Commit 085848f7 authored by chenyuxi's avatar chenyuxi

feat: 允许跳过节点系统自动审核

parent 5e6bc517
......@@ -132,6 +132,7 @@ public abstract class AbastractAuditProcess<T,E extends T> {
// 节点是否允许跳过(0:不允许,1允许)
Integer isPass = CommonConstants.ZERO_INT;
for (TNodePrimission nodePrimission : nodePrimissionList) {
isPass = CommonConstants.ZERO_INT;
// 审核用户改造; 3指定用户;5指定角色(crm)
if (CommonConstants.THREE_INT == nodePrimission.getType().intValue()
|| CommonConstants.TWO_INT == nodePrimission.getType().intValue()
......@@ -145,13 +146,10 @@ public abstract class AbastractAuditProcess<T,E extends T> {
}
// 事业部条线没有审批人直接审核通过,配置了可以跳过
// if(Common.isEmpty(sysUserList) && CommonConstants.ONE_STRING.equals(nodePrimission.getIsPass())){
//// // 标记节点可以跳过
//// isPass = CommonConstants.ONE_INT;
//// // 系统自动给当前节点完成审核,将审核通过
//// sysAutoAudit(processVo,currentProcessNode,departId,auditType,entityId,entity);
//// } else {
if(Common.isEmpty(sysUserList) && CommonConstants.ONE_STRING.equals(nodePrimission.getIsPass())){
// 系统自动给当前节点完成审核,将审核通过
return sysAutoAudit(processVo,currentProcessNode,departId,auditType,entityId,entity);
} else {
if (Common.isEmpty(sysUserList)) {
throw new CheckedException("未找到审批用户");
}
......@@ -187,8 +185,7 @@ public abstract class AbastractAuditProcess<T,E extends T> {
auditRecordService.save(newEntity);
}
//}
}
}
// 事业部条线没有审批人直接审核通过,配置了可以跳过
if(Common.isEmpty(sysUserList) && isPass == CommonConstants.ONE_INT){
......@@ -609,7 +606,7 @@ public abstract class AbastractAuditProcess<T,E extends T> {
* @param entity 实体类:用于审核通过逻辑
* @return R<String>
**/
private void sysAutoAudit(ProcessVo processVo,TProcessNode currentProcessNode,String departId, String auditType,
private List<SysUser> sysAutoAudit(ProcessVo processVo,TProcessNode currentProcessNode,String departId, String auditType,
String entityId,T entity) {
// 新增自动审核通过记录
TAuditRecord newEntity = new TAuditRecord();
......@@ -617,8 +614,9 @@ public abstract class AbastractAuditProcess<T,E extends T> {
newEntity.setFlowId(currentProcessNode.getProcessId());
newEntity.setNodeId(currentProcessNode.getId());
newEntity.setApprovalMan(CommonConstants.ONE_STRING);
newEntity.setApprovalManName("系统");
newEntity.setApprovalManName("审核人为空,系统默认审核通过");
newEntity.setApprovalOpinion("审核人为空,默认审核通过");
newEntity.setApprovalTime(LocalDateTime.now());
newEntity.setDeleteFlag(CommonConstants.NOT_DELETE_FLAG);
newEntity.setPreFlag(CommonConstants.ONE_STRING);
newEntity.setApprovalResult(CommonConstants.ZERO_STRING);
......@@ -644,36 +642,39 @@ public abstract class AbastractAuditProcess<T,E extends T> {
// 获取流程配置信息
TProcessNode endProcessNode = ProcessAuditUtil.getEndProcessNode(processVo);
if (endProcessNode == null) {
log.error("系统自动审核,未获取到结束节点");
return;
throw new CheckedException("系统自动审核,未获取到结束节点");
}
TProcessNode preEndProcessNode = ProcessAuditUtil.getPreEndTProcessNode(processVo, endProcessNode);
if (preEndProcessNode == null) {
log.error("系统自动审核,未找到结束节点前一个节点");
return;
throw new CheckedException("系统自动审核,未找到结束节点前一个节点");
}
// 当前是结束节点前的一个节点
if (StringUtils.equals(preEndProcessNode.getId(), newEntity.getNodeId())) {
// 直接最终审核通过
auditSuccess(entity, newEntity, null);
return null;
} else {
TProcessNode nextProcessNode = getNextNode(processVo, currentProcessNode.getLogoTitle(), entityId, auditType, entity, null);
if (nextProcessNode == null) {
throw new CheckedException(NEXT_AUDIT_NODE_NOT_FOUND);
// 未找到下一个审核节点,删除系统自动审核的记录
auditRecordService.removeById(newEntity.getId());
throw new CheckedException("未找到系统自动审核后,下一个审批节点,请联系管理员");
}
// 如果返回的是end节点:判断是不是返回的是不是主流程结束节点
if (StringUtils.equals(ProcessConstants.PROCESS_NODE_END, nextProcessNode.getType())
&& StringUtils.equals(currentProcessNode.getProcessId(), nextProcessNode.getProcessId())) {
// 直接最终审核通过
auditSuccess(entity, newEntity, null);
return null;
}
// 获取下个审批用户
List<SysUser> remoteSysUserList = getAuditUseListByProcessNode(processVo,nextProcessNode, departId, entityId, auditType, entity, newEntity);
if (Common.isEmpty(remoteSysUserList)) {
throw new CheckedException(NEXT_NODE_USER_NULL);
// 未找到下一个审核节点,删除系统自动审核的记录
auditRecordService.removeById(newEntity.getId());
throw new CheckedException("未找到系统自动审核后,下个节点的审批用户");
}
// // 流程中的审核结束,继续下一个节点
// auditSuccessAndNex(entity, remoteSysUserList, newEntity);
return remoteSysUserList;
}
}
......
......@@ -525,7 +525,7 @@ public class TInsuranceUnpurchaseApplyServiceImpl extends ServiceImpl<TInsurance
if(Common.isEmpty(entity.getCreateUserDeptId())){
return R.failed("申请人所属部门id不能为空");
}
// todo 传:流程类型 1不购买商险申请;审核类型 0不购买商险审核
// 传:流程类型 1不购买商险申请;审核类型 0不购买商险审核
R<List<SysUser>> auditUserListR = tInsuranceUnpurchaseApplyAuditProcess.getAuditUserList(id, user, entity.getCreateUserDeptId(),
CommonConstants.ONE_STRING, CommonConstants.ZERO_STRING,
"", entity.getApplyNo(), entity, TInsuranceUnpurchaseApply.class);
......
......@@ -227,7 +227,6 @@ public class TInsuranceUnpurchaseApplyAuditProcess extends AbastractAuditProcess
String authUrl = null;
Map<String, Object> textcard = new HashMap<>();
authUrl = String.format(SecurityConstants.WX_GET_MESSAGE_AUTH_URL, wxConfig.getCorpid(), "https://test-wx.worfu.com/auth/oauth/wxLogin", "01"+insuranceUnpurchaseApply.getId());
textcard.put("title", "含风险项目不购买商险申请");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment