bathfire 2 vuotta sitten
commit
9cf61fbf1d
100 muutettua tiedostoa jossa 42749 lisäystä ja 0 poistoa
  1. 40 0
      .gitignore
  2. 54 0
      conf/KeyCode.xml
  3. 292 0
      conf/KeyId.xml
  4. 49 0
      conf/MachineInfoTemplate.gtm
  5. 76 0
      conf/MachineTypeTemplate.gtm
  6. 73 0
      conf/QuoteScript_Template.gtm
  7. 1370 0
      conf/addressdata/cities.json
  8. 13354 0
      conf/addressdata/counties.json
  9. 126 0
      conf/addressdata/provices.json
  10. 289 0
      conf/application-ddWebOne.xml
  11. 3 0
      conf/callCenter.properties
  12. 17374 0
      conf/emojis.json
  13. 38 0
      conf/esTemplate/clientindustryinfo.json
  14. 137 0
      conf/esTemplate/clientinfo.json
  15. 37 0
      conf/esTemplate/clientlevel.json
  16. 68 0
      conf/esTemplate/clientreceiveaddress.json
  17. 33 0
      conf/esTemplate/dataPurview.json
  18. 135 0
      conf/esTemplate/deliveryFeedBackInfo.json
  19. 119 0
      conf/esTemplate/docIndex.json
  20. 52 0
      conf/esTemplate/inquirecondition.json
  21. 41 0
      conf/esTemplate/inquiremaininfo.json
  22. 58 0
      conf/esTemplate/inquireresultcolumn.json
  23. 92 0
      conf/esTemplate/machineBreedTask.json
  24. 134 0
      conf/esTemplate/materialinfo.json
  25. 21 0
      conf/esTemplate/materialtype.json
  26. 27 0
      conf/esTemplate/oplog.json
  27. 207 0
      conf/esTemplate/orderChargeData.json
  28. 114 0
      conf/esTemplate/orderCostItem.json
  29. 160 0
      conf/esTemplate/orderDeliverInform.json
  30. 79 0
      conf/esTemplate/orderImageDispatchItem.json
  31. 118 0
      conf/esTemplate/orderLifeCycle.json
  32. 81 0
      conf/esTemplate/orderLifeCycleCount.json
  33. 137 0
      conf/esTemplate/orderMaterialItem.json
  34. 285 0
      conf/esTemplate/orderPart.json
  35. 33 0
      conf/esTemplate/orderPartParamValue.json
  36. 173 0
      conf/esTemplate/orderPartProcess.json
  37. 140 0
      conf/esTemplate/orderPrePay.json
  38. 196 0
      conf/esTemplate/orderReceivable.json
  39. 101 0
      conf/esTemplate/orderSendAddress.json
  40. 30 0
      conf/esTemplate/orderStep.json
  41. 219 0
      conf/esTemplate/orderStockItem.json
  42. 114 0
      conf/esTemplate/orderStockLabel.json
  43. 126 0
      conf/esTemplate/outassistinfo.json
  44. 63 0
      conf/esTemplate/paperbaseinfo.json
  45. 74 0
      conf/esTemplate/paperinfo.json
  46. 64 0
      conf/esTemplate/paperquoteinfo.json
  47. 22 0
      conf/esTemplate/papertype.json
  48. 182 0
      conf/esTemplate/printBill.json
  49. 276 0
      conf/esTemplate/printBillBreed.json
  50. 70 0
      conf/esTemplate/printBillLifeCycle.json
  51. 36 0
      conf/esTemplate/printBillStep.json
  52. 126 0
      conf/esTemplate/printBreedPart.json
  53. 377 0
      conf/esTemplate/printOrder.json
  54. 90 0
      conf/esTemplate/product.json
  55. 33 0
      conf/esTemplate/productImage.json
  56. 103 0
      conf/esTemplate/supplierinfo.json
  57. 51 0
      conf/esTemplate/sysmessage.json
  58. 39 0
      conf/esTemplate/sysmessagestatus.json
  59. 33 0
      conf/esTemplate/sysmessagetext.json
  60. 143 0
      conf/esTemplate/workPart.json
  61. 44 0
      conf/esTemplate/workprocess.json
  62. 62 0
      conf/eskeys.properties
  63. 77 0
      conf/log4j2-sweetfish.yml
  64. 4 0
      conf/productKey.txt
  65. 34 0
      conf/redis.properties
  66. 113 0
      conf/rediskeys.properties
  67. 85 0
      conf/redisscript/balance_client_moneys.lua
  68. 11 0
      conf/redisscript/formtoken.lua
  69. 33 0
      conf/redisscript/hincrby_multiple.lua
  70. 13 0
      conf/redisscript/lget_ldel.lua
  71. 146 0
      conf/redisscript/lock_data.lua
  72. 24 0
      conf/redisscript/lock_order.lua
  73. 48 0
      conf/redisscript/lock_order_designer.lua
  74. 57 0
      conf/redisscript/qty_stock_material.lua
  75. 198 0
      conf/redisscript/qty_stock_materials.lua
  76. 102 0
      conf/redisscript/qty_stock_precise.lua
  77. 118 0
      conf/redisscript/qty_stock_virtual.lua
  78. 110 0
      conf/redisscript/qty_stock_virtual_can_negative.lua
  79. 36 0
      conf/redisscript/que_pop.lua
  80. 53 0
      conf/redisscript/tablecode.lua
  81. 53 0
      conf/rexdb-ddWebOne.xml
  82. 17 0
      conf/rexdb-pro.properties
  83. 8 0
      conf/script/1000/addressparser/AreaEnum.groovy
  84. 226 0
      conf/script/1000/addressparser/BE_MapAddressUpdate2.groovy
  85. 804 0
      conf/script/1000/addressparser/BE_ParseAddress.groovy
  86. 112 0
      conf/script/1000/business/BE_DocClearScriptCache.groovy
  87. 168 0
      conf/script/1000/business/BE_ERPLogin.groovy
  88. 502 0
      conf/script/1000/business/BE_IndexCardPanelData.groovy
  89. 35 0
      conf/script/1000/business/BE_Init_ExpandoGroovy.groovy
  90. 51 0
      conf/script/1000/business/BE_System_TestListExt.groovy
  91. 299 0
      conf/script/1000/commons/BreedStatisticsQueryBuilder.groovy
  92. 150 0
      conf/script/1000/commons/ESList.groovy
  93. 123 0
      conf/script/1000/commons/ESMap.groovy
  94. 83 0
      conf/script/1000/commons/ESOne.groovy
  95. 16 0
      conf/script/1000/commons/ExecPageFlipper.groovy
  96. 62 0
      conf/script/1000/commons/GroovyExtensions.groovy
  97. 455 0
      conf/script/1000/commons/OrderStatisticsQueryBuilder.groovy
  98. 27 0
      conf/script/1000/commons/QT.groovy
  99. 3 0
      conf/script/1000/init/First_1_ApplyGroovyExt.groovy
  100. 0 0
      conf/script/1000/init/Ignore_ExecPageFlipper.groovy

+ 40 - 0
.gitignore

@@ -0,0 +1,40 @@
+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
+/logs/
+/.idea/

+ 54 - 0
conf/KeyCode.xml

@@ -0,0 +1,54 @@
+<?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>
+</Items>

+ 292 - 0
conf/KeyId.xml

@@ -0,0 +1,292 @@
+<?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>
+</Items>

+ 49 - 0
conf/MachineInfoTemplate.gtm

@@ -0,0 +1,49 @@
+import com.dderp.common.api.BusinessExecutor
+import com.dderp.common.entity.base.ProcessMapItem
+import com.dderp.common.entity.base.ScriptMapResult
+import com.dderp.common.entity.site.ERPTokenUser
+import com.sweetfish.service.RetResult
+import com.dderp.common.datas.ERPModule
+import org.rex.RMap
+
+/**
+ * Created by #{userName} on #{createDate}.
+ * #{machineInfoName}机台计算工时脚本
+ * @author #{userName}
+ */
+
+class BE_#{ActionClassName} implements BusinessExecutor<ProcessMapItem, ScriptMapResult> {
+
+    @Override
+    String scriptName() {
+        return "机台[#{machineInfoName}]工时计算脚本";
+    }
+
+    ERPModule module() {
+        return ERPModule.MACHINE_INFO;
+    }
+
+    @Override
+    RetResult<ScriptMapResult> execute(ProcessMapItem source) {
+         RMap params = source.itemData;
+         String dataSourceId = source.dataSourceId;
+         long supplierCode = source.supplierCode;
+         ERPTokenUser currentUser = source.currentUser;
+
+         //版套数
+         int psSuite = params.getInt("psSuite");
+         //千印数
+         int printCount1000 = params.getInt("printCount1000");
+
+
+         int workMinutes = psSuite * 5 + printCount1000 * 5; //每套版5分钟+每千印5分钟
+         if (workMinutes < 6) workMinutes = 6; //最少6分钟
+
+
+         RMap resultMap = new RMap<>();
+         resultMap.set("workTime", workMinutes);
+         ScriptMapResult result = new ScriptMapResult();
+         result.setResultMap(resultMap);
+         return RetResult.success().retcode(0).result(result);
+    }
+}

+ 76 - 0
conf/MachineTypeTemplate.gtm

@@ -0,0 +1,76 @@
+import com.dderp.common.api.BusinessExecutor
+import com.dderp.common.datas.ERPModule
+import com.dderp.common.entity.base.ProcessMapItem
+import com.dderp.common.entity.base.ScriptMapResult
+import com.dderp.common.entity.site.ERPTokenUser
+import com.dderp.common.tool.ERPUtils
+import com.sweetfish.service.RetResult
+import org.rex.RMap
+
+/**
+ * Created by #{userName} on #{createDate}.
+ * #{machineTypeName}机型印工计算
+ * @author #{userName}
+ */
+
+class BE_#{ActionClassName} implements BusinessExecutor<ProcessMapItem, ScriptMapResult> {
+
+    @Override
+    String scriptName() {
+        return "机型[#{machineTypeName}]印工计算脚本";
+    }
+
+    ERPModule module() {
+        return ERPModule.MACHINE_TYPE;
+    }
+
+    RetResult<ScriptMapResult> execute(ProcessMapItem source) {
+        RMap params = source.itemData;
+        String dataSourceId = source.dataSourceId;
+        long supplierCode = source.supplierCode;
+        ERPTokenUser currentUser = source.currentUser;
+
+        //需要的字段为 版套数/千印数
+        if (!ERPUtils.mapContainKey(params, "breedFlipType")
+                || !ERPUtils.mapContainKey(params, "printCount") || !ERPUtils.mapContainKey(params, "breedSets")) {
+            return RetResult.<ScriptMapResult> errorT().retinfo("传入参数不正确");
+        }
+
+        //int psGroupCount = params.getInt("psGroupCount");
+        // int printCount1000 = params.getInt("printCount1000");
+        double printCount = params.getInt("printCount");
+        int breedFlipType = params.getInt("breedFlipType");
+        int breedSets = params.getInt("breedSets");
+        double qbjia = 380;
+        double jtjia = 80;
+        printCount = Math.ceil(printCount * 0.001);
+        //五色三菱机380元/套含版含千印,之后千印80元
+        double printFee = qbjia;
+        if (breedFlipType == 1) {
+            if (printCount > 1) {
+                double divCount = printCount - 1;
+                printFee += divCount * jtjia;
+            }
+            printFee = printFee * 2 * breedSets;
+        } else if (breedFlipType > 1 && breedFlipType < 4) {
+            if (printCount > 1) {
+                double divCount = printCount - 1;
+                printFee += divCount * jtjia * 2;
+            }
+            printFee = printFee * breedSets;
+        } else if (breedFlipType == 4) {
+            if (printCount > 1) {
+                double divCount = printCount - 1;
+                printFee += divCount * jtjia;
+            }
+            printFee = printFee * breedSets;
+        }
+
+
+        RMap resultMap = new RMap();
+        resultMap.set("printFee", printFee);
+
+
+        return RetResult.<ScriptMapResult> successT().result(new ScriptMapResult(resultMap));
+    }
+}

+ 73 - 0
conf/QuoteScript_Template.gtm

@@ -0,0 +1,73 @@
+import com.dderp.common.api.BusinessExecutor
+import com.dderp.common.datas.ERPModule
+import com.dderp.common.entity.base.ScriptMapResult
+import com.dderp.common.entity.order.PrintOrder
+import com.dderp.common.entity.product.ProcessOrderQuoteItem
+import com.dderp.common.entity.product.ProductInfo
+import com.sweetfish.service.RetResult
+import org.rex.RMap
+
+import javax.annotation.Resource
+
+/**
+ * Created by #{userName} on #{createDate}.
+ * #{productName}报价脚本实现
+ * @author #{userName}
+ */
+
+class BE_#{ScriptClassName} implements BusinessExecutor<ProcessOrderQuoteItem, ScriptMapResult> {
+
+    @Resource(name = "APP_HOME")
+    String appHome
+
+    String scriptName() {
+        return "产品[#{productName}]报价脚本"
+    }
+
+    ERPModule module() {
+        return ERPModule.PRODUCT_QUOTE
+    }
+
+    //参数,注意下面都是示例
+    //vbegin
+    //[印工]
+    double printMoney = 1.123
+    //[覆膜单价]
+    double fumoMoney = 2.234
+    //[封皮价格.规格,联数,开数,印色,单价]
+    String fpFile = "testTable.json"
+    //vend
+
+    def fpTable = []
+
+    void start(long supplierCode) {
+        fpTable = QT.load(appHome, supplierCode, fpFile)
+    }
+
+    RetResult<ScriptMapResult> execute(ProcessOrderQuoteItem source) {
+        BigDecimal dMoney = BigDecimal.ZERO
+
+        PrintOrder printOrder = source.printOrder
+        //产品信息,包括部件,部件参数等
+        ProductInfo productInfo = source.productInfo
+
+        //开始报价计算
+
+        printOrder.partList.each { orderPart ->
+            //orderPart即为部件
+
+            //获取部件参数示例
+            String paperSize = orderPart quoteProduct productInfo quoteParameterValue "尺寸"
+
+            //获取部件工艺,只有ERP报价系统需要,如果是商城系统,那么工艺会作为参数传入,
+        }
+
+        //返回价格,请修改为对应的价格
+        RMap map = new RMap()
+        //基础价,代理价,交易价
+        map.put("BaseMoney", BigDecimal.ZERO)
+        map.put("ProxyMoney", BigDecimal.ZERO)
+        map.put("TotalMoney", dMoney)
+        return RetResult.<ScriptMapResult> successT().result(new ScriptMapResult(map))
+    }
+}

Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 1370 - 0
conf/addressdata/cities.json


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 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": "新疆维吾尔自治区"
+  }
+]

+ 289 - 0
conf/application-ddWebOne.xml

@@ -0,0 +1,289 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<application port="51100" lib="">
+
+    <resources>
+        <group name="ERP_SERVICE_REMOTE">
+            <node addr="127.0.0.1" port="51101"/>
+        </group>
+
+        <properties load="redis.properties;workProcess.properties;callCenter.properties">
+            <property name="orderFileRoot" value="${APP_HOME}/orderFiles"/>
+            <!--注入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="aeerp:tableid:"/>
+            <property name="tableCodePrefix" value="aeerp: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="dnyDriver.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="webSocketServerName" value="aws"/>
+
+            <!--分厂维护服务地址-->
+            <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="51102" maxbody="5m" aliveTimeoutSeconds="0">
+        <!-- 前端配置了nginx,需要配置才能获取客户端真实的IP地址 -->
+        <request>
+            <remoteaddr value="request.headers.X-Forwarded-For"/>
+        </request>
+
+        <services autoload="false" includes="">
+            <service value="com.dderp.webcore.rest.ERPRest"/>
+            <service value="com.dderp.webcore.rest.AdminRest">
+                <isUseScriptService value="true"/>
+            </service>
+            <service value="com.dderp.webcore.rest.ERPUpdateRest"/>
+            <service value="com.dderp.webcore.rest.SystemRest"/>
+            <service value="com.dderp.webcore.rest.DocInfoRest">
+                <isUseScriptService value="true"/>
+            </service>
+            <service value="com.dderp.webcore.rest.ProductRest"/>
+        </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.dderp.webcore.servlet.ERPSessionFilter"/>
+        </filters>
+
+        <!--管理提供给管理用户的接口-->
+        <rest autoload="false" base="com.dderp.common.base.ERPAdminHttpServlet">
+            <service value="com.dderp.webcore.rest.ERPRest"/>
+            <service value="com.dderp.webcore.rest.AdminRest" >
+                <isUseScriptService value="true"/>
+            </service>
+            <service value="com.dderp.webcore.rest.ERPUpdateRest"/>
+            <service value="com.dderp.webcore.rest.SystemRest"/>
+            <service value="com.dderp.webcore.rest.DocInfoRest">
+                <isUseScriptService value="true"/>
+            </service>
+            <service value="com.dderp.webcore.rest.ProductRest"/>
+
+            <websocket value="com.dderp.webcore.websocket.ERPWebSocket" name="aws" groups="ERP_SERVICE_REMOTE"/>
+        </rest>
+
+
+
+        <servlets autoload="false">
+            <servlet value="com.dderp.webcore.servlet.ERPCallServlet" />
+        </servlets>
+    </server>
+
+    <server protocol="SNCP" host="127.0.0.1" port="51101" aliveTimeoutSeconds="0">
+        <services autoload="false" includes="">
+            <service value="com.dySweetFishPlugin.sql.SqlService" groups="ERP_SERVICE_REMOTE"/>
+            <service value="com.dySweetFishPlugin.sql.DBService" groups="ERP_SERVICE_REMOTE">
+                <!--封装rexdb数据库操作服务,maxsize缓存最大查询结果数量,expireminutes缓存超时时间,分钟单位-->
+                <maxsize value="100"/>
+                <expireminutes value="1"/>
+            </service>
+
+            <service value="com.dySweetFishPlugin.redis.RedisService" groups="ERP_SERVICE_REMOTE"/>
+            <service value="com.dySweetFishPlugin.sql.TableIdService" groups="ERP_SERVICE_REMOTE">
+                <tableSharding value="com.dderp.business.dao.TableIdShardingStrategy"/>
+                <!--多数据源-->
+                <dataBaseMulti value="true"/>
+            </service>
+
+            <service value="com.dySweetFishPlugin.sql.dao.TunaDaoService" groups="ERP_SERVICE_REMOTE"/>
+            <service value="com.dySweetFishPlugin.sql.dao.TunaService" groups="ERP_SERVICE_REMOTE">
+                <dao value="com.dderp.business.dao.LoginDao"/>
+                <dao value="com.dderp.business.dao.SystemDao"/>
+                <dao value="com.dderp.business.dao.DocDao"/>
+                <dao value="com.dderp.business.dao.ProductDao"/>
+                <dao value="com.dderp.business.dao.ClientDao"/>
+                <dao value="com.dderp.business.dao.OutAssistDao"/>
+                <dao value="com.dderp.business.dao.SupplierDao"/>
+                <dao value="com.dderp.business.dao.MaterialDao"/>
+                <dao value="com.dderp.business.dao.PaperDao"/>
+<!--                <dao value="com.dderp.business.dao.OrderDao"/>-->
+            </service>
+
+            <service value="com.dySweetFishPlugin.redis.jobqueue.RedisJQService" groups="ERP_SERVICE_REMOTE"/>
+            <service value="com.dySweetFishPlugin.redis.jobqueue.RedisJobProducer" groups="ERP_SERVICE_REMOTE"/>
+            <service value="com.dySweetFishPlugin.redis.jobqueue.RedisJobConsumer" groups="ERP_SERVICE_REMOTE">
+            </service>
+
+            <service value="com.dderp.common.api.NoSqlKeysService" load="rediskeys.properties;eskeys.properties"
+                     groups="ERP_SERVICE_REMOTE"/>
+
+            <service value="com.dderp.common.api.TypeTokenConvertService" groups="ERP_SERVICE_REMOTE"/>
+
+            <service value="com.dySweetFishPlugin.elasticsearch.ESClient" groups="ERP_SERVICE_REMOTE">
+                <clusterName value="elasticsearch"/>
+                <host value="192.168.1.248"/>
+                <port value="9300"/>
+            </service>
+
+            <service value="com.dderp.common.api.ERPLockDataService" groups="ERP_SERVICE_REMOTE">
+                <master value="true"/>
+            </service>
+
+            <service value="com.dderp.common.api.QRCodeService" groups="ERP_SERVICE_REMOTE">
+                <orderRule value="ProtocolCode"/>
+            </service>
+
+            <service value="com.dderp.common.tool.CodeGenerate" groups="ERP_SERVICE_REMOTE">
+                <master value="true"/>
+            </service>
+
+            <service value="com.dderp.common.tool.ProductTagWordFilter" groups="ERP_SERVICE_REMOTE">
+                <dicFile value="productKey.txt"/>
+            </service>
+
+            <service value="com.dderp.common.api.OpLogService" groups="ERP_SERVICE_REMOTE"/>
+
+            <service name="aws" value="com.sweetfish.source.CacheMemorySource" groups="ERP_SERVICE_REMOTE">
+            </service>
+            <service name="aws" value="com.sweetfish.service.WebSocketNodeService" groups="ERP_SERVICE_REMOTE"/>
+
+            <service value="com.dderp.business.service.SupplierInitImpl" groups="ERP_SERVICE_REMOTE">
+                <master value="true"/>
+                <environment value="dev"/>
+                <clearESData value="false" />
+            </service>
+
+            <service value="com.dderp.business.service.ERPServiceImpl" groups="ERP_SERVICE_REMOTE">
+                <master value="true"/>
+            </service>
+
+            <service value="com.dderp.business.service.SysMessageServiceImpl" groups="ERP_SERVICE_REMOTE">
+                <master value="true"/>
+            </service>
+
+            <service value="com.dderp.common.api.ERPLockDataService" groups="ERP_SERVICE_REMOTE">
+                <master value="true"/>
+            </service>
+
+            <service value="com.dderp.business.service.DocInfoServiceImpl" groups="ERP_SERVICE_REMOTE">
+                <master value="true"/>
+                <!--使用业务脚本-->
+                <isUseScriptService value="true"/>
+            </service>
+
+            <service value="com.dderp.business.service.SystemServiceImpl" groups="ERP_SERVICE_REMOTE">
+                <master value="true"/>
+                <isUseScriptService value="true"/>
+                <preCompiler value="1000/business/BE_System_TestListExt.groovy"/>
+            </service>
+
+            <service value="com.dderp.business.service.LoginServiceImpl" groups="ERP_SERVICE_REMOTE">
+                <master value="true"/>
+                <isUseScriptService value="true"/>
+            </service>
+
+            <service value="com.dderp.business.service.LoginUserServiceImpl" groups="ERP_SERVICE_REMOTE">
+                <master value="true"/>
+                <isUseScriptService value="false"/>
+            </service>
+
+            <service value="com.dderp.business.service.PermissionServiceImpl" groups="ERP_SERVICE_REMOTE">
+                <master value="true"/>
+                <isUseScriptService value="false"/>
+            </service>
+
+            <service value="com.dderp.business.service.RoleServiceImpl" groups="ERP_SERVICE_REMOTE">
+                <master value="true"/>
+                <isUseScriptService value="false"/>
+            </service>
+
+            <service value="com.dderp.business.service.ConfigServiceImpl" groups="ERP_SERVICE_REMOTE">
+                <master value="true"/>
+                <isUseScriptService value="false"/>
+            </service>
+
+            <service value="com.dderp.business.service.DictServiceImpl" groups="ERP_SERVICE_REMOTE">
+                <master value="true"/>
+                <isUseScriptService value="false"/>
+            </service>
+
+            <service value="com.dderp.business.service.MenuServiceImpl" groups="ERP_SERVICE_REMOTE">
+                <master value="true"/>
+                <isUseScriptService value="false"/>
+            </service>
+
+            <service value="com.dderp.business.service.DeptServiceImpl" groups="ERP_SERVICE_REMOTE">
+                <master value="true"/>
+                <isUseScriptService value="false"/>
+            </service>
+
+            <service value="com.dderp.business.service.erp.ProductServiceImpl" groups="ERP_SERVICE_REMOTE">
+                <master value="true"/>
+                <isUseScriptService value="true"/>
+            </service>
+
+            <service value="com.dderp.business.service.erp.OrderServiceImpl" groups="ERP_SERVICE_REMOTE">
+                <master value="true"/>
+                <isUseScriptService value="true"/>
+            </service>
+
+            <service value="com.dderp.business.service.erp.OrderSearchServiceImpl" groups="ERP_SERVICE_REMOTE">
+                <master value="true"/>
+                <isUseScriptService value="true"/>
+            </service>
+
+            <service value="com.dderp.business.service.erp.ClientServiceImpl" groups="ERP_SERVICE_REMOTE">
+                <master value="true"/>
+                <isUseScriptService value="true"/>
+            </service>
+
+            <service value="com.dderp.business.service.erp.OutAssistServiceImpl" groups="ERP_SERVICE_REMOTE">
+                <master value="true"/>
+                <isUseScriptService value="true"/>
+            </service>
+
+            <service value="com.dderp.business.service.erp.SupplierServiceImpl" groups="ERP_SERVICE_REMOTE">
+                <master value="true"/>
+                <isUseScriptService value="true"/>
+            </service>
+
+            <service value="com.dderp.business.service.erp.MaterialServiceImpl" groups="ERP_SERVICE_REMOTE">
+                <master value="true"/>
+                <isUseScriptService value="true"/>
+            </service>
+
+            <service value="com.dderp.business.service.erp.PaperServiceImpl" groups="ERP_SERVICE_REMOTE">
+                <master value="true"/>
+                <isUseScriptService value="true"/>
+            </service>
+        </services>
+    </server>
+</application>

