|
@@ -10,15 +10,13 @@ import com.alibaba.fastjson.serializer.SerializeConfig;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
|
|
|
import com.fs.erp.converter.ErpWdtToErpOrderMapper;
|
|
|
import com.fs.erp.domain.ErpOrder;
|
|
|
+import com.fs.erp.domain.ErpOrderQuery;
|
|
|
import com.fs.erp.domain.ErpRefundOrder;
|
|
|
import com.fs.erp.dto.*;
|
|
|
import com.fs.erp.dto.sdk.wangdian.api.WdtClient;
|
|
|
import com.fs.erp.dto.sdk.wangdian.enums.*;
|
|
|
import com.fs.erp.dto.wdt.*;
|
|
|
import com.fs.erp.service.IErpOrderService;
|
|
|
-import com.fs.his.config.FsErpConfig;
|
|
|
-import com.fs.his.config.FsSysConfig;
|
|
|
-import com.fs.his.utils.ConfigUtil;
|
|
|
import com.fs.store.domain.FsStoreOrder;
|
|
|
import com.fs.store.domain.FsStoreProduct;
|
|
|
import com.fs.store.service.IFsStoreOrderItemService;
|
|
@@ -56,11 +54,11 @@ public class WdtErpOrderServiceImpl implements IErpOrderService {
|
|
|
@Autowired
|
|
|
private IFsStoreProductService fsStoreProductService;
|
|
|
|
|
|
-// @Value("${fsConfig.erpWdShopCode}")
|
|
|
-// private String shopCode;
|
|
|
+ @Value("${fsConfig.erpWdShopCode}")
|
|
|
+ private String shopCode;
|
|
|
|
|
|
@Autowired
|
|
|
- ConfigUtil configUtil;
|
|
|
+ private WdtClient client;
|
|
|
|
|
|
/**
|
|
|
* 普通推送
|
|
@@ -72,20 +70,369 @@ public class WdtErpOrderServiceImpl implements IErpOrderService {
|
|
|
private static final Integer REFUND_TYPE = 2;
|
|
|
@Override
|
|
|
public ErpOrderResponse addOrder(ErpOrder order) {
|
|
|
- return getErpOrderResponse(order,NORMAL_TYPE);
|
|
|
+// if(order.getIsPackage()!=null && order.getIsPackage() == 1){
|
|
|
+// return getErpPackageOrderResponse(order);
|
|
|
+// }
|
|
|
+ return getErpOrderResponse(order);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- *
|
|
|
+ * 获取erp推送参数
|
|
|
* @param order 订单参数
|
|
|
- * @param type 1正常 2退款
|
|
|
* @return
|
|
|
*/
|
|
|
- private ErpOrderResponse getErpOrderResponse(ErpOrder order,Integer type) {
|
|
|
- FsErpConfig erpConfig = configUtil.getErpConfig();
|
|
|
- String shopCode = erpConfig.getErpWdShopCode();
|
|
|
+ private ErpOrderResponse getErpOrderResponse(ErpOrder order) {
|
|
|
+ //测试环境sid、appkey、密钥请到旺店通开放平台-自助对接-申请测试环境内查看,测试环境url=https://sandbox.wangdian.cn/openapi2/
|
|
|
+ //调用正式环境时请将sid、appkey、appsecret切换为实际参数,参数在旺店通开放平台-自助对接-应用管理内应用状态为已上线的应用中查看,调用正式环境注意切换正式环境url=https://api.wangdian.cn/openapi2/
|
|
|
+
|
|
|
+ ErpWdtBusinessRequestParams erpWdtBusinessRequestParams = new ErpWdtBusinessRequestParams();
|
|
|
+ erpWdtBusinessRequestParams.setShopNo(shopCode);
|
|
|
+ erpWdtBusinessRequestParams.setSwitchMode(0);
|
|
|
+ ErpWdtTrade erpWdtTrade = new ErpWdtTrade();
|
|
|
+ FsStoreOrder fsStoreOrder = fsStoreOrderService.selectFsStoreOrderByOrderCode(order.getPlatform_code());
|
|
|
+ BigDecimal couponPrice = fsStoreOrder.getCouponPrice();
|
|
|
|
|
|
- WdtClient client = WdtClient.getInstance();
|
|
|
+ // 平台状态
|
|
|
+ erpWdtTrade.setTradeStatus(TradeStatus.PAID_WAITING_FOR_SHIPMENT.getValue());
|
|
|
+
|
|
|
+ // 订单id
|
|
|
+ erpWdtTrade.setTid(order.getPlatform_code());
|
|
|
+
|
|
|
+
|
|
|
+ // 如果是货到付款
|
|
|
+ if("2".equals(fsStoreOrder.getPayType())){
|
|
|
+ // 支付状态
|
|
|
+ erpWdtTrade.setPayStatus(PaymentStatus.PARTIALLY_PAID.getValue());
|
|
|
+ // 发货条件
|
|
|
+ erpWdtTrade.setDeliveryTerm(DeliveryTerm.CASH_ON_DELIVERY.getValue());
|
|
|
+ // 货到付款金额 = 物流代收金额-优惠金额
|
|
|
+ erpWdtTrade.setCodAmount(fsStoreOrder.getPayDelivery().subtract(couponPrice));
|
|
|
+
|
|
|
+ } else if("3".equals(fsStoreOrder.getPayType())){
|
|
|
+ // 支付状态
|
|
|
+ erpWdtTrade.setPayStatus(PaymentStatus.UNPAID.getValue());
|
|
|
+ // 发货条件
|
|
|
+ erpWdtTrade.setDeliveryTerm(DeliveryTerm.CASH_ON_DELIVERY.getValue());
|
|
|
+ // 货到付款金额 = 物流代收金额-优惠金额
|
|
|
+ erpWdtTrade.setCodAmount(fsStoreOrder.getPayDelivery().subtract(couponPrice));
|
|
|
+ } else { // 如果是线上付款
|
|
|
+ // 支付状态
|
|
|
+ erpWdtTrade.setPayStatus(PaymentStatus.FULLY_PAID.getValue());
|
|
|
+ // 发货条件
|
|
|
+ erpWdtTrade.setDeliveryTerm(DeliveryTerm.PAYMENT_BEFORE_DELIVERY.getValue());
|
|
|
+ }
|
|
|
+
|
|
|
+ // 下单时间
|
|
|
+ erpWdtTrade.setTradeTime(order.getDeal_datetime());
|
|
|
+ // 支付时间
|
|
|
+ erpWdtTrade.setPayTime(order.getDeal_datetime());
|
|
|
+ // 分销类别
|
|
|
+ erpWdtTrade.setFenxiaoType(FenxiaoType.JINGXIAO.getValue());
|
|
|
+ // 客户网名
|
|
|
+ erpWdtTrade.setBuyerNick(order.getReceiver_name());
|
|
|
+ // 收件人姓名
|
|
|
+ erpWdtTrade.setReceiverName(order.getReceiver_name());
|
|
|
+ // 省份
|
|
|
+ erpWdtTrade.setReceiverProvince(order.getReceiver_province());
|
|
|
+ // 市
|
|
|
+ erpWdtTrade.setReceiverCity(order.getReceiver_city());
|
|
|
+ // 区
|
|
|
+ erpWdtTrade.setReceiverDistrict(order.getReceiver_district());
|
|
|
+ // 详细地址
|
|
|
+ erpWdtTrade.setReceiverAddress(order.getReceiver_address());
|
|
|
+ // 手机
|
|
|
+ erpWdtTrade.setReceiverMobile(order.getReceiver_mobile());
|
|
|
+ // 固定电话
|
|
|
+ erpWdtTrade.setReceiverTelno(order.getReceiver_mobile());
|
|
|
+ // 买家备注
|
|
|
+ erpWdtTrade.setBuyerMessage(order.getBuyer_memo());
|
|
|
+ // 卖家备注
|
|
|
+ erpWdtTrade.setSellerMemo(order.getSeller_memo());
|
|
|
+ erpWdtTrade.setWarehouseNo(order.getWarehouse_code());
|
|
|
+
|
|
|
+ // 运费金额
|
|
|
+ erpWdtTrade.setPostAmount(fsStoreOrder.getFreightPrice());
|
|
|
+ // 已付金额
|
|
|
+ if(ObjectUtils.isNotNull(fsStoreOrder)){
|
|
|
+ erpWdtTrade.setPaid(fsStoreOrder.getPayMoney());
|
|
|
+ }
|
|
|
+
|
|
|
+ List<FsStoreOrderItemVO> fsStoreOrderItemVOS = fsStoreOrderItemService.selectFsStoreOrderItemListByOrderId(fsStoreOrder.getId());
|
|
|
+ List<ErpWdtOrder> erpWdtOrderList = new ArrayList<>();
|
|
|
+ // 商品总价
|
|
|
+ BigDecimal totalPrice = fsStoreOrder.getTotalPrice();
|
|
|
+
|
|
|
+ // 总折扣金额 = 优惠券金额 + 折扣金额
|
|
|
+ BigDecimal totalDiscountPrice = BigDecimal.ZERO;
|
|
|
+ // 折扣金额
|
|
|
+ BigDecimal discountPrice = totalPrice.subtract(fsStoreOrder.getPayPrice());
|
|
|
+ totalDiscountPrice = couponPrice.add(discountPrice);
|
|
|
+
|
|
|
+ // 防止除零错误
|
|
|
+ if (totalPrice.compareTo(BigDecimal.ZERO) == 0) {
|
|
|
+ totalPrice = BigDecimal.ONE;
|
|
|
+ }
|
|
|
+
|
|
|
+ for (FsStoreOrderItemVO fsStoreOrderItem : fsStoreOrderItemVOS) {
|
|
|
+ ErpWdtOrder erpWdtOrder = new ErpWdtOrder();
|
|
|
+ //平台订单货品表主键
|
|
|
+ erpWdtOrder.setOid(String.format("%s%s",fsStoreOrderItem.getOrderCode(),fsStoreOrderItem.getItemId()));
|
|
|
+ erpWdtOrder.setNum(BigDecimal.valueOf(fsStoreOrderItem.getNum()));
|
|
|
+ FsStoreProduct fsStoreProduct = fsStoreProductService.selectFsStoreProductById(fsStoreOrderItem.getProductId());
|
|
|
+ Asserts.check(ObjectUtils.isNotNull(fsStoreProduct),"该产品不存在! 产品id: {} ",fsStoreOrderItem.getProductId());
|
|
|
+ // 单价
|
|
|
+ erpWdtOrder.setPrice(fsStoreProduct.getPrice());
|
|
|
+ // 状态
|
|
|
+ erpWdtOrder.setStatus(TradeStatus.SHIPPED.getValue());
|
|
|
+ // 退款状态
|
|
|
+ erpWdtOrder.setRefundStatus(RefundStatus.NO_REFUND.getValue());
|
|
|
+
|
|
|
+ // 平台货品ID
|
|
|
+ erpWdtOrder.setGoodsId(String.valueOf(fsStoreProduct.getProductId()));
|
|
|
+ JSONObject jsonObject = JSON.parseObject(fsStoreOrderItem.getJsonInfo());
|
|
|
+ erpWdtOrder.setSpecId(jsonObject.getString("sku"));
|
|
|
+ erpWdtOrder.setGoodsNo(jsonObject.getString("barCode"));
|
|
|
+ erpWdtOrder.setSpecNo(jsonObject.getString("sku"));
|
|
|
+ // 货品名称
|
|
|
+ erpWdtOrder.setGoodsName(fsStoreProduct.getProductName());
|
|
|
+ // 调整
|
|
|
+ erpWdtOrder.setAdjustAmount(BigDecimal.ZERO);
|
|
|
+ // 优惠
|
|
|
+ erpWdtOrder.setDiscount(BigDecimal.ZERO);
|
|
|
+ // 分摊优惠
|
|
|
+ // 分摊比例
|
|
|
+ BigDecimal price = fsStoreProduct.getPrice().multiply(BigDecimal.valueOf(fsStoreOrderItem.getNum()));
|
|
|
+ BigDecimal divide = price.divide(totalPrice, RoundingMode.HALF_UP);
|
|
|
+ erpWdtOrder.setShareDiscount(divide.multiply(totalDiscountPrice));
|
|
|
+
|
|
|
+ erpWdtOrderList.add(erpWdtOrder);
|
|
|
+ }
|
|
|
+
|
|
|
+ // 最后一个商品的分摊优惠等于总优惠减去前面分摊优惠之和
|
|
|
+ Asserts.check(CollectionUtils.isNotEmpty(erpWdtOrderList),"订单 {} 商品不能为空!", order.getPlatform_code());
|
|
|
+ long size = erpWdtOrderList.size();
|
|
|
+ if(size > 1) {
|
|
|
+ ErpWdtOrder erpWdtOrder = erpWdtOrderList.get(erpWdtOrderList.size() - 1);
|
|
|
+ erpWdtOrder.setShareDiscount(totalDiscountPrice.subtract(erpWdtOrderList.stream()
|
|
|
+ .limit(size - 1L)
|
|
|
+ .map(item -> Optional.ofNullable(item.getShareDiscount()).orElse(BigDecimal.ZERO))
|
|
|
+ .reduce(BigDecimal.ZERO, BigDecimal::add)));
|
|
|
+ }
|
|
|
+
|
|
|
+ erpWdtTrade.setOrderList(erpWdtOrderList);
|
|
|
+ erpWdtBusinessRequestParams.setTradeList(new ArrayList<>(Arrays.asList(erpWdtTrade)));
|
|
|
+
|
|
|
+ Map<String,String> map = new HashMap<>();
|
|
|
+ map.put("shop_no",erpWdtBusinessRequestParams.getShopNo());
|
|
|
+ map.put("switch_mode", String.valueOf(erpWdtBusinessRequestParams.getSwitchMode()));
|
|
|
+ map.put("trade_list", convertToSnakeCase(erpWdtBusinessRequestParams.getTradeList()));
|
|
|
+
|
|
|
+
|
|
|
+ try {
|
|
|
+ String response = client.execute("trade_push.php", map);
|
|
|
+ ParserConfig config = new ParserConfig();
|
|
|
+ config.propertyNamingStrategy = PropertyNamingStrategy.CamelCase;
|
|
|
+ ErpWdtApiResponse erpWdtApiResponse = JSON.parseObject(response, ErpWdtApiResponse.class,config);
|
|
|
+ if(ObjectUtil.equal(0,erpWdtApiResponse.getCode())){
|
|
|
+ log.info("订单推送成功: {}", response);
|
|
|
+ ErpOrderResponse erpOrderResponse = new ErpOrderResponse();
|
|
|
+ erpOrderResponse.setCode(order.getPlatform_code());
|
|
|
+ erpOrderResponse.setSuccess(true);
|
|
|
+ erpOrderResponse.setRequestRawData(JSON.toJSONString(map));
|
|
|
+ erpOrderResponse.setResponseRawData(response);
|
|
|
+ return erpOrderResponse;
|
|
|
+ } else {
|
|
|
+ throw new RuntimeException(String.format("订单推送失败,原因: %s",erpWdtApiResponse.getMessage()));
|
|
|
+ }
|
|
|
+ } catch (IOException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ return new ErpOrderResponse();
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取erp推送参数
|
|
|
+ * @param order 订单参数
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+// private ErpOrderResponse getErpOrderResponse(ErpOrder order) {
|
|
|
+// //测试环境sid、appkey、密钥请到旺店通开放平台-自助对接-申请测试环境内查看,测试环境url=https://sandbox.wangdian.cn/openapi2/
|
|
|
+// //调用正式环境时请将sid、appkey、appsecret切换为实际参数,参数在旺店通开放平台-自助对接-应用管理内应用状态为已上线的应用中查看,调用正式环境注意切换正式环境url=https://api.wangdian.cn/openapi2/
|
|
|
+//
|
|
|
+// ErpWdtBusinessRequestParams erpWdtBusinessRequestParams = new ErpWdtBusinessRequestParams();
|
|
|
+// erpWdtBusinessRequestParams.setShopNo(shopCode);
|
|
|
+// erpWdtBusinessRequestParams.setSwitchMode(0);
|
|
|
+// ErpWdtTrade erpWdtTrade = new ErpWdtTrade();
|
|
|
+// FsStoreOrder fsStoreOrder = fsStoreOrderService.selectFsStoreOrderByOrderCode(order.getPlatform_code());
|
|
|
+// BigDecimal couponPrice = fsStoreOrder.getCouponPrice();
|
|
|
+//
|
|
|
+// // 平台状态
|
|
|
+// erpWdtTrade.setTradeStatus(TradeStatus.PAID_WAITING_FOR_SHIPMENT.getValue());
|
|
|
+//
|
|
|
+// // 订单id
|
|
|
+// erpWdtTrade.setTid(order.getPlatform_code());
|
|
|
+//
|
|
|
+//
|
|
|
+// // 如果是货到付款
|
|
|
+// if("2".equals(fsStoreOrder.getPayType())){
|
|
|
+// // 支付状态
|
|
|
+// erpWdtTrade.setPayStatus(PaymentStatus.PARTIALLY_PAID.getValue());
|
|
|
+// // 发货条件
|
|
|
+// erpWdtTrade.setDeliveryTerm(DeliveryTerm.CASH_ON_DELIVERY.getValue());
|
|
|
+// // 货到付款金额 = 物流代收金额-优惠金额
|
|
|
+// erpWdtTrade.setCodAmount(fsStoreOrder.getPayDelivery().subtract(couponPrice));
|
|
|
+//
|
|
|
+// } else if("3".equals(fsStoreOrder.getPayType())){
|
|
|
+// // 支付状态
|
|
|
+// erpWdtTrade.setPayStatus(PaymentStatus.UNPAID.getValue());
|
|
|
+// // 发货条件
|
|
|
+// erpWdtTrade.setDeliveryTerm(DeliveryTerm.CASH_ON_DELIVERY.getValue());
|
|
|
+// // 货到付款金额 = 物流代收金额-优惠金额
|
|
|
+// erpWdtTrade.setCodAmount(fsStoreOrder.getPayDelivery().subtract(couponPrice));
|
|
|
+// } else { // 如果是线上付款
|
|
|
+// // 支付状态
|
|
|
+// erpWdtTrade.setPayStatus(PaymentStatus.FULLY_PAID.getValue());
|
|
|
+// // 发货条件
|
|
|
+// erpWdtTrade.setDeliveryTerm(DeliveryTerm.PAYMENT_BEFORE_DELIVERY.getValue());
|
|
|
+// }
|
|
|
+//
|
|
|
+// // 下单时间
|
|
|
+// erpWdtTrade.setTradeTime(order.getDeal_datetime());
|
|
|
+// // 支付时间
|
|
|
+// erpWdtTrade.setPayTime(order.getDeal_datetime());
|
|
|
+// // 分销类别
|
|
|
+// erpWdtTrade.setFenxiaoType(FenxiaoType.JINGXIAO.getValue());
|
|
|
+// // 客户网名
|
|
|
+// erpWdtTrade.setBuyerNick(order.getReceiver_name());
|
|
|
+// // 收件人姓名
|
|
|
+// erpWdtTrade.setReceiverName(order.getReceiver_name());
|
|
|
+// // 省份
|
|
|
+// erpWdtTrade.setReceiverProvince(order.getReceiver_province());
|
|
|
+// // 市
|
|
|
+// erpWdtTrade.setReceiverCity(order.getReceiver_city());
|
|
|
+// // 区
|
|
|
+// erpWdtTrade.setReceiverDistrict(order.getReceiver_district());
|
|
|
+// // 详细地址
|
|
|
+// erpWdtTrade.setReceiverAddress(order.getReceiver_address());
|
|
|
+// // 手机
|
|
|
+// erpWdtTrade.setReceiverMobile(order.getReceiver_mobile());
|
|
|
+// // 固定电话
|
|
|
+// erpWdtTrade.setReceiverTelno(order.getReceiver_mobile());
|
|
|
+// // 买家备注
|
|
|
+// erpWdtTrade.setBuyerMessage(order.getBuyer_memo());
|
|
|
+// // 卖家备注
|
|
|
+// erpWdtTrade.setSellerMemo(order.getSeller_memo());
|
|
|
+// erpWdtTrade.setWarehouseNo(order.getWarehouse_code());
|
|
|
+//
|
|
|
+//
|
|
|
+// // 运费金额
|
|
|
+// erpWdtTrade.setPostAmount(fsStoreOrder.getFreightPrice());
|
|
|
+// // 已付金额
|
|
|
+// if(ObjectUtils.isNotNull(fsStoreOrder)){
|
|
|
+// erpWdtTrade.setPaid(fsStoreOrder.getPayMoney());
|
|
|
+// }
|
|
|
+//
|
|
|
+// List<FsStoreOrderItemVO> fsStoreOrderItemVOS = fsStoreOrderItemService.selectFsStoreOrderItemListByOrderId(fsStoreOrder.getId());
|
|
|
+// List<ErpWdtOrder> erpWdtOrderList = new ArrayList<>();
|
|
|
+// // 商品总价
|
|
|
+// BigDecimal totalPrice = fsStoreOrder.getTotalPrice();
|
|
|
+//
|
|
|
+// // 优惠券金额
|
|
|
+// if (fsStoreOrder.getCouponPrice().compareTo(BigDecimal.ZERO) == 0
|
|
|
+// && fsStoreOrder.getTotalPrice().compareTo(fsStoreOrder.getPayMoney()) > 0) {
|
|
|
+// BigDecimal payDelivery = fsStoreOrder.getPayDelivery();
|
|
|
+// BigDecimal payMoney = fsStoreOrder.getPayMoney();
|
|
|
+// if(ObjectUtil.isNull(payDelivery)){
|
|
|
+// payDelivery = BigDecimal.ZERO;
|
|
|
+// }
|
|
|
+// if(ObjectUtil.isNull(payMoney)){
|
|
|
+// payMoney = BigDecimal.ZERO;
|
|
|
+// }
|
|
|
+// couponPrice = totalPrice.subtract(payMoney)
|
|
|
+// .subtract(payDelivery);
|
|
|
+// }
|
|
|
+//
|
|
|
+//
|
|
|
+// for (FsStoreOrderItemVO fsStoreOrderItem : fsStoreOrderItemVOS) {
|
|
|
+// ErpWdtOrder erpWdtOrder = new ErpWdtOrder();
|
|
|
+// //平台订单货品表主键
|
|
|
+// erpWdtOrder.setOid(String.format("%s%s",fsStoreOrderItem.getOrderCode(),fsStoreOrderItem.getItemId()));
|
|
|
+// erpWdtOrder.setNum(BigDecimal.valueOf(fsStoreOrderItem.getNum()));
|
|
|
+// FsStoreProduct fsStoreProduct = fsStoreProductService.selectFsStoreProductById(fsStoreOrderItem.getProductId());
|
|
|
+// Asserts.check(ObjectUtils.isNotNull(fsStoreProduct),"该产品不存在! 产品id: {} ",fsStoreOrderItem.getProductId());
|
|
|
+// // 单价
|
|
|
+// erpWdtOrder.setPrice(fsStoreProduct.getPrice());
|
|
|
+// // 状态
|
|
|
+// erpWdtOrder.setStatus(TradeStatus.SHIPPED.getValue());
|
|
|
+// // 退款状态
|
|
|
+// erpWdtOrder.setRefundStatus(RefundStatus.NO_REFUND.getValue());
|
|
|
+//
|
|
|
+// // 平台货品ID
|
|
|
+// erpWdtOrder.setGoodsId(String.valueOf(fsStoreProduct.getProductId()));
|
|
|
+// JSONObject jsonObject = JSON.parseObject(fsStoreOrderItem.getJsonInfo());
|
|
|
+// erpWdtOrder.setSpecId(jsonObject.getString("sku"));
|
|
|
+// erpWdtOrder.setGoodsNo(jsonObject.getString("barCode"));
|
|
|
+// erpWdtOrder.setSpecNo(jsonObject.getString("sku"));
|
|
|
+// // 货品名称
|
|
|
+// erpWdtOrder.setGoodsName(fsStoreProduct.getProductName());
|
|
|
+// // 调整
|
|
|
+// erpWdtOrder.setAdjustAmount(BigDecimal.ZERO);
|
|
|
+// // 优惠
|
|
|
+// erpWdtOrder.setDiscount(BigDecimal.ZERO);
|
|
|
+// // 分摊优惠
|
|
|
+// // 分摊比例
|
|
|
+// BigDecimal price = fsStoreProduct.getPrice().multiply(BigDecimal.valueOf(fsStoreOrderItem.getNum()));
|
|
|
+// BigDecimal divide = price.divide(totalPrice, RoundingMode.HALF_UP);
|
|
|
+// erpWdtOrder.setShareDiscount(divide.multiply(couponPrice));
|
|
|
+//
|
|
|
+// erpWdtOrderList.add(erpWdtOrder);
|
|
|
+// }
|
|
|
+//
|
|
|
+// // 最后一个商品的分摊优惠等于总优惠减去前面分摊优惠之和
|
|
|
+// Asserts.check(CollectionUtils.isNotEmpty(erpWdtOrderList),"订单 {} 商品不能为空!", order.getPlatform_code());
|
|
|
+// long size = erpWdtOrderList.size();
|
|
|
+// if(size > 1) {
|
|
|
+// ErpWdtOrder erpWdtOrder = erpWdtOrderList.get(erpWdtOrderList.size() - 1);
|
|
|
+// erpWdtOrder.setShareDiscount(couponPrice.subtract(erpWdtOrderList.stream()
|
|
|
+// .limit(size - 1L)
|
|
|
+// .map(item -> Optional.ofNullable(item.getShareDiscount()).orElse(BigDecimal.ZERO))
|
|
|
+// .reduce(BigDecimal.ZERO, BigDecimal::add)));
|
|
|
+// }
|
|
|
+//
|
|
|
+// erpWdtTrade.setOrderList(erpWdtOrderList);
|
|
|
+// erpWdtBusinessRequestParams.setTradeList(new ArrayList<>(Arrays.asList(erpWdtTrade)));
|
|
|
+//
|
|
|
+// Map<String,String> map = new HashMap<>();
|
|
|
+// map.put("shop_no",erpWdtBusinessRequestParams.getShopNo());
|
|
|
+// map.put("switch_mode", String.valueOf(erpWdtBusinessRequestParams.getSwitchMode()));
|
|
|
+// map.put("trade_list", convertToSnakeCase(erpWdtBusinessRequestParams.getTradeList()));
|
|
|
+//
|
|
|
+//
|
|
|
+// try {
|
|
|
+// String response = client.execute("trade_push.php", map);
|
|
|
+// ParserConfig config = new ParserConfig();
|
|
|
+// config.propertyNamingStrategy = PropertyNamingStrategy.CamelCase;
|
|
|
+// ErpWdtApiResponse erpWdtApiResponse = JSON.parseObject(response, ErpWdtApiResponse.class,config);
|
|
|
+// if(ObjectUtil.equal(0,erpWdtApiResponse.getCode())){
|
|
|
+// log.info("订单推送成功: {}", response);
|
|
|
+// ErpOrderResponse erpOrderResponse = new ErpOrderResponse();
|
|
|
+// erpOrderResponse.setCode(order.getPlatform_code());
|
|
|
+// return erpOrderResponse;
|
|
|
+// } else {
|
|
|
+// throw new RuntimeException(String.format("订单推送失败,原因: %s",erpWdtApiResponse.getMessage()));
|
|
|
+// }
|
|
|
+// } catch (IOException e) {
|
|
|
+// e.printStackTrace();
|
|
|
+// }
|
|
|
+// return new ErpOrderResponse();
|
|
|
+// }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取erp退款参数
|
|
|
+ * @param order 订单参数
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ private ErpOrderResponse getErpOrderRefundResponse(ErpOrder order) {
|
|
|
//测试环境sid、appkey、密钥请到旺店通开放平台-自助对接-申请测试环境内查看,测试环境url=https://sandbox.wangdian.cn/openapi2/
|
|
|
//调用正式环境时请将sid、appkey、appsecret切换为实际参数,参数在旺店通开放平台-自助对接-应用管理内应用状态为已上线的应用中查看,调用正式环境注意切换正式环境url=https://api.wangdian.cn/openapi2/
|
|
|
|
|
@@ -97,11 +444,7 @@ public class WdtErpOrderServiceImpl implements IErpOrderService {
|
|
|
// 订单id
|
|
|
erpWdtTrade.setTid(order.getPlatform_code());
|
|
|
// 平台状态
|
|
|
- if(Objects.equals(type, NORMAL_TYPE)){
|
|
|
- erpWdtTrade.setTradeStatus(TradeStatus.PAID_WAITING_FOR_SHIPMENT.getValue());
|
|
|
- }else if(Objects.equals(type, REFUND_TYPE)){
|
|
|
- erpWdtTrade.setTradeStatus(TradeStatus.REFUNDED.getValue());
|
|
|
- }
|
|
|
+ erpWdtTrade.setTradeStatus(TradeStatus.REFUNDED.getValue());
|
|
|
|
|
|
// 支付状态
|
|
|
erpWdtTrade.setPayStatus(PaymentStatus.FULLY_PAID.getValue());
|
|
@@ -149,8 +492,13 @@ public class WdtErpOrderServiceImpl implements IErpOrderService {
|
|
|
|
|
|
// 优惠券金额
|
|
|
BigDecimal couponPrice = fsStoreOrder.getCouponPrice();
|
|
|
+ if (fsStoreOrder.getCouponPrice().compareTo(BigDecimal.ZERO) == 0
|
|
|
+ && fsStoreOrder.getTotalPrice().compareTo(fsStoreOrder.getPayMoney()) > 0) {
|
|
|
+ couponPrice = fsStoreOrder.getTotalPrice().subtract(fsStoreOrder.getPayMoney());
|
|
|
+ }
|
|
|
// 商品总价
|
|
|
BigDecimal totalPrice = fsStoreOrder.getTotalPrice();
|
|
|
+
|
|
|
for (FsStoreOrderItemVO fsStoreOrderItem : fsStoreOrderItemVOS) {
|
|
|
ErpWdtOrder erpWdtOrder = new ErpWdtOrder();
|
|
|
//平台订单货品表主键
|
|
@@ -161,15 +509,10 @@ public class WdtErpOrderServiceImpl implements IErpOrderService {
|
|
|
// 单价
|
|
|
erpWdtOrder.setPrice(fsStoreProduct.getPrice());
|
|
|
// 状态
|
|
|
- if(Objects.equals(type, NORMAL_TYPE)){
|
|
|
- erpWdtOrder.setStatus(TradeStatus.SHIPPED.getValue());
|
|
|
- // 退款状态
|
|
|
- erpWdtOrder.setRefundStatus(RefundStatus.NO_REFUND.getValue());
|
|
|
- } else {
|
|
|
- erpWdtOrder.setStatus(TradeStatus.REFUNDED.getValue());
|
|
|
- // 退款状态
|
|
|
- erpWdtOrder.setRefundStatus(RefundStatus.REFUND_SUCCESSFUL.getValue());
|
|
|
- }
|
|
|
+
|
|
|
+ erpWdtOrder.setStatus(TradeStatus.REFUNDED.getValue());
|
|
|
+ // 退款状态
|
|
|
+ erpWdtOrder.setRefundStatus(RefundStatus.REFUND_SUCCESSFUL.getValue());
|
|
|
|
|
|
// 平台货品ID
|
|
|
erpWdtOrder.setGoodsId(String.valueOf(fsStoreProduct.getProductId()));
|
|
@@ -185,7 +528,8 @@ public class WdtErpOrderServiceImpl implements IErpOrderService {
|
|
|
erpWdtOrder.setDiscount(BigDecimal.ZERO);
|
|
|
// 分摊优惠
|
|
|
// 分摊比例
|
|
|
- BigDecimal divide = fsStoreProduct.getPrice().divide(totalPrice, RoundingMode.HALF_UP);
|
|
|
+ BigDecimal price = fsStoreProduct.getPrice().multiply(BigDecimal.valueOf(fsStoreOrderItem.getNum()));
|
|
|
+ BigDecimal divide = price.divide(totalPrice, RoundingMode.HALF_UP);
|
|
|
erpWdtOrder.setShareDiscount(divide.multiply(couponPrice));
|
|
|
|
|
|
erpWdtOrderList.add(erpWdtOrder);
|
|
@@ -197,7 +541,7 @@ public class WdtErpOrderServiceImpl implements IErpOrderService {
|
|
|
if(size > 1) {
|
|
|
ErpWdtOrder erpWdtOrder = erpWdtOrderList.get(erpWdtOrderList.size() - 1);
|
|
|
erpWdtOrder.setShareDiscount(couponPrice.subtract(erpWdtOrderList.stream()
|
|
|
- .limit(size - 1L)
|
|
|
+ .limit(size - 1L)
|
|
|
.map(item -> Optional.ofNullable(item.getShareDiscount()).orElse(BigDecimal.ZERO))
|
|
|
.reduce(BigDecimal.ZERO, BigDecimal::add)));
|
|
|
}
|
|
@@ -215,6 +559,7 @@ public class WdtErpOrderServiceImpl implements IErpOrderService {
|
|
|
String response = client.execute("trade_push.php", map);
|
|
|
ParserConfig config = new ParserConfig();
|
|
|
config.propertyNamingStrategy = PropertyNamingStrategy.CamelCase;
|
|
|
+ log.info("Erp推送传参: {}", map);
|
|
|
ErpWdtApiResponse erpWdtApiResponse = JSON.parseObject(response, ErpWdtApiResponse.class,config);
|
|
|
if(ObjectUtil.equal(0,erpWdtApiResponse.getCode())){
|
|
|
log.info("订单推送成功: {}", response);
|
|
@@ -222,7 +567,7 @@ public class WdtErpOrderServiceImpl implements IErpOrderService {
|
|
|
erpOrderResponse.setCode(order.getPlatform_code());
|
|
|
return erpOrderResponse;
|
|
|
} else {
|
|
|
- throw new RuntimeException(String.format("订单推送失败,原因: %s",erpWdtApiResponse.getMessage()));
|
|
|
+ // throw new RuntimeException(String.format("订单推送失败,原因: %s",erpWdtApiResponse.getMessage()));
|
|
|
}
|
|
|
} catch (IOException e) {
|
|
|
e.printStackTrace();
|
|
@@ -242,7 +587,6 @@ public class WdtErpOrderServiceImpl implements IErpOrderService {
|
|
|
|
|
|
@Override
|
|
|
public ErpOrderQueryResponse getOrder(ErpOrderQueryRequert param) {
|
|
|
- WdtClient client = WdtClient.getInstance();
|
|
|
Map<String,String> map = new HashMap<>();
|
|
|
map.put("src_tid",param.getCode());
|
|
|
try {
|
|
@@ -264,21 +608,29 @@ public class WdtErpOrderServiceImpl implements IErpOrderService {
|
|
|
|
|
|
@Override
|
|
|
public BaseResponse refundUpdate(ErpRefundUpdateRequest param) {
|
|
|
- FsErpConfig erpConfig = configUtil.getErpConfig();
|
|
|
- String shopCode = erpConfig.getErpWdShopCode();
|
|
|
-
|
|
|
log.info("退款单更新: {}", param);
|
|
|
FsStoreOrder fsStoreOrder = fsStoreOrderService.selectFsStoreOrderByOrderCode(param.getTid());
|
|
|
|
|
|
- // 待发货状态,售前退款
|
|
|
- if(ObjectUtil.equal(1, fsStoreOrder.getStatus())){
|
|
|
+ ErpOrderQueryRequert request = new ErpOrderQueryRequert();
|
|
|
+ request.setCode(fsStoreOrder.getExtendOrderId());
|
|
|
+
|
|
|
+ Set<Integer> status = new HashSet<>();
|
|
|
+ status.add(95);
|
|
|
+ status.add(105);
|
|
|
+ status.add(110);
|
|
|
+
|
|
|
+ ErpOrderQueryResponse response = getOrder(request);
|
|
|
+ ErpOrderQuery erpOrderQuery = response.getOrders().get(0);
|
|
|
+ Integer deliveryState = erpOrderQuery.getDelivery_state();
|
|
|
+ // 如果是未发货
|
|
|
+ if(!status.contains(deliveryState)){
|
|
|
log.info("售前退款 参数: {}",param);
|
|
|
try {
|
|
|
ErpOrder order = fsStoreOrderService.getErpOrder(fsStoreOrder);
|
|
|
|
|
|
Asserts.check(ObjectUtils.isNotNull(order),"该订单不存在!");
|
|
|
|
|
|
- return getErpOrderResponse(order,REFUND_TYPE);
|
|
|
+ return getErpOrderRefundResponse(order);
|
|
|
} catch (Exception e) {
|
|
|
throw new RuntimeException(e);
|
|
|
}
|
|
@@ -286,7 +638,6 @@ public class WdtErpOrderServiceImpl implements IErpOrderService {
|
|
|
|
|
|
//--------------售后退款------------
|
|
|
log.info("售后退款 参数: {}", param);
|
|
|
- WdtClient client = WdtClient.getInstance();
|
|
|
Map<String,String> map = new HashMap<>();
|
|
|
|
|
|
|
|
@@ -330,6 +681,177 @@ public class WdtErpOrderServiceImpl implements IErpOrderService {
|
|
|
throw new RuntimeException(e);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public ErpOrderResponse finishOrder(ErpOrder order) {
|
|
|
+ //测试环境sid、appkey、密钥请到旺店通开放平台-自助对接-申请测试环境内查看,测试环境url=https://sandbox.wangdian.cn/openapi2/
|
|
|
+ //调用正式环境时请将sid、appkey、appsecret切换为实际参数,参数在旺店通开放平台-自助对接-应用管理内应用状态为已上线的应用中查看,调用正式环境注意切换正式环境url=https://api.wangdian.cn/openapi2/
|
|
|
+
|
|
|
+ ErpWdtBusinessRequestParams erpWdtBusinessRequestParams = new ErpWdtBusinessRequestParams();
|
|
|
+ erpWdtBusinessRequestParams.setShopNo(shopCode);
|
|
|
+ erpWdtBusinessRequestParams.setSwitchMode(0);
|
|
|
+ ErpWdtTrade erpWdtTrade = new ErpWdtTrade();
|
|
|
+ FsStoreOrder fsStoreOrder = fsStoreOrderService.selectFsStoreOrderByOrderCode(order.getPlatform_code());
|
|
|
+ BigDecimal couponPrice = fsStoreOrder.getCouponPrice();
|
|
|
+
|
|
|
+ // 平台状态
|
|
|
+ erpWdtTrade.setTradeStatus(TradeStatus.COMPLETED.getValue());
|
|
|
+
|
|
|
+ // 订单id
|
|
|
+ erpWdtTrade.setTid(order.getPlatform_code());
|
|
|
+
|
|
|
+
|
|
|
+ // 如果是货到付款
|
|
|
+ if("2".equals(fsStoreOrder.getPayType())){
|
|
|
+ // 支付状态
|
|
|
+ erpWdtTrade.setPayStatus(PaymentStatus.PARTIALLY_PAID.getValue());
|
|
|
+ // 发货条件
|
|
|
+ erpWdtTrade.setDeliveryTerm(DeliveryTerm.CASH_ON_DELIVERY.getValue());
|
|
|
+ // 货到付款金额 = 物流代收金额-优惠金额
|
|
|
+ erpWdtTrade.setCodAmount(fsStoreOrder.getPayDelivery().subtract(couponPrice));
|
|
|
+
|
|
|
+ } else if("3".equals(fsStoreOrder.getPayType())){
|
|
|
+ // 支付状态
|
|
|
+ erpWdtTrade.setPayStatus(PaymentStatus.UNPAID.getValue());
|
|
|
+ // 发货条件
|
|
|
+ erpWdtTrade.setDeliveryTerm(DeliveryTerm.CASH_ON_DELIVERY.getValue());
|
|
|
+ // 货到付款金额 = 物流代收金额-优惠金额
|
|
|
+ erpWdtTrade.setCodAmount(fsStoreOrder.getPayDelivery().subtract(couponPrice));
|
|
|
+ } else { // 如果是线上付款
|
|
|
+ // 支付状态
|
|
|
+ erpWdtTrade.setPayStatus(PaymentStatus.FULLY_PAID.getValue());
|
|
|
+ // 发货条件
|
|
|
+ erpWdtTrade.setDeliveryTerm(DeliveryTerm.PAYMENT_BEFORE_DELIVERY.getValue());
|
|
|
+ }
|
|
|
+
|
|
|
+ // 下单时间
|
|
|
+ erpWdtTrade.setTradeTime(order.getDeal_datetime());
|
|
|
+ // 支付时间
|
|
|
+ erpWdtTrade.setPayTime(order.getDeal_datetime());
|
|
|
+ // 分销类别
|
|
|
+ erpWdtTrade.setFenxiaoType(FenxiaoType.JINGXIAO.getValue());
|
|
|
+ // 客户网名
|
|
|
+ erpWdtTrade.setBuyerNick(order.getReceiver_name());
|
|
|
+ // 收件人姓名
|
|
|
+ erpWdtTrade.setReceiverName(order.getReceiver_name());
|
|
|
+ // 省份
|
|
|
+ erpWdtTrade.setReceiverProvince(order.getReceiver_province());
|
|
|
+ // 市
|
|
|
+ erpWdtTrade.setReceiverCity(order.getReceiver_city());
|
|
|
+ // 区
|
|
|
+ erpWdtTrade.setReceiverDistrict(order.getReceiver_district());
|
|
|
+ // 详细地址
|
|
|
+ erpWdtTrade.setReceiverAddress(order.getReceiver_address());
|
|
|
+ // 手机
|
|
|
+ erpWdtTrade.setReceiverMobile(order.getReceiver_mobile());
|
|
|
+ // 固定电话
|
|
|
+ erpWdtTrade.setReceiverTelno(order.getReceiver_mobile());
|
|
|
+ // 买家备注
|
|
|
+ erpWdtTrade.setBuyerMessage(order.getBuyer_memo());
|
|
|
+ // 卖家备注
|
|
|
+ erpWdtTrade.setSellerMemo(order.getSeller_memo());
|
|
|
+ erpWdtTrade.setWarehouseNo(order.getWarehouse_code());
|
|
|
+
|
|
|
+ // 运费金额
|
|
|
+ erpWdtTrade.setPostAmount(fsStoreOrder.getFreightPrice());
|
|
|
+ // 已付金额
|
|
|
+ if(ObjectUtils.isNotNull(fsStoreOrder)){
|
|
|
+ erpWdtTrade.setPaid(fsStoreOrder.getPayMoney());
|
|
|
+ }
|
|
|
+
|
|
|
+ List<FsStoreOrderItemVO> fsStoreOrderItemVOS = fsStoreOrderItemService.selectFsStoreOrderItemListByOrderId(fsStoreOrder.getId());
|
|
|
+ List<ErpWdtOrder> erpWdtOrderList = new ArrayList<>();
|
|
|
+ // 商品总价
|
|
|
+ BigDecimal totalPrice = fsStoreOrder.getTotalPrice();
|
|
|
+
|
|
|
+ // 总折扣金额 = 优惠券金额 + 折扣金额
|
|
|
+ BigDecimal totalDiscountPrice = BigDecimal.ZERO;
|
|
|
+ // 折扣金额
|
|
|
+ BigDecimal discountPrice = totalPrice.subtract(fsStoreOrder.getPayPrice());
|
|
|
+ totalDiscountPrice = couponPrice.add(discountPrice);
|
|
|
+
|
|
|
+ // 防止除零错误
|
|
|
+ if (totalPrice.compareTo(BigDecimal.ZERO) == 0) {
|
|
|
+ totalPrice = BigDecimal.ONE;
|
|
|
+ }
|
|
|
+
|
|
|
+ for (FsStoreOrderItemVO fsStoreOrderItem : fsStoreOrderItemVOS) {
|
|
|
+ ErpWdtOrder erpWdtOrder = new ErpWdtOrder();
|
|
|
+ //平台订单货品表主键
|
|
|
+ erpWdtOrder.setOid(String.format("%s%s",fsStoreOrderItem.getOrderCode(),fsStoreOrderItem.getItemId()));
|
|
|
+ erpWdtOrder.setNum(BigDecimal.valueOf(fsStoreOrderItem.getNum()));
|
|
|
+ FsStoreProduct fsStoreProduct = fsStoreProductService.selectFsStoreProductById(fsStoreOrderItem.getProductId());
|
|
|
+ Asserts.check(ObjectUtils.isNotNull(fsStoreProduct),"该产品不存在! 产品id: {} ",fsStoreOrderItem.getProductId());
|
|
|
+ // 单价
|
|
|
+ erpWdtOrder.setPrice(fsStoreProduct.getPrice());
|
|
|
+ // 状态
|
|
|
+ erpWdtOrder.setStatus(TradeStatus.SHIPPED.getValue());
|
|
|
+ // 退款状态
|
|
|
+ erpWdtOrder.setRefundStatus(RefundStatus.NO_REFUND.getValue());
|
|
|
+
|
|
|
+ // 平台货品ID
|
|
|
+ erpWdtOrder.setGoodsId(String.valueOf(fsStoreProduct.getProductId()));
|
|
|
+ JSONObject jsonObject = JSON.parseObject(fsStoreOrderItem.getJsonInfo());
|
|
|
+ erpWdtOrder.setSpecId(jsonObject.getString("sku"));
|
|
|
+ erpWdtOrder.setGoodsNo(jsonObject.getString("barCode"));
|
|
|
+ erpWdtOrder.setSpecNo(jsonObject.getString("sku"));
|
|
|
+ // 货品名称
|
|
|
+ erpWdtOrder.setGoodsName(fsStoreProduct.getProductName());
|
|
|
+ // 调整
|
|
|
+ erpWdtOrder.setAdjustAmount(BigDecimal.ZERO);
|
|
|
+ // 优惠
|
|
|
+ erpWdtOrder.setDiscount(BigDecimal.ZERO);
|
|
|
+ // 分摊优惠
|
|
|
+ // 分摊比例
|
|
|
+ BigDecimal price = fsStoreProduct.getPrice().multiply(BigDecimal.valueOf(fsStoreOrderItem.getNum()));
|
|
|
+ BigDecimal divide = price.divide(totalPrice, RoundingMode.HALF_UP);
|
|
|
+ erpWdtOrder.setShareDiscount(divide.multiply(totalDiscountPrice));
|
|
|
+
|
|
|
+ erpWdtOrderList.add(erpWdtOrder);
|
|
|
+ }
|
|
|
+
|
|
|
+ // 最后一个商品的分摊优惠等于总优惠减去前面分摊优惠之和
|
|
|
+ Asserts.check(CollectionUtils.isNotEmpty(erpWdtOrderList),"订单 {} 商品不能为空!", order.getPlatform_code());
|
|
|
+ long size = erpWdtOrderList.size();
|
|
|
+ if(size > 1) {
|
|
|
+ ErpWdtOrder erpWdtOrder = erpWdtOrderList.get(erpWdtOrderList.size() - 1);
|
|
|
+ erpWdtOrder.setShareDiscount(totalDiscountPrice.subtract(erpWdtOrderList.stream()
|
|
|
+ .limit(size - 1L)
|
|
|
+ .map(item -> Optional.ofNullable(item.getShareDiscount()).orElse(BigDecimal.ZERO))
|
|
|
+ .reduce(BigDecimal.ZERO, BigDecimal::add)));
|
|
|
+ }
|
|
|
+
|
|
|
+ erpWdtTrade.setOrderList(erpWdtOrderList);
|
|
|
+ erpWdtBusinessRequestParams.setTradeList(new ArrayList<>(Arrays.asList(erpWdtTrade)));
|
|
|
+
|
|
|
+ Map<String,String> map = new HashMap<>();
|
|
|
+ map.put("shop_no",erpWdtBusinessRequestParams.getShopNo());
|
|
|
+ map.put("switch_mode", String.valueOf(erpWdtBusinessRequestParams.getSwitchMode()));
|
|
|
+ map.put("trade_list", convertToSnakeCase(erpWdtBusinessRequestParams.getTradeList()));
|
|
|
+
|
|
|
+
|
|
|
+ try {
|
|
|
+ String response = client.execute("trade_push.php", map);
|
|
|
+ ParserConfig config = new ParserConfig();
|
|
|
+ config.propertyNamingStrategy = PropertyNamingStrategy.CamelCase;
|
|
|
+ ErpWdtApiResponse erpWdtApiResponse = JSON.parseObject(response, ErpWdtApiResponse.class,config);
|
|
|
+ if(ObjectUtil.equal(0,erpWdtApiResponse.getCode())){
|
|
|
+ log.info("订单推送成功: {}", response);
|
|
|
+ ErpOrderResponse erpOrderResponse = new ErpOrderResponse();
|
|
|
+ erpOrderResponse.setCode(order.getPlatform_code());
|
|
|
+ erpOrderResponse.setSuccess(true);
|
|
|
+ erpOrderResponse.setRequestRawData(JSON.toJSONString(map));
|
|
|
+ erpOrderResponse.setResponseRawData(response);
|
|
|
+ return erpOrderResponse;
|
|
|
+ } else {
|
|
|
+ throw new RuntimeException(String.format("订单推送失败,原因: %s",erpWdtApiResponse.getMessage()));
|
|
|
+ }
|
|
|
+ } catch (IOException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ return new ErpOrderResponse();
|
|
|
+ }
|
|
|
+
|
|
|
public static String convertToSnakeCase(Object obj) {
|
|
|
SerializeConfig config = new SerializeConfig();
|
|
|
config.propertyNamingStrategy = PropertyNamingStrategy.SnakeCase;
|