浏览代码

用户退款申请
订单售后单

Veronique 2 年之前
父节点
当前提交
64a2bb7d95
共有 39 个文件被更改,包括 1433 次插入402 次删除
  1. 13 0
      conf/KeyCode.xml
  2. 18 0
      conf/KeyId.xml
  3. 4 1
      conf/esTemplate/businessorder.json
  4. 101 0
      conf/esTemplate/orderaftersalebill.json
  5. 4 0
      conf/esTemplate/orderdetailitem.json
  6. 3 0
      conf/esTemplate/orderfinances.json
  7. 78 0
      conf/esTemplate/orderrefundrequest.json
  8. 2 0
      conf/eskeys.properties
  9. 6 1
      conf/script/1000/init/Init_16_BusinessOrder.groovy
  10. 4 9
      conf/script/1000/orderApi/BE_Order_AcceptOrder_Douyin.groovy
  11. 0 11
      conf/script/1000/orderApi/BE_Order_AcceptOrder_Request.groovy
  12. 201 0
      conf/script/1000/orderApi/BE_Order_CancelOrder_DYLK.groovy
  13. 5 4
      conf/script/1000/orderApi/BE_Order_CreateOrder_Douyin.groovy
  14. 201 0
      conf/script/1000/orderApi/BE_Order_RejectOrder_DYLK.groovy
  15. 1 11
      conf/script/1000/orderApi/BE_Order_RejectOrder_Request.groovy
  16. 11 69
      conf/script/1000/orderApi/BE_Order_CancelOrder.groovy
  17. 17 20
      conf/script/1000/orderApi/BE_Order_RejectOrder_Douyin.groovy
  18. 0 0
      conf/script/1000/scriptFiles/refundOrderReasonIn_DYLK.json
  19. 0 0
      conf/script/1000/scriptFiles/rejectOrderReasonIn_DYLK.json
  20. 21 0
      conf/script/1000/scriptFiles/voidApplySourceIn_DYLK.json
  21. 22 19
      conf/sqlroot/com/dderp/business/dao/OrderDao.dql
  22. 87 113
      conf/初始化业务表.sql
  23. 5 4
      ddBusiness/src/main/java/com/dderp/business/dao/OrderDao.java
  24. 1 1
      ddBusiness/src/main/java/com/dderp/business/service/PlatformServiceImpl.java
  25. 7 89
      ddBusiness/src/main/java/com/dderp/business/service/StoreServiceImpl.java
  26. 0 1
      ddCommon/src/main/java/com/dderp/common/api/StoreService.java
  27. 6 0
      ddCommon/src/main/java/com/dderp/common/datas/ESKeys.java
  28. 3 0
      ddCommon/src/main/java/com/dderp/common/datas/ReadOrderOption.java
  29. 1 1
      ddCommon/src/main/java/com/dderp/common/datas/BusinessOrderStatus.java
  30. 1 1
      ddCommon/src/main/java/com/dderp/common/datas/business/PlatformType.java
  31. 43 0
      ddCommon/src/main/java/com/dderp/common/datas/flycat/RefundRequestStatus.java
  32. 35 20
      ddCommon/src/main/java/com/dderp/common/entity/order/BusinessOrder.java
  33. 227 0
      ddCommon/src/main/java/com/dderp/common/entity/order/OrderAfterSaleBill.java
  34. 14 0
      ddCommon/src/main/java/com/dderp/common/entity/order/OrderDetailItem.java
  35. 12 0
      ddCommon/src/main/java/com/dderp/common/entity/order/OrderFinances.java
  36. 217 0
      ddCommon/src/main/java/com/dderp/common/entity/order/OrderRefundRequest.java
  37. 4 3
      ddCommon/src/main/java/com/dderp/common/entity/store/ViewStoreInfo.java
  38. 0 21
      ddWebCore/src/main/java/com/dderp/webcore/rest/StoreRest.java
  39. 58 3
      ddWebCore/src/main/java/com/dderp/webcore/servlet/OrderCallServlet.java

+ 13 - 0
conf/KeyCode.xml

@@ -64,4 +64,17 @@
         <CodeLength>4</CodeLength>
         <CodeLength>4</CodeLength>
         <TableWhere/>
         <TableWhere/>
     </Item>
     </Item>
+
+    <Item>
+        <CodeName>deOrderAfterSaleBill.code</CodeName>
+        <TableName>v_deOrderAfterSaleBill</TableName>
+        <CodeFieldName>billCode</CodeFieldName>
+        <CodePrefix>AS</CodePrefix>
+        <CodeYear>true</CodeYear>
+        <YearLength>4</YearLength>
+        <CodeMonth>true</CodeMonth>
+        <CodeDay>true</CodeDay>
+        <CodeLength>4</CodeLength>
+        <TableWhere/>
+    </Item>
 </Items>
 </Items>

+ 18 - 0
conf/KeyId.xml

@@ -388,4 +388,22 @@
             <TableWhere/>
             <TableWhere/>
         </Table>
         </Table>
     </Item>
     </Item>
+
+    <Item>
+        <IDName>deOrderAfterSaleBill.id</IDName>
+        <Table>
+            <TableName>v_deorderaftersalebill</TableName>
+            <IDFieldName>id</IDFieldName>
+            <TableWhere/>
+        </Table>
+    </Item>
+
+    <Item>
+        <IDName>deOrderRefundRequest.id</IDName>
+        <Table>
+            <TableName>v_deorderrefundrequest</TableName>
+            <IDFieldName>id</IDFieldName>
+            <TableWhere/>
+        </Table>
+    </Item>
 </Items>
 </Items>

+ 4 - 1
conf/esTemplate/businessorder.json

@@ -103,7 +103,10 @@
         "type": "text",
         "type": "text",
         "index": "not_analyzed"
         "index": "not_analyzed"
       },
       },
-      "voidFlag": {
+      "voidFlagIn": {
+        "type": "integer"
+      },
+      "voidFlagOut": {
         "type": "integer"
         "type": "integer"
       },
       },
       "createBy": {
       "createBy": {

+ 101 - 0
conf/esTemplate/orderaftersalebill.json

@@ -0,0 +1,101 @@
+{
+  "orderaftersalebill": {
+    "_parent": {
+      "type": "info"
+    },
+    "properties": {
+      "id": {
+        "type": "long"
+      },
+      "idOrder": {
+        "type": "long"
+      },
+      "idStore": {
+        "type": "long"
+      },
+      "billCode": {
+        "type": "text",
+        "index": "analyzed",
+        "analyzer": "codefull_analyzer",
+        "fields": {
+          "raw": {
+            "type": "keyword"
+          }
+        }
+      },
+      "outPlatformStoreId": {
+        "type": "text",
+        "index": "analyzed",
+        "analyzer": "codefull_analyzer",
+        "fields": {
+          "raw": {
+            "type": "keyword"
+          }
+        }
+      },
+      "idStorePlatform": {
+        "type": "long"
+      },
+      "platformCode": {
+        "type": "text",
+        "index": "analyzed",
+        "analyzer": "codefull_analyzer",
+        "fields": {
+          "raw": {
+            "type": "keyword"
+          }
+        }
+      },
+      "platformType": {
+        "type": "integer"
+      },
+      "platformName": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "outAfterSaleId": {
+        "type": "text",
+        "index": "analyzed",
+        "analyzer": "codefull_analyzer",
+        "fields": {
+          "raw": {
+            "type": "keyword"
+          }
+        }
+      },
+      "applySource": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "userRefundAmount": {
+        "type": "integer"
+      },
+      "totalUserRefundAmount": {
+        "type": "integer"
+      },
+      "prodCountAfterRefund": {
+        "type": "integer"
+      },
+      "productsRemainDetail": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "productsRefundDetail": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "createBy": {
+        "type": "long"
+      },
+      "createTimeLong": {
+        "type": "long"
+      },
+      "updateBy": {
+        "type": "long"
+      },
+      "updateTimeLong": {
+        "type": "long"
+      }
+    }
+  }
+}

+ 4 - 0
conf/esTemplate/orderdetailitem.json

@@ -23,6 +23,10 @@
       "itemMoney": {
       "itemMoney": {
         "type": "double"
         "type": "double"
       },
       },
+      "itemDetail": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
       "createBy": {
       "createBy": {
         "type": "long"
         "type": "long"
       },
       },

+ 3 - 0
conf/esTemplate/orderfinances.json

@@ -31,6 +31,9 @@
       "storeRealCollection": {
       "storeRealCollection": {
         "type": "double"
         "type": "double"
       },
       },
+      "omeServiceFee": {
+        "type": "double"
+      },
       "createBy": {
       "createBy": {
         "type": "long"
         "type": "long"
       },
       },

+ 78 - 0
conf/esTemplate/orderrefundrequest.json

@@ -0,0 +1,78 @@
+{
+  "info": {
+    "properties": {
+      "id": {
+        "type": "long"
+      },
+      "idOrder": {
+        "type": "long"
+      },
+      "idStore": {
+        "type": "long"
+      },
+      "outPlatformStoreId": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "idStorePlatform": {
+        "type": "long"
+      },
+      "platformCode": {
+        "type": "text",
+        "index": "analyzed",
+        "analyzer": "codefull_analyzer",
+        "fields": {
+          "raw": {
+            "type": "keyword"
+          }
+        }
+      },
+      "platformType": {
+        "type": "integer"
+      },
+      "platformName": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "outAfterSaleId": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "requestStatus": {
+        "type": "integer"
+      },
+      "userRefundMemo": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "refundType": {
+        "type": "integer"
+      },
+      "deliveryFee": {
+        "type": "integer"
+      },
+      "refundFee": {
+        "type": "integer"
+      },
+      "refundProdCount": {
+        "type": "integer"
+      },
+      "refundProductsDetail": {
+        "type": "text",
+        "index": "not_analyzed"
+      },
+      "createBy": {
+        "type": "long"
+      },
+      "createTimeLong": {
+        "type": "long"
+      },
+      "updateBy": {
+        "type": "long"
+      },
+      "updateTimeLong": {
+        "type": "long"
+      }
+    }
+  }
+}

+ 2 - 0
conf/eskeys.properties

@@ -70,4 +70,6 @@ es.storeplatform.index = dydeliver_storeplatform_
 es.businesorder.index = dydeliver_businessorder_
 es.businesorder.index = dydeliver_businessorder_
 #订单脚印
 #订单脚印
 es.orderstep.index = dydeliver_orderstep_
 es.orderstep.index = dydeliver_orderstep_
+#订单退款申请
+es.refundorderrequest.index = dydeliver_refundorderrequest_
 
 

+ 6 - 1
conf/script/1000/init/Init_16_BusinessOrder.groovy

@@ -15,12 +15,17 @@ static def createRunnable(ESClient esClient, RedisService redisService, Supplier
                 Utility.ofMap(ESKeys.ES_DELIVER_BUSINESS_ORDER_TYPE, "businessorder.json",
                 Utility.ofMap(ESKeys.ES_DELIVER_BUSINESS_ORDER_TYPE, "businessorder.json",
                         ESKeys.ES_DELIVER_ORDER_DELIVERY_INFO_TYPE, "orderdeliveryinfo.json",
                         ESKeys.ES_DELIVER_ORDER_DELIVERY_INFO_TYPE, "orderdeliveryinfo.json",
                         ESKeys.ES_DELIVER_ORDER_FINANCES_TYPE, "orderfinances.json",
                         ESKeys.ES_DELIVER_ORDER_FINANCES_TYPE, "orderfinances.json",
-                        ESKeys.ES_DELIVER_ORDER_DETAIL_ITEM_TYPE, "orderdetailitem.json"))
+                        ESKeys.ES_DELIVER_ORDER_DETAIL_ITEM_TYPE, "orderdetailitem.json",
+                        ESKeys.ES_DELIVER_ORDER_AFTER_SALE_BILL_TYPE, "orderaftersalebill.json"))
 
 
         esClient.checkIndexEx(supplierService.getDateYearESIndex(supplierCode, ESKeys.ES_DELIVER_ORDER_STEP_INDEX, 0),
         esClient.checkIndexEx(supplierService.getDateYearESIndex(supplierCode, ESKeys.ES_DELIVER_ORDER_STEP_INDEX, 0),
                 ESKeys.INDEX_CONFIG,
                 ESKeys.INDEX_CONFIG,
                 Utility.ofMap(ESKeys.ES_DELIVER_ORDER_STEP_TYPE, "orderStep.json"))
                 Utility.ofMap(ESKeys.ES_DELIVER_ORDER_STEP_TYPE, "orderStep.json"))
 
 
+        esClient.checkIndexEx(supplierService.getDateYearESIndex(supplierCode, ESKeys.ES_DELIVER_REFUND_ORDER_REQUEST_INDEX, 0),
+                ESKeys.INDEX_CONFIG,
+                Utility.ofMap(ESKeys.ES_DELIVER_REFUND_ORDER_REQUEST_TYPE, "orderrefundrequest.json"))
+
     } as Runnable
     } as Runnable
 }
 }
 
 

+ 4 - 9
conf/script/1000/orderApi/BE_Order_AcceptOrder_Douyin.groovy

@@ -6,19 +6,15 @@ import com.dderp.common.api.flycat.DouyinService
 import com.dderp.common.api.flycat.OrderSearchService
 import com.dderp.common.api.flycat.OrderSearchService
 import com.dderp.common.api.flycat.OrderService
 import com.dderp.common.api.flycat.OrderService
 import com.dderp.common.api.flycat.OrderStepService
 import com.dderp.common.api.flycat.OrderStepService
-import com.dderp.common.datas.BusinessOrderStatus
+import com.dderp.common.datas.flycat.BusinessOrderStatus
 import com.dderp.common.datas.ERPModule
 import com.dderp.common.datas.ERPModule
 import com.dderp.common.datas.ESKeys
 import com.dderp.common.datas.ESKeys
-import com.dderp.common.datas.ReadOrderOption
-import com.dderp.common.datas.business.PlatformType
+import com.dderp.common.datas.flycat.PlatformType
 import com.dderp.common.entity.base.InvokeCallParams
 import com.dderp.common.entity.base.InvokeCallParams
 import com.dderp.common.entity.base.InvokeCallResult
 import com.dderp.common.entity.base.InvokeCallResult
-import com.dderp.common.entity.base.ProcessStringItem
-import com.dderp.common.entity.geo.GeoPoiLocation
 import com.dderp.common.entity.order.*
 import com.dderp.common.entity.order.*
 import com.dderp.common.entity.site.ERPTokenUser
 import com.dderp.common.entity.site.ERPTokenUser
 import com.dderp.common.entity.store.StorePlatform
 import com.dderp.common.entity.store.StorePlatform
-import com.dderp.common.entity.store.ViewStoreInfo
 import com.dySweetFishPlugin.elasticsearch.ESClient
 import com.dySweetFishPlugin.elasticsearch.ESClient
 import com.dySweetFishPlugin.sql.TableIdService
 import com.dySweetFishPlugin.sql.TableIdService
 import com.dySweetFishPlugin.sql.dao.TunaService
 import com.dySweetFishPlugin.sql.dao.TunaService
@@ -36,14 +32,13 @@ import org.elasticsearch.common.xcontent.XContentType
 import org.rex.RMap
 import org.rex.RMap
 
 
 import javax.annotation.Resource
 import javax.annotation.Resource
-import java.math.RoundingMode
 import java.time.LocalDateTime
 import java.time.LocalDateTime
 import java.time.ZoneOffset
 import java.time.ZoneOffset
 
 
 import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder
 import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder
 
 
 @SuppressWarnings("unused")
 @SuppressWarnings("unused")
