|
@@ -8,6 +8,7 @@ import com.github.microservice.models.hxz.*;
|
|
|
import com.github.microservice.models.type.OrderFromType;
|
|
import com.github.microservice.models.type.OrderFromType;
|
|
|
import com.github.microservice.models.type.PaymentDeviceType;
|
|
import com.github.microservice.models.type.PaymentDeviceType;
|
|
|
import com.github.microservice.models.type.PaymentType;
|
|
import com.github.microservice.models.type.PaymentType;
|
|
|
|
|
+import com.zhongshu.card.client.model.operLogs.OperationLogsAddParam;
|
|
|
import com.zhongshu.card.client.model.payment.*;
|
|
import com.zhongshu.card.client.model.payment.*;
|
|
|
import com.zhongshu.card.client.model.payment.statistic.BusinessMainStatisticModel;
|
|
import com.zhongshu.card.client.model.payment.statistic.BusinessMainStatisticModel;
|
|
|
import com.zhongshu.card.client.model.payment.statistic.StatisticItem;
|
|
import com.zhongshu.card.client.model.payment.statistic.StatisticItem;
|
|
@@ -37,9 +38,12 @@ import com.zhongshu.card.server.core.httpRequest.ApiRequestService;
|
|
|
import com.zhongshu.card.server.core.httpRequest.apiConf.APIResponseModel;
|
|
import com.zhongshu.card.server.core.httpRequest.apiConf.APIResponseModel;
|
|
|
import com.zhongshu.card.server.core.service.base.SuperService;
|
|
import com.zhongshu.card.server.core.service.base.SuperService;
|
|
|
import com.zhongshu.card.server.core.service.org.OrganizationServiceImpl;
|
|
import com.zhongshu.card.server.core.service.org.OrganizationServiceImpl;
|
|
|
|
|
+import com.zhongshu.card.server.core.service.user.OperationLogsService;
|
|
|
import com.zhongshu.card.server.core.util.*;
|
|
import com.zhongshu.card.server.core.util.*;
|
|
|
import com.zhongshu.payment.client.model.WalletModel;
|
|
import com.zhongshu.payment.client.model.WalletModel;
|
|
|
import com.zhongshu.payment.client.model.param.AmountUpdateParam;
|
|
import com.zhongshu.payment.client.model.param.AmountUpdateParam;
|
|
|
|
|
+import com.zhongshu.payment.client.payModel.commn.CreateOrderParam;
|
|
|
|
|
+import com.zhongshu.payment.client.service.OrderPayFeignService;
|
|
|
import com.zhongshu.payment.client.service.WalletFeignService;
|
|
import com.zhongshu.payment.client.service.WalletFeignService;
|
|
|
import com.zhongshu.payment.client.types.WalletType;
|
|
import com.zhongshu.payment.client.types.WalletType;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
@@ -97,6 +101,12 @@ public class ExpenseFlowServiceImpl extends SuperService implements ExpenseFlowS
|
|
|
@Autowired
|
|
@Autowired
|
|
|
WalletFeignService walletFeignService;
|
|
WalletFeignService walletFeignService;
|
|
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ OrderPayFeignService orderPayFeignService;
|
|
|
|
|
+
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ OperationLogsService operationLogsService;
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* 创建流水
|
|
* 创建流水
|
|
|
*
|
|
*
|
|
@@ -162,21 +172,31 @@ public class ExpenseFlowServiceImpl extends SuperService implements ExpenseFlowS
|
|
|
return ResultContent.buildSuccess(entity);
|
|
return ResultContent.buildSuccess(entity);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- // 钱包支付
|
|
|
|
|
- AmountUpdateParam param = new AmountUpdateParam();
|
|
|
|
|
- param.setOid(entity.getProjectOid());
|
|
|
|
|
|
|
+ CreateOrderParam param = new CreateOrderParam();
|
|
|
|
|
+ param.setProjectOid(entity.getProjectOid());
|
|
|
param.setUserId(entity.getUserId());
|
|
param.setUserId(entity.getUserId());
|
|
|
param.setShopId(entity.getShopOid());
|
|
param.setShopId(entity.getShopOid());
|
|
|
param.setSchoolId(entity.getSchoolOid());
|
|
param.setSchoolId(entity.getSchoolOid());
|
|
|
param.setTotal(entity.getPayAmount());
|
|
param.setTotal(entity.getPayAmount());
|
|
|
param.setOutTradeNo(entity.getPaymentNo());
|
|
param.setOutTradeNo(entity.getPaymentNo());
|
|
|
- ResultContent content = walletFeignService.consume(param);
|
|
|
|
|
|
|
+ param.setPaymentType(entity.getPaymentType());
|
|
|
|
|
+ param.setDescription("刷卡消费");
|
|
|
|
|
+
|
|
|
|
|
+ OperationLogsAddParam logsAddParam = initLog(entity.getUserId());
|
|
|
|
|
+ logsAddParam.setTitle("刷卡消费");
|
|
|
|
|
+ logsAddParam.setDataId(entity.getPaymentNo());
|
|
|
|
|
+ entity.setPayStartTime(System.currentTimeMillis());
|
|
|
|
|
+ ResultContent content = orderPayFeignService.createAndPay(param);
|
|
|
if (content.isSuccess()) {
|
|
if (content.isSuccess()) {
|
|
|
// 关联参数
|
|
// 关联参数
|
|
|
- entity.setPaymentStatus("支付成功");
|
|
|
|
|
|
|
+ String msg = "支付成功";
|
|
|
|
|
+ entity.setPaymentStatus(msg);
|
|
|
entity.setIsPaySuccess(Boolean.TRUE);
|
|
entity.setIsPaySuccess(Boolean.TRUE);
|
|
|
- entity.setPayRemark("支付成功");
|
|
|
|
|
|
|
+ entity.setPayRemark(msg);
|
|
|
entity.setOrderType(OrderType.HAVE_PAID);
|
|
entity.setOrderType(OrderType.HAVE_PAID);
|
|
|
|
|
+ logsAddParam.setMessageType(MessageType.Info);
|
|
|
|
|
+ logsAddParam.setLevel(LogsLevel.Low);
|
|
|
|
|
+ logsAddParam.setContent(msg);
|
|
|
} else {
|
|
} else {
|
|
|
String msg = content.getMsg();
|
|
String msg = content.getMsg();
|
|
|
if (StringUtils.isNotEmpty(msg) && msg.contains("Connection reset")) {
|
|
if (StringUtils.isNotEmpty(msg) && msg.contains("Connection reset")) {
|
|
@@ -184,10 +204,17 @@ public class ExpenseFlowServiceImpl extends SuperService implements ExpenseFlowS
|
|
|
}
|
|
}
|
|
|
entity.setPaymentStatus(msg);
|
|
entity.setPaymentStatus(msg);
|
|
|
entity.setIsPaySuccess(Boolean.FALSE);
|
|
entity.setIsPaySuccess(Boolean.FALSE);
|
|
|
- entity.setPayRemark(content.getMsg());
|
|
|
|
|
|
|
+ entity.setPayRemark(msg);
|
|
|
entity.setOrderType(OrderType.PAID_ERROR);
|
|
entity.setOrderType(OrderType.PAID_ERROR);
|
|
|
|
|
+ logsAddParam.setMessageType(MessageType.Warn);
|
|
|
|
|
+ logsAddParam.setLevel(LogsLevel.Low);
|
|
|
|
|
+ logsAddParam.setContent(msg);
|
|
|
}
|
|
}
|
|
|
|
|
+ operationLogsService.addLog(logsAddParam);
|
|
|
|
|
+ entity.setPayEndTime(System.currentTimeMillis());
|
|
|
|
|
+ entity.setPayMillis(entity.getPayEndTime() - entity.getPayStartTime());
|
|
|
expenseFlowDao.save(entity);
|
|
expenseFlowDao.save(entity);
|
|
|
|
|
+
|
|
|
return ResultContent.buildSuccess();
|
|
return ResultContent.buildSuccess();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -344,23 +371,6 @@ public class ExpenseFlowServiceImpl extends SuperService implements ExpenseFlowS
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-// // 个人钱包
|
|
|
|
|
-// if (paymentType == PaymentType.UserWallet) {
|
|
|
|
|
-// // 得到消费的金额
|
|
|
|
|
-// BigDecimal amount = entity.getPayAmount();
|
|
|
|
|
-// // 钱包信息
|
|
|
|
|
-// Wallet wallet = walletService.getUserWalletByUserId(entity.getUserId());
|
|
|
|
|
-// if (wallet.getDataState() != DataState.Enable) {
|
|
|
|
|
-// entity.setVerifyError(String.format("支付失败钱包%s", wallet.getDataState().getRemark()));
|
|
|
|
|
-// return;
|
|
|
|
|
-// }
|
|
|
|
|
-// // 检查
|
|
|
|
|
-// if (wallet.getAmount().compareTo(amount) < 0) {
|
|
|
|
|
-// entity.setVerifyError("余额不足");
|
|
|
|
|
-// return;
|
|
|
|
|
-// }
|
|
|
|
|
-// }
|
|
|
|
|
-
|
|
|
|
|
// 消费设备信息
|
|
// 消费设备信息
|
|
|
if (deviceInfo.getDeviceType() != null) {
|
|
if (deviceInfo.getDeviceType() != null) {
|
|
|
entity.setPayType(deviceInfo.getDeviceType().getRemark());
|
|
entity.setPayType(deviceInfo.getDeviceType().getRemark());
|