Browse Source

Merge branch 'dev_screen_data' of http://git.elinkit.com.cn:7070/r/epmet-cloud into dev_screen_data

 Conflicts:
	epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java
dev
wxz 5 years ago
parent
commit
b4254b09f9
  1. 13
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java
  2. 6
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/GrassrootsPartyDevServiceImpl.java
  3. 2
      epmet-module/data-report/data-report-server/src/main/resources/logback-spring.xml
  4. 9
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcal/AgencyScoreDTO.java
  5. 6
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcal/DeptScoreDTO.java
  6. 13
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/FactIndexCommunityScoreDTO.java
  7. 4
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/FactIndexGridScoreDTO.java
  8. 19
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/form/IndexDataMonthlyFormDTO.java
  9. 4
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/form/KcCategorySummaryFormDTO.java
  10. 2
      epmet-module/data-statistical/data-statistical-server/pom.xml
  11. 4
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java
  12. 11
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/AgencyScoreDao.java
  13. 13
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/CommunityScoreDao.java
  14. 5
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/CommunitySubScoreDao.java
  15. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/IndexGroupDetailDao.java
  16. 4
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/indexcal/AgencyScoreEntity.java
  17. 4
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/indexcal/AgencySubScoreEntity.java
  18. 5
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/indexcal/CpcScoreEntity.java
  19. 5
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/indexcal/CpcSubScoreEntity.java
  20. 4
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/indexcal/DeptScoreEntity.java
  21. 4
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/indexcal/DeptSubScoreEntity.java
  22. 7
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/indexcal/FactIndexCommunityScoreEntity.java
  23. 70
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/indexcal/FactIndexCommunitySubScoreEntity.java
  24. 4
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/indexcal/GridScoreEntity.java
  25. 4
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/indexcal/GridSubScoreEntity.java
  26. 75
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/FactIndexCommunityFiveScoreEntity.java
  27. 17
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenIndexDataMonthlyEntity.java
  28. 4
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenKcProjectCategoryGridDailyEntity.java
  29. 31
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/redis/IndexCalRedis.java
  30. 14
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/CpcIndexCalculateServiceImpl.java
  31. 15
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/DeptScoreServiceImpl.java
  32. 10
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/GridCorreLationServiceImpl.java
  33. 66
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateCommunityServiceImpl.java
  34. 13
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateDistrictServiceImpl.java
  35. 164
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateServiceImpl.java
  36. 14
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateStreetServiceImpl.java
  37. 8
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCodeFieldReServiceImpl.java
  38. 26
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/FactIndexCollectServiceImpl.java
  39. 13
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/IndexGroupDetailService.java
  40. 38
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/IndexGroupDetailServiceImpl.java
  41. 8
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/support/normalizing/batch/BatchScoreCalculator.java
  42. 4
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/support/normalizing/batch/IndexScoreVo.java
  43. 53
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/AgencyScoreDao.xml
  44. 4
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/AgencySubScoreDao.xml
  45. 49
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/CommunityScoreDao.xml
  46. 4
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/CommunitySubScoreDao.xml
  47. 2
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/CpcScoreDao.xml
  48. 2
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/CpcSubScoreDao.xml
  49. 5
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/DeptScoreDao.xml
  50. 2
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/DeptSubScoreDao.xml
  51. 7
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/GridScoreDao.xml
  52. 2
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/GridSubScoreDao.xml
  53. 6
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/IndexGroupDetailDao.xml
  54. 6
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenIndexDataMonthlyDao.xml
  55. 2
      epmet-module/data-statistical/data-statistical-server/src/test/java/com/epmet/stats/test/normalizing/DemoScoreCal.java
  56. 8
      epmet-user/epmet-user-server/src/main/resources/mapper/GovStaffRoleDao.xml

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

@ -295,21 +295,32 @@ public class RedisKeys {
* @return * @return
*/ */
public static String getExternalAppSecretKey(String appId) { 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 * 计算指标时获取指标code和fields关系缓存Key
*
* @return * @return
*/ */
public static String getIndexCodeFieldReKey() { public static String getIndexCodeFieldReKey() {
return rootPrefix.concat("stats:indexcal:indexcode:field"); 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:未在计算 * 0:未在计算
* 1:正在计算 * 1:正在计算
*
* @param customerId * @param customerId
* @return * @return
*/ */

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

@ -86,7 +86,11 @@ public class GrassrootsPartyDevServiceImpl implements GrassrootsPartyDevService
@DataSource(value = DataSourceConstant.EVALUATION_INDEX,datasourceNameFromArg = true) @DataSource(value = DataSourceConstant.EVALUATION_INDEX,datasourceNameFromArg = true)
@Override @Override
public PartymemberAgeDistributionResultDTO partymemberAgeDistribution(ParymemberFormDTO param) { public PartymemberAgeDistributionResultDTO partymemberAgeDistribution(ParymemberFormDTO param) {
return screenCpcBaseDataDao.selectPartymemberAgeDistribution(param.getAgencyId()); PartymemberAgeDistributionResultDTO ageInfo = screenCpcBaseDataDao.selectPartymemberAgeDistribution(param.getAgencyId());
if(null == ageInfo){
ageInfo = new PartymemberAgeDistributionResultDTO();
}
return ageInfo;
} }
/** /**

2
epmet-module/data-report/data-report-server/src/main/resources/logback-spring.xml

@ -139,7 +139,7 @@
</appender> </appender>
<!-- 开发、测试环境 --> <!-- 开发、测试环境 -->
<springProfile name="dev,test"> <springProfile name="dev,test,local">
<logger name="org.springframework.web" level="INFO"/> <logger name="org.springframework.web" level="INFO"/>
<logger name="org.springboot.sample" level="INFO"/> <logger name="org.springboot.sample" level="INFO"/>
<logger name="com.epmet.datareport.dao.group" level="DEBUG"/> <logger name="com.epmet.datareport.dao.group" level="DEBUG"/>

9
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() { public AgencyScoreDTO() {
this.isTotal = NumConstant.ZERO_STR; this.isTotal = NumConstant.ZERO_STR;

6
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; private Date updatedTime;
} /**
* 权重同一组权重总和=1 9.12新增
*/
private BigDecimal weight;
}

13
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; package com.epmet.dto.screen;
import java.io.Serializable;
import java.util.Date;
import lombok.Data; import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal; 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() { public FactIndexCommunityScoreDTO() {
this.customerId = ""; this.customerId = "";

4
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; private Date updatedTime;
/**
* 权重同一组权重总和=1 9.12新增
*/
private BigDecimal weight;
} }

19
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; package com.epmet.dto.screencoll.form;
import com.epmet.commons.tools.constant.NumConstant;
import lombok.Data; import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
@ -64,4 +65,22 @@ public class IndexDataMonthlyFormDTO implements Serializable {
* 治理能力指数 * 治理能力指数
*/ */
private BigDecimal governAblity; 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);
} }

4
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; private String allParentIds;
/** /**
* 类别id * 一级类别id
*/ */
private String categoryId; private String categoryId;
/** /**
* 分类名称 * 一级分类名称
*/ */
private String categoryName; private String categoryName;

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

@ -226,7 +226,7 @@
<activeByDefault>true</activeByDefault> <activeByDefault>true</activeByDefault>
</activation> </activation>
<properties> <properties>
<server.port>8109</server.port> <server.port>8108</server.port>
<spring.profiles.active>local</spring.profiles.active> <spring.profiles.active>local</spring.profiles.active>
<!-- 数据库配置--> <!-- 数据库配置-->

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

@ -168,9 +168,9 @@ public class DemoController {
// List<GridScoreDTO> gridScoreDTOList=gridScoreDao.selectList(formDTO); // List<GridScoreDTO> gridScoreDTOList=gridScoreDao.selectList(formDTO);
// return new Result<List<GridScoreDTO>>().ok(gridScoreDTOList); // return new Result<List<GridScoreDTO>>().ok(gridScoreDTOList);
cpcIndexCalculateService.cpcIndexCalculate(formDTO); // cpcIndexCalculateService.cpcIndexCalculate(formDTO);
gridCorreLationService.calculateGridCorreLation(formDTO); gridCorreLationService.calculateGridCorreLation(formDTO);
deptScoreService.calculateDeptCorreLation(formDTO); // deptScoreService.calculateDeptCorreLation(formDTO);
return new Result(); return new Result();
} }
@DataSource(DataSourceConstant.EVALUATION_INDEX) @DataSource(DataSourceConstant.EVALUATION_INDEX)

11
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<AgencyScoreEntity> {
**/ **/
List<AgencyScoreDTO> selectListAgencyScore(@Param("customerId")String customerId, @Param("monthId")String monthId); List<AgencyScoreDTO> 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<AgencyScoreEntity> list, @Param("customerId")String customerId);
/** /**
* 根据入参查询 /街道相关分数表id * 根据入参查询 /街道相关分数表id
* @param customerId * @param customerId

13
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.commons.mybatis.dao.BaseDao;
import com.epmet.dto.indexcal.SubCommunityAvgResultDTO; import com.epmet.dto.indexcal.SubCommunityAvgResultDTO;
import com.epmet.dto.screen.FactIndexCommunityScoreDTO; 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.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
@ -79,17 +79,6 @@ public interface CommunityScoreDao extends BaseDao<FactIndexCommunityScoreEntity
*/ */
List<SubCommunityAvgResultDTO> selectSubCommAvgScore(@Param("customerId")String customerId, @Param("monthId")String monthId, @Param("indexCode")String indexCode); List<SubCommunityAvgResultDTO> 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<FactIndexCommunityScoreEntity> list, @Param("customerId")String customerId);
/** /**
* 根据入参查询 查询社区id * 根据入参查询 查询社区id
* @param customerId * @param customerId

5
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; package com.epmet.dao.evaluationindex.indexcal;
import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.indexcal.SubCommunityAvgResultDTO;
import com.epmet.dto.screen.FactIndexCommunityScoreDTO; 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.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
@ -33,7 +32,7 @@ import java.util.List;
* @since v1.0.0 2020-08-31 * @since v1.0.0 2020-08-31
*/ */
@Mapper @Mapper
public interface CommunitySubScoreDao extends BaseDao<FactIndexCommunityScoreEntity> { public interface CommunitySubScoreDao extends BaseDao<FactIndexCommunitySubScoreEntity> {
/** /**
* @param lists * @param lists

2
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<IndexGroupDetailEntity> { public interface IndexGroupDetailDao extends BaseDao<IndexGroupDetailEntity> {
List<IndexGroupDetailEntity> getDetailListByParentCode(@Param("customerId") String customerId, @Param("indexCode") String indexCode); List<IndexGroupDetailEntity> getDetailListByParentCode(@Param("customerId") String customerId, @Param("indexCode") String indexCode);
List<IndexGroupDetailEntity> getAllIndexWeightList(String customerId);
} }

4
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; private String dataType;
/**
* 权重同一组权重总和=1
*/
private BigDecimal weight;
} }

4
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; private String dataType;
/**
* 权重同一组权重总和=1
*/
private BigDecimal weight;
} }

5
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不是 * 是否是总分 1是0不是
*/ */
private String isTotal; private String isTotal;
/**
* 权重同一组权重总和=1
*/
private BigDecimal weight;
} }

5
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不是 * 是否是总分 1是0不是
*/ */
private String isTotal; private String isTotal;
/**
* 权重同一组权重总和=1
*/
private BigDecimal weight;
} }

4
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; private String allParentIndexCode;
/**
* 权重同一组权重总和=1
*/
private BigDecimal weight;
} }

4
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; private String allParentIndexCode;
/**
* 权重同一组权重总和=1
*/
private BigDecimal weight;
} }

7
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/FactIndexCommunityScoreEntity.java → 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 <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.epmet.entity.evaluationindex.screen; package com.epmet.entity.evaluationindex.indexcal;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.epmet.commons.mybatis.entity.BaseEpmetEntity; import com.epmet.commons.mybatis.entity.BaseEpmetEntity;
@ -87,4 +87,9 @@ public class FactIndexCommunityScoreEntity extends BaseEpmetEntity {
*/ */
private String allParentIndexCode; private String allParentIndexCode;
/**
* 权重同一组权重总和=1
*/
private BigDecimal weight;
} }

70
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: yyyyQ1yyyyQ2yyyyQ3yyyyQ4
*/
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;
}

4
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; private String allParentIndexCode;
/**
* 权重同一组权重总和=1
*/
private BigDecimal weight;
} }

4
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; private String allParentIndexCode;
/**
* 权重同一组权重总和=1
*/
private BigDecimal weight;
} }

75
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/FactIndexCommunityFiveScoreEntity.java

@ -1,75 +0,0 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.entity.evaluationindex.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;
}

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

4
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; private String allParentIds;
/** /**
* 类别id * 一级类别id
*/ */
private String categoryId; private String categoryId;
/** /**
* 分类名称 * 一级分类名称
*/ */
private String categoryName; private String categoryName;

