|
|
|
@ -37,20 +37,6 @@ public class DataEaseModel {
|
|
|
|
|
return Db.find(sql, identity_id);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取数据集对应的表
|
|
|
|
|
*
|
|
|
|
|
* @param dataset_id 数据集id
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
public List<Record> getDataSetTableContent(int dataset_id) {
|
|
|
|
|
Record record = getDataSetById(dataset_id);
|
|
|
|
|
if (record == null) return null;
|
|
|
|
|
String sql = "select * from `" + record.getStr("table_name") + "`";
|
|
|
|
|
List<Record> list = Db.use(DB_NAME).find(sql);
|
|
|
|
|
return list;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 保存数据集对应的表
|
|
|
|
@ -91,9 +77,8 @@ public class DataEaseModel {
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
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;
|
|
|
|
|
String sql = "select id,custom_attr from core_chart_view where scene_id=? and type like '%map%'";
|
|
|
|
|
return Db.use(DB_NAME).find(sql, bigScreenId);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -105,8 +90,7 @@ public class DataEaseModel {
|
|
|
|
|
public String getCityCode(String cityName) {
|
|
|
|
|
String full_name = getFullAreaName(cityName);
|
|
|
|
|
String sql = "select area_code from t_city_code where area_name=?";
|
|
|
|
|
String area_code=Db.findFirst(sql, full_name).getStr("area_code");
|
|
|
|
|
return area_code;
|
|
|
|
|
return Db.findFirst(sql, full_name).getStr("area_code");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -117,22 +101,29 @@ public class DataEaseModel {
|
|
|
|
|
*/
|
|
|
|
|
public void updateCity(String dataVisualizationName, String cityName) {
|
|
|
|
|
//取出大屏的ID值
|
|
|
|
|
String sql = "select * from dataease.data_visualization_info where name =?";
|
|
|
|
|
Record dataVisualizationInfo = Db.findFirst(sql, dataVisualizationName);
|
|
|
|
|
//云南省教育决策支持系统
|
|
|
|
|
String sql = "select * from data_visualization_info where name =?";
|
|
|
|
|
Record dataVisualizationInfo = Db.use(DB_NAME).findFirst(sql, dataVisualizationName);
|
|
|
|
|
long bigScreenId = dataVisualizationInfo.getLong("id");
|
|
|
|
|
// 配置的内容
|
|
|
|
|
List<Record> list = getMap(bigScreenId);
|
|
|
|
|
|
|
|
|
|
for (Record record : list) {
|
|
|
|
|
long id = record.getLong("id");
|
|
|
|
|
com.alibaba.fastjson.JSONObject jo = com.alibaba.fastjson.JSONObject.parseObject(record.getStr("custom_attr"));
|
|
|
|
|
JSONObject jo = JSONObject.fromObject(record.getStr("custom_attr"));
|
|
|
|
|
//获取城市编码
|
|
|
|
|
String area_code = getCityCode(cityName);
|
|
|
|
|
//修改前
|
|
|
|
|
System.out.println("修改前=" + jo.getJSONObject("map"));
|
|
|
|
|
|
|
|
|
|
//修改城市编码
|
|
|
|
|
jo.getJSONObject("map").put("id", area_code);
|
|
|
|
|
jo.getJSONObject("map").put("level", "city");
|
|
|
|
|
|
|
|
|
|
System.out.println("修改后=" + jo.getJSONObject("map"));
|
|
|
|
|
//写到数据库
|
|
|
|
|
String jsonString = jo.toJSONString();
|
|
|
|
|
Db.update("update dataease.core_chart_view set custom_attr=? where id=?", jsonString, id);
|
|
|
|
|
String jsonString = jo.toString();
|
|
|
|
|
Db.use(DB_NAME).update("update core_chart_view set custom_attr=? where id=?", jsonString, id);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|