Browse Source

事件赋值得分相关

dev
zhaoqifeng 3 years ago
parent
commit
5b5407d135
  1. 91
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/poi/excel/handler/CustomMergeStrategy.java
  2. 10
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/constant/EventConstant.java
  3. 3
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/evaluationindex/form/EventCategoryFormDTO.java
  4. 65
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/evaluationindex/form/EventCategoryListFormDTO.java
  5. 59
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/evaluationindex/result/EventCategoryListResultDTO.java
  6. 33
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/evaluationindex/result/EventScoreTotalResultDTO.java
  7. 132
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/PingYinEventController.java
  8. 72
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/evaluationindex/PingYinEventDao.java
  9. 35
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/evaluationindex/PingYinEventService.java
  10. 133
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/evaluationindex/impl/PingYinEventServiceImpl.java
  11. BIN
      epmet-module/data-aggregator/data-aggregator-server/src/main/resources/excel/eventScore.xlsx
  12. 236
      epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/evaluationindex/PingYinEventDao.xml
  13. 6
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/GridstaffWorkInfoPingyinDTO.java
  14. 26
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenPyEventDataEntity.java
  15. 19
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenPyEventDataServiceImpl.java
  16. 12
      epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/GridstaffWorkInfoPingyinServiceImpl.java
  17. 3
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/patrol/PatrolQueryFormDTO.java
  18. 5
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/PatrolRoutineWorkResult.java
  19. 9
      epmet-user/epmet-user-server/src/main/resources/mapper/PatrolRoutineWorkDao.xml

91
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<Integer> exportFieldGroupCountList;
/**
* 目标合并列index
*/
private Integer targetColumnIndex;
// 需要开始合并单元格的首行index
private Integer rowIndex;
// exportDataList为待合并目标列的值
public CustomMergeStrategy(List<String> 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<Integer> getGroupCountList(List<String> exportDataList){
if (CollectionUtils.isEmpty(exportDataList)) {
return new ArrayList<>();
}
List<Integer> 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;
}
}

10
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";
}

3
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;
}

65
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;
}

59
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;
}

33
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;
}

132
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<List<EventCategoryResultDTO>>().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<PageData<EventCategoryListResultDTO>> getEventCategoryList(@LoginUser TokenDto tokenDto, @RequestBody EventCategoryListFormDTO formDTO){
ValidatorUtils.validateEntity(formDTO, EventCategoryListFormDTO.EventCategoryForm.class);
formDTO.setCustomerId(tokenDto.getCustomerId());
return new Result<PageData<EventCategoryListResultDTO>>().ok(pingYinEventService.getEventCategoryList(formDTO));
}
/**
* 事件赋值得分总计
*
* @Param tokenDto
* @Param formDTO
* @Return {@link Result< EventScoreTotalResultDTO>}
* @Author zhaoqifeng
* @Date 2022/12/14 13:46
*/
@PostMapping("getEventScoreTotal")
public Result<EventScoreTotalResultDTO> getEventScoreTotal(@LoginUser TokenDto tokenDto, @RequestBody EventCategoryFormDTO formDTO){
ValidatorUtils.validateEntity(formDTO, EventCategoryListFormDTO.EventCategoryForm.class);
formDTO.setCustomerId(tokenDto.getCustomerId());
return new Result<EventScoreTotalResultDTO>().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<EventCategoryResultDTO> 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<Object> 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();
}
}
}
}

72
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<EventCategoryResultDTO> selectWorkCategoryScoreList(EventCategoryFormDTO formDTO);
/**
* 项目分类列表
*
* @Param formDTO
* @Return {@link List< EventCategoryListResultDTO>}
* @Author zhaoqifeng
* @Date 2022/12/13 10:12
*/
List<EventCategoryListResultDTO> getProjectCategoryList(EventCategoryListFormDTO formDTO);
/**
* 例行工作
*
* @Param formDTO
* @Return {@link List< EventCategoryListResultDTO>}
* @Author zhaoqifeng
* @Date 2022/12/13 10:12
*/
List<EventCategoryListResultDTO> 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<EventCategoryResultDTO> selectProjectCategoryForExport(@Param("customerId")String customerId);
/**
* 获取例行工作分类
*
* @Param
* @Return {@link List< EventCategoryResultDTO>}
* @Author zhaoqifeng
* @Date 2022/12/9 13:41
*/
List<EventCategoryResultDTO> selectWorkCategoryForExport();
}

