不报错 内容的 调用
This commit is contained in:
@@ -9,7 +9,8 @@ import java.util.function.Consumer;
|
|||||||
public class FunUtils {
|
public class FunUtils {
|
||||||
/**
|
/**
|
||||||
* 执行方法并捕获异常
|
* 执行方法并捕获异常
|
||||||
* @param func 方法
|
*
|
||||||
|
* @param func 方法
|
||||||
* @param value 失败的值
|
* @param value 失败的值
|
||||||
*/
|
*/
|
||||||
public static <T> T safeRun(Func0<T> func, T value) {
|
public static <T> T safeRun(Func0<T> func, T value) {
|
||||||
@@ -29,4 +30,12 @@ public class FunUtils {
|
|||||||
log.warn(msg.length > 0 ? msg[0] : "方法执行失败: {}", e.getMessage());
|
log.warn(msg.length > 0 ? msg[0] : "方法执行失败: {}", e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void safeRunVoid(Runnable func, String errorMsg, Object... args) {
|
||||||
|
try {
|
||||||
|
func.run();
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error(errorMsg, args, e);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,6 +50,7 @@ import com.czg.service.order.mapper.OrderInfoCustomMapper;
|
|||||||
import com.czg.service.order.print.PrinterHandler;
|
import com.czg.service.order.print.PrinterHandler;
|
||||||
import com.czg.utils.AssertUtil;
|
import com.czg.utils.AssertUtil;
|
||||||
import com.czg.utils.CzgStrUtils;
|
import com.czg.utils.CzgStrUtils;
|
||||||
|
import com.czg.utils.FunUtils;
|
||||||
import com.czg.utils.PageUtil;
|
import com.czg.utils.PageUtil;
|
||||||
import com.mybatisflex.core.paginate.Page;
|
import com.mybatisflex.core.paginate.Page;
|
||||||
import com.mybatisflex.core.query.QueryWrapper;
|
import com.mybatisflex.core.query.QueryWrapper;
|
||||||
@@ -1293,13 +1294,15 @@ public class OrderInfoCustomServiceImpl implements OrderInfoCustomService {
|
|||||||
shopUserUseInfo(orderInfo, shopUser);
|
shopUserUseInfo(orderInfo, shopUser);
|
||||||
// 后续 赠送等功能 挂账支付不赠送
|
// 后续 赠送等功能 挂账支付不赠送
|
||||||
if (!orderInfo.getPayType().equals(PayEnums.CREDIT_PAY.getValue())) {
|
if (!orderInfo.getPayType().equals(PayEnums.CREDIT_PAY.getValue())) {
|
||||||
try {
|
FunUtils.safeRunVoid(() -> consumerCouponService.receiveConsumerCoupon(shopUser.getSourceShopId(), orderInfo.getId(),
|
||||||
//消费赠券
|
orderInfo.getPayAmount(), shopUser.getUserId(), shopUser.getId()), "订单{}消费赠券失败", orderInfo.getId());
|
||||||
consumerCouponService.receiveConsumerCoupon(shopUser.getSourceShopId(), orderInfo.getId(), orderInfo.getPayAmount(), shopUser.getUserId(), shopUser.getId());
|
FunUtils.safeRunVoid(() -> pointsConfigService.consumeAwardPoints(shopUser, orderInfo), "订单{}赠送积分失败", orderInfo.getId());
|
||||||
//下单赠送积分
|
|
||||||
pointsConfigService.consumeAwardPoints(shopUser, orderInfo);
|
FunUtils.safeRunVoid(() -> consumeCashbackService.cashback(orderInfo.getShopId(), shopUser.getUserId(),
|
||||||
//消费返现
|
orderInfo.getPayAmount(), orderInfo.getId(), orderInfo.getOrderNo()), "订单{}消费返现失败", orderInfo.getId());
|
||||||
consumeCashbackService.cashback(orderInfo.getShopId(), shopUser.getUserId(), orderInfo.getPayAmount(), orderInfo.getId(), orderInfo.getOrderNo());
|
|
||||||
|
|
||||||
|
FunUtils.safeRunVoid(() -> {
|
||||||
if (shopUser.getIsVip().equals(0)) {
|
if (shopUser.getIsVip().equals(0)) {
|
||||||
// 消费累计成为会员的情况
|
// 消费累计成为会员的情况
|
||||||
memberConfigService.joinMemberByCondition(orderInfo.getShopId(), orderInfo.getUserId(), shopUser);
|
memberConfigService.joinMemberByCondition(orderInfo.getShopId(), orderInfo.getUserId(), shopUser);
|
||||||
@@ -1307,9 +1310,7 @@ public class OrderInfoCustomServiceImpl implements OrderInfoCustomService {
|
|||||||
// 消费赠送成长值
|
// 消费赠送成长值
|
||||||
memberConfigService.deliver(shopUser, TableValueConstant.MemberExpFlow.Type.COST, orderInfo.getPayAmount(), null, orderInfo.getId());
|
memberConfigService.deliver(shopUser, TableValueConstant.MemberExpFlow.Type.COST, orderInfo.getPayAmount(), null, orderInfo.getId());
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
}, "订单{}用户累计/赠送成长值失败", orderInfo.getId());
|
||||||
log.error("订单{}消费赠券失败", orderInfo.getId(), e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user