Merge remote-tracking branch 'origin/dev' into dev
commit
7fee5d9827
|
|
@ -7,6 +7,7 @@ import org.qinan.safetyeval.client.api.institution.EvalInternalReviewApi;
|
||||||
import org.qinan.safetyeval.client.co.institution.EvalInternalReviewCO;
|
import org.qinan.safetyeval.client.co.institution.EvalInternalReviewCO;
|
||||||
import org.qinan.safetyeval.client.co.institution.EvalInternalReviewDetailCO;
|
import org.qinan.safetyeval.client.co.institution.EvalInternalReviewDetailCO;
|
||||||
import org.qinan.safetyeval.client.dto.SingleResponse;
|
import org.qinan.safetyeval.client.dto.SingleResponse;
|
||||||
|
import org.qinan.safetyeval.client.dto.institution.EvalInternalReviewAssignCmd;
|
||||||
import org.qinan.safetyeval.client.dto.institution.EvalInternalReviewConfirmCmd;
|
import org.qinan.safetyeval.client.dto.institution.EvalInternalReviewConfirmCmd;
|
||||||
import org.qinan.safetyeval.client.dto.institution.EvalInternalReviewSaveCmd;
|
import org.qinan.safetyeval.client.dto.institution.EvalInternalReviewSaveCmd;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
|
@ -34,6 +35,12 @@ public class EvalInternalReviewController {
|
||||||
return evalInternalReviewApi.confirm(cmd);
|
return evalInternalReviewApi.confirm(cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*@ApiOperation("下发签字任务")
|
||||||
|
@PostMapping("/assign")
|
||||||
|
public SingleResponse<Void> assign(@Validated @RequestBody EvalInternalReviewAssignCmd cmd) {
|
||||||
|
return evalInternalReviewApi.assign(cmd);
|
||||||
|
}*/
|
||||||
|
|
||||||
/*@ApiOperation("按项目查询")
|
/*@ApiOperation("按项目查询")
|
||||||
@GetMapping("/get")
|
@GetMapping("/get")
|
||||||
public SingleResponse<EvalInternalReviewCO> get(@ApiParam("项目ID") @RequestParam Long projectId) {
|
public SingleResponse<EvalInternalReviewCO> get(@ApiParam("项目ID") @RequestParam Long projectId) {
|
||||||
|
|
@ -45,4 +52,6 @@ public class EvalInternalReviewController {
|
||||||
public SingleResponse<EvalInternalReviewDetailCO> detail(@ApiParam("项目ID") @RequestParam Long projectId) {
|
public SingleResponse<EvalInternalReviewDetailCO> detail(@ApiParam("项目ID") @RequestParam Long projectId) {
|
||||||
return evalInternalReviewApi.getDetailByProject(projectId);
|
return evalInternalReviewApi.getDetailByProject(projectId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
package org.qinan.safetyeval.app.executor.institution;
|
package org.qinan.safetyeval.app.executor.institution;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.qinan.safetyeval.app.executor.institution.support.EvalCmdCopy;
|
import org.qinan.safetyeval.app.executor.institution.support.EvalCmdCopy;
|
||||||
import org.qinan.safetyeval.app.executor.institution.support.EvalNodeCoConverter;
|
import org.qinan.safetyeval.app.executor.institution.support.EvalNodeCoConverter;
|
||||||
import org.qinan.safetyeval.app.executor.institution.support.EvalProjectNodeSupport;
|
import org.qinan.safetyeval.app.executor.institution.support.EvalProjectNodeSupport;
|
||||||
|
|
@ -8,6 +10,7 @@ import org.qinan.safetyeval.client.api.institution.EvalInternalReviewApi;
|
||||||
import org.qinan.safetyeval.client.co.institution.EvalInternalReviewCO;
|
import org.qinan.safetyeval.client.co.institution.EvalInternalReviewCO;
|
||||||
import org.qinan.safetyeval.client.co.institution.EvalInternalReviewDetailCO;
|
import org.qinan.safetyeval.client.co.institution.EvalInternalReviewDetailCO;
|
||||||
import org.qinan.safetyeval.client.dto.SingleResponse;
|
import org.qinan.safetyeval.client.dto.SingleResponse;
|
||||||
|
import org.qinan.safetyeval.client.dto.institution.EvalInternalReviewAssignCmd;
|
||||||
import org.qinan.safetyeval.client.dto.institution.EvalInternalReviewConfirmCmd;
|
import org.qinan.safetyeval.client.dto.institution.EvalInternalReviewConfirmCmd;
|
||||||
import org.qinan.safetyeval.client.dto.institution.EvalInternalReviewSaveCmd;
|
import org.qinan.safetyeval.client.dto.institution.EvalInternalReviewSaveCmd;
|
||||||
import org.qinan.safetyeval.client.item.request.EvalReviewItemAddCmd;
|
import org.qinan.safetyeval.client.item.request.EvalReviewItemAddCmd;
|
||||||
|
|
@ -27,6 +30,8 @@ import org.qinan.safetyeval.domain.item.model.EvalReviewItemE;
|
||||||
import org.qinan.safetyeval.domain.service.ProjectStageSyncService;
|
import org.qinan.safetyeval.domain.service.ProjectStageSyncService;
|
||||||
import org.qinan.safetyeval.domain.support.EvalNodeCodes;
|
import org.qinan.safetyeval.domain.support.EvalNodeCodes;
|
||||||
import org.qinan.safetyeval.infrastructure.convertor.EvalInternalReviewConvertor;
|
import org.qinan.safetyeval.infrastructure.convertor.EvalInternalReviewConvertor;
|
||||||
|
import org.qinan.safetyeval.infrastructure.dataobject.EvalInternalReviewDO;
|
||||||
|
import org.qinan.safetyeval.infrastructure.mapper.EvalInternalReviewMapper;
|
||||||
import org.qinan.safetyeval.infrastructure.persistence.queryservice.EvalReviewItemQueryService;
|
import org.qinan.safetyeval.infrastructure.persistence.queryservice.EvalReviewItemQueryService;
|
||||||
import org.qinan.safetyeval.infrastructure.support.NodeWriteAuthority;
|
import org.qinan.safetyeval.infrastructure.support.NodeWriteAuthority;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
@ -36,6 +41,9 @@ import javax.annotation.Resource;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import static org.qinan.safetyeval.domain.exception.ErrorCode.ASSIGN_SIGN_TASK;
|
||||||
|
import static org.qinan.safetyeval.domain.exception.ErrorCode.SIGN_TASK_NOT_COMPLETE;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class EvalInternalReviewExecutor implements EvalInternalReviewApi {
|
public class EvalInternalReviewExecutor implements EvalInternalReviewApi {
|
||||||
|
|
||||||
|
|
@ -55,6 +63,8 @@ public class EvalInternalReviewExecutor implements EvalInternalReviewApi {
|
||||||
private EvalReviewItemCmdConvertor evalReviewItemCmdConvertor;
|
private EvalReviewItemCmdConvertor evalReviewItemCmdConvertor;
|
||||||
@Resource
|
@Resource
|
||||||
private ProjectStageSyncService projectStageSyncService;
|
private ProjectStageSyncService projectStageSyncService;
|
||||||
|
@Resource
|
||||||
|
private EvalInternalReviewMapper evalInternalReviewMapper;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SingleResponse<EvalInternalReviewCO> getOrSave(EvalInternalReviewSaveCmd cmd) {
|
public SingleResponse<EvalInternalReviewCO> getOrSave(EvalInternalReviewSaveCmd cmd) {
|
||||||
|
|
@ -80,33 +90,41 @@ public class EvalInternalReviewExecutor implements EvalInternalReviewApi {
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public SingleResponse<Void> confirm(EvalInternalReviewConfirmCmd cmd) {
|
public SingleResponse<Void> confirm(EvalInternalReviewConfirmCmd cmd) {
|
||||||
Long projectId = Long.parseLong(cmd.getProjectId());
|
Long projectId = cmd.getProjectId();
|
||||||
EvalProjectEntity project = evalProjectNodeSupport.requireProject(projectId);
|
EvalProjectEntity project = evalProjectNodeSupport.requireProject(projectId);
|
||||||
|
|
||||||
// 判断项目是否归档
|
// 判断项目是否归档
|
||||||
if (project.getArchiveFlag() != null && project.getArchiveFlag() == 1) {
|
if (project.getArchiveFlag() != null && project.getArchiveFlag() == 1) {
|
||||||
throw new BizException(ErrorCode.EVAL_PROJECT_ARCHIVED);
|
throw new BizException(ErrorCode.EVAL_PROJECT_ARCHIVED);
|
||||||
}
|
}
|
||||||
|
|
||||||
EvalInternalReviewEntity entity = evalInternalReviewConvertor.applyConfirmCmd(cmd);
|
EvalInternalReviewEntity entity = evalInternalReviewConvertor.applyConfirmCmd(cmd);
|
||||||
|
EvalInternalReviewDO evalInternalReviewDO = null;
|
||||||
if (cmd.getId() != null) {
|
if (cmd.getId() != null) {
|
||||||
// id不为空,查询数据,查不到则抛异常
|
evalInternalReviewDO = evalInternalReviewMapper.selectOne(new LambdaQueryWrapper<EvalInternalReviewDO>()
|
||||||
entity = evalInternalReviewGateway.get(cmd.getId());
|
.select(EvalInternalReviewDO::getId, EvalInternalReviewDO::getReviewerSignatureUrl));
|
||||||
if (entity == null) {
|
if (evalInternalReviewDO == null) {
|
||||||
throw new BizException(ErrorCode.EVAL_INTERNAL_REVIEW_NOT_FOUND);
|
throw new BizException(ErrorCode.EVAL_INTERNAL_REVIEW_NOT_FOUND);
|
||||||
}
|
}
|
||||||
evalProjectNodeSupport.fillNodeStatus(entity.getStatusCode(), entity);
|
}
|
||||||
|
|
||||||
|
if (cmd.getResultCode().equals(EvalReviewEnum.PASSED.getCode())) {
|
||||||
|
if (evalInternalReviewDO == null) {
|
||||||
|
throw new BizException(ASSIGN_SIGN_TASK);
|
||||||
|
}
|
||||||
|
if (StringUtils.isBlank(evalInternalReviewDO.getReviewerSignatureUrl())) {
|
||||||
|
throw new BizException(SIGN_TASK_NOT_COMPLETE);
|
||||||
|
}
|
||||||
|
projectStageSyncService.onNodeCompleted(projectId, ProjectStageEnum.INTERNAL_REVIEW.getNode());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cmd.getId() != null) {
|
||||||
entity = evalInternalReviewGateway.modify(entity);
|
entity = evalInternalReviewGateway.modify(entity);
|
||||||
} else {
|
} else {
|
||||||
// id为空,新增数据
|
// id为空,新增数据
|
||||||
entity.setOrgId(project.getOrgId());
|
entity.setOrgId(project.getOrgId());
|
||||||
entity.setStatusCode(1);
|
|
||||||
evalProjectNodeSupport.fillNodeStatus(entity.getStatusCode(), entity);
|
|
||||||
entity = evalInternalReviewGateway.save(entity);
|
entity = evalInternalReviewGateway.save(entity);
|
||||||
}
|
}
|
||||||
if (cmd.getResultCode().equals(EvalReviewEnum.PASSED.getCode())) {
|
|
||||||
projectStageSyncService.onNodeCompleted(projectId, ProjectStageEnum.INTERNAL_REVIEW.getNode());
|
|
||||||
}
|
|
||||||
|
|
||||||
// 审核项:根据bizId和bizType先删后增
|
// 审核项:根据bizId和bizType先删后增
|
||||||
String bizType = ReviewDimensionEnum.TypeEnum.EVAL_INTERNAL_REVIEW.getCode();
|
String bizType = ReviewDimensionEnum.TypeEnum.EVAL_INTERNAL_REVIEW.getCode();
|
||||||
|
|
@ -120,6 +138,12 @@ public class EvalInternalReviewExecutor implements EvalInternalReviewApi {
|
||||||
return SingleResponse.success();
|
return SingleResponse.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public SingleResponse<Void> assign(EvalInternalReviewAssignCmd cmd) {
|
||||||
|
return SingleResponse.success();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SingleResponse<EvalInternalReviewCO> getByProject(Long projectId) {
|
public SingleResponse<EvalInternalReviewCO> getByProject(Long projectId) {
|
||||||
evalProjectNodeSupport.assertRead(projectId);
|
evalProjectNodeSupport.assertRead(projectId);
|
||||||
|
|
|
||||||
|
|
@ -3,12 +3,14 @@ package org.qinan.safetyeval.client.api.institution;
|
||||||
import org.qinan.safetyeval.client.co.institution.EvalInternalReviewCO;
|
import org.qinan.safetyeval.client.co.institution.EvalInternalReviewCO;
|
||||||
import org.qinan.safetyeval.client.co.institution.EvalInternalReviewDetailCO;
|
import org.qinan.safetyeval.client.co.institution.EvalInternalReviewDetailCO;
|
||||||
import org.qinan.safetyeval.client.dto.SingleResponse;
|
import org.qinan.safetyeval.client.dto.SingleResponse;
|
||||||
|
import org.qinan.safetyeval.client.dto.institution.EvalInternalReviewAssignCmd;
|
||||||
import org.qinan.safetyeval.client.dto.institution.EvalInternalReviewConfirmCmd;
|
import org.qinan.safetyeval.client.dto.institution.EvalInternalReviewConfirmCmd;
|
||||||
import org.qinan.safetyeval.client.dto.institution.EvalInternalReviewSaveCmd;
|
import org.qinan.safetyeval.client.dto.institution.EvalInternalReviewSaveCmd;
|
||||||
|
|
||||||
public interface EvalInternalReviewApi {
|
public interface EvalInternalReviewApi {
|
||||||
SingleResponse<EvalInternalReviewCO> getOrSave(EvalInternalReviewSaveCmd cmd);
|
SingleResponse<EvalInternalReviewCO> getOrSave(EvalInternalReviewSaveCmd cmd);
|
||||||
SingleResponse<Void> confirm(EvalInternalReviewConfirmCmd cmd);
|
SingleResponse<Void> confirm(EvalInternalReviewConfirmCmd cmd);
|
||||||
|
SingleResponse<Void> assign(EvalInternalReviewAssignCmd cmd);
|
||||||
SingleResponse<EvalInternalReviewCO> getByProject(Long projectId);
|
SingleResponse<EvalInternalReviewCO> getByProject(Long projectId);
|
||||||
SingleResponse<EvalInternalReviewDetailCO> getDetailByProject(Long projectId);
|
SingleResponse<EvalInternalReviewDetailCO> getDetailByProject(Long projectId);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,30 @@
|
||||||
|
package org.qinan.safetyeval.client.dto.institution;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
import org.qinan.safetyeval.client.item.request.EvalReviewItemAddCmd;
|
||||||
|
|
||||||
|
import javax.validation.Valid;
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
import javax.validation.constraints.Size;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class EvalInternalReviewAssignCmd {
|
||||||
|
|
||||||
|
@ApiModelProperty("id")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@ApiModelProperty("项目id")
|
||||||
|
private Long projectId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "内审人人员id")
|
||||||
|
private String reviewerPersonnelId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "内审人姓名", example = "2")
|
||||||
|
private String reviewerName;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "审核签字任务状态 dispatched 下发,non_dispatched 未下发", example = "non_dispatched")
|
||||||
|
private String reviewerSignatureTaskStatus;
|
||||||
|
}
|
||||||
|
|
@ -17,13 +17,13 @@ public class EvalInternalReviewConfirmCmd {
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
@ApiModelProperty("项目id")
|
@ApiModelProperty("项目id")
|
||||||
private String projectId;
|
private Long projectId;
|
||||||
|
|
||||||
@ApiModelProperty(value = "节点状态编码:1未开始 2进行中 3已完成 4退回", example = "2")
|
@ApiModelProperty(value = "节点状态编码:1未开始 2进行中 3已完成 4退回", example = "2")
|
||||||
private Integer statusCode;
|
private Integer statusCode;
|
||||||
|
|
||||||
@ApiModelProperty(value = "内审人人员id")
|
@ApiModelProperty(value = "内审人人员id")
|
||||||
private String reviewerPersonnelId;
|
private Long reviewerPersonnelId;
|
||||||
|
|
||||||
@ApiModelProperty(value = "内审人姓名", example = "2")
|
@ApiModelProperty(value = "内审人姓名", example = "2")
|
||||||
private String reviewerName;
|
private String reviewerName;
|
||||||
|
|
|
||||||
|
|
@ -114,6 +114,12 @@ public enum ErrorCode {
|
||||||
SMS_CODE_NOT_RIGHT("04-01-003", "验证码不正确"),
|
SMS_CODE_NOT_RIGHT("04-01-003", "验证码不正确"),
|
||||||
SMS_CODE_TOO_FREQUENT("04-01-004", "操作过于频繁,请稍后再试"),
|
SMS_CODE_TOO_FREQUENT("04-01-004", "操作过于频繁,请稍后再试"),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 内审
|
||||||
|
*/
|
||||||
|
ASSIGN_SIGN_TASK("04-02-001", "请先下发签字任务"),
|
||||||
|
SIGN_TASK_NOT_COMPLETE("04-02-002", "签字任务未完成"),
|
||||||
|
|
||||||
// gbs
|
// gbs
|
||||||
GBS_USER_ERROR("04-01-001", "gbs用户未登录"),
|
GBS_USER_ERROR("04-01-001", "gbs用户未登录"),
|
||||||
GBS_USER_SYNC_ERROR("04-01-002", "gbs用户同步错误"),
|
GBS_USER_SYNC_ERROR("04-01-002", "gbs用户同步错误"),
|
||||||
|
|
@ -121,6 +127,7 @@ public enum ErrorCode {
|
||||||
// ---- 消息中心 ----
|
// ---- 消息中心 ----
|
||||||
SAFETY_MESSAGE_NOT_FOUND("05-01-001", "消息不存在"),
|
SAFETY_MESSAGE_NOT_FOUND("05-01-001", "消息不存在"),
|
||||||
|
|
||||||
|
|
||||||
// ---- 机构端安评(phase2 eval) ----
|
// ---- 机构端安评(phase2 eval) ----
|
||||||
EVAL_CUSTOMER_NOT_FOUND("06-01-001", "安评客户不存在"),
|
EVAL_CUSTOMER_NOT_FOUND("06-01-001", "安评客户不存在"),
|
||||||
EVAL_PROJECT_NOT_FOUND("06-02-001", "安评项目不存在"),
|
EVAL_PROJECT_NOT_FOUND("06-02-001", "安评项目不存在"),
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ import org.mapstruct.Mapping;
|
||||||
import org.mapstruct.MappingTarget;
|
import org.mapstruct.MappingTarget;
|
||||||
import org.qinan.safetyeval.client.co.institution.EvalInternalReviewCO;
|
import org.qinan.safetyeval.client.co.institution.EvalInternalReviewCO;
|
||||||
import org.qinan.safetyeval.client.co.institution.EvalProjectMemberCO;
|
import org.qinan.safetyeval.client.co.institution.EvalProjectMemberCO;
|
||||||
|
import org.qinan.safetyeval.client.dto.institution.EvalInternalReviewAssignCmd;
|
||||||
import org.qinan.safetyeval.client.dto.institution.EvalInternalReviewConfirmCmd;
|
import org.qinan.safetyeval.client.dto.institution.EvalInternalReviewConfirmCmd;
|
||||||
import org.qinan.safetyeval.domain.entity.EvalInternalReviewEntity;
|
import org.qinan.safetyeval.domain.entity.EvalInternalReviewEntity;
|
||||||
import org.qinan.safetyeval.domain.entity.EvalProjectMemberEntity;
|
import org.qinan.safetyeval.domain.entity.EvalProjectMemberEntity;
|
||||||
|
|
@ -26,14 +27,7 @@ public interface EvalInternalReviewConvertor {
|
||||||
/**
|
/**
|
||||||
* 将 ConfirmCmd 转换为新的 entity(projectId、reviewerPersonnelId 由 String 转 Long)。
|
* 将 ConfirmCmd 转换为新的 entity(projectId、reviewerPersonnelId 由 String 转 Long)。
|
||||||
*/
|
*/
|
||||||
@Mapping(target = "projectId", expression = "java(cmd.getProjectId() == null ? null : Long.parseLong(cmd.getProjectId()))")
|
|
||||||
@Mapping(target = "reviewerPersonnelId", expression = "java(cmd.getReviewerPersonnelId() == null ? null : Long.parseLong(cmd.getReviewerPersonnelId()))")
|
|
||||||
EvalInternalReviewEntity applyConfirmCmd(EvalInternalReviewConfirmCmd cmd);
|
EvalInternalReviewEntity applyConfirmCmd(EvalInternalReviewConfirmCmd cmd);
|
||||||
|
|
||||||
/**
|
|
||||||
* 将 ConfirmCmd 中的字段拷贝到 entity(projectId、reviewerPersonnelId 由 String 转 Long)。
|
|
||||||
*/
|
|
||||||
@Mapping(target = "projectId", expression = "java(cmd.getProjectId() == null ? null : Long.parseLong(cmd.getProjectId()))")
|
|
||||||
@Mapping(target = "reviewerPersonnelId", expression = "java(cmd.getReviewerPersonnelId() == null ? null : Long.parseLong(cmd.getReviewerPersonnelId()))")
|
|
||||||
void applyConfirmCmd(EvalInternalReviewConfirmCmd cmd, @MappingTarget EvalInternalReviewEntity entity);
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue