Browse Source

Merge branch 'dev_pingyiin_zqf' into dev

master
sunyuchao 3 years ago
parent
commit
bf985c664f
  1. 91
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/poi/excel/handler/CustomMergeStrategy.java
  2. 61
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/poi/excel/handler/CustomerTitleHandler.java
  3. 1
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/constant/DataSourceConstant.java
  4. 10
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/constant/EventConstant.java
  5. 69
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/evaluationindex/EventCategoryResultDTO.java
  6. 54
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/evaluationindex/form/EventCategoryFormDTO.java
  7. 65
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/evaluationindex/form/EventCategoryListFormDTO.java
  8. 59
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/evaluationindex/result/EventCategoryListResultDTO.java
  9. 33
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/evaluationindex/result/EventScoreTotalResultDTO.java
  10. 44
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/evaluationindex/result/OrgEventScoreResultDTO.java
  11. 3
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/form/GridLivelyFormDTO.java
  12. 7
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/feign/DataAggregatorOpenFeignClient.java
  13. 8
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/feign/impl/DataAggregatorOpenFeignClientFallback.java
  14. 18
      epmet-module/data-aggregator/data-aggregator-server/pom.xml
  15. 183
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/PingYinEventController.java
  16. 3
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/evaluationindex/EvaluationIndexDao.java
  17. 157
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/evaluationindex/PingYinEventDao.java
  18. 3
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/evaluationindex/EvaluationIndexService.java
  19. 70
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/evaluationindex/PingYinEventService.java
  20. 8
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/evaluationindex/impl/EvaluationIndexServiceImpl.java
  21. 262
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/evaluationindex/impl/PingYinEventServiceImpl.java
  22. 8
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/impl/GovOrgServiceImpl.java
  23. 5
      epmet-module/data-aggregator/data-aggregator-server/src/main/resources/bootstrap.yml
  24. BIN
      epmet-module/data-aggregator/data-aggregator-server/src/main/resources/excel/eventScore.xlsx
  25. 9
      epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/evaluationindex/EvaluationIndexDao.xml
  26. 584
      epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/evaluationindex/PingYinEventDao.xml
  27. 4
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/basereport/form/EventInfoFormDTO.java
  28. 117
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcollect/ScreenPyGridStaffDTO.java
  29. 95
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcollect/ScreenPyHistoryScoreDTO.java
  30. 126
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcollect/ScreenPyHistoryScoreDetailDTO.java
  31. 106
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcollect/ScreenPyWeightConfigurationDTO.java
  32. 44
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcollect/form/HistoryScoreComputeFormDTO.java
  33. 106
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcollect/form/HistoryScoreFormDTO.java
  34. 48
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcollect/form/HistoryScoreListFormDTO.java
  35. 58
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcollect/form/WeightConfigurationFormDTO.java
  36. 31
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcollect/form/WeightConfigurationListFormDTO.java
  37. 22
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcollect/result/HistoryScoreComputeResultDTO.java
  38. 120
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcollect/result/HistoryScoreDetailResultDTO.java
  39. 33
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcollect/result/HistoryScoreListResultDTO.java
  40. 25
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcollect/result/HistoryScoreSjffResultDTO.java
  41. 41
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcollect/result/WeightConfigurationListResultDTO.java
  42. 179
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/EventreportPingyinDTO.java
  43. 93
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/GridstaffWorkInfoPingyinDTO.java
  44. 30
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/form/SavePyEventDataFormDTO.java
  45. 8
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/DataStatisticalOpenFeignClient.java
  46. 12
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/impl/DataStatisticalOpenFeignClientFallBack.java
  47. 6
      epmet-module/data-statistical/data-statistical-server/pom.xml
  48. 19
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DataReportingController.java
  49. 36
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/ScreenPyGridStaffController.java
  50. 154
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/ScreenPyHistoryScoreController.java
  51. 70
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/ScreenPyWeightConfigurationController.java
  52. 36
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcoll/ScreenPyGridStaffDao.java
  53. 44
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcoll/ScreenPyHistoryScoreDao.java
  54. 40
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcoll/ScreenPyHistoryScoreDetailDao.java
  55. 43
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcoll/ScreenPyWeightConfigurationDao.java
  56. 16
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenPyEventDataDao.java
  57. 84
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/indexcoll/ScreenPyGridStaffEntity.java
  58. 94
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/indexcoll/ScreenPyHistoryScoreDetailEntity.java
  59. 64
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/indexcoll/ScreenPyHistoryScoreEntity.java
  60. 74
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/indexcoll/ScreenPyWeightConfigurationEntity.java
  61. 70
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenPyEventDataEntity.java
  62. 57
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/excel/HistoryScoreDetailExcel.java
  63. 15
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/ScreenPyGridStaffService.java
  64. 18
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/ScreenPyHistoryScoreDetailService.java
  65. 30
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/ScreenPyHistoryScoreService.java
  66. 23
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/ScreenPyWeightConfigurationService.java
  67. 53
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/ScreenPyGridStaffServiceImpl.java
  68. 40
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/ScreenPyHistoryScoreDetailServiceImpl.java
  69. 203
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/ScreenPyHistoryScoreServiceImpl.java
  70. 74
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/ScreenPyWeightConfigurationServiceImpl.java
  71. 24
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenPyEventDataService.java
  72. 95
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenPyEventDataServiceImpl.java
  73. 18
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcoll/ScreenPyGridStaffDao.xml
  74. 73
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcoll/ScreenPyHistoryScoreDao.xml
  75. 65
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcoll/ScreenPyHistoryScoreDetailDao.xml
  76. 43
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcoll/ScreenPyWeightConfigurationDao.xml
  77. 7
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenPyEventDataDao.xml
  78. 13
      epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/controller/EventreportPingyinController.java
  79. 34
      epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/controller/GridstaffWorkInfoPingyinController.java
  80. 9
      epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/EventreportPingyinService.java
  81. 10
      epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/GridstaffWorkInfoPingyinService.java
  82. 38
      epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/EventreportPingyinServiceImpl.java
  83. 19
      epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/GridstaffInfoPingyinServiceImpl.java
  84. 86
      epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/GridstaffWorkInfoPingyinServiceImpl.java
  85. 3
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/patrol/PatrolQueryFormDTO.java
  86. 5
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/PatrolRoutineWorkResult.java
  87. 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;
}
}

61
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/poi/excel/handler/CustomerTitleHandler.java

@ -0,0 +1,61 @@
package com.epmet.commons.tools.utils.poi.excel.handler;
import com.alibaba.excel.metadata.Head;
import com.alibaba.excel.metadata.data.CellData;
import com.alibaba.excel.metadata.data.WriteCellData;
import com.alibaba.excel.write.handler.CellWriteHandler;
import com.alibaba.excel.write.metadata.holder.WriteSheetHolder;
import com.alibaba.excel.write.metadata.holder.WriteTableHolder;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.CellType;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.util.CellRangeAddress;
import org.springframework.util.PropertyPlaceholderHelper;
import java.util.List;
import java.util.Properties;
/**
* desc:标头策略
*
*/
public class CustomerTitleHandler implements CellWriteHandler {
private String title = "xixihaha";
PropertyPlaceholderHelper placeholderHelper = new PropertyPlaceholderHelper("${", "}");
public CustomerTitleHandler(String title) {
this.title = title;
}
/*public CustomerTitleHandler(String title) {
this.title = "nihao s";
}*/
@Override
public void beforeCellCreate(WriteSheetHolder writeSheetHolder, WriteTableHolder writeTableHolder,Row row, Head head, Integer integer, Integer integer1, Boolean aBoolean) {
if (head != null) {
List<String> headNameList = head.getHeadNameList();
if (CollectionUtils.isNotEmpty(headNameList)) {
Properties properties = new Properties();
properties.setProperty("title", title);
headNameList.set(1, placeholderHelper.replacePlaceholders(headNameList.get(1), properties));
}
}
}
@Override
public void afterCellCreate(WriteSheetHolder writeSheetHolder, WriteTableHolder writeTableHolder,
Cell cell, Head head, Integer integer, Boolean aBoolean) {
}
@Override
public void afterCellDataConverted(WriteSheetHolder writeSheetHolder, WriteTableHolder writeTableHolder,
WriteCellData cellData, Cell cell, Head head, Integer integer, Boolean aBoolean) {
}
@Override
public void afterCellDispose(WriteSheetHolder writeSheetHolder, WriteTableHolder writeTableHolder,
List<WriteCellData<?>> list, Cell cell, Head head, Integer integer, Boolean aBoolean) {
}
}

1
epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/constant/DataSourceConstant.java

@ -30,6 +30,7 @@ public interface DataSourceConstant {
String DATA_STATISTICAL="datastatistical";
String EVALUATION_INDEX = "evaluationIndex";
String EVALUATION_INDEX_READ = "evaluationIndexRead";
String OPERCUSTOMIZE="opercustomize";

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

69
epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/evaluationindex/EventCategoryResultDTO.java

@ -0,0 +1,69 @@
package com.epmet.dataaggre.dto.evaluationindex;
import com.epmet.commons.tools.constant.NumConstant;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
/**
* @Author zxc
* @DateTime 2021/11/4 3:13 下午
* @DESC
*/
@Data
public class EventCategoryResultDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 类型project事件 work例行工作
*/
private String eventType;
/**
* 分类CODE
*/
private String categoryCode;
/**
* 分类code父级
*/
private String parentCategoryCode;
/**
* 分类名字
*/
private String categoryName;
/**
* 分类名字父级
*/
private String parentCategoryName;
/**
* 项目数
*/
private Integer eventTotal;
/**
* 分值
*/
private Integer score;
private Integer totalScore;
private List<EventCategoryResultDTO> children;
@JsonIgnore
private Integer index;
public EventCategoryResultDTO() {
this.categoryCode = "";
this.categoryName = "";
this.eventTotal = NumConstant.ZERO;
this.totalScore = NumConstant.ZERO;
this.children = new ArrayList<>();
}
}

54
epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/evaluationindex/form/EventCategoryFormDTO.java

@ -0,0 +1,54 @@
package com.epmet.dataaggre.dto.evaluationindex.form;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* @author Administrator
*/
@Data
public class EventCategoryFormDTO implements Serializable {
private static final long serialVersionUID = 1L;
public interface EventCategoryForm{}
public interface CategoryEventExportForm {}
/**
* 组织ID
*/
private String customerId;
/**
* 组织ID
*/
private String orgId;
/**
* 组织类型 组织agency网格grid
*/
private String orgType;
private String areaCode;
/**
* 组织级别
*/
private String orgLevel;
@NotBlank(message = "结束时间不能为空",groups = {EventCategoryForm.class,CategoryEventExportForm.class})
private String endTime;
/**
* 开始时间
*/
private String startTime;
/**
* 组织名称
*/
@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;
}

44
epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/evaluationindex/result/OrgEventScoreResultDTO.java

@ -0,0 +1,44 @@
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 OrgEventScoreResultDTO implements Serializable {
private static final long serialVersionUID = 2570384890580378137L;
private String orgName;
/**
* 上报事件数
*/
private String projectCount;
/**
* 上报事件总分
*/
private String projectScore;
/**
* 例行工作数
*/
private String workCount;
/**
* 例行工作总分
*/
private String workScore;
/**
* 网格员数量
*/
private String memberCount;
/**
* 考核得分
*/
private String aveScore;
}

3
epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/form/GridLivelyFormDTO.java

@ -33,4 +33,7 @@ public class GridLivelyFormDTO implements Serializable {
@NotBlank(message = "结束查询时间不能为空", groups = {Grid.class})
private String endTime;
//数据区分 type=historyScore表示以平阴中间库网格数据为准来计算
private String type = "";
}

7
epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/feign/DataAggregatorOpenFeignClient.java

@ -7,6 +7,7 @@ import com.epmet.commons.tools.utils.Result;
import com.epmet.dataaggre.dto.epmetuser.form.ResisByPolicyRulesFormDTO;
import com.epmet.dataaggre.dto.epmetuser.result.ResiByPolicyInfoResultDTO;
import com.epmet.dataaggre.dto.govorg.form.GridLivelyFormDTO;
import com.epmet.dataaggre.dto.govorg.result.GridLivelyResultDTO;
import com.epmet.dataaggre.feign.impl.DataAggregatorOpenFeignClientFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
@ -33,4 +34,10 @@ public interface DataAggregatorOpenFeignClient {
*/
@PostMapping("data/aggregator/icuser/listByPolicyRules")
Result<PageData<ResiByPolicyInfoResultDTO>> listByPolicyRules(@RequestBody ResisByPolicyRulesFormDTO input);
/**
* 网格活跃度统计
*/
@PostMapping(value = "data/aggregator/org/gridlively")
Result<List<GridLivelyResultDTO>> grdiLively(@RequestBody GridLivelyFormDTO form);
}

8
epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/feign/impl/DataAggregatorOpenFeignClientFallback.java

@ -7,8 +7,11 @@ import com.epmet.commons.tools.utils.Result;
import com.epmet.dataaggre.dto.epmetuser.form.ResisByPolicyRulesFormDTO;
import com.epmet.dataaggre.dto.epmetuser.result.ResiByPolicyInfoResultDTO;
import com.epmet.dataaggre.dto.govorg.form.GridLivelyFormDTO;
import com.epmet.dataaggre.dto.govorg.result.GridLivelyResultDTO;
import com.epmet.dataaggre.feign.DataAggregatorOpenFeignClient;
import java.util.List;
public class DataAggregatorOpenFeignClientFallback implements DataAggregatorOpenFeignClient {
/**
* 定时任务导出网格活跃统计表
@ -24,4 +27,9 @@ public class DataAggregatorOpenFeignClientFallback implements DataAggregatorOpen
public Result<PageData<ResiByPolicyInfoResultDTO>> listByPolicyRules(ResisByPolicyRulesFormDTO input) {
return ModuleUtils.feignConError(ServiceConstant.DATA_AGGREGATOR_SERVER, "listByPolicyRules", input);
}
@Override
public Result<List<GridLivelyResultDTO>> grdiLively(GridLivelyFormDTO form) {
return ModuleUtils.feignConError(ServiceConstant.DATA_AGGREGATOR_SERVER, "grdiLively",form);
}
}

18
epmet-module/data-aggregator/data-aggregator-server/pom.xml

@ -384,6 +384,12 @@
<datasource.druid.evaluationIndex.username>epmet_evaluation_index_user</datasource.druid.evaluationIndex.username>
<datasource.druid.evaluationIndex.password>EpmEt-db-UsEr</datasource.druid.evaluationIndex.password>
<datasource.druid.evaluationIndex1.url>
<![CDATA[jdbc:mysql://192.168.1.140:3306/epmet_evaluation_index?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai]]>
</datasource.druid.evaluationIndex1.url>
<datasource.druid.evaluationIndex1.username>root</datasource.druid.evaluationIndex1.username>
<datasource.druid.evaluationIndex1.password>root</datasource.druid.evaluationIndex1.password>
<datasource.druid.opercustomize.url>
<![CDATA[jdbc:mysql://192.168.1.140:3306/epmet_oper_customize?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai]]>
</datasource.druid.opercustomize.url>
@ -522,6 +528,12 @@
<datasource.druid.evaluationIndex.username>epmet</datasource.druid.evaluationIndex.username>
<datasource.druid.evaluationIndex.password>elink@833066</datasource.druid.evaluationIndex.password>
<datasource.druid.evaluationIndex1.url>
<![CDATA[jdbc:mysql://rm-m5ef9t617j6o5eup7.mysql.rds.aliyuncs.com:3306/epmet_evaluation_index?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai]]>
</datasource.druid.evaluationIndex1.url>
<datasource.druid.evaluationIndex1.username>epmet</datasource.druid.evaluationIndex1.username>
<datasource.druid.evaluationIndex1.password>elink@833066</datasource.druid.evaluationIndex1.password>
<datasource.druid.opercustomize.url>
<![CDATA[jdbc:mysql://rm-m5ef9t617j6o5eup7.mysql.rds.aliyuncs.com:3306/epmet_oper_customize?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai]]>
</datasource.druid.opercustomize.url>
@ -661,6 +673,12 @@
<datasource.druid.evaluationIndex.username>epmet_evaluation_index_user</datasource.druid.evaluationIndex.username>
<datasource.druid.evaluationIndex.password>EpmEt-db-UsEr</datasource.druid.evaluationIndex.password>
<datasource.druid.evaluationIndex1.url>
<![CDATA[jdbc:mysql://rm-m5e3vzs2637224wj9.mysql.rds.aliyuncs.com:3306/epmet_evaluation_index?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai]]>
</datasource.druid.evaluationIndex1.url>
<datasource.druid.evaluationIndex1.username>epmet_cloud_viewer</datasource.druid.evaluationIndex1.username>
<datasource.druid.evaluationIndex1.password>EpmEtclOUdvIEwEr@w</datasource.druid.evaluationIndex1.password>
<datasource.druid.opercustomize.url>
<![CDATA[jdbc:mysql://rm-m5e3vzs2637224wj9.mysql.rds.aliyuncs.com:3306/epmet_oper_customize?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai]]>
</datasource.druid.opercustomize.url>

183
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/PingYinEventController.java

@ -0,0 +1,183 @@
package com.epmet.dataaggre.controller;
import com.alibaba.excel.EasyExcelFactory;
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.dto.evaluationindex.result.OrgEventScoreResultDTO;
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;
/**
* @author Administrator
*/
@RestController
@RequestMapping("pyevent")
@Slf4j
public class PingYinEventController {
@Resource
private PingYinEventService pingYinEventService;
/**
* 事件赋值得分
*
* @Param tokenDto
* @Return {@link Result<List<EventCategoryResultDTO>>}
* @Author zhaoqifeng
* @Date 2022/12/9 9:42
*/
@PostMapping("getEventCategorySore")
public Result<List<EventCategoryResultDTO>> getEventCategorySore(@LoginUser TokenDto tokenDto, @RequestBody EventCategoryFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, EventCategoryFormDTO.EventCategoryForm.class);
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 = EasyExcelFactory.write(outputStream).withTemplate(inputStream).build();
WriteSheet writeSheet = EasyExcelFactory.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);
List<OrgEventScoreResultDTO> orgScoreList = pingYinEventService.getOrgEventScoreList(formDTO);
WriteSheet writeSheet1 = EasyExcelFactory.writerSheet(1).build();
excelWriter.fill(orgScoreList, fillConfig, writeSheet1);
excelWriter.fill(scoreTotal, writeSheet1);
} 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();
}
}
}
}

