顺丰同城相关接口方法完善
This commit is contained in:
parent
c7018bbb6b
commit
1fbd523ca7
@ -0,0 +1,124 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2024. Lorem ipsum dolor sit amet, consectetur adipiscing elit.
|
||||||
|
* Morbi non lorem porttitor neque feugiat blandit. Ut vitae ipsum eget quam lacinia accumsan.
|
||||||
|
* Etiam sed turpis ac ipsum condimentum fringilla. Maecenas magna.
|
||||||
|
* Proin dapibus sapien vel ante. Aliquam erat volutpat. Pellentesque sagittis ligula eget metus.
|
||||||
|
* Vestibulum commodo. Ut rhoncus gravida arcu.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.suisung.mall.common.modules.store;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import io.swagger.models.auth.In;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
|
@Accessors(chain = true)
|
||||||
|
@TableName("shop_store_sf_order")
|
||||||
|
@ApiModel(value = "顺丰同城配送订单表实体", description = "顺丰同城配送订单表")
|
||||||
|
public class ShopStoreSfOrder {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "同城配送订单自增Id")
|
||||||
|
@TableId(value = "id", type = IdType.INPUT)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "同城开发者ID")
|
||||||
|
private Integer dev_id;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "顺丰订单号, 请注意:新版本V1.9及以后,该订单号升级为JS开头的15位订单号,类型为字符串(老版本仍为int类型)")
|
||||||
|
private String sf_order_id;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "顺丰运单号(需要在顺丰后台配置门店后返回此字段)")
|
||||||
|
private String sf_bill_id;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "顺丰店铺id")
|
||||||
|
private String sf_shop_id;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "商家订单号,唯一的")
|
||||||
|
private String shop_order_id;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "配送员姓名")
|
||||||
|
private String operator_name;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "配送员电话")
|
||||||
|
private String operator_phone;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "sf_order_status` int DEFAULT 0 COMMENT '状态:1-订单创建;2-订单取消;10-配送员接单/配送员改派;12-配送员到店;15配送员配送中(已取货);17-配送员妥投完单;22-配送员撤单;31-取消中;91-骑士上报异常;")
|
||||||
|
private Integer sf_order_status;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "状态说明")
|
||||||
|
private String sf_order_status_desc;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "推送时间")
|
||||||
|
private Long push_time;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "状态流轨迹,JSON 格式")
|
||||||
|
private String feed;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "配送轨迹H5页面URL")
|
||||||
|
private String h5_url;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "配送费总额,当return_flag中包含1时返回,单位分(值为计算出来此单总价)")
|
||||||
|
private Integer total_price;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "配送距离,当return_flag中包含2时返回,单位米(值为计算出来实际配送距离)")
|
||||||
|
private Integer delivery_distance_meter;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "省心送费,单位分。在顺丰同城后台配置,配置后有此字段和费用。")
|
||||||
|
private Integer free_send_service_fee;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "商品重量,当return_flag中包含4时返回,单位克(值为下单传入参数回传)")
|
||||||
|
private Integer weight_gram;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "起送时间,当return_flag中包含8时返回,时间格式为Unix时间戳,注意转换")
|
||||||
|
private Long start_time;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "预计送达时间,当return_flag中包含16时返回,时间格式为Unix时间戳,注意转换")
|
||||||
|
private Long expect_time;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "总支付金额,当return_flag中包含32时返回,单位分")
|
||||||
|
private Integer total_pay_money;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "实际支付金额,当return_flag中包含64时返回,单位分(实际支付金额=总支付金额-优惠券总金额)")
|
||||||
|
private Integer real_pay_money;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "优惠券总金额,当return_flag中包含128时返回,单位分")
|
||||||
|
private Integer coupons_total_fee;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "结算方式,当return_flag中包含256时返回")
|
||||||
|
private Integer settlement_type;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "取件码。在顺丰同城商户侧配置,配置后有此字段。")
|
||||||
|
private Integer pickup_code;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "签收码。在顺丰同城商户侧配置,配置后有此字段。")
|
||||||
|
private Integer complete_code;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "爆单费,单位分")
|
||||||
|
private Integer overflow_fee;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "保价费,单位分")
|
||||||
|
private Integer insure_fee;
|
||||||
|
|
||||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||||
|
@ApiModelProperty(value = "新增时间")
|
||||||
|
private Date created_at;
|
||||||
|
|
||||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||||
|
@ApiModelProperty(value = "修改时间")
|
||||||
|
private Date updated_at;
|
||||||
|
}
|
||||||
@ -99,5 +99,14 @@ public class ShopUserDeliveryAddress implements Serializable {
|
|||||||
@ApiModelProperty(value = "标签:1:-家;2-公司;3-学校;9-其他;")
|
@ApiModelProperty(value = "标签:1:-家;2-公司;3-学校;9-其他;")
|
||||||
private Integer ud_label;
|
private Integer ud_label;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "街道标记")
|
||||||
|
private String ud_marker;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "街道地址")
|
||||||
|
private String ud_street_addr;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "门牌号")
|
||||||
|
private String ud_street_no;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -34,7 +34,7 @@ public class SFExpressController {
|
|||||||
return sfExpressApiService.createOrder(shopOrderId);
|
return sfExpressApiService.createOrder(shopOrderId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation(value = "顺丰同城店铺取消订单", notes = "顺丰同城店铺取消订单")
|
@ApiOperation(value = "用户或店铺取消顺丰同城订单", notes = "用户或店铺取消顺丰同城订单")
|
||||||
@RequestMapping(value = "/cancel-order", method = RequestMethod.POST)
|
@RequestMapping(value = "/cancel-order", method = RequestMethod.POST)
|
||||||
public SFExpressApiRes cancelOrder(@RequestParam(name = "order_id", defaultValue = "") String orderId) {
|
public SFExpressApiRes cancelOrder(@RequestParam(name = "order_id", defaultValue = "") String orderId) {
|
||||||
Map<String, Object> params = new HashMap<>();
|
Map<String, Object> params = new HashMap<>();
|
||||||
@ -42,7 +42,7 @@ public class SFExpressController {
|
|||||||
return sfExpressApiService.cancelOrder(params);
|
return sfExpressApiService.cancelOrder(params);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation(value = "顺丰同城店铺订单加小费", notes = "顺丰同城店铺订单加小费")
|
@ApiOperation(value = "给顺丰同城配送员加小费", notes = "给顺丰同城配送员加小费")
|
||||||
@RequestMapping(value = "/add-order-gratuity-fee", method = RequestMethod.POST)
|
@RequestMapping(value = "/add-order-gratuity-fee", method = RequestMethod.POST)
|
||||||
public SFExpressApiRes addOrderGratuityFee(@RequestParam(name = "order_id", defaultValue = "") String orderId,
|
public SFExpressApiRes addOrderGratuityFee(@RequestParam(name = "order_id", defaultValue = "") String orderId,
|
||||||
@RequestParam(name = "gratuity_fee", defaultValue = "DD-20241119-0001") Integer gratuityFee) {
|
@RequestParam(name = "gratuity_fee", defaultValue = "DD-20241119-0001") Integer gratuityFee) {
|
||||||
@ -52,7 +52,7 @@ public class SFExpressController {
|
|||||||
return sfExpressApiService.addOrderGratuityFee(params);
|
return sfExpressApiService.addOrderGratuityFee(params);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation(value = "顺丰同城店铺催单", notes = "顺丰同城店铺催单")
|
@ApiOperation(value = "向配送员或顺丰同城平台催单", notes = "向配送员或顺丰同城平台催单")
|
||||||
@RequestMapping(value = "/reminder-order", method = RequestMethod.POST)
|
@RequestMapping(value = "/reminder-order", method = RequestMethod.POST)
|
||||||
public SFExpressApiRes reminderOrder(@RequestParam(name = "order_id", defaultValue = "") String orderId) {
|
public SFExpressApiRes reminderOrder(@RequestParam(name = "order_id", defaultValue = "") String orderId) {
|
||||||
Map<String, Object> params = new HashMap<>();
|
Map<String, Object> params = new HashMap<>();
|
||||||
@ -60,7 +60,7 @@ public class SFExpressController {
|
|||||||
return sfExpressApiService.reminderOrder(params);
|
return sfExpressApiService.reminderOrder(params);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation(value = "订单状态流查询", notes = "订单状态流查询")
|
@ApiOperation(value = "查询顺丰同城订单状态流", notes = "查询顺丰同城订单状态流")
|
||||||
@RequestMapping(value = "/list-order-feed", method = RequestMethod.POST)
|
@RequestMapping(value = "/list-order-feed", method = RequestMethod.POST)
|
||||||
public SFExpressApiRes listOrderFeed(@RequestParam(name = "order_id", defaultValue = "") String orderId) {
|
public SFExpressApiRes listOrderFeed(@RequestParam(name = "order_id", defaultValue = "") String orderId) {
|
||||||
Map<String, Object> params = new HashMap<>();
|
Map<String, Object> params = new HashMap<>();
|
||||||
|
|||||||
@ -8,7 +8,9 @@
|
|||||||
|
|
||||||
package com.suisung.mall.shop.sfexpress.service;
|
package com.suisung.mall.shop.sfexpress.service;
|
||||||
|
|
||||||
|
import com.suisung.mall.common.pojo.req.SFCreateOrderReq;
|
||||||
import com.suisung.mall.common.pojo.res.SFExpressApiRes;
|
import com.suisung.mall.common.pojo.res.SFExpressApiRes;
|
||||||
|
import org.springframework.data.util.Pair;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@ -23,6 +25,14 @@ public interface SFExpressApiService {
|
|||||||
SFExpressApiRes createOrder(String shopOrderId);
|
SFExpressApiRes createOrder(String shopOrderId);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 内部顺丰同城订单下单
|
||||||
|
* @param sfCreateOrderReq
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Pair<Boolean,String> innerCreateSfExpressOrder(SFCreateOrderReq sfCreateOrderReq);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 取消订单,当商家处发生异常需要取消配送时,可调用此接口对订单进行取消操作,同步返回结果。
|
* 取消订单,当商家处发生异常需要取消配送时,可调用此接口对订单进行取消操作,同步返回结果。
|
||||||
*
|
*
|
||||||
|
|||||||
@ -8,19 +8,26 @@
|
|||||||
|
|
||||||
package com.suisung.mall.shop.sfexpress.service.impl;
|
package com.suisung.mall.shop.sfexpress.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.convert.Convert;
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import cn.hutool.http.HttpUtil;
|
import cn.hutool.http.HttpUtil;
|
||||||
|
import cn.hutool.json.JSONObject;
|
||||||
|
import cn.hutool.json.JSONUtil;
|
||||||
|
import com.suisung.mall.common.modules.store.ShopStoreSfOrder;
|
||||||
import com.suisung.mall.common.pojo.req.*;
|
import com.suisung.mall.common.pojo.req.*;
|
||||||
import com.suisung.mall.common.pojo.res.SFExpressApiRes;
|
import com.suisung.mall.common.pojo.res.SFExpressApiRes;
|
||||||
import com.suisung.mall.common.utils.JsonUtil;
|
import com.suisung.mall.common.utils.JsonUtil;
|
||||||
import com.suisung.mall.shop.sfexpress.service.SFExpressApiService;
|
import com.suisung.mall.shop.sfexpress.service.SFExpressApiService;
|
||||||
|
import com.suisung.mall.shop.store.service.ShopStoreSfOrderService;
|
||||||
import org.apache.commons.codec.binary.Base64;
|
import org.apache.commons.codec.binary.Base64;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.data.util.Pair;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.security.MessageDigest;
|
import java.security.MessageDigest;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -40,7 +47,8 @@ public class SFExpressApiServiceImpl implements SFExpressApiService {
|
|||||||
@Value("${sf-express.dev_id}")
|
@Value("${sf-express.dev_id}")
|
||||||
private String devId;
|
private String devId;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private ShopStoreSfOrderService shopStoreSfOrderService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SFExpressApiRes createOrder(String shopOrderId) {
|
public SFExpressApiRes createOrder(String shopOrderId) {
|
||||||
@ -66,7 +74,7 @@ public class SFExpressApiServiceImpl implements SFExpressApiService {
|
|||||||
SFOrderDetailReq orderDetail = new SFOrderDetailReq();
|
SFOrderDetailReq orderDetail = new SFOrderDetailReq();
|
||||||
orderDetail.setTotal_price(2000);
|
orderDetail.setTotal_price(2000);
|
||||||
orderDetail.setProduct_type(6);
|
orderDetail.setProduct_type(6);
|
||||||
orderDetail.setWeight_gram(0); // 重量一律传 0kg 先,谢总本地协商好的
|
orderDetail.setWeight_gram(0); // 重量一律传 0kg 先,谢总本地运营商协商好的
|
||||||
orderDetail.setProduct_num(2);
|
orderDetail.setProduct_num(2);
|
||||||
orderDetail.setProduct_type_num(1);
|
orderDetail.setProduct_type_num(1);
|
||||||
|
|
||||||
@ -83,22 +91,22 @@ public class SFExpressApiServiceImpl implements SFExpressApiService {
|
|||||||
|
|
||||||
param.setOrder_detail(orderDetail);
|
param.setOrder_detail(orderDetail);
|
||||||
|
|
||||||
SFOrderShopReq shop = new SFOrderShopReq();
|
SFOrderShopReq sender = new SFOrderShopReq();
|
||||||
shop.setShop_name("顺丰同城开放平台");
|
sender.setShop_name("顺丰同城开放平台");
|
||||||
shop.setShop_address("蜂巢工场西区");
|
sender.setShop_address("蜂巢工场西区");
|
||||||
shop.setShop_phone("13203559287");
|
sender.setShop_phone("13203559287");
|
||||||
shop.setShop_lng("116.327914");
|
sender.setShop_lng("116.327914");
|
||||||
shop.setShop_lat("40.045488");
|
sender.setShop_lat("40.045488");
|
||||||
param.setShop(shop);
|
param.setShop(sender);
|
||||||
|
|
||||||
|
|
||||||
SFOrderReceiveReq receive = new SFOrderReceiveReq();
|
SFOrderReceiveReq receiver = new SFOrderReceiveReq();
|
||||||
receive.setUser_name("顺丰同城");
|
receiver.setUser_name("顺丰同城");
|
||||||
receive.setUser_phone("13881979410");
|
receiver.setUser_phone("13881979410");
|
||||||
receive.setUser_address("北京市海淀区学清嘉创大厦A座15层");
|
receiver.setUser_address("北京市海淀区学清嘉创大厦A座15层");
|
||||||
receive.setUser_lng("116.352843");
|
receiver.setUser_lng("116.352843");
|
||||||
receive.setUser_lat("40.015028");
|
receiver.setUser_lat("40.015028");
|
||||||
param.setReceive(receive);
|
param.setReceive(receiver);
|
||||||
|
|
||||||
|
|
||||||
// 转换 json 字符串参数
|
// 转换 json 字符串参数
|
||||||
@ -115,6 +123,52 @@ public class SFExpressApiServiceImpl implements SFExpressApiService {
|
|||||||
return JsonUtil.json2object(retRespStr, SFExpressApiRes.class);
|
return JsonUtil.json2object(retRespStr, SFExpressApiRes.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 内部顺丰同城订单下单
|
||||||
|
*
|
||||||
|
* @param sfCreateOrderReq
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Pair<Boolean,String> innerCreateSfExpressOrder(SFCreateOrderReq sfCreateOrderReq) {
|
||||||
|
// 请求参数转换 json 字符串参数
|
||||||
|
String paramJSON = JsonUtil.toJSONString(sfCreateOrderReq);
|
||||||
|
|
||||||
|
// 根据参数生成请求签名
|
||||||
|
String send_url = buildUrl("createorder", paramJSON);
|
||||||
|
|
||||||
|
String retRespStr = HttpUtil.post(send_url, paramJSON);
|
||||||
|
if (StrUtil.isEmpty(retRespStr)) {
|
||||||
|
logger.error("顺丰同城:创建订单异常,无返回值!");
|
||||||
|
return Pair.of(false, "创建订单异常,无返回值!");
|
||||||
|
}
|
||||||
|
|
||||||
|
JSONObject sfExpressApiRes = JSONUtil.parseObj(retRespStr); //JsonUtil.json2object(retRespStr, SFExpressApiRes.class);
|
||||||
|
if (sfExpressApiRes == null) {
|
||||||
|
logger.error("顺丰同城:创建订单后异常,无返回值!");
|
||||||
|
return Pair.of(false, "创建订单后异常,无返回值!");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!sfExpressApiRes.get("error_code").equals(0) || sfExpressApiRes.get("result") == null) {
|
||||||
|
logger.error("顺丰同城:创建订单后,发生错误 {}", sfExpressApiRes.get("error_msg"));
|
||||||
|
return Pair.of(false, Convert.toStr(sfExpressApiRes.get("error_msg")));
|
||||||
|
}
|
||||||
|
|
||||||
|
// 顺丰同城 result json 数据转实体实例
|
||||||
|
ShopStoreSfOrder shopStoreSfOrder = JSONUtil.toBean(sfExpressApiRes.get("result").toString(),ShopStoreSfOrder.class);
|
||||||
|
shopStoreSfOrder.setDev_id(sfCreateOrderReq.getDev_id());
|
||||||
|
|
||||||
|
// 下单成功,保存顺丰同城订单记录到 shop_store_sf_order 表里
|
||||||
|
Boolean success = shopStoreSfOrderService.insertShopStoreSfOrder(shopStoreSfOrder);
|
||||||
|
if (!success) {
|
||||||
|
return Pair.of(false, "顺丰同城订单保存失败!");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 取件码。在顺丰同城商户侧配置,配置后有此字段。
|
||||||
|
String pickupCode = shopStoreSfOrder.getPickup_code() != null ? shopStoreSfOrder.getPickup_code().toString() : "";
|
||||||
|
return Pair.of(true, pickupCode);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 取消订单
|
* 取消订单
|
||||||
*
|
*
|
||||||
|
|||||||
@ -0,0 +1,20 @@
|
|||||||
|
package com.suisung.mall.shop.store.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.suisung.mall.common.modules.store.ShopStorePrinterLog;
|
||||||
|
import com.suisung.mall.common.modules.store.ShopStoreSfOrder;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 顺丰同城订单 mapper 接口
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author panjunjie
|
||||||
|
* @since 2024-10-28
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Repository
|
||||||
|
public interface ShopStoreSfOrderMapper extends BaseMapper<ShopStoreSfOrder>{
|
||||||
|
|
||||||
|
}
|
||||||
@ -93,6 +93,7 @@ public interface ShopStoreBaseService extends IBaseService<ShopStoreBase> {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据店铺Id获取一条基本店铺信息
|
* 根据店铺Id获取一条基本店铺信息
|
||||||
|
*
|
||||||
* @param store_id
|
* @param store_id
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -18,6 +18,7 @@ public interface ShopStorePrinterLogService extends IBaseService<ShopStorePrinte
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 批量新增打票机打印日志
|
* 批量新增打票机打印日志
|
||||||
|
*
|
||||||
* @param records
|
* @param records
|
||||||
*/
|
*/
|
||||||
void insertShopStorePrinterLogBatch(List<ShopStorePrinterLog> records);
|
void insertShopStorePrinterLogBatch(List<ShopStorePrinterLog> records);
|
||||||
|
|||||||
@ -7,7 +7,6 @@ import com.suisung.mall.common.pojo.vo.ShopStorePrinterVO;
|
|||||||
import com.suisung.mall.core.web.service.IBaseService;
|
import com.suisung.mall.core.web.service.IBaseService;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
public interface ShopStorePrinterService extends IBaseService<ShopStorePrinter> {
|
public interface ShopStorePrinterService extends IBaseService<ShopStorePrinter> {
|
||||||
|
|
||||||
@ -25,6 +24,7 @@ public interface ShopStorePrinterService extends IBaseService<ShopStorePrinter>
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取一个打印机详情信息
|
* 获取一个打印机详情信息
|
||||||
|
*
|
||||||
* @param printer_id
|
* @param printer_id
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@ -48,6 +48,7 @@ public interface ShopStorePrinterService extends IBaseService<ShopStorePrinter>
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 门店开启/关闭一个打票机
|
* 门店开启/关闭一个打票机
|
||||||
|
*
|
||||||
* @param printer_id
|
* @param printer_id
|
||||||
* @param status
|
* @param status
|
||||||
* @return
|
* @return
|
||||||
@ -64,6 +65,7 @@ public interface ShopStorePrinterService extends IBaseService<ShopStorePrinter>
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 请空打印机打印队列
|
* 请空打印机打印队列
|
||||||
|
*
|
||||||
* @param printer_sn
|
* @param printer_sn
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@ -71,6 +73,7 @@ public interface ShopStorePrinterService extends IBaseService<ShopStorePrinter>
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 支付成功后,立即打印门店的订单信息
|
* 支付成功后,立即打印门店的订单信息
|
||||||
|
*
|
||||||
* @param orderId
|
* @param orderId
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@ -78,6 +81,7 @@ public interface ShopStorePrinterService extends IBaseService<ShopStorePrinter>
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取店铺所有有效打印机
|
* 获取店铺所有有效打印机
|
||||||
|
*
|
||||||
* @param storeId
|
* @param storeId
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -8,9 +8,7 @@
|
|||||||
|
|
||||||
package com.suisung.mall.shop.store.service;
|
package com.suisung.mall.shop.store.service;
|
||||||
|
|
||||||
import com.suisung.mall.common.api.CommonResult;
|
|
||||||
import com.suisung.mall.common.modules.store.ShopStoreSameCityTransport;
|
import com.suisung.mall.common.modules.store.ShopStoreSameCityTransport;
|
||||||
import com.suisung.mall.common.pojo.dto.ShopStoreSameCityTransportBaseDTO;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@ -19,6 +17,7 @@ public interface ShopStoreSameCityTransportService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据同城配送基础配置自增 Id 获取同城配送扩展设置列表
|
* 根据同城配送基础配置自增 Id 获取同城配送扩展设置列表
|
||||||
|
*
|
||||||
* @param transportBaseId
|
* @param transportBaseId
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@ -26,6 +25,7 @@ public interface ShopStoreSameCityTransportService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 保存同城配送扩展设置列表(存在就更新,不存在就新增)
|
* 保存同城配送扩展设置列表(存在就更新,不存在就新增)
|
||||||
|
*
|
||||||
* @param transportList
|
* @param transportList
|
||||||
* @return 成功的记录数
|
* @return 成功的记录数
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -0,0 +1,18 @@
|
|||||||
|
package com.suisung.mall.shop.store.service;
|
||||||
|
|
||||||
|
import com.suisung.mall.common.modules.store.ShopStoreSfOrder;
|
||||||
|
import com.suisung.mall.core.web.service.IBaseService;
|
||||||
|
|
||||||
|
public interface ShopStoreSfOrderService extends IBaseService<ShopStoreSfOrder> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增一个顺丰同城订单记录
|
||||||
|
*
|
||||||
|
* @param record
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Boolean insertShopStoreSfOrder(ShopStoreSfOrder record);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@ -12,7 +12,6 @@ import cn.hutool.core.collection.CollUtil;
|
|||||||
import cn.hutool.core.convert.Convert;
|
import cn.hutool.core.convert.Convert;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.mchange.lang.DoubleUtils;
|
|
||||||
import com.suisung.mall.common.api.CommonResult;
|
import com.suisung.mall.common.api.CommonResult;
|
||||||
import com.suisung.mall.common.constant.CommonConstant;
|
import com.suisung.mall.common.constant.CommonConstant;
|
||||||
import com.suisung.mall.common.domain.UserDto;
|
import com.suisung.mall.common.domain.UserDto;
|
||||||
@ -283,11 +282,11 @@ public class ShopStoreSameCityTransportBaseServiceImpl extends BaseServiceImpl<S
|
|||||||
BigDecimal diffDistanceM = CommonUtil.DecimalRoundHalfUp(BigDecimal.valueOf(distance - transportBase.getDistance_base() * 1000).divide(BigDecimal.valueOf(1000)));
|
BigDecimal diffDistanceM = CommonUtil.DecimalRoundHalfUp(BigDecimal.valueOf(distance - transportBase.getDistance_base() * 1000).divide(BigDecimal.valueOf(1000)));
|
||||||
// 累加的次数
|
// 累加的次数
|
||||||
Integer times = 0;
|
Integer times = 0;
|
||||||
if(diffDistanceM.intValue()>transportBase.getDistance_increase_km()){
|
if (diffDistanceM.intValue() > transportBase.getDistance_increase_km()) {
|
||||||
times = diffDistanceM.intValue() / transportBase.getDistance_increase_km();
|
times = diffDistanceM.intValue() / transportBase.getDistance_increase_km();
|
||||||
// 求余,如果有余数,增加一次倍数
|
// 求余,如果有余数,增加一次倍数
|
||||||
if(diffDistanceM.intValue() % transportBase.getDistance_increase_km()>0){
|
if (diffDistanceM.intValue() % transportBase.getDistance_increase_km() > 0) {
|
||||||
times+=1;
|
times += 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -301,15 +300,15 @@ public class ShopStoreSameCityTransportBaseServiceImpl extends BaseServiceImpl<S
|
|||||||
BigDecimal diffWeightKg = CommonUtil.DecimalRoundHalfUp(BigDecimal.valueOf(weightGram - transportBase.getWeight_base() * 1000).divide(BigDecimal.valueOf(1000)));
|
BigDecimal diffWeightKg = CommonUtil.DecimalRoundHalfUp(BigDecimal.valueOf(weightGram - transportBase.getWeight_base() * 1000).divide(BigDecimal.valueOf(1000)));
|
||||||
// 累加的次数
|
// 累加的次数
|
||||||
Integer times = 0;
|
Integer times = 0;
|
||||||
if(diffWeightKg.intValue()>transportBase.getWeight_increase_kg()){
|
if (diffWeightKg.intValue() > transportBase.getWeight_increase_kg()) {
|
||||||
times = diffWeightKg.intValue() / transportBase.getWeight_increase_kg();
|
times = diffWeightKg.intValue() / transportBase.getWeight_increase_kg();
|
||||||
// 求余,如果有余数,增加一次倍数
|
// 求余,如果有余数,增加一次倍数
|
||||||
if(diffWeightKg.intValue() % transportBase.getWeight_increase_kg()>0){
|
if (diffWeightKg.intValue() % transportBase.getWeight_increase_kg() > 0) {
|
||||||
times+=1;
|
times += 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
deliveryBaseFee = deliveryBaseFee.add(transportBase.getWeight_increase_fee().multiply(BigDecimal.valueOf(times)));
|
deliveryBaseFee = deliveryBaseFee.add(transportBase.getWeight_increase_fee().multiply(BigDecimal.valueOf(times)));
|
||||||
}
|
}
|
||||||
// #### 基础配送费计算完毕
|
// #### 基础配送费计算完毕
|
||||||
|
|
||||||
|
|||||||
@ -131,5 +131,4 @@ public class ShopStoreSameCityTransportServiceImpl extends BaseServiceImpl<ShopS
|
|||||||
return update(updateTransport, updateWrapper);
|
return update(updateTransport, updateWrapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,46 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2024. Lorem ipsum dolor sit amet, consectetur adipiscing elit.
|
||||||
|
* Morbi non lorem porttitor neque feugiat blandit. Ut vitae ipsum eget quam lacinia accumsan.
|
||||||
|
* Etiam sed turpis ac ipsum condimentum fringilla. Maecenas magna.
|
||||||
|
* Proin dapibus sapien vel ante. Aliquam erat volutpat. Pellentesque sagittis ligula eget metus.
|
||||||
|
* Vestibulum commodo. Ut rhoncus gravida arcu.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.suisung.mall.shop.store.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.suisung.mall.common.modules.store.ShopStoreSfOrder;
|
||||||
|
import com.suisung.mall.core.web.service.impl.BaseServiceImpl;
|
||||||
|
import com.suisung.mall.shop.store.mapper.ShopStoreSfOrderMapper;
|
||||||
|
import com.suisung.mall.shop.store.service.ShopStoreSfOrderService;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class ShopStoreSfOrderServiceImpl extends BaseServiceImpl<ShopStoreSfOrderMapper, ShopStoreSfOrder> implements ShopStoreSfOrderService {
|
||||||
|
|
||||||
|
private static final Logger logger = LoggerFactory.getLogger(ShopStoreSfOrderServiceImpl.class);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增一个顺丰同城订单记录
|
||||||
|
*
|
||||||
|
* @param record
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Boolean insertShopStoreSfOrder(ShopStoreSfOrder record) {
|
||||||
|
if (record == null) {
|
||||||
|
logger.error("ShopStoreSfOrder 实体空值,保存失败!");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (StrUtil.isEmpty(record.getSf_shop_id()) || StrUtil.isEmpty(record.getSf_order_id()) || StrUtil.isEmpty(record.getShop_order_id())) {
|
||||||
|
logger.error("ShopStoreSfOrder 保存,缺少必要参数,保存失败!");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return save(record);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -560,6 +560,7 @@ public class ShopUserCartServiceImpl extends BaseServiceImpl<ShopUserCartMapper,
|
|||||||
cartQueryWrapper.eq("store_id", checked_store);
|
cartQueryWrapper.eq("store_id", checked_store);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 从购物车里获取商品信息
|
||||||
data = getLists(cartQueryWrapper, 1, 500);
|
data = getLists(cartQueryWrapper, 1, 500);
|
||||||
} else {
|
} else {
|
||||||
// 直接购买,数据检测
|
// 直接购买,数据检测
|
||||||
@ -652,6 +653,7 @@ public class ShopUserCartServiceImpl extends BaseServiceImpl<ShopUserCartMapper,
|
|||||||
cart_row.put("pfgb_id", pfgb_id);
|
cart_row.put("pfgb_id", pfgb_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 生成订单数据,结算checkout预览及生成订单
|
||||||
data = formatCartRows(cart_rows, activity_rows, null, null);
|
data = formatCartRows(cart_rows, activity_rows, null, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1260,10 +1262,10 @@ public class ShopUserCartServiceImpl extends BaseServiceImpl<ShopUserCartMapper,
|
|||||||
BigDecimal orderSelMoneyAmount = BigDecimal.ZERO;//商品订单原价
|
BigDecimal orderSelMoneyAmount = BigDecimal.ZERO;//商品订单原价
|
||||||
BigDecimal orderDiscountAmount = BigDecimal.ZERO;//商品订单折扣优惠金额
|
BigDecimal orderDiscountAmount = BigDecimal.ZERO;//商品订单折扣优惠金额
|
||||||
BigDecimal orderSelPointsAmount = BigDecimal.ZERO;//商品订单积分抵扣金额
|
BigDecimal orderSelPointsAmount = BigDecimal.ZERO;//商品订单积分抵扣金额
|
||||||
BigDecimal orderSelSpAmount = 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());
|
data_rows.put("items", new ArrayList());
|
||||||
|
|
||||||
// 获取所有店铺信息
|
// 获取所有店铺信息
|
||||||
@ -1330,7 +1332,7 @@ public class ShopUserCartServiceImpl extends BaseServiceImpl<ShopUserCartMapper,
|
|||||||
item_row_map.putAll(row);
|
item_row_map.putAll(row);
|
||||||
|
|
||||||
|
|
||||||
//取交集
|
//允许发的快递类型id,普通快递,同城配送,自取。取交集
|
||||||
allowTransportIds = (List<Integer>) CollUtil.intersection(allowTransportIds, Convert.toList(Integer.class, item.get("product_transport_id")));
|
allowTransportIds = (List<Integer>) CollUtil.intersection(allowTransportIds, Convert.toList(Integer.class, item.get("product_transport_id")));
|
||||||
|
|
||||||
Map stand_item_row = fixCartItemRow(item_row_map, chain_item_row);
|
Map stand_item_row = fixCartItemRow(item_row_map, chain_item_row);
|
||||||
@ -1577,7 +1579,6 @@ public class ShopUserCartServiceImpl extends BaseServiceImpl<ShopUserCartMapper,
|
|||||||
item_row.put("points_subtotal", NumberUtil.mul(item_unit_points, cart_quantity));
|
item_row.put("points_subtotal", NumberUtil.mul(item_unit_points, cart_quantity));
|
||||||
item_row.put("sp_subtotal", NumberUtil.mul(item_unit_sp, cart_quantity));
|
item_row.put("sp_subtotal", NumberUtil.mul(item_unit_sp, cart_quantity));
|
||||||
|
|
||||||
|
|
||||||
Boolean cart_select = Convert.toBool(item_row.get("cart_select"));
|
Boolean cart_select = Convert.toBool(item_row.get("cart_select"));
|
||||||
Boolean is_on_sale = Convert.toBool(item_row.get("is_on_sale"));
|
Boolean is_on_sale = Convert.toBool(item_row.get("is_on_sale"));
|
||||||
if (cart_select && is_on_sale) {
|
if (cart_select && is_on_sale) {
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
<sql id="Base_Column_List">
|
<sql id="Base_Column_List">
|
||||||
ud_id, user_id, ud_name, ud_intl, ud_mobile, ud_telephone, ud_contacter, ud_im, ud_province_id, ud_province,
|
ud_id, user_id, ud_name, ud_intl, ud_mobile, ud_telephone, ud_contacter, ud_im, ud_province_id, ud_province,
|
||||||
ud_city_id, ud_city, ud_county_id, ud_county, ud_address, ud_postalcode, ud_tag_name, ud_longitude, ud_latitude,
|
ud_city_id, ud_city, ud_county_id, ud_county, ud_address, ud_postalcode, ud_tag_name, ud_longitude, ud_latitude,
|
||||||
ud_time, ud_is_default, ud_gender, ud_label
|
ud_time, ud_is_default, ud_gender, ud_label, ud_marker, ud_street_addr, ud_street_no
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user