From fb6a469e68f5907239d2cf0ee0713cb3b419314c Mon Sep 17 00:00:00 2001 From: wr <1754607820@qq.com> Date: Mon, 11 Sep 2023 15:48:56 +0800 Subject: [PATCH] =?UTF-8?q?1.=E6=A8=A1=E6=9D=BF=E5=AD=97=E6=AE=B5*?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=BA=A2=E8=89=B2=E6=A0=87=E8=AF=86=202.?= =?UTF-8?q?=E9=A2=84=E8=AD=A6=E5=8D=95,=E5=8F=8D=E9=A6=88=E5=8D=95?= =?UTF-8?q?=E5=AF=BC=E5=87=BA=E6=8E=A5=E5=8F=A3=E5=A2=9E=E5=8A=A0=203.?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=8A=80=E6=9C=AF=E7=9B=91=E7=9D=A3=E6=9C=88?= =?UTF-8?q?=E6=8A=A5=E7=BB=9F=E8=AE=A1=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/njcn/poi/excel/ExcelUtil.java | 72 ++++++++++++++++- .../com/njcn/process/pojo/po/SupvAlarm.java | 22 +++++- .../njcn/process/pojo/po/SupvAlarmBack.java | 31 +++++--- .../njcn/process/pojo/vo/SupvProblemVO.java | 6 +- .../njcn/process/utils/ExcelStyleUtil.java | 24 +----- .../controller/SupvAlarmBackController.java | 6 ++ .../controller/SupvAlarmController.java | 7 ++ .../process/mapper/SupvAlarmBackMapper.java | 1 + .../process/mapper/SupvReportMMapper.java | 7 +- .../mapper/mapping/SupvAlarmBackMapper.xml | 10 +++ .../mapper/mapping/SupvReportMMapper.xml | 20 ++++- .../service/ISupvAlarmBackService.java | 2 + .../process/service/ISupvAlarmService.java | 2 + .../impl/SupvAlarmBackServiceImpl.java | 12 ++- .../service/impl/SupvAlarmServiceImpl.java | 41 +++++++++- .../service/impl/SupvProblemServiceImpl.java | 7 ++ .../service/impl/SupvReportMServiceImpl.java | 78 ++++++++++--------- 17 files changed, 270 insertions(+), 78 deletions(-) diff --git a/pqs-common/common-poi/src/main/java/com/njcn/poi/excel/ExcelUtil.java b/pqs-common/common-poi/src/main/java/com/njcn/poi/excel/ExcelUtil.java index 066a9df47..004a4c489 100644 --- a/pqs-common/common-poi/src/main/java/com/njcn/poi/excel/ExcelUtil.java +++ b/pqs-common/common-poi/src/main/java/com/njcn/poi/excel/ExcelUtil.java @@ -7,12 +7,11 @@ import com.njcn.web.utils.HttpServletUtil; import lombok.extern.slf4j.Slf4j; import org.apache.poi.hssf.usermodel.DVConstraint; import org.apache.poi.hssf.usermodel.HSSFDataValidation; -import org.apache.poi.ss.usermodel.DataValidationHelper; -import org.apache.poi.ss.usermodel.Sheet; -import org.apache.poi.ss.usermodel.Workbook; +import org.apache.poi.ss.usermodel.*; import org.apache.poi.ss.util.CellRangeAddressList; import org.apache.poi.xssf.usermodel.XSSFDataValidation; import org.apache.poi.xssf.usermodel.XSSFDataValidationConstraint; +import org.apache.poi.xssf.usermodel.XSSFRichTextString; import javax.servlet.ServletOutputStream; import javax.servlet.http.HttpServletResponse; @@ -49,6 +48,73 @@ public class ExcelUtil { } } + /** + * 指定名称、数据下载报表(带指定标题将*显示比必填信息) + * + * @param fileName 文件名 + */ + public static void exportExcel(ExportParams exportParams,String fileName, Class pojoClass, Collection dataSet) { + HttpServletResponse response = HttpServletUtil.getResponse(); + try (ServletOutputStream outputStream = response.getOutputStream()) { + fileName = URLEncoder.encode(fileName, CharsetUtil.UTF_8); + response.reset(); + response.setHeader("Content-Disposition", "attachment; filename=\"" + fileName + "\""); + response.setContentType("application/octet-stream;charset=UTF-8"); + Workbook workbook = ExcelExportUtil.exportExcel(exportParams, pojoClass, dataSet); + Sheet sheetAt = workbook.getSheetAt(0); + //获取列数 + int physicalNumberOfCells = sheetAt.getRow(0).getPhysicalNumberOfCells(); + //没有表格标题,只有表格头 + for (int i = 0; i < 2; i++) { + //获取行 + Row row = sheetAt.getRow(i); + for (int j = 0; j < physicalNumberOfCells; j++) { + //获取单元格对象 + Cell cell = row.getCell(j); + //获取单元格样式对象 + CellStyle cellStyle = workbook.createCellStyle(); + //获取单元格内容对象 + Font font = workbook.createFont(); + font.setFontHeightInPoints((short)12); + //一定要装入 样式中才会生效 + cellStyle.setFont(font); + //设置居中对齐 + cellStyle.setAlignment(HorizontalAlignment.CENTER); + cellStyle.setVerticalAlignment(VerticalAlignment.CENTER); + //设置单元格字体颜色 + cell.setCellStyle(cellStyle); + //获取当前值 + String stringCellValue = cell.getStringCellValue(); + if (stringCellValue.contains("*")) { + // 创建一个富文本 + XSSFRichTextString xssfRichTextString = new XSSFRichTextString(stringCellValue); + int startIndex = stringCellValue.indexOf("*"); + int entIndex = stringCellValue.lastIndexOf("*"); + if(entIndex!=0){ + Font font3 = workbook.createFont(); + font3.setFontHeightInPoints((short)12); + font3.setColor(Font.COLOR_NORMAL); + xssfRichTextString.applyFont(0, entIndex, font3); + } + //设置带*样式 + Font font1 = workbook.createFont(); + font1.setFontHeightInPoints((short)12); + font1.setColor(Font.COLOR_RED); + xssfRichTextString.applyFont(startIndex, entIndex+1, font1); + //其他样式 + Font font2 = workbook.createFont(); + font2.setFontHeightInPoints((short)12); + font2.setColor(Font.COLOR_NORMAL); + xssfRichTextString.applyFont(entIndex+1, stringCellValue.length(), font2); + cell.setCellValue(xssfRichTextString); + } + } + } + workbook.write(outputStream); + } catch (IOException e) { + log.error(">>> 导出数据异常:{}", e.getMessage()); + } + } /** * @param excel 目标excel diff --git a/pqs-process/process-api/src/main/java/com/njcn/process/pojo/po/SupvAlarm.java b/pqs-process/process-api/src/main/java/com/njcn/process/pojo/po/SupvAlarm.java index 93c5b0053..c5df1f3c6 100644 --- a/pqs-process/process-api/src/main/java/com/njcn/process/pojo/po/SupvAlarm.java +++ b/pqs-process/process-api/src/main/java/com/njcn/process/pojo/po/SupvAlarm.java @@ -1,5 +1,6 @@ package com.njcn.process.pojo.po; +import cn.afterturn.easypoi.excel.annotation.Excel; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; @@ -38,14 +39,17 @@ public class SupvAlarm { @ApiModelProperty("单据类别") @TableField("bill_Type") + @Excel(name = "*单据类别",width = 15) private String billType; @ApiModelProperty("单据编号") @TableField("bill_No") + @Excel(name = "*单据编号",width = 30) private String billNo; @ApiModelProperty("单据名称") @TableField("bill_Name") + @Excel(name = "*单据名称",width = 20) private String billName; @ApiModelProperty("编制单位id,取ISC平台上的组织id (sys_dept)") @@ -54,10 +58,12 @@ public class SupvAlarm { @ApiModelProperty("编制单位名称,取ISC平台上的组织名称") @TableField("creater_Org_Name") + @Excel(name = "*编制单位名称",width = 20) private String createrOrgName; @ApiModelProperty("所属专业,见3.11(字典)") @TableField("speciality_Type") + @Excel(name = "*所属专业",width = 15) private String specialityType; @ApiModelProperty("责任单位id,取ISC平台上的组织id") @@ -66,15 +72,16 @@ public class SupvAlarm { @ApiModelProperty("责任单位名称,取ISC平台上的组织名称") @TableField("org_Name") + @Excel(name = "*责任单位名称",width = 20) private String orgName; @ApiModelProperty("接收人id,取ISC平台上的人员id") @TableField("receive_UserId") - private String receiveUserId; @ApiModelProperty("接收人名称,取ISC平台上的人员名称") @TableField("receive_User_Name") + @Excel(name = "接收人名称",width = 15) private String receiveUserName; @ApiModelProperty("编制时间 yyyy-MM-dd HH:mm:ss") @@ -82,12 +89,19 @@ public class SupvAlarm { @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") private LocalDateTime createrTime; + @ApiModelProperty("编制时间 yyyy-MM-dd HH:mm:ss") + @TableField(exist = false) + @Excel(name = "*编制时间",width = 20) + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") + private String time; + @ApiModelProperty("主管部门id,取ISC平台上的组织id") @TableField("manager_Dept_Id") private String managerDeptId; @ApiModelProperty("主管部门名称,取ISC平台上的组织名称") @TableField("manager_Dept_Name") + @Excel(name = "*主管部门名称",width = 15) private String managerDeptName; @ApiModelProperty("主送单位id,取ISC平台上的组织id") @@ -96,6 +110,7 @@ public class SupvAlarm { @ApiModelProperty("主送单位名称,取ISC平台上的组织名称") @TableField("main_Sender_Name") + @Excel(name = "主送单位名称",width = 15) private String mainSenderName; @ApiModelProperty("抄送单位id,取ISC平台上的组织id") @@ -104,22 +119,27 @@ public class SupvAlarm { @ApiModelProperty("抄送单位名称,取ISC平台上的组织名称") @TableField("copy_Sender_Name") + @Excel(name = "抄送单位名称",width = 20) private String copySenderName; @ApiModelProperty("依据标准") @TableField("tech_Supv_Basis") + @Excel(name = "*依据标准",width = 60) private String techSupvBasis; @ApiModelProperty("问题描述") @TableField("problem_Desc") + @Excel(name = "*问题描述",width = 60) private String problemDesc; @ApiModelProperty("处理建议") @TableField("deal_Advise") + @Excel(name = "*处理建议",width = 60) private String dealAdvise; @ApiModelProperty("0.以上送 1.未上送 2.取消上送 3.待重新上送") @TableField("is_upload_head") private Integer isUploadHead; + } diff --git a/pqs-process/process-api/src/main/java/com/njcn/process/pojo/po/SupvAlarmBack.java b/pqs-process/process-api/src/main/java/com/njcn/process/pojo/po/SupvAlarmBack.java index e30f69d22..4371fefa5 100644 --- a/pqs-process/process-api/src/main/java/com/njcn/process/pojo/po/SupvAlarmBack.java +++ b/pqs-process/process-api/src/main/java/com/njcn/process/pojo/po/SupvAlarmBack.java @@ -1,5 +1,6 @@ package com.njcn.process.pojo.po; +import cn.afterturn.easypoi.excel.annotation.Excel; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; @@ -27,13 +28,27 @@ public class SupvAlarmBack { @TableId("alarm_Back_Id") private String alarmBackId; + @ApiModelProperty("单据编号") + @Excel(name = "单据编号",width = 30) + @TableField(exist = false) + private String billNo; + + @ApiModelProperty("单据名称") + @TableField(exist = false) + @Excel(name = "单据名称",width = 30) + private String billName; + + @ApiModelProperty("项目执行单位id") @TableField("execute_Org_Id") private String executeOrgId; + @ApiModelProperty("项目执行单位名称") @TableField("execute_Org_Name") + @Excel(name = "项目执行单位名称",width = 30) private String executeOrgName; @TableField("treatment_Measures") + @Excel(name = "*采取措施",width = 60) private String treatmentMeasures; @ApiModelProperty("填报人id,取ISC平台上的人员id") @@ -42,6 +57,7 @@ public class SupvAlarmBack { @ApiModelProperty("填报人名称,取ISC平台上的人员名称") @TableField("fill_User_Name") + @Excel(name = "*填报人名称",width = 30) private String fillUserName; @ApiModelProperty("完成时间 yyyy-MM-dd HH:mm:ss") @@ -49,25 +65,22 @@ public class SupvAlarmBack { @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") private LocalDateTime completeTime; + @ApiModelProperty("完成时间") + @Excel(name = "*完成时间",width = 30) + @TableField(exist = false) + private String time; + @ApiModelProperty("告预警单id,关联告预警单表") @TableField("work_Alarm_Id") private String workAlarmId; - @ApiModelProperty("单据编号") - @TableField(exist = false) - private String billNo; - - @ApiModelProperty("单据名称") - @TableField(exist = false) - private String billName; - - @ApiModelProperty("反馈单位id,取ISC平台上的组织id") @TableField("feedback_Org_Id") private String feedbackOrgId; @ApiModelProperty("反馈单位名称,取ISC平台上的组织名称") @TableField("feedback_Org_Name") + @Excel(name = "反馈单位名称",width = 30) private String feedbackOrgName; @TableField("province_Id") diff --git a/pqs-process/process-api/src/main/java/com/njcn/process/pojo/vo/SupvProblemVO.java b/pqs-process/process-api/src/main/java/com/njcn/process/pojo/vo/SupvProblemVO.java index a06a209f0..3f49f97b8 100644 --- a/pqs-process/process-api/src/main/java/com/njcn/process/pojo/vo/SupvProblemVO.java +++ b/pqs-process/process-api/src/main/java/com/njcn/process/pojo/vo/SupvProblemVO.java @@ -29,10 +29,10 @@ public class SupvProblemVO { @Excel(name = "计划名称",width = 40) private String workPlanName; - @Excel(name = "责任单位编号",width = 15) + @Excel(name = "责任单位编号",width = 20) private String dutyOrgId; - @Excel(name = "责任单位名称",width = 15) + @Excel(name = "责任单位名称",width = 20) private String dutyOrgName; @Excel(name = "监测点类型",width = 15) @@ -44,7 +44,7 @@ public class SupvProblemVO { @Excel(name = "计划整改时间",width = 15) private String planRectificationTime; - @Excel(name = "整改情况",width = 15,replace = {"已整改_01","未整改_02"}) + @Excel(name = "整改情况",width = 15,replace = {"已整改_02","未整改_01"}) private String rectificationStatus; @Excel(name = "整改时间",width = 15) diff --git a/pqs-process/process-api/src/main/java/com/njcn/process/utils/ExcelStyleUtil.java b/pqs-process/process-api/src/main/java/com/njcn/process/utils/ExcelStyleUtil.java index a65a71721..d8aea66ba 100644 --- a/pqs-process/process-api/src/main/java/com/njcn/process/utils/ExcelStyleUtil.java +++ b/pqs-process/process-api/src/main/java/com/njcn/process/utils/ExcelStyleUtil.java @@ -5,6 +5,7 @@ import cn.afterturn.easypoi.excel.entity.params.ExcelForEachParams; import cn.afterturn.easypoi.excel.export.styler.IExcelExportStyler; import org.apache.poi.hssf.util.HSSFColor; import org.apache.poi.ss.usermodel.*; +import org.apache.poi.xssf.usermodel.XSSFRichTextString; /** * pqs @@ -35,7 +36,7 @@ public class ExcelStyleUtil implements IExcelExportStyler { private void init(Workbook workbook) { this.styles = initStyles(workbook); this.titleStyle = initTitleStyle(workbook); - this.headerStyle = initTitleStyle(workbook); + this.headerStyle = initHeaderStyle(workbook); } @@ -131,28 +132,11 @@ public class ExcelStyleUtil implements IExcelExportStyler { } font.setFontName("Courier New"); style.setFont(font); - // 设置底边框 - style.setBorderBottom(BorderStyle.THIN); - // 设置左边框 - style.setBorderLeft(BorderStyle.THIN); - // 设置右边框; - style.setBorderRight(BorderStyle.THIN); - // 设置顶边框; - style.setBorderTop(BorderStyle.THIN); - // 设置底边颜色 - style.setBottomBorderColor(HSSFColor.HSSFColorPredefined.BLACK.getIndex()); - // 设置左边框颜色; - style.setLeftBorderColor(HSSFColor.HSSFColorPredefined.BLACK.getIndex()); - // 设置右边框颜色; - style.setRightBorderColor(HSSFColor.HSSFColorPredefined.BLACK.getIndex()); - // 设置顶边框颜色; - style.setTopBorderColor(HSSFColor.HSSFColorPredefined.BLACK.getIndex()); - // 设置自动换行; - style.setWrapText(false); - // 设置垂直对齐的样式为居中对齐; style.setVerticalAlignment(VerticalAlignment.CENTER); return style; } + + } diff --git a/pqs-process/process-boot/src/main/java/com/njcn/process/controller/SupvAlarmBackController.java b/pqs-process/process-boot/src/main/java/com/njcn/process/controller/SupvAlarmBackController.java index ea18a754f..d5aceb62a 100644 --- a/pqs-process/process-boot/src/main/java/com/njcn/process/controller/SupvAlarmBackController.java +++ b/pqs-process/process-boot/src/main/java/com/njcn/process/controller/SupvAlarmBackController.java @@ -68,6 +68,12 @@ public class SupvAlarmBackController extends BaseController { Boolean b = supvAlarmBackService.delAlarmBack(planIds); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, b, methodDescribe); } + @PostMapping("/downAlarmBack") + @OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.ADD) + @ApiOperation("导出预告警单反馈数据信息") + public void downAlarm(){ + supvAlarmBackService.downAlarmBack(); + } @PostMapping("pageAlarmBack") @OperateInfo(info = LogEnum.BUSINESS_COMMON) diff --git a/pqs-process/process-boot/src/main/java/com/njcn/process/controller/SupvAlarmController.java b/pqs-process/process-boot/src/main/java/com/njcn/process/controller/SupvAlarmController.java index b8d06c2bd..ea54c7489 100644 --- a/pqs-process/process-boot/src/main/java/com/njcn/process/controller/SupvAlarmController.java +++ b/pqs-process/process-boot/src/main/java/com/njcn/process/controller/SupvAlarmController.java @@ -69,6 +69,13 @@ public class SupvAlarmController extends BaseController { return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, b, methodDescribe); } + @PostMapping("/downAlarm") + @OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.ADD) + @ApiOperation("导出预告警单信息") + public void downAlarm(){ + supvAlarmService.downAlarm(); + } + @PostMapping("pageAlarm") @OperateInfo(info = LogEnum.BUSINESS_COMMON) @ApiOperation("分页查询预告警单") diff --git a/pqs-process/process-boot/src/main/java/com/njcn/process/mapper/SupvAlarmBackMapper.java b/pqs-process/process-boot/src/main/java/com/njcn/process/mapper/SupvAlarmBackMapper.java index 2b4cb80d6..f2d412c93 100644 --- a/pqs-process/process-boot/src/main/java/com/njcn/process/mapper/SupvAlarmBackMapper.java +++ b/pqs-process/process-boot/src/main/java/com/njcn/process/mapper/SupvAlarmBackMapper.java @@ -21,4 +21,5 @@ public interface SupvAlarmBackMapper extends BaseMapper { Page pageAlarmBack(Page objectPage,@Param("ids") List ids,@Param("param") SupvAlarmBackParam param); + List selectAlarmBack(); } diff --git a/pqs-process/process-boot/src/main/java/com/njcn/process/mapper/SupvReportMMapper.java b/pqs-process/process-boot/src/main/java/com/njcn/process/mapper/SupvReportMMapper.java index 4d574fcda..78cc8aae8 100644 --- a/pqs-process/process-boot/src/main/java/com/njcn/process/mapper/SupvReportMMapper.java +++ b/pqs-process/process-boot/src/main/java/com/njcn/process/mapper/SupvReportMMapper.java @@ -21,12 +21,15 @@ import java.util.List; */ public interface SupvReportMMapper extends MppBaseMapper { + //月报计划统计(按照实施结束时间统计) List statisticPlanReport(@Param("startTime")LocalDateTime startTime, @Param("endTime")LocalDateTime endTime, @Param("statisticType")String statisticType,@Param("objType")String objType,@Param("effectStatus")List effectStatus); + //本年计划统计(按照计划时间统计) + List statisticPlanReportYear(@Param("startTime")LocalDateTime startTime, @Param("endTime")LocalDateTime endTime, @Param("statisticType")String statisticType,@Param("objType")String objType,@Param("effectStatus")List effectStatus); - //问题数据 + //问题数据(问题发现时间统计) List statisticQueReport(@Param("startTime")LocalDateTime startTime, @Param("endTime")LocalDateTime endTime, @Param("statisticType")String statisticType,@Param("rectificationStatus")String rectificationStatus,@Param("objType")String objType); - //问题整改数量 + //问题整改数量(问题整改时间统计) List statisticQueReportRectify(@Param("startTime")LocalDateTime startTime, @Param("endTime")LocalDateTime endTime, @Param("statisticType")String statisticType,@Param("rectificationStatus")String rectificationStatus,@Param("objType")String objType); diff --git a/pqs-process/process-boot/src/main/java/com/njcn/process/mapper/mapping/SupvAlarmBackMapper.xml b/pqs-process/process-boot/src/main/java/com/njcn/process/mapper/mapping/SupvAlarmBackMapper.xml index a50694556..0cdf60c0c 100644 --- a/pqs-process/process-boot/src/main/java/com/njcn/process/mapper/mapping/SupvAlarmBackMapper.xml +++ b/pqs-process/process-boot/src/main/java/com/njcn/process/mapper/mapping/SupvAlarmBackMapper.xml @@ -19,4 +19,14 @@ + diff --git a/pqs-process/process-boot/src/main/java/com/njcn/process/mapper/mapping/SupvReportMMapper.xml b/pqs-process/process-boot/src/main/java/com/njcn/process/mapper/mapping/SupvReportMMapper.xml index 46915cc84..ba1579b8b 100644 --- a/pqs-process/process-boot/src/main/java/com/njcn/process/mapper/mapping/SupvReportMMapper.xml +++ b/pqs-process/process-boot/src/main/java/com/njcn/process/mapper/mapping/SupvReportMMapper.xml @@ -10,7 +10,7 @@ where supv_Type = #{statisticType} - and plan_Supv_Date between #{startTime} and #{endTime} + and effect_End_Time between #{startTime} and #{endTime} and obj_type = #{objType} @@ -57,4 +57,22 @@ group by a.duty_Org_Id + diff --git a/pqs-process/process-boot/src/main/java/com/njcn/process/service/ISupvAlarmBackService.java b/pqs-process/process-boot/src/main/java/com/njcn/process/service/ISupvAlarmBackService.java index 6d97ac669..049b7f569 100644 --- a/pqs-process/process-boot/src/main/java/com/njcn/process/service/ISupvAlarmBackService.java +++ b/pqs-process/process-boot/src/main/java/com/njcn/process/service/ISupvAlarmBackService.java @@ -25,4 +25,6 @@ public interface ISupvAlarmBackService extends IService { boolean delAlarmBack(List planIds); Page pageAlarmBack(SupvAlarmBackParam param); + + void downAlarmBack(); } diff --git a/pqs-process/process-boot/src/main/java/com/njcn/process/service/ISupvAlarmService.java b/pqs-process/process-boot/src/main/java/com/njcn/process/service/ISupvAlarmService.java index 0973bf878..a7fe5e213 100644 --- a/pqs-process/process-boot/src/main/java/com/njcn/process/service/ISupvAlarmService.java +++ b/pqs-process/process-boot/src/main/java/com/njcn/process/service/ISupvAlarmService.java @@ -24,4 +24,6 @@ public interface ISupvAlarmService extends IService { boolean delAlarm(List planIds); Page pageAlarm(SupvAlarmParam param); + + void downAlarm(); } diff --git a/pqs-process/process-boot/src/main/java/com/njcn/process/service/impl/SupvAlarmBackServiceImpl.java b/pqs-process/process-boot/src/main/java/com/njcn/process/service/impl/SupvAlarmBackServiceImpl.java index e2415e2a9..136324b7e 100644 --- a/pqs-process/process-boot/src/main/java/com/njcn/process/service/impl/SupvAlarmBackServiceImpl.java +++ b/pqs-process/process-boot/src/main/java/com/njcn/process/service/impl/SupvAlarmBackServiceImpl.java @@ -1,17 +1,18 @@ package com.njcn.process.service.impl; +import cn.afterturn.easypoi.excel.entity.ExportParams; import cn.hutool.core.bean.BeanUtil; -import cn.hutool.core.collection.CollUtil; import cn.hutool.core.util.StrUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.njcn.common.pojo.exception.BusinessException; +import com.njcn.poi.excel.ExcelUtil; import com.njcn.process.mapper.SupvAlarmBackMapper; import com.njcn.process.pojo.param.SupvAlarmBackParam; -import com.njcn.process.pojo.po.SupvAlarm; import com.njcn.process.pojo.po.SupvAlarmBack; import com.njcn.process.service.ISupvAlarmBackService; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.njcn.system.api.DicDataFeignClient; import com.njcn.user.api.DeptFeignClient; import com.njcn.user.pojo.po.Dept; import lombok.RequiredArgsConstructor; @@ -79,4 +80,11 @@ public class SupvAlarmBackServiceImpl extends ServiceImpl list = this.baseMapper.selectAlarmBack(); + ExportParams exportParams = new ExportParams("预告警单反馈数据模板(带*字段均是必填,请严格按照模板标准填入数据)", "预告警单反馈数据信息"); + ExcelUtil.exportExcel(exportParams,"预告警单反馈数据信息.xlsx",SupvAlarmBack.class, list); + } } diff --git a/pqs-process/process-boot/src/main/java/com/njcn/process/service/impl/SupvAlarmServiceImpl.java b/pqs-process/process-boot/src/main/java/com/njcn/process/service/impl/SupvAlarmServiceImpl.java index 01fd065f6..5da10aafc 100644 --- a/pqs-process/process-boot/src/main/java/com/njcn/process/service/impl/SupvAlarmServiceImpl.java +++ b/pqs-process/process-boot/src/main/java/com/njcn/process/service/impl/SupvAlarmServiceImpl.java @@ -1,23 +1,33 @@ package com.njcn.process.service.impl; +import cn.afterturn.easypoi.excel.entity.ExportParams; import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.date.DatePattern; import cn.hutool.core.date.DateUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.njcn.common.pojo.exception.BusinessException; +import com.njcn.poi.excel.ExcelUtil; import com.njcn.process.mapper.SupvAlarmMapper; import com.njcn.process.pojo.param.SupvAlarmParam; import com.njcn.process.pojo.po.SupvAlarm; -import com.njcn.process.pojo.po.SupvPlanHis; import com.njcn.process.service.ISupvAlarmService; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.njcn.system.api.DicDataFeignClient; +import com.njcn.system.enums.DicDataTypeEnum; +import com.njcn.system.pojo.po.DictData; import com.njcn.user.api.DeptFeignClient; import com.njcn.user.pojo.po.Dept; import lombok.RequiredArgsConstructor; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; +import java.time.format.DateTimeFormatter; import java.util.List; +import java.util.Map; +import java.util.function.Function; +import java.util.stream.Collectors; /** *

@@ -32,6 +42,7 @@ import java.util.List; public class SupvAlarmServiceImpl extends ServiceImpl implements ISupvAlarmService { private final DeptFeignClient deptFeignClient; + private final DicDataFeignClient dicDataFeignClient; @Value("${gw.code}") private String code; @@ -79,4 +90,32 @@ public class SupvAlarmServiceImpl extends ServiceImpl billList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.BILL_TYPE.getCode()).getData(); + Map mapBill = billList.stream().collect(Collectors.toMap(DictData::getId, Function.identity())); + + //所属专业 + List specialityList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.SPECIALITY_TYPE.getCode()).getData(); + Map mapSpeciality = specialityList.stream().collect(Collectors.toMap(DictData::getId, Function.identity())); + + List list = this.list(); + if(CollUtil.isNotEmpty(list)){ + for (SupvAlarm supvAlarm : list) { + supvAlarm.setTime(supvAlarm.getCreaterTime().format(DateTimeFormatter.ofPattern(DatePattern.NORM_DATETIME_PATTERN))); + if (mapBill.containsKey(supvAlarm.getBillType())) { + supvAlarm.setBillType(mapBill.get(supvAlarm.getBillType()).getName()); + } + + if (mapSpeciality.containsKey(supvAlarm.getSpecialityType())) { + supvAlarm.setSpecialityType(mapSpeciality.get(supvAlarm.getSpecialityType()).getName()); + } + } + } + ExportParams exportParams = new ExportParams("预告警单模板(带*字段均是必填,请严格按照模板标准填入数据)", "预告警单信息"); + ExcelUtil.exportExcel(exportParams,"预告警单信息.xlsx",SupvAlarm.class, list); + + } } diff --git a/pqs-process/process-boot/src/main/java/com/njcn/process/service/impl/SupvProblemServiceImpl.java b/pqs-process/process-boot/src/main/java/com/njcn/process/service/impl/SupvProblemServiceImpl.java index a2057c66f..aa72e74f3 100644 --- a/pqs-process/process-boot/src/main/java/com/njcn/process/service/impl/SupvProblemServiceImpl.java +++ b/pqs-process/process-boot/src/main/java/com/njcn/process/service/impl/SupvProblemServiceImpl.java @@ -145,6 +145,10 @@ public class SupvProblemServiceImpl extends ServiceImpl problemTypeList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.SUPV_PROBLEM_TYPE.getCode()).getData(); Map mapProblemType = problemTypeList.stream().collect(Collectors.toMap(DictData::getId, Function.identity())); + //问题类型 + List problemLevelList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.problem_level_type.getCode().trim()).getData(); + Map mapProblemLeve = problemLevelList.stream().collect(Collectors.toMap(DictData::getValue, Function.identity())); + for (SupvProblemVO supvProblem : supvProblemVOS) { Dept dept = deptFeignClient.getDeptByCode(supvProblem.getDutyOrgId()).getData(); supvProblem.setDutyOrgName(dept.getName()); @@ -155,6 +159,9 @@ public class SupvProblemServiceImpl extends ServiceImpl dictDataUhv = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.SUPV_TYPE.getCode()).getData(); Map mapStatistic = dictDataUhv.stream().collect(Collectors.toMap(DictData::getCode, Function.identity())); @@ -93,17 +95,27 @@ public class SupvReportMServiceImpl extends MppServiceImpl mapCode = deptList.stream().collect(Collectors.toMap(PvTerminalTreeVO::getCode, Function.identity())); Map mapList = deptList.stream().collect(Collectors.toMap(PvTerminalTreeVO::getId, Function.identity())); - List processPublicDTOListM = this.baseMapper.statisticPlanReport(firstDay,endTime,mapStatistic.get(DicDataEnum.UHV_Converter.getCode()).getId(),null,Stream.of("02","03","04").collect(Collectors.toList())); - List processPublicDTOListY = this.baseMapper.statisticPlanReport(firstYearDay,endYearDay,mapStatistic.get(DicDataEnum.UHV_Converter.getCode()).getId(),null,null); - List processPublicDTOListAll = this.baseMapper.statisticPlanReport(firstYearDay,endTime,mapStatistic.get(DicDataEnum.UHV_Converter.getCode()).getId(),null, Stream.of("02","03","04").collect(Collectors.toList())); + //特高压换流站月报监督数量 + List processPublicDTOListM = this.baseMapper.statisticPlanReport(firstDay,endTime,mapStatistic.get(DicDataEnum.UHV_Converter.getCode()).getId(),null,null); + List processPublicDTOListY = this.baseMapper.statisticPlanReportYear(firstYearDay,endYearDay,mapStatistic.get(DicDataEnum.UHV_Converter.getCode()).getId(),null,null); + List processPublicDTOListAll = this.baseMapper.statisticPlanReport(firstYearDay,endTime,mapStatistic.get(DicDataEnum.UHV_Converter.getCode()).getId(),null, null); + + //新能源场站(在运站)月报监督数量 + List processPublicDTOListNewM = this.baseMapper.statisticPlanReport(firstDay,endTime,mapStatistic.get(DicDataEnum.New_Energy.getCode()).getId(),"01",null); + List processPublicDTOListNewY = this.baseMapper.statisticPlanReportYear(firstYearDay,endYearDay,mapStatistic.get(DicDataEnum.New_Energy.getCode()).getId(),"01",null); + List processPublicDTOListNewAll = this.baseMapper.statisticPlanReport(firstYearDay,endTime,mapStatistic.get(DicDataEnum.New_Energy.getCode()).getId(),"01",null); + + //新能源场站(改扩建)月报监督新数量 + List processPublicDTOListNewZM = this.baseMapper.statisticPlanReport(firstDay,endTime,mapStatistic.get(DicDataEnum.New_Energy.getCode()).getId(),"02",null); + List processPublicDTOListNewZY = this.baseMapper.statisticPlanReportYear(firstYearDay,endYearDay,mapStatistic.get(DicDataEnum.New_Energy.getCode()).getId(),"02",null); + List processPublicDTOListNewZAll = this.baseMapper.statisticPlanReport(firstYearDay,endTime,mapStatistic.get(DicDataEnum.New_Energy.getCode()).getId(),"02",null); + + //敏感用户月报监督数量 + List processPublicDTOMingGanM = this.baseMapper.statisticPlanReport(firstDay,endTime,mapStatistic.get(DicDataEnum.POWER_QUALITY.getCode()).getId(),null,null); + List processPublicDTOMingGanY = this.baseMapper.statisticPlanReportYear(firstYearDay,endYearDay,mapStatistic.get(DicDataEnum.POWER_QUALITY.getCode()).getId(),null,null); + List processPublicDTOMingGanAll = this.baseMapper.statisticPlanReport(firstYearDay,endTime,mapStatistic.get(DicDataEnum.POWER_QUALITY.getCode()).getId(),null,null); - List processPublicDTOListNewM = this.baseMapper.statisticPlanReport(firstDay,endTime,mapStatistic.get(DicDataEnum.New_Energy.getCode()).getId(),"01",Stream.of("02","03","04").collect(Collectors.toList())); - List processPublicDTOListNewY = this.baseMapper.statisticPlanReport(firstYearDay,endYearDay,mapStatistic.get(DicDataEnum.New_Energy.getCode()).getId(),"01",null); - List processPublicDTOListNewAll = this.baseMapper.statisticPlanReport(firstYearDay,endTime,mapStatistic.get(DicDataEnum.New_Energy.getCode()).getId(),"01",Stream.of("02","03","04").collect(Collectors.toList())); - List processPublicDTOListNewZM = this.baseMapper.statisticPlanReport(firstDay,endTime,mapStatistic.get(DicDataEnum.New_Energy.getCode()).getId(),"02",Stream.of("02","03","04").collect(Collectors.toList())); - List processPublicDTOListNewZY = this.baseMapper.statisticPlanReport(firstYearDay,endYearDay,mapStatistic.get(DicDataEnum.New_Energy.getCode()).getId(),"02",null); - List processPublicDTOListNewZAll = this.baseMapper.statisticPlanReport(firstYearDay,endTime,mapStatistic.get(DicDataEnum.New_Energy.getCode()).getId(),"02",Stream.of("02","03","04").collect(Collectors.toList())); //换流站问题总数量 @@ -111,49 +123,43 @@ public class SupvReportMServiceImpl extends MppServiceImpl processPublicDTOQesAll = this.baseMapper.statisticQueReport(firstYearDay,endTime,mapStatistic.get(DicDataEnum.UHV_Converter.getCode()).getId(),null,null); //换流站问题已整改数量 - List processPublicDTOQesYesM = this.baseMapper.statisticQueReport(firstDay,endTime,mapStatistic.get(DicDataEnum.UHV_Converter.getCode()).getId(),"01",null); - List processPublicDTOQesYesAll = this.baseMapper.statisticQueReport(firstYearDay,endTime,mapStatistic.get(DicDataEnum.UHV_Converter.getCode()).getId(),"01",null); + List processPublicDTOQesYesM = this.baseMapper.statisticQueReportRectify(firstDay,endTime,mapStatistic.get(DicDataEnum.UHV_Converter.getCode()).getId(),"01",null); + List processPublicDTOQesYesAll = this.baseMapper.statisticQueReportRectify(firstYearDay,endTime,mapStatistic.get(DicDataEnum.UHV_Converter.getCode()).getId(),"01",null); - //新能源问题总数量 + //新能源(在运站)问题总数量 List processPublicDTOQesNewM = this.baseMapper.statisticQueReport(firstDay,endTime,mapStatistic.get(DicDataEnum.New_Energy.getCode()).getId(),null,"01"); List processPublicDTOQesNewAll = this.baseMapper.statisticQueReport(firstYearDay,endTime,mapStatistic.get(DicDataEnum.New_Energy.getCode()).getId(),null,"01"); - //新能源问题已整改数量 - List processPublicDTOQesNewYesM = this.baseMapper.statisticQueReportRectify(firstDay,endTime,mapStatistic.get(DicDataEnum.New_Energy.getCode()).getId(),"01","01"); - List processPublicDTOQesNewYesAll = this.baseMapper.statisticQueReportRectify(firstYearDay,endTime,mapStatistic.get(DicDataEnum.New_Energy.getCode()).getId(),"01","01"); + //新能源(在运站)问题已整改数量 + List processPublicDTOQesNewYesM = this.baseMapper.statisticQueReportRectify(firstDay,endTime,mapStatistic.get(DicDataEnum.New_Energy.getCode()).getId(),"02","01"); + List processPublicDTOQesNewYesAll = this.baseMapper.statisticQueReportRectify(firstYearDay,endTime,mapStatistic.get(DicDataEnum.New_Energy.getCode()).getId(),"02","01"); - //新能源改扩建问题数量 + //新能源(改扩建)问题数量 List processPublicDTOQesNewGaiM = this.baseMapper.statisticQueReport(firstDay,endTime,mapStatistic.get(DicDataEnum.New_Energy.getCode()).getId(),null,"02"); List processPublicDTOQesNewGaiAll = this.baseMapper.statisticQueReport(firstYearDay,endTime,mapStatistic.get(DicDataEnum.New_Energy.getCode()).getId(),null,"02"); - //新能源改扩建整改问题数量 - List processPublicDTOQesNewGaiYesM = this.baseMapper.statisticQueReportRectify(firstDay,endTime,mapStatistic.get(DicDataEnum.New_Energy.getCode()).getId(),"01","02"); - List processPublicDTOQesNewGaiYesAll = this.baseMapper.statisticQueReportRectify(firstYearDay,endTime,mapStatistic.get(DicDataEnum.New_Energy.getCode()).getId(),"01","02"); - - - //敏感用户 - List processPublicDTOMingGanM = this.baseMapper.statisticPlanReport(firstDay,endTime,mapStatistic.get(DicDataEnum.POWER_QUALITY.getCode()).getId(),null,Stream.of("02","03","04").collect(Collectors.toList())); - List processPublicDTOMingGanY = this.baseMapper.statisticPlanReport(firstYearDay,endYearDay,mapStatistic.get(DicDataEnum.POWER_QUALITY.getCode()).getId(),null,null); - List processPublicDTOMingGanAll = this.baseMapper.statisticPlanReport(firstYearDay,endTime,mapStatistic.get(DicDataEnum.POWER_QUALITY.getCode()).getId(),null,Stream.of("02","03","04").collect(Collectors.toList())); + //新能源(改扩建)整改问题数量 + List processPublicDTOQesNewGaiYesM = this.baseMapper.statisticQueReportRectify(firstDay,endTime,mapStatistic.get(DicDataEnum.New_Energy.getCode()).getId(),"02","02"); + List processPublicDTOQesNewGaiYesAll = this.baseMapper.statisticQueReportRectify(firstYearDay,endTime,mapStatistic.get(DicDataEnum.New_Energy.getCode()).getId(),"02","02"); //敏感用户问题总数量 List processPublicDTOQesMingGanM = this.baseMapper.statisticQueReport(firstDay,endTime,mapStatistic.get(DicDataEnum.POWER_QUALITY.getCode()).getId(),null,null); List processPublicDTOQesMingGanAll = this.baseMapper.statisticQueReport(firstYearDay,endTime,mapStatistic.get(DicDataEnum.POWER_QUALITY.getCode()).getId(),null,null); //敏感用户问题已整改数量 - List processPublicDTOQesMingGanYesM = this.baseMapper.statisticQueReportRectify(firstDay,endTime,mapStatistic.get(DicDataEnum.POWER_QUALITY.getCode()).getId(),"01",null); - List processPublicDTOQesMingGanYesAll = this.baseMapper.statisticQueReportRectify(firstYearDay,endTime,mapStatistic.get(DicDataEnum.POWER_QUALITY.getCode()).getId(),"01",null); + List processPublicDTOQesMingGanYesM = this.baseMapper.statisticQueReportRectify(firstDay,endTime,mapStatistic.get(DicDataEnum.POWER_QUALITY.getCode()).getId(),"02",null); + List processPublicDTOQesMingGanYesAll = this.baseMapper.statisticQueReportRectify(firstYearDay,endTime,mapStatistic.get(DicDataEnum.POWER_QUALITY.getCode()).getId(),"02",null); - //电压 - List processPublicDTODianYaListM = this.baseMapper.statisticPlanReport(firstYearDay,endTime,mapStatistic.get(DicDataEnum.Technical_Super.getCode()).getId(),null,null); - List processPublicDTODianYaListAll = this.baseMapper.statisticPlanReport(firstYearDay,endTime,mapStatistic.get(DicDataEnum.Technical_Super.getCode()).getId(),null,Stream.of("02","03","04").collect(Collectors.toList())); + //供电电压本月前统计 + List processPublicDTODianYaListM = this.baseMapper.statisticPlanReport(firstYearDay,lastEndTime,mapStatistic.get(DicDataEnum.Technical_Super.getCode()).getId(),null,null); + List processPublicDTODianYaListAll = this.baseMapper.statisticPlanReport(firstYearDay,lastEndTime,mapStatistic.get(DicDataEnum.Technical_Super.getCode()).getId(),null,null); - //本月问题数量和累计问题数量 + //供电电压问题数量 List processPublicDTODianYaGanM = this.baseMapper.statisticQueReport(firstDay,endTime,mapStatistic.get(DicDataEnum.Technical_Super.getCode()).getId(),null,null); List processPublicDTODianYaGanAll = this.baseMapper.statisticQueReport(firstYearDay,endTime,mapStatistic.get(DicDataEnum.Technical_Super.getCode()).getId(),null,null); - //整改 - List processPublicDTODianYaGanYesM = this.baseMapper.statisticQueReportRectify(firstDay,endTime,mapStatistic.get(DicDataEnum.Technical_Super.getCode()).getId(),"01",null); - List processPublicDTODianYaGanYesAll = this.baseMapper.statisticQueReportRectify(firstYearDay,endTime,mapStatistic.get(DicDataEnum.Technical_Super.getCode()).getId(),"01",null); + //供电电压已整改问题 + List processPublicDTODianYaGanYesM = this.baseMapper.statisticQueReportRectify(firstDay,endTime,mapStatistic.get(DicDataEnum.Technical_Super.getCode()).getId(),"02",null); + List processPublicDTODianYaGanYesAll = this.baseMapper.statisticQueReportRectify(firstYearDay,endTime,mapStatistic.get(DicDataEnum.Technical_Super.getCode()).getId(),"02",null); List supvReportMBatch = new ArrayList<>();