|
|
@ -730,26 +730,29 @@ public class OperDefectServiceImpl extends BaseServiceImpl<OperDefectMapper, Ope |
|
|
|
sheet.addMergedRegion(repeat_religon); |
|
|
|
sheet.addMergedRegion(repeat_religon); |
|
|
|
currentRow++; |
|
|
|
currentRow++; |
|
|
|
|
|
|
|
|
|
|
|
//表头2
|
|
|
|
|
|
|
|
CellRangeAddress repeat_head2_cell_religon = new CellRangeAddress(currentRow, currentRow, (short) 0, (short) 2); |
|
|
|
|
|
|
|
sheet.addMergedRegion(repeat_head2_cell_religon); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
HSSFRow repeat_head2 = sheet.createRow(currentRow); |
|
|
|
HSSFRow repeat_head2 = sheet.createRow(currentRow); |
|
|
|
this.setFullHeadCell(wb, repeat_head2, (short) 9, 0); |
|
|
|
this.setFullHeadCell(wb, repeat_head2, (short) 9, 0); |
|
|
|
HSSFCell repeat_head2_cell1 = repeat_head2.getCell(3); |
|
|
|
HSSFCell repeat_head2_cell1 = repeat_head2.getCell(1); |
|
|
|
CellRangeAddress repeat_head2_cell1_religon = new CellRangeAddress(currentRow, currentRow, (short) 3, (short) 4); |
|
|
|
CellRangeAddress repeat_head2_cell1_religon = new CellRangeAddress(currentRow, currentRow, (short) 1, (short) 2); |
|
|
|
sheet.addMergedRegion(repeat_head2_cell1_religon); |
|
|
|
sheet.addMergedRegion(repeat_head2_cell1_religon); |
|
|
|
repeat_head2_cell1.setCellValue("发生数量"); |
|
|
|
repeat_head2_cell1.setCellValue("重复发生数量"); |
|
|
|
|
|
|
|
|
|
|
|
HSSFCell repeat_head2_cell2 = repeat_head2.getCell(5); |
|
|
|
HSSFCell repeat_head2_cell2 = repeat_head2.getCell(3); |
|
|
|
CellRangeAddress repeat_head2_cell2_religon = new CellRangeAddress(currentRow, currentRow, (short) 5, (short) 6); |
|
|
|
CellRangeAddress repeat_head2_cell2_religon = new CellRangeAddress(currentRow, currentRow, (short) 3, (short) 4); |
|
|
|
sheet.addMergedRegion(repeat_head2_cell2_religon); |
|
|
|
sheet.addMergedRegion(repeat_head2_cell2_religon); |
|
|
|
repeat_head2_cell2.setCellValue("占重复缺陷总数的比率(%)"); |
|
|
|
repeat_head2_cell2.setCellValue("占重复缺陷总数的比率(%)"); |
|
|
|
|
|
|
|
|
|
|
|
HSSFCell repeat_head2_cell3 = repeat_head2.getCell(7); |
|
|
|
|
|
|
|
CellRangeAddress repeat_head2_cell3_religon = new CellRangeAddress(currentRow, currentRow, (short) 7, (short) 8); |
|
|
|
HSSFCell repeat_head2_cell3 = repeat_head2.getCell(5); |
|
|
|
|
|
|
|
CellRangeAddress repeat_head2_cell3_religon = new CellRangeAddress(currentRow, currentRow, (short) 5, (short) 6); |
|
|
|
sheet.addMergedRegion(repeat_head2_cell3_religon); |
|
|
|
sheet.addMergedRegion(repeat_head2_cell3_religon); |
|
|
|
repeat_head2_cell3.setCellValue("占总缺陷的比率(%)"); |
|
|
|
repeat_head2_cell3.setCellValue("总发生数量"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
HSSFCell repeat_head2_cell4 = repeat_head2.getCell(7); |
|
|
|
|
|
|
|
CellRangeAddress repeat_head2_cell4_religon = new CellRangeAddress(currentRow, currentRow, (short) 7, (short) 8); |
|
|
|
|
|
|
|
sheet.addMergedRegion(repeat_head2_cell4_religon); |
|
|
|
|
|
|
|
repeat_head2_cell4.setCellValue("占总缺陷的比率(%)"); |
|
|
|
|
|
|
|
|
|
|
|
currentRow++; |
|
|
|
currentRow++; |
|
|
|
|
|
|
|
|
|
|
@ -759,8 +762,6 @@ public class OperDefectServiceImpl extends BaseServiceImpl<OperDefectMapper, Ope |
|
|
|
this.setFullHeadCell(wb, repeat_row, (short) 9, 1); |
|
|
|
this.setFullHeadCell(wb, repeat_row, (short) 9, 1); |
|
|
|
//第一列
|
|
|
|
//第一列
|
|
|
|
HSSFCell repeat_cell1 = repeat_row.getCell(0); |
|
|
|
HSSFCell repeat_cell1 = repeat_row.getCell(0); |
|
|
|
CellRangeAddress repeat_content_religon = new CellRangeAddress(currentRow, currentRow, (short) 0, (short) 2); |
|
|
|
|
|
|
|
sheet.addMergedRegion(repeat_content_religon); |
|
|
|
|
|
|
|
if ("1".equals(repeat.get(i).getDefectLevel())) { |
|
|
|
if ("1".equals(repeat.get(i).getDefectLevel())) { |
|
|
|
repeat_cell1.setCellValue("一类缺陷"); |
|
|
|
repeat_cell1.setCellValue("一类缺陷"); |
|
|
|
} else if ("2".equals(repeat.get(i).getDefectLevel())) { |
|
|
|
} else if ("2".equals(repeat.get(i).getDefectLevel())) { |
|
|
@ -771,22 +772,28 @@ public class OperDefectServiceImpl extends BaseServiceImpl<OperDefectMapper, Ope |
|
|
|
repeat_cell1.setCellValue(repeat.get(i).getDefectLevel()); |
|
|
|
repeat_cell1.setCellValue(repeat.get(i).getDefectLevel()); |
|
|
|
} |
|
|
|
} |
|
|
|
//第二列
|
|
|
|
//第二列
|
|
|
|
HSSFCell repeat_cell2 = repeat_row.getCell(3); |
|
|
|
HSSFCell repeat_cell2 = repeat_row.getCell(1); |
|
|
|
CellRangeAddress repeat_content_religon1 = new CellRangeAddress(currentRow, currentRow, (short) 3, (short) 4); |
|
|
|
CellRangeAddress repeat_content_religon1 = new CellRangeAddress(currentRow, currentRow, (short) 1, (short) 2); |
|
|
|
sheet.addMergedRegion(repeat_content_religon1); |
|
|
|
sheet.addMergedRegion(repeat_content_religon1); |
|
|
|
repeat_cell2.setCellValue(repeat.get(i).getHappenNum()); |
|
|
|
repeat_cell2.setCellValue(repeat.get(i).getHappenNum()); |
|
|
|
|
|
|
|
|
|
|
|
//第三列
|
|
|
|
//第三列
|
|
|
|
HSSFCell repeat_cell3 = repeat_row.getCell(5); |
|
|
|
HSSFCell repeat_cell3 = repeat_row.getCell(3); |
|
|
|
CellRangeAddress repeat_content_religon2 = new CellRangeAddress(currentRow, currentRow, (short) 5, (short) 6); |
|
|
|
CellRangeAddress repeat_content_religon2 = new CellRangeAddress(currentRow, currentRow, (short) 3, (short) 4); |
|
|
|
sheet.addMergedRegion(repeat_content_religon2); |
|
|
|
sheet.addMergedRegion(repeat_content_religon2); |
|
|
|
repeat_cell3.setCellValue(this.dealDouble(repeat.get(i).getRepeatRatio())); |
|
|
|
repeat_cell3.setCellValue(this.dealDouble(repeat.get(i).getRepeatRatio())); |
|
|
|
|
|
|
|
|
|
|
|
//第四列
|
|
|
|
//第四列
|
|
|
|
HSSFCell repeat_cell4 = repeat_row.getCell(7); |
|
|
|
HSSFCell repeat_cell4 = repeat_row.getCell(5); |
|
|
|
CellRangeAddress repeat_content_religon3 = new CellRangeAddress(currentRow, currentRow, (short) 7, (short) 8); |
|
|
|
CellRangeAddress repeat_content_religon3 = new CellRangeAddress(currentRow, currentRow, (short) 5, (short) 6); |
|
|
|
sheet.addMergedRegion(repeat_content_religon3); |
|
|
|
sheet.addMergedRegion(repeat_content_religon3); |
|
|
|
repeat_cell4.setCellValue(this.dealDouble(repeat.get(i).getHappenRatio())); |
|
|
|
repeat_cell4.setCellValue(repeat.get(i).getHappenSumNum()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//第五列
|
|
|
|
|
|
|
|
HSSFCell repeat_cell5 = repeat_row.getCell(7); |
|
|
|
|
|
|
|
CellRangeAddress repeat_content_religon4 = new CellRangeAddress(currentRow, currentRow, (short) 7, (short) 8); |
|
|
|
|
|
|
|
sheet.addMergedRegion(repeat_content_religon4); |
|
|
|
|
|
|
|
repeat_cell5.setCellValue(this.dealDouble(repeat.get(i).getHappenRatio())); |
|
|
|
currentRow++; |
|
|
|
currentRow++; |
|
|
|
} |
|
|
|
} |
|
|
|
return currentRow; |
|
|
|
return currentRow; |
|
|
@ -944,7 +951,7 @@ public class OperDefectServiceImpl extends BaseServiceImpl<OperDefectMapper, Ope |
|
|
|
List<String> deptList ; |
|
|
|
List<String> deptList ; |
|
|
|
R<List<Dept>> res = sysClient.getDeptByCurrentUser(); |
|
|
|
R<List<Dept>> res = sysClient.getDeptByCurrentUser(); |
|
|
|
if (res.isSuccess() && CollectionUtil.isNotEmpty(res.getData())) { |
|
|
|
if (res.isSuccess() && CollectionUtil.isNotEmpty(res.getData())) { |
|
|
|
deptList = res.getData().stream().map(Dept::getId).map(s -> s.toString()).collect(Collectors.toList()); |
|
|
|
deptList = res.getData().stream().map(Dept::getId).map(Object::toString).collect(Collectors.toList()); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
throw new WebServiceException("该用户没有此权限"); |
|
|
|
throw new WebServiceException("该用户没有此权限"); |
|
|
|
} |
|
|
|
} |
|
|
@ -961,35 +968,46 @@ public class OperDefectServiceImpl extends BaseServiceImpl<OperDefectMapper, Ope |
|
|
|
//总缺陷数
|
|
|
|
//总缺陷数
|
|
|
|
int total = repetStatistics.stream().mapToInt(OperDefectStatisticsCodeDTO::getDefectNum).sum(); |
|
|
|
int total = repetStatistics.stream().mapToInt(OperDefectStatisticsCodeDTO::getDefectNum).sum(); |
|
|
|
//总重复缺陷数
|
|
|
|
//总重复缺陷数
|
|
|
|
int totalRepeat = repetStatistics.stream().filter(s -> s.getDefectNum() > 1 && s.getDefectLevel() != null).collect(Collectors.summingInt(OperDefectStatisticsCodeDTO::getDefectNum)); |
|
|
|
int totalRepeat = repetStatistics.stream().filter(s -> s.getDefectNum() > 1 && s.getDefectLevel() != null).mapToInt(OperDefectStatisticsCodeDTO::getDefectNum).sum(); |
|
|
|
//等级重复统计
|
|
|
|
//等级重复统计
|
|
|
|
Map<String, IntSummaryStatistics> repeatList = repetStatistics.stream().filter(s -> s.getDefectNum() > 1 && s.getDefectLevel() != null).collect(Collectors.groupingBy(OperDefectStatisticsCodeDTO::getDefectLevel, Collectors.summarizingInt(OperDefectStatisticsCodeDTO::getDefectNum))); |
|
|
|
Map<String, IntSummaryStatistics> repeatList = repetStatistics.stream().filter(s -> s.getDefectNum() > 1 && s.getDefectLevel() != null).collect(Collectors.groupingBy(OperDefectStatisticsCodeDTO::getDefectLevel, Collectors.summarizingInt(OperDefectStatisticsCodeDTO::getDefectNum))); |
|
|
|
|
|
|
|
//缺陷等级分类总数统计
|
|
|
|
|
|
|
|
Map<String, IntSummaryStatistics> sums = repetStatistics.stream().collect(Collectors.groupingBy(OperDefectStatisticsCodeDTO::getDefectLevel, Collectors.summarizingInt(OperDefectStatisticsCodeDTO::getDefectNum))); |
|
|
|
|
|
|
|
|
|
|
|
OperDefectRepeatRatioDTO one = new OperDefectRepeatRatioDTO(); |
|
|
|
OperDefectRepeatRatioDTO one = new OperDefectRepeatRatioDTO(); |
|
|
|
one.setDefectLevel(DefectConstant.DefectLevelEnum.ONE.getStatus()); |
|
|
|
one.setDefectLevel(DefectConstant.DefectLevelEnum.ONE.getStatus()); |
|
|
|
if (repeatList.get(one.getDefectLevel()) != null) { |
|
|
|
if (repeatList.get(one.getDefectLevel()) != null) { |
|
|
|
one.setHappenNum(repeatList.get(one.getDefectLevel()).getSum()); |
|
|
|
one.setHappenNum(repeatList.get(one.getDefectLevel()).getSum()); |
|
|
|
one.setHappenRatio(one.getHappenNum() / Double.valueOf(total)); |
|
|
|
one.setRepeatRatio(one.getHappenNum() / (double) totalRepeat); |
|
|
|
one.setRepeatRatio(one.getHappenNum() / Double.valueOf(totalRepeat)); |
|
|
|
} |
|
|
|
|
|
|
|
if(sums.containsKey(one.getDefectLevel())){ |
|
|
|
|
|
|
|
one.setHappenSumNum(sums.get(one.getDefectLevel()).getSum()); |
|
|
|
|
|
|
|
one.setHappenRatio(one.getHappenSumNum() / (double) total); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
OperDefectRepeatRatioDTO two = new OperDefectRepeatRatioDTO(); |
|
|
|
OperDefectRepeatRatioDTO two = new OperDefectRepeatRatioDTO(); |
|
|
|
two.setDefectLevel(DefectConstant.DefectLevelEnum.TWO.getStatus()); |
|
|
|
two.setDefectLevel(DefectConstant.DefectLevelEnum.TWO.getStatus()); |
|
|
|
if (repeatList.get(two.getDefectLevel()) != null) { |
|
|
|
if (repeatList.get(two.getDefectLevel()) != null) { |
|
|
|
two.setHappenNum(repeatList.get(two.getDefectLevel()).getSum()); |
|
|
|
two.setHappenNum(repeatList.get(two.getDefectLevel()).getSum()); |
|
|
|
two.setHappenRatio(two.getHappenNum() / Double.valueOf(total)); |
|
|
|
two.setRepeatRatio(two.getHappenNum() / (double) totalRepeat); |
|
|
|
two.setRepeatRatio(two.getHappenNum() / Double.valueOf(totalRepeat)); |
|
|
|
} |
|
|
|
|
|
|
|
if(sums.containsKey(two.getDefectLevel())){ |
|
|
|
|
|
|
|
two.setHappenSumNum(sums.get(two.getDefectLevel()).getSum()); |
|
|
|
|
|
|
|
two.setHappenRatio(two.getHappenSumNum() / (double) total); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
OperDefectRepeatRatioDTO three = new OperDefectRepeatRatioDTO(); |
|
|
|
OperDefectRepeatRatioDTO three = new OperDefectRepeatRatioDTO(); |
|
|
|
three.setDefectLevel(DefectConstant.DefectLevelEnum.THREE.getStatus()); |
|
|
|
three.setDefectLevel(DefectConstant.DefectLevelEnum.THREE.getStatus()); |
|
|
|
if (repeatList.get(three.getDefectLevel()) != null) { |
|
|
|
if (repeatList.get(three.getDefectLevel()) != null) { |
|
|
|
three.setHappenNum(repeatList.get(three.getDefectLevel()).getSum()); |
|
|
|
three.setHappenNum(repeatList.get(three.getDefectLevel()).getSum()); |
|
|
|
three.setHappenRatio(three.getHappenNum() / Double.valueOf(total)); |
|
|
|
three.setRepeatRatio(three.getHappenNum() / (double) totalRepeat); |
|
|
|
three.setRepeatRatio(three.getHappenNum() / Double.valueOf(totalRepeat)); |
|
|
|
} |
|
|
|
|
|
|
|
if(sums.containsKey(three.getDefectLevel())){ |
|
|
|
|
|
|
|
three.setHappenSumNum(sums.get(three.getDefectLevel()).getSum()); |
|
|
|
|
|
|
|
three.setHappenRatio(three.getHappenSumNum() / (double) total); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
OperDefectRepeatRatioDTO addUp = OperDefectRepeatRatioDTO.builder().defectLevel("合计").happenNum(one.getHappenNum() + two.getHappenNum() + three.getHappenNum()).happenRatio(one.getHappenRatio() + two.getHappenRatio() + three.getHappenRatio()).repeatRatio(1.00).build(); |
|
|
|
OperDefectRepeatRatioDTO addUp = OperDefectRepeatRatioDTO.builder().defectLevel("合计").happenNum(one.getHappenNum() + two.getHappenNum() + three.getHappenNum()).happenSumNum(one.getHappenSumNum() + two.getHappenSumNum() + three.getHappenSumNum()).happenRatio(1.0).repeatRatio(1.00).build(); |
|
|
|
if (addUp.getHappenNum().equals(0L)) { |
|
|
|
if (addUp.getHappenNum().equals(0L)) { |
|
|
|
addUp.setRepeatRatio(0.0); |
|
|
|
addUp.setRepeatRatio(0.0); |
|
|
|
} |
|
|
|
} |
|
|
|