Commit 3952fee8 by zhiwj

修改sql

parent 4e6975f9
......@@ -37,6 +37,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Collections;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
......@@ -104,17 +105,21 @@ public class AuditLogApiServiceImpl implements AuditLogApiService {
auditLogDTO.setApplyUserName(userServiceResponse.getResult().getUserName());
auditLogDTO.setApplyUserPhone(userServiceResponse.getResult().getPhoneNumber());
// 判断有没有审核员, 没有审核员就返回错误
ServiceResponse<List<AuditorDTO>> auditorResponse = auditorApiService.listAuditorByProject(auditLogDTO.getProjectItemId(), auditLogDTO.getApplyUserId(), auditLogDTO.getEnterpriseId());
if (!auditorResponse.isSuccess()) {
return EnterpriseServiceResponse.failure(auditorResponse.getCode(), auditorResponse.getMessage());
}
List<AuditorDTO> 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(), "审核员没有绑定微信或管理员");
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 (Constants.DEL_STATUS.equals(projectItem.getUseStatus())) {
return EnterpriseServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "该审批项已被禁用");
......@@ -169,6 +174,21 @@ 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.setAuditReason("自动审批");
this.audit(autoAudit);
}
return EnterpriseServiceResponse.success();
}
......@@ -176,7 +196,7 @@ public class AuditLogApiServiceImpl implements AuditLogApiService {
@Transactional(rollbackFor = Exception.class)
public ServiceResponse<AuditLogDTO> audit(AuditLogDTO auditLogDTO) {
// 完成待办事项
todoItemApiService.finishTodoItem(auditLogDTO.getEnterpriseId(), auditLogDTO.getAuditorId(), com.gic.enterprise.constant.Constants.TODO_ITEM_AUDIT, "www.baidu.com?auditLogId=" + auditLogDTO.getAuditLogId());
todoItemApiService.finishTodoItem(auditLogDTO.getEnterpriseId(), auditLogDTO.getAuditorId(), com.gic.enterprise.constant.Constants.TODO_ITEM_AUDIT, com.gic.enterprise.constant.Constants.TODO_ITEM_AUDIT_URL + "?auditLogId=" + auditLogDTO.getAuditLogId());
TabAuditLog auditLog = this.auditLogService.getAuditById(auditLogDTO.getAuditLogId());
if (auditLog == null) {
......
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