管道,流程,数据源切换,大屏,测量点位

This commit is contained in:
Timer
2026-03-08 04:20:59 +08:00
parent d60f8aa1f5
commit 5fa4d814aa

View File

@ -432,7 +432,12 @@ public class MPointController {
// 比对ES全量数据总数和数据库全量数据总数
long dbCount = this.mPointService.getDbTotalCount();
long esCount = this.mPointService.getEsTotalCount();
long esCount = 0;
try {
esCount = this.mPointService.getEsTotalCount();
} catch (Exception e) {
logger.warn("ES数据查询异常跳过ES", e);
}
logger.info("getlistES数据比对 -> DB总数:" + dbCount + ", ES总数:" + esCount);
String result;
@ -543,8 +548,46 @@ public class MPointController {
units.add(unit);
}
String bizids = "";
StringBuilder bizids = new StringBuilder();
if (searchName != null && !searchName.isEmpty()) {
String keyword = getKeyword(searchName, units);
if (!keyword.isEmpty()) {
units = this.getParent(keyword, units);
bizids = new StringBuilder(keyword);
}
}
for (Unit value : units) {
if (bizids.length() > 0) {
bizids.append(" ");
}
bizids.append(value.getId());
}
childBoolQueryBuilder.must(QueryBuilders.matchQuery("bizid", bizids.toString()));
}
boolQueryBuilder.should(childBoolQueryBuilder);
nativeSearchQueryBuilder.withSort(SortBuilders.fieldSort(sort).order(sortOrder));
nativeSearchQueryBuilder.withQuery(boolQueryBuilder);
nativeSearchQueryBuilder.withPageable(PageRequest.of(page - 1, rows));
Page<MPoint> list = this.mPointService.selectListByES(nativeSearchQueryBuilder);
// 查询工艺段
for (MPoint mp : list) {
List<ProcessSection> processSections = processSectionService.selectSimpleListByWhere("where code = '" + mp.getProcesssectioncode() + "'");
if (processSections != null && !processSections.isEmpty()) {
mp.setProcessSection(processSections.get(0));
}
}
JSONArray json = JSONArray.fromObject(list.getContent());
result = "{\"total\":" + list.getTotalElements() + ",\"rows\":" + json + "}";
}
model.addAttribute("result", result);
return new ModelAndView("result");
}
private static String getKeyword(String searchName, List<Unit> units) {
int lastMatchNum = 1;
String keyword = "";
char[] sNchars = searchName.toCharArray();
@ -559,40 +602,7 @@ public class MPointController {
keyword = units.get(u).getId();
}
}
if (!keyword.isEmpty()) {
units = this.getParent(keyword, units);
bizids = keyword;
}
}
for (int u = 0; u < units.size(); u++) {
if (!bizids.isEmpty()) {
bizids += " ";
}
bizids += units.get(u).getId();
}
childBoolQueryBuilder.must(QueryBuilders.matchQuery("bizid", bizids));
}
boolQueryBuilder.should(childBoolQueryBuilder);
nativeSearchQueryBuilder.withSort(SortBuilders.fieldSort(sort).order(sortOrder));
nativeSearchQueryBuilder.withQuery(boolQueryBuilder);
nativeSearchQueryBuilder.withPageable(PageRequest.of(page - 1, rows));
Page<MPoint> list = this.mPointService.selectListByES(nativeSearchQueryBuilder);
// 查询工艺段
for (MPoint mp : list) {
List<ProcessSection> processSections = processSectionService.selectSimpleListByWhere("where code = '" + mp.getProcesssectioncode() + "'");
if (processSections != null && processSections.size() > 0) {
mp.setProcessSection(processSections.get(0));
}
}
JSONArray json = JSONArray.fromObject(list.getContent());
result = "{\"total\":" + list.getTotalElements() + ",\"rows\":" + json + "}";
}
model.addAttribute("result", result);
return new ModelAndView("result");
return keyword;
}
@RequestMapping("/getKPIList.do")
@ -4520,7 +4530,7 @@ public class MPointController {
}
PageHelper.startPage(page, rows);
List<MPointHistory> list = mPointHistoryService.selectMpHisDataLeftMpHisChange(bizid, mpid,"'"+mpid+"'", wherestr + orderstr, dbname);
List<MPointHistory> list = mPointHistoryService.selectMpHisDataLeftMpHisChange(bizid, mpid, "'" + mpid + "'", wherestr + orderstr, dbname);
PageInfo<MPointHistory> pi = new PageInfo<MPointHistory>(list);
JSONArray json = JSONArray.fromObject(list);