20240115-ljl-multiPay
ljl 1 year ago
parent b08e4b553b
commit 6439039923

@ -15,7 +15,7 @@ public class DsSuccessRetDTO {
private String code;
private String message;
private Integer createAlibabaOrderLogId;
private Integer isEncryptOrder;
private String isEncryptOrder;
private Integer isUseManualConsignee;
private String flow;
private Boolean includeSplitJxhy;

@ -3,6 +3,7 @@ package com.ms.api.dto.dsorder;
import lombok.Data;
import java.util.Date;
import java.util.Map;
@Data
public class RefundInfoDTO {
@ -10,9 +11,15 @@ public class RefundInfoDTO {
private String status;
private String refundStatus;
private Date gmtTimeOut;
private Integer goodsStatus;
private Integer refundPayment;
private Integer goodsReceived;
private String rejectReason;
private Integer onlyRefund;
private Integer refundGoods;
private String sellerMobile;
private String sellerRealName;
private String sellerReceiveAddress;
private String sellerTel;
private Map<String, Integer> orderEntryCountMap;
}

@ -14,5 +14,5 @@ public class Refund1688Const {
public static final String REFUND_STATUS_WAIT_BUYER_SEND = "waitbuyersend";
public static final String REFUND_STATUS_WAIT_BUYER_RECEIVE = "waitsellerreceive";
public static final String REFUND_STATUS_WAIT_SELLER_RECEIVE = "waitsellerreceive";
}

@ -25,7 +25,7 @@ import java.util.List;
* date 2022/11/24 5:14 PM
*/
@Slf4j
@Component
//@Component
public class MqDemoService implements ApplicationListener<ContextRefreshedEvent> {
private static final String TOPIC = MqFactory.generateProdTopic("miaoshougoods_test");
private static final String GROUP = "GID_miaoshougoods_test";

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

@ -1,8 +1,10 @@
package com.ms.biz.service.impl;
import com.alibaba.fastjson.JSON;
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.doudian.open.api.supplyCenter_order_syncSupplierInfo.param.SupplierOrderUrl;
import com.ms.api.dto.dsapi.request.*;
import com.ms.api.dto.dsapi.response.*;
import com.ms.api.dto.dsorder.PurchaseOrderDTO;
@ -24,13 +26,17 @@ import com.ms.dal.mapper.*;
import lombok.AllArgsConstructor;
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.jdbc.datasource.DataSourceTransactionManager;
import org.springframework.stereotype.Service;
import org.springframework.transaction.TransactionDefinition;
import org.springframework.transaction.TransactionStatus;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
@Service
@ -48,6 +54,9 @@ public class DistributionOrderServiceImpl implements DistributionOrderService {
private PurchaseOrderItemMapper purchaseOrderItemMapper;
private DsApiService dsApiService;
@Autowired
private RedisTemplate<String, String> redisTemplate;
@Override
public void batchCreate(BatchCreateParam param, BatchCreateData data) {
System.out.println("param: " + param);
@ -77,6 +86,9 @@ public class DistributionOrderServiceImpl implements DistributionOrderService {
BatchCreateDistributionOrdersRequestDTO request = buildBatchCreateDistributionOrdersRequestDTO(param);
BatchCreateDistributionOrdersResponseDTO response = dsApiService.batchCreateDistributionOrders(param.getShopId(), request);
// String res = "{\"result\":\"success\",\"successCount\":1,\"failCount\":0,\"successList\":[{\"result\":\"success\",\"data\":{\"success\":true,\"totalSuccessAmount\":1399,\"orderId\":\"3630260954504828754\",\"postFee\":0,\"mutilOrders\":null},\"createAlibabaOrderLogId\":1420,\"platformOrderIds\":[\"6917543139367389081\"],\"isEncryptOrder\":\"true\",\"isSupportEncryptOrder\":1,\"isUseManualConsignee\":0,\"flow\":\"fenxiao\",\"includeSplitJxhy\":false,\"sourceOrderIds\":[\"3630260954504828754\"],\"payRet\":null,\"platformOrderId\":\"6917543139367389081\",\"relatePurchaseOrderInfos\":[{\"platformOrderId\":\"6917543139367389081\",\"purchasePlatform\":\"1688DS\",\"purchaseOrderSn\":\"3630260954504828754\",\"purchaseOrderBuyer\":\"\\u6843\\u72f8\\u706c\\u5c0f\\u7231\",\"purchaseOrderSeller\":\"\\u4e49\\u4e4c\\u73cd\\u4eab\\u8d38\\u6613\",\"purchaseOrderPayment\":\"13.99\",\"purchaseOrderFullname\":\"\\u7535*\",\"purchaseOrderMobile\":\"1********00\",\"purchaseOrderFullAddress\":\"\\u5317\\u4eac \\u5317\\u4eac\\u5e02 \\u6d77\\u6dc0\\u533a \\u6d77\\u6dc0\\u8857\\u9053 \\u4e92\\u8054*******\",\"purchaseOrderStartTime\":\"2023-11-14 14:29:33\",\"platformPushStatus\":\"wait\",\"purchaseOrderLogisticsName\":\"\",\"purchaseOrderWaybillCode\":\"\",\"purchaseOrderStatus\":\"wait_pay\",\"purchaseOrderFlow\":\"fenxiao\",\"alibabaOrderStatus\":\"waitbuyerpay\",\"isUseManualConsignee\":0,\"isDsEncryptOrder\":0,\"isSupportEncryptOrder\":0,\"logisticsIsAccept\":false,\"items\":[{\"skuId\":\"3659175955997568\",\"wareId\":\"3649883085652281308\",\"purchaseNum\":\"1\",\"purchasePrice\":\"13.99\",\"sourceItemId\":\"686872273204\",\"subItemId\":\"3630260954504828754\"}],\"mergePurchasePlatformOrderIds\":null,\"purchaseOrderUpdateTime\":\"2023-11-14 14:29:33\",\"purchaseOrderPayTime\":null}]}],\"errorList\":null,\"lockSourceItems\":[{\"createPurchaseOrderLockSkuId\":\"2077\",\"createPurchaseOrderLockId\":\"20001608\",\"sourceItemId\":\"686872273204\",\"sourceSkuId\":\"4897420288982\",\"createPurchaseOrderLogId\":\"1477\",\"sourceOrderId\":\"3630260954504828754\",\"sourceNum\":null,\"reqId\":null,\"status\":\"lock\",\"gmtCreate\":\"2023-11-14 14:29:32\",\"gmtModified\":\"2023-11-14 14:29:33\",\"platformOrderId\":\"6917543139367389081\",\"platformItemId\":\"3649883085652281308\",\"platformSkuId\":\"3659175955997568\"}]}";
// BatchCreateDistributionOrdersResponseDTO response = JSON.parseObject(res, BatchCreateDistributionOrdersResponseDTO.class);
List<OrderResult> orderResults = new ArrayList<>();
List<PurchaseOrder> purchaseOrders = new ArrayList<>();
List<PurchaseOrderItem> purchaseOrderItems = new ArrayList<>();
@ -85,7 +97,7 @@ public class DistributionOrderServiceImpl implements DistributionOrderService {
String purOrderId = orderIdAndPurOrderIdMap.get(purchaseOrderDTO.getPlatformOrderId());
PurchaseOrder purchaseOrder = buildPurchaseOrderByDTO(purchaseOrderDTO, purOrderId);
purchaseOrders.add(purchaseOrder);
List<PurchaseOrderItem> items = buildPurchaseOrderItemsByPurchaseOrderDTO(purchaseOrderDTO, purOrderId);
List<PurchaseOrderItem> items = buildPurchaseOrderItemsByPurchaseOrderDTO(purchaseOrder, purchaseOrderDTO, purOrderId);
purchaseOrderItems.addAll(items);
OrderResult orderResult = buildOrderResult(purchaseOrderDTO, orderIdAndPurOrderIdMap, skuIdAndPurSkuOrderIdMap);
orderResults.add(orderResult);
@ -93,8 +105,8 @@ public class DistributionOrderServiceImpl implements DistributionOrderService {
}
data.setOrderResults(orderResults);
purchaseOrderItemMapper.insertBatch(purchaseOrderItems);
purchaseOrderMapper.insertBatch(purchaseOrders);
purchaseOrderItemMapper.insertBatch(purchaseOrderItems);
}
private PurchaseOrder buildPurchaseOrderByDTO(PurchaseOrderDTO purchaseOrderDTO, String purOrderId) {
@ -112,13 +124,17 @@ public class DistributionOrderServiceImpl implements DistributionOrderService {
throw new RuntimeException("时间格式错误");
}
String purchaseOrderId = generateOrderId("purchase_order");
PurchaseOrder purchaseOrder = new PurchaseOrder();
purchaseOrder.setPurchaseOrderId(Long.valueOf(purchaseOrderId));
purchaseOrder.setPurOrderId(purOrderId);
purchaseOrder.setOrderId(Long.valueOf(purchaseOrderDTO.getPlatformOrderId()));
purchaseOrder.setPurchasePlatform(purchaseOrderDTO.getPurchasePlatform());
purchaseOrder.setPurchaseOrderStatus(purchaseOrderDTO.getPurchaseOrderStatus());
purchaseOrder.setPurchaseOrderSendTime(purchaseOrderSendTime);
purchaseOrder.setPurchaseOrderStartTime(purchaseOrderStartTime);
purchaseOrder.setPurchaseOrderPayment(BigDecimal.valueOf(0));
purchaseOrder.setPurchaseOrderBuyer(purchaseOrderDTO.getPurchaseOrderBuyer());
purchaseOrder.setPurchaseOrderSeller(purchaseOrderDTO.getPurchaseOrderSeller());
purchaseOrder.setLogisticsIsAccept(purchaseOrderDTO.getLogisticsIsAccept());
@ -134,16 +150,18 @@ public class DistributionOrderServiceImpl implements DistributionOrderService {
return purchaseOrder;
}
private List<PurchaseOrderItem> buildPurchaseOrderItemsByPurchaseOrderDTO(PurchaseOrderDTO purchaseOrderDTO, String purOrderId) {
private List<PurchaseOrderItem> buildPurchaseOrderItemsByPurchaseOrderDTO(PurchaseOrder purchaseOrder, PurchaseOrderDTO purchaseOrderDTO, String purOrderId) {
List<PurchaseOrderItem> items = new ArrayList<>();
for (PurchaseOrderItemDTO itemDTO: purchaseOrderDTO.getItems()) {
PurchaseOrderItem item = new PurchaseOrderItem();
item.setPurOrderId(purOrderId);
item.setPurchaseOrderId(purchaseOrder.getPurchaseOrderId());
item.setOrderId(Long.valueOf(purchaseOrderDTO.getPlatformOrderId()));
item.setPurchaseNum(itemDTO.getPurchaseNum());
item.setSkuId(itemDTO.getSkuId());
item.setWareId(itemDTO.getWareId());
item.setPurchaseUrl(itemDTO.getPurchaseUrl());
item.setPurchaseUrl(itemDTO.getPurchaseUrl() == null ? "" : itemDTO.getPurchaseUrl());
item.setPurchasePrice(BigDecimal.valueOf(0));
item.setStatus(StatusConst.normal);
item.setGmtCreate(new Date());
item.setGmtModified(new Date());
@ -205,7 +223,12 @@ public class DistributionOrderServiceImpl implements DistributionOrderService {
orderResult.setOutPreOrderId(""); // TODO 无此参数
orderResult.setPurOrderId(orderIdAndPurOrderIdMap.get(purchaseOrder.getPlatformOrderId()));
orderResult.setSupplierOrderId(purchaseOrder.getPurchaseOrderSn());
orderResult.setSupplierOrderUrl(null);
OrderResult.SupplierOrderUrl supplierOrderUrl = new OrderResult.SupplierOrderUrl();
String url = String.format("https://trade.1688.com/order/new_step_order_detail.htm?orderId=%s&amug_web_biz=fwmkt&amug_web_fl_src=cy", purchaseOrder.getPurchaseOrderSn());
supplierOrderUrl.setH5Url(url);
supplierOrderUrl.setPcUrl(url);
orderResult.setSupplierOrderUrl(supplierOrderUrl);
List<OrderResult.SkuOrderResult> skuOrderResults = new ArrayList<>();
for (PurchaseOrderItemDTO item: purchaseOrder.getItems()) {
@ -324,9 +347,11 @@ public class DistributionOrderServiceImpl implements DistributionOrderService {
consigneeInfo.setCountyAreaId(Integer.valueOf(address.getTown().getId()));
consigneeInfo.setTown(address.getStreet().getName());
consigneeInfo.setTownAreaId(Integer.valueOf(address.getStreet().getId()));
consigneeInfo.setFullAddress("");
consigneeInfo.setFullname(address.getPostReceiver());
consigneeInfo.setMobile(address.getPostTel());
String fullAddress = String.format("%s%s%s%s%s", consigneeInfo.getProvince(), consigneeInfo.getCity(), consigneeInfo.getCounty(), consigneeInfo.getTown(), consigneeInfo.getAddress());
consigneeInfo.setFullAddress(fullAddress);
return consigneeInfo;
}
@ -435,14 +460,17 @@ public class DistributionOrderServiceImpl implements DistributionOrderService {
throw new RuntimeException("每次只能请求1个采购单");
}
String purOrderId = param.getParams().get(0).getPurOrderId();
PlatformPurchaseOrder platformPurchaseOrder = platformPurchaseOrderMapper.selectByPrimaryKey(param.getParams().get(0).getPurOrderId());
if (platformPurchaseOrder == null) {
throw new RuntimeException("采购单不存在");
}
PurchaseOrder purchaseOrder = purchaseOrderMapper.getByPurOrderId(purOrderId);
List<PaymentResult> paymentResults = new ArrayList<>();
for (BatchPayParam.Param p: param.getParams()) {
GetPurchaseOrderPayUrlResponseDTO response = dsApiService.getPurchaseOrderPayUrl(Collections.singletonList(p.getPurOrderId()), p.getShopId());
GetPurchaseOrderPayUrlResponseDTO response = dsApiService.getPurchaseOrderPayUrl(Collections.singletonList(purchaseOrder.getPurchaseOrderSn()), p.getShopId());
if (response.isSuccess()) {
PaymentResult paymentResult = new PaymentResult();
PaymentResult.PayUrl payUrl = new PaymentResult.PayUrl();
@ -463,4 +491,15 @@ public class DistributionOrderServiceImpl implements DistributionOrderService {
}
data.setPaymentResults(paymentResults);
}
public String generateOrderId(String type) {
Date date = new Date();
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddhhmm00");
String dateKey = dateFormat.format(date);
String key = type + ":" + dateKey;
Long value = redisTemplate.opsForValue().increment(key, 1);
redisTemplate.expire(key, 1, TimeUnit.MINUTES);
SimpleDateFormat dateFormat1 = new SimpleDateFormat("yyyyMMddhhmmss");
return dateFormat1.format(date) + String.format("%1$04d", value);
}
}

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

@ -14,6 +14,7 @@ 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.Refund1688Const;
import com.ms.biz.consts.StatusConst;
import com.ms.biz.service.DsMessageConsumerBufferService;
import com.ms.biz.service.DsMessageConsumerQueueService;
@ -327,7 +328,7 @@ public class DsMessageServiceImpl implements DsMessageService {
DDApi.supplyCenterRefundOperate(param);
}
private static SkuRefundInfosItem buildSkuRefundInfosItem(RefundInfoDTO refundInfo) {
private SkuRefundInfosItem buildSkuRefundInfosItem(RefundInfoDTO refundInfo) {
Address address = new Address();
address.setUserName(refundInfo.getSellerRealName());
address.setDetail(refundInfo.getSellerReceiveAddress());
@ -337,18 +338,40 @@ public class DsMessageServiceImpl implements DsMessageService {
skuRefundInfosItem.setRejectReason(refundInfo.getRejectReason());
skuRefundInfosItem.setAddress(address);
skuRefundInfosItem.setCloseReason("");
skuRefundInfosItem.setOperationType(1);
skuRefundInfosItem.setAftersaleType(1L);
skuRefundInfosItem.setOperationType(getOperateType(refundInfo));
skuRefundInfosItem.setAftersaleType((long) getAftersaleType(refundInfo));
return skuRefundInfosItem;
}
private int getOperateType(String refundStatus) {
/*Refund1688Const.REFUND_STATUS_WAIT_SELLER_AGREE 0
Refund1688Const.REFUND_STATUS_WAIT_BUYER_SEND 2
Refund1688Const.REFUND_STATUS_WAIT_BUYER_RECEIVE 4
Refund1688Const.REFUND_STATUS_REFUND_CLOSE 5
Refund1688Const.REFUND_STATUS_REFUND_CLOSE 3*/
return 0;
private int getOperateType(RefundInfoDTO refundInfo) {
int operateType = 0;
if (refundInfo.getStatus().equals(Refund1688Const.REFUND_STATUS_WAIT_SELLER_AGREE)) {
operateType = 0;
} else if (refundInfo.getStatus().equals(Refund1688Const.REFUND_STATUS_WAIT_BUYER_SEND)) {
operateType = 2;
} else if (refundInfo.getStatus().equals(Refund1688Const.REFUND_STATUS_WAIT_SELLER_RECEIVE)) {
operateType = 2;
} else if (refundInfo.getOnlyRefund() == 1 && refundInfo.getStatus().equals(Refund1688Const.REFUND_STATUS_REFUND_SUCCESS)) {
operateType = 1;
} else if (refundInfo.getOnlyRefund() == 0 && refundInfo.getGoodsStatus() == 3 && refundInfo.getStatus().equals(Refund1688Const.REFUND_STATUS_REFUND_SUCCESS)) {
operateType = 6;
} else if (refundInfo.getOnlyRefund() == 0 && refundInfo.getGoodsStatus() == 3 && refundInfo.getStatus().equals(Refund1688Const.REFUND_STATUS_REFUND_CLOSE)) {
operateType = 7;
} else if (refundInfo.getOnlyRefund() == 1 && refundInfo.getStatus().equals(Refund1688Const.REFUND_STATUS_REFUND_CLOSE)) {
operateType = 3;
} else if (refundInfo.getStatus().equals(Refund1688Const.REFUND_STATUS_REFUND_CLOSE)) {
operateType = 3;
}
return operateType;
}
private int getAftersaleType(RefundInfoDTO refundInfo) {
if (refundInfo.getOnlyRefund() == 1 && refundInfo.getGoodsReceived() == 1) {
return 1;
} else if (refundInfo.getOnlyRefund() == 1 && refundInfo.getGoodsReceived() == 0) {
return 2;
}
return 3;
}
private void handlePurchaseOrderCancel(PurchaseOrderCancelMessageDTO messageDTO) {
@ -364,15 +387,21 @@ public class DsMessageServiceImpl implements DsMessageService {
SupplyCenterOrderSyncSupplierInfoParam param = new SupplyCenterOrderSyncSupplierInfoParam();
param.setPurOrderId(platformPurchaseOrder.getPurOrderId());
param.setSupplierOrderId(purchaseOrderDTO.getPurchaseOrderSn());
param.setSupplierOrderUrl(new SupplierOrderUrl());
SupplierOrderUrl supplierOrderUrl = new SupplierOrderUrl();
String url = String.format("https://trade.1688.com/order/new_step_order_detail.htm?orderId=%s&amug_web_biz=fwmkt&amug_web_fl_src=cy", purchaseOrderDTO.getPurchaseOrderSn());
supplierOrderUrl.setH5Url(url);
supplierOrderUrl.setPcUrl(url);
param.setSupplierOrderUrl(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(item.getSubItemId());
skuOrders.add(skuOrdersItem);
}
param.setSkuOrders(skuOrders);
DDApi.supplyCenterOrderSyncSupplierInfo(param);
}
}

@ -0,0 +1,60 @@
package com.ms.dal.entity;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
*
* @TableName doudian_message
*/
@Data
public class DoudianMessage implements Serializable {
/**
* id
*/
private Long doudianMessageId;
/**
* 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,30 @@
package com.ms.dal.mapper;
import com.ms.dal.entity.DoudianMessage;
import com.ms.dal.entity.PlatformPurchaseOrderSku;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* @Entity com.ms.dal.entity.DoudianMessage
*/
@Mapper
public interface DoudianMessageMapper {
int deleteByPrimaryKey(Long id);
int insert(DoudianMessage record);
int insertOrUpdate(DoudianMessage record);
int insertSelective(DoudianMessage record);
DoudianMessage selectByPrimaryKey(Long id);
int updateByPrimaryKeySelective(DoudianMessage record);
int updateByPrimaryKey(DoudianMessage record);
int insertBatch(List<DoudianMessage> list);
}

@ -30,4 +30,6 @@ public interface PurchaseOrderMapper {
int insertBatch(List<PurchaseOrder> list);
PurchaseOrder getByPurchaseOrderSn(@Param("purchaseOrderSn") String purchaseOrderSn);
PurchaseOrder getByPurOrderId(@Param("purOrderId") String purOrderId);
}

@ -22,12 +22,12 @@ mybatis.mapper-locations=classpath*:mapper/*.xml
mybatis.configuration.log-impl=org.apache.ibatis.logging.slf4j.Slf4jImpl
mybatis.configuration.map-underscore-to-camel-case=true
#cloud.app.key=7290512081592305208
#cloud.app.secret=d21bf43e-c671-4fa5-b35a-762a9c775129
cloud.app.key=7290512081592305208
cloud.app.secret=d21bf43e-c671-4fa5-b35a-762a9c775129
# boe
cloud.app.key=7296606199200499244
cloud.app.secret=0063975e-7755-4d51-8255-ad163604456f
#cloud.app.key=7296606199200499244
#cloud.app.secret=0063975e-7755-4d51-8255-ad163604456f
#spring.redis.host=r-2zext1mz5bw1hsochrpd.redis.rds.aliyuncs.com
#spring.redis.port=6379

@ -0,0 +1,181 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ms.dal.mapper.DoudianMessageMapper">
<resultMap id="BaseResultMap" type="com.ms.dal.entity.DoudianMessage">
<id property="doudianMessageId" column="doudian_message_id" jdbcType="BIGINT"/>
<result property="msgId" column="msg_id" jdbcType="VARCHAR"/>
<result property="shopId" column="shop_id" jdbcType="BIGINT"/>
<result property="tag" column="tag" jdbcType="SMALLINT"/>
<result property="data" column="data" jdbcType="VARCHAR"/>
<result property="status" column="status" jdbcType="VARCHAR"/>
<result property="reason" column="reason" jdbcType="VARCHAR"/>
<result property="gmtCreate" column="gmt_create" jdbcType="TIMESTAMP"/>
<result property="gmtModified" column="gmt_modified" jdbcType="TIMESTAMP"/>
</resultMap>
<sql id="Base_Column_List">
doudian_message_id,msg_id,shop_id,
tag,data,status,
reason,gmt_create,gmt_modified
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from doudian_message
where doudian_message_id = #{doudianMessageId,jdbcType=BIGINT}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete from doudian_message
where doudian_message_id = #{doudianMessageId,jdbcType=BIGINT}
</delete>
<insert id="insert" keyColumn="doudian_message_id" keyProperty="doudianMessageId" parameterType="com.ms.dal.entity.DoudianMessage" useGeneratedKeys="true">
insert into doudian_message
( doudian_message_id,msg_id,shop_id
,tag,data,status
,reason,gmt_create,gmt_modified
)
values (#{doudianMessageId,jdbcType=BIGINT},#{msgId,jdbcType=VARCHAR},#{shopId,jdbcType=BIGINT}
,#{tag,jdbcType=SMALLINT},#{data,jdbcType=VARCHAR},#{status,jdbcType=VARCHAR}
,#{reason,jdbcType=VARCHAR},#{gmtCreate,jdbcType=TIMESTAMP},#{gmtModified,jdbcType=TIMESTAMP}
)
</insert>
<update id="insertOrUpdate" keyColumn="doudian_message_id" keyProperty="doudianMessageId" parameterType="com.ms.dal.entity.DoudianMessage"
useGeneratedKeys="true">
insert into doudian_message
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="doudianMessageId != null">doudian_message_id,</if>
<if test="msgId != null">msg_id,</if>
<if test="shopId != null">shop_id,</if>
<if test="tag != null">tag,</if>
<if test="data != null">data,</if>
<if test="status != null">status,</if>
<if test="reason != null">reason,</if>
<if test="gmtCreate != null">gmt_create,</if>
<if test="gmtModified != null">gmt_modified,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="doudianMessageId != null">#{doudianMessageId,jdbcType=BIGINT},</if>
<if test="msgId != null">#{msgId,jdbcType=VARCHAR},</if>
<if test="shopId != null">#{shopId,jdbcType=BIGINT},</if>
<if test="tag != null">#{tag,jdbcType=SMALLINT},</if>
<if test="data != null">#{data,jdbcType=VARCHAR},</if>
<if test="status != null">#{status,jdbcType=VARCHAR},</if>
<if test="reason != null">#{reason,jdbcType=VARCHAR},</if>
<if test="gmtCreate != null">#{gmtCreate,jdbcType=TIMESTAMP},</if>
<if test="gmtModified != null">#{gmtModified,jdbcType=TIMESTAMP},</if>
</trim>
ON DUPLICATE KEY UPDATE
<trim suffixOverrides=",">
<if test="msgId != null">
msg_id = #{msgId,jdbcType=VARCHAR},
</if>
<if test="shopId != null">
shop_id = #{shopId,jdbcType=BIGINT},
</if>
<if test="tag != null">
tag = #{tag,jdbcType=SMALLINT},
</if>
<if test="data != null">
data = #{data,jdbcType=VARCHAR},
</if>
<if test="status != null">
status = #{status,jdbcType=VARCHAR},
</if>
<if test="reason != null">
reason = #{reason,jdbcType=VARCHAR},
</if>
<if test="gmtCreate != null">
gmt_create = #{gmtCreate,jdbcType=TIMESTAMP},
</if>
<if test="gmtModified != null">
gmt_modified = #{gmtModified,jdbcType=TIMESTAMP},
</if>
</trim>
</update>
<insert id="insertSelective" keyColumn="doudian_message_id" keyProperty="doudianMessageId" parameterType="com.ms.dal.entity.DoudianMessage" useGeneratedKeys="true">
insert into doudian_message
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="doudianMessageId != null">doudian_message_id,</if>
<if test="msgId != null">msg_id,</if>
<if test="shopId != null">shop_id,</if>
<if test="tag != null">tag,</if>
<if test="data != null">data,</if>
<if test="status != null">status,</if>
<if test="reason != null">reason,</if>
<if test="gmtCreate != null">gmt_create,</if>
<if test="gmtModified != null">gmt_modified,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="doudianMessageId != null">#{doudianMessageId,jdbcType=BIGINT},</if>
<if test="msgId != null">#{msgId,jdbcType=VARCHAR},</if>
<if test="shopId != null">#{shopId,jdbcType=BIGINT},</if>
<if test="tag != null">#{tag,jdbcType=SMALLINT},</if>
<if test="data != null">#{data,jdbcType=VARCHAR},</if>
<if test="status != null">#{status,jdbcType=VARCHAR},</if>
<if test="reason != null">#{reason,jdbcType=VARCHAR},</if>
<if test="gmtCreate != null">#{gmtCreate,jdbcType=TIMESTAMP},</if>
<if test="gmtModified != null">#{gmtModified,jdbcType=TIMESTAMP},</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.ms.dal.entity.DoudianMessage">
update doudian_message
<set>
<if test="msgId != null">
msg_id = #{msgId,jdbcType=VARCHAR},
</if>
<if test="shopId != null">
shop_id = #{shopId,jdbcType=BIGINT},
</if>
<if test="tag != null">
tag = #{tag,jdbcType=SMALLINT},
</if>
<if test="data != null">
data = #{data,jdbcType=VARCHAR},
</if>
<if test="status != null">
status = #{status,jdbcType=VARCHAR},
</if>
<if test="reason != null">
reason = #{reason,jdbcType=VARCHAR},
</if>
<if test="gmtCreate != null">
gmt_create = #{gmtCreate,jdbcType=TIMESTAMP},
</if>
<if test="gmtModified != null">
gmt_modified = #{gmtModified,jdbcType=TIMESTAMP},
</if>
</set>
where doudian_message_id = #{doudianMessageId,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="com.ms.dal.entity.DoudianMessage">
update doudian_message
set
msg_id = #{msgId,jdbcType=VARCHAR},
shop_id = #{shopId,jdbcType=BIGINT},
tag = #{tag,jdbcType=SMALLINT},
data = #{data,jdbcType=VARCHAR},
status = #{status,jdbcType=VARCHAR},
reason = #{reason,jdbcType=VARCHAR},
gmt_create = #{gmtCreate,jdbcType=TIMESTAMP},
gmt_modified = #{gmtModified,jdbcType=TIMESTAMP}
where doudian_message_id = #{doudianMessageId,jdbcType=BIGINT}
</update>
<insert id="insertBatch" keyColumn="doudian_message_id" keyProperty="doudianMessageId" useGeneratedKeys="true">
insert into doudian_message
(doudian_message_id,msg_id,shop_id
,tag,data,status
,reason,gmt_create,gmt_modified)
values
<foreach item="item" collection="list" separator="," >
(#{item.doudianMessageId,jdbcType=BIGINT},#{msgId,jdbcType=VARCHAR},#{item.shopId,jdbcType=BIGINT}
,#{item.tag,jdbcType=SMALLINT},#{item.data,jdbcType=VARCHAR},#{item.status,jdbcType=VARCHAR}
,#{item.reason,jdbcType=VARCHAR},#{item.gmtCreate,jdbcType=TIMESTAMP},#{item.gmtModified,jdbcType=TIMESTAMP}
)
</foreach>
</insert>
</mapper>

@ -28,7 +28,7 @@
gmt_modified
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from platform_purchase_order
@ -52,7 +52,7 @@
</choose>
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
delete from platform_purchase_order
where pur_order_id = #{purOrderId,jdbcType=VARCHAR}
</delete>

@ -22,20 +22,20 @@
<sql id="Base_Column_List">
pur_sku_order_id,pur_order_id,shop_id,
sku_order_id,out_product_id,out_sku_id,
sku_order_id,outer_product_id,outer_sku_id,
cargo_id,cargo_sku_id,product_id,
sku_id,num,gmt_create,
gmt_modified
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from platform_purchase_order_sku
where pur_sku_order_id = #{purSkuOrderId,jdbcType=VARCHAR}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
delete from platform_purchase_order_sku
where pur_sku_order_id = #{purSkuOrderId,jdbcType=VARCHAR}
</delete>
@ -97,10 +97,10 @@
sku_order_id = #{skuOrderId,jdbcType=VARCHAR},
</if>
<if test="outProductId != null">
out_product_id = #{outProductId,jdbcType=VARCHAR},
outer_product_id = #{outProductId,jdbcType=VARCHAR},
</if>
<if test="outSkuId != null">
out_sku_id = #{outSkuId,jdbcType=VARCHAR},
outer_sku_id = #{outSkuId,jdbcType=VARCHAR},
</if>
<if test="cargoId != null">
cargo_id = #{cargoId,jdbcType=BIGINT},

@ -213,7 +213,7 @@
values
<foreach item="item" collection="list" separator="," >
(#{item.purchaseOrderItemId,jdbcType=BIGINT},#{item.purchaseOrderId,jdbcType=BIGINT},#{item.orderId,jdbcType=BIGINT}
,#{purOrderId,jdbcType=VARCHAR},#{item.wareId,jdbcType=BIGINT},#{item.skuId,jdbcType=BIGINT},#{item.purchaseUrl,jdbcType=VARCHAR}
,#{item.purOrderId,jdbcType=VARCHAR},#{item.wareId,jdbcType=BIGINT},#{item.skuId,jdbcType=BIGINT},#{item.purchaseUrl,jdbcType=VARCHAR}
,#{item.purchasePrice,jdbcType=DECIMAL},#{item.purchaseNum,jdbcType=SMALLINT},#{item.status,jdbcType=VARCHAR}
,#{item.gmtCreate,jdbcType=TIMESTAMP},#{item.gmtModified,jdbcType=TIMESTAMP})
</foreach>

@ -49,6 +49,12 @@
from purchase_order
where purchase_order_sn = #{purchaseOrderSn,jdbcType=VARCHAR}
</select>
<select id="getByPurOrderId" resultType="com.ms.dal.entity.PurchaseOrder">
select
<include refid="Base_Column_List" />
from purchase_order
where pur_order_id = #{purOrderId,jdbcType=VARCHAR}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete from purchase_order
@ -324,7 +330,7 @@
,gmt_modified)
values
<foreach item="item" collection="list" separator="," >
(#{item.purchaseOrderId,jdbcType=BIGINT},#{item.orderId,jdbcType=BIGINT},#{item.purchasePlatform,jdbcType=VARCHAR},#{purOrderId,jdbcType=VARCHAR}
(#{item.purchaseOrderId,jdbcType=BIGINT},#{item.orderId,jdbcType=BIGINT},#{item.purchasePlatform,jdbcType=VARCHAR},#{item.purOrderId,jdbcType=VARCHAR}
,#{item.purchaseOrderSn,jdbcType=VARCHAR},#{item.purchaseOrderBuyer,jdbcType=VARCHAR},#{item.purchaseOrderSeller,jdbcType=VARCHAR}
,#{item.purchaseOrderPayment,jdbcType=DECIMAL},#{item.purchaseOrderStatus,jdbcType=VARCHAR},#{item.purchaseOrderLogisticsName,jdbcType=VARCHAR}
,#{item.purchaseOrderWaybillCode,jdbcType=VARCHAR},#{item.purchaseOrderSendTime,jdbcType=TIMESTAMP},#{item.purchaseOrderFullname,jdbcType=VARCHAR}

@ -37,6 +37,7 @@ public class OpenSPIController {
private final DoudianOpSpiBizHandler querySupplyPlatformAuthBizHandler = context -> {
QuerySupplyPlatformAuthParam param = context.getParam();
System.out.println("param" + param);
QuerySupplyPlatformAuthData data = context.getData();
try {
shopService.querySupplyPlatformAuth(param, data);
@ -55,6 +56,7 @@ public class OpenSPIController {
private final DoudianOpSpiBizHandler batchCreateBizHandler = context -> {
BatchCreateParam param = context.getParam();
System.out.println("param" + param);
BatchCreateData data = context.getData();
try {
distributionOrderService.batchCreate(param, data);
@ -68,6 +70,7 @@ public class OpenSPIController {
@RequestMapping(path = "supplyCenter/order/batchPay" , method = {RequestMethod.POST})
@ResponseBody
public String batchPay(HttpServletRequest httpServletRequest) {
System.out.println(httpServletRequest);
return DoudianOpSpi.config(BatchCreateRequest.class, batchPayBizHandler, httpServletRequest).responseJson();
}

@ -14,9 +14,15 @@ import com.ms.api.dto.dsapi.response.GetSourceItemInfosResponseDTO;
import com.ms.biz.common.R;
import com.ms.biz.common.Ret;
import com.ms.api.dto.dsorder.DsMessageCallbackDTO;
import com.ms.biz.dto.openspi.request.BatchCreateParam;
import com.ms.biz.dto.openspi.request.BatchPayParam;
import com.ms.biz.dto.openspi.response.BatchCreateData;
import com.ms.biz.dto.openspi.response.BatchPayData;
import com.ms.biz.dto.openspi.response.QuerySupplyPlatformAuthData;
import com.ms.biz.service.*;
import com.ms.biz.tool.CommonTool;
import com.ms.biz.util.DDApi;
import com.ms.dal.entity.DsMessageConsumerQueue;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.apache.http.client.utils.DateUtils;
@ -52,6 +58,12 @@ public class Test {
@Autowired
private DsApiService dsApiService;
@Autowired
private DistributionOrderService distributionOrderService;
@Autowired
private DsMessageConsumerQueueService dsMessageConsumerQueueService;
@GetMapping("/hello")
public String hello(@RequestParam(value = "name", defaultValue = "World") String name) {
return String.format("Hello %s!", name);
@ -99,6 +111,22 @@ public class Test {
}
public static void main(String[] args) throws ParseException {
Long value = 1L;
Date date = new Date();
SimpleDateFormat dateFormat1 = new SimpleDateFormat("yyyyMMddhhmm00");
System.out.println(dateFormat1.format(date) + String.format("%1$04d", value));
String d = "{\"orders\":[{\"pur_order_id\":\"7299756498531418412\",\"order_id\":\"6917543139367389081\",\"post_address\":{\"province\":{\"id\":\"11\",\"name\":\"北京市\"},\"city\":{\"id\":\"110000\",\"name\":\"北京市\"},\"town\":{\"id\":\"110108\",\"name\":\"海淀区\"},\"street\":{\"id\":\"110108012\",\"name\":\"海淀街道\"},\"encrypt_detail\":\"MC8EEAjx7GdmeypB6WkV9DrpH9sEGWv8lSI1N1i9SaxcxKw1aW4waq481ueqVRcEAA==\",\"post_tel\":\"MCEEEDyPE4U3H7NDrnVhSgGOPzsEC9mVHEzJYMyY91uJBAA=\",\"post_receiver\":\"MCgEEHlttu0OuRqxJ3AaFAEvpr8EEjMU+9kRHPkU+MiXyD4zIkdVMgQA\"},\"mask_post_address\":{\"province\":{\"id\":\"11\",\"name\":\"北京市\"},\"city\":{\"id\":\"110000\",\"name\":\"北京市\"},\"town\":{\"id\":\"110108\",\"name\":\"海淀区\"},\"street\":{\"id\":\"110108012\",\"name\":\"海淀街道\"},\"detail\":\"互联*******\",\"post_tel\":\"1********00\",\"post_receiver\":\"电*****\"},\"sku_orders\":[{\"pur_sku_order_id\":\"7299756498531451180\",\"sku_order_id\":\"6917543139367389081\",\"cargo_id\":3649687424122130945,\"cargo_sku_id\":3659175936152832,\"product_id\":3649883085652281308,\"sku_id\":3659175955997568,\"num\":1,\"outer_product_id\":\"686872273204\",\"outer_sku_id\":\"4897420288982\"}]}],\"shop_id\":1111502210}";
System.out.println(JSON.parseObject(d));
QuerySupplyPlatformAuthData data = new QuerySupplyPlatformAuthData();
data.setAuthUrl("abc");
data.setAuthorized(false);
System.out.println(JSON.toJSONString(data));
System.out.println(JSON.parseObject(JSON.toJSONString(data)));
String str = "{\"data\":\"{\\\"activity_id\\\":\\\"0\\\",\\\"after\\\":\\\"false\\\",\\\"before\\\":\\\"true\\\",\\\"channel_id\\\":\\\"0\\\",\\\"channel_type\\\":0,\\\"process_time\\\":1699455945,\\\"product_id\\\":\\\"3649553844716833566\\\",\\\"shop_id\\\":\\\"121233657\\\",\\\"sku_id\\\":\\\"3384401776121602\\\"}\",\"tag\":\"420\",\"msg_id\":\"66533861744835594630:0:420:1699455945:2560971988:7264840234423027259\"}";
DoudianMessage msg = JSON.parseObject(str, DoudianMessage.class);
System.out.println(msg);
@ -162,22 +190,22 @@ public class Test {
}
@PostMapping("/getAuthInfo")
public String getAuthInfo() {
GetAuthInfoResponseDTO responseDTO = dsApiService.getAuthInfo(30459766L);
public String getAuthInfo() { // 30459766L
GetAuthInfoResponseDTO responseDTO = dsApiService.getAuthInfo(1111502210L);
System.out.println(responseDTO);
return "";
}
@PostMapping("/getAuthShopMemberInfos")
public String getAuthShopMemberInfos() {
GetAuthShopMemberInfosResponseDTO responseDTO = dsApiService.getAuthShopMemberInfos(30459766L);
GetAuthShopMemberInfosResponseDTO responseDTO = dsApiService.getAuthShopMemberInfos(1111502210L);
System.out.println(responseDTO);
return "";
}
@PostMapping("/checkDsAppAuthExpire")
public String checkDsAppAuthExpire() {
CheckDsAppAuthExpireResponseDTO responseDTO = dsApiService.checkDsAppAuthExpire(4463798L, "b2b-221123084407697b20", "");
CheckDsAppAuthExpireResponseDTO responseDTO = dsApiService.checkDsAppAuthExpire(16412356L, "", "");
System.out.println(responseDTO);
return "";
}
@ -197,4 +225,36 @@ public class Test {
System.out.println(responseDTO);
return "";
}
@RequestMapping("/ttt")
public String ttt() {
String d = "{\"orders\":[{\"pur_order_id\":\"7299756498531418412\",\"order_id\":\"6917543139367389081\",\"post_address\":{\"province\":{\"id\":\"11\",\"name\":\"北京市\"},\"city\":{\"id\":\"110000\",\"name\":\"北京市\"},\"town\":{\"id\":\"110108\",\"name\":\"海淀区\"},\"street\":{\"id\":\"110108012\",\"name\":\"海淀街道\"},\"encrypt_detail\":\"MC8EEAjx7GdmeypB6WkV9DrpH9sEGWv8lSI1N1i9SaxcxKw1aW4waq481ueqVRcEAA==\",\"post_tel\":\"MCEEEDyPE4U3H7NDrnVhSgGOPzsEC9mVHEzJYMyY91uJBAA=\",\"post_receiver\":\"MCgEEHlttu0OuRqxJ3AaFAEvpr8EEjMU+9kRHPkU+MiXyD4zIkdVMgQA\"},\"mask_post_address\":{\"province\":{\"id\":\"11\",\"name\":\"北京市\"},\"city\":{\"id\":\"110000\",\"name\":\"北京市\"},\"town\":{\"id\":\"110108\",\"name\":\"海淀区\"},\"street\":{\"id\":\"110108012\",\"name\":\"海淀街道\"},\"detail\":\"互联*******\",\"post_tel\":\"1********00\",\"post_receiver\":\"电*****\"},\"sku_orders\":[{\"pur_sku_order_id\":\"7299756498531451180\",\"sku_order_id\":\"6917543139367389081\",\"cargo_id\":3649687424122130945,\"cargo_sku_id\":3659175936152832,\"product_id\":3649883085652281308,\"sku_id\":3659175955997568,\"num\":1,\"outer_product_id\":\"686872273204\",\"outer_sku_id\":\"4897420288982\"}]}],\"shop_id\":1111502210}";
BatchCreateParam param = JSON.parseObject(d, BatchCreateParam.class);
BatchCreateData data = new BatchCreateData();
distributionOrderService.batchCreate(param, data);
return "";
}
@RequestMapping("/batchPay")
public String batchPay() {
String d = "{\"params\":{\"pur_order_id\":\"7299756498531418412\"},\"shop_id\":1111502210}";
BatchPayParam param = JSON.parseObject(d, BatchPayParam.class);
BatchPayData data = new BatchPayData();
distributionOrderService.batchPay(param, data);
return "";
}
@RequestMapping("/moveMsg")
public String moveMsg() {
dsMessageConsumerQueueService.moveBufferToSolidRedisQueue(2000);
return "";
}
@RequestMapping("/consumeMsg")
public String consumeMsg() {
DsMessageConsumerQueue queue = dsMessageConsumerQueueService.lockSolidRedisQueue(0L, false);
dsMessageService.processDsMessage(queue.getDsMessageId());
return "";
}
}

Loading…
Cancel
Save