guyanqing 1 éve
szülő
commit
8283eb55de
79 módosított fájl, 2134 hozzáadás és 41 törlés
  1. 2 0
      springcloudalibabaVIP23/.idea/compiler.xml
  2. 4 0
      springcloudalibabaVIP23/.idea/encodings.xml
  3. 58 38
      springcloudalibabaVIP23/.idea/workspace.xml
  4. 134 0
      springcloudalibabaVIP23/Storage-Module/pom.xml
  5. 16 0
      springcloudalibabaVIP23/Storage-Module/src/main/java/com/sf/SeataStorageServiceApplication2002.java
  6. 41 0
      springcloudalibabaVIP23/Storage-Module/src/main/java/com/sf/config/DataSourceProxyConfig.java
  7. 9 0
      springcloudalibabaVIP23/Storage-Module/src/main/java/com/sf/config/MybatisConfig.java
  8. 19 0
      springcloudalibabaVIP23/Storage-Module/src/main/java/com/sf/controller/StorageController.java
  9. 10 0
      springcloudalibabaVIP23/Storage-Module/src/main/java/com/sf/dao/StorageDao.java
  10. 19 0
      springcloudalibabaVIP23/Storage-Module/src/main/java/com/sf/domain/CommonResult.java
  11. 20 0
      springcloudalibabaVIP23/Storage-Module/src/main/java/com/sf/domain/Storage.java
  12. 6 0
      springcloudalibabaVIP23/Storage-Module/src/main/java/com/sf/service/StorageService.java
  13. 21 0
      springcloudalibabaVIP23/Storage-Module/src/main/java/com/sf/service/impl/StorageServiceImpl.java
  14. 35 0
      springcloudalibabaVIP23/Storage-Module/src/main/resources/application.yml
  15. 140 0
      springcloudalibabaVIP23/Storage-Module/src/main/resources/file.conf
  16. 22 0
      springcloudalibabaVIP23/Storage-Module/src/main/resources/mapper/StorageMapper.xml
  17. 73 0
      springcloudalibabaVIP23/Storage-Module/src/main/resources/registry.conf
  18. 20 0
      springcloudalibabaVIP23/Storage-Module/src/test/java/com/sf/AppTest.java
  19. 35 0
      springcloudalibabaVIP23/Storage-Module/target/classes/application.yml
  20. BIN
      springcloudalibabaVIP23/Storage-Module/target/classes/com/sf/SeataStorageServiceApplication2002.class
  21. BIN
      springcloudalibabaVIP23/Storage-Module/target/classes/com/sf/config/DataSourceProxyConfig.class
  22. BIN
      springcloudalibabaVIP23/Storage-Module/target/classes/com/sf/config/MybatisConfig.class
  23. BIN
      springcloudalibabaVIP23/Storage-Module/target/classes/com/sf/controller/StorageController.class
  24. BIN
      springcloudalibabaVIP23/Storage-Module/target/classes/com/sf/dao/StorageDao.class
  25. BIN
      springcloudalibabaVIP23/Storage-Module/target/classes/com/sf/domain/CommonResult.class
  26. BIN
      springcloudalibabaVIP23/Storage-Module/target/classes/com/sf/domain/Storage.class
  27. BIN
      springcloudalibabaVIP23/Storage-Module/target/classes/com/sf/service/StorageService.class
  28. BIN
      springcloudalibabaVIP23/Storage-Module/target/classes/com/sf/service/impl/StorageServiceImpl.class
  29. 140 0
      springcloudalibabaVIP23/Storage-Module/target/classes/file.conf
  30. 22 0
      springcloudalibabaVIP23/Storage-Module/target/classes/mapper/StorageMapper.xml
  31. 73 0
      springcloudalibabaVIP23/Storage-Module/target/classes/registry.conf
  32. 134 0
      springcloudalibabaVIP23/account-Module/pom.xml
  33. 16 0
      springcloudalibabaVIP23/account-Module/src/main/java/com/sf/SeataAccountMainApp2003.java
  34. 41 0
      springcloudalibabaVIP23/account-Module/src/main/java/com/sf/config/DataSourceProxyConfig.java
  35. 9 0
      springcloudalibabaVIP23/account-Module/src/main/java/com/sf/config/MybatisConfig.java
  36. 23 0
      springcloudalibabaVIP23/account-Module/src/main/java/com/sf/controller/AccountController.java
  37. 14 0
      springcloudalibabaVIP23/account-Module/src/main/java/com/sf/dao/AccountDao.java
  38. 31 0
      springcloudalibabaVIP23/account-Module/src/main/java/com/sf/domain/Account.java
  39. 18 0
      springcloudalibabaVIP23/account-Module/src/main/java/com/sf/domain/CommonResult.java
  40. 13 0
      springcloudalibabaVIP23/account-Module/src/main/java/com/sf/service/AccountService.java
  41. 22 0
      springcloudalibabaVIP23/account-Module/src/main/java/com/sf/service/impl/AccountServiceImpl.java
  42. 36 0
      springcloudalibabaVIP23/account-Module/src/main/resources/application.yml
  43. 140 0
      springcloudalibabaVIP23/account-Module/src/main/resources/file.conf
  44. 22 0
      springcloudalibabaVIP23/account-Module/src/main/resources/mapper/AccountMapper.xml
  45. 73 0
      springcloudalibabaVIP23/account-Module/src/main/resources/registry.conf
  46. 20 0
      springcloudalibabaVIP23/account-Module/src/test/java/com/sf/AppTest.java
  47. 36 0
      springcloudalibabaVIP23/account-Module/target/classes/application.yml
  48. BIN
      springcloudalibabaVIP23/account-Module/target/classes/com/sf/SeataAccountMainApp2003.class
  49. BIN
      springcloudalibabaVIP23/account-Module/target/classes/com/sf/config/DataSourceProxyConfig.class
  50. BIN
      springcloudalibabaVIP23/account-Module/target/classes/com/sf/config/MybatisConfig.class
  51. BIN
      springcloudalibabaVIP23/account-Module/target/classes/com/sf/controller/AccountController.class
  52. BIN
      springcloudalibabaVIP23/account-Module/target/classes/com/sf/dao/AccountDao.class
  53. BIN
      springcloudalibabaVIP23/account-Module/target/classes/com/sf/domain/Account.class
  54. BIN
      springcloudalibabaVIP23/account-Module/target/classes/com/sf/domain/CommonResult.class
  55. BIN
      springcloudalibabaVIP23/account-Module/target/classes/com/sf/service/AccountService.class
  56. BIN
      springcloudalibabaVIP23/account-Module/target/classes/com/sf/service/impl/AccountServiceImpl.class
  57. 140 0
      springcloudalibabaVIP23/account-Module/target/classes/file.conf
  58. 22 0
      springcloudalibabaVIP23/account-Module/target/classes/mapper/AccountMapper.xml
  59. 73 0
      springcloudalibabaVIP23/account-Module/target/classes/registry.conf
  60. 2 0
      springcloudalibabaVIP23/pom.xml
  61. 20 0
      springcloudalibabaVIP23/seata-order-service2001/src/main/java/com/sf/service/AccountService.java
  62. 18 0
      springcloudalibabaVIP23/seata-order-service2001/src/main/java/com/sf/service/StorageService.java
  63. 18 2
      springcloudalibabaVIP23/seata-order-service2001/src/main/java/com/sf/service/impl/OrderServiceImpl.java
  64. 1 1
      springcloudalibabaVIP23/seata-order-service2001/src/main/resources/application.yml
  65. 36 0
      springcloudalibabaVIP23/seata-order-service2001/target/classes/application.yml
  66. BIN
      springcloudalibabaVIP23/seata-order-service2001/target/classes/com/sf/SeataOrderMainApp2001.class
  67. BIN
      springcloudalibabaVIP23/seata-order-service2001/target/classes/com/sf/config/DataSourceProxyConfig.class
  68. BIN
      springcloudalibabaVIP23/seata-order-service2001/target/classes/com/sf/config/MybatisConfig.class
  69. BIN
      springcloudalibabaVIP23/seata-order-service2001/target/classes/com/sf/controller/OrderController.class
  70. BIN
      springcloudalibabaVIP23/seata-order-service2001/target/classes/com/sf/dao/OrderDao.class
  71. BIN
      springcloudalibabaVIP23/seata-order-service2001/target/classes/com/sf/domain/CommonResult.class
  72. BIN
      springcloudalibabaVIP23/seata-order-service2001/target/classes/com/sf/domain/Order.class
  73. BIN
      springcloudalibabaVIP23/seata-order-service2001/target/classes/com/sf/service/AccountService.class
  74. BIN
      springcloudalibabaVIP23/seata-order-service2001/target/classes/com/sf/service/OrderService.class
  75. BIN
      springcloudalibabaVIP23/seata-order-service2001/target/classes/com/sf/service/StorageService.class
  76. BIN
      springcloudalibabaVIP23/seata-order-service2001/target/classes/com/sf/service/impl/OrderServiceImpl.class
  77. 140 0
      springcloudalibabaVIP23/seata-order-service2001/target/classes/file.conf
  78. 24 0
      springcloudalibabaVIP23/seata-order-service2001/target/classes/mapper/OrderMapper.xml
  79. 73 0
      springcloudalibabaVIP23/seata-order-service2001/target/classes/registry.conf

+ 2 - 0
springcloudalibabaVIP23/.idea/compiler.xml

@@ -14,9 +14,11 @@
         <module name="cloudalibaba-provider-payment9002" />
         <module name="cloudalibaba-provider-payment9001" />
         <module name="cloud-api-commons" />
+        <module name="account-Module" />
         <module name="seata-order-service2001" />
         <module name="cloudalibaba-consumer-nacos-order84" />
         <module name="cloudalibaba-sentinel-service8401" />
+        <module name="Storage-Module" />
       </profile>
     </annotationProcessing>
   </component>

+ 4 - 0
springcloudalibabaVIP23/.idea/encodings.xml

@@ -1,6 +1,10 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <project version="4">
   <component name="Encoding" native2AsciiForPropertiesFiles="true" defaultCharsetForPropertiesFiles="UTF-8">
+    <file url="file://$PROJECT_DIR$/Storage-Module/src/main/java" charset="UTF-8" />
+    <file url="file://$PROJECT_DIR$/Storage-Module/src/main/resources" charset="UTF-8" />
+    <file url="file://$PROJECT_DIR$/account-Module/src/main/java" charset="UTF-8" />
+    <file url="file://$PROJECT_DIR$/account-Module/src/main/resources" charset="UTF-8" />
     <file url="file://$PROJECT_DIR$/cloud-api-commons/src/main/java" charset="UTF-8" />
     <file url="file://$PROJECT_DIR$/cloud-api-commons/src/main/resources" charset="UTF-8" />
     <file url="file://$PROJECT_DIR$/cloudalibaba-config-nacos-client3377/src/main/java" charset="UTF-8" />

+ 58 - 38
springcloudalibabaVIP23/.idea/workspace.xml

@@ -5,25 +5,44 @@
   </component>
   <component name="ChangeListManager">
     <list default="true" id="0bad6c28-ea68-4d3a-b40f-655b0d82b08f" name="Changes" comment="">
