|
|
|
@ -76,7 +76,7 @@ public class PartyGuideServiceImpl implements PartyGuideService { |
|
|
|
} |
|
|
|
String monthId = screenExtractFormDTO.getMonthId(); |
|
|
|
if (StringUtils.isEmpty(monthId)){ |
|
|
|
monthId = LocalDate.now().toString().replace("-","").substring(NumConstant.ZERO,NumConstant.SIX); |
|
|
|
monthId = LocalDate.now().minusMonths(NumConstant.ONE).toString().replace("-","").substring(NumConstant.ZERO,NumConstant.SIX); |
|
|
|
} |
|
|
|
if (!CollectionUtils.isEmpty(customerIds)){ |
|
|
|
String finalMonthId = monthId; |
|
|
|
@ -273,8 +273,10 @@ public class PartyGuideServiceImpl implements PartyGuideService { |
|
|
|
if (!CollectionUtils.isEmpty(agencyIdList)){ |
|
|
|
List<ScreenPartyBranchDataFormDTO> result = new ArrayList<>(); |
|
|
|
List<String> orgIds = agencyIdList.stream().map(m -> m.getAgencyId()).collect(Collectors.toList()); |
|
|
|
List<JoinUserCountResultDTO> joinUserCountByAgencyList = actUserRelationService.selectJoinUserCount(customerId, monthId, ScreenConstant.AGENCY); |
|
|
|
List<ScreenPartyBranchDataFormDTO> screenPartyBranchDataByAgencyList = actInfoService.selectActInfo(customerId, monthId, ScreenConstant.AGENCY, orgIds); |
|
|
|
if (isGrid == true){ |
|
|
|
List<JoinUserCountResultDTO> joinUserCountList = actUserRelationService.selectJoinUserCount(customerId, monthId); |
|
|
|
List<JoinUserCountResultDTO> joinUserCountList = actUserRelationService.selectJoinUserCount(customerId, monthId, ScreenConstant.GRID); |
|
|
|
agencyIdList.forEach(agency -> { |
|
|
|
String agencyId = agency.getAgencyId(); |
|
|
|
Map<String, Object> agencyMap = agencyService.selectAllSubAgencyId(agencyId, customerId); |
|
|
|
@ -286,7 +288,7 @@ public class PartyGuideServiceImpl implements PartyGuideService { |
|
|
|
joinUserCountList.forEach(join -> { |
|
|
|
if (party.getOrgId().equals(join.getOrgId())){ |
|
|
|
party.setAverageJoinUserCount(join.getJoinUserCount()); |
|
|
|
party.setAverageJoinUserCount(party.getJoinUserCount() / party.getOrganizeCount()); |
|
|
|
party.setAverageJoinUserCount(party.getOrganizeCount()==NumConstant.ZERO ? NumConstant.ZERO : party.getJoinUserCount() / party.getOrganizeCount()); |
|
|
|
party.setYearId(DateUtils.getYearId(monthId)); |
|
|
|
} |
|
|
|
}); |
|
|
|
@ -314,7 +316,17 @@ public class PartyGuideServiceImpl implements PartyGuideService { |
|
|
|
form.setYearId(DateUtils.getYearId(monthId)); |
|
|
|
form.setOrganizeCount(actList.stream().collect(Collectors.summingInt(ScreenPartyBranchDataFormDTO::getOrganizeCount))); |
|
|
|
form.setJoinUserCount(actList.stream().collect(Collectors.summingInt(ScreenPartyBranchDataFormDTO::getJoinUserCount))); |
|
|
|
form.setAverageJoinUserCount(form.getJoinUserCount() / form.getOrganizeCount()); |
|
|
|
screenPartyBranchDataByAgencyList.forEach(organize -> { |
|
|
|
if (organize.getOrgId().equals(agencyId)){ |
|
|
|
form.setOrganizeCount(calAdd(organize.getOrganizeCount(),actList.stream().collect(Collectors.summingInt(ScreenPartyBranchDataFormDTO::getOrganizeCount)))); |
|
|
|
} |
|
|
|
}); |
|
|
|
joinUserCountByAgencyList.forEach(join -> { |
|
|
|
if (join.getOrgId().equals(agencyId)){ |
|
|
|
form.setJoinUserCount(calAdd(join.getJoinUserCount(),actList.stream().collect(Collectors.summingInt(ScreenPartyBranchDataFormDTO::getJoinUserCount)))); |
|
|
|
} |
|
|
|
}); |
|
|
|
form.setAverageJoinUserCount(form.getOrganizeCount()==NumConstant.ZERO?NumConstant.ZERO : (form.getJoinUserCount() / form.getOrganizeCount())); |
|
|
|
result.add(form); |
|
|
|
}); |
|
|
|
delAndInsertOrganize(result,customerId,monthId,orgIds); |
|
|
|
@ -330,15 +342,17 @@ public class PartyGuideServiceImpl implements PartyGuideService { |
|
|
|
}); |
|
|
|
// 存在直属网格
|
|
|
|
if (!CollectionUtils.isEmpty(disGridIds)){ |
|
|
|
orgIds.addAll(disGridIds); |
|
|
|
List<ScreenPartyBranchDataFormDTO> gridResult = new ArrayList<>(); |
|
|
|
List<JoinUserCountResultDTO> joinUserCountList = actUserRelationService.selectJoinUserCount(customerId, monthId); |
|
|
|
List<OrgNameResultDTO> orgNameList = agencyService.selectOrgNameGrid(disGridIds); |
|
|
|
List<JoinUserCountResultDTO> joinUserCountList = actUserRelationService.selectJoinUserCount(customerId, monthId, ScreenConstant.GRID); |
|
|
|
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()); |
|
|
|
joinUserCountList.forEach(join -> { |
|
|
|
if (party.getOrgId().equals(join.getOrgId())){ |
|
|
|
party.setAverageJoinUserCount(join.getJoinUserCount()); |
|
|
|
party.setAverageJoinUserCount(party.getOrganizeCount()==NumConstant.ZERO ? NumConstant.ZERO : party.getJoinUserCount() / party.getOrganizeCount()); |
|
|
|
party.setYearId(DateUtils.getYearId(monthId)); |
|
|
|
} |
|
|
|
}); |
|
|
|
ScreenPartyBranchDataFormDTO copyParty = ConvertUtils.sourceToTarget(party, ScreenPartyBranchDataFormDTO.class); |
|
|
|
@ -360,7 +374,17 @@ public class PartyGuideServiceImpl implements PartyGuideService { |
|
|
|
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()); |
|
|
|
screenPartyBranchDataByAgencyList.forEach(organize -> { |
|
|
|
if (organize.getOrgId().equals(agencyId)){ |
|
|
|
form.setOrganizeCount(calAdd(organize.getOrganizeCount(),screenPartyBranchDataList.stream().collect(Collectors.summingInt(ScreenPartyBranchDataFormDTO::getOrganizeCount)))); |
|
|
|
} |
|
|
|
}); |
|
|
|
joinUserCountByAgencyList.forEach(join -> { |
|
|
|
if (join.getOrgId().equals(agencyId)){ |
|
|
|
form.setJoinUserCount(calAdd(join.getJoinUserCount(),screenPartyBranchDataList.stream().collect(Collectors.summingInt(ScreenPartyBranchDataFormDTO::getJoinUserCount)))); |
|
|
|
} |
|
|
|
}); |
|
|
|
form.setAverageJoinUserCount(form.getOrganizeCount()==NumConstant.ZERO?NumConstant.ZERO : (form.getJoinUserCount() / form.getOrganizeCount())); |
|
|
|
result.add(form); |
|
|
|
} |
|
|
|
}); |
|
|
|
@ -369,6 +393,13 @@ public class PartyGuideServiceImpl implements PartyGuideService { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
public Integer calAdd(Integer a, Integer b){ |
|
|
|
if (null != a && null != b){ |
|
|
|
return a + b; |
|
|
|
} |
|
|
|
return NumConstant.ZERO; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @Description 社区级别的处理 |
|
|
|
* @Param customerId |
|
|
|
|