+ 3 - 0
conf/callCenter.properties

@@ -0,0 +1,3 @@
+product.center.call.url = http://192.168.1.17:8080/apis/call/gateway
+product.center.call.clientCode = abc
+product.center.call.md5Key = dddd

Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 17374 - 0
conf/emojis.json


+ 38 - 0
conf/esTemplate/clientindustryinfo.json

@@ -0,0 +1,38 @@
+{
+  "info": {
+    "properties": {
+      "id": {
+        "type": "long"
+      },
+      "industryCode": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "industryName": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "enable": {
+        "type": "long"
+      },
+      "createBy": {
+        "type": "long"
+      },
+      "createTime": {
+        "type": "long"
+      },
+      "createTimeLong": {
+        "type": "long"
+      },
+      "updateBy": {
+        "type": "long"
+      },
+      "updateTime": {
+        "type": "long"
+      },
+      "updateTimeLong": {
+        "type": "long"
+      }
+    }
+  }
+}

+ 137 - 0
conf/esTemplate/clientinfo.json

@@ -0,0 +1,137 @@
+{
+  "info": {
+    "properties": {
+      "id": {
+        "type": "long"
+      },
+      "idIndustry": {
+        "type": "long"
+      },
+      "industryName": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "clientName": {
+        "type": "text",
+        "analyzer": "index_ansj",
+        "search_analyzer": "query_ansj",
+        "fields": {
+          "raw": {
+            "type":  "keyword"
+          },
+          "raw2": {
+            "type":  "text",
+            "index": "analyzed",
+            "analyzer": "keywordignorespace_analyzer"
+          },
+          "number": {
+            "type": "text",
+            "index": "analyzed",
+            "analyzer": "number_analyzer"
+          },
+          "letter": {
+            "type": "text",
+            "index": "analyzed",
+            "analyzer": "letter_analyzer"
+          }
+        }
+      },
+      "contactMan": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "contactPhone": {
+        "type": "text",
+        "index": "analyzed",
+        "analyzer": "codefull_analyzer",
+        "fields": {
+          "raw": {
+            "type": "keyword"
+          }
+        }
+      },
+      "clientCode": {
+        "type": "text",
+        "index": "analyzed",
+        "analyzer": "codefull_analyzer",
+        "fields": {
+          "raw": {
+            "type": "keyword"
+          }
+        }
+      },
+      "province": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "city": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "area": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "address": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "clientFrom": {
+        "type": "long"
+      },
+      "overdraftQuota": {
+        "type": "long"
+      },
+      "idLevel": {
+        "type": "long"
+      },
+      "levelName": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "idSalesManBelong": {
+        "type": "long"
+      },
+      "salesManNameBelong": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "enable": {
+        "type": "long"
+      },
+      "createBy": {
+        "type": "long"
+      },
+      "createTime": {
+        "type": "long"
+      },
+      "createTimeLong": {
+        "type": "long"
+      },
+      "updateBy": {
+        "type": "long"
+      },
+      "updateTime": {
+        "type": "long"
+      },
+      "updateTimeLong": {
+        "type": "long"
+      },
+      "signKey": {
+        "type": "keyword"
+      },
+      "dutyMan": {
+        "type": "text",
+        "index": "not_analyzed",
+        "fields": {
+          "raw": {
+            "type": "keyword"
+          }
+        }
+      },
+      "againstFlag": {
+        "type": "long"
+      }
+    }
+  }
+}

+ 37 - 0
conf/esTemplate/clientlevel.json

@@ -0,0 +1,37 @@
+{
+  "info": {
+    "properties": {
+      "id": {
+        "type": "long"
+      },
+      "levelName": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "enable": {
+        "type": "long"
+      },
+      "levelValue": {
+        "type": "long"
+      },
+      "createBy": {
+        "type": "long"
+      },
+      "createTime": {
+        "type": "long"
+      },
+      "createTimeLong": {
+        "type": "long"
+      },
+      "updateBy": {
+        "type": "long"
+      },
+      "updateTime": {
+        "type": "long"
+      },
+      "updateTimeLong": {
+        "type": "long"
+      }
+    }
+  }
+}

+ 68 - 0
conf/esTemplate/clientreceiveaddress.json

@@ -0,0 +1,68 @@
+{
+  "info": {
+    "properties": {
+      "id": {
+        "type": "long"
+      },
+      "idClient": {
+        "type": "long"
+      },
+      "receiveMan": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "receivePhone": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "idShipArea": {
+        "type": "long"
+      },
+      "shipArea": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "province": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "city": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "area": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "address": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "coordinate": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "defaultFlag": {
+        "type": "long"
+      },
+      "createBy": {
+        "type": "long"
+      },
+      "createTime": {
+        "type": "long"
+      },
+      "createTimeLong": {
+        "type": "long"
+      },
+      "updateBy": {
+        "type": "long"
+      },
+      "updateTime": {
+        "type": "long"
+      },
+      "updateTimeLong": {
+        "type": "long"
+      }
+    }
+  }
+}

+ 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"
+          }
+        }
+      }
+    }
+  }
+}

+ 135 - 0
conf/esTemplate/deliveryFeedBackInfo.json

@@ -0,0 +1,135 @@
+{
+  "deliveryfeedbackinfo": {
+    "_parent": {
+      "type": "info"
+    },
+    "properties": {
+      "id": {
+        "type": "long"
+      },
+      "idSendBillItem": {
+        "type": "long"
+      },
+      "idOrder": {
+        "type": "long"
+      },
+      "orderYear": {
+        "type": "integer"
+      },
+      "idLogisticsInfo": {
+        "type": "long"
+      },
+      "logisticsCode": {
+        "type": "text",
+        "index": "analyzed",
+        "analyzer": "codefull_analyzer",
+        "fields": {
+          "raw": {
+            "type": "keyword"
+          }
+        }
+      },
+      "logisticsName": {
+        "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"
+          }
+        }
+      },
+      "chargeKind": {
+        "type": "integer"
+      },
+      "logisticsRecMoney": {
+        "type": "double"
+      },
+      "idGuarantor": {
+        "type": "long"
+      },
+      "guarantorName": {
+        "type": "text",
+        "index": "not_analyzed",
+        "fields": {
+          "raw": {
+            "type": "keyword"
+          }
+        }
+      },
+      "guarantorMoney": {
+        "type": "double"
+      },
+      "chargeMemo": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "voidFlag": {
+        "type": "integer"
+      },
+      "feedBackKind": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "sendMan": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "reviewMemo": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "sendDateLong": {
+        "type": "long"
+      },
+      "itemState": {
+        "type": "long"
+      },
+      "guarantorCheckFlag": {
+        "type": "integer"
+      },
+      "driverName": {
+        "type": "text",
+        "index": "analyzed",
+        "analyzer": "codefull_analyzer",
+        "fields": {
+          "raw": {
+            "type": "keyword"
+          }
+        }
+      },
+      "expressName": {
+        "type": "text",
+        "index": "analyzed",
+        "analyzer": "codefull_analyzer",
+        "fields": {
+          "raw": {
+            "type": "keyword"
+          }
+        }
+      },
+      "createBy": {
+        "type": "long"
+      },
+      "createTimeLong": {
+        "type": "long"
+      },
+      "updateBy": {
+        "type": "long"
+      },
+      "updateTimeLong": {
+        "type": "long"
+      }
+    }
+  }
+}

+ 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"
+      }
+    }
+  }
+}

+ 92 - 0
conf/esTemplate/machineBreedTask.json

@@ -0,0 +1,92 @@
+{
+  "machinebreedtask": {
+    "_parent": {
+      "type": "breed"
+    },
+    "properties": {
+      "id": {
+        "type": "long"
+      },
+      "billYear": {
+        "type": "integer"
+      },
+      "idMachineInfo": {
+        "type": "long"
+      },
+      "idProcess": {
+        "type": "long"
+      },
+      "idPrintBreed": {
+        "type": "long"
+      },
+      "idPrintBill": {
+        "type": "long"
+      },
+      "expectedWorkTime": {
+        "type": "double"
+      },
+      "beginAtLong": {
+        "type": "long"
+      },
+      "completeAtLong": {
+        "type": "long"
+      },
+      "scheduleStatus": {
+        "type": "long"
+      },
+      "pauseStatus": {
+        "type": "long"
+      },
+      "taskStatus": {
+        "type": "long"
+      },
+      "sortIndex": {
+        "type": "long"
+      },
+      "lastOperateManId": {
+        "type": "long"
+      },
+      "lastOperateManName": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "taskMemo": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "voidFlag": {
+        "type": "integer"
+      },
+      "assembleBreedId": {
+        "type": "long"
+      },
+      "madeBreedId": {
+        "type": "long"
+      },
+      "cutPaperId": {
+        "type": "long"
+      },
+      "printId": {
+        "type": "long"
+      },
+      "createBy": {
+        "type": "long"
+      },
+      "createTime": {
+        "type": "long"
+      },
+      "createTimeLong": {
+        "type": "long"
+      },
+      "updateBy": {
+        "type": "long"
+      },
+      "updateTime": {
+        "type": "long"
+      },
+      "updateTimeLong": {
+        "type": "long"
+      }
+    }
+  }
+}

+ 134 - 0
conf/esTemplate/materialinfo.json

@@ -0,0 +1,134 @@
+{
+  "info": {
+    "properties": {
+      "id": {
+        "type": "long"
+      },
+      "idMaterialType": {
+        "type": "long"
+      },
+      "materialTypeName": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "materialName": {
+        "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"
+          }
+        }
+      },
+      "mtModel": {
+        "type": "text",
+        "analyzer": "index_ansj",
+        "search_analyzer": "query_ansj"
+      },
+      "mtRule": {
+        "type": "text",
+        "analyzer": "index_ansj",
+        "search_analyzer": "query_ansj"
+      },
+      "mtUnit": {
+        "type": "text",
+        "index": "not_analyzed",
+        "fields": {
+          "raw": {
+            "type": "keyword"
+          },
+          "number": {
+            "type": "text",
+            "index": "analyzed",
+            "analyzer": "number_analyzer"
+          },
+          "letter": {
+            "type": "text",
+            "index": "analyzed",
+            "analyzer": "letter_analyzer"
+          }
+        }
+      },
+      "byUnit": {
+        "type": "text",
+        "index": "not_analyzed",
+        "fields": {
+          "raw": {
+            "type": "keyword"
+          }
+        }
+      },
+      "seUnit": {
+        "type": "text",
+        "index": "not_analyzed",
+        "fields": {
+          "raw": {
+            "type": "keyword"
+          }
+        }
+      },
+      "convertUnitByToMt": {
+        "type": "double"
+      },
+      "convertUnitMtToSe": {
+        "type": "double"
+      },
+      "newestPrice": {
+        "type": "double"
+      },
+      "voidFlag": {
+        "type": "integer"
+      },
+      "remark": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "materialCode": {
+        "type": "text",
+        "index": "analyzed",
+        "analyzer": "codefull_analyzer",
+        "fields": {
+          "raw": {
+            "type": "keyword"
+          }
+        }
+      },
+      "barCode": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "stockPrecision": {
+        "type": "integer"
+      },
+      "createBy": {
+        "type": "long"
+      },
+      "createTimeLong": {
+        "type": "long"
+      },
+      "updateBy": {
+        "type": "long"
+      },
+      "updateTimeLong": {
+        "type": "long"
+      },
+      "priceType": {
+        "type": "long"
+      },
+      "machineRequestFlag": {
+        "type": "integer"
+      }
+    }
+  }
+}

+ 21 - 0
conf/esTemplate/materialtype.json

@@ -0,0 +1,21 @@
+{
+  "info": {
+    "properties": {
+      "id": {
+        "type": "long"
+      },
+      "materialTypeName": {
+        "type": "text",
+        "index": "not_analyzed",
+        "fields": {
+          "raw": {
+            "type": "keyword"
+          }
+        }
+      },
+      "voidFlag": {
+        "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"
+      }
+    }
+  }
+}

+ 207 - 0
conf/esTemplate/orderChargeData.json

@@ -0,0 +1,207 @@
+{
+  "orderchargedata": {
+    "_parent": {
+      "type": "orderreceivable"
+    },
+    "properties": {
+      "id": {
+        "type": "long"
+      },
+      "idReceivable": {
+        "type": "long"
+      },
+      "idPaymentOrderGroup": {
+        "type": "long"
+      },
+      "chargeCode": {
+        "type": "text",
+        "index": "analyzed",
+        "analyzer": "codefull_analyzer",
+        "fields": {
+          "raw": {
+            "type": "keyword"
+          }
+        }
+      },
+      "lockFlag": {
+        "type": "integer"
+      },
+      "lockMan": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "financeCode": {
+        "type": "text",
+        "index": "analyzed",
+        "analyzer": "codefull_analyzer",
+        "fields": {
+          "raw": {
+            "type": "keyword"
+          }
+        }
+      },
+      "idClient": {
+        "type": "long"
+      },
+      "clientName": {
+        "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"
+          }
+        }
+      },
+      "orderName": {
+        "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"
+          }
+        }
+      },
+      "receivableMoney": {
+        "type": "double"
+      },
+      "agioMoney": {
+        "type": "double"
+      },
+      "agioMemo": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "idAccount": {
+        "type": "long"
+      },
+      "accountName": {
+        "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"
+          }
+        }
+      },
+      "voucherCode": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "payMan": {
+        "type": "text",
+        "index": "not_analyzed",
+        "fields": {
+          "raw": {
+            "type": "keyword"
+          }
+        }
+      },
+      "dataKind": {
+        "type": "integer"
+      },
+      "chargeKind": {
+        "type": "integer"
+      },
+      "chargeMan": {
+        "type": "text",
+        "index": "not_analyzed",
+        "fields": {
+          "raw": {
+            "type": "keyword"
+          }
+        }
+      },
+      "orderCreateTimeLong": {
+        "type": "long"
+      },
+      "orderCreateMan": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "voidFlag": {
+        "type": "integer"
+      },
+      "billYear": {
+        "type": "integer"
+      },
+      "idOrder": {
+        "type": "long"
+      },
+      "receiveCode": {
+        "type": "text",
+        "index": "analyzed",
+        "analyzer": "codefull_analyzer",
+        "fields": {
+          "raw": {
+            "type": "keyword"
+          }
+        }
+      },
+      "chargeDateLong": {
+        "type": "long"
+      },
+      "createBy": {
+        "type": "long"
+      },
+      "createTimeLong": {
+        "type": "long"
+      },
+      "updateBy": {
+        "type": "long"
+      },
+      "updateTimeLong": {
+        "type": "long"
+      },
+      "orderCode": {
+        "type": "text",
+        "index": "analyzed",
+        "analyzer": "codefull_analyzer",
+        "fields": {
+          "raw": {
+            "type": "keyword"
+          }
+        }
+      },
+      "chargeMemo": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "redState": {
+        "type": "integer"
+      }
+    }
+  }
+}

+ 114 - 0
conf/esTemplate/orderCostItem.json

@@ -0,0 +1,114 @@
+{
+  "ordercostitem": {
+    "_parent": {
+      "type": "info"
+    },
+    "properties": {
+      "id": {
+        "type": "long"
+      },
+      "idOrder": {
+        "type": "long"
+      },
+      "costItemValue": {
+        "type": "integer"
+      },
+      "costItemName": {
+        "type": "text",
+        "index": "not_analyzed",
+        "fields": {
+          "raw": {
+            "type": "keyword"
+          }
+        }
+      },
+      "direction": {
+        "type": "integer"
+      },
+      "machineUseMoney": {
+        "type": "double"
+      },
+      "referenceId": {
+        "type": "integer"
+      },
+      "referenceName": {
+        "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"
+          }
+        }
+      },
+      "mtRule": {
+        "type": "keyword",
+        "index": "not_analyzed",
+        "fields": {
+          "number": {
+            "type": "text",
+            "index": "analyzed",
+            "analyzer": "number_analyzer"
+          }
+        }
+      },
+      "useQty": {
+        "type": "double"
+      },
+      "price": {
+        "type": "double"
+      },
+      "money": {
+        "type": "double"
+      },
+      "idTeam": {
+        "type": "long"
+      },
+      "teamName": {
+        "type": "text",
+        "index": "not_analyzed",
+        "fields": {
+          "raw": {
+            "type": "keyword"
+          }
+        }
+      },
+      "memo": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "createMan": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "checkState": {
+        "type": "integer"
+      },
+      "sortIndex": {
+        "type": "integer"
+      },
+      "createBy": {
+        "type": "long"
+      },
+      "createTimeLong": {
+        "type": "long"
+      },
+      "updateBy": {
+        "type": "long"
+      },
+      "updateTimeLong": {
+        "type": "long"
+      }
+    }
+  }
+}

+ 160 - 0
conf/esTemplate/orderDeliverInform.json

