Browse Source

Merge branch 'dev_third_data' into dev_temp

# Conflicts:
#	epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/dao/ProjectSatisfactionStatisticsDao.java
#	epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/entity/ProjectSatisfactionStatisticsEntity.java
#	epmet-module/gov-project/gov-project-server/src/main/resources/mapper/ProjectSatisfactionStatisticsDao.xml
dev_shibei_match
sunyuchao 5 years ago
parent
commit
bd5b3d8379
  1. 1
      epmet-cloud-generator/src/main/java/io/renren/GeneratorApplication.java
  2. 3
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/Constant.java
  3. 18
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/DateUtils.java
  4. 2
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/constant/DataSourceConstant.java
  5. 29
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/datastats/form/AgenctBasicDataFormDTO.java
  6. 40
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/datastats/form/SubAgencyFormDTO.java
  7. 40
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/datastats/form/SubGridFormDTO.java
  8. 94
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/datastats/result/AgencyBasicDataResultDTO.java
  9. 33
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/datastats/result/SubAgencyGroupResultDTO.java
  10. 37
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/datastats/result/SubAgencyIssueResultDTO.java
  11. 33
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/datastats/result/SubAgencyProjectResultDTO.java
  12. 37
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/datastats/result/SubAgencyTopicResultDTO.java
  13. 33
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/datastats/result/SubAgencyUserResultDTO.java
  14. 33
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/datastats/result/SubGridGroupResultDTO.java
  15. 37
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/datastats/result/SubGridIssueResultDTO.java
  16. 33
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/datastats/result/SubGridProjectResultDTO.java
  17. 37
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/datastats/result/SubGridTopicResultDTO.java
  18. 33
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/datastats/result/SubGridUserResultDTO.java
  19. 28
      epmet-module/data-aggregator/data-aggregator-server/pom.xml
  20. 150
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/DataStatsController.java
  21. 157
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/datastats/DataStatsDao.java
  22. 78
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/datastats/DimAgencyEntity.java
  23. 49
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/datastats/DimCustomerEntity.java
  24. 59
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/datastats/DimGridEntity.java
  25. 94
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/datastats/DataStatsService.java
  26. 632
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/datastats/impl/DataStatsServiceImpl.java
  27. 5
      epmet-module/data-aggregator/data-aggregator-server/src/main/resources/bootstrap.yml
  28. 317
      epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/datastats/DatsStatsDao.xml
  29. 122
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/index/dto/IndexExplainDTO.java
  30. 97
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/index/dto/IndexExplainTreeDTO.java
  31. 52
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/index/form/IndexExplainFormDTO.java
  32. 40
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/index/form/IndexScoreFormDTO.java
  33. 25
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/index/result/IndexExplainChildResult.java
  34. 48
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/index/result/IndexExplainResult.java
  35. 92
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/index/result/IndexGroupDetailResult.java
  36. 49
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/index/result/IndexScoreDetailResult.java
  37. 40
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/index/result/IndexScoreResult.java
  38. 74
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/constant/IndexConstant.java
  39. 62
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/index/IndexExplainController.java
  40. 0
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/.gitignore
  41. 36
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/index/IndexExplainDao.java
  42. 33
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/index/IndexGroupDao.java
  43. 45
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/index/IndexGroupDetailDao.java
  44. 33
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/fact/FactIndexCpcScoreDao.java
  45. 38
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/fact/FactIndexCpcSubScoreDao.java
  46. 12
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/fact/FactIndexGridSubScoreDao.java
  47. 98
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/entity/evaluationindex/FactIndexCpcScoreEntity.java
  48. 98
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/entity/evaluationindex/FactIndexCpcSubScoreEntity.java
  49. 90
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/entity/evaluationindex/IndexGroupDetailEntity.java
  50. 68
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/entity/evaluationindex/IndexGroupEntity.java
  51. 42
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/index/IndexExplainService.java
  52. 191
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/index/impl/IndexExplainServiceImpl.java
  53. 28
      epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexCpcScoreDao.xml
  54. 43
      epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexCpcSubScoreDao.xml
  55. 32
      epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexGridSubScoreDao.xml
  56. 0
      epmet-module/data-report/data-report-server/src/main/resources/mapper/index/IndexDictDao.xml
  57. 41
      epmet-module/data-report/data-report-server/src/main/resources/mapper/index/IndexExplainDao.xml
  58. 23
      epmet-module/data-report/data-report-server/src/main/resources/mapper/index/IndexGroupDao.xml
  59. 36
      epmet-module/data-report/data-report-server/src/main/resources/mapper/index/IndexGroupDetailDao.xml
  60. 146
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/FactOriginGroupMemberDailyDTO.java
  61. 5
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/result/PartyMemberInfoResultDTO.java
  62. 70
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/group/ActCategoryDictDTO.java
  63. 4
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/group/form/GroupTotalFormDTO.java
  64. 20
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcollect/result/PartyJoinThreeMeetDTO.java
  65. 187
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/FactAgencyOriginProjectDailyDTO.java
  66. 172
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/FactAgencyOriginProjectMonthlyDTO.java
  67. 9
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java
  68. 4
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/FactOriginExtractController.java
  69. 38
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactGroupActDailyDao.java
  70. 33
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactGroupActMonthlyDao.java
  71. 6
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginGroupMainDailyDao.java
  72. 33
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginGroupMemberDailyDao.java
  73. 51
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/group/GroupDataDao.java
  74. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/org/StatsCustomerAgencyDao.java
  75. 8
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/DimCustomerPartymemberDao.java
  76. 33
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/FactAgencyOriginProjectDailyDao.java
  77. 33
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/FactAgencyOriginProjectMonthlyDao.java
  78. 100
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/extract/FactGroupActDailyEntity.java
  79. 100
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/extract/FactGroupActMonthlyEntity.java
  80. 5
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/extract/FactOriginGroupMainDailyEntity.java
  81. 116
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/extract/FactOriginGroupMemberDailyEntity.java
  82. 157
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/stats/FactAgencyOriginProjectDailyEntity.java
  83. 142
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/stats/FactAgencyOriginProjectMonthlyEntity.java
  84. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/StatsGroupService.java
  85. 31
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/dataToIndex/impl/CalCpcIndexServiceImpl.java
  86. 67
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/dataToIndex/impl/CalGridIndexServiceImpl.java
  87. 48
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactGroupActDailyService.java
  88. 31
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactGroupActMonthlyService.java
  89. 9
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginGroupMainDailyService.java
  90. 95
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginGroupMemberDailyService.java
  91. 165
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactGroupActDailyServiceImpl.java
  92. 41
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactGroupActMonthlyServiceImpl.java
  93. 75
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginExtractServiceImpl.java
  94. 27
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginGroupMainDailyServiceImpl.java
  95. 101
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginGroupMemberDailyServiceImpl.java
  96. 7
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/GroupExtractServiceImpl.java
  97. 53
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/group/GroupDataService.java
  98. 87
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/group/impl/GroupDataServiceImpl.java
  99. 69
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsGroupServiceImpl.java
  100. 3
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/CustomerAgencyService.java

1
epmet-cloud-generator/src/main/java/io/renren/GeneratorApplication.java

@ -8,5 +8,6 @@ public class GeneratorApplication {
public static void main(String[] args) {
SpringApplication.run(GeneratorApplication.class, args);
System.out.println("http://localhost:8070/epmet-cloud-generator/#generator.html");
}
}

3
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/Constant.java

@ -8,6 +8,7 @@
package com.epmet.commons.tools.constant;
/**
* 常量
*
@ -133,4 +134,6 @@ public interface Constant {
* 创建时间字段名
*/
String CREATED_TIME = "created_time";
String DEFAULT_CUSTOMER = "default";
}

18
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/DateUtils.java

@ -800,4 +800,22 @@ public class DateUtils {
}
return date;
}
/**
* 格式化日期
* @param dateStr String 字符型日期
* @param format String 格式
* @return Date 日期
*/
public static Date parseDate(String dateStr, String format) {
Date date = null;
try {
DateFormat dateFormat = new SimpleDateFormat(format);
date = dateFormat.parse(dateStr);
} catch (Exception e) {
e.printStackTrace();
}
return date;
}
}

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

@ -26,4 +26,6 @@ public interface DataSourceConstant {
String EPMET_COMMON_SERVICE="commonservice";
String OPER_CRM="opercrm";
String DATA_STATISTICAL="datastatistical";
}

29
epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/datastats/form/AgenctBasicDataFormDTO.java

@ -0,0 +1,29 @@
package com.epmet.dataaggre.dto.datastats.form;
import com.epmet.commons.tools.validator.group.CustomerClientShowGroup;
import com.epmet.dataaggre.dto.resigroup.form.CandidateListFormDTO;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* @Description 基础数据-组织各种数据汇总-接口入参
* @Auth sun
*/
@Data
public class AgenctBasicDataFormDTO implements Serializable {
private static final long serialVersionUID = -3381286960911634231L;
/**
* 组织Id
*/
@NotBlank(message = "组织ID不能为空",groups = AgenctBasicDataFormDTO.Agency.class)
private String agencyId;
/**
* 日维度Id
*/
private String dateId;
public interface Agency extends CustomerClientShowGroup{}
}

40
epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/datastats/form/SubAgencyFormDTO.java

@ -0,0 +1,40 @@
package com.epmet.dataaggre.dto.datastats.form;
import com.epmet.commons.tools.validator.group.CustomerClientShowGroup;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* @Description 基础数据-组织直属下级数据汇总-接口入参
* @Auth sun
*/
@Data
public class SubAgencyFormDTO implements Serializable {
private static final long serialVersionUID = -3381286960911634231L;
/**
* 组织Id
*/
@NotBlank(message = "组织ID不能为空",groups = SubAgencyFormDTO.Agency.class)
private String agencyId;
/**
* 日维度Id
*/
private String dateId;
public interface Agency extends CustomerClientShowGroup{}
@Data
public static class Topic implements Serializable {
//组织Id
private String agencyId;
//话题数量
private Integer topicCount;
//话题状态 已关闭:closed、已屏蔽:hidden、 讨论中:discussing
private String topicStatus;
//话题已转议题数量
private Integer shiftedIssueTotal;
}
}

40
epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/datastats/form/SubGridFormDTO.java

@ -0,0 +1,40 @@
package com.epmet.dataaggre.dto.datastats.form;
import com.epmet.commons.tools.validator.group.CustomerClientShowGroup;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* @Description 基础数据-组织直属网格数据汇总-接口入参
* @Auth sun
*/
@Data
public class SubGridFormDTO implements Serializable {
private static final long serialVersionUID = -3381286960911634231L;
/**
* 组织Id
*/
@NotBlank(message = "组织ID不能为空",groups = SubGridFormDTO.Agency.class)
private String agencyId;
/**
* 日维度Id
*/
private String dateId;
public interface Agency extends CustomerClientShowGroup{}
@Data
public static class Topic implements Serializable {
//网格Id
private String gridId;
//话题数量
private Integer topicCount;
//话题状态 已关闭:closed、已屏蔽:hidden、 讨论中:discussing
private String topicStatus;
//话题已转议题数量
private Integer shiftedIssueTotal;
}
}

94
epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/datastats/result/AgencyBasicDataResultDTO.java

@ -0,0 +1,94 @@
package com.epmet.dataaggre.dto.datastats.result;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
/**
* @Description 基础数据-组织各种数据汇总-接口返参
* @Auth sun
*/
@Data
public class AgencyBasicDataResultDTO implements Serializable {
private static final long serialVersionUID = 466974582608407121L;
@JsonIgnore
BigDecimal bi = new BigDecimal(0);
/**
* 组织Id
*/
private String agencyId;
//用户总数
private Integer userTotal = 0;
//党员总数
private Integer partyMemberTotal = 0;
//党员总数占比
private BigDecimal partyMemberRatio = bi;
//居民总数
private Integer resiTotal = 0;
//居民总数占比
private BigDecimal resiRatio = bi;
//党群小组总数
private Integer groupTotal = 0;
//楼院小组总数
private Integer ordinaryTotal = 0;
//楼院小组总数占比
private BigDecimal ordinaryRatio = bi;
//支部小组总数
private Integer branchTotal = 0;
//支部小组总数占比
private BigDecimal branchRatio = bi;
//话题总数
private Integer topicTotal = 0;
//热议中总数
private Integer discussingTotal = 0;
//热议中总数占比
private BigDecimal discussingRatio = bi;
//已处理总数
private Integer closedTopicTotal = 0;
//已处理总数占比
private BigDecimal closedTopicRatio = bi;
//转议题总数
private Integer shiftIssueTotal = 0;
//转议题总数占比
private BigDecimal shiftIssueRatio = bi;
//议题总数
private Integer issueTotal = 0;
//表决中总数
private Integer votingTotal = 0;
//表决中总数占比
private BigDecimal votingRatio = bi;
//已处理总数
private Integer closedIssueTotal = 0;
//已处理总数占比
private BigDecimal closedIssueRatio = bi;
//已转项目总数
private Integer shiftProjectTotal = 0;
//已转项目总数占比
private BigDecimal shiftProjectRatio = bi;
//项目总数
private Integer projectTotal = 0;
//处理中总数
private Integer pendingTotal = 0;
//处理中总数占比
private BigDecimal pendingRatio = bi;
//已结案总数
private Integer closedProjectTotal = 0;
//已结案总数占比
private BigDecimal closedProjectRatio = bi;
@Data
public static class Topic implements Serializable {
//话题数量
private Integer topicCount;
//话题状态 已关闭:closed、已屏蔽:hidden、 讨论中:discussing
private String topicStatus;
//话题已转议题数量
private Integer shiftedIssueTotal;
//数据更新至 时间
private String deadline;
}
}

33
epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/datastats/result/SubAgencyGroupResultDTO.java

@ -0,0 +1,33 @@
package com.epmet.dataaggre.dto.datastats.result;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
/**
* @Description 基础数据-查询当前组织的直属下级组织群组数据-接口返参
* @Auth sun
*/
@Data
public class SubAgencyGroupResultDTO implements Serializable {
private static final long serialVersionUID = 466974582608407121L;
@JsonIgnore
BigDecimal bi = new BigDecimal(0);
//组织Id
private String agencyId;
//组织名称
private String agencyName;
//党群小组总数
private Integer groupTotal = 0;
//楼院小组总数
private Integer ordinaryTotal = 0;
//楼院小组总数占比
private BigDecimal ordinaryRatio = bi;
//支部小组总数
private Integer branchTotal = 0;
//支部小组总数占比
private BigDecimal branchRatio = bi;
}

37
epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/datastats/result/SubAgencyIssueResultDTO.java

@ -0,0 +1,37 @@
package com.epmet.dataaggre.dto.datastats.result;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
/**
* @Description 基础数据-查询当前组织的直属下级组织议题数据-接口返参
* @Auth sun
*/
@Data
public class SubAgencyIssueResultDTO implements Serializable {
private static final long serialVersionUID = 466974582608407121L;
@JsonIgnore
BigDecimal bi = new BigDecimal(0);
//组织Id
private String agencyId;
//组织名称
private String agencyName;
//议题总数
private Integer issueTotal = 0;
//表决中总数
private Integer votingTotal = 0;
//表决中总数占比
private BigDecimal votingRatio = bi;
//已处理总数
private Integer closedIssueTotal = 0;
//已处理总数占比
private BigDecimal closedIssueRatio = bi;
//已转项目总数
private Integer shiftProjectTotal = 0;
//已转项目总数占比
private BigDecimal shiftProjectRatio = bi;
}

33
epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/datastats/result/SubAgencyProjectResultDTO.java

@ -0,0 +1,33 @@
package com.epmet.dataaggre.dto.datastats.result;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
/**
* @Description 基础数据-查询当前组织的直属下级组织项目数据-接口返参
* @Auth sun
*/
@Data
public class SubAgencyProjectResultDTO implements Serializable {
private static final long serialVersionUID = 466974582608407121L;
@JsonIgnore
BigDecimal bi = new BigDecimal(0);
//组织Id
private String agencyId;
//组织名称
private String agencyName;
//项目总数
private Integer projectTotal = 0;
//处理中总数
private Integer pendingTotal = 0;
//处理中总数占比
private BigDecimal pendingRatio = bi;
//已结案总数
private Integer closedProjectTotal = 0;
//已结案总数占比
private BigDecimal closedProjectRatio = bi;
}

37
epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/datastats/result/SubAgencyTopicResultDTO.java

@ -0,0 +1,37 @@
package com.epmet.dataaggre.dto.datastats.result;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
/**
* @Description 基础数据-查询当前组织的直属下级组织话题数据-接口返参
* @Auth sun
*/
@Data
public class SubAgencyTopicResultDTO implements Serializable {
private static final long serialVersionUID = 466974582608407121L;
@JsonIgnore
BigDecimal bi = new BigDecimal(0);
//组织Id
private String agencyId;
//组织名称
private String agencyName;
//话题总数
private Integer topicTotal = 0;
//热议中总数
private Integer discussingTotal = 0;
//热议中总数占比
private BigDecimal discussingRatio = bi;
//已处理总数
private Integer closedTopicTotal = 0;
//已处理总数占比
private BigDecimal closedTopicRatio = bi;
//转议题总数
private Integer shiftIssueTotal = 0;
//转议题总数占比
private BigDecimal shiftIssueRatio = bi;
}

33
epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/datastats/result/SubAgencyUserResultDTO.java

@ -0,0 +1,33 @@
package com.epmet.dataaggre.dto.datastats.result;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
/**
* @Description 基础数据-查询当前组织的直属下级组织用户数据-接口返参
* @Auth sun
*/
@Data
public class SubAgencyUserResultDTO implements Serializable {
private static final long serialVersionUID = 466974582608407121L;
@JsonIgnore
BigDecimal bi = new BigDecimal(0);
//组织Id
private String agencyId;
//组织名称
private String agencyName;
//用户总数
private Integer userTotal = 0;
//党员总数
private Integer partyMemberTotal = 0;
//党员总数占比
private BigDecimal partyMemberRatio = bi;
//居民总数
private Integer resiTotal = 0;
//居民总数占比
private BigDecimal resiRatio = bi;
}

33
epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/datastats/result/SubGridGroupResultDTO.java

@ -0,0 +1,33 @@
package com.epmet.dataaggre.dto.datastats.result;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
/**
* @Description 基础数据-查询当前组织下直属网格列表群组数据-接口返参
* @Auth sun
*/
@Data
public class SubGridGroupResultDTO implements Serializable {
private static final long serialVersionUID = 466974582608407121L;
@JsonIgnore
BigDecimal bi = new BigDecimal(0);
//网格Id
private String gridId;
//网格名称
private String gridName;
//党群小组总数
private Integer groupTotal = 0;
//楼院小组总数
private Integer ordinaryTotal = 0;
//楼院小组总数占比
private BigDecimal ordinaryRatio = bi;
//支部小组总数
private Integer branchTotal = 0;
//支部小组总数占比
private BigDecimal branchRatio = bi;
}

37
epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/datastats/result/SubGridIssueResultDTO.java

@ -0,0 +1,37 @@
package com.epmet.dataaggre.dto.datastats.result;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
/**
* @Description 基础数据-查询当前组织下直属网格列表议题数据-接口返参
* @Auth sun
*/
@Data
public class SubGridIssueResultDTO implements Serializable {
private static final long serialVersionUID = 466974582608407121L;
@JsonIgnore
BigDecimal bi = new BigDecimal(0);
//网格Id
private String gridId;
//网格名称
private String gridName;
//议题总数
private Integer issueTotal = 0;
//表决中总数
private Integer votingTotal = 0;
//表决中总数占比
private BigDecimal votingRatio = bi;
//已处理总数
private Integer closedIssueTotal = 0;
//已处理总数占比
private BigDecimal closedIssueRatio = bi;
//已转项目总数
private Integer shiftProjectTotal = 0;
//已转项目总数占比
private BigDecimal shiftProjectRatio = bi;
}

33
epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/datastats/result/SubGridProjectResultDTO.java

@ -0,0 +1,33 @@
package com.epmet.dataaggre.dto.datastats.result;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
/**
* @Description 基础数据-查询当前组织下直属网格列表项目数据-接口返参
* @Auth sun
*/
@Data
public class SubGridProjectResultDTO implements Serializable {
private static final long serialVersionUID = 466974582608407121L;
@JsonIgnore
BigDecimal bi = new BigDecimal(0);
//网格Id
private String gridId;
//网格名称
private String gridName;
//项目总数
private Integer projectTotal = 0;
//处理中总数
private Integer pendingTotal = 0;
//处理中总数占比
private BigDecimal pendingRatio = bi;
//已结案总数
private Integer closedProjectTotal = 0;
//已结案总数占比
private BigDecimal closedProjectRatio = bi;
}

37
epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/datastats/result/SubGridTopicResultDTO.java

@ -0,0 +1,37 @@
package com.epmet.dataaggre.dto.datastats.result;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
/**
* @Description 基础数据-查询当前组织下直属网格列表话题数据-接口返参
* @Auth sun
*/
@Data
public class SubGridTopicResultDTO implements Serializable {
private static final long serialVersionUID = 466974582608407121L;
@JsonIgnore
BigDecimal bi = new BigDecimal(0);
//网格Id
private String gridId;
//网格名称
private String gridName;
//话题总数
private Integer topicTotal = 0;
//热议中总数
private Integer discussingTotal = 0;
//热议中总数占比
private BigDecimal discussingRatio = bi;
//已处理总数
private Integer closedTopicTotal = 0;
//已处理总数占比
private BigDecimal closedTopicRatio = bi;
//转议题总数
private Integer shiftIssueTotal = 0;
//转议题总数占比
private BigDecimal shiftIssueRatio = bi;
}

33
epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/datastats/result/SubGridUserResultDTO.java

@ -0,0 +1,33 @@
package com.epmet.dataaggre.dto.datastats.result;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
/**
* @Description 基础数据-查询当前组织下直属网格列表用户数据-接口返参
* @Auth sun
*/
@Data
public class SubGridUserResultDTO implements Serializable {
private static final long serialVersionUID = 466974582608407121L;
@JsonIgnore
BigDecimal bi = new BigDecimal(0);
//网格Id
private String gridId;
//网格名称
private String gridName;
//用户总数
private Integer userTotal = 0;
//党员总数
private Integer partyMemberTotal = 0;
//党员总数占比
private BigDecimal partyMemberRatio = bi;
//居民总数
private Integer resiTotal = 0;
//居民总数占比
private BigDecimal resiRatio = bi;
}

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

