|
@@ -3,17 +3,21 @@ package com.ruoyi.system.service.impl;
|
|
|
import com.alibaba.fastjson2.JSON;
|
|
|
import com.alibaba.fastjson2.JSONArray;
|
|
|
import com.alibaba.fastjson2.JSONObject;
|
|
|
+import com.alibaba.fastjson2.TypeReference;
|
|
|
import com.ruoyi.common.core.domain.AjaxResult;
|
|
|
import com.ruoyi.common.exception.ServiceException;
|
|
|
import com.ruoyi.common.utils.SecurityUtils;
|
|
|
import com.ruoyi.common.utils.StringUtils;
|
|
|
import com.ruoyi.common.utils.hkws.GetCameraPreviewURL;
|
|
|
+import com.ruoyi.system.domain.EquipmentConfiguration;
|
|
|
import com.ruoyi.system.domain.vo.CameraInfoVo;
|
|
|
+import com.ruoyi.system.mapper.EquipmentConfigurationMapper;
|
|
|
import com.ruoyi.system.service.CameraService;
|
|
|
import org.apache.poi.ss.usermodel.DateUtil;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
-import java.util.Date;
|
|
|
+import java.util.*;
|
|
|
|
|
|
|
|
|
/**
|
|
@@ -24,8 +28,13 @@ import java.util.Date;
|
|
|
*/
|
|
|
@Service
|
|
|
public class CameraServiceImpl implements CameraService {
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private EquipmentConfigurationMapper equipmentConfigurationMapper;
|
|
|
+
|
|
|
@Override
|
|
|
public AjaxResult selectCameraList(CameraInfoVo cameraInfoVo) {
|
|
|
+ //Map<String,JSONObject> map = new HashMap<>();
|
|
|
/**
|
|
|
* STEP3:设置接口的URI地址
|
|
|
*/
|
|
@@ -47,6 +56,23 @@ public class CameraServiceImpl implements CameraService {
|
|
|
|
|
|
String result = GetCameraPreviewURL.GetCameraPreviewURL(url,body);
|
|
|
JSONObject jsonObject = JSON.parseObject(result);
|
|
|
+ //将门禁设备单独列出
|
|
|
+ //Map<String, Object> map = jsonObject.to(new TypeReference<Map<String, Object>>() {});
|
|
|
+ JSONObject data = (JSONObject) jsonObject.get("data");
|
|
|
+ JSONArray itemsArray = data.getJSONArray("list");
|
|
|
+ List<JSONObject> itemsList = itemsArray.toJavaList(JSONObject.class);
|
|
|
+ List<JSONObject> accessList = new ArrayList<>();
|
|
|
+ //查询门禁设备名字
|
|
|
+ List<EquipmentConfiguration> equipmentList = equipmentConfigurationMapper.selectEquipmentConfigurationList(new EquipmentConfiguration());
|
|
|
+ for (JSONObject object : itemsList) {
|
|
|
+ for (EquipmentConfiguration equipmentConfiguration : equipmentList) {
|
|
|
+ if(object.get("name").equals(equipmentConfiguration.getEquipmentName())){
|
|
|
+ accessList.add(object);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ data.put("access",accessList);
|
|
|
+
|
|
|
return AjaxResult.success(jsonObject);
|
|
|
}
|
|
|
|