luotaiqian 2026-07-27 15:09:57 +08:00
parent 9b8d233d8f
commit 9d1cea06d4
1 changed files with 15 additions and 0 deletions

View File

@ -20,15 +20,18 @@ import org.qinan.safetyeval.domain.query.EvalProjectMemberQuery;
import org.qinan.safetyeval.domain.query.EvalProjectQuery;
import org.qinan.safetyeval.domain.query.PageResult;
import org.qinan.safetyeval.domain.service.EvalProjectDomainService;
import org.qinan.safetyeval.domain.waring.model.EvalProjectProcessWaringE;
import org.qinan.safetyeval.infrastructure.adapter.ThreadLocalUserInfoAdapter;
import org.qinan.safetyeval.infrastructure.adapter.auth.AuthUserContextAdapter;
import org.qinan.safetyeval.infrastructure.mapper.EvalProjectMapper;
import org.qinan.safetyeval.infrastructure.support.InstitutionOrgSupport;
import org.qinan.safetyeval.infrastructure.support.InsertFieldDefaults;
import org.qinan.safetyeval.infrastructure.support.ProjectNoGenerator;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.dao.DuplicateKeyException;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import java.time.LocalDate;
@ -60,13 +63,25 @@ public class EvalProjectExecutor implements EvalProjectApi {
private EvalProjectMemberGateway evalProjectMemberGateway;
@Override
@Transactional(rollbackFor = Exception.class)
public SingleResponse<EvalProjectCO> save(EvalProjectAddCmd cmd) {
Long orgId = institutionOrgSupport.resolveCurrentOrgId();
EvalProjectEntity entity = evalProjectCmdConvertor.convertAddCmdToE(cmd);
EvalProjectEntity result = saveWithProjectNo(entity, orgId);
createProcessWaring(result);
return SingleResponse.success(evalProjectCmdConvertor.convertEToCO(result));
}
/**
*
*/
private void createProcessWaring(EvalProjectEntity project) {
EvalProjectProcessWaringE waring = EvalProjectProcessWaringE.of();
waring.setProjectId(project.getId());
InsertFieldDefaults.apply(waring);
waring.add();
}
@Override
public SingleResponse<EvalProjectCO> get(Long id) {
EvalProjectEntity entity = evalProjectDomainService.get(id);