Browse Source

Merge remote-tracking branch 'origin/dev_screen_data' into dev_screen_data

dev_shibei_match
wangchao 5 years ago
parent
commit
2169d5c876
  1. 10
      epmet-commons/epmet-commons-dynamic-datasource/src/main/java/com/epmet/commons/dynamic/datasource/annotation/DataSource.java
  2. 42
      epmet-commons/epmet-commons-dynamic-datasource/src/main/java/com/epmet/commons/dynamic/datasource/aspect/DataSourceAspect.java
  3. 12
      epmet-commons/epmet-commons-dynamic-datasource/src/main/java/com/epmet/commons/dynamic/datasource/bean/DataSourceParam.java
  4. 2
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java
  5. 81
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/UniqueIdGenerator.java
  6. 4
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/screen/constant/ScreenConstant.java
  7. 2
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/screen/dto/form/SubAgencyIndexRankFormDTO.java
  8. 9
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/screen/dto/result/CompartmentResultDTO.java
  9. 52
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/screen/dto/result/FineExampleResultDTO.java
  10. 3
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/screen/dto/result/ParymemberResultDTO.java
  11. 3
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/screen/dto/result/ProjectDetailResultDTO.java
  12. 7
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/screen/dto/result/TreeResultDTO.java
  13. 9
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/screen/dto/result/UserResultDTO.java
  14. 2
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/screen/ScreenCustomerGridDao.java
  15. 2
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/screen/ScreenDifficultyDataDao.java
  16. 12
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/screen/ScreenPioneerDataDao.java
  17. 2
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/screen/ScreenUserTotalDataDao.java
  18. 2
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/screen/impl/AgencyServiceImpl.java
  19. 11
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/screen/impl/IndexServiceImpl.java
  20. 48
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/screen/impl/PartyMemberLeadServiceImpl.java
  21. 4
      epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenIndexDataMonthlyDao.xml
  22. 20
      epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenPioneerDataDao.xml
  23. 12
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcollect/form/GridGovrnAbilityFormDTO.java
  24. 9
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcollect/form/GridPartyMemberDataFormDTO.java
  25. 2
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcollect/form/OrgServiceAbilityFormDTO.java
  26. 97
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/IndexDictDTO.java
  27. 92
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/IndexGroupDTO.java
  28. 92
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/IndexGroupDetailDTO.java
  29. 92
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/IndexGroupDetailTemplateDTO.java
  30. 31
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/form/PioneerDataFormDTO.java
  31. 19
      epmet-module/data-statistical/data-statistical-server/pom.xml
  32. 68
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/IndexDictController.java
  33. 14
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/indexcoll/FactIndexGovrnAblityDeptMonthlyDao.java
  34. 13
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/indexcoll/FactIndexGovrnAblityGridMonthlyDao.java
  35. 18
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/indexcoll/FactIndexPartyAblityCpcMonthlyDao.java
  36. 13
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/indexcoll/FactIndexPartyAblityGridMonthlyDao.java
  37. 13
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/indexcoll/FactIndexServiceAblityGridMonthlyDao.java
  38. 34
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/screen/IndexDictDao.java
  39. 33
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/screen/IndexGroupDao.java
  40. 33
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/screen/IndexGroupDetailDao.java
  41. 35
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/screen/IndexGroupDetailTemplateDao.java
  42. 34
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/screen/IndexGroupTemplateDao.java
  43. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/screen/ScreenCustomerGridDao.java
  44. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/screen/ScreenDifficultyDataDao.java
  45. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/screen/ScreenUserTotalDataDao.java
  46. 4
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/indexcoll/FactIndexGovrnAblityOrgMonthlyEntity.java
  47. 4
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/indexcoll/FactIndexPartyAblityOrgMonthlyEntity.java
  48. 4
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/indexcoll/FactIndexServiceAblityOrgMonthlyEntity.java
  49. 53
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/IndexDictEntity.java
  50. 60
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/IndexGroupDetailEntity.java
  51. 65
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/IndexGroupDetailTemplateEntity.java
  52. 58
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/IndexGroupEntity.java
  53. 53
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/IndexGroupTemplateEntity.java
  54. 19
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/ScreenCpcBaseDataEntity.java
  55. 10
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/ScreenCustomerAgencyEntity.java
  56. 7
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/ScreenCustomerDeptEntity.java
  57. 9
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/ScreenCustomerGridEntity.java
  58. 20
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/ScreenDifficultyDataEntity.java
  59. 26
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/ScreenEventDataEntity.java
  60. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/ScreenEventImgDataEntity.java
  61. 4
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/ScreenGovernRankDataEntity.java
  62. 8
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/ScreenIndexDataMonthlyEntity.java
  63. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/ScreenIndexDataYearlyEntity.java
  64. 4
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/ScreenOrgRankDataEntity.java
  65. 15
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/ScreenPartyBranchDataEntity.java
  66. 9
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/ScreenPartyLinkMassesDataEntity.java
  67. 41
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/ScreenPartyUserRankDataEntity.java
  68. 43
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/ScreenPioneerDataEntity.java
  69. 67
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/ScreenUserJoinEntity.java
  70. 23
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/ScreenUserTotalDataEntity.java
  71. 272
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/model/IndexExcelDataListener.java
  72. 26
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/model/IndexModel.java
  73. 54
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/model/ParseIndexExcelResult.java
  74. 20
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/indexcollect/impl/FactIndexCollectServiceImpl.java
  75. 34
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/screen/IndexDictService.java
  76. 31
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/screen/IndexGroupDetailService.java
  77. 34
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/screen/IndexGroupDetailTemplateService.java
  78. 31
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/screen/IndexGroupService.java
  79. 34
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/screen/IndexGroupTemplateService.java
  80. 43
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/screen/impl/IndexDictServiceImpl.java
  81. 36
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/screen/impl/IndexGroupDetailServiceImpl.java
  82. 42
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/screen/impl/IndexGroupDetailTemplateServiceImpl.java
  83. 35
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/screen/impl/IndexGroupServiceImpl.java
  84. 43
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/screen/impl/IndexGroupTemplateServiceImpl.java
  85. 17
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/util/ExcelListener.java
  86. 35
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/util/TestFileUtil.java
  87. 3
      epmet-module/data-statistical/data-statistical-server/src/main/resources/db/migration/V0.0.3__update_col_data_type.sql
  88. 2
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/indexcoll/FactIndexGovrnAblityGridMonthlyDao.xml
  89. 8
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/screen/IndexDictDao.xml
  90. 7
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/screen/IndexGroupDao.xml
  91. 6
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/screen/IndexGroupDetailDao.xml
  92. 9
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/screen/IndexGroupDetailTemplateDao.xml
  93. 8
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/screen/IndexGroupTemplateDao.xml
  94. 15
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/screen/ScreenPioneerDataDao.xml
  95. 17
      epmet-module/data-statistical/data-statistical-server/src/test/java/com/epmet/stats/test/model/DemoData.java
  96. 84
      epmet-module/data-statistical/data-statistical-server/src/test/java/com/epmet/stats/test/model/DemoDataListener.java
  97. 30
      epmet-module/data-statistical/data-statistical-server/src/test/java/com/epmet/stats/test/read/ConverterData.java
  98. 48
      epmet-module/data-statistical/data-statistical-server/src/test/java/com/epmet/stats/test/read/ConverterDataListener.java
  99. 59
      epmet-module/data-statistical/data-statistical-server/src/test/java/com/epmet/stats/test/read/CustomStringStringConverter.java
  100. 15
      epmet-module/data-statistical/data-statistical-server/src/test/java/com/epmet/stats/test/read/DemoDAO.java

10
epmet-commons/epmet-commons-dynamic-datasource/src/main/java/com/epmet/commons/dynamic/datasource/annotation/DataSource.java

@ -21,5 +21,15 @@ import java.lang.annotation.*;
@Documented
@Inherited
public @interface DataSource {
/**
* 直接指定数据源名称
* @return
*/
String value() default "";
/**
* 是否从参数中获取数据源名称优先级高于value
* @return
*/
boolean datasourceNameFromArg() default false;
}

42
epmet-commons/epmet-commons-dynamic-datasource/src/main/java/com/epmet/commons/dynamic/datasource/aspect/DataSourceAspect.java

@ -9,7 +9,9 @@
package com.epmet.commons.dynamic.datasource.aspect;
import com.epmet.commons.dynamic.datasource.annotation.DataSource;
import com.epmet.commons.dynamic.datasource.bean.DataSourceParam;
import com.epmet.commons.dynamic.datasource.config.DynamicContextHolder;
import org.apache.commons.lang3.StringUtils;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
@ -22,6 +24,7 @@ import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;
import java.lang.reflect.Method;
import java.lang.reflect.Parameter;
/**
* 多数据源切面处理类
@ -52,9 +55,9 @@ public class DataSourceAspect {
if(targetDataSource != null || methodDataSource != null){
String value;
if(methodDataSource != null){
value = methodDataSource.value();
value = getDatasourceName(methodDataSource, signature.getMethod().getParameters(), point.getArgs());
}else {
value = targetDataSource.value();
value = getDatasourceName(targetDataSource, signature.getMethod().getParameters(), point.getArgs());
}
DynamicContextHolder.push(value);
@ -68,4 +71,39 @@ public class DataSourceAspect {
logger.debug("clean datasource");
}
}
/**
* 获取要用到的数据源名称
* @param dataSource
* @return
*/
public String getDatasourceName(DataSource dataSource, Parameter[] methodParameters, Object[] methodArgValues) {
if (dataSource.datasourceNameFromArg()) {
// 1.从参数中动态获取数据源名称
String datasourceNameFromParam = getDatasourceNameFromArg(methodParameters, methodArgValues);
if (StringUtils.isNotBlank(datasourceNameFromParam)) {
// 如果有DatasourceParam类型的参数并且设置了datasourceName值,那么返回这个值,否则使用硬编码的
return datasourceNameFromParam;
}
}
// 2.硬编码指定数据源名称
return dataSource.value();
}
/**
* 从参数中取数据源名称
* @param parameters
* @param argsObject
* @return
*/
public String getDatasourceNameFromArg(Parameter[] parameters, Object[] argsObject) {
for (int i = 0; i < parameters.length; i++) {
if (parameters[i].getType() == DataSourceParam.class) {
DataSourceParam param = (DataSourceParam) argsObject[i];
return param.getDatasourceName();
}
}
return null;
}
}

12
epmet-commons/epmet-commons-dynamic-datasource/src/main/java/com/epmet/commons/dynamic/datasource/bean/DataSourceParam.java

@ -0,0 +1,12 @@
package com.epmet.commons.dynamic.datasource.bean;
import lombok.AllArgsConstructor;
import lombok.Data;
@Data
@AllArgsConstructor
public class DataSourceParam {
private String datasourceName;
}

2
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java

