fix: 项目建立附件填充

dev-tmp1
zhanglei 2026-08-28 14:12:58 +08:00
parent 2198ebdeaa
commit e324393020
5 changed files with 52 additions and 2 deletions

View File

@ -3,21 +3,29 @@ package org.qinan.safetyeval.adapter.web.institution;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
import org.qinan.safetyeval.client.api.institution.EvalProjectMemberApi;
import org.qinan.safetyeval.client.api.institution.EvalRiskAnalysisApi;
import org.qinan.safetyeval.client.api.institution.EvalSurveyAttachApi;
import org.qinan.safetyeval.client.co.institution.EvalProjectMemberCO;
import org.qinan.safetyeval.client.co.institution.EvalRiskParticipantCO;
import org.qinan.safetyeval.client.co.institution.EvalSurveyAttachCO;
import org.qinan.safetyeval.client.dto.PageResponse;
import org.qinan.safetyeval.client.dto.SingleResponse;
import org.qinan.safetyeval.client.dto.institution.EvalProjectMemberAddCmd;
import org.qinan.safetyeval.client.dto.institution.EvalProjectMemberPageQuery;
import org.qinan.safetyeval.client.dto.institution.EvalRiskParticipantSaveCmd;
import org.qinan.safetyeval.client.dto.institution.EvalSurveyAttachSaveCmd;
import org.qinan.safetyeval.domain.constant.ProjectDocumentEnum;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.CollectionUtils;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
@Slf4j
@Api(tags = "机构端-安评项目成员")
@RestController
@RequestMapping("/safetyEval/institution/eval-project-member")
@ -27,6 +35,8 @@ public class EvalProjectMemberController {
private EvalProjectMemberApi evalProjectMemberApi;
@Resource
private EvalRiskAnalysisApi evalRiskAnalysisApi;
@Autowired
private EvalSurveyAttachApi evalSurveyAttachApi;
@ApiOperation("保存成员(id空新增/非空修改)")
@ -57,4 +67,22 @@ public class EvalProjectMemberController {
@ApiParam("projectId") @RequestParam String projectId) {
return evalRiskAnalysisApi.listParticipantsMember(projectId);
}
//////////////////////////////////项目组成员附件
@ApiOperation("保存项目成立附件")
@PostMapping("/saveProjectEstablishedAttach")
public SingleResponse<Boolean> saveProjectEstablishedAttach(@Validated @RequestBody EvalSurveyAttachSaveCmd cmdList) {
return evalSurveyAttachApi.saveProjectEstablishedAttach(cmdList);
}
@ApiOperation("按项目查询项目成立附件列表")
@GetMapping("/getProjectEstablishedAttach")
public SingleResponse<EvalSurveyAttachCO> getProjectEstablishedAttach(@ApiParam("项目ID") @RequestParam String projectId) {
SingleResponse<List<EvalSurveyAttachCO>> listSingleResponse = evalSurveyAttachApi.listByProject(Long.parseLong(projectId));
List<EvalSurveyAttachCO> data = listSingleResponse.getData();
if (!CollectionUtils.isEmpty(data)) {
data.removeIf(item -> !ProjectDocumentEnum.PROJECT_ESTABLISHED.getVal().equals(item.getAttachTypeCode()));
}
return SingleResponse.success(CollectionUtils.isEmpty(data) ? null : data.get(0));
}
}

View File

@ -12,6 +12,7 @@ import org.qinan.safetyeval.client.dto.SingleResponse;
import org.qinan.safetyeval.client.dto.institution.EvalSurveyAttachSaveCmd;
import org.qinan.safetyeval.client.dto.institution.EvalSurveyPageQuery;
import org.qinan.safetyeval.client.dto.institution.EvalSurveySaveCmd;
import org.qinan.safetyeval.domain.constant.ProjectDocumentEnum;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
@ -49,6 +50,10 @@ public class EvalSurveyController {
@ApiOperation("按项目查询附件列表")
@GetMapping("/list")
public SingleResponse<List<EvalSurveyAttachCO>> list(@ApiParam("项目ID") @RequestParam String projectId) {
return evalSurveyAttachApi.listByProject(Long.parseLong(projectId));
SingleResponse<List<EvalSurveyAttachCO>> listSingleResponse = evalSurveyAttachApi.listByProject(Long.parseLong(projectId));
if (listSingleResponse != null && listSingleResponse.getData() != null) {
listSingleResponse.getData().removeIf(item -> ProjectDocumentEnum.PROJECT_ESTABLISHED.getVal().equals(item.getAttachTypeCode()));
}
return listSingleResponse;
}
}

View File

@ -50,7 +50,9 @@ public class EvalSurveyAttachExecutor implements EvalSurveyAttachApi {
@Transactional(rollbackFor = Exception.class)
public SingleResponse<Boolean> save(List<EvalSurveyAttachSaveCmd> cmdList) {
evalSurveyAttachMapper.delete(new LambdaQueryWrapper<EvalSurveyAttachDO>()
.eq(EvalSurveyAttachDO::getProjectId, cmdList.get(0).getProjectId()));
.eq(EvalSurveyAttachDO::getProjectId, cmdList.get(0).getProjectId())
.ne(EvalSurveyAttachDO::getAttachTypeCode, ProjectDocumentEnum.PROJECT_ESTABLISHED.getVal())
);
for (EvalSurveyAttachSaveCmd cmd : cmdList) {
cmd.setId(null);
EvalSurveyAttachEntity entity = evalSurveyCmdConvertor.convertAttachSaveCmdToE(cmd);
@ -96,4 +98,16 @@ public class EvalSurveyAttachExecutor implements EvalSurveyAttachApi {
evalSurveyCmdConvertor.convertAttachEListToCOList(
evalSurveyDomainService.listAttachesByProjectId(projectId)));
}
@Override
public SingleResponse<Boolean> saveProjectEstablishedAttach(EvalSurveyAttachSaveCmd cmdList) {
evalSurveyAttachMapper.delete(new LambdaQueryWrapper<EvalSurveyAttachDO>()
.eq(EvalSurveyAttachDO::getProjectId, cmdList.getProjectId())
.eq(EvalSurveyAttachDO::getAttachTypeCode, ProjectDocumentEnum.PROJECT_ESTABLISHED.getVal())
);
cmdList.setId(null);
EvalSurveyAttachEntity entity = evalSurveyCmdConvertor.convertAttachSaveCmdToE(cmdList);
evalSurveyDomainService.saveOrUpdateAttach(entity);
return SingleResponse.success(true);
}
}

View File

@ -11,4 +11,6 @@ public interface EvalSurveyAttachApi {
SingleResponse<Boolean> save(List<EvalSurveyAttachSaveCmd> cmdList);
SingleResponse<List<EvalSurveyAttachCO>> listByProject(Long projectId);
SingleResponse<Boolean> saveProjectEstablishedAttach(EvalSurveyAttachSaveCmd cmdList);
}

View File

@ -14,6 +14,7 @@ public enum ProjectDocumentEnum {
RECTIFICATION_NOTICE("整改通知", "RECTIFICATION_NOTICE"),
ENTERPRISE_RECTIFICATION("企业整改", "ENTERPRISE_RECTIFICATION"),
RECTIFICATION_REVIEW("整改复查", "RECTIFICATION_REVIEW"),
PROJECT_ESTABLISHED("项目建立附件", "PROJECT_ESTABLISHED"),
SITE_INSPECTION_FORM("现场检查表", "SITE_INSPECTION_FORM");
@Getter