@@ -0,0 +1,160 @@
+{
+  "orderdeliverinform": {
+    "_parent": {
+      "type": "info"
+    },
+    "properties": {
+      "id": {
+        "type": "long"
+      },
+      "idOrder": {
+        "type": "long"
+      },
+      "idOrderSendAddress": {
+        "type": "long"
+      },
+      "linkMan": {
+        "type": "text",
+        "index": "not_analyzed",
+        "fields": {
+          "raw": {
+            "type": "keyword"
+          }
+        }
+      },
+      "linkPhone": {
+        "type": "text",
+        "index": "analyzed",
+        "analyzer": "codefull_analyzer",
+        "fields": {
+          "raw": {
+            "type": "keyword"
+          }
+        }
+      },
+      "sendProvince": {
+        "type": "keyword",
+        "index": "not_analyzed"
+      },
+      "sendCity": {
+        "type": "keyword",
+        "index": "not_analyzed"
+      },
+      "sendDistrict": {
+        "type": "keyword",
+        "index": "not_analyzed"
+      },
+      "sendAddress": {
+        "type": "text",
+        "analyzer": "index_ansj",
+        "search_analyzer": "query_ansj",
+        "fields": {
+          "raw": {
+            "type": "keyword"
+          }
+        }
+      },
+      "needDeliverQty": {
+        "type": "double"
+      },
+      "deliveredQty": {
+        "type": "double"
+      },
+      "sendKind": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "searchSendKind": {
+        "type": "text",
+        "analyzer": "index_ansj",
+        "search_analyzer": "query_ansj",
+        "fields": {
+          "raw": {
+            "type": "keyword"
+          }
+        }
+      },
+      "idLogistics": {
+        "type": "long"
+      },
+      "logisticsName": {
+        "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"
+          }
+        }
+      },
+      "longitude": {
+        "type": "double"
+      },
+      "latitude": {
+        "type": "double"
+      },
+      "orderYear": {
+        "type": "integer"
+      },
+      "orderMoneyTotal": {
+        "type": "double"
+      },
+      "orderMoneyPay": {
+        "type": "double"
+      },
+      "sendState": {
+        "type": "integer"
+      },
+      "createBy": {
+        "type": "long"
+      },
+      "createTimeLong": {
+        "type": "long"
+      },
+      "updateBy": {
+        "type": "long"
+      },
+      "updateTimeLong": {
+        "type": "long"
+      },
+      "idClient": {
+        "type": "long"
+      },
+      "sendRegion": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "voidFlag": {
+        "type": "integer"
+      },
+      "acDeliverDateLong": {
+        "type": "long"
+      },
+      "deliverMan": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "createMan": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "packDetail": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "packageCount": {
+        "type": "integer"
+      }
+    }
+  }
+}

+ 79 - 0
conf/esTemplate/orderImageDispatchItem.json

@@ -0,0 +1,79 @@
+{
+  "orderimagedispatchitem": {
+    "_parent": {
+      "type": "info"
+    },
+    "properties": {
+      "id": {
+        "type": "long"
+      },
+      "idOrder": {
+        "type": "long"
+      },
+      "itemKind": {
+        "type": "long"
+      },
+      "workStatus": {
+        "type": "long"
+      },
+      "pCount": {
+        "type": "integer"
+      },
+      "idUser": {
+        "type": "long"
+      },
+      "userName": {
+        "type": "text",
+        "index": "not_analyzed",
+        "fields": {
+          "raw": {
+            "type":  "keyword"
+          }
+        }
+      },
+      "dispatchTimeLong": {
+        "type": "long"
+      },
+      "dispatchTimeYear": {
+        "type": "long"
+      },
+      "dispatchTimeMonth": {
+        "type": "long"
+      },
+      "dispatchTimeDay": {
+        "type": "long"
+      },
+      "processTimeLong": {
+        "type": "long"
+      },
+      "processTimeYear": {
+        "type": "long"
+      },
+      "processTimeMonth": {
+        "type": "long"
+      },
+      "processTimeDay": {
+        "type": "long"
+      },
+      "processMemo": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "editCountP": {
+        "type": "integer"
+      },
+      "createBy": {
+        "type": "long"
+      },
+      "createTimeLong": {
+        "type": "long"
+      },
+      "updateBy": {
+        "type": "long"
+      },
+      "updateTimeLong": {
+        "type": "long"
+      }
+    }
+  }
+}

+ 118 - 0
conf/esTemplate/orderLifeCycle.json

@@ -0,0 +1,118 @@
+{
+  "orderlifecycle": {
+    "_parent": {
+      "type": "info"
+    },
+    "properties": {
+      "id": {
+        "type": "long"
+      },
+      "idOrder": {
+        "type": "long"
+      },
+      "idOrderPart": {
+        "type": "long"
+      },
+      "lifeNodeId": {
+        "type": "long"
+      },
+      "lifeNodeName": {
+        "type": "text",
+        "index": "not_analyzed",
+        "fields": {
+          "raw": {
+            "type":  "keyword"
+          }
+        }
+      },
+      "lifeNodeState": {
+        "type": "integer"
+      },
+      "orderYear": {
+        "type": "integer"
+      },
+      "referenceMasterId": {
+        "type": "long"
+      },
+      "referenceMasterCode": {
+        "type": "text",
+        "index": "analyzed",
+        "analyzer": "codefull_analyzer",
+        "fields": {
+          "raw": {
+            "type":  "keyword"
+          }
+        }
+      },
+      "referenceSlaveId": {
+        "type": "long"
+      },
+      "referenceSlaveCode": {
+        "type": "text",
+        "index": "analyzed",
+        "analyzer": "codefull_analyzer",
+        "fields": {
+          "raw": {
+            "type":  "keyword"
+          }
+        }
+      },
+      "referenceMasterContent": {
+        "type": "text",
+        "analyzer": "index_ansj",
+        "search_analyzer": "query_ansj",
+        "fields": {
+          "number": {
+            "type": "text",
+            "index": "analyzed",
+            "analyzer": "number_analyzer"
+          },
+          "letter": {
+            "type": "text",
+            "index": "analyzed",
+            "analyzer": "letter_analyzer"
+          },
+          "raw": {
+            "type": "keyword"
+          }
+        }
+      },
+      "createManName": {
+        "type": "text",
+        "index": "not_analyzed",
+        "fields": {
+          "raw": {
+            "type": "keyword"
+          }
+        }
+      },
+      "updateManName": {
+        "type": "text",
+        "index": "not_analyzed",
+        "fields": {
+          "raw": {
+            "type": "keyword"
+          }
+        }
+      },
+      "voidMasterFlag": {
+        "type": "integer"
+      },
+      "voidSlaveFlag": {
+        "type": "integer"
+      },
+      "createBy": {
+        "type": "long"
+      },
+      "createTimeLong": {
+        "type": "long"
+      },
+      "updateBy": {
+        "type": "long"
+      },
+      "updateTimeLong": {
+        "type": "long"
+      }
+    }
+  }
+}

+ 81 - 0
conf/esTemplate/orderLifeCycleCount.json

@@ -0,0 +1,81 @@
+{
+  "orderlifecyclecount": {
+    "_parent": {
+      "type": "info"
+    },
+    "properties": {
+      "id": {
+        "type": "long"
+      },
+      "idOrder": {
+        "type": "long"
+      },
+      "idOrderPart": {
+        "type": "long"
+      },
+      "a0Count": {
+        "type": "long"
+      },
+      "a1Count": {
+        "type": "long"
+      },
+      "a2Count": {
+        "type": "long"
+      },
+      "a3Count": {
+        "type": "long"
+      },
+      "a4Count": {
+        "type": "long"
+      },
+      "a5Count": {
+        "type": "long"
+      },
+      "a6Count": {
+        "type": "long"
+      },
+      "a7Count": {
+        "type": "long"
+      },
+      "a8Count": {
+        "type": "long"
+      },
+      "a9Count": {
+        "type": "long"
+      },
+      "a10Count": {
+        "type": "long"
+      },
+      "a11Count": {
+        "type": "long"
+      },
+      "a12Count": {
+        "type": "long"
+      },
+      "a13Count": {
+        "type": "long"
+      },
+      "a14Count": {
+        "type": "long"
+      },
+      "a15Count": {
+        "type": "long"
+      },
+      "a16Count": {
+        "type": "long"
+      },
+      "a17Count": {
+        "type": "long"
+      },
+      "a18Count": {
+        "type": "long"
+      },
+      "a19Count": {
+        "type": "long"
+      },
+      "a20Count": {
+        "type": "long"
+      }
+    }
+  }
+}

+ 137 - 0
conf/esTemplate/orderMaterialItem.json

@@ -0,0 +1,137 @@
+{
+  "ordermaterial": {
+    "_parent": {
+      "type": "info"
+    },
+    "properties": {
+      "id": {
+        "type": "long"
+      },
+      "idOrder": {
+        "type": "long"
+      },
+      "idMaterial": {
+        "type": "long"
+      },
+      "mtName": {
+        "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"
+          }
+        }
+      },
+      "idActualMaterial": {
+        "type": "long"
+      },
+      "actualMtName": {
+        "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"
+          }
+        }
+      },
+      "materialQty": {
+        "type": "double"
+      },
+      "actualMaterialQty": {
+        "type": "double"
+      },
+      "processedQty": {
+        "type": "double"
+      },
+      "materialMemo": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "materialState": {
+        "type": "integer"
+      },
+      "orderYear": {
+        "type": "integer"
+      },
+      "materialFlag": {
+        "type": "integer"
+      },
+      "idStockRoom": {
+        "type": "long"
+      },
+      "stockRoomName": {
+        "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"
+          }
+        }
+      },
+      "preOutMan": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "idCompany": {
+        "type": "long"
+      },
+      "orderPreRequestFlag": {
+        "type": "integer"
+      },
+      "orderStockInFlag": {
+        "type": "integer"
+      },
+      "orderPickingFlag": {
+        "type": "integer"
+      },
+      "orderStockOutFlag": {
+        "type": "integer"
+      },
+      "createBy": {
+        "type": "long"
+      },
+      "createTimeLong": {
+        "type": "long"
+      },
+      "updateBy": {
+        "type": "long"
+      },
+      "updateTimeLong": {
+        "type": "long"
+      }
+    }
+  }
+}

+ 285 - 0
conf/esTemplate/orderPart.json

@@ -0,0 +1,285 @@
+{
+  "orderpart": {
+    "_parent": {
+      "type": "info"
+    },
+    "properties": {
+      "id": {
+        "type": "long"
+      },
+      "idOrder": {
+        "type": "long"
+      },
+      "idPart": {
+        "type": "long"
+      },
+      "partName": {
+        "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"
+          }
+        }
+      },
+      "partSize": {
+        "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"
+          }
+        }
+      },
+      "partSizeDesc": {
+        "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"
+          }
+        }
+      },
+      "partSizeWidth": {
+        "type": "double"
+      },
+      "partSizeHeight": {
+        "type": "double"
+      },
+      "partSizeLength": {
+        "type": "double"
+      },
+      "bloodValue": {
+        "type": "double"
+      },
+      "idPaperType": {
+        "type": "long"
+      },
+      "paperTypeName": {
+        "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"
+          }
+        }
+      },
+      "idPaperQuoteInfo": {
+        "type": "long"
+      },
+      "quotePaperName": {
+        "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"
+          }
+        }
+      },
+      "faceCount": {
+        "type": "integer"
+      },
+      "pageQty": {
+        "type": "integer"
+      },
+      "partQty": {
+        "type": "double"
+      },
+      "paperSuttle": {
+        "type": "integer"
+      },
+      "originFile": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "finalFile": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "pDFFileObverse": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "pDFFileObversePageIndex": {
+        "type": "integer"
+      },
+      "pDFFileReverse": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "pDFFileReversePageIndex": {
+        "type": "integer"
+      },
+      "thumbFileObverse": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "thumbFileReverse": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "previewFileObverse": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "previewFileReverse": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "partIndex": {
+        "type": "integer"
+      },
+      "orderYear": {
+        "type": "integer"
+      },
+      "partColorObverse": {
+        "type": "long"
+      },
+      "partColorReverse": {
+        "type": "long"
+      },
+      "fileType": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "productPartName": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "orderCode": {
+        "type": "text",
+        "index": "analyzed",
+        "analyzer": "codefull_analyzer",
+        "fields": {
+          "raw": {
+            "type": "keyword"
+          }
+        }
+      },
+      "allProcessStr": {
+        "type": "text",
+        "index": "not_analyzed",
+        "fields": {
+          "raw": {
+            "type": "keyword"
+          }
+        }
+      },
+      "fuMoFlag": {
+        "type": "integer"
+      },
+      "moQieFlag": {
+        "type": "integer"
+      },
+      "moduleCount": {
+        "type": "integer"
+      },
+      "partSaleQty": {
+        "type": "double"
+      },
+      "specialPaperFlag": {
+        "type": "integer"
+      },
+      "qtyEnoughFlag": {
+        "type": "integer"
+      },
+      "partDesc": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "mainFlag": {
+        "type": "integer"
+      },
+      "partColour": {
+        "type": "text",
+        "index": "not_analyzed",
+        "fields": {
+          "raw": {
+            "type": "keyword"
+          }
+        }
+      },
+      "holdSize": {
+        "type": "integer"
+      },
+      "bookStyle": {
+        "type": "integer"
+      },
+      "cupSize": {
+        "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"
+          }
+        }
+      }
+    }
+  }
+}

+ 33 - 0
conf/esTemplate/orderPartParamValue.json

@@ -0,0 +1,33 @@
+{
+  "orderpartparamvalue": {
+    "_parent": {
+      "type": "orderpart"
+    },
+    "properties": {
+      "id": {
+        "type": "long"
+      },
+      "idOrder": {
+        "type": "long"
+      },
+      "idOrderPart": {
+        "type": "long"
+      },
+      "idParameter": {
+        "type": "long"
+      },
+      "paramValue": {
+        "type": "text"
+      },
+      "fieldType": {
+        "type": "long"
+      },
+      "paramDisplay": {
+        "type": "text"
+      },
+      "orderYear": {
+        "type": "integer"
+      }
+    }
+  }
+}

+ 173 - 0
conf/esTemplate/orderPartProcess.json

@@ -0,0 +1,173 @@
+{
+  "orderpartprocess": {
+    "_parent": {
+      "type": "orderpart"
+    },
+    "properties": {
+      "id": {
+        "type": "long"
+      },
+      "idOrder": {
+        "type": "long"
+      },
+      "idOrderPart": {
+        "type": "long"
+      },
+      "idProcess": {
+        "type": "long"
+      },
+      "processMemo": {
+        "type": "text"
+      },
+      "orderIndex": {
+        "type": "long"
+      },
+      "pDFFileName": {
+        "type": "text"
+      },
+      "pDFFilePageIndex": {
+        "type": "long"
+      },
+      "processPrice": {
+        "type": "double"
+      },
+      "processQty": {
+        "type": "double"
+      },
+      "processMoney": {
+        "type": "double"
+      },
+      "processRule": {
+        "type": "text",
+        "fields": {
+          "raw": {
+            "type": "keyword"
+          }
+        }
+      },
+      "idMaterial": {
+        "type": "long"
+      },
+      "orderYear": {
+        "type": "integer"
+      },
+      "processName": {
+        "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"
+          }
+        }
+      },
+      "obvRevId": {
+        "type": "long"
+      },
+      "isOutAssisted": {
+        "type": "integer"
+      },
+      "idOutAssistBill": {
+        "type": "long"
+      },
+      "outAssistBillCode": {
+        "type": "text",
+        "index": "analyzed",
+        "analyzer": "codefull_analyzer",
+        "fields": {
+          "raw": {
+            "type": "keyword"
+          }
+        }
+      },
+      "materialQty": {
+        "type": "double"
+      },
+      "materialPreOutFlag": {
+        "type": "integer"
+      },
+      "idActualMaterialInfo": {
+        "type": "long"
+      },
+      "actualMaterialInfoName": {
+        "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"
+          }
+        }
+      },
+      "preOutStockLockIdRoom": {
+        "type": "long"
+      },
+      "preOutStockLockQty": {
+        "type": "integer"
+      },
+      "preOutLockState": {
+        "type": "integer"
+      },
+      "preOutLockManId": {
+        "type": "long"
+      },
+      "preOutLockManName": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "preOutStockUnlocked": {
+        "type": "integer"
+      },
+      "materialPreRequestFlag": {
+        "type": "integer"
+      },
+      "materialStockInFlag": {
+        "type": "integer"
+      },
+      "materialPickingFlag": {
+        "type": "integer"
+      },
+      "materialStockOutFlag": {
+        "type": "integer"
+      },
+      "createBy": {
+        "type": "long"
+      },
+      "createTime": {
+        "type": "long"
+      },
+      "createTimeLong": {
+        "type": "long"
+      },
+      "updateBy": {
+        "type": "long"
+      },
+      "updateTime": {
+        "type": "long"
+      },
+      "updateTimeLong": {
+        "type": "long"
+      }
+    }
+  }
+}

+ 140 - 0
conf/esTemplate/orderPrePay.json

@@ -0,0 +1,140 @@
+{
+  "orderprepay": {
+    "_parent": {
+      "type": "info"
+    },
+
+    "properties": {
+      "id": {
+        "type": "long"
+      },
+      "idOrder": {
+        "type": "long"
+      },
+      "prePayMoney": {
+        "type": "double"
+      },
+      "billState": {
+        "type": "integer"
+      },
+      "createMan": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "idAccount": {
+        "type": "long"
+      },
+      "accountName": {
+        "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"
+          }
+        }
+      },
+      "actMoney": {
+        "type": "double"
+      },
+      "prePayMemo": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "auditDateLong": {
+        "type": "long"
+      },
+      "auditMan": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "idAuditMan": {
+        "type": "long"
+      },
+      "chargeDateCode": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "orderYear": {
+        "type": "integer"
+      },
+      "orderCode": {
+        "type": "text",
+        "index": "analyzed",
+        "analyzer": "codefull_analyzer",
+        "fields": {
+          "raw": {
+            "type":  "keyword"
+          }
+        }
+      },
+      "orderName": {
+        "type": "text",
+        "analyzer": "index_ansj",
+        "search_analyzer": "query_ansj",
+        "fields": {
+          "raw": {
+            "type": "keyword"
+          }
+        }
+      },
+      "orderPrintDesc": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "orderQty": {
+        "type": "double"
+      },
+      "orderMoneyTotal": {
+        "type": "double"
+      },
+      "clientName": {
+        "type": "text",
+        "analyzer": "index_ansj",
+        "search_analyzer": "query_ansj",
+        "fields": {
+          "raw": {
+            "type": "keyword"
+          }
+        }
+      },
+
+      "clientCode": {
+        "type": "text",
+        "index": "analyzed",
+        "analyzer": "codefull_analyzer",
+        "fields": {
+          "raw": {
+            "type":  "keyword"
+          }
+        }
+      },
+
+      "orderCreateTimeLong": {
+        "type": "long"
+      },
+      "createBy": {
+        "type": "long"
+      },
+      "createTimeLong": {
+        "type": "long"
+      },
+      "updateBy": {
+        "type": "long"
+      },
+      "updateTimeLong": {
+        "type": "long"
+      }
+    }
+  }
+}

+ 196 - 0
conf/esTemplate/orderReceivable.json

@@ -0,0 +1,196 @@
+{
+  "orderreceivable": {
+    "_parent": {
+      "type": "info"
+    },
+    "properties": {
+      "id": {
+        "type": "long"
+      },
+      "idOrder": {
+        "type": "long"
+      },
+      "idClient": {
+        "type": "long"
+      },
+      "clientName": {
+        "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"
+          }
+        }
+      },
+      "billMoney": {
+        "type": "double"
+      },
+      "chargeMoney": {
+        "type": "double"
+      },
+      "payMoney": {
+        "type": "double"
+      },
+      "createMan": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "dataKind": {
+        "type": "integer"
+      },
+      "chargeState": {
+        "type": "integer"
+      },
+      "chargeTimeLong": {
+        "type": "long"
+      },
+      "chargeMan": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "financeCode": {
+        "type": "text",
+        "index": "analyzed",
+        "analyzer": "codefull_analyzer",
+        "fields": {
+          "raw": {
+            "type": "keyword"
+          }
+        }
+      },
+      "orderYear": {
+        "type": "integer"
+      },
+      "printBillCode": {
+        "type": "text",
+        "index": "analyzed",
+        "analyzer": "codefull_analyzer",
+        "fields": {
+          "raw": {
+            "type": "keyword"
+          }
+        }
+      },
+      "orderCreateMan": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "orderCreateTimeLong": {
+        "type": "long"
+      },
+      "orderCode": {
+        "type": "text",
+        "index": "analyzed",
+        "analyzer": "codefull_analyzer",
+        "fields": {
+          "raw": {
+            "type": "keyword"
+          }
+        }
+      },
+      "maYunCode": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "orderName": {
+        "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"
+          }
+        }
+      },
+      "stateMemo": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "orderMoney": {
+        "type": "double"
+      },
+      "orderMoneyPrePay": {
+        "type": "double"
+      },
+      "orderQty": {
+        "type": "double"
+      },
+      "orderMessage": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "billMemo": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "orderStateSend": {
+        "type": "integer"
+      },
+      "orderPayKind": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "createBy": {
+        "type": "long"
+      },
+      "createTimeLong": {
+        "type": "long"
+      },
+      "updateBy": {
+        "type": "long"
+      },
+      "updateTimeLong": {
+        "type": "long"
+      },
+      "idPaymentGroup": {
+        "type": "long"
+      },
+      "onlinePayState": {
+        "type": "long"
+      },
+      "receivableMemo": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "idMemoMan": {
+        "type": "long"
+      },
+      "memoMan": {
+        "type": "text",
+        "index": "not_analyzed",
+        "fields": {
+          "raw": {
+            "type": "keyword"
+          }
+        }
+      },
+      "memoDate": {
+        "type": "long"
+      },
+      "memoDateLong": {
+        "type": "long"
+      }
+    }
+  }
+}

+ 101 - 0
conf/esTemplate/orderSendAddress.json

