main
黄海 9 months ago
parent 85c0f43f88
commit 3717eeb024

@ -42,17 +42,17 @@ public class DataEaseController extends Controller {
*
* @param city_name
*/
@Before({GET.class})
@EmptyInterface({"city_name"})
public void route(String city_name) {
if(city_name.equals("昆明市")){
dm.updateCity("156530100");
redirect301("http://10.10.14.203:8100/#/de-link/zud8IQ8J?attachParams=eyJjaXR5X25hbWUiOiLmmIbmmI7luIIifQ==");
}else{
dm.updateCity("156532300");
redirect301("http://10.10.14.203:8100/#/de-link/zud8IQ8J?attachParams=eyJjaXR5X25hbWUiOiLmpZrpm4TlvZ3ml4/oh6rmsrvlt54ifQ==");
}
}
// @Before({GET.class})
// @EmptyInterface({"city_name"})
// public void route(String city_name) {
// if(city_name.equals("昆明市")){
// dm.updateCity("156530100");
// redirect301("http://10.10.14.203:8100/#/de-link/zud8IQ8J?attachParams=eyJjaXR5X25hbWUiOiLmmIbmmI7luIIifQ==");
// }else{
// dm.updateCity("156532300");
// redirect301("http://10.10.14.203:8100/#/de-link/zud8IQ8J?attachParams=eyJjaXR5X25hbWUiOiLmpZrpm4TlvZ3ml4/oh6rmsrvlt54ifQ==");
// }
// }
/**
* identity_id,
*/

@ -56,8 +56,6 @@ public class DataEaseModel {
* @param ja json
*/
public void saveDataSetTable(int identity_id, int dataset_id, String xmqh, JSONArray ja) {
System.out.println(ja);
String tableName = getTableName(dataset_id).getStr("table_name");
if (identity_id > 1) {
String sql = "delete from dataease.`" + tableName + "` where `行政区划`=?";
@ -82,36 +80,55 @@ public class DataEaseModel {
Db.use("dataease").batchSave(tableName, list, 100);
}
/**
* DataEase
*
*
* @param xzqhId ID
* @param bigScreenId ID
* @return
*/
public void updateCity(String xzqhId) {
public List<Record> getMap(long bigScreenId) {
String sql = "select id,custom_attr from dataease.core_chart_view where scene_id=? and type='map'";
List<Record> list = Db.find(sql, bigScreenId);
return list;
}
/**
*
*
* @param cityName
* @return
*/
public String getCityCode(String cityName) {
String sql = "select area_code from t_city_code where area_name=?";
return Db.findFirst(sql, cityName).getStr("area_code");
}
/**
*
*
* @param dataVisualizationName
* @param cityName
*/
public void updateCity(String dataVisualizationName, String cityName) {
//取出大屏的ID值
String sql = "select * from dataease.data_visualization_info where name ='黄海测试的市州地图'";
Record dataVisualizationInfo = Db.findFirst(sql);
String sql = "select * from dataease.data_visualization_info where name =?";
Record dataVisualizationInfo = Db.findFirst(sql, dataVisualizationName);
long bigScreenId = dataVisualizationInfo.getLong("id");
// 配置的内容
sql = "select id,custom_attr from dataease.core_chart_view where scene_id=? and type='map'";
List<Record> list = Db.find(sql, bigScreenId);
List<Record> list = getMap(bigScreenId);
for (Record record : list) {
long id = record.getLong("id");
JSONObject jo = JSONObject.fromObject(record.getStr("custom_attr"));
jo.getJSONObject("map").put("id", xzqhId);
System.out.println(jo.getJSONObject("map"));
//回写到数据库
String jsonString = jo.toString();
com.alibaba.fastjson.JSONObject jo = com.alibaba.fastjson.JSONObject.parseObject(record.getStr("custom_attr"));
//获取城市编码
String area_code = getCityCode(cityName);
//修改城市编码
jo.getJSONObject("map").put("id", area_code);
jo.getJSONObject("map").put("level", "city");
//写到数据库
String jsonString = jo.toJSONString();
Db.update("update dataease.core_chart_view set custom_attr=? where id=?", jsonString, id);
}
/**
* json
* https://www.uutils.com/format/json.htm
*
* 20231
* https://blog.csdn.net/isworking/article/details/128630487
*/
}
}

@ -1,69 +1,14 @@
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.Prop;
import com.jfinal.plugin.activerecord.ActiveRecordPlugin;
import com.jfinal.plugin.activerecord.Db;
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 {
/**
*
*
* @param bigScreenId ID
* @return
*/
public static List<Record> getMap(long bigScreenId) {
String sql = "select id,custom_attr from dataease.core_chart_view where scene_id=? and type='map'";
List<Record> list = Db.find(sql, bigScreenId);
return list;
}
/**
*
*
* @param cityName
* @return
*/
public static String getCityCode(String cityName) {
String sql = "select area_code from t_city_code where area_name=?";
return Db.findFirst(sql, cityName).getStr("area_code");
}
/**
*
*
* @param dataVisualizationName
* @param cityName
*/
public static void updateCity(String dataVisualizationName, String cityName) {
//取出大屏的ID值
String sql = "select * from dataease.data_visualization_info where name =?";
Record dataVisualizationInfo = Db.findFirst(sql, dataVisualizationName);
long bigScreenId = dataVisualizationInfo.getLong("id");
// 配置的内容
List<Record> list = getMap(bigScreenId);
for (Record record : list) {
long id = record.getLong("id");
JSONObject jo = JSONObject.parseObject(record.getStr("custom_attr"));
//获取城市编码
String area_code = getCityCode(cityName);
//修改城市编码
jo.getJSONObject("map").put("id", area_code);
jo.getJSONObject("map").put("level", "city");
//写到数据库
String jsonString = jo.toJSONString();
Db.update("update dataease.core_chart_view set custom_attr=? where id=?", jsonString, id);
}
}
/**
*
* http://10.10.14.203:8100/#/de-link/zud8IQ8J
@ -88,7 +33,8 @@ public class ChangeDataEaseCity {
//要修改的大屏中文名称
String dataVisualizationName = "黄海测试的市州地图";
String cityName = "昭通市";
updateCity(dataVisualizationName, cityName);
DataEaseModel dm = new DataEaseModel();
dm.updateCity(dataVisualizationName, cityName);
/*
156530100

Loading…
Cancel
Save