-      <change afterPath="$PROJECT_DIR$/seata-order-service2001/pom.xml" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/seata-order-service2001/src/main/java/com/sf/SeataOrderMainApp2001.java" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/seata-order-service2001/src/main/java/com/sf/config/DataSourceProxyConfig.java" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/seata-order-service2001/src/main/java/com/sf/config/MybatisConfig.java" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/seata-order-service2001/src/main/java/com/sf/controller/OrderController.java" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/seata-order-service2001/src/main/java/com/sf/dao/OrderDao.java" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/seata-order-service2001/src/main/java/com/sf/domain/CommonResult.java" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/seata-order-service2001/src/main/java/com/sf/domain/Order.java" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/seata-order-service2001/src/main/java/com/sf/service/OrderService.java" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/seata-order-service2001/src/main/java/com/sf/service/impl/OrderServiceImpl.java" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/seata-order-service2001/src/main/resources/application.yml" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/seata-order-service2001/src/main/resources/file.conf" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/seata-order-service2001/src/main/resources/mapper/OrderMapper.xml" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/seata-order-service2001/src/main/resources/registry.conf" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/seata-order-service2001/src/test/java/com/sf/AppTest.java" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/Storage-Module/pom.xml" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/Storage-Module/src/main/java/com/sf/SeataStorageServiceApplication2002.java" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/Storage-Module/src/main/java/com/sf/config/DataSourceProxyConfig.java" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/Storage-Module/src/main/java/com/sf/config/MybatisConfig.java" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/Storage-Module/src/main/java/com/sf/controller/StorageController.java" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/Storage-Module/src/main/java/com/sf/dao/StorageDao.java" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/Storage-Module/src/main/java/com/sf/domain/CommonResult.java" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/Storage-Module/src/main/java/com/sf/domain/Storage.java" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/Storage-Module/src/main/java/com/sf/service/StorageService.java" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/Storage-Module/src/main/java/com/sf/service/impl/StorageServiceImpl.java" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/Storage-Module/src/main/resources/application.yml" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/Storage-Module/src/main/resources/file.conf" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/Storage-Module/src/main/resources/mapper/StorageMapper.xml" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/Storage-Module/src/main/resources/registry.conf" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/Storage-Module/src/test/java/com/sf/AppTest.java" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/account-Module/pom.xml" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/account-Module/src/main/java/com/sf/SeataAccountMainApp2003.java" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/account-Module/src/main/java/com/sf/config/DataSourceProxyConfig.java" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/account-Module/src/main/java/com/sf/config/MybatisConfig.java" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/account-Module/src/main/java/com/sf/controller/AccountController.java" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/account-Module/src/main/java/com/sf/dao/AccountDao.java" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/account-Module/src/main/java/com/sf/domain/Account.java" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/account-Module/src/main/java/com/sf/domain/CommonResult.java" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/account-Module/src/main/java/com/sf/service/AccountService.java" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/account-Module/src/main/java/com/sf/service/impl/AccountServiceImpl.java" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/account-Module/src/main/resources/application.yml" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/account-Module/src/main/resources/file.conf" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/account-Module/src/main/resources/mapper/AccountMapper.xml" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/account-Module/src/main/resources/registry.conf" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/account-Module/src/test/java/com/sf/AppTest.java" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/seata-order-service2001/src/main/java/com/sf/service/AccountService.java" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/seata-order-service2001/src/main/java/com/sf/service/StorageService.java" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/.idea/compiler.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/compiler.xml" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/.idea/encodings.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/encodings.xml" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/pom.xml" beforeDir="false" afterPath="$PROJECT_DIR$/pom.xml" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/seata-order-service2001/src/main/java/com/sf/service/impl/OrderServiceImpl.java" beforeDir="false" afterPath="$PROJECT_DIR$/seata-order-service2001/src/main/java/com/sf/service/impl/OrderServiceImpl.java" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/seata-order-service2001/src/main/resources/application.yml" beforeDir="false" afterPath="$PROJECT_DIR$/seata-order-service2001/src/main/resources/application.yml" afterDir="false" />
     </list>
     <option name="SHOW_DIALOG" value="false" />
     <option name="HIGHLIGHT_CONFLICTS" value="true" />
@@ -33,8 +52,8 @@
   <component name="FileTemplateManagerImpl">
     <option name="RECENT_TEMPLATES">
       <list>
-        <option value="Interface" />
         <option value="Class" />
+        <option value="Interface" />
       </list>
     </option>
   </component>
@@ -62,7 +81,7 @@
     "SHARE_PROJECT_CONFIGURATION_FILES": "true",
     "WebServerToolWindowFactoryState": "false",
     "jdk.selected.JAVA_MODULE": "1.8",
-    "last_opened_file_path": "D:/Program Files/IntelliJ IDEA 2019.3.3/VIP23/springcloudalibabaVIP23/cloudalibaba-sentinel-service8401/src/main/resources",
+    "last_opened_file_path": "D:/Program Files/IntelliJ IDEA 2019.3.3/VIP23/springcloudalibabaVIP23/account-Module/src/main/java/com/sf",
     "node.js.detected.package.eslint": "true",
     "node.js.detected.package.tslint": "true",
     "node.js.selected.package.eslint": "(autodetect)",
@@ -71,17 +90,17 @@
     "project.structure.proportion": "0.15",
     "project.structure.side.proportion": "0.35402298",
     "settings.editor.selected.configurable": "editor.preferences.fonts.default",
-    "spring.configuration.checksum": "eef36db803e3763009b633b1a4930b6c",
+    "spring.configuration.checksum": "2349743076d2cecf0f0d93d8ea63264e",
     "vue.rearranger.settings.migration": "true"
   }
 }]]></component>
   <component name="RecentsManager">
     <key name="CopyFile.RECENT_KEYS">
+      <recent name="D:\Program Files\IntelliJ IDEA 2019.3.3\VIP23\springcloudalibabaVIP23\account-Module\src\main\java\com\sf" />
+      <recent name="D:\Program Files\IntelliJ IDEA 2019.3.3\VIP23\springcloudalibabaVIP23\account-Module\src\main\resources" />
+      <recent name="D:\Program Files\IntelliJ IDEA 2019.3.3\VIP23\springcloudalibabaVIP23\Storage-Module\src\main\java\com\sf" />
       <recent name="D:\Program Files\IntelliJ IDEA 2019.3.3\VIP23\springcloudalibabaVIP23\cloudalibaba-sentinel-service8401\src\main\resources" />
       <recent name="D:\Program Files\IntelliJ IDEA 2019.3.3\VIP23\springcloudalibabaVIP23\cloudalibaba-consumer-nacos-order84\src\main\resources" />
-      <recent name="D:\Program Files\IntelliJ IDEA 2019.3.3\VIP23\springcloudalibabaVIP23\cloudalibaba-provider-payment9004\src\main\resources" />
-      <recent name="D:\Program Files\IntelliJ IDEA 2019.3.3\VIP23\springcloudalibabaVIP23\cloudalibaba-provider-payment9002\src\main\resources" />
-      <recent name="D:\Program Files\IntelliJ IDEA 2019.3.3\VIP23\springcloudalibabaVIP23\cloudalibaba-provider-payment9001\src\main\resources" />
     </key>
     <key name="CopyClassDialog.RECENTS_KEY">
       <recent name="com.sf.config" />
@@ -96,7 +115,7 @@
       </set>
     </option>
   </component>
-  <component name="RunManager" selected="Spring Boot.MainApp8401">
+  <component name="RunManager" selected="Spring Boot.SeataOrderMainApp2001">
     <configuration name="MainApp8401" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot" temporary="true" nameIsGenerated="true">
       <module name="cloudalibaba-sentinel-service8401" />
       <option name="SPRING_BOOT_MAIN_CLASS" value="com.sf.MainApp8401" />
@@ -110,9 +129,9 @@
         <option name="Make" enabled="true" />
       </method>
     </configuration>
-    <configuration name="NacosConfigClientMain3377" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot" temporary="true" nameIsGenerated="true">
-      <module name="cloudalibaba-config-nacos-client3377" />
-      <option name="SPRING_BOOT_MAIN_CLASS" value="com.sf.NacosConfigClientMain3377" />
+    <configuration name="OrderNacosMain84" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot" temporary="true" nameIsGenerated="true">
+      <module name="cloudalibaba-consumer-nacos-order84" />
+      <option name="SPRING_BOOT_MAIN_CLASS" value="com.sf.OrderNacosMain84" />
       <extension name="coverage">
         <pattern>
           <option name="PATTERN" value="com.sf.*" />
@@ -123,9 +142,9 @@
         <option name="Make" enabled="true" />
       </method>
     </configuration>
-    <configuration name="OrderNacosMain84" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot" temporary="true" nameIsGenerated="true">
-      <module name="cloudalibaba-consumer-nacos-order84" />
-      <option name="SPRING_BOOT_MAIN_CLASS" value="com.sf.OrderNacosMain84" />
+    <configuration name="SeataAccountMainApp2003" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot" temporary="true" nameIsGenerated="true">
+      <module name="account-Module" />
+      <option name="SPRING_BOOT_MAIN_CLASS" value="com.sf.SeataAccountMainApp2003" />
       <extension name="coverage">
         <pattern>
           <option name="PATTERN" value="com.sf.*" />
@@ -136,9 +155,9 @@
         <option name="Make" enabled="true" />
       </method>
     </configuration>
-    <configuration name="PaymentMain9003" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot" temporary="true" nameIsGenerated="true">
-      <module name="cloudalibaba-provider-payment9003" />
-      <option name="SPRING_BOOT_MAIN_CLASS" value="com.sf.PaymentMain9003" />
+    <configuration name="SeataOrderMainApp2001" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot" temporary="true" nameIsGenerated="true">
+      <module name="seata-order-service2001" />
+      <option name="SPRING_BOOT_MAIN_CLASS" value="com.sf.SeataOrderMainApp2001" />
       <extension name="coverage">
         <pattern>
           <option name="PATTERN" value="com.sf.*" />
@@ -149,9 +168,9 @@
         <option name="Make" enabled="true" />
       </method>
     </configuration>
-    <configuration name="PaymentMain9004" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot" temporary="true" nameIsGenerated="true">
-      <module name="cloudalibaba-provider-payment9004" />
-      <option name="SPRING_BOOT_MAIN_CLASS" value="com.sf.PaymentMain9004" />
+    <configuration name="SeataStorageServiceApplication2002" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot" temporary="true" nameIsGenerated="true">
+      <module name="Storage-Module" />
+      <option name="SPRING_BOOT_MAIN_CLASS" value="com.sf.SeataStorageServiceApplication2002" />
       <extension name="coverage">
         <pattern>
           <option name="PATTERN" value="com.sf.*" />
@@ -164,11 +183,11 @@
     </configuration>
     <recent_temporary>
       <list>
+        <item itemvalue="Spring Boot.SeataOrderMainApp2001" />
+        <item itemvalue="Spring Boot.SeataAccountMainApp2003" />
+        <item itemvalue="Spring Boot.SeataStorageServiceApplication2002" />
         <item itemvalue="Spring Boot.MainApp8401" />
         <item itemvalue="Spring Boot.OrderNacosMain84" />
-        <item itemvalue="Spring Boot.PaymentMain9004" />
-        <item itemvalue="Spring Boot.PaymentMain9003" />
-        <item itemvalue="Spring Boot.NacosConfigClientMain3377" />
       </list>
     </recent_temporary>
   </component>
