소스 검색

触发重新归档

huanglc 4 주 전
부모
커밋
0e8a8a13f2

+ 10 - 0
bpm-core/src/main/java/com/srm/bpm/logic/service/impl/BillBpmnLogicImpl.java

@@ -80,6 +80,7 @@ import cn.hutool.core.collection.CollectionUtil;
80
 import cn.hutool.core.lang.UUID;
80
 import cn.hutool.core.lang.UUID;
81
 import lombok.RequiredArgsConstructor;
81
 import lombok.RequiredArgsConstructor;
82
 import lombok.extern.slf4j.Slf4j;
82
 import lombok.extern.slf4j.Slf4j;
83
+import org.springframework.transaction.interceptor.TransactionAspectSupport;
83
 
84
 
84
 import static com.srm.bpm.logic.constant.BillStatus.CANCEL;
85
 import static com.srm.bpm.logic.constant.BillStatus.CANCEL;
85
 import static com.srm.bpm.logic.constant.NodeLinkType.create;
86
 import static com.srm.bpm.logic.constant.NodeLinkType.create;
@@ -652,6 +653,9 @@ public class BillBpmnLogicImpl implements BillBpmnLogic {
652
         } catch (Exception e) {
653
         } catch (Exception e) {
653
             log.error("检查归档条件并触发回调时发生异常。billId: {}, taskId: {}, 错误: {}",
654
             log.error("检查归档条件并触发回调时发生异常。billId: {}, taskId: {}, 错误: {}",
654
                     bill != null ? bill.getId() : null, taskId, e.getMessage(), e);
655
                     bill != null ? bill.getId() : null, taskId, e.getMessage(), e);
656
+            // 设置事务回滚,确保异常不会导致事务提交
657
+            TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
658
+            throw new RuntimeException("检查归档条件并触发回调时发生异常: " + e.getMessage(), e);
655
         }
659
         }
656
     }
660
     }
657
 
661
 
@@ -678,6 +682,9 @@ public class BillBpmnLogicImpl implements BillBpmnLogic {
678
             }
682
             }
679
         } catch (Exception e) {
683
         } catch (Exception e) {
680
             log.error("触发审批单完成逻辑和回调时发生异常。billId: {}, 错误: {}", bill.getId(), e.getMessage(), e);
684
             log.error("触发审批单完成逻辑和回调时发生异常。billId: {}, 错误: {}", bill.getId(), e.getMessage(), e);
685
+            // 设置事务回滚,确保异常不会导致事务提交
686
+            TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
687
+            throw new RuntimeException("触发审批单完成逻辑和回调时发生异常: " + e.getMessage(), e);
681
         }
688
         }
682
     }
689
     }
683
 
690
 
@@ -745,6 +752,9 @@ public class BillBpmnLogicImpl implements BillBpmnLogic {
745
             }
752
             }
746
         } catch (Exception e) {
753
         } catch (Exception e) {
747
             log.error("检查审批单完成状态时发生异常。billId: {}, 错误: {}", bill.getId(), e.getMessage(), e);
754
             log.error("检查审批单完成状态时发生异常。billId: {}, 错误: {}", bill.getId(), e.getMessage(), e);
755
+            // 设置事务回滚,确保异常不会导致事务提交
756
+            TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
757
+            throw new RuntimeException("检查审批单完成状态时发生异常: " + e.getMessage(), e);
748
         }
758
         }
749
     }
759
     }
750
     
760
     

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 1135 - 1117
bpm-core/src/main/java/com/srm/bpm/logic/service/impl/BillLogicImpl.java


+ 6 - 6
bpm-server/src/main/resources/application.yml

@@ -49,15 +49,15 @@ spring:
49
     druid:
49
     druid:
50
       #MySQL
50
       #MySQL
51
       driver-class-name: com.mysql.jdbc.Driver
51
       driver-class-name: com.mysql.jdbc.Driver
52
-#      url: jdbc:mysql://172.16.0.48:3306/jqh_srm_9000?useUnicode=true&characterEncoding=utf-8&useSSL=false&allowMultiQueries=true&serverTimezone=GMT%2B8
53
-#      username: root
54
-#      password: jqh_srm_2022
52
+      url: jdbc:mysql://172.16.0.48:3306/jqh_srm_9000?useUnicode=true&characterEncoding=utf-8&useSSL=false&allowMultiQueries=true&serverTimezone=GMT%2B8
53
+      username: root
54
+      password: jqh_srm_2022
55
 #      url: jdbc:mysql://172.16.0.71:3306/jqh_srm_9001?useUnicode=true&characterEncoding=utf-8&useSSL=false&allowMultiQueries=true&serverTimezone=GMT%2B8
55
 #      url: jdbc:mysql://172.16.0.71:3306/jqh_srm_9001?useUnicode=true&characterEncoding=utf-8&useSSL=false&allowMultiQueries=true&serverTimezone=GMT%2B8
56
 #      username: root
56
 #      username: root
57
 #      password: jqh_srm_123123
57
 #      password: jqh_srm_123123
58
-      url: jdbc:mysql://172.16.0.66:3306/jqh_srm_9000?useUnicode=true&characterEncoding=utf-8&useSSL=false&allowMultiQueries=true&serverTimezone=GMT%2B8
59
-      username: root
60
-      password: jqh_srm_2022
58
+#      url: jdbc:mysql://172.16.0.66:3306/jqh_srm_9000?useUnicode=true&characterEncoding=utf-8&useSSL=false&allowMultiQueries=true&serverTimezone=GMT%2B8
59
+#      username: root
60
+#      password: jqh_srm_2022
61
       initial-size: 10
61
       initial-size: 10
62
       max-active: 20
62
       max-active: 20
63
       min-idle: 2
63
       min-idle: 2