|
|
@@ -14,6 +14,7 @@ import com.zhongshu.card.client.ret.ResultContent;
|
|
|
import com.zhongshu.card.client.ret.ResultMessage;
|
|
|
import com.zhongshu.card.client.service.payment.ExpenseFlowService;
|
|
|
import com.zhongshu.card.client.utils.type.DataState;
|
|
|
+import com.zhongshu.card.client.utils.type.OrderType;
|
|
|
import com.zhongshu.card.client.utils.type.RechargeType;
|
|
|
import com.zhongshu.card.client.utils.type.UserState;
|
|
|
import com.zhongshu.card.client.utils.type.school.CardState;
|
|
|
@@ -133,6 +134,7 @@ public class ExpenseFlowServiceImpl extends SuperService implements ExpenseFlowS
|
|
|
expenseFlow.setPaymentType(iotParam.getPaymentType());
|
|
|
expenseFlow.setParam(iotParam);
|
|
|
expenseFlow.setPaymentDeviceType(PaymentDeviceType.HxzConsumTransactions);
|
|
|
+ expenseFlow.setOrderType(OrderType.WAIT_PAYMENT);
|
|
|
|
|
|
// 验证参数、填充数据
|
|
|
commonVerifyExpenseFlow(expenseFlow);
|
|
|
@@ -258,15 +260,13 @@ public class ExpenseFlowServiceImpl extends SuperService implements ExpenseFlowS
|
|
|
// 验证设备
|
|
|
DeviceInfo deviceInfo = deviceInfoDao.findTopByDeviceId(deviceId);
|
|
|
if (ObjectUtils.isEmpty(deviceInfo)) {
|
|
|
- entity.setVerifyParamIsSuccess(Boolean.FALSE);
|
|
|
- entity.setVerifyParamMsg("业务设备未注册");
|
|
|
+ entity.setVerifyError("业务设备未注册");
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
// 设备已停用
|
|
|
if (deviceInfo.getState() != null && deviceInfo.getState() == DataState.Disable) {
|
|
|
- entity.setVerifyParamIsSuccess(Boolean.FALSE);
|
|
|
- entity.setVerifyParamMsg(String.format("设备%s", deviceInfo.getState().getRemark()));
|
|
|
+ entity.setVerifyError(String.format("设备%s", deviceInfo.getState().getRemark()));
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
@@ -280,14 +280,12 @@ public class ExpenseFlowServiceImpl extends SuperService implements ExpenseFlowS
|
|
|
}
|
|
|
|
|
|
if (StringUtils.isEmpty(entity.getSchoolOid())) {
|
|
|
- entity.setVerifyParamIsSuccess(Boolean.FALSE);
|
|
|
- entity.setVerifyParamMsg("设备未绑定学校");
|
|
|
+ entity.setVerifyError("设备未绑定学校");
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
if (StringUtils.isEmpty(entity.getShopOid())) {
|
|
|
- entity.setVerifyParamIsSuccess(Boolean.FALSE);
|
|
|
- entity.setVerifyParamMsg("设备未绑定商户");
|
|
|
+ entity.setVerifyError("设备未绑定商户");
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
@@ -303,8 +301,7 @@ public class ExpenseFlowServiceImpl extends SuperService implements ExpenseFlowS
|
|
|
|
|
|
// 验证项目信息
|
|
|
if (StringUtils.isEmpty(entity.getProjectCode())) {
|
|
|
- entity.setVerifyParamIsSuccess(Boolean.FALSE);
|
|
|
- entity.setVerifyParamMsg("未绑定项目信息");
|
|
|
+ entity.setVerifyError("未绑定项目信息");
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
@@ -314,8 +311,7 @@ public class ExpenseFlowServiceImpl extends SuperService implements ExpenseFlowS
|
|
|
CardInfo cardInfo = cardInfoDao.findByCode(entity.getCardNo());
|
|
|
// 验证卡片
|
|
|
if (ObjectUtils.isEmpty(cardInfo)) {
|
|
|
- entity.setVerifyParamIsSuccess(Boolean.FALSE);
|
|
|
- entity.setVerifyParamMsg("卡片未注册");
|
|
|
+ entity.setVerifyError("卡片未注册");
|
|
|
return;
|
|
|
}
|
|
|
entity.setCardInfo(cardInfo);
|
|
|
@@ -323,38 +319,33 @@ public class ExpenseFlowServiceImpl extends SuperService implements ExpenseFlowS
|
|
|
|
|
|
// 判断卡片是否可用
|
|
|
if (cardInfo.getCardState() != CardState.Enable) {
|
|
|
- entity.setVerifyParamIsSuccess(Boolean.FALSE);
|
|
|
- entity.setVerifyParamMsg(String.format("卡片%s", cardInfo.getCardState().getRemark()));
|
|
|
+ entity.setVerifyError(String.format("卡片%s", cardInfo.getCardState().getRemark()));
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
ConsumTransactionsModel iotParam = (ConsumTransactionsModel) entity.getParam();
|
|
|
if (iotParam.getMode() != 0 && iotParam.getPayType() != 0) {
|
|
|
- entity.setVerifyParamIsSuccess(Boolean.FALSE);
|
|
|
- entity.setVerifyParamMsg("消费模式不支持");
|
|
|
+ entity.setVerifyError("消费模式不支持");
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
// 验证用户信息
|
|
|
if (StringUtils.isEmpty(entity.getUserId())) {
|
|
|
- entity.setVerifyParamIsSuccess(Boolean.FALSE);
|
|
|
- entity.setVerifyParamMsg("订单未找到用户");
|
|
|
+ entity.setVerifyError("订单未找到用户");
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
UserAccount userAccount = userCountDao.findTopByUserId(entity.getUserId());
|
|
|
if (ObjectUtils.isEmpty(userAccount)) {
|
|
|
- entity.setVerifyParamIsSuccess(Boolean.FALSE);
|
|
|
- entity.setVerifyParamMsg("用户未注册");
|
|
|
+ entity.setVerifyError("用户未注册");
|
|
|
return;
|
|
|
}
|
|
|
entity.setUserName(userAccount.getName());
|
|
|
entity.setUserAccount(userAccount);
|
|
|
|
|
|
if (userAccount.getState() == UserState.Locked) {
|
|
|
- entity.setVerifyParamIsSuccess(Boolean.FALSE);
|
|
|
- entity.setVerifyParamMsg("用户已锁定");
|
|
|
+ entity.setVerifyError("用户已锁定");
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
@@ -365,14 +356,12 @@ public class ExpenseFlowServiceImpl extends SuperService implements ExpenseFlowS
|
|
|
// 钱包信息
|
|
|
Wallet wallet = walletService.getUserWalletByUserId(entity.getUserId());
|
|
|
if (wallet.getDataState() != DataState.Enable) {
|
|
|
- entity.setVerifyParamIsSuccess(Boolean.FALSE);
|
|
|
- entity.setVerifyParamMsg(String.format("支付失败钱包%s", wallet.getDataState().getRemark()));
|
|
|
+ entity.setVerifyError(String.format("支付失败钱包%s", wallet.getDataState().getRemark()));
|
|
|
return;
|
|
|
}
|
|
|
// 检查
|
|
|
if (wallet.getAmount().compareTo(amount) < 0) {
|
|
|
- entity.setVerifyParamIsSuccess(Boolean.FALSE);
|
|
|
- entity.setVerifyParamMsg("余额不足");
|
|
|
+ entity.setVerifyError("余额不足");
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
|
@@ -384,19 +373,16 @@ public class ExpenseFlowServiceImpl extends SuperService implements ExpenseFlowS
|
|
|
entity.setPayType("消费");
|
|
|
}
|
|
|
if (entity.getPaymentType() == null) {
|
|
|
- entity.setVerifyParamIsSuccess(Boolean.FALSE);
|
|
|
- entity.setVerifyParamMsg("支付方式不支持");
|
|
|
+ entity.setVerifyError("支付方式不支持");
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
// 金额判断
|
|
|
BigDecimal payAmount = entity.getPayAmount();
|
|
|
if (CommonUtil.bigDecimalIsEmpty(payAmount)) {
|
|
|
- entity.setVerifyParamIsSuccess(Boolean.FALSE);
|
|
|
- entity.setVerifyParamMsg("消费金额不能为0");
|
|
|
+ entity.setVerifyError("消费金额不能为0");
|
|
|
return;
|
|
|
}
|
|
|
-
|
|
|
entity.setVerifyParamIsSuccess(Boolean.TRUE);
|
|
|
entity.setVerifyParamMsg("参数验证成功");
|
|
|
}
|