|
|
|
@ -125,16 +125,25 @@ public class Step2_CopyFilter {
|
|
|
|
|
String custom_filter_json = cn.hutool.core.io.FileUtil.readUtf8String(PathKit.getRootClassPath() + "/Data/filter.json");
|
|
|
|
|
for (Record record : list) {
|
|
|
|
|
long id = record.getLong("id");
|
|
|
|
|
long fieldId = mapField.get(id);
|
|
|
|
|
|
|
|
|
|
long fieldId = -1;
|
|
|
|
|
if (mapField.containsKey(id)) {
|
|
|
|
|
fieldId = mapField.get(id);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
String custom_filter = record.getStr("custom_filter");
|
|
|
|
|
JSONObject jo = JSONObject.parseObject(custom_filter);
|
|
|
|
|
jo.put("logic", "and");
|
|
|
|
|
if (jo.getJSONArray("items") == null) {
|
|
|
|
|
jo = JSONObject.parseObject(custom_filter_json);
|
|
|
|
|
if (fieldId > 0) {
|
|
|
|
|
jo.getJSONArray("items").getJSONObject(0).put("fieldId", fieldId);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
JSONObject newJo = JSONObject.parseObject(custom_filter_json).getJSONArray("items").getJSONObject(0);
|
|
|
|
|
if (fieldId > 0) {
|
|
|
|
|
newJo.put("fieldId", fieldId);
|
|
|
|
|
}
|
|
|
|
|
jo.getJSONArray("items").add(newJo);
|
|
|
|
|
}
|
|
|
|
|
sql = "update core_chart_view set custom_filter=? where id=?";
|
|
|
|
|