3
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/evaluationindex/EvaluationIndexDao.java

@ -23,6 +23,7 @@ import com.epmet.dataaggre.dto.evaluationindex.ScreenCustomerGridDTO;
import com.epmet.dataaggre.dto.evaluationindex.ScreenGovernRankDataDailyDTO;
import com.epmet.dataaggre.dto.govorg.form.GridLivelyFormDTO;
import com.epmet.dataaggre.dto.govorg.result.GridDateIdResultDTO;
import com.epmet.dataaggre.dto.govorg.result.GridLivelyResultDTO;
import com.epmet.dataaggre.dto.govproject.form.ProjectCategoryTotalFormDTO;
import com.epmet.dataaggre.dto.govproject.result.ProjectCategoryTotalResultDTO;
import org.apache.ibatis.annotations.Mapper;
@ -128,4 +129,6 @@ public interface EvaluationIndexDao {
* @return
*/
List<ScreenCustomerGridDTO> getSubAllGridByAgencyPath(@Param("fullAgencyPath") String fullAgencyPath);
GridLivelyResultDTO streetGridList(GridLivelyFormDTO formDTO);
}

157
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/evaluationindex/PingYinEventDao.java

@ -0,0 +1,157 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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 com.epmet.dataaggre.dto.evaluationindex.result.OrgEventScoreResultDTO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* @Author sun
* @Description 指标统计服务
*/
@Mapper
public interface PingYinEventDao {
/**
* 获取项目分类
*
* @Param customerId
* @Return {@link List< EventCategoryResultDTO>}
* @Author zhaoqifeng
* @Date 2022/12/9 13:40
*/
List<EventCategoryResultDTO> selectProjectCategory(@Param("customerId")String customerId);
/**
* 获取例行工作分类
*
* @Param
* @Return {@link List< EventCategoryResultDTO>}
* @Author zhaoqifeng
* @Date 2022/12/9 13:41
*/
List<EventCategoryResultDTO> selectWorkCategory();
/**
* 项目赋值得分
* @Param formDTO
* @Return {@link List< EventCategoryResultDTO>}
* @Author zhaoqifeng
* @Date 2022/12/9 11:00
*/
List<EventCategoryResultDTO> selectProjectCategoryScoreList(EventCategoryFormDTO formDTO);
/**
* 例行工作赋值得分
* @Param formDTO
* @Return {@link List< EventCategoryResultDTO>}
* @Author zhaoqifeng
* @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();
/**
* 下级得分
*
* @Param formDTO
* @Return {@link List< OrgEventScoreResultDTO>}
* @Author zhaoqifeng
* @Date 2022/12/15 9:31
*/
List<OrgEventScoreResultDTO> selectOrgEventScoreList(EventCategoryFormDTO formDTO);
List<OrgEventScoreResultDTO> selectGridEventScoreList(EventCategoryFormDTO formDTO);
String getAreaCode(@Param("agencyId")String agencyId);
}

3
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/evaluationindex/EvaluationIndexService.java

@ -8,6 +8,7 @@ import com.epmet.dataaggre.dto.evaluationindex.ScreenCustomerGridDTO;
import com.epmet.dataaggre.dto.evaluationindex.ScreenGovernRankDataDailyDTO;
import com.epmet.dataaggre.dto.govorg.form.GridLivelyFormDTO;
import com.epmet.dataaggre.dto.govorg.result.GridDateIdResultDTO;
import com.epmet.dataaggre.dto.govorg.result.GridLivelyResultDTO;
import com.epmet.dataaggre.dto.govproject.form.ProjectCategoryTotalFormDTO;
import com.epmet.dataaggre.dto.govproject.result.ProjectCategoryTotalResultDTO;
@ -103,4 +104,6 @@ public interface EvaluationIndexService {
* @author sun
*/
List<GridDateIdResultDTO> getGridProejctToProjectMain(GridLivelyFormDTO formDTO);
GridLivelyResultDTO streetGridList(GridLivelyFormDTO formDTO);
}

70
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/evaluationindex/PingYinEventService.java

@ -0,0 +1,70 @@
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 com.epmet.dataaggre.dto.evaluationindex.result.OrgEventScoreResultDTO;
import java.util.List;
/**
* @author Administrator
*/
public interface PingYinEventService {
/**
* 事件赋值得分
*
* @Param tokenDto
* @Param formDTO
* @Return {@link List<EventCategoryResultDTO>}
* @Author zhaoqifeng
* @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);
/**
* 下级得分
*
* @Param formDTO
* @Return {@link List< OrgEventScoreResultDTO>}
* @Author zhaoqifeng
* @Date 2022/12/15 11:05
*/
List<OrgEventScoreResultDTO> getOrgEventScoreList(EventCategoryFormDTO formDTO);
}

8
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/evaluationindex/impl/EvaluationIndexServiceImpl.java

@ -13,6 +13,7 @@ import com.epmet.dataaggre.dto.evaluationindex.ScreenCustomerGridDTO;
import com.epmet.dataaggre.dto.evaluationindex.ScreenGovernRankDataDailyDTO;
import com.epmet.dataaggre.dto.govorg.form.GridLivelyFormDTO;
import com.epmet.dataaggre.dto.govorg.result.GridDateIdResultDTO;
import com.epmet.dataaggre.dto.govorg.result.GridLivelyResultDTO;
import com.epmet.dataaggre.dto.govproject.form.ProjectCategoryTotalFormDTO;
import com.epmet.dataaggre.dto.govproject.result.ProjectCategoryTotalResultDTO;
import com.epmet.dataaggre.service.evaluationindex.EvaluationIndexService;
@ -248,4 +249,11 @@ public class EvaluationIndexServiceImpl implements EvaluationIndexService {
return evaluationIndexDao.getGridProejctToProjectMain(formDTO);
}
@Override
public GridLivelyResultDTO streetGridList(GridLivelyFormDTO formDTO) {
GridLivelyResultDTO resultDTO = evaluationIndexDao.streetGridList(formDTO);
resultDTO.setAgencyId(formDTO.getAgencyId());
return resultDTO;
}
}

262
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/evaluationindex/impl/PingYinEventServiceImpl.java

@ -0,0 +1,262 @@
package com.epmet.dataaggre.service.evaluationindex.impl;
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.dataaggre.constant.DataSourceConstant;
import com.epmet.dataaggre.constant.EventConstant;
import com.epmet.dataaggre.constant.OrgConstant;
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.dto.evaluationindex.result.OrgEventScoreResultDTO;
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.Collections;
import java.util.List;
/**
* @Author sun
* @Description 指标统计服务
*/
@Service
@DataSource(DataSourceConstant.EVALUATION_INDEX_READ)
@Slf4j
public class PingYinEventServiceImpl implements PingYinEventService {
@Resource
private PingYinEventDao pingYinEventDao;
/**
* 事件赋值得分
*
* @param tokenDto
* @param formDTO
* @Param tokenDto
* @Param formDTO
* @Return {@link List < EventCategoryResultDTO >}
* @Author zhaoqifeng
* @Date 2022/12/9 9:55
*/
@Override
public List<EventCategoryResultDTO> getEventCategorySore(TokenDto tokenDto, EventCategoryFormDTO formDTO) {
List<EventCategoryResultDTO> result = new ArrayList<>();
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());
//获取项目分类
List<EventCategoryResultDTO> projectCategoryList = pingYinEventDao.selectProjectCategory(formDTO.getCustomerId());
//获取项目赋值得分统计
List<EventCategoryResultDTO> projectScoreList = pingYinEventDao.selectProjectCategoryScoreList(formDTO);
if (CollectionUtils.isNotEmpty(projectScoreList)) {
projectCategoryList.forEach(item -> {
projectScoreList.stream().filter(e -> item.getCategoryCode().equals(e.getParentCategoryCode())).forEach(e -> {
item.setEventTotal(item.getEventTotal() + e.getEventTotal());
item.setTotalScore(item.getTotalScore() + e.getTotalScore());
});
item.getChildren().forEach(son -> projectScoreList.stream().filter(e -> son.getCategoryCode().equals(e.getCategoryCode())).forEach(e -> {
son.setEventTotal(e.getEventTotal());
son.setTotalScore(e.getTotalScore());
}));
});
}
result.addAll(projectCategoryList);
//获取例行工作分类
List<EventCategoryResultDTO> workCategoryList = pingYinEventDao.selectWorkCategory();
//获取例行工作赋值得分统计
List<EventCategoryResultDTO> workScoreList = pingYinEventDao.selectWorkCategoryScoreList(formDTO);
if (CollectionUtils.isNotEmpty(workScoreList)) {
workCategoryList.forEach(item -> {
workScoreList.stream().filter(e -> item.getCategoryCode().equals(e.getParentCategoryCode())).forEach(e -> {
item.setEventTotal(item.getEventTotal() + e.getEventTotal());
item.setTotalScore(item.getTotalScore() + e.getTotalScore());
});
item.getChildren().forEach(son -> workScoreList.stream().filter(e -> son.getCategoryCode().equals(e.getCategoryCode())).forEach(e -> {
son.setEventTotal(e.getEventTotal());
son.setTotalScore(e.getTotalScore());
}));
});
}
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) {
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());
//获取项目分类
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;
}
/**
* 下级得分
*
* @param formDTO
* @Param formDTO
* @Return {@link List< OrgEventScoreResultDTO >}
* @Author zhaoqifeng
* @Date 2022/12/15 11:05
*/
@Override
public List<OrgEventScoreResultDTO> getOrgEventScoreList(EventCategoryFormDTO formDTO) {
if (OrgConstant.GRID.equals((formDTO.getOrgLevel()))) {
return Collections.emptyList();
}
List<OrgEventScoreResultDTO> result;
//获取areacode
if (StringUtils.isBlank(formDTO.getAreaCode())) {
formDTO.setAreaCode(pingYinEventDao.getAreaCode(formDTO.getOrgId()));
}
if (OrgConstant.COMMUNITY.equals(formDTO.getOrgLevel())) {
result = pingYinEventDao.selectGridEventScoreList(formDTO);
} else {
result = pingYinEventDao.selectOrgEventScoreList(formDTO);
}
result.forEach(item -> {
item.setAveScore("0.00");
if (!NumConstant.ZERO_STR.equals(item.getMemberCount())) {
BigDecimal projectScore = new BigDecimal(item.getProjectScore());
BigDecimal workScore = new BigDecimal(item.getWorkScore());
BigDecimal total = projectScore.add(workScore);
BigDecimal count = new BigDecimal(item.getMemberCount());
BigDecimal ave = total.divide(count, NumConstant.TWO, RoundingMode.HALF_UP);
item.setAveScore(ave.toString());
}
});
return result;
}
}

8
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/impl/GovOrgServiceImpl.java