@ -100,6 +100,8 @@ public enum EpmetErrorCode {
OPER_UPLOAD_FILE_OVER_SIZE(8707, "文件体积过大"),
OPER_UPLOAD_FILE_TYPE_ERROR(8708, "文件类型错误"),
OPER_EXTERNAL_APP_AUTH_ERROR(8709, "外部应用认证失败"),
OPER_EXTERNAL_CUSTOMER_NOT_EXISTS(8710, "该客户不存在"),
OPER_EXTERNAL_APP_EXISTS(8711, "应用已存在"),
// 党建声音 前端提示 88段
DRAFT_CONTENT_IS_NULL(8801, "至少需要添加一个段落"),

81
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/UniqueIdGenerator.java

@ -0,0 +1,81 @@
package com.epmet.commons.tools.utils;
import org.apache.commons.lang3.StringUtils;
import java.util.Date;
import java.util.Random;
import java.util.concurrent.atomic.AtomicLong;
/**
* 唯一ID生成器
*/
public class UniqueIdGenerator {
private static UniqueValue uniqueValue = new UniqueValue();
private static String middle;
static {
String threadCode = StringUtils.right(String.valueOf(Math.abs(System.nanoTime()+"".hashCode())), 2);
middle = StringUtils.leftPad(threadCode, 2, "0");
}
/**
* 唯一时间值
*/
private static class UniqueValue {
private AtomicLong uniqueValue = new AtomicLong(0L);
private volatile String currentTime = DateUtils.format(new Date(), DateUtils.DATE_TIME_NO_SPLIT);
private volatile String lastTime = currentTime;
/**
* 获取当前时间yyyyMMddHHmmSS
* 如果到了下一秒则唯一值从0开始
*
* @return
*/
public String getCurrentTime() {
currentTime = DateUtils.format(new Date(), DateUtils.DATE_TIME_NO_SPLIT);
if (!currentTime.equals(lastTime)) {
lastTime = currentTime;
Random random = new Random();
uniqueValue.set(Long.valueOf(random.nextInt(10)));
}
return currentTime;
}
public String getCurrentValue() {
return StringUtils.leftPad(String.valueOf(uniqueValue.incrementAndGet()), 5, "0");
}
}
/**
* 生成一个24位唯一ID
* 15位时间+2位中间值防止多服务冲突+2个线程code+5位秒级递增值
*
* @return
*/
public static String generate() {
StringBuilder builder = new StringBuilder(32);
builder.append(uniqueValue.getCurrentTime())
.append(middle)
.append(getUniqueThreadCode())
.append(uniqueValue.getCurrentValue());
return builder.toString();
}
public static String getUniqueThreadCode() {
String threadCode = StringUtils.left(String.valueOf(Thread.currentThread().hashCode()), 2);
return StringUtils.leftPad(threadCode, 2, "0");
}
public static void main(String[] args) throws InterruptedException {
System.out.println(UniqueIdGenerator.uniqueValue.currentTime);
System.out.println(UniqueIdGenerator.middle);
System.out.println(UniqueIdGenerator.getUniqueThreadCode());
System.out.println(uniqueValue.getCurrentValue());
}
}

4
epmet-module/data-report/data-report-client/src/main/java/com/epmet/screen/constant/ScreenConstant.java

@ -8,4 +8,8 @@ public interface ScreenConstant {
String COMMUNITY = "community";
String MONTH = "月";
String RATIO = "%";
}

2
epmet-module/data-report/data-report-client/src/main/java/com/epmet/screen/dto/form/SubAgencyIndexRankFormDTO.java

@ -29,5 +29,5 @@ public class SubAgencyIndexRankFormDTO implements Serializable {
@NotNull(message = "默认查询名次不能为空",groups = {SubAgencyIndexRank.class})
private Integer topNum;
private String monthId;
private String yearId;
}

9
epmet-module/data-report/data-report-client/src/main/java/com/epmet/screen/dto/result/CompartmentResultDTO.java

@ -4,6 +4,7 @@ import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
/**
@ -18,17 +19,17 @@ public class CompartmentResultDTO implements Serializable {
/**
* 当前所选组织
*/
private String agencyId;
private String agencyId = "";
/**
* 当前所选组织名称
*/
private String name;
private String name = "";
/**
* 当前所选组织的坐标区域
*/
private String areaMarks;
private String areaMarks = "";
/**
* 机关级别
@ -44,5 +45,5 @@ public class CompartmentResultDTO implements Serializable {
/**
* 子级用户分布
*/
private List<AgencyDistributionResultDTO> agencyDistribution;
private List<AgencyDistributionResultDTO> agencyDistribution = new ArrayList<>();
}

52
epmet-module/data-report/data-report-client/src/main/java/com/epmet/screen/dto/result/FineExampleResultDTO.java

@ -1,5 +1,6 @@
package com.epmet.screen.dto.result;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;
import java.io.Serializable;
@ -14,42 +15,67 @@ public class FineExampleResultDTO implements Serializable {
private static final long serialVersionUID = -2754696449087950719L;
/**
* 党员参与议题数
* 党员参与议
*/
private Integer issueTotal;
private Integer issueTotal = 0;
@JsonIgnore
private Double issueRatioA;
/**
* 党员参与议题书占平台议题数的占比
* 党员参与议占比
*/
private String issueRatio;
private String issueRatio = "0.00%";
/**
* 党员发布话题总数
*/
private Integer topicTotal;
private Integer topicTotal = 0;
@JsonIgnore
private Double topicRatioA;
/**
* 占平台总话题百分比
* 党员发布话题占
*/
private String topicRatio;
private String topicRatio = "0.00%";
/**
* 议题转项目
*/
private Integer shiftProjectTotal;
private Integer shiftProjectTotal = 0;
@JsonIgnore
private Double shiftProjectRatioA;
/**
* 议题转项目占平台总项目数的比率
* 议题转项目占比
*/
private String shiftProjectRatio;
private String shiftProjectRatio = "0.00%";
/**
* 解决项目
*/
private Integer resolvedProjectTotal;
private Integer resolvedProjectTotal = 0;
@JsonIgnore
private Double resolvedProjectRatioA;
/**
* 解决项目占比
*/
private String resolvedProjectRatio = "0.00%";
/**
* 党员发布议题数
*/
private Integer publishIssueTotal = 0;
@JsonIgnore
private Double publishIssueRatioA;
/**
* 占总解决项目的百分比
* 党员发布议题数占比
*/
private String resolvedProjectRatio;
private String publishIssueRatio = "0.00%";
}

3
epmet-module/data-report/data-report-client/src/main/java/com/epmet/screen/dto/result/ParymemberResultDTO.java

@ -4,6 +4,7 @@ import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
/**
@ -44,5 +45,5 @@ public class ParymemberResultDTO implements Serializable {
/**
* 子级用户分布
*/
private List<ParymemberDistributionResultDTO> userDistribution;
private List<ParymemberDistributionResultDTO> userDistribution = new ArrayList<>();
}

3
epmet-module/data-report/data-report-client/src/main/java/com/epmet/screen/dto/result/ProjectDetailResultDTO.java

@ -3,6 +3,7 @@ package com.epmet.screen.dto.result;
import lombok.Data;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
/**
@ -42,5 +43,5 @@ public class ProjectDetailResultDTO implements Serializable {
/**
* 图片列表
*/
private List<String> imgList;
private List<String> imgList = new ArrayList<>();
}

7
epmet-module/data-report/data-report-client/src/main/java/com/epmet/screen/dto/result/TreeResultDTO.java

@ -4,6 +4,7 @@ import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
/**
@ -18,12 +19,12 @@ public class TreeResultDTO implements Serializable {
/**
* 显示名称
*/
private String label;
private String label = "";
/**
* agencyId下拉框value
*/
private String value;
private String value = "";
@JsonIgnore
private String pids;
@ -31,6 +32,6 @@ public class TreeResultDTO implements Serializable {
/**
* 子目录
*/
private List<TreeResultDTO> children;
private List<TreeResultDTO> children = new ArrayList<>();
}

9
epmet-module/data-report/data-report-client/src/main/java/com/epmet/screen/dto/result/UserResultDTO.java

@ -4,6 +4,7 @@ import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
/**
@ -18,17 +19,17 @@ public class UserResultDTO implements Serializable {
/**
* 当前所选组织
*/
private String agencyId;
private String agencyId = "";
/**
* 当前所选组织名称
*/
private String name;
private String name = "";
/**
* 当前所选组织的坐标区域
*/
private String areaMarks;
private String areaMarks = "";
/**
* 机关级别
@ -44,5 +45,5 @@ public class UserResultDTO implements Serializable {
/**
* 子级用户分布
*/
private List<UserDistributionResultDTO> userDistribution;
private List<UserDistributionResultDTO> userDistribution = new ArrayList<>();
}

2
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/screen/ScreenCustomerGridDao.java

@ -27,7 +27,7 @@ import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 网格信息
* 网格(党支部)信息
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-08-18

2
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/screen/ScreenDifficultyDataDao.java

@ -24,7 +24,7 @@ import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 基层治理-难点堵点
* 基层治理-难点堵点(耗时最长|设计部门最多|处理次数)
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-08-18

12
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/screen/ScreenPioneerDataDao.java

@ -17,7 +17,9 @@
package com.epmet.datareport.dao.screen;
import com.epmet.screen.dto.result.FineExampleResultDTO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/**
* 党建引领-先锋模范数据
@ -27,5 +29,13 @@ import org.apache.ibatis.annotations.Mapper;
*/
@Mapper
public interface ScreenPioneerDataDao{
/**
* @Description 查询先锋模范
* @param agencyId
* @author zxc
* @date 2020/8/20 5:22 下午
*/
FineExampleResultDTO selectFineExample(@Param("agencyId")String agencyId);
}

2
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/screen/ScreenUserTotalDataDao.java

@ -26,7 +26,7 @@ import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 中央区-各类用户总数
* 中央区-各类(用户|党员|党群|话题|议题|项目|注册人数|参与人数)总数
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-08-18

2
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/screen/impl/AgencyServiceImpl.java

