|
|
@ -1,11 +1,9 @@ |
|
|
|
package com.epmet.service.evaluationindex.extract.toscreen.impl; |
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSON; |
|
|
|
import com.epmet.commons.tools.constant.NumConstant; |
|
|
|
import com.epmet.commons.tools.utils.ConvertUtils; |
|
|
|
import com.epmet.constant.ScreenConstant; |
|
|
|
import com.epmet.dto.extract.form.ExtractScreenFormDTO; |
|
|
|
import com.epmet.dto.extract.form.ScreenExtractFormDTO; |
|
|
|
import com.epmet.dto.extract.form.ScreenPartyBranchDataFormDTO; |
|
|
|
import com.epmet.dto.extract.form.ScreenPartyLinkMassesDataFormDTO; |
|
|
|
import com.epmet.dto.extract.result.*; |
|
|
@ -185,22 +183,22 @@ public class PartyGuideServiceImpl implements PartyGuideService { |
|
|
|
// 判断当前级别agency是否为空
|
|
|
|
if (!CollectionUtils.isEmpty(agencyIdList)){ |
|
|
|
// 获取agencyIds
|
|
|
|
List<String> orgIds = agencyIdList.stream().map(m -> m.getAgencyId()).collect(Collectors.toList()); |
|
|
|
if (isGrid == true){ |
|
|
|
List<String> orgIds = agencyIdList.stream().map(CustomerAgencyInfoResultDTO::getAgencyId).collect(Collectors.toList()); |
|
|
|
if (isGrid) { |
|
|
|
agencyIdList.forEach(agency -> { |
|
|
|
// 计算社区级别的下级(实际就是网格)
|
|
|
|
GridPartyGuideDTO gridPartyGuideDTO = communityLevelSubGrid(customerId, monthId, agency); |
|
|
|
GridPartyGuideDTO gridPartyGuideDTO = communityLevelSubGrid(customerId, agency); |
|
|
|
orgIds.addAll(gridPartyGuideDTO.getOrgIds()); |
|
|
|
result.addAll(gridPartyGuideDTO.getResult()); |
|
|
|
}); |
|
|
|
// 根据agencyId分组,计算各个社区的
|
|
|
|
Map<String, List<ScreenPartyLinkMassesDataFormDTO>> groupByAgency = result.stream().collect(Collectors.groupingBy(ScreenPartyLinkMassesDataFormDTO::getParentId)); |
|
|
|
groupByAgency.forEach((agencyId,gridList) -> { |
|
|
|
groupByAgency.forEach((agencyId, gridList) -> { |
|
|
|
ScreenPartyLinkMassesDataFormDTO form = new ScreenPartyLinkMassesDataFormDTO(); |
|
|
|
List<OrgNameResultDTO> orgNameAgencyList = agencyService.selectOrgNameAgency(orgIds); |
|
|
|
if (!CollectionUtils.isEmpty(orgNameAgencyList)){ |
|
|
|
orgNameAgencyList.forEach(name -> { |
|
|
|
if (agencyId.equals(name.getAgencyId())){ |
|
|
|
if (agencyId.equals(name.getAgencyId())) { |
|
|
|
form.setOrgName(name.getAgencyName()); |
|
|
|
form.setParentId(name.getParentId()); |
|
|
|
} |
|
|
@ -210,8 +208,8 @@ public class PartyGuideServiceImpl implements PartyGuideService { |
|
|
|
form.setCustomerId(customerId); |
|
|
|
form.setDataEndTime(monthId); |
|
|
|
form.setOrgType(ScreenConstant.AGENCY); |
|
|
|
form.setCreateGroupTotal(gridList.stream().collect(Collectors.summingInt(ScreenPartyLinkMassesDataFormDTO::getCreateGroupTotal))); |
|
|
|
form.setGroupUserTotal(gridList.stream().collect(Collectors.summingInt(ScreenPartyLinkMassesDataFormDTO::getGroupUserTotal))); |
|
|
|
form.setCreateGroupTotal(gridList.stream().mapToInt(ScreenPartyLinkMassesDataFormDTO::getCreateGroupTotal).sum()); |
|
|
|
form.setGroupUserTotal(gridList.stream().mapToInt(ScreenPartyLinkMassesDataFormDTO::getGroupUserTotal).sum()); |
|
|
|
result.add(form); |
|
|
|
}); |
|
|
|
delAndInsertLink(result,customerId,monthId,orgIds); |
|
|
@ -227,15 +225,15 @@ public class PartyGuideServiceImpl implements PartyGuideService { |
|
|
|
} |
|
|
|
}); |
|
|
|
// 不为空 存在直属网格
|
|
|
|
if (!CollectionUtils.isEmpty(disGridIds)){ |
|
|
|
if (!CollectionUtils.isEmpty(disGridIds)) { |
|
|
|
List<ScreenPartyLinkMassesDataFormDTO> gridResult = new ArrayList<>(); |
|
|
|
// 查询党员创建组,组内成员数
|
|
|
|
List<ScreenPartyLinkMassesDataFormDTO> partyLinkMassesDataList = groupMainService.selectPartyCreateGroupInfo(customerId, monthId, disGridIds); |
|
|
|
List<OrgNameResultDTO> orgNameList = agencyService.selectOrgNameGrid(partyLinkMassesDataList.stream().map(m -> m.getOrgId()).collect(Collectors.toList())); |
|
|
|
if (!CollectionUtils.isEmpty(partyLinkMassesDataList)){ |
|
|
|
List<ScreenPartyLinkMassesDataFormDTO> partyLinkMassesDataList = groupMainService.selectPartyCreateGroupInfo(customerId, disGridIds); |
|
|
|
List<OrgNameResultDTO> orgNameList = agencyService.selectOrgNameGrid(partyLinkMassesDataList.stream().map(ScreenPartyLinkMassesDataFormDTO::getOrgId).collect(Collectors.toList())); |
|
|
|
if (!CollectionUtils.isEmpty(partyLinkMassesDataList)) { |
|
|
|
partyLinkMassesDataList.forEach(party -> { |
|
|
|
orgNameList.forEach(org -> { |
|
|
|
if (party.getOrgId().equals(org.getGridId())){ |
|
|
|
if (party.getOrgId().equals(org.getGridId())) { |
|
|
|
party.setOrgName(org.getGridName()); |
|
|
|
} |
|
|
|
}); |
|
|
@ -246,10 +244,10 @@ public class PartyGuideServiceImpl implements PartyGuideService { |
|
|
|
delAndInsertLink(gridResult,customerId,monthId,disGridIds); |
|
|
|
} |
|
|
|
// 查询直属网格的信息 + 下级机关的信息 = agency的机关信息
|
|
|
|
List<ScreenPartyLinkMassesDataFormDTO> screenPartyLinkMassesDataGrid = groupMainService.selectPartyCreateGroupInfo(customerId, monthId, disGridIds); |
|
|
|
List<ScreenPartyLinkMassesDataFormDTO> screenPartyLinkMassesDataGrid = groupMainService.selectPartyCreateGroupInfo(customerId, disGridIds); |
|
|
|
List<ScreenPartyLinkMassesDataFormDTO> screenPartyLinkMassesDataList = linkMassesDataService.selectPartyLinkMassesInfo(customerId, monthId, agencyId); |
|
|
|
screenPartyLinkMassesDataList.addAll(screenPartyLinkMassesDataGrid); |
|
|
|
if (!CollectionUtils.isEmpty(screenPartyLinkMassesDataList)){ |
|
|
|
if (!CollectionUtils.isEmpty(screenPartyLinkMassesDataList)) { |
|
|
|
ScreenPartyLinkMassesDataFormDTO form = new ScreenPartyLinkMassesDataFormDTO(); |
|
|
|
form.setOrgId(agencyId); |
|
|
|
form.setOrgType(ScreenConstant.AGENCY); |
|
|
@ -257,8 +255,8 @@ public class PartyGuideServiceImpl implements PartyGuideService { |
|
|
|
form.setCustomerId(customerId); |
|
|
|
form.setDataEndTime(monthId); |
|
|
|
form.setParentId(screenPartyLinkMassesDataList.get(NumConstant.ZERO).getParentId()); |
|
|
|
form.setGroupUserTotal(screenPartyLinkMassesDataList.stream().collect(Collectors.summingInt(ScreenPartyLinkMassesDataFormDTO::getGroupUserTotal))); |
|
|
|
form.setCreateGroupTotal(screenPartyLinkMassesDataList.stream().collect(Collectors.summingInt(ScreenPartyLinkMassesDataFormDTO::getCreateGroupTotal))); |
|
|
|
form.setGroupUserTotal(screenPartyLinkMassesDataList.stream().mapToInt(ScreenPartyLinkMassesDataFormDTO::getGroupUserTotal).sum()); |
|
|
|
form.setCreateGroupTotal(screenPartyLinkMassesDataList.stream().mapToInt(ScreenPartyLinkMassesDataFormDTO::getCreateGroupTotal).sum()); |
|
|
|
result.add(form); |
|
|
|
} |
|
|
|
}); |
|
|
@ -431,24 +429,23 @@ public class PartyGuideServiceImpl implements PartyGuideService { |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @Description 社区级别的处理 |
|
|
|
* @Description 社区级别的处理 |
|
|
|
* @Param customerId |
|
|
|
* @Param monthId |
|
|
|
* @Param agency |
|
|
|
* @author zxc |
|
|
|
* @date 2020/9/25 10:06 上午 |
|
|
|
*/ |
|
|
|
public GridPartyGuideDTO communityLevelSubGrid(String customerId, String monthId, CustomerAgencyInfoResultDTO agency){ |
|
|
|
public GridPartyGuideDTO communityLevelSubGrid(String customerId, CustomerAgencyInfoResultDTO agency) { |
|
|
|
String agencyId = agency.getAgencyId(); |
|
|
|
// 获取下级所有agencyId【根据agencyMap中的level判断下级orgId是否是gridId】(此处直接作为gridId)
|
|
|
|
Map<String, Object> agencyMap = agencyService.selectAllSubAgencyId(agencyId, customerId); |
|
|
|
List<String> gridIds = (List<String>) agencyMap.get(agencyId); |
|
|
|
List<ScreenPartyLinkMassesDataFormDTO> partyLinkMassesDataList = groupMainService.selectPartyCreateGroupInfo(customerId, monthId, gridIds); |
|
|
|
List<ScreenPartyLinkMassesDataFormDTO> partyLinkMassesDataList = groupMainService.selectPartyCreateGroupInfo(customerId, gridIds); |
|
|
|
List<String> orgIds = partyLinkMassesDataList.stream().map(m -> m.getOrgId()).collect(Collectors.toList()); |
|
|
|
List<OrgNameResultDTO> orgNameList = agencyService.selectOrgNameGrid(orgIds); |
|
|
|
partyLinkMassesDataList.forEach(party -> { |
|
|
|
orgNameList.forEach(orgName -> { |
|
|
|
if (party.getOrgId().equals(orgName.getGridId())){ |
|
|
|
if (party.getOrgId().equals(orgName.getGridId())) { |
|
|
|
party.setOrgName(orgName.getGridName()); |
|
|
|
} |
|
|
|
}); |
|
|
|