|
|
|
@ -109,7 +109,7 @@ public class BankServiceImpl implements BankService { |
|
|
|
BankVO bankVO = new BankVO(); |
|
|
|
List<PaymentDTO> paymentDTOList; |
|
|
|
try { |
|
|
|
paymentDTOList = transactions.toJavaList(PaymentDTO.class); |
|
|
|
paymentDTOList = transactions.toJavaList(PaymentDTO.class); |
|
|
|
} catch (Exception e) { |
|
|
|
log.error("解析JSON响应时发生错误: {}", e.getMessage(), e); |
|
|
|
return Result.error("payment当天无数据请切换日期"); |
|
|
|
@ -271,7 +271,7 @@ public class BankServiceImpl implements BankService { |
|
|
|
try { |
|
|
|
// 设置Stripe API密钥 |
|
|
|
Stripe.apiKey = "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"; |
|
|
|
if(bankDTO.getSum() <= 0){ |
|
|
|
if (bankDTO.getSum() <= 0) { |
|
|
|
return Result.error("最大条数不能小于等于0"); |
|
|
|
} |
|
|
|
// 收集处理信息 |
|
|
|
@ -401,7 +401,7 @@ public class BankServiceImpl implements BankService { |
|
|
|
// 方式一:通过订单号查找最近数据 |
|
|
|
String orderNo = bankDTO.getOrderNo(); |
|
|
|
|
|
|
|
if(bankDTO.getSum() <= 0){ |
|
|
|
if (bankDTO.getSum() <= 0) { |
|
|
|
return Result.error("最大条数不能小于等于0"); |
|
|
|
} |
|
|
|
|
|
|
|
@ -505,7 +505,7 @@ public class BankServiceImpl implements BankService { |
|
|
|
bankVO.setStripeDTO(stripeDTO); |
|
|
|
CashCollection cashCollection = cashCollectionMapper.selectByGoldCoinOrderCode(orderNo); |
|
|
|
if (cashCollection == null) { |
|
|
|
return Result.error("金币系统当前日期 " + " 该订单号 " + orderNo + " 未查到"); |
|
|
|
return Result.error("金币系统当前日期 " + " 该订单号 " + orderNo + " 未查到"); |
|
|
|
} else { |
|
|
|
cashCollectionMapper.updateByGoldCoinOrderCodeByStripe(bankVO.getStripeDTO()); |
|
|
|
} |
|
|
|
@ -516,19 +516,37 @@ public class BankServiceImpl implements BankService { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//firstdata银行接口(批量) |
|
|
|
@Override |
|
|
|
public Result firstdataAuto(BankDTO bankDTO) { |
|
|
|
return null; |
|
|
|
//firstdata银行接口(批量) |
|
|
|
@Override |
|
|
|
public Result firstdataAuto(BankDTO bankDTO) { |
|
|
|
// 获取需要处理的订单号列表 |
|
|
|
List<String> orderNoList = cashCollectionMapper.selectFirstdataList(); |
|
|
|
|
|
|
|
// 存储处理结果的列表 |
|
|
|
List<Result> results = new ArrayList<>(); |
|
|
|
|
|
|
|
// 对每个订单执行getFirstdata方法 |
|
|
|
for (String orderNo : orderNoList) { |
|
|
|
// 创建一个新的BankDTO实例,设置订单号 |
|
|
|
BankDTO dto = new BankDTO(); |
|
|
|
dto.setOrderNo(orderNo); |
|
|
|
|
|
|
|
// 调用getFirstdata方法处理单个订单 |
|
|
|
Result result = getFirstdata(dto); |
|
|
|
results.add(result); |
|
|
|
} |
|
|
|
|
|
|
|
// 返回处理结果列表 |
|
|
|
return Result.success(results); |
|
|
|
} |
|
|
|
|
|
|
|
//firstdata银行接口(单个) |
|
|
|
@Override |
|
|
|
public Result getFirstdata(BankDTO bankDTO) { |
|
|
|
try { |
|
|
|
CashCollection cashCollection = cashCollectionMapper.selectByBankCode(bankDTO.getOrderNo()); |
|
|
|
if (cashCollection == null) { |
|
|
|
return Result.error("金币系统当前日期 " + " 该银行订单号 " + bankDTO.getOrderNo() + " 未查到"); |
|
|
|
return Result.error("金币系统当前日期 " + " 该银行订单号 " + bankDTO.getOrderNo() + " 未查到"); |
|
|
|
} |
|
|
|
// 获取签名参数 |
|
|
|
FirstdataRequestDTO firstdataRequestDTO = generatePaymentAsiaSignature(); |
|
|
|
@ -585,7 +603,7 @@ public class BankServiceImpl implements BankService { |
|
|
|
firstdataDTO.setTotal(total); |
|
|
|
|
|
|
|
// 根据要求设置amount为永久金币×100 |
|
|
|
Integer amount = cashCollection.getPermanentGold() ; |
|
|
|
Integer amount = cashCollection.getPermanentGold(); |
|
|
|
firstdataDTO.setAmount(amount); |
|
|
|
|
|
|
|
// 根据国家计算fee |
|
|
|
@ -655,6 +673,7 @@ public class BankServiceImpl implements BankService { |
|
|
|
|
|
|
|
/** |
|
|
|
* 生成PaymentAsia API所需的签名 |
|
|
|
* |
|
|
|
* @return 签名字符串 |
|
|
|
*/ |
|
|
|
public FirstdataRequestDTO generatePaymentAsiaSignature() { |
|
|
|
|