修改bug

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

@ -20,6 +20,7 @@ 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.biz.tool.SecurityTool;
import com.ms.biz.util.DDApi;
import com.ms.dal.entity.*;
import com.ms.dal.mapper.*;
@ -159,6 +160,7 @@ public class DistributionOrderServiceImpl implements DistributionOrderService {
item.setOrderId(Long.valueOf(purchaseOrderDTO.getPlatformOrderId()));
item.setPurchaseNum(itemDTO.getPurchaseNum());
item.setSkuId(itemDTO.getSkuId());
item.setSubItemId(itemDTO.getSubItemId() == null ? "" : itemDTO.getSubItemId());
item.setWareId(itemDTO.getWareId());
item.setPurchaseUrl(itemDTO.getPurchaseUrl() == null ? "" : itemDTO.getPurchaseUrl());
item.setPurchasePrice(BigDecimal.valueOf(0));
@ -381,7 +383,7 @@ public class DistributionOrderServiceImpl implements DistributionOrderService {
platformOrder.setSourceOrderBuyerRemark("");
platformOrder.setSourceOrderSellerMemo("");
platformOrder.setBuyerRemark("");
platformOrder.setUserId(shopId.toString());
platformOrder.setUserId(SecurityTool.encodeByAES(String.valueOf(shopId)));
platformOrder.setConsigneeInfo(consigneeInfo);
platformOrder.setEncryptOutOrderInfo(encryptOutOrderInfo);
platformOrder.setItems(items);

@ -360,7 +360,7 @@ public class DsMessageServiceImpl implements DsMessageService {
} 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;
operateType = 5;
}
return operateType;
}
@ -380,6 +380,7 @@ public class DsMessageServiceImpl implements DsMessageService {
private void handlePurchaseOrderRelate(PurchaseOrderRelateMessageDTO messageDTO) {
PurchaseOrderDTO purchaseOrderDTO = messageDTO.getPurchaseOrderInfo();
PurchaseOrder purchaseOrder = purchaseOrderMapper.getByPurchaseOrderSn(purchaseOrderDTO.getPurchaseOrderSn());
List<PurchaseOrderItem> purchaseOrderItems = purchaseOrderItemMapper.getListByPurchaseOrderId(purchaseOrder.getPurchaseOrderId());
List<PlatformPurchaseOrderSku> platformPurchaseOrderSkus = platformPurchaseOrderSkuMapper.getListByPurOrderIds(Collections.singletonList(purchaseOrder.getPurOrderId()));
Map<Long, PlatformPurchaseOrderSku> skuIdAndPlatformPurchaseOrderSkuMap = platformPurchaseOrderSkus.stream().collect(Collectors.toMap(PlatformPurchaseOrderSku::getSkuId, x->x));
@ -393,15 +394,24 @@ public class DsMessageServiceImpl implements DsMessageService {
supplierOrderUrl.setPcUrl(url);
param.setSupplierOrderUrl(supplierOrderUrl);
List<SkuOrdersItem> skuOrders = new ArrayList<>();
Map<Long, String> skuIdAndSubItemIdMap = new HashMap<>();
for (PurchaseOrderItemDTO item: purchaseOrderDTO.getItems()) {
PlatformPurchaseOrderSku platformPurchaseOrderSku = skuIdAndPlatformPurchaseOrderSkuMap.get(item.getSkuId());
SkuOrdersItem skuOrdersItem = new SkuOrdersItem();
skuOrdersItem.setPurSkuOrderId(platformPurchaseOrderSku.getPurSkuOrderId());
skuOrdersItem.setSupplierSkuOrderId(item.getSubItemId());
skuIdAndSubItemIdMap.put(item.getSkuId(), item.getSubItemId());
skuOrders.add(skuOrdersItem);
}
param.setSkuOrders(skuOrders);
for (PurchaseOrderItem item: purchaseOrderItems) {
if (skuIdAndSubItemIdMap.containsKey(item.getSkuId())) {
item.setSubItemId(skuIdAndSubItemIdMap.get(item.getSkuId()));
purchaseOrderItemMapper.updateByPrimaryKeySelective(item);
}
}
DDApi.supplyCenterOrderSyncSupplierInfo(param);
}
}

@ -28,8 +28,11 @@ public class BatchCreateService extends SPIBaseService implements ExtensionServi
BatchCreateData data = new BatchCreateData();
distributionOrderService.batchCreate(param, data);
return BaseResponse.<JSONObject>builder().success(true).message("success").code("0").data(JSON.parseObject(JSON.toJSONString(data))).build();
} catch (Exception e) {
} catch (RuntimeException e) {
return BaseResponse.<JSONObject>builder().success(true).message(e.getMessage()).code("100003").build();
} catch (Throwable e) {
log.error("batchCreate error", e);
return BaseResponse.<JSONObject>builder().success(true).message("系统异常").code("100003").build();
}
}
}

