diff --git a/ms-biz/src/main/java/com/ms/biz/dto/openspi/response/BatchCreateData.java b/ms-biz/src/main/java/com/ms/biz/dto/openspi/response/BatchCreateData.java index 0b871cd..201a521 100644 --- a/ms-biz/src/main/java/com/ms/biz/dto/openspi/response/BatchCreateData.java +++ b/ms-biz/src/main/java/com/ms/biz/dto/openspi/response/BatchCreateData.java @@ -1,5 +1,6 @@ package com.ms.biz.dto.openspi.response; +import com.alibaba.fastjson.annotation.JSONField; import com.doudian.open.gson.annotations.SerializedName; import lombok.Data; @@ -7,6 +8,7 @@ import java.util.List; @Data public class BatchCreateData { + @JSONField(name = "order_results") @SerializedName("order_results") private List orderResults; } diff --git a/ms-biz/src/main/java/com/ms/biz/dto/openspi/response/BatchPayData.java b/ms-biz/src/main/java/com/ms/biz/dto/openspi/response/BatchPayData.java index 314e56b..13a0f5c 100644 --- a/ms-biz/src/main/java/com/ms/biz/dto/openspi/response/BatchPayData.java +++ b/ms-biz/src/main/java/com/ms/biz/dto/openspi/response/BatchPayData.java @@ -1,5 +1,6 @@ package com.ms.biz.dto.openspi.response; +import com.alibaba.fastjson.annotation.JSONField; import com.doudian.open.gson.annotations.SerializedName; import lombok.Data; @@ -7,6 +8,7 @@ import java.util.List; @Data public class BatchPayData { + @JSONField(name = "payment_results") @SerializedName("payment_results") private List paymentResults; } diff --git a/ms-biz/src/main/java/com/ms/biz/dto/openspi/response/OrderResult.java b/ms-biz/src/main/java/com/ms/biz/dto/openspi/response/OrderResult.java index 0e49f09..d6469da 100644 --- a/ms-biz/src/main/java/com/ms/biz/dto/openspi/response/OrderResult.java +++ b/ms-biz/src/main/java/com/ms/biz/dto/openspi/response/OrderResult.java @@ -1,5 +1,6 @@ package com.ms.biz.dto.openspi.response; +import com.alibaba.fastjson.annotation.JSONField; import com.doudian.open.gson.annotations.SerializedName; import lombok.Data; @@ -8,36 +9,45 @@ import java.util.List; @Data public class OrderResult { + @JSONField(name = "pur_order_id") @SerializedName("pur_order_id") private String purOrderId; + @JSONField(name = "out_pre_orderId") @SerializedName("out_pre_orderId") private String outPreOrderId; + @JSONField(name = "supplier_order_id") @SerializedName("supplier_order_id") private String supplierOrderId; + @JSONField(name = "supplier_order_url") @SerializedName("supplier_order_url") private SupplierOrderUrl supplierOrderUrl; + @JSONField(name = "sku_order_results") @SerializedName("sku_order_results") private List skuOrderResults; @Data public static class SupplierOrderUrl implements Serializable { + @JSONField(name = "h5_url") @SerializedName("h5_url") private String h5Url; + @JSONField(name = "pc_url") @SerializedName("pc_url") private String pcUrl; } @Data public static class SkuOrderResult implements Serializable { + @JSONField(name = "pur_sku_order_id") @SerializedName("pur_sku_order_id") private String purSkuOrderId; + @JSONField(name = "supplier_sku_order_id") @SerializedName("supplier_sku_order_id") private String supplierSkuOrderId; } diff --git a/ms-biz/src/main/java/com/ms/biz/dto/openspi/response/PaymentResult.java b/ms-biz/src/main/java/com/ms/biz/dto/openspi/response/PaymentResult.java index 00d807a..fcada38 100644 --- a/ms-biz/src/main/java/com/ms/biz/dto/openspi/response/PaymentResult.java +++ b/ms-biz/src/main/java/com/ms/biz/dto/openspi/response/PaymentResult.java @@ -1,5 +1,6 @@ package com.ms.biz.dto.openspi.response; +import com.alibaba.fastjson.annotation.JSONField; import com.doudian.open.gson.annotations.SerializedName; import lombok.Data; @@ -7,17 +8,21 @@ import java.io.Serializable; @Data public class PaymentResult { + @JSONField(name = "pur_order_id") @SerializedName("pur_order_id") private String purOrderId; + @JSONField(name = "pay_url") @SerializedName("pay_url") private PayUrl payUrl; @Data public static class PayUrl implements Serializable { + @JSONField(name = "h5_url") @SerializedName("h5_url") private String h5Url; + @JSONField(name = "pc_url") @SerializedName("pc_url") private String pcUrl; } 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 cbe5213..f935b43 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 @@ -317,24 +317,48 @@ public class DsMessageServiceImpl implements DsMessageService { if (purchaseOrderDTO.getRefundInfo() == null || purchaseOrderDTO.getRefundInfo().isEmpty()) { return; } + + Map subItemIdAndSkuIdMap = new HashMap<>(); + for (PurchaseOrderItemDTO itemDTO: purchaseOrderDTO.getItems()) { + subItemIdAndSkuIdMap.put(itemDTO.getSubItemId(), itemDTO.getSkuId()); + } + Map skuIdAndPurSkuOrderIdMap = new HashMap<>(); + List skus = platformPurchaseOrderSkuMapper.getListByPurOrderIds(Collections.singletonList(purchaseOrder.getPurOrderId())); + for (PlatformPurchaseOrderSku sku: skus) { + skuIdAndPurSkuOrderIdMap.put(sku.getOuterSkuId(), sku.getPurSkuOrderId()); + } + SupplyCenterRefundOperateParam param = new SupplyCenterRefundOperateParam(); param.setPurOrderId(purchaseOrderDTO.getPlatformOrderId()); List skuRefundInfosItems = new ArrayList<>(); for (Map.Entry entry: purchaseOrderDTO.getRefundInfo().entrySet()) { - SkuRefundInfosItem skuRefundInfosItem = buildSkuRefundInfosItem(entry.getValue()); - skuRefundInfosItems.add(skuRefundInfosItem); + Set subItemIds = entry.getValue().getOrderEntryCountMap().keySet(); + for (String subItemId: subItemIds) { + if (!subItemIdAndSkuIdMap.containsKey(subItemId)) { + log.info("sku unFound, subItemId: " + subItemId + "subItemIdAndSkuIdMap: " + subItemIdAndSkuIdMap); + continue; + } + Long skuId = subItemIdAndSkuIdMap.get(subItemId); + if (!skuIdAndPurSkuOrderIdMap.containsKey(String.valueOf(skuId))) { + log.info("purSkuOrderId unFound skuId: " + skuId + "skuIdAndPurSkuOrderIdMap: " + skuIdAndPurSkuOrderIdMap); + continue; + } + String purSkuOrderId = skuIdAndPurSkuOrderIdMap.get(String.valueOf(skuId)); + SkuRefundInfosItem skuRefundInfosItem = buildSkuRefundInfosItem(purSkuOrderId, entry.getValue()); + skuRefundInfosItems.add(skuRefundInfosItem); + } } param.setSkuRefundInfos(skuRefundInfosItems); DDApi.supplyCenterRefundOperate(param); } - private SkuRefundInfosItem buildSkuRefundInfosItem(RefundInfoDTO refundInfo) { + private SkuRefundInfosItem buildSkuRefundInfosItem(String purSkuOrderId, RefundInfoDTO refundInfo) { Address address = new Address(); address.setUserName(refundInfo.getSellerRealName()); address.setDetail(refundInfo.getSellerReceiveAddress()); address.setMobile(refundInfo.getSellerMobile()); SkuRefundInfosItem skuRefundInfosItem = new SkuRefundInfosItem(); - skuRefundInfosItem.setPurSkuOrderId(""); + skuRefundInfosItem.setPurSkuOrderId(purSkuOrderId); skuRefundInfosItem.setRejectReason(refundInfo.getRejectReason()); skuRefundInfosItem.setAddress(address); skuRefundInfosItem.setCloseReason(""); diff --git a/ms-biz/src/main/java/com/ms/biz/service/impl/ShopServiceImpl.java b/ms-biz/src/main/java/com/ms/biz/service/impl/ShopServiceImpl.java index a8a0820..037768b 100644 --- a/ms-biz/src/main/java/com/ms/biz/service/impl/ShopServiceImpl.java +++ b/ms-biz/src/main/java/com/ms/biz/service/impl/ShopServiceImpl.java @@ -114,6 +114,11 @@ public class ShopServiceImpl implements ShopService { } public void querySupplyPlatformAuth(QuerySupplyPlatformAuthParam param, QuerySupplyPlatformAuthData data) { + if (param.getScene() == 1) { + data.setAuthorized(true); + data.setAuthUrl(""); + return; + } Long shopId = param.getShopId(); ShopBO shop = getShopInfo(shopId); ShopTo1688DsMember shopTo1688DsMember = shopTo1688DsMemberMapper.getDetailByShopId(shopId);