@@ -0,0 +1,101 @@
+{
+  "ordersendaddress": {
+    "_parent": {
+      "type": "info"
+    },
+    "properties": {
+      "id": {
+        "type": "long"
+      },
+      "idOrder": {
+        "type": "long"
+      },
+      "linkMan": {
+        "type": "text",
+        "index": "not_analyzed",
+        "fields": {
+          "raw": {
+            "type": "keyword"
+          }
+        }
+      },
+      "linkPhone": {
+        "type": "text",
+        "index": "analyzed",
+        "analyzer": "codefull_analyzer",
+        "fields": {
+          "raw": {
+            "type": "keyword"
+          }
+        }
+      },
+      "sendProvince": {
+        "type": "keyword",
+        "index": "not_analyzed"
+      },
+      "sendCity": {
+        "type": "keyword",
+        "index": "not_analyzed"
+      },
+      "sendDistrict": {
+        "type": "keyword",
+        "index": "not_analyzed"
+      },
+      "sendAddress": {
+        "type": "text",
+        "analyzer": "index_ansj",
+        "search_analyzer": "query_ansj",
+        "fields": {
+          "raw": {
+            "type": "keyword"
+          }
+        }
+      },
+      "addressQty": {
+        "type": "double"
+      },
+      "sendQty": {
+        "type": "double"
+      },
+      "sendKind": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "idLogistics": {
+        "type": "long"
+      },
+      "logisticsName": {
+        "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"
+          }
+        }
+      },
+      "longitude": {
+        "type": "double"
+      },
+      "latitude": {
+        "type": "double"
+      },
+      "orderYear": {
+        "type": "integer"
+      },
+      "sendRegion": {
+        "type": "text"
+      }
+    }
+  }
+}

+ 30 - 0
conf/esTemplate/orderStep.json

@@ -0,0 +1,30 @@
+{
+  "info": {
+    "properties": {
+      "id": {
+        "type": "long"
+      },
+      "idOrder": {
+        "type": "long"
+      },
+      "idWorkMan": {
+        "type": "long"
+      },
+      "workTime": {
+        "type": "long"
+      },
+      "workTimeLong": {
+        "type": "long"
+      },
+      "workMemo": {
+        "type": "text"
+      },
+      "workExplain": {
+        "type": "text"
+      },
+      "orderYear": {
+        "type": "integer"
+      }
+    }
+  }
+}

+ 219 - 0
conf/esTemplate/orderStockItem.json

@@ -0,0 +1,219 @@
+{
+  "orderstockitem": {
+    "_parent": {
+      "type": "info"
+    },
+    "properties": {
+      "id": {
+        "type": "long"
+      },
+      "idOrder": {
+        "type": "long"
+      },
+      "orderCode": {
+        "type": "text",
+        "analyzer": "codefull_analyzer",
+        "fields": {
+          "raw": {
+            "type": "keyword"
+          }
+        }
+      },
+      "idClient": {
+        "type": "long"
+      },
+      "productTypeName": {
+        "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"
+          }
+        }
+      },
+      "orderName": {
+        "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"
+          }
+        }
+      },
+      "clientName": {
+        "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"
+          }
+        }
+      },
+      "orderQty": {
+        "type": "double"
+      },
+      "totalBoxCount": {
+        "type": "long"
+      },
+      "stockCount": {
+        "type": "long"
+      },
+      "boxCount": {
+        "type": "long"
+      },
+      "boxDesc": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "itemPrint": {
+        "type": "double"
+      },
+      "idPrintBoxMan": {
+        "type": "long"
+      },
+      "printBoxMan": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "idInStockMan": {
+        "type": "long"
+      },
+      "inStockMan": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "inStockCode": {
+        "type": "text",
+        "analyzer": "codefull_analyzer",
+        "fields": {
+          "raw": {
+            "type": "keyword"
+          }
+        }
+      },
+      "idCheckMan": {
+        "type": "long"
+      },
+      "checkMan": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "idStockPlace": {
+        "type": "long"
+      },
+      "stockPlace": {
+        "type": "text",
+        "index": "not_analyzed",
+        "fields": {
+          "raw": {
+            "type": "keyword"
+          }
+        }
+      },
+      "verifyProduct": {
+        "type": "integer"
+      },
+      "idVerifyMan": {
+        "type": "long"
+      },
+      "verifyMan": {
+        "type": "text",
+        "index": "not_analyzed",
+        "fields": {
+          "raw": {
+            "type": "keyword"
+          }
+        }
+      },
+      "verifyDateLong": {
+        "type": "long"
+      },
+      "idBoxedMan": {
+        "type": "long"
+      },
+      "boxedMan": {
+        "type": "text",
+        "index": "not_analyzed",
+        "fields": {
+          "raw": {
+            "type": "keyword"
+          }
+        }
+      },
+      "stockMemo": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "transLockFlag": {
+        "type": "integer"
+      },
+      "idTransLockMan": {
+        "type": "long"
+      },
+      "transLockMan": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "itemState": {
+        "type": "long"
+      },
+      "startNum": {
+        "type": "long"
+      },
+      "voidFlag": {
+        "type": "integer"
+      },
+      "inputKind": {
+        "type": "integer"
+      },
+      "orderYear": {
+        "type": "integer"
+      },
+      "createBy": {
+        "type": "long"
+      },
+      "createTimeLong": {
+        "type": "long"
+      },
+      "updateBy": {
+        "type": "long"
+      },
+      "updateTimeLong": {
+        "type": "long"
+      }
+    }
+  }
+}

+ 114 - 0
conf/esTemplate/orderStockLabel.json

@@ -0,0 +1,114 @@
+{
+  "orderstocklabel": {
+    "_parent": {
+      "type": "orderstockitem"
+    },
+    "properties": {
+      "id": {
+        "type": "long"
+      },
+      "idOrderStockItem": {
+        "type": "long"
+      },
+      "idOrder": {
+        "type": "long"
+      },
+      "labelState": {
+        "type": "integer"
+      },
+      "labelQty": {
+        "type": "double"
+      },
+      "labelCount": {
+        "type": "integer"
+      },
+      "labelNum": {
+        "type": "integer"
+      },
+      "orderYear": {
+        "type": "integer"
+      },
+      "idStockPlace": {
+        "type": "long"
+      },
+      "stockPlace": {
+        "type": "text",
+        "index": "not_analyzed",
+        "fields": {
+          "raw": {
+            "type": "keyword"
+          }
+        }
+      },
+      "createBy": {
+        "type": "long"
+      },
+      "createTimeLong": {
+        "type": "long"
+      },
+      "updateBy": {
+        "type": "long"
+      },
+      "updateTimeLong": {
+        "type": "long"
+      },
+      "idOrderCreate": {
+        "type": "long"
+      },
+      "orderCreateMan": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "orderCode": {
+        "type": "text",
+        "index": "analyzed",
+        "analyzer": "codefull_analyzer",
+        "fields": {
+          "raw": {
+            "type": "keyword"
+          }
+        }
+      },
+      "orderName": {
+        "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"
+          }
+        }
+      },
+      "clintName": {
+        "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"
+          }
+        }
+      }
+    }
+  }
+}

+ 126 - 0
conf/esTemplate/outassistinfo.json

@@ -0,0 +1,126 @@
+{
+  "info": {
+    "properties": {
+      "id": {
+        "type": "long"
+      },
+      "assistType": {
+        "type": "long"
+      },
+      "workType": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "workQuality": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "settleType": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "outAssistName": {
+        "type": "text",
+        "index": "not_analyzed",
+        "fields": {
+          "raw": {
+            "type": "keyword"
+          }
+        }
+      },
+      "contactMan": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "contactPhone": {
+        "type": "text",
+        "index": "analyzed",
+        "analyzer": "codefull_analyzer",
+        "fields": {
+          "raw": {
+            "type": "keyword"
+          }
+        }
+      },
+      "outAssistCode": {
+        "type": "text",
+        "index": "analyzed",
+        "analyzer": "codefull_analyzer",
+        "fields": {
+          "raw": {
+            "type": "keyword"
+          }
+        }
+      },
+      "province": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "city": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "area": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "address": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "remark": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "factorySyncKey": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "contractUrl": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "dataBaseAlias": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "shardingKey": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "enable": {
+        "type": "long"
+      },
+      "submitOnAllocation": {
+        "type": "integer"
+      },
+      "sortIndex": {
+        "type": "integer"
+      },
+      "capacity": {
+        "type": "long"
+      },
+      "needPackMaterial": {
+        "type": "integer"
+      },
+      "createBy": {
+        "type": "long"
+      },
+      "createTime": {
+        "type": "long"
+      },
+      "createTimeLong": {
+        "type": "long"
+      },
+      "updateBy": {
+        "type": "long"
+      },
+      "updateTime": {
+        "type": "long"
+      },
+      "updateTimeLong": {
+        "type": "long"
+      }
+    }
+  }
+}

+ 63 - 0
conf/esTemplate/paperbaseinfo.json

@@ -0,0 +1,63 @@
+{
+  "info": {
+    "properties": {
+      "id": {
+        "type": "long"
+      },
+      "idPaperType": {
+        "type": "long"
+      },
+      "paperName": {
+        "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"
+          }
+        }
+      },
+      "mtSuttle": {
+        "type": "double"
+      },
+      "paperInfoCode": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "priceType": {
+        "type": "integer"
+      },
+      "paperPrice": {
+        "type": "double"
+      },
+      "createBy": {
+        "type": "long"
+      },
+      "createTimeLong": {
+        "type": "long"
+      },
+      "updateBy": {
+        "type": "long"
+      },
+      "updateTimeLong": {
+        "type": "long"
+      },
+      "voidFlag": {
+        "type": "long"
+      },
+      "sortNum": {
+        "type": "integer"
+      }
+    }
+  }
+}

+ 74 - 0
conf/esTemplate/paperinfo.json

@@ -0,0 +1,74 @@
+{
+  "info": {
+    "properties": {
+      "id": {
+        "type": "long"
+      },
+      "idPaperType": {
+        "type": "long"
+      },
+      "paperName": {
+        "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"
+          }
+        }
+      },
+      "paperCode": {
+        "type": "keyword",
+        "index": "not_analyzed"
+      },
+      "mtModel": {
+        "type": "text",
+        "index": "not_analyzed",
+        "fields": {
+          "raw": {
+            "type":  "keyword"
+          }
+        }
+      },
+      "mtRule": {
+        "type": "keyword",
+        "index": "not_analyzed",
+        "fields": {
+          "number": {
+            "type": "text",
+            "index": "analyzed",
+            "analyzer": "number_analyzer"
+          }
+        }
+      },
+      "mtSuttle": {
+        "type": "double",
+        "index": "not_analyzed"
+      },
+      "barCode": {
+        "type": "keyword",
+        "index": "not_analyzed"
+      },
+      "remark": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "voidFlag": {
+        "type": "long"
+      },
+      "priceType": {
+        "type": "long"
+      }
+    }
+  }
+}

+ 64 - 0
conf/esTemplate/paperquoteinfo.json

@@ -0,0 +1,64 @@
+{
+  "info": {
+    "properties": {
+      "id": {
+        "type": "long"
+      },
+      "idPaperBaseInfo": {
+        "type": "long"
+      },
+      "paperBaseName": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "idPaperBrand": {
+        "type": "long"
+      },
+      "paperBrandName": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "paperQuoteName": {
+        "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"
+          }
+        }
+      },
+      "priceType": {
+        "type": "integer"
+      },
+      "paperPrice": {
+        "type": "double"
+      },
+      "voidFlag": {
+        "type": "integer"
+      },
+      "createBy": {
+        "type": "long"
+      },
+      "createTimeLong": {
+        "type": "long"
+      },
+      "updateBy": {
+        "type": "long"
+      },
+      "updateTimeLong": {
+        "type": "long"
+      }
+    }
+  }
+}

+ 22 - 0
conf/esTemplate/papertype.json

@@ -0,0 +1,22 @@
+{
+  "info": {
+    "properties": {
+      "id": {
+        "type": "long"
+      },
+      "paperTypeName": {
+        "type": "text",
+        "analyzer": "index_ansj",
+        "search_analyzer": "query_ansj",
+        "fields": {
+          "raw": {
+            "type":  "keyword"
+          }
+        }
+      },
+      "voidFlag": {
+        "type": "long"
+      }
+    }
+  }
+}

+ 182 - 0
conf/esTemplate/printBill.json

@@ -0,0 +1,182 @@
+{
+  "info": {
+    "properties": {
+      "id": {
+        "type": "long"
+      },
+      "billYear": {
+        "type": "integer"
+      },
+      "billCode": {
+        "type": "text",
+        "index": "analyzed",
+        "analyzer": "codefull_analyzer",
+        "fields": {
+          "raw": {
+            "type": "keyword"
+          }
+        }
+      },
+      "productName": {
+        "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"
+          }
+        }
+      },
+      "billName": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "clientName": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "processText": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "outSourceProcessText": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "deliveryDate": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "deliveryDateLong": {
+        "type": "long"
+      },
+      "printTime": {
+        "type": "long"
+      },
+      "voidFlag": {
+        "type": "integer"
+      },
+      "billNote": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "billState": {
+        "type": "integer"
+      },
+      "billType": {
+        "type": "integer"
+      },
+      "billMoneyPlate": {
+        "type": "double"
+      },
+      "billMoneyPaper": {
+        "type": "double"
+      },
+      "billMoneyPrint": {
+        "type": "double"
+      },
+      "billMoneyProcess": {
+        "type": "double"
+      },
+      "billMoneyTotal": {
+        "type": "double"
+      },
+      "billMoneyAdjust": {
+        "type": "double"
+      },
+      "orderMoneyTotal": {
+        "type": "double"
+      },
+      "containsOrderIds": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "containsOrderCodes": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "breedFileUrl": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "currentVersion": {
+        "type": "long"
+      },
+      "autoPDFFlag": {
+        "type": "integer"
+      },
+      "idProduct": {
+        "type": "long"
+      },
+      "createBy": {
+        "type": "long"
+      },
+      "createManName": {
+        "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"
+          }
+        }
+      },
+      "orderPrintRequire": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "orderSendKind": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "assembleBreedRequire": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "idCompany": {
+        "type": "long"
+      },
+      "importantBill": {
+        "type": "integer"
+      },
+      "idClientLevel": {
+        "type": "long"
+      },
+      "createTime": {
+        "type": "long"
+      },
+      "createTimeLong": {
+        "type": "long"
+      },
+      "updateBy": {
+        "type": "long"
+      },
+      "updateTime": {
+        "type": "long"
+      },
+      "updateTimeLong": {
+        "type": "long"
+      }
+    }
+  }
+}

+ 276 - 0
conf/esTemplate/printBillBreed.json

@@ -0,0 +1,276 @@
+{
+  "breed": {
+    "_parent": {
+      "type": "info"
+    },
+    "properties": {
+      "id": {
+        "type": "long"
+      },
+      "billYear": {
+        "type": "integer"
+      },
+      "idCompany": {
+        "type": "long"
+      },
+      "idPrintBill": {
+        "type": "long"
+      },
+      "breedName": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "breedTypeName": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "selfProvidedPaper": {
+        "type": "long"
+      },
+      "wholePaperSize": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "paperBand": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "idPaperBaseInfo": {
+        "type": "long"
+      },
+      "paperName": {
+        "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"
+          }
+        }
+      },
+      "idPaperCutInfo": {
+        "type": "long"
+      },
+      "cutName": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "cutCount": {
+        "type": "long"
+      },
+      "cutSize": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "partCount": {
+        "type": "long"
+      },
+      "partPrintTotalQty": {
+        "type": "long"
+      },
+      "breedNo": {
+        "type": "long"
+      },
+      "breedSets": {
+        "type": "long"
+      },
+      "printCount": {
+        "type": "long"
+      },
+      "printFlowCount": {
+        "type": "long"
+      },
+      "craftFlowCount": {
+        "type": "long"
+      },
+      "wholePaperCount": {
+        "type": "long"
+      },
+      "originWholePaperCount": {
+        "type": "long"
+      },
+      "paperPrice": {
+        "type": "double"
+      },
+      "breedPaperPrice": {
+        "type": "double"
+      },
+      "idActualPaperInfo": {
+        "type": "long"
+      },
+      "actualPaperName": {
+        "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"
+          }
+        }
+      },
+      "idMachineType": {
+        "type": "long"
+      },
+      "idMachine": {
+        "type": "long"
+      },
+      "machineTypeName": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "machineName": {
+        "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"
+          }
+        }
+      },
+      "colorCount": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "specialColor": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "breedFlipType": {
+        "type": "long"
+      },
+      "breedSize": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "psSize": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "psGroupCount": {
+        "type": "long"
+      },
+      "psCount": {
+        "type": "long"
+      },
+      "completeCount": {
+        "type": "long"
+      },
+      "printCount1000": {
+        "type": "double"
+      },
+      "printCosts": {
+        "type": "double"
+      },
+      "breedProcess": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "breedStatus": {
+        "type": "integer"
+      },
+      "printRequire": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "preOutStockState": {
+        "type": "integer"
+      },
+      "preOutStockLockIdRoom": {
+        "type": "long"
+      },
+      "preOutStockLockQty": {
+        "type": "integer"
+      },
+      "preOutLockState": {
+        "type": "integer"
+      },
+      "preOutLockManId": {
+        "type": "long"
+      },
+      "preOutLockManName": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "idPlateSizeTemplate": {
+        "type": "long"
+      },
+      "voidFlag": {
+        "type": "integer"
+      },
+      "containsOrderIds": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "preOutStockUnlocked": {
+        "type": "integer"
+      },
+      "pickPaperCount": {
+        "type": "long"
+      },
+      "paperRequireFlag": {
+        "type": "integer"
+      },
+      "paperPreRequestFlag": {
+        "type": "integer"
+      },
+      "paperStockInFlag": {
+        "type": "integer"
+      },
+      "paperPickingFlag": {
+        "type": "integer"
+      },
+      "paperStockOutFlag": {
+        "type": "integer"
+      },
+      "createBy": {
+        "type": "long"
+      },
+      "createTime": {
+        "type": "long"
+      },
+      "createTimeLong": {
+        "type": "long"
+      },
+      "updateBy": {
+        "type": "long"
+      },
+      "updateTime": {
+        "type": "long"
+      },
+      "updateTimeLong": {
+        "type": "long"
+      }
+    }
+  }
+}

+ 70 - 0
conf/esTemplate/printBillLifeCycle.json

@@ -0,0 +1,70 @@
+{
+  "printbilllifecycle": {
+    "_parent": {
+      "type": "breed"
+    },
+    "properties": {
+      "idPrintBill": {
+        "type": "long"
+      },
+      "idBreed": {
+        "type": "long"
+      },
+      "lifeNodeId": {
+        "type": "long"
+      },
+      "lifeNodeName": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "lifeNodeState": {
+        "type": "integer"
+      },
+      "billYear": {
+        "type": "integer"
+      },
+      "referenceMasterId": {
+        "type": "long"
+      },
+      "referenceSlaveId": {
+        "type": "long"
+      },
+      "createManName": {
+        "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"
+          }
+        }
+      },
+      "updateManName": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "createBy": {
+        "type": "long"
+      },
+      "createTimeLong": {
+        "type": "long"
+      },
+      "updateBy": {
+        "type": "long"
+      },
+      "updateTimeLong": {
+        "type": "long"
+      }
+    }
+  }
+}

+ 36 - 0
conf/esTemplate/printBillStep.json

@@ -0,0 +1,36 @@
+{
+  "info": {
+    "properties": {
+      "id": {
+        "type": "long"
+      },
+      "billYear": {
+        "type": "integer"
+      },
+      "idPrintBill": {
+        "type": "long"
+      },
+      "idWorkMan": {
+        "type": "long"
+      },
+      "workMan": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "workTime": {
+        "type": "long"
+      },
+      "workTimeLong": {
+        "type": "long"
+      },
+      "workMemo": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "workExplain": {
+        "type": "text",
+        "index": "not_analyzed"
+      }
+    }
+  }
+}

+ 126 - 0
conf/esTemplate/printBreedPart.json

@@ -0,0 +1,126 @@
+{
+  "printbreedpart": {
+    "_parent": {
+      "type": "breed"
+    },
+    "properties": {
+      "id": {
+        "type": "long"
+      },
+      "billYear": {
+        "type": "integer"
+      },
+      "idProduct": {
+        "type": "long"
+      },
+      "idPartInfo": {
+        "type": "long"
+      },
+      "idPrintBill": {
+        "type": "long"
+      },
+      "idPrintBreed": {
+        "type": "long"
+      },
+      "idOrder": {
+        "type": "long"
+      },
+      "idOrderPart": {
+        "type": "long"
+      },
+      "idWorkPart": {
+        "type": "long"
+      },
+      "partHeight": {
+        "type": "double"
+      },
+      "partWidth": {
+        "type": "double"
+      },
+      "locationX": {
+        "type": "double"
+      },
+      "locationY": {
+        "type": "double"
+      },
+      "rotationAngle": {
+        "type": "long"
+      },
+      "productName": {
+        "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"
+          }
+        }
+      },
+      "orderName": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "orderNameQuery": {
+        "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"
+          }
+        }
+      },
+      "orderCode": {
+        "type": "text",
+        "index": "analyzed",
+        "analyzer": "codefull_analyzer",
+        "fields": {
+          "raw": {
+            "type": "keyword"
+          }
+        }
+      },
+      "productPartName": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "semiFeedbackStatus": {
+        "type": "integer"
+      },
+      "semiFeedbackContent": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "idSemiFeedbackMan": {
+        "type": "long"
+      },
+      "semiFeedbackTimeLong": {
+        "type": "long"
+      },
+      "cropRect": {
+        "type": "text",
+        "index": "not_analyzed"
+      }
+    }
+  }
+}

