|
|
@ -317,24 +317,48 @@ public class DsMessageServiceImpl implements DsMessageService {
|
|
|
|
if (purchaseOrderDTO.getRefundInfo() == null || purchaseOrderDTO.getRefundInfo().isEmpty()) {
|
|
|
|
if (purchaseOrderDTO.getRefundInfo() == null || purchaseOrderDTO.getRefundInfo().isEmpty()) {
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Map<String, Long> subItemIdAndSkuIdMap = new HashMap<>();
|
|
|
|
|
|
|
|
for (PurchaseOrderItemDTO itemDTO: purchaseOrderDTO.getItems()) {
|
|
|
|
|
|
|
|
subItemIdAndSkuIdMap.put(itemDTO.getSubItemId(), itemDTO.getSkuId());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
Map<String, String> skuIdAndPurSkuOrderIdMap = new HashMap<>();
|
|
|
|
|
|
|
|
List<PlatformPurchaseOrderSku> skus = platformPurchaseOrderSkuMapper.getListByPurOrderIds(Collections.singletonList(purchaseOrder.getPurOrderId()));
|
|
|
|
|
|
|
|
for (PlatformPurchaseOrderSku sku: skus) {
|
|
|
|
|
|
|
|
skuIdAndPurSkuOrderIdMap.put(sku.getOuterSkuId(), sku.getPurSkuOrderId());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
SupplyCenterRefundOperateParam param = new SupplyCenterRefundOperateParam();
|
|
|
|
SupplyCenterRefundOperateParam param = new SupplyCenterRefundOperateParam();
|
|
|
|
param.setPurOrderId(purchaseOrderDTO.getPlatformOrderId());
|
|
|
|
param.setPurOrderId(purchaseOrderDTO.getPlatformOrderId());
|
|
|
|
List<SkuRefundInfosItem> skuRefundInfosItems = new ArrayList<>();
|
|
|
|
List<SkuRefundInfosItem> skuRefundInfosItems = new ArrayList<>();
|
|
|
|
for (Map.Entry<String, RefundInfoDTO> entry: purchaseOrderDTO.getRefundInfo().entrySet()) {
|
|
|
|
for (Map.Entry<String, RefundInfoDTO> entry: purchaseOrderDTO.getRefundInfo().entrySet()) {
|
|
|
|
SkuRefundInfosItem skuRefundInfosItem = buildSkuRefundInfosItem(entry.getValue());
|
|
|
|
Set<String> 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);
|
|
|
|
skuRefundInfosItems.add(skuRefundInfosItem);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
param.setSkuRefundInfos(skuRefundInfosItems);
|
|
|
|
param.setSkuRefundInfos(skuRefundInfosItems);
|
|
|
|
DDApi.supplyCenterRefundOperate(param);
|
|
|
|
DDApi.supplyCenterRefundOperate(param);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private SkuRefundInfosItem buildSkuRefundInfosItem(RefundInfoDTO refundInfo) {
|
|
|
|
private SkuRefundInfosItem buildSkuRefundInfosItem(String purSkuOrderId, RefundInfoDTO refundInfo) {
|
|
|
|
Address address = new Address();
|
|
|
|
Address address = new Address();
|
|
|
|
address.setUserName(refundInfo.getSellerRealName());
|
|
|
|
address.setUserName(refundInfo.getSellerRealName());
|
|
|
|
address.setDetail(refundInfo.getSellerReceiveAddress());
|
|
|
|
address.setDetail(refundInfo.getSellerReceiveAddress());
|
|
|
|
address.setMobile(refundInfo.getSellerMobile());
|
|
|
|
address.setMobile(refundInfo.getSellerMobile());
|
|
|
|
SkuRefundInfosItem skuRefundInfosItem = new SkuRefundInfosItem();
|
|
|
|
SkuRefundInfosItem skuRefundInfosItem = new SkuRefundInfosItem();
|
|
|
|
skuRefundInfosItem.setPurSkuOrderId("");
|
|
|
|
skuRefundInfosItem.setPurSkuOrderId(purSkuOrderId);
|
|
|
|
skuRefundInfosItem.setRejectReason(refundInfo.getRejectReason());
|
|
|
|
skuRefundInfosItem.setRejectReason(refundInfo.getRejectReason());
|
|
|
|
skuRefundInfosItem.setAddress(address);
|
|
|
|
skuRefundInfosItem.setAddress(address);
|
|
|
|
skuRefundInfosItem.setCloseReason("");
|
|
|
|
skuRefundInfosItem.setCloseReason("");
|
|
|
|