@@ -187,7 +206,8 @@
       <workItem from="1697931753064" duration="638000" />
       <workItem from="1698312279279" duration="9566000" />
       <workItem from="1698914353786" duration="9997000" />
-      <workItem from="1699079521546" duration="5328000" />
+      <workItem from="1699079521546" duration="6446000" />
+      <workItem from="1699523852460" duration="6288000" />
     </task>
     <servers />
   </component>

+ 134 - 0
springcloudalibabaVIP23/Storage-Module/pom.xml

@@ -0,0 +1,134 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <artifactId>springcloudalibabaVIP23</artifactId>
+        <groupId>com.sf</groupId>
+        <version>1.0-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>Storage-Module</artifactId>
+
+    <name>Storage-Module</name>
+    <!-- FIXME change it to the project's website -->
+    <url>http://www.example.com</url>
+
+    <properties>
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+        <maven.compiler.source>1.7</maven.compiler.source>
+        <maven.compiler.target>1.7</maven.compiler.target>
+    </properties>
+
+    <dependencies>
+        <!--nacos-->
+        <dependency>
+            <groupId>com.alibaba.cloud</groupId>
+            <artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
+        </dependency>
+        <!--seata-->
+        <dependency>
+            <groupId>com.alibaba.cloud</groupId>
+            <artifactId>spring-cloud-starter-alibaba-seata</artifactId>
+            <exclusions>
+                <exclusion>
+                    <artifactId>seata-all</artifactId>
+                    <groupId>io.seata</groupId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+        <dependency>
+            <groupId>io.seata</groupId>
+            <artifactId>seata-all</artifactId>
+            <version>0.9.0</version>
+        </dependency>
+        <!--feign-->
+        <dependency>
+            <groupId>org.springframework.cloud</groupId>
+            <artifactId>spring-cloud-starter-openfeign</artifactId>
+        </dependency>
+        <!--web-actuator-->
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-web</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-actuator</artifactId>
+        </dependency>
+        <!--mysql-druid-->
+        <dependency>
+            <groupId>mysql</groupId>
+            <artifactId>mysql-connector-java</artifactId>
+            <version>5.1.37</version>
+        </dependency>
+        <dependency>
+            <groupId>com.alibaba</groupId>
+            <artifactId>druid-spring-boot-starter</artifactId>
+            <version>1.1.10</version>
+        </dependency>
+        <dependency>
+            <groupId>org.mybatis.spring.boot</groupId>
+            <artifactId>mybatis-spring-boot-starter</artifactId>
+            <version>2.0.0</version>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-test</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.projectlombok</groupId>
+            <artifactId>lombok</artifactId>
+            <version>1.18.28</version>
+            <optional>true</optional>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <pluginManagement><!-- lock down plugins versions to avoid using Maven defaults (may be moved to parent pom) -->
+            <plugins>
+                <!-- clean lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#clean_Lifecycle -->
+                <plugin>
+                    <artifactId>maven-clean-plugin</artifactId>
+                    <version>3.1.0</version>
+                </plugin>
+                <!-- default lifecycle, jar packaging: see https://maven.apache.org/ref/current/maven-core/default-bindings.html#Plugin_bindings_for_jar_packaging -->
+                <plugin>
+                    <artifactId>maven-resources-plugin</artifactId>
+                    <version>3.0.2</version>
+                </plugin>
+                <plugin>
+                    <artifactId>maven-compiler-plugin</artifactId>
+                    <version>3.8.0</version>
+                </plugin>
+                <plugin>
+                    <artifactId>maven-surefire-plugin</artifactId>
+                    <version>2.22.1</version>
+                </plugin>
+                <plugin>
+                    <artifactId>maven-jar-plugin</artifactId>
+                    <version>3.0.2</version>
+                </plugin>
+                <plugin>
+                    <artifactId>maven-install-plugin</artifactId>
+                    <version>2.5.2</version>
+                </plugin>
+                <plugin>
+                    <artifactId>maven-deploy-plugin</artifactId>
+                    <version>2.8.2</version>
+                </plugin>
+                <!-- site lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#site_Lifecycle -->
+                <plugin>
+                    <artifactId>maven-site-plugin</artifactId>
+                    <version>3.7.1</version>
+                </plugin>
+                <plugin>
+                    <artifactId>maven-project-info-reports-plugin</artifactId>
+                    <version>3.0.0</version>
+                </plugin>
+            </plugins>
+        </pluginManagement>
+    </build>
+</project>

+ 16 - 0
springcloudalibabaVIP23/Storage-Module/src/main/java/com/sf/SeataStorageServiceApplication2002.java

@@ -0,0 +1,16 @@
+package com.sf;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
+import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
+import org.springframework.cloud.openfeign.EnableFeignClients;
+
+@SpringBootApplication(exclude = DataSourceAutoConfiguration.class)
+@EnableFeignClients
+@EnableDiscoveryClient
+public class SeataStorageServiceApplication2002 {
+    public static void main(String[] args) {
+        SpringApplication.run(SeataStorageServiceApplication2002.class,args);
+    }
+}

+ 41 - 0
springcloudalibabaVIP23/Storage-Module/src/main/java/com/sf/config/DataSourceProxyConfig.java

@@ -0,0 +1,41 @@
+package com.sf.config;
+
+import com.alibaba.druid.pool.DruidDataSource;
+import io.seata.rm.datasource.DataSourceProxy;
+import org.apache.ibatis.session.SqlSessionFactory;
+import org.mybatis.spring.SqlSessionFactoryBean;
+import org.mybatis.spring.transaction.SpringManagedTransactionFactory;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
+
+import javax.sql.DataSource;
+
+
+/**
+ * 使用seata对数据源进行代理
+ */
+@Configuration
+public class DataSourceProxyConfig {
+    @Value("${mybatis.mapperLocations}")
+    private String mapperLocations;
+    @Bean
+    @ConfigurationProperties(prefix = "spring.datasource")
+    public DataSource druidDataSource(){
+        return new DruidDataSource();
+    }
+    @Bean
+    public DataSourceProxy dataSourceProxy(DataSource dataSource) {
+        return new DataSourceProxy(dataSource);
+    }
+    @Bean
+    public SqlSessionFactory sqlSessionFactoryBean(DataSourceProxy dataSourceProxy) throws Exception {
+        SqlSessionFactoryBean sqlSessionFactoryBean = new SqlSessionFactoryBean();
+        sqlSessionFactoryBean.setDataSource(dataSourceProxy);
+        sqlSessionFactoryBean.setMapperLocations(new PathMatchingResourcePatternResolver().getResources(mapperLocations));
+        sqlSessionFactoryBean.setTransactionFactory(new SpringManagedTransactionFactory());
+        return sqlSessionFactoryBean.getObject();
+    }
+}

+ 9 - 0
springcloudalibabaVIP23/Storage-Module/src/main/java/com/sf/config/MybatisConfig.java

@@ -0,0 +1,9 @@
+package com.sf.config;
+
+import org.mybatis.spring.annotation.MapperScan;
+import org.springframework.context.annotation.Configuration;
+
+@Configuration
+@MapperScan({"com.sf.dao"})
+public class MybatisConfig {
+}

+ 19 - 0
springcloudalibabaVIP23/Storage-Module/src/main/java/com/sf/controller/StorageController.java

@@ -0,0 +1,19 @@
+package com.sf.controller;
+
+import com.sf.domain.CommonResult;
+import com.sf.service.StorageService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+@RestController
+public class StorageController {
+    @Autowired
+    private StorageService storageService;
+    //扣减库存
+    @RequestMapping("/storage/decrease")
+    public CommonResult decrease(Long productId, Integer count) {
+        storageService.decrease(productId, count);
+        return new CommonResult(200,"扣减库存成功!");
+    }
+}

+ 10 - 0
springcloudalibabaVIP23/Storage-Module/src/main/java/com/sf/dao/StorageDao.java

@@ -0,0 +1,10 @@
+package com.sf.dao;
+
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+@Mapper
+public interface StorageDao {
+    //扣减库存信息
+    void decrease(@Param("productId") Long productId, @Param("count") Integer count);
+}

+ 19 - 0
springcloudalibabaVIP23/Storage-Module/src/main/java/com/sf/domain/CommonResult.java

@@ -0,0 +1,19 @@
+package com.sf.domain;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+public class CommonResult<T> {
+    private Integer code;
+    private String message;
+    private T data;
+
+    public CommonResult(Integer code, String message) {
+        this(code,message,null);
+    }
+}
+

+ 20 - 0
springcloudalibabaVIP23/Storage-Module/src/main/java/com/sf/domain/Storage.java

@@ -0,0 +1,20 @@
+package com.sf.domain;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+@Data
+@NoArgsConstructor
+@AllArgsConstructor
+public class Storage {
+    private Long id;
+    // 产品id
+    private Long productId;
+    //总库存
+    private Integer total;
+    //已用库存
+    private Integer used;
+    //剩余库存
+    private Integer residue;
+}

+ 6 - 0
springcloudalibabaVIP23/Storage-Module/src/main/java/com/sf/service/StorageService.java

@@ -0,0 +1,6 @@
+package com.sf.service;
+
+public interface StorageService {
+    // 扣减库存
+    void decrease(Long productId, Integer count);
+}

+ 21 - 0
springcloudalibabaVIP23/Storage-Module/src/main/java/com/sf/service/impl/StorageServiceImpl.java

@@ -0,0 +1,21 @@
+package com.sf.service.impl;
+
+import com.sf.dao.StorageDao;
+import com.sf.service.StorageService;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import javax.print.attribute.standard.PrinterURI;
+@Service
+@Slf4j
+public class StorageServiceImpl implements StorageService {
+    @Autowired
+    private StorageDao storageDao;
+    @Override
+    public void decrease(Long productId, Integer count) {
+        log.info("------->storage-service中扣减库存开始");
+        storageDao.decrease(productId,count);
+        log.info("------->storage-service中扣减库存结束");
+    }
+}

+ 35 - 0
springcloudalibabaVIP23/Storage-Module/src/main/resources/application.yml

