添加总人流大于5000的接口

添加标签筛选接口
摄像头接口优化
This commit is contained in:
wuweida 2022-05-30 10:48:26 +08:00
parent 28092b60cd
commit d42a066172
9 changed files with 97 additions and 21 deletions

View File

@ -248,6 +248,21 @@ public class Controller {
return success; return success;
} }
/**
* 查询city为1的标签
* @return
*/
@GetMapping("selectByLabelCity")
@ApiOperation("查询city为1的标签")
public Result selectByLabelCity(){
List<Label> labels = cameraChannelMapper.selectByLabelCity();
Result success = Result.success(labels);
return success;
}
/** /**
* 根据标签名字模糊查询标签 * 根据标签名字模糊查询标签
* @param labelName * @param labelName
@ -295,12 +310,15 @@ public class Controller {
@ApiOperation("提供给其他项目分页查询摄像头接口") @ApiOperation("提供给其他项目分页查询摄像头接口")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "page",value = "页码",required = true,dataType = "Integer"), @ApiImplicitParam(name = "page",value = "页码",required = true,dataType = "Integer"),
@ApiImplicitParam(name = "pageSize",value = "页码大小",required = true,dataType = "Integer"), @ApiImplicitParam(name = "pageSize",value = "页码大小",required = true,dataType = "Integer")
@ApiImplicitParam(name = "labelCode",value = "标签号",required = false,dataType = "String")
}) })
public Result selectNLAll(Integer page,Integer pageSize,String labelCode){ public Result selectNLAll(Integer page,Integer pageSize,String labelCode){
List<CameraChannelNLDto> selectNLAll = cameraChannelMapper.selectNLAll(page,pageSize,labelCode); List<CameraChannelNLDto> selectNLAll = cameraChannelMapper.selectNLAll(page,pageSize);
if (labelCode != null && labelCode != ""){
List<CameraChannelNLDto> dtos = cameraChannelMapper.selectByLabel(page, pageSize);
Result success = Result.success(dtos);
return success;
}
Result success = Result.success(selectNLAll); Result success = Result.success(selectNLAll);
return success; return success;
} }
@ -420,6 +438,13 @@ public class Controller {
List<PassengerFlow> list = passengerFlowService.listPassengerFlow(timeId); List<PassengerFlow> list = passengerFlowService.listPassengerFlow(timeId);
return list; return list;
} }
//从表中获取最新的客流列表并筛选出all_nums >=5000的
@GetMapping("listPassengerFlowByAllNums")
@ApiOperation("从表中获取最新的客流列表并筛选出all_nums >=5000的")
public List<PassengerFlow> listPassengerFlowByAllNums(){
List<PassengerFlow> list = passengerFlowService.listPassengerFlowByAllNums();
return list;
}
//获取实时客流并保存到表t_passenger_flow //获取实时客流并保存到表t_passenger_flow
@GetMapping("savePassengerFlow") @GetMapping("savePassengerFlow")
@ -494,6 +519,21 @@ public class Controller {
List<RoadData> list = roadDataService.listRoadData(dt); List<RoadData> list = roadDataService.listRoadData(dt);
return Result.success(list); return Result.success(list);
} }
//根据输入的日期间隔查询道路污染数据(例如2022-05-10 00:00:00至2022-05-11 00:00:00
@GetMapping(value="listRoadDataByTimeRegion")
@ApiOperation("根据输入的日期间隔查询道路污染数据(例如2022-05-10 00:00:00至2022-05-11 00:00:00")
@ApiImplicitParams({
@ApiImplicitParam(name = "start", value = "开始日期", paramType = "query", dataType = "string", required = true),
@ApiImplicitParam(name = "end", value = "结束日期", paramType = "query", dataType = "string", required = true)
})
public Result listRoadDataByTimeRegion(
@RequestParam(value="start") String start,
@RequestParam(value="end") String end
){
List<RoadData> list = roadDataService.listRoadDataByTimeRegion(start,end);
return Result.success(list);
}
//查询工地信息根据经纬度和半径查询 //查询工地信息根据经纬度和半径查询
@GetMapping(value = "listBuildingSiteByPoints") @GetMapping(value = "listBuildingSiteByPoints")

View File

@ -32,4 +32,11 @@ public class FileController {
Result success = Result.success(s); Result success = Result.success(s);
return success; return success;
} }
@GetMapping("token")
public Result token( ) {
String s = monitorService.init();
Result success = Result.success(s);
return success;
}
} }

View File

@ -12,6 +12,6 @@ public class Label {
private String labelCode; private String labelCode;
private String labelName; private String labelName;
private String capturePatternn; private String capturePatternn;
private String used; private String city;
} }

View File

@ -34,6 +34,9 @@ public interface CameraChannelMapper extends BaseMapper<CameraChannel> {
@Select("select * from t_label") @Select("select * from t_label")
List<Label> selectAllLabel(); List<Label> selectAllLabel();
@Select("select * from t_label where city = 1 ")
List<Label> selectByLabelCity();
@Select("select * from t_label where label_name like concat('%',#{labelName},'%')") @Select("select * from t_label where label_name like concat('%',#{labelName},'%')")
List<Label> selectByLabelName(String labelName); List<Label> selectByLabelName(String labelName);
@ -52,6 +55,8 @@ public interface CameraChannelMapper extends BaseMapper<CameraChannel> {
@Param("gpsY1") Double gpsY1); @Param("gpsY1") Double gpsY1);
List<CameraChannelNLDto> selectNLAll(@Param("page") Integer page,@Param("pageSize") Integer pageSize,@Param("labelCode") String labelCode); List<CameraChannelNLDto> selectNLAll(@Param("page") Integer page,@Param("pageSize") Integer pageSize);
List<CameraChannelNLDto> selectByLabel(@Param("page") Integer page,@Param("pageSize") Integer pageSize);
} }

View File

@ -90,7 +90,7 @@ public class MonitorService {
static int keepaliveCount = 16; static int keepaliveCount = 16;
@PostConstruct @PostConstruct
public void init(){ public String init(){
String loginUrl = monitorDomain + "/videoService/accounts/authorize"; String loginUrl = monitorDomain + "/videoService/accounts/authorize";
HashMap<String, String> loginParam = new HashMap<>(); HashMap<String, String> loginParam = new HashMap<>();
@ -128,13 +128,13 @@ public class MonitorService {
String token = (String) reponse.get("token"); String token = (String) reponse.get("token");
if (token== null || StringUtils.isEmpty(token)){ if (token== null || StringUtils.isEmpty(token)){
log.error("[monitor-capture]:" + "监控系统登录失败"); log.error("[monitor-capture]:" + "监控系统登录失败");
return; return "";
} }
this.token = token; this.token = token;
Integer duration = (Integer) reponse.get("duration"); Integer duration = (Integer) reponse.get("duration");
if (duration == null || duration < 20){ if (duration == null || duration < 20){
log.error("[monitor-capture]:" + "监控系统失效时间异常" + duration); log.error("[monitor-capture]:" + "监控系统失效时间异常" + duration);
return; return "";
} }
duration = duration - 20; duration = duration - 20;
@ -178,6 +178,7 @@ public class MonitorService {
}, 0, duration * 1000); }, 0, duration * 1000);
} }
return token;
} }
@Scheduled(cron = "0 0 8 * * ?") @Scheduled(cron = "0 0 8 * * ?")
@ -463,16 +464,16 @@ public class MonitorService {
ChannelPicture picture = new ChannelPicture(); ChannelPicture picture = new ChannelPicture();
picture.setChannelCode(channelCode); picture.setChannelCode(channelCode);
picture.setPicUrl(picUrl); picture.setPicUrl(picUrl);
picture.setInsertTime(new Date()); /*picture.setInsertTime(new Date());
channelPictureMapper.insert(picture); channelPictureMapper.insert(picture);*/
/*if (channelCode == null){ if (channelCode == null){
channelPictureMapper.insert(picture); channelPictureMapper.insert(picture);
}else { }else {
QueryWrapper<ChannelPicture> queryWrapper = new QueryWrapper<>(); QueryWrapper<ChannelPicture> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("channel_code", channelCode); queryWrapper.eq("channel_code", channelCode);
picture.setInsertTime(new Date()); picture.setInsertTime(new Date());
channelPictureMapper.update(picture, queryWrapper); channelPictureMapper.update(picture, queryWrapper);
}*/ }
}catch (Exception e){ }catch (Exception e){
log.info( "[monitor-capture] " +channelCode + " 截图图片失败 " + e.getMessage()); log.info( "[monitor-capture] " +channelCode + " 截图图片失败 " + e.getMessage());
@ -717,12 +718,15 @@ public class MonitorService {
HttpHeaders headers = new HttpHeaders(); HttpHeaders headers = new HttpHeaders();
headers.add("X-Subject-Token",token); headers.add("X-Subject-Token",token);
System.out.println(token);
ResponseEntity<HashMap> forEntity = restTemplate.exchange(url, HttpMethod.GET, new HttpEntity(headers), HashMap.class ); ResponseEntity<HashMap> forEntity = restTemplate.exchange(url, HttpMethod.GET, new HttpEntity(headers), HashMap.class );
HashMap body = forEntity.getBody(); HashMap body = forEntity.getBody();
String file = (String) body.get("url"); String file = (String) body.get("url");
return file; return file;
} }
@ -777,7 +781,7 @@ public class MonitorService {
cameraChannel.setParentId(id); cameraChannel.setParentId(id);
//cameraChannelMapper.insert(cameraChannel); cameraChannelMapper.insert(cameraChannel);
} }

