Merge branch 'prod' into test
This commit is contained in:
@@ -4,8 +4,8 @@ import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.io.IoUtil;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.czg.CzgPayUtils;
|
||||
import com.czg.account.entity.ShopUser;
|
||||
import com.czg.account.service.ShopUserService;
|
||||
import com.czg.constants.PayTypeConstants;
|
||||
import com.czg.entity.CzgBaseRespParams;
|
||||
import com.czg.market.entity.MkShopConsumeDiscountRecord;
|
||||
import com.czg.market.service.MkDistributionUserService;
|
||||
@@ -13,7 +13,6 @@ import com.czg.market.service.MkShopConsumeDiscountRecordService;
|
||||
import com.czg.market.service.OrderInfoService;
|
||||
import com.czg.order.entity.OrderInfo;
|
||||
import com.czg.order.entity.OrderPayment;
|
||||
import com.czg.constants.PayTypeConstants;
|
||||
import com.czg.order.service.OrderInfoCustomService;
|
||||
import com.czg.order.service.OrderPaymentService;
|
||||
import com.czg.service.market.service.impl.AppWxServiceImpl;
|
||||
|
||||
@@ -86,7 +86,6 @@ public class CzgControllerAdvice {
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 处理自定义异常
|
||||
*/
|
||||
@@ -164,9 +163,20 @@ public class CzgControllerAdvice {
|
||||
@ExceptionHandler(value = Exception.class)
|
||||
@ResponseStatus(HttpStatus.OK)
|
||||
public CzgResult<Object> errorHandler(Exception ex) {
|
||||
// setErrorLog(ex);
|
||||
// 3. 处理未捕获的异常(系统异常,隐藏敏感信息)
|
||||
log.error("系统未处理异常", ex);
|
||||
Throwable rootCause = ex;
|
||||
while (rootCause.getCause() != null && !(rootCause instanceof CzgException)) {
|
||||
rootCause = rootCause.getCause();
|
||||
}
|
||||
|
||||
// 2. 如果根因是CzgException,直接抛出/返回该异常
|
||||
if (rootCause instanceof CzgException exception) {
|
||||
return CzgResult.failure(exception.getCode(), exception.getMsg());
|
||||
}else if (rootCause instanceof ValidateException exception) {
|
||||
return CzgResult.failure(exception.getStatus(), exception.getMessage());
|
||||
}
|
||||
|
||||
// 3. 非业务异常,按原有逻辑处理
|
||||
return CzgResult.failure(CzgRespCode.SYSTEM_ERROR.getCode(), "系统错误,请联系管理员");
|
||||
}
|
||||
|
||||
|
||||
@@ -106,13 +106,14 @@ public class MkShopConsumeDiscountRecordServiceImpl extends ServiceImpl<MkShopCo
|
||||
.eq(MkShopConsumeDiscountRecord::getIsUse, 1)
|
||||
.eq(MkShopConsumeDiscountRecord::getShopUserId, shopUser.getId()));
|
||||
boolean exists = orderInfoService.exists(new QueryWrapper().eq(OrderInfo::getUserId, shopUser.getUserId())
|
||||
.eq(OrderInfo::getShopId, shopUser.getSourceShopId()).eq(OrderInfo::getStatus, OrderStatusEnums.DONE.getCode()));
|
||||
.eq(OrderInfo::getShopId, shopId).eq(OrderInfo::getStatus, OrderStatusEnums.DONE.getCode()));
|
||||
return !exists && discountRecord == null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MkShopConsumeDiscountRecord getDiscount(Long shopId, Long userId, Long orderId) {
|
||||
ShopUser shopUser = shopUserService.getOne(new QueryWrapper().eq(ShopUser::getUserId, userId).eq(ShopUser::getSourceShopId, shopId));
|
||||
ShopUser shopUser = shopUserService.getUserInfo(shopId, userId);
|
||||
AssertUtil.isTrue(shopUser == null, "用户不存在");
|
||||
boolean newUser = isNewUser(shopUser, shopId);
|
||||
if (!newUser) {
|
||||
// throw new CzgException("新客立减仅新用户可用");
|
||||
|
||||
Reference in New Issue
Block a user