@ -157,6 +157,13 @@
<datasource.druid.opercrm.username>epmet_oper_crm_user</datasource.druid.opercrm.username>
<datasource.druid.opercrm.password>EpmEt-db-UsEr</datasource.druid.opercrm.password>
<!-- data_statistical -->
<datasource.druid.opercrm.url>
<![CDATA[jdbc:mysql://192.168.1.130:3306/epmet_data_statistical?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai]]>
</datasource.druid.opercrm.url>
<datasource.druid.opercrm.username>epmet_data_statistical_user</datasource.druid.opercrm.username>
<datasource.druid.opercrm.password>EpmEt-db-UsEr</datasource.druid.opercrm.password>
<!-- redis配置 -->
<spring.redis.index>0</spring.redis.index>
<spring.redis.host>192.168.1.130</spring.redis.host>
@ -238,6 +245,13 @@
<datasource.druid.opercrm.username>epmet_oper_crm_user</datasource.druid.opercrm.username>
<datasource.druid.opercrm.password>EpmEt-db-UsEr</datasource.druid.opercrm.password>
<!-- data_statistical -->
<datasource.druid.opercrm.url>
<![CDATA[jdbc:mysql://192.168.1.130:3306/epmet_data_statistical?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai]]>
</datasource.druid.opercrm.url>
<datasource.druid.opercrm.username>epmet_data_statistical_user</datasource.druid.opercrm.username>
<datasource.druid.opercrm.password>EpmEt-db-UsEr</datasource.druid.opercrm.password>
<!-- redis配置 -->
<spring.redis.index>0</spring.redis.index>
<spring.redis.host>192.168.1.130</spring.redis.host>
@ -319,6 +333,13 @@
<datasource.druid.opercrm.username>epmet</datasource.druid.opercrm.username>
<datasource.druid.opercrm.password>elink@833066</datasource.druid.opercrm.password>
<!-- data_statistical -->
<datasource.druid.opercrm.url>
<![CDATA[jdbc:mysql://rm-m5ef9t617j6o5eup7.mysql.rds.aliyuncs.com:3306/epmet_data_statistical?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai]]>
</datasource.druid.opercrm.url>
<datasource.druid.opercrm.username>epmet_data_statistical_user</datasource.druid.opercrm.username>
<datasource.druid.opercrm.password>EpmEt-db-UsEr</datasource.druid.opercrm.password>
<!-- redis配置 -->
<spring.redis.index>0</spring.redis.index>
<spring.redis.host>r-m5eoz5b6tkx09y6bpz.redis.rds.aliyuncs.com</spring.redis.host>
@ -400,6 +421,13 @@
<datasource.druid.opercrm.username>epmet_oper_crm_user</datasource.druid.opercrm.username>
<datasource.druid.opercrm.password>EpmEt-db-UsEr</datasource.druid.opercrm.password>
<!-- data_statistical -->
<datasource.druid.opercrm.url>
<![CDATA[jdbc:mysql://rm-m5e3vzs2637224wj9.mysql.rds.aliyuncs.com:3306/epmet_data_statistical?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai]]>
</datasource.druid.opercrm.url>
<datasource.druid.opercrm.username>epmet_data_statistical_user</datasource.druid.opercrm.username>
<datasource.druid.opercrm.password>EpmEt-db-UsEr</datasource.druid.opercrm.password>
<!-- redis配置 -->
<spring.redis.index>0</spring.redis.index>
<spring.redis.host>r-m5ez3n1j0qc3ykq2ut.redis.rds.aliyuncs.com</spring.redis.host>

150
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/DataStatsController.java

@ -0,0 +1,150 @@
package com.epmet.dataaggre.controller;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.dataaggre.dto.datastats.form.AgenctBasicDataFormDTO;
import com.epmet.dataaggre.dto.datastats.form.SubAgencyFormDTO;
import com.epmet.dataaggre.dto.datastats.form.SubGridFormDTO;
import com.epmet.dataaggre.dto.datastats.result.*;
import com.epmet.dataaggre.service.datastats.DataStatsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* @Author sun
* @Description 数据统计服务
*/
@RestController
@RequestMapping("datastats")
public class DataStatsController {
@Autowired
private DataStatsService dataStatsService;
/**
* @Param formDTO
* @Description 组织下五项基础数据汇总
* @author sun
*/
@PostMapping("agencybasicdata")
public Result<AgencyBasicDataResultDTO> agencyBasicData(@RequestBody AgenctBasicDataFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, AgenctBasicDataFormDTO.Agency.class);
return new Result<AgencyBasicDataResultDTO>().ok(dataStatsService.agencyBasicData(formDTO));
}
/**
* @Param formDTO
* @Description 查询当前组织的直属下级组织用户数据
* @author sun
*/
@PostMapping("subagencyuser")
public Result<List<SubAgencyUserResultDTO>> subAgencyUser(@RequestBody SubAgencyFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, SubAgencyFormDTO.Agency.class);
return new Result<List<SubAgencyUserResultDTO>>().ok(dataStatsService.subAgencyUser(formDTO));
}
/**
* @Param formDTO
* @Description 查询当前组织下直属网格列表用户数据
* @author sun
*/
@PostMapping("subgriduser")
public Result<List<SubGridUserResultDTO>> subGridUser(@RequestBody SubGridFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, SubGridFormDTO.Agency.class);
return new Result<List<SubGridUserResultDTO>>().ok(dataStatsService.subGridUser(formDTO));
}
/**
* @Param formDTO
* @Description 查询当前组织的直属下级组织群组数据
* @author sun
*/
@PostMapping("subagencygroup")
public Result<List<SubAgencyGroupResultDTO>> subAgencyGroup(@RequestBody SubAgencyFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, SubAgencyFormDTO.Agency.class);
return new Result<List<SubAgencyGroupResultDTO>>().ok(dataStatsService.subAgencyGroup(formDTO));
}
/**
* @Param formDTO
* @Description 查询当前组织下直属网格列表群组数据
* @author sun
*/
@PostMapping("subgridgroup")
public Result<List<SubGridGroupResultDTO>> subGridGroup(@RequestBody SubGridFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, SubGridFormDTO.Agency.class);
return new Result<List<SubGridGroupResultDTO>>().ok(dataStatsService.subGridGroup(formDTO));
}
/**
* @Param formDTO
* @Description 查询当前组织的直属下级组织话题数据
* @author sun
*/
@PostMapping("subagencytopic")
public Result<List<SubAgencyTopicResultDTO>> subAgencyTopic(@RequestBody SubAgencyFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, SubAgencyFormDTO.Agency.class);
return new Result<List<SubAgencyTopicResultDTO>>().ok(dataStatsService.subAgencyTopic(formDTO));
}
/**
* @Param formDTO
* @Description 查询当前组织下直属网格列表话题数据
* @author sun
*/
@PostMapping("subgridtopic")
public Result<List<SubGridTopicResultDTO>> subGridTopic(@RequestBody SubGridFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, SubGridFormDTO.Agency.class);
return new Result<List<SubGridTopicResultDTO>>().ok(dataStatsService.subGridTopic(formDTO));
}
/**
* @Param formDTO
* @Description 查询当前组织的直属下级组织议题数据
* @author sun
*/
@PostMapping("subagencyissue")
public Result<List<SubAgencyIssueResultDTO>> subAgencyIssue(@RequestBody SubAgencyFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, SubAgencyFormDTO.Agency.class);
return new Result<List<SubAgencyIssueResultDTO>>().ok(dataStatsService.subAgencyIssue(formDTO));
}
/**
* @Param formDTO
* @Description 查询当前组织下直属网格列表议题数据
* @author sun
*/
@PostMapping("subgridissue")
public Result<List<SubGridIssueResultDTO>> subGridIssue(@RequestBody SubGridFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, SubGridFormDTO.Agency.class);
return new Result<List<SubGridIssueResultDTO>>().ok(dataStatsService.subGridIssue(formDTO));
}
/**
* @Param formDTO
* @Description 查询当前组织的直属下级组织项目数据
* @author sun
*/
@PostMapping("subagencyproject")
public Result<List<SubAgencyProjectResultDTO>> subAgencyProject(@RequestBody SubAgencyFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, SubAgencyFormDTO.Agency.class);
return new Result<List<SubAgencyProjectResultDTO>>().ok(dataStatsService.subAgencyProject(formDTO));
}
/**
* @Param formDTO
* @Description 查询当前组织下直属网格列表项目数据
* @author sun
*/
@PostMapping("subgridproject")
public Result<List<SubGridProjectResultDTO>> subGridProject(@RequestBody SubGridFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, SubGridFormDTO.Agency.class);
return new Result<List<SubGridProjectResultDTO>>().ok(dataStatsService.subGridProject(formDTO));
}
}

157
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/datastats/DataStatsDao.java

@ -0,0 +1,157 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.dataaggre.dao.datastats;
import com.epmet.dataaggre.dto.datastats.form.SubAgencyFormDTO;
import com.epmet.dataaggre.dto.datastats.form.SubGridFormDTO;
import com.epmet.dataaggre.dto.datastats.result.*;
import com.epmet.dataaggre.entity.datastats.DimAgencyEntity;
import com.epmet.dataaggre.entity.datastats.DimGridEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* @Author sun
* @Description 数据统计服务
*/
@Mapper
public interface DataStatsDao {
/**
* @Description 查询组织下注册用户最新日统计数据
* @author sun
*/
AgencyBasicDataResultDTO getAgnecyRegUser(@Param("agencyId") String agencyId, @Param("dateId") String dateId);
/**
* @Description 查询组织下最新群组日统计数据
* @author sun
*/
AgencyBasicDataResultDTO getAgnecyGroup(@Param("agencyId") String agencyId, @Param("dateId") String dateId);
/**
* @Description 查询组织下最新状态话题-机关日统计数据表
* @author sun
*/
List<AgencyBasicDataResultDTO.Topic> getAgencyTopic(@Param("agencyId") String agencyId, @Param("dateId") String dateId);
/**
* @Description 查询组织下最新转议题话题-机关日统计数据表
* @author sun
*/
AgencyBasicDataResultDTO.Topic getAgencyTopicShiftIssue(@Param("agencyId") String agencyId, @Param("dateId") String dateId);
/**
* @Description 查询组织下最新议题日统计数据
* @author sun
*/
AgencyBasicDataResultDTO getAgencyIssue(@Param("agencyId") String agencyId, @Param("dateId") String dateId);
/**
* @Description 查询组织下最新项目日统计数据
* @author sun
*/
AgencyBasicDataResultDTO getAgencyProject(@Param("agencyId") String agencyId, @Param("dateId") String dateId);
/**
* @Description 查询当前组织的直属下级组织信息
* @author sun
*/
List<DimAgencyEntity> getSubAgencyList(@Param("pid") String pid);
/**
* @Description 查询直属下级组织注册用户日统计数据默认按用户总数降序
* @author sun
*/
List<SubAgencyUserResultDTO> getSubAgencyUser(@Param("agencyIds") List<String> agencyIds, @Param("dateId") String dateId);
/**
* @Description 查询组织下网格列表
* @author sun
*/
List<DimGridEntity> getSubGridList(@Param("agencyId") String agencyId);
/**
* @Description 查询网格层级注册用户日统计数据
* @author sun
*/
List<SubGridUserResultDTO> getSubGridUser(@Param("gridIds") List<String> gridIds, @Param("dateId") String dateId);
/**
* @Description 查询直属下级组织小组日统计数据默认按群组总数降序
* @author sun
*/
List<SubAgencyGroupResultDTO> getSubAgencyGroup(@Param("agencyIds") List<String> agencyIds, @Param("dateId") String dateId);
/**
* @Description 查询网格层级小组日统计数据默认按群组总数降序
* @author sun
*/
List<SubGridGroupResultDTO> getSubGridGroup(@Param("gridIds") List<String> gridIds, @Param("dateId") String dateId);
/**
* @Description 查询直属下级组织状态话题-日统计数据
* @author sun
*/
List<SubAgencyFormDTO.Topic> getSubAgencyTopic(@Param("agencyIds") List<String> agencyIds, @Param("dateId") String dateId);
/**
* @Description 查询直属下级组织转议题话题-日统计数据表
* @author sun
*/
List<SubAgencyFormDTO.Topic> getSubAgencyTopicShiftIssue(@Param("agencyIds") List<String> agencyIds, @Param("dateId") String dateId);
/**
* @Description 查询网格层级状态话题-日统计数据
* @author sun
*/
List<SubGridFormDTO.Topic> getSubGridTopic(@Param("gridIds") List<String> gridIds, @Param("dateId") String dateId);
/**
* @Description 查询网格层级转议题话题-日统计数据表
* @author sun
*/
List<SubGridFormDTO.Topic> getSubGridTopicShiftIssue(@Param("gridIds") List<String> gridIds, @Param("dateId") String dateId);
/**
* @Description 查询直属下级组织议题日统计数据默认按议题总数降序
* @author sun
*/
List<SubAgencyIssueResultDTO> getSubAgencyIssue(@Param("agencyIds") List<String> agencyIds, @Param("dateId") String dateId);
/**
* @Description 查询网格层级议题日统计数据默认按议题总数降序
* @author sun
*/
List<SubGridIssueResultDTO> getSubGridIssue(@Param("gridIds") List<String> gridIds, @Param("dateId") String dateId);
/**
* @Description 查询直属下级组织项目日统计数据默认按项目总数降序
* @author sun
*/
List<SubAgencyProjectResultDTO> getSubAgencyProject(@Param("agencyIds") List<String> agencyIds, @Param("dateId") String dateId);
/**
* @Description 查询网格层级项目日统计数据默认按项目总数降序
* @author sun
*/
List<SubGridProjectResultDTO> getSubGridProject(@Param("gridIds") List<String> gridIds, @Param("dateId") String dateId);
}

78
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/datastats/DimAgencyEntity.java

@ -0,0 +1,78 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.dataaggre.entity.datastats;
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-06-16
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("dim_agency")
public class DimAgencyEntity extends BaseEpmetEntity {
private static final long serialVersionUID = 1L;
/**
* 组织名称
*/
private String agencyName;
/**
* 客户ID
*/
private String customerId;
/**
* 上级组织机构ID根组织为0
*/
private String pid;
/**
* 所有上级组织机构ID(以英文:隔开)
*/
private String pids;
/**
* 机关维度类型self:机关本身自己,all:机关自己+下级+网格+部门等
*/
private String agencyDimType;
/**
* 所有上级名称,-连接
*/
private String allParentName;
/**
* 机关级别社区级community
* 街道:street,
* 区县级: district,
* 市级: city
* 省级:province
*/
private String level;
}

49
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/datastats/DimCustomerEntity.java

@ -0,0 +1,49 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.dataaggre.entity.datastats;
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-06-16
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("dim_customer")
public class DimCustomerEntity extends BaseEpmetEntity {
private static final long serialVersionUID = 1L;
/**
* 客户名称
*/
private String customerName;
/**
* 客户所属行政地区编码取值来自客户根组织的area_code01.14 add
*/
private String areaCode;
}

59
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/datastats/DimGridEntity.java

@ -0,0 +1,59 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.dataaggre.entity.datastats;
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-06-16
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("dim_grid")
public class DimGridEntity extends BaseEpmetEntity {
private static final long serialVersionUID = 1L;
/**
* 网格名称
*/
private String gridName;
/**
* 客户ID
*/
private String customerId;
/**
* 所属组织机构IDcustomer_agency.id
*/
private String agencyId;
/**
* 所属地区码所属组织地区码
*/
private String areaCode;
}

94
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/datastats/DataStatsService.java

@ -0,0 +1,94 @@
package com.epmet.dataaggre.service.datastats;
import com.epmet.dataaggre.dto.datastats.form.AgenctBasicDataFormDTO;
import com.epmet.dataaggre.dto.datastats.form.SubAgencyFormDTO;
import com.epmet.dataaggre.dto.datastats.form.SubGridFormDTO;
import com.epmet.dataaggre.dto.datastats.result.*;
import java.util.List;
/**
* @Author sun
* @Description 数据统计服务
*/
public interface DataStatsService {
/**
* @Param formDTO
* @Description 组织下五项基础数据汇总
* @author sun
*/
AgencyBasicDataResultDTO agencyBasicData(AgenctBasicDataFormDTO formDTO);
/**
* @Param formDTO
* @Description 查询当前组织的直属下级组织用户数据
* @author sun
*/
List<SubAgencyUserResultDTO> subAgencyUser(SubAgencyFormDTO formDTO);
/**
* @Param formDTO
* @Description 查询当前组织下直属网格列表用户数据
* @author sun
*/
List<SubGridUserResultDTO> subGridUser(SubGridFormDTO formDTO);
/**
* @Param formDTO
* @Description 查询当前组织的直属下级组织群组数据
* @author sun
*/
List<SubAgencyGroupResultDTO> subAgencyGroup(SubAgencyFormDTO formDTO);
/**
* @Param formDTO
* @Description 查询当前组织下直属网格列表群组数据
* @author sun
*/
List<SubGridGroupResultDTO> subGridGroup(SubGridFormDTO formDTO);
/**
* @Param formDTO
* @Description 查询当前组织的直属下级组织话题数据
* @author sun
* @return
*/
List<SubAgencyTopicResultDTO> subAgencyTopic(SubAgencyFormDTO formDTO);
/**
* @Param formDTO
* @Description 查询当前组织下直属网格列表话题数据
* @author sun
* @return
*/
List<SubGridTopicResultDTO> subGridTopic(SubGridFormDTO formDTO);
/**
* @Param formDTO
* @Description 查询当前组织的直属下级组织议题数据
* @author sun
*/
List<SubAgencyIssueResultDTO> subAgencyIssue(SubAgencyFormDTO formDTO);
/**
* @Param formDTO
* @Description 查询当前组织下直属网格列表议题数据
* @author sun
*/
List<SubGridIssueResultDTO> subGridIssue(SubGridFormDTO formDTO);
/**
* @Param formDTO
* @Description 查询当前组织的直属下级组织项目数据
* @author sun
*/
List<SubAgencyProjectResultDTO> subAgencyProject(SubAgencyFormDTO formDTO);
/**
* @Param formDTO
* @Description 查询当前组织下直属网格列表项目数据
* @author sun
*/
List<SubGridProjectResultDTO> subGridProject(SubGridFormDTO formDTO);
}

632
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/datastats/impl/DataStatsServiceImpl.java

