|
@@ -1,7 +1,19 @@
|
|
|
package com.persagy.controller;
|
|
|
|
|
|
|
|
|
-import cn.hutool.core.util.ObjectUtil;
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.Arrays;
|
|
|
+import java.util.HashMap;
|
|
|
+import java.util.Iterator;
|
|
|
+import java.util.concurrent.ConcurrentHashMap;
|
|
|
+import java.util.concurrent.atomic.AtomicInteger;
|
|
|
+
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.web.bind.annotation.PostMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestBody;
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
+
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.persagy.cache.AlarmInfoCache;
|
|
|
import com.persagy.constant.CommonConst;
|
|
@@ -12,17 +24,11 @@ import com.persagy.netty.client.NettyClient;
|
|
|
import com.persagy.repository.AlarmRecordRepository;
|
|
|
import com.persagy.service.AlarmHandleService;
|
|
|
import com.persagy.utils.LockUtil;
|
|
|
+
|
|
|
+import cn.hutool.core.util.ObjectUtil;
|
|
|
+import cn.hutool.core.util.StrUtil;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
-import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.web.bind.annotation.PostMapping;
|
|
|
-import org.springframework.web.bind.annotation.RequestBody;
|
|
|
-import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
-import org.springframework.web.bind.annotation.RestController;
|
|
|
-
|
|
|
-import java.util.*;
|
|
|
-import java.util.concurrent.ConcurrentHashMap;
|
|
|
-import java.util.concurrent.atomic.AtomicInteger;
|
|
|
|
|
|
@Api(tags = "hello")
|
|
|
@RestController
|
|
@@ -115,7 +121,14 @@ public class HelloWorld {
|
|
|
}
|
|
|
|
|
|
@PostMapping("/test4")
|
|
|
- public Map<String, AlarmDefine> test4(@RequestBody JSONObject jsonObject) throws Exception {
|
|
|
+ public Object test4(@RequestBody JSONObject jsonObject) throws Exception {
|
|
|
+ String objId = jsonObject.getString("objId");
|
|
|
+ String itemId = jsonObject.getString("itemId");
|
|
|
+ if (StrUtil.isAllNotBlank(objId, itemId)) {
|
|
|
+ String defineId = AlarmInfoCache.getAlarmDefineId(jsonObject);
|
|
|
+ return alarmInfoCache.getAlarmDefinitionById(defineId);
|
|
|
+ }
|
|
|
+
|
|
|
ConcurrentHashMap<String, AlarmDefine> alarmDefineMap = alarmInfoCache.getAlarmDefineMap();
|
|
|
if (ObjectUtil.isNotEmpty(alarmDefineMap)) {
|
|
|
return alarmDefineMap;
|