@ -75,7 +75,7 @@ public class AgencyServiceImpl implements AgencyService {
public CompartmentResultDTO compartment(CompartmentFormDTO compartmentFormDTO) {
CompartmentResultDTO agencyAreaInfo = screenCustomerAgencyDao.getAgencyAreaInfo(compartmentFormDTO.getAgencyId());
if (null == agencyAreaInfo){
return agencyAreaInfo;
return new CompartmentResultDTO();
}
if (agencyAreaInfo.getLevel().equals(ScreenConstant.COMMUNITY)){
// 当level为"community"时,查询screen_customer_grid表

11
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/screen/impl/IndexServiceImpl.java

@ -34,7 +34,7 @@ public class IndexServiceImpl implements IndexService {
@Autowired
private ScreenIndexDataMonthlyDao screenIndexDataMonthlyDao;
@Autowired
private GrassrootsPartyDevServiceImpl grassrootsPartyDevServiceImpl;
private PartyMemberLeadServiceImpl partyMemberLeadServiceImpl;
/**
* @Description 1年度平均指数
@ -60,7 +60,7 @@ public class IndexServiceImpl implements IndexService {
@Override
public MonthPieChartResultDTO monthPieChart(MonthPieChartFormDTO monthPieChartFormDTO) {
MonthPieChartResultDTO monthPieChartResultDTO = screenIndexDataMonthlyDao.selectMonthPieChart(monthPieChartFormDTO.getAgencyId());
if (null == monthPieChartFormDTO){
if (null == monthPieChartResultDTO){
return new MonthPieChartResultDTO();
}
return monthPieChartResultDTO;
@ -81,8 +81,7 @@ public class IndexServiceImpl implements IndexService {
List<Double> governAbilityData = new ArrayList<>();
List<Double> totalIndexData = new ArrayList<>();
// 1. x轴
Map<String, String> x = grassrootsPartyDevServiceImpl.getX();
result.setXAxis(x.values().stream().collect(Collectors.toList()));
result.setXAxis(partyMemberLeadServiceImpl.getXPro());
// 2. 查询近一年的指数值【不包括本月】
List<MonthBarchartResult> monthBarchartResults = screenIndexDataMonthlyDao.selectMonthBarchart(customerId, monthBarchartFormDTO.getAgencyId());
if (monthBarchartResults.size() == NumConstant.ZERO){
@ -121,8 +120,8 @@ public class IndexServiceImpl implements IndexService {
@Override
public List<SubAgencyIndexRankResultDTO> subAgencyIndexRank(SubAgencyIndexRankFormDTO subAgencyIndexRankFormDTO) {
LocalDate now = LocalDate.now().minusMonths(NumConstant.ONE);
String monthId = now.toString().substring(NumConstant.ZERO,NumConstant.FOUR).concat(now.toString().substring(NumConstant.FIVE,NumConstant.SEVEN));
subAgencyIndexRankFormDTO.setMonthId(monthId);
int yearId = now.getYear();
subAgencyIndexRankFormDTO.setYearId(String.valueOf(yearId));
List<SubAgencyIndexRankResultDTO> subAgencyIndexRankResultDTOS = screenIndexDataMonthlyDao.selectSubAgencyIndexRank(subAgencyIndexRankFormDTO);
if (subAgencyIndexRankResultDTOS.size() == NumConstant.ZERO){
return new ArrayList<>();

48
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/screen/impl/PartyMemberLeadServiceImpl.java

@ -3,14 +3,18 @@ package com.epmet.datareport.service.screen.impl;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.datareport.dao.screen.ScreenPartyBranchDataDao;
import com.epmet.datareport.dao.screen.ScreenPartyLinkMassesDataDao;
import com.epmet.datareport.dao.screen.ScreenPioneerDataDao;
import com.epmet.datareport.service.screen.PartyMemberLeadService;
import com.epmet.screen.dto.form.ContactMassLineChartFormDTO;
import com.epmet.screen.dto.form.FineExampleFormDTO;
import com.epmet.screen.dto.form.VolunteerServiceFormDTO;
import com.epmet.screen.dto.result.*;
import com.epmet.screen.constant.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
@ -29,9 +33,9 @@ public class PartyMemberLeadServiceImpl implements PartyMemberLeadService {
@Autowired
private ScreenPartyLinkMassesDataDao screenPartyLinkMassesDataDao;
@Autowired
private GrassrootsPartyDevServiceImpl grassrootsPartyDevServiceImpl;
@Autowired
private ScreenPartyBranchDataDao screenPartyBranchDataDao;
@Autowired
private ScreenPioneerDataDao screenPioneerDataDao;
/**
* @Description 1先锋模范
@ -41,8 +45,27 @@ public class PartyMemberLeadServiceImpl implements PartyMemberLeadService {
*/
@Override
public FineExampleResultDTO fineExample(FineExampleFormDTO fineExampleFormDTO) {
FineExampleResultDTO fineExampleResultDTO = screenPioneerDataDao.selectFineExample(fineExampleFormDTO.getAgencyId());
if (null == fineExampleResultDTO){
return new FineExampleResultDTO();
}
fineExampleResultDTO.setIssueRatio(this.getRatio(fineExampleResultDTO.getIssueRatioA()));
fineExampleResultDTO.setPublishIssueRatio(this.getRatio(fineExampleResultDTO.getPublishIssueRatioA()));
fineExampleResultDTO.setResolvedProjectRatio(this.getRatio(fineExampleResultDTO.getResolvedProjectRatioA()));
fineExampleResultDTO.setTopicRatio(this.getRatio(fineExampleResultDTO.getTopicRatioA()));
fineExampleResultDTO.setShiftProjectRatio(this.getRatio(fineExampleResultDTO.getShiftProjectRatioA()));
return fineExampleResultDTO;
}
return null;
/**
* @Description 小数转换百分比
* @param d
* @author zxc
* @date 2020/8/20 6:06 下午
*/
public String getRatio(Double d){
BigDecimal bigDecimal = new BigDecimal(d * NumConstant.ONE_HUNDRED);
return bigDecimal.setScale(NumConstant.TWO, BigDecimal.ROUND_HALF_UP).toPlainString().concat(ScreenConstant.RATIO);
}
/**
@ -87,8 +110,7 @@ public class PartyMemberLeadServiceImpl implements PartyMemberLeadService {
List<Integer> organizeData = new ArrayList<>();
List<Integer> joinData = new ArrayList<>();
List<Integer> averageJoinUserData = new ArrayList<>();
Map<String, String> x = grassrootsPartyDevServiceImpl.getX();
result.setXAxis(x.values().stream().collect(Collectors.toList()));
result.setXAxis(this.getXPro());
List<VolunteerServiceResult> volunteerServiceResults = screenPartyBranchDataDao.selectVolunteerServiceResult(volunteerServiceFormDTO.getAgencyId());
if (volunteerServiceResults.size() == NumConstant.ZERO){
for (int i = NumConstant.ZERO; i <= NumConstant.TWELVE; i++) {
@ -112,4 +134,20 @@ public class PartyMemberLeadServiceImpl implements PartyMemberLeadService {
result.setAverageJoinUserData(averageJoinUserData);
return result;
}
/**
* @Description 获取之前的12个月份不包括当前月
* @author zxc
* @date 2020/8/21 10:19 上午
*/
public List<String> getXPro(){
List<String> xAxis = new ArrayList<>();
LocalDate today = LocalDate.now();
for(int i = NumConstant.TWELVE;i >= NumConstant.ONE; i--){
LocalDate localDate = today.minusMonths(i);
String s = localDate.getMonth().getValue() + ScreenConstant.MONTH;
xAxis.add(s);
}
return xAxis;
}
}

4
epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenIndexDataMonthlyDao.xml

@ -45,11 +45,11 @@
party_dev_ablity AS partyDevAbility,
service_ablity AS serviceAbility
FROM
screen_index_data_monthly
screen_index_data_yearly
WHERE
del_flag = '0'
AND parent_id = #{agencyId}
AND month_id = #{monthId}
AND year_id = #{yearId}
ORDER BY index_total DESC
LIMIT #{topNum}
</select>

20
epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenPioneerDataDao.xml

@ -3,5 +3,23 @@
<mapper namespace="com.epmet.datareport.dao.screen.ScreenPioneerDataDao">
<!-- 查询先锋模范 -->
<select id="selectFineExample" resultType="com.epmet.screen.dto.result.FineExampleResultDTO">
SELECT
issue_total AS issueTotal,
issue_ratio AS issueRatioA,
topic_total AS topicTotal,
topic_ratio AS topicRatioA,
shift_project_total AS shiftProjectTotal,
shift_project_Ratio AS shiftProjectRatioA,
resolved_project_total AS resolvedProjectTotal,
resolved_project_ratio AS resolvedProjectRatioA,
publish_issue_total AS publishIssueTotal,
publish_issue_ratio AS publishIssueRatioA
FROM
screen_pioneer_data
WHERE
del_flag = '0'
AND org_id = #{agencyId}
</select>
</mapper>

12
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcollect/form/GridGovrnAbilityFormDTO.java

@ -55,15 +55,10 @@ public class GridGovrnAbilityFormDTO implements Serializable {
*/
private Integer projectTotal;
/**
* 网格自治项目数
*/
private Integer selfSolveProjectRatio;
/**
* 网格办结项目数
*/
private Integer resolveProjectTotal;
private Integer resolveProjectCount;
/**
* 网格吹哨部门准确率
@ -79,4 +74,9 @@ public class GridGovrnAbilityFormDTO implements Serializable {
* 网格议题转项目率
*/
private BigDecimal avgShiftProjectRatio;
/**
* 网格自治项目数 统计期网格自身内办结的项目数目
*/
private Integer selfSolveProjectCount;
}

9
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcollect/form/GridPartyMemberDataFormDTO.java

@ -86,4 +86,13 @@ public class GridPartyMemberDataFormDTO implements Serializable {
*/
private Integer issueToProjectCount;
/**
* 用户id
*/
private String userId;
/**
* 上级组织Id
*/
private String parentId;
}

2
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcollect/form/OrgServiceAbilityFormDTO.java

@ -43,7 +43,7 @@ public class OrgServiceAbilityFormDTO implements Serializable {
/**
* allRegion全区community社区street街道
*/
private Integer dataType;
private String dataType;
/**
* 社区/街道活动组织次数 爱心活动

97
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/IndexDictDTO.java

@ -0,0 +1,97 @@
/**
* 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.screen;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* 评价指标字典
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-08-19
*/
@Data
public class IndexDictDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键id
*/
private String id;
/**
* 指标编码(唯一)
*/
private String indexCode;
/**
* 指标名
*/
private String indexName;
/**
* 指标描述
*/
private String indexDesc;
/**
* 父级指标id如果是一级指标PID=0
*/
private String pid;
/**
* 指标级别1,2,3,4,5
*/
private String level;
/**
* 删除标识 0.未删除 1.已删除
*/
private Integer delFlag;
/**
* 乐观锁
*/
private Integer revision;
/**
* 创建人
*/
private String createdBy;
/**
* 创建时间
*/
private Date createdTime;
/**
* 更新人
*/
private String updatedBy;
/**
* 更新时间
*/
private Date updatedTime;
}

92
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/IndexGroupDTO.java

@ -0,0 +1,92 @@
/**
* 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.screen;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* 客户指标分组
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-08-19
*/
@Data
public class IndexGroupDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键id
*/
private String id;
/**
* 客户id
*/
private String customerId;
/**
* 指标id
*/
private String indexCode;
/**
* 是否启用启用enable 禁用disabled
*/
private String status;
/**
* 当前指标关联的上一级指标分组如果没有上一级则为0
*/
private String parentIndexGroupId;
/**
* 删除标识 0.未删除 1.已删除
*/
private Integer delFlag;
/**
* 乐观锁
*/
private Integer revision;
/**
* 创建人
*/
private String createdBy;
/**
* 创建时间
*/
private Date createdTime;
/**
* 更新人
*/
private String updatedBy;
/**
* 更新时间
*/
private Date updatedTime;
}

92
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/IndexGroupDetailDTO.java

@ -0,0 +1,92 @@
/**
* 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.screen;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
/**
* 客户指标详情
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-08-19
*/
@Data
public class IndexGroupDetailDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键id
*/
private String id;
/**
* index_group.id
*/
private String indexGroupId;
/**
* 指标id
*/
private String indexCode;
/**
* 权重同一组权重总和=1
*/
private BigDecimal weight;
/**
* 是否启用启用enable 禁用disabled
*/
private String status;
/**
* 删除标识 0.未删除 1.已删除
*/
private Integer delFlag;
/**
* 乐观锁
*/
private Integer revision;
/**
* 创建人
*/
private String createdBy;
/**
* 创建时间
*/
private Date createdTime;
/**
* 更新人
*/
private String updatedBy;
/**
* 更新时间
*/
private Date updatedTime;
}

92
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/IndexGroupDetailTemplateDTO.java

@ -0,0 +1,92 @@
/**
* 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.screen;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
/**
* 客户指标详情
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-08-19
*/
@Data
public class IndexGroupDetailTemplateDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键id
*/
private String id;
/**
* index_group.id
*/
private String indexGroupId;
/**
* 指标id
*/
private String indexCode;
/**
* 权重同一组权重总和=1
*/
private BigDecimal weight;
/**
* 是否启用启用enable 禁用disabled
*/
private String status;
/**
* 删除标识 0.未删除 1.已删除
*/
private Integer delFlag;
/**
* 乐观锁
*/
private Integer revision;
/**
* 创建人
*/
private String createdBy;
/**
* 创建时间
*/
private Date createdTime;
/**
* 更新人
*/
private String updatedBy;
/**
* 更新时间
*/
private Date updatedTime;
}

31
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/form/PioneerDataFormDTO.java

@ -3,6 +3,7 @@ package com.epmet.dto.screencoll.form;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
/**
* 10党建引领-先锋模范数据
@ -35,9 +36,9 @@ public class PioneerDataFormDTO implements Serializable {
private String orgName;
/**
* 用户总数
* 党员发布议题
*/
private Integer userTotal;
private Integer publishIssueTotal;
/**
* 议事数
@ -58,4 +59,30 @@ public class PioneerDataFormDTO implements Serializable {
* 解决项目总数
*/
private Integer resolvedProjectTotal;
/**
* 议事占比
*/
private BigDecimal issueRatio;
/**
* 话题占比
*/
private BigDecimal topicRatio;
/**
* 议题转项目占比
*/
private BigDecimal shiftProjectRatio;
/**
* 解决项目占比
*/
private BigDecimal resolvedProjectRatio;
/**
* 党员发布议题占比
*/
private BigDecimal publishIssueRatio;
}

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

@ -74,6 +74,25 @@
<version>2.0.0</version>
<scope>compile</scope>
</dependency>
<!--excel start-->
<!-- xls格式excel依赖包 -->
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>3.17</version>
</dependency>
<!--xlsx格式excel依赖包-->
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>3.17</version>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>easyexcel</artifactId>
<version>2.2.6</version>
</dependency>
</dependencies>
<build>

68
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/IndexDictController.java

@ -0,0 +1,68 @@
package com.epmet.controller;
import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.ExcelReader;
import com.alibaba.excel.read.metadata.ReadSheet;
import com.epmet.commons.tools.utils.Result;
import com.epmet.model.IndexExcelDataListener;
import com.epmet.model.IndexModel;
import com.epmet.service.screen.IndexDictService;
import com.epmet.service.screen.IndexGroupDetailTemplateService;
import com.epmet.service.screen.IndexGroupTemplateService;
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.RequestMapping;
import org.springframework.web.bind.annotation.RequestPart;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import java.io.IOException;
import java.io.InputStream;
/**
* @author liujianjun
*/
@RequestMapping("indexdict")
@RestController
@Slf4j
public class IndexDictController {
@Autowired
private IndexDictService indexDictService;
@Autowired
private IndexGroupTemplateService indexGroupTemplateService;
@Autowired
private IndexGroupDetailTemplateService indexGroupDetailTemplateService;
/**
* urlhttp://localhost:8108/data/stats/indexdict/initFromExcel
* desc:从excel初始化指标分组权重
*
* @param file
* @return
*/
@PostMapping("initFromExcel")
public Result<String> testTx(@RequestPart("file") MultipartFile file) {
ExcelReader excelReader = null;
try {
InputStream inputStream = null;
try {
inputStream = file.getInputStream();
} catch (IOException e) {
return new Result<String>().error("读取文件失败");
}
excelReader = EasyExcel.read(inputStream).build();
// 这里为了简单 所以注册了 同样的head 和Listener 自己使用功能必须不同的Listener
ReadSheet readSheet = EasyExcel.readSheet(1).head(IndexModel.class)
.registerReadListener(new IndexExcelDataListener(indexDictService, indexGroupTemplateService, indexGroupDetailTemplateService))
.build();
excelReader.read(readSheet);
} finally {
if (excelReader != null) {
excelReader.finish();
}
}
return new Result<>();
}
}

14
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/indexcoll/FactIndexGovrnAblityDeptMonthlyDao.java