@ -0,0 +1,632 @@
package com.epmet.dataaggre.service.datastats.impl;
import com.epmet.commons.dynamic.datasource.annotation.DataSource;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.utils.DateUtils;
import com.epmet.dataaggre.constant.DataSourceConstant;
import com.epmet.dataaggre.dao.datastats.DataStatsDao;
import com.epmet.dataaggre.dto.datastats.form.AgenctBasicDataFormDTO;
import com.epmet.dataaggre.dto.datastats.form.SubAgencyFormDTO;
import com.epmet.dataaggre.dto.datastats.form.SubGridFormDTO;
import com.epmet.dataaggre.dto.datastats.result.*;
import com.epmet.dataaggre.entity.datastats.DimAgencyEntity;
import com.epmet.dataaggre.entity.datastats.DimGridEntity;
import com.epmet.dataaggre.service.datastats.DataStatsService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.text.NumberFormat;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicReference;
import java.util.stream.Collectors;
/**
* @Author sun
* @Description 数据统计服务
*/
@Service
@DataSource(DataSourceConstant.DATA_STATISTICAL)
@Slf4j
public class DataStatsServiceImpl implements DataStatsService {
@Autowired
private DataStatsDao dataStatsDao;
/**
* @Param formDTO
* @Description 组织下五项基础数据汇总
* @author sun
*/
@Override
public AgencyBasicDataResultDTO agencyBasicData(AgenctBasicDataFormDTO formDTO) {
AgencyBasicDataResultDTO resultDTO = new AgencyBasicDataResultDTO();
resultDTO.setAgencyId(formDTO.getAgencyId());
NumberFormat numberFormat = NumberFormat.getInstance();
numberFormat.setMaximumFractionDigits(NumConstant.FOUR);
//入参有日期的则按具体时间执行,没有的则按当前时间前一天执行
if (StringUtils.isBlank(formDTO.getDateId())) {
Date yesterday = DateUtils.addDateDays(new Date(), -1);
SimpleDateFormat format = new SimpleDateFormat(DateUtils.DATE_PATTERN_YYYYMMDD);
formDTO.setDateId(format.format(yesterday));
}
//1.查询组织下注册用户最新日统计数据【只查询注册用户的统计数据,不涉及参与用户的】
AgencyBasicDataResultDTO user = dataStatsDao.getAgnecyRegUser(formDTO.getAgencyId(), formDTO.getDateId());
if (null != user) {
resultDTO.setUserTotal(user.getUserTotal());
resultDTO.setResiTotal(user.getResiTotal());
resultDTO.setResiRatio(user.getResiTotal() == 0 || user.getUserTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) user.getResiTotal() / (float) user.getUserTotal())));
resultDTO.setPartyMemberTotal(user.getPartyMemberTotal());
resultDTO.setPartyMemberRatio(user.getPartyMemberTotal() == 0 || user.getUserTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) user.getPartyMemberTotal() / (float) user.getUserTotal())));
}
//2.查询组织下最新群组日统计数据
AgencyBasicDataResultDTO group = dataStatsDao.getAgnecyGroup(formDTO.getAgencyId(), formDTO.getDateId());
if (null != group) {
resultDTO.setGroupTotal(group.getGroupTotal());
resultDTO.setOrdinaryTotal(group.getOrdinaryTotal());
resultDTO.setOrdinaryRatio(group.getOrdinaryTotal() == 0 || group.getGroupTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) group.getOrdinaryTotal() / (float) group.getGroupTotal())));
resultDTO.setBranchTotal(group.getBranchTotal());
resultDTO.setBranchRatio(group.getBranchTotal() == 0 || group.getGroupTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) group.getBranchTotal() / (float) group.getGroupTotal())));
}
//3.查询组织下最新话题日统计数据
//状态话题-机关日统计数据表最新日期三种状态数据
//机关日表里三种类型数据之和就是话题总量,讨论中数量与热议中不是一个概念,热议中=总量-关闭数-屏蔽数-转议题数
List<AgencyBasicDataResultDTO.Topic> topic = dataStatsDao.getAgencyTopic(formDTO.getAgencyId(), formDTO.getDateId());
//转议题话题-机关日统计数据表
AgencyBasicDataResultDTO.Topic topicSHiftIssue = dataStatsDao.getAgencyTopicShiftIssue(formDTO.getAgencyId(), formDTO.getDateId());
AtomicReference<Integer> closedTotal = new AtomicReference<>(0);
AtomicReference<Integer> hiddenTotal = new AtomicReference<>(0);
if (topic.size()>NumConstant.ZERO) {
resultDTO.setTopicTotal(topic.stream().collect(Collectors.summingInt(AgencyBasicDataResultDTO.Topic::getTopicCount)));
topic.forEach(t -> {
if (t.getTopicStatus().equals("closed")){ closedTotal.set(t.getTopicCount()); }
if (t.getTopicStatus().equals("hidden")){ hiddenTotal.set(t.getTopicCount()); }
});
}
if (null != topicSHiftIssue) {
resultDTO.setShiftIssueTotal(topicSHiftIssue.getShiftedIssueTotal());
resultDTO.setShiftIssueRatio(resultDTO.getShiftIssueTotal() == 0 || resultDTO.getTopicTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) resultDTO.getShiftIssueTotal() / (float) resultDTO.getTopicTotal())));
}
resultDTO.setDiscussingTotal(resultDTO.getTopicTotal()-closedTotal.get()-hiddenTotal.get()-resultDTO.getShiftIssueTotal());
resultDTO.setDiscussingRatio(resultDTO.getDiscussingTotal() == 0 || resultDTO.getTopicTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) resultDTO.getDiscussingTotal() / (float) resultDTO.getTopicTotal())));
resultDTO.setClosedTopicTotal(closedTotal.get());
resultDTO.setClosedTopicRatio(resultDTO.getClosedTopicTotal() == 0 || resultDTO.getTopicTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) resultDTO.getClosedTopicTotal() / (float) resultDTO.getTopicTotal())));
//4.查询组织下最新议题日统计数据
AgencyBasicDataResultDTO issue = dataStatsDao.getAgencyIssue(formDTO.getAgencyId(), formDTO.getDateId());
if (null != issue) {
resultDTO.setIssueTotal(issue.getIssueTotal());
resultDTO.setVotingTotal(issue.getVotingTotal());
resultDTO.setVotingRatio(resultDTO.getVotingTotal() == 0 || resultDTO.getIssueTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) resultDTO.getVotingTotal() / (float) resultDTO.getIssueTotal())));
resultDTO.setClosedIssueTotal(issue.getClosedIssueTotal());
resultDTO.setClosedIssueRatio(resultDTO.getClosedIssueTotal() == 0 || resultDTO.getIssueTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) resultDTO.getClosedIssueTotal() / (float) resultDTO.getIssueTotal())));
resultDTO.setShiftProjectTotal(issue.getShiftProjectTotal());
resultDTO.setShiftProjectRatio(resultDTO.getShiftProjectTotal() == 0 || resultDTO.getIssueTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) resultDTO.getShiftProjectTotal() / (float) resultDTO.getIssueTotal())));
}
//5.查询组织下最新项目日统计数据
AgencyBasicDataResultDTO project = dataStatsDao.getAgencyProject(formDTO.getAgencyId(), formDTO.getDateId());
if (null != project) {
resultDTO.setProjectTotal(project.getProjectTotal());
resultDTO.setPendingTotal(project.getPendingTotal());
resultDTO.setPendingRatio(resultDTO.getPendingTotal() == 0 || resultDTO.getProjectTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) resultDTO.getPendingTotal() / (float) resultDTO.getProjectTotal())));
resultDTO.setClosedProjectTotal(project.getClosedProjectTotal());
resultDTO.setClosedProjectRatio(resultDTO.getClosedProjectTotal() == 0 || resultDTO.getProjectTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) resultDTO.getClosedProjectTotal() / (float) resultDTO.getProjectTotal())));
}
return resultDTO;
}
/**
* @Param formDTO
* @Description 查询当前组织的直属下级组织用户数据
* @author sun
*/
@Override
public List<SubAgencyUserResultDTO> subAgencyUser(SubAgencyFormDTO formDTO) {
List<SubAgencyUserResultDTO> resultList = new ArrayList<>();
NumberFormat numberFormat = NumberFormat.getInstance();
numberFormat.setMaximumFractionDigits(NumConstant.FOUR);
//入参有日期的则按具体时间执行,没有的则按当前时间前一天执行
if (StringUtils.isBlank(formDTO.getDateId())) {
Date yesterday = DateUtils.addDateDays(new Date(), -1);
SimpleDateFormat format = new SimpleDateFormat(DateUtils.DATE_PATTERN_YYYYMMDD);
formDTO.setDateId(format.format(yesterday));
}
//1.查询当前组织的直属下级组织信息【机关维度】
List<DimAgencyEntity> subAgencyList = dataStatsDao.getSubAgencyList(formDTO.getAgencyId());
if(subAgencyList.size()<NumConstant.ONE){
return resultList;
}
List<String> agencyIds = subAgencyList.stream().map(DimAgencyEntity::getId).collect(Collectors.toList());
//2.查询直属下级组织注册用户日统计数据,默认按用户总数降序
resultList = dataStatsDao.getSubAgencyUser(agencyIds, formDTO.getDateId());
//3.封装数据并返回
resultList.forEach(re->{
re.setPartyMemberRatio(re.getPartyMemberTotal() == 0 || re.getUserTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) re.getPartyMemberTotal() / (float) re.getUserTotal())));
re.setResiRatio(re.getResiTotal() == 0 || re.getUserTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) re.getResiTotal() / (float) re.getUserTotal())));
subAgencyList.forEach(sub->{
if(re.getAgencyId().equals(sub.getId())){
re.setAgencyName(sub.getAgencyName());
}
});
});
return resultList;
}
/**
* @Param formDTO
* @Description 查询当前组织下直属网格列表用户数据
* @author sun
*/
@Override
public List<SubGridUserResultDTO> subGridUser(SubGridFormDTO formDTO) {
List<SubGridUserResultDTO> resultList = new ArrayList<>();
NumberFormat numberFormat = NumberFormat.getInstance();
numberFormat.setMaximumFractionDigits(NumConstant.FOUR);
//入参有日期的则按具体时间执行,没有的则按当前时间前一天执行
if (StringUtils.isBlank(formDTO.getDateId())) {
Date yesterday = DateUtils.addDateDays(new Date(), -1);
SimpleDateFormat format = new SimpleDateFormat(DateUtils.DATE_PATTERN_YYYYMMDD);
formDTO.setDateId(format.format(yesterday));
}
//1.查询组织直属网格列表【网格维度】
List<DimGridEntity> gridList = dataStatsDao.getSubGridList(formDTO.getAgencyId());
if(gridList.size()<NumConstant.ONE){
return resultList;
}
List<String> gridIds = gridList.stream().map(DimGridEntity::getId).collect(Collectors.toList());
//2.查询网格层级注册用户日统计数据,默认按用户总数降序
resultList = dataStatsDao.getSubGridUser(gridIds, formDTO.getDateId());
//3.封装数据并返回
resultList.forEach(re->{
re.setPartyMemberRatio(re.getPartyMemberTotal() == 0 || re.getUserTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) re.getPartyMemberTotal() / (float) re.getUserTotal())));
re.setResiRatio(re.getResiTotal() == 0 || re.getUserTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) re.getResiTotal() / (float) re.getUserTotal())));
gridList.forEach(sub->{
if(re.getGridId().equals(sub.getId())){
re.setGridName(sub.getGridName());
}
});
});
return resultList;
}
/**
* @Param formDTO
* @Description 查询当前组织的直属下级组织群组数据
* @author sun
*/
@Override
public List<SubAgencyGroupResultDTO> subAgencyGroup(SubAgencyFormDTO formDTO) {
List<SubAgencyGroupResultDTO> resultList = new ArrayList<>();
NumberFormat numberFormat = NumberFormat.getInstance();
numberFormat.setMaximumFractionDigits(NumConstant.FOUR);
//入参有日期的则按具体时间执行,没有的则按当前时间前一天执行
if (StringUtils.isBlank(formDTO.getDateId())) {
Date yesterday = DateUtils.addDateDays(new Date(), -1);
SimpleDateFormat format = new SimpleDateFormat(DateUtils.DATE_PATTERN_YYYYMMDD);
formDTO.setDateId(format.format(yesterday));
}
//1.查询当前组织的直属下级组织信息【机关维度】
List<DimAgencyEntity> subAgencyList = dataStatsDao.getSubAgencyList(formDTO.getAgencyId());
if(subAgencyList.size()<NumConstant.ONE){
return resultList;
}
List<String> agencyIds = subAgencyList.stream().map(DimAgencyEntity::getId).collect(Collectors.toList());
//2.查询直属下级组织小组日统计数据,默认按群组总数降序
resultList = dataStatsDao.getSubAgencyGroup(agencyIds, formDTO.getDateId());
//3.封装数据并返回
resultList.forEach(re->{
re.setOrdinaryRatio(re.getOrdinaryTotal() == 0 || re.getGroupTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) re.getOrdinaryTotal() / (float) re.getGroupTotal())));
re.setBranchRatio(re.getBranchTotal() == 0 || re.getGroupTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) re.getBranchTotal() / (float) re.getGroupTotal())));
subAgencyList.forEach(sub->{
if(re.getAgencyId().equals(sub.getId())){
re.setAgencyName(sub.getAgencyName());
}
});
});
return resultList;
}
/**
* @Param formDTO
* @Description 查询当前组织下直属网格列表群组数据
* @author sun
*/
@Override
public List<SubGridGroupResultDTO> subGridGroup(SubGridFormDTO formDTO) {
List<SubGridGroupResultDTO> resultList = new ArrayList<>();
NumberFormat numberFormat = NumberFormat.getInstance();
numberFormat.setMaximumFractionDigits(NumConstant.FOUR);
//入参有日期的则按具体时间执行,没有的则按当前时间前一天执行
if (StringUtils.isBlank(formDTO.getDateId())) {
Date yesterday = DateUtils.addDateDays(new Date(), -1);
SimpleDateFormat format = new SimpleDateFormat(DateUtils.DATE_PATTERN_YYYYMMDD);
formDTO.setDateId(format.format(yesterday));
}
//1.查询组织直属网格列表【网格维度】
List<DimGridEntity> gridList = dataStatsDao.getSubGridList(formDTO.getAgencyId());
if(gridList.size()<NumConstant.ONE){
return resultList;
}
List<String> gridIds = gridList.stream().map(DimGridEntity::getId).collect(Collectors.toList());
//2.查询网格层级小组日统计数据,默认按群组总数降序
resultList = dataStatsDao.getSubGridGroup(gridIds, formDTO.getDateId());
//3.封装数据并返回
resultList.forEach(re->{
re.setOrdinaryRatio(re.getOrdinaryTotal() == 0 || re.getGroupTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) re.getOrdinaryTotal() / (float) re.getGroupTotal())));
re.setBranchRatio(re.getBranchTotal() == 0 || re.getGroupTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) re.getBranchTotal() / (float) re.getGroupTotal())));
gridList.forEach(sub->{
if(re.getGridId().equals(sub.getId())){
re.setGridName(sub.getGridName());
}
});
});
return resultList;
}
/**
* @Param formDTO
* @Description 查询当前组织的直属下级组织话题数据
* @author sun
* @return
*/
@Override
public List<SubAgencyTopicResultDTO> subAgencyTopic(SubAgencyFormDTO formDTO) {
List<SubAgencyTopicResultDTO> resultList = new ArrayList<>();
NumberFormat numberFormat = NumberFormat.getInstance();
numberFormat.setMaximumFractionDigits(NumConstant.FOUR);
//入参有日期的则按具体时间执行,没有的则按当前时间前一天执行
if (StringUtils.isBlank(formDTO.getDateId())) {
Date yesterday = DateUtils.addDateDays(new Date(), -1);
SimpleDateFormat format = new SimpleDateFormat(DateUtils.DATE_PATTERN_YYYYMMDD);
formDTO.setDateId(format.format(yesterday));
}
//1.查询当前组织的直属下级组织信息【机关维度】
List<DimAgencyEntity> subAgencyList = dataStatsDao.getSubAgencyList(formDTO.getAgencyId());
if(subAgencyList.size()<NumConstant.ONE){
return resultList;
}
List<String> agencyIds = subAgencyList.stream().map(DimAgencyEntity::getId).collect(Collectors.toList());
//2.查询直属下级组织状态话题-日统计数据
//机关日表里三种类型数据之和就是话题总量,讨论中数量与热议中不是一个概念,热议中=总量-关闭数-屏蔽数-转议题数
List<SubAgencyFormDTO.Topic> topic = dataStatsDao.getSubAgencyTopic(agencyIds, formDTO.getDateId());
//查询直属下级组织转议题话题-日统计数据表
List<SubAgencyFormDTO.Topic> topicShiftIssue = dataStatsDao.getSubAgencyTopicShiftIssue(agencyIds, formDTO.getDateId());
agencyIds.forEach(agencyId->{
SubAgencyTopicResultDTO resultDTO = new SubAgencyTopicResultDTO();
AtomicInteger topicTotal = new AtomicInteger(0);
AtomicInteger closedTotal = new AtomicInteger(0);
AtomicInteger hiddenTotal = new AtomicInteger(0);
AtomicInteger shiftIssueTotal = new AtomicInteger(0);
AtomicReference<String> agencyName = new AtomicReference<>("");
topic.forEach(t->{
if(t.getAgencyId().equals(agencyId)){
topicTotal.addAndGet(t.getTopicCount());
if (t.getTopicStatus().equals("closed")){ closedTotal.set(t.getTopicCount()); }
if (t.getTopicStatus().equals("hidden")){ hiddenTotal.set(t.getTopicCount()); }
}
});
topicShiftIssue.forEach(t->{
if(t.getAgencyId().equals(agencyId)){
shiftIssueTotal.addAndGet(t.getShiftedIssueTotal());
}
});
subAgencyList.forEach(sub->{
if(agencyId.equals(sub.getId())){
agencyName.set(sub.getAgencyName());
}
});
resultDTO.setAgencyId(agencyId);
resultDTO.setAgencyName(agencyName.get());
resultDTO.setTopicTotal(topicTotal.get());
resultDTO.setDiscussingTotal(topicTotal.get()-closedTotal.get()-hiddenTotal.get()-shiftIssueTotal.get());
resultDTO.setDiscussingRatio(resultDTO.getDiscussingTotal() == 0 || resultDTO.getTopicTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) resultDTO.getDiscussingTotal() / (float) resultDTO.getTopicTotal())));
resultDTO.setClosedTopicTotal(closedTotal.get());
resultDTO.setClosedTopicRatio(resultDTO.getClosedTopicTotal() == 0 || resultDTO.getTopicTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) resultDTO.getClosedTopicTotal() / (float) resultDTO.getTopicTotal())));
resultDTO.setShiftIssueTotal(shiftIssueTotal.get());
resultDTO.setShiftIssueRatio(resultDTO.getShiftIssueTotal() == 0 || resultDTO.getTopicTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) resultDTO.getShiftIssueTotal() / (float) resultDTO.getTopicTotal())));
resultList.add(resultDTO);
});
//3.默认按话题总数降序
Collections.sort(resultList, new Comparator<SubAgencyTopicResultDTO>() {
@Override
public int compare(SubAgencyTopicResultDTO o1, SubAgencyTopicResultDTO o2) {
//升序
//return o1.getTopicTotal().compareTo(o2.getTopicTotal());
//降序
return o2.getTopicTotal().compareTo(o1.getTopicTotal());
}
});
return resultList;
}
/**
* @Param formDTO
* @Description 查询当前组织下直属网格列表话题数据
* @author sun
* @return
*/
@Override
public List<SubGridTopicResultDTO> subGridTopic(SubGridFormDTO formDTO) {
List<SubGridTopicResultDTO> resultList = new ArrayList<>();
NumberFormat numberFormat = NumberFormat.getInstance();
numberFormat.setMaximumFractionDigits(NumConstant.FOUR);
//入参有日期的则按具体时间执行,没有的则按当前时间前一天执行
if (StringUtils.isBlank(formDTO.getDateId())) {
Date yesterday = DateUtils.addDateDays(new Date(), -1);
SimpleDateFormat format = new SimpleDateFormat(DateUtils.DATE_PATTERN_YYYYMMDD);
formDTO.setDateId(format.format(yesterday));
}
//1.查询组织直属网格列表【网格维度】
List<DimGridEntity> gridList = dataStatsDao.getSubGridList(formDTO.getAgencyId());
if(gridList.size()<NumConstant.ONE){
return resultList;
}
List<String> gridIds = gridList.stream().map(DimGridEntity::getId).collect(Collectors.toList());
//2.查询网格层级话题数据
//查询网格层级状态话题-日统计数据 机关日表里三种类型数据之和就是话题总量,讨论中数量与热议中不是一个概念,热议中=总量-关闭数-屏蔽数-转议题数
List<SubGridFormDTO.Topic> topic = dataStatsDao.getSubGridTopic(gridIds, formDTO.getDateId());
//查询网格层级转议题话题-日统计数据表
List<SubGridFormDTO.Topic> topicShiftIssue = dataStatsDao.getSubGridTopicShiftIssue(gridIds, formDTO.getDateId());
gridIds.forEach(gridId->{
SubGridTopicResultDTO resultDTO = new SubGridTopicResultDTO();
AtomicInteger topicTotal = new AtomicInteger(0);
AtomicInteger closedTotal = new AtomicInteger(0);
AtomicInteger hiddenTotal = new AtomicInteger(0);
AtomicInteger shiftIssueTotal = new AtomicInteger(0);
AtomicReference<String> gridName = new AtomicReference<>("");
topic.forEach(t->{
if(t.getGridId().equals(gridId)){
topicTotal.addAndGet(t.getTopicCount());
if (t.getTopicStatus().equals("closed")){ closedTotal.set(t.getTopicCount()); }
if (t.getTopicStatus().equals("hidden")){ hiddenTotal.set(t.getTopicCount()); }
}
});
topicShiftIssue.forEach(t->{
if(t.getGridId().equals(gridId)){
shiftIssueTotal.addAndGet(t.getShiftedIssueTotal());
}
});
gridList.forEach(sub->{
if(gridId.equals(sub.getId())){
gridName.set(sub.getGridName());
}
});
resultDTO.setGridId(gridId);
resultDTO.setGridName(gridName.get());
resultDTO.setTopicTotal(topicTotal.get());
resultDTO.setDiscussingTotal(topicTotal.get()-closedTotal.get()-hiddenTotal.get()-shiftIssueTotal.get());
resultDTO.setDiscussingRatio(resultDTO.getDiscussingTotal() == 0 || resultDTO.getTopicTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) resultDTO.getDiscussingTotal() / (float) resultDTO.getTopicTotal())));
resultDTO.setClosedTopicTotal(closedTotal.get());
resultDTO.setClosedTopicRatio(resultDTO.getClosedTopicTotal() == 0 || resultDTO.getTopicTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) resultDTO.getClosedTopicTotal() / (float) resultDTO.getTopicTotal())));
resultDTO.setShiftIssueTotal(shiftIssueTotal.get());
resultDTO.setShiftIssueRatio(resultDTO.getShiftIssueTotal() == 0 || resultDTO.getTopicTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) resultDTO.getShiftIssueTotal() / (float) resultDTO.getTopicTotal())));
resultList.add(resultDTO);
});
//3.默认按话题总数降序
Collections.sort(resultList, new Comparator<SubGridTopicResultDTO>() {
@Override
public int compare(SubGridTopicResultDTO o1, SubGridTopicResultDTO o2) {
//升序
//return o1.getTopicTotal().compareTo(o2.getTopicTotal());
//降序
return o2.getTopicTotal().compareTo(o1.getTopicTotal());
}
});
return resultList;
}
/**
* @Param formDTO
* @Description 查询当前组织的直属下级组织议题数据
* @author sun
*/
@Override
public List<SubAgencyIssueResultDTO> subAgencyIssue(SubAgencyFormDTO formDTO) {
List<SubAgencyIssueResultDTO> resultList = new ArrayList<>();
NumberFormat numberFormat = NumberFormat.getInstance();
numberFormat.setMaximumFractionDigits(NumConstant.FOUR);
//入参有日期的则按具体时间执行,没有的则按当前时间前一天执行
if (StringUtils.isBlank(formDTO.getDateId())) {
Date yesterday = DateUtils.addDateDays(new Date(), -1);
SimpleDateFormat format = new SimpleDateFormat(DateUtils.DATE_PATTERN_YYYYMMDD);
formDTO.setDateId(format.format(yesterday));
}
//1.查询当前组织的直属下级组织信息【机关维度】
List<DimAgencyEntity> subAgencyList = dataStatsDao.getSubAgencyList(formDTO.getAgencyId());
if(subAgencyList.size()<NumConstant.ONE){
return resultList;
}
List<String> agencyIds = subAgencyList.stream().map(DimAgencyEntity::getId).collect(Collectors.toList());
//2.查询直属下级组织议题日统计数据,默认按议题总数降序
resultList = dataStatsDao.getSubAgencyIssue(agencyIds, formDTO.getDateId());
//3.封装数据并返回
resultList.forEach(re->{
re.setVotingRatio(re.getVotingTotal() == 0 || re.getIssueTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) re.getVotingTotal() / (float) re.getIssueTotal())));
re.setClosedIssueRatio(re.getClosedIssueTotal() == 0 || re.getIssueTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) re.getClosedIssueTotal() / (float) re.getIssueTotal())));
re.setShiftProjectRatio(re.getShiftProjectTotal() == 0 || re.getIssueTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) re.getShiftProjectTotal() / (float) re.getIssueTotal())));
subAgencyList.forEach(sub->{
if(re.getAgencyId().equals(sub.getId())){
re.setAgencyName(sub.getAgencyName());
}
});
});
return resultList;
}
/**
* @Param formDTO
* @Description 查询当前组织下直属网格列表议题数据
* @author sun
*/
@Override
public List<SubGridIssueResultDTO> subGridIssue(SubGridFormDTO formDTO) {
List<SubGridIssueResultDTO> resultList = new ArrayList<>();
NumberFormat numberFormat = NumberFormat.getInstance();
numberFormat.setMaximumFractionDigits(NumConstant.FOUR);
//入参有日期的则按具体时间执行,没有的则按当前时间前一天执行
if (StringUtils.isBlank(formDTO.getDateId())) {
Date yesterday = DateUtils.addDateDays(new Date(), -1);
SimpleDateFormat format = new SimpleDateFormat(DateUtils.DATE_PATTERN_YYYYMMDD);
formDTO.setDateId(format.format(yesterday));
}
//1.查询组织直属网格列表【网格维度】
List<DimGridEntity> gridList = dataStatsDao.getSubGridList(formDTO.getAgencyId());
if(gridList.size()<NumConstant.ONE){
return resultList;
}
List<String> gridIds = gridList.stream().map(DimGridEntity::getId).collect(Collectors.toList());
//2.查询网格层级议题日统计数据,默认按议题总数降序
resultList = dataStatsDao.getSubGridIssue(gridIds, formDTO.getDateId());
//3.封装数据并返回
resultList.forEach(re->{
re.setVotingRatio(re.getVotingTotal() == 0 || re.getIssueTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) re.getVotingTotal() / (float) re.getIssueTotal())));
re.setClosedIssueRatio(re.getClosedIssueTotal() == 0 || re.getIssueTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) re.getClosedIssueTotal() / (float) re.getIssueTotal())));
re.setShiftProjectRatio(re.getShiftProjectTotal() == 0 || re.getIssueTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) re.getShiftProjectTotal() / (float) re.getIssueTotal())));
gridList.forEach(sub->{
if(re.getGridId().equals(sub.getId())){
re.setGridName(sub.getGridName());
}
});
});
return resultList;
}
/**
* @Param formDTO
* @Description 查询当前组织的直属下级组织项目数据
* @author sun
*/
@Override
public List<SubAgencyProjectResultDTO> subAgencyProject(SubAgencyFormDTO formDTO) {
List<SubAgencyProjectResultDTO> resultList = new ArrayList<>();
NumberFormat numberFormat = NumberFormat.getInstance();
numberFormat.setMaximumFractionDigits(NumConstant.FOUR);
//入参有日期的则按具体时间执行,没有的则按当前时间前一天执行
if (StringUtils.isBlank(formDTO.getDateId())) {
Date yesterday = DateUtils.addDateDays(new Date(), -1);
SimpleDateFormat format = new SimpleDateFormat(DateUtils.DATE_PATTERN_YYYYMMDD);
formDTO.setDateId(format.format(yesterday));
}
//1.查询当前组织的直属下级组织信息【机关维度】
List<DimAgencyEntity> subAgencyList = dataStatsDao.getSubAgencyList(formDTO.getAgencyId());
if(subAgencyList.size()<NumConstant.ONE){
return resultList;
}
List<String> agencyIds = subAgencyList.stream().map(DimAgencyEntity::getId).collect(Collectors.toList());
//2.查询直属下级组织项目日统计数据,默认按项目总数降序
resultList = dataStatsDao.getSubAgencyProject(agencyIds, formDTO.getDateId());
//3.封装数据并返回
resultList.forEach(re->{
re.setPendingRatio(re.getPendingTotal() == 0 || re.getProjectTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) re.getPendingTotal() / (float) re.getProjectTotal())));
re.setClosedProjectRatio(re.getClosedProjectTotal() == 0 || re.getProjectTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) re.getClosedProjectTotal() / (float) re.getProjectTotal())));
subAgencyList.forEach(sub->{
if(re.getAgencyId().equals(sub.getId())){
re.setAgencyName(sub.getAgencyName());
}
});
});
return resultList;
}
/**
* @Param formDTO
* @Description 查询当前组织下直属网格列表项目数据
* @author sun
*/
@Override
public List<SubGridProjectResultDTO> subGridProject(SubGridFormDTO formDTO) {
List<SubGridProjectResultDTO> resultList = new ArrayList<>();
NumberFormat numberFormat = NumberFormat.getInstance();
numberFormat.setMaximumFractionDigits(NumConstant.FOUR);
//入参有日期的则按具体时间执行,没有的则按当前时间前一天执行
if (StringUtils.isBlank(formDTO.getDateId())) {
Date yesterday = DateUtils.addDateDays(new Date(), -1);
SimpleDateFormat format = new SimpleDateFormat(DateUtils.DATE_PATTERN_YYYYMMDD);
formDTO.setDateId(format.format(yesterday));
}
//1.查询组织直属网格列表【网格维度】
List<DimGridEntity> gridList = dataStatsDao.getSubGridList(formDTO.getAgencyId());
if(gridList.size()<NumConstant.ONE){
return resultList;
}
List<String> gridIds = gridList.stream().map(DimGridEntity::getId).collect(Collectors.toList());
//2.查询网格层级项目日统计数据,默认按项目总数降序
resultList = dataStatsDao.getSubGridProject(gridIds, formDTO.getDateId());
//3.封装数据并返回
resultList.forEach(re->{
re.setPendingRatio(re.getPendingTotal() == 0 || re.getProjectTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) re.getPendingTotal() / (float) re.getProjectTotal())));
re.setClosedProjectRatio(re.getClosedProjectTotal() == 0 || re.getProjectTotal() == 0 ? BigDecimal.ZERO : new BigDecimal(numberFormat.format((float) re.getClosedProjectTotal() / (float) re.getProjectTotal())));
gridList.forEach(sub->{
if(re.getGridId().equals(sub.getId())){
re.setGridName(sub.getGridName());
}
});
});
return resultList;
}
}

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

@ -129,6 +129,11 @@ dynamic:
url: @datasource.druid.opercrm.url@
username: @datasource.druid.opercrm.username@
password: @datasource.druid.opercrm.password@
datastatistical:
driver-class-name: com.mysql.cj.jdbc.Driver
url: @datasource.druid.opercrm.url@
username: @datasource.druid.opercrm.username@
password: @datasource.druid.opercrm.password@
feign:
hystrix:
enabled: true

317
epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/datastats/DatsStatsDao.xml

