|
|
@ -2,18 +2,24 @@ package com.epmet.modules.partymember.service.impl; |
|
|
|
|
|
|
|
import com.epmet.commons.tools.constant.AppClientConstant; |
|
|
|
import com.epmet.commons.tools.constant.EpmetRoleKeyConstant; |
|
|
|
import com.epmet.commons.tools.constant.NumConstant; |
|
|
|
import com.epmet.commons.tools.exception.EpmetErrorCode; |
|
|
|
import com.epmet.commons.tools.exception.RenException; |
|
|
|
import com.epmet.commons.tools.utils.ConvertUtils; |
|
|
|
import com.epmet.commons.tools.utils.Result; |
|
|
|
import com.epmet.constant.PartyMemberConstant; |
|
|
|
import com.epmet.constant.PartyMemberMessageConstant; |
|
|
|
import com.epmet.constant.ReadFlagConstant; |
|
|
|
import com.epmet.dto.CustomerGridDTO; |
|
|
|
import com.epmet.dto.CustomerStaffGridDTO; |
|
|
|
import com.epmet.dto.UserResiInfoDTO; |
|
|
|
import com.epmet.dto.UserRoleDTO; |
|
|
|
import com.epmet.dto.form.CustomerGridFormDTO; |
|
|
|
import com.epmet.dto.form.StaffRoleFormDTO; |
|
|
|
import com.epmet.dto.form.UserMessageFormDTO; |
|
|
|
import com.epmet.dto.form.UserResiInfoFormDTO; |
|
|
|
import com.epmet.dto.result.AgencyAndStaffsResultDTO; |
|
|
|
import com.epmet.dto.result.GovStaffRoleResultDTO; |
|
|
|
import com.epmet.dto.result.GridInfoResultDTO; |
|
|
|
import com.epmet.dto.result.UserResiInfoResultDTO; |
|
|
|
import com.epmet.modules.feign.EpmetMessageFeignClient; |
|
|
@ -22,6 +28,9 @@ import com.epmet.modules.feign.GovOrgFeignClient; |
|
|
|
import com.epmet.modules.partymember.entity.*; |
|
|
|
import com.epmet.modules.partymember.redis.PartymemberInfoRedis; |
|
|
|
import com.epmet.modules.partymember.service.*; |
|
|
|
import com.epmet.modules.warmhearted.constant.ResiWarmUserMessageConstant; |
|
|
|
import com.epmet.modules.warmhearted.constant.ResiWarmheartedConstant; |
|
|
|
import com.epmet.modules.warmhearted.constant.ResiWarmheartedVisitConstant; |
|
|
|
import com.epmet.redis.ResiPartyMemberRedis; |
|
|
|
import com.epmet.resi.mine.dto.from.PartyMemberInitFromDTO; |
|
|
|
import com.epmet.resi.mine.dto.from.VerificationCodeFromDTO; |
|
|
@ -269,7 +278,7 @@ public class PartyMemberConfirmServiceImpl implements PartyMemberConfirmService |
|
|
|
partymemberConfirmManualService.insert(manualEntity); |
|
|
|
} |
|
|
|
|
|
|
|
auditMessage(ConvertUtils.sourceToTarget(partyMemberInfo, PartymemberInfoEntity.class), PartyMemberMessageConstant.MEMBER_APPLY_MSG); |
|
|
|
auditMessageToGov(ConvertUtils.sourceToTarget(partyMemberInfo, PartymemberInfoEntity.class), PartyMemberMessageConstant.MEMBER_APPLY_MSG); |
|
|
|
//更新政府端:工作-基层治理-党员认证reddot
|
|
|
|
resiPartyMemberRedis.addWorkGrassrootsPartyAuthRedDotValue(infoDTO.getGridId()); |
|
|
|
return new Result(); |
|
|
@ -301,9 +310,9 @@ public class PartyMemberConfirmServiceImpl implements PartyMemberConfirmService |
|
|
|
//存入党员注册关系表 用于统计客户网格的认证党员数
|
|
|
|
saveRegisterRelation(ConvertUtils.sourceToTarget(partyMemberInfoEntity, |
|
|
|
PartymemberInfoDTO.class)); |
|
|
|
auditMessage(partyMemberInfoEntity, PartyMemberMessageConstant.AUDIT_APPROVE_MSG); |
|
|
|
auditMessageToResi(partyMemberInfoEntity, PartyMemberMessageConstant.AUDIT_APPROVE_MSG); |
|
|
|
} else { |
|
|
|
auditMessage(partyMemberInfoEntity, PartyMemberMessageConstant.AUDIT_REJECT_MSG); |
|
|
|
auditMessageToResi(partyMemberInfoEntity, PartyMemberMessageConstant.AUDIT_REJECT_MSG); |
|
|
|
} |
|
|
|
//更新政府端:工作-基层治理-党员认证reddot
|
|
|
|
resiPartyMemberRedis.subtractWorkGrassrootsPartyAuthRedDotValue(manualEntity.getGridId()); |
|
|
@ -561,16 +570,15 @@ public class PartyMemberConfirmServiceImpl implements PartyMemberConfirmService |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 热心居民申请审核通过向申请人发送消息 |
|
|
|
* 党员申请审核通过向申请人发送消息 |
|
|
|
* @Author sun |
|
|
|
* @param formDTO |
|
|
|
* @param userMsg 消息模板 |
|
|
|
*/ |
|
|
|
private Result auditMessage(PartymemberInfoEntity formDTO, String userMsg) { |
|
|
|
private Result auditMessageToResi(PartymemberInfoEntity formDTO, String userMsg) { |
|
|
|
UserMessageFormDTO userMessageFormDTO = new UserMessageFormDTO(); |
|
|
|
userMessageFormDTO.setCustomerId(formDTO.getCustomerId()); |
|
|
|
userMessageFormDTO.setGridId(formDTO.getGridId()); |
|
|
|
userMessageFormDTO.setUserId(formDTO.getUserId()); |
|
|
|
userMessageFormDTO.setApp(AppClientConstant.APP_RESI); |
|
|
|
userMessageFormDTO.setTitle(PartyMemberMessageConstant.GROUP_TITLE); |
|
|
|
//调用gov-org服务查询网格信息
|
|
|
@ -588,4 +596,61 @@ public class PartyMemberConfirmServiceImpl implements PartyMemberConfirmService |
|
|
|
return messageFeignClient.saveUserMessage(userMessageFormDTO); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 党员申请审核向网格长发送消息 |
|
|
|
* @Author sun |
|
|
|
* @param formDTO |
|
|
|
* @param userMsg 消息模板 |
|
|
|
*/ |
|
|
|
private Result auditMessageToGov(PartymemberInfoEntity formDTO, String userMsg) { |
|
|
|
Result result = new Result(); |
|
|
|
//1:调用gov-org服务,根据网格Id查询所属组织机构Id,根据网格Id查询网格下所有工作人员列表
|
|
|
|
Result<AgencyAndStaffsResultDTO> resultAgencyAndStaffs = govOrgFeignClient.getAgencyAndStaffsBygridId(formDTO.getGridId()); |
|
|
|
if(!resultAgencyAndStaffs.success()){ |
|
|
|
throw new RenException(ResiWarmheartedConstant.SELECT_EXCEPTION); |
|
|
|
} |
|
|
|
AgencyAndStaffsResultDTO agencyAndStaffsResultDTO = resultAgencyAndStaffs.getData(); |
|
|
|
//网格下工作人员列表
|
|
|
|
CustomerGridDTO customerGridDTO = agencyAndStaffsResultDTO.getCustomerGridDTO(); |
|
|
|
List<CustomerStaffGridDTO> staffList = agencyAndStaffsResultDTO.getStaffList(); |
|
|
|
//2:调用epmet-user服务,根据组织机构Id和网格长角色查询组织机构下所有的网格长StaffId
|
|
|
|
StaffRoleFormDTO staffRoleFormDTO = new StaffRoleFormDTO(); |
|
|
|
staffRoleFormDTO.setOrgId(customerGridDTO.getPid()); |
|
|
|
staffRoleFormDTO.setRoleKey(ResiWarmheartedVisitConstant.GRID_MANAGER); |
|
|
|
Result<List<GovStaffRoleResultDTO>> resultList = epmetUserFeignClient.getStaffsInRole(staffRoleFormDTO); |
|
|
|
List<GovStaffRoleResultDTO> roleList = resultList.getData(); |
|
|
|
//3:调用user服务获取申请人的基本信息
|
|
|
|
UserResiInfoFormDTO resiInfoParam = new UserResiInfoFormDTO(); |
|
|
|
resiInfoParam.setCustomerId(formDTO.getCustomerId()); |
|
|
|
resiInfoParam.setUserId(formDTO.getUserId()); |
|
|
|
Result<UserResiInfoResultDTO> resultUserInfo = epmetUserFeignClient.getUserResiInfoDTO(resiInfoParam); |
|
|
|
if (!resultUserInfo.success() || null == resultUserInfo.getData()) { |
|
|
|
throw new RenException(ResiWarmheartedVisitConstant.SELECT_USERINFO_EXCEPTION); |
|
|
|
} |
|
|
|
String showName = resultUserInfo.getData().getShowName(); |
|
|
|
String message = String.format(userMsg, showName); |
|
|
|
|
|
|
|
//4:遍历找出当前网格的所有网格长并给网格长发消息
|
|
|
|
List<UserMessageFormDTO> msgList = new ArrayList<>(); |
|
|
|
staffList.forEach(staff->{ |
|
|
|
roleList.forEach(role->{ |
|
|
|
if(staff.getUserId().equals(role.getStaffId())){ |
|
|
|
UserMessageFormDTO msgDTO = new UserMessageFormDTO(); |
|
|
|
msgDTO.setCustomerId(formDTO.getCustomerId()); |
|
|
|
msgDTO.setGridId(formDTO.getGridId()); |
|
|
|
msgDTO.setUserId(staff.getUserId()); |
|
|
|
msgDTO.setApp(AppClientConstant.APP_GOV); |
|
|
|
msgDTO.setTitle(ResiWarmUserMessageConstant.GROUP_TITLE); |
|
|
|
msgDTO.setMessageContent(message); |
|
|
|
msgDTO.setReadFlag(ReadFlagConstant.UN_READ); |
|
|
|
msgList.add(msgDTO); |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
if (msgList.size() > NumConstant.ZERO) { |
|
|
|
result = messageFeignClient.saveUserMessageList(msgList); |
|
|
|
} |
|
|
|
return result; |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|