|
|
@ -30,6 +30,7 @@ import com.epmet.commons.tools.utils.ConvertUtils; |
|
|
|
import com.epmet.commons.tools.utils.DateUtils; |
|
|
|
import com.epmet.commons.tools.utils.Result; |
|
|
|
import com.epmet.dto.form.UserResiInfoFormDTO; |
|
|
|
import com.epmet.dto.form.UserResiInfoListFormDTO; |
|
|
|
import com.epmet.dto.form.UserRoleFormDTO; |
|
|
|
import com.epmet.dto.result.UserResiInfoResultDTO; |
|
|
|
import com.epmet.dto.result.UserRoleResultDTO; |
|
|
@ -37,12 +38,14 @@ import com.epmet.modules.feign.EpmetUserFeignClient; |
|
|
|
import com.epmet.modules.group.dao.ResiGroupDao; |
|
|
|
import com.epmet.modules.group.dao.ResiGroupOperationDao; |
|
|
|
import com.epmet.modules.group.entity.ResiGroupEntity; |
|
|
|
import com.epmet.modules.group.entity.ResiGroupOperationEntity; |
|
|
|
import com.epmet.modules.group.redis.ResiGroupRedis; |
|
|
|
import com.epmet.modules.group.service.ResiGroupOperationService; |
|
|
|
import com.epmet.modules.group.service.ResiGroupService; |
|
|
|
import com.epmet.modules.group.service.ResiGroupStatisticalService; |
|
|
|
import com.epmet.modules.member.dao.GroupMemeberOperationDao; |
|
|
|
import com.epmet.modules.member.dao.ResiGroupMemberDao; |
|
|
|
import com.epmet.modules.member.redis.ResiGroupMemberRedis; |
|
|
|
import com.epmet.modules.member.service.GroupMemeberOperationService; |
|
|
|
import com.epmet.modules.member.service.ResiGroupMemberService; |
|
|
|
import com.epmet.modules.utils.ModuleConstant; |
|
|
@ -56,6 +59,7 @@ import com.epmet.resi.group.dto.group.form.*; |
|
|
|
import com.epmet.resi.group.dto.group.result.*; |
|
|
|
import com.epmet.resi.group.dto.member.GroupMemeberOperationDTO; |
|
|
|
import com.epmet.resi.group.dto.member.ResiGroupMemberDTO; |
|
|
|
import com.epmet.resi.group.dto.member.ResiGroupMemberInfoRedisDTO; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.slf4j.Logger; |
|
|
|
import org.slf4j.LoggerFactory; |
|
|
@ -103,6 +107,9 @@ public class ResiGroupServiceImpl extends BaseServiceImpl<ResiGroupDao, ResiGrou |
|
|
|
@Autowired |
|
|
|
private ResiGroupRedis resiGroupRedis; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private ResiGroupMemberRedis resiGroupMemberRedis; |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
public PageData<ResiGroupDTO> page(Map<String, Object> params) { |
|
|
@ -457,21 +464,45 @@ public class ResiGroupServiceImpl extends BaseServiceImpl<ResiGroupDao, ResiGrou |
|
|
|
groupMemeberOperationDTO.setOperateUserId(agreeApplyGroupFormDTO.getUserId()); |
|
|
|
groupMemeberOperationService.update(groupMemeberOperationDTO); |
|
|
|
//5、给用户发送消息???待定
|
|
|
|
//6、新增小组缓存信息
|
|
|
|
//6、新增小组缓存信息、组员缓存信息
|
|
|
|
Map<String, Object> param = new HashMap<>(); |
|
|
|
param.put("resiGroupId", resiGroupDTO.getId()); |
|
|
|
param.put(ModuleConstant.RESI_GROUP_ID_CAMEL, resiGroupDTO.getId()); |
|
|
|
param.put(FieldConstant.DEL_FLAG,NumConstant.ZERO_STR); |
|
|
|
List<ResiGroupStatisticalDTO> statisticalList = resiGroupStatisticalService.list(param); |
|
|
|
if (null != statisticalList && statisticalList.size() > 0) { |
|
|
|
ResiGroupInfoRedisDTO groupRedis = transferToGroupInfoRedis(resiGroupDTO, statisticalList.get(0)); |
|
|
|
resiGroupRedis.set(groupRedis); |
|
|
|
|
|
|
|
ResiGroupMemberInfoRedisDTO memberRedis = new ResiGroupMemberInfoRedisDTO(); |
|
|
|
memberRedis.setUserId(resiGroupMemberDTO.getCustomerUserId()); |
|
|
|
memberRedis.setGroupLeaderFlag("leader"); |
|
|
|
memberRedis.setEnterGroupType(resiGroupMemberDTO.getEnterGroupType()); |
|
|
|
memberRedis.setMemberStatus(resiGroupMemberDTO.getStatus()); |
|
|
|
memberRedis.setGroupId(resiGroupMemberDTO.getResiGroupId()); |
|
|
|
|
|
|
|
UserResiInfoFormDTO userParam = new UserResiInfoFormDTO(); |
|
|
|
userParam.setUserId(resiGroupMemberDTO.getCustomerUserId()); |
|
|
|
userParam.setCustomerId(resiGroupDTO.getCustomerId()); |
|
|
|
Result<UserResiInfoResultDTO> userInfo = |
|
|
|
epmetUserFeignClient.getUserResiInfoDTO(userParam); |
|
|
|
if(userInfo.success() && null != userInfo.getData()){ |
|
|
|
memberRedis.setUserShowName(userInfo.getData().getShowName()); |
|
|
|
memberRedis.setUserHeadPhoto(userInfo.getData().getHeadPhoto()); |
|
|
|
}else{ |
|
|
|
logger.warn(ModuleConstant.USER_INFO_LIST_NOT_FOUND); |
|
|
|
} |
|
|
|
resiGroupMemberRedis.set(memberRedis); |
|
|
|
} else { |
|
|
|
//当没有查询到组统计信息时
|
|
|
|
UserRoleFormDTO userRoleFormDTO = new UserRoleFormDTO(); |
|
|
|
userRoleFormDTO.setApp("resi"); |
|
|
|
userRoleFormDTO.setCustomerId(resiGroupDTO.getCustomerId()); |
|
|
|
userRoleFormDTO.setUserId(agreeApplyGroupFormDTO.getUserId()); |
|
|
|
//userRoleFormDTO.setGridId
|
|
|
|
//epmetUserFeignClient.getUserRoleInfo(userRoleFormDTO);
|
|
|
|
/* |
|
|
|
当没有查询到组统计信息时,需要自己封装统计信息 |
|
|
|
@param UserRoleFormDTO::getApp |
|
|
|
@param UserRoleFormDTO::getCustomerId |
|
|
|
@param UserRoleFormDTO::getUserId |
|
|
|
@param UserRoleFormDTO::getGridId |
|
|
|
查询用户身份信息[热心居民/党员] |
|
|
|
epmetUserFeignClient.getUserRoleInfo(userRoleFormDTO); |
|
|
|
*/ |
|
|
|
logger.warn(ModuleConstant.NO_SUCH_GROUP_STASTICAL_INFO); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -589,4 +620,62 @@ public class ResiGroupServiceImpl extends BaseServiceImpl<ResiGroupDao, ResiGrou |
|
|
|
return targetObject; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @Description 查询待审核的小组 (不从缓存中取,这时还没有成功建组,缓存中没有组数据) |
|
|
|
* @Param ApplyingGroupsFormDTO |
|
|
|
* @return Result<List<ApplyingGroupResultDTO>> |
|
|
|
* @Author wangc |
|
|
|
* @Date 2020.04.18 10:18 |
|
|
|
**/ |
|
|
|
@Override |
|
|
|
public Result<List<ApplyingGroupResultDTO>> getApplyingGroups(ApplyingGroupsFormDTO params){ |
|
|
|
if(null == params.getPageNo()){ |
|
|
|
throw new RenException(ModuleConstant.PAGE_INDEX_NOT_NULL); |
|
|
|
} |
|
|
|
params.setPageNo((params.getPageNo() - NumConstant.ONE) * params.getPageSize()); |
|
|
|
return new Result<List<ApplyingGroupResultDTO>>().ok(baseDao.getApplyingGroupsByCustIdAndGridId(params)); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @Description 建组申请详情 已审核(更新已读未读标识)/未审核 |
|
|
|
* @Param AgreeApplyGroupFormDTO |
|
|
|
* @return Result<ApplyingGroupResultDTO> |
|
|
|
* @Author wangc |
|
|
|
* @Date 2020.04.19 23:32 |
|
|
|
**/ |
|
|
|
@Override |
|
|
|
public Result<ApplyingGroupDetailResultDTO> getApplyingGroupDetail(CommonGroupIdFromDTO groupId){ |
|
|
|
//1.查询小组信息
|
|
|
|
//注意,这里查询出的组申请详情中,无论是已审核还是未审核,都是将该组信息关联到初始化组时状态为[待审核、审核通过、拒绝]其中之一的组操作记录上,并读取审核的已读未读信息,上述三种状态在一个组的所有操作记录当中只可能存在一种,与之后的屏蔽、取消屏蔽、关闭无关,如果查出多条说明建组的逻辑有问题
|
|
|
|
ApplyingGroupDetailResultDTO detail = baseDao.getApplyingGroupDetailByGroupId(groupId.getGroupId()); |
|
|
|
//2.查询用户信息(TODO 先走数据库,之后改成走缓存)
|
|
|
|
List<String> userId = new ArrayList<>(); |
|
|
|
userId.add(detail.getLeaderId()); |
|
|
|
Result<List<UserResiInfoResultDTO>> userInfoResult = |
|
|
|
epmetUserFeignClient.getUserResiInfoList(new UserResiInfoListFormDTO(userId)); |
|
|
|
if(userInfoResult.success() && null != userInfoResult.getData() && userInfoResult.getData().size() >= 1){ |
|
|
|
detail.setGroupHeadPhoto(userInfoResult.getData().get(0).getHeadPhoto()); |
|
|
|
//姓氏+先生/女士 注:在数据库中拼接成[街道+显示名称]默认格式,故要进行截取
|
|
|
|
//detail.setGroupLeaderName(userInfoResult.getData().get(0).getShowName().split("-")[NumConstant.ONE]);
|
|
|
|
//姓氏+名称
|
|
|
|
detail.setGroupLeaderName(userInfoResult.getData().get(0).getSurname() + userInfoResult.getData().get(0).getName()); |
|
|
|
detail.setStreet(userInfoResult.getData().get(0).getStreet()); |
|
|
|
}else{ |
|
|
|
logger.warn(ModuleConstant.USER_INFO_LIST_NOT_FOUND); |
|
|
|
} |
|
|
|
//3.未读改成已读
|
|
|
|
if(StringUtils.equals(detail.getReadFlag(),ModuleConstant.UNREAD)){ |
|
|
|
ResiGroupOperationEntity operationEntity = new ResiGroupOperationEntity(); |
|
|
|
operationEntity.setId(detail.getOperationId()); |
|
|
|
operationEntity.setReadFlag(ModuleConstant.READ); |
|
|
|
operationEntity.setUpdatedBy(groupId.getUserId()); |
|
|
|
resiGroupOperationDao.updateById(operationEntity); |
|
|
|
} |
|
|
|
//4.将组长用户Id隐藏
|
|
|
|
detail.setLeaderId(null); |
|
|
|
detail.setOperationId(null); |
|
|
|
|
|
|
|
return new Result<ApplyingGroupDetailResultDTO>().ok(detail); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|