Commit d0b237d0 by zhiwj

自动审批

parent 84c46ab8
......@@ -95,6 +95,7 @@ public class AuditLogApiServiceImpl implements AuditLogApiService {
if (projectItem == null) {
return EnterpriseServiceResponse.failure(ErrorCode.NOTEXISTS);
}
auditLogDTO.setProjectItemId(projectItem.getProjectItemId());
auditLogDTO.setProjectItemName(projectItem.getProjectItemName());
// 判断申请人是否存在
......@@ -104,21 +105,29 @@ public class AuditLogApiServiceImpl implements AuditLogApiService {
}
auditLogDTO.setApplyUserName(userServiceResponse.getResult().getUserName());
auditLogDTO.setApplyUserPhone(userServiceResponse.getResult().getPhoneNumber());
// 判断有没有审核员, 没有审核员就返回错误
// 如果审批项是被禁用的 直接通过
if (projectItem.getUseStatus() == 0 || userServiceResponse.getResult().getSuperAdmin() == 1) {
String extraInfo = auditLogDTO.getExtraInfo();
JSONObject jsonObject = JSON.parseObject(extraInfo);
jsonObject.put("auditResult", DataSecurityAuditEnum.PASS.getCode());
String[] callback = projectItem.getCallbackUrl().split(GlobalInfo.FLAG_COMMA);
AsyncCallbackUtils.callBack(jsonObject, callback[0], callback[1]);
return EnterpriseServiceResponse.success();
}
// 判断有没有审核员, 没有审核员就返回错误
ServiceResponse<List<AuditorDTO>> auditorResponse = auditorApiService.listAuditorByProject(auditLogDTO.getProjectItemId(), auditLogDTO.getApplyUserId(), auditLogDTO.getEnterpriseId());
List<AuditorDTO> auditorList = Collections.emptyList();
if (userServiceResponse.getResult().getSuperAdmin() == 0) {
// 普通管理员需要判断是否有审核员
if (!auditorResponse.isSuccess()) {
return EnterpriseServiceResponse.failure(auditorResponse.getCode(), auditorResponse.getMessage());
}
auditorList = auditorResponse.getResult();
List<AuditorDTO> openidList = auditorList.stream().filter(e -> StringUtils.isNotBlank(e.getOpenid())).collect(Collectors.toList());
List<AuditorDTO> userIdList = auditorList.stream().filter(e -> e.getUserId() != null).collect(Collectors.toList());
if (CollectionUtils.isEmpty(openidList) && CollectionUtils.isEmpty(userIdList)) {
return EnterpriseServiceResponse.failure(ErrorCode.OPERATION_FAILED.getCode(), "审核员没有绑定微信或管理员");
}
// 普通管理员需要判断是否有审核员
if (!auditorResponse.isSuccess()) {
return EnterpriseServiceResponse.failure(auditorResponse.getCode(), auditorResponse.getMessage());
}
auditorList = auditorResponse.getResult();
List<AuditorDTO> openidList = auditorList.stream().filter(e -> StringUtils.isNotBlank(e.getOpenid())).collect(Collectors.toList());
List<AuditorDTO> userIdList = auditorList.stream().filter(e -> e.getUserId() != null).collect(Collectors.toList());
if (CollectionUtils.isEmpty(openidList) && CollectionUtils.isEmpty(userIdList)) {
return EnterpriseServiceResponse.failure(ErrorCode.OPERATION_FAILED.getCode(), "审核员没有绑定微信或管理员");
}
// 判断审批项是否禁用
if (Constants.DEL_STATUS.equals(projectItem.getUseStatus())) {
......@@ -174,20 +183,20 @@ public class AuditLogApiServiceImpl implements AuditLogApiService {
// sendWxMessage();
}
// 如果申请人是超管 自动审批
if (userServiceResponse.getResult().getSuperAdmin() == 1) {
AuditLogDTO autoAudit = new AuditLogDTO();
autoAudit.setEnterpriseId(auditLogDTO.getEnterpriseId());
autoAudit.setApplyUserId(auditLogDTO.getApplyUserId());
autoAudit.setAuditorId(auditLogDTO.getApplyUserId());
autoAudit.setAuditResult(DataSecurityAuditEnum.PASS.getCode());
autoAudit.setAuditorPhone(auditLogDTO.getApplyUserPhone());
autoAudit.setAuditorName(auditLogDTO.getAuditorName());
autoAudit.setAuditLogId(auditLogId);
autoAudit.setAuditReason("自动审批");
this.audit(autoAudit);
}
// // 如果申请人是超管 自动审批
// if (userServiceResponse.getResult().getSuperAdmin() == 1) {
// AuditLogDTO autoAudit = new AuditLogDTO();
// autoAudit.setEnterpriseId(auditLogDTO.getEnterpriseId());
// autoAudit.setApplyUserId(auditLogDTO.getApplyUserId());
// autoAudit.setAuditorId(auditLogDTO.getApplyUserId());
// autoAudit.setAuditResult(DataSecurityAuditEnum.PASS.getCode());
// autoAudit.setAuditorPhone(auditLogDTO.getApplyUserPhone());
// autoAudit.setAuditorName(auditLogDTO.getAuditorName());
// autoAudit.setAuditLogId(auditLogId);
// autoAudit.setAuditReason("自动审批");
// this.audit(autoAudit);
//
// }
return EnterpriseServiceResponse.success();
......
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