Browse Source

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

dev_shibei_match
yinzuomei 5 years ago
parent
commit
7e1e9062a9
  1. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/AgencyScoreDao.java
  2. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/AgencySubScoreDao.java
  3. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/CommunityScoreDao.java
  4. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/CommunitySubScoreDao.java
  5. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/CpcScoreDao.java
  6. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/CpcSubScoreDao.java
  7. 65
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/CpcIndexCalculateServiceImpl.java
  8. 34
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateCommunityServiceImpl.java
  9. 40
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateDistrictServiceImpl.java
  10. 40
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateStreetServiceImpl.java
  11. 1
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/AgencyScoreDao.xml
  12. 1
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/AgencySubScoreDao.xml
  13. 1
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/CommunityScoreDao.xml
  14. 1
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/CommunitySubScoreDao.xml
  15. 14
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/CpcScoreDao.xml
  16. 10
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/CpcSubScoreDao.xml

2
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/AgencyScoreDao.java

@ -51,7 +51,7 @@ public interface AgencyScoreDao extends BaseDao<AgencyScoreEntity> {
* @author zxc
* @date 2020/9/2 15:47
*/
void deleteOldRecord(@Param("customerId") String customerId, @Param("monthId")String monthId, @Param("dataType")String dataType);
Integer deleteOldRecord(@Param("customerId") String customerId, @Param("monthId")String monthId, @Param("dataType")String dataType,@Param("delNum")Integer delNum);
/**
* @Description 查询fact_index_agency_score相关信息

2
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/AgencySubScoreDao.java

@ -50,6 +50,6 @@ public interface AgencySubScoreDao extends BaseDao<AgencyScoreEntity> {
* @author zxc
* @date 2020/9/2 15:47
*/
void deleteOldRecord(@Param("customerId") String customerId, @Param("monthId") String monthId, @Param("dataType") String dataType);
Integer deleteOldRecord(@Param("customerId") String customerId, @Param("monthId") String monthId, @Param("dataType") String dataType,@Param("delNum")Integer delNum);
}

2
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/CommunityScoreDao.java

@ -50,7 +50,7 @@ public interface CommunityScoreDao extends BaseDao<FactIndexCommunityScoreEntity
* @author zxc
* @date 2020/9/1 9:03 上午
*/
void deleteOldRecord(@Param("customerId") String customerId,@Param("monthId")String monthId);
Integer deleteOldRecord(@Param("customerId") String customerId,@Param("monthId")String monthId,@Param("delNum")Integer delNum);
/**
* @Description 查询社区相关信息

2
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/CommunitySubScoreDao.java

@ -50,6 +50,6 @@ public interface CommunitySubScoreDao extends BaseDao<FactIndexCommunityScoreEnt
* @author zxc
* @date 2020/9/1 9:03 上午
*/
void deleteOldRecord(@Param("customerId") String customerId, @Param("monthId") String monthId);
Integer deleteOldRecord(@Param("customerId") String customerId, @Param("monthId") String monthId,@Param("delNum")Integer delNum);
}

2
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/CpcScoreDao.java

