From 6439039923bec26e18c2f0747b08332809cb5e68 Mon Sep 17 00:00:00 2001 From: ljl Date: Tue, 14 Nov 2023 16:58:10 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dto/dsapi/response/DsSuccessRetDTO.java | 2 +- .../com/ms/api/dto/dsorder/RefundInfoDTO.java | 7 + .../com/ms/biz/consts/Refund1688Const.java | 2 +- .../java/com/ms/biz/paas/MqDemoService.java | 2 +- .../ms/biz/service/DoudianMessageService.java | 21 ++ .../impl/DistributionOrderServiceImpl.java | 53 ++++- .../impl/DoudianMessageServiceImpl.java | 53 +++++ .../service/impl/DsMessageServiceImpl.java | 51 +++-- .../com/ms/dal/entity/DoudianMessage.java | 60 ++++++ .../ms/dal/mapper/DoudianMessageMapper.java | 30 +++ .../ms/dal/mapper/PurchaseOrderMapper.java | 2 + .../src/main/resources/application.properties | 8 +- .../resources/mapper/DoudianMessageMapper.xml | 181 ++++++++++++++++++ .../mapper/PlatformPurchaseOrderMapper.xml | 4 +- .../mapper/PlatformPurchaseOrderSkuMapper.xml | 10 +- .../mapper/PurchaseOrderItemMapper.xml | 2 +- .../resources/mapper/PurchaseOrderMapper.xml | 8 +- .../ms/web/controller/OpenSPIController.java | 3 + .../main/java/com/ms/web/controller/Test.java | 68 ++++++- 19 files changed, 529 insertions(+), 38 deletions(-) create mode 100644 ms-biz/src/main/java/com/ms/biz/service/DoudianMessageService.java create mode 100644 ms-biz/src/main/java/com/ms/biz/service/impl/DoudianMessageServiceImpl.java create mode 100644 ms-dal/src/main/java/com/ms/dal/entity/DoudianMessage.java create mode 100644 ms-dal/src/main/java/com/ms/dal/mapper/DoudianMessageMapper.java create mode 100644 ms-dal/src/main/resources/mapper/DoudianMessageMapper.xml diff --git a/ms-api/src/main/java/com/ms/api/dto/dsapi/response/DsSuccessRetDTO.java b/ms-api/src/main/java/com/ms/api/dto/dsapi/response/DsSuccessRetDTO.java index 29258b0..abf784e 100644 --- a/ms-api/src/main/java/com/ms/api/dto/dsapi/response/DsSuccessRetDTO.java +++ b/ms-api/src/main/java/com/ms/api/dto/dsapi/response/DsSuccessRetDTO.java @@ -15,7 +15,7 @@ public class DsSuccessRetDTO { private String code; private String message; private Integer createAlibabaOrderLogId; - private Integer isEncryptOrder; + private String isEncryptOrder; private Integer isUseManualConsignee; private String flow; private Boolean includeSplitJxhy; diff --git a/ms-api/src/main/java/com/ms/api/dto/dsorder/RefundInfoDTO.java b/ms-api/src/main/java/com/ms/api/dto/dsorder/RefundInfoDTO.java index 0ac2839..67777cd 100644 --- a/ms-api/src/main/java/com/ms/api/dto/dsorder/RefundInfoDTO.java +++ b/ms-api/src/main/java/com/ms/api/dto/dsorder/RefundInfoDTO.java @@ -3,6 +3,7 @@ package com.ms.api.dto.dsorder; import lombok.Data; import java.util.Date; +import java.util.Map; @Data public class RefundInfoDTO { @@ -10,9 +11,15 @@ public class RefundInfoDTO { private String status; private String refundStatus; private Date gmtTimeOut; + private Integer goodsStatus; + private Integer refundPayment; + private Integer goodsReceived; private String rejectReason; + private Integer onlyRefund; + private Integer refundGoods; private String sellerMobile; private String sellerRealName; private String sellerReceiveAddress; private String sellerTel; + private Map orderEntryCountMap; } diff --git a/ms-biz/src/main/java/com/ms/biz/consts/Refund1688Const.java b/ms-biz/src/main/java/com/ms/biz/consts/Refund1688Const.java index 98ba59f..a4a172a 100644 --- a/ms-biz/src/main/java/com/ms/biz/consts/Refund1688Const.java +++ b/ms-biz/src/main/java/com/ms/biz/consts/Refund1688Const.java @@ -14,5 +14,5 @@ public class Refund1688Const { public static final String REFUND_STATUS_WAIT_BUYER_SEND = "waitbuyersend"; - public static final String REFUND_STATUS_WAIT_BUYER_RECEIVE = "waitsellerreceive"; + public static final String REFUND_STATUS_WAIT_SELLER_RECEIVE = "waitsellerreceive"; } diff --git a/ms-biz/src/main/java/com/ms/biz/paas/MqDemoService.java b/ms-biz/src/main/java/com/ms/biz/paas/MqDemoService.java index 628fa84..10403b0 100644 --- a/ms-biz/src/main/java/com/ms/biz/paas/MqDemoService.java +++ b/ms-biz/src/main/java/com/ms/biz/paas/MqDemoService.java @@ -25,7 +25,7 @@ import java.util.List; * date 2022/11/24 5:14 PM */ @Slf4j -@Component +//@Component public class MqDemoService implements ApplicationListener { private static final String TOPIC = MqFactory.generateProdTopic("miaoshougoods_test"); private static final String GROUP = "GID_miaoshougoods_test"; diff --git a/ms-biz/src/main/java/com/ms/biz/service/DoudianMessageService.java b/ms-biz/src/main/java/com/ms/biz/service/DoudianMessageService.java new file mode 100644 index 0000000..1b34156 --- /dev/null +++ b/ms-biz/src/main/java/com/ms/biz/service/DoudianMessageService.java @@ -0,0 +1,21 @@ +package com.ms.biz.service; + +import com.ms.dal.entity.DoudianMessage; + +/** + * + */ +public interface DoudianMessageService { + + int deleteByPrimaryKey(Long id); + + int insert(DoudianMessage record); + + int insertSelective(DoudianMessage record); + + DoudianMessage selectByPrimaryKey(Long id); + + int updateByPrimaryKeySelective(DoudianMessage record); + + int updateByPrimaryKey(DoudianMessage record); +} 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 7b35c3b..3c9dcf3 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 @@ -1,8 +1,10 @@ package com.ms.biz.service.impl; +import com.alibaba.fastjson.JSON; import com.doudian.open.api.supplyCenter_cargo_detail.data.SpecPricesItem; import com.doudian.open.api.supplyCenter_cargo_detail.data.SupplyCenterCargoDetailData; import com.doudian.open.api.supplyCenter_cargo_detail.param.SupplyCenterCargoDetailParam; +import com.doudian.open.api.supplyCenter_order_syncSupplierInfo.param.SupplierOrderUrl; import com.ms.api.dto.dsapi.request.*; import com.ms.api.dto.dsapi.response.*; import com.ms.api.dto.dsorder.PurchaseOrderDTO; @@ -24,13 +26,17 @@ import com.ms.dal.mapper.*; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.redis.core.RedisTemplate; import org.springframework.jdbc.datasource.DataSourceTransactionManager; import org.springframework.stereotype.Service; import org.springframework.transaction.TransactionDefinition; import org.springframework.transaction.TransactionStatus; +import java.math.BigDecimal; import java.text.SimpleDateFormat; import java.util.*; +import java.util.concurrent.TimeUnit; import java.util.stream.Collectors; @Service @@ -48,6 +54,9 @@ public class DistributionOrderServiceImpl implements DistributionOrderService { private PurchaseOrderItemMapper purchaseOrderItemMapper; private DsApiService dsApiService; + @Autowired + private RedisTemplate redisTemplate; + @Override public void batchCreate(BatchCreateParam param, BatchCreateData data) { System.out.println("param: " + param); @@ -77,6 +86,9 @@ 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); + List orderResults = new ArrayList<>(); List purchaseOrders = new ArrayList<>(); List purchaseOrderItems = new ArrayList<>(); @@ -85,7 +97,7 @@ public class DistributionOrderServiceImpl implements DistributionOrderService { String purOrderId = orderIdAndPurOrderIdMap.get(purchaseOrderDTO.getPlatformOrderId()); PurchaseOrder purchaseOrder = buildPurchaseOrderByDTO(purchaseOrderDTO, purOrderId); purchaseOrders.add(purchaseOrder); - List items = buildPurchaseOrderItemsByPurchaseOrderDTO(purchaseOrderDTO, purOrderId); + List items = buildPurchaseOrderItemsByPurchaseOrderDTO(purchaseOrder, purchaseOrderDTO, purOrderId); purchaseOrderItems.addAll(items); OrderResult orderResult = buildOrderResult(purchaseOrderDTO, orderIdAndPurOrderIdMap, skuIdAndPurSkuOrderIdMap); orderResults.add(orderResult); @@ -93,8 +105,8 @@ public class DistributionOrderServiceImpl implements DistributionOrderService { } data.setOrderResults(orderResults); - purchaseOrderItemMapper.insertBatch(purchaseOrderItems); purchaseOrderMapper.insertBatch(purchaseOrders); + purchaseOrderItemMapper.insertBatch(purchaseOrderItems); } private PurchaseOrder buildPurchaseOrderByDTO(PurchaseOrderDTO purchaseOrderDTO, String purOrderId) { @@ -112,13 +124,17 @@ public class DistributionOrderServiceImpl implements DistributionOrderService { throw new RuntimeException("时间格式错误"); } + String purchaseOrderId = generateOrderId("purchase_order"); + PurchaseOrder purchaseOrder = new PurchaseOrder(); + purchaseOrder.setPurchaseOrderId(Long.valueOf(purchaseOrderId)); purchaseOrder.setPurOrderId(purOrderId); purchaseOrder.setOrderId(Long.valueOf(purchaseOrderDTO.getPlatformOrderId())); purchaseOrder.setPurchasePlatform(purchaseOrderDTO.getPurchasePlatform()); purchaseOrder.setPurchaseOrderStatus(purchaseOrderDTO.getPurchaseOrderStatus()); purchaseOrder.setPurchaseOrderSendTime(purchaseOrderSendTime); purchaseOrder.setPurchaseOrderStartTime(purchaseOrderStartTime); + purchaseOrder.setPurchaseOrderPayment(BigDecimal.valueOf(0)); purchaseOrder.setPurchaseOrderBuyer(purchaseOrderDTO.getPurchaseOrderBuyer()); purchaseOrder.setPurchaseOrderSeller(purchaseOrderDTO.getPurchaseOrderSeller()); purchaseOrder.setLogisticsIsAccept(purchaseOrderDTO.getLogisticsIsAccept()); @@ -134,16 +150,18 @@ public class DistributionOrderServiceImpl implements DistributionOrderService { return purchaseOrder; } - private List buildPurchaseOrderItemsByPurchaseOrderDTO(PurchaseOrderDTO purchaseOrderDTO, String purOrderId) { + private List buildPurchaseOrderItemsByPurchaseOrderDTO(PurchaseOrder purchaseOrder, PurchaseOrderDTO purchaseOrderDTO, String purOrderId) { List items = new ArrayList<>(); for (PurchaseOrderItemDTO itemDTO: purchaseOrderDTO.getItems()) { PurchaseOrderItem item = new PurchaseOrderItem(); item.setPurOrderId(purOrderId); + item.setPurchaseOrderId(purchaseOrder.getPurchaseOrderId()); item.setOrderId(Long.valueOf(purchaseOrderDTO.getPlatformOrderId())); item.setPurchaseNum(itemDTO.getPurchaseNum()); item.setSkuId(itemDTO.getSkuId()); item.setWareId(itemDTO.getWareId()); - item.setPurchaseUrl(itemDTO.getPurchaseUrl()); + item.setPurchaseUrl(itemDTO.getPurchaseUrl() == null ? "" : itemDTO.getPurchaseUrl()); + item.setPurchasePrice(BigDecimal.valueOf(0)); item.setStatus(StatusConst.normal); item.setGmtCreate(new Date()); item.setGmtModified(new Date()); @@ -205,7 +223,12 @@ public class DistributionOrderServiceImpl implements DistributionOrderService { orderResult.setOutPreOrderId(""); // TODO 无此参数 orderResult.setPurOrderId(orderIdAndPurOrderIdMap.get(purchaseOrder.getPlatformOrderId())); orderResult.setSupplierOrderId(purchaseOrder.getPurchaseOrderSn()); - orderResult.setSupplierOrderUrl(null); + + OrderResult.SupplierOrderUrl supplierOrderUrl = new OrderResult.SupplierOrderUrl(); + String url = String.format("https://trade.1688.com/order/new_step_order_detail.htm?orderId=%s&amug_web_biz=fwmkt&amug_web_fl_src=cy", purchaseOrder.getPurchaseOrderSn()); + supplierOrderUrl.setH5Url(url); + supplierOrderUrl.setPcUrl(url); + orderResult.setSupplierOrderUrl(supplierOrderUrl); List skuOrderResults = new ArrayList<>(); for (PurchaseOrderItemDTO item: purchaseOrder.getItems()) { @@ -324,9 +347,11 @@ public class DistributionOrderServiceImpl implements DistributionOrderService { consigneeInfo.setCountyAreaId(Integer.valueOf(address.getTown().getId())); consigneeInfo.setTown(address.getStreet().getName()); consigneeInfo.setTownAreaId(Integer.valueOf(address.getStreet().getId())); - consigneeInfo.setFullAddress(""); consigneeInfo.setFullname(address.getPostReceiver()); consigneeInfo.setMobile(address.getPostTel()); + + String fullAddress = String.format("%s%s%s%s%s", consigneeInfo.getProvince(), consigneeInfo.getCity(), consigneeInfo.getCounty(), consigneeInfo.getTown(), consigneeInfo.getAddress()); + consigneeInfo.setFullAddress(fullAddress); return consigneeInfo; } @@ -435,14 +460,17 @@ public class DistributionOrderServiceImpl implements DistributionOrderService { throw new RuntimeException("每次只能请求1个采购单"); } + String purOrderId = param.getParams().get(0).getPurOrderId(); PlatformPurchaseOrder platformPurchaseOrder = platformPurchaseOrderMapper.selectByPrimaryKey(param.getParams().get(0).getPurOrderId()); if (platformPurchaseOrder == null) { throw new RuntimeException("采购单不存在"); } + PurchaseOrder purchaseOrder = purchaseOrderMapper.getByPurOrderId(purOrderId); + List paymentResults = new ArrayList<>(); for (BatchPayParam.Param p: param.getParams()) { - GetPurchaseOrderPayUrlResponseDTO response = dsApiService.getPurchaseOrderPayUrl(Collections.singletonList(p.getPurOrderId()), p.getShopId()); + GetPurchaseOrderPayUrlResponseDTO response = dsApiService.getPurchaseOrderPayUrl(Collections.singletonList(purchaseOrder.getPurchaseOrderSn()), p.getShopId()); if (response.isSuccess()) { PaymentResult paymentResult = new PaymentResult(); PaymentResult.PayUrl payUrl = new PaymentResult.PayUrl(); @@ -463,4 +491,15 @@ public class DistributionOrderServiceImpl implements DistributionOrderService { } data.setPaymentResults(paymentResults); } + + public String generateOrderId(String type) { + Date date = new Date(); + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddhhmm00"); + String dateKey = dateFormat.format(date); + String key = type + ":" + dateKey; + Long value = redisTemplate.opsForValue().increment(key, 1); + redisTemplate.expire(key, 1, TimeUnit.MINUTES); + SimpleDateFormat dateFormat1 = new SimpleDateFormat("yyyyMMddhhmmss"); + return dateFormat1.format(date) + String.format("%1$04d", value); + } } diff --git a/ms-biz/src/main/java/com/ms/biz/service/impl/DoudianMessageServiceImpl.java b/ms-biz/src/main/java/com/ms/biz/service/impl/DoudianMessageServiceImpl.java new file mode 100644 index 0000000..f1c1bf0 --- /dev/null +++ b/ms-biz/src/main/java/com/ms/biz/service/impl/DoudianMessageServiceImpl.java @@ -0,0 +1,53 @@ +package com.ms.biz.service.impl; + +import com.ms.dal.entity.DoudianMessage; +import com.ms.biz.service.DoudianMessageService; +import com.ms.dal.mapper.DoudianMessageMapper; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + + +/** + * + */ +@Service +public class DoudianMessageServiceImpl implements DoudianMessageService{ + + @Autowired + private DoudianMessageMapper doudianMessageMapper; + + @Override + public int deleteByPrimaryKey(Long id) { + return doudianMessageMapper.deleteByPrimaryKey(id); + } + + @Override + public int insert(DoudianMessage record) { + return doudianMessageMapper.insert(record); + } + + @Override + public int insertSelective(DoudianMessage record) { + return doudianMessageMapper.insertSelective(record); + } + + @Override + public DoudianMessage selectByPrimaryKey(Long id) { + return doudianMessageMapper.selectByPrimaryKey(id); + } + + @Override + public int updateByPrimaryKeySelective(DoudianMessage record) { + return doudianMessageMapper.updateByPrimaryKeySelective(record); + } + + @Override + public int updateByPrimaryKey(DoudianMessage record) { + return doudianMessageMapper.updateByPrimaryKey(record); + } + +} + + + + diff --git a/ms-biz/src/main/java/com/ms/biz/service/impl/DsMessageServiceImpl.java b/ms-biz/src/main/java/com/ms/biz/service/impl/DsMessageServiceImpl.java index 3b8b2af..9d0d3e2 100644 --- a/ms-biz/src/main/java/com/ms/biz/service/impl/DsMessageServiceImpl.java +++ b/ms-biz/src/main/java/com/ms/biz/service/impl/DsMessageServiceImpl.java @@ -14,6 +14,7 @@ import com.doudian.open.api.supplyCenter_refund_operate.param.SkuRefundInfosItem import com.doudian.open.api.supplyCenter_refund_operate.param.SupplyCenterRefundOperateParam; import com.ms.biz.consts.DsMessageConst; import com.ms.biz.consts.PurchaseOrderConst; +import com.ms.biz.consts.Refund1688Const; import com.ms.biz.consts.StatusConst; import com.ms.biz.service.DsMessageConsumerBufferService; import com.ms.biz.service.DsMessageConsumerQueueService; @@ -327,7 +328,7 @@ public class DsMessageServiceImpl implements DsMessageService { DDApi.supplyCenterRefundOperate(param); } - private static SkuRefundInfosItem buildSkuRefundInfosItem(RefundInfoDTO refundInfo) { + private SkuRefundInfosItem buildSkuRefundInfosItem(RefundInfoDTO refundInfo) { Address address = new Address(); address.setUserName(refundInfo.getSellerRealName()); address.setDetail(refundInfo.getSellerReceiveAddress()); @@ -337,18 +338,40 @@ public class DsMessageServiceImpl implements DsMessageService { skuRefundInfosItem.setRejectReason(refundInfo.getRejectReason()); skuRefundInfosItem.setAddress(address); skuRefundInfosItem.setCloseReason(""); - skuRefundInfosItem.setOperationType(1); - skuRefundInfosItem.setAftersaleType(1L); + skuRefundInfosItem.setOperationType(getOperateType(refundInfo)); + skuRefundInfosItem.setAftersaleType((long) getAftersaleType(refundInfo)); return skuRefundInfosItem; } - private int getOperateType(String refundStatus) { - /*Refund1688Const.REFUND_STATUS_WAIT_SELLER_AGREE 0 - Refund1688Const.REFUND_STATUS_WAIT_BUYER_SEND 2 - Refund1688Const.REFUND_STATUS_WAIT_BUYER_RECEIVE 4 - Refund1688Const.REFUND_STATUS_REFUND_CLOSE 5 - Refund1688Const.REFUND_STATUS_REFUND_CLOSE 3*/ - return 0; + private int getOperateType(RefundInfoDTO refundInfo) { + int operateType = 0; + if (refundInfo.getStatus().equals(Refund1688Const.REFUND_STATUS_WAIT_SELLER_AGREE)) { + operateType = 0; + } else if (refundInfo.getStatus().equals(Refund1688Const.REFUND_STATUS_WAIT_BUYER_SEND)) { + operateType = 2; + } else if (refundInfo.getStatus().equals(Refund1688Const.REFUND_STATUS_WAIT_SELLER_RECEIVE)) { + operateType = 2; + } else if (refundInfo.getOnlyRefund() == 1 && refundInfo.getStatus().equals(Refund1688Const.REFUND_STATUS_REFUND_SUCCESS)) { + operateType = 1; + } else if (refundInfo.getOnlyRefund() == 0 && refundInfo.getGoodsStatus() == 3 && refundInfo.getStatus().equals(Refund1688Const.REFUND_STATUS_REFUND_SUCCESS)) { + operateType = 6; + } else if (refundInfo.getOnlyRefund() == 0 && refundInfo.getGoodsStatus() == 3 && refundInfo.getStatus().equals(Refund1688Const.REFUND_STATUS_REFUND_CLOSE)) { + operateType = 7; + } else if (refundInfo.getOnlyRefund() == 1 && refundInfo.getStatus().equals(Refund1688Const.REFUND_STATUS_REFUND_CLOSE)) { + operateType = 3; + } else if (refundInfo.getStatus().equals(Refund1688Const.REFUND_STATUS_REFUND_CLOSE)) { + operateType = 3; + } + return operateType; + } + + private int getAftersaleType(RefundInfoDTO refundInfo) { + if (refundInfo.getOnlyRefund() == 1 && refundInfo.getGoodsReceived() == 1) { + return 1; + } else if (refundInfo.getOnlyRefund() == 1 && refundInfo.getGoodsReceived() == 0) { + return 2; + } + return 3; } private void handlePurchaseOrderCancel(PurchaseOrderCancelMessageDTO messageDTO) { @@ -364,15 +387,21 @@ public class DsMessageServiceImpl implements DsMessageService { SupplyCenterOrderSyncSupplierInfoParam param = new SupplyCenterOrderSyncSupplierInfoParam(); param.setPurOrderId(platformPurchaseOrder.getPurOrderId()); param.setSupplierOrderId(purchaseOrderDTO.getPurchaseOrderSn()); - param.setSupplierOrderUrl(new SupplierOrderUrl()); + SupplierOrderUrl supplierOrderUrl = new SupplierOrderUrl(); + String url = String.format("https://trade.1688.com/order/new_step_order_detail.htm?orderId=%s&amug_web_biz=fwmkt&amug_web_fl_src=cy", purchaseOrderDTO.getPurchaseOrderSn()); + supplierOrderUrl.setH5Url(url); + supplierOrderUrl.setPcUrl(url); + param.setSupplierOrderUrl(supplierOrderUrl); List skuOrders = new ArrayList<>(); for (PurchaseOrderItemDTO item: purchaseOrderDTO.getItems()) { PlatformPurchaseOrderSku platformPurchaseOrderSku = skuIdAndPlatformPurchaseOrderSkuMap.get(item.getSkuId()); SkuOrdersItem skuOrdersItem = new SkuOrdersItem(); skuOrdersItem.setPurSkuOrderId(platformPurchaseOrderSku.getPurSkuOrderId()); skuOrdersItem.setSupplierSkuOrderId(item.getSubItemId()); + skuOrders.add(skuOrdersItem); } param.setSkuOrders(skuOrders); + DDApi.supplyCenterOrderSyncSupplierInfo(param); } } diff --git a/ms-dal/src/main/java/com/ms/dal/entity/DoudianMessage.java b/ms-dal/src/main/java/com/ms/dal/entity/DoudianMessage.java new file mode 100644 index 0000000..1d0ee45 --- /dev/null +++ b/ms-dal/src/main/java/com/ms/dal/entity/DoudianMessage.java @@ -0,0 +1,60 @@ +package com.ms.dal.entity; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** + * 抖店订单消息 + * @TableName doudian_message + */ +@Data +public class DoudianMessage implements Serializable { + /** + * 自增id + */ + private Long doudianMessageId; + + /** + * 官方的消息id + */ + private String msgId; + + /** + * 店铺id + */ + private Long shopId; + + /** + * 消息类型 + */ + private Integer tag; + + /** + * 消息内容 json + */ + private String data; + + /** + * 消息处理状态 + */ + private String status; + + /** + * 消息处理失败原因 + */ + private String reason; + + /** + * 创建时间 + */ + private Date gmtCreate; + + /** + * 修改时间 + */ + private Date gmtModified; + + private static final long serialVersionUID = 1L; +} \ No newline at end of file diff --git a/ms-dal/src/main/java/com/ms/dal/mapper/DoudianMessageMapper.java b/ms-dal/src/main/java/com/ms/dal/mapper/DoudianMessageMapper.java new file mode 100644 index 0000000..59d4f67 --- /dev/null +++ b/ms-dal/src/main/java/com/ms/dal/mapper/DoudianMessageMapper.java @@ -0,0 +1,30 @@ +package com.ms.dal.mapper; + +import com.ms.dal.entity.DoudianMessage; +import com.ms.dal.entity.PlatformPurchaseOrderSku; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + +/** + * @Entity com.ms.dal.entity.DoudianMessage + */ +@Mapper +public interface DoudianMessageMapper { + + int deleteByPrimaryKey(Long id); + + int insert(DoudianMessage record); + + int insertOrUpdate(DoudianMessage record); + + int insertSelective(DoudianMessage record); + + DoudianMessage selectByPrimaryKey(Long id); + + int updateByPrimaryKeySelective(DoudianMessage record); + + int updateByPrimaryKey(DoudianMessage record); + + int insertBatch(List list); +} diff --git a/ms-dal/src/main/java/com/ms/dal/mapper/PurchaseOrderMapper.java b/ms-dal/src/main/java/com/ms/dal/mapper/PurchaseOrderMapper.java index 8ab3f43..8df0b42 100644 --- a/ms-dal/src/main/java/com/ms/dal/mapper/PurchaseOrderMapper.java +++ b/ms-dal/src/main/java/com/ms/dal/mapper/PurchaseOrderMapper.java @@ -30,4 +30,6 @@ public interface PurchaseOrderMapper { int insertBatch(List list); PurchaseOrder getByPurchaseOrderSn(@Param("purchaseOrderSn") String purchaseOrderSn); + + PurchaseOrder getByPurOrderId(@Param("purOrderId") String purOrderId); } diff --git a/ms-dal/src/main/resources/application.properties b/ms-dal/src/main/resources/application.properties index 4604c98..c4b6be6 100644 --- a/ms-dal/src/main/resources/application.properties +++ b/ms-dal/src/main/resources/application.properties @@ -22,12 +22,12 @@ mybatis.mapper-locations=classpath*:mapper/*.xml mybatis.configuration.log-impl=org.apache.ibatis.logging.slf4j.Slf4jImpl mybatis.configuration.map-underscore-to-camel-case=true -#cloud.app.key=7290512081592305208 -#cloud.app.secret=d21bf43e-c671-4fa5-b35a-762a9c775129 +cloud.app.key=7290512081592305208 +cloud.app.secret=d21bf43e-c671-4fa5-b35a-762a9c775129 # boe -cloud.app.key=7296606199200499244 -cloud.app.secret=0063975e-7755-4d51-8255-ad163604456f +#cloud.app.key=7296606199200499244 +#cloud.app.secret=0063975e-7755-4d51-8255-ad163604456f #spring.redis.host=r-2zext1mz5bw1hsochrpd.redis.rds.aliyuncs.com #spring.redis.port=6379 diff --git a/ms-dal/src/main/resources/mapper/DoudianMessageMapper.xml b/ms-dal/src/main/resources/mapper/DoudianMessageMapper.xml new file mode 100644 index 0000000..36f2440 --- /dev/null +++ b/ms-dal/src/main/resources/mapper/DoudianMessageMapper.xml @@ -0,0 +1,181 @@ + + + + + + + + + + + + + + + + + + doudian_message_id,msg_id,shop_id, + tag,data,status, + reason,gmt_create,gmt_modified + + + + + + delete from doudian_message + where doudian_message_id = #{doudianMessageId,jdbcType=BIGINT} + + + insert into doudian_message + ( doudian_message_id,msg_id,shop_id + ,tag,data,status + ,reason,gmt_create,gmt_modified + ) + values (#{doudianMessageId,jdbcType=BIGINT},#{msgId,jdbcType=VARCHAR},#{shopId,jdbcType=BIGINT} + ,#{tag,jdbcType=SMALLINT},#{data,jdbcType=VARCHAR},#{status,jdbcType=VARCHAR} + ,#{reason,jdbcType=VARCHAR},#{gmtCreate,jdbcType=TIMESTAMP},#{gmtModified,jdbcType=TIMESTAMP} + ) + + + insert into doudian_message + + doudian_message_id, + msg_id, + shop_id, + tag, + data, + status, + reason, + gmt_create, + gmt_modified, + + + #{doudianMessageId,jdbcType=BIGINT}, + #{msgId,jdbcType=VARCHAR}, + #{shopId,jdbcType=BIGINT}, + #{tag,jdbcType=SMALLINT}, + #{data,jdbcType=VARCHAR}, + #{status,jdbcType=VARCHAR}, + #{reason,jdbcType=VARCHAR}, + #{gmtCreate,jdbcType=TIMESTAMP}, + #{gmtModified,jdbcType=TIMESTAMP}, + + ON DUPLICATE KEY UPDATE + + + msg_id = #{msgId,jdbcType=VARCHAR}, + + + shop_id = #{shopId,jdbcType=BIGINT}, + + + tag = #{tag,jdbcType=SMALLINT}, + + + data = #{data,jdbcType=VARCHAR}, + + + status = #{status,jdbcType=VARCHAR}, + + + reason = #{reason,jdbcType=VARCHAR}, + + + gmt_create = #{gmtCreate,jdbcType=TIMESTAMP}, + + + gmt_modified = #{gmtModified,jdbcType=TIMESTAMP}, + + + + + insert into doudian_message + + doudian_message_id, + msg_id, + shop_id, + tag, + data, + status, + reason, + gmt_create, + gmt_modified, + + + #{doudianMessageId,jdbcType=BIGINT}, + #{msgId,jdbcType=VARCHAR}, + #{shopId,jdbcType=BIGINT}, + #{tag,jdbcType=SMALLINT}, + #{data,jdbcType=VARCHAR}, + #{status,jdbcType=VARCHAR}, + #{reason,jdbcType=VARCHAR}, + #{gmtCreate,jdbcType=TIMESTAMP}, + #{gmtModified,jdbcType=TIMESTAMP}, + + + + update doudian_message + + + msg_id = #{msgId,jdbcType=VARCHAR}, + + + shop_id = #{shopId,jdbcType=BIGINT}, + + + tag = #{tag,jdbcType=SMALLINT}, + + + data = #{data,jdbcType=VARCHAR}, + + + status = #{status,jdbcType=VARCHAR}, + + + reason = #{reason,jdbcType=VARCHAR}, + + + gmt_create = #{gmtCreate,jdbcType=TIMESTAMP}, + + + gmt_modified = #{gmtModified,jdbcType=TIMESTAMP}, + + + where doudian_message_id = #{doudianMessageId,jdbcType=BIGINT} + + + update doudian_message + set + msg_id = #{msgId,jdbcType=VARCHAR}, + shop_id = #{shopId,jdbcType=BIGINT}, + tag = #{tag,jdbcType=SMALLINT}, + data = #{data,jdbcType=VARCHAR}, + status = #{status,jdbcType=VARCHAR}, + reason = #{reason,jdbcType=VARCHAR}, + gmt_create = #{gmtCreate,jdbcType=TIMESTAMP}, + gmt_modified = #{gmtModified,jdbcType=TIMESTAMP} + where doudian_message_id = #{doudianMessageId,jdbcType=BIGINT} + + + insert into doudian_message + (doudian_message_id,msg_id,shop_id + ,tag,data,status + ,reason,gmt_create,gmt_modified) + values + + (#{item.doudianMessageId,jdbcType=BIGINT},#{msgId,jdbcType=VARCHAR},#{item.shopId,jdbcType=BIGINT} + ,#{item.tag,jdbcType=SMALLINT},#{item.data,jdbcType=VARCHAR},#{item.status,jdbcType=VARCHAR} + ,#{item.reason,jdbcType=VARCHAR},#{item.gmtCreate,jdbcType=TIMESTAMP},#{item.gmtModified,jdbcType=TIMESTAMP} + ) + + + diff --git a/ms-dal/src/main/resources/mapper/PlatformPurchaseOrderMapper.xml b/ms-dal/src/main/resources/mapper/PlatformPurchaseOrderMapper.xml index 2e86ac3..743f94d 100644 --- a/ms-dal/src/main/resources/mapper/PlatformPurchaseOrderMapper.xml +++ b/ms-dal/src/main/resources/mapper/PlatformPurchaseOrderMapper.xml @@ -28,7 +28,7 @@ gmt_modified - select from platform_purchase_order @@ -52,7 +52,7 @@ - + delete from platform_purchase_order where pur_order_id = #{purOrderId,jdbcType=VARCHAR} diff --git a/ms-dal/src/main/resources/mapper/PlatformPurchaseOrderSkuMapper.xml b/ms-dal/src/main/resources/mapper/PlatformPurchaseOrderSkuMapper.xml index db974cb..7ec013b 100644 --- a/ms-dal/src/main/resources/mapper/PlatformPurchaseOrderSkuMapper.xml +++ b/ms-dal/src/main/resources/mapper/PlatformPurchaseOrderSkuMapper.xml @@ -22,20 +22,20 @@ pur_sku_order_id,pur_order_id,shop_id, - sku_order_id,out_product_id,out_sku_id, + sku_order_id,outer_product_id,outer_sku_id, cargo_id,cargo_sku_id,product_id, sku_id,num,gmt_create, gmt_modified - select from platform_purchase_order_sku where pur_sku_order_id = #{purSkuOrderId,jdbcType=VARCHAR} - + delete from platform_purchase_order_sku where pur_sku_order_id = #{purSkuOrderId,jdbcType=VARCHAR} @@ -97,10 +97,10 @@ sku_order_id = #{skuOrderId,jdbcType=VARCHAR}, - out_product_id = #{outProductId,jdbcType=VARCHAR}, + outer_product_id = #{outProductId,jdbcType=VARCHAR}, - out_sku_id = #{outSkuId,jdbcType=VARCHAR}, + outer_sku_id = #{outSkuId,jdbcType=VARCHAR}, cargo_id = #{cargoId,jdbcType=BIGINT}, diff --git a/ms-dal/src/main/resources/mapper/PurchaseOrderItemMapper.xml b/ms-dal/src/main/resources/mapper/PurchaseOrderItemMapper.xml index 02a7adc..91a04cc 100644 --- a/ms-dal/src/main/resources/mapper/PurchaseOrderItemMapper.xml +++ b/ms-dal/src/main/resources/mapper/PurchaseOrderItemMapper.xml @@ -213,7 +213,7 @@ values (#{item.purchaseOrderItemId,jdbcType=BIGINT},#{item.purchaseOrderId,jdbcType=BIGINT},#{item.orderId,jdbcType=BIGINT} - ,#{purOrderId,jdbcType=VARCHAR},#{item.wareId,jdbcType=BIGINT},#{item.skuId,jdbcType=BIGINT},#{item.purchaseUrl,jdbcType=VARCHAR} + ,#{item.purOrderId,jdbcType=VARCHAR},#{item.wareId,jdbcType=BIGINT},#{item.skuId,jdbcType=BIGINT},#{item.purchaseUrl,jdbcType=VARCHAR} ,#{item.purchasePrice,jdbcType=DECIMAL},#{item.purchaseNum,jdbcType=SMALLINT},#{item.status,jdbcType=VARCHAR} ,#{item.gmtCreate,jdbcType=TIMESTAMP},#{item.gmtModified,jdbcType=TIMESTAMP}) diff --git a/ms-dal/src/main/resources/mapper/PurchaseOrderMapper.xml b/ms-dal/src/main/resources/mapper/PurchaseOrderMapper.xml index 226f88d..10fe90e 100644 --- a/ms-dal/src/main/resources/mapper/PurchaseOrderMapper.xml +++ b/ms-dal/src/main/resources/mapper/PurchaseOrderMapper.xml @@ -49,6 +49,12 @@ from purchase_order where purchase_order_sn = #{purchaseOrderSn,jdbcType=VARCHAR} + delete from purchase_order @@ -324,7 +330,7 @@ ,gmt_modified) values - (#{item.purchaseOrderId,jdbcType=BIGINT},#{item.orderId,jdbcType=BIGINT},#{item.purchasePlatform,jdbcType=VARCHAR},#{purOrderId,jdbcType=VARCHAR} + (#{item.purchaseOrderId,jdbcType=BIGINT},#{item.orderId,jdbcType=BIGINT},#{item.purchasePlatform,jdbcType=VARCHAR},#{item.purOrderId,jdbcType=VARCHAR} ,#{item.purchaseOrderSn,jdbcType=VARCHAR},#{item.purchaseOrderBuyer,jdbcType=VARCHAR},#{item.purchaseOrderSeller,jdbcType=VARCHAR} ,#{item.purchaseOrderPayment,jdbcType=DECIMAL},#{item.purchaseOrderStatus,jdbcType=VARCHAR},#{item.purchaseOrderLogisticsName,jdbcType=VARCHAR} ,#{item.purchaseOrderWaybillCode,jdbcType=VARCHAR},#{item.purchaseOrderSendTime,jdbcType=TIMESTAMP},#{item.purchaseOrderFullname,jdbcType=VARCHAR} diff --git a/ms-web/src/main/java/com/ms/web/controller/OpenSPIController.java b/ms-web/src/main/java/com/ms/web/controller/OpenSPIController.java index 4b64962..a83429d 100644 --- a/ms-web/src/main/java/com/ms/web/controller/OpenSPIController.java +++ b/ms-web/src/main/java/com/ms/web/controller/OpenSPIController.java @@ -37,6 +37,7 @@ public class OpenSPIController { private final DoudianOpSpiBizHandler querySupplyPlatformAuthBizHandler = context -> { QuerySupplyPlatformAuthParam param = context.getParam(); + System.out.println("param" + param); QuerySupplyPlatformAuthData data = context.getData(); try { shopService.querySupplyPlatformAuth(param, data); @@ -55,6 +56,7 @@ public class OpenSPIController { private final DoudianOpSpiBizHandler batchCreateBizHandler = context -> { BatchCreateParam param = context.getParam(); + System.out.println("param" + param); BatchCreateData data = context.getData(); try { distributionOrderService.batchCreate(param, data); @@ -68,6 +70,7 @@ public class OpenSPIController { @RequestMapping(path = "supplyCenter/order/batchPay" , method = {RequestMethod.POST}) @ResponseBody public String batchPay(HttpServletRequest httpServletRequest) { + System.out.println(httpServletRequest); return DoudianOpSpi.config(BatchCreateRequest.class, batchPayBizHandler, httpServletRequest).responseJson(); } 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 5434dc0..6c285f1 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 @@ -14,9 +14,15 @@ import com.ms.api.dto.dsapi.response.GetSourceItemInfosResponseDTO; import com.ms.biz.common.R; import com.ms.biz.common.Ret; import com.ms.api.dto.dsorder.DsMessageCallbackDTO; +import com.ms.biz.dto.openspi.request.BatchCreateParam; +import com.ms.biz.dto.openspi.request.BatchPayParam; +import com.ms.biz.dto.openspi.response.BatchCreateData; +import com.ms.biz.dto.openspi.response.BatchPayData; +import com.ms.biz.dto.openspi.response.QuerySupplyPlatformAuthData; import com.ms.biz.service.*; import com.ms.biz.tool.CommonTool; import com.ms.biz.util.DDApi; +import com.ms.dal.entity.DsMessageConsumerQueue; import lombok.Data; import lombok.extern.slf4j.Slf4j; import org.apache.http.client.utils.DateUtils; @@ -52,6 +58,12 @@ public class Test { @Autowired private DsApiService dsApiService; + @Autowired + private DistributionOrderService distributionOrderService; + + @Autowired + private DsMessageConsumerQueueService dsMessageConsumerQueueService; + @GetMapping("/hello") public String hello(@RequestParam(value = "name", defaultValue = "World") String name) { return String.format("Hello %s!", name); @@ -99,6 +111,22 @@ public class Test { } public static void main(String[] args) throws ParseException { + + Long value = 1L; + Date date = new Date(); + SimpleDateFormat dateFormat1 = new SimpleDateFormat("yyyyMMddhhmm00"); + + System.out.println(dateFormat1.format(date) + String.format("%1$04d", value)); + + String d = "{\"orders\":[{\"pur_order_id\":\"7299756498531418412\",\"order_id\":\"6917543139367389081\",\"post_address\":{\"province\":{\"id\":\"11\",\"name\":\"北京市\"},\"city\":{\"id\":\"110000\",\"name\":\"北京市\"},\"town\":{\"id\":\"110108\",\"name\":\"海淀区\"},\"street\":{\"id\":\"110108012\",\"name\":\"海淀街道\"},\"encrypt_detail\":\"MC8EEAjx7GdmeypB6WkV9DrpH9sEGWv8lSI1N1i9SaxcxKw1aW4waq481ueqVRcEAA==\",\"post_tel\":\"MCEEEDyPE4U3H7NDrnVhSgGOPzsEC9mVHEzJYMyY91uJBAA=\",\"post_receiver\":\"MCgEEHlttu0OuRqxJ3AaFAEvpr8EEjMU+9kRHPkU+MiXyD4zIkdVMgQA\"},\"mask_post_address\":{\"province\":{\"id\":\"11\",\"name\":\"北京市\"},\"city\":{\"id\":\"110000\",\"name\":\"北京市\"},\"town\":{\"id\":\"110108\",\"name\":\"海淀区\"},\"street\":{\"id\":\"110108012\",\"name\":\"海淀街道\"},\"detail\":\"互联*******\",\"post_tel\":\"1********00\",\"post_receiver\":\"电*****\"},\"sku_orders\":[{\"pur_sku_order_id\":\"7299756498531451180\",\"sku_order_id\":\"6917543139367389081\",\"cargo_id\":3649687424122130945,\"cargo_sku_id\":3659175936152832,\"product_id\":3649883085652281308,\"sku_id\":3659175955997568,\"num\":1,\"outer_product_id\":\"686872273204\",\"outer_sku_id\":\"4897420288982\"}]}],\"shop_id\":1111502210}"; + System.out.println(JSON.parseObject(d)); + + QuerySupplyPlatformAuthData data = new QuerySupplyPlatformAuthData(); + data.setAuthUrl("abc"); + data.setAuthorized(false); + System.out.println(JSON.toJSONString(data)); + System.out.println(JSON.parseObject(JSON.toJSONString(data))); + String str = "{\"data\":\"{\\\"activity_id\\\":\\\"0\\\",\\\"after\\\":\\\"false\\\",\\\"before\\\":\\\"true\\\",\\\"channel_id\\\":\\\"0\\\",\\\"channel_type\\\":0,\\\"process_time\\\":1699455945,\\\"product_id\\\":\\\"3649553844716833566\\\",\\\"shop_id\\\":\\\"121233657\\\",\\\"sku_id\\\":\\\"3384401776121602\\\"}\",\"tag\":\"420\",\"msg_id\":\"66533861744835594630:0:420:1699455945:2560971988:7264840234423027259\"}"; DoudianMessage msg = JSON.parseObject(str, DoudianMessage.class); System.out.println(msg); @@ -162,22 +190,22 @@ public class Test { } @PostMapping("/getAuthInfo") - public String getAuthInfo() { - GetAuthInfoResponseDTO responseDTO = dsApiService.getAuthInfo(30459766L); + public String getAuthInfo() { // 30459766L + GetAuthInfoResponseDTO responseDTO = dsApiService.getAuthInfo(1111502210L); System.out.println(responseDTO); return ""; } @PostMapping("/getAuthShopMemberInfos") public String getAuthShopMemberInfos() { - GetAuthShopMemberInfosResponseDTO responseDTO = dsApiService.getAuthShopMemberInfos(30459766L); + GetAuthShopMemberInfosResponseDTO responseDTO = dsApiService.getAuthShopMemberInfos(1111502210L); System.out.println(responseDTO); return ""; } @PostMapping("/checkDsAppAuthExpire") public String checkDsAppAuthExpire() { - CheckDsAppAuthExpireResponseDTO responseDTO = dsApiService.checkDsAppAuthExpire(4463798L, "b2b-221123084407697b20", ""); + CheckDsAppAuthExpireResponseDTO responseDTO = dsApiService.checkDsAppAuthExpire(16412356L, "", ""); System.out.println(responseDTO); return ""; } @@ -197,4 +225,36 @@ public class Test { System.out.println(responseDTO); return ""; } + + @RequestMapping("/ttt") + public String ttt() { + String d = "{\"orders\":[{\"pur_order_id\":\"7299756498531418412\",\"order_id\":\"6917543139367389081\",\"post_address\":{\"province\":{\"id\":\"11\",\"name\":\"北京市\"},\"city\":{\"id\":\"110000\",\"name\":\"北京市\"},\"town\":{\"id\":\"110108\",\"name\":\"海淀区\"},\"street\":{\"id\":\"110108012\",\"name\":\"海淀街道\"},\"encrypt_detail\":\"MC8EEAjx7GdmeypB6WkV9DrpH9sEGWv8lSI1N1i9SaxcxKw1aW4waq481ueqVRcEAA==\",\"post_tel\":\"MCEEEDyPE4U3H7NDrnVhSgGOPzsEC9mVHEzJYMyY91uJBAA=\",\"post_receiver\":\"MCgEEHlttu0OuRqxJ3AaFAEvpr8EEjMU+9kRHPkU+MiXyD4zIkdVMgQA\"},\"mask_post_address\":{\"province\":{\"id\":\"11\",\"name\":\"北京市\"},\"city\":{\"id\":\"110000\",\"name\":\"北京市\"},\"town\":{\"id\":\"110108\",\"name\":\"海淀区\"},\"street\":{\"id\":\"110108012\",\"name\":\"海淀街道\"},\"detail\":\"互联*******\",\"post_tel\":\"1********00\",\"post_receiver\":\"电*****\"},\"sku_orders\":[{\"pur_sku_order_id\":\"7299756498531451180\",\"sku_order_id\":\"6917543139367389081\",\"cargo_id\":3649687424122130945,\"cargo_sku_id\":3659175936152832,\"product_id\":3649883085652281308,\"sku_id\":3659175955997568,\"num\":1,\"outer_product_id\":\"686872273204\",\"outer_sku_id\":\"4897420288982\"}]}],\"shop_id\":1111502210}"; + BatchCreateParam param = JSON.parseObject(d, BatchCreateParam.class); + BatchCreateData data = new BatchCreateData(); + distributionOrderService.batchCreate(param, data); + return ""; + } + + @RequestMapping("/batchPay") + public String batchPay() { + String d = "{\"params\":{\"pur_order_id\":\"7299756498531418412\"},\"shop_id\":1111502210}"; + BatchPayParam param = JSON.parseObject(d, BatchPayParam.class); + BatchPayData data = new BatchPayData(); + distributionOrderService.batchPay(param, data); + return ""; + } + + @RequestMapping("/moveMsg") + public String moveMsg() { + dsMessageConsumerQueueService.moveBufferToSolidRedisQueue(2000); + return ""; + } + + @RequestMapping("/consumeMsg") + public String consumeMsg() { + DsMessageConsumerQueue queue = dsMessageConsumerQueueService.lockSolidRedisQueue(0L, false); + dsMessageService.processDsMessage(queue.getDsMessageId()); + return ""; + } + }