|
@@ -1,12 +1,32 @@
|
|
|
package com.persagy.apm.dmpalarm.service.impl;
|
|
|
|
|
|
-import cn.hutool.core.date.DateUtil;
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.Date;
|
|
|
+import java.util.HashMap;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+import java.util.Map.Entry;
|
|
|
+import java.util.Set;
|
|
|
+import java.util.UUID;
|
|
|
+
|
|
|
+import javax.annotation.Resource;
|
|
|
+
|
|
|
+import org.apache.commons.lang.StringUtils;
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
+import org.springframework.util.CollectionUtils;
|
|
|
+
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|
|
import com.persagy.apm.dmpalarm.config.DmpParameterStorage;
|
|
|
import com.persagy.apm.dmpalarm.criteria.JsonCriteria;
|
|
|
-import com.persagy.apm.dmpalarm.enumeration.*;
|
|
|
+import com.persagy.apm.dmpalarm.enumeration.AlarmLogType;
|
|
|
+import com.persagy.apm.dmpalarm.enumeration.EnumAlarmListType;
|
|
|
+import com.persagy.apm.dmpalarm.enumeration.EnumAlarmMessageType;
|
|
|
+import com.persagy.apm.dmpalarm.enumeration.EnumAlarmRecordWithColumns;
|
|
|
+import com.persagy.apm.dmpalarm.enumeration.EnumAlarmState;
|
|
|
+import com.persagy.apm.dmpalarm.enumeration.EnumAlarmTreatState;
|
|
|
import com.persagy.apm.dmpalarm.json.JacksonMapper;
|
|
|
import com.persagy.apm.dmpalarm.model.AlarmLog;
|
|
|
import com.persagy.apm.dmpalarm.model.AlarmRecord;
|
|
@@ -18,15 +38,10 @@ import com.persagy.apm.dmpalarm.utils.CheckRequiredParam;
|
|
|
import com.persagy.apm.dmpalarm.utils.DatePatternStyle;
|
|
|
import com.persagy.apm.dmpalarm.web.MapResponse;
|
|
|
import com.persagy.apm.dmpalarm.web.PagedResponse;
|
|
|
-import lombok.extern.slf4j.Slf4j;
|
|
|
-import org.apache.commons.lang.StringUtils;
|
|
|
-import org.springframework.stereotype.Service;
|
|
|
-import org.springframework.transaction.annotation.Transactional;
|
|
|
-import org.springframework.util.CollectionUtils;
|
|
|
|
|
|
-import javax.annotation.Resource;
|
|
|
-import java.util.*;
|
|
|
-import java.util.Map.Entry;
|
|
|
+import cn.hutool.core.date.DateUtil;
|
|
|
+import cn.hutool.core.text.CharSequenceUtil;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
|
/**
|
|
|
* 报警记录(AlarmRecord) service层
|
|
@@ -43,7 +58,8 @@ public class AlarmRecordServiceImpl extends BaseServiceImpl<BaseMapper<AlarmReco
|
|
|
@Resource
|
|
|
private IShardingService shardingService;
|
|
|
|
|
|
- @Override
|
|
|
+ @SuppressWarnings("unchecked")
|
|
|
+ @Override
|
|
|
public PagedResponse<AlarmRecord> query(JsonCriteria jsonCriteria) {
|
|
|
try {
|
|
|
QueryWrapper<AlarmRecord> queryWrapper = criteriaUtils.handleAlarmConditions(jsonCriteria,
|
|
@@ -68,7 +84,14 @@ public class AlarmRecordServiceImpl extends BaseServiceImpl<BaseMapper<AlarmReco
|
|
|
JSONObject supplementJsonObject = jsonCriteria.getCriteria().getJSONObject("supplement");
|
|
|
if (null != supplementJsonObject && !supplementJsonObject.isEmpty()) {
|
|
|
for (Entry<String, Object> entry : supplementJsonObject.entrySet()) {
|
|
|
- queryWrapper.eq("supplement ->'$." + entry.getKey() + "'", entry.getValue());
|
|
|
+ List<Object> param=new ArrayList<>();
|
|
|
+ if (entry.getValue() instanceof List) {
|
|
|
+ param = (List<Object>) entry.getValue() ;
|
|
|
+ }else {
|
|
|
+ param.add(entry.getValue());
|
|
|
+ }
|
|
|
+ String strArray =CharSequenceUtil.join("\",\"", param);
|
|
|
+ queryWrapper.apply("JSON_CONTAINS( JSON_ARRAY(\""+strArray+"\"), JSON_ARRAY(supplement->'$."+entry.getKey()+"'))") ;
|
|
|
}
|
|
|
}
|
|
|
PagedResponse<AlarmRecord> resp = shardingService.selectShardingPageList(AlarmRecord.class, queryWrapper,
|