code review:订单列表、详情

This commit is contained in:
YunaiV 2023-08-23 00:46:28 +08:00
parent c0ffaf8ea9
commit 5932e8e931
12 changed files with 48 additions and 66 deletions

View File

@ -70,9 +70,7 @@ public class DeliveryExpressController {
@GetMapping("/list-all-simple") @GetMapping("/list-all-simple")
@Operation(summary = "获取快递公司精简信息列表", description = "主要用于前端的下拉选项") @Operation(summary = "获取快递公司精简信息列表", description = "主要用于前端的下拉选项")
public CommonResult<List<DeliveryExpressSimpleRespVO>> getSimpleDeliveryExpressList() { public CommonResult<List<DeliveryExpressSimpleRespVO>> getSimpleDeliveryExpressList() {
// 获取品牌列表只要开启状态的
List<DeliveryExpressDO> list = deliveryExpressService.getDeliveryExpressListByStatus(CommonStatusEnum.ENABLE.getStatus()); List<DeliveryExpressDO> list = deliveryExpressService.getDeliveryExpressListByStatus(CommonStatusEnum.ENABLE.getStatus());
// 排序后返回给前端
return success(DeliveryExpressConvert.INSTANCE.convertList1(list)); return success(DeliveryExpressConvert.INSTANCE.convertList1(list));
} }

View File

@ -66,9 +66,7 @@ public class DeliveryPickUpStoreController {
@GetMapping("/list-all-simple") @GetMapping("/list-all-simple")
@Operation(summary = "获取快递公司精简信息列表") @Operation(summary = "获取快递公司精简信息列表")
public CommonResult<List<DeliveryPickUpStoreSimpleRespVO>> getSimpleDeliveryPickUpStoreList() { public CommonResult<List<DeliveryPickUpStoreSimpleRespVO>> getSimpleDeliveryPickUpStoreList() {
// 获取品牌列表只要开启状态的
List<DeliveryPickUpStoreDO> list = deliveryPickUpStoreService.getDeliveryPickUpStoreListByStatus(CommonStatusEnum.ENABLE.getStatus()); List<DeliveryPickUpStoreDO> list = deliveryPickUpStoreService.getDeliveryPickUpStoreListByStatus(CommonStatusEnum.ENABLE.getStatus());
// 排序后返回给前端
return success(DeliveryPickUpStoreConvert.INSTANCE.convertList1(list)); return success(DeliveryPickUpStoreConvert.INSTANCE.convertList1(list));
} }

View File

@ -1,16 +1,10 @@
package cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.pickup; 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 io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.time.LocalTime;
@Schema(description = "管理后台 - 自提门店精简信息 Response VO") @Schema(description = "管理后台 - 自提门店精简信息 Response VO")
@Data @Data
@NoArgsConstructor @NoArgsConstructor
@ -18,34 +12,20 @@ import java.time.LocalTime;
public class DeliveryPickUpStoreSimpleRespVO { public class DeliveryPickUpStoreSimpleRespVO {
@Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "23128") @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "23128")
@NotNull(message = "编号不能为空")
private Long id; private Long id;
@Schema(description = "门店名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "李四") @Schema(description = "门店名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "李四")
@NotBlank(message = "门店名称不能为空")
private String name; private String name;
@Schema(description = "门店手机", requiredMode = Schema.RequiredMode.REQUIRED, example = "15601892312") @Schema(description = "门店手机", requiredMode = Schema.RequiredMode.REQUIRED, example = "15601892312")
@NotBlank(message = "门店手机不能为空")
@Mobile
private String phone; private String phone;
@Schema(description = "区域编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "18733") @Schema(description = "区域编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "18733")
@NotNull(message = "区域编号不能为空")
private Integer areaId; private Integer areaId;
// TODO @puhui999要把 areaName 也返回哈
@Schema(description = "门店详细地址", requiredMode = Schema.RequiredMode.REQUIRED, example = "复旦大学路 188 号") @Schema(description = "门店详细地址", requiredMode = Schema.RequiredMode.REQUIRED, example = "复旦大学路 188 号")
@NotBlank(message = "门店详细地址不能为空")
private String detailAddress; 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;
} }

View File

