main
黄海 7 months ago
parent 84264a9b75
commit 915b540380

@ -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);
jo.getJSONArray("items").getJSONObject(0).put("fieldId", fieldId);
if (fieldId > 0) {
jo.getJSONArray("items").getJSONObject(0).put("fieldId", fieldId);
}
} else {
JSONObject newJo = JSONObject.parseObject(custom_filter_json).getJSONArray("items").getJSONObject(0);
newJo.put("fieldId", fieldId);
if (fieldId > 0) {
newJo.put("fieldId", fieldId);
}
jo.getJSONArray("items").add(newJo);
}
sql = "update core_chart_view set custom_filter=? where id=?";

Loading…
Cancel
Save