@ -36,12 +36,22 @@ public interface FactIndexGovrnAblityDeptMonthlyDao extends BaseDao<FactIndexGov
* 8治理能力-部门相关指标
* 据CUSTOMER_IDAGENCY_IDDEPT_IDYEAR_IDMONTH_IDQUARTER_ID进行查询如果有数据则先进行物理删除
*
* @param formDTO
* @param customerId
* @param agencyId
* @param deptId
* @param yearId
* @param monthId
* @param quarterId
* @param customerId
* @Author zhangyong
* @Date 10:52 2020-08-20
**/
void deleteFactIndexGovrnAblityDeptMonthly(DeptGovrnAbilityFormDTO formDTO, @Param("customerId") String customerId);
void deleteFactIndexGovrnAblityDeptMonthly(@Param("customerId") String customerId,
@Param("agencyId") String agencyId,
@Param("deptId") String deptId,
@Param("yearId") String yearId,
@Param("monthId") String monthId,
@Param("quarterId") String quarterId);
/**
* 8治理能力-部门相关指标

13
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/indexcoll/FactIndexGovrnAblityGridMonthlyDao.java

@ -38,12 +38,21 @@ public interface FactIndexGovrnAblityGridMonthlyDao extends BaseDao<FactIndexGov
* 6治理能力-网格相关指标
* 根据CUSTOMER_IDAGENCY_IDGRID_IDYEAR_IDMONTH_IDQUARTER_ID进行查询如果有数据则先进行物理删除
*
* @param formDTO
* @param customerId
* @param agencyId
* @param gridId
* @param yearId
* @param monthId
* @param quarterId
* @Author zhangyong
* @Date 10:52 2020-08-20
**/
void deleteFactIndexGovrnAblityGridMonthly(GridGovrnAbilityFormDTO formDTO, @Param("customerId") String customerId);
void deleteFactIndexGovrnAblityGridMonthly(@Param("customerId") String customerId,
@Param("agencyId") String agencyId,
@Param("gridId") String gridId,
@Param("yearId") String yearId,
@Param("monthId") String monthId,
@Param("quarterId") String quarterId);
/**
* 6治理能力-网格相关指标

18
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/indexcoll/FactIndexPartyAblityCpcMonthlyDao.java

@ -38,12 +38,23 @@ public interface FactIndexPartyAblityCpcMonthlyDao extends BaseDao<FactIndexPart
* 1党建能力-党员相关指标上报(按照月份)
* 1) 根据CUSTOMER_IDAGENCY_IDGRID_IDUSER_IDYEAR_IDMONTH_IDQUARTER_ID进行查询如果有数据则先进行物理删除
*
* @param formDTO
* @param customerId
* @param agencyId
* @param gridId
* @param userId
* @param yearId
* @param monthId
* @param quarterId
* @Author zhangyong
* @Date 10:52 2020-08-20
**/
void deleteFactIndexPartyAblityCpcMonthly(GridPartyMemberDataFormDTO formDTO, @Param("customerId") String customerId);
void deleteFactIndexPartyAblityCpcMonthly(@Param("customerId") String customerId,
@Param("agencyId") String agencyId,
@Param("gridId") String gridId,
@Param("userId") String userId,
@Param("yearId") String yearId,
@Param("monthId") String monthId,
@Param("quarterId") String quarterId);
/**
* 1党建能力-党员相关指标上报(按照月份)
@ -54,5 +65,6 @@ public interface FactIndexPartyAblityCpcMonthlyDao extends BaseDao<FactIndexPart
* @Author zhangyong
* @Date 10:52 2020-08-20
**/
void batchInsertFactIndexPartyAblityCpcMonthly(@Param("list") List<GridPartyMemberDataFormDTO> list, @Param("customerId")String customerId);
void batchInsertFactIndexPartyAblityCpcMonthly(@Param("list") List<GridPartyMemberDataFormDTO> list,
@Param("customerId")String customerId);
}

13
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/indexcoll/FactIndexPartyAblityGridMonthlyDao.java

@ -38,12 +38,21 @@ public interface FactIndexPartyAblityGridMonthlyDao extends BaseDao<FactIndexPar
* 2党建能力-网格相关指标上报(按照月份)
* 1) 根据CUSTOMER_IDAGENCY_IDGRID_IDYEAR_IDMONTH_IDQUARTER_ID进行查询如果有数据则先进行物理删除
*
* @param formDTO
* @param customerId
* @param agencyId
* @param gridId
* @param yearId
* @param monthId
* @param quarterId
* @Author zhangyong
* @Date 10:52 2020-08-20
**/
void deleteFactIndexPartyAblityGridMonthly(GridPartyAbilityFormDTO formDTO, @Param("customerId") String customerId);
void deleteFactIndexPartyAblityGridMonthly(@Param("customerId") String customerId,
@Param("agencyId") String agencyId,
@Param("gridId") String gridId,
@Param("yearId") String yearId,
@Param("monthId") String monthId,
@Param("quarterId") String quarterId);
/**
* 2党建能力-网格相关指标上报(按照月份)

13
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/indexcoll/FactIndexServiceAblityGridMonthlyDao.java

@ -37,12 +37,21 @@ public interface FactIndexServiceAblityGridMonthlyDao extends BaseDao<FactIndexS
* 4服务能力-网格相关指标
* 根据CUSTOMER_IDAGENCY_IDGRID_IDYEAR_IDMONTH_IDQUARTER_ID进行查询如果有数据则先进行物理删除
*
* @param formDTO
* @param customerId
* @param agencyId
* @param gridId
* @param yearId
* @param monthId
* @param quarterId
* @Author zhangyong
* @Date 10:52 2020-08-20
**/
void deleteFactIndexServiceAblityGridMonthly(GridServiceAbilityFormDTO formDTO, @Param("customerId") String customerId);
void deleteFactIndexServiceAblityGridMonthly(@Param("customerId") String customerId,
@Param("agencyId") String agencyId,
@Param("gridId") String gridId,
@Param("yearId") String yearId,
@Param("monthId") String monthId,
@Param("quarterId") String quarterId);
/**
* 4服务能力-网格相关指标

34
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/screen/IndexDictDao.java

@ -0,0 +1,34 @@
/**
* 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.dao.screen;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.entity.screen.IndexDictEntity;
import org.apache.ibatis.annotations.Mapper;
/**
* 评价指标字典
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-08-19
*/
@Mapper
public interface IndexDictDao extends BaseDao<IndexDictEntity> {
int deleteAll();
}

33
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/screen/IndexGroupDao.java

@ -0,0 +1,33 @@
/**
* 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.dao.screen;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.entity.screen.IndexGroupEntity;
import org.apache.ibatis.annotations.Mapper;
/**
* 客户指标分组
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-08-19
*/
@Mapper
public interface IndexGroupDao extends BaseDao<IndexGroupEntity> {
}

33
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/screen/IndexGroupDetailDao.java

@ -0,0 +1,33 @@
/**
* 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.dao.screen;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.entity.screen.IndexGroupDetailEntity;
import org.apache.ibatis.annotations.Mapper;
/**
* 客户指标详情
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-08-19
*/
@Mapper
public interface IndexGroupDetailDao extends BaseDao<IndexGroupDetailEntity> {
}

35
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/screen/IndexGroupDetailTemplateDao.java

@ -0,0 +1,35 @@
/**
* 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.dao.screen;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.entity.screen.IndexGroupDetailTemplateEntity;
import org.apache.ibatis.annotations.Mapper;
/**
* 客户指标详情
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-08-19
*/
@Mapper
public interface IndexGroupDetailTemplateDao extends BaseDao<IndexGroupDetailTemplateEntity> {
int deleteAll();
}

34
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/screen/IndexGroupTemplateDao.java

@ -0,0 +1,34 @@
/**
* 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.dao.screen;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.entity.screen.IndexGroupTemplateEntity;
import org.apache.ibatis.annotations.Mapper;
/**
* 默认指标分组
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-08-19
*/
@Mapper
public interface IndexGroupTemplateDao extends BaseDao<IndexGroupTemplateEntity> {
int deleteAll();
}

2
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/screen/ScreenCustomerGridDao.java

@ -26,7 +26,7 @@ import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 网格信息
* 网格(党支部)信息
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-08-18

2
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/screen/ScreenDifficultyDataDao.java

@ -26,7 +26,7 @@ import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 基层治理-难点堵点
* 基层治理-难点堵点(耗时最长|设计部门最多|处理次数)
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-08-18

2
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/screen/ScreenUserTotalDataDao.java

@ -26,7 +26,7 @@ import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 中央区-各类用户总数
* 中央区-各类(用户|党员|党群|话题|议题|项目|注册人数|参与人数)总数
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-08-18

4
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/indexcoll/FactIndexGovrnAblityOrgMonthlyEntity.java

@ -27,7 +27,7 @@ import java.math.BigDecimal;
import java.util.Date;
/**
* 治理能力-街道及社区相关数据
* 治理能力-街道及社区相关数据
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-08-20
@ -72,7 +72,7 @@ public class FactIndexGovrnAblityOrgMonthlyEntity extends BaseEpmetEntity {
/**
* 数据类型 allRegion全区street街道community社区grid网格
*/
private Integer dataType;
private String dataType;
/**
* 被吹哨次数

4
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/indexcoll/FactIndexPartyAblityOrgMonthlyEntity.java

@ -26,7 +26,7 @@ import lombok.EqualsAndHashCode;
import java.util.Date;
/**
* 党建能力-街道及社区相关事实表
* 党建能力-街道及社区相关事实表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-08-20
@ -76,6 +76,6 @@ public class FactIndexPartyAblityOrgMonthlyEntity extends BaseEpmetEntity {
/**
* 数据类型 allRegion全区community社区street街道
*/
private Integer dataType;
private String dataType;
}

4
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/indexcoll/FactIndexServiceAblityOrgMonthlyEntity.java

@ -26,7 +26,7 @@ import lombok.EqualsAndHashCode;
import java.util.Date;
/**
* 服务能力-组织街道|社区|全区相关事实表
* 服务能力-组织街道|社区|全区相关事实表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-08-20
@ -76,6 +76,6 @@ public class FactIndexServiceAblityOrgMonthlyEntity extends BaseEpmetEntity {
/**
* 数据类型 allRegion全区street街道community社区grid网格
*/
private Integer dataType;
private String dataType;
}

53
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/IndexDictEntity.java

@ -0,0 +1,53 @@
/**
* 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.screen;
import com.baomidou.mybatisplus.annotation.TableName;
import com.epmet.commons.mybatis.entity.BaseEpmetEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* 评价指标字典
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-08-19
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("index_dict")
public class IndexDictEntity extends BaseEpmetEntity {
private static final long serialVersionUID = 1L;
/**
* 指标名
*/
private String indexName;
/**
* 指标描述
*/
private String indexDesc;
/**
* 指标级别1,2,3,4,5
*/
private String level;
}

60
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/IndexGroupDetailEntity.java

@ -0,0 +1,60 @@
/**
* 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.screen;
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
* @since v1.0.0 2020-08-19
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("index_group_detail")
public class IndexGroupDetailEntity extends BaseEpmetEntity {
private static final long serialVersionUID = 1L;
/**
* index_group.id
*/
private String indexGroupId;
/**
* 指标id
*/
private String indexId;
/**
* 权重同一组权重总和=1
*/
private BigDecimal weight;
/**
* 是否启用启用enable 禁用disabled
*/
private String status;
}

65
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/IndexGroupDetailTemplateEntity.java

@ -0,0 +1,65 @@
/**
* 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.screen;
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
* @since v1.0.0 2020-08-19
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("index_group_detail_template")
public class IndexGroupDetailTemplateEntity extends BaseEpmetEntity {
private static final long serialVersionUID = 1L;
/**
* index_group.id
*/
private String indexGroupId;
/**
* 指标id
*/
private String indexId;
/**
* 权重同一组权重总和=1
*/
private BigDecimal weight;
/**
* 是否启用启用enable 禁用disabled
*/
private String status;
/**
* 阈值 如果是百分比 则为除以100以后的值
*/
private BigDecimal threshold;
}

58
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/IndexGroupEntity.java

@ -0,0 +1,58 @@
/**
* 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.screen;
import com.baomidou.mybatisplus.annotation.TableName;
import com.epmet.commons.mybatis.entity.BaseEpmetEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* 客户指标分组
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-08-19
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("index_group")
public class IndexGroupEntity extends BaseEpmetEntity {
private static final long serialVersionUID = 1L;
/**
* 客户id
*/
private String customerId;
/**
* 指标id
*/
private String indexId;
/**
* 是否启用启用enable 禁用disabled
*/
private String status;
/**
* 当前指标关联的上一级指标分组如果没有上一级则为0
*/
private String parentIndexGroupId;
}

53
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/IndexGroupTemplateEntity.java

@ -0,0 +1,53 @@
/**
* 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.screen;
import com.baomidou.mybatisplus.annotation.TableName;
import com.epmet.commons.mybatis.entity.BaseEpmetEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* 客户指标分组
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-08-19
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("index_group_template")
public class IndexGroupTemplateEntity extends BaseEpmetEntity {
private static final long serialVersionUID = 1L;
/**
* 指标id
*/
private String indexId;
/**
* 是否启用启用enable 禁用disabled
*/
private String status;
/**
* 当前指标关联的上一级指标分组如果没有上一级则为0
*/
private String parentIndexGroupId;
}

