打包费

This commit is contained in:
Jack 2025-08-16 00:16:23 +08:00
parent b6896e177a
commit 186ae11fec
3 changed files with 26 additions and 16 deletions

View File

@ -6401,7 +6401,6 @@ public class ShopOrderBaseServiceImpl extends BaseServiceImpl<ShopOrderBaseMappe
Integer chain_store_id = chain_row.getStore_id();
Integer base_store_id = (Integer) base_row.get("store_id");
// 订单信息保存处理
if (flag) {
String product_item_name = item_items.stream().map(s -> Convert.toStr(s.get("product_item_name"))).collect(Collectors.joining("|"));

View File

@ -2340,13 +2340,15 @@ public class ShopStoreBaseServiceImpl extends BaseServiceImpl<ShopStoreBaseMappe
// 打包费
BigDecimal packingFee = Convert.toBigDecimal(getParameter("packing_fee"));
if (packingFee != null && packingFee.compareTo(BigDecimal.ZERO) > 0) {
if (packingFee.compareTo(new BigDecimal("10")) > 0) {
return CommonResult.failed("打包费请控制在0到10元范围");
}
base.setPacking_fee(packingFee);
if (packingFee == null || packingFee.compareTo(BigDecimal.ZERO) <= 0) {
base.setPacking_fee(BigDecimal.ZERO);
}
if (packingFee.compareTo(new BigDecimal("10")) > 0) {
return CommonResult.failed("打包费请控制在0到10元范围");
}
base.setPacking_fee(packingFee);
// 百度坐标系BD09经纬度 转出 火星坐标系GCJ02经纬度 因为数据库保存的经纬度统一是GCJ02经纬度所以需要转换
base = bd09ToGcj02Gps(base);
@ -2499,15 +2501,17 @@ public class ShopStoreBaseServiceImpl extends BaseServiceImpl<ShopStoreBaseMappe
}
}
// 打包费联系人联系人手机
// 打包费
BigDecimal packingFee = Convert.toBigDecimal(getParameter("packing_fee"));
if (packingFee != null && packingFee.compareTo(BigDecimal.ZERO) > 0) {
if (packingFee.compareTo(new BigDecimal("10")) > 0) {
return CommonResult.failed("打包费请控制在0到10元范围");
}
base.setPacking_fee(packingFee);
if (packingFee == null || packingFee.compareTo(BigDecimal.ZERO) <= 0) {
base.setPacking_fee(BigDecimal.ZERO);
}
if (packingFee.compareTo(new BigDecimal("10")) > 0) {
return CommonResult.failed("打包费请控制在0到10元范围");
}
base.setPacking_fee(packingFee);
// 百度坐标系BD09经纬度 转出 火星坐标系GCJ02经纬度 因为数据库保存的经纬度统一是GCJ02经纬度所以需要转换
base = bd09ToGcj02Gps(base);

View File

@ -419,7 +419,7 @@ public class ShopUserCartServiceImpl extends BaseServiceImpl<ShopUserCartMapper,
// 采购判断 先放入此处
String from = getParameter("from");
Integer item_quantity = Convert.toInt(item_row.get("item_quantity"));
if(StringUtils.isNotEmpty(from)){
if (StringUtils.isNotEmpty(from)) {
if ("manage".equals(from) && item_quantity < cart_quantity) {
throw new ApiException(I18nUtil._("当前商品只可购买") + item_quantity + I18nUtil._("件,请确认!"));
} else if ("manage".equals(from) && cart_quantity <= 0) {
@ -429,7 +429,7 @@ public class ShopUserCartServiceImpl extends BaseServiceImpl<ShopUserCartMapper,
throw new ApiException(ResultCode.FAILED);
}
}
}else {
} else {
if (item_quantity < cart_quantity) {
throw new ApiException(I18nUtil._("当前商品只可购买") + item_quantity + I18nUtil._("件,请确认!"));
} else if (cart_quantity <= 0) {
@ -597,7 +597,7 @@ public class ShopUserCartServiceImpl extends BaseServiceImpl<ShopUserCartMapper,
cartQueryWrapper.eq("store_id", checked_store);
}
// 从购物车里获取商品信息
// 从购物车里获取商品信息, 加入购物车时已经计算了运费优惠打包费等信息
data = getLists(cartQueryWrapper, 1, 500);
} else {
// 直接点击购买数据检测
@ -1302,6 +1302,7 @@ public class ShopUserCartServiceImpl extends BaseServiceImpl<ShopUserCartMapper,
BigDecimal orderSelPointsAmount = BigDecimal.ZERO;//商品订单积分抵扣金额
BigDecimal orderSelSpAmount = BigDecimal.ZERO;//可能是商品订单促销金额
BigDecimal orderRebateAmount = BigDecimal.ZERO;//可能是商品订单返利金额
BigDecimal packingFee = BigDecimal.ZERO; // 商家打包费
data_rows.put("orderSelMoneyAmount", 10.00f); // 这是什么金额最低支付金额吗
data_rows.put("items", new ArrayList());
@ -1403,6 +1404,7 @@ public class ShopUserCartServiceImpl extends BaseServiceImpl<ShopUserCartMapper,
List<ShopStoreConfig> storeConfigs = shopStoreConfigService.gets(storeIds);
for (Map store_row : store_rows) {
// 店铺Id
Integer store_id = Convert.toInt(store_row.get("store_id"));
List<Map> stand_item_row_list = (List<Map>) ObjectUtil.defaultIfNull(store_items_rows.get(store_id), new ArrayList());
store_row.put("items", stand_item_row_list);
@ -1431,7 +1433,7 @@ public class ShopUserCartServiceImpl extends BaseServiceImpl<ShopUserCartMapper,
activitys.put("multple", new ArrayList());
activitys.put("coupons", new HashMap<>());
activitys.put("postFree", new HashMap<>());
// 封装
// 封装读取活动信息
store_row.put("activitys", activitys);
//促销活动商品通过SKU商品存入SPU管理数据方便
@ -1597,6 +1599,7 @@ public class ShopUserCartServiceImpl extends BaseServiceImpl<ShopUserCartMapper,
BigDecimal store_sp_total = BigDecimal.ZERO;
BigDecimal store_old_amount = BigDecimal.ZERO;
// 店铺里的订单列表
for (Map item_row : items) {
// 快速修正订单价格
if (fixOrderVo != null && fixOrderVo.isFix_price()) {
@ -2214,6 +2217,9 @@ public class ShopUserCartServiceImpl extends BaseServiceImpl<ShopUserCartMapper,
store_row.put("productSpSel", store_sp_total);
store_row.put("order_money_select_items", NumberUtil.sub(store_total, activityDiscountMoney));
// 店铺订单打包费
// store_row.put("packing_fee", packingFee);
//BigDecimal item_discount_amount_sum = items.stream().map(s -> Convert.toBigDecimal(s.get("item_discount_amount"), BigDecimal.ZERO)).reduce(BigDecimal::add).get();
//item_discount_amount 数据实时放入 activityDiscountMoney, pulseActivityDiscountMoney 不重叠放入二选一
@ -2226,6 +2232,7 @@ public class ShopUserCartServiceImpl extends BaseServiceImpl<ShopUserCartMapper,
store_row.put("postFreeBalance", 0); // 还需postFreeBalance元即可免邮费
store_row.put("activity_discount_amount", order_activity_discount_amount);
// 关键订单金额数据
orderSelProductAmount = orderSelProductAmount.add(store_origin_total);
orderSelFreightAmount = orderSelFreightAmount.add(Convert.toBigDecimal(store_row.get("freight"))); // 重要订单运费金额