|
|
@ -22,14 +22,19 @@ import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; |
|
|
|
import com.epmet.commons.tools.constant.NumConstant; |
|
|
|
import com.epmet.commons.tools.constant.StrConstant; |
|
|
|
import com.epmet.commons.tools.exception.RenException; |
|
|
|
import com.epmet.commons.tools.utils.DateUtils; |
|
|
|
import com.epmet.constant.IndexCalConstant; |
|
|
|
import com.epmet.dao.evaluationindex.indexcal.DeptScoreDao; |
|
|
|
import com.epmet.dao.evaluationindex.indexcoll.FactIndexGovrnAblityDeptMonthlyDao; |
|
|
|
import com.epmet.dao.evaluationindex.screen.ScreenCustomerDeptDao; |
|
|
|
import com.epmet.dto.indexcal.CalculateCommonFormDTO; |
|
|
|
import com.epmet.entity.evaluationindex.indexcal.DeptScoreEntity; |
|
|
|
import com.epmet.entity.evaluationindex.indexcoll.FactIndexGovrnAblityDeptMonthlyEntity; |
|
|
|
import com.epmet.entity.evaluationindex.screen.IndexGroupDetailEntity; |
|
|
|
import com.epmet.entity.evaluationindex.screen.ScreenCustomerDeptEntity; |
|
|
|
import com.epmet.eum.IndexCodeEnum; |
|
|
|
import com.epmet.service.evaluationindex.indexcal.DeptScoreService; |
|
|
|
import com.epmet.service.evaluationindex.indexcal.GridCorreLationService; |
|
|
|
import com.epmet.service.evaluationindex.indexcal.IndexCodeFieldReService; |
|
|
|
import com.epmet.service.evaluationindex.screen.IndexGroupDetailService; |
|
|
|
import com.epmet.support.normalizing.BigDecimalScoreCalculator; |
|
|
@ -42,6 +47,7 @@ import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
import org.springframework.util.CollectionUtils; |
|
|
|
|
|
|
|
import java.math.BigDecimal; |
|
|
@ -49,7 +55,6 @@ import java.util.ArrayList; |
|
|
|
import java.util.HashMap; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
@ -67,6 +72,12 @@ public class DeptScoreServiceImpl extends BaseServiceImpl<DeptScoreDao, DeptScor |
|
|
|
private FactIndexGovrnAblityDeptMonthlyDao factIndexGovrnAblityDeptMonthlyDao; |
|
|
|
@Autowired |
|
|
|
private IndexCodeFieldReService indexCodeFieldReService; |
|
|
|
@Autowired |
|
|
|
private GridCorreLationService gridCorreLationService; |
|
|
|
@Autowired |
|
|
|
private ScreenCustomerDeptDao screenCustomerDeptDao; |
|
|
|
@Autowired |
|
|
|
private DeptScoreDao deptScoreDao; |
|
|
|
|
|
|
|
/** |
|
|
|
* @param formDTO |
|
|
@ -94,7 +105,7 @@ public class DeptScoreServiceImpl extends BaseServiceImpl<DeptScoreDao, DeptScor |
|
|
|
return Boolean.FALSE; |
|
|
|
} else if (NumConstant.ONE == total) { |
|
|
|
//只有一个网格时
|
|
|
|
log.warn(String.format("customerId:%s,monthId:%s,only one fact_index_party_ablity_grid_monthly record", formDTO.getCustomerId(), formDTO.getMonthId())); |
|
|
|
log.warn(String.format("customerId:%s,monthId:%s,only one fact_index_govrn_ablity_dept_monthly record", formDTO.getCustomerId(), formDTO.getMonthId())); |
|
|
|
this.handleOneGridScene(formDTO); |
|
|
|
return Boolean.TRUE; |
|
|
|
} |
|
|
@ -146,21 +157,56 @@ public class DeptScoreServiceImpl extends BaseServiceImpl<DeptScoreDao, DeptScor |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
}); |
|
|
|
//保存中间表记录 TODO
|
|
|
|
HashMap<String, BigDecimal> resultMap = gridCorreLationService.calculate(indexMap); |
|
|
|
//保存中间表记录
|
|
|
|
this.saveDeptScoreEntity(formDTO,resultMap); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @return void |
|
|
|
* @param formDTO |
|
|
|
* @param resultMap |
|
|
|
* @author yinzuomei |
|
|
|
* @description fact_index_dept_score |
|
|
|
* @Date 2020/9/3 16:11 |
|
|
|
**/ |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public void saveDeptScoreEntity(CalculateCommonFormDTO formDTO, HashMap<String, BigDecimal> resultMap) { |
|
|
|
String quarterId = DateUtils.getQuarterId(formDTO.getMonthId()); |
|
|
|
String yearId = DateUtils.getYearId(formDTO.getMonthId()); |
|
|
|
resultMap.forEach((deptId, governAblityScore) -> { |
|
|
|
DeptScoreEntity deptScoreEntity = new DeptScoreEntity(); |
|
|
|
deptScoreEntity.setCustomerId(formDTO.getCustomerId()); |
|
|
|
deptScoreEntity.setDeptId(deptId); |
|
|
|
deptScoreEntity.setIsTotal(NumConstant.ZERO_STR); |
|
|
|
deptScoreEntity.setIndexCode(IndexCodeEnum.ZHI_LI_NENG_LI.getCode()); |
|
|
|
ScreenCustomerDeptEntity deptEntity = screenCustomerDeptDao.selectParentAgencyId(formDTO.getCustomerId(), deptId); |
|
|
|
if (null != deptEntity) { |
|
|
|
if(StringUtils.isNotBlank(deptEntity.getParentAgencyId())){ |
|
|
|
deptScoreEntity.setAgencyId(deptEntity.getParentAgencyId()); |
|
|
|
} |
|
|
|
} |
|
|
|
deptScoreEntity.setQuarterId(quarterId); |
|
|
|
deptScoreEntity.setYearId(yearId); |
|
|
|
deptScoreEntity.setMonthId(formDTO.getMonthId()); |
|
|
|
deptScoreEntity.setScore(governAblityScore); |
|
|
|
deptScoreDao.insert(deptScoreEntity); |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @param formDTO |
|
|
|
* @return void |
|
|
|
* @author yinzuomei |
|
|
|
* @description TODO |
|
|
|
* @description |
|
|
|
* @Date 2020/9/3 9:35 |
|
|
|
**/ |
|
|
|
private void handleOneGridScene(CalculateCommonFormDTO formDTO) { |
|
|
|
|
|
|
|
FactIndexGovrnAblityDeptMonthlyEntity entity = factIndexGovrnAblityDeptMonthlyDao.selectOneRecord(formDTO.getCustomerId(), formDTO.getMonthId()); |
|
|
|
HashMap<String, BigDecimal> resultMap = new HashMap<>(); |
|
|
|
resultMap.put(entity.getDeptId(), new BigDecimal(NumConstant.FIFTY_STR)); |
|
|
|
this.saveDeptScoreEntity(formDTO, resultMap); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|