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

dev
zhanglei 2026-07-22 18:23:59 +08:00
commit 7fee5d9827
7 changed files with 87 additions and 21 deletions

View File

@ -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.EvalInternalReviewDetailCO;
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.EvalInternalReviewSaveCmd;
import org.springframework.validation.annotation.Validated;
@ -34,6 +35,12 @@ public class EvalInternalReviewController {
return evalInternalReviewApi.confirm(cmd);
}
/*@ApiOperation("下发签字任务")
@PostMapping("/assign")
public SingleResponse<Void> assign(@Validated @RequestBody EvalInternalReviewAssignCmd cmd) {
return evalInternalReviewApi.assign(cmd);
}*/
/*@ApiOperation("按项目查询")
@GetMapping("/get")
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) {
return evalInternalReviewApi.getDetailByProject(projectId);
}
}

View File

@ -1,5 +1,7 @@
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.EvalNodeCoConverter;
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.EvalInternalReviewDetailCO;
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.EvalInternalReviewSaveCmd;
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.support.EvalNodeCodes;
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.support.NodeWriteAuthority;
import org.springframework.stereotype.Service;
@ -36,6 +41,9 @@ import javax.annotation.Resource;
import java.util.List;
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
public class EvalInternalReviewExecutor implements EvalInternalReviewApi {
@ -55,6 +63,8 @@ public class EvalInternalReviewExecutor implements EvalInternalReviewApi {
private EvalReviewItemCmdConvertor evalReviewItemCmdConvertor;
@Resource
private ProjectStageSyncService projectStageSyncService;
@Resource
private EvalInternalReviewMapper evalInternalReviewMapper;
@Override
public SingleResponse<EvalInternalReviewCO> getOrSave(EvalInternalReviewSaveCmd cmd) {
@ -80,33 +90,41 @@ public class EvalInternalReviewExecutor implements EvalInternalReviewApi {
@Override
@Transactional(rollbackFor = Exception.class)
public SingleResponse<Void> confirm(EvalInternalReviewConfirmCmd cmd) {
Long projectId = Long.parseLong(cmd.getProjectId());
Long projectId = cmd.getProjectId();
EvalProjectEntity project = evalProjectNodeSupport.requireProject(projectId);
// 判断项目是否归档
if (project.getArchiveFlag() != null && project.getArchiveFlag() == 1) {
throw new BizException(ErrorCode.EVAL_PROJECT_ARCHIVED);
}
EvalInternalReviewEntity entity = evalInternalReviewConvertor.applyConfirmCmd(cmd);
EvalInternalReviewDO evalInternalReviewDO = null;
if (cmd.getId() != null) {
// id不为空查询数据查不到则抛异常
entity = evalInternalReviewGateway.get(cmd.getId());
if (entity == null) {
evalInternalReviewDO = evalInternalReviewMapper.selectOne(new LambdaQueryWrapper<EvalInternalReviewDO>()
.select(EvalInternalReviewDO::getId, EvalInternalReviewDO::getReviewerSignatureUrl));
if (evalInternalReviewDO == null) {
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);
} else {
// id为空新增数据
entity.setOrgId(project.getOrgId());
entity.setStatusCode(1);
evalProjectNodeSupport.fillNodeStatus(entity.getStatusCode(), entity);
entity = evalInternalReviewGateway.save(entity);
}
if (cmd.getResultCode().equals(EvalReviewEnum.PASSED.getCode())) {
projectStageSyncService.onNodeCompleted(projectId, ProjectStageEnum.INTERNAL_REVIEW.getNode());
}
// 审核项根据bizId和bizType先删后增
String bizType = ReviewDimensionEnum.TypeEnum.EVAL_INTERNAL_REVIEW.getCode();
@ -120,6 +138,12 @@ public class EvalInternalReviewExecutor implements EvalInternalReviewApi {
return SingleResponse.success();
}
@Override
@Transactional(rollbackFor = Exception.class)
public SingleResponse<Void> assign(EvalInternalReviewAssignCmd cmd) {
return SingleResponse.success();
}
@Override
public SingleResponse<EvalInternalReviewCO> getByProject(Long projectId) {
evalProjectNodeSupport.assertRead(projectId);

View File

@ -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.EvalInternalReviewDetailCO;
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.EvalInternalReviewSaveCmd;
public interface EvalInternalReviewApi {
SingleResponse<EvalInternalReviewCO> getOrSave(EvalInternalReviewSaveCmd cmd);
SingleResponse<Void> confirm(EvalInternalReviewConfirmCmd cmd);
SingleResponse<Void> assign(EvalInternalReviewAssignCmd cmd);
SingleResponse<EvalInternalReviewCO> getByProject(Long projectId);
SingleResponse<EvalInternalReviewDetailCO> getDetailByProject(Long projectId);
}

View File

@ -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;
}

View File

@ -17,13 +17,13 @@ public class EvalInternalReviewConfirmCmd {
private Long id;
@ApiModelProperty("项目id")
private String projectId;
private Long projectId;
@ApiModelProperty(value = "节点状态编码1未开始 2进行中 3已完成 4退回", example = "2")
private Integer statusCode;
@ApiModelProperty(value = "内审人人员id")
private String reviewerPersonnelId;
private Long reviewerPersonnelId;
@ApiModelProperty(value = "内审人姓名", example = "2")
private String reviewerName;

View File

@ -114,6 +114,12 @@ public enum ErrorCode {
SMS_CODE_NOT_RIGHT("04-01-003", "验证码不正确"),
SMS_CODE_TOO_FREQUENT("04-01-004", "操作过于频繁,请稍后再试"),
/**
*
*/
ASSIGN_SIGN_TASK("04-02-001", "请先下发签字任务"),
SIGN_TASK_NOT_COMPLETE("04-02-002", "签字任务未完成"),
// gbs
GBS_USER_ERROR("04-01-001", "gbs用户未登录"),
GBS_USER_SYNC_ERROR("04-01-002", "gbs用户同步错误"),
@ -121,6 +127,7 @@ public enum ErrorCode {
// ---- 消息中心 ----
SAFETY_MESSAGE_NOT_FOUND("05-01-001", "消息不存在"),
// ---- 机构端安评phase2 eval ----
EVAL_CUSTOMER_NOT_FOUND("06-01-001", "安评客户不存在"),
EVAL_PROJECT_NOT_FOUND("06-02-001", "安评项目不存在"),

View File

@ -5,6 +5,7 @@ import org.mapstruct.Mapping;
import org.mapstruct.MappingTarget;
import org.qinan.safetyeval.client.co.institution.EvalInternalReviewCO;
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.domain.entity.EvalInternalReviewEntity;
import org.qinan.safetyeval.domain.entity.EvalProjectMemberEntity;
@ -26,14 +27,7 @@ public interface EvalInternalReviewConvertor {
/**
* ConfirmCmd entityprojectIdreviewerPersonnelId 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);
/**
* ConfirmCmd entityprojectIdreviewerPersonnelId 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);
}