交易:订单核销

This commit is contained in:
owen 2023-10-17 16:09:37 +08:00
parent b89ae001ad
commit 5e65512a92
4 changed files with 37 additions and 12 deletions

View File

@ -56,7 +56,7 @@ public class TradeOrderController {
}
// 查询用户信息
Map<Long, MemberUserRespDTO> userMap = memberUserApi.getUserMap(convertSet(pageResult.getList(), TradeOrderDO::getUserId));;
Map<Long, MemberUserRespDTO> userMap = memberUserApi.getUserMap(convertSet(pageResult.getList(), TradeOrderDO::getUserId));
// 查询订单项
List<TradeOrderItemDO> orderItems = tradeOrderQueryService.getOrderItemListByOrderId(
convertSet(pageResult.getList(), TradeOrderDO::getId));
@ -126,18 +126,31 @@ public class TradeOrderController {
return success(true);
}
// TODO @疯狂1订单列表界面增加一个核销按钮点击后弹窗出一个核销码输入的窗口
//
//2输入核销码后点击确认基于 code 查询对应的订单之后弹窗展示
//
//3新的弹窗下面有个确认核销按钮确认后进行订单核销逻辑注意只有门店自提的订单才可以核销
// TODO 这里的 id 应该是 pickUpVerifyCode 参数哈
@PutMapping("/pick-up")
@PutMapping("/pick-up-by-id")
@Operation(summary = "订单核销")
@Parameter(name = "id", description = "交易订单编号")
@PreAuthorize("@ss.hasPermission('trade:order:pick-up')")
public CommonResult<Boolean> pickUpOrder(@RequestParam("id") Long id) {
public CommonResult<Boolean> pickUpOrderById(@RequestParam("id") Long id) {
tradeOrderUpdateService.pickUpOrderByMember(id);
return success(true);
}
@PutMapping("/pick-up-by-verify-code")
@Operation(summary = "订单核销")
@Parameter(name = "pickUpVerifyCode", description = "自提核销码")
@PreAuthorize("@ss.hasPermission('trade:order:pick-up')")
public CommonResult<Boolean> pickUpOrderByVerifyCode(@RequestParam("pickUpVerifyCode") String pickUpVerifyCode) {
tradeOrderUpdateService.pickUpOrderByAdmin(pickUpVerifyCode);
return success(true);
}
@GetMapping("/get-by-pick-up-verify-code")
@Operation(summary = "查询核销码对应的订单")
@Parameter(name = "pickUpVerifyCode", description = "自提核销码")
@PreAuthorize("@ss.hasPermission('trade:order:query')")
public CommonResult<TradeOrderDetailRespVO> getByPickUpVerifyCode(@RequestParam("pickUpVerifyCode") String pickUpVerifyCode) {
TradeOrderDO tradeOrder = tradeOrderUpdateService.getByPickUpVerifyCode(pickUpVerifyCode);
return success(TradeOrderConvert.INSTANCE.convert2(tradeOrder, null));
}
}

View File

@ -93,6 +93,9 @@ public class TradeOrderBaseVO {
@Schema(description = "自提门店", example = "10")
private Long pickUpStoreId;
@Schema(description = "自提核销码", example = "10")
private Long pickUpVerifyCode;
@Schema(description = "配送模板编号", example = "1024")
private Long deliveryTemplateId;
@ -102,9 +105,6 @@ public class TradeOrderBaseVO {
@Schema(description = "发货物流单号", example = "1024")
private String logisticsNo;
@Schema(description = "发货状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
private Integer deliveryStatus;
@Schema(description = "发货时间")
private LocalDateTime deliveryTime;

View File

@ -131,6 +131,13 @@ public interface TradeOrderUpdateService {
*/
void pickUpOrderByAdmin(String pickUpVerifyCode);
/**
* 管理员根据自提核销码查询订单
*
* @param pickUpVerifyCode 自提核销码
*/
TradeOrderDO getByPickUpVerifyCode(String pickUpVerifyCode);
// =================== Order Item ===================
/**

View File

@ -680,6 +680,11 @@ public class TradeOrderUpdateServiceImpl implements TradeOrderUpdateService {
getSelf().pickUpOrder(tradeOrderMapper.selectOneByPickUpVerifyCode(pickUpVerifyCode));
}
@Override
public TradeOrderDO getByPickUpVerifyCode(String pickUpVerifyCode) {
return tradeOrderMapper.selectOneByPickUpVerifyCode(pickUpVerifyCode);
}
@Transactional(rollbackFor = Exception.class)
public void pickUpOrder(TradeOrderDO order) {
if (order == null) {