-class BE_Order_AcceptOrder_Douyin implements BusinessExecutor<InvokeCallParams, InvokeCallResult> {
+class BE_Order_AcceptOrder_DYLK implements BusinessExecutor<InvokeCallParams, InvokeCallResult> {
 
 
     private final Logger logger = LogManager.getLogger(this.getClass().getSimpleName())
     private final Logger logger = LogManager.getLogger(this.getClass().getSimpleName())
 
 
@@ -81,7 +76,7 @@ class BE_Order_AcceptOrder_Douyin implements BusinessExecutor<InvokeCallParams,
 
 
     @Override
     @Override
     String scriptName() {
     String scriptName() {
-        return "订单商户接单"
+        return "[抖音来客]商户接单"
     }
     }
 
 
     @Override
     @Override

+ 0 - 11
conf/script/1000/orderApi/BE_Order_AcceptOrder_Request.groovy

@@ -6,13 +6,10 @@ import com.dderp.common.api.flycat.DouyinService
 import com.dderp.common.api.flycat.OrderSearchService
 import com.dderp.common.api.flycat.OrderSearchService
 import com.dderp.common.api.flycat.OrderService
 import com.dderp.common.api.flycat.OrderService
 import com.dderp.common.api.flycat.OrderStepService
 import com.dderp.common.api.flycat.OrderStepService
-import com.dderp.common.datas.BusinessOrderStatus
 import com.dderp.common.datas.ERPModule
 import com.dderp.common.datas.ERPModule
-import com.dderp.common.datas.ESKeys
 import com.dderp.common.entity.base.InvokeCallParams
 import com.dderp.common.entity.base.InvokeCallParams
 import com.dderp.common.entity.base.InvokeCallResult
 import com.dderp.common.entity.base.InvokeCallResult
 import com.dderp.common.entity.order.BusinessOrder
 import com.dderp.common.entity.order.BusinessOrder
-import com.dderp.common.entity.order.OrderStep
 import com.dderp.common.entity.site.ERPTokenUser
 import com.dderp.common.entity.site.ERPTokenUser
 import com.dderp.common.entity.store.StorePlatform
 import com.dderp.common.entity.store.StorePlatform
 import com.dySweetFishPlugin.elasticsearch.ESClient
 import com.dySweetFishPlugin.elasticsearch.ESClient
@@ -23,19 +20,11 @@ import com.sweetfish.service.RetResult
 import groovy.json.JsonSlurper
 import groovy.json.JsonSlurper
 import org.apache.logging.log4j.LogManager
 import org.apache.logging.log4j.LogManager
 import org.apache.logging.log4j.Logger
 import org.apache.logging.log4j.Logger
-import org.elasticsearch.action.bulk.BulkRequestBuilder
-import org.elasticsearch.action.bulk.BulkResponse
-import org.elasticsearch.action.index.IndexRequestBuilder
-import org.elasticsearch.action.support.WriteRequest
-import org.elasticsearch.action.update.UpdateRequestBuilder
-import org.elasticsearch.common.xcontent.XContentType
 
 
 import javax.annotation.Resource
 import javax.annotation.Resource
 import java.time.LocalDateTime
 import java.time.LocalDateTime
 import java.time.ZoneOffset
 import java.time.ZoneOffset
 
 
-import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder
-
 @SuppressWarnings("unused")
 @SuppressWarnings("unused")
 class BE_Order_AcceptOrder_Request implements BusinessExecutor<InvokeCallParams, InvokeCallResult> {
 class BE_Order_AcceptOrder_Request implements BusinessExecutor<InvokeCallParams, InvokeCallResult> {
 
 

+ 201 - 0
conf/script/1000/orderApi/BE_Order_CancelOrder_DYLK.groovy

@@ -0,0 +1,201 @@
+import com.dderp.business.dao.OrderDao
+import com.dderp.common.api.BusinessExecutor
+import com.dderp.common.api.StoreService
+import com.dderp.common.api.SupplierInitService
+import com.dderp.common.api.flycat.DouyinService
+import com.dderp.common.api.flycat.OrderSearchService
+import com.dderp.common.api.flycat.OrderService
+import com.dderp.common.api.flycat.OrderStepService
+import com.dderp.common.datas.ERPModule
+import com.dderp.common.datas.ESKeys
+import com.dderp.common.datas.ReadOrderOption
+import com.dderp.common.datas.flycat.PlatformType
+import com.dderp.common.entity.base.InvokeCallParams
+import com.dderp.common.entity.base.InvokeCallResult
+import com.dderp.common.entity.order.BusinessOrder
+import com.dderp.common.entity.order.OrderAfterSaleBill
+import com.dderp.common.entity.order.OrderFinances
+import com.dderp.common.entity.order.OrderStep
+import com.dderp.common.entity.site.ERPTokenUser
+import com.dderp.common.entity.store.StorePlatform
+import com.dySweetFishPlugin.elasticsearch.ESClient
+import com.dySweetFishPlugin.sql.TableIdService
+import com.dySweetFishPlugin.sql.dao.TunaService
+import com.sweetfish.convert.json.JsonConvert
+import com.sweetfish.service.RetResult
+import groovy.json.JsonSlurper
+import org.apache.logging.log4j.LogManager
+import org.apache.logging.log4j.Logger
+import org.elasticsearch.action.bulk.BulkRequestBuilder
+import org.elasticsearch.action.bulk.BulkResponse
+import org.elasticsearch.action.index.IndexRequestBuilder
+import org.elasticsearch.action.support.WriteRequest
+import org.elasticsearch.action.update.UpdateRequestBuilder
+import org.elasticsearch.common.xcontent.XContentType
+import org.rex.RMap
+
+import javax.annotation.Resource
+import java.time.LocalDateTime
+import java.time.ZoneOffset
+
+import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder
+
+@SuppressWarnings("unused")
+class BE_Order_CancelOrder_DYLK implements BusinessExecutor<InvokeCallParams, InvokeCallResult> {
+
+    private final Logger logger = LogManager.getLogger(this.getClass().getSimpleName())
+
+    @Resource
+    private JsonConvert jsonConvert
+
+    @Resource
+    private TableIdService tableIdService
+
+    @Resource
+    private StoreService storeService
+
+    @Resource
+    private ESClient esClient
+
+    @Resource
+    private SupplierInitService supplierInitService
+
+    @Resource
+    private OrderStepService orderStepService
+
+    @Resource
+    private OrderService orderService
+
+    @Resource
+    private OrderSearchService orderSearchService
+
+    @Resource
+    private DouyinService douyinService
+
+    @Resource(name = "APP_HOME")
+    private String appHome
+
+    @Resource
+    private TunaService tunaService
+
+    private OrderDao orderDao
+
+    @Override
+    String scriptName() {
+        return "[抖音来客]取消订单"
+    }
+
+    @Override
+    ERPModule module() {
+        return ERPModule.ORDER_API
+    }
+
+    @Override
+    RetResult<InvokeCallParams> beforeExecute(InvokeCallParams source) {
+        return super.beforeExecute(source)
+    }
+    //params:{order_id:平台订单code, poi_id:平台门店id, after_sale_id:退款id, apply_source:"申请来源"}
+    RetResult<InvokeCallResult> execute(InvokeCallParams source) {
+        //秒级时间戳,groovy里面不让用system
+        long currentTime = LocalDateTime.now().toEpochSecond(ZoneOffset.ofHours(8))
+        String dataSourceId = source.dataSourceId
+        long supplierCode = source.supplierCode
+        ERPTokenUser currentUser = source.currentUser
+
+        def jsonSlurper = new JsonSlurper()
+        def invokeOrder = jsonSlurper.parseText(source.params)
+        String incomePlatformOrderCode = invokeOrder["order_id"] as String
+        String platformStoreId = invokeOrder["poi_id"] as String
+
+        StorePlatform storePlatform = storeService.getStorePlatformByInvokeInfo(platformStoreId, "DYLK", PlatformType.order.value, supplierCode)
+        if (storePlatform == null) return RetResult.<InvokeCallResult> errorT().retinfo("订单来源平台未知!")
+
+        RMap searchParams = new RMap();
+        searchParams.set("incomePlatformId", platformStoreId)
+        searchParams.set("incomePlatformOrderCode", incomePlatformOrderCode)
+
+        RetResult<List<BusinessOrder>> orderResult = orderSearchService.searchBusinessOrderList(searchParams, currentUser,
+                dataSourceId, supplierCode, ReadOrderOption.ORDER_PRODUCT, ReadOrderOption.ORDER_FINANCES)
+        if (!orderResult.isSuccess()) return RetResult.<InvokeCallResult> errorT().retinfo(orderResult.retinfo)
+
+        BusinessOrder esOrder = orderResult.result.get(0) //这么查只可能有一个
+        OrderFinances orderFinances = esOrder.orderFinances
+
+        esOrder.setVoidFlagIn(100)
+        BusinessOrder.update(esOrder, currentUser.id)
+
+        OrderStep orderStep = orderStepService.parseOrderStep(esOrder.id, 0,
+                "[" + storePlatform.platformName + "]订单取消: " + invokeOrder["apply_source"], storePlatform.platformCode, currentUser)
+
+        OrderAfterSaleBill afterSaleBill = new OrderAfterSaleBill()
+        afterSaleBill.setId(tableIdService.getTableIdMulti("deOrderAfterSaleBill.id", 1, dataSourceId, String.valueOf(supplierCode)))
+        afterSaleBill.setIdOrder(esOrder.id)
+        afterSaleBill.setIdStorePlatform(storePlatform.id)
+        afterSaleBill.setIdStore(storePlatform.idStore)
+        afterSaleBill.setOutPlatformStoreId(storePlatform.platformStoreId)
+        afterSaleBill.setPlatformCode(storePlatform.platformCode)
+        afterSaleBill.setPlatformType(storePlatform.platformType)
+        afterSaleBill.setPlatformName(storePlatform.platformName)
+        afterSaleBill.setBillCode(tableIdService.getTableCodeMulti("deOrderAfterSaleBill.code", dataSourceId, String.valueOf(supplierCode)))
+        afterSaleBill.setApplySource(invokeOrder["apply_source"] as String)
+        afterSaleBill.setFullRefunded(true)
+        afterSaleBill.setUserRefundAmount((orderFinances.customerPaid * 100).intValue())
+        afterSaleBill.setTotalUserRefundAmount((orderFinances.customerPaid * 100).intValue())
+        afterSaleBill.setProdCountAfterRefund(0)
+        afterSaleBill.setProductsRemainDetail("")
+        afterSaleBill.setProductsRefundDetail(jsonConvert.convertTo(esOrder.detailItemList))
+        OrderAfterSaleBill.create(afterSaleBill, currentUser.id)
+
+        //持久化
+        //订单主表
+        BulkRequestBuilder bulkRequest = esClient.getClient().prepareBulk().setRefreshPolicy(WriteRequest.RefreshPolicy.IMMEDIATE)
+
+        UpdateRequestBuilder orderRequest = esClient.getClient().prepareUpdate(
+                supplierInitService.getDateYearESIndex(supplierCode, ESKeys.ES_DELIVER_BUSINESS_ORDER_INDEX, 0),
+                ESKeys.ES_DELIVER_BUSINESS_ORDER_TYPE,
+                String.valueOf(esOrder.getId()))
+                .setDoc(jsonBuilder()
+                        .startObject()
+                        .field("voidFlagIn", esOrder.voidFlagIn)
+                        .field("updateBy", esOrder.getUpdateBy())
+                        .field("updateTimeLong", esOrder.getUpdateTimeLong())
+                        .endObject())
+        bulkRequest.add(orderRequest)
+
+        //订单售后单
+        IndexRequestBuilder orderAfterBillRequest = esClient.getClient()
+                .prepareIndex(supplierInitService.getDateYearESIndex(supplierCode, ESKeys.ES_DELIVER_BUSINESS_ORDER_INDEX, 0),
+                        ESKeys.ES_DELIVER_ORDER_AFTER_SALE_BILL_TYPE)
+                .setId(String.valueOf(afterSaleBill.id))
+                .setParent(String.valueOf(afterSaleBill.idOrder))
+                .setSource(jsonConvert.convertTo(afterSaleBill), XContentType.JSON)
+        bulkRequest.add(orderAfterBillRequest)
+
+        //订单脚印
+        IndexRequestBuilder orderStepRequest = esClient.getClient()
+                .prepareIndex(supplierInitService.getDateYearESIndex(supplierCode, ESKeys.ES_DELIVER_ORDER_STEP_INDEX, 0),
+                        ESKeys.ES_DELIVER_ORDER_STEP_TYPE)
+                .setId(String.valueOf(orderStep.id))
+                .setSource(jsonConvert.convertTo(orderStep), XContentType.JSON)
+        bulkRequest.add(orderStepRequest)
+
+
+        BulkResponse bulkResponse = bulkRequest.get();
+        orderDao = tunaService.generate(OrderDao.class)
+        if (bulkResponse.hasFailures()) {
+            logger.error("订单取消出错:" + bulkResponse.buildFailureMessage());
+            return RetResult.<InvokeCallResult> errorT().retinfo("订单取消出错:" + esOrder.orderName);
+        } else {
+            logger.info("订单取消成功");
+            //写数据库
+            orderDao.voidBusinessOrderIn(esOrder,
+                    afterSaleBill,
+                    [orderStep],
+                    dataSourceId,
+                    String.valueOf(supplierCode))
+
+
+            return RetResult.<InvokeCallResult> successT().result(InvokeCallResult.success().data(jsonConvert.convertTo(esOrder)))
+        }
+    }
+}

+ 5 - 4
conf/script/1000/orderApi/BE_Order_CreateOrder_Douyin.groovy

@@ -4,10 +4,10 @@ import com.dderp.common.api.StoreService
 import com.dderp.common.api.SupplierInitService
 import com.dderp.common.api.SupplierInitService
 import com.dderp.common.api.flycat.OrderService
 import com.dderp.common.api.flycat.OrderService
 import com.dderp.common.api.flycat.OrderStepService
 import com.dderp.common.api.flycat.OrderStepService
-import com.dderp.common.datas.BusinessOrderStatus
+import com.dderp.common.datas.flycat.BusinessOrderStatus
 import com.dderp.common.datas.ERPModule
 import com.dderp.common.datas.ERPModule
 import com.dderp.common.datas.ESKeys
 import com.dderp.common.datas.ESKeys
-import com.dderp.common.datas.business.PlatformType
+import com.dderp.common.datas.flycat.PlatformType
 import com.dderp.common.entity.base.ProcessStringItem
 import com.dderp.common.entity.base.ProcessStringItem
 import com.dderp.common.entity.geo.GeoPoiLocation
 import com.dderp.common.entity.geo.GeoPoiLocation
 import com.dderp.common.entity.order.BusinessOrder
 import com.dderp.common.entity.order.BusinessOrder
@@ -38,7 +38,7 @@ import java.time.LocalDateTime
 import java.time.ZoneOffset
 import java.time.ZoneOffset
 
 
 @SuppressWarnings("unused")
 @SuppressWarnings("unused")
-class BE_Order_CreateOrder_Douyin implements BusinessExecutor<ProcessStringItem, BusinessOrder> {
+class BE_Order_CreateOrder_DYLK implements BusinessExecutor<ProcessStringItem, BusinessOrder> {
 
 
     private final Logger logger = LogManager.getLogger(this.getClass().getSimpleName())
     private final Logger logger = LogManager.getLogger(this.getClass().getSimpleName())
 
 
@@ -70,7 +70,7 @@ class BE_Order_CreateOrder_Douyin implements BusinessExecutor<ProcessStringItem,
 
 
     @Override
     @Override
     String scriptName() {
     String scriptName() {
-        return "抖音来客创建订单"
+        return "[抖音来客]创建订单"
     }
     }
 
 
     @Override
     @Override
@@ -162,6 +162,7 @@ class BE_Order_CreateOrder_Douyin implements BusinessExecutor<ProcessStringItem,
             item.setItemName(it["product_name"] as String)
             item.setItemName(it["product_name"] as String)
             item.setItemCount(it["num"] as int)
             item.setItemCount(it["num"] as int)
             item.setItemMoney(it["origin_amount"] as BigDecimal)
             item.setItemMoney(it["origin_amount"] as BigDecimal)
+            item.setItemDetail(jsonConvert.convertTo(it["commodities"]))
 
 
             itemList.add(item)
             itemList.add(item)
         }
         }

+ 201 - 0
conf/script/1000/orderApi/BE_Order_RejectOrder_DYLK.groovy

@@ -0,0 +1,201 @@
+import com.dderp.business.dao.OrderDao
+import com.dderp.common.api.BusinessExecutor
+import com.dderp.common.api.StoreService
+import com.dderp.common.api.SupplierInitService
+import com.dderp.common.api.flycat.DouyinService
+import com.dderp.common.api.flycat.OrderSearchService
+import com.dderp.common.api.flycat.OrderService
+import com.dderp.common.api.flycat.OrderStepService
+import com.dderp.common.datas.ReadOrderOption
+import com.dderp.common.datas.flycat.BusinessOrderStatus
+import com.dderp.common.datas.ERPModule
+import com.dderp.common.datas.ESKeys
+import com.dderp.common.datas.flycat.PlatformType
+import com.dderp.common.entity.base.InvokeCallParams
+import com.dderp.common.entity.base.InvokeCallResult
+import com.dderp.common.entity.order.BusinessOrder
+import com.dderp.common.entity.order.OrderAfterSaleBill
+import com.dderp.common.entity.order.OrderFinances
+import com.dderp.common.entity.order.OrderStep
+import com.dderp.common.entity.site.ERPTokenUser
+import com.dderp.common.entity.store.StorePlatform
+import com.dySweetFishPlugin.elasticsearch.ESClient
+import com.dySweetFishPlugin.sql.TableIdService
+import com.dySweetFishPlugin.sql.dao.TunaService
+import com.sweetfish.convert.json.JsonConvert
+import com.sweetfish.service.RetResult
+import groovy.json.JsonSlurper
+import org.apache.logging.log4j.LogManager
+import org.apache.logging.log4j.Logger
+import org.elasticsearch.action.bulk.BulkRequestBuilder
+import org.elasticsearch.action.bulk.BulkResponse
+import org.elasticsearch.action.index.IndexRequestBuilder
+import org.elasticsearch.action.support.WriteRequest
+import org.elasticsearch.action.update.UpdateRequestBuilder
+import org.elasticsearch.common.xcontent.XContentType
+import org.rex.RMap
+
+import javax.annotation.Resource
+import java.time.LocalDateTime
+import java.time.ZoneOffset
+
+import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder
+
+@SuppressWarnings("unused")
+class BE_Order_RejectOrder_DYLK implements BusinessExecutor<InvokeCallParams, InvokeCallResult> {
+
+    private final Logger logger = LogManager.getLogger(this.getClass().getSimpleName())
+
+    @Resource
+    private JsonConvert jsonConvert
+
+    @Resource
+    private TableIdService tableIdService
+
+    @Resource
+    private StoreService storeService
+
+    @Resource
+    private ESClient esClient
+
+    @Resource
+    private SupplierInitService supplierInitService
+
+    @Resource
+    private OrderStepService orderStepService
+
+    @Resource
+    private OrderService orderService
+
+    @Resource
+    private OrderSearchService orderSearchService
+
+    @Resource
+    private DouyinService douyinService
+
+    @Resource
+    private TunaService tunaService
+
+    private OrderDao orderDao
+
+    @Override
+    String scriptName() {
+        return "[抖音来客]商户拒单"
+    }
+
+    @Override
+    ERPModule module() {
+        return ERPModule.ORDER_API
+    }
+
+    RetResult<InvokeCallResult> execute(InvokeCallParams source) {
+        //秒级时间戳,groovy里面不让用system
+        long currentTime = LocalDateTime.now().toEpochSecond(ZoneOffset.ofHours(8))
+        String dataSourceId = source.dataSourceId
+        long supplierCode = source.supplierCode
+        ERPTokenUser currentUser = source.currentUser
+
+        def jsonSlurper = new JsonSlurper()
+        def invokeOrder = jsonSlurper.parseText(source.params)
+        String incomePlatformOrderCode = invokeOrder["order_id"] as String
+        String platformStoreId = invokeOrder["poi_id"] as String
+
+        StorePlatform storePlatform = storeService.getStorePlatformByInvokeInfo(platformStoreId, "DYLK", PlatformType.order.value, supplierCode)
+        if (storePlatform == null) return RetResult.<InvokeCallResult> errorT().retinfo("订单来源平台未知!")
+
+        RMap searchParams = new RMap();
+        searchParams.set("incomePlatformId", platformStoreId)
+        searchParams.set("incomePlatformOrderCode", incomePlatformOrderCode)
+
+        RetResult<List<BusinessOrder>> orderResult = orderSearchService.searchBusinessOrderList(searchParams, currentUser, dataSourceId,
+                supplierCode, ReadOrderOption.ORDER_PRODUCT, ReadOrderOption.ORDER_FINANCES)
+        if (!orderResult.isSuccess()) return RetResult.<InvokeCallResult> errorT().retinfo(orderResult.retinfo)
+
+        BusinessOrder esOrder = orderResult.result.get(0) //这么查只可能有一个
+        OrderFinances orderFinances = esOrder.orderFinances
+
+        if (esOrder.orderStatus != BusinessOrderStatus.init.value)
+            return RetResult.<InvokeCallResult> errorT().retinfo("订单状态[" +
+                    BusinessOrderStatus.getName(esOrder.orderStatus) + "],不允许拒单操作")
+
+        //todo 目前不知道商户拒单是个什么逻辑,暂且认为等同于订单取消
+//        esOrder.setOrderStatus(BusinessOrderStatus.accept.value)
+        esOrder.setVoidFlagIn(100)
+        BusinessOrder.update(esOrder, currentUser.id)
+
+        OrderStep orderStep = orderStepService.parseOrderStep(esOrder.id, 0,
+                "[" + storePlatform.platformName + "]商家拒绝接单: " + invokeOrder["description"], storePlatform.platformCode, currentUser)
+
+        OrderAfterSaleBill afterSaleBill = new OrderAfterSaleBill()
+        afterSaleBill.setId(tableIdService.getTableIdMulti("deOrderAfterSaleBill.id", 1, dataSourceId, String.valueOf(supplierCode)))
+        afterSaleBill.setIdOrder(esOrder.id)
+        afterSaleBill.setIdStorePlatform(storePlatform.id)
+        afterSaleBill.setIdStore(storePlatform.idStore)
+        afterSaleBill.setOutPlatformStoreId(storePlatform.platformStoreId)
+        afterSaleBill.setPlatformCode(storePlatform.platformCode)
+        afterSaleBill.setPlatformType(storePlatform.platformType)
+        afterSaleBill.setPlatformName(storePlatform.platformName)
+        afterSaleBill.setBillCode(tableIdService.getTableCodeMulti("deOrderAfterSaleBill.code", dataSourceId, String.valueOf(supplierCode)))
+        afterSaleBill.setApplySource("MERCHANT")//拒单只能是商户发起
+        afterSaleBill.setFullRefunded(true)
+        afterSaleBill.setUserRefundAmount((orderFinances.customerPaid * 100).intValue())
+        afterSaleBill.setTotalUserRefundAmount((orderFinances.customerPaid * 100).intValue())
+        afterSaleBill.setProdCountAfterRefund(0)
+        afterSaleBill.setProductsRemainDetail("")
+        afterSaleBill.setProductsRefundDetail(jsonConvert.convertTo(esOrder.detailItemList))
+        OrderAfterSaleBill.create(afterSaleBill, currentUser.id)
+
+        //持久化
+        //订单主表
+        BulkRequestBuilder bulkRequest = esClient.getClient().prepareBulk().setRefreshPolicy(WriteRequest.RefreshPolicy.IMMEDIATE)
+
+        UpdateRequestBuilder orderRequest = esClient.getClient().prepareUpdate(
+                supplierInitService.getDateYearESIndex(supplierCode, ESKeys.ES_DELIVER_BUSINESS_ORDER_INDEX, 0),
+                ESKeys.ES_DELIVER_BUSINESS_ORDER_TYPE,
+                String.valueOf(esOrder.getId()))
+                .setDoc(jsonBuilder()
+                        .startObject()
+                        .field("voidFlagIn", esOrder.voidFlagIn)
+                        .field("updateBy", esOrder.getUpdateBy())
+                        .field("updateTimeLong", esOrder.getUpdateTimeLong())
+                        .endObject())
+        bulkRequest.add(orderRequest)
+
+        //订单售后单
+        IndexRequestBuilder orderAfterBillRequest = esClient.getClient()
+                .prepareIndex(supplierInitService.getDateYearESIndex(supplierCode, ESKeys.ES_DELIVER_BUSINESS_ORDER_INDEX, 0),
+                        ESKeys.ES_DELIVER_ORDER_AFTER_SALE_BILL_TYPE)
+                .setId(String.valueOf(afterSaleBill.id))
+                .setParent(String.valueOf(afterSaleBill.idOrder))
+                .setSource(jsonConvert.convertTo(afterSaleBill), XContentType.JSON)
+        bulkRequest.add(orderAfterBillRequest)
+
+        //订单脚印
+        IndexRequestBuilder orderStepRequest = esClient.getClient()
+                .prepareIndex(supplierInitService.getDateYearESIndex(supplierCode, ESKeys.ES_DELIVER_ORDER_STEP_INDEX, 0),
+                        ESKeys.ES_DELIVER_ORDER_STEP_TYPE)
+                .setId(String.valueOf(orderStep.id))
+                .setSource(jsonConvert.convertTo(orderStep), XContentType.JSON)
+        bulkRequest.add(orderStepRequest)
+
+
+        BulkResponse bulkResponse = bulkRequest.get();
+        orderDao = tunaService.generate(OrderDao.class)
+        if (bulkResponse.hasFailures()) {
+            logger.error("商户拒绝接单出错:" + bulkResponse.buildFailureMessage());
+            return RetResult.<InvokeCallResult> errorT().retinfo("商户拒绝接单出错:" + esOrder.orderName);
+        } else {
+            logger.info("商户拒绝接单成功");
+            //写数据库
+            orderDao.voidBusinessOrderIn(esOrder,
+                    afterSaleBill,
+                    [orderStep],
+                    dataSourceId,
+                    String.valueOf(supplierCode))
+
+
+            return RetResult.<InvokeCallResult> successT().result(InvokeCallResult.success().data(jsonConvert.convertTo(esOrder)))
+        }
+
+    }
+}

+ 1 - 11
conf/script/1000/orderApi/BE_Order_RejectOrder_Request.groovy

@@ -6,13 +6,11 @@ import com.dderp.common.api.flycat.DouyinService
 import com.dderp.common.api.flycat.OrderSearchService
 import com.dderp.common.api.flycat.OrderSearchService
 import com.dderp.common.api.flycat.OrderService
 import com.dderp.common.api.flycat.OrderService
 import com.dderp.common.api.flycat.OrderStepService
 import com.dderp.common.api.flycat.OrderStepService
-import com.dderp.common.datas.BusinessOrderStatus
+import com.dderp.common.datas.flycat.BusinessOrderStatus
 import com.dderp.common.datas.ERPModule
 import com.dderp.common.datas.ERPModule
-import com.dderp.common.datas.ESKeys
 import com.dderp.common.entity.base.InvokeCallParams
 import com.dderp.common.entity.base.InvokeCallParams
 import com.dderp.common.entity.base.InvokeCallResult
 import com.dderp.common.entity.base.InvokeCallResult
 import com.dderp.common.entity.order.BusinessOrder
 import com.dderp.common.entity.order.BusinessOrder
-import com.dderp.common.entity.order.OrderStep
 import com.dderp.common.entity.site.ERPTokenUser
 import com.dderp.common.entity.site.ERPTokenUser
 import com.dderp.common.entity.store.StorePlatform
 import com.dderp.common.entity.store.StorePlatform
 import com.dySweetFishPlugin.elasticsearch.ESClient
 import com.dySweetFishPlugin.elasticsearch.ESClient
@@ -23,19 +21,11 @@ import com.sweetfish.service.RetResult
 import groovy.json.JsonSlurper
 import groovy.json.JsonSlurper
 import org.apache.logging.log4j.LogManager
 import org.apache.logging.log4j.LogManager
 import org.apache.logging.log4j.Logger
 import org.apache.logging.log4j.Logger
-import org.elasticsearch.action.bulk.BulkRequestBuilder
-import org.elasticsearch.action.bulk.BulkResponse
-import org.elasticsearch.action.index.IndexRequestBuilder
-import org.elasticsearch.action.support.WriteRequest
-import org.elasticsearch.action.update.UpdateRequestBuilder
-import org.elasticsearch.common.xcontent.XContentType
 
 
 import javax.annotation.Resource
 import javax.annotation.Resource
 import java.time.LocalDateTime
 import java.time.LocalDateTime
 import java.time.ZoneOffset
 import java.time.ZoneOffset
 
 
-import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder
-
 @SuppressWarnings("unused")
 @SuppressWarnings("unused")
 class BE_Order_RejectOrder_Request implements BusinessExecutor<InvokeCallParams, InvokeCallResult> {
 class BE_Order_RejectOrder_Request implements BusinessExecutor<InvokeCallParams, InvokeCallResult> {
 
 

+ 11 - 69
conf/script/1000/orderApi/BE_Order_CancelOrder.groovy

@@ -6,13 +6,11 @@ import com.dderp.common.api.flycat.DouyinService
 import com.dderp.common.api.flycat.OrderSearchService
 import com.dderp.common.api.flycat.OrderSearchService
 import com.dderp.common.api.flycat.OrderService
 import com.dderp.common.api.flycat.OrderService
 import com.dderp.common.api.flycat.OrderStepService
 import com.dderp.common.api.flycat.OrderStepService
-import com.dderp.common.datas.BusinessOrderStatus
+import com.dderp.common.datas.flycat.BusinessOrderStatus
 import com.dderp.common.datas.ERPModule
 import com.dderp.common.datas.ERPModule
-import com.dderp.common.datas.ESKeys
 import com.dderp.common.entity.base.InvokeCallParams
 import com.dderp.common.entity.base.InvokeCallParams
 import com.dderp.common.entity.base.InvokeCallResult
 import com.dderp.common.entity.base.InvokeCallResult
 import com.dderp.common.entity.order.BusinessOrder
 import com.dderp.common.entity.order.BusinessOrder
-import com.dderp.common.entity.order.OrderStep
 import com.dderp.common.entity.site.ERPTokenUser
 import com.dderp.common.entity.site.ERPTokenUser
 import com.dderp.common.entity.store.StorePlatform
 import com.dderp.common.entity.store.StorePlatform
 import com.dySweetFishPlugin.elasticsearch.ESClient
 import com.dySweetFishPlugin.elasticsearch.ESClient
@@ -23,21 +21,13 @@ import com.sweetfish.service.RetResult
 import groovy.json.JsonSlurper
 import groovy.json.JsonSlurper
 import org.apache.logging.log4j.LogManager
 import org.apache.logging.log4j.LogManager
 import org.apache.logging.log4j.Logger
 import org.apache.logging.log4j.Logger
-import org.elasticsearch.action.bulk.BulkRequestBuilder
-import org.elasticsearch.action.bulk.BulkResponse
-import org.elasticsearch.action.index.IndexRequestBuilder
-import org.elasticsearch.action.support.WriteRequest
-import org.elasticsearch.action.update.UpdateRequestBuilder
-import org.elasticsearch.common.xcontent.XContentType
 
 
 import javax.annotation.Resource
 import javax.annotation.Resource
 import java.time.LocalDateTime
 import java.time.LocalDateTime
 import java.time.ZoneOffset
 import java.time.ZoneOffset
 
 
-import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder
-
 @SuppressWarnings("unused")
 @SuppressWarnings("unused")
-class BE_Order_CancelOrder implements BusinessExecutor<InvokeCallParams, InvokeCallResult> {
+class BE_Order_StoreCancelOrder_Request implements BusinessExecutor<InvokeCallParams, InvokeCallResult> {
 
 
     private final Logger logger = LogManager.getLogger(this.getClass().getSimpleName())
     private final Logger logger = LogManager.getLogger(this.getClass().getSimpleName())
 
 
@@ -109,10 +99,14 @@ class BE_Order_CancelOrder implements BusinessExecutor<InvokeCallParams, InvokeC
                 "script" + File.separator +
                 "script" + File.separator +
                 supplierCode + File.separator +
                 supplierCode + File.separator +
                 "scriptFiles" + File.separator +
                 "scriptFiles" + File.separator +
-                "refundOrderReason.json")
+                "refundOrderReasonIn_DYLK.json")
         def refundCodeArray = jsonSlurper.parse(refundCodeJsonFile)
         def refundCodeArray = jsonSlurper.parse(refundCodeJsonFile)
 
 
         BusinessOrder esOrder = orderResult.result
         BusinessOrder esOrder = orderResult.result
+
+        esOrder.orderStatus >= BusinessOrderStatus.orderComplete.value
+        return RetResult.<InvokeCallResult> errorT().retinfo("订单已完成,不允许发起退单")
+
         def legalReasons = (refundCodeArray.find { it["orderStatus"] == esOrder.orderStatus })["refundReason"] as ArrayList
         def legalReasons = (refundCodeArray.find { it["orderStatus"] == esOrder.orderStatus })["refundReason"] as ArrayList
 
 
         for (Integer reason in invokeOrder["refundReason"] as ArrayList<Integer>) {
         for (Integer reason in invokeOrder["refundReason"] as ArrayList<Integer>) {
@@ -122,18 +116,11 @@ class BE_Order_CancelOrder implements BusinessExecutor<InvokeCallParams, InvokeC
             }
             }
         }
         }
 
 
-        esOrder.setVoidFlag(1)
-        BusinessOrder.update(esOrder, currentUser.id)
-
         StorePlatform storePlatform = storeService.getStorePlatformInfo(esOrder.incomePlatformId, supplierCode)
         StorePlatform storePlatform = storeService.getStorePlatformInfo(esOrder.incomePlatformId, supplierCode)
         if (storePlatform == null) return RetResult.<InvokeCallResult> errorT().retinfo("订单来源平台未知!")
         if (storePlatform == null) return RetResult.<InvokeCallResult> errorT().retinfo("订单来源平台未知!")
 
 
-        OrderStep orderStep = orderStepService.parseOrderStep(esOrder.id, 0,
-                "[" + storePlatform.platformName + "]商家取消订单: " + invokeOrder["description"], storePlatform.platformCode, currentUser)
-
         //todo 判断订单目前状态,如果已生成配送单据,则要同步将配送单据取消
         //todo 判断订单目前状态,如果已生成配送单据,则要同步将配送单据取消
 
 
-        def callSuccess = [success: false, errorMsg: ""]
         //根据订单来源平台,回调平台的接单接口
         //根据订单来源平台,回调平台的接单接口
         switch (storePlatform.platformCode) {
         switch (storePlatform.platformCode) {
             case "DYLK": {
             case "DYLK": {
@@ -148,61 +135,16 @@ class BE_Order_CancelOrder implements BusinessExecutor<InvokeCallParams, InvokeC
                 String responseStr = douyinService.postInvoker("/goodlife/v1/after_sale/order/apply_refund/", jsonConvert.convertTo(postBody))
                 String responseStr = douyinService.postInvoker("/goodlife/v1/after_sale/order/apply_refund/", jsonConvert.convertTo(postBody))
                 def response = jsonSlurper.parseText(responseStr)
                 def response = jsonSlurper.parseText(responseStr)
                 if (response["extra"]["error_code"] as Integer == 0) {
                 if (response["extra"]["error_code"] as Integer == 0) {
-                    callSuccess["success"] = true
+                    return RetResult.<InvokeCallResult>successT()
                 } else {
                 } else {
                     //todo 抖音侧调用失败,怎么处理?
                     //todo 抖音侧调用失败,怎么处理?
-                    logger.error("[抖音来客]商户接单平台接口调用失败:" + response["extra"]["description"] as String)
-                    callSuccess["success"] = false
-                    callSuccess["errorMsg"] = "[抖音来客]商户接单平台接口调用失败:" + response["extra"]["description"] as String
+                    logger.error("[抖音来客]商户发起退单接口调用失败:" + response["extra"]["description"] as String)
+                    return RetResult.<InvokeCallResult>errorT().retinfo("[抖音来客]商户发起退单接口调用失败:" + response["extra"]["description"] as String)
                 }
                 }
 
 
-                break;
             }
             }
         }
         }
 
 
-        if (callSuccess["success"]) {
-            //持久化
-            //订单主表
-            BulkRequestBuilder bulkRequest = esClient.getClient().prepareBulk().setRefreshPolicy(WriteRequest.RefreshPolicy.IMMEDIATE)
-
-            UpdateRequestBuilder orderRequest = esClient.getClient().prepareUpdate(
-                    supplierInitService.getDateYearESIndex(supplierCode, ESKeys.ES_DELIVER_BUSINESS_ORDER_INDEX, 0),
-                    ESKeys.ES_DELIVER_BUSINESS_ORDER_TYPE,
-                    String.valueOf(esOrder.getId()))
-                    .setDoc(jsonBuilder()
-                            .startObject()
-                            .field("voidFlag", esOrder.voidFlag)
-                            .field("updateBy", esOrder.getUpdateBy())
-                            .field("updateTimeLong", esOrder.getUpdateTimeLong())
-                            .endObject())
-            bulkRequest.add(orderRequest)
-            //订单脚印
-            IndexRequestBuilder orderStepRequest = esClient.getClient()
-                    .prepareIndex(supplierInitService.getDateYearESIndex(supplierCode, ESKeys.ES_DELIVER_ORDER_STEP_INDEX, 0),
-                            ESKeys.ES_DELIVER_ORDER_STEP_TYPE)
-                    .setId(String.valueOf(orderStep.id))
-                    .setSource(jsonConvert.convertTo(orderStep), XContentType.JSON)
-            bulkRequest.add(orderStepRequest)
-
-
-            BulkResponse bulkResponse = bulkRequest.get();
-            orderDao = tunaService.generate(OrderDao.class)
-            if (bulkResponse.hasFailures()) {
-                logger.error("商户取消订单出错:" + bulkResponse.buildFailureMessage());
-                return RetResult.<InvokeCallResult> errorT().retinfo("商户取消订单出错:" + esOrder.orderName);
-            } else {
-                logger.info("商户取消订单成功");
-                //写数据库
-                orderDao.voidBusinessOrder(esOrder,
-                        [orderStep],
-                        dataSourceId,
-                        String.valueOf(supplierCode))
-
-
-                return RetResult.<InvokeCallResult> successT().result(InvokeCallResult.success().data(jsonConvert.convertTo(esOrder)))
-            }
-        } else {
-            return RetResult.<InvokeCallResult> errorT().retinfo("商户取消订单出错:" + callSuccess["errorMsg"]);
-        }
+        return RetResult.<InvokeCallResult> errorT().retinfo("订单来源平台未知!")
     }
     }
 }
 }

