|
|
|
|
@@ -255,7 +255,6 @@ public class PointServiceImpl implements PointService {
|
|
|
|
|
updatePoint.setId(pointId);
|
|
|
|
|
updatePoint.setPointStatus(PointStatusEnum.POINT_STATUS_3.getCode());
|
|
|
|
|
updatePoint.setSubmitAuditCount(submitAuditCount);
|
|
|
|
|
updatePoint.setOperateUserId(request.getOperateUserId());
|
|
|
|
|
PointDetailInfoDO updatePointDetail = new PointDetailInfoDO();
|
|
|
|
|
updatePointDetail.setId(pointDetailInfo.getId());
|
|
|
|
|
updatePointDetail.setDevelopmentManagerSign(request.getDevelopmentManagerSign());
|
|
|
|
|
@@ -266,7 +265,7 @@ public class PointServiceImpl implements PointService {
|
|
|
|
|
if(Objects.isNull(auditSetting)){
|
|
|
|
|
throw new ServiceException(ErrorCodeEnum.POINT_AUDIT_NOT_SETTING);
|
|
|
|
|
}
|
|
|
|
|
List<AuditNodeDTO> auditNode = dealAuditNode(auditSetting, pointInfo.getRegionId(), request.getOperateUserId(), pointInfo.getDevelopmentManager());
|
|
|
|
|
List<AuditNodeDTO> auditNode = dealAuditNode(auditSetting, pointInfo.getRegionId(), pointInfo.getDevelopmentManager());
|
|
|
|
|
//获取审批节点上的数据
|
|
|
|
|
List<PointAuditRecordDO> recordList = AuditNodeDTO.convertDO(pointId, submitAuditCount, auditNode);
|
|
|
|
|
pointAuditRecordDAO.addPointAuditRecord(recordList);
|
|
|
|
|
@@ -299,53 +298,11 @@ public class PointServiceImpl implements PointService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
|
|
public Integer operationUserAudit(String userId, OperationAuditRequest request) {
|
|
|
|
|
if(!request.check()){
|
|
|
|
|
throw new ServiceException(ErrorCodeEnum.PARAMS_VALIDATE_ERROR);
|
|
|
|
|
}
|
|
|
|
|
Long pointId = request.getPointId();
|
|
|
|
|
PointInfoDO pointInfo = pointInfoDAO.getPointInfoById(pointId);
|
|
|
|
|
PointDetailInfoDO pointDetailInfo = pointDetailInfoDAO.getPointDetailInfoByPointId(pointId);
|
|
|
|
|
if(Objects.isNull(pointInfo) || Objects.isNull(pointDetailInfo)){
|
|
|
|
|
log.info("铺位基本信息不存在");
|
|
|
|
|
throw new ServiceException(ErrorCodeEnum.POINT_NOT_EXIST);
|
|
|
|
|
}
|
|
|
|
|
if(!PointStatusEnum.POINT_STATUS_3.getCode().equals(pointInfo.getPointStatus())){
|
|
|
|
|
log.info("铺位状态不允许该操作");
|
|
|
|
|
throw new ServiceException(ErrorCodeEnum.NOT_ALLOW_OPERATE);
|
|
|
|
|
}
|
|
|
|
|
if(!userId.equals(pointInfo.getOperateUserId())){
|
|
|
|
|
log.info("运营人员不对");
|
|
|
|
|
throw new ServiceException(ErrorCodeEnum.NO_PERMISSION);
|
|
|
|
|
}
|
|
|
|
|
PointTodoInfoDO pointTodo = pointTodoInfoDAO.getPointToDoByUserIdAndPointId(userId, pointId);
|
|
|
|
|
if(Objects.isNull(pointTodo)){
|
|
|
|
|
log.info("该用户没有待办数据");
|
|
|
|
|
throw new ServiceException(ErrorCodeEnum.USER_NOT_TODO_AUDIT);
|
|
|
|
|
}
|
|
|
|
|
if(!NodeNoEnum.NODE_NO_2.getCode().equals(pointTodo.getNodeNo())){
|
|
|
|
|
log.info("获取铺位待办数据不对");
|
|
|
|
|
throw new ServiceException(ErrorCodeEnum.POINT_AUDIT_NODE_ERROR);
|
|
|
|
|
}
|
|
|
|
|
Map<Integer, PointAuditRecordDO> pointAuditRecordMap = pointAuditRecordDAO.getPointAuditRecordMap(pointId, pointInfo.getSubmitAuditCount());
|
|
|
|
|
PointAuditRecordDO pointAuditRecord = pointAuditRecordMap.get(NodeNoEnum.NODE_NO_2.getCode());
|
|
|
|
|
if(Objects.isNull(pointAuditRecord) || !AuditStatusEnum.TODO.getCode().equals(pointAuditRecord.getAuditStatus())){
|
|
|
|
|
log.info("铺位处理记录中的数据不对或者状态不对");
|
|
|
|
|
throw new ServiceException(ErrorCodeEnum.POINT_AUDIT_NODE_ERROR);
|
|
|
|
|
}
|
|
|
|
|
AuditStatusEnum auditStatus = AuditStatusEnum.getByCode(request.getAuditStatus());
|
|
|
|
|
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)){
|
|
|
|
|
return auditRejectDeal(pointInfo, request.getReason());
|
|
|
|
|
}
|
|
|
|
|
return dealNextAuditRecord(pointInfo, pointAuditRecordMap, NodeNoEnum.NODE_NO_2.getCode());
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 初始化上传租赁合同阶段
|
|
|
|
|
* @param pointInfo
|
|
|
|
|
@@ -377,13 +334,6 @@ public class PointServiceImpl implements PointService {
|
|
|
|
|
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);
|
|
|
|
|
Map<String, String> messageMap = new HashMap<>();
|
|
|
|
|
messageMap.put("pointId", String.valueOf(pointInfo.getId()));
|
|
|
|
|
@@ -395,6 +345,7 @@ public class PointServiceImpl implements PointService {
|
|
|
|
|
updatePoint.setId(pointInfo.getId());
|
|
|
|
|
//没有下一节点 审批通过
|
|
|
|
|
updatePoint.setPointStatus(PointStatusEnum.POINT_STATUS_5.getCode());
|
|
|
|
|
updatePoint.setStorageStatus(StorageStatusEnum.IN_STORAGE.getCode());
|
|
|
|
|
if(SelectStatusEnum.SELECT_STATUS_1.getCode().equals(pointInfo.getSelectStatus())){
|
|
|
|
|
initUploadRentContract(pointInfo);
|
|
|
|
|
}
|
|
|
|
|
@@ -443,10 +394,6 @@ public class PointServiceImpl implements PointService {
|
|
|
|
|
log.info("该用户没有待办数据");
|
|
|
|
|
throw new ServiceException(ErrorCodeEnum.USER_NOT_TODO_AUDIT);
|
|
|
|
|
}
|
|
|
|
|
if(NodeNoEnum.NODE_NO_2.getCode().equals(pointTodo.getNodeNo())){
|
|
|
|
|
log.info("获取铺位待办数据不对");
|
|
|
|
|
throw new ServiceException(ErrorCodeEnum.POINT_AUDIT_NODE_ERROR);
|
|
|
|
|
}
|
|
|
|
|
PointInfoDO pointInfo = pointInfoDAO.getPointInfoById(pointId);
|
|
|
|
|
if(Objects.isNull(pointInfo)){
|
|
|
|
|
log.info("铺位不存在");
|
|
|
|
|
@@ -1055,47 +1002,19 @@ public class PointServiceImpl implements PointService {
|
|
|
|
|
return resultPage;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public List<AuditNodeDTO> dealAuditNode(AuditSettingVO auditSetting, Long regionId, String operateUserId, String developmentManager) {
|
|
|
|
|
public List<AuditNodeDTO> dealAuditNode(AuditSettingVO auditSetting, Long regionId, String developmentManager) {
|
|
|
|
|
List<String> roleIds = new ArrayList<>();
|
|
|
|
|
//审核人
|
|
|
|
|
Pair<List<String>, List<String>> firstApproval = getUserIdsAndPositionIds(auditSetting.getFirstApproval());
|
|
|
|
|
Pair<List<String>, List<String>> thirdApproval = getUserIdsAndPositionIds(auditSetting.getThirdApproval());
|
|
|
|
|
Pair<List<String>, List<String>> fourthApproval = getUserIdsAndPositionIds(auditSetting.getFourthApproval());
|
|
|
|
|
Pair<List<String>, List<String>> fifthApproval = getUserIdsAndPositionIds(auditSetting.getFifthApproval());
|
|
|
|
|
if(CollectionUtils.isNotEmpty(firstApproval.getValue())){
|
|
|
|
|
roleIds.addAll(firstApproval.getValue());
|
|
|
|
|
}
|
|
|
|
|
if(CollectionUtils.isNotEmpty(thirdApproval.getValue())){
|
|
|
|
|
roleIds.addAll(thirdApproval.getValue());
|
|
|
|
|
}
|
|
|
|
|
if(CollectionUtils.isNotEmpty(fourthApproval.getValue())){
|
|
|
|
|
roleIds.addAll(fourthApproval.getValue());
|
|
|
|
|
}
|
|
|
|
|
if(CollectionUtils.isNotEmpty(fifthApproval.getValue())){
|
|
|
|
|
roleIds.addAll(fifthApproval.getValue());
|
|
|
|
|
}
|
|
|
|
|
List<AuditNodeDTO> resultList = new ArrayList<>();
|
|
|
|
|
Map<String, List<String>> userIdsMap = userAuthMappingService.getUserIdByRoleIdAndRegionId(roleIds, regionId);
|
|
|
|
|
List<String> firstApprovalUserIds = getUserIdsByPositionIds(firstApproval, userIdsMap);
|
|
|
|
|
List<String> thirdApprovalUserIds = getUserIdsByPositionIds(thirdApproval, userIdsMap);
|
|
|
|
|
List<String> fourthApprovalUserIds = getUserIdsByPositionIds(fourthApproval, userIdsMap);
|
|
|
|
|
List<String> fifthApprovalUserIds = getUserIdsByPositionIds(fifthApproval, userIdsMap);
|
|
|
|
|
resultList.add(new AuditNodeDTO(NodeNoEnum.NODE_NO_0.getCode(), PointAuditRecordDO.SUBMIT_TASK, Boolean.FALSE, Arrays.asList(developmentManager)));
|
|
|
|
|
if(CollectionUtils.isNotEmpty(firstApprovalUserIds)){
|
|
|
|
|
resultList.add(new AuditNodeDTO(NodeNoEnum.NODE_NO_1.getCode(), PointAuditRecordDO.RECEIVE_TASK, Boolean.TRUE, firstApprovalUserIds));
|
|
|
|
|
resultList.add(new AuditNodeDTO(NodeNoEnum.NODE_NO_2.getCode(), Arrays.asList(operateUserId)));
|
|
|
|
|
}else{
|
|
|
|
|
resultList.add(new AuditNodeDTO(NodeNoEnum.NODE_NO_2.getCode(), PointAuditRecordDO.RECEIVE_TASK, Boolean.TRUE, Arrays.asList(operateUserId)));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(CollectionUtils.isNotEmpty(thirdApprovalUserIds)){
|
|
|
|
|
resultList.add(new AuditNodeDTO(NodeNoEnum.NODE_NO_3.getCode(), thirdApprovalUserIds));
|
|
|
|
|
}
|
|
|
|
|
if(CollectionUtils.isNotEmpty(fourthApprovalUserIds)){
|
|
|
|
|
resultList.add(new AuditNodeDTO(NodeNoEnum.NODE_NO_4.getCode(), fourthApprovalUserIds));
|
|
|
|
|
}
|
|
|
|
|
if(CollectionUtils.isNotEmpty(fifthApprovalUserIds)){
|
|
|
|
|
resultList.add(new AuditNodeDTO(NodeNoEnum.NODE_NO_5.getCode(), fifthApprovalUserIds));
|
|
|
|
|
}
|
|
|
|
|
return resultList;
|
|
|
|
|
}
|
|
|
|
|
|