View File

@ -119,6 +119,16 @@ public class PassengerFlowService {
return lists; return lists;
} }
//从表中获取获取最新的实时客流并筛选出all_nums>=5000,并desc排序
public List<PassengerFlow> listPassengerFlowByAllNums(){
List<PassengerFlow> lists = new ArrayList<>();
String timeId = passengerFlowMapper.getByMaxId().getTimeId();
QueryWrapper<PassengerFlow> wrapper = new QueryWrapper<>();
wrapper.eq("time_id",timeId).ge("all_nums",5000).orderByDesc("all_nums");
lists = passengerFlowMapper.selectList(wrapper);
return lists;
}
@Scheduled(cron = "0 31 10-22/1 * * ? ") @Scheduled(cron = "0 31 10-22/1 * * ? ")
//提供的接口能查到当前时间2个小时之前的数据每隔15分钟一次我们只取整点从早8点到晚8点的整点数据 //提供的接口能查到当前时间2个小时之前的数据每隔15分钟一次我们只取整点从早8点到晚8点的整点数据
//10:31 到晚上1031每小时的31分执行一次 //10:31 到晚上1031每小时的31分执行一次

View File

@ -84,6 +84,13 @@ public class RoadDataService {
return list; return list;
} }
public List<RoadData> listRoadDataByTimeRegion(String start,String end){
QueryWrapper<RoadData> wrapper = new QueryWrapper<>();
wrapper.between("dt",start,end);
List<RoadData> list = roadDataMapper.selectList(wrapper);
return list;
}
//获取当前日期的时间串2022-05-08 00:00:00 //获取当前日期的时间串2022-05-08 00:00:00
private String dateTimeStr(){ private String dateTimeStr(){
LocalDate localDate = LocalDate.now(); LocalDate localDate = LocalDate.now();

View File

@ -36,7 +36,7 @@ public class SedimentTrailService {
private MonitorService monitorService; private MonitorService monitorService;
//获取渣土车轨迹并保存到表t_trail_sediment //获取渣土车轨迹并保存到表t_trail_sediment
@Transactional(rollbackFor = Exception.class) //@Transactional(rollbackFor = Exception.class)
public boolean batchSaveSedimentTrail(){ public boolean batchSaveSedimentTrail(){
try{ try{
List<Map> maps = monitorService.resCatalogApplyZTYS(); List<Map> maps = monitorService.resCatalogApplyZTYS();

View File

@ -27,12 +27,15 @@
<select id="selectNLAll" resultType="com.hisense.monitormanage.dto.CameraChannelNLDto"> <select id="selectNLAll" resultType="com.hisense.monitormanage.dto.CameraChannelNLDto">
SELECT a.label_name,d.* from t_label a RIGHT JOIN (select b.label_code,c.* from t_camera_channel c SELECT a.label_name,d.* from t_label a RIGHT JOIN (select b.label_code,c.* from t_camera_channel c
LEFT JOIN t_channel_mtm_label b on c.channel_code = b.channel_code) d LEFT JOIN t_channel_mtm_label b on c.channel_code = b.channel_code) d
on d.label_code = a.label_code on d.label_code = a.label_code
<where> <bind name="page" value="(page-1)*pageSize"/>
<if test="labelCode != null and labelCode != ''"> limit #{page},#{pageSize}
d.label_code = #{labelCode} </select>
</if>
</where> <select id="selectByLabel" resultType="com.hisense.monitormanage.dto.CameraChannelNLDto">
SELECT a.label_name,d.* from t_label a JOIN (select b.label_code,c.* from t_camera_channel c
JOIN t_channel_mtm_label b on c.channel_code = b.channel_code where b.label_code != '') d
on d.label_code = a.label_code
<bind name="page" value="(page-1)*pageSize"/> <bind name="page" value="(page-1)*pageSize"/>
limit #{page},#{pageSize} limit #{page},#{pageSize}
</select> </select>