@ -707,7 +707,13 @@ public class GovOrgServiceImpl implements GovOrgService {
@Override
public List<GridLivelyResultDTO> grdiLively(GridLivelyFormDTO formDTO) {
//1.查询当前组织的直属下级组织列表及组织下的网格总数
LinkedList<GridLivelyResultDTO> subList = customerAgencyDao.subAgencyListAndGridSumNum(formDTO.getAgencyId());
LinkedList<GridLivelyResultDTO> subList = new LinkedList<>();
if(StringUtils.isNotBlank(formDTO.getType())&&"".equals(formDTO.getType())){
GridLivelyResultDTO dto = evaluationIndexService.streetGridList(formDTO);
subList.add(dto);
}else {
subList = customerAgencyDao.subAgencyListAndGridSumNum(formDTO.getAgencyId());
}
//2.查询直属下级组织下网格在查询时间段内存在例行工作次数的网格,一天一条
List<GridDateIdResultDTO> workList = epmetUserService.getGridDateRoutineWorkList(formDTO);
//3.查询直属下级组织下网格在查询时间段内存在上报事件(直接立项)数的网格,一天一条

5
epmet-module/data-aggregator/data-aggregator-server/src/main/resources/bootstrap.yml

@ -166,6 +166,11 @@ dynamic:
url: @datasource.druid.partymember.url@
username: @datasource.druid.partymember.username@
password: @datasource.druid.partymember.password@
evaluationIndexRead:
driver-class-name: com.mysql.cj.jdbc.Driver
url: @datasource.druid.evaluationIndex1.url@
username: @datasource.druid.evaluationIndex1.username@
password: @datasource.druid.evaluationIndex1.password@
feign:
hystrix:
enabled: true

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

Binary file not shown.

9
epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/evaluationindex/EvaluationIndexDao.xml

@ -236,4 +236,13 @@
order by parentAgencyId,gridName
</select>
<select id="streetGridList" resultType="com.epmet.dataaggre.dto.govorg.result.GridLivelyResultDTO">
SELECT
COUNT(id) gridSumNum
FROM
grid_info_pingyin
WHERE
pids LIKE CONCAT('%', #{agencyId}, '%')
</select>
</mapper>

584
epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/evaluationindex/PingYinEventDao.xml

@ -0,0 +1,584 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.epmet.dataaggre.dao.evaluationindex.PingYinEventDao">
<!-- 查询客户下所有分类 -->
<resultMap id="selectCategoryByCustomerIdMap" type="com.epmet.dataaggre.dto.evaluationindex.EventCategoryResultDTO">
<result column="e" property="eventType"/>
<result column="c" property="categoryCode"/>
<result column="n" property="categoryName"/>
<result column="pc1" property="parentCategoryCode"/>
<result column="score1" property="score"/>
<collection property="children" ofType="com.epmet.dataaggre.dto.evaluationindex.EventCategoryResultDTO">
<result column="e" property="eventType"/>
<result column="c2" property="categoryCode"/>
<result column="n2" property="categoryName"/>
<result column="pc2" property="parentCategoryCode"/>
<result column="score2" property="score"/>
<result column="n" property="parentCategoryName"/>
</collection>
</resultMap>
<select id="selectProjectCategory" resultMap="selectCategoryByCustomerIdMap">
SELECT
'事件' AS e,
'事件' AS e2,
p1.CATEGORY_CODE AS c,
p2.CATEGORY_CODE AS c2,
p1.CATEGORY_NAME AS n,
p2.CATEGORY_NAME AS n2,
p1.PARENT_CATEGORY_CODE AS pc1,
p2.PARENT_CATEGORY_CODE AS pc2,
p1.SCORE AS score1,
p2.SCORE AS score2
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="selectWorkCategory" resultMap="selectCategoryByCustomerIdMap">
SELECT
'例行工作' AS e,
'例行工作' AS e2,
p1.CATEGORY_CODE AS c,
p2.CATEGORY_CODE AS c2,
p1.CATEGORY_NAME AS n,
p2.CATEGORY_NAME AS n2,
p1.PARENT_CATEGORY_CODE AS pc1,
p2.PARENT_CATEGORY_CODE AS pc2,
p1.SCORE AS score1,
p2.SCORE AS score2
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>
<select id="selectProjectCategoryScoreList" resultType="com.epmet.dataaggre.dto.evaluationindex.EventCategoryResultDTO">
SELECT
*
FROM
(SELECT
a.CATEGORY_CODE,
c.PARENT_CATEGORY_CODE,
COUNT( a.EVENT_ID ) AS eventTotal,
c.SCORE,
SUM( c.SCORE ) 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>
GROUP BY a.CATEGORY_CODE
) a
WHERE CATEGORY_CODE IS NOT NULL
</select>
<select id="selectWorkCategoryScoreList" resultType="com.epmet.dataaggre.dto.evaluationindex.EventCategoryResultDTO">
SELECT
*
FROM
(SELECT
a.CATEGORY_CODE,
c.PARENT_CATEGORY_CODE,
COUNT( a.EVENT_ID ) AS eventTotal,
c.SCORE,
SUM( c.SCORE ) 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>
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(DISTINCT STAFF_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>
<select id="selectOrgEventScoreList" resultType="com.epmet.dataaggre.dto.evaluationindex.result.OrgEventScoreResultDTO">
SELECT
a.orgName,
projectCount,
projectScore,
workCount,
workScore,
memberCount
FROM
(
SELECT
a.AGENCY_ID,
a.AGENCY_NAME AS orgName,
IFNULL( SUM( b.eventCount ), 0 ) AS projectCount,
IFNULL( SUM( b.eventScore ), 0 ) AS projectScore
FROM
screen_customer_agency a
LEFT JOIN (
SELECT
a.PIDS,
COUNT( a.EVENT_ID ) AS eventCount,
SUM( b.SCORE ) AS eventScore
FROM
screen_py_event_data a
INNER JOIN customer_project_category_dict b ON a.CATEGORY_CODE = b.CATEGORY_CODE
AND b.CUSTOMER_ID = #{customerId}
AND b.IS_DISABLE = 'enable'
WHERE
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="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.PIDS
) b ON b.PIDS LIKE CONCAT( '%', a.AGENCY_ID, '%' )
WHERE
a.DEL_FLAG = '0'
AND a.PARENT_AREA_CODE = #{areaCode}
GROUP BY
a.AGENCY_ID
) a
INNER JOIN (
SELECT
a.AGENCY_ID,
a.AGENCY_NAME AS orgName,
IFNULL( SUM( c.eventCount ), 0 ) AS workCount,
IFNULL( SUM( c.eventScore ), 0 ) AS workScore
FROM
screen_customer_agency a
LEFT JOIN (
SELECT
a.PIDS,
COUNT( a.EVENT_ID ) AS eventCount,
SUM( b.SCORE ) AS eventScore
FROM
screen_py_event_data a
INNER JOIN customer_patrol_work_type_dict b ON a.CATEGORY_CODE = b.CATEGORY_CODE
AND b.IS_DISABLE = 'enable'
WHERE
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="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.PIDS
) c ON c.PIDS LIKE CONCAT( '%', a.AGENCY_ID, '%' )
WHERE
a.DEL_FLAG = '0'
AND a.PARENT_AREA_CODE = #{areaCode}
GROUP BY
a.AGENCY_ID
) b ON a.AGENCY_ID = b.AGENCY_ID
INNER JOIN (
SELECT
a.AGENCY_ID,
a.AGENCY_NAME AS orgName,
IFNULL( COUNT( DISTINCT d.STAFF_ID ), 0 ) AS memberCount
FROM
screen_customer_agency a
LEFT JOIN screen_py_grid_staff d ON d.DEL_FLAG = '0'
AND IS_LEAVE = 'N'
AND d.PIDS LIKE CONCAT( '%', a.AGENCY_ID, '%' )
<if test="name != null and name != ''">
AND d.STAFF_NAME LIKE CONCAT('%', #{name}, '%')
</if>
<if test="mobile != null and mobile != ''">
AND d.MOBILE LIKE CONCAT('%', #{mobile}, '%')
</if>
WHERE
a.DEL_FLAG = '0'
AND a.PARENT_AREA_CODE = #{areaCode}
GROUP BY
a.AGENCY_ID
) c ON a.AGENCY_ID = c.AGENCY_ID
</select>
<select id="selectGridEventScoreList" resultType="com.epmet.dataaggre.dto.evaluationindex.result.OrgEventScoreResultDTO">
SELECT
a.orgName,
projectCount,
projectScore,
workCount,
workScore,
memberCount
FROM
(
SELECT
a.GRID_ID,
a.GRID_NAME AS orgName,
IFNULL( SUM( b.eventCount ), 0 ) AS projectCount,
IFNULL( SUM( b.eventScore ), 0 ) AS projectScore
FROM
screen_customer_grid a
LEFT JOIN (
SELECT
a.ORG_ID,
COUNT( a.EVENT_ID ) AS eventCount,
SUM( b.SCORE ) AS eventScore
FROM
screen_py_event_data a
INNER JOIN customer_project_category_dict b ON a.CATEGORY_CODE = b.CATEGORY_CODE
AND b.CUSTOMER_ID = #{customerId}
AND b.IS_DISABLE = 'enable'
WHERE
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="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.ORG_ID
) b ON b.ORG_ID = a.GRID_ID
WHERE
a.DEL_FLAG = '0'
AND a.PARENT_AGENCY_ID = #{orgId}
GROUP BY
a.GRID_ID
) a
INNER JOIN (
SELECT
a.GRID_ID,
a.GRID_NAME AS orgName,
IFNULL( SUM( c.eventCount ), 0 ) AS workCount,
IFNULL( SUM( c.eventScore ), 0 ) AS workScore
FROM
screen_customer_grid a
LEFT JOIN (
SELECT
a.ORG_ID,
COUNT( a.EVENT_ID ) AS eventCount,
SUM( b.SCORE ) AS eventScore
FROM
screen_py_event_data a
INNER JOIN customer_patrol_work_type_dict b ON a.CATEGORY_CODE = b.CATEGORY_CODE
AND b.IS_DISABLE = 'enable'
WHERE
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="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.ORG_ID
) c ON c.ORG_ID = a.GRID_ID
WHERE
a.DEL_FLAG = '0'
AND a.PARENT_AGENCY_ID = #{orgId}
GROUP BY
a.GRID_ID
) b ON a.GRID_ID = b.GRID_ID
INNER JOIN (
SELECT
a.GRID_ID,
a.GRID_NAME AS orgName,
IFNULL( COUNT( DISTINCT d.STAFF_ID ), 0 ) AS memberCount
FROM
screen_customer_grid a
LEFT JOIN screen_py_grid_staff d ON d.DEL_FLAG = '0'
AND IS_LEAVE = 'N'
AND d.GRID_ID = a.GRID_ID
<if test="name != null and name != ''">
AND d.STAFF_NAME LIKE CONCAT('%', #{name}, '%')
</if>
<if test="mobile != null and mobile != ''">
AND d.MOBILE LIKE CONCAT('%', #{mobile}, '%')
</if>
WHERE
a.DEL_FLAG = '0'
AND a.PARENT_AGENCY_ID = #{orgId}
GROUP BY
a.GRID_ID
) c ON a.GRID_ID = c.GRID_ID
</select>
<select id="getAreaCode" resultType="java.lang.String">
SELECT AREA_CODE
FROM screen_customer_agency
WHERE DEL_FLAG = '0'
AND AGENCY_ID = #{agencyId}
</select>
</mapper>

4
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/basereport/form/EventInfoFormDTO.java

@ -4,6 +4,7 @@ import com.epmet.commons.tools.dto.form.PageFormDTO;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
@ -27,4 +28,7 @@ public class EventInfoFormDTO extends PageFormDTO implements Serializable {
* 2在完全初始化之后由于eventreport_pingyin表没有客户ID初始化其他客户的数据时候可以设2直接新增
*/
private String initFlag = "0";
private Date startTime;
private Date endTime;
}

117
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcollect/ScreenPyGridStaffDTO.java

@ -0,0 +1,117 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.dto.indexcollect;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* 平阴区网格员基础信息
*
* @author generator generator@elink-cn.com
*/
@Data
public class ScreenPyGridStaffDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* ID 主键
*/
private String id;
/**
* 客户Id
*/
private String customerId;
/**
* 网格Id
*/
private String gridId;
/**
* 网格编码
*/
private String gridCode;
/**
* 网格名称
*/
private String gridName;
/**
* 网格名称
*/
private String pids;
/**
* 工作人员Id
*/
private String staffId;
/**
* 网格员姓名
*/
private String staffName;
/**
* 手机号
*/
private String mobile;
/**
* 是否离职格式为YN
*/
private String isLeave;
/**
* 删除标识 0未删除1已删除
*/
private String delFlag;
/**
* 乐观锁
*/
private Integer revision;
/**
* 创建人
*/
private String createdBy;
/**
* 创建时间
*/
private Date createdTime;
/**
* 更新人
*/
private String updatedBy;
/**
* 更新时间
*/
private Date updatedTime;
}

95
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcollect/ScreenPyHistoryScoreDTO.java

@ -0,0 +1,95 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.dto.indexcollect;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* 平阴历史得分主表
*
* @author generator generator@elink-cn.com
*/
@Data
public class ScreenPyHistoryScoreDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* ID 主键
*/
private String id;
/**
* 客户Id
*/
private String customerId;
/**
* 标题
*/
private String title;
/**
* 起始时间
*/
private Date startTime;
/**
* 截止时间
*/
private Date endTime;
/**
* 发布时间
*/
private Date releaseTime;
/**
* 删除标识 0未删除1已删除
*/
private String delFlag;
/**
* 乐观锁
*/
private Integer revision;
/**
* 创建人
*/
private String createdBy;
/**
* 创建时间
*/
private Date createdTime;
/**
* 更新人
*/
private String updatedBy;
/**
* 更新时间
*/
private Date updatedTime;
}

126
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcollect/ScreenPyHistoryScoreDetailDTO.java

@ -0,0 +1,126 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.dto.indexcollect;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
/**
* 平阴历史得分明细表
*
* @author generator generator@elink-cn.com
*/
@Data
public class ScreenPyHistoryScoreDetailDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* ID 主键
*/
private String id;
/**
* 客户Id
*/
private String customerId;
/**
* screen_py_history_score.id
*/
private String historyScoreId;
/**
* 街道组织Id
*/
private String agencyId;
/**
* 街道名称
*/
private String agencyName;
/**
* 网格活跃度
*/
private BigDecimal wghyd;
/**
* 事件赋分
*/
private BigDecimal sjff;
/**
* 雪亮工程
*/
private BigDecimal xlgc;
/**
* 日核周调
*/
private BigDecimal rhzt;
/**
* 亮点工作
*/
private BigDecimal ldgz;
/**
* 其他工作
*/
private BigDecimal qtgz;
/**
* 能力得分
*/
private BigDecimal nldf;
/**
* 删除标识 0未删除1已删除
*/
private String delFlag;
/**
* 乐观锁
*/
private Integer revision;
/**
* 创建人
*/
private String createdBy;
/**
* 创建时间
*/
private Date createdTime;
/**
* 更新人
*/
private String updatedBy;
/**
* 更新时间
*/
private Date updatedTime;
}

106
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcollect/ScreenPyWeightConfigurationDTO.java

@ -0,0 +1,106 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.dto.indexcollect;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
/**
* 平阴政法能力权重配置
*
* @author generator generator@elink-cn.com
*/
@Data
public class ScreenPyWeightConfigurationDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* ID 主键
*/
private String id;
/**
* 客户Id
*/
private String customerId;
/**
* 网格活跃度
*/
private BigDecimal wghyd;
/**
* 事件赋分
*/
private BigDecimal sjff;
/**
* 雪亮工程
*/
private BigDecimal xlgc;
/**
* 日核周调
*/
private BigDecimal rhzt;
/**
* 亮点工作
*/
private BigDecimal ldgz;
/**
* 其他工作
*/
private BigDecimal qtgz;
/**
* 删除标识 0未删除1已删除
*/
private String delFlag;
/**
* 乐观锁
*/
private Integer revision;
/**
* 创建人
*/
private String createdBy;
/**
* 创建时间
*/
private Date createdTime;
/**
* 更新人
*/
private String updatedBy;
/**
* 更新时间
*/
private Date updatedTime;
}

44
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcollect/form/HistoryScoreComputeFormDTO.java

@ -0,0 +1,44 @@
package com.epmet.dto.indexcollect.form;
import com.epmet.commons.tools.validator.group.CustomerClientShowGroup;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
@Data
public class HistoryScoreComputeFormDTO implements Serializable {
private static final long serialVersionUID = 1L;
public interface Compute extends CustomerClientShowGroup {}
/**
* 组织Id
*/
@NotBlank(message = "组织Id不能为空", groups = Compute.class)
private String agencyId;
/**
* 计算类型 grid:网格活跃度 event:事件赋分
*/
@NotBlank(message = "计算类型不能为空", groups = Compute.class)
private String type;
/**
* 起始时间yyyyMMdd
*/
@NotBlank(message = "起始时间不能为空", groups = {Compute.class})
private String startTime;
/**
* 终止时间yyyyMMdd
*/
@NotBlank(message = "终止时间不能为空", groups = {Compute.class})
private String endTime;
private String customerId;
private String userId;
}

106
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcollect/form/HistoryScoreFormDTO.java

@ -0,0 +1,106 @@
package com.epmet.dto.indexcollect.form;
import com.epmet.commons.tools.validator.group.AddGroup;
import com.epmet.commons.tools.validator.group.CustomerClientShowGroup;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
@Data
public class HistoryScoreFormDTO implements Serializable {
private static final long serialVersionUID = 1L;
public interface Add extends CustomerClientShowGroup {}
public interface Edit extends CustomerClientShowGroup {}
/**
* id
*/
@NotBlank(message = "id不能为空", groups = Edit.class)
private String id;
/**
* 标题
*/
@NotBlank(message = "标题不能为空", groups = Add.class)
private String title;
/**
* 起始时间
*/
@NotNull(message = "起始时间不能为空", groups = {Add.class})
@JsonFormat(pattern = "yyyy-MM-dd")
private Date startTime;
/**
* 截止时间
*/
@NotNull(message = "截止时间不能为空", groups = {Add.class})
@JsonFormat(pattern = "yyyy-MM-dd")
private Date endTime;
/**
* 截止时间
*/
private List<Detail> detailList;
private String customerId;
private String userId;
@Data
public static class Detail implements Serializable {
/**
* 街道组织Id
*/
private String agencyId;
/**
* 街道名称
*/
private String agencyName;
/**
* 网格活跃度
*/
private BigDecimal wghyd;
/**
* 事件赋分
*/
private BigDecimal sjff;
/**
* 雪亮工程
*/
private BigDecimal xlgc;
/**
* 日核周调
*/
private BigDecimal rhzt;
/**
* 亮点工作
*/
private BigDecimal ldgz;
/**
* 其他工作
*/
private BigDecimal qtgz;
/**
* 能力得分
*/
private BigDecimal nldf;
}
}

48
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcollect/form/HistoryScoreListFormDTO.java

@ -0,0 +1,48 @@
package com.epmet.dto.indexcollect.form;
import lombok.Data;
import java.io.Serializable;
@Data
public class HistoryScoreListFormDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 标题
*/
private String title;
/**
* 起始时间
*/
//@JsonFormat(pattern = "yyyy-MM-dd")
private String startTime;
/**
* 截止时间
*/
//@JsonFormat(pattern = "yyyy-MM-dd")
private String endTime;
/**
* 当前页
*/
private Integer pageNo = 1;
/**
* 每页记录数
*/
private Integer pageSize = 20;
/**
* 是否分页true分 false不分
*/
private Boolean isPage = true;
private String customerId;
private String userId;
}

58
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcollect/form/WeightConfigurationFormDTO.java

@ -0,0 +1,58 @@
package com.epmet.dto.indexcollect.form;
import com.epmet.commons.tools.validator.group.CustomerClientShowGroup;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
import java.math.BigDecimal;
@Data
public class WeightConfigurationFormDTO implements Serializable {
private static final long serialVersionUID = 1L;
public interface Add extends CustomerClientShowGroup {}
public interface Edit extends CustomerClientShowGroup {}
/**
* id
*/
@NotBlank(message = "标题不能为空", groups = Edit.class)
private String id;
/**
* 网格活跃度
*/
private BigDecimal wghyd;
/**
* 事件赋分
*/
private BigDecimal sjff;
/**
* 雪亮工程
*/
private BigDecimal xlgc;
/**
* 日核周调
*/
private BigDecimal rhzt;
/**
* 亮点工作
*/
private BigDecimal ldgz;
/**
* 其他工作
*/
private BigDecimal qtgz;
private String customerId;
private String userId;
}

31
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcollect/form/WeightConfigurationListFormDTO.java

@ -0,0 +1,31 @@
package com.epmet.dto.indexcollect.form;
import lombok.Data;
import java.io.Serializable;
@Data
public class WeightConfigurationListFormDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 当前页
*/
private Integer pageNo = 1;
/**
* 每页记录数
*/
private Integer pageSize = 20;
/**
* 是否分页true分 false不分
*/
private Boolean isPage;
private String customerId;
private String userId;
}

22
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcollect/result/HistoryScoreComputeResultDTO.java

@ -0,0 +1,22 @@
package com.epmet.dto.indexcollect.result;
import lombok.Data;
import java.io.Serializable;
@Data
public class HistoryScoreComputeResultDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 组织Id
*/
private String agencyId;
/**
* 分数
*/
private String score = "0";
}

120
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcollect/result/HistoryScoreDetailResultDTO.java

@ -0,0 +1,120 @@
package com.epmet.dto.indexcollect.result;
import com.epmet.commons.tools.validator.group.CustomerClientShowGroup;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
@Data
public class HistoryScoreDetailResultDTO implements Serializable {
private static final long serialVersionUID = 1L;
public interface Add extends CustomerClientShowGroup {
}
public interface Edit extends CustomerClientShowGroup {
}
/**
* id
*/
private String id;
/**
* 客户Id
*/
private String customerId;
/**
* 标题
*/
private String title;
/**
* 起始时间
*/
private Date startTime;
/**
* 截止时间
*/
private Date endTime;
/**
* 时间区间
*/
private String time;
/**
* 发布时间
*/
private Date releaseTime;
/**
* 截止时间
*/
private List<Detail> detailList;
@Data
public static class Detail implements Serializable {
/**
* id
*/
private String id;
/**
* screen_py_history_score.id
*/
private String historyScoreId;
/**
* 街道组织Id
*/
private String agencyId;
/**
* 街道名称
*/
private String agencyName;
/**
* 网格活跃度
*/
private BigDecimal wghyd;
/**
* 事件赋分
*/
private BigDecimal sjff;
/**
* 雪亮工程
*/
private BigDecimal xlgc;
/**
* 日核周调
*/
private BigDecimal rhzt;
/**
* 亮点工作
*/
private BigDecimal ldgz;
/**
* 其他工作
*/
private BigDecimal qtgz;
/**
* 能力得分
*/
private BigDecimal nldf;
}
}

33
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcollect/result/HistoryScoreListResultDTO.java

@ -0,0 +1,33 @@
package com.epmet.dto.indexcollect.result;
import lombok.Data;
import java.io.Serializable;
@Data
public class HistoryScoreListResultDTO implements Serializable {
private static final long serialVersionUID = -4316054054019675419L;
/**
* id
*/
private String id;
/**
* 标题
*/
private String title;
/**
* 时间区间
*/
private String time;
/**
* 发布者
*/
private String updatedBy;
private String updatedById;
/**
* 发布时间
*/
private String releaseTime;
}

25
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcollect/result/HistoryScoreSjffResultDTO.java

@ -0,0 +1,25 @@
package com.epmet.dto.indexcollect.result;
import lombok.Data;
import java.io.Serializable;
@Data
public class HistoryScoreSjffResultDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 上报事件总得分
*/
private Integer eventScore;
/**
* 例行工作总得分
*/
private Integer projectScore;
/**
* 网格员总数
*/
private Integer gridStaffNum;
}

41
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcollect/result/WeightConfigurationListResultDTO.java

@ -0,0 +1,41 @@
package com.epmet.dto.indexcollect.result;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
@Data
public class WeightConfigurationListResultDTO implements Serializable {
private static final long serialVersionUID = -4316054054019675419L;
/**
* id
*/
private String id;
/**
* 网格活跃度
*/
private BigDecimal wghyd;
/**
* 事件赋分
*/
private BigDecimal sjff;
/**
* 雪亮工程
*/
private BigDecimal xlgc;
/**
* 日核周调
*/
private BigDecimal rhzt;
/**
* 亮点工作
*/
private BigDecimal ldgz;
/**
* 其他工作
*/
private BigDecimal qtgz;
}

179
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/EventreportPingyinDTO.java

@ -0,0 +1,179 @@
package com.epmet.dto.screen;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
/**
* 平阴区事件上报中间表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2022-07-22
*/
@Data
public class EventreportPingyinDTO {
private static final long serialVersionUID = 1L;
/**
* 上报区县代码参照6位行政区划代码
*/
private String qxBm;
/**
* 上报区县名称
*/
private String qxMc;
/**
* 网格编码,参照山东省社会治理网格化智能工作平台数据标准
*/
private String gridCode;
/**
* 网格名称
*/
private String gridName;
/**
* 事件编号可以使用区县系统中的事件唯一识别码
*/
private String eventCode;
/**
* 事件名称
*/
private String eventName;
/**
* 事件类别,参照山东省社会治理网格化智能工作平台数据标准10.19
*/
private String eventCategory;
/**
* 上报网格员姓名
*/
private String gridUserName;
/**
* 上报网格员的身份证号码
*/
private String gridUserCardid;
/**
* 事件上报时间
*/
private Date reportTime;
/**
* 事件发生时间
*/
private Date happenTime;
/**
* 事件发生地点描述
*/
private String happenPlace;
/**
* 事件简述详细一些文字数量不少于10字
*/
private String eventDescription;
/**
* 事件办结方式符合标准10.20
*/
private String waysOfResolving;
/**
* 必填 是否化解填写YNY N
*/
private String successfulOrNo;
/**
* 必填 是否办结填写YNY N
*/
private String successfulDefuse;
/**
* 办结层级符合标准10.21
*/
private String completeLevel;
/**
* 办结时间办结后填写
*/
private Date completeTime;
/**
* 事件发生位置经度wgs84坐标系请勿用火星坐标系不得跑出辖区
*/
private BigDecimal lng;
/**
* 事件发生位置纬度wgs84坐标系请勿用火星坐标系不得跑出辖区
*/
private BigDecimal lat;
/**
* 事件主要当事人姓名
*/
private String name;
/**
* 事件涉及人数
*/
private Integer numberInvolved;
/**
* 事件涉及单位名称
*/
private String relatedUnites;
/**
* 重点场所类别符合标准10.25
*/
private String keyAreaType;
/**
* 宗教活动规模符合标准10.26
*/
private String religionScale;
/**
* 宗教类别符合标准10.27
*/
private String religionType;
/**
* 重点场所是否变动填写YNY N
*/
private String isKeyareaState;
/**
* 重点人员是否在当地填写YNY N
*/
private String isKeypeopleLocate;
/**
* 重点人员现状描述
*/
private String keypeopleStatus;
/**
* 例行工作编辑插入更新时间,县市区填写
*/
private Date updateTime;
/**
* 事件是否删除YN
*/
private String isDel;
/**
* 入库时间自动生成请勿设置
*/
private Date recoredInsertTime;
}

93
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/GridstaffWorkInfoPingyinDTO.java

@ -0,0 +1,93 @@
package com.epmet.dto.screen;
import lombok.Data;
import java.util.Date;
/**
* 平阴区网格员例行工作信息
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2022-07-22
*/
@Data
public class GridstaffWorkInfoPingyinDTO {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
private String id;
/**
* 上报区县代码参照6位行政区划代码
*/
private String qxBm;
/**
* 上报区县名称
*/
private String qxMc;
/**
* 网格编码
*/
private String gridCode;
/**
* 网格名称
*/
private String gridName;
private String gridId;
/**
* 例行工作类型,应符合10.27中的例行工作类型
*/
private String workType;
/**
* 发生日期,格式为YYYY-MM-DD
*/
private Date happenTime;
/**
* 基础信息主键,出租房巡查重点场所巡查刑满释放人员社区矫正吸毒人员信访人员重点青少年和精神障碍者必填
*/
private Integer baseInfoId;
/**
* 有无变动异常,YN
*/
private String workResult;
/**
* 说明
*/
private String workContent;
/**
* 例行工作编辑插入更新时间,县市区填写
*/
private Date updateTime;
/**
* 例行工作是否删除YN
*/
private String isDel;
/**
* 入库时间自动生成请勿设置
*/
private Date recoredInsertTime;
private String happenTimeString;
private String title;
private String staffName;
private String mobile;
private String orgId;
private String pids;
}

30
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/form/SavePyEventDataFormDTO.java

@ -0,0 +1,30 @@
package com.epmet.dto.screen.form;/**
* @author ZhaoQiFeng
* @date 2022/12/8
* @apiNote
*/
import com.epmet.dto.screen.EventreportPingyinDTO;
import com.epmet.dto.screen.GridstaffWorkInfoPingyinDTO;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* @Description
* @Author zhaoqifeng
* @Date 2022/12/8 13:47
*/
@Data
public class SavePyEventDataFormDTO implements Serializable {
private static final long serialVersionUID = 526763788231934112L;
/**
* 项目列表
*/
private List<EventreportPingyinDTO> projectList;
/**
* 例行工作列表
*/
private List<GridstaffWorkInfoPingyinDTO> workList;
}

8
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/DataStatisticalOpenFeignClient.java

@ -8,10 +8,12 @@ import com.epmet.dto.basereport.result.EventInfoResultDTO;
import com.epmet.dto.extract.form.*;
import com.epmet.dto.group.form.GroupStatsFormDTO;
import com.epmet.dto.group.form.GroupTotalFormDTO;
import com.epmet.dto.indexcollect.ScreenPyGridStaffDTO;
import com.epmet.dto.org.form.GridBaseInfoFormDTO;
import com.epmet.dto.org.result.CustomerAgencyDTO;
import com.epmet.dto.org.result.CustomerGridDTO;
import com.epmet.dto.screen.form.InitCustomerIndexForm;
import com.epmet.dto.screen.form.SavePyEventDataFormDTO;
import com.epmet.dto.stats.form.CustomerIdAndDateIdFormDTO;
import com.epmet.dto.stats.form.FactUserHouseFormDTO;
import com.epmet.dto.user.form.StaffBaseInfoFormDTO;
@ -379,4 +381,10 @@ public interface DataStatisticalOpenFeignClient {
@PostMapping("/data/stats/factAgencyUserHouseDaily/userHouseStatNeighborhood")
Result userHouseStatNeighborhood(@RequestBody FactUserHouseFormDTO formDTO);
@PostMapping("/data/stats/datareporting/saveData")
Result saveData(@RequestBody SavePyEventDataFormDTO formDTO);
@PostMapping("/data/stats/screenPyStaffData/savelist")
Result saveList(@RequestBody List<ScreenPyGridStaffDTO> dtoList);
}

12
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/impl/DataStatisticalOpenFeignClientFallBack.java

@ -9,10 +9,12 @@ import com.epmet.dto.basereport.result.EventInfoResultDTO;
import com.epmet.dto.extract.form.*;
import com.epmet.dto.group.form.GroupStatsFormDTO;
import com.epmet.dto.group.form.GroupTotalFormDTO;
import com.epmet.dto.indexcollect.ScreenPyGridStaffDTO;
import com.epmet.dto.org.form.GridBaseInfoFormDTO;
import com.epmet.dto.org.result.CustomerAgencyDTO;
import com.epmet.dto.org.result.CustomerGridDTO;
import com.epmet.dto.screen.form.InitCustomerIndexForm;
import com.epmet.dto.screen.form.SavePyEventDataFormDTO;
import com.epmet.dto.stats.form.CustomerIdAndDateIdFormDTO;
import com.epmet.dto.stats.form.FactUserHouseFormDTO;
import com.epmet.dto.user.form.StaffBaseInfoFormDTO;
@ -372,4 +374,14 @@ public class DataStatisticalOpenFeignClientFallBack implements DataStatisticalOp
public Result userHouseStatNeighborhood(FactUserHouseFormDTO formDTO) {
return ModuleUtils.feignConError(ServiceConstant.DATA_STATISTICAL_SERVER, "userHouseStatNeighborhood", formDTO);
}
@Override
public Result saveData(SavePyEventDataFormDTO formDTO) {
return ModuleUtils.feignConError(ServiceConstant.DATA_STATISTICAL_SERVER, "SavePyEventDataFormDTO", formDTO);
}
@Override
public Result saveList(List<ScreenPyGridStaffDTO> dtoList) {
return ModuleUtils.feignConError(ServiceConstant.DATA_STATISTICAL_SERVER, "saveList", dtoList);
}
}

