|
|
@@ -1,13 +1,12 @@
|
|
|
package modules.tx.transfer;
|
|
|
|
|
|
-import com.alibaba.fastjson.JSONObject;
|
|
|
import com.jfinal.aop.Inject;
|
|
|
import com.jfinal.plugin.activerecord.Db;
|
|
|
import com.jfinal.plugin.activerecord.Model;
|
|
|
import com.jfinal.plugin.activerecord.Record;
|
|
|
-import common.model.HistoryTransfer;
|
|
|
import modules.address.AddressService;
|
|
|
import modules.address.factory.FactoryService;
|
|
|
+import modules.address.token.TokenService;
|
|
|
|
|
|
import java.util.Arrays;
|
|
|
import java.util.List;
|
|
|
@@ -16,9 +15,11 @@ public class TransferService {
|
|
|
@Inject
|
|
|
AddressService addressService;
|
|
|
@Inject
|
|
|
+ TokenService tokenService;
|
|
|
+ @Inject
|
|
|
FactoryService factoryService;
|
|
|
|
|
|
- static String[] QUERY_TABLE_PRIORITY = {"t_address", "t_v2_lp", "t_v3_lp", "t_bal_lp", "t_token"};
|
|
|
+ static String[] QUERY_TABLE_PRIORITY = {"t_address", "t_v2_lp", "t_v3_lp", "t_bal_lp"};
|
|
|
|
|
|
public boolean saveTransferList(List<? extends Model<?>> transferList) {
|
|
|
int totalSize = transferList.size();
|
|
|
@@ -39,6 +40,7 @@ public class TransferService {
|
|
|
}
|
|
|
|
|
|
public void putNameToTransferByKey(Record transfer, String key, int chainId, String hash) {
|
|
|
+ // 按优先级索引,QUERY_TABLE_PRIORITY
|
|
|
for (String tableName: QUERY_TABLE_PRIORITY) {
|
|
|
String nameValue = addressService.findNameByTableAndChainIdAndHash(tableName, chainId, hash);
|
|
|
if (nameValue != null) {
|
|
|
@@ -47,6 +49,14 @@ public class TransferService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ // 按优先级索引,搜索token的symbol
|
|
|
+ String tokenSymbol = tokenService.findSymbolByChainIdAndHash(chainId, hash);
|
|
|
+ if (tokenSymbol != null) {
|
|
|
+ transfer.put(key + "Symbol", tokenSymbol);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 最后查router的name
|
|
|
String nameValue = factoryService.findNameByChainIdAndRouter(chainId, hash);
|
|
|
if (nameValue != null) transfer.put(key + "Name", nameValue);
|
|
|
}
|