+ 377 - 0
conf/esTemplate/printOrder.json

@@ -0,0 +1,377 @@
+{
+  "info": {
+    "properties": {
+      "id": {
+        "type": "long"
+      },
+      "orderYear": {
+        "type": "integer"
+      },
+      "orderCode": {
+        "type": "text",
+        "index": "analyzed",
+        "analyzer": "codefull_analyzer",
+        "fields": {
+          "raw": {
+            "type": "keyword"
+          }
+        }
+      },
+      "orderName": {
+        "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"
+          }
+        }
+      },
+      "idProduct": {
+        "type": "long"
+      },
+      "idClient": {
+        "type": "long"
+      },
+      "clientName": {
+        "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"
+          }
+        }
+      },
+      "clientCode": {
+        "type": "text",
+        "index": "analyzed",
+        "analyzer": "codefull_analyzer",
+        "fields": {
+          "raw": {
+            "type": "keyword"
+          }
+        }
+      },
+      "orderFrom": {
+        "type": "integer"
+      },
+      "platformOrderID": {
+        "type": "text",
+        "index": "analyzed",
+        "analyzer": "codefull_analyzer",
+        "fields": {
+          "raw": {
+            "type": "keyword"
+          }
+        }
+      },
+      "orderState": {
+        "type": "integer"
+      },
+      "stateMemo": {
+        "type": "text",
+        "index": "not_analyzed",
+        "fields": {
+          "raw": {
+            "type": "keyword"
+          }
+        }
+      },
+      "orderMoneyProcess": {
+        "type": "double"
+      },
+      "orderMoneyPrint": {
+        "type": "double"
+      },
+      "orderMoneyTotal": {
+        "type": "double"
+      },
+      "chargeMoney": {
+        "type": "double"
+      },
+      "payMoney": {
+        "type": "double"
+      },
+      "orderMoneySend": {
+        "type": "double"
+      },
+      "orderMoneyPre": {
+        "type": "double"
+      },
+      "kindCount": {
+        "type": "integer"
+      },
+      "orderQty": {
+        "type": "double"
+      },
+      "boxedOrderQty": {
+        "type": "double"
+      },
+      "boxedOrderQtyEx": {
+        "type": "double"
+      },
+      "payKind": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "searchPayKind": {
+        "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"
+          }
+        }
+      },
+      "orderMemo": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "sendMemo": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "deliverDateLong": {
+        "type": "long"
+      },
+      "checkMan": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "checkDateLong": {
+        "type": "long"
+      },
+      "voidFlag": {
+        "type": "integer"
+      },
+      "cutKind": {
+        "type": "integer"
+      },
+      "printRequire": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "prePrintCode": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "photographFlag": {
+        "type": "integer"
+      },
+      "partCount": {
+        "type": "integer"
+      },
+      "businessKind": {
+        "type": "integer"
+      },
+      "maYunCode": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "idSale": {
+        "type": "long"
+      },
+      "saleMan": {
+        "type": "text",
+        "index": "not_analyzed",
+        "fields": {
+          "raw": {
+            "type": "keyword"
+          }
+        }
+      },
+      "idSaleWorkTeam": {
+        "type": "long"
+      },
+      "orderMessage": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "fileDescription": {
+        "type": "text",
+        "index": "not_analyzed",
+        "fields": {
+          "raw": {
+            "type": "keyword"
+          }
+        }
+      },
+      "originFileLink": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "orderStateCharge": {
+        "type": "integer"
+      },
+      "createMan": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "orderRegion": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "productName": {
+        "type": "text",
+        "index": "not_analyzed",
+        "fields": {
+          "raw": {
+            "type": "keyword"
+          }
+        }
+      },
+      "orderType": {
+        "type": "integer"
+      },
+      "versionCode": {
+        "type": "long"
+      },
+      "allProcessStr": {
+        "type": "text",
+        "index": "not_analyzed",
+        "fields": {
+          "raw": {
+            "type": "keyword"
+          }
+        }
+      },
+      "packRequire": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "packKind": {
+        "type": "integer"
+      },
+      "boxRequire": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "pageQty": {
+        "type": "integer"
+      },
+      "createBy": {
+        "type": "long"
+      },
+      "createTimeLong": {
+        "type": "long"
+      },
+      "updateBy": {
+        "type": "long"
+      },
+      "updateTimeLong": {
+        "type": "long"
+      },
+      "attachFile": {
+        "type": "text",
+        "index": "not_analyzed",
+        "fields": {
+          "raw": {
+            "type": "keyword"
+          }
+        }
+      },
+      "attachFileLink": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "proofFile": {
+        "type": "text",
+        "index": "not_analyzed",
+        "fields": {
+          "raw": {
+            "type": "keyword"
+          }
+        }
+      },
+      "proofFileLink": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "packageQty": {
+        "type": "double"
+      },
+      "webProofFileLink": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "paperRequireFlag": {
+        "type": "integer"
+      },
+      "idProductType": {
+        "type": "long"
+      },
+      "originOrderId": {
+        "type": "long"
+      },
+      "rePrintIndex": {
+        "type": "long"
+      },
+      "rePrintNeedImageProcess": {
+        "type": "long"
+      },
+      "firstOrderFlag": {
+        "type": "integer"
+      },
+      "usePreStore": {
+        "type": "integer"
+      },
+      "traceFlag": {
+        "type": "integer"
+      },
+      "dutyMan": {
+        "type": "text",
+        "index": "not_analyzed",
+        "fields": {
+          "raw": {
+            "type": "keyword"
+          }
+        }
+      },
+      "idClientLevel": {
+        "type": "long"
+      },
+      "contractTeamId": {
+        "type": "long"
+      },
+      "contractManId": {
+        "type": "long"
+      },
+      "contractMan": {
+        "type": "text",
+        "index": "not_analyzed"
+      }
+    }
+  }
+}

+ 90 - 0
conf/esTemplate/product.json

@@ -0,0 +1,90 @@
+{
+  "info": {
+    "properties": {
+      "id": {
+        "type": "long"
+      },
+      "idType": {
+        "type": "long"
+      },
+      "productName": {
+        "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"
+          }
+        }
+      },
+      "productUnit": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "makeUpType": {
+        "type": "long"
+      },
+      "billPrefix": {
+        "type":  "keyword"
+      },
+      "billCodeTimeKind": {
+        "type": "integer"
+      },
+      "orderPrefix": {
+        "type":  "keyword"
+      },
+      "isSelfHelp": {
+        "type": "long"
+      },
+      "priceFlag": {
+        "type": "long"
+      },
+      "photoFixFlag": {
+        "type": "long"
+      },
+      "voidFlag": {
+        "type": "long"
+      },
+      "saleFlag": {
+        "type": "long"
+      },
+      "idPartner": {
+        "type": "long"
+      },
+      "idProductPriceInfo": {
+        "type": "long"
+      },
+      "compageVisibleFlag": {
+        "type": "long"
+      },
+      "minDeliveryDay": {
+        "type": "integer"
+      },
+      "systemType": {
+        "type": "integer"
+      },
+      "createBy": {
+        "type": "long"
+      },
+      "createTimeLong": {
+        "type": "long"
+      },
+      "updateBy": {
+        "type": "long"
+      },
+      "updateTimeLong": {
+        "type": "long"
+      }
+    }
+  }
+}

+ 33 - 0
conf/esTemplate/productImage.json

@@ -0,0 +1,33 @@
+{
+  "info": {
+    "properties": {
+      "id": {
+        "type": "long",
+        "index": "not_analyzed",
+        "fields": {
+          "raw": {
+            "type": "keyword"
+          }
+        }
+      },
+      "idProduct": {
+        "type": "long"
+      },
+      "sortNum": {
+        "type": "long"
+      },
+      "idSkuCategory": {
+        "type": "long"
+      },
+      "imageUrl": {
+        "type": "text",
+        "index": "not_analyzed",
+        "fields": {
+          "raw": {
+            "type": "keyword"
+          }
+        }
+      }
+    }
+  }
+}

+ 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"
+          }
+        }
+      }
+    }
+  }
+}

+ 143 - 0
conf/esTemplate/workPart.json

@@ -0,0 +1,143 @@
+{
+  "workpart": {
+    "_parent": {
+      "type": "info"
+    },
+    "properties": {
+      "id": {
+        "type": "long"
+      },
+      "idOrderPart": {
+        "type": "long"
+      },
+      "idOrder": {
+        "type": "long"
+      },
+      "idPart": {
+        "type": "long"
+      },
+      "workPartQty": {
+        "type": "double"
+      },
+      "workPartState": {
+        "type": "integer"
+      },
+      "lockFlag": {
+        "type": "integer"
+      },
+      "lockMan": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "orderYear": {
+        "type": "integer"
+      },
+      "compageVisibleFlag": {
+        "type": "integer"
+      },
+      "createMan": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "createBy": {
+        "type": "long"
+      },
+      "createTimeLong": {
+        "type": "long"
+      },
+      "updateBy": {
+        "type": "long"
+      },
+      "updateTimeLong": {
+        "type": "long"
+      },
+      "idPaperType": {
+        "type": "long"
+      },
+      "paperTypeName": {
+        "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"
+          }
+        }
+      },
+      "paperName": {
+        "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"
+          }
+        }
+      },
+      "paperSuttle": {
+        "type": "integer"
+      },
+      "idProduct": {
+        "type": "long"
+      },
+      "fuMoFlag": {
+        "type": "integer"
+      },
+      "moQieFlag": {
+        "type": "integer"
+      },
+      "moduleCount": {
+        "type": "integer"
+      },
+      "specialPaperFlag": {
+        "type": "integer"
+      },
+      "qtyEnoughFlag": {
+        "type": "integer"
+      },
+      "partSizeDesc": {
+        "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"
+          }
+        }
+      },
+      "faceCount": {
+        "type": "integer"
+      }
+    }
+  }
+}

+ 44 - 0
conf/esTemplate/workprocess.json

@@ -0,0 +1,44 @@
+{
+  "info": {
+    "properties": {
+      "id": {
+        "type": "long"
+      },
+      "processName": {
+        "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"
+          }
+        }
+      },
+      "voidFlag": {
+        "type": "long"
+      },
+      "sortNum": {
+        "type": "integer"
+      },
+      "baseMoney": {
+        "type": "double"
+      },
+      "price": {
+        "type": "double"
+      },
+      "specialFlag": {
+        "type": "long"
+      }
+    }
+  }
+}

+ 62 - 0
conf/eskeys.properties

@@ -0,0 +1,62 @@
+# suppress inspection "UnusedProperty" for whole file
+
+#注意ES的index只能为小写
+
+#系统群发消息索引库,理论上此库只需一个即可,群发消息不会太多
+es.sysmsg.index=aeerp_sysmsg_
+
+#系统群发消息内容索引库
+es.sysmsgtext.index = aeerp_sysmsgtext_
+
+#用户对用户或者消息通知,发送给指定人的消息,暂时可以只用一个进行存储,
+#未来数据量大的情况下,可以按年份之类的条件增加索引
+es.p2pmsg.index = aeerp_p2pmsg_
+
+#点对点消息内容索引库
+es.p2pmsgtext.index = aeerp_p2pmsgtext_
+
+#用户对应消息状态,用户在登录时在群发和对点发消息库中查找未读的消息写入此库中
+#方便分页和最后的展示,理论上此库需要进行分表,可以针对用户id进行路由
+es.usermsg.index = aeerp_usermsg_
+
+
+#通用文件信息存储
+es.erpfile.index = aeerp_erpfile_
+
+#数据权限
+es.erpdatapurview.index = aeerp_erpdatepurview_
+
+#查询统计
+es.inquireinfo.index = aeerp_inquireinfo_
+
+es.productinfo.index = aeerp_product_info_
+es.product.image.index = aeerp_product_image_
+
+es.workprocess.index = aeerp_workprocess_info_
+#订单索引
+es.printorder.index = aeerp_printorder_
+es.orderstep.index = aeerp_orderstep_
+
+#施工单
+es.printbill.index = aeerp_printbill_
+es.billstep.index = aeerp_billstep_
+es.breedprocess.index = aeerp_breedprocess_
+
+#客户
+es.clientinfo.index = aeerp_clientinfo_
+es.clientreceiveaddress.index = aeerp_clientreceiveaddress_
+
+#纸张&辅料
+es.paperbaseinfo.index = aeerp_paperbaseinfo_
+es.paperinfotype.index = aeerp_paperinfotype_
+es.paperinfo.index = aeerp_paperinfo_
+es.paperquoteinfo.index = aeerp_paperquoteinfo_
+
+es.materialinfotype.index = aeerp_materialinfotype_
+es.materialinfo.index = aeerp_materialinfo_
+
+#外协
+es.outassistinfo.index = aeerp_outassistinfo_
+#供应商
+es.supplierInfo.index = aeerp_supplierinfo_
+

+ 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

+ 4 - 0
conf/productKey.txt

@@ -0,0 +1,4 @@
+铜版
+铜色
+铜版纸
+克重

+ 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.248: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

+ 113 - 0
conf/rediskeys.properties

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

+ 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

+ 53 - 0
conf/rexdb-ddWebOne.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>

+ 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/erpdatamain?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/dnyerp20221012?useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&useSSL=false&rewriteBatchedStatements=true
+mysql001.username=dbadmin
+mysql001.password=Admin@123

+ 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.dderp.common.api.BusinessExecutor
+import com.dderp.common.datas.ERPModule
+import com.dderp.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.dderp.common.api.BusinessExecutor
+import com.dderp.common.datas.ERPModule
+import com.dderp.common.entity.base.ProcessStringItem
+import com.dderp.common.entity.system.ParseAreaResult
+import com.dderp.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
+    }
+}

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

@@ -0,0 +1,112 @@
+import com.dderp.common.api.BusinessExecutor
+import com.dderp.common.api.DocInfoService
+import com.dderp.common.api.SystemService
+import com.dderp.common.api.erp.OrderService
+import com.dderp.common.api.erp.ProductService
+import com.dderp.common.datas.ERPModule
+import com.dderp.common.datas.ERPModuleEntity
+import com.dderp.common.entity.base.BusinessOperation
+import com.dderp.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
+    ProductService productService
+
+    @Resource
+    OrderService orderService
+
+    @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)
+            productService.reloadScriptCache(source.inputItem.code, ERPModule.SYSTEM, source.dataSourceId, source.supplierCode)
+            orderService.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.PRODUCT, ERPModule.PRODUCT_QUOTE]:
+                    if (source.getOperation() == BusinessOperation.SAVE) {
+                        productService.invalidateScriptCache(source.getSupplierCode() + "-" + source.getInputItem().getCode())
+                    } else {
+                        productService.reloadScriptCache(source.getInputItem().getCode(), erpModule, source.getDataSourceId(), source.getSupplierCode())
+                    }
+                    break
+                case [ERPModule.ERP_ORDER, ERPModule.ERP_ORDER_SEARCH]:
+                    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.ADDRESSPARSER:
+                    break
+                case ERPModule.APP:
+                    break
+                default:
+                    break
+            }
+        }
+
+        return RetResult.success().result(source.getInputItem())
+    }
+}

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

@@ -0,0 +1,168 @@
+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.dderp.business.dao.LoginDao
+import com.dderp.common.api.*
+import com.dderp.common.datas.ERPModule
+import com.dderp.common.entity.base.DataBaseMultiItemEx
+import com.dderp.common.entity.base.ProcessEntityItem
+import com.dderp.common.entity.site.ERPTokenUser
+import com.dderp.common.entity.site.LoginRequest
+import com.dderp.common.entity.site.LoginResult
+import com.dderp.common.entity.system.LoginUser
+import com.dderp.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.dnyDriver.commonkey")
+    private String ssoDriverTokenCommonKey
+
+    @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
+            ]
+    ]
+
+    @Override
+    String scriptName() {
+        return "ERP系统登录"
+    }
+
+    @Override
+    ERPModule module() {
+        return ERPModule.SYSTEM
+    }
+
+    @Override
+    RetResult<LoginResult> execute(ProcessEntityItem<LoginRequest> source) {
+        //直接定义Resource不好使,还是需要赋值
+        loginStrategies.get("0").tokenKey = ssoERPTokenCommonKey
+
+        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)
+        }
+
+    }
+}

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