@@ -0,0 +1,35 @@
+server:
+  port: 2002
+spring:
+  application:
+    name: seata-storage-service
+  cloud:
+    alibaba:
+      seata:
+        tx-service-group: fsp_tx_group   #自定义事务组名称需要和seata-server中的对应
+    nacos:
+      discovery:
+        server-addr: localhost:8848
+  datasource:
+    driver-class-name: com.mysql.jdbc.Driver
+    url: jdbc:mysql://localhost:3306/seata_storage
+    username: root
+    password: root
+feign:
+  hystrix:
+    enabled: false
+  client:
+    config:
+      default:
+        connect-timeout: 30000
+        read-timeout: 30000
+logging:
+  level:
+    io:
+      seata: info
+mybatis:
+  mapperLocations: classpath:mapper/*.xml
+
+ribbon:
+  ReadTimeout: 2000
+  ConnectTimeout: 2000

+ 140 - 0
springcloudalibabaVIP23/Storage-Module/src/main/resources/file.conf

@@ -0,0 +1,140 @@
+transport {
+  # tcp udt unix-domain-socket
+  type = "TCP"
+  #NIO NATIVE
+  server = "NIO"
+  #enable heartbeat
+  heartbeat = true
+  #thread factory for netty
+  thread-factory {
+    boss-thread-prefix = "NettyBoss"
+    worker-thread-prefix = "NettyServerNIOWorker"
+    server-executor-thread-prefix = "NettyServerBizHandler"
+    share-boss-worker = false
+    client-selector-thread-prefix = "NettyClientSelector"
+    client-selector-thread-size = 1
+    client-worker-thread-prefix = "NettyClientWorkerThread"
+    # netty boss thread size,will not be used for UDT
+    boss-thread-size = 1
+    #auto default pin or 8
+    worker-thread-size = 8
+  }
+  shutdown {
+    # when destroy server, wait seconds
+    wait = 3
+  }
+  serialization = "seata"
+  compressor = "none"
+}
+service {
+  #vgroup->rgroup
+  vgroup_mapping.fsp_tx_group = "default"#修改自定义事务组的名称
+  #only support single node
+  default.grouplist = "127.0.0.1:8091"
+  #degrade current not support
+  enableDegrade = false
+  #disable
+  disable = false
+  #unit ms,s,m,h,d represents milliseconds, seconds, minutes, hours, days, default permanent
+  max.commit.retry.timeout = "-1"
+  max.rollback.retry.timeout = "-1"
+}
+
+client {
+  async.commit.buffer.limit = 10000
+  lock {
+    retry.internal = 10
+    retry.times = 30
+  }
+  report.retry.count = 5
+  tm.commit.retry.count = 1
+  tm.rollback.retry.count = 1
+}
+
+## transaction log store
+store {
+  ## store mode: file、db
+  mode = "db"
+
+  ## file store
+  file {
+    dir = "sessionStore"
+
+    # branch session size , if exceeded first try compress lockkey, still exceeded throws exceptions
+    max-branch-session-size = 16384
+    # globe session size , if exceeded throws exceptions
+    max-global-session-size = 512
+    # file buffer size , if exceeded allocate new buffer
+    file-write-buffer-cache-size = 16384
+    # when recover batch read size
+    session.reload.read_size = 100
+    # async, sync
+    flush-disk-mode = async
+  }
+
+  ## database store
+  db {
+    ## the implement of javax.sql.DataSource, such as DruidDataSource(druid)/BasicDataSource(dbcp) etc.
+    datasource = "dbcp"
+    ## mysql/oracle/h2/oceanbase etc.
+    db-type = "mysql"
+    driver-class-name = "com.mysql.jdbc.Driver"
+    url = "jdbc:mysql://127.0.0.1:3306/seata"
+    user = "root"
+    password = "root"
+    min-conn = 1
+    max-conn = 3
+    global.table = "global_table"
+    branch.table = "branch_table"
+    lock-table = "lock_table"
+    query-limit = 100
+  }
+}
+lock {
+  ## the lock store mode: local、remote
+  mode = "remote"
+
+  local {
+    ## store locks in user's database
+  }
+
+  remote {
+    ## store locks in the seata's server
+  }
+}
+recovery {
+  #schedule committing retry period in milliseconds
+  committing-retry-period = 1000
+  #schedule asyn committing retry period in milliseconds
+  asyn-committing-retry-period = 1000
+  #schedule rollbacking retry period in milliseconds
+  rollbacking-retry-period = 1000
+  #schedule timeout retry period in milliseconds
+  timeout-retry-period = 1000
+}
+
+transaction {
+  undo.data.validation = true
+  undo.log.serialization = "jackson"
+  undo.log.save.days = 7
+  #schedule delete expired undo_log in milliseconds
+  undo.log.delete.period = 86400000
+  undo.log.table = "undo_log"
+}
+
+## metrics settings
+metrics {
+  enabled = false
+  registry-type = "compact"
+  # multi exporters use comma divided
+  exporter-list = "prometheus"
+  exporter-prometheus-port = 9898
+}
+
+support {
+  ## spring
+  spring {
+    # auto proxy the DataSource bean
+    datasource.autoproxy = false
+  }
+}

+ 22 - 0
springcloudalibabaVIP23/Storage-Module/src/main/resources/mapper/StorageMapper.xml

@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
+<mapper namespace="com.sf.dao.StorageDao">
+
+    <resultMap id="BaseResultMap" type="com.sf.domain.Storage">
+        <id column="id" property="id" jdbcType="BIGINT"/>
+        <result column="product_id" property="productId" jdbcType="BIGINT"/>
+        <result column="total" property="total" jdbcType="INTEGER"/>
+        <result column="used" property="used" jdbcType="INTEGER"/>
+        <result column="residue" property="residue" jdbcType="INTEGER"/>
+    </resultMap>
+
+    <update id="decrease">
+        UPDATE
+            t_storage
+        SET
+            used = used + #{count},residue = residue - #{count}
+        WHERE
+            product_id = #{productId}
+    </update>
+
+</mapper>

+ 73 - 0
springcloudalibabaVIP23/Storage-Module/src/main/resources/registry.conf

@@ -0,0 +1,73 @@
+registry {
+  # file 、nacos 、eureka、redis、zk、consul、etcd3、sofa
+  type = "nacos"
+
+  nacos {
+    serverAddr = "localhost:8848"
+    namespace = ""
+    cluster = "default"
+  }
+  eureka {
+    serviceUrl = "http://localhost:8761/eureka"
+    application = "default"
+    weight = "1"
+  }
+  redis {
+    serverAddr = "localhost:6379"
+    db = "0"
+  }
+  zk {
+    cluster = "default"
+    serverAddr = "127.0.0.1:2181"
+    session.timeout = 6000
+    connect.timeout = 2000
+  }
+  consul {
+    cluster = "default"
+    serverAddr = "127.0.0.1:8500"
+  }
+  etcd3 {
+    cluster = "default"
+    serverAddr = "http://localhost:2379"
+  }
+  sofa {
+    serverAddr = "127.0.0.1:9603"
+    application = "default"
+    region = "DEFAULT_ZONE"
+    datacenter = "DefaultDataCenter"
+    cluster = "default"
+    group = "SEATA_GROUP"
+    addressWaitTime = "3000"
+  }
+  file {
+    name = "file.conf"
+  }
+}
+
+config {
+  # file、nacos 、apollo、zk、consul、etcd3
+  type = "file"
+
+  nacos {
+    serverAddr = "localhost"
+    namespace = ""
+  }
+  consul {
+    serverAddr = "127.0.0.1:8500"
+  }
+  apollo {
+    app.id = "seata-server"
+    apollo.meta = "http://192.168.1.204:8801"
+  }
+  zk {
+    serverAddr = "127.0.0.1:2181"
+    session.timeout = 6000
+    connect.timeout = 2000
+  }
+  etcd3 {
+    serverAddr = "http://localhost:2379"
+  }
+  file {
+    name = "file.conf"
+  }
+}

+ 20 - 0
springcloudalibabaVIP23/Storage-Module/src/test/java/com/sf/AppTest.java

@@ -0,0 +1,20 @@
+package com.sf;
+
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+
+/**
+ * Unit test for simple App.
+ */
+public class AppTest 
+{
+    /**
+     * Rigorous Test :-)
+     */
+    @Test
+    public void shouldAnswerWithTrue()
+    {
+        assertTrue( true );
+    }
+}

+ 35 - 0
springcloudalibabaVIP23/Storage-Module/target/classes/application.yml

