REQ-3581: 添加印章人员的时间, 添加人员信息
This commit is contained in:
parent
891b084579
commit
47296c64f6
@ -4,6 +4,7 @@ package cn.axzo.nanopart.ess.api.domain.contract;
|
||||
import cn.axzo.nanopart.ess.api.domain.OrgPerson;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.springframework.web.context.request.async.StandardServletAsyncWebRequest;
|
||||
|
||||
import javax.validation.constraints.Min;
|
||||
import javax.validation.constraints.NotNull;
|
||||
@ -15,6 +16,13 @@ import javax.validation.constraints.NotNull;
|
||||
@Getter
|
||||
public class OrgPersonInfo implements OrgPerson {
|
||||
|
||||
public static OrgPersonInfo create(Long ouId, Long personId) {
|
||||
OrgPersonInfo orgPersonInfo = new OrgPersonInfo();
|
||||
orgPersonInfo.setOuId(ouId);
|
||||
orgPersonInfo.setPersonId(personId);
|
||||
return orgPersonInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 单位id
|
||||
*/
|
||||
|
||||
@ -9,6 +9,7 @@ import org.springframework.dao.DuplicateKeyException;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import cn.axzo.nanopart.ess.api.domain.OrgPerson;
|
||||
import cn.axzo.nanopart.ess.api.domain.contract.OrgPersonInfo;
|
||||
import cn.axzo.nanopart.ess.api.enums.EssPersonState;
|
||||
import cn.axzo.nanopart.ess.api.enums.EssSealState;
|
||||
import cn.axzo.nanopart.ess.api.enums.EssSealType;
|
||||
@ -156,7 +157,18 @@ public class OrgManager {
|
||||
}
|
||||
|
||||
@BizTransactional
|
||||
public void maybeAddSealPerson(String essSealId, Long personId) {
|
||||
public void addSealPerson(String essSealId, Long personId) {
|
||||
EssSeal seal = essSealDao.findByEssSealId(essSealId).orElse(null);
|
||||
BizAssertions.assertNotNull(seal, "印章不存在: {}", essSealId);
|
||||
//noinspection DataFlowIssue
|
||||
getOrCreateOrgPerson(OrgPersonInfo.create(seal.getOuId(), personId));
|
||||
maybeAddSealPerson(essSealId, personId);
|
||||
}
|
||||
|
||||
/**
|
||||
* should be called in transaction
|
||||
*/
|
||||
private void maybeAddSealPerson(String essSealId, Long personId) {
|
||||
EssSeal seal = essSealDao.findByEssSealId(essSealId).orElse(null);
|
||||
BizAssertions.assertNotNull(seal, "印章不存在: {}", essSealId);
|
||||
EssSealPerson savedSealPerson = essSealPersonDao.find(essSealId, personId, true).orElse(null);
|
||||
|
||||
@ -1,6 +1,10 @@
|
||||
|
||||
package cn.axzo.nanopart.ess.server.ess.controller;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import cn.axzo.basics.common.BeanMapper;
|
||||
import cn.axzo.framework.domain.web.result.ApiResult;
|
||||
import cn.axzo.nanopart.ess.api.EssApi;
|
||||
@ -39,9 +43,6 @@ import cn.axzo.nanopart.ess.server.ess.OrgManager;
|
||||
import cn.axzo.nanopart.ess.server.ess.QueryService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author yanglin
|
||||
@ -100,7 +101,7 @@ class ApiController implements EssApi {
|
||||
@Override
|
||||
public ApiResult<Void> addSealPerson(AddSealPersonRequest request) {
|
||||
log.info("addSealPerson request={}", request);
|
||||
orgManager.maybeAddSealPerson(request.getEssSealId(), request.getPersonId());
|
||||
orgManager.addSealPerson(request.getEssSealId(), request.getPersonId());
|
||||
return ApiResult.ok();
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user