|
|
@ -19,17 +19,22 @@ package com.epmet.service.evaluationindex.extract.todata.impl; |
|
|
|
|
|
|
|
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; |
|
|
|
import com.epmet.commons.tools.constant.NumConstant; |
|
|
|
import com.epmet.constant.DimObjectActionConstant; |
|
|
|
import com.epmet.constant.DimObjectStatusConstant; |
|
|
|
import com.epmet.constant.ProjectConstant; |
|
|
|
import com.epmet.dao.evaluationindex.extract.FactGridGovernDailyDao; |
|
|
|
import com.epmet.dto.extract.FactOriginProjectLogDailyDTO; |
|
|
|
import com.epmet.dto.org.GridInfoDTO; |
|
|
|
import com.epmet.entity.evaluationindex.extract.FactGridGovernDailyEntity; |
|
|
|
import com.epmet.entity.evaluationindex.extract.GovernGridClosedTotalCommonDTO; |
|
|
|
import com.epmet.entity.evaluationindex.extract.GovernGridTotalCommonDTO; |
|
|
|
import com.epmet.entity.evaluationindex.extract.GovernProjectInfoDTO; |
|
|
|
import com.epmet.entity.org.CustomerAgencyEntity; |
|
|
|
import com.epmet.service.evaluationindex.extract.todata.FactGridGovernDailyService; |
|
|
|
import com.epmet.service.evaluationindex.extract.todata.FactOriginIssueMainDailyService; |
|
|
|
import com.epmet.service.evaluationindex.extract.todata.FactOriginProjectMainDailyService; |
|
|
|
import com.epmet.service.evaluationindex.extract.todata.FactOriginTopicMainDailyService; |
|
|
|
import com.epmet.service.org.CustomerAgencyService; |
|
|
|
import com.epmet.service.org.CustomerGridService; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.apache.commons.collections4.CollectionUtils; |
|
|
@ -39,10 +44,7 @@ import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
import java.math.BigDecimal; |
|
|
|
import java.text.NumberFormat; |
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.HashMap; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
import java.util.*; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
/** |
|
|
@ -62,7 +64,8 @@ public class FactGridGovernDailyServiceImpl extends BaseServiceImpl<FactGridGove |
|
|
|
private FactOriginProjectMainDailyService factOriginProjectMainDailyService; |
|
|
|
@Autowired |
|
|
|
private CustomerGridService customerGridService; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private CustomerAgencyService customerAgencyService; |
|
|
|
|
|
|
|
// 指标解释:
|
|
|
|
// 1、问题解决总数:当前网格内,话题关闭(已解决+无需解决)总数、议题关闭(已解决+无需解决)总数和项目结案(议题转为项目的结案数+项目立项结案数)总数之和
|
|
|
@ -242,13 +245,193 @@ public class FactGridGovernDailyServiceImpl extends BaseServiceImpl<FactGridGove |
|
|
|
} |
|
|
|
|
|
|
|
private Map<String, GovernGridClosedTotalCommonDTO> getGovernGridClosedTotalCommonDTOMap(String customerId, List<String> gridIds) { |
|
|
|
Map<String, GovernGridClosedTotalCommonDTO> resultMap=new HashMap<>(); |
|
|
|
for(String gridId:gridIds){ |
|
|
|
Map<String, GovernGridClosedTotalCommonDTO> resultMap = new HashMap<>(); |
|
|
|
for (String gridId : gridIds) { |
|
|
|
|
|
|
|
GovernGridClosedTotalCommonDTO governGridClosedTotalCommonDTO = new GovernGridClosedTotalCommonDTO(); |
|
|
|
governGridClosedTotalCommonDTO.setGridId(gridId); |
|
|
|
|
|
|
|
// 11、来源于议题的项目,未出网格结案并且已解决的项目数
|
|
|
|
int fromIssueResolvedInGridCount = NumConstant.ZERO; |
|
|
|
// 12、来源于议题的项目,未出网格结案并且无需解决的项目数
|
|
|
|
int fromIssueUnResolvedInGridCount = NumConstant.ZERO; |
|
|
|
// 13、来源于项目立项的项目,未出网格结案,并且已解决的项目数;因现在网格不能立项,所以此列默认为0
|
|
|
|
int fromAgencyResolvedInGridCount = NumConstant.ZERO; |
|
|
|
// 14、来源于项目立项的项目,未出网格结案,并且无需解决的项目数;因现在网格不能立项,所以此列默认为0
|
|
|
|
int fromAgencyUnResolvedInGridCount = NumConstant.ZERO; |
|
|
|
// 当前网格内出来的项目:由社区结案(已解决+未解决)的项目总数
|
|
|
|
int communityClosedCount= NumConstant.ZERO; |
|
|
|
// 当前网格内出来的项目:由街道结案(已解决+未解决)的项目总数
|
|
|
|
int streetClosedCount=NumConstant.ZERO;; |
|
|
|
// 当前网格内出来的项目:由街道结案(已解决+未解决)的项目总数
|
|
|
|
int districtDeptClosedCount=NumConstant.ZERO; |
|
|
|
|
|
|
|
//当前网格内已结案的项目
|
|
|
|
List<GovernProjectInfoDTO> currentGridClosedProjectList = factOriginProjectMainDailyService.getGridClosedProjectList(customerId, gridId, |
|
|
|
ProjectConstant.CLOSED,null,null); |
|
|
|
for (GovernProjectInfoDTO governProjectInfoDTO : currentGridClosedProjectList) { |
|
|
|
// 1、先判断当前项目是否出了网格
|
|
|
|
// 举例:A社区下有A1、A2两个网格;A1网格下的一个项目,流转给了A2网格的某人,他结案了。 只要项目流转部门未出grid ;就算是网格自治。
|
|
|
|
boolean inGridClosed = checkIsInGridClosed(governProjectInfoDTO.getGridId(), |
|
|
|
governProjectInfoDTO.getProjectLogDTOList()); |
|
|
|
if (inGridClosed) { |
|
|
|
// 2、在网格内流转结案的,计算以下下值
|
|
|
|
if (ProjectConstant.PROJECT_ORIGIN_ISSUE.equals(governProjectInfoDTO.getOrigin())) { |
|
|
|
if (ProjectConstant.RESOLVED.equals(governProjectInfoDTO.getIsResolved())) { |
|
|
|
// 11、来源于议题的项目,未出网格(在网格内流转的)结案并且已解决的项目数
|
|
|
|
fromIssueResolvedInGridCount += 1; |
|
|
|
} else if (ProjectConstant.UNRESOLVED.equals(governProjectInfoDTO.getIsResolved())) { |
|
|
|
// 12、来源于议题的项目,未出网格(在网格内流转的)结案并且无需解决的项目数
|
|
|
|
fromIssueUnResolvedInGridCount += 1; |
|
|
|
} |
|
|
|
} else if (ProjectConstant.PROJECT_ORIGIN_AGENCY.equals(governProjectInfoDTO.getOrigin())) { |
|
|
|
if (ProjectConstant.RESOLVED.equals(governProjectInfoDTO.getIsResolved())) { |
|
|
|
// 13、来源于项目立项的项目,未出网格(在网格内流转的)结案,并且已解决的项目数;因现在网格不能立项,所以此列默认为0
|
|
|
|
fromAgencyResolvedInGridCount += 1; |
|
|
|
} else if (ProjectConstant.UNRESOLVED.equals(governProjectInfoDTO.getIsResolved())) { |
|
|
|
// 14、来源于项目立项的项目,未出网格(在网格内流转的)结案,并且无需解决的项目数;因现在网格不能立项,所以此列默认为0
|
|
|
|
fromAgencyUnResolvedInGridCount += 1; |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
// 3、出了网格的判断是由谁解决的?
|
|
|
|
String resolveOrgType=getProjectResolveOrgType(governProjectInfoDTO.getProjectLogDTOList()); |
|
|
|
if("community".equals(resolveOrgType)){ |
|
|
|
// 当前网格内出来的项目:由社区结案(已解决+未解决)的项目总数
|
|
|
|
communityClosedCount+=1; |
|
|
|
}else if("street".equals(resolveOrgType)){ |
|
|
|
// 当前网格内出来的项目:由街道结案(已解决+未解决)的项目总数
|
|
|
|
streetClosedCount+=1; |
|
|
|
}else if("districtdept".equals(resolveOrgType)){ |
|
|
|
// 当前网格内出来的项目:由街道结案(已解决+未解决)的项目总数
|
|
|
|
districtDeptClosedCount+=1; |
|
|
|
} |
|
|
|
// todo 可能是 市级解决、省级解决呢???
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
governGridClosedTotalCommonDTO.setFromIssueResolvedInGridCount(fromIssueResolvedInGridCount); |
|
|
|
governGridClosedTotalCommonDTO.setFromIssueUnResolvedInGridCount(fromIssueUnResolvedInGridCount); |
|
|
|
governGridClosedTotalCommonDTO.setFromAgencyResolvedInGridCount(fromAgencyResolvedInGridCount); |
|
|
|
governGridClosedTotalCommonDTO.setFromAgencyUnResolvedInGridCount(fromAgencyUnResolvedInGridCount); |
|
|
|
governGridClosedTotalCommonDTO.setCommunityClosedCount(communityClosedCount); |
|
|
|
governGridClosedTotalCommonDTO.setStreetClosedCount(streetClosedCount); |
|
|
|
governGridClosedTotalCommonDTO.setDistrictDeptClosedCount(districtDeptClosedCount); |
|
|
|
resultMap.put(gridId, governGridClosedTotalCommonDTO); |
|
|
|
} |
|
|
|
return resultMap; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 已经出网格的项目,到底归谁解决呢? |
|
|
|
* |
|
|
|
* @param projectLogDTOList 当前项目所有的处理明细 |
|
|
|
* @return String 社区解决:community;街道解决:street;区直部门解决:districtdept |
|
|
|
*/ |
|
|
|
private String getProjectResolveOrgType(List<FactOriginProjectLogDailyDTO> projectLogDTOList) { |
|
|
|
List<Integer> handleLevelList=new ArrayList<>(); |
|
|
|
for (FactOriginProjectLogDailyDTO logDailyDTO : projectLogDTOList) { |
|
|
|
if(logDailyDTO.getActionCode().equals(DimObjectActionConstant.PROJECT_RETURN)){ |
|
|
|
//当前操作如果是退回,不参与比较
|
|
|
|
continue; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 机关级别(社区级:community, |
|
|
|
乡(镇、街道)级:street, |
|
|
|
区县级: district, |
|
|
|
市级: city |
|
|
|
省级:province) |
|
|
|
*/ |
|
|
|
// orgType: 网格grid,部门department,组织:agency
|
|
|
|
if ("grid".equals(logDailyDTO.getOrgType())) { |
|
|
|
handleLevelList.add(NumConstant.ONE); |
|
|
|
} else if ("agency".equals(logDailyDTO.getOrgType())) { |
|
|
|
CustomerAgencyEntity agencyEntity=customerAgencyService.getAgencyById(logDailyDTO.getOrgId()); |
|
|
|
if("community".equals(agencyEntity.getLevel())){ |
|
|
|
handleLevelList.add(NumConstant.TWO); |
|
|
|
}else if("street".equals(agencyEntity.getLevel())){ |
|
|
|
handleLevelList.add(NumConstant.THREE); |
|
|
|
}else if("district".equals(agencyEntity.getLevel())){ |
|
|
|
handleLevelList.add(NumConstant.FOUR); |
|
|
|
}else if("city".equals(agencyEntity.getLevel())){ |
|
|
|
handleLevelList.add(NumConstant.FIVE); |
|
|
|
}else if("province".equals(agencyEntity.getLevel())){ |
|
|
|
handleLevelList.add(NumConstant.SIX); |
|
|
|
} |
|
|
|
} else if ("department".equals(logDailyDTO.getOrgType())) { |
|
|
|
CustomerAgencyEntity deptAgencyEntity=customerAgencyService.getAgencyByDeptId(logDailyDTO.getOrgId()); |
|
|
|
if("district".equals(deptAgencyEntity.getLevel())){ |
|
|
|
// 区直部门直接返回
|
|
|
|
return "districtdept"; |
|
|
|
}else if("community".equals(deptAgencyEntity.getLevel())){ |
|
|
|
handleLevelList.add(NumConstant.TWO); |
|
|
|
}else if("street".equals(deptAgencyEntity.getLevel())){ |
|
|
|
handleLevelList.add(NumConstant.THREE); |
|
|
|
}else if("city".equals(deptAgencyEntity.getLevel())){ |
|
|
|
handleLevelList.add(NumConstant.FIVE); |
|
|
|
}else if("province".equals(deptAgencyEntity.getLevel())){ |
|
|
|
handleLevelList.add(NumConstant.SIX); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
//网格:1 grid
|
|
|
|
//社区:2 community
|
|
|
|
//街道:3 street
|
|
|
|
//区县:4 district
|
|
|
|
//市级:5 city
|
|
|
|
//省:6 province
|
|
|
|
//区直部门:7 districtdept
|
|
|
|
//求出最高的处理部门级别
|
|
|
|
String result = ""; |
|
|
|
int max = Collections.max(handleLevelList); |
|
|
|
switch (max) { |
|
|
|
case NumConstant.ONE: |
|
|
|
return "grid"; |
|
|
|
case NumConstant.TWO: |
|
|
|
result = "community"; |
|
|
|
break; |
|
|
|
case NumConstant.THREE: |
|
|
|
result = "street"; |
|
|
|
break; |
|
|
|
case NumConstant.FOUR: |
|
|
|
result = "district"; |
|
|
|
break; |
|
|
|
case NumConstant.FIVE: |
|
|
|
result = "city"; |
|
|
|
break; |
|
|
|
case NumConstant.SIX: |
|
|
|
result = "province"; |
|
|
|
break; |
|
|
|
case NumConstant.SEVEN: |
|
|
|
result = "districtdept"; |
|
|
|
} |
|
|
|
return result; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 根据项目处理的明细,判断当前项目是否在网格内自己解决的 |
|
|
|
* |
|
|
|
* @param gridId 当前项目所属网格 |
|
|
|
* @param projectLogDTOList |
|
|
|
* @return boolean |
|
|
|
*/ |
|
|
|
private boolean checkIsInGridClosed(String gridId, List<FactOriginProjectLogDailyDTO> projectLogDTOList) { |
|
|
|
boolean flag = true; |
|
|
|
for (FactOriginProjectLogDailyDTO detail : projectLogDTOList) { |
|
|
|
if(detail.getActionCode().equals(DimObjectActionConstant.PROJECT_RETURN)){ |
|
|
|
//当前操作如果是退回,不参与比较
|
|
|
|
continue; |
|
|
|
} |
|
|
|
//只要出了网格,就不算自治
|
|
|
|
if (!"grid".equals(detail.getOrgType())) { |
|
|
|
flag = false; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
return flag; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 构造要插入的数据,每个网格一天一条数据,初始赋值0 |
|
|
|
* |
|
|
|