From de4c5dfdbdff807bbac3a91cc40a027efbd09fa3 Mon Sep 17 00:00:00 2001 From: wanggeng888 <450292408@qq.com> Date: Wed, 16 Jun 2021 11:43:32 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E8=AE=BE=E7=BD=AE=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E4=BF=A1=E6=81=AF=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/CommunityBossServiceImpl.java | 43 ++++++++++++++++--- 1 file changed, 37 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/cm/systemcity/service/communityboss/impl/CommunityBossServiceImpl.java b/src/main/java/com/cm/systemcity/service/communityboss/impl/CommunityBossServiceImpl.java index 77894ab..74c5c6d 100755 --- a/src/main/java/com/cm/systemcity/service/communityboss/impl/CommunityBossServiceImpl.java +++ b/src/main/java/com/cm/systemcity/service/communityboss/impl/CommunityBossServiceImpl.java @@ -7,6 +7,7 @@ import com.cm.common.exception.SaveException; import com.cm.common.exception.SearchException; import com.cm.common.exception.UpdateException; import com.cm.common.plugin.oauth.service.user.IUserService; +import com.cm.common.plugin.pojo.bos.UserResourceBO; import com.cm.common.pojo.ListPage; import com.cm.common.result.SuccessResult; import com.cm.common.result.SuccessResultData; @@ -108,16 +109,16 @@ public class CommunityBossServiceImpl extends AbstractService implements ICommun String[] districtIds = params.get("districtId").toString().split(","); String communityBossId = params.get("communityBossId").toString(); LOG.debug("删除原有片长和小区关系"); - deleteCommunityBossDistrict(communityBossId,districtIds); - saveCommunityBossDistrict(communityBossId,districtIds); + deleteCommunityBossDistrict(communityBossId, districtIds); + saveCommunityBossDistrict(communityBossId, districtIds); } LOG.debug("修改片长和楼宇关系"); if (params.get("buildingId") != null && !StringUtils.isBlank(params.get("buildingId").toString())) { String[] buildingIds = params.get("buildingId").toString().split(","); String communityBossId = params.get("communityBossId").toString(); LOG.debug("删除原有片长和楼宇关系"); - deleteCommunityBossBuilding(communityBossId,buildingIds); - saveCommunityBossBuilding(communityBossId,buildingIds); + deleteCommunityBossBuilding(communityBossId, buildingIds); + saveCommunityBossBuilding(communityBossId, buildingIds); } return new SuccessResult(); } @@ -164,7 +165,7 @@ public class CommunityBossServiceImpl extends AbstractService implements ICommun @Override public CommunityBossDTO getCommunityBoss(Map params) throws SearchException { CommunityBossDTO communityBossDTO = getCommunityBossDTO(params); - if(communityBossDTO == null) { + if (communityBossDTO == null) { return null; } setCommunityBossCommunity(communityBossDTO); @@ -183,10 +184,39 @@ public class CommunityBossServiceImpl extends AbstractService implements ICommun setCommunityBossDistrict(communityBossDTO); setCommunityBossBuilding(communityBossDTO); } + setUserInfo(communityBossDTOs); PageInfo pageInfo = new PageInfo<>(communityBossDTOs); return new SuccessResultList<>(communityBossDTOs, pageInfo.getPageNum(), pageInfo.getTotal()); } + /** + * 设置用户内容 + * + * @param communityBossDTOs + */ + private void setUserInfo(List communityBossDTOs) { + if (communityBossDTOs.isEmpty()) { + return; + } + Set userIdSet = new HashSet<>(); + for (CommunityBossDTO communityBossDTO : communityBossDTOs) { + userIdSet.add(communityBossDTO.getCommunityBossId()); + userIdSet.add(communityBossDTO.getCommunityBossParentId()); + } + List userResourceBOs = userService.listUserResourceByIds(new ArrayList<>(userIdSet)); + for (CommunityBossDTO communityBossDTO : communityBossDTOs) { + for (UserResourceBO userResourceBO : userResourceBOs) { + if (StringUtils.equals(communityBossDTO.getCommunityBossId(), userResourceBO.getUserId())) { + communityBossDTO.setCommunityBossUsername(userResourceBO.getUserUsername()); + communityBossDTO.setCommunityBossName(userResourceBO.getUserName()); + } + if (StringUtils.equals(communityBossDTO.getCommunityBossParentId(), userResourceBO.getUserId())) { + communityBossDTO.setCommunityBossParentName(userResourceBO.getUserName()); + } + } + } + } + /** * 设置片长社区关系 * @@ -301,6 +331,7 @@ public class CommunityBossServiceImpl extends AbstractService implements ICommun /** * 获取片长小区列表 + * * @param params * @return * @throws SearchException @@ -322,7 +353,6 @@ public class CommunityBossServiceImpl extends AbstractService implements ICommun } - /** * 保存片长和楼宇关系 * @@ -355,6 +385,7 @@ public class CommunityBossServiceImpl extends AbstractService implements ICommun /** * 获取片长楼宇列表 + * * @param params * @return * @throws SearchException