|
@@ -10,6 +10,7 @@ import com.fs.erp.domain.*;
|
|
|
import com.fs.erp.dto.*;
|
|
|
import com.fs.erp.http.JstErpHttpService;
|
|
|
import com.fs.erp.mapper.FsJstAftersalePushMapper;
|
|
|
+import com.fs.erp.mapper.FsJstCodPushMapper;
|
|
|
import com.fs.erp.service.IErpOrderService;
|
|
|
import com.fs.erp.utils.SignUtil;
|
|
|
import com.fs.express.enums.TaskStatusEnum;
|
|
@@ -62,6 +63,9 @@ public class JSTErpOrderServiceImpl implements IErpOrderService {
|
|
|
@Autowired
|
|
|
private FsStoreAfterSalesMapper fsStoreAfterSalesMapper;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private FsJstCodPushMapper fsJstCodPushMapper;
|
|
|
+
|
|
|
@Override
|
|
|
public ErpOrderResponse addOrder(ErpOrder order) {
|
|
|
FsStoreOrder fsStoreOrder = fsStoreOrderService.selectFsStoreOrderByOrderCode(order.getPlatform_code());
|
|
@@ -70,8 +74,6 @@ public class JSTErpOrderServiceImpl implements IErpOrderService {
|
|
|
|
|
|
ShopOrderDTO shopOrderDTO = new ShopOrderDTO();
|
|
|
|
|
|
- BigDecimal couponPrice = fsStoreOrder.getCouponPrice();
|
|
|
-
|
|
|
shopOrderDTO.setShopId(Long.valueOf(order.getShop_code()));
|
|
|
shopOrderDTO.setSoId(order.getPlatform_code());
|
|
|
shopOrderDTO.setOrderDate(order.getDeal_datetime());
|
|
@@ -129,21 +131,42 @@ public class JSTErpOrderServiceImpl implements IErpOrderService {
|
|
|
}
|
|
|
shopOrderDTO.setItems(itemDTOList);
|
|
|
|
|
|
-
|
|
|
+ // 实际支付金额
|
|
|
PaymentDTO paymentDTO = new PaymentDTO();
|
|
|
- paymentDTO.setAmount(erpOrderPayment.getPayment());
|
|
|
+ paymentDTO.setAmount(fsStoreOrder.getPayMoney().doubleValue());
|
|
|
paymentDTO.setOuterPayId(order.getPlatform_code());
|
|
|
paymentDTO.setPayDate(order.getDeal_datetime());
|
|
|
- paymentDTO.setPayment("微信");
|
|
|
+ paymentDTO.setPayment("微信支付");
|
|
|
paymentDTO.setBuyerAccount(order.getBuyer_account());
|
|
|
paymentDTO.setSellerAccount("平台销售");
|
|
|
shopOrderDTO.setPay(paymentDTO);
|
|
|
|
|
|
+
|
|
|
// 如果是货到付款
|
|
|
if("2".equals(fsStoreOrder.getPayType()) || "3".equals(fsStoreOrder.getPayType())){
|
|
|
shopOrderDTO.setIsCod(true);
|
|
|
// 货到付款金额 = 物流代收金额-优惠金额
|
|
|
- shopOrderDTO.setBuyerPaidAmount(fsStoreOrder.getPayDelivery().subtract(couponPrice));
|
|
|
+ shopOrderDTO.setBuyerPaidAmount(fsStoreOrder.getPayDelivery());
|
|
|
+ shopOrderDTO.setPayAmount(fsStoreOrder.getPayPrice().doubleValue());
|
|
|
+
|
|
|
+ // 货到付款要推两次
|
|
|
+ paymentDTO = new PaymentDTO();
|
|
|
+ // 物流代收金额
|
|
|
+ paymentDTO.setAmount(fsStoreOrder.getPayDelivery().doubleValue());
|
|
|
+ paymentDTO.setOuterPayId(order.getPlatform_code());
|
|
|
+ paymentDTO.setPayDate(order.getDeal_datetime());
|
|
|
+ paymentDTO.setPayment("物流代收金额");
|
|
|
+ paymentDTO.setBuyerAccount(order.getBuyer_account());
|
|
|
+ paymentDTO.setSellerAccount("平台销售");
|
|
|
+ shopOrderDTO.setPay(paymentDTO);
|
|
|
+
|
|
|
+ FsJstCodPush fsJstCodPush = new FsJstCodPush();
|
|
|
+ fsJstCodPush.setOrderId(fsStoreOrder.getOrderCode());
|
|
|
+ fsJstCodPush.setType("0");
|
|
|
+ fsJstCodPush.setParams(JSON.toJSONString(shopOrderDTO));
|
|
|
+ fsJstCodPush.setRetryCount(0);
|
|
|
+ fsJstCodPush.setTaskStatus(TaskStatusEnum.PENDING.getCode());
|
|
|
+ fsJstCodPushMapper.insert(fsJstCodPush);
|
|
|
}
|
|
|
|
|
|
ErpOrderResponseDTO upload = jstErpHttpService.upload(shopOrderDTO);
|
|
@@ -289,9 +312,6 @@ public class JSTErpOrderServiceImpl implements IErpOrderService {
|
|
|
FsStoreOrder fsStoreOrder = fsStoreOrderService.selectFsStoreOrderByOrderCode(param.getTid());
|
|
|
FsStoreDelivers byOrderCode = fsStoreDeliversMapper.findByOrderCode(fsStoreOrder.getOrderCode());
|
|
|
|
|
|
-
|
|
|
- FsStoreAfterSales afterSales = fsStoreAfterSalesMapper.selectFsStoreAfterSalesByOrderCode(fsStoreOrder.getOrderCode());
|
|
|
-
|
|
|
// 发货后退款
|
|
|
if(ObjectUtil.isNotNull(byOrderCode)){
|
|
|
|