feat: 订单详情返回是否打包赠送字段
This commit is contained in:
parent
e9956b5336
commit
e19535d71e
|
|
@ -16,6 +16,7 @@
|
|||
package cn.ysk.cashier.dto.order;
|
||||
|
||||
import cn.ysk.cashier.pojo.order.TbCashierCart;
|
||||
import cn.ysk.cashier.pojo.order.TbFullOrderDetail;
|
||||
import cn.ysk.cashier.pojo.order.TbOrderDetail;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
|
@ -159,7 +160,7 @@ public class TbOrderInfoDto implements Serializable {
|
|||
|
||||
private String remark;
|
||||
|
||||
private List<TbOrderDetail> detailList;
|
||||
private List<? extends TbOrderDetail> detailList;
|
||||
|
||||
private String payRemark;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,9 +1,13 @@
|
|||
package cn.ysk.cashier.mybatis.mapper;
|
||||
|
||||
import cn.ysk.cashier.pojo.order.TbFullOrderDetail;
|
||||
import cn.ysk.cashier.pojo.order.TbOrderDetail;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
import org.apache.ibatis.annotations.Update;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface TbOrderDetailMapper extends BaseMapper<TbOrderDetail> {
|
||||
|
||||
/**
|
||||
|
|
@ -16,4 +20,11 @@ public interface TbOrderDetailMapper extends BaseMapper<TbOrderDetail> {
|
|||
@Update("update tb_order_detail set status=#{status}, price_amount=(num+#{changeNum})*price,num=num+#{changeNum} " +
|
||||
"where id=#{id}")
|
||||
int updateNumAmountStatus(Integer id, String status, int changeNum);
|
||||
|
||||
/**
|
||||
* 查询包含打包费和是否赠送的订单详情信息
|
||||
* @param orderId 订单id
|
||||
*/
|
||||
@Select("select a.*, b.is_gift, b.is_pack from tb_order_detail as a left join tb_cashier_cart as b on a.cart_id=b.id where a.order_id=#{orderId}")
|
||||
List<TbFullOrderDetail> selectFullInfoByOrderId(Integer orderId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package cn.ysk.cashier.mybatis.service;
|
|||
|
||||
import cn.ysk.cashier.dto.shoptable.ReturnOrderDTO;
|
||||
import cn.ysk.cashier.enums.OrderStatusEnums;
|
||||
import cn.ysk.cashier.pojo.order.TbFullOrderDetail;
|
||||
import cn.ysk.cashier.pojo.order.TbOrderDetail;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
|
|
@ -33,5 +34,13 @@ public interface MpOrderDetailService extends IService<TbOrderDetail> {
|
|||
* @return 是否成功
|
||||
*/
|
||||
boolean updateUseTypeByCartIds(ArrayList<Integer> cartIds, String useType);
|
||||
|
||||
/**
|
||||
* 根据订单id查询订单详情
|
||||
* @param orderId 订单id
|
||||
* @return 详情信息
|
||||
*/
|
||||
List<TbOrderDetail> selectByOrderId(Integer orderId);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -5,11 +5,13 @@ import cn.ysk.cashier.enums.OrderStatusEnums;
|
|||
import cn.ysk.cashier.mybatis.mapper.TbOrderDetailMapper;
|
||||
import cn.ysk.cashier.mybatis.service.MpOrderDetailService;
|
||||
import cn.ysk.cashier.pojo.order.TbOrderDetail;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
|
@ -38,5 +40,11 @@ public class MpOrderDetailServiceImpl extends ServiceImpl<TbOrderDetailMapper, T
|
|||
.in(TbOrderDetail::getCartId, cartIds)
|
||||
.set(TbOrderDetail::getUseType, useType));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TbOrderDetail> selectByOrderId(Integer orderId) {
|
||||
return list(new LambdaQueryWrapper<TbOrderDetail>()
|
||||
.eq(TbOrderDetail::getOrderId, orderId));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -16,10 +16,13 @@ import cn.ysk.cashier.mapper.product.TbProductSkuMapper;
|
|||
import cn.ysk.cashier.mybatis.entity.*;
|
||||
import cn.ysk.cashier.mybatis.mapper.TbCashierCartMapper;
|
||||
import cn.ysk.cashier.mybatis.mapper.TbMShopUserMapper;
|
||||
import cn.ysk.cashier.mybatis.mapper.TbOrderDetailMapper;
|
||||
import cn.ysk.cashier.mybatis.mapper.TbShopUserFlowMapper;
|
||||
import cn.ysk.cashier.mybatis.service.MpOrderDetailService;
|
||||
import cn.ysk.cashier.mybatis.service.TbActivateInRecordService;
|
||||
import cn.ysk.cashier.mybatis.service.TbActivateOutRecordService;
|
||||
import cn.ysk.cashier.mybatis.service.TbOrderPaymentService;
|
||||
import cn.ysk.cashier.mybatis.service.impl.MpOrderDetailServiceImpl;
|
||||
import cn.ysk.cashier.pojo.TbShopPayType;
|
||||
import cn.ysk.cashier.pojo.order.TbCashierCart;
|
||||
import cn.ysk.cashier.pojo.order.TbFullOrderDetail;
|
||||
|
|
@ -105,6 +108,8 @@ public class TbOrderInfoServiceImpl implements TbOrderInfoService {
|
|||
private final TbCashierCartMapper tbCashierCartMapper;
|
||||
|
||||
private final PayService payService;
|
||||
private final MpOrderDetailService mpOrderDetailService;
|
||||
private final TbOrderDetailMapper tbOrderDetailMapper;
|
||||
|
||||
@Value("${thirdPay.url}")
|
||||
private String url;
|
||||
|
|
@ -291,7 +296,7 @@ public class TbOrderInfoServiceImpl implements TbOrderInfoService {
|
|||
dto.setPayType("退单");
|
||||
}
|
||||
}
|
||||
List<TbOrderDetail> details = tbOrderDetailRepository.searchDetailByOrderId(tbOrderInfo.getId());
|
||||
List<TbFullOrderDetail> details = tbOrderDetailMapper.selectFullInfoByOrderId(tbOrderInfo.getId());
|
||||
dto.setIsRefund(0);
|
||||
dto.setRefundAmount(BigDecimal.ZERO);
|
||||
dto.setRefundRemark(tbOrderInfo.getRefundRemark());
|
||||
|
|
|
|||
|
|
@ -778,7 +778,7 @@ public class TbShopTableServiceImpl implements TbShopTableService {
|
|||
@Override
|
||||
public Map<String, Object> getCart(String tableId, Integer page,
|
||||
Integer size, Integer shopId, String masterId, String useType) {
|
||||
ShopEatTypeInfoDTO shopEatTypeInfoDTO = checkEatModel(shopId, OrderUseTypeEnum.TAKEOUT.getValue().equals(useType) ? null : tableId);
|
||||
ShopEatTypeInfoDTO shopEatTypeInfoDTO = checkEatModel(shopId, OrderUseTypeEnum.TAKEOUT.getValue().equals(useType) ? null : tableId, useType);
|
||||
LambdaQueryWrapper<TbCashierCart> queryWrapper = new LambdaQueryWrapper<TbCashierCart>()
|
||||
.in(TbCashierCart::getStatus, "create", "return")
|
||||
.eq(TbCashierCart::getShopId, shopId)
|
||||
|
|
@ -787,7 +787,11 @@ public class TbShopTableServiceImpl implements TbShopTableService {
|
|||
.and(q -> q.eq(TbCashierCart::getMasterId, masterId).or().isNull(TbCashierCart::getMasterId));
|
||||
|
||||
if (!shopEatTypeInfoDTO.isTakeout()) {
|
||||
if (StrUtil.isBlank(tableId)) {
|
||||
queryWrapper.isNull(TbCashierCart::getTableId);
|
||||
}else {
|
||||
queryWrapper.eq(TbCashierCart::getTableId, tableId);
|
||||
}
|
||||
} else {
|
||||
queryWrapper.and(q -> q.isNull(TbCashierCart::getTableId).or().eq(TbCashierCart::getTableId, ""))
|
||||
.in(TbCashierCart::getPlatformType, OrderPlatformTypeEnum.PC.getValue(), OrderPlatformTypeEnum.CASH.getValue());
|
||||
|
|
|
|||
Loading…
Reference in New Issue