|
|
@@ -13,6 +13,7 @@ import org.dromara.backstage.api.*;
|
|
|
import org.dromara.backstage.api.domain.vo.*;
|
|
|
import org.dromara.common.core.config.DefaultConfig;
|
|
|
import org.dromara.common.core.constant.ApiErrorTypeConstants;
|
|
|
+import org.dromara.common.core.constant.Constants;
|
|
|
import org.dromara.common.core.domain.R;
|
|
|
import org.dromara.common.core.domain.model.ErrorInfo;
|
|
|
import org.dromara.common.core.enums.BagNameEnum;
|
|
|
@@ -81,7 +82,6 @@ public class CheckBusiness {
|
|
|
private final IXfCardLimitedService cardLimitedService;
|
|
|
private final DefaultConfig defaultConfig;
|
|
|
private final BaseBusiness baseBusiness;
|
|
|
- // private final SyncRemoteXfTermService syncRemoteXfTermService;
|
|
|
|
|
|
/**
|
|
|
* 计算折扣金额
|
|
|
@@ -222,7 +222,6 @@ public class CheckBusiness {
|
|
|
return R.fail(errorInfo);
|
|
|
}
|
|
|
bo.setTermNo(remoteXfTermVo.getTermNo());
|
|
|
- BeanUtil.copyProperties(remoteXfTermVo, useTermVo);
|
|
|
RemoteVoConvert.INSTANCE.copyRemoteTermVo(useTermVo, remoteXfTermVo);
|
|
|
return R.ok();
|
|
|
}
|
|
|
@@ -239,8 +238,6 @@ public class CheckBusiness {
|
|
|
public R<ErrorInfo> checkConsume(ConsumptionBo bo, RemoteUserAccountVo userAccountVo, RemoteCardVo userCardVo, XfTermVo useTermVo) {
|
|
|
ErrorInfo errorInfo;
|
|
|
R<ErrorInfo> result;
|
|
|
- // 如果折扣验证,消费金额会更新成折扣金额,所以先保存
|
|
|
- BigDecimal consumeMoney = bo.getConsumeMoney();
|
|
|
// 1.消费账户状态验证,验证账户是否已开户、是否冻结、状态是否正常、是否过有效期
|
|
|
if ("Y".equals(userAccountVo.getFreezeStatus())) {
|
|
|
errorInfo = new ErrorInfo(400, ApiErrorTypeConstants.NOT_FOUND, "账户已被冻结",
|
|
|
@@ -262,31 +259,49 @@ public class CheckBusiness {
|
|
|
MessageFormat.format("流水号为[{0}]的账户已过有效期,不允许交易", userAccountVo.getUserNo()));
|
|
|
return R.fail(errorInfo);
|
|
|
}
|
|
|
+
|
|
|
// 2.餐类验证
|
|
|
+ long startTime=System.currentTimeMillis();
|
|
|
RemoteMealTypeVo mealType = remoteMealTypeService.queryMealTypeVoByTime(bo.getConsumeDate());
|
|
|
if (ObjectUtil.isEmpty(mealType)) {
|
|
|
return R.fail(new ErrorInfo(400, ApiErrorTypeConstants.NOT_FOUND, "不在交易时段", "不在交易时段"));
|
|
|
}
|
|
|
+
|
|
|
// 3.设备限制验证,只有消费机上传时会会进行验证,在手工补扣、错扣补款时不进行验证
|
|
|
+ startTime=System.currentTimeMillis();
|
|
|
if (bo.getStatusFlag() == 1 || bo.getStatusFlag() == 4) {
|
|
|
result = checkTermLimitDeal(bo, useTermVo, userCardVo, mealType);
|
|
|
if (R.isError(result)) {
|
|
|
return R.fail(new ErrorInfo(400, ApiErrorTypeConstants.NOT_FOUND, "消费限制判断存在问题", JSONUtil.toJsonStr(result.getData())));
|
|
|
}
|
|
|
}
|
|
|
+ log.info("折扣验证耗时:{}毫秒", System.currentTimeMillis()-startTime);
|
|
|
// 4.根据消费机的消费模式验证余额,如果余额不足则返回
|
|
|
+ startTime=System.currentTimeMillis();
|
|
|
result = checkOrigDeductionBag(bo, userAccountVo, useTermVo);
|
|
|
if (R.isError(result)) {
|
|
|
return result;
|
|
|
}
|
|
|
-
|
|
|
+ log.info("卡余验证耗时:{}毫秒", System.currentTimeMillis()-startTime);
|
|
|
return R.ok();
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 检查消费交易的账单,通过验证各种组件如卡片详情、原始记录、餐类信息、扣款钱包以及操作员详情。此外,它还会更新与用户卡片相关的其他消费信息
|
|
|
+ *
|
|
|
+ * @param bo 包含交易详情的消费业务对象
|
|
|
+ * @param userAccountVo 与交易关联的用户账户信息
|
|
|
+ * @param userCardVo 与用户关联的卡片信息。
|
|
|
+ * @param useTermVo 处理交易的终端信息
|
|
|
+ * @param bagVoList 扣款钱包信息的列表
|
|
|
+ * @param mealTypeVo 交易餐类信息
|
|
|
+ * @param operatorVo 为交易操作员信息
|
|
|
+ * @return 返回一个结果对象,包含成功或错误信息。如果发生验证失败,错误信息将包括有关验证失败的详细信息
|
|
|
+ */
|
|
|
public R<ErrorInfo> checkBill(ConsumptionBo bo, RemoteUserAccountVo userAccountVo, RemoteCardVo userCardVo,
|
|
|
XfTermVo useTermVo, List<PtBagVo> bagVoList, RemoteMealTypeVo mealTypeVo,
|
|
|
RemoteOperatorVo operatorVo) {
|
|
|
- R<ErrorInfo> result = checkCardNo(bo, userAccountVo, userCardVo);
|
|
|
+ R<ErrorInfo> result = checkUser(bo, userAccountVo, userCardVo);
|
|
|
if (R.isError(result)) {
|
|
|
return result;
|
|
|
}
|
|
|
@@ -324,6 +339,7 @@ public class CheckBusiness {
|
|
|
* @param accountVo 消费账户
|
|
|
*/
|
|
|
private void setUserInfo(ConsumptionBo bo, RemoteUserAccountVo accountVo) {
|
|
|
+ bo.setUserId(accountVo.getUserId());
|
|
|
bo.setRealName(StrUtil.isEmpty(accountVo.getRealName()) ? "----" : accountVo.getRealName());
|
|
|
bo.setUserNo(accountVo.getUserNo());
|
|
|
bo.setUserNumb(accountVo.getUserNumb());
|
|
|
@@ -342,46 +358,58 @@ public class CheckBusiness {
|
|
|
*/
|
|
|
@NotNull
|
|
|
private R<ErrorInfo> checkCardNo(ConsumptionBo bo, RemoteUserAccountVo userAccountVo, RemoteCardVo userCardVo) {
|
|
|
- RemoteUserAccountVo accountVo;
|
|
|
- RemoteCardVo cardVo;
|
|
|
+ ErrorInfo errorInfo;
|
|
|
Long cardNo = bo.getCardNo();
|
|
|
- if (cardNo > 0L) {
|
|
|
- ErrorInfo errorInfo;
|
|
|
- cardVo = remoteCardService.queryCardByCardNo(cardNo);
|
|
|
- if (ObjectUtil.isEmpty(cardVo)) {
|
|
|
- errorInfo = new ErrorInfo(400, ApiErrorTypeConstants.PARAM_ERROR, "卡片不存在",
|
|
|
- MessageFormat.format("流水号为[{0}]的卡片不存在,不允许交易", cardNo));
|
|
|
|
|
|
- return R.fail(errorInfo);
|
|
|
- }
|
|
|
- if (!String.valueOf(CardStatusEnum.NORMAL.code()).equals(cardVo.getStatus())) {
|
|
|
- errorInfo = new ErrorInfo(400, ApiErrorTypeConstants.PARAM_ERROR, "卡片状态不正确",
|
|
|
- MessageFormat.format("流水号为[{0}]的卡片状态不正确,不允许交易", cardNo));
|
|
|
+ RemoteCardVo cardVo = remoteCardService.queryCardByCardNo(cardNo);
|
|
|
+ if (ObjectUtil.isEmpty(cardVo)) {
|
|
|
+ errorInfo = new ErrorInfo(400, ApiErrorTypeConstants.PARAM_ERROR, "卡片不存在",
|
|
|
+ MessageFormat.format("流水号为[{0}]的卡片不存在,不允许交易", cardNo));
|
|
|
+
|
|
|
+ return R.fail(errorInfo);
|
|
|
+ }
|
|
|
+ if (!String.valueOf(CardStatusEnum.NORMAL.code()).equals(cardVo.getStatus())) {
|
|
|
+ errorInfo = new ErrorInfo(400, ApiErrorTypeConstants.PARAM_ERROR, "卡片状态不正确",
|
|
|
+ MessageFormat.format("流水号为[{0}]的卡片状态不正确,不允许交易", cardNo));
|
|
|
+
|
|
|
+ return R.fail(errorInfo);
|
|
|
+ }
|
|
|
+ if (bo.getFactoryId() > 0) {
|
|
|
+ if (!Objects.equals(cardVo.getFactoryId(), bo.getFactoryId())) {
|
|
|
+ errorInfo = new ErrorInfo(400, ApiErrorTypeConstants.PARAM_ERROR, "卡片不正确", "物理卡号不一致,不允许交易");
|
|
|
|
|
|
return R.fail(errorInfo);
|
|
|
}
|
|
|
- if (bo.getFactoryId() > 0) {
|
|
|
- if (!Objects.equals(cardVo.getFactoryId(), bo.getFactoryId())) {
|
|
|
- errorInfo = new ErrorInfo(400, ApiErrorTypeConstants.PARAM_ERROR, "卡片不正确", "物理卡号不一致,不允许交易");
|
|
|
+ }
|
|
|
+ RemoteUserAccountVo accountVo = remoteUserAccountService.getUserAccountVoById(cardVo.getUserId());
|
|
|
+ if (Objects.isNull(accountVo)) {
|
|
|
+ errorInfo = new ErrorInfo(400, ApiErrorTypeConstants.PARAM_ERROR, "人员不存在",
|
|
|
+ MessageFormat.format("流水号为[{0}]的卡片无对应的人员信息,不允许交易", cardNo));
|
|
|
|
|
|
- return R.fail(errorInfo);
|
|
|
- }
|
|
|
- }
|
|
|
- accountVo = remoteUserAccountService.getUserAccountVoById(cardVo.getUserId());
|
|
|
- } else {
|
|
|
- accountVo = remoteUserAccountService.getUserAccountVoByUserNo(bo.getUserNo());
|
|
|
- cardVo = remoteCardService.queryMainCardByUserId(accountVo.getUserId());
|
|
|
+ return R.fail(errorInfo);
|
|
|
+ }
|
|
|
+ if (Objects.equals(accountVo.getFreezeStatus(), Constants.SYS_YES)) {
|
|
|
+ errorInfo = new ErrorInfo(400, ApiErrorTypeConstants.PARAM_ERROR, "人员被冻结",
|
|
|
+ MessageFormat.format("流水号为[{0}]的卡片对应的人员被冻结,不允许交易", cardNo));
|
|
|
+
|
|
|
+ return R.fail(errorInfo);
|
|
|
+ }
|
|
|
+ Date nowDate = new Date();
|
|
|
+ long currentTime = nowDate.getTime();
|
|
|
+ if (accountVo.getLifespan().getTime()<currentTime) {
|
|
|
+ errorInfo = new ErrorInfo(400, ApiErrorTypeConstants.PARAM_ERROR, "账户过期",
|
|
|
+ MessageFormat.format("流水号为[{0}]的卡片对应的人员账户过期,不允许交易", cardNo));
|
|
|
+
|
|
|
+ return R.fail(errorInfo);
|
|
|
}
|
|
|
+ // 设置返回的消费用户信息
|
|
|
setUserInfo(bo, accountVo);
|
|
|
+
|
|
|
bo.setCardNo(cardVo.getCardNo());
|
|
|
bo.setFactoryId(cardVo.getFactoryId());
|
|
|
bo.setCardTypeName(cardVo.getCardTypeName());
|
|
|
- bo.setExpireDate(accountVo.getLifespan());
|
|
|
- bo.setDeptName(accountVo.getDeptName());
|
|
|
- // BeanUtil.copyProperties(accountVo, userAccountVo);
|
|
|
- RemoteVoConvert.INSTANCE.copyRemoteUserAccountVo(userAccountVo,accountVo);
|
|
|
- // BeanUtil.copyProperties(cardVo, userCardVo);
|
|
|
- RemoteVoConvert.INSTANCE.copyRemoteCardVo(userCardVo,cardVo);
|
|
|
+ RemoteVoConvert.INSTANCE.copyRemoteUserAccountVo(userAccountVo, accountVo);
|
|
|
+ RemoteVoConvert.INSTANCE.copyRemoteCardVo(userCardVo, cardVo);
|
|
|
return R.ok();
|
|
|
}
|
|
|
|
|
|
@@ -409,15 +437,31 @@ public class CheckBusiness {
|
|
|
return R.fail(errorInfo);
|
|
|
}
|
|
|
RemoteUserAccountVo accountVo = remoteUserAccountService.getUserAccountVoById(cardVo.getUserId());
|
|
|
+ if (Objects.isNull(accountVo)) {
|
|
|
+ errorInfo = new ErrorInfo(400, ApiErrorTypeConstants.PARAM_ERROR, "人员不存在",
|
|
|
+ MessageFormat.format("物理卡号为[{0}]的卡片无对应的人员信息,不允许交易", factoryId));
|
|
|
+
|
|
|
+ return R.fail(errorInfo);
|
|
|
+ }
|
|
|
+ if (Objects.equals(accountVo.getFreezeStatus(), Constants.SYS_YES)) {
|
|
|
+ errorInfo = new ErrorInfo(400, ApiErrorTypeConstants.PARAM_ERROR, "人员被冻结",
|
|
|
+ MessageFormat.format("物理卡号为[{0}]的卡片对应的人员被冻结,不允许交易", factoryId));
|
|
|
+
|
|
|
+ return R.fail(errorInfo);
|
|
|
+ }
|
|
|
+ Date nowDate = new Date();
|
|
|
+ long currentTime = nowDate.getTime();
|
|
|
+ if (accountVo.getLifespan().getTime()<currentTime) {
|
|
|
+ errorInfo = new ErrorInfo(400, ApiErrorTypeConstants.PARAM_ERROR, "账户过期",
|
|
|
+ MessageFormat.format("物理卡号为[{0}]的卡片对应的人员账户过期,不允许交易", factoryId));
|
|
|
+
|
|
|
+ return R.fail(errorInfo);
|
|
|
+ }
|
|
|
setUserInfo(bo, accountVo);
|
|
|
bo.setCardNo(cardVo.getCardNo());
|
|
|
bo.setCardTypeName(cardVo.getCardTypeName());
|
|
|
- bo.setExpireDate(accountVo.getLifespan());
|
|
|
- bo.setDeptName(accountVo.getDeptName());
|
|
|
- // BeanUtil.copyProperties(accountVo, userAccountVo);
|
|
|
- RemoteVoConvert.INSTANCE.copyRemoteUserAccountVo(userAccountVo,accountVo);
|
|
|
- // BeanUtil.copyProperties(cardVo, userCardVo);
|
|
|
- RemoteVoConvert.INSTANCE.copyRemoteCardVo(userCardVo,cardVo);
|
|
|
+ RemoteVoConvert.INSTANCE.copyRemoteUserAccountVo(userAccountVo, accountVo);
|
|
|
+ RemoteVoConvert.INSTANCE.copyRemoteCardVo(userCardVo, cardVo);
|
|
|
return R.ok();
|
|
|
}
|
|
|
|
|
|
@@ -440,6 +484,20 @@ public class CheckBusiness {
|
|
|
|
|
|
return R.fail(errorInfo);
|
|
|
}
|
|
|
+ if (Objects.equals(accountVo.getFreezeStatus(), Constants.SYS_YES)) {
|
|
|
+ errorInfo = new ErrorInfo(400, ApiErrorTypeConstants.PARAM_ERROR, "人员被冻结",
|
|
|
+ MessageFormat.format("流水号为[{0}]的人员被冻结,不允许交易", userNo));
|
|
|
+
|
|
|
+ return R.fail(errorInfo);
|
|
|
+ }
|
|
|
+ Date nowDate = new Date();
|
|
|
+ long currentTime = nowDate.getTime();
|
|
|
+ if (accountVo.getLifespan().getTime()<currentTime) {
|
|
|
+ errorInfo = new ErrorInfo(400, ApiErrorTypeConstants.PARAM_ERROR, "账户过期",
|
|
|
+ MessageFormat.format("流水号为[{0}]的人员账户过期,不允许交易", userNo));
|
|
|
+
|
|
|
+ return R.fail(errorInfo);
|
|
|
+ }
|
|
|
RemoteCardVo cardVo = remoteCardService.queryMainCardByUserId(accountVo.getUserId());
|
|
|
if (ObjectUtil.isEmpty(cardVo)) {
|
|
|
errorInfo = new ErrorInfo(400, ApiErrorTypeConstants.PARAM_ERROR, "卡片不存在",
|
|
|
@@ -458,12 +516,8 @@ public class CheckBusiness {
|
|
|
bo.setCardNo(cardVo.getCardNo());
|
|
|
bo.setFactoryId(cardVo.getFactoryId());
|
|
|
bo.setCardTypeName(cardVo.getCardTypeName());
|
|
|
- bo.setExpireDate(accountVo.getLifespan());
|
|
|
- bo.setDeptName(accountVo.getDeptName());
|
|
|
- // BeanUtil.copyProperties(accountVo, userAccountVo);
|
|
|
- RemoteVoConvert.INSTANCE.copyRemoteUserAccountVo(userAccountVo,accountVo);
|
|
|
- // BeanUtil.copyProperties(cardVo, userCardVo);
|
|
|
- RemoteVoConvert.INSTANCE.copyRemoteCardVo(userCardVo,cardVo);
|
|
|
+ RemoteVoConvert.INSTANCE.copyRemoteUserAccountVo(userAccountVo, accountVo);
|
|
|
+ RemoteVoConvert.INSTANCE.copyRemoteCardVo(userCardVo, cardVo);
|
|
|
return R.ok();
|
|
|
}
|
|
|
|
|
|
@@ -487,17 +541,31 @@ public class CheckBusiness {
|
|
|
|
|
|
return R.fail(errorInfo);
|
|
|
}
|
|
|
+ if (Objects.equals(accountVo.getFreezeStatus(), Constants.SYS_YES)) {
|
|
|
+ errorInfo = new ErrorInfo(400, ApiErrorTypeConstants.PARAM_ERROR, "人员被冻结",
|
|
|
+ MessageFormat.format("编号为[{0}]的人员被冻结,不允许交易", userNumb));
|
|
|
+
|
|
|
+ return R.fail(errorInfo);
|
|
|
+ }
|
|
|
+ Date nowDate = new Date();
|
|
|
+ long currentTime = nowDate.getTime();
|
|
|
+ if (accountVo.getLifespan().getTime()<currentTime) {
|
|
|
+ errorInfo = new ErrorInfo(400, ApiErrorTypeConstants.PARAM_ERROR, "账户过期",
|
|
|
+ MessageFormat.format("编号为[{0}]的人员账户过期,不允许交易", userNumb));
|
|
|
+
|
|
|
+ return R.fail(errorInfo);
|
|
|
+ }
|
|
|
RemoteCardVo cardVo = remoteCardService.queryMainCardByUserId(accountVo.getUserId());
|
|
|
if (ObjectUtil.isEmpty(cardVo)) {
|
|
|
errorInfo = new ErrorInfo(400, ApiErrorTypeConstants.PARAM_ERROR, "卡片不存在",
|
|
|
- MessageFormat.format("没有编号为[{0}]的人员的卡片信息,不允许交易", userNumb));
|
|
|
+ MessageFormat.format("没有编号为[{0}]人员的卡片信息,不允许交易", userNumb));
|
|
|
|
|
|
return R.fail(errorInfo);
|
|
|
}
|
|
|
// 实体卡时需要验证卡状态
|
|
|
if (!String.valueOf(CardStatusEnum.NORMAL.code()).equals(cardVo.getStatus()) && cardVo.getFactoryId() > 0) {
|
|
|
errorInfo = new ErrorInfo(400, ApiErrorTypeConstants.PARAM_ERROR, "卡片状态不正确",
|
|
|
- MessageFormat.format("编号为[{0}]的人员卡片状态不正确,不允许交易", userNumb));
|
|
|
+ MessageFormat.format("编号为[{0}]人员卡片状态不正确,不允许交易", userNumb));
|
|
|
|
|
|
return R.fail(errorInfo);
|
|
|
}
|
|
|
@@ -507,10 +575,8 @@ public class CheckBusiness {
|
|
|
bo.setFactoryId(cardVo.getFactoryId());
|
|
|
bo.setCardTypeName(cardVo.getCardTypeName());
|
|
|
|
|
|
- // BeanUtil.copyProperties(accountVo, userAccountVo);
|
|
|
- RemoteVoConvert.INSTANCE.copyRemoteUserAccountVo(userAccountVo,accountVo);
|
|
|
- // BeanUtil.copyProperties(cardVo, userCardVo);
|
|
|
- RemoteVoConvert.INSTANCE.copyRemoteCardVo(userCardVo,cardVo);
|
|
|
+ RemoteVoConvert.INSTANCE.copyRemoteUserAccountVo(userAccountVo, accountVo);
|
|
|
+ RemoteVoConvert.INSTANCE.copyRemoteCardVo(userCardVo, cardVo);
|
|
|
|
|
|
return R.ok();
|
|
|
}
|
|
|
@@ -668,9 +734,9 @@ public class CheckBusiness {
|
|
|
// 计算扣费钱包的总金额
|
|
|
for (String bagCode : bagCodes) {
|
|
|
PtBagVo bagVo = bagService.queryByUserBagCode(userId, bagCode);
|
|
|
- if (ObjectUtil.isNotEmpty(bagVo)) {
|
|
|
+ // if (ObjectUtil.isNotEmpty(bagVo)) {
|
|
|
totalBalance = totalBalance.add(bagVo.getBalance());
|
|
|
- }
|
|
|
+ // }
|
|
|
}
|
|
|
// 如果扣费钱包总余额<消费金额,则不允许消费
|
|
|
if (consumeMoney.compareTo(totalBalance) > 0) {
|
|
|
@@ -724,8 +790,8 @@ public class CheckBusiness {
|
|
|
|
|
|
// 设备消费间隔验证
|
|
|
if ((currentLocalDt.toEpochSecond(ZoneOffset.of("+8"))
|
|
|
- - lastPayLocalDt.toEpochSecond(ZoneOffset.of("+8"))) / 60 < termSwipeInterval && termSwipeInterval > 0) {// 消费间隔
|
|
|
- return R.fail(new ErrorInfo(400, TradeStatusEnum.TimeInterval.toString(), "超过设备单次限额", TradeStatusEnum.TimeInterval.getName()));
|
|
|
+ - lastPayLocalDt.toEpochSecond(ZoneOffset.of("+8"))) / 60 < termSwipeInterval && termSwipeInterval > 0) {
|
|
|
+ return R.fail(new ErrorInfo(400, TradeStatusEnum.TimeInterval.toString(), "消费间隔过短", TradeStatusEnum.TimeInterval.getName()));
|
|
|
}
|
|
|
// 设备单次限额验证
|
|
|
if (termSingleMoney.compareTo(consumeValue) < 0 && termSingleMoney.compareTo(BigDecimal.ZERO) > 0) {// 限制金额
|
|
|
@@ -785,15 +851,18 @@ public class CheckBusiness {
|
|
|
* @return 检查结果
|
|
|
*/
|
|
|
public R<ErrorInfo> checkCardLimitDeal(ConsumptionBo bo, XfTermVo termVo, RemoteCardVo userCardVo, RemoteMealTypeVo mealTypeVo) {
|
|
|
+ long startTime=System.currentTimeMillis();
|
|
|
LocalDateTime currentLocalDt = LocalDateTime.now();
|
|
|
Long cardNo = userCardVo.getCardNo();
|
|
|
Long mealTypeId = Long.valueOf(mealTypeVo.getTypeId());
|
|
|
Date lastPayDate = userCardVo.getLastPay();
|
|
|
// 获取卡片的限制信息
|
|
|
XfCardLimitedVo cardLimitedVo = cardLimitedService.queryByCardNo(cardNo);
|
|
|
+ log.info("卡类限额、限次与折扣初始化耗时1:{}", System.currentTimeMillis()-startTime);
|
|
|
if (ObjectUtil.isEmpty(cardLimitedVo)) {
|
|
|
cardLimitedVo = initXfCardLimited(cardNo, mealTypeVo.getMealId(), lastPayDate);
|
|
|
}
|
|
|
+ log.info("卡类限额、限次与折扣初始化耗时:{}", System.currentTimeMillis()-startTime);
|
|
|
// 最后交易时间
|
|
|
LocalDateTime lastPayLimitLocalDt = LocalDateTime.ofInstant(cardLimitedVo.getLastPay().toInstant(), ZoneOffset.of("+8"));
|
|
|
// 最后交易餐类
|
|
|
@@ -806,21 +875,29 @@ public class CheckBusiness {
|
|
|
if (!Objects.equals(lastPayLimitMealType, mealTypeId)) {
|
|
|
cardLimitedVo = cardLimitedService.resetMealCardLimitedData(cardNo, mealTypeId.toString());
|
|
|
}
|
|
|
+ log.info("卡类限额、限次与折扣初始化耗时2:{}", System.currentTimeMillis()-startTime);
|
|
|
+
|
|
|
// 卡类折扣检查
|
|
|
+ startTime=System.currentTimeMillis();
|
|
|
R<ErrorInfo> result = checkCardDisCount(termVo, userCardVo, cardLimitedVo, mealTypeVo, bo);
|
|
|
if (R.isError(result)) {
|
|
|
return R.fail(result.getData());
|
|
|
}
|
|
|
+ log.info("卡类折扣检查耗时:{}", System.currentTimeMillis()-startTime);
|
|
|
// 卡类限额检查
|
|
|
+ startTime=System.currentTimeMillis();
|
|
|
result = checkCardQuota(termVo, userCardVo, cardLimitedVo, mealTypeVo, bo.getConsumeMoney());
|
|
|
if (R.isError(result)) {
|
|
|
return R.fail(result.getData());
|
|
|
}
|
|
|
+ log.info("卡类限额检查耗时:{}", System.currentTimeMillis()-startTime);
|
|
|
// 卡类限次检
|
|
|
+ startTime=System.currentTimeMillis();
|
|
|
result = checkCardLimited(termVo, userCardVo, cardLimitedVo, mealTypeVo);
|
|
|
if (R.isError(result)) {
|
|
|
return R.fail(result.getData());
|
|
|
}
|
|
|
+ log.info("卡类限次检查耗时:{}", System.currentTimeMillis()-startTime);
|
|
|
return R.ok();
|
|
|
}
|
|
|
|