package jnpf.dmsService; import jnpf.audit.sdk.annotation.AuditLog; import jnpf.dmsEntity.wenjianbianhao.DmsFlowEventType; import jnpf.exception.DataException; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; /** Records issuance failure only after the native business transaction has rolled back. */ @Slf4j @Service @RequiredArgsConstructor public class DmsWenjianBianhaoFlowService { private final DmsWenjianBianhaoApplicationService applications; @AuditLog(action = "DMS_NUMBER_FLOW_SYNC", failureAction = "DMS_NUMBER_FLOW_SYNC_FAILED", label = "同步文件编号申请流程", bizModule = "DMS", bizType = "DMS_NUMBER_APPLICATION", bizCodeExpr = "#p1", bizCodeRequired = false, targetTable = "dms_wenjian_bianhao_shenqing", targetIdExpr = "#p1") public void sync(String flowId, String taskId, Integer flowState, DmsFlowEventType eventType) throws DataException { try { applications.syncApplicationFlow(flowId, taskId, flowState, eventType); } catch (Exception failure) { if (Integer.valueOf(2).equals(flowState) && eventType == DmsFlowEventType.END) { try { applications.markIssuanceFailed(flowId, taskId); } catch (Exception markingFailure) { failure.addSuppressed(markingFailure); log.error("文件编号发放失败,且失败标志回写失败 taskId={}", taskId, failure); } } throw failure; } } }