新增设置用户信息方法

This commit is contained in:
wanggeng888 2021-06-16 11:43:32 +08:00
parent 7728c5365d
commit de4c5dfdbd

View File

@ -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;
@ -183,10 +184,39 @@ public class CommunityBossServiceImpl extends AbstractService implements ICommun
setCommunityBossDistrict(communityBossDTO);
setCommunityBossBuilding(communityBossDTO);
}
setUserInfo(communityBossDTOs);
PageInfo<CommunityBossDTO> pageInfo = new PageInfo<>(communityBossDTOs);
return new SuccessResultList<>(communityBossDTOs, pageInfo.getPageNum(), pageInfo.getTotal());
}
/**
* 设置用户内容
*
* @param communityBossDTOs
*/
private void setUserInfo(List<CommunityBossDTO> communityBossDTOs) {
if (communityBossDTOs.isEmpty()) {
return;
}
Set<String> userIdSet = new HashSet<>();
for (CommunityBossDTO communityBossDTO : communityBossDTOs) {
userIdSet.add(communityBossDTO.getCommunityBossId());
userIdSet.add(communityBossDTO.getCommunityBossParentId());
}
List<UserResourceBO> 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