|
|
|
@ -10,6 +10,8 @@ import com.jfinal.plugin.activerecord.Record;
|
|
|
|
|
import com.jfinal.plugin.activerecord.dialect.MysqlDialect;
|
|
|
|
|
import com.jfinal.plugin.hikaricp.HikariCpPlugin;
|
|
|
|
|
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
public class ChangeDataEaseCity {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -34,30 +36,39 @@ public class ChangeDataEaseCity {
|
|
|
|
|
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"));
|
|
|
|
|
List<Record> list = Db.find(sql, bigScreenId);
|
|
|
|
|
|
|
|
|
|
for (Record record : list) {
|
|
|
|
|
long id = record.getLong("id");
|
|
|
|
|
com.alibaba.fastjson2.JSONObject jo = com.alibaba.fastjson2.JSONObject.parseObject(record.getStr("custom_attr"));
|
|
|
|
|
System.out.println(jo.getJSONObject("map").getString("level"));
|
|
|
|
|
System.out.println(jo.getJSONObject("map").getString("id"));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (jo.getJSONObject("map").getString("id").equals("156530100")) {
|
|
|
|
|
//修改为楚雄
|
|
|
|
|
jo.getJSONObject("map").put("id", "156532300");
|
|
|
|
|
jo.getJSONObject("map").put("level", "city");
|
|
|
|
|
} else {
|
|
|
|
|
//修改为昆明
|
|
|
|
|
jo.getJSONObject("map").put("id", "156530100");
|
|
|
|
|
jo.getJSONObject("map").put("level", "city");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//回写到数据库
|
|
|
|
|
String jsonString = jo.toJSONString();
|
|
|
|
|
Db.update("update core_chart_view set custom_attr=? where id=?", jsonString, id);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* json格式化工具
|
|
|
|
|
* https://www.uutils.com/format/json.htm
|
|
|
|
|
*
|
|
|
|
|
* 互联网:2023年,省市县行政区划名称及编码对照表、最新省市区表1
|
|
|
|
|
* https://blog.csdn.net/isworking/article/details/128630487
|
|
|
|
|
吉林省
|
|
|
|
|
province 156220000
|
|
|
|
|
|
|
|
|
|
云南省
|
|
|
|
|
province 156530000
|
|
|
|
|
220000000000
|
|
|
|
|
*/
|
|
|
|
|
//修改为云南省
|
|
|
|
|
//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("成功切换!");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|