From 5fb8a58f6daaa5dfc0b2a349e1fed28f625b63ee Mon Sep 17 00:00:00 2001
From: wuxw <928255095@qq.com>
Date: 星期四, 26 十二月 2019 20:08:26 +0800
Subject: [PATCH] 优化编译报错问题
---
UserService/src/main/java/com/java110/user/smo/impl/OrgInnerServiceSMOImpl.java | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++++++-----
1 files changed, 54 insertions(+), 5 deletions(-)
diff --git a/UserService/src/main/java/com/java110/user/smo/impl/OrgInnerServiceSMOImpl.java b/UserService/src/main/java/com/java110/user/smo/impl/OrgInnerServiceSMOImpl.java
index 407ea0a..ffc8586 100644
--- a/UserService/src/main/java/com/java110/user/smo/impl/OrgInnerServiceSMOImpl.java
+++ b/UserService/src/main/java/com/java110/user/smo/impl/OrgInnerServiceSMOImpl.java
@@ -2,17 +2,17 @@
import com.java110.core.base.smo.BaseServiceSMO;
+import com.java110.core.smo.community.ICommunityInnerServiceSMO;
import com.java110.core.smo.org.IOrgInnerServiceSMO;
import com.java110.core.smo.user.IUserInnerServiceSMO;
import com.java110.dto.PageDto;
-import com.java110.dto.UserDto;
+import com.java110.dto.community.CommunityDto;
import com.java110.dto.org.OrgDto;
import com.java110.user.dao.IOrgServiceDao;
import com.java110.utils.util.BeanConvertUtil;
+import com.java110.utils.util.StringUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
@@ -35,6 +35,10 @@
@Autowired
private IUserInnerServiceSMO userInnerServiceSMOImpl;
+ @Autowired
+ private ICommunityInnerServiceSMO communityInnerServiceSMOImpl;
+
+
@Override
public List<OrgDto> queryOrgs(@RequestBody OrgDto orgDto) {
@@ -48,6 +52,21 @@
List<OrgDto> orgs = BeanConvertUtil.covertBeanList(orgServiceDaoImpl.getOrgInfo(BeanConvertUtil.beanCovertMap(orgDto)), OrgDto.class);
+ String[] communityIds = getCommunityIds(orgs);
+ if (communityIds == null || communityIds.length < 1) {
+ return orgs;
+ }
+ CommunityDto communityDto = new CommunityDto();
+ communityDto.setCommunityIds(communityIds);
+ List<CommunityDto> communityDtos = communityInnerServiceSMOImpl.queryCommunitys(communityDto);
+
+ for (CommunityDto tmpCommunityDto : communityDtos) {
+ for (OrgDto tmpOrgDto : orgs) {
+ if (tmpCommunityDto.getCommunityId().equals(tmpOrgDto.getBelongCommunityId())) {
+ tmpOrgDto.setBelongCommunityName(tmpCommunityDto.getName());
+ }
+ }
+ }
return orgs;
}
@@ -62,7 +81,6 @@
/**
* <p>鏌ヨ涓婄骇缁勭粐淇℃伅</p>
*
- *
* @param orgDto 鏁版嵁瀵硅薄鍒嗕韩
* @return OrgDto 瀵硅薄鏁版嵁
*/
@@ -73,11 +91,34 @@
List<OrgDto> orgs = BeanConvertUtil.covertBeanList(orgServiceDaoImpl.getParentOrgInfo(BeanConvertUtil.beanCovertMap(orgDto)), OrgDto.class);
- if(orgs == null){
+ if (orgs == null) {
orgs = new ArrayList<>();
}
return orgs;
+ }
+
+
+ /**
+ * 鑾峰彇鎵归噺userId
+ *
+ * @param orgDtos 灏忓尯妤间俊鎭�
+ * @return 鎵归噺userIds 淇℃伅
+ */
+ private String[] getCommunityIds(List<OrgDto> orgDtos) {
+ List<String> communityIds = new ArrayList<String>();
+ for (OrgDto orgDto : orgDtos) {
+ if ("9999".equals(orgDto.getBelongCommunityId())) {
+ orgDto.setBelongCommunityName("鍏ラ┗鎵�鏈夊皬鍖�");
+ continue;
+ }
+ if (StringUtil.isEmpty(orgDto.getBelongCommunityId())) {
+ orgDto.setBelongCommunityName("鏈煡灏忓尯");
+ continue;
+ }
+ communityIds.add(orgDto.getBelongCommunityId());
+ }
+ return communityIds.toArray(new String[communityIds.size()]);
}
public IOrgServiceDao getOrgServiceDaoImpl() {
@@ -95,4 +136,12 @@
public void setUserInnerServiceSMOImpl(IUserInnerServiceSMO userInnerServiceSMOImpl) {
this.userInnerServiceSMOImpl = userInnerServiceSMOImpl;
}
+
+ public ICommunityInnerServiceSMO getCommunityInnerServiceSMOImpl() {
+ return communityInnerServiceSMOImpl;
+ }
+
+ public void setCommunityInnerServiceSMOImpl(ICommunityInnerServiceSMO communityInnerServiceSMOImpl) {
+ this.communityInnerServiceSMOImpl = communityInnerServiceSMOImpl;
+ }
}
--
Gitblit v1.8.0