Browse Source

居民创建群组,发送消息,更新消息字段到群组操作表中

dev_shibei_match
wangchao 5 years ago
parent
commit
fddbe0efdd
  1. 36
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupServiceImpl.java
  2. 11
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/utils/ModuleConstant.java

36
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupServiceImpl.java

@ -310,11 +310,39 @@ public class ResiGroupServiceImpl extends BaseServiceImpl<ResiGroupDao, ResiGrou
//2、插入一条待审核的组信息
ResiGroupEntity resiGroupEntity = this.structureResiGroupEntity(applyCreateGroupFormDTO);
insert(resiGroupEntity);
//3、插入一条待审核的操作记录
//3.1、查询当前申请人的身份,生成对应格式的消息内容
UserRoleDTO userRoleDTO = this.checkPartyMemberOrWarmHeated(applyCreateGroupFormDTO.getApp(),
applyCreateGroupFormDTO.getUserId(),
applyCreateGroupFormDTO.getCustomerId(),
applyCreateGroupFormDTO.getGridId());
if (!NumConstant.ONE_STR.equals(userRoleDTO.getPartymemberFlag()) && !NumConstant.ONE_STR.equals(userRoleDTO.getWarmHeartedFlag())) {
return new Result().error(EpmetErrorCode.CANNOT_CREATE_GROUP.getCode());
}
String roleName = "";
if(NumConstant.ONE_STR.equals(userRoleDTO.getPartymemberFlag())){
roleName = ModuleConstant.PARTYMEMBER;
}else if(NumConstant.ONE_STR.equals(userRoleDTO.getWarmHeartedFlag())){
roleName = ModuleConstant.WAREMHEARTED_RESI;
}
UserResiInfoFormDTO resiParam = new UserResiInfoFormDTO();
resiParam.setCustomerId(applyCreateGroupFormDTO.getCustomerId());
resiParam.setUserId(applyCreateGroupFormDTO.getUserId());
Result<UserResiInfoResultDTO> resiResult =
epmetUserFeignClient.getUserResiInfoDTO(resiParam);
String userName = "";
if(resiResult.success() && null != resiResult.getData()){
userName = (StringUtils.isBlank(resiResult.getData().getSurname()) ? "" : resiResult.getData().getSurname())
+ (StringUtils.isBlank(resiResult.getData().getName()) ? "" :resiResult.getData().getName());
}
userName = StringUtils.isBlank(userName) ? ModuleConstant.UNKNOWN : userName;
String msg = String.format(ModuleConstant.CREATION_OF_GROUP_MESSAGE_TEMPLATE,roleName,userName,applyCreateGroupFormDTO);
//3.2、插入一条待审核的操作记录
ResiGroupOperationDTO resiGroupOperation = new ResiGroupOperationDTO();
resiGroupOperation.setResiGroupId(resiGroupEntity.getId());
resiGroupOperation.setState(GroupStateConstant.GROUP_UNDER_AUDITTING);
resiGroupOperation.setOperateUserId(applyCreateGroupFormDTO.getUserId());
resiGroupOperation.setMessageText(msg);
resiGroupOperation.setReadFlag(ModuleConstant.UNREAD);
resiGroupOperationService.save(resiGroupOperation);
//4、插入一群成员信息(群主)
ResiGroupMemberDTO resiGroupMemberDTO = new ResiGroupMemberDTO();
@ -333,10 +361,10 @@ public class ResiGroupServiceImpl extends BaseServiceImpl<ResiGroupDao, ResiGrou
groupMemeberOperationDTO.setEnterGroupType(EnterGroupTypeConstant.CREATED);
groupMemeberOperationService.save(groupMemeberOperationDTO);
//6、群初始统计记录
UserRoleDTO userRoleDTO = this.checkPartyMemberOrWarmHeated(applyCreateGroupFormDTO.getApp(),
/*UserRoleDTO userRoleDTO = this.checkPartyMemberOrWarmHeated(applyCreateGroupFormDTO.getApp(),
applyCreateGroupFormDTO.getUserId(),
applyCreateGroupFormDTO.getCustomerId(),
applyCreateGroupFormDTO.getGridId());
applyCreateGroupFormDTO.getGridId());*/
ResiGroupStatisticalDTO resiGroupStatisticalDTO = new ResiGroupStatisticalDTO();
resiGroupStatisticalDTO.setResiGroupId(resiGroupEntity.getId());
resiGroupStatisticalDTO.setTotalMembers(NumConstant.ONE);
@ -354,6 +382,8 @@ public class ResiGroupServiceImpl extends BaseServiceImpl<ResiGroupDao, ResiGrou
resiGroupStatisticalDTO.setTotalEarnestMemebers(NumConstant.ZERO);
}
resiGroupStatisticalService.save(resiGroupStatisticalDTO);
//8.发送一条建组审核消息给当前网格的管理员,给当前网格数据的机构下所有的管理员发送消息
return new Result();
}

11
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/utils/ModuleConstant.java

@ -218,4 +218,15 @@ public interface ModuleConstant extends Constant {
* 审核信息已读
* */
String READ = "read";
String PARTYMEMBER = "党员";
String WAREMHEARTED_RESI = "热心居民";
String UNKNOWN = "未知";
/**
* 申请组时的消息模板
*/
String CREATION_OF_GROUP_MESSAGE_TEMPLATE = "%s%s申请创建小组【%s】,请审核。";
}

Loading…
Cancel
Save