6
epmet-module/data-statistical/data-statistical-server/pom.xml

@ -148,6 +148,12 @@
<version>2.0.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.epmet</groupId>
<artifactId>data-aggregator-client</artifactId>
<version>2.0.0</version>
<scope>compile</scope>
</dependency>
</dependencies>
<build>

19
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DataReportingController.java

@ -7,6 +7,7 @@ import com.epmet.dto.basereport.result.EventInfoResultDTO;
import com.epmet.dto.org.form.GridBaseInfoFormDTO;
import com.epmet.dto.org.result.CustomerAgencyDTO;
import com.epmet.dto.org.result.CustomerGridDTO;
import com.epmet.dto.screen.form.SavePyEventDataFormDTO;
import com.epmet.dto.user.form.StaffBaseInfoFormDTO;
import com.epmet.dto.user.param.MidPatrolFormDTO;
import com.epmet.dto.user.result.GridUserInfoDTO;
@ -14,12 +15,14 @@ import com.epmet.dto.user.result.MidPatrolDetailResult;
import com.epmet.dto.user.result.MidPatrolRecordResult;
import com.epmet.opendata.dto.BaseDisputeProcessDTO;
import com.epmet.service.DataReportingService;
import com.epmet.service.evaluationindex.screen.ScreenPyEventDataService;
import org.springframework.beans.factory.annotation.Autowired;
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 java.util.List;
/**
@ -31,6 +34,8 @@ import java.util.List;
public class DataReportingController {
@Autowired
private DataReportingService dataReportingService;
@Resource
private ScreenPyEventDataService screenPyEventDataService;
/**
* @Author sun
@ -106,4 +111,18 @@ public class DataReportingController {
public Result<List<EventInfoResultDTO>> getEventInfoV2(@RequestBody(required = false) EventInfoFormDTO formDTO) {
return new Result<List<EventInfoResultDTO>>().ok(dataReportingService.getEventInfoV2(formDTO));
}
/**
* 保存同步到中间库的数据
*
* @Param formDTO
* @Return {@link Result}
* @Author zhaoqifeng
* @Date 2022/12/8 16:03
*/
@PostMapping("saveData")
public Result getEventInfoV2(@RequestBody(required = false) SavePyEventDataFormDTO formDTO) {
screenPyEventDataService.saveData(formDTO);
return new Result();
}
}

36
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/ScreenPyGridStaffController.java

