|
|
@@ -115,7 +115,6 @@ public class ExpenseFlowServiceImpl extends SuperService implements ExpenseFlowS
|
|
|
|
|
|
// 验证参数、填充数据
|
|
|
commonVerifyExpenseFlow(expenseFlow);
|
|
|
-// expenseFlowDao.save(expenseFlow);
|
|
|
return ResultContent.buildSuccess(expenseFlow);
|
|
|
}
|
|
|
|
|
|
@@ -191,11 +190,19 @@ public class ExpenseFlowServiceImpl extends SuperService implements ExpenseFlowS
|
|
|
Boolean isPaySuccess = expenseFlow.getIsPaySuccess();
|
|
|
if (isPaySuccess != null && isPaySuccess) {
|
|
|
result.setSuccess();
|
|
|
- result.setText("支付成功");
|
|
|
+ // 设置了显示异常,去掉
|
|
|
+// result.setText(expenseFlow.getPayRemark());
|
|
|
result.setCardNo(expenseFlow.getCardNo());
|
|
|
result.setName(expenseFlow.getUserName());
|
|
|
// 金额 转为 元 单位
|
|
|
result.setAmount(CommonUtil.turnMoney2Show(expenseFlow.getPayAmount()));
|
|
|
+ if (expenseFlow.getPaymentType() == PaymentType.UserWallet) {
|
|
|
+ // 钱包查询余额
|
|
|
+ Wallet wallet = walletDao.findByUserId(expenseFlow.getUserId());
|
|
|
+ if (ObjectUtils.isNotEmpty(wallet)) {
|
|
|
+ result.setMoney(CommonUtil.turnMoney2Show(wallet.getAmount()));
|
|
|
+ }
|
|
|
+ }
|
|
|
} else {
|
|
|
result.setFailed(expenseFlow.getPayRemark());
|
|
|
}
|
|
|
@@ -248,8 +255,6 @@ public class ExpenseFlowServiceImpl extends SuperService implements ExpenseFlowS
|
|
|
expenseFlow.setPaymentDeviceType(PaymentDeviceType.HxzConsumTransactions);
|
|
|
|
|
|
commonVerifyExpenseFlow(expenseFlow);
|
|
|
-
|
|
|
-// expenseFlowDao.save(expenseFlow);
|
|
|
return ResultContent.buildSuccess(expenseFlow);
|
|
|
}
|
|
|
|
|
|
@@ -260,6 +265,15 @@ public class ExpenseFlowServiceImpl extends SuperService implements ExpenseFlowS
|
|
|
*/
|
|
|
private void commonVerifyExpenseFlow(ExpenseFlow entity) {
|
|
|
String deviceId = entity.getDeviceId();
|
|
|
+
|
|
|
+ // 验证设备
|
|
|
+ DeviceInfo deviceInfo = deviceInfoDao.findTopByDeviceId(deviceId);
|
|
|
+ if (ObjectUtils.isEmpty(deviceInfo)) {
|
|
|
+ entity.setVerifyParamIsSuccess(Boolean.FALSE);
|
|
|
+ entity.setVerifyParamMsg("业务设备未注册");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
// 查询设备绑定德 商户 学校
|
|
|
if (StringUtils.isNotEmpty(deviceId)) {
|
|
|
DeviceBind deviceBind = deviceBindDao.findTopByDeviceId(deviceId);
|
|
|
@@ -269,13 +283,13 @@ public class ExpenseFlowServiceImpl extends SuperService implements ExpenseFlowS
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if (StringUtils.isNotEmpty(entity.getSchoolOid())) {
|
|
|
+ if (StringUtils.isEmpty(entity.getSchoolOid())) {
|
|
|
entity.setVerifyParamIsSuccess(Boolean.FALSE);
|
|
|
entity.setVerifyParamMsg("设备未绑定学校");
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- if (StringUtils.isNotEmpty(entity.getShopOid())) {
|
|
|
+ if (StringUtils.isEmpty(entity.getShopOid())) {
|
|
|
entity.setVerifyParamIsSuccess(Boolean.FALSE);
|
|
|
entity.setVerifyParamMsg("设备未绑定商户");
|
|
|
return;
|
|
|
@@ -284,12 +298,7 @@ public class ExpenseFlowServiceImpl extends SuperService implements ExpenseFlowS
|
|
|
PaymentType paymentType = entity.getPaymentType();
|
|
|
// 刷卡支付
|
|
|
if (paymentType == PaymentType.UserWallet) {
|
|
|
-
|
|
|
CardInfo cardInfo = cardInfoDao.findByCode(entity.getCardNo());
|
|
|
- if (ObjectUtils.isNotEmpty(cardInfo)) {
|
|
|
- entity.setCardInfo(cardInfo);
|
|
|
- entity.setUserId(cardInfo.getUserId());
|
|
|
- }
|
|
|
|
|
|
// 验证卡片
|
|
|
if (ObjectUtils.isEmpty(cardInfo)) {
|
|
|
@@ -297,6 +306,9 @@ public class ExpenseFlowServiceImpl extends SuperService implements ExpenseFlowS
|
|
|
entity.setVerifyParamMsg("卡片未注册");
|
|
|
return;
|
|
|
}
|
|
|
+ entity.setCardInfo(cardInfo);
|
|
|
+ entity.setUserId(cardInfo.getUserId());
|
|
|
+
|
|
|
// 判断卡片是否可用
|
|
|
if (cardInfo.getCardState() != CardState.Enable) {
|
|
|
entity.setVerifyParamIsSuccess(Boolean.FALSE);
|
|
|
@@ -312,7 +324,8 @@ public class ExpenseFlowServiceImpl extends SuperService implements ExpenseFlowS
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if (StringUtils.isNotEmpty(entity.getUserId())) {
|
|
|
+ //
|
|
|
+ if (StringUtils.isEmpty(entity.getUserId())) {
|
|
|
entity.setVerifyParamIsSuccess(Boolean.FALSE);
|
|
|
entity.setVerifyParamMsg("订单未找到用户");
|
|
|
return;
|
|
|
@@ -352,13 +365,6 @@ public class ExpenseFlowServiceImpl extends SuperService implements ExpenseFlowS
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- // 验证设备
|
|
|
- DeviceInfo deviceInfo = deviceInfoDao.findTopByDeviceId(deviceId);
|
|
|
- if (ObjectUtils.isEmpty(deviceInfo)) {
|
|
|
- entity.setVerifyParamIsSuccess(Boolean.FALSE);
|
|
|
- entity.setVerifyParamMsg("业务设备未注册");
|
|
|
- return;
|
|
|
- }
|
|
|
// 消费设备信息
|
|
|
if (deviceInfo.getDeviceType() != null) {
|
|
|
entity.setPayType(deviceInfo.getDeviceType().getRemark());
|
|
|
@@ -403,8 +409,6 @@ public class ExpenseFlowServiceImpl extends SuperService implements ExpenseFlowS
|
|
|
log.info("支付结果:{}", apiResponseModel);
|
|
|
if (apiResponseModel.isSuccess()) {
|
|
|
// 关联参数
|
|
|
- TransactionInquiryResult result = JSONUtil.toBean(apiResponseModel.getContent(), TransactionInquiryResult.class);
|
|
|
-// entity.setOrderNo(result.getQrorder());
|
|
|
entity.setPaymentStatus("支付成功");
|
|
|
entity.setIsPaySuccess(Boolean.TRUE);
|
|
|
entity.setPayRemark("支付成功");
|
|
|
@@ -415,7 +419,7 @@ public class ExpenseFlowServiceImpl extends SuperService implements ExpenseFlowS
|
|
|
entity.setPayRemark(apiResponseModel.getMsg());
|
|
|
}
|
|
|
expenseFlowDao.save(entity);
|
|
|
- return ResultContent.buildSuccess();
|
|
|
+ return ResultContent.buildSuccess(entity);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -431,9 +435,10 @@ public class ExpenseFlowServiceImpl extends SuperService implements ExpenseFlowS
|
|
|
Boolean isPaySuccess = expenseFlow.getIsPaySuccess();
|
|
|
if (isPaySuccess != null && isPaySuccess) {
|
|
|
result.setSuccess();
|
|
|
- result.setText(expenseFlow.getPayRemark());
|
|
|
+// result.setText(expenseFlow.getPayRemark());
|
|
|
result.setCardNo(expenseFlow.getCardNo());
|
|
|
- result.setName(expenseFlow.getUserName());
|
|
|
+// result.setName(expenseFlow.getUserName());
|
|
|
+ result.setName("陈琰春");
|
|
|
// 金额 转为 元 单位
|
|
|
result.setAmount(CommonUtil.turnMoney2Show(expenseFlow.getPayAmount()));
|
|
|
} else {
|