Merge branch 'dev' into prod
This commit is contained in:
@@ -78,7 +78,9 @@ public class ShopTableController {
|
|||||||
queryWrapper.eq(ShopTable::getTableCode, tableCode);
|
queryWrapper.eq(ShopTable::getTableCode, tableCode);
|
||||||
}
|
}
|
||||||
ShopTable one = shopTableService.getOne(queryWrapper);
|
ShopTable one = shopTableService.getOne(queryWrapper);
|
||||||
one.setStatusMsg(ShopTableStatusEnum.getMsgByValue(one.getStatus()));
|
if (one != null) {
|
||||||
|
one.setStatusMsg(ShopTableStatusEnum.getMsgByValue(one.getStatus()));
|
||||||
|
}
|
||||||
return CzgResult.success(one);
|
return CzgResult.success(one);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import org.springframework.http.converter.HttpMessageNotReadableException;
|
|||||||
import org.springframework.validation.ObjectError;
|
import org.springframework.validation.ObjectError;
|
||||||
import org.springframework.web.HttpRequestMethodNotSupportedException;
|
import org.springframework.web.HttpRequestMethodNotSupportedException;
|
||||||
import org.springframework.web.bind.MethodArgumentNotValidException;
|
import org.springframework.web.bind.MethodArgumentNotValidException;
|
||||||
|
import org.springframework.web.bind.MissingServletRequestParameterException;
|
||||||
import org.springframework.web.bind.annotation.ExceptionHandler;
|
import org.springframework.web.bind.annotation.ExceptionHandler;
|
||||||
import org.springframework.web.bind.annotation.ResponseBody;
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
import org.springframework.web.bind.annotation.ResponseStatus;
|
import org.springframework.web.bind.annotation.ResponseStatus;
|
||||||
@@ -63,14 +64,14 @@ public class CzgControllerAdvice {
|
|||||||
@ResponseBody
|
@ResponseBody
|
||||||
@ExceptionHandler(value = NotPermissionException.class)
|
@ExceptionHandler(value = NotPermissionException.class)
|
||||||
@ResponseStatus(HttpStatus.OK)
|
@ResponseStatus(HttpStatus.OK)
|
||||||
public CzgResult<Object> notPermissionErrorHandler(NotPermissionException ex) {
|
public CzgResult<Object> notPermissionErrorHandler() {
|
||||||
return CzgResult.failure(CzgRespCode.UN_PERMISSION);
|
return CzgResult.failure(CzgRespCode.UN_PERMISSION);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
@ExceptionHandler(value = NotRoleException.class)
|
@ExceptionHandler(value = NotRoleException.class)
|
||||||
@ResponseStatus(HttpStatus.OK)
|
@ResponseStatus(HttpStatus.OK)
|
||||||
public CzgResult<Object> notRoleErrorHandler(NotRoleException ex) {
|
public CzgResult<Object> notRoleErrorHandler() {
|
||||||
return CzgResult.failure(CzgRespCode.UN_ROLE);
|
return CzgResult.failure(CzgRespCode.UN_ROLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -118,6 +119,12 @@ public class CzgControllerAdvice {
|
|||||||
return CzgResult.failure(701, "订单已过期,请重新下单");
|
return CzgResult.failure(701, "订单已过期,请重新下单");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ExceptionHandler(MissingServletRequestParameterException.class)
|
||||||
|
public CzgResult<Object> handleMissingServletRequestParameterException(MissingServletRequestParameterException ex) {
|
||||||
|
log.error("传参错误", ex);
|
||||||
|
return CzgResult.failure(CzgRespCode.SYSTEM_ERROR.getCode(), "系统繁忙,请稍后再试");
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 处理Hutool的断言抛出异常
|
* 处理Hutool的断言抛出异常
|
||||||
*/
|
*/
|
||||||
@@ -156,7 +163,7 @@ public class CzgControllerAdvice {
|
|||||||
public CzgResult<Object> errorHandler(Exception ex) {
|
public CzgResult<Object> errorHandler(Exception ex) {
|
||||||
// setErrorLog(ex);
|
// setErrorLog(ex);
|
||||||
// 3. 处理未捕获的异常(系统异常,隐藏敏感信息)
|
// 3. 处理未捕获的异常(系统异常,隐藏敏感信息)
|
||||||
log.error("系统未处理异常", ex); // 替换原有 setErrorLog,使用日志框架
|
log.error("系统未处理异常", ex);
|
||||||
return CzgResult.failure(CzgRespCode.SYSTEM_ERROR.getCode(), "系统繁忙,请稍后再试");
|
return CzgResult.failure(CzgRespCode.SYSTEM_ERROR.getCode(), "系统繁忙,请稍后再试");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -15,6 +15,8 @@ import java.util.List;
|
|||||||
@Data
|
@Data
|
||||||
public class ProductVO extends Product {
|
public class ProductVO extends Product {
|
||||||
private BigDecimal lowPrice;
|
private BigDecimal lowPrice;
|
||||||
|
private String unitName;
|
||||||
|
private BigDecimal lowMemberPrice;
|
||||||
private List<ProdSku> skuList;
|
private List<ProdSku> skuList;
|
||||||
private Integer isSaleTime;
|
private Integer isSaleTime;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.czg.service.account.service.impl;
|
package com.czg.service.account.service.impl;
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import cn.hutool.core.util.NumberUtil;
|
||||||
import cn.hutool.core.util.ObjUtil;
|
import cn.hutool.core.util.ObjUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.czg.account.dto.pad.*;
|
import com.czg.account.dto.pad.*;
|
||||||
@@ -27,6 +28,7 @@ import jakarta.annotation.Resource;
|
|||||||
import org.apache.dubbo.config.annotation.DubboReference;
|
import org.apache.dubbo.config.annotation.DubboReference;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.time.DayOfWeek;
|
import java.time.DayOfWeek;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.time.LocalTime;
|
import java.time.LocalTime;
|
||||||
@@ -34,6 +36,7 @@ import java.time.format.TextStyle;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Administrator
|
* @author Administrator
|
||||||
@@ -115,7 +118,8 @@ public class PadProdServiceImpl implements PadProdService {
|
|||||||
List<ProdSku> skuList = prodSkuService.list(new QueryWrapper().eq(ProdSku::getProductId, item.getId()));
|
List<ProdSku> skuList = prodSkuService.list(new QueryWrapper().eq(ProdSku::getProductId, item.getId()));
|
||||||
item.setSkuList(skuList);
|
item.setSkuList(skuList);
|
||||||
item.setIsSaleTime(calcIsSaleTime(item.getDays(), item.getStartTime(), item.getEndTime()));
|
item.setIsSaleTime(calcIsSaleTime(item.getDays(), item.getStartTime(), item.getEndTime()));
|
||||||
|
// Optional<BigDecimal> lowMemberPriceIsPresent = skuList.stream().map(obj -> NumberUtil.nullToZero(obj.getMemberPrice())).min(BigDecimal::compareTo);
|
||||||
|
// lowMemberPriceIsPresent.ifPresent(item::setLowMemberPrice);
|
||||||
});
|
});
|
||||||
padDetailDTO.setProductList(products);
|
padDetailDTO.setProductList(products);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -264,7 +264,7 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional
|
@Transactional
|
||||||
public OrderInfo createOrder(OrderInfoAddDTO param) throws ValidateException{
|
public OrderInfo createOrder(OrderInfoAddDTO param) throws ValidateException {
|
||||||
ShopInfo shopInfo = shopInfoService.getById(param.getShopId());
|
ShopInfo shopInfo = shopInfoService.getById(param.getShopId());
|
||||||
AssertUtil.isNull(shopInfo, "生成订单失败,店铺信息不存在");
|
AssertUtil.isNull(shopInfo, "生成订单失败,店铺信息不存在");
|
||||||
if (!shopInfo.getEatModel().contains(param.getDineMode())) {
|
if (!shopInfo.getEatModel().contains(param.getDineMode())) {
|
||||||
@@ -524,16 +524,21 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
|
|||||||
支付计算金额不正确,
|
支付计算金额不正确,
|
||||||
订单Id:{},支付计算金额为:{},商品总金额:{},临时菜价格:{},打包费:{},餐位费:{},
|
订单Id:{},支付计算金额为:{},商品总金额:{},临时菜价格:{},打包费:{},餐位费:{},
|
||||||
传递支付金额为:{},商品券:{},其它券:{},新客立减:{},满减活动:{},
|
传递支付金额为:{},商品券:{},其它券:{},新客立减:{},满减活动:{},
|
||||||
商家最终改价:{},积分抵扣金额:{},抹零金额:{}
|
超级会员折扣金额:{},商家最终改价:{},积分抵扣金额:{},抹零金额:{}
|
||||||
""",
|
""",
|
||||||
orderInfo.getId(), newTotalAmount, totalAmount.getPrice(), tempAmount.getPrice(), packAmount.getPrice(), orderInfo.getSeatAmount(),
|
orderInfo.getId(), newTotalAmount, totalAmount.getPrice(), tempAmount.getPrice(), packAmount.getPrice(), orderInfo.getSeatAmount(),
|
||||||
param.getOrderAmount(), param.getProductCouponDiscountAmount(), param.getOtherCouponDiscountAmount(), param.getNewCustomerDiscountAmount(),
|
param.getOrderAmount(), param.getProductCouponDiscountAmount(), param.getOtherCouponDiscountAmount(), param.getNewCustomerDiscountAmount(),
|
||||||
discountActAmount, param.getDiscountAmount(), param.getPointsDiscountAmount(), param.getRoundAmount());
|
discountActAmount, param.getVipDiscountAmount(), param.getDiscountAmount(), param.getPointsDiscountAmount(), param.getRoundAmount());
|
||||||
throw new OrderValidateException("生成支付订单失败,支付金额不正确");
|
throw new OrderValidateException("生成支付订单失败,支付金额不正确");
|
||||||
}
|
}
|
||||||
orderInfo.setPackFee(packAmount.getPrice());
|
orderInfo.setPackFee(packAmount.getPrice());
|
||||||
//生成订单 //discount_info 所有折扣 几折 折扣金额 满减金额 优惠券金额 积分抵扣金额 抹零
|
//生成订单 //discount_info 所有折扣 几折 折扣金额 满减金额 优惠券金额 积分抵扣金额 抹零
|
||||||
upOrderPayInfo(orderInfo, param);
|
upOrderPayInfo(orderInfo, param);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
orderDetailService.updateBatch(orderDetails);
|
orderDetailService.updateBatch(orderDetails);
|
||||||
return orderInfo;
|
return orderInfo;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -246,9 +246,10 @@
|
|||||||
where id = #{shopId}
|
where id = #{shopId}
|
||||||
</select>
|
</select>
|
||||||
<select id="productList" resultType="com.czg.product.vo.ProductVO">
|
<select id="productList" resultType="com.czg.product.vo.ProductVO">
|
||||||
select a.*, min(b.sale_price) as lowPrice
|
select a.*, min(b.sale_price) as lowPrice, min(b.member_price) as lowMemberPrice, unit.name as unitName
|
||||||
from tb_product as a
|
from tb_product as a
|
||||||
left join tb_prod_sku as b on a.id = b.product_id
|
left join tb_prod_sku as b on a.id = b.product_id
|
||||||
|
left join tb_shop_prod_unit unit on a.unit_id=unit.id
|
||||||
where a.shop_id = #{shopId}
|
where a.shop_id = #{shopId}
|
||||||
<if test="productIds != null">
|
<if test="productIds != null">
|
||||||
and a.id in
|
and a.id in
|
||||||
|
|||||||
Reference in New Issue
Block a user