@ -0,0 +1,36 @@
package com.epmet.controller;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.indexcollect.ScreenPyGridStaffDTO;
import com.epmet.service.evaluationindex.indexcoll.ScreenPyGridStaffService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
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 java.util.List;
/**
* 平阴区网格员基础信息
*
* @author generator generator@elink-cn.com
*/
@Slf4j
@RestController
@RequestMapping("screenPyGridStaff")
public class ScreenPyGridStaffController {
@Autowired
private ScreenPyGridStaffService screenPyStaffDataService;
@PostMapping("savelist")
public Result saveList(@RequestBody List<ScreenPyGridStaffDTO> dtoList) {
screenPyStaffDataService.saveList(dtoList);
return new Result();
}
}

154
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/ScreenPyHistoryScoreController.java

@ -0,0 +1,154 @@
package com.epmet.controller;
import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.ExcelWriter;
import com.alibaba.excel.support.ExcelTypeEnum;
import com.alibaba.excel.write.metadata.WriteSheet;
import com.alibaba.fastjson.JSON;
import com.epmet.commons.tools.annotation.LoginUser;
import com.epmet.commons.tools.aop.NoRepeatSubmit;
import com.epmet.commons.tools.constant.NumConstant;
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.ConvertUtils;
import com.epmet.commons.tools.utils.DateUtils;
import com.epmet.commons.tools.utils.ExcelUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.utils.poi.excel.handler.CustomerTitleHandler;
import com.epmet.commons.tools.utils.poi.excel.handler.ExcelFillCellMergeStrategy;
import com.epmet.commons.tools.utils.poi.excel.handler.FreezeAndFilter;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.dto.indexcollect.form.HistoryScoreComputeFormDTO;
import com.epmet.dto.indexcollect.form.HistoryScoreFormDTO;
import com.epmet.dto.indexcollect.form.HistoryScoreListFormDTO;
import com.epmet.dto.indexcollect.result.HistoryScoreComputeResultDTO;
import com.epmet.dto.indexcollect.result.HistoryScoreDetailResultDTO;
import com.epmet.dto.indexcollect.result.HistoryScoreListResultDTO;
import com.epmet.excel.HistoryScoreDetailExcel;
import com.epmet.service.evaluationindex.indexcoll.ScreenPyHistoryScoreDetailService;
import com.epmet.service.evaluationindex.indexcoll.ScreenPyHistoryScoreService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
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.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Date;
import java.util.List;
/**
* 平阴历史得分主表
*
* @author generator generator@elink-cn.com
*/
@Slf4j
@RestController
@RequestMapping("screenPyHistoryScore")
public class ScreenPyHistoryScoreController {
@Autowired
private ScreenPyHistoryScoreService screenPyHistoryScoreService;
@Autowired
private ScreenPyHistoryScoreDetailService screenPyHistoryScoreDetailService;
@RequestMapping("list")
public Result<PageData<HistoryScoreListResultDTO>> list(@LoginUser TokenDto tokenDto, @RequestBody HistoryScoreListFormDTO formDTO) {
formDTO.setCustomerId(tokenDto.getCustomerId());
formDTO.setUserId(tokenDto.getUserId());
return new Result<PageData<HistoryScoreListResultDTO>>().ok(screenPyHistoryScoreService.list(formDTO));
}
@NoRepeatSubmit
@PostMapping("add")
public Result save(@LoginUser TokenDto tokenDto, @RequestBody HistoryScoreFormDTO dto) {
ValidatorUtils.validateEntity(dto, HistoryScoreFormDTO.Add.class);
dto.setCustomerId(tokenDto.getCustomerId());
dto.setUserId(tokenDto.getUserId());
screenPyHistoryScoreService.save(dto);
return new Result();
}
@PostMapping("edit")
public Result update(@LoginUser TokenDto tokenDto, @RequestBody HistoryScoreFormDTO dto) {
ValidatorUtils.validateEntity(dto, HistoryScoreFormDTO.Edit.class);
dto.setCustomerId(tokenDto.getCustomerId());
dto.setUserId(tokenDto.getUserId());
screenPyHistoryScoreService.update(dto);
return new Result();
}
@PostMapping("deleteById")
public Result deleteById(@LoginUser TokenDto tokenDto, @RequestBody HistoryScoreFormDTO dto) {
ValidatorUtils.validateEntity(dto, HistoryScoreFormDTO.Edit.class);
dto.setCustomerId(tokenDto.getCustomerId());
dto.setUserId(tokenDto.getUserId());
screenPyHistoryScoreService.deleteById(dto);
return new Result();
}
@RequestMapping("detail")
public Result<HistoryScoreDetailResultDTO> detail(@LoginUser TokenDto tokenDto, @RequestBody HistoryScoreFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, HistoryScoreFormDTO.Edit.class);
formDTO.setCustomerId(tokenDto.getCustomerId());
return new Result<HistoryScoreDetailResultDTO>().ok(screenPyHistoryScoreService.detail(formDTO));
}
@PostMapping("export")
public void export(@LoginUser TokenDto tokenDto, @RequestBody HistoryScoreListFormDTO formDTO, HttpServletResponse response) throws IOException {
formDTO.setCustomerId(tokenDto.getCustomerId());
formDTO.setUserId(tokenDto.getUserId());
formDTO.setIsPage(false);
ExcelWriter excelWriter = null;
formDTO.setPageNo(NumConstant.ONE);
formDTO.setPageSize(NumConstant.FIVE_HUNDRED);
try {
String fileName = "历史得分" + DateUtils.format(new Date()) + ".xlsx";
excelWriter = EasyExcel.write(ExcelUtils.getOutputStreamForExcel(fileName, response), HistoryScoreDetailExcel.class).excelType(ExcelTypeEnum.XLSX).build();
PageData<HistoryScoreDetailResultDTO> data = null;
List<HistoryScoreDetailExcel> list = null;
do {
data = screenPyHistoryScoreDetailService.selectScoreDetailList(formDTO);
for (HistoryScoreDetailResultDTO d : data.getList()){
list = ConvertUtils.sourceToTarget(d.getDetailList(), HistoryScoreDetailExcel.class);
//一条主表记录一个sheet页
WriteSheet writeSheet = EasyExcel.writerSheet("(" + d.getTitle() + ")").registerWriteHandler(new CustomerTitleHandler(d.getTime())).build();
excelWriter.write(list, writeSheet);
}
formDTO.setPageNo(formDTO.getPageNo() + NumConstant.ONE);
} while (CollectionUtils.isNotEmpty(list) && list.size() == formDTO.getPageSize());
} 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();
}
}
}
@RequestMapping("computescore")
public Result<HistoryScoreComputeResultDTO> computeScore(@LoginUser TokenDto tokenDto, @RequestBody HistoryScoreComputeFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, HistoryScoreComputeFormDTO.Compute.class);
formDTO.setCustomerId(tokenDto.getCustomerId());
return new Result<HistoryScoreComputeResultDTO>().ok(screenPyHistoryScoreService.computeScore(formDTO));
}
}

70
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/ScreenPyWeightConfigurationController.java

@ -0,0 +1,70 @@
package com.epmet.controller;
import com.epmet.commons.tools.annotation.LoginUser;
import com.epmet.commons.tools.aop.NoRepeatSubmit;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.dto.indexcollect.form.WeightConfigurationFormDTO;
import com.epmet.dto.indexcollect.form.WeightConfigurationListFormDTO;
import com.epmet.dto.indexcollect.result.WeightConfigurationListResultDTO;
import com.epmet.service.evaluationindex.indexcoll.ScreenPyWeightConfigurationService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
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;
/**
* 平阴政法能力权重配置
*
* @author generator generator@elink-cn.com
*/
@Slf4j
@RestController
@RequestMapping("screenPyWeightConfiguration")
public class ScreenPyWeightConfigurationController {
@Autowired
private ScreenPyWeightConfigurationService screenPyWeightConfigurationService;
@RequestMapping("list")
public Result<PageData<WeightConfigurationListResultDTO>> list(@LoginUser TokenDto tokenDto, @RequestBody WeightConfigurationListFormDTO formDTO) {
formDTO.setCustomerId(tokenDto.getCustomerId());
formDTO.setUserId(tokenDto.getUserId());
return new Result<PageData<WeightConfigurationListResultDTO>>().ok(screenPyWeightConfigurationService.list(formDTO));
}
@NoRepeatSubmit
@PostMapping("add")
public Result save(@LoginUser TokenDto tokenDto, @RequestBody WeightConfigurationFormDTO dto) {
ValidatorUtils.validateEntity(dto, WeightConfigurationFormDTO.Add.class);
dto.setCustomerId(tokenDto.getCustomerId());
dto.setUserId(tokenDto.getUserId());
screenPyWeightConfigurationService.save(dto);
return new Result();
}
@PostMapping("edit")
public Result update(@LoginUser TokenDto tokenDto, @RequestBody WeightConfigurationFormDTO dto) {
ValidatorUtils.validateEntity(dto, WeightConfigurationFormDTO.Edit.class);
dto.setCustomerId(tokenDto.getCustomerId());
dto.setUserId(tokenDto.getUserId());
screenPyWeightConfigurationService.update(dto);
return new Result();
}
@PostMapping("deleteById")
public Result deleteById(@LoginUser TokenDto tokenDto, @RequestBody WeightConfigurationFormDTO dto) {
ValidatorUtils.validateEntity(dto, WeightConfigurationFormDTO.Edit.class);
dto.setCustomerId(tokenDto.getCustomerId());
dto.setUserId(tokenDto.getUserId());
screenPyWeightConfigurationService.deleteById(dto);
return new Result();
}
}

36
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcoll/ScreenPyGridStaffDao.java

@ -0,0 +1,36 @@
package com.epmet.dao.evaluationindex.indexcoll; /**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.entity.evaluationindex.indexcoll.ScreenPyGridStaffEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 平阴区网格员基础信息
*
* @author generator generator@elink-cn.com
*/
@Mapper
public interface ScreenPyGridStaffDao extends BaseDao<ScreenPyGridStaffEntity> {
ScreenPyGridStaffEntity selectStaff(@Param("gridId") String gridId, @Param("staffId") String staffId);
}

44
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcoll/ScreenPyHistoryScoreDao.java

@ -0,0 +1,44 @@
package com.epmet.dao.evaluationindex.indexcoll; /**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.indexcollect.form.HistoryScoreComputeFormDTO;
import com.epmet.dto.indexcollect.form.HistoryScoreListFormDTO;
import com.epmet.dto.indexcollect.result.HistoryScoreListResultDTO;
import com.epmet.dto.indexcollect.result.HistoryScoreSjffResultDTO;
import com.epmet.entity.evaluationindex.indexcoll.ScreenPyHistoryScoreEntity;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* 平阴历史得分主表
*
* @author generator generator@elink-cn.com
*/
@Mapper
public interface ScreenPyHistoryScoreDao extends BaseDao<ScreenPyHistoryScoreEntity> {
List<HistoryScoreListResultDTO> selectHistoryScoreList(HistoryScoreListFormDTO formDTO);
HistoryScoreSjffResultDTO sumEventScore(HistoryScoreComputeFormDTO formDTO);
HistoryScoreSjffResultDTO sumProjectScore(HistoryScoreComputeFormDTO formDTO);
HistoryScoreSjffResultDTO sumGridNum(HistoryScoreComputeFormDTO formDTO);
}

40
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcoll/ScreenPyHistoryScoreDetailDao.java

@ -0,0 +1,40 @@
package com.epmet.dao.evaluationindex.indexcoll; /**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.indexcollect.form.HistoryScoreListFormDTO;
import com.epmet.dto.indexcollect.result.HistoryScoreDetailResultDTO;
import com.epmet.entity.evaluationindex.indexcoll.ScreenPyHistoryScoreDetailEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 平阴历史得分明细表
*
* @author generator generator@elink-cn.com
*/
@Mapper
public interface ScreenPyHistoryScoreDetailDao extends BaseDao<ScreenPyHistoryScoreDetailEntity> {
void delByHistoryScoreId(@Param("historyScoreId") String historyScoreId, @Param("userId") String userId);
List<HistoryScoreDetailResultDTO> selectScoreDetailList(HistoryScoreListFormDTO formDTO);
}

43
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcoll/ScreenPyWeightConfigurationDao.java

@ -0,0 +1,43 @@
package com.epmet.dao.evaluationindex.indexcoll; /**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.indexcollect.ScreenPyWeightConfigurationDTO;
import com.epmet.dto.indexcollect.form.HistoryScoreListFormDTO;
import com.epmet.dto.indexcollect.form.WeightConfigurationListFormDTO;
import com.epmet.dto.indexcollect.result.HistoryScoreListResultDTO;
import com.epmet.dto.indexcollect.result.WeightConfigurationListResultDTO;
import com.epmet.entity.evaluationindex.indexcoll.ScreenPyHistoryScoreEntity;
import com.epmet.entity.evaluationindex.indexcoll.ScreenPyWeightConfigurationEntity;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* 平阴政法能力权重配置
*
* @author generator generator@elink-cn.com
*/
@Mapper
public interface ScreenPyWeightConfigurationDao extends BaseDao<ScreenPyWeightConfigurationEntity> {
List<WeightConfigurationListResultDTO> selectWeightConfigurationList(WeightConfigurationListFormDTO formDTO);
ScreenPyWeightConfigurationDTO selectOneDTO();
}

16
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenPyEventDataDao.java

@ -0,0 +1,16 @@
package com.epmet.dao.evaluationindex.screen;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.entity.evaluationindex.screen.ScreenPyEventDataEntity;
import org.apache.ibatis.annotations.Mapper;
/**
* 上报到市平台中间库的事件
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2022-12-08
*/
@Mapper
public interface ScreenPyEventDataDao extends BaseDao<ScreenPyEventDataEntity> {
}

84
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/indexcoll/ScreenPyGridStaffEntity.java

@ -0,0 +1,84 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.entity.evaluationindex.indexcoll;
import com.baomidou.mybatisplus.annotation.TableName;
import com.epmet.commons.mybatis.entity.BaseEpmetEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
/**
* 平阴区网格员基础信息
*
* @author generator generator@elink-cn.com
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("screen_py_grid_staff")
public class ScreenPyGridStaffEntity extends BaseEpmetEntity {
private static final long serialVersionUID = 1L;
/**
* 客户Id
*/
private String customerId;
/**
* 网格Id
*/
private String gridId;
/**
* 网格编码
*/
private String gridCode;
/**
* 网格名称
*/
private String gridName;
/**
* 网格名称
*/
private String pids;
/**
* 工作人员Id
*/
private String staffId;
/**
* 网格员姓名
*/
private String staffName;
/**
* 手机号
*/
private String mobile;
/**
* 是否离职格式为YN
*/
private String isLeave;
}

94
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/indexcoll/ScreenPyHistoryScoreDetailEntity.java

@ -0,0 +1,94 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.entity.evaluationindex.indexcoll;
import com.baomidou.mybatisplus.annotation.TableName;
import com.epmet.commons.mybatis.entity.BaseEpmetEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.math.BigDecimal;
/**
* 平阴历史得分明细表
*
* @author generator generator@elink-cn.com
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("screen_py_history_score_detail")
public class ScreenPyHistoryScoreDetailEntity extends BaseEpmetEntity {
private static final long serialVersionUID = 1L;
/**
* 客户Id
*/
private String customerId;
/**
* screen_py_history_score.id
*/
private String historyScoreId;
/**
* 街道组织Id
*/
private String agencyId;
/**
* 街道名称
*/
private String agencyName;
/**
* 网格活跃度
*/
private BigDecimal wghyd;
/**
* 事件赋分
*/
private BigDecimal sjff;
/**
* 雪亮工程
*/
private BigDecimal xlgc;
/**
* 日核周调
*/
private BigDecimal rhzt;
/**
* 亮点工作
*/
private BigDecimal ldgz;
/**
* 其他工作
*/
private BigDecimal qtgz;
/**
* 能力得分
*/
private BigDecimal nldf;
}

64
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/indexcoll/ScreenPyHistoryScoreEntity.java

