顺丰同城相关接口方法完善
This commit is contained in:
parent
15ece62c7f
commit
a820c7bbdf
@ -13,7 +13,7 @@ public class ApiException extends RuntimeException {
|
||||
this.errorCode = errorCode;
|
||||
}
|
||||
|
||||
public ApiException(IErrorCode errorCode,String appendMessage) {
|
||||
public ApiException(IErrorCode errorCode, String appendMessage) {
|
||||
super(errorCode.getMessage() + ":" + appendMessage);
|
||||
this.errorCode = errorCode;
|
||||
}
|
||||
|
||||
@ -32,6 +32,9 @@ public class SFCreateOrderReq implements Serializable {
|
||||
@ApiModelProperty("商家订单号")
|
||||
private String shop_order_id;
|
||||
|
||||
@ApiModelProperty("订单接入来源")
|
||||
private String order_source;
|
||||
|
||||
@ApiModelProperty("取货序号")
|
||||
private String order_sequence;
|
||||
|
||||
|
||||
@ -73,16 +73,20 @@ public class OrderPayedListener {
|
||||
logger.info("#### 支付异步通知回调处理是否成功:{} ####", flag);
|
||||
// 生成取单号和打印小票
|
||||
if (flag) {
|
||||
// TODO 以下仅处理下单打印的情况,还需要处理退单打印分支。
|
||||
logger.info("####开始生成订单{}的取单号####", orderId);
|
||||
|
||||
ShopOrderInfo orderInfo = new ShopOrderInfo();
|
||||
orderInfo.setOrder_id(orderId);
|
||||
// 生成取单号,写入order_info
|
||||
orderInfo.setOrder_pickup_num(shopOrderInfoService.genTodayPickupNum(orderInfoOld.getStore_id()));
|
||||
Long orderPickupNum = shopOrderInfoService.genTodayPickupNum(orderInfoOld.getStore_id());
|
||||
orderInfo.setOrder_pickup_num(orderPickupNum);
|
||||
shopOrderInfoService.edit(orderInfo);
|
||||
|
||||
// 订单状态处理成功之后,打印小票
|
||||
shopStorePrinterService.printShopStoreOrder(orderId);
|
||||
|
||||
// 发送顺丰同城快递
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -4,6 +4,7 @@ import com.suisung.mall.common.api.CommonResult;
|
||||
import com.suisung.mall.common.modules.order.ShopOrderBase;
|
||||
import com.suisung.mall.common.modules.order.ShopOrderInfo;
|
||||
import com.suisung.mall.common.modules.order.ShopOrderLogistics;
|
||||
import com.suisung.mall.common.pojo.req.SFCreateOrderReq;
|
||||
import com.suisung.mall.core.web.service.IBaseService;
|
||||
import com.suisung.mall.shop.order.vo.OrdeListVo;
|
||||
import com.suisung.mall.shop.product.pojo.vo.FixOrderVo;
|
||||
@ -518,4 +519,14 @@ public interface ShopOrderBaseService extends IBaseService<ShopOrderBase> {
|
||||
* @return
|
||||
*/
|
||||
Map getOrderPrintInfo(@Param("orderId") String orderId, @Param("payState") Integer payState);
|
||||
|
||||
|
||||
/**
|
||||
* 根据订单Id,生成顺丰同城的订单实体实例
|
||||
* @param devId
|
||||
* @param orderId
|
||||
* @param orderPickupNum
|
||||
* @return
|
||||
*/
|
||||
SFCreateOrderReq buildSFOrderData(Integer devId,String orderId,String orderPickupNum);
|
||||
}
|
||||
|
||||
@ -12,5 +12,10 @@ import com.suisung.mall.core.web.service.IBaseService;
|
||||
* @since 2021-06-16
|
||||
*/
|
||||
public interface ShopOrderDeliveryAddressService extends IBaseService<ShopOrderDeliveryAddress> {
|
||||
|
||||
/**
|
||||
* 根据订单ID获取订单发货地址
|
||||
* @param orderId
|
||||
* @return
|
||||
*/
|
||||
ShopOrderDeliveryAddress selectByOrderId(String orderId);
|
||||
}
|
||||
|
||||
@ -54,6 +54,9 @@ import com.suisung.mall.common.modules.product.ShopProductItem;
|
||||
import com.suisung.mall.common.modules.product.ShopProductValidPeriod;
|
||||
import com.suisung.mall.common.modules.store.*;
|
||||
import com.suisung.mall.common.modules.user.*;
|
||||
import com.suisung.mall.common.pojo.req.SFCreateOrderReq;
|
||||
import com.suisung.mall.common.pojo.req.SFOrderReceiveReq;
|
||||
import com.suisung.mall.common.pojo.req.SFOrderShopReq;
|
||||
import com.suisung.mall.common.pojo.to.MsgTO;
|
||||
import com.suisung.mall.common.pojo.to.PayMoneyTO;
|
||||
import com.suisung.mall.common.pojo.to.PayPointTO;
|
||||
@ -104,6 +107,7 @@ import org.springframework.transaction.TransactionDefinition;
|
||||
import org.springframework.transaction.TransactionStatus;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.io.Serializable;
|
||||
@ -342,8 +346,12 @@ public class ShopOrderBaseServiceImpl extends BaseServiceImpl<ShopOrderBaseMappe
|
||||
@Autowired
|
||||
private ShopActivityCutpriceService shopActivityCutpriceService;
|
||||
|
||||
@Resource
|
||||
private ShopOrderDeliveryAddressService shopOrderDeliveryAddressService;
|
||||
|
||||
private Logger logger = LoggerFactory.getLogger(ShopOrderBaseServiceImpl.class);
|
||||
|
||||
|
||||
@Override
|
||||
public List<Map<String, Object>> statisticState() {
|
||||
UserDto user = getCurrentUser();
|
||||
@ -1286,6 +1294,7 @@ public class ShopOrderBaseServiceImpl extends BaseServiceImpl<ShopOrderBaseMappe
|
||||
Map cart_data;
|
||||
|
||||
if (!force_bind_mobile || CollUtil.isNotEmpty(userBind)) {
|
||||
// 手机绑定的情况
|
||||
Integer chain_id = Convert.toInt(getParameter("chain_id"));
|
||||
Boolean if_chain = Convert.toBool(getParameter("if_chain"), false);
|
||||
Integer checked_store = getParameter("checked_store", 0);
|
||||
@ -1480,6 +1489,7 @@ public class ShopOrderBaseServiceImpl extends BaseServiceImpl<ShopOrderBaseMappe
|
||||
// 添加订单
|
||||
List<String> order_id_row = addOrder(cart_data, true, false, null);
|
||||
|
||||
// 最终应付金额
|
||||
BigDecimal orderSelMoneyAmount = Convert.toBigDecimal(cart_data.get("orderSelMoneyAmount"));
|
||||
|
||||
if (CollUtil.isNotEmpty(order_id_row) && ObjectUtil.compare(orderSelMoneyAmount, BigDecimal.ZERO) <= 0) {
|
||||
@ -2788,6 +2798,7 @@ public class ShopOrderBaseServiceImpl extends BaseServiceImpl<ShopOrderBaseMappe
|
||||
logger.error("order_rows 订单空!");
|
||||
throw new ApiException(ResultCode.FAILED);
|
||||
}
|
||||
|
||||
// 修改订单状态, 随机去一个订单获取店铺编号
|
||||
ShopOrderInfo order_row = order_rows.get(0);
|
||||
|
||||
@ -3000,7 +3011,6 @@ public class ShopOrderBaseServiceImpl extends BaseServiceImpl<ShopOrderBaseMappe
|
||||
|
||||
if (ObjectUtil.equal(StateCode.PRODUCT_KIND_CARD, kindId)) {
|
||||
// 卡券类,发送code, 则代表交易完成,类似充话费、虚拟卡号等等
|
||||
|
||||
}
|
||||
|
||||
// 生成提货码
|
||||
@ -3157,7 +3167,6 @@ public class ShopOrderBaseServiceImpl extends BaseServiceImpl<ShopOrderBaseMappe
|
||||
accountUserAnalytics.setUser_product_buy_num(order_item_quantity + ObjectUtil.defaultIfNull(accountUserAnalytics.getUser_product_buy_num(), 0));
|
||||
|
||||
mqMessageVos.add(new MqMessageVo(MqConstant.ACCOUNT_EXCHANGE, MqConstant.ACCOUNT_ANALYTICS_ROUTING_KEY, JSONUtil.parseObj(accountUserAnalytics)));
|
||||
// todo
|
||||
|
||||
// 检测升级
|
||||
AccountUserAnalytics analytics = accountService.getUserAnalytics(user_id);
|
||||
@ -8271,9 +8280,68 @@ public class ShopOrderBaseServiceImpl extends BaseServiceImpl<ShopOrderBaseMappe
|
||||
m.put("order_items", orderItems);//订单商品列表
|
||||
m.put("order_items_count", orderItems.size());//商品数量
|
||||
|
||||
// 配送时间= 支付时间+20分钟
|
||||
m.put("delivery_time", DateUtil.offsetMinute((Date) m.get("payment_time"), 20));
|
||||
// 配送时间= 支付时间+25分钟
|
||||
m.put("delivery_time", DateUtil.offsetMinute((Date) m.get("payment_time"), 25));
|
||||
|
||||
return m;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据订单Id,生成顺丰同城的订单实体实例
|
||||
* 1、订单整体信息,和订单产品信息
|
||||
* 2、商家的详细地址、电话和经纬度
|
||||
* 3、收货人的姓名、电话、详细地址、经纬度
|
||||
*
|
||||
* @param orderId
|
||||
* @return
|
||||
*/
|
||||
public SFCreateOrderReq buildSFOrderData(Integer devId,String orderId,String orderPickupNum) {
|
||||
if (StrUtil.isBlank(orderId)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
ShopStoreBase shopStoreBase = shopStoreBaseService.get(orderId);
|
||||
ShopStoreInfo shopStoreInfo = shopStoreInfoService.get(orderId);
|
||||
ShopOrderDeliveryAddress shopOrderDeliveryAddress = shopOrderDeliveryAddressService.selectByOrderId(orderId);
|
||||
if (shopStoreBase == null || shopStoreInfo == null || shopOrderDeliveryAddress == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
SFCreateOrderReq sfCreateOrderReq = new SFCreateOrderReq();
|
||||
sfCreateOrderReq.setDev_id(devId);
|
||||
sfCreateOrderReq.setShop_id(shopStoreBase.getStore_id().toString());
|
||||
sfCreateOrderReq.setPush_time(DateUtil.currentSeconds());
|
||||
sfCreateOrderReq.setShop_order_id(orderId);
|
||||
sfCreateOrderReq.setOrder_time(DateUtil.currentSeconds());
|
||||
sfCreateOrderReq.setOrder_source("小发同城");
|
||||
sfCreateOrderReq.setOrder_sequence(orderPickupNum);
|
||||
sfCreateOrderReq.setVersion(19);
|
||||
sfCreateOrderReq.setReturn_flag(511);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// 店铺信息(发货人信息)
|
||||
SFOrderShopReq sfOrderShopReq = new SFOrderShopReq();
|
||||
sfOrderShopReq.setShop_name(shopStoreBase.getStore_name());
|
||||
sfOrderShopReq.setShop_phone(shopStoreInfo.getStore_tel());
|
||||
sfOrderShopReq.setShop_address(shopStoreBase.getStore_address());
|
||||
sfOrderShopReq.setShop_lng(shopStoreBase.getStore_longitude());
|
||||
sfOrderShopReq.setShop_lat(shopStoreBase.getStore_latitude());
|
||||
|
||||
sfCreateOrderReq.setShop(sfOrderShopReq);
|
||||
|
||||
// 收货人信息
|
||||
SFOrderReceiveReq receive = new SFOrderReceiveReq();
|
||||
receive.setUser_name(shopOrderDeliveryAddress.getDa_name());
|
||||
receive.setUser_phone(shopOrderDeliveryAddress.getDa_telephone());
|
||||
receive.setUser_address(shopOrderDeliveryAddress.getDa_address());
|
||||
receive.setUser_lng(shopOrderDeliveryAddress.getDa_longitude());
|
||||
receive.setUser_lat(shopOrderDeliveryAddress.getDa_latitude());
|
||||
|
||||
sfCreateOrderReq.setReceive(receive);
|
||||
|
||||
return sfCreateOrderReq;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
package com.suisung.mall.shop.order.service.impl;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.suisung.mall.common.modules.order.ShopOrderDeliveryAddress;
|
||||
import com.suisung.mall.core.web.service.impl.BaseServiceImpl;
|
||||
import com.suisung.mall.shop.order.mapper.ShopOrderDeliveryAddressMapper;
|
||||
@ -17,4 +18,18 @@ import org.springframework.stereotype.Service;
|
||||
*/
|
||||
@Service
|
||||
public class ShopOrderDeliveryAddressServiceImpl extends BaseServiceImpl<ShopOrderDeliveryAddressMapper, ShopOrderDeliveryAddress> implements ShopOrderDeliveryAddressService {
|
||||
/**
|
||||
* 根据订单ID获取订单发货地址
|
||||
*
|
||||
* @param orderId
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public ShopOrderDeliveryAddress selectByOrderId(String orderId) {
|
||||
if(StrUtil.isBlank(orderId)){
|
||||
return null;
|
||||
}
|
||||
|
||||
return getById(orderId);
|
||||
}
|
||||
}
|
||||
|
||||
@ -45,7 +45,7 @@ public class SFExpressApiServiceImpl implements SFExpressApiService {
|
||||
@Value("${sf-express.appkey}")
|
||||
private String appKey;
|
||||
@Value("${sf-express.dev_id}")
|
||||
private String devId;
|
||||
private Integer devId;
|
||||
|
||||
@Resource
|
||||
private ShopStoreSfOrderService shopStoreSfOrderService;
|
||||
@ -60,16 +60,17 @@ public class SFExpressApiServiceImpl implements SFExpressApiService {
|
||||
|
||||
Long now = DateUtil.currentSeconds();
|
||||
|
||||
SFCreateOrderReq param = new SFCreateOrderReq();
|
||||
param.setDev_id(1711573316);
|
||||
param.setVersion(19);
|
||||
param.setOrder_time(now);
|
||||
param.setPush_time(now);
|
||||
param.setRemark("测试顺丰同城发单,请不要通知骑手接单!");
|
||||
param.setOrder_sequence("000000123");
|
||||
param.setShop_id("3243279847393");
|
||||
param.setShop_order_id(shopOrderId); //"DD-20241118-00001"
|
||||
param.setReturn_flag(511);
|
||||
SFCreateOrderReq sfOrder = new SFCreateOrderReq();
|
||||
sfOrder.setDev_id(1711573316);
|
||||
sfOrder.setVersion(19);
|
||||
sfOrder.setOrder_time(now);
|
||||
sfOrder.setPush_time(now);
|
||||
sfOrder.setRemark("测试顺丰同城发单,请不要通知骑手接单!");
|
||||
sfOrder.setOrder_source("小发同城");
|
||||
sfOrder.setOrder_sequence("000000123"); // 打票机的取单号
|
||||
sfOrder.setShop_id("3243279847393");
|
||||
sfOrder.setShop_order_id(shopOrderId); //"DD-20241118-00001"
|
||||
sfOrder.setReturn_flag(511);
|
||||
|
||||
SFOrderDetailReq orderDetail = new SFOrderDetailReq();
|
||||
orderDetail.setTotal_price(2000);
|
||||
@ -89,28 +90,28 @@ public class SFExpressApiServiceImpl implements SFExpressApiService {
|
||||
|
||||
orderDetail.setProduct_detail(orderProductList);
|
||||
|
||||
param.setOrder_detail(orderDetail);
|
||||
sfOrder.setOrder_detail(orderDetail);
|
||||
|
||||
SFOrderShopReq sender = new SFOrderShopReq();
|
||||
sender.setShop_name("顺丰同城开放平台");
|
||||
sender.setShop_address("蜂巢工场西区");
|
||||
sender.setShop_phone("13203559287");
|
||||
sender.setShop_lng("116.327914");
|
||||
sender.setShop_lat("40.045488");
|
||||
param.setShop(sender);
|
||||
SFOrderShopReq shop = new SFOrderShopReq();
|
||||
shop.setShop_name("顺丰同城开放平台");
|
||||
shop.setShop_address("蜂巢工场西区");
|
||||
shop.setShop_phone("13203559287");
|
||||
shop.setShop_lng("116.327914");
|
||||
shop.setShop_lat("40.045488");
|
||||
sfOrder.setShop(shop);
|
||||
|
||||
|
||||
SFOrderReceiveReq receiver = new SFOrderReceiveReq();
|
||||
receiver.setUser_name("顺丰同城");
|
||||
receiver.setUser_phone("13881979410");
|
||||
receiver.setUser_address("北京市海淀区学清嘉创大厦A座15层");
|
||||
receiver.setUser_lng("116.352843");
|
||||
receiver.setUser_lat("40.015028");
|
||||
param.setReceive(receiver);
|
||||
SFOrderReceiveReq receive = new SFOrderReceiveReq();
|
||||
receive.setUser_name("顺丰同城");
|
||||
receive.setUser_phone("13881979410");
|
||||
receive.setUser_address("北京市海淀区学清嘉创大厦A座15层");
|
||||
receive.setUser_lng("116.352843");
|
||||
receive.setUser_lat("40.015028");
|
||||
sfOrder.setReceive(receive);
|
||||
|
||||
|
||||
// 转换 json 字符串参数
|
||||
String paramJSON = JsonUtil.toJSONString(param);
|
||||
String paramJSON = JsonUtil.toJSONString(sfOrder);
|
||||
|
||||
// 根据参数生成请求签名
|
||||
String send_url = buildUrl("createorder", paramJSON);
|
||||
@ -139,18 +140,18 @@ public class SFExpressApiServiceImpl implements SFExpressApiService {
|
||||
|
||||
String retRespStr = HttpUtil.post(send_url, paramJSON);
|
||||
if (StrUtil.isEmpty(retRespStr)) {
|
||||
logger.error("顺丰同城:创建订单异常,无返回值!");
|
||||
return Pair.of(false, "创建订单异常,无返回值!");
|
||||
logger.error("创建顺丰同城订单异常,无返回值!");
|
||||
return Pair.of(false, "创建顺丰同城订单异常,无返回值!");
|
||||
}
|
||||
|
||||
JSONObject sfExpressApiRes = JSONUtil.parseObj(retRespStr); //JsonUtil.json2object(retRespStr, SFExpressApiRes.class);
|
||||
JSONObject sfExpressApiRes = JSONUtil.parseObj(retRespStr);
|
||||
if (sfExpressApiRes == null) {
|
||||
logger.error("顺丰同城:创建订单后异常,无返回值!");
|
||||
return Pair.of(false, "创建订单后异常,无返回值!");
|
||||
logger.error("创建顺丰同城订单后异常,无返回值!");
|
||||
return Pair.of(false, "创建顺丰同城订单后异常,无返回值!");
|
||||
}
|
||||
|
||||
if (!sfExpressApiRes.get("error_code").equals(0) || sfExpressApiRes.get("result") == null) {
|
||||
logger.error("顺丰同城:创建订单后,发生错误 {}", sfExpressApiRes.get("error_msg"));
|
||||
logger.error("创建顺丰同城订单后,发生错误 {}", sfExpressApiRes.get("error_msg"));
|
||||
return Pair.of(false, Convert.toStr(sfExpressApiRes.get("error_msg")));
|
||||
}
|
||||
|
||||
@ -161,15 +162,15 @@ public class SFExpressApiServiceImpl implements SFExpressApiService {
|
||||
// 下单成功,保存顺丰同城订单记录到 shop_store_sf_order 表里
|
||||
Boolean success = shopStoreSfOrderService.insertShopStoreSfOrder(shopStoreSfOrder);
|
||||
if (!success) {
|
||||
return Pair.of(false, "顺丰同城订单保存失败!");
|
||||
return Pair.of(false, "保存顺丰同城订单失败!");
|
||||
}
|
||||
|
||||
// 取件码。在顺丰同城商户侧配置,配置后有此字段。
|
||||
String pickupCode = shopStoreSfOrder.getPickup_code() != null ? shopStoreSfOrder.getPickup_code().toString() : "";
|
||||
// String pickupCode = shopStoreSfOrder.getPickup_code() != null ? shopStoreSfOrder.getPickup_code().toString() : "";
|
||||
|
||||
// TODO 商城订单状态:从 待发货 更改为 待收货
|
||||
|
||||
return Pair.of(true, pickupCode);
|
||||
return Pair.of(true, "");
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -547,9 +547,9 @@ public class ShopUserCartServiceImpl extends BaseServiceImpl<ShopUserCartMapper,
|
||||
activity_rows = shopStoreActivityBaseService.getActivityFormatOne(activity_id, quantity);
|
||||
}
|
||||
|
||||
// 从购物车进来
|
||||
if (StrUtil.isBlank(cart_id) || (ifcart != null && ifcart != 0)) {
|
||||
|
||||
if (StrUtil.isBlank(cart_id) || (ifcart != null && ifcart != 0)) {
|
||||
// 从购物车进来
|
||||
QueryWrapper<ShopUserCart> cartQueryWrapper = new QueryWrapper<>();
|
||||
cartQueryWrapper.eq("user_id", user_id)
|
||||
.eq("chain_id", chain_id)
|
||||
@ -563,7 +563,7 @@ public class ShopUserCartServiceImpl extends BaseServiceImpl<ShopUserCartMapper,
|
||||
// 从购物车里获取商品信息
|
||||
data = getLists(cartQueryWrapper, 1, 500);
|
||||
} else {
|
||||
// 直接购买,数据检测
|
||||
// 直接点击购买,数据检测
|
||||
if (StrUtil.isNotBlank(cart_id)) {
|
||||
List<String> item_info_row = StrUtil.split(cart_id, ",");
|
||||
|
||||
@ -575,7 +575,7 @@ public class ShopUserCartServiceImpl extends BaseServiceImpl<ShopUserCartMapper,
|
||||
|
||||
int[] item_row = StrUtil.splitToInt(item, "|");
|
||||
if (item_row[1] <= 0) {
|
||||
throw new ApiException(I18nUtil._("至少购买1个有效商品!"));
|
||||
throw new ApiException(I18nUtil._("至少选购1个商品!"));
|
||||
}
|
||||
|
||||
// 购买的商品记录
|
||||
@ -605,7 +605,7 @@ public class ShopUserCartServiceImpl extends BaseServiceImpl<ShopUserCartMapper,
|
||||
}
|
||||
|
||||
Integer product_inventory_warning = accountBaseConfigService.getConfig("product_inventory_warning", 5);
|
||||
// 商品数量小于5个,通知卖家
|
||||
// 商品库存数量小于5个,通知卖家
|
||||
if ((item_quantity - item_quantity_frozen) < product_inventory_warning) {
|
||||
// todo 发送消息
|
||||
String message_id = "commodity-inventory-notice";
|
||||
@ -653,7 +653,7 @@ public class ShopUserCartServiceImpl extends BaseServiceImpl<ShopUserCartMapper,
|
||||
cart_row.put("pfgb_id", pfgb_id);
|
||||
}
|
||||
|
||||
// 生成订单数据,结算checkout预览及生成订单
|
||||
// 生成订单数据,结算checkout预览及生成订单(关键函数)
|
||||
data = formatCartRows(cart_rows, activity_rows, null, null);
|
||||
}
|
||||
}
|
||||
@ -741,7 +741,7 @@ public class ShopUserCartServiceImpl extends BaseServiceImpl<ShopUserCartMapper,
|
||||
if (CollUtil.isNotEmpty(delivery_address_row) && CheckUtil.isNotEmpty(district_id)) {
|
||||
// 计算邮费情况
|
||||
if (Convert.toBool(is_delivery)) {
|
||||
// 配送检测和计算
|
||||
// 配送运费校验和计算
|
||||
calTransportFreight(data, district_id);
|
||||
data.put("has_stock", data.get("can_delivery")); // 是否有货
|
||||
} else {
|
||||
@ -1258,14 +1258,14 @@ public class ShopUserCartServiceImpl extends BaseServiceImpl<ShopUserCartMapper,
|
||||
|
||||
// 关键金额数据,对方竟然没有备注清楚!!!
|
||||
BigDecimal orderSelProductAmount = BigDecimal.ZERO; //商品订单原价
|
||||
BigDecimal orderSelFreightAmount = BigDecimal.ZERO;//商品订单原价
|
||||
BigDecimal orderSelMoneyAmount = BigDecimal.ZERO;//商品订单原价
|
||||
BigDecimal orderSelFreightAmount = BigDecimal.ZERO;//选中商品运费金额(仅运费)
|
||||
BigDecimal orderSelMoneyAmount = BigDecimal.ZERO;//选中商品最终应付金额
|
||||
BigDecimal orderDiscountAmount = BigDecimal.ZERO;//商品订单折扣优惠金额
|
||||
BigDecimal orderSelPointsAmount = BigDecimal.ZERO;//商品订单积分抵扣金额
|
||||
BigDecimal orderSelSpAmount = BigDecimal.ZERO;//可能是:商品订单促销金额
|
||||
BigDecimal orderRebateAmount = BigDecimal.ZERO;//商品订单返利金额
|
||||
BigDecimal orderRebateAmount = BigDecimal.ZERO;//可能是:商品订单返利金额
|
||||
|
||||
data_rows.put("orderSelMoneyAmount", 10.00f); // 这是什么金额?
|
||||
data_rows.put("orderSelMoneyAmount", 10.00f); // 这是什么金额?最低支付金额吗?
|
||||
data_rows.put("items", new ArrayList());
|
||||
|
||||
// 获取所有店铺信息
|
||||
@ -2181,6 +2181,7 @@ public class ShopUserCartServiceImpl extends BaseServiceImpl<ShopUserCartMapper,
|
||||
//item_discount_amount 数据实时放入 activityDiscountMoney, pulseActivityDiscountMoney 中。 不重叠放入。二选一。
|
||||
|
||||
store_row.put("order_activity_discount_amount", order_activity_discount_amount);
|
||||
// 店铺订单总优惠额度 = 店铺全局优惠 + 单品优惠 + 价格策略折扣
|
||||
store_row.put("order_discount_amount", order_discount_amount);
|
||||
|
||||
store_row.put("postFree", true); // 是否免运费
|
||||
@ -2456,7 +2457,7 @@ public class ShopUserCartServiceImpl extends BaseServiceImpl<ShopUserCartMapper,
|
||||
* 2、配送区域问题
|
||||
*
|
||||
* @param cart_data 最终数据
|
||||
* @param district_id 配送地区
|
||||
* @param district_id 配送地区(城市id)
|
||||
*/
|
||||
@Override
|
||||
public void calTransportFreight(Map cart_data, Integer district_id) {
|
||||
@ -2473,7 +2474,6 @@ public class ShopUserCartServiceImpl extends BaseServiceImpl<ShopUserCartMapper,
|
||||
boolean isgiftbag = false;
|
||||
Map activity_rule = new HashMap();
|
||||
|
||||
|
||||
// 活动可能影响,重新计算价格
|
||||
List<Map> items = (List<Map>) cart_data.get("items");
|
||||
for (Map store_row : items) {
|
||||
@ -2486,10 +2486,10 @@ public class ShopUserCartServiceImpl extends BaseServiceImpl<ShopUserCartMapper,
|
||||
BigDecimal giftbag_amount = Convert.toBigDecimal(activity_rule.get("giftbag_amount"));
|
||||
BigDecimal giftbag_fixed_discount = NumberUtil.div(Convert.toBigDecimal(activity_rule.get("giftbag_fixed_discount")), 10);
|
||||
|
||||
if (Convert.toInt(activity_rule.get("group_discount_type")).intValue() == 2) {
|
||||
if (Convert.toInt(activity_rule.get("group_discount_type")).intValue() == StateCode.ACTIVITY_GROUPBOOKING_FIXED_AMOUNT) {
|
||||
//优惠金额购买
|
||||
store_row.put("order_money_select_items", NumberUtil.mul(giftbag_fixed_amount, cart_quantity));
|
||||
} else if (Convert.toInt(activity_rule.get("group_discount_type")).intValue() == 3) {
|
||||
} else if (Convert.toInt(activity_rule.get("group_discount_type")).intValue() == StateCode.ACTIVITY_GROUPBOOKING_FIXED_DISCOUNT) {
|
||||
//优惠折扣
|
||||
store_row.put("order_money_select_items", NumberUtil.mul(giftbag_amount, giftbag_fixed_discount, cart_quantity));
|
||||
} else {
|
||||
@ -2507,6 +2507,7 @@ public class ShopUserCartServiceImpl extends BaseServiceImpl<ShopUserCartMapper,
|
||||
//是否启用店铺订单免运费
|
||||
boolean ifEnabledFreeFreight = shopStoreConfigService.ifEnabledFreeFreight(store_id);
|
||||
if (ifEnabledFreeFreight) {
|
||||
// 免运费
|
||||
BigDecimal order_money_select_items = Convert.toBigDecimal(store_row.get("order_money_select_items"), BigDecimal.ZERO);
|
||||
Map data = transportAmountService.calFreight(store_id, district_id, order_money_select_items, post_free_max);
|
||||
|
||||
@ -2653,11 +2654,14 @@ public class ShopUserCartServiceImpl extends BaseServiceImpl<ShopUserCartMapper,
|
||||
}
|
||||
|
||||
if (CheckUtil.isEmpty(freight)) {
|
||||
// 免运费
|
||||
store_row.put("postFree", true); // 是否免运费
|
||||
} else {
|
||||
// 不免运费
|
||||
store_row.put("postFree", false); // 是否免运费
|
||||
|
||||
BigDecimal order_money_select_items = Convert.toBigDecimal(store_row.get("order_money_select_items"));
|
||||
// 选中商品金额 - 免除运费金额
|
||||
store_row.put("postFreeBalance", NumberUtil.sub(order_money_select_items, post_free_max).abs());
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user