diff --git a/src/main/java/com/dsideal/base/DataEase/Util/CopyOuterParamsScreenToFilterScreen.java b/src/main/java/com/dsideal/base/DataEase/Util/CopyOuterParamsScreenToFilterScreen.java index ecf12b5e..8275ff58 100644 --- a/src/main/java/com/dsideal/base/DataEase/Util/CopyOuterParamsScreenToFilterScreen.java +++ b/src/main/java/com/dsideal/base/DataEase/Util/CopyOuterParamsScreenToFilterScreen.java @@ -36,14 +36,13 @@ public class CopyOuterParamsScreenToFilterScreen { /** - * 清理指定名称大屏的所有副本,为了再次生成不重复 + * 清理指定名称指定大屏 * * @param bigScreenName 大屏名称 */ - public static void clearScreen(String bigScreenName) { + public static void clearSingleScreen(String bigScreenName) { //一、先删除后插入保持健康 - // 保留:【云南省教育决策支持系统【市州拷贝】】,删除掉云南省教育决策支持系统【市州拷贝】+昆明市,云南省教育决策支持系统【市州】+楚雄州等数据 - String sql = "select * from data_visualization_info where name like '%" + bigScreenName + "%' and name <>'" + bigScreenName + "'"; + String sql = "select * from data_visualization_info where name ='" + bigScreenName + "'"; List toDelList = Db.use(DB_NAME).find(sql); for (Record record : toDelList) { long id = record.getLong("id"); @@ -150,7 +149,7 @@ public class CopyOuterParamsScreenToFilterScreen { Db.use(DB_NAME).update("update core_chart_view set custom_attr=? where id=?", jsonString, id); } //更改过滤器 - sql = "select * from core_chart_view where scene_id=?"; + sql = "select * from core_chart_view where scene_id=? and table_id>0 and type not like '%map%'"; List list = Db.use(DB_NAME).find(sql, childId); String custom_filter_json = cn.hutool.core.io.FileUtil.readUtf8String(PathKit.getRootClassPath() + "/Data/filter.json"); for (Record record : list) { @@ -158,9 +157,9 @@ public class CopyOuterParamsScreenToFilterScreen { String custom_filter = record.getStr("custom_filter"); JSONObject jo = JSONObject.parseObject(custom_filter); if (jo.getJSONArray("items") == null) { - jo.put("items", JSONArray.parseArray(custom_filter_json)); + jo=JSONObject.parseObject(custom_filter_json); } else { - jo.getJSONArray("items").add(JSONObject.parseObject(custom_filter_json)); + jo.getJSONArray("items").add(JSONObject.parseObject(custom_filter_json).getJSONArray("items").getJSONObject(0)); } sql = "update core_chart_view set custom_filter=? where id=?"; Db.use(DB_NAME).update(sql, jo.toString(), id); @@ -189,24 +188,6 @@ public class CopyOuterParamsScreenToFilterScreen { Db.use(DataEaseModel.DB_NAME).save("xpack_share", "id", shareRecord); } - /** - * 获取城市的共享链接 - * - * @param dataVisualizationName - * @param cityName - * @return - */ - public static String getCityShare(String dataVisualizationName, String cityName) { - String screenName = dataVisualizationName + cityName; - String sql = "select * from data_visualization_info where name =?"; - Record record = Db.use(DataEaseModel.DB_NAME).findFirst(sql, screenName); - long id = record.getLong("id"); - sql = "select * from xpack_share where resource_id=?"; - Record shareRecord = Db.use(DataEaseModel.DB_NAME).findFirst(sql, id); - System.out.println(cityName + "的共享链接:" + shareRecord.getStr("uuid")); - return shareRecord.getStr("uuid"); - } - public static void main(String[] args) throws InterruptedException { //连接本地数据库系统 LocalMysqlConnectUtil.Init(); @@ -214,7 +195,7 @@ public class CopyOuterParamsScreenToFilterScreen { //清理掉旧的数据 String dataVisualizationNameCity = LocalMysqlConnectUtil.PropKit.get("dataEase.dataVisualizationNameCity"); //清理掉旧的数据 - clearScreen(dataVisualizationNameCity); + clearSingleScreen(dataVisualizationNameCity); //获取市州级外链参数大屏名称 String dataVisualizationOuterParamsNameCity = LocalMysqlConnectUtil.PropKit.get("dataEase.dataVisualizationOuterParamsNameCity");