code review:订单列表、详情
This commit is contained in:
parent
c0ffaf8ea9
commit
5932e8e931
|
@ -70,9 +70,7 @@ public class DeliveryExpressController {
|
|||
@GetMapping("/list-all-simple")
|
||||
@Operation(summary = "获取快递公司精简信息列表", description = "主要用于前端的下拉选项")
|
||||
public CommonResult<List<DeliveryExpressSimpleRespVO>> getSimpleDeliveryExpressList() {
|
||||
// 获取品牌列表,只要开启状态的
|
||||
List<DeliveryExpressDO> list = deliveryExpressService.getDeliveryExpressListByStatus(CommonStatusEnum.ENABLE.getStatus());
|
||||
// 排序后,返回给前端
|
||||
return success(DeliveryExpressConvert.INSTANCE.convertList1(list));
|
||||
}
|
||||
|
||||
|
|
|
@ -66,9 +66,7 @@ public class DeliveryPickUpStoreController {
|
|||
@GetMapping("/list-all-simple")
|
||||
@Operation(summary = "获取快递公司精简信息列表")
|
||||
public CommonResult<List<DeliveryPickUpStoreSimpleRespVO>> getSimpleDeliveryPickUpStoreList() {
|
||||
// 获取品牌列表,只要开启状态的
|
||||
List<DeliveryPickUpStoreDO> list = deliveryPickUpStoreService.getDeliveryPickUpStoreListByStatus(CommonStatusEnum.ENABLE.getStatus());
|
||||
// 排序后,返回给前端
|
||||
return success(DeliveryPickUpStoreConvert.INSTANCE.convertList1(list));
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
}
|
||||
|
|
|
@ -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<Boolean> remarkOrder(@RequestBody TradeOrderRemarkReqVO reqVO) {
|
||||
tradeOrderUpdateService.remarkOrder(reqVO);
|
||||
public CommonResult<Boolean> 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<Boolean> adjustPrice(@RequestBody TradeOrderAdjustPriceReqVO reqVO) {
|
||||
tradeOrderUpdateService.adjustPrice(reqVO);
|
||||
public CommonResult<Boolean> 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<Boolean> adjustAddress(@RequestBody TradeOrderAdjustAddressReqVO reqVO) {
|
||||
tradeOrderUpdateService.adjustAddress(reqVO);
|
||||
public CommonResult<Boolean> updateOrderAddress(@RequestBody TradeOrderUpdateAddressReqVO reqVO) {
|
||||
tradeOrderUpdateService.updateOrderAddress(reqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
|
|
|
@ -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 = "订单编号不能为空")
|
|
@ -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;
|
||||
|
|
@ -31,6 +31,7 @@ public interface DeliveryExpressConvert {
|
|||
List<DeliveryExpressExcelVO> convertList02(List<DeliveryExpressDO> list);
|
||||
|
||||
List<DeliveryExpressSimpleRespVO> convertList1(List<DeliveryExpressDO> list);
|
||||
|
||||
List<AppDeliveryExpressRespVO> convertList03(List<DeliveryExpressDO> list);
|
||||
|
||||
}
|
||||
|
|
|
@ -277,9 +277,9 @@ public interface TradeOrderConvert {
|
|||
|
||||
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);
|
||||
|
||||
|
|
|
@ -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<DeliveryExpressDO> getDeliveryExpressListByStatus(Integer status);
|
||||
}
|
||||
|
|
|
@ -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 ===================
|
||||
|
||||
|
|
|
@ -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<TradeOrderDO, PayOrderRespDTO> 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 发货后是否支持修改收货地址
|
||||
|
||||
|
|
|
@ -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, "支付交易拓展单不存在");
|
||||
|
|
Loading…
Reference in New Issue