|
|
@@ -35,7 +35,9 @@ import com.sqx.modules.activity.service.ActivityPartRecordService;
|
|
|
import com.sqx.modules.activity.service.ActivityService;
|
|
|
import com.sqx.modules.activity.vo.OrderSuitActivityVO;
|
|
|
import com.sqx.modules.address.entity.Address;
|
|
|
+import com.sqx.modules.address.entity.InsideAddress;
|
|
|
import com.sqx.modules.address.service.AddressService;
|
|
|
+import com.sqx.modules.address.service.InsideAddressService;
|
|
|
import com.sqx.modules.app.dao.UserBrowseDao;
|
|
|
import com.sqx.modules.app.dao.UserDao;
|
|
|
import com.sqx.modules.app.dao.UserMoneyDao;
|
|
|
@@ -51,7 +53,6 @@ import com.sqx.modules.common.service.CommonInfoService;
|
|
|
import com.sqx.modules.coupon.dao.TbCouponUserDao;
|
|
|
import com.sqx.modules.coupon.entity.TbCouponUser;
|
|
|
import com.sqx.modules.datacentre.entity.SysUserShop;
|
|
|
-import com.sqx.modules.errand.dao.TbIndentDao;
|
|
|
import com.sqx.modules.errand.entity.TbIndent;
|
|
|
import com.sqx.modules.errand.entity.TbIndentSmsSendLog;
|
|
|
import com.sqx.modules.errand.service.TbIndentService;
|
|
|
@@ -184,8 +185,6 @@ public class AppAppOrderServiceImpl extends ServiceImpl<AppOrderDao, TbOrder> im
|
|
|
@Autowired
|
|
|
private UserMoneyService userMoneyService;
|
|
|
@Autowired
|
|
|
- private TbIndentDao tbIndentDao;
|
|
|
- @Autowired
|
|
|
private UserBrowseDao userBrowseDao;
|
|
|
@Autowired
|
|
|
private PayDetailsDao payDetailsDao;
|
|
|
@@ -214,16 +213,16 @@ public class AppAppOrderServiceImpl extends ServiceImpl<AppOrderDao, TbOrder> im
|
|
|
private UserIntegralDao userIntegralDao;
|
|
|
@Autowired
|
|
|
private UserIntegralDetailsDao userIntegralDetailsDao;
|
|
|
-
|
|
|
@Autowired
|
|
|
private EvaluateRiderService evaluateRiderService;
|
|
|
@Autowired
|
|
|
private ShopTypeService shopTypeService;
|
|
|
-
|
|
|
@Autowired
|
|
|
private GoodsShopService goodsShopService;
|
|
|
|
|
|
@Resource
|
|
|
+ private InsideAddressService insideAddressService;
|
|
|
+ @Resource
|
|
|
private RedissonClient redissonClient;
|
|
|
|
|
|
private final static String RHT_PAY_BASE_URL = "https://api.ekbuyclub.com";
|
|
|
@@ -1018,7 +1017,7 @@ public class AppAppOrderServiceImpl extends ServiceImpl<AppOrderDao, TbOrder> im
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 计算店铺收益 店铺订单收益=订单应付金额+订单使用的优惠券金额-跑腿费用
|
|
|
+ * 计算店铺收益 店铺订单收益=订单应付金额+订单使用的优惠券金额-跑腿费用-校内配送费用
|
|
|
*
|
|
|
* @param order 订单信息
|
|
|
* @param goodsShop 店铺信息
|
|
|
@@ -1032,6 +1031,8 @@ public class AppAppOrderServiceImpl extends ServiceImpl<AppOrderDao, TbOrder> im
|
|
|
sumMoney = sumMoney.subtract(goodsShop.getErrandMoney());
|
|
|
}
|
|
|
|
|
|
+ sumMoney = sumMoney.subtract(order.getInsideDeliveryFee());
|
|
|
+
|
|
|
BigDecimal shopMoney = sumMoney.multiply(shopRate);
|
|
|
order.setShopIncomeMoney(shopMoney.setScale(2, BigDecimal.ROUND_DOWN));
|
|
|
|
|
|
@@ -1108,6 +1109,12 @@ public class AppAppOrderServiceImpl extends ServiceImpl<AppOrderDao, TbOrder> im
|
|
|
throw new SqxException("超出商家配送范围,无法点餐!");
|
|
|
}
|
|
|
|
|
|
+ Long insideAddressId = address.getInsideAddressId();
|
|
|
+ if (ObjectUtil.isNotNull(insideAddressId)) {
|
|
|
+ InsideAddress insideAddress = insideAddressService.getById(insideAddressId);
|
|
|
+ order.setInsideDeliveryFee(insideAddress.getDeliveryFee());
|
|
|
+ }
|
|
|
+
|
|
|
// 店铺是否开启配送费满减 0是 1否
|
|
|
Integer enableFullReductionFlag = goodsShop.getEnableFullReductionFlag() != null ? goodsShop.getEnableFullReductionFlag() : 1;
|
|
|
// 店铺跑腿费
|
|
|
@@ -1141,6 +1148,9 @@ public class AppAppOrderServiceImpl extends ServiceImpl<AppOrderDao, TbOrder> im
|
|
|
|
|
|
order.setErrandMoney(shopErrandMoney);
|
|
|
|
|
|
+ // 支付金额加入内部配送费
|
|
|
+ order.setPayMoney(order.getPayMoney().add(order.getInsideDeliveryFee()));
|
|
|
+
|
|
|
// 判断订单金额是否大于最低起送金额
|
|
|
if (goodsShop.getMinimumDelivery() == null) {
|
|
|
goodsShop.setMinimumDelivery(BigDecimal.valueOf(0));
|
|
|
@@ -1165,8 +1175,7 @@ public class AppAppOrderServiceImpl extends ServiceImpl<AppOrderDao, TbOrder> im
|
|
|
order.setErrandMoney(BigDecimal.ZERO);
|
|
|
}
|
|
|
|
|
|
- log.info("preOrder==>[{}],订单跑腿费计算结束,跑腿费[{}],当前订单应付总价[{}]",
|
|
|
- order.getOrderId(), order.getErrandMoney(), order.getPayMoney());
|
|
|
+ log.info("preOrder==>[{}],订单跑腿费计算结束,跑腿费[{}],校内配送费[{}],当前订单应付总价[{}]", order.getOrderId(), order.getErrandMoney(), order.getInsideDeliveryFee(), order.getPayMoney());
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -1775,6 +1784,9 @@ public class AppAppOrderServiceImpl extends ServiceImpl<AppOrderDao, TbOrder> im
|
|
|
sumMoney = sumMoney.subtract(goodsShop.getErrandMoney());
|
|
|
}
|
|
|
|
|
|
+ // 再减去校内配送费
|
|
|
+ sumMoney = sumMoney.subtract(tbOrder.getInsideDeliveryFee());
|
|
|
+
|
|
|
BigDecimal shopMoney = sumMoney.multiply(shopRate);
|
|
|
shopMoney = (shopMoney.setScale(2, BigDecimal.ROUND_DOWN));
|
|
|
tbOrder.setShopIncomeMoney(shopMoney);
|
|
|
@@ -2086,6 +2098,9 @@ public class AppAppOrderServiceImpl extends ServiceImpl<AppOrderDao, TbOrder> im
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ // 再减去校内配送费
|
|
|
+ sumMoney = sumMoney.subtract(tbOrder.getInsideDeliveryFee());
|
|
|
+
|
|
|
// 店铺收入
|
|
|
BigDecimal shopMoney = sumMoney.multiply(shopRate);
|
|
|
shopMoney = shopMoney.setScale(2, BigDecimal.ROUND_DOWN);
|
|
|
@@ -2158,6 +2173,7 @@ public class AppAppOrderServiceImpl extends ServiceImpl<AppOrderDao, TbOrder> im
|
|
|
contentBuffer.append("跑腿费:").append(errandMoney.setScale(2, BigDecimal.ROUND_DOWN)).append("(").append(tbOrder.getErrandMoneyIsShop()).append(")").append(",");
|
|
|
}
|
|
|
|
|
|
+ contentBuffer.append("特殊地址跑腿费:").append(tbOrder.getInsideDeliveryFee().setScale(2, BigDecimal.ROUND_DOWN)).append(",");
|
|
|
contentBuffer.append("平台服务费:").append(pingRate.setScale(2, BigDecimal.ROUND_DOWN)).append(",");
|
|
|
contentBuffer.append("短信服务费:").append(smsSendMoney.setScale(2, BigDecimal.ROUND_DOWN)).append(",");
|
|
|
contentBuffer.append("到账金额:").append(shopMoney.setScale(2, BigDecimal.ROUND_DOWN));
|