@ -0,0 +1,64 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.entity.evaluationindex.indexcoll;
import com.baomidou.mybatisplus.annotation.TableName;
import com.epmet.commons.mybatis.entity.BaseEpmetEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
/**
* 平阴历史得分主表
*
* @author generator generator@elink-cn.com
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("screen_py_history_score")
public class ScreenPyHistoryScoreEntity extends BaseEpmetEntity {
private static final long serialVersionUID = 1L;
/**
* 客户Id
*/
private String customerId;
/**
* 标题
*/
private String title;
/**
* 起始时间
*/
private Date startTime;
/**
* 截止时间
*/
private Date endTime;
/**
* 发布时间
*/
private Date releaseTime;
}

74
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/indexcoll/ScreenPyWeightConfigurationEntity.java

@ -0,0 +1,74 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.entity.evaluationindex.indexcoll;
import com.baomidou.mybatisplus.annotation.TableName;
import com.epmet.commons.mybatis.entity.BaseEpmetEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.math.BigDecimal;
/**
* 平阴政法能力权重配置
*
* @author generator generator@elink-cn.com
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("screen_py_weight_configuration")
public class ScreenPyWeightConfigurationEntity extends BaseEpmetEntity {
private static final long serialVersionUID = 1L;
/**
* 客户Id
*/
private String customerId;
/**
* 网格活跃度
*/
private BigDecimal wghyd;
/**
* 事件赋分
*/
private BigDecimal sjff;
/**
* 雪亮工程
*/
private BigDecimal xlgc;
/**
* 日核周调
*/
private BigDecimal rhzt;
/**
* 亮点工作
*/
private BigDecimal ldgz;
/**
* 其他工作
*/
private BigDecimal qtgz;
}

70
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenPyEventDataEntity.java

@ -0,0 +1,70 @@
package com.epmet.entity.evaluationindex.screen;
import com.baomidou.mybatisplus.annotation.TableName;
import com.epmet.commons.mybatis.entity.BaseEpmetEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
/**
* 上报到市平台中间库的事件
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2022-12-08
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("screen_py_event_data")
public class ScreenPyEventDataEntity extends BaseEpmetEntity {
private static final long serialVersionUID = 1L;
///**
// * 客户Id
// */
//private String customerId;
/**
* 上级组织Id
*/
private String orgId;
/**
* 所有上级ID用英文逗号分开
*/
private String pids;
/**
* 事件Id
*/
private String eventId;
/**
* 事件类别 上报事件project例行工作work
*/
private String eventType;
/**
* 事件时间
*/
private Date eventCreateTime;
/**
* 事件分类编码
*/
private String categoryCode;
private String title;
private String staffName;
private String mobile;
///**
// * 父类事件分类编码
// */
//private String parentCategoryCode;
}

57
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/excel/HistoryScoreDetailExcel.java

@ -0,0 +1,57 @@
package com.epmet.excel;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.alibaba.excel.annotation.write.style.HeadRowHeight;
import com.alibaba.excel.annotation.write.style.HeadStyle;
import com.alibaba.excel.enums.poi.FillPatternTypeEnum;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
/**
* 政法能力历史得分-导出
*
* @author generator generator@elink-cn.com
*/
@HeadStyle(fillPatternType = FillPatternTypeEnum.SOLID_FOREGROUND, fillForegroundColor = 44)
@HeadRowHeight(40)
@Data
public class HistoryScoreDetailExcel implements Serializable {
private static final long serialVersionUID = -12110233388005838L;
@ExcelProperty(value = {"平阴县街道(镇)政法能力得分排行", "${title}", "下级单位"})
@ColumnWidth(15)
@HeadStyle(fillPatternType = FillPatternTypeEnum.SOLID_FOREGROUND, fillForegroundColor = 44)
private String agencyName;
@ExcelProperty(value = {"平阴县街道(镇)政法能力得分排行", "${title}", "网格活跃度"})
@ColumnWidth(15)
private BigDecimal wghyd;
@ExcelProperty(value = {"平阴县街道(镇)政法能力得分排行", "${title}", "事件赋值得分"})
@ColumnWidth(20)
private BigDecimal sjff;
@ExcelProperty(value = {"平阴县街道(镇)政法能力得分排行", "${title}", "雪亮工程"})
@ColumnWidth(15)
private BigDecimal xlgc;
@ExcelProperty(value = {"平阴县街道(镇)政法能力得分排行", "${title}", "日核周调"})
@ColumnWidth(15)
private BigDecimal rhzt;
@ExcelProperty(value = {"平阴县街道(镇)政法能力得分排行", "${title}", "亮点工作"})
@ColumnWidth(15)
private BigDecimal ldgz;
@ExcelProperty(value = {"平阴县街道(镇)政法能力得分排行", "${title}", "其他工作"})
@ColumnWidth(15)
private BigDecimal qtgz;
@ExcelProperty(value = {"平阴县街道(镇)政法能力得分排行", "${title}", "能力得分"})
@ColumnWidth(15)
private BigDecimal nldf;
}

15
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/ScreenPyGridStaffService.java

@ -0,0 +1,15 @@
package com.epmet.service.evaluationindex.indexcoll;
import com.epmet.dto.indexcollect.ScreenPyGridStaffDTO;
import java.util.List;
/**
* 平阴区网格员基础信息
*
* @author generator generator@elink-cn.com
*/
public interface ScreenPyGridStaffService {
void saveList(List<ScreenPyGridStaffDTO> dtoList);
}

18
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/ScreenPyHistoryScoreDetailService.java

@ -0,0 +1,18 @@
package com.epmet.service.evaluationindex.indexcoll;
import com.epmet.commons.tools.page.PageData;
import com.epmet.dto.indexcollect.form.HistoryScoreListFormDTO;
import com.epmet.dto.indexcollect.result.HistoryScoreDetailResultDTO;
import java.util.List;
/**
* 平阴历史得分明细表
*
* @author generator generator@elink-cn.com
*/
public interface ScreenPyHistoryScoreDetailService {
PageData<HistoryScoreDetailResultDTO> selectScoreDetailList(HistoryScoreListFormDTO formDTO);
}

30
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/ScreenPyHistoryScoreService.java

@ -0,0 +1,30 @@
package com.epmet.service.evaluationindex.indexcoll;
import com.epmet.commons.tools.page.PageData;
import com.epmet.dto.indexcollect.form.HistoryScoreComputeFormDTO;
import com.epmet.dto.indexcollect.form.HistoryScoreFormDTO;
import com.epmet.dto.indexcollect.form.HistoryScoreListFormDTO;
import com.epmet.dto.indexcollect.result.HistoryScoreComputeResultDTO;
import com.epmet.dto.indexcollect.result.HistoryScoreDetailResultDTO;
import com.epmet.dto.indexcollect.result.HistoryScoreListResultDTO;
import com.epmet.dto.result.IcMoveInListResultDTO;
/**
* 平阴历史得分主表
*
* @author generator generator@elink-cn.com
*/
public interface ScreenPyHistoryScoreService {
PageData<HistoryScoreListResultDTO> list(HistoryScoreListFormDTO formDTO);
void save(HistoryScoreFormDTO dto);
void update(HistoryScoreFormDTO dto);
void deleteById(HistoryScoreFormDTO dto);
HistoryScoreDetailResultDTO detail(HistoryScoreFormDTO formDTO);
HistoryScoreComputeResultDTO computeScore(HistoryScoreComputeFormDTO formDTO);
}

23
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/ScreenPyWeightConfigurationService.java

@ -0,0 +1,23 @@
package com.epmet.service.evaluationindex.indexcoll;
import com.epmet.commons.tools.page.PageData;
import com.epmet.dto.indexcollect.form.WeightConfigurationFormDTO;
import com.epmet.dto.indexcollect.form.WeightConfigurationListFormDTO;
import com.epmet.dto.indexcollect.result.WeightConfigurationListResultDTO;
/**
* 平阴政法能力权重配置
*
* @author generator generator@elink-cn.com
*/
public interface ScreenPyWeightConfigurationService {
PageData<WeightConfigurationListResultDTO> list(WeightConfigurationListFormDTO formDTO);
void save(WeightConfigurationFormDTO dto);
void update(WeightConfigurationFormDTO dto);
void deleteById(WeightConfigurationFormDTO dto);
}

53
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/ScreenPyGridStaffServiceImpl.java

@ -0,0 +1,53 @@
package com.epmet.service.evaluationindex.indexcoll.impl;
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
import com.epmet.commons.dynamic.datasource.annotation.DataSource;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.StrConstant;
import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult;
import com.epmet.commons.tools.exception.EpmetException;
import com.epmet.commons.tools.redis.common.CustomerStaffRedis;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.constant.DataSourceConstant;
import com.epmet.dao.evaluationindex.indexcoll.ScreenPyGridStaffDao;
import com.epmet.dto.indexcollect.ScreenPyGridStaffDTO;
import com.epmet.entity.evaluationindex.indexcoll.ScreenPyGridStaffEntity;
import com.epmet.service.evaluationindex.indexcoll.ScreenPyGridStaffService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 平阴区网格员基础信息
*
* @author generator generator@elink-cn.com
*/
@Slf4j
@Service
@DataSource(DataSourceConstant.EVALUATION_INDEX)
public class ScreenPyGridStaffServiceImpl extends BaseServiceImpl<ScreenPyGridStaffDao, ScreenPyGridStaffEntity> implements ScreenPyGridStaffService {
@Override
public void saveList(List<ScreenPyGridStaffDTO> dtoList) {
dtoList.forEach(d -> {
CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(StrConstant.PY_CUSTOMER, d.getStaffId());
if (null == staffInfo) {
throw new EpmetException(String.format("查询工作人员%s缓存信息失败...", d.getStaffId()));
}
ScreenPyGridStaffEntity entity = baseDao.selectStaff(d.getGridId(), d.getStaffId());
//存在就更新 不存在就新增
if (null != entity) {
ScreenPyGridStaffEntity entity1 = ConvertUtils.sourceToTarget(d, ScreenPyGridStaffEntity.class);
entity1.setId(entity.getId());
entity1.setPids(("".equals(staffInfo.getAgencyPIds()) ? staffInfo.getAgencyId() : staffInfo.getAgencyPIds() + ":") + staffInfo.getAgencyId());
baseDao.updateById(entity1);
} else {
ScreenPyGridStaffEntity saveEntity = ConvertUtils.sourceToTarget(d, ScreenPyGridStaffEntity.class);
saveEntity.setId(IdWorker.getIdStr());
saveEntity.setPids(("".equals(staffInfo.getAgencyPIds()) ? staffInfo.getAgencyId() : staffInfo.getAgencyPIds() + ":") + staffInfo.getAgencyId());
insert(saveEntity);
}
});
}
}

40
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/ScreenPyHistoryScoreDetailServiceImpl.java

@ -0,0 +1,40 @@
package com.epmet.service.evaluationindex.indexcoll.impl;
import com.epmet.commons.dynamic.datasource.annotation.DataSource;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.page.PageData;
import com.epmet.constant.DataSourceConstant;
import com.epmet.dao.evaluationindex.indexcoll.ScreenPyHistoryScoreDetailDao;
import com.epmet.dto.indexcollect.form.HistoryScoreListFormDTO;
import com.epmet.dto.indexcollect.result.HistoryScoreDetailResultDTO;
import com.epmet.dto.indexcollect.result.HistoryScoreListResultDTO;
import com.epmet.entity.evaluationindex.indexcoll.ScreenPyHistoryScoreDetailEntity;
import com.epmet.service.evaluationindex.indexcoll.ScreenPyHistoryScoreDetailService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 平阴历史得分明细表
*
* @author generator generator@elink-cn.com
*/
@Slf4j
@Service
@DataSource(DataSourceConstant.EVALUATION_INDEX)
public class ScreenPyHistoryScoreDetailServiceImpl extends BaseServiceImpl<ScreenPyHistoryScoreDetailDao, ScreenPyHistoryScoreDetailEntity> implements ScreenPyHistoryScoreDetailService {
@Override
public PageData<HistoryScoreDetailResultDTO> selectScoreDetailList(HistoryScoreListFormDTO formDTO) {
PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize(), formDTO.getIsPage());
List<HistoryScoreDetailResultDTO> list = baseDao.selectScoreDetailList(formDTO);
PageInfo<HistoryScoreDetailResultDTO> pageInfo = new PageInfo<>(list);
return new PageData<>(list, pageInfo.getTotal());
}
}

203
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/ScreenPyHistoryScoreServiceImpl.java

