From 5932e8e9317dcc1f4330a3b4d398ad888d74fb7c Mon Sep 17 00:00:00 2001 From: YunaiV Date: Wed, 23 Aug 2023 00:46:28 +0800 Subject: [PATCH] =?UTF-8?q?code=20review=EF=BC=9A=E8=AE=A2=E5=8D=95?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E3=80=81=E8=AF=A6=E6=83=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../delivery/DeliveryExpressController.java | 2 - .../DeliveryPickUpStoreController.java | 2 - .../DeliveryPickUpStoreSimpleRespVO.java | 24 +----------- .../admin/order/TradeOrderController.java | 16 +++++--- ...java => TradeOrderUpdateAddressReqVO.java} | 2 +- ...O.java => TradeOrderUpdatePriceReqVO.java} | 4 +- .../delivery/DeliveryExpressConvert.java | 1 + .../convert/order/TradeOrderConvert.java | 4 +- .../delivery/DeliveryExpressService.java | 6 +-- .../order/TradeOrderUpdateService.java | 14 +++---- .../order/TradeOrderUpdateServiceImpl.java | 37 +++++++++++-------- .../module/pay/enums/ErrorCodeConstants.java | 2 +- 12 files changed, 48 insertions(+), 66 deletions(-) rename yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/order/vo/{TradeOrderAdjustAddressReqVO.java => TradeOrderUpdateAddressReqVO.java} (96%) rename yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/order/vo/{TradeOrderAdjustPriceReqVO.java => TradeOrderUpdatePriceReqVO.java} (72%) diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/delivery/DeliveryExpressController.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/delivery/DeliveryExpressController.java index 699530f3d4..12236abba5 100644 --- a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/delivery/DeliveryExpressController.java +++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/delivery/DeliveryExpressController.java @@ -70,9 +70,7 @@ public class DeliveryExpressController { @GetMapping("/list-all-simple") @Operation(summary = "获取快递公司精简信息列表", description = "主要用于前端的下拉选项") public CommonResult> getSimpleDeliveryExpressList() { - // 获取品牌列表,只要开启状态的 List list = deliveryExpressService.getDeliveryExpressListByStatus(CommonStatusEnum.ENABLE.getStatus()); - // 排序后,返回给前端 return success(DeliveryExpressConvert.INSTANCE.convertList1(list)); } diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/delivery/DeliveryPickUpStoreController.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/delivery/DeliveryPickUpStoreController.java index 6bbbda381a..a8ddec24cc 100644 --- a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/delivery/DeliveryPickUpStoreController.java +++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/delivery/DeliveryPickUpStoreController.java @@ -66,9 +66,7 @@ public class DeliveryPickUpStoreController { @GetMapping("/list-all-simple") @Operation(summary = "获取快递公司精简信息列表") public CommonResult> getSimpleDeliveryPickUpStoreList() { - // 获取品牌列表,只要开启状态的 List list = deliveryPickUpStoreService.getDeliveryPickUpStoreListByStatus(CommonStatusEnum.ENABLE.getStatus()); - // 排序后,返回给前端 return success(DeliveryPickUpStoreConvert.INSTANCE.convertList1(list)); } diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/delivery/vo/pickup/DeliveryPickUpStoreSimpleRespVO.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/delivery/vo/pickup/DeliveryPickUpStoreSimpleRespVO.java index 05497dac75..34c66df4cc 100644 --- a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/delivery/vo/pickup/DeliveryPickUpStoreSimpleRespVO.java +++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/delivery/vo/pickup/DeliveryPickUpStoreSimpleRespVO.java @@ -1,16 +1,10 @@ package cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.pickup; -import cn.iocoder.yudao.framework.common.validation.Mobile; -import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.v3.oas.annotations.media.Schema; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; -import javax.validation.constraints.NotBlank; -import javax.validation.constraints.NotNull; -import java.time.LocalTime; - @Schema(description = "管理后台 - 自提门店精简信息 Response VO") @Data @NoArgsConstructor @@ -18,34 +12,20 @@ import java.time.LocalTime; public class DeliveryPickUpStoreSimpleRespVO { @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "23128") - @NotNull(message = "编号不能为空") private Long id; @Schema(description = "门店名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "李四") - @NotBlank(message = "门店名称不能为空") private String name; @Schema(description = "门店手机", requiredMode = Schema.RequiredMode.REQUIRED, example = "15601892312") - @NotBlank(message = "门店手机不能为空") - @Mobile private String phone; @Schema(description = "区域编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "18733") - @NotNull(message = "区域编号不能为空") private Integer areaId; + // TODO @puhui999:要把 areaName 也返回哈 + @Schema(description = "门店详细地址", requiredMode = Schema.RequiredMode.REQUIRED, example = "复旦大学路 188 号") - @NotBlank(message = "门店详细地址不能为空") private String detailAddress; - @Schema(description = "营业开始时间", requiredMode = Schema.RequiredMode.REQUIRED) - @NotNull(message = "营业开始时间不能为空") - @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "HH:mm") - private LocalTime openingTime; - - @Schema(description = "营业结束时间", requiredMode = Schema.RequiredMode.REQUIRED) - @NotNull(message = "营业结束时间不能为空") - @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "HH:mm") - private LocalTime closingTime; - } diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/order/TradeOrderController.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/order/TradeOrderController.java index ac3cb90b6f..8a28e5ddb2 100644 --- a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/order/TradeOrderController.java +++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/order/TradeOrderController.java @@ -85,6 +85,7 @@ public class TradeOrderController { tradeOrderQueryService.getExpressTrackList(id, getLoginUserId()))); } + // TODO @puhui999:put 请求哈 @PostMapping("/delivery") @Operation(summary = "订单发货") @PreAuthorize("@ss.hasPermission('trade:order:update')") @@ -93,27 +94,30 @@ public class TradeOrderController { return success(true); } + // TODO @puhui999:put 请求哈,update-remark; @PostMapping("/remark") @Operation(summary = "订单备注") @PreAuthorize("@ss.hasPermission('trade:order:update')") - public CommonResult remarkOrder(@RequestBody TradeOrderRemarkReqVO reqVO) { - tradeOrderUpdateService.remarkOrder(reqVO); + public CommonResult updateOrderRemark(@RequestBody TradeOrderRemarkReqVO reqVO) { + tradeOrderUpdateService.updateOrderRemark(reqVO); return success(true); } + // TODO @puhui999:put 请求哈,update-price; @PostMapping("/adjust-price") @Operation(summary = "订单调价") @PreAuthorize("@ss.hasPermission('trade:order:update')") - public CommonResult adjustPrice(@RequestBody TradeOrderAdjustPriceReqVO reqVO) { - tradeOrderUpdateService.adjustPrice(reqVO); + public CommonResult updateOrderPrice(@RequestBody TradeOrderUpdatePriceReqVO reqVO) { + tradeOrderUpdateService.updateOrderPrice(reqVO); return success(true); } + // TODO @puhui999:put 请求哈,update-address; @PostMapping("/adjust-address") @Operation(summary = "修改订单收货地址") @PreAuthorize("@ss.hasPermission('trade:order:update')") - public CommonResult adjustAddress(@RequestBody TradeOrderAdjustAddressReqVO reqVO) { - tradeOrderUpdateService.adjustAddress(reqVO); + public CommonResult updateOrderAddress(@RequestBody TradeOrderUpdateAddressReqVO reqVO) { + tradeOrderUpdateService.updateOrderAddress(reqVO); return success(true); } diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/order/vo/TradeOrderAdjustAddressReqVO.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/order/vo/TradeOrderUpdateAddressReqVO.java similarity index 96% rename from yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/order/vo/TradeOrderAdjustAddressReqVO.java rename to yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/order/vo/TradeOrderUpdateAddressReqVO.java index 5ea530b29c..b66216b46e 100644 --- a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/order/vo/TradeOrderAdjustAddressReqVO.java +++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/order/vo/TradeOrderUpdateAddressReqVO.java @@ -8,7 +8,7 @@ import javax.validation.constraints.NotNull; @Schema(description = "管理后台 - 订单修改地址 Request VO") @Data -public class TradeOrderAdjustAddressReqVO { +public class TradeOrderUpdateAddressReqVO { @Schema(description = "订单编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") @NotNull(message = "订单编号不能为空") diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/order/vo/TradeOrderAdjustPriceReqVO.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/order/vo/TradeOrderUpdatePriceReqVO.java similarity index 72% rename from yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/order/vo/TradeOrderAdjustPriceReqVO.java rename to yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/order/vo/TradeOrderUpdatePriceReqVO.java index bed7ac0e93..d3e0afb7cf 100644 --- a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/order/vo/TradeOrderAdjustPriceReqVO.java +++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/order/vo/TradeOrderUpdatePriceReqVO.java @@ -7,13 +7,13 @@ import javax.validation.constraints.NotNull; @Schema(description = "管理后台 - 订单改价 Request VO") @Data -public class TradeOrderAdjustPriceReqVO { +public class TradeOrderUpdatePriceReqVO { @Schema(description = "订单编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") @NotNull(message = "订单编号不能为空") private Long id; - @Schema(description = "订单调价,单位:分 正数,加价;负数,减价", requiredMode = Schema.RequiredMode.REQUIRED, example = "-100") + @Schema(description = "订单调价,单位:分。正数,加价;负数,减价", requiredMode = Schema.RequiredMode.REQUIRED, example = "-100") @NotNull(message = "订单调价价格不能为空") private Integer adjustPrice; diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/convert/delivery/DeliveryExpressConvert.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/convert/delivery/DeliveryExpressConvert.java index 73ef5e67d5..3910dcaa31 100644 --- a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/convert/delivery/DeliveryExpressConvert.java +++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/convert/delivery/DeliveryExpressConvert.java @@ -31,6 +31,7 @@ public interface DeliveryExpressConvert { List convertList02(List list); List convertList1(List list); + List convertList03(List list); } diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/convert/order/TradeOrderConvert.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/convert/order/TradeOrderConvert.java index 4d83a46f78..76e79c5239 100644 --- a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/convert/order/TradeOrderConvert.java +++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/convert/order/TradeOrderConvert.java @@ -277,9 +277,9 @@ public interface TradeOrderConvert { List convertList02(List list); - TradeOrderDO convert(TradeOrderAdjustAddressReqVO reqVO); + TradeOrderDO convert(TradeOrderUpdateAddressReqVO reqVO); - TradeOrderDO convert(TradeOrderAdjustPriceReqVO reqVO); + TradeOrderDO convert(TradeOrderUpdatePriceReqVO reqVO); TradeOrderDO convert(TradeOrderRemarkReqVO reqVO); diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/delivery/DeliveryExpressService.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/delivery/DeliveryExpressService.java index 5aeceac2c6..f47f899bbe 100644 --- a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/delivery/DeliveryExpressService.java +++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/delivery/DeliveryExpressService.java @@ -1,8 +1,5 @@ package cn.iocoder.yudao.module.trade.service.delivery; -import java.util.*; -import javax.validation.*; - import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.express.DeliveryExpressCreateReqVO; import cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.express.DeliveryExpressExportReqVO; @@ -11,7 +8,6 @@ import cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.express.Delive import cn.iocoder.yudao.module.trade.dal.dataobject.delivery.DeliveryExpressDO; import javax.validation.Valid; -import java.util.Collection; import java.util.List; /** @@ -71,7 +67,7 @@ public interface DeliveryExpressService { * 获取指定状态的快递公司列表 * * @param status 状态 - * @return 返回快递公司列表 + * @return 快递公司列表 */ List getDeliveryExpressListByStatus(Integer status); } diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/order/TradeOrderUpdateService.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/order/TradeOrderUpdateService.java index 217ba154c2..bf52358e6b 100644 --- a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/order/TradeOrderUpdateService.java +++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/order/TradeOrderUpdateService.java @@ -1,7 +1,7 @@ package cn.iocoder.yudao.module.trade.service.order; -import cn.iocoder.yudao.module.trade.controller.admin.order.vo.TradeOrderAdjustAddressReqVO; -import cn.iocoder.yudao.module.trade.controller.admin.order.vo.TradeOrderAdjustPriceReqVO; +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.app.order.vo.AppTradeOrderCreateReqVO; @@ -67,21 +67,21 @@ public interface TradeOrderUpdateService { * * @param reqVO 请求 */ - void remarkOrder(TradeOrderRemarkReqVO reqVO); + void updateOrderRemark(TradeOrderRemarkReqVO reqVO); /** - * 调整价格 + * 【管理员】调整价格 * * @param reqVO 请求 */ - void adjustPrice(TradeOrderAdjustPriceReqVO reqVO); + void updateOrderPrice(TradeOrderUpdatePriceReqVO reqVO); /** - * 调整地址 + * 【管理员】调整地址 * * @param reqVO 请求 */ - void adjustAddress(TradeOrderAdjustAddressReqVO reqVO); + void updateOrderAddress(TradeOrderUpdateAddressReqVO reqVO); // =================== Order Item =================== diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/order/TradeOrderUpdateServiceImpl.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/order/TradeOrderUpdateServiceImpl.java index 934a46fdf8..dd119a64ed 100644 --- a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/order/TradeOrderUpdateServiceImpl.java +++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/order/TradeOrderUpdateServiceImpl.java @@ -29,8 +29,8 @@ 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.TradeOrderAdjustAddressReqVO; -import cn.iocoder.yudao.module.trade.controller.admin.order.vo.TradeOrderAdjustPriceReqVO; +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.app.order.vo.AppTradeOrderCreateReqVO; @@ -68,7 +68,7 @@ import java.util.Objects; import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.*; import static cn.iocoder.yudao.module.pay.enums.ErrorCodeConstants.ORDER_NOT_FOUND; -import static cn.iocoder.yudao.module.pay.enums.ErrorCodeConstants.ORDER_PAID_NO_ADJUST_PRICE; +import static cn.iocoder.yudao.module.pay.enums.ErrorCodeConstants.ORDER_UPDATE_PRICE_FAIL_PAID; import static cn.iocoder.yudao.module.trade.enums.ErrorCodeConstants.*; /** @@ -350,7 +350,7 @@ public class TradeOrderUpdateServiceImpl implements TradeOrderUpdateService { */ private KeyValue validateOrderPayable(Long id, Long payOrderId) { // 校验订单是否存在 - TradeOrderDO order = validateOrder(id); + TradeOrderDO order = validateOrderExists(id); // 校验订单未支付 if (!TradeOrderStatusEnum.isUnpaid(order.getStatus()) || order.getPayStatus()) { log.error("[validateOrderPaid][order({}) 不处于待支付状态,请进行处理!order 数据是:{}]", @@ -397,8 +397,10 @@ public class TradeOrderUpdateServiceImpl implements TradeOrderUpdateService { // TODO @puhui999:只有选择快递的,才可以发货 // 1.1 校验并获得交易订单(可发货) TradeOrderDO order = validateOrderDeliverable(deliveryReqVO.getId()); - TradeOrderDO updateOrderObj = new TradeOrderDO(); + + // TODO @puhui999:下面不修改 deliveryType,直接校验 deliveryType 是否为快递,是快递才可以发货;先做严格的方式哈。 // 判断发货类型 + TradeOrderDO updateOrderObj = new TradeOrderDO(); // 2.1 快递发货 if (ObjectUtil.notEqual(deliveryReqVO.getLogisticsId(), 0L)) { // 校验快递公司 @@ -414,13 +416,13 @@ public class TradeOrderUpdateServiceImpl implements TradeOrderUpdateService { // 2.2 无需发货 updateOrderObj.setLogisticsId(0L).setLogisticsNo("").setDeliveryType(DeliveryTypeEnum.NULL.getMode()); } - // 更新 TradeOrderDO 状态为已发货,等待收货 updateOrderObj.setStatus(TradeOrderStatusEnum.DELIVERED.getStatus()).setDeliveryTime(LocalDateTime.now()); int updateCount = tradeOrderMapper.updateByIdAndStatus(order.getId(), order.getStatus(), updateOrderObj); if (updateCount == 0) { throw exception(ORDER_DELIVERY_FAIL_STATUS_NOT_UNDELIVERED); } + // TODO 芋艿:发送订单变化的消息 // 发送站内信 @@ -428,7 +430,6 @@ public class TradeOrderUpdateServiceImpl implements TradeOrderUpdateService { .setUserId(order.getUserId()).setMessage(null)); // TODO 芋艿:OrderLog - // TODO 设计:lili:是不是发货后,才支持售后? } /** @@ -440,8 +441,9 @@ public class TradeOrderUpdateServiceImpl implements TradeOrderUpdateService { * @return 交易订单 */ private TradeOrderDO validateOrderDeliverable(Long id) { - TradeOrderDO order = validateOrder(id); + TradeOrderDO order = validateOrderExists(id); // 校验订单是否是待发货状态 + // TODO @puhui999:已经发货,可以重新发货,修改信息; if (!TradeOrderStatusEnum.isUndelivered(order.getStatus())) { throw exception(ORDER_DELIVERY_FAIL_STATUS_NOT_UNDELIVERED); } @@ -452,6 +454,7 @@ public class TradeOrderUpdateServiceImpl implements TradeOrderUpdateService { // 订单类型:拼团 if (Objects.equals(TradeOrderTypeEnum.COMBINATION.getType(), order.getType())) { // 校验订单拼团是否成功 + // TODO @puhui999:是不是取反? if (combinationRecordApi.isCombinationRecordSuccess(order.getUserId(), order.getId())) { throw exception(ORDER_DELIVERY_FAIL_COMBINATION_RECORD_STATUS_NOT_SUCCESS); } @@ -459,6 +462,7 @@ public class TradeOrderUpdateServiceImpl implements TradeOrderUpdateService { // 订单类类型:砍价 if (Objects.equals(TradeOrderTypeEnum.BARGAIN.getType(), order.getType())) { // 校验订单砍价是否成功 + // TODO @puhui999:是不是取反? if (bargainRecordApi.isBargainRecordSuccess(order.getUserId(), order.getId())) { throw exception(ORDER_DELIVERY_FAIL_BARGAIN_RECORD_STATUS_NOT_SUCCESS); } @@ -467,7 +471,7 @@ public class TradeOrderUpdateServiceImpl implements TradeOrderUpdateService { } @NotNull - private TradeOrderDO validateOrder(Long id) { + private TradeOrderDO validateOrderExists(Long id) { // 校验订单是否存在 TradeOrderDO order = tradeOrderMapper.selectById(id); if (order == null) { @@ -496,9 +500,9 @@ public class TradeOrderUpdateServiceImpl implements TradeOrderUpdateService { } @Override - public void remarkOrder(TradeOrderRemarkReqVO reqVO) { + public void updateOrderRemark(TradeOrderRemarkReqVO reqVO) { // 校验并获得交易订单 - validateOrder(reqVO.getId()); + validateOrderExists(reqVO.getId()); // 更新 TradeOrderDO order = TradeOrderConvert.INSTANCE.convert(reqVO); @@ -506,23 +510,24 @@ public class TradeOrderUpdateServiceImpl implements TradeOrderUpdateService { } @Override - public void adjustPrice(TradeOrderAdjustPriceReqVO reqVO) { + public void updateOrderPrice(TradeOrderUpdatePriceReqVO reqVO) { // 校验交易订单 - TradeOrderDO order = validateOrder(reqVO.getId()); + TradeOrderDO order = validateOrderExists(reqVO.getId()); if (order.getPayStatus()) { - throw exception(ORDER_PAID_NO_ADJUST_PRICE); + throw exception(ORDER_UPDATE_PRICE_FAIL_PAID); } // 更新 + // TODO @puhui999:TradeOrderItemDO 需要做 adjustPrice 的分摊;另外,支付订单那的价格,需要 update 下; TradeOrderDO update = TradeOrderConvert.INSTANCE.convert(reqVO); update.setPayPrice(update.getPayPrice() + update.getAdjustPrice()); tradeOrderMapper.updateById(update); } @Override - public void adjustAddress(TradeOrderAdjustAddressReqVO reqVO) { + public void updateOrderAddress(TradeOrderUpdateAddressReqVO reqVO) { // 校验交易订单 - validateOrder(reqVO.getId()); + validateOrderExists(reqVO.getId()); // TODO 是否需要校验订单是否发货 // TODO 发货后是否支持修改收货地址 diff --git a/yudao-module-pay/yudao-module-pay-api/src/main/java/cn/iocoder/yudao/module/pay/enums/ErrorCodeConstants.java b/yudao-module-pay/yudao-module-pay-api/src/main/java/cn/iocoder/yudao/module/pay/enums/ErrorCodeConstants.java index e1c933fd1d..65f80d7eb7 100644 --- a/yudao-module-pay/yudao-module-pay-api/src/main/java/cn/iocoder/yudao/module/pay/enums/ErrorCodeConstants.java +++ b/yudao-module-pay/yudao-module-pay-api/src/main/java/cn/iocoder/yudao/module/pay/enums/ErrorCodeConstants.java @@ -27,7 +27,7 @@ public interface ErrorCodeConstants { ErrorCode ORDER_IS_EXPIRED = new ErrorCode(1007002003, "支付订单已经过期"); ErrorCode ORDER_SUBMIT_CHANNEL_ERROR = new ErrorCode(1007002004, "发起支付报错,错误码:{},错误提示:{}"); ErrorCode ORDER_REFUND_FAIL_STATUS_ERROR = new ErrorCode(1007002005, "支付订单退款失败,原因:状态不是已支付或已退款"); - ErrorCode ORDER_PAID_NO_ADJUST_PRICE = new ErrorCode(1007002006, "支付订单调价失败,原因:支付订单已付款,不能调价"); + ErrorCode ORDER_UPDATE_PRICE_FAIL_PAID = new ErrorCode(1007002006, "支付订单调价失败,原因:支付订单已付款,不能调价"); // ========== ORDER 模块(拓展单) 1007003000 ========== ErrorCode ORDER_EXTENSION_NOT_FOUND = new ErrorCode(1007003000, "支付交易拓展单不存在");