Browse Source

12月10日银行

sunjiabei/feature-20251202094523-银行接口同步
sunjiabei 1 month ago
parent
commit
dc6f0757d7
  1. 39
      src/main/java/com/example/demo/serviceImpl/cash/BankServiceImpl.java
  2. 4
      src/main/resources/cashMapper/CashCollectionMapper.xml

39
src/main/java/com/example/demo/serviceImpl/cash/BankServiceImpl.java

@ -160,8 +160,6 @@ public class BankServiceImpl implements BankService {
}
}
//payment银行接口(批量)
@Override
public Result paymentAuto(BankDTO bankDTO) {
try {
// 1. 准备参数
@ -203,6 +201,12 @@ public class BankServiceImpl implements BankService {
JSONObject jsonObject = JSON.parseObject(responseBody);
JSONArray transactions = jsonObject.getJSONObject("payload").getJSONArray("transactions");
// 添加非空校验
if (transactions == null || transactions.isEmpty()) {
log.warn("transactions为空或无数据");
return Result.error("payment当天无数据请切换日期");
}
// 创建BankVO并设置paymentDTOList
BankVO bankVO = new BankVO();
List<PaymentDTO> paymentDTOList;
@ -233,7 +237,7 @@ public class BankServiceImpl implements BankService {
// 获取订单号
String orderNo = paymentDTO.getMerchant_reference();
List<String> orderNoList = cashCollectionMapper.selectStripeList();
List<String> orderNoList = cashCollectionMapper.selectPaymentList();
// 检查当前订单号是否在列表中
if (orderNoList.contains(orderNo)) {
cashCollectionMapper.updateByGoldCoinOrderCodeByPayment(paymentDTO);
@ -266,6 +270,7 @@ public class BankServiceImpl implements BankService {
}
}
//stripe银行接口(批量)
@Override
public Result stripeAuto(BankDTO bankDTO) {
@ -718,7 +723,7 @@ public class BankServiceImpl implements BankService {
}
// 银行自动处理接口(每天早上6点执行)
@Scheduled(cron = "0 53 10 * * ?")
@Scheduled(cron = "0 0 6 * * ?")
@Override
public Result bankAuto() {
try {
@ -742,14 +747,26 @@ public class BankServiceImpl implements BankService {
String todayStr = today.format(formatter);
// 创建BankDTO实例并设置时间
BankDTO dto = new BankDTO();
dto.setStartTime(fiveDayAgoStr);
dto.setEndTime(todayStr);
dto.setTime(sixDayAgoStr);
dto.setSum(1000);
// 依次调用各个自动处理方法
Result paymentResult = paymentAuto(dto);
dto.setTime(oneDayAgoStr);
Result paymentOneDayResult = paymentAuto(dto);
dto.setTime(twoDayAgoStr);
Result paymentTwoDayResult = paymentAuto(dto);
dto.setTime(threeDayAgoStr);
Result paymentThreeDayResult = paymentAuto(dto);
dto.setTime(fourDayAgoStr);
Result paymentFourDayResult = paymentAuto(dto);
dto.setTime(fiveDayAgoStr);
Result paymentFiveDayResult = paymentAuto(dto);
dto.setTime(sixDayAgoStr);
Result paymentSixDayResult = paymentAuto(dto);
dto.setTime(sevenDayAgoStr);
Result paymentSevenDayResult = paymentAuto(dto);
Result stripeResult = stripeAuto(dto);
Result firstdataResult = firstdataAuto(dto);
Result ipayResult = ipayAuto(dto);
@ -759,7 +776,13 @@ public class BankServiceImpl implements BankService {
List<String> messages = new ArrayList<>();
// 收集各方法的处理结果信息
messages.add("Payment Auto Result: " + (paymentResult != null ? paymentResult.toString() : "null"));
messages.add("Payment One Day Auto Result: " + (paymentOneDayResult != null ? paymentOneDayResult.toString() : "null"));
messages.add("Payment Two Day Auto Result: " + (paymentTwoDayResult != null ? paymentTwoDayResult.toString() : "null"));
messages.add("Payment Three Day Auto Result: " + (paymentThreeDayResult != null ? paymentThreeDayResult.toString() : "null"));
messages.add("Payment Four Day Auto Result: " + (paymentFourDayResult != null ? paymentFourDayResult.toString() : "null"));
messages.add("Payment Five Day Auto Result: " + (paymentFiveDayResult != null ? paymentFiveDayResult.toString() : "null"));
messages.add("Payment Six Day Auto Result: " + (paymentSixDayResult != null ? paymentSixDayResult.toString() : "null"));
messages.add("Payment Seven Day Auto Result: " + (paymentSevenDayResult != null ? paymentSevenDayResult.toString() : "null"));
messages.add("Stripe Auto Result: " + (stripeResult != null ? stripeResult.toString() : "null"));
messages.add("Firstdata Auto Result: " + (firstdataResult != null ? firstdataResult.toString() : "null"));
messages.add("Ipay Auto Result: " + (ipayResult != null ? ipayResult.toString() : "null"));

4
src/main/resources/cashMapper/CashCollectionMapper.xml

@ -309,13 +309,13 @@
select * from cash_record_collection where bank_code=#{bankCode}
</select>
<select id="selectFirstdataList" resultType="java.lang.String">
select order_code from cash_record_collection where bank_code is not null and payload='FirstData' and order_no_status=1
select bank_code from cash_record_collection where bank_code is not null and payload='FirstData' and order_no_status=1
</select>
<select id="selectStripeList" resultType="java.lang.String">
select order_code from cash_record_collection where payload='Stripe' and order_no_status=1
</select>
<select id="selectPaymentList" resultType="java.lang.String">
select bank_code from cash_record_collection where payload='PaymentAsia' and order_no_status=1
select order_code from cash_record_collection where payload='PaymentAsia' and order_no_status=1
</select>
<select id="selectIpayList" resultType="com.example.demo.domain.vo.cash.CashCollection">
select order_code,permanent_gold from cash_record_collection where payload='Ipay88' and order_no_status=1

Loading…
Cancel
Save