@ -0,0 +1,203 @@
package com.epmet.service.evaluationindex.indexcoll.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.epmet.commons.dynamic.datasource.annotation.DataSource;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.EpmetException;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.constant.DataSourceConstant;
import com.epmet.dao.evaluationindex.indexcoll.ScreenPyHistoryScoreDao;
import com.epmet.dao.evaluationindex.indexcoll.ScreenPyHistoryScoreDetailDao;
import com.epmet.dao.evaluationindex.indexcoll.ScreenPyWeightConfigurationDao;
import com.epmet.dataaggre.dto.govorg.form.GridLivelyFormDTO;
import com.epmet.dataaggre.dto.govorg.result.GridLivelyResultDTO;
import com.epmet.dataaggre.feign.DataAggregatorOpenFeignClient;
import com.epmet.dto.indexcollect.ScreenPyHistoryScoreDetailDTO;
import com.epmet.dto.indexcollect.ScreenPyWeightConfigurationDTO;
import com.epmet.dto.indexcollect.form.HistoryScoreComputeFormDTO;
import com.epmet.dto.indexcollect.form.HistoryScoreFormDTO;
import com.epmet.dto.indexcollect.form.HistoryScoreListFormDTO;
import com.epmet.dto.indexcollect.result.HistoryScoreComputeResultDTO;
import com.epmet.dto.indexcollect.result.HistoryScoreDetailResultDTO;
import com.epmet.dto.indexcollect.result.HistoryScoreListResultDTO;
import com.epmet.dto.indexcollect.result.HistoryScoreSjffResultDTO;
import com.epmet.dto.result.IcMoveInListResultDTO;
import com.epmet.entity.evaluationindex.indexcoll.ScreenPyHistoryScoreDetailEntity;
import com.epmet.entity.evaluationindex.indexcoll.ScreenPyHistoryScoreEntity;
import com.epmet.service.evaluationindex.indexcoll.ScreenPyHistoryScoreDetailService;
import com.epmet.service.evaluationindex.indexcoll.ScreenPyHistoryScoreService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.text.NumberFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
* 平阴历史得分主表
*
* @author generator generator@elink-cn.com
*/
@Slf4j
@Service
@DataSource(DataSourceConstant.EVALUATION_INDEX_READ)
public class ScreenPyHistoryScoreServiceImpl implements ScreenPyHistoryScoreService {
@Autowired
private ScreenPyHistoryScoreDao screenPyHistoryScoreDao;
@Autowired
private ScreenPyHistoryScoreDetailServiceImpl screenPyHistoryScoreDetailServiceImpl;
@Autowired
private ScreenPyHistoryScoreDetailDao screenPyHistoryScoreDetailDao;
@Autowired
private DataAggregatorOpenFeignClient dataAggregatorOpenFeignClient;
@Autowired
private ScreenPyWeightConfigurationDao screenPyWeightConfigurationDao;
@Override
public PageData<HistoryScoreListResultDTO> list(HistoryScoreListFormDTO formDTO) {
PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize(), formDTO.getIsPage());
List<HistoryScoreListResultDTO> list = screenPyHistoryScoreDao.selectHistoryScoreList(formDTO);
PageInfo<HistoryScoreListResultDTO> pageInfo = new PageInfo<>(list);
return new PageData<>(list, pageInfo.getTotal());
}
@Override
@Transactional(rollbackFor = Exception.class)
public void save(HistoryScoreFormDTO formDTO) {
//1.主表新增数据
ScreenPyHistoryScoreEntity entity = ConvertUtils.sourceToTarget(formDTO, ScreenPyHistoryScoreEntity.class);
entity.setReleaseTime(new Date());
screenPyHistoryScoreDao.insert(entity);
//2.明细表新增数据
ScreenPyWeightConfigurationDTO wcDTO = screenPyWeightConfigurationDao.selectOneDTO();
List<ScreenPyHistoryScoreDetailEntity> list = new ArrayList<>();
formDTO.getDetailList().forEach(dto -> {
ScreenPyHistoryScoreDetailEntity detailEntity = ConvertUtils.sourceToTarget(dto, ScreenPyHistoryScoreDetailEntity.class);
detailEntity.setCustomerId(formDTO.getCustomerId());
detailEntity.setHistoryScoreId(entity.getId());
if (null != wcDTO) {
BigDecimal nldf = detailEntity.getWghyd().multiply(wcDTO.getWghyd()).add(detailEntity.getWghyd().multiply(wcDTO.getWghyd()))
.add(detailEntity.getWghyd().multiply(wcDTO.getWghyd())).add(detailEntity.getWghyd().multiply(wcDTO.getWghyd()))
.add(detailEntity.getWghyd().multiply(wcDTO.getWghyd())).add(detailEntity.getWghyd().multiply(wcDTO.getWghyd()));
detailEntity.setNldf(nldf);
}
list.add(detailEntity);
});
screenPyHistoryScoreDetailServiceImpl.insertBatch(list);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(HistoryScoreFormDTO formDTO) {
ScreenPyHistoryScoreEntity entity = screenPyHistoryScoreDao.selectById(formDTO.getId());
if (entity == null) {
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "未查到相关信息", "未查到相关信息");
}
//1.更新主表
ScreenPyHistoryScoreEntity newEntity = ConvertUtils.sourceToTarget(formDTO, ScreenPyHistoryScoreEntity.class);
newEntity.setId(entity.getId());
screenPyHistoryScoreDao.updateById(newEntity);
//2.更新字表 字表先删后增
List<ScreenPyHistoryScoreDetailEntity> list = new ArrayList<>();
ScreenPyWeightConfigurationDTO wcDTO = screenPyWeightConfigurationDao.selectOneDTO();
formDTO.getDetailList().forEach(dto -> {
ScreenPyHistoryScoreDetailEntity detailEntity = ConvertUtils.sourceToTarget(dto, ScreenPyHistoryScoreDetailEntity.class);
detailEntity.setCustomerId(entity.getCustomerId());
detailEntity.setHistoryScoreId(entity.getId());
if (null != wcDTO) {
BigDecimal nldf = detailEntity.getWghyd().multiply(wcDTO.getWghyd()).add(detailEntity.getWghyd().multiply(wcDTO.getWghyd()))
.add(detailEntity.getWghyd().multiply(wcDTO.getWghyd())).add(detailEntity.getWghyd().multiply(wcDTO.getWghyd()))
.add(detailEntity.getWghyd().multiply(wcDTO.getWghyd())).add(detailEntity.getWghyd().multiply(wcDTO.getWghyd()));
detailEntity.setNldf(nldf);
}
list.add(detailEntity);
});
screenPyHistoryScoreDetailDao.delByHistoryScoreId(formDTO.getId(), formDTO.getUserId());
screenPyHistoryScoreDetailServiceImpl.insertBatch(list);
}
@Override
public void deleteById(HistoryScoreFormDTO formDTO) {
ScreenPyHistoryScoreEntity entity = screenPyHistoryScoreDao.selectById(formDTO.getId());
if (entity == null) {
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "未查到相关信息", "未查到相关信息");
}
entity.setDelFlag("1");
screenPyHistoryScoreDao.updateById(entity);
screenPyHistoryScoreDetailDao.delByHistoryScoreId(formDTO.getId(), formDTO.getUserId());
}
@Override
public HistoryScoreDetailResultDTO detail(HistoryScoreFormDTO formDTO) {
HistoryScoreDetailResultDTO resultDTO = new HistoryScoreDetailResultDTO();
//1.主表数据
ScreenPyHistoryScoreEntity entity = screenPyHistoryScoreDao.selectById(formDTO.getId());
if (entity == null) {
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "未查到相关信息", "未查到相关信息");
}
resultDTO = ConvertUtils.sourceToTarget(entity, HistoryScoreDetailResultDTO.class);
//2.字表数据
LambdaQueryWrapper<ScreenPyHistoryScoreDetailEntity> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(ScreenPyHistoryScoreDetailEntity::getHistoryScoreId, formDTO.getId());
wrapper.eq(ScreenPyHistoryScoreDetailEntity::getDelFlag, "0");
wrapper.orderByDesc(ScreenPyHistoryScoreDetailEntity::getNldf);
List<ScreenPyHistoryScoreDetailEntity> list = screenPyHistoryScoreDetailDao.selectList(wrapper);
List<HistoryScoreDetailResultDTO.Detail> detailList = ConvertUtils.sourceToTarget(list, HistoryScoreDetailResultDTO.Detail.class);
resultDTO.setDetailList(detailList);
return resultDTO;
}
@Override
public HistoryScoreComputeResultDTO computeScore(HistoryScoreComputeFormDTO formDTO) {
HistoryScoreComputeResultDTO resultDTO = new HistoryScoreComputeResultDTO();
resultDTO.setAgencyId(formDTO.getAgencyId());
//计算百分比使用,保留小数点后两位
NumberFormat numberFormat = NumberFormat.getInstance();
numberFormat.setMaximumFractionDigits(NumConstant.TWO);
if ("grid".equals(formDTO.getType())) {
/**
* 网格活跃度每周得分=活跃网格数/本街镇网格数x100+(正常网格数/本街镇网格数)x80
* 1周内每个末级网格有五天及五天以上上传事件或开展例行工作的为活跃网格有2天及2天以上5天以下上传事件或开展例行工作的为正常运行网格只有1天上传事件或开展例行工作的为僵尸网格
* 本街镇网格数基于本街镇基础网格总数进行计算不包含专属网格
*/
//1.获取街道下时间区间内的网格活跃度数据
GridLivelyFormDTO form = ConvertUtils.sourceToTarget(formDTO, GridLivelyFormDTO.class);
form.setType("historyScore");
Result<List<GridLivelyResultDTO>> result = dataAggregatorOpenFeignClient.grdiLively(form);
if (!result.success() || result.getData() == null) {
throw new RenException("统计街道下网格活跃度数据失败");
}
GridLivelyResultDTO gridLively = result.getData().get(NumConstant.ZERO);
String score = (gridLively.getGridSumNum() <= 0) ? "0" : numberFormat.format(((float) gridLively.getGridLivelyNum() / (float) gridLively.getGridSumNum()) * 100 + (gridLively.getGridOrdinaryNum() / gridLively.getGridSumNum()) * 80);
resultDTO.setScore(score);
} else if ("event".equals(formDTO.getType())) {
/**
* 事件赋分= 街道下末级网格上报事件数量乘以对应的每项事件分值的累加和除以街道下有效未离职状态的网格员总数
* 加上街道下末级网格例行工作数量乘以对应的每项事件分值的累加和除以街道下有效未离职状态的网格员总数
*/
//查询街道下时间区间内事件总分
HistoryScoreSjffResultDTO dto1 = screenPyHistoryScoreDao.sumEventScore(formDTO);
//查询街道下时间区间内例行工作总分
HistoryScoreSjffResultDTO dto2 = screenPyHistoryScoreDao.sumProjectScore(formDTO);
//查询街道下有效网格员数
HistoryScoreSjffResultDTO dto3 = screenPyHistoryScoreDao.sumGridNum(formDTO);
String score = numberFormat.format(((float) dto1.getEventScore() / (float) dto3.getGridStaffNum()) + (dto2.getProjectScore() / dto3.getGridStaffNum()));
resultDTO.setScore(score);
}
return resultDTO;
}
}

74
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/ScreenPyWeightConfigurationServiceImpl.java

@ -0,0 +1,74 @@
package com.epmet.service.evaluationindex.indexcoll.impl;
import com.epmet.commons.dynamic.datasource.annotation.DataSource;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
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.utils.ConvertUtils;
import com.epmet.constant.DataSourceConstant;
import com.epmet.dao.evaluationindex.indexcoll.ScreenPyWeightConfigurationDao;
import com.epmet.dto.indexcollect.form.WeightConfigurationFormDTO;
import com.epmet.dto.indexcollect.form.WeightConfigurationListFormDTO;
import com.epmet.dto.indexcollect.result.WeightConfigurationListResultDTO;
import com.epmet.entity.evaluationindex.indexcoll.ScreenPyWeightConfigurationEntity;
import com.epmet.service.evaluationindex.indexcoll.ScreenPyWeightConfigurationService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
/**
* 平阴政法能力权重配置
*
* @author generator generator@elink-cn.com
*/
@Slf4j
@Service
@DataSource(DataSourceConstant.EVALUATION_INDEX)
public class ScreenPyWeightConfigurationServiceImpl extends BaseServiceImpl<ScreenPyWeightConfigurationDao, ScreenPyWeightConfigurationEntity> implements ScreenPyWeightConfigurationService {
@Override
public PageData<WeightConfigurationListResultDTO> list(WeightConfigurationListFormDTO formDTO) {
PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize(), formDTO.getIsPage());
List<WeightConfigurationListResultDTO> list = baseDao.selectWeightConfigurationList(formDTO);
PageInfo<WeightConfigurationListResultDTO> pageInfo = new PageInfo<>(list);
return new PageData<>(list, pageInfo.getTotal());
}
@Override
@Transactional(rollbackFor = Exception.class)
public void save(WeightConfigurationFormDTO formDTO) {
//1.主表新增数据
ScreenPyWeightConfigurationEntity entity = ConvertUtils.sourceToTarget(formDTO, ScreenPyWeightConfigurationEntity.class);
insert(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(WeightConfigurationFormDTO formDTO) {
ScreenPyWeightConfigurationEntity entity = baseDao.selectById(formDTO.getId());
if (entity == null) {
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "未查到相关信息", "未查到相关信息");
}
ScreenPyWeightConfigurationEntity newEntity = ConvertUtils.sourceToTarget(formDTO, ScreenPyWeightConfigurationEntity.class);
newEntity.setId(entity.getId());
baseDao.updateById(newEntity);
}
@Override
public void deleteById(WeightConfigurationFormDTO formDTO) {
ScreenPyWeightConfigurationEntity entity = baseDao.selectById(formDTO.getId());
if (entity == null) {
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "未查到相关信息", "未查到相关信息");
}
entity.setDelFlag("1");
baseDao.updateById(entity);
}
}

24
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenPyEventDataService.java

@ -0,0 +1,24 @@
package com.epmet.service.evaluationindex.screen;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.dto.screen.form.SavePyEventDataFormDTO;
import com.epmet.entity.evaluationindex.screen.ScreenPyEventDataEntity;
/**
* 上报到市平台中间库的事件
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2022-12-08
*/
public interface ScreenPyEventDataService extends BaseService<ScreenPyEventDataEntity> {
/**
* 保存同步到中间库的数据
*
* @Param formDTO
* @Return
* @Author zhaoqifeng
* @Date 2022/12/8 11:14
*/
void saveData(SavePyEventDataFormDTO formDTO);
}

95
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenPyEventDataServiceImpl.java

@ -0,0 +1,95 @@
package com.epmet.service.evaluationindex.screen.impl;
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;
/**
* 上报到市平台中间库的事件
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2022-12-08
*/
@Slf4j
@Service
@DataSource(DataSourceConstant.EVALUATION_INDEX)
public class ScreenPyEventDataServiceImpl extends BaseServiceImpl<ScreenPyEventDataDao, ScreenPyEventDataEntity> implements ScreenPyEventDataService {
@Resource
private ScreenProjectDataDao screenProjectDataDao;
/**
* 保存同步到中间库的数据
*
* @param formDTO
* @Param formDTO
* @Return
* @Author zhaoqifeng
* @Date 2022/12/8 11:14
*/
@Override
public void saveData(SavePyEventDataFormDTO formDTO) {
if (CollectionUtils.isNotEmpty(formDTO.getProjectList())) {
formDTO.getProjectList().forEach(item -> {
ScreenPyEventDataEntity entity = new ScreenPyEventDataEntity();
entity.setEventId(item.getEventCode().replace("py_", ""));
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());
ScreenPyEventDataEntity event = baseDao.selectOne(wrapper);
if (null == event) {
baseDao.insert(entity);
} else {
entity.setId(event.getId());
baseDao.updateById(entity);
}
});
}
if (CollectionUtils.isNotEmpty(formDTO.getWorkList())) {
formDTO.getWorkList().forEach(item -> {
ScreenPyEventDataEntity entity = new ScreenPyEventDataEntity();
entity.setEventId(item.getId());
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());
ScreenPyEventDataEntity event = baseDao.selectOne(wrapper);
if (null == event) {
baseDao.insert(entity);
} else {
entity.setId(event.getId());
baseDao.updateById(entity);
}
});
}
}
}

18
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcoll/ScreenPyGridStaffDao.xml

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.epmet.dao.evaluationindex.indexcoll.ScreenPyGridStaffDao">
<select id="selectStaff" resultType="com.epmet.entity.evaluationindex.indexcoll.ScreenPyGridStaffEntity">
SELECT
*
FROM
screen_py_grid_staff
WHERE
del_flag = '0'
AND staff_id = #{staffId}
AND grid_id = #{gridId}
LIMIT 1
</select>
</mapper>

73
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcoll/ScreenPyHistoryScoreDao.xml