35
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<EventCategoryResultDTO> getEventCategorySore (TokenDto tokenDto, EventCategoryFormDTO formDTO);
/**
* 事件分类列表
*
* @Param formDTO
* @Return {@link PageData< EventCategoryListResultDTO>}
* @Author zhaoqifeng
* @Date 2022/12/13 9:55
*/
PageData<EventCategoryListResultDTO> 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<EventCategoryResultDTO>}
* @Author zhaoqifeng
* @Date 2022/12/9 9:55
*/
List<EventCategoryResultDTO> getEventCategorySoreExport (TokenDto tokenDto, EventCategoryFormDTO formDTO);
}

133
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<EventCategoryResultDTO> getEventCategorySore(TokenDto tokenDto, EventCategoryFormDTO formDTO) {
List<EventCategoryResultDTO> 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<EventCategoryListResultDTO> getEventCategoryList(EventCategoryListFormDTO formDTO) {
PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize(), formDTO.getIsPage());
List<EventCategoryListResultDTO> list;
if (EventConstant.PROJECT.equals(formDTO.getEventType())) {
//项目分类列表
list = pingYinEventDao.getProjectCategoryList(formDTO);
} else {
//例行工作分类列表
list = pingYinEventDao.getWorkCategoryList(formDTO);
}
PageInfo<EventCategoryListResultDTO> 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<EventCategoryResultDTO>}
* @Author zhaoqifeng
* @Date 2022/12/9 9:55
*/
@Override
public List<EventCategoryResultDTO> 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<EventCategoryResultDTO> projectCategoryList = pingYinEventDao.selectProjectCategoryForExport(formDTO.getCustomerId());
//获取项目赋值得分统计
List<EventCategoryResultDTO> 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<EventCategoryResultDTO> result = new ArrayList<>(projectCategoryList);
//获取例行工作分类
List<EventCategoryResultDTO> workCategoryList = pingYinEventDao.selectWorkCategoryForExport();
//获取例行工作赋值得分统计
List<EventCategoryResultDTO> 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;
}
}

BIN
epmet-module/data-aggregator/data-aggregator-server/src/main/resources/excel/eventScore.xlsx

Binary file not shown.

