This commit is contained in:
parent
7307ff2db8
commit
8c0415f250
|
|
@ -3,10 +3,7 @@ package com.czg.controller.admin;
|
||||||
import com.czg.annotation.Debounce;
|
import com.czg.annotation.Debounce;
|
||||||
import com.czg.annotation.SaStaffCheckPermission;
|
import com.czg.annotation.SaStaffCheckPermission;
|
||||||
import com.czg.config.RabbitPublisher;
|
import com.czg.config.RabbitPublisher;
|
||||||
import com.czg.order.dto.OrderInfoAddDTO;
|
import com.czg.order.dto.*;
|
||||||
import com.czg.order.dto.OrderInfoPrintDTO;
|
|
||||||
import com.czg.order.dto.OrderInfoQueryDTO;
|
|
||||||
import com.czg.order.dto.OrderInfoRefundDTO;
|
|
||||||
import com.czg.order.entity.OrderInfo;
|
import com.czg.order.entity.OrderInfo;
|
||||||
import com.czg.order.service.OrderInfoService;
|
import com.czg.order.service.OrderInfoService;
|
||||||
import com.czg.order.vo.HistoryOrderPrintVo;
|
import com.czg.order.vo.HistoryOrderPrintVo;
|
||||||
|
|
@ -76,15 +73,13 @@ public class AdminOrderController {
|
||||||
return CzgResult.success(orderInfoService.createOrder(addDto));
|
return CzgResult.success(orderInfoService.createOrder(addDto));
|
||||||
}
|
}
|
||||||
|
|
||||||
// /**
|
/**
|
||||||
// * 合单
|
* 转桌
|
||||||
// * @param refundDTO
|
*/
|
||||||
// * @return
|
@PostMapping("/mergeOrder")
|
||||||
// */
|
public CzgResult<Object> mergeOrder(@Validated @RequestBody MergeOrderDTO param) {
|
||||||
// @PostMapping("/mergeOrder")
|
return orderInfoService.mergeOrder(param);
|
||||||
// public CzgResult<Object> mergeOrder(@Validated @RequestBody OrderInfoRefundDTO refundDTO) {
|
}
|
||||||
//
|
|
||||||
// }
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 订单全额退款 只传订单id
|
* 订单全额退款 只传订单id
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,32 @@
|
||||||
|
package com.czg.order.dto;
|
||||||
|
|
||||||
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author ww
|
||||||
|
* @description
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class MergeOrderDTO implements Serializable {
|
||||||
|
@NotNull(message = "订单Id不能为空")
|
||||||
|
private Long sourceOrderId;
|
||||||
|
/**
|
||||||
|
* 目标订单Id
|
||||||
|
*/
|
||||||
|
private Long targetOrderId;
|
||||||
|
/**
|
||||||
|
* 目标台桌
|
||||||
|
*/
|
||||||
|
private String targetTableCode;
|
||||||
|
/**
|
||||||
|
* 转台详情Id
|
||||||
|
*/
|
||||||
|
private List<Long> detailIds;
|
||||||
|
}
|
||||||
|
|
@ -19,7 +19,6 @@ import java.util.List;
|
||||||
* @since 2025-02-13
|
* @since 2025-02-13
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
|
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public class OrderInfoRefundDTO implements Serializable {
|
public class OrderInfoRefundDTO implements Serializable {
|
||||||
|
|
|
||||||
|
|
@ -39,6 +39,8 @@ public interface OrderInfoService extends IService<OrderInfo> {
|
||||||
|
|
||||||
OrderInfo checkOrderPay(CheckOrderPay param);
|
OrderInfo checkOrderPay(CheckOrderPay param);
|
||||||
|
|
||||||
|
CzgResult<Object> mergeOrder(MergeOrderDTO param);
|
||||||
|
|
||||||
void payCallBackOrder(@NotBlank String orderNo, @NotNull JSONObject resultJson);
|
void payCallBackOrder(@NotBlank String orderNo, @NotNull JSONObject resultJson);
|
||||||
|
|
||||||
void refundCallBackOrder(@NotBlank String orderNo, @NotNull JSONObject resultJson);
|
void refundCallBackOrder(@NotBlank String orderNo, @NotNull JSONObject resultJson);
|
||||||
|
|
|
||||||
|
|
@ -360,6 +360,54 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
|
||||||
return orderInfo;
|
return orderInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CzgResult<Object> mergeOrder(MergeOrderDTO param) {
|
||||||
|
if (param.getTargetOrderId() == null && StrUtil.isBlank(param.getTargetTableCode())) {
|
||||||
|
throw new ValidateException("转台失败,请选择目标台桌后转台");
|
||||||
|
}
|
||||||
|
OrderInfo sourceOrder = getById(param.getSourceOrderId());
|
||||||
|
if (sourceOrder == null || !sourceOrder.getStatus().equals(OrderStatusEnums.UNPAID.getCode())) {
|
||||||
|
throw new ValidateException("转台失败,无可转订单");
|
||||||
|
}
|
||||||
|
OrderInfo targetOrder = queryChain()
|
||||||
|
.eq(OrderInfo::getId, param.getTargetOrderId())
|
||||||
|
.eq(OrderInfo::getTableCode, param.getTargetTableCode())
|
||||||
|
.eq(OrderInfo::getStatus, OrderStatusEnums.UNPAID.getCode())
|
||||||
|
.one();
|
||||||
|
if (targetOrder == null) {
|
||||||
|
OrderInfoAddDTO addDTO = new OrderInfoAddDTO();
|
||||||
|
addDTO.setShopId(sourceOrder.getShopId());
|
||||||
|
addDTO.setStaffId(sourceOrder.getStaffId());
|
||||||
|
addDTO.setTableCode(param.getTargetTableCode());
|
||||||
|
addDTO.setOrderType(sourceOrder.getOrderType());
|
||||||
|
addDTO.setPlatformType(sourceOrder.getPlatformType());
|
||||||
|
addDTO.setPayMode(sourceOrder.getPayMode());
|
||||||
|
addDTO.setDineMode("dine-in");
|
||||||
|
addDTO.setPlaceNum(1);
|
||||||
|
addDTO.setWaitCall(false);
|
||||||
|
addDTO.setVipPrice(false);
|
||||||
|
ShopInfo shopInfo = shopInfoService.getById(sourceOrder.getShopId());
|
||||||
|
targetOrder = initOrderInfo(addDTO, shopInfo, null);
|
||||||
|
}
|
||||||
|
if (CollUtil.isEmpty(param.getDetailIds())) {
|
||||||
|
long count = orderDetailService.queryChain().eq(OrderDetail::getOrderId, sourceOrder.getId()).count();
|
||||||
|
if (count < 1) {
|
||||||
|
throw new ValidateException("转台失败,该订单无可转商品");
|
||||||
|
}
|
||||||
|
orderDetailService.updateChain()
|
||||||
|
.eq(OrderDetail::getOrderId, sourceOrder.getId())
|
||||||
|
.set(OrderDetail::getOrderId, targetOrder.getId())
|
||||||
|
.update();
|
||||||
|
} else {
|
||||||
|
orderDetailService.updateChain()
|
||||||
|
.eq(OrderDetail::getOrderId, sourceOrder.getId())
|
||||||
|
.in(OrderDetail::getId, param.getDetailIds())
|
||||||
|
.set(OrderDetail::getOrderId, targetOrder.getId())
|
||||||
|
.update();
|
||||||
|
}
|
||||||
|
return CzgResult.success();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 填充 单价/付款金额
|
* 填充 单价/付款金额
|
||||||
*
|
*
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue