Veronique vor 1 Jahr
Commit
d617978d85
100 geänderte Dateien mit 42574 neuen und 0 gelöschten Zeilen
  1. 39 0
      .gitignore
  2. 80 0
      conf/KeyCode.xml
  3. 427 0
      conf/KeyId.xml
  4. 69 0
      conf/Rest接口Call InvokeCallParams方法文档示例和说明.xml
  5. 1370 0
      conf/addressdata/cities.json
  6. 13354 0
      conf/addressdata/counties.json
  7. 126 0
      conf/addressdata/provices.json
  8. 64 0
      conf/apiFiles/expressOut.xml
  9. 128 0
      conf/apiFiles/orderProcess.xml
  10. 317 0
      conf/application-yjWebOne.xml
  11. 17374 0
      conf/emojis.json
  12. 33 0
      conf/esTemplate/dataPurview.json
  13. 119 0
      conf/esTemplate/docIndex.json
  14. 52 0
      conf/esTemplate/inquirecondition.json
  15. 41 0
      conf/esTemplate/inquiremaininfo.json
  16. 58 0
      conf/esTemplate/inquireresultcolumn.json
  17. 27 0
      conf/esTemplate/oplog.json
  18. 103 0
      conf/esTemplate/supplierinfo.json
  19. 51 0
      conf/esTemplate/sysmessage.json
  20. 39 0
      conf/esTemplate/sysmessagestatus.json
  21. 33 0
      conf/esTemplate/sysmessagetext.json
  22. 75 0
      conf/eskeys.properties
  23. 77 0
      conf/log4j2-sweetfish.yml
  24. 34 0
      conf/redis.properties
  25. 141 0
      conf/rediskeys.properties
  26. 85 0
      conf/redisscript/balance_client_moneys.lua
  27. 11 0
      conf/redisscript/formtoken.lua
  28. 33 0
      conf/redisscript/hincrby_multiple.lua
  29. 13 0
      conf/redisscript/lget_ldel.lua
  30. 146 0
      conf/redisscript/lock_data.lua
  31. 24 0
      conf/redisscript/lock_order.lua
  32. 48 0
      conf/redisscript/lock_order_designer.lua
  33. 57 0
      conf/redisscript/qty_stock_material.lua
  34. 198 0
      conf/redisscript/qty_stock_materials.lua
  35. 102 0
      conf/redisscript/qty_stock_precise.lua
  36. 118 0
      conf/redisscript/qty_stock_virtual.lua
  37. 110 0
      conf/redisscript/qty_stock_virtual_can_negative.lua
  38. 36 0
      conf/redisscript/que_pop.lua
  39. 53 0
      conf/redisscript/tablecode.lua
  40. 17 0
      conf/rexdb-pro.properties
  41. 53 0
      conf/rexdb-yjWebOne.xml
  42. 8 0
      conf/script/1000/addressparser/AreaEnum.groovy
  43. 226 0
      conf/script/1000/addressparser/BE_MapAddressUpdate2.groovy
  44. 804 0
      conf/script/1000/addressparser/BE_ParseAddress.groovy
  45. 136 0
      conf/script/1000/business/BE_DocClearScriptCache.groovy
  46. 220 0
      conf/script/1000/business/BE_ERPLogin.groovy
  47. 50 0
      conf/script/1000/business/BE_IndexCardPanelData.groovy
  48. 35 0
      conf/script/1000/business/BE_Init_ExpandoGroovy.groovy
  49. 62 0
      conf/script/1000/business/BE_PlateForm_CodeList.groovy
  50. 150 0
      conf/script/1000/commons/ESList.groovy
  51. 123 0
      conf/script/1000/commons/ESMap.groovy
  52. 83 0
      conf/script/1000/commons/ESOne.groovy
  53. 16 0
      conf/script/1000/commons/ExecPageFlipper.groovy
  54. 33 0
      conf/script/1000/commons/GroovyExtensions.groovy
  55. 27 0
      conf/script/1000/commons/QT.groovy
  56. 3 0
      conf/script/1000/init/First_1_ApplyGroovyExt.groovy
  57. 16 0
      conf/script/1000/init/Ignore_ExecPageFlipper.groovy
  58. 21 0
      conf/script/1000/init/Ignore_GroovyExtensions.groovy
  59. 40 0
      conf/script/1000/init/Ignore_ReadUTF8File.groovy
  60. 101 0
      conf/script/1000/init/Init_10_Inquire.groovy
  61. 25 0
      conf/script/1000/init/Init_11_NoticeMessage.groovy
  62. 31 0
      conf/script/1000/init/Init_12_UserNoticeMessage.groovy
  63. 31 0
      conf/script/1000/init/Init_13_SysMsg.groovy
  64. 41 0
      conf/script/1000/init/Init_1_Menu.groovy
  65. 29 0
      conf/script/1000/init/Init_29_CompanyInfo.groovy
  66. 11 0
      conf/script/1000/init/Init_2_Role.groovy
  67. 64 0
      conf/script/1000/init/Init_3_Config.groovy
  68. 40 0
      conf/script/1000/init/Init_4_LoginUser.groovy
  69. 27 0
      conf/script/1000/init/Init_5_Dept.groovy
  70. 33 0
      conf/script/1000/init/Init_6_PersonConfig.groovy
  71. 53 0
      conf/script/1000/init/Init_7_DataPurview.groovy
  72. 46 0
      conf/script/1000/init/Init_8_Dict.groovy
  73. 36 0
      conf/script/1000/init/Init_9_Script.groovy
  74. 63 0
      conf/script/1000/init/Run_1_Script2DataBase.groovy
  75. 60 0
      conf/script/1000/init/Schedule_1_60_300_SysMsgExpire.groovy
  76. 10 0
      conf/script/1000/init/Time_1_D_0_10_42_05_TestTime1.groovy
  77. 11 0
      conf/script/1000/init/Time_2_M_02_10_42_07_TestTime2.groovy
  78. 219 0
      conf/script/1000/sync/BE_BusinessOrder_SyncDataBase2ES.groovy
  79. 175 0
      conf/sqlroot/com/yinjie/heating/business/dao/ClientDao.dql
  80. 194 0
      conf/sqlroot/com/yinjie/heating/business/dao/DocDao.dql
  81. 16 0
      conf/sqlroot/com/yinjie/heating/business/dao/LoginDao.dql
  82. 36 0
      conf/sqlroot/com/yinjie/heating/business/dao/SupplierDao.dql
  83. 608 0
      conf/sqlroot/com/yinjie/heating/business/dao/SystemDao.dql
  84. 450 0
      conf/初始化业务表.sql
  85. 11 0
      conf/启动更新sql模板.sql
  86. 75 0
      pom.xml
  87. 28 0
      yjBusiness/pom.xml
  88. 137 0
      yjBusiness/src/main/java/com/yinjie/heating/business/dao/DocDao.java
  89. 15 0
      yjBusiness/src/main/java/com/yinjie/heating/business/dao/LoginDao.java
  90. 24 0
      yjBusiness/src/main/java/com/yinjie/heating/business/dao/OrderTableShardingStrategy.java
  91. 16 0
      yjBusiness/src/main/java/com/yinjie/heating/business/dao/SupplierDataBaseShardingStrategy.java
  92. 10 0
      yjBusiness/src/main/java/com/yinjie/heating/business/dao/SupplierTableShardingStrategy.java
  93. 397 0
      yjBusiness/src/main/java/com/yinjie/heating/business/dao/SystemDao.java
  94. 16 0
      yjBusiness/src/main/java/com/yinjie/heating/business/dao/TableIdShardingStrategy.java
  95. 389 0
      yjBusiness/src/main/java/com/yinjie/heating/business/service/ConfigServiceImpl.java
  96. 287 0
      yjBusiness/src/main/java/com/yinjie/heating/business/service/DeptServiceImpl.java
  97. 409 0
      yjBusiness/src/main/java/com/yinjie/heating/business/service/DictServiceImpl.java
  98. 878 0
      yjBusiness/src/main/java/com/yinjie/heating/business/service/DocInfoServiceImpl.java
  99. 84 0
      yjBusiness/src/main/java/com/yinjie/heating/business/service/ERPServiceImpl.java
  100. 0 0
      yjBusiness/src/main/java/com/yinjie/heating/business/service/LoginServiceImpl.java

+ 39 - 0
.gitignore

@@ -0,0 +1,39 @@
+target/
+!.mvn/wrapper/maven-wrapper.jar
+!**/src/main/**/target/
+!**/src/test/**/target/
+
+### IntelliJ IDEA ###
+.idea/modules.xml
+.idea/jarRepositories.xml
+.idea/compiler.xml
+.idea/libraries/
+*.iws
+*.iml
+*.ipr
+
+### Eclipse ###
+.apt_generated
+.classpath
+.factorypath
+.project
+.settings
+.springBeans
+.sts4-cache
+
+### NetBeans ###
+/nbproject/private/
+/nbbuild/
+/dist/
+/nbdist/
+/.nb-gradle/
+build/
+!**/src/main/**/build/
+!**/src/test/**/build/
+
+### VS Code ###
+.vscode/
+
+### Mac OS ###
+.DS_Store
+/.idea/

+ 80 - 0
conf/KeyCode.xml

@@ -0,0 +1,80 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Items>
+    <Item>
+        <CodeName>tbDept.code</CodeName>
+        <TableName>tbDept</TableName>
+        <CodeFieldName>deptCode</CodeFieldName>
+        <CodePrefix/>
+        <CodeYear>false</CodeYear>
+        <YearLength>4</YearLength>
+        <CodeMonth>false</CodeMonth>
+        <CodeDay>false</CodeDay>
+        <CodeLength>3</CodeLength>
+        <TableWhere/>
+    </Item>
+
+    <Item>
+        <CodeName>tbUser.Code</CodeName>
+        <TableName>tbUser</TableName>
+        <CodeFieldName>userCode</CodeFieldName>
+        <CodePrefix/>
+        <CodeYear>false</CodeYear>
+        <YearLength>4</YearLength>
+        <CodeMonth>false</CodeMonth>
+        <CodeDay>false</CodeDay>
+        <CodeLength>4</CodeLength>
+        <TableWhere/>
+    </Item>
+
+    <Item>
+        <CodeName>tbMaterialInfoType.code</CodeName>
+        <TableName>tbMaterialInfoType</TableName>
+        <CodeFieldName>materialTypeCode</CodeFieldName>
+        <CodePrefix/>
+        <CodeYear>false</CodeYear>
+        <YearLength>4</YearLength>
+        <CodeMonth>false</CodeMonth>
+        <CodeDay>false</CodeDay>
+        <CodeLength>2</CodeLength>
+        <TableWhere/>
+    </Item>
+
+    <Item>
+        <CodeName>tbPaperInfoType.code</CodeName>
+        <TableName>tbPaperInfoType</TableName>
+        <CodeFieldName>paperTypeCode</CodeFieldName>
+        <CodePrefix/>
+        <CodeYear>false</CodeYear>
+        <YearLength>4</YearLength>
+        <CodeMonth>false</CodeMonth>
+        <CodeDay>false</CodeDay>
+        <CodeLength>4</CodeLength>
+        <TableWhere/>
+    </Item>
+
+    <Item>
+        <CodeName>deBusinessOrder.code</CodeName>
+        <TableName>v_deBusinessOrder</TableName>
+        <CodeFieldName>orderCode</CodeFieldName>
+        <CodePrefix>BS</CodePrefix>
+        <CodeYear>true</CodeYear>
+        <YearLength>4</YearLength>
+        <CodeMonth>true</CodeMonth>
+        <CodeDay>true</CodeDay>
+        <CodeLength>4</CodeLength>
+        <TableWhere/>
+    </Item>
+
+    <Item>
+        <CodeName>deOrderAfterSaleBill.code</CodeName>
+        <TableName>v_deOrderAfterSaleBill</TableName>
+        <CodeFieldName>billCode</CodeFieldName>
+        <CodePrefix>AS</CodePrefix>
+        <CodeYear>true</CodeYear>
+        <YearLength>4</YearLength>
+        <CodeMonth>true</CodeMonth>
+        <CodeDay>true</CodeDay>
+        <CodeLength>4</CodeLength>
+        <TableWhere/>
+    </Item>
+</Items>

+ 427 - 0
conf/KeyId.xml

@@ -0,0 +1,427 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Items>
+    <Item>
+        <IDName>tbDictType.id</IDName>
+        <Table>
+            <TableName>tbDictType</TableName>
+            <IDFieldName>id</IDFieldName>
+            <TableWhere/>
+        </Table>
+    </Item>
+
+    <Item>
+        <IDName>tbDictData.id</IDName>
+        <Table>
+            <TableName>tbDictData</TableName>
+            <IDFieldName>id</IDFieldName>
+            <TableWhere/>
+        </Table>
+    </Item>
+
+    <Item>
+        <IDName>tbBusinessScript.id</IDName>
+        <Table>
+            <TableName>tbBusinessScript</TableName>
+            <IDFieldName>id</IDFieldName>
+            <TableWhere/>
+        </Table>
+    </Item>
+
+    <Item>
+        <IDName>tbUser.id</IDName>
+        <Table>
+            <TableName>tbUser</TableName>
+            <IDFieldName>id</IDFieldName>
+            <TableWhere/>
+        </Table>
+        <Table>
+            <TableName>dnDriverInfo</TableName>
+            <IDFieldName>id</IDFieldName>
+            <TableWhere/>
+        </Table>
+        <Table>
+            <TableName>dnMallClient</TableName>
+            <IDFieldName>id</IDFieldName>
+            <TableWhere/>
+        </Table>
+    </Item>
+
+
+    <Item>
+        <IDName>tbDept.id</IDName>
+        <Table>
+            <TableName>tbDept</TableName>
+            <IDFieldName>id</IDFieldName>
+            <TableWhere/>
+        </Table>
+    </Item>
+
+    <Item>
+        <IDName>tbRole.id</IDName>
+        <Table>
+            <TableName>tbRole</TableName>
+            <IDFieldName>id</IDFieldName>
+            <TableWhere/>
+        </Table>
+    </Item>
+
+    <Item>
+        <IDName>tbMenu.id</IDName>
+        <Table>
+            <TableName>tbMenu</TableName>
+            <IDFieldName>id</IDFieldName>
+            <TableWhere/>
+        </Table>
+    </Item>
+
+    <Item>
+        <IDName>eiInquireMainInfo.id</IDName>
+        <Table>
+            <TableName>eiInquireMainInfo</TableName>
+            <IDFieldName>id</IDFieldName>
+            <TableWhere/>
+        </Table>
+    </Item>
+
+    <Item>
+        <IDName>eiInquireResultColumn.id</IDName>
+        <Table>
+            <TableName>eiInquireResultColumn</TableName>
+            <IDFieldName>id</IDFieldName>
+            <TableWhere/>
+        </Table>
+    </Item>
+
+    <Item>
+        <IDName>eiInquireCondition.id</IDName>
+        <Table>
+            <TableName>eiInquireCondition</TableName>
+            <IDFieldName>id</IDFieldName>
+            <TableWhere/>
+        </Table>
+    </Item>
+
+    <Item>
+        <IDName>tbNoticeMessage.id</IDName>
+        <Table>
+            <TableName>tbNoticeMessage</TableName>
+            <IDFieldName>id</IDFieldName>
+            <TableWhere/>
+        </Table>
+    </Item>
+
+    <Item>
+        <IDName>tbUserNoticeMessage.id</IDName>
+        <Table>
+            <TableName>tbUserNoticeMessage</TableName>
+            <IDFieldName>id</IDFieldName>
+            <TableWhere/>
+        </Table>
+    </Item>
+
+    <Item>
+        <IDName>tbAnnouncement.id</IDName>
+        <Table>
+            <TableName>tbAnnouncement</TableName>
+            <IDFieldName>id</IDFieldName>
+            <TableWhere/>
+        </Table>
+    </Item>
+
+    <Item>
+        <IDName>tbAnnouncementAttachment.id</IDName>
+        <Table>
+            <TableName>tbAnnouncementAttachment</TableName>
+            <IDFieldName>id</IDFieldName>
+            <TableWhere/>
+        </Table>
+    </Item>
+
+    <Item>
+        <IDName>tbProductInfo.id</IDName>
+        <Table>
+            <TableName>tbProduct</TableName>
+            <IDFieldName>id</IDFieldName>
+            <TableWhere/>
+        </Table>
+    </Item>
+
+    <Item>
+        <IDName>tbProductType.id</IDName>
+        <Table>
+            <TableName>tbProductType</TableName>
+            <IDFieldName>id</IDFieldName>
+            <TableWhere/>
+        </Table>
+    </Item>
+
+    <Item>
+        <IDName>tbProductParameter.id</IDName>
+        <Table>
+            <TableName>tbProductParameter</TableName>
+            <IDFieldName>id</IDFieldName>
+            <TableWhere/>
+        </Table>
+    </Item>
+
+    <Item>
+        <IDName>tbProductPagePriceInfo.id</IDName>
+        <Table>
+            <TableName>tbProductPagePriceInfo</TableName>
+            <IDFieldName>id</IDFieldName>
+            <TableWhere/>
+        </Table>
+    </Item>
+
+    <Item>
+        <IDName>tbPartInfo.id</IDName>
+        <Table>
+            <TableName>tbPartInfo</TableName>
+            <IDFieldName>id</IDFieldName>
+            <TableWhere/>
+        </Table>
+    </Item>
+
+    <Item>
+        <IDName>tbPartParameter.id</IDName>
+        <Table>
+            <TableName>tbPartParameter</TableName>
+            <IDFieldName>id</IDFieldName>
+            <TableWhere/>
+        </Table>
+    </Item>
+
+    <Item>
+        <IDName>tbPartParameterItem.id</IDName>
+        <Table>
+            <TableName>tbPartParameterItem</TableName>
+            <IDFieldName>id</IDFieldName>
+            <TableWhere/>
+        </Table>
+    </Item>
+
+    <Item>
+        <IDName>tbPartWorkProcess.id</IDName>
+        <Table>
+            <TableName>tbPartWorkProcess</TableName>
+            <IDFieldName>id</IDFieldName>
+            <TableWhere/>
+        </Table>
+    </Item>
+
+    <Item>
+        <IDName>tbMaterialInfoType.id</IDName>
+        <Table>
+            <TableName>tbMaterialInfoType</TableName>
+            <IDFieldName>id</IDFieldName>
+            <TableWhere/>
+        </Table>
+    </Item>
+
+    <Item>
+        <IDName>V_tbPaperMaterialId.id</IDName>
+        <Table>
+            <TableName>v_tbpapermaterialid</TableName>
+            <IDFieldName>id</IDFieldName>
+            <TableWhere/>
+        </Table>
+    </Item>
+
+    <Item>
+        <IDName>tbPaperBrand.id</IDName>
+        <Table>
+            <TableName>tbPaperBrand</TableName>
+            <IDFieldName>id</IDFieldName>
+            <TableWhere/>
+        </Table>
+    </Item>
+
+    <Item>
+        <IDName>tbPaperInfoType.id</IDName>
+        <Table>
+            <TableName>tbPaperInfoType</TableName>
+            <IDFieldName>id</IDFieldName>
+            <TableWhere/>
+        </Table>
+    </Item>
+
+    <Item>
+        <IDName>tbPaperBaseInfo.id</IDName>
+        <Table>
+            <TableName>tbPaperBaseInfo</TableName>
+            <IDFieldName>id</IDFieldName>
+            <TableWhere/>
+        </Table>
+    </Item>
+
+    <Item>
+        <IDName>tbPaperCutInfo.id</IDName>
+        <Table>
+            <TableName>tbPaperCutInfo</TableName>
+            <IDFieldName>id</IDFieldName>
+            <TableWhere/>
+        </Table>
+    </Item>
+
+    <Item>
+        <IDName>tbPaperCutSizeInfo.id</IDName>
+        <Table>
+            <TableName>tbPaperCutSizeInfo</TableName>
+            <IDFieldName>id</IDFieldName>
+            <TableWhere/>
+        </Table>
+    </Item>
+
+    <Item>
+        <IDName>tbPaperQuoteInfo.id</IDName>
+        <Table>
+            <TableName>tbPaperQuoteInfo</TableName>
+            <IDFieldName>id</IDFieldName>
+            <TableWhere/>
+        </Table>
+    </Item>
+
+    <Item>
+        <IDName>V_tbPaperMaterialId.id</IDName>
+        <Table>
+            <TableName>v_tbpapermaterialid</TableName>
+            <IDFieldName>id</IDFieldName>
+            <TableWhere/>
+        </Table>
+    </Item>
+
+    <Item>
+        <IDName>tbPlatformInfo.id</IDName>
+        <Table>
+            <TableName>tbPlatformInfo</TableName>
+            <IDFieldName>id</IDFieldName>
+            <TableWhere/>
+        </Table>
+    </Item>
+
+    <Item>
+        <IDName>tbPlatformRequire.id</IDName>
+        <Table>
+            <TableName>tbPlatformRequire</TableName>
+            <IDFieldName>id</IDFieldName>
+            <TableWhere/>
+        </Table>
+    </Item>
+
+    <Item>
+        <IDName>tbStoreBrand.id</IDName>
+        <Table>
+            <TableName>tbStoreBrand</TableName>
+            <IDFieldName>id</IDFieldName>
+            <TableWhere/>
+        </Table>
+    </Item>
+
+    <Item>
+        <IDName>tbStoreInfo.id</IDName>
+        <Table>
+            <TableName>tbStoreInfo</TableName>
+            <IDFieldName>id</IDFieldName>
+            <TableWhere/>
+        </Table>
+    </Item>
+
+    <Item>
+        <IDName>tbStoreInvoiceInfo.id</IDName>
+        <Table>
+            <TableName>tbStoreInvoiceInfo</TableName>
+            <IDFieldName>id</IDFieldName>
+            <TableWhere/>
+        </Table>
+    </Item>
+
+    <Item>
+        <IDName>tbStorePlatform.id</IDName>
+        <Table>
+            <TableName>tbStorePlatform</TableName>
+            <IDFieldName>id</IDFieldName>
+            <TableWhere/>
+        </Table>
+    </Item>
+
+    <Item>
+        <IDName>tbStorePlatformRequire.id</IDName>
+        <Table>
+            <TableName>tbStorePlatformRequire</TableName>
+            <IDFieldName>id</IDFieldName>
+            <TableWhere/>
+        </Table>
+    </Item>
+
+    <Item>
+        <IDName>deBusinessOrder.id</IDName>
+        <Table>
+            <TableName>v_debusinessorder</TableName>
+            <IDFieldName>id</IDFieldName>
+            <TableWhere/>
+        </Table>
+    </Item>
+
+    <Item>
+        <IDName>deOrderFinances.id</IDName>
+        <Table>
+            <TableName>v_deorderfinances</TableName>
+            <IDFieldName>id</IDFieldName>
+            <TableWhere/>
+        </Table>
+    </Item>
+
+    <Item>
+        <IDName>deOrderDeliveryInfo.id</IDName>
+        <Table>
+            <TableName>v_deorderdeliveryinfo</TableName>
+            <IDFieldName>id</IDFieldName>
+            <TableWhere/>
+        </Table>
+    </Item>
+
+    <Item>
+        <IDName>deOrderDetailItem.id</IDName>
+        <Table>
+            <TableName>v_deorderdetailitem</TableName>
+            <IDFieldName>id</IDFieldName>
+            <TableWhere/>
+        </Table>
+    </Item>
+
+    <Item>
+        <IDName>deOrderAfterSaleBill.id</IDName>
+        <Table>
+            <TableName>v_deorderaftersalebill</TableName>
+            <IDFieldName>id</IDFieldName>
+            <TableWhere/>
+        </Table>
+    </Item>
+
+    <Item>
+        <IDName>deOrderRefundRequest.id</IDName>
+        <Table>
+            <TableName>v_deorderrefundrequest</TableName>
+            <IDFieldName>id</IDFieldName>
+            <TableWhere/>
+        </Table>
+    </Item>
+
+    <Item>
+        <IDName>deOrderDiscount.id</IDName>
+        <Table>
+            <TableName>v_deorderdiscount</TableName>
+            <IDFieldName>id</IDFieldName>
+            <TableWhere/>
+        </Table>
+    </Item>
+
+    <Item>
+        <IDName>deOrderRiderItems.id</IDName>
+        <Table>
+            <TableName>v_deOrderRiderItems</TableName>
+            <IDFieldName>id</IDFieldName>
+            <TableWhere/>
+        </Table>
+    </Item>
+</Items>

+ 69 - 0
conf/Rest接口Call InvokeCallParams方法文档示例和说明.xml

@@ -0,0 +1,69 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<apis>
+    <api>
+        <!-- 接口名称 -->
+        <methodName>测试api</methodName>
+        <!-- 排序 -->
+        <sort>10</sort>
+        <!-- 使用的脚本业务名称 不要BE_ -->
+        <businessMethod>Express_aaaa</businessMethod>
+        <!-- 是否需要token,留着空表示不需要,需要token的写上获取token的方法,不能不要该节点 -->
+        <tokenFrom></tokenFrom>
+        <!-- 是否需要分页,留着空表示不需要,随便写的啥表示需要分页参数,不能不要该节点 -->
+        <pageFrom>1</pageFrom>
+
+        <!--
+            参数信息,paramOnly和params是互斥的,有的时候我们需要的参数是单个类的json就完事,但是又懒得一个一个写param,可以只用paramOnly标识,里面输入带包类名,
+            然后在类里面用@ApiPlce("脚本业务名称")标记上需要的字段即可,不能不要该节点,使用params时,paramOnly写空即可。
+        -->
+        <paramOnly></paramOnly>
+        <!--
+            参数信息,
+        -->
+        <params>
+            <param>
+                <!-- 参数说明 -->
+                <paramComment>参数1</paramComment>
+                <!-- 参数名称 -->
+                <paramKey>keyWord1</paramKey>
+                <!-- 参数类型 "Integer", "Long", "Double", "Float", "Boolean", "String" 为基础类型 -->
+                <paramKind>Integer</paramKind>
+            </param>
+
+            <param>
+                <paramComment>参数2</paramComment>
+                <paramKey>keyWord2</paramKey>
+                <paramKind>String</paramKind>
+            </param>
+
+            <param>
+                <paramComment>参数3</paramComment>
+                <paramKey>keyWord3</paramKey>
+                <!-- 参数类型 为类时,文档会读取注解@ApiPlce("脚本业务名称")的字段生成参数表 -->
+                <paramKind>com.yinjie.heating.common.entity.order.BusinessOrder</paramKind>
+            </param>
+
+            <param>
+                <paramComment>参数4</paramComment>
+                <paramKey>keyWord4</paramKey>
+                <paramKind>com.yinjie.heating.common.entity.order.OrderAfterSaleBill</paramKind>
+            </param>
+        </params>
+
+        <!-- 类说明,文档会生成类的说明表格 -->
+        <webApiBean>com.yinjie.heating.common.entity.order.OrderAfterSaleBill</webApiBean>
+        <webApiBean>com.yinjie.heating.common.entity.order.OrderDeliveryInfo</webApiBean>
+    </api>
+
+    <api>
+        <methodName>创建配送单</methodName>
+        <sort>11</sort>
+        <businessMethod>Express_bbbbb</businessMethod>
+        <tokenFrom>/order/orderFormToken</tokenFrom>
+        <pageFrom></pageFrom>
+
+        <paramOnly>com.yinjie.heating.common.entity.order.BusinessOrder</paramOnly>
+
+        <webApiBean></webApiBean>
+    </api>
+</apis>

Datei-Diff unterdrückt, da er zu groß ist
+ 1370 - 0
conf/addressdata/cities.json


Datei-Diff unterdrückt, da er zu groß ist
+ 13354 - 0
conf/addressdata/counties.json


+ 126 - 0
conf/addressdata/provices.json

@@ -0,0 +1,126 @@
+[
+  {
+      "code": "110000",
+      "name": "北京市"
+  },
+  {
+      "code": "120000",
+      "name": "天津市"
+  },
+  {
+      "code": "130000",
+      "name": "河北省"
+  },
+  {
+      "code": "140000",
+      "name": "山西省"
+  },
+  {
+      "code": "150000",
+      "name": "内蒙古自治区"
+  },
+  {
+      "code": "210000",
+      "name": "辽宁省"
+  },
+  {
+      "code": "220000",
+      "name": "吉林省"
+  },
+  {
+      "code": "230000",
+      "name": "黑龙江省"
+  },
+  {
+      "code": "310000",
+      "name": "上海市"
+  },
+  {
+      "code": "320000",
+      "name": "江苏省"
+  },
+  {
+      "code": "330000",
+      "name": "浙江省"
+  },
+  {
+      "code": "340000",
+      "name": "安徽省"
+  },
+  {
+      "code": "350000",
+      "name": "福建省"
+  },
+  {
+      "code": "360000",
+      "name": "江西省"
+  },
+  {
+      "code": "370000",
+      "name": "山东省"
+  },
+  {
+      "code": "410000",
+      "name": "河南省"
+  },
+  {
+      "code": "420000",
+      "name": "湖北省"
+  },
+  {
+      "code": "430000",
+      "name": "湖南省"
+  },
+  {
+      "code": "440000",
+      "name": "广东省"
+  },
+  {
+      "code": "450000",
+      "name": "广西壮族自治区"
+  },
+  {
+      "code": "460000",
+      "name": "海南省"
+  },
+  {
+      "code": "500000",
+      "name": "重庆市"
+  },
+  {
+      "code": "510000",
+      "name": "四川省"
+  },
+  {
+      "code": "520000",
+      "name": "贵州省"
+  },
+  {
+      "code": "530000",
+      "name": "云南省"
+  },
+  {
+      "code": "540000",
+      "name": "西藏自治区"
+  },
+  {
+      "code": "610000",
+      "name": "陕西省"
+  },
+  {
+      "code": "620000",
+      "name": "甘肃省"
+  },
+  {
+      "code": "630000",
+      "name": "青海省"
+  },
+  {
+      "code": "640000",
+      "name": "宁夏回族自治区"
+  },
+  {
+      "code": "650000",
+      "name": "新疆维吾尔自治区"
+  }
+]

+ 64 - 0
conf/apiFiles/expressOut.xml

@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<apis>
+    <api>
+        <!-- 接口名称 -->
+        <methodName>顺丰同城预下单报价</methodName>
+        <!-- 排序 -->
+        <sort>2</sort>
+        <businessMethod>Express_PreCreateOrder_SFTC</businessMethod>
+        <!-- 是否需要token,留着空表示不需要,需要token的写上获取token的方法,不能不要该节点 -->
+        <tokenFrom/>
+        <!-- 是否需要分页,留着空表示不需要,随便写的啥表示需要分页参数,不能不要该节点 -->
+        <pageFrom/>
+
+        <!--
+            参数信息,paramOnly和params是互斥的,有的时候我们需要的参数是单个类的json就完事,但是又懒得一个一个写param,可以只用paramOnly标识,里面输入带包类名,
+            然后在类里面用@ApiPlce("脚本业务名称")标记上需要的字段即可,不能不要该节点,使用params时,paramOnly写空即可。
+        -->
+        <paramOnly/>
+        <!--
+            参数信息,
+        -->
+        <params>
+            <param>
+                <!-- 参数说明 -->
+                <paramComment>订单id</paramComment>
+                <!-- 参数名称 -->
+                <paramKey>idOrder</paramKey>
+                <!-- 参数类型 "Integer", "Long", "Double", "Float", "Boolean", "String" 为基础类型 -->
+                <paramKind>Long</paramKind>
+            </param>
+        </params>
+    </api>
+
+    <api>
+        <!-- 接口名称 -->
+        <methodName>顺丰同城配送发单</methodName>
+        <!-- 排序 -->
+        <sort>3</sort>
+        <businessMethod>Express_CreateOrder_SFTC</businessMethod>
+        <!-- 是否需要token,留着空表示不需要,需要token的写上获取token的方法,不能不要该节点 -->
+        <tokenFrom>/eout/expressFormToken</tokenFrom>
+        <!-- 是否需要分页,留着空表示不需要,随便写的啥表示需要分页参数,不能不要该节点 -->
+        <pageFrom/>
+
+        <!--
+            参数信息,paramOnly和params是互斥的,有的时候我们需要的参数是单个类的json就完事,但是又懒得一个一个写param,可以只用paramOnly标识,里面输入带包类名,
+            然后在类里面用@ApiPlce("脚本业务名称")标记上需要的字段即可,不能不要该节点,使用params时,paramOnly写空即可。
+        -->
+        <paramOnly/>
+        <!--
+            参数信息,
+        -->
+        <params>
+            <param>
+                <!-- 参数说明 -->
+                <paramComment>订单id</paramComment>
+                <!-- 参数名称 -->
+                <paramKey>idOrder</paramKey>
+                <!-- 参数类型 "Integer", "Long", "Double", "Float", "Boolean", "String" 为基础类型 -->
+                <paramKind>Long</paramKind>
+            </param>
+        </params>
+    </api>
+</apis>

+ 128 - 0
conf/apiFiles/orderProcess.xml

@@ -0,0 +1,128 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<apis>
+    <api>
+        <!-- 接口名称 -->
+        <methodName>门店接单</methodName>
+        <!-- 排序 -->
+        <sort>10</sort>
+        <!-- 使用的脚本业务名称 不要BE_ -->
+        <businessMethod>Order_AcceptOrder_Request</businessMethod>
+        <!-- 是否需要token,留着空表示不需要,需要token的写上获取token的方法,不能不要该节点 -->
+        <tokenFrom></tokenFrom>
+        <!-- 是否需要分页,留着空表示不需要,随便写的啥表示需要分页参数,不能不要该节点 -->
+        <pageFrom></pageFrom>
+
+        <!--
+            参数信息,paramOnly和params是互斥的,有的时候我们需要的参数是单个类的json就完事,但是又懒得一个一个写param,可以只用paramOnly标识,里面输入带包类名,
+            然后在类里面用@ApiPlce("脚本业务名称")标记上需要的字段即可,不能不要该节点,使用params时,paramOnly写空即可。
+        -->
+        <paramOnly></paramOnly>
+        <!--
+            参数信息,
+        -->
+        <params>
+            <param>
+                <!-- 参数说明 -->
+                <paramComment>订单id</paramComment>
+                <!-- 参数名称 -->
+                <paramKey>idOrder</paramKey>
+                <!-- 参数类型 "Integer", "Long", "Double", "Float", "Boolean", "String" 为基础类型 -->
+                <paramKind>Long</paramKind>
+            </param>
+        </params>
+
+    </api>
+
+    <api>
+        <!-- 接口名称 -->
+        <methodName>门店出餐完成</methodName>
+        <!-- 排序 -->
+        <sort>11</sort>
+        <!-- 使用的脚本业务名称 不要BE_ -->
+        <businessMethod>Order_CookingDone_Request</businessMethod>
+        <!-- 是否需要token,留着空表示不需要,需要token的写上获取token的方法,不能不要该节点 -->
+        <tokenFrom></tokenFrom>
+        <!-- 是否需要分页,留着空表示不需要,随便写的啥表示需要分页参数,不能不要该节点 -->
+        <pageFrom></pageFrom>
+
+        <!--
+            参数信息,paramOnly和params是互斥的,有的时候我们需要的参数是单个类的json就完事,但是又懒得一个一个写param,可以只用paramOnly标识,里面输入带包类名,
+            然后在类里面用@ApiPlce("脚本业务名称")标记上需要的字段即可,不能不要该节点,使用params时,paramOnly写空即可。
+        -->
+        <paramOnly></paramOnly>
+        <!--
+            参数信息,
+        -->
+        <params>
+            <param>
+                <!-- 参数说明 -->
+                <paramComment>订单id</paramComment>
+                <!-- 参数名称 -->
+                <paramKey>idOrder</paramKey>
+                <!-- 参数类型 "Integer", "Long", "Double", "Float", "Boolean", "String" 为基础类型 -->
+                <paramKind>Long</paramKind>
+            </param>
+        </params>
+
+    </api>
+
+    <api>
+        <!-- 接口名称 -->
+        <methodName>商户同意/拒绝退款请求</methodName>
+        <!-- 排序 -->
+        <sort>11</sort>
+        <!-- 使用的脚本业务名称 不要BE_ -->
+        <businessMethod>Order_ProcessRefund_Request</businessMethod>
+        <!-- 是否需要token,留着空表示不需要,需要token的写上获取token的方法,不能不要该节点 -->
+        <tokenFrom></tokenFrom>
+        <!-- 是否需要分页,留着空表示不需要,随便写的啥表示需要分页参数,不能不要该节点 -->
+        <pageFrom></pageFrom>
+
+        <!--
+            参数信息,paramOnly和params是互斥的,有的时候我们需要的参数是单个类的json就完事,但是又懒得一个一个写param,可以只用paramOnly标识,里面输入带包类名,
+            然后在类里面用@ApiPlce("脚本业务名称")标记上需要的字段即可,不能不要该节点,使用params时,paramOnly写空即可。
+        -->
+        <paramOnly></paramOnly>
+        <!--
+            参数信息,
+        -->
+        <params>
+            <param>
+                <!-- 参数说明 -->
+                <paramComment>客户退款申请id</paramComment>
+                <!-- 参数名称 -->
+                <paramKey>idRefundRequest</paramKey>
+                <!-- 参数类型 "Integer", "Long", "Double", "Float", "Boolean", "String" 为基础类型 -->
+                <paramKind>Long</paramKind>
+            </param>
+
+            <param>
+                <!-- 参数说明 -->
+                <paramComment>同意/拒绝退款</paramComment>
+                <!-- 参数名称 -->
+                <paramKey>approve</paramKey>
+                <!-- 参数类型 "Integer", "Long", "Double", "Float", "Boolean", "String" 为基础类型 -->
+                <paramKind>Integer</paramKind>
+            </param>
+
+            <param>
+                <!-- 参数说明 -->
+                <paramComment>拒绝原因代码,如"[101,102,103]",注意这个括号不能少必须是数组形式</paramComment>
+                <!-- 参数名称 -->
+                <paramKey>rejectReasonCode</paramKey>
+                <!-- 参数类型 "Integer", "Long", "Double", "Float", "Boolean", "String" 为基础类型 -->
+                <paramKind>String</paramKind>
+            </param>
+
+            <param>
+                <!-- 参数说明 -->
+                <paramComment>拒绝原因备注</paramComment>
+                <!-- 参数名称 -->
+                <paramKey>rejectMemo</paramKey>
+                <!-- 参数类型 "Integer", "Long", "Double", "Float", "Boolean", "String" 为基础类型 -->
+                <paramKind>String</paramKind>
+            </param>
+        </params>
+
+    </api>
+</apis>

+ 317 - 0
conf/application-yjWebOne.xml

@@ -0,0 +1,317 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<application port="52100" lib="">
+
+    <resources>
+        <group name="DELIVER_SERVICE_REMOTE">
+            <node addr="127.0.0.1" port="52101"/>
+        </group>
+
+        <properties load="redis.properties;workProcess.properties;sftc.properties;platform.properties">
+            <property name="orderFileRoot" value="${APP_HOME}/orderFiles"/>
+            <property name="bucketFileRoot" value="${APP_HOME}/bucketFiles"/>
+            <!--注入sql脚本的目录-->
+            <property name="sqlroot" value="${APP_HOME}/conf/sqlroot/"/>
+
+            <!--注入初始化id配置文件-->
+            <property name="tableIdFile" value="${APP_HOME}/conf/KeyId.xml"/>
+            <!--注入初始化code配置文件-->
+            <property name="tableCodeFile" value="${APP_HOME}/conf/KeyCode.xml"/>
+
+            <property name="tableIdPrefix" value="dydeliver:tableid:"/>
+            <property name="tableCodePrefix" value="dydeliver:tablecode:"/>
+
+            <!--session过期时间-->
+            <property name="sessionExpireSeconds" value="3600"/>
+
+            <property name="passwordSalt" value="gas@FeeCenteR@PassWord"/>
+            <property name="menuResourcerRoleIds" value="16"/>
+
+            <!--登录token加密key-->
+            <property name="erpToken.commonkey" value="4c72865cf224465393e3eecb38fc8685"/>
+            <property name="deliver.Store.commonkey" value="95428de286f4accd73b80acebd38abd1"/>
+            <property name="dnyMall.commonkey" value="2b23f19e5ec0d17c086eb8fcf68f5b6f"/>
+
+            <property name="baiduKey" value="r8bLF3qzzYxVpPACZaxbaWSgYDyihz0d"/>
+
+            <!--数据的起始年份和结束年份,影响缓存索引的建立和数据库中的分表-->
+            <property name="bookStartYear" value="2010"/>
+            <property name="bookEndYear" value="2030"/>
+            <property name="bookSplitKind" value="1"/>
+
+            <property name="riderGeoShards" value="4" />
+
+            <property name="webSocketServerName" value="dws"/>
+
+            <!--分厂维护服务地址-->
+            <property name="erpDataMain.url" value="http://192.168.1.24:8080/apis"/>
+
+            <property name="orderImportRoot" value="${APP_HOME}/importOrder"/>
+
+            <!--支付超时分钟-->
+            <property name="payTimeOutMinutes" value="30"/>
+
+            <!--系统运行模式,区分ERP和商城完全靠脚本理论是可行的,就是一些档案增删改的代码也需要调整到脚本执行,前期懒得处理,用此字段区分一下算了-->
+            <!--ERP:印刷ERP-->
+            <!--Mall:印刷商城-->
+            <!--ProductCenter:产品中心-->
+            <property name="sysRunMode" value="ERP"/>
+        </properties>
+    </resources>
+
+    <server protocol="HTTP" host="127.0.0.1" port="52102" maxbody="5m" aliveTimeoutSeconds="0">
+        <!-- 前端配置了nginx,需要配置才能获取客户端真实的IP地址 -->
+        <request>
+            <remoteaddr value="request.headers.X-Forwarded-For"/>
+        </request>
+
+        <services autoload="false" includes="">
+            <service value="com.yinjie.heating.webcore.rest.ERPRest"/>
+            <service value="com.yinjie.heating.webcore.rest.AdminRest">
+                <isUseScriptService value="true"/>
+            </service>
+            <service value="com.yinjie.heating.webcore.rest.ERPUpdateRest"/>
+            <service value="com.yinjie.heating.webcore.rest.SystemRest"/>
+            <service value="com.yinjie.heating.webcore.rest.DocInfoRest">
+                <isUseScriptService value="true"/>
+            </service>
+            <service value="com.yinjie.heating.webcore.rest.PlatformRest">
+                <isUseScriptService value="true"/>
+            </service>
+            <service value="com.yinjie.heating.webcore.rest.StoreRest">
+                <isUseScriptService value="true"/>
+            </service>
+
+            <service value="com.yinjie.heating.webcore.rest.flycat.ExpressOutRest"/>
+            <service value="com.yinjie.heating.webcore.rest.flycat.OrderRest"/>
+
+            <service value="com.yinjie.heating.webcore.rest.flycat.StoreAppRest"/>
+        </services>
+
+        <resource-servlet webroot="root" index="index.html">
+            <cache limit="1M" lengthmax="2M" watch="true"/>
+        </resource-servlet>
+
+        <!--http过滤器-->
+        <filters autoload="false" includes="" excludes="">
+            <filter value="com.yinjie.heating.webcore.servlet.ERPSessionFilter"/>
+        </filters>
+
+        <!--管理提供给管理用户的接口-->
+        <rest autoload="false" base="com.yinjie.heating.common.base.ERPAdminHttpServlet">
+            <service value="com.yinjie.heating.webcore.rest.ERPRest"/>
+            <service value="com.yinjie.heating.webcore.rest.AdminRest">
+                <isUseScriptService value="true"/>
+            </service>
+            <service value="com.yinjie.heating.webcore.rest.ERPUpdateRest"/>
+            <service value="com.yinjie.heating.webcore.rest.SystemRest"/>
+            <service value="com.yinjie.heating.webcore.rest.DocInfoRest">
+                <isUseScriptService value="true"/>
+            </service>
+            <service value="com.yinjie.heating.webcore.rest.ProductRest"/>
+            <service value="com.yinjie.heating.webcore.rest.PlatformRest"/>
+            <service value="com.yinjie.heating.webcore.rest.StoreRest"/>
+            <service value="com.yinjie.heating.webcore.rest.flycat.ExpressOutRest"/>
+            <service value="com.yinjie.heating.webcore.rest.flycat.OrderRest"/>
+
+            <websocket value="com.yinjie.heating.webcore.websocket.ERPWebSocket" name="dws" groups="DELIVER_SERVICE_REMOTE"/>
+        </rest>
+
+        <rest autoload="false" base="com.yinjie.heating.common.base.ERPStoreAppHttpServlet">
+            <service value="com.yinjie.heating.webcore.rest.flycat.StoreAppRest"/>
+        </rest>
+
+        <servlets autoload="false">
+            <servlet value="com.yinjie.heating.common.servlet.apidoc.ApiDocServlet">
+                <environment value="dev"/>
+            </servlet>
+
+            <servlet value="com.yinjie.heating.common.servlet.file.FileUploadServlet"/>
+
+            <servlet value="com.yinjie.heating.webcore.servlet.ExpressCallServlet"/>
+            <servlet value="com.yinjie.heating.webcore.servlet.OrderCallServlet"/>
+        </servlets>
+    </server>
+
+    <server protocol="SNCP" host="127.0.0.1" port="52101" aliveTimeoutSeconds="0">
+        <services autoload="false" includes="">
+            <service value="com.dySweetFishPlugin.sql.SqlService" groups="DELIVER_SERVICE_REMOTE"/>
+            <service value="com.dySweetFishPlugin.sql.DBService" groups="DELIVER_SERVICE_REMOTE">
+                <!--封装rexdb数据库操作服务,maxsize缓存最大查询结果数量,expireminutes缓存超时时间,分钟单位-->
+                <maxsize value="100"/>
+                <expireminutes value="1"/>
+            </service>
+
+            <service value="com.dySweetFishPlugin.redis.RedisService" groups="DELIVER_SERVICE_REMOTE"/>
+            <service value="com.dySweetFishPlugin.sql.TableIdService" groups="DELIVER_SERVICE_REMOTE">
+                <tableSharding value="com.yinjie.heating.business.dao.TableIdShardingStrategy"/>
+                <!--多数据源-->
+                <dataBaseMulti value="true"/>
+            </service>
+
+            <service value="com.dySweetFishPlugin.sql.dao.TunaDaoService" groups="DELIVER_SERVICE_REMOTE"/>
+            <service value="com.dySweetFishPlugin.sql.dao.TunaService" groups="DELIVER_SERVICE_REMOTE">
+                <dao value="com.yinjie.heating.business.dao.LoginDao"/>
+                <dao value="com.yinjie.heating.business.dao.SystemDao"/>
+                <dao value="com.yinjie.heating.business.dao.DocDao"/>
+                <dao value="com.yinjie.heating.business.dao.StoreDao"/>
+                <dao value="com.yinjie.heating.business.dao.PlatformDao"/>
+                <dao value="com.yinjie.heating.business.dao.OrderDao"/>
+            </service>
+
+            <service value="com.dySweetFishPlugin.redis.jobqueue.RedisJQService" groups="DELIVER_SERVICE_REMOTE"/>
+            <service value="com.dySweetFishPlugin.redis.jobqueue.RedisJobProducer" groups="DELIVER_SERVICE_REMOTE"/>
+            <service value="com.dySweetFishPlugin.redis.jobqueue.RedisJobConsumer" groups="DELIVER_SERVICE_REMOTE">
+            </service>
+
+            <service value="com.yinjie.heating.common.api.NoSqlKeysService" load="rediskeys.properties;eskeys.properties"
+                     groups="DELIVER_SERVICE_REMOTE"/>
+
+            <service value="com.yinjie.heating.common.api.TypeTokenConvertService" groups="DELIVER_SERVICE_REMOTE"/>
+
+            <service value="com.dySweetFishPlugin.elasticsearch.ESClient" groups="DELIVER_SERVICE_REMOTE">
+                <clusterName value="elasticsearch"/>
+                <host value="192.168.1.243"/>
+                <port value="9300"/>
+            </service>
+
+            <service value="com.yinjie.heating.common.api.ERPLockDataService" groups="DELIVER_SERVICE_REMOTE">
+                <master value="true"/>
+            </service>
+
+            <service value="com.yinjie.heating.common.api.QRCodeService" groups="DELIVER_SERVICE_REMOTE">
+                <orderRule value="ProtocolCode"/>
+            </service>
+
+            <service value="com.yinjie.heating.common.tool.CodeGenerate" groups="DELIVER_SERVICE_REMOTE">
+                <master value="true"/>
+            </service>
+
+            <service value="com.yinjie.heating.common.tool.ProductTagWordFilter" groups="DELIVER_SERVICE_REMOTE">
+                <dicFile value="productKey.txt"/>
+            </service>
+
+            <service value="com.yinjie.heating.common.api.OpLogService" groups="DELIVER_SERVICE_REMOTE"/>
+
+            <service name="dws" value="com.sweetfish.source.CacheMemorySource" groups="DELIVER_SERVICE_REMOTE">
+            </service>
+            <service name="dws" value="com.sweetfish.service.WebSocketNodeService" groups="DELIVER_SERVICE_REMOTE"/>
+
+            <service value="com.yinjie.heating.business.service.SupplierInitImpl" groups="DELIVER_SERVICE_REMOTE">
+                <master value="true"/>
+                <environment value="dev"/>
+                <clearESData value="false"/>
+            </service>
+
+            <service value="com.yinjie.heating.business.service.ERPServiceImpl" groups="DELIVER_SERVICE_REMOTE">
+                <master value="true"/>
+            </service>
+
+            <service value="com.yinjie.heating.business.service.SysMessageServiceImpl" groups="DELIVER_SERVICE_REMOTE">
+                <master value="true"/>
+            </service>
+
+            <service value="com.yinjie.heating.common.api.ERPLockDataService" groups="DELIVER_SERVICE_REMOTE">
+                <master value="true"/>
+            </service>
+
+            <service value="com.yinjie.heating.business.service.DocInfoServiceImpl" groups="DELIVER_SERVICE_REMOTE">
+                <master value="true"/>
+                <!--使用业务脚本-->
+                <isUseScriptService value="true"/>
+            </service>
+
+            <service value="com.yinjie.heating.business.service.SystemServiceImpl" groups="DELIVER_SERVICE_REMOTE">
+                <master value="true"/>
+                <isUseScriptService value="true"/>
+            </service>
+
+            <service value="com.yinjie.heating.business.service.LoginServiceImpl" groups="DELIVER_SERVICE_REMOTE">
+                <master value="true"/>
+                <isUseScriptService value="true"/>
+            </service>
+
+            <service value="com.yinjie.heating.business.service.LoginUserServiceImpl" groups="DELIVER_SERVICE_REMOTE">
+                <master value="true"/>
+                <isUseScriptService value="false"/>
+            </service>
+
+            <service value="com.yinjie.heating.business.service.PermissionServiceImpl" groups="DELIVER_SERVICE_REMOTE">
+                <master value="true"/>
+                <isUseScriptService value="false"/>
+            </service>
+
+            <service value="com.yinjie.heating.business.service.RoleServiceImpl" groups="DELIVER_SERVICE_REMOTE">
+                <master value="true"/>
+                <isUseScriptService value="false"/>
+            </service>
+
+            <service value="com.yinjie.heating.business.service.ConfigServiceImpl" groups="DELIVER_SERVICE_REMOTE">
+                <master value="true"/>
+                <isUseScriptService value="false"/>
+            </service>
+
+            <service value="com.yinjie.heating.business.service.DictServiceImpl" groups="DELIVER_SERVICE_REMOTE">
+                <master value="true"/>
+                <isUseScriptService value="false"/>
+            </service>
+
+            <service value="com.yinjie.heating.business.service.MenuServiceImpl" groups="DELIVER_SERVICE_REMOTE">
+                <master value="true"/>
+                <isUseScriptService value="false"/>
+            </service>
+
+            <service value="com.yinjie.heating.business.service.DeptServiceImpl" groups="DELIVER_SERVICE_REMOTE">
+                <master value="true"/>
+                <isUseScriptService value="false"/>
+            </service>
+
+            <service value="com.yinjie.heating.business.service.StoreServiceImpl" groups="DELIVER_SERVICE_REMOTE">
+                <master value="true"/>
+                <isUseScriptService value="true"/>
+            </service>
+
+            <service value="com.yinjie.heating.business.service.PlatformServiceImpl" groups="DELIVER_SERVICE_REMOTE">
+                <master value="true"/>
+                <isUseScriptService value="true"/>
+            </service>
+
+            <service value="com.yinjie.heating.business.service.flycat.ExpressOutServiceImpl" groups="DELIVER_SERVICE_REMOTE">
+                <master value="true"/>
+                <isUseScriptService value="true"/>
+            </service>
+
+<!--            <service value="com.yinjie.heating.business.service.flycat.IncomePlatformServiceImpl" groups="DELIVER_SERVICE_REMOTE">-->
+<!--                <master value="true"/>-->
+<!--                <environment value="release"/>-->
+<!--                <isUseScriptService value="false"/>-->
+<!--            </service>-->
+
+            <service value="com.yinjie.heating.business.service.flycat.PlatformAccessTokenServiceImpl" groups="DELIVER_SERVICE_REMOTE">
+                <master value="true"/>
+                <environment value="release"/>
+                <isUseScriptService value="true"/>
+            </service>
+
+            <service value="com.yinjie.heating.business.service.flycat.OrderServiceImpl" groups="DELIVER_SERVICE_REMOTE">
+                <master value="true"/>
+                <isUseScriptService value="true"/>
+            </service>
+
+            <service value="com.yinjie.heating.business.service.flycat.OrderSearchServiceImpl" groups="DELIVER_SERVICE_REMOTE">
+                <master value="true"/>
+                <isUseScriptService value="true"/>
+            </service>
+
+            <service value="com.yinjie.heating.business.service.flycat.OrderStepServiceImpl" groups="DELIVER_SERVICE_REMOTE">
+                <master value="true"/>
+                <isUseScriptService value="false"/>
+            </service>
+
+            <service value="com.yinjie.heating.business.service.flycat.ExpressGeoServiceImpl" groups="DELIVER_SERVICE_REMOTE">
+                <master value="true"/>
+                <isUseScriptService value="true"/>
+            </service>
+        </services>
+    </server>
+</application>

Datei-Diff unterdrückt, da er zu groß ist
+ 17374 - 0
conf/emojis.json


+ 33 - 0
conf/esTemplate/dataPurview.json

@@ -0,0 +1,33 @@
+{
+  "info": {
+    "properties": {
+      "idData": {
+        "type": "long"
+      },
+      "idUser": {
+        "type": "long"
+      },
+      "userName": {
+        "type": "text",
+        "index": "not_analyzed",
+        "fields": {
+          "raw": {
+            "type":  "keyword"
+          }
+        }
+      },
+      "idCreateUser": {
+        "type": "long"
+      },
+      "createUserName": {
+        "type": "text",
+        "index": "not_analyzed",
+        "fields": {
+          "raw": {
+            "type":  "keyword"
+          }
+        }
+      }
+    }
+  }
+}

+ 119 - 0
conf/esTemplate/docIndex.json

@@ -0,0 +1,119 @@
+{
+  "index": {
+    "number_of_shards": "1",
+    "number_of_replicas": "0",
+    "max_result_window": 100000000
+  },
+  "analysis": {
+    "analyzer": {
+      "codeprefix_analyzer": {
+        "tokenizer": "codeprefix_tokenizer",
+        "filter": [
+          "lowercase"
+        ]
+      },
+      "codefull_analyzer": {
+        "tokenizer": "codefull_tokenizer",
+        "filter": [
+          "lowercase"
+        ]
+      },
+      "lowercase_analyzer": {
+        "tokenizer": "standard",
+        "filter": [
+          "lowercase"
+        ]
+      },
+      "number_analyzer": {
+        "tokenizer": "number_tokenizer"
+      },
+      "number_ngram_analyzer": {
+        "tokenizer": "number_ngram_tokenizer",
+        "filter": [
+          "lowercase"
+        ]
+      },
+      "number2_analyzer": {
+        "tokenizer": "standard",
+        "filter": [
+          "lowercase", "number_filter"
+        ]
+      },
+      "letter_analyzer": {
+        "tokenizer": "letter2_tokenizer",
+        "filter": [
+          "lowercase"
+        ]
+      },
+      "letter2_analyzer": {
+        "tokenizer": "letter_tokenizer",
+        "filter": [
+          "lowercase"
+        ]
+      },
+      "keywordignorespace_analyzer": {
+        "tokenizer": "keyword",
+        "char_filter": [
+          "replace_whitespace"
+        ]
+      }
+    },
+    "tokenizer": {
+      "codeprefix_tokenizer": {
+        "type": "edge_ngram",
+        "min_gram": 2,
+        "max_gram": 50,
+        "token_chars": [
+          "letter",
+          "digit"
+        ]
+      },
+      "codefull_tokenizer": {
+        "type": "ngram",
+        "min_gram": 2,
+        "max_gram": 50
+      },
+      "number_tokenizer": {
+        "type": "pattern",
+        "pattern": "\\D+"
+      },
+      "number_ngram_tokenizer": {
+        "type": "ngram",
+        "min_gram": 2,
+        "max_gram": 50,
+        "token_chars": [
+          "digit"
+        ]
+      },
+      "letter_tokenizer": {
+        "type": "pattern",
+        "pattern": "\\W+"
+      },
+      "letter2_tokenizer": {
+        "type": "pattern",
+        "pattern": "[^a-zA-Z]"
+      }
+    },
+    "filter": {
+      "number_filter" : {
+        "type" : "pattern_capture",
+        "preserve_original" : true,
+        "patterns" : [
+          "(\\d+)"
+        ]
+      },
+      "ascii_filter" : {
+        "type" : "asciifolding",
+        "preserve_original" : true
+      }
+    },
+    "char_filter": {
+      "replace_whitespace": {
+        "type": "mapping",
+        "mappings": [
+          "\\u0020=>"
+        ]
+      }
+    }
+  }
+}

+ 52 - 0
conf/esTemplate/inquirecondition.json

@@ -0,0 +1,52 @@
+{
+  "inquirecondition": {
+    "_parent": {
+      "type": "info"
+    },
+    "properties": {
+      "id": {
+        "type": "long"
+      },
+      "idInquire": {
+        "type": "long"
+      },
+      "conditionName": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "conditionField": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "dataType": {
+        "type": "integer"
+      },
+      "defaultValue": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "visible": {
+        "type": "integer"
+      },
+      "selectDicType": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "sortAsc": {
+        "type": "integer"
+      },
+      "createBy": {
+        "type": "long"
+      },
+      "createTimeLong": {
+        "type": "long"
+      },
+      "updateBy": {
+        "type": "long"
+      },
+      "updateTimeLong": {
+        "type": "long"
+      }
+    }
+  }
+}

+ 41 - 0
conf/esTemplate/inquiremaininfo.json

@@ -0,0 +1,41 @@
+{
+  "info": {
+    "properties": {
+      "id": {
+        "type": "long"
+      },
+      "inquireName": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "inquireFuncName": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "inquireType": {
+        "type": "integer"
+      },
+      "canExport": {
+        "type": "integer"
+      },
+      "queryInPage": {
+        "type": "integer"
+      },
+      "voidFlag": {
+        "type": "integer"
+      },
+      "createBy": {
+        "type": "long"
+      },
+      "createTimeLong": {
+        "type": "long"
+      },
+      "updateBy": {
+        "type": "long"
+      },
+      "updateTimeLong": {
+        "type": "long"
+      }
+    }
+  }
+}

+ 58 - 0
conf/esTemplate/inquireresultcolumn.json

@@ -0,0 +1,58 @@
+{
+  "inquireresultcolumn": {
+    "_parent": {
+      "type": "info"
+    },
+    "properties": {
+      "id": {
+        "type": "long"
+      },
+      "idInquire": {
+        "type": "long"
+      },
+      "idParentColumn": {
+        "type": "long"
+      },
+      "columnName": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "columnField": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "columnWidth": {
+        "type": "integer"
+      },
+      "visible": {
+        "type": "integer"
+      },
+      "hasStatistics": {
+        "type": "integer"
+      },
+      "statisticsFormat": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "linkUrl": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "sortAsc": {
+        "type": "integer"
+      },
+      "createBy": {
+        "type": "long"
+      },
+      "createTimeLong": {
+        "type": "long"
+      },
+      "updateBy": {
+        "type": "long"
+      },
+      "updateTimeLong": {
+        "type": "long"
+      }
+    }
+  }
+}

+ 27 - 0
conf/esTemplate/oplog.json

@@ -0,0 +1,27 @@
+{
+  "info": {
+    "properties": {
+      "userId": {
+        "type": "long"
+      },
+      "userName": {
+        "type": "text",
+        "index": "not_analyzed",
+        "fielddata": true
+      },
+      "clientIp": {
+        "type": "text",
+        "index": "not_analyzed",
+        "fielddata": true
+      },
+      "url": {
+        "type": "text",
+        "index": "not_analyzed",
+        "fielddata": true
+      },
+      "opDate": {
+        "type": "long"
+      }
+    }
+  }
+}

+ 103 - 0
conf/esTemplate/supplierinfo.json

@@ -0,0 +1,103 @@
+{
+  "info": {
+    "properties": {
+      "id": {
+        "type": "long"
+      },
+      "supplierName": {
+        "type": "text",
+        "analyzer": "index_ansj",
+        "search_analyzer": "query_ansj",
+        "fields": {
+          "raw": {
+            "type":  "keyword"
+          },
+          "number": {
+            "type": "text",
+            "index": "analyzed",
+            "analyzer": "number_analyzer"
+          },
+          "letter": {
+            "type": "text",
+            "index": "analyzed",
+            "analyzer": "letter_analyzer"
+          }
+        }
+      },
+      "supplierCode": {
+        "type": "text",
+        "index": "analyzed",
+        "analyzer": "codefull_analyzer",
+        "fields": {
+          "raw": {
+            "type": "keyword"
+          }
+        }
+      },
+      "supplierKind": {
+        "type": "integer"
+      },
+      "supplierType": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "supplierContent": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "factoryAddress": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "createMan": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "settleKind": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "remark": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "shortPinyin": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "principal": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "linkMan": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "linkPhone": {
+        "type": "text",
+        "index": "analyzed",
+        "analyzer": "codefull_analyzer",
+        "fields": {
+          "raw": {
+            "type": "keyword"
+          }
+        }
+      },
+      "voidFlag": {
+        "type": "integer"
+      },
+      "createBy": {
+        "type": "long"
+      },
+      "createTimeLong": {
+        "type": "long"
+      },
+      "updateBy": {
+        "type": "long"
+      },
+      "updateTimeLong": {
+        "type": "long"
+      }
+    }
+  }
+}

+ 51 - 0
conf/esTemplate/sysmessage.json

@@ -0,0 +1,51 @@
+{
+  "info": {
+    "properties": {
+      "messageId": {
+        "type": "long"
+      },
+      "messageType": {
+        "type": "long"
+      },
+      "sendUserId": {
+        "type": "long"
+      },
+      "sendUserName": {
+        "type": "text",
+        "index": "not_analyzed",
+        "fields": {
+          "raw": {
+            "type":  "keyword"
+          }
+        }
+      },
+      "sendTimeLong": {
+        "type": "long"
+      },
+      "recvUserId": {
+        "type": "long"
+      },
+      "recvUserName": {
+        "type": "text",
+        "index": "not_analyzed",
+        "fields": {
+          "raw": {
+            "type":  "keyword"
+          }
+        }
+      },
+      "expireFlag": {
+        "type": "long"
+      },
+      "expireTime": {
+        "type": "long"
+      },
+      "readStatus": {
+        "type": "long"
+      },
+      "textId": {
+        "type": "long"
+      }
+    }
+  }
+}

+ 39 - 0
conf/esTemplate/sysmessagestatus.json

@@ -0,0 +1,39 @@
+{
+  "info": {
+    "properties": {
+      "userId": {
+        "type": "long"
+      },
+      "messageId": {
+        "type": "long"
+      },
+      "messageType": {
+        "type": "long"
+      },
+      "sendUserId": {
+        "type": "long"
+      },
+      "sendUserName": {
+        "type": "text",
+        "index": "not_analyzed",
+        "fields": {
+          "raw": {
+            "type":  "keyword"
+          }
+        }
+      },
+      "sendTimeLong": {
+        "type": "long"
+      },
+      "voidFlag": {
+        "type": "integer"
+      },
+      "readStatus": {
+        "type": "long"
+      },
+      "textId": {
+        "type": "long"
+      }
+    }
+  }
+}

+ 33 - 0
conf/esTemplate/sysmessagetext.json

@@ -0,0 +1,33 @@
+{
+  "info": {
+    "properties": {
+      "textId": {
+        "type": "long"
+      },
+      "messageTitle": {
+        "type": "text",
+        "analyzer": "index_ansj",
+        "search_analyzer": "query_ansj",
+        "fields": {
+          "raw": {
+            "type":  "keyword"
+          }
+        }
+      },
+      "messageContent": {
+        "type": "text",
+        "analyzer": "index_ansj",
+        "search_analyzer": "query_ansj"
+      },
+      "messageLink": {
+        "type": "text",
+        "index": "not_analyzed",
+        "fields": {
+          "raw": {
+            "type":  "keyword"
+          }
+        }
+      }
+    }
+  }
+}

+ 75 - 0
conf/eskeys.properties

@@ -0,0 +1,75 @@
+# suppress inspection "UnusedProperty" for whole file
+
+#注意ES的index只能为小写
+
+#系统群发消息索引库,理论上此库只需一个即可,群发消息不会太多
+es.sysmsg.index=dydeliver_sysmsg_
+
+#系统群发消息内容索引库
+es.sysmsgtext.index = dydeliver_sysmsgtext_
+
+#用户对用户或者消息通知,发送给指定人的消息,暂时可以只用一个进行存储,
+#未来数据量大的情况下,可以按年份之类的条件增加索引
+es.p2pmsg.index = dydeliver_p2pmsg_
+
+#点对点消息内容索引库
+es.p2pmsgtext.index = dydeliver_p2pmsgtext_
+
+#用户对应消息状态,用户在登录时在群发和对点发消息库中查找未读的消息写入此库中
+#方便分页和最后的展示,理论上此库需要进行分表,可以针对用户id进行路由
+es.usermsg.index = dydeliver_usermsg_
+
+
+#通用文件信息存储
+es.erpfile.index = dydeliver_erpfile_
+
+#数据权限
+es.erpdatapurview.index = dydeliver_erpdatepurview_
+
+#查询统计
+es.inquireinfo.index = dydeliver_inquireinfo_
+
+es.productinfo.index = dydeliver_product_info_
+es.product.image.index = dydeliver_product_image_
+
+es.workprocess.index = dydeliver_workprocess_info_
+
+#施工单
+es.printbill.index = dydeliver_printbill_
+es.billstep.index = dydeliver_billstep_
+es.breedprocess.index = dydeliver_breedprocess_
+
+#客户
+es.clientinfo.index = dydeliver_clientinfo_
+es.clientreceiveaddress.index = dydeliver_clientreceiveaddress_
+
+#纸张&辅料
+es.paperbaseinfo.index = dydeliver_paperbaseinfo_
+es.paperinfotype.index = dydeliver_paperinfotype_
+es.paperinfo.index = dydeliver_paperinfo_
+es.paperquoteinfo.index = dydeliver_paperquoteinfo_
+
+es.materialinfotype.index = dydeliver_materialinfotype_
+es.materialinfo.index = dydeliver_materialinfo_
+
+#外协
+es.outassistinfo.index = dydeliver_outassistinfo_
+#供应商
+es.supplierInfo.index = dydeliver_supplierinfo_
+#平台档案
+es.platforminfo.index = dydeliver_platforminfo_
+#平台需求信息档案
+es.platformrequire.index = dydeliver_platformrequire_
+#门店品牌档案
+es.storebrand.index = dydeliver_storebrand_
+#门店档案
+es.storeinfo.index = dydeliver_storeinfo_
+#门店已开通平台
+es.storeplatform.index = dydeliver_storeplatform_
+#订单
+es.businesorder.index = dydeliver_businessorder_
+#订单脚印
+es.orderstep.index = dydeliver_orderstep_
+#订单退款申请
+es.refundorderrequest.index = dydeliver_refundorderrequest_
+

+ 77 - 0
conf/log4j2-sweetfish.yml

@@ -0,0 +1,77 @@
+Configuration:
+  status: warn
+
+  Properties: # 定义全局变量
+    Property: # 缺省配置(用于开发环境)。其他环境需要在VM参数中指定,如下:
+      #测试:-Dlog.level.console=warn -Dlog.level.xjj=trace
+      #生产:-Dlog.level.console=warn -Dlog.level.xjj=info
+      - name: log.level.console
+        value: trace
+      - name: log.path
+        value: ${sys:APP_HOME}/logs
+      - name: project.name
+        value: ${sys:current.app.name}
+
+  Appenders:
+    Console:  #输出到控制台
+      name: CONSOLE
+      target: SYSTEM_OUT
+      PatternLayout:
+        Pattern: '[%d] %p [${project.name}] %c{1} [%l] %M [%t] -- %m%n'
+    RollingFile: # 输出到文件,超过128MB归档
+      - name: infoRollingFile
+        ThresholdFilter:
+          level: info
+          onMatch: ACCEPT
+          onMismatch: DENY
+        ignoreExceptions: false
+        fileName: ${log.path}/${project.name}/info.log
+        filePattern: ${log.path}/${project.name}/info.%d{yyyy-MM-dd}.log
+        PatternLayout:
+          pattern: '[%d] %p [${project.name}] %c{1} %M [%t] [%X{reqId}] -- %m%n'
+        Policies:
+          SizeBasedTriggeringPolicy:
+            size: "128 MB"
+          TimeBasedTriggeringPolicy:
+            interval: 1
+            modulate: true
+      - name: errorRollingFile
+        ThresholdFilter:
+          level: error
+          onMatch: ACCEPT
+          onMismatch: DENY
+        ignoreExceptions: false
+        fileName: ${log.path}/${project.name}/error.log
+        filePattern: ${log.path}/${project.name}/err.%d{yyyy-MM-dd}.log
+        PatternLayout:
+          pattern: '[%d]\t%p\t[${project.name}]\t%c{1}\t%M\t[%t]\t[%X{reqId}]\t--\t%m%n'
+        Policies:
+          SizeBasedTriggeringPolicy:
+            size: "128 MB"
+          TimeBasedTriggeringPolicy:
+            interval: 1
+            modulate: true
+      - name: warnRollingFile
+        ThresholdFilter:
+          level: warn
+          onMatch: ACCEPT
+          onMismatch: DENY
+        ignoreExceptions: false
+        fileName: ${log.path}/${project.name}/access.log
+        filePattern: ${log.path}/${project.name}/warn.%d{yyyy-MM-dd}.log
+        PatternLayout:
+          pattern: '[%d]\t%p\t[${project.name}]\t--\t%m%n'
+        Policies:
+          SizeBasedTriggeringPolicy:
+            size: "128 MB"
+          TimeBasedTriggeringPolicy:
+            interval: 1
+            modulate: true
+  Loggers:
+    Root:
+      level: info
+      AppenderRef:
+        - ref: CONSOLE
+        - ref: infoRollingFile
+        - ref: errorRollingFile
+        - ref: warnRollingFile

+ 34 - 0
conf/redis.properties

@@ -0,0 +1,34 @@
+# suppress inspection "UnusedProperty" for whole file
+
+# 操作超时时间,默认2秒
+redis.timeout=3000
+
+# redis url接口以";"分割多个地址
+# 阿里云 centos redis地址
+#139.129.245.104:6379
+redis.jedisPoolConfig.urls=192.168.1.243:6379
+redis.jedisPoolConfig.password=Admin@dounengyin@123
+#redis.jedisPoolConfig.password=
+
+# jedis池最大连接数总数,默认8
+redis.jedisPoolConfig.maxTotal=32
+
+# jedis池最大空闲连接数,默认8
+redis.jedisPoolConfig.maxIdle=32
+
+#jedis池最少空闲连接数
+redis.jedisPoolConfig.minIdle=3
+
+# jedis池没有对象返回时,最大等待时间单位为毫秒
+redis.jedisPoolConfig.maxWaitTime=60000
+
+# 在borrow一个jedis实例时,是否提前进行validate操作
+redis.jedisPoolConfig.testOnBorrow=true
+
+#账单消息消费者节点,对应tradework
+redis.TradeWork.NodeCount=1
+
+#微信Token消息消费者节点,对应tokenwork
+redis.TokenWork.NodeCount=1
+
+redis.database=1

+ 141 - 0
conf/rediskeys.properties

@@ -0,0 +1,141 @@
+# suppress inspection "UnusedProperty" for whole file
+
+redis.reqlimit=dydeliver:reqlimit
+redis.authcode=dydeliver:authcode
+redis.sessions=dydeliver:sessions
+redis.platformsupplier=dydeliver:platform:supplier
+redis.platformsuppliercode=dydeliver:platform:suppliercode
+#单个redis节点的分布式锁
+redis.lock=dydeliver:lock
+redis.dept=dydeliver:sysdept
+redis.account=dydeliver:account
+#存储所有的系统功能,以hash结构存储,如果内存占用高,可把key写成纯数字
+redis.sysactions=dydeliver:sysactions
+#存储所有的系统菜单,以hash结构存储,如果内存占用高,可把key写成纯数字
+redis.sysmenus=dydeliver:sysmenus
+#存储所有的系统角色,以hash结构存储,如果内存占用高,可把key写成纯数字
+redis.sysroles=dydeliver:sysroles
+redis.sysrolemenus=dydeliver:sysrolemenus
+#存储角色的菜单和功能
+redis.sysroleactions=dydeliver:sysroleactions
+#存储用户角色,每个用户一个键值
+#当前服务端未保存用户和session的对应关系,导致无法快速获取用户的角色关系
+#这里在首次从数据库中获取时进行存储,在修改员工档案的时候删除键值并修改
+redis.sysuserrole=dydeliver:sysuserrole
+redis.erp.dicttype=dydeliver:erp:dicttype
+
+
+#系统配置
+redis.configvalue=dydeliver:configvalue
+#字典数据
+redis.dicttype=dydeliver:dicttype
+redis.dictdata=dydeliver:dictdata
+
+#业务脚本
+redis.businessscript=dydeliver:businessscript
+redis.scriptcompile=dydeliver:scriptcompile
+
+#分厂信息
+redis.companyinfo = dydeliver:companyinfo
+
+#消息类型
+redis.erp.noticemessage = dydeliver:noticemessage
+redis.erp.usernoticemessage = dydeliver:usernoticemessage
+
+redis.erp.pay.tradeno = dydeliver:erp:pay:tradeno
+
+#消息组前缀
+redis.erp.noticemsggroup = dydeliver:noticemsggroup
+
+#登录用户,一直记录,用户登录则记录下信息
+redis.erp.loginuser = dydeliver:loginuser
+redis.erp.onlineuser = dydeliver:onlineuser
+
+redis.erp.personconfig = dydeliver:personconfig
+
+redis.formtoken = dydeliver:formtoken
+redis.formtokenex = dydeliver:formtokenex
+
+#仪表盘
+redis.cardpanel = dydeliver:cardpanel
+
+#业务锁定数据
+redis.erplock.data = dydeliver:erplock:data
+redis.erplock.userdata = dydeliver:erplock:userdata
+redis.erplock.exclusivelockpart = dydeliver:erplock:exclusivelockpart
+
+#版的版心尺寸
+redis.erp.breedplatesize = dydeliver:erp:breedplatesize
+
+#查询统计
+redis.erp.inquireinfo = dydeliver:erp:inquireinfo
+
+#分厂
+redis.company.info = dydeliver:erp:company:info
+
+redis.erp.product.parameter = dydeliver:erp:product:parameter
+redis.erp.product.info = dydeliver:erp:product:info
+redis.erp.product.detail = dydeliver:erp:product:detail
+redis.erp.product.type = dydeliver:erp:product:type
+redis.erp.product.pagePrice = dydeliver:erp:product:pagePrice
+redis.erp.product.example.image = dydeliver:erp:product:exampleImage
+redis.erp.product.room = dydeliver:erp:product:room
+
+#单据打印次数
+redis.erp.itemprintcount = dydeliver:print:printcount
+
+redis.erp.order.cycle.item = dydeliver:erp:cycle:item:order
+
+redis.erp.print.bill.cycle.item = dydeliver:erp:cycle:item:printBill
+
+
+redis.erp.develop.client = dydeliver:erp:developclient
+redis.erp.develop.client.code = dydeliver:erp:developclientcode
+
+#机型机台
+redis.erp.machine.type = dydeliver:erp:machine:type
+redis.erp.machine.info = dydeliver:erp:machine:info
+
+#数据锁定
+
+redis.erp.client.industry.info = dydeliver:erp:client:industry:info
+redis.erp.client.moneybalance = dydeliver:erp:client:balance:clientmoney
+redis.erp.client.clientlevel = dydeliver:erp:client:clientlevel
+
+#纸张品牌
+redis.erp.paper.brand = dydeliver:erp:paper:brand
+#纸张开数档案
+redis.erp.paper.cut.info = dydeliver:erp:paper:cut:info
+redis.erp.paper.cut.size.info= dydeliver:erp:paper:cut:size:info
+
+#平台信息档案
+redis.deliver.platforminfo = dydeliver:deliver:platforminfo
+#平台需求条件档案
+redis.deliver.platformrequire = dydeliver:deliver:platformrequire
+#门店品牌
+redis.deliver.storebrand = dydeliver:deliver:storebrand
+#抖音上一次刷新token的时间,将废弃
+redis.douyin.lasttokendate = dydeliver:douyin:lasttokendate
+#抖音当前的token,将废弃
+redis.douyin.accesstoken = dydeliver:douyin:accesstoken
+
+#平台上一次刷新token的时间
+redis.platform.lasttokendate = dydeliver:platform:lasttokendate
+#平台当前的token
+redis.platform.accesstoken = dydeliver:platform:accesstoken
+
+redis.erp.order.shop.sequence = dydeliver:erp:order:shop:sequence
+
+redis.erp.working.order = dydeliver:erp:working:order
+redis.erp.working.express.sf.order = dydeliver:erp:working:express:sf:order
+redis.erp.working.express.sf.store = dydeliver:erp:working:express:sf:store
+
+#抖音推送消息msg_id
+redis.deliver.douyin.call.msgid = dydeliver:douyin:callmsgid
+
+redis.erp.order.rider.geo = dydeliver:erp:order:rider:geo
+
+
+
+
+

+ 85 - 0
conf/redisscript/balance_client_moneys.lua

@@ -0,0 +1,85 @@
+---
+--- Generated by EmmyLua(https://github.com/EmmyLua)
+--- Created by jlutt.
+--- DateTime: 2020-09-07 16:26
+--- 客户余额操作
+--- 客户余额的操作基本为单个客户的操作,客户存款,预存款冲抵
+---
+
+local key = KEYS[1]
+local jsonData = ARGV[2]
+local jsonCheckData = ARGV[1]
+
+local material = cjson.decode(jsonData)
+local checkMaterial = cjson.decode(jsonCheckData)
+
+local result = {}
+
+result['error'] = 0
+result['errorMsg'] = ''
+
+--- 检查能否减少数量
+for k, v in pairs(checkMaterial) do
+    local numName = v['numName']
+    local numKey = v['numKey']
+    local numField = v['numField']
+    local nowNum = tonumber(redis.call('HGET', numKey, numField))
+
+    if (nowNum == nil) then
+        nowNum = 0;
+    end
+
+    local incrNum = v['incrNum']
+
+    if ((nowNum == nil or nowNum <= 0) and (incrNum < 0)) then
+        result['error'] = 1
+        result['errorMsg'] = numName .. '余额不足'
+        break ;
+    end
+
+    if (nowNum + incrNum) < 0 then
+        result['error'] = 1
+        result['errorMsg'] = numName .. '余额不足'
+        break ;
+    end
+end
+
+local currIndex2 = 1
+local stock = {}
+if (result['error'] == 0) then
+    --数量都够,可以操作
+    for k, v in pairs(material) do
+        local numKey = v['numKey']
+        local numField = v['numField']
+        local incrNum = v['incrNum']
+
+        stock[currIndex2] = {}
+
+        stock[currIndex2]['idClient'] = v['idClient'];
+
+        local iExists = redis.call("HEXISTS", numKey, numField);
+        if (iExists == 0) then
+            stock[currIndex2]['insert'] = 1
+        else
+            stock[currIndex2]['insert'] = 0
+        end
+
+        local afterNum = redis.call("HINCRBY", numKey, numField, incrNum)
+
+        stock[currIndex2]['beforeNum'] = afterNum - incrNum
+        stock[currIndex2]['afterNum'] = afterNum
+        stock[currIndex2]['calcNum'] = incrNum
+
+        currIndex2 = currIndex2 + 1
+    end
+end
+
+local time = redis.call('TIME')
+result['time'] = time[1]
+result['microseconds'] = time[2]
+
+result['clientList'] = stock
+
+local re = cjson.encode(result);
+
+return re

+ 11 - 0
conf/redisscript/formtoken.lua

@@ -0,0 +1,11 @@
+local key = KEYS[1]
+local field = ARGV[1]
+
+local afterNum = -1;
+
+local iExists = redis.call("HEXISTS", key, field);
+if (iExists == 0) then
+else
+    afterNum = tonumber(redis.call("HINCRBY", key, field, 1))
+end
+return  tostring(afterNum);

+ 33 - 0
conf/redisscript/hincrby_multiple.lua

@@ -0,0 +1,33 @@
+--- redis一次性HINCRBY多个字段
+
+local key = KEYS[1]
+local jsonData = ARGV[1]
+
+local fields = cjson.decode(jsonData)
+
+local result = {}
+
+result['error'] = 0
+result['errorMsg'] = ''
+
+local currIndex = 1
+local nums = {}
+for k, v in pairs(fields) do
+    local numKey = v['numKey']
+    local numField = v['numField']
+    local incrNum = v['incrNum']
+
+    local afterNum = redis.call("HINCRBY", numKey, numField, incrNum)
+
+    nums[currIndex] = {}
+    nums[currIndex]['numField'] = numField
+    nums[currIndex]['afterNum'] = afterNum
+
+    currIndex = currIndex + 1
+end
+
+result['numList'] = nums
+
+local re = cjson.encode(result);
+
+return re

+ 13 - 0
conf/redisscript/lget_ldel.lua

@@ -0,0 +1,13 @@
+---
+--- 从list中头部获取指定数量的数据,然后删除
+--- Generated by EmmyLua(https://github.com/EmmyLua)
+--- Created by Administrator.
+--- DateTime: 2018-12-19 15:21
+---
+
+local key = KEYS[1]
+local range = tonumber(ARGV[1]) - 1
+
+local result = redis.call('LRANGE', key, 0, range)
+redis.call('LTRIM', key, range + 1, -1)
+return result

+ 146 - 0
conf/redisscript/lock_data.lua

@@ -0,0 +1,146 @@
+---
+--- 业务锁定
+--- 键值为key,参数为通过eval传递的数组
+---
+
+function string:split(sep)
+    local sep, fields = sep or ",", {};
+    local pattern = string.format("([^%s]+)", sep);
+    self:gsub(pattern, function(c) fields[#fields+1] = c end);
+    return fields;
+end;
+
+local key = KEYS[1]
+local keyUser = KEYS[2]
+local user = tonumber(ARGV[1])
+--- op = 0 锁定 op = 1 解锁
+local op = tonumber(ARGV[2])
+local idStr = ARGV[3]
+
+local idArr = idStr:split()
+---unpack如果报错,可能是redis集成的lua版本问题,可改为table.unpack
+local vals = redis.call("HMGET", key, unpack(idArr))
+
+local result = {}
+result['error'] = 0
+result['errorMsg'] = ''
+
+---需要判断两种情况,1返回值为空键值不存在 2返回的所有值都为空,表示无人锁定
+if (next(vals) == nil) then
+    if (op == 0) then
+        ---整个都为空,理论为键值不存在 表示无人锁定
+        local newTable = {}
+        local newTableUser = {}
+        local i = 1
+        for k, v in pairs(idArr) do
+            newTable[i] = v;
+            newTable[i + 1] = tostring(user)
+            newTableUser[i] = tostring(v) .. "-" .. tostring(user) .. "-0"
+            newTableUser[i + 1] = "1"
+            i = i + 2
+        end
+        redis.call("HMSET", key, unpack(newTable))
+        redis.call("HMSET", keyUser, unpack(newTableUser))
+        ---返回所有id
+        result['successIds'] = idArr
+        result['realSuccessIds'] = idArr
+        result['failIds'] = { };
+    else
+        --- 解锁时,无人锁定
+        result['error'] = 1
+        result['errorMsg'] = '无锁定数据'
+        result['successIds'] = {}
+        result['realSuccessIds'] = {}
+        result['failIds'] = idArr
+    end
+    return cjson.encode(result);
+else
+    ---可锁定ids
+    local waitSuccessLockIds = {};
+    local waitRealSuccessLockIds = {};
+    local waitFailLockIds = {};
+
+    ---可解锁ids
+    local waitSuccessDelIds = {};
+    local waitSuccessDelUserIds = {};
+    local waitFailDelIds = {};
+    for k, v in pairs(vals) do
+        if (v == false) then
+            ---表示不存在此值,即数据未锁定
+            if (op == 0) then
+                waitSuccessLockIds[#waitSuccessLockIds + 1] = idArr[k];
+                waitRealSuccessLockIds[#waitRealSuccessLockIds + 1] = idArr[k];
+            else
+                waitFailDelIds[#waitFailDelIds + 1] = idArr[k];
+            end
+        else
+            if (op == 0) then
+                ---锁定情况下 表示有值,但需要做进一步判断是否锁定人和传入的操作人不同
+                if (tonumber(v) ~= user) then
+                    waitFailLockIds[#waitFailLockIds + 1] = idArr[k];
+                else
+                    waitSuccessLockIds[#waitSuccessLockIds + 1] = idArr[k];
+                end
+            else
+                ---解锁情况下 表示有值,但需要做进一步判断是否锁定人和传入的操作人不同
+                if (tonumber(v) == user) then
+                    waitSuccessDelIds[#waitSuccessDelIds + 1] = idArr[k];
+                    waitSuccessDelUserIds[#waitSuccessDelUserIds + 1] = tostring(idArr[k]) .. "-" .. tostring(user) .. "-0"
+                else
+                    waitFailDelIds[#waitFailDelIds + 1] = idArr[k];
+                end
+            end
+        end
+    end
+
+    if (op == 0) then
+        if (next(waitSuccessLockIds) ~= nil) then
+            local newTable = {}
+            local newTableUser = {}
+            local i = 1
+            for k, v in pairs(waitSuccessLockIds) do
+                newTable[i] = v;
+                newTable[i + 1] = tostring(user)
+                newTableUser[i] = tostring(v) .. "-" .. tostring(user) .. "-0"
+                newTableUser[i + 1] = "1"
+                i = i + 2
+            end
+            redis.call("HMSET", key, unpack(newTable))
+            redis.call("HMSET", keyUser, unpack(newTableUser))
+            result['error'] = 0
+            result['errorMsg'] = ''
+            result['successIds'] = waitSuccessLockIds
+            result['realSuccessIds'] = waitRealSuccessLockIds
+            result['failIds'] = waitFailLockIds
+        else
+            result['error'] = 1
+            result['errorMsg'] = '无可锁定数据'
+            result['successIds'] = waitSuccessLockIds
+            result['realSuccessIds'] = waitRealSuccessLockIds
+            result['failIds'] = waitFailLockIds
+        end
+        return cjson.encode(result);
+    else
+        if (next(waitSuccessDelIds) ~= nil) then
+            redis.call("HDEL", key, unpack(waitSuccessDelIds))
+            redis.call("HDEL", keyUser, unpack(waitSuccessDelUserIds))
+            result['error'] = 0
+            result['errorMsg'] = ''
+            result['successIds'] = waitSuccessDelIds
+            result['realSuccessIds'] = waitSuccessDelIds
+            result['failIds'] = waitFailDelIds
+        else
+            result['error'] = 1
+            result['errorMsg'] = '无可解锁数据'
+            result['successIds'] = waitSuccessDelIds
+            result['realSuccessIds'] = waitSuccessDelIds
+            result['failIds'] = waitFailDelIds
+        end
+        return cjson.encode(result);
+    end
+end
+
+
+
+
+

+ 24 - 0
conf/redisscript/lock_order.lua

@@ -0,0 +1,24 @@
+---
+--- Generated by EmmyLua(https://github.com/EmmyLua)
+--- Created by Administrator.
+--- DateTime: 2018-03-13 10:42
+--- 订单、施工单版本号判断
+---
+local key = KEYS[1]
+local idOrder = ARGV[1]
+local inputVersion = tonumber(ARGV[2])
+
+local nowVersion = tonumber(redis.call('HGET', key, idOrder))
+if (nowVersion == nil) then
+    nowVersion = 0
+end
+
+local afterNum = -1;
+if (inputVersion == nowVersion) then
+    afterNum = tonumber(redis.call("HINCRBY", key, idOrder, 1))
+end
+return  tostring(afterNum);
+
+
+
+

+ 48 - 0
conf/redisscript/lock_order_designer.lua

@@ -0,0 +1,48 @@
+---
+--- Generated by EmmyLua(https://github.com/EmmyLua)
+--- Created by jlutt.
+--- DateTime: 2020-12-21 11:17
+--- 修图人员暂停重启订单数量变更
+
+local orderKey = KEYS[1]
+local imageKey = KEYS[2]
+local idUser = ARGV[1]
+local userMax = tonumber(ARGV[2])
+local imagePCount = tonumber(ARGV[3])
+local iKind = tonumber(ARGV[4])
+
+local nowCount = tonumber(redis.call('HGET', orderKey, idUser))
+if (nowCount == nil) then
+    nowCount = 0
+end
+
+local afterNum = -1;
+
+if (iKind == 0) then
+    -- 正常的分配或者处理
+    --- 设置P数
+    if (imagePCount < 0) then
+        afterNum = redis.call("ZSCORE", imageKey, idUser)
+        if ((afterNum == nil or tonumber(afterNum) <= 0)) then
+            afterNum = 0
+        else
+            afterNum = redis.call("ZINCRBY", imageKey, imagePCount, idUser)
+        end
+    else
+        afterNum = redis.call("ZINCRBY", imageKey, imagePCount, idUser)
+    end
+elseif (iKind > 0) then
+    --- 暂停
+    if (nowCount < userMax) then
+        afterNum = tonumber(redis.call("HINCRBY", orderKey, idUser, 1))
+        --- 设置P数
+        redis.call("ZINCRBY", imageKey, imagePCount, idUser)
+    end
+else
+    --- 重启
+    afterNum = tonumber(redis.call("HINCRBY", orderKey, idUser, -1))
+    --- 设置P数
+    redis.call("ZINCRBY", imageKey, imagePCount, idUser)
+end
+
+return tostring(afterNum);

+ 57 - 0
conf/redisscript/qty_stock_material.lua

@@ -0,0 +1,57 @@
+---
+--- Generated by EmmyLua(https://github.com/EmmyLua)
+--- Created by 81460.
+--- DateTime: 2020-01-13 14:10
+--- 纸张、辅料的库存数量操作
+
+local key = KEYS[1]
+
+local field = ARGV[1]
+local incrNum = tonumber(ARGV[2])
+
+local x = {}
+local nowNum = tonumber(redis.call('HGET', key, field))
+
+if (nowNum == nil) then
+    x['beforeStock'] = 0
+    x['insert'] = 1
+else
+    x['beforeStock'] = nowNum
+    x['insert'] = 0
+end
+
+if (nowNum == nil) then
+    if (incrNum >= 0) then
+        --- 入库操作
+        redis.call("HSET", key, field, incrNum)
+        x['stockNum'] = incrNum
+        x['afterStock'] = incrNum
+    else
+        --- 出库操作
+        x['stockNum'] = -1
+        x['insert'] = -1
+        x['afterStock'] = -1
+    end
+else
+    local afterNum = tonumber(redis.call("HINCRBY", key, field, incrNum))
+    if (afterNum >= 0.0) then
+        --- 可以操作
+        x['stockNum'] = incrNum
+        x['afterStock'] = afterNum
+        --- return afterNum
+    else
+        --- 为负了,则加回去,不允许操作
+        redis.call("HINCRBY", key, field, -1 * incrNum)
+        x['stockNum'] = -1
+        x['insert'] = -1
+        x['afterStock'] = -1
+        --- return -1
+    end
+end
+
+local time = redis.call('TIME')
+x['time'] = time[1]
+x['microseconds'] = time[2]
+local re = cjson.encode(x);
+
+return re

+ 198 - 0
conf/redisscript/qty_stock_materials.lua

@@ -0,0 +1,198 @@
+---
+--- Generated by EmmyLua(https://github.com/EmmyLua)
+--- Created by 81460.
+--- DateTime: 2020-01-13 16:08
+--- 批量操作物料库存数量
+--- 前提条件
+--- 1、不允许一个进销存单据明细中同一种物料有不同的库房库位,如果需要做不同的库房库位操作,可以先做库存转移,然后在入库或者出库
+--- 2、numKey为一个hash表,用于存储所有的物料的 numField的当前数量,numField可以用库房+库位字符串来区分
+--- 4、计算逻辑只是简单的先判断传入的每个物料的当前数量是否大于需要增减的数量(减少数量传入负值即可),全部都符合条件则进行增减
+--- 5、增减物料数量
+--- 6、传进来的数据明细为正常的list转json即可
+--- 7、传进来的数据明细对象为RedisStockCalcItem,输出对象为RedisStockCalcInfo
+---[
+---
+---      {
+---        "name":"Porsche",
+---       "stock": 11.1
+---      },
+---      {
+---     "name":"BMW"
+---   },
+---   {
+---     "name":"Volvo"
+---   }
+---]
+---Result返回对象为json
+---Result.error = 0表示无措
+---Result.errorMsg 表示错误信息
+---
+---
+local key = KEYS[1]
+local jsonData = ARGV[2]
+local jsonCheckData = ARGV[1]
+
+local material = cjson.decode(jsonData)
+local checkMaterial = cjson.decode(jsonCheckData)
+
+local result = {}
+
+result['error'] = 0
+result['errorMsg'] = ''
+
+--- 检查能否减少数量
+for k, v in pairs(checkMaterial) do
+    local numName = v['numName']
+    local numKey = v['numKey']
+    local numField = v['numField']
+    local nowNum = tonumber(redis.call('HGET', numKey, numField))
+
+    if (nowNum == nil) then
+        nowNum = 0;
+    end
+
+    local incrNum = v['incrNum']
+
+    if ((nowNum == nil or nowNum <= 0) and (incrNum < 0)) then
+        result['error'] = 1
+        result['errorMsg'] = numName .. '数量不足'
+        break ;
+    end
+
+    if (nowNum + incrNum) < 0 then
+        result['error'] = 1
+        result['errorMsg'] = numName .. '数量不足'
+        break ;
+    end
+
+    local idToStockRoom = v['idToStockRoom']
+    if (idToStockRoom > 0) then
+        --- 判断目标库存
+        local numToField = v['numToField']
+        local numToName = v['numToName']
+        local nowToNum = tonumber(redis.call('HGET', numKey, numToField))
+
+        if (nowToNum == nil) then
+            nowToNum = 0;
+        end
+
+        local incrToNum = v['incrToNum']
+
+        if ((nowToNum == nil or nowToNum <= 0) and (incrToNum < 0)) then
+            result['error'] = 1
+            result['errorMsg'] = numToName .. '数量不足'
+            break ;
+        end
+
+        if (nowToNum + incrToNum) < 0 then
+            result['error'] = 1
+            result['errorMsg'] = numToName .. '数量不足'
+            break ;
+        end
+    end
+end
+
+local currIndex2 = 1
+local stock = {}
+if (result['error'] == 0) then
+    --数量都够,可以操作
+    for k, v in pairs(material) do
+        local numKey = v['numKey']
+        local numField = v['numField']
+        local incrNum = v['incrNum']
+
+        ---local storeKey = v['storeKey']
+        ---local storeField = v['storeField']
+
+        stock[currIndex2] = {}
+
+        stock[currIndex2]['idCompany'] = v['idCompany'];
+        stock[currIndex2]['idToCompany'] = v['idToCompany'];
+        stock[currIndex2]['idMaterial'] = v['idMaterial'];
+        stock[currIndex2]['materialFlag'] = v['materialFlag'];
+        stock[currIndex2]['qtyPrecise'] = v['qtyPrecise'];
+        stock[currIndex2]['idStockRoom'] = v['idStockRoom'];
+
+        local iExists = redis.call("HEXISTS", numKey, numField);
+        if (iExists == 0) then
+            stock[currIndex2]['insert'] = 1
+        else
+            stock[currIndex2]['insert'] = 0
+        end
+
+        local afterNum = redis.call("HINCRBY", numKey, numField, incrNum)
+
+        stock[currIndex2]['beforeStock'] = afterNum - incrNum
+        stock[currIndex2]['afterStock'] = afterNum
+        stock[currIndex2]['stockNum'] = incrNum
+
+        if (v['idCompany'] > 0) then
+            local iCompanyExists = redis.call("HEXISTS", numKey, v['companyField']);
+            if (iCompanyExists == 0) then
+                stock[currIndex2]['companyInsert'] = 1
+            else
+                stock[currIndex2]['companyInsert'] = 0
+            end
+
+            local companyAfterNum = redis.call("HINCRBY", numKey, v['companyField'], incrNum)
+
+            stock[currIndex2]['companyBeforeStock'] = companyAfterNum - incrNum
+            stock[currIndex2]['companyAfterStock'] = companyAfterNum
+            stock[currIndex2]['companyStockNum'] = incrNum
+        else
+            stock[currIndex2]['companyInsert'] = -1
+        end
+
+        local idToStockRoom = v['idToStockRoom']
+        if (idToStockRoom > 0) then
+
+            local numToField = v['numToField']
+            local incrToNum = v['incrToNum']
+
+            stock[currIndex2]['idToStockRoom'] = v['idToStockRoom'];
+
+            local iToExists = redis.call("HEXISTS", numKey, numToField);
+            if (iToExists == 0) then
+                stock[currIndex2]['toInsert'] = 1
+            else
+                stock[currIndex2]['toInsert'] = 0
+            end
+
+            local afterToNum = redis.call("HINCRBY", numKey, numToField, incrToNum)
+
+            stock[currIndex2]['toBeforeStock'] = afterToNum - incrToNum
+            stock[currIndex2]['toAfterStock'] = afterToNum
+            stock[currIndex2]['toStockNum'] = incrToNum
+
+            if (v['idToCompany'] > 0) then
+                local iToCompanyExists = redis.call("HEXISTS", numKey, v['companyToField']);
+                if (iToCompanyExists == 0) then
+                    stock[currIndex2]['toCompanyInsert'] = 1
+                else
+                    stock[currIndex2]['toCompanyInsert'] = 0
+                end
+
+                local toCompanyAfterNum = redis.call("HINCRBY", numKey, v['companyToField'], incrToNum)
+
+                stock[currIndex2]['toCompanyBeforeStock'] = toCompanyAfterNum - incrToNum
+                stock[currIndex2]['toCompanyAfterStock'] = toCompanyAfterNum
+                stock[currIndex2]['toCompanyStockNum'] = incrToNum
+            else
+                stock[currIndex2]['toCompanyInsert'] = -1
+            end
+        end
+
+        ---stock[currIndex2]['insert'] = redis.call("HSET", storeKey, storeField, afterNum)
+        currIndex2 = currIndex2 + 1
+    end
+end
+
+local time = redis.call('TIME')
+result['time'] = time[1]
+result['microseconds'] = time[2]
+
+result['stockList'] = stock
+
+local re = cjson.encode(result);
+
+return re

+ 102 - 0
conf/redisscript/qty_stock_precise.lua

@@ -0,0 +1,102 @@
+---
+--- Generated by EmmyLua(https://github.com/EmmyLua)
+--- Created by jlutt.
+--- DateTime: 2020-09-03 9:38
+--- 库存调整精度
+---
+
+local key = KEYS[1]
+local virualKey = KEYS[2]
+
+local field = ARGV[1]..'-*'
+local oldPrecise = tonumber(ARGV[2])
+local newPrecise = tonumber(ARGV[3])
+
+local scanTable = {}
+local scanVirsualTable = {}
+local cursor = 0
+
+repeat
+    local rep = redis.call('HSCAN', key, cursor, 'MATCH', field)
+    cursor = rep[1]
+    for k, v in pairs(rep[2]) do
+        --- lua中k为序号,从1开始
+        if k % 2 == 0 then
+            local numField = rep[2][k -1]
+            local numValue = v
+
+            ---hscan的缺点:同一个元素可能会被返回多次
+            if (scanTable[numField] == nil) then
+                ---不能在hscan中直接调用hset命令,报错replicate_commands
+                ---local newValue = v * (10 ^ (newPrecise - oldPrecise))
+                ---redis.call("HSET", key, numField, newValue)
+                ---redis.log(redis.LOG_WARNING, 'c----' ..numField..'='.. numValue..'=='..newValue);
+                scanTable[numField] = numValue
+            end
+        end
+    end
+until cursor == '0'
+
+cursor = 0
+repeat
+    local rep = redis.call('HSCAN', virualKey, cursor, 'MATCH', field)
+    cursor = rep[1]
+    for k, v in pairs(rep[2]) do
+        --- lua中k为序号,从1开始
+        if k % 2 == 0 then
+            local numField = rep[2][k -1]
+            local numValue = v
+
+            ---hscan的缺点:同一个元素可能会被返回多次
+            if (scanVirsualTable[numField] == nil) then
+                ---不能在hscan中直接调用hset命令,报错replicate_commands
+                ---local newValue = v * (10 ^ (newPrecise - oldPrecise))
+                ---redis.call("HSET", key, numField, newValue)
+                ---redis.log(redis.LOG_WARNING, 'c----' ..numField..'='.. numValue..'=='..newValue);
+                scanVirsualTable[numField] = numValue
+            end
+        end
+    end
+until cursor == '0'
+
+---https://redis.io/commands/EVAL#replicating-commands-instead-of-scripts
+redis.replicate_commands()
+
+local stock = {}
+local currIndex2 = 1
+local x = {}
+for k, v in pairs(scanTable) do
+    local newValue = math.floor(v * (10 ^ (newPrecise - oldPrecise)))
+    redis.call("HSET", key, k, newValue)
+
+    stock[currIndex2] = {}
+    stock[currIndex2]['stockKey'] = k
+    stock[currIndex2]['stockNum'] = newValue
+
+    ---redis.log(redis.LOG_WARNING, 'b----' ..k..'='.. v .. '==='..newValue)
+
+    currIndex2 = currIndex2 + 1
+end
+
+local currIndex3 = 1
+for k, v in pairs(scanVirsualTable) do
+    local newValue = math.floor(v * (10 ^ (newPrecise - oldPrecise)))
+    redis.call("HSET", virualKey, k, newValue)
+
+    ---redis.log(redis.LOG_WARNING, 'b----' ..k..'='.. v .. '==='..newValue)
+
+    currIndex3 = currIndex3 + 1
+end
+
+---释放变量
+scanTable = nil
+scanVirsualTable = nil
+
+---返回值
+local time = redis.call('TIME')
+x['time'] = time[1]
+x['microseconds'] = time[2]
+x['stockList'] = stock
+local re = cjson.encode(x);
+
+return re

+ 118 - 0
conf/redisscript/qty_stock_virtual.lua

@@ -0,0 +1,118 @@
+---
+--- Generated by EmmyLua(https://github.com/EmmyLua)
+--- Created by 81460.
+--- DateTime: 2020-12-09 16:08
+--- 批量操作物料虚拟库存
+--- 前提条件
+--- 1、不允许一个进销存单据明细中同一种物料有不同的库房库位,如果需要做不同的库房库位操作,可以先做库存转移,然后在入库或者出库
+--- 2、numKey为一个hash表,用于存储所有的物料的 numField的当前数量,numField可以用库房+库位字符串来区分
+--- 4、计算逻辑只是简单的先判断传入的每个物料的当前数量是否大于需要增减的数量(减少数量传入负值即可),全部都符合条件则进行增减
+--- 5、增减物料数量
+--- 6、传进来的数据明细为正常的list转json即可
+--- 7、传进来的数据明细对象为RedisStockCalcItem,输出对象为RedisStockCalcInfo
+---[
+---
+---      {
+---        "name":"Porsche",
+---       "stock": 11.1
+---      },
+---      {
+---     "name":"BMW"
+---   },
+---   {
+---     "name":"Volvo"
+---   }
+---]
+---Result返回对象为json
+---Result.error = 0表示无措
+---Result.errorMsg 表示错误信息
+---
+---
+local key = KEYS[1]
+local jsonData = ARGV[1]
+
+local material = cjson.decode(jsonData)
+local result = {}
+
+result['error'] = 0
+result['errorMsg'] = ''
+
+--- 检查能否减少数量
+for k, v in pairs(material) do
+    local numName = v['numName']
+    local numKey = v['numKey']
+    local numVirtualKey = v['numVirtualKey']
+    local numField = v['numField']
+
+    local nowVirtualNum = tonumber(redis.call('HGET', numVirtualKey, numField))
+    local nowQtyNum = tonumber(redis.call('HGET', numKey, numField))
+
+    if (nowVirtualNum == nil) then
+        nowVirtualNum = 0;
+    end
+
+    if (nowQtyNum == nil) then
+        nowQtyNum = 0;
+    end
+
+    local incrNum = v['incrNum']
+
+    --- 判断虚拟库存
+    if (incrNum > 0) then
+        if (nowVirtualNum + incrNum) > nowQtyNum then
+            result['error'] = 1
+            result['errorMsg'] = numName .. '数量不足'
+            break ;
+        end
+    end
+end
+
+local currIndex2 = 1
+local stock = {}
+if (result['error'] == 0) then
+    --数量都够,可以操作
+    for k, v in pairs(material) do
+        local numVirtualKey = v['numVirtualKey']
+        local numField = v['numField']
+        local incrNum = v['incrNum']
+
+        ---local storeKey = v['storeKey']
+        ---local storeField = v['storeField']
+
+        stock[currIndex2] = {}
+
+        stock[currIndex2]['idCompany'] = v['idCompany'];
+        stock[currIndex2]['idToCompany'] = v['idToCompany'];
+        stock[currIndex2]['idMaterial'] = v['idMaterial'];
+        stock[currIndex2]['materialFlag'] = v['materialFlag'];
+        stock[currIndex2]['qtyPrecise'] = v['qtyPrecise'];
+        stock[currIndex2]['idStockRoom'] = v['idStockRoom'];
+
+        local iExists = redis.call("HEXISTS", numVirtualKey, numField);
+        if (iExists == 0) then
+            stock[currIndex2]['insert'] = 1
+        else
+            stock[currIndex2]['insert'] = 0
+        end
+
+        local afterNum = redis.call("HINCRBY", numVirtualKey, numField, incrNum)
+
+        stock[currIndex2]['beforeStock'] = afterNum - incrNum
+        stock[currIndex2]['afterStock'] = afterNum
+        stock[currIndex2]['stockNum'] = incrNum
+        stock[currIndex2]['companyInsert'] = -1
+
+        ---stock[currIndex2]['insert'] = redis.call("HSET", storeKey, storeField, afterNum)
+        currIndex2 = currIndex2 + 1
+    end
+end
+
+local time = redis.call('TIME')
+result['time'] = time[1]
+result['microseconds'] = time[2]
+
+result['stockList'] = stock
+
+local re = cjson.encode(result);
+
+return re

+ 110 - 0
conf/redisscript/qty_stock_virtual_can_negative.lua

@@ -0,0 +1,110 @@
+---
+--- Generated by EmmyLua(https://github.com/EmmyLua)
+--- Created by 81460.
+--- DateTime: 2020-12-09 16:08
+--- 批量操作物料虚拟库存
+--- 前提条件
+--- 1、不允许一个进销存单据明细中同一种物料有不同的库房库位,如果需要做不同的库房库位操作,可以先做库存转移,然后在入库或者出库
+--- 2、numKey为一个hash表,用于存储所有的物料的 numField的当前数量,numField可以用库房+库位字符串来区分
+--- 4、计算逻辑只是简单的先判断传入的每个物料的当前数量是否大于需要增减的数量(减少数量传入负值即可),全部都符合条件则进行增减
+--- 5、增减物料数量
+--- 6、传进来的数据明细为正常的list转json即可
+--- 7、传进来的数据明细对象为RedisStockCalcItem,输出对象为RedisStockCalcInfo
+---[
+---
+---      {
+---        "name":"Porsche",
+---       "stock": 11.1
+---      },
+---      {
+---     "name":"BMW"
+---   },
+---   {
+---     "name":"Volvo"
+---   }
+---]
+---Result返回对象为json
+---Result.error = 0表示无措
+---Result.errorMsg 表示错误信息
+---
+---
+local key = KEYS[1]
+local jsonData = ARGV[1]
+
+local material = cjson.decode(jsonData)
+local result = {}
+
+result['error'] = 0
+result['errorMsg'] = ''
+
+--- 检查能否减少数量
+for k, v in pairs(material) do
+    local numName = v['numName']
+    local numKey = v['numKey']
+    local numVirtualKey = v['numVirtualKey']
+    local numField = v['numField']
+
+    local nowVirtualNum = tonumber(redis.call('HGET', numVirtualKey, numField))
+    local nowQtyNum = tonumber(redis.call('HGET', numKey, numField))
+
+    if (nowVirtualNum == nil) then
+        nowVirtualNum = 0;
+    end
+
+    if (nowQtyNum == nil) then
+        nowQtyNum = 0;
+    end
+
+    local incrNum = v['incrNum']
+
+end
+
+local currIndex2 = 1
+local stock = {}
+if (result['error'] == 0) then
+    --数量都够,可以操作
+    for k, v in pairs(material) do
+        local numVirtualKey = v['numVirtualKey']
+        local numField = v['numField']
+        local incrNum = v['incrNum']
+
+        ---local storeKey = v['storeKey']
+        ---local storeField = v['storeField']
+
+        stock[currIndex2] = {}
+
+        stock[currIndex2]['idCompany'] = v['idCompany'];
+        stock[currIndex2]['idToCompany'] = v['idToCompany'];
+        stock[currIndex2]['idMaterial'] = v['idMaterial'];
+        stock[currIndex2]['materialFlag'] = v['materialFlag'];
+        stock[currIndex2]['qtyPrecise'] = v['qtyPrecise'];
+        stock[currIndex2]['idStockRoom'] = v['idStockRoom'];
+
+        local iExists = redis.call("HEXISTS", numVirtualKey, numField);
+        if (iExists == 0) then
+            stock[currIndex2]['insert'] = 1
+        else
+            stock[currIndex2]['insert'] = 0
+        end
+
+        local afterNum = redis.call("HINCRBY", numVirtualKey, numField, incrNum)
+
+        stock[currIndex2]['beforeStock'] = afterNum - incrNum
+        stock[currIndex2]['afterStock'] = afterNum
+        stock[currIndex2]['stockNum'] = incrNum
+        stock[currIndex2]['companyInsert'] = -1
+
+        ---stock[currIndex2]['insert'] = redis.call("HSET", storeKey, storeField, afterNum)
+        currIndex2 = currIndex2 + 1
+    end
+end
+
+local time = redis.call('TIME')
+result['time'] = time[1]
+result['microseconds'] = time[2]
+
+result['stockList'] = stock
+
+local re = cjson.encode(result);
+
+return re

+ 36 - 0
conf/redisscript/que_pop.lua

@@ -0,0 +1,36 @@
+---
+--- Generated by EmmyLua(https://github.com/EmmyLua)
+--- Created by Administrator.
+--- DateTime: 2018-03-13 10:42
+---
+local queueKey = KEYS[1]
+local inFlightKey = KEYS[2]
+local freqKey = KEYS[3]
+local now = ARGV[1]
+
+local payload = nil
+
+local not_empty = function(x)
+    return (type(x) == 'table') and (not x.err) and (#x ~= 0)
+end
+
+local ok, queueType = next(redis.call('TYPE', queueKey))
+if queueType == 'zset' then
+    local i, lPayload = next(redis.call('ZRANGEBYSCORE', queueKey, '-inf', now, 'LIMIT' , '0' , '1'))
+    if lPayload then
+        payload = lPayload
+        local frequency = redis.call('HGET', freqKey, payload)
+        if frequency then
+            redis.call('ZINCRBY', queueKey, frequency, payload)
+        else
+            redis.call('ZREM', queueKey, payload)
+        end
+    end
+elseif queueType == 'list' then
+    payload = redis.call('LPOP', queueKey)
+    ---if payload then
+    ---    redis.call('LPUSH', inFlightKey, payload)
+    ---end
+end
+
+return payload

+ 53 - 0
conf/redisscript/tablecode.lua

@@ -0,0 +1,53 @@
+if redis.call('exists', KEYS[1]) == 0 then
+    ---redis.log(redis.LOG_WARNING, 'kkk' .. KEYS[1]);
+    return nil
+else
+    local tableCode = redis.call('get', KEYS[1]);
+    if tableCode then
+        redis.log(redis.LOG_WARNING, tableCode);
+        local x = cjson.decode(tableCode);
+        local yearlength = tonumber(x['yearLength']);
+        local ntime = ARGV[1];
+        if (yearlength == 2) then
+            ntime = ARGV[2];
+        end
+        ---redis.log(redis.LOG_WARNING, 'a' .. ntime);
+        local prefixlength = tonumber(x['prefixLength']);
+        ---redis.log(redis.LOG_WARNING, 'b' .. prefixlength);
+        local datelength = tonumber(x['dateLength']);
+        ---redis.log(redis.LOG_WARNING, 'b' .. datelength);
+        local currcode = x['currcode'];
+        if currcode ~= nil then
+            redis.log(redis.LOG_WARNING, 'c' .. currcode);
+        end
+        local codeprefix = '';
+        if (prefixlength > 0) then
+            codeprefix = x['codePrefix'];
+        end
+        ---redis.log(redis.LOG_WARNING, 'd' .. codeprefix);
+        local codeFormat = x['codeFormat'];
+        local acttime = string.sub(ntime, 1, datelength);
+        ---redis.log(redis.LOG_WARNING, 'e' .. codeFormat);
+        if (currcode and currcode ~= '') then
+            ---redis.log(redis.LOG_WARNING, 'h' .. acttime);
+            local codetime = string.sub(currcode, prefixlength + 1, datelength + prefixlength);
+            ---redis.log(redis.LOG_WARNING, 'i' .. codetime);
+            local codeindex = tonumber(string.sub(currcode, prefixlength + datelength + 1));
+            ---redis.log(redis.LOG_WARNING, 'j' .. codeindex);
+            if acttime == codetime then
+                codeindex = codeindex + 1;
+                x['currcode'] = codeprefix .. acttime .. string.format(codeFormat, codeindex);
+            else
+                codeindex = 1;
+                x['currcode'] = codeprefix .. acttime .. string.format(codeFormat, codeindex);
+            end
+        else
+            x['currcode'] = codeprefix .. acttime .. string.format(codeFormat, 1);
+        end
+        local re = cjson.encode(x);
+        redis.call('set', KEYS[1], re);
+
+        return re;
+    end
+end
+return nil

+ 17 - 0
conf/rexdb-pro.properties

@@ -0,0 +1,17 @@
+# suppress inspection "UnusedProperty" for whole file
+#数据源
+
+#1、主数据源可以和工厂数据库用同一个,做到单数据库使用
+#2、多数据库情况下,此处应该在初始化的时候建立多个工厂数据源,系统暂无法动态添加数据源
+
+#主数据,用于获取工厂客户列表
+mysql.driver=com.mysql.jdbc.Driver
+mysql.url=jdbc:mysql://192.168.1.22:3306/heatinginvoker?useUnicode=true&zeroDateTimeBehavior=convertToNull&useSSL=false
+mysql.username=dbadmin
+mysql.password=Admin@123
+
+#erp001
+mysql001.driver=com.mysql.jdbc.Driver
+mysql001.url=jdbc:mysql://192.168.1.22:3306/heatinginvoker?useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&useSSL=false&rewriteBatchedStatements=true
+mysql001.username=dbadmin
+mysql001.password=Admin@123

+ 53 - 0
conf/rexdb-yjWebOne.xml

@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--<configuration>-->
+<!--<settings>-->
+<!--<property name="lang" value="zh-cn"/>-->
+<!--<property name="nolog" value="false" />-->
+<!--<property name="validateSql" value="false" />-->
+<!--<property name="checkWarnings" value="false" />-->
+<!--<property name="queryTimeout" value="-1" />-->
+<!--<property name="transactionTimeout" value="-1" />-->
+<!--<property name="transactionIsolation" value="" />-->
+<!--<property name="autoRollback" value="false" />-->
+<!--<property name="reflectCache" value="true" />-->
+<!--<property name="dynamicClass" value="true" />-->
+<!--<property name="dateAdjust" value="true" />-->
+<!--<property name="batchTransaction" value="true" />-->
+<!--</settings>-->
+
+<!--</configuration>-->
+<configuration>
+    <properties file="rexdb-pro.properties" />
+    <settings>
+        <property name="nolog" value="true"/>
+        <property name="transactionIsolation" value="READ_COMMITTED"/>
+    </settings>
+
+    <dataSource>
+        <property name="driverClassName" value="${mysql.driver}"/>
+        <property name="url" value="${mysql.url}"/>
+        <property name="username" value="${mysql.username}"/>
+        <property name="password" value="${mysql.password}"/>
+        <property name="initSize" value="1"/>
+        <property name="minSize" value="1"/>
+        <property name="increment" value="1"/>
+        <property name="retries" value="3"/>
+        <property name="testConnection" value="true"/>
+    </dataSource>
+
+    <dataSource id = "erp001">
+        <property name="driverClassName" value="${mysql001.driver}"/>
+        <property name="url" value="${mysql001.url}"/>
+        <property name="username" value="${mysql001.username}"/>
+        <property name="password" value="${mysql001.password}"/>
+        <property name="initSize" value="1"/>
+        <property name="minSize" value="1"/>
+        <property name="increment" value="1"/>
+        <property name="retries" value="3"/>
+        <property name="testConnection" value="true"/>
+    </dataSource>
+
+<!--    <listener class="org.rex.db.listener.impl.SqlDebugListener">-->
+<!--        <property name="simple" value="false"/>-->
+<!--    </listener>-->
+</configuration>

+ 8 - 0
conf/script/1000/addressparser/AreaEnum.groovy

@@ -0,0 +1,8 @@
+/**
+ * Created by jlutt on 2022-02-09
+ *
+ * @author jlutt
+ */
+enum AreaEnum {
+    PROVINCE, CITY, COUNTY;
+}

+ 226 - 0
conf/script/1000/addressparser/BE_MapAddressUpdate2.groovy

@@ -0,0 +1,226 @@
+import com.yinjie.heating.common.api.BusinessExecutor
+import com.yinjie.heating.common.datas.ERPModule
+import com.yinjie.heating.common.entity.base.ProcessStringItem
+import com.sweetfish.service.RetResult
+import org.apache.commons.lang3.StringUtils
+import org.apache.logging.log4j.LogManager
+import org.apache.logging.log4j.Logger
+import org.jsoup.Jsoup
+import org.jsoup.nodes.Document
+import org.jsoup.nodes.Element
+import org.jsoup.select.Elements
+import org.jsoup.select.Evaluator
+
+import javax.annotation.Resource
+import java.util.regex.Pattern
+
+/**
+ * Created by jlutt on 2022-07-11
+ * 行政区划更新
+ * 国家统计局数据
+ * @author jlutt
+ */
+@SuppressWarnings(["HttpUrlsUsage", 'unused'])
+class BE_MapAddressUpdate2 implements BusinessExecutor<ProcessStringItem, ProcessStringItem> {
+
+    protected final Logger logger = LogManager.getLogger(this.getClass().getSimpleName())
+
+    //2023-08-29改为从国家统计局获取数据,民政局数据少东西
+
+    @Resource(name = "APP_HOME")
+    protected String appHome
+
+    @Override
+    String scriptName() {
+        return "行政区划更新V2"
+    }
+
+    @Override
+    ERPModule module() {
+        return ERPModule.ADDRESSPARSER
+    }
+
+    def provinceList = []
+    def cityList = []
+    def countryList = []
+
+    @Override
+    RetResult<ProcessStringItem> execute(ProcessStringItem source) {
+        provinceList.clear()
+        cityList.clear()
+        countryList.clear()
+
+        try {
+            getProvinces()
+
+            provinceList.each { p ->
+                getCities(p["code"] as String)
+            }
+
+            cityList.each { c ->
+                getCounties(c["parentCode"] as String, c["code"] as String)
+            }
+
+            new File(appHome + File.separator + "conf" + File.separator + "addressdata", 'provices.json').withWriter('utf-8') { writer ->
+                writer.writeLine '['
+                provinceList.eachWithIndex { p, idx ->
+                    writer.writeLine '  {'
+                    writer.writeLine '      "code": "' + p["fullCode"] + '",'
+                    writer.writeLine '      "name": "' + p["name"] + '"'
+                    writer.writeLine '  }' + (idx != provinceList.size() - 1 ? ',' : "")
+                }
+                writer.writeLine(']')
+            }
+
+            new File(appHome + File.separator + "conf" + File.separator + "addressdata", 'cities.json').withWriter('utf-8') { writer ->
+                writer.writeLine '['
+                cityList.eachWithIndex { p, idx ->
+                    writer.writeLine '  {'
+                    writer.writeLine '      "code": "' + p["fullCode"] + '",'
+                    writer.writeLine '      "name": "' + p["name"] + '"'
+                    writer.writeLine '  }' + (idx != cityList.size() - 1 ? ',' : "")
+                }
+                writer.writeLine(']')
+            }
+
+            new File(appHome + File.separator + "conf" + File.separator + "addressdata", 'counties.json').withWriter('utf-8') { writer ->
+                writer.writeLine '['
+                countryList.eachWithIndex { p, idx ->
+                    writer.writeLine '  {'
+                    writer.writeLine '      "code": "' + p["fullCode"] + '",'
+                    writer.writeLine '      "name": "' + p["name"] + '"'
+                    writer.writeLine '  }' + (idx != countryList.size() - 1 ? ',' : "")
+                }
+                writer.writeLine(']')
+            }
+
+
+        } catch (IOException e) {
+            e.printStackTrace()
+        }
+
+        return RetResult.<ProcessStringItem> successT().result(ProcessStringItem.newBuilder().itemValue("").build())
+    }
+
+    private Elements getElements(String url, Evaluator evaluator) {
+        try {
+            Document document = Jsoup.connect(url)
+                    .header("Accept", "*/*")
+                    .userAgent("Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36 Edg/115.0.1901.188")
+                    .maxBodySize(0)
+                    .followRedirects(true)
+                    .timeout(10000)
+                    .get()
+            Elements elements = document.select(evaluator)
+            // HTTP请求太频繁会导致报错“HTTP error fetching URL. Status=502, URL=……”或“Too many redirects occurred trying to load URL……”,这里暂停几秒再继续下一次HTTP请求
+            Thread.sleep(2 * 1000)
+//            logger.info(url + "符合条件的元素数:" + elements.size())
+            return elements
+        } catch (Exception e) {
+            logger.error(url + ",执行出错:" + e)
+            try {
+                // 请求出错(如:Read timed out、502)后等待一段时间后再尝试,规避因同一IP频繁请求被限制问题
+                Thread.sleep(30 * 60 * 1000)
+            } catch (InterruptedException ex) {
+                logger.error(url + ",执行出错:" + ex)
+            }
+            return null
+        }
+    }
+
+    def getProvinces() {
+        Elements elements = getElements("http://www.stats.gov.cn/sj/tjbz/tjyqhdmhcxhfdm/2022/index.html",
+                new Evaluator.AttributeWithValueEnding("href", ".html"))
+
+        elements.each { element ->
+            String href = element.attributes().get("href")
+            if (href.matches("\\d+\\.html")) {
+                String code = href.replaceAll("\\.html", "")
+                def province = [
+                        code      : code,
+                        fullCode  : StringUtils.rightPad(code, 6, "0"),
+                        name      : element.text(),
+                        parentCode: "",
+                        parentName: ""
+                ]
+//                logger.info(province.code + "=" + province.fullCode + "=" + province.name)
+                provinceList << province
+            }
+        }
+    }
+
+    def getCities(String provinceCode) {
+        Pattern pattern = Pattern.compile(provinceCode + "/\\d+\\.html")
+
+        Elements elements = getElements("http://www.stats.gov.cn/sj/tjbz/tjyqhdmhcxhfdm/2022/" + provinceCode + ".html",
+                new Evaluator.AttributeWithValueMatching("href", pattern))
+        for (Element element : elements) {
+            String href = element.attributes().get("href")
+            String text = element.text()
+            if (pattern.matcher(href).matches()) {
+                String code = href.replaceAll(provinceCode + "/", "").replaceAll("\\.html", "")
+                if (!text.matches("\\d+")) {
+                    def city = [
+                            code      : code,
+                            fullCode  : StringUtils.rightPad(code, 6, "0"),
+                            name      : element.text(),
+                            parentCode: provinceCode
+                    ]
+//                    logger.info(city.code + "=" + city.fullCode + "=" + city.name)
+                    cityList << city
+                }
+            }
+        }
+    }
+
+    def getCounties(String provinceCode, String cityCode) {
+        Pattern pattern = Pattern.compile("\\d+/\\d+\\.html")
+
+        String url = "http://www.stats.gov.cn/sj/tjbz/tjyqhdmhcxhfdm/2022/" + provinceCode + "/" + cityCode + ".html"
+        Document document = Jsoup.connect(url)
+                .header("Accept", "*/*")
+                .userAgent("Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36 Edg/115.0.1901.188")
+                .maxBodySize(0)
+                .followRedirects(true)
+                .timeout(10000)
+                .get()
+
+        Elements elements1 = document.select(("tr.countytr td:contains(市辖区)"))
+
+        if (!elements1.isEmpty()) {
+            Element td1 = elements1.first()
+            String countyCode = StringUtils.left(td1.parent().select("td").get(0).text(), 6)
+
+            def country = [
+                    code      : countyCode,
+                    fullCode  : countyCode,
+                    name      : "市辖区",
+                    parentCode: cityCode
+            ]
+            countryList << country
+        }
+
+        Elements elements = document.select(new Evaluator.AttributeWithValueMatching("href", pattern))
+
+        for (Element element : elements) {
+            String href = element.attributes().get("href")
+            String text = element.text()
+            if (pattern.matcher(href).matches()) {
+                String code = href.replaceAll("\\d+/", "").replaceAll("\\.html", "")
+                if (!text.matches("\\d+")) {
+                    def country = [
+                            code      : code,
+                            fullCode  : StringUtils.rightPad(code, 6, "0"),
+                            name      : element.text(),
+                            parentCode: cityCode
+                    ]
+//                    logger.info(country.code + "=" + country.fullCode + "=" + country.name)
+                    countryList << country
+                }
+            }
+        }
+
+        Thread.sleep(2 * 1000)
+    }
+
+}

+ 804 - 0
conf/script/1000/addressparser/BE_ParseAddress.groovy

@@ -0,0 +1,804 @@
+import com.sweetfish.service.RetResult
+import com.yinjie.heating.common.api.BusinessExecutor
+import com.yinjie.heating.common.datas.ERPModule
+import com.yinjie.heating.common.entity.base.ProcessStringItem
+import com.yinjie.heating.common.entity.system.ParseAreaResult
+import com.yinjie.heating.common.tool.ERPUtils
+import groovy.json.JsonSlurper
+import org.apache.commons.lang3.StringUtils
+import org.apache.logging.log4j.LogManager
+import org.apache.logging.log4j.Logger
+
+import javax.annotation.Resource
+import java.util.concurrent.atomic.AtomicInteger
+import java.util.concurrent.atomic.AtomicReference
+import java.util.regex.Matcher
+import java.util.regex.Pattern
+import java.util.stream.Collectors
+import java.util.stream.Stream
+
+/**
+ * Created by jlutt on 2022-02-09
+ * 地址解析为省市区联系人电话
+ * @author jlutt
+ */
+class BE_ParseAddress implements BusinessExecutor<ProcessStringItem, ParseAreaResult> {
+
+    protected final Logger logger = LogManager.getLogger(this.getClass().getSimpleName())
+
+    private static final String EMPTY = "", BLANK = " "
+
+    /**
+     * 手机号正则
+     */
+    public static String mobile = "(86-1[0-9]{10})|(861[0-9]{10})|(1[0-9]{10})|(1[0-9]{2} [0-9]{4} [0-9]{4})|(1[0-9]{6} [0-9]{4})|(1[0-9]{6}-[0-9]{4})"
+
+    public static Pattern mobilePattern = Pattern.compile(mobile, 32)
+    /**
+     * 座机号正则
+     */
+    public static String phone = "(([0-9]{3,4}-)[0-9]{7,8})|([0-9]{12})|([0-9]{11})|([0-9]{10})|([0-9]{9})|([0-9]{8})|([0-9]{7})"
+
+    public static Pattern phonePattern = Pattern.compile(phone, 32)
+
+    /**
+     * 邮编正则
+     */
+    public static String zipCode = "([0-9]{6})"
+
+    public static Pattern zipCodePattern = Pattern.compile(zipCode, 32)
+
+    def excludeKeys = [
+            "自治区直辖县级行政区划",
+            "省直辖县级行政区划",
+            "联系人手机号码",
+            "不代收货款",
+            "所在地区",
+            "详细地址",
+            "收货地址",
+            "手机号码",
+            "发件人",
+            "手机号",
+            "收货人",
+            "收件人",
+            "不代收",
+            "收货",
+            "邮编",
+            "电話",
+            "电话",
+            "地址",
+            ":",
+            ":",
+            ";", ";", ",", ",", "。", "、"
+    ]
+
+    //省份有些简称,搜索省份时,可以去掉下面这些词再搜索一次,比如内蒙古自治区,可能简称为内蒙
+    public Set<String> provinceKeys = new LinkedHashSet<>(Arrays.asList("特别行政区", "古自治区", "维吾尔自治区", "壮族自治区", "回族自治区", "自治区", "省省直辖", "省", "市"))
+
+    public Set<String> cityKeys = new LinkedHashSet<>(Arrays.asList("布依族苗族自治州", "苗族侗族自治州", "藏族羌族自治州", "哈尼族彝族自治州", "壮族苗族自治州", "傣族景颇族自治州", "蒙古族藏族自治州",
+            "傣族自治州", "白族自治州", "藏族自治州", "彝族自治州", "回族自治州", "蒙古自治州", "朝鲜族自治州", "地区", "哈萨克自治州", "盟", "市"))
+
+    public Set<String> countyKeys = new LinkedHashSet<>(Arrays.asList("满族自治县", "满族蒙古族自治县", "蒙古族自治县", "朝鲜族自治县",
+            "回族彝族自治县", "彝族回族苗族自治县", "彝族苗族自治县", "土家族苗族自治县", "布依族苗族自治县", "苗族布依族自治县",
+            "彝族傣族自治县", "傣族彝族自治县", "仡佬族苗族自治县", "黎族苗族自治县", "苗族侗族自治县", "哈尼族彝族傣族自治县", "哈尼族彝族自治县",
+            "彝族哈尼族拉祜族自治县", "傣族拉祜族佤族自治县", "傣族佤族自治县", "拉祜族佤族布朗族傣族自治县", "苗族瑶族傣族自治县", "彝族回族自治县",
+            "独龙族怒族自治县", "保安族东乡族撒拉族自治县", "回族土族自治县", "撒拉族自治县", "哈萨克自治县", "塔吉克自治县",
+            "回族自治县", "畲族自治县", "土家族自治县", "布依族自治县", "苗族自治县", "瑶族自治县", "侗族自治县", "水族自治县", "傈僳族自治县",
+            "仫佬族自治县", "毛南族自治县", "黎族自治县", "羌族自治县", "彝族自治县", "藏族自治县", "纳西族自治县", "裕固族自治县", "哈萨克族自治县",
+            "哈尼族自治县", "拉祜族自治县", "佤族自治县",
+            "回族",
+            "左旗", "右旗", "中旗", "后旗", "联合旗", "自治旗", "旗", "自治县",
+            "区", "县", "市"))
+
+    private Map<String, String> provinceShort = new LinkedHashMap<>()
+
+    private Map<String, String> cityShort = new LinkedHashMap<>()
+
+    private Map<String, String> countyShort = new LinkedHashMap<>()
+
+    private Map<String, String> PROVINCES = new LinkedHashMap<String, String>()
+
+    private Map<String, String> CITIES = new LinkedHashMap<String, String>()
+
+    private Map<String, String> COUNTIES = new LinkedHashMap<String, String>()
+
+    @Resource(name = "APP_HOME")
+    private String appHome
+
+    @Override
+    String scriptName() {
+        return "地址解析为省市区联系人电话"
+    }
+
+    @Override
+    ERPModule module() {
+        return ERPModule.ADDRESSPARSER
+    }
+
+    @Override
+    void start(long supplierCode) {
+        def jsonSlurper = new JsonSlurper()
+
+        def provicesJsonFile = new File(appHome + File.separator + "conf" + File.separator + "addressdata" + File.separator + "provices.json")
+        def provicesJsonArray = jsonSlurper.parse(provicesJsonFile)
+
+        provicesJsonArray.each { it ->
+            PROVINCES.put(it["code"] as String, it["name"] as String)
+        }
+
+        def citiesJsonFile = new File(appHome + File.separator + "conf" + File.separator + "addressdata" + File.separator + "cities.json")
+        def citiesJsonArray = jsonSlurper.parse(citiesJsonFile)
+
+        citiesJsonArray.each { it ->
+            CITIES.put(it["code"] as String, it["name"] as String)
+        }
+
+        def countiesJsonFile = new File(appHome + File.separator + "conf" + File.separator + "addressdata" + File.separator + "counties.json")
+        def countiesJsonArray = jsonSlurper.parse(countiesJsonFile)
+
+        countiesJsonArray.each { it ->
+            COUNTIES.put(it["code"] as String, it["name"] as String)
+        }
+
+        for (Map.Entry<String, String> entry : PROVINCES.entrySet()) {
+            String result = entry.getValue()
+            for (String key : provinceKeys) {
+                result = result.replace(key, "")
+            }
+            provinceShort.put(entry.getKey(), result)
+        }
+
+        for (Map.Entry<String, String> entry : CITIES.entrySet()) {
+            String result = entry.getValue()
+            if (result.length() > 2) {
+                for (String key : cityKeys) {
+                    result = result.replace(key, "")
+                }
+                cityShort.put(entry.getKey(), result)
+            }
+        }
+
+        for (Map.Entry<String, String> entry : COUNTIES.entrySet()) {
+            String result = entry.getValue()
+            if ("雨花台区" == result) {
+                result = "雨花区"
+            } else if ("郑州高新技术产业开发区" == result) {
+                result = "高新区"
+            }
+            if (result.length() > 2) {
+                for (String key : countyKeys) {
+                    if (result.indexOf(key) > 0) {
+                        result = result.replace(key, "")
+                    }
+                }
+                countyShort.put(entry.getKey(), result)
+            }
+        }
+    }
+
+    @Override
+    RetResult<List<ParseAreaResult>> executeList(ProcessStringItem source) {
+        List<ParseAreaResult> results = parse(source.getItemValue(), false)
+        return RetResult.<List<ParseAreaResult>> successT().result(results)
+    }
+
+    List<ParseAreaResult> parse(String address, boolean parseAll) {
+        String inputAddress = address
+
+        ParseAreaResult extraResult = new ParseAreaResult()
+        //地址清洗 替换特殊字符,解析手机,座机,邮编,格式化多余空格
+        address = cleanAddress(address)
+
+        //提取手机号
+        address = parseMobile(address, extraResult)
+
+        //提取电话号码
+        address = parsePhone(address, extraResult)
+
+        //提取邮编
+        address = parseZipCode(address, extraResult)
+
+        address = address.replaceAll(" {2,}", BLANK)
+
+//        logger.info(address)
+
+        String memo = parseMemo(inputAddress)
+
+        //解析地址
+        List<ParseAreaResult> results = parseAddress(address, parseAll)
+
+        //将解析的地址结果重新解析一次名称
+        if ((results != null) && (!results.isEmpty())) {
+            results.each { r ->
+                r.setMobile(extraResult.getMobile())
+                r.setPhone(extraResult.getPhone())
+                r.setZipCode(extraResult.getZipCode())
+                parseName(r, 11)
+            }
+        } else {
+            parseName(extraResult, 11)
+            results.add(extraResult)
+        }
+
+        results.each { it.memo = memo }
+        return results
+    }
+
+    private String cleanAddress(String address) {
+        address = address.replaceAll("-", EMPTY)
+
+        address = address.replaceAll("\\[.*?]", "")
+        address = address.replaceAll("【.*?】", "")
+
+        for (String key : excludeKeys) {
+            address = address.replaceAll(key, " ")
+        }
+
+
+        //有一段替换代码groovy执行不了,改成java执行
+        return ERPUtils.formatParseAddress(address)
+    }
+
+    /**
+     * 提取手机号码
+     */
+    private static String parseMobile(String address, ParseAreaResult result) {
+        String mobile = patternGetStr(mobilePattern, address, 0)
+        if (StringUtils.isNotEmpty(mobile)) {
+            result.setMobile(mobile)
+            return address.replaceAll(mobile, BLANK)
+        }
+        return address
+    }
+
+    /**
+     * 提取座机号码
+     */
+    private static String parsePhone(String address, ParseAreaResult result) {
+        String phone = patternGetStr(phonePattern, address, 0)
+        if (StringUtils.isNotEmpty(phone)) {
+            result.setPhone(phone)
+            return address.replaceAll(phone, BLANK)
+        }
+        return address
+    }
+
+    /**
+     * 提取邮编
+     */
+    private static String parseZipCode(String address, ParseAreaResult result) {
+        String zipCode = patternGetStr(zipCodePattern, address, 0)
+        if (StringUtils.isNotEmpty(zipCode)) {
+            result.setZipCode(zipCode)
+            return address.replaceAll(zipCode, BLANK)
+        }
+        return address
+    }
+
+    /**
+     * 提取名称
+     */
+    private static void parseName(ParseAreaResult result, int maxLen) {
+        //设置result
+        if (StringUtils.isEmpty(result.getName())) {
+            //List<String> list = Stream.of(result.getDetails().split(" ")).collect(Collectors.toCollection(ArrayList::new));
+            if (StringUtils.isNotBlank(result.getDetails())) {
+                List<String> list = result.getDetails().split(" ") as List
+                AtomicReference<String> name = new AtomicReference<>("")
+                AtomicInteger index = new AtomicInteger(-1)
+                list.each { s ->
+                    index.addAndGet(1)
+                    if (StringUtils.isNotEmpty(s) && s.length() < maxLen) {
+                        if (StringUtils.isEmpty(name.get()) || name.get().length() > s.length()) {
+                            name.set(s)
+                        }
+                    }
+                }
+
+                if (StringUtils.isNotEmpty(name.get())) {
+                    result.setName(name.get().trim())
+                    list.remove(index.get())
+                    result.setDetails(list.stream().collect(Collectors.joining(" ")))
+                }
+            } else {
+                result.setName("")
+            }
+        }
+    }
+
+    private static String parseMemo(String address) {
+        def result = []
+        def matcher = address =~ /([\[【])(.*?)([]】])/
+        matcher.each { result << it[2] }
+        return result.join(",")
+    }
+
+    private static String patternGetStr(Pattern pattern, CharSequence content, int groupIndex) {
+        if (null != content && null != pattern) {
+            Matcher matcher = pattern.matcher(content)
+            return matcher.find() ? matcher.group(groupIndex) : null
+        } else {
+            return null
+        }
+    }
+
+    private List<ParseAreaResult> parseAddress(String address, boolean parseAll) {
+        List<ParseAreaResult> list = new ArrayList<>()
+        list.addAll(0, parseByProvince(address))
+
+        if (parseAll || list.isEmpty() || !list.get(0).getParse()) {
+            list.addAll(0, parseByCity(address))
+            if (parseAll || list.isEmpty() || !list.get(0).getParse()) {
+                list.addAll(0, parseByCounty(address))
+            }
+        }
+
+        // 可信度排序
+        list.sort { a, b ->
+            int aNameLength = StringUtils.isEmpty(a.name) ? -1 : a.getName().length()
+            int bNameLength = StringUtils.isEmpty(b.getName()) ? -1 : b.getName().length()
+            return a.getParse() && !b.getParse() ? -1 : !a.getParse() && b.getParse() ? 1 : aNameLength > bNameLength ? 1 : aNameLength < bNameLength ? -1 : 0
+        }
+
+        return list
+    }
+
+    /**
+     * 通过区解析地址
+     * @param addressBase
+     * @return
+     */
+    private List<ParseAreaResult> parseByCounty(String addressBase) {
+        List<ParseAreaResult> results = new ArrayList<>()
+        ParseAreaResult result = new ParseAreaResult()
+        result.setType("parseByCounty")
+        String address = addressBase
+        for (Map.Entry<String, String> entry : COUNTIES.entrySet()) {
+            String countyCode = entry.getKey()
+            String countyName = entry.getValue()
+            int index = address.indexOf(countyName)
+            String shortCounty = index > -1 ? "" : countyShort.get(countyCode)
+            int countyLength = StringUtils.isNotEmpty(shortCounty) ? shortCounty.length() : countyName.length()
+            if (StringUtils.isNotEmpty(shortCounty)) {
+                index = address.indexOf(shortCounty)
+            }
+
+            if (index > -1) {
+                if (countyCode.contains("-")) {
+                    countyCode = countyCode.split("-")[0]
+                }
+                result.setCode(countyCode)
+                result.setCounty(countyName)
+                result.setCountyCode(countyCode)
+
+                String cityCode = countyCode.substring(0, 4) + "00"
+                String city = CITIES.get(cityCode)
+                result.setCityCode(cityCode)
+                result.setCity(city)
+
+                String provinceCode = countyCode.substring(0, 2) + "0000"
+                String province = PROVINCES.get(provinceCode)
+                result.setProvinceCode(provinceCode)
+                result.setProvince(province)
+
+
+                String leftAddress = address.substring(0, index)
+                String _provinceName = "", _cityName = ""
+                if (StringUtils.isNotEmpty(leftAddress)) {
+                    _provinceName = province
+                    int _index = leftAddress.indexOf(_provinceName)
+                    if (_index == -1) {
+                        _provinceName = provinceShort.get(countyCode.substring(0, 2) + "0000")
+                        _index = leftAddress.indexOf(_provinceName)
+                        if (_index == -1) {
+                            _provinceName = ""
+                        }
+                    }
+                    if (StringUtils.isNotEmpty(_provinceName)) {
+                        leftAddress = leftAddress.replaceAll(_provinceName, "")
+                    }
+
+                    _cityName = city
+                    _index = leftAddress.indexOf(_cityName)
+                    if (_index == -1) {
+                        _cityName = cityShort.get(countyCode.substring(0, 4) + "00")
+
+                        _index = (StringUtils.isBlank(_cityName)) ? -1 : leftAddress.indexOf(_cityName)
+
+                        if (_index == -1) {
+                            _cityName = ""
+                        }
+                    }
+                    if (StringUtils.isNotEmpty(_cityName)) {
+                        leftAddress = leftAddress.replaceAll(_cityName, "")
+                    }
+                    if (StringUtils.isNotEmpty(leftAddress)) {
+                        result.setName(leftAddress.trim())
+                    }
+                }
+                address = address.substring(index + countyLength)
+
+                if (StringUtils.isNotEmpty(_provinceName) || StringUtils.isNotEmpty(_cityName)) {
+                    result.setParse(true)
+                    break
+                } else {
+                    //如果没有识别到地区 缓存本次结果,并重置数据
+                    ParseAreaResult newResult = new ParseAreaResult()
+                    newResult.mobile = result.mobile
+                    newResult.phone = result.phone
+                    newResult.zipCode = result.zipCode
+                    newResult.province = result.province
+                    newResult.provinceCode = result.provinceCode
+                    newResult.city = result.city
+                    newResult.cityCode = result.cityCode
+                    newResult.county = result.county
+                    newResult.countyCode = result.countyCode
+                    newResult.address = result.address
+                    newResult.details = result.details
+                    newResult.code = result.code
+                    newResult.name = result.name
+                    newResult.type = result.type
+                    newResult.parse = result.parse
+
+                    newResult.setDetails(address.trim())
+                    results.add(0, newResult)
+                    result.clean()
+                    address = addressBase
+                }
+            }
+        }
+
+        if (StringUtils.isNotEmpty(result.getCode())) {
+            result.setDetails(address.trim())
+            results.add(0, result)
+        }
+        return results
+    }
+
+    /**
+     * 通过省解析地址
+     * @param addressBase
+     * @return
+     */
+    private List<ParseAreaResult> parseByCity(String addressBase) {
+        List<ParseAreaResult> results = new ArrayList<>()
+        ParseAreaResult result = new ParseAreaResult()
+        result.setType("parseByCity")
+        String address = addressBase
+        for (Map.Entry<String, String> entry : CITIES.entrySet()) {
+            String cityCode = entry.getKey()
+            String cityName = entry.getValue()
+            int index = address.indexOf(cityName)
+            String shortCity = index > -1 ? "" : cityShort.get(cityCode)
+            int cityLength = StringUtils.isNotEmpty(shortCity) ? shortCity.length() : cityName.length()
+            if (StringUtils.isNotEmpty(shortCity)) {
+                index = address.indexOf(shortCity)
+            }
+
+            if (index > -1) {
+                result.setCode(cityCode)
+                result.setCity(cityName)
+                result.setCityCode(cityCode)
+
+                String provinceCode = cityCode.substring(0, 2) + "0000"
+                String province = PROVINCES.get(provinceCode)
+                result.setProvinceCode(provinceCode)
+                result.setProvince(province)
+
+                String leftAddress = address.substring(0, index)
+                String _provinceName = ""
+                if (StringUtils.isNotEmpty(leftAddress)) {
+                    _provinceName = province
+                    int _index = leftAddress.indexOf(_provinceName)
+                    if (_index == -1) {
+                        _provinceName = provinceShort.get(cityCode.substring(0, 2) + "0000")
+                        _index = leftAddress.indexOf(_provinceName)
+                        if (_index == -1) {
+                            _provinceName = ""
+                        }
+                    }
+                    if (StringUtils.isNotEmpty(_provinceName)) {
+                        leftAddress = leftAddress.replace(_provinceName, "")
+                    }
+                    if (StringUtils.isNotEmpty(leftAddress)) {
+                        result.setName(leftAddress)
+                    }
+                }
+
+                address = address.substring(index + cityLength)
+                address = parseAreaByCity(address, result)
+                if (StringUtils.isNotEmpty(_provinceName) || StringUtils.isNotEmpty(result.getCounty())) {
+                    result.setParse(true)
+                    break
+                } else {
+                    //如果没有识别到地区 缓存本次结果,并重置数据
+                    ParseAreaResult newResult = new ParseAreaResult()
+                    newResult.mobile = result.mobile
+                    newResult.phone = result.phone
+                    newResult.zipCode = result.zipCode
+                    newResult.province = result.province
+                    newResult.provinceCode = result.provinceCode
+                    newResult.city = result.city
+                    newResult.cityCode = result.cityCode
+                    newResult.county = result.county
+                    newResult.countyCode = result.countyCode
+                    newResult.address = result.address
+                    newResult.details = result.details
+                    newResult.code = result.code
+                    newResult.name = result.name
+                    newResult.type = result.type
+                    newResult.parse = result.parse
+
+                    newResult.setDetails(address.trim())
+                    results.add(0, newResult)
+                    result.clean()
+                    address = addressBase
+                }
+            }
+        }
+
+        if (StringUtils.isNotEmpty(result.getCode())) {
+            result.setDetails(address.trim())
+            results.add(0, result)
+        }
+        return results
+    }
+
+    /**
+     * 通过省解析地址
+     * @param addressBase
+     * @return
+     */
+    private List<ParseAreaResult> parseByProvince(String addressBase) {
+        List<ParseAreaResult> results = new ArrayList<>()
+        ParseAreaResult result = new ParseAreaResult()
+        result.setType("parseByProvince")
+        String address = addressBase
+
+        for (Map.Entry<String, String> entry : PROVINCES.entrySet()) {
+            String code = entry.getKey()
+            String province = entry.getValue()
+
+            int index = address.indexOf(province)
+            String shortProvince = index > -1 ? "" : provinceShort.get(code)
+            int provinceLength = StringUtils.isNotEmpty(shortProvince) ? shortProvince.length() : province.length()
+            if (StringUtils.isNotEmpty(shortProvince)) {
+                index = address.indexOf(shortProvince)
+            }
+
+            if (index > -1) {
+                if (index > 0) {
+                    result.setName(address.substring(0, index).trim())
+                    address = address.substring(index).trim()
+                }
+                result.setCode(code)
+                result.setProvince(province)
+                result.setProvinceCode(code)
+
+                String _address = address.substring(provinceLength)
+
+                if (StringUtils.isNotBlank(_address)) {
+                    if (!_address.startsWith("市") || _address.indexOf(province) > -1) {
+                        address = _address
+                    }
+                }
+
+                //如果是用短名匹配的 要替换省关键字
+                if (StringUtils.isNotEmpty(shortProvince)) {
+                    for (String key : provinceKeys) {
+                        if (address.indexOf(key) == 0) {
+                            address = address.substring(key.length())
+                        }
+                    }
+                }
+                String __address = parseCityByProvince(address, result)
+                if (StringUtils.isEmpty(result.getCity())) {
+                    __address = parseCountyByProvince(address, result)
+                }
+
+                if (StringUtils.isNotEmpty(result.getCity())) {
+                    address = __address
+                    result.setParse(true)
+                    break
+                } else {
+                    //如果没有识别到地区 缓存本次结果,并重置数据
+                    ParseAreaResult newResult = new ParseAreaResult()
+                    newResult.mobile = result.mobile
+                    newResult.phone = result.phone
+                    newResult.zipCode = result.zipCode
+                    newResult.province = result.province
+                    newResult.provinceCode = result.provinceCode
+                    newResult.city = result.city
+                    newResult.cityCode = result.cityCode
+                    newResult.county = result.county
+                    newResult.countyCode = result.countyCode
+                    newResult.address = result.address
+                    newResult.details = result.details
+                    newResult.code = result.code
+                    newResult.name = result.name
+                    newResult.type = result.type
+                    newResult.parse = result.parse
+
+                    newResult.setDetails(address.trim())
+                    results.add(0, newResult)
+                    result.clean()
+                    address = addressBase
+                }
+            }
+        }
+
+        //设置code
+        if (StringUtils.isNotEmpty(result.getCode())) {
+            result.setDetails(address.trim())
+            results.add(0, result)
+        }
+        return results
+    }
+
+    private String parseCountyByProvince(String address, ParseAreaResult result) {
+        Map<String, String> counties = getTargetsByCode(AreaEnum.COUNTY, result.getCode())
+        for (Map.Entry<String, String> entry : counties.entrySet()) {
+            String countyCode = entry.getKey()
+            String countyName = entry.getValue()
+            int index = address.indexOf(countyName)
+            String shortCounty = index > -1 ? "" : countyShort.get(countyCode)
+            int countyLength = StringUtils.isNotEmpty(shortCounty) ? shortCounty.length() : countyName.length()
+            if (StringUtils.isNotEmpty(shortCounty)) {
+                index = address.indexOf(shortCounty)
+            }
+            if (index > -1 && index < 6) {
+                if (countyCode.contains("-")) {
+                    countyCode = countyCode.split("-")[0]
+                }
+                result.setCode(countyCode)
+                result.setCounty(countyName)
+                result.setCountyCode(countyCode)
+
+                String cityCode = countyCode.substring(0, 4) + "00"
+                String cityName = CITIES.get(cityCode)
+                result.setCity(cityName)
+                result.setCityCode(cityCode)
+
+                address = address.substring(index + countyLength)
+
+                if (StringUtils.isNotEmpty(shortCounty)) {
+                    for (String key : countyKeys) {
+                        if (address.indexOf(key) == 0) {
+                            address = address.substring(key.length())
+                        }
+                    }
+                }
+                break
+            }
+        }
+        return address
+    }
+
+    /**
+     * 通过省解析城市信息
+     * @param address
+     * @param result
+     * @return
+     */
+    private String parseCityByProvince(String address, ParseAreaResult result) {
+        Map<String, String> cities = getTargetsByCode(AreaEnum.CITY, result.getCode())
+        for (Map.Entry<String, String> entry : cities.entrySet()) {
+            String cityCode = entry.getKey()
+            String cityName = entry.getValue()
+            int index = address.indexOf(cityName)
+            String shortCity = index > -1 ? "" : cityShort.get(cityCode)
+            int cityLength = StringUtils.isNotEmpty(shortCity) ? shortCity.length() : cityName.length()
+            if (StringUtils.isNotEmpty(shortCity)) {
+                index = address.indexOf(shortCity)
+            }
+            if (index > -1 && index < 3) {
+                result.setCode(cityCode)
+                result.setCity(cityName)
+                result.setCityCode(cityCode)
+                address = address.substring(index + cityLength)
+                //如果是用短名匹配的 要替换市关键字
+                if (StringUtils.isNotEmpty(shortCity)) {
+                    String finalAddress = address
+                    for (String key : cityKeys) {
+                        if (address.indexOf(key) == 0 && !StringUtils.equals(key, "市")) {
+                            //排除几个会导致异常的解析
+                            boolean anyMatch = Stream.of("市北区", "市南区", "市中区", "市辖区").anyMatch { v -> finalAddress.indexOf(v) == 0 }
+                            if (!anyMatch) {
+                                address = address.substring(key.length())
+                            }
+                        }
+                    }
+                }
+                address = parseAreaByCity(address, result)
+                break
+            }
+        }
+        return address
+    }
+
+    /**
+     * 通过城市解析地区信息
+     * @param address
+     * @param result
+     * @return
+     */
+    private String parseAreaByCity(String address, ParseAreaResult result) {
+        Map<String, String> counties = getTargetsByCode(AreaEnum.COUNTY, result.getCode())
+        for (Map.Entry<String, String> entry : counties.entrySet()) {
+            String countyCode = entry.getKey()
+            String countyName = entry.getValue()
+            int index = address.indexOf(countyName)
+            String shortCounty = index > -1 ? "" : countyShort.get(countyCode)
+            int countyLength = StringUtils.isNotEmpty(shortCounty) ? shortCounty.length() : countyName.length()
+            if (StringUtils.isNotEmpty(shortCounty)) {
+                index = address.indexOf(shortCounty)
+            }
+            if (index > -1 && index < 3) {
+                if (countyCode.contains("-")) {
+                    countyCode = countyCode.split("-")[0]
+                }
+                result.setCode(countyCode)
+                result.setCounty(countyName)
+                result.setCountyCode(countyCode)
+
+                address = address.substring(index + countyLength)
+                if (StringUtils.isNotEmpty(shortCounty)) {
+                    for (String key : countyKeys) {
+                        if (address.indexOf(key) == 0) {
+                            address = address.substring(key.length())
+                        }
+                    }
+                }
+                break
+            }
+        }
+        return address
+    }
+
+    /**
+     * 通过编码获取省市集合对象
+     *
+     * @param target 省,市枚举
+     * @param code 编码,为地区,市,省
+     * @return 地址对象
+     */
+    private Map<String, String> getTargetsByCode(AreaEnum target, String code) {
+        Map<String, String> targets = null
+        if (AreaEnum.PROVINCE == target) {
+            String provinceCode = code.substring(0, 2)
+            targets = putTargets(provinceCode, PROVINCES)
+        } else if (AreaEnum.CITY == target) {
+            String provinceCode = code.substring(0, 2)
+            targets = putTargets(provinceCode, CITIES)
+        } else if (AreaEnum.COUNTY == target) {
+            if ("00" == code.substring(2, 4)) {
+                String provinceCode = code.substring(0, 2)
+                targets = putTargets(provinceCode, COUNTIES)
+            } else {
+                String cityCode = code.substring(0, 4)
+                targets = putTargets(cityCode, COUNTIES)
+            }
+        }
+        return targets
+    }
+
+    /**
+     * 查找sources中key以preCode开头的对象,并存储到targets中
+     * 其中break必须要依赖于数据是有一定顺序的,必须targets记录在同一范围,中间不能插入其他对象
+     *
+     * @param preCode
+     * @param sources
+     */
+    private static Map<String, String> putTargets(String preCode, Map<String, String> sources) {
+        Map<String, String> targets = new LinkedHashMap<>()
+        for (Map.Entry<String, String> entry : sources.entrySet()) {
+            int index = entry.getKey().indexOf(preCode)
+            if (index == 0) {
+                targets.put(entry.getKey(), entry.getValue())
+            } else if (targets.size() > 0 && index != 0) {
+                break
+            }
+        }
+        return targets
+    }
+}

+ 136 - 0
conf/script/1000/business/BE_DocClearScriptCache.groovy

@@ -0,0 +1,136 @@
+import com.yinjie.heating.common.api.BusinessExecutor
+import com.yinjie.heating.common.api.DocInfoService
+import com.yinjie.heating.common.api.StoreService
+import com.yinjie.heating.common.api.SystemService
+import com.yinjie.heating.common.api.flycat.ExpressOutService
+import com.yinjie.heating.common.api.flycat.OrderSearchService
+import com.yinjie.heating.common.api.flycat.OrderService
+import com.yinjie.heating.common.datas.ERPModule
+import com.yinjie.heating.common.datas.ERPModuleEntity
+import com.yinjie.heating.common.entity.base.BusinessOperation
+import com.yinjie.heating.common.entity.base.ProcessEntityItem
+import com.sweetfish.service.RetResult
+import org.apache.logging.log4j.LogManager
+import org.apache.logging.log4j.Logger
+
+import javax.annotation.Resource
+
+/**
+ * Created by jlutt on 2020-08-25
+ *
+ * @author jlutt
+ */
+@SuppressWarnings("unused")
+class BE_DocClearScriptCache implements BusinessExecutor<ProcessEntityItem<ERPModuleEntity>, ERPModuleEntity> {
+
+    protected final Logger logger = LogManager.getLogger(this.getClass().getSimpleName())
+
+    @Resource
+    SystemService systemService
+
+    @Resource
+    DocInfoService docInfoService
+
+    @Resource
+    ExpressOutService expressOutService
+
+    @Resource
+    StoreService storeService
+
+    @Resource
+    OrderService orderService
+
+    @Resource
+    OrderSearchService orderSearchService
+
+    @Override
+    String scriptName() {
+        return "保存业务脚本清除对象"
+    }
+
+    @Override
+    ERPModule module() {
+        return ERPModule.NONE
+    }
+
+    @Override
+    RetResult<ERPModuleEntity> execute(ProcessEntityItem<ERPModuleEntity> source) {
+        ERPModule erpModule = source.getInputItem().getErpModule()
+
+        logger.info("修改模块" + erpModule.getModuleDisplayName())
+
+        if ("Init_ExpandoGroovy".equalsIgnoreCase(source.getInputItem().getCode())) {
+            //Init_ExpandoGroovy每个使用脚本的service都载入了,由于是默认载入的,而且是启动自动载入的,所以不提供清除的方法,而是每个都重载一次
+            //2024-01-26未测试这个重载能不能不重启给groovy增加扩展方法,需要测试,不过理论上没啥用,因为Init_ExpandoGroovy的脚本是用的其它groovy代码实现的,先这样吧,留着以后处理,暂时不经常修改GroovyExtensions代码算了
+            systemService.reloadScriptCache(source.inputItem.code, ERPModule.SYSTEM, source.dataSourceId, source.supplierCode)
+            docInfoService.reloadScriptCache(source.inputItem.code, ERPModule.SYSTEM, source.dataSourceId, source.supplierCode)
+            expressOutService.reloadScriptCache(source.inputItem.code, ERPModule.SYSTEM, source.dataSourceId, source.supplierCode)
+            storeService.reloadScriptCache(source.inputItem.code, ERPModule.SYSTEM, source.dataSourceId, source.supplierCode)
+            orderService.reloadScriptCache(source.inputItem.code, ERPModule.SYSTEM, source.dataSourceId, source.supplierCode)
+            orderSearchService.reloadScriptCache(source.inputItem.code, ERPModule.SYSTEM, source.dataSourceId, source.supplierCode)
+        }
+        else {
+            switch (erpModule) {
+                case ERPModule.NONE:
+                    break
+                case ERPModule.SYSTEM:
+                    if (source.getOperation() == BusinessOperation.SAVE) {
+                        systemService.invalidateScriptCache(source.getSupplierCode() + "-" + source.getInputItem().getCode())
+                    } else {
+                        systemService.reloadScriptCache(source.getInputItem().getCode(), erpModule, source.getDataSourceId(), source.getSupplierCode())
+                    }
+                    break
+                case [ERPModule.DOC, ERPModule.INQUIREINFO]:
+                    if (source.getOperation() == BusinessOperation.SAVE) {
+                        docInfoService.invalidateScriptCache(source.getSupplierCode() + "-" + source.getInputItem().getCode())
+                    } else {
+                        docInfoService.reloadScriptCache(source.getInputItem().getCode(), erpModule, source.getDataSourceId(), source.getSupplierCode())
+                    }
+                    break
+                case [ERPModule.EXPORT, ERPModule.CHARTS]:
+                    if (source.getOperation() == BusinessOperation.SAVE) {
+                        systemService.invalidateScriptCache(source.getSupplierCode() + "-" + source.getInputItem().getCode())
+                    } else {
+                        systemService.reloadScriptCache(source.getInputItem().getCode(), erpModule, source.getDataSourceId(), source.getSupplierCode())
+                    }
+                    break
+                case ERPModule.EXPRESS_API:
+                    if (source.getOperation() == BusinessOperation.SAVE) {
+                        expressOutService.invalidateScriptCache(source.getSupplierCode() + "-" + source.getInputItem().getCode())
+                    } else {
+                        expressOutService.reloadScriptCache(source.getInputItem().getCode(), erpModule, source.getDataSourceId(), source.getSupplierCode())
+                    }
+                    break
+                case [ERPModule.ERP_ORDER, ERPModule.ORDER_API]:
+                    if (source.getOperation() == BusinessOperation.SAVE) {
+                        orderService.invalidateScriptCache(source.getSupplierCode() + "-" + source.getInputItem().getCode())
+                    } else {
+                        orderService.reloadScriptCache(source.getInputItem().getCode(), erpModule, source.getDataSourceId(), source.getSupplierCode())
+                    }
+                    break
+                case ERPModule.ERP_ORDER_SEARCH:
+                    if (source.getOperation() == BusinessOperation.SAVE) {
+                        orderSearchService.invalidateScriptCache(source.getSupplierCode() + "-" + source.getInputItem().getCode())
+                    } else {
+                        orderSearchService.reloadScriptCache(source.getInputItem().getCode(), erpModule, source.getDataSourceId(), source.getSupplierCode())
+                    }
+                    break
+                case ERPModule.STORE_API:
+                    if (source.getOperation() == BusinessOperation.SAVE) {
+                        storeService.invalidateScriptCache(source.getSupplierCode() + "-" + source.getInputItem().getCode())
+                    } else {
+                        storeService.reloadScriptCache(source.getInputItem().getCode(), erpModule, source.getDataSourceId(), source.getSupplierCode())
+                    }
+                    break
+                case ERPModule.ADDRESSPARSER:
+                    break
+                case ERPModule.APP:
+                    break
+                default:
+                    break
+            }
+        }
+
+        return RetResult.success().result(source.getInputItem())
+    }
+}

+ 220 - 0
conf/script/1000/business/BE_ERPLogin.groovy

@@ -0,0 +1,220 @@
+import com.yinjie.heating.common.datas.TokenUserFrom
+import com.yinjie.heating.common.entity.store.StoreInfo
+import com.dySweetFishPlugin.sql.dao.TunaService
+import com.dySweetFishPlugin.tool.crypto.EncryptUtil
+import com.sweetfish.convert.json.JsonConvert
+import com.sweetfish.service.RetResult
+import com.yinjie.heating.business.dao.LoginDao
+import com.yinjie.heating.common.api.*
+import com.yinjie.heating.common.datas.ERPModule
+import com.yinjie.heating.common.entity.base.DataBaseMultiItemEx
+import com.yinjie.heating.common.entity.base.ProcessEntityItem
+import com.yinjie.heating.common.entity.site.ERPTokenUser
+import com.yinjie.heating.common.entity.site.LoginRequest
+import com.yinjie.heating.common.entity.site.LoginResult
+import com.yinjie.heating.common.entity.system.LoginUser
+import com.yinjie.heating.common.tool.ERPUtils
+import org.apache.commons.lang3.StringUtils
+import org.apache.logging.log4j.LogManager
+import org.apache.logging.log4j.Logger
+import org.rex.RMap
+
+import javax.annotation.Resource
+
+/**
+ * ERP系统登录脚本,随着业务复杂度提高,登录功能统一一个接口提供
+ */
+@SuppressWarnings("unused")
+class BE_ERPLogin implements BusinessExecutor<ProcessEntityItem<LoginRequest>, LoginResult> {
+
+    protected final Logger logger = LogManager.getLogger(this.getClass().getSimpleName())
+
+    @Resource
+    DeptService deptService
+
+    @Resource
+    ERPService erpService
+
+    @Resource
+    TunaService tunaService
+
+    @Resource
+    SysMessageService sysMessageService
+
+    @Resource
+    JsonConvert jsonConvert
+
+    @Resource(name = "property.passwordSalt")
+    private String passwordSalt
+
+    @Resource(name = "property.erpToken.commonkey")
+    private String ssoERPTokenCommonKey
+
+    @Resource(name = "property.deliver.Store.commonkey")
+    private String ssoStoreTokenCommonKey
+
+    @Resource(name = "property.dnyMall.commonkey")
+    private String ssoMallTokenCommonKey
+
+    private LoginDao loginDao
+
+
+    //登录策略,当前数据库那一个地方需要重启服务,可改成不需要的,参考TunaDaoService动态sql执行
+    def loginStrategies = [
+            "0" : [
+                    "name"         : "后台管理系统登录",
+                    "resourceLogin": { LoginRequest loginInfo ->
+
+                        if (loginInfo.password == "D227E2334F89C81FDE0967B115D4F29C") {
+                            LoginUser info = new LoginUser()
+                            info.setId(-999L)
+                            info.setLoginName("SuperResourcer")
+                            info.setUserName("资源管理员")
+                            info.setDeptName("资源管理")
+
+                            return RetResult.<ERPTokenUser> successT().result(new ERPTokenUser(info))
+                        } else {
+                            return RetResult.<ERPTokenUser> errorT().retinfo("用户账号或密码错误,登录失败")
+                        }
+                    },
+                    "login"        : { LoginRequest loginInfo, RMap mapParams, DataBaseMultiItemEx supplierItem ->
+                        mapParams.put("companyId", 0L)
+                        LoginUser info = loginDao.login(mapParams, supplierItem.dataBaseAlias, Long.parseLong(supplierItem.shardingKey))
+
+                        if (info == null) {
+                            return RetResult.<ERPTokenUser> errorT().retinfo("用户账号或密码错误,登录失败")
+                        }
+
+                        if (info.status == 1) {
+                            return RetResult.<ERPTokenUser> errorT().retinfo("用户账号已冻结,登录失败")
+                        }
+
+                        info.deptName = deptService.getRedisDeptName(info.getDeptId(), Long.parseLong(supplierItem.shardingKey))
+
+                        sysMessageService.syncSysGroupMessage(info.getId(), Long.parseLong(supplierItem.shardingKey))
+                        return RetResult.<ERPTokenUser> successT().result(new ERPTokenUser(info))
+                    },
+                    "tokenKey"     : ssoERPTokenCommonKey
+            ],
+            "80": [
+                    "name"         : "门店后台管理系统登录",
+                    "resourceLogin": { LoginRequest loginInfo ->
+                        //不允许使用superResourcer登录,防漏洞
+                        return RetResult.<ERPTokenUser> errorT().retinfo("用户账号或密码错误,登录失败")
+                    },
+                    "login"        : { LoginRequest loginInfo, RMap mapParams, DataBaseMultiItemEx supplierItem ->
+                        mapParams.put("companyId", 0L)
+                        StoreInfo info = loginDao.storeLogin(mapParams, supplierItem.dataBaseAlias, Long.parseLong(supplierItem.shardingKey))
+
+                        if (info == null) {
+                            return RetResult.<ERPTokenUser> errorT().retinfo("用户账号或密码错误,登录失败")
+                        }
+
+                        if (info.voidFlag == 1) {
+                            return RetResult.<ERPTokenUser> errorT().retinfo("用户账号已冻结,登录失败")
+                        }
+
+                        return RetResult.<ERPTokenUser> successT().result(new ERPTokenUser(info))
+                    },
+                    "tokenKey"     : ssoStoreTokenCommonKey
+            ],
+            "81": [
+                    "name"         : "门店APP管理系统登录",
+                    "resourceLogin": { LoginRequest loginInfo ->
+                        //不允许使用superResourcer登录,防漏洞
+                        return RetResult.<ERPTokenUser> errorT().retinfo("用户账号或密码错误,登录失败")
+                    },
+                    "login"        : { LoginRequest loginInfo, RMap mapParams, DataBaseMultiItemEx supplierItem ->
+                        mapParams.put("companyId", 0L)
+                        StoreInfo info = loginDao.storeLogin(mapParams, supplierItem.dataBaseAlias, Long.parseLong(supplierItem.shardingKey))
+
+                        if (info == null) {
+                            return RetResult.<ERPTokenUser> errorT().retinfo("用户账号或密码错误,登录失败")
+                        }
+
+                        if (info.voidFlag == 1) {
+                            return RetResult.<ERPTokenUser> errorT().retinfo("用户账号已冻结,登录失败")
+                        }
+
+                        ERPTokenUser tokenUser = new ERPTokenUser(info)
+                        //这里强制改一下
+                        tokenUser.userFrom = TokenUserFrom.APP_STORE_ADMIN.value
+                        return RetResult.<ERPTokenUser> successT().result(tokenUser)
+
+                    },
+                    "tokenKey"     : ssoStoreTokenCommonKey
+            ]
+    ]
+
+    @Override
+    String scriptName() {
+        return "ERP系统登录"
+    }
+
+    @Override
+    ERPModule module() {
+        return ERPModule.SYSTEM
+    }
+
+    @Override
+    RetResult<LoginResult> execute(ProcessEntityItem<LoginRequest> source) {
+        //直接定义Resource不好使,还是需要赋值
+        loginStrategies.get("0").tokenKey = ssoERPTokenCommonKey
+        loginStrategies.get("80").tokenKey = ssoStoreTokenCommonKey
+        loginStrategies.get("81").tokenKey = ssoStoreTokenCommonKey
+
+        if (source.inputItem == null) {
+            return RetResult.<LoginResult> errorT().retinfo("未传入用户信息")
+        }
+
+        if (source.inputItem.supplierId <= 0L) {
+            return RetResult.<LoginResult> errorT().retinfo("请选择登录公司信息")
+        }
+
+        DataBaseMultiItemEx supplierItem = erpService.getERPSupplierInfo(source.inputItem.supplierId)
+        if (supplierItem == null) {
+            return RetResult.<LoginResult> errorT().retinfo("无效的登录公司信息")
+        }
+
+        if (StringUtils.isEmpty(source.inputItem.loginName)) {
+            return RetResult.<LoginResult> errorT().retinfo("请输入账号")
+        }
+
+        if (StringUtils.isEmpty(source.inputItem.password)) {
+            return RetResult.<LoginResult> errorT().retinfo("请输入密码")
+        }
+
+        if (!loginStrategies.containsKey(String.valueOf(source.inputItem.loginFrom))) {
+            return RetResult.<LoginResult> errorT().retinfo("无效的登录来源")
+        }
+
+        source.inputItem.password = EncryptUtil.md5Digest(source.inputItem.password + passwordSalt)
+
+        loginDao = tunaService.generate(LoginDao.class)
+
+        RetResult<ERPTokenUser> userResult
+        def loginStrategy = loginStrategies.get(String.valueOf(source.inputItem.loginFrom))
+        if (source.inputItem.loginName.equalsIgnoreCase("SuperResourcer")) {
+            userResult = loginStrategy.resourceLogin.call(source.inputItem)
+        } else {
+
+            RMap<String, Object> paramMap = new RMap<>()
+            paramMap.put("loginName", source.inputItem.loginName)
+            paramMap.put("password", source.inputItem.password)
+
+            userResult = loginStrategy.login.call(source.inputItem, paramMap, supplierItem)
+        }
+
+        if (userResult.isSuccess()) {
+            userResult.result.dataSourceId = supplierItem.dataBaseAlias
+            userResult.result.supplierCode = Long.parseLong(supplierItem.shardingKey)
+
+            String accessToken = ERPUtils.parseTokenFromERPUser(userResult.result, loginStrategy.tokenKey, jsonConvert)
+
+            return RetResult.<LoginResult> successT().result(new LoginResult(userResult.result, accessToken))
+        } else {
+            return RetResult.<LoginResult> errorT().retinfo(userResult.retinfo)
+        }
+
+    }
+}

+ 50 - 0
conf/script/1000/business/BE_IndexCardPanelData.groovy

@@ -0,0 +1,50 @@
+import com.yinjie.heating.common.api.BusinessExecutor
+import com.yinjie.heating.common.api.SupplierInitService
+import com.yinjie.heating.common.datas.ERPModule
+import com.yinjie.heating.common.entity.base.ProcessMapItem
+import com.dySweetFishPlugin.elasticsearch.ESClient
+import com.sweetfish.service.RetResult
+import org.rex.RMap
+
+import javax.annotation.Resource
+
+/**
+ * Created by jlutt on 2021-09-22
+ *
+ * @author jlutt
+ */
+@SuppressWarnings("unused")
+class BE_IndexCardPanelData implements BusinessExecutor<ProcessMapItem, ProcessMapItem> {
+
+    @Resource
+    ESClient esClient
+
+    @Resource
+    SupplierInitService supplierService
+
+    @Override
+    String scriptName() {
+        return "首页面板查询业务数据"
+    }
+
+    @Override
+    ERPModule module() {
+        return ERPModule.SYSTEM
+    }
+
+    @Override
+    RetResult<ProcessMapItem> execute(ProcessMapItem source) {
+        RMap data = new RMap()
+
+        data.put("showData", false)
+
+        ProcessMapItem result = ProcessMapItem.newBuilder()
+                .itemData(data)
+                .currentUser(source.getCurrentUser())
+                .dataSourceId(source.getDataSourceId())
+                .supplierCode(source.getSupplierCode())
+                .build()
+
+        return RetResult.<ProcessMapItem> successT().result(result)
+    }
+}

+ 35 - 0
conf/script/1000/business/BE_Init_ExpandoGroovy.groovy

@@ -0,0 +1,35 @@
+import com.yinjie.heating.common.api.BusinessExecutor
+import com.yinjie.heating.common.datas.ERPModule
+import com.yinjie.heating.common.entity.base.ProcessStringItem
+import com.sweetfish.service.RetResult
+import org.apache.logging.log4j.LogManager
+import org.apache.logging.log4j.Logger
+
+@SuppressWarnings("unused")
+class BE_Init_ExpandoGroovy implements BusinessExecutor<ProcessStringItem, ProcessStringItem> {
+
+    protected final Logger logger = LogManager.getLogger(this.getClass().getSimpleName())
+
+    @Override
+    String scriptName() {
+        return "初始化扩展Groovy方法"
+    }
+
+    @Override
+    ERPModule module() {
+        return ERPModule.SYSTEM
+    }
+
+    void start(long supplierCode) {
+        logger.info("扩展Groovy方法")
+        GroovyExtensions.apply()
+    }
+
+    RetResult<ProcessStringItem> execute(ProcessStringItem source) {
+        return RetResult.<ProcessStringItem> successT().result(
+                ProcessStringItem.newBuilder()
+                        .itemValue("此代码无需执行,主要用于扩展Groovy方法,简化书写")
+                        .build()
+        )
+    }
+}

+ 62 - 0
conf/script/1000/business/BE_PlateForm_CodeList.groovy

@@ -0,0 +1,62 @@
+import com.alibaba.fastjson2.JSON
+import com.yinjie.heating.common.api.BusinessExecutor
+import com.yinjie.heating.common.datas.ERPModule
+import com.yinjie.heating.common.entity.base.InvokeCallParams
+import com.yinjie.heating.common.entity.base.InvokeCallResult
+import com.sweetfish.service.RetResult
+import groovy.json.JsonSlurper
+import org.apache.logging.log4j.LogManager
+import org.apache.logging.log4j.Logger
+
+import javax.annotation.Resource
+
+@SuppressWarnings("unused")
+class BE_PlateForm_CodeList implements BusinessExecutor<InvokeCallParams, InvokeCallResult> {
+
+    protected final Logger logger = LogManager.getLogger(this.getClass().getSimpleName())
+
+    @Resource(name = "APP_HOME")
+    private String appHome
+
+    private def platformCodeArray = []
+
+    @Override
+    String scriptName() {
+        return "获取平台编号大全"
+    }
+
+    @Override
+    ERPModule module() {
+        return ERPModule.DOC
+    }
+
+    void start(long supplierCode) {
+        def jsonSlurper = new JsonSlurper()
+
+        def platformCodeJsonFile = new File(appHome + File.separator +
+                "conf" + File.separator +
+                "script" + File.separator +
+                supplierCode + File.separator +
+                "scriptFiles" + File.separator +
+                "platformCode.json")
+        platformCodeArray = jsonSlurper.parse(platformCodeJsonFile)
+    }
+
+    @Override
+    RetResult<InvokeCallResult> execute(InvokeCallParams source) {
+        //JsonOutput不知道怎么改编码。。。中文用unicode编码输出了,虽然也能用,但log不方便。。。
+        //查了一下
+        // https://stackoverflow.com/questions/38569874/how-to-use-groovy-jsonoutput-tojson-with-data-encoded-with-utf-8
+        // https://docs.groovy-lang.org/latest/html/api/groovy/json/JsonGenerator.Options.html
+        // new JsonGenerator.Options()
+        //        .disableUnicodeEscaping()
+        //        .build()
+        //        .toJson(platformCodeArray)
+        String codeJson = JSON.toJSONString(platformCodeArray)// JsonOutput.toJson(platformCodeArray)
+        logger.info(codeJson)
+
+        return RetResult.<InvokeCallResult> successT().result(
+                InvokeCallResult.success().data(codeJson)
+        )
+    }
+}

+ 150 - 0
conf/script/1000/commons/ESList.groovy

@@ -0,0 +1,150 @@
+import com.yinjie.heating.common.api.ESDataInfoExecutor
+import com.yinjie.heating.common.api.QueryBuilderExecutor
+import com.yinjie.heating.common.api.SortBuilderExecutor
+import com.dySweetFishPlugin.elasticsearch.ESClient
+import com.sweetfish.convert.json.JsonConvert
+import com.sweetfish.source.PageFlipper
+import org.elasticsearch.action.search.SearchRequestBuilder
+import org.elasticsearch.action.search.SearchResponse
+import org.elasticsearch.common.unit.TimeValue
+import org.elasticsearch.index.query.QueryBuilder
+import org.elasticsearch.search.SearchHits
+
+/**
+ * Created by jlutt on 2022-04-20
+ *
+ * @author jlutt
+ */
+
+class ESList<T> {
+
+    private ESClient esClient
+
+    private JsonConvert jsonConvert
+
+    private Class<T> clazz
+
+    private QueryBuilderExecutor qbe
+
+    private String index
+
+    private ESDataInfoExecutor<T> de
+
+    private List<SortBuilderExecutor> sbeList = new ArrayList<>()
+
+    static <T> ESList<T> getESList() {
+        return new ESList<>()
+    }
+
+    ESList<T> esClient(ESClient value) {
+        this.esClient = value
+        return this
+    }
+
+    ESList<T> jsonConvert(JsonConvert value) {
+        this.jsonConvert = value
+        return this
+    }
+
+    ESList<T> clazz(Class<T> value) {
+        this.clazz = value
+        return this
+    }
+
+    ESList<T> queryBuilder(QueryBuilderExecutor value) {
+        this.qbe = value
+        return this
+    }
+
+    ESList<T> sortBuilder(SortBuilderExecutor value) {
+        this.sbeList.add(value)
+        return this
+    }
+
+    ESList<T> index(String value) {
+        this.index = value
+        return this
+    }
+
+    ESList<T> dataExecutor(ESDataInfoExecutor<T> value) {
+        this.de = value
+        return this
+    }
+
+    List<T> executeNonePage() {
+        QueryBuilder qb = qbe.execute(null)
+
+        SearchRequestBuilder requestBuilder = esClient.getClient().prepareSearch(index).setQuery(qb)
+
+        if ((sbeList != null) && (!sbeList.isEmpty())) {
+            for (SortBuilderExecutor sortBuilderExecutor : sbeList) {
+                if (sortBuilderExecutor != null) {
+                    requestBuilder = requestBuilder.addSort(sortBuilderExecutor.execute())
+                }
+            }
+        }
+
+        SearchResponse scrollResp = requestBuilder.setSize(100)
+                .setScroll(new TimeValue(60000))
+                .execute()
+                .actionGet()
+
+        List<T> resultList = new ArrayList<>()
+
+        while (scrollResp.getHits().getHits().length != 0) {
+            scrollResp.getHits().getHits().each { x ->
+                String json = x.getSourceAsString()
+                T result = jsonConvert.convertFrom(clazz, json)
+                if (de != null) {
+                    de.execute(result)
+                }
+                resultList.add(result)
+            }
+
+            scrollResp = esClient.getClient().prepareSearchScroll(scrollResp.getScrollId()).setScroll(new TimeValue(60000)).execute().actionGet()
+        }
+
+        return resultList
+    }
+
+    List<T> executePage(PageFlipper pageFlipper) {
+        if (pageFlipper == null) {
+            //加这个判断的目的是为了调用方统一代码,避免写了半天,调用方还要判断是否需要分页获取
+            return executeNonePage()
+        }
+
+        //需要修改pageFlipper的值,所以pageFlipper作参数传入
+        QueryBuilder qb = qbe.execute(null)
+
+        SearchRequestBuilder requestBuilder = esClient.getClient().prepareSearch(index).setQuery(qb)
+
+        if ((sbeList != null) && (!sbeList.isEmpty())) {
+            for (SortBuilderExecutor sortBuilderExecutor : sbeList) {
+                if (sortBuilderExecutor != null) {
+                    requestBuilder = requestBuilder.addSort(sortBuilderExecutor.execute())
+                }
+            }
+        }
+
+        requestBuilder = requestBuilder.setSize(pageFlipper.getPageSize())
+                .setFrom(pageFlipper.getPageSize() * (pageFlipper.getPageIndex() - 1))
+
+
+        SearchHits searchHits = requestBuilder.execute().actionGet().getHits()
+
+        List<T> resultList = new ArrayList<>()
+        searchHits.each { x ->
+            String json = x.getSourceAsString()
+            T result = jsonConvert.convertFrom(clazz, json)
+            if (de != null) {
+                de.execute(result)
+            }
+            resultList.add(result)
+        }
+
+        pageFlipper.setTotal(searchHits.getTotalHits())
+
+        return resultList
+    }
+
+}

+ 123 - 0
conf/script/1000/commons/ESMap.groovy

@@ -0,0 +1,123 @@
+import com.dySweetFishPlugin.elasticsearch.ESClient
+import com.sweetfish.convert.json.JsonConvert
+import com.yinjie.heating.common.api.QueryBuilderExecutor
+import com.yinjie.heating.common.api.SortBuilderExecutor
+import org.elasticsearch.action.search.SearchRequestBuilder
+import org.elasticsearch.action.search.SearchResponse
+import org.elasticsearch.common.unit.TimeValue
+import org.elasticsearch.index.query.QueryBuilder
+
+import java.util.function.ToLongFunction
+
+/**
+ * Created by jlutt on 2022-04-20
+ *
+ * @author jlutt
+ */
+
+class ESMap<T> {
+
+    private long[] src
+
+    private ESClient esClient
+
+    private JsonConvert jsonConvert
+
+    private Class<T> clazz
+
+    private QueryBuilderExecutor qbe
+
+    private String index
+
+    private ToLongFunction<T> tl
+
+    private List<SortBuilderExecutor> sbeList = new ArrayList<>()
+
+    static <T> ESMap<T> getESMap() {
+        return new ESMap<>()
+    }
+
+    ESMap<T> srcIds(long[] value) {
+        this.src = value
+        return this
+    }
+
+    ESMap<T> esClient(ESClient value) {
+        this.esClient = value
+        return this
+    }
+
+    ESMap<T> jsonConvert(JsonConvert value) {
+        this.jsonConvert = value
+        return this
+    }
+
+    ESMap<T> clazz(Class<T> value) {
+        this.clazz = value
+        return this
+    }
+
+    ESMap<T> queryBuilder(QueryBuilderExecutor value) {
+        this.qbe = value
+        return this
+    }
+
+    ESMap<T> sortBuilder(SortBuilderExecutor value) {
+        this.sbeList.add(value)
+        return this
+    }
+
+    ESMap<T> index(String value) {
+        this.index = value
+        return this
+    }
+
+    ESMap<T> convertLongExecutor(ToLongFunction<T> value) {
+        this.tl = value
+        return this
+    }
+
+    Map<Long, List<T>> execute() {
+        QueryBuilder qb = qbe.execute(null)
+
+        SearchRequestBuilder requestBuilder = esClient.getClient().prepareSearch(index).setQuery(qb)
+
+        if ((sbeList != null) && (!sbeList.isEmpty())) {
+            for (SortBuilderExecutor sortBuilderExecutor : sbeList) {
+                if (sortBuilderExecutor != null) {
+                    requestBuilder = requestBuilder.addSort(sortBuilderExecutor.execute())
+                }
+            }
+        }
+
+        SearchResponse scrollResp = requestBuilder.setSize(100)
+                .setScroll(new TimeValue(60000))
+                .execute()
+                .actionGet()
+
+        HashMap<Long, List<T>> dataMap = new HashMap<>()
+
+        while (scrollResp.getHits().getHits().length != 0) {
+            scrollResp.getHits().getHits().each { x ->
+                String json = x.getSourceAsString()
+                T result = jsonConvert.convertFrom(clazz, json)
+                long iValue = tl.applyAsLong(result)
+                if (!dataMap.containsKey(iValue)) {
+                    dataMap.put(iValue, new ArrayList<>())
+                }
+                dataMap.get(iValue).add(result)
+            }
+
+            scrollResp = esClient.getClient().prepareSearchScroll(scrollResp.getScrollId()).setScroll(new TimeValue(60000)).execute().actionGet()
+        }
+
+        src.each { l ->
+            if (!dataMap.containsKey(l)) {
+                dataMap.put(l, new ArrayList<>())
+            }
+        }
+
+        return dataMap
+    }
+}
+

+ 83 - 0
conf/script/1000/commons/ESOne.groovy

@@ -0,0 +1,83 @@
+import com.dySweetFishPlugin.elasticsearch.ESClient
+import com.yinjie.heating.common.api.ESHitInfoExecutor
+import com.yinjie.heating.common.api.QueryBuilderExecutor
+import com.sweetfish.convert.json.JsonConvert
+import org.elasticsearch.action.search.SearchResponse
+import org.elasticsearch.index.query.QueryBuilder
+import org.elasticsearch.search.SearchHit
+
+/**
+ * Created by jlutt on 2022-04-20
+ *
+ * @author jlutt
+ */
+
+class ESOne<T> {
+
+    private ESClient esClient
+
+    private JsonConvert jsonConvert
+
+    private Class<T> clazz
+
+    private QueryBuilderExecutor qbe
+
+    private String index
+
+    private ESHitInfoExecutor<T> de
+
+    static <T> ESOne<T> getESOneInfo() {
+        return new ESOne<>()
+    }
+
+    ESOne<T> esClient(ESClient value) {
+        this.esClient = value
+        return this
+    }
+
+    ESOne<T> jsonConvert(JsonConvert value) {
+        this.jsonConvert = value
+        return this
+    }
+
+    ESOne<T> clazz(Class<T> value) {
+        this.clazz = value
+        return this
+    }
+
+    ESOne<T> queryBuilder(QueryBuilderExecutor value) {
+        this.qbe = value
+        return this
+    }
+
+    ESOne<T> index(String value) {
+        this.index = value
+        return this
+    }
+
+    ESOne<T> hitExecutor(ESHitInfoExecutor<T> value) {
+        this.de = value
+        return this
+    }
+
+    T execute() {
+        QueryBuilder qb = qbe.execute(null)
+
+        SearchResponse scrollResp = esClient.getClient().prepareSearch(index)
+                .setQuery(qb)
+                .setSize(1)
+                .execute()
+                .actionGet()
+        if (scrollResp.getHits().getTotalHits() == 0) {
+            return null
+        } else {
+            SearchHit hit = scrollResp.getHits().getHits()[0]
+            if (de != null) {
+                return de.execute(hit)
+            } else {
+                return jsonConvert.convertFrom(clazz, hit.getSourceAsString())
+            }
+        }
+    }
+
+}

+ 16 - 0
conf/script/1000/commons/ExecPageFlipper.groovy

@@ -0,0 +1,16 @@
+import com.sweetfish.source.PageFlipper
+
+class ExecPageFlipper {
+
+    static execute(int pageSize, Closure command) {
+        PageFlipper pageFlipper = new PageFlipper(1, pageSize)
+
+        command(pageFlipper)
+
+        int iPageTotal = pageFlipper.getPageTotal()
+        for (int i = 2; i <= iPageTotal; i++) {
+            pageFlipper.setPageIndex(i)
+            command(pageFlipper)
+        }
+    }
+}

+ 33 - 0
conf/script/1000/commons/GroovyExtensions.groovy

@@ -0,0 +1,33 @@
+import com.yinjie.heating.common.entity.store.StoreInfo
+import com.yinjie.heating.common.entity.store.StorePlatform
+import org.apache.commons.lang3.StringUtils
+
+class GroovyExtensions {
+
+    static void apply() {
+        List.metaClass {
+            findQuotedElement = { Map<String, String> conditions ->
+                delegate.find { element ->
+                    conditions.every { condition, value -> element[condition] == value }
+                }
+            }
+
+            findQuotedElements = { Map<String, String> conditions ->
+                delegate.findAll { element ->
+                    conditions.every { condition, value -> element[condition] == value }
+                }
+            }
+        }
+
+        StoreInfo.metaClass {
+            requireItem = { String platformCode, String requireCode ->
+                def storeInfo = delegate as StoreInfo
+                StorePlatform storePlatform = storeInfo.platformList.find { StringUtils.equalsIgnoreCase(it.platformCode, platformCode) }
+                if (storePlatform == null) {
+                    return null
+                }
+                return storePlatform.requireList.find {StringUtils.equalsIgnoreCase(it.platformRequireCode, requireCode)}
+            }
+        }
+    }
+}

+ 27 - 0
conf/script/1000/commons/QT.groovy

@@ -0,0 +1,27 @@
+import groovy.json.JsonSlurper
+
+class QT {
+    static load(String appHome, long supplierCode, String jsonFile) {
+        def jsonSlurper = new JsonSlurper()
+
+        def testTableJsonFile = new File(appHome + File.separator +
+                "conf" + File.separator +
+                "script" + File.separator +
+                supplierCode + File.separator +
+                "quoteFiles" + File.separator +
+                jsonFile)
+        return jsonSlurper.parse(testTableJsonFile)
+    }
+
+    static int convertRunMode(String sysRunMode) {
+        if ("ERP".equalsIgnoreCase(sysRunMode)) {
+            return 0
+        } else if ("Mall".equalsIgnoreCase(sysRunMode)) {
+            return 1
+        } else if ("ProductCenter".equalsIgnoreCase(sysRunMode)) {
+            return 2
+        } else {
+            return 0
+        }
+    }
+}

+ 3 - 0
conf/script/1000/init/First_1_ApplyGroovyExt.groovy

@@ -0,0 +1,3 @@
+import Ignore_GroovyExtensions as GroovyExtensions
+
+GroovyExtensions.apply()

+ 16 - 0
conf/script/1000/init/Ignore_ExecPageFlipper.groovy

@@ -0,0 +1,16 @@
+import com.sweetfish.source.PageFlipper
+
+class Ignore_ExecPageFlipper {
+
+    static execute(int pageSize, Closure command) {
+        PageFlipper pageFlipper = new PageFlipper(1, pageSize)
+
+        command(pageFlipper)
+
+        int iPageTotal = pageFlipper.getPageTotal()
+        for (int i = 2; i <= iPageTotal; i++) {
+            pageFlipper.setPageIndex(i)
+            command(pageFlipper)
+        }
+    }
+}

+ 21 - 0
conf/script/1000/init/Ignore_GroovyExtensions.groovy

@@ -0,0 +1,21 @@
+/**
+ * 扩展一些Groovy方法
+ */
+class Ignore_GroovyExtensions {
+
+    static void apply() {
+        List.metaClass {
+            findQuotedElement = { Map<String, String> conditions ->
+                delegate.find { element ->
+                    conditions.every { condition, value -> element[condition] == value }
+                }
+            }
+
+            findQuotedElements = { Map<String, String> conditions ->
+                delegate.findAll { element ->
+                    conditions.every { condition, value -> element[condition] == value }
+                }
+            }
+        }
+    }
+}

+ 40 - 0
conf/script/1000/init/Ignore_ReadUTF8File.groovy

@@ -0,0 +1,40 @@
+import com.dySweetFishPlugin.tool.lang.Holder
+import org.apache.logging.log4j.Logger
+
+import java.nio.charset.StandardCharsets
+import java.nio.file.Files
+import java.nio.file.Path
+import java.util.stream.Stream
+
+class Ignore_ReadUTF8File {
+
+    static String execute(Path scriptFile, boolean trimed, Logger logger) {
+        final StringBuilder buf = new StringBuilder()
+
+        try {
+            Integer iIndex = 0
+            Holder<Integer> prefix = Holder.of(iIndex)
+            try (Stream<String> lines = Files.lines(scriptFile, StandardCharsets.UTF_8)) {
+                lines.each { line ->
+                    line = (trimed) ? line.trim() : line
+                    if (!line.isEmpty()) {
+                        if (prefix.get() == 0) {
+                            buf.append((trimed) ? line.trim() : line)
+                        } else {
+                            buf.append("\n").append((trimed) ? line.trim() : line)
+                        }
+
+                        prefix.set(1)
+                    } else {
+                        if (!trimed) buf.append("\n")
+                    }
+                }
+            }
+
+        } catch (IOException e) {
+            logger.error(e.getMessage(), e)
+        }
+
+        return buf.toString()
+    }
+}

+ 101 - 0
conf/script/1000/init/Init_10_Inquire.groovy

@@ -0,0 +1,101 @@
+import Ignore_ExecPageFlipper as ExecPageFlipper
+import com.yinjie.heating.business.dao.DocDao
+import com.yinjie.heating.common.api.NoSqlKeysService
+import com.yinjie.heating.common.datas.ESKeys
+import com.yinjie.heating.common.datas.RedisKeys
+import com.yinjie.heating.common.entity.inquire.InquireCondition
+import com.yinjie.heating.common.entity.inquire.InquireMainInfo
+import com.yinjie.heating.common.entity.inquire.InquireResultColumn
+import com.yinjie.heating.common.tool.ERPUtils
+import com.dySweetFishPlugin.elasticsearch.ESClient
+import com.dySweetFishPlugin.redis.RedisService
+import com.sweetfish.convert.json.JsonConvert
+import com.sweetfish.source.PageFlipper
+import com.sweetfish.util.Utility
+import org.apache.logging.log4j.Logger
+import org.elasticsearch.action.bulk.BulkRequestBuilder
+import org.elasticsearch.action.bulk.BulkResponse
+import org.elasticsearch.action.index.IndexRequestBuilder
+import org.elasticsearch.common.xcontent.XContentType
+import org.rex.RMap
+
+static def buildTreeList(List<InquireResultColumn> platColumns, long idParent) {
+    if (platColumns.isEmpty())
+        return platColumns
+
+    List<InquireResultColumn> parents = platColumns.findAll { x ->
+        x.idParentColumn == idParent
+    }
+    platColumns.removeAll(parents)
+    parents.each { x ->
+        x.childColumnList = buildTreeList(platColumns, x.id)
+    }
+
+    return parents
+}
+
+static def createRunnable(RedisService redisService, ESClient esClient, NoSqlKeysService keysService, DocDao docDao, JsonConvert jsonConvert, Logger logger, String dataSourceId, long supplierCode) {
+    return {
+        esClient.createIndex(keysService.getESKey(ESKeys.ESERPINQUIREINFO_INDEX, supplierCode), ESKeys.INDEX_CONFIG,
+                Utility.ofMap(ESKeys.ESERPINQUIREMAININFO_TYPE, "inquiremaininfo.json",
+                        ESKeys.ESERPINQUIRERESULTCOLUMN_TYPE, "inquireresultcolumn.json",
+                        ESKeys.ESERPINQUIRECONDITION_TYPE, "inquirecondition.json"))
+
+        redisService.del(keysService.getRedisKey(RedisKeys.KEY_ERP_INQUIREINFO, supplierCode))
+
+        RMap params = new RMap()
+        ExecPageFlipper.execute(500, { PageFlipper p ->
+            List<InquireMainInfo> inquireMainInfos = docDao.selectInquireMainInfo(params, p, dataSourceId, supplierCode)
+
+            if (!inquireMainInfos.isEmpty()) {
+                BulkRequestBuilder bulkRequest = esClient.getClient().prepareBulk()
+
+                inquireMainInfos.each { x ->
+                    IndexRequestBuilder indexRequest = esClient.getClient()
+                            .prepareIndex(keysService.getESKey(ESKeys.ESERPINQUIREINFO_INDEX, supplierCode), ESKeys.ESERPINQUIREMAININFO_TYPE)
+                            .setId(String.valueOf(x.getId()))
+                            .setSource(jsonConvert.convertTo(x), XContentType.JSON)
+                    bulkRequest.add(indexRequest)
+
+                    RMap inquireParams = ERPUtils.ofRMap("idInquire", x.id)
+                    ExecPageFlipper.execute(1000, { PageFlipper p1 ->
+                        List<InquireResultColumn> inquireResultColumns = docDao.selectInquireResultColumn(inquireParams, p1, dataSourceId, supplierCode)
+
+                        //组成树结构
+                        if (!inquireResultColumns.isEmpty()) {
+                            List<InquireResultColumn> treeList = buildTreeList(inquireResultColumns, 0L)
+                            x.setResultColumnList(treeList)
+                        }
+                    })
+
+                    ExecPageFlipper.execute(1000, { PageFlipper p2 ->
+                        List<InquireCondition> inquireConditions = docDao.selectInquireCondition(params, p2, dataSourceId, supplierCode)
+
+                        if (!inquireConditions.isEmpty())
+                            x.setConditionList(inquireConditions)
+                    })
+                }
+
+                BulkResponse bulkResponse = bulkRequest.execute().actionGet()
+
+                if (bulkResponse.hasFailures()) {
+                    logger.error("索引查询统计:" + bulkResponse.buildFailureMessage())
+                } else {
+                    logger.info("索引查询统计共" + inquireMainInfos.size() + "条记录")
+                }
+
+                Map<String, String> inquireInfoMap = inquireMainInfos.collectEntries { [String.valueOf(it.getId()), jsonConvert.convertTo(it)] }
+
+                if (!inquireInfoMap.isEmpty())
+                    redisService.hmset(keysService.getRedisKey(RedisKeys.KEY_ERP_INQUIREINFO, supplierCode), inquireInfoMap)
+            }
+        })
+    } as Runnable
+}
+
+//groovy最后一个表达式的值为返回
+createRunnable(redisService, esClient, keysService, docDao, jsonConvert, logger, dataSourceId, supplierCode)
+
+
+
+

+ 25 - 0
conf/script/1000/init/Init_11_NoticeMessage.groovy

@@ -0,0 +1,25 @@
+import com.yinjie.heating.business.dao.SystemDao
+import com.yinjie.heating.common.api.NoSqlKeysService
+import com.yinjie.heating.common.datas.RedisKeys
+import com.yinjie.heating.common.entity.system.NoticeMessage
+import com.dySweetFishPlugin.redis.RedisService
+import com.sweetfish.convert.json.JsonConvert
+import org.rex.RMap
+
+static def createRunnable(RedisService redisService, NoSqlKeysService keysService, SystemDao systemDao, JsonConvert jsonConvert, String dataSourceId, long supplierCode) {
+    return {
+        RMap params = new RMap()
+        redisService.del(keysService.getRedisKey(RedisKeys.KEY_ERP_NOTICEMESSAGE, supplierCode))
+        List<NoticeMessage> dataList = systemDao.selectAllNoticeMessage(params, dataSourceId, supplierCode)
+        if (!dataList.isEmpty()) {
+            Map<String, String> redisMap = dataList.collectEntries { [String.valueOf(it.getId()), jsonConvert.convertTo(it)] }
+            redisService.hmset(keysService.getRedisKey(RedisKeys.KEY_ERP_NOTICEMESSAGE, supplierCode), redisMap)
+        }
+    } as Runnable
+}
+
+//groovy最后一个表达式的值为返回
+createRunnable(redisService, keysService, systemDao, jsonConvert, dataSourceId, supplierCode)
+
+
+

+ 31 - 0
conf/script/1000/init/Init_12_UserNoticeMessage.groovy

@@ -0,0 +1,31 @@
+import Ignore_ExecPageFlipper as ExecPageFlipper
+import com.yinjie.heating.business.dao.SystemDao
+import com.yinjie.heating.common.api.NoSqlKeysService
+import com.yinjie.heating.common.datas.RedisKeys
+import com.yinjie.heating.common.entity.system.UserNoticeMessage
+import com.dySweetFishPlugin.redis.RedisService
+import com.sweetfish.source.PageFlipper
+import org.rex.RMap
+
+static def createRunnable(RedisService redisService, NoSqlKeysService keysService, SystemDao systemDao, String dataSourceId, long supplierCode) {
+    return {
+        RMap params = new RMap()
+
+        redisService.del(keysService.getRedisKey(RedisKeys.KEY_ERP_USERNOTICEMESSAGE, supplierCode));
+        ExecPageFlipper.execute(500, { PageFlipper p ->
+            List<UserNoticeMessage> personList = systemDao.selectUserNoticeMessage(params, p, dataSourceId, supplierCode);
+
+            if (!personList.isEmpty()) {
+                Map<String, String> redisMap = personList.collectEntries { [it.messageCode + "-" + it.getIdUser() + "-0", "1"] }
+                redisService.hmset(keysService.getRedisKey(RedisKeys.KEY_ERP_USERNOTICEMESSAGE, supplierCode), redisMap);
+            }
+        })
+    } as Runnable
+}
+
+//groovy最后一个表达式的值为返回
+createRunnable(redisService, keysService, systemDao, dataSourceId, supplierCode)
+
+
+
+

+ 31 - 0
conf/script/1000/init/Init_13_SysMsg.groovy

@@ -0,0 +1,31 @@
+import com.yinjie.heating.common.api.NoSqlKeysService
+import com.yinjie.heating.common.datas.ESKeys
+import com.dySweetFishPlugin.elasticsearch.ESClient
+import com.sweetfish.util.Utility
+
+static def createRunnable(ESClient esClient, NoSqlKeysService keysService, long supplierCode) {
+    return {
+        //操作日志
+        esClient.checkIndexEx(ESKeys.ESOPLOG_INDEX + "_" + supplierCode, ESKeys.INDEX_CONFIG,
+                Utility.ofMap(ESKeys.ESERPDEFAULT_TYPE, "oplog.json"))
+
+        //region 站内通知和短信
+        esClient.checkIndexEx(keysService.getESKey(ESKeys.ESERPSYSMSG_INDEX, supplierCode), ESKeys.INDEX_CONFIG,
+                Utility.ofMap(ESKeys.ESERPDEFAULT_TYPE, "sysmessage.json"))
+
+        esClient.checkIndexEx(keysService.getESKey(ESKeys.ESERPSYSMSGTEXT_INDEX, supplierCode), ESKeys.INDEX_CONFIG,
+                Utility.ofMap(ESKeys.ESERPDEFAULT_TYPE, "sysmessagetext.json"))
+
+        esClient.checkIndexEx(keysService.getESKey(ESKeys.ESERPP2PMSG_INDEX, supplierCode), ESKeys.INDEX_CONFIG,
+                Utility.ofMap(ESKeys.ESERPDEFAULT_TYPE, "sysmessage.json"))
+
+        esClient.checkIndexEx(keysService.getESKey(ESKeys.ESERPP2PMSGTEXT_INDEX, supplierCode), ESKeys.INDEX_CONFIG,
+                Utility.ofMap(ESKeys.ESERPDEFAULT_TYPE, "sysmessagetext.json"))
+
+        esClient.checkIndexEx(keysService.getESKey(ESKeys.ESERPUSERMSG_INDEX, supplierCode), ESKeys.INDEX_CONFIG,
+                Utility.ofMap(ESKeys.ESERPDEFAULT_TYPE, "sysmessagestatus.json"))
+    } as Runnable
+}
+
+//groovy最后一个表达式的值为返回
+createRunnable(esClient, keysService, supplierCode)

+ 41 - 0
conf/script/1000/init/Init_1_Menu.groovy

@@ -0,0 +1,41 @@
+import com.yinjie.heating.business.dao.SystemDao
+import com.yinjie.heating.common.api.NoSqlKeysService
+import com.yinjie.heating.common.datas.RedisKeys
+import com.yinjie.heating.common.entity.system.Menu
+import com.dySweetFishPlugin.redis.RedisService
+import com.sweetfish.convert.json.JsonConvert
+import org.rex.RMap
+
+//def task = { RedisService redisService, NoSqlKeysService keysService, SystemDao systemDao, JsonConvert jsonConvert, String dataSourceId, long supplierCode ->
+//    RMap params = new RMap<>()
+//
+//    redisService.del(keysService.getRedisKey(RedisKeys.KEY_SYSMENUS, supplierCode))
+//
+//    List<Menu> menuList = systemDao.queryAllMenus(params, dataSourceId, supplierCode)
+//    //直接写入到redis,取出交给服务需要进行子集处理
+//    Map<String, String> menuMap = menuList.collectEntries { [String.valueOf(it.getId()), jsonConvert.convertTo(it)] }
+//    if (!menuMap.isEmpty()) {
+//        redisService.hmset(keysService.getRedisKey(RedisKeys.KEY_SYSMENUS, supplierCode), menuMap)
+//    }
+//} as Runnable
+//
+//return task(redisService)
+
+//使用上面的写法报错,只能用下面的写法,ide有警告不纠结了,还有一种写法,写一个实现Runnable的class,不如现在看着舒服
+static def createRunnable(RedisService redisService, NoSqlKeysService keysService, SystemDao systemDao, JsonConvert jsonConvert, String dataSourceId, long supplierCode) {
+    return {
+        RMap params = new RMap<>()
+
+        redisService.del(keysService.getRedisKey(RedisKeys.KEY_SYSMENUS, supplierCode))
+
+        List<Menu> menuList = systemDao.queryAllMenus(params, dataSourceId, supplierCode)
+        //直接写入到redis,取出交给服务需要进行子集处理
+        Map<String, String> menuMap = menuList.collectEntries { [String.valueOf(it.getId()), jsonConvert.convertTo(it)] }
+        if (!menuMap.isEmpty()) {
+            redisService.hmset(keysService.getRedisKey(RedisKeys.KEY_SYSMENUS, supplierCode), menuMap)
+        }
+    } as Runnable
+}
+
+//groovy最后一个表达式的值为返回,下面的警告用这种写法去不掉,因为参数是java传递过来的
+createRunnable(redisService, keysService, systemDao, jsonConvert, dataSourceId, supplierCode)

+ 29 - 0
conf/script/1000/init/Init_29_CompanyInfo.groovy

@@ -0,0 +1,29 @@
+import com.yinjie.heating.business.dao.DocDao
+import com.yinjie.heating.common.api.NoSqlKeysService
+import com.yinjie.heating.common.datas.RedisKeys
+import com.yinjie.heating.common.entity.system.CompanyInfo
+import com.dySweetFishPlugin.redis.RedisService
+import com.sweetfish.convert.json.JsonConvert
+import com.sweetfish.source.PageFlipper
+import org.apache.logging.log4j.Logger
+import org.rex.RMap
+
+
+static def createRunnable(RedisService redisService, NoSqlKeysService keysService,
+                          DocDao docDao, Logger logger, JsonConvert jsonConvert, String dataSourceId, long supplierCode) {
+    return {
+        RMap params = new RMap()
+        params.put("voidFlag", -1)
+        redisService.del(keysService.getRedisKey(RedisKeys.KEY_COMPANY_INFO, supplierCode))
+        Ignore_ExecPageFlipper.execute(1000, { PageFlipper p ->
+            List<CompanyInfo> companyInfoList = docDao.selectCompanyInfo(params, dataSourceId, supplierCode, p)
+            Map<String, String> redisMap = companyInfoList.collectEntries { [String.valueOf(it.getId()), jsonConvert.convertTo(it)] }
+            if (!redisMap.isEmpty()) {
+                redisService.hmset(keysService.getRedisKey(RedisKeys.KEY_COMPANY_INFO, supplierCode), redisMap)
+                logger.info("工厂档案,共" + companyInfoList.size() + "条记录")
+            }
+        })
+    } as Runnable
+}
+
+createRunnable(redisService, keysService, docDao, logger, jsonConvert, dataSourceId, supplierCode)

+ 11 - 0
conf/script/1000/init/Init_2_Role.groovy

@@ -0,0 +1,11 @@
+import com.yinjie.heating.common.api.PermissionService
+
+static def createRunnable(PermissionService permissionService, String dataSourceId, long supplierCode) {
+    return {
+        permissionService.buildRoleCache(true, dataSourceId, supplierCode)
+    } as Runnable
+}
+
+//groovy最后一个表达式的值为返回
+createRunnable(permissionService, dataSourceId, supplierCode)
+

+ 64 - 0
conf/script/1000/init/Init_3_Config.groovy

@@ -0,0 +1,64 @@
+import com.yinjie.heating.business.dao.SystemDao
+import com.yinjie.heating.common.api.NoSqlKeysService
+import com.yinjie.heating.common.datas.RedisKeys
+import com.yinjie.heating.common.entity.system.ConfigValue
+import com.dySweetFishPlugin.redis.RedisService
+import com.sweetfish.convert.json.JsonConvert
+import org.apache.commons.lang3.StringUtils
+import org.rex.RMap
+
+import java.util.stream.Collectors
+
+static def createRunnable(RedisService redisService, NoSqlKeysService keysService, SystemDao systemDao, JsonConvert jsonConvert, String dataSourceId, long supplierCode) {
+    return {
+        RMap params = new RMap()
+
+        redisService.del(keysService.getRedisKey(RedisKeys.KEY_CONFIGVALUE, supplierCode))
+
+        for (String key : RedisKeys.SUPPLIER_SYSTEM_CONFIGARR) {
+            RMap initConfigParams = new RMap()
+            initConfigParams.put("configKey", key)
+            ConfigValue initConfig = systemDao.queryConfigValue(initConfigParams, dataSourceId, supplierCode)
+            if ((initConfig == null) || (StringUtils.isEmpty(initConfig.getConfigKey()))) {
+                initConfig = new ConfigValue()
+                initConfig.setConfigKey(key)
+                initConfig.setConfigName("")
+                initConfig.setConfigValue1("")
+                initConfig.setConfigValue2("")
+                initConfig.setConfigValue3("")
+
+                systemDao.addConfigValueSync(initConfig, dataSourceId, supplierCode)
+            }
+        }
+
+        for (String key : RedisKeys.SUPPLIER_SITEINFO_CONFIGARR) {
+            RMap initConfigParams = new RMap()
+            initConfigParams.put("configKey", key)
+            ConfigValue initConfig = systemDao.queryConfigValue(initConfigParams, dataSourceId, supplierCode)
+            if ((initConfig == null) || (StringUtils.isEmpty(initConfig.getConfigKey()))) {
+                initConfig = new ConfigValue();
+                initConfig.setConfigKey(key)
+                initConfig.setConfigName("")
+                initConfig.setConfigValue1("")
+                initConfig.setConfigValue2("")
+                initConfig.setConfigValue3("")
+
+                systemDao.addConfigValueSync(initConfig, dataSourceId, supplierCode)
+            }
+        }
+
+        List<ConfigValue> configValueList = systemDao.queryAllConfigValues(params, dataSourceId, supplierCode)
+
+        Map<String, String> configValueMap = configValueList.stream().collect(
+                Collectors.toMap(ConfigValue::getConfigKey, x -> jsonConvert.convertTo(x))
+        )
+
+        if (!configValueMap.isEmpty()) {
+            redisService.hmset(keysService.getRedisKey(RedisKeys.KEY_CONFIGVALUE, supplierCode), configValueMap)
+        }
+    } as Runnable
+}
+
+//groovy最后一个表达式的值为返回
+createRunnable(redisService, keysService, systemDao, jsonConvert, dataSourceId, supplierCode)
+

+ 40 - 0
conf/script/1000/init/Init_4_LoginUser.groovy

@@ -0,0 +1,40 @@
+import Ignore_ExecPageFlipper as ExecPageFlipper
+import com.yinjie.heating.business.dao.SystemDao
+import com.yinjie.heating.common.api.NoSqlKeysService
+import com.yinjie.heating.common.datas.RedisKeys
+import com.yinjie.heating.common.entity.system.LoginUser
+import com.yinjie.heating.common.tool.ERPUtils
+import com.dySweetFishPlugin.redis.RedisService
+import com.sweetfish.convert.json.JsonConvert
+import com.sweetfish.source.PageFlipper
+import org.rex.RMap
+
+static def createRunnable(RedisService redisService, NoSqlKeysService keysService, SystemDao systemDao, JsonConvert jsonConvert, String dataSourceId, long supplierCode) {
+    return {
+        redisService.del(keysService.getRedisKey(RedisKeys.KEY_ERP_ONLINEUSER, supplierCode))
+        redisService.del(keysService.getRedisKey(RedisKeys.KEY_ERP_LOGINUSER, supplierCode))
+
+        RMap tmpParams = ERPUtils.ofRMap("status", -1)
+
+        ExecPageFlipper.execute(500, { PageFlipper p ->
+            List<LoginUser> loginUserList = systemDao.queryLoginUsers(tmpParams, p, dataSourceId, supplierCode);
+
+            if (!loginUserList.isEmpty()) {
+                Map<String, String> redisMap = loginUserList.collectEntries { [String.valueOf(it.getId()), jsonConvert.convertTo(it)] }
+                redisService.hmset(keysService.getRedisKey(RedisKeys.KEY_ERP_LOGINUSER, supplierCode), redisMap)
+            }
+        })
+
+        //默认一个菜单管理,防止管理员被修改
+        LoginUser resourceUser = new LoginUser()
+        resourceUser.setId(-999L)
+        resourceUser.setLoginName("SuperResourcer")
+        resourceUser.setUserName("资源管理员")
+        resourceUser.setDeptName("资源管理")
+        resourceUser.setStatus(0)
+        redisService.hset(keysService.getRedisKey(RedisKeys.KEY_ERP_LOGINUSER, supplierCode), String.valueOf(resourceUser.getId()), resourceUser);
+    } as Runnable
+}
+
+//groovy最后一个表达式的值为返回
+createRunnable(redisService, keysService, systemDao, jsonConvert, dataSourceId, supplierCode)

+ 27 - 0
conf/script/1000/init/Init_5_Dept.groovy

@@ -0,0 +1,27 @@
+import com.yinjie.heating.business.dao.SystemDao
+import com.yinjie.heating.common.api.NoSqlKeysService
+import com.yinjie.heating.common.datas.RedisKeys
+import com.yinjie.heating.common.entity.system.Dept
+import com.dySweetFishPlugin.redis.RedisService
+import com.sweetfish.convert.json.JsonConvert
+import org.rex.RMap
+
+static def createRunnable(RedisService redisService, NoSqlKeysService keysService, SystemDao systemDao, JsonConvert jsonConvert, String dataSourceId, long supplierCode) {
+    return {
+        RMap params = new RMap()
+
+        redisService.del(keysService.getRedisKey(RedisKeys.KEY_DEPT, supplierCode))
+        List<Dept> deptList = systemDao.queryAllDepts(params, dataSourceId, supplierCode)
+
+        if (!deptList.isEmpty()) {
+            Map<String, String> redisMap = deptList.collectEntries { [String.valueOf(it.getId()), jsonConvert.convertTo(it)] }
+            redisService.hmset(keysService.getRedisKey(RedisKeys.KEY_DEPT, supplierCode), redisMap)
+        }
+    } as Runnable
+}
+
+//groovy最后一个表达式的值为返回
+createRunnable(redisService, keysService, systemDao, jsonConvert, dataSourceId, supplierCode)
+
+
+

+ 33 - 0
conf/script/1000/init/Init_6_PersonConfig.groovy

@@ -0,0 +1,33 @@
+import Ignore_ExecPageFlipper as ExecPageFlipper
+import com.yinjie.heating.business.dao.SystemDao
+import com.yinjie.heating.common.api.NoSqlKeysService
+import com.yinjie.heating.common.datas.RedisKeys
+import com.yinjie.heating.common.entity.system.PersonConfigValue
+import com.dySweetFishPlugin.redis.RedisService
+import com.sweetfish.convert.json.JsonConvert
+import com.sweetfish.source.PageFlipper
+import org.rex.RMap
+
+static def createRunnable(RedisService redisService, NoSqlKeysService keysService, SystemDao systemDao, JsonConvert jsonConvert, String dataSourceId, long supplierCode) {
+    return {
+        redisService.del(keysService.getRedisKey(RedisKeys.KEY_ERP_PERSONCONFIG, supplierCode))
+        RMap tmpParams = new RMap()
+
+        ExecPageFlipper.execute(500, { PageFlipper p ->
+            List<PersonConfigValue> configValueList = systemDao.queryPersonConfigValue(tmpParams, p, dataSourceId, supplierCode)
+
+            if (!configValueList.isEmpty()) {
+                Map<String, String> redisMap = configValueList.collectEntries { [String.valueOf(it.getIdUser()) + "_" + it.getConfigKey(), jsonConvert.convertTo(it)] }
+                redisService.hmset(keysService.getRedisKey(RedisKeys.KEY_ERP_PERSONCONFIG, supplierCode), redisMap)
+            }
+        })
+
+    } as Runnable
+}
+
+//groovy最后一个表达式的值为返回
+createRunnable(redisService, keysService, systemDao, jsonConvert, dataSourceId, supplierCode)
+
+
+
+

+ 53 - 0
conf/script/1000/init/Init_7_DataPurview.groovy

@@ -0,0 +1,53 @@
+import Ignore_ExecPageFlipper as ExecPageFlipper
+import com.yinjie.heating.business.dao.SystemDao
+import com.yinjie.heating.common.api.NoSqlKeysService
+import com.yinjie.heating.common.datas.ESKeys
+import com.yinjie.heating.common.entity.system.DataPurview
+import com.yinjie.heating.common.tool.ERPUtils
+import com.dySweetFishPlugin.elasticsearch.ESClient
+import com.sweetfish.convert.json.JsonConvert
+import com.sweetfish.source.PageFlipper
+import com.sweetfish.util.Utility
+import org.apache.logging.log4j.Logger
+import org.elasticsearch.action.bulk.BulkRequestBuilder
+import org.elasticsearch.action.bulk.BulkResponse
+import org.elasticsearch.action.index.IndexRequestBuilder
+import org.elasticsearch.common.xcontent.XContentType
+import org.rex.RMap
+
+static def createRunnable(NoSqlKeysService keysService, ESClient esClient, SystemDao systemDao, JsonConvert jsonConvert, Logger logger, String dataSourceId, long supplierCode) {
+    return {
+        esClient.createIndex(keysService.getESKey(ESKeys.ESERPDATAPURVIEW_INDEX, supplierCode), ESKeys.INDEX_CONFIG,
+                Utility.ofMap(ESKeys.ESERPDEFAULT_TYPE, "dataPurview.json"))
+
+        RMap params = ERPUtils.ofRMap("voidFlag", -1)
+        ExecPageFlipper.execute(500, { PageFlipper p ->
+            List<DataPurview> dataPurviewList = systemDao.selectDataPurview(params, p, dataSourceId, supplierCode)
+
+            if (!dataPurviewList.isEmpty()) {
+                //产品基本信息,存入es
+                BulkRequestBuilder bulkRequest = esClient.getClient().prepareBulk()
+                dataPurviewList.forEach((x) -> {
+                    IndexRequestBuilder indexRequest = esClient.getClient()
+                            .prepareIndex(keysService.getESKey(ESKeys.ESERPDATAPURVIEW_INDEX, supplierCode), ESKeys.ESERPDEFAULT_TYPE)
+                            .setId(x.getIdData() + "_" + x.getIdUser() + "_" + x.getIdCreateUser())
+                            .setSource(jsonConvert.convertTo(x), XContentType.JSON)
+                    bulkRequest.add(indexRequest)
+                })
+                BulkResponse bulkResponse = bulkRequest.execute().actionGet()
+
+                if (bulkResponse.hasFailures()) {
+                    logger.error("索引数据权限出错:" + bulkResponse.buildFailureMessage())
+                } else {
+                    logger.info("索引数据权限,共" + dataPurviewList.size() + "条记录")
+                }
+            }
+        })
+    } as Runnable
+}
+
+//groovy最后一个表达式的值为返回
+createRunnable(keysService, esClient, systemDao, jsonConvert, logger, dataSourceId, supplierCode)
+
+
+

+ 46 - 0
conf/script/1000/init/Init_8_Dict.groovy

@@ -0,0 +1,46 @@
+import Ignore_ExecPageFlipper as ExecPageFlipper
+import com.yinjie.heating.business.dao.SystemDao
+import com.yinjie.heating.common.api.NoSqlKeysService
+import com.yinjie.heating.common.datas.RedisKeys
+import com.yinjie.heating.common.entity.system.DictData
+import com.yinjie.heating.common.entity.system.DictType
+import com.yinjie.heating.common.tool.ERPUtils
+import com.dySweetFishPlugin.redis.RedisService
+import com.sweetfish.convert.json.JsonConvert
+import com.sweetfish.source.PageFlipper
+import org.rex.RMap
+
+static def createRunnable(RedisService redisService, NoSqlKeysService keysService, SystemDao systemDao, JsonConvert jsonConvert, String dataSourceId, long supplierCode) {
+    return {
+        redisService.del(keysService.getRedisKey(RedisKeys.KEY_ERPDICTTYPE, supplierCode))
+
+        RMap dictTypeParams = ERPUtils.ofRMap("voidFlag", -1)
+        ExecPageFlipper.execute(500, { PageFlipper p ->
+
+            List<DictType> dictTypeList = systemDao.queryDictTypes(dictTypeParams, dataSourceId, supplierCode, p)
+            Map<String, String> dictTypeMap = dictTypeList.collectEntries { [String.valueOf(it.getId()), jsonConvert.convertTo(it)] }
+
+            if (!dictTypeMap.isEmpty()) {
+                redisService.hmset(keysService.getRedisKey(RedisKeys.KEY_ERPDICTTYPE, supplierCode), dictTypeMap)
+            }
+
+            dictTypeList.each { x ->
+                RMap dictParams = ERPUtils.ofRMap("idType", x.getId(), "voidFlag", -1)
+                redisService.del(keysService.getRedisKey(RedisKeys.KEY_ERPDICTDATA, supplierCode, true) + x.getId())
+                ExecPageFlipper.execute(500, { PageFlipper p1 ->
+                    List<DictData> dictDataList = systemDao.queryDictDatas(dictParams, dataSourceId, supplierCode, p1)
+                    Map<String, String> dictDataMap = dictDataList.collectEntries { [String.valueOf(it.getId()), jsonConvert.convertTo(it)] }
+                    if (!dictDataMap.isEmpty()) {
+                        redisService.hmset(keysService.getRedisKey(RedisKeys.KEY_ERPDICTDATA, supplierCode, true) + x.getId(), dictDataMap)
+                    }
+                })
+            }
+        })
+    } as Runnable
+}
+
+//groovy最后一个表达式的值为返回
+createRunnable(redisService, keysService, systemDao, jsonConvert, dataSourceId, supplierCode)
+
+
+

+ 36 - 0
conf/script/1000/init/Init_9_Script.groovy

@@ -0,0 +1,36 @@
+import Ignore_ExecPageFlipper as ExecPageFlipper
+import com.yinjie.heating.business.dao.DocDao
+import com.yinjie.heating.common.api.NoSqlKeysService
+import com.yinjie.heating.common.datas.RedisKeys
+import com.yinjie.heating.common.entity.doc.BusinessScript
+import com.yinjie.heating.common.tool.ERPUtils
+import com.dySweetFishPlugin.redis.RedisService
+import com.sweetfish.convert.json.JsonConvert
+import com.sweetfish.source.PageFlipper
+import org.apache.commons.lang3.StringUtils
+import org.rex.RMap
+
+static def createRunnable(String runEnvironment, RedisService redisService, NoSqlKeysService keysService, DocDao docDao, JsonConvert jsonConvert, String dataSourceId, long supplierCode) {
+    return {
+
+        if (!StringUtils.equalsIgnoreCase(runEnvironment, "dev")) {
+            redisService.del(keysService.getRedisKey(RedisKeys.KEY_BUSINESSSCRIPT, supplierCode))
+        }
+
+
+        ExecPageFlipper.execute(300, { PageFlipper p ->
+            RMap scriptParams = ERPUtils.ofRMap("voidFlag", -1, "businessModule", -1)
+            List<BusinessScript> scriptList = docDao.selectBusinessScript(scriptParams, dataSourceId, supplierCode, p)
+            Map<String, String> redisMap = scriptList.collectEntries { [it.businessCode, jsonConvert.convertTo(it)] }
+            if (!redisMap.isEmpty()) {
+                redisService.hmset(keysService.getRedisKey(RedisKeys.KEY_BUSINESSSCRIPT, supplierCode), redisMap)
+            }
+        })
+    } as Runnable
+}
+
+//groovy最后一个表达式的值为返回
+createRunnable(runEnvironment, redisService, keysService, docDao, jsonConvert, dataSourceId, supplierCode)
+
+
+

+ 63 - 0
conf/script/1000/init/Run_1_Script2DataBase.groovy

@@ -0,0 +1,63 @@
+import Ignore_ReadUTF8File as ReadUTF8File
+import com.yinjie.heating.common.api.BusinessExecutor
+import com.yinjie.heating.common.api.NoSqlKeysService
+import com.yinjie.heating.common.api.SupplierInitService
+import com.yinjie.heating.common.datas.RedisKeys
+import com.yinjie.heating.common.entity.doc.BusinessScript
+import com.yinjie.heating.common.tool.ERPUtils
+import com.dySweetFishPlugin.redis.RedisService
+import groovy.io.FileType
+import org.apache.commons.io.FilenameUtils
+import org.apache.logging.log4j.Logger
+import org.codehaus.groovy.control.CompilationFailedException
+
+import java.lang.reflect.InvocationTargetException
+
+static def createRunnable(String appHome, SupplierInitService supplierService, RedisService redisService, NoSqlKeysService keysService, Logger logger, String dataSourceId, long supplierCode) {
+    String directoryName = appHome + File.separator +
+            "conf" + File.separator +
+            "script" + File.separator +
+            supplierCode + File.separator
+    File directoryScript = new File(directoryName)
+    if (!directoryScript.exists()) {
+        directoryScript.mkdirs()
+    }
+
+    List.metaClass.findElement = { Map<String, String> conditions ->
+        delegate.find { element ->
+            conditions.every { condition, value -> element[condition] == value }
+        }
+    }
+
+    directoryScript.eachFileRecurse(FileType.FILES, { x ->
+        String code = FilenameUtils.getBaseName(x.getName())
+        if (code.startsWith("BE_")) {
+            code = code.substring(3)
+            if (!redisService.hexists(keysService.getRedisKey(RedisKeys.KEY_BUSINESSSCRIPT, supplierCode), code)) {
+                //读取脚本信息
+                try (GroovyClassLoader groovyCl = new GroovyClassLoader(supplierService.getClass().getClassLoader(), ERPUtils.buildERPGroovyConfig())) {
+                    groovyCl.addClasspath(x.getParent().toString())
+
+                    String fileStr = ReadUTF8File.execute(x.toPath(), false, logger)
+
+                    Class groovyClass = groovyCl.parseClass(fileStr, "BE_" + code + "_" + supplierCode + ".groovy")
+                    BusinessExecutor p = (BusinessExecutor) groovyClass.getDeclaredConstructor().newInstance()
+                    BusinessScript businessScript = BusinessScript.newBuilder()
+                            .businessName(p.scriptName())
+                            .businessCode(code)
+                            .businessModule(p.module().getValue())
+                            .systemFlag(1)
+                            .build()
+                    supplierService.addBusinessScriptLocal(businessScript, dataSourceId, supplierCode)
+
+                    groovyCl.clearCache()
+                } catch (IOException | CompilationFailedException | ClassCastException | InstantiationException | IllegalAccessException | InvocationTargetException | NoSuchMethodException e) {
+                    logger.error(e.getMessage(), e)
+                }
+            }
+        }
+    })
+}
+
+//groovy最后一个表达式的值为返回
+createRunnable(appHome, supplierService, redisService, keysService, logger, dataSourceId, supplierCode)

+ 60 - 0
conf/script/1000/init/Schedule_1_60_300_SysMsgExpire.groovy

@@ -0,0 +1,60 @@
+import com.yinjie.heating.common.api.NoSqlKeysService
+import com.yinjie.heating.common.datas.ESKeys
+import com.dySweetFishPlugin.elasticsearch.ESClient
+import org.apache.logging.log4j.Logger
+import org.elasticsearch.action.ActionListener
+import org.elasticsearch.index.query.BoolQueryBuilder
+import org.elasticsearch.index.query.QueryBuilders
+import org.elasticsearch.index.reindex.BulkByScrollResponse
+import org.elasticsearch.index.reindex.UpdateByQueryAction
+import org.elasticsearch.script.Script
+import org.elasticsearch.script.ScriptType
+
+//系统群发消息过期, 系统启动后1分钟后执行一遍标记过期操作,然后每隔5分钟执行一次过期操作
+
+static def createRunnable(ESClient esClient, NoSqlKeysService keysService, Logger logger, long supplierCode) {
+    return {
+        //只有系统群发消息才有过期设置,点对点发的无此功能
+        long current = (new Date()).getTime()
+
+        String index = keysService.getESKey(ESKeys.ESERPSYSMSG_INDEX, supplierCode)
+        BoolQueryBuilder qb = QueryBuilders.boolQuery()
+        qb = qb.must(QueryBuilders.rangeQuery("expireTime").gte(current))
+                .must(QueryBuilders.termQuery("expireFlag", 0))
+                .must(QueryBuilders.typeQuery(ESKeys.ESERPDEFAULT_TYPE))
+
+        //批量更新
+        UpdateByQueryAction.INSTANCE.newRequestBuilder(esClient.getClient())
+                .refresh(true)
+                .abortOnVersionConflict(false)
+                .source(index)
+                .script(new Script(
+                        ScriptType.INLINE,
+                        "painless",
+                        "ctx._source.expireFlag = 1",
+                        Collections.emptyMap()
+                ))
+                .filter(qb)
+                .execute(new ActionListener<BulkByScrollResponse>() {
+                    //回调监听
+                    @Override
+                    public void onResponse(BulkByScrollResponse response) {
+                        if (response.getUpdated() > 0L) {
+                            logger.info("修改过期:" + response.getUpdated())
+                        }
+                    }
+
+                    @Override
+                    public void onFailure(Exception e) {
+                        // Handle the exception
+                        logger.error(e.getMessage(), e)
+                    }
+                })
+    } as Runnable
+}
+
+//groovy最后一个表达式的值为返回
+createRunnable(esClient, keysService, logger, supplierCode)
+
+
+

+ 10 - 0
conf/script/1000/init/Time_1_D_0_10_42_05_TestTime1.groovy

@@ -0,0 +1,10 @@
+import org.apache.logging.log4j.Logger
+
+static def createRunnable(Logger logger, String dataSourceId, long supplierCode) {
+    return {
+        logger.info("我是按天执行的脚本")
+    } as Runnable
+}
+
+//groovy最后一个表达式的值为返回
+createRunnable(logger, dataSourceId, supplierCode)

+ 11 - 0
conf/script/1000/init/Time_2_M_02_10_42_07_TestTime2.groovy

@@ -0,0 +1,11 @@
+import org.apache.logging.log4j.Logger
+
+static def createRunnable(Logger logger, String dataSourceId, long supplierCode) {
+    return {
+        logger.info("我是按月执行的脚本")
+    } as Runnable
+}
+
+//groovy最后一个表达式的值为返回
+createRunnable(logger, dataSourceId, supplierCode)
+

+ 219 - 0
conf/script/1000/sync/BE_BusinessOrder_SyncDataBase2ES.groovy

@@ -0,0 +1,219 @@
+import com.yinjie.heating.common.api.BusinessExecutor
+import com.yinjie.heating.common.api.SupplierInitService
+import com.yinjie.heating.common.datas.ERPModule
+import com.yinjie.heating.common.datas.ESKeys
+import com.yinjie.heating.common.entity.base.ProcessStringItem
+import com.yinjie.heating.common.entity.order.*
+import com.dySweetFishPlugin.elasticsearch.ESClient
+import com.dySweetFishPlugin.sql.DBService
+import com.sweetfish.convert.json.JsonConvert
+import com.sweetfish.service.RetResult
+import com.sweetfish.source.PageFlipper
+import com.sweetfish.util.Utility
+import org.apache.logging.log4j.LogManager
+import org.apache.logging.log4j.Logger
+import org.elasticsearch.action.bulk.BulkRequestBuilder
+import org.elasticsearch.action.bulk.BulkResponse
+import org.elasticsearch.action.index.IndexRequestBuilder
+import org.elasticsearch.action.support.WriteRequest
+import org.elasticsearch.common.xcontent.XContentType
+
+import javax.annotation.Resource
+
+@SuppressWarnings(["unused"])
+class BE_BusinessOrder_SyncDataBase2ES implements BusinessExecutor<ProcessStringItem, ProcessStringItem> {
+
+    protected final Logger logger = LogManager.getLogger(this.getClass().getSimpleName())
+
+
+    @Resource
+    SupplierInitService supplierService
+
+    @Resource
+    ESClient esClient
+
+    @Resource
+    JsonConvert jsonConvert
+
+    @Resource
+    DBService dbService
+
+    @Override
+    String scriptName() {
+        return "外卖订单-ES同步数据库"
+    }
+
+    @Override
+    ERPModule module() {
+        return ERPModule.DATA_SYNC
+    }
+
+    @Override
+    RetResult<ProcessStringItem> execute(ProcessStringItem source) {
+        String dataSourceId = source.getDataSourceId()
+        long supplierCode = source.getSupplierCode()
+
+        esClient.checkIndexEx(supplierService.getDateYearESIndex(supplierCode, ESKeys.ES_DELIVER_BUSINESS_ORDER_INDEX, 0),
+                ESKeys.INDEX_CONFIG,
+                Utility.ofMap(ESKeys.ES_DELIVER_BUSINESS_ORDER_TYPE, "businessorder.json",
+                        ESKeys.ES_DELIVER_ORDER_DELIVERY_INFO_TYPE, "orderdeliveryinfo.json",
+                        ESKeys.ES_DELIVER_ORDER_FINANCES_TYPE, "orderfinances.json",
+                        ESKeys.ES_DELIVER_ORDER_DISCOUNT_TYPE, "orderdiscount.json",
+                        ESKeys.ES_DELIVER_ORDER_DETAIL_ITEM_TYPE, "orderdetailitem.json",
+                        ESKeys.ES_DELIVER_ORDER_AFTER_SALE_BILL_TYPE, "orderaftersalebill.json",
+                        ESKeys.ES_DELIVER_ORDER_RIDER_ITEM_TYPE, "orderrideritem.json"))
+
+        ExecPageFlipper.execute(500, { PageFlipper p ->
+            List<BusinessOrder> dbList = dbService.<BusinessOrder> getList(dataSourceId, "select * from deBusinessOrder${supplierCode}_Current", BusinessOrder.class, p)
+            if (!dbList.isEmpty()) {
+                BulkRequestBuilder bulkRequest = esClient.getClient().prepareBulk().setRefreshPolicy(WriteRequest.RefreshPolicy.IMMEDIATE)
+
+                dbList.each { order ->
+                    IndexRequestBuilder esRequest = esClient.getClient()
+                            .prepareIndex(supplierService.getDateYearESIndex(source.supplierCode, ESKeys.ES_DELIVER_BUSINESS_ORDER_INDEX, 1), ESKeys.ES_DELIVER_BUSINESS_ORDER_TYPE)
+                            .setId(String.valueOf(order.id))
+                            .setSource(source.getConvert("BusinessOrder").convertTo(order), XContentType.JSON)
+                    bulkRequest.add(esRequest)
+                }
+
+                BulkResponse bulkResponse = bulkRequest.execute().actionGet()
+
+                if (bulkResponse.hasFailures()) {
+                    logger.error("索引订单:" + bulkResponse.buildFailureMessage())
+                } else {
+                    logger.info("索引订单共" + dbList.size() + "条记录")
+                }
+
+            }
+        })
+
+        ExecPageFlipper.execute(500, { PageFlipper p ->
+            List<OrderDetailItem> dbList = dbService.<OrderDetailItem> getList(dataSourceId, "select * from deOrderDetailItem${supplierCode}_Current", OrderDetailItem.class, p)
+            if (!dbList.isEmpty()) {
+                BulkRequestBuilder bulkRequest = esClient.getClient().prepareBulk().setRefreshPolicy(WriteRequest.RefreshPolicy.IMMEDIATE)
+
+                dbList.each { info ->
+                    IndexRequestBuilder esRequest = esClient.getClient()
+                            .prepareIndex(supplierService.getDateYearESIndex(source.supplierCode, ESKeys.ES_DELIVER_BUSINESS_ORDER_INDEX, 1), ESKeys.ES_DELIVER_ORDER_DETAIL_ITEM_TYPE)
+                            .setParent(String.valueOf(info.idOrder))
+                            .setId(String.valueOf(info.id))
+                            .setSource(jsonConvert.convertTo(info), XContentType.JSON)
+                    bulkRequest.add(esRequest)
+                }
+
+                BulkResponse bulkResponse = bulkRequest.execute().actionGet()
+
+                if (bulkResponse.hasFailures()) {
+                    logger.error("索引订单detailItem:" + bulkResponse.buildFailureMessage())
+                } else {
+                    logger.info("索引订单共detailItem" + dbList.size() + "条记录")
+                }
+
+            }
+        })
+
+        ExecPageFlipper.execute(500, { PageFlipper p ->
+            List<OrderDeliveryInfo> dbList = dbService.<OrderDeliveryInfo> getList(dataSourceId, "select * from deOrderDeliveryInfo${supplierCode}_Current", OrderDeliveryInfo.class, p)
+            if (!dbList.isEmpty()) {
+                BulkRequestBuilder bulkRequest = esClient.getClient().prepareBulk().setRefreshPolicy(WriteRequest.RefreshPolicy.IMMEDIATE)
+
+                dbList.each { info ->
+                    IndexRequestBuilder esRequest = esClient.getClient()
+                            .prepareIndex(supplierService.getDateYearESIndex(source.supplierCode, ESKeys.ES_DELIVER_BUSINESS_ORDER_INDEX, 1), ESKeys.ES_DELIVER_ORDER_DELIVERY_INFO_TYPE)
+                            .setParent(String.valueOf(info.idOrder))
+                            .setId(String.valueOf(info.id))
+                            .setSource(jsonConvert.convertTo(info), XContentType.JSON)
+                    bulkRequest.add(esRequest)
+                }
+
+                BulkResponse bulkResponse = bulkRequest.execute().actionGet()
+
+                if (bulkResponse.hasFailures()) {
+                    logger.error("索引订单DeliveryInfo:" + bulkResponse.buildFailureMessage())
+                } else {
+                    logger.info("索引订单共DeliveryInfo" + dbList.size() + "条记录")
+                }
+
+            }
+        })
+
+        ExecPageFlipper.execute(500, { PageFlipper p ->
+            List<OrderFinances> dbList = dbService.<OrderFinances> getList(dataSourceId, "select * from deOrderFinances${supplierCode}_Current", OrderFinances.class, p)
+            if (!dbList.isEmpty()) {
+                BulkRequestBuilder bulkRequest = esClient.getClient().prepareBulk().setRefreshPolicy(WriteRequest.RefreshPolicy.IMMEDIATE)
+
+                dbList.each { info ->
+                    IndexRequestBuilder esRequest = esClient.getClient()
+                            .prepareIndex(supplierService.getDateYearESIndex(source.supplierCode, ESKeys.ES_DELIVER_BUSINESS_ORDER_INDEX, 1), ESKeys.ES_DELIVER_ORDER_FINANCES_TYPE)
+                            .setParent(String.valueOf(info.idOrder))
+                            .setId(String.valueOf(info.id))
+                            .setSource(jsonConvert.convertTo(info), XContentType.JSON)
+                    bulkRequest.add(esRequest)
+                }
+
+                BulkResponse bulkResponse = bulkRequest.execute().actionGet()
+
+                if (bulkResponse.hasFailures()) {
+                    logger.error("索引订单OrderFinances:" + bulkResponse.buildFailureMessage())
+                } else {
+                    logger.info("索引订单共OrderFinances" + dbList.size() + "条记录")
+                }
+
+            }
+        })
+
+        ExecPageFlipper.execute(500, { PageFlipper p ->
+            List<OrderDiscount> dbList = dbService.<OrderDiscount> getList(dataSourceId, "select * from deOrderDiscount${supplierCode}_Current", OrderDiscount.class, p)
+            if (!dbList.isEmpty()) {
+                BulkRequestBuilder bulkRequest = esClient.getClient().prepareBulk().setRefreshPolicy(WriteRequest.RefreshPolicy.IMMEDIATE)
+
+                dbList.each { info ->
+                    IndexRequestBuilder esRequest = esClient.getClient()
+                            .prepareIndex(supplierService.getDateYearESIndex(source.supplierCode, ESKeys.ES_DELIVER_BUSINESS_ORDER_INDEX, 1), ESKeys.ES_DELIVER_ORDER_DISCOUNT_TYPE)
+                            .setParent(String.valueOf(info.idOrder))
+                            .setId(String.valueOf(info.id))
+                            .setSource(jsonConvert.convertTo(info), XContentType.JSON)
+                    bulkRequest.add(esRequest)
+                }
+
+                BulkResponse bulkResponse = bulkRequest.execute().actionGet()
+
+                if (bulkResponse.hasFailures()) {
+                    logger.error("索引订单OrderDiscount:" + bulkResponse.buildFailureMessage())
+                } else {
+                    logger.info("索引订单OrderDiscount共" + dbList.size() + "条记录")
+                }
+
+            }
+        })
+
+        ExecPageFlipper.execute(500, { PageFlipper p ->
+            List<OrderRiderItem> dbList = dbService.<OrderRiderItem> getList(dataSourceId, "select * from deOrderRiderItem${supplierCode}_Current", OrderRiderItem.class, p)
+            if (!dbList.isEmpty()) {
+                BulkRequestBuilder bulkRequest = esClient.getClient().prepareBulk().setRefreshPolicy(WriteRequest.RefreshPolicy.IMMEDIATE)
+
+                dbList.each { info ->
+                    IndexRequestBuilder esRequest = esClient.getClient()
+                            .prepareIndex(supplierService.getDateYearESIndex(source.supplierCode, ESKeys.ES_DELIVER_BUSINESS_ORDER_INDEX, 1), ESKeys.ES_DELIVER_ORDER_RIDER_ITEM_TYPE)
+                            .setParent(String.valueOf(info.idOrder))
+                            .setId(String.valueOf(info.id))
+                            .setSource(jsonConvert.convertTo(info), XContentType.JSON)
+                    bulkRequest.add(esRequest)
+                }
+
+                BulkResponse bulkResponse = bulkRequest.execute().actionGet()
+
+                if (bulkResponse.hasFailures()) {
+                    logger.error("索引订单OrderRiderItem:" + bulkResponse.buildFailureMessage())
+                } else {
+                    logger.info("索引订单共OrderRiderItem" + dbList.size() + "条记录")
+                }
+
+            }
+        })
+
+        return RetResult.successT()
+    }
+}
+
+

+ 175 - 0
conf/sqlroot/com/yinjie/heating/business/dao/ClientDao.dql

@@ -0,0 +1,175 @@
+-- [queryClientIndustry]
+select * from $table$;
+
+-- [addClientIndustry]
+insert into $table$ (id, industryCode, industryName, enable,
+                                  createBy, createTime,
+                                  updateBy, updateTime ) values ( #{id}, #{industrycode}, #{industryname}, #{enable},
+#{createby}, #{createtime},
+#{updateby}, #{updatetime} );
+
+-- [updateClientIndustry]
+update $table$ set industryCode = #{industrycode},industryName = #{industryname},
+ updateBy = #{updateby},updateTime = #{updatetime} where id = #{id};
+
+-- [enableClientIndustry]
+update $table$ set enable = #{enable},updateBy = #{updateby},updateTime = #{updatetime} where id = #{id};
+
+-- [queryClientInfo]
+select * from $table$;
+
+-- [addClientInfo]
+insert into $table$ (
+id, idIndustry, industryName, clientName,
+contactMan, contactPhone, clientCode,
+province, city, area,
+address, clientFrom, overdraftQuota,
+idLevel, levelName, idSalesManBelong, salesManNameBelong,
+enable, createBy, createTime,
+updateBy, updateTime,
+invoiceHead,taxRegisterCode,baseBankName,
+baseBankNumber,registerAddress,registerPhone,
+signKey,dutyMan,againstFlag)
+values ( #{id}, #{idindustry}, #{industryname}, #{clientname},
+#{contactman}, #{contactphone}, #{clientcode},
+#{province}, #{city}, #{area},
+#{address}, #{clientfrom}, #{overdraftquota},
+#{idlevel}, #{levelname}, #{idsalesmanbelong}, #{salesmannamebelong},
+#{enable}, #{createby}, #{createtime},
+#{updateby}, #{updatetime},
+#{invoicehead},#{taxregistercode},#{basebankname},
+#{basebanknumber}, #{registeraddress}, #{registerphone},
+#{signkey},#{dutyman},#{againstflag});
+
+-- [updateClientInfo]
+update $table$ set
+idIndustry = #{idindustry},
+industryName = #{industryname},
+clientName = #{clientname},
+contactMan = #{contactman},
+contactPhone = #{contactphone},
+province = #{province},
+city = #{city},
+area = #{area},
+address = #{address},
+clientFrom = #{clientfrom},
+overdraftQuota = #{overdraftquota},
+idLevel = #{idlevel},
+levelName = #{levelname},
+idSalesManBelong = #{idsalesmanbelong},
+salesManNameBelong = #{salesmannamebelong},
+updateBy = #{updateby},
+updateTime = #{updatetime},
+invoiceHead = #{invoicehead},
+taxRegisterCode=#{taxregistercode},
+baseBankName=#{basebankname},
+baseBankNumber = #{basebanknumber},
+registerAddress= #{registeraddress},
+registerPhone=#{registerphone},
+signKey = #{signkey},
+dutyMan = #{dutyman},
+againstFlag = #{againstflag}
+where id = #{id};
+
+-- [enableClientInfo]
+update $table$ set enable = #{enable},
+updateBy = #{updateby},updateTime = #{updatetime}
+where id = #{id};
+
+-- [queryClientByBalance]
+select round(a.balanceNum / 100.0, 2) as balance_money, b.id, b.clientCode, b.clientName
+from $table1$ a
+left join $table2$ b on a.idClient = b.id
+-- trim prefix=WHERE prefixOverrides=AND|OR
+  -- if filterZeroBalance > 0
+    a.balanceNum > 0
+  -- end
+  -- isNotEmpty keyWord
+    and b.clientName LIKE #{Like:keyWord}
+  -- end
+-- end
+-- isEmpty orderBy
+order by b.createTime desc
+-- else
+order by #{orderBy}
+-- end
+;
+
+-- [sumAllClientBalance]
+select 0 as idClient,sum(balanceNum) as balanceNum from $table1$ a left join $table2$ b on a.idClient = b.id where b.enable = 1;
+
+-- [queryClientByBalanceVersion2]
+select round(b.balanceNum / 100.0, 2) as balance_money, a.id, a.clientCode, a.clientName,c.totalChargeMoney
+from $table2$ a
+left join $table1$ b on a.id = b.idClient
+left join $table3$ c on a.id = c.idClient
+-- trim prefix=WHERE prefixOverrides=AND|OR
+  -- if filterZeroBalance > 0
+    b.balanceNum > 0
+  -- end
+  -- if filterZeroChargeMoney > 0
+      c.totalChargeMoney > 0
+    -- end
+  -- isNotEmpty keyWord
+    and a.clientName LIKE #{Like:keyWord}
+  -- end
+-- end
+-- isEmpty orderBy
+order by a.createTime desc
+-- else
+order by #{orderBy}
+-- end
+;
+
+-- [queryClientLevel]
+select * from $table$;
+
+-- [addClientLevel]
+insert into $table$ (id, levelName, enable,levelValue,
+                     createBy, createTime, updateBy,updateTime)
+                     values (#{id}, #{levelname}, #{enable}, #{levelvalue},
+                     #{createby},#{createtime}, #{updateby},#{updatetime} );
+
+-- [updateClientLevel]
+update $table$ set levelName = #{levelname},levelValue = #{levelvalue},updateBy = #{updateby},updateTime = #{updatetime}
+where id = #{id};
+
+-- [enableClientLevel]
+update $table$ set enable = #{enable},updateBy = #{updateby},updateTime = #{updatetime}
+where id = #{id};
+
+-- [queryClientReceiveAddress]
+select * from $table$;
+
+-- [addClientReceiveAddress]
+insert into $table$ (id, idClient, receiveMan, receivePhone, idShipMode,
+                     shipModeName,idShipArea, shipArea, province, city,
+                     area, address, coordinate, defaultFlag, shipOrLogistics,
+                     createBy, createTime,
+                     updateBy, updateTime ) values ( #{id}, #{idclient}, #{receiveman}, #{receivephone}, #{idshipmode},
+#{shipmodename}, #{idshiparea}, #{shiparea}, #{province}, #{city},
+#{area}, #{address}, #{coordinate}, #{defaultflag}, #{shiporlogistics},
+#{createby}, #{createtime},
+#{updateby}, #{updatetime} );
+
+-- [updateClientReceiveAddress]
+update $table$ set receiveMan = #{receiveman},receivePhone = #{receivephone},idShipMode = #{idshipmode},shipModeName = #{shipmodename},
+       idShipArea = #{idshiparea}, shipArea = #{shiparea}, province = #{province},city = #{city},area = #{area},address = #{address}, coordinate=#{coordinate},
+       shipOrLogistics = #{shiporlogistics},
+updateBy = #{updateby},updateTime = #{updatetime} where id = #{id};
+
+-- [defaultClientReceiveAddress]
+update $table$ set defaultFlag = 1,
+updateBy = #{updateby},updateTime = #{updatetime}
+where id = #{id};
+
+-- [unDefaultClientReceiveAddress]
+update $table$ set defaultFlag = 0,
+updateBy = #{updateby},updateTime = #{updatetime}
+where id != #{id} and idClient=#{idclient};
+
+-- [deleteClientReceiveAddress]
+delete from $table$ where id = #{id};
+
+-- [deleteClientReceiveAddressByClient]
+delete from $table$ where idClient = #{id};

+ 194 - 0
conf/sqlroot/com/yinjie/heating/business/dao/DocDao.dql

@@ -0,0 +1,194 @@
+-- [selectBusinessScript]
+select *
+from $table$
+-- trim prefix=WHERE prefixOverrides=AND|OR
+  -- isNotEmpty voidFlag
+  -- if voidFlag >= 0
+    voidFlag = #{voidFlag}
+  -- end
+  -- end
+  -- isNotEmpty keyWord
+    and (businessName LIKE #{Like:keyWord} or businessCode LIKE #{Like:keyWord})
+  -- end
+  -- isNotEmpty businessName
+    and businessName LIKE #{Like:businessName}
+  -- end
+  -- isNotEmpty businessCode
+    and businessCode LIKE #{Like:businessCode}
+  -- end
+  -- isNotEmpty businessModule
+  -- if businessModule >= 0
+    and businessModule = #{businessModule}
+  -- end
+  -- end
+-- end
+-- isEmpty orderBy
+order by businessModule asc, createTime desc
+-- else
+order by #{orderBy}
+-- end
+;
+
+-- [addBusinessScript]
+insert into $table$
+(id, businessName, businessCode,
+voidFlag, businessModule, systemFlag,
+createBy, createTime,
+updateBy, updateTime)
+values (
+#{id}, #{businessname}, #{businesscode},
+#{voidflag}, #{businessmodule}, #{systemflag},
+#{createby}, #{createtime}, #{updateby},
+#{updatetime}
+);
+
+-- [updateBusinessScript]
+update $table$ set
+businessName = #{businessname},
+updateBy = #{updateby},
+updateTime = #{updatetime}
+where id = #{id};
+
+-- [voidBusinessScript]
+update $table$ set
+voidFlag = #{voidflag},
+updateBy = #{updateby},
+updateTime = #{updatetime}
+where id = #{id};
+
+
+-- [selectInquireMainInfo]
+select * from $table$;
+
+-- [addInquireMainInfo]
+       insert into $table$ (id, inquireName, inquireFuncName, inquireType, canExport, queryInPage,
+       voidFlag, createBy, createTime,
+       updateBy, updateTime ) values ( #{id}, #{inquirename}, #{inquirefuncname}, #{inquiretype}, #{canexport}, #{queryinpage},
+#{voidflag}, #{createby}, #{createtime},
+#{updateby}, #{updatetime} );
+
+-- [updateInquireMainInfo]
+       update $table$ set inquireName = #{inquirename},inquireType = #{inquiretype}, canExport = #{canexport}, queryInPage = #{queryinpage},
+       updateBy = #{updateby},
+       updateTime = #{updatetime} where id = #{id};
+
+-- [voidInquireMainInfo]
+       update $table$ set voidFlag = #{voidflag},
+       updateBy = #{updateby},
+       updateTime = #{updatetime} where id = #{id};
+
+
+-- [selectInquireResultColumn]
+select * from $table$
+-- trim prefix=WHERE prefixOverrides=AND|OR
+   -- if idInquire > 0
+       idInquire = #{idInquire}
+   -- end
+-- end
+;
+
+-- [addInquireResultColumn]
+insert into $table$ (id, idInquire, idParentColumn, columnName,
+                     columnField, columnWidth, visible,
+                     hasStatistics, statisticsFormat, linkUrl,
+                     sortAsc, createBy, createTime,
+                     updateBy, updateTime ) values ( #{id}, #{idinquire}, #{idparentcolumn}, #{columnname},
+                                               #{columnfield}, #{columnwidth}, #{visible},
+                                               #{hasstatistics}, #{statisticsformat}, #{linkurl},
+                                               #{sortasc}, #{createby}, #{createtime},
+                                               #{updateby}, #{updatetime} );
+
+-- [updateInquireResultColumn]
+       update $table$ set columnName = #{columnname},columnField = #{columnfield},columnWidth = #{columnwidth},
+       visible = #{visible},hasStatistics = #{hasstatistics},statisticsFormat = #{statisticsformat}, linkUrl = #{linkurl}, sortAsc = #{sortasc},
+       updateBy = #{updateby},
+       updateTime = #{updatetime} where id = #{id};
+
+-- [deleteInquireResultColumn]
+        delete from $table$ where id = #{id};
+
+
+-- [selectInquireCondition]
+select * from $table$
+-- trim prefix=WHERE prefixOverrides=AND|OR
+   -- if idInquire > 0
+       idInquire = #{idInquire}
+   -- end
+-- end
+;
+
+-- [addInquireCondition]
+       insert into $table$ (id, idInquire, conditionName, conditionField,
+       dataType, defaultValue, visible,
+       selectDicType, sortAsc, createBy,
+       createTime,  updateBy,
+       updateTime ) values ( #{id}, #{idinquire}, #{conditionname}, #{conditionfield},
+#{datatype}, #{defaultvalue}, #{visible},
+#{selectdictype}, #{sortasc}, #{createby},
+#{createtime},  #{updateby},
+#{updatetime} );
+
+-- [updateInquireCondition]
+       update $table$ set conditionName = #{conditionname},conditionField = #{conditionfield},dataType = #{datatype},
+       defaultValue = #{defaultvalue},visible = #{visible},selectDicType = #{selectdictype},sortAsc = #{sortasc},
+       updateBy = #{updateby},
+       updateTime = #{updatetime} where id = #{id};
+
+-- [deleteInquireCondition]
+       delete from $table$ where id = #{id};
+
+-- [deleteInquireResultColumnByMain]
+    delete from $table$ where idInquire = #{id};
+
+-- [deleteInquireConditionByMain]
+       delete from $table$ where idInquire = #{id};
+
+
+-- [selectCompanyInfo]
+select *
+from $table$
+-- trim prefix=WHERE prefixOverrides=AND|OR
+  -- if voidFlag >= 0
+    voidFlag = #{voidFlag}
+  -- end
+  -- isNotEmpty keyWord
+    and (companyName LIKE #{Like:keyWord} or linkMan LIKE #{Like:keyWord})
+  -- end
+-- end
+-- isEmpty orderBy
+order by createTime desc
+-- else
+order by #{orderBy}
+-- end;
+
+-- [addCompanyInfo]
+insert into $table$ (
+id, companyName, address, linkMan,
+linkPhone, voidFlag, createBy,
+createTime, createTimeLong, updateBy,
+updateTime, updateTimeLong )
+values (
+#{id}, #{companyname}, #{address}, #{linkman},
+#{linkphone}, #{voidflag}, #{createby},
+#{createtime}, #{createtimelong}, #{updateby},
+#{updatetime}, #{updatetimelong}
+);
+
+-- [updateCompanyInfo]
+update $table$ set
+companyName = #{companyname},
+address = #{address},
+linkMan = #{linkman},
+linkPhone = #{linkphone},
+updateBy = #{updateby},
+updateTime = #{updatetime},
+updateTimeLong = #{updatetimelong}
+where id = #{id};
+
+-- [voidCompanyInfo]
+update $table$ set
+voidFlag = #{voidflag},
+updateBy = #{updateby},
+updateTime = #{updatetime},
+updateTimeLong = #{updatetimelong}
+where id = #{id};

+ 16 - 0
conf/sqlroot/com/yinjie/heating/business/dao/LoginDao.dql

@@ -0,0 +1,16 @@
+-- [login]
+SELECT
+  id, loginName, userName,
+  companyId, deptId, userType,
+  email, phonenumber, sex,
+  avatar, status, delFlag,
+  remark, postIds
+FROM $table$
+WHERE loginName = #{loginName} AND password = #{password};
+
+
+-- [storeLogin]
+SELECT
+ *
+FROM $table$
+WHERE loginAccount = #{loginName} AND loginPass = #{password};

+ 36 - 0
conf/sqlroot/com/yinjie/heating/business/dao/SupplierDao.dql

@@ -0,0 +1,36 @@
+-- [addOutSupplierInfo]
+insert into $table$ (id,supplierName,supplierCode, supplierKind, supplierType,
+supplierContent, factoryAddress, createMan,
+settleKind, remark, shortPinyin,
+principal, linkMan,
+linkPhone, voidFlag, createBy,
+createTime, updateBy,
+updateTime) values ( #{id},#{suppliername}, #{suppliercode}, #{supplierkind}, #{suppliertype},
+#{suppliercontent}, #{factoryaddress}, #{createman},
+#{settlekind}, #{remark}, #{shortpinyin},
+#{principal}, #{linkman},
+#{linkphone}, #{voidflag}, #{createby},
+#{createtime}, #{updateby},
+#{updatetime});
+
+
+-- [updateSupplierInfo]
+update $table$ set supplierCode = #{suppliercode},
+supplierName = #{suppliername}, supplierKind = #{supplierkind},
+supplierType = #{suppliertype},supplierContent = #{suppliercontent},
+factoryAddress = #{factoryaddress},createMan = #{createman},settleKind = #{settlekind},remark = #{remark},
+shortPinyin = #{shortpinyin},principal = #{principal},linkMan = #{linkman},
+linkPhone = #{linkphone},voidFlag = #{voidflag},createBy = #{createby},createTime = #{createtime},
+updateBy = #{updateby},updateTime = #{updatetime}
+ where id = #{id};
+
+
+-- [voidSupplierInfo]
+update $table$ set
+voidFlag = #{voidflag},
+updateBy = #{updateby},
+updateTime = #{updatetime}
+where id = #{id};
+
+-- [querySupplierInfo]
+select * from $table$;

+ 608 - 0
conf/sqlroot/com/yinjie/heating/business/dao/SystemDao.dql

@@ -0,0 +1,608 @@
+-- [login]
+SELECT
+  id, loginName, userName,
+  companyId, deptId, userType,
+  email, phonenumber, sex,
+  avatar, status, delFlag,
+  remark, postIds
+FROM $table$
+WHERE loginName = #{loginName} AND password = #{password};
+
+
+-- [queryLoginUsers]
+select a.id, a.companyId, a.deptId, a.loginName,
+       a.userName, a.userType, a.email, a.phoneNumber,
+       a.sex, a.avatar, a.status, a.delFlag,
+       a.createBy, a.createTime, a.updateBy,
+       a.updateTime, a.remark, a.postIds, b.deptName
+from $table1$ a
+         left join $table2$ b on a.deptId = b.id
+-- trim prefix=WHERE prefixOverrides=AND|OR
+  -- if deptId > 0
+    and a.deptId = #{deptId}
+  -- end
+  -- if status >= 0
+    and a.status = #{status}
+  -- end
+  -- isNotEmpty keyWord
+    and (a.loginName LIKE #{Like:keyWord} or a.userName LIKE #{Like:keyWord})
+  -- end
+  -- isNotEmpty loginName
+    and a.loginName LIKE #{Like:loginName}
+  -- end
+  -- isNotEmpty phone
+    and a.phoneNumber LIKE #{Like:phoneNumber}
+  -- end
+  -- isNotEmpty beginTime
+    and a.createTime >= #{beginTime}
+  -- end
+  -- isNotEmpty endTime
+    and a.createTime <= #{endTime}
+  -- end
+-- end
+-- isEmpty orderBy
+order by createTime desc
+-- else
+order by #{orderBy}
+-- end
+;
+
+-- [getUserInfo]
+SELECT
+  id, loginName, userName,
+  companyId, deptId, userType,
+  email, phonenumber, sex,
+  avatar, status, delFlag,
+  remark, postIds
+FROM $table$
+WHERE id = #{id};
+
+-- [accountExists]
+SELECT count(id)
+FROM $table$
+WHERE loginName = #{loginName};
+
+-- [insertLoginUser]
+insert into $table$ (
+id, companyId, deptId,
+loginName, userName, userType,
+email, phonenumber, sex,
+avatar, password, salt,
+status, createBy,
+createTime, updateBy, updateTime,
+remark, postIds)
+values (
+#{id}, #{companyid}, #{deptid},
+#{loginname}, #{username}, #{usertype},
+#{email}, #{phonenumber}, #{sex},
+#{avatar}, #{password}, #{salt},
+#{status}, #{createby},
+#{createtime}, #{updateby}, #{updatetime},
+#{remark}, #{postids}
+);
+
+-- [insertUserRole]
+insert into $table$ (userId, roleId)
+VALUES (#{userid}, #{roleid});
+
+-- [clearUserRole]
+delete from $table$ where userId = #{userId};
+
+-- [updateLoginUser]
+update $table$ set
+deptId = #{deptid},
+userName = #{username},
+email = #{email},
+phonenumber = #{phonenumber},
+sex = #{sex},
+updateBy = #{updateby},
+updateTime = #{updatetime},
+remark = #{remark},
+postIds = #{postids}
+where id = #{id};
+
+-- [voidLoginUser]
+update $table$ set
+status = #{status}
+where id = #{id};
+
+-- [resetLoginUser]
+update $table$ set
+password = #{password}
+where id = #{id};
+
+-- [changeMyPassword]
+UPDATE $table$ SET
+password = #{password}
+WHERE id = #{id};
+
+
+-- [queryAllMenus]
+select *
+from $table$
+-- isEmpty orderBy
+order by parentId, sortNum
+-- else
+order by #{orderBy}
+-- end
+;
+
+-- [queryAllRoles]
+select *
+from $table$
+-- trim prefix=WHERE prefixOverrides=AND|OR
+  -- isNotEmpty roleName
+    roleName LIKE #{Like:roleName}
+  -- end
+  -- if status >= 0
+    and status = #{status}
+  -- end
+-- end
+-- isEmpty orderBy
+order by sortNum
+-- else
+order by #{orderBy}
+-- end
+;
+
+-- [insertRole]
+insert into $table$
+(id, roleName,
+ sortNum, status, createBy,
+ createTime, updateBy, updateTime,
+ remark, systemFlag)
+VALUES (
+  #{id}, #{rolename},
+  #{sortnum}, #{status}, #{createby},
+  #{createtime}, #{updateby}, #{updatetime},
+  #{remark}, #{systemflag}
+);
+
+-- [updateRole]
+update $table$ set
+  roleName = #{rolename},
+  sortNum = #{sortnum},
+  updateBy = #{updateby},
+  updateTime = #{updatetime},
+  remark = #{remark}
+where id = #{id};
+
+-- [voidRole]
+update $table$ set
+  status = #{status}
+where id = #{id};
+
+-- [insertRoleMenu]
+insert into $table$ (roleId, menuId) VALUES (#{roleid}, #{menuid});
+
+-- [clearRoleMenu]
+delete from $table$ where roleId = #{roleId};
+
+-- [queryRoleMenus]
+select a.*, b.perms as menuperms, b.menuType, b.parentId from $table1$ a
+  left join $table2$ b on a.menuId = b.id
+where a.roleId= #{roleId} and b.menuType in ('M', 'C');
+
+-- [queryRoleActions]
+select a.*, b.perms as menuperms, b.menuType, b.parentId from $table1$ a
+  left join $table2$ b on a.menuId = b.id
+where a.roleId= #{roleId};
+
+-- [queryUserRoles]
+select userId,roleId from $table$ WHERE userId = #{userid};
+
+-- [queryMenuRoles]
+select b.id, b.roleName, b.roleKey, b.sortNum, b.remark
+from $table1$ a
+left join $table2$ b on a.roleId = b.id
+where a.menuId = #{menuId}
+order by b.sortNum;
+
+-- [queryRoleUsers]
+select b.id, b.companyId, b.deptId, b.loginName, b.userName, b.email, b.phonenumber, b.status
+from $table1$ a
+left join $table2$ b on a.userId = b.id
+where a.roleId = #{roleId}
+order by b.id;
+
+--[queryAllDepts]
+select * from $table$
+
+--[addDept]
+insert into $table$ (id, parentId, deptName, deptCode,
+sortNum, leader, phone,
+email, status, parentName,
+createBy, createTime, createTimeLong,
+updateBy, updateTime, updateTimeLong ) values ( #{id}, #{parentid}, #{deptname}, #{deptcode},
+#{sortnum}, #{leader}, #{phone},
+#{email}, #{status}, #{parentname},
+#{createby}, #{createtime},
+#{createtimelong}, #{updateby}, #{updatetime},
+#{updatetimelong} );
+
+-- [updateDept]
+update $table$ set parentId = #{parentid},deptName = #{deptname},deptCode = #{deptcode},sortNum = #{sortnum},
+leader = #{leader},phone = #{phone},email = #{email},status = #{status},
+parentName = #{parentname},
+updateBy = #{updateby},updateTime = #{updatetime},updateTimeLong = #{updatetimelong}
+ where id = #{id};
+
+-- [voidDept]
+update $table$ set
+  status = #{status},
+  updateBy = #{updateby},
+  updateTime = #{updatetime}
+where id=#{id};
+
+-- [insertMenu]
+insert into $table$
+(id, menuName, parentId,
+ sortNum, url, menuType,
+ visible, cacheFlag, perms, icon,
+ createBy, createTime, updateBy,
+ updateTime, remark,
+ route, pathName,
+ runKind, delphiPackage, delphiParams,
+ delphiRunKind, delphiRunForm, delphiFormShow)
+values (
+  #{id}, #{menuname}, #{parentid},
+  #{sortnum}, #{url}, #{menutype},
+  #{visible}, #{cacheflag}, #{perms}, #{icon},
+  #{createby}, #{createtime}, #{updateby},
+  #{updatetime}, #{remark},
+  #{route}, #{pathname},
+  #{runkind}, #{delphipackage}, #{delphiparams},
+  #{delphirunkind}, #{delphirunform}, #{delphiformshow}
+);
+
+-- [updateMenu]
+update $table$ set
+  menuName = #{menuname},
+  parentId = #{parentid},
+  sortNum = #{sortnum},
+  url = #{url},
+  menuType = #{menutype},
+  perms = #{perms},
+  icon = #{icon},
+  updateBy = #{updateby},
+  updateTime = #{updatetime},
+  remark = #{remark},
+  cacheFlag = #{cacheflag},
+  route = #{route},
+  pathName = #{pathname},
+  runKind = #{runkind},
+  delphiPackage = #{delphipackage},
+  delphiParams = #{delphiparams},
+  delphiRunKind = #{delphirunkind},
+  delphiRunForm = #{delphirunform},
+  delphiFormShow = #{delphiformshow}
+where id = #{id};
+
+-- [voidMenu]
+update $table$ set
+  visible = #{visible},
+  updateBy = #{updateby},
+  updateTime = #{updatetime}
+where id = #{id};
+
+
+-- [insertERPFile]
+insert into $table$
+(idUser, userName, fileKind,
+srcFileName, fileDescription, downloadUrl,
+createBy, createTime, createTimeLong,
+updateBy, updateTime, updateTimeLong )
+values (#{iduser}, #{username}, #{filekind},
+#{srcfilename}, #{filedescription}, #{downloadurl},
+#{createby}, #{createtime}, #{createtimelong},
+#{updateby}, #{updatetime}, #{updatetimelong} );
+
+-- [queryAllConfig]
+select * from $table$;
+
+-- [queryConfig]
+select * from $table$
+where configKey = #{configKey};
+
+-- [insertConfigValue]
+insert into $table$
+(configKey, configName, configValue1,
+ configValue2, configValue3, configType,
+ remark)
+VALUES (
+  #{configkey}, #{configname}, #{configvalue1},
+  #{configvalue2}, #{configvalue3}, #{configtype},
+  #{remark}
+);
+
+-- [updateConfigValue]
+update $table$ set
+  configName = #{configname},
+  configModule = #{configmodule},
+  configValue1 = #{configvalue1},
+  configValue2 = #{configvalue2},
+  configValue3 = #{configvalue3},
+  remark = #{remark}
+where configKey = #{configkey};
+
+-- [updateOnlyConfigValue]
+update $table$ set
+configValue1 = #{configvalue1}
+where configKey = #{configkey};
+
+-- [deleteConfigValue]
+delete from $table$
+where configKey = #{configkey};
+
+-- [queryDictTypes]
+select *
+from $table$
+-- trim prefix=WHERE prefixOverrides=AND|OR
+  -- if voidFlag >= 0
+    voidFlag = #{voidFlag}
+  -- end
+  -- isNotEmpty keyWord
+    and (dictName LIKE #{Like:keyWord} or dictType LIKE #{Like:keyWord})
+  -- end
+-- end
+-- isEmpty orderBy
+order by createTime desc
+-- else
+order by #{orderBy}
+-- end
+;
+
+-- [addDictType]
+insert into $table$
+(id, dictName, dictType,
+voidFlag, remark, createBy,
+createTime, updateBy, updateTime)
+values (
+#{id}, #{dictname}, #{dicttype},
+#{voidflag}, #{remark}, #{createby},
+#{createtime}, #{updateby}, #{updatetime}
+);
+
+-- [updateDictType]
+update $table$ set
+dictName = #{dictname},
+dictType = #{dicttype},
+remark = #{remark},
+updateBy = #{updateby},
+updateTime = #{updatetime}
+where id = #{id};
+
+-- [voidDictType]
+update $table$ set
+voidFlag = #{voidflag},
+updateBy = #{updateby},
+updateTime = #{updatetime}
+where id = #{id};
+
+-- [queryDictDatas]
+select *
+from $table$
+-- trim prefix=WHERE prefixOverrides=AND|OR
+  -- if idType >= 0
+    idType = #{idType}
+  -- end
+  -- if voidFlag >= 0
+    voidFlag = #{voidFlag}
+  -- end
+  -- isNotEmpty dictLabel
+    and dictLabel LIKE #{Like:dictLabel}
+  -- end
+-- end
+-- isEmpty orderBy
+order by sortNum desc
+-- else
+order by #{orderBy}
+-- end
+;
+
+-- [addDictData]
+insert into $table$
+(id, idType, dictLabel,
+dictValue, sortNum, cssClass,
+listClass, voidFlag, remark,
+createBy, createTime, updateBy,
+updateTime)
+values (
+#{id}, #{idtype}, #{dictlabel},
+#{dictvalue}, #{sortnum}, #{cssclass},
+#{listclass}, #{voidflag}, #{remark},
+#{createby}, #{createtime}, #{updateby},
+#{updatetime}
+);
+
+-- [updateDictData]
+update $table$ set
+dictLabel = #{dictlabel},
+dictValue = #{dictvalue},
+sortNum = #{sortnum},
+cssClass = #{cssclass},
+listClass = #{listclass},
+remark = #{remark},
+updateBy = #{updateby},
+updateTime = #{updatetime}
+where id = #{id};
+
+-- [voidDictData]
+update $table$ set
+voidFlag = #{voidflag},
+updateBy = #{updateby},
+updateTime = #{updatetime}
+where id = #{id};
+
+-- [selectAllNoticeMessage]
+select * from $table$;
+
+-- [addNoticeMessage]
+insert into $table$ (
+id, messageCode, messageName, messageKind,
+voidFlag, createBy, createTime,
+createTimeLong, updateBy, updateTime,
+updateTimeLong )
+values (
+#{id}, #{messagecode}, #{messagename}, #{messagekind},
+#{voidflag}, #{createby}, #{createtime},
+#{createtimelong}, #{updateby}, #{updatetime},
+#{updatetimelong} );
+
+-- [updateNoticeMessage]
+update $table$ set
+messageName = #{messagename},
+messageKind = #{messagekind},
+updateBy = #{updateby},
+updateTime = #{updatetime},
+updateTimeLong = #{updatetimelong}
+where id = #{id};
+
+-- [voidNoticeMessage]
+update $table$ set
+voidFlag = #{voidflag},
+updateBy = #{updateby},
+updateTime = #{updatetime},
+updateTimeLong = #{updatetimelong}
+where id = #{id};
+
+-- [selectUserNoticeMessage]
+SELECT a.*, b.messageCode FROM $table1$ a
+LEFT JOIN $table2$ b ON a.idNoticeMessage = b.id;
+
+-- [addUserNoticeMessage]
+insert into $table$ (
+id, idUser,
+idNoticeMessage, createBy, createTime,
+createTimeLong, updateBy, updateTime,
+updateTimeLong )
+values (
+#{id}, #{iduser},
+#{idnoticemessage}, #{createby}, #{createtime},
+#{createtimelong}, #{updateby}, #{updatetime},
+#{updatetimelong} );
+
+-- [deleteNoticeMessage]
+delete from $table$ where idUser = #{iduser} and idNoticeMessage = #{idnoticemessage};
+
+-- [queryPersonConfigValue]
+select * from $table$;
+
+-- [addPersonConfigValue]
+insert into $table$ (
+idUser, configKey, configName,
+configValue1, configValue2, configValue3,
+createBy, createTime, createTimeLong,
+updateBy, updateTime, updateTimeLong )
+values (
+#{iduser}, #{configkey}, #{configname},
+#{configvalue1}, #{configvalue2}, #{configvalue3},
+#{createby}, #{createtime}, #{createtimelong},
+#{updateby}, #{updatetime}, #{updatetimelong} );
+
+-- [updatePersonConfigValue]
+update $table$ set
+configValue1 = #{configvalue1},
+configValue2 = #{configvalue2},
+configValue3 = #{configvalue3},
+updateBy = #{updateby},
+updateTime = #{updatetime},
+updateTimeLong = #{updatetimelong}
+where idUser = #{iduser} and configKey = #{configkey};
+
+-- [selectDataPurview]
+select * from $table$ order by idData, idUser, idCreateUser;
+
+-- [addDataPurview]
+insert into $table$ (
+idUser, userName, idCreateUser,
+createUserName, idData )
+values (
+#{iduser}, #{username}, #{idcreateuser},
+#{createusername}, #{iddata} );
+
+-- [deleteDataPurview]
+delete from $table$
+where idData = #{iddata} and idUser = #{iduser} and idCreateUser = #{idcreateuser};
+
+-- [insertTaskQueue]
+insert into $table$
+(userId, createTime, taskName,
+queryBeginDate, queryEndDate, queryContent,
+errorMsg, fileName, fileURL,
+webFileURL)
+values (
+#{userid}, #{createtime}, #{taskname},
+#{querybegindate}, #{queryenddate}, #{querycontent},
+#{errormsg}, #{filename}, #{fileurl},
+#{webfileurl}
+);
+
+-- [selectTaskQueue]
+select * from $table$
+where userId = #{userId}
+-- isNotEmpty beginTime
+and createTime >= #{beginTime}
+-- end
+-- isNotEmpty endTime
+and createTime <= #{endTime}
+-- end
+order by createTime desc;
+
+
+-- [insertPageTableColumn]
+insert into $table$ (
+idUser, pageName, columnName,
+columnTitle, columnWidth, columnIndex)
+values (
+#{iduser}, #{pagename}, #{columnname},
+#{columntitle}, #{columnwidth}, #{columnindex});
+
+-- [deletePageTableColumn]
+delete from $table$
+where idUser = #{idUser} and pageName = #{pageName};
+
+-- [selectPageTableColumn]
+select * from $table$
+where idUser = #{idUser} and pageName = #{pageName}
+order by columnindex;
+
+-- [insertAnnouncement]
+insert into $table$ (id, idAnnouncementType, announcementType, announcementTitle,
+announcementState, voidFlag, idReleaseMan,
+releaseMan, releaseDate,
+createMan, createBy,
+createTime, updateBy,
+updateTime ) values ( #{id}, #{idannouncementtype}, #{announcementtype}, #{announcementtitle},
+#{announcementstate}, #{voidflag}, #{idreleaseman},
+#{releaseman}, #{releasedate},
+#{createman}, #{createby},
+#{createtime}, #{updateby},
+#{updatetime} );
+
+-- [updateAnnouncement]
+update $table$ set idAnnouncementType = #{idannouncementtype},announcementType = #{announcementtype},announcementTitle = #{announcementtitle},announcementState = #{announcementstate},
+voidFlag = #{voidflag},idReleaseMan = #{idreleaseman},releaseMan = #{releaseman},releaseDate = #{releasedate},
+createMan = #{createman},createBy = #{createby},
+createTime = #{createtime},updateBy = #{updateby},updateTime = #{updatetime} where id = #{id};
+
+-- [voidAnnouncement]
+update $table$ set
+voidFlag = #{voidflag},
+updateBy = #{updateby},
+updateTime = #{updatetime}
+where id = #{id};
+
+-- [insertAnnouncementAttachment]
+insert into $table$ (id, idAnnouncement, idUser, userName,
+originName, srcFileName, fileDescription,
+attachmentUrl, downloadUrl, sortNum,
+createBy, createTime,
+updateBy, updateTime ) values ( #{id}, #{idannouncement}, #{iduser}, #{username},
+#{originname}, #{srcfilename}, #{filedescription},
+#{attachmenturl}, #{downloadurl}, #{sortnum},
+#{createby}, #{createtime},
+#{updateby}, #{updatetime} );
+
+-- [deleteAnnouncementAttachment]
+delete from $table$ where id = #{id};

+ 450 - 0
conf/初始化业务表.sql

@@ -0,0 +1,450 @@
+drop table if exists deBusinessOrder1000_current;
+create table deBusinessOrder1000_current(
+                                            id	bigint  default 0,
+                                            orderName	varchar(50) default '',
+                                            orderCode	varchar(100) default '',
+                                            orderStatus	int default 0,
+                                            orderSequence	bigint  default 0,
+                                            incomePlatformId	bigint  default 0,
+                                            incomePlatformName	varchar(50) default '',
+                                            incomePlatformOrderCode	varchar(100) default '',
+                                            incomePlatformOrderTime	datetime default NOW(),
+                                            incomePlatformOrderTimeLong	bigint  default 0,
+                                            suggestDeliverTime	datetime default NOW(),
+                                            suggestDeliverTimeLong	bigint  default 0,
+                                            idStore	bigint  default 0,
+                                            storeName	varchar(50) default '',
+                                            deliverFee	decimal(18,4) default 0,
+                                            deliverDistance	decimal(18,4) default 0,
+                                            deliverAddressAll	varchar(500) default '',
+                                            outGoingPlatformId	bigint  default 0,
+                                            outGoingPlatformName	varchar(50) default '',
+                                            voidFlagIn	int default 0,
+                                            voidFlagOut	int default 0,
+                                            createBy	bigint  default 0,
+                                            createTime	datetime default NOW(),
+                                            createTimeLong	bigint  default 0,
+                                            updateBy	bigint  default 0,
+                                            updateTime	datetime default NOW(),
+                                            updateTimeLong	bigint  default 0,
+                                            primary key (id)
+)
+    ENGINE = INNODB
+    AUTO_INCREMENT = 1
+    DEFAULT CHARSET = utf8
+    COMMENT = '';
+
+-- ----------------------------
+-- Table structure for eoorderstep1000_current
+-- ----------------------------
+DROP TABLE IF EXISTS `deorderstep1000_current`;
+CREATE TABLE `deorderstep1000_current`  (
+                                            `id` bigint(20) NOT NULL AUTO_INCREMENT,
+                                            `idOrder` bigint(20) NULL DEFAULT 0,
+                                            `idWorkMan` bigint(20) NULL DEFAULT 0,
+                                            `workMan` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
+                                            `workTime` datetime NULL DEFAULT CURRENT_TIMESTAMP,
+                                            `workMemo` varchar(1000) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
+                                            `workExplain` varchar(6000) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
+                                            PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
+
+drop table if exists tbPlatformInfo1000;
+create table tbPlatformInfo1000(
+                                   id	bigint  default 0,
+                                   platformName	varchar(50) default '',
+                                   platformType	int default 0,
+                                   requireListSerial	varchar(100) default '',
+                                   voidFlag	int default 0,
+                                   createBy	bigint  default 0,
+                                   createTime	datetime default NOW(),
+                                   createTimeLong	bigint  default 0,
+                                   updateBy	bigint  default 0,
+                                   updateTime	datetime default NOW(),
+                                   updateTimeLong	bigint  default 0,
+                                   primary key (id)
+)
+    ENGINE = INNODB
+    AUTO_INCREMENT = 1
+    DEFAULT CHARSET = utf8
+    COMMENT = '';
+
+drop table if exists tbPlatformRequire1000;
+create table tbPlatformRequire1000(
+                                      id	bigint  default 0,
+                                      requireName	varchar(50) default '',
+                                      requireCode	varchar(100) default '',
+                                      valueType	int default 0,
+                                      voidFlag	int default 0,
+                                      createBy	bigint  default 0,
+                                      createTime	datetime default NOW(),
+                                      createTimeLong	bigint  default 0,
+                                      updateBy	bigint  default 0,
+                                      updateTime	datetime default NOW(),
+                                      updateTimeLong	bigint  default 0,
+                                      primary key (id)
+)
+    ENGINE = INNODB
+    AUTO_INCREMENT = 1
+    DEFAULT CHARSET = utf8
+    COMMENT = '';
+
+drop table if exists tbStoreBrand1000;
+create table tbStoreBrand1000(
+                                 id	bigint  default 0,
+                                 brandName	varchar(50) default '',
+                                 brandLogoUrl	varchar(100) default '',
+                                 startingPrice	decimal(18,4) default 0,
+                                 packagingFee	decimal(18,4) default 0,
+                                 brandMemo	varchar(2000) default '',
+                                 voidFlag	int default 0,
+                                 createBy	bigint  default 0,
+                                 createTime	datetime default NOW(),
+                                 createTimeLong	bigint  default 0,
+                                 updateBy	bigint  default 0,
+                                 updateTime	datetime default NOW(),
+                                 updateTimeLong	bigint  default 0,
+                                 primary key (id)
+)
+    ENGINE = INNODB
+    AUTO_INCREMENT = 1
+    DEFAULT CHARSET = utf8
+    COMMENT = '';
+
+
+drop table if exists tbStoreInfo1000;
+create table tbStoreInfo1000(
+                                id	bigint  default 0,
+                                storeName	varchar(50) default '',
+                                idBrand	bigint  default 0,
+                                brandName	varchar(50) default '',
+                                idStoreType	bigint  default 0,
+                                deliverSettleKind	int default 0,
+                                storeCodeInput	varchar(100) default '',
+                                storeProvince	varchar(50) default '',
+                                storeCity	varchar(50) default '',
+                                storeDistrict	varchar(100) default '',
+                                storeAddress	varchar(500) default '',
+                                contractPhone	varchar(100) default '',
+                                storeBossId	bigint  default 0,
+                                companyLicenseNo	varchar(100) default '',
+                                companyLicensePicUrl	varchar(100) default '',
+                                legalPersonIdNo	varchar(100) default '',
+                                legalPersonName	varchar(50) default '',
+                                voidFlag	int default 0,
+                                enableInvoice	int default 0,
+                                createBy	bigint  default 0,
+                                createTime	datetime default NOW(),
+                                createTimeLong	bigint  default 0,
+                                updateBy	bigint  default 0,
+                                updateTime	datetime default NOW(),
+                                updateTimeLong	bigint  default 0,
+                                primary key (id)
+)
+    ENGINE = INNODB
+    AUTO_INCREMENT = 1
+    DEFAULT CHARSET = utf8
+    COMMENT = '';
+
+
+drop table if exists tbStorePlatform1000;
+create table tbStorePlatform1000(
+                                    id	bigint  default 0,
+                                    idStore	bigint  default 0,
+                                    idPlatformInfo	bigint  default 0,
+                                    platformName	varchar(50) default '',
+                                    platformType	int default 0,
+                                    enableStatue	int default 0,
+                                    createBy	bigint  default 0,
+                                    createTime	datetime default NOW(),
+                                    createTimeLong	bigint  default 0,
+                                    updateBy	bigint  default 0,
+                                    updateTime	datetime default NOW(),
+                                    updateTimeLong	bigint  default 0,
+                                    primary key (id)
+)
+    ENGINE = INNODB
+    AUTO_INCREMENT = 1
+    DEFAULT CHARSET = utf8
+    COMMENT = '';
+
+
+drop table if exists tbStorePlatformRequire1000;
+create table tbStorePlatformRequire1000(
+                                           id	bigint  default 0,
+                                           idStore	bigint  default 0,
+                                           idStorePlatform	bigint  default 0,
+                                           idPlatformRequire	bigint  default 0,
+                                           platformRequireCode	varchar(100) default '',
+                                           platformRequireName	varchar(50) default '',
+                                           itemValue	varchar(100) default '',
+                                           createBy	bigint  default 0,
+                                           createTime	datetime default NOW(),
+                                           createTimeLong	bigint  default 0,
+                                           updateBy	bigint  default 0,
+                                           updateTime	datetime default NOW(),
+                                           updateTimeLong	bigint  default 0,
+                                           primary key (id)
+)
+    ENGINE = INNODB
+    AUTO_INCREMENT = 1
+    DEFAULT CHARSET = utf8
+    COMMENT = '';
+
+drop table if exists tbStoreInvoiceInfo1000;
+create table tbStoreInvoiceInfo1000(
+                                               id	bigint  default 0,
+                                               idStore	bigint  default 0,
+                                               taxIdNo	varchar(100) default '',
+                                               companyName	varchar(50) default '',
+                                               defaultTaxItemName	varchar(50) default '',
+                                               defaultTaxItemCode	varchar(100) default '',
+                                               taxRate	decimal(18,4) default 0,
+                                               createBy	bigint  default 0,
+                                               createTime	datetime default NOW(),
+                                               createTimeLong	bigint  default 0,
+                                               updateBy	bigint  default 0,
+                                               updateTime	datetime default NOW(),
+                                               updateTimeLong	bigint  default 0,
+                                               primary key (id)
+)
+    ENGINE = INNODB
+    AUTO_INCREMENT = 1
+    DEFAULT CHARSET = utf8
+    COMMENT = '';
+
+
+ALTER TABLE `tbplatforminfo1000`
+    ADD COLUMN `platformCode` varchar(50) NULL AFTER `id`;
+
+
+
+drop table if exists deOrderFinances1000_current;
+create table deOrderFinances1000_current(
+                                            id	bigint  default 0,
+                                            idOrder	bigint  default 0,
+                                            orderMoney	decimal(18,4) default 0,
+                                            deliverFee	decimal(18,4) default 0,
+                                            orderPlatformSubsidy	decimal(18,4) default 0,
+                                            storeDiscount	decimal(18,4) default 0,
+                                            customerPaid	decimal(18,4) default 0,
+                                            platformServiceFee	decimal(18,4) default 0,
+                                            storeRealCollection	decimal(18,4) default 0,
+                                            createBy	bigint  default 0,
+                                            createTime	datetime default NOW(),
+                                            createTimeLong	bigint  default 0,
+                                            updateBy	bigint  default 0,
+                                            updateTime	datetime default NOW(),
+                                            updateTimeLong	bigint  default 0,
+                                            primary key (id)
+)
+    ENGINE = INNODB
+    AUTO_INCREMENT = 1
+    DEFAULT CHARSET = utf8
+    COMMENT = '';
+
+
+drop table if exists deOrderDeliveryInfo1000_current;
+create table deOrderDeliveryInfo1000_current(
+                                                id	bigint  default 0,
+                                                idOrder	bigint  default 0,
+                                                deliverProvince	varchar(50) default '',
+                                                deliverCity	varchar(50) default '',
+                                                deliverDistract	varchar(100) default '',
+                                                deliverAddress	varchar(500) default '',
+                                                geoLocationSerial	varchar(1000) default '',
+                                                receiveMan	varchar(100) default '',
+                                                contractPhone	varchar(100) default '',
+                                                deliverTimeliness	int default 0,
+                                                bookingDeliverTime	datetime default NOW(),
+                                                customerInvoiceInfo	varchar(100) default '',
+                                                customerMemo	varchar(2000) default '',
+                                                createBy	bigint  default 0,
+                                                createTime	datetime default NOW(),
+                                                createTimeLong	bigint  default 0,
+                                                updateBy	bigint  default 0,
+                                                updateTime	datetime default NOW(),
+                                                updateTimeLong	bigint  default 0,
+                                                primary key (id)
+)
+    ENGINE = INNODB
+    AUTO_INCREMENT = 1
+    DEFAULT CHARSET = utf8
+    COMMENT = '';
+
+
+drop table if exists deOrderDetailItem1000_current;
+create table deOrderDetailItem1000_current(
+                                              id	bigint  default 0,
+                                              idOrder	bigint  default 0,
+                                              itemName	varchar(50) default '',
+                                              itemPrice	decimal(18,4) default 0,
+                                              itemCount	int default 0,
+                                              itemMoney	decimal(18,4) default 0,
+                                              createBy	bigint  default 0,
+                                              createTime	datetime default NOW(),
+                                              createTimeLong	bigint  default 0,
+                                              updateBy	bigint  default 0,
+                                              updateTime	datetime default NOW(),
+                                              updateTimeLong	bigint  default 0,
+                                              primary key (id)
+)
+    ENGINE = INNODB
+    AUTO_INCREMENT = 1
+    DEFAULT CHARSET = utf8
+    COMMENT = '';
+
+
+CREATE OR REPLACE ALGORITHM = UNDEFINED DEFINER = `dbadmin`@`%` SQL SECURITY DEFINER VIEW `v_debusinessorder1000` AS select `debusinessorder1000_current`.`id` AS `id`,`debusinessorder1000_current`.`orderCode` AS `orderCode` from `debusinessorder1000_current` ;
+CREATE OR REPLACE ALGORITHM = UNDEFINED DEFINER = `dbadmin`@`%` SQL SECURITY DEFINER VIEW `v_deorderfinances1000` AS select `deorderfinances1000_current`.`id` AS `id` from `deorderfinances1000_current` ;
+CREATE OR REPLACE ALGORITHM = UNDEFINED DEFINER = `dbadmin`@`%` SQL SECURITY DEFINER VIEW `v_deorderdetailitem1000` AS  select `deorderdetailitem1000_current`.`id` AS `id` from `deorderdetailitem1000_current`;
+CREATE OR REPLACE ALGORITHM = UNDEFINED DEFINER = `dbadmin`@`%` SQL SECURITY DEFINER VIEW `v_deorderdeliveryinfo1000` AS select `deorderdeliveryinfo1000_current`.`id` AS `id` from `deorderdeliveryinfo1000_current`;
+
+
+ALTER TABLE `tbstoreplatform1000`
+    ADD COLUMN `platformStoreId` varchar(255) NULL AFTER `idStore`;
+
+ALTER TABLE `deorderdeliveryinfo1000_current`
+    ADD COLUMN `bookingDeliverTimeLong` bigint(20) NULL AFTER `bookingDeliverTime`;
+
+ALTER TABLE `deorderfinances1000_current`
+    ADD COLUMN `omeServiceFee` decimal(18, 4) NULL AFTER `storeRealCollection`;
+
+drop table if exists deOrderRefundRequest1000_current;
+create table deOrderRefundRequest1000_current(
+                                                 id	bigint  default 0,
+                                                 idOrder	bigint  default 0,
+                                                 idStore	bigint  default 0,
+                                                 outPlatformStoreId	varchar(100) default '',
+                                                 idStorePlatform	bigint  default 0,
+                                                 platformCode	varchar(100) default '',
+                                                 platformType	int default 0,
+                                                 platformName	varchar(50) default '',
+                                                 outAfterSaleId	varchar(100) default '',
+                                                 requestStatus	int default 0,
+                                                 userRefundMemo	varchar(2000) default '',
+                                                 refundType	int default 0,
+                                                 deliveryFee	int default 0,
+                                                 refundFee	int default 0,
+                                                 refundProdCount	int default 0,
+                                                 refundProductsDetail	varchar(100) default '',
+                                                 createBy	bigint  default 0,
+                                                 createTime	datetime default NOW(),
+                                                 createTimeLong	bigint  default 0,
+                                                 updateBy	bigint  default 0,
+                                                 updateTime	datetime default NOW(),
+                                                 updateTimeLong	bigint  default 0,
+                                                 primary key (id)
+)
+    ENGINE = INNODB
+    AUTO_INCREMENT = 1
+    DEFAULT CHARSET = utf8
+    COMMENT = '';
+
+
+drop table if exists deOrderAfterSaleBill1000_current;
+create table deOrderAfterSaleBill1000_current(
+                                                 id	bigint  default 0,
+                                                 idOrder	bigint  default 0,
+                                                 idStore	bigint  default 0,
+                                                 outPlatformStoreId	varchar(100) default '',
+                                                 idStorePlatform	bigint  default 0,
+                                                 platformCode	varchar(100) default '',
+                                                 platformType	int default 0,
+                                                 platformName	varchar(50) default '',
+                                                 outAfterSaleId	varchar(100) default '',
+                                                 applySource	varchar(100) default '',
+                                                 billCode	varchar(100) default '',
+                                                 userRefundAmount	int default 0,
+                                                 totalUserRefundAmount	int default 0,
+                                                 prodCountAfterRefund	int default 0,
+                                                 productsRemainDetail	varchar(2000) default '',
+                                                 productsRefundDetail	varchar(2000) default '',
+                                                 createBy	bigint  default 0,
+                                                 createTime	datetime default NOW(),
+                                                 createTimeLong	bigint  default 0,
+                                                 updateBy	bigint  default 0,
+                                                 updateTime	datetime default NOW(),
+                                                 updateTimeLong	bigint  default 0,
+                                                 primary key (id)
+)
+    ENGINE = INNODB
+    AUTO_INCREMENT = 1
+    DEFAULT CHARSET = utf8
+    COMMENT = '';
+
+CREATE OR REPLACE ALGORITHM = UNDEFINED DEFINER = `dbadmin`@`%` SQL SECURITY DEFINER VIEW `v_deorderaftersalebill1000` AS SELECT
+                                                                                                                                              `deorderaftersalebill1000_current`.`id` AS `id`,
+                                                                                                                                              `deorderaftersalebill1000_current`.`billCode` AS `billCode`
+                                                                                                                                          FROM
+                                                                                                                                              `deorderaftersalebill1000_current`;
+CREATE OR REPLACE ALGORITHM = UNDEFINED DEFINER = `dbadmin`@`%` SQL SECURITY DEFINER VIEW `v_deorderrefundrequest1000` AS  select `deorderrefundrequest1000_current`.`id` AS `id` from `deorderrefundrequest1000_current`;
+
+ALTER TABLE `deorderdetailitem1000_current`
+    ADD COLUMN `itemDetail` varchar(2000) NULL AFTER `itemMoney`;
+
+
+ALTER TABLE `tbstoreinfo1000`
+    ADD COLUMN `loginAccount` varchar(20) NULL AFTER `enableInvoice`,
+    ADD COLUMN `loginPass` varchar(200) NULL AFTER `loginAccount`;
+
+ALTER TABLE `deorderrefundrequest1000_current`
+    ADD COLUMN `refundReasonCodes` varchar(100) NULL AFTER `requestStatus`;
+
+ALTER TABLE `deorderaftersalebill1000_current`
+    ADD COLUMN `refundReasonCodes` varchar(100) NULL AFTER `billCode`;
+
+ALTER TABLE `deorderrefundrequest1000_current`
+    ADD COLUMN `orderName` varchar(200) NULL AFTER `refundProductsDetail`,
+    ADD COLUMN `orderCode` varchar(100) NULL AFTER `orderName`;
+
+ALTER TABLE `deorderrefundrequest1000_current`
+    ADD COLUMN `refuseToRefundReasonCodes` varchar(200) NULL AFTER `refundType`,
+    ADD COLUMN `refuseToRefundMemo` varchar(500) NULL AFTER `refuseToRefundReasonCodes`;
+
+ALTER TABLE `deorderaftersalebill1000_current`
+    ADD COLUMN `idRefundRequest` bigint(20) NULL AFTER `outAfterSaleId`;
+
+
+ALTER TABLE `deorderfinances1000_current`
+    ADD COLUMN `customerRefunded` decimal(18, 4) NULL AFTER `customerPaid`;
+
+ALTER TABLE `deorderaftersalebill1000_current`
+    ADD COLUMN `refundReasonMsgs` varchar(500) NULL AFTER `refundReasonCodes`;
+
+
+ALTER TABLE `tbstoreplatform1000`
+    ADD COLUMN `platformShopName` varchar(200) NULL AFTER `enableStatue`,
+    ADD COLUMN `platformShopAddress` varchar(300) NULL AFTER `platformShopName`,
+    ADD COLUMN `platformShopPhone` varchar(20) NULL AFTER `platformShopAddress`,
+    ADD COLUMN `platformShopGeoLat` varchar(50) NULL AFTER `platformShopPhone`,
+    ADD COLUMN `platformShopGeoLng` varchar(50) NULL AFTER `platformShopGeoLat`;
+
+
+drop table if exists deOrderDiscount1000_current;
+create table deOrderDiscount1000_current(
+                                            id	bigint  default 0,
+                                            idOrder	bigint  default 0,
+                                            discountName	varchar(50) default '',
+                                            discountType	int default 0,
+                                            discountAmount	int default 0,
+                                            merchantDiscountAmount	int default 0,
+                                            platformDiscountAmount	int default 0,
+                                            createBy	bigint  default 0,
+                                            createTime	datetime default NOW(),
+                                            createTimeLong	bigint  default 0,
+                                            updateBy	bigint  default 0,
+                                            updateTime	datetime default NOW(),
+                                            updateTimeLong	bigint  default 0,
+                                            primary key (id)
+)
+    ENGINE = INNODB
+    AUTO_INCREMENT = 1
+    DEFAULT CHARSET = utf8
+    COMMENT = '';
+
+CREATE OR REPLACE ALGORITHM = UNDEFINED DEFINER = `dbadmin`@`%` SQL SECURITY DEFINER VIEW `v_deorderdiscount1000` AS  select `deorderdiscount1000_current`.`id` AS `id` from `deorderdiscount1000_current`;
+
+ALTER TABLE `tbplatforminfo1000`
+    ADD COLUMN `needAccessToken` int(11) NULL AFTER `voidFlag`,
+    ADD COLUMN `refreshTokenSeconds` int(11) NULL AFTER `needAccessToken`;

+ 11 - 0
conf/启动更新sql模板.sql

@@ -0,0 +1,11 @@
+if exists(select * from sys.objects where name = 'tbMallUserBindSocial${supplyCode}' and type = 'u')
+    drop table tbMallUserBindSocial${supplyCode}
+
+create table tbMallUserBindSocial${supplyCode}(
+                                     id	bigint default 0,
+                                     userId	bigint default 0,
+                                     account	varchar(500) default '',
+                                     socialFrom	int default 0,
+                                     openId	varchar(500) default '',
+                                     primary key (id)
+)

+ 75 - 0
pom.xml

@@ -0,0 +1,75 @@
+<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/maven-v4_0_0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <groupId>com.yinjie</groupId>
+    <artifactId>HeatingPaymentsInvoker</artifactId>
+    <version>1.0</version>
+    <packaging>pom</packaging>
+    <name>HeatingPaymentsInvoker</name>
+    <modules>
+        <module>yjCommon</module>
+        <module>yjBusiness</module>
+        <module>yjWebCore</module>
+        <module>yjWebOne</module>
+    </modules>
+
+
+    <properties>
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
+        <java.version>17</java.version>
+        <maven.compiler.source>${java.version}</maven.compiler.source>
+        <maven.compiler.target>${java.version}</maven.compiler.target>
+        <frame.version>10.2.80</frame.version>
+    </properties>
+
+    <repositories>
+        <repository>
+            <id>thirdparty</id>
+            <url>http://192.168.1.243:12333/nexus/content/repositories/thirdparty/</url>
+            <layout>default</layout>
+            <releases>
+                <enabled>true</enabled>
+            </releases>
+            <snapshots>
+                <enabled>true</enabled>
+            </snapshots>
+        </repository>
+    </repositories>
+
+    <dependencies>
+        <dependency>
+            <groupId>com.dny</groupId>
+            <artifactId>dySweetFish</artifactId>
+            <version>${frame.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>com.dny</groupId>
+            <artifactId>dySweetFishPlugin</artifactId>
+            <version>${frame.version}</version>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-dependency-plugin</artifactId>
+                <version>3.2.0</version>
+                <executions>
+                    <execution>
+                        <id>copy</id>
+                        <phase>package</phase>
+                        <goals>
+                            <goal>copy-dependencies</goal>
+                        </goals>
+                        <configuration>
+                            <outputDirectory>${project.build.directory}/lib</outputDirectory>
+                        </configuration>
+                    </execution>
+                </executions>
+                <!--<fork>true</fork>-->
+            </plugin>
+        </plugins>
+    </build>
+</project>

+ 28 - 0
yjBusiness/pom.xml

@@ -0,0 +1,28 @@
+<?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">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>com.yinjie</groupId>
+        <artifactId>HeatingPaymentsInvoker</artifactId>
+        <version>1.0</version>
+    </parent>
+
+    <artifactId>yjBusiness</artifactId>
+
+    <dependencies>
+        <dependency>
+            <groupId>com.yinjie</groupId>
+            <artifactId>yjCommon</artifactId>
+            <version>1.0</version>
+        </dependency>
+    </dependencies>
+
+    <properties>
+        <maven.compiler.source>17</maven.compiler.source>
+        <maven.compiler.target>17</maven.compiler.target>
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+    </properties>
+
+</project>

+ 137 - 0
yjBusiness/src/main/java/com/yinjie/heating/business/dao/DocDao.java

@@ -0,0 +1,137 @@
+package com.yinjie.heating.business.dao;
+
+import com.yinjie.heating.common.entity.doc.BusinessScript;
+import com.yinjie.heating.common.entity.inquire.InquireCondition;
+import com.yinjie.heating.common.entity.inquire.InquireMainInfo;
+import com.yinjie.heating.common.entity.inquire.InquireResultColumn;
+import com.yinjie.heating.common.entity.system.CompanyInfo;
+import com.dySweetFishPlugin.sql.dao.*;
+import com.sweetfish.source.PageFlipper;
+import org.rex.RMap;
+
+import java.util.List;
+
+@SuppressWarnings({"rawtypes", "unused"})
+public interface DocDao extends DaoRepository {
+
+
+    //region 业务脚本
+
+    @Sharding(databaseShardingStrategy = SupplierDataBaseShardingStrategy.class, tableShardingStrategy = SupplierTableShardingStrategy.class)
+    @DAOMethod(operator = OperatorType.QUERY, owait = OperatorWait.AWAIT)
+    @SqlId(clazz = DocDao.class, sql = "selectBusinessScript", table = "tbBusinessScript", params = {1})
+    List<BusinessScript> selectBusinessScript(RMap params, @DatabaseShardingBy String dataSourceId, @TableShardingBy Long supplierCode,
+                                              PageFlipper pageFlipper);
+
+    @Sharding(databaseShardingStrategy = SupplierDataBaseShardingStrategy.class, tableShardingStrategy = SupplierTableShardingStrategy.class)
+    @DAOMethod(operator = OperatorType.UPDATE, owait = OperatorWait.ASNYC)
+    @SqlId(clazz = DocDao.class, sql = "addBusinessScript", table = "tbBusinessScript", params = {1})
+    void addBusinessScript(BusinessScript businessScript, @DatabaseShardingBy String dataSourceId, @TableShardingBy Long supplierCode);
+
+    @Sharding(databaseShardingStrategy = SupplierDataBaseShardingStrategy.class, tableShardingStrategy = SupplierTableShardingStrategy.class)
+    @DAOMethod(operator = OperatorType.UPDATE, owait = OperatorWait.ASNYC)
+    @SqlId(clazz = DocDao.class, sql = "updateBusinessScript", table = "tbBusinessScript", params = {1})
+    void updateBusinessScript(BusinessScript businessScript, @DatabaseShardingBy String dataSourceId, @TableShardingBy Long supplierCode);
+
+    @Sharding(databaseShardingStrategy = SupplierDataBaseShardingStrategy.class, tableShardingStrategy = SupplierTableShardingStrategy.class)
+    @DAOMethod(operator = OperatorType.UPDATE, owait = OperatorWait.ASNYC)
+    @SqlId(clazz = DocDao.class, sql = "voidBusinessScript", table = "tbBusinessScript", params = {1})
+    void voidBusinessScript(BusinessScript businessScript, @DatabaseShardingBy String dataSourceId, @TableShardingBy Long supplierCode);
+
+    //endregion
+
+
+    //region 查询统计
+    @Sharding(databaseShardingStrategy = SupplierDataBaseShardingStrategy.class, tableShardingStrategy = SupplierTableShardingStrategy.class)
+    @DAOMethod(operator = OperatorType.QUERY, owait = OperatorWait.AWAIT)
+    @SqlId(clazz = DocDao.class, sql = "selectInquireMainInfo", table = "eiInquireMainInfo", params = {1})
+    List<InquireMainInfo> selectInquireMainInfo(RMap params, PageFlipper pageFlipper, @DatabaseShardingBy String dataSourceId, @TableShardingBy Long supplierCode);
+
+    @Sharding(databaseShardingStrategy = SupplierDataBaseShardingStrategy.class, tableShardingStrategy = SupplierTableShardingStrategy.class)
+    @DAOMethod(operator = OperatorType.UPDATE, owait = OperatorWait.ASNYC)
+    @SqlId(clazz = DocDao.class, sql = "addInquireMainInfo", table = "eiInquireMainInfo", params = {1}, sort = 1)
+    @SqlId(clazz = DocDao.class, sql = "addInquireResultColumn", table = "eiInquireResultColumn", params = {2}, sort = 2)
+    @SqlId(clazz = DocDao.class, sql = "addInquireCondition", table = "eiInquireCondition", params = {3}, sort = 3)
+    void addInquireMainInfo(InquireMainInfo inquireMainInfo, List<InquireResultColumn> columnList,
+                           List<InquireCondition> conditionList, @DatabaseShardingBy String dataSourceId, @TableShardingBy Long supplierCode);
+
+    @Sharding(databaseShardingStrategy = SupplierDataBaseShardingStrategy.class, tableShardingStrategy = SupplierTableShardingStrategy.class)
+    @DAOMethod(operator = OperatorType.UPDATE, owait = OperatorWait.ASNYC)
+    @SqlId(clazz = DocDao.class, sql = "updateInquireMainInfo", table = "eiInquireMainInfo", params = {1}, sort = 1)
+    @SqlId(clazz = DocDao.class, sql = "deleteInquireResultColumnByMain", table = "eiInquireResultColumn", params = {1}, sort = 2)
+    @SqlId(clazz = DocDao.class, sql = "deleteInquireConditionByMain", table = "eiInquireCondition", params = {1}, sort = 3)
+    @SqlId(clazz = DocDao.class, sql = "addInquireResultColumn", table = "eiInquireResultColumn", params = {2}, sort = 4)
+    @SqlId(clazz = DocDao.class, sql = "addInquireCondition", table = "eiInquireCondition", params = {3}, sort = 5)
+    void updateInquireMainInfo(InquireMainInfo inquireMainInfo, List<InquireResultColumn> columnList,
+                              List<InquireCondition> conditionList, @DatabaseShardingBy String dataSourceId, @TableShardingBy Long supplierCode);
+
+    @Sharding(databaseShardingStrategy = SupplierDataBaseShardingStrategy.class, tableShardingStrategy = SupplierTableShardingStrategy.class)
+    @DAOMethod(operator = OperatorType.UPDATE, owait = OperatorWait.ASNYC)
+    @SqlId(clazz = DocDao.class, sql = "voidInquireMainInfo", table = "eiInquireMainInfo", params = {1})
+    void voidInquireMainInfo(InquireMainInfo inquireMainInfo, @DatabaseShardingBy String dataSourceId, @TableShardingBy Long supplierCode);
+
+
+    @Sharding(databaseShardingStrategy = SupplierDataBaseShardingStrategy.class, tableShardingStrategy = SupplierTableShardingStrategy.class)
+    @DAOMethod(operator = OperatorType.QUERY, owait = OperatorWait.AWAIT)
+    @SqlId(clazz = DocDao.class, sql = "selectInquireResultColumn", table = "eiInquireResultColumn", params = {1})
+    List<InquireResultColumn> selectInquireResultColumn(RMap params, PageFlipper pageFlipper, @DatabaseShardingBy String dataSourceId, @TableShardingBy Long supplierCode);
+
+    @Sharding(databaseShardingStrategy = SupplierDataBaseShardingStrategy.class, tableShardingStrategy = SupplierTableShardingStrategy.class)
+    @DAOMethod(operator = OperatorType.UPDATE, owait = OperatorWait.ASNYC)
+    @SqlId(clazz = DocDao.class, sql = "addInquireResultColumn", table = "eiInquireResultColumn", params = {1})
+    int addInquireResultColumn(InquireResultColumn inquireResultColumn, @DatabaseShardingBy String dataSourceId, @TableShardingBy Long supplierCode);
+
+    @Sharding(databaseShardingStrategy = SupplierDataBaseShardingStrategy.class, tableShardingStrategy = SupplierTableShardingStrategy.class)
+    @DAOMethod(operator = OperatorType.UPDATE, owait = OperatorWait.ASNYC)
+    @SqlId(clazz = DocDao.class, sql = "updateInquireResultColumn", table = "eiInquireResultColumn", params = {1})
+    int updateInquireResultColumn(InquireResultColumn inquireResultColumn, @DatabaseShardingBy String dataSourceId, @TableShardingBy Long supplierCode);
+
+    @Sharding(databaseShardingStrategy = SupplierDataBaseShardingStrategy.class, tableShardingStrategy = SupplierTableShardingStrategy.class)
+    @DAOMethod(operator = OperatorType.UPDATE, owait = OperatorWait.ASNYC)
+    @SqlId(clazz = DocDao.class, sql = "deleteInquireResultColumn", table = "eiInquireResultColumn", params = {1})
+    int deleteInquireResultColumn(InquireResultColumn inquireResultColumn, @DatabaseShardingBy String dataSourceId, @TableShardingBy Long supplierCode);
+
+
+    @Sharding(databaseShardingStrategy = SupplierDataBaseShardingStrategy.class, tableShardingStrategy = SupplierTableShardingStrategy.class)
+    @DAOMethod(operator = OperatorType.QUERY, owait = OperatorWait.AWAIT)
+    @SqlId(clazz = DocDao.class, sql = "selectInquireCondition", table = "eiInquireCondition", params = {1})
+    List<InquireCondition> selectInquireCondition(RMap params, PageFlipper pageFlipper, @DatabaseShardingBy String dataSourceId, @TableShardingBy Long supplierCode);
+
+    @Sharding(databaseShardingStrategy = SupplierDataBaseShardingStrategy.class, tableShardingStrategy = SupplierTableShardingStrategy.class)
+    @DAOMethod(operator = OperatorType.UPDATE, owait = OperatorWait.ASNYC)
+    @SqlId(clazz = DocDao.class, sql = "addInquireCondition", table = "eiInquireCondition", params = {1})
+    int addInquireCondition(InquireCondition inquireCondition, @DatabaseShardingBy String dataSourceId, @TableShardingBy Long supplierCode);
+
+    @Sharding(databaseShardingStrategy = SupplierDataBaseShardingStrategy.class, tableShardingStrategy = SupplierTableShardingStrategy.class)
+    @DAOMethod(operator = OperatorType.UPDATE, owait = OperatorWait.ASNYC)
+    @SqlId(clazz = DocDao.class, sql = "updateInquireCondition", table = "eiInquireCondition", params = {1})
+    int updateInquireCondition(InquireCondition inquireCondition, @DatabaseShardingBy String dataSourceId, @TableShardingBy Long supplierCode);
+
+    @Sharding(databaseShardingStrategy = SupplierDataBaseShardingStrategy.class, tableShardingStrategy = SupplierTableShardingStrategy.class)
+    @DAOMethod(operator = OperatorType.UPDATE, owait = OperatorWait.ASNYC)
+    @SqlId(clazz = DocDao.class, sql = "deleteInquireCondition", table = "eiInquireCondition", params = {1})
+    int deleteInquireCondition(InquireCondition inquireCondition, @DatabaseShardingBy String dataSourceId, @TableShardingBy Long supplierCode);
+    //endregion
+
+    //region分厂档案
+    @Sharding(databaseShardingStrategy = SupplierDataBaseShardingStrategy.class, tableShardingStrategy = SupplierTableShardingStrategy.class)
+    @DAOMethod(operator = OperatorType.QUERY, owait = OperatorWait.AWAIT)
+    @SqlId(clazz = DocDao.class, sql = "selectCompanyInfo", table = "tbCompanyInfo", params = {1})
+    List<CompanyInfo> selectCompanyInfo(RMap params, @DatabaseShardingBy String dataSourceId, @TableShardingBy Long supplierCode, PageFlipper pageFlipper);
+
+    @Sharding(databaseShardingStrategy = SupplierDataBaseShardingStrategy.class, tableShardingStrategy = SupplierTableShardingStrategy.class)
+    @DAOMethod(operator = OperatorType.UPDATE, owait = OperatorWait.ASNYC)
+    @SqlId(clazz = DocDao.class, sql = "addCompanyInfo", table = "tbCompanyInfo", params = {1})
+    int addCompanyInfo(CompanyInfo companyInfo, @DatabaseShardingBy String dataSourceId, @TableShardingBy Long supplierCode);
+
+    @Sharding(databaseShardingStrategy = SupplierDataBaseShardingStrategy.class, tableShardingStrategy = SupplierTableShardingStrategy.class)
+    @DAOMethod(operator = OperatorType.UPDATE, owait = OperatorWait.ASNYC)
+    @SqlId(clazz = DocDao.class, sql = "updateCompanyInfo", table = "tbCompanyInfo", params = {1})
+    int updateCompanyInfo(CompanyInfo companyInfo, @DatabaseShardingBy String dataSourceId, @TableShardingBy Long supplierCode);
+
+    @Sharding(databaseShardingStrategy = SupplierDataBaseShardingStrategy.class, tableShardingStrategy = SupplierTableShardingStrategy.class)
+    @DAOMethod(operator = OperatorType.UPDATE, owait = OperatorWait.ASNYC)
+    @SqlId(clazz = DocDao.class, sql = "voidCompanyInfo", table = "tbCompanyInfo", params = {1})
+    int voidCompanyInfo(CompanyInfo companyInfo, @DatabaseShardingBy String dataSourceId, @TableShardingBy Long supplierCode);
+    //endregion
+}

+ 15 - 0
yjBusiness/src/main/java/com/yinjie/heating/business/dao/LoginDao.java

@@ -0,0 +1,15 @@
+package com.yinjie.heating.business.dao;
+
+import com.yinjie.heating.common.entity.system.LoginUser;
+import com.dySweetFishPlugin.sql.dao.*;
+import org.rex.RMap;
+
+@SuppressWarnings("rawtypes")
+public interface LoginDao extends DaoRepository {
+
+    @Sharding(databaseShardingStrategy = SupplierDataBaseShardingStrategy.class, tableShardingStrategy = SupplierTableShardingStrategy.class)
+    @DAOMethod(operator = OperatorType.QUERY, owait = OperatorWait.AWAIT)
+    @SqlId(clazz = LoginDao.class, sql = "login", table = "tbUser", params = {1})
+    LoginUser login(RMap params, @DatabaseShardingBy String dataSourceId, @TableShardingBy Long supplierCode);
+
+}

+ 24 - 0
yjBusiness/src/main/java/com/yinjie/heating/business/dao/OrderTableShardingStrategy.java

@@ -0,0 +1,24 @@
+package com.yinjie.heating.business.dao;
+
+import com.dySweetFishPlugin.sql.dao.TableShardingStrategy;
+
+/**
+ * Created by jlutt on 2020-08-11
+ *
+ * @author jlutt
+ */
+public class OrderTableShardingStrategy implements TableShardingStrategy<String> {
+
+    /**
+     * 获得分表后的表名
+     *
+     */
+    @Override
+    public String getTargetTable(String table, String shardingParameter) {
+        if (shardingParameter.contains("_")) {
+            return table + shardingParameter.split("_")[0] + "_current";
+        } else {
+            return table + shardingParameter + "_current";
+        }
+    }
+}

+ 16 - 0
yjBusiness/src/main/java/com/yinjie/heating/business/dao/SupplierDataBaseShardingStrategy.java

@@ -0,0 +1,16 @@
+package com.yinjie.heating.business.dao;
+
+import com.dySweetFishPlugin.sql.dao.DatabaseShardingStrategy;
+
+/**
+ * Created by 81460 on 2020-03-25
+ *
+ * @author 81460
+ */
+public class SupplierDataBaseShardingStrategy implements DatabaseShardingStrategy<String> {
+
+    @Override
+    public String getDataSourceName(String shardingParameter) {
+        return shardingParameter;
+    }
+}

+ 10 - 0
yjBusiness/src/main/java/com/yinjie/heating/business/dao/SupplierTableShardingStrategy.java

@@ -0,0 +1,10 @@
+package com.yinjie.heating.business.dao;
+
+import com.dySweetFishPlugin.sql.dao.TableShardingStrategy;
+
+public class SupplierTableShardingStrategy implements TableShardingStrategy<Long> {
+    @Override
+    public String getTargetTable(String table, Long shardingParameter) {
+        return table + shardingParameter;
+    }
+}

+ 397 - 0
yjBusiness/src/main/java/com/yinjie/heating/business/dao/SystemDao.java

@@ -0,0 +1,397 @@
+package com.yinjie.heating.business.dao;
+
+import com.yinjie.heating.common.entity.site.ERPUploadFile;
+import com.yinjie.heating.common.entity.system.*;
+import com.dySweetFishPlugin.sql.dao.*;
+import com.sweetfish.source.PageFlipper;
+import org.rex.RMap;
+
+import java.util.List;
+
+/**
+ * Created by jlutt on 2020-07-29
+ *
+ * @author jlutt
+ */
+@SuppressWarnings("rawtypes")
+public interface SystemDao extends DaoRepository {
+
+    @Sharding(databaseShardingStrategy = SupplierDataBaseShardingStrategy.class, tableShardingStrategy = SupplierTableShardingStrategy.class)
+    @DAOMethod(operator = OperatorType.QUERY, owait = OperatorWait.AWAIT)
+    @SqlId(clazz = SystemDao.class, sql = "login", table = "tbUser", params = {1})
+    LoginUser login(RMap params, @DatabaseShardingBy String dataSourceId, @TableShardingBy Long supplierCode);
+
+    @Sharding(databaseShardingStrategy = SupplierDataBaseShardingStrategy.class, tableShardingStrategy = SupplierTableShardingStrategy.class)
+    @DAOMethod(operator = OperatorType.QUERY, cache = true, owait = OperatorWait.AWAIT)
+    @SqlId(clazz = SystemDao.class, sql = "getUserInfo", table = "tbUser", params = {1})
+    LoginUser getUserInfo(RMap params, @DatabaseShardingBy String dataSourceId, @TableShardingBy Long supplierCode);
+
+    @Sharding(databaseShardingStrategy = SupplierDataBaseShardingStrategy.class, tableShardingStrategy = SupplierTableShardingStrategy.class)
+    @DAOMethod(operator = OperatorType.QUERY, owait = OperatorWait.AWAIT)
+    @SqlId(clazz = SystemDao.class, sql = "queryLoginUsers", table = "tbUser,tbDept", params = {1})
+    List<LoginUser> queryLoginUsers(RMap params, PageFlipper pageFlipper, @DatabaseShardingBy String dataSourceId, @TableShardingBy Long supplierCode);
+
+    //注意mysql select count 返回的是long类型,不能像sql server用int做返回值
+    @Sharding(databaseShardingStrategy = SupplierDataBaseShardingStrategy.class, tableShardingStrategy = SupplierTableShardingStrategy.class)
+    @DAOMethod(operator = OperatorType.QUERY, owait = OperatorWait.AWAIT)
+    @SqlId(clazz = SystemDao.class, sql = "accountExists", table = "tbUser", params = {1})
+    long accountExists(RMap params, @DatabaseShardingBy String dataSourceId, @TableShardingBy Long supplierCode);
+
+    @Sharding(databaseShardingStrategy = SupplierDataBaseShardingStrategy.class, tableShardingStrategy = SupplierTableShardingStrategy.class)
+    @DAOMethod(operator = OperatorType.UPDATE, owait = OperatorWait.ASNYC)
+    @SqlId(clazz = SystemDao.class, sql = "insertLoginUser", table = "tbUser", params = {1}, sort = 1)
+    @SqlId(clazz = SystemDao.class, sql = "insertUserRole", table = "tbUserRole", params = {2}, sort = 2)
+    int addLoginUser(LoginUser userInfo, List<UserRole> roleList, @DatabaseShardingBy String dataSourceId, @TableShardingBy Long supplierCode);
+
+    @Sharding(databaseShardingStrategy = SupplierDataBaseShardingStrategy.class, tableShardingStrategy = SupplierTableShardingStrategy.class)
+    @DAOMethod(operator = OperatorType.UPDATE, owait = OperatorWait.ASNYC)
+    @SqlId(clazz = SystemDao.class, sql = "insertLoginUser", table = "tbUser", params = {1}, sort = 1)
+    int addLoginUser2(LoginUser userInfo, @DatabaseShardingBy String dataSourceId, @TableShardingBy Long supplierCode);
+
+    @Sharding(databaseShardingStrategy = SupplierDataBaseShardingStrategy.class, tableShardingStrategy = SupplierTableShardingStrategy.class)
+    @DAOMethod(operator = OperatorType.UPDATE, owait = OperatorWait.ASNYC)
+    @SqlId(clazz = SystemDao.class, sql = "updateLoginUser", table = "tbUser", params = {1}, sort = 1)
+    @SqlId(clazz = SystemDao.class, sql = "clearUserRole", table = "tbUserRole", params = {2}, sort = 2)
+    @SqlId(clazz = SystemDao.class, sql = "insertUserRole", table = "tbUserRole", params = {3}, sort = 3)
+    int updateLoginUser(LoginUser userInfo, RMap params, List<UserRole> roleList, @DatabaseShardingBy String dataSourceId, @TableShardingBy Long supplierCode);
+
+    @Sharding(databaseShardingStrategy = SupplierDataBaseShardingStrategy.class, tableShardingStrategy = SupplierTableShardingStrategy.class)
+    @DAOMethod(operator = OperatorType.UPDATE, owait = OperatorWait.ASNYC)
+    @SqlId(clazz = SystemDao.class, sql = "clearUserRole", table = "tbUserRole", params = {1}, sort = 1)
+    @SqlId(clazz = SystemDao.class, sql = "insertUserRole", table = "tbUserRole", params = {2}, sort = 2)
+    int configLoginUserRole(RMap params, List<UserRole> roleList, @DatabaseShardingBy String dataSourceId, @TableShardingBy Long supplierCode);
+
+    @Sharding(databaseShardingStrategy = SupplierDataBaseShardingStrategy.class, tableShardingStrategy = SupplierTableShardingStrategy.class)
+    @DAOMethod(operator = OperatorType.UPDATE, owait = OperatorWait.ASNYC)
+    @SqlId(clazz = SystemDao.class, sql = "updateLoginUser", table = "tbUser", params = {1}, sort = 1)
+    int updateLoginUser2(LoginUser userInfo, @DatabaseShardingBy String dataSourceId, @TableShardingBy Long supplierCode);
+
+    @Sharding(databaseShardingStrategy = SupplierDataBaseShardingStrategy.class, tableShardingStrategy = SupplierTableShardingStrategy.class)
+    @DAOMethod(operator = OperatorType.UPDATE, owait = OperatorWait.ASNYC)
+    @SqlId(clazz = SystemDao.class, sql = "voidLoginUser", table = "tbUser", params = {1})
+    int voidLoginUser(LoginUser userInfo, @DatabaseShardingBy String dataSourceId, @TableShardingBy Long supplierCode);
+
+    @Sharding(databaseShardingStrategy = SupplierDataBaseShardingStrategy.class, tableShardingStrategy = SupplierTableShardingStrategy.class)
+    @DAOMethod(operator = OperatorType.UPDATE, owait = OperatorWait.ASNYC)
+    @SqlId(clazz = SystemDao.class, sql = "resetLoginUser", table = "tbUser", params = {1})
+    int resetLoginUser(LoginUser userInfo, @DatabaseShardingBy String dataSourceId, @TableShardingBy Long supplierCode);
+
+    @Sharding(databaseShardingStrategy = SupplierDataBaseShardingStrategy.class, tableShardingStrategy = SupplierTableShardingStrategy.class)
+    @DAOMethod(operator = OperatorType.UPDATE, owait = OperatorWait.ASNYC)
+    @SqlId(clazz = SystemDao.class, sql = "changeMyPassword", table = "tbUser", params = {1})
+    int changeMyPassword(RMap params, @DatabaseShardingBy String dataSourceId, @TableShardingBy Long supplierCode);
+
+    @Sharding(databaseShardingStrategy = SupplierDataBaseShardingStrategy.class, tableShardingStrategy = SupplierTableShardingStrategy.class)
+    @DAOMethod(operator = OperatorType.QUERY, cache = true, owait = OperatorWait.AWAIT)
+    @SqlId(clazz = SystemDao.class, sql = "queryAllMenus", table = "tbMenu", params = {1})
+    List<Menu> queryAllMenus(RMap params, @DatabaseShardingBy String dataSourceId, @TableShardingBy Long supplierCode);
+
+    @Sharding(databaseShardingStrategy = SupplierDataBaseShardingStrategy.class, tableShardingStrategy = SupplierTableShardingStrategy.class)
+    @DAOMethod(operator = OperatorType.QUERY, cache = true, owait = OperatorWait.AWAIT)
+    @SqlId(clazz = SystemDao.class, sql = "queryAllRoles", table = "tbRole", params = {1})
+    List<Role> queryAllRoles(RMap params, @DatabaseShardingBy String dataSourceId, @TableShardingBy Long supplierCode);
+
+    @Sharding(databaseShardingStrategy = SupplierDataBaseShardingStrategy.class, tableShardingStrategy = SupplierTableShardingStrategy.class)
+    @DAOMethod(operator = OperatorType.QUERY, cache = true, owait = OperatorWait.AWAIT)
+    @SqlId(clazz = SystemDao.class, sql = "queryRoleMenus", table = "tbRoleMenu,tbMenu", params = {1})
+    List<RoleMenu> queryRoleMenus(RMap params, @DatabaseShardingBy String dataSourceId, @TableShardingBy Long supplierCode);
+
+    @Sharding(databaseShardingStrategy = SupplierDataBaseShardingStrategy.class, tableShardingStrategy = SupplierTableShardingStrategy.class)
+    @DAOMethod(operator = OperatorType.QUERY, cache = true, owait = OperatorWait.AWAIT)
+    @SqlId(clazz = SystemDao.class, sql = "queryRoleActions", table = "tbRoleMenu,tbMenu", params = {1})
+    List<RoleMenu> queryRoleActions(RMap params, @DatabaseShardingBy String dataSourceId, @TableShardingBy Long supplierCode);
+
+    @Sharding(databaseShardingStrategy = SupplierDataBaseShardingStrategy.class, tableShardingStrategy = SupplierTableShardingStrategy.class)
+    @DAOMethod(operator = OperatorType.QUERY, cache = true, owait = OperatorWait.AWAIT)
+    @SqlId(clazz = SystemDao.class, sql = "queryUserRoles", table = "tbUserRole", params = {1})
+    List<UserRole> queryUserRoles(RMap params, @DatabaseShardingBy String dataSourceId, @TableShardingBy Long idSupplier);
+
+    @Sharding(databaseShardingStrategy = SupplierDataBaseShardingStrategy.class, tableShardingStrategy = SupplierTableShardingStrategy.class)
+    @DAOMethod(operator = OperatorType.QUERY, cache = true, owait = OperatorWait.AWAIT)
+    @SqlId(clazz = SystemDao.class, sql = "queryMenuRoles", table = "tbRoleMenu,tbRole", params = {1})
+    List<Role> queryMenuRoles(RMap params, PageFlipper pageFlipper, @DatabaseShardingBy String dataSourceId, @TableShardingBy Long supplierCode);
+
+    @Sharding(databaseShardingStrategy = SupplierDataBaseShardingStrategy.class, tableShardingStrategy = SupplierTableShardingStrategy.class)
+    @DAOMethod(operator = OperatorType.QUERY, cache = true, owait = OperatorWait.AWAIT)
+    @SqlId(clazz = SystemDao.class, sql = "queryRoleUsers", table = "tbUserRole,tbUser", params = {1})
+    List<LoginUser> queryRoleUsers(RMap params, PageFlipper pageFlipper, @DatabaseShardingBy String dataSourceId, @TableShardingBy Long supplierCode);
+
+    @Sharding(databaseShardingStrategy = SupplierDataBaseShardingStrategy.class, tableShardingStrategy = SupplierTableShardingStrategy.class)
+    @DAOMethod(operator = OperatorType.QUERY, cache = true, owait = OperatorWait.AWAIT)
+    @SqlId(clazz = SystemDao.class, sql = "queryAllDepts", table = "tbDept", params = {1})
+    List<Dept> queryAllDepts(RMap params, @DatabaseShardingBy String dataSourceId, @TableShardingBy Long idSupplier);
+
+    @Sharding(databaseShardingStrategy = SupplierDataBaseShardingStrategy.class, tableShardingStrategy = SupplierTableShardingStrategy.class)
+    @DAOMethod(operator = OperatorType.UPDATE, owait = OperatorWait.ASNYC)
+    @SqlId(clazz = SystemDao.class, sql = "addDept", table = "tbDept", params = {1})
+    int addDept(Dept dept, @DatabaseShardingBy String dataSourceId, @TableShardingBy Long idSupplier);
+
+    @Sharding(databaseShardingStrategy = SupplierDataBaseShardingStrategy.class, tableShardingStrategy = SupplierTableShardingStrategy.class)
+    @DAOMethod(operator = OperatorType.UPDATE, owait = OperatorWait.ASNYC)
+    @SqlId(clazz = SystemDao.class, sql = "updateDept", table = "tbDept", params = {1})
+    int updateDept(Dept dept, @DatabaseShardingBy String dataSourceId, @TableShardingBy Long idSupplier);
+
+    @Sharding(databaseShardingStrategy = SupplierDataBaseShardingStrategy.class, tableShardingStrategy = SupplierTableShardingStrategy.class)
+    @DAOMethod(operator = OperatorType.UPDATE, owait = OperatorWait.ASNYC)
+    @SqlId(clazz = SystemDao.class, sql = "voidDept", table = "tbDept", params = {1})
+    int voidDept(Dept dept, @DatabaseShardingBy String dataSourceId, @TableShardingBy Long idSupplier);
+
+    @Sharding(databaseShardingStrategy = SupplierDataBaseShardingStrategy.class, tableShardingStrategy = SupplierTableShardingStrategy.class)
+    @DAOMethod(operator = OperatorType.UPDATE, owait = OperatorWait.ASNYC)
+    @SqlId(clazz = SystemDao.class, sql = "insertMenu", table = "tbMenu", params = {1})
+    int addMenu(Menu menu, @DatabaseShardingBy String dataSourceId, @TableShardingBy Long idSupplier);
+
+    @Sharding(databaseShardingStrategy = SupplierDataBaseShardingStrategy.class, tableShardingStrategy = SupplierTableShardingStrategy.class)
+    @DAOMethod(operator = OperatorType.UPDATE, owait = OperatorWait.ASNYC)
+    @SqlId(clazz = SystemDao.class, sql = "updateMenu", table = "tbMenu", params = {1})
+    int updateMenu(Menu menu, @DatabaseShardingBy String dataSourceId, @TableShardingBy Long idSupplier);
+
+    @Sharding(databaseShardingStrategy = SupplierDataBaseShardingStrategy.class, tableShardingStrategy = SupplierTableShardingStrategy.class)
+    @DAOMethod(operator = OperatorType.UPDATE, owait = OperatorWait.ASNYC)
+    @SqlId(clazz = SystemDao.class, sql = "voidMenu", table = "tbMenu", params = {1})
+    int voidMenu(Menu menu, @DatabaseShardingBy String dataSourceId, @TableShardingBy Long idSupplier);
+
+    @Sharding(databaseShardingStrategy = SupplierDataBaseShardingStrategy.class, tableShardingStrategy = SupplierTableShardingStrategy.class)
+    @DAOMethod(operator = OperatorType.QUERY, owait = OperatorWait.AWAIT)
+    @SqlId(clazz = SystemDao.class, sql = "queryAllRoles", table = "tbRole", params = {1})
+    List<Role> selectRolePage(RMap params, PageFlipper pageFlipper, @DatabaseShardingBy String dataSourceId, @TableShardingBy Long idSupplier);
+
+    @Sharding(databaseShardingStrategy = SupplierDataBaseShardingStrategy.class, tableShardingStrategy = SupplierTableShardingStrategy.class)
+    @DAOMethod(operator = OperatorType.UPDATE, owait = OperatorWait.ASNYC)
+    @SqlId(clazz = SystemDao.class, sql = "insertRole", table = "tbRole", params = {1}, sort = 1)
+    @SqlId(clazz = SystemDao.class, sql = "insertRoleMenu", table = "tbRoleMenu", params = {2}, sort = 2)
+    int addRole(Role role, List<RoleMenu> menuList, @DatabaseShardingBy String dataSourceId, @TableShardingBy Long idSupplier);
+
+    @Sharding(databaseShardingStrategy = SupplierDataBaseShardingStrategy.class, tableShardingStrategy = SupplierTableShardingStrategy.class)
+    @DAOMethod(operator = OperatorType.UPDATE, owait = OperatorWait.ASNYC)
+    @SqlId(clazz = SystemDao.class, sql = "updateRole", table = "tbRole", params = {1}, sort = 1)
+    @SqlId(clazz = SystemDao.class, sql = "clearRoleMenu", table = "tbRoleMenu", params = {2}, sort = 2)
+    @SqlId(clazz = SystemDao.class, sql = "insertRoleMenu", table = "tbRoleMenu", params = {3}, sort = 3)
+    int updateRole(Role role, RMap params, List<RoleMenu> menuList, @DatabaseShardingBy String dataSourceId, @TableShardingBy Long idSupplier);
+
+    @Sharding(databaseShardingStrategy = SupplierDataBaseShardingStrategy.class, tableShardingStrategy = SupplierTableShardingStrategy.class)
+    @DAOMethod(operator = OperatorType.UPDATE, owait = OperatorWait.ASNYC)
+    @SqlId(clazz = SystemDao.class, sql = "voidRole", table = "tbRole", params = {1})
+    int voidRole(Role role, @DatabaseShardingBy String dataSourceId, @TableShardingBy Long idSupplier);
+
+    @Sharding(databaseShardingStrategy = SupplierDataBaseShardingStrategy.class, tableShardingStrategy = SupplierTableShardingStrategy.class)
+    @DAOMethod(operator = OperatorType.UPDATE, owait = OperatorWait.ASNYC)
+    @SqlId(clazz = SystemDao.class, sql = "insertERPFile", table = "tbERPUploadFile", params = {1}, sort = 1)
+    int insertERPFile(ERPUploadFile erpUploadFile, @DatabaseShardingBy String dataSourceId, @TableShardingBy Long supplierCode);
+
+    //region 系统配置
+
+    @Sharding(databaseShardingStrategy = SupplierDataBaseShardingStrategy.class, tableShardingStrategy = SupplierTableShardingStrategy.class)
+    @DAOMethod(operator = OperatorType.QUERY, cache = true, owait = OperatorWait.AWAIT)
+    @SqlId(clazz = SystemDao.class, sql = "queryAllConfig", table = "tbConfigValue", params = {1})
+    List<ConfigValue> queryAllConfigValues(RMap params, @DatabaseShardingBy String dataSourceId, @TableShardingBy Long idSupplier);
+
+    @Sharding(databaseShardingStrategy = SupplierDataBaseShardingStrategy.class, tableShardingStrategy = SupplierTableShardingStrategy.class)
+    @DAOMethod(operator = OperatorType.QUERY, cache = true, owait = OperatorWait.AWAIT)
+    @SqlId(clazz = SystemDao.class, sql = "queryConfig", table = "tbConfigValue", params = {1})
+    ConfigValue queryConfigValue(RMap params, @DatabaseShardingBy String dataSourceId, @TableShardingBy Long idSupplier);
+
+    @Sharding(databaseShardingStrategy = SupplierDataBaseShardingStrategy.class, tableShardingStrategy = SupplierTableShardingStrategy.class)
+    @DAOMethod(operator = OperatorType.UPDATE, owait = OperatorWait.ASNYC)
+    @SqlId(clazz = SystemDao.class, sql = "insertConfigValue", table = "tbConfigValue", params = {1})
+    int addConfigValue(ConfigValue configValue, @DatabaseShardingBy String dataSourceId, @TableShardingBy Long idSupplier);
+
+    @Sharding(databaseShardingStrategy = SupplierDataBaseShardingStrategy.class, tableShardingStrategy = SupplierTableShardingStrategy.class)
+    @DAOMethod(operator = OperatorType.UPDATE, owait = OperatorWait.SYNC)
+    @SqlId(clazz = SystemDao.class, sql = "insertConfigValue", table = "tbConfigValue", params = {1})
+    int addConfigValueSync(ConfigValue configValue, @DatabaseShardingBy String dataSourceId, @TableShardingBy Long idSupplier);
+
+    @Sharding(databaseShardingStrategy = SupplierDataBaseShardingStrategy.class, tableShardingStrategy = SupplierTableShardingStrategy.class)
+    @DAOMethod(operator = OperatorType.UPDATE, owait = OperatorWait.ASNYC)
+    @SqlId(clazz = SystemDao.class, sql = "updateConfigValue", table = "tbConfigValue", params = {1})
+    int updateConfigValue(ConfigValue configValue, @DatabaseShardingBy String dataSourceId, @TableShardingBy Long idSupplier);
+
+    @Sharding(databaseShardingStrategy = SupplierDataBaseShardingStrategy.class, tableShardingStrategy = SupplierTableShardingStrategy.class)
+    @DAOMethod(operator = OperatorType.UPDATE, owait = OperatorWait.ASNYC)
+    @SqlId(clazz = SystemDao.class, sql = "updateOnlyConfigValue", table = "tbConfigValue", params = {1})
+    int updateBatchConfigValue(List<ConfigValue> valueList, @DatabaseShardingBy String dataSourceId, @TableShardingBy Long idSupplier);
+
+    @Sharding(databaseShardingStrategy = SupplierDataBaseShardingStrategy.class, tableShardingStrategy = SupplierTableShardingStrategy.class)
+    @DAOMethod(operator = OperatorType.UPDATE, owait = OperatorWait.ASNYC)
+    @SqlId(clazz = SystemDao.class, sql = "deleteConfigValue", table = "tbConfigValue", params = {1})
+    int deleteConfigValue(ConfigValue configValue, @DatabaseShardingBy String dataSourceId, @TableShardingBy Long idSupplier);
+
+    //endregion
+
+    //region 字典管理
+
+    @Sharding(databaseShardingStrategy = SupplierDataBaseShardingStrategy.class, tableShardingStrategy = SupplierTableShardingStrategy.class)
+    @DAOMethod(operator = OperatorType.QUERY, owait = OperatorWait.AWAIT)
+    @SqlId(clazz = SystemDao.class, sql = "queryDictTypes", table = "tbDictType", params = {1})
+    List<DictType> queryDictTypes(RMap params, @DatabaseShardingBy String dataSourceId, @TableShardingBy Long idSupplier, PageFlipper pageFlipper);
+
+    @Sharding(databaseShardingStrategy = SupplierDataBaseShardingStrategy.class, tableShardingStrategy = SupplierTableShardingStrategy.class)
+    @DAOMethod(operator = OperatorType.UPDATE, owait = OperatorWait.ASNYC)
+    @SqlId(clazz = SystemDao.class, sql = "addDictType", table = "tbDictType", params = {1})
+    int addDictType(DictType dictType, @DatabaseShardingBy String dataSourceId, @TableShardingBy Long idSupplier);
+
+    @Sharding(databaseShardingStrategy = SupplierDataBaseShardingStrategy.class, tableShardingStrategy = SupplierTableShardingStrategy.class)
+    @DAOMethod(operator = OperatorType.UPDATE, owait = OperatorWait.ASNYC)
+    @SqlId(clazz = SystemDao.class, sql = "updateDictType", table = "tbDictType", params = {1})
+    int updateDictType(DictType dictType, @DatabaseShardingBy String dataSourceId, @TableShardingBy Long idSupplier);
+
+    @Sharding(databaseShardingStrategy = SupplierDataBaseShardingStrategy.class, tableShardingStrategy = SupplierTableShardingStrategy.class)
+    @DAOMethod(operator = OperatorType.UPDATE, owait = OperatorWait.ASNYC)
+    @SqlId(clazz = SystemDao.class, sql = "voidDictType", table = "tbDictType", params = {1})
+    int voidDictType(DictType dictType, @DatabaseShardingBy String dataSourceId, @TableShardingBy Long idSupplier);
+
+    @Sharding(databaseShardingStrategy = SupplierDataBaseShardingStrategy.class, tableShardingStrategy = SupplierTableShardingStrategy.class)
+    @DAOMethod(operator = OperatorType.QUERY, owait = OperatorWait.AWAIT)
+    @SqlId(clazz = SystemDao.class, sql = "queryDictDatas", table = "tbDictData", params = {1})
+    List<DictData> queryDictDatas(RMap params, @DatabaseShardingBy String dataSourceId, @TableShardingBy Long idSupplier, PageFlipper pageFlipper);
+
+    @Sharding(databaseShardingStrategy = SupplierDataBaseShardingStrategy.class, tableShardingStrategy = SupplierTableShardingStrategy.class)
+    @DAOMethod(operator = OperatorType.UPDATE, owait = OperatorWait.ASNYC)
+    @SqlId(clazz = SystemDao.class, sql = "addDictData", table = "tbDictData", params = {1})
+    int addDictData(DictData dictData, @DatabaseShardingBy String dataSourceId, @TableShardingBy Long idSupplier);
+
+    @Sharding(databaseShardingStrategy = SupplierDataBaseShardingStrategy.class, tableShardingStrategy = SupplierTableShardingStrategy.class)
+    @DAOMethod(operator = OperatorType.UPDATE, owait = OperatorWait.ASNYC)
+    @SqlId(clazz = SystemDao.class, sql = "updateDictData", table = "tbDictData", params = {1})
+    int updateDictData(DictData dictData, @DatabaseShardingBy String dataSourceId, @TableShardingBy Long idSupplier);
+
+    @Sharding(databaseShardingStrategy = SupplierDataBaseShardingStrategy.class, tableShardingStrategy = SupplierTableShardingStrategy.class)
+    @DAOMethod(operator = OperatorType.UPDATE, owait = OperatorWait.ASNYC)
+    @SqlId(clazz = SystemDao.class, sql = "voidDictData", table = "tbDictData", params = {1})
+    int voidDictData(DictData dictData, @DatabaseShardingBy String dataSourceId, @TableShardingBy Long idSupplier);
+
+    //endregion
+
+    //region 消息类型
+
+    @Sharding(databaseShardingStrategy = SupplierDataBaseShardingStrategy.class, tableShardingStrategy = SupplierTableShardingStrategy.class)
+    @DAOMethod(operator = OperatorType.QUERY, owait = OperatorWait.AWAIT)
+    @SqlId(clazz = SystemDao.class, sql = "selectAllNoticeMessage", table = "tbNoticeMessage", params = {1})
+    List<NoticeMessage> selectAllNoticeMessage(RMap params, @DatabaseShardingBy String dataSourceId, @TableShardingBy Long supplierCode);
+
+    @Sharding(databaseShardingStrategy = SupplierDataBaseShardingStrategy.class, tableShardingStrategy = SupplierTableShardingStrategy.class)
+    @DAOMethod(operator = OperatorType.UPDATE, owait = OperatorWait.ASNYC)
+    @SqlId(clazz = SystemDao.class, sql = "addNoticeMessage", table = "tbNoticeMessage", params = {1})
+    int addNoticeMessage(NoticeMessage noticeMessage, @DatabaseShardingBy String dataSourceId, @TableShardingBy Long idSupplier);
+
+    @Sharding(databaseShardingStrategy = SupplierDataBaseShardingStrategy.class, tableShardingStrategy = SupplierTableShardingStrategy.class)
+    @DAOMethod(operator = OperatorType.UPDATE, owait = OperatorWait.ASNYC)
+    @SqlId(clazz = SystemDao.class, sql = "updateNoticeMessage", table = "tbNoticeMessage", params = {1})
+    int updateNoticeMessage(NoticeMessage noticeMessage, @DatabaseShardingBy String dataSourceId, @TableShardingBy Long idSupplier);
+
+    @Sharding(databaseShardingStrategy = SupplierDataBaseShardingStrategy.class, tableShardingStrategy = SupplierTableShardingStrategy.class)
+    @DAOMethod(operator = OperatorType.UPDATE, owait = OperatorWait.ASNYC)
+    @SqlId(clazz = SystemDao.class, sql = "voidNoticeMessage", table = "tbNoticeMessage", params = {1})
+    int voidNoticeMessage(NoticeMessage noticeMessage, @DatabaseShardingBy String dataSourceId, @TableShardingBy Long idSupplier);
+
+    @Sharding(databaseShardingStrategy = SupplierDataBaseShardingStrategy.class, tableShardingStrategy = SupplierTableShardingStrategy.class)
+    @DAOMethod(operator = OperatorType.QUERY, owait = OperatorWait.AWAIT)
+    @SqlId(clazz = SystemDao.class, sql = "selectUserNoticeMessage", table = "tbUserNoticeMessage,tbNoticeMessage", params = {1})
+    List<UserNoticeMessage> selectUserNoticeMessage(RMap params, PageFlipper pageFlipper, @DatabaseShardingBy String dataSourceId, @TableShardingBy Long supplierCode);
+
+    @Sharding(databaseShardingStrategy = SupplierDataBaseShardingStrategy.class, tableShardingStrategy = SupplierTableShardingStrategy.class)
+    @DAOMethod(operator = OperatorType.UPDATE, owait = OperatorWait.ASNYC)
+    @SqlId(clazz = SystemDao.class, sql = "addUserNoticeMessage", table = "tbUserNoticeMessage", params = {1})
+    int addUserNoticeMessage(UserNoticeMessage userNoticeMessage, @DatabaseShardingBy String dataSourceId, @TableShardingBy Long idSupplier);
+
+    @Sharding(databaseShardingStrategy = SupplierDataBaseShardingStrategy.class, tableShardingStrategy = SupplierTableShardingStrategy.class)
+    @DAOMethod(operator = OperatorType.UPDATE, owait = OperatorWait.ASNYC)
+    @SqlId(clazz = SystemDao.class, sql = "deleteNoticeMessage", table = "tbUserNoticeMessage", params = {1})
+    int deleteNoticeMessage(UserNoticeMessage userNoticeMessage, @DatabaseShardingBy String dataSourceId, @TableShardingBy Long idSupplier);
+
+
+    //endregion
+
+    //region 个人配置
+
+    @Sharding(databaseShardingStrategy = SupplierDataBaseShardingStrategy.class, tableShardingStrategy = SupplierTableShardingStrategy.class)
+    @DAOMethod(operator = OperatorType.QUERY, owait = OperatorWait.AWAIT)
+    @SqlId(clazz = SystemDao.class, sql = "queryPersonConfigValue", table = "tbPersonConfigValue", params = {1})
+    List<PersonConfigValue> queryPersonConfigValue(RMap params, PageFlipper pageFlipper, @DatabaseShardingBy String dataSourceId, @TableShardingBy Long supplierCode);
+
+    @Sharding(databaseShardingStrategy = SupplierDataBaseShardingStrategy.class, tableShardingStrategy = SupplierTableShardingStrategy.class)
+    @DAOMethod(operator = OperatorType.UPDATE, owait = OperatorWait.ASNYC)
+    @SqlId(clazz = SystemDao.class, sql = "addPersonConfigValue", table = "tbPersonConfigValue", params = {1}, sort = 1)
+    int addPersonConfigValue(PersonConfigValue configValue, @DatabaseShardingBy String dataSourceId, @TableShardingBy Long supplierCode);
+
+    @Sharding(databaseShardingStrategy = SupplierDataBaseShardingStrategy.class, tableShardingStrategy = SupplierTableShardingStrategy.class)
+    @DAOMethod(operator = OperatorType.UPDATE, owait = OperatorWait.ASNYC)
+    @SqlId(clazz = SystemDao.class, sql = "updatePersonConfigValue", table = "tbPersonConfigValue", params = {1}, sort = 1)
+    int updatePersonConfigValue(PersonConfigValue configValue, @DatabaseShardingBy String dataSourceId, @TableShardingBy Long supplierCode);
+
+    //endregion
+
+    //region 数据权限
+
+    @Sharding(databaseShardingStrategy = SupplierDataBaseShardingStrategy.class, tableShardingStrategy = SupplierTableShardingStrategy.class)
+    @DAOMethod(operator = OperatorType.QUERY, owait = OperatorWait.AWAIT)
+    @SqlId(clazz = SystemDao.class, sql = "selectDataPurview", table = "tbDataPurview", params = {1})
+    List<DataPurview> selectDataPurview(RMap params, PageFlipper pageFlipper, @DatabaseShardingBy String dataSourceId, @TableShardingBy Long idSupplier);
+
+    @Sharding(databaseShardingStrategy = SupplierDataBaseShardingStrategy.class, tableShardingStrategy = SupplierTableShardingStrategy.class)
+    @DAOMethod(operator = OperatorType.UPDATE, owait = OperatorWait.ASNYC)
+    @SqlId(clazz = SystemDao.class, sql = "addDataPurview", table = "tbDataPurview", params = {1})
+    int addDataPurview(List<DataPurview> dataPurviewList, @DatabaseShardingBy String dataSourceId, @TableShardingBy Long idSupplier);
+
+    @Sharding(databaseShardingStrategy = SupplierDataBaseShardingStrategy.class, tableShardingStrategy = SupplierTableShardingStrategy.class)
+    @DAOMethod(operator = OperatorType.UPDATE, owait = OperatorWait.ASNYC)
+    @SqlId(clazz = SystemDao.class, sql = "deleteDataPurview", table = "tbDataPurview", params = {1})
+    int deleteDataPurview(List<DataPurview> dataPurviewList, @DatabaseShardingBy String dataSourceId, @TableShardingBy Long idSupplier);
+
+    //endregion
+
+    //region 导出任务
+
+    @Sharding(databaseShardingStrategy = SupplierDataBaseShardingStrategy.class, tableShardingStrategy = SupplierTableShardingStrategy.class)
+    @DAOMethod(operator = OperatorType.UPDATE, owait = OperatorWait.SYNC)
+    @SqlId(clazz = SystemDao.class, sql = "insertTaskQueue", table = "tbTaskQueue", params = {1}, sort = 1)
+    int saveTaskQueue(TaskQueue taskQueue, @DatabaseShardingBy String dataSourceId, @TableShardingBy Long idSupplier);
+
+    @Sharding(databaseShardingStrategy = SupplierDataBaseShardingStrategy.class, tableShardingStrategy = SupplierTableShardingStrategy.class)
+    @DAOMethod(operator = OperatorType.QUERY, owait = OperatorWait.AWAIT)
+    @SqlId(clazz = SystemDao.class, sql = "selectTaskQueue", table = "tbTaskQueue", params = {1})
+    List<TaskQueue> selectTaskQueue(RMap params, PageFlipper pageFlipper, @DatabaseShardingBy String dataSourceId, @TableShardingBy Long idSupplier);
+
+    //endregion
+
+    //region 页面表格列
+
+    @Sharding(databaseShardingStrategy = SupplierDataBaseShardingStrategy.class, tableShardingStrategy = SupplierTableShardingStrategy.class)
+    @DAOMethod(operator = OperatorType.UPDATE, owait = OperatorWait.ASNYC)
+    @SqlId(clazz = SystemDao.class, sql = "deletePageTableColumn", table = "tbPageTableColumn", params = {1}, sort = 1)
+    @SqlId(clazz = SystemDao.class, sql = "insertPageTableColumn", table = "tbPageTableColumn", params = {2}, sort = 2)
+    int savePageTableColumn(RMap deleteParams, List<PageTableColumn> columnList, @DatabaseShardingBy String dataSourceId, @TableShardingBy Long supplierCode);
+
+    @Sharding(databaseShardingStrategy = SupplierDataBaseShardingStrategy.class, tableShardingStrategy = SupplierTableShardingStrategy.class)
+    @DAOMethod(operator = OperatorType.QUERY, owait = OperatorWait.AWAIT)
+    @SqlId(clazz = SystemDao.class, sql = "selectPageTableColumn", table = "tbPageTableColumn", params = {1}, sort = 1)
+    List<PageTableColumn> selectPageTableColumn(RMap deleteParams, @DatabaseShardingBy String dataSourceId, @TableShardingBy Long supplierCode);
+
+    //endregion
+
+    //region 系统公告
+    @Sharding(databaseShardingStrategy = SupplierDataBaseShardingStrategy.class, tableShardingStrategy = SupplierTableShardingStrategy.class)
+    @DAOMethod(operator = OperatorType.UPDATE, owait = OperatorWait.ASNYC)
+    @SqlId(clazz = SystemDao.class, sql = "insertAnnouncement", table = "tbAnnouncement", tableParam = 4, params = {1}, sort = 1)
+    @SqlId(clazz = SystemDao.class, sql = "insertAnnouncementAttachment", table = "tbAnnouncementAttachment", tableParam = 4, params = {2}, sort = 2)
+    int insertAnnouncement(Announcement announcement, List<AnnouncementAttachment> announcementAttachmentList, @DatabaseShardingBy String dataSourceId, @TableShardingBy Long supplierCode);
+
+    @Sharding(databaseShardingStrategy = SupplierDataBaseShardingStrategy.class, tableShardingStrategy = SupplierTableShardingStrategy.class)
+    @DAOMethod(operator = OperatorType.UPDATE, owait = OperatorWait.ASNYC)
+    @SqlId(clazz = SystemDao.class, sql = "updateAnnouncement", table = "tbAnnouncement", tableParam = 5, params = {1}, sort = 1)
+    @SqlId(clazz = SystemDao.class, sql = "deleteAnnouncementAttachment", table = "tbAnnouncementAttachment", tableParam = 5, params = {2}, sort = 2)
+    @SqlId(clazz = SystemDao.class, sql = "insertAnnouncementAttachment", table = "tbAnnouncementAttachment", tableParam = 5, params = {3}, sort = 3)
+    int updateAnnouncement(Announcement announcement, List<AnnouncementAttachment> deleteAttachmentList,
+                           List<AnnouncementAttachment> insertAttachmentList, @DatabaseShardingBy String dataSourceId, @TableShardingBy Long supplierCode);
+
+    @Sharding(databaseShardingStrategy = SupplierDataBaseShardingStrategy.class, tableShardingStrategy = SupplierTableShardingStrategy.class)
+    @DAOMethod(operator = OperatorType.UPDATE, owait = OperatorWait.ASNYC)
+    @SqlId(clazz = SystemDao.class, sql = "voidAnnouncement", table = "tbAnnouncement", tableParam = 3, params = {1}, sort = 1)
+    int voidAnnouncement(Announcement announcement, @DatabaseShardingBy String dataSourceId, @TableShardingBy Long supplierCode);
+
+    @Sharding(databaseShardingStrategy = SupplierDataBaseShardingStrategy.class, tableShardingStrategy = SupplierTableShardingStrategy.class)
+    @DAOMethod(operator = OperatorType.UPDATE, owait = OperatorWait.ASNYC)
+    @SqlId(clazz = SystemDao.class, sql = "insertAnnouncementAttachmentList", table = "tbAnnouncementAttachment", tableParam = 3, params = {1}, sort = 1)
+    int insertAnnouncementAttachment(List<AnnouncementAttachment> announcementAttachmentList, @DatabaseShardingBy String dataSourceId, @TableShardingBy Long supplierCode);
+    //endregion
+}

+ 16 - 0
yjBusiness/src/main/java/com/yinjie/heating/business/dao/TableIdShardingStrategy.java

@@ -0,0 +1,16 @@
+package com.yinjie.heating.business.dao;
+
+import com.dySweetFishPlugin.sql.dao.TableShardingStrategy;
+
+/**
+ * Created by jlutt on 2018-12-06.
+ *
+ * @author jlutt
+ */
+public class TableIdShardingStrategy implements TableShardingStrategy<String> {
+
+    @Override
+    public String getTargetTable(String table, String shardingParameter) {
+        return table + shardingParameter;
+    }
+}

+ 389 - 0
yjBusiness/src/main/java/com/yinjie/heating/business/service/ConfigServiceImpl.java

@@ -0,0 +1,389 @@
+package com.yinjie.heating.business.service;
+
+import com.yinjie.heating.business.dao.SystemDao;
+import com.yinjie.heating.common.api.ConfigService;
+import com.yinjie.heating.common.api.NoSqlKeysService;
+import com.yinjie.heating.common.base.BaseService;
+import com.yinjie.heating.common.datas.RedisKeys;
+import com.yinjie.heating.common.entity.site.ERPTokenUser;
+import com.yinjie.heating.common.entity.system.ConfigValue;
+import com.yinjie.heating.common.entity.system.PageTableColumn;
+import com.yinjie.heating.common.entity.system.PersonConfigValue;
+import com.dySweetFishPlugin.redis.RedisService;
+import com.dySweetFishPlugin.sql.dao.TunaService;
+import com.sweetfish.convert.json.JsonConvert;
+import com.sweetfish.service.Local;
+import com.sweetfish.service.RetResult;
+import com.sweetfish.util.AnyValue;
+import com.sweetfish.util.AutoLoad;
+import com.sweetfish.util.ResourceType;
+import org.apache.commons.lang3.StringUtils;
+import org.rex.RMap;
+
+import javax.annotation.Resource;
+import java.util.ArrayList;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+@AutoLoad(false)
+@Local
+@ResourceType(ConfigService.class)
+public class ConfigServiceImpl extends BaseService implements ConfigService {
+
+    @Resource
+    RedisService redisService;
+
+    @Resource
+    NoSqlKeysService keysService;
+
+    @Resource
+    JsonConvert jsonConvert;
+
+    @Resource
+    TunaService tunaService;
+
+    private SystemDao systemDao;
+
+    @Override
+    public void init(AnyValue config) {
+        super.init(config);
+    }
+
+    @Override
+    public void destroy(AnyValue config) {
+        super.destroy(config);
+    }
+
+    @Override
+    public void start(AnyValue config) {
+        systemDao = tunaService.generate(SystemDao.class);
+    }
+
+    //region 系统配置管理
+
+    /**
+     * 获取系统配置信息
+     *
+     * @param configKey 配置key
+     * @return 配置信息
+     */
+    @Override
+    public ConfigValue getRedisConfigValue(String configKey, String dataSourceId, long supplierCode) {
+        String json = redisService.hget(keysService.getRedisKey(RedisKeys.KEY_CONFIGVALUE, supplierCode), configKey);
+
+        if (StringUtils.isEmpty(json)) {
+            return null;
+        }
+
+        return jsonConvert.convertFrom(ConfigValue.class, json);
+    }
+
+    /**
+     * 获取配置的第一个参数值long
+     *
+     * @param configKey    配置key
+     * @param dataSourceId 分库
+     * @param supplierCode 分表
+     * @return long
+     */
+    public long getLongRedisConfigValue1(String configKey, String dataSourceId, long supplierCode) {
+        String json = redisService.hget(keysService.getRedisKey(RedisKeys.KEY_CONFIGVALUE, supplierCode), configKey);
+
+        if (StringUtils.isEmpty(json)) {
+            return 0L;
+        }
+
+        ConfigValue value = jsonConvert.convertFrom(ConfigValue.class, json);
+        try {
+            return Long.parseLong(value.getConfigValue1());
+        } catch (NumberFormatException e) {
+            return 0L;
+        }
+    }
+
+    /**
+     * 获取系统配置信息
+     *
+     * @param configKey    配置key
+     * @param dataSourceId 分库
+     * @param supplierCode 分表
+     * @return 配置信息
+     */
+    public List<ConfigValue> getRedisConfigValueMutil(String configKey, String dataSourceId, long supplierCode) {
+        String[] split = configKey.split(",");
+        return getRedisConfigValueList(dataSourceId, supplierCode, split);
+    }
+
+    /**
+     * 获取系统配置信息
+     *
+     * @param dataSourceId 分库
+     * @return 配置信息列表
+     */
+    @Override
+    public List<ConfigValue> getRedisConfigValueList(String dataSourceId, long supplierCode, String[] keys) {
+        List<String> valueList = redisService.hmget(keysService.getRedisKey(RedisKeys.KEY_CONFIGVALUE, supplierCode), keys);
+
+        return valueList.stream().map((x) -> (ConfigValue) jsonConvert.convertFrom(ConfigValue.class, x)).collect(Collectors.toList());
+    }
+
+    /**
+     * 获取配置列表,从redis中直接获取,不分页
+     *
+     * @param searchData  查询条件
+     * @param currentUser 操作人
+     * @return 配置列表
+     */
+    @Override
+    @SuppressWarnings("rawtypes")
+    public RetResult<List<ConfigValue>> getConfigValueList(RMap searchData, ERPTokenUser currentUser, String dataSourceId, long supplierCode) {
+        Map<String, String> configMap = redisService.hgetAll(keysService.getRedisKey(RedisKeys.KEY_CONFIGVALUE, supplierCode));
+        List<ConfigValue> configValueList = new ArrayList<>();
+
+        configMap.forEach((k, v) -> {
+            ConfigValue configValue = jsonConvert.convertFrom(ConfigValue.class, v);
+
+            configValueList.add(configValue);
+        });
+
+        configValueList.sort((v1, v2) -> v1.getConfigKey().compareToIgnoreCase(v2.getConfigKey()));
+
+        return RetResult.<List<ConfigValue>>successT().result(configValueList);
+    }
+
+    /**
+     * 增加配置项
+     *
+     * @param configValue 配置信息
+     * @param currentUser 操作人
+     * @return 操作信息
+     */
+    @Override
+    public RetResult<ConfigValue> addConfigValue(ConfigValue configValue, ERPTokenUser currentUser, String dataSourceId, long supplierCode) {
+        if (StringUtils.isEmpty(configValue.getConfigKey())) {
+            return RetResult.<ConfigValue>errorT().retinfo("请输入配置键名");
+        }
+
+        if (redisService.hexists(keysService.getRedisKey(RedisKeys.KEY_CONFIGVALUE, supplierCode), configValue.getConfigKey())) {
+            return RetResult.<ConfigValue>errorT().retinfo("配置键名已存在");
+        }
+
+        configValue.setConfigType(1);
+
+        redisService.hset(keysService.getRedisKey(RedisKeys.KEY_CONFIGVALUE, supplierCode), configValue.getConfigKey(), jsonConvert.convertTo(configValue));
+
+        systemDao.addConfigValue(configValue, dataSourceId, supplierCode);
+
+        return RetResult.successT();
+    }
+
+    /**
+     * 修改配置项
+     *
+     * @param configValue 配置信息
+     * @param currentUser 操作人
+     * @return 操作信息
+     */
+    @Override
+    public RetResult<ConfigValue> updateConfigValue(ConfigValue configValue, ERPTokenUser currentUser, String dataSourceId, long supplierCode) {
+        //configKey不允许修改
+
+        if (StringUtils.isEmpty(configValue.getConfigKey())) {
+            return RetResult.<ConfigValue>errorT().retinfo("请输入配置键名");
+        }
+
+        ConfigValue redisConfig = getRedisConfigValue(configValue.getConfigKey(), dataSourceId, supplierCode);
+        if (redisConfig == null) {
+            return RetResult.<ConfigValue>errorT().retinfo("不存在的配置项");
+        }
+
+        redisConfig.setConfigName(configValue.getConfigName());
+        redisConfig.setConfigValue1(configValue.getConfigValue1());
+        redisConfig.setConfigValue2(configValue.getConfigValue2());
+        redisConfig.setConfigValue3(configValue.getConfigValue3());
+        redisConfig.setRemark(configValue.getRemark());
+
+        redisService.hset(keysService.getRedisKey(RedisKeys.KEY_CONFIGVALUE, supplierCode), redisConfig.getConfigKey(), jsonConvert.convertTo(redisConfig));
+
+        systemDao.updateConfigValue(redisConfig, dataSourceId, supplierCode);
+
+        return RetResult.successT();
+    }
+
+    /**
+     * 批量修改配置项,只有key和值
+     *
+     * @param valueList 配置项列表
+     */
+    @Override
+    public void updateConfigOnlyValue(List<ConfigValue> valueList, String dataSourceId, long supplierCode) {
+        valueList.forEach((x) -> {
+            ConfigValue redisConfig = getRedisConfigValue(x.getConfigKey(), dataSourceId, supplierCode);
+            if (redisConfig != null) {
+                redisConfig.setConfigValue1(x.getConfigValue1());
+                redisService.hset(keysService.getRedisKey(RedisKeys.KEY_CONFIGVALUE, supplierCode), redisConfig.getConfigKey(), jsonConvert.convertTo(redisConfig));
+            }
+        });
+
+        systemDao.updateBatchConfigValue(valueList, dataSourceId, supplierCode);
+
+    }
+
+    /**
+     * 删除配置项
+     *
+     * @param configValue 配置信息
+     * @param currentUser 操作人
+     * @return 操作信息
+     */
+    @Override
+    public RetResult<ConfigValue> removeConfigValue(ConfigValue configValue, ERPTokenUser currentUser, String dataSourceId, long supplierCode) {
+        if (StringUtils.isEmpty(configValue.getConfigKey())) {
+            return RetResult.<ConfigValue>errorT().retinfo("请输入配置键名");
+        }
+
+        ConfigValue redisConfig = getRedisConfigValue(configValue.getConfigKey(), dataSourceId, supplierCode);
+        if (redisConfig == null) {
+            return RetResult.<ConfigValue>errorT().retinfo("不存在的配置项");
+        }
+
+        redisService.hdel(keysService.getRedisKey(RedisKeys.KEY_CONFIGVALUE, supplierCode), redisConfig.getConfigKey());
+
+        systemDao.deleteConfigValue(redisConfig, dataSourceId, supplierCode);
+
+        return RetResult.successT();
+    }
+
+    /**
+     * 获取网站相关配置信息
+     *
+     * @param currentUser 操作人
+     * @return 网站相关配置信息列表
+     */
+    @Override
+    public RetResult<Map<String, String>> getSiteInfoConfig(ERPTokenUser currentUser, String dataSourceId, long supplierCode) {
+        Map<String, String> content = new LinkedHashMap<>();
+
+        //获取当前所有配置值
+        List<ConfigValue> valueList = getRedisConfigValueList(dataSourceId, supplierCode, RedisKeys.SUPPLIER_SITEINFO_CONFIGARR);
+        valueList.forEach((x) -> {
+            if (x != null) {
+                content.put(x.getConfigKey(), x.getConfigValue1());
+            }
+        });
+        content.put("SiteLogo", "/apis/" + supplierCode + "/logo.png");
+
+        return RetResult.<Map<String, String>>successT().result(content);
+
+    }
+
+    /**
+     * 保存网站相关的配置
+     *
+     * @param valueList 网站相关配置信息列表
+     * @return 操作人
+     */
+    @Override
+    public RetResult<ConfigValue> saveSiteInfoConfigValue(List<ConfigValue> valueList, ERPTokenUser currentUser, String dataSourceId, long supplierCode) {
+        updateConfigOnlyValue(valueList, dataSourceId, supplierCode);
+
+        return RetResult.successT();
+    }
+
+    //endregion
+
+    //region 人员配置
+
+    /**
+     * 获取个人配置信息
+     * 注意判断返回空值情况
+     *
+     * @param idUser       用户id
+     * @param configKey    配置信息
+     * @param dataSourceId 分库
+     * @param supplierCode 分表
+     * @return 配置信息
+     */
+    public PersonConfigValue getPersonConfigValue(long idUser, String configKey, String dataSourceId, long supplierCode) {
+        String json = redisService.hget(keysService.getRedisKey(RedisKeys.KEY_ERP_PERSONCONFIG, supplierCode),
+                idUser + "_" + configKey);
+        if (StringUtils.isBlank(json)) {
+            return null;
+        }
+        return jsonConvert.convertFromO(PersonConfigValue.class, json);
+    }
+
+    /**
+     * 保持配置信息
+     *
+     * @param idUser       用户id
+     * @param configKey    配置主键
+     * @param configValue  配置值
+     * @param dataSourceId 分库
+     * @param supplierCode 分表
+     * @return 操作信息
+     */
+    public int savePersonConfigValue(long idUser, String configKey, String configValue, String dataSourceId, long supplierCode) {
+        PersonConfigValue personConfigValue = new PersonConfigValue(idUser, configKey, configValue);
+        long iResult = redisService.hset(keysService.getRedisKey(RedisKeys.KEY_ERP_PERSONCONFIG, supplierCode),
+                idUser + "_" + configKey,
+                personConfigValue);
+        if (iResult == 1) {
+            systemDao.addPersonConfigValue(personConfigValue, dataSourceId, supplierCode);
+        } else {
+            systemDao.updatePersonConfigValue(personConfigValue, dataSourceId, supplierCode);
+        }
+
+        return 1;
+    }
+
+    //endregion
+
+    //region 页面表格列
+
+    /**
+     * 保存页面列
+     *
+     * @param pageName        页面名称
+     * @param tableColumnList 表格列列表
+     * @param currentUser     操作人
+     * @param dataSourceId    分库
+     * @param supplierCode    分表
+     * @return 操作信息
+     */
+    @SuppressWarnings({"rawtypes", "unchecked"})
+    public RetResult<String> savePageTableColumn(String pageName, List<PageTableColumn> tableColumnList, ERPTokenUser currentUser, String dataSourceId, long supplierCode) {
+        RMap deleteParams = new RMap();
+        deleteParams.put("idUser", currentUser.getId());
+        deleteParams.put("pageName", pageName);
+
+        tableColumnList.forEach((x) -> x.setIdUser(currentUser.getId()));
+
+        systemDao.savePageTableColumn(deleteParams, tableColumnList, dataSourceId, supplierCode);
+        return RetResult.successT();
+    }
+
+    /**
+     * 获取页面列
+     *
+     * @param pageName     页面名称
+     * @param currentUser  操作人
+     * @param dataSourceId 分库
+     * @param supplierCode 分表
+     * @return 操作信息
+     */
+    @SuppressWarnings({"rawtypes", "unchecked"})
+    public RetResult<List<PageTableColumn>> getPageTableColumn(String pageName, ERPTokenUser currentUser, String dataSourceId, long supplierCode) {
+        RMap getParams = new RMap();
+        getParams.put("idUser", currentUser.getId());
+        getParams.put("pageName", pageName);
+
+        List<PageTableColumn> tableColumnList = systemDao.selectPageTableColumn(getParams, dataSourceId, supplierCode);
+
+        return RetResult.<List<PageTableColumn>>successT().result(tableColumnList);
+    }
+
+    //endregion
+}

+ 287 - 0
yjBusiness/src/main/java/com/yinjie/heating/business/service/DeptServiceImpl.java

@@ -0,0 +1,287 @@
+package com.yinjie.heating.business.service;
+
+import com.yinjie.heating.business.dao.SystemDao;
+import com.yinjie.heating.common.api.DeptService;
+import com.yinjie.heating.common.api.NoSqlKeysService;
+import com.yinjie.heating.common.base.BaseService;
+import com.yinjie.heating.common.datas.RedisKeys;
+import com.yinjie.heating.common.entity.base.ZTreeData;
+import com.yinjie.heating.common.entity.convert.EntityReproduce;
+import com.yinjie.heating.common.entity.site.ERPTokenUser;
+import com.yinjie.heating.common.entity.system.Dept;
+import com.yinjie.heating.common.tool.TreeDeptUtils;
+import com.dySweetFishPlugin.redis.RedisService;
+import com.dySweetFishPlugin.sql.TableIdService;
+import com.dySweetFishPlugin.sql.dao.TunaService;
+import com.sweetfish.convert.json.JsonConvert;
+import com.sweetfish.service.Local;
+import com.sweetfish.service.RetResult;
+import com.sweetfish.util.AnyValue;
+import com.sweetfish.util.AutoLoad;
+import com.sweetfish.util.ResourceType;
+import org.apache.commons.lang3.StringUtils;
+import org.rex.RMap;
+
+import javax.annotation.Resource;
+import java.util.ArrayList;
+import java.util.Comparator;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+@AutoLoad(false)
+@Local
+@ResourceType(DeptService.class)
+public class DeptServiceImpl extends BaseService implements DeptService {
+
+    @Resource
+    RedisService redisService;
+
+    @Resource
+    NoSqlKeysService keysService;
+
+    @Resource
+    JsonConvert jsonConvert;
+
+    @Resource
+    TableIdService tableIdService;
+
+    @Resource
+    TunaService tunaService;
+
+    private SystemDao systemDao;
+
+    @Override
+    public void init(AnyValue config) {
+        super.init(config);
+    }
+
+    @Override
+    public void destroy(AnyValue config) {
+        super.destroy(config);
+    }
+
+    @Override
+    public void start(AnyValue config) {
+        systemDao = tunaService.generate(SystemDao.class);
+    }
+
+    //region 部门档案
+
+    private Dept getRedisDept(long deptId, long supplierCode) {
+        String json = redisService.hget(keysService.getRedisKey(RedisKeys.KEY_DEPT, supplierCode), String.valueOf(deptId));
+
+        if (StringUtils.isEmpty(json)) {
+            return null;
+        }
+
+        return jsonConvert.convertFrom(Dept.class, json);
+    }
+
+    /**
+     * 获取部门名称
+     *
+     * @param deptId       部门id
+     * @param supplierCode 分表
+     * @return 部门名称
+     */
+    public String getRedisDeptName(long deptId, long supplierCode) {
+        Dept dept = getRedisDept(deptId, supplierCode);
+
+        if (dept == null) {
+            return "";
+        } else {
+            return dept.getDeptName();
+        }
+    }
+
+    public String getRedisDeptCode(long deptId, long supplierCode) {
+        Dept dept = getRedisDept(deptId, supplierCode);
+
+        if (dept == null) {
+            return "";
+        } else {
+            return dept.getDeptCode();
+        }
+    }
+
+    @SuppressWarnings("unused")
+    private List<Dept> processTreeDepts(List<Dept> deptList) {
+        //排序完成后进行树形处理
+        return TreeDeptUtils.generateTreeDepts(deptList, 0);
+    }
+
+    /**
+     * 获取部门列表
+     * 从redis中获取
+     *
+     * @param searchData 查询条件
+     * @return 部门列表
+     */
+    @SuppressWarnings("rawtypes")
+    public RetResult<List<Dept>> getDeptList(RMap searchData, long supplierCode) {
+        String searchDeptName = "";
+        int searchStatus = -1;
+        if ((searchData != null) && (searchData.containsKey("deptName"))) {
+            searchDeptName = searchData.getString("deptName");
+
+        }
+
+        if ((searchData != null) && (searchData.containsKey("status"))) {
+            searchStatus = searchData.getInt("status");
+        }
+
+        Map<String, String> deptMap = redisService.hgetAll(keysService.getRedisKey(RedisKeys.KEY_DEPT, supplierCode));
+        List<Dept> deptList = new ArrayList<>();
+
+        final String finalDeptName = searchDeptName;
+        final int finalStatus = searchStatus;
+
+        deptMap.forEach((k, v) -> {
+            Dept dept = jsonConvert.convertFrom(Dept.class, v);
+            boolean canAdd = true;
+
+            if (StringUtils.isNotEmpty(finalDeptName)) {
+                canAdd = dept.getDeptName().contains(finalDeptName);
+            }
+
+            if (finalStatus >= 0) {
+                canAdd = canAdd && (dept.getStatus() == finalStatus);
+            }
+
+            if (canAdd) {
+                deptList.add(dept);
+            }
+        });
+        List<Dept> sortedList = deptList.stream().sorted(Comparator.comparing(Dept::getSortNum)).collect(Collectors.toList());
+
+        // List<Dept> resultDeptList = processTreeDepts(deptList);
+        return RetResult.<List<Dept>>successT().result(sortedList);
+
+    }
+
+    public RetResult<List<ZTreeData>> getDeptTreeData(int showAll, long supplierCode) {
+        Map<String, String> deptMap = redisService.hgetAll(keysService.getRedisKey(RedisKeys.KEY_DEPT, supplierCode));
+        List<ZTreeData> deptList = new ArrayList<>();
+
+        if (showAll == 1) {
+            ZTreeData dataAll = new ZTreeData();
+            dataAll.setId(-1);
+            dataAll.setpId(0);
+            dataAll.setName("全部");
+            dataAll.setTitle("全部");
+
+            deptList.add(dataAll);
+        }
+
+        deptMap.forEach((k, v) -> {
+            Dept dept = jsonConvert.convertFrom(Dept.class, v);
+            if (dept.getStatus() == 0) {
+                ZTreeData data = new ZTreeData();
+                data.setId(dept.getId());
+                data.setpId(dept.getParentId());
+                data.setName(dept.getDeptName());
+                data.setTitle(dept.getDeptName());
+
+                deptList.add(data);
+            }
+        });
+
+        return RetResult.<List<ZTreeData>>successT().result(deptList);
+    }
+
+    /**
+     * 增加部门
+     *
+     * @param dept        部门信息
+     * @param currentUser 操作人
+     * @return 操作信息
+     */
+    public RetResult<Dept> addDept(Dept dept, ERPTokenUser currentUser, String dataSourceId, long supplierCode) {
+        dept.setId(tableIdService.getTableIdMulti("tbDept.id", 1, dataSourceId, String.valueOf(supplierCode)));
+        dept.setDeptCode(tableIdService.getTableCodeMulti("tbDept.code", dataSourceId, String.valueOf(supplierCode)));
+        dept.setStatus(0);
+
+        if (dept.getParentId() <= 0) {
+            dept.setParentId(0);
+        }
+
+        Dept.create(dept, currentUser.getId());
+
+        redisService.hset(keysService.getRedisKey(RedisKeys.KEY_DEPT, supplierCode), String.valueOf(dept.getId()), jsonConvert.convertTo(dept));
+
+        systemDao.addDept(dept, dataSourceId, supplierCode);
+
+        return RetResult.successT();
+    }
+
+    public RetResult<Dept> getDeptInfo(long deptId, long supplierCode) {
+        Dept dept = getRedisDept(deptId, supplierCode);
+
+        if (dept != null) {
+            dept.setParentName(getRedisDeptName(dept.getParentId(), supplierCode));
+        }
+
+        return RetResult.<Dept>successT().result(dept);
+    }
+
+    /**
+     * 修改部门
+     *
+     * @param dept        部门信息
+     * @param currentUser 操作人
+     * @return 操作信息
+     */
+    public RetResult<Dept> updateDept(Dept dept, ERPTokenUser currentUser, String dataSourceId, long supplierCode) {
+        if (dept == null) {
+            return RetResult.<Dept>errorT().retinfo("请求数据错误");
+        }
+
+        if (dept.getId() == 0L) {
+            return RetResult.<Dept>errorT().retinfo("请求数据错误");
+        }
+
+        if (dept.getId() == dept.getParentId()) {
+            return RetResult.<Dept>errorT().retinfo("上级部门不能为本部门");
+        }
+
+        Dept.update(dept, currentUser.getId());
+
+        Dept redisDept = getRedisDept(dept.getId(), supplierCode);
+        if (redisDept != null) {
+            EntityReproduce.deptReproduce.apply(redisDept, dept);
+            redisService.hset(keysService.getRedisKey(RedisKeys.KEY_DEPT, supplierCode), String.valueOf(redisDept.getId()), jsonConvert.convertTo(redisDept));
+        }
+
+        systemDao.updateDept(dept, dataSourceId, supplierCode);
+
+        return RetResult.successT();
+    }
+
+    /**
+     * 切换部门状态
+     *
+     * @param dept        部门信息
+     * @param currentUser 操作人
+     * @return 操作信息
+     */
+    public RetResult<Dept> voidDept(Dept dept, ERPTokenUser currentUser, String dataSourceId, long supplierCode) {
+        Dept.update(dept, currentUser.getId());
+
+        Dept redisDept = getRedisDept(dept.getId(), supplierCode);
+        if (redisDept != null) {
+            redisDept.setStatus(dept.getStatus());
+            redisDept.setUpdateBy(dept.getUpdateBy());
+            redisDept.setUpdateTime(dept.getUpdateTime());
+
+            redisService.hset(keysService.getRedisKey(RedisKeys.KEY_DEPT, supplierCode), String.valueOf(redisDept.getId()), jsonConvert.convertTo(redisDept));
+        }
+
+        systemDao.voidDept(dept, dataSourceId, supplierCode);
+
+        return RetResult.successT();
+    }
+
+    //endregion
+
+}

+ 409 - 0
yjBusiness/src/main/java/com/yinjie/heating/business/service/DictServiceImpl.java

@@ -0,0 +1,409 @@
+package com.yinjie.heating.business.service;
+
+import com.yinjie.heating.business.dao.SystemDao;
+import com.yinjie.heating.common.api.DictService;
+import com.yinjie.heating.common.api.NoSqlKeysService;
+import com.yinjie.heating.common.base.BaseService;
+import com.yinjie.heating.common.datas.RedisKeys;
+import com.yinjie.heating.common.entity.site.ERPTokenUser;
+import com.yinjie.heating.common.entity.system.DictData;
+import com.yinjie.heating.common.entity.system.DictType;
+import com.dySweetFishPlugin.redis.RedisService;
+import com.dySweetFishPlugin.sql.TableIdService;
+import com.dySweetFishPlugin.sql.dao.TunaService;
+import com.sweetfish.convert.json.JsonConvert;
+import com.sweetfish.service.Local;
+import com.sweetfish.service.RetResult;
+import com.sweetfish.source.PageFlipper;
+import com.sweetfish.util.AnyValue;
+import com.sweetfish.util.AutoLoad;
+import com.sweetfish.util.ResourceType;
+import org.apache.commons.lang3.StringUtils;
+import org.rex.RMap;
+
+import javax.annotation.Resource;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+@AutoLoad(false)
+@Local
+@ResourceType(DictService.class)
+public class DictServiceImpl extends BaseService implements DictService {
+
+    @Resource
+    RedisService redisService;
+
+    @Resource
+    NoSqlKeysService keysService;
+
+    @Resource
+    JsonConvert jsonConvert;
+
+    @Resource
+    TunaService tunaService;
+
+    @Resource
+    TableIdService tableIdService;
+
+    private SystemDao systemDao;
+
+    @Override
+    public void init(AnyValue config) {
+        super.init(config);
+    }
+
+    @Override
+    public void destroy(AnyValue config) {
+        super.destroy(config);
+    }
+
+    @Override
+    public void start(AnyValue config) {
+        systemDao = tunaService.generate(SystemDao.class);
+    }
+
+    //region 字典管理
+
+    @Override
+    @SuppressWarnings({"unchecked", "rawtypes"})
+    public RetResult<List<DictType>> getDictTypeList(RMap searchData, PageFlipper pageFlipper, String dataSourceId, long supplierCode) {
+        RMap params = new RMap();
+        if (searchData != null) {
+            params.putAll(searchData);
+        }
+
+        if (!params.containsKey("voidFlag")) {
+            params.put("voidFlag", -1);
+        }
+
+        List<DictType> dictTypeList = systemDao.queryDictTypes(params, dataSourceId, supplierCode, pageFlipper);
+        return RetResult.<List<DictType>>successT().result(dictTypeList).page(pageFlipper);
+    }
+
+    @Override
+    public DictType getDictTypeInfoById(long id, String dataSourceId, long supplierCode) {
+        String json = redisService.hget(keysService.getRedisKey(RedisKeys.KEY_ERPDICTTYPE, supplierCode), String.valueOf(id));
+
+        if (StringUtils.isEmpty(json)) {
+            return null;
+        }
+
+        return jsonConvert.convertFrom(DictType.class, json);
+    }
+
+    @Override
+    public DictType getDictTypeInfoByText(String dictType, String dataSourceId, long supplierCode) {
+        Map<String, String> dictTypeMap = redisService.hgetAll(keysService.getRedisKey(RedisKeys.KEY_ERPDICTTYPE, supplierCode));
+
+        for (String v : dictTypeMap.values()) {
+            DictType dict = jsonConvert.convertFrom(DictType.class, v);
+            if (dictType.equalsIgnoreCase(dict.getDictType())) {
+                return dict;
+            }
+        }
+        return null;
+    }
+
+    @Override
+    public String getDictTypeName(long id, String dataSourceId, long supplierCode) {
+        DictType dictType = getDictTypeInfoById(id, dataSourceId, supplierCode);
+        if (dictType == null) {
+            return "";
+        } else {
+            return dictType.getDictName();
+        }
+    }
+
+    @Override
+    public RetResult<DictType> addDictType(DictType dictType, ERPTokenUser currentUser, String dataSourceId, long supplierCode) {
+        dictType.setId(tableIdService.getTableIdMulti("tbDictType.id", 1, dataSourceId, String.valueOf(supplierCode)));
+        dictType.setVoidFlag(0);
+
+        DictType.create(dictType, currentUser.getId());
+
+        //设置redis主表信息
+        redisService.hset(keysService.getRedisKey(RedisKeys.KEY_ERPDICTTYPE, supplierCode), String.valueOf(dictType.getId()), jsonConvert.convertTo(dictType));
+
+        systemDao.addDictType(dictType, dataSourceId, supplierCode);
+
+        return RetResult.successT();
+    }
+
+    @Override
+    public RetResult<DictType> updateDictType(DictType dictType, ERPTokenUser currentUser, String dataSourceId, long supplierCode) {
+        if (dictType == null) {
+            return RetResult.<DictType>errorT().retinfo("请求数据错误");
+        }
+
+        if (dictType.getId() <= 0L) {
+            return RetResult.<DictType>errorT().retinfo("请求数据错误");
+        }
+
+        if (currentUser == null) {
+            return RetResult.<DictType>errorT().retinfo("未登录");
+        }
+
+        DictType.update(dictType, currentUser.getId());
+
+        DictType redisInfo = getDictTypeInfoById(dictType.getId(), dataSourceId, supplierCode);
+        if (redisInfo != null) {
+            redisInfo.setDictName(dictType.getDictName());
+            redisInfo.setDictType(dictType.getDictType());
+            redisInfo.setRemark(dictType.getRemark());
+            redisInfo.setUpdateBy(dictType.getUpdateBy());
+            redisInfo.setUpdateTime(dictType.getUpdateTime());
+
+            redisService.hset(keysService.getRedisKey(RedisKeys.KEY_ERPDICTTYPE, supplierCode), String.valueOf(redisInfo.getId()), jsonConvert.convertTo(redisInfo));
+        }
+
+        systemDao.updateDictType(dictType, dataSourceId, supplierCode);
+
+        return RetResult.successT();
+    }
+
+    @Override
+    public RetResult<DictType> voidDictType(DictType dictType, ERPTokenUser currentUser, String dataSourceId, long supplierCode) {
+        if (dictType == null) {
+            return RetResult.<DictType>errorT().retinfo("请求数据错误");
+        }
+
+        if (dictType.getId() <= 0L) {
+            return RetResult.<DictType>errorT().retinfo("请求数据错误");
+        }
+
+        if (currentUser == null) {
+            return RetResult.<DictType>errorT().retinfo("未登录");
+        }
+
+        DictType.update(dictType, currentUser.getId());
+
+        DictType redisInfo = getDictTypeInfoById(dictType.getId(), dataSourceId, supplierCode);
+        if (redisInfo != null) {
+            redisInfo.setVoidFlag(dictType.getVoidFlag());
+            redisInfo.setUpdateBy(dictType.getUpdateBy());
+            redisInfo.setUpdateTime(dictType.getUpdateTime());
+
+            redisService.hset(keysService.getRedisKey(RedisKeys.KEY_ERPDICTTYPE, supplierCode), String.valueOf(redisInfo.getId()), jsonConvert.convertTo(redisInfo));
+        }
+
+        systemDao.voidDictType(dictType, dataSourceId, supplierCode);
+
+        return RetResult.successT();
+    }
+
+    @Override
+    @SuppressWarnings({"unchecked", "rawtypes"})
+    public RetResult<List<DictData>> getDictDataList(RMap searchData, PageFlipper pageFlipper, String dataSourceId, long supplierCode) {
+        RMap params = new RMap();
+        if (searchData != null) {
+            params.putAll(searchData);
+        }
+
+        if (!params.containsKey("idType")) {
+            params.put("idType", 0);
+        }
+
+        if (!params.containsKey("voidFlag")) {
+            params.put("voidFlag", -1);
+        }
+
+        List<DictData> dictDataList = systemDao.queryDictDatas(params, dataSourceId, supplierCode, pageFlipper);
+        return RetResult.<List<DictData>>successT().result(dictDataList).page(pageFlipper);
+    }
+
+    @Override
+    public DictData getDictDataInfo(long idType, long id, String dataSourceId, long supplierCode) {
+        String json = redisService.hget(keysService.getRedisKey(RedisKeys.KEY_ERPDICTDATA, supplierCode, true) + idType, String.valueOf(id));
+
+        if (StringUtils.isEmpty(json)) {
+            return null;
+        }
+
+        return jsonConvert.convertFrom(DictData.class, json);
+    }
+
+    @Override
+    public DictData getDictDataInfoV2(String dictTypeText, long id, String dataSourceId, long supplierCode) {
+        DictType dictType = getDictTypeInfoByText(dictTypeText, dataSourceId, supplierCode);
+
+        if (dictType == null) {
+            return null;
+        }
+        String json = redisService.hget(keysService.getRedisKey(RedisKeys.KEY_ERPDICTDATA, supplierCode, true) + dictType.getId(), String.valueOf(id));
+
+        if (StringUtils.isEmpty(json)) {
+            return null;
+        }
+
+        return jsonConvert.convertFrom(DictData.class, json);
+    }
+
+    @Override
+    public RetResult<DictData> addDictData(DictData dictData, ERPTokenUser currentUser, String dataSourceId, long supplierCode) {
+        dictData.setId(tableIdService.getTableIdMulti("tbDictData.id", 1, dataSourceId, String.valueOf(supplierCode)));
+        dictData.setVoidFlag(0);
+
+        DictData.create(dictData, currentUser.getId());
+
+        //设置redis主表信息
+        redisService.hset(keysService.getRedisKey(RedisKeys.KEY_ERPDICTDATA, supplierCode, true) + dictData.getIdType(), String.valueOf(dictData.getId()), jsonConvert.convertTo(dictData));
+
+        systemDao.addDictData(dictData, dataSourceId, supplierCode);
+
+        return RetResult.successT();
+    }
+
+    @Override
+    public RetResult<DictData> updateDictData(DictData dictData, ERPTokenUser currentUser, String dataSourceId, long supplierCode) {
+        if (dictData == null) {
+            return RetResult.<DictData>errorT().retinfo("请求数据错误");
+        }
+
+        if (dictData.getId() <= 0L) {
+            return RetResult.<DictData>errorT().retinfo("请求数据错误");
+        }
+
+        if (dictData.getIdType() <= 0L) {
+            return RetResult.<DictData>errorT().retinfo("请求数据错误");
+        }
+
+        if (currentUser == null) {
+            return RetResult.<DictData>errorT().retinfo("未登录");
+        }
+
+        DictData.update(dictData, currentUser.getId());
+
+        DictData redisInfo = getDictDataInfo(dictData.getIdType(), dictData.getId(), dataSourceId, supplierCode);
+        if (redisInfo != null) {
+            redisInfo.setDictLabel(dictData.getDictLabel());
+            redisInfo.setDictValue(dictData.getDictValue());
+            redisInfo.setSortNum(dictData.getSortNum());
+            redisInfo.setCssClass(dictData.getCssClass());
+            redisInfo.setListClass(dictData.getListClass());
+            redisInfo.setRemark(dictData.getRemark());
+            redisInfo.setUpdateBy(dictData.getUpdateBy());
+            redisInfo.setUpdateTime(dictData.getUpdateTime());
+
+            redisService.hset(keysService.getRedisKey(RedisKeys.KEY_ERPDICTDATA, supplierCode, true) + redisInfo.getIdType(), String.valueOf(redisInfo.getId()), jsonConvert.convertTo(redisInfo));
+        }
+
+        systemDao.updateDictData(dictData, dataSourceId, supplierCode);
+
+        return RetResult.successT();
+    }
+
+    @Override
+    public RetResult<DictData> voidDictData(DictData dictData, ERPTokenUser currentUser, String dataSourceId, long supplierCode) {
+        if (dictData == null) {
+            return RetResult.<DictData>errorT().retinfo("请求数据错误");
+        }
+
+        if (dictData.getId() <= 0L) {
+            return RetResult.<DictData>errorT().retinfo("请求数据错误");
+        }
+
+        if (dictData.getIdType() <= 0L) {
+            return RetResult.<DictData>errorT().retinfo("请求数据错误");
+        }
+
+        if (currentUser == null) {
+            return RetResult.<DictData>errorT().retinfo("未登录");
+        }
+
+        DictData.update(dictData, currentUser.getId());
+
+        DictData redisInfo = getDictDataInfo(dictData.getIdType(), dictData.getId(), dataSourceId, supplierCode);
+        if (redisInfo != null) {
+            redisInfo.setVoidFlag(dictData.getVoidFlag());
+            redisInfo.setUpdateBy(dictData.getUpdateBy());
+            redisInfo.setUpdateTime(dictData.getUpdateTime());
+
+            redisService.hset(keysService.getRedisKey(RedisKeys.KEY_ERPDICTDATA, supplierCode, true) + redisInfo.getIdType(), String.valueOf(redisInfo.getId()), jsonConvert.convertTo(redisInfo));
+        }
+        systemDao.voidDictData(dictData, dataSourceId, supplierCode);
+        // systemDao.updateDictData(dictData, dataSourceId, supplierCode);
+
+        return RetResult.successT();
+    }
+
+    /**
+     * 客户端选择字典类型
+     * 从redis中获取字典类型
+     *
+     * @return 字典数据
+     */
+    @Override
+    public RetResult<List<DictType>> selectDictTypeList(String dataSourceId, long supplierCode) {
+        Map<String, String> dictTypeMap = redisService.hgetAll(keysService.getRedisKey(RedisKeys.KEY_ERPDICTTYPE, supplierCode));
+        List<DictType> dictTypeList = new ArrayList<>();
+        dictTypeMap.forEach((k, v) -> {
+            DictType dictType = jsonConvert.convertFrom(DictType.class, v);
+
+            if (dictType.getVoidFlag() == 0) {
+                dictTypeList.add(dictType);
+            }
+        });
+
+        //排序
+        dictTypeList.sort((v1, v2) -> -1 * Long.compare(v1.getId(), v2.getId()));
+
+        return RetResult.<List<DictType>>successT().result(dictTypeList);
+
+    }
+
+    /**
+     * 客户端选择字典数据
+     * 先从redis中获取对应的字典类型,然后获取对应的字典数据
+     *
+     * @param dictTypeText 字典类型
+     * @return 字典数据
+     */
+    @Override
+    @SuppressWarnings("unchecked")
+    public RetResult<List<DictData>> selectDictDataList(String dictTypeText, String dataSourceId, long supplierCode) {
+        DictType dictType = getDictTypeInfoByText(dictTypeText, dataSourceId, supplierCode);
+
+        if (dictType == null) {
+            return RetResult.error().retcode(-1).retinfo("请求数据错误,找不到[" + dictTypeText + "]对应的字典类型");
+        }
+
+        Map<String, String> dictDataMap = redisService.hgetAll(keysService.getRedisKey(RedisKeys.KEY_ERPDICTDATA, supplierCode, true) + dictType.getId());
+        List<DictData> dictDataList = new ArrayList<>();
+        dictDataMap.forEach((k, v) -> {
+            DictData dictData = jsonConvert.convertFrom(DictData.class, v);
+
+            if (dictData.getVoidFlag() == 0) {
+                dictDataList.add(dictData);
+            }
+        });
+
+        //排序
+        dictDataList.sort((v1, v2) -> {
+            if (v1.getSortNum() == v2.getSortNum()) {
+                return Long.compare(v1.getId(), v2.getId());
+            } else {
+                return Integer.compare(v1.getSortNum(), v2.getSortNum());
+            }
+        });
+
+        return RetResult.success().retcode(0).result(dictDataList);
+
+    }
+
+    @Override
+    public RetResult<Map<String, List<DictData>>> selectDictDataListMulti(String dictTypeTextMulti, String dataSourceId, long supplierCode) {
+        String[] dictTypeTextArr = dictTypeTextMulti.split(",");
+        Map<String, List<DictData>> totalResult = new HashMap<>();
+        for (String s : dictTypeTextArr) {
+            RetResult<List<DictData>> dictResult = this.selectDictDataList(s, dataSourceId, supplierCode);
+            totalResult.put(s, dictResult.getResult());
+        }
+
+        return RetResult.<Map<String, List<DictData>>>successT().result(totalResult);
+    }
+
+
+    //endregion
+}

+ 878 - 0
yjBusiness/src/main/java/com/yinjie/heating/business/service/DocInfoServiceImpl.java

@@ -0,0 +1,878 @@
+package com.yinjie.heating.business.service;
+
+import com.yinjie.heating.business.dao.DocDao;
+import com.yinjie.heating.common.api.DocInfoService;
+import com.yinjie.heating.common.api.NoSqlKeysService;
+import com.yinjie.heating.common.base.BaseService;
+import com.yinjie.heating.common.datas.*;
+import com.yinjie.heating.common.entity.base.*;
+import com.yinjie.heating.common.entity.doc.BusinessScript;
+import com.yinjie.heating.common.entity.inquire.InquireCondition;
+import com.yinjie.heating.common.entity.inquire.InquireExecRecord;
+import com.yinjie.heating.common.entity.inquire.InquireMainInfo;
+import com.yinjie.heating.common.entity.inquire.InquireResultColumn;
+import com.yinjie.heating.common.entity.site.ERPTokenUser;
+import com.yinjie.heating.common.entity.system.CompanyInfo;
+import com.yinjie.heating.common.tool.ERPUtils;
+import com.dySweetFishPlugin.elasticsearch.ESClient;
+import com.dySweetFishPlugin.redis.RedisService;
+import com.dySweetFishPlugin.sql.RMapUtils;
+import com.dySweetFishPlugin.sql.TableIdService;
+import com.dySweetFishPlugin.sql.dao.TunaService;
+import com.dySweetFishPlugin.tool.lang.DateUtil;
+import com.dySweetFishPlugin.tool.lang.ThreadFactoryWithNamePrefix;
+import com.sweetfish.convert.json.JsonConvert;
+import com.sweetfish.convert.json.JsonFactory;
+import com.sweetfish.service.Local;
+import com.sweetfish.service.RetResult;
+import com.sweetfish.source.PageFlipper;
+import com.sweetfish.util.AnyValue;
+import com.sweetfish.util.AutoLoad;
+import com.sweetfish.util.ResourceType;
+import org.apache.commons.lang3.StringUtils;
+import org.elasticsearch.action.search.SearchRequestBuilder;
+import org.elasticsearch.action.support.WriteRequest;
+import org.elasticsearch.common.xcontent.XContentBuilder;
+import org.elasticsearch.common.xcontent.XContentFactory;
+import org.elasticsearch.common.xcontent.XContentType;
+import org.elasticsearch.index.query.BoolQueryBuilder;
+import org.elasticsearch.index.query.Operator;
+import org.elasticsearch.index.query.QueryBuilders;
+import org.elasticsearch.search.SearchHits;
+import org.elasticsearch.search.sort.SortBuilder;
+import org.elasticsearch.search.sort.SortBuilders;
+import org.elasticsearch.search.sort.SortOrder;
+import org.rex.RMap;
+
+import javax.annotation.Resource;
+import java.io.File;
+import java.io.IOException;
+import java.nio.charset.StandardCharsets;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.nio.file.StandardOpenOption;
+import java.util.*;
+import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.stream.Collectors;
+
+import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder;
+
+@AutoLoad(false)
+@Local
+@ResourceType(DocInfoService.class)
+public class DocInfoServiceImpl extends BaseService implements DocInfoService {
+    @Resource
+    RedisService redisService;
+
+    @Resource
+    NoSqlKeysService keysService;
+
+    @Resource
+    ESClient esClient;
+
+    @Resource
+    JsonConvert jsonConvert;
+
+    @Resource
+    JsonFactory jsonRootFactory;
+
+    @Resource
+    TunaService tunaService;
+
+    @Resource
+    TableIdService tableIdService;
+
+    private DocDao docDao;
+
+    /**
+     * 档案线程池
+     */
+    private ExecutorService docExecutor;
+
+    private JsonConvert inquireInfoConvert;
+
+    @Override
+    public void init(AnyValue config) {
+        super.init(config);
+
+        docExecutor = Executors.newFixedThreadPool(4, new ThreadFactoryWithNamePrefix("[基础档案线程池]"));
+
+        final JsonFactory billChildFactory = jsonRootFactory.createChild();
+        billChildFactory.register(InquireMainInfo.class, true, "resultColumnList", "conditionList");
+        //重新加载Coder使之覆盖父Factory的配置
+        billChildFactory.reloadCoder(InquireMainInfo.class);
+        this.inquireInfoConvert = billChildFactory.getConvert();
+    }
+
+    @Override
+    public void start(AnyValue config) {
+        docDao = tunaService.generate(DocDao.class);
+    }
+
+    /**
+     * 进程退出时,调用Service销毁
+     * 远程模式下该方法会重载成空方法
+     *
+     * @param config 配置参数
+     */
+    @Override
+    public void destroy(AnyValue config) {
+        super.destroy(config);
+
+        if (docExecutor != null) {
+            docExecutor.shutdown();
+        }
+    }
+
+    //region 业务脚本
+
+    /**
+     * 从redis中按code获取脚本
+     * 脚本数据量不会太大,维护从数据库中获取即可,但redis中会存有code对应的信息,用于其他业务快速使用
+     *
+     * @param code         脚本编码
+     * @param supplierCode 分表
+     * @return 脚本信息
+     */
+    public BusinessScript getRedisBusinessScript(String code, long supplierCode) {
+        String json = redisService.hget(keysService.getRedisKey(RedisKeys.KEY_BUSINESSSCRIPT, supplierCode), code);
+
+        if (StringUtils.isEmpty(json)) {
+            return null;
+        }
+
+        return jsonConvert.convertFrom(BusinessScript.class, json);
+    }
+
+    /**
+     * 从code获取业务脚本信息
+     *
+     * @param code 脚本编码
+     * @return 脚本信息
+     */
+    @Override
+    @SuppressWarnings("rawtypes")
+    public RMap getBusinessScriptInfo(String code, String dataSourceId, long supplierCode) {
+        BusinessScript info = getRedisBusinessScript(code, supplierCode);
+
+        return RMapUtils.successV2(info, null, null);
+    }
+
+    /**
+     * 从redis中获取脚本名称
+     *
+     * @param code         脚本编码
+     * @param supplierCode 分表
+     * @return 脚本名称
+     */
+    public String getRedisBusinessScriptName(String code, long supplierCode) {
+        BusinessScript businessScript = getRedisBusinessScript(code, supplierCode);
+        if (businessScript == null) {
+            return "";
+        }
+
+        return businessScript.getBusinessName();
+    }
+
+    /**
+     * 分页获取业务脚本列表
+     * 从数据库中获取数据
+     *
+     * @param searchData  查询条件
+     * @param pageFlipper 分页参数
+     * @return 业务脚本列表
+     */
+    @Override
+    @SuppressWarnings({"unchecked", "rawtypes"})
+    public RMap getBusinessScriptList(RMap searchData, PageFlipper pageFlipper, String dataSourceId, long supplierCode) {
+
+        RMap params = new RMap();
+        if (searchData != null) {
+            params.putAll(searchData);
+        }
+
+        if (!params.containsKey("voidFlag")) {
+            params.put("voidFlag", -1);
+        }
+
+        List<BusinessScript> scriptList = docDao.selectBusinessScript(params, dataSourceId, supplierCode, pageFlipper);
+
+        return RMapUtils.successV2(scriptList, null, pageFlipper);
+    }
+
+    /**
+     * 增加业务脚本
+     *
+     * @param businessScript 脚本信息
+     * @param currentUser    操作用户
+     * @param dataSourceId   分库
+     * @param supplierCode   分表
+     */
+    public int addBusinessScriptLocal(BusinessScript businessScript, ERPTokenUser currentUser, String dataSourceId, long supplierCode) {
+        if (redisService.hexists(keysService.getRedisKey(RedisKeys.KEY_BUSINESSSCRIPT, supplierCode), businessScript.getBusinessCode())) {
+            return -1;
+        }
+
+        businessScript.setId(tableIdService.getTableIdMulti("tbBusinessScript.id", 1, dataSourceId, String.valueOf(supplierCode)));
+        businessScript.setVoidFlag(0);
+
+        BusinessScript.create(businessScript, currentUser.getId());
+
+        redisService.hset(keysService.getRedisKey(RedisKeys.KEY_BUSINESSSCRIPT, supplierCode), businessScript.getBusinessCode(), jsonConvert.convertTo(businessScript));
+
+        docDao.addBusinessScript(businessScript, dataSourceId, supplierCode);
+
+        return 1;
+    }
+
+    /**
+     * 增加业务脚本
+     *
+     * @param businessScript 脚本信息
+     * @param currentUser    操作用户
+     * @return 操作信息
+     */
+    @Override
+    @SuppressWarnings("rawtypes")
+    public RMap addBusinessScript(BusinessScript businessScript, ERPTokenUser currentUser, String dataSourceId, long supplierCode) {
+        if (currentUser == null) {
+            return RMapUtils.error(HttpCode.UNAUTHORIZED.value(), "未登录");
+        }
+
+        if (StringUtils.isEmpty(businessScript.getBusinessCode())) {
+            return RMapUtils.error(HttpCode.BAD_REQUEST.value(), "业务代码未输入");
+        }
+
+        int iResult = addBusinessScriptLocal(businessScript, currentUser, dataSourceId, supplierCode);
+        if (iResult == -1) {
+            return RMapUtils.error(HttpCode.BAD_REQUEST.value(), "业务代码已存在");
+        }
+
+        return RMapUtils.success();
+    }
+
+    /**
+     * 修改业务脚本
+     *
+     * @param businessScript 业务脚本
+     * @param currentUser    操作用户
+     * @return 操作信息
+     */
+    @Override
+    @SuppressWarnings("rawtypes")
+    public RMap updateBusinessScript(BusinessScript businessScript, ERPTokenUser currentUser, String dataSourceId, long supplierCode) {
+        if (currentUser == null) {
+            return RMapUtils.error(HttpCode.UNAUTHORIZED.value(), "未登录");
+        }
+
+        if (businessScript == null) {
+            return RMapUtils.error(HttpCode.BAD_REQUEST.value(), "请求数据错误");
+        }
+
+        if (businessScript.getId() == 0L) {
+            return RMapUtils.error(HttpCode.BAD_REQUEST.value(), "请求数据错误");
+        }
+
+        BusinessScript redisInfo = getRedisBusinessScript(businessScript.getBusinessCode(), supplierCode);
+        if (redisInfo == null) {
+            return RMapUtils.error(HttpCode.BAD_REQUEST.value(), "不存在此业务代码的脚本信息");
+        }
+        //code不允许修改,因为代码中都使用到了
+        if (redisInfo.getId() != businessScript.getId()) {
+            return RMapUtils.error(HttpCode.BAD_REQUEST.value(), "不允许修改业务代码或id提交错误");
+        }
+
+        BusinessScript.update(businessScript, currentUser.getId());
+
+//        redisInfo.setBusinessCode(businessScript.getBusinessCode());
+        redisInfo.setBusinessName(businessScript.getBusinessName());
+
+        redisInfo.setUpdateBy(businessScript.getUpdateBy());
+        redisInfo.setUpdateTime(businessScript.getUpdateTime());
+
+        redisService.hset(keysService.getRedisKey(RedisKeys.KEY_BUSINESSSCRIPT, supplierCode), redisInfo.getBusinessCode(), jsonConvert.convertTo(redisInfo));
+
+        docDao.updateBusinessScript(businessScript, dataSourceId, supplierCode);
+
+        return RMapUtils.success();
+    }
+
+    /**
+     * 启用、禁用业务脚本
+     *
+     * @param businessScript 业务脚本
+     * @param currentUser    操作用户
+     * @return 操作信息
+     */
+    @Override
+    @SuppressWarnings("rawtypes")
+    public RMap voidBusinessScript(BusinessScript businessScript, ERPTokenUser currentUser, String dataSourceId, long supplierCode) {
+        if (currentUser == null) {
+            return RMapUtils.error(HttpCode.UNAUTHORIZED.value(), "未登录");
+        }
+
+        if (businessScript == null) {
+            return RMapUtils.error(HttpCode.BAD_REQUEST.value(), "请求数据错误");
+        }
+
+        if (businessScript.getId() == 0L) {
+            return RMapUtils.error(HttpCode.BAD_REQUEST.value(), "请求数据错误,id未传入");
+        }
+        if (StringUtils.isBlank(businessScript.getBusinessCode())) {
+            return RMapUtils.error(HttpCode.BAD_REQUEST.value(), "请求数据错误,businessCode未传入");
+        }
+
+        BusinessScript redisInfo = getRedisBusinessScript(businessScript.getBusinessCode(), supplierCode);
+        if (redisInfo == null) {
+            return RMapUtils.error(HttpCode.BAD_REQUEST.value(), "不存在此业务代码的脚本信息");
+        }
+
+        BusinessScript.update(businessScript, currentUser.getId());
+
+        redisInfo.setVoidFlag(businessScript.getVoidFlag());
+        redisInfo.setUpdateBy(businessScript.getUpdateBy());
+        redisInfo.setUpdateTime(businessScript.getUpdateTime());
+        redisService.hset(keysService.getRedisKey(RedisKeys.KEY_BUSINESSSCRIPT, supplierCode), redisInfo.getBusinessCode(), jsonConvert.convertTo(redisInfo));
+
+        docDao.voidBusinessScript(businessScript, dataSourceId, supplierCode);
+
+        return RMapUtils.success();
+    }
+
+
+    /**
+     * 获取业务脚本脚本内容
+     *
+     * @param code 脚本编号
+     * @return 脚本内容
+     */
+    @Override
+    public RetResult<ScriptContent> getBusinessScriptContent(String code, String dataSourceId, long supplierCode) {
+
+        BusinessScript redisInfo = getRedisBusinessScript(code, supplierCode);
+        if (redisInfo == null) {
+            return RetResult.<ScriptContent>errorT().retinfo("不存在此业务代码的脚本信息,可执行相关初始化脚本操作");
+        }
+
+        if (StringUtils.equalsIgnoreCase(code, "ERPLogin")) {
+            return RetResult.<ScriptContent>errorT().retinfo("登录脚本不允许在线查看");
+        }
+
+        ScriptContent content = new ScriptContent();
+        content.setCode(code);
+        content.setModule(redisInfo.getBusinessModule());
+        content.setModuleName(ERPModule.getModule(redisInfo.getBusinessModule()).getModuleDisplayName());
+
+        String prefix = "BE_";
+
+        File quoteScript = new File(businessScriptRoot + File.separator +
+                supplierCode + File.separator +
+                ERPModule.getModule(redisInfo.getBusinessModule()).getSaveDirectory() + File.separator +
+                prefix + code + ".groovy");
+        if (quoteScript.exists()) {
+            content.setScriptBody(readUTF8File(quoteScript.toPath(), false));
+        } else {
+            content.setScriptBody("");
+        }
+
+        return RetResult.<ScriptContent>successT().result(content);
+    }
+
+    /**
+     * 存储业务脚本脚本
+     *
+     * @param script 脚本内容
+     * @return 操作信息
+     */
+    @Override
+    public int saveBusinessScriptContent(ScriptContent script, boolean clearCache, String dataSourceId, long supplierCode, ERPTokenUser currentUser) {
+        if (StringUtils.equalsIgnoreCase(script.getCode(), "ERPLogin")) {
+            return 1;
+        }
+
+        if (redisService.setRedisSemaphore(keysService.getRedisKey(RedisKeys.KEY_SYSLOCK, supplierCode) + "businessscript:" + script.getCode(),
+                "1",
+                20)) {
+            CompletableFuture.runAsync(() -> {
+                //存储文件
+                try {
+                    String prefix = "BE_";
+
+                    String fileName = businessScriptRoot + File.separator +
+                            supplierCode + File.separator +
+                            ERPModule.getModule(script.getModule()).getSaveDirectory() + File.separator +
+                            prefix + script.getCode() + ".groovy";
+
+                    Files.write(Paths.get(fileName),
+                            Collections.singleton(new StringBuilder(script.getScriptBody())),
+                            StandardCharsets.UTF_8,
+                            StandardOpenOption.CREATE,
+                            StandardOpenOption.WRITE,
+                            StandardOpenOption.TRUNCATE_EXISTING);
+
+                    if (clearCache) {
+                        handleScript("DocClearScriptCache",
+                                ERPModule.NONE,
+                                dataSourceId, supplierCode,
+                                () -> ProcessEntityItem.<ERPModuleEntity>newBuilder()
+                                        .inputItem(new ERPModuleEntity(script.getCode(), ERPModule.getModule(script.getModule())))
+                                        .currentUser(currentUser)
+                                        .dataSourceId(dataSourceId)
+                                        .supplierCode(supplierCode)
+                                        .build());
+                    }
+                } catch (Exception e) {
+                    logger.error(e.getMessage(), e);
+                }
+
+            }, docExecutor).whenComplete((v, e) -> {
+                if (e != null) {
+                    logger.error(e.getMessage(), e);
+                }
+            });
+
+            return 1;
+        } else {
+            return -1;
+        }
+    }
+
+    /**
+     * 编译业务脚本脚本
+     *
+     * @param script 脚本内容
+     * @return 编译结果
+     */
+    @Override
+    @SuppressWarnings({"rawtypes"})
+    public RMap compileBusinessScriptContent(ScriptContent script, String dataSourceId, long supplierCode) {
+        if (StringUtils.isBlank(script.getScriptBody())) {
+            return RMapUtils.error(HttpCode.BAD_REQUEST.value(), "脚本内容为空");
+        }
+
+        String error = ERPUtils.checkGroovyScript(this.getClass().getClassLoader(),
+                businessScriptRoot + File.separator +
+                        supplierCode + File.separator +
+                        ERPModule.getModule(script.getModule()).getSaveDirectory(),
+                script.getScriptBody());
+        if (StringUtils.isBlank(error)) {
+            return RMapUtils.success();
+        } else {
+            return RMapUtils.error(HttpCode.BAD_REQUEST.value(), error);
+        }
+
+    }
+
+    //endregion
+
+    //region 查询统计
+    @Override
+    @SuppressWarnings("rawtypes")
+    public RetResult<List<InquireMainInfo>> queryInquireMainInfo(RMap searchData, PageFlipper pageFlipper, ERPTokenUser currentUser, String dataSourceId, long supplierCode) {
+        BoolQueryBuilder boolQueryBuilder = QueryBuilders.boolQuery();
+
+        if ((searchData != null) && (!searchData.isEmpty()) && (StringUtils.isNotEmpty(searchData.getString("voidFlag")))) {
+            String voidFlag = searchData.getString("voidFlag");
+            if (!"-1".equalsIgnoreCase(voidFlag)) {
+                boolQueryBuilder = boolQueryBuilder.must(QueryBuilders.rangeQuery("voidFlag").gte(Integer.parseInt(voidFlag)).lte(Integer.parseInt(voidFlag)));
+            }
+        }
+
+        if ((searchData != null) && (!searchData.isEmpty()) && (StringUtils.isNotEmpty(searchData.getString("keyWord")))) {
+            String keyWord = searchData.getString("keyWord");
+            BoolQueryBuilder qbKeyWord = QueryBuilders.boolQuery()
+                    .should(QueryBuilders.matchQuery("inquireName", keyWord).operator(Operator.AND))
+                    .should(QueryBuilders.matchQuery("inquireFuncName", keyWord).operator(Operator.AND));
+            boolQueryBuilder = boolQueryBuilder.must(qbKeyWord);
+        }
+
+        SortBuilder sortBuilder = SortBuilders.fieldSort("id").order(SortOrder.DESC);
+
+        SearchRequestBuilder requestBuilder = esClient.getClient().prepareSearch(keysService.getESKey(ESKeys.ESERPINQUIREINFO_INDEX, supplierCode))
+                .setTypes(ESKeys.ESERPINQUIREMAININFO_TYPE)
+                .setQuery(boolQueryBuilder)
+                .addSort(sortBuilder)
+                .setSize(pageFlipper.getPageSize())
+                .setFrom(pageFlipper.getPageSize() * (pageFlipper.getPageIndex() - 1));
+
+        SearchHits searchHits = requestBuilder.execute().actionGet().getHits();
+        List<InquireMainInfo> inquireMainInfos = new ArrayList<>();
+        //stream遍历结果集,添加到list集合中,便于返回数据
+        searchHits.forEach(x -> {
+            String json = x.getSourceAsString();
+            InquireMainInfo inquireMainInfo = jsonConvert.convertFrom(InquireMainInfo.class, json);
+            inquireMainInfos.add(inquireMainInfo);
+        });
+
+        pageFlipper.setTotal(searchHits.getTotalHits());
+        return RetResult.<List<InquireMainInfo>>successT().result(inquireMainInfos).page(pageFlipper);
+    }
+
+    @Override
+    public RetResult<InquireMainInfo> getInquireMainInfo(long id, ERPTokenUser currentUser, String dataSourceId, long supplierCode) {
+        InquireMainInfo info = this.getRedisDocInfo(keysService.getRedisKey(RedisKeys.KEY_ERP_INQUIREINFO, supplierCode), String.valueOf(id), InquireMainInfo.class);
+        if (info == null) return RetResult.<InquireMainInfo>errorT().retcode(-1).retinfo("传入参数不正确");
+        //将子表列进行排序
+        info.getResultColumnList().sort(Comparator.comparing(InquireResultColumn::getSortAsc).thenComparing(InquireResultColumn::getId));
+        info.getConditionList().sort(Comparator.comparing(InquireCondition::getSortAsc).thenComparing(InquireCondition::getId));
+        return RetResult.<InquireMainInfo>successT().retcode(0).result(info);
+    }
+
+
+    /**
+     * 递归给结果表头取id
+     *
+     * @param orgColumns 列
+     * @param idMain     id
+     * @return 列信息
+     */
+    private List<InquireResultColumn> setIdsToResultColumns(List<InquireResultColumn> orgColumns, long idMain, long idParentColumn, String dataSourceId, long supplierCode, ERPTokenUser currentUser) {
+        long subId = tableIdService.getTableIdMulti("eiInquireResultColumn.id", orgColumns.size(), dataSourceId, String.valueOf(supplierCode));
+        for (InquireResultColumn column : orgColumns) {
+            column.setId(subId);
+            column.setIdInquire(idMain);
+            column.setIdParentColumn(idParentColumn);
+            InquireResultColumn.create(column, currentUser.getId());
+
+            List<InquireResultColumn> subResultColumnList = setIdsToResultColumns(column.getChildColumnList(), idMain, column.getId(), dataSourceId, supplierCode, currentUser);
+            column.setChildColumnList(subResultColumnList);
+
+            subId++;
+        }
+        return orgColumns;
+    }
+
+    private List<InquireResultColumn> expandTreeColumns(List<InquireResultColumn> treeList, List<InquireResultColumn> expandList) {
+        expandList.addAll(treeList);
+        treeList.forEach(x -> expandTreeColumns(x.getChildColumnList(), expandList));
+
+        return expandList;
+    }
+
+    @Override
+    public RetResult<InquireMainInfo> addInquireInfo(InquireMainInfo mainInfo, ERPTokenUser currentUser, String dataSourceId, long supplierCode) {
+        //先检查脚本类名是否重复--废弃
+        //还是自动生成
+
+
+        mainInfo.setId(tableIdService.getTableIdMulti("eiInquireMainInfo.id", 1, dataSourceId, String.valueOf(supplierCode)));
+        //还是自动生成脚本类名
+        mainInfo.setInquireFuncName(ERPModule.INQUIREINFO.getScriptPrefix() + mainInfo.getId());
+
+        InquireMainInfo.create(mainInfo, currentUser.getId());
+
+        esClient.getClient()
+                .prepareIndex(keysService.getESKey(ESKeys.ESERPINQUIREINFO_INDEX, supplierCode), ESKeys.ESERPINQUIREMAININFO_TYPE)
+                .setId(String.valueOf(mainInfo.getId()))
+                .setSource(inquireInfoConvert.convertTo(mainInfo), XContentType.JSON)
+                .setRefreshPolicy(WriteRequest.RefreshPolicy.IMMEDIATE)
+                .get();
+
+
+        List<InquireResultColumn> resultColumnList = setIdsToResultColumns(mainInfo.getResultColumnList(), mainInfo.getId(), 0L, dataSourceId, supplierCode, currentUser);
+        mainInfo.setResultColumnList(resultColumnList);
+
+        long subId = tableIdService.getTableIdMulti("eiInquireCondition.id", mainInfo.getConditionList().size(), dataSourceId, String.valueOf(supplierCode));
+        for (InquireCondition x : mainInfo.getConditionList()) {
+            x.setId(subId);
+            x.setIdInquire(mainInfo.getId());
+            InquireCondition.create(x, currentUser.getId());
+
+            subId++;
+        }
+
+        //同步新建出脚本文件,使用通用脚本编辑方式
+        CompletableFuture.runAsync(() -> {
+            //存储文件
+            saveAddScriptIdContent((key) -> {
+                        Map<String, Object> beetlMap = new HashMap<>();
+                        beetlMap.put("userName", currentUser.getUserName());
+                        beetlMap.put("createDate", DateUtil.dateToStr(new Date(), "yyyy-MM-dd"));
+                        beetlMap.put("ActionClassName", mainInfo.getInquireFuncName());
+                        beetlMap.put("InquireName", mainInfo.getInquireName());
+
+                        return beetlMap;
+                    },
+                    "InquireInfoFunction.gtm",
+                    ERPModule.INQUIREINFO, mainInfo.getId(),
+                    dataSourceId, supplierCode,
+                    "查询统计[" + mainInfo.getInquireName() + "]脚本",
+                    currentUser);
+
+            //生成excel模板
+//            addExcelTemplate(mainInfo.getId(), currentUser, dataSourceId, supplierCode);
+        }, docExecutor).whenComplete((v, e) -> {
+            if (e != null) {
+                logger.error(e.getMessage(), e);
+            }
+        });
+
+        redisService.hset(keysService.getRedisKey(RedisKeys.KEY_ERP_INQUIREINFO, supplierCode), String.valueOf(mainInfo.getId()), jsonConvert.convertTo(mainInfo));
+
+        //将resultColumns展开成平铺结构
+        List<InquireResultColumn> expandList = new ArrayList<>();
+        expandTreeColumns(mainInfo.getResultColumnList(), expandList);
+        docDao.addInquireMainInfo(mainInfo, expandList, mainInfo.getConditionList(), dataSourceId, supplierCode);
+
+        return RetResult.<InquireMainInfo>successT().retcode(0).result(mainInfo);
+    }
+
+    @Override
+    public RetResult<InquireMainInfo> updateInquireInfo(InquireMainInfo inquireMainInfo, ERPTokenUser currentUser, String dataSourceId, long supplierCode) {
+        RetResult<InquireMainInfo> mainResult = this.getInquireMainInfo(inquireMainInfo.getId(), currentUser, dataSourceId, supplierCode);
+        if (!mainResult.isSuccess()) return mainResult;
+        InquireMainInfo redisInfo = mainResult.getResult();
+
+        redisInfo.setInquireName(inquireMainInfo.getInquireName());
+        redisInfo.setInquireType(inquireMainInfo.getInquireType());
+        redisInfo.setCanExport(inquireMainInfo.getCanExport());
+        redisInfo.setQueryInPage(inquireMainInfo.getQueryInPage());
+        redisInfo.setConditionList(inquireMainInfo.getConditionList());
+        redisInfo.setResultColumnList(inquireMainInfo.getResultColumnList());
+
+        InquireMainInfo.update(redisInfo, currentUser.getId());
+
+        try (XContentBuilder xContentBuilder = XContentFactory.jsonBuilder()) {
+            xContentBuilder.startObject()
+                    .field("inquireName", redisInfo.getInquireName())
+                    .field("inquireType", redisInfo.getInquireType())
+                    .field("canExport", redisInfo.getCanExport())
+                    .field("queryInPage", redisInfo.getQueryInPage())
+                    .field("conditionList", redisInfo.getConditionList())
+                    .field("resultColumnList", redisInfo.getResultColumnList())
+                    .endObject();
+
+            esClient.getClient().prepareUpdate(keysService.getESKey(ESKeys.ESERPINQUIREINFO_INDEX, supplierCode), ESKeys.ESERPINQUIREMAININFO_TYPE,
+                            String.valueOf(redisInfo.getId()))
+                    .setDoc(xContentBuilder)
+                    .setRefreshPolicy(WriteRequest.RefreshPolicy.IMMEDIATE)
+                    .get();
+
+            List<InquireResultColumn> resultColumnList = setIdsToResultColumns(redisInfo.getResultColumnList(), redisInfo.getId(), 0L, dataSourceId, supplierCode, currentUser);
+            redisInfo.setResultColumnList(resultColumnList);
+
+            long subId = tableIdService.getTableIdMulti("eiInquireCondition.id", redisInfo.getConditionList().size(), dataSourceId, String.valueOf(supplierCode));
+            for (InquireCondition x : redisInfo.getConditionList()) {
+                x.setId(subId);
+                x.setIdInquire(redisInfo.getId());
+                InquireCondition.create(x, currentUser.getId());
+
+                subId++;
+            }
+        } catch (IOException e) {
+            logger.error("修改查询统计信息出错:" + e.getMessage(), e);
+            return RetResult.<InquireMainInfo>errorT().retcode(-1).retinfo("修改查询统计信息出错:" + e.getMessage());
+        }
+        redisService.hset(keysService.getRedisKey(RedisKeys.KEY_ERP_INQUIREINFO, supplierCode), String.valueOf(redisInfo.getId()), jsonConvert.convertTo(redisInfo));
+
+        //将resultColumns展开成平铺结构
+        List<InquireResultColumn> expandList = new ArrayList<>();
+        expandTreeColumns(redisInfo.getResultColumnList(), expandList);
+        docDao.updateInquireMainInfo(redisInfo, expandList, redisInfo.getConditionList(), dataSourceId, supplierCode);
+
+        //异步生成excel模板
+
+        return RetResult.<InquireMainInfo>successT().retcode(0).result(redisInfo);
+    }
+
+    @Override
+    public RetResult<InquireMainInfo> voidInquireInfo(InquireMainInfo inquireMainInfo, ERPTokenUser currentUser, String dataSourceId, long supplierCode) {
+        RetResult<InquireMainInfo> mainResult = this.getInquireMainInfo(inquireMainInfo.getId(), currentUser, dataSourceId, supplierCode);
+        if (!mainResult.isSuccess()) return mainResult;
+        InquireMainInfo redisInfo = mainResult.getResult();
+
+        redisInfo.setVoidFlag(inquireMainInfo.getVoidFlag());
+        InquireMainInfo.update(redisInfo, currentUser.getId());
+        try {
+            esClient.getClient().prepareUpdate(keysService.getESKey(ESKeys.ESERPINQUIREINFO_INDEX, supplierCode), ESKeys.ESERPINQUIREMAININFO_TYPE,
+                            String.valueOf(inquireMainInfo.getId()))
+                    .setDoc(jsonBuilder()
+                            .startObject()
+                            .field("voidFlag", redisInfo.getVoidFlag())
+                            .field("updateBy", redisInfo.getUpdateBy())
+                            .field("updateTimeLong", redisInfo.getUpdateTimeLong())
+                            .endObject())
+                    .get();
+        } catch (IOException e) {
+            logger.error("禁用查询统计信息出错:" + e.getMessage(), e);
+            return RetResult.<InquireMainInfo>errorT().retcode(-1).retinfo("禁用查询统计信息出错:" + e.getMessage());
+        }
+        redisService.hset(keysService.getRedisKey(RedisKeys.KEY_ERP_INQUIREINFO, supplierCode), String.valueOf(redisInfo.getId()), jsonConvert.convertTo(redisInfo));
+        docDao.voidInquireMainInfo(redisInfo, dataSourceId, supplierCode);
+
+        return RetResult.<InquireMainInfo>successT().retcode(0);
+    }
+
+    @Override
+    @SuppressWarnings({"rawtypes", "unchecked"})
+    public RetResult<List<InquireExecRecord>> execInquireResult(ProcessSearchItem source) {
+        RMap searchData = source.getSearchData();
+        if (searchData == null)
+            return RetResult.<List<InquireExecRecord>>errorT().retcode(-1).retinfo("传入参数不正确");
+        if (!(ERPUtils.mapContainKey(searchData, "idInquire") && ERPUtils.mapContainKey(searchData, "conditionList")))
+            return RetResult.<List<InquireExecRecord>>errorT().retcode(-1).retinfo("传入参数不正确");
+        long idInquire = searchData.getLong("idInquire");
+        List<InquireCondition> conditionList = searchData.getList("conditionList");
+
+        RetResult<InquireMainInfo> inquireResult = this.getInquireMainInfo(idInquire, source.getCurrentUser(), source.getDataSourceId(), source.getSupplierCode());
+        if (!inquireResult.isSuccess())
+            return RetResult.<List<InquireExecRecord>>errorT().retcode(-1).retinfo("统计报表不存在");
+        InquireMainInfo mainInfo = inquireResult.getResult();
+        // 将前端传入的查询条件替换
+        mainInfo.setConditionList(conditionList);
+        source.getSearchData().set("inquireInfo", mainInfo);
+
+        if (source.getExportFlag() == 1) {
+            CompletableFuture.runAsync(() -> handleScriptList(mainInfo.getInquireFuncName(), ERPModule.INQUIREINFO, source.getDataSourceId(), source.getSupplierCode(),
+                    () -> source), docExecutor);
+            return RetResult.successT();
+        }
+        return this.handleScriptList(mainInfo.getInquireFuncName(), ERPModule.INQUIREINFO, source.getDataSourceId(), source.getSupplierCode(),
+                () -> source);
+    }
+
+    @Override
+    public RetResult<InquireMainInfo> addExcelTemplate(long id, ERPTokenUser currentUser, String dataSourceId, long supplierCode) {
+        return handleScript("Inquire_AddExcelTemp",
+                ERPModule.DOC,
+                dataSourceId, supplierCode,
+                () -> ProcessIdItem.newBuilder()
+                        .id(id)
+                        .dataSourceId(dataSourceId)
+                        .supplierCode(supplierCode)
+                        .currentUser(currentUser)
+                        .build()
+        );
+    }
+
+    //endregion
+
+    //region 分厂档案
+
+    @Override
+    public CompanyInfo getCompanyInfo(long id, long supplierCode) {
+        return this.getRedisDocInfo(keysService.getRedisKey(RedisKeys.KEY_COMPANY_INFO, supplierCode),
+                String.valueOf(id), CompanyInfo.class);
+    }
+
+    @Override
+    public String getRedisCompanyInfoName(long id, long supplierCode) {
+        CompanyInfo companyInfo = this.getCompanyInfo(id, supplierCode);
+        if (companyInfo == null) {
+            return "";
+        }
+        return companyInfo.getCompanyName();
+    }
+
+    @Override
+    @SuppressWarnings({"rawtypes","unchecked"})
+    public RetResult<List<CompanyInfo>> getCompanyInfoList(RMap searchData, PageFlipper pageFlipper, String dataSourceId, long supplierCode) {
+        RMap params = new RMap();
+        if (searchData != null) {
+            params.putAll(searchData);
+        }
+
+        if (!params.containsKey("voidFlag")) {
+            params.put("voidFlag", -1);
+        }
+
+        List<CompanyInfo> companyList = docDao.selectCompanyInfo(params, dataSourceId, supplierCode, pageFlipper);
+
+        return RetResult.<List<CompanyInfo>>successT().result(companyList).page(pageFlipper);
+    }
+
+    @Override
+    public RetResult<List<CompanyInfo>> getAllCompanyInfoList(String dataSourceId, long supplierCode) {
+        Map<String, String> redisMap = redisService.hgetAll(keysService.getRedisKey(RedisKeys.KEY_COMPANY_INFO, supplierCode));
+
+        List<CompanyInfo> infoList = redisMap.values().stream()
+                .map((x) -> (CompanyInfo) jsonConvert.convertFrom(CompanyInfo.class, x))
+                .filter((x) -> x.getVoidFlag() == 0)
+                .sorted(Comparator.comparingLong(CompanyInfo::getId)).collect(Collectors.toList());
+
+        return RetResult.<List<CompanyInfo>>successT().result(infoList);
+    }
+
+    @Override
+    public RetResult<CompanyInfo> addCompanyInfo(CompanyInfo companyInfo, ERPTokenUser currentUser, String dataSourceId, long supplierCode) {
+        companyInfo.setId(tableIdService.getTableIdMulti("tbCompanyInfo.id", 1, dataSourceId, String.valueOf(supplierCode)));
+        companyInfo.setVoidFlag(0);
+
+        CompanyInfo.create(companyInfo, currentUser.getId());
+
+        redisService.hset(keysService.getRedisKey(RedisKeys.KEY_COMPANY_INFO, supplierCode), String.valueOf(companyInfo.getId()), jsonConvert.convertTo(companyInfo));
+
+        docDao.addCompanyInfo(companyInfo, dataSourceId, supplierCode);
+        return RetResult.successT();
+    }
+
+    @Override
+    public RetResult<CompanyInfo> updateCompanyInfo(CompanyInfo companyInfo, ERPTokenUser currentUser, String dataSourceId, long supplierCode) {
+        if (companyInfo == null || companyInfo.getId() == 0L) {
+            return RetResult.<CompanyInfo>errorT().retinfo("请求数据错误");
+        }
+
+        CompanyInfo redisInfo = getCompanyInfo(companyInfo.getId(), supplierCode);
+        if (redisInfo == null) {
+            return RetResult.<CompanyInfo>errorT().retinfo("不存在此id的分厂信息");
+        }
+
+        CompanyInfo.update(companyInfo, currentUser.getId());
+
+        redisInfo.setCompanyName(companyInfo.getCompanyName());
+        redisInfo.setAddress(companyInfo.getAddress());
+        redisInfo.setLinkMan(companyInfo.getLinkMan());
+        redisInfo.setLinkPhone(companyInfo.getLinkPhone());
+
+        redisInfo.setUpdateBy(companyInfo.getUpdateBy());
+        redisInfo.setUpdateTime(companyInfo.getUpdateTime());
+
+        redisService.hset(keysService.getRedisKey(RedisKeys.KEY_COMPANY_INFO, supplierCode), String.valueOf(redisInfo.getId()), jsonConvert.convertTo(redisInfo));
+
+        docDao.updateCompanyInfo(companyInfo, dataSourceId, supplierCode);
+
+        return RetResult.successT();
+    }
+
+    @Override
+    public RetResult<CompanyInfo> voidCompanyInfo(CompanyInfo companyInfo, ERPTokenUser currentUser, String dataSourceId, long supplierCode) {
+        if (companyInfo == null || companyInfo.getId() == 0L) {
+            return RetResult.<CompanyInfo>errorT().retinfo("请求数据错误");
+        }
+
+        CompanyInfo redisInfo = getCompanyInfo(companyInfo.getId(), supplierCode);
+        if (redisInfo == null) {
+            return RetResult.<CompanyInfo>errorT().retinfo("不存在此id的分厂信息");
+        }
+
+        CompanyInfo.update(companyInfo, currentUser.getId());
+
+        redisInfo.setVoidFlag(companyInfo.getVoidFlag());
+        redisService.hset(keysService.getRedisKey(RedisKeys.KEY_COMPANY_INFO, supplierCode), String.valueOf(redisInfo.getId()), jsonConvert.convertTo(redisInfo));
+
+        docDao.voidCompanyInfo(companyInfo, dataSourceId, supplierCode);
+
+        return RetResult.successT();
+    }
+
+
+    //endregion
+
+    public RetResult<InvokeCallResult> callDoc(InvokeCallParams source, ERPTokenUser currentUser, String dataSourceId, long supplierCode) {
+        if (source == null) {
+            return RetResult.<InvokeCallResult>errorT().retinfo("无效的参数信息");
+        }
+
+        if (StringUtils.isEmpty(source.getBusinessMethod())) {
+            return RetResult.<InvokeCallResult>errorT().retinfo("无效的参数方法[businessMethod]信息");
+        }
+
+        source.setCurrentUser(currentUser);
+        source.setDataSourceId(dataSourceId);
+        source.setSupplierCode(supplierCode);
+
+        return callScript(source.getBusinessMethod(), source, currentUser, dataSourceId, supplierCode);
+    }
+}

+ 84 - 0
yjBusiness/src/main/java/com/yinjie/heating/business/service/ERPServiceImpl.java

@@ -0,0 +1,84 @@
+package com.yinjie.heating.business.service;
+
+import com.yinjie.heating.common.api.ERPService;
+import com.yinjie.heating.common.api.NoSqlKeysService;
+import com.yinjie.heating.common.base.BaseService;
+import com.yinjie.heating.common.datas.RedisKeys;
+import com.yinjie.heating.common.entity.base.DataBaseMultiItemEx;
+import com.dySweetFishPlugin.redis.RedisService;
+import com.sweetfish.convert.json.JsonConvert;
+import com.sweetfish.service.Local;
+import com.sweetfish.util.AutoLoad;
+import com.sweetfish.util.ResourceType;
+import org.apache.commons.lang3.StringUtils;
+
+import javax.annotation.Resource;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+/**
+ * Created by jlutt on 2020-07-29
+ *
+ * @author jlutt
+ */
+@AutoLoad(false)
+@Local
+@ResourceType(ERPService.class)
+public class ERPServiceImpl extends BaseService implements ERPService {
+
+    @Resource
+    RedisService redisService;
+
+    @Resource
+    NoSqlKeysService keysService;
+
+    @Resource
+    JsonConvert jsonConvert;
+
+    /**
+     * 获取平台所有工厂客户列表
+     *
+     * @return 工厂客户列表
+     */
+    @Override
+    public List<DataBaseMultiItemEx> getERPSupplierList() {
+        Map<String, String> redisMap = redisService.hgetAll(keysService.getRedisKey(RedisKeys.KEY_SUPPLIERPLATFORM));
+
+        return redisMap.values().stream().map((x) -> (DataBaseMultiItemEx) jsonConvert.convertFromO(DataBaseMultiItemEx.class, x)).sorted((v1, v2) -> v1.getShardingKey().compareToIgnoreCase(v2.getShardingKey())).collect(Collectors.toList());
+    }
+
+    /**
+     * 获取平台工厂客户信息
+     *
+     * @param id 工厂客户id
+     * @return 工厂客户信息
+     */
+    @Override
+    public DataBaseMultiItemEx getERPSupplierInfo(long id) {
+        String json = redisService.hget(keysService.getRedisKey(RedisKeys.KEY_SUPPLIERPLATFORM), String.valueOf(id));
+
+        if (StringUtils.isEmpty(json)) {
+            return null;
+        }
+
+        return jsonConvert.convertFrom(DataBaseMultiItemEx.class, json);
+    }
+
+    /**
+     * 获取平台工厂客户信息
+     *
+     * @param code 工厂客户code
+     * @return 工厂客户信息
+     */
+    @Override
+    public DataBaseMultiItemEx getERPSupplierInfoByCode(long code) {
+        String json = redisService.hget(keysService.getRedisKey(RedisKeys.KEY_SUPPLIERPCODELATFORM), String.valueOf(code));
+
+        if (StringUtils.isEmpty(json)) {
+            return null;
+        }
+
+        return jsonConvert.convertFrom(DataBaseMultiItemEx.class, json);
+    }
+}

+ 0 - 0
yjBusiness/src/main/java/com/yinjie/heating/business/service/LoginServiceImpl.java


Einige Dateien werden nicht angezeigt, da zu viele Dateien in diesem Diff geändert wurden.