优化顺丰下单逻辑
This commit is contained in:
parent
7ab6efaf73
commit
9f8e793d9f
@ -46,6 +46,12 @@ public class ShopStoreSameCityTransportBase implements Serializable {
|
|||||||
@ApiModelProperty(value = "店铺ID")
|
@ApiModelProperty(value = "店铺ID")
|
||||||
private Long store_id;
|
private Long store_id;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "顺丰同城店铺ID")
|
||||||
|
private String shop_id;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "店铺主营商品分类ID")
|
||||||
|
private Integer business_type;
|
||||||
|
|
||||||
@ApiModelProperty(value = "店铺详细地址")
|
@ApiModelProperty(value = "店铺详细地址")
|
||||||
private String store_address;
|
private String store_address;
|
||||||
|
|
||||||
|
|||||||
@ -0,0 +1,26 @@
|
|||||||
|
/*
|
||||||
|
* 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.pojo.dto;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
/**
|
||||||
|
* 公共键值对实体
|
||||||
|
*/
|
||||||
|
public class KeyValueDTO implements Serializable {
|
||||||
|
private Object key; // 键
|
||||||
|
private Object value; //值
|
||||||
|
}
|
||||||
@ -97,6 +97,7 @@ import io.seata.core.exception.TransactionException;
|
|||||||
import io.seata.spring.annotation.GlobalTransactional;
|
import io.seata.spring.annotation.GlobalTransactional;
|
||||||
import io.seata.tm.api.GlobalTransaction;
|
import io.seata.tm.api.GlobalTransaction;
|
||||||
import io.seata.tm.api.GlobalTransactionContext;
|
import io.seata.tm.api.GlobalTransactionContext;
|
||||||
|
import io.swagger.models.auth.In;
|
||||||
import org.apache.commons.collections4.CollectionUtils;
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
@ -353,6 +354,9 @@ public class ShopOrderBaseServiceImpl extends BaseServiceImpl<ShopOrderBaseMappe
|
|||||||
@Resource
|
@Resource
|
||||||
private ShopOrderDeliveryAddressService shopOrderDeliveryAddressService;
|
private ShopOrderDeliveryAddressService shopOrderDeliveryAddressService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private ShopStoreSameCityTransportBaseService shopStoreSameCityTransportBaseService;
|
||||||
|
|
||||||
@Value("${sf-express.enable}")
|
@Value("${sf-express.enable}")
|
||||||
private Integer enable_sf_express;
|
private Integer enable_sf_express;
|
||||||
|
|
||||||
@ -8302,7 +8306,7 @@ public class ShopOrderBaseServiceImpl extends BaseServiceImpl<ShopOrderBaseMappe
|
|||||||
*/
|
*/
|
||||||
public SFCreateOrderReq buildSFOrderData(Integer devId, String orderId, Long orderPickupNum) {
|
public SFCreateOrderReq buildSFOrderData(Integer devId, String orderId, Long orderPickupNum) {
|
||||||
if (StrUtil.isBlank(orderId)) {
|
if (StrUtil.isBlank(orderId)) {
|
||||||
logger.error("缺少店铺Id");
|
logger.error("缺少订单Id");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -8315,18 +8319,34 @@ public class ShopOrderBaseServiceImpl extends BaseServiceImpl<ShopOrderBaseMappe
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
ShopStoreBase shopStoreBase = shopStoreBaseService.get(shopOrderBase.getStore_id());
|
Integer storeId = shopOrderBase.getStore_id();
|
||||||
ShopStoreInfo shopStoreInfo = shopStoreInfoService.get(shopOrderBase.getStore_id());
|
if (storeId == null || storeId <= 0) {
|
||||||
|
logger.error("缺少店铺 Id!");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
ShopStoreBase shopStoreBase = shopStoreBaseService.get(storeId);
|
||||||
|
ShopStoreInfo shopStoreInfo = shopStoreInfoService.get(storeId);
|
||||||
ShopOrderDeliveryAddress shopOrderDeliveryAddress = shopOrderDeliveryAddressService.selectByOrderId(orderId);
|
ShopOrderDeliveryAddress shopOrderDeliveryAddress = shopOrderDeliveryAddressService.selectByOrderId(orderId);
|
||||||
if (shopStoreBase == null || shopStoreInfo == null || shopOrderDeliveryAddress == null) {
|
ShopStoreSameCityTransportBase shopStoreSameCityTransportBase = shopStoreSameCityTransportBaseService.getShopStoreSameCityTransportBaseById(storeId.longValue());
|
||||||
|
if (shopStoreBase == null || shopStoreInfo == null || shopOrderDeliveryAddress == null || shopStoreSameCityTransportBase == null) {
|
||||||
logger.error("无法获取店铺信息!");
|
logger.error("无法获取店铺信息!");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// 7位数取单号,位数不够向左补0
|
// 7位数取单号,位数不够向左补0
|
||||||
String orderPickupNumStr = String.format("%07d", orderPickupNum);
|
String orderPickupNumStr = String.format("%07d", orderPickupNum);
|
||||||
// TODO 顺丰同城业务员给的店铺id
|
|
||||||
|
// 顺丰同城给的测试店铺id
|
||||||
String shopId = "3243279847393";
|
String shopId = "3243279847393";
|
||||||
|
Integer businessType = 6;// 生鲜分类
|
||||||
|
if (enable_sf_express.equals(CommonConstant.Enable)) {//开启正式配送服务的时候
|
||||||
|
// 顺丰同城业务员给的店铺id
|
||||||
|
shopId = shopStoreSameCityTransportBase.getShop_id();
|
||||||
|
businessType = shopStoreSameCityTransportBase.getBusiness_type();
|
||||||
|
}
|
||||||
|
|
||||||
SFCreateOrderReq sfCreateOrderReq = new SFCreateOrderReq();
|
SFCreateOrderReq sfCreateOrderReq = new SFCreateOrderReq();
|
||||||
sfCreateOrderReq.setDev_id(devId);
|
sfCreateOrderReq.setDev_id(devId);
|
||||||
sfCreateOrderReq.setShop_id(shopId); // TODO 顺丰同城业务员给的店铺id
|
sfCreateOrderReq.setShop_id(shopId); // TODO 顺丰同城业务员给的店铺id
|
||||||
@ -8359,7 +8379,7 @@ public class ShopOrderBaseServiceImpl extends BaseServiceImpl<ShopOrderBaseMappe
|
|||||||
orderProductList.add(orderProductDetail);
|
orderProductList.add(orderProductDetail);
|
||||||
}
|
}
|
||||||
|
|
||||||
orderDetail.setProduct_type(6); // 生鲜,参考:https://commit-openic.sf-express.com/#/apidoc
|
orderDetail.setProduct_type(businessType); // 店铺主营商品分类,参考:https://commit-openic.sf-express.com/#/apidoc
|
||||||
orderDetail.setTotal_price(shopOrderBase.getOrder_payment_amount().multiply(BigDecimal.valueOf(1000)).intValue()); // 单位分
|
orderDetail.setTotal_price(shopOrderBase.getOrder_payment_amount().multiply(BigDecimal.valueOf(1000)).intValue()); // 单位分
|
||||||
orderDetail.setWeight_gram(0); // 重量一律传 0kg 先,谢总本地运营商协商好的
|
orderDetail.setWeight_gram(0); // 重量一律传 0kg 先,谢总本地运营商协商好的
|
||||||
orderDetail.setProduct_num(productNum); //物品个数
|
orderDetail.setProduct_num(productNum); //物品个数
|
||||||
@ -8373,7 +8393,7 @@ public class ShopOrderBaseServiceImpl extends BaseServiceImpl<ShopOrderBaseMappe
|
|||||||
|
|
||||||
SFOrderShopReq shop = new SFOrderShopReq();
|
SFOrderShopReq shop = new SFOrderShopReq();
|
||||||
SFOrderReceiveReq receive = new SFOrderReceiveReq();
|
SFOrderReceiveReq receive = new SFOrderReceiveReq();
|
||||||
if(enable_sf_express.equals(CommonConstant.Enable)){
|
if (enable_sf_express.equals(CommonConstant.Enable)) {//开启正式配送服务的时候
|
||||||
// 店铺信息(发货人信息)
|
// 店铺信息(发货人信息)
|
||||||
Pair<Boolean, StandardAddressDTO> pairShopAddr = shopStoreBaseService.checkStoreAddress(shopStoreBase);
|
Pair<Boolean, StandardAddressDTO> pairShopAddr = shopStoreBaseService.checkStoreAddress(shopStoreBase);
|
||||||
shop.setShop_name(shopStoreBase.getStore_name());
|
shop.setShop_name(shopStoreBase.getStore_name());
|
||||||
@ -8388,7 +8408,7 @@ public class ShopOrderBaseServiceImpl extends BaseServiceImpl<ShopOrderBaseMappe
|
|||||||
receive.setUser_address(pairReceiveAddr.getSecond().getFullAddress());
|
receive.setUser_address(pairReceiveAddr.getSecond().getFullAddress());
|
||||||
receive.setUser_lng(pairReceiveAddr.getSecond().getLongitude());
|
receive.setUser_lng(pairReceiveAddr.getSecond().getLongitude());
|
||||||
receive.setUser_lat(pairReceiveAddr.getSecond().getLatitude());
|
receive.setUser_lat(pairReceiveAddr.getSecond().getLatitude());
|
||||||
}else{
|
} else {
|
||||||
// 店铺信息(发货人信息)
|
// 店铺信息(发货人信息)
|
||||||
shop.setShop_name("顺丰同城开放平台");
|
shop.setShop_name("顺丰同城开放平台");
|
||||||
shop.setShop_address("蜂巢工场西区");
|
shop.setShop_address("蜂巢工场西区");
|
||||||
|
|||||||
@ -13,11 +13,13 @@ import com.suisung.mall.common.service.impl.BaseControllerImpl;
|
|||||||
import com.suisung.mall.common.utils.CheckUtil;
|
import com.suisung.mall.common.utils.CheckUtil;
|
||||||
import com.suisung.mall.shop.base.service.ShopBaseStoreGradeService;
|
import com.suisung.mall.shop.base.service.ShopBaseStoreGradeService;
|
||||||
import com.suisung.mall.shop.store.service.ShopStoreBaseService;
|
import com.suisung.mall.shop.store.service.ShopStoreBaseService;
|
||||||
|
import com.suisung.mall.shop.store.service.ShopStoreSameCityTransportBaseService;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@ -44,6 +46,9 @@ public class ShopStoreBaseController extends BaseControllerImpl {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private ShopBaseStoreGradeService shopBaseStoreGradeService;
|
private ShopBaseStoreGradeService shopBaseStoreGradeService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private ShopStoreSameCityTransportBaseService transportBaseService;
|
||||||
|
|
||||||
@ApiOperation(value = "店铺基础信息表-分页列表查询", notes = "店铺基础信息表-分页列表查询")
|
@ApiOperation(value = "店铺基础信息表-分页列表查询", notes = "店铺基础信息表-分页列表查询")
|
||||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||||
public CommonResult list(ShopStoreBase shopStoreBase,
|
public CommonResult list(ShopStoreBase shopStoreBase,
|
||||||
@ -221,5 +226,11 @@ public class ShopStoreBaseController extends BaseControllerImpl {
|
|||||||
shopStoreBaseService.fixStoreData(rows);
|
shopStoreBaseService.fixStoreData(rows);
|
||||||
return rows;
|
return rows;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "店铺主营商品分类", notes = "店铺主营商品分类")
|
||||||
|
@RequestMapping(value = "/business/list", method = {RequestMethod.GET})
|
||||||
|
public CommonResult storeBusinessTypeList() {
|
||||||
|
return transportBaseService.storeBusinessTypeList();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -33,6 +33,12 @@ public interface ShopStoreSameCityTransportBaseService {
|
|||||||
*/
|
*/
|
||||||
CommonResult saveOrUpdateSameCityTransport(ShopStoreSameCityTransportBaseDTO shopStoreSameCityTransportBaseDTO);
|
CommonResult saveOrUpdateSameCityTransport(ShopStoreSameCityTransportBaseDTO shopStoreSameCityTransportBaseDTO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 店铺主营商品类型
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
CommonResult storeBusinessTypeList();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据店铺 Id 获取同城配送设置详情信息
|
* 根据店铺 Id 获取同城配送设置详情信息
|
||||||
*
|
*
|
||||||
|
|||||||
@ -20,6 +20,7 @@ import com.suisung.mall.common.exception.ApiException;
|
|||||||
import com.suisung.mall.common.modules.store.ShopStoreBase;
|
import com.suisung.mall.common.modules.store.ShopStoreBase;
|
||||||
import com.suisung.mall.common.modules.store.ShopStoreSameCityTransport;
|
import com.suisung.mall.common.modules.store.ShopStoreSameCityTransport;
|
||||||
import com.suisung.mall.common.modules.store.ShopStoreSameCityTransportBase;
|
import com.suisung.mall.common.modules.store.ShopStoreSameCityTransportBase;
|
||||||
|
import com.suisung.mall.common.pojo.dto.KeyValueDTO;
|
||||||
import com.suisung.mall.common.pojo.dto.SameCityDeliveryFeeRespDTO;
|
import com.suisung.mall.common.pojo.dto.SameCityDeliveryFeeRespDTO;
|
||||||
import com.suisung.mall.common.pojo.dto.ShopStoreSameCityTransportBaseDTO;
|
import com.suisung.mall.common.pojo.dto.ShopStoreSameCityTransportBaseDTO;
|
||||||
import com.suisung.mall.common.utils.CommonUtil;
|
import com.suisung.mall.common.utils.CommonUtil;
|
||||||
@ -31,6 +32,7 @@ import com.suisung.mall.shop.store.mapper.ShopStoreSameCityTransportBaseMapper;
|
|||||||
import com.suisung.mall.shop.store.service.ShopStoreBaseService;
|
import com.suisung.mall.shop.store.service.ShopStoreBaseService;
|
||||||
import com.suisung.mall.shop.store.service.ShopStoreSameCityTransportBaseService;
|
import com.suisung.mall.shop.store.service.ShopStoreSameCityTransportBaseService;
|
||||||
import com.suisung.mall.shop.store.service.ShopStoreSameCityTransportService;
|
import com.suisung.mall.shop.store.service.ShopStoreSameCityTransportService;
|
||||||
|
import io.swagger.models.auth.In;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.data.util.Pair;
|
import org.springframework.data.util.Pair;
|
||||||
@ -38,8 +40,7 @@ import org.springframework.stereotype.Service;
|
|||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.Date;
|
import java.util.*;
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import static com.suisung.mall.common.utils.ContextUtil.getCurrentUser;
|
import static com.suisung.mall.common.utils.ContextUtil.getCurrentUser;
|
||||||
|
|
||||||
@ -116,6 +117,60 @@ public class ShopStoreSameCityTransportBaseServiceImpl extends BaseServiceImpl<S
|
|||||||
return CommonResult.failed(pair.getSecond());
|
return CommonResult.failed(pair.getSecond());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 店铺主营商品类型
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public CommonResult storeBusinessTypeList() {
|
||||||
|
UserDto user = getCurrentUser();
|
||||||
|
if (user == null) {
|
||||||
|
return CommonResult.failed("无权限操作!");
|
||||||
|
}
|
||||||
|
|
||||||
|
List<KeyValueDTO> list = new ArrayList<KeyValueDTO>(){{
|
||||||
|
add(new KeyValueDTO(1,"快餐"));
|
||||||
|
add(new KeyValueDTO(2,"药品"));
|
||||||
|
add(new KeyValueDTO(3,"百货"));
|
||||||
|
add(new KeyValueDTO(4,"脏衣服收"));
|
||||||
|
add(new KeyValueDTO(5,"干净衣服派"));
|
||||||
|
add(new KeyValueDTO(6,"生鲜"));
|
||||||
|
add(new KeyValueDTO(8,"高端饮品"));
|
||||||
|
add(new KeyValueDTO(10,"快递"));
|
||||||
|
add(new KeyValueDTO(12,"文件"));
|
||||||
|
add(new KeyValueDTO(13,"蛋糕"));
|
||||||
|
add(new KeyValueDTO(14,"鲜花"));
|
||||||
|
add(new KeyValueDTO(15,"数码"));
|
||||||
|
add(new KeyValueDTO(16,"服装"));
|
||||||
|
add(new KeyValueDTO(17,"汽配"));
|
||||||
|
add(new KeyValueDTO(18,"珠宝"));
|
||||||
|
add(new KeyValueDTO(20,"披萨"));
|
||||||
|
add(new KeyValueDTO(21,"中餐"));
|
||||||
|
add(new KeyValueDTO(22,"水产"));
|
||||||
|
add(new KeyValueDTO(32,"中端饮品"));
|
||||||
|
add(new KeyValueDTO(33,"便利店"));
|
||||||
|
add(new KeyValueDTO(34,"面包糕点"));
|
||||||
|
add(new KeyValueDTO(35,"火锅"));
|
||||||
|
add(new KeyValueDTO(36,"证照"));
|
||||||
|
add(new KeyValueDTO(40,"烧烤小龙虾"));
|
||||||
|
add(new KeyValueDTO(41,"外部落地配"));
|
||||||
|
add(new KeyValueDTO(44,"年夜饭"));
|
||||||
|
add(new KeyValueDTO(47,"烟酒行"));
|
||||||
|
add(new KeyValueDTO(48,"成人用品"));
|
||||||
|
add(new KeyValueDTO(53,"冷链医药"));
|
||||||
|
add(new KeyValueDTO(55,"宠物用品"));
|
||||||
|
add(new KeyValueDTO(56,"母婴用品"));
|
||||||
|
add(new KeyValueDTO(57,"美妆用品"));
|
||||||
|
add(new KeyValueDTO(58,"家居建材"));
|
||||||
|
add(new KeyValueDTO(59,"眼镜行"));
|
||||||
|
add(new KeyValueDTO(60,"图文广告"));
|
||||||
|
add(new KeyValueDTO(81,"中药"));
|
||||||
|
}};
|
||||||
|
|
||||||
|
return CommonResult.success(list, "");
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据店铺 Id 获取同城配送设置详情信息
|
* 根据店铺 Id 获取同城配送设置详情信息
|
||||||
*
|
*
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user