Procházet zdrojové kódy

触发重新归档

huanglc před 4 týdny
rodič
revize
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 80
 import cn.hutool.core.lang.UUID;
81 81
 import lombok.RequiredArgsConstructor;
82 82
 import lombok.extern.slf4j.Slf4j;
83
+import org.springframework.transaction.interceptor.TransactionAspectSupport;
83 84
 
84 85
 import static com.srm.bpm.logic.constant.BillStatus.CANCEL;
85 86
 import static com.srm.bpm.logic.constant.NodeLinkType.create;
@@ -652,6 +653,9 @@ public class BillBpmnLogicImpl implements BillBpmnLogic {
652 653
         } catch (Exception e) {
653 654
             log.error("检查归档条件并触发回调时发生异常。billId: {}, taskId: {}, 错误: {}",
654 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 683
         } catch (Exception e) {
680 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 753
         } catch (Exception e) {
747 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
     

Diff nebyl zobrazen, protože je příliš veliký
+ 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 49
     druid:
50 50
       #MySQL
51 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 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 56
 #      username: root
57 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 61
       initial-size: 10
62 62
       max-active: 20
63 63
       min-idle: 2