Browse Source

摄像头同步

develop
wangsixiang 1 month ago
parent
commit
e3fab15fdd
  1. 24
      zc-business/src/main/java/com/zc/business/controller/VideoController.java
  2. 3
      zc-business/src/main/java/com/zc/business/mapper/DcDeviceMapper.java
  3. 3
      zc-business/src/main/java/com/zc/business/service/IDcDeviceService.java
  4. 5
      zc-business/src/main/java/com/zc/business/service/impl/DcDeviceServiceImpl.java
  5. 11
      zc-business/src/main/resources/mapper/business/DcDeviceMapper.xml

24
zc-business/src/main/java/com/zc/business/controller/VideoController.java

@ -99,8 +99,8 @@ public class VideoController extends BaseController {
public AjaxResult synchronizeIotIds() { public AjaxResult synchronizeIotIds() {
// 查询未同步物联ID的摄像头设备信息 // 查询未同步物联ID的摄像头设备信息
LambdaQueryWrapper<DcDevice> query = new LambdaQueryWrapper<>(); LambdaQueryWrapper<DcDevice> query = new LambdaQueryWrapper<>();
query.eq(DcDevice::getDeviceType, DeviceTypeConstants.CAMERA) query.eq(DcDevice::getDeviceType, DeviceTypeConstants.CAMERA);
.isNull(DcDevice::getIotDeviceId); // .isNull(DcDevice::getIotDeviceId);
List<DcDevice> uninitializedCameras = iDcDeviceService.list(query); List<DcDevice> uninitializedCameras = iDcDeviceService.list(query);
@ -168,7 +168,7 @@ public class VideoController extends BaseController {
// 桩号 // 桩号
String pileNum = cameraInfo.getString("pileNum"); String pileNum = cameraInfo.getString("pileNum");
// 方向 // 方向
Integer camOrientation = cameraInfo.getInteger("camOrientation"); int camOrientation = Integer.valueOf(cameraInfo.getString("camOrientation"));
LaneDirectionEnum laneDirectionEnum = CameraDirectionEnum.fromCode(camOrientation).toLaneDirection(); LaneDirectionEnum laneDirectionEnum = CameraDirectionEnum.fromCode(camOrientation).toLaneDirection();
// 是否有云台控制 0 有(球机) 1 ⽆(枪机) // 是否有云台控制 0 有(球机) 1 ⽆(枪机)
@ -235,7 +235,7 @@ public class VideoController extends BaseController {
/*** /***
* 根据相机中的设备状态修改数据平台设备的设备状态 * 根据相机中的设备状态修改数据平台设备的设备状态
*/ */
@Scheduled(cron = "0 0/5 * * * ?") //@Scheduled(cron = "0 0/5 * * * ?")
@PostMapping("/updateDeviceState") @PostMapping("/updateDeviceState")
public void updateDeviceState() throws HttpException, IOException { public void updateDeviceState() throws HttpException, IOException {
logger.debug("开始执行:同步数据平台视频设备设备的设备状态!!"); logger.debug("开始执行:同步数据平台视频设备设备的设备状态!!");
@ -246,6 +246,7 @@ public class VideoController extends BaseController {
// JSONObject qiLuGaoSu = JSONObject.parseObject(JSONArray.parseArray(dataChildren.get("children").toString()).get(UniversalEnum.ZERO.getNumber()).toString()); // JSONObject qiLuGaoSu = JSONObject.parseObject(JSONArray.parseArray(dataChildren.get("children").toString()).get(UniversalEnum.ZERO.getNumber()).toString());
// JSONObject jiHeYunGuan = JSONObject.parseObject(JSONArray.parseArray(qiLuGaoSu.get("children").toString()).get(UniversalEnum.ZERO.getNumber()).toString()); // JSONObject jiHeYunGuan = JSONObject.parseObject(JSONArray.parseArray(qiLuGaoSu.get("children").toString()).get(UniversalEnum.ZERO.getNumber()).toString());
// JSONArray jiHeYunGuanG35 = JSONArray.parseArray(jiHeYunGuan.get("children").toString()); // JSONArray jiHeYunGuanG35 = JSONArray.parseArray(jiHeYunGuan.get("children").toString());
JSONArray data = cameraData.getJSONArray("data"); JSONArray data = cameraData.getJSONArray("data");
JSONObject children = data.getJSONObject(0); JSONObject children = data.getJSONObject(0);
JSONArray jsonObject = children.getJSONArray("children"); JSONArray jsonObject = children.getJSONArray("children");
@ -292,6 +293,7 @@ public class VideoController extends BaseController {
// device.setIotDeviceId(item.get("camId").toString()); // device.setIotDeviceId(item.get("camId").toString());
// list.add(device); // list.add(device);
// } // }
iDcDeviceService.batchUpdate(list); iDcDeviceService.batchUpdate(list);
//更新中间库的设备状态 //更新中间库的设备状态
@ -526,7 +528,21 @@ public class VideoController extends BaseController {
return AjaxResult.success(result); return AjaxResult.success(result);
} }
/**
* 根据桩号查询附近收费站摄像机
*/
@ApiOperation("根据桩号查询附近收费站摄像机")
@GetMapping(value = "/tollStationList")
public Object selectTollStationCamPile(@ApiParam(value = "桩号", name = "pileNum", required = true) String pileNum) throws HttpException, IOException {
Map<String,Object> result = new HashMap<>();
Integer pileNumDistance = pileNumTransformMetre(pileNum);
String startMileage = String.valueOf(pileNumDistance - UniversalEnum.TWO_THOUSAND.getNumber());
String endMileage = String.valueOf(pileNumDistance + UniversalEnum.TWO_THOUSAND.getNumber());
List<DcDevice> tollStationList = iDcDeviceService.selectTollStationCamPile(UniversalEnum.THREE.getValue(),startMileage,endMileage);
result.put("tollStationList",tollStationList);
return AjaxResult.success(result);
}
/** /**
* 获取视频流信息 * 获取视频流信息
*/ */

3
zc-business/src/main/java/com/zc/business/mapper/DcDeviceMapper.java

@ -39,4 +39,7 @@ public interface DcDeviceMapper extends BaseMapper<DcDevice> {
List<DcDevice> selectDeviceTollStationCamera(); List<DcDevice> selectDeviceTollStationCamera();
//同步收费站摄像头状态 //同步收费站摄像头状态
Integer updateTollStationCameraStatus(DcDevice dcDevice); Integer updateTollStationCameraStatus(DcDevice dcDevice);
//获取收费站摄像头
List<DcDevice> selectTollStationCamPile(@Param("direction") String direction,@Param("startMileage") String startMileage,@Param("endMileage") String endMileage);
} }

3
zc-business/src/main/java/com/zc/business/service/IDcDeviceService.java

@ -127,5 +127,6 @@ public interface IDcDeviceService extends IService<DcDevice> {
List<DcDevice> selectDeviceTollStationCamera(); List<DcDevice> selectDeviceTollStationCamera();
//同步收费站摄像头状态 //同步收费站摄像头状态
Integer updateTollStationCameraStatus(DcDevice dcDevice); Integer updateTollStationCameraStatus(DcDevice dcDevice);
//获取附近收费站摄像头
List<DcDevice> selectTollStationCamPile(String direction, String startMileage, String endMileage);
} }

5
zc-business/src/main/java/com/zc/business/service/impl/DcDeviceServiceImpl.java

@ -654,5 +654,10 @@ public class DcDeviceServiceImpl extends ServiceImpl<DcDeviceMapper, DcDevice> i
public Integer updateTollStationCameraStatus(DcDevice dcDevice) { public Integer updateTollStationCameraStatus(DcDevice dcDevice) {
return dcDeviceMapper.updateTollStationCameraStatus(dcDevice); return dcDeviceMapper.updateTollStationCameraStatus(dcDevice);
} }
//获取附近收费站摄像头
@Override
public List<DcDevice> selectTollStationCamPile(String direction, String startMileage, String endMileage) {
return dcDeviceMapper.selectTollStationCamPile(direction, startMileage, endMileage);
}
} }

11
zc-business/src/main/resources/mapper/business/DcDeviceMapper.xml

@ -185,7 +185,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectDeviceTollStationCamera" resultType="com.zc.business.domain.DcDevice"> <select id="selectDeviceTollStationCamera" resultType="com.zc.business.domain.DcDevice">
select id,iot_device_id from dc_device where facilities_type=5 select id,iot_device_id from dc_device where facilities_type=5
</select> </select>
<update id="updateTollStationCameraStatus"> <update id="updateTollStationCameraStatus">
update dc_device set device_state=#{deviceState} where id=#{id} update dc_device set device_state=#{deviceState} where id=#{id}
</update> </update>
<select id="selectTollStationCamPile" resultType="com.zc.business.domain.DcDevice">
select t1.id, t1.iot_device_id, t1.group_id, t1.product_id, t1.stake_mark, t1.direction, t1.device_name,
t1.device_code, t1.device_type,t1.installation_Date,t1.production_date,t1.durable_years,t1.installation_site,
t1.use_state,t1.device_state,t1.other_config,t1.remark,t1.create_time,t1.update_time,t1.facilities_type,
t1.device_ip,t1.stake_mark_range,t1.network_segment,t1.device_img,t1.child_type,t1.facilities_type,t1.longitude,t1.latitude
from dc_device t1
left join (select * from dc_stake_mark GROUP BY stake_mark) t2 on t1.stake_mark = t2.stake_mark
where !ISNULL(t1.iot_device_id) and t1.device_type = '1' and (t1.facilities_type = '5'|| t1.facilities_type = '4')
and t2.mileage >= #{startMileage} and t2.mileage &lt;= #{endMileage}
</select>
</mapper> </mapper>

Loading…
Cancel
Save