@ -78,7 +78,7 @@ public interface CpcScoreDao extends BaseDao<CpcScoreEntity> {
**/
BigDecimal selectGridJoinIssueAvgValue(@Param("customerId") String customerId, @Param("monthId") String monthId, @Param("gridId") String gridId);
int deleteByMonthId(@Param("customerId") String customerId, @Param("monthId") String monthId, @Param("indexCode") String indexCode);
int deleteByMonthId(@Param("customerId") String customerId, @Param("monthId") String monthId, @Param("indexCode") String indexCode, @Param("deleteSize") Integer deleteSize, @Param("isTotal") String isTotal);
List<CpcScoreEntity> getPartScore(@Param("customerId") String customerId, @Param("monthId") String monthId, @Param("allParentCode") String allParentCode);

2
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/CpcSubScoreDao.java

@ -79,7 +79,7 @@ public interface CpcSubScoreDao extends BaseDao<CpcScoreEntity> {
**/
BigDecimal selectGridJoinIssueAvgValue(@Param("customerId") String customerId, @Param("monthId") String monthId, @Param("gridId") String gridId);
int deleteByMonthId(@Param("customerId") String customerId, @Param("monthId") String monthId, @Param("allParentCode") String allParentCode);
int deleteByMonthId(@Param("customerId") String customerId, @Param("monthId") String monthId, @Param("allParentCode") String allParentCode, @Param("deleteSize") Integer deleteSize);
List<CpcScoreEntity> getPartScore(@Param("customerId") String customerId, @Param("monthId") String monthId, @Param("allParentCode") String allParentCode);

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

@ -29,6 +29,7 @@ import com.epmet.support.normalizing.batch.CalculateResult;
import com.epmet.support.normalizing.batch.IndexInputVO;
import com.epmet.support.normalizing.batch.SampleValue;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.ListUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -36,7 +37,10 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import java.math.BigDecimal;
import java.util.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@Slf4j
@ -95,7 +99,7 @@ public class CpcIndexCalculateServiceImpl implements CpcIndexCalculateService {
totalEntity = ConvertUtils.sourceToTarget(part, CpcScoreEntity.class);
totalEntity.setIsTotal(NumConstant.ONE_STR);
totalEntity.setIndexCode(IndexCodeEnum.DANG_YUAN_XIANG_GUAN.getCode());
totalEntity.setScore(new BigDecimal(0));
totalEntity.setScore(new BigDecimal(NumConstant.ZERO));
totalEntity.setAllParentIndexCode(indexGroupDetailEntity.getAllParentIndexCode());
cpcScoreTotalMap.put(userId, totalEntity);
}
@ -105,7 +109,9 @@ public class CpcIndexCalculateServiceImpl implements CpcIndexCalculateService {
totalEntity.setScore(totalEntity.getScore().add(total));
}
});
deleteAndInsertBatch(formDTO, cpcScoreTotalMap.values().stream().collect(Collectors.toList()), IndexCodeEnum.DANG_YUAN_XIANG_GUAN.getCode());
//删除总分 然后插入
cpcScoreDao.deleteByMonthId(formDTO.getCustomerId(), formDTO.getMonthId(), IndexCodeEnum.DANG_YUAN_XIANG_GUAN.getCode(), IndexCalConstant.DELETE_SIZE, NumConstant.ONE_STR);
insertCpcScoreBatch(formDTO, cpcScoreTotalMap.values().stream().collect(Collectors.toList()), IndexCodeEnum.DANG_YUAN_XIANG_GUAN.getCode());
}
/**
@ -140,10 +146,13 @@ public class CpcIndexCalculateServiceImpl implements CpcIndexCalculateService {
* @param indexCode 指标code 非必填
* @param values
*/
@Transactional(rollbackFor = Exception.class)
private void deleteAndInsertBatch(CalculateCommonFormDTO formDTO, Collection<CpcScoreEntity> values, String indexCode) {
cpcScoreDao.deleteByMonthId(formDTO.getCustomerId(), formDTO.getMonthId(), indexCode);
cpcScoreDao.insertBatch(values);
public void insertCpcScoreBatch(CalculateCommonFormDTO formDTO, List<CpcScoreEntity> values, String indexCode) {
if (CollectionUtils.isEmpty(values)) {
log.error("insertCpcScoreBatch要插入的数据为空,param:{},indexCode:{}", JSON.toJSONString(formDTO), indexCode);
return;
}
List<List<CpcScoreEntity>> partition = ListUtils.partition(values, IndexCalConstant.INSERT_SIZE);
partition.forEach(list -> cpcScoreDao.insertBatch(list));
}
private void calculatePartScore(CalculateCommonFormDTO formDTO) {
@ -161,9 +170,12 @@ public class CpcIndexCalculateServiceImpl implements CpcIndexCalculateService {
}
int pageNo = NumConstant.ONE;
int pageSize = NumConstant.ONE_THOUSAND;
int pageSize = IndexCalConstant.PAGE_SIZE;
//分页查询 要计算的原始数据
List<Map<String, Object>> list = null;
groupIndexDetailsMap.keySet().forEach(indexCode -> {
deleteOldData(formDTO, indexCode);
});
do {
list = factIndexPartyAblityCpcMonthlyDao.getCountByMonthId(formDTO.getCustomerId(), formDTO.getMonthId(), (pageNo - 1) * pageSize, pageSize);
if (!CollectionUtils.isEmpty(list)) {
@ -178,6 +190,20 @@ public class CpcIndexCalculateServiceImpl implements CpcIndexCalculateService {
} while (!CollectionUtils.isEmpty(list) && list.size() == pageSize);
}
@Transactional(rollbackFor = Exception.class)
public void deleteOldData(CalculateCommonFormDTO formDTO, String indexCode) {
int effectRow;
do {
effectRow = cpcScoreDao.deleteByMonthId(formDTO.getCustomerId(), formDTO.getMonthId(), indexCode, IndexCalConstant.DELETE_SIZE, NumConstant.ZERO_STR);
} while (effectRow > NumConstant.ZERO);
effectRow = NumConstant.ZERO;
do {
//删除 党员相关:(参与议事等4级指标的 明细数据)
String allParentCode = IndexCodeEnum.DANG_YUAN_XIANG_GUAN.getCode().concat(StrConstant.COLON).concat(indexCode);
effectRow = cpcSubScoreDao.deleteByMonthId(formDTO.getCustomerId(), formDTO.getMonthId(), allParentCode, IndexCalConstant.DELETE_SIZE);
} while (effectRow > NumConstant.ZERO);
}
/**
* desc计算并保存中间结果
*
@ -213,7 +239,7 @@ public class CpcIndexCalculateServiceImpl implements CpcIndexCalculateService {
cpcScoreEntity.setUserId(userId);
cpcScoreEntity.setIsTotal(NumConstant.ZERO_STR);
cpcScoreEntity.setMonthId(formDTO.getMonthId());
cpcScoreEntity.setScore(new BigDecimal(0));
cpcScoreEntity.setScore(new BigDecimal(NumConstant.ZERO));
cpcScoreEntity.setIndexCode(parentIndexCode);
cpcScoreEntity.setAllParentIndexCode(value.getAllParentIndexCode());
scoreEntityMap.put(userId, cpcScoreEntity);
@ -243,7 +269,6 @@ public class CpcIndexCalculateServiceImpl implements CpcIndexCalculateService {
* @param parentIndexCode
* @param result
*/
@Transactional(rollbackFor = Exception.class)
public void saveCpcScore(CalculateCommonFormDTO formDTO, Map<String, CpcScoreEntity> indexDetails, String parentIndexCode, HashMap<String, CalculateResult> result) {
List<CpcScoreEntity> list = new ArrayList<>();
@ -254,8 +279,8 @@ public class CpcIndexCalculateServiceImpl implements CpcIndexCalculateService {
CalculateResult score = entry.getValue();
CpcScoreEntity cpcScoreEntity = indexDetails.get(userId);
cpcScoreEntity.setScore(score.getTotalScore());
allParentIndexCode = score.getDetails().get(0).getAllParentIndexCode();
cpcScoreEntity.setAllParentIndexCode(allParentIndexCode.substring(0, allParentIndexCode.lastIndexOf(StrConstant.COLON)));
allParentIndexCode = score.getDetails().get(NumConstant.ZERO).getAllParentIndexCode();
cpcScoreEntity.setAllParentIndexCode(allParentIndexCode.substring(NumConstant.ZERO, allParentIndexCode.lastIndexOf(StrConstant.COLON)));
list.add(cpcScoreEntity);
CpcScoreEntity parent = ConvertUtils.sourceToTarget(cpcScoreEntity, CpcScoreEntity.class);
score.getDetails().forEach(o -> {
@ -267,9 +292,8 @@ public class CpcIndexCalculateServiceImpl implements CpcIndexCalculateService {
});
}
System.out.println("value:" + JSON.toJSONString(list));
this.deleteAndInsertBatch(formDTO, list, parentIndexCode);
this.deleteAndInsertSubBatch(formDTO, subList, allParentIndexCode);
this.insertCpcScoreBatch(formDTO, list, parentIndexCode);
this.insertCpcSubScoreBatch(formDTO, subList, allParentIndexCode);
}
/**
@ -279,10 +303,13 @@ public class CpcIndexCalculateServiceImpl implements CpcIndexCalculateService {
* @param subList
* @param parentIndexCode 指标code 非必填
*/
@Transactional(rollbackFor = Exception.class)
public void deleteAndInsertSubBatch(CalculateCommonFormDTO formDTO, List<CpcSubScoreEntity> subList, String parentIndexCode) {
cpcSubScoreDao.deleteByMonthId(formDTO.getCustomerId(), formDTO.getMonthId(), parentIndexCode);
cpcSubScoreDao.insertBatch(subList);
public void insertCpcSubScoreBatch(CalculateCommonFormDTO formDTO, List<CpcSubScoreEntity> subList, String parentIndexCode) {
if (CollectionUtils.isEmpty(subList)) {
log.error("insertCpcScoreBatch要插入的数据为空,param:{},indexCode:{}", JSON.toJSONString(formDTO), parentIndexCode);
return;
}
List<List<CpcSubScoreEntity>> partition = ListUtils.partition(subList, IndexCalConstant.INSERT_SIZE);
partition.forEach(list -> cpcSubScoreDao.insertBatch(list));
}

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

@ -93,8 +93,7 @@ public class IndexCalculateCommunityServiceImpl implements IndexCalculateCommuni
return;
} else {
MaxAndMinBigDecimalResultDTO maxAndMinBigDecimal = this.getMaxAndMinBigDecimal(subGridPartyAvgScore.stream().map(o -> o.getScore()).collect(Collectors.toList()));
Integer indexEnd = NumConstant.TEN;
List<List<SubGridAvgResultDTO>> subPartyAvgList = ListUtils.partition(subGridPartyAvgScore, indexEnd);
List<List<SubGridAvgResultDTO>> subPartyAvgList = ListUtils.partition(subGridPartyAvgScore, IndexCalConstant.PAGE_SIZE);
subPartyAvgList.forEach(party -> {
List<SampleValue> index1SampleValues = new ArrayList<>();
party.forEach(c -> {
@ -141,8 +140,7 @@ public class IndexCalculateCommunityServiceImpl implements IndexCalculateCommuni
HashMap<String, CalculateResult> scoreTotalOfSampleId = batchScoreCalculator.getScoreTotalOfSampleId(indexInputVOS);
log.info("communityPartyCalculate getScoreCountOfSampleId result:{}", JSON.toJSONString(scoreTotalOfSampleId));
CommunityCalResultDTO result = getResultB(scoreTotalOfSampleId, customerId, monthId, NumConstant.ZERO_STR, IndexCodeEnum.DANG_JIAN_NENG_LI.getCode(), IndexCodeEnum.SHE_QU_XIANG_GUAN.getCode(), pid);
communitySubScoreDao.deleteOldRecord(customerId,monthId);
factIndexCommunityScoreDao.deleteOldRecord(customerId, monthId);
deleteOldRecord(customerId,monthId);
deleteAndInsert(result);
return true;
}
@ -385,13 +383,37 @@ public class IndexCalculateCommunityServiceImpl implements IndexCalculateCommuni
@Transactional(rollbackFor = Exception.class)
public void deleteAndInsert(CommunityCalResultDTO result) {
if (!CollectionUtils.isEmpty(result.getOneLevel())) {
factIndexCommunityScoreDao.insertCommunityPartyRecord(result.getOneLevel());
List<List<FactIndexCommunityScoreDTO>> partition = ListUtils.partition(result.getOneLevel(), IndexCalConstant.INSERT_SIZE);
partition.forEach(p -> {
factIndexCommunityScoreDao.insertCommunityPartyRecord(p);
});
}
if (!CollectionUtils.isEmpty(result.getFiveLevel())){
communitySubScoreDao.insertCommunityPartyRecord(result.getFiveLevel());
List<List<FactIndexCommunityScoreDTO>> partition = ListUtils.partition(result.getFiveLevel(), IndexCalConstant.INSERT_SIZE);
partition.forEach(p -> {
communitySubScoreDao.insertCommunityPartyRecord(p);
});
}
}
/**
* @Description
* @param customerId
* @param monthId
* @author zxc
* @date 2020/9/10 2:50 下午
*/
public void deleteOldRecord(String customerId,String monthId){
Integer num;
do {
num = factIndexCommunityScoreDao.deleteOldRecord(customerId, monthId,IndexCalConstant.DELETE_SIZE);
}while (num != NumConstant.ZERO);
Integer subNum;
do {
subNum = communitySubScoreDao.deleteOldRecord(customerId,monthId,IndexCalConstant.DELETE_SIZE);
}while (subNum != NumConstant.ZERO);
}
/**
* @param scoreCountOfSampleId 指标计算结果
* @param customerId 客户ID

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

@ -165,9 +165,8 @@ public class IndexCalculateDistrictServiceImpl implements IndexCalculateDistrict
log.info("districtPartyAbilityCalculate getScoreTotalOfSampleId param:{}", JSON.toJSONString(indexInputVOS));
log.info("districtPartyAbilityCalculate getScoreCountOfSampleId result:{}", JSON.toJSONString(scoreTotalOfSampleId));
AgencyCalResultDTO result = getResultB(scoreTotalOfSampleId, customerId, monthId, NumConstant.ZERO_STR, IndexCodeEnum.DANG_JIAN_NENG_LI.getCode(), IndexCodeEnum.QUAN_QU_XIANG_GUAN.getCode(), pid);
agencyScoreDao.deleteOldRecord(customerId, monthId,IndexCalConstant.DISTRICT_LEVEL);
agencySubScoreDao.deleteOldRecord(customerId,monthId,IndexCalConstant.DISTRICT_LEVEL);
deleteAndInsert(result);
deleteOldRecord(customerId,monthId,IndexCalConstant.DISTRICT_LEVEL);
insertDetail(result);
return true;
}
@ -236,7 +235,7 @@ public class IndexCalculateDistrictServiceImpl implements IndexCalculateDistrict
log.info("districtGovernAbilityCalculate getScoreTotalOfSampleId param:{}", JSON.toJSONString(indexInputVOS));
log.info("districtGovernAbilityCalculate getScoreCountOfSampleId result:{}", JSON.toJSONString(scoreTotalOfSampleId));
AgencyCalResultDTO result = getResultB(scoreTotalOfSampleId, customerId, monthId, NumConstant.ZERO_STR, IndexCodeEnum.ZHI_LI_NENG_LI.getCode(), IndexCodeEnum.QUAN_QU_XIANG_GUAN.getCode(), pid);
deleteAndInsert(result);
insertDetail(result);
return true;
}
@ -286,7 +285,7 @@ public class IndexCalculateDistrictServiceImpl implements IndexCalculateDistrict
log.info("districtServiceAbilityCalculate getScoreTotalOfSampleId param:{}", JSON.toJSONString(indexInputVOS));
log.info("districtServiceAbilityCalculate getScoreCountOfSampleId result:{}", JSON.toJSONString(scoreTotalOfSampleId));
AgencyCalResultDTO result = getResultB(scoreTotalOfSampleId, customerId, monthId, NumConstant.ZERO_STR, IndexCodeEnum.FU_WU_NENG_LI.getCode(), IndexCodeEnum.QUAN_QU_XIANG_GUAN.getCode(), pid);
deleteAndInsert(result);
insertDetail(result);
return true;
}
@ -347,6 +346,25 @@ public class IndexCalculateDistrictServiceImpl implements IndexCalculateDistrict
return result;
}
/**
* @Description
* @param customerId
* @param monthId
* @param dataType 数据类型 街道street全区district
* @author zxc
* @date 2020/9/10 2:50 下午
*/
public void deleteOldRecord(String customerId,String monthId,String dataType){
Integer num;
do {
num = agencyScoreDao.deleteOldRecord(customerId, monthId,dataType,IndexCalConstant.DELETE_SIZE);
}while (num != NumConstant.ZERO);
Integer subNum;
do {
subNum = agencySubScoreDao.deleteOldRecord(customerId,monthId,dataType,IndexCalConstant.DELETE_SIZE);
}while (subNum != NumConstant.ZERO);
}
/**
* @param result
* @Description 先删除记录在插入
@ -354,12 +372,18 @@ public class IndexCalculateDistrictServiceImpl implements IndexCalculateDistrict
* @date 2020/9/1 4:24 下午
*/
@Transactional(rollbackFor = Exception.class)
public void deleteAndInsert(AgencyCalResultDTO result) {
public void insertDetail(AgencyCalResultDTO result) {
if (!CollectionUtils.isEmpty(result.getOneTwoLevel())){
agencyScoreDao.insertStreetRecord(result.getOneTwoLevel());
List<List<AgencyScoreDTO>> partition = ListUtils.partition(result.getOneTwoLevel(), IndexCalConstant.INSERT_SIZE);
partition.forEach(p -> {
agencyScoreDao.insertStreetRecord(p);
});
}
if (!CollectionUtils.isEmpty(result.getFiveLevel())){
agencySubScoreDao.insertStreetRecord(result.getFiveLevel());
List<List<AgencyScoreDTO>> partition = ListUtils.partition(result.getFiveLevel(), IndexCalConstant.INSERT_SIZE);
partition.forEach(p -> {
agencySubScoreDao.insertStreetRecord(p);
});
}
}

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

@ -168,9 +168,8 @@ public class IndexCalculateStreetServiceImpl implements IndexCalculateStreetServ
log.info("streetPartyAbilityCalculate getScoreTotalOfSampleId param:{}", JSON.toJSONString(indexInputVOS));
log.info("streetPartyAbilityCalculate getScoreCountOfSampleId result:{}", JSON.toJSONString(scoreTotalOfSampleId));
AgencyCalResultDTO result = getResultB(scoreTotalOfSampleId, customerId, monthId, NumConstant.ZERO_STR, IndexCodeEnum.DANG_JIAN_NENG_LI.getCode(), IndexCodeEnum.JIE_DAO_XIANG_GUAN.getCode(), pid);
agencySubScoreDao.deleteOldRecord(customerId,monthId,IndexCalConstant.STREET_LEVEL);
agencyScoreDao.deleteOldRecord(customerId, monthId, IndexCalConstant.STREET_LEVEL);
deleteAndInsert(result);
deleteOldRecord(customerId, monthId, IndexCalConstant.STREET_LEVEL);
insertDetail(result);
return true;
}
@ -244,7 +243,7 @@ public class IndexCalculateStreetServiceImpl implements IndexCalculateStreetServ
log.info("streetGovernAbilityCalculate getScoreTotalOfSampleId param:{}", JSON.toJSONString(indexInputVOS));
log.info("streetGovernAbilityCalculate getScoreCountOfSampleId result:{}", JSON.toJSONString(scoreTotalOfSampleId));
AgencyCalResultDTO result = getResultB(scoreTotalOfSampleId, customerId, monthId, NumConstant.ZERO_STR, IndexCodeEnum.ZHI_LI_NENG_LI.getCode(), IndexCodeEnum.JIE_DAO_XIANG_GUAN.getCode(), pid);
deleteAndInsert(result);
insertDetail(result);
return true;
}
@ -318,7 +317,7 @@ public class IndexCalculateStreetServiceImpl implements IndexCalculateStreetServ
log.info("streetServiceAbilityCalculate getScoreTotalOfSampleId param:{}", JSON.toJSONString(indexInputVOS));
log.info("streetServiceAbilityCalculate getScoreCountOfSampleId result:{}", JSON.toJSONString(scoreTotalOfSampleId));
AgencyCalResultDTO result = getResultB(scoreTotalOfSampleId, customerId, monthId, NumConstant.ZERO_STR, IndexCodeEnum.FU_WU_NENG_LI.getCode(), IndexCodeEnum.JIE_DAO_XIANG_GUAN.getCode(), pid);
deleteAndInsert(result);
insertDetail(result);
return true;
}
@ -384,15 +383,40 @@ public class IndexCalculateStreetServiceImpl implements IndexCalculateStreetServ
* @date 2020/9/1 4:24 下午
*/
@Transactional(rollbackFor = Exception.class)
public void deleteAndInsert(AgencyCalResultDTO result) {
public void insertDetail(AgencyCalResultDTO result) {
if (!CollectionUtils.isEmpty(result.getOneTwoLevel())) {
agencyScoreDao.insertStreetRecord(result.getOneTwoLevel());
List<List<AgencyScoreDTO>> partition = ListUtils.partition(result.getOneTwoLevel(), IndexCalConstant.INSERT_SIZE);
partition.forEach(p -> {
agencyScoreDao.insertStreetRecord(p);
});
}
if (!CollectionUtils.isEmpty(result.getFiveLevel())){
agencySubScoreDao.insertStreetRecord(result.getFiveLevel());
List<List<AgencyScoreDTO>> partition = ListUtils.partition(result.getFiveLevel(), IndexCalConstant.INSERT_SIZE);
partition.forEach(p -> {
agencySubScoreDao.insertStreetRecord(p);
});
}
}
/**
* @Description
* @param customerId
* @param monthId
* @param dataType 数据类型 街道street全区district
* @author zxc
* @date 2020/9/10 2:50 下午
*/
public void deleteOldRecord(String customerId,String monthId,String dataType){
Integer num;
do {
num = agencyScoreDao.deleteOldRecord(customerId, monthId,dataType,IndexCalConstant.DELETE_SIZE);
}while (num != NumConstant.ZERO);
Integer subNum;
do {
subNum = agencySubScoreDao.deleteOldRecord(customerId,monthId,dataType,IndexCalConstant.DELETE_SIZE);
}while (subNum != NumConstant.ZERO);
}
/**
* @param scoreCountOfSampleId 指标计算结果
* @param customerId 客户ID

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

@ -41,6 +41,7 @@
AND customer_id = #{customerId}
AND month_id = #{monthId}
AND data_type = #{dataType}
LIMIT #{delNum}
</delete>
<select id="selectListAgencyScore" resultType="com.epmet.dto.indexcal.AgencyScoreDTO">

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

@ -40,6 +40,7 @@
AND customer_id = #{customerId}
AND month_id = #{monthId}
AND data_type = #{dataType}
LIMIT #{delNum}
</delete>
</mapper>

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

@ -39,6 +39,7 @@
del_flag = '0'
AND customer_id = #{customerId}
AND month_id = #{monthId}
LIMIT #{delNum}
</delete>
<!-- 查询社区相关信息 -->

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

@ -38,6 +38,7 @@
del_flag = '0'
AND customer_id = #{customerId}
AND month_id = #{monthId}
LIMIT #{delNum}
</delete>
</mapper>

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

@ -6,11 +6,15 @@
<delete id="deleteByMonthId">
delete from fact_index_cpc_score
where
CUSTOMER_ID = #{customerId,jdbcType=VARCHAR}
and MONTH_ID = #{monthId,jdbcType=VARCHAR}
<if test="indexCode != null and indexCode !=''">
and INDEX_CODE = #{indexCode,jdbcType=VARCHAR}
</if>
CUSTOMER_ID = #{customerId,jdbcType=VARCHAR}
AND MONTH_ID = #{monthId,jdbcType=VARCHAR}
AND IS_TOTAL = #{isTotal,jdbcType=VARCHAR}
<if test="indexCode != null and indexCode !=''">
and INDEX_CODE = #{indexCode,jdbcType=VARCHAR}
</if>
<if test="deleteSize != null">
limit #{deleteSize,jdbcType=INTEGER}
</if>
</delete>
<resultMap type="com.epmet.entity.evaluationindex.indexcal.CpcScoreEntity" id="cpcScoreMap">

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

@ -6,10 +6,12 @@
<delete id="deleteByMonthId">
delete from fact_index_cpc_sub_score
where
CUSTOMER_ID = #{customerId,jdbcType=VARCHAR}
and MONTH_ID = #{monthId,jdbcType=VARCHAR}
and ALL_PARENT_INDEX_CODE = #{allParentCode,jdbcType=VARCHAR}
CUSTOMER_ID = #{customerId,jdbcType=VARCHAR}
and MONTH_ID = #{monthId,jdbcType=VARCHAR}
and ALL_PARENT_INDEX_CODE = #{allParentCode,jdbcType=VARCHAR}
<if test="deleteSize != null">
limit #{deleteSize,jdbcType=INTEGER}
</if>
</delete>
<resultMap type="com.epmet.entity.evaluationindex.indexcal.CpcScoreEntity" id="cpcScoreMap">

Loading…
Cancel
Save