平台内部配送费的逻辑新增。接口层面修改
This commit is contained in:
parent
c96983ec72
commit
b1f95f4ecf
@ -23,8 +23,8 @@ public class ShopStoreSameCityTransportBaseController {
|
||||
|
||||
@ApiOperation(value = "获取同城配送运费设置详情", notes = "获取同城配送运费设置详情")
|
||||
@RequestMapping(value = "/detail", method = {RequestMethod.GET})
|
||||
public CommonResult shopStoreSameCityTransportBaseDetail(@RequestParam(name = "is_platfrom", defaultValue = "2") Integer isPlatform) {
|
||||
return transportBaseService.ShopStoreSameCityTransportBaseDetail(isPlatform);
|
||||
public CommonResult shopStoreSameCityTransportBaseDetail(@RequestParam(name = "store_id", required = false, defaultValue = "0") Long store_id) {
|
||||
return transportBaseService.ShopStoreSameCityTransportBaseDetail(store_id);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "保存(新增或修改)同城配送运费设置", notes = "保存(新增或修改)同城配送运费设置")
|
||||
|
||||
@ -20,7 +20,7 @@ public class ShopStoreSameCityTransportBaseMobileController {
|
||||
|
||||
@ApiOperation(value = "下单前检测同城订单配送是否符合要求", notes = "下单前检测同城订单配送是否符合要求")
|
||||
@RequestMapping(value = "/check/same-city/delivery", method = {RequestMethod.POST})
|
||||
public CommonResult checkSameCityDelivery(@RequestParam(name = "is_platfrom", defaultValue = "2") Integer isPlatform) {
|
||||
return transportBaseService.ShopStoreSameCityTransportBaseDetail(isPlatform);
|
||||
public CommonResult checkSameCityDelivery(@RequestParam(name = "store_id", required = false, defaultValue = "0") Long store_id) {
|
||||
return transportBaseService.ShopStoreSameCityTransportBaseDetail(store_id);
|
||||
}
|
||||
}
|
||||
@ -21,9 +21,10 @@ public interface ShopStoreSameCityTransportBaseService {
|
||||
/**
|
||||
* 获取同城配送设置详情信息
|
||||
*
|
||||
* @param storeId
|
||||
* @return
|
||||
*/
|
||||
CommonResult ShopStoreSameCityTransportBaseDetail(Integer isPlatform);
|
||||
CommonResult ShopStoreSameCityTransportBaseDetail(Long storeId);
|
||||
|
||||
/**
|
||||
* 保存或更新同城配送各项设置
|
||||
|
||||
@ -28,6 +28,7 @@ import com.suisung.mall.common.pojo.dto.DeliveryFeeResultDTO;
|
||||
import com.suisung.mall.common.pojo.dto.OrderCacDeliveryFeeDTO;
|
||||
import com.suisung.mall.common.pojo.dto.SameCityDeliveryFeeRespDTO;
|
||||
import com.suisung.mall.common.pojo.dto.ShopStoreSameCityTransportBaseDTO;
|
||||
import com.suisung.mall.common.utils.CheckUtil;
|
||||
import com.suisung.mall.common.utils.CommonUtil;
|
||||
import com.suisung.mall.common.utils.I18nUtil;
|
||||
import com.suisung.mall.common.utils.PositionUtil;
|
||||
@ -78,24 +79,30 @@ public class ShopStoreSameCityTransportBaseServiceImpl extends BaseServiceImpl<S
|
||||
/**
|
||||
* 获取同城配送设置详情信息
|
||||
*
|
||||
* @param storeId
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public CommonResult ShopStoreSameCityTransportBaseDetail(Integer isPlatform) {
|
||||
public CommonResult ShopStoreSameCityTransportBaseDetail(Long storeId) {
|
||||
// 判断有没有权限
|
||||
UserDto user = getCurrentUser();
|
||||
if (user == null || !user.isStore()) {
|
||||
if (user == null) {
|
||||
return CommonResult.failed(ResultCode.FORBIDDEN.getMessage());
|
||||
}
|
||||
|
||||
if (isPlatform == null || isPlatform < 0 || isPlatform > 2) {
|
||||
isPlatform = CommonConstant.Disable2;
|
||||
Integer isPlatform = CommonConstant.Disable2;
|
||||
if (user.isPlatform()) {
|
||||
if (CheckUtil.isEmpty(storeId)) {
|
||||
return CommonResult.failed("平台操作,请传入店铺Id");
|
||||
}
|
||||
isPlatform = CommonConstant.Enable;
|
||||
} else {
|
||||
storeId = Convert.toLong(user.getStore_id());
|
||||
}
|
||||
|
||||
Long storeId = Convert.toLong(user.getStore_id());
|
||||
ShopStoreSameCityTransportBaseDTO retDTO = getShopStoreSameCityTransportBaseDTOById(storeId, isPlatform);
|
||||
if (retDTO == null) {
|
||||
return CommonResult.failed("商家未设置店铺地址,请先设置店铺地址!");
|
||||
return CommonResult.failed("商家未设置店铺地址及经纬度相关信息,请先设置再试!");
|
||||
}
|
||||
|
||||
return CommonResult.success(retDTO);
|
||||
@ -109,21 +116,30 @@ public class ShopStoreSameCityTransportBaseServiceImpl extends BaseServiceImpl<S
|
||||
*/
|
||||
@Override
|
||||
public CommonResult saveOrUpdateSameCityTransport(ShopStoreSameCityTransportBaseDTO shopStoreSameCityTransportBaseDTO) {
|
||||
// 判断有没有权限
|
||||
UserDto user = getCurrentUser();
|
||||
if (user == null || !user.isStore()) {
|
||||
return CommonResult.failed("无权限操作!");
|
||||
}
|
||||
|
||||
Integer userId = user.getId();
|
||||
Long storeId = Convert.toLong(user.getStore_id());
|
||||
|
||||
shopStoreSameCityTransportBaseDTO.getTransportBase().setStore_id(storeId);
|
||||
|
||||
if (shopStoreSameCityTransportBaseDTO == null || shopStoreSameCityTransportBaseDTO.getTransportBase() == null) {
|
||||
return CommonResult.failed("参数有误");
|
||||
}
|
||||
|
||||
// 判断有没有权限
|
||||
UserDto user = getCurrentUser();
|
||||
if (user == null) {
|
||||
return CommonResult.failed("无权限操作!");
|
||||
}
|
||||
|
||||
Long storeId = 0L;
|
||||
int isPlatform = user.isPlatform() ? CommonConstant.Enable : CommonConstant.Disable2;
|
||||
if (isPlatform == CommonConstant.Enable) {
|
||||
if (CheckUtil.isEmpty(shopStoreSameCityTransportBaseDTO.getTransportBase().getStore_id())) {
|
||||
return CommonResult.failed("平台管理,请传入店铺Id");
|
||||
}
|
||||
storeId = Convert.toLong(shopStoreSameCityTransportBaseDTO.getTransportBase().getStore_id());
|
||||
} else {
|
||||
storeId = Convert.toLong(user.getStore_id());
|
||||
shopStoreSameCityTransportBaseDTO.getTransportBase().setStore_id(Convert.toLong(user.getStore_id()));
|
||||
}
|
||||
|
||||
Integer userId = user.getId();
|
||||
|
||||
ShopStoreBase store = shopStoreBaseService.getById(storeId);
|
||||
if (store == null || StrUtil.isBlank(store.getStore_longitude()) || StrUtil.isBlank(store.getStore_latitude())) {
|
||||
CommonResult.failed("无法获取店铺信息!");
|
||||
@ -134,6 +150,7 @@ public class ShopStoreSameCityTransportBaseServiceImpl extends BaseServiceImpl<S
|
||||
transportBase.setStore_longitude(store.getStore_longitude());
|
||||
transportBase.setStore_latitude(store.getStore_latitude());
|
||||
transportBase.setStore_address(store.getStore_address());
|
||||
transportBase.setIs_platform(isPlatform);
|
||||
|
||||
// 新增或更新同城配送基础设置
|
||||
Pair<Long, String> pair = saveOrUpdateShopStoreSameCityTransportBase(transportBase);
|
||||
@ -257,6 +274,7 @@ public class ShopStoreSameCityTransportBaseServiceImpl extends BaseServiceImpl<S
|
||||
transportBase = new ShopStoreSameCityTransportBase();
|
||||
transportBase.setStore_id(storeId);
|
||||
|
||||
transportBase.setIs_platform(isPlatform);
|
||||
// 没有记录时,指定默认值
|
||||
transportBase.setArea_type(1);
|
||||
transportBase.setBasis(1);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user