@ -0,0 +1,73 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.epmet.dao.evaluationindex.indexcoll.ScreenPyHistoryScoreDao">
<select id="selectHistoryScoreList" resultType="com.epmet.dto.indexcollect.result.HistoryScoreListResultDTO">
SELECT
a.id,
a.title,
CONCAT(DATE_FORMAT(a.start_time,'%Y年%m月%d日'),'-',DATE_FORMAT(a.end_time,'%Y年%m月%d日')) `time`,
DATE_FORMAT(a.release_time,'%Y-%m-%d %H:%i') releaseTime,
a.updated_by updatedById,
b.real_name updatedBy
FROM
screen_py_history_score a
LEFT JOIN epmet_user.customer_staff b ON a.customer_id = b.customer_id AND a.updated_by = b.user_id
WHERE
a.del_flag = '0'
<if test="title != null and title != ''">
AND a.title LIKE concat('%', #{title}, '%')
</if>
<if test="startTime != null and startTime.trim() != ''">
AND DATE_FORMAT(a.start_time,'%Y-%m-%d') >= #{startTime}
</if>
<if test="endTime != null and endTime.trim() != ''">
<![CDATA[AND DATE_FORMAT(a.end_time,'%Y-%m-%d') <= #{endTime}]]>
</if>
ORDER BY a.start_time DESC
</select>
<select id="sumEventScore" resultType="com.epmet.dto.indexcollect.result.HistoryScoreSjffResultDTO">
SELECT
SUM(b.score) eventScore
FROM
screen_py_event_data a
LEFT JOIN customer_patrol_work_type_dict b ON b.is_disable = 'enable'
AND a.category_code = b.category_code
WHERE
a.event_type = 'work'
AND PIDS LIKE CONCAT('%', #{agencyId}, '%'))
AND DATE_FORMAT(a.event_create_time, "%Y-%m-%d") >= #{startTime}
AND DATE_FORMAT(a.event_create_time, "%Y-%m-%d") <![CDATA[ <= ]]> #{endTime}
</select>
<select id="sumProjectScore" resultType="com.epmet.dto.indexcollect.result.HistoryScoreSjffResultDTO">
SELECT
SUM(b.score) projectScore
FROM
screen_py_event_data a
LEFT JOIN customer_project_category_dict b ON b.CUSTOMER_ID = #{customerId}
AND b.is_disable = 'enable'
AND a.category_code = b.category_code
WHERE
a.event_type = 'project'
AND PIDS LIKE CONCAT('%', #{agencyId}, '%')
AND DATE_FORMAT(a.event_create_time, "%Y-%m-%d") >= #{startTime}
AND DATE_FORMAT(a.event_create_time, "%Y-%m-%d") <![CDATA[ <= ]]> #{endTime}
</select>
<select id="sumGridNum" resultType="com.epmet.dto.indexcollect.result.HistoryScoreSjffResultDTO">
SELECT
COUNT(id) gridStaffNum
FROM
screen_py_grid_staff
WHERE
del_flag = '0'
AND is_leave = 'N'
AND pids LIKE CONCAT('%', #{agencyId}, '%')
</select>
</mapper>

65
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcoll/ScreenPyHistoryScoreDetailDao.xml

@ -0,0 +1,65 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.epmet.dao.evaluationindex.indexcoll.ScreenPyHistoryScoreDetailDao">
<update id="delByHistoryScoreId" parameterType="java.lang.String">
UPDATE
screen_py_history_score_detail
SET
updated_by = #{userId},
updated_time = NOW(),
del_flag = '1'
WHERE
history_score_id = #{historyScoreId}
AND del_flag = '0'
</update>
<resultMap id="selectCommunitySelfOrganizationListMap" type="com.epmet.dto.indexcollect.result.HistoryScoreDetailResultDTO">
<result property="id" column="id"/>
<result property="title" column="title"/>
<result property="time" column="time"/>
<collection property="detailList" ofType="com.epmet.dto.indexcollect.result.HistoryScoreDetailResultDTO$Detail"
column="id" select="selectPerson"></collection>
</resultMap>
<select id="selectScoreDetailList" resultMap="selectCommunitySelfOrganizationListMap" parameterType="com.epmet.dto.indexcollect.form.HistoryScoreListFormDTO">
SELECT
id AS id,
title AS title,
CONCAT(DATE_FORMAT(start_time,'%Y年%m月%d日'), '-', DATE_FORMAT(end_time, '%Y年%m月%d日')) `time`
FROM screen_py_history_score
WHERE
del_flag = 0
<if test="title != null and title != ''">
AND title LIKE concat('%', #{title}, '%')
</if>
<if test="startTime != null and startTime.trim() != ''">
AND DATE_FORMAT(start_time,'%Y-%m-%d') >= #{startTime}
</if>
<if test="endTime != null and endTime.trim() != ''">
<![CDATA[AND DATE_FORMAT(end_time,'%Y-%m-%d') <= #{endTime}]]>
</if>
ORDER BY start_time DESC
</select>
<select id="selectPerson" resultType="com.epmet.dto.indexcollect.result.HistoryScoreDetailResultDTO$Detail">
SELECT
id,
history_score_id,
agency_id,
agency_name,
FORMAT(wghyd, 2)wghyd,
FORMAT(sjff, 2)sjff,
FORMAT(xlgc, 2)xlgc,
FORMAT(rhzt, 2)rhzt,
FORMAT(ldgz, 2)ldgz,
FORMAT(qtgz, 2)qtgz,
FORMAT(nldf, 2)nldf
FROM
screen_py_history_score_detail
WHERE
del_flag = '0'
AND history_score_id = #{id}
ORDER BY nldf DESC
</select>
</mapper>

43
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcoll/ScreenPyWeightConfigurationDao.xml

@ -0,0 +1,43 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.epmet.dao.evaluationindex.indexcoll.ScreenPyWeightConfigurationDao">
<select id="selectWeightConfigurationList" resultType="com.epmet.dto.indexcollect.result.WeightConfigurationListResultDTO">
SELECT
id,
customer_id,
FORMAT(wghyd, 2)wghyd,
FORMAT(sjff, 2)sjff,
FORMAT(xlgc, 2)xlgc,
FORMAT(rhzt, 2)rhzt,
FORMAT(ldgz, 2)ldgz,
FORMAT(qtgz, 2)qtgz
FROM
screen_py_weight_configuration
WHERE
del_flag = '0'
ORDER BY
updated_time DESC
</select>
<select id="selectOneDTO" resultType="com.epmet.dto.indexcollect.ScreenPyWeightConfigurationDTO">
SELECT
id,
customer_id,
wghyd,
sjff,
xlgc,
rhzt,
ldgz,
qtgz
FROM
screen_py_weight_configuration
WHERE
del_flag = '0'
ORDER BY
updated_time DESC
LIMIT 1
</select>
</mapper>

7
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenPyEventDataDao.xml

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.epmet.dao.evaluationindex.screen.ScreenPyEventDataDao">
</mapper>

13
epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/controller/EventreportPingyinController.java

@ -36,4 +36,17 @@ public class EventreportPingyinController {
return new Result();
}
/**
* 将数据同步到平阴库
* @Param formDTO
* @Return {@link Result}
* @Author zhaoqifeng
* @Date 2022/12/9 14:15
*/
@PostMapping("saveData")
public Result saveData(@RequestBody(required = false) EventInfoFormDTO formDTO) {
eventreportPingyinService.saveData(formDTO);
return new Result();
}
}

34
epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/controller/GridstaffWorkInfoPingyinController.java

@ -1,20 +1,14 @@
package com.epmet.opendata.controller;
import com.epmet.commons.tools.aop.NoRepeatSubmit;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ExcelUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.AssertUtils;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.commons.tools.validator.group.AddGroup;
import com.epmet.commons.tools.validator.group.UpdateGroup;
import com.epmet.commons.tools.validator.group.DefaultGroup;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.epmet.dto.basereport.form.EventInfoFormDTO;
import com.epmet.opendata.service.GridstaffWorkInfoPingyinService;
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.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
/**
@ -27,6 +21,20 @@ import java.util.Map;
@RequestMapping("gridstaffWorkInfoPingyin")
public class GridstaffWorkInfoPingyinController {
@Resource
private GridstaffWorkInfoPingyinService gridstaffWorkInfoPingyinService;
/**
* 将数据同步到平阴库
* @Param formDTO
* @Return {@link Result}
* @Author zhaoqifeng
* @Date 2022/12/9 14:15
*/
@PostMapping("saveData")
public Result saveData(@RequestBody(required = false) EventInfoFormDTO formDTO) {
gridstaffWorkInfoPingyinService.saveData(formDTO);
return new Result();
}
}

9
epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/EventreportPingyinService.java

@ -20,4 +20,13 @@ public interface EventreportPingyinService extends BaseService<EventreportPingyi
* @Date 2021/10/15 16:59
*/
void getEventInfo(EventInfoFormDTO formDTO);
/**
* 将数据同步到平阴库
* @Param formDTO
* @Return
* @Author zhaoqifeng
* @Date 2022/12/9 14:16
*/
void saveData(EventInfoFormDTO formDTO);
}

10
epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/GridstaffWorkInfoPingyinService.java

@ -1,6 +1,7 @@
package com.epmet.opendata.service;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.dto.basereport.form.EventInfoFormDTO;
import com.epmet.opendata.dto.form.UpsertPatrolRecordForm;
import com.epmet.opendata.entity.GridstaffWorkInfoPingyinEntity;
@ -19,4 +20,13 @@ public interface GridstaffWorkInfoPingyinService extends BaseService<GridstaffWo
*/
Boolean insertBaseGridWorkRecordV2(UpsertPatrolRecordForm formDTO);
/**
* 将数据同步到平阴库
* @Param formDTO
* @Return
* @Author zhaoqifeng
* @Date 2022/12/9 14:16
*/
void saveData(EventInfoFormDTO formDTO);
}

38
epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/EventreportPingyinServiceImpl.java

@ -4,10 +4,13 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.utils.StrUtil;
import com.epmet.dto.basereport.form.EventInfoFormDTO;
import com.epmet.dto.basereport.result.EventInfoResultDTO;
import com.epmet.dto.screen.EventreportPingyinDTO;
import com.epmet.dto.screen.form.SavePyEventDataFormDTO;
import com.epmet.feign.DataStatisticalOpenFeignClient;
import com.epmet.opendata.dao.EventreportPingyinDao;
import com.epmet.opendata.dao.GridstaffInfoPingyinDao;
@ -16,6 +19,7 @@ import com.epmet.opendata.entity.GridstaffInfoPingyinEntity;
import com.epmet.opendata.service.EventreportPingyinService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.ListUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -63,13 +67,47 @@ public class EventreportPingyinServiceImpl extends BaseServiceImpl<EventreportPi
}
List<EventInfoResultDTO> list = result.getData();
saveEvent(list, formDTO.getInitFlag());
//将同步的数据保存
SavePyEventDataFormDTO savePyEventData = new SavePyEventDataFormDTO();
savePyEventData.setProjectList(ConvertUtils.sourceToTarget(list, EventreportPingyinDTO.class));
dataStatisticalOpenFeignClient.saveData(savePyEventData);
//分批次循环
while (CollectionUtils.isNotEmpty(list) && list.size() == formDTO.getPageSize()) {
formDTO.setPageNo(formDTO.getPageNo() + NumConstant.ONE);
result = dataStatisticalOpenFeignClient.getEventInfoV2(formDTO);
list = result.getData();
saveEvent(list, formDTO.getInitFlag());
//将同步的数据保存
savePyEventData = new SavePyEventDataFormDTO();
savePyEventData.setProjectList(ConvertUtils.sourceToTarget(list, EventreportPingyinDTO.class));
dataStatisticalOpenFeignClient.saveData(savePyEventData);
}
}
/**
* 将数据同步到平阴库
*
* @param formDTO
* @Param formDTO
* @Return
* @Author zhaoqifeng
* @Date 2022/12/9 14:16
*/
@Override
public void saveData(EventInfoFormDTO formDTO) {
LambdaQueryWrapper<EventreportPingyinEntity> wrapper = new LambdaQueryWrapper<>();
wrapper.ge(EventreportPingyinEntity::getReportTime, formDTO.getStartTime());
wrapper.le(EventreportPingyinEntity::getReportTime, formDTO.getEndTime());
List<EventreportPingyinEntity> list = baseDao.selectList(wrapper);
List<List<EventreportPingyinEntity>> partition = ListUtils.partition(list, NumConstant.ONE_THOUSAND);
partition.forEach(part -> {
//将同步的数据保存
SavePyEventDataFormDTO savePyEventData = new SavePyEventDataFormDTO();
savePyEventData.setProjectList(ConvertUtils.sourceToTarget(part, EventreportPingyinDTO.class));
dataStatisticalOpenFeignClient.saveData(savePyEventData);
});
}
private void saveEvent(List<EventInfoResultDTO> list, String initFlag) {

19
epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/GridstaffInfoPingyinServiceImpl.java

@ -7,6 +7,7 @@ import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.form.CustomerGridStaffListFormDTO;
import com.epmet.dto.form.GridStaffUploadtFormDTO;
import com.epmet.dto.indexcollect.ScreenPyGridStaffDTO;
import com.epmet.dto.result.CustomerGridStaffListResultDTO;
import com.epmet.dto.result.GridStaffUploadResultDTO;
import com.epmet.dto.user.result.GridUserInfoDTO;
@ -119,6 +120,7 @@ public class GridstaffInfoPingyinServiceImpl extends BaseServiceImpl<GridstaffIn
}
//2.中间库新增/修改数据【基本一个人一条数据,程序按批量处理】
List<ScreenPyGridStaffDTO> staffList = new ArrayList<>();
result.getData().forEach(r -> {
GridstaffInfoPingyinEntity entity = ConvertUtils.sourceToTarget(r, GridstaffInfoPingyinEntity.class);
entity.setQxBm("370124");
@ -142,7 +144,24 @@ public class GridstaffInfoPingyinServiceImpl extends BaseServiceImpl<GridstaffIn
} else {
insert(entity);
}
ScreenPyGridStaffDTO dto = ConvertUtils.sourceToTarget(entity, ScreenPyGridStaffDTO.class);
dto.setCustomerId(r.getCustomerId());
dto.setGridId(r.getGridId());
dto.setGridCode(r.getCode());
dto.setGridName(r.getGridName());
dto.setStaffId(r.getStaffId());
dto.setStaffName(r.getNickName());
dto.setMobile(r.getPhonenumber());
dto.setIsLeave(r.getIsLeave());
staffList.add(dto);
});
if(CollectionUtils.isNotEmpty(staffList)){
try{
dataStatisticalOpenFeignClient.saveList(staffList);
} catch (Exception e) {
log.error("method exception", e);
}
}
}

86
epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/GridstaffWorkInfoPingyinServiceImpl.java

@ -13,24 +13,30 @@ import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.utils.StrUtil;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.commons.tools.validator.group.AddGroup;
import com.epmet.dto.basereport.form.EventInfoFormDTO;
import com.epmet.dto.form.patrol.PatrolQueryFormDTO;
import com.epmet.dto.result.PatrolRoutineWorkResult;
import com.epmet.dto.screen.GridstaffWorkInfoPingyinDTO;
import com.epmet.dto.screen.form.SavePyEventDataFormDTO;
import com.epmet.feign.DataStatisticalOpenFeignClient;
import com.epmet.feign.EpmetUserOpenFeignClient;
import com.epmet.opendata.dao.GridstaffWorkInfoPingyinDao;
import com.epmet.opendata.dto.form.UpsertPatrolRecordForm;
import com.epmet.opendata.entity.GridstaffWorkInfoPingyinEntity;
import com.epmet.opendata.service.GridstaffWorkInfoPingyinService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.ListUtils;
import org.apache.commons.lang3.StringUtils;
import org.jetbrains.annotations.NotNull;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
/**
* 平阴区网格员例行工作信息
@ -44,6 +50,8 @@ public class GridstaffWorkInfoPingyinServiceImpl extends BaseServiceImpl<Gridsta
@Autowired
private EpmetUserOpenFeignClient epmetUserOpenFeignClient;
@Resource
private DataStatisticalOpenFeignClient dataStatisticalOpenFeignClient;
@Override
public Boolean insertBaseGridWorkRecordV2(UpsertPatrolRecordForm patrolRecordForm) {
@ -93,6 +101,67 @@ public class GridstaffWorkInfoPingyinServiceImpl extends BaseServiceImpl<Gridsta
return true;
}
/**
* 将数据同步到平阴库
*
* @param formDTO
* @Param formDTO
* @Return
* @Author zhaoqifeng
* @Date 2022/12/9 14:16
*/
@Override
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;
do {
Result<List<PatrolRoutineWorkResult>> record = epmetUserOpenFeignClient.getPatrolRoutineWorkListV2(midPatrolFormDTO);
if (record == null || !record.success()) {
log.warn("获取例行工作记录V2失败,param:{}", JSON.toJSONString(midPatrolFormDTO));
throw new EpmetException(EpmetErrorCode.SERVER_ERROR.getCode());
}
data = record.getData();
if (CollectionUtils.isNotEmpty(record.getData())) {
List<PatrolRoutineWorkResult> newList = new ArrayList<>();
data.forEach(item -> {
if (StringUtils.isBlank(item.getGridId())){
return;
}
GridInfoCache gridInfo = CustomerOrgRedis.getGridInfo(item.getGridId());
if (null == gridInfo) {
return;
}
item.setGridCode(gridInfo.getCode());
if (StringUtils.isNotBlank(item.getGridCode())) {
newList.add(item);
}
});
List<GridstaffWorkInfoPingyinDTO> list = newList.stream().map(item -> {
GridstaffWorkInfoPingyinDTO dto = new GridstaffWorkInfoPingyinDTO();
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());
//将同步的数据保存
SavePyEventDataFormDTO savePyEventData = new SavePyEventDataFormDTO();
savePyEventData.setWorkList(list);
dataStatisticalOpenFeignClient.saveData(savePyEventData);
}
midPatrolFormDTO.setPageNo(midPatrolFormDTO.getPageNo() + 1);
} while (data.size() == NumConstant.ONE_THOUSAND);
}
/**
* Desc: 数据存入
*
@ -112,11 +181,22 @@ public class GridstaffWorkInfoPingyinServiceImpl extends BaseServiceImpl<Gridsta
private Boolean insertNewRecordBatch(List<PatrolRoutineWorkResult> list) {
List<GridstaffWorkInfoPingyinEntity> insertList = new ArrayList<>();
List<GridstaffWorkInfoPingyinDTO> newList = new ArrayList<>();
list.forEach(o -> {
if (StringUtils.isBlank(o.getGridCode())) {
return;
}
insertList.add(buildNewEntity(o));
GridstaffWorkInfoPingyinDTO dto = new GridstaffWorkInfoPingyinDTO();
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
if (CollectionUtils.isEmpty(insertList)) {
@ -124,6 +204,10 @@ public class GridstaffWorkInfoPingyinServiceImpl extends BaseServiceImpl<Gridsta
return false;
}
insertGridStaffWorkInfoPY(insertList);
//将同步的数据保存
SavePyEventDataFormDTO savePyEventData = new SavePyEventDataFormDTO();
savePyEventData.setWorkList(newList);
dataStatisticalOpenFeignClient.saveData(savePyEventData);
return true;
}

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