顺丰同城相关接口方法完善
This commit is contained in:
parent
298049c052
commit
15ece62c7f
@ -46,6 +46,9 @@ public class ShopStoreSameCityTransport implements Serializable {
|
||||
@ApiModelProperty(value = "基础运费自增ID")
|
||||
private Long transport_base_id;
|
||||
|
||||
@ApiModelProperty(value = "店铺自增ID")
|
||||
private Long store_id;
|
||||
|
||||
@ApiModelProperty(value = "业务分类:1-圆半径;2-多边形;")
|
||||
private Integer area_type;
|
||||
|
||||
|
||||
@ -41,6 +41,7 @@ public class ShopStoreSameCityTransportBaseDTO implements Serializable {
|
||||
transport.setTransport_base_id(this.transportBase.getTransport_base_id());
|
||||
transport.setUpdated_by(this.transportBase.getUpdated_by());
|
||||
transport.setUpdated_at(this.transportBase.getUpdated_at());
|
||||
transport.setStore_id(this.transportBase.getStore_id());
|
||||
|
||||
if (transport.getCreated_by() == null) {
|
||||
transport.setCreated_by(transport.getUpdated_by());
|
||||
|
||||
@ -8,6 +8,7 @@ import com.suisung.mall.common.pojo.dto.ShopStoreSameCityTransportBaseDTO;
|
||||
import com.suisung.mall.common.utils.JsonUtil;
|
||||
import com.suisung.mall.shop.store.service.ShopStorePrinterService;
|
||||
import com.suisung.mall.shop.store.service.ShopStoreSameCityTransportBaseService;
|
||||
import com.suisung.mall.shop.store.service.ShopStoreSameCityTransportService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@ -23,6 +24,9 @@ public class ShopStoreSameCityTransportBaseController {
|
||||
@Resource
|
||||
private ShopStoreSameCityTransportBaseService transportBaseService;
|
||||
|
||||
@Resource
|
||||
private ShopStoreSameCityTransportService transportService;
|
||||
|
||||
@ApiOperation(value = "获取同城配送运费设置详情", notes = "获取同城配送运费设置详情")
|
||||
@RequestMapping(value = "/detail", method = {RequestMethod.GET})
|
||||
public CommonResult shopStoreSameCityTransportBaseDetail() {
|
||||
@ -31,8 +35,14 @@ public class ShopStoreSameCityTransportBaseController {
|
||||
|
||||
@ApiOperation(value = "保存(新增或修改)同城配送运费设置", notes = "保存(新增或修改)同城配送运费设置")
|
||||
@RequestMapping(value = "/save", method = {RequestMethod.POST})
|
||||
public CommonResult shopStoreSameCityTransportBaseSettingDetail(@RequestBody(required = true) String requestBody) {
|
||||
public CommonResult saveOrUpdateSameCityTransport(@RequestBody(required = true) String requestBody) {
|
||||
ShopStoreSameCityTransportBaseDTO params = JsonUtil.json2object(requestBody, ShopStoreSameCityTransportBaseDTO.class);
|
||||
return transportBaseService.saveOrUpdateSameCityTransport(params);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "删除同城配送的一个区域设置", notes = "删除同城配送的一个区域设置")
|
||||
@RequestMapping(value = "/delete/area", method = {RequestMethod.POST})
|
||||
public CommonResult deleteShopStoreSameCityTransport(@RequestParam(name = "transport_id" , required = true) Long transportId) {
|
||||
return transportService.deleteShopStoreSameCityTransport(transportId);
|
||||
}
|
||||
}
|
||||
@ -8,12 +8,19 @@
|
||||
|
||||
package com.suisung.mall.shop.store.service;
|
||||
|
||||
import com.suisung.mall.common.api.CommonResult;
|
||||
import com.suisung.mall.common.modules.store.ShopStoreSameCityTransport;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface ShopStoreSameCityTransportService {
|
||||
|
||||
/***
|
||||
* 删除一条同城配送的区域设置记录
|
||||
* @param transportId
|
||||
* @return
|
||||
*/
|
||||
CommonResult deleteShopStoreSameCityTransport(Long transportId);
|
||||
|
||||
/**
|
||||
* 根据同城配送基础配置自增 Id 获取同城配送扩展设置列表
|
||||
@ -30,4 +37,13 @@ public interface ShopStoreSameCityTransportService {
|
||||
* @return 成功的记录数
|
||||
*/
|
||||
Integer saveOrUpdateShopStoreSameCityTransportList(List<ShopStoreSameCityTransport> transportList);
|
||||
|
||||
/**
|
||||
* 删除一条区域配送设置
|
||||
*
|
||||
* @param transportId
|
||||
* @param storeId
|
||||
* @return
|
||||
*/
|
||||
Boolean deleteShopStoreSameCityTransport(Long transportId, Long storeId);
|
||||
}
|
||||
|
||||
@ -2,13 +2,13 @@ package com.suisung.mall.shop.store.service;
|
||||
|
||||
import com.suisung.mall.common.modules.store.ShopStoreSfOrder;
|
||||
import com.suisung.mall.core.web.service.IBaseService;
|
||||
import io.swagger.models.auth.In;
|
||||
|
||||
public interface ShopStoreSfOrderService extends IBaseService<ShopStoreSfOrder> {
|
||||
|
||||
|
||||
/**
|
||||
* 根据顺丰同城订单id获取一条记录
|
||||
*
|
||||
* @param sfOrderId
|
||||
* @return
|
||||
*/
|
||||
@ -25,7 +25,8 @@ public interface ShopStoreSfOrderService extends IBaseService<ShopStoreSfOrder>
|
||||
|
||||
/**
|
||||
* 更新顺丰同城订单的状态等关键字段
|
||||
* @param record
|
||||
*
|
||||
* @param record
|
||||
* @return
|
||||
*/
|
||||
Boolean updateShopStoreSfOrderStatus(ShopStoreSfOrder record);
|
||||
|
||||
@ -9,9 +9,12 @@
|
||||
package com.suisung.mall.shop.store.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.suisung.mall.common.api.CommonResult;
|
||||
import com.suisung.mall.common.constant.CommonConstant;
|
||||
import com.suisung.mall.common.domain.UserDto;
|
||||
import com.suisung.mall.common.modules.store.ShopStoreSameCityTransport;
|
||||
import com.suisung.mall.core.web.service.impl.BaseServiceImpl;
|
||||
import com.suisung.mall.shop.store.mapper.ShopStoreSameCityTransportMapper;
|
||||
@ -24,11 +27,40 @@ import java.math.BigDecimal;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import static com.suisung.mall.common.utils.ContextUtil.getCurrentUser;
|
||||
|
||||
@Service
|
||||
public class ShopStoreSameCityTransportServiceImpl extends BaseServiceImpl<ShopStoreSameCityTransportMapper, ShopStoreSameCityTransport> implements ShopStoreSameCityTransportService {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(ShopStoreSameCityTransportServiceImpl.class);
|
||||
|
||||
|
||||
/***
|
||||
* 删除一条同城配送的区域设置记录
|
||||
* @param transportId
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public CommonResult deleteShopStoreSameCityTransport(Long transportId) {
|
||||
// 判断有没有权限
|
||||
UserDto user = getCurrentUser();
|
||||
if (user == null || !user.isStore()) {
|
||||
return CommonResult.failed("无权限操作!");
|
||||
}
|
||||
|
||||
Long storeId = Convert.toLong(user.getStore_id());
|
||||
|
||||
if (transportId == null || transportId <= 0 || storeId == null || storeId <= 0) {
|
||||
return CommonResult.failed("缺少必要参数");
|
||||
}
|
||||
|
||||
if (!deleteShopStoreSameCityTransport(transportId, storeId)) {
|
||||
return CommonResult.failed("操作失败!");
|
||||
}
|
||||
|
||||
return CommonResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据同城配送基础配置自增 Id 获取同城配送扩展设置列表
|
||||
*
|
||||
@ -69,7 +101,7 @@ public class ShopStoreSameCityTransportServiceImpl extends BaseServiceImpl<ShopS
|
||||
|
||||
int count = 0;
|
||||
for (ShopStoreSameCityTransport transport : transportList) {
|
||||
if (transport.getTransport_base_id() == null || transport.getTransport_base_id() <= 0) {
|
||||
if (transport.getTransport_base_id() == null || transport.getTransport_base_id() <= 0 || transport.getStore_id() == null || transport.getStore_id() <= 0) {
|
||||
logger.error("缺少 transport_base_id 必要参数!");
|
||||
continue;
|
||||
}
|
||||
@ -108,15 +140,22 @@ public class ShopStoreSameCityTransportServiceImpl extends BaseServiceImpl<ShopS
|
||||
return count;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据区域设置自增id和店铺id,修改一条区域配送设置
|
||||
*
|
||||
* @param transport
|
||||
* @return
|
||||
*/
|
||||
public Boolean updateShopStoreSameCityTransport(ShopStoreSameCityTransport transport) {
|
||||
if (transport == null || transport.getTransport_id() == null || transport.getTransport_id() <= 0 || transport.getTransport_base_id() == null || transport.getTransport_base_id() <= 0) {
|
||||
if (transport == null || transport.getTransport_id() == null || transport.getTransport_id() <= 0 || transport.getStore_id()
|
||||
== null || transport.getStore_id() <= 0) {
|
||||
logger.error("缺少Transport_id 或 Transport_base_id 必要参数!");
|
||||
return false;
|
||||
}
|
||||
|
||||
UpdateWrapper<ShopStoreSameCityTransport> updateWrapper = new UpdateWrapper<>();
|
||||
updateWrapper.eq("transport_id", transport.getTransport_id());
|
||||
updateWrapper.eq("transport_base_id", transport.getTransport_base_id());
|
||||
updateWrapper.eq("store_id", transport.getStore_id());
|
||||
|
||||
ShopStoreSameCityTransport updateTransport = new ShopStoreSameCityTransport();
|
||||
updateTransport.setArea_type(transport.getArea_type());
|
||||
@ -131,4 +170,31 @@ public class ShopStoreSameCityTransportServiceImpl extends BaseServiceImpl<ShopS
|
||||
return update(updateTransport, updateWrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除一条区域配送设置
|
||||
*
|
||||
* @param transportId
|
||||
* @param storeId
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Boolean deleteShopStoreSameCityTransport(Long transportId, Long storeId) {
|
||||
if (transportId == null || transportId == null || transportId <= 0 || storeId == null || storeId <= 0) {
|
||||
logger.error("缺少 transportId 或 storeId 必要参数!");
|
||||
return false;
|
||||
}
|
||||
|
||||
QueryWrapper<ShopStoreSameCityTransport> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("transport_id", transportId);
|
||||
queryWrapper.eq("store_id", storeId);
|
||||
|
||||
ShopStoreSameCityTransport record = getOne(queryWrapper);
|
||||
if (record == null) {
|
||||
logger.error("删除记录不存在!");
|
||||
return false;
|
||||
}
|
||||
|
||||
return remove(record.getTransport_id());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -72,7 +72,7 @@ public class ShopStoreSfOrderServiceImpl extends BaseServiceImpl<ShopStoreSfOrde
|
||||
*/
|
||||
@Override
|
||||
public Boolean updateShopStoreSfOrderStatus(ShopStoreSfOrder record) {
|
||||
if (record==null|| StrUtil.isEmpty(record.getSf_order_id()) && record.getSf_order_status() == null || StrUtil.isEmpty(record.getFeed()) || StrUtil.isEmpty(record.getSf_order_status_desc())) {
|
||||
if (record == null || StrUtil.isEmpty(record.getSf_order_id()) && record.getSf_order_status() == null || StrUtil.isEmpty(record.getFeed()) || StrUtil.isEmpty(record.getSf_order_status_desc())) {
|
||||
logger.info("缺少必要参数!");
|
||||
return false;
|
||||
}
|
||||
@ -81,54 +81,54 @@ public class ShopStoreSfOrderServiceImpl extends BaseServiceImpl<ShopStoreSfOrde
|
||||
UpdateWrapper<ShopStoreSfOrder> updateWrapper = new UpdateWrapper<>();
|
||||
updateWrapper.eq("sf_order_id", record.getSf_order_id());
|
||||
|
||||
if (record.getSf_order_status() != null && record.getSf_order_status() > 0) {
|
||||
updateWrapper.set("sf_order_status", record.getSf_order_status() );
|
||||
cnt+=1;
|
||||
if (record.getSf_order_status() != null && record.getSf_order_status() > 0) {
|
||||
updateWrapper.set("sf_order_status", record.getSf_order_status());
|
||||
cnt += 1;
|
||||
}
|
||||
|
||||
if (StrUtil.isNotEmpty(record.getSf_order_status_desc())) {
|
||||
updateWrapper.set("sf_order_status_desc", record.getSf_order_status_desc());
|
||||
cnt+=1;
|
||||
cnt += 1;
|
||||
}
|
||||
|
||||
if (StrUtil.isNotEmpty(record.getOperator_name())) {
|
||||
updateWrapper.set("operator_name", record.getOperator_name());
|
||||
cnt+=1;
|
||||
cnt += 1;
|
||||
}
|
||||
|
||||
if (StrUtil.isNotEmpty(record.getOperator_phone())) {
|
||||
updateWrapper.set("operator_phone", record.getOperator_phone());
|
||||
cnt+=1;
|
||||
cnt += 1;
|
||||
}
|
||||
|
||||
if (StrUtil.isNotEmpty(record.getFeed())) {
|
||||
updateWrapper.set("feed", record.getFeed());
|
||||
cnt+=1;
|
||||
cnt += 1;
|
||||
}
|
||||
|
||||
if (StrUtil.isNotEmpty(record.getCancel_code())) {
|
||||
updateWrapper.set("cancel_code", record.getCancel_code());
|
||||
cnt+=1;
|
||||
cnt += 1;
|
||||
}
|
||||
|
||||
if (StrUtil.isNotEmpty(record.getCancel_reason())) {
|
||||
updateWrapper.set("cancel_reason", record.getCancel_reason());
|
||||
cnt+=1;
|
||||
cnt += 1;
|
||||
}
|
||||
|
||||
if (record.getRider_lng()!=null) {
|
||||
if (record.getRider_lng() != null) {
|
||||
updateWrapper.set("rider_lng", record.getRider_lng());
|
||||
cnt+=1;
|
||||
cnt += 1;
|
||||
}
|
||||
|
||||
if (record.getRider_lat()!=null) {
|
||||
if (record.getRider_lat() != null) {
|
||||
updateWrapper.set("rider_lat", record.getPush_time());
|
||||
cnt+=1;
|
||||
cnt += 1;
|
||||
}
|
||||
|
||||
if (record.getPush_time()!=null && record.getPush_time()>0) {
|
||||
if (record.getPush_time() != null && record.getPush_time() > 0) {
|
||||
updateWrapper.set("push_time", record.getPush_time());
|
||||
cnt+=1;
|
||||
cnt += 1;
|
||||
}
|
||||
|
||||
updateWrapper.set("updated_at", new Date());
|
||||
|
||||
Loading…
Reference in New Issue
Block a user