|
|
@ -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("转让组发送站内信失败"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |