|
|
@ -198,12 +198,22 @@ public class FactIndexCollectServiceImpl implements FactIndexCollectService { |
|
|
|
if (NumConstant.SIX != monthId.length()){ |
|
|
|
throw new RuntimeException("入参monthId格式不正确:monthId =" + monthId); |
|
|
|
} |
|
|
|
// 根据网格类型,删除 指数-指数数据(每月数值)表中 匹配的数据
|
|
|
|
this.batchDelIndexDataMonthly(customerId, monthId, OrgTypeConstant.GRID); |
|
|
|
// 开始处理 网格相关分值表
|
|
|
|
this.startHandleIndexGridScore(monthId, customerId); |
|
|
|
|
|
|
|
// 根据组织类型,删除 指数-指数数据(每月数值)表中 匹配的数据
|
|
|
|
this.batchDelIndexDataMonthly(customerId, monthId, OrgTypeConstant.AGENCY); |
|
|
|
// 开始处理 社区相关分值表
|
|
|
|
this.startHandleIndexCommunityScore(monthId, customerId); |
|
|
|
|
|
|
|
// 根据部门类型,删除 指数-指数数据(每月数值)表中 匹配的数据
|
|
|
|
this.batchDelIndexDataMonthly(customerId, monthId, OrgTypeConstant.DEPARTMENT); |
|
|
|
// 开始处理 区直部门分值表
|
|
|
|
this.startHandleIndexDeptScore(monthId, customerId); |
|
|
|
|
|
|
|
// 同样是 组织类型,所以不再重复删除了
|
|
|
|
// 开始处理 区/街道相关分数表
|
|
|
|
this.startHandleIndexAgencyScore(monthId, customerId); |
|
|
|
|
|
|
@ -236,16 +246,15 @@ public class FactIndexCollectServiceImpl implements FactIndexCollectService { |
|
|
|
} else { |
|
|
|
mismatchGridList = screenCustomerGridDao.selectListMismatchGridInfo(customerId, null); |
|
|
|
} |
|
|
|
boolean delFlag = true; |
|
|
|
|
|
|
|
if (!CollectionUtils.isEmpty(mismatchGridList)){ |
|
|
|
// 如果进行不匹配查询,查到了其他网格信息,一律赋默认值
|
|
|
|
this.insertIndexMonthlyByGridDefaultScore(monthId, customerId, mismatchGridList); |
|
|
|
delFlag = false; |
|
|
|
} |
|
|
|
// fact_index_grid_score 网格相关分值记录表 grid
|
|
|
|
List<FactIndexGridScoreDTO> gridScoreDTOS = factIndexGridScoreDao.selectListGridScore(customerId, monthId); |
|
|
|
// 开始处理实际分数
|
|
|
|
this.insertIndexDataMonthlyByGridScore(delFlag, monthId, customerId, gridScoreDTOS); |
|
|
|
this.insertIndexDataMonthlyByGridScore(monthId, customerId, gridScoreDTOS); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
@ -272,17 +281,12 @@ public class FactIndexCollectServiceImpl implements FactIndexCollectService { |
|
|
|
gridScoreDTOS.get(i).getParentAgencyId(), gridScoreDTOS.get(i).getGridName(), monthlyDTO); |
|
|
|
monthlyFormDTOList.add(monthlyDTO); |
|
|
|
} |
|
|
|
int deleteNum; |
|
|
|
do { |
|
|
|
deleteNum = screenIndexDataMonthlyDao.deleteIndexDataMonthly(customerId,monthId); |
|
|
|
} while (deleteNum > NumConstant.ZERO); |
|
|
|
screenIndexDataMonthlyDao.batchInsertIndexDataMonthly(monthlyFormDTOList, customerId); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 将网格相关分值记录表 数据 插入月表 screenIndexDataMonthlyDao |
|
|
|
* |
|
|
|
* @param delFlag true: 执行删除语句;false:已经删过一次了,本次只添加不删除 |
|
|
|
* @param monthId 202008 |
|
|
|
* @param customerId 客户id |
|
|
|
* @param gridScoreDTOS 网格相关分值记录表 当前客户所属月份数据集 |
|
|
@ -290,7 +294,7 @@ public class FactIndexCollectServiceImpl implements FactIndexCollectService { |
|
|
|
* @Author zhangyong |
|
|
|
* @Date 14:17 2020-09-03 |
|
|
|
**/ |
|
|
|
private void insertIndexDataMonthlyByGridScore(boolean delFlag, String monthId, String customerId, List<FactIndexGridScoreDTO> gridScoreDTOS){ |
|
|
|
private void insertIndexDataMonthlyByGridScore(String monthId, String customerId, List<FactIndexGridScoreDTO> gridScoreDTOS){ |
|
|
|
List<IndexDataMonthlyFormDTO> monthlyFormDTOList = new ArrayList<>(); |
|
|
|
// 根据网格id进行分组,最后组装一条数据 一个网格 对应 4条数据
|
|
|
|
Map<String, List<FactIndexGridScoreDTO>> collect = gridScoreDTOS.stream().collect(Collectors.groupingBy(FactIndexGridScoreDTO::getGridId)); |
|
|
@ -333,12 +337,6 @@ public class FactIndexCollectServiceImpl implements FactIndexCollectService { |
|
|
|
monthlyFormDTOList.add(monthlyFormDTO); |
|
|
|
} |
|
|
|
if (monthlyFormDTOList.size() > NumConstant.ZERO){ |
|
|
|
if (delFlag){ |
|
|
|
int deleteNum; |
|
|
|
do { |
|
|
|
deleteNum = screenIndexDataMonthlyDao.deleteIndexDataMonthly(customerId,monthId); |
|
|
|
} while (deleteNum > NumConstant.ZERO); |
|
|
|
} |
|
|
|
screenIndexDataMonthlyDao.batchInsertIndexDataMonthly(monthlyFormDTOList, customerId); |
|
|
|
} |
|
|
|
} |
|
|
@ -363,11 +361,12 @@ public class FactIndexCollectServiceImpl implements FactIndexCollectService { |
|
|
|
for (int i = NumConstant.ZERO; i < indexCommunityIds.size(); i++){ |
|
|
|
communityIds[i] = indexCommunityIds.get(i); |
|
|
|
} |
|
|
|
// 进行不匹配查询(即返回社区相关分值表 中不存在的社区信息)。
|
|
|
|
mismatchAgencyList = screenCustomerAgencyDao.selectListMismatcAgencyInfo(customerId, communityIds); |
|
|
|
// 进行不匹配查询(即返回社区相关分值表 中不存在的【社区级】 组织信息)。
|
|
|
|
mismatchAgencyList = screenCustomerAgencyDao.selectListMismatcCommunityAgencyInfo(customerId, communityIds); |
|
|
|
} else { |
|
|
|
mismatchAgencyList = screenCustomerAgencyDao.selectListMismatcAgencyInfo(customerId, null); |
|
|
|
mismatchAgencyList = screenCustomerAgencyDao.selectListMismatcCommunityAgencyInfo(customerId, null); |
|
|
|
} |
|
|
|
|
|
|
|
if (!CollectionUtils.isEmpty(mismatchAgencyList)){ |
|
|
|
// 如果进行不匹配查询,查到了其他社区信息,一律赋默认值
|
|
|
|
this.insertIndexMonthlyByAgencyDefaultScore(monthId, customerId, mismatchAgencyList); |
|
|
@ -399,7 +398,7 @@ public class FactIndexCollectServiceImpl implements FactIndexCollectService { |
|
|
|
monthlyDTO.setServiceAblity(zero); |
|
|
|
monthlyDTO.setGovernAblity(zero); |
|
|
|
// 补充表中其他字段
|
|
|
|
monthlyDTO = this.supplementIndexDataMonthlyTable(monthId, OrgTypeConstant.GRID, communityScoreDTOS.get(i).getAgencyId(), |
|
|
|
monthlyDTO = this.supplementIndexDataMonthlyTable(monthId, OrgTypeConstant.AGENCY, communityScoreDTOS.get(i).getAgencyId(), |
|
|
|
communityScoreDTOS.get(i).getPid(), communityScoreDTOS.get(i).getAgencyName(), monthlyDTO); |
|
|
|
monthlyFormDTOList.add(monthlyDTO); |
|
|
|
} |
|
|
@ -487,6 +486,7 @@ public class FactIndexCollectServiceImpl implements FactIndexCollectService { |
|
|
|
} else { |
|
|
|
mismatchDeptList = screenCustomerDeptDao.selectListMismatchDeptInfo(customerId, null); |
|
|
|
} |
|
|
|
|
|
|
|
if (!CollectionUtils.isEmpty(mismatchDeptList)){ |
|
|
|
// 如果进行不匹配查询,查到了其他部门信息,一律赋默认值
|
|
|
|
this.insertIndexMonthlyByDeptDefaultScore(monthId, customerId, mismatchDeptList); |
|
|
@ -518,7 +518,7 @@ public class FactIndexCollectServiceImpl implements FactIndexCollectService { |
|
|
|
monthlyDTO.setServiceAblity(zero); |
|
|
|
monthlyDTO.setGovernAblity(zero); |
|
|
|
// 补充表中其他字段
|
|
|
|
monthlyDTO = this.supplementIndexDataMonthlyTable(monthId, OrgTypeConstant.GRID, deptScoreDTOS.get(i).getDeptId(), |
|
|
|
monthlyDTO = this.supplementIndexDataMonthlyTable(monthId, OrgTypeConstant.DEPARTMENT, deptScoreDTOS.get(i).getDeptId(), |
|
|
|
deptScoreDTOS.get(i).getParentAgencyId(), deptScoreDTOS.get(i).getDeptName(), monthlyDTO); |
|
|
|
monthlyFormDTOList.add(monthlyDTO); |
|
|
|
} |
|
|
@ -592,10 +592,11 @@ public class FactIndexCollectServiceImpl implements FactIndexCollectService { |
|
|
|
for (int i = NumConstant.ZERO; i < indexAgencyIds.size(); i++){ |
|
|
|
agencyIds[i] = indexAgencyIds.get(i); |
|
|
|
} |
|
|
|
mismatchAgencyList = screenCustomerAgencyDao.selectListMismatcAgencyInfo(customerId, agencyIds); |
|
|
|
mismatchAgencyList = screenCustomerAgencyDao.selectListMismatcStreetAndDistrictAgencyInfo(customerId, agencyIds); |
|
|
|
} else { |
|
|
|
mismatchAgencyList = screenCustomerAgencyDao.selectListMismatcAgencyInfo(customerId, null); |
|
|
|
mismatchAgencyList = screenCustomerAgencyDao.selectListMismatcStreetAndDistrictAgencyInfo(customerId, null); |
|
|
|
} |
|
|
|
|
|
|
|
if (!CollectionUtils.isEmpty(mismatchAgencyList)){ |
|
|
|
this.insertIndexMonthlyByAgencyDefaultScore(monthId, customerId, mismatchAgencyList); |
|
|
|
} |
|
|
@ -770,4 +771,21 @@ public class FactIndexCollectServiceImpl implements FactIndexCollectService { |
|
|
|
private String getMonthStr(String monthId){ |
|
|
|
return monthId.substring(NumConstant.FOUR, NumConstant.SIX); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 批量删除 指数-指数数据(每月数值) 表数据 |
|
|
|
* |
|
|
|
* @param customerId |
|
|
|
* @param monthId 202008 |
|
|
|
* @param orgType 组织类别 agency:组织;部门:department;网格:grid |
|
|
|
* @return void |
|
|
|
* @Author zhangyong |
|
|
|
* @Date 09:55 2020-09-12 |
|
|
|
**/ |
|
|
|
private void batchDelIndexDataMonthly( String customerId, String monthId, String orgType){ |
|
|
|
int deleteNum; |
|
|
|
do { |
|
|
|
deleteNum = screenIndexDataMonthlyDao.deleteIndexDataMonthlyByOrgType(customerId, monthId, orgType); |
|
|
|
} while (deleteNum > NumConstant.ZERO); |
|
|
|
} |
|
|
|
} |
|
|
|