Browse Source

转让组接口

master
yinzuomei 4 years ago
parent
commit
bb9ecd664e
  1. 30
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/member/form/ConfirmTransferFormDTO.java
  2. 9
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/constant/UserMessageConstant.java
  3. 22
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/controller/GroupLeaderTransferRecordController.java
  4. 10
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/GroupLeaderTransferRecordService.java
  5. 9
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/ResiGroupMemberService.java
  6. 93
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/impl/GroupLeaderTransferRecordServiceImpl.java
  7. 18
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/impl/ResiGroupMemberServiceImpl.java

30
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;
}

9
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】的组长身份,请查看。";
}

22
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();
}
}

10
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<GroupLeade
* @date 2021-03-29
*/
void delete(String[] ids);
/**
* @return void
* @param formDTO
* @author yinzuomei
* @description 确认转让组-(工作端通用)
* @Date 2021/3/30 10:11
**/
void confirmTransfer(ConfirmTransferFormDTO formDTO);
}

9
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/ResiGroupMemberService.java

@ -206,4 +206,13 @@ public interface ResiGroupMemberService extends BaseService<ResiGroupMemberEntit
* @date 2020.12.22 13:48
*/
void sendMessageToGroupLeader(ResiGroupDTO resiGroupDTO, String currentUserId);
/**
* @return com.epmet.resi.group.dto.member.ResiGroupMemberDTO
* @param groupId
* @author yinzuomei
* @description 获取组长信息
* @Date 2021/3/30 10:17
**/
ResiGroupMemberDTO getGroupLeader(String groupId);
}

93
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/impl/GroupLeaderTransferRecordServiceImpl.java

@ -23,14 +23,27 @@ import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.dto.form.UserMessageFormDTO;
import com.epmet.feign.EpmetMessageOpenFeignClient;
import com.epmet.modules.constant.UserMessageConstant;
import com.epmet.modules.group.service.ResiGroupService;
import com.epmet.modules.member.dao.GroupLeaderTransferRecordDao;
import com.epmet.modules.member.entity.GroupLeaderTransferRecordEntity;
import com.epmet.modules.member.service.GroupLeaderTransferRecordService;
import com.epmet.modules.member.service.ResiGroupMemberService;
import com.epmet.modules.utils.ModuleConstant;
import com.epmet.resi.group.constant.LeaderFlagConstant;
import com.epmet.resi.group.dto.group.ResiGroupDTO;
import com.epmet.resi.group.dto.member.GroupLeaderTransferRecordDTO;
import com.epmet.resi.group.dto.member.ResiGroupMemberDTO;
import com.epmet.resi.group.dto.member.form.ConfirmTransferFormDTO;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
@ -41,9 +54,15 @@ import java.util.Map;
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-03-29
*/
@Slf4j
@Service
public class GroupLeaderTransferRecordServiceImpl extends BaseServiceImpl<GroupLeaderTransferRecordDao, GroupLeaderTransferRecordEntity> implements GroupLeaderTransferRecordService {
@Autowired
private ResiGroupMemberService resiGroupMemberService;
@Autowired
private EpmetMessageOpenFeignClient epmetMessageOpenFeignClient;
@Autowired
private ResiGroupService resiGroupService;
@Override
public PageData<GroupLeaderTransferRecordDTO> page(Map<String, Object> params) {
@ -97,4 +116,76 @@ public class GroupLeaderTransferRecordServiceImpl extends BaseServiceImpl<GroupL
baseDao.deleteBatchIds(Arrays.asList(ids));
}
/**
* @param formDTO
* @return void
* @author yinzuomei
* @description 确认转让组-(工作端通用)
* @Date 2021/3/30 10:11
**/
@Transactional(rollbackFor = Exception.class)
@Override
public void confirmTransfer(ConfirmTransferFormDTO formDTO) {
//原组长
ResiGroupMemberDTO originalLeader = resiGroupMemberService.getGroupLeader(formDTO.getGroupId());
originalLeader.setGroupLeaderFlag(LeaderFlagConstant.GROUP_MEMBER);
resiGroupMemberService.update(originalLeader);
//新组长赋值为组员
ResiGroupMemberDTO newLeader=resiGroupMemberService.getResiGroupMember(formDTO.getGroupId(),formDTO.getNewLeaderUserId());
newLeader.setGroupLeaderFlag(LeaderFlagConstant.GROUP_LEADER);
resiGroupMemberService.update(newLeader);
//插入日志表
GroupLeaderTransferRecordEntity entity = new GroupLeaderTransferRecordEntity();
entity.setCustomerId(formDTO.getCustomerId());
entity.setGroupId(formDTO.getGroupId());
//原组长userId
entity.setOriginalLeader(originalLeader.getCustomerUserId());
entity.setNewLeader(formDTO.getNewLeaderUserId());
entity.setType(formDTO.getType());
insert(entity);
//发送站内信
saveUserMessage(formDTO,originalLeader.getCustomerUserId());
}
private void saveUserMessage(ConfirmTransferFormDTO formDTO,String originalLeaderUserId) {
ResiGroupDTO resiGroupDTO=resiGroupService.get(formDTO.getGroupId());
//组长自己操作:
//组长将组转给组员后,成为组长的组员收到站内信“您有一条小组消息 您已成为【某某小组】的组长,请查看。
//工作人员操作:
//工作人员将组转给组员后,成为组长的组员收到站内信“您有一条小组消息 您已成为【某某小组】的组长,请查看。
// 原组长收到站内信“您有一条小组消息 您已失去【某某小组】的组长身份,请查看。
List<UserMessageFormDTO> 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("转让组发送站内信失败");
}
}
}

18
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<ResiGroupMemberD
e.printStackTrace();
}
}
/**
* @param groupId
* @return com.epmet.resi.group.dto.member.ResiGroupMemberDTO
* @author yinzuomei
* @description 获取组长信息
* @Date 2021/3/30 10:17
**/
@Override
public ResiGroupMemberDTO getGroupLeader(String groupId) {
ResiGroupMemberDTO groupLeader = resiGroupDao.selectGroupLeader(groupId);
return groupLeader;
}
/**
* @param groupMemberListFormDTO
* @return com.epmet.commons.tools.utils.Result

Loading…
Cancel
Save