|
|
@ -6,11 +6,15 @@ import com.dsideal.base.DataEase.Model.DataEaseModel;
|
|
|
|
import com.dsideal.base.Tools.Util.LocalMysqlConnectUtil;
|
|
|
|
import com.dsideal.base.Tools.Util.LocalMysqlConnectUtil;
|
|
|
|
import com.dsideal.base.Util.CommonUtil;
|
|
|
|
import com.dsideal.base.Util.CommonUtil;
|
|
|
|
import com.dsideal.base.Util.FileUtil;
|
|
|
|
import com.dsideal.base.Util.FileUtil;
|
|
|
|
|
|
|
|
import com.jfinal.kit.Kv;
|
|
|
|
import com.jfinal.kit.PathKit;
|
|
|
|
import com.jfinal.kit.PathKit;
|
|
|
|
import com.jfinal.plugin.activerecord.Db;
|
|
|
|
import com.jfinal.plugin.activerecord.Db;
|
|
|
|
import com.jfinal.plugin.activerecord.Record;
|
|
|
|
import com.jfinal.plugin.activerecord.Record;
|
|
|
|
|
|
|
|
import com.jfinal.plugin.activerecord.SqlPara;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import java.util.HashMap;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
|
|
|
|
import static com.dsideal.base.DataEase.Model.DataEaseModel.DB_NAME;
|
|
|
|
import static com.dsideal.base.DataEase.Model.DataEaseModel.DB_NAME;
|
|
|
|
import static com.dsideal.base.DataEase.Util.Step3_CopyBigScreen.*;
|
|
|
|
import static com.dsideal.base.DataEase.Util.Step3_CopyBigScreen.*;
|
|
|
@ -22,8 +26,6 @@ public class Step2_CopyFilter {
|
|
|
|
public static DataEaseModel dm = new DataEaseModel();
|
|
|
|
public static DataEaseModel dm = new DataEaseModel();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 清理指定名称指定大屏
|
|
|
|
* 清理指定名称指定大屏
|
|
|
|
*
|
|
|
|
*
|
|
|
@ -62,6 +64,23 @@ public class Step2_CopyFilter {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 获取指定大屏中每个图表对应的数据集中,行政区划对应的字段ID
|
|
|
|
|
|
|
|
*
|
|
|
|
|
|
|
|
* @param scene_id
|
|
|
|
|
|
|
|
* @return
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
public static Map<Long, Long> queryChartViewFilterFieldId(long scene_id) {
|
|
|
|
|
|
|
|
Map<Long, Long> map = new HashMap<>();
|
|
|
|
|
|
|
|
Kv kv = Kv.by("scene_id", scene_id);
|
|
|
|
|
|
|
|
SqlPara sqlPara = Db.getSqlPara("DataEase.queryChartViewFilterFieldId", kv);
|
|
|
|
|
|
|
|
List<Record> list = Db.use(DB_NAME).find(sqlPara);
|
|
|
|
|
|
|
|
for (Record record : list) {
|
|
|
|
|
|
|
|
map.put(record.getLong("id"), record.getLong("table_field_id"));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return map;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 拷贝城市大屏
|
|
|
|
* 拷贝城市大屏
|
|
|
|
*
|
|
|
|
*
|
|
|
@ -82,6 +101,9 @@ public class Step2_CopyFilter {
|
|
|
|
String screenName = LocalMysqlConnectUtil.PropKit.get("dataEase.dataVisualizationNameCity");//要拷贝出来的屏幕名称
|
|
|
|
String screenName = LocalMysqlConnectUtil.PropKit.get("dataEase.dataVisualizationNameCity");//要拷贝出来的屏幕名称
|
|
|
|
long childId = callApiToCopy(screenName, motherId, pid);
|
|
|
|
long childId = callApiToCopy(screenName, motherId, pid);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//只有一个复制的大屏,当然只有一个字段map,如果是16个的话,就需要放到循环里面进行获取map
|
|
|
|
|
|
|
|
Map<Long, Long> mapField = queryChartViewFilterFieldId(childId);
|
|
|
|
|
|
|
|
|
|
|
|
// 修改地图中城市
|
|
|
|
// 修改地图中城市
|
|
|
|
List<Record> listMap = dm.getMap(childId);
|
|
|
|
List<Record> listMap = dm.getMap(childId);
|
|
|
|
//获取城市编码
|
|
|
|
//获取城市编码
|
|
|
@ -103,13 +125,17 @@ public class Step2_CopyFilter {
|
|
|
|
String custom_filter_json = cn.hutool.core.io.FileUtil.readUtf8String(PathKit.getRootClassPath() + "/Data/filter.json");
|
|
|
|
String custom_filter_json = cn.hutool.core.io.FileUtil.readUtf8String(PathKit.getRootClassPath() + "/Data/filter.json");
|
|
|
|
for (Record record : list) {
|
|
|
|
for (Record record : list) {
|
|
|
|
long id = record.getLong("id");
|
|
|
|
long id = record.getLong("id");
|
|
|
|
|
|
|
|
long fieldId = mapField.get(id);
|
|
|
|
String custom_filter = record.getStr("custom_filter");
|
|
|
|
String custom_filter = record.getStr("custom_filter");
|
|
|
|
JSONObject jo = JSONObject.parseObject(custom_filter);
|
|
|
|
JSONObject jo = JSONObject.parseObject(custom_filter);
|
|
|
|
jo.put("logic","and");
|
|
|
|
jo.put("logic", "and");
|
|
|
|
if (jo.getJSONArray("items") == null) {
|
|
|
|
if (jo.getJSONArray("items") == null) {
|
|
|
|
jo=JSONObject.parseObject(custom_filter_json);
|
|
|
|
jo = JSONObject.parseObject(custom_filter_json);
|
|
|
|
|
|
|
|
jo.getJSONArray("items").getJSONObject(0).put("fieldId", fieldId);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
jo.getJSONArray("items").add(JSONObject.parseObject(custom_filter_json).getJSONArray("items").getJSONObject(0));
|
|
|
|
JSONObject newJo = JSONObject.parseObject(custom_filter_json).getJSONArray("items").getJSONObject(0);
|
|
|
|
|
|
|
|
newJo.put("fieldId", fieldId);
|
|
|
|
|
|
|
|
jo.getJSONArray("items").add(newJo);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
sql = "update core_chart_view set custom_filter=? where id=?";
|
|
|
|
sql = "update core_chart_view set custom_filter=? where id=?";
|
|
|
|
Db.use(DB_NAME).update(sql, jo.toString(), id);
|
|
|
|
Db.use(DB_NAME).update(sql, jo.toString(), id);
|
|
|
@ -123,7 +149,6 @@ public class Step2_CopyFilter {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static void main(String[] args) throws InterruptedException {
|
|
|
|
public static void main(String[] args) throws InterruptedException {
|
|
|
|
//连接本地数据库系统
|
|
|
|
//连接本地数据库系统
|
|
|
|
LocalMysqlConnectUtil.Init();
|
|
|
|
LocalMysqlConnectUtil.Init();
|
|
|
|