Browse Source

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

dev
wangchao 5 years ago
parent
commit
2442d502ac
  1. 4
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/StrConstant.java
  2. 8
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java
  3. 11
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/screen/dto/result/BranchBuildTrendResultDTO.java
  4. 10
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/screen/dto/result/VolunteerServiceResultDTO.java
  5. 12
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/screen/ScreenPartyBranchDataDao.java
  6. 7
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/screen/impl/GrassrootsPartyDevServiceImpl.java
  7. 7
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/screen/impl/PartyMemberLeadServiceImpl.java
  8. 10
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/utils/ModuleConstant.java
  9. 16
      epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenPartyBranchDataDao.xml
  10. 18
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/constant/IndexCalConstant.java
  11. 17
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcal/PageQueryGridFormDTO.java
  12. 109
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/FactIndexCommunityGovrnFiveScoreDTO.java
  13. 110
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/FactIndexCommunityPartyFiveScoreDTO.java
  14. 107
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/FactIndexCommunityScoreDTO.java
  15. 107
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/FactIndexCommunityServiceFiveScoreDTO.java
  16. 112
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/FactIndexGridScoreDTO.java
  17. 45
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/result/CommunityGovernAbilityCalculateResultDTO.java
  18. 68
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/result/CommunityGovernAbilityResultDTO.java
  19. 45
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/result/CommunityPublishArticleCountCalculateResultDTO.java
  20. 54
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/result/CommunityPublishArticleCountResultDTO.java
  21. 25
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/result/MaxAndMinDoubleResultDTO.java
  22. 25
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/result/MaxAndMinIntegerResultDTO.java
  23. 47
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/result/SubGridPartyAvgResultDTO.java
  24. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/DataStatsApplication.java
  25. 23
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java
  26. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/IndexCalculateController.java
  27. 6
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/indexcoll/FactIndexGovrnAblityGridMonthlyDao.java
  28. 10
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/indexcoll/FactIndexGovrnAblityOrgMonthlyDao.java
  29. 9
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/indexcoll/FactIndexPartyAblityGridMonthlyDao.java
  30. 10
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/indexcoll/FactIndexPartyAblityOrgMonthlyDao.java
  31. 6
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/indexcoll/FactIndexServiceAblityGridMonthlyDao.java
  32. 33
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/indexscore/CpcScoreDao.java
  33. 33
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/indexscore/GridScoreDao.java
  34. 33
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/screen/FactIndexCommunityGovrnFiveScoreDao.java
  35. 45
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/screen/FactIndexCommunityPartyFiveScoreDao.java
  36. 33
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/screen/FactIndexCommunityScoreDao.java
  37. 33
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/screen/FactIndexCommunityServiceFiveScoreDao.java
  38. 46
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/screen/FactIndexGridScoreDao.java
  39. 4
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/screen/IndexCodeFieldReDao.java
  40. 87
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/indexscore/CpcScoreEntity.java
  41. 92
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/indexscore/GridScoreEntity.java
  42. 77
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/FactIndexCommunityGovrnFiveScoreEntity.java
  43. 77
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/FactIndexCommunityPartyFiveScoreEntity.java
  44. 77
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/FactIndexCommunityScoreEntity.java
  45. 77
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/FactIndexCommunityServiceFiveScoreEntity.java
  46. 82
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/FactIndexGridScoreEntity.java
  47. 6
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/eum/IndexCodeEnum.java
  48. 54
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/redis/IndexCodeFieldReRedis.java
  49. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/indexcal/CpcIndexCalculateService.java
  50. 5
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/indexcal/GridCorreLationService.java
  51. 24
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/indexcal/IndexCodeFieldReService.java
  52. 29
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/indexcal/impl/CpcIndexCalculateServiceImpl.java
  53. 286
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/indexcal/impl/GridCorreLationServiceImpl.java
  54. 46
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/indexcal/impl/IndexCodeFieldReServiceImpl.java
  55. 32
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/screen/IndexCalculateCommunityService.java
  56. 209
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/screen/impl/IndexCalculateCommunityServiceImpl.java
  57. 29
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/support/normalizing/Correlation.java
  58. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/support/normalizing/ScoreCalculator.java
  59. 36
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/support/normalizing/batch/BatchScoreCalculator.java
  60. 4
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/indexcoll/FactIndexGovrnAblityGridMonthlyDao.xml
  61. 23
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/indexcoll/FactIndexGovrnAblityOrgMonthlyDao.xml
  62. 4
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/indexcoll/FactIndexPartyAblityCpcMonthlyDao.xml
  63. 15
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/indexcoll/FactIndexPartyAblityGridMonthlyDao.xml
  64. 18
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/indexcoll/FactIndexPartyAblityOrgMonthlyDao.xml
  65. 4
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/indexcoll/FactIndexServiceAblityGridMonthlyDao.xml
  66. 26
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/indexscore/CpcScoreDao.xml
  67. 27
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/indexscore/GridScoreDao.xml
  68. 6
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/screen/FactIndexCommunityGovrnFiveScoreDao.xml
  69. 27
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/screen/FactIndexCommunityPartyFiveScoreDao.xml
  70. 6
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/screen/FactIndexCommunityScoreDao.xml
  71. 6
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/screen/FactIndexCommunityServiceFiveScoreDao.xml
  72. 20
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/screen/FactIndexGridScoreDao.xml
  73. 5
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/screen/IndexCodeFieIdReDao.xml
  74. 32
      epmet-module/data-statistical/data-statistical-server/src/test/java/com/epmet/stats/test/normalizing/DemoScoreCal.java

4
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/StrConstant.java

@ -77,4 +77,8 @@ public interface StrConstant {
String NULL_STR="null";
String NOT_FILLED = "无";
String MIN="MIN";
String MAX="MAX";
}

8
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java

@ -297,4 +297,12 @@ public class RedisKeys {
public static String getExternalAppSecretKey(String appId) {
return String.format(rootPrefix+"externalapp:secret:%s",appId);
}
/**
* 计算指标时获取指标code和fields关系缓存Key
* @return
*/
public static String getIndexCodeFieldReKey() {
return rootPrefix.concat("data:index:indexcode:field");
}
}

11
epmet-module/data-report/data-report-client/src/main/java/com/epmet/screen/dto/result/BranchBuildTrendResultDTO.java

@ -1,5 +1,6 @@
package com.epmet.screen.dto.result;
import com.epmet.commons.tools.constant.NumConstant;
import lombok.Data;
import java.io.Serializable;
@ -28,4 +29,14 @@ public class BranchBuildTrendResultDTO implements Serializable {
private List<BranchTrendSeriesDataResultDTO> seriesData;
/**
* 总组织次数
* */
private Integer totalOrganizationCount = NumConstant.ZERO;
/**
* 总参与人数
* */
private Integer totalJoinUserCount = NumConstant.ZERO;
}

10
epmet-module/data-report/data-report-client/src/main/java/com/epmet/screen/dto/result/VolunteerServiceResultDTO.java

@ -33,4 +33,14 @@ public class VolunteerServiceResultDTO implements Serializable {
* 平均参与人次
*/
private List<Integer> averageJoinUserData;
/**
* 总组织次数
* */
private Integer totalOrganizationCount;
/**
* 总参与人数
* */
private Integer totalJoinUserCount;
}

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

@ -68,4 +68,16 @@ public interface ScreenPartyBranchDataDao {
* @date 2020.08.20 09:46
**/
List<BranchBuildOrderByCountResultDTO> selectBranchDataByTypeOrder(@Param("agencyId")String agencyId,@Param("category")String category,@Param("monthId")String monthId,@Param("bottomMonthId")String bottomMonthId);
/**
* @Description 查询组织总数或者总参与人数
* @param category
* @param type
* @param agencyId
* @param monthId
* @return
* @author wangc
* @date 2020.08.28 17:56
**/
Integer selectTotalOrganizationCount(@Param("category") String category,@Param("type") String type, @Param("agencyId") String agencyId,@Param("monthId") String monthId);
}

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

@ -155,7 +155,12 @@ public class GrassrootsPartyDevServiceImpl implements GrassrootsPartyDevService
result.setSeriesData(dataArray);
result.setLegend(null == result.getLegend() ? new ArrayList<>() : result.getLegend());
//总组织次数
Integer totalOrganizationCount = screenPartyBranchDataDao.selectTotalOrganizationCount(param.getCategory(),ModuleConstant.PARAM_BRANCH_DATA_TYPE_ORGAN,param.getAgencyId(),monthMap.keySet().iterator().next());
//总参与人数
Integer totalJoinUserCount = screenPartyBranchDataDao.selectTotalOrganizationCount(param.getCategory(),ModuleConstant.PARAM_BRANCH_DATA_TYPE_JOIN,param.getAgencyId(),monthMap.keySet().iterator().next());
result.setTotalOrganizationCount(null == totalOrganizationCount ? NumConstant.ZERO : totalOrganizationCount);
result.setTotalJoinUserCount(null == totalJoinUserCount ? NumConstant.ZERO : totalJoinUserCount);
return result;
}

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

@ -147,6 +147,13 @@ public class PartyMemberLeadServiceImpl implements PartyMemberLeadService {
result.setOrganizeData(organizeData);
result.setJoinData(joinData);
result.setAverageJoinUserData(averageJoinUserData);
String bottomMonthId = collect.get(NumConstant.ZERO).getMonthId();
//总组织次数
Integer totalOrganizationCount = screenPartyBranchDataDao.selectTotalOrganizationCount(ModuleConstant.KEY_BRANCH_CATEGORY_VOLUNTARY_SERVICE,ModuleConstant.PARAM_BRANCH_DATA_TYPE_ORGAN,volunteerServiceFormDTO.getAgencyId(),bottomMonthId);
//总参与人数
Integer totalJoinUserCount = screenPartyBranchDataDao.selectTotalOrganizationCount(ModuleConstant.KEY_BRANCH_CATEGORY_VOLUNTARY_SERVICE,ModuleConstant.PARAM_BRANCH_DATA_TYPE_JOIN,volunteerServiceFormDTO.getAgencyId(),bottomMonthId);
result.setTotalOrganizationCount(totalOrganizationCount);
result.setTotalJoinUserCount(totalJoinUserCount);
return result;
}

10
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/utils/ModuleConstant.java

@ -21,4 +21,14 @@ public interface ModuleConstant {
String PARAM_DIFFICULTY_TYPE_MOST_DEPTS = "mostdepts";
String PARAM_DIFFICULTY_TYPE_MOST_HANDLED = "mosthandled";
/**
* 支部建设情况折线图 查询数据类型 组织次数
* */
String PARAM_BRANCH_DATA_TYPE_ORGAN = "organize";
/**
* 支部建设情况折线图 查询数据类型 参与人数
* */
String PARAM_BRANCH_DATA_TYPE_JOIN = "joinuser";
}

16
epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenPartyBranchDataDao.xml

@ -29,7 +29,6 @@
screen_party_branch_data
WHERE
DEL_FLAG = '0'
AND ORG_TYPE = 'agency'
AND ORG_ID = #{agencyId}
AND TYPE = #{category}
AND MONTH_ID <![CDATA[ >= ]]> #{bottomMonthId}
@ -85,4 +84,19 @@
LIMIT 12
</select>
<!-- 查询组织总数或者总参与人数 -->
<select id="selectTotalOrganizationCount" resultType="int">
SELECT
CASE #{type} WHEN 'organize' THEN SUM(ORGANIZE_COUNT)
ELSE SUM(JOIN_USER_COUNT)
END AS data
FROM
screen_party_branch_data
WHERE
DEL_FLAG = '0'
AND ORG_ID = #{agencyId}
AND TYPE = #{category}
AND MONTH_ID <![CDATA[ >= ]]> #{monthId}
</select>
</mapper>

18
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/constant/IndexCalConstant.java

@ -0,0 +1,18 @@
package com.epmet.constant;
/**
* 描述一下
*
* @author yinzuomei@elink-cn.com
* @date 2020/8/27 15:20
*/
public interface IndexCalConstant {
Integer PAGE_SIZE = 10;
String GRID_ID="GRID_ID";
String CUSTOMER_ID="CUSTOMER_ID";
String MONTH_ID="MONTH_ID";
}

17
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcal/PageQueryGridFormDTO.java

