From bb9ecd664e82b2811da2276df004601ca79d9658 Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Tue, 30 Mar 2021 10:57:27 +0800 Subject: [PATCH] =?UTF-8?q?=E8=BD=AC=E8=AE=A9=E7=BB=84=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../member/form/ConfirmTransferFormDTO.java | 30 ++++++ .../modules/constant/UserMessageConstant.java | 9 ++ .../GroupLeaderTransferRecordController.java | 22 ++++- .../GroupLeaderTransferRecordService.java | 10 ++ .../service/ResiGroupMemberService.java | 9 ++ .../GroupLeaderTransferRecordServiceImpl.java | 93 ++++++++++++++++++- .../impl/ResiGroupMemberServiceImpl.java | 18 +++- 7 files changed, 186 insertions(+), 5 deletions(-) create mode 100644 epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/member/form/ConfirmTransferFormDTO.java diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/member/form/ConfirmTransferFormDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/member/form/ConfirmTransferFormDTO.java new file mode 100644 index 0000000000..9bda15a783 --- /dev/null +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/member/form/ConfirmTransferFormDTO.java @@ -0,0 +1,30 @@ +package com.epmet.resi.group.dto.member.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * 确认转让组-(工作端通用)入参 + * + * @author yinzuomei@elink-cn.com + * @date 2021/3/30 10:06 + */ +@Data +public class ConfirmTransferFormDTO implements Serializable { + private static final long serialVersionUID = -6087185953287544147L; + + @NotBlank(message = "小组id不能为空") + private String groupId; + + @NotBlank(message = "新组长用户id不能为空") + private String newLeaderUserId; + + @NotBlank(message = "type不能为空:自主转让resi,工作人员转让gov") + private String type; + + @NotBlank(message = "tokenDto中获取customerId为空") + private String customerId; + +} diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/constant/UserMessageConstant.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/constant/UserMessageConstant.java index 29f89329e4..eff45ac9a5 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/constant/UserMessageConstant.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/constant/UserMessageConstant.java @@ -90,4 +90,13 @@ public interface UserMessageConstant { */ String SCANCODE_OPERATE = "通过扫码加入小组。"; + /** + * 新组长上任收到消息 + * */ + String NEW_LEADER_UP = "您已成为【%s】的组长,请查看。"; + + /** + * 原组长下台 + * */ + String ORIGINAL_LEADER_DOWN="您已失去【%s】的组长身份,请查看。"; } diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/controller/GroupLeaderTransferRecordController.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/controller/GroupLeaderTransferRecordController.java index ef22370022..ef39fbff05 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/controller/GroupLeaderTransferRecordController.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/controller/GroupLeaderTransferRecordController.java @@ -17,8 +17,15 @@ package com.epmet.modules.member.controller; +import com.epmet.commons.tools.annotation.LoginUser; +import com.epmet.commons.tools.security.dto.TokenDto; +import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.modules.member.service.GroupLeaderTransferRecordService; +import com.epmet.resi.group.dto.member.form.ConfirmTransferFormDTO; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @@ -36,5 +43,18 @@ public class GroupLeaderTransferRecordController { @Autowired private GroupLeaderTransferRecordService groupLeaderTransferRecordService; - + /** + * @return com.epmet.commons.tools.utils.Result + * @param formDTO + * @author yinzuomei + * @description 确认转让组-(工作端通用) + * @Date 2021/3/30 10:08 + **/ + @PostMapping("confirmtransfer") + public Result confirmTransfer(@LoginUser TokenDto tokenDto, @RequestBody ConfirmTransferFormDTO formDTO){ + formDTO.setCustomerId(tokenDto.getCustomerId()); + ValidatorUtils.validateEntity(formDTO); + groupLeaderTransferRecordService.confirmTransfer(formDTO); + return new Result(); + } } \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/GroupLeaderTransferRecordService.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/GroupLeaderTransferRecordService.java index 641ca57fc4..9d4e947536 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/GroupLeaderTransferRecordService.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/GroupLeaderTransferRecordService.java @@ -21,6 +21,7 @@ import com.epmet.commons.mybatis.service.BaseService; import com.epmet.commons.tools.page.PageData; import com.epmet.modules.member.entity.GroupLeaderTransferRecordEntity; import com.epmet.resi.group.dto.member.GroupLeaderTransferRecordDTO; +import com.epmet.resi.group.dto.member.form.ConfirmTransferFormDTO; import java.util.List; import java.util.Map; @@ -92,4 +93,13 @@ public interface GroupLeaderTransferRecordService extends BaseService implements GroupLeaderTransferRecordService { - + @Autowired + private ResiGroupMemberService resiGroupMemberService; + @Autowired + private EpmetMessageOpenFeignClient epmetMessageOpenFeignClient; + @Autowired + private ResiGroupService resiGroupService; @Override public PageData page(Map params) { @@ -97,4 +116,76 @@ public class GroupLeaderTransferRecordServiceImpl extends BaseServiceImpl msgList=new ArrayList<>(); + if(ModuleConstant.APP_GOV.equals(formDTO.getType())){ + //原组长 + UserMessageFormDTO originalLeader = new UserMessageFormDTO(); + originalLeader.setUserId(originalLeaderUserId); + originalLeader.setTitle(UserMessageConstant.GROUP_TITLE); + originalLeader.setReadFlag(ModuleConstant.UNREAD); + originalLeader.setApp(ModuleConstant.APP_RESI); + //小组所属的网格 + originalLeader.setGridId(resiGroupDTO.getGridId()); + originalLeader.setCustomerId(formDTO.getCustomerId()); + originalLeader.setMessageContent(String.format(UserMessageConstant.ORIGINAL_LEADER_DOWN,resiGroupDTO.getGroupName())); + + msgList.add(originalLeader); + } + //新组长 + UserMessageFormDTO newLeader = new UserMessageFormDTO(); + newLeader.setUserId(formDTO.getNewLeaderUserId()); + newLeader.setTitle(UserMessageConstant.GROUP_TITLE); + newLeader.setReadFlag(ModuleConstant.UNREAD); + newLeader.setApp(ModuleConstant.APP_RESI); + //小组所属的网格 + newLeader.setGridId(resiGroupDTO.getGridId()); + newLeader.setCustomerId(formDTO.getCustomerId()); + newLeader.setMessageContent(String.format(UserMessageConstant.NEW_LEADER_UP,resiGroupDTO.getGroupName())); + + msgList.add(newLeader); + if(!epmetMessageOpenFeignClient.saveUserMessageList(msgList).success()){ + log.warn("转让组发送站内信失败"); + } + } + } \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/impl/ResiGroupMemberServiceImpl.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/impl/ResiGroupMemberServiceImpl.java index 33c2af52a6..c566a5ec94 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/impl/ResiGroupMemberServiceImpl.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/impl/ResiGroupMemberServiceImpl.java @@ -35,7 +35,6 @@ import com.epmet.constant.ReadFlagConstant; import com.epmet.dto.IssueShareLinkVisitRecordDTO; import com.epmet.dto.form.*; import com.epmet.dto.result.UserBaseInfoResultDTO; -import com.epmet.dto.result.UserBasicInfo; import com.epmet.dto.result.UserResiInfoResultDTO; import com.epmet.feign.EpmetMessageOpenFeignClient; import com.epmet.feign.EpmetUserOpenFeignClient; @@ -53,7 +52,6 @@ import com.epmet.modules.member.entity.ResiGroupMemberEntity; 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.topic.dao.ResiTopicDao; import com.epmet.modules.topic.entity.TopicShareLinkVisitRecordEntity; import com.epmet.modules.topic.service.ResiTopicService; import com.epmet.modules.topic.service.TopicShareLinkVisitRecordService; @@ -70,8 +68,8 @@ import com.epmet.resi.group.dto.group.ResiGroupStatisticalInfoRedisDTO; 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 com.epmet.resi.group.dto.member.form.*; import com.epmet.resi.group.dto.member.form.CommonGridIdListFormDTO; +import com.epmet.resi.group.dto.member.form.*; import com.epmet.resi.group.dto.member.result.ApplyingMemberResultDTO; import com.epmet.resi.group.dto.member.result.GridVotableCountResultDTO; import com.epmet.resi.group.dto.member.result.GroupMemberListResultDTO; @@ -314,6 +312,20 @@ public class ResiGroupMemberServiceImpl extends BaseServiceImpl