REQ-3581: 修复印章状态同步问题
This commit is contained in:
parent
aa1d5ec283
commit
ce1f32548c
@ -1,6 +1,5 @@
|
|||||||
package cn.axzo.nanopart.ess.server.dao;
|
package cn.axzo.nanopart.ess.server.dao;
|
||||||
|
|
||||||
import cn.axzo.nanopart.ess.api.domain.contract.Approver;
|
|
||||||
import cn.axzo.nanopart.ess.api.domain.contract.EssApproveDetail;
|
import cn.axzo.nanopart.ess.api.domain.contract.EssApproveDetail;
|
||||||
import cn.axzo.nanopart.ess.api.enums.EssContractState;
|
import cn.axzo.nanopart.ess.api.enums.EssContractState;
|
||||||
import cn.axzo.nanopart.ess.server.entity.EssContract;
|
import cn.axzo.nanopart.ess.server.entity.EssContract;
|
||||||
@ -43,13 +42,11 @@ public class EssContractDao extends ServiceImpl<EssContractMapper, EssContract>
|
|||||||
|
|
||||||
public void setEssContractCreated(Long id,
|
public void setEssContractCreated(Long id,
|
||||||
String flowId,
|
String flowId,
|
||||||
List<String> essFileIds,
|
List<String> essFileIds) {
|
||||||
List<Approver> approvers) {
|
|
||||||
lambdaUpdate()
|
lambdaUpdate()
|
||||||
.eq(EssContract::getId, id)
|
.eq(EssContract::getId, id)
|
||||||
.set(EssContract::getEssFieldIds, JSON.toJSONString(essFileIds))
|
.set(EssContract::getEssFieldIds, JSON.toJSONString(essFileIds))
|
||||||
.set(EssContract::getEssContractId, flowId)
|
.set(EssContract::getEssContractId, flowId)
|
||||||
.set(EssContract::getApprovers, JSON.toJSONString(approvers))
|
|
||||||
.update();
|
.update();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -65,7 +62,7 @@ public class EssContractDao extends ServiceImpl<EssContractMapper, EssContract>
|
|||||||
.update();
|
.update();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setOssInfo(EssContract contract, String fileKey) {
|
public void setOssFileKey(EssContract contract, String fileKey) {
|
||||||
lambdaUpdate()
|
lambdaUpdate()
|
||||||
.eq(EssContract::getId, contract.getId())
|
.eq(EssContract::getId, contract.getId())
|
||||||
.set(EssContract::getOssFileKey, fileKey)
|
.set(EssContract::getOssFileKey, fileKey)
|
||||||
|
|||||||
@ -62,8 +62,7 @@ public class ContractManager {
|
|||||||
for (int i = 0; i < contract.approverSize(); i++)
|
for (int i = 0; i < contract.approverSize(); i++)
|
||||||
contract.getApprover(i).setEssRecipientId(essRecipientIds.get(i));
|
contract.getApprover(i).setEssRecipientId(essRecipientIds.get(i));
|
||||||
essContractDao.setEssContractCreated(
|
essContractDao.setEssContractCreated(
|
||||||
contract.getId(), essResponse.getFlowId(),
|
contract.getId(), essResponse.getFlowId(), essFileIds);
|
||||||
essFileIds, contract.getApprovers());
|
|
||||||
contract = essContractDao.getOrThrow(essResponse.getFlowId());
|
contract = essContractDao.getOrThrow(essResponse.getFlowId());
|
||||||
essBroadcaster.fireContractStateChanged(contract);
|
essBroadcaster.fireContractStateChanged(contract);
|
||||||
CreateContractByFileResponse response = new CreateContractByFileResponse();
|
CreateContractByFileResponse response = new CreateContractByFileResponse();
|
||||||
|
|||||||
@ -173,7 +173,7 @@ public class EssService {
|
|||||||
return;
|
return;
|
||||||
String fileName = String.format("%s.pdf", effectiveContract.getContractName());
|
String fileName = String.format("%s.pdf", effectiveContract.getContractName());
|
||||||
String fileKey = ossService.uploadToOss(essPdfUrl.get(), fileName);
|
String fileKey = ossService.uploadToOss(essPdfUrl.get(), fileName);
|
||||||
essContractDao.setOssInfo(effectiveContract, fileKey);
|
essContractDao.setOssFileKey(effectiveContract, fileKey);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -105,9 +105,10 @@ public class OrgManager {
|
|||||||
// !! seal
|
// !! seal
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
public void maybeAddSeal(Long ouId, String essSealId, EssSealType type) {
|
public boolean maybeAddSeal(Long ouId, String essSealId, EssSealType type) {
|
||||||
EssSeal seal = essSealDao.findByEssSealId(essSealId).orElse(null);
|
EssSeal seal = essSealDao.findByEssSealId(essSealId).orElse(null);
|
||||||
if (seal != null) return;
|
if (seal != null)
|
||||||
|
return false;
|
||||||
seal = new EssSeal();
|
seal = new EssSeal();
|
||||||
seal.setOuId(ouId);
|
seal.setOuId(ouId);
|
||||||
seal.setEssSealId(essSealId);
|
seal.setEssSealId(essSealId);
|
||||||
@ -115,7 +116,9 @@ public class OrgManager {
|
|||||||
seal.setType(type);
|
seal.setType(type);
|
||||||
try {
|
try {
|
||||||
essSealDao.save(seal);
|
essSealDao.save(seal);
|
||||||
|
return true;
|
||||||
} catch (DuplicateKeyException ignored) {
|
} catch (DuplicateKeyException ignored) {
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -157,7 +160,7 @@ public class OrgManager {
|
|||||||
return;
|
return;
|
||||||
try {
|
try {
|
||||||
essSealPersonDao.saveBatch(newPersons);
|
essSealPersonDao.saveBatch(newPersons);
|
||||||
} catch (Exception ignored) {
|
} catch (DuplicateKeyException ignored) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -108,10 +108,10 @@ class CallbackController implements EssCallbackApi, InitializingBean {
|
|||||||
StringUtils.isBlank(operate.getAuthorizedOperatorOpenId())
|
StringUtils.isBlank(operate.getAuthorizedOperatorOpenId())
|
||||||
? PersonOpenId.none()
|
? PersonOpenId.none()
|
||||||
: PersonOpenId.parse(operate.getAuthorizedOperatorOpenId());
|
: PersonOpenId.parse(operate.getAuthorizedOperatorOpenId());
|
||||||
orgManager.maybeAddSeal(ou.getOuId(), operate.getSealId(),
|
boolean sealCreated = orgManager.maybeAddSeal(ou.getOuId(), operate.getSealId(),
|
||||||
EssSealType.fromEssCode(operate.getSealType()));
|
EssSealType.fromEssCode(operate.getSealType()));
|
||||||
// 印章创建人会自动获得授权
|
// 1. 印章创建人会自动获得授权; 2. 避免miss create事件
|
||||||
if ("Create".equals(operate.getOperate()))
|
if (sealCreated)
|
||||||
orgManager.addSealAuthorization(operate.getSealId(), operator.getPersonId(), operator.getPersonId());
|
orgManager.addSealAuthorization(operate.getSealId(), operator.getPersonId(), operator.getPersonId());
|
||||||
if ("Delete".equals(operate.getOperate()))
|
if ("Delete".equals(operate.getOperate()))
|
||||||
orgManager.updateSealState(operate.getSealId(), EssSealState.DELETED);
|
orgManager.updateSealState(operate.getSealId(), EssSealState.DELETED);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user