@ -0,0 +1,317 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.epmet.dataaggre.dao.datastats.DataStatsDao">
<select id="getAgnecyRegUser" resultType="com.epmet.dataaggre.dto.datastats.result.AgencyBasicDataResultDTO">
SELECT
reg_total AS userTotal,
partymember_total AS partyMemberTotal,
(reg_total - partymember_total) AS resiTotal
FROM
fact_reg_user_agency_daily
WHERE
del_flag = '0'
AND agency_id = #{agencyId}
AND date_id = #{dateId}
LIMIT 1
</select>
<select id="getAgnecyGroup" resultType="com.epmet.dataaggre.dto.datastats.result.AgencyBasicDataResultDTO">
SELECT
group_total AS groupTotal,
ordinary_total AS ordinaryTotal,
branch_total AS branchTotal
FROM
fact_group_total_agency_daily
WHERE
del_flag = '0'
AND agency_id = #{agencyId}
AND date_id = #{dateId}
LIMIT 1
</select>
<select id="getAgencyTopic" resultType="com.epmet.dataaggre.dto.datastats.result.AgencyBasicDataResultDTO$Topic">
SELECT
topic_count AS topicCount,
topic_status_id AS topicStatus
FROM
fact_topic_status_agency_daily
WHERE
del_flag = '0'
AND topic_status_id in('discussing','closed','hidden')<!-- 讨论中(热议中!=讨论中)、已处理、已屏蔽 -->
AND agency_id = #{agencyId}
AND date_id = #{dateId}
LIMIT 3
</select>
<select id="getAgencyTopicShiftIssue" resultType="com.epmet.dataaggre.dto.datastats.result.AgencyBasicDataResultDTO$Topic">
SELECT
issue_total AS shiftedIssueTotal,
DATE_FORMAT(date_id, '%Y-%m-%d') AS deadline
FROM
fact_topic_issue_agency_daily
WHERE
del_flag = '0'
AND agency_id = #{agencyId}
AND date_id = #{dateId}
LIMIT 1
</select>
<select id="getAgencyIssue" resultType="com.epmet.dataaggre.dto.datastats.result.AgencyBasicDataResultDTO">
SELECT
issue_total AS issueTotal,
voting_total AS votingTotal,
closed_total AS closedIssueTotal,
shift_project_total AS shiftProjectTotal
FROM
fact_issue_agency_daily
WHERE
del_flag = '0'
AND agency_id = #{agencyId}
AND date_id = #{dateId}
LIMIT 1
</select>
<select id="getAgencyProject" resultType="com.epmet.dataaggre.dto.datastats.result.AgencyBasicDataResultDTO">
SELECT
IFNULL(project_total, 0) AS "projectTotal",
IFNULL(pending_total, 0) AS "pendingTotal",
IFNULL(closed_total, 0) AS "closedProjectTotal"
FROM
fact_agency_project_daily
WHERE
del_flag = '0'
AND agency_id = '8631fa4b22e88fdc259b3f51b5de2be2'
AND date_id = #{dateId}
LIMIT 1
</select>
<select id="getSubAgencyList" resultType="com.epmet.dataaggre.entity.datastats.DimAgencyEntity">
SELECT
*
FROM
dim_agency
WHERE
del_flag = '0'
AND agency_dim_type = 'all'
AND pid = #{pid}
</select>
<select id="getSubAgencyUser" resultType="com.epmet.dataaggre.dto.datastats.result.SubAgencyUserResultDTO">
SELECT
agency_id AS agencyId,
reg_total AS userTotal,
partymember_total AS partyMemberTotal,
(reg_total - partymember_total) AS resiTotal
FROM
fact_reg_user_agency_daily
WHERE
del_flag = '0'
AND date_id = #{dateId}
<foreach item="agencyId" collection="agencyIds" open="AND (" separator="or" close=")" index="">
agency_id = #{agencyId}
</foreach>
ORDER BY
reg_total DESC
</select>
<select id="getSubGridList" resultType="com.epmet.dataaggre.entity.datastats.DimGridEntity">
SELECT
*
FROM
dim_grid
WHERE
del_flag = '0'
AND agency_id = #{agencyId}
</select>
<select id="getSubGridUser" resultType="com.epmet.dataaggre.dto.datastats.result.SubGridUserResultDTO">
SELECT
grid_id AS gridId,
reg_total AS userTotal,
partymember_total AS partyMemberTotal,
(reg_total - partymember_total) AS resiTotal
FROM
fact_reg_user_grid_daily
WHERE
del_flag = '0'
AND date_id = #{dateId}
<foreach item="gridId" collection="gridIds" open="AND (" separator="or" close=")" index="">
grid_id = #{gridId}
</foreach>
ORDER BY
reg_total DESC
</select>
<select id="getSubAgencyGroup" resultType="com.epmet.dataaggre.dto.datastats.result.SubAgencyGroupResultDTO">
SELECT
agency_id AS agencyId,
group_total AS groupTotal,
ordinary_total AS ordinaryTotal,
branch_total AS branchTotal
FROM
fact_group_total_agency_daily
WHERE
del_flag = '0'
AND date_id = #{dateId}
<foreach item="agencyId" collection="agencyIds" open="AND (" separator="or" close=")" index="">
agency_id = #{agencyId}
</foreach>
ORDER BY
group_total DESC
</select>
<select id="getSubGridGroup" resultType="com.epmet.dataaggre.dto.datastats.result.SubGridGroupResultDTO">
SELECT
grid_id AS gridId,
group_total AS groupTotal,
ordinary_total AS ordinaryTotal,
branch_total AS branchTotal
FROM
fact_group_total_grid_daily
WHERE
del_flag = '0'
AND date_id = #{dateId}
<foreach item="gridId" collection="gridIds" open="AND (" separator="or" close=")" index="">
grid_id = #{gridId}
</foreach>
ORDER BY
group_total DESC
</select>
<select id="getSubAgencyTopic" resultType="com.epmet.dataaggre.dto.datastats.form.SubAgencyFormDTO$Topic">
SELECT
agency_id AS agencyId,
topic_count AS topicCount,
topic_status_id AS topicStatus
FROM
fact_topic_status_agency_daily
WHERE
del_flag = '0'
AND topic_status_id in('discussing','closed','hidden')<!-- 讨论中(热议中!=讨论中)、已处理、已屏蔽 -->
AND date_id = #{dateId}
<foreach item="agencyId" collection="agencyIds" open="AND (" separator="or" close=")" index="">
agency_id = #{agencyId}
</foreach>
</select>
<select id="getSubAgencyTopicShiftIssue" resultType="com.epmet.dataaggre.dto.datastats.form.SubAgencyFormDTO$Topic">
SELECT
agency_id AS agencyId,
issue_total AS shiftedIssueTotal
FROM
fact_topic_issue_agency_daily
WHERE
del_flag = '0'
AND date_id = #{dateId}
<foreach item="agencyId" collection="agencyIds" open="AND (" separator="or" close=")" index="">
agency_id = #{agencyId}
</foreach>
</select>
<select id="getSubGridTopic" resultType="com.epmet.dataaggre.dto.datastats.form.SubGridFormDTO$Topic">
SELECT
grid_id AS gridId,
topic_count AS topicCount,
topic_status_id AS topicStatus
FROM
fact_topic_status_grid_daily
WHERE
del_flag = '0'
AND topic_status_id in('discussing','closed','hidden')<!-- 讨论中(热议中!=讨论中)、已处理、已屏蔽 -->
AND date_id = #{dateId}
<foreach item="gridId" collection="gridIds" open="AND (" separator="or" close=")" index="">
grid_id = #{gridId}
</foreach>
</select>
<select id="getSubGridTopicShiftIssue" resultType="com.epmet.dataaggre.dto.datastats.form.SubGridFormDTO$Topic">
SELECT
grid_id AS gridId,
issue_total AS shiftedIssueTotal
FROM
fact_topic_issue_grid_daily
WHERE
del_flag = '0'
AND date_id = #{dateId}
<foreach item="gridId" collection="gridIds" open="AND (" separator="or" close=")" index="">
grid_id = #{gridId}
</foreach>
</select>
<select id="getSubAgencyIssue" resultType="com.epmet.dataaggre.dto.datastats.result.SubAgencyIssueResultDTO">
SELECT
agency_id AS agencyId,
issue_total AS issueTotal,
voting_total AS votingTotal,
closed_total AS closedIssueTotal,
shift_project_total AS shiftProjectTotal
FROM
fact_issue_agency_daily
WHERE
del_flag = '0'
AND date_id = #{dateId}
<foreach item="agencyId" collection="agencyIds" open="AND (" separator="or" close=")" index="">
agency_id = #{agencyId}
</foreach>
ORDER BY
issue_total DESC
</select>
<select id="getSubGridIssue" resultType="com.epmet.dataaggre.dto.datastats.result.SubGridIssueResultDTO">
SELECT
grid_id AS gridId,
issue_total AS issueTotal,
voting_total AS votingTotal,
closed_total AS closedIssueTotal,
shift_project_total AS shiftProjectTotal
FROM
fact_issue_grid_daily
WHERE
del_flag = '0'
AND date_id = #{dateId}
<foreach item="gridId" collection="gridIds" open="AND (" separator="or" close=")" index="">
grid_id = #{gridId}
</foreach>
ORDER BY
issue_total DESC
</select>
<select id="getSubAgencyProject" resultType="com.epmet.dataaggre.dto.datastats.result.SubAgencyProjectResultDTO">
SELECT
agency_id AS agencyId,
IFNULL(project_total, 0) AS "projectTotal",
IFNULL(pending_total, 0) AS "pendingTotal",
IFNULL(closed_total, 0) AS "closedProjectTotal"
FROM
fact_agency_project_daily
WHERE
del_flag = '0'
AND date_id = #{dateId}
<foreach item="agencyId" collection="agencyIds" open="AND (" separator="or" close=")" index="">
agency_id = #{agencyId}
</foreach>
ORDER BY
project_total DESC
</select>
<select id="getSubGridProject" resultType="com.epmet.dataaggre.dto.datastats.result.SubGridProjectResultDTO">
SELECT
grid_id AS gridId,
IFNULL(project_total, 0) AS "projectTotal",
IFNULL(pending_total, 0) AS "pendingTotal",
IFNULL(closed_total, 0) AS "closedProjectTotal"
FROM
fact_grid_project_daily
WHERE
del_flag = '0'
AND date_id = #{dateId}
<foreach item="gridId" collection="gridIds" open="AND (" separator="or" close=")" index="">
grid_id = #{gridId}
</foreach>
ORDER BY
project_total DESC
</select>
</mapper>

122
epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/index/dto/IndexExplainDTO.java

@ -0,0 +1,122 @@
/**
* 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.evaluationindex.index.dto;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* 指标说明文案
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-05-12
*/
@Data
public class IndexExplainDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
private String id;
/**
* 客户id
*/
private String customerId;
/**
* 标题
*/
private String title;
/**
* 指标code
*/
private String indexCode;
/**
* 含义
*/
private String meaning;
/**
* 组织级别网格级grid;社区级community;街道:street;区县级: district;市级: city;省级:province
*/
private String orgLevel;
/**
* 父ID
*/
private String pid;
/**
* 排序
*/
private Integer sort;
/**
* 是否需要查询1有0:
*/
private Integer isSearch;
/**
* 数据类型none本级self下级sub
*/
private String type;
/**
* 是否下钻1 0否eg网格的下级分数 下钻到党员
*/
private Integer goDown;
/**
* 删除标记 0未删除1已删除
*/
private String delFlag;
/**
* 乐观锁
*/
private Integer revision;
/**
* 创建人
*/
private String createdBy;
/**
* 创建时间
*/
private Date createdTime;
/**
* 更新人
*/
private String updatedBy;
/**
* 更新时间
*/
private Date updatedTime;
}

97
epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/index/dto/IndexExplainTreeDTO.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.evaluationindex.index.dto;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* 指标说明文案
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-05-12
*/
@Data
public class IndexExplainTreeDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
private String id;
/**
* 客户id
*/
private String customerId;
/**
* 标题
*/
private String title;
/**
* 含义
*/
private String meaning;
/**
* 指标code
*/
private String indexCode;
/**
* 组织级别网格级grid;社区级community;街道:street;区县级: district;市级: city;省级:province
*/
private String orgLevel;
/**
* 父ID
*/
private String pid;
/**
* 排序
*/
private Integer sort;
/**
* 是否需要查询1有0:
*/
private Integer isSearch;
/**
* 数据类型none本级self下级sub
*/
private String type;
/**
* 是否下钻1 0否eg网格的下级分数 下钻到党员
*/
private Integer goDown;
/**
* 子节点
*/
List<IndexExplainTreeDTO> children;
}

52
epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/index/form/IndexExplainFormDTO.java

@ -0,0 +1,52 @@
/**
* 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.evaluationindex.index.form;
import lombok.Data;
import java.io.Serializable;
/**
* 指标说明文案查询参数
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-05-12
*/
@Data
public class IndexExplainFormDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 客户id
*/
private String customerId;
/**
* 组织级别网格级grid;社区级community;街道:street;区县级: district;市级: city;省级:province
*/
private String orgLevel;
/**
* 组织id
*/
private String orgId;
}

40
epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/index/form/IndexScoreFormDTO.java

@ -0,0 +1,40 @@
package com.epmet.evaluationindex.index.form;
import lombok.Data;
import java.io.Serializable;
/**
* 指标分数 返回结果
* @Author sun
*/
@Data
public class IndexScoreFormDTO implements Serializable {
private static final long serialVersionUID = 6225580299239889980L;
private String customerId;
/**
* 组织或网格Id
*/
private String orgId;
/**
* 组织或网格类型
*/
private String orgType;
/**
* 月份Id格式202009
*/
private String monthId;
/**
* 类型党建能力dangjiannengli治理能力zhilinengli服务能力fuwunengli
*/
private String indexCode;
/**
* 所有有权重的指标code拼接的字符串 冒号隔开
*/
private String allParentIndexCode;
}

25
epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/index/result/IndexExplainChildResult.java

@ -0,0 +1,25 @@
package com.epmet.evaluationindex.index.result;
import com.epmet.evaluationindex.index.dto.IndexExplainDTO;
import lombok.Data;
import java.util.List;
/**
* desc:得分明细说明结果类
*
* @author: LiuJanJun
* @date: 2021/5/12 4:19 下午
* @version: 1.0
*/
@Data
public class IndexExplainChildResult extends IndexExplainDTO {
private static final long serialVersionUID = -3997821113617472317L;
}

48
epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/index/result/IndexExplainResult.java

@ -0,0 +1,48 @@
package com.epmet.evaluationindex.index.result;
import lombok.Data;
import java.util.ArrayList;
import java.util.List;
/**
* desc:得分明细说明结果类
*
* @author: LiuJanJun
* @date: 2021/5/12 4:19 下午
* @version: 1.0
*/
@Data
public class IndexExplainResult {
/**
* 标题
*/
private String title;
/**
* 含义
*/
private String meaning;
/**
* 子节点 list
*/
private List<IndexExplainResult> children = new ArrayList<>();
/**
* 子节点data list
*/
private List<IndexScoreDetailResult> tableDataList = new ArrayList<>();
/**
* 子节点标题 list
*/
private List<String> tableTileList = new ArrayList<>();
/**
* 阈值说明列表
*/
private List<String> thresholdList = new ArrayList<>();
}

92
epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/index/result/IndexGroupDetailResult.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.evaluationindex.index.result;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
/**
* 客户指标详情
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-05-12
*/
@Data
public class IndexGroupDetailResult implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 客户id
*/
private String customerId;
/**
* index_group.id
*/
private String indexGroupId;
/**
* 指标id
*/
private String indexId;
/**
* 指标code
*/
private String indexCode;
/**
* 指标名称
*/
private String indexName;
/**
* 所有有权重的指标code拼接的字符串 冒号隔开
*/
private String allParentIndexCode;
/**
* 所有指标code拼接的字符串 冒号隔开
*/
private String allIndexCodePath;
/**
* 权重同一组权重总和=1
*/
private BigDecimal weight;
/**
* 计算阈值-1:没有阈值如果是百分数则 为0.00几如果为数据则直接填数值
*/
private BigDecimal threshold;
/**
* 是否启用启用enable 禁用disabled
*/
private String status;
/**
* 正相关positive负相关negative
*/
private String correlation;
}

49
epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/index/result/IndexScoreDetailResult.java

@ -0,0 +1,49 @@
package com.epmet.evaluationindex.index.result;
import lombok.Data;
import java.io.Serializable;
/**
* desc:得分明细说明结果类
*
* @author: LiuJanJun
* @date: 2021/5/12 4:19 下午
* @version: 1.0
*/
@Data
public class IndexScoreDetailResult implements Serializable {
private static final long serialVersionUID = -3997821113617472317L;
/**
* 指标code
*/
private String indexCode;
/**
* 指标名称
*/
private String indexName;
/**
* 原始值(如果是平均分的话 则为 参与平均的个数)
*/
private String originValue;
/**
* 分值
*/
private String score;
/**
* 分值
*/
private String weight;
/**
* 数量
*/
private String quantity;
}

40
epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/index/result/IndexScoreResult.java

@ -0,0 +1,40 @@
package com.epmet.evaluationindex.index.result;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
/**
* 指标分数 返回结果
* @Author sun
*/
@Data
public class IndexScoreResult implements Serializable {
private static final long serialVersionUID = -8458272574625683349L;
/**
* 指标code
*/
private String indexCode;
/**
* 指标对应值数值或百分比原始值
*/
private BigDecimal score;
/**
* 指标对应的权重
*/
private BigDecimal weight;
/**
* 原始值
*/
private String originValue;
/**
* 数量
*/
private String quantity;
}

74
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/constant/IndexConstant.java

@ -0,0 +1,74 @@
package com.epmet.datareport.constant;
import org.apache.commons.lang3.StringUtils;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
/**
* @author sun
* @dscription 数据
*/
public class IndexConstant {
/**
* 评价指标类型-百分比
*/
public static final List<String> ScoreLastHeader = Arrays.asList("指标值", "得分", "权重");
public static final List<String> QuantityLastHeader = Arrays.asList("数量", "平均值", "权重");
private static final String DJZS_CN = "党建指数";
private static final String FWZS_CN = "服务指数";
private static final String ZLZS_CN = "治理指数";
private static final String ZB_CN = "指标";
private static final String BEN_JI = "本级";
private static final String XIA_JI = "下级";
/**
* desc: 根据indexCode 获取表格表头
*
* @param allIndexCode
* @return java.util.List<java.lang.String>
* @author LiuJanJun
* @date 2021/5/13 11:06 上午
*/
public static List<String> getStandardSelfHeaders(String allIndexCode) {
List<String> result = new ArrayList<>(8);
if (StringUtils.isBlank(allIndexCode)) {
return null;
}
if (allIndexCode.contains(FactConstant.DJNL)) {
result.add(BEN_JI + DJZS_CN + ZB_CN);
} else if (allIndexCode.contains(FactConstant.FWNL)) {
result.add(BEN_JI + FWZS_CN + ZB_CN);
} else if (allIndexCode.contains(FactConstant.ZLNL)) {
result.add(BEN_JI + ZLZS_CN + ZB_CN);
}
result.addAll(ScoreLastHeader);
return result;
}
/**
* desc: 根据indexCode 获取表格表头
*
* @param allIndexCode
* @return java.util.List<java.lang.String>
* @author LiuJanJun
* @date 2021/5/13 11:06 上午
*/
public static List<String> getStandardSubHeaders(String allIndexCode) {
List<String> result = new ArrayList<>(8);
if (allIndexCode.contains(FactConstant.DJNL)) {
result.add(XIA_JI + DJZS_CN + ZB_CN);
} else if (allIndexCode.contains(FactConstant.FWNL)) {
result.add(XIA_JI + FWZS_CN + ZB_CN);
} else if (allIndexCode.contains(FactConstant.ZLNL)) {
result.add(XIA_JI + ZLZS_CN + ZB_CN);
}
result.addAll(QuantityLastHeader);
return result;
}
}

62
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/index/IndexExplainController.java

@ -0,0 +1,62 @@
/**
* 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.datareport.controller.index;
import com.epmet.commons.tools.utils.Result;
import com.epmet.datareport.service.evaluationindex.index.IndexExplainService;
import com.epmet.evaluationindex.index.form.IndexExplainFormDTO;
import com.epmet.evaluationindex.index.result.IndexExplainResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* 指标说明文案
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-05-12
*/
@RestController
@RequestMapping("indexexplain")
public class IndexExplainController {
@Autowired
private IndexExplainService indexExplainService;
/**
* desc: 获取得分说明明细
*
* @param formDTO
* @return com.epmet.commons.tools.utils.Result<com.epmet.group.dto.result.GroupSummaryInfoResultDTO>
* @author LiuJanJun
* @date 2021/5/12 4:12 下午
*/
@PostMapping("detail")
public Result<List<IndexExplainResult>> getScoreDetail(@RequestBody IndexExplainFormDTO formDTO){
Result<List<IndexExplainResult>> ok = new Result<List<IndexExplainResult>>().ok(indexExplainService.getScoreDetail(formDTO));
return ok;
}
}

0
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/.gitignore

36
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/index/IndexExplainDao.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.datareport.dao.evaluationindex.index;
import com.epmet.evaluationindex.index.dto.IndexExplainTreeDTO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 指标说明文案
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-05-12
*/
@Mapper
public interface IndexExplainDao {
List<IndexExplainTreeDTO> getIndexExplainTreeByOrgType(@Param("orgLevel") String orgLevel);
}

33
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/index/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.datareport.dao.evaluationindex.index;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.datareport.entity.evaluationindex.IndexGroupEntity;
import org.apache.ibatis.annotations.Mapper;
/**
* 客户指标分组
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-05-12
*/
@Mapper
public interface IndexGroupDao extends BaseDao<IndexGroupEntity> {
}

45
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/index/IndexGroupDetailDao.java

@ -0,0 +1,45 @@
/**
* 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.datareport.dao.evaluationindex.index;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.datareport.entity.evaluationindex.IndexGroupDetailEntity;
import com.epmet.evaluationindex.index.result.IndexGroupDetailResult;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* 客户指标详情
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-05-12
*/
@Mapper
public interface IndexGroupDetailDao extends BaseDao<IndexGroupDetailEntity> {
/**
* desc: 根据客户Id获取客户所有指标数据
*
* @param customerId
* @return java.util.List<com.epmet.evaluationindex.index.result.IndexGroupDetailResult>
* @author LiuJanJun
* @date 2021/5/13 2:41 下午
*/
List<IndexGroupDetailResult> getAllIndexByCId(String customerId);
}

33
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/fact/FactIndexCpcScoreDao.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.datareport.dao.fact;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.datareport.entity.evaluationindex.FactIndexCpcScoreEntity;
import org.apache.ibatis.annotations.Mapper;
/**
* 党员相关分值
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-05-14
*/
@Mapper
public interface FactIndexCpcScoreDao extends BaseDao<FactIndexCpcScoreEntity> {
}

38
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/fact/FactIndexCpcSubScoreDao.java

@ -0,0 +1,38 @@
/**
* 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.datareport.dao.fact;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.datareport.entity.evaluationindex.FactIndexCpcSubScoreEntity;
import com.epmet.evaluationindex.index.form.IndexScoreFormDTO;
import com.epmet.evaluationindex.index.result.IndexScoreResult;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* 党员相关分值
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-05-14
*/
@Mapper
public interface FactIndexCpcSubScoreDao extends BaseDao<FactIndexCpcSubScoreEntity> {
List<IndexScoreResult> selecCpcAvgScore(IndexScoreFormDTO ablityListFormDTO);
}

12
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/fact/FactIndexGridSubScoreDao.java

@ -17,6 +17,8 @@
package com.epmet.datareport.dao.fact;
import com.epmet.evaluationindex.index.form.IndexScoreFormDTO;
import com.epmet.evaluationindex.index.result.IndexScoreResult;
import com.epmet.evaluationindex.screen.dto.form.AblityListFormDTO;
import com.epmet.evaluationindex.screen.dto.form.MonthAblityListFormDTO;
import com.epmet.evaluationindex.screen.dto.result.AblityListResultDTO;
@ -48,4 +50,14 @@ public interface FactIndexGridSubScoreDao {
* @author sun
*/
LinkedList<MonthAblityListResultDTO> selectGridMonthAblityList(MonthAblityListFormDTO formDTO);
/**
* desc: 查询分数
*
* @param ablityListFormDTO
* @return java.util.List<com.epmet.evaluationindex.index.result.IndexScoreResult>
* @author LiuJanJun
* @date 2021/5/14 2:07 下午
*/
List<IndexScoreResult> selectGridSubScore(IndexScoreFormDTO ablityListFormDTO);
}

98
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/entity/evaluationindex/FactIndexCpcScoreEntity.java

@ -0,0 +1,98 @@
/**
* 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.datareport.entity.evaluationindex;
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 2021-05-14
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("fact_index_cpc_score")
public class FactIndexCpcScoreEntity extends BaseEpmetEntity {
private static final long serialVersionUID = 1L;
/**
* 客户Id
*/
private String customerId;
/**
* 网格所属的机关Id
*/
private String agencyId;
/**
* 网格Id
*/
private String gridId;
/**
* 年度ID: yyyy
*/
private String yearId;
/**
* 月维度Id: yyyyMM
*/
private String monthId;
/**
* 用户id
*/
private String userId;
/**
* 1总分0不是 默认0
*/
private String isTotal;
/**
* 分值
*/
private BigDecimal score;
/**
* 参与议事分值canyuyishi
党务活动分值dangwuhuodong
联系群众分值lianxiqunzhong
党建能力分值dangjiannengli
*/
private String indexCode;
/**
* 所有指标code拼接的字符串 冒号隔开
*/
private String allParentIndexCode;
/**
* 权重同一组权重总和=1
*/
private BigDecimal weight;
}

98
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/entity/evaluationindex/FactIndexCpcSubScoreEntity.java

@ -0,0 +1,98 @@
/**
* 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.datareport.entity.evaluationindex;
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 2021-05-14
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("fact_index_cpc_sub_score")
public class FactIndexCpcSubScoreEntity extends BaseEpmetEntity {
private static final long serialVersionUID = 1L;
/**
* 客户Id
*/
private String customerId;
/**
* 网格所属的机关Id
*/
private String agencyId;
/**
* 网格Id
*/
private String gridId;
/**
* 年度ID: yyyy
*/
private String yearId;
/**
* 月维度Id: yyyyMM
*/
private String monthId;
/**
* 用户id
*/
private String userId;
/**
* 计算指标时的原始值 字符串类型
*/
private String originValue;
/**
* 分值
*/
private BigDecimal score;
/**
* 参与议事分值canyuyishi
党务活动分值dangwuhuodong
联系群众分值lianxiqunzhong
党建能力分值dangjiannengli
*/
private String indexCode;
/**
* 所有指标code拼接的字符串 冒号隔开
*/
private String allParentIndexCode;
/**
* 权重同一组权重总和=1
*/
private BigDecimal weight;
}

