订单管理:完善订单管理提到的一些问题
This commit is contained in:
parent
60875a0472
commit
655eefc340
@ -32,6 +32,7 @@ public interface ErrorCodeConstants {
|
||||
ErrorCode ORDER_DELIVERY_FAIL_REFUND_STATUS_NOT_NONE = new ErrorCode(1011000021, "交易订单发货失败,订单已退款或部分退款");
|
||||
ErrorCode ORDER_DELIVERY_FAIL_COMBINATION_RECORD_STATUS_NOT_SUCCESS = new ErrorCode(1011000022, "交易订单发货失败,拼团未成功");
|
||||
ErrorCode ORDER_DELIVERY_FAIL_BARGAIN_RECORD_STATUS_NOT_SUCCESS = new ErrorCode(1011000023, "交易订单发货失败,砍价未成功");
|
||||
ErrorCode ORDER_DELIVERY_FAIL_DELIVERY_TYPE_NOT_EXPRESS = new ErrorCode(1011000024, "交易订单发货失败,发货类型不是快递");
|
||||
|
||||
// ========== After Sale 模块 1011000100 ==========
|
||||
ErrorCode AFTER_SALE_NOT_FOUND = new ErrorCode(1011000100, "售后单不存在");
|
||||
|
@ -3,6 +3,8 @@ package cn.iocoder.yudao.module.trade.controller.admin.delivery;
|
||||
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils;
|
||||
import cn.iocoder.yudao.framework.ip.core.utils.AreaUtils;
|
||||
import cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.pickup.*;
|
||||
import cn.iocoder.yudao.module.trade.convert.delivery.DeliveryPickUpStoreConvert;
|
||||
import cn.iocoder.yudao.module.trade.dal.dataobject.delivery.DeliveryPickUpStoreDO;
|
||||
@ -64,10 +66,13 @@ public class DeliveryPickUpStoreController {
|
||||
}
|
||||
|
||||
@GetMapping("/list-all-simple")
|
||||
@Operation(summary = "获取快递公司精简信息列表")
|
||||
@Operation(summary = "获得自提门店精简信息列表")
|
||||
public CommonResult<List<DeliveryPickUpStoreSimpleRespVO>> getSimpleDeliveryPickUpStoreList() {
|
||||
List<DeliveryPickUpStoreDO> list = deliveryPickUpStoreService.getDeliveryPickUpStoreListByStatus(CommonStatusEnum.ENABLE.getStatus());
|
||||
return success(DeliveryPickUpStoreConvert.INSTANCE.convertList1(list));
|
||||
return success(CollectionUtils.convertList(DeliveryPickUpStoreConvert.INSTANCE.convertList1(list), item -> {
|
||||
item.setAreaName(AreaUtils.format(item.getAreaId()));
|
||||
return item;
|
||||
}));
|
||||
}
|
||||
|
||||
@GetMapping("/list")
|
||||
|
@ -23,7 +23,8 @@ public class DeliveryPickUpStoreSimpleRespVO {
|
||||
@Schema(description = "区域编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "18733")
|
||||
private Integer areaId;
|
||||
|
||||
// TODO @puhui999:要把 areaName 也返回哈
|
||||
@Schema(description = "区域名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "xx市")
|
||||
private String areaName;
|
||||
|
||||
@Schema(description = "门店详细地址", requiredMode = Schema.RequiredMode.REQUIRED, example = "复旦大学路 188 号")
|
||||
private String detailAddress;
|
||||
|
@ -85,8 +85,7 @@ public class TradeOrderController {
|
||||
tradeOrderQueryService.getExpressTrackList(id, getLoginUserId())));
|
||||
}
|
||||
|
||||
// TODO @puhui999:put 请求哈
|
||||
@PostMapping("/delivery")
|
||||
@PutMapping("/delivery")
|
||||
@Operation(summary = "订单发货")
|
||||
@PreAuthorize("@ss.hasPermission('trade:order:update')")
|
||||
public CommonResult<Boolean> deliveryOrder(@RequestBody TradeOrderDeliveryReqVO deliveryReqVO) {
|
||||
@ -94,8 +93,7 @@ public class TradeOrderController {
|
||||
return success(true);
|
||||
}
|
||||
|
||||
// TODO @puhui999:put 请求哈,update-remark;
|
||||
@PostMapping("/remark")
|
||||
@PutMapping("/update-remark")
|
||||
@Operation(summary = "订单备注")
|
||||
@PreAuthorize("@ss.hasPermission('trade:order:update')")
|
||||
public CommonResult<Boolean> updateOrderRemark(@RequestBody TradeOrderRemarkReqVO reqVO) {
|
||||
@ -103,8 +101,7 @@ public class TradeOrderController {
|
||||
return success(true);
|
||||
}
|
||||
|
||||
// TODO @puhui999:put 请求哈,update-price;
|
||||
@PostMapping("/adjust-price")
|
||||
@PutMapping("/update-price")
|
||||
@Operation(summary = "订单调价")
|
||||
@PreAuthorize("@ss.hasPermission('trade:order:update')")
|
||||
public CommonResult<Boolean> updateOrderPrice(@RequestBody TradeOrderUpdatePriceReqVO reqVO) {
|
||||
@ -112,8 +109,7 @@ public class TradeOrderController {
|
||||
return success(true);
|
||||
}
|
||||
|
||||
// TODO @puhui999:put 请求哈,update-address;
|
||||
@PostMapping("/adjust-address")
|
||||
@PutMapping("/update-address")
|
||||
@Operation(summary = "修改订单收货地址")
|
||||
@PreAuthorize("@ss.hasPermission('trade:order:update')")
|
||||
public CommonResult<Boolean> updateOrderAddress(@RequestBody TradeOrderUpdateAddressReqVO reqVO) {
|
||||
|
@ -29,10 +29,10 @@ import cn.iocoder.yudao.module.promotion.api.combination.dto.CombinationRecordUp
|
||||
import cn.iocoder.yudao.module.promotion.api.coupon.CouponApi;
|
||||
import cn.iocoder.yudao.module.promotion.api.coupon.dto.CouponUseReqDTO;
|
||||
import cn.iocoder.yudao.module.promotion.enums.combination.CombinationRecordStatusEnum;
|
||||
import cn.iocoder.yudao.module.trade.controller.admin.order.vo.TradeOrderUpdateAddressReqVO;
|
||||
import cn.iocoder.yudao.module.trade.controller.admin.order.vo.TradeOrderUpdatePriceReqVO;
|
||||
import cn.iocoder.yudao.module.trade.controller.admin.order.vo.TradeOrderDeliveryReqVO;
|
||||
import cn.iocoder.yudao.module.trade.controller.admin.order.vo.TradeOrderRemarkReqVO;
|
||||
import cn.iocoder.yudao.module.trade.controller.admin.order.vo.TradeOrderUpdateAddressReqVO;
|
||||
import cn.iocoder.yudao.module.trade.controller.admin.order.vo.TradeOrderUpdatePriceReqVO;
|
||||
import cn.iocoder.yudao.module.trade.controller.app.order.vo.AppTradeOrderCreateReqVO;
|
||||
import cn.iocoder.yudao.module.trade.controller.app.order.vo.AppTradeOrderSettlementReqVO;
|
||||
import cn.iocoder.yudao.module.trade.controller.app.order.vo.AppTradeOrderSettlementRespVO;
|
||||
@ -397,7 +397,10 @@ public class TradeOrderUpdateServiceImpl implements TradeOrderUpdateService {
|
||||
// TODO @puhui999:只有选择快递的,才可以发货
|
||||
// 1.1 校验并获得交易订单(可发货)
|
||||
TradeOrderDO order = validateOrderDeliverable(deliveryReqVO.getId());
|
||||
|
||||
// 校验 deliveryType 是否为快递,是快递才可以发货
|
||||
if (ObjectUtil.notEqual(order.getDeliveryType(), DeliveryTypeEnum.EXPRESS.getMode())) {
|
||||
throw exception(ORDER_DELIVERY_FAIL_DELIVERY_TYPE_NOT_EXPRESS);
|
||||
}
|
||||
// TODO @puhui999:下面不修改 deliveryType,直接校验 deliveryType 是否为快递,是快递才可以发货;先做严格的方式哈。
|
||||
// 判断发货类型
|
||||
TradeOrderDO updateOrderObj = new TradeOrderDO();
|
||||
@ -411,10 +414,10 @@ public class TradeOrderUpdateServiceImpl implements TradeOrderUpdateService {
|
||||
if (deliveryExpress.getStatus().equals(CommonStatusEnum.DISABLE.getStatus())) {
|
||||
throw exception(EXPRESS_STATUS_NOT_ENABLE);
|
||||
}
|
||||
updateOrderObj.setLogisticsId(deliveryReqVO.getLogisticsId()).setLogisticsNo(deliveryReqVO.getLogisticsNo()).setDeliveryType(DeliveryTypeEnum.EXPRESS.getMode());
|
||||
updateOrderObj.setLogisticsId(deliveryReqVO.getLogisticsId()).setLogisticsNo(deliveryReqVO.getLogisticsNo());
|
||||
} else {
|
||||
// 2.2 无需发货
|
||||
updateOrderObj.setLogisticsId(0L).setLogisticsNo("").setDeliveryType(DeliveryTypeEnum.NULL.getMode());
|
||||
updateOrderObj.setLogisticsId(0L).setLogisticsNo("");
|
||||
}
|
||||
// 更新 TradeOrderDO 状态为已发货,等待收货
|
||||
updateOrderObj.setStatus(TradeOrderStatusEnum.DELIVERED.getStatus()).setDeliveryTime(LocalDateTime.now());
|
||||
@ -454,16 +457,14 @@ public class TradeOrderUpdateServiceImpl implements TradeOrderUpdateService {
|
||||
// 订单类型:拼团
|
||||
if (Objects.equals(TradeOrderTypeEnum.COMBINATION.getType(), order.getType())) {
|
||||
// 校验订单拼团是否成功
|
||||
// TODO @puhui999:是不是取反?
|
||||
if (combinationRecordApi.isCombinationRecordSuccess(order.getUserId(), order.getId())) {
|
||||
if (!combinationRecordApi.isCombinationRecordSuccess(order.getUserId(), order.getId())) {
|
||||
throw exception(ORDER_DELIVERY_FAIL_COMBINATION_RECORD_STATUS_NOT_SUCCESS);
|
||||
}
|
||||
}
|
||||
// 订单类类型:砍价
|
||||
if (Objects.equals(TradeOrderTypeEnum.BARGAIN.getType(), order.getType())) {
|
||||
// 校验订单砍价是否成功
|
||||
// TODO @puhui999:是不是取反?
|
||||
if (bargainRecordApi.isBargainRecordSuccess(order.getUserId(), order.getId())) {
|
||||
if (!bargainRecordApi.isBargainRecordSuccess(order.getUserId(), order.getId())) {
|
||||
throw exception(ORDER_DELIVERY_FAIL_BARGAIN_RECORD_STATUS_NOT_SUCCESS);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user