新增设置用户信息方法

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.SearchException;
import com.cm.common.exception.UpdateException; import com.cm.common.exception.UpdateException;
import com.cm.common.plugin.oauth.service.user.IUserService; 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.pojo.ListPage;
import com.cm.common.result.SuccessResult; import com.cm.common.result.SuccessResult;
import com.cm.common.result.SuccessResultData; 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[] districtIds = params.get("districtId").toString().split(",");
String communityBossId = params.get("communityBossId").toString(); String communityBossId = params.get("communityBossId").toString();
LOG.debug("删除原有片长和小区关系"); LOG.debug("删除原有片长和小区关系");
deleteCommunityBossDistrict(communityBossId,districtIds); deleteCommunityBossDistrict(communityBossId, districtIds);
saveCommunityBossDistrict(communityBossId,districtIds); saveCommunityBossDistrict(communityBossId, districtIds);
} }
LOG.debug("修改片长和楼宇关系"); LOG.debug("修改片长和楼宇关系");
if (params.get("buildingId") != null && !StringUtils.isBlank(params.get("buildingId").toString())) { if (params.get("buildingId") != null && !StringUtils.isBlank(params.get("buildingId").toString())) {
String[] buildingIds = params.get("buildingId").toString().split(","); String[] buildingIds = params.get("buildingId").toString().split(",");
String communityBossId = params.get("communityBossId").toString(); String communityBossId = params.get("communityBossId").toString();
LOG.debug("删除原有片长和楼宇关系"); LOG.debug("删除原有片长和楼宇关系");
deleteCommunityBossBuilding(communityBossId,buildingIds); deleteCommunityBossBuilding(communityBossId, buildingIds);
saveCommunityBossBuilding(communityBossId,buildingIds); saveCommunityBossBuilding(communityBossId, buildingIds);
} }
return new SuccessResult(); return new SuccessResult();
} }
@ -164,7 +165,7 @@ public class CommunityBossServiceImpl extends AbstractService implements ICommun
@Override @Override
public CommunityBossDTO getCommunityBoss(Map<String, Object> params) throws SearchException { public CommunityBossDTO getCommunityBoss(Map<String, Object> params) throws SearchException {
CommunityBossDTO communityBossDTO = getCommunityBossDTO(params); CommunityBossDTO communityBossDTO = getCommunityBossDTO(params);
if(communityBossDTO == null) { if (communityBossDTO == null) {
return null; return null;
} }
setCommunityBossCommunity(communityBossDTO); setCommunityBossCommunity(communityBossDTO);
@ -183,10 +184,39 @@ public class CommunityBossServiceImpl extends AbstractService implements ICommun
setCommunityBossDistrict(communityBossDTO); setCommunityBossDistrict(communityBossDTO);
setCommunityBossBuilding(communityBossDTO); setCommunityBossBuilding(communityBossDTO);
} }
setUserInfo(communityBossDTOs);
PageInfo<CommunityBossDTO> pageInfo = new PageInfo<>(communityBossDTOs); PageInfo<CommunityBossDTO> pageInfo = new PageInfo<>(communityBossDTOs);
return new SuccessResultList<>(communityBossDTOs, pageInfo.getPageNum(), pageInfo.getTotal()); 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 * @param params
* @return * @return
* @throws SearchException * @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 * @param params
* @return * @return
* @throws SearchException * @throws SearchException