@ -18,6 +18,11 @@ public class PageQueryGridFormDTO implements Serializable {
*/
private String customerId;
/**
* yyyyMM
*/
private String monthId;
/**
* 页码
* */
@ -27,7 +32,17 @@ public class PageQueryGridFormDTO implements Serializable {
/**
* 每页多少条
* */
private Integer pageSize = 10;
private Integer pageSize;
private Integer pageIndex;
public PageQueryGridFormDTO(String customerId,String monthId,int pageIndex,int pageNo,int pageSize){
this.customerId=customerId;
this.monthId=monthId;
this.pageIndex=pageIndex;
this.pageNo=pageNo;
this.pageSize=pageSize;
}
}

109
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/FactIndexCommunityGovrnFiveScoreDTO.java

@ -0,0 +1,109 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.dto.screen;
import java.io.Serializable;
import java.math.BigDecimal;
import lombok.Data;
/**
* 社区相关-治理能力五级权重分数表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-08-27
*/
@Data
public class FactIndexCommunityGovrnFiveScoreDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
*
*/
private String id;
/**
* 机关iD
*/
private String agencyId;
/**
* 月份ID
*/
private String monthId;
/**
* 指标ID
*/
private String indexId;
/**
* 总指数分值
*/
private BigDecimal totalScore;
/**
* 党建能力分值
*/
private BigDecimal partyAbilityScore;
/**
* 治理能力分值
*/
private BigDecimal govrnAbilityScore;
/**
* 服务能力分值
*/
private BigDecimal serviceAbilityScore;
/**
* 删除状态0正常1删除
*/
private Integer delFlag;
/**
* 乐观锁
*/
private Integer revision;
/**
* 创建人
*/
private String createdBy;
/**
* 更新人
*/
private String updatedBy ;
public FactIndexCommunityGovrnFiveScoreDTO() {
this.agencyId = "";
this.monthId = "";
this.indexId = "";
this.totalScore = new BigDecimal(0);
this.partyAbilityScore = new BigDecimal(0);
this.govrnAbilityScore = new BigDecimal(0);
this.serviceAbilityScore = new BigDecimal(0);
this.delFlag = 0;
this.revision = 0;
this.createdBy = "APP_USER";
this.updatedBy = "APP_USER";
}
}

110
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/FactIndexCommunityPartyFiveScoreDTO.java

@ -0,0 +1,110 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.dto.screen;
import java.io.Serializable;
import java.math.BigDecimal;
import lombok.Data;
/**
* 社区相关-党建能力五级权重分数表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-08-27
*/
@Data
public class FactIndexCommunityPartyFiveScoreDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* id
*/
private String id;
/**
* 机关ID
*/
private String agencyId;
/**
* 月度ID
*/
private String monthId;
/**
* 指标ID
*/
private String indexId;
/**
* 总指数分值
*/
private BigDecimal totalScore;
/**
* 党建能力分值
*/
private BigDecimal partyAbilityScore;
/**
* 治理能力分值
*/
private BigDecimal govrnAbilityScore;
/**
* 服务能力分值
*/
private BigDecimal serviceAbilityScore;
/**
* 删除状态0正常1删除
*/
private Integer delFlag;
/**
* 乐观锁
*/
private Integer revision;
/**
* 创建人
*/
private String createdBy;
/**
* 更新人
*/
private String updatedBy;
public FactIndexCommunityPartyFiveScoreDTO() {
this.agencyId = "";
this.monthId = "";
this.indexId = "";
this.totalScore = new BigDecimal(0);
this.partyAbilityScore = new BigDecimal(0);
this.govrnAbilityScore = new BigDecimal(0);
this.serviceAbilityScore = new BigDecimal(0);
this.delFlag = 0;
this.revision = 0;
this.createdBy = "APP_USER";
this.updatedBy = "APP_USER";
}
}

107
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/FactIndexCommunityScoreDTO.java

@ -0,0 +1,107 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.dto.screen;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
import java.math.BigDecimal;
/**
* 社区相关分数表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-08-27
*/
@Data
public class FactIndexCommunityScoreDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
*
*/
private String id;
/**
* 机关ID
*/
private String agencyId;
/**
* 月份ID
*/
private String monthId;
/**
* 季度ID
*/
private String quarterId;
/**
* 年度ID
*/
private String yearId;
/**
* 指标ID
*/
private String indexId;
/**
* 分数
*/
private BigDecimal score;
/**
* 党建能力party治理能力govrn服务能力service
*/
private String type;
/**
* 删除状态0正常1删除
*/
private Integer delFlag;
/**
* 乐观锁
*/
private Integer revision;
/**
* 创建人
*/
private String createdBy;
/**
* 创建时间
*/
private Date createdTime;
/**
* 更新人
*/
private String updatedBy;
/**
* 更新时间
*/
private Date updatedTime;
}

107
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/FactIndexCommunityServiceFiveScoreDTO.java

@ -0,0 +1,107 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.dto.screen;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
import java.math.BigDecimal;
/**
* 社区相关-服务能力五级权重分数表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-08-27
*/
@Data
public class FactIndexCommunityServiceFiveScoreDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
*
*/
private String id;
/**
* 机关ID
*/
private String agencyId;
/**
* 月度ID
*/
private String monthId;
/**
* 指标ID
*/
private String indexId;
/**
* 总指数分值
*/
private BigDecimal totalScore;
/**
* 党建能力分值
*/
private BigDecimal partyAbilityScore;
/**
* 治理能力分值
*/
private BigDecimal govrnAbilityScore;
/**
* 服务能力分值
*/
private BigDecimal serviceAbilityScore;
/**
* 删除状态0正常1删除
*/
private Integer delFlag;
/**
* 乐观锁
*/
private Integer revision;
/**
* 创建人
*/
private String createdBy;
/**
* 创建时间
*/
private Date createdTime;
/**
* 更新人
*/
private String updatedBy;
/**
* 更新时间
*/
private Date updatedTime;
}

112
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/FactIndexGridScoreDTO.java

@ -0,0 +1,112 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.dto.screen;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
import java.math.BigDecimal;
/**
* 网格相关分值
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-08-28
*/
@Data
public class FactIndexGridScoreDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* ID 主键
*/
private String id;
/**
* 客户Id
*/
private String customerId;
/**
* 网格所属的机关Id
*/
private String agencyId;
/**
* 网格Id
*/
private String gridId;
/**
* 月维度Id: yyyyMM
*/
private String monthId;
/**
* 总指数分值
*/
private BigDecimal totalScore;
/**
* 党建能力分值
*/
private BigDecimal partyAblityScore;
/**
* 治理能力分值
*/
private BigDecimal govrnAblityScore;
/**
* 服务能力分值
*/
private BigDecimal serviceAblityScore;
/**
* 删除标识 0未删除1已删除
*/
private String delFlag;
/**
* 乐观锁
*/
private Integer revision;
/**
* 创建人
*/
private String createdBy;
/**
* 创建时间
*/
private Date createdTime;
/**
* 更新人
*/
private String updatedBy;
/**
* 更新时间
*/
private Date updatedTime;
}

45
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/result/CommunityGovernAbilityCalculateResultDTO.java

@ -0,0 +1,45 @@
package com.epmet.dto.screen.result;
import lombok.Data;
import java.io.Serializable;
/**
* @Author zxc
* @DateTime 2020/8/26 1:21 下午
*/
@Data
public class CommunityGovernAbilityCalculateResultDTO implements Serializable {
private static final long serialVersionUID = 3766218681545581100L;
/**
* 机关ID
*/
private String agencyId;
/**
* 上级组织ID
*/
private String parentId;
/**
* 月度ID
*/
private String monthId;
/**
* 季度ID
*/
private String quarterId;
/**
* 年度ID
*/
private String yearId;
/**
* 分数
*/
private Double score;
}

68
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/result/CommunityGovernAbilityResultDTO.java

@ -0,0 +1,68 @@
package com.epmet.dto.screen.result;
import lombok.Data;
import java.io.Serializable;
/**
* @Author zxc
* @DateTime 2020/8/26 11:20 上午
*/
@Data
public class CommunityGovernAbilityResultDTO implements Serializable {
/**
* 机关ID
*/
private String agencyId;
/**
* 上级组织ID
*/
private String parentId;
/**
* 月度ID
*/
private String monthId;
/**
* 季度ID
*/
private String quarterId;
/**
* 年度ID
*/
private String yearId;
/**
* 社区被吹哨次数
*/
private Integer transferedCount;
/**
* 社区办结项目数
*/
private Integer closedProjectCount;
/**
* 社区项目响应度
*/
private Double respProjectRatio;
/**
* 社区项目超期率
*/
private Double overDueProjectRatio;
/**
* 社区办结项目率
*/
private Double closedProjectRatio;
/**
* 社区办结项目满意度
*/
private Double satisfactionRatio;
}

45
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/result/CommunityPublishArticleCountCalculateResultDTO.java

@ -0,0 +1,45 @@
package com.epmet.dto.screen.result;
import lombok.Data;
import java.io.Serializable;
/**
* @Author zxc
* @DateTime 2020/8/26 10:43 上午
*/
@Data
public class CommunityPublishArticleCountCalculateResultDTO implements Serializable {
private static final long serialVersionUID = 3527690541253204132L;
/**
* 机关ID
*/
private String agencyId;
/**
* 上级组织ID
*/
private String parentId;
/**
* 月度ID
*/
private String monthId;
/**
* 季度ID
*/
private String quarterId;
/**
* 年度ID
*/
private String yearId;
/**
* 分数
*/
private Double score;
}

54
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/result/CommunityPublishArticleCountResultDTO.java

@ -0,0 +1,54 @@
package com.epmet.dto.screen.result;
import lombok.Data;
import java.io.Serializable;
/**
* @Author zxc
* @DateTime 2020/8/26 10:37 上午
*/
@Data
public class CommunityPublishArticleCountResultDTO implements Serializable {
private static final long serialVersionUID = -8260746179353253237L;
/**
* 机关ID
*/
private String agencyId;
/**
* 上级组织ID
*/
private String parentId;
/**
* 月度ID
*/
private String monthId;
/**
* 季度ID
*/
private String quarterId;
/**
* 年度ID
*/
private String yearId;
/**
* 发文数
*/
public Integer publishArticleCount;
public CommunityPublishArticleCountResultDTO() {
this.agencyId = "";
this.parentId = "";
this.monthId = "";
this.quarterId = "";
this.yearId = "";
this.publishArticleCount = 0;
}
}

25
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/result/MaxAndMinDoubleResultDTO.java

@ -0,0 +1,25 @@
package com.epmet.dto.screen.result;
import lombok.Data;
import java.io.Serializable;
/**
* @Author zxc
* @DateTime 2020/8/28 9:51 上午
*/
@Data
public class MaxAndMinDoubleResultDTO implements Serializable {
private static final long serialVersionUID = -3927045097012156582L;
/**
* 最小值
*/
private Double min;
/**
* 最大值
*/
private Double max;
}

25
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/result/MaxAndMinIntegerResultDTO.java

@ -0,0 +1,25 @@
package com.epmet.dto.screen.result;
import lombok.Data;
import java.io.Serializable;
/**
* @Author zxc
* @DateTime 2020/8/28 9:49 上午
*/
@Data
public class MaxAndMinIntegerResultDTO implements Serializable {
private static final long serialVersionUID = 5845694081181431599L;
/**
* 最小值
*/
private Integer min;
/**
* 最大值
*/
private Integer max;
}

47
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/result/SubGridPartyAvgResultDTO.java

@ -0,0 +1,47 @@
package com.epmet.dto.screen.result;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
/**
* @Author zxc
* @DateTime 2020/8/28 3:15 下午
*/
@Data
public class SubGridPartyAvgResultDTO implements Serializable {
private static final long serialVersionUID = 1592381327492545907L;
/**
* 机关ID
*/
private String agencyId;
/**
* 上级组织ID
*/
private String parentId;
/**
* 月度ID
*/
private String monthId;
/**
* 季度ID
*/
private String quarterId;
/**
* 年度ID
*/
private String yearId;
/**
* 分数
*/
private BigDecimal score;
}

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