@@ -0,0 +1,502 @@
+import com.dySweetFishPlugin.elasticsearch.ESClient
+import com.dySweetFishPlugin.tool.lang.DateUtil
+import com.dderp.common.api.BusinessExecutor
+import com.dderp.common.api.erp.ProductService
+import com.dderp.common.api.SupplierInitService
+import com.dderp.common.datas.ERPModule
+import com.dderp.common.datas.ESKeys
+import com.dderp.common.datas.TokenUserFrom
+import com.dderp.common.entity.base.EChartDoubleData
+import com.dderp.common.entity.base.ProcessMapItem
+import com.dderp.common.entity.product.ProductInfo
+import com.sweetfish.service.RetResult
+import org.elasticsearch.action.search.SearchRequestBuilder
+import org.elasticsearch.action.search.SearchResponse
+import org.elasticsearch.index.query.QueryBuilders
+import org.elasticsearch.search.aggregations.AggregationBuilders
+import org.elasticsearch.search.aggregations.bucket.filter.InternalFilter
+import org.elasticsearch.search.aggregations.bucket.histogram.DateHistogramInterval
+import org.elasticsearch.search.aggregations.bucket.histogram.ExtendedBounds
+import org.elasticsearch.search.aggregations.bucket.histogram.Histogram
+import org.elasticsearch.search.aggregations.bucket.histogram.InternalDateHistogram
+import org.elasticsearch.search.aggregations.bucket.terms.Terms
+import org.elasticsearch.search.aggregations.metrics.sum.InternalSum
+import org.elasticsearch.search.aggregations.metrics.valuecount.ValueCount
+import org.rex.RMap
+
+import javax.annotation.Resource
+import java.math.RoundingMode
+import java.time.LocalDate
+import java.time.LocalDateTime
+import java.time.temporal.TemporalAdjusters
+
+/**
+ * Created by jlutt on 2021-09-22
+ *
+ * @author jlutt
+ */
+@SuppressWarnings("unused")
+class BE_IndexCardPanelData implements BusinessExecutor<ProcessMapItem, ProcessMapItem> {
+
+    @Resource
+    ESClient esClient
+
+    @Resource
+    SupplierInitService supplierService
+
+    @Resource
+    ProductService productService
+
+    @Override
+    String scriptName() {
+        return "首页面板查询业务数据"
+    }
+
+    @Override
+    ERPModule module() {
+        return ERPModule.SYSTEM
+    }
+
+    @Override
+    RetResult<ProcessMapItem> execute(ProcessMapItem source) {
+        RMap data = new RMap()
+
+        //region 生产数据查询
+
+        //查询待组版订单数量
+        SearchRequestBuilder childRequest1 = esClient.getClient().prepareSearch(supplierService.getDateYearESIndex(source.getSupplierCode(), ESKeys.ES_ERP_PRINT_ORDER_INDEX, 2021))
+                .setQuery(QueryBuilders.boolQuery().must(QueryBuilders.typeQuery(ESKeys.ES_ERP_PRINT_ORDER_TYPE))
+                        .must(QueryBuilders.termQuery("voidFlag", 0)))
+        childRequest1 = childRequest1.addAggregation(
+                AggregationBuilders
+                        .filter("a3_count",
+                                OrderStatisticsQueryBuilder.valueOf("A3").apply(null, false, false)
+                        )
+                        .subAggregation(AggregationBuilders.count("subA3_Count").field("id"))
+        )
+        childRequest1 = childRequest1.addAggregation(
+                AggregationBuilders
+                        .filter("a7_count",
+                                OrderStatisticsQueryBuilder.valueOf("A7").apply(null, false, false)
+                        )
+                        .subAggregation(AggregationBuilders.count("subA7_Count").field("id"))
+        )
+        childRequest1 = childRequest1.addAggregation(
+                AggregationBuilders
+                        .filter("a12_count",
+                                OrderStatisticsQueryBuilder.valueOf("A12").apply(null, false, false)
+                        )
+                        .subAggregation(AggregationBuilders.count("subA12_Count").field("id"))
+        )
+        SearchResponse childRes1 = childRequest1.execute().actionGet()
+
+        InternalFilter genderWaitBreedOrderCount = childRes1.getAggregations().get("a3_count")
+        ValueCount valueWaitBreedOrderCount = genderWaitBreedOrderCount.getAggregations().get("subA3_Count")
+        data.put("waitBreedOrderCount", valueWaitBreedOrderCount.getValue())
+
+        InternalFilter genderWorkingOrderCount = childRes1.getAggregations().get("a7_count")
+        ValueCount valueWorkingOrderCount = genderWorkingOrderCount.getAggregations().get("subA7_Count")
+        data.put("workingOrderCount", valueWorkingOrderCount.getValue())
+
+        InternalFilter genderWaitSendOrderCount = childRes1.getAggregations().get("a12_count")
+        ValueCount valueWaitSendOrderCount = genderWaitSendOrderCount.getAggregations().get("subA12_Count")
+        data.put("waitSendOrderCount", valueWaitSendOrderCount.getValue())
+
+
+        //查询待下机版数量
+        SearchRequestBuilder childRequest11 = esClient.getClient().prepareSearch(supplierService.getDateYearESIndex(source.getSupplierCode(), ESKeys.ES_ERP_PRINTBILL_INDEX, 2021))
+                .setQuery(QueryBuilders.boolQuery().must(QueryBuilders.typeQuery(ESKeys.ES_ERP_PRINTBILL_BREED_TYPE))
+                        .must(QueryBuilders.termQuery("voidFlag", 0)))
+
+        childRequest11 = childRequest11.addAggregation(
+                AggregationBuilders
+                        .filter("a3_count",
+                                BreedStatisticsQueryBuilder.valueOf("A3").apply(false)
+                        )
+                        .subAggregation(AggregationBuilders.count("subA3_Count").field("id"))
+        )
+
+        SearchResponse childRes11 = childRequest11.execute().actionGet()
+
+        InternalFilter genderScheduleBreedCount = childRes11.getAggregations().get("a3_count")
+        ValueCount valueScheduleBreedCount = genderScheduleBreedCount.getAggregations().get("subA3_Count")
+        data.put("scheduleBreedCount", valueScheduleBreedCount.getValue())
+
+        //endregion
+
+        if (source.getCurrentUser().getUserFrom() == TokenUserFrom.PC_ADMIN.value) {
+
+            LocalDate nowDate = LocalDate.now()
+            LocalDateTime nowTime = LocalDateTime.now()
+
+
+            //region 订单、施工单近7天的数量
+
+            RMap day7WorkData = new RMap()
+            RMap day7MoneyData = new RMap()
+
+            List<String> day7Work_legendStrArray = new ArrayList<>()
+            List<String> day7Money_legendStrArray = new ArrayList<>()
+            day7Work_legendStrArray.add("订单数量")
+            day7Work_legendStrArray.add("施工单版数量")
+            day7Money_legendStrArray.add("订单金额")
+            day7WorkData.put("legendStrArray", day7Work_legendStrArray)
+            day7MoneyData.put("legendStrArray", day7Money_legendStrArray)
+
+//            Date endDate2 = new Date();
+//            endDate2 = DateUtil.getStartOfDay(endDate2);
+//            Date beginDate2 = endDate2 - 6;
+            Date endDate2 = nowDate.toDate()
+            Date beginDate2 = (nowDate - 6).toDate()
+
+            List<String> day7Work_xAxisArray = (nowDate - 6..nowDate).collect {
+                String.valueOf(it.getMonthValue()) + "." + (it.dayOfMonth)
+            }.toList()
+
+//            List<String> day7Work_xAxisArray = (beginDate2..endDate2).collect {
+//                (it[Calendar.MONTH] + 1) + "." + (it[Calendar.DAY_OF_MONTH])
+//            }.toList();
+            day7WorkData.put("xAxisArray", day7Work_xAxisArray)
+            day7MoneyData.put("xAxisArray", day7Work_xAxisArray)
+
+            List<EChartDoubleData> day7Work_seriesList = new ArrayList<>()
+            List<EChartDoubleData> day7Money_seriesList = new ArrayList<>()
+
+            SearchRequestBuilder childRequest2 = esClient.getClient().prepareSearch(supplierService.getDateYearESIndex(source.getSupplierCode(), ESKeys.ES_ERP_PRINT_ORDER_INDEX, 2021))
+                    .setQuery(
+                            QueryBuilders.boolQuery().must(QueryBuilders.typeQuery(ESKeys.ES_ERP_PRINT_ORDER_TYPE))
+                                    .must(QueryBuilders.termQuery("voidFlag", 0))
+                                    .must(QueryBuilders.rangeQuery("createTimeLong").gte(DateUtil.getStartOfDay(beginDate2).getTime()).lte(DateUtil.getEndOfDay(endDate2).getTime()))
+                    )
+
+
+            childRequest2.addAggregation(
+                    AggregationBuilders.dateHistogram("orders")
+                            .field("createTimeLong")
+                            .dateHistogramInterval(DateHistogramInterval.DAY)
+                            .minDocCount(0l)
+                            .extendedBounds(new ExtendedBounds(DateUtil.getStartOfDay(beginDate2).getTime(), DateUtil.getEndOfDay(endDate2).getTime()))
+                            .order(Histogram.Order.KEY_ASC)
+                            .subAggregation(
+                                    AggregationBuilders.sum("sub_orderMoney").field("orderMoneyTotal")
+                            )
+            )
+            SearchResponse childRes2 = childRequest2.execute().actionGet()
+            InternalDateHistogram day7Work_Orders = childRes2.getAggregations().get("orders")
+
+            EChartDoubleData day7Work_OrderCount_SeriesData = new EChartDoubleData()
+            day7Work_OrderCount_SeriesData.setName("订单数量")
+            day7Work_OrderCount_SeriesData.setType("line")
+
+            EChartDoubleData day7Work_OrderMoney_SeriesData = new EChartDoubleData()
+            day7Work_OrderMoney_SeriesData.setName("订单金额")
+            day7Work_OrderMoney_SeriesData.setType("line")
+
+            day7Work_Orders.buckets.each {
+                day7Work_OrderCount_SeriesData.getData().add(BigDecimal.valueOf(it.docCount))
+                InternalSum internalMoneySum = it.getAggregations().get("sub_orderMoney")
+                day7Work_OrderMoney_SeriesData.getData().add(BigDecimal.valueOf(internalMoneySum.getValue()))
+            }
+            //extendedBounds必须添加,防止开始和结束的数据为0,但加上后,好像前面会多一天
+            if (day7Work_OrderCount_SeriesData.getData().size() == 8) {
+                day7Work_OrderCount_SeriesData.getData().remove(0)
+            }
+            if (day7Work_OrderMoney_SeriesData.getData().size() == 8) {
+                day7Work_OrderMoney_SeriesData.getData().remove(0)
+            }
+
+            day7Work_seriesList.add(day7Work_OrderCount_SeriesData)
+            day7Money_seriesList.add(day7Work_OrderMoney_SeriesData)
+
+
+            //施工单
+            SearchRequestBuilder childRequest12 = esClient.getClient().prepareSearch(supplierService.getDateYearESIndex(source.getSupplierCode(), ESKeys.ES_ERP_PRINTBILL_INDEX, 2021))
+                    .setQuery(
+                            QueryBuilders.boolQuery().must(QueryBuilders.typeQuery(ESKeys.ES_ERP_PRINTBILL_BREED_TYPE))
+                                    .must(QueryBuilders.termQuery("voidFlag", 0))
+                                    .must(QueryBuilders.rangeQuery("createTime").gte(DateUtil.getStartOfDay(beginDate2).getTime()).lte(DateUtil.getEndOfDay(endDate2).getTime()))
+                    )
+
+
+            childRequest12.addAggregation(
+                    AggregationBuilders.dateHistogram("breeds")
+                            .field("createTime")
+                            .dateHistogramInterval(DateHistogramInterval.DAY)
+                            .minDocCount(0l)
+                            .extendedBounds(new ExtendedBounds(DateUtil.getStartOfDay(beginDate2).getTime(), DateUtil.getEndOfDay(endDate2).getTime()))
+                            .order(Histogram.Order.KEY_ASC)
+            )
+            SearchResponse childRes12 = childRequest12.execute().actionGet()
+            InternalDateHistogram day7Work_Breeds = childRes12.getAggregations().get("breeds")
+
+            EChartDoubleData day7Work_BreedCount_SeriesData = new EChartDoubleData()
+            day7Work_BreedCount_SeriesData.setName("施工单版数量")
+            day7Work_BreedCount_SeriesData.setType("line")
+
+            day7Work_Breeds.buckets.each {
+                day7Work_BreedCount_SeriesData.getData().add(BigDecimal.valueOf(it.docCount))
+            }
+
+            //extendedBounds必须添加,防止开始和结束的数据为0,但加上后,好像前面会多一天
+            if (day7Work_BreedCount_SeriesData.getData().size() == 8) {
+                day7Work_BreedCount_SeriesData.getData().remove(0)
+            }
+
+            day7Work_seriesList.add(day7Work_BreedCount_SeriesData)
+
+            day7WorkData.put("seriesData", day7Work_seriesList)
+            day7MoneyData.put("seriesData", day7Money_seriesList)
+//        day7Work_Orders.
+
+            data.put("day7Work", day7WorkData)
+            data.put("day7Money", day7MoneyData)
+
+            //endregion
+
+            //region 订单产品近7天的印量
+
+
+            RMap day7ProductPrintCountData = new RMap()
+
+            List<String> day7ProductPrintCount_legendStrArray = new ArrayList<>()
+            List<ProductInfo> productInfoList = productService.getProductInfoAllLocal(source.getDataSourceId(), source.getSupplierCode())
+            productInfoList.each {
+                day7ProductPrintCount_legendStrArray.add(it.productName)
+            }
+            day7ProductPrintCount_legendStrArray.add("全部产品")
+            day7ProductPrintCountData.put("legendStrArray", day7ProductPrintCount_legendStrArray)
+
+//            Date endDate5 = new Date();
+//            endDate5 = DateUtil.getStartOfDay(endDate5);
+//            Date beginDate5 = endDate2 - 6;
+            Date endDate5 = nowDate.toDate()
+            Date beginDate5 = (nowDate - 6).toDate()
+
+            List<String> day7ProductPrintCount_xAxisArray = (nowDate - 6..nowDate).collect {
+                String.valueOf(it.getMonthValue()) + "." + String.valueOf(it.getDayOfMonth())
+            }.toList()
+
+//            List<String> day7ProductPrintCount_xAxisArray = (beginDate5..endDate5).collect {
+//                (it[Calendar.MONTH] + 1) + "." + (it[Calendar.DAY_OF_MONTH])
+//            }.toList();
+            day7ProductPrintCountData.put("xAxisArray", day7ProductPrintCount_xAxisArray)
+
+            List<EChartDoubleData> day7ProductPrintCount_seriesList = new ArrayList<>()
+
+            SearchRequestBuilder childRequest5 = esClient.getClient().prepareSearch(supplierService.getDateYearESIndex(source.getSupplierCode(), ESKeys.ES_ERP_PRINT_ORDER_INDEX, 2021))
+                    .setQuery(
+                            QueryBuilders.boolQuery().must(QueryBuilders.typeQuery(ESKeys.ES_ERP_PRINT_ORDER_TYPE))
+                                    .must(QueryBuilders.termQuery("voidFlag", 0))
+                                    .must(QueryBuilders.rangeQuery("createTimeLong").gte(DateUtil.getStartOfDay(beginDate2).getTime()).lte(DateUtil.getEndOfDay(endDate2).getTime()))
+                    )
+
+
+            childRequest5.addAggregation(
+                    AggregationBuilders.dateHistogram("orders")
+                            .field("createTimeLong")
+                            .dateHistogramInterval(DateHistogramInterval.DAY)
+                            .minDocCount(0l)
+                            .extendedBounds(new ExtendedBounds(DateUtil.getStartOfDay(beginDate5).getTime(), DateUtil.getEndOfDay(endDate5).getTime()))
+                            .order(Histogram.Order.KEY_ASC)
+                            .subAggregation(
+                                    AggregationBuilders.terms("products")
+                                            .field("idProduct")
+                                            .size(100)
+                                            .order(Terms.Order.count(false))
+                                            .subAggregation(
+                                                    AggregationBuilders.sum("sub_orderPrintCount").field("orderQty")
+                                            )
+                            )
+                            .subAggregation(
+                                    AggregationBuilders.sum("sub_AllOrderPrintCount").field("orderQty")
+                            )
+            )
+            SearchResponse childRes5 = childRequest5.execute().actionGet()
+
+            productInfoList.each {
+                EChartDoubleData day7ProductPrintCount_SeriesData = new EChartDoubleData()
+                day7ProductPrintCount_SeriesData.setType("line")
+                day7ProductPrintCount_SeriesData.setName(it.productName)
+                day7ProductPrintCount_SeriesData.setId(it.getId())
+
+                day7ProductPrintCount_seriesList.add(day7ProductPrintCount_SeriesData)
+            }
+
+            EChartDoubleData day7ProductPrintCount_SeriesData = new EChartDoubleData()
+            day7ProductPrintCount_SeriesData.setType("line")
+            day7ProductPrintCount_SeriesData.setName("全部产品")
+            day7ProductPrintCount_SeriesData.setId(-1)
+            day7ProductPrintCount_seriesList.add(day7ProductPrintCount_SeriesData)
+
+
+            InternalDateHistogram day7ProductPrintCount_Orders = childRes5.getAggregations().get("orders")
+            List<Long> idProductList = new ArrayList<>()
+            day7ProductPrintCount_Orders.buckets.each {
+                idProductList.clear()
+                Terms productsGenders = it.getAggregations().get("products")
+                productsGenders.buckets.each { p ->
+                    Terms.Bucket productBucket = p
+                    long idProduct = Long.parseLong(productBucket.getKeyAsString())
+                    InternalSum internalOrderQtySum = productBucket.getAggregations().get("sub_orderPrintCount")
+
+                    idProductList.add(idProduct)
+
+                    EChartDoubleData chartData = day7ProductPrintCount_seriesList.find { x -> return x.getId() == idProduct }
+                    if (chartData != null) {
+                        chartData.getData().add(BigDecimal.valueOf(internalOrderQtySum.getValue()))
+                    }
+                }
+
+                InternalSum internalAllOrderQtySum = it.getAggregations().get("sub_AllOrderPrintCount")
+                EChartDoubleData chartAllData = day7ProductPrintCount_seriesList.find { x -> return x.getId() == -1 }
+                if (chartAllData != null) {
+                    chartAllData.getData().add(BigDecimal.valueOf(internalAllOrderQtySum.getValue()))
+                }
+
+                //找不到数据的得加0
+                List<EChartDoubleData> remainDataList = day7ProductPrintCount_seriesList.findAll { x -> return ((x.getId() != -1) && (!idProductList.any { y -> y == x.getId() })) }
+                remainDataList.each { d ->
+                    d.getData().add(BigDecimal.ZERO)
+                }
+            }
+
+            day7ProductPrintCount_seriesList.each {
+                //extendedBounds必须添加,防止开始和结束的数据为0,但加上后,好像前面会多一天
+                if (it.getData().size() == 8) {
+                    it.getData().remove(0)
+                }
+            }
+
+            day7ProductPrintCountData.put("seriesData", day7ProductPrintCount_seriesList)
+
+            data.put("day7ProductPrintCount", day7ProductPrintCountData)
+
+
+            //endregion
+
+            //region 订单月产品类型统计
+
+            RMap monthOrderProductData = new RMap()
+
+
+            LocalDateTime beginDate3 = nowTime.withDayOfMonth(1)
+            LocalDateTime endDate3 = nowTime.withDayOfMonth(nowTime.toLocalDate().lengthOfMonth())
+
+            List<RMap> monthOrderProduct_seriesList = new ArrayList<>()
+
+            SearchRequestBuilder childRequest3 = esClient.getClient().prepareSearch(supplierService.getDateYearESIndex(source.getSupplierCode(), ESKeys.ES_ERP_PRINT_ORDER_INDEX, 2021))
+                    .setQuery(
+                            QueryBuilders.boolQuery().must(QueryBuilders.typeQuery(ESKeys.ES_ERP_PRINT_ORDER_TYPE))
+                                    .must(QueryBuilders.termQuery("voidFlag", 0))
+                                    .must(QueryBuilders.rangeQuery("createTimeLong").gte(DateUtil.getStartOfDay(DateUtil.localDateTimeToDate(beginDate3)).getTime()).lte(DateUtil.getEndOfDay(DateUtil.localDateTimeToDate(endDate3)).getTime()))
+                    )
+
+
+            childRequest3.addAggregation(
+                    AggregationBuilders.terms("orders")
+                            .field("idProduct")
+                            .size(100)
+                            .order(Terms.Order.count(false))
+                            .subAggregation(
+                                    AggregationBuilders.sum("sub_orderMoney").field("orderMoneyTotal")
+                            )
+            )
+            SearchResponse childRes3 = childRequest3.execute().actionGet()
+
+            Terms monthOrderProductGenders = childRes3.getAggregations().get("orders")
+            for (Terms.Bucket monthOrderProductBucket : monthOrderProductGenders.getBuckets()) {
+                long idProduct = Long.parseLong(monthOrderProductBucket.getKeyAsString())
+                RMap bucketData = new RMap()
+                InternalSum moneySum = monthOrderProductBucket.getAggregations().get("sub_orderMoney")
+                bucketData.put("name", productService.getProductInfoName(idProduct, source.getSupplierCode()))
+//                bucketData.put("value", monthOrderProductBucket.getDocCount());
+                bucketData.put("value", BigDecimal.valueOf(moneySum.getValue()).setScale(2, RoundingMode.HALF_UP))
+                monthOrderProduct_seriesList.add(bucketData)
+            }
+
+            monthOrderProductData.put("seriesData", monthOrderProduct_seriesList)
+            data.put("monthOrderProduct", monthOrderProductData)
+
+            //endregion
+
+            //region 订单月份数量统计
+
+            RMap month12WorkData = new RMap()
+            RMap month12MoneyData = new RMap()
+
+            LocalDateTime beginDate4 = nowTime.with(TemporalAdjusters.firstDayOfYear())
+            LocalDateTime endDate4 = nowTime.with(TemporalAdjusters.lastDayOfYear())
+
+            List<EChartDoubleData> month12Work_seriesList = new ArrayList<>()
+            List<EChartDoubleData> month12Money_seriesList = new ArrayList<>()
+
+            SearchRequestBuilder childRequest4 = esClient.getClient().prepareSearch(supplierService.getDateYearESIndex(source.getSupplierCode(), ESKeys.ES_ERP_PRINT_ORDER_INDEX, 2021))
+                    .setQuery(
+                            QueryBuilders.boolQuery().must(QueryBuilders.typeQuery(ESKeys.ES_ERP_PRINT_ORDER_TYPE))
+                                    .must(QueryBuilders.termQuery("voidFlag", 0))
+                                    .must(QueryBuilders.rangeQuery("createTimeLong").gte(DateUtil.getStartOfDay(DateUtil.localDateTimeToDate(beginDate4)).getTime()).lte(DateUtil.getEndOfDay(DateUtil.localDateTimeToDate(endDate4)).getTime()))
+                    )
+
+
+            childRequest4.addAggregation(
+                    AggregationBuilders.dateHistogram("orders")
+                            .field("createTimeLong")
+                            .dateHistogramInterval(DateHistogramInterval.MONTH)
+                            .minDocCount(0l)
+                            .extendedBounds(new ExtendedBounds(DateUtil.getStartOfDay(DateUtil.localDateTimeToDate(beginDate4)).getTime(), DateUtil.getEndOfDay(DateUtil.localDateTimeToDate(endDate4)).getTime()))
+                            .order(Histogram.Order.KEY_ASC)
+                            .subAggregation(
+                                    AggregationBuilders.sum("sub_orderMoney").field("orderMoneyTotal")
+                            )
+            )
+            SearchResponse childRes4 = childRequest4.execute().actionGet()
+            InternalDateHistogram month12Work_Orders = childRes4.getAggregations().get("orders")
+
+            EChartDoubleData month12Work_OrderCount_SeriesData = new EChartDoubleData()
+            month12Work_OrderCount_SeriesData.setName("订单数量")
+            month12Work_OrderCount_SeriesData.setType("bar")
+
+            EChartDoubleData month12Work_OrderMoney_SeriesData = new EChartDoubleData()
+            month12Work_OrderMoney_SeriesData.setName("订单金额")
+            month12Work_OrderMoney_SeriesData.setType("bar")
+
+            month12Work_Orders.buckets.each {
+                month12Work_OrderCount_SeriesData.getData().add(BigDecimal.valueOf(it.docCount))
+                InternalSum internalMoneySum = it.getAggregations().get("sub_orderMoney")
+                month12Work_OrderMoney_SeriesData.getData().add(BigDecimal.valueOf(internalMoneySum.getValue()).setScale(2, RoundingMode.HALF_UP))
+            }
+            //extendedBounds必须添加,防止开始和结束的数据为0,但加上后,好像前面会多一天
+            if (month12Work_OrderCount_SeriesData.getData().size() == 13) {
+                month12Work_OrderCount_SeriesData.getData().remove(0)
+            }
+            if (month12Work_OrderMoney_SeriesData.getData().size() == 13) {
+                month12Work_OrderMoney_SeriesData.getData().remove(0)
+            }
+
+
+            month12Work_seriesList.add(month12Work_OrderCount_SeriesData)
+            month12Money_seriesList.add(month12Work_OrderMoney_SeriesData)
+
+            month12WorkData.put("seriesData", month12Work_seriesList)
+            month12MoneyData.put("seriesData", month12Money_seriesList)
+//        day7Work_Orders.
+
+            data.put("month12Work", month12WorkData)
+            data.put("month12Money", month12MoneyData)
+
+            //endregion
+
+        }
+
+        data.put("showData", true)
+
+        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.dderp.common.api.BusinessExecutor
+import com.dderp.common.datas.ERPModule
+import com.dderp.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()
+        )
+    }
+}

+ 51 - 0
conf/script/1000/business/BE_System_TestListExt.groovy

