diff --git a/pqs-event/event-boot/src/main/java/com/njcn/event/mapper/majornetwork/ReportMapper.java b/pqs-event/event-boot/src/main/java/com/njcn/event/mapper/majornetwork/ReportMapper.java index 8919764cc..326a789e8 100644 --- a/pqs-event/event-boot/src/main/java/com/njcn/event/mapper/majornetwork/ReportMapper.java +++ b/pqs-event/event-boot/src/main/java/com/njcn/event/mapper/majornetwork/ReportMapper.java @@ -22,4 +22,5 @@ public interface ReportMapper { Page getUpTimes(Page page, @Param("lineIds") List lineIds, @Param("startTime") String startTime, @Param("endTime") String endTime, @Param("dictdata") String dictdata); Page getSagTimes(Page page, @Param("lineIds") List lineIds, @Param("startTime") String startTime, @Param("endTime") String endTime, @Param("dictdata") String dictdata); + List getListCount( @Param("lineIds") List lineIds, @Param("startTime") String startTime, @Param("endTime") String endTime, @Param("dictdata") String dictdata); } diff --git a/pqs-event/event-boot/src/main/java/com/njcn/event/mapper/majornetwork/mapping/ReportMapper.xml b/pqs-event/event-boot/src/main/java/com/njcn/event/mapper/majornetwork/mapping/ReportMapper.xml index 4a7a318f7..36cc4ba79 100644 --- a/pqs-event/event-boot/src/main/java/com/njcn/event/mapper/majornetwork/mapping/ReportMapper.xml +++ b/pqs-event/event-boot/src/main/java/com/njcn/event/mapper/majornetwork/mapping/ReportMapper.xml @@ -61,5 +61,24 @@ and rmed.event_type = #{dictdata} GROUP BY rmed.measurement_point_id + \ No newline at end of file diff --git a/pqs-event/event-boot/src/main/java/com/njcn/event/service/majornetwork/Impl/ReportServiceImpl.java b/pqs-event/event-boot/src/main/java/com/njcn/event/service/majornetwork/Impl/ReportServiceImpl.java index 8721bd433..2f58b1e2c 100644 --- a/pqs-event/event-boot/src/main/java/com/njcn/event/service/majornetwork/Impl/ReportServiceImpl.java +++ b/pqs-event/event-boot/src/main/java/com/njcn/event/service/majornetwork/Impl/ReportServiceImpl.java @@ -890,6 +890,9 @@ public class ReportServiceImpl implements ReportService { sheet2(sheets,cellStyle,bodyStyle,businessParam); sheet3(sheets,cellStyle,bodyStyle,businessParam); sheet4(sheets,cellStyle,bodyStyle,businessParam); + sheet5(sheets,cellStyle,bodyStyle,businessParam); + sheet6(sheets,cellStyle,bodyStyle,businessParam); + sheet7(sheets,cellStyle,bodyStyle,businessParam); ArrayList online = new ArrayList<>(); @@ -907,7 +910,7 @@ public class ReportServiceImpl implements ReportService { List up2 = new ArrayList<>(); List sag2 = new ArrayList<>(); List break2 = new ArrayList<>(); -/* + for (int i = 0; i < GereralList.size(); i++) { GeneralVO vo = GereralList.get(i); @@ -1072,7 +1075,6 @@ public class ReportServiceImpl implements ReportService { drawingPatriarch.createPicture(anchor1, sheets.addPicture(bytes2, HSSFWorkbook.PICTURE_TYPE_JPEG)); drawingPatriarch.createPicture(anchor2, sheets.addPicture(bytes3, HSSFWorkbook.PICTURE_TYPE_JPEG)); drawingPatriarch.createPicture(anchor3, sheets.addPicture(bytes4, HSSFWorkbook.PICTURE_TYPE_JPEG)); -*/ PoiUtil.exportFileByWorkbook(sheets, "电压暂降周报.xlsx", response); } public void sheet2(HSSFWorkbook sheets,HSSFCellStyle cellStyle, HSSFCellStyle bodyStyle ,DeviceInfoParam.BusinessParam businessParam){ @@ -1166,7 +1168,7 @@ public class ReportServiceImpl implements ReportService { } } - public void sheet3(HSSFWorkbook sheets,HSSFCellStyle cellStyle, HSSFCellStyle bodyStyle ,DeviceInfoParam.BusinessParam businessParam){ + public void sheet3(HSSFWorkbook sheets,HSSFCellStyle cellStyle, HSSFCellStyle bodyStyle ,DeviceInfoParam.BusinessParam businessParam) throws TemplateException, IOException { sheets.createSheet("暂态原因统计"); HSSFSheet sheetAt = sheets.getSheetAt(2); sheetAt.setColumnWidth(0, 40 * 256); @@ -1255,7 +1257,21 @@ public class ReportServiceImpl implements ReportService { cellR1.setCellValue(reasonsVO.getRate()); } } - //todo 缺少eaches + HSSFPatriarch drawingPatriarch = sheetAt.createDrawingPatriarch(); + + HSSFClientAnchor anchor = new HSSFClientAnchor(0, 10, 10, 6, (short) 0.5, (short) 6, (short) 6, (short) 36); + + List xdata = new ArrayList<>(); + for (ReasonsVO reasonsVO : reason) { + xdata.add(reasonsVO.getReason()); + } + String tr = getR(xdata, reason, "bar9.ftl"); + BASE64Decoder decoder = new BASE64Decoder(); + + byte[] bytes = decoder.decodeBuffer(tr); + drawingPatriarch.createPicture(anchor, sheets.addPicture(bytes, HSSFWorkbook.PICTURE_TYPE_JPEG)); + + } public void sheet4(HSSFWorkbook sheets,HSSFCellStyle cellStyle, HSSFCellStyle bodyStyle ,DeviceInfoParam.BusinessParam businessParam){ sheets.createSheet("详细事件列表"); @@ -1351,6 +1367,235 @@ public class ReportServiceImpl implements ReportService { } } + public void sheet5(HSSFWorkbook sheets,HSSFCellStyle cellStyle, HSSFCellStyle bodyStyle ,DeviceInfoParam.BusinessParam businessParam){ + sheets.createSheet("暂降次数统计"); + HSSFSheet sheetAt = sheets.getSheetAt(4); + sheetAt.setColumnWidth(0, 9 * 256); + sheetAt.setColumnWidth(1, 24 * 256); + sheetAt.setColumnWidth(2, 24 * 256); + sheetAt.setColumnWidth(3, 24 * 256); + sheetAt.setColumnWidth(4, 24 * 256); + sheetAt.setColumnWidth(5, 24 * 256); + sheetAt.setColumnWidth(6, 24 * 256); + sheetAt.addMergedRegion(new CellRangeAddress(0, 1, 0, 0)); + sheetAt.addMergedRegion(new CellRangeAddress(0, 1, 1, 1)); + sheetAt.addMergedRegion(new CellRangeAddress(0, 1, 2, 2)); + sheetAt.addMergedRegion(new CellRangeAddress(0, 1, 3, 3)); + sheetAt.addMergedRegion(new CellRangeAddress(0, 1, 4, 4)); + sheetAt.addMergedRegion(new CellRangeAddress(0, 1, 5, 5)); + sheetAt.addMergedRegion(new CellRangeAddress(0, 1, 6, 6)); + + HSSFRow row1 = sheetAt.createRow(0); + + + HSSFCell r1Cell0 = row1.createCell(0); + HSSFCell r1Cell1 = row1.createCell(1); + HSSFCell r1Cell2 = row1.createCell(2); + HSSFCell r1Cell3 = row1.createCell(3); + HSSFCell r1Cell4 = row1.createCell(4); + HSSFCell r1Cell5 = row1.createCell(5); + HSSFCell r1Cell6 = row1.createCell(6); + setCellStyle(r1Cell0, "序号", cellStyle); + setCellStyle(r1Cell1, "监测点", cellStyle); + setCellStyle(r1Cell2, "干扰源类型", cellStyle); + setCellStyle(r1Cell3, "监测点对象名称", cellStyle); + setCellStyle(r1Cell4, "变电站", cellStyle); + setCellStyle(r1Cell5, "供电公司", cellStyle); + setCellStyle(r1Cell6, "暂降次数", cellStyle); + DictData dictdata = dicDataFeignClient.getDicDataByCode(DicDataEnum.VOLTAGE_DIP.getCode()).getData(); + List severity = sheetList(businessParam,dictdata.getId()); + for (int i = 0; i < severity.size(); i++) { + DetailVO vo = severity.get(i); + + HSSFRow row = sheetAt.createRow(i + 2); + HSSFCell cell0 = row.createCell(0); + HSSFCell cell1 = row.createCell(1); + HSSFCell cell2 = row.createCell(2); + HSSFCell cell3 = row.createCell(3); + HSSFCell cell4 = row.createCell(4); + HSSFCell cell5 = row.createCell(5); + HSSFCell cell6 = row.createCell(6); + + cell0.setCellStyle(bodyStyle); + cell1.setCellStyle(bodyStyle); + cell2.setCellStyle(bodyStyle); + cell3.setCellStyle(bodyStyle); + cell4.setCellStyle(bodyStyle); + cell5.setCellStyle(bodyStyle); + cell6.setCellStyle(bodyStyle); + + cell0.setCellValue(i+1); + cell1.setCellValue(vo.getLineName()); + cell2.setCellValue(vo.getLoadType()); + cell3.setCellValue(vo.getObjName()); + cell4.setCellValue(vo.getSubName()); + cell5.setCellValue(vo.getGdName()); + cell6.setCellValue(vo.getTimes()); + } + + } + public void sheet6(HSSFWorkbook sheets,HSSFCellStyle cellStyle, HSSFCellStyle bodyStyle ,DeviceInfoParam.BusinessParam businessParam){ + sheets.createSheet("暂升次数统计"); + HSSFSheet sheetAt = sheets.getSheetAt(5); + sheetAt.setColumnWidth(0, 9 * 256); + sheetAt.setColumnWidth(1, 24 * 256); + sheetAt.setColumnWidth(2, 24 * 256); + sheetAt.setColumnWidth(3, 24 * 256); + sheetAt.setColumnWidth(4, 24 * 256); + sheetAt.setColumnWidth(5, 24 * 256); + sheetAt.setColumnWidth(6, 24 * 256); + sheetAt.addMergedRegion(new CellRangeAddress(0, 1, 0, 0)); + sheetAt.addMergedRegion(new CellRangeAddress(0, 1, 1, 1)); + sheetAt.addMergedRegion(new CellRangeAddress(0, 1, 2, 2)); + sheetAt.addMergedRegion(new CellRangeAddress(0, 1, 3, 3)); + sheetAt.addMergedRegion(new CellRangeAddress(0, 1, 4, 4)); + sheetAt.addMergedRegion(new CellRangeAddress(0, 1, 5, 5)); + sheetAt.addMergedRegion(new CellRangeAddress(0, 1, 6, 6)); + + HSSFRow row1 = sheetAt.createRow(0); + + + HSSFCell r1Cell0 = row1.createCell(0); + HSSFCell r1Cell1 = row1.createCell(1); + HSSFCell r1Cell2 = row1.createCell(2); + HSSFCell r1Cell3 = row1.createCell(3); + HSSFCell r1Cell4 = row1.createCell(4); + HSSFCell r1Cell5 = row1.createCell(5); + HSSFCell r1Cell6 = row1.createCell(6); + setCellStyle(r1Cell0, "序号", cellStyle); + setCellStyle(r1Cell1, "监测点", cellStyle); + setCellStyle(r1Cell2, "干扰源类型", cellStyle); + setCellStyle(r1Cell3, "监测点对象名称", cellStyle); + setCellStyle(r1Cell4, "变电站", cellStyle); + setCellStyle(r1Cell5, "供电公司", cellStyle); + setCellStyle(r1Cell6, "暂升次数", cellStyle); + DictData dictdata = dicDataFeignClient.getDicDataByCode(DicDataEnum.VOLTAGE_RISE.getCode()).getData(); + List severity = sheetList(businessParam,dictdata.getId()); + for (int i = 0; i < severity.size(); i++) { + DetailVO vo = severity.get(i); + + HSSFRow row = sheetAt.createRow(i + 2); + HSSFCell cell0 = row.createCell(0); + HSSFCell cell1 = row.createCell(1); + HSSFCell cell2 = row.createCell(2); + HSSFCell cell3 = row.createCell(3); + HSSFCell cell4 = row.createCell(4); + HSSFCell cell5 = row.createCell(5); + HSSFCell cell6 = row.createCell(6); + + cell0.setCellStyle(bodyStyle); + cell1.setCellStyle(bodyStyle); + cell2.setCellStyle(bodyStyle); + cell3.setCellStyle(bodyStyle); + cell4.setCellStyle(bodyStyle); + cell5.setCellStyle(bodyStyle); + cell6.setCellStyle(bodyStyle); + + cell0.setCellValue(i+1); + cell1.setCellValue(vo.getLineName()); + cell2.setCellValue(vo.getLoadType()); + cell3.setCellValue(vo.getObjName()); + cell4.setCellValue(vo.getSubName()); + cell5.setCellValue(vo.getGdName()); + cell6.setCellValue(vo.getTimes()); + } + + } + public void sheet7(HSSFWorkbook sheets,HSSFCellStyle cellStyle, HSSFCellStyle bodyStyle ,DeviceInfoParam.BusinessParam businessParam){ + sheets.createSheet("短时中断次数统计"); + HSSFSheet sheetAt = sheets.getSheetAt(6); + sheetAt.setColumnWidth(0, 9 * 256); + sheetAt.setColumnWidth(1, 24 * 256); + sheetAt.setColumnWidth(2, 24 * 256); + sheetAt.setColumnWidth(3, 24 * 256); + sheetAt.setColumnWidth(4, 24 * 256); + sheetAt.setColumnWidth(5, 24 * 256); + sheetAt.setColumnWidth(6, 24 * 256); + sheetAt.addMergedRegion(new CellRangeAddress(0, 1, 0, 0)); + sheetAt.addMergedRegion(new CellRangeAddress(0, 1, 1, 1)); + sheetAt.addMergedRegion(new CellRangeAddress(0, 1, 2, 2)); + sheetAt.addMergedRegion(new CellRangeAddress(0, 1, 3, 3)); + sheetAt.addMergedRegion(new CellRangeAddress(0, 1, 4, 4)); + sheetAt.addMergedRegion(new CellRangeAddress(0, 1, 5, 5)); + sheetAt.addMergedRegion(new CellRangeAddress(0, 1, 6, 6)); + + HSSFRow row1 = sheetAt.createRow(0); + + + HSSFCell r1Cell0 = row1.createCell(0); + HSSFCell r1Cell1 = row1.createCell(1); + HSSFCell r1Cell2 = row1.createCell(2); + HSSFCell r1Cell3 = row1.createCell(3); + HSSFCell r1Cell4 = row1.createCell(4); + HSSFCell r1Cell5 = row1.createCell(5); + HSSFCell r1Cell6 = row1.createCell(6); + setCellStyle(r1Cell0, "序号", cellStyle); + setCellStyle(r1Cell1, "监测点", cellStyle); + setCellStyle(r1Cell2, "干扰源类型", cellStyle); + setCellStyle(r1Cell3, "监测点对象名称", cellStyle); + setCellStyle(r1Cell4, "变电站", cellStyle); + setCellStyle(r1Cell5, "供电公司", cellStyle); + setCellStyle(r1Cell6, "短时中断次数", cellStyle); + DictData dictdata = dicDataFeignClient.getDicDataByCode(DicDataEnum.SHORT_INTERRUPTIONS.getCode()).getData(); + List severity = sheetList(businessParam,dictdata.getId()); + for (int i = 0; i < severity.size(); i++) { + DetailVO vo = severity.get(i); + + HSSFRow row = sheetAt.createRow(i + 2); + HSSFCell cell0 = row.createCell(0); + HSSFCell cell1 = row.createCell(1); + HSSFCell cell2 = row.createCell(2); + HSSFCell cell3 = row.createCell(3); + HSSFCell cell4 = row.createCell(4); + HSSFCell cell5 = row.createCell(5); + HSSFCell cell6 = row.createCell(6); + + cell0.setCellStyle(bodyStyle); + cell1.setCellStyle(bodyStyle); + cell2.setCellStyle(bodyStyle); + cell3.setCellStyle(bodyStyle); + cell4.setCellStyle(bodyStyle); + cell5.setCellStyle(bodyStyle); + cell6.setCellStyle(bodyStyle); + + cell0.setCellValue(i+1); + cell1.setCellValue(vo.getLineName()); + cell2.setCellValue(vo.getLoadType()); + cell3.setCellValue(vo.getObjName()); + cell4.setCellValue(vo.getSubName()); + cell5.setCellValue(vo.getGdName()); + cell6.setCellValue(vo.getTimes()); + } + + } + private List sheetList(DeviceInfoParam.BusinessParam businessParam,String id){ + List deviceDTOList = generalDeviceInfoClient.getPracticalAllDeviceInfo(businessParam).getData(); + List lineIds = deviceDTOList.stream().flatMap(list -> list.getLineIndexes().stream()).collect(Collectors.toList()); + if (CollectionUtil.isEmpty(lineIds)) { + throw new BusinessException(DeviceResponseEnum.DEPT_LINE_EMPTY); + } + List listCount = reportMapper.getListCount(lineIds, businessParam.getSearchBeginTime(), businessParam.getSearchEndTime(), id); + + ArrayList idlist = new ArrayList<>(); + for (DetailVO vo : listCount) { + idlist.add(vo.getLineId()); + } + if(CollUtil.isNotEmpty(idlist)){ + HttpResult> AreaInfo = lineFeignClient.getBaseLineAreaInfo(idlist); + List data = AreaInfo.getData(); + for (DetailVO v : listCount) { + for (AreaLineInfoVO vo : data) { + if (vo.getLineId().equals(v.getLineId())) { + BeanUtils.copyProperties(vo, v); + } + } + } + } + return listCount; + } + + + /** * sheet 详细数据列表 */ diff --git a/pqs-event/event-boot/src/main/resources/templates/bar8.ftl b/pqs-event/event-boot/src/main/resources/templates/bar8.ftl index 526cfef33..646cb1f11 100644 --- a/pqs-event/event-boot/src/main/resources/templates/bar8.ftl +++ b/pqs-event/event-boot/src/main/resources/templates/bar8.ftl @@ -19,7 +19,8 @@ radius: '70%', center: ['50%', '60%'], label: { normal: { -show: false +show: true, +formatter: '{d}%' }, emphasis: { show: true diff --git a/pqs-event/event-boot/src/main/resources/templates/bar9.ftl b/pqs-event/event-boot/src/main/resources/templates/bar9.ftl index d6dbb53cc..48e4a14a4 100644 --- a/pqs-event/event-boot/src/main/resources/templates/bar9.ftl +++ b/pqs-event/event-boot/src/main/resources/templates/bar9.ftl @@ -19,7 +19,7 @@ radius: '70%', center: ['50%', '53%'], label: { normal: { -show: false +formatter: '{d}%' }, emphasis: { show: true