This commit is contained in:
zhangchenbiao
2024-05-07 11:43:30 +08:00
parent 10dfaafaba
commit d31461886d

View File

@@ -340,39 +340,15 @@ public class PointServiceImpl implements PointService {
throw new ServiceException(ErrorCodeEnum.POINT_AUDIT_NODE_ERROR);
}
AuditStatusEnum auditStatus = AuditStatusEnum.getByCode(request.getAuditStatus());
PointInfoDO updatePoint = new PointInfoDO();
updatePoint.setId(pointId);
PointDetailInfoDO updatePointDetailInfo = OperationAuditRequest.convertDO(pointDetailInfo.getId(), request);
pointDetailInfoDAO.updatePointDetailInfo(updatePointDetailInfo);
pointTodoInfoDAO.updatePointTodoInfo(pointId, NodeNoEnum.NODE_NO_2.getCode(), pointInfo.getSubmitAuditCount(), userId);
PointAuditRecordDO updateAuditRecord = PointAuditRecordDO.convert(pointAuditRecord.getId(), userId, auditStatus, request.getReason(), NodeNoEnum.NODE_NO_2, request.getSignTime(), request.getSignAddress(), request.getPictureUrl());
pointAuditRecordDAO.updatePointAuditRecord(updateAuditRecord);
if(AuditStatusEnum.REJECT.equals(auditStatus)){
//删除剩余未完成的审核记录
pointAuditRecordDAO.deletePointAuditRecord(pointId, pointInfo.getSubmitAuditCount());
updatePoint.setPointStatus(PointStatusEnum.POINT_STATUS_2.getCode());
updatePoint.setStorageStatus(StorageStatusEnum.NOT_IN_STORAGE.getCode());
commonService.sendMessage(Arrays.asList(pointInfo.getDevelopmentManager()), MessageEnum.MESSAGE_12, pointInfo.getPointName(), pointInfo.getAddress(), request.getReason());
return pointInfoDAO.updatePointInfo(updatePoint);
return auditRejectDeal(pointInfo, request.getReason());
}
PointAuditRecordDO nextAuditRecord = getNextAuditRecord(NodeNoEnum.NODE_NO_2.getCode(), pointAuditRecordMap);
if(Objects.nonNull(nextAuditRecord)){
pointAuditRecordDAO.updatePointAuditRecord(PointAuditRecordDO.convert(nextAuditRecord.getId(), new Date()));
//审批通过的情况下 生成下一个节点的待办数据
pointTodoInfoDAO.addPointTodoInfo(PointAuditRecordDO.convertTODO(nextAuditRecord));
updatePoint.setPointStatus(PointStatusEnum.POINT_STATUS_4.getCode());
List<String> sendMessageUserIds = JSONObject.parseArray(nextAuditRecord.getHandlerUserIds(), String.class);
commonService.sendMessage(sendMessageUserIds, MessageEnum.MESSAGE_13, pointInfo.getPointName(), pointInfo.getAddress());
}else{
//没有下一节点 审批通过
updatePoint.setPointStatus(PointStatusEnum.POINT_STATUS_5.getCode());
if(SelectStatusEnum.SELECT_STATUS_1.getCode().equals(pointInfo.getSelectStatus())){
initUploadRentContract(pointInfo);
}
commonService.sendMessage(Arrays.asList(pointInfo.getDevelopmentManager()), MessageEnum.MESSAGE_11, pointInfo.getPointName(), pointInfo.getAddress());
}
updatePoint.setStorageStatus(StorageStatusEnum.IN_STORAGE.getCode());
return pointInfoDAO.updatePointInfo(updatePoint);
return dealNextAuditRecord(pointInfo, pointAuditRecordMap, NodeNoEnum.NODE_NO_2.getCode());
}
/**
@@ -387,6 +363,61 @@ public class PointServiceImpl implements PointService {
commonService.sendSms(lineInfo.getMobile(), SMSMsgEnum.SELECT_SUCCESS, templateParam);
}
/**
* 处理下一个节点的审批记录
* @param pointInfo
* @param pointAuditRecordMap
* @param currentNo
* @return
*/
private Integer dealNextAuditRecord(PointInfoDO pointInfo, Map<Integer, PointAuditRecordDO> pointAuditRecordMap, Integer currentNo){
Integer result = CommonConstants.ZERO;
PointAuditRecordDO nextAuditRecord = getNextAuditRecord(currentNo, pointAuditRecordMap);
if(Objects.nonNull(nextAuditRecord)){
pointAuditRecordDAO.updatePointAuditRecord(PointAuditRecordDO.convert(nextAuditRecord.getId(), new Date()));
//审批通过的情况下 生成下一个节点的待办数据
pointTodoInfoDAO.addPointTodoInfo(PointAuditRecordDO.convertTODO(nextAuditRecord));
if(NodeNoEnum.NODE_NO_2.getCode().equals(currentNo)){
PointInfoDO updatePoint = new PointInfoDO();
updatePoint.setId(pointInfo.getId());
updatePoint.setPointStatus(PointStatusEnum.POINT_STATUS_4.getCode());
updatePoint.setStorageStatus(StorageStatusEnum.IN_STORAGE.getCode());
result = pointInfoDAO.updatePointInfo(updatePoint);
}
List<String> sendMessageUserIds = JSONObject.parseArray(nextAuditRecord.getHandlerUserIds(), String.class);
commonService.sendMessage(sendMessageUserIds, MessageEnum.MESSAGE_13, pointInfo.getPointName(), pointInfo.getAddress());
}else{
PointInfoDO updatePoint = new PointInfoDO();
updatePoint.setId(pointInfo.getId());
//没有下一节点 审批通过
updatePoint.setPointStatus(PointStatusEnum.POINT_STATUS_5.getCode());
if(SelectStatusEnum.SELECT_STATUS_1.getCode().equals(pointInfo.getSelectStatus())){
initUploadRentContract(pointInfo);
}
commonService.sendMessage(Arrays.asList(pointInfo.getDevelopmentManager()), MessageEnum.MESSAGE_11, pointInfo.getPointName(), pointInfo.getAddress());
result = pointInfoDAO.updatePointInfo(updatePoint);
}
return result;
}
/**
* 铺位审核拒绝处理
* @param pointInfo
* @param reason
* @return
*/
private Integer auditRejectDeal(PointInfoDO pointInfo, String reason){
Long pointId = pointInfo.getId();
PointInfoDO pointInfoUpdate = new PointInfoDO();
pointInfoUpdate.setId(pointId);
pointInfoUpdate.setPointStatus(PointStatusEnum.POINT_STATUS_2.getCode());
pointInfoUpdate.setStorageStatus(StorageStatusEnum.NOT_IN_STORAGE.getCode());
//删除剩余未完成的审核记录
pointAuditRecordDAO.deletePointAuditRecord(pointId, pointInfo.getSubmitAuditCount());
commonService.sendMessage(Arrays.asList(pointInfo.getDevelopmentManager()), MessageEnum.MESSAGE_12, pointInfo.getPointName(), pointInfo.getAddress(), reason);
return pointInfoDAO.updatePointInfo(pointInfoUpdate);
}
@Override
@Transactional(rollbackFor = Exception.class)
public Integer audit(String userId, PointAuditRequest request) {
@@ -421,31 +452,10 @@ public class PointServiceImpl implements PointService {
PointAuditRecordDO auditRecord = PointAuditRecordDO.convert(pointAuditRecord.getId(), userId, auditStatus, request.getReason(), nodeNoEnum);
pointAuditRecordDAO.updatePointAuditRecord(auditRecord);
if(AuditStatusEnum.REJECT.equals(auditStatus)){
PointInfoDO pointInfoUpdate = new PointInfoDO();
pointInfoUpdate.setId(pointId);
pointInfoUpdate.setPointStatus(PointStatusEnum.POINT_STATUS_2.getCode());
//删除剩余未完成的审核记录
pointAuditRecordDAO.deletePointAuditRecord(pointId, pointInfo.getSubmitAuditCount());
commonService.sendMessage(Arrays.asList(pointInfo.getDevelopmentManager()), MessageEnum.MESSAGE_12, pointInfo.getPointName(), pointInfo.getAddress(), request.getReason());
return pointInfoDAO.updatePointInfo(pointInfoUpdate);
return auditRejectDeal(pointInfo, request.getReason());
}
PointAuditRecordDO nextAuditRecord = getNextAuditRecord(pointTodo.getNodeNo(), pointAuditRecordMap);
if(Objects.nonNull(nextAuditRecord)){
//更新下一阶段任务的收到任务时间
pointAuditRecordDAO.updatePointAuditRecord(PointAuditRecordDO.convert(nextAuditRecord.getId(), new Date()));
List<String> sendMessageUserIds = JSONObject.parseArray(nextAuditRecord.getHandlerUserIds(), String.class);
commonService.sendMessage(sendMessageUserIds, MessageEnum.MESSAGE_13, pointInfo.getPointName(), pointInfo.getAddress());
//审批通过的情况下 生成下一个节点的待办数据
return pointTodoInfoDAO.addPointTodoInfo(PointAuditRecordDO.convertTODO(nextAuditRecord));
}
PointInfoDO pointInfoUpdate = new PointInfoDO();
pointInfoUpdate.setId(pointId);
pointInfoUpdate.setPointStatus(PointStatusEnum.POINT_STATUS_5.getCode());
if(SelectStatusEnum.SELECT_STATUS_1.getCode().equals(pointInfo.getSelectStatus())){
initUploadRentContract(pointInfo);
}
commonService.sendMessage(Arrays.asList(pointInfo.getDevelopmentManager()), MessageEnum.MESSAGE_11, pointInfo.getPointName(), pointInfo.getAddress());
return pointInfoDAO.updatePointInfo(pointInfoUpdate);
//处理下一节点任务及更新point状态
return dealNextAuditRecord(pointInfo, pointAuditRecordMap, pointTodo.getNodeNo());
}
@Override