diff --git a/ms-biz/src/main/java/com/ms/biz/service/impl/DistributionOrderServiceImpl.java b/ms-biz/src/main/java/com/ms/biz/service/impl/DistributionOrderServiceImpl.java index ea16922..9b08a92 100644 --- a/ms-biz/src/main/java/com/ms/biz/service/impl/DistributionOrderServiceImpl.java +++ b/ms-biz/src/main/java/com/ms/biz/service/impl/DistributionOrderServiceImpl.java @@ -81,15 +81,17 @@ public class DistributionOrderServiceImpl implements DistributionOrderService { BatchCreateDistributionOrdersRequestDTO request = buildBatchCreateDistributionOrdersRequestDTO(param); BatchCreateDistributionOrdersResponseDTO response = dsApiService.batchCreateDistributionOrders(param.getShopId(), request); - // String res = "{\"result\":\"success\",\"successCount\":1,\"failCount\":0,\"successList\":[{\"result\":\"success\",\"data\":{\"success\":true,\"totalSuccessAmount\":1399,\"orderId\":\"3630260954504828754\",\"postFee\":0,\"mutilOrders\":null},\"createAlibabaOrderLogId\":1420,\"platformOrderIds\":[\"6917543139367389081\"],\"isEncryptOrder\":\"true\",\"isSupportEncryptOrder\":1,\"isUseManualConsignee\":0,\"flow\":\"fenxiao\",\"includeSplitJxhy\":false,\"sourceOrderIds\":[\"3630260954504828754\"],\"payRet\":null,\"platformOrderId\":\"6917543139367389081\",\"relatePurchaseOrderInfos\":[{\"platformOrderId\":\"6917543139367389081\",\"purchasePlatform\":\"1688DS\",\"purchaseOrderSn\":\"3630260954504828754\",\"purchaseOrderBuyer\":\"\\u6843\\u72f8\\u706c\\u5c0f\\u7231\",\"purchaseOrderSeller\":\"\\u4e49\\u4e4c\\u73cd\\u4eab\\u8d38\\u6613\",\"purchaseOrderPayment\":\"13.99\",\"purchaseOrderFullname\":\"\\u7535*\",\"purchaseOrderMobile\":\"1********00\",\"purchaseOrderFullAddress\":\"\\u5317\\u4eac \\u5317\\u4eac\\u5e02 \\u6d77\\u6dc0\\u533a \\u6d77\\u6dc0\\u8857\\u9053 \\u4e92\\u8054*******\",\"purchaseOrderStartTime\":\"2023-11-14 14:29:33\",\"platformPushStatus\":\"wait\",\"purchaseOrderLogisticsName\":\"\",\"purchaseOrderWaybillCode\":\"\",\"purchaseOrderStatus\":\"wait_pay\",\"purchaseOrderFlow\":\"fenxiao\",\"alibabaOrderStatus\":\"waitbuyerpay\",\"isUseManualConsignee\":0,\"isDsEncryptOrder\":0,\"isSupportEncryptOrder\":0,\"logisticsIsAccept\":false,\"items\":[{\"skuId\":\"3659175955997568\",\"wareId\":\"3649883085652281308\",\"purchaseNum\":\"1\",\"purchasePrice\":\"13.99\",\"sourceItemId\":\"686872273204\",\"subItemId\":\"3630260954504828754\"}],\"mergePurchasePlatformOrderIds\":null,\"purchaseOrderUpdateTime\":\"2023-11-14 14:29:33\",\"purchaseOrderPayTime\":null}]}],\"errorList\":null,\"lockSourceItems\":[{\"createPurchaseOrderLockSkuId\":\"2077\",\"createPurchaseOrderLockId\":\"20001608\",\"sourceItemId\":\"686872273204\",\"sourceSkuId\":\"4897420288982\",\"createPurchaseOrderLogId\":\"1477\",\"sourceOrderId\":\"3630260954504828754\",\"sourceNum\":null,\"reqId\":null,\"status\":\"lock\",\"gmtCreate\":\"2023-11-14 14:29:32\",\"gmtModified\":\"2023-11-14 14:29:33\",\"platformOrderId\":\"6917543139367389081\",\"platformItemId\":\"3649883085652281308\",\"platformSkuId\":\"3659175955997568\"}]}"; - // BatchCreateDistributionOrdersResponseDTO response = JSON.parseObject(res, BatchCreateDistributionOrdersResponseDTO.class); +// String res = "{\"result\":\"success\",\"successCount\":1,\"failCount\":0,\"successList\":[{\"result\":\"success\",\"data\":{\"success\":true,\"totalSuccessAmount\":598,\"orderId\":\"3641170788609141341\",\"postFee\":0,\"mutilOrders\":null},\"createAlibabaOrderLogId\":1496,\"platformOrderIds\":[\"6923971910449173607\"],\"isEncryptOrder\":\"true\",\"isSupportEncryptOrder\":1,\"isUseManualConsignee\":0,\"flow\":\"fenxiao\",\"includeSplitJxhy\":false,\"sourceOrderIds\":[\"3641170788609141341\"],\"payRet\":null,\"platformOrderId\":\"6923971910449173607\",\"relatePurchaseOrderInfos\":[{\"platformOrderId\":\"6923971910449173607\",\"purchasePlatform\":\"1688DS\",\"purchaseOrderSn\":\"3641170788609141341\",\"purchaseOrderBuyer\":\"douhuotest\",\"purchaseOrderSeller\":\"\\u798f\\u5dde\\u67cf\\u4e3a\\u5546\\u8d38\\u6709\\u9650\\u516c\\u53f8\",\"purchaseOrderPayment\":\"5.98\",\"purchaseOrderFullname\":\"\\u6de1*\",\"purchaseOrderMobile\":\"1********80\",\"purchaseOrderFullAddress\":\"\\u6d59\\u6c5f\\u7701 \\u676d\\u5dde\\u5e02 \\u4f59\\u676d\\u533a \\u4ed3\\u524d\\u8857\\u9053 \\u4f59\\u676d*\\u8def****\",\"purchaseOrderStartTime\":\"2023-11-22 11:03:37\",\"platformPushStatus\":\"wait\",\"purchaseOrderLogisticsName\":\"\",\"purchaseOrderWaybillCode\":\"\",\"purchaseOrderStatus\":\"wait_pay\",\"purchaseOrderFlow\":\"fenxiao\",\"alibabaOrderStatus\":\"waitbuyerpay\",\"isUseManualConsignee\":0,\"isDsEncryptOrder\":0,\"isSupportEncryptOrder\":0,\"logisticsIsAccept\":false,\"items\":[{\"skuId\":\"3386515436145410\",\"wareId\":\"3651940874226638524\",\"purchaseNum\":\"2\",\"purchasePrice\":\"2.99\",\"sourceItemId\":\"712130508984\",\"subItemId\":\"3641170788609141341\"}],\"mergePurchasePlatformOrderIds\":null,\"purchaseOrderUpdateTime\":\"2023-11-22 11:03:37\",\"purchaseOrderPayTime\":null}]}],\"errorList\":null,\"lockSourceItems\":[{\"createPurchaseOrderLockSkuId\":\"2224\",\"createPurchaseOrderLockId\":\"20001680\",\"sourceItemId\":\"712130508984\",\"sourceSkuId\":\"4987755988437\",\"createPurchaseOrderLogId\":\"1553\",\"sourceOrderId\":\"3641170788609141341\",\"sourceNum\":null,\"reqId\":null,\"status\":\"lock\",\"gmtCreate\":\"2023-11-22 11:03:36\",\"gmtModified\":\"2023-11-22 11:03:37\",\"platformOrderId\":\"6923971910449173607\",\"platformItemId\":\"3651940874226638524\",\"platformSkuId\":\"3386515436145410\"}]}"; +// BatchCreateDistributionOrdersResponseDTO response = JSON.parseObject(res, BatchCreateDistributionOrdersResponseDTO.class); - List errorList = new ArrayList<>(); - for (DsErrorRetDTO errorRet: response.getErrorList()) { - errorList.add(errorRet.getReason()); - } - if (!errorList.isEmpty()) { - throw new RuntimeException(String.join(";", errorList)); + if (response.getErrorList() != null) { + List errorList = new ArrayList<>(); + for (DsErrorRetDTO errorRet: response.getErrorList()) { + errorList.add(errorRet.getReason()); + } + if (!errorList.isEmpty()) { + throw new RuntimeException(String.join(";", errorList)); + } } List orderResults = new ArrayList<>(); diff --git a/ms-biz/src/main/java/com/ms/biz/spi/callback/BatchCreateService.java b/ms-biz/src/main/java/com/ms/biz/spi/callback/BatchCreateService.java index dd3fc9c..7907573 100644 --- a/ms-biz/src/main/java/com/ms/biz/spi/callback/BatchCreateService.java +++ b/ms-biz/src/main/java/com/ms/biz/spi/callback/BatchCreateService.java @@ -29,9 +29,11 @@ public class BatchCreateService extends SPIBaseService implements ExtensionServi distributionOrderService.batchCreate(param, data); return BaseResponse.builder().success(true).message("success").code("0").data(JSON.parseObject(JSON.toJSONString(data))).build(); } catch (RuntimeException e) { - return BaseResponse.builder().success(true).message(e.getMessage()).code("100003").build(); + log.error("batchCreate error1", e); + String message = e.getMessage() == null ? "系统异常" : e.getMessage(); + return BaseResponse.builder().success(true).message(message).code("100003").build(); } catch (Throwable e) { - log.error("batchCreate error", e); + log.error("batchCreate error2", e); return BaseResponse.builder().success(true).message("系统异常").code("100003").build(); } } diff --git a/ms-web/src/main/java/com/ms/web/controller/Test.java b/ms-web/src/main/java/com/ms/web/controller/Test.java index 09376c5..a2fcb16 100644 --- a/ms-web/src/main/java/com/ms/web/controller/Test.java +++ b/ms-web/src/main/java/com/ms/web/controller/Test.java @@ -233,11 +233,11 @@ public class Test { @RequestMapping("/batchCreate") public String batchCreate() { - String d = "{\"orders\":[{\"mask_post_address\":{\"city\":{\"id\":\"330100\",\"name\":\"杭州市\"},\"detail\":\"余杭*路****\",\"post_receiver\":\"淡**\",\"post_tel\":\"1********80\",\"province\":{\"id\":\"33\",\"name\":\"浙江省\"},\"street\":{\"id\":\"3301100120000\",\"name\":\"仓前街道\"},\"town\":{\"id\":\"3301100000000\",\"name\":\"余杭区\"}},\"order_id\":\"6923840578763953515\",\"post_address\":{\"city\":{\"id\":\"330100\",\"name\":\"杭州市\"},\"detail\":\"\",\"encrypt_detail\":\"#iyvDRxlWwsSVIGFpTvXG8xnTMrr4#ACn6LHQE1kb+TbI85Ka6e+LQtjO1AxrT6bcTCtHDD9oG1RtU8x9aw73EeIyImArqzGAqcIl5tY6xfSKMGsekZO172jS0n3XADmslrLL32Qu17LnmrgcVXvJSt2b2DcHS*CgwIARCtHBiqICABKAESPgo8pbS3syRmunaGXTFmXXljtG2r/f16AS6WqXmIcsJqFpPayW+paVDmQbq2cqdfytcxhv1RKo3+7sWiggBCGgA=#1##\",\"encrypt_post_receiver\":\"#smlyjYrQ#IfMCin8hRw96KQwfgDAQGWltM7lRF1Y5IWHGR6fztU2wbG81dpHmbC7knpQKTZAVnymCzDSXPs/o0tPKiIWqkwtcXoJ8CGoHlCq8RyNbQJ24*CgwIARCtHBiqICABKAESPgo8YTCpI69Am/cxRo6MK2mA2aInfozU8iNlnLLTkDrARyWtyPk2jQHXBVfMvF46PZ2hLYwiCq/EKi0Ou89/GgA=#1##\",\"encrypt_post_tel\":\"$o+GrGJidM5c0VEWIKPfzwjrgJJvnyAnBCrKy42/Puig=$sJViW2c/NlJulTEuRZJkVeH+J3sgxlIkklQg3lYwYcvLgmecRz+v4f8N43+yPZa7BNew4SmxGK+N0ybzlo2xKlELi20Norw0WRq67Tu6fdb6OGc=*CgwIARCtHBiqICABKAESPgo8jUy6fINer40wH26e6Ojh22NOyPXaWv9uapVIKVu39QNXdsbC/JscSv4xcSlcbyR1zVbPRPe+vcoisAqgGgA=$1$$\",\"post_receiver\":\"\",\"post_tel\":\"\",\"province\":{\"id\":\"33\",\"name\":\"浙江省\"},\"street\":{\"id\":\"3301100120000\",\"name\":\"仓前街道\"},\"town\":{\"id\":\"3301100000000\",\"name\":\"余杭区\"}},\"pur_order_id\":\"7302285414677152035\",\"sku_orders\":[{\"cargo_id\":3650987455676581230,\"cargo_sku_id\":3385720331553538,\"num\":1,\"outer_product_id\":\"649016281205\",\"outer_sku_id\":\"4823756953234\",\"product_id\":3651167138015801592,\"pur_sku_order_id\":\"7302285414677168419\",\"sku_id\":3385747071915266,\"sku_order_id\":\"6923840578763953515\"}]}],\"shop_id\":117233105}"; + String d = "{\"orders\":[{\"mask_post_address\":{\"city\":{\"id\":\"330100\",\"name\":\"杭州市\"},\"detail\":\"余杭*路****\",\"post_receiver\":\"淡\",\"post_tel\":\"1********80\",\"province\":{\"id\":\"33\",\"name\":\"浙江省\"},\"street\":{\"id\":\"3301100120000\",\"name\":\"仓前街道\"},\"town\":{\"id\":\"3301100000000\",\"name\":\"余杭区\"}},\"order_id\":\"6923971910449173607\",\"post_address\":{\"city\":{\"id\":\"330100\",\"name\":\"杭州市\"},\"detail\":\"\",\"encrypt_detail\":\"#iyvDRxlWwsSVIGFpTvXG8xnTMrr4#0EtDPSnclpuXoe4cm9PbGRty29BV638tB3sFW50AH8OSuPE1ez4Ckx9S/5oMxilA+OD0fjDbZoer9ypQtxco+kQKx3U6UAw5ySHXuhSOWUEJDxW1eFOV7k2d9DA=*CgwIARCtHBiqICABKAESPgo87zzg3pjRu02NeG4BjIGzZe+xlXTWJqwX/uZ+ngz1LQn5f1fl4pkHOiFAMuZIl4p+Qzy+jG980ovJAiujGgA=#1##\",\"encrypt_post_receiver\":\"#cb9d#9+7ttEli8WI2+7/UyWgbyzHraoj2ol4gx0Wbux9bC21dtYFfxia7c4exWu+RFMOuFAIyKDSAHJm7h5IG4vp3Q6Ntk81t6/4=*CgwIARCtHBiqICABKAESPgo8zZOgfQVdyAFIjGLYlmVRDEm4k25w7b7uff7z6VK1W0QlHcHqXveuc2wL7VoD76BnqgT0C6UY3l2iqalzGgA=#1##\",\"encrypt_post_tel\":\"$o+GrGJidM5c0VEWIKPfzwjrgJJvnyAnBCrKy42/Puig=$HprTzY87R1gt1KIokYLexHyyImj2u85Vks+tb+cEe0HMKNXVLLB2lntDryhEN9K9rkhqU/sLcphmUSJiehCvZSIWXVJLlS3wlQ/y0/2ZFQ==*CgwIARCtHBiqICABKAESPgo8n3VNtx3wRxnHSK3rFN1837emZrTzKeL0GZKc/0ADgVOf8MuBRCNv4fedNyYFKOvIbIstKZsF0gm563L7GgA=$1$$\",\"post_receiver\":\"\",\"post_tel\":\"\",\"province\":{\"id\":\"33\",\"name\":\"浙江省\"},\"street\":{\"id\":\"3301100120000\",\"name\":\"仓前街道\"},\"town\":{\"id\":\"3301100000000\",\"name\":\"余杭区\"}},\"pur_order_id\":\"7303881914703020288\",\"sku_orders\":[{\"cargo_id\":3651912428658262186,\"cargo_sku_id\":3386515436144898,\"num\":2,\"outer_product_id\":\"712130508984\",\"outer_sku_id\":\"4987755988437\",\"product_id\":3651940874226638524,\"pur_sku_order_id\":\"7303881914703036672\",\"sku_id\":3386515436145410,\"sku_order_id\":\"6923971910449173607\"}]}],\"shop_id\":77977}"; BatchCreateParam param = JSON.parseObject(d, BatchCreateParam.class); BatchCreateData data = new BatchCreateData(); distributionOrderService.batchCreate(param, data); - System.out.println(param); + System.out.println(data); return ""; }