|
|
|
@ -3,12 +3,13 @@ package com.dsideal.base.Tools;
|
|
|
|
|
import com.dsideal.base.DataEase.Model.DataEaseModel;
|
|
|
|
|
import com.dsideal.base.Tools.Util.LocalMysqlConnectUtil;
|
|
|
|
|
import com.jcraft.jsch.JSchException;
|
|
|
|
|
import com.jfinal.kit.StrKit;
|
|
|
|
|
import com.jfinal.plugin.activerecord.Db;
|
|
|
|
|
import com.jfinal.plugin.activerecord.Record;
|
|
|
|
|
|
|
|
|
|
import java.io.IOException;
|
|
|
|
|
import java.util.HashMap;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
|
|
public class Step4_ChangUrlLink {
|
|
|
|
|
|
|
|
|
@ -17,22 +18,27 @@ public class Step4_ChangUrlLink {
|
|
|
|
|
public static void main(String[] args) throws IOException, JSchException {
|
|
|
|
|
LocalMysqlConnectUtil.Init();
|
|
|
|
|
//原地址
|
|
|
|
|
String sourceHost = "http://10.10.21.20:9000/dsBase/";
|
|
|
|
|
//目标地址
|
|
|
|
|
String targetHost = "https://www.edusoa.com/dsBase/";
|
|
|
|
|
Map<String, String> _map = new HashMap<>();
|
|
|
|
|
//路由地址替换
|
|
|
|
|
_map.put("http://10.10.21.20:9000/dsBase/", "https://www.edusoa.com/dsBase/");
|
|
|
|
|
//大屏发布地址替换
|
|
|
|
|
_map.put("http://10.10.14.203/", "https://www.edusoa.com/");
|
|
|
|
|
|
|
|
|
|
String sql = "select * from visualization_link_jump_info";
|
|
|
|
|
//select component_data from data_visualization_info where id=1036286881547030528
|
|
|
|
|
String sql = "select * from data_visualization_info";
|
|
|
|
|
List<Record> list = Db.use(DataEaseModel.DB_NAME).find(sql);
|
|
|
|
|
String prefix = "http://";
|
|
|
|
|
for (Record record : list) {
|
|
|
|
|
String content = record.getStr("content");
|
|
|
|
|
String content = record.getStr("component_data");
|
|
|
|
|
long id = record.getLong("id");
|
|
|
|
|
if (!StrKit.isBlank(content)
|
|
|
|
|
//只有http的不要
|
|
|
|
|
&& content.startsWith(prefix) && content.length() > prefix.length()) {
|
|
|
|
|
System.out.println(content);
|
|
|
|
|
sql="update visualization_link_jump_info set content=? where id=?";
|
|
|
|
|
Db.use(DataEaseModel.DB_NAME).update(sql, content.replace(sourceHost, targetHost), id);
|
|
|
|
|
//遍历Map<String,String> _map
|
|
|
|
|
for (Map.Entry<String, String> entry : _map.entrySet()) {
|
|
|
|
|
String sourceHost = entry.getKey();
|
|
|
|
|
String targetHost = entry.getValue();
|
|
|
|
|
if (content.contains(sourceHost)) {
|
|
|
|
|
sql = "update data_visualization_info set content=? where id=?";
|
|
|
|
|
Db.use(DataEaseModel.DB_NAME).update(sql, content.replace(sourceHost, targetHost), id);
|
|
|
|
|
System.out.println("id=" + id + " 替换完成,替换内容:" + sourceHost + "->" + targetHost);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|