Browse Source

政府端-热心居民模块接口程序调测修改

dev_shibei_match
sunyuchao 5 years ago
parent
commit
4875319625
  1. 5
      epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/warmhearted/form/ResiWarmheartedSubmitFormDTO.java
  2. 4
      epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/warmhearted/constant/ResiWarmheartedVisitConstant.java
  3. 70
      epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/warmhearted/service/impl/ResiWarmheartedApplyServiceImpl.java

5
epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/warmhearted/form/ResiWarmheartedSubmitFormDTO.java

@ -66,4 +66,9 @@ public class ResiWarmheartedSubmitFormDTO implements Serializable {
*/
private String app;
/**
* 消息内容
*/
private String messageText;
}

4
epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/warmhearted/constant/ResiWarmheartedVisitConstant.java

@ -70,7 +70,11 @@ public interface ResiWarmheartedVisitConstant {
*/
String REPEAT_EXCEPTION = "已存在待审核的申请,不能重复申请";
String SELECT_USERINFO_EXCEPTION = "未查询到申请人基本信息,申请提交失败";
String UPDATE_EXCEPTION = "热心居民申请数据更新失败,热心居民角色添加失败";
String SELECT_EXCEPTION = "根据申请Id未查询到热心居民申请详情信息";
String AUDIT_EXCEPTION = "该申请数据已审核,不能再次审核";
}

70
epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/warmhearted/service/impl/ResiWarmheartedApplyServiceImpl.java

