刘光辉
119 分钟以前 06f314545ac3514d7ce28939920866ae8188d31c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
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;
        }
    }
}