|
|
@@ -539,6 +539,11 @@ public class FsExternalOrderServiceImpl implements IFsExternalOrderService {
|
|
|
return null;
|
|
|
}
|
|
|
ShopOrderDTO codOrderDTO = JSON.parseObject(JSON.toJSONString(shopOrderDTO), ShopOrderDTO.class);
|
|
|
+ FsStore fsStore = null;
|
|
|
+ if (order.getStoreId() != null) {
|
|
|
+ fsStore = fsStoreMapper.selectFsStoreByShopCode(order.getStoreId().toString());
|
|
|
+ }
|
|
|
+ BigDecimal amountMultiplier = resolveJstAmountMultiplier(fsStore);
|
|
|
BigDecimal totalPrice = order.getTotalPrice() == null ? BigDecimal.ZERO : order.getTotalPrice();
|
|
|
BigDecimal payPrice = order.getPayPrice() == null ? BigDecimal.ZERO : order.getPayPrice();
|
|
|
BigDecimal codAmount = totalPrice.subtract(payPrice);
|
|
|
@@ -546,10 +551,11 @@ public class FsExternalOrderServiceImpl implements IFsExternalOrderService {
|
|
|
codAmount = BigDecimal.ZERO;
|
|
|
}
|
|
|
codOrderDTO.setIsCod(true);
|
|
|
- codOrderDTO.setPayAmount(totalPrice.doubleValue());
|
|
|
+ // 货到付款:应收/商品总额、代收金额同样按店铺倍数推送
|
|
|
+ codOrderDTO.setPayAmount(multiplyForJst(totalPrice, amountMultiplier));
|
|
|
|
|
|
PaymentDTO paymentDTO = new PaymentDTO();
|
|
|
- paymentDTO.setAmount(codAmount.doubleValue());
|
|
|
+ paymentDTO.setAmount(multiplyForJst(codAmount, amountMultiplier));
|
|
|
paymentDTO.setOuterPayId(String.format("%s%d", order.getOrderCode(), 1));
|
|
|
paymentDTO.setPayDate(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
|
|
|
paymentDTO.setPayment("货到付款");
|
|
|
@@ -578,8 +584,14 @@ public class FsExternalOrderServiceImpl implements IFsExternalOrderService {
|
|
|
shopOrderDTO.setOrderDate(sdf.format(new Date()));
|
|
|
shopOrderDTO.setShopStatus("WAIT_SELLER_SEND_GOODS");
|
|
|
shopOrderDTO.setShopBuyerId(order.getUserName());
|
|
|
- shopOrderDTO.setPayAmount(order.getTotalPrice().doubleValue());
|
|
|
+ // 推送聚水潭金额倍数:店铺名含「商贸」x2,普通店 x10(仅改推送金额,本地订单不变)
|
|
|
+ BigDecimal amountMultiplier = resolveJstAmountMultiplier(fsStore);
|
|
|
+ BigDecimal totalPrice = order.getTotalPrice() == null ? BigDecimal.ZERO : order.getTotalPrice();
|
|
|
+ BigDecimal payPrice = order.getPayPrice() == null ? BigDecimal.ZERO : order.getPayPrice();
|
|
|
+ shopOrderDTO.setPayAmount(multiplyForJst(totalPrice, amountMultiplier));
|
|
|
shopOrderDTO.setFreight(order.getFreightPrice() != null ? order.getFreightPrice().doubleValue() : 0.0);
|
|
|
+ log.info("外部订单{}推送聚水潭金额倍数={}, 店铺={}, 原总额={}, 原定金={}",
|
|
|
+ order.getOrderCode(), amountMultiplier, fsStore.getStoreName(), totalPrice, payPrice);
|
|
|
|
|
|
StringBuilder remarkBuilder = new StringBuilder();
|
|
|
if (order.getCompanyId() != null) {
|
|
|
@@ -638,7 +650,7 @@ public class FsExternalOrderServiceImpl implements IFsExternalOrderService {
|
|
|
shopOrderDTO.setItems(itemDTOList);
|
|
|
|
|
|
PaymentDTO paymentDTO = new PaymentDTO();
|
|
|
- paymentDTO.setAmount(order.getPayPrice().doubleValue());
|
|
|
+ paymentDTO.setAmount(multiplyForJst(payPrice, amountMultiplier));
|
|
|
paymentDTO.setOuterPayId(order.getOrderCode());
|
|
|
paymentDTO.setPayDate(sdf.format(new Date()));
|
|
|
paymentDTO.setPayment("微信支付");
|
|
|
@@ -649,6 +661,23 @@ public class FsExternalOrderServiceImpl implements IFsExternalOrderService {
|
|
|
return shopOrderDTO;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 推送聚水潭金额倍数:店铺名称包含「商贸」乘 2,否则乘 10
|
|
|
+ */
|
|
|
+ private BigDecimal resolveJstAmountMultiplier(FsStore fsStore) {
|
|
|
+ String storeName = fsStore == null ? null : fsStore.getStoreName();
|
|
|
+ if (StringUtils.isNotBlank(storeName) && storeName.contains("商贸")) {
|
|
|
+ return BigDecimal.valueOf(2);
|
|
|
+ }
|
|
|
+ return BigDecimal.valueOf(10);
|
|
|
+ }
|
|
|
+
|
|
|
+ private double multiplyForJst(BigDecimal amount, BigDecimal multiplier) {
|
|
|
+ BigDecimal base = amount == null ? BigDecimal.ZERO : amount;
|
|
|
+ BigDecimal factor = multiplier == null ? BigDecimal.ONE : multiplier;
|
|
|
+ return base.multiply(factor).doubleValue();
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public void syncOrderStatusFromJst() throws Exception {
|
|
|
FsSysConfig sysConfig = configUtil.getSysConfig();
|
|
|
@@ -930,6 +959,24 @@ public class FsExternalOrderServiceImpl implements IFsExternalOrderService {
|
|
|
return R.error("审核失败");
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public R batchAuditExternalOrder(List<Long> orderIds, String auditor) {
|
|
|
+ if (CollectionUtils.isEmpty(orderIds)) {
|
|
|
+ return R.error("请选择要审核的订单");
|
|
|
+ }
|
|
|
+ int successCount = 0;
|
|
|
+ int skipCount = 0;
|
|
|
+ for (Long orderId : orderIds) {
|
|
|
+ R result = auditExternalOrder(orderId, auditor);
|
|
|
+ if (result != null && Integer.valueOf(200).equals(result.get("code"))) {
|
|
|
+ successCount++;
|
|
|
+ } else {
|
|
|
+ skipCount++;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return R.ok("审核成功 " + successCount + " 条,跳过 " + skipCount + " 条");
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public R cancelExternalOrder(Long orderId) {
|
|
|
FsExternalOrder order = fsExternalOrderMapper.selectFsExternalOrderByOrderId(orderId);
|