From e64197421cf28099935f71f193989a3394d47fe0 Mon Sep 17 00:00:00 2001
From: mrzcc <121184950@qq.com>
Date: 星期一, 17 二月 2020 18:12:38 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 Api/src/main/java/com/java110/api/listener/community/ListMyEnteredCommunitysListener.java |   27 +++++++++++++++++++++++----
 1 files changed, 23 insertions(+), 4 deletions(-)

diff --git a/Api/src/main/java/com/java110/api/listener/community/ListMyEnteredCommunitysListener.java b/Api/src/main/java/com/java110/api/listener/community/ListMyEnteredCommunitysListener.java
index 662f501..7b70ac0 100644
--- a/Api/src/main/java/com/java110/api/listener/community/ListMyEnteredCommunitysListener.java
+++ b/Api/src/main/java/com/java110/api/listener/community/ListMyEnteredCommunitysListener.java
@@ -5,9 +5,11 @@
 import com.java110.core.annotation.Java110Listener;
 import com.java110.core.context.DataFlowContext;
 import com.java110.core.smo.community.ICommunityInnerServiceSMO;
+import com.java110.core.smo.org.IOrgCommunityInnerServiceSMO;
 import com.java110.core.smo.org.IOrgInnerServiceSMO;
 import com.java110.core.smo.org.IOrgStaffRelInnerServiceSMO;
 import com.java110.dto.community.CommunityDto;
+import com.java110.dto.org.OrgCommunityDto;
 import com.java110.dto.org.OrgDto;
 import com.java110.dto.org.OrgStaffRelDto;
 import com.java110.event.service.api.ServiceDataFlowEvent;
@@ -37,6 +39,9 @@
 
     @Autowired
     private IOrgStaffRelInnerServiceSMO orgStaffRelInnerServiceSMOImpl;
+
+    @Autowired
+    private IOrgCommunityInnerServiceSMO orgCommunityInnerServiceSMOImpl;
 
     @Autowired
     private IOrgInnerServiceSMO orgInnerServiceSMOImpl;
@@ -92,6 +97,7 @@
         List<OrgDto> orgDtos = orgInnerServiceSMOImpl.queryOrgs(orgDto);
 
         Assert.listOnlyOne(orgDtos, "鏍规嵁缁勭粐ID鏈煡璇㈠埌鍛樺伐瀵瑰簲閮ㄩ棬淇℃伅鎴栨煡璇㈠埌澶氭潯鏁版嵁");
+
         int count = 0;
         List<ApiCommunityDataVo> communitys = null;
         if ("9999".equals(orgDtos.get(0).getBelongCommunityId())) {
@@ -105,10 +111,23 @@
                 communitys = new ArrayList<>();
             }
         } else {
-            CommunityDto communityDto = new CommunityDto();
-            communityDto.setCommunityId(orgDtos.get(0).getBelongCommunityId());
-            communitys = BeanConvertUtil.covertBeanList(communityInnerServiceSMOImpl.queryCommunitys(communityDto), ApiCommunityDataVo.class);
-            count = 1;
+            String companyOrgId = orgDtos.get(0).getParentOrgId();
+            OrgCommunityDto orgCommunityDto = new OrgCommunityDto();
+            orgCommunityDto.setOrgId(companyOrgId);
+            count = orgCommunityInnerServiceSMOImpl.queryOrgCommunitysCount(orgCommunityDto);
+            if (count > 0) {
+                List<OrgCommunityDto> orgCommunityDtos = orgCommunityInnerServiceSMOImpl.queryOrgCommunitys(orgCommunityDto);
+                communitys = BeanConvertUtil.covertBeanList(orgCommunityDtos, ApiCommunityDataVo.class);
+                for (OrgCommunityDto tmpOrgCommunityDto : orgCommunityDtos) {
+                    for (ApiCommunityDataVo tmpApiCommunityDataVo : communitys) {
+                        if (tmpOrgCommunityDto.getCommunityId().equals(tmpApiCommunityDataVo.getCommunityId())) {
+                            tmpApiCommunityDataVo.setName(tmpOrgCommunityDto.getCommunityName());
+                        }
+                    }
+                }
+            } else {
+                communitys = new ArrayList<>();
+            }
         }
 
 

--
Gitblit v1.8.0