@ -28,8 +28,11 @@ public class BatchPayService extends SPIBaseService implements ExtensionServiceH
BatchPayData data = new BatchPayData();
distributionOrderService.batchPay(param, data);
return BaseResponse.<JSONObject>builder().success(true).message("success").code("0").data(JSON.parseObject(JSON.toJSONString(data))).build();
} catch (Exception e) {
} catch (RuntimeException e) {
return BaseResponse.<JSONObject>builder().success(true).message(e.getMessage()).code("100003").build();
} catch (Throwable e) {
log.error("batchPay error", e);
return BaseResponse.<JSONObject>builder().success(true).message("系统异常").code("100003").build();
}
}
}

@ -27,8 +27,11 @@ public class QuerySupplyPlatformAuthService extends SPIBaseService implements Ex
QuerySupplyPlatformAuthData data = new QuerySupplyPlatformAuthData();
shopService.querySupplyPlatformAuth(param, data);
return BaseResponse.<JSONObject>builder().success(true).message("success").code("0").data(JSON.parseObject(JSON.toJSONString(data))).build();
} catch (Exception e) {
} catch (RuntimeException e) {
return BaseResponse.<JSONObject>builder().success(true).message(e.getMessage()).code("100003").build();
} catch (Throwable e) {
log.error("querySupplyPlatformAuth error", e);
return BaseResponse.<JSONObject>builder().success(true).message("系统异常").code("100003").build();
}
}
}

