inspect-server/src/main/java/com/yuanchu/mom/controller/InsOrderController.java
@@ -142,6 +142,15 @@ CostStatisticsDto costStatisticsDto = JackSonUtil.unmarshal(JackSonUtil.marshal(data.get("entity")), CostStatisticsDto.class); return Result.success(insOrderService.costStatistics(page, costStatisticsDto)); } @ValueAuth @ApiOperation(value = "费用统计获取总价") @PostMapping("/costStatistics2") public Result<?> costStatistics2(@RequestBody Map<String, Object> data) throws Exception { CostStatisticsDto costStatisticsDto = JackSonUtil.unmarshal(JackSonUtil.marshal(data.get("entity")), CostStatisticsDto.class); return Result.success(insOrderService.costStatistics2(costStatisticsDto)); } @ValueClassify("统计图表") @ApiOperation(value = "样品缺陷指数") @PostMapping("/selectSampleDefects") inspect-server/src/main/java/com/yuanchu/mom/mapper/InsOrderMapper.java
@@ -35,6 +35,8 @@ IPage<CostStatisticsDto> selectCostStatistics(IPage<CostStatisticsDto> page, QueryWrapper<CostStatisticsDto> ew); List<CostStatisticsDto> selectCostStatistics2(@Param("ew") QueryWrapper<CostStatisticsDto> ew); List<Map<String, String>> selectDeviceList(Set<String> names); List<SampleDefectsFatherVo> selectSampleDefects(Page page, @Param("inspectionItems") String inspectionItems, @Param("orderNumber") String orderNumber); inspect-server/src/main/java/com/yuanchu/mom/service/InsOrderService.java
@@ -34,6 +34,8 @@ Map<String, Object> costStatistics(IPage<CostStatisticsDto> page, CostStatisticsDto costStatisticsDto); Map<String, Object> costStatistics2(CostStatisticsDto costStatisticsDto); Map<String, Object> selectSampleDefects(Page page, String inspectionItems, String orderNumber); int updateStatus(Integer id); inspect-server/src/main/java/com/yuanchu/mom/service/impl/InsOrderPlanServiceImpl.java
@@ -914,8 +914,9 @@ for (long i = 0; i < size; i++) { if (i % number == 0) { List<RowRenderData> rows = new ArrayList<>(); //表格的行数 √ ✖ ✔ for (int j = 0; j < number + 3; j++) { //表格的行数 × √ ✖ ✔ long count1 = size-(index-1)*number < number ? size-(index-1)*number + 3 : number + 3; for (int j = 0; j <count1 ; j++) { RowRenderData rowRenderData = new RowRenderData(); RowStyle rowStyle = new RowStyle(); rowStyle.setHeight(40); @@ -957,7 +958,6 @@ cellRenderData.setParagraphs(paragraphRenderDataList); cells.add(cellRenderData); } } else if (j == 1) { //第二行 @@ -1003,7 +1003,7 @@ cells.add(cellRenderData); } } else if (j == number + 2) { else if (j == count1-1) { //最后一行 if (k == 0 || k == 1) { //前两列 @@ -1014,7 +1014,7 @@ cellRenderData.setParagraphs(paragraphRenderDataList); cells.add(cellRenderData); } else { textRenderData.setText("“✔”表示项目合格,“✖”表示项目不合格@“✔”indicates test Item is qualified,“✖”indicates test Item is unqualified∑19"); textRenderData.setText("“√”表示项目合格,“×”表示项目不合格@“√”indicates test Item is qualified,“×”indicates test Item is unqualified∑19"); renderData.add(textRenderData); paragraphRenderData.setContents(renderData); paragraphRenderDataList.add(paragraphRenderData); @@ -1031,10 +1031,14 @@ paragraphRenderDataList.add(paragraphRenderData); cellRenderData.setParagraphs(paragraphRenderDataList); cells.add(cellRenderData); } else if (k == 1) { } else if (k == 1) { //第二列 String insProduct = filteredProducts.get((int) ((j - 2) + 10 * (index - 1))); String insProduct; try { insProduct = filteredProducts.get((int) ((j - 2) + 10 * (index - 1))); } catch (Exception e) { continue; } String[] split = insProduct.split(","); if (ObjectUtils.isEmpty(split[1]) || split[1].equals("")) { textRenderData.setText(split[0]); @@ -1046,11 +1050,15 @@ paragraphRenderDataList.add(paragraphRenderData); cellRenderData.setParagraphs(paragraphRenderDataList); cells.add(cellRenderData); } else if (k == 2) { } else if (k == 2) { //第三列 //先判断检验项是否有子类 String insProduct = filteredProducts.get((int) ((j - 2) + 10 * (index - 1))); String insProduct; try { insProduct = filteredProducts.get((int) ((j - 2) + 10 * (index - 1))); } catch (Exception e) { continue; } String[] split = insProduct.split(","); if (ObjectUtils.isEmpty(split[2]) || split[2].equals("")) { //如果没有子类 @@ -1069,11 +1077,15 @@ paragraphRenderDataList.add(paragraphRenderData); cellRenderData.setParagraphs(paragraphRenderDataList); cells.add(cellRenderData); } else if (k == 3) { } else if (k == 3) { //第四列 //先判断检验项是否有子类 String insProduct = filteredProducts.get((int) ((j - 2) + 10 * (index - 1))); String insProduct; try { insProduct = filteredProducts.get((int) ((j - 2) + 10 * (index - 1))); } catch (Exception e) { continue; } String[] split = insProduct.split(","); if (ObjectUtils.isEmpty(split[2]) || split[2].equals("")) { //如果没有子类 @@ -1087,10 +1099,14 @@ paragraphRenderDataList.add(paragraphRenderData); cellRenderData.setParagraphs(paragraphRenderDataList); cells.add(cellRenderData); } else if (k == 4) { } else if (k == 4) { //第五列 String insProduct = filteredProducts.get((int) ((j - 2) + 10 * (index - 1))); String insProduct; try { insProduct = filteredProducts.get((int) ((j - 2) + 10 * (index - 1))); } catch (Exception e) { continue; } String[] split = insProduct.split(","); //查询所有样品该检验项的检验结果(最终值) List<InsProduct> products = insProductMapper.selectList(Wrappers.<InsProduct>lambdaQuery() @@ -1105,16 +1121,20 @@ Optional<String> min = products.stream().map(InsProduct::getLastValue) .filter(value -> !value.isEmpty()) .min(String::compareTo); textRenderData.setText(min+"-"+max);//检验结果 textRenderData.setText(min.get() + "-" + max.get());//检验结果 renderData.add(textRenderData); paragraphRenderData.setContents(renderData); paragraphRenderDataList.add(paragraphRenderData); cellRenderData.setParagraphs(paragraphRenderDataList); cells.add(cellRenderData); } else { } else { //最后一列 String insProduct = filteredProducts.get((int) ((j - 2) + 10 * (index - 1))); String insProduct; try { insProduct = filteredProducts.get((int) ((j - 2) + 10 * (index - 1))); } catch (Exception e) { continue; } String[] split = insProduct.split(","); //查询所有样品该检验项的检验结论(ins_result) List<InsProduct> products = insProductMapper.selectList(Wrappers.<InsProduct>lambdaQuery() @@ -1125,10 +1145,10 @@ List<Integer> result = products.stream().map(InsProduct::getInsResult).distinct().collect(Collectors.toList()); if (result.size() == 1 && result.contains(1)) { //合格 textRenderData.setText("✔"); textRenderData.setText("√"); }else { //不合格 textRenderData.setText("✖"); textRenderData.setText("×"); } renderData.add(textRenderData); paragraphRenderData.setContents(renderData); @@ -1152,7 +1172,7 @@ } System.out.println("");*/ if (row.getCells().size() != countSize) { throw new ErrorException("每行单元格不相等"); throw new ErrorException("每行单元格不相等1"); } } TableStyle tableStyle = new TableStyle(); @@ -1214,10 +1234,14 @@ paragraphRenderDataList.add(paragraphRenderData); cellRenderData.setParagraphs(paragraphRenderDataList); cells.add(cellRenderData); } else { } else { //第二列 String product = filteredProducts.get((int) ((k - 1) + (index4 - 1) * 7)); String product; try { product = filteredProducts.get((int) ((k - 1) + (index4 - 1) * 7)); } catch (Exception e) { continue; } String[] split = product.split(","); if (ObjectUtils.isEmpty(split[2])||split[2].equals("")){ if (ObjectUtils.isEmpty(split[1]) || split[1].equals("")){ @@ -1238,8 +1262,7 @@ cellRenderData.setParagraphs(paragraphRenderDataList); cells.add(cellRenderData); } } else if (i==1){ } else if (i == 1) { //第二行 if (k==0){ //第一列 @@ -1249,10 +1272,14 @@ paragraphRenderDataList.add(paragraphRenderData); cellRenderData.setParagraphs(paragraphRenderDataList); cells.add(cellRenderData); } else { } else { //第二列 String product = filteredProducts.get((int) ((k - 1) + (index4 - 1) * 7)); String product; try { product = filteredProducts.get((int) ((k - 1) + (index4 - 1) * 7)); } catch (Exception e) { continue; } String[] split = product.split(","); if (ObjectUtils.isEmpty(split[2])||split[2].equals("")){ if (ObjectUtils.isEmpty(split[1]) || split[1].equals("")){ @@ -1273,8 +1300,7 @@ cellRenderData.setParagraphs(paragraphRenderDataList); cells.add(cellRenderData); } } else { } else { if (k==0){ //第一列 textRenderData.setText(samples.get(i-2).getSampleCode()); @@ -1283,10 +1309,14 @@ paragraphRenderDataList.add(paragraphRenderData); cellRenderData.setParagraphs(paragraphRenderDataList); cells.add(cellRenderData); } else { } else { //根据样品编号和项目去查询最终值 String product = filteredProducts.get((int) ((k - 1) + (index4 - 1) * 7)); String product; try { product = filteredProducts.get((int) ((k - 1) + (index4 - 1) * 7)); } catch (Exception e) { continue; } String[] split = product.split(","); InsProduct insProduct = insProductMapper.selectOne(Wrappers.<InsProduct>lambdaQuery() .eq(InsProduct::getState, 1) @@ -1327,7 +1357,7 @@ } System.out.println("");*/ if (row.getCells().size() != countSize) { throw new ErrorException("每行单元格不相等"); throw new ErrorException("每行单元格不相等2"); } } TableStyle tableStyle = new TableStyle(); @@ -1355,12 +1385,14 @@ List<InsSample> sampleList = insSamples.stream().filter(insSample -> insSample.getSampleCode().contains("/")).collect(Collectors.toList()); //过滤出光纤接头损耗的检验项目 List<String> strings = filteredProducts.stream().filter(s -> s.contains("光纤接头损耗")).distinct().collect(Collectors.toList()); long index41 = 1; for (int i = 0; i < sampleList.size(); i++) { if (i%16==0){ //样品数量超过16需要新增表格 List<RowRenderData> rows = new ArrayList<>(); int count2 = sampleList.size()-(index41-1)*16 < 16 ? (int) (sampleList.size() - (index41 - 1) * 16 + 1) : 17; //表格的行数 for (int j = 0; j < 17; j++) { for (int j = 0; j < count2; j++) { RowRenderData rowRenderData = new RowRenderData(); RowStyle rowStyle = new RowStyle(); rowStyle.setHeight(40); @@ -1418,14 +1450,13 @@ else { if (k==0){ //第一列 textRenderData.setText(sampleList.get(0).getSampleCode()+"∑44"); textRenderData.setText(sampleList.get(0).getModel() + "∑44"); renderData.add(textRenderData); paragraphRenderData.setContents(renderData); paragraphRenderDataList.add(paragraphRenderData); cellRenderData.setParagraphs(paragraphRenderDataList); cells.add(cellRenderData); } else if (k==1){ } else if (k == 1) { //第二列 textRenderData.setText(sampleList.get(j-1).getSampleCode().split("/")[0]); renderData.add(textRenderData); @@ -1433,8 +1464,7 @@ paragraphRenderDataList.add(paragraphRenderData); cellRenderData.setParagraphs(paragraphRenderDataList); cells.add(cellRenderData); } else if (k==2){ } else if (k == 2) { //第三列 textRenderData.setText(sampleList.get(j-1).getSampleCode().split("/")[1]); renderData.add(textRenderData); @@ -1442,8 +1472,7 @@ paragraphRenderDataList.add(paragraphRenderData); cellRenderData.setParagraphs(paragraphRenderDataList); cells.add(cellRenderData); } else { } else { //根据对应的样品编号和检验项目查询对应数据(最终值) String[] split = strings.get(k - 3).split(","); InsProduct insProduct = insProductMapper.selectOne(Wrappers.<InsProduct>lambdaQuery() @@ -1474,7 +1503,7 @@ } System.out.println("");*/ if (row.getCells().size() != countSize) { throw new ErrorException("每行单元格不相等"); throw new ErrorException("每行单元格不相等3"); } } TableStyle tableStyle = new TableStyle(); @@ -1495,6 +1524,7 @@ table.put("index4", index4+1); tables4.add(table); index4++; index41++; } } tables4.forEach(table4 -> { @@ -1762,7 +1792,7 @@ } System.out.println("");*/ if (row.getCells().size() != countSize) { throw new ErrorException("每行单元格不相等"); throw new ErrorException("每行单元格不相等4"); } } TableStyle tableStyle = new TableStyle(); @@ -2200,8 +2230,7 @@ if (rowRenderData.getCells().size() != 0) { rows.add(rowRenderData); } } else { } else { //如果有多次循环 if (i == 0) { //第一次循环的列数,那么列数包括20℃常温(2 * (size-nm.size()) -nm.size()+1) @@ -3044,7 +3073,7 @@ } System.out.println("");*/ if (row.getCells().size() != countSize) { throw new ErrorException("每行单元格不相等"); throw new ErrorException("每行单元格不相等5"); } } TableStyle tableStyle = new TableStyle(); inspect-server/src/main/java/com/yuanchu/mom/service/impl/InsOrderServiceImpl.java
@@ -404,6 +404,21 @@ } @Override public Map<String, Object> costStatistics2(CostStatisticsDto costStatisticsDto) { Map<String, Object> map = new HashMap<>(); String dates = costStatisticsDto.getDates(); String[] split = dates.replaceAll("\\[", "").replaceAll("]", "").replaceAll("\"", "").split(","); costStatisticsDto.setDates(null); List<CostStatisticsDto> costStatisticsDtos = insOrderMapper.selectCostStatistics2(QueryWrappers.queryWrappers(costStatisticsDto).ge("create_time", split[0]).le("create_time", split[1] + " 23:59:59")); double totalPrice = costStatisticsDtos.stream() .filter(dto -> dto.getPrice() != null) // 过滤掉价格为 null 的对象 .mapToDouble(value -> value.getPrice().doubleValue()) .sum(); map.put("total",totalPrice); return map; } @Override public Map<String, Object> selectSampleDefects(Page page, String inspectionItems, String orderNumber) { List<SampleDefectsFatherVo> sampleDefectsFatherVos = insOrderMapper.selectSampleDefects(page, inspectionItems, orderNumber); Map<String, Object> map = new HashMap<>(); inspect-server/src/main/resources/mapper/InsOrderMapper.xml
@@ -300,4 +300,35 @@ and ins_sample_id in (select id from ins_sample where ins_order_id = #{id})) </select> <select id="selectCostStatistics2" resultType="com.yuanchu.mom.dto.CostStatisticsDto"> select * from ( SELECT i.id, i.entrust_code, i.create_time, isa.sample, isa.model, c.price, c.cost, c.inspection_item, u.company, u.`name`, i.create_user, c.ins_sample_id FROM ins_order i LEFT JOIN ins_sample isa ON isa.ins_order_id = i.id LEFT JOIN `user` u ON u.id = i.user_id LEFT JOIN (select SUM(b.price) price, sum(b.man_hour) cost,b.ins_sample_id,GROUP_CONCAT(b.inspection_item2 SEPARATOR ',') inspection_item from (select *,GROUP_CONCAT(inspection_item SEPARATOR ',') inspection_item2 from ins_product where state = 1 GROUP BY ins_sample_id,man_hour_group) b GROUP BY b.ins_sample_id) c ON c.ins_sample_id = isa.id where (i.state = 1 or i.state = 3 or i.state = 4) ) a <if test="ew.customSqlSegment != null and ew.customSqlSegment != ''"> ${ew.customSqlSegment} </if> </select> </mapper> performance-server/src/main/java/com/yuanchu/mom/service/impl/AuxiliaryCorrectionHoursServiceImpl.java
@@ -96,6 +96,9 @@ } } } if (ids.size()==0){ ids=null; } map.put("body", auxiliaryCorrectionHoursMapper.selectAuxiliaryCorrectionHours(page, QueryWrappers.queryWrappers(auxiliaryCorrectionHoursDto).eq("month", auxiliaryCorrectionHoursDto.getMonth()), ids)); return map; } performance-server/src/main/java/com/yuanchu/mom/service/impl/AuxiliaryOriginalHoursServiceImpl.java
@@ -102,6 +102,9 @@ ids.clear(); ids.add(userMapper.selectOne(Wrappers.<User>lambdaQuery().like(User::getName, name)).getId()); } if (ids.size()==0){ ids=null; } IPage<AuxiliaryOriginalHoursDto> originalHoursDtoIPage = new Page<>(); originalHoursDtoIPage.setSize(page.getSize()); originalHoursDtoIPage.setCurrent(page.getCurrent()); performance-server/src/main/java/com/yuanchu/mom/service/impl/AuxiliaryOutputWorkingHoursServiceImpl.java
@@ -90,6 +90,9 @@ ids.addAll(users.stream().map(User::getId).distinct().collect(Collectors.toList())); } } if (ids.size()==0){ ids=null; } if (ObjectUtils.isNotEmpty(dates) && ObjectUtils.isNotEmpty(week)){ String[] split = dates.replaceAll("\\[", "").replaceAll("]", "").replaceAll("\"", "").split(","); String[] weeks = week.replaceAll("\\[", "").replaceAll("]", "").replaceAll("\"", "").split(","); performance-server/src/main/java/com/yuanchu/mom/service/impl/AuxiliaryWorkingHoursDayServiceImpl.java
@@ -86,6 +86,9 @@ ids.addAll(users.stream().map(User::getId).distinct().collect(Collectors.toList())); } } if (ids.size()==0){ ids=null; } if (ObjectUtils.isNotEmpty(dates) && ObjectUtils.isNotEmpty(week)) { String[] split = dates.replaceAll("\\[", "").replaceAll("]", "").replaceAll("\"", "").split(","); String[] weeks = week.replaceAll("\\[", "").replaceAll("]", "").replaceAll("\"", "").split(","); performance-server/src/main/resources/mapper/AuxiliaryCorrectionHoursMapper.xml
@@ -49,13 +49,13 @@ select ach.*,name FROM auxiliary_correction_hours ach left join user on user.id=ach.name_user WHERE name_user in(#{ids}) <!--<if test="ids !=null and ids != ''"> WHERE name_user in WHERE 1=1 <if test="ids !=null and ids != ''"> and name_user in <foreach collection="ids" index="index" open="(" separator="," close=")" item="val"> #{val} </foreach> </if>--> </if> ) A <if test="ew.customSqlSegment != null and ew.customSqlSegment != ''"> ${ew.customSqlSegment} performance-server/src/main/resources/mapper/AuxiliaryOriginalHoursMapper.xml
@@ -18,13 +18,13 @@ left join department_lims dl on depart_lims_id = dl.id where date_time LIKE CONCAT('%', #{month}, '%') and awhd.state='已批准' and name_user in(#{ids}) <!-- <if test="ids !=null and ids != ''"> <!--and name_user in(#{ids})--> <if test="ids !=null and ids != ''"> and name_user in <foreach collection="ids" index="index" open="(" separator="," close=")" item="val"> #{val} </foreach> </if>--> </if> order by month ) A group by A.name, A.month) C @@ -40,13 +40,13 @@ left join user on user.id = aowh.`check` left join department_lims dl on depart_lims_id = dl.id where date_time LIKE CONCAT('%', #{month}, '%') and `check` in(#{ids}) <!--<if test="ids !=null and ids != ''"> <!--and `check` in(#{ids})--> <if test="ids !=null and ids != ''"> and `check` in <foreach collection="ids" index="index" open="(" separator="," close=")" item="val"> #{val} </foreach> </if>--> </if> group by user.name, month order by user.name, month ) B performance-server/src/main/resources/mapper/AuxiliaryOutputWorkingHoursMapper.xml
@@ -39,13 +39,13 @@ name FROM auxiliary_output_working_hours aowh left join user on user.id=aowh.`check` WHERE `check` in(#{ids}) <!--<if test="ids !=null and ids != ''"> WHERE `check` in WHERE 1=1 <if test="ids !=null and ids != ''"> and `check` in <foreach collection="ids" index="index" open="(" separator="," close=")" item="val"> #{val} </foreach> </if>--> </if> ) A <if test="ew.customSqlSegment != null and ew.customSqlSegment != ''"> ${ew.customSqlSegment} @@ -55,13 +55,13 @@ select aowh.*,name FROM auxiliary_output_working_hours aowh left join user on user.id=aowh.`check` WHERE `check` in(#{ids}) <!-- <if test="ids !=null and ids != ''"> WHERE `check` in WHERE 1=1 <if test="ids !=null and ids != ''"> and `check` in <foreach collection="ids" index="index" open="(" separator="," close=")" item="val"> #{val} </foreach> </if>--> </if> </select> <select id="totalHours" resultType="java.util.Map"> select A.name, @@ -75,13 +75,13 @@ left join user on user.id=aowh.`check` left join department_lims dl on depart_lims_id=dl.id where date_time LIKE CONCAT('%', #{month}, '%') and `check` in (#{ids}) <!--<if test="ids !=null and ids != ''"> and `check` in (#ids) <!--and `check` in (#{ids})--> <if test="ids !=null and ids != ''"> and `check` in <foreach collection="ids" open="(" separator="," close=")" item="val"> #{val} </foreach> </if>--> </if> group by user.name,date_time order by user.name,date_time )A @@ -89,12 +89,12 @@ <select id="selectListByIds" resultType="com.yuanchu.mom.pojo.AuxiliaryOutputWorkingHours"> select * from auxiliary_output_working_hours where 1=1 and `check` in(#{ids}) <!--<if test="ids !=null and ids != ''"> <!--and `check` in(#{ids})--> <if test="ids !=null and ids != ''"> and `check` in <foreach collection="ids" index="index" open="(" separator="," close=")" item="val"> #{val} </foreach> </if>--> </if> </select> </mapper> performance-server/src/main/resources/mapper/AuxiliaryWorkingHoursDayMapper.xml
@@ -31,13 +31,13 @@ select awhd.*,name FROM auxiliary_working_hours_day awhd left join user on name_user=user.id WHERE name_user in(#{ids}) <!--<if test="ids !=null and ids != ''"> WHERE name_user in WHERE 1=1 <if test="ids !=null and ids != ''"> and name_user in <foreach collection="ids" index="index" open="(" separator="," close=")" item="val"> #{val} </foreach> </if>--> </if> ) A <if test="ew.customSqlSegment != null and ew.customSqlSegment != ''"> ${ew.customSqlSegment} @@ -47,24 +47,24 @@ select awhd.*,name FROM auxiliary_working_hours_day awhd left join user on name_user=user.id WHERE name_user in(#{ids}) <!--<if test="ids !=null and ids != ''"> WHERE name_user in <foreach collection="ids" index="index" open="(" separator="," close=")" item="val"> #{val} </foreach> </if>--> </select> <select id="selectListByIds" resultType="com.yuanchu.mom.pojo.AuxiliaryWorkingHoursDay"> select * from auxiliary_working_hours_day where 1=1 and name_user in(#{ids}) <!-- <if test="ids !=null and ids != ''"> WHERE 1=1 <if test="ids !=null and ids != ''"> and name_user in <foreach collection="ids" index="index" open="(" separator="," close=")" item="val"> #{val} </foreach> </if>--> </if> </select> <select id="selectListByIds" resultType="com.yuanchu.mom.pojo.AuxiliaryWorkingHoursDay"> select * from auxiliary_working_hours_day where 1=1 <if test="ids !=null and ids != ''"> and name_user in <foreach collection="ids" index="index" open="(" separator="," close=")" item="val"> #{val} </foreach> </if> </select> <select id="totalHours" resultType="java.util.Map"> select A.name, @@ -80,13 +80,12 @@ left join department_lims dl on depart_lims_id=dl.id where date_time LIKE CONCAT('%', #{month}, '%') and awhd.state='已批准' and name_user in (#{ids}) <!-- <if test="ids !=null and ids != ''"> <if test="ids !=null and ids != ''"> and name_user in <foreach collection="ids" index="index" open="(" separator="," close=")" item="val"> #{val} </foreach> </if>--> </if> order by month,user.name )A group by A.name,A.month