@@ -0,0 +1,51 @@
+import com.dderp.common.api.BusinessExecutor
+import com.dderp.common.datas.ERPModule
+import com.dderp.common.entity.base.ProcessStringItem
+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_System_TestListExt implements BusinessExecutor<ProcessStringItem, ProcessStringItem> {
+
+    protected final Logger logger = LogManager.getLogger(this.getClass().getSimpleName())
+
+    @Resource(name = "APP_HOME")
+    private String appHome
+
+    @Override
+    String scriptName() {
+        return "测试Groovy扩展方法是否成功"
+    }
+
+    @Override
+    ERPModule module() {
+        return ERPModule.SYSTEM
+    }
+
+    void start(long supplierCode) {
+        def jsonSlurper = new JsonSlurper()
+
+        def testTableJsonFile = new File(appHome + File.separator +
+                "conf" + File.separator +
+                "script" + File.separator +
+                "1000" + File.separator +
+                "quoteFiles" + File.separator +
+                "testTable.json")
+        def testTableJsonArray = jsonSlurper.parse(testTableJsonFile)
+
+        logger.info(testTableJsonArray.findQuotedElement(["规格": "正度", "开数": "16开"]))
+        logger.info(testTableJsonArray.findQuotedElements(["规格": "大度", "开数": "8开"]))
+    }
+
+    RetResult<ProcessStringItem> execute(ProcessStringItem source) {
+        return RetResult.<ProcessStringItem> successT().result(
+                ProcessStringItem.newBuilder()
+                        .itemValue("此代码无需执行,主要用于扩展Groovy方法,简化书写")
+                        .build()
+        )
+    }
+}

+ 299 - 0
conf/script/1000/commons/BreedStatisticsQueryBuilder.groovy

@@ -0,0 +1,299 @@
+import com.dderp.common.datas.ESKeys
+import com.dderp.common.datas.PrintBillLifeNode
+import org.apache.lucene.search.join.ScoreMode
+import org.elasticsearch.index.query.BoolQueryBuilder
+import org.elasticsearch.index.query.QueryBuilder
+import org.elasticsearch.index.query.QueryBuilders
+import org.elasticsearch.join.query.JoinQueryBuilders
+
+/**
+ * Created by jlutt on 2021-05-08
+ *
+ * @author jlutt
+ */
+
+enum BreedStatisticsQueryBuilder {
+    //待下达
+    A1{
+        QueryBuilder apply(boolean readCycle) {
+            return QueryBuilders.boolQuery()
+                    .mustNot(JoinQueryBuilders.hasChildQuery(
+                            ESKeys.ES_ERP_PRINTBILL_LIFECYCLE_TYPE,
+                            QueryBuilders.boolQuery()
+                                    .must(QueryBuilders.rangeQuery("lifeNodeId").gte(PrintBillLifeNode.submit.value))
+                                    .must(QueryBuilders.rangeQuery("lifeNodeState").gt(0)),
+                            ScoreMode.None)
+                    )
+        }
+    },
+
+    //待纸张预出库
+    A2{
+        QueryBuilder apply(boolean readCycle) {
+            return QueryBuilders.boolQuery()
+                    .must(JoinQueryBuilders.hasChildQuery(
+                            ESKeys.ES_ERP_PRINTBILL_LIFECYCLE_TYPE,
+                            QueryBuilders.boolQuery()
+                                    .must(QueryBuilders.termQuery("lifeNodeId", PrintBillLifeNode.submit.value))
+                                    .must(QueryBuilders.rangeQuery("lifeNodeState").gt(0)),
+                            ScoreMode.None)
+                    )
+                    .mustNot(JoinQueryBuilders.hasChildQuery(
+                            ESKeys.ES_ERP_PRINTBILL_LIFECYCLE_TYPE,
+                            QueryBuilders.boolQuery()
+                                    .must(QueryBuilders.termQuery("lifeNodeId", PrintBillLifeNode.paperPreOut.value))
+                                    .must(QueryBuilders.rangeQuery("lifeNodeState").gt(0)),
+                            ScoreMode.None)
+                    )
+                    .mustNot(JoinQueryBuilders.hasChildQuery(
+                            ESKeys.ES_ERP_PRINTBILL_LIFECYCLE_TYPE,
+                            QueryBuilders.boolQuery()
+                                    .must(QueryBuilders.termQuery("lifeNodeId", PrintBillLifeNode.paperStockOut.value))
+                                    .must(QueryBuilders.rangeQuery("lifeNodeState").gt(0)),
+                            ScoreMode.None)
+                    )
+        }
+    },
+
+    //待下机
+    A3{
+        QueryBuilder apply(boolean readCycle) {
+            return QueryBuilders.boolQuery()
+                    .must(JoinQueryBuilders.hasChildQuery(
+                            ESKeys.ES_ERP_PRINTBILL_LIFECYCLE_TYPE,
+                            QueryBuilders.boolQuery()
+                                    .must(QueryBuilders.termQuery("lifeNodeId", PrintBillLifeNode.submit.value))
+                                    .must(QueryBuilders.rangeQuery("lifeNodeState").gt(0)),
+                            ScoreMode.None)
+                    )
+                    .mustNot(JoinQueryBuilders.hasChildQuery(
+                            ESKeys.ES_ERP_PRINTBILL_LIFECYCLE_TYPE,
+                            QueryBuilders.boolQuery()
+                                    .must(QueryBuilders.termQuery("lifeNodeId", PrintBillLifeNode.printFeedback.value))
+                                    .must(QueryBuilders.rangeQuery("lifeNodeState").gt(0)),
+                            ScoreMode.None)
+                    )
+        }
+    },
+
+    //待纸张领料
+    A4{
+        QueryBuilder apply(boolean readCycle) {
+            BoolQueryBuilder q = QueryBuilders.boolQuery()
+                    .must(JoinQueryBuilders.hasChildQuery(
+                            ESKeys.ES_ERP_PRINTBILL_LIFECYCLE_TYPE,
+                            QueryBuilders.boolQuery()
+                                    .must(QueryBuilders.termQuery("lifeNodeId", PrintBillLifeNode.paperPreOut.value))
+                                    .must(QueryBuilders.rangeQuery("lifeNodeState").gt(0)),
+                            ScoreMode.None)
+                    )
+                    .mustNot(JoinQueryBuilders.hasChildQuery(
+                            ESKeys.ES_ERP_PRINTBILL_LIFECYCLE_TYPE,
+                            QueryBuilders.boolQuery()
+                                    .must(QueryBuilders.termQuery("lifeNodeId", PrintBillLifeNode.paperPick.value))
+                                    .must(QueryBuilders.rangeQuery("lifeNodeState").gt(0)),
+                            ScoreMode.None)
+                    )
+            return q
+        }
+    },
+
+    //待出库
+    A5{
+        QueryBuilder apply(boolean readCycle) {
+            BoolQueryBuilder q = QueryBuilders.boolQuery()
+                    .must(JoinQueryBuilders.hasChildQuery(
+                            ESKeys.ES_ERP_PRINTBILL_LIFECYCLE_TYPE,
+                            QueryBuilders.boolQuery()
+                                    .must(QueryBuilders.termQuery("lifeNodeId", PrintBillLifeNode.paperPick.value))
+                                    .must(QueryBuilders.rangeQuery("lifeNodeState").gt(0)),
+                            ScoreMode.None)
+                    )
+                    .mustNot(JoinQueryBuilders.hasChildQuery(
+                            ESKeys.ES_ERP_PRINTBILL_LIFECYCLE_TYPE,
+                            QueryBuilders.boolQuery()
+                                    .must(QueryBuilders.termQuery("lifeNodeId", PrintBillLifeNode.paperStockOut.value))
+                                    .must(QueryBuilders.rangeQuery("lifeNodeState").gt(0)),
+                            ScoreMode.None)
+                    )
+            return q
+        }
+    },
+
+    //待拼版反馈
+    A6{
+        QueryBuilder apply(boolean readCycle) {
+            return QueryBuilders.boolQuery()
+                    .must(JoinQueryBuilders.hasChildQuery(
+                            ESKeys.ES_ERP_PRINTBILL_LIFECYCLE_TYPE,
+                            QueryBuilders.boolQuery()
+                                    .must(QueryBuilders.termQuery("lifeNodeId", PrintBillLifeNode.schedule.value))
+                                    .must(QueryBuilders.rangeQuery("lifeNodeState").gt(0)),
+                            ScoreMode.None)
+                    )
+                    .mustNot(JoinQueryBuilders.hasChildQuery(
+                            ESKeys.ES_ERP_PRINTBILL_LIFECYCLE_TYPE,
+                            QueryBuilders.boolQuery()
+                                    .must(QueryBuilders.termQuery("lifeNodeId", PrintBillLifeNode.spliceBreedFeedback.value))
+                                    .must(QueryBuilders.rangeQuery("lifeNodeState").gt(0)),
+                            ScoreMode.None)
+                    )
+        }
+    },
+    //待制版反馈
+    A7{
+        QueryBuilder apply(boolean readCycle) {
+            return QueryBuilders.boolQuery()
+                    .must(JoinQueryBuilders.hasChildQuery(
+                            ESKeys.ES_ERP_PRINTBILL_LIFECYCLE_TYPE,
+                            QueryBuilders.boolQuery()
+                                    .must(QueryBuilders.termQuery("lifeNodeId", PrintBillLifeNode.schedule.value))
+                                    .must(QueryBuilders.rangeQuery("lifeNodeState").gt(0)),
+                            ScoreMode.None)
+                    )
+                    .mustNot(JoinQueryBuilders.hasChildQuery(
+                            ESKeys.ES_ERP_PRINTBILL_LIFECYCLE_TYPE,
+                            QueryBuilders.boolQuery()
+                                    .must(QueryBuilders.termQuery("lifeNodeId", PrintBillLifeNode.makeBreedFeedback.value))
+                                    .must(QueryBuilders.rangeQuery("lifeNodeState").gt(0)),
+                            ScoreMode.None)
+                    )
+        }
+    },
+    //待白料裁切反馈
+    A8{
+        QueryBuilder apply(boolean readCycle) {
+            return QueryBuilders.boolQuery()
+                    .must(JoinQueryBuilders.hasChildQuery(
+                            ESKeys.ES_ERP_PRINTBILL_LIFECYCLE_TYPE,
+                            QueryBuilders.boolQuery()
+                                    .must(QueryBuilders.termQuery("lifeNodeId", PrintBillLifeNode.schedule.value))
+                                    .must(QueryBuilders.rangeQuery("lifeNodeState").gt(0)),
+                            ScoreMode.None)
+                    )
+                    .mustNot(JoinQueryBuilders.hasChildQuery(
+                            ESKeys.ES_ERP_PRINTBILL_LIFECYCLE_TYPE,
+                            QueryBuilders.boolQuery()
+                                    .must(QueryBuilders.termQuery("lifeNodeId", PrintBillLifeNode.paperCutFeedback.value))
+                                    .must(QueryBuilders.rangeQuery("lifeNodeState").gt(0)),
+                            ScoreMode.None)
+                    )
+        }
+    },
+    //待印刷反馈
+    A9{
+        QueryBuilder apply(boolean readCycle) {
+            return QueryBuilders.boolQuery()
+                    .must(JoinQueryBuilders.hasChildQuery(
+                            ESKeys.ES_ERP_PRINTBILL_LIFECYCLE_TYPE,
+                            QueryBuilders.boolQuery()
+                                    .must(QueryBuilders.termQuery("lifeNodeId", PrintBillLifeNode.schedule.value))
+                                    .must(QueryBuilders.rangeQuery("lifeNodeState").gt(0)),
+                            ScoreMode.None)
+                    )
+                    .mustNot(JoinQueryBuilders.hasChildQuery(
+                            ESKeys.ES_ERP_PRINTBILL_LIFECYCLE_TYPE,
+                            QueryBuilders.boolQuery()
+                                    .must(QueryBuilders.termQuery("lifeNodeId", PrintBillLifeNode.printFeedback.value))
+                                    .must(QueryBuilders.rangeQuery("lifeNodeState").gt(0)),
+                            ScoreMode.None)
+                    )
+        }
+    },
+    //待外协下达
+    A10{
+        QueryBuilder apply(boolean readCycle) {
+            return QueryBuilders.boolQuery()
+                    .must(JoinQueryBuilders.hasChildQuery(
+                            ESKeys.ES_ERP_PRINTBILL_LIFECYCLE_TYPE,
+                            QueryBuilders.boolQuery()
+                                    .must(QueryBuilders.termQuery("lifeNodeId", PrintBillLifeNode.outAssist.value))
+                                    .must(QueryBuilders.termQuery("lifeNodeState", 1)),
+                            ScoreMode.None)
+                    )
+                    .mustNot(JoinQueryBuilders.hasChildQuery(
+                            ESKeys.ES_ERP_PRINTBILL_LIFECYCLE_TYPE,
+                            QueryBuilders.boolQuery()
+                                    .must(QueryBuilders.termQuery("lifeNodeId", PrintBillLifeNode.outAssist.value))
+                                    .must(QueryBuilders.rangeQuery("lifeNodeState").gt(1)),
+                            ScoreMode.None)
+                    )
+        }
+    },
+    //待外协验收
+    A11{
+        QueryBuilder apply(boolean readCycle) {
+            return QueryBuilders.boolQuery()
+                    .must(JoinQueryBuilders.hasChildQuery(
+                            ESKeys.ES_ERP_PRINTBILL_LIFECYCLE_TYPE,
+                            QueryBuilders.boolQuery()
+                                    .must(QueryBuilders.termQuery("lifeNodeId", PrintBillLifeNode.outAssist.value))
+                                    .must(QueryBuilders.termQuery("lifeNodeState", 2)),
+                            ScoreMode.None)
+                    )
+                    .mustNot(JoinQueryBuilders.hasChildQuery(
+                            ESKeys.ES_ERP_PRINTBILL_LIFECYCLE_TYPE,
+                            QueryBuilders.boolQuery()
+                                    .must(QueryBuilders.termQuery("lifeNodeId", PrintBillLifeNode.outAssist.value))
+                                    .must(QueryBuilders.rangeQuery("lifeNodeState").gt(2)),
+                            ScoreMode.None)
+                    )
+        }
+    },
+
+    //已外协验收
+    A12{
+        QueryBuilder apply(boolean readCycle) {
+            return QueryBuilders.boolQuery()
+                    .must(JoinQueryBuilders.hasChildQuery(
+                            ESKeys.ESERPPRINTBILLLIFECYCLE_TYPE,
+                            QueryBuilders.boolQuery()
+                                    .must(QueryBuilders.termQuery("lifeNodeId", PrintBillLifeNode.outAssist.value))
+                                    .must(QueryBuilders.termQuery("lifeNodeState", 3)),
+                            ScoreMode.None)
+                    )
+                    .mustNot(JoinQueryBuilders.hasChildQuery(
+                            ESKeys.ESERPPRINTBILLLIFECYCLE_TYPE,
+                            QueryBuilders.boolQuery()
+                                    .must(QueryBuilders.termQuery("lifeNodeId", PrintBillLifeNode.complete.value))
+                                    .must(QueryBuilders.rangeQuery("lifeNodeState").gt(0)),
+                            ScoreMode.None)
+                    )
+        }
+    },
+    //待半成品反馈
+    A13{
+        QueryBuilder apply(boolean readCycle) {
+            return QueryBuilders.boolQuery()
+                    .must(JoinQueryBuilders.hasChildQuery(
+                            ESKeys.ESERPPRINTBILLLIFECYCLE_TYPE,
+                            QueryBuilders.boolQuery()
+                                    .must(QueryBuilders.termQuery("lifeNodeId", PrintBillLifeNode.printFeedback.value))
+                                    .must(QueryBuilders.rangeQuery("lifeNodeState").gt(0)),
+                            ScoreMode.None)
+                    )
+                    .mustNot(JoinQueryBuilders.hasChildQuery(
+                            ESKeys.ESERPPRINTBILLLIFECYCLE_TYPE,
+                            QueryBuilders.boolQuery()
+                                    .must(QueryBuilders.termQuery("lifeNodeId", PrintBillLifeNode.semiComplete.value))
+                                    .must(QueryBuilders.rangeQuery("lifeNodeState").gt(0)),
+                            ScoreMode.None)
+                    )
+        }
+    },
+    //生产完成
+    A14{
+        QueryBuilder apply(boolean readCycle) {
+            return QueryBuilders.boolQuery()
+                    .must(JoinQueryBuilders.hasChildQuery(
+                            ESKeys.ESERPPRINTBILLLIFECYCLE_TYPE,
+                            QueryBuilders.boolQuery()
+                                    .must(QueryBuilders.termQuery("lifeNodeId", PrintBillLifeNode.complete.value)),
+                            ScoreMode.None)
+                    )
+        }
+    };
+
+
+    abstract QueryBuilder apply(boolean readCycle);
+}

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

@@ -0,0 +1,150 @@
+import com.dderp.common.api.ESDataInfoExecutor
+import com.dderp.common.api.QueryBuilderExecutor
+import com.dderp.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.dderp.common.api.QueryBuilderExecutor
+import com.dderp.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.dderp.common.api.ESHitInfoExecutor
+import com.dderp.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)
+        }
+    }
+}

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

@@ -0,0 +1,62 @@
+import com.dderp.common.entity.order.OrderPart
+import com.dderp.common.entity.order.OrderPartParamValue
+import com.dderp.common.entity.product.PartParameter
+import com.dderp.common.entity.product.ProductInfo
+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 }
+                }
+            }
+        }
+
+        //下面的代码参考官网的元编程
+        OrderPart.metaClass {
+            quoteProduct = { ProductInfo product ->
+                delegate.metaClass.@"$product" = product
+                return delegate
+            }
+
+            quoteParameter = {String paramName ->
+                def orderPart = delegate as OrderPart
+
+                def productInfo = delegate.product as ProductInfo
+                def partInfo = productInfo.findPartInfo(orderPart.idPart)
+
+                PartParameter partParameter = partInfo.parameterList.find {(it.productParameter != null) && (StringUtils.equalsIgnoreCase(it.productParameter.parameterName, paramName)) }
+                if (partParameter == null) {
+                    return null
+                }
+
+                OrderPartParamValue orderPartParamValue = orderPart.paramValueList.find {it.idParameter == partParameter.idParameter}
+                if (orderPartParamValue == null) {
+                    return null
+                }
+
+                return orderPartParamValue
+            }
+
+            quoteParameterValue = {String paramName ->
+                def orderPart = delegate as OrderPart
+
+                OrderPartParamValue orderPartParamValue = orderPart.quoteParameter paramName
+                if (orderPartParamValue == null) {
+                    return null
+                }
+
+                return orderPartParamValue.paramValue
+            }
+        }
+    }
+}

+ 455 - 0
conf/script/1000/commons/OrderStatisticsQueryBuilder.groovy