@@ -0,0 +1,35 @@
+server:
+  port: 2002
+spring:
+  application:
+    name: seata-storage-service
+  cloud:
+    alibaba:
+      seata:
+        tx-service-group: fsp_tx_group   #自定义事务组名称需要和seata-server中的对应
+    nacos:
+      discovery:
+        server-addr: localhost:8848
+  datasource:
+    driver-class-name: com.mysql.jdbc.Driver
+    url: jdbc:mysql://localhost:3306/seata_storage
+    username: root
+    password: root
+feign:
+  hystrix:
+    enabled: false
+  client:
+    config:
+      default:
+        connect-timeout: 30000
+        read-timeout: 30000
+logging:
+  level:
+    io:
+      seata: info
+mybatis:
+  mapperLocations: classpath:mapper/*.xml
+
+ribbon:
+  ReadTimeout: 2000
+  ConnectTimeout: 2000

BIN
springcloudalibabaVIP23/Storage-Module/target/classes/com/sf/SeataStorageServiceApplication2002.class


BIN
springcloudalibabaVIP23/Storage-Module/target/classes/com/sf/config/DataSourceProxyConfig.class


BIN
springcloudalibabaVIP23/Storage-Module/target/classes/com/sf/config/MybatisConfig.class


BIN
springcloudalibabaVIP23/Storage-Module/target/classes/com/sf/controller/StorageController.class


BIN
springcloudalibabaVIP23/Storage-Module/target/classes/com/sf/dao/StorageDao.class


BIN
springcloudalibabaVIP23/Storage-Module/target/classes/com/sf/domain/CommonResult.class


BIN
springcloudalibabaVIP23/Storage-Module/target/classes/com/sf/domain/Storage.class


BIN
springcloudalibabaVIP23/Storage-Module/target/classes/com/sf/service/StorageService.class


BIN
springcloudalibabaVIP23/Storage-Module/target/classes/com/sf/service/impl/StorageServiceImpl.class


+ 140 - 0
springcloudalibabaVIP23/Storage-Module/target/classes/file.conf

@@ -0,0 +1,140 @@
+transport {
+  # tcp udt unix-domain-socket
+  type = "TCP"
+  #NIO NATIVE
+  server = "NIO"
+  #enable heartbeat
+  heartbeat = true
+  #thread factory for netty
+  thread-factory {
+    boss-thread-prefix = "NettyBoss"
+    worker-thread-prefix = "NettyServerNIOWorker"
+    server-executor-thread-prefix = "NettyServerBizHandler"
+    share-boss-worker = false
+    client-selector-thread-prefix = "NettyClientSelector"
+    client-selector-thread-size = 1
+    client-worker-thread-prefix = "NettyClientWorkerThread"
+    # netty boss thread size,will not be used for UDT
+    boss-thread-size = 1
+    #auto default pin or 8
+    worker-thread-size = 8
+  }
+  shutdown {
+    # when destroy server, wait seconds
+    wait = 3
+  }
+  serialization = "seata"
+  compressor = "none"
+}
+service {
+  #vgroup->rgroup
+  vgroup_mapping.fsp_tx_group = "default"#修改自定义事务组的名称
+  #only support single node
+  default.grouplist = "127.0.0.1:8091"
+  #degrade current not support
+  enableDegrade = false
+  #disable
+  disable = false
+  #unit ms,s,m,h,d represents milliseconds, seconds, minutes, hours, days, default permanent
+  max.commit.retry.timeout = "-1"
+  max.rollback.retry.timeout = "-1"
+}
+
+client {
+  async.commit.buffer.limit = 10000
+  lock {
+    retry.internal = 10
+    retry.times = 30
+  }
+  report.retry.count = 5
+  tm.commit.retry.count = 1
+  tm.rollback.retry.count = 1
+}
+
+## transaction log store
+store {
+  ## store mode: file、db
+  mode = "db"
+
+  ## file store
+  file {
+    dir = "sessionStore"
+
+    # branch session size , if exceeded first try compress lockkey, still exceeded throws exceptions
+    max-branch-session-size = 16384
+    # globe session size , if exceeded throws exceptions
+    max-global-session-size = 512
+    # file buffer size , if exceeded allocate new buffer
+    file-write-buffer-cache-size = 16384
+    # when recover batch read size
+    session.reload.read_size = 100
+    # async, sync
+    flush-disk-mode = async
+  }
+
+  ## database store
+  db {
+    ## the implement of javax.sql.DataSource, such as DruidDataSource(druid)/BasicDataSource(dbcp) etc.
+    datasource = "dbcp"
+    ## mysql/oracle/h2/oceanbase etc.
+    db-type = "mysql"
+    driver-class-name = "com.mysql.jdbc.Driver"
+    url = "jdbc:mysql://127.0.0.1:3306/seata"
+    user = "root"
+    password = "root"
+    min-conn = 1
+    max-conn = 3
+    global.table = "global_table"
+    branch.table = "branch_table"
+    lock-table = "lock_table"
+    query-limit = 100
+  }
+}
+lock {
+  ## the lock store mode: local、remote
+  mode = "remote"
+
+  local {
+    ## store locks in user's database
+  }
+
+  remote {
+    ## store locks in the seata's server
+  }
+}
+recovery {
+  #schedule committing retry period in milliseconds
+  committing-retry-period = 1000
+  #schedule asyn committing retry period in milliseconds
+  asyn-committing-retry-period = 1000
+  #schedule rollbacking retry period in milliseconds
+  rollbacking-retry-period = 1000
+  #schedule timeout retry period in milliseconds
+  timeout-retry-period = 1000
+}
+
+transaction {
+  undo.data.validation = true
+  undo.log.serialization = "jackson"
+  undo.log.save.days = 7
+  #schedule delete expired undo_log in milliseconds
+  undo.log.delete.period = 86400000
+  undo.log.table = "undo_log"
+}
+
+## metrics settings
+metrics {
+  enabled = false
+  registry-type = "compact"
+  # multi exporters use comma divided
+  exporter-list = "prometheus"
+  exporter-prometheus-port = 9898
+}
+
+support {
+  ## spring
+  spring {
+    # auto proxy the DataSource bean
+    datasource.autoproxy = false
+  }
+}

+ 22 - 0
springcloudalibabaVIP23/Storage-Module/target/classes/mapper/StorageMapper.xml

@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
+<mapper namespace="com.sf.dao.StorageDao">
+
+    <resultMap id="BaseResultMap" type="com.sf.domain.Storage">
+        <id column="id" property="id" jdbcType="BIGINT"/>
+        <result column="product_id" property="productId" jdbcType="BIGINT"/>
+        <result column="total" property="total" jdbcType="INTEGER"/>
+        <result column="used" property="used" jdbcType="INTEGER"/>
+        <result column="residue" property="residue" jdbcType="INTEGER"/>
+    </resultMap>
+
+    <update id="decrease">
+        UPDATE
+            t_storage
+        SET
+            used = used + #{count},residue = residue - #{count}
+        WHERE
+            product_id = #{productId}
+    </update>
+
+</mapper>

+ 73 - 0
springcloudalibabaVIP23/Storage-Module/target/classes/registry.conf

@@ -0,0 +1,73 @@
+registry {
+  # file 、nacos 、eureka、redis、zk、consul、etcd3、sofa
+  type = "nacos"
+
+  nacos {
+    serverAddr = "localhost:8848"
+    namespace = ""
+    cluster = "default"
+  }
+  eureka {
+    serviceUrl = "http://localhost:8761/eureka"
+    application = "default"
+    weight = "1"
+  }
+  redis {
+    serverAddr = "localhost:6379"
+    db = "0"
+  }
+  zk {
+    cluster = "default"
+    serverAddr = "127.0.0.1:2181"
+    session.timeout = 6000
+    connect.timeout = 2000
+  }
+  consul {
+    cluster = "default"
+    serverAddr = "127.0.0.1:8500"
+  }
+  etcd3 {
+    cluster = "default"
+    serverAddr = "http://localhost:2379"
+  }
+  sofa {
+    serverAddr = "127.0.0.1:9603"
+    application = "default"
+    region = "DEFAULT_ZONE"
+    datacenter = "DefaultDataCenter"
+    cluster = "default"
+    group = "SEATA_GROUP"
+    addressWaitTime = "3000"
+  }
+  file {
+    name = "file.conf"
+  }
+}
+
+config {
+  # file、nacos 、apollo、zk、consul、etcd3
+  type = "file"
+
+  nacos {
+    serverAddr = "localhost"
+    namespace = ""
+  }
+  consul {
+    serverAddr = "127.0.0.1:8500"
+  }
+  apollo {
+    app.id = "seata-server"
+    apollo.meta = "http://192.168.1.204:8801"
+  }
+  zk {
+    serverAddr = "127.0.0.1:2181"
+    session.timeout = 6000
+    connect.timeout = 2000
+  }
+  etcd3 {
+    serverAddr = "http://localhost:2379"
+  }
+  file {
+    name = "file.conf"
+  }
+}

+ 134 - 0
springcloudalibabaVIP23/account-Module/pom.xml

@@ -0,0 +1,134 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <artifactId>springcloudalibabaVIP23</artifactId>
+        <groupId>com.sf</groupId>
+        <version>1.0-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>account-Module</artifactId>
+
+    <name>account-Module</name>
+    <!-- FIXME change it to the project's website -->
+    <url>http://www.example.com</url>
+
+    <properties>
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+        <maven.compiler.source>1.7</maven.compiler.source>
+        <maven.compiler.target>1.7</maven.compiler.target>
+    </properties>
+
+    <dependencies>
+        <!--nacos-->
+        <dependency>
+            <groupId>com.alibaba.cloud</groupId>
+            <artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
+        </dependency>
+        <!--seata-->
+        <dependency>
+            <groupId>com.alibaba.cloud</groupId>
+            <artifactId>spring-cloud-starter-alibaba-seata</artifactId>
+            <exclusions>
+                <exclusion>
+                    <artifactId>seata-all</artifactId>
+                    <groupId>io.seata</groupId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+        <dependency>
+            <groupId>io.seata</groupId>
+            <artifactId>seata-all</artifactId>
+            <version>0.9.0</version>
+        </dependency>
+        <!--feign-->
+        <dependency>
+            <groupId>org.springframework.cloud</groupId>
+            <artifactId>spring-cloud-starter-openfeign</artifactId>
+        </dependency>
+        <!--web-actuator-->
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-web</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-actuator</artifactId>
+        </dependency>
+        <!--mysql-druid-->
+        <dependency>
+            <groupId>mysql</groupId>
+            <artifactId>mysql-connector-java</artifactId>
+            <version>5.1.37</version>
+        </dependency>
+        <dependency>
+            <groupId>com.alibaba</groupId>
+            <artifactId>druid-spring-boot-starter</artifactId>
+            <version>1.1.10</version>
+        </dependency>
+        <dependency>
+            <groupId>org.mybatis.spring.boot</groupId>
+            <artifactId>mybatis-spring-boot-starter</artifactId>
+            <version>2.0.0</version>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-test</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.projectlombok</groupId>
+            <artifactId>lombok</artifactId>
+            <version>1.18.28</version>
+            <optional>true</optional>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <pluginManagement><!-- lock down plugins versions to avoid using Maven defaults (may be moved to parent pom) -->
+            <plugins>
+                <!-- clean lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#clean_Lifecycle -->
+                <plugin>
+                    <artifactId>maven-clean-plugin</artifactId>
+                    <version>3.1.0</version>
+                </plugin>
+                <!-- default lifecycle, jar packaging: see https://maven.apache.org/ref/current/maven-core/default-bindings.html#Plugin_bindings_for_jar_packaging -->
+                <plugin>
+                    <artifactId>maven-resources-plugin</artifactId>
+                    <version>3.0.2</version>
+                </plugin>
+                <plugin>
+                    <artifactId>maven-compiler-plugin</artifactId>
+                    <version>3.8.0</version>
+                </plugin>
+                <plugin>
+                    <artifactId>maven-surefire-plugin</artifactId>
+                    <version>2.22.1</version>
+                </plugin>
+                <plugin>
+                    <artifactId>maven-jar-plugin</artifactId>
+                    <version>3.0.2</version>
+                </plugin>
+                <plugin>
+                    <artifactId>maven-install-plugin</artifactId>
+                    <version>2.5.2</version>
+                </plugin>
+                <plugin>
+                    <artifactId>maven-deploy-plugin</artifactId>
+                    <version>2.8.2</version>
+                </plugin>
+                <!-- site lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#site_Lifecycle -->
+                <plugin>
+                    <artifactId>maven-site-plugin</artifactId>
+                    <version>3.7.1</version>
+                </plugin>
+                <plugin>
+                    <artifactId>maven-project-info-reports-plugin</artifactId>
+                    <version>3.0.0</version>
+                </plugin>
+            </plugins>
+        </pluginManagement>
+    </build>
+</project>

+ 16 - 0
springcloudalibabaVIP23/account-Module/src/main/java/com/sf/SeataAccountMainApp2003.java

@@ -0,0 +1,16 @@
+package com.sf;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
+import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
+import org.springframework.cloud.openfeign.EnableFeignClients;
+
+@EnableFeignClients
+@EnableDiscoveryClient
+@SpringBootApplication(exclude = DataSourceAutoConfiguration.class)  //取消数据源的自动创建,用我们自己配置的数据源,并且使用seata对数据源进行代理
+public class SeataAccountMainApp2003 {
+    public static void main(String[] args) {
+        SpringApplication.run(SeataAccountMainApp2003.class,args);
+    }
+}

+ 41 - 0
springcloudalibabaVIP23/account-Module/src/main/java/com/sf/config/DataSourceProxyConfig.java

@@ -0,0 +1,41 @@
+package com.sf.config;
+
+import com.alibaba.druid.pool.DruidDataSource;
+import io.seata.rm.datasource.DataSourceProxy;
+import org.apache.ibatis.session.SqlSessionFactory;
+import org.mybatis.spring.SqlSessionFactoryBean;
+import org.mybatis.spring.transaction.SpringManagedTransactionFactory;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
+
+import javax.sql.DataSource;
+
+
+/**
+ * 使用seata对数据源进行代理
+ */
+@Configuration
+public class DataSourceProxyConfig {
+    @Value("${mybatis.mapperLocations}")
+    private String mapperLocations;
+    @Bean
+    @ConfigurationProperties(prefix = "spring.datasource")
+    public DataSource druidDataSource(){
+        return new DruidDataSource();
+    }
+    @Bean
+    public DataSourceProxy dataSourceProxy(DataSource dataSource) {
+        return new DataSourceProxy(dataSource);
+    }
+    @Bean
+    public SqlSessionFactory sqlSessionFactoryBean(DataSourceProxy dataSourceProxy) throws Exception {
+        SqlSessionFactoryBean sqlSessionFactoryBean = new SqlSessionFactoryBean();
+        sqlSessionFactoryBean.setDataSource(dataSourceProxy);
+        sqlSessionFactoryBean.setMapperLocations(new PathMatchingResourcePatternResolver().getResources(mapperLocations));
+        sqlSessionFactoryBean.setTransactionFactory(new SpringManagedTransactionFactory());
+        return sqlSessionFactoryBean.getObject();
+    }
+}

+ 9 - 0
springcloudalibabaVIP23/account-Module/src/main/java/com/sf/config/MybatisConfig.java

@@ -0,0 +1,9 @@
+package com.sf.config;
+
+import org.mybatis.spring.annotation.MapperScan;
+import org.springframework.context.annotation.Configuration;
+
+@Configuration
+@MapperScan({"com.sf.dao"})
+public class MybatisConfig {
+}