19
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/ScreenCpcBaseDataEntity.java

@ -29,7 +29,7 @@ import java.util.Date;
* 基层党建-党员基本情况
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-08-18
* @since v1.0.0 2020-08-21
*/
@Data
@EqualsAndHashCode(callSuper=false)
@ -63,6 +63,11 @@ public class ScreenCpcBaseDataEntity extends BaseEpmetEntity {
*/
private String orgName;
/**
* 数据更新至: yyyy|yyyyMM|yyyyMMdd(08-21新增)
*/
private String dataEndTime;
/**
* 注册用户数
*/
@ -79,32 +84,32 @@ public class ScreenCpcBaseDataEntity extends BaseEpmetEntity {
private Integer partyMemberCount;
/**
* 小于20岁
* 小于20岁的党员总人数
*/
private Integer ageLevel1;
/**
* 20-30岁
* 20-30岁的党员总人数
*/
private Integer ageLevel2;
/**
* 31-40岁
* 31-40岁的党员总人数
*/
private Integer ageLevel3;
/**
* 41-50岁
* 41-50岁的党员总人数
*/
private Integer ageLevel4;
/**
* 51-60岁
* 51-60岁的党员总人数
*/
private Integer ageLevel5;
/**
* 60+
* 60+的党员总人数
*/
private Integer ageLevel6;

10
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/ScreenCustomerAgencyEntity.java

@ -14,7 +14,6 @@
* 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.screen;
import com.baomidou.mybatisplus.annotation.TableName;
@ -29,7 +28,7 @@ import java.util.Date;
* 组织机构信息
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-08-18
* @since v1.0.0 2020-08-21
*/
@Data
@EqualsAndHashCode(callSuper=false)
@ -59,7 +58,7 @@ public class ScreenCustomerAgencyEntity extends BaseEpmetEntity {
private String pid;
/**
* 所有上级ID用逗号分开
* 所有上级ID用逗号英文分开
*/
private String pids;
@ -97,4 +96,9 @@ public class ScreenCustomerAgencyEntity extends BaseEpmetEntity {
*/
private String areaCode;
/**
* 数据更新至: yyyy|yyyyMM|yyyyMMdd(08-21新增)
*/
private String dataEndTime;
}

7
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/ScreenCustomerDeptEntity.java

@ -29,7 +29,7 @@ import java.util.Date;
* 部门信息
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-08-18
* @since v1.0.0 2020-08-21
*/
@Data
@EqualsAndHashCode(callSuper=false)
@ -73,4 +73,9 @@ public class ScreenCustomerDeptEntity extends BaseEpmetEntity {
*/
private String deptMark;
/**
* 数据更新至: yyyy|yyyyMM|yyyyMMdd(08-21新增)
*/
private String dataEndTime;
}

9
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/ScreenCustomerGridEntity.java

@ -26,10 +26,10 @@ import lombok.EqualsAndHashCode;
import java.util.Date;
/**
* 网格信息
* 网格(党支部)信息
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-08-18
* @since v1.0.0 2020-08-21
*/
@Data
@EqualsAndHashCode(callSuper=false)
@ -73,4 +73,9 @@ public class ScreenCustomerGridEntity extends BaseEpmetEntity {
*/
private String partyMark;
/**
* 数据更新至: yyyy|yyyyMM|yyyyMMdd(08-21新增)
*/
private String dataEndTime;
}

20
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/ScreenDifficultyDataEntity.java

@ -26,10 +26,10 @@ import lombok.EqualsAndHashCode;
import java.util.Date;
/**
* 基层治理-难点堵点
* 基层治理-难点堵点(耗时最长|设计部门最多|处理次数)
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-08-18
* @since v1.0.0 2020-08-21
*/
@Data
@EqualsAndHashCode(callSuper=false)
@ -93,6 +93,10 @@ public class ScreenDifficultyDataEntity extends BaseEpmetEntity {
*/
private Integer eventReOrg;
/**
* 事件被处理次数08-21新增
*/
private Integer eventHandledCount;
/**
* 事件类别编码
*/
@ -113,8 +117,14 @@ public class ScreenDifficultyDataEntity extends BaseEpmetEntity {
*/
private String eventStatusDesc;
/**
* 最近一次操作说明
*/
/**
* 最近一次操作说明
*/
private String latestOperateDesc;
/**
* 数据更新至: yyyy|yyyyMM|yyyyMMdd(08-21新增)
*/
private String dataEndTime;
}

26
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/ScreenEventDataEntity.java

@ -30,7 +30,7 @@ import java.util.Date;
* 中央区-事件数据
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-08-18
* @since v1.0.0 2020-08-21
*/
@Data
@EqualsAndHashCode(callSuper=false)
@ -124,18 +124,24 @@ public class ScreenEventDataEntity extends BaseEpmetEntity {
*/
private Date lastProcessDate;
/**
* 事件状态key
*/
/**
* 事件状态key
*/
private String eventStatusCode;
/**
* 事件状态描述
*/
/**
* 事件状态描述
*/
private String eventStatusDesc;
/**
* 最近一次操作说明
*/
/**
* 最近一次操作说明
*/
private String latestOperateDesc;
/**
* 数据更新至: yyyy|yyyMM|yyyyMMdd
*/
private String dataEndTime;
}

2
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/ScreenEventImgDataEntity.java

@ -29,7 +29,7 @@ import java.util.Date;
* 中央区-事件数据图片数据
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-08-18
* @since v1.0.0 2020-08-21
*/
@Data
@EqualsAndHashCode(callSuper=false)

4
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/ScreenGovernRankDataEntity.java

@ -27,10 +27,10 @@ import java.math.BigDecimal;
import java.util.Date;
/**
* 基层治理-治理能力排行数据
* 基层治理-治理能力排行数据(按月统计)
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-08-18
* @since v1.0.0 2020-08-21
*/
@Data
@EqualsAndHashCode(callSuper=false)

8
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/ScreenIndexDataMonthlyEntity.java

@ -27,10 +27,10 @@ import java.math.BigDecimal;
import java.util.Date;
/**
* 指数-指数数据
* 指数-指数数据(每月数值)
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-08-18
* @since v1.0.0 2020-08-21
*/
@Data
@EqualsAndHashCode(callSuper=false)
@ -45,12 +45,12 @@ public class ScreenIndexDataMonthlyEntity extends BaseEpmetEntity {
private String customerId;
/**
* 年Id
* 年Id: yyyy
*/
private String yearId;
/**
* 月份Id
* 月份Id yyyyMM
*/
private String monthId;

2
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/ScreenIndexDataYearlyEntity.java

@ -30,7 +30,7 @@ import java.util.Date;
* 指数-指数数据(按年统计)
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-08-19
* @since v1.0.0 2020-08-21
*/
@Data
@EqualsAndHashCode(callSuper=false)

4
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/ScreenOrgRankDataEntity.java

@ -27,10 +27,10 @@ import java.math.BigDecimal;
import java.util.Date;
/**
* 党建引领-组织排行榜
* 党建引领-组织先进排行榜
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-08-18
* @since v1.0.0 2020-08-21
*/
@Data
@EqualsAndHashCode(callSuper=false)

15
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/ScreenPartyBranchDataEntity.java

@ -14,7 +14,6 @@
* 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.screen;
import com.baomidou.mybatisplus.annotation.TableName;
@ -26,10 +25,10 @@ import lombok.EqualsAndHashCode;
import java.util.Date;
/**
* 基层党建-建设情况数据支部联建,志愿服务
* 基层党建-建设情况数据支部联建,志愿服务)按月
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-08-18
* @since v1.0.0 2020-08-21
*/
@Data
@EqualsAndHashCode(callSuper=false)
@ -54,7 +53,7 @@ public class ScreenPartyBranchDataEntity extends BaseEpmetEntity {
private String monthId;
/**
* 数据类别 party:支部建设;union:联合建设党员志愿服务voluntaryservice
* 数据类别 party:支部建设; union:联合建设党员志愿服务voluntaryservice
*/
private String type;
@ -84,7 +83,7 @@ public class ScreenPartyBranchDataEntity extends BaseEpmetEntity {
private String meetCategoryId;
/**
* 会议分类名称
* 会议分类名称三会党课主题党日.....等等
*/
private String meetCategoryName;
@ -98,9 +97,9 @@ public class ScreenPartyBranchDataEntity extends BaseEpmetEntity {
*/
private Integer joinUserCount;
/**
* 平均参加人数
*/
/**
* 平均参加人数
*/
private Integer averageJoinUserCount;
}

9
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/ScreenPartyLinkMassesDataEntity.java

@ -29,7 +29,7 @@ import java.util.Date;
* 党建引领-党员联系群众数据
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-08-18
* @since v1.0.0 2020-08-21
*/
@Data
@EqualsAndHashCode(callSuper=false)
@ -64,7 +64,7 @@ public class ScreenPartyLinkMassesDataEntity extends BaseEpmetEntity {
private String orgName;
/**
* 建群总数
* 党员建群总数
*/
private Integer createGroupTotal;
@ -73,4 +73,9 @@ public class ScreenPartyLinkMassesDataEntity extends BaseEpmetEntity {
*/
private Integer groupUserTotal;
/**
* 数据更新至: yyyy|yyyyMM|yyyyMMdd(08-21新增)
*/
private String dataEndTime;
}

41
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/ScreenPartyUserRankDataEntity.java

@ -29,7 +29,7 @@ import java.util.Date;
* 党建引领基层治理-市民党员积分排行榜
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-08-18
* @since v1.0.0 2020-08-21
*/
@Data
@EqualsAndHashCode(callSuper=false)
@ -44,47 +44,47 @@ public class ScreenPartyUserRankDataEntity extends BaseEpmetEntity {
private String customerId;
/**
* 年Id
* 网格id
*/
private String yearId;
private String gridId;
/**
* 月份Id
* 组织名称
*/
private String monthId;
private String gridName;
/**
* 组织类别 agency组织部门department网格grid
* 网格所属的组织id
*/
private String orgType;
private String orgId;
/**
* 组织Id 可以为网格机关id
* 网格所属的组织名称
*/
private String orgId;
private String orgName;
/**
* 上级组织Id
* 是否是党员标志1是0不是党员
*/
private String parentId;
private Integer partyFlag;
/**
* 组织名称
* 用户Id
*/
private String orgName;
private String userId;
/**
* 用户身份 party:党员;resi居民
*
*/
private String userType;
private String surname;
/**
* 用户Id
*
*/
private String userId;
private String name;
/**
* 用户名称
* 姓名
*/
private String userName;
@ -93,4 +93,9 @@ public class ScreenPartyUserRankDataEntity extends BaseEpmetEntity {
*/
private Integer pointTotal;
/**
* 数据更新至: yyyy|yyyyMM|yyyyMMdd(08-21新增)
*/
private String dataEndTime;
}

43
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/ScreenPioneerDataEntity.java

@ -23,13 +23,14 @@ import com.epmet.commons.mybatis.entity.BaseEpmetEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.math.BigDecimal;
import java.util.Date;
/**
* 党建引领-先锋模范数据
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-08-18
* @since v1.0.0 2020-08-21
*/
@Data
@EqualsAndHashCode(callSuper=false)
@ -64,28 +65,58 @@ public class ScreenPioneerDataEntity extends BaseEpmetEntity {
private String orgName;
/**
* 用户总数
* 党员参与议事
*/
private Integer userTotal;
private Integer issueTotal;
/**
* 议事数
* 党员参与议事占比
*/
private Integer issueTotal;
private BigDecimal issueRatio;
/**
* 话题总数
* 党员发布话题
*/
private Integer topicTotal;
/**
* 党员发布话题占比
*/
private BigDecimal topicRatio;
/**
* 党员发布议题
*/
private Integer publishIssueTotal;
/**
* 党员发布议题占比
*/
private BigDecimal publishIssueRatio;
/**
* 议题转项目数
*/
private Integer shiftProjectTotal;
/**
* 议题转项目占比
*/
private BigDecimal shiftProjectRatio;
/**
* 解决项目总数
*/
private Integer resolvedProjectTotal;
/**
* 解决项目总数占比
*/
private BigDecimal resolvedProjectRatio;
/**
* 数据更新至: yyyy|yyyyMM|yyyyMMdd(08-21新增)
*/
private String dataEndTime;
}

67
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/ScreenUserJoinEntity.java

@ -30,7 +30,7 @@ import java.util.Date;
* 基层治理-公众参与
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-08-18
* @since v1.0.0 2020-08-21
*/
@Data
@EqualsAndHashCode(callSuper=false)
@ -44,16 +44,6 @@ public class ScreenUserJoinEntity extends BaseEpmetEntity {
*/
private String customerId;
/**
* 年Id
*/
private String yearId;
/**
* 月份Id
*/
private String monthId;
/**
* 组织类别 agency组织部门department网格grid
*/
@ -75,19 +65,58 @@ public class ScreenUserJoinEntity extends BaseEpmetEntity {
private String orgName;
/**
* 组织次数
* 数据更新至 年Id: yyyy
*/
private String yearId;
/**
* 数据更新至 月份Id :yyyyMM
*/
private Integer organizeTotal;
private String monthId;
/**
* 总的参与次数
*/
private String joinTotal;
/**
* 参与次数
*/
private Integer joinTotal;
/**
* 总的参与次数较上月增长率(采集的时候后台自己计算)
*/
private BigDecimal joinTotalUpRate;
/**
* 平均参与人数
* 增长incr下降decr 相等 eq
*/
private Integer avgJoinUser;
private String joinTotalUpFlag;
/**
* 人均议题
*/
private Integer avgIssue;
/**
* 人均议题较上月增长率(采集的时候后台自己计算)
*/
private BigDecimal avgIssueUpRate;
/**
* 增长incr下降decr 相等 eq
*/
private String avgIssueUpFlag;
/**
* 平均参与度
*/
private Integer avgJoin;
/**
* 平均参与度较上月增长率(采集的时候后台自己计算)
*/
private BigDecimal agvgJoinUpRate;
/**
* 增长incr下降decr 相等 eq
*/
private String agvgJoinUpFlag;
}

23
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/ScreenUserTotalDataEntity.java

@ -26,10 +26,10 @@ import lombok.EqualsAndHashCode;
import java.util.Date;
/**
* 中央区-各类用户总数
* 中央区-各类(用户|党员|党群|话题|议题|项目|注册人数|参与人数)总数
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-08-18
* @since v1.0.0 2020-08-21
*/
@Data
@EqualsAndHashCode(callSuper=false)
@ -44,7 +44,7 @@ public class ScreenUserTotalDataEntity extends BaseEpmetEntity {
private String customerId;
/**
* 组织类别 agency组织部门department网格grid
* 组织类别 agency组织网格grid部门department
*/
private String orgType;
@ -59,10 +59,15 @@ public class ScreenUserTotalDataEntity extends BaseEpmetEntity {
private String parentId;
/**
* 组织名称
* 组织名称也可能是网格名称
*/
private String orgName;
/**
* 数据更新至: yyyy|yyyyMM|yyyyMMdd(08-21新增)
*/
private String dataEndTime;
/**
* 用户总数
*/
@ -93,4 +98,14 @@ public class ScreenUserTotalDataEntity extends BaseEpmetEntity {
*/
private Integer projectTotal;
/**
* 注册人数08-21新增
*/
private Integer regUserTotal;
/**
* 参与人数08-21新增
*/
private Integer joinUserTotal;
}

272
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/model/IndexExcelDataListener.java

@ -0,0 +1,272 @@
package com.epmet.model;
import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.event.AnalysisEventListener;
import com.alibaba.fastjson.JSON;
import com.epmet.commons.tools.utils.UniqueIdGenerator;
import com.epmet.entity.screen.IndexDictEntity;
import com.epmet.entity.screen.IndexGroupDetailTemplateEntity;
import com.epmet.entity.screen.IndexGroupTemplateEntity;
import com.epmet.service.screen.IndexDictService;
import com.epmet.service.screen.IndexGroupDetailTemplateService;
import com.epmet.service.screen.IndexGroupTemplateService;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.*;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors;
/**
* 读取转换异常
*
* @author Jiaju Zhuang
*/
public class IndexExcelDataListener extends AnalysisEventListener<IndexModel> {
private static final Logger LOGGER = LoggerFactory.getLogger(IndexExcelDataListener.class);
/**
* 每隔5条存储数据库实际使用中可以3000条然后清理list 方便内存回收
*/
private static volatile boolean isGroup = false;
;
AtomicInteger total = new AtomicInteger(0);
Map<String, IndexDictEntity> indexDicMap = new HashMap<>();
Map<String, IndexGroupTemplateEntity> indexGroupMap = new HashMap<>();
Map<String, IndexGroupDetailTemplateEntity> indexGroupDetailMap = new HashMap<>();
List<IndexModel> indexModelList = new ArrayList<>();
private String preWheight;
private Integer wheightSum = 0;
/**
* 假设这个是一个DAO当然有业务逻辑这个也可以是一个service当然如果不用存储这个对象没用
*/
private IndexDictService indexDictService;
private IndexGroupTemplateService indexGroupTemplateService;
private IndexGroupDetailTemplateService indexGroupDetailTemplateService;
/**
* 如果使用了spring,请使用这个构造方法每次创建Listener的时候需要把spring管理的类传进来
*
* @param indexDictService
*/
public IndexExcelDataListener(IndexDictService indexDictService, IndexGroupTemplateService indexGroupTemplateService, IndexGroupDetailTemplateService indexGroupDetailTemplateService) {
this.indexDictService = indexDictService;
this.indexGroupTemplateService = indexGroupTemplateService;
this.indexGroupDetailTemplateService = indexGroupDetailTemplateService;
}
/**
* 这个每一条数据解析都会来调用
*
* @param data one row value. Is is same as {@link AnalysisContext#readRowHolder()}
* @param context
*/
@Override
public void invoke(IndexModel data, AnalysisContext context) {
if (data == null || data.getIsUsed() == null || data.getIsUsed() != 1) {
return;
}
//合并单元格的 权重 处理
String weight = data.getWeight();
if (StringUtils.isNotBlank(weight)) {
weight = weight.replace("%", "");
data.setWeight(weight);
preWheight = data.getWeight();
} else {
data.setWeight(preWheight);
}
LOGGER.info("解析到一条数据:{}", JSON.toJSONString(data));
IndexDictEntity entity = new IndexDictEntity();
IndexDictEntity entity2 = new IndexDictEntity();
IndexDictEntity entity3 = new IndexDictEntity();
IndexDictEntity entity4 = new IndexDictEntity();
IndexDictEntity entity5 = new IndexDictEntity();
indexModelList.add(data);
buildIndexDicEntity(data, entity, entity2, entity3, entity4, entity5);
buildIndexGroupEntity();
total.addAndGet(1);
// 达到BATCH_COUNT了,需要去存储一次数据库,防止数据几万条数据在内存,容易OOM
/*if (isGroup) {
saveData();
// 存储完成清理 list
list.clear();
}*/
}
private void buildIndexGroupEntity() {
List<IndexModel> collect = indexModelList.stream().sorted(Comparator.comparing(IndexModel::getLevel1Index)).collect(Collectors.toList());
collect.forEach(index -> {
if (index.getLevel1Index().equals("党员相关")) {
IndexDictEntity indexDictEntity = indexDicMap.get(index.getLevel1Index());
String level1GroupId = UniqueIdGenerator.generate();
IndexGroupTemplateEntity group1 = indexGroupMap.get(index.getLevel1Index());
if (group1 == null) {
group1 = new IndexGroupTemplateEntity();
group1.setIndexId(indexDictEntity.getId());
group1.setParentIndexGroupId("0");
group1.setId(level1GroupId);
indexGroupMap.put(index.getLevel1Index(), group1);
}
String level4Index = index.getLevel4Index();
indexDictEntity = indexDicMap.get(level4Index);
String level2GroupId = UniqueIdGenerator.generate();
IndexGroupTemplateEntity group2 = indexGroupMap.get(level4Index);
IndexGroupDetailTemplateEntity templateEntity = null;
if (group2 == null) {
group2 = new IndexGroupTemplateEntity();
group2.setIndexId(indexDictEntity.getId());
group2.setParentIndexGroupId(level1GroupId);
group2.setId(level2GroupId);
indexGroupMap.put(level4Index, group2);
//构建 分组明细
templateEntity = indexGroupDetailMap.get(level4Index);
if (templateEntity == null) {
buildIndexGroupDetail(indexDictEntity, index, group1.getId(), 2);
}
}
indexDictEntity = indexDicMap.get(index.getLevel5Index());
templateEntity = indexGroupDetailMap.get(index.getLevel5Index());
if (templateEntity == null) {
buildIndexGroupDetail(indexDictEntity, index, group2.getId(), 5);
}
} else {
//todo 测试完去掉
//if ("街道相关".equals(index.getLevel1Index())) {
IndexDictEntity indexDictEntity = indexDicMap.get(index.getLevel1Index());
String level1GroupId = UniqueIdGenerator.generate();
IndexGroupTemplateEntity group1 = indexGroupMap.get(index.getLevel1Index());
if (group1 == null) {
group1 = new IndexGroupTemplateEntity();
group1.setIndexId(indexDictEntity.getId());
group1.setParentIndexGroupId("0");
group1.setId(level1GroupId);
indexGroupMap.put(index.getLevel1Index(), group1);
}
String level2Index = index.getLevel2Index();
indexDictEntity = indexDicMap.get(level2Index);
String level2GroupId = UniqueIdGenerator.generate();
IndexGroupTemplateEntity group2 = indexGroupMap.get(level2Index);
IndexGroupDetailTemplateEntity templateEntity = null;
if (group2 == null) {
group2 = new IndexGroupTemplateEntity();
group2.setIndexId(indexDictEntity.getId());
group2.setParentIndexGroupId(level1GroupId);
group2.setId(level2GroupId);
indexGroupMap.put(level2Index, group2);
//构建 分组明细
templateEntity = indexGroupDetailMap.get(level2Index);
if (templateEntity == null) {
buildIndexGroupDetail(indexDictEntity, index, group1.getId(), 2);
}
}
indexDictEntity = indexDicMap.get(index.getLevel5Index());
templateEntity = indexGroupDetailMap.get(index.getLevel5Index());
if (templateEntity == null) {
buildIndexGroupDetail(indexDictEntity, index, group2.getId(), 5);
}
}
//}
});
LOGGER.info("所有指标分组数据解析完成:{}", JSON.toJSONString(indexGroupMap.values()));
LOGGER.info("所有指标分组明细数据解析完成:{}", JSON.toJSONString(indexGroupDetailMap.values()));
}
private void buildIndexGroupDetail(IndexDictEntity indexDictEntity, IndexModel index, String groupId, Integer level) {
IndexGroupDetailTemplateEntity templateEntity;
templateEntity = new IndexGroupDetailTemplateEntity();
templateEntity.setIndexGroupId(groupId);
templateEntity.setIndexId(indexDictEntity.getId());
if (level == 5) {
String level5WeightStr = index.getLevel5Weight().replace("%", "");
templateEntity.setWeight(new BigDecimal(level5WeightStr).divide(new BigDecimal(100), 4, RoundingMode.HALF_UP));
indexGroupDetailMap.put(index.getLevel5Index(), templateEntity);
} else {
indexGroupDetailMap.put(indexDictEntity.getIndexName(), templateEntity);
templateEntity.setWeight(new BigDecimal(index.getWeight()).divide(new BigDecimal(100), 4, RoundingMode.HALF_UP));
}
templateEntity.setId(UniqueIdGenerator.generate());
if (StringUtils.isNotBlank(index.getThreshold())) {
String thresholdStr = index.getThreshold().replace("%", "");
templateEntity.setThreshold(new BigDecimal(thresholdStr).divide(new BigDecimal(100), 4, RoundingMode.HALF_UP));
}
}
private void buildIndexDicEntity(IndexModel data, IndexDictEntity entity, IndexDictEntity entity2, IndexDictEntity entity3, IndexDictEntity entity4, IndexDictEntity entity5) {
if (!indexDicMap.containsKey(data.getLevel1Index())) {
entity.setId(UniqueIdGenerator.generate());
entity.setIndexName(data.getLevel1Index());
entity.setLevel("1");
indexDicMap.put(data.getLevel1Index(), entity);
}
if (!indexDicMap.containsKey(data.getLevel2Index())) {
entity2.setId(UniqueIdGenerator.generate());
entity2.setIndexName(data.getLevel2Index());
entity2.setLevel("2");
indexDicMap.put(data.getLevel2Index(), entity2);
}
if (!indexDicMap.containsKey(data.getLevel3Index())) {
entity3.setId(UniqueIdGenerator.generate());
entity3.setIndexName(data.getLevel3Index());
entity3.setLevel("3");
indexDicMap.put(data.getLevel3Index(), entity3);
}
if (!indexDicMap.containsKey(data.getLevel4Index())) {
entity4.setId(UniqueIdGenerator.generate());
entity4.setIndexName(data.getLevel4Index());
entity4.setLevel("4");
indexDicMap.put(data.getLevel4Index(), entity4);
}
if (!indexDicMap.containsKey(data.getLevel5Index())) {
entity5.setId(UniqueIdGenerator.generate());
entity5.setIndexName(data.getLevel5Index());
entity5.setLevel("5");
indexDicMap.put(data.getLevel5Index(), entity5);
}
}
/**
* 所有数据解析完成了 都会来调用
*
* @param context
*/
@Override
public void doAfterAllAnalysed(AnalysisContext context) {
// 这里也要保存数据,确保最后遗留的数据也存储到数据库
saveData();
LOGGER.info("所有数据解析完成!total:{}", total.intValue());
}
/**
* 加上存储数据库
*/
private void saveData() {
LOGGER.info("{}条数据,开始存储数据库!", indexDicMap.size());
indexDictService.deleteAndInsertBatch(indexDicMap.values());
buildIndexGroupEntity();
indexGroupTemplateService.deleteAndInsertBatch(indexGroupMap.values());
indexGroupDetailTemplateService.deleteAndInsertBatch(indexGroupDetailMap.values());
LOGGER.info("存储数据库成功!指标:{}个,分组:{}个,详情:{}个", indexDicMap.values().size(), indexGroupMap.values().size(), indexGroupDetailMap.values().size());
}
}

26
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/model/IndexModel.java

@ -0,0 +1,26 @@
package com.epmet.model;
import com.alibaba.excel.annotation.ExcelProperty;
import lombok.Data;
@Data
public class IndexModel {
@ExcelProperty(value = "一级指标")
private String level1Index;
@ExcelProperty(value = "二级指标")
private String level2Index;
@ExcelProperty(value = "三级指标")
private String level3Index;
@ExcelProperty(value = "四级指标")
private String level4Index;
@ExcelProperty(value = "五级指标")
private String level5Index;
@ExcelProperty(value = "是否采用")
private Integer isUsed;
@ExcelProperty(value = "权重")
private String weight;
@ExcelProperty(value = "五级权重")
private String level5Weight;
@ExcelProperty(value = "阈值")
private String threshold;
}

54
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/model/ParseIndexExcelResult.java

@ -0,0 +1,54 @@
package com.epmet.model;
import lombok.Data;
import java.io.Serializable;
import java.util.HashSet;
import java.util.Objects;
import java.util.Set;
@Data
public class ParseIndexExcelResult implements Serializable {
private String id;
private String groupId;
/**
* 当前指标关联的上一级指标分组如果没有上一级则为0
*/
private String parentIndexGroupId;
/**
* 指标编码(唯一)
*/
private String indexCode;
/**
* 指标名
*/
private String indexName;
/**
* 指标描述
*/
private String indexDesc;
/**
* 指标级别1,2,3,4,5
*/
private String level;
private Set<ParseIndexExcelResult> children = new HashSet<>();
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
ParseIndexExcelResult that = (ParseIndexExcelResult) o;
return indexCode.equals(that.indexCode) &&
indexName.equals(that.indexName) &&
level.equals(that.level);
}
@Override
public int hashCode() {
return Objects.hash(indexCode, indexName, indexDesc, level);
}
}

20
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/indexcollect/impl/FactIndexCollectServiceImpl.java

@ -39,7 +39,9 @@ public class FactIndexCollectServiceImpl implements FactIndexCollectService {
public void insertGridPartyMemberData(List<GridPartyMemberDataFormDTO> formDTO, String customerId) {
if (null != formDTO && formDTO.size() > NumConstant.ZERO){
for (int i = NumConstant.ZERO; i < formDTO.size(); i++){
factIndexPartyAblityCpcMonthlyDao.deleteFactIndexPartyAblityCpcMonthly(formDTO.get(i), customerId);
factIndexPartyAblityCpcMonthlyDao.deleteFactIndexPartyAblityCpcMonthly(customerId,
formDTO.get(i).getAgencyId(), formDTO.get(i).getGridId(), formDTO.get(i).getUserId(),
formDTO.get(i).getYearId(), formDTO.get(i).getMonthId(), formDTO.get(i).getQuarterId());
}
factIndexPartyAblityCpcMonthlyDao.batchInsertFactIndexPartyAblityCpcMonthly(formDTO, customerId);
}
@ -50,7 +52,9 @@ public class FactIndexCollectServiceImpl implements FactIndexCollectService {
public void insertGridPartyAbility(List<GridPartyAbilityFormDTO> formDTO, String customerId) {
if (null != formDTO && formDTO.size() > NumConstant.ZERO){
for (int i = NumConstant.ZERO; i < formDTO.size(); i++){
factIndexPartyAblityGridMonthlyDao.deleteFactIndexPartyAblityGridMonthly(formDTO.get(i), customerId);
factIndexPartyAblityGridMonthlyDao.deleteFactIndexPartyAblityGridMonthly(customerId,
formDTO.get(i).getAgencyId(), formDTO.get(i).getGridId(), formDTO.get(i).getYearId(),
formDTO.get(i).getMonthId(), formDTO.get(i).getQuarterId());
}
factIndexPartyAblityGridMonthlyDao.batchInsertFactIndexPartyAblityGridMonthly(formDTO, customerId);
}
@ -78,7 +82,9 @@ public class FactIndexCollectServiceImpl implements FactIndexCollectService {
public void insertGridServiceAbility(List<GridServiceAbilityFormDTO> formDTO, String customerId) {
if (null != formDTO && formDTO.size() > NumConstant.ZERO){
for (int i = NumConstant.ZERO; i < formDTO.size(); i++){
factIndexServiceAblityGridMonthlyDao.deleteFactIndexServiceAblityGridMonthly(formDTO.get(i), customerId);
factIndexServiceAblityGridMonthlyDao.deleteFactIndexServiceAblityGridMonthly(customerId,
formDTO.get(i).getAgencyId(), formDTO.get(i).getGridId(), formDTO.get(i).getYearId(),
formDTO.get(i).getMonthId(), formDTO.get(i).getQuarterId());
}
factIndexServiceAblityGridMonthlyDao.batchInsertFactIndexServiceAblityGridMonthly(formDTO, customerId);
}
@ -106,7 +112,9 @@ public class FactIndexCollectServiceImpl implements FactIndexCollectService {
public void insertGridGovrnAbility(List<GridGovrnAbilityFormDTO> formDTO, String customerId) {
if (null != formDTO && formDTO.size() > NumConstant.ZERO){
for (int i = NumConstant.ZERO; i < formDTO.size(); i++){
factIndexGovrnAblityGridMonthlyDao.deleteFactIndexGovrnAblityGridMonthly(formDTO.get(i), customerId);
factIndexGovrnAblityGridMonthlyDao.deleteFactIndexGovrnAblityGridMonthly(customerId,
formDTO.get(i).getAgencyId(), formDTO.get(i).getGridId(), formDTO.get(i).getYearId(),
formDTO.get(i).getMonthId(), formDTO.get(i).getQuarterId());
}
factIndexGovrnAblityGridMonthlyDao.batchInsertFactIndexGovrnAblityGridMonthly(formDTO, customerId);
}
@ -134,7 +142,9 @@ public class FactIndexCollectServiceImpl implements FactIndexCollectService {
public void insertDeptGovrnAbility(List<DeptGovrnAbilityFormDTO> formDTO, String customerId) {
if (null != formDTO && formDTO.size() > NumConstant.ZERO){
for (int i = NumConstant.ZERO; i < formDTO.size(); i++){
factIndexGovrnAblityDeptMonthlyDao.deleteFactIndexGovrnAblityDeptMonthly(formDTO.get(i), customerId);
factIndexGovrnAblityDeptMonthlyDao.deleteFactIndexGovrnAblityDeptMonthly(customerId,
formDTO.get(i).getAgencyId(), formDTO.get(i).getDeptId(), formDTO.get(i).getYearId(),
formDTO.get(i).getMonthId(), formDTO.get(i).getQuarterId());
}
factIndexGovrnAblityDeptMonthlyDao.batchInsertFactIndexGovrnAblityDeptMonthly(formDTO, customerId);
}

34
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/screen/IndexDictService.java

@ -0,0 +1,34 @@
/**
* 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.service.screen;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.entity.screen.IndexDictEntity;
import java.util.Collection;
/**
* 评价指标字典
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-08-19
*/
public interface IndexDictService extends BaseService<IndexDictEntity> {
Boolean deleteAndInsertBatch(Collection<IndexDictEntity> values);
}

31
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/screen/IndexGroupDetailService.java

@ -0,0 +1,31 @@
/**
* 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.service.screen;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.entity.screen.IndexGroupDetailEntity;
/**
* 客户指标详情
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-08-19
*/
public interface IndexGroupDetailService extends BaseService<IndexGroupDetailEntity> {
}

34
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/screen/IndexGroupDetailTemplateService.java

@ -0,0 +1,34 @@
/**
* 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.service.screen;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.entity.screen.IndexGroupDetailTemplateEntity;
import java.util.Collection;
/**
* 客户指标详情
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-08-19
*/
public interface IndexGroupDetailTemplateService extends BaseService<IndexGroupDetailTemplateEntity> {
Boolean deleteAndInsertBatch(Collection<IndexGroupDetailTemplateEntity> values);
}

31
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/screen/IndexGroupService.java

@ -0,0 +1,31 @@
/**
* 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.service.screen;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.entity.screen.IndexGroupEntity;
/**
* 客户指标分组
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-08-19
*/
public interface IndexGroupService extends BaseService<IndexGroupEntity> {
}

34
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/screen/IndexGroupTemplateService.java

@ -0,0 +1,34 @@
/**
* 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.service.screen;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.entity.screen.IndexGroupTemplateEntity;
import java.util.Collection;
/**
* 默认指标分组
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-08-19
*/
public interface IndexGroupTemplateService extends BaseService<IndexGroupTemplateEntity> {
Boolean deleteAndInsertBatch(Collection<IndexGroupTemplateEntity> values);
}

43
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/screen/impl/IndexDictServiceImpl.java

@ -0,0 +1,43 @@
/**
* 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.service.screen.impl;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.dao.screen.IndexDictDao;
import com.epmet.entity.screen.IndexDictEntity;
import com.epmet.service.screen.IndexDictService;
import org.springframework.stereotype.Service;
import java.util.Collection;
/**
* 评价指标字典
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-08-19
*/
@Service
public class IndexDictServiceImpl extends BaseServiceImpl<IndexDictDao, IndexDictEntity> implements IndexDictService {
@Override
public Boolean deleteAndInsertBatch(Collection<IndexDictEntity> values) {
int n = baseDao.deleteAll();
return this.insertBatch(values,10);
}
}

36
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/screen/impl/IndexGroupDetailServiceImpl.java

@ -0,0 +1,36 @@
/**
* 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.service.screen.impl;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.dao.screen.IndexGroupDetailDao;
import com.epmet.entity.screen.IndexGroupDetailEntity;
import com.epmet.service.screen.IndexGroupDetailService;
import org.springframework.stereotype.Service;
/**
* 客户指标详情
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-08-19
*/
@Service
public class IndexGroupDetailServiceImpl extends BaseServiceImpl<IndexGroupDetailDao, IndexGroupDetailEntity> implements IndexGroupDetailService {
}

42
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/screen/impl/IndexGroupDetailTemplateServiceImpl.java

@ -0,0 +1,42 @@
/**
* 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.service.screen.impl;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.dao.screen.IndexGroupDetailTemplateDao;
import com.epmet.entity.screen.IndexGroupDetailTemplateEntity;
import com.epmet.service.screen.IndexGroupDetailTemplateService;
import org.springframework.stereotype.Service;
import java.util.Collection;
/**
* 客户指标详情
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-08-19
*/
@Service
public class IndexGroupDetailTemplateServiceImpl extends BaseServiceImpl<IndexGroupDetailTemplateDao, IndexGroupDetailTemplateEntity> implements IndexGroupDetailTemplateService {
@Override
public Boolean deleteAndInsertBatch(Collection<IndexGroupDetailTemplateEntity> values) {
baseDao.deleteAll();
return this.insertBatch(values, 10);
}
}

35
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/screen/impl/IndexGroupServiceImpl.java

@ -0,0 +1,35 @@
/**
* 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.service.screen.impl;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.dao.screen.IndexGroupDao;
import com.epmet.entity.screen.IndexGroupEntity;
import com.epmet.service.screen.IndexGroupService;
import org.springframework.stereotype.Service;
/**
* 客户指标分组
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-08-19
*/
@Service
public class IndexGroupServiceImpl extends BaseServiceImpl<IndexGroupDao, IndexGroupEntity> implements IndexGroupService {
}

43
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/screen/impl/IndexGroupTemplateServiceImpl.java

@ -0,0 +1,43 @@
/**
* 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.service.screen.impl;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.dao.screen.IndexGroupTemplateDao;
import com.epmet.entity.screen.IndexGroupTemplateEntity;
import com.epmet.service.screen.IndexGroupTemplateService;
import org.springframework.stereotype.Service;
import java.util.Collection;
/**
* 客户指标分组
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-08-19
*/
@Service
public class IndexGroupTemplateServiceImpl extends BaseServiceImpl<IndexGroupTemplateDao, IndexGroupTemplateEntity> implements IndexGroupTemplateService {
@Override
public Boolean deleteAndInsertBatch(Collection<IndexGroupTemplateEntity> values) {
baseDao.deleteAll();
return this.insertBatch(values, 10);
}
}

17
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/util/ExcelListener.java

@ -0,0 +1,17 @@
package com.epmet.util;
import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.event.AnalysisEventListener;
import org.apache.poi.ss.formula.functions.T;
public class ExcelListener extends AnalysisEventListener<T> {
@Override
public void invoke(T t, AnalysisContext analysisContext) {
}
@Override
public void doAfterAllAnalysed(AnalysisContext analysisContext) {
System.out.println(analysisContext);
}
}

35
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/util/TestFileUtil.java

@ -0,0 +1,35 @@
package com.epmet.util;
import java.io.File;
import java.io.InputStream;
public class TestFileUtil {
public static InputStream getResourcesFileInputStream(String fileName) {
return Thread.currentThread().getContextClassLoader().getResourceAsStream("" + fileName);
}
public static String getPath() {
return TestFileUtil.class.getResource("/").getPath();
}
public static File createNewFile(String pathName) {
File file = new File(getPath() + pathName);
if (file.exists()) {
file.delete();
} else {
if (!file.getParentFile().exists()) {
file.getParentFile().mkdirs();
}
}
return file;
}
public static File readFile(String pathName) {
return new File(getPath() + pathName);
}
public static File readUserHomeFile(String pathName) {
return new File(System.getProperty("user.home") + File.separator + pathName);
}
}

3
epmet-module/data-statistical/data-statistical-server/src/main/resources/db/migration/V0.0.3__update_col_data_type.sql

@ -0,0 +1,3 @@
alter table fact_index_party_ablity_org_monthly MODIFY column DATA_TYPE VARCHAR(100) DEFAULT '' COMMENT '数据类型 allRegion:全区;community:社区;street:街道';
alter table fact_index_service_ablity_org_monthly MODIFY column DATA_TYPE VARCHAR(100) DEFAULT '' COMMENT '数据类型 allRegion:全区;community:社区;street:街道';
alter table fact_index_govrn_ablity_org_monthly MODIFY column DATA_TYPE VARCHAR(100) DEFAULT '' COMMENT '数据类型 allRegion:全区;community:社区;street:街道';

2
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/indexcoll/FactIndexGovrnAblityGridMonthlyDao.xml

@ -29,7 +29,7 @@
<delete id="deleteFactIndexGovrnAblityGridMonthly">
delete from fact_index_govrn_ablity_grid_monthly
where CUSTOMER_ID = #{customerId} AND AGENCY_ID = #{agencyId} AND GRID_ID = #{gridId} AND USER_ID = #{userId}
where CUSTOMER_ID = #{customerId} AND AGENCY_ID = #{agencyId} AND GRID_ID = #{gridId}
AND YEAR_ID = #{yearId} AND MONTH_ID = #{monthId} AND QUARTER_ID = #{quarterId}
</delete>

8
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/screen/IndexDictDao.xml

@ -0,0 +1,8 @@
<?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.screen.IndexDictDao">
<delete id="deleteAll">
delete from index_dict
</delete>
</mapper>

7
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/screen/IndexGroupDao.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.screen.IndexGroupDao">
</mapper>

6
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/screen/IndexGroupDetailDao.xml

@ -0,0 +1,6 @@
<?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.screen.IndexGroupDetailDao">
</mapper>

9
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/screen/IndexGroupDetailTemplateDao.xml

@ -0,0 +1,9 @@
<?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.screen.IndexGroupDetailTemplateDao">
<delete id="deleteAll">
delete from index_group_detail_template
</delete>
</mapper>

8
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/screen/IndexGroupTemplateDao.xml

@ -0,0 +1,8 @@
<?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.screen.IndexGroupTemplateDao">
<delete id="deleteAll">
delete from index_group_template
</delete>
</mapper>

15
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/screen/ScreenPioneerDataDao.xml

@ -21,11 +21,16 @@
ORG_ID,
PARENT_ID,
ORG_NAME,
USER_TOTAL,
PUBLISH_ISSUE_TOTAL,
ISSUE_TOTAL,
TOPIC_TOTAL,
SHIFT_PROJECT_TOTAL,
RESOLVED_PROJECT_TOTAL,
PUBLISH_ISSUE_RATIO,
ISSUE_RATIO,
TOPIC_RATIO,
SHIFT_PROJECT_RATIO,
RESOLVED_PROJECT_TOTAL_RATIO,
DEL_FLAG,
REVISION,
CREATED_BY,
@ -41,11 +46,17 @@
#{item.orgId},
#{item.parentId},
#{item.orgName},
#{item.userTotal},
#{item.publishIssueTotal},
#{item.issueTotal},
#{item.topicTotal},
#{item.shiftProjectTotal},
#{item.resolvedProjectTotal},
#{item.issueRatio},
#{item.topicRatio},
#{item.shiftProjectRatio},
#{item.resolvedProjectRatio},
#{item.publishIssueRatio},
0,
0,
'APP_USER',

17
epmet-module/data-statistical/data-statistical-server/src/test/java/com/epmet/stats/test/model/DemoData.java

@ -0,0 +1,17 @@
package com.epmet.stats.test.model;
import lombok.Data;
import java.util.Date;
/**
* 基础数据类.这里的排序和excel里面的排序一致
*
* @author Jiaju Zhuang
**/
@Data
public class DemoData {
private String string;
private Date date;
private Double doubleData;
}

84
epmet-module/data-statistical/data-statistical-server/src/test/java/com/epmet/stats/test/model/DemoDataListener.java

@ -0,0 +1,84 @@
package com.epmet.stats.test.model;
import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.event.AnalysisEventListener;
import com.alibaba.fastjson.JSON;
import com.epmet.dao.screen.ScreenCustomerAgencyDao;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.ArrayList;
import java.util.List;
/**
* 模板的读取类
*
* @author Jiaju Zhuang
*/
// 有个很重要的点 DemoDataListener 不能被spring管理,要每次读取excel都要new,然后里面用到spring可以构造方法传进去
public class DemoDataListener extends AnalysisEventListener<DemoData> {
private static final Logger LOGGER = LoggerFactory.getLogger(DemoDataListener.class);
/**
* 每隔5条存储数据库实际使用中可以3000条然后清理list 方便内存回收
*/
private static final int BATCH_COUNT = 5;
List<DemoData> list = new ArrayList<DemoData>();
/**
* 假设这个是一个DAO当然有业务逻辑这个也可以是一个service当然如果不用存储这个对象没用
*/
private ScreenCustomerAgencyDao demoDAO;
public DemoDataListener() {
// 这里是demo,所以随便new一个。实际使用如果到了spring,请使用下面的有参构造函数
demoDAO = null;
}
/**
* 如果使用了spring,请使用这个构造方法每次创建Listener的时候需要把spring管理的类传进来
*
* @param demoDAO
*/
public DemoDataListener(ScreenCustomerAgencyDao demoDAO) {
this.demoDAO = demoDAO;
}
/**
* 这个每一条数据解析都会来调用
*
* @param data
* one row value. Is is same as {@link AnalysisContext#readRowHolder()}
* @param context
*/
@Override
public void invoke(DemoData data, AnalysisContext context) {
LOGGER.info("解析到一条数据:{}", JSON.toJSONString(data));
list.add(data);
// 达到BATCH_COUNT了,需要去存储一次数据库,防止数据几万条数据在内存,容易OOM
if (list.size() >= BATCH_COUNT) {
saveData();
// 存储完成清理 list
list.clear();
}
}
/**
* 所有数据解析完成了 都会来调用
*
* @param context
*/
@Override
public void doAfterAllAnalysed(AnalysisContext context) {
// 这里也要保存数据,确保最后遗留的数据也存储到数据库
saveData();
LOGGER.info("所有数据解析完成!");
}
/**
* 加上存储数据库
*/
private void saveData() {
LOGGER.info("{}条数据,开始存储数据库!", list.size());
//demoDAO.save(list);
LOGGER.info("存储数据库成功!");
}
}

30
epmet-module/data-statistical/data-statistical-server/src/test/java/com/epmet/stats/test/read/ConverterData.java

@ -0,0 +1,30 @@
package com.epmet.stats.test.read;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.format.DateTimeFormat;
import com.alibaba.excel.annotation.format.NumberFormat;
import lombok.Data;
/**
* 基础数据类.这里的排序和excel里面的排序一致
*
* @author Jiaju Zhuang
**/
@Data
public class ConverterData {
/**
* 我自定义 转换器不管数据库传过来什么 我给他加上自定义
*/
@ExcelProperty(converter = CustomStringStringConverter.class)
private String string;
/**
* 这里用string 去接日期才能格式化我想接收年月日格式
*/
@DateTimeFormat("yyyy年MM月dd日HH时mm分ss秒")
private String date;
/**
* 我想接收百分比的数字
*/
@NumberFormat("#.##%")
private String doubleData;
}

48
epmet-module/data-statistical/data-statistical-server/src/test/java/com/epmet/stats/test/read/ConverterDataListener.java

@ -0,0 +1,48 @@
package com.epmet.stats.test.read;
import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.event.AnalysisEventListener;
import com.alibaba.fastjson.JSON;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.ArrayList;
import java.util.List;
/**
* 模板的读取类
*
* @author Jiaju Zhuang
*/
public class ConverterDataListener extends AnalysisEventListener<ConverterData> {
private static final Logger LOGGER = LoggerFactory.getLogger(ConverterDataListener.class);
/**
* 每隔5条存储数据库实际使用中可以3000条然后清理list 方便内存回收
*/
private static final int BATCH_COUNT = 5;
List<ConverterData> list = new ArrayList<ConverterData>();
@Override
public void invoke(ConverterData data, AnalysisContext context) {
LOGGER.info("解析到一条数据:{}", JSON.toJSONString(data));
list.add(data);
if (list.size() >= BATCH_COUNT) {
saveData();
list.clear();
}
}
@Override
public void doAfterAllAnalysed(AnalysisContext context) {
saveData();
LOGGER.info("所有数据解析完成!");
}
/**
* 加上存储数据库
*/
private void saveData() {
LOGGER.info("{}条数据,开始存储数据库!", list.size());
LOGGER.info("存储数据库成功!");
}
}

59
epmet-module/data-statistical/data-statistical-server/src/test/java/com/epmet/stats/test/read/CustomStringStringConverter.java

@ -0,0 +1,59 @@
package com.epmet.stats.test.read;
import com.alibaba.excel.converters.Converter;
import com.alibaba.excel.enums.CellDataTypeEnum;
import com.alibaba.excel.metadata.CellData;
import com.alibaba.excel.metadata.GlobalConfiguration;
import com.alibaba.excel.metadata.property.ExcelContentProperty;
/**
* String and string converter
*
* @author Jiaju Zhuang
*/
public class CustomStringStringConverter implements Converter<String> {
@Override
public Class supportJavaTypeKey() {
return String.class;
}
@Override
public CellDataTypeEnum supportExcelTypeKey() {
return CellDataTypeEnum.STRING;
}
/**
* 这里读的时候会调用
*
* @param cellData
* NotNull
* @param contentProperty
* Nullable
* @param globalConfiguration
* NotNull
* @return
*/
@Override
public String convertToJavaData(CellData cellData, ExcelContentProperty contentProperty,
GlobalConfiguration globalConfiguration) {
return "自定义:" + cellData.getStringValue();
}
/**
* 这里是写的时候会调用 不用管
*
* @param value
* NotNull
* @param contentProperty
* Nullable
* @param globalConfiguration
* NotNull
* @return
*/
@Override
public CellData convertToExcelData(String value, ExcelContentProperty contentProperty,
GlobalConfiguration globalConfiguration) {
return new CellData(value);
}
}

15
epmet-module/data-statistical/data-statistical-server/src/test/java/com/epmet/stats/test/read/DemoDAO.java

@ -0,0 +1,15 @@
package com.epmet.stats.test.read;
import java.util.List;
/**
* 假设这个是你的DAO存储当然还要这个类让spring管理当然你不用需要存储也不需要这个类
*
* @author Jiaju Zhuang
**/
public class DemoDAO {
public void save(List<DemoData> list) {
// 如果是mybatis,尽量别直接调用多次insert,自己写一个mapper里面新增一个方法batchInsert,所有数据一次性插入
}
}

Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save