REQ-3581: 设置签署人

This commit is contained in:
yanglin 2025-02-20 13:46:14 +08:00
parent 245468e97f
commit e5e507d051
5 changed files with 19 additions and 17 deletions

View File

@ -40,7 +40,7 @@ public class Approver implements OrgPerson {
*/ */
@Range(min = 3, max = 300, message = "preReadTime必须在3-300之间") @Range(min = 3, max = 300, message = "preReadTime必须在3-300之间")
@NotNull(message = "preReadTime不能为空") @NotNull(message = "preReadTime不能为空")
private Long preReadTimeSeconds = 10L; private Long preReadTimeSeconds = 5L;
/** /**
* 指定盖章时, 使用的章类型 * 指定盖章时, 使用的章类型

View File

@ -12,14 +12,9 @@ import lombok.Setter;
public class EssApproveDetail { public class EssApproveDetail {
/** /**
* 签署人单位, 动态签署人在没有签署的时候可能为 * 签署人, 动态签署人在没有签署的时候可能为null
*/ */
private Long ouId; private OrgPersonInfo signPerson;
/**
* 签署人, 动态签署人在没有签署的时候可能为空
*/
private Long personId;
/** /**
* 签署编号 * 签署编号

View File

@ -16,6 +16,7 @@ import lombok.Getter;
import lombok.Setter; import lombok.Setter;
import java.util.List; import java.util.List;
import java.util.Objects;
import java.util.Optional; import java.util.Optional;
/** /**
@ -106,7 +107,9 @@ public class EssContract extends BaseEntity<EssContract> {
if (approveDetails == null) if (approveDetails == null)
return false; return false;
return approveDetails.stream() return approveDetails.stream()
.anyMatch(detail -> ouId.equals(detail.getOuId())); .map(EssApproveDetail::getSignPerson)
.filter(Objects::nonNull)
.anyMatch(person -> ouId.equals(person.getOuId()));
} }
public int approverSize() { public int approverSize() {

View File

@ -138,13 +138,7 @@ class CallbackController implements EssCallbackApi, InitializingBean {
EssApproveDetail detail = new EssApproveDetail(); EssApproveDetail detail = new EssApproveDetail();
if (StringUtils.isNotBlank(info.getProxyOperatorOpenId())) { if (StringUtils.isNotBlank(info.getProxyOperatorOpenId())) {
PersonOpenId personOpenId = PersonOpenId.parse(info.getProxyOperatorOpenId()); PersonOpenId personOpenId = PersonOpenId.parse(info.getProxyOperatorOpenId());
detail.setOuId(personOpenId.getOuId()); detail.setSignPerson(personOpenId.toOrgPersonInfo());
detail.setPersonId(personOpenId.getPersonId());
} else if (StringUtils.isNotBlank(info.getProxyOrganizationOpenId())) {
detail.setOuId(OrgOpenId.parse(info.getProxyOrganizationOpenId()).getOuId());
if (StringUtils.isNotBlank(info.getPhoneNumber()))
essSupport.findPersonByPhone(info.getPhoneNumber())
.ifPresent(person -> detail.setPersonId(person.getId()));
} }
detail.setRecipientId(info.getRecipientId()); detail.setRecipientId(info.getRecipientId());
detail.setState(EssContractApproveState.fromEssCode(info.getApproveStatus())); detail.setState(EssContractApproveState.fromEssCode(info.getApproveStatus()));
@ -162,7 +156,9 @@ class CallbackController implements EssCallbackApi, InitializingBean {
JSONObject customData = JsonObjectAsString.parse(changes.getCustomerData()).asJsonObject(); JSONObject customData = JsonObjectAsString.parse(changes.getCustomerData()).asJsonObject();
contract = essContractDao.getById(customData.getLong(ContractManager.CONTRACT_ID)); contract = essContractDao.getById(customData.getLong(ContractManager.CONTRACT_ID));
} }
if (contract != null) { if (contract == null) {
log.warn("contract not found: {}", changes.getFlowId());
} else {
contractManager.updateContractState(contract, state, approveDetails); contractManager.updateContractState(contract, state, approveDetails);
essService.maybeUploadContractToOss(contract); essService.maybeUploadContractToOss(contract);
} }

View File

@ -1,6 +1,7 @@
package cn.axzo.nanopart.ess.server.ess.domain; package cn.axzo.nanopart.ess.server.ess.domain;
import cn.axzo.nanopart.ess.api.domain.OrgPerson; import cn.axzo.nanopart.ess.api.domain.OrgPerson;
import cn.axzo.nanopart.ess.api.domain.contract.OrgPersonInfo;
import lombok.AccessLevel; import lombok.AccessLevel;
import lombok.Getter; import lombok.Getter;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
@ -38,6 +39,13 @@ public class PersonOpenId implements OrgPerson {
return ouId + "_" + personId; return ouId + "_" + personId;
} }
public OrgPersonInfo toOrgPersonInfo() {
OrgPersonInfo orgPersonInfo = new OrgPersonInfo();
orgPersonInfo.setOuId(ouId);
orgPersonInfo.setPersonId(personId);
return orgPersonInfo;
}
@Override @Override
public String toString() { public String toString() {
return toOpenId(); return toOpenId();