@ -85,6 +85,7 @@ public class TradeOrderController {
tradeOrderQueryService.getExpressTrackList(id, getLoginUserId()))); tradeOrderQueryService.getExpressTrackList(id, getLoginUserId())));
} }
// TODO @puhui999put 请求哈
@PostMapping("/delivery") @PostMapping("/delivery")
@Operation(summary = "订单发货") @Operation(summary = "订单发货")
@PreAuthorize("@ss.hasPermission('trade:order:update')") @PreAuthorize("@ss.hasPermission('trade:order:update')")
@ -93,27 +94,30 @@ public class TradeOrderController {
return success(true); return success(true);
} }
// TODO @puhui999put 请求哈update-remark
@PostMapping("/remark") @PostMapping("/remark")
@Operation(summary = "订单备注") @Operation(summary = "订单备注")
@PreAuthorize("@ss.hasPermission('trade:order:update')") @PreAuthorize("@ss.hasPermission('trade:order:update')")
public CommonResult<Boolean> remarkOrder(@RequestBody TradeOrderRemarkReqVO reqVO) { public CommonResult<Boolean> updateOrderRemark(@RequestBody TradeOrderRemarkReqVO reqVO) {
tradeOrderUpdateService.remarkOrder(reqVO); tradeOrderUpdateService.updateOrderRemark(reqVO);
return success(true); return success(true);
} }
// TODO @puhui999put 请求哈update-price
@PostMapping("/adjust-price") @PostMapping("/adjust-price")
@Operation(summary = "订单调价") @Operation(summary = "订单调价")
@PreAuthorize("@ss.hasPermission('trade:order:update')") @PreAuthorize("@ss.hasPermission('trade:order:update')")
public CommonResult<Boolean> adjustPrice(@RequestBody TradeOrderAdjustPriceReqVO reqVO) { public CommonResult<Boolean> updateOrderPrice(@RequestBody TradeOrderUpdatePriceReqVO reqVO) {
tradeOrderUpdateService.adjustPrice(reqVO); tradeOrderUpdateService.updateOrderPrice(reqVO);
return success(true); return success(true);
} }
// TODO @puhui999put 请求哈update-address
@PostMapping("/adjust-address") @PostMapping("/adjust-address")
@Operation(summary = "修改订单收货地址") @Operation(summary = "修改订单收货地址")
@PreAuthorize("@ss.hasPermission('trade:order:update')") @PreAuthorize("@ss.hasPermission('trade:order:update')")
public CommonResult<Boolean> adjustAddress(@RequestBody TradeOrderAdjustAddressReqVO reqVO) { public CommonResult<Boolean> updateOrderAddress(@RequestBody TradeOrderUpdateAddressReqVO reqVO) {
tradeOrderUpdateService.adjustAddress(reqVO); tradeOrderUpdateService.updateOrderAddress(reqVO);
return success(true); return success(true);
} }

View File