+ 23 - 0
springcloudalibabaVIP23/account-Module/src/main/java/com/sf/controller/AccountController.java

@@ -0,0 +1,23 @@
+package com.sf.controller;
+
+import com.sf.domain.CommonResult;
+import com.sf.service.AccountService;
+import com.sf.service.impl.AccountServiceImpl;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.math.BigDecimal;
+
+@RestController
+public class AccountController {
+    @Autowired
+    private AccountService accountService;
+
+    @RequestMapping("/account/decrease")
+    public CommonResult decrease(@RequestParam("userId") Long userId, @RequestParam("money") BigDecimal money){
+        accountService.decrease(userId,money);
+        return new CommonResult(200,"扣减账户余额成功!");
+    }
+}

+ 14 - 0
springcloudalibabaVIP23/account-Module/src/main/java/com/sf/dao/AccountDao.java

@@ -0,0 +1,14 @@
+package com.sf.dao;
+
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.math.BigDecimal;
+
+@Mapper
+public interface AccountDao {
+    /**
+     * 扣减账户余额
+     */
+    void decrease(@Param("userId") Long userId, @Param("money") BigDecimal money);
+}

+ 31 - 0
springcloudalibabaVIP23/account-Module/src/main/java/com/sf/domain/Account.java

@@ -0,0 +1,31 @@
+package com.sf.domain;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.math.BigDecimal;
+
+@Data
+@NoArgsConstructor
+@AllArgsConstructor
+public class Account {
+
+    private Long id;
+    /**
+     * 用户id
+     */
+    private Long userId;
+    /**
+     * 总额度
+     */
+    private BigDecimal total;
+    /**
+     * 已用额度
+     */
+    private BigDecimal used;
+    /**
+     * 剩余额度
+     */
+    private BigDecimal residue;
+}

+ 18 - 0
springcloudalibabaVIP23/account-Module/src/main/java/com/sf/domain/CommonResult.java

@@ -0,0 +1,18 @@
+package com.sf.domain;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+public class CommonResult<T> {
+    private Integer code;
+    private String message;
+    private T data;
+
+    public CommonResult(Integer code, String message) {
+        this(code,message,null);
+    }
+}

+ 13 - 0
springcloudalibabaVIP23/account-Module/src/main/java/com/sf/service/AccountService.java

@@ -0,0 +1,13 @@
+package com.sf.service;
+
+import org.springframework.web.bind.annotation.RequestParam;
+
+import java.math.BigDecimal;
+
+public interface AccountService {
+    /**
+     * 扣减账户余额
+     */
+    void decrease(@RequestParam("userId") Long userId, @RequestParam("money") BigDecimal money);
+
+}

+ 22 - 0
springcloudalibabaVIP23/account-Module/src/main/java/com/sf/service/impl/AccountServiceImpl.java

@@ -0,0 +1,22 @@
+package com.sf.service.impl;
+
+import com.sf.dao.AccountDao;
+import com.sf.service.AccountService;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.math.BigDecimal;
+
+@Service
+@Slf4j
+public class AccountServiceImpl implements AccountService {
+    @Autowired
+    private AccountDao accountDao;
+    @Override
+    public void decrease(Long userId, BigDecimal money) {
+        log.info("------->account-service中扣减账户余额开始");
+        accountDao.decrease(userId,money);
+        log.info("------->account-service中扣减账户余额结束");
+    }
+}

+ 36 - 0
springcloudalibabaVIP23/account-Module/src/main/resources/application.yml

@@ -0,0 +1,36 @@
+server:
+  port: 2003
+spring:
+  application:
+    name: seata-account-service
+  cloud:
+    alibaba:
+      seata:
+        tx-service-group: fsp_tx_group   #自定义事务组名称需要和seata-server中的对应
+    nacos:
+      discovery:
+        server-addr: localhost:8848
+  datasource:
+    driver-class-name: com.mysql.jdbc.Driver
+    url: jdbc:mysql://localhost:3306/seata_account
+    username: root
+    password: root
+feign:
+  hystrix:
+    enabled: false
+  client:
+    config:
+      default:
+        connect-timeout: 100000
+        read-timeout: 100000
+logging:
+  level:
+    io:
+      seata: info
+mybatis:
+  mapperLocations: classpath:mapper/*.xml
+
+
+ribbon:
+  ReadTimeout: 2000
+  ConnectTimeout: 20000

+ 140 - 0
springcloudalibabaVIP23/account-Module/src/main/resources/file.conf

@@ -0,0 +1,140 @@
+transport {
+  # tcp udt unix-domain-socket
+  type = "TCP"
+  #NIO NATIVE
+  server = "NIO"
+  #enable heartbeat
+  heartbeat = true
+  #thread factory for netty
+  thread-factory {
+    boss-thread-prefix = "NettyBoss"
+    worker-thread-prefix = "NettyServerNIOWorker"
+    server-executor-thread-prefix = "NettyServerBizHandler"
+    share-boss-worker = false
+    client-selector-thread-prefix = "NettyClientSelector"
+    client-selector-thread-size = 1
+    client-worker-thread-prefix = "NettyClientWorkerThread"
+    # netty boss thread size,will not be used for UDT
+    boss-thread-size = 1
+    #auto default pin or 8
+    worker-thread-size = 8
+  }
+  shutdown {
+    # when destroy server, wait seconds
+    wait = 3
+  }
+  serialization = "seata"
+  compressor = "none"
+}
+service {
+  #vgroup->rgroup
+  vgroup_mapping.fsp_tx_group = "default"#修改自定义事务组的名称
+  #only support single node
+  default.grouplist = "127.0.0.1:8091"
+  #degrade current not support
+  enableDegrade = false
+  #disable
+  disable = false
+  #unit ms,s,m,h,d represents milliseconds, seconds, minutes, hours, days, default permanent
+  max.commit.retry.timeout = "-1"
+  max.rollback.retry.timeout = "-1"
+}
+
+client {
+  async.commit.buffer.limit = 10000
+  lock {
+    retry.internal = 10
+    retry.times = 30
+  }
+  report.retry.count = 5
+  tm.commit.retry.count = 1
+  tm.rollback.retry.count = 1
+}
+
+## transaction log store
+store {
+  ## store mode: file、db
+  mode = "db"
+
+  ## file store
+  file {
+    dir = "sessionStore"
+
+    # branch session size , if exceeded first try compress lockkey, still exceeded throws exceptions
+    max-branch-session-size = 16384
+    # globe session size , if exceeded throws exceptions
+    max-global-session-size = 512
+    # file buffer size , if exceeded allocate new buffer
+    file-write-buffer-cache-size = 16384
+    # when recover batch read size
+    session.reload.read_size = 100
+    # async, sync
+    flush-disk-mode = async
+  }
+
+  ## database store
+  db {
+    ## the implement of javax.sql.DataSource, such as DruidDataSource(druid)/BasicDataSource(dbcp) etc.
+    datasource = "dbcp"
+    ## mysql/oracle/h2/oceanbase etc.
+    db-type = "mysql"
+    driver-class-name = "com.mysql.jdbc.Driver"
+    url = "jdbc:mysql://127.0.0.1:3306/seata"
+    user = "root"
+    password = "root"
+    min-conn = 1
+    max-conn = 3
+    global.table = "global_table"
+    branch.table = "branch_table"
+    lock-table = "lock_table"
+    query-limit = 100
+  }
+}
+lock {
+  ## the lock store mode: local、remote
+  mode = "remote"
+
+  local {
+    ## store locks in user's database
+  }
+
+  remote {
+    ## store locks in the seata's server
+  }
+}
+recovery {
+  #schedule committing retry period in milliseconds
+  committing-retry-period = 1000
+  #schedule asyn committing retry period in milliseconds
+  asyn-committing-retry-period = 1000
+  #schedule rollbacking retry period in milliseconds
+  rollbacking-retry-period = 1000
+  #schedule timeout retry period in milliseconds
+  timeout-retry-period = 1000
+}
+
+transaction {
+  undo.data.validation = true
+  undo.log.serialization = "jackson"
+  undo.log.save.days = 7
+  #schedule delete expired undo_log in milliseconds
+  undo.log.delete.period = 86400000
+  undo.log.table = "undo_log"
+}
+
+## metrics settings
+metrics {
+  enabled = false
+  registry-type = "compact"
+  # multi exporters use comma divided
+  exporter-list = "prometheus"
+  exporter-prometheus-port = 9898
+}
+
+support {
+  ## spring
+  spring {
+    # auto proxy the DataSource bean
+    datasource.autoproxy = false
+  }
+}

+ 22 - 0
springcloudalibabaVIP23/account-Module/src/main/resources/mapper/AccountMapper.xml

@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
+
+<mapper namespace="com.sf.dao.AccountDao">
+
+    <resultMap id="BaseResultMap" type="com.sf.domain.Account">
+        <id column="id" property="id" jdbcType="BIGINT"/>
+        <result column="user_id" property="userId" jdbcType="BIGINT"/>
+        <result column="total" property="total" jdbcType="DECIMAL"/>
+        <result column="used" property="used" jdbcType="DECIMAL"/>
+        <result column="residue" property="residue" jdbcType="DECIMAL"/>
+    </resultMap>
+
+    <update id="decrease">
+        UPDATE t_account
+        SET
+            residue = residue - #{money},used = used + #{money}
+        WHERE
+            user_id = #{userId};
+    </update>
+
+</mapper>

+ 73 - 0
springcloudalibabaVIP23/account-Module/src/main/resources/registry.conf

@@ -0,0 +1,73 @@
+registry {
+  # file 、nacos 、eureka、redis、zk、consul、etcd3、sofa
+  type = "nacos"
+
+  nacos {
+    serverAddr = "localhost:8848"
+    namespace = ""
+    cluster = "default"
+  }
+  eureka {
+    serviceUrl = "http://localhost:8761/eureka"
+    application = "default"
+    weight = "1"
+  }
+  redis {
+    serverAddr = "localhost:6379"
+    db = "0"
+  }
+  zk {
+    cluster = "default"
+    serverAddr = "127.0.0.1:2181"
+    session.timeout = 6000
+    connect.timeout = 2000
+  }
+  consul {
+    cluster = "default"
+    serverAddr = "127.0.0.1:8500"
+  }
+  etcd3 {
+    cluster = "default"
+    serverAddr = "http://localhost:2379"
+  }
+  sofa {
+    serverAddr = "127.0.0.1:9603"
+    application = "default"
+    region = "DEFAULT_ZONE"
+    datacenter = "DefaultDataCenter"
+    cluster = "default"
+    group = "SEATA_GROUP"
+    addressWaitTime = "3000"
+  }
+  file {
+    name = "file.conf"
+  }
+}
+
+config {
+  # file、nacos 、apollo、zk、consul、etcd3
+  type = "file"
+
+  nacos {
+    serverAddr = "localhost"
+    namespace = ""
+  }
+  consul {
+    serverAddr = "127.0.0.1:8500"
+  }
+  apollo {
+    app.id = "seata-server"
+    apollo.meta = "http://192.168.1.204:8801"
+  }
+  zk {
+    serverAddr = "127.0.0.1:2181"
+    session.timeout = 6000
+    connect.timeout = 2000
+  }
+  etcd3 {
+    serverAddr = "http://localhost:2379"
+  }
+  file {
+    name = "file.conf"
+  }
+}

+ 20 - 0
springcloudalibabaVIP23/account-Module/src/test/java/com/sf/AppTest.java

@@ -0,0 +1,20 @@
+package com.sf;
+
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+
+/**
+ * Unit test for simple App.
+ */
+public class AppTest 
+{
+    /**
+     * Rigorous Test :-)
+     */
+    @Test
+    public void shouldAnswerWithTrue()
+    {
+        assertTrue( true );
+    }
+}

