|
|
|
@ -0,0 +1,70 @@
|
|
|
|
|
package com.dsideal.base.Tools;
|
|
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
|
import com.dsideal.base.DataEase.Model.DataEaseModel;
|
|
|
|
|
import com.dsideal.base.Plugin.YamlProp;
|
|
|
|
|
import com.jfinal.kit.Kv;
|
|
|
|
|
import com.jfinal.kit.Prop;
|
|
|
|
|
import com.jfinal.plugin.activerecord.ActiveRecordPlugin;
|
|
|
|
|
import com.jfinal.plugin.activerecord.Db;
|
|
|
|
|
import com.jfinal.plugin.activerecord.Record;
|
|
|
|
|
import com.jfinal.plugin.activerecord.SqlPara;
|
|
|
|
|
import com.jfinal.plugin.activerecord.dialect.MysqlDialect;
|
|
|
|
|
import com.jfinal.plugin.hikaricp.HikariCpPlugin;
|
|
|
|
|
|
|
|
|
|
import java.io.File;
|
|
|
|
|
import java.sql.SQLOutput;
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
public class ChangeCity {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static void main(String[] args) {
|
|
|
|
|
//加载配置文件
|
|
|
|
|
String configFile = "application_dev.yaml";
|
|
|
|
|
Prop PropKit = new YamlProp(configFile);
|
|
|
|
|
|
|
|
|
|
HikariCpPlugin dataEasePlugin = new HikariCpPlugin(PropKit.get("mysql.jdbcUrl").replace("ds_db", DataEaseModel.DB_NAME), PropKit.get("mysql.user"),
|
|
|
|
|
PropKit.get("mysql.password").trim(), PropKit.get("mysql.driverClassName"));
|
|
|
|
|
dataEasePlugin.start();
|
|
|
|
|
|
|
|
|
|
// 配置ActiveRecord插件
|
|
|
|
|
ActiveRecordPlugin arpDataEase = new ActiveRecordPlugin(DataEaseModel.DB_NAME, dataEasePlugin);
|
|
|
|
|
arpDataEase.setDialect(new MysqlDialect());
|
|
|
|
|
|
|
|
|
|
arpDataEase.start();
|
|
|
|
|
//取出大屏的ID值
|
|
|
|
|
String sql = "select * from data_visualization_info where name ='黄海测试的市州地图'";
|
|
|
|
|
Record dataVisualizationInfo = Db.findFirst(sql);
|
|
|
|
|
long bigScreenId = dataVisualizationInfo.getLong("id");
|
|
|
|
|
System.out.println(bigScreenId);
|
|
|
|
|
// 配置的内容
|
|
|
|
|
sql = "select id,custom_attr from core_chart_view where scene_id=? and type='map'";
|
|
|
|
|
Record record = Db.findFirst(sql, bigScreenId);
|
|
|
|
|
long id = record.getLong("id");
|
|
|
|
|
JSONObject jo = JSONObject.parseObject(record.getStr("custom_attr"));
|
|
|
|
|
System.out.println(jo.getJSONObject("map").getString("level"));
|
|
|
|
|
System.out.println(jo.getJSONObject("map").getString("id"));
|
|
|
|
|
/**
|
|
|
|
|
* json格式化工具
|
|
|
|
|
* https://www.uutils.com/format/json.htm
|
|
|
|
|
*
|
|
|
|
|
* 互联网:2023年,省市县行政区划名称及编码对照表、最新省市区表1
|
|
|
|
|
* https://blog.csdn.net/isworking/article/details/128630487
|
|
|
|
|
吉林省
|
|
|
|
|
province 156220000
|
|
|
|
|
|
|
|
|
|
云南省
|
|
|
|
|
province 156530000
|
|
|
|
|
*/
|
|
|
|
|
//修改为云南省
|
|
|
|
|
//jo.getJSONObject("map").put("id", "156530000");
|
|
|
|
|
//修改为吉林省
|
|
|
|
|
jo.getJSONObject("map").put("id", "156220000");
|
|
|
|
|
//回写到数据库
|
|
|
|
|
String jsonString = jo.toJSONString();
|
|
|
|
|
Db.update("update core_chart_view set custom_attr=? where id=?", jsonString, id);
|
|
|
|
|
System.out.println("成功切换为!");
|
|
|
|
|
}
|
|
|
|
|
}
|