Browse Source

代码优化

dev_shibei_match
zhangyongzhangyong 5 years ago
parent
commit
9794b400ec
  1. 18
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/constant/OrgTypeConstant.java
  2. 111
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/FactIndexCollectServiceImpl.java

18
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/constant/OrgTypeConstant.java

@ -9,7 +9,7 @@
package com.epmet.constant;
/**
* 组织类别 常量
* 组织类别/机关级别 常量
*
* @author sun
* @since 1.0.0
@ -30,4 +30,20 @@ public interface OrgTypeConstant {
* 组织
*/
String AGENCY = "agency";
/**
* 街道
*/
String STREET = "street";
/**
* 区县级
*/
String DISTRICT = "district";
/**
* 社区级
*/
String COMMUNITY = "community";
}

111
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/FactIndexCollectServiceImpl.java

@ -702,46 +702,20 @@ public class FactIndexCollectServiceImpl implements FactIndexCollectService {
indexGridScoreDTO.setDelFlag(NumConstant.ZERO_STR);
insertIndexGridScoreDTOS.add(indexGridScoreDTO);
FactIndexGridScoreDTO indexGridScoreDTO1 = new FactIndexGridScoreDTO();
FactIndexGridScoreDTO indexGridScoreDTO1 = ConvertUtils.sourceToTarget(indexGridScoreDTO, FactIndexGridScoreDTO.class);
// 赋默认值 - 治理能力
indexGridScoreDTO1.setGridId(gridDTO.getGridId());
indexGridScoreDTO1.setAgencyId(gridDTO.getParentAgencyId());
indexGridScoreDTO1.setAllParentIds(gridDTO.getAllParentIds());
indexGridScoreDTO1.setQuarterId(DateUtils.getQuarterId(monthId));
indexGridScoreDTO1.setYearId(getYearStr(monthId));
indexGridScoreDTO1.setMonthId(monthId);
indexGridScoreDTO1.setIsTotal(NumConstant.ZERO_STR);
indexGridScoreDTO1.setScore(zero);
indexGridScoreDTO1.setIndexCode(IndexCodeEnum.ZHI_LI_NENG_LI.getCode());
indexGridScoreDTO1.setDelFlag(NumConstant.ZERO_STR);
insertIndexGridScoreDTOS.add(indexGridScoreDTO1);
FactIndexGridScoreDTO indexGridScoreDTO2 = new FactIndexGridScoreDTO();
FactIndexGridScoreDTO indexGridScoreDTO2 = ConvertUtils.sourceToTarget(indexGridScoreDTO, FactIndexGridScoreDTO.class);
// 赋默认值 - 服务能力
indexGridScoreDTO2.setGridId(gridDTO.getGridId());
indexGridScoreDTO2.setAgencyId(gridDTO.getParentAgencyId());
indexGridScoreDTO2.setAllParentIds(gridDTO.getAllParentIds());
indexGridScoreDTO2.setQuarterId(DateUtils.getQuarterId(monthId));
indexGridScoreDTO2.setYearId(getYearStr(monthId));
indexGridScoreDTO2.setMonthId(monthId);
indexGridScoreDTO2.setIsTotal(NumConstant.ZERO_STR);
indexGridScoreDTO2.setScore(zero);
indexGridScoreDTO2.setIndexCode(IndexCodeEnum.FU_WU_NENG_LI.getCode());
indexGridScoreDTO2.setDelFlag(NumConstant.ZERO_STR);
insertIndexGridScoreDTOS.add(indexGridScoreDTO2);
FactIndexGridScoreDTO indexGridScoreDTO3 = new FactIndexGridScoreDTO();
// 赋默认值 - 网格相关
indexGridScoreDTO3.setGridId(gridDTO.getGridId());
indexGridScoreDTO3.setAgencyId(gridDTO.getParentAgencyId());
indexGridScoreDTO3.setAllParentIds(gridDTO.getAllParentIds());
indexGridScoreDTO3.setQuarterId(DateUtils.getQuarterId(monthId));
indexGridScoreDTO3.setYearId(getYearStr(monthId));
indexGridScoreDTO3.setMonthId(monthId);
FactIndexGridScoreDTO indexGridScoreDTO3 = ConvertUtils.sourceToTarget(indexGridScoreDTO, FactIndexGridScoreDTO.class);
indexGridScoreDTO3.setIsTotal(NumConstant.ONE_STR);
indexGridScoreDTO3.setScore(zero);
// 赋默认值 - 网格相关
indexGridScoreDTO3.setIndexCode(IndexCodeEnum.WANG_GE_XIANG_GUAN.getCode());
indexGridScoreDTO3.setDelFlag(NumConstant.ZERO_STR);
insertIndexGridScoreDTOS.add(indexGridScoreDTO3);
}
factIndexGridScoreDao.batchInsertGridScoreData(insertIndexGridScoreDTOS, customerId);
@ -775,39 +749,19 @@ public class FactIndexCollectServiceImpl implements FactIndexCollectService {
communityScore1.setIndexCode(IndexCodeEnum.DANG_JIAN_NENG_LI.getCode());
insertIndexCommunityScore.add(communityScore1);
FactIndexCommunityScoreEntity communityScore2 = new FactIndexCommunityScoreEntity();
// 赋默认值 - 治理能力
communityScore2.setAgencyId(agencyDTO.getAgencyId());
communityScore2.setParentAgencyId(agencyDTO.getPid());
communityScore2.setQuarterId(DateUtils.getQuarterId(monthId));
communityScore2.setYearId(getYearStr(monthId));
communityScore2.setMonthId(monthId);
communityScore2.setIsTotal(NumConstant.ZERO_STR);
communityScore2.setScore(zero);
FactIndexCommunityScoreEntity communityScore2 = ConvertUtils.sourceToTarget(communityScore1, FactIndexCommunityScoreEntity.class);
communityScore2.setIndexCode(IndexCodeEnum.ZHI_LI_NENG_LI.getCode());
insertIndexCommunityScore.add(communityScore2);
FactIndexCommunityScoreEntity communityScore3 = new FactIndexCommunityScoreEntity();
// 赋默认值 - 服务能力
communityScore3.setAgencyId(agencyDTO.getAgencyId());
communityScore3.setParentAgencyId(agencyDTO.getPid());
communityScore3.setQuarterId(DateUtils.getQuarterId(monthId));
communityScore3.setYearId(getYearStr(monthId));
communityScore3.setMonthId(monthId);
communityScore3.setIsTotal(NumConstant.ZERO_STR);
communityScore3.setScore(zero);
FactIndexCommunityScoreEntity communityScore3 = ConvertUtils.sourceToTarget(communityScore1, FactIndexCommunityScoreEntity.class);
communityScore3.setIndexCode(IndexCodeEnum.FU_WU_NENG_LI.getCode());
insertIndexCommunityScore.add(communityScore3);
FactIndexCommunityScoreEntity communityScore4 = new FactIndexCommunityScoreEntity();
// 赋默认值 - 社区相关
communityScore4.setAgencyId(agencyDTO.getAgencyId());
communityScore4.setParentAgencyId(agencyDTO.getPid());
communityScore4.setQuarterId(DateUtils.getQuarterId(monthId));
communityScore4.setYearId(getYearStr(monthId));
communityScore4.setMonthId(monthId);
FactIndexCommunityScoreEntity communityScore4 = ConvertUtils.sourceToTarget(communityScore1, FactIndexCommunityScoreEntity.class);
communityScore4.setIsTotal(NumConstant.ONE_STR);
communityScore4.setScore(zero);
communityScore4.setIndexCode(IndexCodeEnum.SHE_QU_XIANG_GUAN.getCode());
insertIndexCommunityScore.add(communityScore4);
}
@ -858,8 +812,8 @@ public class FactIndexCollectServiceImpl implements FactIndexCollectService {
BigDecimal zero = new BigDecimal(NumConstant.ZERO);
List<AgencyScoreEntity> insertIndexAgencyScore = new ArrayList<>();
for (ScreenCustomerAgencyEntity agencyDTO : mismatchAgencyList){
if ("community".equals(agencyDTO.getLevel()) || "street".equals(agencyDTO.getLevel())
|| "district".equals(agencyDTO.getLevel())){
if (OrgTypeConstant.COMMUNITY.equals(agencyDTO.getLevel()) || OrgTypeConstant.STREET.equals(agencyDTO.getLevel())
|| OrgTypeConstant.DISTRICT.equals(agencyDTO.getLevel())){
AgencyScoreEntity agencyScore1 = new AgencyScoreEntity();
// 赋默认值 - 党建能力指数
agencyScore1.setAgencyId(agencyDTO.getAgencyId());
@ -873,51 +827,30 @@ public class FactIndexCollectServiceImpl implements FactIndexCollectService {
agencyScore1.setScore(zero);
agencyScore1.setIndexCode(IndexCodeEnum.DANG_JIAN_NENG_LI.getCode());
AgencyScoreEntity agencyScore2 = new AgencyScoreEntity();
AgencyScoreEntity agencyScore2 = ConvertUtils.sourceToTarget(agencyScore1, AgencyScoreEntity.class);
// 赋默认值 - 治理能力
agencyScore2.setAgencyId(agencyDTO.getAgencyId());
agencyScore2.setParentAgencyId(agencyDTO.getPid());
//季度id: yyyyQ1、yyyyQ2、yyyyQ3、yyyyQ4
agencyScore2.setQuarterId(DateUtils.getQuarterId(monthId));
agencyScore2.setYearId(getYearStr(monthId));
agencyScore2.setMonthId(monthId);
agencyScore2.setIsTotal(NumConstant.ZERO_STR);
agencyScore2.setScore(zero);
agencyScore2.setIndexCode(IndexCodeEnum.ZHI_LI_NENG_LI.getCode());
AgencyScoreEntity agencyScore3 = new AgencyScoreEntity();
AgencyScoreEntity agencyScore3 = ConvertUtils.sourceToTarget(agencyScore1, AgencyScoreEntity.class);
// 赋默认值 - 服务能力
agencyScore3.setAgencyId(agencyDTO.getAgencyId());
agencyScore3.setParentAgencyId(agencyDTO.getPid());
agencyScore3.setQuarterId(DateUtils.getQuarterId(monthId));
agencyScore3.setYearId(getYearStr(monthId));
agencyScore3.setMonthId(monthId);
agencyScore3.setIsTotal(NumConstant.ZERO_STR);
agencyScore3.setScore(zero);
agencyScore3.setIndexCode(IndexCodeEnum.FU_WU_NENG_LI.getCode());
AgencyScoreEntity agencyScore4 = new AgencyScoreEntity();
agencyScore4.setAgencyId(agencyDTO.getAgencyId());
agencyScore4.setParentAgencyId(agencyDTO.getPid());
agencyScore4.setQuarterId(DateUtils.getQuarterId(monthId));
agencyScore4.setYearId(getYearStr(monthId));
agencyScore4.setMonthId(monthId);
AgencyScoreEntity agencyScore4 = ConvertUtils.sourceToTarget(agencyScore1, AgencyScoreEntity.class);
agencyScore4.setIsTotal(NumConstant.ONE_STR);
agencyScore4.setScore(zero);
if ("community".equals(agencyDTO.getLevel())){
if (OrgTypeConstant.COMMUNITY.equals(agencyDTO.getLevel())){
// 赋默认值 - 全区相关
agencyScore4.setIndexCode(IndexCodeEnum.QUAN_QU_XIANG_GUAN.getCode());
agencyScore4.setDataType("district");
agencyScore1.setDataType("district");
agencyScore2.setDataType("district");
agencyScore3.setDataType("district");
} else if ("street".equals(agencyDTO.getLevel()) || "district".equals(agencyDTO.getLevel())){
agencyScore4.setDataType(OrgTypeConstant.DISTRICT);
agencyScore1.setDataType(OrgTypeConstant.DISTRICT);
agencyScore2.setDataType(OrgTypeConstant.DISTRICT);
agencyScore3.setDataType(OrgTypeConstant.DISTRICT);
} else if (OrgTypeConstant.STREET.equals(agencyDTO.getLevel()) || OrgTypeConstant.DISTRICT.equals(agencyDTO.getLevel())){
// 赋默认值 - 街道相关
agencyScore4.setIndexCode(IndexCodeEnum.JIE_DAO_XIANG_GUAN.getCode());
agencyScore4.setDataType("street");
agencyScore1.setDataType("street");
agencyScore2.setDataType("street");
agencyScore3.setDataType("street");
agencyScore4.setDataType(OrgTypeConstant.STREET);
agencyScore1.setDataType(OrgTypeConstant.STREET);
agencyScore2.setDataType(OrgTypeConstant.STREET);
agencyScore3.setDataType(OrgTypeConstant.STREET);
}
insertIndexAgencyScore.add(agencyScore1);
insertIndexAgencyScore.add(agencyScore2);

Loading…
Cancel
Save