|
@ -12,7 +12,6 @@ import com.epmet.dao.evaluationindex.indexcal.CommunityScoreDao; |
|
|
import com.epmet.dao.evaluationindex.indexcoll.FactIndexGovrnAblityOrgMonthlyDao; |
|
|
import com.epmet.dao.evaluationindex.indexcoll.FactIndexGovrnAblityOrgMonthlyDao; |
|
|
import com.epmet.dao.evaluationindex.indexcoll.FactIndexPartyAblityOrgMonthlyDao; |
|
|
import com.epmet.dao.evaluationindex.indexcoll.FactIndexPartyAblityOrgMonthlyDao; |
|
|
import com.epmet.dao.evaluationindex.indexcoll.FactIndexServiceAblityOrgMonthlyDao; |
|
|
import com.epmet.dao.evaluationindex.indexcoll.FactIndexServiceAblityOrgMonthlyDao; |
|
|
import com.epmet.dao.evaluationindex.screen.ScreenCustomerAgencyDao; |
|
|
|
|
|
import com.epmet.dto.indexcal.AgencyScoreDTO; |
|
|
import com.epmet.dto.indexcal.AgencyScoreDTO; |
|
|
import com.epmet.dto.indexcal.SubCommunityAvgResultDTO; |
|
|
import com.epmet.dto.indexcal.SubCommunityAvgResultDTO; |
|
|
import com.epmet.dto.screen.result.MaxAndMinBigDecimalResultDTO; |
|
|
import com.epmet.dto.screen.result.MaxAndMinBigDecimalResultDTO; |
|
@ -26,6 +25,7 @@ import com.epmet.support.normalizing.Correlation; |
|
|
import com.epmet.support.normalizing.ScoreCalculator; |
|
|
import com.epmet.support.normalizing.ScoreCalculator; |
|
|
import com.epmet.support.normalizing.ScoreConstants; |
|
|
import com.epmet.support.normalizing.ScoreConstants; |
|
|
import com.epmet.support.normalizing.batch.BatchScoreCalculator; |
|
|
import com.epmet.support.normalizing.batch.BatchScoreCalculator; |
|
|
|
|
|
import com.epmet.support.normalizing.batch.CalculateResult; |
|
|
import com.epmet.support.normalizing.batch.IndexInputVO; |
|
|
import com.epmet.support.normalizing.batch.IndexInputVO; |
|
|
import com.epmet.support.normalizing.batch.SampleValue; |
|
|
import com.epmet.support.normalizing.batch.SampleValue; |
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
import lombok.extern.slf4j.Slf4j; |
|
@ -62,8 +62,6 @@ public class IndexCalculateStreetServiceImpl implements IndexCalculateStreetServ |
|
|
private CommunityScoreDao communityScoreDao; |
|
|
private CommunityScoreDao communityScoreDao; |
|
|
@Autowired |
|
|
@Autowired |
|
|
private AgencyScoreDao agencyScoreDao; |
|
|
private AgencyScoreDao agencyScoreDao; |
|
|
@Autowired |
|
|
|
|
|
private ScreenCustomerAgencyDao customerAgencyDao; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* @Description 计算街道相关总分 |
|
|
* @Description 计算街道相关总分 |
|
@ -128,7 +126,7 @@ public class IndexCalculateStreetServiceImpl implements IndexCalculateStreetServ |
|
|
index1SampleValues.add(s); |
|
|
index1SampleValues.add(s); |
|
|
}); |
|
|
}); |
|
|
BigDecimalScoreCalculator sc = new BigDecimalScoreCalculator(maxAndMinBigDecimal.getMin(), maxAndMinBigDecimal.getMax(), ScoreConstants.MIN_SCORE, ScoreConstants.MAX_SCORE, Correlation.getCorrelation(detail.getCorrelation())); |
|
|
BigDecimalScoreCalculator sc = new BigDecimalScoreCalculator(maxAndMinBigDecimal.getMin(), maxAndMinBigDecimal.getMax(), ScoreConstants.MIN_SCORE, ScoreConstants.MAX_SCORE, Correlation.getCorrelation(detail.getCorrelation())); |
|
|
IndexInputVO index1VO = new IndexInputVO(detail.getIndexId(), detail.getAllParentIndexCode(), index1SampleValues, detail.getThreshold(), detail.getWeight(), sc); |
|
|
IndexInputVO index1VO = new IndexInputVO(detail.getIndexCode(), detail.getAllParentIndexCode(), index1SampleValues, detail.getThreshold(), detail.getWeight(), sc); |
|
|
indexInputVOS.add(index1VO); |
|
|
indexInputVOS.add(index1VO); |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
@ -143,11 +141,7 @@ public class IndexCalculateStreetServiceImpl implements IndexCalculateStreetServ |
|
|
if (StringUtils.isEmpty(fieldName)) { |
|
|
if (StringUtils.isEmpty(fieldName)) { |
|
|
log.error(String.format(IndexCalConstant.INDEX_CODE_NULL, detail.getIndexCode())); |
|
|
log.error(String.format(IndexCalConstant.INDEX_CODE_NULL, detail.getIndexCode())); |
|
|
return; |
|
|
return; |
|
|
} else if (mapList.size() == NumConstant.ONE) { |
|
|
}else{ |
|
|
pid.put(mapList.get(NumConstant.ZERO).get(IndexCalConstant.AGENCY_ID).toString(), mapList.get(NumConstant.ZERO).get(IndexCalConstant.PARENT_ID).toString()); |
|
|
|
|
|
sizeOne(mapList.get(NumConstant.ZERO).get(IndexCalConstant.AGENCY_ID).toString(), customerId, monthId, IndexCodeEnum.DANG_JIAN_NENG_LI.getCode(), pid); |
|
|
|
|
|
return; |
|
|
|
|
|
} else if (mapList.size() > NumConstant.ONE) { |
|
|
|
|
|
MaxAndMinBigDecimalResultDTO maxAndMinBigDecimal = this.getMaxAndMinBigDecimal(mapList.stream().map(m -> new BigDecimal(m.get(fieldName).toString())).collect(Collectors.toList())); |
|
|
MaxAndMinBigDecimalResultDTO maxAndMinBigDecimal = this.getMaxAndMinBigDecimal(mapList.stream().map(m -> new BigDecimal(m.get(fieldName).toString())).collect(Collectors.toList())); |
|
|
List<List<Map<String, Object>>> publishArticleList = ListUtils.partition(mapList, IndexCalConstant.PAGE_SIZE); |
|
|
List<List<Map<String, Object>>> publishArticleList = ListUtils.partition(mapList, IndexCalConstant.PAGE_SIZE); |
|
|
publishArticleList.forEach(publish -> { |
|
|
publishArticleList.forEach(publish -> { |
|
@ -158,16 +152,17 @@ public class IndexCalculateStreetServiceImpl implements IndexCalculateStreetServ |
|
|
SampleValue s = new SampleValue((String) c.get(IndexCalConstant.AGENCY_ID), new BigDecimal(String.valueOf(c.get(fieldName)))); |
|
|
SampleValue s = new SampleValue((String) c.get(IndexCalConstant.AGENCY_ID), new BigDecimal(String.valueOf(c.get(fieldName)))); |
|
|
index1SampleValues.add(s); |
|
|
index1SampleValues.add(s); |
|
|
}); |
|
|
}); |
|
|
IndexInputVO index1VO = new IndexInputVO(detail.getIndexId(), detail.getAllParentIndexCode(), index1SampleValues, detail.getThreshold(), detail.getWeight(), sc1); |
|
|
IndexInputVO index1VO = new IndexInputVO(detail.getIndexCode(), detail.getAllParentIndexCode(), index1SampleValues, detail.getThreshold(), detail.getWeight(), sc1); |
|
|
indexInputVOS.add(index1VO); |
|
|
indexInputVOS.add(index1VO); |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
BatchScoreCalculator batchScoreCalculator = new BatchScoreCalculator(); |
|
|
BatchScoreCalculator batchScoreCalculator = new BatchScoreCalculator(); |
|
|
HashMap<String, BigDecimal> scoreCountOfSampleId = batchScoreCalculator.getScoreCountOfSampleId(indexInputVOS); |
|
|
HashMap<String, CalculateResult> scoreTotalOfSampleId = batchScoreCalculator.getScoreTotalOfSampleId(indexInputVOS); |
|
|
List<AgencyScoreDTO> result = getResult(scoreCountOfSampleId, customerId, monthId, NumConstant.ZERO_STR, IndexCodeEnum.DANG_JIAN_NENG_LI.getCode(), pid); |
|
|
List<AgencyScoreDTO> result = getResultB(scoreTotalOfSampleId, customerId, monthId, NumConstant.ZERO_STR, IndexCodeEnum.DANG_JIAN_NENG_LI.getCode(),IndexCodeEnum.JIE_DAO_XIANG_GUAN.getCode(), pid); |
|
|
deleteAndInsert(customerId, monthId, IndexCodeEnum.DANG_JIAN_NENG_LI.getCode(), result); |
|
|
agencyScoreDao.deleteOldRecord(customerId, monthId, IndexCalConstant.STREET_LEVEL); |
|
|
|
|
|
deleteAndInsert(result); |
|
|
return true; |
|
|
return true; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -203,7 +198,7 @@ public class IndexCalculateStreetServiceImpl implements IndexCalculateStreetServ |
|
|
index1SampleValues.add(s); |
|
|
index1SampleValues.add(s); |
|
|
}); |
|
|
}); |
|
|
BigDecimalScoreCalculator sc = new BigDecimalScoreCalculator(maxAndMinBigDecimal.getMin(), maxAndMinBigDecimal.getMax(), ScoreConstants.MIN_SCORE, ScoreConstants.MAX_SCORE, Correlation.getCorrelation(detail.getCorrelation())); |
|
|
BigDecimalScoreCalculator sc = new BigDecimalScoreCalculator(maxAndMinBigDecimal.getMin(), maxAndMinBigDecimal.getMax(), ScoreConstants.MIN_SCORE, ScoreConstants.MAX_SCORE, Correlation.getCorrelation(detail.getCorrelation())); |
|
|
IndexInputVO index1VO = new IndexInputVO(detail.getIndexId(), detail.getAllParentIndexCode(), index1SampleValues, detail.getThreshold(), detail.getWeight(), sc); |
|
|
IndexInputVO index1VO = new IndexInputVO(detail.getIndexCode(), detail.getAllParentIndexCode(), index1SampleValues, detail.getThreshold(), detail.getWeight(), sc); |
|
|
indexInputVOS.add(index1VO); |
|
|
indexInputVOS.add(index1VO); |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
@ -213,11 +208,7 @@ public class IndexCalculateStreetServiceImpl implements IndexCalculateStreetServ |
|
|
if (CollectionUtils.isEmpty(communityGovernAbility)){ |
|
|
if (CollectionUtils.isEmpty(communityGovernAbility)){ |
|
|
log.error(IndexCalConstant.STREET_GOVERN_ABILITY_NULL); |
|
|
log.error(IndexCalConstant.STREET_GOVERN_ABILITY_NULL); |
|
|
return; |
|
|
return; |
|
|
}else if (communityGovernAbility.size() == NumConstant.ONE) { |
|
|
}else{ |
|
|
pid.put(communityGovernAbility.get(NumConstant.ZERO).get(IndexCalConstant.AGENCY_ID).toString(), communityGovernAbility.get(NumConstant.ZERO).get(IndexCalConstant.PARENT_ID).toString()); |
|
|
|
|
|
sizeOne(communityGovernAbility.get(NumConstant.ZERO).get(IndexCalConstant.AGENCY_ID).toString(), customerId, monthId, IndexCodeEnum.ZHI_LI_NENG_LI.getCode(), pid); |
|
|
|
|
|
return; |
|
|
|
|
|
} else if (communityGovernAbility.size() > NumConstant.ONE) { |
|
|
|
|
|
String fieldNameByIndexCode = indexCodeFieldReService.getFieldNameByIndexCode(detail.getIndexCode()); |
|
|
String fieldNameByIndexCode = indexCodeFieldReService.getFieldNameByIndexCode(detail.getIndexCode()); |
|
|
if (StringUtils.isEmpty(fieldNameByIndexCode)) { |
|
|
if (StringUtils.isEmpty(fieldNameByIndexCode)) { |
|
|
log.error(String.format(IndexCalConstant.INDEX_CODE_NULL,detail.getIndexCode())); |
|
|
log.error(String.format(IndexCalConstant.INDEX_CODE_NULL,detail.getIndexCode())); |
|
@ -234,16 +225,16 @@ public class IndexCalculateStreetServiceImpl implements IndexCalculateStreetServ |
|
|
SampleValue s = new SampleValue((String) c.get(IndexCalConstant.AGENCY_ID), new BigDecimal(String.valueOf(c.get(fieldNameByIndexCode)))); |
|
|
SampleValue s = new SampleValue((String) c.get(IndexCalConstant.AGENCY_ID), new BigDecimal(String.valueOf(c.get(fieldNameByIndexCode)))); |
|
|
index1SampleValues.add(s); |
|
|
index1SampleValues.add(s); |
|
|
}); |
|
|
}); |
|
|
IndexInputVO index1VO = new IndexInputVO(detail.getIndexId(), detail.getAllParentIndexCode(), index1SampleValues, detail.getThreshold(), detail.getWeight(), sc1); |
|
|
IndexInputVO index1VO = new IndexInputVO(detail.getIndexCode(), detail.getAllParentIndexCode(), index1SampleValues, detail.getThreshold(), detail.getWeight(), sc1); |
|
|
indexInputVOS.add(index1VO); |
|
|
indexInputVOS.add(index1VO); |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
BatchScoreCalculator batchScoreCalculator = new BatchScoreCalculator(); |
|
|
BatchScoreCalculator batchScoreCalculator = new BatchScoreCalculator(); |
|
|
HashMap<String, BigDecimal> scoreCountOfSampleId = batchScoreCalculator.getScoreCountOfSampleId(indexInputVOS); |
|
|
HashMap<String, CalculateResult> scoreTotalOfSampleId = batchScoreCalculator.getScoreTotalOfSampleId(indexInputVOS); |
|
|
List<AgencyScoreDTO> result = getResult(scoreCountOfSampleId, customerId, monthId, NumConstant.ZERO_STR, IndexCodeEnum.ZHI_LI_NENG_LI.getCode(), pid); |
|
|
List<AgencyScoreDTO> result = getResultB(scoreTotalOfSampleId, customerId, monthId, NumConstant.ZERO_STR, IndexCodeEnum.ZHI_LI_NENG_LI.getCode(),IndexCodeEnum.JIE_DAO_XIANG_GUAN.getCode(), pid); |
|
|
deleteAndInsert(customerId, monthId, IndexCodeEnum.ZHI_LI_NENG_LI.getCode(), result); |
|
|
deleteAndInsert(result); |
|
|
return true; |
|
|
return true; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -280,7 +271,7 @@ public class IndexCalculateStreetServiceImpl implements IndexCalculateStreetServ |
|
|
SampleValue s = new SampleValue(c.getAgencyId(), c.getScore()); |
|
|
SampleValue s = new SampleValue(c.getAgencyId(), c.getScore()); |
|
|
index1SampleValues.add(s); |
|
|
index1SampleValues.add(s); |
|
|
}); |
|
|
}); |
|
|
IndexInputVO index1VO = new IndexInputVO(detail.getIndexId(), detail.getAllParentIndexCode(), index1SampleValues, detail.getThreshold(), detail.getWeight(), sc1); |
|
|
IndexInputVO index1VO = new IndexInputVO(detail.getIndexCode(), detail.getAllParentIndexCode(), index1SampleValues, detail.getThreshold(), detail.getWeight(), sc1); |
|
|
indexInputVOS.add(index1VO); |
|
|
indexInputVOS.add(index1VO); |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
@ -289,11 +280,7 @@ public class IndexCalculateStreetServiceImpl implements IndexCalculateStreetServ |
|
|
if (CollectionUtils.isEmpty(communityActivityCountList)) { |
|
|
if (CollectionUtils.isEmpty(communityActivityCountList)) { |
|
|
log.error(IndexCalConstant.STREET_SERVICE_ABILITY_NULL); |
|
|
log.error(IndexCalConstant.STREET_SERVICE_ABILITY_NULL); |
|
|
return; |
|
|
return; |
|
|
}else if (communityActivityCountList.size() == NumConstant.ONE) { |
|
|
}else{ |
|
|
pid.put(communityActivityCountList.get(NumConstant.ZERO).get(IndexCalConstant.AGENCY_ID).toString(), communityActivityCountList.get(NumConstant.ZERO).get(IndexCalConstant.PARENT_ID).toString()); |
|
|
|
|
|
sizeOne(communityActivityCountList.get(NumConstant.ZERO).get(IndexCalConstant.AGENCY_ID).toString(), customerId, monthId, IndexCodeEnum.FU_WU_NENG_LI.getCode(), pid); |
|
|
|
|
|
return; |
|
|
|
|
|
} else if (communityActivityCountList.size() > NumConstant.ONE) { |
|
|
|
|
|
String fieldNameByIndexCode = indexCodeFieldReService.getFieldNameByIndexCode(detail.getIndexCode()); |
|
|
String fieldNameByIndexCode = indexCodeFieldReService.getFieldNameByIndexCode(detail.getIndexCode()); |
|
|
if (StringUtils.isEmpty(fieldNameByIndexCode)) { |
|
|
if (StringUtils.isEmpty(fieldNameByIndexCode)) { |
|
|
log.error(String.format(IndexCalConstant.INDEX_CODE_NULL,detail.getIndexCode())); |
|
|
log.error(String.format(IndexCalConstant.INDEX_CODE_NULL,detail.getIndexCode())); |
|
@ -310,17 +297,16 @@ public class IndexCalculateStreetServiceImpl implements IndexCalculateStreetServ |
|
|
SampleValue s = new SampleValue((String) c.get(IndexCalConstant.AGENCY_ID), new BigDecimal(String.valueOf(c.get(fieldNameByIndexCode)))); |
|
|
SampleValue s = new SampleValue((String) c.get(IndexCalConstant.AGENCY_ID), new BigDecimal(String.valueOf(c.get(fieldNameByIndexCode)))); |
|
|
index1SampleValues.add(s); |
|
|
index1SampleValues.add(s); |
|
|
}); |
|
|
}); |
|
|
IndexInputVO index1VO = new IndexInputVO(detail.getIndexId(), detail.getAllParentIndexCode(), index1SampleValues, detail.getThreshold(), detail.getWeight(), sc1); |
|
|
IndexInputVO index1VO = new IndexInputVO(detail.getIndexCode(), detail.getAllParentIndexCode(), index1SampleValues, detail.getThreshold(), detail.getWeight(), sc1); |
|
|
indexInputVOS.add(index1VO); |
|
|
indexInputVOS.add(index1VO); |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
BatchScoreCalculator batchScoreCalculator = new BatchScoreCalculator(); |
|
|
BatchScoreCalculator batchScoreCalculator = new BatchScoreCalculator(); |
|
|
HashMap<String, BigDecimal> scoreCountOfSampleId = batchScoreCalculator.getScoreCountOfSampleId(indexInputVOS); |
|
|
HashMap<String, CalculateResult> scoreTotalOfSampleId = batchScoreCalculator.getScoreTotalOfSampleId(indexInputVOS); |
|
|
List<AgencyScoreDTO> result = getResult(scoreCountOfSampleId, customerId, monthId, NumConstant.ZERO_STR, IndexCodeEnum.FU_WU_NENG_LI.getCode(), pid |
|
|
List<AgencyScoreDTO> result = getResultB(scoreTotalOfSampleId, customerId, monthId, NumConstant.ZERO_STR, IndexCodeEnum.FU_WU_NENG_LI.getCode(),IndexCodeEnum.JIE_DAO_XIANG_GUAN.getCode(), pid); |
|
|
); |
|
|
deleteAndInsert(result); |
|
|
deleteAndInsert(customerId, monthId, IndexCodeEnum.FU_WU_NENG_LI.getCode(), result); |
|
|
|
|
|
return true; |
|
|
return true; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -353,13 +339,14 @@ public class IndexCalculateStreetServiceImpl implements IndexCalculateStreetServ |
|
|
score.setQuarterId(DateUtils.getQuarterId(monthId)); |
|
|
score.setQuarterId(DateUtils.getQuarterId(monthId)); |
|
|
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); |
|
|
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()); |
|
|
}); |
|
|
}); |
|
|
result.add(score); |
|
|
result.add(score); |
|
|
}); |
|
|
}); |
|
|
deleteAndInsert(customerId, monthId, IndexCodeEnum.JIE_DAO_XIANG_GUAN.getCode(), result); |
|
|
deleteAndInsert(result); |
|
|
return true; |
|
|
return true; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -379,18 +366,14 @@ public class IndexCalculateStreetServiceImpl implements IndexCalculateStreetServ |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* @param customerId |
|
|
|
|
|
* @param monthId |
|
|
|
|
|
* @param indexCode |
|
|
|
|
|
* @param subAllCommunityList |
|
|
* @param subAllCommunityList |
|
|
* @Description 先删除记录,在插入 |
|
|
* @Description 先删除记录,在插入 |
|
|
* @author zxc |
|
|
* @author zxc |
|
|
* @date 2020/9/1 4:24 下午 |
|
|
* @date 2020/9/1 4:24 下午 |
|
|
*/ |
|
|
*/ |
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
public void deleteAndInsert(String customerId, String monthId, String indexCode, List<AgencyScoreDTO> subAllCommunityList) { |
|
|
public void deleteAndInsert(List<AgencyScoreDTO> subAllCommunityList) { |
|
|
if (!CollectionUtils.isEmpty(subAllCommunityList)) { |
|
|
if (!CollectionUtils.isEmpty(subAllCommunityList)) { |
|
|
agencyScoreDao.deleteOldRecord(customerId, monthId, indexCode,IndexCalConstant.STREET_LEVEL); |
|
|
|
|
|
agencyScoreDao.insertStreetRecord(subAllCommunityList); |
|
|
agencyScoreDao.insertStreetRecord(subAllCommunityList); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
@ -405,7 +388,7 @@ public class IndexCalculateStreetServiceImpl implements IndexCalculateStreetServ |
|
|
* @author zxc |
|
|
* @author zxc |
|
|
* @date 2020/9/2 2:37 下午 |
|
|
* @date 2020/9/2 2:37 下午 |
|
|
*/ |
|
|
*/ |
|
|
public List<AgencyScoreDTO> getResult(HashMap<String, BigDecimal> scoreCountOfSampleId, String customerId, String monthId, String isTotal, String indexCode, Map<String, String> pid) { |
|
|
public List<AgencyScoreDTO> getResultB(HashMap<String, CalculateResult> scoreCountOfSampleId, String customerId, String monthId, String isTotal, String indexCode, String allParentIndexCode, Map<String, String> pid) { |
|
|
List<AgencyScoreDTO> result = new ArrayList<>(); |
|
|
List<AgencyScoreDTO> result = new ArrayList<>(); |
|
|
scoreCountOfSampleId.forEach((k, v) -> { |
|
|
scoreCountOfSampleId.forEach((k, v) -> { |
|
|
AgencyScoreDTO score = new AgencyScoreDTO(); |
|
|
AgencyScoreDTO score = new AgencyScoreDTO(); |
|
@ -416,29 +399,37 @@ public class IndexCalculateStreetServiceImpl implements IndexCalculateStreetServ |
|
|
score.setYearId(DateUtils.getYearId(monthId)); |
|
|
score.setYearId(DateUtils.getYearId(monthId)); |
|
|
score.setIsTotal(isTotal); |
|
|
score.setIsTotal(isTotal); |
|
|
score.setIndexCode(indexCode); |
|
|
score.setIndexCode(indexCode); |
|
|
score.setScore(v); |
|
|
score.setScore(v.getTotalScore()); |
|
|
|
|
|
score.setAllParentIndexCode(allParentIndexCode); |
|
|
|
|
|
score.setDataType(IndexCalConstant.STREET_LEVEL); |
|
|
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())){ |
|
|
|
|
|
v.getDetails().forEach(streetScore -> { |
|
|
|
|
|
AgencyScoreDTO s = new AgencyScoreDTO(); |
|
|
|
|
|
s.setCustomerId(customerId); |
|
|
|
|
|
s.setAgencyId(k); |
|
|
|
|
|
s.setMonthId(monthId); |
|
|
|
|
|
s.setQuarterId(DateUtils.getQuarterId(monthId)); |
|
|
|
|
|
s.setYearId(DateUtils.getYearId(monthId)); |
|
|
|
|
|
s.setIsTotal(isTotal); |
|
|
|
|
|
s.setIndexCode(streetScore.getIndexCode()); |
|
|
|
|
|
s.setScore(streetScore.getScore()); |
|
|
|
|
|
s.setDataType(IndexCalConstant.STREET_LEVEL); |
|
|
|
|
|
s.setAllParentIndexCode(streetScore.getAllParentIndexCode()); |
|
|
|
|
|
pid.forEach((agency, parentAgency) -> { |
|
|
|
|
|
if (k.equals(agency)) { |
|
|
|
|
|
s.setParentAgencyId(parentAgency); |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
result.add(s); |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
result.add(score); |
|
|
result.add(score); |
|
|
}); |
|
|
}); |
|
|
return result; |
|
|
return result; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* @param agencyId |
|
|
|
|
|
* @param customerId |
|
|
|
|
|
* @param monthId |
|
|
|
|
|
* @Description 当查询结果为一条时,调用此方法 |
|
|
|
|
|
* @author zxc |
|
|
|
|
|
* @date 2020/9/2 2:40 下午 |
|
|
|
|
|
*/ |
|
|
|
|
|
public void sizeOne(String agencyId, String customerId, String monthId, String indexCode, Map<String, String> pid) { |
|
|
|
|
|
HashMap<String, BigDecimal> scoreCountOfSample = new HashMap<>(); |
|
|
|
|
|
scoreCountOfSample.put(agencyId, new BigDecimal(NumConstant.FIFTY)); |
|
|
|
|
|
List<AgencyScoreDTO> result = getResult(scoreCountOfSample, customerId, monthId, NumConstant.ZERO_STR, indexCode, pid); |
|
|
|
|
|
deleteAndInsert(customerId, monthId, indexCode, result); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|