+ 36 - 0
springcloudalibabaVIP23/account-Module/target/classes/application.yml

@@ -0,0 +1,36 @@
+server:
+  port: 2003
+spring:
+  application:
+    name: seata-account-service
+  cloud:
+    alibaba:
+      seata:
+        tx-service-group: fsp_tx_group   #自定义事务组名称需要和seata-server中的对应
+    nacos:
+      discovery:
+        server-addr: localhost:8848
+  datasource:
+    driver-class-name: com.mysql.jdbc.Driver
+    url: jdbc:mysql://localhost:3306/seata_account
+    username: root
+    password: root
+feign:
+  hystrix:
+    enabled: false
+  client:
+    config:
+      default:
+        connect-timeout: 100000
+        read-timeout: 100000
+logging:
+  level:
+    io:
+      seata: info
+mybatis:
+  mapperLocations: classpath:mapper/*.xml
+
+
+ribbon:
+  ReadTimeout: 2000
+  ConnectTimeout: 20000

BIN
springcloudalibabaVIP23/account-Module/target/classes/com/sf/SeataAccountMainApp2003.class


BIN
springcloudalibabaVIP23/account-Module/target/classes/com/sf/config/DataSourceProxyConfig.class


BIN
springcloudalibabaVIP23/account-Module/target/classes/com/sf/config/MybatisConfig.class


BIN
springcloudalibabaVIP23/account-Module/target/classes/com/sf/controller/AccountController.class


BIN
springcloudalibabaVIP23/account-Module/target/classes/com/sf/dao/AccountDao.class


BIN
springcloudalibabaVIP23/account-Module/target/classes/com/sf/domain/Account.class


BIN
springcloudalibabaVIP23/account-Module/target/classes/com/sf/domain/CommonResult.class


BIN
springcloudalibabaVIP23/account-Module/target/classes/com/sf/service/AccountService.class


BIN
springcloudalibabaVIP23/account-Module/target/classes/com/sf/service/impl/AccountServiceImpl.class


+ 140 - 0
springcloudalibabaVIP23/account-Module/target/classes/file.conf

@@ -0,0 +1,140 @@
+transport {
+  # tcp udt unix-domain-socket
+  type = "TCP"
+  #NIO NATIVE
+  server = "NIO"
+  #enable heartbeat
+  heartbeat = true
+  #thread factory for netty
+  thread-factory {
+    boss-thread-prefix = "NettyBoss"
+    worker-thread-prefix = "NettyServerNIOWorker"
+    server-executor-thread-prefix = "NettyServerBizHandler"
+    share-boss-worker = false
+    client-selector-thread-prefix = "NettyClientSelector"
+    client-selector-thread-size = 1
+    client-worker-thread-prefix = "NettyClientWorkerThread"
+    # netty boss thread size,will not be used for UDT
+    boss-thread-size = 1
+    #auto default pin or 8
+    worker-thread-size = 8
+  }
+  shutdown {
+    # when destroy server, wait seconds
+    wait = 3
+  }
+  serialization = "seata"
+  compressor = "none"
+}
+service {
+  #vgroup->rgroup
+  vgroup_mapping.fsp_tx_group = "default"#修改自定义事务组的名称
+  #only support single node
+  default.grouplist = "127.0.0.1:8091"
+  #degrade current not support
+  enableDegrade = false
+  #disable
+  disable = false
+  #unit ms,s,m,h,d represents milliseconds, seconds, minutes, hours, days, default permanent
+  max.commit.retry.timeout = "-1"
+  max.rollback.retry.timeout = "-1"
+}
+
+client {
+  async.commit.buffer.limit = 10000
+  lock {
+    retry.internal = 10
+    retry.times = 30
+  }
+  report.retry.count = 5
+  tm.commit.retry.count = 1
+  tm.rollback.retry.count = 1
+}
+
+## transaction log store
+store {
+  ## store mode: file、db
+  mode = "db"
+
+  ## file store
+  file {
+    dir = "sessionStore"
+
+    # branch session size , if exceeded first try compress lockkey, still exceeded throws exceptions
+    max-branch-session-size = 16384
+    # globe session size , if exceeded throws exceptions
+    max-global-session-size = 512
+    # file buffer size , if exceeded allocate new buffer
+    file-write-buffer-cache-size = 16384
+    # when recover batch read size
+    session.reload.read_size = 100
+    # async, sync
+    flush-disk-mode = async
+  }
+
+  ## database store
+  db {
+    ## the implement of javax.sql.DataSource, such as DruidDataSource(druid)/BasicDataSource(dbcp) etc.
+    datasource = "dbcp"
+    ## mysql/oracle/h2/oceanbase etc.
+    db-type = "mysql"
+    driver-class-name = "com.mysql.jdbc.Driver"
+    url = "jdbc:mysql://127.0.0.1:3306/seata"
+    user = "root"
+    password = "root"
+    min-conn = 1
+    max-conn = 3
+    global.table = "global_table"
+    branch.table = "branch_table"
+    lock-table = "lock_table"
+    query-limit = 100
+  }
+}
+lock {
+  ## the lock store mode: local、remote
+  mode = "remote"
+
+  local {
+    ## store locks in user's database
+  }
+
+  remote {
+    ## store locks in the seata's server
+  }
+}
+recovery {
+  #schedule committing retry period in milliseconds
+  committing-retry-period = 1000
+  #schedule asyn committing retry period in milliseconds
+  asyn-committing-retry-period = 1000
+  #schedule rollbacking retry period in milliseconds
+  rollbacking-retry-period = 1000
+  #schedule timeout retry period in milliseconds
+  timeout-retry-period = 1000
+}
+
+transaction {
+  undo.data.validation = true
+  undo.log.serialization = "jackson"
+  undo.log.save.days = 7
+  #schedule delete expired undo_log in milliseconds
+  undo.log.delete.period = 86400000
+  undo.log.table = "undo_log"
+}
+
+## metrics settings
+metrics {
+  enabled = false
+  registry-type = "compact"
+  # multi exporters use comma divided
+  exporter-list = "prometheus"
+  exporter-prometheus-port = 9898
+}
+
+support {
+  ## spring
+  spring {
+    # auto proxy the DataSource bean
+    datasource.autoproxy = false
+  }
+}

+ 22 - 0
springcloudalibabaVIP23/account-Module/target/classes/mapper/AccountMapper.xml

@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
+
+<mapper namespace="com.sf.dao.AccountDao">
+
+    <resultMap id="BaseResultMap" type="com.sf.domain.Account">
+        <id column="id" property="id" jdbcType="BIGINT"/>
+        <result column="user_id" property="userId" jdbcType="BIGINT"/>
+        <result column="total" property="total" jdbcType="DECIMAL"/>
+        <result column="used" property="used" jdbcType="DECIMAL"/>
+        <result column="residue" property="residue" jdbcType="DECIMAL"/>
+    </resultMap>
+
+    <update id="decrease">
+        UPDATE t_account
+        SET
+            residue = residue - #{money},used = used + #{money}
+        WHERE
+            user_id = #{userId};
+    </update>
+
+</mapper>

+ 73 - 0
springcloudalibabaVIP23/account-Module/target/classes/registry.conf

@@ -0,0 +1,73 @@
+registry {
+  # file 、nacos 、eureka、redis、zk、consul、etcd3、sofa
+  type = "nacos"
+
+  nacos {
+    serverAddr = "localhost:8848"
+    namespace = ""
+    cluster = "default"
+  }
+  eureka {
+    serviceUrl = "http://localhost:8761/eureka"
+    application = "default"
+    weight = "1"
+  }
+  redis {
+    serverAddr = "localhost:6379"
+    db = "0"
+  }
+  zk {
+    cluster = "default"
+    serverAddr = "127.0.0.1:2181"
+    session.timeout = 6000
+    connect.timeout = 2000
+  }
+  consul {
+    cluster = "default"
+    serverAddr = "127.0.0.1:8500"
+  }
+  etcd3 {
+    cluster = "default"
+    serverAddr = "http://localhost:2379"
+  }
+  sofa {
+    serverAddr = "127.0.0.1:9603"
+    application = "default"
+    region = "DEFAULT_ZONE"
+    datacenter = "DefaultDataCenter"
+    cluster = "default"
+    group = "SEATA_GROUP"
+    addressWaitTime = "3000"
+  }
+  file {
+    name = "file.conf"
+  }
+}
+
+config {
+  # file、nacos 、apollo、zk、consul、etcd3
+  type = "file"
+
+  nacos {
+    serverAddr = "localhost"
+    namespace = ""
+  }
+  consul {
+    serverAddr = "127.0.0.1:8500"
+  }
+  apollo {
+    app.id = "seata-server"
+    apollo.meta = "http://192.168.1.204:8801"
+  }
+  zk {
+    serverAddr = "127.0.0.1:2181"
+    session.timeout = 6000
+    connect.timeout = 2000
+  }
+  etcd3 {
+    serverAddr = "http://localhost:2379"
+  }
+  file {
+    name = "file.conf"
+  }
+}

+ 2 - 0
springcloudalibabaVIP23/pom.xml

@@ -18,6 +18,8 @@
       <module>cloudalibaba-provider-payment9004</module>
       <module>cloudalibaba-consumer-nacos-order84</module>
       <module>seata-order-service2001</module>
+      <module>Storage-Module</module>
+      <module>account-Module</module>
   </modules>
   <packaging>pom</packaging>
 

+ 20 - 0
springcloudalibabaVIP23/seata-order-service2001/src/main/java/com/sf/service/AccountService.java

@@ -0,0 +1,20 @@
+package com.sf.service;
+
+import com.sf.domain.CommonResult;
+import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+
+import java.math.BigDecimal;
+
+@FeignClient(value = "seata-account-service")
+public interface AccountService {
+    /**
+     * 用户账户做扣减操作,,扣钱
+     * @param userId     给哪个用户扣钱
+     * @param money       扣多少钱
+     * @return
+     */
+    @PostMapping(value = "/account/decrease")
+    CommonResult decrease(@RequestParam("userId") Long userId, @RequestParam("money") BigDecimal money);
+}

+ 18 - 0
springcloudalibabaVIP23/seata-order-service2001/src/main/java/com/sf/service/StorageService.java

@@ -0,0 +1,18 @@
+package com.sf.service;
+
+import com.sf.domain.CommonResult;
+import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+
+@FeignClient(value = "seata-storage-service")    //通过openfeign调用库存模块的减库存接口
+public interface StorageService {
+    /**
+     * 做减库存的操作
+     * productId : 减少哪个商品的库存
+     * count:此商品库存减少的数量
+     */
+
+    @PostMapping(value = "/storage/decrease")
+    CommonResult decrease(@RequestParam("productId") Long productId, @RequestParam("count") Integer count);
+}

