|
|
@ -19,6 +19,7 @@ import com.epmet.dataaggre.entity.datastats.DimGridEntity; |
|
|
|
import com.epmet.dataaggre.entity.datastats.FactAgencyGovernDailyEntity; |
|
|
|
import com.epmet.dataaggre.service.datastats.DataStatsService; |
|
|
|
import com.epmet.dataaggre.service.evaluationindex.EvaluationIndexService; |
|
|
|
import com.epmet.dataaggre.service.opercrm.CustomerRelation; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.apache.commons.collections4.CollectionUtils; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
@ -46,6 +47,8 @@ public class DataStatsServiceImpl implements DataStatsService { |
|
|
|
private DataStatsDao dataStatsDao; |
|
|
|
@Autowired |
|
|
|
private EvaluationIndexService indexService; |
|
|
|
@Autowired |
|
|
|
private CustomerRelation customerRelation; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
@ -68,10 +71,9 @@ public class DataStatsServiceImpl implements DataStatsService { |
|
|
|
formDTO.setDateId(format.format(yesterday)); |
|
|
|
} |
|
|
|
|
|
|
|
//0.判断level是否有值,有值判断areaCode是否有值,没值直接用agencyId查数据,有值查询不是当前agencyId对应客户的areaCode的下级组织列表
|
|
|
|
if(StringUtils.isNotBlank(formDTO.getLevel())&&!"community".equals(formDTO.getLevel())&&StringUtils.isNotBlank(formDTO.getAreaCode())){ |
|
|
|
agencyList = indexService.getAgencyByAreaCodeAgencyId(formDTO.getAgencyId(), formDTO.getAreaCode()); |
|
|
|
} |
|
|
|
//0.根据组织Id查询是否存在子客户,存在的按areaCode查询当前客户之外的客户组织列表
|
|
|
|
agencyList = indexService.getAgencyIdsByAgencyId(formDTO.getAgencyId()); |
|
|
|
agencyList.add(formDTO.getAgencyId()); |
|
|
|
agencyList.add(formDTO.getAgencyId()); |
|
|
|
|
|
|
|
//1.查询组织下注册用户最新日统计数据【只查询注册用户的统计数据,不涉及参与用户的】
|
|
|
@ -287,8 +289,8 @@ public class DataStatsServiceImpl implements DataStatsService { |
|
|
|
formDTO.setType("user"); |
|
|
|
} |
|
|
|
|
|
|
|
//1.查询直属下级组织列表,有areaCode的按areaCode查,没有的按agencyId查
|
|
|
|
List<ScreenCustomerAgencyDTO> subAgencyList = indexService.getSubAgencyList(formDTO.getAgencyId(), formDTO.getAreaCode()); |
|
|
|
//1.查询直属下级组织列表,有子客户的按areaCode查没有的按agencyId查
|
|
|
|
List<ScreenCustomerAgencyDTO> subAgencyList = indexService.getSubAgencyListByAgency(formDTO.getAgencyId()); |
|
|
|
if (subAgencyList.size() < NumConstant.ONE) { |
|
|
|
return resultList; |
|
|
|
} |
|
|
@ -425,8 +427,8 @@ public class DataStatsServiceImpl implements DataStatsService { |
|
|
|
formDTO.setType("group"); |
|
|
|
} |
|
|
|
|
|
|
|
//1.查询直属下级组织列表,有areaCode的按areaCode查,没有的按agencyId查
|
|
|
|
List<ScreenCustomerAgencyDTO> subAgencyList = indexService.getSubAgencyList(formDTO.getAgencyId(), formDTO.getAreaCode()); |
|
|
|
//1.查询直属下级组织列表,有子客户的按areaCode查没有的按agencyId查
|
|
|
|
List<ScreenCustomerAgencyDTO> subAgencyList = indexService.getSubAgencyListByAgency(formDTO.getAgencyId()); |
|
|
|
if (subAgencyList.size() < NumConstant.ONE) { |
|
|
|
return resultList; |
|
|
|
} |
|
|
@ -560,8 +562,8 @@ public class DataStatsServiceImpl implements DataStatsService { |
|
|
|
formDTO.setType("topic"); |
|
|
|
} |
|
|
|
|
|
|
|
//1.查询直属下级组织列表,有areaCode的按areaCode查,没有的按agencyId查
|
|
|
|
List<ScreenCustomerAgencyDTO> subAgencyList = indexService.getSubAgencyList(formDTO.getAgencyId(), formDTO.getAreaCode()); |
|
|
|
//1.查询直属下级组织列表,有子客户的按areaCode查没有的按agencyId查
|
|
|
|
List<ScreenCustomerAgencyDTO> subAgencyList = indexService.getSubAgencyListByAgency(formDTO.getAgencyId()); |
|
|
|
if (subAgencyList.size() < NumConstant.ONE) { |
|
|
|
return resultList; |
|
|
|
} |
|
|
@ -749,8 +751,8 @@ public class DataStatsServiceImpl implements DataStatsService { |
|
|
|
formDTO.setType("issue"); |
|
|
|
} |
|
|
|
|
|
|
|
//1.查询直属下级组织列表,有areaCode的按areaCode查,没有的按agencyId查
|
|
|
|
List<ScreenCustomerAgencyDTO> subAgencyList = indexService.getSubAgencyList(formDTO.getAgencyId(), formDTO.getAreaCode()); |
|
|
|
//1.查询直属下级组织列表,有子客户的按areaCode查没有的按agencyId查
|
|
|
|
List<ScreenCustomerAgencyDTO> subAgencyList = indexService.getSubAgencyListByAgency(formDTO.getAgencyId()); |
|
|
|
if (subAgencyList.size() < NumConstant.ONE) { |
|
|
|
return resultList; |
|
|
|
} |
|
|
@ -891,8 +893,8 @@ public class DataStatsServiceImpl implements DataStatsService { |
|
|
|
formDTO.setType("project"); |
|
|
|
} |
|
|
|
|
|
|
|
//1.查询直属下级组织列表,有areaCode的按areaCode查,没有的按agencyId查
|
|
|
|
List<ScreenCustomerAgencyDTO> subAgencyList = indexService.getSubAgencyList(formDTO.getAgencyId(), formDTO.getAreaCode()); |
|
|
|
//1.查询直属下级组织列表,有子客户的按areaCode查没有的按agencyId查
|
|
|
|
List<ScreenCustomerAgencyDTO> subAgencyList = indexService.getSubAgencyListByAgency(formDTO.getAgencyId()); |
|
|
|
if (subAgencyList.size() < NumConstant.ONE) { |
|
|
|
return resultList; |
|
|
|
} |
|
|
@ -1127,40 +1129,39 @@ public class DataStatsServiceImpl implements DataStatsService { |
|
|
|
SimpleDateFormat format = new SimpleDateFormat(DateUtils.DATE_PATTERN_YYYYMMDD); |
|
|
|
formDTO.setDateId(format.format(yesterday)); |
|
|
|
} |
|
|
|
if (OrgConstant.PROVINCE.equals(formDTO.getLevel()) || OrgConstant.CITY.equals(formDTO.getLevel()) || OrgConstant.DISTRICT.equals(formDTO.getLevel())) { |
|
|
|
if (StringUtils.isNotBlank(formDTO.getAreaCode())) { |
|
|
|
ScreenCustomerAgencyDTO agencyDTO = indexService.getAgencyInfo(formDTO.getAgencyId()); |
|
|
|
if (customerRelation.haveSubCustomer(agencyDTO.getCustomerId())) { |
|
|
|
|
|
|
|
List<String> subAgencyIds = indexService.getAgencyByAreaCodeAgencyId(formDTO.getAgencyId(), formDTO.getAreaCode()); |
|
|
|
if (CollectionUtils.isEmpty(subAgencyIds)) { |
|
|
|
subAgencyIds = new ArrayList<>(); |
|
|
|
} |
|
|
|
subAgencyIds.add(formDTO.getAgencyId()); |
|
|
|
List<FactAgencyGovernDailyEntity> list = dataStatsDao.getAgencyGovernDaily(subAgencyIds, formDTO.getDateId()); |
|
|
|
if (CollectionUtils.isNotEmpty(list)) { |
|
|
|
//问题解决总数
|
|
|
|
Integer problemResolvedCount = list.stream().mapToInt(FactAgencyGovernDailyEntity ::getProblemResolvedCount).sum(); |
|
|
|
//未出小组即未转议题的:话题关闭已解决数
|
|
|
|
Integer inGroupTopicResolvedCount = list.stream().mapToInt(FactAgencyGovernDailyEntity ::getInGroupTopicResolvedCount).sum(); |
|
|
|
//未出小组即未转议题的:话题关闭无需解决数
|
|
|
|
Integer inGroupTopicUnResolvedCount = list.stream().mapToInt(FactAgencyGovernDailyEntity ::getInGroupTopicUnResolvedCount).sum(); |
|
|
|
//未出当前网格的,结案项目数
|
|
|
|
Integer gridSelfGovernProjectTotal = list.stream().mapToInt(FactAgencyGovernDailyEntity ::getGridSelfGovernProjectTotal).sum(); |
|
|
|
//由社区结案的项目总数
|
|
|
|
Integer communityClosedCount = list.stream().mapToInt(FactAgencyGovernDailyEntity ::getCommunityClosedCount).sum(); |
|
|
|
//由街道结案的项目总数
|
|
|
|
Integer streetClosedCount = list.stream().mapToInt(FactAgencyGovernDailyEntity ::getStreetClosedCount).sum(); |
|
|
|
//由区直部门结案的项目总数
|
|
|
|
Integer districtDeptClosedCount = list.stream().mapToInt(FactAgencyGovernDailyEntity ::getDistrictDeptClosedCount).sum(); |
|
|
|
|
|
|
|
resultDTO.setProblemResolvedCount(problemResolvedCount); |
|
|
|
resultDTO.setGroupSelfGovernRatio(getPercentage(inGroupTopicResolvedCount + inGroupTopicUnResolvedCount, problemResolvedCount)); |
|
|
|
resultDTO.setGridSelfGovernRatio(getPercentage(gridSelfGovernProjectTotal, problemResolvedCount)); |
|
|
|
resultDTO.setCommunityResolvedRatio(getPercentage(communityClosedCount, problemResolvedCount)); |
|
|
|
resultDTO.setStreetResolvedRatio(getPercentage(streetClosedCount, problemResolvedCount)); |
|
|
|
resultDTO.setDistrictDeptResolvedRatio(getPercentage(districtDeptClosedCount, problemResolvedCount)); |
|
|
|
|
|
|
|
return resultDTO; |
|
|
|
} |
|
|
|
List<String> subAgencyIds = indexService.getAgencyByAreaCodeAgencyId(formDTO.getAgencyId(), agencyDTO.getAreaCode()); |
|
|
|
if (CollectionUtils.isEmpty(subAgencyIds)) { |
|
|
|
subAgencyIds = new ArrayList<>(); |
|
|
|
} |
|
|
|
subAgencyIds.add(formDTO.getAgencyId()); |
|
|
|
List<FactAgencyGovernDailyEntity> list = dataStatsDao.getAgencyGovernDaily(subAgencyIds, formDTO.getDateId()); |
|
|
|
if (CollectionUtils.isNotEmpty(list)) { |
|
|
|
//问题解决总数
|
|
|
|
Integer problemResolvedCount = list.stream().mapToInt(FactAgencyGovernDailyEntity ::getProblemResolvedCount).sum(); |
|
|
|
//未出小组即未转议题的:话题关闭已解决数
|
|
|
|
Integer inGroupTopicResolvedCount = list.stream().mapToInt(FactAgencyGovernDailyEntity ::getInGroupTopicResolvedCount).sum(); |
|
|
|
//未出小组即未转议题的:话题关闭无需解决数
|
|
|
|
Integer inGroupTopicUnResolvedCount = list.stream().mapToInt(FactAgencyGovernDailyEntity ::getInGroupTopicUnResolvedCount).sum(); |
|
|
|
//未出当前网格的,结案项目数
|
|
|
|
Integer gridSelfGovernProjectTotal = list.stream().mapToInt(FactAgencyGovernDailyEntity ::getGridSelfGovernProjectTotal).sum(); |
|
|
|
//由社区结案的项目总数
|
|
|
|
Integer communityClosedCount = list.stream().mapToInt(FactAgencyGovernDailyEntity ::getCommunityClosedCount).sum(); |
|
|
|
//由街道结案的项目总数
|
|
|
|
Integer streetClosedCount = list.stream().mapToInt(FactAgencyGovernDailyEntity ::getStreetClosedCount).sum(); |
|
|
|
//由区直部门结案的项目总数
|
|
|
|
Integer districtDeptClosedCount = list.stream().mapToInt(FactAgencyGovernDailyEntity ::getDistrictDeptClosedCount).sum(); |
|
|
|
|
|
|
|
resultDTO.setProblemResolvedCount(problemResolvedCount); |
|
|
|
resultDTO.setGroupSelfGovernRatio(getPercentage(inGroupTopicResolvedCount + inGroupTopicUnResolvedCount, problemResolvedCount)); |
|
|
|
resultDTO.setGridSelfGovernRatio(getPercentage(gridSelfGovernProjectTotal, problemResolvedCount)); |
|
|
|
resultDTO.setCommunityResolvedRatio(getPercentage(communityClosedCount, problemResolvedCount)); |
|
|
|
resultDTO.setStreetResolvedRatio(getPercentage(streetClosedCount, problemResolvedCount)); |
|
|
|
resultDTO.setDistrictDeptResolvedRatio(getPercentage(districtDeptClosedCount, problemResolvedCount)); |
|
|
|
|
|
|
|
return resultDTO; |
|
|
|
} |
|
|
|
} |
|
|
|
//1.按日期查询当前组织事件治理指数
|
|
|
@ -1201,8 +1202,9 @@ public class DataStatsServiceImpl implements DataStatsService { |
|
|
|
return resultList; |
|
|
|
} |
|
|
|
List<String> agencyIds = subAgencyList.stream().map(DimAgencyEntity::getId).collect(Collectors.toList()); |
|
|
|
if (StringUtils.isNotBlank(formDTO.getAreaCode())) { |
|
|
|
List<ScreenCustomerAgencyDTO> subAgencies = indexService.getSubAgencyList(formDTO.getAgencyId(), formDTO.getAreaCode()); |
|
|
|
ScreenCustomerAgencyDTO agencyDTO = indexService.getAgencyInfo(formDTO.getAgencyId()); |
|
|
|
if (customerRelation.haveSubCustomer(agencyDTO.getCustomerId())) { |
|
|
|
List<ScreenCustomerAgencyDTO> subAgencies = indexService.getSubAgencyList(formDTO.getAgencyId(), agencyDTO.getAreaCode()); |
|
|
|
agencyIds = subAgencies.stream().map(ScreenCustomerAgencyDTO::getAgencyId).collect(Collectors.toList()); |
|
|
|
subAgencyList = subAgencies.stream().map(item -> { |
|
|
|
DimAgencyEntity entity = new DimAgencyEntity(); |
|
|
@ -1377,10 +1379,10 @@ public class DataStatsServiceImpl implements DataStatsService { |
|
|
|
SimpleDateFormat format = new SimpleDateFormat(DateUtils.DATE_PATTERN_YYYYMMDD); |
|
|
|
formDTO.setDateId(format.format(yesterday)); |
|
|
|
} |
|
|
|
|
|
|
|
if (OrgConstant.PROVINCE.equals(formDTO.getLevel()) || OrgConstant.CITY.equals(formDTO.getLevel()) || OrgConstant.DISTRICT.equals(formDTO.getLevel())) { |
|
|
|
if (StringUtils.isNotBlank(formDTO.getAreaCode())) { |
|
|
|
ScreenGovernRankDataDailyDTO governData = indexService.getGovernRank(formDTO.getOrgId(), formDTO.getAreaCode(), formDTO.getDateId()); |
|
|
|
if (OrgConstant.AGENCY.equals(formDTO.getOrgType())) { |
|
|
|
ScreenCustomerAgencyDTO agencyDTO = indexService.getAgencyInfo(formDTO.getOrgId()); |
|
|
|
if (customerRelation.haveSubCustomer(agencyDTO.getCustomerId())) { |
|
|
|
ScreenGovernRankDataDailyDTO governData = indexService.getGovernRank(formDTO.getOrgId(), agencyDTO.getAreaCode(), formDTO.getDateId()); |
|
|
|
resultDTO.setGovernRatio(getPercentage(governData.getGovernCount(), governData.getClosedCount())); |
|
|
|
resultDTO.setResolvedRatio(getPercentage(governData.getResolvedCount(), governData.getClosedCount())); |
|
|
|
resultDTO.setResponseRatio(getPercentage(governData.getResponseCount(), governData.getTransferCount())); |
|
|
|