@ -28,6 +28,11 @@ public class PurchaseOrderItem implements Serializable {
*/
private String purOrderId;
/**
*
*/
private String subItemId;
/**
* id
*/

@ -25,7 +25,10 @@ public interface PurchaseOrderItemMapper {
int updateByPrimaryKeySelective(PurchaseOrderItem record);
int updateByPrimaryKey(PurchaseOrderItem record);
int insertBatch(List<PurchaseOrderItem> list);
int updateStatusByPurchaseOrderIds(@Param("status") String status, @Param("purchaseOrderIds") List<Long> purchaseOrderIds);
List<PurchaseOrderItem> getListByPurchaseOrderId(@Param("purchaseOrderId") Long purchaseOrderId);
}

@ -8,6 +8,7 @@
<id property="purchaseOrderItemId" column="purchase_order_item_id" jdbcType="BIGINT"/>
<result property="purchaseOrderId" column="purchase_order_id" jdbcType="BIGINT"/>
<result property="purOrderId" column="pur_order_id" jdbcType="VARCHAR"/>
<result property="subItemId" column="sub_item_id" jdbcType="VARCHAR"/>
<result property="orderId" column="order_id" jdbcType="BIGINT"/>
<result property="wareId" column="ware_id" jdbcType="BIGINT"/>
<result property="skuId" column="sku_id" jdbcType="BIGINT"/>
@ -21,7 +22,7 @@
<sql id="Base_Column_List">
purchase_order_item_id,purchase_order_id,pur_order_id,
order_id,ware_id,sku_id,
sub_item_id,order_id,ware_id,sku_id,
purchase_url,purchase_price,purchase_num,
status,gmt_create,gmt_modified
</sql>
@ -32,6 +33,12 @@
from purchase_order_item
where purchase_order_item_id = #{purchaseOrderItemId,jdbcType=BIGINT}
</select>
<select id="getListByPurchaseOrderId" resultType="com.ms.dal.entity.PurchaseOrderItem">
select
<include refid="Base_Column_List" />
from purchase_order_item
where purchase_order_id = #{purchaseOrderId,jdbcType=BIGINT}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete from purchase_order_item
@ -40,12 +47,12 @@
<insert id="insert" keyColumn="purchase_order_item_id" keyProperty="purchaseOrderItemId" parameterType="com.ms.dal.entity.PurchaseOrderItem" useGeneratedKeys="true">
insert into purchase_order_item
( purchase_order_item_id,purchase_order_id,pur_order_id
,order_id,ware_id,sku_id
,sub_item_id,order_id,ware_id,sku_id
,purchase_url,purchase_price,purchase_num
,status,gmt_create,gmt_modified
)
values (#{purchaseOrderItemId,jdbcType=BIGINT},#{purchaseOrderId,jdbcType=BIGINT},#{purOrderId,jdbcType=VARCHAR}
,#{orderId,jdbcType=BIGINT},#{wareId,jdbcType=BIGINT},#{skuId,jdbcType=BIGINT}
,#{subItemId,jdbcType=VARCHAR},#{orderId,jdbcType=BIGINT},#{wareId,jdbcType=BIGINT},#{skuId,jdbcType=BIGINT}
,#{purchaseUrl,jdbcType=VARCHAR},#{purchasePrice,jdbcType=DECIMAL},#{purchaseNum,jdbcType=SMALLINT}
,#{status,jdbcType=VARCHAR},#{gmtCreate,jdbcType=TIMESTAMP},#{gmtModified,jdbcType=TIMESTAMP}
)
@ -57,6 +64,7 @@
<if test="purchaseOrderItemId != null">purchase_order_item_id,</if>
<if test="purchaseOrderId != null">purchase_order_id,</if>
<if test="purOrderId != null">pur_order_id,</if>
<if test="subItemId != null">sub_item_id,</if>
<if test="orderId != null">order_id,</if>
<if test="wareId != null">ware_id,</if>
<if test="skuId != null">sku_id,</if>
@ -71,6 +79,7 @@
<if test="purchaseOrderItemId != null">#{purchaseOrderItemId,jdbcType=BIGINT},</if>
<if test="purchaseOrderId != null">#{purchaseOrderId,jdbcType=BIGINT},</if>
<if test="purOrderId != null">#{purOrderId,jdbcType=VARCHAR},</if>
<if test="subItemId != null">#{subItemId,jdbcType=VARCHAR},</if>
<if test="orderId != null">#{orderId,jdbcType=BIGINT},</if>
<if test="wareId != null">#{wareId,jdbcType=BIGINT},</if>
<if test="skuId != null">#{skuId,jdbcType=BIGINT},</if>
@ -89,6 +98,9 @@
<if test="purOrderId != null">
pur_order_id = #{purOrderId,jdbcType=VARCHAR},
</if>
<if test="subItemId != null">
sub_item_id = #{subItemId,jdbcType=VARCHAR},
</if>
<if test="orderId != null">
order_id = #{orderId,jdbcType=BIGINT},
</if>
@ -124,6 +136,7 @@
<if test="purchaseOrderItemId != null">purchase_order_item_id,</if>
<if test="purchaseOrderId != null">purchase_order_id,</if>
<if test="purOrderId != null">pur_order_id,</if>
<if test="subItemId != null">sub_item_id,</if>
<if test="orderId != null">order_id,</if>
<if test="wareId != null">ware_id,</if>
<if test="skuId != null">sku_id,</if>
@ -138,6 +151,7 @@
<if test="purchaseOrderItemId != null">#{purchaseOrderItemId,jdbcType=BIGINT},</if>
<if test="purchaseOrderId != null">#{purchaseOrderId,jdbcType=BIGINT},</if>
<if test="purOrderId != null">#{purOrderId,jdbcType=VARCHAR},</if>
<if test="subItemId != null">#{subItemId,jdbcType=VARCHAR},</if>
<if test="orderId != null">#{orderId,jdbcType=BIGINT},</if>
<if test="wareId != null">#{wareId,jdbcType=BIGINT},</if>
<if test="skuId != null">#{skuId,jdbcType=BIGINT},</if>
@ -158,6 +172,9 @@
<if test="purOrderId != null">
pur_order_id = #{purOrderId,jdbcType=VARCHAR},
</if>
<if test="subItemId != null">
sub_item_id = #{subItemId,jdbcType=VARCHAR},
</if>
<if test="orderId != null">
order_id = #{orderId,jdbcType=BIGINT},
</if>
@ -193,6 +210,7 @@
set
purchase_order_id = #{purchaseOrderId,jdbcType=BIGINT},
pur_order_id = #{purOrderId,jdbcType=VARCHAR},
sub_item_id = #{subItemId,jdbcType=VARCHAR},
order_id = #{orderId,jdbcType=BIGINT},
ware_id = #{wareId,jdbcType=BIGINT},
sku_id = #{skuId,jdbcType=BIGINT},
@ -206,13 +224,13 @@
</update>
<insert id="insertBatch" keyColumn="purchase_order_item_id" keyProperty="purchaseOrderItemId" useGeneratedKeys="true">
insert into purchase_order_item
(purchase_order_item_id,purchase_order_id,order_id
,pur_order_id,ware_id,sku_id,purchase_url
(purchase_order_item_id,purchase_order_id,sub_item_id
,order_id,pur_order_id,ware_id,sku_id,purchase_url
,purchase_price,purchase_num,status
,gmt_create,gmt_modified)
values
<foreach item="item" collection="list" separator="," >
(#{item.purchaseOrderItemId,jdbcType=BIGINT},#{item.purchaseOrderId,jdbcType=BIGINT},#{item.orderId,jdbcType=BIGINT}
(#{item.purchaseOrderItemId,jdbcType=BIGINT},#{item.purchaseOrderId,jdbcType=BIGINT},#{item.subItemId,jdbcType=VARCHAR},#{item.orderId,jdbcType=BIGINT}
,#{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})

@ -226,8 +226,8 @@ public class Test {
return "";
}
@RequestMapping("/ttt")
public String ttt() {
@RequestMapping("/batchCreate")
public String batchCreate() {
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();

Loading…
Cancel
Save