From a2893f62ad6036e301d4919ae861dc75e53badb5 Mon Sep 17 00:00:00 2001 From: zxc <1272811460@qq.com> Date: Sun, 27 Sep 2020 18:08:15 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=84=E7=BB=87=E6=AC=A1=E6=95=B0=EF=BC=8C?= =?UTF-8?q?=E5=8F=82=E4=B8=8E=E4=BA=BA=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../extract/toscreen/impl/PartyGuideServiceImpl.java | 10 +++------- .../main/resources/mapper/heart/ActUserRelation.xml | 6 ++++-- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PartyGuideServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PartyGuideServiceImpl.java index 911ea86352..deddc49f27 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PartyGuideServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PartyGuideServiceImpl.java @@ -283,7 +283,7 @@ public class PartyGuideServiceImpl implements PartyGuideService { if (isGrid == false){ orgIds.addAll(directGridIds.stream().map(m -> m.getGridId()).collect(Collectors.toList())); } - List joinUserCountByAgencyList = actUserRelationService.selectJoinUserCount(customerId, monthId, ScreenConstant.AGENCY); + List joinUserCountList = actUserRelationService.selectJoinUserCount(customerId, monthId, null); List screenPartyBranchDataByAgencyList = actInfoService.selectActInfo(customerId, monthId, ScreenConstant.AGENCY, orgIds); List screenPartyBranchData = agencyService.selectAllAgencyIdToOrganize(customerId, monthId); List screenPartyBranchDataListAgencyAll = gridService.selectAllGridIdToOrganize(customerId, monthId); @@ -297,7 +297,6 @@ public class PartyGuideServiceImpl implements PartyGuideService { }); }); if (isGrid == true){ - List joinUserCountList = actUserRelationService.selectJoinUserCount(customerId, monthId, ScreenConstant.GRID); agencyIdList.forEach(agency -> { List screenPartyBranchDataList = actInfoService.selectActInfo(customerId, monthId, ScreenConstant.GRID, orgIds); finalResult.forEach(fl -> { @@ -329,7 +328,7 @@ public class PartyGuideServiceImpl implements PartyGuideService { fl.setOrganizeCount(calAdd(organize.getOrganizeCount(),actList.stream().collect(Collectors.summingInt(ScreenPartyBranchDataFormDTO::getOrganizeCount)))); } }); - joinUserCountByAgencyList.forEach(join -> { + joinUserCountList.forEach(join -> { if (join.getOrgId().equals(agencyId)){ fl.setJoinUserCount(calAdd(join.getJoinUserCount(),actList.stream().collect(Collectors.summingInt(ScreenPartyBranchDataFormDTO::getJoinUserCount)))); } @@ -340,7 +339,6 @@ public class PartyGuideServiceImpl implements PartyGuideService { }); } }); - log.error("结果"+JSON.toJSONString(finalResult)); delOrganize(customerId,monthId,orgIds); insertOrganize(finalResult); }else { @@ -355,7 +353,6 @@ public class PartyGuideServiceImpl implements PartyGuideService { // 存在直属网格 if (!CollectionUtils.isEmpty(disGridIds)){ orgIds.addAll(disGridIds); - List joinUserCountList = actUserRelationService.selectJoinUserCount(customerId, monthId, ScreenConstant.GRID); List screenPartyBranchDataList = actInfoService.selectActInfo(customerId, monthId, ScreenConstant.GRID, disGridIds); finalResult.forEach(r -> { screenPartyBranchDataList.forEach(party ->{ @@ -384,13 +381,12 @@ public class PartyGuideServiceImpl implements PartyGuideService { form.setOrganizeCount(calAdd(organize.getOrganizeCount(),screenPartyBranchDataList.stream().collect(Collectors.summingInt(ScreenPartyBranchDataFormDTO::getOrganizeCount)))); } }); - joinUserCountByAgencyList.forEach(join -> { + joinUserCountList.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())); - }); } }); diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/heart/ActUserRelation.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/heart/ActUserRelation.xml index cc1254716e..4d49a71968 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/heart/ActUserRelation.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/heart/ActUserRelation.xml @@ -10,7 +10,7 @@ COUNT(asr.USER_ID) AS joinUserCount FROM act_user_relation asr - LEFT JOIN act_info ai ON asr.ACT_ID = ai.ID + LEFT JOIN act_info ai ON asr.ACT_ID = ai.ID WHERE ai.DEL_FLAG = 0 AND asr.DEL_FLAG = '0' @@ -18,7 +18,9 @@ AND asr.REWARD_FLAG = 'agree' AND ai.CUSTOMER_ID = #{customerId} AND DATE_FORMAT( ai.ACTUAL_END_TIME, '%Y%m' ) = #{monthId} - AND ai.SPONSOR_TYPE = #{orgType} + + AND ai.SPONSOR_TYPE = #{orgType} + GROUP BY ai.SPONSOR_ID