90
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/entity/evaluationindex/IndexGroupDetailEntity.java

@ -0,0 +1,90 @@
/**
* 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.datareport.entity.evaluationindex;
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 2021-05-12
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("index_group_detail")
public class IndexGroupDetailEntity extends BaseEpmetEntity {
private static final long serialVersionUID = 1L;
/**
* 客户id
*/
private String customerId;
/**
* index_group.id
*/
private String indexGroupId;
/**
* 指标id
*/
private String indexId;
/**
* 指标code
*/
private String indexCode;
/**
* 所有有权重的指标code拼接的字符串 冒号隔开
*/
private String allParentIndexCode;
/**
* 所有指标code拼接的字符串 冒号隔开
*/
private String allIndexCodePath;
/**
* 权重同一组权重总和=1
*/
private BigDecimal weight;
/**
* 计算阈值-1:没有阈值如果是百分数则 为0.00几如果为数据则直接填数值
*/
private BigDecimal threshold;
/**
* 是否启用启用enable 禁用disabled
*/
private String status;
/**
* 正相关positive负相关negative
*/
private String correlation;
}

68
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/entity/evaluationindex/IndexGroupEntity.java

@ -0,0 +1,68 @@
/**
* 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.datareport.entity.evaluationindex;
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 2021-05-12
*/
@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;
/**
* 指标code
*/
private String indexCode;
/**
* 是否启用启用enable 禁用disabled
*/
private String status;
/**
* 当前指标关联的上一级指标分组如果没有上一级则为0
*/
private String parentIndexGroupId;
/**
* 所有指标code拼接的字符串 冒号隔开
*/
private String allIndexCodePath;
}

42
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/index/IndexExplainService.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.datareport.service.evaluationindex.index;
import com.epmet.evaluationindex.index.form.IndexExplainFormDTO;
import com.epmet.evaluationindex.index.result.IndexExplainResult;
import java.util.List;
/**
* 指标说明文案
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-05-12
*/
public interface IndexExplainService {
/**
* desc: 获取指标得分说明
*
* @param formDTO
* @return java.util.List<com.epmet.evaluationindex.index.result.IndexExplainResult>
* @author LiuJanJun
* @date 2021/5/12 4:38 下午
*/
List<IndexExplainResult> getScoreDetail(IndexExplainFormDTO formDTO);
}

191
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/index/impl/IndexExplainServiceImpl.java

@ -0,0 +1,191 @@
/**
* 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.datareport.service.evaluationindex.index.impl;
import com.epmet.commons.dynamic.datasource.annotation.DataSource;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.utils.DateUtils;
import com.epmet.constant.DataSourceConstant;
import com.epmet.datareport.constant.IndexConstant;
import com.epmet.datareport.dao.evaluationindex.index.IndexExplainDao;
import com.epmet.datareport.dao.evaluationindex.index.IndexGroupDetailDao;
import com.epmet.datareport.dao.fact.FactIndexCpcSubScoreDao;
import com.epmet.datareport.dao.fact.FactIndexGridSubScoreDao;
import com.epmet.datareport.service.evaluationindex.index.IndexExplainService;
import com.epmet.evaluationindex.index.dto.IndexExplainTreeDTO;
import com.epmet.evaluationindex.index.form.IndexExplainFormDTO;
import com.epmet.evaluationindex.index.form.IndexScoreFormDTO;
import com.epmet.evaluationindex.index.result.IndexExplainResult;
import com.epmet.evaluationindex.index.result.IndexGroupDetailResult;
import com.epmet.evaluationindex.index.result.IndexScoreDetailResult;
import com.epmet.evaluationindex.index.result.IndexScoreResult;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* 指标说明文案
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-05-12
*/
@Service
@DataSource(DataSourceConstant.EVALUATION_INDEX)
public class IndexExplainServiceImpl implements IndexExplainService {
@Autowired
private IndexExplainDao indexExplainDao;
@Autowired
private IndexGroupDetailDao indexGroupDetailDao;
@Autowired
private FactIndexGridSubScoreDao gridSubScoreDao;
@Autowired
private FactIndexCpcSubScoreDao factIndexCpcSubScoreDao;
@Override
public List<IndexExplainResult> getScoreDetail(IndexExplainFormDTO formDTO) {
List<IndexExplainResult> results = new ArrayList<>();
List<IndexExplainTreeDTO> explainDTOList = indexExplainDao.getIndexExplainTreeByOrgType(formDTO.getOrgLevel());
if (CollectionUtils.isEmpty(explainDTOList)) {
return null;
}
List<IndexGroupDetailResult> groupDetailEntities = indexGroupDetailDao.getAllIndexByCId(formDTO.getCustomerId());
if (CollectionUtils.isEmpty(groupDetailEntities)) {
return null;
}
Map<String, List<IndexGroupDetailResult>> detailEntityMap = groupDetailEntities.stream().collect(Collectors.groupingBy(IndexGroupDetailResult::getAllParentIndexCode));
for (IndexExplainTreeDTO explainDTO : explainDTOList) {
//根节点
IndexExplainResult result = new IndexExplainResult();
results.add(result);
result.setTitle(explainDTO.getTitle());
result.setMeaning(explainDTO.getMeaning());
//设置表格数据
setTableData(formDTO, detailEntityMap, explainDTO, result);
//子节点
setChildren(formDTO, detailEntityMap, result, explainDTO, explainDTO.getChildren());
}
return results;
}
private void setTableData(IndexExplainFormDTO formDTO, Map<String, List<IndexGroupDetailResult>> detailEntityMap, IndexExplainTreeDTO explainDTO, IndexExplainResult result) {
Integer goDown = explainDTO.getGoDown();
if (NumConstant.ONE == explainDTO.getIsSearch()) {
List<String> tableHeaders = getTableHeaders(explainDTO);
result.setTableTileList(tableHeaders);
switch (explainDTO.getOrgLevel()) {
case "grid":
String type = explainDTO.getType();
String allIndexCodePath = null;
List<IndexScoreDetailResult> tableList = null;
if ("zishen".equals(type)) {
allIndexCodePath = "wanggexiangguan:dangjiannengli";
tableList = setDefaultTableData(detailEntityMap, type, allIndexCodePath);
result.setTableDataList(tableList);
} else if ("xiaji".equals(type)) {
allIndexCodePath = "dangyuanxiangguan:lianxiqunzhong";
tableList = setDefaultTableData(detailEntityMap, type, allIndexCodePath);
result.setTableDataList(tableList);
}
//set Target value
IndexScoreFormDTO ablityListFormDTO = new IndexScoreFormDTO();
ablityListFormDTO.setCustomerId(formDTO.getCustomerId());
ablityListFormDTO.setOrgId(formDTO.getOrgId());
ablityListFormDTO.setMonthId(DateUtils.getCurrentTimeBeforeMonthId());
ablityListFormDTO.setAllParentIndexCode(allIndexCodePath);
//下钻到党员
List<IndexScoreResult> scoreList = null;
if (goDown == 1) {
scoreList = factIndexCpcSubScoreDao.selecCpcAvgScore(ablityListFormDTO);
} else {
//不下钻
scoreList = gridSubScoreDao.selectGridSubScore(ablityListFormDTO);
}
for (IndexScoreResult score : scoreList) {
for (IndexScoreDetailResult tb : tableList) {
if (tb.getIndexCode().equals(score.getIndexCode())) {
tb.setOriginValue(score.getOriginValue());
tb.setScore(String.valueOf(score.getScore()));
tb.setQuantity(score.getQuantity());
tb.setWeight(score.getWeight().multiply(new BigDecimal(100)).setScale(NumConstant.TWO, BigDecimal.ROUND_HALF_UP) + "%");
}
}
}
break;
default:
}
}
}
private List<IndexScoreDetailResult> setDefaultTableData(Map<String, List<IndexGroupDetailResult>> detailEntityMap, String type, String allIndexCodePath) {
List<IndexGroupDetailResult> indexGroupDetailEntities = detailEntityMap.get(allIndexCodePath);
List<IndexScoreDetailResult> tableList = new ArrayList<>();
indexGroupDetailEntities.forEach(index -> {
IndexScoreDetailResult table = new IndexScoreDetailResult();
table.setIndexCode(index.getIndexCode());
table.setIndexName(index.getIndexName());
table.setOriginValue(NumConstant.ZERO_STR);
table.setScore(NumConstant.ZERO_STR);
table.setWeight(index.getWeight().multiply(new BigDecimal(100)).setScale(NumConstant.TWO, BigDecimal.ROUND_HALF_UP) + "%");
tableList.add(table);
});
return tableList;
}
private void setChildren(IndexExplainFormDTO formDTO, Map<String, List<IndexGroupDetailResult>> detailEntityMap, IndexExplainResult result, IndexExplainTreeDTO parentNode, List<IndexExplainTreeDTO> children) {
List<IndexExplainResult> childrenList = new ArrayList<>();
children.forEach(child -> {
IndexExplainResult ch = new IndexExplainResult();
ch.setTitle(child.getTitle());
ch.setMeaning(child.getMeaning());
if (CollectionUtils.isNotEmpty(child.getChildren())) {
setChildren(formDTO, detailEntityMap, ch, child, child.getChildren());
}
setTableData(formDTO, detailEntityMap, child, ch);
childrenList.add(ch);
});
result.setChildren(childrenList);
}
public static void main(String[] args) {
}
private List<String> getTableHeaders(IndexExplainTreeDTO explain) {
String type = explain.getType();
List<String> headers = new ArrayList<>();
if ("zishen".equals(type)) {
headers = IndexConstant.getStandardSelfHeaders(explain.getIndexCode());
} else if ("xiaji".equals(type)) {
headers = IndexConstant.getStandardSubHeaders(explain.getIndexCode());
}
return headers;
}
}

28
epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexCpcScoreDao.xml

@ -0,0 +1,28 @@
<?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.datareport.dao.fact.FactIndexCpcScoreDao">
<!--<resultMap type="com.epmet.entity.FactIndexCpcScoreEntity" id="factIndexCpcScoreMap">
<result property="id" column="ID"/>
<result property="customerId" column="CUSTOMER_ID"/>
<result property="agencyId" column="AGENCY_ID"/>
<result property="gridId" column="GRID_ID"/>
<result property="yearId" column="YEAR_ID"/>
<result property="monthId" column="MONTH_ID"/>
<result property="userId" column="USER_ID"/>
<result property="isTotal" column="IS_TOTAL"/>
<result property="score" column="SCORE"/>
<result property="indexCode" column="INDEX_CODE"/>
<result property="allParentIndexCode" column="ALL_PARENT_INDEX_CODE"/>
<result property="weight" column="WEIGHT"/>
<result property="delFlag" column="DEL_FLAG"/>
<result property="revision" column="REVISION"/>
<result property="createdBy" column="CREATED_BY"/>
<result property="createdTime" column="CREATED_TIME"/>
<result property="updatedBy" column="UPDATED_BY"/>
<result property="updatedTime" column="UPDATED_TIME"/>
</resultMap>-->
</mapper>

43
epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexCpcSubScoreDao.xml

@ -0,0 +1,43 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.epmet.datareport.dao.fact.FactIndexCpcSubScoreDao">
<!--<resultMap type="com.epmet.entity.FactIndexCpcSubScoreEntity" id="factIndexCpcSubScoreMap">
<result property="id" column="ID"/>
<result property="customerId" column="CUSTOMER_ID"/>
<result property="agencyId" column="AGENCY_ID"/>
<result property="gridId" column="GRID_ID"/>
<result property="yearId" column="YEAR_ID"/>
<result property="monthId" column="MONTH_ID"/>
<result property="userId" column="USER_ID"/>
<result property="originValue" column="ORIGIN_VALUE"/>
<result property="score" column="SCORE"/>
<result property="indexCode" column="INDEX_CODE"/>
<result property="allParentIndexCode" column="ALL_PARENT_INDEX_CODE"/>
<result property="weight" column="WEIGHT"/>
<result property="delFlag" column="DEL_FLAG"/>
<result property="revision" column="REVISION"/>
<result property="createdBy" column="CREATED_BY"/>
<result property="createdTime" column="CREATED_TIME"/>
<result property="updatedBy" column="UPDATED_BY"/>
<result property="updatedTime" column="UPDATED_TIME"/>
</resultMap>-->
<select id="selecCpcAvgScore" resultType="com.epmet.evaluationindex.index.result.IndexScoreResult">
SELECT
id, customer_id, agency_id, grid_id, year_id, month_id, user_id,
COUNT(*) quantity,
ROUND(AVG(score),2) score,
index_code, all_parent_index_code, weight
FROM fact_index_cpc_sub_score
WHERE ALL_PARENT_INDEX_CODE = #{allParentIndexCode}
AND CUSTOMER_ID = #{customerId}
and GRID_ID = #{orgId}
and MONTH_ID = #{monthId}
GROUP BY INDEX_CODE;
</select>
</mapper>

32
epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexGridSubScoreDao.xml

@ -40,5 +40,37 @@
ORDER BY
fact.month_id ASC
</select>
<select id="selectGridSubScore" resultType="com.epmet.evaluationindex.index.result.IndexScoreResult">
<!-- SELECT
fact.index_code,
IF(fact.origin_value='',0,IFNULL(fact.origin_value,0)) AS origin_value,
round(fact.SCORE,2) AS score,
round(fact.WEIGHT,2) AS weight
FROM
fact_index_grid_sub_score fact
WHERE
fact.del_flag = '0'
AND fact.all_parent_index_code = #{allParentIndexCode}
AND customer_id = #{customerId}
AND grid_id = #{orgId}
AND month_id = #{monthId}-->
SELECT
fact.index_code,
IF(fact.origin_value='',0,IFNULL(fact.origin_value,0)) AS origin_value,
round(fact.score,2) AS score,
round(fact.WEIGHT,2) AS weight
FROM
fact_index_grid_sub_score fact
WHERE
fact.del_flag = '0'
AND fact.all_parent_index_code = #{allParentIndexCode}
AND customer_id = #{customerId}
AND grid_id = #{orgId}
AND month_id = #{monthId}
</select>
</mapper>

0
epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/IndexDictDao.xml → epmet-module/data-report/data-report-server/src/main/resources/mapper/index/IndexDictDao.xml

41
epmet-module/data-report/data-report-server/src/main/resources/mapper/index/IndexExplainDao.xml

@ -0,0 +1,41 @@
<?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.datareport.dao.evaluationindex.index.IndexExplainDao">
<resultMap id="explainTreeResultMap" type="com.epmet.evaluationindex.index.dto.IndexExplainTreeDTO">
<result property="id" column="ID"/>
<result property="customerId" column="CUSTOMER_ID"/>
<result property="title" column="TITLE"/>
<result property="meaning" column="MEANING"/>
<result property="indexCode" column="INDEX_CODE"/>
<result property="orgLevel" column="ORG_LEVEL"/>
<result property="pid" column="PID"/>
<result property="sort" column="SORT"/>
<result property="isSearch" column="IS_SEARCH"/>
<result property="type" column="TYPE"/>
<result property="goDown" column="GO_DOWN"/>
<collection property="children" ofType="com.epmet.evaluationindex.index.dto.IndexExplainTreeDTO" column="ID" select="getIndexExplainTreeByPid">
</collection>
</resultMap>
<select id="getIndexExplainTreeByOrgType" resultMap="explainTreeResultMap">
SELECT
ID, CUSTOMER_ID, TITLE, MEANING, INDEX_CODE, ORG_LEVEL, PID, SORT, IS_SEARCH, TYPE, GO_DOWN
FROM index_explain
WHERE
ORG_LEVEL = #{orgLevel}
and DEL_FLAG = '0'
AND PID = '0'
ORDER BY SORT
</select>
<select id="getIndexExplainTreeByPid" resultMap="explainTreeResultMap">
SELECT
ID, CUSTOMER_ID, TITLE, MEANING, INDEX_CODE, ORG_LEVEL, PID, SORT, IS_SEARCH, TYPE, GO_DOWN
FROM index_explain
WHERE
DEL_FLAG = '0'
AND PID = #{pid}
ORDER BY SORT
</select>
</mapper>

23
epmet-module/data-report/data-report-server/src/main/resources/mapper/index/IndexGroupDao.xml

@ -0,0 +1,23 @@
<?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.datareport.dao.evaluationindex.index.IndexGroupDao">
<!--<resultMap type="com.epmet.entity.IndexGroupEntity" id="indexGroupMap">
<result property="id" column="ID"/>
<result property="customerId" column="CUSTOMER_ID"/>
<result property="indexId" column="INDEX_ID"/>
<result property="indexCode" column="INDEX_CODE"/>
<result property="status" column="STATUS"/>
<result property="parentIndexGroupId" column="PARENT_INDEX_GROUP_ID"/>
<result property="allIndexCodePath" column="ALL_INDEX_CODE_PATH"/>
<result property="delFlag" column="DEL_FLAG"/>
<result property="revision" column="REVISION"/>
<result property="createdBy" column="CREATED_BY"/>
<result property="createdTime" column="CREATED_TIME"/>
<result property="updatedBy" column="UPDATED_BY"/>
<result property="updatedTime" column="UPDATED_TIME"/>
</resultMap>-->
</mapper>

36
epmet-module/data-report/data-report-server/src/main/resources/mapper/index/IndexGroupDetailDao.xml

@ -0,0 +1,36 @@
<?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.datareport.dao.evaluationindex.index.IndexGroupDetailDao">
<!--<resultMap type="com.epmet.entity.IndexGroupDetailEntity" id="indexGroupDetailMap">
<result property="id" column="ID"/>
<result property="customerId" column="CUSTOMER_ID"/>
<result property="indexGroupId" column="INDEX_GROUP_ID"/>
<result property="indexId" column="INDEX_ID"/>
<result property="indexCode" column="INDEX_CODE"/>
<result property="allParentIndexCode" column="ALL_PARENT_INDEX_CODE"/>
<result property="allIndexCodePath" column="ALL_INDEX_CODE_PATH"/>
<result property="weight" column="WEIGHT"/>
<result property="threshold" column="THRESHOLD"/>
<result property="status" column="STATUS"/>
<result property="correlation" column="CORRELATION"/>
<result property="delFlag" column="DEL_FLAG"/>
<result property="revision" column="REVISION"/>
<result property="createdBy" column="CREATED_BY"/>
<result property="createdTime" column="CREATED_TIME"/>
<result property="updatedBy" column="UPDATED_BY"/>
<result property="updatedTime" column="UPDATED_TIME"/>
</resultMap>-->
<select id="getAllIndexByCId" resultType="com.epmet.evaluationindex.index.result.IndexGroupDetailResult">
SELECT
d.ID, d.CUSTOMER_ID, d.INDEX_GROUP_ID, d.INDEX_ID, d.INDEX_CODE, d.ALL_PARENT_INDEX_CODE,
d.ALL_INDEX_CODE_PATH, d.WEIGHT, d.THRESHOLD, d.STATUS, d.CORRELATION,
id.INDEX_NAME
FROM index_group_detail d LEFT JOIN index_dict id ON d.index_code = id.index_code
WHERE
d.DEL_FLAG = 0 AND id.DEL_FLAG = 0 AND d.CUSTOMER_ID = #{customerId}
</select>
</mapper>

146
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/FactOriginGroupMemberDailyDTO.java

@ -0,0 +1,146 @@
/**
* 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.extract;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
*
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-05-12
*/
@Data
public class FactOriginGroupMemberDailyDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
private String id;
/**
* 组Id
*/
private String groupId;
/**
* 小组所在的网格id
*/
private String gridId;
/**
* 小组所在的社区id
*/
private String agencyId;
/**
* 小组所在的街道id
*/
private String parentId;
/**
* 所有上级组织ID,英文:隔开
*/
private String pids;
/**
* 成员IduserId
*/
private String memberId;
/**
* 客户Id
*/
private String customerId;
/**
* leader(群主) member(成员)
*/
private String leaderFlag;
/**
* 入群审核通过或自动加入群的日期 yyyyMMdd
*/
private String dateId;
/**
* 入群周 2020W15
*/
private String weekId;
/**
* 入群月 202004
*/
private String monthId;
/**
* 入群季 2020Q2
*/
private String quarterId;
/**
* 入群年 2020
*/
private String yearId;
/**
* join入群群主建群自己入群也是join
*/
private String actionCode;
/**
* 是否是党员
*/
private Integer isParty;
/**
* 乐观锁
*/
private Integer revision;
/**
* 删除标识
*/
private String delFlag;
/**
*
*/
private String createdBy;
/**
*
*/
private Date createdTime;
/**
*
*/
private String updatedBy;
/**
*
*/
private Date updatedTime;
}

5
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/result/PartyMemberInfoResultDTO.java

@ -48,4 +48,9 @@ public class PartyMemberInfoResultDTO implements Serializable {
* 机关名称
*/
private String agencyName;
/**
* 党员的用户id
*/
private String userId;
}

70
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/group/ActCategoryDictDTO.java

@ -0,0 +1,70 @@
/**
* 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.group;
import lombok.Data;
import java.io.Serializable;
/**
* 活动类别字典
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-04-16
*/
@Data
public class ActCategoryDictDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
private String id;
/**
* 客户id
*/
private String customerId;
/**
* 类别编码
*/
private String categoryCode;
/**
* 活动类别名称eg支部建设联建共建
*/
private String categoryName;
/**
* 等级1,2......
*/
private Integer level;
/**
* 排序
*/
private Integer sort;
/**
* 上级类别编码
*/
private String parentCode;
}

4
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/group/form/GroupTotalFormDTO.java

@ -18,7 +18,7 @@ public class GroupTotalFormDTO implements Serializable {
*/
private String customerId = "";
/**
* 需要执行的日期格式yyyy-MM-dd2020-01-01
* 需要执行的日期格式yyyyMMdd
*/
private String date = "";
private String dateId = "";
}

20
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcollect/result/PartyJoinThreeMeetDTO.java

@ -0,0 +1,20 @@
package com.epmet.dto.indexcollect.result;
import lombok.Data;
import java.io.Serializable;
/**
* 网格相关党员参加三会一课人次
*
* @author yinzuomei@elink-cn.com
* @date 2021/5/13 10:50
*/
@Data
public class PartyJoinThreeMeetDTO implements Serializable {
private static final long serialVersionUID = 3027535602832948917L;
private String gridId;
private String userId;
private Integer joinThreeMeetsCount;
}

187
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/FactAgencyOriginProjectDailyDTO.java

@ -0,0 +1,187 @@
/**
* 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.stats;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
import java.math.BigDecimal;
/**
* 机关下日项目数据统计 存放机关下截止到当前日期的各项总数据以及昨日新增各项数据每日定时执行先删后增
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-05-12
*/
@Data
public class FactAgencyOriginProjectDailyDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 唯一标识
*/
private String id;
/**
* 客户Id dim_customer.id
*/
private String customerId;
/**
* 机关Id dim_agency.id
*/
private String agencyId;
/**
* 上级组织Iddim_agency.pid
*/
private String parentId;
/**
* 日维度Id dim_date.id
*/
private String dateId;
/**
* 周维度Id dim_week.id
*/
private String weekId;
/**
* 月维度Id dim_month.id
*/
private String monthId;
/**
* 季度ID
*/
private String quarterId;
/**
* 年维度Id dim_year.id
*/
private String yearId;
/**
* 项目来源 来源议题issue 组织agency
*/
private String origin;
/**
* 截止当日项目总数 当前组织及下级项目总数
*/
private Integer projectTotal;
/**
* 截止当日处理中项目数 当前组织及下级所有未结案项目总数
*/
private Integer pendingTotal;
/**
* 截止当日处理中项目占比 当前组织及下级未结案项目百分比存百分比数小数点后两位
*/
private BigDecimal pendingRatio;
/**
* 截止当日已结案项目数 当前组织及下级已结案项目总数
*/
private Integer closedTotal;
/**
* 截止当日已结案项目占比 当前组织及下级已结案项目百分比存百分比数小数点后两位
*/
private BigDecimal closedRatio;
/**
* 截止当日已结案中已解决项目数 当前组织及下级已结案项目中已解决总数
*/
private Integer resolvedTotal;
/**
* 截止当日已结案中已解决项目占比 当前组织及下级已结案项目中已解决占比
*/
private BigDecimal resolvedRatio;
/**
* 截止当日已结案中未解决项目数 当前组织及下级已结案项目中未解决总数
*/
private Integer unresolvedTotal;
/**
* 截止当日已结案中未解决项目占比 当前组织及下级已结案项目中未解决占比
*/
private BigDecimal unresolvedRatio;
/**
* 当日项目总数 当前组织及下级项目总数
*/
private Integer projectIncr;
/**
* 当日处理中项目数 当前组织及下级前一日新增处理中项目数
*/
private Integer pendingIncr;
/**
* 当日已结案项目数 当前组织及下级前一日新增结案项目数
*/
private Integer closedIncr;
/**
* 当日已结案项目中已解决数 当前组织及下级前一日新增结案中已解决项目数
*/
private Integer resolvedIncr;
/**
* 当日已结案项目组未解决数 当前组织及下级前一日新增结案中未解决项目数
*/
private Integer unresolvedIncr;
/**
* 删除标识 0.未删除 1.已删除
*/
private Integer delFlag;
/**
* 乐观锁
*/
private Integer revision;
/**
* 创建人
*/
private String createdBy;
/**
* 创建时间
*/
private Date createdTime;
/**
* 更新人
*/
private String updatedBy;
/**
* 更新时间
*/
private Date updatedTime;
}

