|
@@ -6,6 +6,7 @@ import com.ozs.common.annotation.Log;
|
|
|
import com.ozs.common.core.controller.BaseController;
|
|
|
import com.ozs.common.core.domain.AjaxResult;
|
|
|
import com.ozs.common.core.domain.entity.SysDictData;
|
|
|
+import com.ozs.common.core.redis.RedisCache;
|
|
|
import com.ozs.common.enums.BusinessType;
|
|
|
import com.ozs.common.utils.ChineseToPingyin;
|
|
|
import com.ozs.common.utils.StringUtils;
|
|
@@ -25,6 +26,7 @@ import com.ozs.service.BaseVehicleService;
|
|
|
import com.ozs.service.VehiclePositionService;
|
|
|
import com.ozs.system.service.DataScoreUtil;
|
|
|
import com.ozs.system.service.ISysDictTypeService;
|
|
|
+import com.ozs.web.common.Constant;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -39,7 +41,9 @@ import java.io.InputStream;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.Comparator;
|
|
|
import java.util.Date;
|
|
|
+import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
@@ -64,7 +68,8 @@ public class BaseVehicleController extends BaseController {
|
|
|
private ISysDictTypeService dictTypeService;
|
|
|
@Resource
|
|
|
BaseDeviceDynamicManagementService baseDeviceDynamicManagementService;
|
|
|
-
|
|
|
+ @Autowired
|
|
|
+ private RedisCache redisCache;
|
|
|
|
|
|
/**
|
|
|
* 车载终端挂载列表
|
|
@@ -315,6 +320,29 @@ public class BaseVehicleController extends BaseController {
|
|
|
return success(vehicleTree);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 前端传终端码
|
|
|
+ * 1、根据终端码 查询 行驶记录表 获取最新的机车位置 \ 司机的目视距离;
|
|
|
+ * 2、根据 机车的位置 和线路 查询 机车前方1路视频 ( 10KM 是否有报警 )
|
|
|
+ */
|
|
|
+ @ApiOperation(value = "通过终端编码获取流")
|
|
|
+ @GetMapping("/vehicleCurrentStream")
|
|
|
+ @Log(title = "通过终端编码获取流", businessType = BusinessType.SELECT)
|
|
|
+ public AjaxResult vehicleCurrentStream(String zdCode) {
|
|
|
+ Map<String, Object> cacheMap = redisCache.getCacheMap(Constant.HERTBEA_KEY + zdCode);
|
|
|
+ if (!ObjectUtils.isEmpty(cacheMap)) {
|
|
|
+ Map<String, String> ccMap = new HashMap<>();
|
|
|
+ Object cameraCode = cacheMap.get("cameraCode");
|
|
|
+ Object stream = cacheMap.get("currentStream");
|
|
|
+ if (!ObjectUtils.isEmpty(cameraCode)) {
|
|
|
+ ccMap.put("cameraCode", cameraCode.toString());
|
|
|
+ ccMap.put("currentStream", stream.toString());
|
|
|
+ return AjaxResult.success(ccMap);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return AjaxResult.error("当前机车无实时流");
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 机车信息表 (首页地图中的机车信息)
|
|
|
*
|