20240115-ljl-multiPay
ljl 1 year ago
parent e2693dbfdc
commit 77a9205a35

@ -1,57 +1,22 @@
package com.ms.api.dto.dsapi.response;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serializable;
import java.util.List;
import java.util.Map;
@EqualsAndHashCode(callSuper = true)
@Data
public class GetPurchaseOrderItemsAndSourceItemsResponseDTO extends CommonResponseDTO {
private Map<String, ProductInfo> sourceItemIdAndProductInfoMap;
private Map<String, SourceProductInfo> sourceItemIdAndProductInfoMap;
private Map<String, CommonResponseDTO> sourceItemIdAndProductApiRetMap;
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;
@Data
public static class ProductInfo implements Serializable {
private Long sourceItemId;
private String productType;
private String categoryName;
private String status;
private String title;
private String productUrl;
private List<String> images;
private String instanceCode;
private Integer isJxhyOffer;
private String sellerLoginId;
private Long sellerId;
private String resourceOwner;
private List<Sku> skus;
private EncryptLogisticsOrderSupportChannel encryptLogisticsOrderSupportChannel;
private Map<String, SourceItemSkuRelation> platformSkuIdAndSourceSkuInfoMap;
private Map<String, String> platformSkuIdAndSourceSkuIdMap;
}
@Data
public static class Sku implements Serializable {
private Long sourceSkuId;
private String specId;
private Double retailPrice;
private Double price;
private Double consignPrice;
private String img;
private String skuSubName;
private Long sourceItemId;
private Integer stock;
private String instanceCode;
private Integer isJxhyOffer;
private Double jxhyPrice;
}
@Data
public static class SourceItemSkuRelation implements Serializable {
private Integer moveProductManualSourceSkuRelationId;
@ -164,13 +129,8 @@ public class GetPurchaseOrderItemsAndSourceItemsResponseDTO extends CommonRespon
@Data
public static class SourceItemInfo implements Serializable {
private ProductInfo productInfo;
private SourceProductInfo productInfo;
private Long sourceItemId;
private CommonResponseDTO productApiRet;
}
@Data
public static class EncryptLogisticsOrderSupportChannel implements Serializable {
private List<String> supportChannels;
}
}

@ -0,0 +1,13 @@
package com.ms.api.dto.dsapi.response;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Map;
@EqualsAndHashCode(callSuper = true)
@Data
public class GetSourceItemInfosResponseDTO extends CommonResponseDTO{
private Map<String, SourceProductInfo> sourceItemIdAndProductInfoMap;
private Map<String, CommonResponseDTO> sourceItemIdAndProductApiRetMap;
}

@ -0,0 +1,10 @@
package com.ms.api.dto.dsapi.response;
import lombok.Data;
@Data
public class SourceItemRelation {
private String sourceItemId;
private Long productId;
private String title;
}

@ -0,0 +1,32 @@
package com.ms.api.dto.dsapi.response;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
import java.util.Map;
@Data
public class SourceProductInfo {
private Long sourceItemId;
private String productType;
private String categoryName;
private String status;
private String title;
private String productUrl;
private List<String> images;
private String instanceCode;
private Integer isJxhyOffer;
private String sellerLoginId;
private Long sellerId;
private String resourceOwner;
private List<SourceSkuInfo> skus;
private EncryptLogisticsOrderSupportChannel encryptLogisticsOrderSupportChannel;
private Map<String, String> platformSkuIdAndSourceSkuIdMap;
@Data
public static class EncryptLogisticsOrderSupportChannel implements Serializable {
private List<String> supportChannels;
}
}

@ -0,0 +1,19 @@
package com.ms.api.dto.dsapi.response;
import lombok.Data;
@Data
public class SourceSkuInfo {
private Long sourceSkuId;
private String specId;
private Double retailPrice;
private Double price;
private Double consignPrice;
private String img;
private String skuSubName;
private Long sourceItemId;
private Integer stock;
private String instanceCode;
private Integer isJxhyOffer;
private Double jxhyPrice;
}

@ -1,10 +1,12 @@
package com.ms.api.dto.dsorder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serializable;
import java.util.List;
@EqualsAndHashCode(callSuper = true)
@Data
public class PurchaseOrderCancelMessageDTO extends DsMessageDTO {
private String skuId;

@ -1,7 +1,9 @@
package com.ms.api.dto.dsorder;
import lombok.Data;
import lombok.EqualsAndHashCode;
@EqualsAndHashCode(callSuper = true)
@Data
public class PurchaseOrderChangeMessageDTO extends DsMessageDTO {
private PurchaseOrderDTO purchaseOrderInfo;

@ -38,6 +38,7 @@ public class PurchaseOrderDTO {
private Integer isSupportEncryptOrder;
private List<Long> mergePurchasePlatformOrderIds;
private String notFirst1688OrderType;
private Map<String, RefundInfoDTO> refundInfo;
public List<Long> getSkuIds() {
List<Long> skuIds = new ArrayList<>();

@ -1,7 +1,9 @@
package com.ms.api.dto.dsorder;
import lombok.Data;
import lombok.EqualsAndHashCode;
@EqualsAndHashCode(callSuper = true)
@Data
public class PurchaseOrderRelateMessageDTO extends DsMessageDTO {
private PurchaseOrderDTO purchaseOrderInfo;

@ -0,0 +1,18 @@
package com.ms.api.dto.dsorder;
import lombok.Data;
import java.util.Date;
@Data
public class RefundInfoDTO {
private String refundId;
private String status;
private String refundStatus;
private Date gmtTimeOut;
private String rejectReason;
private String sellerMobile;
private String sellerRealName;
private String sellerReceiveAddress;
private String sellerTel;
}

@ -1,12 +1,13 @@
package com.ms.biz.bo;
import com.ms.api.dto.dsapi.response.GetPurchaseOrderItemsAndSourceItemsResponseDTO;
import com.ms.api.dto.dsapi.response.SourceSkuInfo;
import lombok.Data;
import java.util.Map;
@Data
public class MatchSourceSkuInfoResultBO {
private Map<Long, GetPurchaseOrderItemsAndSourceItemsResponseDTO.Sku> platformSkuIdAndMatchSourceSkuInfoMap;
private Map<Long, SourceSkuInfo> platformSkuIdAndMatchSourceSkuInfoMap;
private Map<Long, MatchFailSkuInfoBO> platformSkuIdAndMatchFailSkuInfoMap;
}

@ -6,7 +6,7 @@ import java.util.List;
public class CommonConst {
public static final String SUCCESS = "success";
public static final String FAIL = "fail";
public static final String PLATFORM = "ddmicroapp";
public static final String PLATFORM = "ddsupplycenter";
public static final String BIZ_MOVE = "move";
public static final int MATERIAL_AUDIT_STATUS_QUEUE_MAX_CNT = 5000;
public static final String COLLECT_TASK_SOURCE_1688 = "1688";

@ -0,0 +1,18 @@
package com.ms.biz.consts;
import java.util.HashMap;
import java.util.Map;
public class Refund1688Const {
public static final String REFUND_STATUS_WAIT_SELLER_AGREE = "waitselleragree";
public static final String REFUND_STATUS_REFUND_SUCCESS = "refundsuccess";
public static final String REFUND_STATUS_REFUND_CLOSE = "refundclose";
public static final String REFUND_STATUS_WAIT_BUYER_MODIFY = "waitbuyermodify";
public static final String REFUND_STATUS_WAIT_BUYER_SEND = "waitbuyersend";
public static final String REFUND_STATUS_WAIT_BUYER_RECEIVE = "waitsellerreceive";
}

@ -1,6 +1,6 @@
package com.ms.biz.dto.openspi.request;
import com.google.gson.annotations.SerializedName;
import com.doudian.open.gson.annotations.SerializedName;
import lombok.Data;
import java.io.Serializable;

@ -1,5 +1,6 @@
package com.ms.biz.dto.openspi.request;
import com.doudian.open.gson.annotations.SerializedName;
import lombok.Data;
import java.util.List;
@ -7,5 +8,7 @@ import java.util.List;
@Data
public class BatchCreateParam {
private List<CreateOrder> orders;
@SerializedName("shop_id")
private Long shopId;
}

@ -1,6 +1,6 @@
package com.ms.biz.dto.openspi.request;
import com.google.gson.annotations.SerializedName;
import com.doudian.open.gson.annotations.SerializedName;
import lombok.Data;
import java.io.Serializable;

@ -1,6 +1,6 @@
package com.ms.biz.dto.openspi.request;
import com.google.gson.annotations.SerializedName;
import com.doudian.open.gson.annotations.SerializedName;
import lombok.Data;
import java.util.List;

@ -1,6 +1,6 @@
package com.ms.biz.dto.openspi.request;
import com.google.gson.annotations.SerializedName;
import com.doudian.open.gson.annotations.SerializedName;
import lombok.Data;
@Data

@ -1,6 +1,6 @@
package com.ms.biz.dto.openspi.request;
import com.google.gson.annotations.SerializedName;
import com.doudian.open.gson.annotations.SerializedName;
import lombok.Data;
@Data
@ -11,6 +11,12 @@ public class SkuOrder {
@SerializedName("sku_order_id")
private String skuOrderId;
@SerializedName("outer_product_id")
private String outerProductId;
@SerializedName("outer_sku_id")
private String outerSkuId;
@SerializedName("cargo_id")
private Long cargoId;

@ -1,6 +1,6 @@
package com.ms.biz.dto.openspi.response;
import com.google.gson.annotations.SerializedName;
import com.doudian.open.gson.annotations.SerializedName;
import lombok.Data;
import java.util.List;

@ -1,6 +1,6 @@
package com.ms.biz.dto.openspi.response;
import com.google.gson.annotations.SerializedName;
import com.doudian.open.gson.annotations.SerializedName;
import lombok.Data;
import java.util.List;

@ -1,6 +1,6 @@
package com.ms.biz.dto.openspi.response;
import com.google.gson.annotations.SerializedName;
import com.doudian.open.gson.annotations.SerializedName;
import lombok.Data;
import java.io.Serializable;

@ -1,6 +1,6 @@
package com.ms.biz.dto.openspi.response;
import com.google.gson.annotations.SerializedName;
import com.doudian.open.gson.annotations.SerializedName;
import lombok.Data;
import java.io.Serializable;

@ -1,6 +1,6 @@
package com.ms.biz.dto.openspi.response;
import com.google.gson.annotations.SerializedName;
import com.doudian.open.gson.annotations.SerializedName;
import lombok.Data;
@Data

@ -0,0 +1,21 @@
package com.ms.biz.service;
import com.ms.dal.entity.DdAftersaleMsg;
/**
*
*/
public interface DdAftersaleMsgService {
int deleteByPrimaryKey(Long id);
int insert(DdAftersaleMsg record);
int insertSelective(DdAftersaleMsg record);
DdAftersaleMsg selectByPrimaryKey(Long id);
int updateByPrimaryKeySelective(DdAftersaleMsg record);
int updateByPrimaryKey(DdAftersaleMsg record);
}

@ -0,0 +1,21 @@
package com.ms.biz.service;
import com.ms.dal.entity.DdTradeMsg;
/**
*
*/
public interface DdTradeMsgService {
int deleteByPrimaryKey(Long id);
int insert(DdTradeMsg record);
int insertSelective(DdTradeMsg record);
DdTradeMsg selectByPrimaryKey(Long id);
int updateByPrimaryKeySelective(DdTradeMsg record);
int updateByPrimaryKey(DdTradeMsg record);
}

@ -0,0 +1,21 @@
package com.ms.biz.service;
import com.ms.dal.entity.DoudianAftersaleMsgBuffer;
/**
*
*/
public interface DoudianAftersaleMsgBufferService {
int deleteByPrimaryKey(Long id);
int insert(DoudianAftersaleMsgBuffer record);
int insertSelective(DoudianAftersaleMsgBuffer record);
DoudianAftersaleMsgBuffer selectByPrimaryKey(Long id);
int updateByPrimaryKeySelective(DoudianAftersaleMsgBuffer record);
int updateByPrimaryKey(DoudianAftersaleMsgBuffer record);
}

@ -0,0 +1,21 @@
package com.ms.biz.service;
import com.ms.dal.entity.DoudianAftersaleMsgQueue;
/**
*
*/
public interface DoudianAftersaleMsgQueueService {
int deleteByPrimaryKey(Long id);
int insert(DoudianAftersaleMsgQueue record);
int insertSelective(DoudianAftersaleMsgQueue record);
DoudianAftersaleMsgQueue selectByPrimaryKey(Long id);
int updateByPrimaryKeySelective(DoudianAftersaleMsgQueue record);
int updateByPrimaryKey(DoudianAftersaleMsgQueue record);
}

@ -0,0 +1,21 @@
package com.ms.biz.service;
import com.ms.dal.entity.DoudianMsgParseQueue;
/**
*
*/
public interface DoudianMsgParseQueueService {
int deleteByPrimaryKey(Long id);
int insert(DoudianMsgParseQueue record);
int insertSelective(DoudianMsgParseQueue record);
DoudianMsgParseQueue selectByPrimaryKey(Long id);
int updateByPrimaryKeySelective(DoudianMsgParseQueue record);
int updateByPrimaryKey(DoudianMsgParseQueue record);
}

@ -0,0 +1,32 @@
package com.ms.biz.service;
import com.ms.dal.entity.DoudianMsg;
import com.ms.dal.entity.DoudianMsgParseQueue;
/**
*
*/
public interface DoudianMsgService {
int deleteByPrimaryKey(Long id);
int insert(DoudianMsg record);
int insertSelective(DoudianMsg record);
DoudianMsg selectByPrimaryKey(Long id);
int updateByPrimaryKeySelective(DoudianMsg record);
int updateByPrimaryKey(DoudianMsg record);
boolean addDoudianMsg(String msgBody);
DoudianMsgParseQueue lockDoudianMsgParseQueue();
boolean processDoudianMsgParseQueue(Long doudianMsgId);
void failProcessDoudianMsgParseQueue(Long doudianMsgId);
boolean deleteDoudianMsgParseQueue(Long doudianMsgId);
}

@ -0,0 +1,21 @@
package com.ms.biz.service;
import com.ms.dal.entity.DoudianTradeMsgBuffer;
/**
*
*/
public interface DoudianTradeMsgBufferService {
int deleteByPrimaryKey(Long id);
int insert(DoudianTradeMsgBuffer record);
int insertSelective(DoudianTradeMsgBuffer record);
DoudianTradeMsgBuffer selectByPrimaryKey(Long id);
int updateByPrimaryKeySelective(DoudianTradeMsgBuffer record);
int updateByPrimaryKey(DoudianTradeMsgBuffer record);
}

@ -0,0 +1,21 @@
package com.ms.biz.service;
import com.ms.dal.entity.DoudianTradeMsgQueue;
/**
*
*/
public interface DoudianTradeMsgQueueService {
int deleteByPrimaryKey(Long id);
int insert(DoudianTradeMsgQueue record);
int insertSelective(DoudianTradeMsgQueue record);
DoudianTradeMsgQueue selectByPrimaryKey(Long id);
int updateByPrimaryKeySelective(DoudianTradeMsgQueue record);
int updateByPrimaryKey(DoudianTradeMsgQueue record);
}

@ -22,4 +22,5 @@ public interface DsApiService {
CommonResponseDTO cancelPurchaseOrder(String platform, Long shopId, String orderId, String purchaseOrderSn);
GetPurchaseOrderPayUrlResponseDTO getPurchaseOrderPayUrl(List<String> sourceOrderId, Long shopId);
GetPlatformAuthUrlResponseDTO getPlatformAuthUrl(ShopBO shopBO);
GetSourceItemInfosResponseDTO getSourceItemInfos(Long shopId, List<String> sourceItemIds);
}

@ -34,4 +34,6 @@ public interface DsMessageService {
void addDsMessage(Long shopId, Long platformPushMsgId, String bizId, String bizType, String data);
void clearDsMessageQueue(DsMessageConsumerQueue queue, ResultDTO result);
void processDsMessage(Long dsMessageId);
}

@ -0,0 +1,21 @@
package com.ms.biz.service;
import com.ms.dal.entity.PlatformPurchaseOrderAddress;
/**
*
*/
public interface PlatformPurchaseOrderAddressService {
int deleteByPrimaryKey(String id);
int insert(PlatformPurchaseOrderAddress record);
int insertSelective(PlatformPurchaseOrderAddress record);
PlatformPurchaseOrderAddress selectByPrimaryKey(String id);
int updateByPrimaryKeySelective(PlatformPurchaseOrderAddress record);
int updateByPrimaryKey(PlatformPurchaseOrderAddress record);
}

@ -0,0 +1,21 @@
package com.ms.biz.service;
import com.ms.dal.entity.PlatformPurchaseOrderMaskAddress;
/**
*
*/
public interface PlatformPurchaseOrderMaskAddressService {
int deleteByPrimaryKey(String id);
int insert(PlatformPurchaseOrderMaskAddress record);
int insertSelective(PlatformPurchaseOrderMaskAddress record);
PlatformPurchaseOrderMaskAddress selectByPrimaryKey(String id);
int updateByPrimaryKeySelective(PlatformPurchaseOrderMaskAddress record);
int updateByPrimaryKey(PlatformPurchaseOrderMaskAddress record);
}

@ -0,0 +1,21 @@
package com.ms.biz.service;
import com.ms.dal.entity.PlatformPurchaseOrder;
/**
*
*/
public interface PlatformPurchaseOrderService {
int deleteByPrimaryKey(String id);
int insert(PlatformPurchaseOrder record);
int insertSelective(PlatformPurchaseOrder record);
PlatformPurchaseOrder selectByPrimaryKey(String id);
int updateByPrimaryKeySelective(PlatformPurchaseOrder record);
int updateByPrimaryKey(PlatformPurchaseOrder record);
}

@ -0,0 +1,21 @@
package com.ms.biz.service;
import com.ms.dal.entity.PlatformPurchaseOrderSku;
/**
*
*/
public interface PlatformPurchaseOrderSkuService {
int deleteByPrimaryKey(String id);
int insert(PlatformPurchaseOrderSku record);
int insertSelective(PlatformPurchaseOrderSku record);
PlatformPurchaseOrderSku selectByPrimaryKey(String id);
int updateByPrimaryKeySelective(PlatformPurchaseOrderSku record);
int updateByPrimaryKey(PlatformPurchaseOrderSku record);
}

@ -1,21 +0,0 @@
package com.ms.biz.service;
import com.ms.dal.entity.PurchaseOrderAddress;
/**
*
*/
public interface PurchaseOrderAddressService {
int deleteByPrimaryKey(Long id);
int insert(PurchaseOrderAddress record);
int insertSelective(PurchaseOrderAddress record);
PurchaseOrderAddress selectByPrimaryKey(Long id);
int updateByPrimaryKeySelective(PurchaseOrderAddress record);
int updateByPrimaryKey(PurchaseOrderAddress record);
}

@ -0,0 +1,21 @@
package com.ms.biz.service;
import com.ms.dal.entity.PurchaseOrderItem;
/**
*
*/
public interface PurchaseOrderItemService {
int deleteByPrimaryKey(Long id);
int insert(PurchaseOrderItem record);
int insertSelective(PurchaseOrderItem record);
PurchaseOrderItem selectByPrimaryKey(Long id);
int updateByPrimaryKeySelective(PurchaseOrderItem record);
int updateByPrimaryKey(PurchaseOrderItem record);
}

@ -1,21 +0,0 @@
package com.ms.biz.service;
import com.ms.dal.entity.PurchaseOrderMaskAddress;
/**
*
*/
public interface PurchaseOrderMaskAddressService {
int deleteByPrimaryKey(Long id);
int insert(PurchaseOrderMaskAddress record);
int insertSelective(PurchaseOrderMaskAddress record);
PurchaseOrderMaskAddress selectByPrimaryKey(Long id);
int updateByPrimaryKeySelective(PurchaseOrderMaskAddress record);
int updateByPrimaryKey(PurchaseOrderMaskAddress record);
}

@ -1,21 +0,0 @@
package com.ms.biz.service;
import com.ms.dal.entity.PurchaseOrderSku;
/**
*
*/
public interface PurchaseOrderSkuService {
int deleteByPrimaryKey(Long id);
int insert(PurchaseOrderSku record);
int insertSelective(PurchaseOrderSku record);
PurchaseOrderSku selectByPrimaryKey(Long id);
int updateByPrimaryKeySelective(PurchaseOrderSku record);
int updateByPrimaryKey(PurchaseOrderSku record);
}

@ -0,0 +1,53 @@
package com.ms.biz.service.impl;
import com.ms.dal.entity.DdAftersaleMsg;
import com.ms.biz.service.DdAftersaleMsgService;
import com.ms.dal.mapper.DdAftersaleMsgMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
*
*/
@Service
public class DdAftersaleMsgServiceImpl implements DdAftersaleMsgService{
@Autowired
private DdAftersaleMsgMapper ddAftersaleMsgMapper;
@Override
public int deleteByPrimaryKey(Long id) {
return ddAftersaleMsgMapper.deleteByPrimaryKey(id);
}
@Override
public int insert(DdAftersaleMsg record) {
return ddAftersaleMsgMapper.insert(record);
}
@Override
public int insertSelective(DdAftersaleMsg record) {
return ddAftersaleMsgMapper.insertSelective(record);
}
@Override
public DdAftersaleMsg selectByPrimaryKey(Long id) {
return ddAftersaleMsgMapper.selectByPrimaryKey(id);
}
@Override
public int updateByPrimaryKeySelective(DdAftersaleMsg record) {
return ddAftersaleMsgMapper.updateByPrimaryKeySelective(record);
}
@Override
public int updateByPrimaryKey(DdAftersaleMsg record) {
return ddAftersaleMsgMapper.updateByPrimaryKey(record);
}
}

@ -0,0 +1,53 @@
package com.ms.biz.service.impl;
import com.ms.dal.entity.DdTradeMsg;
import com.ms.biz.service.DdTradeMsgService;
import com.ms.dal.mapper.DdTradeMsgMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
*
*/
@Service
public class DdTradeMsgServiceImpl implements DdTradeMsgService{
@Autowired
private DdTradeMsgMapper ddTradeMsgMapper;
@Override
public int deleteByPrimaryKey(Long id) {
return ddTradeMsgMapper.deleteByPrimaryKey(id);
}
@Override
public int insert(DdTradeMsg record) {
return ddTradeMsgMapper.insert(record);
}
@Override
public int insertSelective(DdTradeMsg record) {
return ddTradeMsgMapper.insertSelective(record);
}
@Override
public DdTradeMsg selectByPrimaryKey(Long id) {
return ddTradeMsgMapper.selectByPrimaryKey(id);
}
@Override
public int updateByPrimaryKeySelective(DdTradeMsg record) {
return ddTradeMsgMapper.updateByPrimaryKeySelective(record);
}
@Override
public int updateByPrimaryKey(DdTradeMsg record) {
return ddTradeMsgMapper.updateByPrimaryKey(record);
}
}

@ -1,12 +1,16 @@
package com.ms.biz.service.impl;
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.ms.api.dto.dsapi.request.*;
import com.ms.api.dto.dsapi.response.BatchCreateDistributionOrdersResponseDTO;
import com.ms.api.dto.dsapi.response.DsSuccessRetDTO;
import com.ms.api.dto.dsapi.response.GetPurchaseOrderPayUrlResponseDTO;
import com.ms.api.dto.dsapi.response.*;
import com.ms.api.dto.dsorder.PurchaseOrderDTO;
import com.ms.api.dto.dsorder.PurchaseOrderItemDTO;
import com.ms.biz.consts.CommonConst;
import com.ms.biz.consts.DsOrderConst;
import com.ms.biz.consts.PurchaseOrderConst;
import com.ms.biz.consts.StatusConst;
import com.ms.biz.dto.openspi.request.*;
import com.ms.biz.dto.openspi.response.BatchCreateData;
import com.ms.biz.dto.openspi.response.BatchPayData;
@ -14,22 +18,20 @@ import com.ms.biz.dto.openspi.response.OrderResult;
import com.ms.biz.dto.openspi.response.PaymentResult;
import com.ms.biz.service.DistributionOrderService;
import com.ms.biz.service.DsApiService;
import com.ms.dal.entity.PurchaseOrder;
import com.ms.dal.entity.PurchaseOrderAddress;
import com.ms.dal.entity.PurchaseOrderMaskAddress;
import com.ms.dal.entity.PurchaseOrderSku;
import com.ms.dal.mapper.PurchaseOrderAddressMapper;
import com.ms.dal.mapper.PurchaseOrderMapper;
import com.ms.dal.mapper.PurchaseOrderMaskAddressMapper;
import com.ms.dal.mapper.PurchaseOrderSkuMapper;
import com.ms.biz.util.DDApi;
import com.ms.dal.entity.*;
import com.ms.dal.mapper.*;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
import org.springframework.stereotype.Service;
import org.springframework.transaction.TransactionDefinition;
import org.springframework.transaction.TransactionStatus;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;
@Service
@Slf4j
@ -38,127 +40,274 @@ public class DistributionOrderServiceImpl implements DistributionOrderService {
private final DataSourceTransactionManager dataSourceTransactionManager;
private final TransactionDefinition transactionDefinition;
private PlatformPurchaseOrderMapper platformPurchaseOrderMapper;
private PlatformPurchaseOrderSkuMapper platformPurchaseOrderSkuMapper;
private PlatformPurchaseOrderAddressMapper platformPurchaseOrderAddressMapper;
private PlatformPurchaseOrderMaskAddressMapper platformPurchaseOrderMaskAddressMapper;
private PurchaseOrderMapper purchaseOrderMapper;
private PurchaseOrderSkuMapper purchaseOrderSkuMapper;
private PurchaseOrderAddressMapper purchaseOrderAddressMapper;
private PurchaseOrderMaskAddressMapper purchaseOrderMaskAddressMapper;
private PurchaseOrderItemMapper purchaseOrderItemMapper;
private DsApiService dsApiService;
@Override
public void batchCreate(BatchCreateParam param, BatchCreateData data) {
System.out.println("param: " + param);
if (param.getOrders().size() > 1) {
throw new RuntimeException("目前暂不支持多单采购");
}
Long shopId = param.getShopId();
Map<String, String> orderIdAndPurOrderIdMap = new HashMap<>();
Map<Long, String> skuIdAndPurSkuOrderIdMap = new HashMap<>();
for (CreateOrder order: param.getOrders()) {
orderIdAndPurOrderIdMap.put(order.getOrderId(), order.getPurOrderId());
for (SkuOrder skuOrder: order.getSkuOrders()) {
skuIdAndPurSkuOrderIdMap.put(skuOrder.getSkuId(), skuOrder.getPurSkuOrderId());
}
}
Set<String> purOrderIds = new HashSet<>(orderIdAndPurOrderIdMap.values());
List<PlatformPurchaseOrder> existsPlatformPurchaseOrders = platformPurchaseOrderMapper.getListByPurOrderIds(new ArrayList<>(purOrderIds));
Set<String> existsPurOrderIds = existsPlatformPurchaseOrders.stream().map(PlatformPurchaseOrder::getPurOrderId).collect(Collectors.toSet());
if (!existsPurOrderIds.isEmpty()) {
throw new RuntimeException("已经存在采购单号:" + String.join(",", existsPurOrderIds));
}
storeCreateOrders(shopId, param.getOrders());
BatchCreateDistributionOrdersRequestDTO request = buildBatchCreateDistributionOrdersRequestDTO(param);
BatchCreateDistributionOrdersResponseDTO response = dsApiService.batchCreateDistributionOrders(param.getShopId(), request);
List<OrderResult> orderResults = new ArrayList<>();
List<PurchaseOrder> purchaseOrders = new ArrayList<>();
List<PurchaseOrderItem> purchaseOrderItems = new ArrayList<>();
for (DsSuccessRetDTO successRet: response.getSuccessList()) {
for (PurchaseOrderDTO purchaseOrder: successRet.getRelatePurchaseOrderInfos()) {
OrderResult orderResult = new OrderResult();
orderResult.setOutPreOrderId(purchaseOrder.getPurchaseOrderSn());
orderResult.setPurOrderId(purchaseOrder.getPlatformOrderId());
orderResult.setSupplierOrderId(purchaseOrder.getPurchaseOrderSn());
orderResult.setSupplierOrderUrl(null);
List<OrderResult.SkuOrderResult> skuOrderResults = new ArrayList<>();
for (PurchaseOrderItemDTO item: purchaseOrder.getItems()) {
OrderResult.SkuOrderResult skuOrderResult = new OrderResult.SkuOrderResult();
skuOrderResult.setPurSkuOrderId("");
skuOrderResult.setSupplierSkuOrderId("");
skuOrderResults.add(skuOrderResult);
}
orderResult.setSkuOrderResults(skuOrderResults);
for (PurchaseOrderDTO purchaseOrderDTO: successRet.getRelatePurchaseOrderInfos()) {
String purOrderId = orderIdAndPurOrderIdMap.get(purchaseOrderDTO.getPlatformOrderId());
PurchaseOrder purchaseOrder = buildPurchaseOrderByDTO(purchaseOrderDTO, purOrderId);
purchaseOrders.add(purchaseOrder);
List<PurchaseOrderItem> items = buildPurchaseOrderItemsByPurchaseOrderDTO(purchaseOrderDTO, purOrderId);
purchaseOrderItems.addAll(items);
OrderResult orderResult = buildOrderResult(purchaseOrderDTO, orderIdAndPurOrderIdMap, skuIdAndPurSkuOrderIdMap);
orderResults.add(orderResult);
}
}
data.setOrderResults(orderResults);
purchaseOrderItemMapper.insertBatch(purchaseOrderItems);
purchaseOrderMapper.insertBatch(purchaseOrders);
}
private PurchaseOrder buildPurchaseOrderByDTO(PurchaseOrderDTO purchaseOrderDTO, String purOrderId) {
Date purchaseOrderSendTime = null;
Date purchaseOrderStartTime = null;
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
try {
if (StringUtils.isNotBlank(purchaseOrderDTO.getPurchaseOrderStartTime())) {
purchaseOrderStartTime = dateFormat.parse(purchaseOrderDTO.getPurchaseOrderStartTime());
}
if (StringUtils.isNotBlank(purchaseOrderDTO.getPurchaseOrderSendTime())) {
purchaseOrderSendTime = dateFormat.parse(purchaseOrderDTO.getPurchaseOrderSendTime());
}
} catch (java.text.ParseException e) {
throw new RuntimeException("时间格式错误");
}
PurchaseOrder purchaseOrder = new PurchaseOrder();
purchaseOrder.setPurOrderId(purOrderId);
purchaseOrder.setOrderId(Long.valueOf(purchaseOrderDTO.getPlatformOrderId()));
purchaseOrder.setPurchasePlatform(purchaseOrderDTO.getPurchasePlatform());
purchaseOrder.setPurchaseOrderStatus(purchaseOrderDTO.getPurchaseOrderStatus());
purchaseOrder.setPurchaseOrderSendTime(purchaseOrderSendTime);
purchaseOrder.setPurchaseOrderStartTime(purchaseOrderStartTime);
purchaseOrder.setPurchaseOrderBuyer(purchaseOrderDTO.getPurchaseOrderBuyer());
purchaseOrder.setPurchaseOrderSeller(purchaseOrderDTO.getPurchaseOrderSeller());
purchaseOrder.setLogisticsIsAccept(purchaseOrderDTO.getLogisticsIsAccept());
purchaseOrder.setPurchaseOrderFullAddress(purchaseOrderDTO.getPurchaseOrderFullAddress());
purchaseOrder.setPurchaseOrderMobile(purchaseOrderDTO.getPurchaseOrderMobile());
purchaseOrder.setPurchaseOrderFullname(purchaseOrderDTO.getPurchaseOrderFullname());
purchaseOrder.setPurchaseOrderSn(purchaseOrderDTO.getPurchaseOrderSn());
purchaseOrder.setPurchaseOrderLogisticsName(purchaseOrderDTO.getPurchaseOrderLogisticsName());
purchaseOrder.setPurchaseOrderWaybillCode(purchaseOrderDTO.getPurchaseOrderWaybillCode());
purchaseOrder.setStatus(StatusConst.normal);
purchaseOrder.setGmtCreate(new Date());
purchaseOrder.setGmtModified(new Date());
return purchaseOrder;
}
private List<PurchaseOrderItem> buildPurchaseOrderItemsByPurchaseOrderDTO(PurchaseOrderDTO purchaseOrderDTO, String purOrderId) {
List<PurchaseOrderItem> items = new ArrayList<>();
for (PurchaseOrderItemDTO itemDTO: purchaseOrderDTO.getItems()) {
PurchaseOrderItem item = new PurchaseOrderItem();
item.setPurOrderId(purOrderId);
item.setOrderId(Long.valueOf(purchaseOrderDTO.getPlatformOrderId()));
item.setPurchaseNum(itemDTO.getPurchaseNum());
item.setSkuId(itemDTO.getSkuId());
item.setWareId(itemDTO.getWareId());
item.setPurchaseUrl(itemDTO.getPurchaseUrl());
item.setStatus(StatusConst.normal);
item.setGmtCreate(new Date());
item.setGmtModified(new Date());
items.add(item);
}
return items;
}
private Map<String, Map<Long, String>> getSkuAndProductOfSourceMap(List<Long> productIds) {
List<Long> hadGetProductIds = new ArrayList<>();
Map<Long, String> skuIdAndOutSkuIdMap = new HashMap<>();
Map<Long, String> productIdAndOutProductIdMap = new HashMap<>();
for (Long productId: productIds) {
if (hadGetProductIds.contains(productId)) {
continue;
}
SupplyCenterCargoDetailParam supplyCenterCargoDetailParam = new SupplyCenterCargoDetailParam();
supplyCenterCargoDetailParam.setProductId(productId.toString());
SupplyCenterCargoDetailData supplyCenterCargoDetailData = DDApi.supplyCenterCargoDetail(supplyCenterCargoDetailParam);
productIdAndOutProductIdMap.put(productId, supplyCenterCargoDetailData.getOuterProductId());
for (SpecPricesItem item: supplyCenterCargoDetailData.getSpecPrices()) {
skuIdAndOutSkuIdMap.put(item.getSkuId(), item.getOuterSkuId());
}
hadGetProductIds.add(productId);
}
Map<String, Map<Long, String>> result = new HashMap<>();
result.put("skuIdAndOutSkuIdMap", skuIdAndOutSkuIdMap);
result.put("productIdAndOutProductIdMap", productIdAndOutProductIdMap);
return result;
}
private Map<Long, SourceProductInfo> getProductIdAndSourceProductInfoMap(Long shopId, Map<Long, String> productIdAndOutProductIdMap) {
List<String> sourceItemIds = new ArrayList<>(productIdAndOutProductIdMap.values());
GetSourceItemInfosResponseDTO sourceItemInfosResp = dsApiService.getSourceItemInfos(shopId, sourceItemIds);
if (!sourceItemInfosResp.isSuccess()) {
throw new RuntimeException(sourceItemInfosResp.getReason());
}
List<String> errorList = new ArrayList<>();
for (Map.Entry<String, CommonResponseDTO> entry: sourceItemInfosResp.getSourceItemIdAndProductApiRetMap().entrySet()) {
errorList.add(entry.getValue().getReason());
}
if (!errorList.isEmpty()) {
throw new RuntimeException(String.join(" / ", errorList));
}
Map<Long, SourceProductInfo> productIdAndSourceProductInfoMap = new HashMap<>();
for (Map.Entry<Long, String> entry : productIdAndOutProductIdMap.entrySet()) {
SourceProductInfo sourceProductInfo = sourceItemInfosResp.getSourceItemIdAndProductInfoMap().get(entry.getValue());
productIdAndSourceProductInfoMap.put(entry.getKey(), sourceProductInfo);
}
return productIdAndSourceProductInfoMap;
}
private OrderResult buildOrderResult(PurchaseOrderDTO purchaseOrder, Map<String, String> orderIdAndPurOrderIdMap, Map<Long, String> skuIdAndPurSkuOrderIdMap) {
OrderResult orderResult = new OrderResult();
orderResult.setOutPreOrderId(""); // TODO 无此参数
orderResult.setPurOrderId(orderIdAndPurOrderIdMap.get(purchaseOrder.getPlatformOrderId()));
orderResult.setSupplierOrderId(purchaseOrder.getPurchaseOrderSn());
orderResult.setSupplierOrderUrl(null);
List<OrderResult.SkuOrderResult> skuOrderResults = new ArrayList<>();
for (PurchaseOrderItemDTO item: purchaseOrder.getItems()) {
OrderResult.SkuOrderResult skuOrderResult = new OrderResult.SkuOrderResult();
skuOrderResult.setPurSkuOrderId(skuIdAndPurSkuOrderIdMap.get(item.getSkuId()));
skuOrderResult.setSupplierSkuOrderId(""); // TODO 无此参数
skuOrderResults.add(skuOrderResult);
}
orderResult.setSkuOrderResults(skuOrderResults);
return orderResult;
}
private void storeCreateOrders(Long shopId, List<CreateOrder> orders) {
TransactionStatus transactionStatus = dataSourceTransactionManager.getTransaction(transactionDefinition);
try {
for (CreateOrder order: orders) {
savePurchaseOrder(shopId, order);
savePurchaseOrderAddress(shopId, order.getPurOrderId(), order.getPostAddress());
savePurchaseOrderMaskAddress(shopId, order.getPurOrderId(), order.getMaskPostAddress());
savePurchaseOrderSku(shopId, order.getPurOrderId(), order.getSkuOrders());
savePlatformPurchaseOrder(shopId, order);
savePlatformPurchaseOrderAddress(shopId, order.getPurOrderId(), order.getPostAddress());
savePlatformPurchaseOrderMaskAddress(shopId, order.getPurOrderId(), order.getMaskPostAddress());
savePlatformPurchaseOrderSku(shopId, order.getPurOrderId(), order.getSkuOrders());
}
dataSourceTransactionManager.commit(transactionStatus);
} catch (Throwable e) {
log.error("storeCreateOrders", e);
dataSourceTransactionManager.rollback(transactionStatus);
throw new RuntimeException("数据保存异常");
throw new RuntimeException("数据保存异常:" + e.getMessage());
}
}
private PurchaseOrder savePurchaseOrder(Long shopId, CreateOrder order) {
PurchaseOrder purchaseOrder = new PurchaseOrder();
purchaseOrder.setPurOrderId(order.getPurOrderId());
purchaseOrder.setOrderId(order.getOrderId());
purchaseOrder.setShopId(shopId);
purchaseOrder.setGmtModified(new Date());
purchaseOrder.setGmtModified(new Date());
purchaseOrderMapper.insertSelective(purchaseOrder);
return purchaseOrder;
private PlatformPurchaseOrder savePlatformPurchaseOrder(Long shopId, CreateOrder order) {
PlatformPurchaseOrder platformPurchaseOrder = new PlatformPurchaseOrder();
platformPurchaseOrder.setPurOrderId(order.getPurOrderId());
platformPurchaseOrder.setOrderId(order.getOrderId());
platformPurchaseOrder.setShopId(shopId);
platformPurchaseOrder.setPurchaseStatus(PurchaseOrderConst.PURCHASE_ORDER_STATUS_WAIT_PAY);
platformPurchaseOrder.setStatus(StatusConst.normal);
platformPurchaseOrder.setGmtModified(new Date());
platformPurchaseOrder.setGmtModified(new Date());
platformPurchaseOrderMapper.insertSelective(platformPurchaseOrder);
return platformPurchaseOrder;
}
private List<PurchaseOrderSku> savePurchaseOrderSku(Long shopId, String purOrderId, List<SkuOrder> skuOrders) {
List<PurchaseOrderSku> purchaseOrderSkus = new ArrayList<>();
private List<PlatformPurchaseOrderSku> savePlatformPurchaseOrderSku(Long shopId, String purOrderId, List<SkuOrder> skuOrders) {
if (skuOrders.isEmpty()) {
return new ArrayList<>();
}
List<PlatformPurchaseOrderSku> platformPurchaseOrderSkus = new ArrayList<>();
for (SkuOrder skuOrder: skuOrders) {
PurchaseOrderSku purchaseOrderSku = new PurchaseOrderSku();
purchaseOrderSku.setPurOrderId(purOrderId);
purchaseOrderSku.setShopId(shopId);
purchaseOrderSku.setPurSkuOrderId(skuOrder.getPurSkuOrderId());
purchaseOrderSku.setSkuId(skuOrder.getSkuId());
purchaseOrderSku.setProductId(skuOrder.getProductId());
purchaseOrderSku.setCargoId(skuOrder.getCargoId());
purchaseOrderSku.setCargoSkuId(skuOrder.getCargoSkuId());
purchaseOrderSku.setNum(skuOrder.getNum());
purchaseOrderSku.setGmtModified(new Date());
purchaseOrderSku.setGmtCreate(new Date());
PlatformPurchaseOrderSku platformPurchaseOrderSku = new PlatformPurchaseOrderSku();
platformPurchaseOrderSku.setPurOrderId(purOrderId);
platformPurchaseOrderSku.setShopId(shopId);
platformPurchaseOrderSku.setPurSkuOrderId(skuOrder.getPurSkuOrderId());
platformPurchaseOrderSku.setOuterSkuId(skuOrder.getOuterSkuId());
platformPurchaseOrderSku.setOuterProductId(skuOrder.getOuterProductId());
platformPurchaseOrderSku.setSkuOrderId(skuOrder.getSkuOrderId());
platformPurchaseOrderSku.setSkuId(skuOrder.getSkuId());
platformPurchaseOrderSku.setProductId(skuOrder.getProductId());
platformPurchaseOrderSku.setCargoId(skuOrder.getCargoId());
platformPurchaseOrderSku.setCargoSkuId(skuOrder.getCargoSkuId());
platformPurchaseOrderSku.setNum(skuOrder.getNum());
platformPurchaseOrderSku.setGmtModified(new Date());
platformPurchaseOrderSku.setGmtCreate(new Date());
platformPurchaseOrderSkus.add(platformPurchaseOrderSku);
}
purchaseOrderSkuMapper.insertBatch(purchaseOrderSkus);
return purchaseOrderSkus;
System.out.println("purchaseOrderSkus: " + platformPurchaseOrderSkus);
platformPurchaseOrderSkuMapper.insertBatch(platformPurchaseOrderSkus);
return platformPurchaseOrderSkus;
}
private PurchaseOrderAddress savePurchaseOrderAddress(Long shopId, String purOrderId, Address address) {
PurchaseOrderAddress purchaseOrderAddress = new PurchaseOrderAddress();
purchaseOrderAddress.setPurOrderId(purOrderId);
purchaseOrderAddress.setShopId(shopId);
purchaseOrderAddress.setProvinceId(address.getProvince().getId());
purchaseOrderAddress.setProvinceName(address.getProvince().getName());
purchaseOrderAddress.setCityId(address.getCity().getId());
purchaseOrderAddress.setCityName(address.getCity().getName());
purchaseOrderAddress.setTownId(address.getTown().getId());
purchaseOrderAddress.setTownName(address.getTown().getName());
purchaseOrderAddress.setEncryptDetail(address.getEncryptDetail());
purchaseOrderAddress.setPostReceiver(address.getPostReceiver());
purchaseOrderAddress.setPostTel(address.getPostTel());
purchaseOrderAddress.setGmtCreate(new Date());
purchaseOrderAddress.setGmtModified(new Date());
purchaseOrderAddressMapper.insertSelective(purchaseOrderAddress);
return purchaseOrderAddress;
private PlatformPurchaseOrderAddress savePlatformPurchaseOrderAddress(Long shopId, String purOrderId, Address address) {
PlatformPurchaseOrderAddress platformPurchaseOrderAddress = new PlatformPurchaseOrderAddress();
platformPurchaseOrderAddress.setPurOrderId(purOrderId);
platformPurchaseOrderAddress.setShopId(shopId);
platformPurchaseOrderAddress.setProvinceId(address.getProvince().getId());
platformPurchaseOrderAddress.setProvinceName(address.getProvince().getName());
platformPurchaseOrderAddress.setCityId(address.getCity().getId());
platformPurchaseOrderAddress.setCityName(address.getCity().getName());
platformPurchaseOrderAddress.setTownId(address.getTown().getId());
platformPurchaseOrderAddress.setTownName(address.getTown().getName());
platformPurchaseOrderAddress.setEncryptDetail(address.getEncryptDetail());
platformPurchaseOrderAddress.setPostReceiver(address.getPostReceiver());
platformPurchaseOrderAddress.setPostTel(address.getPostTel());
platformPurchaseOrderAddress.setGmtCreate(new Date());
platformPurchaseOrderAddress.setGmtModified(new Date());
platformPurchaseOrderAddressMapper.insertSelective(platformPurchaseOrderAddress);
return platformPurchaseOrderAddress;
}
private PurchaseOrderMaskAddress savePurchaseOrderMaskAddress(Long shopId, String purOrderId, Address address) {
PurchaseOrderMaskAddress purchaseOrderMaskAddress = new PurchaseOrderMaskAddress();
purchaseOrderMaskAddress.setPurOrderId(purOrderId);
purchaseOrderMaskAddress.setShopId(shopId);
purchaseOrderMaskAddress.setProvinceId(address.getProvince().getId());
purchaseOrderMaskAddress.setProvinceName(address.getProvince().getName());
purchaseOrderMaskAddress.setCityId(address.getCity().getId());
purchaseOrderMaskAddress.setCityName(address.getCity().getName());
purchaseOrderMaskAddress.setTownId(address.getTown().getId());
purchaseOrderMaskAddress.setTownName(address.getTown().getName());
purchaseOrderMaskAddress.setDetail(address.getDetail());
purchaseOrderMaskAddress.setPostReceiver(address.getPostReceiver());
purchaseOrderMaskAddress.setPostTel(address.getPostTel());
purchaseOrderMaskAddress.setGmtCreate(new Date());
purchaseOrderMaskAddress.setGmtModified(new Date());
purchaseOrderMaskAddressMapper.insertSelective(purchaseOrderMaskAddress);
return purchaseOrderMaskAddress;
private PlatformPurchaseOrderMaskAddress savePlatformPurchaseOrderMaskAddress(Long shopId, String purOrderId, Address address) {
PlatformPurchaseOrderMaskAddress platformPurchaseOrderMaskAddress = new PlatformPurchaseOrderMaskAddress();
platformPurchaseOrderMaskAddress.setPurOrderId(purOrderId);
platformPurchaseOrderMaskAddress.setShopId(shopId);
platformPurchaseOrderMaskAddress.setProvinceId(address.getProvince().getId());
platformPurchaseOrderMaskAddress.setProvinceName(address.getProvince().getName());
platformPurchaseOrderMaskAddress.setCityId(address.getCity().getId());
platformPurchaseOrderMaskAddress.setCityName(address.getCity().getName());
platformPurchaseOrderMaskAddress.setTownId(address.getTown().getId());
platformPurchaseOrderMaskAddress.setTownName(address.getTown().getName());
platformPurchaseOrderMaskAddress.setDetail(address.getDetail());
platformPurchaseOrderMaskAddress.setPostReceiver(address.getPostReceiver());
platformPurchaseOrderMaskAddress.setPostTel(address.getPostTel());
platformPurchaseOrderMaskAddress.setGmtCreate(new Date());
platformPurchaseOrderMaskAddress.setGmtModified(new Date());
platformPurchaseOrderMaskAddressMapper.insertSelective(platformPurchaseOrderMaskAddress);
return platformPurchaseOrderMaskAddress;
}
private ConsigneeInfoDTO buildConsigneeInfoDTO(Address address) {
@ -189,12 +338,12 @@ public class DistributionOrderServiceImpl implements DistributionOrderService {
return encryptOutOrderInfo;
}
private PlatformOrderDTO buildPlatformOrderDTO(Long shopId, CreateOrder order) {
private PlatformOrderDTO buildPlatformOrderDTO(Long shopId, CreateOrder order, Map<Long, SourceProductInfo> productIdAndSourceProductInfoMap, Map<Long, String> skuIdAndOutSkuIdMap) {
ConsigneeInfoDTO consigneeInfo = buildConsigneeInfoDTO(order.getMaskPostAddress());
EncryptOutOrderInfoDTO encryptOutOrderInfo = buildEncryptOutOrderInfoDTO(order.getPurOrderId(), order.getPostAddress());
EncryptOutOrderInfoDTO encryptOutOrderInfo = buildEncryptOutOrderInfoDTO(order.getOrderId(), order.getPostAddress());
List<PlatformOrderItemDTO> items = new ArrayList<>();
for (SkuOrder skuOrder: order.getSkuOrders()) {
PlatformOrderItemDTO item = buildPlatformOrderItemDTO(order.getPurOrderId(), skuOrder);
PlatformOrderItemDTO item = buildPlatformOrderItemDTO(order.getOrderId(), skuOrder, productIdAndSourceProductInfoMap, skuIdAndOutSkuIdMap);
items.add(item);
}
@ -204,59 +353,93 @@ public class DistributionOrderServiceImpl implements DistributionOrderService {
platformOrder.setSourceOrderBuyerRemark("");
platformOrder.setSourceOrderSellerMemo("");
platformOrder.setBuyerRemark("");
platformOrder.setUserId("");
platformOrder.setUserId(shopId.toString());
platformOrder.setConsigneeInfo(consigneeInfo);
platformOrder.setEncryptOutOrderInfo(encryptOutOrderInfo);
platformOrder.setItems(items);
return platformOrder;
}
private PlatformOrderItemDTO buildPlatformOrderItemDTO(String orderId, SkuOrder skuOrder) {
private SourceSkuInfo getSourceSkuInfo(SkuOrder skuOrder, Map<Long, SourceProductInfo> productIdAndSourceProductInfoMap, Map<Long, String> skuIdAndOutSkuIdMap) {
SourceProductInfo sourceProductInfo = productIdAndSourceProductInfoMap.get(skuOrder.getProductId());
if (sourceProductInfo == null) {
throw new RuntimeException("未匹配到货源商品");
}
SourceSkuInfo sourceSkuInfo = null;
String sourceSkuId = skuIdAndOutSkuIdMap.get(skuOrder.getSkuId());
if (sourceSkuId == null) {
throw new RuntimeException("未匹配到货源SKU");
}
for (SourceSkuInfo sku: sourceProductInfo.getSkus()) {
if (Objects.equals(sku.getSourceSkuId(), Long.valueOf(sourceSkuId))) {
sourceSkuInfo = sku;
}
}
return sourceSkuInfo;
}
private PlatformOrderItemDTO buildPlatformOrderItemDTO(String orderId, SkuOrder skuOrder, Map<Long, SourceProductInfo> productIdAndSourceProductInfoMap, Map<Long, String> skuIdAndOutSkuIdMap) {
SourceSkuInfo sourceSkuInfo = getSourceSkuInfo(skuOrder, productIdAndSourceProductInfoMap, skuIdAndOutSkuIdMap);
if (sourceSkuInfo == null) {
throw new RuntimeException("未匹配到货源SKU");
}
boolean isJxhyOffer= sourceSkuInfo.getIsJxhyOffer().equals(1);
PlatformOrderItemDTO item = new PlatformOrderItemDTO();
item.setItemTotal(skuOrder.getNum().intValue());
item.setSourceSkuId(skuOrder.getCargoSkuId());
item.setSourceItemId(String.valueOf(skuOrder.getCargoId()));
item.setSourceSkuId(sourceSkuInfo.getSourceSkuId());
item.setSourceItemId(sourceSkuInfo.getSourceItemId().toString());
item.setPlatformItemId(String.valueOf(skuOrder.getProductId()));
item.setPlatformSkuId(skuOrder.getSkuId());
item.setPlatformOrderId(orderId);
item.setPlatformSkuSubName("");
item.setSpecId("");
item.setPlatformSkuSubName(sourceSkuInfo.getSkuSubName());
item.setSpecId(sourceSkuInfo.getSpecId());
item.setIsJxhyOffer(isJxhyOffer);
item.setJxhyPrice(sourceSkuInfo.getJxhyPrice());
return item;
}
private BatchCreateDistributionOrdersRequestDTO buildBatchCreateDistributionOrdersRequestDTO(BatchCreateParam param) {
Map<Long, String> productIdAndOutProductIdMap = new HashMap<>();
Map<Long, String> skuIdAndOutSkuIdMap = new HashMap<>();
for (CreateOrder order: param.getOrders()) {
for (SkuOrder skuOrder: order.getSkuOrders()) {
productIdAndOutProductIdMap.put(skuOrder.getProductId(), skuOrder.getOuterProductId());
skuIdAndOutSkuIdMap.put(skuOrder.getSkuId(), skuOrder.getOuterSkuId());
}
}
Map<Long, SourceProductInfo> productIdAndSourceProductInfoMap = getProductIdAndSourceProductInfoMap(param.getShopId(), productIdAndOutProductIdMap);
BatchCreateDistributionOrdersRequestDTO request = new BatchCreateDistributionOrdersRequestDTO();
List<PlatformOrderDTO> platformOrders = new ArrayList<>();
for (CreateOrder order: param.getOrders()) {
PlatformOrderDTO platformOrder = buildPlatformOrderDTO(param.getShopId(), order);
PlatformOrderDTO platformOrder = buildPlatformOrderDTO(param.getShopId(), order, productIdAndSourceProductInfoMap, skuIdAndOutSkuIdMap);
platformOrders.add(platformOrder);
}
request.setPlatformOrders(platformOrders);
request.setPlatform(CommonConst.PLATFORM);
request.setActionSource("");
request.setOperateInfo(null);
request.setPurchaseSource("");
request.setActionSource(DsOrderConst.ACTION_SOURCE_BATCH_PURCHASE);
request.setPurchaseSource(DsOrderConst.PURCHASE_SOURCE_PLATFORM_BATCH);
request.setIsAutoPay(0);
request.setRepurchase(false);
request.setPlatformOrderIdAndPurchaseConfirmLogIdMap(null);
return request;
}
@Override
public void batchPay(BatchPayParam param, BatchPayData data) {
Map<Long, Set<String>> shopIdAndPurOrderIdListMap = new HashMap<>();
for (BatchPayParam.Param p: param.getParams()) {
Set<String> purOrderIdList = new HashSet<>();
if (shopIdAndPurOrderIdListMap.containsKey(p.getShopId())) {
purOrderIdList = shopIdAndPurOrderIdListMap.get(p.getShopId());
}
purOrderIdList.add(p.getPurOrderId());
shopIdAndPurOrderIdListMap.put(p.getShopId(), purOrderIdList);
if (param.getParams().size() != 1) {
throw new RuntimeException("每次只能请求1个采购单");
}
PlatformPurchaseOrder platformPurchaseOrder = platformPurchaseOrderMapper.selectByPrimaryKey(param.getParams().get(0).getPurOrderId());
if (platformPurchaseOrder == null) {
throw new RuntimeException("采购单不存在");
}
List<PaymentResult> paymentResults = new ArrayList<>();
for (Map.Entry<Long, Set<String>> item: shopIdAndPurOrderIdListMap.entrySet()) {
GetPurchaseOrderPayUrlResponseDTO response = dsApiService.getPurchaseOrderPayUrl(new ArrayList<>(item.getValue()), item.getKey());
for (BatchPayParam.Param p: param.getParams()) {
GetPurchaseOrderPayUrlResponseDTO response = dsApiService.getPurchaseOrderPayUrl(Collections.singletonList(p.getPurOrderId()), p.getShopId());
if (response.isSuccess()) {
PaymentResult paymentResult = new PaymentResult();
PaymentResult.PayUrl payUrl = new PaymentResult.PayUrl();
@ -264,8 +447,15 @@ public class DistributionOrderServiceImpl implements DistributionOrderService {
payUrl.setPcUrl(response.getPayUrl());
paymentResult.setPayUrl(payUrl);
paymentResult.setPurOrderId(new ArrayList<>(item.getValue()).get(0));
paymentResult.setPurOrderId(p.getPurOrderId());
paymentResults.add(paymentResult);
platformPurchaseOrder.setPayPcUrl(response.getPayUrl());
platformPurchaseOrder.setPayH5Url(response.getPayUrl());
platformPurchaseOrderMapper.updateByPrimaryKeySelective(platformPurchaseOrder);
} else {
throw new RuntimeException(response.getReason());
}
}
data.setPaymentResults(paymentResults);

@ -0,0 +1,53 @@
package com.ms.biz.service.impl;
import com.ms.dal.entity.DoudianAftersaleMsgBuffer;
import com.ms.biz.service.DoudianAftersaleMsgBufferService;
import com.ms.dal.mapper.DoudianAftersaleMsgBufferMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
*
*/
@Service
public class DoudianAftersaleMsgBufferServiceImpl implements DoudianAftersaleMsgBufferService{
@Autowired
private DoudianAftersaleMsgBufferMapper doudianAftersaleMsgBufferMapper;
@Override
public int deleteByPrimaryKey(Long id) {
return doudianAftersaleMsgBufferMapper.deleteByPrimaryKey(id);
}
@Override
public int insert(DoudianAftersaleMsgBuffer record) {
return doudianAftersaleMsgBufferMapper.insert(record);
}
@Override
public int insertSelective(DoudianAftersaleMsgBuffer record) {
return doudianAftersaleMsgBufferMapper.insertSelective(record);
}
@Override
public DoudianAftersaleMsgBuffer selectByPrimaryKey(Long id) {
return doudianAftersaleMsgBufferMapper.selectByPrimaryKey(id);
}
@Override
public int updateByPrimaryKeySelective(DoudianAftersaleMsgBuffer record) {
return doudianAftersaleMsgBufferMapper.updateByPrimaryKeySelective(record);
}
@Override
public int updateByPrimaryKey(DoudianAftersaleMsgBuffer record) {
return doudianAftersaleMsgBufferMapper.updateByPrimaryKey(record);
}
}

@ -0,0 +1,53 @@
package com.ms.biz.service.impl;
import com.ms.dal.entity.DoudianAftersaleMsgQueue;
import com.ms.biz.service.DoudianAftersaleMsgQueueService;
import com.ms.dal.mapper.DoudianAftersaleMsgQueueMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
*
*/
@Service
public class DoudianAftersaleMsgQueueServiceImpl implements DoudianAftersaleMsgQueueService{
@Autowired
private DoudianAftersaleMsgQueueMapper doudianAftersaleMsgQueueMapper;
@Override
public int deleteByPrimaryKey(Long id) {
return doudianAftersaleMsgQueueMapper.deleteByPrimaryKey(id);
}
@Override
public int insert(DoudianAftersaleMsgQueue record) {
return doudianAftersaleMsgQueueMapper.insert(record);
}
@Override
public int insertSelective(DoudianAftersaleMsgQueue record) {
return doudianAftersaleMsgQueueMapper.insertSelective(record);
}
@Override
public DoudianAftersaleMsgQueue selectByPrimaryKey(Long id) {
return doudianAftersaleMsgQueueMapper.selectByPrimaryKey(id);
}
@Override
public int updateByPrimaryKeySelective(DoudianAftersaleMsgQueue record) {
return doudianAftersaleMsgQueueMapper.updateByPrimaryKeySelective(record);
}
@Override
public int updateByPrimaryKey(DoudianAftersaleMsgQueue record) {
return doudianAftersaleMsgQueueMapper.updateByPrimaryKey(record);
}
}

@ -0,0 +1,53 @@
package com.ms.biz.service.impl;
import com.ms.dal.entity.DoudianMsgParseQueue;
import com.ms.biz.service.DoudianMsgParseQueueService;
import com.ms.dal.mapper.DoudianMsgParseQueueMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
*
*/
@Service
public class DoudianMsgParseQueueServiceImpl implements DoudianMsgParseQueueService{
@Autowired
private DoudianMsgParseQueueMapper doudianMsgParseQueueMapper;
@Override
public int deleteByPrimaryKey(Long id) {
return doudianMsgParseQueueMapper.deleteByPrimaryKey(id);
}
@Override
public int insert(DoudianMsgParseQueue record) {
return doudianMsgParseQueueMapper.insert(record);
}
@Override
public int insertSelective(DoudianMsgParseQueue record) {
return doudianMsgParseQueueMapper.insertSelective(record);
}
@Override
public DoudianMsgParseQueue selectByPrimaryKey(Long id) {
return doudianMsgParseQueueMapper.selectByPrimaryKey(id);
}
@Override
public int updateByPrimaryKeySelective(DoudianMsgParseQueue record) {
return doudianMsgParseQueueMapper.updateByPrimaryKeySelective(record);
}
@Override
public int updateByPrimaryKey(DoudianMsgParseQueue record) {
return doudianMsgParseQueueMapper.updateByPrimaryKey(record);
}
}

@ -0,0 +1,242 @@
package com.ms.biz.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.ms.biz.consts.DoudianMsgConst;
import com.ms.biz.consts.StatusConst;
import com.ms.dal.entity.*;
import com.ms.biz.service.DoudianMsgService;
import com.ms.dal.mapper.*;
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.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
*
*/
@Slf4j
@Service
public class DoudianMsgServiceImpl implements DoudianMsgService{
@Autowired
private DoudianMsgMapper doudianMsgMapper;
@Autowired
private DoudianMsgParseQueueMapper doudianMsgParseQueueMapper;
@Autowired
private DdTradeMsgMapper ddTradeMsgMapper;
@Autowired
private DoudianTradeMsgBufferMapper doudianTradeMsgBufferMapper;
@Autowired
private DdAftersaleMsgMapper ddAftersaleMsgMapper;
@Autowired
private DoudianAftersaleMsgBufferMapper doudianAftersaleMsgBufferMapper;
@Autowired
private RedisTemplate<String, String> redisTemplate;
@Override
public int deleteByPrimaryKey(Long id) {
return doudianMsgMapper.deleteByPrimaryKey(id);
}
@Override
public int insert(DoudianMsg record) {
return doudianMsgMapper.insert(record);
}
@Override
public int insertSelective(DoudianMsg record) {
return doudianMsgMapper.insertSelective(record);
}
@Override
public DoudianMsg selectByPrimaryKey(Long id) {
return doudianMsgMapper.selectByPrimaryKey(id);
}
@Override
public int updateByPrimaryKeySelective(DoudianMsg record) {
return doudianMsgMapper.updateByPrimaryKeySelective(record);
}
@Override
public int updateByPrimaryKey(DoudianMsg record) {
return doudianMsgMapper.updateByPrimaryKey(record);
}
@Transactional(rollbackFor = Exception.class)
@Override
public boolean addDoudianMsg(String msgBody) {
DoudianMsg doudianMsgData = new DoudianMsg();
doudianMsgData.setMsgBody(msgBody);
doudianMsgData.setStatus(StatusConst.wait);
doudianMsgData.setGmtCreate(new Date());
doudianMsgData.setGmtModified(new Date());
doudianMsgMapper.insertSelective(doudianMsgData);
DoudianMsgParseQueue doudianMsgParseQueueData = new DoudianMsgParseQueue();
doudianMsgParseQueueData.setDoudianMsgId(doudianMsgData.getDoudianMsgId());
doudianMsgParseQueueData.setLocked(0L);
doudianMsgParseQueueData.setGmtCreate(new Date());
doudianMsgParseQueueData.setGmtModified(new Date());
doudianMsgParseQueueMapper.insertSelective(doudianMsgParseQueueData);
redisTemplate.opsForList().leftPush("doudian_msg_parse_queue", String.valueOf(doudianMsgParseQueueData.getDoudianMsgParseQueueId()));
return true;
}
@Override
public DoudianMsgParseQueue lockDoudianMsgParseQueue() {
String queueRedisKey = "doudian_msg_parse_queue";
String queueId = redisTemplate.opsForList().rightPop(queueRedisKey);
if (StringUtils.isEmpty(queueId)) {
return null;
}
DoudianMsgParseQueue row = doudianMsgParseQueueMapper.selectUnlockRowByQueueId(Long.valueOf(queueId));
if (row == null) {
return null;
}
DoudianMsgParseQueue updateData = new DoudianMsgParseQueue();
updateData.setDoudianMsgParseQueueId(row.getDoudianMsgParseQueueId());
row.setLocked(1L);
row.setGmtLastHeartbeat(new Date());
row.setGmtLocked(new Date());
row.setGmtModified(new Date());
int affRow = doudianMsgParseQueueMapper.updateByPrimaryKeySelective(row);
if (affRow == 1) {
return row;
}
return null;
}
@Override
@Transactional(rollbackFor = Exception.class)
public boolean processDoudianMsgParseQueue(Long doudianMsgId) {
if (doudianMsgId == null) {
return false;
}
DoudianMsg doudianMsgInfo = doudianMsgMapper.selectByPrimaryKey(doudianMsgId);
if (doudianMsgInfo == null) {
return false;
}
List<String> msgList = JSON.parseArray(doudianMsgInfo.getMsgBody(), String.class);
List<String> shopIds = new ArrayList<>();
for (String msg : msgList) {
JSONObject msgItem = JSONObject.parseObject(msg);
JSONObject currentMsgData = JSONObject.parseObject(msgItem.getString("data"));
if (currentMsgData.containsKey("shop_id")) {
shopIds.add(currentMsgData.get("shop_id").toString());
} else {
log.info(String.format("timer doudian_msg shop_id_empty doudianMsgId{%s} msgBody: %s", doudianMsgId, doudianMsgInfo.getMsgBody()));
}
}
List<DdTradeMsg> doudianTradeMsgDatas = new ArrayList<>();
List<DoudianTradeMsgBuffer> doudianTradeMsgBufferDatas = new ArrayList<>();
List<DdAftersaleMsg> aftersaleMsgsDatas = new ArrayList<>();
List<DoudianAftersaleMsgBuffer> aftersaleMsgBufferDatas = new ArrayList<>();
for (String msg : msgList) {
JSONObject msgItem = JSONObject.parseObject(msg);
Map currentMsgData = JSONObject.parseObject(msgItem.getString("data"), Map.class);
Long shopId = Long.valueOf(currentMsgData.get("shop_id").toString());
if (DoudianMsgConst.ALL_TRADE_TAGS.contains(Integer.valueOf(msgItem.get("tag").toString()))) {
DdTradeMsg msgObj = new DdTradeMsg();
msgObj.setMsgId(msgItem.get("msg_id").toString());
msgObj.setShopId(shopId);
msgObj.setTag(Integer.valueOf(msgItem.get("tag").toString()));
msgObj.setData(msgItem.get("data").toString());
msgObj.setStatus(StatusConst.wait);
msgObj.setGmtCreate(new Date());
msgObj.setGmtModified(new Date());
doudianTradeMsgDatas.add(msgObj);
DoudianTradeMsgBuffer buffer = new DoudianTradeMsgBuffer();
buffer.setMsgId(msgItem.get("msg_id").toString());
buffer.setShopId(shopId);
buffer.setGmtCreate(new Date());
buffer.setGmtModified(new Date());
doudianTradeMsgBufferDatas.add(buffer);
}
if (DoudianMsgConst.ALL_AFTERSALE_TAGS.contains(Integer.valueOf(msgItem.get("tag").toString()))) {
DdAftersaleMsg msgObj = new DdAftersaleMsg();
msgObj.setMsgId(msgItem.get("msg_id").toString());
msgObj.setShopId(shopId);
msgObj.setTag(Integer.valueOf(msgItem.get("tag").toString()));
msgObj.setData(msgItem.get("data").toString());
msgObj.setStatus(StatusConst.wait);
msgObj.setGmtCreate(new Date());
msgObj.setGmtModified(new Date());
aftersaleMsgsDatas.add(msgObj);
DoudianAftersaleMsgBuffer buffer = new DoudianAftersaleMsgBuffer();
buffer.setMsgId(msgItem.get("msg_id").toString());
buffer.setShopId(shopId);
buffer.setGmtCreate(new Date());
buffer.setGmtModified(new Date());
aftersaleMsgBufferDatas.add(buffer);
}
}
// 插入分好类的数据
for (DdTradeMsg item : doudianTradeMsgDatas) {
ddTradeMsgMapper.insertSelective(item);
}
for (DoudianTradeMsgBuffer item : doudianTradeMsgBufferDatas) {
doudianTradeMsgBufferMapper.insertSelective(item);
}
for (DdAftersaleMsg item : aftersaleMsgsDatas) {
ddAftersaleMsgMapper.insertSelective(item);
}
for (DoudianAftersaleMsgBuffer item : aftersaleMsgBufferDatas) {
doudianAftersaleMsgBufferMapper.insertSelective(item);
}
DoudianMsg updateDoudianMsg = new DoudianMsg();
updateDoudianMsg.setDoudianMsgId(doudianMsgId);
updateDoudianMsg.setStatus(StatusConst.success);
updateDoudianMsg.setGmtModified(new Date());
doudianMsgMapper.updateByPrimaryKeySelective(updateDoudianMsg);
return true;
}
@Override
public void failProcessDoudianMsgParseQueue(Long doudianMsgId) {
DoudianMsg updateDoudianMsg = new DoudianMsg();
updateDoudianMsg.setDoudianMsgId(doudianMsgId);
updateDoudianMsg.setStatus(StatusConst.fail);
updateDoudianMsg.setReason("插入数据失败");
updateDoudianMsg.setGmtModified(new Date());
doudianMsgMapper.updateByPrimaryKeySelective(updateDoudianMsg);
}
@Override
public boolean deleteDoudianMsgParseQueue(Long queueId) {
int affRow = doudianMsgParseQueueMapper.deleteByPrimaryKey(queueId);
return affRow > 0;
}
}

@ -0,0 +1,53 @@
package com.ms.biz.service.impl;
import com.ms.dal.entity.DoudianTradeMsgBuffer;
import com.ms.biz.service.DoudianTradeMsgBufferService;
import com.ms.dal.mapper.DoudianTradeMsgBufferMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
*
*/
@Service
public class DoudianTradeMsgBufferServiceImpl implements DoudianTradeMsgBufferService{
@Autowired
private DoudianTradeMsgBufferMapper doudianTradeMsgBufferMapper;
@Override
public int deleteByPrimaryKey(Long id) {
return doudianTradeMsgBufferMapper.deleteByPrimaryKey(id);
}
@Override
public int insert(DoudianTradeMsgBuffer record) {
return doudianTradeMsgBufferMapper.insert(record);
}
@Override
public int insertSelective(DoudianTradeMsgBuffer record) {
return doudianTradeMsgBufferMapper.insertSelective(record);
}
@Override
public DoudianTradeMsgBuffer selectByPrimaryKey(Long id) {
return doudianTradeMsgBufferMapper.selectByPrimaryKey(id);
}
@Override
public int updateByPrimaryKeySelective(DoudianTradeMsgBuffer record) {
return doudianTradeMsgBufferMapper.updateByPrimaryKeySelective(record);
}
@Override
public int updateByPrimaryKey(DoudianTradeMsgBuffer record) {
return doudianTradeMsgBufferMapper.updateByPrimaryKey(record);
}
}

@ -0,0 +1,53 @@
package com.ms.biz.service.impl;
import com.ms.dal.entity.DoudianTradeMsgQueue;
import com.ms.biz.service.DoudianTradeMsgQueueService;
import com.ms.dal.mapper.DoudianTradeMsgQueueMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
*
*/
@Service
public class DoudianTradeMsgQueueServiceImpl implements DoudianTradeMsgQueueService{
@Autowired
private DoudianTradeMsgQueueMapper doudianTradeMsgQueueMapper;
@Override
public int deleteByPrimaryKey(Long id) {
return doudianTradeMsgQueueMapper.deleteByPrimaryKey(id);
}
@Override
public int insert(DoudianTradeMsgQueue record) {
return doudianTradeMsgQueueMapper.insert(record);
}
@Override
public int insertSelective(DoudianTradeMsgQueue record) {
return doudianTradeMsgQueueMapper.insertSelective(record);
}
@Override
public DoudianTradeMsgQueue selectByPrimaryKey(Long id) {
return doudianTradeMsgQueueMapper.selectByPrimaryKey(id);
}
@Override
public int updateByPrimaryKeySelective(DoudianTradeMsgQueue record) {
return doudianTradeMsgQueueMapper.updateByPrimaryKeySelective(record);
}
@Override
public int updateByPrimaryKey(DoudianTradeMsgQueue record) {
return doudianTradeMsgQueueMapper.updateByPrimaryKey(record);
}
}

@ -119,10 +119,20 @@ public class DsApiServiceImpl implements DsApiService {
params.put("shopName",shopInfo.getShopName());
params.put("gmtExpire", "2024-08-30 00:00:00");
params.put("version","3");
String resp = execute("/order/getPurchaseOrderPayUrl", params);
String resp = execute("/platform_shop/get_platform_auth_url", params);
return JSON.parseObject(resp, GetPlatformAuthUrlResponseDTO.class);
}
@Override
public GetSourceItemInfosResponseDTO getSourceItemInfos(Long shopId, List<String> sourceItemIds) {
Map<String, Object> params = new HashMap<>();
params.put("platform", CommonConst.PLATFORM);
params.put("userId", SecurityTool.encodeByAES(String.valueOf(shopId)));
params.put("sourceItemIds", sourceItemIds);
String resp = execute("/order/getSourceItemInfos", params);
return JSON.parseObject(resp, GetSourceItemInfosResponseDTO.class);
}
private Map<String, Object> objectToMap(Object obj) {
Map<String, Object> map = new HashMap<>();
Class<?> clazz = obj.getClass();

@ -1,18 +1,32 @@
package com.ms.biz.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.doudian.open.api.supplyCenter_order_cancel.param.SupplyCenterOrderCancelParam;
import com.doudian.open.api.supplyCenter_order_confirm.param.SupplyCenterOrderConfirmParam;
import com.doudian.open.api.supplyCenter_order_logistics.param.SupplyCenterOrderLogisticsParam;
import com.doudian.open.api.supplyCenter_order_pay.param.SkuOrderPayInfosItem;
import com.doudian.open.api.supplyCenter_order_pay.param.SupplyCenterOrderPayParam;
import com.doudian.open.api.supplyCenter_order_syncSupplierInfo.param.SkuOrdersItem;
import com.doudian.open.api.supplyCenter_order_syncSupplierInfo.param.SupplierOrderUrl;
import com.doudian.open.api.supplyCenter_order_syncSupplierInfo.param.SupplyCenterOrderSyncSupplierInfoParam;
import com.doudian.open.api.supplyCenter_refund_operate.param.Address;
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.StatusConst;
import com.ms.biz.dto.openspi.request.SkuOrder;
import com.ms.biz.service.DsMessageConsumerBufferService;
import com.ms.biz.service.DsMessageConsumerQueueService;
import com.ms.biz.service.DsMessageService;
import com.ms.api.dto.dsorder.*;
import com.ms.biz.tool.CommonTool;
import com.ms.dal.entity.DsMessage;
import com.ms.dal.entity.DsMessageConsumerQueue;
import com.ms.dal.mapper.DsMessageMapper;
import com.ms.biz.util.DDApi;
import com.ms.dal.entity.*;
import com.ms.dal.mapper.*;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
import org.springframework.lang.Nullable;
import org.springframework.stereotype.Service;
@ -20,9 +34,10 @@ import org.springframework.transaction.TransactionDefinition;
import org.springframework.transaction.TransactionStatus;
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Objects;
import java.util.*;
import java.util.stream.Collectors;
@Service
@Slf4j
@ -34,6 +49,10 @@ public class DsMessageServiceImpl implements DsMessageService {
private DsMessageMapper dsMessageMapper;
private DsMessageConsumerBufferService dsMessageConsumerBufferService;
private DsMessageConsumerQueueService dsMessageConsumerQueueService;
private PlatformPurchaseOrderMapper platformPurchaseOrderMapper;
private PlatformPurchaseOrderSkuMapper platformPurchaseOrderSkuMapper;
private PurchaseOrderMapper purchaseOrderMapper;
private PurchaseOrderItemMapper purchaseOrderItemMapper;
@Override
public int deleteByPrimaryKey(Long id) {
@ -152,6 +171,208 @@ public class DsMessageServiceImpl implements DsMessageService {
}
dsMessageConsumerQueueService.deleteByPrimaryKey(queue.getDsMessageConsumerQueueId());
}
public void processDsMessage(Long dsMessageId) {
DsMessage dsMessage = selectByPrimaryKey(dsMessageId);
if (dsMessage == null) {
throw new RuntimeException("消息不存在");
}
DsMessageDTO messageDTO = parseData(dsMessage);
boolean isExpire = isDsMessageExpire(dsMessage, messageDTO);
if (isExpire) {
if (Objects.equals(dsMessage.getBizType(), DsMessageConst.BIZ_TYPE_RELATE_PURCHASE_ORDER)) {
PurchaseOrderDTO purchaseOrderDTO = ((PurchaseOrderRelateMessageDTO)messageDTO).getPurchaseOrderInfo();
// do something
}
throw new RuntimeException("消息已过期");
}
switch (dsMessage.getBizType()) {
case DsMessageConst.BIZ_TYPE_RELATE_PURCHASE_ORDER:
handlePurchaseOrderRelate((PurchaseOrderRelateMessageDTO)messageDTO);
break;
case DsMessageConst.BIZ_TYPE_PURCHASE_ORDER_CHANGE:
handlePurchaseOrderChange((PurchaseOrderChangeMessageDTO)messageDTO);
break;
case DsMessageConst.BIZ_TYPE_CANCEL_PURCHASE_ORDER:
handlePurchaseOrderCancel((PurchaseOrderCancelMessageDTO)messageDTO);
break;
default:
throw new RuntimeException("bizType [" + dsMessage.getBizType() + "] 暂无对应的处理逻辑");
}
}
private boolean isDsMessageExpire(DsMessage dsMessage, DsMessageDTO messageDTO) {
if (messageDTO.getGmtMessageCreate() == null) {
return false;
}
switch (dsMessage.getBizType()) {
case DsMessageConst.BIZ_TYPE_CANCEL_PURCHASE_ORDER:
return hasNewThanDsMessage(dsMessage, DsMessageConst.BIZ_TYPE_RELATE_PURCHASE_ORDER);
case DsMessageConst.BIZ_TYPE_PURCHASE_ORDER_CHANGE:
return hasNewThanDsMessage(dsMessage, DsMessageConst.BIZ_TYPE_PURCHASE_ORDER_CHANGE);
case DsMessageConst.BIZ_TYPE_RELATE_PURCHASE_ORDER:
return hasNewThanDsMessage(dsMessage, DsMessageConst.BIZ_TYPE_CANCEL_PURCHASE_ORDER);
default:
return false;
}
}
private void handlePurchaseOrderChange(PurchaseOrderChangeMessageDTO messageDTO) {
PurchaseOrderDTO purchaseOrderDTO = messageDTO.getPurchaseOrderInfo();
PurchaseOrder purchaseOrder = purchaseOrderMapper.getByPurchaseOrderSn(purchaseOrderDTO.getPurchaseOrderSn());
PlatformPurchaseOrder platformPurchaseOrder = platformPurchaseOrderMapper.selectByPrimaryKey(purchaseOrder.getPurOrderId());
List<PlatformPurchaseOrderSku> platformPurchaseOrderSkus = platformPurchaseOrderSkuMapper.getListByPurOrderIds(Collections.singletonList(purchaseOrder.getPurOrderId()));
Map<Long, PlatformPurchaseOrderSku> skuIdAndPlatformPurchaseOrderSkuMap = platformPurchaseOrderSkus.stream().collect(Collectors.toMap(PlatformPurchaseOrderSku::getSkuId, x->x));
String purchaseOrderStatus = purchaseOrderDTO.getPurchaseOrderStatus();
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date messageCreateTime;
try {
messageCreateTime = dateFormat.parse(messageDTO.getGmtMessageCreate());
} catch (java.text.ParseException e) {
throw new RuntimeException("时间格式错误");
}
if (!Objects.equals(purchaseOrder.getPurchaseOrderStatus(),purchaseOrderStatus)){
switch (purchaseOrderStatus) {
case PurchaseOrderConst.PURCHASE_ORDER_STATUS_WAIT_SEND:
handlePurchaseOrderAfterPay(purchaseOrderDTO, messageCreateTime, purchaseOrder, skuIdAndPlatformPurchaseOrderSkuMap);
break;
case PurchaseOrderConst.PURCHASE_ORDER_STATUS_WAIT_CONFIRM:
handlePurchaseOrderAfterSend(purchaseOrderDTO, purchaseOrder);
break;
case PurchaseOrderConst.PURCHASE_ORDER_STATUS_FINISHED:
handlePurchaseOrderAfterFinish(purchaseOrderDTO, messageCreateTime, purchaseOrder);
break;
case PurchaseOrderConst.PURCHASE_ORDER_STATUS_CANCEL:
handlePurchaseOrderAfterCancel(purchaseOrderDTO, messageCreateTime, purchaseOrder);
platformPurchaseOrder.setStatus(StatusConst.delete); // TODO 多单?精选
break;
}
platformPurchaseOrder.setPurchaseStatus(purchaseOrderStatus);
platformPurchaseOrder.setGmtModified(new Date());
platformPurchaseOrderMapper.updateByPrimaryKeySelective(platformPurchaseOrder);
purchaseOrder.setPurchaseOrderStatus(purchaseOrderStatus);
purchaseOrder.setGmtModified(new Date());
purchaseOrderMapper.updateByPrimaryKeySelective(purchaseOrder);
if (purchaseOrder.getStatus().equals(StatusConst.delete)) {
purchaseOrderItemMapper.updateStatusByPurchaseOrderIds(StatusConst.delete, Collections.singletonList(purchaseOrder.getPurchaseOrderId()));
}
}
handlePurchaseOrderRefund(purchaseOrderDTO, purchaseOrder, skuIdAndPlatformPurchaseOrderSkuMap);
}
private void handlePurchaseOrderAfterPay(PurchaseOrderDTO purchaseOrderDTO, Date messageCreateTime, PurchaseOrder purchaseOrder, Map<Long, PlatformPurchaseOrderSku> skuIdAndPlatformPurchaseOrderSkuMap) {
purchaseOrder.setPurchaseOrderPayment(new BigDecimal(purchaseOrderDTO.getPurchaseOrderPayment()));
SupplyCenterOrderPayParam param = new SupplyCenterOrderPayParam();
param.setPayAmount((long)(Double.parseDouble(purchaseOrderDTO.getPurchaseOrderPayment()) * 100));
param.setPayTime(messageCreateTime.getTime());
param.setPurOrderId(purchaseOrder.getPurOrderId());
param.setPostAmount(0L);
List<SkuOrderPayInfosItem> skuOrderPayInfosItems = new ArrayList<>();
for (PurchaseOrderItemDTO item: purchaseOrderDTO.getItems()) {
PlatformPurchaseOrderSku platformPurchaseOrderSku = skuIdAndPlatformPurchaseOrderSkuMap.get(item.getSkuId());
SkuOrderPayInfosItem skuOrderPayInfosItem = new SkuOrderPayInfosItem();
skuOrderPayInfosItem.setPayAmount((long)(item.getPurchasePrice() * 100));
skuOrderPayInfosItem.setPurSkuOrderId(platformPurchaseOrderSku.getPurSkuOrderId());
skuOrderPayInfosItems.add(skuOrderPayInfosItem);
}
param.setSkuOrderPayInfos(skuOrderPayInfosItems);
DDApi.supplyCenterOrderPay(param);
}
private void handlePurchaseOrderAfterSend(PurchaseOrderDTO purchaseOrderDTO, PurchaseOrder purchaseOrder) {
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date purchaseOrderSendTime = null;
try {
if (StringUtils.isNotBlank(purchaseOrderDTO.getPurchaseOrderSendTime())) {
purchaseOrderSendTime = dateFormat.parse(purchaseOrderDTO.getPurchaseOrderSendTime());
}
} catch (java.text.ParseException e) {
throw new RuntimeException("时间格式错误");
}
purchaseOrder.setPurchaseOrderSendTime(purchaseOrderSendTime);
purchaseOrder.setPurchaseOrderLogisticsName(purchaseOrder.getPurchaseOrderLogisticsName());
purchaseOrder.setPurchaseOrderWaybillCode(purchaseOrder.getPurchaseOrderWaybillCode());
SupplyCenterOrderLogisticsParam param = new SupplyCenterOrderLogisticsParam();
param.setPurOrderId(purchaseOrder.getPurOrderId());
if (purchaseOrderSendTime != null) {
param.setExpressTime(purchaseOrderSendTime.getTime());
}
param.setExpressType(1);
DDApi.supplyCenterOrderLogistics(param);
}
private void handlePurchaseOrderAfterFinish(PurchaseOrderDTO purchaseOrderDTO, Date messageCreateTime, PurchaseOrder purchaseOrder) {
SupplyCenterOrderConfirmParam param = new SupplyCenterOrderConfirmParam();
param.setPurOrderId(purchaseOrder.getPurOrderId());
param.setConfirmTime(messageCreateTime.getTime());
DDApi.supplyCenterOrderConfirm(param);
}
private void handlePurchaseOrderAfterCancel(PurchaseOrderDTO purchaseOrderDTO, Date messageCreateTime, PurchaseOrder purchaseOrder) {
purchaseOrder.setStatus(StatusConst.delete);
SupplyCenterOrderCancelParam param = new SupplyCenterOrderCancelParam();
param.setPurOrderId(purchaseOrder.getPurOrderId());
param.setCancelTime(messageCreateTime.getTime());
DDApi.supplyCenterOrderCancel(param);
}
private void handlePurchaseOrderRefund(PurchaseOrderDTO purchaseOrderDTO, PurchaseOrder purchaseOrder, Map<Long, PlatformPurchaseOrderSku> skuIdAndPlatformPurchaseOrderSkuMap) {
if (purchaseOrderDTO.getRefundInfo() == null || purchaseOrderDTO.getRefundInfo().isEmpty()) {
return;
}
SupplyCenterRefundOperateParam param = new SupplyCenterRefundOperateParam();
param.setPurOrderId(purchaseOrderDTO.getPlatformOrderId());
List<SkuRefundInfosItem> skuRefundInfosItems = new ArrayList<>();
for (Map.Entry<String, RefundInfoDTO> entry: purchaseOrderDTO.getRefundInfo().entrySet()) {
RefundInfoDTO refundInfo = entry.getValue();
Address address = new Address();
address.setUserName(refundInfo.getSellerRealName());
address.setDetail(refundInfo.getSellerReceiveAddress());
address.setMobile(refundInfo.getSellerMobile());
SkuRefundInfosItem skuRefundInfosItem = new SkuRefundInfosItem();
skuRefundInfosItem.setPurSkuOrderId("");
skuRefundInfosItem.setRejectReason(refundInfo.getRejectReason());
skuRefundInfosItem.setAddress(address);
skuRefundInfosItem.setCloseReason("");
skuRefundInfosItem.setOperationType(1);
skuRefundInfosItems.add(skuRefundInfosItem);
}
param.setSkuRefundInfos(skuRefundInfosItems);
DDApi.supplyCenterRefundOperate(param);
}
private void handlePurchaseOrderCancel(PurchaseOrderCancelMessageDTO messageDTO) {
}
private void handlePurchaseOrderRelate(PurchaseOrderRelateMessageDTO messageDTO) {
PurchaseOrderDTO purchaseOrderDTO = messageDTO.getPurchaseOrderInfo();
PurchaseOrder purchaseOrder = purchaseOrderMapper.getByPurchaseOrderSn(purchaseOrderDTO.getPurchaseOrderSn());
List<PlatformPurchaseOrderSku> platformPurchaseOrderSkus = platformPurchaseOrderSkuMapper.getListByPurOrderIds(Collections.singletonList(purchaseOrder.getPurOrderId()));
Map<Long, PlatformPurchaseOrderSku> skuIdAndPlatformPurchaseOrderSkuMap = platformPurchaseOrderSkus.stream().collect(Collectors.toMap(PlatformPurchaseOrderSku::getSkuId, x->x));
PlatformPurchaseOrder platformPurchaseOrder = platformPurchaseOrderMapper.selectByPrimaryKey(purchaseOrder.getPurOrderId());
SupplyCenterOrderSyncSupplierInfoParam param = new SupplyCenterOrderSyncSupplierInfoParam();
param.setPurOrderId(platformPurchaseOrder.getPurOrderId());
param.setSupplierOrderId(purchaseOrderDTO.getPurchaseOrderSn());
param.setSupplierOrderUrl(new SupplierOrderUrl());
List<SkuOrdersItem> skuOrders = new ArrayList<>();
for (PurchaseOrderItemDTO item: purchaseOrderDTO.getItems()) {
PlatformPurchaseOrderSku platformPurchaseOrderSku = skuIdAndPlatformPurchaseOrderSkuMap.get(item.getSkuId());
SkuOrdersItem skuOrdersItem = new SkuOrdersItem();
skuOrdersItem.setPurSkuOrderId(platformPurchaseOrderSku.getPurSkuOrderId());
skuOrdersItem.setSupplierSkuOrderId(""); // TODO 上游没值
}
param.setSkuOrders(skuOrders);
DDApi.supplyCenterOrderSyncSupplierInfo(param);
}
}

@ -0,0 +1,53 @@
package com.ms.biz.service.impl;
import com.ms.biz.service.PlatformPurchaseOrderAddressService;
import com.ms.dal.entity.PlatformPurchaseOrderAddress;
import com.ms.dal.mapper.PlatformPurchaseOrderAddressMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
*
*/
@Service
public class PlatformPurchaseOrderAddressServiceImpl implements PlatformPurchaseOrderAddressService {
@Autowired
private PlatformPurchaseOrderAddressMapper platformPurchaseOrderAddressMapper;
@Override
public int deleteByPrimaryKey(String id) {
return platformPurchaseOrderAddressMapper.deleteByPrimaryKey(id);
}
@Override
public int insert(PlatformPurchaseOrderAddress record) {
return platformPurchaseOrderAddressMapper.insert(record);
}
@Override
public int insertSelective(PlatformPurchaseOrderAddress record) {
return platformPurchaseOrderAddressMapper.insertSelective(record);
}
@Override
public PlatformPurchaseOrderAddress selectByPrimaryKey(String id) {
return platformPurchaseOrderAddressMapper.selectByPrimaryKey(id);
}
@Override
public int updateByPrimaryKeySelective(PlatformPurchaseOrderAddress record) {
return platformPurchaseOrderAddressMapper.updateByPrimaryKeySelective(record);
}
@Override
public int updateByPrimaryKey(PlatformPurchaseOrderAddress record) {
return platformPurchaseOrderAddressMapper.updateByPrimaryKey(record);
}
}

@ -0,0 +1,53 @@
package com.ms.biz.service.impl;
import com.ms.biz.service.PlatformPurchaseOrderMaskAddressService;
import com.ms.dal.entity.PlatformPurchaseOrderMaskAddress;
import com.ms.dal.mapper.PlatformPurchaseOrderMaskAddressMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
*
*/
@Service
public class PlatformPurchaseOrderMaskAddressServiceImpl implements PlatformPurchaseOrderMaskAddressService {
@Autowired
private PlatformPurchaseOrderMaskAddressMapper platformPurchaseOrderMaskAddressMapper;
@Override
public int deleteByPrimaryKey(String id) {
return platformPurchaseOrderMaskAddressMapper.deleteByPrimaryKey(id);
}
@Override
public int insert(PlatformPurchaseOrderMaskAddress record) {
return platformPurchaseOrderMaskAddressMapper.insert(record);
}
@Override
public int insertSelective(PlatformPurchaseOrderMaskAddress record) {
return platformPurchaseOrderMaskAddressMapper.insertSelective(record);
}
@Override
public PlatformPurchaseOrderMaskAddress selectByPrimaryKey(String id) {
return platformPurchaseOrderMaskAddressMapper.selectByPrimaryKey(id);
}
@Override
public int updateByPrimaryKeySelective(PlatformPurchaseOrderMaskAddress record) {
return platformPurchaseOrderMaskAddressMapper.updateByPrimaryKeySelective(record);
}
@Override
public int updateByPrimaryKey(PlatformPurchaseOrderMaskAddress record) {
return platformPurchaseOrderMaskAddressMapper.updateByPrimaryKey(record);
}
}

@ -0,0 +1,53 @@
package com.ms.biz.service.impl;
import com.ms.biz.service.PlatformPurchaseOrderService;
import com.ms.dal.entity.PlatformPurchaseOrder;
import com.ms.dal.mapper.PlatformPurchaseOrderMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
*
*/
@Service
public class PlatformPurchaseOrderServiceImpl implements PlatformPurchaseOrderService {
@Autowired
private PlatformPurchaseOrderMapper platformPurchaseOrderMapper;
@Override
public int deleteByPrimaryKey(String id) {
return platformPurchaseOrderMapper.deleteByPrimaryKey(id);
}
@Override
public int insert(PlatformPurchaseOrder record) {
return platformPurchaseOrderMapper.insert(record);
}
@Override
public int insertSelective(PlatformPurchaseOrder record) {
return platformPurchaseOrderMapper.insertSelective(record);
}
@Override
public PlatformPurchaseOrder selectByPrimaryKey(String id) {
return platformPurchaseOrderMapper.selectByPrimaryKey(id);
}
@Override
public int updateByPrimaryKeySelective(PlatformPurchaseOrder record) {
return platformPurchaseOrderMapper.updateByPrimaryKeySelective(record);
}
@Override
public int updateByPrimaryKey(PlatformPurchaseOrder record) {
return platformPurchaseOrderMapper.updateByPrimaryKey(record);
}
}

@ -0,0 +1,53 @@
package com.ms.biz.service.impl;
import com.ms.biz.service.PlatformPurchaseOrderSkuService;
import com.ms.dal.entity.PlatformPurchaseOrderSku;
import com.ms.dal.mapper.PlatformPurchaseOrderSkuMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
*
*/
@Service
public class PlatformPurchaseOrderSkuServiceImpl implements PlatformPurchaseOrderSkuService {
@Autowired
private PlatformPurchaseOrderSkuMapper platformPurchaseOrderSkuMapper;
@Override
public int deleteByPrimaryKey(String id) {
return platformPurchaseOrderSkuMapper.deleteByPrimaryKey(id);
}
@Override
public int insert(PlatformPurchaseOrderSku record) {
return platformPurchaseOrderSkuMapper.insert(record);
}
@Override
public int insertSelective(PlatformPurchaseOrderSku record) {
return platformPurchaseOrderSkuMapper.insertSelective(record);
}
@Override
public PlatformPurchaseOrderSku selectByPrimaryKey(String id) {
return platformPurchaseOrderSkuMapper.selectByPrimaryKey(id);
}
@Override
public int updateByPrimaryKeySelective(PlatformPurchaseOrderSku record) {
return platformPurchaseOrderSkuMapper.updateByPrimaryKeySelective(record);
}
@Override
public int updateByPrimaryKey(PlatformPurchaseOrderSku record) {
return platformPurchaseOrderSkuMapper.updateByPrimaryKey(record);
}
}

@ -1,53 +0,0 @@
package com.ms.biz.service.impl;
import com.ms.biz.service.PurchaseOrderAddressService;
import com.ms.dal.entity.PurchaseOrderAddress;
import com.ms.dal.mapper.PurchaseOrderAddressMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
*
*/
@Service
public class PurchaseOrderAddressServiceImpl implements PurchaseOrderAddressService {
@Autowired
private PurchaseOrderAddressMapper purchaseOrderAddressMapper;
@Override
public int deleteByPrimaryKey(Long id) {
return purchaseOrderAddressMapper.deleteByPrimaryKey(id);
}
@Override
public int insert(PurchaseOrderAddress record) {
return purchaseOrderAddressMapper.insert(record);
}
@Override
public int insertSelective(PurchaseOrderAddress record) {
return purchaseOrderAddressMapper.insertSelective(record);
}
@Override
public PurchaseOrderAddress selectByPrimaryKey(Long id) {
return purchaseOrderAddressMapper.selectByPrimaryKey(id);
}
@Override
public int updateByPrimaryKeySelective(PurchaseOrderAddress record) {
return purchaseOrderAddressMapper.updateByPrimaryKeySelective(record);
}
@Override
public int updateByPrimaryKey(PurchaseOrderAddress record) {
return purchaseOrderAddressMapper.updateByPrimaryKey(record);
}
}

@ -0,0 +1,53 @@
package com.ms.biz.service.impl;
import com.ms.dal.entity.PurchaseOrderItem;
import com.ms.biz.service.PurchaseOrderItemService;
import com.ms.dal.mapper.PurchaseOrderItemMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
*
*/
@Service
public class PurchaseOrderItemServiceImpl implements PurchaseOrderItemService{
@Autowired
private PurchaseOrderItemMapper purchaseOrderItemMapper;
@Override
public int deleteByPrimaryKey(Long id) {
return purchaseOrderItemMapper.deleteByPrimaryKey(id);
}
@Override
public int insert(PurchaseOrderItem record) {
return purchaseOrderItemMapper.insert(record);
}
@Override
public int insertSelective(PurchaseOrderItem record) {
return purchaseOrderItemMapper.insertSelective(record);
}
@Override
public PurchaseOrderItem selectByPrimaryKey(Long id) {
return purchaseOrderItemMapper.selectByPrimaryKey(id);
}
@Override
public int updateByPrimaryKeySelective(PurchaseOrderItem record) {
return purchaseOrderItemMapper.updateByPrimaryKeySelective(record);
}
@Override
public int updateByPrimaryKey(PurchaseOrderItem record) {
return purchaseOrderItemMapper.updateByPrimaryKey(record);
}
}

@ -1,53 +0,0 @@
package com.ms.biz.service.impl;
import com.ms.biz.service.PurchaseOrderMaskAddressService;
import com.ms.dal.entity.PurchaseOrderMaskAddress;
import com.ms.dal.mapper.PurchaseOrderMaskAddressMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
*
*/
@Service
public class PurchaseOrderMaskAddressServiceImpl implements PurchaseOrderMaskAddressService{
@Autowired
private PurchaseOrderMaskAddressMapper purchaseOrderMaskAddressMapper;
@Override
public int deleteByPrimaryKey(Long id) {
return purchaseOrderMaskAddressMapper.deleteByPrimaryKey(id);
}
@Override
public int insert(PurchaseOrderMaskAddress record) {
return purchaseOrderMaskAddressMapper.insert(record);
}
@Override
public int insertSelective(PurchaseOrderMaskAddress record) {
return purchaseOrderMaskAddressMapper.insertSelective(record);
}
@Override
public PurchaseOrderMaskAddress selectByPrimaryKey(Long id) {
return purchaseOrderMaskAddressMapper.selectByPrimaryKey(id);
}
@Override
public int updateByPrimaryKeySelective(PurchaseOrderMaskAddress record) {
return purchaseOrderMaskAddressMapper.updateByPrimaryKeySelective(record);
}
@Override
public int updateByPrimaryKey(PurchaseOrderMaskAddress record) {
return purchaseOrderMaskAddressMapper.updateByPrimaryKey(record);
}
}

@ -1,7 +1,7 @@
package com.ms.biz.service.impl;
import com.ms.biz.service.PurchaseOrderService;
import com.ms.dal.entity.PurchaseOrder;
import com.ms.biz.service.PurchaseOrderService;
import com.ms.dal.mapper.PurchaseOrderMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@ -1,53 +0,0 @@
package com.ms.biz.service.impl;
import com.ms.biz.service.PurchaseOrderSkuService;
import com.ms.dal.entity.PurchaseOrderSku;
import com.ms.dal.mapper.PurchaseOrderSkuMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
*
*/
@Service
public class PurchaseOrderSkuServiceImpl implements PurchaseOrderSkuService{
@Autowired
private PurchaseOrderSkuMapper purchaseOrderSkuMapper;
@Override
public int deleteByPrimaryKey(Long id) {
return purchaseOrderSkuMapper.deleteByPrimaryKey(id);
}
@Override
public int insert(PurchaseOrderSku record) {
return purchaseOrderSkuMapper.insert(record);
}
@Override
public int insertSelective(PurchaseOrderSku record) {
return purchaseOrderSkuMapper.insertSelective(record);
}
@Override
public PurchaseOrderSku selectByPrimaryKey(Long id) {
return purchaseOrderSkuMapper.selectByPrimaryKey(id);
}
@Override
public int updateByPrimaryKeySelective(PurchaseOrderSku record) {
return purchaseOrderSkuMapper.updateByPrimaryKeySelective(record);
}
@Override
public int updateByPrimaryKey(PurchaseOrderSku record) {
return purchaseOrderSkuMapper.updateByPrimaryKey(record);
}
}

@ -0,0 +1,52 @@
package com.ms.biz.spi.callback;
import com.alibaba.fastjson.JSON;
import com.jinritemai.cloud.base.api.BaseRequest;
import com.jinritemai.cloud.base.api.BaseResponse;
import com.jinritemai.cloud.base.api.ExtensionService;
import com.jinritemai.cloud.base.api.ExtensionServiceHandler;
import com.ms.biz.common.R;
import com.ms.biz.common.SPIBaseService;
import com.ms.biz.service.DoudianMsgService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.List;
@ExtensionService("CloudOpenMsgConsumer")
@Slf4j
public class DoudianMsgReceiveService extends SPIBaseService implements ExtensionServiceHandler<List<String>, Void> {
@Autowired
private DoudianMsgService doudianMsgService;
@Override
public BaseResponse<Void> handle(BaseRequest<List<String>> req) {
// initHandle(req);
// ----参数校验----
List<String> msgList = req.getData();
if (msgList == null || msgList.isEmpty()) {
R.ok();
}
String msgBody = JSON.toJSONString(msgList);
log.info("CloudOpenMsgConsumer request: " + msgBody);
// ----逻辑校验----
// ----业务处理----
boolean addRet = false;
try {
addRet = doudianMsgService.addDoudianMsg(msgBody);
} catch (Exception e) {
log.error(String.format("addDoudianMsg fail, exception: %s", e.getMessage()));
}
if (!addRet) {
log.info(String.format("fail msgBody: %s", JSON.toJSONString(msgList)));
return BaseResponse.<Void>builder().success(false).code("1").build();
}
// 处理成功则返回 true code 0
return BaseResponse.<Void>builder().success(true).code("0").build();
}
}

@ -36,19 +36,7 @@ public class MemberAuthCallbackService extends SPIBaseService implements Extensi
MemberAuthCallBackRequestDTO fields = req.getData();
log.info("receive callback: " + JSON.toJSONString(fields));
String body = fields.getBody();
// String body = "{\"userId\":\"111087462\",\"cnaliMemberId\":\"b2b-6848123449731a\",\"authCode\":\"NGVkNWM1NjctNzYxMy01YWIwLWI5MDUtMmFhYjYwZGFiYzI5\",\"gmtMemberExpireTime\":\"2023-12-21 23:59:59\",\"type\":\"auth\"}";
// ----逻辑校验----
// ----业务处理----
try {
// final String charset = "utf-8";
// String contents = URLDecoder.decode(body, charset);
// String[] keyValues = contents.split("&");
// for (int i = 0; i < keyValues.length; i++) {
// String key = keyValues[i].substring(0, keyValues[i].indexOf("="));
// String value = keyValues[i].substring(keyValues[i].indexOf("=") + 1);
// map.put(key, value);
// }
JSONObject map = JSONObject.parseObject(body);
String authCode = map.getString("authCode");
String cnaliMemberId = map.getString("cnaliMemberId");

@ -53,19 +53,6 @@ public class ShopAuthCallbackService extends SPIBaseService implements Extension
if (msgType == 2) { // 授权消息
shopId = msgObj.getLong("shop_id");
// String code = msgObj.getString("code");
// try {
// TokenCreateRequest request = new TokenCreateRequest();
// TokenCreateParam param = request.getParam();
// param.setCode(code);
// param.setGrantType("authorization_code");
// log.info("create token response: " + JSON.toJSONString(param));
// TokenCreateResponse response = request.execute();
// TokenCreateData tokenCreateData = response.getData();
// shopName = tokenCreateData.getShopName();
// } catch (Exception e) {
// log.error("获取商户信息失败", e);
// }
int actionType = msgObj.getInteger("action_type");
if (actionType == 1 || actionType == 3) { // 关闭授权或授权超时时,去更新授权过期时间为当期时间

@ -0,0 +1,107 @@
package com.ms.biz.task;
import com.ms.biz.common.TaskBaseService;
import com.ms.biz.service.DoudianMsgService;
import com.ms.dal.entity.DoudianMsgParseQueue;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.concurrent.Executor;
@Configuration
@Component
@Slf4j
public class DoudianMsgParseTaskService extends TaskBaseService {
@Autowired
private DoudianMsgService doudianMsgService;
/**
*
*/
public int getCorePoolSiz() {
return 5;
}
/**
*
*/
public String getTaskExecutorName() {
return "doudianMsgParseTaskPool";
}
@Bean(name = "doudianMsgParseTaskPool")
@Override
public Executor getAsyncExecutor() {
return super.getAsyncExecutor();
}
@Resource(name = "doudianMsgParseTaskPool")
protected Executor taskPool;
@Override
protected Executor getTaskPool() {
return taskPool;
}
@Async("doudianMsgParseTaskPool")
@Override
public void runTask() {
super.runTask();
}
@Override
public Object getTask() {
DoudianMsgParseQueue queue = doudianMsgService.lockDoudianMsgParseQueue();
return queue;
}
/**
*
*
* @param params
* @return
*/
@Override
public Object processTask(Object params) {
if (params == null) {
return null;
}
DoudianMsgParseQueue queue = (DoudianMsgParseQueue) params;
Long doudianMsgId = queue.getDoudianMsgId();
boolean isSuccess = false;
try {
isSuccess = doudianMsgService.processDoudianMsgParseQueue(doudianMsgId);
} catch (Exception e) {
log.error("ParseDoudianMsgTask processTask exception: ", e);
doudianMsgService.failProcessDoudianMsgParseQueue(doudianMsgId);
}
if (isSuccess) {
return queue.getDoudianMsgParseQueueId();
} else {
return null;
}
}
/**
*
*
* @param params
*/
@Override
public void clearTask(Object params) {
if (params == null) {
return;
}
Long queueId = (Long)params;
doudianMsgService.deleteDoudianMsgParseQueue(queueId);
}
}

@ -78,7 +78,7 @@ public class DsMessageConsumeMsgTaskService extends TaskBaseService {
Map<String, Object> res = new HashMap<>();
res.put("queue", params);
try {
// distributionOrderService.processDsMessage(((DsMessageConsumerQueue)params).getDsMessageId());
dsMessageService.processDsMessage(((DsMessageConsumerQueue)params).getDsMessageId());
res.put("processResult", ResultDTO.success());
} catch (RuntimeException e) {
log.error("[dsMessageConsumeMsgTask]error: ", e);

@ -5,6 +5,8 @@ import java.time.ZoneOffset;
import java.time.format.DateTimeFormatter;
import java.util.*;
import com.ms.api.dto.dsapi.response.SourceProductInfo;
import com.ms.api.dto.dsapi.response.SourceSkuInfo;
import com.ms.biz.bo.OrderItemSkuInfoBO;
import com.ms.biz.consts.AfterSaleConst;
import com.ms.biz.consts.DsOrderConst;
@ -129,7 +131,7 @@ public class DsOrderTool {
return (sourceSkuSubNameLength == platformSkuSubNameLength && platformSkuSubNameLength == findCount);
}
public static GetPurchaseOrderItemsAndSourceItemsResponseDTO.Sku getMatchSourceSkuInfo(OrderItemSkuInfoBO platformItem, Map<String, String> platformSkuIdAndSourceSkuIdMap, GetPurchaseOrderItemsAndSourceItemsResponseDTO.ProductInfo productInfo) {
public static SourceSkuInfo getMatchSourceSkuInfo(OrderItemSkuInfoBO platformItem, Map<String, String> platformSkuIdAndSourceSkuIdMap, SourceProductInfo productInfo) {
if (platformItem == null || productInfo == null) {
return null;
}
@ -139,9 +141,9 @@ public class DsOrderTool {
String manualRelateSourceSkuId = platformSkuIdAndSourceSkuIdMap.get(platformItem.getSkuId());
Long sourceItemId = productInfo.getSourceItemId();
GetPurchaseOrderItemsAndSourceItemsResponseDTO.Sku manualRelateSkuInfo = null;
GetPurchaseOrderItemsAndSourceItemsResponseDTO.Sku matchSkuInfo = null;
for (GetPurchaseOrderItemsAndSourceItemsResponseDTO.Sku skuInfo : productInfo.getSkus()) {
SourceSkuInfo manualRelateSkuInfo = null;
SourceSkuInfo matchSkuInfo = null;
for (SourceSkuInfo skuInfo : productInfo.getSkus()) {
if (!StringUtils.isEmpty(manualRelateSourceSkuId) && manualRelateSourceSkuId.equals(skuInfo.getSourceSkuId().toString())) {
manualRelateSkuInfo = skuInfo;
break;
@ -158,7 +160,7 @@ public class DsOrderTool {
return manualRelateSkuInfo != null ? manualRelateSkuInfo : matchSkuInfo;
}
public static int getRealSourceSkuPurchaseQuantity(Long platformSkuId, Integer platformItemTotal, GetPurchaseOrderItemsAndSourceItemsResponseDTO.Sku matchSourceSkuInfo, Map<String, GetPurchaseOrderItemsAndSourceItemsResponseDTO.SourceItemSkuRelation> platformSkuIdAndSourceSkuInfoMap) {
public static int getRealSourceSkuPurchaseQuantity(Long platformSkuId, Integer platformItemTotal, SourceSkuInfo matchSourceSkuInfo, Map<String, GetPurchaseOrderItemsAndSourceItemsResponseDTO.SourceItemSkuRelation> platformSkuIdAndSourceSkuInfoMap) {
if (platformSkuIdAndSourceSkuInfoMap == null || platformSkuIdAndSourceSkuInfoMap.isEmpty() || matchSourceSkuInfo == null) {
return platformItemTotal;
}

@ -2,6 +2,10 @@ package com.ms.biz.util;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSONObject;
import com.doudian.open.api.supplyCenter_cargo_detail.SupplyCenterCargoDetailRequest;
import com.doudian.open.api.supplyCenter_cargo_detail.SupplyCenterCargoDetailResponse;
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_cancel.SupplyCenterOrderCancelRequest;
import com.doudian.open.api.supplyCenter_order_cancel.SupplyCenterOrderCancelResponse;
import com.doudian.open.api.supplyCenter_order_cancel.data.SupplyCenterOrderCancelData;
@ -31,7 +35,7 @@ import com.ms.biz.tool.CommonTool;
import lombok.extern.slf4j.Slf4j;
@Slf4j
public class DdRequestUtil {
public class DDApi {
public static SupplyCenterOrderConfirmData supplyCenterOrderConfirm(SupplyCenterOrderConfirmParam param) {
log.info("DdApi:{}", "supplyCenterOrderConfirm");
@ -45,7 +49,7 @@ public class DdRequestUtil {
throw new RuntimeException(String.format("抖店请求错误:msg:%s,code:%s,subCode:%s,subMsg:%s,", response.getMsg(), response.getCode(), response.getSubCode(), response.getSubMsg()));
}
public static SupplyCenterOrderSyncSupplierInfoData supplyCenterOrderConfirm(SupplyCenterOrderSyncSupplierInfoParam param) {
public static SupplyCenterOrderSyncSupplierInfoData supplyCenterOrderSyncSupplierInfo(SupplyCenterOrderSyncSupplierInfoParam param) {
log.info("DdApi:{}", "supplyCenterOrderConfirm");
SupplyCenterOrderSyncSupplierInfoRequest request = new SupplyCenterOrderSyncSupplierInfoRequest();
request.setParam(param);
@ -105,8 +109,21 @@ public class DdRequestUtil {
throw new RuntimeException(String.format("抖店请求错误:msg:%s,code:%s,subCode:%s,subMsg:%s,", response.getMsg(), response.getCode(), response.getSubCode(), response.getSubMsg()));
}
public static SupplyCenterCargoDetailData supplyCenterCargoDetail(SupplyCenterCargoDetailParam param) {
log.info("DdApi:{}", "supplyCenterCargoDetail");
SupplyCenterCargoDetailRequest request = new SupplyCenterCargoDetailRequest();
request.setParam(param);
SupplyCenterCargoDetailResponse response = execute(request);
boolean success = CommonTool.checkDdApiRequestIsSuccess(response);
if (success && ObjectUtil.isNotEmpty(response.getData())) {
return response.getData();
}
throw new RuntimeException(String.format("抖店请求错误:msg:%s,code:%s,subCode:%s,subMsg:%s,", response.getMsg(), response.getCode(), response.getSubCode(), response.getSubMsg()));
}
private static <T, R> T execute(DoudianOpRequest<R> request) {
log.info("DdParam:{}", JSONObject.toJSONString(request.getParam()));
log.info("DdRequest:{}", JSONObject.toJSONString(request));
T response = request.execute();
log.info("DdResponse:{}", JSONObject.toJSONString(response));
return response;

@ -0,0 +1,61 @@
package com.ms.dal.entity;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
*
* @TableName dd_aftersale_msg
*/
@Data
public class DdAftersaleMsg implements Serializable {
/**
* id
*/
private Long ddAftersaleMsgId;
/**
* 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;
}

@ -0,0 +1,61 @@
package com.ms.dal.entity;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
*
* @TableName dd_trade_msg
*/
@Data
public class DdTradeMsg implements Serializable {
/**
* id
*/
private Long ddTradeMsgId;
/**
* 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;
}

@ -0,0 +1,41 @@
package com.ms.dal.entity;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* buffer
* @TableName doudian_aftersale_msg_buffer
*/
@Data
public class DoudianAftersaleMsgBuffer implements Serializable {
/**
* id
*/
private Long doudianAftersaleMsgBufferId;
/**
* id
*/
private String msgId;
/**
* id
*/
private Long shopId;
/**
*
*/
private Date gmtCreate;
/**
*
*/
private Date gmtModified;
private static final long serialVersionUID = 1L;
}

@ -0,0 +1,61 @@
package com.ms.dal.entity;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* queue
* @TableName doudian_aftersale_msg_queue
*/
@Data
public class DoudianAftersaleMsgQueue implements Serializable {
/**
* id
*/
private Long doudianAftersaleMsgQueueId;
/**
* id
*/
private String msgId;
/**
* id
*/
private Long shopId;
/**
* id
*/
private Integer locked;
/**
*
*/
private Date gmtLocked;
/**
*
*/
private String hostname;
/**
*
*/
private Date gmtLastHeartbeat;
/**
*
*/
private Date gmtCreate;
/**
*
*/
private Date gmtModified;
private static final long serialVersionUID = 1L;
}

@ -0,0 +1,51 @@
package com.ms.dal.entity;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
*
* @TableName doudian_msg
*/
@Data
public class DoudianMsg implements Serializable {
/**
* id
*/
private Long doudianMsgId;
/**
* id
*/
private Long shopId;
/**
* json
*/
private String msgBody;
/**
*
*/
private String status;
/**
*
*/
private String reason;
/**
*
*/
private Date gmtCreate;
/**
*
*/
private Date gmtModified;
private static final long serialVersionUID = 1L;
}

@ -0,0 +1,55 @@
package com.ms.dal.entity;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
*
* @TableName doudian_msg_parse_queue
*/
@Data
public class DoudianMsgParseQueue implements Serializable {
/**
* id
*/
private Long doudianMsgParseQueueId;
/**
*
*/
private Long doudianMsgId;
/**
* id
*/
private Long locked;
/**
*
*/
private Date gmtLocked;
/**
*
*/
private String hostname;
/**
*
*/
private Date gmtLastHeartbeat;
/**
*
*/
private Date gmtCreate;
/**
*
*/
private Date gmtModified;
private static final long serialVersionUID = 1L;
}

@ -0,0 +1,40 @@
package com.ms.dal.entity;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* buffer
* @TableName doudian_trade_msg_buffer
*/
@Data
public class DoudianTradeMsgBuffer implements Serializable {
/**
* id
*/
private Long doudianTradeMsgBufferId;
/**
* id
*/
private Long shopId;
/**
* id
*/
private String msgId;
/**
*
*/
private Date gmtCreate;
/**
*
*/
private Date gmtModified;
private static final long serialVersionUID = 1L;
}

@ -0,0 +1,60 @@
package com.ms.dal.entity;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* queue
* @TableName doudian_trade_msg_queue
*/
@Data
public class DoudianTradeMsgQueue implements Serializable {
/**
* id
*/
private Long doudianTradeMsgQueueId;
/**
* id
*/
private String msgId;
/**
* id
*/
private Long shopId;
/**
* id
*/
private Long locked;
/**
*
*/
private Date gmtLocked;
/**
*
*/
private String hostname;
/**
*
*/
private Date gmtLastHeartbeat;
/**
*
*/
private Date gmtCreate;
/**
*
*/
private Date gmtModified;
private static final long serialVersionUID = 1L;
}

@ -0,0 +1,81 @@
package com.ms.dal.entity;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
*
* @TableName purchase_order
*/
@Data
public class PlatformPurchaseOrder implements Serializable {
/**
*
*/
private String purOrderId;
/**
* id
*/
private String orderId;
/**
* id
*/
private Long shopId;
/**
*
*/
private String outPreOrderId;
/**
*
*/
private String supplierOrderId;
/**
*
*/
private String purchaseStatus;
/**
*
*/
private String status;
/**
* h5
*/
private String supplierOrderH5Url;
/**
* pc
*/
private String supplierOrderPcUrl;
/**
* h5url
*/
private String payH5Url;
/**
* pcurl
*/
private String payPcUrl;
/**
*
*/
private Date gmtCreate;
/**
*
*/
private Date gmtModified;
private static final long serialVersionUID = 1L;
}

@ -11,7 +11,7 @@ import java.util.Date;
*/
@Data
public class PurchaseOrderAddress implements Serializable {
public class PlatformPurchaseOrderAddress implements Serializable {
/**
*
*/

@ -11,7 +11,7 @@ import java.util.Date;
*/
@Data
public class PurchaseOrderMaskAddress implements Serializable {
public class PlatformPurchaseOrderMaskAddress implements Serializable {
/**
*
*/

@ -11,7 +11,7 @@ import java.util.Date;
*/
@Data
public class PurchaseOrderSku implements Serializable {
public class PlatformPurchaseOrderSku implements Serializable {
/**
*
*/
@ -32,6 +32,16 @@ public class PurchaseOrderSku implements Serializable {
*/
private String skuOrderId;
/**
* ID
*/
private String outerProductId;
/**
* skuid
*/
private String outerSkuId;
/**
* id
*/

@ -3,59 +3,105 @@ package com.ms.dal.entity;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
/**
*
*
* @TableName purchase_order
*/
@Data
public class PurchaseOrder implements Serializable {
/**
*
*/
private Long purchaseOrderId;
/**
*
*/
private String purOrderId;
/**
* id
* id
*/
private Long orderId;
/**
*
*/
private String purchasePlatform;
/**
*
*/
private String purchaseOrderSn;
/**
*
*/
private String purchaseOrderBuyer;
/**
*
*/
private String purchaseOrderSeller;
/**
*
*/
private BigDecimal purchaseOrderPayment;
/**
*
*/
private String purchaseOrderStatus;
/**
*
*/
private String purchaseOrderLogisticsName;
/**
*
*/
private String orderId;
private String purchaseOrderWaybillCode;
/**
* id
*
*/
private Long shopId;
private Date purchaseOrderSendTime;
/**
*
*
*/
private String outPreOrderId;
private String purchaseOrderFullname;
/**
*
*
*/
private String supplierOrderId;
private String purchaseOrderMobile;
/**
* h5
*
*/
private String supplierOrderH5Url;
private String purchaseOrderFullAddress;
/**
* pc
*
*/
private String supplierOrderPcUrl;
private Date purchaseOrderStartTime;
/**
* h5url
*
*/
private String payH5Url;
private Integer logisticsIsAccept;
/**
* pcurl
*
*/
private String payPcUrl;
private String status;
/**
*

@ -0,0 +1,77 @@
package com.ms.dal.entity;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
/**
*
* @TableName purchase_order_item
*/
@Data
public class PurchaseOrderItem implements Serializable {
/**
*
*/
private Long purchaseOrderItemId;
/**
* ID
*/
private Long purchaseOrderId;
/**
*
*/
private String purOrderId;
/**
* id
*/
private Long orderId;
/**
* ID
*/
private Long wareId;
/**
* SKU ID
*/
private Long skuId;
/**
*
*/
private String purchaseUrl;
/**
*
*/
private BigDecimal purchasePrice;
/**
*
*/
private Integer purchaseNum;
/**
*
*/
private String status;
/**
*
*/
private Date gmtCreate;
/**
*
*/
private Date gmtModified;
private static final long serialVersionUID = 1L;
}

@ -0,0 +1,26 @@
package com.ms.dal.mapper;
import com.ms.dal.entity.DdAftersaleMsg;
import org.apache.ibatis.annotations.Mapper;
/**
* @Entity com.ms.dal.entity.DdAftersaleMsg
*/
@Mapper
public interface DdAftersaleMsgMapper {
int deleteByPrimaryKey(Long id);
int insert(DdAftersaleMsg record);
int insertOrUpdate(DdAftersaleMsg record);
int insertSelective(DdAftersaleMsg record);
DdAftersaleMsg selectByPrimaryKey(Long id);
int updateByPrimaryKeySelective(DdAftersaleMsg record);
int updateByPrimaryKey(DdAftersaleMsg record);
}

@ -0,0 +1,26 @@
package com.ms.dal.mapper;
import com.ms.dal.entity.DdTradeMsg;
import org.apache.ibatis.annotations.Mapper;
/**
* @Entity com.ms.dal.entity.DdTradeMsg
*/
@Mapper
public interface DdTradeMsgMapper {
int deleteByPrimaryKey(Long id);
int insert(DdTradeMsg record);
int insertOrUpdate(DdTradeMsg record);
int insertSelective(DdTradeMsg record);
DdTradeMsg selectByPrimaryKey(Long id);
int updateByPrimaryKeySelective(DdTradeMsg record);
int updateByPrimaryKey(DdTradeMsg record);
}

@ -0,0 +1,26 @@
package com.ms.dal.mapper;
import com.ms.dal.entity.DoudianAftersaleMsgBuffer;
import org.apache.ibatis.annotations.Mapper;
/**
* @Entity com.ms.dal.entity.DoudianAftersaleMsgBuffer
*/
@Mapper
public interface DoudianAftersaleMsgBufferMapper {
int deleteByPrimaryKey(Long id);
int insert(DoudianAftersaleMsgBuffer record);
int insertOrUpdate(DoudianAftersaleMsgBuffer record);
int insertSelective(DoudianAftersaleMsgBuffer record);
DoudianAftersaleMsgBuffer selectByPrimaryKey(Long id);
int updateByPrimaryKeySelective(DoudianAftersaleMsgBuffer record);
int updateByPrimaryKey(DoudianAftersaleMsgBuffer record);
}

@ -0,0 +1,26 @@
package com.ms.dal.mapper;
import com.ms.dal.entity.DoudianAftersaleMsgQueue;
import org.apache.ibatis.annotations.Mapper;
/**
* @Entity com.ms.dal.entity.DoudianAftersaleMsgQueue
*/
@Mapper
public interface DoudianAftersaleMsgQueueMapper {
int deleteByPrimaryKey(Long id);
int insert(DoudianAftersaleMsgQueue record);
int insertOrUpdate(DoudianAftersaleMsgQueue record);
int insertSelective(DoudianAftersaleMsgQueue record);
DoudianAftersaleMsgQueue selectByPrimaryKey(Long id);
int updateByPrimaryKeySelective(DoudianAftersaleMsgQueue record);
int updateByPrimaryKey(DoudianAftersaleMsgQueue record);
}

@ -0,0 +1,26 @@
package com.ms.dal.mapper;
import com.ms.dal.entity.DoudianMsg;
import org.apache.ibatis.annotations.Mapper;
/**
* @Entity com.ms.dal.entity.DoudianMsg
*/
@Mapper
public interface DoudianMsgMapper {
int deleteByPrimaryKey(Long id);
int insert(DoudianMsg record);
int insertOrUpdate(DoudianMsg record);
int insertSelective(DoudianMsg record);
DoudianMsg selectByPrimaryKey(Long id);
int updateByPrimaryKeySelective(DoudianMsg record);
int updateByPrimaryKey(DoudianMsg record);
}

@ -0,0 +1,27 @@
package com.ms.dal.mapper;
import com.ms.dal.entity.DoudianMsgParseQueue;
import org.apache.ibatis.annotations.Mapper;
/**
* @Entity com.ms.dal.entity.DoudianMsgParseQueue
*/
@Mapper
public interface DoudianMsgParseQueueMapper {
int deleteByPrimaryKey(Long id);
int insert(DoudianMsgParseQueue record);
int insertOrUpdate(DoudianMsgParseQueue record);
int insertSelective(DoudianMsgParseQueue record);
DoudianMsgParseQueue selectByPrimaryKey(Long id);
int updateByPrimaryKeySelective(DoudianMsgParseQueue record);
int updateByPrimaryKey(DoudianMsgParseQueue record);
DoudianMsgParseQueue selectUnlockRowByQueueId(Long queueId);
}

@ -0,0 +1,26 @@
package com.ms.dal.mapper;
import com.ms.dal.entity.DoudianTradeMsgBuffer;
import org.apache.ibatis.annotations.Mapper;
/**
* @Entity com.ms.dal.entity.DoudianTradeMsgBuffer
*/
@Mapper
public interface DoudianTradeMsgBufferMapper {
int deleteByPrimaryKey(Long id);
int insert(DoudianTradeMsgBuffer record);
int insertOrUpdate(DoudianTradeMsgBuffer record);
int insertSelective(DoudianTradeMsgBuffer record);
DoudianTradeMsgBuffer selectByPrimaryKey(Long id);
int updateByPrimaryKeySelective(DoudianTradeMsgBuffer record);
int updateByPrimaryKey(DoudianTradeMsgBuffer record);
}

@ -0,0 +1,26 @@
package com.ms.dal.mapper;
import com.ms.dal.entity.DoudianTradeMsgQueue;
import org.apache.ibatis.annotations.Mapper;
/**
* @Entity com.ms.dal.entity.DoudianTradeMsgQueue
*/
@Mapper
public interface DoudianTradeMsgQueueMapper {
int deleteByPrimaryKey(Long id);
int insert(DoudianTradeMsgQueue record);
int insertOrUpdate(DoudianTradeMsgQueue record);
int insertSelective(DoudianTradeMsgQueue record);
DoudianTradeMsgQueue selectByPrimaryKey(Long id);
int updateByPrimaryKeySelective(DoudianTradeMsgQueue record);
int updateByPrimaryKey(DoudianTradeMsgQueue record);
}

@ -0,0 +1,26 @@
package com.ms.dal.mapper;
import com.ms.dal.entity.PlatformPurchaseOrderAddress;
import org.apache.ibatis.annotations.Mapper;
/**
* @Entity com.ms.dal.entity.PurchaseOrderAddress
*/
@Mapper
public interface PlatformPurchaseOrderAddressMapper {
int deleteByPrimaryKey(String id);
int insert(PlatformPurchaseOrderAddress record);
int insertOrUpdate(PlatformPurchaseOrderAddress record);
int insertSelective(PlatformPurchaseOrderAddress record);
PlatformPurchaseOrderAddress selectByPrimaryKey(String id);
int updateByPrimaryKeySelective(PlatformPurchaseOrderAddress record);
int updateByPrimaryKey(PlatformPurchaseOrderAddress record);
}

@ -0,0 +1,30 @@
package com.ms.dal.mapper;
import com.ms.dal.entity.PlatformPurchaseOrder;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* @Entity com.ms.dal.PlatformPurchaseOrder
*/
@Mapper
public interface PlatformPurchaseOrderMapper {
int deleteByPrimaryKey(String id);
int insert(PlatformPurchaseOrder record);
int insertOrUpdate(PlatformPurchaseOrder record);
int insertSelective(PlatformPurchaseOrder record);
PlatformPurchaseOrder selectByPrimaryKey(String id);
int updateByPrimaryKeySelective(PlatformPurchaseOrder record);
int updateByPrimaryKey(PlatformPurchaseOrder record);
List<PlatformPurchaseOrder> getListByPurOrderIds(@Param("purOrderIds") List<String> purOrderIds);
}

@ -0,0 +1,26 @@
package com.ms.dal.mapper;
import com.ms.dal.entity.PlatformPurchaseOrderMaskAddress;
import org.apache.ibatis.annotations.Mapper;
/**
* @Entity com.ms.dal.entity.PurchaseOrderMaskAddress
*/
@Mapper
public interface PlatformPurchaseOrderMaskAddressMapper {
int deleteByPrimaryKey(String id);
int insert(PlatformPurchaseOrderMaskAddress record);
int insertOrUpdate(PlatformPurchaseOrderMaskAddress record);
int insertSelective(PlatformPurchaseOrderMaskAddress record);
PlatformPurchaseOrderMaskAddress selectByPrimaryKey(String id);
int updateByPrimaryKeySelective(PlatformPurchaseOrderMaskAddress record);
int updateByPrimaryKey(PlatformPurchaseOrderMaskAddress record);
}

@ -0,0 +1,33 @@
package com.ms.dal.mapper;
import com.ms.dal.entity.PlatformPurchaseOrderSku;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* @Entity com.ms.dal.PlatformPurchaseOrderSku
*/
@Mapper
public interface PlatformPurchaseOrderSkuMapper {
int deleteByPrimaryKey(String id);
int insert(PlatformPurchaseOrderSku record);
int insertOrUpdate(PlatformPurchaseOrderSku record);
int insertSelective(PlatformPurchaseOrderSku record);
PlatformPurchaseOrderSku selectByPrimaryKey(String id);
int updateByPrimaryKeySelective(PlatformPurchaseOrderSku record);
int updateByPrimaryKey(PlatformPurchaseOrderSku record);
List<PlatformPurchaseOrderSku> getListByPurOrderIds(@Param("purOrderIds") List<String> purOrderIds);
int insertBatch(List<PlatformPurchaseOrderSku> list);
}

@ -1,26 +0,0 @@
package com.ms.dal.mapper;
import com.ms.dal.entity.PurchaseOrderAddress;
import org.apache.ibatis.annotations.Mapper;
/**
* @Entity com.ms.dal.entity.PurchaseOrderAddress
*/
@Mapper
public interface PurchaseOrderAddressMapper {
int deleteByPrimaryKey(Long id);
int insert(PurchaseOrderAddress record);
int insertOrUpdate(PurchaseOrderAddress record);
int insertSelective(PurchaseOrderAddress record);
PurchaseOrderAddress selectByPrimaryKey(Long id);
int updateByPrimaryKeySelective(PurchaseOrderAddress record);
int updateByPrimaryKey(PurchaseOrderAddress record);
}

@ -0,0 +1,31 @@
package com.ms.dal.mapper;
import com.ms.dal.entity.PurchaseOrderItem;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* @Entity com.ms.dal.PurchaseOrderItem
*/
@Mapper
public interface PurchaseOrderItemMapper {
int deleteByPrimaryKey(Long id);
int insert(PurchaseOrderItem record);
int insertOrUpdate(PurchaseOrderItem record);
int insertSelective(PurchaseOrderItem record);
PurchaseOrderItem selectByPrimaryKey(Long id);
int updateByPrimaryKeySelective(PurchaseOrderItem record);
int updateByPrimaryKey(PurchaseOrderItem record);
int insertBatch(List<PurchaseOrderItem> list);
int updateStatusByPurchaseOrderIds(@Param("status") String status, @Param("purchaseOrderIds") List<Long> purchaseOrderIds);
}

@ -1,10 +1,14 @@
package com.ms.dal.mapper;
import com.ms.dal.entity.PurchaseOrder;
import com.ms.dal.entity.PurchaseOrderItem;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* @Entity com.ms.dal.entity.PurchaseOrder
* @Entity com.ms.dal.PurchaseOrder
*/
@Mapper
public interface PurchaseOrderMapper {
@ -23,4 +27,7 @@ public interface PurchaseOrderMapper {
int updateByPrimaryKey(PurchaseOrder record);
int insertBatch(List<PurchaseOrder> list);
PurchaseOrder getByPurchaseOrderSn(@Param("purchaseOrderSn") String purchaseOrderSn);
}

@ -1,26 +0,0 @@
package com.ms.dal.mapper;
import com.ms.dal.entity.PurchaseOrderMaskAddress;
import org.apache.ibatis.annotations.Mapper;
/**
* @Entity com.ms.dal.entity.PurchaseOrderMaskAddress
*/
@Mapper
public interface PurchaseOrderMaskAddressMapper {
int deleteByPrimaryKey(Long id);
int insert(PurchaseOrderMaskAddress record);
int insertOrUpdate(PurchaseOrderMaskAddress record);
int insertSelective(PurchaseOrderMaskAddress record);
PurchaseOrderMaskAddress selectByPrimaryKey(Long id);
int updateByPrimaryKeySelective(PurchaseOrderMaskAddress record);
int updateByPrimaryKey(PurchaseOrderMaskAddress record);
}

@ -1,29 +0,0 @@
package com.ms.dal.mapper;
import com.ms.dal.entity.PurchaseOrderSku;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* @Entity com.ms.dal.entity.PurchaseOrderSku
*/
@Mapper
public interface PurchaseOrderSkuMapper {
int deleteByPrimaryKey(Long id);
int insert(PurchaseOrderSku record);
int insertOrUpdate(PurchaseOrderSku record);
int insertSelective(PurchaseOrderSku record);
PurchaseOrderSku selectByPrimaryKey(Long id);
int updateByPrimaryKeySelective(PurchaseOrderSku record);
int updateByPrimaryKey(PurchaseOrderSku record);
int insertBatch(List<PurchaseOrderSku> list);
}

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save