运费设置业务类 添加相关方法

This commit is contained in:
Jack 2024-11-24 14:41:29 +08:00
parent 7a00de8aa9
commit 046aff7463
4 changed files with 51 additions and 9 deletions

View File

@ -0,0 +1,31 @@
package com.suisung.mall.shop.store.controller.admin;
import com.suisung.mall.common.api.CommonResult;
import com.suisung.mall.common.modules.store.ShopStorePrinter;
import com.suisung.mall.shop.store.service.ShopStorePrinterService;
import com.suisung.mall.shop.store.service.ShopStoreSameCityTransportBaseService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
@Api(tags = "门店打票机打印业务")
@RestController
@RequestMapping("/admin/shop/store/same-city-transport")
public class ShopStoreSameCityTransportBaseController {
@Resource
private ShopStoreSameCityTransportBaseService transportBaseService;
@ApiOperation(value = "同城配送运费设置详情", notes = "同城配送运费设置详情")
@RequestMapping(value = "/detail", method = {RequestMethod.GET})
public CommonResult shopStorePrinterDetail() {
return transportBaseService.ShopStoreSameCityTransportBaseDetail();
}
}

View File

@ -96,5 +96,5 @@ public interface ShopStoreBaseService extends IBaseService<ShopStoreBase> {
* @param store_id
* @return
*/
ShopStoreBase storeBase(Integer store_id);
ShopStoreBase getShopStoreBaseByStoreId(Integer store_id);
}

View File

@ -2811,14 +2811,14 @@ public class ShopStoreBaseServiceImpl extends BaseServiceImpl<ShopStoreBaseMappe
* @param store_id
* @return
*/
@Override
public ShopStoreBase storeBase(Integer store_id) {
public ShopStoreBase getShopStoreBaseByStoreId(Integer store_id) {
if (store_id == null || store_id <= 0) {
return null;
}
QueryWrapper<ShopStoreBase> queryWrapper = new QueryWrapper();
queryWrapper.eq("store_id", store_id);
return getOne(queryWrapper);
}

View File

@ -12,20 +12,24 @@ import cn.hutool.core.convert.Convert;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.suisung.mall.common.api.CommonResult;
import com.suisung.mall.common.constant.ConstantError;
import com.suisung.mall.common.domain.UserDto;
import com.suisung.mall.common.modules.store.ShopStoreBase;
import com.suisung.mall.common.modules.store.ShopStoreSameCityTransport;
import com.suisung.mall.common.modules.store.ShopStoreSameCityTransportBase;
import com.suisung.mall.common.pojo.dto.ShopStoreSameCityTransportBaseDTO;
import com.suisung.mall.core.web.service.impl.BaseServiceImpl;
import com.suisung.mall.shop.chain.controller.admin.ShopChainUserController;
import com.suisung.mall.shop.store.mapper.ShopStoreSameCityTransportBaseMapper;
import com.suisung.mall.shop.store.service.ShopStoreBaseService;
import com.suisung.mall.shop.store.service.ShopStoreSameCityTransportBaseService;
import com.suisung.mall.shop.store.service.ShopStoreSameCityTransportService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import static com.suisung.mall.common.utils.ContextUtil.getCurrentUser;
@ -38,6 +42,8 @@ public class ShopStoreSameCityTransportBaseServiceImpl extends BaseServiceImpl<S
@Resource
private ShopStoreBaseService shopStoreBaseService;
@Autowired
private ShopChainUserController user;
/**
* 获取同城配送设置详情信息
@ -47,12 +53,12 @@ public class ShopStoreSameCityTransportBaseServiceImpl extends BaseServiceImpl<S
@Override
public CommonResult ShopStoreSameCityTransportBaseDetail() {
// 判断有没有权限
UserDto user = getCurrentUser();
if (user == null || !user.isStore()) {
return CommonResult.failed("无权限操作!");
}
// UserDto user = getCurrentUser();
// if (user == null || !user.isStore()) {
// return CommonResult.failed("无权限操作!");
// }
Long storeId = Convert.toLong(user.getStore_id());
Long storeId = 2L; //Convert.toLong(user.getStore_id());
ShopStoreSameCityTransportBaseDTO retDTO = getDetailById(storeId);
if (retDTO == null) {
return CommonResult.failed("商家未设置店铺地址,请先设置店铺地址!");
@ -109,7 +115,7 @@ public class ShopStoreSameCityTransportBaseServiceImpl extends BaseServiceImpl<S
}
// 店铺基本信息
ShopStoreBase shopStoreBase = shopStoreBaseService.storeBase(storeId.intValue());
ShopStoreBase shopStoreBase = shopStoreBaseService.getShopStoreBaseByStoreId(storeId.intValue());
if (shopStoreBase == null) {
return null;
}
@ -132,6 +138,11 @@ public class ShopStoreSameCityTransportBaseServiceImpl extends BaseServiceImpl<S
transportBase.setDistance_increase_fee(BigDecimal.valueOf(1));
transportBase.setWeight_increase_kg(1);
transportBase.setWeight_increase_fee(BigDecimal.valueOf(1));
transportBase.setStatus(ConstantError.Enable);
Date now = new Date();
transportBase.setCreated_at(now);
transportBase.setUpdated_at(transportBase.getCreated_at());
// shop_store_base 表获取店铺的地址和经纬度
transportBase.setStore_address(StrUtil.removeAll(shopStoreBase.getStore_area(), "/") + shopStoreBase.getStore_address());