添加日志

This commit is contained in:
lu7213 committed 2026-10-28 10:16:55 -04:00
1 parent 28d0517294
commit 1e79e836e8
1 file changed
+17 -9
@@ -1,24 +1,25 @@
package com.ruoyi.system.rental;
import static com.ruoyi.system.rental.RentalValues.*;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.extern.slf4j.Slf4j;
import okhttp3.*;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.tron.trident.core.ApiWrapper;
import java.math.BigDecimal;
import java.util.*;
import java.util.Locale;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import static com.ruoyi.system.rental.RentalValues.*;
/**
* 云端只读链上适配器,不持有私钥且不调用广播接口。 普通TRON RPC不提供任意历史资源状态;确认区块资源证明必须来自配置的受信历史节点。
* 缺少历史证据时保留真实交易与资金占位,禁止用当前参数冒充历史交付成功。
*/
@Slf4j
@Service
public class RentalChain {
@Value("${rental.rpc.nile:https://nile.trongrid.io}")
@@ -84,7 +85,8 @@ public class RentalChain {
(fullBlock ? 16 : 1) * 1024 * 1024));
}
} catch (Exception ex) {
throw new IllegalStateException("链上查询失败,保留原业务状态");
log.error(ex.getMessage(), ex);
throw new IllegalStateException("链上查询失败,保留原业务状态 " + base + path);
}
}
@@ -177,14 +179,18 @@ public class RentalChain {
return total;
}
/** 内置历史模式在派单前建立确认关系基线,RPC失败时继续等待派单,不先广播再补基线。 */
/**
* 内置历史模式在派单前建立确认关系基线,RPC失败时继续等待派单,不先广播再补基线。
*/
public void prepareHistory(String network, String owner, String receiver, String resource) {
if (embeddedHistory) {
historyService.getObject().anchor(network, owner, receiver, resource);
}
}
/** 返回CONFIRMED仅代表交易真实成功;历史资源证据不足时delivery_proven=false。 */
/**
* 返回CONFIRMED仅代表交易真实成功;历史资源证据不足时delivery_proven=false。
*/
public Map<String, Object> verify(
Map<String, Object> task, String txId, String owner, String receiver) {
require(txId.matches("[0-9a-fA-F]{64}"), "交易哈希无效");
@@ -292,7 +298,9 @@ public class RentalChain {
return ApiWrapper.toHex(ApiWrapper.parseAddress(address));
}
/** 人工充值/付款依据必须由配置网络的USDT Transfer日志独立核对。 */
/**
* 人工充值/付款依据必须由配置网络的USDT Transfer日志独立核对。
*/
public Map<String, Object> transfer(
String network, String txId, int index, String to, BigDecimal expected) {
network(network);