diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java index e1fa2fa2c7..786067c3f0 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java @@ -295,25 +295,36 @@ public class RedisKeys { * @return */ public static String getExternalAppSecretKey(String appId) { - return String.format(rootPrefix+"externalapp:secret:%s",appId); + return String.format(rootPrefix + "externalapp:secret:%s", appId); } /** * 计算指标时获取指标code和fields关系缓存Key + * * @return */ public static String getIndexCodeFieldReKey() { return rootPrefix.concat("stats:indexcal:indexcode:field"); } + /** + * 计算指标时获取指标权重缓存Key + * + * @return + */ + public static String getIndexCodeWeightKey(String customerId) { + return rootPrefix.concat("stats:indexcal:indexcode:weight").concat(customerId); + } + /** * 客户统计的计算标记。 * 0:未在计算 * 1:正在计算 + * * @param customerId * @return */ public static String getCustomerStatsCalFlag(String customerId) { - return String.format(rootPrefix+"stats:calflag:%s", customerId); + return String.format(rootPrefix + "stats:calflag:%s", customerId); } } diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcal/AgencyScoreDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcal/AgencyScoreDTO.java index dabf459123..605f755064 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcal/AgencyScoreDTO.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcal/AgencyScoreDTO.java @@ -120,12 +120,17 @@ public class AgencyScoreDTO implements Serializable { /** * 更新人 */ - private String updatedBy; + private String updatedBy; /** * 更新时间 */ - private Date updatedTime; + private Date updatedTime; + + /** + * 权重 + */ + private BigDecimal weight; public AgencyScoreDTO() { this.isTotal = NumConstant.ZERO_STR; diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcal/DeptScoreDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcal/DeptScoreDTO.java index f61ab58957..8c0ee008be 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcal/DeptScoreDTO.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcal/DeptScoreDTO.java @@ -120,4 +120,8 @@ public class DeptScoreDTO implements Serializable { */ private Date updatedTime; -} \ No newline at end of file + /** + * 权重(同一组权重总和=1) 9.12新增 + */ + private BigDecimal weight; +} diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcollect/form/OrgGovrnAbilityFormDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcollect/form/OrgGovrnAbilityFormDTO.java index c2eadf4dc7..dc91df6e08 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcollect/form/OrgGovrnAbilityFormDTO.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcollect/form/OrgGovrnAbilityFormDTO.java @@ -71,7 +71,7 @@ public class OrgGovrnAbilityFormDTO implements Serializable { private BigDecimal satisfactionRatio; /** - * 社区超期项目率,dataTyp=commnuity有值 + * 社区超期项目率,dataTyp=community有值 */ private BigDecimal overdueProjectRatio; diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/FactIndexCommunityScoreDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/FactIndexCommunityScoreDTO.java index 026b92084b..2888cc7706 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/FactIndexCommunityScoreDTO.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/FactIndexCommunityScoreDTO.java @@ -17,11 +17,11 @@ package com.epmet.dto.screen; -import java.io.Serializable; -import java.util.Date; import lombok.Data; +import java.io.Serializable; import java.math.BigDecimal; +import java.util.Date; /** * 社区相关分数表 @@ -112,12 +112,17 @@ public class FactIndexCommunityScoreDTO implements Serializable { /** * 更新人 */ - private String updatedBy; + private String updatedBy; /** * 更新时间 */ - private Date updatedTime; + private Date updatedTime; + + /** + * 权重 + */ + private BigDecimal weight; public FactIndexCommunityScoreDTO() { this.customerId = ""; diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/FactIndexGridScoreDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/FactIndexGridScoreDTO.java index d5be2db6e9..ed068f9a75 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/FactIndexGridScoreDTO.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/FactIndexGridScoreDTO.java @@ -119,4 +119,8 @@ public class FactIndexGridScoreDTO implements Serializable { */ private Date updatedTime; + /** + * 权重(同一组权重总和=1) 9.12新增 + */ + private BigDecimal weight; } diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/form/IndexDataMonthlyFormDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/form/IndexDataMonthlyFormDTO.java index c27f75db87..4adf142a12 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/form/IndexDataMonthlyFormDTO.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/form/IndexDataMonthlyFormDTO.java @@ -1,5 +1,6 @@ package com.epmet.dto.screencoll.form; +import com.epmet.commons.tools.constant.NumConstant; import lombok.Data; import java.io.Serializable; @@ -64,4 +65,22 @@ public class IndexDataMonthlyFormDTO implements Serializable { * 治理能力指数 */ private BigDecimal governAblity; + +// PARTY_DEV_WEIGHT decimal 5 4 0 0 0 0 0 0 0 0 0 0 0 +// SERVICE_ABLITY_WEIGHT decimal 5 4 0 0 0 0 0 0 0 0 0 0 0 +// GOVERN_ABLITY_WEIGHT decimal 5 4 0 0 0 0 0 0 0 0 0 0 0 + /** + * 党建能力指数权重 + */ + private BigDecimal partyDevWeight = new BigDecimal(NumConstant.ZERO); + + /** + * 服务能力指数 权重 + */ + private BigDecimal serviceAblityWeight = new BigDecimal(NumConstant.ZERO); + + /** + * 治理能力分数,权重 + */ + private BigDecimal governAblityWeight = new BigDecimal(NumConstant.ZERO); } diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/form/KcCategorySummaryFormDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/form/KcCategorySummaryFormDTO.java index 495e3ac7f7..045e515fe1 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/form/KcCategorySummaryFormDTO.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/form/KcCategorySummaryFormDTO.java @@ -36,12 +36,12 @@ public class KcCategorySummaryFormDTO implements Serializable { private String allParentIds; /** - * 类别id + * 一级类别id */ private String categoryId; /** - * 分类名称 + * 一级分类名称 */ private String categoryName; diff --git a/epmet-module/data-statistical/data-statistical-server/pom.xml b/epmet-module/data-statistical/data-statistical-server/pom.xml index b907c6525e..d930651a68 100644 --- a/epmet-module/data-statistical/data-statistical-server/pom.xml +++ b/epmet-module/data-statistical/data-statistical-server/pom.xml @@ -226,7 +226,7 @@ true - 8109 + 8108 local diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java index 59ed8ba771..360571a1e4 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java @@ -168,9 +168,9 @@ public class DemoController { // List gridScoreDTOList=gridScoreDao.selectList(formDTO); // return new Result>().ok(gridScoreDTOList); - cpcIndexCalculateService.cpcIndexCalculate(formDTO); +// cpcIndexCalculateService.cpcIndexCalculate(formDTO); gridCorreLationService.calculateGridCorreLation(formDTO); - deptScoreService.calculateDeptCorreLation(formDTO); +// deptScoreService.calculateDeptCorreLation(formDTO); return new Result(); } @DataSource(DataSourceConstant.EVALUATION_INDEX) diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/IndexCalculateController.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/IndexCalculateController.java index 1a48df14d5..8459b99f50 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/IndexCalculateController.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/IndexCalculateController.java @@ -135,10 +135,10 @@ public class IndexCalculateController { public Result calculateAll(@RequestBody CalculateCommonFormDTO formDTO) { long start = System.currentTimeMillis(); Boolean aBoolean = indexCalculateService.indexCalculate(formDTO); + HttpClientManager.getInstance().sendAlarmMsg("客户Id:" + formDTO.getCustomerId() + ",calculateAll全部指标计算完成,是否成功:" + aBoolean + ",总耗时:" + (System.currentTimeMillis() - start) / 1000 + "秒"); if (aBoolean) { return new Result().ok(true); } - HttpClientManager.getInstance().sendAlarmMsg("客户Id:" + formDTO.getCustomerId() + ",calculateAll全部指标计算完成,总耗时:" + (System.currentTimeMillis() - start) / 1000 + "秒"); return new Result().error("指标计算失败"); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/AgencyScoreDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/AgencyScoreDao.java index fa9ae610f4..3046923a98 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/AgencyScoreDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/AgencyScoreDao.java @@ -82,17 +82,6 @@ public interface AgencyScoreDao extends BaseDao { **/ List selectListAgencyScore(@Param("customerId")String customerId, @Param("monthId")String monthId); - /** - * 批量插入区/街道相关分数表 - * - * @param list - * @param customerId - * @return void - * @Author zhangyong - * @Date 11:11 2020-09-04 - **/ - void batchInsertAgencyScoreData(@Param("list") List list, @Param("customerId")String customerId); - /** * 根据入参查询 区/街道相关分数表id * @param customerId diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/CommunityScoreDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/CommunityScoreDao.java index 4df07097d9..95d0f60e84 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/CommunityScoreDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/CommunityScoreDao.java @@ -20,7 +20,7 @@ package com.epmet.dao.evaluationindex.indexcal; import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.dto.indexcal.SubCommunityAvgResultDTO; import com.epmet.dto.screen.FactIndexCommunityScoreDTO; -import com.epmet.entity.evaluationindex.screen.FactIndexCommunityScoreEntity; +import com.epmet.entity.evaluationindex.indexcal.FactIndexCommunityScoreEntity; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -79,17 +79,6 @@ public interface CommunityScoreDao extends BaseDao selectSubCommAvgScore(@Param("customerId")String customerId, @Param("monthId")String monthId, @Param("indexCode")String indexCode); - /** - * 批量插入 社区相关分数表 - * - * @param list - * @param customerId - * @return void - * @Author zhangyong - * @Date 11:11 2020-09-04 - **/ - void batchInsertCommunityScoreData(@Param("list") List list, @Param("customerId")String customerId); - /** * 根据入参查询 查询社区id * @param customerId diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/CommunitySubScoreDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/CommunitySubScoreDao.java index 7107d29e8c..a8d5971cc7 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/CommunitySubScoreDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/CommunitySubScoreDao.java @@ -18,9 +18,8 @@ package com.epmet.dao.evaluationindex.indexcal; import com.epmet.commons.mybatis.dao.BaseDao; -import com.epmet.dto.indexcal.SubCommunityAvgResultDTO; import com.epmet.dto.screen.FactIndexCommunityScoreDTO; -import com.epmet.entity.evaluationindex.screen.FactIndexCommunityScoreEntity; +import com.epmet.entity.evaluationindex.indexcal.FactIndexCommunitySubScoreEntity; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -33,7 +32,7 @@ import java.util.List; * @since v1.0.0 2020-08-31 */ @Mapper -public interface CommunitySubScoreDao extends BaseDao { +public interface CommunitySubScoreDao extends BaseDao { /** * @param lists diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/IndexGroupDetailDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/IndexGroupDetailDao.java index 17e7a7eb82..d67b86e887 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/IndexGroupDetailDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/IndexGroupDetailDao.java @@ -34,4 +34,6 @@ import java.util.List; public interface IndexGroupDetailDao extends BaseDao { List getDetailListByParentCode(@Param("customerId") String customerId, @Param("indexCode") String indexCode); + + List getAllIndexWeightList(String customerId); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/indexcal/AgencyScoreEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/indexcal/AgencyScoreEntity.java index 879018ac99..21847b47d9 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/indexcal/AgencyScoreEntity.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/indexcal/AgencyScoreEntity.java @@ -87,4 +87,8 @@ public class AgencyScoreEntity extends BaseEpmetEntity { */ private String dataType; + /** + * 权重(同一组权重总和=1) + */ + private BigDecimal weight; } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/indexcal/AgencySubScoreEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/indexcal/AgencySubScoreEntity.java index 2f1d277b46..d5ca30dc0e 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/indexcal/AgencySubScoreEntity.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/indexcal/AgencySubScoreEntity.java @@ -87,4 +87,8 @@ public class AgencySubScoreEntity extends BaseEpmetEntity { */ private String dataType; + /** + * 权重(同一组权重总和=1) + */ + private BigDecimal weight; } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/indexcal/CpcScoreEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/indexcal/CpcScoreEntity.java index 30eb9fb66a..ee1a68f8eb 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/indexcal/CpcScoreEntity.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/indexcal/CpcScoreEntity.java @@ -87,4 +87,9 @@ public class CpcScoreEntity extends BaseEpmetEntity { * 是否是总分 1是0不是 */ private String isTotal; + + /** + * 权重(同一组权重总和=1) + */ + private BigDecimal weight; } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/indexcal/CpcSubScoreEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/indexcal/CpcSubScoreEntity.java index 2183f77502..f1c79068a5 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/indexcal/CpcSubScoreEntity.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/indexcal/CpcSubScoreEntity.java @@ -87,4 +87,9 @@ public class CpcSubScoreEntity extends BaseEpmetEntity { * 是否是总分 1是0不是 */ private String isTotal; + + /** + * 权重(同一组权重总和=1) + */ + private BigDecimal weight; } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/indexcal/DeptScoreEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/indexcal/DeptScoreEntity.java index 7a5dcce754..41a5f19188 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/indexcal/DeptScoreEntity.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/indexcal/DeptScoreEntity.java @@ -87,4 +87,8 @@ public class DeptScoreEntity extends BaseEpmetEntity { */ private String allParentIndexCode; + /** + * 权重(同一组权重总和=1) + */ + private BigDecimal weight; } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/indexcal/DeptSubScoreEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/indexcal/DeptSubScoreEntity.java index db12edfeec..191ffb0157 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/indexcal/DeptSubScoreEntity.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/indexcal/DeptSubScoreEntity.java @@ -82,4 +82,8 @@ public class DeptSubScoreEntity extends BaseEpmetEntity { */ private String allParentIndexCode; + /** + * 权重(同一组权重总和=1) + */ + private BigDecimal weight; } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/FactIndexCommunityScoreEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/indexcal/FactIndexCommunityScoreEntity.java similarity index 93% rename from epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/FactIndexCommunityScoreEntity.java rename to epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/indexcal/FactIndexCommunityScoreEntity.java index 5fee9d7cb3..1a2dbe1dfd 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/FactIndexCommunityScoreEntity.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/indexcal/FactIndexCommunityScoreEntity.java @@ -15,7 +15,7 @@ * along with this program. If not, see . */ -package com.epmet.entity.evaluationindex.screen; +package com.epmet.entity.evaluationindex.indexcal; import com.baomidou.mybatisplus.annotation.TableName; import com.epmet.commons.mybatis.entity.BaseEpmetEntity; @@ -87,4 +87,9 @@ public class FactIndexCommunityScoreEntity extends BaseEpmetEntity { */ private String allParentIndexCode; + /** + * 权重(同一组权重总和=1) + */ + private BigDecimal weight; + } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/indexcal/FactIndexCommunitySubScoreEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/indexcal/FactIndexCommunitySubScoreEntity.java new file mode 100644 index 0000000000..d8938d9018 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/indexcal/FactIndexCommunitySubScoreEntity.java @@ -0,0 +1,70 @@ +package com.epmet.entity.evaluationindex.indexcal; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.math.BigDecimal; + +/** + * 社区相关分数表-明细 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-08-31 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("fact_index_community_sub_score") +public class FactIndexCommunitySubScoreEntity extends BaseEpmetEntity { + private static final long serialVersionUID = -7046354032669198828L; + /** + * 客户Id + */ + private String customerId; + + /** + * 组织id + */ + private String agencyId; + + /** + * 社区上一级组织id + */ + private String parentAgencyId; + + /** + * 年度ID: yyyy + */ + private String yearId; + + /** + * 季度id: yyyyQ1、yyyyQ2、yyyyQ3、yyyyQ4 + */ + private String quarterId; + + /** + * 月维度Id: yyyyMM + */ + private String monthId; + + /** + * 分值 + */ + private BigDecimal score; + + /** + * 党建能力:dangjiannengli;治理能力:zhilinengli;服务能力:fuwunengli;社区相关:shequxiangguan + */ + private String indexCode; + + /** + * 所有指标code拼接的字符串 冒号隔开 + */ + private String allParentIndexCode; + + /** + * 权重(同一组权重总和=1) + */ + private BigDecimal weight; +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/indexcal/GridScoreEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/indexcal/GridScoreEntity.java index 2fc442c0be..6831a84e5c 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/indexcal/GridScoreEntity.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/indexcal/GridScoreEntity.java @@ -92,4 +92,8 @@ public class GridScoreEntity extends BaseEpmetEntity { */ private String allParentIndexCode; + /** + * 权重(同一组权重总和=1) + */ + private BigDecimal weight; } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/indexcal/GridSubScoreEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/indexcal/GridSubScoreEntity.java index 01f40a5ddd..3404fda77d 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/indexcal/GridSubScoreEntity.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/indexcal/GridSubScoreEntity.java @@ -92,4 +92,8 @@ public class GridSubScoreEntity extends BaseEpmetEntity { */ private String allParentIndexCode; + /** + * 权重(同一组权重总和=1) + */ + private BigDecimal weight; } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/indexcoll/FactIndexGovrnAblityOrgMonthlyEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/indexcoll/FactIndexGovrnAblityOrgMonthlyEntity.java index e23472c6a4..fe8ee990b8 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/indexcoll/FactIndexGovrnAblityOrgMonthlyEntity.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/indexcoll/FactIndexGovrnAblityOrgMonthlyEntity.java @@ -98,7 +98,7 @@ public class FactIndexGovrnAblityOrgMonthlyEntity extends BaseEpmetEntity { private BigDecimal satisfactionRatio; /** - * 社区超期项目率,dataTyp=commnuity有值 + * 社区超期项目率,dataTyp=community有值 */ private BigDecimal overdueProjectRatio; diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/FactIndexCommunityFiveScoreEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/FactIndexCommunityFiveScoreEntity.java deleted file mode 100644 index 40a112d6d8..0000000000 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/FactIndexCommunityFiveScoreEntity.java +++ /dev/null @@ -1,75 +0,0 @@ -/** - * Copyright 2018 人人开源 https://www.renren.io - *

- * 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. - *

- * 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. - *

- * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package com.epmet.entity.evaluationindex.screen; - -import com.baomidou.mybatisplus.annotation.TableName; -import com.epmet.commons.mybatis.entity.BaseEpmetEntity; -import lombok.Data; -import lombok.EqualsAndHashCode; - -import java.math.BigDecimal; - -/** - * 社区相关-党建能力【五级权重】分数表 - * - * @author generator generator@elink-cn.com - * @since v1.0.0 2020-08-27 - */ -@Data -@EqualsAndHashCode(callSuper=false) -@TableName("fact_index_community_five_score") -public class FactIndexCommunityFiveScoreEntity 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; - -} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenIndexDataMonthlyEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenIndexDataMonthlyEntity.java index e8d16e858d..0a2fdd7455 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenIndexDataMonthlyEntity.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenIndexDataMonthlyEntity.java @@ -92,4 +92,21 @@ public class ScreenIndexDataMonthlyEntity extends BaseEpmetEntity { */ private BigDecimal governAblity; +// PARTY_DEV_WEIGHT decimal 5 4 0 0 0 0 0 0 0 0 0 0 0 +// SERVICE_ABLITY_WEIGHT decimal 5 4 0 0 0 0 0 0 0 0 0 0 0 +// GOVERN_ABLITY_WEIGHT decimal 5 4 0 0 0 0 0 0 0 0 0 0 0 + /** + * 党建能力指数权重 + */ + private BigDecimal partyDevWeight; + + /** + * 服务能力指数 权重 + */ + private BigDecimal serviceAblityWeight; + + /** + * 治理能力分数,权重 + */ + private BigDecimal governAblityWeight; } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenKcProjectCategoryGridDailyEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenKcProjectCategoryGridDailyEntity.java index 3307b3dcfa..ba35584411 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenKcProjectCategoryGridDailyEntity.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenKcProjectCategoryGridDailyEntity.java @@ -69,12 +69,12 @@ public class ScreenKcProjectCategoryGridDailyEntity extends BaseEpmetEntity { private String allParentIds; /** - * 类别id + * 一级类别id */ private String categoryId; /** - * 分类名称 + * 一级分类名称 */ private String categoryName; diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/redis/IndexCodeFieldReRedis.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/redis/IndexCalRedis.java similarity index 67% rename from epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/redis/IndexCodeFieldReRedis.java rename to epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/redis/IndexCalRedis.java index 8a99d62890..8e1c769d14 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/redis/IndexCodeFieldReRedis.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/redis/IndexCalRedis.java @@ -24,12 +24,13 @@ import org.springframework.data.redis.core.HashOperations; import org.springframework.data.redis.core.RedisTemplate; import org.springframework.stereotype.Component; +import java.math.BigDecimal; import java.util.Map; import java.util.concurrent.TimeUnit; @Slf4j @Component -public class IndexCodeFieldReRedis { +public class IndexCalRedis { @Autowired private RedisTemplate redisTemplate; @@ -54,9 +55,37 @@ public class IndexCodeFieldReRedis { /** * desc:删除指标字段关系缓存 + * * @return */ public Boolean deleteIndexCodeFromRedis() { return redisTemplate.delete(RedisKeys.getIndexCodeFieldReKey()); } + + /** + * @Description 获取指标权重 + */ + public Map getIndexCodeWeightMap(String customerId) { + HashOperations hashOperations = redisTemplate.opsForHash(); + Map values = hashOperations.entries(RedisKeys.getIndexCodeWeightKey(customerId)); + return values; + } + + /** + * @Description 存入指标权重 + */ + public void setIndexCodeWeightMap(String customerId, Map records) { + HashOperations hashOperations = redisTemplate.opsForHash(); + hashOperations.putAll(RedisKeys.getIndexCodeWeightKey(customerId), records); + redisTemplate.expire(RedisKeys.getIndexCodeFieldReKey(), 1, TimeUnit.DAYS); + } + + /** + * desc:删除指标权重缓存 + * + * @return + */ + public Boolean deleteIndexCodeWeightFromRedis(String customerId) { + return redisTemplate.delete(RedisKeys.getIndexCodeWeightKey(customerId)); + } } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/CpcIndexCalculateServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/CpcIndexCalculateServiceImpl.java index 7c2f3dc367..0de8be20fc 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/CpcIndexCalculateServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/CpcIndexCalculateServiceImpl.java @@ -50,7 +50,7 @@ public class CpcIndexCalculateServiceImpl implements CpcIndexCalculateService { @Autowired private FactIndexPartyAblityCpcMonthlyDao factIndexPartyAblityCpcMonthlyDao; @Autowired - private IndexGroupDetailService getDetailListByParentCode; + private IndexGroupDetailService indexGroupDetailService; @Autowired private IndexCodeFieldReService indexCodeFieldReService; @Autowired @@ -72,7 +72,7 @@ public class CpcIndexCalculateServiceImpl implements CpcIndexCalculateService { */ private void calculateTotalScore(CalculateCommonFormDTO formDTO) { //获取指标权重 - List parentIndexDetails = getDetailListByParentCode.getDetailListByParentCode(formDTO.getCustomerId(), IndexCodeEnum.DANG_YUAN_XIANG_GUAN.getCode()); + List parentIndexDetails = indexGroupDetailService.getDetailListByParentCode(formDTO.getCustomerId(), IndexCodeEnum.DANG_YUAN_XIANG_GUAN.getCode()); if (CollectionUtils.isEmpty(parentIndexDetails)) { log.warn("cpcIndexCalculate customerId:{} have not any indexGroupDetail", formDTO.getCustomerId()); throw new RenException("客户【党员相关】指标权重信息不存在"); @@ -113,6 +113,7 @@ public class CpcIndexCalculateServiceImpl implements CpcIndexCalculateService { totalEntity.setIndexCode(IndexCodeEnum.DANG_YUAN_XIANG_GUAN.getCode()); totalEntity.setScore(new BigDecimal(NumConstant.ZERO)); totalEntity.setAllParentIndexCode(NumConstant.ZERO_STR); + totalEntity.setWeight(new BigDecimal(NumConstant.ONE_NEG)); if (preLastCpcScoreTotalMap.containsKey(part.getUserId())) { preLastCpcScoreTotalMap.put(part.getUserId(), part); @@ -265,6 +266,8 @@ public class CpcIndexCalculateServiceImpl implements CpcIndexCalculateService { cpcScoreEntity.setScore(new BigDecimal(NumConstant.ZERO)); cpcScoreEntity.setIndexCode(parentIndexCode); cpcScoreEntity.setAllParentIndexCode(value.getAllParentIndexCode()); + BigDecimal weight = indexGroupDetailService.getWeightByAllPathIndexCode(formDTO.getCustomerId(), value.getAllParentIndexCode()); + cpcScoreEntity.setWeight(weight); scoreEntityMap.put(userId, cpcScoreEntity); //构造样本值对象 @@ -311,6 +314,7 @@ public class CpcIndexCalculateServiceImpl implements CpcIndexCalculateService { child.setIndexCode(o.getIndexCode()); child.setAllParentIndexCode(o.getAllParentIndexCode()); child.setScore(o.getScore()); + child.setWeight(o.getWeight()); subList.add(child); }); @@ -403,17 +407,17 @@ public class CpcIndexCalculateServiceImpl implements CpcIndexCalculateService { */ private Map> getIndexDetailMap(CalculateCommonFormDTO formDTO) { //获取指标权重信息 -参与议事 - List canyuyishiIndexDetails = getDetailListByParentCode.getDetailListByParentCode(formDTO.getCustomerId(), IndexCodeEnum.DANG_YUAN_XIANG_GUAN.getCode(), IndexCodeEnum.CAN_YU_YI_SHI.getCode()); + List canyuyishiIndexDetails = indexGroupDetailService.getDetailListByParentCode(formDTO.getCustomerId(), IndexCodeEnum.DANG_YUAN_XIANG_GUAN.getCode(), IndexCodeEnum.CAN_YU_YI_SHI.getCode()); if (CollectionUtils.isEmpty(canyuyishiIndexDetails)) { log.error("cpcIndexCalculate customerId:{} have not any indexGroupDetail", formDTO.getCustomerId()); return null; } - List dangwuhongdongIndexDetails = getDetailListByParentCode.getDetailListByParentCode(formDTO.getCustomerId(), IndexCodeEnum.DANG_YUAN_XIANG_GUAN.getCode(), IndexCodeEnum.DANG_WU_HUO_DONG.getCode()); + List dangwuhongdongIndexDetails = indexGroupDetailService.getDetailListByParentCode(formDTO.getCustomerId(), IndexCodeEnum.DANG_YUAN_XIANG_GUAN.getCode(), IndexCodeEnum.DANG_WU_HUO_DONG.getCode()); if (CollectionUtils.isEmpty(canyuyishiIndexDetails)) { log.error("cpcIndexCalculate customerId:{} have not any indexGroupDetail", formDTO.getCustomerId()); return null; } - List lianxiqunzhongIndexDetails = getDetailListByParentCode.getDetailListByParentCode(formDTO.getCustomerId(), IndexCodeEnum.DANG_YUAN_XIANG_GUAN.getCode(), IndexCodeEnum.LIAN_XI_QUN_ZHONG.getCode()); + List lianxiqunzhongIndexDetails = indexGroupDetailService.getDetailListByParentCode(formDTO.getCustomerId(), IndexCodeEnum.DANG_YUAN_XIANG_GUAN.getCode(), IndexCodeEnum.LIAN_XI_QUN_ZHONG.getCode()); if (CollectionUtils.isEmpty(canyuyishiIndexDetails)) { log.error("cpcIndexCalculate customerId:{} have not any indexGroupDetail", formDTO.getCustomerId()); return null; diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/DeptScoreServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/DeptScoreServiceImpl.java index b133615512..9355c6f79e 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/DeptScoreServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/DeptScoreServiceImpl.java @@ -78,7 +78,7 @@ import java.util.stream.Collectors; @Service public class DeptScoreServiceImpl extends BaseServiceImpl implements DeptScoreService { @Autowired - private IndexGroupDetailService getDetailListByParentCode; + private IndexGroupDetailService indexGroupDetailService; @Autowired private FactIndexGovrnAblityDeptMonthlyDao factIndexGovrnAblityDeptMonthlyDao; @Autowired @@ -117,7 +117,7 @@ public class DeptScoreServiceImpl extends BaseServiceImpl indexGroupDetailEntityList = getDetailListByParentCode.getDetailListByParentCode(formDTO.getCustomerId(), + List indexGroupDetailEntityList = indexGroupDetailService.getDetailListByParentCode(formDTO.getCustomerId(), IndexCodeEnum.QU_ZHI_BU_MEN.getCode(), IndexCodeEnum.ZHI_LI_NENG_LI.getCode()); if (CollectionUtils.isEmpty(indexGroupDetailEntityList)) { @@ -167,7 +167,7 @@ public class DeptScoreServiceImpl extends BaseServiceImpl indexList = getDetailListByParentCode.getDetailListByParentCode(formDTO.getCustomerId(), + List indexList = indexGroupDetailService.getDetailListByParentCode(formDTO.getCustomerId(), IndexCodeEnum.QU_ZHI_BU_MEN.getCode()); if (CollectionUtils.isEmpty(indexList)) { log.error("calculateDeptTotalScore customerId:{} have not any indexGroupDetail", formDTO.getCustomerId()); @@ -189,6 +189,7 @@ public class DeptScoreServiceImpl extends BaseServiceImpl { //遍历所有的指标 indexMap.forEach((key, value) -> { - log.info("index_code :{}",key); +// log.info("index_code :{}",key); if (IndexCodeEnum.ZUZHINEIDANGYDLXQZNLKPFPJZ.getCode().equals(key)) { //组织内党员的联系群众能力考评分(平均值) // log.info("组织内党员的联系群众能力考评分(平均值) 单独处理"); @@ -356,7 +356,7 @@ public class GridCorreLationServiceImpl implements GridCorreLationService { if(StringUtils.isNotBlank(screenCustomerGridDTO.getParentAgencyId())){ gridScoreEntity.setAgencyId(screenCustomerGridDTO.getParentAgencyId()); } - if(StringUtils.isNotBlank(screenCustomerGridDTO.getAllParentIds())){ + if (StringUtils.isNotBlank(screenCustomerGridDTO.getAllParentIds())) { gridScoreEntity.setAllParentIds(screenCustomerGridDTO.getAllParentIds()); } } @@ -366,13 +366,16 @@ public class GridCorreLationServiceImpl implements GridCorreLationService { gridScoreEntity.setScore(calculateResult.getTotalScore()); //新增ALL_PARENT_INDEX_CODE 所有指标code拼接的字符串 冒号隔开 gridScoreEntity.setAllParentIndexCode(IndexCodeEnum.WANG_GE_XIANG_GUAN.getCode()); + BigDecimal weight = indexGroupDetailService.getWeightByAllPathIndexCode(formDTO.getCustomerId(), gridScoreEntity.getAllParentIndexCode().concat(StrConstant.COLON).concat(gridScoreEntity.getIndexCode())); + gridScoreEntity.setWeight(weight); gridScoreEntityList.add(gridScoreEntity); - for(IndexScoreVo detail:calculateResult.getDetails()){ - GridSubScoreEntity gridSubScoreEntity= ConvertUtils.sourceToTarget(gridScoreEntity, GridSubScoreEntity.class); + for (IndexScoreVo detail : calculateResult.getDetails()) { + GridSubScoreEntity gridSubScoreEntity = ConvertUtils.sourceToTarget(gridScoreEntity, GridSubScoreEntity.class); //重新赋值 gridSubScoreEntity.setIndexCode(detail.getIndexCode()); gridSubScoreEntity.setAllParentIndexCode(detail.getAllParentIndexCode()); gridSubScoreEntity.setScore(detail.getScore()); + gridSubScoreEntity.setWeight(detail.getWeight()); gridSubScoreList.add(gridSubScoreEntity); } }); @@ -667,6 +670,7 @@ public class GridCorreLationServiceImpl implements GridCorreLationService { gridScoreEntity.setIndexCode(IndexCodeEnum.WANG_GE_XIANG_GUAN.getCode()); gridScoreEntity.setScore(BigDecimal.ZERO); gridScoreEntity.setAllParentIndexCode(NumConstant.ZERO_STR); + gridScoreEntity.setWeight(new BigDecimal(NumConstant.ONE_NEG)); log.warn("customerId:" + gridScoreDTO.getCustomerId() + ";gridId:" + gridScoreDTO.getGridId() + ";monthId:" + gridScoreDTO.getMonthId() + "能力值缺失"); for (GridScoreDetailDTO gridScoreDetailDTO : gridScoreDTO.getDetailList()) { BigDecimal indexScore = gridScoreDetailDTO.getScore().multiply(indexMap.get(gridScoreDetailDTO.getIndexCode()).getWeight()); diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateCommunityServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateCommunityServiceImpl.java index da6956d167..4821e0ee59 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateCommunityServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateCommunityServiceImpl.java @@ -4,6 +4,7 @@ import com.alibaba.druid.util.StringUtils; import com.alibaba.fastjson.JSON; import com.epmet.commons.dynamic.datasource.annotation.DataSource; import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.constant.StrConstant; import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.utils.DateUtils; import com.epmet.constant.DataSourceConstant; @@ -322,6 +323,7 @@ public class IndexCalculateCommunityServiceImpl implements IndexCalculateCommuni score.setQuarterId(DateUtils.getQuarterId(monthId)); score.setIndexCode(IndexCalConstant.COMMUNITY_RELATE); score.setAllParentIndexCode(NumConstant.ZERO_STR); + score.setWeight(new BigDecimal(NumConstant.ONE_NEG)); value.forEach(community -> { score.setScore(score.getScore().add(community.getScore())); score.setParentAgencyId(community.getParentAgencyId()); @@ -441,6 +443,9 @@ public class IndexCalculateCommunityServiceImpl implements IndexCalculateCommuni score.setIndexCode(indexCode); score.setScore(v.getTotalScore()); score.setAllParentIndexCode(allParentIndexCode); + String allPath = allParentIndexCode.concat(StrConstant.COLON).concat(indexCode); + BigDecimal weight = indexGroupDetailService.getWeightByAllPathIndexCode(customerId, allPath); + score.setWeight(weight); pid.forEach((agency, parentAgency) -> { if (k.equals(agency)) { score.setParentAgencyId(parentAgency); @@ -458,6 +463,7 @@ public class IndexCalculateCommunityServiceImpl implements IndexCalculateCommuni s.setIndexCode(fiveDetail.getIndexCode()); s.setScore(fiveDetail.getScore()); s.setAllParentIndexCode(fiveDetail.getAllParentIndexCode()); + s.setWeight(fiveDetail.getWeight()); pid.forEach((agency, parentAgency) -> { if (k.equals(agency)) { s.setParentAgencyId(parentAgency); diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateDistrictServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateDistrictServiceImpl.java index d11a1e7df2..8ae71e38d1 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateDistrictServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateDistrictServiceImpl.java @@ -4,6 +4,7 @@ import com.alibaba.druid.util.StringUtils; import com.alibaba.fastjson.JSON; import com.epmet.commons.dynamic.datasource.annotation.DataSource; import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.constant.StrConstant; import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.utils.DateUtils; import com.epmet.constant.DataSourceConstant; @@ -321,6 +322,7 @@ public class IndexCalculateDistrictServiceImpl implements IndexCalculateDistrict score.setDataType(IndexCalConstant.DISTRICT_LEVEL); score.setIndexCode(IndexCodeEnum.QUAN_QU_XIANG_GUAN.getCode()); score.setAllParentIndexCode(NumConstant.ZERO_STR); + score.setWeight(new BigDecimal(NumConstant.ONE_NEG)); value.forEach(community -> { score.setScore(score.getScore().add(community.getScore())); score.setParentAgencyId(community.getParentAgencyId()); @@ -415,13 +417,16 @@ public class IndexCalculateDistrictServiceImpl implements IndexCalculateDistrict score.setScore(v.getTotalScore()); score.setAllParentIndexCode(allParentIndexCode); score.setDataType(IndexCalConstant.DISTRICT_LEVEL); + String allPath = allParentIndexCode.concat(StrConstant.COLON).concat(indexCode); + BigDecimal weight = indexGroupDetailService.getWeightByAllPathIndexCode(customerId, allPath); + score.setWeight(weight); pid.forEach((agency, parentAgency) -> { //todo 确认 if (k != null && k.equals(agency)) { score.setParentAgencyId(parentAgency); } }); - if (!CollectionUtils.isEmpty(v.getDetails())){ + if (!CollectionUtils.isEmpty(v.getDetails())) { v.getDetails().forEach(streetScore -> { AgencyScoreDTO s = new AgencyScoreDTO(); s.setCustomerId(customerId); @@ -434,6 +439,7 @@ public class IndexCalculateDistrictServiceImpl implements IndexCalculateDistrict s.setScore(streetScore.getScore()); s.setAllParentIndexCode(streetScore.getAllParentIndexCode()); s.setDataType(IndexCalConstant.DISTRICT_LEVEL); + s.setWeight(streetScore.getWeight()); pid.forEach((agency, parentAgency) -> { //todo 确认 if (k != null && k.equals(agency)) { diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateServiceImpl.java index 48b8b46e31..c4fef95f7b 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateServiceImpl.java @@ -8,7 +8,7 @@ import com.epmet.commons.tools.utils.Result; import com.epmet.constant.DataSourceConstant; import com.epmet.dto.indexcal.CalculateCommonFormDTO; import com.epmet.feign.EpmetCommonServiceOpenFeignClient; -import com.epmet.redis.IndexCodeFieldReRedis; +import com.epmet.redis.IndexCalRedis; import com.epmet.service.evaluationindex.indexcal.*; import com.epmet.service.evaluationindex.indexcoll.FactIndexCollectService; import com.epmet.util.DimIdGenerator; @@ -36,7 +36,7 @@ public class IndexCalculateServiceImpl implements IndexCalculateService { @Autowired private CpcIndexCalculateService cpcIndexCalculateService; @Autowired - private IndexCodeFieldReRedis indexCodeFieldReRedis; + private IndexCalRedis indexCalRedis; @Autowired private IndexCalculateCommunityService indexCalculateCommunityService; @Autowired @@ -70,90 +70,106 @@ public class IndexCalculateServiceImpl implements IndexCalculateService { } Boolean flag = false; for (String customerId : customerIds) { - CalculateCommonFormDTO calculateCommonFormDTO = new CalculateCommonFormDTO(customerId, formDTO.getMonthId()); - long start = System.currentTimeMillis(); + CalculateCommonFormDTO param = new CalculateCommonFormDTO(); + param.setCustomerId(customerId); + param.setMonthId(formDTO.getMonthId()); + flag = calulateCustomerIndexScore(param); + } + return flag; + } catch (Exception e) { + log.error("indexCalculate exception,param:{}", JSON.toJSONString(formDTO)); + } finally { + //清除缓存 + indexCalRedis.deleteIndexCodeFromRedis(); + } + return false; + } + + private Boolean calulateCustomerIndexScore(CalculateCommonFormDTO formDTO) { + try { + String customerId = formDTO.getCustomerId(); + Boolean flag; + long start = System.currentTimeMillis(); + try { + //计算党员相关的 try { - //计算党员相关的 - try { - CalculateCommonFormDTO param = new CalculateCommonFormDTO(customerId, formDTO.getMonthId()); - flag = cpcIndexCalculateService.cpcIndexCalculate(param); - log.info("客户Id:{}【党员相关】计算完毕,总耗时:{}秒,result:{}", customerId, (System.currentTimeMillis() - start) / 1000, flag); - } catch (Exception e) { - log.error("indexCalculate cpcIndexCalculate exception", e); - throw new RenException("indexCalculate cpcIndexCalculate exception", e); - } - //测试用 - //计算网格 - start = System.currentTimeMillis(); - try { - flag = gridCorreLationService.calculateGridCorreLation(calculateCommonFormDTO); - log.info("客户Id:{}【网格相关】计算完毕,总耗时:{}秒,result:{},result:{}", customerId, (System.currentTimeMillis() - start) / 1000, flag); - } catch (Exception e) { - log.error("indexCalculate calculateGridCorreLation exception", e); - throw new RenException("indexCalculate calculateGridCorreLation exception", e); - } - //计算社区 - start = System.currentTimeMillis(); - try { - flag = indexCalculateCommunityService.calCommunityAll(customerId, formDTO.getMonthId()); - log.info("客户Id:{}【社区相关】计算完毕,总耗时:{}秒,result:{},result:{}", customerId, (System.currentTimeMillis() - start) / 1000, flag); - } catch (Exception e) { - log.error("indexCalculate calCommunityAll exception", e); - throw new RenException("indexCalculate calAll exception", e); - } + flag = cpcIndexCalculateService.cpcIndexCalculate(formDTO); + log.info("客户Id:{}【党员相关】计算完毕,总耗时:{}秒,result:{}", customerId, (System.currentTimeMillis() - start) / 1000, flag); + } catch (Exception e) { + log.error("indexCalculate cpcIndexCalculate exception", e); + throw new RenException("indexCalculate cpcIndexCalculate exception", e); + } + //测试用 + + //计算网格 + start = System.currentTimeMillis(); + try { + flag = gridCorreLationService.calculateGridCorreLation(formDTO); + log.info("客户Id:{}【网格相关】计算完毕,总耗时:{}秒,result:{},result:{}", customerId, (System.currentTimeMillis() - start) / 1000, flag); + } catch (Exception e) { + log.error("indexCalculate calculateGridCorreLation exception", e); + throw new RenException("indexCalculate calculateGridCorreLation exception", e); + } + //计算社区 + start = System.currentTimeMillis(); + try { + flag = indexCalculateCommunityService.calCommunityAll(customerId, formDTO.getMonthId()); + log.info("客户Id:{}【社区相关】计算完毕,总耗时:{}秒,result:{},result:{}", customerId, (System.currentTimeMillis() - start) / 1000, flag); + } catch (Exception e) { + log.error("indexCalculate calCommunityAll exception", e); + throw new RenException("indexCalculate calAll exception", e); + } - //计算街道 - start = System.currentTimeMillis(); - try { - flag = indexCalculateStreetService.calStreetAll(customerId, formDTO.getMonthId()); - log.info("客户Id:{}【街道相关】计算完毕,总耗时:{}秒,result:{}", customerId, (System.currentTimeMillis() - start) / 1000, flag); - } catch (Exception e) { - log.error("indexCalculate calStreetAll exception", e); - throw new RenException("indexCalculate calStreetAll exception", e); - } + //计算街道 + start = System.currentTimeMillis(); + try { + flag = indexCalculateStreetService.calStreetAll(customerId, formDTO.getMonthId()); + log.info("客户Id:{}【街道相关】计算完毕,总耗时:{}秒,result:{}", customerId, (System.currentTimeMillis() - start) / 1000, flag); + } catch (Exception e) { + log.error("indexCalculate calStreetAll exception", e); + throw new RenException("indexCalculate calStreetAll exception", e); + } - //计算区直属 - start = System.currentTimeMillis(); - try { - flag = deptScoreService.calculateDeptCorreLation(calculateCommonFormDTO); - log.info("客户Id:{}【区直部门】计算完毕,总耗时:{}秒,result:{}", customerId, (System.currentTimeMillis() - start) / 1000, flag); - } catch (Exception e) { - log.error("indexCalculate calculateDeptCorreLation exception", e); - throw new RenException("indexCalculate calculateDeptCorreLation exception", e); - } + //计算区直属 + start = System.currentTimeMillis(); + try { + flag = deptScoreService.calculateDeptCorreLation(formDTO); + log.info("客户Id:{}【区直部门】计算完毕,总耗时:{}秒,result:{}", customerId, (System.currentTimeMillis() - start) / 1000, flag); + } catch (Exception e) { + log.error("indexCalculate calculateDeptCorreLation exception", e); + throw new RenException("indexCalculate calculateDeptCorreLation exception", e); + } - //计算全区 - start = System.currentTimeMillis(); - try { - indexCalculateDistrictService.calDistrictAll(customerId, formDTO.getMonthId()); - log.info("客户Id:{}【全区相关】计算完毕,总耗时:{}秒,result:{}", customerId, (System.currentTimeMillis() - start) / 1000, flag); - } catch (Exception e) { - log.error("indexCalculate calDistrictAll exception", e); - throw new RenException("indexCalculate calDistrictAll exception", e); - } - } catch (RenException e) { - flag = false; + //计算全区 + start = System.currentTimeMillis(); + try { + indexCalculateDistrictService.calDistrictAll(customerId, formDTO.getMonthId()); + log.info("客户Id:{}【全区相关】计算完毕,总耗时:{}秒,result:{}", customerId, (System.currentTimeMillis() - start) / 1000, flag); + } catch (Exception e) { + log.error("indexCalculate calDistrictAll exception", e); + throw new RenException("indexCalculate calDistrictAll exception", e); } + } catch (RenException e) { + flag = false; + } - //计算完毕后 将结果插入大屏相关数据表 - if (flag) { - start = System.currentTimeMillis(); - try { - factIndexCollectService.insertScreenIndexDataMonthlyAndYearly(formDTO.getMonthId(), formDTO.getCustomerId()); - log.info("客户Id:{}分数插入到大屏显示库完毕,总耗时:{}秒", customerId, (System.currentTimeMillis() - start) / 1000); - } catch (Exception e) { - log.error("indexCalculate insertScreenIndexDataMonthlyAndYearly exception", e); - flag = false; - } + //计算完毕后 将结果插入大屏相关数据表 + if (flag) { + start = System.currentTimeMillis(); + try { + factIndexCollectService.insertScreenIndexDataMonthlyAndYearly(formDTO.getMonthId(), formDTO.getCustomerId()); + log.info("客户Id:{}分数插入到大屏显示库完毕,总耗时:{}秒", customerId, (System.currentTimeMillis() - start) / 1000); + } catch (Exception e) { + log.error("indexCalculate insertScreenIndexDataMonthlyAndYearly exception", e); + flag = false; } } return flag; } catch (Exception e) { - log.error("indexCalculate exception,param:{}", JSON.toJSONString(formDTO)); + log.error("calulateCustomerIndexScore exception", e); } finally { - //清除缓存 - indexCodeFieldReRedis.deleteIndexCodeFromRedis(); + indexCalRedis.deleteIndexCodeWeightFromRedis(formDTO.getCustomerId()); } return false; } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateStreetServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateStreetServiceImpl.java index 1eb6a60a5b..5fb28ac104 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateStreetServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateStreetServiceImpl.java @@ -4,6 +4,7 @@ import com.alibaba.druid.util.StringUtils; import com.alibaba.fastjson.JSON; import com.epmet.commons.dynamic.datasource.annotation.DataSource; import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.constant.StrConstant; import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.utils.DateUtils; import com.epmet.constant.DataSourceConstant; @@ -351,6 +352,7 @@ public class IndexCalculateStreetServiceImpl implements IndexCalculateStreetServ score.setIndexCode(IndexCodeEnum.JIE_DAO_XIANG_GUAN.getCode()); score.setDataType(IndexCalConstant.STREET_LEVEL); score.setAllParentIndexCode(NumConstant.ZERO_STR); + score.setWeight(new BigDecimal(NumConstant.ONE_NEG)); value.forEach(street -> { score.setScore(score.getScore().add(street.getScore())); score.setParentAgencyId(street.getParentAgencyId()); @@ -445,12 +447,15 @@ public class IndexCalculateStreetServiceImpl implements IndexCalculateStreetServ score.setScore(v.getTotalScore()); score.setAllParentIndexCode(allParentIndexCode); score.setDataType(IndexCalConstant.STREET_LEVEL); + String allPath = allParentIndexCode.concat(StrConstant.COLON).concat(indexCode); + BigDecimal weight = indexGroupDetailService.getWeightByAllPathIndexCode(customerId, allPath); + score.setWeight(weight); pid.forEach((agency, parentAgency) -> { if (k.equals(agency)) { score.setParentAgencyId(parentAgency); } }); - if (!CollectionUtils.isEmpty(v.getDetails())){ + if (!CollectionUtils.isEmpty(v.getDetails())) { v.getDetails().forEach(streetScore -> { AgencyScoreDTO s = new AgencyScoreDTO(); s.setCustomerId(customerId); @@ -463,6 +468,7 @@ public class IndexCalculateStreetServiceImpl implements IndexCalculateStreetServ s.setScore(streetScore.getScore()); s.setDataType(IndexCalConstant.STREET_LEVEL); s.setAllParentIndexCode(streetScore.getAllParentIndexCode()); + s.setWeight(streetScore.getWeight()); pid.forEach((agency, parentAgency) -> { if (k.equals(agency)) { s.setParentAgencyId(parentAgency); diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCodeFieldReServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCodeFieldReServiceImpl.java index 3e89bee003..009dc1dc42 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCodeFieldReServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCodeFieldReServiceImpl.java @@ -4,7 +4,7 @@ import com.epmet.commons.dynamic.datasource.annotation.DataSource; import com.epmet.constant.DataSourceConstant; import com.epmet.dao.evaluationindex.screen.IndexCodeFieldReDao; import com.epmet.entity.evaluationindex.screen.IndexCodeFieldReEntity; -import com.epmet.redis.IndexCodeFieldReRedis; +import com.epmet.redis.IndexCalRedis; import com.epmet.service.evaluationindex.indexcal.IndexCodeFieldReService; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; @@ -25,18 +25,18 @@ public class IndexCodeFieldReServiceImpl implements IndexCodeFieldReService { private IndexCodeFieldReDao indexCodeFieldReDao; @Autowired - private IndexCodeFieldReRedis indexCodeFieldReRedis; + private IndexCalRedis indexCalRedis; @Override public Map getIndexCodeFieldReMap() { - Map indexCodeFiledReMap = indexCodeFieldReRedis.getIndexCodeFiledReMap(); + Map indexCodeFiledReMap = indexCalRedis.getIndexCodeFiledReMap(); if (CollectionUtils.isEmpty(indexCodeFiledReMap)) { List allData = indexCodeFieldReDao.getAllData(); if (CollectionUtils.isEmpty(allData)){ return new HashMap<>(); } indexCodeFiledReMap = allData.stream().collect(Collectors.toMap(IndexCodeFieldReEntity::getIndexCode, o -> o.getFieldId())); - indexCodeFieldReRedis.setIndexCodeFiledReMap(indexCodeFiledReMap); + indexCalRedis.setIndexCodeFiledReMap(indexCodeFiledReMap); } return indexCodeFiledReMap; } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/FactIndexCollectServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/FactIndexCollectServiceImpl.java index 1a879bd3a8..ade95f1c5d 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/FactIndexCollectServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/FactIndexCollectServiceImpl.java @@ -276,6 +276,10 @@ public class FactIndexCollectServiceImpl implements FactIndexCollectService { monthlyDTO.setPartyDevAblity(zero); monthlyDTO.setServiceAblity(zero); monthlyDTO.setGovernAblity(zero); + // 9.12 增加权重 + monthlyDTO.setPartyDevWeight(zero); + monthlyDTO.setServiceAblityWeight(zero); + monthlyDTO.setGovernAblityWeight(zero); // 补充表中其他字段 monthlyDTO = this.supplementIndexDataMonthlyTable(monthId, OrgTypeConstant.GRID, gridScoreDTOS.get(i).getGridId(), gridScoreDTOS.get(i).getParentAgencyId(), gridScoreDTOS.get(i).getGridName(), monthlyDTO); @@ -315,6 +319,7 @@ public class FactIndexCollectServiceImpl implements FactIndexCollectService { } else { // 赋实际值 党建能力、治理能力、服务能力 monthlyFormDTO = this.setValueAbilityMonthlyFor(gridScore.getValue().get(i).getIndexCode(), + gridScore.getValue().get(i).getWeight(), gridScore.getValue().get(i).getScore(), monthlyFormDTO); } @@ -397,6 +402,10 @@ public class FactIndexCollectServiceImpl implements FactIndexCollectService { monthlyDTO.setPartyDevAblity(zero); monthlyDTO.setServiceAblity(zero); monthlyDTO.setGovernAblity(zero); + // 9.12 增加权重 + monthlyDTO.setPartyDevWeight(zero); + monthlyDTO.setServiceAblityWeight(zero); + monthlyDTO.setGovernAblityWeight(zero); // 补充表中其他字段 monthlyDTO = this.supplementIndexDataMonthlyTable(monthId, OrgTypeConstant.AGENCY, communityScoreDTOS.get(i).getAgencyId(), communityScoreDTOS.get(i).getPid(), communityScoreDTOS.get(i).getAgencyName(), monthlyDTO); @@ -435,6 +444,7 @@ public class FactIndexCollectServiceImpl implements FactIndexCollectService { } else { // 赋值 党建能力、治理能力、服务能力 monthlyFormDTO = this.setValueAbilityMonthlyFor(communityScore.getValue().get(i).getIndexCode(), + communityScore.getValue().get(i).getWeight(), communityScore.getValue().get(i).getScore(), monthlyFormDTO); } @@ -517,6 +527,10 @@ public class FactIndexCollectServiceImpl implements FactIndexCollectService { monthlyDTO.setPartyDevAblity(zero); monthlyDTO.setServiceAblity(zero); monthlyDTO.setGovernAblity(zero); + // 9.12 增加权重 + monthlyDTO.setPartyDevWeight(zero); + monthlyDTO.setServiceAblityWeight(zero); + monthlyDTO.setGovernAblityWeight(zero); // 补充表中其他字段 monthlyDTO = this.supplementIndexDataMonthlyTable(monthId, OrgTypeConstant.DEPARTMENT, deptScoreDTOS.get(i).getDeptId(), deptScoreDTOS.get(i).getParentAgencyId(), deptScoreDTOS.get(i).getDeptName(), monthlyDTO); @@ -547,8 +561,12 @@ public class FactIndexCollectServiceImpl implements FactIndexCollectService { for ( int i = 0; i < deptScore.getValue().size(); i++){ // 区直街道的总分 就是 治理能力 monthlyFormDTO.setIndexTotal(deptScore.getValue().get(i).getScore()); + // 多余的权重,赋0 + monthlyFormDTO.setPartyDevWeight(new BigDecimal(NumConstant.ZERO)); + monthlyFormDTO.setServiceAblityWeight(new BigDecimal(NumConstant.ZERO)); // 赋值 治理能力 monthlyFormDTO = this.setValueAbilityMonthlyFor(deptScore.getValue().get(i).getIndexCode(), + deptScore.getValue().get(i).getWeight(), deptScore.getValue().get(i).getScore(), monthlyFormDTO); } @@ -633,6 +651,7 @@ public class FactIndexCollectServiceImpl implements FactIndexCollectService { } else { // 赋值 党建能力、治理能力、服务能力 monthlyFormDTO = this.setValueAbilityMonthlyFor(agencyScore.getValue().get(i).getIndexCode(), + agencyScore.getValue().get(i).getWeight(), agencyScore.getValue().get(i).getScore(), monthlyFormDTO); } @@ -686,23 +705,28 @@ public class FactIndexCollectServiceImpl implements FactIndexCollectService { /** * 赋实际值 党建能力、治理能力、服务能力 * @param IndexCode 组织类别 + * @param weight 权重(同一组权重总和=1) * @param Score 分数 * @param monthlyFormDTO 待保存的数据 * @return com.epmet.dto.screencoll.form.IndexDataMonthlyFormDTO * @Author zhangyong * @Date 09:26 2020-09-04 **/ - private IndexDataMonthlyFormDTO setValueAbilityMonthlyFor(String IndexCode, BigDecimal Score, IndexDataMonthlyFormDTO monthlyFormDTO){ + private IndexDataMonthlyFormDTO setValueAbilityMonthlyFor(String IndexCode, BigDecimal weight, BigDecimal Score, IndexDataMonthlyFormDTO monthlyFormDTO){ // 赋实际值 if (IndexCodeEnum.DANG_JIAN_NENG_LI.getCode().equals(IndexCode)){ // 党建能力 monthlyFormDTO.setPartyDevAblity(Score); + // 9.12 增加权重 + monthlyFormDTO.setPartyDevWeight(weight); } else if (IndexCodeEnum.ZHI_LI_NENG_LI.getCode().equals(IndexCode)){ // 治理能力 monthlyFormDTO.setGovernAblity(Score); + monthlyFormDTO.setGovernAblityWeight(weight); } else if (IndexCodeEnum.FU_WU_NENG_LI.getCode().equals(IndexCode)){ // 服务能力 monthlyFormDTO.setServiceAblity(Score); + monthlyFormDTO.setServiceAblityWeight(weight); } return monthlyFormDTO; } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/IndexGroupDetailService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/IndexGroupDetailService.java index f202beca1b..eb77f2cf63 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/IndexGroupDetailService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/IndexGroupDetailService.java @@ -20,6 +20,7 @@ package com.epmet.service.evaluationindex.screen; import com.epmet.commons.mybatis.service.BaseService; import com.epmet.entity.evaluationindex.screen.IndexGroupDetailEntity; +import java.math.BigDecimal; import java.util.List; /** @@ -31,8 +32,18 @@ import java.util.List; public interface IndexGroupDetailService extends BaseService { /** * desc:根据all_parent_index_code 获取指标明细 + * * @param customerId * @param indexCode */ - List getDetailListByParentCode(String customerId,String... indexCode); + List getDetailListByParentCode(String customerId, String... indexCode); + + /** + * desc:根据all_parent_index_code 获取指标权重 + * 如果获取不到 返回-1 表明数据有误 + * + * @param customerId + * @param allPathIndexCode + */ + BigDecimal getWeightByAllPathIndexCode(String customerId, String allPathIndexCode); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/IndexGroupDetailServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/IndexGroupDetailServiceImpl.java index 7a8935bd02..26fb5b8cc2 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/IndexGroupDetailServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/IndexGroupDetailServiceImpl.java @@ -19,15 +19,23 @@ package com.epmet.service.evaluationindex.screen.impl; import com.epmet.commons.dynamic.datasource.annotation.DataSource; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.constant.StrConstant; import com.epmet.commons.tools.exception.RenException; import com.epmet.constant.DataSourceConstant; import com.epmet.dao.evaluationindex.screen.IndexGroupDetailDao; import com.epmet.entity.evaluationindex.screen.IndexGroupDetailEntity; +import com.epmet.redis.IndexCalRedis; import com.epmet.service.evaluationindex.screen.IndexGroupDetailService; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; 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.stream.Collectors; /** * 客户指标详情 @@ -35,20 +43,40 @@ import java.util.List; * @author generator generator@elink-cn.com * @since v1.0.0 2020-08-19 */ +@Slf4j @Service @DataSource(DataSourceConstant.EVALUATION_INDEX) public class IndexGroupDetailServiceImpl extends BaseServiceImpl implements IndexGroupDetailService { - + @Autowired + private IndexCalRedis indexCalRedis; @Override - public List getDetailListByParentCode(String customerId,String... indexCode) { - if (indexCode == null || indexCode.length == 0){ + public List getDetailListByParentCode(String customerId, String... indexCode) { + if (indexCode == null || indexCode.length == 0) { throw new RenException("参数错误"); } StringBuilder sb = new StringBuilder(); - for (String code:indexCode){ + for (String code : indexCode) { sb.append(code).append(StrConstant.COLON); } - return baseDao.getDetailListByParentCode(customerId,sb.deleteCharAt(sb.length()-1).toString()); + return baseDao.getDetailListByParentCode(customerId, sb.deleteCharAt(sb.length() - 1).toString()); } + + @Override + public BigDecimal getWeightByAllPathIndexCode(String customerId, String allPathIndexCode) { + Map indexCodeFiledReMap = indexCalRedis.getIndexCodeWeightMap(customerId); + if (CollectionUtils.isEmpty(indexCodeFiledReMap)) { + List allData = baseDao.getAllIndexWeightList(customerId); + if (CollectionUtils.isEmpty(allData)) { + log.warn("getAllIndexWeightList return empty"); + return null; + } + indexCodeFiledReMap = allData.stream().collect(Collectors.toMap(IndexGroupDetailEntity::getIndexCode, o -> o.getWeight())); + indexCalRedis.setIndexCodeWeightMap(customerId, indexCodeFiledReMap); + } + BigDecimal weight = indexCodeFiledReMap.get(allPathIndexCode); + + return weight == null ? new BigDecimal(NumConstant.ONE_NEG) : weight; + } + } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/support/normalizing/batch/BatchScoreCalculator.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/support/normalizing/batch/BatchScoreCalculator.java index 1ca86d8faf..c171f62300 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/support/normalizing/batch/BatchScoreCalculator.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/support/normalizing/batch/BatchScoreCalculator.java @@ -67,7 +67,7 @@ public class BatchScoreCalculator { result.setDetails(new ArrayList<>()); scoreCountOfSamples.put(sampleId, result); } - IndexScoreVo sampleScore = new IndexScoreVo(idx.getIndexId(), idx.getAllParentIndexCode(), score); + IndexScoreVo sampleScore = new IndexScoreVo(idx.getIndexId(), idx.getAllParentIndexCode(), score, idx.getWeight()); result.getDetails().add(sampleScore); result.setTotalScore(result.getTotalScore().add(score).setScale(6, RoundingMode.HALF_UP)); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/support/normalizing/batch/IndexScoreVo.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/support/normalizing/batch/IndexScoreVo.java index 3b108999a1..dd971eadc3 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/support/normalizing/batch/IndexScoreVo.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/support/normalizing/batch/IndexScoreVo.java @@ -26,6 +26,10 @@ public class IndexScoreVo implements Serializable { * 分值 */ private BigDecimal score; + /** + * 该指标的权重 + */ + private BigDecimal weight; } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/AgencyScoreDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/AgencyScoreDao.xml index a0c7f2cdae..65922677e5 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/AgencyScoreDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/AgencyScoreDao.xml @@ -5,7 +5,8 @@ - INSERT INTO fact_index_agency_score (ID, CUSTOMER_ID, AGENCY_ID, PARENT_AGENCY_ID, YEAR_ID, QUARTER_ID, MONTH_ID, DATA_TYPE, IS_TOTAL, SCORE, INDEX_CODE,ALL_PARENT_INDEX_CODE, DEL_FLAG, REVISION, CREATED_BY, CREATED_TIME, UPDATED_BY, UPDATED_TIME ) + INSERT INTO fact_index_agency_score (ID, CUSTOMER_ID, AGENCY_ID, PARENT_AGENCY_ID, YEAR_ID, QUARTER_ID, MONTH_ID, DATA_TYPE, IS_TOTAL, SCORE, INDEX_CODE,ALL_PARENT_INDEX_CODE, + WEIGHT,DEL_FLAG, REVISION, CREATED_BY, CREATED_TIME, UPDATED_BY, UPDATED_TIME ) VALUES ( @@ -21,6 +22,7 @@ #{item.score}, #{item.indexCode}, #{item.allParentIndexCode}, + #{item.weight}, #{item.delFlag}, #{item.revision}, #{item.createdBy}, @@ -53,7 +55,8 @@ MONTH_ID monthId, IS_TOTAL isTotal, SCORE score, - INDEX_CODE indexCode + INDEX_CODE indexCode, + WEIGHT weight FROM fact_index_agency_score WHERE @@ -107,52 +110,6 @@ GROUP BY fics.parent_agency_id - - insert into fact_index_agency_score - ( - ID, - CUSTOMER_ID, - - AGENCY_ID, - PARENT_AGENCY_ID, - YEAR_ID, - QUARTER_ID, - MONTH_ID, - DATA_TYPE, - IS_TOTAL, - SCORE, - INDEX_CODE, - - DEL_FLAG, - REVISION, - CREATED_BY, - CREATED_TIME, - UPDATED_BY, - UPDATED_TIME - ) values - - ( - (SELECT REPLACE(UUID(), '-', '') AS id), - #{customerId}, - #{item.agencyId}, - #{item.parentAgencyId}, - - #{item.yearId}, - #{item.quarterId}, - #{item.monthId}, - #{item.dataType}, - #{item.isTotal}, - #{item.score}, - #{item.indexCode}, - 0, - 0, - 'APP_USER', - now(), - 'APP_USER', - now() - ) - - - - insert into fact_index_community_score - ( - ID, - CUSTOMER_ID, - AGENCY_ID, - PARENT_AGENCY_ID, - YEAR_ID, - QUARTER_ID, - MONTH_ID, - IS_TOTAL, - SCORE, - INDEX_CODE, - DEL_FLAG, - REVISION, - CREATED_BY, - CREATED_TIME, - UPDATED_BY, - UPDATED_TIME - ) values - - ( - (SELECT REPLACE(UUID(), '-', '') AS id), - #{customerId}, - #{item.agencyId}, - #{item.parentAgencyId}, - #{item.yearId}, - #{item.quarterId}, - - #{item.monthId}, - #{item.isTotal}, - #{item.score}, - #{item.indexCode}, - 0, - 0, - 'APP_USER', - now(), - 'APP_USER', - now() - ) - - - \ No newline at end of file + diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/GridSubScoreDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/GridSubScoreDao.xml index 7111976b9d..536f834564 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/GridSubScoreDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/GridSubScoreDao.xml @@ -17,6 +17,7 @@ `SCORE`, `INDEX_CODE`, ALL_PARENT_INDEX_CODE, + WEIGHT, `DEL_FLAG`, `REVISION`, `CREATED_BY`, @@ -38,6 +39,7 @@ #{item.score}, #{item.indexCode}, #{item.allParentIndexCode}, + #{item.weight}, 0, 0, 'APP_USER', diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/IndexGroupDetailDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/IndexGroupDetailDao.xml index c2ab3e07c6..76bec7b257 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/IndexGroupDetailDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/IndexGroupDetailDao.xml @@ -12,4 +12,10 @@ CUSTOMER_ID = #{customerId,jdbcType=VARCHAR} and STATUS = 'enable' and DEL_FLAG = '0' and ALL_PARENT_INDEX_CODE = #{indexCode,jdbcType=VARCHAR} + + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenIndexDataMonthlyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenIndexDataMonthlyDao.xml index 417ac18c3f..b699ec7d6b 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenIndexDataMonthlyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenIndexDataMonthlyDao.xml @@ -24,6 +24,9 @@ PARTY_DEV_ABLITY, SERVICE_ABLITY, GOVERN_ABLITY, + PARTY_DEV_WEIGHT, + SERVICE_ABLITY_WEIGHT, + GOVERN_ABLITY_WEIGHT, DEL_FLAG, REVISION, CREATED_BY, @@ -46,6 +49,9 @@ #{item.partyDevAblity}, #{item.serviceAblity}, #{item.governAblity}, + #{item.partyDevWeight}, + #{item.serviceAblityWeight}, + #{item.governAblityWeight}, 0, 0, 'APP_USER', diff --git a/epmet-module/data-statistical/data-statistical-server/src/test/java/com/epmet/stats/test/normalizing/DemoScoreCal.java b/epmet-module/data-statistical/data-statistical-server/src/test/java/com/epmet/stats/test/normalizing/DemoScoreCal.java index 57969c12e0..15e029b3e6 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/test/java/com/epmet/stats/test/normalizing/DemoScoreCal.java +++ b/epmet-module/data-statistical/data-statistical-server/src/test/java/com/epmet/stats/test/normalizing/DemoScoreCal.java @@ -1,5 +1,6 @@ package com.epmet.stats.test.normalizing; +import com.alibaba.fastjson.JSON; import com.epmet.support.normalizing.*; import com.epmet.support.normalizing.batch.*; import org.junit.Test; @@ -233,6 +234,7 @@ public class DemoScoreCal { List indexInputVOS = Arrays.asList(index1VO, index2VO, index3VO, index4VO); BatchScoreCalculator batchScoreCalculator = new BatchScoreCalculator(); + System.out.println("param:" + JSON.toJSONString(indexInputVOS)); HashMap result = batchScoreCalculator.getScoreCountOfSampleId(indexInputVOS); HashMap result2 = batchScoreCalculator.getScoreTotalOfSampleId(indexInputVOS);