|
|
@ -20,13 +20,11 @@ package com.epmet.modules.warmhearted.service.impl; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; |
|
|
|
import com.epmet.commons.tools.constant.AppClientConstant; |
|
|
|
import com.epmet.commons.tools.constant.EpmetRoleKeyConstant; |
|
|
|
import com.epmet.commons.tools.constant.FieldConstant; |
|
|
|
import com.epmet.commons.tools.constant.NumConstant; |
|
|
|
import com.epmet.commons.tools.constant.*; |
|
|
|
import com.epmet.commons.tools.exception.EpmetErrorCode; |
|
|
|
import com.epmet.commons.tools.exception.RenException; |
|
|
|
import com.epmet.commons.tools.page.PageData; |
|
|
|
import com.epmet.commons.tools.security.dto.TokenDto; |
|
|
|
import com.epmet.commons.tools.utils.ConvertUtils; |
|
|
|
import com.epmet.commons.tools.utils.Result; |
|
|
|
import com.epmet.constant.PartyMemberConstant; |
|
|
@ -200,7 +198,12 @@ public class ResiWarmheartedApplyServiceImpl extends BaseServiceImpl<ResiWarmhea |
|
|
|
throw new RenException(ResiWarmheartedVisitConstant.SELECT_USERINFO_EXCEPTION); |
|
|
|
} |
|
|
|
String showName = resultUserInfo.getData().getShowName(); |
|
|
|
String messageContent = String.format(ResiWarmUserMessageConstant.RESIWARM_APPLY_MSG, showName); |
|
|
|
String messageContent = ""; |
|
|
|
if (StrConstant.SPECIAL_CUSTOMER.equals(formDTO.getCustomerId())) { |
|
|
|
messageContent = String.format("%s申请成为组长,请审核。", showName); |
|
|
|
} else { |
|
|
|
messageContent = String.format(ResiWarmUserMessageConstant.RESIWARM_APPLY_MSG, showName); |
|
|
|
} |
|
|
|
formDTO.setMessageText(messageContent); |
|
|
|
//1:将申请记录存入热心居民申请表中
|
|
|
|
saveResiWarmApply(formDTO); |
|
|
@ -212,7 +215,11 @@ public class ResiWarmheartedApplyServiceImpl extends BaseServiceImpl<ResiWarmhea |
|
|
|
throw new RenException(ResiWarmheartedVisitConstant.SAVE_MSG_EXCEPTION); |
|
|
|
} |
|
|
|
result.setCode(NumConstant.ZERO); |
|
|
|
result.setMsg(ResiWarmheartedVisitConstant.RESI_WARM_SUBMIT); |
|
|
|
if (StrConstant.SPECIAL_CUSTOMER.equals(formDTO.getCustomerId())) { |
|
|
|
result.setMsg("组长信息已提交成功,请等待后台审核。"); |
|
|
|
} else { |
|
|
|
result.setMsg(ResiWarmheartedVisitConstant.RESI_WARM_SUBMIT); |
|
|
|
} |
|
|
|
} |
|
|
|
return result; |
|
|
|
} |
|
|
@ -270,7 +277,11 @@ public class ResiWarmheartedApplyServiceImpl extends BaseServiceImpl<ResiWarmhea |
|
|
|
msgDTO.setGridId(formDTO.getGridId()); |
|
|
|
msgDTO.setUserId(staff.getUserId()); |
|
|
|
msgDTO.setApp(AppClientConstant.APP_GOV); |
|
|
|
msgDTO.setTitle(ResiWarmUserMessageConstant.GROUP_TITLE); |
|
|
|
if (StrConstant.SPECIAL_CUSTOMER.equals(formDTO.getCustomerId())) { |
|
|
|
msgDTO.setTitle("您有一条组长申请消息"); |
|
|
|
} else { |
|
|
|
msgDTO.setTitle(ResiWarmUserMessageConstant.GROUP_TITLE); |
|
|
|
} |
|
|
|
msgDTO.setMessageContent(formDTO.getMessageText()); |
|
|
|
msgDTO.setReadFlag(ReadFlagConstant.UN_READ); |
|
|
|
msgList.add(msgDTO); |
|
|
@ -280,7 +291,11 @@ public class ResiWarmheartedApplyServiceImpl extends BaseServiceImpl<ResiWarmhea |
|
|
|
subscribeDTO.setGridId(formDTO.getGridId()); |
|
|
|
subscribeDTO.setUserId(staff.getUserId()); |
|
|
|
subscribeDTO.setCustomerId(formDTO.getCustomerId()); |
|
|
|
subscribeDTO.setBehaviorType(ResiWarmUserMessageConstant.WX_WARMHEARTED_BEHAVIOR); |
|
|
|
if (StrConstant.SPECIAL_CUSTOMER.equals(formDTO.getCustomerId())) { |
|
|
|
subscribeDTO.setBehaviorType("组长申请消息"); |
|
|
|
} else { |
|
|
|
subscribeDTO.setBehaviorType(ResiWarmUserMessageConstant.WX_WARMHEARTED_BEHAVIOR); |
|
|
|
} |
|
|
|
subscribeDTO.setMessageContent(formDTO.getMessageText()); |
|
|
|
subscribeDTO.setMessageTime(new Date()); |
|
|
|
subscribeList.add(subscribeDTO); |
|
|
@ -384,7 +399,7 @@ public class ResiWarmheartedApplyServiceImpl extends BaseServiceImpl<ResiWarmhea |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public Result approve(ResiWarmAuditApproveFormDTO formDTO) { |
|
|
|
public Result approve(TokenDto tokenDTO, ResiWarmAuditApproveFormDTO formDTO) { |
|
|
|
Result result = new Result(); |
|
|
|
//0:先校验数据是否是未审核状态,防止接口测试调用多次
|
|
|
|
ResiWarmheartedApplyEntity entity = baseDao.selectById(formDTO.getApplyId()); |
|
|
@ -399,7 +414,11 @@ public class ResiWarmheartedApplyServiceImpl extends BaseServiceImpl<ResiWarmhea |
|
|
|
//2:审核通过的添加热心居民的角色
|
|
|
|
if (num < NumConstant.ONE) { |
|
|
|
logger.error(String.format("政府端-热心居民申请-审核通过错误,applyId=%s,错误提示:%s",ResiWarmheartedVisitConstant.UPDATE_EXCEPTION)); |
|
|
|
throw new RenException(ResiWarmheartedVisitConstant.UPDATE_EXCEPTION); |
|
|
|
if (StrConstant.SPECIAL_CUSTOMER.equals(tokenDTO.getCustomerId())) { |
|
|
|
throw new RenException("组长申请数据更新失败,组长角色添加失败"); |
|
|
|
} else { |
|
|
|
throw new RenException(ResiWarmheartedVisitConstant.UPDATE_EXCEPTION); |
|
|
|
} |
|
|
|
} |
|
|
|
//查询需要添加热心居民角色的userId
|
|
|
|
UserRoleDTO dto = new UserRoleDTO(); |
|
|
@ -413,7 +432,11 @@ public class ResiWarmheartedApplyServiceImpl extends BaseServiceImpl<ResiWarmhea |
|
|
|
dto.setGridId(entity.getGridId()); |
|
|
|
result = epmetUserFeignClient.saveUserRole(dto); |
|
|
|
//3:为申请人发送审核通过消息提示
|
|
|
|
result = auditMessage(entity, ResiWarmUserMessageConstant.AUDIT_APPROVE_MSG); |
|
|
|
if (StrConstant.SPECIAL_CUSTOMER.equals(entity.getCustomerId())) { |
|
|
|
result = auditMessage(entity, "您申请的%s组长已审核通过,请查看。"); |
|
|
|
} else { |
|
|
|
result = auditMessage(entity, ResiWarmUserMessageConstant.AUDIT_APPROVE_MSG); |
|
|
|
} |
|
|
|
//5:更新这个人注册热心居民的网格下的所在的组的热心居民数信息
|
|
|
|
ResiIdentityFormDTO identityParam = new ResiIdentityFormDTO(); |
|
|
|
identityParam.setUserId(entity.getUserId()); |
|
|
@ -434,7 +457,11 @@ public class ResiWarmheartedApplyServiceImpl extends BaseServiceImpl<ResiWarmhea |
|
|
|
userMessageFormDTO.setGridId(formDTO.getGridId()); |
|
|
|
userMessageFormDTO.setUserId(formDTO.getUserId()); |
|
|
|
userMessageFormDTO.setApp(AppClientConstant.APP_RESI); |
|
|
|
userMessageFormDTO.setTitle(ResiWarmUserMessageConstant.GROUP_TITLE); |
|
|
|
if (StrConstant.SPECIAL_CUSTOMER.equals(formDTO.getCustomerId())) { |
|
|
|
userMessageFormDTO.setTitle("您有一条组长申请消息"); |
|
|
|
} else { |
|
|
|
userMessageFormDTO.setTitle(ResiWarmUserMessageConstant.GROUP_TITLE); |
|
|
|
} |
|
|
|
//调用gov-org服务查询网格信息
|
|
|
|
CustomerGridFormDTO customerGridFormDTO = new CustomerGridFormDTO(); |
|
|
|
customerGridFormDTO.setGridId(formDTO.getGridId()); |
|
|
@ -453,7 +480,11 @@ public class ResiWarmheartedApplyServiceImpl extends BaseServiceImpl<ResiWarmhea |
|
|
|
wxSubscribeMessageFormDTO.setUserId(formDTO.getUserId()); |
|
|
|
wxSubscribeMessageFormDTO.setGridId(formDTO.getGridId()); |
|
|
|
wxSubscribeMessageFormDTO.setClientType(AppClientConstant.APP_RESI); |
|
|
|
wxSubscribeMessageFormDTO.setBehaviorType(ResiWarmUserMessageConstant.WX_WARMHEARTED_BEHAVIOR); |
|
|
|
if (StrConstant.SPECIAL_CUSTOMER.equals(formDTO.getCustomerId())) { |
|
|
|
wxSubscribeMessageFormDTO.setBehaviorType("组长申请消息"); |
|
|
|
} else { |
|
|
|
wxSubscribeMessageFormDTO.setBehaviorType(ResiWarmUserMessageConstant.WX_WARMHEARTED_BEHAVIOR); |
|
|
|
} |
|
|
|
wxSubscribeMessageFormDTO.setMessageContent(messageContent); |
|
|
|
wxSubscribeMessageFormDTO.setMessageTime(new Date()); |
|
|
|
List<WxSubscribeMessageFormDTO> msgList = new ArrayList<>(); |
|
|
@ -487,7 +518,11 @@ public class ResiWarmheartedApplyServiceImpl extends BaseServiceImpl<ResiWarmhea |
|
|
|
baseDao.updateById(entity); |
|
|
|
//2:为申请人发送审核驳回消息提示
|
|
|
|
//查询申请信息
|
|
|
|
auditMessage(entity, ResiWarmUserMessageConstant.AUDIT_REJECT_MSG); |
|
|
|
if (StrConstant.SPECIAL_CUSTOMER.equals(entity.getCustomerId())) { |
|
|
|
auditMessage(entity, "您申请的%s组长,已被驳回,原因:%s"); |
|
|
|
} else { |
|
|
|
auditMessage(entity, ResiWarmUserMessageConstant.AUDIT_REJECT_MSG); |
|
|
|
} |
|
|
|
return result; |
|
|
|
} |
|
|
|
|
|
|
@ -499,12 +534,16 @@ public class ResiWarmheartedApplyServiceImpl extends BaseServiceImpl<ResiWarmhea |
|
|
|
* @author sun |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public Result<ResiWarmAuditResultDTO> getDetail(ResiWarmGetDetailFormDTO formDTO) { |
|
|
|
public Result<ResiWarmAuditResultDTO> getDetail(TokenDto tokenDTO, ResiWarmGetDetailFormDTO formDTO) { |
|
|
|
Result<ResiWarmAuditResultDTO> result = new Result<>(); |
|
|
|
//1:根据申请Id查询热心居民申请审核详情
|
|
|
|
ResiWarmheartedApplyEntity entity = baseDao.selectById(formDTO.getApplyId()); |
|
|
|
if (null == entity) { |
|
|
|
result.error(ResiWarmheartedVisitConstant.SELECT_EXCEPTION); |
|
|
|
if (StrConstant.SPECIAL_CUSTOMER.equals(tokenDTO.getCustomerId())) { |
|
|
|
result.error("根据申请Id未查询到组长申请详情信息"); |
|
|
|
} else { |
|
|
|
result.error(ResiWarmheartedVisitConstant.SELECT_EXCEPTION); |
|
|
|
} |
|
|
|
return result; |
|
|
|
} |
|
|
|
//2:修改申请数据状态为已读
|
|
|
@ -518,7 +557,11 @@ public class ResiWarmheartedApplyServiceImpl extends BaseServiceImpl<ResiWarmhea |
|
|
|
userResiInfoFormDTO.setUserId(entity.getUserId()); |
|
|
|
Result<UserResiInfoResultDTO> resultUserInfo = epmetUserFeignClient.getUserResiInfoDTO(userResiInfoFormDTO); |
|
|
|
if (!resultUserInfo.success() || null == resultUserInfo.getData()) { |
|
|
|
result.error(ResiWarmheartedVisitConstant.SELECT_EXCEPTION); |
|
|
|
if (StrConstant.SPECIAL_CUSTOMER.equals(tokenDTO.getCustomerId())) { |
|
|
|
result.error("根据申请Id未查询到组长申请详情信息"); |
|
|
|
} else { |
|
|
|
result.error(ResiWarmheartedVisitConstant.SELECT_EXCEPTION); |
|
|
|
} |
|
|
|
return result; |
|
|
|
} |
|
|
|
UserResiInfoResultDTO userInfo = resultUserInfo.getData(); |
|
|
|