|
|
@ -29,12 +29,14 @@ import com.epmet.commons.tools.page.PageData; |
|
|
|
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.constant.ReadFlagConstant; |
|
|
|
import com.epmet.dto.form.*; |
|
|
|
import com.epmet.dto.result.UserResiInfoResultDTO; |
|
|
|
import com.epmet.dto.result.UserRoleResultDTO; |
|
|
|
import com.epmet.modules.constant.UserMessageConstant; |
|
|
|
import com.epmet.modules.feign.EpmetMessageFeignClient; |
|
|
|
import com.epmet.modules.feign.EpmetUserFeignClient; |
|
|
|
import com.epmet.modules.feign.GovOrgFeignClient; |
|
|
|
import com.epmet.modules.group.dao.ResiGroupDao; |
|
|
|
import com.epmet.modules.group.dao.ResiGroupOperationDao; |
|
|
|
import com.epmet.modules.group.entity.ResiGroupEntity; |
|
|
@ -110,6 +112,11 @@ public class ResiGroupServiceImpl extends BaseServiceImpl<ResiGroupDao, ResiGrou |
|
|
|
@Autowired |
|
|
|
private ResiGroupMemberRedis resiGroupMemberRedis; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private GovOrgFeignClient govOrgFeignClient; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private EpmetMessageFeignClient epmetMessageFeignClient; |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
@ -336,7 +343,7 @@ public class ResiGroupServiceImpl extends BaseServiceImpl<ResiGroupDao, ResiGrou |
|
|
|
+ (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.getGroupName()); |
|
|
|
String msg = String.format(UserMessageConstant.CREATION_OF_GROUP_MESSAGE_TEMPLATE,roleName,userName,applyCreateGroupFormDTO.getGroupName()); |
|
|
|
//3.2、插入一条待审核的操作记录
|
|
|
|
ResiGroupOperationDTO resiGroupOperation = new ResiGroupOperationDTO(); |
|
|
|
resiGroupOperation.setResiGroupId(resiGroupEntity.getId()); |
|
|
@ -383,6 +390,8 @@ public class ResiGroupServiceImpl extends BaseServiceImpl<ResiGroupDao, ResiGrou |
|
|
|
resiGroupStatisticalDTO.setTotalEarnestMemebers(NumConstant.ZERO); |
|
|
|
} |
|
|
|
resiGroupStatisticalService.save(resiGroupStatisticalDTO); |
|
|
|
//发送消息:创建小组
|
|
|
|
sendMsgResi2Gov(UserMessageConstant.CREATE_GROUP_APPLYING_MSG_TITLE,msg,applyCreateGroupFormDTO.getGridId(),applyCreateGroupFormDTO.getUserId(),applyCreateGroupFormDTO.getCustomerId()); |
|
|
|
return new Result(); |
|
|
|
} |
|
|
|
|
|
|
@ -533,7 +542,18 @@ public class ResiGroupServiceImpl extends BaseServiceImpl<ResiGroupDao, ResiGrou |
|
|
|
*/ |
|
|
|
logger.warn(ModuleConstant.NO_SUCH_GROUP_STASTICAL_INFO); |
|
|
|
} |
|
|
|
|
|
|
|
//发送消息
|
|
|
|
UserMessageFormDTO userMessageFormDTO = new UserMessageFormDTO(); |
|
|
|
userMessageFormDTO.setUserId(resiGroupDTO.getCreatedBy()); |
|
|
|
userMessageFormDTO.setTitle(UserMessageConstant.AUDITED_GROUP_APPLYING_TITLE); |
|
|
|
userMessageFormDTO.setReadFlag(ModuleConstant.UNREAD); |
|
|
|
userMessageFormDTO.setApp(ModuleConstant.APP_RESI); |
|
|
|
userMessageFormDTO.setGridId(resiGroupDTO.getGridId()); |
|
|
|
userMessageFormDTO.setCustomerId(resiGroupDTO.getCustomerId()); |
|
|
|
userMessageFormDTO.setMessageContent(String.format(UserMessageConstant.AGREE_CREATING_GROUP_MSG_TEMPLATE,resiGroupDTO.getGroupName())); |
|
|
|
if(!epmetMessageFeignClient.saveUserMessage(userMessageFormDTO).success()){ |
|
|
|
logger.warn(String.format(ModuleConstant.FAILED_SEND_MESSAGE,String.format(UserMessageConstant.AGREE_CREATING_GROUP_MSG_TEMPLATE,resiGroupDTO.getGroupName()))); |
|
|
|
} |
|
|
|
|
|
|
|
return new Result(); |
|
|
|
} |
|
|
@ -567,6 +587,18 @@ public class ResiGroupServiceImpl extends BaseServiceImpl<ResiGroupDao, ResiGrou |
|
|
|
groupMemeberOperationDTO.setOperateUserId(disAgreeApplyGroupFormDTO.getUserId()); |
|
|
|
groupMemeberOperationService.update(groupMemeberOperationDTO); |
|
|
|
//5、给用户发送消息???待定
|
|
|
|
UserMessageFormDTO userMessageFormDTO = new UserMessageFormDTO(); |
|
|
|
userMessageFormDTO.setUserId(resiGroupDTO.getCreatedBy()); |
|
|
|
userMessageFormDTO.setTitle(UserMessageConstant.AUDITED_GROUP_APPLYING_TITLE); |
|
|
|
userMessageFormDTO.setReadFlag(ModuleConstant.UNREAD); |
|
|
|
userMessageFormDTO.setApp(ModuleConstant.APP_RESI); |
|
|
|
userMessageFormDTO.setGridId(resiGroupDTO.getGridId()); |
|
|
|
userMessageFormDTO.setCustomerId(resiGroupDTO.getCustomerId()); |
|
|
|
userMessageFormDTO.setMessageContent(String.format(UserMessageConstant.DISAGREE_CREATING_GROUP_MSG_TEMPLATE,resiGroupDTO.getGroupName(),disAgreeApplyGroupFormDTO.getRejectReason())); |
|
|
|
if(!epmetMessageFeignClient.saveUserMessage(userMessageFormDTO).success()){ |
|
|
|
logger.warn(String.format(ModuleConstant.FAILED_SEND_MESSAGE,String.format(UserMessageConstant.DISAGREE_CREATING_GROUP_MSG_TEMPLATE,resiGroupDTO.getGroupName(),disAgreeApplyGroupFormDTO.getRejectReason()))); |
|
|
|
} |
|
|
|
|
|
|
|
return new Result(); |
|
|
|
} |
|
|
|
|
|
|
@ -719,7 +751,7 @@ public class ResiGroupServiceImpl extends BaseServiceImpl<ResiGroupDao, ResiGrou |
|
|
|
* @Date 2020.04.19 23:32 |
|
|
|
**/ |
|
|
|
@Override |
|
|
|
public Result<ApplyingGroupDetailResultDTO> getApplyingGroupDetail(CommonGroupIdFromDTO groupId){ |
|
|
|
public Result<ApplyingGroupDetailResult2DTO> getApplyingGroupDetail(CommonGroupIdFromDTO groupId){ |
|
|
|
//1.查询小组信息
|
|
|
|
//注意,这里查询出的组申请详情中,无论是已审核还是未审核,都是将该组信息关联到初始化组时状态为[待审核、审核通过、拒绝]其中之一的组操作记录上,并读取审核的已读未读信息,上述三种状态在一个组的所有操作记录当中只可能存在一种,与之后的屏蔽、取消屏蔽、关闭无关,如果查出多条说明建组的逻辑有问题
|
|
|
|
ApplyingGroupDetailResultDTO detail = baseDao.getApplyingGroupDetailByGroupId(groupId.getGroupId()); |
|
|
@ -735,6 +767,9 @@ public class ResiGroupServiceImpl extends BaseServiceImpl<ResiGroupDao, ResiGrou |
|
|
|
//姓氏+名称
|
|
|
|
detail.setGroupLeaderName(userInfoResult.getData().get(0).getSurname() + userInfoResult.getData().get(0).getName()); |
|
|
|
detail.setStreet(userInfoResult.getData().get(0).getStreet()); |
|
|
|
StringBuffer buffer = new StringBuffer(detail.getStreet()); |
|
|
|
buffer.append(StringUtils.isBlank(buffer) ? "" : "-"); |
|
|
|
detail.setGroupLeaderName(buffer.append(detail.getGroupLeaderName()).toString()); |
|
|
|
}else{ |
|
|
|
logger.warn(ModuleConstant.USER_INFO_LIST_NOT_FOUND); |
|
|
|
} |
|
|
@ -750,7 +785,54 @@ public class ResiGroupServiceImpl extends BaseServiceImpl<ResiGroupDao, ResiGrou |
|
|
|
detail.setLeaderId(null); |
|
|
|
detail.setOperationId(null); |
|
|
|
|
|
|
|
return new Result<ApplyingGroupDetailResultDTO>().ok(detail); |
|
|
|
return new Result<ApplyingGroupDetailResult2DTO>().ok(ConvertUtils.sourceToTarget(detail, ApplyingGroupDetailResult2DTO.class)); |
|
|
|
} |
|
|
|
/** |
|
|
|
* @Description 给加入此网格的网格长发送消息 |
|
|
|
* @param msg |
|
|
|
* @param gridId |
|
|
|
* @param userId |
|
|
|
* @author wangc |
|
|
|
* @date 2020.04.29 22:49 |
|
|
|
**/ |
|
|
|
private void sendMsgResi2Gov(String title,String msg,String gridId,String userId,String customerId){ |
|
|
|
//1.查询加入当前网格下的人员 customer_staff_grid
|
|
|
|
CommonGridIdFormDTO commonGridIdFormDTO = new CommonGridIdFormDTO(); |
|
|
|
commonGridIdFormDTO.setGridId(gridId); |
|
|
|
commonGridIdFormDTO.setUserId(userId); |
|
|
|
Result<List<String>> gridstaffs = |
|
|
|
govOrgFeignClient.getGridStaffs(commonGridIdFormDTO); |
|
|
|
//2.查询这些人是否有管理员身份且未被禁用 staff_role customer_staff
|
|
|
|
if(gridstaffs.success() && null != gridstaffs.getData() && gridstaffs.getData().size() > 0){ |
|
|
|
RolesUsersListFormDTO rolesUsersListFormDTO = new RolesUsersListFormDTO(); |
|
|
|
rolesUsersListFormDTO.setCustomerId(customerId); |
|
|
|
List<String> roleKeys = new ArrayList<String>(); |
|
|
|
roleKeys.add(ModuleConstant.STAFF_ROLE_GRID_MANAGER); |
|
|
|
rolesUsersListFormDTO.setRoleKeys(roleKeys); |
|
|
|
rolesUsersListFormDTO.setUserIds(gridstaffs.getData()); |
|
|
|
Result<List<String>> staffRoles = |
|
|
|
epmetUserFeignClient.specificRolesStaffs(rolesUsersListFormDTO); |
|
|
|
//3.发送消息
|
|
|
|
if(staffRoles.success() && null != staffRoles.getData() && staffRoles.getData().size() > 0){ |
|
|
|
List<UserMessageFormDTO> msgList = new ArrayList<>(); |
|
|
|
for(String to : staffRoles.getData()){ |
|
|
|
UserMessageFormDTO msgObj = new UserMessageFormDTO(); |
|
|
|
msgObj.setApp(ModuleConstant.APP_GOV); |
|
|
|
msgObj.setCustomerId(customerId); |
|
|
|
msgObj.setGridId(gridId); |
|
|
|
msgObj.setMessageContent(msg); |
|
|
|
msgObj.setReadFlag(ReadFlagConstant.UN_READ); |
|
|
|
msgObj.setTitle(title); |
|
|
|
msgObj.setUserId(to); |
|
|
|
msgList.add(msgObj); |
|
|
|
} |
|
|
|
Result result = epmetMessageFeignClient.saveUserMessageList(msgList); |
|
|
|
if(!result.success()){ |
|
|
|
logger.warn(String.format(ModuleConstant.FAILED_SEND_MESSAGE,msg)); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|