|
|
|
@ -7,9 +7,11 @@ import com.ruoyi.common.core.controller.BaseController;
|
|
|
|
|
import com.ruoyi.common.json.JsonUtils;
|
|
|
|
|
import com.ruoyi.system.domain.BaseSensorInfo;
|
|
|
|
|
import com.ruoyi.system.domain.BaseSensorType;
|
|
|
|
|
import com.ruoyi.system.domain.SysParamConfig;
|
|
|
|
|
import com.ruoyi.system.domain.dto.BaseSensorInfoDto;
|
|
|
|
|
import com.ruoyi.system.service.IBaseSensorInfoService;
|
|
|
|
|
import com.ruoyi.system.service.IBaseSensorTypeService;
|
|
|
|
|
import com.ruoyi.system.service.ISysParamConfigService;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
|
|
import org.springframework.data.redis.core.StringRedisTemplate;
|
|
|
|
@ -39,6 +41,8 @@ public class SensorSummaryController extends BaseController {
|
|
|
|
|
|
|
|
|
|
@Autowired private IBaseSensorInfoService baseSensorInfoService;
|
|
|
|
|
|
|
|
|
|
@Autowired private ISysParamConfigService sysParamConfigService;
|
|
|
|
|
|
|
|
|
|
@Autowired private StringRedisTemplate redisTemplate;
|
|
|
|
|
|
|
|
|
|
@GetMapping()
|
|
|
|
@ -67,18 +71,30 @@ public class SensorSummaryController extends BaseController {
|
|
|
|
|
Map<String, Object> info = new HashMap<>();
|
|
|
|
|
Object jrm = redisTemplate.opsForHash().get(x.getSensorType(), x.getSensorId());
|
|
|
|
|
if (jrm != null) {
|
|
|
|
|
List<SysParamConfig> sysParamConfigs =
|
|
|
|
|
sysParamConfigService.selectSysParamConfigList(
|
|
|
|
|
new SysParamConfig(x.getSensorType(), null, 0L));
|
|
|
|
|
|
|
|
|
|
JSONObject jsonObject = JSON.parseObject(jrm.toString());
|
|
|
|
|
Object param = jsonObject.get("param");
|
|
|
|
|
JSONObject data = JSON.parseObject(param.toString());
|
|
|
|
|
JSONObject datavalue = JSON.parseObject(data.get("datavalue").toString());
|
|
|
|
|
info = JsonUtils.JSONObjectToMap(datavalue);
|
|
|
|
|
// info = JsonUtils.JSONObjectToMap(datavalue);
|
|
|
|
|
|
|
|
|
|
sysParamConfigs.forEach(
|
|
|
|
|
params -> {
|
|
|
|
|
info.put(params.getParamTitle(), datavalue.get(params.getParamTitle()));
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
info.put("datatype", data.get("datatype"));
|
|
|
|
|
|
|
|
|
|
String collectTime = jsonObject.get("collectTime").toString();
|
|
|
|
|
|
|
|
|
|
info.put(
|
|
|
|
|
"collectTime",
|
|
|
|
|
collectTime.substring(0, collectTime.indexOf(".")).replace("T", " "));
|
|
|
|
|
if (collectTime.length() > 19) {
|
|
|
|
|
collectTime = collectTime.substring(0, collectTime.indexOf(".")).replace("T", " ");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
info.put("collectTime", collectTime);
|
|
|
|
|
}
|
|
|
|
|
info.put("id", indexId++);
|
|
|
|
|
|
|
|
|
@ -88,14 +104,6 @@ public class SensorSummaryController extends BaseController {
|
|
|
|
|
|
|
|
|
|
info.put("sensorLocation", x.getSensorLocation());
|
|
|
|
|
|
|
|
|
|
String[] split = hiddenField.split(",");
|
|
|
|
|
|
|
|
|
|
for (String s : split) {
|
|
|
|
|
if(info.containsKey(s)){
|
|
|
|
|
info.remove(s);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
result.add(info);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|