2025008071805
This commit is contained in:
parent
969a7d6543
commit
6320230085
|
|
@ -495,15 +495,6 @@ public class AppleOrderController extends BaseController {
|
|||
|
||||
// 计算服务金抵扣金额
|
||||
Integer serviceFee = configJson.getInteger("servicefee");
|
||||
// if (serviceFee != null && serviceFee > 0) {
|
||||
// // 查询数据库最新用户数据
|
||||
// Users userDb = usersService.selectUsersById(user.getId());
|
||||
// if (userDb != null && userDb.getServicefee() != null && userDb.getServicefee().compareTo(BigDecimal.ZERO) > 0) {
|
||||
// // 服务金抵扣金额 = 用户服务金 * 服务金比例 / 100
|
||||
// BigDecimal serviceRate = BigDecimal.valueOf(serviceFee).divide(BigDecimal.valueOf(100), 4, BigDecimal.ROUND_HALF_UP);
|
||||
// serviceMoney = userDb.getServicefee().multiply(serviceRate);
|
||||
// }
|
||||
// }
|
||||
if (serviceFee != null && serviceFee > 0) {
|
||||
// 查询数据库最新用户数据
|
||||
Users userDb = usersService.selectUsersById(user.getId());
|
||||
|
|
@ -511,6 +502,10 @@ public class AppleOrderController extends BaseController {
|
|||
// 服务金抵扣金额 = 用户服务金 * 服务金比例 / 100
|
||||
BigDecimal serviceRate = BigDecimal.valueOf(serviceFee).divide(BigDecimal.valueOf(100), 4, BigDecimal.ROUND_HALF_UP);
|
||||
serviceMoney = userDb.getServicefee().multiply(serviceRate);
|
||||
//如果服务金抵扣金额大于订单金额,则取订单金额
|
||||
if (serviceMoney.compareTo(totalAmount) > 0) {
|
||||
serviceMoney = totalAmount;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package com.ruoyi.system.ControllerUtil;
|
|||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.ruoyi.common.utils.AmapUtils;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import com.ruoyi.common.utils.spring.SpringUtils;
|
||||
|
|
@ -1056,13 +1057,20 @@ public class OrderUtil {
|
|||
UserAddress userAddress = userAddressService.selectUserAddressById(payBefor.getAddressid());
|
||||
System.out.println("查询到的地址信息: " + (userAddress != null ? userAddress.toString() : "null"));
|
||||
if (userAddress != null) {
|
||||
order.setAdressjson(com.alibaba.fastjson2.JSONObject.parseObject(userAddress.toString()).toJSONString());
|
||||
// order.setAdressjson(com.alibaba.fastjson2.JSONObject.parseObject(userAddress.toString()).toJSONString());
|
||||
order.setAddressId(userAddress.getId());
|
||||
order.setName(userAddress.getName());
|
||||
order.setPhone(userAddress.getPhone());
|
||||
order.setAddress(userAddress.getAddressInfo());
|
||||
System.out.println("地址信息设置完成");
|
||||
}
|
||||
if (userAddress != null) {
|
||||
try {
|
||||
order.setAdressjson(JSON.toJSONString(userAddress));
|
||||
} catch (Exception e) {
|
||||
order.setAdressjson(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
// 可补充其它字段,如拼团价、优惠券、备注等
|
||||
System.out.println("开始插入订单");
|
||||
|
|
|
|||
Loading…
Reference in New Issue