@ -17,6 +17,6 @@ public class DataStatsApplication {
public static void main(String[] args) {
SpringApplication.run(DataStatsApplication.class ,args);
HttpClientManager.getInstance().sendAlarmMsg(EnvEnum.getCurrentEnv().getName() +" DataStatsApplication started!");
// HttpClientManager.getInstance().sendAlarmMsg(EnvEnum.getCurrentEnv().getName() +" DataStatsApplication started!");
}
}

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

@ -1,10 +1,14 @@
package com.epmet.controller;
import com.baomidou.mybatisplus.extension.api.R;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.AgencySubTreeDto;
import com.epmet.dto.indexcal.CalculateCommonFormDTO;
import com.epmet.entity.stats.DimAgencyEntity;
import com.epmet.service.StatsDemoService;
import com.epmet.service.indexcal.GridCorreLationService;
import com.epmet.service.screen.IndexCalculateCommunityService;
import com.epmet.service.stats.DimAgencyService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
@ -32,6 +36,10 @@ public class DemoController {
@Autowired
private DimAgencyService dimAgencyService;
@Autowired
private IndexCalculateCommunityService indexCalculateCommunityService;
@Autowired
private GridCorreLationService gridCorreLationService;
@GetMapping("testAlarm")
public void testAlarm() {
@ -108,4 +116,19 @@ public class DemoController {
List<DimAgencyEntity> list = dimAgencyService.getAgencyListByCustomerId("ba7c0b5b21e882b263ee8456e2cfb63e");
return new Result().ok(list);
}
@PostMapping("zxc")
public Result getZxc(){
// indexCalculateCommunityService.communityPublishArticleCountCalculate("b09527201c4409e19d1dbc5e3c3429a1","202008");
indexCalculateCommunityService.communityPublishArticleCountCalculate("","202008");
return new Result();
}
@PostMapping("testcalculategridcorrelation")
public Result testcalculateGridCorreLation(){
CalculateCommonFormDTO formDTO=new CalculateCommonFormDTO("b09527201c4409e19d1dbc5e3c3429a1","202008");
gridCorreLationService.calculateGridCorreLation(formDTO);
return new Result();
}
}

2
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/IndexCalculateController.java

@ -4,7 +4,7 @@ import com.epmet.commons.extappauth.bean.ExternalAppRequestParam;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.indexcal.CalculateCommonFormDTO;
import com.epmet.dto.screen.form.IndexCalculateForm;
import com.epmet.service.screen.CpcIndexCalculateService;
import com.epmet.service.indexcal.CpcIndexCalculateService;
import com.epmet.service.screen.IndexCalculateService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;

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

@ -18,6 +18,7 @@
package com.epmet.dao.indexcoll;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.indexcal.PageQueryGridFormDTO;
import com.epmet.dto.indexcollect.form.GridGovrnAbilityFormDTO;
import com.epmet.entity.indexcoll.FactIndexGovrnAblityGridMonthlyEntity;
import org.apache.ibatis.annotations.Mapper;
@ -67,14 +68,13 @@ public interface FactIndexGovrnAblityGridMonthlyDao extends BaseDao<FactIndexGov
void batchInsertFactIndexGovrnAblityGridMonthly(@Param("list") List<GridGovrnAbilityFormDTO> list, @Param("customerId")String customerId);
/**
* @param customerId 客户id
* @param monthId yyyyMM
* @param formDTO
* @return java.util.List<com.epmet.dto.indexcollect.FactIndexGovrnAblityGridMonthlyDTO>
* @author yinzuomei
* @description 当前客户下所有网格的治理能力相关五级指标
* @Date 2020/8/26 15:58
**/
List<Map<String,Object>> selectListGovrnAblityGrid(@Param("customerId") String customerId, @Param("monthId") String monthId);
List<Map<String,Object>> selectListGovrnAblityGrid(PageQueryGridFormDTO formDTO);
/**
* @return java.util.Map<java.lang.String,java.lang.Object>

10
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/indexcoll/FactIndexGovrnAblityOrgMonthlyDao.java

@ -19,6 +19,7 @@ package com.epmet.dao.indexcoll;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.indexcollect.form.OrgGovrnAbilityFormDTO;
import com.epmet.dto.screen.result.CommunityGovernAbilityResultDTO;
import com.epmet.entity.indexcoll.FactIndexGovrnAblityOrgMonthlyEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@ -61,4 +62,13 @@ public interface FactIndexGovrnAblityOrgMonthlyDao extends BaseDao<FactIndexGovr
* @Date 10:52 2020-08-20
**/
void batchInsertFactIndexGovrnAblityOrgMonthly(@Param("list") List<OrgGovrnAbilityFormDTO> list, @Param("customerId")String customerId);
/**
* @Description 社区治理能力各个参数查询被吹哨次数办结项目数项目响应度超期项目率办结项目率办结项目满意度
* @param customerId
* @param monthId
* @author zxc
* @date 2020/8/26 1:40 下午
*/
List<CommunityGovernAbilityResultDTO> selectCommunityGovernAbility(@Param("customerId")String customerId, @Param("monthId")String monthId);
}

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

@ -18,6 +18,8 @@
package com.epmet.dao.indexcoll;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.indexcal.CalculateCommonFormDTO;
import com.epmet.dto.indexcal.PageQueryGridFormDTO;
import com.epmet.dto.indexcollect.FactIndexPartyAblityGridMonthlyDTO;
import com.epmet.dto.indexcollect.form.GridPartyAbilityFormDTO;
import com.epmet.entity.indexcoll.FactIndexPartyAblityGridMonthlyEntity;
@ -68,14 +70,13 @@ public interface FactIndexPartyAblityGridMonthlyDao extends BaseDao<FactIndexPar
void batchInsertFactIndexPartyAblityGridMonthly(@Param("list") List<GridPartyAbilityFormDTO> list, @Param("customerId")String customerId);
/**
* @param customerId 客户id
* @param monthId yyyyMM
* @param formDTO
* @return java.util.List<com.epmet.dto.indexcollect.FactIndexPartyAblityGridMonthlyDTO>
* @author yinzuomei
* @description 当前客户下所有网格的党建能力相关五级指标
* @Date 2020/8/26 15:57
**/
List<Map<String,Object>> selectListPartyAblityGrid(@Param("customerId") String customerId, @Param("monthId") String monthId);
List<Map<String,Object>> selectListPartyAblityGrid(PageQueryGridFormDTO formDTO);
/**
* @return java.util.Map<java.lang.String,java.lang.Object>
@ -86,4 +87,6 @@ public interface FactIndexPartyAblityGridMonthlyDao extends BaseDao<FactIndexPar
* @Date 2020/8/27 12:51
**/
Map<String, Object> selectPartyAblityGridMinAndMax(@Param("customerId") String customerId, @Param("monthId") String monthId);
Integer selectCount(CalculateCommonFormDTO formDTO);
}

10
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/indexcoll/FactIndexPartyAblityOrgMonthlyDao.java

@ -19,6 +19,7 @@ package com.epmet.dao.indexcoll;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.indexcollect.form.OrgPartyAbilityFormDTO;
import com.epmet.dto.screen.result.CommunityPublishArticleCountResultDTO;
import com.epmet.entity.indexcoll.FactIndexPartyAblityOrgMonthlyEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@ -62,4 +63,13 @@ public interface FactIndexPartyAblityOrgMonthlyDao extends BaseDao<FactIndexPart
* @Date 10:52 2020-08-20
**/
void batchInsertFactIndexPartyAblityOrgMonthly(@Param("list") List<OrgPartyAbilityFormDTO> list, @Param("customerId")String customerId);
/**
* @Description 查询社区下的发文数
* @param customerId
* @param monthId
* @author zxc
* @date 2020/8/26 10:49 上午
*/
List<CommunityPublishArticleCountResultDTO> selectPublishArticleCount(@Param("customerId")String customerId, @Param("monthId")String monthId);
}

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

@ -18,6 +18,7 @@
package com.epmet.dao.indexcoll;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.indexcal.PageQueryGridFormDTO;
import com.epmet.dto.indexcollect.FactIndexServiceAblityGridMonthlyDTO;
import com.epmet.dto.indexcollect.form.GridServiceAbilityFormDTO;
import com.epmet.entity.indexcoll.FactIndexServiceAblityGridMonthlyEntity;
@ -68,13 +69,12 @@ public interface FactIndexServiceAblityGridMonthlyDao extends BaseDao<FactIndexS
/**
* @return java.util.List<com.epmet.dto.indexcollect.FactIndexServiceAblityGridMonthlyDTO>
* @param customerId
* @param monthId
* @param formDTO
* @author yinzuomei
* @description 当前客户下所有网格的治理能力相关五级指标
* @Date 2020/8/26 15:59
**/
List<Map<String,Object>> selectListServiceAblityGrid(@Param("customerId") String customerId, @Param("monthId") String monthId);
List<Map<String,Object>> selectListServiceAblityGrid(PageQueryGridFormDTO formDTO);
/**
* @return java.util.Map<java.lang.String,java.lang.Object>

33
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/indexscore/CpcScoreDao.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.indexscore;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.entity.indexscore.CpcScoreEntity;
import org.apache.ibatis.annotations.Mapper;
/**
* 党员相关分值
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-08-31
*/
@Mapper
public interface CpcScoreDao extends BaseDao<CpcScoreEntity> {
}

33
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/indexscore/GridScoreDao.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.indexscore;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.entity.indexscore.GridScoreEntity;
import org.apache.ibatis.annotations.Mapper;
/**
* 网格相关分值
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-08-31
*/
@Mapper
public interface GridScoreDao extends BaseDao<GridScoreEntity> {
}

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

@ -0,0 +1,33 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.dao.screen;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.entity.screen.FactIndexCommunityGovrnFiveScoreEntity;
import org.apache.ibatis.annotations.Mapper;
/**
* 社区相关-治理能力五级权重分数表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-08-27
*/
@Mapper
public interface FactIndexCommunityGovrnFiveScoreDao extends BaseDao<FactIndexCommunityGovrnFiveScoreEntity> {
}

45
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/screen/FactIndexCommunityPartyFiveScoreDao.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.dao.screen;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.screen.FactIndexCommunityPartyFiveScoreDTO;
import com.epmet.entity.screen.FactIndexCommunityPartyFiveScoreEntity;
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 2020-08-27
*/
@Mapper
public interface FactIndexCommunityPartyFiveScoreDao extends BaseDao<FactIndexCommunityPartyFiveScoreEntity> {
/**
* @Description 党建能力社区中间表插入
* @param lists
* @author zxc
* @date 2020/8/27 5:05 下午
*/
void insertCommunityPartyRecord(@Param("lists")List<FactIndexCommunityPartyFiveScoreDTO> lists);
}

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

@ -0,0 +1,33 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.dao.screen;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.entity.screen.FactIndexCommunityScoreEntity;
import org.apache.ibatis.annotations.Mapper;
/**
* 社区相关分数表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-08-27
*/
@Mapper
public interface FactIndexCommunityScoreDao extends BaseDao<FactIndexCommunityScoreEntity> {
}

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

@ -0,0 +1,33 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.dao.screen;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.entity.screen.FactIndexCommunityServiceFiveScoreEntity;
import org.apache.ibatis.annotations.Mapper;
/**
* 社区相关-服务能力五级权重分数表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-08-27
*/
@Mapper
public interface FactIndexCommunityServiceFiveScoreDao extends BaseDao<FactIndexCommunityServiceFiveScoreEntity> {
}

46
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/screen/FactIndexGridScoreDao.java

@ -0,0 +1,46 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.dao.screen;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.screen.result.SubGridPartyAvgResultDTO;
import com.epmet.entity.screen.FactIndexGridScoreEntity;
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 2020-08-28
*/
@Mapper
public interface FactIndexGridScoreDao extends BaseDao<FactIndexGridScoreEntity> {
/**
* @Description 下属所有网格的党建能力平均值
* @param customerId
* @param monthId
* @author zxc
* @date 2020/8/28 3:20 下午
*/
List<SubGridPartyAvgResultDTO> selectSubGridPartyAvgScore(@Param("customerId")String customerId,@Param("monthId")String monthId);
}

4
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/screen/IndexCodeFieldReDao.java

@ -4,6 +4,10 @@ import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.entity.screen.IndexCodeFieldReEntity;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@Mapper
public interface IndexCodeFieldReDao extends BaseDao<IndexCodeFieldReEntity> {
List<IndexCodeFieldReEntity> getAllData();
}

