Merge branch 'ljl-dsPurchaseOrder'

20230922-ljl-fixBug
ljl 1 year ago
commit bdce64e476

@ -8,30 +8,9 @@ import java.util.List;
@Data
public class BatchAddPurchaseConfirmLogRequestDTO {
private String userId;
private String purchaseSource;
private String purchasePlatform;
@Data
public static class PlatformOrder implements Serializable {
private String platformOrderId;
private String userId;
private List<PlatformOrderItem> items;
}
@Data
public static class PlatformOrderItem implements Serializable {
private String platformOrderId;
private String platformItemId;
private String platformSkuId;
private Integer itemTotal;
private String platformSkuSubName;
private String sourceItemId;
private String sourceSkuId;
private Integer sourceNum;
private String sourceSkuPurchaseQuantity;
private String sourceSkuSubName;
private Integer isSkuSubNameEqual;
private Integer isItemTotalEqual;
private String dsRefundStatus;
}
private String platform;
private OperateInfoDTO operateInfo;
private List<PlatformOrderDTO> platformOrders;
}

@ -6,6 +6,7 @@ import java.util.List;
@Data
public class PlatformOrderDTO {
private String userId;
private String platformOrderId;
private Long shopId;
private ConsigneeInfoDTO consigneeInfo;

@ -6,7 +6,7 @@ import lombok.Data;
public class PlatformOrderItemDTO {
private String sourceItemId;
private String specId;
private Integer sourceSkuId;
private Long sourceSkuId;
private String platformItemId;
private String platformOrderId;
private Integer itemTotal;
@ -14,4 +14,5 @@ public class PlatformOrderItemDTO {
private Boolean isJxhyOffer;
private String instanceCode;
private String platformSkuSubName;
private String platformSkuId;
}

@ -4,7 +4,7 @@ import lombok.Data;
@Data
public class SavePlatformManualSelectedSkuRequestDTO {
private String shopId;
private String userId;
private String platform;
private String platformItemId;
private String platformSkuId;

@ -0,0 +1,10 @@
package com.ms.api.dto.dsapi.response;
import lombok.Data;
import java.util.HashMap;
@Data
public class BatchAddDsPurchaseConfirmLogResponseDTO extends CommonResponseDTO {
HashMap<String, Long> platformOrderIdAndPurchaseConfirmLogIdMap;
}

@ -10,7 +10,7 @@ import java.util.Map;
public class GetPurchaseOrderItemsAndSourceItemsResponseDTO extends CommonResponseDTO {
private Map<String, ProductInfo> sourceItemIdAndProductInfoMap;
private Map<String, CommonResponseDTO> sourceItemIdAndProductApiRetMap;
private Map<String, SourceItemSkuRelation> platformItemIdAndSourceItemSkuRelationMap;
private Map<String, Map<String, List<SourceItemSkuRelation>>> platformItemIdAndSourceItemSkuRelationMap;
private Map<String, List<PurchaseOrderItem>> platformOrderIdAndPurchaseOrderItemsMap;
private Map<String, List<PurchaseOrder>> platformOrderIdAndPurchaseOrdersMap;
private Map<String, SourceItemInfo> platformItemIdAndSourceItemInfoMap;
@ -32,6 +32,8 @@ public class GetPurchaseOrderItemsAndSourceItemsResponseDTO extends CommonRespon
private String resourceOwner;
private List<Sku> skus;
private EncryptLogisticsOrderSupportChannel encryptLogisticsOrderSupportChannel;
private Map<String, SourceItemSkuRelation> platformSkuIdAndSourceSkuInfoMap;
private Map<String, String> platformSkuIdAndSourceSkuIdMap;
}
@Data
@ -61,6 +63,7 @@ public class GetPurchaseOrderItemsAndSourceItemsResponseDTO extends CommonRespon
private String gmtCreate;
private String gmtModified;
private Long platformItemId;
private Long sourceItemId;
}
@Data

@ -1,5 +1,6 @@
package com.ms.api.service;
import java.util.HashMap;
import java.util.List;
import com.ms.api.dto.dsapi.request.BatchAddPurchaseConfirmLogRequestDTO;
@ -14,7 +15,7 @@ import com.ms.api.dto.dsorder.OrderItemDTO;
public interface DistributionOrderService {
BatchCreateDistributionOrdersResponseDTO batchCreateDistributionOrders(Long shopId, BatchCreateDistributionOrdersRequestDTO request);
GetPurchaseOrderItemsAndSourceItemsResponseDTO getSourceSkuInfos(Long shopId, List<OrderItemDTO> orderItems);
CommonResponseDTO batchAddDsPurchaseConfirmLog(BatchAddPurchaseConfirmLogRequestDTO request);
HashMap<String, Long> batchAddDsPurchaseConfirmLog(Long shopId, BatchAddPurchaseConfirmLogRequestDTO request);
void cancelPurchaseOrder(Long shopId, String orderId, List<Long> skuIds, String source, boolean isForce);
void closeSourceOrderAndCancelRelatePurchaseOrder(Long shopId, String orderId, String purchaseOrderSn);
String getDsPurchaseOrderPayUrl(Long shopId, GetDsPurchaseOrderPayUrlRequestDTO request);

@ -13,7 +13,7 @@ public interface DsApiService {
BatchCreateDistributionOrdersResponseDTO batchCreateDistributionOrders(BatchCreateDistributionOrdersRequestDTO request);
CommonResponseDTO saveDsManualSelectedSku(SavePlatformManualSelectedSkuRequestDTO request);
GetPurchaseOrderItemsAndSourceItemsResponseDTO getPurchaseOrderItemsAndSourceItems(GetPurchaseOrderItemsAndSourceItemsRequestDTO request);
CommonResponseDTO batchAddPurchaseConfirmLog(BatchAddPurchaseConfirmLogRequestDTO request);
BatchAddDsPurchaseConfirmLogResponseDTO batchAddPurchaseConfirmLog(Long shopId, BatchAddPurchaseConfirmLogRequestDTO request);
CommonResponseDTO cancelPurchaseOrderRelate(String platform, Long shopId, String orderId, List<Long> skuIds);
CommonResponseDTO cancelPurchaseOrder(String platform, Long shopId, String orderId, String purchaseOrderSn);
GetPurchaseOrderPayUrlResponseDTO getPurchaseOrderPayUrl(List<String> sourceOrderId, Long shopId);

@ -23,9 +23,9 @@ public interface OpOrderChildService {
int updateByPrimaryKey(OpOrderChild record);
List<OpOrderChild> getListByOrderIdsAndSkuIds(List<String> orderIds, List<Integer> skuIds);
List<OpOrderChild> getListByOrderIdsAndSkuIds(List<String> orderIds, List<Long> skuIds);
HashMap<String, HashMap<Long, String>> getOrderIdAndSkuIdAndSkuSubNameMap(List<String> orderIds, List<Integer> skuIds);
HashMap<String, HashMap<Long, String>> getOrderIdAndSkuIdAndSkuSubNameMap(List<String> orderIds, List<Long> skuIds);
List<Integer> getHistorySkuIdsByOrderId(String orderId);

@ -1,7 +1,10 @@
package com.ms.api.service;
import com.ms.dal.entity.OpPackage;
import com.ms.dal.entity.OpPackageOrderChild;
import java.util.List;
/**
*
*/
@ -18,4 +21,6 @@ public interface OpPackageOrderChildService {
int updateByPrimaryKeySelective(OpPackageOrderChild record);
int updateByPrimaryKey(OpPackageOrderChild record);
List<OpPackageOrderChild> getListByOpPackageIds(List<Long> opPackageIds);
}

@ -2,6 +2,8 @@ package com.ms.api.service;
import com.ms.dal.entity.OpPackageOrder;
import java.util.List;
/**
*
*/
@ -18,4 +20,8 @@ public interface OpPackageOrderService {
int updateByPrimaryKeySelective(OpPackageOrder record);
int updateByPrimaryKey(OpPackageOrder record);
List<Long> getOpPackageIdsByOrderIds(List<String> orderIds);
List<OpPackageOrder> getListByOrderIds(List<String> orderIds);
}

@ -2,6 +2,9 @@ package com.ms.api.service;
import com.ms.dal.entity.OpPackage;
import java.util.HashMap;
import java.util.List;
/**
*
*/
@ -18,4 +21,6 @@ public interface OpPackageService {
int updateByPrimaryKeySelective(OpPackage record);
int updateByPrimaryKey(OpPackage record);
List<OpPackage> getListByOpPackageIds(List<Long> opPackageIds);
}

@ -61,9 +61,6 @@ public class DistributionOrderServiceImpl implements DistributionOrderService {
@Autowired
private OpOrderAmountDetailService opOrderAmountDetailService;
@Autowired
private OpOrderRedpackInfoService opOrderRedpackInfoService;
@Autowired
private PurchaseSettingService purchaseSettingService;
@ -88,6 +85,8 @@ public class DistributionOrderServiceImpl implements DistributionOrderService {
@Autowired
private OpLogisticsPlatformService opLogisticsPlatformService;
@Autowired
private PurchaseOrderTagService purchaseOrderTagService;
@Override
public BatchCreateDistributionOrdersResponseDTO batchCreateDistributionOrders(Long shopId, BatchCreateDistributionOrdersRequestDTO request) {
@ -124,11 +123,8 @@ public class DistributionOrderServiceImpl implements DistributionOrderService {
platformOrderDto.setEncryptOutOrderInfo(encryptOutOrderInfoDto);
}
List<String> allDecryptFields = Arrays.asList("post_receiver", "post_tel", "detail");
Set<String> useManualConsigneeOrderIds = new HashSet<>();
HashMap<String, List<String>> tradeKeyAndDecryptFieldsMap = new HashMap<>();
HashMap<String, String> sourceItemIdAndSourceSellerIdMap = getSourceItemIdAndSourceSellerIdMap(request.getAllItems());
HashMap<String, String> rebuildPlatformOrdersByChoicesItem = new HashMap<>();
HashMap<Long, PlatformShopPurchaseSettingDTO> shopPurchaseSettings = new HashMap<>();
for (PlatformOrderDTO platformOrderDto : platformOrders) {
Set<String> sourceSellerIds = getSourceSellerIdsFromPlatformOrder(platformOrderDto, sourceItemIdAndSourceSellerIdMap);
@ -148,7 +144,7 @@ public class DistributionOrderServiceImpl implements DistributionOrderService {
if (platformOrderDto.getConsigneeInfo().getIsManualInput()) {
useManualConsigneeOrderIds.add(platformOrderDto.getPlatformOrderId());
} else if (checkNeedDecryptConsigneeInfo(platformOrderDto, shopPurchaseSettings.get(platformOrderDto.getShopId()), sourceSellerIds.iterator().next())) {
tradeKeyAndDecryptFieldsMap.put(platformOrderDto.getPlatformOrderId(), allDecryptFields);
throw new RuntimeException("不支持解密");
}
for (PlatformOrderItemDTO item: platformOrderDto.getItems()) {
@ -325,19 +321,11 @@ public class DistributionOrderServiceImpl implements DistributionOrderService {
}
}
private void checkItems(List<PlatformOrderItemDTO> items) {
for (PlatformOrderItemDTO item: items) {
if (item.getSourceSkuId() == 0 || item.getItemTotal() == 0) {
throw new RuntimeException("items参数错误");
}
}
}
private List<PlatformOrderDTO> rebuildPlatformOrderItems(List<PlatformOrderDTO> platformOrders) {
private void rebuildPlatformOrderItems(List<PlatformOrderDTO> platformOrders) {
Stream<String> orderIdsStream = platformOrders.stream().map(PlatformOrderDTO::getPlatformOrderId);
List<String> orderIds = orderIdsStream.collect(Collectors.toList());
List<Integer> skuIds = new ArrayList<>();
List<Long> skuIds = new ArrayList<>();
for (PlatformOrderDTO platformOrder: platformOrders) {
for (PlatformOrderItemDTO item: platformOrder.getItems()) {
skuIds.add(item.getSourceSkuId());
@ -347,10 +335,9 @@ public class DistributionOrderServiceImpl implements DistributionOrderService {
HashMap<String, HashMap<Long, String>> orderIdAndSkuIdAndSkuSubNameMap = opOrderChildService.getOrderIdAndSkuIdAndSkuSubNameMap(orderIds, skuIds);
for (PlatformOrderDTO platformOrder: platformOrders) {
for (PlatformOrderItemDTO item: platformOrder.getItems()) {
item.setPlatformSkuSubName(orderIdAndSkuIdAndSkuSubNameMap.get(platformOrder.getPlatformOrderId()).get(Long.valueOf(item.getSourceSkuId())));
item.setPlatformSkuSubName(orderIdAndSkuIdAndSkuSubNameMap.get(platformOrder.getPlatformOrderId()).get(item.getSourceSkuId()));
}
}
return platformOrders;
}
private void dsRelatePurchaseOrder(PurchaseOrderRequestDTO purchaseOrderInfo, OpOrder opOrder) {
@ -472,8 +459,8 @@ public class DistributionOrderServiceImpl implements DistributionOrderService {
deliveryInfo.setWaybillCode(waybillCode);
}
for (PurchaseOrderItem item: purchaseOrder.getItems()) {
if (skuIds.contains(item.getSkuId().intValue())) {
List<OpOrderChild> childOrderInfoList = skuIdAndChildOrderInfoMap.get(item.getSkuId().intValue());
if (skuIds.contains(item.getSkuId())) {
List<OpOrderChild> childOrderInfoList = skuIdAndChildOrderInfoMap.get(item.getSkuId());
for (OpOrderChild child: childOrderInfoList) {
JSONObject opOrderChildAfterSale = child.getAfterSaleInfo();
if (opOrderChildAfterSale != null && opOrderChildAfterSale.get("after_sale_type").equals(AfterSaleConst.AFTERSALE_TYPE_REFUND_ONLY_BEFORE_SALE) && !AfterSaleConst.getAfterSaleCloseOrCancelStatusList().equals(opOrderChildAfterSale.get("after_sale_status"))) {
@ -487,7 +474,7 @@ public class DistributionOrderServiceImpl implements DistributionOrderService {
boolean hasMultiPackageOutstorage = opOrder.getOrderStatus().equals(OrderConst.ORDER_STATUS_PART_DELIVERY);
OrderPackageInfoDTO orderPackageInfoDTO = new OrderPackageInfoDTO();
orderPackageInfoDTO.setDeliveryInfo(deliveryInfo);;
orderPackageInfoDTO.setDeliveryInfo(deliveryInfo);
orderPackageInfoDTO.setPackageList(packageList);
orderPackageInfoDTO.setHasAfterSaleChildOrder(hasAfterSaleChildOrder);
orderPackageInfoDTO.setHasMultiPackageOutstorage(hasMultiPackageOutstorage);
@ -606,7 +593,7 @@ public class DistributionOrderServiceImpl implements DistributionOrderService {
return newSellerWords;
}
newSellerWords = newSellerWords.replaceAll(appChineseName, "0.0");
if (newSellerWords.equals(oldSellerWords) && shopRemarkFlag.equals(opOrder.getSellerRemarkStars())) {
if (newSellerWords.equals(oldSellerWords) && String.valueOf(shopRemarkFlag).equals(opOrder.getSellerRemarkStars())) {
return newSellerWords;
}
opOrderExtService.updateOpOrderShopNote(shopId, orderId, newSellerWords);
@ -667,9 +654,9 @@ public class DistributionOrderServiceImpl implements DistributionOrderService {
String profitText = "";
String profitRatioText = "";
if (needProfit || needProfitRatio) {
HashMap<String, Double> resuslt = getOrderProfitAndRatioByOrderId(firstPurchaseOrder.getOrderId());
profitText = "(总利润 ¥" + resuslt.get("orderProfitSum") + "";
profitRatioText = "(利润率" + resuslt.get("orderTotalProfitRate") + "%";
HashMap<String, Double> result = getOrderProfitAndRatioByOrderId(firstPurchaseOrder.getOrderId());
profitText = "(总利润 ¥" + result.get("orderProfitSum") + "";
profitRatioText = "(利润率" + result.get("orderTotalProfitRate") + "%";
}
for (PurchaseOrder purchaseOrder: purchaseOrders) {
@ -813,9 +800,10 @@ public class DistributionOrderServiceImpl implements DistributionOrderService {
BigDecimal purchaseOrderPayment = new BigDecimal(purchaseOrderRequestDto.getPurchaseOrderPayment());
dbPurchaseOrder.setPurchaseOrderPayment(purchaseOrderPayment);
}
comparePurchaseOrderAndAddUpdateLog(purchaseOrderRequestDto, opOrder.getShopId(), PurchaseOrderConst.ACTION_RSYNC);
checkPurchaseOrderLogisticsChangeAndAddTag(purchaseOrderRequestDto, dbPurchaseOrder);
OpOrderExt orderExt = opOrderExtService.getByOrderId(dbPurchaseOrder.getOrderId());
if ("normal".equals(dbPurchaseOrder.getStatus()) && orderExt != null && orderExt.getFilterPurchaseStatus() != null) {
updateOpOrderFilterPurchaseStatus(opOrder.getOrderId(), orderExt);
}
@ -919,7 +907,7 @@ public class DistributionOrderServiceImpl implements DistributionOrderService {
List<PurchaseOrderItem> purchaseOrderItems = purchaseOrderItemService.getRelatedPurchaseOrderItems(opOrderDs.getShopId(), orderId);
List<String> purchaseWareIds;
List<Long> dsPurchaseSkuIds = new ArrayList<>();
List<String> dsPurchaseSkuIds = new ArrayList<>();
List<String> purchaseDsProductIds = new ArrayList<>();
if (!purchaseOrderItems.isEmpty()) {
Stream<String> wareIdsStream = purchaseOrderItems.stream().map(PurchaseOrderItem::getWareId);
@ -928,7 +916,7 @@ public class DistributionOrderServiceImpl implements DistributionOrderService {
if (purchaseOrderItem.getPurchasePlatform().equals(purchasePlatform)) {
purchaseDsProductIds.add(purchaseOrderItem.getWareId());
dsProductIds.add(purchaseOrderItem.getWareId());
dsPurchaseSkuIds.add(purchaseOrderItem.getSkuId());
dsPurchaseSkuIds.add(String.valueOf(purchaseOrderItem.getSkuId()));
}
}
} else {
@ -938,7 +926,7 @@ public class DistributionOrderServiceImpl implements DistributionOrderService {
List<String> noPurchaseDsProductIds = dsProductIds.stream().filter(i -> !purchaseWareIds.contains(i)).collect(Collectors.toList());
List<String> notPurchaseDsSkuIds = dsProductIds.stream().filter(i -> !dsPurchaseSkuIds.contains(i)).collect(Collectors.toList());
List<Long> notDsAndDsPurchaseSkuIds = skuIdList.stream().filter(i -> !dsOrderSkuIds.contains(i)).collect(Collectors.toList());
notDsAndDsPurchaseSkuIds = notDsAndDsPurchaseSkuIds.stream().filter(i -> !dsPurchaseSkuIds.contains(i)).collect(Collectors.toList());
notDsAndDsPurchaseSkuIds = notDsAndDsPurchaseSkuIds.stream().filter(i -> !dsPurchaseSkuIds.contains(String.valueOf(i))).collect(Collectors.toList());
if (orderPrintService.checkAndDeleteOpOrderDs(purchasePlatform, orderId, productToDsItemList, purchaseOrderItems)) {
return;
@ -1020,11 +1008,6 @@ public class DistributionOrderServiceImpl implements DistributionOrderService {
opOrderDsService.updateByPrimaryKeySelective(opOrderDs);
}
private void addPurchaseOrderRefundOrderTipMsg(Long shopId, String orderId, String purchaseOrderStatus, Long purchaseOrderId) {
}
private void savePurchaseOrderInfo(PurchaseOrderRequestDTO purchaseOrderRequestDto, OpOrder opOrder, HashMap<Long, OpOrderChild> skuIdAndOpOrderChildMap) {
purchaseAccountService.savePurchaseAccount(opOrder.getShopId(), purchaseOrderRequestDto.getPurchasePlatform(), purchaseOrderRequestDto.getPurchaseOrderBuyer());
PurchaseOrder dbPurchaseOrder = purchaseOrderService.getByPlatformAndPurchaseOrderSn(purchaseOrderRequestDto.getPurchasePlatform(), purchaseOrderRequestDto.getPurchaseOrderSn());
@ -1150,10 +1133,6 @@ public class DistributionOrderServiceImpl implements DistributionOrderService {
return log;
}
public void savePurchaseOrderSetting(Long shopId) {
}
private PurchaseOrder buildPurchaseOrderByDto(PurchaseOrderRequestDTO purchaseOrderRequestDto, PurchaseOrder oldPurchaseOrder, OpOrder opOrder) {
PurchaseOrder purchaseOrder = oldPurchaseOrder;
if (purchaseOrder == null) {
@ -1245,6 +1224,15 @@ public class DistributionOrderServiceImpl implements DistributionOrderService {
return isReapt;
}
private void getOrderPurchaseItemsOldPackageInfo(PurchaseOrder purchaseOrder) {
List<PurchaseOrderItem> purchaseOrderItems = purchaseOrderItemService.getRelatePurchaseOrderItemsByPurchaseOrderId(purchaseOrder.getPurchaseOrderId());
List<Long> skuIds = purchaseOrderItems.stream().map(PurchaseOrderItem::getSkuId).collect(Collectors.toList());
List<String> orderIds = new ArrayList<>();
orderIds.add(purchaseOrder.getOrderId());
opOrderChildService.getListByOrderIdsAndSkuIds(orderIds, skuIds);
}
@Override
public GetPurchaseOrderItemsAndSourceItemsResponseDTO getSourceSkuInfos(Long shopId, List<OrderItemDTO> orderItems) {
Stream<String> orderIdsStream = orderItems.stream().map(OrderItemDTO::getOrderId);
@ -1256,7 +1244,7 @@ public class DistributionOrderServiceImpl implements DistributionOrderService {
Map<String, OpOrder> orderIdAndOpOrderMap = orders.stream().collect(Collectors.toMap(OpOrder::getOrderId, x->x));
Stream<Long> shopIdsStream = orders.stream().map(OpOrder::getShopId);
Set<Long> shopIdSet = shopIdsStream.collect(Collectors.toSet());
if (shopIdSet.size() != 1 || shopIdSet.contains(shopId)) {
if (shopIdSet.size() != 1 || !shopIdSet.contains(shopId)) {
throw new RuntimeException("订单归属异常");
}
@ -1283,8 +1271,12 @@ public class DistributionOrderServiceImpl implements DistributionOrderService {
}
@Override
public CommonResponseDTO batchAddDsPurchaseConfirmLog(BatchAddPurchaseConfirmLogRequestDTO request) {
return dsApiService.batchAddPurchaseConfirmLog(request);
public HashMap<String, Long> batchAddDsPurchaseConfirmLog(Long shopId, BatchAddPurchaseConfirmLogRequestDTO request) {
BatchAddDsPurchaseConfirmLogResponseDTO response = dsApiService.batchAddPurchaseConfirmLog(shopId, request);
if (!response.isSuccess()) {
throw new RuntimeException(response.getReason());
}
return response.getPlatformOrderIdAndPurchaseConfirmLogIdMap();
}
@Override

@ -47,9 +47,17 @@ public class DsApiServiceImpl implements DsApiService {
}
@Override
public CommonResponseDTO batchAddPurchaseConfirmLog(BatchAddPurchaseConfirmLogRequestDTO request) {
public BatchAddDsPurchaseConfirmLogResponseDTO batchAddPurchaseConfirmLog(Long shopId, BatchAddPurchaseConfirmLogRequestDTO request) {
request.setPlatform("dd");
request.setUserId(SecurityTool.encodeByAES(String.valueOf(shopId)));
request.setOperateInfo(createOperateInfo(shopId));
for (PlatformOrderDTO platformOrder: request.getPlatformOrders()) {
for (PlatformOrderItemDTO item: platformOrder.getItems()) {
item.setPlatformItemId(SecurityTool.encodeByAES(item.getPlatformItemId()));
}
}
String resp = execute("/order/batchAddPurchaseConfirmLog", objectToMap(request));
return JSON.parseObject(resp, CommonResponseDTO.class);
return JSON.parseObject(resp, BatchAddDsPurchaseConfirmLogResponseDTO.class);
}
@Override

@ -63,11 +63,11 @@ public class OpOrderChildServiceImpl implements OpOrderChildService{
}
@Override
public List<OpOrderChild> getListByOrderIdsAndSkuIds(List<String> orderIds, List<Integer> skuIds) {
public List<OpOrderChild> getListByOrderIdsAndSkuIds(List<String> orderIds, List<Long> skuIds) {
return opOrderChildMapper.getListByOrderIdsAndSkuIds(orderIds, skuIds);
}
@Override
public HashMap<String, HashMap<Long, String>> getOrderIdAndSkuIdAndSkuSubNameMap(List<String> orderIds, List<Integer> skuIds) {
public HashMap<String, HashMap<Long, String>> getOrderIdAndSkuIdAndSkuSubNameMap(List<String> orderIds, List<Long> skuIds) {
List<OpOrderChild> children = getListByOrderIdsAndSkuIds(orderIds, skuIds);
HashMap<String, HashMap<Long, String>> map = new HashMap<>();
for (OpOrderChild child: children) {

@ -6,6 +6,8 @@ import com.ms.dal.mapper.OpPackageOrderChildMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
*
@ -46,6 +48,10 @@ public class OpPackageOrderChildServiceImpl implements OpPackageOrderChildServic
return opPackageOrderChildMapper.updateByPrimaryKey(record);
}
@Override
public List<OpPackageOrderChild> getListByOpPackageIds(List<Long> opPackageIds) {
return opPackageOrderChildMapper.getListByOpPackageIds(opPackageIds);
}
}

@ -6,6 +6,9 @@ import com.ms.dal.mapper.OpPackageOrderMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.stream.Collectors;
/**
*
@ -46,6 +49,16 @@ public class OpPackageOrderServiceImpl implements OpPackageOrderService{
return opPackageOrderMapper.updateByPrimaryKey(record);
}
@Override
public List<Long> getOpPackageIdsByOrderIds(List<String> orderIds) {
List<OpPackageOrder> packageOrders = getListByOrderIds(orderIds);
return packageOrders.stream().map(OpPackageOrder::getOpPackageId).collect(Collectors.toList());
}
@Override
public List<OpPackageOrder> getListByOrderIds(List<String> orderIds) {
return opPackageOrderMapper.getListByOrderIds(orderIds);
}
}

@ -6,6 +6,8 @@ import com.ms.dal.mapper.OpPackageMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
*
@ -46,6 +48,10 @@ public class OpPackageServiceImpl implements OpPackageService{
return opPackageMapper.updateByPrimaryKey(record);
}
@Override
public List<OpPackage> getListByOpPackageIds(List<Long> opPackageIds) {
return opPackageMapper.getListByOpPackageIds(opPackageIds);
}
}

@ -1751,13 +1751,13 @@ public class PurchaseOrderServiceImpl implements PurchaseOrderService {
String productId = opOrderChild.getProductId();
ProductToDsItem productToDsItem = productIdAndProductToDsItemMap.getOrDefault(productId, null);
if (ObjectUtil.isNotEmpty(productToDsItem)) {
if (PurchaseOrderConst.PURCHASE_PLATFORM_SOOXIE_D_S.equals(productToDsItem.getSource_platform())) {
if (PurchaseOrderConst.PURCHASE_PLATFORM_SOOXIE_D_S.equals(productToDsItem.getSourcePlatform())) {
productToDsItem.setSourceSellerId(null);
productToDsItem.setSource_platform(null);
productToDsItem.setSourcePlatform(null);
productToDsItem.setSourceItemId(null);
}
opOrderChild.setSourceSellerId(productToDsItem.getSourceSellerId());
opOrderChild.setSource_platform(productToDsItem.getSource_platform());
opOrderChild.setSource_platform(productToDsItem.getSourcePlatform());
opOrderChild.setSourceItemId(productToDsItem.getSourceItemId());
opOrderChild.setSourceItem(productToDsItem);
}

@ -13,6 +13,9 @@ import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.HashMap;
import java.util.Map;
@ExtensionService("batchAddDsPurchaseConfirmLog")
@Slf4j
@AllArgsConstructor
@ -22,9 +25,16 @@ public class BatchAddDsPurchaseConfirmLogService extends SPIBaseService implemen
@Override
public BaseResponse<Ret> handle(BaseRequest<BatchAddPurchaseConfirmLogRequestDTO> req) {
initHandle(req);
BatchAddPurchaseConfirmLogRequestDTO requestDTO = req.getData();
distributionOrderService.batchAddDsPurchaseConfirmLog(requestDTO);
return R.ok(Ret.success());
try {
initHandle(req);
BatchAddPurchaseConfirmLogRequestDTO requestDTO = req.getData();
HashMap<String, Long> platformOrderIdAndPurchaseConfirmLogIdMap = distributionOrderService.batchAddDsPurchaseConfirmLog(shopId, requestDTO);
Map<String, Object> data = new HashMap<>();
data.put("platformItemIdAndSourceItemInfoMap", platformOrderIdAndPurchaseConfirmLogIdMap);
return R.ok(Ret.success(data));
} catch (Exception e) {
log.error("batchAddDsPurchaseConfirmLog fail" + e.getMessage());
return R.ok(Ret.fail(e.getMessage()));
}
}
}

@ -8,11 +8,15 @@ import com.ms.api.common.R;
import com.ms.api.common.Ret;
import com.ms.api.common.SPIBaseService;
import com.ms.api.dto.dsapi.request.BatchCreateDistributionOrdersRequestDTO;
import com.ms.api.dto.dsapi.response.BatchCreateDistributionOrdersResponseDTO;
import com.ms.api.service.DistributionOrderService;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.HashMap;
import java.util.Map;
@ExtensionService("batchCreateDistributionOrders")
@Slf4j
@AllArgsConstructor
@ -22,9 +26,19 @@ public class BatchCreateDistributionOrdersService extends SPIBaseService impleme
@Override
public BaseResponse<Ret> handle(BaseRequest<BatchCreateDistributionOrdersRequestDTO> req) {
initHandle(req);
BatchCreateDistributionOrdersRequestDTO requestDTO = req.getData();
distributionOrderService.batchCreateDistributionOrders(shopId, requestDTO);
return R.ok(Ret.success());
try {
initHandle(req);
BatchCreateDistributionOrdersRequestDTO requestDTO = req.getData();
BatchCreateDistributionOrdersResponseDTO response = distributionOrderService.batchCreateDistributionOrders(shopId, requestDTO);
Map<String, Object> data = new HashMap<>();
data.put("successCount", response.getSuccessCount());
data.put("failCount", response.getFailCount());
data.put("successList", response.getSuccessList());
data.put("errorList", response.getErrorList());
return R.ok(Ret.success(data));
} catch (Exception e) {
log.error("batchCreateDistributionOrders fail" + e.getMessage());
return R.ok(Ret.fail(e.getMessage()));
}
}
}

@ -23,10 +23,15 @@ public class CancelPurchaseOrderService extends SPIBaseService implements Extens
@Override
public BaseResponse<Ret> handle(BaseRequest<CanclePurchaseOrderRequestDTO> req) {
initHandle(req);
CanclePurchaseOrderRequestDTO requestDTO = req.getData();
String source = PurchaseOrderConst.PURCHASE_ORDER_CANCEL_SOURCE_CG_CANCEL;
distributionOrderService.cancelPurchaseOrder(shopId, requestDTO.getOrderId(), requestDTO.getSkuIds(), source, false);
return R.ok(Ret.success());
try {
initHandle(req);
CanclePurchaseOrderRequestDTO requestDTO = req.getData();
String source = PurchaseOrderConst.PURCHASE_ORDER_CANCEL_SOURCE_CG_CANCEL;
distributionOrderService.cancelPurchaseOrder(shopId, requestDTO.getOrderId(), requestDTO.getSkuIds(), source, false);
return R.ok(Ret.success());
} catch (Exception e) {
log.error("cancelPurchaseOrder fail" + e.getMessage());
return R.ok(Ret.fail(e.getMessage()));
}
}
}

@ -22,9 +22,14 @@ public class ClosePurchaseOrderService extends SPIBaseService implements Extensi
@Override
public BaseResponse<Ret> handle(BaseRequest<ClosePurchaseOrderRequestDTO> req) {
initHandle(req);
ClosePurchaseOrderRequestDTO requestDTO = req.getData();
distributionOrderService.closeSourceOrderAndCancelRelatePurchaseOrder(shopId, requestDTO.getOrderId(), requestDTO.getPurchaseOrderSn());
return R.ok(Ret.success());
try {
initHandle(req);
ClosePurchaseOrderRequestDTO requestDTO = req.getData();
distributionOrderService.closeSourceOrderAndCancelRelatePurchaseOrder(shopId, requestDTO.getOrderId(), requestDTO.getPurchaseOrderSn());
return R.ok(Ret.success());
} catch (Exception e) {
log.error("closePurchaseOrder fail" + e.getMessage());
return R.ok(Ret.fail(e.getMessage()));
}
}
}

@ -25,11 +25,16 @@ public class GetDsPurchaseOrderPayUrlService extends SPIBaseService implements E
@Override
public BaseResponse<Ret> handle(BaseRequest<GetDsPurchaseOrderPayUrlRequestDTO> req) {
initHandle(req);
GetDsPurchaseOrderPayUrlRequestDTO requestDTO = req.getData();
String payUrl = distributionOrderService.getDsPurchaseOrderPayUrl(shopId, requestDTO);
Map<String, Object> data = new HashMap<>();
data.put("payUrl", payUrl);
return R.ok(Ret.success(data));
try {
initHandle(req);
GetDsPurchaseOrderPayUrlRequestDTO requestDTO = req.getData();
String payUrl = distributionOrderService.getDsPurchaseOrderPayUrl(shopId, requestDTO);
Map<String, Object> data = new HashMap<>();
data.put("payUrl", payUrl);
return R.ok(Ret.success(data));
} catch (Exception e) {
log.error("getDsPurchaseOrderPayUrl fail" + e.getMessage());
return R.ok(Ret.fail(e.getMessage()));
}
}
}

@ -27,19 +27,24 @@ public class GetSourceSkuInfosService extends SPIBaseService implements Extensio
@Override
public BaseResponse<Ret> handle(BaseRequest<GetSourceSkuInfosRequestDTO> req) {
initHandle(req);
GetSourceSkuInfosRequestDTO requestDTO = req.getData();
GetPurchaseOrderItemsAndSourceItemsResponseDTO response = distributionOrderService.getSourceSkuInfos(shopId, requestDTO.getOrderItems());
if (!response.isSuccess()) {
throw new RuntimeException(response.getReason());
try {
initHandle(req);
GetSourceSkuInfosRequestDTO requestDTO = req.getData();
GetPurchaseOrderItemsAndSourceItemsResponseDTO response = distributionOrderService.getSourceSkuInfos(shopId, requestDTO.getOrderItems());
if (!response.isSuccess()) {
throw new RuntimeException(response.getReason());
}
Map<String, Object> data = new HashMap<>();
data.put("platformItemIdAndSourceItemInfoMap", response.getPlatformItemIdAndSourceItemInfoMap());
data.put("platformOrderIdAndPurchaseOrderItemsMap", response.getPlatformOrderIdAndPurchaseOrderItemsMap());
data.put("sourceItemIdAndProductInfoMap", response.getSourceItemIdAndProductInfoMap());
data.put("platformOrderIdAndPurchaseOrdersMap", response.getPlatformOrderIdAndPurchaseOrdersMap());
data.put("platformItemIdAndSourceItemSkuRelationMap", response.getPlatformItemIdAndSourceItemSkuRelationMap());
data.put("sourceItemIdAndProductApiRetMap", response.getSourceItemIdAndProductApiRetMap());
return R.ok(Ret.success(data));
} catch (Exception e) {
log.error("getSourceSkuInfos fail" + e.getMessage());
return R.ok(Ret.fail(e.getMessage()));
}
Map<String, Object> data = new HashMap<>();
data.put("platformItemIdAndSourceItemInfoMap", response.getPlatformItemIdAndSourceItemInfoMap());
data.put("platformOrderIdAndPurchaseOrderItemsMap", response.getPlatformOrderIdAndPurchaseOrderItemsMap());
data.put("sourceItemIdAndProductInfoMap", response.getSourceItemIdAndProductInfoMap());
data.put("platformOrderIdAndPurchaseOrdersMap", response.getPlatformOrderIdAndPurchaseOrdersMap());
data.put("platformItemIdAndSourceItemSkuRelationMap", response.getPlatformItemIdAndSourceItemSkuRelationMap());
data.put("sourceItemIdAndProductApiRetMap", response.getSourceItemIdAndProductApiRetMap());
return R.ok(Ret.success(data));
}
}

@ -5,28 +5,41 @@ import com.jinritemai.cloud.base.api.BaseResponse;
import com.jinritemai.cloud.base.api.ExtensionService;
import com.jinritemai.cloud.base.api.ExtensionServiceHandler;
import com.ms.api.common.R;
import com.ms.api.common.Ret;
import com.ms.api.common.SPIBaseService;
import com.ms.api.dto.dsapi.request.OperateInfoDTO;
import com.ms.api.dto.dsapi.request.SavePlatformManualSelectedSkuRequestDTO;
import com.ms.api.dto.dsapi.response.CommonResponseDTO;
import com.ms.api.service.DsApiService;
import com.ms.api.tool.SecurityTool;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
@ExtensionService("saveDsManualSelectedSku")
@Slf4j
public class SaveDsManualSelectedSkuService implements ExtensionServiceHandler<SavePlatformManualSelectedSkuRequestDTO, CommonResponseDTO> {
public class SaveDsManualSelectedSkuService extends SPIBaseService implements ExtensionServiceHandler<SavePlatformManualSelectedSkuRequestDTO, Ret> {
@Autowired
private DsApiService dsApiService;
@Override
public BaseResponse<CommonResponseDTO> handle(BaseRequest<SavePlatformManualSelectedSkuRequestDTO> req) {
String shopId = req.getAuthId();
SavePlatformManualSelectedSkuRequestDTO dto = req.getData();
dto.setShopId(shopId);
dto.setOperateInfo(new OperateInfoDTO(shopId));
dto.setPlatform("dd");
CommonResponseDTO responseDTO = dsApiService.saveDsManualSelectedSku(dto);
return R.ok(responseDTO);
public BaseResponse<Ret> handle(BaseRequest<SavePlatformManualSelectedSkuRequestDTO> req) {
try {
initHandle(req);
String shopId = SecurityTool.encodeByAES(req.getAuthId());
SavePlatformManualSelectedSkuRequestDTO dto = req.getData();
dto.setPlatformItemId(SecurityTool.encodeByAES(dto.getPlatformItemId()));
dto.setUserId(shopId);
dto.setOperateInfo(new OperateInfoDTO(shopId));
dto.setPlatform("dd");
CommonResponseDTO responseDTO = dsApiService.saveDsManualSelectedSku(dto);
if (!responseDTO.isSuccess()) {
throw new RuntimeException(responseDTO.getReason());
}
return R.ok(Ret.success());
} catch (Exception e) {
log.error("saveDsManualSelectedSku fail" + e.getMessage());
return R.ok(Ret.fail(e.getMessage()));
}
}
}

@ -52,7 +52,7 @@ public class ProductToDsItem implements Serializable {
/**
*
*/
private String source_platform;
private String sourcePlatform;
/**
*

@ -27,7 +27,7 @@ public interface OpOrderChildMapper {
int updateByPrimaryKey(OpOrderChild record);
List<OpOrderChild> getListByOrderIdsAndSkuIds(@Param("orderIds") List<String> orderIds, @Param("skuIds") List<Integer> skuIds);
List<OpOrderChild> getListByOrderIdsAndSkuIds(@Param("orderIds") List<String> orderIds, @Param("skuIds") List<Long> skuIds);
List<OpOrderChild> getListByOrderId(@Param("orderId") String orderId);

@ -3,6 +3,8 @@ package com.ms.dal.mapper;
import com.ms.dal.entity.OpPackage;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* @Entity com.ms.dal.entity.OpPackage
*/
@ -23,4 +25,5 @@ public interface OpPackageMapper {
int updateByPrimaryKey(OpPackage record);
List<OpPackage> getListByOpPackageIds(List<Long> opPackageIds);
}

@ -3,6 +3,8 @@ package com.ms.dal.mapper;
import com.ms.dal.entity.OpPackageOrderChild;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* @Entity com.ms.dal.entity.OpPackageOrderChild
*/
@ -23,4 +25,5 @@ public interface OpPackageOrderChildMapper {
int updateByPrimaryKey(OpPackageOrderChild record);
List<OpPackageOrderChild> getListByOpPackageIds(List<Long> opPackageIds);
}

@ -3,6 +3,8 @@ package com.ms.dal.mapper;
import com.ms.dal.entity.OpPackageOrder;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* @Entity com.ms.dal.entity.OpPackageOrder
*/
@ -23,4 +25,5 @@ public interface OpPackageOrderMapper {
int updateByPrimaryKey(OpPackageOrder record);
List<OpPackageOrder> getListByOrderIds(List<String> orderIds);
}

@ -38,7 +38,23 @@
from op_package
where op_package_id = #{opPackageId,jdbcType=BIGINT}
</select>
<select id="getListByOpPackageIds" resultType="com.ms.dal.entity.OpPackage">
select
<include refid="Base_Column_List" />
from op_package
where 1=1
<choose>
<when test="opPackageIds!=null and opPackageIds.size>0">
and op_package_id IN %ls'
<foreach collection="opPackageIds" item="wareId" index="index" open="(" close=")" separator=",">
#{wareId}
</foreach>
</when>
<otherwise>
AND 1=0
</otherwise>
</choose>
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete from op_package
where op_package_id = #{opPackageId,jdbcType=BIGINT}

@ -27,7 +27,23 @@
from op_package_order_child
where op_package_order_child_id = #{opPackageOrderChildId,jdbcType=BIGINT}
</select>
<select id="getListByOpPackageIds" resultType="com.ms.dal.entity.OpPackageOrderChild">
select
<include refid="Base_Column_List" />
from op_package
where 1=1
<choose>
<when test="opPackageIds!=null and opPackageIds.size>0">
and op_package_id IN %ls'
<foreach collection="opPackageIds" item="wareId" index="index" open="(" close=")" separator=",">
#{wareId}
</foreach>
</when>
<otherwise>
AND 1=0
</otherwise>
</choose>
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete from op_package_order_child
where op_package_order_child_id = #{opPackageOrderChildId,jdbcType=BIGINT}

@ -24,6 +24,23 @@
from op_package_order
where op_package_order_id = #{opPackageOrderId,jdbcType=BIGINT}
</select>
<select id="getListByOrderIds" resultType="com.ms.dal.entity.OpPackageOrder">
select
<include refid="Base_Column_List" />
from op_package_order
where 1=1
<choose>
<when test="orderIds!=null and orderIds.size>0">
and order_id IN %ls'
<foreach collection="orderIds" item="wareId" index="index" open="(" close=")" separator=",">
#{wareId}
</foreach>
</when>
<otherwise>
AND 1=0
</otherwise>
</choose>
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete from op_package_order

@ -6,6 +6,7 @@ import java.util.Map;
import javax.annotation.Resource;
import com.alibaba.fastjson.JSONObject;
import com.jinritemai.cloud.base.api.BaseRequest;
import com.jinritemai.cloud.base.api.BaseResponse;
import com.ms.api.common.ApiResult;
import com.ms.api.common.Pager;
@ -14,11 +15,14 @@ import com.ms.api.common.Ret;
import com.ms.api.consts.AppConst;
import com.ms.api.consts.DsOrderConst;
import com.ms.api.consts.PurchaseOrderConst;
import com.ms.api.dto.dsapi.response.GetPurchaseOrderItemsAndSourceItemsResponseDTO;
import com.ms.api.dto.dsorder.GetSourceSkuInfosRequestDTO;
import com.ms.api.dto.order.ManualRsyncDdOrdersDTO;
import com.ms.api.dto.order.RsyncAfterSaleRequestDTO;
import com.ms.api.dto.order.RsyncFullOrderRequestDTO;
import com.ms.api.dto.order.SearchDsOrderFilterDTO;
import com.ms.api.dto.order.SearchDsOrderListRequestDTO;
import com.ms.api.service.DistributionOrderService;
import com.ms.api.service.OpOrderService;
import com.ms.api.service.PurchaseOrderService;
import com.ms.api.util.OrderUtil;
@ -56,6 +60,9 @@ public class OrderTestController {
@Resource
private OpOrderService opOrderService;
@Resource
private DistributionOrderService distributionOrderService;
@PostMapping("/searchDsOrderList")
public BaseResponse<Ret> searchDsOrderList(@RequestBody SearchDsOrderListRequestDTO dto) {
String shopId = AppConst.TEST_SHOP_ID;

Loading…
Cancel
Save