交易:核销

This commit is contained in:
owen 2023-10-04 10:51:36 +08:00
parent 60ea719b46
commit 7a15b340b0
7 changed files with 55 additions and 1 deletions

View File

@ -32,6 +32,7 @@ public interface ErrorCodeConstants {
ErrorCode ORDER_UPDATE_PRICE_FAIL_ALREADY = new ErrorCode(1_011_000_027, "支付订单调价失败,原因:已经修改过价格");
ErrorCode ORDER_UPDATE_PRICE_FAIL_PRICE_ERROR = new ErrorCode(1_011_000_028, "支付订单调价失败,原因:调整后支付价格不能小于 0.01 元");
ErrorCode ORDER_DELETE_FAIL_STATUS_NOT_CANCEL = new ErrorCode(1_011_000_029, "交易订单删除失败,订单不是【已取消】状态");
ErrorCode ORDER_RECEIVE_FAIL_DELIVERY_TYPE_NOT_PICK_UP = new ErrorCode(1_011_000_030, "交易订单自提失败,收货方式不是【用户自提】");
// ========== After Sale 模块 1-011-000-100 ==========
ErrorCode AFTER_SALE_NOT_FOUND = new ErrorCode(1_011_000_100, "售后单不存在");

View File

@ -19,6 +19,7 @@ public enum TradeOrderOperateTypeEnum {
ADMIN_DELIVERY(20, "已发货,快递公司:{deliveryName},快递单号:{logisticsNo}"),
MEMBER_RECEIVE(30, "用户已收货"),
SYSTEM_RECEIVE(31, "到期未收货,系统自动确认收货"),
PICK_UP_RECEIVE(32, "自提收货"),
MEMBER_COMMENT(33, "用户评价"),
SYSTEM_COMMENT(34, "到期未评价,系统自动评价"),
MEMBER_CANCEL(40, "取消订单"),

View File

@ -126,6 +126,12 @@ public class TradeOrderController {
return success(true);
}
// TODO 核销逻辑
@PutMapping("/pick-up")
@Operation(summary = "订单核销")
@PreAuthorize("@ss.hasPermission('trade:order:pick-up')")
public CommonResult<Boolean> pickUpOrder(@RequestParam("id") Long id) {
tradeOrderUpdateService.pickUpOrder(id);
return success(true);
}
}

View File

@ -40,6 +40,9 @@ public class TradeOrderPageReqVO extends PageParam {
@Schema(description = "自提门店编号", example = "[1,2]")
private List<Long> pickUpStoreIds;
@Schema(description = "自提核销码", example = "12345678")
private String pickUpVerifyCode;
@Schema(description = "订单类型", example = "1")
private Integer type;

View File

@ -41,6 +41,7 @@ public interface TradeOrderMapper extends BaseMapperX<TradeOrderDO> {
.eqIfPresent(TradeOrderDO::getTerminal, reqVO.getTerminal())
.eqIfPresent(TradeOrderDO::getLogisticsId, reqVO.getLogisticsId())
.inIfPresent(TradeOrderDO::getPickUpStoreId, reqVO.getPickUpStoreIds())
.likeIfPresent(TradeOrderDO::getPickUpVerifyCode, reqVO.getPickUpVerifyCode())
.betweenIfPresent(TradeOrderDO::getCreateTime, reqVO.getCreateTime())
.orderByDesc(TradeOrderDO::getId));
}
@ -105,4 +106,8 @@ public interface TradeOrderMapper extends BaseMapperX<TradeOrderDO> {
.between(TradeOrderDO::getCreateTime, beginTime, endTime));
}
default TradeOrderDO selectOneByPickUpVerifyCode(String pickUpVerifyCode) {
return selectOne(TradeOrderDO::getPickUpVerifyCode, pickUpVerifyCode);
}
}

View File

@ -115,6 +115,20 @@ public interface TradeOrderUpdateService {
*/
void updateOrderAddress(TradeOrderUpdateAddressReqVO reqVO);
/**
* 管理员核销订单
*
* @param id 订单编号
*/
void pickUpOrder(Long id);
/**
* 管理员核销订单
*
* @param pickUpVerifyCode 自提核销码
*/
void pickUpOrder(String pickUpVerifyCode);
// =================== Order Item ===================
/**

View File

@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.trade.service.order;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.lang.Assert;
import cn.hutool.core.map.MapUtil;
import cn.hutool.core.util.ObjUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.RandomUtil;
import cn.hutool.extra.spring.SpringUtil;
@ -763,6 +764,29 @@ public class TradeOrderUpdateServiceImpl implements TradeOrderUpdateService {
// TODO @puhui999操作日志
}
@Override
public void pickUpOrder(Long id) {
getSelf().pickUpOrder(tradeOrderMapper.selectById(id));
}
@Override
public void pickUpOrder(String pickUpVerifyCode) {
getSelf().pickUpOrder(tradeOrderMapper.selectOneByPickUpVerifyCode(pickUpVerifyCode));
}
@Transactional(rollbackFor = Exception.class)
@TradeOrderLog(operateType = TradeOrderOperateTypeEnum.PICK_UP_RECEIVE)
public void pickUpOrder(TradeOrderDO order) {
if (order == null) {
throw exception(ORDER_NOT_FOUND);
}
if (ObjUtil.notEqual(DeliveryTypeEnum.PICK_UP.getType(), order.getDeliveryType())) {
throw exception(ORDER_RECEIVE_FAIL_DELIVERY_TYPE_NOT_PICK_UP);
}
// todo 校验核销操作人
receiveOrder0(order);
}
// =================== Order Item ===================
@Override