This commit is contained in:
2023-10-26 16:54:50 +08:00
parent 10d5636c56
commit 1c252a2d34
6 changed files with 25 additions and 6 deletions

View File

@@ -3,6 +3,7 @@ package com.jsowell.service;
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONObject;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.PropertyNamingStrategies;
import com.github.pagehelper.PageHelper;
@@ -980,6 +981,7 @@ public class OrderService {
JSONObject jsonObject = JSON.parseObject(data);
ObjectMapper mapper = new ObjectMapper();
mapper.setPropertyNamingStrategy(PropertyNamingStrategies.SNAKE_CASE);
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
AdapayCallbackRecord adapayCallbackRecord = mapper.readValue(jsonObject.toJSONString(), AdapayCallbackRecord.class);
// 支付扩展域

View File

@@ -511,7 +511,11 @@ public class TempService {
List<String> paymentIdList = Lists.newArrayList();
BigDecimal total = BigDecimal.ZERO;
AdapayMemberAccount aDefault = adapayMemberAccountService.getDefault();
String wechatAppId = "wxbb3e0d474569481d";
for (AdaPayment adaPayment : adaPayments) {
String paymentId = adaPayment.getId();
String pay_mode = adaPayment.getPay_mode();
if (StringUtils.isBlank(pay_mode)) {
// 实时分账的不检查
@@ -524,6 +528,10 @@ public class TempService {
continue;
}
if (StringUtils.equals(paymentId, "002212023102509474610563069333816762368")) {
continue;
}
// 交易金额
BigDecimal payAmt = new BigDecimal(adaPayment.getPay_amt());
@@ -536,10 +544,12 @@ public class TempService {
BigDecimal subtract = payAmt.subtract(reservedAmt).subtract(confirmedAmt);
if (subtract.compareTo(BigDecimal.ZERO) > 0) {
paymentIdList.add(adaPayment.getId());
paymentIdList.add(paymentId);
total = total.add(subtract);
logger.info("支付单:{}, 支付金额:{}, 总撤销金额:{}, 总确认金额:{}, 剩余金额:{}",
adaPayment.getId(), payAmt, reservedAmt, confirmedAmt, subtract);
paymentId, payAmt, reservedAmt, confirmedAmt, subtract);
// adapayService.createPaymentConfirmRequest(paymentId, aDefault, subtract, null, wechatAppId);
}
}
logger.info("{} - {} 期间,共有{}笔支付单存在剩余金额, 共计:{}list:{}", dto.getStartTime(), dto.getEndTime(), paymentIdList.size(), total, JSON.toJSONString(paymentIdList));

View File

@@ -237,8 +237,8 @@ public class SpringBootTestController {
@Test
public void checkPaymentTest() {
QueryOrderDTO dto = new QueryOrderDTO();
String startTime = "2023-10-01 00:00:00";
String endTime = "2023-10-25 23:59:59";
String startTime = "2023-09-01 00:00:00";
String endTime = "2023-09-30 23:59:59";
dto.setStartTime(startTime);
dto.setEndTime(endTime);
@@ -1574,14 +1574,15 @@ public class SpringBootTestController {
@Test
public void testSaveCallback() throws JsonProcessingException {
String data = "{\"app_id\":\"app_d0c80cb1-ffc8-48cb-a030-fe9bec823aaa\",\"created_time\":\"20230530132956\",\"description\":\"{\\\"orderCode\\\":\\\"C29505932783\\\",\\\"type\\\":\\\"order\\\"}\",\"end_time\":\"20230530133027\",\"expend\":{\"bank_type\":\"OTHERS\",\"open_id\":\"o8jhot6PJF93EPhNISsXi28dKdS8\",\"sub_open_id\":\"o4REX5MprZfTaLnVNxfdOY-wnwGI\"},\"fee_amt\":\"0.11\",\"id\":\"002212023053013295610509491838664794112\",\"order_no\":\"C29505932783\",\"out_trans_id\":\"4200001855202305308670391485\",\"party_order_id\":\"02212305304859640306711\",\"pay_amt\":\"20.00\",\"pay_channel\":\"wx_lite\",\"real_amt\":\"20.00\",\"share_eq\":\"Y\",\"status\":\"succeeded\",\"wx_user_id\":\"\"}";
String data = "{\"app_id2\":\"app_d0c80cb1-ffc8-48cb-a030-fe9bec823aaa\",\"created_time\":\"20230530132956\",\"description\":\"{\\\"orderCode\\\":\\\"C29505932783\\\",\\\"type\\\":\\\"order\\\"}\",\"end_time\":\"20230530133027\",\"expend\":{\"bank_type\":\"OTHERS\",\"open_id\":\"o8jhot6PJF93EPhNISsXi28dKdS8\",\"sub_open_id\":\"o4REX5MprZfTaLnVNxfdOY-wnwGI\"},\"fee_amt\":\"0.11\",\"id\":\"002212023053013295610509491838664794112\",\"order_no\":\"C29505932783\",\"out_trans_id\":\"4200001855202305308670391485\",\"party_order_id\":\"02212305304859640306711\",\"pay_amt\":\"20.00\",\"pay_channel\":\"wx_lite\",\"real_amt\":\"20.00\",\"share_eq\":\"Y\",\"status\":\"succeeded\",\"wx_user_id\":\"\"}";
JSONObject jsonObject = JSON.parseObject(data);
ObjectMapper mapper = new ObjectMapper();
mapper.setPropertyNamingStrategy(PropertyNamingStrategies.SNAKE_CASE);
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
AdapayCallbackRecord adapayCallbackRecord = mapper.readValue(jsonObject.toJSONString(), AdapayCallbackRecord.class);
adapayCallbackRecord.setExpend(jsonObject.getString("expend"));
adapayCallbackRecord.setPaymentId(jsonObject.getString("id"));
adapayCallbackRecordService.saveAdapayCallbackRecord(adapayCallbackRecord);
// adapayCallbackRecordService.saveAdapayCallbackRecord(adapayCallbackRecord);
}