+ 17 - 20
conf/script/1000/orderApi/BE_Order_RejectOrder_Douyin.groovy

@@ -6,10 +6,10 @@ import com.dderp.common.api.flycat.DouyinService
 import com.dderp.common.api.flycat.OrderSearchService
 import com.dderp.common.api.flycat.OrderSearchService
 import com.dderp.common.api.flycat.OrderService
 import com.dderp.common.api.flycat.OrderService
 import com.dderp.common.api.flycat.OrderStepService
 import com.dderp.common.api.flycat.OrderStepService
-import com.dderp.common.datas.BusinessOrderStatus
 import com.dderp.common.datas.ERPModule
 import com.dderp.common.datas.ERPModule
 import com.dderp.common.datas.ESKeys
 import com.dderp.common.datas.ESKeys
-import com.dderp.common.datas.business.PlatformType
+import com.dderp.common.datas.flycat.BusinessOrderStatus
+import com.dderp.common.datas.flycat.PlatformType
 import com.dderp.common.entity.base.InvokeCallParams
 import com.dderp.common.entity.base.InvokeCallParams
 import com.dderp.common.entity.base.InvokeCallResult
 import com.dderp.common.entity.base.InvokeCallResult
 import com.dderp.common.entity.order.BusinessOrder
 import com.dderp.common.entity.order.BusinessOrder