@ -8,7 +8,7 @@ import javax.validation.constraints.NotNull;
@Schema(description = "管理后台 - 订单修改地址 Request VO") @Schema(description = "管理后台 - 订单修改地址 Request VO")
@Data @Data
public class TradeOrderAdjustAddressReqVO { public class TradeOrderUpdateAddressReqVO {
@Schema(description = "订单编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") @Schema(description = "订单编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
@NotNull(message = "订单编号不能为空") @NotNull(message = "订单编号不能为空")

View File

@ -7,13 +7,13 @@ import javax.validation.constraints.NotNull;
@Schema(description = "管理后台 - 订单改价 Request VO") @Schema(description = "管理后台 - 订单改价 Request VO")
@Data @Data
public class TradeOrderAdjustPriceReqVO { public class TradeOrderUpdatePriceReqVO {
@Schema(description = "订单编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") @Schema(description = "订单编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
@NotNull(message = "订单编号不能为空") @NotNull(message = "订单编号不能为空")
private Long id; private Long id;
@Schema(description = "订单调价,单位:分 正数,加价;负数,减价", requiredMode = Schema.RequiredMode.REQUIRED, example = "-100") @Schema(description = "订单调价,单位:分正数,加价;负数,减价", requiredMode = Schema.RequiredMode.REQUIRED, example = "-100")
@NotNull(message = "订单调价价格不能为空") @NotNull(message = "订单调价价格不能为空")
private Integer adjustPrice; private Integer adjustPrice;

View File

@ -31,6 +31,7 @@ public interface DeliveryExpressConvert {
List<DeliveryExpressExcelVO> convertList02(List<DeliveryExpressDO> list); List<DeliveryExpressExcelVO> convertList02(List<DeliveryExpressDO> list);
List<DeliveryExpressSimpleRespVO> convertList1(List<DeliveryExpressDO> list); List<DeliveryExpressSimpleRespVO> convertList1(List<DeliveryExpressDO> list);
List<AppDeliveryExpressRespVO> convertList03(List<DeliveryExpressDO> list); List<AppDeliveryExpressRespVO> convertList03(List<DeliveryExpressDO> list);
} }

View File

@ -277,9 +277,9 @@ public interface TradeOrderConvert {
List<AppOrderExpressTrackRespDTO> convertList02(List<ExpressTrackRespDTO> list); List<AppOrderExpressTrackRespDTO> convertList02(List<ExpressTrackRespDTO> list);
TradeOrderDO convert(TradeOrderAdjustAddressReqVO reqVO); TradeOrderDO convert(TradeOrderUpdateAddressReqVO reqVO);
TradeOrderDO convert(TradeOrderAdjustPriceReqVO reqVO); TradeOrderDO convert(TradeOrderUpdatePriceReqVO reqVO);
TradeOrderDO convert(TradeOrderRemarkReqVO reqVO); TradeOrderDO convert(TradeOrderRemarkReqVO reqVO);

View File

@ -1,8 +1,5 @@
package cn.iocoder.yudao.module.trade.service.delivery; 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.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.DeliveryExpressCreateReqVO;
import cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.express.DeliveryExpressExportReqVO; 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 cn.iocoder.yudao.module.trade.dal.dataobject.delivery.DeliveryExpressDO;
import javax.validation.Valid; import javax.validation.Valid;
import java.util.Collection;
import java.util.List; import java.util.List;
/** /**
@ -71,7 +67,7 @@ public interface DeliveryExpressService {
* 获取指定状态的快递公司列表 * 获取指定状态的快递公司列表
* *
* @param status 状态 * @param status 状态
* @return 返回快递公司列表 * @return 快递公司列表
*/ */
List<DeliveryExpressDO> getDeliveryExpressListByStatus(Integer status); List<DeliveryExpressDO> getDeliveryExpressListByStatus(Integer status);
} }

View File

@ -1,7 +1,7 @@
package cn.iocoder.yudao.module.trade.service.order; 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.TradeOrderUpdateAddressReqVO;
import cn.iocoder.yudao.module.trade.controller.admin.order.vo.TradeOrderAdjustPriceReqVO; 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.TradeOrderDeliveryReqVO;
import cn.iocoder.yudao.module.trade.controller.admin.order.vo.TradeOrderRemarkReqVO; import cn.iocoder.yudao.module.trade.controller.admin.order.vo.TradeOrderRemarkReqVO;
import cn.iocoder.yudao.module.trade.controller.app.order.vo.AppTradeOrderCreateReqVO; import cn.iocoder.yudao.module.trade.controller.app.order.vo.AppTradeOrderCreateReqVO;
@ -67,21 +67,21 @@ public interface TradeOrderUpdateService {
* *
* @param reqVO 请求 * @param reqVO 请求
*/ */
void remarkOrder(TradeOrderRemarkReqVO reqVO); void updateOrderRemark(TradeOrderRemarkReqVO reqVO);
/** /**
* 调整价格 * 管理员调整价格
* *
* @param reqVO 请求 * @param reqVO 请求
*/ */
void adjustPrice(TradeOrderAdjustPriceReqVO reqVO); void updateOrderPrice(TradeOrderUpdatePriceReqVO reqVO);
/** /**
* 调整地址 * 管理员调整地址
* *
* @param reqVO 请求 * @param reqVO 请求
*/ */
void adjustAddress(TradeOrderAdjustAddressReqVO reqVO); void updateOrderAddress(TradeOrderUpdateAddressReqVO reqVO);
// =================== Order Item =================== // =================== Order Item ===================

View File

@ -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.CouponApi;
import cn.iocoder.yudao.module.promotion.api.coupon.dto.CouponUseReqDTO; import cn.iocoder.yudao.module.promotion.api.coupon.dto.CouponUseReqDTO;
import cn.iocoder.yudao.module.promotion.enums.combination.CombinationRecordStatusEnum; 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.TradeOrderUpdateAddressReqVO;
import cn.iocoder.yudao.module.trade.controller.admin.order.vo.TradeOrderAdjustPriceReqVO; 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.TradeOrderDeliveryReqVO;
import cn.iocoder.yudao.module.trade.controller.admin.order.vo.TradeOrderRemarkReqVO; import cn.iocoder.yudao.module.trade.controller.admin.order.vo.TradeOrderRemarkReqVO;
import cn.iocoder.yudao.module.trade.controller.app.order.vo.AppTradeOrderCreateReqVO; 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.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.*; 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_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.*; import static cn.iocoder.yudao.module.trade.enums.ErrorCodeConstants.*;
/** /**
@ -350,7 +350,7 @@ public class TradeOrderUpdateServiceImpl implements TradeOrderUpdateService {
*/ */
private KeyValue<TradeOrderDO, PayOrderRespDTO> validateOrderPayable(Long id, Long payOrderId) { private KeyValue<TradeOrderDO, PayOrderRespDTO> validateOrderPayable(Long id, Long payOrderId) {
// 校验订单是否存在 // 校验订单是否存在
TradeOrderDO order = validateOrder(id); TradeOrderDO order = validateOrderExists(id);
// 校验订单未支付 // 校验订单未支付
if (!TradeOrderStatusEnum.isUnpaid(order.getStatus()) || order.getPayStatus()) { if (!TradeOrderStatusEnum.isUnpaid(order.getStatus()) || order.getPayStatus()) {
log.error("[validateOrderPaid][order({}) 不处于待支付状态请进行处理order 数据是:{}]", log.error("[validateOrderPaid][order({}) 不处于待支付状态请进行处理order 数据是:{}]",
@ -397,8 +397,10 @@ public class TradeOrderUpdateServiceImpl implements TradeOrderUpdateService {
// TODO @puhui999只有选择快递的才可以发货 // TODO @puhui999只有选择快递的才可以发货
// 1.1 校验并获得交易订单可发货 // 1.1 校验并获得交易订单可发货
TradeOrderDO order = validateOrderDeliverable(deliveryReqVO.getId()); TradeOrderDO order = validateOrderDeliverable(deliveryReqVO.getId());
TradeOrderDO updateOrderObj = new TradeOrderDO();
// TODO @puhui999下面不修改 deliveryType直接校验 deliveryType 是否为快递是快递才可以发货先做严格的方式哈
// 判断发货类型 // 判断发货类型
TradeOrderDO updateOrderObj = new TradeOrderDO();
// 2.1 快递发货 // 2.1 快递发货
if (ObjectUtil.notEqual(deliveryReqVO.getLogisticsId(), 0L)) { if (ObjectUtil.notEqual(deliveryReqVO.getLogisticsId(), 0L)) {
// 校验快递公司 // 校验快递公司
@ -414,13 +416,13 @@ public class TradeOrderUpdateServiceImpl implements TradeOrderUpdateService {
// 2.2 无需发货 // 2.2 无需发货
updateOrderObj.setLogisticsId(0L).setLogisticsNo("").setDeliveryType(DeliveryTypeEnum.NULL.getMode()); updateOrderObj.setLogisticsId(0L).setLogisticsNo("").setDeliveryType(DeliveryTypeEnum.NULL.getMode());
} }
// 更新 TradeOrderDO 状态为已发货等待收货 // 更新 TradeOrderDO 状态为已发货等待收货
updateOrderObj.setStatus(TradeOrderStatusEnum.DELIVERED.getStatus()).setDeliveryTime(LocalDateTime.now()); updateOrderObj.setStatus(TradeOrderStatusEnum.DELIVERED.getStatus()).setDeliveryTime(LocalDateTime.now());
int updateCount = tradeOrderMapper.updateByIdAndStatus(order.getId(), order.getStatus(), updateOrderObj); int updateCount = tradeOrderMapper.updateByIdAndStatus(order.getId(), order.getStatus(), updateOrderObj);
if (updateCount == 0) { if (updateCount == 0) {
throw exception(ORDER_DELIVERY_FAIL_STATUS_NOT_UNDELIVERED); throw exception(ORDER_DELIVERY_FAIL_STATUS_NOT_UNDELIVERED);
} }
// TODO 芋艿发送订单变化的消息 // TODO 芋艿发送订单变化的消息
// 发送站内信 // 发送站内信
@ -428,7 +430,6 @@ public class TradeOrderUpdateServiceImpl implements TradeOrderUpdateService {
.setUserId(order.getUserId()).setMessage(null)); .setUserId(order.getUserId()).setMessage(null));
// TODO 芋艿OrderLog // TODO 芋艿OrderLog
// TODO 设计lili是不是发货后才支持售后
} }
/** /**
@ -440,8 +441,9 @@ public class TradeOrderUpdateServiceImpl implements TradeOrderUpdateService {
* @return 交易订单 * @return 交易订单
*/ */
private TradeOrderDO validateOrderDeliverable(Long id) { private TradeOrderDO validateOrderDeliverable(Long id) {
TradeOrderDO order = validateOrder(id); TradeOrderDO order = validateOrderExists(id);
// 校验订单是否是待发货状态 // 校验订单是否是待发货状态
// TODO @puhui999已经发货可以重新发货修改信息
if (!TradeOrderStatusEnum.isUndelivered(order.getStatus())) { if (!TradeOrderStatusEnum.isUndelivered(order.getStatus())) {
throw exception(ORDER_DELIVERY_FAIL_STATUS_NOT_UNDELIVERED); 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())) { 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); 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())) { 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); throw exception(ORDER_DELIVERY_FAIL_BARGAIN_RECORD_STATUS_NOT_SUCCESS);
} }
@ -467,7 +471,7 @@ public class TradeOrderUpdateServiceImpl implements TradeOrderUpdateService {
} }
@NotNull @NotNull
private TradeOrderDO validateOrder(Long id) { private TradeOrderDO validateOrderExists(Long id) {
// 校验订单是否存在 // 校验订单是否存在
TradeOrderDO order = tradeOrderMapper.selectById(id); TradeOrderDO order = tradeOrderMapper.selectById(id);
if (order == null) { if (order == null) {
@ -496,9 +500,9 @@ public class TradeOrderUpdateServiceImpl implements TradeOrderUpdateService {
} }
@Override @Override
public void remarkOrder(TradeOrderRemarkReqVO reqVO) { public void updateOrderRemark(TradeOrderRemarkReqVO reqVO) {
// 校验并获得交易订单 // 校验并获得交易订单
validateOrder(reqVO.getId()); validateOrderExists(reqVO.getId());
// 更新 // 更新
TradeOrderDO order = TradeOrderConvert.INSTANCE.convert(reqVO); TradeOrderDO order = TradeOrderConvert.INSTANCE.convert(reqVO);
@ -506,23 +510,24 @@ public class TradeOrderUpdateServiceImpl implements TradeOrderUpdateService {
} }
@Override @Override
public void adjustPrice(TradeOrderAdjustPriceReqVO reqVO) { public void updateOrderPrice(TradeOrderUpdatePriceReqVO reqVO) {
// 校验交易订单 // 校验交易订单
TradeOrderDO order = validateOrder(reqVO.getId()); TradeOrderDO order = validateOrderExists(reqVO.getId());
if (order.getPayStatus()) { if (order.getPayStatus()) {
throw exception(ORDER_PAID_NO_ADJUST_PRICE); throw exception(ORDER_UPDATE_PRICE_FAIL_PAID);
} }
// 更新 // 更新
// TODO @puhui999TradeOrderItemDO 需要做 adjustPrice 的分摊另外支付订单那的价格需要 update
TradeOrderDO update = TradeOrderConvert.INSTANCE.convert(reqVO); TradeOrderDO update = TradeOrderConvert.INSTANCE.convert(reqVO);
update.setPayPrice(update.getPayPrice() + update.getAdjustPrice()); update.setPayPrice(update.getPayPrice() + update.getAdjustPrice());
tradeOrderMapper.updateById(update); tradeOrderMapper.updateById(update);
} }
@Override @Override
public void adjustAddress(TradeOrderAdjustAddressReqVO reqVO) { public void updateOrderAddress(TradeOrderUpdateAddressReqVO reqVO) {
// 校验交易订单 // 校验交易订单
validateOrder(reqVO.getId()); validateOrderExists(reqVO.getId());
// TODO 是否需要校验订单是否发货 // TODO 是否需要校验订单是否发货
// TODO 发货后是否支持修改收货地址 // TODO 发货后是否支持修改收货地址

View File

@ -27,7 +27,7 @@ public interface ErrorCodeConstants {
ErrorCode ORDER_IS_EXPIRED = new ErrorCode(1007002003, "支付订单已经过期"); ErrorCode ORDER_IS_EXPIRED = new ErrorCode(1007002003, "支付订单已经过期");
ErrorCode ORDER_SUBMIT_CHANNEL_ERROR = new ErrorCode(1007002004, "发起支付报错,错误码:{},错误提示:{}"); ErrorCode ORDER_SUBMIT_CHANNEL_ERROR = new ErrorCode(1007002004, "发起支付报错,错误码:{},错误提示:{}");
ErrorCode ORDER_REFUND_FAIL_STATUS_ERROR = new ErrorCode(1007002005, "支付订单退款失败,原因:状态不是已支付或已退款"); 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 ========== // ========== ORDER 模块(拓展单) 1007003000 ==========
ErrorCode ORDER_EXTENSION_NOT_FOUND = new ErrorCode(1007003000, "支付交易拓展单不存在"); ErrorCode ORDER_EXTENSION_NOT_FOUND = new ErrorCode(1007003000, "支付交易拓展单不存在");