172
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/FactAgencyOriginProjectMonthlyDTO.java

@ -0,0 +1,172 @@
/**
* 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.stats;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
import java.math.BigDecimal;
/**
* 机关下月项目数据统计 存放机关下截止到当前月份的各项总数据以及上月新增各项数据每月月初定时执行先删后增
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-05-12
*/
@Data
public class FactAgencyOriginProjectMonthlyDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 唯一标识
*/
private String id;
/**
* 客户Id dim_customer.id
*/
private String customerId;
/**
* 机关Id dim_agency.id
*/
private String agencyId;
/**
* 上级组织Iddim_agency.pid
*/
private String parentId;
/**
* 月维度Id dim_month.id
*/
private String monthId;
/**
* 季维度Id dim_quarter.id
*/
private String quarterId;
/**
* 年维度Id dim_year.id
*/
private String yearId;
/**
* 截止当月项目总数 当前组织及下级项目总数
*/
private Integer projectTotal;
/**
* 截止当月处理中项目数 当前组织及下级所有未结案项目总数
*/
private Integer pendingTotal;
/**
* 截止当月处理中项目占比 当前组织及下级未结案项目百分比存百分比数小数点后两位
*/
private BigDecimal pendingRatio;
/**
* 截止当月已结案项目数 当前组织及下级已结案项目总数
*/
private Integer closedTotal;
/**
* 截止当月已结案项目占比 当前组织及下级已结案项目百分比存百分比数小数点后两位
*/
private BigDecimal closedRatio;
/**
* 截止当月已结案中已解决项目数 当前组织及下级已结案项目中已解决总数
*/
private Integer resolvedTotal;
/**
* 截止当月已结案中已解决项目占比 当前组织及下级已结案项目中已解决占比
*/
private BigDecimal resolvedRatio;
/**
* 截止当月已结案中未解决项目数 当前组织及下级已结案项目中未解决总数
*/
private Integer unresolvedTotal;
/**
* 截止当月已结案中未解决项目占比 当前组织及下级已结案项目中未解决占比
*/
private BigDecimal unresolvedRatio;
/**
* 当月项目总数 当前组织及下级前一月新增项目数
*/
private Integer projectIncr;
/**
* 当月处理中项目数 当前组织及下级前一月新增处理中项目数
*/
private Integer pendingIncr;
/**
* 当月已结案项目数 当前组织及下级前一月新增结案项目数
*/
private Integer closedIncr;
/**
* 当月已结案项目中已解决数 当前组织及下级前一日新增结案中已解决项目数
*/
private Integer resolvedIncr;
/**
* 当月已结案项目组未解决数 当前组织及下级前一日新增结案中未解决项目数
*/
private Integer unresolvedIncr;
/**
* 删除标识 0.未删除 1.已删除
*/
private Integer delFlag;
/**
* 乐观锁
*/
private Integer revision;
/**
* 创建人
*/
private String createdBy;
/**
* 创建时间
*/
private Date createdTime;
/**
* 更新人
*/
private String updatedBy;
/**
* 更新时间
*/
private Date updatedTime;
}

9
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java

@ -35,6 +35,7 @@ import com.epmet.entity.stats.DimDateEntity;
import com.epmet.entity.stats.DimMonthEntity;
import com.epmet.service.StatsDemoService;
import com.epmet.service.evaluationindex.extract.dataToIndex.*;
import com.epmet.service.evaluationindex.extract.todata.FactGroupActDailyService;
import com.epmet.service.evaluationindex.extract.todata.FactOriginProjectCategoryDailyService;
import com.epmet.service.evaluationindex.extract.todata.FactOriginTopicMainDailyService;
import com.epmet.service.evaluationindex.extract.toscreen.*;
@ -109,6 +110,8 @@ public class DemoController {
private ScreenProjectCategoryGridDailyService projectCategoryGridDailyService;
@Autowired
private FactOriginProjectCategoryDailyService originProjectCategoryDailyService;
@Autowired
private FactGroupActDailyService factGroupActDailyService;
@GetMapping("testAlarm")
public void testAlarm() {
@ -870,4 +873,10 @@ public class DemoController {
return new Result().ok(ndddYhjfService.difficultyDataExtract(param));
}
@PostMapping("extractgroupact")
public Result extractGroupAct(@RequestParam("customerId") String customerId,@RequestParam("dateId")String dateId){
factGroupActDailyService.extractGridGroupActDaily(customerId,dateId);
factGroupActDailyService.extractAgencyGroupActDaily(customerId,dateId);
return new Result();
}
}

4
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/FactOriginExtractController.java

@ -126,7 +126,9 @@ public class FactOriginExtractController {
paramNew.setDateId(dateDimId);
groupExtractService.extractGroupData(paramNew);
}
}else groupExtractService.extractGroupData(param);
}else {
groupExtractService.extractGroupData(param);
}
return new Result();
}
}

38
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactGroupActDailyDao.java

@ -0,0 +1,38 @@
/**
* 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.evaluationindex.extract;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.entity.evaluationindex.extract.FactGroupActDailyEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/**
* 组织活动(参加人数组织次数平均参加人数)按天累计值分析
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-05-13
*/
@Mapper
public interface FactGroupActDailyDao extends BaseDao<FactGroupActDailyEntity> {
int deleteBatch(@Param("customerId") String customerId,
@Param("dateId") String dateId,
@Param("limit") Integer limit,
@Param("orgType")String orgType);
}

33
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactGroupActMonthlyDao.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.evaluationindex.extract;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.entity.evaluationindex.extract.FactGroupActMonthlyEntity;
import org.apache.ibatis.annotations.Mapper;
/**
* 专项组活动(参加人数组织次数平均参加人数)按月增量分析
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-05-13
*/
@Mapper
public interface FactGroupActMonthlyDao extends BaseDao<FactGroupActMonthlyEntity> {
}

6
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginGroupMainDailyDao.java

@ -199,4 +199,10 @@ public interface FactOriginGroupMainDailyDao extends BaseDao<FactOriginGroupMain
*/
List<OrgStatisticsResultDTO> selectOrgGroupCount(@Param("customerId") String customerId, @Param("monthId") String monthId,
@Param("level") String level);
/**
* @Author sun
* @Description 查询客户小组维度下有效群组列表
**/
List<FactOriginGroupMainDailyEntity> selectCustomerGroupList(@Param("customerId") String customerId, @Param("dateId") String dateId);
}

33
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginGroupMemberDailyDao.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.evaluationindex.extract;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.entity.evaluationindex.extract.FactOriginGroupMemberDailyEntity;
import org.apache.ibatis.annotations.Mapper;
/**
*
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-05-12
*/
@Mapper
public interface FactOriginGroupMemberDailyDao extends BaseDao<FactOriginGroupMemberDailyEntity> {
}

51
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/group/GroupDataDao.java

@ -1,12 +1,15 @@
package com.epmet.dao.group;
import com.epmet.dto.extract.FactOriginGroupMainDailyDTO;
import com.epmet.dto.group.ActCategoryDictDTO;
import com.epmet.dto.group.form.GridGroupPeopleFormDTO;
import com.epmet.dto.group.form.GridGroupPeopleTotalFormDTO;
import com.epmet.dto.group.form.GridGroupTotalFormDTO;
import com.epmet.dto.group.form.GroupIncrFormDTO;
import com.epmet.dto.group.result.*;
import com.epmet.entity.group.ResiGroupEntity;
import com.epmet.dto.indexcollect.result.CpcIndexCommonDTO;
import com.epmet.dto.indexcollect.result.GridIndexCommonDTO;
import com.epmet.entity.evaluationindex.extract.FactGroupActDailyEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@ -93,8 +96,46 @@ public interface GroupDataDao {
List<FactOriginGroupMainDailyDTO> groupExtracting(@Param("customerId")String customerId,@Param("dateId") String dateId);
/**
* @Author sun
* @Description 查询客户下有效群组列表
**/
List<ResiGroupEntity> selectCustomerGroupList(@Param("customerId")String customerId);
* 查询小组活动签到表计算用户在本月内签到的活动次数 限制活动分类编码100001 三会一课
*
* @param customerId
* @param monthId
* @return com.epmet.dto.indexcollect.result.CpcIndexCommonDTO
*/
List<CpcIndexCommonDTO> selectUserSignedCount(@Param("customerId")String customerId, @Param("monthId")String monthId);
/**
* 网格相关组织三会一课次数 当前网格下 满足未取消的活动 and 签到记录>1 and 活动开始时间在当前时间维度内 +1
*
* @param customerId
* @param monthId
* @return com.epmet.dto.indexcollect.result.CpcIndexCommonDTO
*/
List<GridIndexCommonDTO> selectCountGridCreateThreeMeets(@Param("customerId")String customerId, @Param("monthId")String monthId);
/**
* 网格相关组织三会一课次数 当前网格下 满足未取消的活动 and 签到记录>1 and 活动开始时间在当前时间维度内 +1
*
* @param customerId
* @return com.epmet.dto.group.ActCategoryDictDTO
*/
List<ActCategoryDictDTO> queryCustomerActCategoryDict(String customerId);
/**
* 查询某个分类截止到dateId,组织次数参与人数平均参与人数
*
* @param customerId
* @param dateId
* @param categoryCode
* @return com.epmet.entity.evaluationindex.extract.FactGroupActDailyEntity
*/
List<FactGroupActDailyEntity> selectCountGridGroupActDaily(@Param("customerId") String customerId,
@Param("dateId") String dateId,
@Param("categoryCode") String categoryCode,
@Param("gridId")String gridId);
List<FactGroupActDailyEntity> selectCountAgencyGroupActDaily(@Param("customerId") String customerId,
@Param("agencyId")String agencyId,
@Param("dateId") String dateId,
@Param("categoryCode") String categoryCode);
}

2
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/org/StatsCustomerAgencyDao.java

@ -33,4 +33,6 @@ public interface StatsCustomerAgencyDao extends BaseDao<CustomerAgencyEntity> {
List<CustomerAreaCodeResultDTO> selectCustomerAreaCodeById(@Param("customerIds") List<String> customerIds);
CustomerAgencyEntity getRootAgencyInfo(String customerId);
List<CustomerAgencyEntity> queryAgencyListByCustomerId(String customerId);
}

8
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/DimCustomerPartymemberDao.java

@ -100,4 +100,12 @@ public interface DimCustomerPartymemberDao extends BaseDao<DimCustomerPartymembe
* @Date 2020/9/24 14:31
**/
List<String> selectPartyMemberUserIdsByPids(@Param("customerId") String customerId, @Param("pids")String pids);
/**
* 查询当前客户下所有注册的党员
*
* @param customerId
* @return 返回网格id用户id
*/
List<PartyMemberInfoResultDTO> selectPartyMemberInfoByCustomerId(@Param("customerId")String customerId);
}

33
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/FactAgencyOriginProjectDailyDao.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.stats;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.entity.stats.FactAgencyOriginProjectDailyEntity;
import org.apache.ibatis.annotations.Mapper;
/**
* 机关下日项目数据统计 存放机关下截止到当前日期的各项总数据以及昨日新增各项数据每日定时执行先删后增
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-05-12
*/
@Mapper
public interface FactAgencyOriginProjectDailyDao extends BaseDao<FactAgencyOriginProjectDailyEntity> {
}

33
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/FactAgencyOriginProjectMonthlyDao.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.stats;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.entity.stats.FactAgencyOriginProjectMonthlyEntity;
import org.apache.ibatis.annotations.Mapper;
/**
* 机关下月项目数据统计 存放机关下截止到当前月份的各项总数据以及上月新增各项数据每月月初定时执行先删后增
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-05-12
*/
@Mapper
public interface FactAgencyOriginProjectMonthlyDao extends BaseDao<FactAgencyOriginProjectMonthlyEntity> {
}

100
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/extract/FactGroupActDailyEntity.java

@ -0,0 +1,100 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.entity.evaluationindex.extract;
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 2021-05-13
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("fact_group_act_daily")
public class FactGroupActDailyEntity extends BaseEpmetEntity {
private static final long serialVersionUID = 1L;
/**
* 客户ID
*/
private String customerId;
/**
* 数据更新至日期IdyyyyMMdd
*/
private String dateId;
/**
* 网格id
*/
private String orgId;
/**
* 网格grid;组织agency
*/
private String orgType;
/**
* 1)orgType=grid: pid=网格所属组织id;
2)orgType=agency pid=当前组织的上级组织
*/
private String pid;
/**
* 1)orgType=grid: pids=网格所有上级组织包括pid;
2)orgType=agency pids=当前组织的所有上级组织包括pid.
*/
private String pids;
/**
* 活动分类编码
*/
private String categoryCode;
/**
* 上级分类编码
*/
private String parentCode;
/**
* 分类等级
*/
private Integer level;
/**
* 截止到dateId: 组织次数;包含dateId这一天的数据
*/
private Integer organizeTotal;
/**
* 截止到dateId: 参加人数;包含dateId这一天的数据
*/
private Integer participateUserTotal;
/**
* 截止到dateId: 平均参加人数;包含dateId这一天的数据
*/
private Integer avgParticipateUserTotal;
}

100
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/extract/FactGroupActMonthlyEntity.java

@ -0,0 +1,100 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.entity.evaluationindex.extract;
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 2021-05-13
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("fact_group_act_monthly")
public class FactGroupActMonthlyEntity extends BaseEpmetEntity {
private static final long serialVersionUID = 1L;
/**
* 客户ID
*/
private String customerId;
/**
* 数据维度yyyyMM
*/
private String monthId;
/**
* 网格id
*/
private String orgId;
/**
* 网格grid;组织agency
*/
private String orgType;
/**
* 1)orgType=grid: pid=网格所属组织id;
2)orgType=agency pid=当前组织的上级组织
*/
private String pid;
/**
* 1)orgType=grid: pids=网格所有上级组织包括pid;
2)orgType=agency pids=当前组织的所有上级组织包括pid.
*/
private String pids;
/**
* 活动分类编码
*/
private String categoryCode;
/**
* 上级分类编码
*/
private String parentCode;
/**
* 分类等级
*/
private Integer level;
/**
* 本月内活动组织次数
*/
private Integer organizeIncr;
/**
* 本月内活动签到人数参加人数
*/
private Integer participateUserIncr;
/**
* 本月内平均参加人数
*/
private Integer avgParticipateUserIncr;
}

5
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/extract/FactOriginGroupMainDailyEntity.java

@ -116,4 +116,9 @@ Ps: 如果一个小组被拒绝,当前小组的状态将永久停留在“审
*/
private Integer isOwnerParty;
/**
* 小组类型(ordinary:楼院小组 branch:支部小组)
*/
private String groupType;
}

116
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/extract/FactOriginGroupMemberDailyEntity.java

@ -0,0 +1,116 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.entity.evaluationindex.extract;
import com.baomidou.mybatisplus.annotation.TableName;
import com.epmet.commons.mybatis.entity.BaseEpmetEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
/**
*
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-05-12
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("fact_origin_group_member_daily")
public class FactOriginGroupMemberDailyEntity extends BaseEpmetEntity {
private static final long serialVersionUID = 1L;
/**
* 组Id
*/
private String groupId;
/**
* 小组所在的网格id
*/
private String gridId;
/**
* 小组所在的社区id
*/
private String agencyId;
/**
* 小组所在的街道id
*/
private String parentId;
/**
* 所有上级组织ID,英文:隔开
*/
private String pids;
/**
* 成员IduserId
*/
private String memberId;
/**
* 客户Id
*/
private String customerId;
/**
* leader(群主) member(成员)
*/
private String leaderFlag;
/**
* 入群审核通过或自动加入群的日期 yyyyMMdd
*/
private String dateId;
/**
* 入群周 2020W15
*/
private String weekId;
/**
* 入群月 202004
*/
private String monthId;
/**
* 入群季 2020Q2
*/
private String quarterId;
/**
* 入群年 2020
*/
private String yearId;
/**
* join入群群主建群自己入群也是join
*/
private String actionCode;
/**
* 是否是党员
*/
private Integer isParty;
}

157
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/stats/FactAgencyOriginProjectDailyEntity.java

@ -0,0 +1,157 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.entity.stats;
import com.baomidou.mybatisplus.annotation.TableName;
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 2021-05-12
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("fact_agency_origin_project_daily")
public class FactAgencyOriginProjectDailyEntity extends BaseEpmetEntity {
private static final long serialVersionUID = 1L;
/**
* 客户Id dim_customer.id
*/
private String customerId;
/**
* 机关Id dim_agency.id
*/
private String agencyId;
/**
* 上级组织Iddim_agency.pid
*/
private String parentId;
/**
* 日维度Id dim_date.id
*/
private String dateId;
/**
* 周维度Id dim_week.id
*/
private String weekId;
/**
* 月维度Id dim_month.id
*/
private String monthId;
/**
* 季度ID
*/
private String quarterId;
/**
* 年维度Id dim_year.id
*/
private String yearId;
/**
* 项目来源 来源议题issue 组织agency
*/
private String origin;
/**
* 截止当日项目总数 当前组织及下级项目总数
*/
private Integer projectTotal;
/**
* 截止当日处理中项目数 当前组织及下级所有未结案项目总数
*/
private Integer pendingTotal;
/**
* 截止当日处理中项目占比 当前组织及下级未结案项目百分比存百分比数小数点后两位
*/
private BigDecimal pendingRatio;
/**
* 截止当日已结案项目数 当前组织及下级已结案项目总数
*/
private Integer closedTotal;
/**
* 截止当日已结案项目占比 当前组织及下级已结案项目百分比存百分比数小数点后两位
*/
private BigDecimal closedRatio;
/**
* 截止当日已结案中已解决项目数 当前组织及下级已结案项目中已解决总数
*/
private Integer resolvedTotal;
/**
* 截止当日已结案中已解决项目占比 当前组织及下级已结案项目中已解决占比
*/
private BigDecimal resolvedRatio;
/**
* 截止当日已结案中未解决项目数 当前组织及下级已结案项目中未解决总数
*/
private Integer unresolvedTotal;
/**
* 截止当日已结案中未解决项目占比 当前组织及下级已结案项目中未解决占比
*/
private BigDecimal unresolvedRatio;
/**
* 当日项目总数 当前组织及下级项目总数
*/
private Integer projectIncr;
/**
* 当日处理中项目数 当前组织及下级前一日新增处理中项目数
*/
private Integer pendingIncr;
/**
* 当日已结案项目数 当前组织及下级前一日新增结案项目数
*/
private Integer closedIncr;
/**
* 当日已结案项目中已解决数 当前组织及下级前一日新增结案中已解决项目数
*/
private Integer resolvedIncr;
/**
* 当日已结案项目组未解决数 当前组织及下级前一日新增结案中未解决项目数
*/
private Integer unresolvedIncr;
}

142
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/stats/FactAgencyOriginProjectMonthlyEntity.java

@ -0,0 +1,142 @@
/**
* 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.stats;
import com.baomidou.mybatisplus.annotation.TableName;
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 2021-05-12
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("fact_agency_origin_project_monthly")
public class FactAgencyOriginProjectMonthlyEntity extends BaseEpmetEntity {
private static final long serialVersionUID = 1L;
/**
* 客户Id dim_customer.id
*/
private String customerId;
/**
* 机关Id dim_agency.id
*/
private String agencyId;
/**
* 上级组织Iddim_agency.pid
*/
private String parentId;
/**
* 月维度Id dim_month.id
*/
private String monthId;
/**
* 季维度Id dim_quarter.id
*/
private String quarterId;
/**
* 年维度Id dim_year.id
*/
private String yearId;
/**
* 截止当月项目总数 当前组织及下级项目总数
*/
private Integer projectTotal;
/**
* 截止当月处理中项目数 当前组织及下级所有未结案项目总数
*/
private Integer pendingTotal;
/**
* 截止当月处理中项目占比 当前组织及下级未结案项目百分比存百分比数小数点后两位
*/
private BigDecimal pendingRatio;
/**
* 截止当月已结案项目数 当前组织及下级已结案项目总数
*/
private Integer closedTotal;
/**
* 截止当月已结案项目占比 当前组织及下级已结案项目百分比存百分比数小数点后两位
*/
private BigDecimal closedRatio;
/**
* 截止当月已结案中已解决项目数 当前组织及下级已结案项目中已解决总数
*/
private Integer resolvedTotal;
/**
* 截止当月已结案中已解决项目占比 当前组织及下级已结案项目中已解决占比
*/
private BigDecimal resolvedRatio;
/**
* 截止当月已结案中未解决项目数 当前组织及下级已结案项目中未解决总数
*/
private Integer unresolvedTotal;
/**
* 截止当月已结案中未解决项目占比 当前组织及下级已结案项目中未解决占比
*/
private BigDecimal unresolvedRatio;
/**
* 当月项目总数 当前组织及下级前一月新增项目数
*/
private Integer projectIncr;
/**
* 当月处理中项目数 当前组织及下级前一月新增处理中项目数
*/
private Integer pendingIncr;
/**
* 当月已结案项目数 当前组织及下级前一月新增结案项目数
*/
private Integer closedIncr;
/**
* 当月已结案项目中已解决数 当前组织及下级前一日新增结案中已解决项目数
*/
private Integer resolvedIncr;
/**
* 当月已结案项目组未解决数 当前组织及下级前一日新增结案中未解决项目数
*/
private Integer unresolvedIncr;
}

2
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/StatsGroupService.java