@@ -39,7 +39,7 @@ import java.time.ZoneOffset
 import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder
 import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder
 
 
 @SuppressWarnings("unused")
 @SuppressWarnings("unused")
-class BE_Order_RejectOrder_Douyin implements BusinessExecutor<InvokeCallParams, InvokeCallResult> {
+class BE_Order_UserRefundRequest_DYLK implements BusinessExecutor<InvokeCallParams, InvokeCallResult> {
 
 
     private final Logger logger = LogManager.getLogger(this.getClass().getSimpleName())
     private final Logger logger = LogManager.getLogger(this.getClass().getSimpleName())
 
 
@@ -77,7 +77,7 @@ class BE_Order_RejectOrder_Douyin implements BusinessExecutor<InvokeCallParams,
 
 
     @Override
     @Override
     String scriptName() {
     String scriptName() {
-        return "订单商户拒单"
+        return "[抖音来客]客户退款申请"
     }
     }
 
 
     @Override
     @Override
@@ -85,6 +85,11 @@ class BE_Order_RejectOrder_Douyin implements BusinessExecutor<InvokeCallParams,
         return ERPModule.ORDER_API
         return ERPModule.ORDER_API
     }
     }
 
 
+    @Override
+    RetResult<InvokeCallParams> beforeExecute(InvokeCallParams source) {
+        return super.beforeExecute(source)
+    }
+
     RetResult<InvokeCallResult> execute(InvokeCallParams source) {
     RetResult<InvokeCallResult> execute(InvokeCallParams source) {
         //秒级时间戳,groovy里面不让用system
         //秒级时间戳,groovy里面不让用system
         long currentTime = LocalDateTime.now().toEpochSecond(ZoneOffset.ofHours(8))
         long currentTime = LocalDateTime.now().toEpochSecond(ZoneOffset.ofHours(8))
@@ -108,18 +113,11 @@ class BE_Order_RejectOrder_Douyin implements BusinessExecutor<InvokeCallParams,
         if (!orderResult.isSuccess()) return RetResult.<InvokeCallResult> errorT().retinfo(orderResult.retinfo)
         if (!orderResult.isSuccess()) return RetResult.<InvokeCallResult> errorT().retinfo(orderResult.retinfo)
 
 
         BusinessOrder esOrder = orderResult.result.get(0) //这么查只可能有一个
         BusinessOrder esOrder = orderResult.result.get(0) //这么查只可能有一个
-
-        if (esOrder.orderStatus != BusinessOrderStatus.init.value)
-            return RetResult.<InvokeCallResult> errorT().retinfo("订单状态[" +
-                    BusinessOrderStatus.getName(esOrder.orderStatus) + "],不允许拒单操作")
-
-        //todo 目前不知道商户拒单是个什么逻辑,暂且认为等同于订单取消
-//        esOrder.setOrderStatus(BusinessOrderStatus.accept.value)
-        esOrder.setVoidFlag(1)
+        esOrder.setOrderStatus(BusinessOrderStatus.accept.value)
         BusinessOrder.update(esOrder, currentUser.id)
         BusinessOrder.update(esOrder, currentUser.id)
 
 
-        OrderStep orderStep = orderStepService.parseOrderStep(esOrder.id, 0,
-                "[" + storePlatform.platformName + "]商家拒绝接单: " + invokeOrder["description"], storePlatform.platformCode, currentUser)
+        OrderStep orderStep = orderStepService.parseOrderStep(esOrder.id, 0, "[" + storePlatform.platformName + "]商家接单完成", storePlatform.platformCode, currentUser)
+
 
 
         //持久化
         //持久化
         //订单主表
         //订单主表
@@ -131,7 +129,7 @@ class BE_Order_RejectOrder_Douyin implements BusinessExecutor<InvokeCallParams,
                 String.valueOf(esOrder.getId()))
                 String.valueOf(esOrder.getId()))
                 .setDoc(jsonBuilder()
                 .setDoc(jsonBuilder()
                         .startObject()
                         .startObject()
-                        .field("voidFlag", esOrder.voidFlag)
+                        .field("orderStatus", esOrder.orderStatus)
                         .field("updateBy", esOrder.getUpdateBy())
                         .field("updateBy", esOrder.getUpdateBy())
                         .field("updateTimeLong", esOrder.getUpdateTimeLong())
                         .field("updateTimeLong", esOrder.getUpdateTimeLong())
                         .endObject())
                         .endObject())
@@ -148,17 +146,16 @@ class BE_Order_RejectOrder_Douyin implements BusinessExecutor<InvokeCallParams,
         BulkResponse bulkResponse = bulkRequest.get();
         BulkResponse bulkResponse = bulkRequest.get();
         orderDao = tunaService.generate(OrderDao.class)
         orderDao = tunaService.generate(OrderDao.class)
         if (bulkResponse.hasFailures()) {
         if (bulkResponse.hasFailures()) {
-            logger.error("商户拒绝接单出错:" + bulkResponse.buildFailureMessage());
-            return RetResult.<InvokeCallResult> errorT().retinfo("商户拒绝接单出错:" + esOrder.orderName);
+            logger.error("商户接单出错:" + bulkResponse.buildFailureMessage());
+            return RetResult.<InvokeCallResult> errorT().retinfo("商户接单出错:" + esOrder.orderName);
         } else {
         } else {
-            logger.info("商户拒绝接单成功");
+            logger.info("商户接单成功");
             //写数据库
             //写数据库
-            orderDao.voidBusinessOrder(esOrder,
+            orderDao.acceptBusinessOrder(esOrder,
                     [orderStep],
                     [orderStep],
                     dataSourceId,
                     dataSourceId,
                     String.valueOf(supplierCode))
                     String.valueOf(supplierCode))
 
 
-
             return RetResult.<InvokeCallResult> successT().result(InvokeCallResult.success().data(jsonConvert.convertTo(esOrder)))
             return RetResult.<InvokeCallResult> successT().result(InvokeCallResult.success().data(jsonConvert.convertTo(esOrder)))
         }
         }
 
 

conf/script/1000/scriptFiles/refundOrderReason.json → conf/script/1000/scriptFiles/refundOrderReasonIn_DYLK.json


conf/script/1000/scriptFiles/rejectOrderReason.json → conf/script/1000/scriptFiles/rejectOrderReasonIn_DYLK.json


+ 21 - 0
conf/script/1000/scriptFiles/voidApplySourceIn_DYLK.json

@@ -0,0 +1,21 @@
+{
+  "USER": "用户发起",
+  "MERCHANT": "商户发起发起",
+  "CUSTOMER_SERVICE_STAFF": "客服/运营",
+  "JUDGMENT": "判责(x项目)",
+  "SYSTEM": "系统",
+  "REFUND_TIMEOUT_ARBITRATE": "履约审核超时自动发起仲裁",
+  "PAY_TIMEOUT_CANCEL": "过期自动退",
+  "MERCHANT_CONFIRM_FAIL_REFUND": "商家发货确认失败",
+  "EXPIRE_REFUND": "过期退",
+  "PAY_CALLBACK_BUT_CANCELED": "回调时超订单被取消导致的超付",
+  "USER_FULFILMENT_REFUND": "用户履约后退款",
+  "CUSTOMER_SERVICE_STAFF_FULFILMENT_REFUND": "运营/客服履约后退款",
+  "MERCHANT_CONFIRM_REJECT_REFUND": "商家拒单自动退款",
+  "MERCHANT_CONFIRM_TIMEOUT_REFUND": "商家确认(接单)超时自动退款",
+  "MERCHANT_CONFIRM_CANCEL_REFUND": "商家取消订单自动退款",
+  "MERCHANT_CONFIRM_CANCEL_REFUND_FULFILMEN": "商家取消订单自动退款[40字符限制]",
+  "MERCHANT_FULFILMENT_REFUND": "商家核销后退款",
+  "DELIVER_CANCEL_REFUND": "运单取消导致退款",
+  "DATA_FIX": "数据修复"
+}

+ 22 - 19
conf/sqlroot/com/dderp/business/dao/OrderDao.dql