31
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/redis/IndexCodeFieldReRedis.java → 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.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.math.BigDecimal;
import java.util.Map; import java.util.Map;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
@Slf4j @Slf4j
@Component @Component
public class IndexCodeFieldReRedis { public class IndexCalRedis {
@Autowired @Autowired
private RedisTemplate redisTemplate; private RedisTemplate redisTemplate;
@ -54,9 +55,37 @@ public class IndexCodeFieldReRedis {
/** /**
* desc:删除指标字段关系缓存 * desc:删除指标字段关系缓存
*
* @return * @return
*/ */
public Boolean deleteIndexCodeFromRedis() { public Boolean deleteIndexCodeFromRedis() {
return redisTemplate.delete(RedisKeys.getIndexCodeFieldReKey()); return redisTemplate.delete(RedisKeys.getIndexCodeFieldReKey());
} }
/**
* @Description 获取指标权重
*/
public Map<String, BigDecimal> getIndexCodeWeightMap(String customerId) {
HashOperations hashOperations = redisTemplate.opsForHash();
Map<String, BigDecimal> values = hashOperations.entries(RedisKeys.getIndexCodeWeightKey(customerId));
return values;
}
/**
* @Description 存入指标权重
*/
public void setIndexCodeWeightMap(String customerId, Map<String, BigDecimal> 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));
}
} }

