|
|
|
@ -317,24 +317,48 @@ public class DsMessageServiceImpl implements DsMessageService {
|
|
|
|
|
if (purchaseOrderDTO.getRefundInfo() == null || purchaseOrderDTO.getRefundInfo().isEmpty()) {
|
|
|
|
|
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();
|
|
|
|
|
param.setPurOrderId(purchaseOrderDTO.getPlatformOrderId());
|
|
|
|
|
List<SkuRefundInfosItem> skuRefundInfosItems = new ArrayList<>();
|
|
|
|
|
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);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
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("");
|
|
|
|
|