@@ -0,0 +1,455 @@
+import com.dderp.common.datas.ESKeys
+import com.dderp.common.datas.OrderLifeCycleNode
+import com.dySweetFishPlugin.tool.lang.DateUtil
+import org.apache.lucene.search.join.ScoreMode
+import org.elasticsearch.index.query.BoolQueryBuilder
+import org.elasticsearch.index.query.InnerHitBuilder
+import org.elasticsearch.index.query.QueryBuilder
+import org.elasticsearch.index.query.QueryBuilders
+import org.elasticsearch.join.query.JoinQueryBuilders
+
+import java.time.Instant
+import java.time.LocalDate
+import java.time.ZoneId
+
+/**
+ * Created by jlutt on 2021-05-08
+ *
+ * @author jlutt
+ */
+
+enum OrderStatisticsQueryBuilder {
+
+    //待审核
+    A1{
+        QueryBuilder apply(List<Long> permissionIds, boolean checkPermission, boolean readCycle) {
+            BoolQueryBuilder q = QueryBuilders.boolQuery()
+                    .must(JoinQueryBuilders.hasChildQuery(
+                            ESKeys.ES_ERP_ORDER_LIFECYCLE_TYPE,
+                            QueryBuilders.boolQuery()
+                                    .must(QueryBuilders.termQuery("lifeNodeId", OrderLifeCycleNode.CREATE.getValue()))
+                                    .must(QueryBuilders.rangeQuery("lifeNodeState").gt(0))
+                                    .must(QueryBuilders.termQuery("voidMasterFlag", 0)),
+                            ScoreMode.None)
+                    )
+                    .mustNot(JoinQueryBuilders.hasChildQuery(
+                            ESKeys.ES_ERP_ORDER_LIFECYCLE_TYPE,
+                            QueryBuilders.boolQuery()
+                                    .must(QueryBuilders.rangeQuery("lifeNodeId").gt(OrderLifeCycleNode.CREATE.getValue()))
+                                    .must(QueryBuilders.rangeQuery("lifeNodeState").gt(0))
+                                    .must(QueryBuilders.termQuery("voidMasterFlag", 0)),
+                            ScoreMode.None)
+                    )
+            if (checkPermission) {
+                if ((permissionIds != null) && (!permissionIds.isEmpty())) {
+                    q = q.must(QueryBuilders.termsQuery("createBy", permissionIds.toArray()))
+                }
+            }
+            return q
+        }
+    },
+
+    //文件待处理
+    A2{
+        QueryBuilder apply(List<Long> permissionIds, boolean checkPermission, boolean readCycle) {
+            BoolQueryBuilder q = QueryBuilders.boolQuery()
+                    .must(JoinQueryBuilders.hasChildQuery(
+                            ESKeys.ES_ERP_ORDER_LIFECYCLE_TYPE,
+                            QueryBuilders.boolQuery()
+                                    .must(QueryBuilders.termQuery("lifeNodeId", OrderLifeCycleNode.VERIFY.getValue()))
+                                    .must(QueryBuilders.rangeQuery("lifeNodeState").gt(0))
+                                    .must(QueryBuilders.termQuery("voidMasterFlag", 0)),
+                            ScoreMode.None)
+                    )
+                    .mustNot(JoinQueryBuilders.hasChildQuery(
+                            ESKeys.ES_ERP_ORDER_LIFECYCLE_TYPE,
+                            QueryBuilders.boolQuery()
+                                    .must(QueryBuilders.termQuery("lifeNodeId", OrderLifeCycleNode.IMAGE_DESIGN.getValue()))
+                                    .must(QueryBuilders.rangeQuery("lifeNodeState").gt(0))
+                                    .must(QueryBuilders.termQuery("voidMasterFlag", 0)),
+                            ScoreMode.None)
+                    )
+            if (checkPermission) {
+                if ((permissionIds != null) && (!permissionIds.isEmpty())) {
+                    q = q.must(QueryBuilders.termsQuery("createBy", permissionIds.toArray()))
+                }
+            }
+            return q
+        }
+    },
+
+    //待组版
+    A3{
+        QueryBuilder apply(List<Long> permissionIds, boolean checkPermission, boolean readCycle) {
+            BoolQueryBuilder q = QueryBuilders.boolQuery()
+                    .must(JoinQueryBuilders.hasChildQuery(
+                            ESKeys.ES_ERP_ORDER_LIFECYCLE_TYPE,
+                            QueryBuilders.boolQuery()
+                                    .must(QueryBuilders.termQuery("lifeNodeId", OrderLifeCycleNode.VERIFY.getValue()))
+                                    .must(QueryBuilders.rangeQuery("lifeNodeState").gt(0))
+                                    .must(QueryBuilders.termQuery("voidMasterFlag", 0)),
+                            ScoreMode.None)
+                    )
+                    .mustNot(JoinQueryBuilders.hasChildQuery(
+                            ESKeys.ES_ERP_ORDER_LIFECYCLE_TYPE,
+                            QueryBuilders.boolQuery()
+                                    .must(QueryBuilders.termQuery("lifeNodeId", OrderLifeCycleNode.COMPOSE_PLATE.getValue()))
+                                    .must(QueryBuilders.rangeQuery("lifeNodeState").gt(0))
+                                    .must(QueryBuilders.termQuery("voidMasterFlag", 0)),
+                            ScoreMode.None)
+                    )
+            if (checkPermission) {
+                if ((permissionIds != null) && (!permissionIds.isEmpty())) {
+                    q = q.must(QueryBuilders.termsQuery("createBy", permissionIds.toArray()))
+                }
+            }
+            return q
+        }
+    },
+
+    //待排产
+    A4{
+        QueryBuilder apply(List<Long> permissionIds, boolean checkPermission, boolean readCycle) {
+            BoolQueryBuilder q = QueryBuilders.boolQuery()
+                    .must(JoinQueryBuilders.hasChildQuery(
+                            ESKeys.ES_ERP_ORDER_LIFECYCLE_TYPE,
+                            QueryBuilders.boolQuery()
+                                    .must(QueryBuilders.termQuery("lifeNodeId", OrderLifeCycleNode.TRANSMITTED.getValue()))
+                                    .must(QueryBuilders.rangeQuery("lifeNodeState").gt(0))
+//                                    .must(QueryBuilders.termQuery("lifeNodeId", OrderLifeCycleNode.COMPOSE_PLATE.getValue()))
+                                    .must(QueryBuilders.termQuery("voidMasterFlag", 0)),
+                            ScoreMode.None)
+                    )
+                    .mustNot(JoinQueryBuilders.hasChildQuery(
+                            ESKeys.ES_ERP_ORDER_LIFECYCLE_TYPE,
+                            QueryBuilders.boolQuery()
+                                    .must(QueryBuilders.termQuery("lifeNodeId", OrderLifeCycleNode.PLANNED.getValue()))
+                                    .must(QueryBuilders.rangeQuery("lifeNodeState").gt(0))
+                                    .must(QueryBuilders.termQuery("voidMasterFlag", 0)),
+                            ScoreMode.None)
+                    )
+
+            if (readCycle) {
+                q = q.must(JoinQueryBuilders.hasChildQuery(
+                        ESKeys.ES_ERP_ORDER_LIFECYCLE_TYPE,
+                        QueryBuilders.boolQuery()
+                                .must(QueryBuilders.termQuery("lifeNodeId", OrderLifeCycleNode.COMPOSE_PLATE.getValue()))
+                                .must(QueryBuilders.rangeQuery("lifeNodeState").gt(0))
+                                .must(QueryBuilders.termQuery("voidMasterFlag", 0)),
+                        ScoreMode.None).innerHit(new InnerHitBuilder().setSize(10000)))
+            }
+            if (checkPermission) {
+                if ((permissionIds != null) && (!permissionIds.isEmpty())) {
+                    q = q.must(QueryBuilders.termsQuery("createBy", permissionIds.toArray()))
+                }
+            }
+            return q
+        }
+    },
+
+    //待拼版
+    A5{
+        QueryBuilder apply(List<Long> permissionIds, boolean checkPermission, boolean readCycle) {
+            BoolQueryBuilder q = QueryBuilders.boolQuery()
+                    .must(JoinQueryBuilders.hasChildQuery(
+                            ESKeys.ES_ERP_ORDER_LIFECYCLE_TYPE,
+                            QueryBuilders.boolQuery()
+                                    .must(QueryBuilders.termQuery("lifeNodeId", OrderLifeCycleNode.TRANSMITTED.getValue()))
+                                    .must(QueryBuilders.rangeQuery("lifeNodeState").gt(0))
+                                    .must(QueryBuilders.termQuery("voidMasterFlag", 0)),
+                            ScoreMode.None)
+                    )
+                    .mustNot(JoinQueryBuilders.hasChildQuery(
+                            ESKeys.ES_ERP_ORDER_LIFECYCLE_TYPE,
+                            QueryBuilders.boolQuery()
+                                    .must(QueryBuilders.termQuery("lifeNodeId", OrderLifeCycleNode.PDF_PLATED.getValue()))
+                                    .must(QueryBuilders.rangeQuery("lifeNodeState").gt(0))
+                                    .must(QueryBuilders.termQuery("voidMasterFlag", 0)),
+                            ScoreMode.None)
+                    )
+            if (checkPermission) {
+                if ((permissionIds != null) && (!permissionIds.isEmpty())) {
+                    q = q.must(QueryBuilders.termsQuery("createBy", permissionIds.toArray()))
+                }
+            }
+            return q
+        }
+    },
+
+    A6{
+        QueryBuilder apply(List<Long> permissionIds, boolean checkPermission, boolean readCycle) {
+            BoolQueryBuilder q = QueryBuilders.boolQuery()
+                    .must(JoinQueryBuilders.hasChildQuery(
+                            ESKeys.ES_ERP_ORDER_LIFECYCLE_TYPE,
+                            QueryBuilders.boolQuery()
+                                    .must(QueryBuilders.termQuery("lifeNodeId", OrderLifeCycleNode.TRANSMITTED.getValue()))
+                                    .must(QueryBuilders.rangeQuery("lifeNodeState").gt(0))
+                                    .must(QueryBuilders.termQuery("voidMasterFlag", 0)),
+                            ScoreMode.None)
+                    )
+                    .mustNot(JoinQueryBuilders.hasChildQuery(
+                            ESKeys.ES_ERP_ORDER_LIFECYCLE_TYPE,
+                            QueryBuilders.boolQuery()
+                                    .must(QueryBuilders.termQuery("lifeNodeId", OrderLifeCycleNode.PS_MAKE.getValue()))
+                                    .must(QueryBuilders.rangeQuery("lifeNodeState").gt(0))
+                                    .must(QueryBuilders.termQuery("voidMasterFlag", 0)),
+                            ScoreMode.None)
+                    )
+            if (checkPermission) {
+                if ((permissionIds != null) && (!permissionIds.isEmpty())) {
+                    q = q.must(QueryBuilders.termsQuery("createBy", permissionIds.toArray()))
+                }
+            }
+            return q
+        }
+    },
+
+    A7{
+        QueryBuilder apply(List<Long> permissionIds, boolean checkPermission, boolean readCycle) {
+            BoolQueryBuilder q = QueryBuilders.boolQuery()
+                    .must(JoinQueryBuilders.hasChildQuery(
+                            ESKeys.ES_ERP_ORDER_LIFECYCLE_TYPE,
+                            QueryBuilders.boolQuery()
+                                    .must(QueryBuilders.termQuery("lifeNodeId", OrderLifeCycleNode.TRANSMITTED.getValue()))
+                                    .must(QueryBuilders.rangeQuery("lifeNodeState").gt(0))
+                                    .must(QueryBuilders.termQuery("voidMasterFlag", 0)),
+                            ScoreMode.None)
+                    )
+                    .mustNot(JoinQueryBuilders.hasChildQuery(
+                            ESKeys.ES_ERP_ORDER_LIFECYCLE_TYPE,
+                            QueryBuilders.boolQuery()
+                                    .must(QueryBuilders.termQuery("lifeNodeId", OrderLifeCycleNode.STOCK_IN.getValue()))
+                                    .must(QueryBuilders.rangeQuery("lifeNodeState").gt(0))
+                                    .must(QueryBuilders.termQuery("voidMasterFlag", 0)),
+                            ScoreMode.None)
+                    )
+            if (checkPermission) {
+                if ((permissionIds != null) && (!permissionIds.isEmpty())) {
+                    q = q.must(QueryBuilders.termsQuery("createBy", permissionIds.toArray()))
+                }
+            }
+            return q
+        }
+    },
+
+    A8{
+        QueryBuilder apply(List<Long> permissionIds, boolean checkPermission, boolean readCycle) {
+            BoolQueryBuilder q = QueryBuilders.boolQuery()
+                    .must(JoinQueryBuilders.hasChildQuery(
+                            ESKeys.ES_ERP_ORDER_LIFECYCLE_TYPE,
+                            QueryBuilders.boolQuery()
+                                    .must(QueryBuilders.termQuery("lifeNodeId", OrderLifeCycleNode.TRANSMITTED.getValue()))
+                                    .must(QueryBuilders.rangeQuery("lifeNodeState").gt(0))
+                                    .must(QueryBuilders.termQuery("voidMasterFlag", 0)),
+                            ScoreMode.None)
+                    )
+                    .mustNot(JoinQueryBuilders.hasChildQuery(
+                            ESKeys.ES_ERP_ORDER_LIFECYCLE_TYPE,
+                            QueryBuilders.boolQuery()
+                                    .must(QueryBuilders.termQuery("lifeNodeId", OrderLifeCycleNode.PRINTED.getValue()))
+                                    .must(QueryBuilders.rangeQuery("lifeNodeState").gt(0))
+                                    .must(QueryBuilders.termQuery("voidMasterFlag", 0)),
+                            ScoreMode.None)
+                    )
+            if (checkPermission) {
+                if ((permissionIds != null) && (!permissionIds.isEmpty())) {
+                    q = q.must(QueryBuilders.termsQuery("createBy", permissionIds.toArray()))
+                }
+            }
+            return q
+        }
+    },
+
+    A9{
+        QueryBuilder apply(List<Long> permissionIds, boolean checkPermission, boolean readCycle) {
+            BoolQueryBuilder q = QueryBuilders.boolQuery()
+                    .must(JoinQueryBuilders.hasChildQuery(
+                            ESKeys.ES_ERP_ORDER_LIFECYCLE_TYPE,
+                            QueryBuilders.boolQuery()
+                                    .must(QueryBuilders.termQuery("lifeNodeId", OrderLifeCycleNode.TRANSMITTED.getValue()))
+                                    .must(QueryBuilders.rangeQuery("lifeNodeState").gt(0))
+                                    .must(QueryBuilders.termQuery("voidMasterFlag", 0)),
+                            ScoreMode.None)
+                    )
+                    .mustNot(JoinQueryBuilders.hasChildQuery(
+                            ESKeys.ES_ERP_ORDER_LIFECYCLE_TYPE,
+                            QueryBuilders.boolQuery()
+                                    .must(QueryBuilders.termQuery("lifeNodeId", OrderLifeCycleNode.PREPARED.getValue()))
+                                    .must(QueryBuilders.termQuery("voidMasterFlag", 0)),
+                            ScoreMode.None)
+                    )
+            if (checkPermission) {
+                if ((permissionIds != null) && (!permissionIds.isEmpty())) {
+                    q = q.must(QueryBuilders.termsQuery("createBy", permissionIds.toArray()))
+                }
+            }
+            return q
+        }
+    },
+
+    A10{
+        QueryBuilder apply(List<Long> permissionIds, boolean checkPermission, boolean readCycle) {
+            BoolQueryBuilder q = QueryBuilders.boolQuery()
+                    .must(JoinQueryBuilders.hasChildQuery(
+                            ESKeys.ES_ERP_ORDER_LIFECYCLE_TYPE,
+                            QueryBuilders.boolQuery()
+                                    .must(QueryBuilders.termQuery("lifeNodeId", OrderLifeCycleNode.OUT_ASSIST_WAIT.getValue()))
+                                    .must(QueryBuilders.termQuery("voidMasterFlag", 0)),
+                            ScoreMode.None)
+                    )
+                    .mustNot(JoinQueryBuilders.hasChildQuery(
+                            ESKeys.ES_ERP_ORDER_LIFECYCLE_TYPE,
+                            QueryBuilders.boolQuery()
+                                    .must(QueryBuilders.termQuery("lifeNodeId", OrderLifeCycleNode.OUT_ASSIST_COMPLETED.getValue()))
+                                    .must(QueryBuilders.termQuery("voidMasterFlag", 0)),
+                            ScoreMode.None)
+                    )
+            if (checkPermission) {
+                if ((permissionIds != null) && (!permissionIds.isEmpty())) {
+                    q = q.must(QueryBuilders.termsQuery("createBy", permissionIds.toArray()))
+                }
+            }
+            return q
+        }
+    },
+
+    A11{
+        QueryBuilder apply(List<Long> permissionIds, boolean checkPermission, boolean readCycle) {
+            BoolQueryBuilder q = QueryBuilders.boolQuery()
+                    .must(JoinQueryBuilders.hasChildQuery(
+                            ESKeys.ES_ERP_ORDER_LIFECYCLE_TYPE,
+                            QueryBuilders.boolQuery()
+                                    .must(QueryBuilders.termQuery("lifeNodeId", OrderLifeCycleNode.VERIFY.getValue()))
+                                    .must(QueryBuilders.termQuery("voidMasterFlag", 0)),
+                            ScoreMode.None)
+                    )
+                    .mustNot(JoinQueryBuilders.hasChildQuery(
+                            ESKeys.ES_ERP_ORDER_LIFECYCLE_TYPE,
+                            QueryBuilders.boolQuery()
+                                    .must(QueryBuilders.termQuery("lifeNodeId", OrderLifeCycleNode.STOCK_IN.getValue()))
+                                    .must(QueryBuilders.termQuery("voidMasterFlag", 0)),
+                            ScoreMode.None)
+                    )
+            if (checkPermission) {
+                if ((permissionIds != null) && (!permissionIds.isEmpty())) {
+                    q = q.must(QueryBuilders.termsQuery("createBy", permissionIds.toArray()))
+                }
+            }
+            return q
+        }
+    },
+
+    A12{
+        QueryBuilder apply(List<Long> permissionIds, boolean checkPermission, boolean readCycle) {
+            BoolQueryBuilder q = QueryBuilders.boolQuery()
+                    .must(JoinQueryBuilders.hasChildQuery(
+                            ESKeys.ES_ERP_ORDER_LIFECYCLE_TYPE,
+                            QueryBuilders.boolQuery()
+                                    .must(QueryBuilders.termQuery("lifeNodeId", OrderLifeCycleNode.STOCK_IN.getValue()))
+                                    .must(QueryBuilders.termQuery("voidMasterFlag", 0)),
+                            ScoreMode.None)
+                    )
+                    .mustNot(JoinQueryBuilders.hasChildQuery(
+                            ESKeys.ES_ERP_ORDER_LIFECYCLE_TYPE,
+                            QueryBuilders.boolQuery()
+                                    .must(QueryBuilders.termQuery("lifeNodeId", OrderLifeCycleNode.SEND.getValue()))
+                                    .must(QueryBuilders.termQuery("voidMasterFlag", 0)),
+                            ScoreMode.None)
+                    )
+            if (checkPermission) {
+                if ((permissionIds != null) && (!permissionIds.isEmpty())) {
+                    q = q.must(QueryBuilders.termsQuery("createBy", permissionIds.toArray()))
+                }
+            }
+            return q
+        }
+    },
+
+    A13{
+        QueryBuilder apply(List<Long> permissionIds, boolean checkPermission, boolean readCycle) {
+            long lastStartTime = DateUtil.getStartOfDay(Date.from(LocalDate.now().plusDays(-1).atStartOfDay().atZone(ZoneId.systemDefault()).toInstant())).getTime()
+            long lastEndTime = DateUtil.getEndOfDay(Date.from(LocalDate.now().plusDays(-1).atStartOfDay().atZone(ZoneId.systemDefault()).toInstant())).getTime()
+            BoolQueryBuilder q = QueryBuilders.boolQuery()
+            if (readCycle) {
+                q = q.must(QueryBuilders.rangeQuery("createTimeLong").gte(lastStartTime).lte(lastEndTime))
+                        .should(JoinQueryBuilders.hasChildQuery(
+                                ESKeys.ES_ERP_ORDER_LIFECYCLE_TYPE,
+                                QueryBuilders.boolQuery()
+                                        .must(QueryBuilders.termQuery("lifeNodeId", OrderLifeCycleNode.COMPOSE_PLATE.getValue()))
+                                        .must(QueryBuilders.termQuery("voidMasterFlag", 0)),
+                                ScoreMode.None).innerHit(new InnerHitBuilder().setSize(10000)))
+            } else {
+                q = q.must(QueryBuilders.rangeQuery("createTimeLong").gte(lastStartTime).lte(lastEndTime))
+            }
+            if (checkPermission) {
+                if ((permissionIds != null) && (!permissionIds.isEmpty())) {
+                    q = q.must(QueryBuilders.termsQuery("createBy", permissionIds.toArray()))
+                }
+            }
+            return q
+        }
+    },
+
+    A14{
+        QueryBuilder apply(List<Long> permissionIds, boolean checkPermission, boolean readCycle) {
+            long curStartTime = DateUtil.getStartOfDay(Date.from(Instant.now())).getTime()
+            long curEndTime = DateUtil.getEndOfDay(Date.from(Instant.now())).getTime()
+            BoolQueryBuilder q = QueryBuilders.boolQuery()
+            if (readCycle) {
+                q = q.must(QueryBuilders.rangeQuery("createTimeLong").gte(curStartTime).lte(curEndTime))
+                        .should(JoinQueryBuilders.hasChildQuery(
+                                ESKeys.ES_ERP_ORDER_LIFECYCLE_TYPE,
+                                QueryBuilders.boolQuery()
+                                        .must(QueryBuilders.termQuery("lifeNodeId", OrderLifeCycleNode.COMPOSE_PLATE.getValue()))
+                                        .must(QueryBuilders.termQuery("voidMasterFlag", 0)),
+                                ScoreMode.None).innerHit(new InnerHitBuilder().setSize(10000)))
+            } else {
+                q = q.must(QueryBuilders.rangeQuery("createTimeLong").gte(curStartTime).lte(curEndTime))
+            }
+            if (checkPermission) {
+                if ((permissionIds != null) && (!permissionIds.isEmpty())) {
+                    q = q.must(QueryBuilders.termsQuery("createBy", permissionIds.toArray()))
+                }
+            }
+            return q
+        }
+    },
+
+    A15{
+        QueryBuilder apply(List<Long> permissionIds, boolean checkPermission, boolean readCycle) {
+            BoolQueryBuilder q = QueryBuilders.boolQuery()
+                    .must(JoinQueryBuilders.hasChildQuery(
+                            ESKeys.ES_ERP_ORDER_LIFECYCLE_TYPE,
+                            QueryBuilders.boolQuery()
+                                    .must(QueryBuilders.termQuery("lifeNodeId", OrderLifeCycleNode.CREATE.getValue()))
+                                    .must(QueryBuilders.termQuery("voidMasterFlag", 0)),
+                            ScoreMode.None)
+                    )
+                    .mustNot(JoinQueryBuilders.hasChildQuery(
+                            ESKeys.ES_ERP_ORDER_LIFECYCLE_TYPE,
+                            QueryBuilders.boolQuery()
+                                    .must(QueryBuilders.termQuery("lifeNodeId", OrderLifeCycleNode.SEND.getValue()))
+                                    .must(QueryBuilders.termQuery("voidMasterFlag", 0)),
+                            ScoreMode.None)
+                    )
+
+            if (readCycle) {
+                q = q.should(JoinQueryBuilders.hasChildQuery(
+                        ESKeys.ES_ERP_ORDER_LIFECYCLE_TYPE,
+                        QueryBuilders.boolQuery()
+                                .must(QueryBuilders.termQuery("lifeNodeId", OrderLifeCycleNode.COMPOSE_PLATE.getValue()))
+                                .must(QueryBuilders.termQuery("voidMasterFlag", 0)),
+                        ScoreMode.None).innerHit(new InnerHitBuilder().setSize(10000)))
+            }
+            if (checkPermission) {
+                if ((permissionIds != null) && (!permissionIds.isEmpty())) {
+                    q = q.must(QueryBuilders.termsQuery("createBy", permissionIds.toArray()))
+                }
+            }
+            return q
+        }
+    };
+
+
+    abstract QueryBuilder apply(List<Long> permissionIds, boolean checkPermission, boolean readCycle);
+}

+ 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()

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


Kaikkia tiedostoja ei voida näyttää, sillä liian monta tiedostoa muuttui tässä diffissä