diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/AreaMonthReportServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/AreaMonthReportServiceImpl.java index b839e30..7f3e1cc 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/AreaMonthReportServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/AreaMonthReportServiceImpl.java @@ -416,10 +416,10 @@ public class AreaMonthReportServiceImpl implements IAreaMonthReportService { wrapper.eq(OperPhenomenonEntity::getDiscriminateStatus, TreatMethodConstant.AUTO_SCREENED); wrapper.in(OperPhenomenonEntity::getCreateDept, deptIds); List monPhenomenonList = operPhenomenonService.list(wrapper); - monPhenomenonList = monPhenomenonList.stream().filter(s -> s.getDefectGrading() != null).collect(Collectors.toList()); + monPhenomenonList = monPhenomenonList.stream().filter(s -> s.getDefectLevel() != null).collect(Collectors.toList()); List monConclusionList = monPhenomenonList.stream().filter(s -> "1".equals(s.getConclusionStatus())).collect(Collectors.toList()); // 只填写二类及以上缺陷 - List monConclusionListByDefectGrading = monConclusionList.stream().filter(s -> !"1".equals(s.getDefectGrading())).sorted(Comparator.comparing(OperPhenomenonEntity::getCreateDept).reversed().thenComparing(OperPhenomenonEntity::getDefectGrading)).collect(Collectors.toList()); + List monConclusionListByDefectGrading = monConclusionList.stream().filter(s -> !"1".equals(s.getDefectLevel())).sorted(Comparator.comparing(OperPhenomenonEntity::getCreateDept).reversed().thenComparing(OperPhenomenonEntity::getDefectLevel)).collect(Collectors.toList()); // 各电站缺陷处理统计表 ArrayList> checkList = new ArrayList<>(); for (OperPhenomenonEntity operPhenomenonEntity : monConclusionListByDefectGrading) { @@ -432,13 +432,13 @@ public class AreaMonthReportServiceImpl implements IAreaMonthReportService { HashMap temp = new HashMap<>(); temp.put("name", createDeptName.getData()); String checkLevel=""; - if("1".equals(operPhenomenonEntity.getDefectGrading())) { + if("1".equals(operPhenomenonEntity.getDefectLevel())) { checkLevel="Ⅰ级缺陷"; } - if("2".equals(operPhenomenonEntity.getDefectGrading()) ){ + if("2".equals(operPhenomenonEntity.getDefectLevel()) ){ checkLevel="Ⅱ级缺陷"; } - if("3".equals(operPhenomenonEntity.getDefectGrading()) ){ + if("3".equals(operPhenomenonEntity.getDefectLevel()) ){ checkLevel="Ⅲ级缺陷"; } temp.put("level", checkLevel); @@ -460,7 +460,7 @@ public class AreaMonthReportServiceImpl implements IAreaMonthReportService { wrapperYear.eq(OperPhenomenonEntity::getDiscriminateStatus, TreatMethodConstant.AUTO_SCREENED); wrapperYear.in(OperPhenomenonEntity::getCreateDept, deptIds); List yearPhenomenonEntities = operPhenomenonService.list(wrapperYear); - yearPhenomenonEntities = yearPhenomenonEntities.stream().filter(s -> StringUtil.isNotBlank(s.getDefectGrading())).filter(s -> ObjectUtil.isNotEmpty(s.getCreateDept())).collect(Collectors.toList()); + yearPhenomenonEntities = yearPhenomenonEntities.stream().filter(s -> StringUtil.isNotBlank(s.getDefectLevel())).filter(s -> ObjectUtil.isNotEmpty(s.getCreateDept())).collect(Collectors.toList()); List yearConclusionList = yearPhenomenonEntities.stream().filter(s -> "1".equals(s.getConclusionStatus())).collect(Collectors.toList()); ArrayList> checkStatistics = new ArrayList<>(); @@ -480,7 +480,7 @@ public class AreaMonthReportServiceImpl implements IAreaMonthReportService { } else { Map>> phenomenonMap = yearPhenomenonEntities.stream().collect( Collectors.groupingBy(OperPhenomenonEntity::getCreateDept, - Collectors.groupingBy(OperPhenomenonEntity::getDefectGrading))); + Collectors.groupingBy(OperPhenomenonEntity::getDefectLevel))); for (Map.Entry>> deptMapEntry : phenomenonMap.entrySet()) { R deptName1 = sysClient.getDeptName(deptMapEntry.getKey()); for (Map.Entry> levelList : deptMapEntry.getValue().entrySet()) { @@ -488,26 +488,26 @@ public class AreaMonthReportServiceImpl implements IAreaMonthReportService { int shortagesYear = (int) levelList.getValue().stream().filter(s -> "1".equals(s.getConclusionStatus())).count(); double shortagesRate = 0d; if (findShortagesYear != 0 && shortagesYear != 0) { - shortagesRate = BigDecimal.valueOf(shortagesYear).divide(BigDecimal.valueOf(findShortagesYear), 2, RoundingMode.UP).doubleValue(); + shortagesRate = BigDecimal.valueOf(shortagesYear).divide(BigDecimal.valueOf(findShortagesYear), 2, RoundingMode.UP).setScale(2).doubleValue(); } - int findShortagesMon = (int) Optional.ofNullable(monPhenomenonList).orElse(new ArrayList<>()).stream().filter(s -> s.getDefectGrading().equals(levelList.getKey())).count(); - int shortagesMon = (int) Optional.ofNullable(monConclusionList).orElse(new ArrayList<>()).stream().filter(s -> s.getDefectGrading().equals(levelList.getKey())).count(); + int findShortagesMon = (int) Optional.ofNullable(monPhenomenonList).orElse(new ArrayList<>()).stream().filter(s -> s.getDefectLevel().equals(levelList.getKey())).count(); + int shortagesMon = (int) Optional.ofNullable(monConclusionList).orElse(new ArrayList<>()).stream().filter(s -> s.getDefectLevel().equals(levelList.getKey())).count(); CheckChartVo checkChartVo = new CheckChartVo(deptName1.getData(), levelList.getKey(), findShortagesMon, shortagesMon, findShortagesYear, shortagesYear, shortagesRate); checkChartRes.add(checkChartVo); } } // 总计 - Map> levelPhenomenonList = yearPhenomenonEntities.stream().collect(Collectors.groupingBy(OperPhenomenonEntity::getDefectGrading)); + Map> levelPhenomenonList = yearPhenomenonEntities.stream().collect(Collectors.groupingBy(OperPhenomenonEntity::getDefectLevel)); for (Map.Entry> levelPhenomenon : levelPhenomenonList.entrySet()) { int findShortagesYear = levelPhenomenon.getValue().size(); int shortagesYear = (int) Optional.ofNullable(yearConclusionList).orElse(new ArrayList<>()).stream() - .filter(s -> s.getDefectGrading().equals(levelPhenomenon.getKey())).count(); + .filter(s -> s.getDefectLevel().equals(levelPhenomenon.getKey())).count(); double shortagesRate = 0d; if (findShortagesYear != 0 && shortagesYear != 0) { shortagesRate = BigDecimal.valueOf(shortagesYear).divide(BigDecimal.valueOf(findShortagesYear), 2, RoundingMode.UP).doubleValue(); } - int findShortagesMon = (int) Optional.ofNullable(monPhenomenonList).orElse(new ArrayList<>()).stream().filter(s -> s.getDefectGrading().equals(levelPhenomenon.getKey())).count(); - int shortagesMon = (int) Optional.ofNullable(monConclusionList).orElse(new ArrayList<>()).stream().filter(s -> s.getDefectGrading().equals(levelPhenomenon.getKey())).count(); + int findShortagesMon = (int) Optional.ofNullable(monPhenomenonList).orElse(new ArrayList<>()).stream().filter(s -> s.getDefectLevel().equals(levelPhenomenon.getKey())).count(); + int shortagesMon = (int) Optional.ofNullable(monConclusionList).orElse(new ArrayList<>()).stream().filter(s -> s.getDefectLevel().equals(levelPhenomenon.getKey())).count(); CheckChartVo checkChartVo = new CheckChartVo("总计", levelPhenomenon.getKey(), findShortagesMon, shortagesMon, findShortagesYear, shortagesYear, shortagesRate); checkChartRes.add(checkChartVo); } @@ -528,8 +528,8 @@ public class AreaMonthReportServiceImpl implements IAreaMonthReportService { temp.put("checkLevel", checkLevel); temp.put("findShortagesMon", checkChartRe.getFindShortagesMon().toString()); temp.put("shortagesMon", checkChartRe.getShortagesMon().toString()); - temp.put("findShortagesYear", checkChartRe.getShortagesYear().toString()); - temp.put("shortagesYear", checkChartRe.getFindShortagesYear().toString()); + temp.put("findShortagesYear", checkChartRe.getFindShortagesYear().toString()); + temp.put("shortagesYear", checkChartRe.getShortagesYear().toString()); temp.put("shortagesRate", checkChartRe.getShortagesRate()* 100 + "%"); checkStatistics.add(temp); map.put("checkStatistics", checkStatistics); diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/util/WordUtils.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/util/WordUtils.java index eafafad..e3581e6 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/util/WordUtils.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/util/WordUtils.java @@ -112,16 +112,23 @@ public abstract class WordUtils { XWPFTable xwpfTable = tableList.get(tabIndex); //获取表格所有行数 List rows = xwpfTable.getRows(); - for (int i = 0; i < rows.size(); i++) { - if (i==rows.size()-1){ - continue; - } + for (int i = 0; i < rows.size()-2; i++) { +// if (i==rows.size()-2){ +// continue; +// } XWPFTableCell cell = rows.get(i).getCell(0); XWPFTableCell cell2 = rows.get(i+1).getCell(0); + XWPFTableCell cell3 = rows.get(i+2).getCell(0); String text = cell.getText(); String text2 = cell2.getText(); + String text3 = cell3.getText(); if (text2.equals(text)){ - mergeCellsVertically(xwpfTable,0,i,i+1); + if (text3.equals(text)){ + mergeCellsVertically(xwpfTable,0,i,i+2); + i=i+1; + }else{ + mergeCellsVertically(xwpfTable,0,i,i+1); + } } } } diff --git a/hzims-service/operational/src/main/resources/template/word/stationMonthReport.docx b/hzims-service/operational/src/main/resources/template/word/stationMonthReport.docx index 7917960..9da28f5 100644 Binary files a/hzims-service/operational/src/main/resources/template/word/stationMonthReport.docx and b/hzims-service/operational/src/main/resources/template/word/stationMonthReport.docx differ