@ -187,16 +187,28 @@ public class ResiWarmheartedApplyServiceImpl extends BaseServiceImpl<ResiWarmhea
logger.error(ResiWarmheartedVisitConstant.REPEAT_EXCEPTION);
throw new RenException(ResiWarmheartedVisitConstant.REPEAT_EXCEPTION);
} else {
//0:调用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 messageContent = String.format(ResiWarmUserMessageConstant.RESIWARM_APPLY_MSG, showName);
formDTO.setMessageText(messageContent);
//1:将申请记录存入热心居民申请表中
saveResiWarmApply(formDTO);
//2:将最后一次操作行为更新到热心居民申请行为记录表中
resiWarmheartedVisitService.updateResiWarmVisit(formDTO);
//3:添加消息信息,给网格长发消息
saveResiWarmUserMessage(formDTO);
result.setCode(NumConstant.ZERO);
result.setMsg(ResiWarmheartedVisitConstant.RESI_WARM_SUBMIT);
}
return result;
}
/**
* 热心居民申请表新增数据
*
@ -211,8 +223,31 @@ public class ResiWarmheartedApplyServiceImpl extends BaseServiceImpl<ResiWarmhea
entity.setReason(formDTO.getReason());
entity.setResiWarmVisitId(formDTO.getResiWarmVisitId());
entity.setAuditStatus(ResiWarmheartedVisitConstant.UNDER_AUDITTING);
entity.setReadFlag(ResiWarmheartedVisitConstant.UN_READ);
entity.setMessageText(formDTO.getMessageText());
baseDao.insert(entity);
}
/**
* 热心居民申请像网格长发送消息
*
* @param formDTO
* @return
* @Author sun
*/
private void saveResiWarmUserMessage(ResiWarmheartedSubmitFormDTO formDTO) {
UserMessageFormDTO userMessageFormDTO = new UserMessageFormDTO();
userMessageFormDTO.setCustomerId(formDTO.getCustomerId());
userMessageFormDTO.setGridId(formDTO.getGridId());
//网格长用户Id TODO
//userMessageFormDTO.setUserId();
userMessageFormDTO.setUserId(formDTO.getUserId());//先在token中取一个默认值
userMessageFormDTO.setApp(formDTO.getApp());
userMessageFormDTO.setTitle(ResiWarmUserMessageConstant.GROUP_TITLE);
userMessageFormDTO.setMessageContent(formDTO.getMessageText());
userMessageFormDTO.setReadFlag(ReadFlagConstant.UN_READ);
//保存消息
epmetMessageFeignClient.saveUserMessage(userMessageFormDTO);
}
@Override
@Transactional(rollbackFor = Exception.class)
@ -302,6 +337,7 @@ public class ResiWarmheartedApplyServiceImpl extends BaseServiceImpl<ResiWarmhea
List<ResiWarmAuditResultDTO> applyList = new ArrayList<>();
//1:查询待审核状态的热心居民申请
formDTO.setAuditStatus(PartyMemberConstant.UNDER_AUDITTING);
formDTO.setPageNo((formDTO.getPageNo() - NumConstant.ONE) * formDTO.getPageSize());
applyList = baseDao.selectResiWarmAuditList(formDTO);
if (null == applyList || applyList.size() < NumConstant.ONE) {
return result.ok(applyList);
@ -339,9 +375,13 @@ public class ResiWarmheartedApplyServiceImpl extends BaseServiceImpl<ResiWarmhea
@Transactional(rollbackFor = Exception.class)
public Result approve(ResiWarmAuditApproveFormDTO formDTO) {
Result result = new Result();
//0:先校验数据是否是未审核状态,防止接口测试调用多次
ResiWarmheartedApplyEntity entity = baseDao.selectById(formDTO.getApplyId());
if (null == entity || !ResiWarmheartedVisitConstant.UNDER_AUDITTING.equals(entity.getAuditStatus())) {
result.error(ResiWarmheartedVisitConstant.AUDIT_EXCEPTION);
return result;
}
//1:更新热心居民申请表数据
ResiWarmheartedApplyEntity entity = new ResiWarmheartedApplyEntity();
entity.setId(formDTO.getApplyId());
//审核状态-通过
entity.setAuditStatus(PartyMemberConstant.APPROVED);
int num = baseDao.updateById(entity);
@ -351,19 +391,18 @@ public class ResiWarmheartedApplyServiceImpl extends BaseServiceImpl<ResiWarmhea
return result;
}
//查询需要添加热心居民角色的userId
ResiWarmheartedApplyEntity resiWarmheartedApplyEntity = baseDao.selectById(formDTO.getApplyId());
UserRoleDTO dto = new UserRoleDTO();
dto.setCustomerId(resiWarmheartedApplyEntity.getCustomerId());
dto.setUserId(resiWarmheartedApplyEntity.getUserId());
dto.setCustomerId(entity.getCustomerId());
dto.setUserId(entity.getUserId());
//所属端-居民端
dto.setApp(AppClientConstant.APP_RESI);
//角色-热心居民
dto.setRoleKey(EpmetRoleKeyConstant.WARMHEARTED);
//角色表新增网格Id
dto.setGridId(resiWarmheartedApplyEntity.getGridId());
dto.setGridId(entity.getGridId());
result = epmetUserFeignClient.saveUserRole(dto);
//3:为申请人发送审核通过消息提示
auditMessage(resiWarmheartedApplyEntity, ResiWarmUserMessageConstant.AUDIT_APPROVE_MSG);
result = auditMessage(entity, ResiWarmUserMessageConstant.AUDIT_APPROVE_MSG);
return result;
}
/**
@ -372,7 +411,7 @@ public class ResiWarmheartedApplyServiceImpl extends BaseServiceImpl<ResiWarmhea
* @param formDTO
* @param userMsg 消息模板
*/
private void auditMessage(ResiWarmheartedApplyEntity formDTO, String userMsg) {
private Result auditMessage(ResiWarmheartedApplyEntity formDTO, String userMsg) {
UserMessageFormDTO userMessageFormDTO = new UserMessageFormDTO();
userMessageFormDTO.setCustomerId(formDTO.getCustomerId());
userMessageFormDTO.setGridId(formDTO.getGridId());
@ -391,7 +430,7 @@ public class ResiWarmheartedApplyServiceImpl extends BaseServiceImpl<ResiWarmhea
userMessageFormDTO.setMessageContent(messageContent);
userMessageFormDTO.setReadFlag(ReadFlagConstant.UN_READ);
//保存消息
epmetMessageFeignClient.saveUserMessage(userMessageFormDTO);
return epmetMessageFeignClient.saveUserMessage(userMessageFormDTO);
}
/**
* 政府端-热心居民申请-审核驳回
@ -404,17 +443,20 @@ public class ResiWarmheartedApplyServiceImpl extends BaseServiceImpl<ResiWarmhea
@Transactional(rollbackFor = Exception.class)
public Result reject(ResiWarmAuditRejectFormDTO formDTO) {
Result result = new Result();
//0:先校验数据是否是未审核状态,防止接口测试调用多次
ResiWarmheartedApplyEntity entity = baseDao.selectById(formDTO.getApplyId());
if (null == entity || !ResiWarmheartedVisitConstant.UNDER_AUDITTING.equals(entity.getAuditStatus())) {
result.error(ResiWarmheartedVisitConstant.AUDIT_EXCEPTION);
return result;
}
//1:更新热心居民申请表数据
ResiWarmheartedApplyEntity entity = new ResiWarmheartedApplyEntity();
entity.setId(formDTO.getApplyId());
//审核状态-未通过
entity.setAuditStatus(PartyMemberConstant.REJECTED);
entity.setRefuseReason(formDTO.getRefuseReason());
baseDao.updateById(entity);
//2:为申请人发送审核驳回消息提示
//查询申请信息
ResiWarmheartedApplyEntity resiWarmheartedApplyEntity = baseDao.selectById(formDTO.getApplyId());
auditMessage(resiWarmheartedApplyEntity, ResiWarmUserMessageConstant.AUDIT_REJECT_MSG);
auditMessage(entity, ResiWarmUserMessageConstant.AUDIT_REJECT_MSG);
return result;
}

Loading…
Cancel
Save