|
@ -2,6 +2,7 @@ package com.epmet.service.evaluationindex.extract.toscreen.impl; |
|
|
|
|
|
|
|
|
import com.epmet.commons.tools.constant.NumConstant; |
|
|
import com.epmet.commons.tools.constant.NumConstant; |
|
|
import com.epmet.commons.tools.utils.ConvertUtils; |
|
|
import com.epmet.commons.tools.utils.ConvertUtils; |
|
|
|
|
|
import com.epmet.commons.tools.utils.DateUtils; |
|
|
import com.epmet.constant.ScreenConstant; |
|
|
import com.epmet.constant.ScreenConstant; |
|
|
import com.epmet.dto.extract.form.ScreenExtractFormDTO; |
|
|
import com.epmet.dto.extract.form.ScreenExtractFormDTO; |
|
|
import com.epmet.dto.extract.form.ScreenPartyBranchDataFormDTO; |
|
|
import com.epmet.dto.extract.form.ScreenPartyBranchDataFormDTO; |
|
@ -286,13 +287,13 @@ public class PartyGuideServiceImpl implements PartyGuideService { |
|
|
if (party.getOrgId().equals(join.getOrgId())){ |
|
|
if (party.getOrgId().equals(join.getOrgId())){ |
|
|
party.setAverageJoinUserCount(join.getJoinUserCount()); |
|
|
party.setAverageJoinUserCount(join.getJoinUserCount()); |
|
|
party.setAverageJoinUserCount(party.getJoinUserCount() / party.getOrganizeCount()); |
|
|
party.setAverageJoinUserCount(party.getJoinUserCount() / party.getOrganizeCount()); |
|
|
|
|
|
party.setYearId(DateUtils.getYearId(monthId)); |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
|
result.addAll(screenPartyBranchDataList); |
|
|
result.addAll(screenPartyBranchDataList); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
// 社区级别的
|
|
|
// 社区级别的
|
|
|
Map<String, List<ScreenPartyBranchDataFormDTO>> groupByAgency = result.stream().collect(Collectors.groupingBy(ScreenPartyBranchDataFormDTO::getParentId)); |
|
|
Map<String, List<ScreenPartyBranchDataFormDTO>> groupByAgency = result.stream().collect(Collectors.groupingBy(ScreenPartyBranchDataFormDTO::getParentId)); |
|
|
List<OrgNameResultDTO> orgNameAgencyList = agencyService.selectOrgNameAgency(orgIds); |
|
|
List<OrgNameResultDTO> orgNameAgencyList = agencyService.selectOrgNameAgency(orgIds); |
|
@ -309,14 +310,61 @@ public class PartyGuideServiceImpl implements PartyGuideService { |
|
|
form.setOrgId(agencyId); |
|
|
form.setOrgId(agencyId); |
|
|
form.setCustomerId(customerId); |
|
|
form.setCustomerId(customerId); |
|
|
form.setOrgType(ScreenConstant.AGENCY); |
|
|
form.setOrgType(ScreenConstant.AGENCY); |
|
|
|
|
|
form.setMonthId(monthId); |
|
|
|
|
|
form.setYearId(DateUtils.getYearId(monthId)); |
|
|
form.setOrganizeCount(actList.stream().collect(Collectors.summingInt(ScreenPartyBranchDataFormDTO::getOrganizeCount))); |
|
|
form.setOrganizeCount(actList.stream().collect(Collectors.summingInt(ScreenPartyBranchDataFormDTO::getOrganizeCount))); |
|
|
form.setJoinUserCount(actList.stream().collect(Collectors.summingInt(ScreenPartyBranchDataFormDTO::getJoinUserCount))); |
|
|
form.setJoinUserCount(actList.stream().collect(Collectors.summingInt(ScreenPartyBranchDataFormDTO::getJoinUserCount))); |
|
|
form.setAverageJoinUserCount(form.getJoinUserCount() / form.getOrganizeCount()); |
|
|
form.setAverageJoinUserCount(form.getJoinUserCount() / form.getOrganizeCount()); |
|
|
result.add(form); |
|
|
result.add(form); |
|
|
}); |
|
|
}); |
|
|
|
|
|
delAndInsertOrganize(result,customerId,monthId,orgIds); |
|
|
}else { |
|
|
}else { |
|
|
|
|
|
List<GridInfoResultDTO> directGridIds = gridService.selectDirectGrid(orgIds); |
|
|
|
|
|
agencyIdList.forEach(agency -> { |
|
|
|
|
|
String agencyId = agency.getAgencyId(); |
|
|
|
|
|
List<String> disGridIds = new ArrayList<>(); |
|
|
|
|
|
directGridIds.forEach(grid -> { |
|
|
|
|
|
if (agencyId.equals(grid.getAgencyId())){ |
|
|
|
|
|
disGridIds.add(grid.getGridId()); |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
// 存在直属网格
|
|
|
|
|
|
if (!CollectionUtils.isEmpty(disGridIds)){ |
|
|
|
|
|
List<ScreenPartyBranchDataFormDTO> gridResult = new ArrayList<>(); |
|
|
|
|
|
List<JoinUserCountResultDTO> joinUserCountList = actUserRelationService.selectJoinUserCount(customerId, monthId); |
|
|
|
|
|
List<OrgNameResultDTO> orgNameList = agencyService.selectOrgNameGrid(disGridIds); |
|
|
|
|
|
List<ScreenPartyBranchDataFormDTO> screenPartyBranchDataList = actInfoService.selectActInfo(customerId, monthId, ScreenConstant.GRID, disGridIds); |
|
|
|
|
|
if (!CollectionUtils.isEmpty(screenPartyBranchDataList)){ |
|
|
|
|
|
screenPartyBranchDataList.forEach(party -> { |
|
|
|
|
|
orgNameList.forEach(org -> { |
|
|
|
|
|
if (party.getOrgId().equals(org.getGridId())){ |
|
|
|
|
|
party.setOrgName(org.getGridName()); |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
ScreenPartyBranchDataFormDTO copyParty = ConvertUtils.sourceToTarget(party, ScreenPartyBranchDataFormDTO.class); |
|
|
|
|
|
gridResult.add(copyParty); |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
List<ScreenPartyBranchDataFormDTO> disPartyBranchDataList = partyBranchDataService.selectScreenPartyBranchDataByOrgId(customerId, monthId, disGridIds); |
|
|
|
|
|
List<ScreenPartyBranchDataFormDTO> screenPartyBranchDataList = partyBranchDataService.selectScreenPartyBranchDataByParentId(customerId, monthId, agencyId); |
|
|
|
|
|
screenPartyBranchDataList.addAll(disPartyBranchDataList); |
|
|
|
|
|
if (!CollectionUtils.isEmpty(screenPartyBranchDataList)){ |
|
|
|
|
|
ScreenPartyBranchDataFormDTO form = new ScreenPartyBranchDataFormDTO(); |
|
|
|
|
|
form.setOrgId(agencyId); |
|
|
|
|
|
form.setOrgType(ScreenConstant.AGENCY); |
|
|
|
|
|
form.setOrgName(screenPartyBranchDataList.get(NumConstant.ZERO).getOrgName()); |
|
|
|
|
|
form.setCustomerId(customerId); |
|
|
|
|
|
form.setMonthId(monthId); |
|
|
|
|
|
form.setYearId(DateUtils.getYearId(monthId)); |
|
|
|
|
|
form.setParentId(screenPartyBranchDataList.get(NumConstant.ZERO).getParentId()); |
|
|
|
|
|
form.setJoinUserCount(screenPartyBranchDataList.stream().collect(Collectors.summingInt(ScreenPartyBranchDataFormDTO::getJoinUserCount))); |
|
|
|
|
|
form.setOrganizeCount(screenPartyBranchDataList.stream().collect(Collectors.summingInt(ScreenPartyBranchDataFormDTO::getOrganizeCount))); |
|
|
|
|
|
form.setAverageJoinUserCount(form.getJoinUserCount() / form.getOrganizeCount()); |
|
|
|
|
|
result.add(form); |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
delAndInsertOrganize(result,customerId,monthId,orgIds); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
@ -381,7 +429,7 @@ public class PartyGuideServiceImpl implements PartyGuideService { |
|
|
} |
|
|
} |
|
|
Integer delNum; |
|
|
Integer delNum; |
|
|
do { |
|
|
do { |
|
|
delNum = linkMassesDataService.deleteOldPartyLinkInfo(customerId, monthId, orgIds); |
|
|
delNum = linkMassesDataService.deleteOldPartyLinkInfo(customerId, orgIds); |
|
|
}while (delNum > NumConstant.ZERO); |
|
|
}while (delNum > NumConstant.ZERO); |
|
|
List<List<ScreenPartyLinkMassesDataFormDTO>> partition = ListUtils.partition(finalResult, NumConstant.ONE_HUNDRED); |
|
|
List<List<ScreenPartyLinkMassesDataFormDTO>> partition = ListUtils.partition(finalResult, NumConstant.ONE_HUNDRED); |
|
|
partition.forEach(p -> { |
|
|
partition.forEach(p -> { |
|
@ -403,6 +451,31 @@ public class PartyGuideServiceImpl implements PartyGuideService { |
|
|
List<ScreenPartyBranchDataFormDTO> screenPartyBranchData = agencyService.selectAllAgencyIdToOrganize(customerId, monthId); |
|
|
List<ScreenPartyBranchDataFormDTO> screenPartyBranchData = agencyService.selectAllAgencyIdToOrganize(customerId, monthId); |
|
|
List<ScreenPartyBranchDataFormDTO> screenPartyBranchDataList = gridService.selectAllGridIdToOrganize(customerId, monthId); |
|
|
List<ScreenPartyBranchDataFormDTO> screenPartyBranchDataList = gridService.selectAllGridIdToOrganize(customerId, monthId); |
|
|
screenPartyBranchDataList.addAll(screenPartyBranchData); |
|
|
screenPartyBranchDataList.addAll(screenPartyBranchData); |
|
|
|
|
|
List<ScreenPartyBranchDataFormDTO> finalResult = new ArrayList<>(); |
|
|
|
|
|
screenPartyBranchDataList.forEach(rl -> { |
|
|
|
|
|
orgIds.forEach(orgId -> { |
|
|
|
|
|
if (rl.getOrgId().equals(orgId)){ |
|
|
|
|
|
finalResult.add(rl); |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
}); |
|
|
|
|
|
if (!CollectionUtils.isEmpty(result)){ |
|
|
|
|
|
finalResult.forEach(fr -> { |
|
|
|
|
|
result.forEach(r -> { |
|
|
|
|
|
if (fr.getOrgId().equals(r.getOrgId())){ |
|
|
|
|
|
BeanUtils.copyProperties(r,fr); |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
Integer delNum; |
|
|
|
|
|
do { |
|
|
|
|
|
delNum = partyBranchDataService.deleteOldScreenPartyBranchData(customerId, monthId, orgIds); |
|
|
|
|
|
}while (delNum > NumConstant.ZERO); |
|
|
|
|
|
List<List<ScreenPartyBranchDataFormDTO>> partition = ListUtils.partition(finalResult, NumConstant.ONE_HUNDRED); |
|
|
|
|
|
partition.forEach(p -> { |
|
|
|
|
|
partyBranchDataService.insertScreenPartyBranchData(p); |
|
|
|
|
|
}); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|