From 5b5407d1356ecf55048118bdadfeee84ecee01c1 Mon Sep 17 00:00:00 2001 From: zhaoqifeng Date: Wed, 14 Dec 2022 17:56:21 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BA=8B=E4=BB=B6=E8=B5=8B=E5=80=BC=E5=BE=97?= =?UTF-8?q?=E5=88=86=E7=9B=B8=E5=85=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../excel/handler/CustomMergeStrategy.java | 91 +++++++ .../dataaggre/constant/EventConstant.java | 10 + .../form/EventCategoryFormDTO.java | 3 + .../form/EventCategoryListFormDTO.java | 65 +++++ .../result/EventCategoryListResultDTO.java | 59 +++++ .../result/EventScoreTotalResultDTO.java | 33 +++ .../controller/PingYinEventController.java | 132 ++++++++++ .../dao/evaluationindex/PingYinEventDao.java | 72 ++++++ .../evaluationindex/PingYinEventService.java | 35 +++ .../impl/PingYinEventServiceImpl.java | 133 +++++++++- .../src/main/resources/excel/eventScore.xlsx | Bin 0 -> 12491 bytes .../evaluationindex/PingYinEventDao.xml | 236 +++++++++++++++++- .../screen/GridstaffWorkInfoPingyinDTO.java | 6 + .../screen/ScreenPyEventDataEntity.java | 26 +- .../impl/ScreenPyEventDataServiceImpl.java | 19 ++ .../GridstaffWorkInfoPingyinServiceImpl.java | 12 + .../dto/form/patrol/PatrolQueryFormDTO.java | 3 + .../dto/result/PatrolRoutineWorkResult.java | 5 +- .../resources/mapper/PatrolRoutineWorkDao.xml | 9 + 19 files changed, 921 insertions(+), 28 deletions(-) create mode 100644 epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/poi/excel/handler/CustomMergeStrategy.java create mode 100644 epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/constant/EventConstant.java create mode 100644 epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/evaluationindex/form/EventCategoryListFormDTO.java create mode 100644 epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/evaluationindex/result/EventCategoryListResultDTO.java create mode 100644 epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/evaluationindex/result/EventScoreTotalResultDTO.java create mode 100644 epmet-module/data-aggregator/data-aggregator-server/src/main/resources/excel/eventScore.xlsx diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/poi/excel/handler/CustomMergeStrategy.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/poi/excel/handler/CustomMergeStrategy.java new file mode 100644 index 0000000000..bbe8cafbca --- /dev/null +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/poi/excel/handler/CustomMergeStrategy.java @@ -0,0 +1,91 @@ +package com.epmet.commons.tools.utils.poi.excel.handler;/** + * @author ZhaoQiFeng + * @date 2022/12/14 + * @apiNote + */ + +import com.alibaba.excel.metadata.Head; +import com.alibaba.excel.write.merge.AbstractMergeStrategy; +import org.apache.commons.collections4.CollectionUtils; +import org.apache.poi.ss.usermodel.Cell; +import org.apache.poi.ss.usermodel.Sheet; +import org.apache.poi.ss.util.CellRangeAddress; + +import java.util.ArrayList; +import java.util.List; + +/** + * 自定义合并策略 该类继承了AbstractMergeStrategy抽象合并策略,需要重写merge()方法 + * @Author zhaoqifeng + * @Date 2022/12/14 15:10 + */ +public class CustomMergeStrategy extends AbstractMergeStrategy { + + /** + * 分组,每几行合并一次 + */ + private List exportFieldGroupCountList; + + /** + * 目标合并列index + */ + private Integer targetColumnIndex; + + // 需要开始合并单元格的首行index + private Integer rowIndex; + + // exportDataList为待合并目标列的值 + public CustomMergeStrategy(List exportDataList, Integer targetColumnIndex) { + this.exportFieldGroupCountList = getGroupCountList(exportDataList); + this.targetColumnIndex = targetColumnIndex; + } + + + @Override + protected void merge(Sheet sheet, Cell cell, Head head, Integer relativeRowIndex) { + + if (null == rowIndex) { + rowIndex = cell.getRowIndex(); + } + // 仅从首行以及目标列的单元格开始合并,忽略其他 + if (cell.getRowIndex() == rowIndex && cell.getColumnIndex() == targetColumnIndex) { + mergeGroupColumn(sheet); + } + } + + private void mergeGroupColumn(Sheet sheet) { + int rowCount = rowIndex; + for (Integer count : exportFieldGroupCountList) { + if(count == 1) { + rowCount += count; + continue ; + } + // 合并单元格 + CellRangeAddress cellRangeAddress = new CellRangeAddress(rowCount, rowCount + count - 1, targetColumnIndex, targetColumnIndex); + sheet.addMergedRegionUnsafe(cellRangeAddress); + rowCount += count; + } + } + + // 该方法将目标列根据值是否相同连续可合并,存储可合并的行数 + private List getGroupCountList(List exportDataList){ + if (CollectionUtils.isEmpty(exportDataList)) { + return new ArrayList<>(); + } + + List groupCountList = new ArrayList<>(); + int count = 1; + + for (int i = 1; i < exportDataList.size(); i++) { + if (exportDataList.get(i).equals(exportDataList.get(i - 1))) { + count++; + } else { + groupCountList.add(count); + count = 1; + } + } + // 处理完最后一条后 + groupCountList.add(count); + return groupCountList; + } +} diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/constant/EventConstant.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/constant/EventConstant.java new file mode 100644 index 0000000000..ad8948fa23 --- /dev/null +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/constant/EventConstant.java @@ -0,0 +1,10 @@ +package com.epmet.dataaggre.constant; + +/** + * @Author zxc + * @DateTime 2020/12/25 上午10:47 + */ +public interface EventConstant { + String PROJECT = "project"; + String WORK = "work"; +} diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/evaluationindex/form/EventCategoryFormDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/evaluationindex/form/EventCategoryFormDTO.java index 5d848e185e..f9cd88c5e5 100644 --- a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/evaluationindex/form/EventCategoryFormDTO.java +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/evaluationindex/form/EventCategoryFormDTO.java @@ -44,4 +44,7 @@ public class EventCategoryFormDTO implements Serializable { */ @NotBlank(message = "组织名称不能为空",groups = CategoryEventExportForm.class) private String orgName; + + private String name; + private String mobile; } diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/evaluationindex/form/EventCategoryListFormDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/evaluationindex/form/EventCategoryListFormDTO.java new file mode 100644 index 0000000000..58bf30b26d --- /dev/null +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/evaluationindex/form/EventCategoryListFormDTO.java @@ -0,0 +1,65 @@ +package com.epmet.dataaggre.dto.evaluationindex.form; + +import com.epmet.commons.tools.dto.form.PageFormDTO; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import java.io.Serializable; + +/** + * @author Administrator + */ +@Data +public class EventCategoryListFormDTO extends PageFormDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + public interface EventCategoryForm{} + public interface CategoryEventExportForm {} + public interface CategoryEventListExportForm {} + /** + * 组织ID + */ + private String customerId; + + /** + * 组织ID + */ + private String orgId; + + /** + * 组织类型 组织:agency,网格:grid + */ + private String orgType; + + @NotBlank(message = "结束时间不能为空",groups = {EventCategoryForm.class,CategoryEventExportForm.class}) + private String endTime; + + /** + * 类型,project:事件, work:例行工作 + */ + @NotNull(message = "事件类型不能为空",groups = CategoryEventListExportForm.class) + private String eventType; + + /** + * 开始时间 + */ + private String startTime; + + /** + * 组织名称 + */ + @NotBlank(message = "组织名称不能为空",groups = CategoryEventExportForm.class) + private String orgName; + + @NotNull(message = "categoryCode不能为空",groups = {EventCategoryForm.class, CategoryEventListExportForm.class}) + private String categoryCode; + + @NotNull(message = "categoryName不能为空",groups = CategoryEventListExportForm.class) + private String categoryName; + private String parentCategoryName; + + private String name; + private String mobile; +} diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/evaluationindex/result/EventCategoryListResultDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/evaluationindex/result/EventCategoryListResultDTO.java new file mode 100644 index 0000000000..6836682946 --- /dev/null +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/evaluationindex/result/EventCategoryListResultDTO.java @@ -0,0 +1,59 @@ +package com.epmet.dataaggre.dto.evaluationindex.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @author Administrator + */ +@Data +public class EventCategoryListResultDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 事件ID + */ + private String eventId; + + /** + * 事件类型 项目:project,例行工作:work + */ + private String eventType; + + /** + * 标题 + */ + private String title; + + /** + * 类别 + */ + private String category; + + /** + * 项目状态:待处理 pending,结案closed + */ + private String status; + + /** + * 项目状态:待处理 pending,结案closed + */ + private String statusDesc; + + /** + * 所属网格 + */ + private String gridName; + private String gridId; + /** + * 项目创建时间 + */ + private String createTime; + + private String staffName; + + private Integer score; + +} diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/evaluationindex/result/EventScoreTotalResultDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/evaluationindex/result/EventScoreTotalResultDTO.java new file mode 100644 index 0000000000..419efe119a --- /dev/null +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/evaluationindex/result/EventScoreTotalResultDTO.java @@ -0,0 +1,33 @@ +package com.epmet.dataaggre.dto.evaluationindex.result;/** + * @author ZhaoQiFeng + * @date 2022/12/14 + * @apiNote + */ + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Description + * @Author zhaoqifeng + * @Date 2022/12/14 13:39 + */ +@Data +public class EventScoreTotalResultDTO implements Serializable { + private static final long serialVersionUID = 2570384890580378137L; + private String orgName; + private String date; + /** + * 总分 + */ + private String totalScore; + /** + * 网格员数量 + */ + private String memberCount; + /** + * 考核得分 + */ + private String aveScore; +} diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/PingYinEventController.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/PingYinEventController.java index 50531e28b1..8ec1f0089b 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/PingYinEventController.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/PingYinEventController.java @@ -1,20 +1,43 @@ package com.epmet.dataaggre.controller; +import com.alibaba.excel.EasyExcel; +import com.alibaba.excel.ExcelWriter; +import com.alibaba.excel.write.metadata.WriteSheet; +import com.alibaba.excel.write.metadata.fill.FillConfig; +import com.alibaba.fastjson.JSON; import com.epmet.commons.tools.annotation.LoginUser; +import com.epmet.commons.tools.exception.EpmetErrorCode; +import com.epmet.commons.tools.exception.EpmetException; +import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.security.dto.TokenDto; +import com.epmet.commons.tools.utils.DateUtils; import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.utils.poi.excel.handler.CustomMergeStrategy; import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.dataaggre.dto.evaluationindex.EventCategoryResultDTO; import com.epmet.dataaggre.dto.evaluationindex.form.EventCategoryFormDTO; +import com.epmet.dataaggre.dto.evaluationindex.form.EventCategoryListFormDTO; +import com.epmet.dataaggre.dto.evaluationindex.result.EventCategoryListResultDTO; +import com.epmet.dataaggre.dto.evaluationindex.result.EventScoreTotalResultDTO; import com.epmet.dataaggre.service.evaluationindex.PingYinEventService; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.springframework.core.io.ClassPathResource; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import javax.annotation.Resource; +import javax.servlet.ServletOutputStream; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.io.InputStream; +import java.io.PrintWriter; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; import java.util.List; +import java.util.stream.Collectors; /** @@ -41,5 +64,114 @@ public class PingYinEventController { return new Result>().ok(pingYinEventService.getEventCategorySore(tokenDto, formDTO)); } + /** + * 事件分类列表 + * + * @Param tokenDto + * @Param formDTO + * @Return {@link Result< PageData< EventCategoryListResultDTO>>} + * @Author zhaoqifeng + * @Date 2022/12/13 9:55 + */ + @PostMapping("getEventCategoryList") + public Result> getEventCategoryList(@LoginUser TokenDto tokenDto, @RequestBody EventCategoryListFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO, EventCategoryListFormDTO.EventCategoryForm.class); + formDTO.setCustomerId(tokenDto.getCustomerId()); + return new Result>().ok(pingYinEventService.getEventCategoryList(formDTO)); + } + + /** + * 事件赋值得分总计 + * + * @Param tokenDto + * @Param formDTO + * @Return {@link Result< EventScoreTotalResultDTO>} + * @Author zhaoqifeng + * @Date 2022/12/14 13:46 + */ + @PostMapping("getEventScoreTotal") + public Result getEventScoreTotal(@LoginUser TokenDto tokenDto, @RequestBody EventCategoryFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO, EventCategoryListFormDTO.EventCategoryForm.class); + formDTO.setCustomerId(tokenDto.getCustomerId()); + return new Result().ok(pingYinEventService.getEventScoreTotal(formDTO)); + } + + /** + * 事件赋值得分导出 + * @Param tokenDto + * @Param formDTO + * @Param response + * @Return + * @Author zhaoqifeng + * @Date 2022/12/14 16:08 + */ + @PostMapping("eventScoreExport") + public void eventScoreExport(@LoginUser TokenDto tokenDto, + @RequestBody EventCategoryFormDTO formDTO, HttpServletResponse response) throws Exception{ + ValidatorUtils.validateEntity(formDTO, EventCategoryListFormDTO.EventCategoryForm.class); + formDTO.setCustomerId(tokenDto.getCustomerId()); + String fileName = formDTO.getOrgName() + "事件赋值得分.xlsx"; + ExcelWriter excelWriter = null; + //获取模板 + ClassPathResource classPathResource = new ClassPathResource("excel/eventScore.xlsx"); + InputStream inputStream = classPathResource.getInputStream(); + try { + + try { + fileName = URLEncoder.encode("事件赋值得分.xlsx", "UTF-8"); + } catch (UnsupportedEncodingException e) { + e.printStackTrace(); + } + response.setHeader("Content-disposition", "attachment; filename=" + fileName); + response.setContentType("application/msexcel;charset=UTF-8"); + response.setHeader("Pragma", "No-cache"); + response.setHeader("Cache-Control", "no-cache"); + response.setDateHeader("Expires", 0); + ServletOutputStream outputStream = response.getOutputStream(); + //总计 + EventScoreTotalResultDTO scoreTotal = pingYinEventService.getEventScoreTotal(formDTO); + scoreTotal.setOrgName(formDTO.getOrgName()); + String endTime =DateUtils.format(DateUtils.parse(formDTO.getEndTime(), DateUtils.DATE_PATTERN_YYYYMMDD), DateUtils.DATE_NAME_PATTERN); + if (StringUtils.isNotEmpty(formDTO.getStartTime())) { + String startTime =DateUtils.format(DateUtils.parse(formDTO.getStartTime(), DateUtils.DATE_PATTERN_YYYYMMDD), DateUtils.DATE_NAME_PATTERN); + scoreTotal.setDate(startTime.concat("—").concat(endTime)); + } else { + scoreTotal.setDate("截止到" + endTime); + } + //分类统计 + List categoryList = pingYinEventService.getEventCategorySoreExport(tokenDto, formDTO); + //设置输出流和模板信息 + excelWriter = EasyExcel.write(outputStream).withTemplate(inputStream).build(); + WriteSheet writeSheet = EasyExcel.writerSheet(0) + .registerWriteHandler(new CustomMergeStrategy(categoryList.stream().map(EventCategoryResultDTO::getEventType).collect(Collectors.toList()), 0)) + .registerWriteHandler(new CustomMergeStrategy(categoryList.stream().map(EventCategoryResultDTO::getParentCategoryName).collect(Collectors.toList()), 1)) + .build(); + //开启自动换行,自动换行表示每次写入一条list数据是都会重新生成一行空行,此选项默认是关闭的,需要提前设置为true + FillConfig fillConfig = FillConfig.builder().forceNewRow(Boolean.TRUE).build(); + excelWriter.fill(categoryList, fillConfig, writeSheet); + excelWriter.fill(scoreTotal, writeSheet); + } catch (EpmetException e) { + response.reset(); + response.setCharacterEncoding("UTF-8"); + response.setHeader("content-type", "application/json; charset=UTF-8"); + PrintWriter printWriter = response.getWriter(); + Result result = new Result<>().error(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),e.getMsg()); + printWriter.write(JSON.toJSONString(result)); + printWriter.close(); + } catch (Exception e) { + log.error("export exception", e); + } finally { + if (excelWriter != null) { + excelWriter.finish(); + } + try { + inputStream.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + } + + } diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/evaluationindex/PingYinEventDao.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/evaluationindex/PingYinEventDao.java index 86ddcb8590..66f9962f37 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/evaluationindex/PingYinEventDao.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/evaluationindex/PingYinEventDao.java @@ -19,6 +19,8 @@ package com.epmet.dataaggre.dao.evaluationindex; import com.epmet.dataaggre.dto.evaluationindex.EventCategoryResultDTO; import com.epmet.dataaggre.dto.evaluationindex.form.EventCategoryFormDTO; +import com.epmet.dataaggre.dto.evaluationindex.form.EventCategoryListFormDTO; +import com.epmet.dataaggre.dto.evaluationindex.result.EventCategoryListResultDTO; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -67,4 +69,74 @@ public interface PingYinEventDao { * @Date 2022/12/9 11:00 */ List selectWorkCategoryScoreList(EventCategoryFormDTO formDTO); + + /** + * 项目分类列表 + * + * @Param formDTO + * @Return {@link List< EventCategoryListResultDTO>} + * @Author zhaoqifeng + * @Date 2022/12/13 10:12 + */ + List getProjectCategoryList(EventCategoryListFormDTO formDTO); + + /** + * 例行工作 + * + * @Param formDTO + * @Return {@link List< EventCategoryListResultDTO>} + * @Author zhaoqifeng + * @Date 2022/12/13 10:12 + */ + List getWorkCategoryList(EventCategoryListFormDTO formDTO); + + /** + * 上报事件总分 + * + * @Param formDTO + * @Return {@link Long} + * @Author zhaoqifeng + * @Date 2022/12/14 13:56 + */ + Long getProjectTotalScore(EventCategoryFormDTO formDTO); + + /** + * 例行工作总分 + * + * @Param formDTO + * @Return {@link Long} + * @Author zhaoqifeng + * @Date 2022/12/14 13:56 + */ + Long getWorkTotalScore(EventCategoryFormDTO formDTO); + + /** + * 网格员数 + * + * @Param formDTO + * @Return {@link Long} + * @Author zhaoqifeng + * @Date 2022/12/14 13:56 + */ + Long getMemberCount(EventCategoryFormDTO formDTO); + + /** + * 获取项目分类 + * + * @Param customerId + * @Return {@link List< EventCategoryResultDTO>} + * @Author zhaoqifeng + * @Date 2022/12/9 13:40 + */ + List selectProjectCategoryForExport(@Param("customerId")String customerId); + + /** + * 获取例行工作分类 + * + * @Param + * @Return {@link List< EventCategoryResultDTO>} + * @Author zhaoqifeng + * @Date 2022/12/9 13:41 + */ + List selectWorkCategoryForExport(); } diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/evaluationindex/PingYinEventService.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/evaluationindex/PingYinEventService.java index 9e93890ad2..1e4bb50c07 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/evaluationindex/PingYinEventService.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/evaluationindex/PingYinEventService.java @@ -1,8 +1,12 @@ package com.epmet.dataaggre.service.evaluationindex; +import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.dataaggre.dto.evaluationindex.EventCategoryResultDTO; import com.epmet.dataaggre.dto.evaluationindex.form.EventCategoryFormDTO; +import com.epmet.dataaggre.dto.evaluationindex.form.EventCategoryListFormDTO; +import com.epmet.dataaggre.dto.evaluationindex.result.EventCategoryListResultDTO; +import com.epmet.dataaggre.dto.evaluationindex.result.EventScoreTotalResultDTO; import java.util.List; @@ -21,4 +25,35 @@ public interface PingYinEventService { * @Date 2022/12/9 9:55 */ List getEventCategorySore (TokenDto tokenDto, EventCategoryFormDTO formDTO); + + /** + * 事件分类列表 + * + * @Param formDTO + * @Return {@link PageData< EventCategoryListResultDTO>} + * @Author zhaoqifeng + * @Date 2022/12/13 9:55 + */ + PageData getEventCategoryList(EventCategoryListFormDTO formDTO); + + /** + * 事件赋值得分总计 + * + * @Param formDTO + * @Return {@link EventScoreTotalResultDTO} + * @Author zhaoqifeng + * @Date 2022/12/14 13:46 + */ + EventScoreTotalResultDTO getEventScoreTotal(EventCategoryFormDTO formDTO); + + /** + * 事件赋值得分导出 + * + * @Param tokenDto + * @Param formDTO + * @Return {@link List} + * @Author zhaoqifeng + * @Date 2022/12/9 9:55 + */ + List getEventCategorySoreExport (TokenDto tokenDto, EventCategoryFormDTO formDTO); } diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/evaluationindex/impl/PingYinEventServiceImpl.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/evaluationindex/impl/PingYinEventServiceImpl.java index d2b3180459..2ac0e78511 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/evaluationindex/impl/PingYinEventServiceImpl.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/evaluationindex/impl/PingYinEventServiceImpl.java @@ -4,20 +4,30 @@ import com.epmet.commons.dynamic.datasource.annotation.DataSource; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; import com.epmet.commons.tools.exception.EpmetException; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.redis.common.CustomerOrgRedis; import com.epmet.commons.tools.redis.common.CustomerStaffRedis; +import com.epmet.commons.tools.redis.common.bean.GridInfoCache; import com.epmet.commons.tools.security.dto.TokenDto; -import com.epmet.commons.tools.utils.DateUtils; import com.epmet.dataaggre.constant.DataSourceConstant; +import com.epmet.dataaggre.constant.EventConstant; import com.epmet.dataaggre.dao.evaluationindex.PingYinEventDao; import com.epmet.dataaggre.dto.evaluationindex.EventCategoryResultDTO; import com.epmet.dataaggre.dto.evaluationindex.form.EventCategoryFormDTO; +import com.epmet.dataaggre.dto.evaluationindex.form.EventCategoryListFormDTO; +import com.epmet.dataaggre.dto.evaluationindex.result.EventCategoryListResultDTO; +import com.epmet.dataaggre.dto.evaluationindex.result.EventScoreTotalResultDTO; import com.epmet.dataaggre.service.evaluationindex.PingYinEventService; +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Service; import javax.annotation.Resource; +import java.math.BigDecimal; +import java.math.RoundingMode; import java.util.ArrayList; import java.util.List; @@ -47,9 +57,6 @@ public class PingYinEventServiceImpl implements PingYinEventService { @Override public List getEventCategorySore(TokenDto tokenDto, EventCategoryFormDTO formDTO) { List result = new ArrayList<>(); - if (StringUtils.isNotBlank(formDTO.getStartTime())){ - formDTO.setStartTime(DateUtils.getBeforeNDay(formDTO.getStartTime(), NumConstant.ONE)); - } if (StringUtils.isBlank(formDTO.getOrgId())){ CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(tokenDto.getCustomerId(), tokenDto.getUserId()); if (null == staffInfo){ @@ -95,4 +102,122 @@ public class PingYinEventServiceImpl implements PingYinEventService { result.addAll(workCategoryList); return result; } + + /** + * 事件分类列表 + * + * @param formDTO + * @Param formDTO + * @Return {@link PageData < EventCategoryListResultDTO >} + * @Author zhaoqifeng + * @Date 2022/12/13 9:55 + */ + @Override + public PageData getEventCategoryList(EventCategoryListFormDTO formDTO) { + PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize(), formDTO.getIsPage()); + List list; + if (EventConstant.PROJECT.equals(formDTO.getEventType())) { + //项目分类列表 + list = pingYinEventDao.getProjectCategoryList(formDTO); + } else { + //例行工作分类列表 + list = pingYinEventDao.getWorkCategoryList(formDTO); + } + PageInfo pageInfo = new PageInfo<>(list); + if(CollectionUtils.isNotEmpty(list)) { + list.forEach(item -> { + GridInfoCache gridInfo = CustomerOrgRedis.getGridInfo(item.getGridId()); + if (null == gridInfo) { + log.error("获取网格信息失败"); + return; + } + item.setGridName(gridInfo.getGridNamePath()); + if (EventConstant.PROJECT.equals(item.getEventType())) { + item.setStatusDesc("pending".equals(item.getStatus())?"处理中":"已结案"); + } + }); + } + return new PageData<>(list, pageInfo.getTotal()); + } + + /** + * 事件赋值得分总计 + * + * @param formDTO + * @Param formDTO + * @Return {@link EventScoreTotalResultDTO} + * @Author zhaoqifeng + * @Date 2022/12/14 13:46 + */ + @Override + public EventScoreTotalResultDTO getEventScoreTotal(EventCategoryFormDTO formDTO) { + formDTO.setCustomerId("6f203e30de1a65aab7e69c058826cd80"); + EventScoreTotalResultDTO result = new EventScoreTotalResultDTO(); + Long projectScore = pingYinEventDao.getProjectTotalScore(formDTO); + Long workScore = pingYinEventDao.getWorkTotalScore(formDTO); + Long memberCount = pingYinEventDao.getMemberCount(formDTO); + Long totalScore = projectScore + workScore; + result.setTotalScore(totalScore.toString()); + result.setMemberCount(memberCount.toString()); + result.setAveScore("0.00"); + if (memberCount != 0L) { + BigDecimal total = new BigDecimal(totalScore); + BigDecimal count = new BigDecimal(memberCount); + BigDecimal ave = total.divide(count, NumConstant.TWO, RoundingMode.HALF_UP); + result.setAveScore(ave.toString()); + } + return result; + } + + /** + * 事件赋值得分导出 + * + * @param tokenDto + * @param formDTO + * @Param tokenDto + * @Param formDTO + * @Return {@link List} + * @Author zhaoqifeng + * @Date 2022/12/9 9:55 + */ + @Override + public List getEventCategorySoreExport(TokenDto tokenDto, EventCategoryFormDTO formDTO) { + if (StringUtils.isBlank(formDTO.getOrgId())){ + CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(tokenDto.getCustomerId(), tokenDto.getUserId()); + if (null == staffInfo){ + throw new EpmetException("未查询到此工作人员的所属组织信息..."); + } + formDTO.setOrgId(staffInfo.getAgencyId()); + formDTO.setOrgType("agency"); + } + formDTO.setCustomerId(tokenDto.getCustomerId()); + formDTO.setCustomerId("6f203e30de1a65aab7e69c058826cd80"); + //获取项目分类 + List projectCategoryList = pingYinEventDao.selectProjectCategoryForExport(formDTO.getCustomerId()); + //获取项目赋值得分统计 + List projectScoreList = pingYinEventDao.selectProjectCategoryScoreList(formDTO); + if (CollectionUtils.isNotEmpty(projectScoreList)) { + projectCategoryList.forEach(item -> { + projectScoreList.stream().filter(e -> item.getCategoryCode().equals(e.getCategoryCode())).forEach(e -> { + item.setEventTotal(e.getEventTotal()); + item.setTotalScore(e.getTotalScore()); + }); + }); + } + List result = new ArrayList<>(projectCategoryList); + //获取例行工作分类 + List workCategoryList = pingYinEventDao.selectWorkCategoryForExport(); + //获取例行工作赋值得分统计 + List workScoreList = pingYinEventDao.selectWorkCategoryScoreList(formDTO); + if (CollectionUtils.isNotEmpty(workScoreList)) { + workCategoryList.forEach(item -> { + workScoreList.stream().filter(e -> item.getCategoryCode().equals(e.getCategoryCode())).forEach(e -> { + item.setEventTotal(e.getEventTotal()); + item.setTotalScore(e.getTotalScore()); + }); + }); + } + result.addAll(workCategoryList); + return result; + } } diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/excel/eventScore.xlsx b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/excel/eventScore.xlsx new file mode 100644 index 0000000000000000000000000000000000000000..4966fd5e327f044cdae9434bbafaf77e84b5806c GIT binary patch literal 12491 zcmeHt1y>wtw>9qW?(Xiv-Q67;3DUS*aCdiihu{)if=kc@4G9o}1q=3dGVi@J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T@ej2T~Ip^RKJ_2gttz^Z)<= literal 0 HcmV?d00001 diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/evaluationindex/PingYinEventDao.xml b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/evaluationindex/PingYinEventDao.xml index db627975ae..54c52e5095 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/evaluationindex/PingYinEventDao.xml +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/evaluationindex/PingYinEventDao.xml @@ -76,8 +76,6 @@ SUM( c.SCORE ) AS totalScore FROM screen_py_event_data a - INNER JOIN screen_project_data b ON a.EVENT_ID = b.PROJECT_ID - AND b.DEL_FLAG = '0' INNER JOIN customer_project_category_dict c ON a.CATEGORY_CODE = c.CATEGORY_CODE AND c.DEL_FLAG = '0' AND c.CUSTOMER_ID = #{customerId} @@ -86,17 +84,24 @@ a.DEL_FLAG = '0' AND a.EVENT_TYPE = 'project' - AND DATE_FORMAT( a.EVENT_CREATE_TIME, '%Y-%m-%d' ) >= #{startTime} + AND DATE_FORMAT( a.EVENT_CREATE_TIME, '%Y%m%d' ) >= #{startTime} - AND DATE_FORMAT( a.EVENT_CREATE_TIME, '%Y-%m-%d' ) <= #{endTime} + AND DATE_FORMAT( a.EVENT_CREATE_TIME, '%Y%m%d' ) <= #{endTime} - AND b.ORG_ID = #{orgId} + AND a.ORG_ID = #{orgId} - AND b.ALL_PARENT_IDS LIKE CONCAT('%', #{orgId}, '%') + AND a.PIDS LIKE CONCAT('%', #{orgId}, '%') + + + AND a.STAFF_NAME LIKE CONCAT('%', #{name}, '%') + + AND a.MOBILE LIKE CONCAT('%', #{mobile}, '%') + + GROUP BY a.CATEGORY_CODE ) a WHERE CATEGORY_CODE IS NOT NULL @@ -113,27 +118,234 @@ SUM( c.SCORE ) AS totalScore FROM screen_py_event_data a - INNER JOIN epmet_user.patrol_routine_work b ON a.EVENT_ID = b.ID - AND b.DEL_FLAG = '0' INNER JOIN customer_patrol_work_type_dict c ON a.CATEGORY_CODE = c.CATEGORY_CODE AND c.IS_DISABLE = 'enable' WHERE a.DEL_FLAG = '0' AND a.EVENT_TYPE = 'work' - AND DATE_FORMAT( a.EVENT_CREATE_TIME, '%Y-%m-%d' ) >= #{startTime} + AND DATE_FORMAT( a.EVENT_CREATE_TIME, '%Y%m%d' ) >= #{startTime} - AND DATE_FORMAT( a.EVENT_CREATE_TIME, '%Y-%m-%d' ) <= #{endTime} + AND DATE_FORMAT( a.EVENT_CREATE_TIME, '%Y%m%d' ) <= #{endTime} - AND b.GRID_ID = #{orgId} + AND a.ORG_ID = #{orgId} - AND b.PIDS LIKE CONCAT('%', #{orgId}, '%') + AND a.PIDS LIKE CONCAT('%', #{orgId}, '%') + + + AND a.STAFF_NAME LIKE CONCAT('%', #{name}, '%') + + + AND a.MOBILE LIKE CONCAT('%', #{mobile}, '%') + GROUP BY a.CATEGORY_CODE ) a WHERE CATEGORY_CODE IS NOT NULL + + + + + + + + + diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/GridstaffWorkInfoPingyinDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/GridstaffWorkInfoPingyinDTO.java index 161a63e263..b277c2bee9 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/GridstaffWorkInfoPingyinDTO.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/GridstaffWorkInfoPingyinDTO.java @@ -84,4 +84,10 @@ public class GridstaffWorkInfoPingyinDTO { private String happenTimeString; + private String title; + private String staffName; + private String mobile; + private String orgId; + private String pids; + } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenPyEventDataEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenPyEventDataEntity.java index 8039234f00..2b31ed2fed 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenPyEventDataEntity.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenPyEventDataEntity.java @@ -25,16 +25,16 @@ public class ScreenPyEventDataEntity extends BaseEpmetEntity { // * 客户Id // */ //private String customerId; - // - ///** - // * 上级组织Id - // */ - //private String parentId; - // - ///** - // * 所有上级ID,用英文逗号分开 - // */ - //private String allParentIds; + + /** + * 上级组织Id + */ + private String orgId; + + /** + * 所有上级ID,用英文逗号分开 + */ + private String pids; /** * 事件Id @@ -56,6 +56,12 @@ public class ScreenPyEventDataEntity extends BaseEpmetEntity { */ private String categoryCode; + private String title; + + private String staffName; + + private String mobile; + ///** // * 父类事件分类编码 // */ diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenPyEventDataServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenPyEventDataServiceImpl.java index 01e9dbda03..b916f891a7 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenPyEventDataServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenPyEventDataServiceImpl.java @@ -4,14 +4,18 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.epmet.commons.dynamic.datasource.annotation.DataSource; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.constant.DataSourceConstant; +import com.epmet.dao.evaluationindex.screen.ScreenProjectDataDao; import com.epmet.dao.evaluationindex.screen.ScreenPyEventDataDao; import com.epmet.dto.screen.form.SavePyEventDataFormDTO; +import com.epmet.entity.evaluationindex.screen.ScreenProjectDataEntity; import com.epmet.entity.evaluationindex.screen.ScreenPyEventDataEntity; import com.epmet.service.evaluationindex.screen.ScreenPyEventDataService; import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections4.CollectionUtils; import org.springframework.stereotype.Service; +import javax.annotation.Resource; + /** * 上报到市平台中间库的事件 * @@ -23,6 +27,8 @@ import org.springframework.stereotype.Service; @DataSource(DataSourceConstant.EVALUATION_INDEX) public class ScreenPyEventDataServiceImpl extends BaseServiceImpl implements ScreenPyEventDataService { + @Resource + private ScreenProjectDataDao screenProjectDataDao; /** * 保存同步到中间库的数据 * @@ -41,6 +47,14 @@ public class ScreenPyEventDataServiceImpl extends BaseServiceImpl wrapper = new LambdaQueryWrapper<>(); wrapper.eq(ScreenPyEventDataEntity::getEventId, entity.getEventId()); wrapper.eq(ScreenPyEventDataEntity::getEventType, entity.getEventType()); @@ -60,6 +74,11 @@ public class ScreenPyEventDataServiceImpl extends BaseServiceImpl wrapper = new LambdaQueryWrapper<>(); wrapper.eq(ScreenPyEventDataEntity::getEventId, entity.getEventId()); wrapper.eq(ScreenPyEventDataEntity::getEventType, entity.getEventType()); diff --git a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/GridstaffWorkInfoPingyinServiceImpl.java b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/GridstaffWorkInfoPingyinServiceImpl.java index 3577f3311d..5c554f218d 100755 --- a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/GridstaffWorkInfoPingyinServiceImpl.java +++ b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/GridstaffWorkInfoPingyinServiceImpl.java @@ -114,6 +114,8 @@ public class GridstaffWorkInfoPingyinServiceImpl extends BaseServiceImpl data; @@ -144,6 +146,11 @@ public class GridstaffWorkInfoPingyinServiceImpl extends BaseServiceImpl SELECT m.*, + cs.REAL_NAME AS staffName, + cs.MOBILE, prwt.WORK_TYPE_CODE AS workTypeSecondCode, substring_index(prwt.ALL_P_CODE,':',1) AS workTypeFirstCode FROM epmet_user.patrol_routine_work m + INNER JOIN customer_staff cs ON m.USER_ID = cs.USER_ID LEFT JOIN patrol_routine_work_type prwt ON m.ID = prwt.ROUTINE_WORK_ID WHERE m.CUSTOMER_ID = #{customerId} AND m.ID = #{id} + + AND DATE_FORMAT( HAPPEN_TIME, '%Y-%m-%d' ) >= #{startTime} + + + AND DATE_FORMAT( HAPPEN_TIME, '%Y-%m-%d' ) <= #{endTime} + AND m.DEL_FLAG = '0'