14
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 @Autowired
private FactIndexPartyAblityCpcMonthlyDao factIndexPartyAblityCpcMonthlyDao; private FactIndexPartyAblityCpcMonthlyDao factIndexPartyAblityCpcMonthlyDao;
@Autowired @Autowired
private IndexGroupDetailService getDetailListByParentCode; private IndexGroupDetailService indexGroupDetailService;
@Autowired @Autowired
private IndexCodeFieldReService indexCodeFieldReService; private IndexCodeFieldReService indexCodeFieldReService;
@Autowired @Autowired
@ -72,7 +72,7 @@ public class CpcIndexCalculateServiceImpl implements CpcIndexCalculateService {
*/ */
private void calculateTotalScore(CalculateCommonFormDTO formDTO) { private void calculateTotalScore(CalculateCommonFormDTO formDTO) {
//获取指标权重 //获取指标权重
List<IndexGroupDetailEntity> parentIndexDetails = getDetailListByParentCode.getDetailListByParentCode(formDTO.getCustomerId(), IndexCodeEnum.DANG_YUAN_XIANG_GUAN.getCode()); List<IndexGroupDetailEntity> parentIndexDetails = indexGroupDetailService.getDetailListByParentCode(formDTO.getCustomerId(), IndexCodeEnum.DANG_YUAN_XIANG_GUAN.getCode());
if (CollectionUtils.isEmpty(parentIndexDetails)) { if (CollectionUtils.isEmpty(parentIndexDetails)) {
log.warn("cpcIndexCalculate customerId:{} have not any indexGroupDetail", formDTO.getCustomerId()); log.warn("cpcIndexCalculate customerId:{} have not any indexGroupDetail", formDTO.getCustomerId());
throw new RenException("客户【党员相关】指标权重信息不存在"); throw new RenException("客户【党员相关】指标权重信息不存在");
@ -113,6 +113,7 @@ public class CpcIndexCalculateServiceImpl implements CpcIndexCalculateService {
totalEntity.setIndexCode(IndexCodeEnum.DANG_YUAN_XIANG_GUAN.getCode()); totalEntity.setIndexCode(IndexCodeEnum.DANG_YUAN_XIANG_GUAN.getCode());
totalEntity.setScore(new BigDecimal(NumConstant.ZERO)); totalEntity.setScore(new BigDecimal(NumConstant.ZERO));
totalEntity.setAllParentIndexCode(NumConstant.ZERO_STR); totalEntity.setAllParentIndexCode(NumConstant.ZERO_STR);
totalEntity.setWeight(new BigDecimal(NumConstant.ONE_NEG));
if (preLastCpcScoreTotalMap.containsKey(part.getUserId())) { if (preLastCpcScoreTotalMap.containsKey(part.getUserId())) {
preLastCpcScoreTotalMap.put(part.getUserId(), part); preLastCpcScoreTotalMap.put(part.getUserId(), part);
@ -265,6 +266,8 @@ public class CpcIndexCalculateServiceImpl implements CpcIndexCalculateService {
cpcScoreEntity.setScore(new BigDecimal(NumConstant.ZERO)); cpcScoreEntity.setScore(new BigDecimal(NumConstant.ZERO));
cpcScoreEntity.setIndexCode(parentIndexCode); cpcScoreEntity.setIndexCode(parentIndexCode);
cpcScoreEntity.setAllParentIndexCode(value.getAllParentIndexCode()); cpcScoreEntity.setAllParentIndexCode(value.getAllParentIndexCode());
BigDecimal weight = indexGroupDetailService.getWeightByAllPathIndexCode(formDTO.getCustomerId(), value.getAllParentIndexCode());
cpcScoreEntity.setWeight(weight);
scoreEntityMap.put(userId, cpcScoreEntity); scoreEntityMap.put(userId, cpcScoreEntity);
//构造样本值对象 //构造样本值对象
@ -311,6 +314,7 @@ public class CpcIndexCalculateServiceImpl implements CpcIndexCalculateService {
child.setIndexCode(o.getIndexCode()); child.setIndexCode(o.getIndexCode());
child.setAllParentIndexCode(o.getAllParentIndexCode()); child.setAllParentIndexCode(o.getAllParentIndexCode());
child.setScore(o.getScore()); child.setScore(o.getScore());
child.setWeight(o.getWeight());
subList.add(child); subList.add(child);
}); });
@ -403,17 +407,17 @@ public class CpcIndexCalculateServiceImpl implements CpcIndexCalculateService {
*/ */
private Map<String, List<IndexGroupDetailEntity>> getIndexDetailMap(CalculateCommonFormDTO formDTO) { private Map<String, List<IndexGroupDetailEntity>> getIndexDetailMap(CalculateCommonFormDTO formDTO) {
//获取指标权重信息 -参与议事 //获取指标权重信息 -参与议事
List<IndexGroupDetailEntity> canyuyishiIndexDetails = getDetailListByParentCode.getDetailListByParentCode(formDTO.getCustomerId(), IndexCodeEnum.DANG_YUAN_XIANG_GUAN.getCode(), IndexCodeEnum.CAN_YU_YI_SHI.getCode()); List<IndexGroupDetailEntity> canyuyishiIndexDetails = indexGroupDetailService.getDetailListByParentCode(formDTO.getCustomerId(), IndexCodeEnum.DANG_YUAN_XIANG_GUAN.getCode(), IndexCodeEnum.CAN_YU_YI_SHI.getCode());
if (CollectionUtils.isEmpty(canyuyishiIndexDetails)) { if (CollectionUtils.isEmpty(canyuyishiIndexDetails)) {
log.error("cpcIndexCalculate customerId:{} have not any indexGroupDetail", formDTO.getCustomerId()); log.error("cpcIndexCalculate customerId:{} have not any indexGroupDetail", formDTO.getCustomerId());
return null; return null;
} }
List<IndexGroupDetailEntity> dangwuhongdongIndexDetails = getDetailListByParentCode.getDetailListByParentCode(formDTO.getCustomerId(), IndexCodeEnum.DANG_YUAN_XIANG_GUAN.getCode(), IndexCodeEnum.DANG_WU_HUO_DONG.getCode()); List<IndexGroupDetailEntity> dangwuhongdongIndexDetails = indexGroupDetailService.getDetailListByParentCode(formDTO.getCustomerId(), IndexCodeEnum.DANG_YUAN_XIANG_GUAN.getCode(), IndexCodeEnum.DANG_WU_HUO_DONG.getCode());
if (CollectionUtils.isEmpty(canyuyishiIndexDetails)) { if (CollectionUtils.isEmpty(canyuyishiIndexDetails)) {
log.error("cpcIndexCalculate customerId:{} have not any indexGroupDetail", formDTO.getCustomerId()); log.error("cpcIndexCalculate customerId:{} have not any indexGroupDetail", formDTO.getCustomerId());
return null; return null;
} }
List<IndexGroupDetailEntity> lianxiqunzhongIndexDetails = getDetailListByParentCode.getDetailListByParentCode(formDTO.getCustomerId(), IndexCodeEnum.DANG_YUAN_XIANG_GUAN.getCode(), IndexCodeEnum.LIAN_XI_QUN_ZHONG.getCode()); List<IndexGroupDetailEntity> lianxiqunzhongIndexDetails = indexGroupDetailService.getDetailListByParentCode(formDTO.getCustomerId(), IndexCodeEnum.DANG_YUAN_XIANG_GUAN.getCode(), IndexCodeEnum.LIAN_XI_QUN_ZHONG.getCode());
if (CollectionUtils.isEmpty(canyuyishiIndexDetails)) { if (CollectionUtils.isEmpty(canyuyishiIndexDetails)) {
log.error("cpcIndexCalculate customerId:{} have not any indexGroupDetail", formDTO.getCustomerId()); log.error("cpcIndexCalculate customerId:{} have not any indexGroupDetail", formDTO.getCustomerId());
return null; return null;

15
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 @Service
public class DeptScoreServiceImpl extends BaseServiceImpl<DeptScoreDao, DeptScoreEntity> implements DeptScoreService { public class DeptScoreServiceImpl extends BaseServiceImpl<DeptScoreDao, DeptScoreEntity> implements DeptScoreService {
@Autowired @Autowired
private IndexGroupDetailService getDetailListByParentCode; private IndexGroupDetailService indexGroupDetailService;
@Autowired @Autowired
private FactIndexGovrnAblityDeptMonthlyDao factIndexGovrnAblityDeptMonthlyDao; private FactIndexGovrnAblityDeptMonthlyDao factIndexGovrnAblityDeptMonthlyDao;
@Autowired @Autowired
@ -117,7 +117,7 @@ public class DeptScoreServiceImpl extends BaseServiceImpl<DeptScoreDao, DeptScor
**/ **/
private void calculateZhiLiNengLiScore(CalculateCommonFormDTO formDTO) { private void calculateZhiLiNengLiScore(CalculateCommonFormDTO formDTO) {
//获取区直部门的治理能力下,五级指标权重 //获取区直部门的治理能力下,五级指标权重
List<IndexGroupDetailEntity> indexGroupDetailEntityList = getDetailListByParentCode.getDetailListByParentCode(formDTO.getCustomerId(), List<IndexGroupDetailEntity> indexGroupDetailEntityList = indexGroupDetailService.getDetailListByParentCode(formDTO.getCustomerId(),
IndexCodeEnum.QU_ZHI_BU_MEN.getCode(), IndexCodeEnum.QU_ZHI_BU_MEN.getCode(),
IndexCodeEnum.ZHI_LI_NENG_LI.getCode()); IndexCodeEnum.ZHI_LI_NENG_LI.getCode());
if (CollectionUtils.isEmpty(indexGroupDetailEntityList)) { if (CollectionUtils.isEmpty(indexGroupDetailEntityList)) {
@ -167,7 +167,7 @@ public class DeptScoreServiceImpl extends BaseServiceImpl<DeptScoreDao, DeptScor
**/ **/
private void calculateDeptTotalScore(CalculateCommonFormDTO formDTO) { private void calculateDeptTotalScore(CalculateCommonFormDTO formDTO) {
//计算区直部门总分 //计算区直部门总分
List<IndexGroupDetailEntity> indexList = getDetailListByParentCode.getDetailListByParentCode(formDTO.getCustomerId(), List<IndexGroupDetailEntity> indexList = indexGroupDetailService.getDetailListByParentCode(formDTO.getCustomerId(),
IndexCodeEnum.QU_ZHI_BU_MEN.getCode()); IndexCodeEnum.QU_ZHI_BU_MEN.getCode());
if (CollectionUtils.isEmpty(indexList)) { if (CollectionUtils.isEmpty(indexList)) {
log.error("calculateDeptTotalScore customerId:{} have not any indexGroupDetail", formDTO.getCustomerId()); log.error("calculateDeptTotalScore customerId:{} have not any indexGroupDetail", formDTO.getCustomerId());
@ -189,6 +189,7 @@ public class DeptScoreServiceImpl extends BaseServiceImpl<DeptScoreDao, DeptScor
deptScoreEntity.setIndexCode(IndexCodeEnum.QU_ZHI_BU_MEN.getCode()); deptScoreEntity.setIndexCode(IndexCodeEnum.QU_ZHI_BU_MEN.getCode());
deptScoreEntity.setScore(BigDecimal.ZERO); deptScoreEntity.setScore(BigDecimal.ZERO);
deptScoreEntity.setAllParentIndexCode(NumConstant.ZERO_STR); deptScoreEntity.setAllParentIndexCode(NumConstant.ZERO_STR);
deptScoreEntity.setWeight(new BigDecimal(NumConstant.ONE_NEG));
for (DeptScoreDetailDTO deptScoreDetailDTO : deptScore.getDetailList()) { for (DeptScoreDetailDTO deptScoreDetailDTO : deptScore.getDetailList()) {
BigDecimal indexScore = deptScoreDetailDTO.getScore().multiply(indexMap.get(deptScoreDetailDTO.getIndexCode()).getWeight()); BigDecimal indexScore = deptScoreDetailDTO.getScore().multiply(indexMap.get(deptScoreDetailDTO.getIndexCode()).getWeight());
deptScoreEntity.setScore(deptScoreEntity.getScore().add(indexScore)); deptScoreEntity.setScore(deptScoreEntity.getScore().add(indexScore));
@ -310,13 +311,17 @@ public class DeptScoreServiceImpl extends BaseServiceImpl<DeptScoreDao, DeptScor
//区直部门治理能力的 上一级是 quzhibumen //区直部门治理能力的 上一级是 quzhibumen
////新增ALL_PARENT_INDEX_CODE 所有指标code拼接的字符串 冒号隔开 ////新增ALL_PARENT_INDEX_CODE 所有指标code拼接的字符串 冒号隔开
deptScoreEntity.setAllParentIndexCode(IndexCodeEnum.QU_ZHI_BU_MEN.getCode()); deptScoreEntity.setAllParentIndexCode(IndexCodeEnum.QU_ZHI_BU_MEN.getCode());
String allPath = deptScoreEntity.getAllParentIndexCode().concat(StrConstant.COLON).concat(deptScoreEntity.getIndexCode());
BigDecimal weight = indexGroupDetailService.getWeightByAllPathIndexCode(formDTO.getCustomerId(), allPath);
deptScoreEntity.setWeight(weight);
deptScoreEntityList.add(deptScoreEntity); deptScoreEntityList.add(deptScoreEntity);
for(IndexScoreVo detail:calculateResult.getDetails()){ for (IndexScoreVo detail : calculateResult.getDetails()) {
DeptSubScoreEntity deptSubScore= ConvertUtils.sourceToTarget(deptScoreEntity, DeptSubScoreEntity.class); DeptSubScoreEntity deptSubScore = ConvertUtils.sourceToTarget(deptScoreEntity, DeptSubScoreEntity.class);
//重新赋值 //重新赋值
deptSubScore.setIndexCode(detail.getIndexCode()); deptSubScore.setIndexCode(detail.getIndexCode());
deptSubScore.setAllParentIndexCode(detail.getAllParentIndexCode()); deptSubScore.setAllParentIndexCode(detail.getAllParentIndexCode());
deptSubScore.setScore(detail.getScore()); deptSubScore.setScore(detail.getScore());
deptSubScore.setWeight(detail.getWeight());
deptSubScoreEntityList.add(deptSubScore); deptSubScoreEntityList.add(deptSubScore);
} }
}); });

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

@ -356,7 +356,7 @@ public class GridCorreLationServiceImpl implements GridCorreLationService {
if(StringUtils.isNotBlank(screenCustomerGridDTO.getParentAgencyId())){ if(StringUtils.isNotBlank(screenCustomerGridDTO.getParentAgencyId())){
gridScoreEntity.setAgencyId(screenCustomerGridDTO.getParentAgencyId()); gridScoreEntity.setAgencyId(screenCustomerGridDTO.getParentAgencyId());
} }
if(StringUtils.isNotBlank(screenCustomerGridDTO.getAllParentIds())){ if (StringUtils.isNotBlank(screenCustomerGridDTO.getAllParentIds())) {
gridScoreEntity.setAllParentIds(screenCustomerGridDTO.getAllParentIds()); gridScoreEntity.setAllParentIds(screenCustomerGridDTO.getAllParentIds());
} }
} }
@ -366,13 +366,16 @@ public class GridCorreLationServiceImpl implements GridCorreLationService {
gridScoreEntity.setScore(calculateResult.getTotalScore()); gridScoreEntity.setScore(calculateResult.getTotalScore());
//新增ALL_PARENT_INDEX_CODE 所有指标code拼接的字符串 冒号隔开 //新增ALL_PARENT_INDEX_CODE 所有指标code拼接的字符串 冒号隔开
gridScoreEntity.setAllParentIndexCode(IndexCodeEnum.WANG_GE_XIANG_GUAN.getCode()); 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); gridScoreEntityList.add(gridScoreEntity);
for(IndexScoreVo detail:calculateResult.getDetails()){ for (IndexScoreVo detail : calculateResult.getDetails()) {
GridSubScoreEntity gridSubScoreEntity= ConvertUtils.sourceToTarget(gridScoreEntity, GridSubScoreEntity.class); GridSubScoreEntity gridSubScoreEntity = ConvertUtils.sourceToTarget(gridScoreEntity, GridSubScoreEntity.class);
//重新赋值 //重新赋值
gridSubScoreEntity.setIndexCode(detail.getIndexCode()); gridSubScoreEntity.setIndexCode(detail.getIndexCode());
gridSubScoreEntity.setAllParentIndexCode(detail.getAllParentIndexCode()); gridSubScoreEntity.setAllParentIndexCode(detail.getAllParentIndexCode());
gridSubScoreEntity.setScore(detail.getScore()); gridSubScoreEntity.setScore(detail.getScore());
gridSubScoreEntity.setWeight(detail.getWeight());
gridSubScoreList.add(gridSubScoreEntity); gridSubScoreList.add(gridSubScoreEntity);
} }
}); });
@ -667,6 +670,7 @@ public class GridCorreLationServiceImpl implements GridCorreLationService {
gridScoreEntity.setIndexCode(IndexCodeEnum.WANG_GE_XIANG_GUAN.getCode()); gridScoreEntity.setIndexCode(IndexCodeEnum.WANG_GE_XIANG_GUAN.getCode());
gridScoreEntity.setScore(BigDecimal.ZERO); gridScoreEntity.setScore(BigDecimal.ZERO);
gridScoreEntity.setAllParentIndexCode(NumConstant.ZERO_STR); gridScoreEntity.setAllParentIndexCode(NumConstant.ZERO_STR);
gridScoreEntity.setWeight(new BigDecimal(NumConstant.ONE_NEG));
log.warn("customerId:" + gridScoreDTO.getCustomerId() + ";gridId:" + gridScoreDTO.getGridId() + ";monthId:" + gridScoreDTO.getMonthId() + "能力值缺失"); log.warn("customerId:" + gridScoreDTO.getCustomerId() + ";gridId:" + gridScoreDTO.getGridId() + ";monthId:" + gridScoreDTO.getMonthId() + "能力值缺失");
for (GridScoreDetailDTO gridScoreDetailDTO : gridScoreDTO.getDetailList()) { for (GridScoreDetailDTO gridScoreDetailDTO : gridScoreDTO.getDetailList()) {
BigDecimal indexScore = gridScoreDetailDTO.getScore().multiply(indexMap.get(gridScoreDetailDTO.getIndexCode()).getWeight()); BigDecimal indexScore = gridScoreDetailDTO.getScore().multiply(indexMap.get(gridScoreDetailDTO.getIndexCode()).getWeight());

66
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.alibaba.fastjson.JSON;
import com.epmet.commons.dynamic.datasource.annotation.DataSource; import com.epmet.commons.dynamic.datasource.annotation.DataSource;
import com.epmet.commons.tools.constant.NumConstant; 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.exception.RenException;
import com.epmet.commons.tools.utils.DateUtils; import com.epmet.commons.tools.utils.DateUtils;
import com.epmet.constant.DataSourceConstant; import com.epmet.constant.DataSourceConstant;
@ -68,6 +69,33 @@ public class IndexCalculateCommunityServiceImpl implements IndexCalculateCommuni
@Autowired @Autowired
private CommunitySubScoreDao communitySubScoreDao; private CommunitySubScoreDao communitySubScoreDao;
/**
* @param customerId
* @param monthId
* @Description 计算社区相关总分
* @author zxc
* @date 2020/9/1 4:12 下午
*/
public Boolean calCommunityAll(String customerId, String monthId) {
Boolean aBoolean = communityPartyCalculate(customerId, monthId);//党建能力
if (!aBoolean.equals(true)) {
throw new RenException("calculate community-party-ability failure ......");
}
Boolean bBoolean = communityGovernAbilityCalculate(customerId, monthId);// 治理能力
if (!bBoolean.equals(true)) {
throw new RenException("calculate community-govern-ability failure ......");
}
Boolean cBoolean = communityServiceAbilityCalculate(customerId, monthId);// 服务能力
if (!cBoolean.equals(true)) {
throw new RenException("calculate community-service-ability failure ......");
}
Boolean dBoolean = communityRelate(customerId, monthId);
if (!dBoolean.equals(true)) {
throw new RenException("calculate community-all insert failure ......");
}
return true;
}
/** /**
* @param customerId * @param customerId
* @Description 社区名义发文数量计算党建能力 * @Description 社区名义发文数量计算党建能力
@ -90,7 +118,6 @@ public class IndexCalculateCommunityServiceImpl implements IndexCalculateCommuni
List<SubGridAvgResultDTO> subGridPartyAvgScore = factIndexGridScoreDao.selectSubGridAvgScore(customerId, monthId,IndexCodeEnum.DANG_JIAN_NENG_LI.getCode()); List<SubGridAvgResultDTO> subGridPartyAvgScore = factIndexGridScoreDao.selectSubGridAvgScore(customerId, monthId,IndexCodeEnum.DANG_JIAN_NENG_LI.getCode());
if (CollectionUtils.isEmpty(subGridPartyAvgScore)) { if (CollectionUtils.isEmpty(subGridPartyAvgScore)) {
log.error(IndexCalConstant.GRID_PARTY_AVG_NULL); log.error(IndexCalConstant.GRID_PARTY_AVG_NULL);
return;
} else { } else {
MaxAndMinBigDecimalResultDTO maxAndMinBigDecimal = this.getMaxAndMinBigDecimal(subGridPartyAvgScore.stream().map(o -> o.getScore()).collect(Collectors.toList())); MaxAndMinBigDecimalResultDTO maxAndMinBigDecimal = this.getMaxAndMinBigDecimal(subGridPartyAvgScore.stream().map(o -> o.getScore()).collect(Collectors.toList()));
List<List<SubGridAvgResultDTO>> subPartyAvgList = ListUtils.partition(subGridPartyAvgScore, IndexCalConstant.PAGE_SIZE); List<List<SubGridAvgResultDTO>> subPartyAvgList = ListUtils.partition(subGridPartyAvgScore, IndexCalConstant.PAGE_SIZE);
@ -111,7 +138,6 @@ public class IndexCalculateCommunityServiceImpl implements IndexCalculateCommuni
List<Map<String, Object>> publishArticleCountList = factIndexPartyAblityOrgMonthlyDao.selectPublishArticleCountMap(customerId, monthId,IndexCalConstant.COMMUNITY_LEVEL); List<Map<String, Object>> publishArticleCountList = factIndexPartyAblityOrgMonthlyDao.selectPublishArticleCountMap(customerId, monthId,IndexCalConstant.COMMUNITY_LEVEL);
if (CollectionUtils.isEmpty(publishArticleCountList)) { if (CollectionUtils.isEmpty(publishArticleCountList)) {
log.error(IndexCalConstant.COMMUNITY_PUBLISH_ARTICLE_LIST_NULL); log.error(IndexCalConstant.COMMUNITY_PUBLISH_ARTICLE_LIST_NULL);
return;
} }
String fieldNameByIndexCode = indexCodeFieldReService.getFieldNameByIndexCode(detail.getIndexCode()); String fieldNameByIndexCode = indexCodeFieldReService.getFieldNameByIndexCode(detail.getIndexCode());
if (StringUtils.isEmpty(fieldNameByIndexCode)) { if (StringUtils.isEmpty(fieldNameByIndexCode)) {
@ -165,7 +191,6 @@ public class IndexCalculateCommunityServiceImpl implements IndexCalculateCommuni
List<SubGridAvgResultDTO> subGridGovernAvg = factIndexGridScoreDao.selectSubGridAvgScore(customerId, monthId,IndexCodeEnum.ZHI_LI_NENG_LI.getCode()); List<SubGridAvgResultDTO> subGridGovernAvg = factIndexGridScoreDao.selectSubGridAvgScore(customerId, monthId,IndexCodeEnum.ZHI_LI_NENG_LI.getCode());
if (CollectionUtils.isEmpty(subGridGovernAvg)){ if (CollectionUtils.isEmpty(subGridGovernAvg)){
log.error("社区下级治理能力平均分集合为空"); log.error("社区下级治理能力平均分集合为空");
return;
}else{ }else{
MaxAndMinBigDecimalResultDTO maxAndMinBigDecimal = this.getMaxAndMinBigDecimal(subGridGovernAvg.stream().map(o -> o.getScore()).collect(Collectors.toList())); MaxAndMinBigDecimalResultDTO maxAndMinBigDecimal = this.getMaxAndMinBigDecimal(subGridGovernAvg.stream().map(o -> o.getScore()).collect(Collectors.toList()));
List<List<SubGridAvgResultDTO>> governAvg = ListUtils.partition(subGridGovernAvg, IndexCalConstant.PAGE_SIZE); List<List<SubGridAvgResultDTO>> governAvg = ListUtils.partition(subGridGovernAvg, IndexCalConstant.PAGE_SIZE);
@ -186,7 +211,6 @@ public class IndexCalculateCommunityServiceImpl implements IndexCalculateCommuni
List<Map<String, Object>> communityGovernAbility = factIndexGovrnAblityOrgMonthlyDao.selectCommunityGovernAbility(customerId, monthId,IndexCalConstant.COMMUNITY_LEVEL); List<Map<String, Object>> communityGovernAbility = factIndexGovrnAblityOrgMonthlyDao.selectCommunityGovernAbility(customerId, monthId,IndexCalConstant.COMMUNITY_LEVEL);
if (CollectionUtils.isEmpty(communityGovernAbility)){ if (CollectionUtils.isEmpty(communityGovernAbility)){
log.error(IndexCalConstant.COMMUNITY_GOVERN_ABILITY_NULL); log.error(IndexCalConstant.COMMUNITY_GOVERN_ABILITY_NULL);
return;
}else{ }else{
String fieldNameByIndexCode = indexCodeFieldReService.getFieldNameByIndexCode(detail.getIndexCode()); String fieldNameByIndexCode = indexCodeFieldReService.getFieldNameByIndexCode(detail.getIndexCode());
if (StringUtils.isEmpty(fieldNameByIndexCode)) { if (StringUtils.isEmpty(fieldNameByIndexCode)) {
@ -240,7 +264,6 @@ public class IndexCalculateCommunityServiceImpl implements IndexCalculateCommuni
List<SubGridAvgResultDTO> subGridServiceAvg = factIndexGridScoreDao.selectSubGridAvgScore(customerId, monthId,IndexCodeEnum.FU_WU_NENG_LI.getCode()); List<SubGridAvgResultDTO> subGridServiceAvg = factIndexGridScoreDao.selectSubGridAvgScore(customerId, monthId,IndexCodeEnum.FU_WU_NENG_LI.getCode());
if (CollectionUtils.isEmpty(subGridServiceAvg)) { if (CollectionUtils.isEmpty(subGridServiceAvg)) {
log.error("查询社区下级所有网格服务能力得分平均值集合为空"); log.error("查询社区下级所有网格服务能力得分平均值集合为空");
//todo return;
} else { } else {
MaxAndMinBigDecimalResultDTO maxAndMinBigDecimal = this.getMaxAndMinBigDecimal(subGridServiceAvg.stream().map(o -> o.getScore()).collect(Collectors.toList())); MaxAndMinBigDecimalResultDTO maxAndMinBigDecimal = this.getMaxAndMinBigDecimal(subGridServiceAvg.stream().map(o -> o.getScore()).collect(Collectors.toList()));
List<List<SubGridAvgResultDTO>> serviceAvgList = ListUtils.partition(subGridServiceAvg, IndexCalConstant.PAGE_SIZE); List<List<SubGridAvgResultDTO>> serviceAvgList = ListUtils.partition(subGridServiceAvg, IndexCalConstant.PAGE_SIZE);
@ -260,7 +283,6 @@ public class IndexCalculateCommunityServiceImpl implements IndexCalculateCommuni
List<Map<String, Object>> communityActivityCountList = factIndexServiceAblityOrgMonthlyDao.selectActivityCountMap(customerId, monthId,IndexCalConstant.COMMUNITY_LEVEL); List<Map<String, Object>> communityActivityCountList = factIndexServiceAblityOrgMonthlyDao.selectActivityCountMap(customerId, monthId,IndexCalConstant.COMMUNITY_LEVEL);
if (CollectionUtils.isEmpty(communityActivityCountList)) { if (CollectionUtils.isEmpty(communityActivityCountList)) {
log.error(IndexCalConstant.COMMUNITY_SERVICE_ABILITY_NULL); log.error(IndexCalConstant.COMMUNITY_SERVICE_ABILITY_NULL);
return;
}else{ }else{
String fieldNameByIndexCode = indexCodeFieldReService.getFieldNameByIndexCode(detail.getIndexCode()); String fieldNameByIndexCode = indexCodeFieldReService.getFieldNameByIndexCode(detail.getIndexCode());
if (StringUtils.isEmpty(fieldNameByIndexCode)) { if (StringUtils.isEmpty(fieldNameByIndexCode)) {
@ -322,6 +344,7 @@ public class IndexCalculateCommunityServiceImpl implements IndexCalculateCommuni
score.setQuarterId(DateUtils.getQuarterId(monthId)); score.setQuarterId(DateUtils.getQuarterId(monthId));
score.setIndexCode(IndexCalConstant.COMMUNITY_RELATE); score.setIndexCode(IndexCalConstant.COMMUNITY_RELATE);
score.setAllParentIndexCode(NumConstant.ZERO_STR); score.setAllParentIndexCode(NumConstant.ZERO_STR);
score.setWeight(new BigDecimal(NumConstant.ONE_NEG));
value.forEach(community -> { value.forEach(community -> {
score.setScore(score.getScore().add(community.getScore())); score.setScore(score.getScore().add(community.getScore()));
score.setParentAgencyId(community.getParentAgencyId()); score.setParentAgencyId(community.getParentAgencyId());
@ -334,33 +357,6 @@ public class IndexCalculateCommunityServiceImpl implements IndexCalculateCommuni
return true; return true;
} }
/**
* @param customerId
* @param monthId
* @Description 计算社区相关总分
* @author zxc
* @date 2020/9/1 4:12 下午
*/
public Boolean calCommunityAll(String customerId, String monthId) {
Boolean aBoolean = communityPartyCalculate(customerId, monthId);//党建能力
if (!aBoolean.equals(true)) {
throw new RenException("calculate community-party-ability failure ......");
}
Boolean bBoolean = communityGovernAbilityCalculate(customerId, monthId);// 治理能力
if (!bBoolean.equals(true)) {
throw new RenException("calculate community-govern-ability failure ......");
}
Boolean cBoolean = communityServiceAbilityCalculate(customerId, monthId);// 服务能力
if (!cBoolean.equals(true)) {
throw new RenException("calculate community-service-ability failure ......");
}
Boolean dBoolean = communityRelate(customerId, monthId);
if (!dBoolean.equals(true)) {
throw new RenException("calculate community-all insert failure ......");
}
return true;
}
/** /**
* @param list * @param list
* @Description BigDecimal类型获取最大数和最小数 * @Description BigDecimal类型获取最大数和最小数
@ -441,6 +437,9 @@ public class IndexCalculateCommunityServiceImpl implements IndexCalculateCommuni
score.setIndexCode(indexCode); score.setIndexCode(indexCode);
score.setScore(v.getTotalScore()); score.setScore(v.getTotalScore());
score.setAllParentIndexCode(allParentIndexCode); score.setAllParentIndexCode(allParentIndexCode);
String allPath = allParentIndexCode.concat(StrConstant.COLON).concat(indexCode);
BigDecimal weight = indexGroupDetailService.getWeightByAllPathIndexCode(customerId, allPath);
score.setWeight(weight);
pid.forEach((agency, parentAgency) -> { pid.forEach((agency, parentAgency) -> {
if (k.equals(agency)) { if (k.equals(agency)) {
score.setParentAgencyId(parentAgency); score.setParentAgencyId(parentAgency);
@ -458,6 +457,7 @@ public class IndexCalculateCommunityServiceImpl implements IndexCalculateCommuni
s.setIndexCode(fiveDetail.getIndexCode()); s.setIndexCode(fiveDetail.getIndexCode());
s.setScore(fiveDetail.getScore()); s.setScore(fiveDetail.getScore());
s.setAllParentIndexCode(fiveDetail.getAllParentIndexCode()); s.setAllParentIndexCode(fiveDetail.getAllParentIndexCode());
s.setWeight(fiveDetail.getWeight());
pid.forEach((agency, parentAgency) -> { pid.forEach((agency, parentAgency) -> {
if (k.equals(agency)) { if (k.equals(agency)) {
s.setParentAgencyId(parentAgency); s.setParentAgencyId(parentAgency);

13
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.alibaba.fastjson.JSON;
import com.epmet.commons.dynamic.datasource.annotation.DataSource; import com.epmet.commons.dynamic.datasource.annotation.DataSource;
import com.epmet.commons.tools.constant.NumConstant; 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.exception.RenException;
import com.epmet.commons.tools.utils.DateUtils; import com.epmet.commons.tools.utils.DateUtils;
import com.epmet.constant.DataSourceConstant; import com.epmet.constant.DataSourceConstant;
@ -115,7 +116,6 @@ public class IndexCalculateDistrictServiceImpl implements IndexCalculateDistrict
List<SubAgencyScoreAvgResultDTO> subGridPartyAvgScore = agencyScoreDao.selectAgencyScoreAvg(customerId, monthId,IndexCodeEnum.DANG_JIAN_NENG_LI.getCode(),IndexCalConstant.STREET_LEVEL); List<SubAgencyScoreAvgResultDTO> subGridPartyAvgScore = agencyScoreDao.selectAgencyScoreAvg(customerId, monthId,IndexCodeEnum.DANG_JIAN_NENG_LI.getCode(),IndexCalConstant.STREET_LEVEL);
if (CollectionUtils.isEmpty(subGridPartyAvgScore)) { if (CollectionUtils.isEmpty(subGridPartyAvgScore)) {
log.error(IndexCalConstant.DISTRICT_PARTY_AVG_NULL); log.error(IndexCalConstant.DISTRICT_PARTY_AVG_NULL);
return;
} else if (subGridPartyAvgScore.size() > NumConstant.ZERO) { } else if (subGridPartyAvgScore.size() > NumConstant.ZERO) {
MaxAndMinBigDecimalResultDTO maxAndMinBigDecimal = this.getMaxAndMinBigDecimal(subGridPartyAvgScore.stream().map(o -> o.getScore()).collect(Collectors.toList())); MaxAndMinBigDecimalResultDTO maxAndMinBigDecimal = this.getMaxAndMinBigDecimal(subGridPartyAvgScore.stream().map(o -> o.getScore()).collect(Collectors.toList()));
List<List<SubAgencyScoreAvgResultDTO>> subPartyAvgList = ListUtils.partition(subGridPartyAvgScore, IndexCalConstant.PAGE_SIZE); List<List<SubAgencyScoreAvgResultDTO>> subPartyAvgList = ListUtils.partition(subGridPartyAvgScore, IndexCalConstant.PAGE_SIZE);
@ -136,7 +136,6 @@ public class IndexCalculateDistrictServiceImpl implements IndexCalculateDistrict
List<Map<String, Object>> publishArticleCountList = factIndexPartyAblityOrgMonthlyDao.selectPublishArticleCountMap(customerId, monthId,IndexCalConstant.DISTRICT_LEVEL); List<Map<String, Object>> publishArticleCountList = factIndexPartyAblityOrgMonthlyDao.selectPublishArticleCountMap(customerId, monthId,IndexCalConstant.DISTRICT_LEVEL);
if (CollectionUtils.isEmpty(publishArticleCountList)) { if (CollectionUtils.isEmpty(publishArticleCountList)) {
log.error(IndexCalConstant.DISTRICT_PUBLISH_ARTICLE_LIST_NULL); log.error(IndexCalConstant.DISTRICT_PUBLISH_ARTICLE_LIST_NULL);
return;
} }
String fieldNameByIndexCode = indexCodeFieldReService.getFieldNameByIndexCode(detail.getIndexCode()); String fieldNameByIndexCode = indexCodeFieldReService.getFieldNameByIndexCode(detail.getIndexCode());
if (StringUtils.isEmpty(fieldNameByIndexCode)) { if (StringUtils.isEmpty(fieldNameByIndexCode)) {
@ -190,7 +189,6 @@ public class IndexCalculateDistrictServiceImpl implements IndexCalculateDistrict
List<SubAgencyScoreAvgResultDTO> districtGovernAvgList = agencyScoreDao.selectAgencyScoreAvg(customerId, monthId, IndexCodeEnum.ZHI_LI_NENG_LI.getCode(),IndexCalConstant.STREET_LEVEL); List<SubAgencyScoreAvgResultDTO> districtGovernAvgList = agencyScoreDao.selectAgencyScoreAvg(customerId, monthId, IndexCodeEnum.ZHI_LI_NENG_LI.getCode(),IndexCalConstant.STREET_LEVEL);
if (CollectionUtils.isEmpty(districtGovernAvgList)) { if (CollectionUtils.isEmpty(districtGovernAvgList)) {
log.error("查询所有街道治理能力平均值集合为空"); log.error("查询所有街道治理能力平均值集合为空");
return;
} else{ } else{
MaxAndMinBigDecimalResultDTO maxAndMinBigDecimal = this.getMaxAndMinBigDecimal(districtGovernAvgList.stream().map(o -> o.getScore()).collect(Collectors.toList())); MaxAndMinBigDecimalResultDTO maxAndMinBigDecimal = this.getMaxAndMinBigDecimal(districtGovernAvgList.stream().map(o -> o.getScore()).collect(Collectors.toList()));
List<List<SubAgencyScoreAvgResultDTO>> governAvg = ListUtils.partition(districtGovernAvgList, IndexCalConstant.PAGE_SIZE); List<List<SubAgencyScoreAvgResultDTO>> governAvg = ListUtils.partition(districtGovernAvgList, IndexCalConstant.PAGE_SIZE);
@ -210,7 +208,6 @@ public class IndexCalculateDistrictServiceImpl implements IndexCalculateDistrict
List<SubAgencyScoreAvgResultDTO> deptScoreAvgList = deptScoreDao.selectGovernDeptScoreAvg(customerId, monthId, IndexCodeEnum.ZHI_LI_NENG_LI.getCode()); List<SubAgencyScoreAvgResultDTO> deptScoreAvgList = deptScoreDao.selectGovernDeptScoreAvg(customerId, monthId, IndexCodeEnum.ZHI_LI_NENG_LI.getCode());
if (CollectionUtils.isEmpty(deptScoreAvgList)) { if (CollectionUtils.isEmpty(deptScoreAvgList)) {
log.error("查询所有直属部门治理能力平均值集合为空"); log.error("查询所有直属部门治理能力平均值集合为空");
//return;
} else{ } else{
MaxAndMinBigDecimalResultDTO maxAndMinBigDecimal = this.getMaxAndMinBigDecimal(deptScoreAvgList.stream().map(o -> o.getScore()).collect(Collectors.toList())); MaxAndMinBigDecimalResultDTO maxAndMinBigDecimal = this.getMaxAndMinBigDecimal(deptScoreAvgList.stream().map(o -> o.getScore()).collect(Collectors.toList()));
List<List<SubAgencyScoreAvgResultDTO>> governAvg = ListUtils.partition(deptScoreAvgList, IndexCalConstant.PAGE_SIZE); List<List<SubAgencyScoreAvgResultDTO>> governAvg = ListUtils.partition(deptScoreAvgList, IndexCalConstant.PAGE_SIZE);
@ -260,7 +257,6 @@ public class IndexCalculateDistrictServiceImpl implements IndexCalculateDistrict
List<SubAgencyScoreAvgResultDTO> subStreetAvgList = agencyScoreDao.selectAgencyScoreAvg(customerId, monthId,IndexCodeEnum.FU_WU_NENG_LI.getCode(),IndexCalConstant.STREET_LEVEL); List<SubAgencyScoreAvgResultDTO> subStreetAvgList = agencyScoreDao.selectAgencyScoreAvg(customerId, monthId,IndexCodeEnum.FU_WU_NENG_LI.getCode(),IndexCalConstant.STREET_LEVEL);
if (CollectionUtils.isEmpty(subStreetAvgList)) { if (CollectionUtils.isEmpty(subStreetAvgList)) {
log.error("查询区下属街道服务能力汇总平均值集合为空"); log.error("查询区下属街道服务能力汇总平均值集合为空");
return;
} else{ } else{
MaxAndMinBigDecimalResultDTO maxAndMinBigDecimal = this.getMaxAndMinBigDecimal(subStreetAvgList.stream().map(o -> o.getScore()).collect(Collectors.toList())); MaxAndMinBigDecimalResultDTO maxAndMinBigDecimal = this.getMaxAndMinBigDecimal(subStreetAvgList.stream().map(o -> o.getScore()).collect(Collectors.toList()));
List<List<SubAgencyScoreAvgResultDTO>> serviceAvgList = ListUtils.partition(subStreetAvgList, IndexCalConstant.PAGE_SIZE); List<List<SubAgencyScoreAvgResultDTO>> serviceAvgList = ListUtils.partition(subStreetAvgList, IndexCalConstant.PAGE_SIZE);
@ -321,6 +317,7 @@ public class IndexCalculateDistrictServiceImpl implements IndexCalculateDistrict
score.setDataType(IndexCalConstant.DISTRICT_LEVEL); score.setDataType(IndexCalConstant.DISTRICT_LEVEL);
score.setIndexCode(IndexCodeEnum.QUAN_QU_XIANG_GUAN.getCode()); score.setIndexCode(IndexCodeEnum.QUAN_QU_XIANG_GUAN.getCode());
score.setAllParentIndexCode(NumConstant.ZERO_STR); score.setAllParentIndexCode(NumConstant.ZERO_STR);
score.setWeight(new BigDecimal(NumConstant.ONE_NEG));
value.forEach(community -> { value.forEach(community -> {
score.setScore(score.getScore().add(community.getScore())); score.setScore(score.getScore().add(community.getScore()));
score.setParentAgencyId(community.getParentAgencyId()); score.setParentAgencyId(community.getParentAgencyId());
@ -415,13 +412,16 @@ public class IndexCalculateDistrictServiceImpl implements IndexCalculateDistrict
score.setScore(v.getTotalScore()); score.setScore(v.getTotalScore());
score.setAllParentIndexCode(allParentIndexCode); score.setAllParentIndexCode(allParentIndexCode);
score.setDataType(IndexCalConstant.DISTRICT_LEVEL); 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) -> { pid.forEach((agency, parentAgency) -> {
//todo 确认 //todo 确认
if (k != null && k.equals(agency)) { if (k != null && k.equals(agency)) {
score.setParentAgencyId(parentAgency); score.setParentAgencyId(parentAgency);
} }
}); });
if (!CollectionUtils.isEmpty(v.getDetails())){ if (!CollectionUtils.isEmpty(v.getDetails())) {
v.getDetails().forEach(streetScore -> { v.getDetails().forEach(streetScore -> {
AgencyScoreDTO s = new AgencyScoreDTO(); AgencyScoreDTO s = new AgencyScoreDTO();
s.setCustomerId(customerId); s.setCustomerId(customerId);
@ -434,6 +434,7 @@ public class IndexCalculateDistrictServiceImpl implements IndexCalculateDistrict
s.setScore(streetScore.getScore()); s.setScore(streetScore.getScore());
s.setAllParentIndexCode(streetScore.getAllParentIndexCode()); s.setAllParentIndexCode(streetScore.getAllParentIndexCode());
s.setDataType(IndexCalConstant.DISTRICT_LEVEL); s.setDataType(IndexCalConstant.DISTRICT_LEVEL);
s.setWeight(streetScore.getWeight());
pid.forEach((agency, parentAgency) -> { pid.forEach((agency, parentAgency) -> {
//todo 确认 //todo 确认
if (k != null && k.equals(agency)) { if (k != null && k.equals(agency)) {

164
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.constant.DataSourceConstant;
import com.epmet.dto.indexcal.CalculateCommonFormDTO; import com.epmet.dto.indexcal.CalculateCommonFormDTO;
import com.epmet.feign.EpmetCommonServiceOpenFeignClient; 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.indexcal.*;
import com.epmet.service.evaluationindex.indexcoll.FactIndexCollectService; import com.epmet.service.evaluationindex.indexcoll.FactIndexCollectService;
import com.epmet.util.DimIdGenerator; import com.epmet.util.DimIdGenerator;
@ -36,7 +36,7 @@ public class IndexCalculateServiceImpl implements IndexCalculateService {
@Autowired @Autowired
private CpcIndexCalculateService cpcIndexCalculateService; private CpcIndexCalculateService cpcIndexCalculateService;
@Autowired @Autowired
private IndexCodeFieldReRedis indexCodeFieldReRedis; private IndexCalRedis indexCalRedis;
@Autowired @Autowired
private IndexCalculateCommunityService indexCalculateCommunityService; private IndexCalculateCommunityService indexCalculateCommunityService;
@Autowired @Autowired
@ -70,90 +70,106 @@ public class IndexCalculateServiceImpl implements IndexCalculateService {
} }
Boolean flag = false; Boolean flag = false;
for (String customerId : customerIds) { for (String customerId : customerIds) {
CalculateCommonFormDTO calculateCommonFormDTO = new CalculateCommonFormDTO(customerId, formDTO.getMonthId()); CalculateCommonFormDTO param = new CalculateCommonFormDTO();
long start = System.currentTimeMillis(); 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 {
//计算党员相关的
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);
}
//测试用
//计算网格 flag = cpcIndexCalculateService.cpcIndexCalculate(formDTO);
start = System.currentTimeMillis(); log.info("客户Id:{}【党员相关】计算完毕,总耗时:{}秒,result:{}", customerId, (System.currentTimeMillis() - start) / 1000, flag);
try { } catch (Exception e) {
flag = gridCorreLationService.calculateGridCorreLation(calculateCommonFormDTO); log.error("indexCalculate cpcIndexCalculate exception", e);
log.info("客户Id:{}【网格相关】计算完毕,总耗时:{}秒,result:{},result:{}", customerId, (System.currentTimeMillis() - start) / 1000, flag); throw new RenException("indexCalculate cpcIndexCalculate exception", e);
} catch (Exception e) { }
log.error("indexCalculate calculateGridCorreLation exception", e); //测试用
throw new RenException("indexCalculate calculateGridCorreLation exception", e);
} //计算网格
//计算社区 start = System.currentTimeMillis();
start = System.currentTimeMillis(); try {
try { flag = gridCorreLationService.calculateGridCorreLation(formDTO);
flag = indexCalculateCommunityService.calCommunityAll(customerId, formDTO.getMonthId()); log.info("客户Id:{}【网格相关】计算完毕,总耗时:{}秒,result:{},result:{}", customerId, (System.currentTimeMillis() - start) / 1000, flag);
log.info("客户Id:{}【社区相关】计算完毕,总耗时:{}秒,result:{},result:{}", customerId, (System.currentTimeMillis() - start) / 1000, flag); } catch (Exception e) {
} catch (Exception e) { log.error("indexCalculate calculateGridCorreLation exception", e);
log.error("indexCalculate calCommunityAll exception", e); throw new RenException("indexCalculate calculateGridCorreLation exception", e);
throw new RenException("indexCalculate calAll 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(); start = System.currentTimeMillis();
try { try {
flag = indexCalculateStreetService.calStreetAll(customerId, formDTO.getMonthId()); flag = indexCalculateStreetService.calStreetAll(customerId, formDTO.getMonthId());
log.info("客户Id:{}【街道相关】计算完毕,总耗时:{}秒,result:{}", customerId, (System.currentTimeMillis() - start) / 1000, flag); log.info("客户Id:{}【街道相关】计算完毕,总耗时:{}秒,result:{}", customerId, (System.currentTimeMillis() - start) / 1000, flag);
} catch (Exception e) { } catch (Exception e) {
log.error("indexCalculate calStreetAll exception", e); log.error("indexCalculate calStreetAll exception", e);
throw new RenException("indexCalculate calStreetAll exception", e); throw new RenException("indexCalculate calStreetAll exception", e);
} }
//计算区直属 //计算区直属
start = System.currentTimeMillis(); start = System.currentTimeMillis();
try { try {
flag = deptScoreService.calculateDeptCorreLation(calculateCommonFormDTO); flag = deptScoreService.calculateDeptCorreLation(formDTO);
log.info("客户Id:{}【区直部门】计算完毕,总耗时:{}秒,result:{}", customerId, (System.currentTimeMillis() - start) / 1000, flag); log.info("客户Id:{}【区直部门】计算完毕,总耗时:{}秒,result:{}", customerId, (System.currentTimeMillis() - start) / 1000, flag);
} catch (Exception e) { } catch (Exception e) {
log.error("indexCalculate calculateDeptCorreLation exception", e); log.error("indexCalculate calculateDeptCorreLation exception", e);
throw new RenException("indexCalculate calculateDeptCorreLation exception", e); throw new RenException("indexCalculate calculateDeptCorreLation exception", e);
} }
//计算全区 //计算全区
start = System.currentTimeMillis(); start = System.currentTimeMillis();
try { try {
indexCalculateDistrictService.calDistrictAll(customerId, formDTO.getMonthId()); indexCalculateDistrictService.calDistrictAll(customerId, formDTO.getMonthId());
log.info("客户Id:{}【全区相关】计算完毕,总耗时:{}秒,result:{}", customerId, (System.currentTimeMillis() - start) / 1000, flag); log.info("客户Id:{}【全区相关】计算完毕,总耗时:{}秒,result:{}", customerId, (System.currentTimeMillis() - start) / 1000, flag);
} catch (Exception e) { } catch (Exception e) {
log.error("indexCalculate calDistrictAll exception", e); log.error("indexCalculate calDistrictAll exception", e);
throw new RenException("indexCalculate calDistrictAll exception", e); throw new RenException("indexCalculate calDistrictAll exception", e);
}
} catch (RenException e) {
flag = false;
} }
} catch (RenException e) {
flag = false;
}
//计算完毕后 将结果插入大屏相关数据表 //计算完毕后 将结果插入大屏相关数据表
if (flag) { if (flag) {
start = System.currentTimeMillis(); start = System.currentTimeMillis();
try { try {
factIndexCollectService.insertScreenIndexDataMonthlyAndYearly(formDTO.getMonthId(), formDTO.getCustomerId()); factIndexCollectService.insertScreenIndexDataMonthlyAndYearly(formDTO.getMonthId(), formDTO.getCustomerId());
log.info("客户Id:{}分数插入到大屏显示库完毕,总耗时:{}秒", customerId, (System.currentTimeMillis() - start) / 1000); log.info("客户Id:{}分数插入到大屏显示库完毕,总耗时:{}秒", customerId, (System.currentTimeMillis() - start) / 1000);
} catch (Exception e) { } catch (Exception e) {
log.error("indexCalculate insertScreenIndexDataMonthlyAndYearly exception", e); log.error("indexCalculate insertScreenIndexDataMonthlyAndYearly exception", e);
flag = false; flag = false;
}
} }
} }
return flag; return flag;
} catch (Exception e) { } catch (Exception e) {
log.error("indexCalculate exception,param:{}", JSON.toJSONString(formDTO)); log.error("calulateCustomerIndexScore exception", e);
} finally { } finally {
//清除缓存 indexCalRedis.deleteIndexCodeWeightFromRedis(formDTO.getCustomerId());
indexCodeFieldReRedis.deleteIndexCodeFromRedis();
} }
return false; return false;
} }

14
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.alibaba.fastjson.JSON;
import com.epmet.commons.dynamic.datasource.annotation.DataSource; import com.epmet.commons.dynamic.datasource.annotation.DataSource;
import com.epmet.commons.tools.constant.NumConstant; 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.exception.RenException;
import com.epmet.commons.tools.utils.DateUtils; import com.epmet.commons.tools.utils.DateUtils;
import com.epmet.constant.DataSourceConstant; import com.epmet.constant.DataSourceConstant;
@ -118,7 +119,6 @@ public class IndexCalculateStreetServiceImpl implements IndexCalculateStreetServ
List<SubCommunityAvgResultDTO> subCommPartyAvgScore = communityScoreDao.selectSubCommAvgScore(customerId, monthId,IndexCodeEnum.DANG_JIAN_NENG_LI.getCode()); List<SubCommunityAvgResultDTO> subCommPartyAvgScore = communityScoreDao.selectSubCommAvgScore(customerId, monthId,IndexCodeEnum.DANG_JIAN_NENG_LI.getCode());
if (CollectionUtils.isEmpty(subCommPartyAvgScore)) { if (CollectionUtils.isEmpty(subCommPartyAvgScore)) {
log.error(IndexCalConstant.COMMUNITY_PARTY_AVG_NULL); log.error(IndexCalConstant.COMMUNITY_PARTY_AVG_NULL);
//todo return;
} else if (subCommPartyAvgScore.size() > NumConstant.ZERO) { } else if (subCommPartyAvgScore.size() > NumConstant.ZERO) {
MaxAndMinBigDecimalResultDTO maxAndMinBigDecimal = this.getMaxAndMinBigDecimal(subCommPartyAvgScore.stream().map(o -> o.getScore()).collect(Collectors.toList())); MaxAndMinBigDecimalResultDTO maxAndMinBigDecimal = this.getMaxAndMinBigDecimal(subCommPartyAvgScore.stream().map(o -> o.getScore()).collect(Collectors.toList()));
Integer indexEnd = NumConstant.TEN; Integer indexEnd = NumConstant.TEN;
@ -140,7 +140,6 @@ public class IndexCalculateStreetServiceImpl implements IndexCalculateStreetServ
List<Map<String, Object>> mapList = factIndexPartyAblityOrgMonthlyDao.selectPublishArticleCountMap(customerId, monthId, IndexCalConstant.STREET_LEVEL); List<Map<String, Object>> mapList = factIndexPartyAblityOrgMonthlyDao.selectPublishArticleCountMap(customerId, monthId, IndexCalConstant.STREET_LEVEL);
if (CollectionUtils.isEmpty(mapList)) { if (CollectionUtils.isEmpty(mapList)) {
log.error(IndexCalConstant.STREET_PUBLISH_ARTICLE_LIST_NULL); log.error(IndexCalConstant.STREET_PUBLISH_ARTICLE_LIST_NULL);
return;
} }
String fieldName = indexCodeFieldReService.getFieldNameByIndexCode(detail.getIndexCode()); String fieldName = indexCodeFieldReService.getFieldNameByIndexCode(detail.getIndexCode());
if (StringUtils.isEmpty(fieldName)) { if (StringUtils.isEmpty(fieldName)) {
@ -193,7 +192,6 @@ public class IndexCalculateStreetServiceImpl implements IndexCalculateStreetServ
List<SubCommunityAvgResultDTO> subGridGovernAvg = communityScoreDao.selectSubCommAvgScore(customerId, monthId,IndexCodeEnum.ZHI_LI_NENG_LI.getCode()); List<SubCommunityAvgResultDTO> subGridGovernAvg = communityScoreDao.selectSubCommAvgScore(customerId, monthId,IndexCodeEnum.ZHI_LI_NENG_LI.getCode());
if (CollectionUtils.isEmpty(subGridGovernAvg)){ if (CollectionUtils.isEmpty(subGridGovernAvg)){
log.error("查询街道下属所有社区治理能力汇总为空"); log.error("查询街道下属所有社区治理能力汇总为空");
//todo return;
}else if (subGridGovernAvg.size() > NumConstant.ZERO) { }else if (subGridGovernAvg.size() > NumConstant.ZERO) {
MaxAndMinBigDecimalResultDTO maxAndMinBigDecimal = this.getMaxAndMinBigDecimal(subGridGovernAvg.stream().map(o -> o.getScore()).collect(Collectors.toList())); MaxAndMinBigDecimalResultDTO maxAndMinBigDecimal = this.getMaxAndMinBigDecimal(subGridGovernAvg.stream().map(o -> o.getScore()).collect(Collectors.toList()));
List<List<SubCommunityAvgResultDTO>> governAvg = ListUtils.partition(subGridGovernAvg, IndexCalConstant.PAGE_SIZE); List<List<SubCommunityAvgResultDTO>> governAvg = ListUtils.partition(subGridGovernAvg, IndexCalConstant.PAGE_SIZE);
@ -214,7 +212,6 @@ public class IndexCalculateStreetServiceImpl implements IndexCalculateStreetServ
List<Map<String, Object>> communityGovernAbility = factIndexGovrnAblityOrgMonthlyDao.selectCommunityGovernAbility(customerId, monthId,IndexCalConstant.STREET_LEVEL); List<Map<String, Object>> communityGovernAbility = factIndexGovrnAblityOrgMonthlyDao.selectCommunityGovernAbility(customerId, monthId,IndexCalConstant.STREET_LEVEL);
if (CollectionUtils.isEmpty(communityGovernAbility)){ if (CollectionUtils.isEmpty(communityGovernAbility)){
log.error(IndexCalConstant.STREET_GOVERN_ABILITY_NULL); log.error(IndexCalConstant.STREET_GOVERN_ABILITY_NULL);
return;
}else{ }else{
String fieldNameByIndexCode = indexCodeFieldReService.getFieldNameByIndexCode(detail.getIndexCode()); String fieldNameByIndexCode = indexCodeFieldReService.getFieldNameByIndexCode(detail.getIndexCode());
if (StringUtils.isEmpty(fieldNameByIndexCode)) { if (StringUtils.isEmpty(fieldNameByIndexCode)) {
@ -268,7 +265,6 @@ public class IndexCalculateStreetServiceImpl implements IndexCalculateStreetServ
List<SubCommunityAvgResultDTO> subCommServiceAvg = communityScoreDao.selectSubCommAvgScore(customerId, monthId,IndexCodeEnum.FU_WU_NENG_LI.getCode()); List<SubCommunityAvgResultDTO> subCommServiceAvg = communityScoreDao.selectSubCommAvgScore(customerId, monthId,IndexCodeEnum.FU_WU_NENG_LI.getCode());
if (CollectionUtils.isEmpty(subCommServiceAvg)) { if (CollectionUtils.isEmpty(subCommServiceAvg)) {
log.error("查询街道下属社区服务能力得分平均值为空"); log.error("查询街道下属社区服务能力得分平均值为空");
//todo return;
} else if (subCommServiceAvg.size() > NumConstant.ZERO) { } else if (subCommServiceAvg.size() > NumConstant.ZERO) {
MaxAndMinBigDecimalResultDTO maxAndMinBigDecimal = this.getMaxAndMinBigDecimal(subCommServiceAvg.stream().map(o -> o.getScore()).collect(Collectors.toList())); MaxAndMinBigDecimalResultDTO maxAndMinBigDecimal = this.getMaxAndMinBigDecimal(subCommServiceAvg.stream().map(o -> o.getScore()).collect(Collectors.toList()));
List<List<SubCommunityAvgResultDTO>> serviceAvgList = ListUtils.partition(subCommServiceAvg, IndexCalConstant.PAGE_SIZE); List<List<SubCommunityAvgResultDTO>> serviceAvgList = ListUtils.partition(subCommServiceAvg, IndexCalConstant.PAGE_SIZE);
@ -288,7 +284,6 @@ public class IndexCalculateStreetServiceImpl implements IndexCalculateStreetServ
List<Map<String, Object>> communityActivityCountList = factIndexServiceAblityOrgMonthlyDao.selectActivityCountMap(customerId, monthId,IndexCalConstant.STREET_LEVEL); List<Map<String, Object>> communityActivityCountList = factIndexServiceAblityOrgMonthlyDao.selectActivityCountMap(customerId, monthId,IndexCalConstant.STREET_LEVEL);
if (CollectionUtils.isEmpty(communityActivityCountList)) { if (CollectionUtils.isEmpty(communityActivityCountList)) {
log.error(IndexCalConstant.STREET_SERVICE_ABILITY_NULL); log.error(IndexCalConstant.STREET_SERVICE_ABILITY_NULL);
return;
}else{ }else{
String fieldNameByIndexCode = indexCodeFieldReService.getFieldNameByIndexCode(detail.getIndexCode()); String fieldNameByIndexCode = indexCodeFieldReService.getFieldNameByIndexCode(detail.getIndexCode());
if (StringUtils.isEmpty(fieldNameByIndexCode)) { if (StringUtils.isEmpty(fieldNameByIndexCode)) {
@ -351,6 +346,7 @@ public class IndexCalculateStreetServiceImpl implements IndexCalculateStreetServ
score.setIndexCode(IndexCodeEnum.JIE_DAO_XIANG_GUAN.getCode()); score.setIndexCode(IndexCodeEnum.JIE_DAO_XIANG_GUAN.getCode());
score.setDataType(IndexCalConstant.STREET_LEVEL); score.setDataType(IndexCalConstant.STREET_LEVEL);
score.setAllParentIndexCode(NumConstant.ZERO_STR); score.setAllParentIndexCode(NumConstant.ZERO_STR);
score.setWeight(new BigDecimal(NumConstant.ONE_NEG));
value.forEach(street -> { value.forEach(street -> {
score.setScore(score.getScore().add(street.getScore())); score.setScore(score.getScore().add(street.getScore()));
score.setParentAgencyId(street.getParentAgencyId()); score.setParentAgencyId(street.getParentAgencyId());
@ -445,12 +441,15 @@ public class IndexCalculateStreetServiceImpl implements IndexCalculateStreetServ
score.setScore(v.getTotalScore()); score.setScore(v.getTotalScore());
score.setAllParentIndexCode(allParentIndexCode); score.setAllParentIndexCode(allParentIndexCode);
score.setDataType(IndexCalConstant.STREET_LEVEL); 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) -> { pid.forEach((agency, parentAgency) -> {
if (k.equals(agency)) { if (k.equals(agency)) {
score.setParentAgencyId(parentAgency); score.setParentAgencyId(parentAgency);
} }
}); });
if (!CollectionUtils.isEmpty(v.getDetails())){ if (!CollectionUtils.isEmpty(v.getDetails())) {
v.getDetails().forEach(streetScore -> { v.getDetails().forEach(streetScore -> {
AgencyScoreDTO s = new AgencyScoreDTO(); AgencyScoreDTO s = new AgencyScoreDTO();
s.setCustomerId(customerId); s.setCustomerId(customerId);
@ -463,6 +462,7 @@ public class IndexCalculateStreetServiceImpl implements IndexCalculateStreetServ
s.setScore(streetScore.getScore()); s.setScore(streetScore.getScore());
s.setDataType(IndexCalConstant.STREET_LEVEL); s.setDataType(IndexCalConstant.STREET_LEVEL);
s.setAllParentIndexCode(streetScore.getAllParentIndexCode()); s.setAllParentIndexCode(streetScore.getAllParentIndexCode());
s.setWeight(streetScore.getWeight());
pid.forEach((agency, parentAgency) -> { pid.forEach((agency, parentAgency) -> {
if (k.equals(agency)) { if (k.equals(agency)) {
s.setParentAgencyId(parentAgency); s.setParentAgencyId(parentAgency);

8
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.constant.DataSourceConstant;
import com.epmet.dao.evaluationindex.screen.IndexCodeFieldReDao; import com.epmet.dao.evaluationindex.screen.IndexCodeFieldReDao;
import com.epmet.entity.evaluationindex.screen.IndexCodeFieldReEntity; 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 com.epmet.service.evaluationindex.indexcal.IndexCodeFieldReService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -25,18 +25,18 @@ public class IndexCodeFieldReServiceImpl implements IndexCodeFieldReService {
private IndexCodeFieldReDao indexCodeFieldReDao; private IndexCodeFieldReDao indexCodeFieldReDao;
@Autowired @Autowired
private IndexCodeFieldReRedis indexCodeFieldReRedis; private IndexCalRedis indexCalRedis;
@Override @Override
public Map<String, String> getIndexCodeFieldReMap() { public Map<String, String> getIndexCodeFieldReMap() {
Map<String, String> indexCodeFiledReMap = indexCodeFieldReRedis.getIndexCodeFiledReMap(); Map<String, String> indexCodeFiledReMap = indexCalRedis.getIndexCodeFiledReMap();
if (CollectionUtils.isEmpty(indexCodeFiledReMap)) { if (CollectionUtils.isEmpty(indexCodeFiledReMap)) {
List<IndexCodeFieldReEntity> allData = indexCodeFieldReDao.getAllData(); List<IndexCodeFieldReEntity> allData = indexCodeFieldReDao.getAllData();
if (CollectionUtils.isEmpty(allData)){ if (CollectionUtils.isEmpty(allData)){
return new HashMap<>(); return new HashMap<>();
} }
indexCodeFiledReMap = allData.stream().collect(Collectors.toMap(IndexCodeFieldReEntity::getIndexCode, o -> o.getFieldId())); indexCodeFiledReMap = allData.stream().collect(Collectors.toMap(IndexCodeFieldReEntity::getIndexCode, o -> o.getFieldId()));
indexCodeFieldReRedis.setIndexCodeFiledReMap(indexCodeFiledReMap); indexCalRedis.setIndexCodeFiledReMap(indexCodeFiledReMap);
} }
return indexCodeFiledReMap; return indexCodeFiledReMap;
} }

26
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.setPartyDevAblity(zero);
monthlyDTO.setServiceAblity(zero); monthlyDTO.setServiceAblity(zero);
monthlyDTO.setGovernAblity(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(), monthlyDTO = this.supplementIndexDataMonthlyTable(monthId, OrgTypeConstant.GRID, gridScoreDTOS.get(i).getGridId(),
gridScoreDTOS.get(i).getParentAgencyId(), gridScoreDTOS.get(i).getGridName(), monthlyDTO); gridScoreDTOS.get(i).getParentAgencyId(), gridScoreDTOS.get(i).getGridName(), monthlyDTO);
@ -315,6 +319,7 @@ public class FactIndexCollectServiceImpl implements FactIndexCollectService {
} else { } else {
// 赋实际值 党建能力、治理能力、服务能力 // 赋实际值 党建能力、治理能力、服务能力
monthlyFormDTO = this.setValueAbilityMonthlyFor(gridScore.getValue().get(i).getIndexCode(), monthlyFormDTO = this.setValueAbilityMonthlyFor(gridScore.getValue().get(i).getIndexCode(),
gridScore.getValue().get(i).getWeight(),
gridScore.getValue().get(i).getScore(), gridScore.getValue().get(i).getScore(),
monthlyFormDTO); monthlyFormDTO);
} }
@ -397,6 +402,10 @@ public class FactIndexCollectServiceImpl implements FactIndexCollectService {
monthlyDTO.setPartyDevAblity(zero); monthlyDTO.setPartyDevAblity(zero);
monthlyDTO.setServiceAblity(zero); monthlyDTO.setServiceAblity(zero);
monthlyDTO.setGovernAblity(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(), monthlyDTO = this.supplementIndexDataMonthlyTable(monthId, OrgTypeConstant.AGENCY, communityScoreDTOS.get(i).getAgencyId(),
communityScoreDTOS.get(i).getPid(), communityScoreDTOS.get(i).getAgencyName(), monthlyDTO); communityScoreDTOS.get(i).getPid(), communityScoreDTOS.get(i).getAgencyName(), monthlyDTO);
@ -435,6 +444,7 @@ public class FactIndexCollectServiceImpl implements FactIndexCollectService {
} else { } else {
// 赋值 党建能力、治理能力、服务能力 // 赋值 党建能力、治理能力、服务能力
monthlyFormDTO = this.setValueAbilityMonthlyFor(communityScore.getValue().get(i).getIndexCode(), monthlyFormDTO = this.setValueAbilityMonthlyFor(communityScore.getValue().get(i).getIndexCode(),
communityScore.getValue().get(i).getWeight(),
communityScore.getValue().get(i).getScore(), communityScore.getValue().get(i).getScore(),
monthlyFormDTO); monthlyFormDTO);
} }
@ -517,6 +527,10 @@ public class FactIndexCollectServiceImpl implements FactIndexCollectService {
monthlyDTO.setPartyDevAblity(zero); monthlyDTO.setPartyDevAblity(zero);
monthlyDTO.setServiceAblity(zero); monthlyDTO.setServiceAblity(zero);
monthlyDTO.setGovernAblity(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(), monthlyDTO = this.supplementIndexDataMonthlyTable(monthId, OrgTypeConstant.DEPARTMENT, deptScoreDTOS.get(i).getDeptId(),
deptScoreDTOS.get(i).getParentAgencyId(), deptScoreDTOS.get(i).getDeptName(), monthlyDTO); 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++){ for ( int i = 0; i < deptScore.getValue().size(); i++){
// 区直街道的总分 就是 治理能力 // 区直街道的总分 就是 治理能力
monthlyFormDTO.setIndexTotal(deptScore.getValue().get(i).getScore()); 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(), monthlyFormDTO = this.setValueAbilityMonthlyFor(deptScore.getValue().get(i).getIndexCode(),
deptScore.getValue().get(i).getWeight(),
deptScore.getValue().get(i).getScore(), deptScore.getValue().get(i).getScore(),
monthlyFormDTO); monthlyFormDTO);
} }
@ -633,6 +651,7 @@ public class FactIndexCollectServiceImpl implements FactIndexCollectService {
} else { } else {
// 赋值 党建能力、治理能力、服务能力 // 赋值 党建能力、治理能力、服务能力
monthlyFormDTO = this.setValueAbilityMonthlyFor(agencyScore.getValue().get(i).getIndexCode(), monthlyFormDTO = this.setValueAbilityMonthlyFor(agencyScore.getValue().get(i).getIndexCode(),
agencyScore.getValue().get(i).getWeight(),
agencyScore.getValue().get(i).getScore(), agencyScore.getValue().get(i).getScore(),
monthlyFormDTO); monthlyFormDTO);
} }
@ -686,23 +705,28 @@ public class FactIndexCollectServiceImpl implements FactIndexCollectService {
/** /**
* 赋实际值 党建能力治理能力服务能力 * 赋实际值 党建能力治理能力服务能力
* @param IndexCode 组织类别 * @param IndexCode 组织类别
* @param weight 权重同一组权重总和=1
* @param Score 分数 * @param Score 分数
* @param monthlyFormDTO 待保存的数据 * @param monthlyFormDTO 待保存的数据
* @return com.epmet.dto.screencoll.form.IndexDataMonthlyFormDTO * @return com.epmet.dto.screencoll.form.IndexDataMonthlyFormDTO
* @Author zhangyong * @Author zhangyong
* @Date 09:26 2020-09-04 * @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)){ if (IndexCodeEnum.DANG_JIAN_NENG_LI.getCode().equals(IndexCode)){
// 党建能力 // 党建能力
monthlyFormDTO.setPartyDevAblity(Score); monthlyFormDTO.setPartyDevAblity(Score);
// 9.12 增加权重
monthlyFormDTO.setPartyDevWeight(weight);
} else if (IndexCodeEnum.ZHI_LI_NENG_LI.getCode().equals(IndexCode)){ } else if (IndexCodeEnum.ZHI_LI_NENG_LI.getCode().equals(IndexCode)){
// 治理能力 // 治理能力
monthlyFormDTO.setGovernAblity(Score); monthlyFormDTO.setGovernAblity(Score);
monthlyFormDTO.setGovernAblityWeight(weight);
} else if (IndexCodeEnum.FU_WU_NENG_LI.getCode().equals(IndexCode)){ } else if (IndexCodeEnum.FU_WU_NENG_LI.getCode().equals(IndexCode)){
// 服务能力 // 服务能力
monthlyFormDTO.setServiceAblity(Score); monthlyFormDTO.setServiceAblity(Score);
monthlyFormDTO.setServiceAblityWeight(weight);
} }
return monthlyFormDTO; return monthlyFormDTO;
} }

13
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.commons.mybatis.service.BaseService;
import com.epmet.entity.evaluationindex.screen.IndexGroupDetailEntity; import com.epmet.entity.evaluationindex.screen.IndexGroupDetailEntity;
import java.math.BigDecimal;
import java.util.List; import java.util.List;
/** /**
@ -31,8 +32,18 @@ import java.util.List;
public interface IndexGroupDetailService extends BaseService<IndexGroupDetailEntity> { public interface IndexGroupDetailService extends BaseService<IndexGroupDetailEntity> {
/** /**
* desc根据all_parent_index_code 获取指标明细 * desc根据all_parent_index_code 获取指标明细
*
* @param customerId * @param customerId
* @param indexCode * @param indexCode
*/ */
List<IndexGroupDetailEntity> getDetailListByParentCode(String customerId,String... indexCode); List<IndexGroupDetailEntity> getDetailListByParentCode(String customerId, String... indexCode);
/**
* desc根据all_parent_index_code 获取指标权重
* 如果获取不到 返回-1 表明数据有误
*
* @param customerId
* @param allPathIndexCode
*/
BigDecimal getWeightByAllPathIndexCode(String customerId, String allPathIndexCode);
} }

38
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.dynamic.datasource.annotation.DataSource;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; 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.constant.StrConstant;
import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.exception.RenException;
import com.epmet.constant.DataSourceConstant; import com.epmet.constant.DataSourceConstant;
import com.epmet.dao.evaluationindex.screen.IndexGroupDetailDao; import com.epmet.dao.evaluationindex.screen.IndexGroupDetailDao;
import com.epmet.entity.evaluationindex.screen.IndexGroupDetailEntity; import com.epmet.entity.evaluationindex.screen.IndexGroupDetailEntity;
import com.epmet.redis.IndexCalRedis;
import com.epmet.service.evaluationindex.screen.IndexGroupDetailService; 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.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.math.BigDecimal;
import java.util.List; 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 * @author generator generator@elink-cn.com
* @since v1.0.0 2020-08-19 * @since v1.0.0 2020-08-19
*/ */
@Slf4j
@Service @Service
@DataSource(DataSourceConstant.EVALUATION_INDEX) @DataSource(DataSourceConstant.EVALUATION_INDEX)
public class IndexGroupDetailServiceImpl extends BaseServiceImpl<IndexGroupDetailDao, IndexGroupDetailEntity> implements IndexGroupDetailService { public class IndexGroupDetailServiceImpl extends BaseServiceImpl<IndexGroupDetailDao, IndexGroupDetailEntity> implements IndexGroupDetailService {
@Autowired
private IndexCalRedis indexCalRedis;
@Override @Override
public List<IndexGroupDetailEntity> getDetailListByParentCode(String customerId,String... indexCode) { public List<IndexGroupDetailEntity> getDetailListByParentCode(String customerId, String... indexCode) {
if (indexCode == null || indexCode.length == 0){ if (indexCode == null || indexCode.length == 0) {
throw new RenException("参数错误"); throw new RenException("参数错误");
} }
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
for (String code:indexCode){ for (String code : indexCode) {
sb.append(code).append(StrConstant.COLON); 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<String, BigDecimal> indexCodeFiledReMap = indexCalRedis.getIndexCodeWeightMap(customerId);
if (CollectionUtils.isEmpty(indexCodeFiledReMap)) {
List<IndexGroupDetailEntity> 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;
}
} }

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

@ -37,7 +37,7 @@ public class BatchScoreCalculator {
} }
/** /**
* 执行计算以样本的所有指标总得分及明细分数值 * 执行计算以样本的所有指标总得分原始值及明细分数归一后的值 不乘以权重
* *
* @param indexInputVOS * @param indexInputVOS
* @return * @return
@ -56,7 +56,9 @@ public class BatchScoreCalculator {
//遍历该指标下的每个数据 //遍历该指标下的每个数据
for (SampleValue vo : indexValueVOs) { for (SampleValue vo : indexValueVOs) {
String sampleId = vo.getSampleId(); String sampleId = vo.getSampleId();
BigDecimal score = scoreCalculator.normalize(getFinalSampleValue(vo.getSampleValue(), threshold), weight).setScale(6, RoundingMode.HALF_UP); //归一后的值
BigDecimal normalizeValue = getFinalSampleValue(vo.getSampleValue(), threshold);
BigDecimal score = scoreCalculator.normalize(normalizeValue, weight).setScale(6, RoundingMode.HALF_UP);
CalculateResult result = scoreCountOfSamples.get(sampleId); CalculateResult result = scoreCountOfSamples.get(sampleId);
if (result == null) { if (result == null) {
@ -67,7 +69,7 @@ public class BatchScoreCalculator {
result.setDetails(new ArrayList<>()); result.setDetails(new ArrayList<>());
scoreCountOfSamples.put(sampleId, result); scoreCountOfSamples.put(sampleId, result);
} }
IndexScoreVo sampleScore = new IndexScoreVo(idx.getIndexId(), idx.getAllParentIndexCode(), score); IndexScoreVo sampleScore = new IndexScoreVo(idx.getIndexId(), idx.getAllParentIndexCode(), normalizeValue, idx.getWeight());
result.getDetails().add(sampleScore); result.getDetails().add(sampleScore);
result.setTotalScore(result.getTotalScore().add(score).setScale(6, RoundingMode.HALF_UP)); result.setTotalScore(result.getTotalScore().add(score).setScale(6, RoundingMode.HALF_UP));
} }

4
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 score;
/**
* 该指标的权重
*/
private BigDecimal weight;
} }

53
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/AgencyScoreDao.xml

@ -5,7 +5,8 @@
<!-- 【街道】中间表插入 --> <!-- 【街道】中间表插入 -->
<insert id="insertStreetRecord"> <insert id="insertStreetRecord">
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 VALUES
<foreach collection="lists" item="item" separator=","> <foreach collection="lists" item="item" separator=",">
( (
@ -21,6 +22,7 @@
#{item.score}, #{item.score},
#{item.indexCode}, #{item.indexCode},
#{item.allParentIndexCode}, #{item.allParentIndexCode},
#{item.weight},
#{item.delFlag}, #{item.delFlag},
#{item.revision}, #{item.revision},
#{item.createdBy}, #{item.createdBy},
@ -53,7 +55,8 @@
MONTH_ID monthId, MONTH_ID monthId,
IS_TOTAL isTotal, IS_TOTAL isTotal,
SCORE score, SCORE score,
INDEX_CODE indexCode INDEX_CODE indexCode,
WEIGHT weight
FROM FROM
fact_index_agency_score fact_index_agency_score
WHERE WHERE
@ -107,52 +110,6 @@
GROUP BY fics.parent_agency_id GROUP BY fics.parent_agency_id
</select> </select>
<insert id="batchInsertAgencyScoreData" parameterType="map">
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
<foreach collection="list" item="item" index="index" separator=",">
(
(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()
)
</foreach>
</insert>
<select id="selectListAgencyId" resultType="String"> <select id="selectListAgencyId" resultType="String">
SELECT SELECT

4
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/AgencySubScoreDao.xml

@ -5,7 +5,8 @@
<!-- 【街道】中间表插入 --> <!-- 【街道】中间表插入 -->
<insert id="insertStreetRecord"> <insert id="insertStreetRecord">
INSERT INTO fact_index_agency_sub_score (ID, CUSTOMER_ID, AGENCY_ID, PARENT_AGENCY_ID, YEAR_ID, QUARTER_ID, MONTH_ID, DATA_TYPE, SCORE, INDEX_CODE,ALL_PARENT_INDEX_CODE, DEL_FLAG, REVISION, CREATED_BY, CREATED_TIME, UPDATED_BY, UPDATED_TIME ) INSERT INTO fact_index_agency_sub_score (ID, CUSTOMER_ID, AGENCY_ID, PARENT_AGENCY_ID, YEAR_ID, QUARTER_ID, MONTH_ID, DATA_TYPE, SCORE, INDEX_CODE,ALL_PARENT_INDEX_CODE,
WEIGHT,DEL_FLAG, REVISION, CREATED_BY, CREATED_TIME, UPDATED_BY, UPDATED_TIME )
VALUES VALUES
<foreach collection="lists" item="item" separator=","> <foreach collection="lists" item="item" separator=",">
( (
@ -20,6 +21,7 @@
#{item.score}, #{item.score},
#{item.indexCode}, #{item.indexCode},
#{item.allParentIndexCode}, #{item.allParentIndexCode},
#{item.weight},
#{item.delFlag}, #{item.delFlag},
#{item.revision}, #{item.revision},
#{item.createdBy}, #{item.createdBy},

49
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/CommunityScoreDao.xml

@ -5,7 +5,8 @@
<!-- 党建能力【社区】中间表插入 --> <!-- 党建能力【社区】中间表插入 -->
<insert id="insertCommunityPartyRecord"> <insert id="insertCommunityPartyRecord">
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,ALL_PARENT_INDEX_CODE, DEL_FLAG, REVISION, CREATED_BY, CREATED_TIME, UPDATED_BY, UPDATED_TIME ) 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,ALL_PARENT_INDEX_CODE,
WEIGHT,DEL_FLAG, REVISION, CREATED_BY, CREATED_TIME, UPDATED_BY, UPDATED_TIME )
VALUES VALUES
<foreach collection="lists" item="item" separator=","> <foreach collection="lists" item="item" separator=",">
( (
@ -20,6 +21,7 @@
#{item.score}, #{item.score},
#{item.indexCode}, #{item.indexCode},
#{item.allParentIndexCode}, #{item.allParentIndexCode},
#{item.weight},
#{item.delFlag}, #{item.delFlag},
#{item.revision}, #{item.revision},
#{item.createdBy}, #{item.createdBy},
@ -96,7 +98,8 @@
MONTH_ID monthId, MONTH_ID monthId,
IS_TOTAL isTotal, IS_TOTAL isTotal,
SCORE score, SCORE score,
INDEX_CODE indexCode INDEX_CODE indexCode,
WEIGHT weight
FROM FROM
fact_index_community_score fact_index_community_score
WHERE WHERE
@ -106,48 +109,6 @@
ORDER BY AGENCY_ID ORDER BY AGENCY_ID
</select> </select>
<insert id="batchInsertCommunityScoreData" parameterType="map">
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
<foreach collection="list" item="item" index="index" separator=",">
(
(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()
)
</foreach>
</insert>
<select id="selectListCommunityId" resultType="String"> <select id="selectListCommunityId" resultType="String">
SELECT SELECT

4
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/CommunitySubScoreDao.xml

@ -5,7 +5,8 @@
<!-- 党建能力【社区】中间表插入 --> <!-- 党建能力【社区】中间表插入 -->
<insert id="insertCommunityPartyRecord"> <insert id="insertCommunityPartyRecord">
INSERT INTO fact_index_community_sub_score ( ID, CUSTOMER_ID, AGENCY_ID, PARENT_AGENCY_ID, YEAR_ID, QUARTER_ID, MONTH_ID, SCORE, INDEX_CODE,ALL_PARENT_INDEX_CODE, DEL_FLAG, REVISION, CREATED_BY, CREATED_TIME, UPDATED_BY, UPDATED_TIME ) INSERT INTO fact_index_community_sub_score ( ID, CUSTOMER_ID, AGENCY_ID, PARENT_AGENCY_ID, YEAR_ID, QUARTER_ID, MONTH_ID, SCORE, INDEX_CODE,ALL_PARENT_INDEX_CODE,
WEIGHT,DEL_FLAG, REVISION, CREATED_BY, CREATED_TIME, UPDATED_BY, UPDATED_TIME )
VALUES VALUES
<foreach collection="lists" item="item" separator=","> <foreach collection="lists" item="item" separator=",">
( (
@ -19,6 +20,7 @@
#{item.score}, #{item.score},
#{item.indexCode}, #{item.indexCode},
#{item.allParentIndexCode}, #{item.allParentIndexCode},
#{item.weight},
#{item.delFlag}, #{item.delFlag},
#{item.revision}, #{item.revision},
#{item.createdBy}, #{item.createdBy},

2
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/CpcScoreDao.xml

@ -116,6 +116,7 @@
`SCORE`, `SCORE`,
`INDEX_CODE`, `INDEX_CODE`,
`ALL_PARENT_INDEX_CODE`, `ALL_PARENT_INDEX_CODE`,
WEIGHT,
`DEL_FLAG`, `DEL_FLAG`,
`REVISION`, `REVISION`,
`CREATED_BY`, `CREATED_BY`,
@ -137,6 +138,7 @@
#{item.score}, #{item.score},
#{item.indexCode}, #{item.indexCode},
#{item.allParentIndexCode}, #{item.allParentIndexCode},
#{item.weight},
0, 0,
0, 0,
'APP_USER', 'APP_USER',

2
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/CpcSubScoreDao.xml

@ -113,6 +113,7 @@
`SCORE`, `SCORE`,
`INDEX_CODE`, `INDEX_CODE`,
`ALL_PARENT_INDEX_CODE`, `ALL_PARENT_INDEX_CODE`,
WEIGHT,
`DEL_FLAG`, `DEL_FLAG`,
`REVISION`, `REVISION`,
`CREATED_BY`, `CREATED_BY`,
@ -133,6 +134,7 @@
#{item.score}, #{item.score},
#{item.indexCode}, #{item.indexCode},
#{item.allParentIndexCode}, #{item.allParentIndexCode},
#{item.weight},
0, 0,
0, 0,
'APP_USER', 'APP_USER',

5
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/DeptScoreDao.xml

@ -11,7 +11,8 @@
MONTH_ID monthId, MONTH_ID monthId,
IS_TOTAL isTotal, IS_TOTAL isTotal,
SCORE score, SCORE score,
INDEX_CODE indexCode INDEX_CODE indexCode,
WEIGHT weight
FROM FROM
fact_index_dept_score fact_index_dept_score
WHERE WHERE
@ -83,6 +84,7 @@
SCORE, SCORE,
INDEX_CODE, INDEX_CODE,
ALL_PARENT_INDEX_CODE, ALL_PARENT_INDEX_CODE,
WEIGHT,
DEL_FLAG, DEL_FLAG,
REVISION, REVISION,
CREATED_BY, CREATED_BY,
@ -103,6 +105,7 @@
#{item.score}, #{item.score},
#{item.indexCode}, #{item.indexCode},
#{item.allParentIndexCode}, #{item.allParentIndexCode},
#{item.weight},
0, 0,
0, 0,
'APP_USER', 'APP_USER',

2
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/DeptSubScoreDao.xml

@ -16,6 +16,7 @@
SCORE, SCORE,
INDEX_CODE, INDEX_CODE,
ALL_PARENT_INDEX_CODE, ALL_PARENT_INDEX_CODE,
WEIGHT,
DEL_FLAG, DEL_FLAG,
REVISION, REVISION,
CREATED_BY, CREATED_BY,
@ -35,6 +36,7 @@
#{item.score}, #{item.score},
#{item.indexCode}, #{item.indexCode},
#{item.allParentIndexCode}, #{item.allParentIndexCode},
#{item.weight},
0, 0,
0, 0,
'APP_USER', 'APP_USER',

7
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/GridScoreDao.xml

@ -52,6 +52,7 @@
`SCORE`, `SCORE`,
`INDEX_CODE`, `INDEX_CODE`,
ALL_PARENT_INDEX_CODE, ALL_PARENT_INDEX_CODE,
WEIGHT,
`DEL_FLAG`, `DEL_FLAG`,
`REVISION`, `REVISION`,
`CREATED_BY`, `CREATED_BY`,
@ -74,6 +75,7 @@
#{item.score}, #{item.score},
#{item.indexCode}, #{item.indexCode},
#{item.allParentIndexCode}, #{item.allParentIndexCode},
#{item.weight},
0, 0,
0, 0,
'APP_USER', 'APP_USER',
@ -152,7 +154,8 @@
MONTH_ID monthId, MONTH_ID monthId,
IS_TOTAL isTotal, IS_TOTAL isTotal,
SCORE score, SCORE score,
INDEX_CODE indexCode INDEX_CODE indexCode,
WEIGHT weight
FROM FROM
fact_index_grid_score fact_index_grid_score
WHERE WHERE
@ -175,4 +178,4 @@
ORDER BY GRID_ID ORDER BY GRID_ID
</select> </select>
</mapper> </mapper>

2
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/GridSubScoreDao.xml

@ -17,6 +17,7 @@
`SCORE`, `SCORE`,
`INDEX_CODE`, `INDEX_CODE`,
ALL_PARENT_INDEX_CODE, ALL_PARENT_INDEX_CODE,
WEIGHT,
`DEL_FLAG`, `DEL_FLAG`,
`REVISION`, `REVISION`,
`CREATED_BY`, `CREATED_BY`,
@ -38,6 +39,7 @@
#{item.score}, #{item.score},
#{item.indexCode}, #{item.indexCode},
#{item.allParentIndexCode}, #{item.allParentIndexCode},
#{item.weight},
0, 0,
0, 0,
'APP_USER', 'APP_USER',

6
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' CUSTOMER_ID = #{customerId,jdbcType=VARCHAR} and STATUS = 'enable' and DEL_FLAG = '0'
and ALL_PARENT_INDEX_CODE = #{indexCode,jdbcType=VARCHAR} and ALL_PARENT_INDEX_CODE = #{indexCode,jdbcType=VARCHAR}
</select> </select>
<select id="getAllIndexWeightList" resultType="com.epmet.entity.evaluationindex.screen.IndexGroupDetailEntity">
select ID, concat(ALL_PARENT_INDEX_CODE,':',INDEX_CODE) INDEX_CODE, WEIGHT, THRESHOLD FROM index_group_detail
WHERE
CUSTOMER_ID = #{customerId,jdbcType=VARCHAR} and STATUS = 'enable' and DEL_FLAG = '0'
</select>
</mapper> </mapper>

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

@ -24,6 +24,9 @@
PARTY_DEV_ABLITY, PARTY_DEV_ABLITY,
SERVICE_ABLITY, SERVICE_ABLITY,
GOVERN_ABLITY, GOVERN_ABLITY,
PARTY_DEV_WEIGHT,
SERVICE_ABLITY_WEIGHT,
GOVERN_ABLITY_WEIGHT,
DEL_FLAG, DEL_FLAG,
REVISION, REVISION,
CREATED_BY, CREATED_BY,
@ -46,6 +49,9 @@
#{item.partyDevAblity}, #{item.partyDevAblity},
#{item.serviceAblity}, #{item.serviceAblity},
#{item.governAblity}, #{item.governAblity},
#{item.partyDevWeight},
#{item.serviceAblityWeight},
#{item.governAblityWeight},
0, 0,
0, 0,
'APP_USER', 'APP_USER',

2
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; package com.epmet.stats.test.normalizing;
import com.alibaba.fastjson.JSON;
import com.epmet.support.normalizing.*; import com.epmet.support.normalizing.*;
import com.epmet.support.normalizing.batch.*; import com.epmet.support.normalizing.batch.*;
import org.junit.Test; import org.junit.Test;
@ -233,6 +234,7 @@ public class DemoScoreCal {
List<IndexInputVO> indexInputVOS = Arrays.asList(index1VO, index2VO, index3VO, index4VO); List<IndexInputVO> indexInputVOS = Arrays.asList(index1VO, index2VO, index3VO, index4VO);
BatchScoreCalculator batchScoreCalculator = new BatchScoreCalculator(); BatchScoreCalculator batchScoreCalculator = new BatchScoreCalculator();
System.out.println("param:" + JSON.toJSONString(indexInputVOS));
HashMap<String, BigDecimal> result = batchScoreCalculator.getScoreCountOfSampleId(indexInputVOS); HashMap<String, BigDecimal> result = batchScoreCalculator.getScoreCountOfSampleId(indexInputVOS);
HashMap<String, CalculateResult> result2 = batchScoreCalculator.getScoreTotalOfSampleId(indexInputVOS); HashMap<String, CalculateResult> result2 = batchScoreCalculator.getScoreTotalOfSampleId(indexInputVOS);

8
epmet-user/epmet-user-server/src/main/resources/mapper/GovStaffRoleDao.xml

@ -82,8 +82,10 @@
gsr.del_flag = 0 gsr.del_flag = 0
AND sr.del_flag = 0 AND sr.del_flag = 0
AND AND
<foreach collection="userIds" item="userId" separator="OR"> (
sr.staff_id = #{userId} <foreach collection="userIds" item="userId" separator="OR">
</foreach> sr.staff_id = #{userId}
</foreach>
)
</select> </select>
</mapper> </mapper>
Loading…
Cancel
Save