店铺初始化,加上同城配送默认设置
This commit is contained in:
parent
af2627bad5
commit
22e28f2e81
@ -41,11 +41,11 @@ public class ShopStoreSameCityTransportBaseDTO implements Serializable {
|
|||||||
transport.setUpdated_at(this.transportBase.getUpdated_at());
|
transport.setUpdated_at(this.transportBase.getUpdated_at());
|
||||||
transport.setStore_id(this.transportBase.getStore_id());
|
transport.setStore_id(this.transportBase.getStore_id());
|
||||||
|
|
||||||
if (transport.getCreated_by() == null) {
|
if (transport.getCreated_by() == null && transport.getUpdated_by() != null) {
|
||||||
transport.setCreated_by(transport.getUpdated_by());
|
transport.setCreated_by(transport.getUpdated_by());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (transport.getCreated_at() == null) {
|
if (transport.getCreated_at() == null && transport.getUpdated_at() != null) {
|
||||||
transport.setCreated_at(transport.getUpdated_at());
|
transport.setCreated_at(transport.getUpdated_at());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -74,8 +74,8 @@
|
|||||||
<groupId>com.lkl.laop.sdk</groupId>
|
<groupId>com.lkl.laop.sdk</groupId>
|
||||||
<artifactId>lkl-laop-java-sdk</artifactId>
|
<artifactId>lkl-laop-java-sdk</artifactId>
|
||||||
<version>1.0.7</version>
|
<version>1.0.7</version>
|
||||||
<systemPath>${project.basedir}/src/main/resources/lib/lkl-java-sdk-1.0.7.jar</systemPath>
|
<!-- <systemPath>${project.basedir}/src/main/resources/lib/lkl-java-sdk-1.0.7.jar</systemPath>-->
|
||||||
<scope>system</scope>
|
<!-- <scope>system</scope>-->
|
||||||
</dependency>
|
</dependency>
|
||||||
<!--拉卡拉支付与分账 结束-->
|
<!--拉卡拉支付与分账 结束-->
|
||||||
|
|
||||||
|
|||||||
@ -14,6 +14,7 @@ import com.suisung.mall.common.service.impl.BaseControllerImpl;
|
|||||||
import com.suisung.mall.shop.lakala.service.LakalaApiService;
|
import com.suisung.mall.shop.lakala.service.LakalaApiService;
|
||||||
import com.suisung.mall.shop.library.service.LibraryProductService;
|
import com.suisung.mall.shop.library.service.LibraryProductService;
|
||||||
import com.suisung.mall.shop.order.service.ShopOrderReturnService;
|
import com.suisung.mall.shop.order.service.ShopOrderReturnService;
|
||||||
|
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.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
@ -40,6 +41,9 @@ public class LakalaController extends BaseControllerImpl {
|
|||||||
@Resource
|
@Resource
|
||||||
private LibraryProductService libraryProductService;
|
private LibraryProductService libraryProductService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private ShopStoreSameCityTransportBaseService storeSameCityTransportBaseService;
|
||||||
|
|
||||||
@ApiOperation(value = "测试案例", notes = "测试案例")
|
@ApiOperation(value = "测试案例", notes = "测试案例")
|
||||||
@RequestMapping(value = "/testcase", method = RequestMethod.POST)
|
@RequestMapping(value = "/testcase", method = RequestMethod.POST)
|
||||||
public Object testcase(@RequestBody JSONObject paramsJSON) {
|
public Object testcase(@RequestBody JSONObject paramsJSON) {
|
||||||
@ -47,6 +51,8 @@ public class LakalaController extends BaseControllerImpl {
|
|||||||
// return lakalaPayService.applyLedgerMerEc(paramsJSON.getStr("mchMobile"));
|
// return lakalaPayService.applyLedgerMerEc(paramsJSON.getStr("mchMobile"));
|
||||||
// return lakalaPayService.LedgerMerEcDownload(975790666910121984L);
|
// return lakalaPayService.LedgerMerEcDownload(975790666910121984L);
|
||||||
|
|
||||||
|
// return storeSameCityTransportBaseService.initDefaultSameCityTransport(58);
|
||||||
|
|
||||||
// return geTuiPushService.pushMessageToSingleByCid("f9da7081a7951cff6d7f1d4e2d2f270b", "", "从 shop 发消息", "none", "");
|
// return geTuiPushService.pushMessageToSingleByCid("f9da7081a7951cff6d7f1d4e2d2f270b", "", "从 shop 发消息", "none", "");
|
||||||
|
|
||||||
// return "";
|
// return "";
|
||||||
|
|||||||
@ -73,6 +73,14 @@ public interface ShopStoreSameCityTransportBaseService {
|
|||||||
Pair<Long, String> saveOrUpdateShopStoreSameCityTransportBase(ShopStoreSameCityTransportBase shopStoreSameCityTransportBase);
|
Pair<Long, String> saveOrUpdateShopStoreSameCityTransportBase(ShopStoreSameCityTransportBase shopStoreSameCityTransportBase);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 初始化默认的同城配送基础运费信息
|
||||||
|
*
|
||||||
|
* @param storeId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Pair<Boolean, String> initDefaultSameCityTransport(Integer storeId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 计算同城订单配送费
|
* 计算同城订单配送费
|
||||||
*
|
*
|
||||||
|
|||||||
@ -47,7 +47,10 @@ import com.suisung.mall.common.pojo.dto.StandardAddressDTO;
|
|||||||
import com.suisung.mall.common.service.impl.BaiduMapServiceImpl;
|
import com.suisung.mall.common.service.impl.BaiduMapServiceImpl;
|
||||||
import com.suisung.mall.common.utils.*;
|
import com.suisung.mall.common.utils.*;
|
||||||
import com.suisung.mall.core.web.service.impl.BaseServiceImpl;
|
import com.suisung.mall.core.web.service.impl.BaseServiceImpl;
|
||||||
import com.suisung.mall.shop.base.service.*;
|
import com.suisung.mall.shop.base.service.AccountBaseConfigService;
|
||||||
|
import com.suisung.mall.shop.base.service.ShopBaseProductTagService;
|
||||||
|
import com.suisung.mall.shop.base.service.ShopBaseStoreCategoryService;
|
||||||
|
import com.suisung.mall.shop.base.service.ShopBaseStoreGradeService;
|
||||||
import com.suisung.mall.shop.config.BaiduUtil;
|
import com.suisung.mall.shop.config.BaiduUtil;
|
||||||
import com.suisung.mall.shop.distribution.service.ShopDistributionPlantformUserService;
|
import com.suisung.mall.shop.distribution.service.ShopDistributionPlantformUserService;
|
||||||
import com.suisung.mall.shop.entity.LocationBean;
|
import com.suisung.mall.shop.entity.LocationBean;
|
||||||
@ -74,6 +77,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|||||||
import org.springframework.web.context.request.RequestContextHolder;
|
import org.springframework.web.context.request.RequestContextHolder;
|
||||||
import org.springframework.web.context.request.ServletRequestAttributes;
|
import org.springframework.web.context.request.ServletRequestAttributes;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
@ -166,8 +170,8 @@ public class ShopStoreBaseServiceImpl extends BaseServiceImpl<ShopStoreBaseMappe
|
|||||||
@Autowired
|
@Autowired
|
||||||
private ShopPageModuleService shopPageModuleService;
|
private ShopPageModuleService shopPageModuleService;
|
||||||
@Lazy
|
@Lazy
|
||||||
@Autowired
|
@Resource
|
||||||
private ShopBaseDistrictService shopBaseDistrictService;
|
private ShopStoreSameCityTransportBaseService storeSameCityTransportBaseService;
|
||||||
@Lazy
|
@Lazy
|
||||||
@Autowired
|
@Autowired
|
||||||
private ShopMchEntryService shopMchEntryService;
|
private ShopMchEntryService shopMchEntryService;
|
||||||
@ -3237,6 +3241,9 @@ public class ShopStoreBaseServiceImpl extends BaseServiceImpl<ShopStoreBaseMappe
|
|||||||
// 更改店铺Id
|
// 更改店铺Id
|
||||||
shopMchEntryService.updateMerchEntryStoreId(shopMchEntry.getId(), storeId);
|
shopMchEntryService.updateMerchEntryStoreId(shopMchEntry.getId(), storeId);
|
||||||
|
|
||||||
|
// 初始化同城配送默认设置
|
||||||
|
storeSameCityTransportBaseService.initDefaultSameCityTransport(storeId);
|
||||||
|
|
||||||
return Pair.of(storeId, "新增成功");
|
return Pair.of(storeId, "新增成功");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error("店铺生成失败", e);
|
logger.error("店铺生成失败", e);
|
||||||
|
|||||||
@ -61,9 +61,11 @@ public class ShopStoreSameCityTransportBaseServiceImpl extends BaseServiceImpl<S
|
|||||||
private ShopStoreSameCityTransportService shopStoreSameCityTransportService;
|
private ShopStoreSameCityTransportService shopStoreSameCityTransportService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private ShopStoreBaseService shopStoreBaseService;
|
private ShopStoreBaseService shopStoreBaseService;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private AccountBaseConfigService accountBaseConfigService;
|
private AccountBaseConfigService accountBaseConfigService;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取同城配送设置详情信息
|
* 获取同城配送设置详情信息
|
||||||
*
|
*
|
||||||
@ -74,7 +76,7 @@ public class ShopStoreSameCityTransportBaseServiceImpl extends BaseServiceImpl<S
|
|||||||
// 判断有没有权限
|
// 判断有没有权限
|
||||||
UserDto user = getCurrentUser();
|
UserDto user = getCurrentUser();
|
||||||
if (user == null || !user.isStore()) {
|
if (user == null || !user.isStore()) {
|
||||||
return CommonResult.failed("无权限操作!");
|
return CommonResult.failed(ResultCode.FORBIDDEN.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
Long storeId = Convert.toLong(user.getStore_id());
|
Long storeId = Convert.toLong(user.getStore_id());
|
||||||
@ -293,66 +295,128 @@ public class ShopStoreSameCityTransportBaseServiceImpl extends BaseServiceImpl<S
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Pair<Long, String> saveOrUpdateShopStoreSameCityTransportBase(ShopStoreSameCityTransportBase transportBase) {
|
public Pair<Long, String> saveOrUpdateShopStoreSameCityTransportBase(ShopStoreSameCityTransportBase transportBase) {
|
||||||
if (transportBase == null || transportBase.getStore_id() == null || transportBase.getStore_id() <= 0) {
|
try {
|
||||||
return Pair.of(0L, "缺少店铺Id必要参数!");
|
if (transportBase == null || transportBase.getStore_id() == null || transportBase.getStore_id() <= 0) {
|
||||||
}
|
return Pair.of(0L, "缺少店铺Id必要参数!");
|
||||||
|
|
||||||
if (transportBase.getDistance_base() == null || transportBase.getDistance_base() < 0) {
|
|
||||||
transportBase.setDistance_base(0);
|
|
||||||
// return Pair.of(0L, "请输入距离!");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (transportBase.getWeight_base() == null || transportBase.getWeight_base() < 0) {
|
|
||||||
// return Pair.of(0L, "请输入重量!");
|
|
||||||
transportBase.setWeight_base(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (transportBase.getDelivery_base_fee() == null || BigDecimal.ZERO.compareTo(transportBase.getDelivery_base_fee()) > 0) {
|
|
||||||
// return Pair.of(0L, "请输入配送运费!");
|
|
||||||
transportBase.setDelivery_base_fee(BigDecimal.ZERO);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (transportBase.getDistance_increase_km() == null || transportBase.getDistance_increase_km() < 0) {
|
|
||||||
transportBase.setDistance_increase_km(0);
|
|
||||||
}
|
|
||||||
if (transportBase.getDistance_increase_fee() == null || BigDecimal.ZERO.compareTo(transportBase.getDistance_increase_fee()) > 0) {
|
|
||||||
transportBase.setDistance_increase_fee(BigDecimal.ZERO);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (transportBase.getWeight_increase_kg() == null || transportBase.getWeight_increase_kg() < 0) {
|
|
||||||
transportBase.setWeight_increase_kg(0);
|
|
||||||
}
|
|
||||||
if (transportBase.getWeight_increase_fee() == null || BigDecimal.ZERO.compareTo(transportBase.getWeight_increase_fee()) > 0) {
|
|
||||||
transportBase.setWeight_increase_fee(BigDecimal.ZERO);
|
|
||||||
}
|
|
||||||
|
|
||||||
QueryWrapper<ShopStoreSameCityTransportBase> queryWrapper = new QueryWrapper<>();
|
|
||||||
queryWrapper.eq("store_id", transportBase.getStore_id());
|
|
||||||
ShopStoreSameCityTransportBase transportBaseExist = getOne(queryWrapper);
|
|
||||||
if (transportBaseExist == null) {
|
|
||||||
// 新增记录
|
|
||||||
transportBase.setCreated_by(transportBase.getUpdated_by());
|
|
||||||
if (save(transportBase)) {
|
|
||||||
// 应返回自增id
|
|
||||||
transportBaseExist = getOne(queryWrapper);
|
|
||||||
transportBase.setTransport_base_id(transportBaseExist.getTransport_base_id());
|
|
||||||
return Pair.of(transportBaseExist.getTransport_base_id(), "添加成功!");
|
|
||||||
} else {
|
|
||||||
return Pair.of(0L, "添加失败!");
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// 记录已经存在就直接更新
|
// 设置默认值
|
||||||
Long transportBaseId = transportBase.getTransport_base_id();
|
if (transportBase.getDistance_base() == null || transportBase.getDistance_base() < 0) {
|
||||||
if (transportBaseId == null || transportBase.getTransport_base_id() <= 0) {
|
transportBase.setDistance_base(0);
|
||||||
transportBase.setTransport_base_id(transportBaseExist.getTransport_base_id());
|
}
|
||||||
}
|
if (transportBase.getWeight_base() == null || transportBase.getWeight_base() < 0) {
|
||||||
|
transportBase.setWeight_base(0);
|
||||||
|
}
|
||||||
|
if (transportBase.getDelivery_base_fee() == null || transportBase.getDelivery_base_fee().compareTo(BigDecimal.ZERO) < 0) {
|
||||||
|
transportBase.setDelivery_base_fee(BigDecimal.ZERO);
|
||||||
|
}
|
||||||
|
if (transportBase.getDistance_increase_km() == null || transportBase.getDistance_increase_km() < 0) {
|
||||||
|
transportBase.setDistance_increase_km(0);
|
||||||
|
}
|
||||||
|
if (transportBase.getDistance_increase_fee() == null || transportBase.getDistance_increase_fee().compareTo(BigDecimal.ZERO) < 0) {
|
||||||
|
transportBase.setDistance_increase_fee(BigDecimal.ZERO);
|
||||||
|
}
|
||||||
|
if (transportBase.getWeight_increase_kg() == null || transportBase.getWeight_increase_kg() < 0) {
|
||||||
|
transportBase.setWeight_increase_kg(0);
|
||||||
|
}
|
||||||
|
if (transportBase.getWeight_increase_fee() == null || transportBase.getWeight_increase_fee().compareTo(BigDecimal.ZERO) < 0) {
|
||||||
|
transportBase.setWeight_increase_fee(BigDecimal.ZERO);
|
||||||
|
}
|
||||||
|
|
||||||
// 更新记录
|
QueryWrapper<ShopStoreSameCityTransportBase> queryWrapper = new QueryWrapper<>();
|
||||||
if (updateById(transportBase)) {
|
queryWrapper.eq("store_id", transportBase.getStore_id());
|
||||||
return Pair.of(transportBase.getTransport_base_id(), "更新成功!");
|
ShopStoreSameCityTransportBase exist = getOne(queryWrapper);
|
||||||
} else {
|
|
||||||
return Pair.of(0L, "更新失败!");
|
if (exist == null) {
|
||||||
|
// 新增
|
||||||
|
transportBase.setCreated_by(transportBase.getUpdated_by());
|
||||||
|
if (save(transportBase)) {
|
||||||
|
return Pair.of(transportBase.getTransport_base_id(), "添加成功!");
|
||||||
|
} else {
|
||||||
|
return Pair.of(0L, "添加失败!");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// 更新
|
||||||
|
transportBase.setTransport_base_id(exist.getTransport_base_id());
|
||||||
|
if (updateById(transportBase)) {
|
||||||
|
return Pair.of(transportBase.getTransport_base_id(), "更新成功!");
|
||||||
|
} else {
|
||||||
|
return Pair.of(0L, "更新失败!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("保存或更新同城配送基础信息异常: ", e);
|
||||||
|
return Pair.of(0L, "系统内部错误");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 初始化默认的同城配送基础运费信息
|
||||||
|
*
|
||||||
|
* @param storeId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Pair<Boolean, String> initDefaultSameCityTransport(Integer storeId) {
|
||||||
|
try {
|
||||||
|
// 校验店铺ID
|
||||||
|
if (storeId == null || storeId <= 0) {
|
||||||
|
return Pair.of(false, "缺少店铺Id必要参数!");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取预设配置
|
||||||
|
String sameCityDeliverySetting = accountBaseConfigService.getConfig("same_city_delivery_setting", "");
|
||||||
|
if (StrUtil.isBlank(sameCityDeliverySetting)) {
|
||||||
|
return Pair.of(false, "缺少同城配送预设设置!");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 转换为 DTO 对象
|
||||||
|
ShopStoreSameCityTransportBaseDTO transportDTO = JSONUtil.toBean(sameCityDeliverySetting, ShopStoreSameCityTransportBaseDTO.class);
|
||||||
|
if (transportDTO == null) {
|
||||||
|
return Pair.of(false, "同城配送预设设置格式错误!");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询店铺信息
|
||||||
|
ShopStoreBase storeBase = shopStoreBaseService.get(storeId);
|
||||||
|
if (storeBase == null) {
|
||||||
|
return Pair.of(false, "店铺不存在!");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 设置基础配送信息
|
||||||
|
ShopStoreSameCityTransportBase transportBase = transportDTO.getTransportBase();
|
||||||
|
if (transportBase == null) {
|
||||||
|
return Pair.of(false, "缺少同城配送基础设置!");
|
||||||
|
}
|
||||||
|
|
||||||
|
transportBase.setStore_id(Convert.toLong(storeBase.getStore_id()));
|
||||||
|
transportBase.setStore_longitude(storeBase.getStore_longitude());
|
||||||
|
transportBase.setStore_latitude(storeBase.getStore_latitude());
|
||||||
|
transportBase.setStore_address(storeBase.getStore_address());
|
||||||
|
|
||||||
|
// 保存或更新基础配送信息
|
||||||
|
Pair<Long, String> saveOrUpdateResult = saveOrUpdateShopStoreSameCityTransportBase(transportBase);
|
||||||
|
Long transportBaseId = saveOrUpdateResult.getFirst();
|
||||||
|
if (transportBaseId == null || transportBaseId <= 0) {
|
||||||
|
return Pair.of(false, saveOrUpdateResult.getSecond());
|
||||||
|
}
|
||||||
|
|
||||||
|
// 更新 transport_base_id 并刷新列表
|
||||||
|
transportBase.setTransport_base_id(transportBaseId);
|
||||||
|
transportDTO.setTransportBase(transportBase);
|
||||||
|
transportDTO.rebuildTransportList(); // 更清晰的方法名
|
||||||
|
|
||||||
|
// 保存扩展配送信息
|
||||||
|
int count = shopStoreSameCityTransportService.saveOrUpdateShopStoreSameCityTransportList(transportDTO.getTransportList());
|
||||||
|
if (count <= 0) {
|
||||||
|
return Pair.of(false, "保存同城配送设置部分失败!");
|
||||||
|
}
|
||||||
|
|
||||||
|
return Pair.of(true, "初始化成功");
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error("初始化同城配送设置异常: ", e);
|
||||||
|
return Pair.of(false, "初始化同城配送设置异常");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -101,39 +101,45 @@ public class ShopStoreSameCityTransportServiceImpl extends BaseServiceImpl<ShopS
|
|||||||
|
|
||||||
int count = 0;
|
int count = 0;
|
||||||
for (ShopStoreSameCityTransport transport : transportList) {
|
for (ShopStoreSameCityTransport transport : transportList) {
|
||||||
if (transport.getTransport_base_id() == null || transport.getTransport_base_id() <= 0 || transport.getStore_id() == null || transport.getStore_id() <= 0) {
|
try {
|
||||||
logger.error("缺少 transport_base_id 必要参数!");
|
if (transport == null ||
|
||||||
continue;
|
transport.getTransport_base_id() == null || transport.getTransport_base_id() <= 0 ||
|
||||||
}
|
transport.getStore_id() == null || transport.getStore_id() <= 0) {
|
||||||
// 检验参数完整性
|
logger.error("缺少 transport_base_id 或 store_id 必要参数!");
|
||||||
if (transport.getArea_type() == null) {
|
continue;
|
||||||
transport.setArea_type(1);//业务分类:1-圆半径;2-多边形
|
|
||||||
}
|
|
||||||
|
|
||||||
if (transport.getMax_delivery_radius() == null || transport.getMax_delivery_radius() <= 0) {
|
|
||||||
logger.error("缺少配送范围,忽略保存!");
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
// 未选起送金额条件,起送金额为0
|
|
||||||
if (transport.getMin_delivery_amount_type() == null && transport.getMin_delivery_amount() != null) {
|
|
||||||
transport.setMin_delivery_amount(BigDecimal.ZERO);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 未选减免的金额条件,减免的金额为0
|
|
||||||
if ((transport.getDelivery_discount_type() == null || transport.getMin_delivery_discount_amount() == null) && transport.getDelivery_discount() != null) {
|
|
||||||
transport.setDelivery_discount(BigDecimal.ZERO);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (transport == null || transport.getTransport_id() == null || transport.getTransport_id() <= 0) {
|
|
||||||
// 新增
|
|
||||||
if (save(transport)) {
|
|
||||||
count += 1;
|
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
// 修改
|
// 设置默认值
|
||||||
if (updateShopStoreSameCityTransport(transport)) {
|
if (transport.getArea_type() == null) {
|
||||||
count += 1;
|
transport.setArea_type(1); // 业务分类:1-圆半径;2-多边形
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (transport.getMax_delivery_radius() == null || transport.getMax_delivery_radius() <= 0) {
|
||||||
|
logger.error("缺少配送范围,忽略保存!");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (transport.getMin_delivery_amount_type() == null && transport.getMin_delivery_amount() != null) {
|
||||||
|
transport.setMin_delivery_amount(BigDecimal.ZERO);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((transport.getDelivery_discount_type() == null || transport.getMin_delivery_discount_amount() == null)
|
||||||
|
&& transport.getDelivery_discount() != null) {
|
||||||
|
transport.setDelivery_discount(BigDecimal.ZERO);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 新增或更新
|
||||||
|
if (transport.getTransport_id() == null || transport.getTransport_id() <= 0) {
|
||||||
|
if (save(transport)) {
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (updateShopStoreSameCityTransport(transport)) {
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error("处理单条运输信息失败: ", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user