|
|
@@ -38,6 +38,8 @@ import java.io.*;
|
|
|
import java.math.BigDecimal;
|
|
|
import java.net.Socket;
|
|
|
import java.net.SocketTimeoutException;
|
|
|
+import java.net.URL;
|
|
|
+import java.net.URLConnection;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.time.LocalDateTime;
|
|
|
import java.util.Date;
|
|
|
@@ -228,10 +230,11 @@ public class DistributorSelfRechargeServiceImpl implements DistributorSelfRechar
|
|
|
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
- public Long distributorCMBRecharge(Long id, String payOrderId, Integer payStatus) {
|
|
|
+ public Long distributorCMBRecharge(Long distributorId,Long id, String payOrderId, Integer payStatus) {
|
|
|
log.info("对公转账充值支付完成:{},{},{}", id, payOrderId, payStatus);
|
|
|
AtomicReference<Long> tradeLogId = new AtomicReference<>();
|
|
|
- DistributorSelfRechargeDO distributorSelfRecharge = getDistributorSelfRecharge(id);
|
|
|
+ DistributorSelfRechargeDO distributorSelfRecharge = distributorSelfRechargeMapper.selectById(id);
|
|
|
+// DistributorSelfRechargeDO distributorSelfRecharge = getDistributorSelfRecharge(id);
|
|
|
if (distributorSelfRecharge.getRechargeState() == 1) {
|
|
|
throw exception0(11_029, "当前自助充值已处理");
|
|
|
}
|
|
|
@@ -244,30 +247,10 @@ public class DistributorSelfRechargeServiceImpl implements DistributorSelfRechar
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public void abcRemittance(DistributorDO distributor) {
|
|
|
+ public void abcRemittance(DistributorDO distributor, String host, Integer port, String yqtCard, int ofday, String url) {
|
|
|
String cardNo = distributor.getCmbShortNo();
|
|
|
log.error("abc对公转账充值查询{}", cardNo);
|
|
|
- String host = configApi.getPlatformConfigValueByKey("dgConfig_ip");
|
|
|
- String portStr = configApi.getPlatformConfigValueByKey("dgConfig_port");
|
|
|
- String yqtCard = configApi.getPlatformConfigValueByKey("dgConfig_card");
|
|
|
- String day = configApi.getPlatformConfigValueByKey("dgConfig_day");
|
|
|
- int ofday = 1;
|
|
|
- if (StringUtils.isNotBlank(day)) {
|
|
|
- try {
|
|
|
- ofday = Integer.parseInt(day);
|
|
|
- } catch (Exception ignored) {
|
|
|
-
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- int port = 15999;
|
|
|
- if (StringUtils.isNotBlank(portStr)) {
|
|
|
- try {
|
|
|
- port = Integer.parseInt(portStr);
|
|
|
- } catch (Exception ignored) {
|
|
|
|
|
|
- }
|
|
|
- }
|
|
|
try {
|
|
|
// 1. 获取当前时间,用于组装公共包头流水与日期
|
|
|
Date now = new Date();
|
|
|
@@ -376,12 +359,23 @@ public class DistributorSelfRechargeServiceImpl implements DistributorSelfRechar
|
|
|
log.error("无交易数据{}", cardNo);
|
|
|
return;
|
|
|
}
|
|
|
- // 使用 try-with-resources 自动关闭流 //替换成文件目录
|
|
|
- try (FileInputStream fis = new FileInputStream("/data/bankshare/" + batchFileName);
|
|
|
- InputStreamReader isr = new InputStreamReader(fis, "GBK");
|
|
|
- BufferedReader br = new BufferedReader(isr)) {
|
|
|
+ try {
|
|
|
+ // 1. 创建 URL 对象
|
|
|
+ URL conurl = new URL(url + batchFileName);
|
|
|
+ // 2. 打开连接
|
|
|
+ URLConnection connection = conurl.openConnection();
|
|
|
+ // 3. 设置可选参数(例如超时时间、User-Agent)
|
|
|
+ connection.setConnectTimeout(5000); // 连接超时 5 秒
|
|
|
+ connection.setReadTimeout(5000); // 读取超时 5 秒
|
|
|
+ connection.setRequestProperty("User-Agent", "Mozilla/5.0");
|
|
|
+
|
|
|
+ // 4. 获取输入流
|
|
|
+ InputStream inputStream = connection.getInputStream();
|
|
|
+
|
|
|
+ // 5. 读取数据
|
|
|
+ BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream, "GBK"));
|
|
|
String line;
|
|
|
- while ((line = br.readLine()) != null) {
|
|
|
+ while ((line = reader.readLine()) != null) {
|
|
|
log.error(line);
|
|
|
//省市代码|账号|账薄号|货币码|交易日期|日志号|交易时间|户名|账薄名|交易类型|交
|
|
|
//易行号|传票号|发生额标识|现转标志|交易金额|账户余额|上笔余额|凭证种类|交易码|
|
|
|
@@ -423,8 +417,8 @@ public class DistributorSelfRechargeServiceImpl implements DistributorSelfRechar
|
|
|
DistributorSelfRechargeReqDTO reqDTO = new DistributorSelfRechargeReqDTO();
|
|
|
reqDTO.setOrderId(newRecharge.getId());
|
|
|
reqDTO.setPayOrderId(refNbr);
|
|
|
+ reqDTO.setDistributorId(distributor.getId());
|
|
|
reqDTO.setPayStatus(1);
|
|
|
-
|
|
|
try {
|
|
|
otaDistributorApi.distributorCMBRecharge(reqDTO).getCheckedData();
|
|
|
log.error("充值通知成功 | orderId:{}", newRecharge.getId());
|
|
|
@@ -434,9 +428,12 @@ public class DistributorSelfRechargeServiceImpl implements DistributorSelfRechar
|
|
|
} catch (NumberFormatException e) {
|
|
|
log.error("金额格式错误 | trsamt:{}", trsAmt, e);
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
|
|
|
+ // 6. 关闭资源
|
|
|
+ reader.close();
|
|
|
+ inputStream.close();
|
|
|
+
|
|
|
} catch (IOException e) {
|
|
|
e.printStackTrace();
|
|
|
}
|