87
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/indexscore/CpcScoreEntity.java

@ -0,0 +1,87 @@
/**
* 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.indexscore;
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 2020-08-31
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("fact_index_cpc_score")
public class CpcScoreEntity extends BaseEpmetEntity {
private static final long serialVersionUID = 1L;
/**
* 客户Id
*/
private String customerId;
/**
* 网格所属的机关Id
*/
private String agencyId;
/**
* 网格Id
*/
private String gridId;
/**
* 用户id
*/
private String userId;
/**
* 月维度Id: yyyyMM
*/
private String monthId;
/**
* 党建能力分值
*/
private BigDecimal partyAblityScore;
/**
* 参与议事分值
*/
private BigDecimal joinIssueScore;
/**
* 党务活动分值
*/
private BigDecimal partyWorkActScore;
/**
* 联系群众分值
*/
private BigDecimal contactMassesScore;
}

92
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/indexscore/GridScoreEntity.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.entity.indexscore;
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 2020-08-31
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("fact_index_grid_score")
public class GridScoreEntity extends BaseEpmetEntity {
private static final long serialVersionUID = 1L;
/**
* 客户Id
*/
private String customerId;
/**
* 网格Id
*/
private String gridId;
/**
* 网格所属的机关Id
*/
private String agencyId;
/**
* 季度ID
*/
private String quarterId;
/**
* 年度ID
*/
private String yearId;
/**
* 月维度Id: yyyyMM
*/
private String monthId;
/**
* 总指数分值
*/
private BigDecimal totalScore;
/**
* 党建能力分值
*/
private BigDecimal partyAblityScore;
/**
* 治理能力分值
*/
private BigDecimal govrnAblityScore;
/**
* 服务能力分值
*/
private BigDecimal serviceAblityScore;
}

77
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/FactIndexCommunityGovrnFiveScoreEntity.java

@ -0,0 +1,77 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.entity.screen;
import com.baomidou.mybatisplus.annotation.TableName;
import com.epmet.commons.mybatis.entity.BaseEpmetEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.math.BigDecimal;
import java.util.Date;
/**
* 社区相关-治理能力五级权重分数表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-08-27
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("fact_index_community_govrn_five_score")
public class FactIndexCommunityGovrnFiveScoreEntity extends BaseEpmetEntity {
private static final long serialVersionUID = 1L;
/**
* 机关iD
*/
private String agencyId;
/**
* 月份ID
*/
private String monthId;
/**
* 季度ID
*/
private String quarterId;
/**
* 年度ID
*/
private String yearId;
/**
* 指标ID
*/
private String indexId;
/**
* 分数
*/
private BigDecimal score;
/**
* 社区被吹哨次数transfered社区办结项目数closed_project社区项目响应度resp_project_ratio社区超期项目率overdue_project_ratio社区办结项目率closed_project_ratio社区办结项目满意度satisfaction_ratio
*/
private String type;
}

77
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/FactIndexCommunityPartyFiveScoreEntity.java

@ -0,0 +1,77 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.entity.screen;
import com.baomidou.mybatisplus.annotation.TableName;
import com.epmet.commons.mybatis.entity.BaseEpmetEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.math.BigDecimal;
import java.util.Date;
/**
* 社区相关-党建能力五级权重分数表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-08-27
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("fact_index_community_party_five_score")
public class FactIndexCommunityPartyFiveScoreEntity extends BaseEpmetEntity {
private static final long serialVersionUID = 1L;
/**
* 机关ID
*/
private String agencyId;
/**
* 月度ID
*/
private String monthId;
/**
* 季度ID
*/
private String quarterId;
/**
* 年度ID
*/
private String yearId;
/**
* 指标ID
*/
private String indexId;
/**
* 分数
*/
private BigDecimal score;
/**
* 发文数量publish_article
*/
private String type;
}

77
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/FactIndexCommunityScoreEntity.java

@ -0,0 +1,77 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.entity.screen;
import com.baomidou.mybatisplus.annotation.TableName;
import com.epmet.commons.mybatis.entity.BaseEpmetEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.math.BigDecimal;
import java.util.Date;
/**
* 社区相关分数表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-08-27
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("fact_index_community_score")
public class FactIndexCommunityScoreEntity extends BaseEpmetEntity {
private static final long serialVersionUID = 1L;
/**
* 机关ID
*/
private String agencyId;
/**
* 月份ID
*/
private String monthId;
/**
* 季度ID
*/
private String quarterId;
/**
* 年度ID
*/
private String yearId;
/**
* 指标ID
*/
private String indexId;
/**
* 分数
*/
private BigDecimal score;
/**
* 党建能力party治理能力govrn服务能力service
*/
private String type;
}

77
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/FactIndexCommunityServiceFiveScoreEntity.java

@ -0,0 +1,77 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.entity.screen;
import com.baomidou.mybatisplus.annotation.TableName;
import com.epmet.commons.mybatis.entity.BaseEpmetEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.math.BigDecimal;
import java.util.Date;
/**
* 社区相关-服务能力五级权重分数表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-08-27
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("fact_index_community_service_five_score")
public class FactIndexCommunityServiceFiveScoreEntity extends BaseEpmetEntity {
private static final long serialVersionUID = 1L;
/**
* 机关ID
*/
private String agencyId;
/**
* 月度ID
*/
private String monthId;
/**
* 季度ID
*/
private String quarterId;
/**
* 年度ID
*/
private String yearId;
/**
* 指标ID
*/
private String indexId;
/**
* 分数
*/
private BigDecimal score;
/**
* 社区活动组织次数activity
*/
private String type;
}

82
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/FactIndexGridScoreEntity.java

@ -0,0 +1,82 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.entity.screen;
import com.baomidou.mybatisplus.annotation.TableName;
import com.epmet.commons.mybatis.entity.BaseEpmetEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.math.BigDecimal;
import java.util.Date;
/**
* 网格相关分值
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-08-28
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("fact_index_grid_score")
public class FactIndexGridScoreEntity extends BaseEpmetEntity {
private static final long serialVersionUID = 1L;
/**
* 客户Id
*/
private String customerId;
/**
* 网格所属的机关Id
*/
private String agencyId;
/**
* 网格Id
*/
private String gridId;
/**
* 月维度Id: yyyyMM
*/
private String monthId;
/**
* 总指数分值
*/
private BigDecimal totalScore;
/**
* 党建能力分值
*/
private BigDecimal partyAblityScore;
/**
* 治理能力分值
*/
private BigDecimal govrnAblityScore;
/**
* 服务能力分值
*/
private BigDecimal serviceAblityScore;
}

6
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/eum/IndexCodeEnum.java

