|
@@ -13,7 +13,6 @@ import com.sooka.sponest.monitor.dahua.mapper.CentermonitorTMonitoringEquipmentP
|
|
import com.sooka.sponest.monitor.dahua.service.DahuaService;
|
|
import com.sooka.sponest.monitor.dahua.service.DahuaService;
|
|
import com.sooka.sponest.monitor.dahua.utils.HttpEnum;
|
|
import com.sooka.sponest.monitor.dahua.utils.HttpEnum;
|
|
import com.sooka.sponest.monitor.dahua.utils.HttpTestUtils;
|
|
import com.sooka.sponest.monitor.dahua.utils.HttpTestUtils;
|
|
-import com.sooka.sponest.monitor.remoteapi.service.lawenforcement.RemoteLawenforcementBaseService;
|
|
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.ApiOperation;
|
|
import io.swagger.annotations.ApiOperation;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
@@ -45,8 +44,6 @@ public class EquipmentStatusTaskController {
|
|
|
|
|
|
@Resource
|
|
@Resource
|
|
private CentermonitorTCameraMapper centermonitorTCameraMapper;
|
|
private CentermonitorTCameraMapper centermonitorTCameraMapper;
|
|
- @Resource
|
|
|
|
- private RemoteLawenforcementBaseService remoteLawenforcementBaseService;
|
|
|
|
@Value("${sooka.dahua_interface_server.loginIp}")
|
|
@Value("${sooka.dahua_interface_server.loginIp}")
|
|
private String loginIp;
|
|
private String loginIp;
|
|
@Value("${sooka.dahua_interface_server.loginPort}")
|
|
@Value("${sooka.dahua_interface_server.loginPort}")
|
|
@@ -55,13 +52,12 @@ public class EquipmentStatusTaskController {
|
|
private String userName;
|
|
private String userName;
|
|
@Value("${sooka.dahua_interface_server.userPwd}")
|
|
@Value("${sooka.dahua_interface_server.userPwd}")
|
|
private String userPwd;
|
|
private String userPwd;
|
|
- // private String loginIp = "10.53.0.35";
|
|
|
|
|
|
+// private String loginIp = "10.53.0.35";
|
|
// private String loginPort = "7901";
|
|
// private String loginPort = "7901";
|
|
// private String userName = "system";
|
|
// private String userName = "system";
|
|
// private String userPwd = "Admin123";
|
|
// private String userPwd = "Admin123";
|
|
//按组织获取设备详细信息
|
|
//按组织获取设备详细信息
|
|
public static final String ACTION = "/videoService/devicesManager/devicesInfo";
|
|
public static final String ACTION = "/videoService/devicesManager/devicesInfo";
|
|
- private List<String> orgCodes = Arrays.asList("11033445593778368", "11248668755298496");
|
|
|
|
@Resource
|
|
@Resource
|
|
DahuaService dahuaService;
|
|
DahuaService dahuaService;
|
|
@Resource
|
|
@Resource
|
|
@@ -90,13 +86,12 @@ public class EquipmentStatusTaskController {
|
|
*/
|
|
*/
|
|
private void getMessage(String ip, int port, String token) {
|
|
private void getMessage(String ip, int port, String token) {
|
|
Map<String, String> content = new HashMap<>();
|
|
Map<String, String> content = new HashMap<>();
|
|
- for (String orgCode : orgCodes) {
|
|
|
|
- content.put("orgCode", orgCode);
|
|
|
|
- getDevicesInfo(ip, port, token, content, orgCode);
|
|
|
|
- }
|
|
|
|
|
|
+ content.put("orgCode", "11248668755298496");
|
|
|
|
+ getDevicesInfo(ip, port, token, content);
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|
|
- private void getDevicesInfo(String ip, int port, String token, Map<String, String> content, String orgCode) {
|
|
|
|
|
|
+ private void getDevicesInfo(String ip, int port, String token, Map<String, String> content) {
|
|
String response = HttpTestUtils.httpRequest(HttpEnum.POST, ip, port, ACTION, token, new Gson().toJson(content));
|
|
String response = HttpTestUtils.httpRequest(HttpEnum.POST, ip, port, ACTION, token, new Gson().toJson(content));
|
|
JSONObject jsonObject = JSONObject.parseObject(response);
|
|
JSONObject jsonObject = JSONObject.parseObject(response);
|
|
if (jsonObject.get("devices") == null) {
|
|
if (jsonObject.get("devices") == null) {
|
|
@@ -106,7 +101,7 @@ public class EquipmentStatusTaskController {
|
|
Map<String, Object> rsp = new Gson().fromJson(response, Map.class);
|
|
Map<String, Object> rsp = new Gson().fromJson(response, Map.class);
|
|
List<Map<String, Object>> arr = (List<Map<String, Object>>) rsp.get("devices");
|
|
List<Map<String, Object>> arr = (List<Map<String, Object>>) rsp.get("devices");
|
|
log.info("获取记录仪在离线数据 size = {}", arr.size());
|
|
log.info("获取记录仪在离线数据 size = {}", arr.size());
|
|
- updateDeviceState(arr, orgCode);
|
|
|
|
|
|
+ updateDeviceState(arr);
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -114,50 +109,40 @@ public class EquipmentStatusTaskController {
|
|
*
|
|
*
|
|
* @param arr
|
|
* @param arr
|
|
*/
|
|
*/
|
|
- private void updateDeviceState(List<Map<String, Object>> arr, String orgCode) {
|
|
|
|
|
|
+ private void updateDeviceState(List<Map<String, Object>> arr) {
|
|
log.info("根据组织code编码获取执法仪详情数据:{}", arr.size());
|
|
log.info("根据组织code编码获取执法仪详情数据:{}", arr.size());
|
|
if (CollectionUtils.isNotEmpty(arr)) {
|
|
if (CollectionUtils.isNotEmpty(arr)) {
|
|
- if (orgCode.equals("11248668755298496")) {
|
|
|
|
- List<Map<String, Object>> list = (List<Map<String, Object>>) arr.get(0).get("units");
|
|
|
|
- for (Map<String, Object> map : list) {
|
|
|
|
- if (map.get("unitType").toString().equals("1")) {
|
|
|
|
- arr = (List<Map<String, Object>>) map.get("channels");
|
|
|
|
- //更新摄像头类型为录像机在离线状态
|
|
|
|
- List<String> channelCodeAllList = arr.stream().map(item -> item.get("channelCode"))
|
|
|
|
- .filter(channelCode -> channelCode != null)
|
|
|
|
- .map(Object::toString)
|
|
|
|
- .collect(Collectors.toList());
|
|
|
|
- //先把摄像头类型为录像机的状态全部改成离线
|
|
|
|
- if (CollectionUtils.isNotEmpty(channelCodeAllList)) {
|
|
|
|
- centermonitorTCameraMapper.updateBatchVideoRecorderOfflineState(channelCodeAllList);
|
|
|
|
- }
|
|
|
|
- //再修改摄像头类型为录像机的在线状态
|
|
|
|
- List<String> channelCodeList = arr.stream()
|
|
|
|
- .filter(item -> "1".equals(item.get("status")))
|
|
|
|
- .map(item -> item.get("channelCode"))
|
|
|
|
- .filter(channelCode -> channelCode != null)
|
|
|
|
- .map(Object::toString)
|
|
|
|
- .collect(Collectors.toList());
|
|
|
|
- if (CollectionUtils.isNotEmpty(channelCodeList)) {
|
|
|
|
- centermonitorTCameraMapper.updateBatchVideoRecorderOnlineState(channelCodeList);
|
|
|
|
- }
|
|
|
|
- break;
|
|
|
|
|
|
+ List<Map<String, Object>> list = (List<Map<String, Object>>) arr.get(0).get("units");
|
|
|
|
+ for (Map<String, Object> map : list) {
|
|
|
|
+ if (map.get("unitType").toString().equals("1")) {
|
|
|
|
+ arr = (List<Map<String, Object>>) map.get("channels");
|
|
|
|
+ //更新摄像头类型为录像机在离线状态
|
|
|
|
+ List<String> channelCodeAllList = arr.stream().map(item -> item.get("channelCode"))
|
|
|
|
+ .filter(channelCode -> channelCode != null)
|
|
|
|
+ .map(Object::toString)
|
|
|
|
+ .collect(Collectors.toList());
|
|
|
|
+ //先把摄像头类型为录像机的状态全部改成离线
|
|
|
|
+ if (CollectionUtils.isNotEmpty(channelCodeAllList)) {
|
|
|
|
+ centermonitorTCameraMapper.updateBatchVideoRecorderOfflineState(channelCodeAllList);
|
|
}
|
|
}
|
|
|
|
+ //再修改摄像头类型为录像机的在线状态
|
|
|
|
+ List<String> channelCodeList = arr.stream()
|
|
|
|
+ .filter(item -> "1".equals(item.get("status")))
|
|
|
|
+ .map(item -> item.get("channelCode"))
|
|
|
|
+ .filter(channelCode -> channelCode != null)
|
|
|
|
+ .map(Object::toString)
|
|
|
|
+ .collect(Collectors.toList());
|
|
|
|
+ if (CollectionUtils.isNotEmpty(channelCodeList)) {
|
|
|
|
+ centermonitorTCameraMapper.updateBatchVideoRecorderOnlineState(channelCodeList);
|
|
|
|
+ }
|
|
|
|
+ break;
|
|
}
|
|
}
|
|
- } else {
|
|
|
|
- //向执法中心推送设备状态
|
|
|
|
- R result = remoteLawenforcementBaseService.deviceOpenOrClose(arr);
|
|
|
|
- if (result.getCode() != 200) {
|
|
|
|
- log.info("向执法中心推送设备状态失败:{}", result.getMsg());
|
|
|
|
- }
|
|
|
|
- //更新执法仪在离线状态
|
|
|
|
- centermonitorTCameraMapper.updateBatchLawEnforcementInstrumentState(arr);
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- *获取记录仪位置数据
|
|
|
|
|
|
+ * 获取记录仪位置数据
|
|
*/
|
|
*/
|
|
@PostMapping("putDahuaRecorderLocation")
|
|
@PostMapping("putDahuaRecorderLocation")
|
|
@ResponseBody
|
|
@ResponseBody
|
|
@@ -165,8 +150,8 @@ public class EquipmentStatusTaskController {
|
|
try {
|
|
try {
|
|
dahuaService.insertEquipmentPosition(centermonitorTMonitoringEquipmentPositionDO);
|
|
dahuaService.insertEquipmentPosition(centermonitorTMonitoringEquipmentPositionDO);
|
|
//更新执法记录仪经纬度
|
|
//更新执法记录仪经纬度
|
|
- log.info("获取记录仪位置数据:{}",centermonitorTMonitoringEquipmentPositionDO);
|
|
|
|
- centermonitorTMonitoringEquipmentPositionMapper.updateLongitudeAndLatitudeByCameraCode(centermonitorTMonitoringEquipmentPositionDO.getGpsX(),centermonitorTMonitoringEquipmentPositionDO.getGpsY(),centermonitorTMonitoringEquipmentPositionDO.getChannelCode());
|
|
|
|
|
|
+ log.info("获取记录仪位置数据:{}", centermonitorTMonitoringEquipmentPositionDO);
|
|
|
|
+ centermonitorTMonitoringEquipmentPositionMapper.updateLongitudeAndLatitudeByCameraCode(centermonitorTMonitoringEquipmentPositionDO.getGpsX(), centermonitorTMonitoringEquipmentPositionDO.getGpsY(), centermonitorTMonitoringEquipmentPositionDO.getChannelCode());
|
|
return AjaxResult.success();
|
|
return AjaxResult.success();
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|