退菜同步修改订单金额

This commit is contained in:
SongZhang 2024-10-12 10:20:02 +08:00
parent 608fb72c78
commit 7379b1d85d
2 changed files with 17 additions and 0 deletions

View File

@ -5,7 +5,9 @@ import cn.ysk.cashier.vo.TbOrderSaleVO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import java.math.BigDecimal;
import java.sql.Timestamp;
import java.util.List;
@ -32,4 +34,10 @@ public interface TbOrderInfoMapper extends BaseMapper<TbOrderInfo> {
" ) " +
"</script>")
List<TbOrderSaleVO> selectAllSaleInfo(@Param("startTime") Timestamp startTime, @Param("endTime") Timestamp endTime, @Param("productSkuIds") List<Integer> productSkuIds, @Param("shopId") Integer shopId);
@Update("update tb_order_info set settlement_amount=settlement_amount-#{priceAmount}, pack_fee=pack_fee-#{packAmount}," +
"order_amount=origin_amount-#{priceAmount}, amount=amount-#{priceAmount}," +
"order_amount=order_amount-#{priceAmount} where id=#{orderId} and origin_amount-#{priceAmount} >= 0")
int updateOrderAmount(Integer orderId, BigDecimal priceAmount, BigDecimal packAmount);
}

View File

@ -629,6 +629,9 @@ public class TbShopTableServiceImpl implements TbShopTableService {
}
// 餐位费直接删除
TbOrderDetail orderDetail = orderDetailMapper.selectOne(new LambdaQueryWrapper<TbOrderDetail>()
.eq(TbOrderDetail::getCartId, cashierCart.getId()));
if (cashierCart.getId() == -999) {
cashierCartMapper.deleteById(cashierCart.getId());
if (cashierCart.getOrderId() != null) {
@ -656,6 +659,12 @@ public class TbShopTableServiceImpl implements TbShopTableService {
}
if (cashierCart.getOrderId() != null) {
// 减少订单金额
orderInfoMapper.updateOrderAmount(cashierCart.getOrderId(), orderDetail.getPriceAmount(), orderDetail.getPackAmount());
}
}
@Override