@@ -16,29 +16,31 @@ select * from $table$;
 
 
 -- [addBusinessOrder]
 -- [addBusinessOrder]
 insert into $table$ (id, orderName, orderCode, orderStatus,
 insert into $table$ (id, orderName, orderCode, orderStatus,
-incomePlatformId, incomePlatformName, incomePlatformOrderCode,
-incomePlatformOrderTime, incomePlatformOrderTimeLong, suggestDeliverTime,
-suggestDeliverTimeLong, orderSequence, idStore, storeName,
-deliverFee, deliverDistance, deliverAddressAll,
-outGoingPlatformId, outGoingPlatformName, voidFlag,
-createBy, createTime, createTimeLong,
-updateBy, updateTime, updateTimeLong ) values ( #{id}, #{ordername}, #{ordercode}, #{orderstatus},
-#{incomeplatformid}, #{incomeplatformname}, #{incomeplatformordercode},
-#{incomeplatformordertime}, #{incomeplatformordertimelong}, #{suggestdelivertime},
-#{suggestdelivertimelong}, #{ordersequence}, #{idstore}, #{storename},
-#{deliverfee}, #{deliverdistance}, #{deliveraddressall},
-#{outgoingplatformid}, #{outgoingplatformname}, #{voidflag},
-#{createby}, #{createtime}, #{createtimelong},
-#{updateby}, #{updatetime}, #{updatetimelong} );
+orderSequence, incomePlatformId, incomePlatformName,
+incomePlatformOrderCode, incomePlatformOrderTime, incomePlatformOrderTimeLong,
+suggestDeliverTime, suggestDeliverTimeLong, idStore,
+storeName, deliverFee, deliverDistance,
+deliverAddressAll, outGoingPlatformId, outGoingPlatformName,
+voidFlagIn, voidFlagOut, createBy,
+createTime, createTimeLong, updateBy,
+updateTime, updateTimeLong ) values ( #{id}, #{ordername}, #{ordercode}, #{orderstatus},
+#{ordersequence}, #{incomeplatformid}, #{incomeplatformname},
+#{incomeplatformordercode}, #{incomeplatformordertime}, #{incomeplatformordertimelong},
+#{suggestdelivertime}, #{suggestdelivertimelong}, #{idstore},
+#{storename}, #{deliverfee}, #{deliverdistance},
+#{deliveraddressall}, #{outgoingplatformid}, #{outgoingplatformname},
+#{voidflagin}, #{voidflagout}, #{createby},
+#{createtime}, #{createtimelong}, #{updateby},
+#{updatetime}, #{updatetimelong} );
 
 
 -- [addOrderFinances]
 -- [addOrderFinances]
 insert into $table$ (id, idOrder, orderMoney, deliverFee,
 insert into $table$ (id, idOrder, orderMoney, deliverFee,
 orderPlatformSubsidy, storeDiscount, customerPaid,
 orderPlatformSubsidy, storeDiscount, customerPaid,
-platformServiceFee, storeRealCollection, createBy,
+platformServiceFee, storeRealCollection, omeServiceFee, createBy,
 createTime, createTimeLong, updateBy,
 createTime, createTimeLong, updateBy,
 updateTime, updateTimeLong ) values ( #{id}, #{idorder}, #{ordermoney}, #{deliverfee},
 updateTime, updateTimeLong ) values ( #{id}, #{idorder}, #{ordermoney}, #{deliverfee},
 #{orderplatformsubsidy}, #{storediscount}, #{customerpaid},
 #{orderplatformsubsidy}, #{storediscount}, #{customerpaid},
-#{platformservicefee}, #{storerealcollection}, #{createby},
+#{platformservicefee}, #{storerealcollection}, #{omeservicefee}, #{createby},
 #{createtime}, #{createtimelong}, #{updateby},
 #{createtime}, #{createtimelong}, #{updateby},
 #{updatetime}, #{updatetimelong} );
 #{updatetime}, #{updatetimelong} );
 
 
@@ -59,10 +61,10 @@ updateTimeLong ) values ( #{id}, #{idorder}, #{deliverprovince}, #{delivercity},
 
 
 -- [addOrderDetailItem]
 -- [addOrderDetailItem]
 insert into $table$ (id, idOrder, itemName, itemPrice,
 insert into $table$ (id, idOrder, itemName, itemPrice,
-itemCount, itemMoney, createBy,
+itemCount, itemMoney, itemDetail, createBy,
 createTime, createTimeLong, updateBy,
 createTime, createTimeLong, updateBy,
 updateTime, updateTimeLong ) values ( #{id}, #{idorder}, #{itemname}, #{itemprice},
 updateTime, updateTimeLong ) values ( #{id}, #{idorder}, #{itemname}, #{itemprice},
-#{itemcount}, #{itemmoney}, #{createby},
+#{itemcount}, #{itemmoney}, #{itemdetail}, #{createby},
 #{createtime}, #{createtimelong}, #{updateby},
 #{createtime}, #{createtimelong}, #{updateby},
 #{updatetime}, #{updatetimelong} );
 #{updatetime}, #{updatetimelong} );
 
 
@@ -79,6 +81,6 @@ updateTime, updateTimeLong ) values ( #{idorder}, #{idworkman}, #{workman}, #{wo
 update $table$ set orderStatus = #{orderstatus}, updateBy = #{updateby},updateTime = #{updatetime},updateTimeLong = #{updatetimelong}
 update $table$ set orderStatus = #{orderstatus}, updateBy = #{updateby},updateTime = #{updatetime},updateTimeLong = #{updatetimelong}
 where id = #{id};
 where id = #{id};
 
 
-update $table$ set voidFlag = #{voidflag}, updateBy = #{updateby}, updateTime = #{updatetime}, updateTimeLong = #{updatetimelong}
+-- [voidBusinessOrderIn]
+update $table$ set voidFlagIn = #{voidflagin}, updateBy = #{updateby}, updateTime = #{updatetime}, updateTimeLong = #{updatetimelong}
 where id = #{id};
 where id = #{id};

+ 87 - 113
conf/初始化业务表.sql

@@ -1,9 +1,10 @@
-drop table if exists eoBusinessOrder1000_current;
-create table eoBusinessOrder1000_current(
+drop table if exists deBusinessOrder1000_current;
+create table deBusinessOrder1000_current(
                                             id	bigint  default 0,
                                             id	bigint  default 0,
                                             orderName	varchar(50) default '',
                                             orderName	varchar(50) default '',
                                             orderCode	varchar(100) default '',
                                             orderCode	varchar(100) default '',
                                             orderStatus	int default 0,
                                             orderStatus	int default 0,
+                                            orderSequence	bigint  default 0,
                                             incomePlatformId	bigint  default 0,
                                             incomePlatformId	bigint  default 0,
                                             incomePlatformName	varchar(50) default '',
                                             incomePlatformName	varchar(50) default '',
                                             incomePlatformOrderCode	varchar(100) default '',
                                             incomePlatformOrderCode	varchar(100) default '',
@@ -18,80 +19,8 @@ create table eoBusinessOrder1000_current(
                                             deliverAddressAll	varchar(500) default '',
                                             deliverAddressAll	varchar(500) default '',
                                             outGoingPlatformId	bigint  default 0,
                                             outGoingPlatformId	bigint  default 0,
                                             outGoingPlatformName	varchar(50) default '',
                                             outGoingPlatformName	varchar(50) default '',
-                                            voidFlag	int default 0,
-                                            createBy	bigint  default 0,
-                                            createTime	datetime default NOW(),
-                                            createTimeLong	bigint  default 0,
-                                            updateBy	bigint  default 0,
-                                            updateTime	datetime default NOW(),
-                                            updateTimeLong	bigint  default 0,
-                                            primary key (id)
-)
-    ENGINE = INNODB
-AUTO_INCREMENT = 1
-DEFAULT CHARSET = utf8
-COMMENT = '';
-
-drop table if exists eoOrderDeliveryInfo1000_current;
-create table eoOrderDeliveryInfo1000_current(
-                                                id	bigint  default 0,
-                                                idOrder	bigint  default 0,
-                                                deliverProvince	varchar(50) default '',
-                                                deliverCity	varchar(50) default '',
-                                                deliverDistract	varchar(100) default '',
-                                                deliverAddress	varchar(500) default '',
-                                                receiveMan	varchar(100) default '',
-                                                contractPhone	varchar(100) default '',
-                                                deliverTimeliness	int default 0,
-                                                bookingDeliverTime	datetime default NOW(),
-                                                customerInvoiceInfo	varchar(100) default '',
-                                                customerMemo	varchar(2000) default '',
-                                                createBy	bigint  default 0,
-                                                createTime	datetime default NOW(),
-                                                createTimeLong	bigint  default 0,
-                                                updateBy	bigint  default 0,
-                                                updateTime	datetime default NOW(),
-                                                updateTimeLong	bigint  default 0,
-                                                primary key (id)
-)
-    ENGINE = INNODB
-    AUTO_INCREMENT = 1
-    DEFAULT CHARSET = utf8
-    COMMENT = '';
-
-
-drop table if exists eoOrderDetailItem1000_current;
-create table eoOrderDetailItem1000_current(
-                                              id	bigint  default 0,
-                                              idOrder	bigint  default 0,
-                                              itemName	varchar(50) default '',
-                                              itemPrice	decimal(18,4) default 0,
-                                              itemCount	int default 0,
-                                              itemMoney	decimal(18,4) default 0,
-                                              createBy	bigint  default 0,
-                                              createTime	datetime default NOW(),
-                                              createTimeLong	bigint  default 0,
-                                              updateBy	bigint  default 0,
-                                              updateTime	datetime default NOW(),
-                                              updateTimeLong	bigint  default 0,
-                                              primary key (id)
-)
-    ENGINE = INNODB
-    AUTO_INCREMENT = 1
-    DEFAULT CHARSET = utf8
-    COMMENT = '';
-
-drop table if exists eoOrderFinances1000_current;
-create table eoOrderFinances1000_current(
-                                            id	bigint  default 0,
-                                            idOrder	bigint  default 0,
-                                            orderMoney	decimal(18,4) default 0,
-                                            deliverFee	decimal(18,4) default 0,
-                                            orderPlatformSubsidy	decimal(18,4) default 0,
-                                            storeDiscount	decimal(18,4) default 0,
-                                            customerPaid	decimal(18,4) default 0,
-                                            platformServiceFee	decimal(18,4) default 0,
-                                            storeRealCollection	decimal(18,4) default 0,
+                                            voidFlagIn	int default 0,
+                                            voidFlagOut	int default 0,
                                             createBy	bigint  default 0,
                                             createBy	bigint  default 0,
                                             createTime	datetime default NOW(),
                                             createTime	datetime default NOW(),
                                             createTimeLong	bigint  default 0,
                                             createTimeLong	bigint  default 0,
@@ -290,41 +219,6 @@ ALTER TABLE `tbplatforminfo1000`
     ADD COLUMN `platformCode` varchar(50) NULL AFTER `id`;
     ADD COLUMN `platformCode` varchar(50) NULL AFTER `id`;
 
 
 
 
-drop table if exists deBusinessOrder1000_current;
-create table deBusinessOrder1000_current(
-                                            id	bigint  default 0,
-                                            orderName	varchar(50) default '',
-                                            orderCode	varchar(100) default '',
-                                            orderStatus	int default 0,
-                                            incomePlatformId	bigint  default 0,
-                                            incomePlatformName	varchar(50) default '',
-                                            incomePlatformOrderCode	varchar(100) default '',
-                                            incomePlatformOrderTime	datetime default NOW(),
-                                            incomePlatformOrderTimeLong	bigint  default 0,
-                                            suggestDeliverTime	datetime default NOW(),
-                                            suggestDeliverTimeLong	bigint  default 0,
-                                            idStore	bigint  default 0,
-                                            storeName	varchar(50) default '',
-                                            deliverFee	decimal(18,4) default 0,
-                                            deliverDistance	decimal(18,4) default 0,
-                                            deliverAddressAll	varchar(500) default '',
-                                            outGoingPlatformId	bigint  default 0,
-                                            outGoingPlatformName	varchar(50) default '',
-                                            voidFlag	int default 0,
-                                            createBy	bigint  default 0,
-                                            createTime	datetime default NOW(),
-                                            createTimeLong	bigint  default 0,
-                                            updateBy	bigint  default 0,
-                                            updateTime	datetime default NOW(),
-                                            updateTimeLong	bigint  default 0,
-                                            primary key (id)
-)
-    ENGINE = INNODB
-    AUTO_INCREMENT = 1
-    DEFAULT CHARSET = utf8
-    COMMENT = '';
-
-
 
 
 drop table if exists deOrderFinances1000_current;
 drop table if exists deOrderFinances1000_current;
 create table deOrderFinances1000_current(
 create table deOrderFinances1000_current(
@@ -414,5 +308,85 @@ ALTER TABLE `tbstoreplatform1000`
 ALTER TABLE `deorderdeliveryinfo1000_currnet`
 ALTER TABLE `deorderdeliveryinfo1000_currnet`
     ADD COLUMN `bookingDeliverTimeLong` bigint(20) NULL AFTER `bookingDeliverTime`;
     ADD COLUMN `bookingDeliverTimeLong` bigint(20) NULL AFTER `bookingDeliverTime`;
 
 
-ALTER TABLE `debusinessorder1000_current`
-    ADD COLUMN `orderSequence` bigint(20) NULL AFTER `suggestDeliverTimeLong`;
+ALTER TABLE `deorderfinances1000_current`
+    ADD COLUMN `omeServiceFee` decimal(18, 4) NULL AFTER `storeRealCollection`;
+
+drop table if exists deOrderRefundRequest1000_current;
+create table deOrderRefundRequest1000_current(
+                                                 id	bigint  default 0,
+                                                 idOrder	bigint  default 0,
+                                                 idStore	bigint  default 0,
+                                                 outPlatformStoreId	varchar(100) default '',
+                                                 idStorePlatform	bigint  default 0,
+                                                 platformCode	varchar(100) default '',
+                                                 platformType	int default 0,
+                                                 platformName	varchar(50) default '',
+                                                 outAfterSaleId	varchar(100) default '',
+                                                 requestStatus	int default 0,
+                                                 userRefundMemo	varchar(2000) default '',
+                                                 refundType	int default 0,
+                                                 deliveryFee	int default 0,
+                                                 refundFee	int default 0,
+                                                 refundProdCount	int default 0,
+                                                 refundProductsDetail	varchar(100) default '',
+                                                 createBy	bigint  default 0,
+                                                 createTime	datetime default NOW(),
+                                                 createTimeLong	bigint  default 0,
+                                                 updateBy	bigint  default 0,
+                                                 updateTime	datetime default NOW(),
+                                                 updateTimeLong	bigint  default 0,
+                                                 primary key (id)
+)
+    ENGINE = INNODB
+    AUTO_INCREMENT = 1
+    DEFAULT CHARSET = utf8
+    COMMENT = '';
+
+
+drop table if exists deOrderAfterSaleBill1000_current;
+create table deOrderAfterSaleBill1000_current(
+                                                 id	bigint  default 0,
+                                                 idOrder	bigint  default 0,
+                                                 idStore	bigint  default 0,
+                                                 outPlatformStoreId	varchar(100) default '',
+                                                 idStorePlatform	bigint  default 0,
+                                                 platformCode	varchar(100) default '',
+                                                 platformType	int default 0,
+                                                 platformName	varchar(50) default '',
+                                                 outAfterSaleId	varchar(100) default '',
+                                                 applySource	varchar(100) default '',
+                                                 billCode	varchar(100) default '',
+                                                 userRefundAmount	int default 0,
+                                                 totalUserRefundAmount	int default 0,
+                                                 prodCountAfterRefund	int default 0,
+                                                 productsRemainDetail	varchar(100) default '',
+                                                 productsRefundDetail	varchar(100) default '',
+                                                 createBy	bigint  default 0,
+                                                 createTime	datetime default NOW(),
+                                                 createTimeLong	bigint  default 0,
+                                                 updateBy	bigint  default 0,
+                                                 updateTime	datetime default NOW(),
+                                                 updateTimeLong	bigint  default 0,
+                                                 primary key (id)
+)
+    ENGINE = INNODB
+    AUTO_INCREMENT = 1
+    DEFAULT CHARSET = utf8
+    COMMENT = '';
+
+CREATE OR REPLACE ALGORITHM = UNDEFINED DEFINER = `dbadmin`@`%` SQL SECURITY DEFINER VIEW `v_deorderaftersalebill1000` AS SELECT
+                                                                                                                                              `deorderaftersalebill1000_current`.`id` AS `id`,
+                                                                                                                                              `deorderaftersalebill1000_current`.`billCode` AS `billCode`
+                                                                                                                                          FROM
+                                                                                                                                              `deorderaftersalebill1000_current`;
+CREATE OR REPLACE ALGORITHM = UNDEFINED DEFINER = `dbadmin`@`%` SQL SECURITY DEFINER VIEW `v_deorderrefundrequest1000` AS  select `deorderrefundrequest1000_current`.`id` AS `id` from `deorderrefundrequest1000_current`;
+
+ALTER TABLE `deorderdetailitem1000_current`
+    ADD COLUMN `itemDetail` varchar(2000) NULL AFTER `itemMoney`;
+
+
+
+
+
+
+

+ 5 - 4
ddBusiness/src/main/java/com/dderp/business/dao/OrderDao.java

@@ -1,7 +1,6 @@
 package com.dderp.business.dao;
 package com.dderp.business.dao;
 
 
 import com.dderp.common.entity.order.*;
 import com.dderp.common.entity.order.*;
-import com.dderp.common.entity.store.StoreBrand;
 import com.dySweetFishPlugin.sql.dao.*;
 import com.dySweetFishPlugin.sql.dao.*;
 import com.sweetfish.source.PageFlipper;
 import com.sweetfish.source.PageFlipper;
 import org.rex.RMap;
 import org.rex.RMap;
@@ -60,9 +59,11 @@ public interface OrderDao extends DaoRepository {
 
 
     @Sharding(databaseShardingStrategy = SupplierDataBaseShardingStrategy.class, tableShardingStrategy = OrderTableShardingStrategy.class)
     @Sharding(databaseShardingStrategy = SupplierDataBaseShardingStrategy.class, tableShardingStrategy = OrderTableShardingStrategy.class)
     @DAOMethod(operator = OperatorType.UPDATE, owait = OperatorWait.ASNYC)
     @DAOMethod(operator = OperatorType.UPDATE, owait = OperatorWait.ASNYC)
-    @SqlId(clazz = OrderDao.class, sql = "voidBusinessOrder", table = "deBusinessOrder", tableParam = 4, params = {1}, sort = 1)
-    @SqlId(clazz = OrderDao.class, sql = "addOrderStep", table = "deOrderStep", tableParam = 4, params = {2}, sort = 2)
-    int voidBusinessOrder(BusinessOrder businessOrder,
+    @SqlId(clazz = OrderDao.class, sql = "voidBusinessOrderIn", table = "deBusinessOrder", tableParam = 5, params = {1}, sort = 1)
+    @SqlId(clazz = OrderDao.class, sql = "addOrderAfterSaleBill", table = "deOrderAfterSaleBill", tableParam = 5, params = {2}, sort = 2)
+    @SqlId(clazz = OrderDao.class, sql = "addOrderStep", table = "deOrderStep", tableParam = 5, params = {3}, sort = 3)
+    int voidBusinessOrderIn(BusinessOrder businessOrder,
+                            OrderAfterSaleBill afterSaleBill,
                             List<OrderStep> stepList,
                             List<OrderStep> stepList,
                             @DatabaseShardingBy String dataSourceId, String tableKey);
                             @DatabaseShardingBy String dataSourceId, String tableKey);
 }
 }

+ 1 - 1
ddBusiness/src/main/java/com/dderp/business/service/PlatformServiceImpl.java

@@ -5,7 +5,7 @@ import com.dderp.common.api.NoSqlKeysService;
 import com.dderp.common.api.PlatformService;
 import com.dderp.common.api.PlatformService;
 import com.dderp.common.base.BaseService;
 import com.dderp.common.base.BaseService;
 import com.dderp.common.datas.RedisKeys;
 import com.dderp.common.datas.RedisKeys;
-import com.dderp.common.datas.business.PlatformType;
+import com.dderp.common.datas.flycat.PlatformType;
 import com.dderp.common.entity.platform.PlatformInfo;
 import com.dderp.common.entity.platform.PlatformInfo;
 import com.dderp.common.entity.platform.PlatformRequire;
 import com.dderp.common.entity.platform.PlatformRequire;
 import com.dderp.common.entity.site.ERPTokenUser;
 import com.dderp.common.entity.site.ERPTokenUser;

+ 7 - 89
ddBusiness/src/main/java/com/dderp/business/service/StoreServiceImpl.java

@@ -83,7 +83,7 @@ public class StoreServiceImpl extends BaseService implements StoreService {
                 params,
                 params,
                 ((sd) -> {
                 ((sd) -> {
                     BoolQueryBuilder qb = QueryBuilders.boolQuery();
                     BoolQueryBuilder qb = QueryBuilders.boolQuery();
-                    qb = qb.must(QueryBuilders.typeQuery(ESKeys.ES_DELIVER_STORE_BRAND_INDEX));
+                    qb = qb.must(QueryBuilders.typeQuery(ESKeys.ES_DELIVER_STORE_BRAND_TYPE));
 
 
                     if (ERPUtils.mapContainKey(params, "brandName")) {
                     if (ERPUtils.mapContainKey(params, "brandName")) {
                         String platformName = params.getString("brandName");
                         String platformName = params.getString("brandName");
@@ -100,7 +100,7 @@ public class StoreServiceImpl extends BaseService implements StoreService {
 
 
                     return qb;
                     return qb;
                 }),
                 }),
-                keysService.getESKey(ESKeys.ES_DELIVER_STORE_BRAND_TYPE, supplierCode),
+                keysService.getESKey(ESKeys.ES_DELIVER_STORE_BRAND_INDEX, supplierCode),
                 pageFlipper,
                 pageFlipper,
                 (() -> SortBuilders.fieldSort("id").order(SortOrder.DESC)));
                 (() -> SortBuilders.fieldSort("id").order(SortOrder.DESC)));
     }
     }
@@ -330,7 +330,7 @@ public class StoreServiceImpl extends BaseService implements StoreService {
                         return qb;
                         return qb;
                     }),
                     }),
                     (StorePlatform::getIdStore),
                     (StorePlatform::getIdStore),
-                    new String[]{keysService.getESKey(ESKeys.ES_DELIVER_STORE_INFO_INDEX, supplierCode)},
+                    new String[]{keysService.getESKey(ESKeys.ES_DELIVER_STORE_PLATFORM_INDEX, supplierCode)},
                     (SortBuilderExecutor) null);
                     (SortBuilderExecutor) null);
 
 
             storeInfoList.forEach(x -> {
             storeInfoList.forEach(x -> {
@@ -409,7 +409,7 @@ public class StoreServiceImpl extends BaseService implements StoreService {
         storeInfo.setEnableInvoice(0);
         storeInfo.setEnableInvoice(0);
 
 
         IndexResponse itemResponse = esClient.getClient()
         IndexResponse itemResponse = esClient.getClient()
-                .prepareIndex(keysService.getESKey(ESKeys.ES_DELIVER_STORE_INFO_TYPE, supplierCode), ESKeys.ES_DELIVER_STORE_INFO_INDEX)
+                .prepareIndex(keysService.getESKey(ESKeys.ES_DELIVER_STORE_INFO_INDEX, supplierCode), ESKeys.ES_DELIVER_STORE_INFO_TYPE)
                 .setId(String.valueOf(storeInfo.getId()))
                 .setId(String.valueOf(storeInfo.getId()))
                 .setSource(jsonConvert.convertTo(storeInfo), XContentType.JSON)
                 .setSource(jsonConvert.convertTo(storeInfo), XContentType.JSON)
                 .setRefreshPolicy(WriteRequest.RefreshPolicy.IMMEDIATE)
                 .setRefreshPolicy(WriteRequest.RefreshPolicy.IMMEDIATE)
@@ -458,7 +458,7 @@ public class StoreServiceImpl extends BaseService implements StoreService {
                     qb.must(QueryBuilders.termQuery("idStore", idStore));
                     qb.must(QueryBuilders.termQuery("idStore", idStore));
                     return qb;
                     return qb;
                 },
                 },
-                keysService.getESKey(ESKeys.ES_DELIVER_STORE_INFO_TYPE, supplierCode),
+                keysService.getESKey(ESKeys.ES_DELIVER_STORE_INFO_INDEX, supplierCode),
                 null);
                 null);
     }
     }
 
 
@@ -494,6 +494,7 @@ public class StoreServiceImpl extends BaseService implements StoreService {
         StoreInvoiceInfo esInvoice = getStoreInvoiceInfo(invoiceInfo.getIdStore(), supplierCode);
         StoreInvoiceInfo esInvoice = getStoreInvoiceInfo(invoiceInfo.getIdStore(), supplierCode);
         if (esInvoice == null) { // 未设置过发票信息 需要新增
         if (esInvoice == null) { // 未设置过发票信息 需要新增
             invoiceInfo.setId(tableIdService.getTableIdMulti("tbStoreInvoiceInfo.id", 1, dataSourceId, String.valueOf(supplierCode)));
             invoiceInfo.setId(tableIdService.getTableIdMulti("tbStoreInvoiceInfo.id", 1, dataSourceId, String.valueOf(supplierCode)));
+
             StoreInvoiceInfo.create(invoiceInfo, currentUser.getId());
             StoreInvoiceInfo.create(invoiceInfo, currentUser.getId());
             IndexResponse itemResponse = esClient.getClient()
             IndexResponse itemResponse = esClient.getClient()
                     .prepareIndex(
                     .prepareIndex(
@@ -550,22 +551,8 @@ public class StoreServiceImpl extends BaseService implements StoreService {
 
 
         StoreInfo esInfo = this.getViewStoreInfo(storeInfo.getId(), supplierCode, false, false, false).getStoreInfo();
         StoreInfo esInfo = this.getViewStoreInfo(storeInfo.getId(), supplierCode, false, false, false).getStoreInfo();
         if (esInfo == null) {
         if (esInfo == null) {
-            return RetResult.<StoreInfo>errorT().retinfo("未找到此门店品牌");
+            return RetResult.<StoreInfo>errorT().retinfo("未找到此门店");
         }
         }
-        //先查一下有没有重名的门店信息(防止修改名称改重)同行业门店不同地区门店名可以重
-        StoreBrand checkNameInfo = this.getESOneInfo(esClient, jsonConvert,
-                StoreBrand.class,
-                (a) -> {
-                    BoolQueryBuilder qb = QueryBuilders.boolQuery().must(QueryBuilders.typeQuery(ESKeys.ES_DELIVER_STORE_INFO_TYPE));
-                    qb.must(QueryBuilders.termQuery("storeName.raw", esInfo.getStoreName()))
-                            .mustNot(QueryBuilders.idsQuery(String.valueOf(esInfo.getId())));
-
-                    return qb;
-                },
-                keysService.getESKey(ESKeys.ES_DELIVER_STORE_INFO_INDEX, supplierCode),
-                null);
-
-        if (checkNameInfo != null) return RetResult.<StoreInfo>errorT().retinfo("已存在同名的门店");
 
 
         esInfo.setStoreName(storeInfo.getStoreName());
         esInfo.setStoreName(storeInfo.getStoreName());
         esInfo.setIdBrand(storeInfo.getIdBrand());
         esInfo.setIdBrand(storeInfo.getIdBrand());
@@ -665,74 +652,5 @@ public class StoreServiceImpl extends BaseService implements StoreService {
                 keysService.getESKey(ESKeys.ES_DELIVER_STORE_PLATFORM_INDEX, supplierCode),
                 keysService.getESKey(ESKeys.ES_DELIVER_STORE_PLATFORM_INDEX, supplierCode),
                 null);
                 null);
     }
     }
-
-    @Override
-    public RetResult<StorePlatform> configStorePlatform(StorePlatform storePlatform, ERPTokenUser currentUser, String dataSourceId, long supplierCode) {
-        StorePlatform esInfo = this.getStorePlatformInfo(storePlatform.getId(), supplierCode);
-        if (esInfo == null) {
-            return RetResult.<StorePlatform>errorT().retinfo("未找到此开通平台");
-        }
-
-        esInfo.setIdStore(storePlatform.getIdPlatformInfo());
-        esInfo.setPlatformName(storePlatform.getPlatformName());
-        esInfo.setPlatformType(storePlatform.getPlatformType());
-        esInfo.setEnableStatue(storePlatform.getEnableStatue());
-        StorePlatform.update(esInfo, currentUser.getId());
-
-        BulkRequestBuilder bulkRequest = esClient.getClient().prepareBulk().setRefreshPolicy(WriteRequest.RefreshPolicy.IMMEDIATE);
-        UpdateRequest updateRequest = null;
-        try {
-            updateRequest = new UpdateRequest(keysService.getESKey(ESKeys.ES_DELIVER_STORE_PLATFORM_INDEX, supplierCode),
-                    ESKeys.ES_DELIVER_STORE_PLATFORM_TYPE, String.valueOf(esInfo.getId()))
-                    .doc(jsonBuilder()
-                            .startObject()
-                            .field("idPlatformInfo", esInfo.getIdPlatformInfo())
-                            .field("platformName", esInfo.getPlatformName())
-                            .field("platformType", esInfo.getPlatformType())
-                            .field("enableStatue", esInfo.getEnableStatue())
-                            .field("updateTimeLong", esInfo.getUpdateTimeLong())
-                            .field("updateBy", esInfo.getUpdateBy())
-                            .endObject());
-        } catch (IOException e) {
-            throw new RuntimeException(e);
-        }
-        bulkRequest.add(updateRequest);
-
-        storePlatform.getRequireList().forEach(x -> {
-            if (x.getId() <= 0) {
-                x.setId(tableIdService.getTableIdMulti("tbStorePlatformRequire.id", 1, dataSourceId, String.valueOf(supplierCode)));
-                StorePlatformRequire.create(x, currentUser.getId());
-            }
-            x.setIdStore(storePlatform.getIdStore());
-            x.setIdStorePlatform(storePlatform.getIdPlatformInfo());
-            StorePlatformRequire.update(x, currentUser.getId());
-            bulkRequest.add(esClient.getClient().prepareIndex(
-                            keysService.getESKey(ESKeys.ES_DELIVER_STORE_PLATFORM_INDEX, supplierCode), ESKeys.ES_DELIVER_STORE_PLATFORM_REQUIRE_TYPE)
-                    .setId(String.valueOf(x.getId()))
-                    .setParent(String.valueOf(storePlatform.getId()))
-                    .setSource(jsonConvert.convertTo(storePlatform), XContentType.JSON));
-        });
-
-        BoolQueryBuilder qbOrderPart = QueryBuilders.boolQuery()
-                .must(QueryBuilders.typeQuery(ESKeys.ES_DELIVER_STORE_PLATFORM_REQUIRE_TYPE))
-                .must(QueryBuilders.termQuery("idStorePlatform", esInfo.getId()));
-        DeleteByQueryAction.INSTANCE.newRequestBuilder(esClient.getClient())
-                .refresh(true)
-                .source(keysService.getESKey(ESKeys.ES_DELIVER_STORE_PLATFORM_INDEX, supplierCode))
-                .filter(qbOrderPart)
-                .get();
-
-        BulkResponse bulkResponse = bulkRequest.get();
-
-        if (bulkResponse.hasFailures()) {
-            logger.error("门店配置平台出错:" + bulkResponse.buildFailureMessage());
-            return RetResult.<StorePlatform>errorT().retinfo("门店配置平台出错:" + storePlatform.getPlatformName());
-        } else {
-            logger.info("门店配置平台成功");
-            //写数据库
-            storeDao.updateStorePlatform(esInfo, storePlatform.getRequireList(), dataSourceId, supplierCode);
-            return RetResult.successT();
-        }
-    }
     //endregion
     //endregion
 }
 }

+ 0 - 1
ddCommon/src/main/java/com/dderp/common/api/StoreService.java

@@ -67,7 +67,6 @@ public interface StoreService extends ScriptService {
 
 
     StorePlatform getStorePlatformByInvokeInfo(String platformStoreId, String platformCode, int platformType, long supplierCode);
     StorePlatform getStorePlatformByInvokeInfo(String platformStoreId, String platformCode, int platformType, long supplierCode);
 
 
-    RetResult<StorePlatform> configStorePlatform(StorePlatform storePlatform, ERPTokenUser currentUser, String dataSourceId, long supplierCode);
     //endregion
     //endregion
 
 
 
 

+ 6 - 0
ddCommon/src/main/java/com/dderp/common/datas/ESKeys.java

@@ -223,6 +223,7 @@ public class ESKeys {
     public static final String ES_DELIVER_ORDER_DELIVERY_INFO_TYPE = "orderdeliveryinfo";
     public static final String ES_DELIVER_ORDER_DELIVERY_INFO_TYPE = "orderdeliveryinfo";
     public static final String ES_DELIVER_ORDER_FINANCES_TYPE = "orderfinances";
     public static final String ES_DELIVER_ORDER_FINANCES_TYPE = "orderfinances";
     public static final String ES_DELIVER_ORDER_DETAIL_ITEM_TYPE = "orderdetailitem";
     public static final String ES_DELIVER_ORDER_DETAIL_ITEM_TYPE = "orderdetailitem";
+    public static final String ES_DELIVER_ORDER_AFTER_SALE_BILL_TYPE = "orderaftersalebill";
     //endregion
     //endregion
 
 
     //region 订单脚印
     //region 订单脚印
@@ -230,4 +231,9 @@ public class ESKeys {
     public static final String ES_DELIVER_ORDER_STEP_TYPE = "info";
     public static final String ES_DELIVER_ORDER_STEP_TYPE = "info";
     //endregion
     //endregion
 
 
+
+    //region 订单退款申请
+    public static final String ES_DELIVER_REFUND_ORDER_REQUEST_INDEX = "es.refundorderrequest.index";
+    public static final String ES_DELIVER_REFUND_ORDER_REQUEST_TYPE = "info";
+    //endregion
 }
 }

+ 3 - 0
ddCommon/src/main/java/com/dderp/common/datas/ReadOrderOption.java

@@ -8,6 +8,9 @@ public enum ReadOrderOption {
     //订单收货信息
     //订单收货信息
     ORDER_DELIVERY,
     ORDER_DELIVERY,
 
 
+    //订单金额信息
+    ORDER_FINANCES,
+
     //订单配送信息
     //订单配送信息
     ORDER_RIDER,
     ORDER_RIDER,
 
 

+ 1 - 1
ddCommon/src/main/java/com/dderp/common/datas/BusinessOrderStatus.java

@@ -1,4 +1,4 @@
-package com.dderp.common.datas;
+package com.dderp.common.datas.flycat;
 
 
 /**
 /**
  * Created by jlutt on 2021-07-11
  * Created by jlutt on 2021-07-11

+ 1 - 1
ddCommon/src/main/java/com/dderp/common/datas/business/PlatformType.java

@@ -1,4 +1,4 @@
-package com.dderp.common.datas.business;
+package com.dderp.common.datas.flycat;
 
 
 /**
 /**
  * 平台类别
  * 平台类别

+ 43 - 0
ddCommon/src/main/java/com/dderp/common/datas/flycat/RefundRequestStatus.java

@@ -0,0 +1,43 @@
+package com.dderp.common.datas.flycat;
+
+/**
+ * 平台类别
+ */
+@SuppressWarnings("unused")
+public enum RefundRequestStatus {
+
+    init("已申请", 0),
+    agree("同意退款", 1),
+    refuse("拒绝退款", 2);
+
+    private String name;
+    private int value;
+
+    RefundRequestStatus(String name, int value) {
+        this.name = name;
+        this.value = value;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public int getValue() {
+        return value;
+    }
+
+    public void setValue(int value) {
+        this.value = value;
+    }
+
+    public static String getName(int value) {
+        for (RefundRequestStatus p : RefundRequestStatus.values()) {
+            if (p.getValue() == value) return p.getName();
+        }
+        return null;
+    }
+}

+ 35 - 20
ddCommon/src/main/java/com/dderp/common/entity/order/BusinessOrder.java

@@ -13,6 +13,7 @@ import java.util.List;
  * 订单
  * 订单
  */
  */
 public class BusinessOrder extends BaseEntity {
 public class BusinessOrder extends BaseEntity {
+    @Comment("")
     @RColumn("id")
     @RColumn("id")
     private long id;
     private long id;
 
 
@@ -88,9 +89,13 @@ public class BusinessOrder extends BaseEntity {
     @Comment("配送平台名称")
     @Comment("配送平台名称")
     private String outGoingPlatformName;
     private String outGoingPlatformName;
 
 
-    @Comment("禁用标记")
-    @RColumn("voidflag")
-    private int voidFlag;
+    @RColumn("voidflagin")
+    @Comment("来源平台的退款标记")
+    private int voidFlagIn;
+
+    @RColumn("voidflagout")
+    @Comment("配送平台的退款标记")
+    private int voidFlagOut;
 
 
     @Comment("订单金额信息")
     @Comment("订单金额信息")
     private OrderFinances orderFinances;
     private OrderFinances orderFinances;
@@ -101,9 +106,9 @@ public class BusinessOrder extends BaseEntity {
     @Comment("订单配送信息")
     @Comment("订单配送信息")
     private OrderDeliveryInfo orderDeliveryInfo;
     private OrderDeliveryInfo orderDeliveryInfo;
 
 
+    @Comment("")
     private List<OrderRiderItem> riderItemList = new ArrayList<>();
     private List<OrderRiderItem> riderItemList = new ArrayList<>();
 
 
-
     public long getId() {
     public long getId() {
         return id;
         return id;
     }
     }
@@ -136,6 +141,14 @@ public class BusinessOrder extends BaseEntity {
         this.orderStatus = orderStatus;
         this.orderStatus = orderStatus;
     }
     }
 
 
+    public long getOrderSequence() {
+        return orderSequence;
+    }
+
+    public void setOrderSequence(long orderSequence) {
+        this.orderSequence = orderSequence;
+    }
+
     public long getIncomePlatformId() {
     public long getIncomePlatformId() {
         return incomePlatformId;
         return incomePlatformId;
     }
     }
@@ -248,6 +261,24 @@ public class BusinessOrder extends BaseEntity {
         this.outGoingPlatformName = outGoingPlatformName;
         this.outGoingPlatformName = outGoingPlatformName;
     }
     }
 
 
+    public int getVoidFlagIn() {
+        return voidFlagIn;
+    }
+
+    public void setVoidFlagIn(int voidFlagIn) {
+        this.voidFlagIn = voidFlagIn;
+    }
+
+
+    public int getVoidFlagOut() {
+        return voidFlagOut;
+    }
+
+    public void setVoidFlagOut(int voidFlagOut) {
+        this.voidFlagOut = voidFlagOut;
+    }
+
+
     public OrderFinances getOrderFinances() {
     public OrderFinances getOrderFinances() {
         return orderFinances;
         return orderFinances;
     }
     }
@@ -272,14 +303,6 @@ public class BusinessOrder extends BaseEntity {
         this.orderDeliveryInfo = orderDeliveryInfo;
         this.orderDeliveryInfo = orderDeliveryInfo;
     }
     }
 
 
-    public int getVoidFlag() {
-        return voidFlag;
-    }
-
-    public void setVoidFlag(int voidFlag) {
-        this.voidFlag = voidFlag;
-    }
-
     public List<OrderRiderItem> getRiderItemList() {
     public List<OrderRiderItem> getRiderItemList() {
         return riderItemList;
         return riderItemList;
     }
     }
@@ -287,12 +310,4 @@ public class BusinessOrder extends BaseEntity {
     public void setRiderItemList(List<OrderRiderItem> riderItemList) {
     public void setRiderItemList(List<OrderRiderItem> riderItemList) {
         this.riderItemList = riderItemList;
         this.riderItemList = riderItemList;
     }
     }
-
-    public long getOrderSequence() {
-        return orderSequence;
-    }
-
-    public void setOrderSequence(long orderSequence) {
-        this.orderSequence = orderSequence;
-    }
 }
 }

+ 227 - 0
ddCommon/src/main/java/com/dderp/common/entity/order/OrderAfterSaleBill.java

@@ -0,0 +1,227 @@
+package com.dderp.common.entity.order;
+
+import com.dderp.common.entity.base.BaseEntity;
+import com.sweetfish.util.Comment;
+import org.rex.db.RColumn;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * 订单售后单
+ */
+public class OrderAfterSaleBill extends BaseEntity {
+    @RColumn("id")
+    @Comment("")
+    private long id;
+
+    @RColumn("idorder")
+    @Comment("订单id")
+    private long idOrder;
+
+    @RColumn("idstore")
+    @Comment("系统门店id")
+    private long idStore;
+
+    @RColumn("outplatformstoreid")
+    @Comment("绑定的该平台系统中的门店id,由于对接订单时查找对应的绑定门店")
+    private String outPlatformStoreId;
+
+    @RColumn("idstoreplatform")
+    @Comment("门店已开通平台id")
+    private long idStorePlatform;
+
+    @RColumn("platformcode")
+    @Comment("平台code")
+    private String platformCode;
+
+    @RColumn("platformtype")
+    @Comment("平台类别 0订单平台/1配送平台")
+    private int platformType;
+
+    @RColumn("platformname")
+    @Comment("平台名称")
+    private String platformName;
+
+    @RColumn("outaftersaleid")
+    @Comment("绑定的该平台系统中的售后单号")
+    private String outAfterSaleId;
+
+    @Comment("退款原因代码list")
+    private List<Integer> refundReasonCodes = new ArrayList<>();
+
+    @RColumn("applysource")
+    @Comment("售后申请来源")
+    private String applySource;
+
+    @Comment("单据code")
+    @RColumn("billcode")
+    private String billCode;
+
+    @Comment("整笔订单是否已经完全退款")
+    private boolean isFullRefunded;
+
+    @RColumn("userrefundamount")
+    @Comment("本次用户退款金额,分")
+    private int userRefundAmount;
+
+    @RColumn("totaluserrefundamount")
+    @Comment("用户退款总金额,分")
+    private int totalUserRefundAmount;
+
+    @RColumn("prodcountafterrefund")
+    @Comment("退款后剩余商品数量")
+    private int prodCountAfterRefund;
+
+    @RColumn("productsremaindetail")
+    @Comment("退款后剩余商品详情")
+    private String productsRemainDetail;
+
+    @RColumn("productsrefunddetail")
+    @Comment("本次退款商品详情")
+    private String productsRefundDetail;
+
+    public long getId() {
+        return id;
+    }
+
+    public void setId(long id) {
+        this.id = id;
+    }
+
+    public long getIdOrder() {
+        return idOrder;
+    }
+
+    public void setIdOrder(long idOrder) {
+        this.idOrder = idOrder;
+    }
+
+    public long getIdStore() {
+        return idStore;
+    }
+
+    public void setIdStore(long idStore) {
+        this.idStore = idStore;
+    }
+
+    public String getOutPlatformStoreId() {
+        return outPlatformStoreId;
+    }
+
+    public void setOutPlatformStoreId(String outPlatformStoreId) {
+        this.outPlatformStoreId = outPlatformStoreId;
+    }
+
+    public long getIdStorePlatform() {
+        return idStorePlatform;
+    }
+
+    public void setIdStorePlatform(long idStorePlatform) {
+        this.idStorePlatform = idStorePlatform;
+    }
+
+    public String getPlatformCode() {
+        return platformCode;
+    }
+
+    public void setPlatformCode(String platformCode) {
+        this.platformCode = platformCode;
+    }
+
+    public int getPlatformType() {
+        return platformType;
+    }
+
+    public void setPlatformType(int platformType) {
+        this.platformType = platformType;
+    }
+
+    public String getPlatformName() {
+        return platformName;
+    }
+
+    public void setPlatformName(String platformName) {
+        this.platformName = platformName;
+    }
+
+    public String getOutAfterSaleId() {
+        return outAfterSaleId;
+    }
+
+    public void setOutAfterSaleId(String outAfterSaleId) {
+        this.outAfterSaleId = outAfterSaleId;
+    }
+
+    public List<Integer> getRefundReasonCodes() {
+        return refundReasonCodes;
+    }
+
+    public void setRefundReasonCodes(List<Integer> refundReasonCodes) {
+        this.refundReasonCodes = refundReasonCodes;
+    }
+
+    public String getApplySource() {
+        return applySource;
+    }
+
+    public void setApplySource(String applySource) {
+        this.applySource = applySource;
+    }
+
+    public boolean isFullRefunded() {
+        return isFullRefunded;
+    }
+
+    public void setFullRefunded(boolean fullRefunded) {
+        isFullRefunded = fullRefunded;
+    }
+
+    public int getUserRefundAmount() {
+        return userRefundAmount;
+    }
+
+    public void setUserRefundAmount(int userRefundAmount) {
+        this.userRefundAmount = userRefundAmount;
+    }
+
+    public int getTotalUserRefundAmount() {
+        return totalUserRefundAmount;
+    }
+
+    public void setTotalUserRefundAmount(int totalUserRefundAmount) {
+        this.totalUserRefundAmount = totalUserRefundAmount;
+    }
+
+    public int getProdCountAfterRefund() {
+        return prodCountAfterRefund;
+    }
+
+    public void setProdCountAfterRefund(int prodCountAfterRefund) {
+        this.prodCountAfterRefund = prodCountAfterRefund;
+    }
+
+    public String getProductsRemainDetail() {
+        return productsRemainDetail;
+    }
+
+    public void setProductsRemainDetail(String productsRemainDetail) {
+        this.productsRemainDetail = productsRemainDetail;
+    }
+
+    public String getProductsRefundDetail() {
+        return productsRefundDetail;
+    }
+
+    public void setProductsRefundDetail(String productsRefundDetail) {
+        this.productsRefundDetail = productsRefundDetail;
+    }
+
+    public String getBillCode() {
+        return billCode;
+    }
+
+    public void setBillCode(String billCode) {
+        this.billCode = billCode;
+    }
+}

+ 14 - 0
ddCommon/src/main/java/com/dderp/common/entity/order/OrderDetailItem.java

@@ -10,9 +10,11 @@ import java.math.BigDecimal;
  * 订单详情,主要是明细
  * 订单详情,主要是明细
  */
  */
 public class OrderDetailItem extends BaseEntity {
 public class OrderDetailItem extends BaseEntity {
+    @Comment("")
     @RColumn("id")
     @RColumn("id")
     private long id;
     private long id;
 
 
+    @Comment("")
     @RColumn("idorder")
     @RColumn("idorder")
     private long idOrder;
     private long idOrder;
 
 
@@ -32,6 +34,10 @@ public class OrderDetailItem extends BaseEntity {
     @Comment("项目总价")
     @Comment("项目总价")
     private BigDecimal itemMoney;
     private BigDecimal itemMoney;
 
 
+    @Comment("项目明细")
+    @RColumn("itemdetail")
+    private String itemDetail;
+
     public long getId() {
     public long getId() {
         return id;
         return id;
     }
     }
@@ -79,4 +85,12 @@ public class OrderDetailItem extends BaseEntity {
     public void setItemMoney(BigDecimal itemMoney) {
     public void setItemMoney(BigDecimal itemMoney) {
         this.itemMoney = itemMoney;
         this.itemMoney = itemMoney;
     }
     }
+
+    public String getItemDetail() {
+        return itemDetail;
+    }
+
+    public void setItemDetail(String itemDetail) {
+        this.itemDetail = itemDetail;
+    }
 }
 }

+ 12 - 0
ddCommon/src/main/java/com/dderp/common/entity/order/OrderFinances.java

@@ -44,6 +44,10 @@ public class OrderFinances extends BaseEntity {
     @Comment("店铺实收金额")
     @Comment("店铺实收金额")
     private BigDecimal storeRealCollection;
     private BigDecimal storeRealCollection;
 
 
+    @Comment("配送平台退单违约金")
+    @RColumn("omeservicefee")
+    private BigDecimal omeServiceFee;
+
     public long getId() {
     public long getId() {
         return id;
         return id;
     }
     }
@@ -115,4 +119,12 @@ public class OrderFinances extends BaseEntity {
     public void setStoreRealCollection(BigDecimal storeRealCollection) {
     public void setStoreRealCollection(BigDecimal storeRealCollection) {
         this.storeRealCollection = storeRealCollection;
         this.storeRealCollection = storeRealCollection;
     }
     }
+
+    public BigDecimal getOmeServiceFee() {
+        return omeServiceFee;
+    }
+
+    public void setOmeServiceFee(BigDecimal omeServiceFee) {
+        this.omeServiceFee = omeServiceFee;
+    }
 }
 }

+ 217 - 0
ddCommon/src/main/java/com/dderp/common/entity/order/OrderRefundRequest.java

@@ -0,0 +1,217 @@
+package com.dderp.common.entity.order;
+
+import com.dderp.common.entity.base.BaseEntity;
+import com.sweetfish.util.Comment;
+import org.rex.db.RColumn;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * 用户退款申请
+ */
+public class OrderRefundRequest extends BaseEntity {
+    @Comment("")
+    @RColumn("id")
+    private long id;
+
+    @Comment("订单id")
+    @RColumn("idorder")
+    private long idOrder;
+
+    @Comment("系统门店id")
+    @RColumn("idstore")
+    private long idStore;
+
+    @Comment("绑定的该平台系统中的门店id,由于对接订单时查找对应的绑定门店")
+    @RColumn("outplatformstoreid")
+    private String outPlatformStoreId;
+
+    @Comment("门店已开通平台id")
+    @RColumn("idstoreplatform")
+    private long idStorePlatform;
+
+    @Comment("平台code")
+    @RColumn("platformcode")
+    private String platformCode;
+
+    @Comment("平台类别 0订单平台/1配送平台")
+    @RColumn("platformtype")
+    private int platformType;
+
+    @Comment("平台名称")
+    @RColumn("platformname")
+    private String platformName;
+
+    @Comment("绑定的该平台系统中的售后单号")
+    @RColumn("outaftersaleid")
+    private String outAfterSaleId;
+
+    @Comment("申请状态")
+    @RColumn("requeststatus")
+    private int requestStatus;
+
+    @Comment("退款原因代码list")
+    private List<Integer> refundReasonCodes = new ArrayList<>();
+
+    @Comment("用户申请时填写的备注信息")
+    @RColumn("userrefundmemo")
+    private String userRefundMemo;
+
+    @Comment("退款类型:1-用户退款 2-客服、运营退款 3-研发退款 4-商家退款 99-系统退款 //疑似无用,理论都是1")
+    @RColumn("refundtype")
+    private int refundType;
+
+    @Comment("配送费用")
+    @RColumn("deliveryfee")
+    private int deliveryFee;
+
+    @Comment("申请退款")
+    @RColumn("refundfee")
+    private int refundFee;
+
+    @Comment("申请退款货物数")
+    @RColumn("refundprodcount")
+    private int refundProdCount;
+
+    @Comment("申请退款的货物明细")
+    @RColumn("refundproductsdetail")
+    private String refundProductsDetail;
+
+
+    public long getId() {
+        return id;
+    }
+
+    public void setId(long id) {
+        this.id = id;
+    }
+
+    public long getIdOrder() {
+        return idOrder;
+    }
+
+    public void setIdOrder(long idOrder) {
+        this.idOrder = idOrder;
+    }
+
+    public long getIdStore() {
+        return idStore;
+    }
+
+    public void setIdStore(long idStore) {
+        this.idStore = idStore;
+    }
+
+    public String getOutPlatformStoreId() {
+        return outPlatformStoreId;
+    }
+
+    public void setOutPlatformStoreId(String outPlatformStoreId) {
+        this.outPlatformStoreId = outPlatformStoreId;
+    }
+
+    public long getIdStorePlatform() {
+        return idStorePlatform;
+    }
+
+    public void setIdStorePlatform(long idStorePlatform) {
+        this.idStorePlatform = idStorePlatform;
+    }
+
+    public String getPlatformCode() {
+        return platformCode;
+    }
+
+    public void setPlatformCode(String platformCode) {
+        this.platformCode = platformCode;
+    }
+
+    public int getPlatformType() {
+        return platformType;
+    }
+
+    public void setPlatformType(int platformType) {
+        this.platformType = platformType;
+    }
+
+    public String getPlatformName() {
+        return platformName;
+    }
+
+    public void setPlatformName(String platformName) {
+        this.platformName = platformName;
+    }
+
+    public String getOutAfterSaleId() {
+        return outAfterSaleId;
+    }
+
+    public void setOutAfterSaleId(String outAfterSaleId) {
+        this.outAfterSaleId = outAfterSaleId;
+    }
+
+    public int getRequestStatus() {
+        return requestStatus;
+    }
+
+    public void setRequestStatus(int requestStatus) {
+        this.requestStatus = requestStatus;
+    }
+
+    public List<Integer> getRefundReasonCodes() {
+        return refundReasonCodes;
+    }
+
+    public void setRefundReasonCodes(List<Integer> refundReasonCodes) {
+        this.refundReasonCodes = refundReasonCodes;
+    }
+
+    public String getUserRefundMemo() {
+        return userRefundMemo;
+    }
+
+    public void setUserRefundMemo(String userRefundMemo) {
+        this.userRefundMemo = userRefundMemo;
+    }
+
+    public int getRefundType() {
+        return refundType;
+    }
+
+    public void setRefundType(int refundType) {
+        this.refundType = refundType;
+    }
+
+    public int getDeliveryFee() {
+        return deliveryFee;
+    }
+
+    public void setDeliveryFee(int deliveryFee) {
+        this.deliveryFee = deliveryFee;
+    }
+
+    public int getRefundFee() {
+        return refundFee;
+    }
+
+    public void setRefundFee(int refundFee) {
+        this.refundFee = refundFee;
+    }
+
+    public int getRefundProdCount() {
+        return refundProdCount;
+    }
+
+    public void setRefundProdCount(int refundProdCount) {
+        this.refundProdCount = refundProdCount;
+    }
+
+    public String getRefundProductsDetail() {
+        return refundProductsDetail;
+    }
+
+    public void setRefundProductsDetail(String refundProductsDetail) {
+        this.refundProductsDetail = refundProductsDetail;
+    }
+}

+ 4 - 3
ddCommon/src/main/java/com/dderp/common/entity/store/ViewStoreInfo.java

@@ -1,9 +1,10 @@
 package com.dderp.common.entity.store;
 package com.dderp.common.entity.store;
 
 
-import com.dderp.common.datas.business.PlatformType;
+import com.dderp.common.datas.flycat.PlatformType;
 import com.dderp.common.entity.base.BaseEntity;
 import com.dderp.common.entity.base.BaseEntity;
 import com.sweetfish.util.Comment;
 import com.sweetfish.util.Comment;
 
 
+import java.util.HashMap;
 import java.util.Map;
 import java.util.Map;
 
 
 /**
 /**
@@ -14,10 +15,10 @@ public class ViewStoreInfo extends BaseEntity {
     private StoreInfo storeInfo;
     private StoreInfo storeInfo;
 
 
     @Comment("门店开通的订单平台")
     @Comment("门店开通的订单平台")
-    private Map<String, Object> orderPlatforms;
+    private Map<String, Object> orderPlatforms = new HashMap<>();
 
 
     @Comment("门店开通的配送平台")
     @Comment("门店开通的配送平台")
-    private Map<String, Object> deliveryPlatforms;
+    private Map<String, Object> deliveryPlatforms = new HashMap<>();
 
 
     public ViewStoreInfo() {
     public ViewStoreInfo() {
     }
     }

+ 0 - 21
ddWebCore/src/main/java/com/dderp/webcore/rest/StoreRest.java

@@ -233,26 +233,5 @@ public class StoreRest extends BaseService {
 
 
     //endregion
     //endregion
 
 
-    //region 门店平台
-
-    @RestMapping(name = "configStorePlatform", auth = true, sort = 22, comment = "修改门店平台", methods = {"POST"})
-    @WebApiBean(result = true, type = StorePlatform.class)
-    public CompletableFuture<RMap> configStorePlatform(
-            @RestParam(name = "storePlatform", comment = "门店平台信息") StorePlatform storePlatform,
-            @RestParam(name = "&", comment = "当前用户,不需要传入") ERPTokenUser currentUser,
-            @RestHeader(name = ERPHeader.HTTPHEADER_DATASOURCE) String dataSourceId,
-            @RestHeader(name = ERPHeader.HTTPHEADER_SUPPLIER) String supplierCode) {
-        return CompletableFuture.supplyAsync(
-                () -> {
-                    RetResult<StorePlatform> result = storeService.configStorePlatform(storePlatform, currentUser, dataSourceId, Long.parseLong(supplierCode));
-                    if (!result.isSuccess()) return RMapUtils.error(HttpCode.BAD_REQUEST.value(), result.getRetinfo());
-                    return RMapUtils.successV2(result.getResult(), null, null);
-                }, getExecutor()
-        );
-    }
-
-    //endregion
-
-
 }
 }
 
 

+ 58 - 3
ddWebCore/src/main/java/com/dderp/webcore/servlet/OrderCallServlet.java

@@ -12,6 +12,7 @@ import com.dderp.common.entity.invoke.douyin.DouyinCallBody;
 import com.dderp.common.entity.order.BusinessOrder;
 import com.dderp.common.entity.order.BusinessOrder;
 import com.dderp.common.entity.site.ERPTokenUser;
 import com.dderp.common.entity.site.ERPTokenUser;
 import com.dderp.common.entity.store.StorePlatform;
 import com.dderp.common.entity.store.StorePlatform;
+import com.dderp.common.tool.DouyinTools;
 import com.dySweetFishPlugin.redis.RedisService;
 import com.dySweetFishPlugin.redis.RedisService;
 import com.sweetfish.convert.json.JsonConvert;
 import com.sweetfish.convert.json.JsonConvert;
 import com.sweetfish.net.WorkThread;
 import com.sweetfish.net.WorkThread;
@@ -133,7 +134,7 @@ public class OrderCallServlet extends HttpServlet {
                 //用户下单消息
                 //用户下单消息
                 CompletableFuture.runAsync(() -> {
                 CompletableFuture.runAsync(() -> {
                     InvokeCallParams callParams = new InvokeCallParams();
                     InvokeCallParams callParams = new InvokeCallParams();
-                    callParams.setBusinessMethod("Order_CreateOrder_Douyin");
+                    callParams.setBusinessMethod("Order_CreateOrder_DYLK");
                     callParams.setParams(callBody.getContent());
                     callParams.setParams(callBody.getContent());
                     RetResult<InvokeCallResult> result = orderService.callOrder(callParams, currentUser, dataSourceId, supplierCode);
                     RetResult<InvokeCallResult> result = orderService.callOrder(callParams, currentUser, dataSourceId, supplierCode);
                     if (result.isSuccess())
                     if (result.isSuccess())
@@ -146,7 +147,7 @@ public class OrderCallServlet extends HttpServlet {
                 //商户接单消息
                 //商户接单消息
                 CompletableFuture.runAsync(() -> {
                 CompletableFuture.runAsync(() -> {
                     InvokeCallParams callParams = new InvokeCallParams();
                     InvokeCallParams callParams = new InvokeCallParams();
-                    callParams.setBusinessMethod("Order_AcceptOrder_Douyin");
+                    callParams.setBusinessMethod("Order_AcceptOrder_DYLK");
                     callParams.setParams(callBody.getContent());
                     callParams.setParams(callBody.getContent());
                     RetResult<InvokeCallResult> result = orderService.callOrder(callParams, currentUser, dataSourceId, supplierCode);
                     RetResult<InvokeCallResult> result = orderService.callOrder(callParams, currentUser, dataSourceId, supplierCode);
                     if (result.isSuccess())
                     if (result.isSuccess())
@@ -159,7 +160,7 @@ public class OrderCallServlet extends HttpServlet {
                 //商户拒单消息
                 //商户拒单消息
                 CompletableFuture.runAsync(() -> {
                 CompletableFuture.runAsync(() -> {
                     InvokeCallParams callParams = new InvokeCallParams();
                     InvokeCallParams callParams = new InvokeCallParams();
-                    callParams.setBusinessMethod("Order_RejectOrder_Douyin");
+                    callParams.setBusinessMethod("Order_RejectOrder_DYLK");
                     callParams.setParams(callBody.getContent());
                     callParams.setParams(callBody.getContent());
                     RetResult<InvokeCallResult> result = orderService.callOrder(callParams, currentUser, dataSourceId, supplierCode);
                     RetResult<InvokeCallResult> result = orderService.callOrder(callParams, currentUser, dataSourceId, supplierCode);
                     if (result.isSuccess())
                     if (result.isSuccess())
@@ -170,6 +171,15 @@ public class OrderCallServlet extends HttpServlet {
             }
             }
             case "life_trade_refund_complete": {
             case "life_trade_refund_complete": {
                 //订单已取消消息
                 //订单已取消消息
+                CompletableFuture.runAsync(() -> {
+                    InvokeCallParams callParams = new InvokeCallParams();
+                    callParams.setBusinessMethod("Order_CancelOrder_DYLK");
+                    callParams.setParams(callBody.getContent());
+                    RetResult<InvokeCallResult> result = orderService.callOrder(callParams, currentUser, dataSourceId, supplierCode);
+                    if (result.isSuccess())
+                        logger.info("[抖音来客]订单取消成功");
+                    else logger.error("[抖音来客]订单取消失败:" + result.getRetinfo());
+                });
                 break;
                 break;
             }
             }
             case "life_trade_takeout_order_finish": {
             case "life_trade_takeout_order_finish": {
@@ -184,7 +194,52 @@ public class OrderCallServlet extends HttpServlet {
 
 
         //无论如何,最终还得返回个200
         //无论如何,最终还得返回个200
         response.finish(200, "success");
         response.finish(200, "success");
+    }
+
+
+    @HttpMapping(url = "/order/dylk_spi_call", methods = {"POST"}, comment = "[抖音来客]spi回调入口_客户退款申请")
+    public void dylk_spi_call(HttpRequest request, HttpResponse response) {
+        //简单的入口,估计也没多少接口提供出去,这里多加一层方法包一下,是担心后续会修改
+        logger.info("[抖音来客spi回调]:" + request);
+        String body = request.getBodyUTF8();
+
+        String douyinSign = request.getHeader("x-life-sign");
+        String douyinClientKey = request.getHeader("x-life-clientkey");
+//        String douyinClientKey = request.getParameter("client_key");
+        String douyinTimestamp = request.getParameter("timestamp");
+        String dataSourceId = request.getHeader(ERPHeader.HTTPHEADER_DATASOURCE);
+        long supplierCode = Long.parseLong(request.getHeader(ERPHeader.HTTPHEADER_SUPPLIER));
+
+        Map<String, String> query = new HashMap<>();
+        query.put("client_key", douyinClientKey);
+        query.put("timestamp", douyinTimestamp);
+
+        String sign = DouyinTools.SignV2(douyinAppSecret, body, query);
+
+        if (!sign.equals(douyinSign)) {
+            logger.error("[抖音来客]spi推送消息验签失败");
+            response.finish(200, "验签失败");
+            return;
+        }
 
 
+        //造一个系统后台用户
+        ERPTokenUser currentUser = new ERPTokenUser();
+        currentUser.setId(-100);
+        currentUser.setUserName("抖音来客");
 
 
+        CompletableFuture.runAsync(() -> {
+            InvokeCallParams callParams = new InvokeCallParams();
+            callParams.setBusinessMethod("Order_UserRefundRequest_DYLK");
+            callParams.setParams(body);
+            RetResult<InvokeCallResult> result = orderService.callOrder(callParams, currentUser, dataSourceId, supplierCode);
+            if (result.isSuccess())
+                logger.info("[抖音来客]用户退款申请写入成功");
+            else logger.error("[抖音来客]用户退款申请写入失败:" + result.getRetinfo());
+        });
+        //无论如何,先同步返回个处理中
+        String resp = """
+                {"data":{"result":1}}
+                """;
+        response.finish(200, resp);
     }
     }
 }
 }