feat:一级审批

This commit is contained in:
苏竹红
2024-08-19 17:45:02 +08:00
parent 39d6dba87a
commit ab6d161940
4 changed files with 8 additions and 112 deletions

View File

@@ -7,11 +7,6 @@ import java.util.List;
public enum NodeNoEnum {
NODE_NO_0(0,"提交任务"),
NODE_NO_1(1,"第一级审批"),
NODE_NO_2(2,"第二级审批"),
NODE_NO_3(3,"第三级审批"),
NODE_NO_4(4,"第四级审批"),
NODE_NO_5(5,"第五级审批"),
NODE_NO_100(100,"结束"),
;
@@ -47,22 +42,9 @@ public enum NodeNoEnum {
*/
public static List<NodeNoEnum> getNextNodeNoList(Integer nodeNo){
if(NodeNoEnum.NODE_NO_0.getCode().equals(nodeNo)){
return Lists.newArrayList(NodeNoEnum.NODE_NO_1, NodeNoEnum.NODE_NO_2, NodeNoEnum.NODE_NO_3, NodeNoEnum.NODE_NO_4, NodeNoEnum.NODE_NO_5);
}
if(NodeNoEnum.NODE_NO_1.getCode().equals(nodeNo)){
return Lists.newArrayList(NodeNoEnum.NODE_NO_2, NodeNoEnum.NODE_NO_3, NodeNoEnum.NODE_NO_4, NodeNoEnum.NODE_NO_5);
}
if(NodeNoEnum.NODE_NO_2.getCode().equals(nodeNo)){
return Lists.newArrayList(NodeNoEnum.NODE_NO_3, NodeNoEnum.NODE_NO_4, NodeNoEnum.NODE_NO_5);
}
if(NodeNoEnum.NODE_NO_3.getCode().equals(nodeNo)){
return Lists.newArrayList(NodeNoEnum.NODE_NO_4, NodeNoEnum.NODE_NO_5);
}
if(NodeNoEnum.NODE_NO_4.getCode().equals(nodeNo)){
return Lists.newArrayList(NodeNoEnum.NODE_NO_5);
}else {
return Lists.newArrayList();
return Lists.newArrayList(NodeNoEnum.NODE_NO_1);
}
return Lists.newArrayList();
}
public static NodeNoEnum getByCode(Integer code){

View File

@@ -19,11 +19,6 @@ public class SubmitPointAuditRequest {
@ApiModelProperty("点位id")
private Long pointId;
@NotNull
@NotBlank
@ApiModelProperty("营运人员")
private String operateUserId;
@NotNull
@NotBlank
@ApiModelProperty("拓展专员签名")

View File

@@ -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;
}

View File

@@ -1,5 +1,5 @@
spring.application.name=zxjp-web
spring.profiles.active=@profileActive@
spring.profiles.active=test
server.port=40300
server.servlet.context-path=/zxjp