@ -3,6 +3,8 @@ package com.epmet.service;
import com.epmet.dto.group.form.GroupStatsFormDTO;
import com.epmet.dto.group.form.GroupTotalFormDTO;
import java.text.ParseException;
/**
* @Author zxc
* @CreateTime 2020/6/16 14:14

31
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/dataToIndex/impl/CalCpcIndexServiceImpl.java

@ -7,6 +7,7 @@ import com.epmet.entity.evaluationindex.indexcoll.FactIndexPartyAblityCpcMonthly
import com.epmet.service.evaluationindex.extract.dataToIndex.CalCpcIndexService;
import com.epmet.service.evaluationindex.extract.todata.*;
import com.epmet.service.evaluationindex.indexcoll.FactIndexPartyAblityCpcMonthlyService;
import com.epmet.service.group.GroupDataService;
import com.epmet.service.stats.DimCustomerPartymemberService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
@ -43,6 +44,8 @@ public class CalCpcIndexServiceImpl implements CalCpcIndexService {
private FactIndexPartyAblityCpcMonthlyService factIndexPartyAblityCpcMonthlyService;
@Autowired
private FactOriginGroupMainDailyService factOriginGroupMainDailyService;
@Autowired
private GroupDataService groupDataService;
/**
* @param customerId 客户id
@ -54,7 +57,7 @@ public class CalCpcIndexServiceImpl implements CalCpcIndexService {
**/
@Override
public void calCpcPartyAbility(String customerId, String monthId) {
//1、构造初始值
//1、构造初始值 当前客户下所有的党员
List<FactIndexPartyAblityCpcMonthlyEntity> indexPartyAblityCpcList = dimCustomerPartymemberService.selectPartyMemberList(customerId);
if (CollectionUtils.isEmpty(indexPartyAblityCpcList)) {
log.info("dim_customer_partymember do not any records customerId="+customerId);
@ -71,7 +74,8 @@ public class CalCpcIndexServiceImpl implements CalCpcIndexService {
Map<String, Integer> shiftIssueCountMap = calShiftIssueCount(customerId, monthId);
//4、党员提出的议题转项目数
Map<String, Integer> shiftProjectCountMap = calShiftProjectCount(customerId, monthId);
//5、参加“三会一课”次数 默认0
//5、参加“三会一课”次数 默认0 :当前用户在本月内活动签到次数 限制活动分类编码100001 三会一课
Map<String,Integer> joinThreeMeetsCountMap=calJoinThreeMeetsCount(customerId,monthId);
//可以先查询出每个党员的 自建群
Map<String, List<String>> userCreatedGroups = queryUserCreatedGroups(customerId, indexPartyAblityCpcList);
@ -105,7 +109,10 @@ public class CalCpcIndexServiceImpl implements CalCpcIndexService {
if (shiftProjectCountMap.containsKey(indexPartyAblityCpcEntity.getUserId())) {
indexPartyAblityCpcEntity.setShiftProjectCount(shiftProjectCountMap.get(indexPartyAblityCpcEntity.getUserId()));
}
//5、参加“三会一课”次数 目前没有此业务,默认0
//5、参加“三会一课”次数 目前没有此业务,默认0 : 当前用户在本月内活动签到次数 限制活动分类编码100001 三会一课
if(joinThreeMeetsCountMap.containsKey(indexPartyAblityCpcEntity.getUserId())){
indexPartyAblityCpcEntity.setJoinThreeMeetsCount(joinThreeMeetsCountMap.get(indexPartyAblityCpcEntity.getUserId()));
}
//6、党员自建群群众人数
if (groupUserCountMap.containsKey(indexPartyAblityCpcEntity.getUserId())) {
indexPartyAblityCpcEntity.setGroupUserCount(groupUserCountMap.get(indexPartyAblityCpcEntity.getUserId()));
@ -220,6 +227,24 @@ public class CalCpcIndexServiceImpl implements CalCpcIndexService {
return resultMap;
}
/**
* @return java.util.Map<java.lang.String,java.lang.Integer>
* @param customerId
* @param monthId
* @author yinzuomei
* @description 5:参加三会一课次数 : 当前用户在本月内活动签到次数 限制活动分类编码100001 三会一课
* @Date 2021/5/12 13:38
**/
private Map<String, Integer> calJoinThreeMeetsCount(String customerId, String monthId) {
//查询小组活动签到表,计算用户在本月内签到的活动次数
List<CpcIndexCommonDTO> list=groupDataService.selectJoinThreeMeetsCount(customerId,monthId);
Map<String, Integer> resultMap = new HashMap<>();
for (CpcIndexCommonDTO cpcIndexCommonDTO : list) {
resultMap.put(cpcIndexCommonDTO.getUserId(), cpcIndexCommonDTO.getIndexValue());
}
return resultMap;
}
/**
* @param customerId
* @param monthId

67
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/dataToIndex/impl/CalGridIndexServiceImpl.java

@ -1,6 +1,7 @@
package com.epmet.service.evaluationindex.extract.dataToIndex.impl;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.DateUtils;
import com.epmet.constant.ExtractConstant;
import com.epmet.constant.ProjectEvaluateConstant;
@ -8,6 +9,9 @@ import com.epmet.dto.extract.form.GovernAbilityGridMonthlyFormDTO;
import com.epmet.dto.extract.form.GridIssueCountResultDTO;
import com.epmet.dto.extract.form.PartyAbilityGridMonthlyFormDTO;
import com.epmet.dto.extract.result.*;
import com.epmet.dto.indexcollect.result.CpcIndexCommonDTO;
import com.epmet.dto.indexcollect.result.GridIndexCommonDTO;
import com.epmet.dto.indexcollect.result.PartyJoinThreeMeetDTO;
import com.epmet.entity.evaluationindex.indexcoll.FactIndexServiceAblityGridMonthlyEntity;
import com.epmet.service.evaluationindex.extract.dataToIndex.CalGridIndexService;
import com.epmet.service.evaluationindex.extract.todata.*;
@ -15,8 +19,10 @@ import com.epmet.service.evaluationindex.indexcoll.FactIndexGovrnAblityOrgMonthl
import com.epmet.service.evaluationindex.indexcoll.FactIndexPartyAblityOrgMonthlyService;
import com.epmet.service.evaluationindex.indexcoll.FactIndexServiceAblityGridMonthlyService;
import com.epmet.service.evaluationindex.screen.ScreenCustomerGridService;
import com.epmet.service.group.GroupDataService;
import com.epmet.service.heart.ActInfoService;
import com.epmet.service.partymember.PartyMemberService;
import com.epmet.service.stats.DimCustomerPartymemberService;
import com.epmet.service.stats.FactArticlePublishedGridDailyService;
import com.epmet.service.stats.user.FactRegUserGridMonthlyService;
import com.epmet.service.user.UserService;
@ -29,7 +35,10 @@ import org.springframework.util.CollectionUtils;
import java.math.BigDecimal;
import java.text.NumberFormat;
import java.util.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.atomic.AtomicReference;
import java.util.stream.Collectors;
@ -71,6 +80,10 @@ public class CalGridIndexServiceImpl implements CalGridIndexService {
private PartyMemberService partyMemberService;
@Autowired
private ScreenCustomerGridService gridService;
@Autowired
private GroupDataService groupDataService;
@Autowired
private DimCustomerPartymemberService dimCustomerPartymemberService;
/**
* @Description 计算网格指标党建能力
@ -130,6 +143,11 @@ public class CalGridIndexServiceImpl implements CalGridIndexService {
});
}
// 组织“三会一课”次数 前网格下 满足【未取消的活动 and 签到记录>1 and 活动开始时间在当前时间维度内】 +1
Map<String,Integer> createThreeMeetsCountMap=getCreateThreeMeetsCountMap(customerId,monthId);
// 党员参加“三会一课”人次 :本网格内注册的党员,在本月内活动签到次数
List<PartyJoinThreeMeetDTO> joinThreeMeetsCountList=getJoinThreeMeetsCountMap(customerId,monthId);
String quarterId = DateUtils.getQuarterId(monthId);
String yearId = DateUtils.getYearId(monthId);
result.forEach(r -> {
@ -217,6 +235,20 @@ public class CalGridIndexServiceImpl implements CalGridIndexService {
}
});
}
// 组织“三会一课”次数 前网格下 满足【未取消的活动 and 签到记录>1 and 活动开始时间在当前时间维度内】 +1
if (createThreeMeetsCountMap.containsKey(r.getGridId())) {
r.setCreateThreeMeetsCount(createThreeMeetsCountMap.get(r.getGridId()));
}
// 党员参加“三会一课”人次 :本网格内注册的党员,在本月内活动签到次数
if (!CollectionUtils.isEmpty(joinThreeMeetsCountList)) {
Integer joinThreeMeetsCount = NumConstant.ZERO;
for (PartyJoinThreeMeetDTO dto : joinThreeMeetsCountList) {
if (dto.getGridId().equals(r.getGridId())) {
joinThreeMeetsCount += dto.getJoinThreeMeetsCount();
}
}
r.setJoinThreeMeetsCount(joinThreeMeetsCount);
}
});
delPartyAbility(customerId, monthId);
List<List<PartyAbilityGridMonthlyFormDTO>> partition = ListUtils.partition(result, NumConstant.ONE_HUNDRED);
@ -226,6 +258,39 @@ public class CalGridIndexServiceImpl implements CalGridIndexService {
return true;
}
private Map<String, Integer> getCreateThreeMeetsCountMap(String customerId, String monthId) {
// 组织“三会一课”次数 前网格下 满足【未取消的活动 and 签到记录>1 and 活动开始时间在当前时间维度内】 +1
//查询小组活动签到表,计算用户在本月内签到的活动次数
List<GridIndexCommonDTO> list=groupDataService.selectCountGridCreateThreeMeets(customerId,monthId);
Map<String, Integer> resultMap = new HashMap<>();
for (GridIndexCommonDTO gridIndexCommonDTO : list) {
resultMap.put(gridIndexCommonDTO.getGridId(), gridIndexCommonDTO.getIndexValue());
}
return resultMap;
}
private List<PartyJoinThreeMeetDTO> getJoinThreeMeetsCountMap(String customerId, String monthId) {
List<PartyJoinThreeMeetDTO> partyJoinThreeMeetDTOList = new ArrayList<>();
// 党员参加“三会一课”人次 :本网格内注册的党员,在本月内活动签到次数
//1、查询出当前客户下注册的党员
List<PartyMemberInfoResultDTO> list = dimCustomerPartymemberService.selectPartyMemberInfoByCustomerId(customerId);
if (!CollectionUtils.isEmpty(list)) {
partyJoinThreeMeetDTOList = ConvertUtils.sourceToTarget(list, PartyJoinThreeMeetDTO.class);
//2、查询出所有用户本月签到次数
List<CpcIndexCommonDTO> userList = groupDataService.selectJoinThreeMeetsCount(customerId, monthId);
for (PartyJoinThreeMeetDTO partyJoinThreeMeetDTO : partyJoinThreeMeetDTOList) {
partyJoinThreeMeetDTO.setJoinThreeMeetsCount(NumConstant.ZERO);
for (CpcIndexCommonDTO cpcIndexCommonDTO : userList) {
if (partyJoinThreeMeetDTO.getUserId().equals(cpcIndexCommonDTO.getUserId())) {
partyJoinThreeMeetDTO.setJoinThreeMeetsCount(cpcIndexCommonDTO.getIndexValue());
break;
}
}
}
}
return partyJoinThreeMeetDTOList;
}
/**
* @Description 计算网格指标治理能力
* @param customerId

48
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactGroupActDailyService.java

@ -0,0 +1,48 @@
/**
* 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.evaluationindex.extract.todata;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.entity.evaluationindex.extract.FactGroupActDailyEntity;
/**
* 组织活动(参加人数组织次数平均参加人数)按天累计值分析
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-05-13
*/
public interface FactGroupActDailyService extends BaseService<FactGroupActDailyEntity> {
/**
* 当前客户截止到dateId,网格下 各个分类的 参加人数组织次数平均参加人数
*
* @param customerId
* @param dateId
* @return
*/
void extractGridGroupActDaily(String customerId, String dateId);
/**
* 当前客户截止到dateId,组织下 各个分类的 参加人数组织次数平均参加人数
*
* @param customerId
* @param dateId
* @return
*/
void extractAgencyGroupActDaily(String customerId, String dateId);
}

31
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactGroupActMonthlyService.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.evaluationindex.extract.todata;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.entity.evaluationindex.extract.FactGroupActMonthlyEntity;
/**
* 专项组活动(参加人数组织次数平均参加人数)按月增量分析
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-05-13
*/
public interface FactGroupActMonthlyService extends BaseService<FactGroupActMonthlyEntity> {
}

9
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginGroupMainDailyService.java

@ -64,7 +64,8 @@ public interface FactOriginGroupMainDailyService extends BaseService<FactOriginG
* @author wangc
* @date 2020.09.23 16:30
**/
boolean insertExtractedData(boolean isFirst, String customerId, String dateId, List<FactOriginGroupMainDailyDTO> originGroupData, List<ExtractGroupMemberActionRecordResultDTO> memberList, List<String> missing);
boolean insertExtractedData(boolean isFirst, String customerId, String dateId, List<FactOriginGroupMainDailyDTO> originGroupData,
List<ExtractGroupMemberActionRecordResultDTO> memberList, List<String> missing, List<String> partyIds);
/**
* @param customerId
@ -105,4 +106,10 @@ public interface FactOriginGroupMainDailyService extends BaseService<FactOriginG
* @return java.util.List<com.epmet.dto.extract.result.OrgStatisticsResultDTO>
*/
List<OrgStatisticsResultDTO> getOrgGroupCount(String customerId, String monthId, String level);
/**
* @Author sun
* @Description 查询客户小组维度下有效群组列表
**/
List<FactOriginGroupMainDailyEntity> getGroupListByCustomerId(String customerId, String dateId);
}

95
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginGroupMemberDailyService.java

@ -0,0 +1,95 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.service.evaluationindex.extract.todata;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData;
import com.epmet.dto.extract.FactOriginGroupMemberDailyDTO;
import com.epmet.entity.evaluationindex.extract.FactOriginGroupMemberDailyEntity;
import java.util.List;
import java.util.Map;
/**
*
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-05-12
*/
public interface FactOriginGroupMemberDailyService extends BaseService<FactOriginGroupMemberDailyEntity> {
/**
* 默认分页
*
* @param params
* @return PageData<FactOriginGroupMemberDailyDTO>
* @author generator
* @date 2021-05-12
*/
PageData<FactOriginGroupMemberDailyDTO> page(Map<String, Object> params);
/**
* 默认查询
*
* @param params
* @return java.util.List<FactOriginGroupMemberDailyDTO>
* @author generator
* @date 2021-05-12
*/
List<FactOriginGroupMemberDailyDTO> list(Map<String, Object> params);
/**
* 单条查询
*
* @param id
* @return FactOriginGroupMemberDailyDTO
* @author generator
* @date 2021-05-12
*/
FactOriginGroupMemberDailyDTO get(String id);
/**
* 默认保存
*
* @param dto
* @return void
* @author generator
* @date 2021-05-12
*/
void save(FactOriginGroupMemberDailyDTO dto);
/**
* 默认更新
*
* @param dto
* @return void
* @author generator
* @date 2021-05-12
*/
void update(FactOriginGroupMemberDailyDTO dto);
/**
* 批量删除
*
* @param ids
* @return void
* @author generator
* @date 2021-05-12
*/
void delete(String[] ids);
}

165
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactGroupActDailyServiceImpl.java

@ -0,0 +1,165 @@
/**
* 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.evaluationindex.extract.todata.impl;
import com.epmet.commons.dynamic.datasource.annotation.DataSource;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.constant.DataSourceConstant;
import com.epmet.dao.evaluationindex.extract.FactGroupActDailyDao;
import com.epmet.dto.group.ActCategoryDictDTO;
import com.epmet.dto.org.GridInfoDTO;
import com.epmet.entity.evaluationindex.extract.FactGroupActDailyEntity;
import com.epmet.entity.org.CustomerAgencyEntity;
import com.epmet.service.evaluationindex.extract.todata.FactGroupActDailyService;
import com.epmet.service.group.GroupDataService;
import com.epmet.service.org.CustomerAgencyService;
import com.epmet.service.org.CustomerGridService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
/**
* 组织活动(参加人数组织次数平均参加人数)按天累计值分析
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-05-13
*/
@Slf4j
@DataSource(DataSourceConstant.STATS)
@Service
public class FactGroupActDailyServiceImpl extends BaseServiceImpl<FactGroupActDailyDao, FactGroupActDailyEntity> implements FactGroupActDailyService {
@Autowired
private GroupDataService groupDataService;
@Autowired
private CustomerAgencyService customerAgencyService;
@Autowired
private CustomerGridService customerGridService;
/**
* 当前客户截止到dateId,网格下 各个分类的 参加人数组织次数平均参加人数
*
* @param customerId
* @param dateId
* @return
*/
@Override
public void extractGridGroupActDaily(String customerId, String dateId) {
if(StringUtils.isBlank(customerId)||StringUtils.isBlank(dateId)){
return;
}
// 1、查询出当前客户的组织分类;如果没有直接返回
List<ActCategoryDictDTO> actCategoryDictDTOList = groupDataService.queryCustomerActCategoryDict(customerId);
if (CollectionUtils.isEmpty(actCategoryDictDTOList)) {
return;
}
// 2、当前客户下所有的网格
List<GridInfoDTO> gridInfoDTOList=customerGridService.queryGridInfoList(customerId);
// 2、遍历每个分类,查询组织次数、参与人数、平均参与人数
List<FactGroupActDailyEntity> insertList = new ArrayList<>();
for(GridInfoDTO gridInfoDTO:gridInfoDTOList){
for (ActCategoryDictDTO actCategoryDictDTO : actCategoryDictDTOList) {
List<FactGroupActDailyEntity> list = groupDataService.selectCountGridGroupActDaily(customerId, dateId, actCategoryDictDTO.getCategoryCode(),gridInfoDTO.getGridId());
if (CollectionUtils.isNotEmpty(list)) {
list.forEach(dto->{
dto.setCategoryCode(actCategoryDictDTO.getCategoryCode());
dto.setParentCode(actCategoryDictDTO.getParentCode());
dto.setLevel(actCategoryDictDTO.getLevel());
dto.setOrgType("grid");
dto.setDateId(dateId);
});
insertList.addAll(list);
}
}
}
// 3、批量删除
int deleteNum;
do {
deleteNum = baseDao.deleteBatch(customerId, dateId, NumConstant.TWO_HUNDRED,"grid");
} while (deleteNum > NumConstant.ZERO);
// 4、插入数据
insertList.forEach(insertEntity -> {
baseDao.insert(insertEntity);
});
log.info("extractGridGroupActDaily completed");
}
/**
* 当前客户截止到dateId,组织下 各个分类的 参加人数组织次数平均参加人数
*
* @param customerId
* @param dateId
* @return
*/
@Override
public void extractAgencyGroupActDaily(String customerId, String dateId) {
// 1、查询出当前客户的组织分类;如果没有直接返回
List<ActCategoryDictDTO> actCategoryDictDTOList = groupDataService.queryCustomerActCategoryDict(customerId);
if (CollectionUtils.isEmpty(actCategoryDictDTOList)) {
return;
}
// 2、当前客户下所有的组织
List<CustomerAgencyEntity> agencyEntityList=customerAgencyService.queryAgencyListByCustomerId(customerId);
List<FactGroupActDailyEntity> insertList = new ArrayList<>();
for(CustomerAgencyEntity agencyEntity:agencyEntityList){
for(ActCategoryDictDTO categoryDict:actCategoryDictDTOList){
List<FactGroupActDailyEntity> list = groupDataService.selectCountAgencyGroupActDaily(customerId,
agencyEntity.getId(),
dateId,
categoryDict.getCategoryCode());
if (CollectionUtils.isNotEmpty(list)) {
list.forEach(dto->{
dto.setCategoryCode(categoryDict.getCategoryCode());
dto.setParentCode(categoryDict.getParentCode());
dto.setLevel(categoryDict.getLevel());
dto.setOrgId(agencyEntity.getId());
dto.setOrgType("agency");
dto.setPid(agencyEntity.getPid());
dto.setPids(agencyEntity.getPids());
dto.setDateId(dateId);
});
insertList.addAll(list);
}
}
}
// 3、批量删除
int deleteNum;
do {
deleteNum = baseDao.deleteBatch(customerId, dateId, NumConstant.TWO_HUNDRED,"agency");
} while (deleteNum > NumConstant.ZERO);
// 4、插入数据
insertList.forEach(insertEntity->{
baseDao.insert(insertEntity);
});
log.info("extractAgencyGroupActDaily completed");
}
}

41
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactGroupActMonthlyServiceImpl.java

@ -0,0 +1,41 @@
/**
* 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.evaluationindex.extract.todata.impl;
import com.epmet.commons.dynamic.datasource.annotation.DataSource;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.constant.DataSourceConstant;
import com.epmet.dao.evaluationindex.extract.FactGroupActMonthlyDao;
import com.epmet.entity.evaluationindex.extract.FactGroupActMonthlyEntity;
import com.epmet.service.evaluationindex.extract.todata.FactGroupActMonthlyService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
/**
* 专项组活动(参加人数组织次数平均参加人数)按月增量分析
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-05-13
*/
@DataSource(DataSourceConstant.STATS)
@Slf4j
@Service
public class FactGroupActMonthlyServiceImpl extends BaseServiceImpl<FactGroupActMonthlyDao, FactGroupActMonthlyEntity> implements FactGroupActMonthlyService {
}

75
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginExtractServiceImpl.java

@ -5,7 +5,9 @@ import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.DateUtils;
import com.epmet.dto.extract.form.ExtractOriginFormDTO;
import com.epmet.dto.group.form.GroupTotalFormDTO;
import com.epmet.dto.stats.form.CustomerIdAndDateIdFormDTO;
import com.epmet.service.StatsGroupService;
import com.epmet.service.evaluationindex.extract.todata.*;
import com.epmet.service.stats.DimCustomerPartymemberService;
import com.epmet.service.stats.DimCustomerService;
@ -48,6 +50,11 @@ public class FactOriginExtractServiceImpl implements FactOriginExtractService {
private DimCustomerPartymemberService dimCustomerPartymemberService;
@Autowired
private FactOriginProjectCategoryDailyService originProjectCategoryDailyService;
@Autowired
private FactGroupActDailyService factGroupActDailyService;
@Autowired
private StatsGroupService statsGroupService;
@Override
public void extractAll(ExtractOriginFormDTO extractOriginFormDTO) {
@ -188,6 +195,74 @@ public class FactOriginExtractServiceImpl implements FactOriginExtractService {
}
}
});
//小组活动
threadPool.submit(() -> {
ExtractOriginFormDTO extractOriginFormDTO = ConvertUtils.sourceToTarget(param, ExtractOriginFormDTO.class);
if (!isRange) {
//截止到当前dateId
try {
factGroupActDailyService.extractGridGroupActDaily(extractOriginFormDTO.getCustomerId(), extractOriginFormDTO.getDateId());
} catch (Exception e) {
log.error("抽取【fact_group_act_daily】发生异常,参数:" + JSON.toJSONString(extractOriginFormDTO), e);
}
try {
factGroupActDailyService.extractAgencyGroupActDaily(extractOriginFormDTO.getCustomerId(), extractOriginFormDTO.getDateId());
} catch (Exception e) {
log.error("抽取【fact_group_act_daily】发生异常,参数:" + JSON.toJSONString(extractOriginFormDTO), e);
}
} else {
//参数指定日期内,比如startDate=20210501,endDate=20210513;依次计算截止到20210501的数据.....截止到20210513的数据
try {
for (int i = 0; i < finalDaysBetween.size(); i++) {
String dateDimId = finalDaysBetween.get(i);
extractOriginFormDTO.setDateId(dateDimId);
factGroupActDailyService.extractGridGroupActDaily(extractOriginFormDTO.getCustomerId(), extractOriginFormDTO.getDateId());
}
} catch (Exception e) {
log.error("抽取【fact_group_act_daily】发生异常,参数:" + JSON.toJSONString(extractOriginFormDTO), e);
}
try {
for (int i = 0; i < finalDaysBetween.size(); i++) {
String dateDimId = finalDaysBetween.get(i);
extractOriginFormDTO.setDateId(dateDimId);
factGroupActDailyService.extractAgencyGroupActDaily(extractOriginFormDTO.getCustomerId(), extractOriginFormDTO.getDateId());
}
} catch (Exception e) {
log.error("抽取【fact_group_act_daily】发生异常,参数:" + JSON.toJSONString(extractOriginFormDTO), e);
}
}
});
//网格、组织小组总数日统计
threadPool.submit(() -> {
GroupTotalFormDTO formDTO = new GroupTotalFormDTO();
formDTO.setCustomerId(param.getCustomerId());
if (!isRange) {
formDTO.setDateId(param.getDateId());
try {
statsGroupService.gridGroupTotal(formDTO);
} catch (Exception e) {
log.error("小组总数-网格日统计计算错误,参数:" + JSON.toJSONString(formDTO), e);
}
try {
statsGroupService.agencyGroupTotal(formDTO);
} catch (Exception e) {
log.error("小组总数-机关日统计计算错误,参数:" + JSON.toJSONString(formDTO), e);
}
} else {
try {
statsGroupService.gridGroupTotal(formDTO);
} catch (Exception e) {
log.error("小组总数-网格日统计计算错误,参数:" + JSON.toJSONString(formDTO), e);
}
try {
statsGroupService.agencyGroupTotal(formDTO);
} catch (Exception e) {
log.error("小组总数-机关日统计计算错误,参数:" + JSON.toJSONString(formDTO), e);
}
}
});
submitProjectRelationData(param, finalDaysBetween);
}

27
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginGroupMainDailyServiceImpl.java

@ -18,15 +18,21 @@
package com.epmet.service.evaluationindex.extract.todata.impl;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.dao.evaluationindex.extract.FactOriginGroupMainDailyDao;
import com.epmet.dao.evaluationindex.extract.FactOriginGroupMemberDailyDao;
import com.epmet.dto.extract.FactOriginGroupMainDailyDTO;
import com.epmet.dto.extract.form.ScreenPartyLinkMassesDataFormDTO;
import com.epmet.dto.extract.result.GridGroupUserCountResultDTO;
import com.epmet.dto.extract.result.OrgStatisticsResultDTO;
import com.epmet.dto.group.result.ExtractGroupMemberActionRecordResultDTO;
import com.epmet.entity.evaluationindex.extract.FactOriginGroupMainDailyEntity;
import com.epmet.entity.evaluationindex.extract.FactOriginGroupMemberDailyEntity;
import com.epmet.service.evaluationindex.extract.todata.FactOriginGroupMainDailyService;
import com.epmet.service.evaluationindex.extract.todata.FactOriginGroupMemberDailyService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
@ -45,6 +51,8 @@ import java.util.stream.Collectors;
@Service
public class FactOriginGroupMainDailyServiceImpl extends BaseServiceImpl<FactOriginGroupMainDailyDao, FactOriginGroupMainDailyEntity> implements FactOriginGroupMainDailyService {
@Autowired
private FactOriginGroupMemberDailyService factOriginGroupMemberDailyService;
/**
* @return java.util.List<java.lang.String>
@ -84,7 +92,7 @@ public class FactOriginGroupMainDailyServiceImpl extends BaseServiceImpl<FactOri
**/
@Override
@Transactional(rollbackFor = Exception.class)
public boolean insertExtractedData(boolean isFirst, String customerId, String dateId,List<FactOriginGroupMainDailyDTO> originGroupData, List<ExtractGroupMemberActionRecordResultDTO> memberList,List<String> missing) {
public boolean insertExtractedData(boolean isFirst, String customerId, String dateId,List<FactOriginGroupMainDailyDTO> originGroupData, List<ExtractGroupMemberActionRecordResultDTO> memberList,List<String> missing, List<String> partyIds) {
if(!CollectionUtils.isEmpty(originGroupData)) {
if (isFirst) {
//isFirst
@ -96,9 +104,15 @@ public class FactOriginGroupMainDailyServiceImpl extends BaseServiceImpl<FactOri
}
//删除要插入的组主表数据
baseDao.deleteBatchByGroupId(customerId, originGroupData.stream().map(FactOriginGroupMainDailyDTO::getId).distinct().collect(Collectors.toList()));
List<FactOriginGroupMemberDailyEntity> members = ConvertUtils.sourceToTarget(memberList, FactOriginGroupMemberDailyEntity.class);
members.forEach(item -> {
if (partyIds.contains(item.getMemberId())) {
item.setIsParty(NumConstant.ONE);
}
});
baseDao.insertBatchMain(originGroupData);
baseDao.insertBatchMembers(memberList);
factOriginGroupMemberDailyService.insertBatch(members);
}
if(!CollectionUtils.isEmpty(missing)){
baseDao.deleteBatchByGroupId(customerId,missing);
@ -136,4 +150,13 @@ public class FactOriginGroupMainDailyServiceImpl extends BaseServiceImpl<FactOri
return baseDao.selectOrgGroupCount(customerId, monthId, level);
}
/**
* @Author sun
* @Description 查询客户小组维度下有效群组列表
**/
@Override
public List<FactOriginGroupMainDailyEntity> getGroupListByCustomerId(String customerId, String dateId) {
return baseDao.selectCustomerGroupList(customerId, dateId);
}
}

101
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginGroupMemberDailyServiceImpl.java

@ -0,0 +1,101 @@
/**
* 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.evaluationindex.extract.todata.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.dao.evaluationindex.extract.FactOriginGroupMemberDailyDao;
import com.epmet.dto.extract.FactOriginGroupMemberDailyDTO;
import com.epmet.entity.evaluationindex.extract.FactOriginGroupMemberDailyEntity;
import com.epmet.service.evaluationindex.extract.todata.FactOriginGroupMemberDailyService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
/**
*
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-05-12
*/
@Service
public class FactOriginGroupMemberDailyServiceImpl extends BaseServiceImpl<FactOriginGroupMemberDailyDao, FactOriginGroupMemberDailyEntity> implements FactOriginGroupMemberDailyService {
@Override
public PageData<FactOriginGroupMemberDailyDTO> page(Map<String, Object> params) {
IPage<FactOriginGroupMemberDailyEntity> page = baseDao.selectPage(
getPage(params, FieldConstant.CREATED_TIME, false),
getWrapper(params)
);
return getPageData(page, FactOriginGroupMemberDailyDTO.class);
}
@Override
public List<FactOriginGroupMemberDailyDTO> list(Map<String, Object> params) {
List<FactOriginGroupMemberDailyEntity> entityList = baseDao.selectList(getWrapper(params));
return ConvertUtils.sourceToTarget(entityList, FactOriginGroupMemberDailyDTO.class);
}
private QueryWrapper<FactOriginGroupMemberDailyEntity> getWrapper(Map<String, Object> params){
String id = (String)params.get(FieldConstant.ID_HUMP);
QueryWrapper<FactOriginGroupMemberDailyEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id);
return wrapper;
}
@Override
public FactOriginGroupMemberDailyDTO get(String id) {
FactOriginGroupMemberDailyEntity entity = baseDao.selectById(id);
return ConvertUtils.sourceToTarget(entity, FactOriginGroupMemberDailyDTO.class);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void save(FactOriginGroupMemberDailyDTO dto) {
FactOriginGroupMemberDailyEntity entity = ConvertUtils.sourceToTarget(dto, FactOriginGroupMemberDailyEntity.class);
insert(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(FactOriginGroupMemberDailyDTO dto) {
FactOriginGroupMemberDailyEntity entity = ConvertUtils.sourceToTarget(dto, FactOriginGroupMemberDailyEntity.class);
updateById(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void delete(String[] ids) {
// 逻辑删除(@TableLogic 注解)
baseDao.deleteBatchIds(Arrays.asList(ids));
}
}

7
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/GroupExtractServiceImpl.java

@ -89,7 +89,7 @@ public class GroupExtractServiceImpl implements GroupExtractService {
List<ExtractGroupMemberActionRecordResultDTO> memberList = new LinkedList<>();
if (!CollectionUtils.isEmpty(originGroupData)) {
List<GridAttributesResultDTO> gridList = dimGridService.getGridAttributes(param.getCustomerId(),null);
List<String> partyIds = userService.getPartymembersByCustomerId(param.getCustomerId());
if (!CollectionUtils.isEmpty(gridList)) {
Map<String, GridAttributesResultDTO> gridMap =
gridList.stream().collect(Collectors.toMap(GridAttributesResultDTO::getGridId, Function.identity(), (key1, key2) -> key2));
@ -166,14 +166,13 @@ public class GroupExtractServiceImpl implements GroupExtractService {
param.getDateId(),
originGroupData,
memberList,
missingGroups
missingGroups,
partyIds
);
}
List<String> partyIds = userService.getPartymembersByCustomerId(param.getCustomerId());
List<GridHeartedFormDTO> heartedIds = userService.getWarmHeartedByCustomerId(param.getCustomerId());
if(!partyIds.isEmpty()) {
factOriginGroupMainDailyDao.updatePartyFlag(partyIds, param.getCustomerId());

53
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/group/GroupDataService.java

@ -1,8 +1,11 @@
package com.epmet.service.group;
import com.epmet.dto.extract.FactOriginGroupMainDailyDTO;
import com.epmet.dto.group.ActCategoryDictDTO;
import com.epmet.dto.group.result.*;
import com.epmet.entity.group.ResiGroupEntity;
import com.epmet.dto.indexcollect.result.CpcIndexCommonDTO;
import com.epmet.dto.indexcollect.result.GridIndexCommonDTO;
import com.epmet.entity.evaluationindex.extract.FactGroupActDailyEntity;
import com.epmet.util.DimIdGenerator;
import org.apache.ibatis.annotations.Param;
@ -68,8 +71,48 @@ public interface GroupDataService {
List<FactOriginGroupMainDailyDTO> extractGroupData(Boolean isFirst,String customerId,String dateId);
/**
* @Author sun
* @Description 查询客户下有效群组列表
**/
List<ResiGroupEntity> getGroupListByCustomerId(String customerId);
* 查询小组活动签到表计算用户在本月内签到的活动次数
*
* @param customerId
* @param monthId
* @return com.epmet.dto.indexcollect.result.CpcIndexCommonDTO
*/
List<CpcIndexCommonDTO> selectJoinThreeMeetsCount(String customerId, String monthId);
/**
* 网格相关组织三会一课次数 当前网格下 满足未取消的活动 and 签到记录>1 and 活动开始时间在当前时间维度内 +1
*
* @param customerId
* @param monthId
* @return com.epmet.dto.indexcollect.result.CpcIndexCommonDTO
*/
List<GridIndexCommonDTO> selectCountGridCreateThreeMeets(String customerId, String monthId);
/**
* 查询出当前客户的组织分类如果没有直接返回
*
* @param customerId
*/
List<ActCategoryDictDTO> queryCustomerActCategoryDict(String customerId);
/**
* 查询某个分类截止到dateId,组织次数参与人数平均参与人数
* 网格按天
* @param customerId
* @param dateId
* @param categoryCode
* @return com.epmet.entity.evaluationindex.extract.FactGroupActDailyEntity
*/
List<FactGroupActDailyEntity> selectCountGridGroupActDaily(String customerId, String dateId, String categoryCode,String gridId);
/**
* 查询某个分类截止到dateId,组织次数参与人数平均参与人数
* 组织按天
* @param customerId
* @param agencyId
* @param dateId
* @param categoryCode
* @return com.epmet.entity.evaluationindex.extract.FactGroupActDailyEntity
*/
List<FactGroupActDailyEntity> selectCountAgencyGroupActDaily(String customerId, String agencyId, String dateId, String categoryCode);
}

87
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/group/impl/GroupDataServiceImpl.java

@ -1,25 +1,27 @@
package com.epmet.service.group.impl;
import com.epmet.commons.dynamic.datasource.annotation.DataSource;
import com.epmet.commons.tools.constant.Constant;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.constant.DataSourceConstant;
import com.epmet.dao.group.GroupDataDao;
import com.epmet.dto.extract.FactOriginGroupMainDailyDTO;
import com.epmet.dto.group.ActCategoryDictDTO;
import com.epmet.dto.group.form.GridGroupPeopleFormDTO;
import com.epmet.dto.group.form.GridGroupPeopleTotalFormDTO;
import com.epmet.dto.group.form.GridGroupTotalFormDTO;
import com.epmet.dto.group.form.GroupIncrFormDTO;
import com.epmet.dto.group.result.*;
import com.epmet.entity.group.ResiGroupEntity;
import com.epmet.entity.stats.DimGridEntity;
import com.epmet.dto.indexcollect.result.CpcIndexCommonDTO;
import com.epmet.dto.indexcollect.result.GridIndexCommonDTO;
import com.epmet.entity.evaluationindex.extract.FactGroupActDailyEntity;
import com.epmet.service.group.GroupDataService;
import com.epmet.util.DimIdGenerator;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.util.StringUtil;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.util.*;
import java.util.stream.Collectors;
@ -28,6 +30,7 @@ import java.util.stream.Collectors;
* @Author zxc
* @CreateTime 2020/6/16 13:23
*/
@Slf4j
@Service
@DataSource(DataSourceConstant.RESI_GROUP)
public class GroupDataServiceImpl implements GroupDataService {
@ -139,6 +142,7 @@ public class GroupDataServiceImpl implements GroupDataService {
* @param
* @author zxc
*/
@Override
public List<AgencyGroupTotalCountResultDTO> getAgencyGroupTotalCount(String customerId,String dateId){
/*if (allGrid.size() == NumConstant.ZERO){
return new ArrayList<>();
@ -164,6 +168,7 @@ public class GroupDataServiceImpl implements GroupDataService {
* @param
* @author zxc
*/
@Override
public List<AgencyGridGroupPeopleResultDTO> selectAgencyEveryGroupPeopleCount(String customerId,String dateId){
/*if (allGrid.size() == NumConstant.ZERO){
return new ArrayList<>();
@ -177,6 +182,7 @@ public class GroupDataServiceImpl implements GroupDataService {
* @param dateId
* @author zxc
*/
@Override
public List<AgencyGroupIncrResultDTO> selectAgencyGroupIncr(String customerId,String dateId){
/*if (allGrid.size() == NumConstant.ZERO){
return new ArrayList<>();
@ -211,14 +217,75 @@ public class GroupDataServiceImpl implements GroupDataService {
return groupDataDao.groupExtracting(customerId,isFirst?null:dateId);
}
/**
* 查询小组活动签到表计算用户在本月内签到的活动次数 限制活动分类编码100001 三会一课
*
* @param customerId
* @param monthId
* @return com.epmet.dto.indexcollect.result.CpcIndexCommonDTO
*/
@Override
public List<CpcIndexCommonDTO> selectJoinThreeMeetsCount(String customerId, String monthId) {
return groupDataDao.selectUserSignedCount(customerId,monthId);
}
/**
* @Author sun
* @Description 查询客户下有效群组列表
**/
* 网格相关组织三会一课次数 当前网格下 满足未取消的活动 and 签到记录>1 and 活动开始时间在当前时间维度内 +1
*
* @param customerId
* @param monthId
* @return com.epmet.dto.indexcollect.result.CpcIndexCommonDTO
*/
@Override
public List<GridIndexCommonDTO> selectCountGridCreateThreeMeets(String customerId, String monthId) {
return groupDataDao.selectCountGridCreateThreeMeets(customerId,monthId);
}
/**
* 查询出当前客户的组织分类如果没有直接返回
*
* @param customerId
*/
@DataSource(DataSourceConstant.RESI_GROUP)
@Override
public List<ActCategoryDictDTO> queryCustomerActCategoryDict(String customerId) {
List<ActCategoryDictDTO> resultList=groupDataDao.queryCustomerActCategoryDict(customerId);
if(CollectionUtils.isNotEmpty(resultList)){
log.info("当前客户下有自己的项目分类");
return resultList;
}
log.info("----------------------------------------------------");
return groupDataDao.queryCustomerActCategoryDict(Constant.DEFAULT_CUSTOMER);
}
/**
* 查询某个分类截止到dateId,组织次数参与人数平均参与人数
*
* @param customerId
* @param dateId
* @param categoryCode
* @return
*/
@DataSource(DataSourceConstant.RESI_GROUP)
@Override
public List<FactGroupActDailyEntity> selectCountGridGroupActDaily(String customerId, String dateId, String categoryCode,String gridId) {
return groupDataDao.selectCountGridGroupActDaily(customerId,dateId,categoryCode,gridId);
}
/**
* 查询某个分类截止到dateId,组织次数参与人数平均参与人数
* 组织按天
*
* @param customerId
* @param agencyId
* @param dateId
* @param categoryCode
* @return com.epmet.entity.evaluationindex.extract.FactGroupActDailyEntity
*/
@DataSource(DataSourceConstant.RESI_GROUP)
@Override
public List<ResiGroupEntity> getGroupListByCustomerId(String customerId) {
return groupDataDao.selectCustomerGroupList(customerId);
public List<FactGroupActDailyEntity> selectCountAgencyGroupActDaily(String customerId, String agencyId, String dateId, String categoryCode) {
return groupDataDao.selectCountAgencyGroupActDaily(customerId,agencyId,dateId,categoryCode);
}

69
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsGroupServiceImpl.java

@ -1,6 +1,7 @@
package com.epmet.service.impl;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.convert.DateConverter;
import com.epmet.commons.tools.utils.DateUtils;
import com.epmet.constant.GroupConstant;
import com.epmet.dto.AgencySubTreeDto;
@ -9,24 +10,29 @@ import com.epmet.dto.group.form.GroupStatsFormDTO;
import com.epmet.dto.group.form.GroupTotalFormDTO;
import com.epmet.dto.group.result.*;
import com.epmet.dto.stats.DimAgencyDTO;
import com.epmet.entity.evaluationindex.extract.FactOriginGroupMainDailyEntity;
import com.epmet.entity.group.ResiGroupEntity;
import com.epmet.entity.stats.DimAgencyEntity;
import com.epmet.entity.stats.DimGridEntity;
import com.epmet.entity.stats.FactGroupTotalAgencyDailyEntity;
import com.epmet.entity.stats.FactGroupTotalGridDailyEntity;
import com.epmet.service.StatsGroupService;
import com.epmet.service.evaluationindex.extract.todata.FactOriginGroupMainDailyService;
import com.epmet.service.group.GroupDataService;
import com.epmet.service.org.CustomerGridService;
import com.epmet.service.stats.*;
import com.epmet.util.DimIdGenerator;
import com.epmet.util.ModuleConstant;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.configuration.ConfigurationException;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.ZoneId;
import java.time.ZonedDateTime;
@ -63,6 +69,8 @@ public class StatsGroupServiceImpl implements StatsGroupService {
private FactGroupTotalGridDailyService factGroupTotalGridDailyService;
@Autowired
private FactGroupTotalAgencyDailyService factGroupTotalAgencyDailyService;
@Autowired
private FactOriginGroupMainDailyService factOriginGroupMainDailyService;
/**
* @param
@ -352,15 +360,16 @@ public class StatsGroupServiceImpl implements StatsGroupService {
**/
@Override
public void gridGroupTotal(GroupTotalFormDTO formDTO) {
Date date = DateUtils.yesterDay();
//入参有日期的则按具体时间执行,没有的则按当前时间前一天执行
if (null != formDTO && StringUtils.isNotBlank(formDTO.getDate())) {
date = DateUtils.parse(formDTO.getDate(), DateUtils.DATE_PATTERN);
if (StringUtils.isBlank(formDTO.getDateId())) {
Date yesterday = DateUtils.addDateDays(new Date(), -1);
SimpleDateFormat format = new SimpleDateFormat(DateUtils.DATE_PATTERN_YYYYMMDD);
formDTO.setDateId(format.format(yesterday));
}
//入参有客户Id的则按客户Id执行,没有的则全部客户都执行
if (null != formDTO && StringUtils.isNotBlank(formDTO.getCustomerId())) {
log.info("单独统计客户网格-小组总数日统计数据,当前统计的客户Id:" + formDTO.getCustomerId());
gridGroupStats(formDTO.getCustomerId(), date);
gridGroupStats(formDTO.getCustomerId(), formDTO.getDateId());
} else {
int pageNo = 1;
int pageSize = 100;
@ -373,7 +382,7 @@ public class StatsGroupServiceImpl implements StatsGroupService {
try {
log.info("for循环统计网格-小组总数日统计数据,当前统计的客户Id:" + customerId);
//遍历统计每一个客户数据
gridGroupStats(customerId, date);
gridGroupStats(customerId, formDTO.getDateId());
} catch (Exception e) {
log.error("小组总数-网格日统计-程序错误,对应客户Id:" + customerId, e);
log.error("Error creating model JSON", e);
@ -389,8 +398,9 @@ public class StatsGroupServiceImpl implements StatsGroupService {
* @Author sun
* @Description 小组总数-网格日统计数据
**/
private void gridGroupStats(String customerId, Date date) {
private void gridGroupStats(String customerId, String dateId) {
//1:查询各维度表Id,方便使用
Date date = DateUtils.parseDate(dateId,DateUtils.DATE_PATTERN_YYYYMMDD);
DimIdGenerator.DimIdBean dimId = DimIdGenerator.getDimIdBean(date);
//2:根据客户Id查询网格维度表数据
@ -399,18 +409,18 @@ public class StatsGroupServiceImpl implements StatsGroupService {
//3.根据客户Id查询客户下有效的群组列表数据
log.info("StatsGroupServiceImpl.customerGridStats-根据客户Id查询客户下有效的群组列表数据,对应客户Id:" + customerId);
List<ResiGroupEntity> groupList = groupDataService.getGroupListByCustomerId(customerId);
List<FactOriginGroupMainDailyEntity> groupList = factOriginGroupMainDailyService.getGroupListByCustomerId(customerId, dateId);
//4.分别计算每个网格下审核通过的小组数据
List<FactGroupTotalGridDailyEntity> list = new ArrayList<>();
DimIdGenerator.DimIdBean finalDimId = dimId;
dimGridList.forEach(grid -> {
FactGroupTotalGridDailyEntity entity = new FactGroupTotalGridDailyEntity();
AtomicInteger total = new AtomicInteger(0);
AtomicInteger ordinary = new AtomicInteger(0);
AtomicInteger branch = new AtomicInteger(0);
groupList.forEach(group -> {
if (grid.getId().equals(group.getGridId()) && "approved".equals(group.getState())) {
if (grid.getId().equals(group.getGridId()) && "approved".equals(group.getGroupState())) {
total.addAndGet(1);
if ("ordinary".equals(group.getGroupType())) {
ordinary.addAndGet(1);
@ -424,11 +434,11 @@ public class StatsGroupServiceImpl implements StatsGroupService {
entity.setCustomerId(grid.getCustomerId());
entity.setAgencyId(grid.getAgencyId());
entity.setGridId(grid.getId());
entity.setDateId(dimId.getDateId());
entity.setWeekId(dimId.getWeekId());
entity.setMonthId(dimId.getMonthId());
entity.setQuarterId(dimId.getQuarterId());
entity.setYearId(dimId.getYearId());
entity.setDateId(finalDimId.getDateId());
entity.setWeekId(finalDimId.getWeekId());
entity.setMonthId(finalDimId.getMonthId());
entity.setQuarterId(finalDimId.getQuarterId());
entity.setYearId(finalDimId.getYearId());
entity.setGroupTotal(total.get());
entity.setOrdinaryTotal(ordinary.get());
entity.setBranchTotal(branch.get());
@ -457,15 +467,16 @@ public class StatsGroupServiceImpl implements StatsGroupService {
**/
@Override
public void agencyGroupTotal(GroupTotalFormDTO formDTO) {
Date date = DateUtils.yesterDay();
//入参有时间的则按具体时间执行,没有的则按当前时间前一天执行
if (null != formDTO && StringUtils.isNotBlank(formDTO.getDate())) {
date = DateUtils.parse(formDTO.getDate(), DateUtils.DATE_PATTERN);
//入参有日期的则按具体时间执行,没有的则按当前时间前一天执行
if (StringUtils.isBlank(formDTO.getDateId())) {
Date yesterday = DateUtils.addDateDays(new Date(), -1);
SimpleDateFormat format = new SimpleDateFormat(DateUtils.DATE_PATTERN_YYYYMMDD);
formDTO.setDateId(format.format(yesterday));
}
//入参有客户Id的则按客户Id执行,没有的则全部客户都执行
if (null != formDTO && StringUtils.isNotBlank(formDTO.getCustomerId())) {
log.info("单独统计客户组织下-小组总数日统计数据,当前统计的客户Id:" + formDTO.getCustomerId());
agencyGroupStats(formDTO.getCustomerId(), date);
agencyGroupStats(formDTO.getCustomerId(), formDTO.getDateId());
} else {
int pageNo = 1;
int pageSize = 100;
@ -477,7 +488,7 @@ public class StatsGroupServiceImpl implements StatsGroupService {
try {
log.info("for循环统计机关-小组总数日统计数据,当前统计的客户Id:" + customerId);
//遍历统计每一个客户数据
agencyGroupStats(customerId, date);
agencyGroupStats(customerId, formDTO.getDateId());
} catch (Exception e) {
log.error("小组总数-机关日统计程序错误,对应客户Id:" + customerId, e);
log.error("Error creating model JSON", e);
@ -493,8 +504,9 @@ public class StatsGroupServiceImpl implements StatsGroupService {
* @Author sun
* @Description 小组总数-机关日统计数据
**/
private void agencyGroupStats(String customerId, Date date) {
private void agencyGroupStats(String customerId, String dateId) {
//1:查询各维度表Id,方便使用
Date date = DateUtils.parseDate(dateId,DateUtils.DATE_PATTERN_YYYYMMDD);
DimIdGenerator.DimIdBean dimId = DimIdGenerator.getDimIdBean(date);
//2:根据客户Id查询机关维度表数据
@ -508,10 +520,11 @@ public class StatsGroupServiceImpl implements StatsGroupService {
//4.根据客户Id查询客户下有效的群组列表数据
log.info("StatsGroupServiceImpl.agencyGroupStats-根据客户Id查询客户下有效的群组列表数据,对应客户Id:" + customerId);
List<ResiGroupEntity> groupList = groupDataService.getGroupListByCustomerId(customerId);
List<FactOriginGroupMainDailyEntity> groupList = factOriginGroupMainDailyService.getGroupListByCustomerId(customerId, dateId);
List<FactGroupTotalAgencyDailyEntity> list = new ArrayList<>();
//5.遍历组织维度数据分别计算每个组织下群组数据
DimIdGenerator.DimIdBean finalDimId = dimId;
agencyList.forEach(agency->{
FactGroupTotalAgencyDailyEntity entity = new FactGroupTotalAgencyDailyEntity();
//5-1.汇总组织及所有下级组织列表
@ -538,7 +551,7 @@ public class StatsGroupServiceImpl implements StatsGroupService {
//5-3.根据汇总的网格列表统计对应的群组数据
agencyGridList.forEach(gridId -> {
groupList.forEach(group -> {
if (gridId.equals(group.getGridId()) && "approved".equals(group.getState())) {
if (gridId.equals(group.getGridId()) && "approved".equals(group.getGroupState())) {
total.addAndGet(1);
if ("ordinary".equals(group.getGroupType())) {
ordinary.addAndGet(1);
@ -553,11 +566,11 @@ public class StatsGroupServiceImpl implements StatsGroupService {
entity.setCustomerId(agency.getCustomerId());
entity.setAgencyId(agency.getId());
entity.setPid(agency.getPid());
entity.setDateId(dimId.getDateId());
entity.setWeekId(dimId.getWeekId());
entity.setMonthId(dimId.getMonthId());
entity.setQuarterId(dimId.getQuarterId());
entity.setYearId(dimId.getYearId());
entity.setDateId(finalDimId.getDateId());
entity.setWeekId(finalDimId.getWeekId());
entity.setMonthId(finalDimId.getMonthId());
entity.setQuarterId(finalDimId.getQuarterId());
entity.setYearId(finalDimId.getYearId());
entity.setGroupTotal(total.get());
entity.setOrdinaryTotal(ordinary.get());
entity.setBranchTotal(branch.get());

3
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/CustomerAgencyService.java

@ -20,4 +20,7 @@ public interface CustomerAgencyService {
List<CustomerAreaCodeResultDTO> selectCustomerAreaCodeById(List<String> customerIds);
CustomerAgencyEntity getRootAgencyInfo(String customerId);
List<CustomerAgencyEntity> queryAgencyListByCustomerId(String customerId);
}

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

Loading…
Cancel
Save