+ 18 - 2
springcloudalibabaVIP23/seata-order-service2001/src/main/java/com/sf/service/impl/OrderServiceImpl.java

@@ -2,7 +2,9 @@ package com.sf.service.impl;
 
 import com.sf.dao.OrderDao;
 import com.sf.domain.Order;
+import com.sf.service.AccountService;
 import com.sf.service.OrderService;
+import com.sf.service.StorageService;
 import io.seata.spring.annotation.GlobalTransactional;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -13,11 +15,25 @@ import org.springframework.stereotype.Service;
 public class OrderServiceImpl implements OrderService {
     @Autowired
     private OrderDao orderDao;
+    @Autowired
+    private StorageService storageService;
+    @Autowired
+    private AccountService accountService;
+    @GlobalTransactional(rollbackFor = RuntimeException.class)
     @Override
     public void create(Order order) {
-     log.info("创建订单开始啦...");
+        log.info("创建订单开始啦...");
         orderDao.create(order);
-        log.info("扣减库存");
+        log.info("扣减库存开始...");
+        int a = 1/0;
+        storageService.decrease(order.getProductId(),order.getCount());
+        log.info("扣减库存结束...");
+        log.info("扣减账户余额开始...");
+        accountService.decrease(order.getUserId(),order.getMoney());
+        log.info("扣减账户余额结束...");
+        log.info("修改订单的状态");
+        orderDao.update(order.getUserId(),1);
 
+        log.info("----下订单结束啦");
     }
 }

+ 1 - 1
springcloudalibabaVIP23/seata-order-service2001/src/main/resources/application.yml

@@ -12,7 +12,7 @@ spring:
         server-addr: localhost:8848
   datasource:
     driver-class-name: com.mysql.jdbc.Driver
-    url: jdbc:mysql://localhost:3306/seata_account
+    url: jdbc:mysql://localhost:3306/seata_order
     username: root
     password: root
 feign:

+ 36 - 0
springcloudalibabaVIP23/seata-order-service2001/target/classes/application.yml

@@ -0,0 +1,36 @@
+server:
+  port: 2001
+spring:
+  application:
+    name: seata-order-service
+  cloud:
+    alibaba:
+      seata:
+        tx-service-group: fsp_tx_group   #自定义事务组名称需要和seata-server中的对应
+    nacos:
+      discovery:
+        server-addr: localhost:8848
+  datasource:
+    driver-class-name: com.mysql.jdbc.Driver
+    url: jdbc:mysql://localhost:3306/seata_order
+    username: root
+    password: root
+feign:
+  hystrix:
+    enabled: false
+  client:
+    config:
+      default:
+        connect-timeout: 30000
+        read-timeout: 30000
+logging:
+  level:
+    io:
+      seata: info
+mybatis:
+  mapperLocations: classpath:mapper/*.xml
+
+
+ribbon:
+  ReadTimeout: 2000
+  ConnectTimeout: 2000

BIN
springcloudalibabaVIP23/seata-order-service2001/target/classes/com/sf/SeataOrderMainApp2001.class


BIN
springcloudalibabaVIP23/seata-order-service2001/target/classes/com/sf/config/DataSourceProxyConfig.class


BIN
springcloudalibabaVIP23/seata-order-service2001/target/classes/com/sf/config/MybatisConfig.class


BIN
springcloudalibabaVIP23/seata-order-service2001/target/classes/com/sf/controller/OrderController.class


BIN
springcloudalibabaVIP23/seata-order-service2001/target/classes/com/sf/dao/OrderDao.class


BIN
springcloudalibabaVIP23/seata-order-service2001/target/classes/com/sf/domain/CommonResult.class


BIN
springcloudalibabaVIP23/seata-order-service2001/target/classes/com/sf/domain/Order.class


BIN
springcloudalibabaVIP23/seata-order-service2001/target/classes/com/sf/service/AccountService.class


BIN
springcloudalibabaVIP23/seata-order-service2001/target/classes/com/sf/service/OrderService.class


BIN
springcloudalibabaVIP23/seata-order-service2001/target/classes/com/sf/service/StorageService.class


BIN
springcloudalibabaVIP23/seata-order-service2001/target/classes/com/sf/service/impl/OrderServiceImpl.class


+ 140 - 0
springcloudalibabaVIP23/seata-order-service2001/target/classes/file.conf

@@ -0,0 +1,140 @@
+transport {
+  # tcp udt unix-domain-socket
+  type = "TCP"
+  #NIO NATIVE
+  server = "NIO"
+  #enable heartbeat
+  heartbeat = true
+  #thread factory for netty
+  thread-factory {
+    boss-thread-prefix = "NettyBoss"
+    worker-thread-prefix = "NettyServerNIOWorker"
+    server-executor-thread-prefix = "NettyServerBizHandler"
+    share-boss-worker = false
+    client-selector-thread-prefix = "NettyClientSelector"
+    client-selector-thread-size = 1
+    client-worker-thread-prefix = "NettyClientWorkerThread"
+    # netty boss thread size,will not be used for UDT
+    boss-thread-size = 1
+    #auto default pin or 8
+    worker-thread-size = 8
+  }
+  shutdown {
+    # when destroy server, wait seconds
+    wait = 3
+  }
+  serialization = "seata"
+  compressor = "none"
+}
+service {
+  #vgroup->rgroup
+  vgroup_mapping.fsp_tx_group = "default"#修改自定义事务组的名称
+  #only support single node
+  default.grouplist = "127.0.0.1:8091"
+  #degrade current not support
+  enableDegrade = false
+  #disable
+  disable = false
+  #unit ms,s,m,h,d represents milliseconds, seconds, minutes, hours, days, default permanent
+  max.commit.retry.timeout = "-1"
+  max.rollback.retry.timeout = "-1"
+}
+
+client {
+  async.commit.buffer.limit = 10000
+  lock {
+    retry.internal = 10
+    retry.times = 30
+  }
+  report.retry.count = 5
+  tm.commit.retry.count = 1
+  tm.rollback.retry.count = 1
+}
+
+## transaction log store
+store {
+  ## store mode: file、db
+  mode = "db"
+
+  ## file store
+  file {
+    dir = "sessionStore"
+
+    # branch session size , if exceeded first try compress lockkey, still exceeded throws exceptions
+    max-branch-session-size = 16384
+    # globe session size , if exceeded throws exceptions
+    max-global-session-size = 512
+    # file buffer size , if exceeded allocate new buffer
+    file-write-buffer-cache-size = 16384
+    # when recover batch read size
+    session.reload.read_size = 100
+    # async, sync
+    flush-disk-mode = async
+  }
+
+  ## database store
+  db {
+    ## the implement of javax.sql.DataSource, such as DruidDataSource(druid)/BasicDataSource(dbcp) etc.
+    datasource = "dbcp"
+    ## mysql/oracle/h2/oceanbase etc.
+    db-type = "mysql"
+    driver-class-name = "com.mysql.jdbc.Driver"
+    url = "jdbc:mysql://127.0.0.1:3306/seata"
+    user = "root"
+    password = "root"
+    min-conn = 1
+    max-conn = 3
+    global.table = "global_table"
+    branch.table = "branch_table"
+    lock-table = "lock_table"
+    query-limit = 100
+  }
+}
+lock {
+  ## the lock store mode: local、remote
+  mode = "remote"
+
+  local {
+    ## store locks in user's database
+  }
+
+  remote {
+    ## store locks in the seata's server
+  }
+}
+recovery {
+  #schedule committing retry period in milliseconds
+  committing-retry-period = 1000
+  #schedule asyn committing retry period in milliseconds
+  asyn-committing-retry-period = 1000
+  #schedule rollbacking retry period in milliseconds
+  rollbacking-retry-period = 1000
+  #schedule timeout retry period in milliseconds
+  timeout-retry-period = 1000
+}
+
+transaction {
+  undo.data.validation = true
+  undo.log.serialization = "jackson"
+  undo.log.save.days = 7
+  #schedule delete expired undo_log in milliseconds
+  undo.log.delete.period = 86400000
+  undo.log.table = "undo_log"
+}
+
+## metrics settings
+metrics {
+  enabled = false
+  registry-type = "compact"
+  # multi exporters use comma divided
+  exporter-list = "prometheus"
+  exporter-prometheus-port = 9898
+}
+
+support {
+  ## spring
+  spring {
+    # auto proxy the DataSource bean
+    datasource.autoproxy = false
+  }
+}

+ 24 - 0
springcloudalibabaVIP23/seata-order-service2001/target/classes/mapper/OrderMapper.xml

@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
+
+<mapper namespace="com.sf.dao.OrderDao">
+
+    <resultMap id="BaseResultMap" type="com.sf.domain.Order">
+        <id column="id" property="id" jdbcType="BIGINT"/>
+        <result column="user_id" property="userId" jdbcType="BIGINT"/>
+        <result column="product_id" property="productId" jdbcType="BIGINT"/>
+        <result column="count" property="count" jdbcType="INTEGER"/>
+        <result column="money" property="money" jdbcType="DECIMAL"/>
+        <result column="status" property="status" jdbcType="INTEGER"/>
+    </resultMap>
+
+    <insert id="create" parameterType="com.sf.domain.Order">
+        insert into t_order (id,user_id,product_id,count,money,status)
+        values (null,#{userId},#{productId},#{count},#{money},0);
+    </insert>
+
+    <update id="update">
+        update t_order set status = 1 where user_id=#{userId} and status = #{status};
+    </update>
+
+</mapper>

+ 73 - 0
springcloudalibabaVIP23/seata-order-service2001/target/classes/registry.conf

@@ -0,0 +1,73 @@
+registry {
+  # file 、nacos 、eureka、redis、zk、consul、etcd3、sofa
+  type = "nacos"
+
+  nacos {
+    serverAddr = "localhost:8848"
+    namespace = ""
+    cluster = "default"
+  }
+  eureka {
+    serviceUrl = "http://localhost:8761/eureka"
+    application = "default"
+    weight = "1"
+  }
+  redis {
+    serverAddr = "localhost:6379"
+    db = "0"
+  }
+  zk {
+    cluster = "default"
+    serverAddr = "127.0.0.1:2181"
+    session.timeout = 6000
+    connect.timeout = 2000
+  }
+  consul {
+    cluster = "default"
+    serverAddr = "127.0.0.1:8500"
+  }
+  etcd3 {
+    cluster = "default"
+    serverAddr = "http://localhost:2379"
+  }
+  sofa {
+    serverAddr = "127.0.0.1:9603"
+    application = "default"
+    region = "DEFAULT_ZONE"
+    datacenter = "DefaultDataCenter"
+    cluster = "default"
+    group = "SEATA_GROUP"
+    addressWaitTime = "3000"
+  }
+  file {
+    name = "file.conf"
+  }
+}
+
+config {
+  # file、nacos 、apollo、zk、consul、etcd3
+  type = "file"
+
+  nacos {
+    serverAddr = "localhost"
+    namespace = ""
+  }
+  consul {
+    serverAddr = "127.0.0.1:8500"
+  }
+  apollo {
+    app.id = "seata-server"
+    apollo.meta = "http://192.168.1.204:8801"
+  }
+  zk {
+    serverAddr = "127.0.0.1:2181"
+    session.timeout = 6000
+    connect.timeout = 2000
+  }
+  etcd3 {
+    serverAddr = "http://localhost:2379"
+  }
+  file {
+    name = "file.conf"
+  }
+}