236
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'
<if test="startTime != null and startTime != ''">
AND DATE_FORMAT( a.EVENT_CREATE_TIME, '%Y-%m-%d' ) &gt;= #{startTime}
AND DATE_FORMAT( a.EVENT_CREATE_TIME, '%Y%m%d' ) &gt;= #{startTime}
</if>
<if test="endTime != null and endTime != ''">
AND DATE_FORMAT( a.EVENT_CREATE_TIME, '%Y-%m-%d' ) &lt;= #{endTime}
AND DATE_FORMAT( a.EVENT_CREATE_TIME, '%Y%m%d' ) &lt;= #{endTime}
</if>
<if test="orgType == 'grid'">
AND b.ORG_ID = #{orgId}
AND a.ORG_ID = #{orgId}
</if>
<if test="orgType == 'agency'">
AND b.ALL_PARENT_IDS LIKE CONCAT('%', #{orgId}, '%')
AND a.PIDS LIKE CONCAT('%', #{orgId}, '%')
</if>
<if test="name != null and name != ''">
AND a.STAFF_NAME LIKE CONCAT('%', #{name}, '%')
</if>
<if test="mobile != null and mobile != ''">
AND a.MOBILE LIKE CONCAT('%', #{mobile}, '%')
</if>
GROUP BY a.CATEGORY_CODE
) a
WHERE CATEGORY_CODE IS NOT NULL
</select>
@ -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'
<if test="startTime != null and startTime != ''">
AND DATE_FORMAT( a.EVENT_CREATE_TIME, '%Y-%m-%d' ) &gt;= #{startTime}
AND DATE_FORMAT( a.EVENT_CREATE_TIME, '%Y%m%d' ) &gt;= #{startTime}
</if>
<if test="endTime != null and endTime != ''">
AND DATE_FORMAT( a.EVENT_CREATE_TIME, '%Y-%m-%d' ) &lt;= #{endTime}
AND DATE_FORMAT( a.EVENT_CREATE_TIME, '%Y%m%d' ) &lt;= #{endTime}
</if>
<if test="orgType == 'grid'">
AND b.GRID_ID = #{orgId}
AND a.ORG_ID = #{orgId}
</if>
<if test="orgType == 'agency'">
AND b.PIDS LIKE CONCAT('%', #{orgId}, '%')
AND a.PIDS LIKE CONCAT('%', #{orgId}, '%')
</if>
<if test="name != null and name != ''">
AND a.STAFF_NAME LIKE CONCAT('%', #{name}, '%')
</if>
<if test="mobile != null and mobile != ''">
AND a.MOBILE LIKE CONCAT('%', #{mobile}, '%')
</if>
GROUP BY a.CATEGORY_CODE
) a
WHERE CATEGORY_CODE IS NOT NULL
</select>
<select id="getProjectCategoryList" resultType="com.epmet.dataaggre.dto.evaluationindex.result.EventCategoryListResultDTO">
SELECT
a.EVENT_ID,
a.EVENT_TYPE,
b.PROJECT_TITLE AS "title",
CONCAT( d.CATEGORY_NAME, '-', c.CATEGORY_NAME ) AS "category",
b.PROJECT_STATUS_CODE AS "status",
b.PROJECT_CREATE_TIME AS "createTime",
b.ORG_ID AS "gridId",
b.LINK_NAME AS "staffName",
c.SCORE
FROM
screen_py_event_data a
INNER JOIN screen_project_data b ON a.EVENT_ID = b.PROJECT_ID
INNER JOIN customer_project_category_dict c ON a.CATEGORY_CODE = c.CATEGORY_CODE
AND c.CUSTOMER_ID = #{customerId}
INNER JOIN customer_project_category_dict d ON d.CATEGORY_CODE = c.PARENT_CATEGORY_CODE
AND d.CUSTOMER_ID = #{customerId}
WHERE
a.EVENT_TYPE = 'project'
AND (c.CATEGORY_CODE = #{categoryCode} OR d.CATEGORY_CODE = #{categoryCode})
<if test="orgType == 'grid'">
AND b.ORG_ID = #{orgId}
</if>
<if test="orgType == 'agency'">
AND b.ALL_PARENT_IDS LIKE CONCAT('%', #{orgId}, '%')
</if>
<if test="startTime != null and startTime != ''">
AND DATE_FORMAT( a.EVENT_CREATE_TIME, '%Y%m%d' ) &gt;= #{startTime}
</if>
<if test="endTime != null and endTime != ''">
AND DATE_FORMAT( a.EVENT_CREATE_TIME, '%Y%m%d' ) &lt;= #{endTime}
</if>
<if test="name != null and name != ''">
AND b.LINK_NAME LIKE CONCAT('%', #{name}, '%')
</if>
<if test="mobile != null and mobile != ''">
AND b.LINK_MOBILE LIKE CONCAT('%', #{mobile}, '%')
</if>
ORDER BY PROJECT_CREATE_TIME DESC
</select>
<select id="getWorkCategoryList" resultType="com.epmet.dataaggre.dto.evaluationindex.result.EventCategoryListResultDTO">
SELECT
a.EVENT_ID,
a.EVENT_TYPE,
a.TITLE,
CONCAT( d.CATEGORY_NAME, '-', c.CATEGORY_NAME ) AS "category",
DATE_FORMAT(a.EVENT_CREATE_TIME,'%Y-%m-%d') AS "createTime",
a.ORG_ID AS 'gridId',
a.STAFF_NAME AS 'staffName',
c.SCORE
FROM
screen_py_event_data a
INNER JOIN customer_patrol_work_type_dict c ON a.CATEGORY_CODE = c.CATEGORY_CODE
INNER JOIN customer_patrol_work_type_dict d ON d.CATEGORY_CODE = c.PARENT_CATEGORY_CODE
WHERE
a.EVENT_TYPE = 'WORK'
AND (c.CATEGORY_CODE = '01' OR d.CATEGORY_CODE = '01')
<if test="orgType == 'grid'">
AND a.ORG_ID = #{orgId}
</if>
<if test="orgType == 'agency'">
AND a.PIDS LIKE CONCAT('%', #{orgId}, '%')
</if>
<if test="startTime != null and startTime != ''">
AND DATE_FORMAT( a.EVENT_CREATE_TIME, '%Y%m%d' ) &gt;= #{startTime}
</if>
<if test="endTime != null and endTime != ''">
AND DATE_FORMAT( a.EVENT_CREATE_TIME, '%Y%m%d' ) &lt;= #{endTime}
</if>
<if test="name != null and name != ''">
AND a.STAFF_NAME LIKE CONCAT('%', #{name}, '%')
</if>
<if test="mobile != null and mobile != ''">
AND a.MOBILE LIKE CONCAT('%', #{mobile}, '%')
</if>
ORDER BY EVENT_CREATE_TIME DESC
</select>
<select id="getProjectTotalScore" resultType="java.lang.Long">
SELECT
IFNULL(SUM( c.SCORE ), 0) AS totalScore
FROM
screen_py_event_data a
INNER JOIN customer_project_category_dict c ON a.CATEGORY_CODE = c.CATEGORY_CODE
AND c.DEL_FLAG = '0'
AND c.CUSTOMER_ID = #{customerId}
AND c.IS_DISABLE = 'enable'
WHERE
a.DEL_FLAG = '0'
AND a.EVENT_TYPE = 'project'
<if test="startTime != null and startTime != ''">
AND DATE_FORMAT( a.EVENT_CREATE_TIME, '%Y%m%d' ) &gt;= #{startTime}
</if>
<if test="endTime != null and endTime != ''">
AND DATE_FORMAT( a.EVENT_CREATE_TIME, '%Y%m%d' ) &lt;= #{endTime}
</if>
<if test="orgType == 'grid'">
AND a.ORG_ID = #{orgId}
</if>
<if test="orgType == 'agency'">
AND a.PIDS LIKE CONCAT('%', #{orgId}, '%')
</if>
<if test="name != null and name != ''">
AND a.STAFF_NAME LIKE CONCAT('%', #{name}, '%')
</if>
<if test="mobile != null and mobile != ''">
AND a.MOBILE LIKE CONCAT('%', #{mobile}, '%')
</if>
</select>
<select id="getWorkTotalScore" resultType="java.lang.Long">
SELECT
IFNULL(SUM( c.SCORE ), 0) AS totalScore
FROM
screen_py_event_data a
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'
<if test="startTime != null and startTime != ''">
AND DATE_FORMAT( a.EVENT_CREATE_TIME, '%Y%m%d' ) &gt;= #{startTime}
</if>
<if test="endTime != null and endTime != ''">
AND DATE_FORMAT( a.EVENT_CREATE_TIME, '%Y%m%d' ) &lt;= #{endTime}
</if>
<if test="orgType == 'grid'">
AND a.ORG_ID = #{orgId}
</if>
<if test="orgType == 'agency'">
AND a.PIDS LIKE CONCAT('%', #{orgId}, '%')
</if>
<if test="name != null and name != ''">
AND a.STAFF_NAME LIKE CONCAT('%', #{name}, '%')
</if>
<if test="mobile != null and mobile != ''">
AND a.MOBILE LIKE CONCAT('%', #{mobile}, '%')
</if>
</select>
<select id="getMemberCount" resultType="java.lang.Long">
SELECT
IFNULL(COUNT(ID), 0)
FROM
screen_py_grid_staff
WHERE
DEL_FLAG = '0'
AND IS_LEAVE = 'N'
<if test="orgType == 'grid'">
AND GRID_ID = #{orgId}
</if>
<if test="orgType == 'agency'">
AND PIDS LIKE CONCAT('%', #{orgId}, '%')
</if>
<if test="name != null and name != ''">
AND STAFF_NAME LIKE CONCAT('%', #{name}, '%')
</if>
<if test="mobile != null and mobile != ''">
AND MOBILE LIKE CONCAT('%', #{mobile}, '%')
</if>
</select>
<select id="selectProjectCategoryForExport" resultType="com.epmet.dataaggre.dto.evaluationindex.EventCategoryResultDTO">
SELECT
'上报事件' AS eventType,
p1.CATEGORY_CODE AS parentCategoryCode,
p2.CATEGORY_CODE AS categoryCode,
p1.CATEGORY_NAME AS parentCategoryName,
p2.CATEGORY_NAME AS categoryName,
p2.SCORE AS score
FROM
customer_project_category_dict p1,
customer_project_category_dict p2
WHERE
p1.DEL_FLAG = '0'
AND p2.DEL_FLAG = '0'
AND p1.CUSTOMER_ID = #{customerId}
AND p2.CUSTOMER_ID = #{customerId}
AND p1.CATEGORY_CODE = p2.PARENT_CATEGORY_CODE
AND p1.CUSTOMER_TYPE = 'internal'
AND p2.CUSTOMER_TYPE = 'internal'
AND p1.IS_DISABLE = 'enable'
AND p2.IS_DISABLE = 'enable'
ORDER BY
p1.SORT,
p2.SORT
</select>
<select id="selectWorkCategoryForExport" resultType="com.epmet.dataaggre.dto.evaluationindex.EventCategoryResultDTO">
SELECT
'例行工作' AS eventType,
p1.CATEGORY_CODE AS parentCategoryCode,
p2.CATEGORY_CODE AS categoryCode,
p1.CATEGORY_NAME AS parentCategoryName,
p2.CATEGORY_NAME AS categoryName,
p2.SCORE AS score
FROM customer_patrol_work_type_dict p1,customer_patrol_work_type_dict p2
WHERE p1.DEL_FLAG = '0'
AND p2.DEL_FLAG = '0'
AND p1.CATEGORY_CODE = p2.PARENT_CATEGORY_CODE
AND p1.IS_DISABLE = 'enable'
AND p2.IS_DISABLE = 'enable'
ORDER BY p1.SORT, p2.SORT
</select>
</mapper>

6
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;
}

26
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;
///**
// * 父类事件分类编码
// */

19
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<ScreenPyEventDataDao, ScreenPyEventDataEntity> implements ScreenPyEventDataService {
@Resource
private ScreenProjectDataDao screenProjectDataDao;
/**
* 保存同步到中间库的数据
*
@ -41,6 +47,14 @@ public class ScreenPyEventDataServiceImpl extends BaseServiceImpl<ScreenPyEventD
entity.setEventType("project");
entity.setEventCreateTime(item.getReportTime());
entity.setCategoryCode(item.getEventCategory());
ScreenProjectDataEntity project = screenProjectDataDao.selectById(entity.getEventId());
if (null != project) {
entity.setOrgId(project.getOrgId());
entity.setPids(project.getAllParentIds());
entity.setTitle(project.getProjectTitle());
entity.setStaffName(project.getLinkName());
entity.setMobile(project.getLinkMobile());
}
LambdaQueryWrapper<ScreenPyEventDataEntity> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(ScreenPyEventDataEntity::getEventId, entity.getEventId());
wrapper.eq(ScreenPyEventDataEntity::getEventType, entity.getEventType());
@ -60,6 +74,11 @@ public class ScreenPyEventDataServiceImpl extends BaseServiceImpl<ScreenPyEventD
entity.setEventType("work");
entity.setEventCreateTime(item.getHappenTime());
entity.setCategoryCode(item.getWorkType());
entity.setOrgId(item.getOrgId());
entity.setPids(item.getPids());
entity.setTitle(item.getTitle());
entity.setStaffName(item.getStaffName());
entity.setMobile(item.getMobile());
LambdaQueryWrapper<ScreenPyEventDataEntity> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(ScreenPyEventDataEntity::getEventId, entity.getEventId());
wrapper.eq(ScreenPyEventDataEntity::getEventType, entity.getEventType());

12
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<Gridsta
public void saveData(EventInfoFormDTO formDTO) {
PatrolQueryFormDTO midPatrolFormDTO = new PatrolQueryFormDTO();
midPatrolFormDTO.setCustomerId(formDTO.getCustomerId());
midPatrolFormDTO.setStartTime(DateUtils.format(formDTO.getStartTime(), DateUtils.DATE_PATTERN));
midPatrolFormDTO.setEndTime(DateUtils.format(formDTO.getEndTime(), DateUtils.DATE_PATTERN));
midPatrolFormDTO.setPageNo(NumConstant.ONE);
midPatrolFormDTO.setPageSize(NumConstant.ONE_THOUSAND);
List<PatrolRoutineWorkResult> data;
@ -144,6 +146,11 @@ public class GridstaffWorkInfoPingyinServiceImpl extends BaseServiceImpl<Gridsta
dto.setId(item.getId());
dto.setHappenTime(DateUtils.parseDate(item.getHappenTime().concat(" 00:00:00"), DateUtils.DATE_PATTERN));
dto.setWorkType(item.getWorkTypeSecondCode());
dto.setTitle(item.getTitle());
dto.setOrgId(item.getGridId());
dto.setPids(item.getPids());
dto.setStaffName(item.getStaffName());
dto.setMobile(item.getMobile());
return dto;
}).collect(Collectors.toList());
//将同步的数据保存
@ -184,6 +191,11 @@ public class GridstaffWorkInfoPingyinServiceImpl extends BaseServiceImpl<Gridsta
dto.setId(o.getId());
dto.setHappenTime(DateUtils.parseDate(o.getHappenTime().concat(" 00:00:00"), DateUtils.DATE_PATTERN));
dto.setWorkType(o.getWorkTypeSecondCode());
dto.setTitle(o.getTitle());
dto.setOrgId(o.getGridId());
dto.setPids(o.getPids());
dto.setStaffName(o.getStaffName());
dto.setMobile(o.getMobile());
newList.add(dto);
});
//insert

3
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/patrol/PatrolQueryFormDTO.java

@ -26,4 +26,7 @@ public class PatrolQueryFormDTO extends PageFormDTO implements Serializable {
*/
private String id;
private String startTime;
private String endTime;
}

5
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/PatrolRoutineWorkResult.java

@ -24,11 +24,12 @@ public class PatrolRoutineWorkResult implements Serializable {
private String gridId;
private String gridCode;
private String gridName;
private String pids;
private String title;
private String userId;
private String staffName;
private String mobile;
/**
* 一级工作类型 code
*/

9
epmet-user/epmet-user-server/src/main/resources/mapper/PatrolRoutineWorkDao.xml

@ -26,15 +26,24 @@
<select id="selectList" resultType="com.epmet.dto.result.PatrolRoutineWorkResult">
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}
<if test="id != null and id != ''">
AND m.ID = #{id}
</if>
<if test="startTime != null and startTime != ''">
AND DATE_FORMAT( HAPPEN_TIME, '%Y-%m-%d' ) &gt;= #{startTime}
</if>
<if test="endTime != null and endTime != ''">
AND DATE_FORMAT( HAPPEN_TIME, '%Y-%m-%d' ) &lt;= #{endTime}
</if>
AND m.DEL_FLAG = '0'
</select>

Loading…
Cancel
Save