@ -1,5 +1,7 @@
package com.epmet.eum;
import com.epmet.dto.indexcal.CalculateCommonFormDTO;
/**
* 需要计算指标code枚举类
*
@ -8,7 +10,7 @@ package com.epmet.eum;
**/
public enum IndexCodeEnum {
DANG_YUAN_XIANG_GUAN("dangyuanxiangguan", "党员相关", 1),
WANG_GE_XIANG_GUAN("wangggexiangguan", "网格相关", 1),
WANG_GE_XIANG_GUAN("wanggexiangguan", "网格相关", 1),
SHE_QU_XIANG_GUAN("shequxiangguan", "社区相关", 1),
JIE_DAO_XIANG_GUAN("jiedaoxiangguan", "街道相关", 1),
QU_ZHI_BU_MEN("quzhibumen", "区直部门", 1),
@ -21,7 +23,7 @@ public enum IndexCodeEnum {
CAN_YU_YI_SHI("canyuyishi", "参与议事", 4),
DANG_WU_HUO_DONG("dangwuhuodong", "党务活动", 4),
LIAN_XI_QUN_ZHONG("lianxiqunzhong", "联系群众", 4),
ZUZHINEIDANGYDLXQZNLKPFPJZ("zuzhineidangydlxqznlkpfpjz","组织内党员的联系群众能力考评分(平均值)",5),
;
private String code;

54
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/redis/IndexCodeFieldReRedis.java

@ -0,0 +1,54 @@
/**
* 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.redis;
import com.epmet.commons.tools.redis.RedisKeys;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.HashOperations;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Component;
import java.util.Map;
import java.util.concurrent.TimeUnit;
@Slf4j
@Component
public class IndexCodeFieldReRedis {
@Autowired
private RedisTemplate redisTemplate;
/**
* @Description 获取指标code和字段Id的关系
*/
public Map<String, String> getIndexCodeFiledReMap() {
HashOperations hashOperations = redisTemplate.opsForHash();
Map<String, String> values = hashOperations.entries(RedisKeys.getIndexCodeFieldReKey());
return values;
}
/**
* @Description 存入指标code和字段Id的关系
*/
public void setIndexCodeFiledReMap(Map<String, String> records) {
HashOperations hashOperations = redisTemplate.opsForHash();
hashOperations.putAll(RedisKeys.getIndexCodeFieldReKey(), records);
redisTemplate.expire(RedisKeys.getIndexCodeFieldReKey(), 1, TimeUnit.DAYS);
}
}

2
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/screen/CpcIndexCalculateService.java → epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/indexcal/CpcIndexCalculateService.java

@ -1,4 +1,4 @@
package com.epmet.service.screen;
package com.epmet.service.indexcal;
import com.epmet.dto.indexcal.CalculateCommonFormDTO;

5
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/indexcal/GridCorreLationService.java

@ -27,13 +27,12 @@ public interface GridCorreLationService {
/**
* @return java.util.List<java.util.Map<java.lang.String,java.lang.Object>>
* @param customerId
* @param monthId
* @param formDTO
* @author yinzuomei
* @description 党建能力-网格相关事实表 当前客户下所有网格的党建能力相关五级指标
* @Date 2020/8/27 14:48
**/
List<Map<String,Object>> queryListPartyAblityGrid(String customerId, String monthId);
List<Map<String,Object>> queryListPartyAblityGrid(PageQueryGridFormDTO formDTO);
/**
* @return java.util.List<com.epmet.dto.ScreenCustomerGridDTO>

24
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/indexcal/IndexCodeFieldReService.java

@ -0,0 +1,24 @@
package com.epmet.service.indexcal;
import java.util.Map;
/**
* 党员指标计算service
*
* @author liujianjun@elink-cn.com
* @date 2020/8/18 10:25
*/
public interface IndexCodeFieldReService {
/**
* desc获取指标code对应的字段值
* @return
*/
Map<String,String> getIndexCodeFieldReMap();
/**
* desc:根据指标code获取 对应的字段
* @param indexCode
* @return
*/
String getFieldNameByIndexCode(String indexCode);
}

29
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/screen/impl/CpcIndexCalculateServiceImpl.java → epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/indexcal/impl/CpcIndexCalculateServiceImpl.java

@ -1,13 +1,14 @@
package com.epmet.service.screen.impl;
package com.epmet.service.indexcal.impl;
import com.alibaba.fastjson.JSON;
import com.epmet.dao.indexcoll.FactIndexPartyAblityCpcMonthlyDao;
import com.epmet.dao.screen.IndexCodeFieldReDao;
import com.epmet.dao.screen.IndexGroupDetailDao;
import com.epmet.dto.indexcal.CalculateCommonFormDTO;
import com.epmet.entity.screen.IndexGroupDetailEntity;
import com.epmet.eum.IndexCodeEnum;
import com.epmet.service.screen.CpcIndexCalculateService;
import com.epmet.service.indexcal.CpcIndexCalculateService;
import com.epmet.service.indexcal.IndexCodeFieldReService;
import com.epmet.service.screen.IndexGroupDetailService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -25,21 +26,35 @@ public class CpcIndexCalculateServiceImpl implements CpcIndexCalculateService {
@Autowired
private IndexCodeFieldReDao indexCodeFieldReDao;
@Autowired
private IndexGroupDetailDao indexGroupDetailDao;
private IndexGroupDetailService getDetailListByParentCode;
@Autowired
private IndexCodeFieldReService indexCodeFieldReService;
@Override
public Boolean cpcIndexCalculate(CalculateCommonFormDTO formDTO) {
//计算最大最小值
Map<String, BigDecimal> minAndMaxList = factIndexPartyAblityCpcMonthlyDao.getExtremeValue(formDTO.getCustomerId());
if (CollectionUtils.isEmpty(minAndMaxList)){
log.warn("customerId:{} have not any fact record",formDTO.getCustomerId());
log.warn("cpcIndexCalculate customerId:{} have not any fact record",formDTO.getCustomerId());
return false;
}
//获取指标权重信息
List<IndexGroupDetailEntity> indexDetails = indexGroupDetailDao.getDetailListByParentCode(formDTO.getCustomerId(), IndexCodeEnum.DANG_YUAN_XIANG_GUAN.getCode());
List<IndexGroupDetailEntity> indexDetails = getDetailListByParentCode.getDetailListByParentCode(formDTO.getCustomerId(), IndexCodeEnum.DANG_YUAN_XIANG_GUAN.getCode(),IndexCodeEnum.CAN_YU_YI_SHI.getCode());
if (CollectionUtils.isEmpty(indexDetails)){
log.warn("customerId:{} have not any indexGroupDetail",formDTO.getCustomerId());
log.warn("cpcIndexCalculate customerId:{} have not any indexGroupDetail",formDTO.getCustomerId());
return false;
}
Map<String, String> indexCodeFieldReList = indexCodeFieldReService.getIndexCodeFieldReMap();
if (CollectionUtils.isEmpty(indexCodeFieldReList)){
log.warn("cpcIndexCalculate have any indexcodefieldre");
return false;
}
String indexCode = null;
String fieldName = null;
for (IndexGroupDetailEntity indexDetail : indexDetails) {
indexCode = indexDetail.getIndexCode();
fieldName = indexCodeFieldReService.getFieldNameByIndexCode(indexCode);
}
log.info(JSON.toJSONString(minAndMaxList));
Map<String, BigDecimal> list = factIndexPartyAblityCpcMonthlyDao.getCountByMonthId(formDTO.getCustomerId(), formDTO.getMonthId());

286
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/indexcal/impl/GridCorreLationServiceImpl.java

@ -1,6 +1,8 @@
package com.epmet.service.indexcal.impl;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.constant.StrConstant;
import com.epmet.constant.IndexCalConstant;
import com.epmet.dao.indexcoll.FactIndexGovrnAblityGridMonthlyDao;
import com.epmet.dao.indexcoll.FactIndexPartyAblityGridMonthlyDao;
import com.epmet.dao.indexcoll.FactIndexServiceAblityGridMonthlyDao;
@ -9,13 +11,14 @@ import com.epmet.dto.ScreenCustomerGridDTO;
import com.epmet.dto.indexcal.CalculateCommonFormDTO;
import com.epmet.dto.indexcal.CustomerGridInfoDTO;
import com.epmet.dto.indexcal.PageQueryGridFormDTO;
import com.epmet.dto.indexcollect.FactIndexGovrnAblityGridMonthlyDTO;
import com.epmet.dto.indexcollect.FactIndexPartyAblityGridMonthlyDTO;
import com.epmet.dto.indexcollect.FactIndexServiceAblityGridMonthlyDTO;
import com.epmet.entity.screen.IndexGroupDetailEntity;
import com.epmet.eum.IndexCodeEnum;
import com.epmet.service.indexcal.GridCorreLationService;
import com.epmet.service.indexcal.IndexCodeFieldReService;
import com.epmet.service.screen.IndexGroupDetailService;
import com.epmet.support.normalizing.*;
import com.epmet.support.normalizing.batch.*;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
@ -23,8 +26,9 @@ import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.math.BigDecimal;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
/**
* 网格相关service
@ -45,6 +49,8 @@ public class GridCorreLationServiceImpl implements GridCorreLationService {
private ScreenCustomerGridDao screenCustomerGridDao;
@Autowired
private IndexGroupDetailService indexGroupDetailService;
@Autowired
private IndexCodeFieldReService indexCodeFieldReService;
/**
* @param formDTO
@ -59,86 +65,265 @@ public class GridCorreLationServiceImpl implements GridCorreLationService {
List<IndexGroupDetailEntity> dangJianNengLiList = indexGroupDetailService.getDetailListByParentCode(formDTO.getCustomerId(),
IndexCodeEnum.WANG_GE_XIANG_GUAN.getCode(),
IndexCodeEnum.DANG_JIAN_NENG_LI.getCode());
if(!CollectionUtils.isEmpty(dangJianNengLiList)){
if (!CollectionUtils.isEmpty(dangJianNengLiList)) {
//1、计算网格相关-党建能力
calculateGridCorreLationDangJian(formDTO,dangJianNengLiList);
calculateGridCorreLationDangJian(formDTO, dangJianNengLiList);
}
List<IndexGroupDetailEntity> zhiLiNengLiList = indexGroupDetailService.getDetailListByParentCode(formDTO.getCustomerId(),
/* List<IndexGroupDetailEntity> zhiLiNengLiList = indexGroupDetailService.getDetailListByParentCode(formDTO.getCustomerId(),
IndexCodeEnum.WANG_GE_XIANG_GUAN.getCode(),
IndexCodeEnum.ZHI_LI_NENG_LI.getCode());
if(!CollectionUtils.isEmpty(zhiLiNengLiList)){
if (!CollectionUtils.isEmpty(zhiLiNengLiList)) {
//2、计算网格相关-治理能力
calculateGridCorreLationZhiLi(formDTO,zhiLiNengLiList);
calculateGridCorreLationZhiLi(formDTO, zhiLiNengLiList);
}
List<IndexGroupDetailEntity> fuWuNengLiList = indexGroupDetailService.getDetailListByParentCode(formDTO.getCustomerId(),
IndexCodeEnum.WANG_GE_XIANG_GUAN.getCode(),
IndexCodeEnum.FU_WU_NENG_LI.getCode());
if(!CollectionUtils.isEmpty(fuWuNengLiList)){
if (!CollectionUtils.isEmpty(fuWuNengLiList)) {
//3、计算网格相关-服务能力
calculateGridCorreLationFuWu(formDTO,fuWuNengLiList);
calculateGridCorreLationFuWu(formDTO, fuWuNengLiList);
}
//计算网格相关总分
List<IndexGroupDetailEntity> wgxgList = indexGroupDetailService.getDetailListByParentCode(formDTO.getCustomerId(),
IndexCodeEnum.WANG_GE_XIANG_GUAN.getCode());
if(!CollectionUtils.isEmpty(wgxgList)){
calculateGridCorreLationTotal(formDTO,wgxgList);
}
if (!CollectionUtils.isEmpty(wgxgList)) {
calculateGridCorreLationTotal(formDTO, wgxgList);
}*/
resultFlag = true;
return resultFlag;
}
/**
* @return void
* @param formDTO
* @param indexList
* @return void
* @author yinzuomei
* @description 计算网格相关-党建能力
* @Date 2020/8/26 16:47
* @Date 2020/8/26 16:47
**/
private void calculateGridCorreLationDangJian(CalculateCommonFormDTO formDTO,List<IndexGroupDetailEntity> indexList){
//分页查询网格列表
//查询五级指标
private void calculateGridCorreLationDangJian(CalculateCommonFormDTO formDTO, List<IndexGroupDetailEntity> indexList) {
//查询总记录数
int total = factIndexPartyAblityGridMonthlyDao.selectCount(formDTO);
if (NumConstant.ZERO == total) {
logger.info(String.format("customerId:%s,monthId:%s,没有上传网格相关-党建能力-五级指标数据"), formDTO.getCustomerId(), formDTO.getMonthId());
return;
}
//总页数,进行批量查询,批量计算
int totalPage = (int) Math.ceil((double) total / IndexCalConstant.PAGE_SIZE);
logger.info(String.format("共%s条数据,分%s次计算", total, totalPage));
//每一组指标的最大值,key:code_MIN/MAX
Map<String, Object> minAndMaxMap = queryPartyAblityGridMinAndMax(formDTO.getCustomerId(), formDTO.getMonthId());
//指标集合
Map<String, IndexInputVO<BigDecimal>> indexMap = getIndexInputVO(formDTO, indexList, minAndMaxMap);
//分页查询采集记录
for (int pageNo = 1; pageNo <= totalPage; pageNo++) {
int pageIndex = (pageNo - NumConstant.ONE) * IndexCalConstant.PAGE_SIZE;
//前10条
List<Map<String, Object>> recordList = queryListPartyAblityGrid(new PageQueryGridFormDTO(formDTO.getCustomerId(),
formDTO.getMonthId(),
pageIndex,
pageNo,
IndexCalConstant.PAGE_SIZE));
//遍历每一个网格的记录
recordList.forEach(recordMap -> {
//遍历所有的指标
indexMap.forEach((key, value) -> {
//列名不为空
if (StringUtils.isNotBlank(indexCodeFieldReService.getFieldNameByIndexCode(key))) {
//对应的数值
String sampleValueStr = String.valueOf(recordMap.get(indexCodeFieldReService.getFieldNameByIndexCode(key)));
//构造样本值对象
SampleValue<BigDecimal> currentGridIndexValue = new SampleValue((String) recordMap.get(IndexCalConstant.GRID_ID), new BigDecimal(sampleValueStr));
value.getIndexValueVOs().add(currentGridIndexValue);
} else if (IndexCodeEnum.ZUZHINEIDANGYDLXQZNLKPFPJZ.getCode().equals(key)) {
//组织内党员的联系群众能力考评分(平均值)
logger.info("组织内党员的联系群众能力考评分(平均值) 单独处理");
//网格内党员的联系群众能力考评分(平均值)
String gridId=(String) recordMap.get(IndexCalConstant.GRID_ID);
BigDecimal contactMassesAvgValue = getGridContactMassesAvgValue(gridId);
SampleValue<BigDecimal> contactMassesAblityValue = new SampleValue((String) recordMap.get(IndexCalConstant.GRID_ID), contactMassesAvgValue);
value.getIndexValueVOs().add(contactMassesAblityValue);
}
});
});
List<IndexOutputVO> result = calculate(indexMap);
// TODO 处理结果
saveGridCorreLationDangJian(formDTO, indexList, result);
try {
for (IndexOutputVO m : result) {
logger.info("indexId=" + m.getIndexId());
for (SampleScore sampleScore : m.getIndexScoreVOs()) {
logger.info(String.format("网格id:%s,得分:%s", sampleScore.getSampleId(), sampleScore.getSampleScore()));
}
}
} catch (Exception e) {
}
}
}
/**
* @return java.util.Map<java.lang.String,java.math.BigDecimal>
* @param formDTO
* @author yinzuomei
* @description TODO
* @Date 2020/8/31 9:51
**/
private Map<String, BigDecimal> contactMassesAblityMap(CalculateCommonFormDTO formDTO) {
return null;
}
/**
* @return java.math.BigDecimal
* @param gridId 网格id
* @author yinzuomei TODO
* @description 获取网格组织内党员的联系群众能力考评分平均值
* @Date 2020/8/31 9:50
**/
private BigDecimal getGridContactMassesAvgValue(String gridId) {
return null;
}
/**
* @param formDTO 客户id 月份id: yyyyMM
* @param indexList 指标集合
* @param indexOutputVOList
* @return void
* @author yinzuomei
* @description 保存网格相关五级指标分值
* @Date 2020/8/30 22:50
**/
private void saveGridCorreLationDangJian(CalculateCommonFormDTO formDTO,
List<IndexGroupDetailEntity> indexList,
List<IndexOutputVO> indexOutputVOList) {
Map<String, IndexGroupDetailEntity> indexMap = indexList.stream().collect(Collectors.toMap(IndexGroupDetailEntity::getIndexCode, Function.identity()));
}
/**
* @param indexMap
* @return java.util.List<com.epmet.support.normalizing.batch.IndexOutputVO>
* @author yinzuomei
* @description
* @Date 2020/8/30 21:40
**/
private List<IndexOutputVO> calculate(Map<String, IndexInputVO<BigDecimal>> indexMap) {
//构造入参
List<IndexInputVO> indexInputVOS = this.getIndexInputVOList(indexMap);
BatchScoreCalculator batchScoreCalculator = new BatchScoreCalculator();
return batchScoreCalculator.getScoreDetailOfIndexId(indexInputVOS);
}
/**
* @param indexMap
* @return java.util.List<com.epmet.support.normalizing.batch.IndexInputVO>
* @author yinzuomei
* @description
* @Date 2020/8/30 18:34
**/
private List<IndexInputVO> getIndexInputVOList(Map<String, IndexInputVO<BigDecimal>> indexMap) {
List<IndexInputVO> list = new ArrayList<>();
//遍历所有的指标
indexMap.forEach((key, indexInputVO) -> {
list.add(indexInputVO);
});
return list;
}
/**
* @param indexList 指标集合
* @param minAndMaxMap 最大值最小值集合
* @return java.util.Map<java.lang.String, com.epmet.support.normalizing.batch.IndexInputVO>
* @author yinzuomei
* @description
* @Date 2020/8/30 15:56
**/
private Map<String, IndexInputVO<BigDecimal>> getIndexInputVO(CalculateCommonFormDTO formDTO, List<IndexGroupDetailEntity> indexList, Map<String, Object> minAndMaxMap) {
Map<String, IndexInputVO<BigDecimal>> map = new HashMap<>();
for (int indexNum = 0; indexNum < indexList.size(); indexNum++) {
IndexGroupDetailEntity index = indexList.get(indexNum);
IndexInputVO indexInputVO = new IndexInputVO();
// 指标code
indexInputVO.setIndexId(index.getIndexCode());
//权重
indexInputVO.setWeight(index.getWeight());
BigDecimal minValue = null;
BigDecimal maxValue = null;
if (IndexCodeEnum.ZUZHINEIDANGYDLXQZNLKPFPJZ.getCode().equals(index.getIndexCode())) {
//组织内党员的联系群众能力考评分(平均值) 获取最大值,最小值
logger.info("组织内党员的联系群众能力考评分(平均值) 单独处理");
Map<String,BigDecimal> contactMassesAblityMap= this.contactMassesAblityMap(formDTO);
minValue=contactMassesAblityMap.get(StrConstant.MIN);
maxValue=contactMassesAblityMap.get(StrConstant.MAX);
} else {
//获取指标对应的列名
String fieldName = indexCodeFieldReService.getFieldNameByIndexCode(index.getIndexCode());
// logger.info("fieldName=" + fieldName + ";index.getIndexCode()=" + index.getIndexCode());
//最小值key
String minValueKey = fieldName.concat(StrConstant.UNDER_LINE).concat(StrConstant.MIN);
//最大值key
String maxValueKey = fieldName.concat(StrConstant.UNDER_LINE).concat(StrConstant.MAX);
minValue = new BigDecimal(String.valueOf(minAndMaxMap.get(minValueKey)));
maxValue = new BigDecimal(String.valueOf(minAndMaxMap.get(maxValueKey)));
}
// logger.info("minValue="+minValue+";maxValue="+maxValue);
//分值计算器
ScoreCalculator<Integer> scoreCalculator = new BigDecimalScoreCalculator(minValue,
maxValue,
ScoreConstants.MIN_SCORE,
ScoreConstants.MAX_SCORE,
Correlation.getCorrelation(index.getCorrelation())
);
indexInputVO.setScoreCalculator(scoreCalculator);
List<SampleValue<BigDecimal>> sampleValueList = new ArrayList<>();
indexInputVO.setIndexValueVOs(sampleValueList);
map.put(index.getIndexCode(), indexInputVO);
}
return map;
}
/**
* @param formDTO
* @param indexList
* @return void TODO
* @author yinzuomei
* @description 计算网格相关-治理能力
* @Date 2020/8/26 16:47
* @Date 2020/8/26 16:47
**/
private void calculateGridCorreLationZhiLi(CalculateCommonFormDTO formDTO,List<IndexGroupDetailEntity> indexList){
private void calculateGridCorreLationZhiLi(CalculateCommonFormDTO formDTO, List<IndexGroupDetailEntity> indexList) {
}
/**
* @return void
* @param formDTO
* @param indexList
* @return void
* @author yinzuomei
* @description 计算网格相关-服务能力
* @Date 2020/8/26 16:48
* @description 计算网格相关-服务能力
* @Date 2020/8/26 16:48
**/
private void calculateGridCorreLationFuWu(CalculateCommonFormDTO formDTO,List<IndexGroupDetailEntity> indexList){
private void calculateGridCorreLationFuWu(CalculateCommonFormDTO formDTO, List<IndexGroupDetailEntity> indexList) {
}
/**
* @return void
* @param formDTO
* @param indexList
* @return void
* @author yinzuomei
* @description 计算网格相关总分
* @Date 2020/8/26 16:50
**/
private void calculateGridCorreLationTotal(CalculateCommonFormDTO formDTO,List<IndexGroupDetailEntity> indexList){
private void calculateGridCorreLationTotal(CalculateCommonFormDTO formDTO, List<IndexGroupDetailEntity> indexList) {
}
/**
* @param customerId
* @return com.epmet.dto.indexcal.CustomerGridInfoDTO
@ -154,13 +339,14 @@ public class GridCorreLationServiceImpl implements GridCorreLationService {
}
/**
* @return
* @param formDTO
* @return
* @author yinzuomei
* @description 分页查询网格列表
* @Date 2020/8/27 14:42
**/
public List<ScreenCustomerGridDTO> pageGridList(PageQueryGridFormDTO formDTO){
@Override
public List<ScreenCustomerGridDTO> pageGridList(PageQueryGridFormDTO formDTO) {
int pageIndex = (formDTO.getPageNo() - NumConstant.ONE) * formDTO.getPageSize();
formDTO.setPageIndex(pageIndex);
return screenCustomerGridDao.pageListByCustomerId(formDTO);
@ -168,16 +354,15 @@ public class GridCorreLationServiceImpl implements GridCorreLationService {
/**
* @param customerId
* @param monthId
* @param formDTO
* @return java.util.List<com.epmet.dto.indexcollect.FactIndexPartyAblityGridMonthlyDTO>
* @author yinzuomei
* @description 党建能力-网格相关事实表 当前客户下所有网格的党建能力相关五级指标
* @Date 2020/8/26 15:52
**/
@Override
public List<Map<String,Object>> queryListPartyAblityGrid(String customerId, String monthId) {
return factIndexPartyAblityGridMonthlyDao.selectListPartyAblityGrid(customerId, monthId);
public List<Map<String, Object>> queryListPartyAblityGrid(PageQueryGridFormDTO formDTO) {
return factIndexPartyAblityGridMonthlyDao.selectListPartyAblityGrid(formDTO);
}
/*网格群众用户数
@ -194,29 +379,29 @@ public class GridCorreLationServiceImpl implements GridCorreLationService {
网格议题转项目率
组织三会一课次数
党员参加三会一课人次*/
/**
* @return java.util.Map<java.lang.String,java.lang.Object>
* @param customerId
* @param monthId
* @return java.util.Map<java.lang.String, java.lang.Object>
* @author yinzuomei
* @description 查询党建能力网格相关各五级指标最大值最小值
* @Date 2020/8/27 12:47
* @Date 2020/8/27 12:47
**/
public Map<String, Object> queryPartyAblityGridMinAndMax(String customerId, String monthId){
return factIndexPartyAblityGridMonthlyDao.selectPartyAblityGridMinAndMax(customerId,monthId);
public Map<String, Object> queryPartyAblityGridMinAndMax(String customerId, String monthId) {
return factIndexPartyAblityGridMonthlyDao.selectPartyAblityGridMinAndMax(customerId, monthId);
}
/**
* @param customerId
* @param monthId
* @param formDTO
* @return java.util.List<com.epmet.dto.indexcollect.FactIndexGovrnAblityGridMonthlyDTO>
* @author yinzuomei
* @description 当前客户下所有网格的治理能力相关五级指标
* @Date 2020/8/26 15:55
**/
public List<Map<String,Object>> queryListGovrnAblityGrid(String customerId, String monthId) {
return factIndexGovrnAblityGridMonthlyDao.selectListGovrnAblityGrid(customerId, monthId);
public List<Map<String, Object>> queryListGovrnAblityGrid(PageQueryGridFormDTO formDTO) {
return factIndexGovrnAblityGridMonthlyDao.selectListGovrnAblityGrid(formDTO);
}
@ -233,23 +418,22 @@ public class GridCorreLationServiceImpl implements GridCorreLationService {
}
/**
* @param customerId
* @param monthId
* @param formDTO
* @return java.util.List<com.epmet.dto.indexcollect.FactIndexServiceAblityGridMonthlyDTO>
* @author yinzuomei
* @description 当前客户下所有网格的服务能力相关五级指标
* @Date 2020/8/26 15:55
**/
public List<Map<String,Object>> queryListServiceAblityGrid(String customerId, String monthId) {
return factIndexServiceAblityGridMonthlyDao.selectListServiceAblityGrid(customerId, monthId);
public List<Map<String, Object>> queryListServiceAblityGrid(PageQueryGridFormDTO formDTO) {
return factIndexServiceAblityGridMonthlyDao.selectListServiceAblityGrid(formDTO);
}
/**
* @return java.util.Map<java.lang.String,java.lang.Object>
* @param customerId
* @param monthId
* @return java.util.Map<java.lang.String, java.lang.Object>
* @author yinzuomei
* @description 查询 服务能力网格相关各五级指标最大值最小值
* @description 查询 服务能力网格相关各五级指标最大值最小值
* @Date 2020/8/27 12:50
**/
public Map<String, Object> queryServiceAblityGridMinAndMax(String customerId, String monthId) {

46
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/indexcal/impl/IndexCodeFieldReServiceImpl.java

@ -0,0 +1,46 @@
package com.epmet.service.indexcal.impl;
import com.epmet.dao.screen.IndexCodeFieldReDao;
import com.epmet.entity.screen.IndexCodeFieldReEntity;
import com.epmet.redis.IndexCodeFieldReRedis;
import com.epmet.service.indexcal.IndexCodeFieldReService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@Service
public class IndexCodeFieldReServiceImpl implements IndexCodeFieldReService {
@Autowired
private IndexCodeFieldReDao indexCodeFieldReDao;
@Autowired
private IndexCodeFieldReRedis indexCodeFieldReRedis;
@Override
public Map<String, String> getIndexCodeFieldReMap() {
Map<String, String> indexCodeFiledReMap = indexCodeFieldReRedis.getIndexCodeFiledReMap();
if (CollectionUtils.isEmpty(indexCodeFiledReMap)) {
List<IndexCodeFieldReEntity> allData = indexCodeFieldReDao.getAllData();
if (CollectionUtils.isEmpty(allData)){
return new HashMap<>();
}
indexCodeFiledReMap = allData.stream().collect(Collectors.toMap(IndexCodeFieldReEntity::getIndexCode, o -> o.getFieldId()));
indexCodeFieldReRedis.setIndexCodeFiledReMap(indexCodeFiledReMap);
}
return indexCodeFiledReMap;
}
@Override
public String getFieldNameByIndexCode(String indexCode) {
Map<String, String> indexCodeFieldReMap = this.getIndexCodeFieldReMap();
if (CollectionUtils.isEmpty(indexCodeFieldReMap)) {
return null;
}
return indexCodeFieldReMap.get(indexCode);
}
}

32
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/screen/IndexCalculateCommunityService.java

@ -0,0 +1,32 @@
package com.epmet.service.screen;
import com.epmet.dto.screen.result.CommunityGovernAbilityCalculateResultDTO;
import com.epmet.dto.screen.result.CommunityPublishArticleCountCalculateResultDTO;
import java.util.List;
/**
* @Author zxc
* @DateTime 2020/8/26 10:33 上午
*/
public interface IndexCalculateCommunityService {
/**
* @Description 社区名义发文数量计算
* @param customerId
* @param monthId
* @author zxc
* @date 2020/8/26 10:46 上午
*/
void communityPublishArticleCountCalculate(String customerId, String monthId);
/**
* @Description 社区治理能力
* @param customerId
* @param monthId
* @author zxc
* @date 2020/8/26 1:40 下午
*/
void CommunityGovernAbilityCalculate(String customerId, String monthId);
}

209
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/screen/impl/IndexCalculateCommunityServiceImpl.java

@ -0,0 +1,209 @@
package com.epmet.service.screen.impl;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.page.PageData;
import com.epmet.dao.indexcoll.FactIndexGovrnAblityOrgMonthlyDao;
import com.epmet.dao.indexcoll.FactIndexPartyAblityCpcMonthlyDao;
import com.epmet.dao.indexcoll.FactIndexPartyAblityOrgMonthlyDao;
import com.epmet.dao.screen.*;
import com.epmet.dto.indexcal.ExtremeValueCommonDTO;
import com.epmet.dto.screen.FactIndexCommunityPartyFiveScoreDTO;
import com.epmet.dto.screen.result.*;
import com.epmet.entity.screen.IndexGroupDetailEntity;
import com.epmet.eum.IndexCodeEnum;
import com.epmet.service.indexcal.IndexCodeFieldReService;
import com.epmet.service.screen.IndexCalculateCommunityService;
import com.epmet.service.screen.IndexGroupDetailService;
import com.epmet.support.normalizing.Correlation;
import com.epmet.support.normalizing.IntegerScoreCalculator;
import com.epmet.support.normalizing.ScoreCalculator;
import com.epmet.support.normalizing.ScoreConstants;
import com.epmet.support.normalizing.batch.BatchScoreCalculator;
import com.epmet.support.normalizing.batch.IndexInputVO;
import com.epmet.support.normalizing.batch.IndexOutputVO;
import com.epmet.support.normalizing.batch.SampleValue;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import io.swagger.models.auth.In;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.util.*;
import java.util.stream.Collectors;
/**
* @Author zxc
* @DateTime 2020/8/26 10:34 上午
*/
@Service
@Slf4j
public class IndexCalculateCommunityServiceImpl implements IndexCalculateCommunityService {
@Autowired
private FactIndexPartyAblityOrgMonthlyDao factIndexPartyAblityOrgMonthlyDao;
@Autowired
private FactIndexGovrnAblityOrgMonthlyDao factIndexGovrnAblityOrgMonthlyDao;
@Autowired
private IndexGroupDetailService indexGroupDetailService;
@Autowired
private IndexCodeFieldReService indexCodeFieldReService;
@Autowired
private FactIndexCommunityPartyFiveScoreDao factIndexCommunityPartyFiveScoreDao;
@Autowired
private FactIndexGridScoreDao factIndexGridScoreDao;
@Autowired
private FactIndexCommunityServiceFiveScoreDao factIndexCommunityServiceFiveScoreDao;
@Autowired
private FactIndexCommunityGovrnFiveScoreDao factIndexCommunityGovrnFiveScoreDao;
@Autowired
private FactIndexCommunityScoreDao factIndexCommunityScoreDao;
/**
* @Description 社区名义发文数量计算党建能力
* @param customerId
* @author zxc
* @date 2020/8/26 10:46 上午
*/
@Transactional(rollbackFor = Exception.class)
@Override
public void communityPublishArticleCountCalculate(String customerId, String monthId) {
customerId = "b09527201c4409e19d1dbc5e3c3429a1";
// 党建能力
// 根据all_parent_index_code 获取指标明细
List<IndexGroupDetailEntity> detailListByParentCode = indexGroupDetailService.getDetailListByParentCode(customerId, IndexCodeEnum.SHE_QU_XIANG_GUAN.getCode(),IndexCodeEnum.DANG_JIAN_NENG_LI.getCode());
List<FactIndexCommunityPartyFiveScoreDTO> subAllGridList = new ArrayList<>();
List<FactIndexCommunityPartyFiveScoreDTO> communityPublishArticle = new ArrayList<>();
//下属所有网格的党建能力平均值
String finalCustomerId = customerId;
detailListByParentCode.forEach(indexGroup -> {
if (indexGroup.getIndexCode().equals("xiazhusuoyouwgddjnlpjz")){
List<SubGridPartyAvgResultDTO> subGridPartyAvgScore = factIndexGridScoreDao.selectSubGridPartyAvgScore(finalCustomerId, monthId);
if (subGridPartyAvgScore.size() != NumConstant.ZERO){
subGridPartyAvgScore.forEach(subGridParty -> {
BigDecimal multiply = subGridParty.getScore().multiply(indexGroup.getWeight());
subGridParty.setScore(multiply);
FactIndexCommunityPartyFiveScoreDTO dto = new FactIndexCommunityPartyFiveScoreDTO();
BeanUtils.copyProperties(subGridParty,dto);
dto.setIndexId(indexGroup.getIndexId());
dto.setTotalScore(dto.getPartyAbilityScore());
subAllGridList.add(dto);
});
factIndexCommunityPartyFiveScoreDao.insertCommunityPartyRecord(subAllGridList);
}
}
});
List<CommunityPublishArticleCountResultDTO> publishArticleCounts = factIndexPartyAblityOrgMonthlyDao.selectPublishArticleCount(customerId, monthId);
detailListByParentCode.forEach(indexGroup -> {
if (indexGroup.getIndexCode().equals("shequmingyifwsl")) {
if (publishArticleCounts.size() == NumConstant.ONE) {
//TODO 计算之后的分数
FactIndexCommunityPartyFiveScoreDTO dto = new FactIndexCommunityPartyFiveScoreDTO();
BeanUtils.copyProperties(detailListByParentCode.get(NumConstant.ZERO), dto);
dto.setPartyAbilityScore(BigDecimal.valueOf(50.00));
dto.setIndexId(detailListByParentCode.get(NumConstant.ZERO).getIndexId());
communityPublishArticle.add(dto);
factIndexCommunityPartyFiveScoreDao.insertCommunityPartyRecord(communityPublishArticle);
} else if (publishArticleCounts.size() != NumConstant.ZERO) {
Integer indexStart = NumConstant.ZERO;
Integer indexEnd = NumConstant.TEN;
List<CommunityPublishArticleCountResultDTO> collect;
MaxAndMinIntegerResultDTO maxAndMinInteger = this.getMaxAndMinInteger(publishArticleCounts.stream().map(CommunityPublishArticleCountResultDTO::getPublishArticleCount).collect(Collectors.toList()));
do {
collect = publishArticleCounts.stream().skip(indexEnd * indexStart).limit(indexEnd).collect(Collectors.toList());
ScoreCalculator<Integer> sc1 = new IntegerScoreCalculator(maxAndMinInteger.getMin(), maxAndMinInteger.getMax(), ScoreConstants.MIN_SCORE, ScoreConstants.MAX_SCORE, Correlation.POSITIVE);
List<SampleValue<Integer>> ll = new ArrayList<>();
collect.forEach(c -> {
SampleValue s = new SampleValue(c.getAgencyId(), c.getPublishArticleCount());
ll.add(s);
FactIndexCommunityPartyFiveScoreDTO publishArticle = new FactIndexCommunityPartyFiveScoreDTO();
BeanUtils.copyProperties(c,publishArticle);
communityPublishArticle.add(publishArticle);
});
IndexInputVO<Integer> index1VO = new IndexInputVO<>(indexGroup.getIndexId(), ll, indexGroup.getWeight(), sc1);
List<IndexInputVO> indexInputVOS = Arrays.asList(index1VO);
BatchScoreCalculator batchScoreCalculator = new BatchScoreCalculator();
List<IndexOutputVO> result = batchScoreCalculator.getScoreDetailOfIndexId(indexInputVOS);
result.get(NumConstant.ZERO).getIndexScoreVOs().forEach(agency -> {
communityPublishArticle.forEach(publish -> {
if (publish.getAgencyId().equals(agency.getSampleId())){
publish.setIndexId(indexGroup.getIndexId());
publish.setPartyAbilityScore(agency.getSampleScore());
publish.setTotalScore(agency.getSampleScore());
}
});
});
indexStart++;
} while (collect.size() == 10);
factIndexCommunityPartyFiveScoreDao.insertCommunityPartyRecord(communityPublishArticle);
}
}
});
}
/**
* @Description 社区治理能力
* @param customerId
* @param monthId
* @author zxc
* @date 2020/8/26 1:40 下午
*/
@Transactional(rollbackFor = Exception.class)
@Override
public void CommunityGovernAbilityCalculate(String customerId, String monthId) {
List<CommunityGovernAbilityResultDTO> communityGovernAbility = factIndexGovrnAblityOrgMonthlyDao.selectCommunityGovernAbility(customerId, monthId);
if (communityGovernAbility.size() == NumConstant.ONE){
List<CommunityGovernAbilityCalculateResultDTO> result = new ArrayList<>();
CommunityGovernAbilityCalculateResultDTO governAbility = new CommunityGovernAbilityCalculateResultDTO();
BeanUtils.copyProperties(communityGovernAbility.get(NumConstant.ZERO),governAbility);
// TODO 计算之后的分数
result.add(governAbility);
}
}
/**
* @Description Integer类型获取最大数和最小数
* @param list
* @author zxc
* @date 2020/8/27 1:30 下午
*/
public MaxAndMinIntegerResultDTO getMaxAndMinInteger(List<Integer> list){
Integer max = Collections.max(list);
Integer min = Collections.min(list);
MaxAndMinIntegerResultDTO result = new MaxAndMinIntegerResultDTO();
result.setMax(max);
result.setMin(min);
return result;
}
/**
* @Description Double类型获取最大数和最小数
* @param list
* @author zxc
* @date 2020/8/27 1:32 下午
*/
public MaxAndMinDoubleResultDTO getMaxAndMinDouble(List<Double> list){
Double max = Collections.max(list);
Double min = Collections.min(list);
MaxAndMinDoubleResultDTO result = new MaxAndMinDoubleResultDTO();
result.setMax(max);
result.setMin(min);
return result;
}
}

29
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/support/normalizing/Correlation.java

@ -14,4 +14,33 @@ public enum Correlation {
this.code = code;
this.desc = desc;
}
public static Correlation getCorrelation(String code){
if (code == null) {
return Correlation.POSITIVE;
}
Correlation[] values = Correlation.values();
for (Correlation correlation : values) {
if (code.equals(correlation.getCode())) {
return correlation;
}
}
return Correlation.POSITIVE;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getDesc() {
return desc;
}
public void setDesc(String desc) {
this.desc = desc;
}
}

2
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/support/normalizing/ScoreCalculator.java

@ -173,7 +173,7 @@ public abstract class ScoreCalculator<T> {
*/
protected BigDecimal calcuteCoefficient(BigDecimal min, BigDecimal max) {
BigDecimal fenmu = max.subtract(min);
if (fenmu.toString().equals("0"))return new BigDecimal(0);
if (fenmu.compareTo(BigDecimal.ZERO)==0)return new BigDecimal(0);
BigDecimal fenzi = maxScore.subtract(minScore);
BigDecimal divide = fenzi.divide(fenmu, MathContext.DECIMAL32);
System.out.println("分子:"+fenzi+"分母:"+fenmu+"系数:"+divide.toString());

36
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/support/normalizing/batch/BatchScoreCalculator.java

@ -3,18 +3,20 @@ package com.epmet.support.normalizing.batch;
import com.epmet.support.normalizing.ScoreCalculator;
import java.math.BigDecimal;
import java.util.HashMap;
import java.util.List;
import java.util.stream.Collectors;
public class BatchScoreCalculator {
/**
* 执行计算
* 执行计算每个指标中每个样本的得分明细
* @return 每一条都是一个指标的所有样本对应的得分值
*/
public List<IndexOutputVO> exec(List<IndexInputVO> indexInputVOS) {
public List<IndexOutputVO> getScoreDetailOfIndexId(List<IndexInputVO> indexInputVOS) {
return indexInputVOS.stream().map(i -> {
// 每个指标循环一次
String indexId = i.getIndexId();
List<SampleValue> indexValueVOs = i.getIndexValueVOs();
BigDecimal weight = i.getWeight();
@ -30,4 +32,34 @@ public class BatchScoreCalculator {
}).collect(Collectors.toList());
}
/**
* 执行计算以样本的所有指标总得分
* @param indexInputVOS
* @return
*/
public HashMap<String, BigDecimal> getScoreCountOfSampleId(List<IndexInputVO> indexInputVOS) {
// 每个样本的总得分
HashMap<String, BigDecimal> scoreCountOfSamples = new HashMap<>();
for (IndexInputVO idx : indexInputVOS) {
// 每个指标循环一次
List<SampleValue> indexValueVOs = idx.getIndexValueVOs();
BigDecimal weight = idx.getWeight();
ScoreCalculator scoreCalculator = idx.getScoreCalculator();
for (SampleValue vo : indexValueVOs) {
String sampleId = vo.getSampleId();
BigDecimal score = scoreCalculator.normalize(vo.getSampleValue(), weight);
if (scoreCountOfSamples.containsKey(sampleId)) {
BigDecimal newScore = scoreCountOfSamples.get(sampleId).add(score);
scoreCountOfSamples.put(sampleId, newScore);
} else {
scoreCountOfSamples.put(sampleId, score);
}
}
}
return scoreCountOfSamples;
}
}

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

@ -86,7 +86,7 @@
</insert>
<!-- 当前客户下,所有网格的治理能力相关五级指标 -->
<select id="selectListGovrnAblityGrid" parameterType="map" resultType="java.util.HashMap">
<select id="selectListGovrnAblityGrid" parameterType="com.epmet.dto.indexcal.PageQueryGridFormDTO" resultType="java.util.HashMap">
SELECT
m.CUSTOMER_ID,
m.GRID_ID,
@ -105,6 +105,8 @@
m.DEL_FLAG = '0'
and m.CUSTOMER_ID=#{customerId}
and m.MONTH_ID=#{monthId}
order by m.GRID_ID asc
LIMIT #{pageIndex}, #{pageSize}
</select>
<!-- 查询治理能力,网格相关,各五级指标最大值,最小值 -->

23
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/indexcoll/FactIndexGovrnAblityOrgMonthlyDao.xml

@ -85,4 +85,27 @@
)
</foreach>
</insert>
<!-- 社区治理能力各个参数查询 -->
<select id="selectCommunityGovernAbility" resultType="com.epmet.dto.screen.result.CommunityGovernAbilityResultDTO">
SELECT
agency_id AS agencyId,
parent_id AS parentId,
month_id AS monthId,
quarter_id AS quarterId,
year_id AS yearId,
transfered_count AS transferedCount,
closed_project_count AS closedProjectCount,
resp_project_ratio AS respProjectRatio,
overdue_project_ratio AS overDueProjectRatio,
closed_project_ratio AS closedProjectRatio,
satisfaction_ratio AS satisfactionRatio
FROM
fact_index_govrn_ablity_org_monthly
WHERE
del_flag = '0'
AND data_type = 'community'
AND customer_id = #{customerId}
AND month_id = #{monthId}
</select>
</mapper>

4
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/indexcoll/FactIndexPartyAblityCpcMonthlyDao.xml

@ -96,6 +96,10 @@
<select id="getCountByMonthId" resultType="java.util.Map">
SELECT
CUSTOMER_ID,
AGENCY_ID,
PARENT_ID,
GRID_ID,
CREATE_TOPIC_COUNT,
JOIN_TOPIC_COUNT,
SHIFT_ISSUE_COUNT,

15
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/indexcoll/FactIndexPartyAblityGridMonthlyDao.xml

@ -102,7 +102,7 @@
<!-- 当前客户下,所有网格的党建能力相关五级指标 -->
<select id="selectListPartyAblityGrid" parameterType="map" resultType="java.util.HashMap">
<select id="selectListPartyAblityGrid" parameterType="com.epmet.dto.indexcal.PageQueryGridFormDTO" resultType="java.util.HashMap">
SELECT
m.CUSTOMER_ID,
m.GRID_ID,
@ -126,6 +126,8 @@
m.DEL_FLAG = '0'
AND m.CUSTOMER_ID =#{customerId}
AND m.MONTH_ID =#{monthId}
order by m.GRID_ID asc
LIMIT #{pageIndex}, #{pageSize}
</select>
<!-- 查询党建能力,网格相关,各五级指标最大值,最小值 -->
@ -167,4 +169,15 @@
AND m.CUSTOMER_ID =#{customerId}
AND m.MONTH_ID =#{monthId}
</select>
<select id="selectCount" parameterType="com.epmet.dto.indexcal.CalculateCommonFormDTO" resultType="java.lang.Integer">
SELECT
count(1) as total
FROM
fact_index_party_ablity_grid_monthly m
WHERE
m.DEL_FLAG = '0'
AND m.CUSTOMER_ID =#{customerId}
AND m.MONTH_ID =#{monthId}
</select>
</mapper>

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

@ -71,4 +71,22 @@
</foreach>
</insert>
<!-- 查询社区下的发文数 -->
<select id="selectPublishArticleCount" resultType="com.epmet.dto.screen.result.CommunityPublishArticleCountResultDTO">
SELECT
agency_id,
parent_id,
month_id,
quarter_id,
year_id,
publish_article_count
FROM
fact_index_party_ablity_org_monthly
WHERE
del_flag = '0'
AND data_type = 'community'
AND customer_id = #{customerId}
AND month_id = #{monthId}
</select>
</mapper>

4
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/indexcoll/FactIndexServiceAblityGridMonthlyDao.xml

@ -71,7 +71,7 @@
</insert>
<!-- 当前客户下,所有网格的治理能力相关五级指标 -->
<select id="selectListServiceAblityGrid" parameterType="map" resultType="java.util.HashMap">
<select id="selectListServiceAblityGrid" parameterType="com.epmet.dto.indexcal.PageQueryGridFormDTO" resultType="java.util.HashMap">
SELECT
m.CUSTOMER_ID,
m.GRID_ID,
@ -85,6 +85,8 @@
m.DEL_FLAG = '0'
and m.CUSTOMER_ID=#{customerId}
and m.MONTH_ID=#{monthId}
order by m.GRID_ID asc
LIMIT #{pageIndex}, #{pageSize}
</select>
<!-- 查询 服务能力,网格相关,各五级指标最大值,最小值 -->

26
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/indexscore/CpcScoreDao.xml

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.epmet.dao.indexscore.CpcScoreDao">
<resultMap type="com.epmet.entity.indexscore.CpcScoreEntity" id="cpcScoreMap">
<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="userId" column="USER_ID"/>
<result property="monthId" column="MONTH_ID"/>
<result property="partyAblityScore" column="PARTY_ABLITY_SCORE"/>
<result property="joinIssueScore" column="JOIN_ISSUE_SCORE"/>
<result property="partyWorkActScore" column="PARTY_WORK_ACT_SCORE"/>
<result property="contactMassesScore" column="CONTACT_MASSES_SCORE"/>
<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>

27
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/indexscore/GridScoreDao.xml

@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.epmet.dao.indexscore.GridScoreDao">
<resultMap type="com.epmet.entity.indexscore.GridScoreEntity" id="gridScoreMap">
<result property="id" column="ID"/>
<result property="customerId" column="CUSTOMER_ID"/>
<result property="gridId" column="GRID_ID"/>
<result property="agencyId" column="AGENCY_ID"/>
<result property="quarterId" column="QUARTER_ID"/>
<result property="yearId" column="YEAR_ID"/>
<result property="monthId" column="MONTH_ID"/>
<result property="totalScore" column="TOTAL_SCORE"/>
<result property="partyAblityScore" column="PARTY_ABLITY_SCORE"/>
<result property="govrnAblityScore" column="GOVRN_ABLITY_SCORE"/>
<result property="serviceAblityScore" column="SERVICE_ABLITY_SCORE"/>
<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>

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

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

27
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/screen/FactIndexCommunityPartyFiveScoreDao.xml

@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.epmet.dao.screen.FactIndexCommunityPartyFiveScoreDao">
<!-- 党建能力【社区】中间表插入 -->
<insert id="insertCommunityPartyRecord">
INSERT INTO fact_index_community_party_five_score ( ID, AGENCY_ID, MONTH_ID, INDEX_ID, TOTAL_SCORE, PARTY_ABILITY_SCORE, DEL_FLAG, REVISION, CREATED_BY, CREATED_TIME, UPDATED_BY, UPDATED_TIME )
VALUES
<foreach collection="lists" item="item" separator=",">
(
REPLACE ( UUID(), '-', '' ),
#{item.agencyId},
#{item.monthId},
#{item.indexId},
#{item.totalScore},
#{item.partyAbilityScore},
#{item.delFlag},
#{item.revision},
#{item.createdBy},
NOW(),
#{item.updatedBy},
NOW()
)
</foreach>
</insert>
</mapper>

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

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

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

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

20
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/screen/FactIndexGridScoreDao.xml

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.epmet.dao.screen.FactIndexGridScoreDao">
<!-- 下属所有网格的党建能力平均值 -->
<select id="selectSubGridPartyAvgScore" resultType="com.epmet.dto.screen.result.SubGridPartyAvgResultDTO">
SELECT
agency_id,
month_id,
AVG( party_ablity_score ) AS score
FROM
fact_index_grid_score
WHERE
del_flag = '0'
AND customer_id = #{customerId}
AND month_id = #{monthId}
GROUP BY agency_id
</select>
</mapper>

5
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/screen/IndexCodeFieIdReDao.xml

@ -3,4 +3,9 @@
<mapper namespace="com.epmet.dao.screen.IndexCodeFieldReDao">
<select id="getAllData" resultType="com.epmet.entity.screen.IndexCodeFieldReEntity">
SELECT INDEX_CODE,FIELD_ID FROM index_code_field_re WHERE DEL_FLAG = '0'
</select>
</mapper>

32
epmet-module/data-statistical/data-statistical-server/src/test/java/com/epmet/stats/test/normalizing/DemoScoreCal.java

@ -9,6 +9,7 @@ import org.junit.Test;
import java.math.BigDecimal;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
public class DemoScoreCal {
@ -83,7 +84,7 @@ public class DemoScoreCal {
List<IndexInputVO> indexInputVOS = Arrays.asList(index1VO, index2VO);
BatchScoreCalculator batchScoreCalculator = new BatchScoreCalculator();
List<IndexOutputVO> result = batchScoreCalculator.exec(indexInputVOS);
List<IndexOutputVO> result = batchScoreCalculator.getScoreDetailOfIndexId(indexInputVOS);
System.err.println("--------------------------------");
result.stream().forEach(r -> System.out.println(r));
@ -109,7 +110,7 @@ public class DemoScoreCal {
List<IndexInputVO> indexInputVOS = Arrays.asList(index1VO, index2VO);
BatchScoreCalculator batchScoreCalculator = new BatchScoreCalculator();
List<IndexOutputVO> result = batchScoreCalculator.exec(indexInputVOS);
List<IndexOutputVO> result = batchScoreCalculator.getScoreDetailOfIndexId(indexInputVOS);
System.err.println("--------------------------------");
result.stream().forEach(r -> System.out.println(r));
@ -117,5 +118,32 @@ public class DemoScoreCal {
System.err.println("--------------------------------");
}
@Test
public void testBigDecimalBatchCalculateGroupBySampleId() throws InterruptedException {
//{4,8,1,3,2}
// 每个指标需要单独的分支计算器,因为每个指标的最大最小值是不同的
ScoreCalculator sc1 = new BigDecimalScoreCalculator(new BigDecimal(1), new BigDecimal(8), ScoreConstants.MIN_SCORE, ScoreConstants.MAX_SCORE, Correlation.NEGATIVE);
ScoreCalculator sc2 = new BigDecimalScoreCalculator(new BigDecimal(1), new BigDecimal(8), ScoreConstants.MIN_SCORE, ScoreConstants.MAX_SCORE, Correlation.NEGATIVE);
List<SampleValue> index1SampleValues = Arrays.asList(new SampleValue<>("id1", new BigDecimal(4)), new SampleValue<>("id2", new BigDecimal(1)), new SampleValue<>("id3", new BigDecimal(8)));
List<SampleValue> index2SampleValues = Arrays.asList(new SampleValue<>("id1", new BigDecimal(1)), new SampleValue<>("id2", new BigDecimal(8)), new SampleValue<>("id3", new BigDecimal(3)));
// 每个指标的信息,包括样本列表,权重,指标标记
IndexInputVO index1VO = new IndexInputVO("aaa", index1SampleValues, new BigDecimal(1), sc1);
IndexInputVO index2VO = new IndexInputVO("bbb", index2SampleValues, new BigDecimal(1), sc2);
List<IndexInputVO> indexInputVOS = Arrays.asList(index1VO, index2VO);
BatchScoreCalculator batchScoreCalculator = new BatchScoreCalculator();
HashMap<String, BigDecimal> result = batchScoreCalculator.getScoreCountOfSampleId(indexInputVOS);
System.err.println("--------------------------------");
result.forEach((key, value) -> {
System.out.println(key.concat("的得分为:").concat(value.toString()));
});
System.err.println("--------------------------------");
}
}

Loading…
Cancel
Save