Commit a2bf095e by guojuxing

Merge remote-tracking branch 'origin/developer' into developer

parents fe5cad41 af661c66
package com.gic.enterprise.dto;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.Date;
......@@ -14,9 +12,6 @@ import java.util.Date;
public class ProjectItemDTO implements Serializable {
private static final long serialVersionUID = -394928332987419164L;
public interface SaveValid{
}
/**
*
......@@ -26,36 +21,30 @@ public class ProjectItemDTO implements Serializable {
/**
* 审批项名称
*/
@NotBlank(message = "审批项名称不能为空", groups = SaveValid.class)
private String projectItemName;
/**
* 审批项code
*/
@NotBlank(message = "审批项code不能为空", groups = SaveValid.class)
private String projectItemCode;
/**
* 审批项描述
*/
@NotBlank(message = "审批项描述不能为空", groups = SaveValid.class)
private String projectItemDesc;
/**
* 项目id
*/
@NotNull(message = "项目id不能为空", groups = SaveValid.class)
private Integer projectId;
/**
* 回调地址
*/
@NotBlank(message = "回调地址不能为空", groups = SaveValid.class)
private String callbackUrl;
/**
* 使用状态 1:可用 0:禁用
*/
@NotNull(message = "使用状态不能为空", groups = SaveValid.class)
private Integer useStatus;
/**
......@@ -68,19 +57,16 @@ public class ProjectItemDTO implements Serializable {
*/
private Date updateTime;
@NotBlank(message = "是否为平台项目不能为空", groups = SaveValid.class)
private Integer isPlatform;
/**
* 审核截止时长 单位:天
*/
@NotNull(message = "审核截止时间不能为空", groups = SaveValid.class)
private Integer auditExpireDuration;
/**
* 审批模板类型 0:普通审批项, 1:风险模式审批, 2:导出完整数据
*/
@NotNull(message = "审批模板类型不能为空", groups = SaveValid.class)
private Integer auditTemplateType;
public Integer getProjectItemId() {
......
package com.gic.enterprise.qo;
import com.gic.enterprise.dto.ProjectItemDTO;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.util.Date;
import java.util.List;
/**
......@@ -17,80 +12,49 @@ public class ProjectItemQO extends PageQO {
private static final long serialVersionUID = 1218293562538399805L;
public interface SaveValid{
}
public interface DelValid{
}
public interface ListValid{
}
/**
*
*/
@NotNull(message = "审批项id不能为空", groups = {DelValid.class})
private Integer projectItemId;
/**
* 审批项名称
*/
@org.hibernate.validator.constraints.NotBlank(message = "审批项名称不能为空", groups = {SaveValid.class})
private String projectItemName;
@NotBlank(message = "审批项code不能为空", groups = ProjectItemDTO.SaveValid.class)
private String projectItemCode;
/**
* 审批项描述
*/
@org.hibernate.validator.constraints.NotBlank(message = "审批项描述不能为空", groups = {SaveValid.class})
private String projectItemDesc;
/**
* 项目id
*/
@NotNull(message = "项目id不能为空", groups = {SaveValid.class, ListValid.class})
private Integer projectId;
/**
* 回调地址
*/
@org.hibernate.validator.constraints.NotBlank(message = "回调地址不能为空", groups = {SaveValid.class})
private String callbackUrl;
/**
* 使用状态 1:可用 0:禁用
*/
@NotNull(message = "使用状态不能为空", groups = {SaveValid.class})
private Integer useStatus;
/**
*
*/
private Date createTime;
/**
*
*/
private Date updateTime;
private String search;
@NotBlank(message = "是否为平台项目不能为空", groups = ProjectItemDTO.SaveValid.class)
private Integer isPlatform;
/**
* 审核截止时长 单位:天
*/
@NotNull(message = "审核截止时间不能为空", groups = ProjectItemDTO.SaveValid.class)
private Integer auditExpireDuration;
/**
* 审批模板类型 0:普通审批项, 1:风险模式审批, 2:导出完整数据
*/
@NotNull(message = "审批模板类型不能为空", groups = ProjectItemDTO.SaveValid.class)
private Integer auditTemplateType;
private List<Integer> projectItemList;
......@@ -151,22 +115,6 @@ public class ProjectItemQO extends PageQO {
this.useStatus = useStatus;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
public String getSearch() {
return search;
}
......
......@@ -12,13 +12,7 @@ import javax.validation.constraints.NotNull;
public class ProjectQO extends PageQO {
private static final long serialVersionUID = -3584081588337122486L;
public interface SaveValid {}
public interface DelValid {}
@NotNull(message = "项目id不能为空", groups = DelValid.class)
private Integer projectId;
@org.hibernate.validator.constraints.NotBlank(message = "项目名称不能为空", groups = SaveValid.class)
private String projectName;
public Integer getProjectId() {
......
......@@ -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();
......
package com.gic.operation.web.controller;
import com.alibaba.fastjson.JSON;
import com.gic.api.base.commons.Page;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.commons.util.EntityUtil;
import com.gic.commons.webapi.reponse.RestResponse;
import com.gic.enterprise.dto.ProjectDTO;
import com.gic.enterprise.qo.PageQO;
import com.gic.enterprise.qo.ProjectQO;
import com.gic.enterprise.service.ProjectApiService;
import com.gic.enterprise.utils.ResultControllerUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
......@@ -28,14 +25,14 @@ public class ProjectController {
private ProjectApiService projectApiService;
@RequestMapping("/save-project")
public RestResponse saveOrUpdateProject(@Validated(ProjectQO.SaveValid.class) ProjectQO projectQO) {
public RestResponse saveOrUpdateProject(ProjectQO projectQO) {
ProjectDTO projectDTO = EntityUtil.changeEntityByJSON(ProjectDTO.class, projectQO);
ServiceResponse<Integer> serviceResponse = projectApiService.saveOrUpdateProject(projectDTO);
return ResultControllerUtils.commonResult(serviceResponse);
}
@RequestMapping("/del-project")
public RestResponse delProject(@Validated(ProjectQO.DelValid.class) ProjectQO projectQO) {
public RestResponse delProject(ProjectQO projectQO) {
ServiceResponse<Integer> serviceResponse = projectApiService.delProject(projectQO.getProjectId());
return ResultControllerUtils.commonResult(serviceResponse);
}
......
......@@ -9,7 +9,6 @@ import com.gic.enterprise.qo.ProjectItemQO;
import com.gic.enterprise.service.ProjectItemApiService;
import com.gic.enterprise.utils.ResultControllerUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
......@@ -26,20 +25,20 @@ public class ProjectItemController {
private ProjectItemApiService projectItemApiService;
@RequestMapping("/save-project-item")
public RestResponse saveProjectItem(@Validated({ProjectItemQO.SaveValid.class}) ProjectItemQO projectItemQO) {
public RestResponse saveProjectItem(ProjectItemQO projectItemQO) {
ProjectItemDTO projectItemDTO = EntityUtil.changeEntityByJSON(ProjectItemDTO.class, projectItemQO);
ServiceResponse<Integer> serviceResponse = projectItemApiService.saveOrUpdateProjectItem(projectItemDTO);
return ResultControllerUtils.commonResult(serviceResponse);
}
@RequestMapping("/del-project-item")
public RestResponse delProjectItem(@Validated({ProjectItemQO.DelValid.class}) ProjectItemQO projectItemQO) {
public RestResponse delProjectItem(ProjectItemQO projectItemQO) {
ServiceResponse<Integer> serviceResponse = projectItemApiService.delProjectItem(projectItemQO.getProjectItemId());
return ResultControllerUtils.commonResult(serviceResponse);
}
@RequestMapping("/list-project-item")
public RestResponse listProjectItem(@Validated({ProjectItemQO.ListValid.class}) ProjectItemQO projectItemQO) {
public RestResponse listProjectItem(ProjectItemQO projectItemQO) {
ServiceResponse<Page<ProjectItemDTO>> serviceResponse = projectItemApiService.listProjectItem(projectItemQO);
return ResultControllerUtils.commonResult(serviceResponse);
}
......
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