|
@@ -340,6 +340,7 @@ public class FsPackageOrderServiceImpl implements IFsPackageOrderService
|
|
|
BigDecimal payDelivery = new BigDecimal(0);
|
|
|
BigDecimal discountMoney = new BigDecimal(0);
|
|
|
String json = configService.selectConfigByKey("his.package");
|
|
|
+ FsSysConfig sysConfig = configUtil.getSysConfig();
|
|
|
PackageConfigDTO configDTO = JSONUtil.toBean(json, PackageConfigDTO.class);
|
|
|
if (param.getUserCouponId() != null && param.getUserCouponId() > 0l) {
|
|
|
FsUserCoupon userCoupon = userCouponService.selectFsUserCouponById(param.getUserCouponId());
|
|
@@ -402,7 +403,7 @@ public class FsPackageOrderServiceImpl implements IFsPackageOrderService
|
|
|
payPrice = orderPrice;
|
|
|
discountMoney = new BigDecimal(0);
|
|
|
}
|
|
|
-
|
|
|
+ //payRemain-代收金额 payDelivery-邮费 payPrice-实际支付金额 payMoney-支付金额
|
|
|
if (payPrice.compareTo(new BigDecimal(0)) == 1) {
|
|
|
if (param.getPayType().equals(1)) {
|
|
|
//全款
|
|
@@ -412,13 +413,35 @@ public class FsPackageOrderServiceImpl implements IFsPackageOrderService
|
|
|
|
|
|
} else if (param.getPayType().equals(2)) {
|
|
|
//代收
|
|
|
- payMoney = payPrice.multiply(new BigDecimal((100 - configDTO.getPayRate()))).divide(new BigDecimal(100));
|
|
|
- payMoney = new BigDecimal(payMoney.setScale(0, BigDecimal.ROUND_HALF_UP).longValue());
|
|
|
+// payMoney = payPrice.multiply(new BigDecimal((100 - configDTO.getPayRate()))).divide(new BigDecimal(100));
|
|
|
+// payMoney = new BigDecimal(payMoney.setScale(0, BigDecimal.ROUND_HALF_UP).longValue());
|
|
|
+// payRemain = payPrice.subtract(payMoney);
|
|
|
+// payDelivery = new BigDecimal(0);
|
|
|
+// if (payRemain.compareTo(new BigDecimal(0)) == 0) {
|
|
|
+// throw new CustomException("代收金额应大于0");
|
|
|
+// }
|
|
|
+ if (sysConfig.getRetainer() != null && sysConfig.getRate() != null && sysConfig.getRate().compareTo(new BigDecimal(0)) > 0) {
|
|
|
+ if (payPrice.compareTo(new BigDecimal(100)) < 0) {
|
|
|
+ throw new CustomException("订单金额应大于等于100");
|
|
|
+ }
|
|
|
+ //有最低定金金额和提成比率
|
|
|
+ if (payPrice.compareTo(new BigDecimal(1000)) < 0) {
|
|
|
+ payMoney = new BigDecimal(100);
|
|
|
+ } else {
|
|
|
+ payMoney = payPrice.multiply(sysConfig.getRate()).divide(new BigDecimal(100));
|
|
|
+ payMoney = new BigDecimal(payMoney.setScale(0, BigDecimal.ROUND_HALF_UP).longValue());
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ payMoney = payPrice.multiply(new BigDecimal((100 - configDTO.getPayRate()))).divide(new BigDecimal(100));
|
|
|
+ payMoney = new BigDecimal(payMoney.setScale(0, BigDecimal.ROUND_HALF_UP).longValue());
|
|
|
+ }
|
|
|
payRemain = payPrice.subtract(payMoney);
|
|
|
payDelivery = new BigDecimal(0);
|
|
|
if (payRemain.compareTo(new BigDecimal(0)) == 0) {
|
|
|
throw new CustomException("代收金额应大于0");
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
} else if (param.getPayType().equals(3)) {
|
|
|
//货到付款
|
|
|
payMoney = configDTO.getPayDelivery();
|