|
@@ -13,6 +13,7 @@ import org.dromara.backstage.api.*;
|
|
|
import org.dromara.backstage.api.domain.vo.*;
|
|
import org.dromara.backstage.api.domain.vo.*;
|
|
|
import org.dromara.common.core.config.DefaultConfig;
|
|
import org.dromara.common.core.config.DefaultConfig;
|
|
|
import org.dromara.common.core.constant.ApiErrorTypeConstants;
|
|
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.R;
|
|
|
import org.dromara.common.core.domain.model.ErrorInfo;
|
|
import org.dromara.common.core.domain.model.ErrorInfo;
|
|
|
import org.dromara.common.core.enums.BagNameEnum;
|
|
import org.dromara.common.core.enums.BagNameEnum;
|
|
@@ -283,6 +284,18 @@ public class CheckBusiness {
|
|
|
return R.ok();
|
|
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,
|
|
public R<ErrorInfo> checkBill(ConsumptionBo bo, RemoteUserAccountVo userAccountVo, RemoteCardVo userCardVo,
|
|
|
XfTermVo useTermVo, List<PtBagVo> bagVoList, RemoteMealTypeVo mealTypeVo,
|
|
XfTermVo useTermVo, List<PtBagVo> bagVoList, RemoteMealTypeVo mealTypeVo,
|
|
|
RemoteOperatorVo operatorVo) {
|
|
RemoteOperatorVo operatorVo) {
|
|
@@ -324,6 +337,7 @@ public class CheckBusiness {
|
|
|
* @param accountVo 消费账户
|
|
* @param accountVo 消费账户
|
|
|
*/
|
|
*/
|
|
|
private void setUserInfo(ConsumptionBo bo, RemoteUserAccountVo accountVo) {
|
|
private void setUserInfo(ConsumptionBo bo, RemoteUserAccountVo accountVo) {
|
|
|
|
|
+ bo.setUserId(accountVo.getUserId());
|
|
|
bo.setRealName(StrUtil.isEmpty(accountVo.getRealName()) ? "----" : accountVo.getRealName());
|
|
bo.setRealName(StrUtil.isEmpty(accountVo.getRealName()) ? "----" : accountVo.getRealName());
|
|
|
bo.setUserNo(accountVo.getUserNo());
|
|
bo.setUserNo(accountVo.getUserNo());
|
|
|
bo.setUserNumb(accountVo.getUserNumb());
|
|
bo.setUserNumb(accountVo.getUserNumb());
|
|
@@ -342,46 +356,58 @@ public class CheckBusiness {
|
|
|
*/
|
|
*/
|
|
|
@NotNull
|
|
@NotNull
|
|
|
private R<ErrorInfo> checkCardNo(ConsumptionBo bo, RemoteUserAccountVo userAccountVo, RemoteCardVo userCardVo) {
|
|
private R<ErrorInfo> checkCardNo(ConsumptionBo bo, RemoteUserAccountVo userAccountVo, RemoteCardVo userCardVo) {
|
|
|
- RemoteUserAccountVo accountVo;
|
|
|
|
|
- RemoteCardVo cardVo;
|
|
|
|
|
|
|
+ ErrorInfo errorInfo;
|
|
|
Long cardNo = bo.getCardNo();
|
|
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);
|
|
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);
|
|
setUserInfo(bo, accountVo);
|
|
|
|
|
+
|
|
|
bo.setCardNo(cardVo.getCardNo());
|
|
bo.setCardNo(cardVo.getCardNo());
|
|
|
bo.setFactoryId(cardVo.getFactoryId());
|
|
bo.setFactoryId(cardVo.getFactoryId());
|
|
|
bo.setCardTypeName(cardVo.getCardTypeName());
|
|
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();
|
|
return R.ok();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -409,15 +435,31 @@ public class CheckBusiness {
|
|
|
return R.fail(errorInfo);
|
|
return R.fail(errorInfo);
|
|
|
}
|
|
}
|
|
|
RemoteUserAccountVo accountVo = remoteUserAccountService.getUserAccountVoById(cardVo.getUserId());
|
|
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);
|
|
setUserInfo(bo, accountVo);
|
|
|
bo.setCardNo(cardVo.getCardNo());
|
|
bo.setCardNo(cardVo.getCardNo());
|
|
|
bo.setCardTypeName(cardVo.getCardTypeName());
|
|
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();
|
|
return R.ok();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -440,6 +482,20 @@ public class CheckBusiness {
|
|
|
|
|
|
|
|
return R.fail(errorInfo);
|
|
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());
|
|
RemoteCardVo cardVo = remoteCardService.queryMainCardByUserId(accountVo.getUserId());
|
|
|
if (ObjectUtil.isEmpty(cardVo)) {
|
|
if (ObjectUtil.isEmpty(cardVo)) {
|
|
|
errorInfo = new ErrorInfo(400, ApiErrorTypeConstants.PARAM_ERROR, "卡片不存在",
|
|
errorInfo = new ErrorInfo(400, ApiErrorTypeConstants.PARAM_ERROR, "卡片不存在",
|
|
@@ -458,12 +514,8 @@ public class CheckBusiness {
|
|
|
bo.setCardNo(cardVo.getCardNo());
|
|
bo.setCardNo(cardVo.getCardNo());
|
|
|
bo.setFactoryId(cardVo.getFactoryId());
|
|
bo.setFactoryId(cardVo.getFactoryId());
|
|
|
bo.setCardTypeName(cardVo.getCardTypeName());
|
|
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();
|
|
return R.ok();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -487,17 +539,31 @@ public class CheckBusiness {
|
|
|
|
|
|
|
|
return R.fail(errorInfo);
|
|
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());
|
|
RemoteCardVo cardVo = remoteCardService.queryMainCardByUserId(accountVo.getUserId());
|
|
|
if (ObjectUtil.isEmpty(cardVo)) {
|
|
if (ObjectUtil.isEmpty(cardVo)) {
|
|
|
errorInfo = new ErrorInfo(400, ApiErrorTypeConstants.PARAM_ERROR, "卡片不存在",
|
|
errorInfo = new ErrorInfo(400, ApiErrorTypeConstants.PARAM_ERROR, "卡片不存在",
|
|
|
- MessageFormat.format("没有编号为[{0}]的人员的卡片信息,不允许交易", userNumb));
|
|
|
|
|
|
|
+ MessageFormat.format("没有编号为[{0}]人员的卡片信息,不允许交易", userNumb));
|
|
|
|
|
|
|
|
return R.fail(errorInfo);
|
|
return R.fail(errorInfo);
|
|
|
}
|
|
}
|
|
|
// 实体卡时需要验证卡状态
|
|
// 实体卡时需要验证卡状态
|
|
|
if (!String.valueOf(CardStatusEnum.NORMAL.code()).equals(cardVo.getStatus()) && cardVo.getFactoryId() > 0) {
|
|
if (!String.valueOf(CardStatusEnum.NORMAL.code()).equals(cardVo.getStatus()) && cardVo.getFactoryId() > 0) {
|
|
|
errorInfo = new ErrorInfo(400, ApiErrorTypeConstants.PARAM_ERROR, "卡片状态不正确",
|
|
errorInfo = new ErrorInfo(400, ApiErrorTypeConstants.PARAM_ERROR, "卡片状态不正确",
|
|
|
- MessageFormat.format("编号为[{0}]的人员卡片状态不正确,不允许交易", userNumb));
|
|
|
|
|
|
|
+ MessageFormat.format("编号为[{0}]人员卡片状态不正确,不允许交易", userNumb));
|
|
|
|
|
|
|
|
return R.fail(errorInfo);
|
|
return R.fail(errorInfo);
|
|
|
}
|
|
}
|
|
@@ -507,10 +573,8 @@ public class CheckBusiness {
|
|
|
bo.setFactoryId(cardVo.getFactoryId());
|
|
bo.setFactoryId(cardVo.getFactoryId());
|
|
|
bo.setCardTypeName(cardVo.getCardTypeName());
|
|
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();
|
|
return R.ok();
|
|
|
}
|
|
}
|