|
|
|
@ -1,7 +1,10 @@ |
|
|
|
package com.epmet.service.evaluationindex.indexcoll.impl; |
|
|
|
|
|
|
|
import com.epmet.commons.dynamic.datasource.annotation.DataSource; |
|
|
|
import com.epmet.commons.tools.constant.FieldConstant; |
|
|
|
import com.epmet.commons.tools.constant.NumConstant; |
|
|
|
import com.epmet.commons.tools.utils.ConvertUtils; |
|
|
|
import com.epmet.commons.tools.utils.DateUtils; |
|
|
|
import com.epmet.constant.DataSourceConstant; |
|
|
|
import com.epmet.constant.OrgTypeConstant; |
|
|
|
import com.epmet.dao.evaluationindex.indexcal.AgencyScoreDao; |
|
|
|
@ -15,6 +18,11 @@ import com.epmet.dto.indexcollect.form.*; |
|
|
|
import com.epmet.dto.screen.FactIndexCommunityScoreDTO; |
|
|
|
import com.epmet.dto.screen.FactIndexGridScoreDTO; |
|
|
|
import com.epmet.dto.screencoll.form.IndexDataMonthlyFormDTO; |
|
|
|
import com.epmet.dto.screencoll.form.IndexDataYearlyFormDTO; |
|
|
|
import com.epmet.entity.evaluationindex.indexcal.AgencyScoreEntity; |
|
|
|
import com.epmet.entity.evaluationindex.indexcal.DeptScoreEntity; |
|
|
|
import com.epmet.entity.evaluationindex.screen.FactIndexCommunityScoreEntity; |
|
|
|
import com.epmet.entity.evaluationindex.screen.ScreenCustomerAgencyEntity; |
|
|
|
import com.epmet.entity.evaluationindex.screen.ScreenCustomerDeptEntity; |
|
|
|
import com.epmet.eum.IndexCodeEnum; |
|
|
|
import com.epmet.service.evaluationindex.indexcoll.FactIndexCollectService; |
|
|
|
@ -207,34 +215,53 @@ public class FactIndexCollectServiceImpl implements FactIndexCollectService { |
|
|
|
if (NumConstant.SIX != monthId.length()){ |
|
|
|
throw new RuntimeException("入参monthId格式不正确:monthId =" + monthId); |
|
|
|
} |
|
|
|
String year = monthId.substring(NumConstant.ZERO, NumConstant.FOUR); |
|
|
|
String month = monthId.substring(NumConstant.FOUR, NumConstant.SIX); |
|
|
|
// 开始处理 网格相关分值表
|
|
|
|
this.startHandleIndexGridScore(monthId, customerId); |
|
|
|
// 开始处理 社区相关分值表
|
|
|
|
this.startHandleIndexCommunityScore(monthId, customerId); |
|
|
|
// 开始处理 区直部门分值表
|
|
|
|
this.startHandleIndexDeptScore(monthId, customerId); |
|
|
|
// 开始处理 区/街道相关分数表
|
|
|
|
this.startHandleIndexAgencyScore(monthId, customerId); |
|
|
|
|
|
|
|
// fact_index_grid_score 网格相关分值记录表 grid
|
|
|
|
List<FactIndexGridScoreDTO> gridScoreDTOS = factIndexGridScoreDao.selectListGridScore(customerId, monthId); |
|
|
|
if (null != gridScoreDTOS && gridScoreDTOS.size() > NumConstant.ZERO){ |
|
|
|
this.insertIndexDataMonthlyByGridScore(month, year, customerId, gridScoreDTOS); |
|
|
|
} |
|
|
|
|
|
|
|
// fact_index_community_score 社区相关分数表 agency
|
|
|
|
List<FactIndexCommunityScoreDTO> communityScoreDTOS = factIndexCommunityScoreDao.selectListCommunityScore(customerId, monthId); |
|
|
|
if (null != communityScoreDTOS && communityScoreDTOS.size() > NumConstant.ZERO){ |
|
|
|
this.insertIndexDataMonthlyByCommunityScore(month, year, customerId, communityScoreDTOS); |
|
|
|
} |
|
|
|
|
|
|
|
// fact_index_dept_score 区直部门分值表 department
|
|
|
|
List<DeptScoreDTO> deptScoreDTOS = deptScoreDao.selectListDeptScore(customerId, monthId); |
|
|
|
if (null != deptScoreDTOS && deptScoreDTOS.size() > NumConstant.ZERO){ |
|
|
|
this.insertIndexDataMonthlyByDeptScore(month, year, customerId, deptScoreDTOS); |
|
|
|
} |
|
|
|
// 根据年,汇总今年各项得到,计算平均值后 插入年表 screen_index_data_yearly
|
|
|
|
this.insertIndexDataYear(this.getYearStr(monthId), this.getMonthStr(monthId), customerId); |
|
|
|
} |
|
|
|
|
|
|
|
// fact_index_agency_score 区/街道相关分数表 agency
|
|
|
|
List<AgencyScoreDTO> agencyScoreDTOS = agencyScoreDaol.selectListAgencyScore(customerId, monthId); |
|
|
|
if (null != agencyScoreDTOS && agencyScoreDTOS.size() > NumConstant.ZERO) { |
|
|
|
this.insertIndexDataMonthlyByAgencyScore(month, year, customerId, agencyScoreDTOS); |
|
|
|
/** |
|
|
|
* 目标:将网格的 党建能力、治理能力、服务能力、总指数 得分。 整理后(4条合1条) 插入 指数-指数数据(月表) |
|
|
|
* 如果网格相关分值表 中的网格数量不全,需要从 网格(党支部)信息表(一) 中,先查询到缺少的网格信息,赋上默认值后,插入网格相关分值表(四)。 |
|
|
|
* |
|
|
|
* @param monthId |
|
|
|
* @param customerId |
|
|
|
* @return void |
|
|
|
* @Author zhangyong |
|
|
|
* @Date 13:44 2020-09-04 |
|
|
|
**/ |
|
|
|
private void startHandleIndexGridScore(String monthId, String customerId){ |
|
|
|
// 查询网格相关分值记录 表已经存在的网格id
|
|
|
|
List<String> indexGridIds = factIndexGridScoreDao.selectListGridId(customerId, monthId); |
|
|
|
if (indexGridIds.size() > NumConstant.ZERO){ |
|
|
|
// 根据网格相关分值表 中查询到的网格id,去 网格(党支部)信息表 进行不匹配查询(即返回网格相关分值表 中不存在的网格信息)。
|
|
|
|
String[] gridIds = new String[indexGridIds.size()]; |
|
|
|
for (int i = NumConstant.ZERO; i < indexGridIds.size(); i++){ |
|
|
|
gridIds[i] = indexGridIds.get(i); |
|
|
|
} |
|
|
|
List<ScreenCustomerGridDTO> mismatchGridList = screenCustomerGridDao.selectListMismatchGridInfo(customerId, gridIds); |
|
|
|
// 将 网格相关分值表 中,本月份没有的网格信息,按照 4种类型,各新增一遍,赋默认值 0
|
|
|
|
if (mismatchGridList.size() > NumConstant.ZERO){ |
|
|
|
this.insertIndexGridScoreDefaultValueFor(monthId, customerId, mismatchGridList); |
|
|
|
} |
|
|
|
} else { |
|
|
|
// 将所有的网格按照 4种类型,各赋一遍默认值
|
|
|
|
List<ScreenCustomerGridDTO> mismatchGridList = screenCustomerGridDao.selectListMismatchGridInfo(customerId, null); |
|
|
|
this.insertIndexGridScoreDefaultValueFor(monthId, customerId, mismatchGridList); |
|
|
|
} |
|
|
|
|
|
|
|
// 插入年表 screen_index_data_yearly
|
|
|
|
// 开始处理实际分数
|
|
|
|
// fact_index_grid_score 网格相关分值记录表 grid
|
|
|
|
String[] dateArr = yearOrMonth(monthId); |
|
|
|
List<FactIndexGridScoreDTO> gridScoreDTOS = factIndexGridScoreDao.selectListGridScore(customerId, monthId); |
|
|
|
this.insertIndexDataMonthlyByGridScore(dateArr[NumConstant.ONE], dateArr[NumConstant.ZERO], customerId, gridScoreDTOS); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
@ -283,8 +310,37 @@ public class FactIndexCollectServiceImpl implements FactIndexCollectService { |
|
|
|
parentGridInfo.getParentAgencyId(), parentGridInfo.getGridName(), monthlyFormDTO); |
|
|
|
monthlyFormDTOList.add(monthlyFormDTO); |
|
|
|
} |
|
|
|
screenIndexDataMonthlyDao.deleteIndexDataMonthly(customerId, year, month, orgIds); |
|
|
|
screenIndexDataMonthlyDao.batchInsertIndexDataMonthly(monthlyFormDTOList, customerId); |
|
|
|
if (monthlyFormDTOList.size() > NumConstant.ZERO){ |
|
|
|
screenIndexDataMonthlyDao.deleteIndexDataMonthly(customerId, year, month, orgIds); |
|
|
|
screenIndexDataMonthlyDao.batchInsertIndexDataMonthly(monthlyFormDTOList, customerId); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
private void startHandleIndexCommunityScore(String monthId, String customerId){ |
|
|
|
// 查询社区相关分值记录
|
|
|
|
List<String> indexCommunityIds = factIndexCommunityScoreDao.selectListCommunityId(customerId, monthId); |
|
|
|
if (indexCommunityIds.size() > NumConstant.ZERO){ |
|
|
|
// 根据网格相关分值表 中查询到的网格id,去 网格(党支部)信息表 进行不匹配查询(即返回网格相关分值表 中不存在的网格信息)。
|
|
|
|
String[] communityIds = new String[indexCommunityIds.size()]; |
|
|
|
for (int i = NumConstant.ZERO; i < indexCommunityIds.size(); i++){ |
|
|
|
communityIds[i] = indexCommunityIds.get(i); |
|
|
|
} |
|
|
|
List<ScreenCustomerAgencyEntity> mismatchAgencyList = screenCustomerAgencyDao.selectListMismatcAgencyInfo(customerId, communityIds); |
|
|
|
// 将 社区相关分数表 中,本月份没有的网格信息,按照 4种类型,各新增一遍,赋默认值 0
|
|
|
|
if (mismatchAgencyList.size() > NumConstant.ZERO){ |
|
|
|
this.insertIndexCommunityScoreDefaultValueFor(monthId, customerId, mismatchAgencyList); |
|
|
|
} |
|
|
|
} else { |
|
|
|
// 将所有的社区按照 4种类型,各赋一遍默认值
|
|
|
|
List<ScreenCustomerAgencyEntity> mismatchAgencyList = screenCustomerAgencyDao.selectListMismatcAgencyInfo(customerId, null); |
|
|
|
this.insertIndexCommunityScoreDefaultValueFor(monthId, customerId, mismatchAgencyList); |
|
|
|
} |
|
|
|
// 开始处理实际分数
|
|
|
|
// fact_index_community_score 社区相关分数表 agency
|
|
|
|
String[] dateArr = yearOrMonth(monthId); |
|
|
|
// 查询社区相关分值记录
|
|
|
|
List<FactIndexCommunityScoreDTO> communityScoreDTOS = factIndexCommunityScoreDao.selectListCommunityScore(customerId, monthId); |
|
|
|
this.insertIndexDataMonthlyByCommunityScore(dateArr[NumConstant.ONE], dateArr[NumConstant.ZERO], customerId, communityScoreDTOS); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
@ -337,8 +393,34 @@ public class FactIndexCollectServiceImpl implements FactIndexCollectService { |
|
|
|
// 补充表中其他字段
|
|
|
|
monthlyFormDTOList.add(monthlyFormDTO); |
|
|
|
} |
|
|
|
screenIndexDataMonthlyDao.deleteIndexDataMonthly(customerId, year, month, orgIds); |
|
|
|
screenIndexDataMonthlyDao.batchInsertIndexDataMonthly(monthlyFormDTOList, customerId); |
|
|
|
if (monthlyFormDTOList.size() > NumConstant.ZERO){ |
|
|
|
screenIndexDataMonthlyDao.deleteIndexDataMonthly(customerId, year, month, orgIds); |
|
|
|
screenIndexDataMonthlyDao.batchInsertIndexDataMonthly(monthlyFormDTOList, customerId); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
private void startHandleIndexDeptScore(String monthId, String customerId){ |
|
|
|
// 查询社 区直部门分值表
|
|
|
|
List<String> indexDeptIds = deptScoreDao.selectListDeptId(customerId, monthId); |
|
|
|
if (indexDeptIds.size() > NumConstant.ZERO){ |
|
|
|
String[] depeIds = new String[indexDeptIds.size()]; |
|
|
|
for (int i = NumConstant.ZERO; i < indexDeptIds.size(); i++){ |
|
|
|
depeIds[i] = indexDeptIds.get(i); |
|
|
|
} |
|
|
|
List<ScreenCustomerDeptEntity> mismatchDeptList = screenCustomerDeptDao.selectListMismatchDeptInfo(customerId, depeIds); |
|
|
|
if (mismatchDeptList.size() > NumConstant.ZERO){ |
|
|
|
this.insertIndexDeptScoreDefaultValueFor(monthId, customerId, mismatchDeptList); |
|
|
|
} |
|
|
|
} else { |
|
|
|
List<ScreenCustomerDeptEntity> mismatchDeptList = screenCustomerDeptDao.selectListMismatchDeptInfo(customerId, null); |
|
|
|
this.insertIndexDeptScoreDefaultValueFor(monthId, customerId, mismatchDeptList); |
|
|
|
} |
|
|
|
// 开始处理实际分数
|
|
|
|
// fact_index_dept_score 区直部门分值表 department
|
|
|
|
String[] dateArr = yearOrMonth(monthId); |
|
|
|
// 查询社 区直部门分值表
|
|
|
|
List<DeptScoreDTO> deptScoreDTOS = deptScoreDao.selectListDeptScore(customerId, monthId); |
|
|
|
this.insertIndexDataMonthlyByDeptScore(dateArr[NumConstant.ONE], dateArr[NumConstant.ZERO], customerId, deptScoreDTOS); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
@ -388,6 +470,28 @@ public class FactIndexCollectServiceImpl implements FactIndexCollectService { |
|
|
|
screenIndexDataMonthlyDao.batchInsertIndexDataMonthly(monthlyFormDTOList, customerId); |
|
|
|
} |
|
|
|
|
|
|
|
private void startHandleIndexAgencyScore(String monthId, String customerId){ |
|
|
|
List<String> indexAgencyIds = agencyScoreDaol.selectListAgencyId(customerId, monthId); |
|
|
|
if (indexAgencyIds.size() > NumConstant.ZERO){ |
|
|
|
String[] agencys = new String[indexAgencyIds.size()]; |
|
|
|
for (int i = NumConstant.ZERO; i < indexAgencyIds.size(); i++){ |
|
|
|
agencys[i] = indexAgencyIds.get(i); |
|
|
|
} |
|
|
|
List<ScreenCustomerAgencyEntity> mismatchAgencyList = screenCustomerAgencyDao.selectListMismatcAgencyInfo(customerId, agencys); |
|
|
|
if (mismatchAgencyList.size() > NumConstant.ZERO){ |
|
|
|
this.insertIndexAgencyScoreDefaultValueFor(monthId, customerId, mismatchAgencyList); |
|
|
|
} |
|
|
|
} else { |
|
|
|
List<ScreenCustomerAgencyEntity> mismatchAgencyList = screenCustomerAgencyDao.selectListMismatcAgencyInfo(customerId, null); |
|
|
|
this.insertIndexAgencyScoreDefaultValueFor(monthId, customerId, mismatchAgencyList); |
|
|
|
} |
|
|
|
// 开始处理实际分数
|
|
|
|
// fact_index_agency_score 区/街道相关分数表 agency
|
|
|
|
String[] dateArr = yearOrMonth(monthId); |
|
|
|
List<AgencyScoreDTO> agencyScoreDTOS = agencyScoreDaol.selectListAgencyScore(customerId, monthId); |
|
|
|
this.insertIndexDataMonthlyByAgencyScore(dateArr[NumConstant.ONE], dateArr[NumConstant.ZERO], customerId, agencyScoreDTOS); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 将区/街道相关分数表 数据 插入月表 screenIndexDataMonthlyDao |
|
|
|
* |
|
|
|
@ -496,4 +600,319 @@ public class FactIndexCollectServiceImpl implements FactIndexCollectService { |
|
|
|
} |
|
|
|
return monthlyFormDTO; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 设置 指数-指数数据(月、年) 表 |
|
|
|
* 总指数、党建能力指数、治理能力、服务能力 默认值 0 |
|
|
|
* @param monthlyFormDTO |
|
|
|
* @return com.epmet.dto.screencoll.form.IndexDataMonthlyFormDTO |
|
|
|
* @Author zhangyong |
|
|
|
* @Date 11:01 2020-09-04 |
|
|
|
**/ |
|
|
|
private IndexDataMonthlyFormDTO setIndexDefaultValueFor(IndexDataMonthlyFormDTO monthlyFormDTO){ |
|
|
|
BigDecimal zero = new BigDecimal(NumConstant.ZERO); |
|
|
|
monthlyFormDTO.setIndexTotal(zero); |
|
|
|
monthlyFormDTO.setPartyDevAblity(zero); |
|
|
|
monthlyFormDTO.setGovernAblity(zero); |
|
|
|
return monthlyFormDTO; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 新增 网格相关分值记录表 默认值,一条网格,按照组织类别的不同 需要插入4次 |
|
|
|
* |
|
|
|
* @param monthId |
|
|
|
* @param customerId |
|
|
|
* @param mismatchGridList |
|
|
|
* @return void |
|
|
|
* @Author zhangyong |
|
|
|
* @Date 14:02 2020-09-04 |
|
|
|
**/ |
|
|
|
private void insertIndexGridScoreDefaultValueFor(String monthId, String customerId, List<ScreenCustomerGridDTO> mismatchGridList){ |
|
|
|
String[] dateArr = yearOrMonth(monthId); |
|
|
|
List<FactIndexGridScoreDTO> insertIndexGridScoreDTOS = new ArrayList<>(); |
|
|
|
for (ScreenCustomerGridDTO gridDTO : mismatchGridList){ |
|
|
|
FactIndexGridScoreDTO indexGridScoreDTO = new FactIndexGridScoreDTO(); |
|
|
|
// 赋默认值 - 党建能力指数
|
|
|
|
indexGridScoreDTO.setGridId(gridDTO.getGridId()); |
|
|
|
indexGridScoreDTO.setAgencyId(gridDTO.getParentAgencyId()); |
|
|
|
indexGridScoreDTO.setAllParentIds(gridDTO.getAllParentIds()); |
|
|
|
//季度id: yyyyQ1、yyyyQ2、yyyyQ3、yyyyQ4
|
|
|
|
indexGridScoreDTO.setQuarterId(DateUtils.getQuarterId(monthId)); |
|
|
|
indexGridScoreDTO.setYearId(dateArr[NumConstant.ZERO]); |
|
|
|
indexGridScoreDTO.setMonthId(monthId); |
|
|
|
indexGridScoreDTO.setIsTotal(NumConstant.ZERO_STR); // 0 or 1
|
|
|
|
indexGridScoreDTO.setScore(new BigDecimal(NumConstant.ZERO)); |
|
|
|
indexGridScoreDTO.setIndexCode(IndexCodeEnum.DANG_JIAN_NENG_LI.getCode()); // 4种类型
|
|
|
|
indexGridScoreDTO.setDelFlag(NumConstant.ZERO_STR); |
|
|
|
insertIndexGridScoreDTOS.add(indexGridScoreDTO); |
|
|
|
|
|
|
|
FactIndexGridScoreDTO indexGridScoreDTO1 = new FactIndexGridScoreDTO(); |
|
|
|
// 赋默认值 - 治理能力
|
|
|
|
indexGridScoreDTO1.setGridId(gridDTO.getGridId()); |
|
|
|
indexGridScoreDTO1.setAgencyId(gridDTO.getParentAgencyId()); |
|
|
|
indexGridScoreDTO1.setAllParentIds(gridDTO.getAllParentIds()); |
|
|
|
indexGridScoreDTO1.setQuarterId(DateUtils.getQuarterId(monthId)); |
|
|
|
indexGridScoreDTO1.setYearId(dateArr[NumConstant.ZERO]); |
|
|
|
indexGridScoreDTO1.setMonthId(monthId); |
|
|
|
indexGridScoreDTO1.setIsTotal(NumConstant.ZERO_STR); |
|
|
|
indexGridScoreDTO1.setScore(new BigDecimal(NumConstant.ZERO)); |
|
|
|
indexGridScoreDTO1.setIndexCode(IndexCodeEnum.ZHI_LI_NENG_LI.getCode()); |
|
|
|
indexGridScoreDTO1.setDelFlag(NumConstant.ZERO_STR); |
|
|
|
insertIndexGridScoreDTOS.add(indexGridScoreDTO1); |
|
|
|
|
|
|
|
FactIndexGridScoreDTO indexGridScoreDTO2 = new FactIndexGridScoreDTO(); |
|
|
|
// 赋默认值 - 服务能力
|
|
|
|
indexGridScoreDTO2.setGridId(gridDTO.getGridId()); |
|
|
|
indexGridScoreDTO2.setAgencyId(gridDTO.getParentAgencyId()); |
|
|
|
indexGridScoreDTO2.setAllParentIds(gridDTO.getAllParentIds()); |
|
|
|
indexGridScoreDTO2.setQuarterId(DateUtils.getQuarterId(monthId)); |
|
|
|
indexGridScoreDTO2.setYearId(dateArr[NumConstant.ZERO]); |
|
|
|
indexGridScoreDTO2.setMonthId(monthId); |
|
|
|
indexGridScoreDTO2.setIsTotal(NumConstant.ZERO_STR); |
|
|
|
indexGridScoreDTO2.setScore(new BigDecimal(NumConstant.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(dateArr[NumConstant.ZERO]); |
|
|
|
indexGridScoreDTO3.setMonthId(monthId); |
|
|
|
indexGridScoreDTO3.setIsTotal(NumConstant.ONE_STR); |
|
|
|
indexGridScoreDTO3.setScore(new BigDecimal(NumConstant.ZERO)); |
|
|
|
indexGridScoreDTO3.setIndexCode(IndexCodeEnum.WANG_GE_XIANG_GUAN.getCode()); |
|
|
|
indexGridScoreDTO3.setDelFlag(NumConstant.ZERO_STR); |
|
|
|
insertIndexGridScoreDTOS.add(indexGridScoreDTO3); |
|
|
|
} |
|
|
|
factIndexGridScoreDao.batchInsertGridScoreData(insertIndexGridScoreDTOS, customerId); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 新增 社区相关分数表 默认值,一条组织id,按照组织类别的不同 需要插入4次 |
|
|
|
* |
|
|
|
* @param monthId |
|
|
|
* @param customerId |
|
|
|
* @param mismatchAgencyList |
|
|
|
* @return void |
|
|
|
* @Author zhangyong |
|
|
|
* @Date 14:02 2020-09-04 |
|
|
|
**/ |
|
|
|
private void insertIndexCommunityScoreDefaultValueFor(String monthId, String customerId, List<ScreenCustomerAgencyEntity> mismatchAgencyList){ |
|
|
|
String[] dateArr = yearOrMonth(monthId); |
|
|
|
List<FactIndexCommunityScoreEntity> insertIndexCommunityScore = new ArrayList<>(); |
|
|
|
for (ScreenCustomerAgencyEntity agencyDTO : mismatchAgencyList){ |
|
|
|
FactIndexCommunityScoreEntity communityScore1 = new FactIndexCommunityScoreEntity(); |
|
|
|
// 赋默认值 - 党建能力指数
|
|
|
|
communityScore1.setAgencyId(agencyDTO.getAgencyId()); |
|
|
|
communityScore1.setParentAgencyId(agencyDTO.getPid()); |
|
|
|
//季度id: yyyyQ1、yyyyQ2、yyyyQ3、yyyyQ4
|
|
|
|
communityScore1.setQuarterId(DateUtils.getQuarterId(monthId)); |
|
|
|
communityScore1.setYearId(dateArr[NumConstant.ZERO]); |
|
|
|
communityScore1.setMonthId(monthId); |
|
|
|
communityScore1.setIsTotal(NumConstant.ZERO_STR); // 0 or 1
|
|
|
|
communityScore1.setScore(new BigDecimal(NumConstant.ZERO)); |
|
|
|
communityScore1.setIndexCode(IndexCodeEnum.DANG_JIAN_NENG_LI.getCode()); // 4种类型
|
|
|
|
insertIndexCommunityScore.add(communityScore1); |
|
|
|
|
|
|
|
FactIndexCommunityScoreEntity communityScore2 = new FactIndexCommunityScoreEntity(); |
|
|
|
// 赋默认值 - 治理能力
|
|
|
|
communityScore2.setAgencyId(agencyDTO.getAgencyId()); |
|
|
|
communityScore2.setParentAgencyId(agencyDTO.getPid()); |
|
|
|
//季度id: yyyyQ1、yyyyQ2、yyyyQ3、yyyyQ4
|
|
|
|
communityScore2.setQuarterId(DateUtils.getQuarterId(monthId)); |
|
|
|
communityScore2.setYearId(dateArr[NumConstant.ZERO]); |
|
|
|
communityScore2.setMonthId(monthId); |
|
|
|
communityScore2.setIsTotal(NumConstant.ZERO_STR); |
|
|
|
communityScore2.setScore(new BigDecimal(NumConstant.ZERO)); |
|
|
|
communityScore2.setIndexCode(IndexCodeEnum.ZHI_LI_NENG_LI.getCode()); |
|
|
|
insertIndexCommunityScore.add(communityScore2); |
|
|
|
|
|
|
|
FactIndexCommunityScoreEntity communityScore3 = new FactIndexCommunityScoreEntity(); |
|
|
|
// 赋默认值 - 服务能力
|
|
|
|
communityScore3.setAgencyId(agencyDTO.getAgencyId()); |
|
|
|
communityScore3.setParentAgencyId(agencyDTO.getPid()); |
|
|
|
//季度id: yyyyQ1、yyyyQ2、yyyyQ3、yyyyQ4
|
|
|
|
communityScore3.setQuarterId(DateUtils.getQuarterId(monthId)); |
|
|
|
communityScore3.setYearId(dateArr[NumConstant.ZERO]); |
|
|
|
communityScore3.setMonthId(monthId); |
|
|
|
communityScore3.setIsTotal(NumConstant.ZERO_STR); |
|
|
|
communityScore3.setScore(new BigDecimal(NumConstant.ZERO)); |
|
|
|
communityScore3.setIndexCode(IndexCodeEnum.FU_WU_NENG_LI.getCode()); |
|
|
|
insertIndexCommunityScore.add(communityScore3); |
|
|
|
|
|
|
|
FactIndexCommunityScoreEntity communityScore4 = new FactIndexCommunityScoreEntity(); |
|
|
|
// 赋默认值 - 社区相关
|
|
|
|
communityScore4.setAgencyId(agencyDTO.getAgencyId()); |
|
|
|
communityScore4.setParentAgencyId(agencyDTO.getPid()); |
|
|
|
//季度id: yyyyQ1、yyyyQ2、yyyyQ3、yyyyQ4
|
|
|
|
communityScore4.setQuarterId(DateUtils.getQuarterId(monthId)); |
|
|
|
communityScore4.setYearId(dateArr[NumConstant.ZERO]); |
|
|
|
communityScore4.setMonthId(monthId); |
|
|
|
communityScore4.setIsTotal(NumConstant.ONE_STR); |
|
|
|
communityScore4.setScore(new BigDecimal(NumConstant.ZERO)); |
|
|
|
communityScore4.setIndexCode(IndexCodeEnum.SHE_QU_XIANG_GUAN.getCode()); |
|
|
|
insertIndexCommunityScore.add(communityScore4); |
|
|
|
} |
|
|
|
factIndexCommunityScoreDao.batchInsertCommunityScoreData(insertIndexCommunityScore, customerId); |
|
|
|
} |
|
|
|
|
|
|
|
private void insertIndexDeptScoreDefaultValueFor(String monthId, String customerId, List<ScreenCustomerDeptEntity> mismatchDeptList){ |
|
|
|
String[] dateArr = yearOrMonth(monthId); |
|
|
|
List<DeptScoreEntity> insertIndexDeptScore = new ArrayList<>(); |
|
|
|
for (ScreenCustomerDeptEntity deptDTO : mismatchDeptList){ |
|
|
|
DeptScoreEntity deptScore2 = new DeptScoreEntity(); |
|
|
|
// 赋默认值 - 治理能力
|
|
|
|
deptScore2.setDeptId(deptDTO.getDeptId()); |
|
|
|
deptScore2.setAgencyId(deptDTO.getParentAgencyId()); |
|
|
|
//季度id: yyyyQ1、yyyyQ2、yyyyQ3、yyyyQ4
|
|
|
|
deptScore2.setQuarterId(DateUtils.getQuarterId(monthId)); |
|
|
|
deptScore2.setYearId(dateArr[NumConstant.ZERO]); |
|
|
|
deptScore2.setMonthId(monthId); |
|
|
|
deptScore2.setIsTotal(NumConstant.ZERO_STR); |
|
|
|
deptScore2.setScore(new BigDecimal(NumConstant.ZERO)); |
|
|
|
deptScore2.setIndexCode(IndexCodeEnum.ZHI_LI_NENG_LI.getCode()); |
|
|
|
insertIndexDeptScore.add(deptScore2); |
|
|
|
} |
|
|
|
deptScoreDao.batchInsertDeptScoreData(insertIndexDeptScore, customerId); |
|
|
|
} |
|
|
|
|
|
|
|
private void insertIndexAgencyScoreDefaultValueFor(String monthId, String customerId, List<ScreenCustomerAgencyEntity> mismatchAgencyList){ |
|
|
|
String[] dateArr = yearOrMonth(monthId); |
|
|
|
List<AgencyScoreEntity> insertIndexAgencyScore = new ArrayList<>(); |
|
|
|
for (ScreenCustomerAgencyEntity agencyDTO : mismatchAgencyList){ |
|
|
|
AgencyScoreEntity agencyScore1 = new AgencyScoreEntity(); |
|
|
|
// 赋默认值 - 党建能力指数
|
|
|
|
agencyScore1.setAgencyId(agencyDTO.getAgencyId()); |
|
|
|
agencyScore1.setParentAgencyId(agencyDTO.getPid()); |
|
|
|
//季度id: yyyyQ1、yyyyQ2、yyyyQ3、yyyyQ4
|
|
|
|
agencyScore1.setQuarterId(DateUtils.getQuarterId(monthId)); |
|
|
|
agencyScore1.setYearId(dateArr[NumConstant.ZERO]); |
|
|
|
agencyScore1.setMonthId(monthId); |
|
|
|
agencyScore1.setIsTotal(NumConstant.ZERO_STR); // 0 or 1
|
|
|
|
agencyScore1.setScore(new BigDecimal(NumConstant.ZERO)); |
|
|
|
agencyScore1.setIndexCode(IndexCodeEnum.DANG_JIAN_NENG_LI.getCode()); // 4种类型
|
|
|
|
|
|
|
|
AgencyScoreEntity agencyScore2 = new AgencyScoreEntity(); |
|
|
|
// 赋默认值 - 治理能力
|
|
|
|
agencyScore2.setAgencyId(agencyDTO.getAgencyId()); |
|
|
|
agencyScore2.setParentAgencyId(agencyDTO.getPid()); |
|
|
|
//季度id: yyyyQ1、yyyyQ2、yyyyQ3、yyyyQ4
|
|
|
|
agencyScore2.setQuarterId(DateUtils.getQuarterId(monthId)); |
|
|
|
agencyScore2.setYearId(dateArr[NumConstant.ZERO]); |
|
|
|
agencyScore2.setMonthId(monthId); |
|
|
|
agencyScore2.setIsTotal(NumConstant.ZERO_STR); |
|
|
|
agencyScore2.setScore(new BigDecimal(NumConstant.ZERO)); |
|
|
|
agencyScore2.setIndexCode(IndexCodeEnum.ZHI_LI_NENG_LI.getCode()); |
|
|
|
|
|
|
|
AgencyScoreEntity agencyScore3 = new AgencyScoreEntity(); |
|
|
|
// 赋默认值 - 服务能力
|
|
|
|
agencyScore3.setAgencyId(agencyDTO.getAgencyId()); |
|
|
|
agencyScore3.setParentAgencyId(agencyDTO.getPid()); |
|
|
|
//季度id: yyyyQ1、yyyyQ2、yyyyQ3、yyyyQ4
|
|
|
|
agencyScore3.setQuarterId(DateUtils.getQuarterId(monthId)); |
|
|
|
agencyScore3.setYearId(dateArr[NumConstant.ZERO]); |
|
|
|
agencyScore3.setMonthId(monthId); |
|
|
|
agencyScore3.setIsTotal(NumConstant.ZERO_STR); |
|
|
|
agencyScore3.setScore(new BigDecimal(NumConstant.ZERO)); |
|
|
|
agencyScore3.setIndexCode(IndexCodeEnum.FU_WU_NENG_LI.getCode()); |
|
|
|
|
|
|
|
if ("community".equals(agencyDTO.getLevel())){ |
|
|
|
AgencyScoreEntity agencyScore4 = new AgencyScoreEntity(); |
|
|
|
// 赋默认值 - 全区相关
|
|
|
|
agencyScore4.setAgencyId(agencyDTO.getAgencyId()); |
|
|
|
agencyScore4.setParentAgencyId(agencyDTO.getPid()); |
|
|
|
//季度id: yyyyQ1、yyyyQ2、yyyyQ3、yyyyQ4
|
|
|
|
agencyScore4.setQuarterId(DateUtils.getQuarterId(monthId)); |
|
|
|
agencyScore4.setYearId(dateArr[NumConstant.ZERO]); |
|
|
|
agencyScore4.setMonthId(monthId); |
|
|
|
agencyScore4.setIsTotal(NumConstant.ONE_STR); |
|
|
|
agencyScore4.setScore(new BigDecimal(NumConstant.ZERO)); |
|
|
|
agencyScore4.setIndexCode(IndexCodeEnum.QUAN_QU_XIANG_GUAN.getCode()); |
|
|
|
|
|
|
|
agencyScore4.setDataType("district"); |
|
|
|
agencyScore1.setDataType("district"); |
|
|
|
agencyScore2.setDataType("district"); |
|
|
|
agencyScore3.setDataType("district"); |
|
|
|
insertIndexAgencyScore.add(agencyScore4); |
|
|
|
} else if ("street".equals(agencyDTO.getLevel())){ |
|
|
|
AgencyScoreEntity agencyScore4 = new AgencyScoreEntity(); |
|
|
|
// 赋默认值 - 街道相关
|
|
|
|
agencyScore4.setAgencyId(agencyDTO.getAgencyId()); |
|
|
|
agencyScore4.setParentAgencyId(agencyDTO.getPid()); |
|
|
|
//季度id: yyyyQ1、yyyyQ2、yyyyQ3、yyyyQ4
|
|
|
|
agencyScore4.setQuarterId(DateUtils.getQuarterId(monthId)); |
|
|
|
agencyScore4.setYearId(dateArr[NumConstant.ZERO]); |
|
|
|
agencyScore4.setMonthId(monthId); |
|
|
|
agencyScore4.setIsTotal(NumConstant.ONE_STR); |
|
|
|
agencyScore4.setScore(new BigDecimal(NumConstant.ZERO)); |
|
|
|
agencyScore4.setIndexCode(IndexCodeEnum.JIE_DAO_XIANG_GUAN.getCode()); |
|
|
|
|
|
|
|
agencyScore4.setDataType("street"); |
|
|
|
agencyScore1.setDataType("street"); |
|
|
|
agencyScore2.setDataType("street"); |
|
|
|
agencyScore3.setDataType("street"); |
|
|
|
insertIndexAgencyScore.add(agencyScore4); |
|
|
|
} |
|
|
|
insertIndexAgencyScore.add(agencyScore1); |
|
|
|
insertIndexAgencyScore.add(agencyScore2); |
|
|
|
insertIndexAgencyScore.add(agencyScore3); |
|
|
|
} |
|
|
|
agencyScoreDaol.batchInsertAgencyScoreData(insertIndexAgencyScore, customerId); |
|
|
|
} |
|
|
|
|
|
|
|
private void insertIndexDataYear(String year, String month, String customerId){ |
|
|
|
List<IndexDataMonthlyFormDTO> monthlyFormList = screenIndexDataMonthlyDao.selectListIndexDataMonthlyByYear(customerId, year, month); |
|
|
|
String[] orgIds = new String[monthlyFormList.size()]; |
|
|
|
for (int i = NumConstant.ZERO; i < monthlyFormList.size(); i++){ |
|
|
|
orgIds[i] = monthlyFormList.get(i).getOrgId(); |
|
|
|
} |
|
|
|
screenIndexDataYearlyDao.deleteIndexDataYearly(customerId, year, orgIds); |
|
|
|
List<IndexDataYearlyFormDTO> entity = ConvertUtils.sourceToTarget(monthlyFormList, IndexDataYearlyFormDTO.class); |
|
|
|
screenIndexDataYearlyDao.batchInsertIndexDataYearly(entity, customerId); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 将月份id,拆分 dateArr[0] = 年份 dateArr[1] = 月份 |
|
|
|
* |
|
|
|
* @param monthId 202008 |
|
|
|
* @return java.lang.String[] |
|
|
|
* @Author zhangyong |
|
|
|
* @Date 13:39 2020-09-04 |
|
|
|
**/ |
|
|
|
private String[] yearOrMonth(String monthId){ |
|
|
|
String[] dateArr = new String[NumConstant.TWO]; |
|
|
|
dateArr[NumConstant.ZERO] = monthId.substring(NumConstant.ZERO, NumConstant.FOUR); |
|
|
|
dateArr[NumConstant.ONE] = monthId.substring(NumConstant.FOUR, NumConstant.SIX); |
|
|
|
return dateArr; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* 将月份id,拆分成 年份 |
|
|
|
* |
|
|
|
* @param monthId 202008 |
|
|
|
* @return java.lang.String |
|
|
|
* @Author zhangyong |
|
|
|
* @Date 13:39 2020-09-04 |
|
|
|
**/ |
|
|
|
private String getYearStr(String monthId){ |
|
|
|
return monthId.substring(NumConstant.ZERO, NumConstant.FOUR); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* 将月份id,拆分成 月份 |
|
|
|
* |
|
|
|
* @param monthId 202008 |
|
|
|
* @return java.lang.String |
|
|
|
* @Author zhangyong |
|
|
|
* @Date 13:39 2020-09-04 |
|
|
|
**/ |
|
|
|
private String getMonthStr(String monthId){ |
|
|
|
return monthId.substring(NumConstant.FOUR, NumConstant.SIX); |
|
|
|
} |
|
|
|
} |
|
|
|
|