diff --git a/src/main/java/com/hisense/monitormanage/MonitorManageApplication.java b/src/main/java/com/hisense/monitormanage/MonitorManageApplication.java index 878f69c..2c41b26 100644 --- a/src/main/java/com/hisense/monitormanage/MonitorManageApplication.java +++ b/src/main/java/com/hisense/monitormanage/MonitorManageApplication.java @@ -3,7 +3,6 @@ package com.hisense.monitormanage; import org.mybatis.spring.annotation.MapperScan; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.cache.annotation.Cacheable; import org.springframework.cache.annotation.EnableCaching; import org.springframework.scheduling.annotation.EnableScheduling; import springfox.documentation.swagger2.annotations.EnableSwagger2; diff --git a/src/main/java/com/hisense/monitormanage/controller/BuildingController.java b/src/main/java/com/hisense/monitormanage/controller/BuildingController.java index 3e3d963..3312842 100644 --- a/src/main/java/com/hisense/monitormanage/controller/BuildingController.java +++ b/src/main/java/com/hisense/monitormanage/controller/BuildingController.java @@ -2,7 +2,6 @@ package com.hisense.monitormanage.controller; import com.hisense.monitormanage.dto.BuildingRecordsDto; import com.hisense.monitormanage.entity.BuildingRecords; -import com.hisense.monitormanage.entity.CameraChannel; import com.hisense.monitormanage.entity.Result; import com.hisense.monitormanage.mapper.BuildingRecordsMapper; import com.hisense.monitormanage.service.BuildingRecordsService; diff --git a/src/main/java/com/hisense/monitormanage/controller/Controller.java b/src/main/java/com/hisense/monitormanage/controller/Controller.java index e21659c..f6e790f 100644 --- a/src/main/java/com/hisense/monitormanage/controller/Controller.java +++ b/src/main/java/com/hisense/monitormanage/controller/Controller.java @@ -329,15 +329,6 @@ public class Controller { return success; } - //查询视频点播巡检结果,只取异常的 -// @RequestMapping("listChannelPlayStates") -// public Result listChannelPlayStates( -// @RequestParam(value="page",required = false,defaultValue = "1") Integer page, -// @RequestParam(value="pageSize",required = false,defaultValue = "20") Integer pageSize -// ){ -// return monitorService.listChannelPlayStates(); -// } - //道路统计数据与排名 @GetMapping("roadData") @ApiOperation("道路统计数据与排名,根据后台dt调用接口") diff --git a/src/main/java/com/hisense/monitormanage/controller/EventController.java b/src/main/java/com/hisense/monitormanage/controller/EventController.java index db6c3f2..5df5c35 100644 --- a/src/main/java/com/hisense/monitormanage/controller/EventController.java +++ b/src/main/java/com/hisense/monitormanage/controller/EventController.java @@ -18,7 +18,6 @@ import org.springframework.web.bind.annotation.RestController; import javax.servlet.ServletInputStream; import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.text.SimpleDateFormat; import java.util.*; @@ -68,36 +67,29 @@ public class EventController { event.setEventCnName(jsonObject.getString("eventAlias")); event.setEventSerial(jsonObject.getString("eventSerial")); JSONObject attributes = jsonObject.getJSONObject("attributes"); - if (attributes==null){ - }else { + if (attributes!=null){ JSONObject text = attributes.getJSONObject("text"); - if (text == null){ - }else { + if (text != null){ event.setVehicle(text.getString("valueDescription")); } JSONObject color = attributes.getJSONObject("color"); - if (color == null) { - } else { + if (color != null) { event.setColor(color.getString("valueDescription")); } JSONObject largeVehicle = attributes.getJSONObject("large_vehicle"); - if (largeVehicle == null) { - } else { + if (largeVehicle != null) { event.setVehicle(largeVehicle.getString("valueDescription")); } JSONObject trainingVehicle = attributes.getJSONObject("training_vehicle"); if (trainingVehicle == null) { - } else { event.setVehicle(trainingVehicle.getString("valueDescription")); } JSONObject smallVehicle = attributes.getJSONObject("small_vehicle"); - if (smallVehicle == null) { - } else { + if (smallVehicle != null) { event.setVehicle(smallVehicle.getString("valueDescription")); } JSONObject aClass = attributes.getJSONObject("class"); - if (aClass == null) { - } else { + if (aClass != null) { event.setClasses(aClass.getString("valueDescription")); } } @@ -158,7 +150,12 @@ public class EventController { event.setEventNewName(event.getEventCnName()); } } - Result success = Result.success(events); + Integer integer = eventMapper.selectCountEvent(); + page = integer/pageSize + 1; + Map map = new HashMap<>(); + map.put("page",page); + map.put("events",events); + Result success = Result.success(map); return success; } diff --git a/src/main/java/com/hisense/monitormanage/controller/FileController.java b/src/main/java/com/hisense/monitormanage/controller/FileController.java index 8156254..ea68df4 100644 --- a/src/main/java/com/hisense/monitormanage/controller/FileController.java +++ b/src/main/java/com/hisense/monitormanage/controller/FileController.java @@ -32,11 +32,4 @@ public class FileController { Result success = Result.success(s); return success; } - - @GetMapping("token") - public Result token( ) { - String s = monitorService.init(); - Result success = Result.success(s); - return success; - } } diff --git a/src/main/java/com/hisense/monitormanage/controller/SanitationController.java b/src/main/java/com/hisense/monitormanage/controller/SanitationController.java index 7f87a8e..df48a02 100644 --- a/src/main/java/com/hisense/monitormanage/controller/SanitationController.java +++ b/src/main/java/com/hisense/monitormanage/controller/SanitationController.java @@ -1,6 +1,5 @@ package com.hisense.monitormanage.controller; -import com.baomidou.mybatisplus.extension.api.R; import com.hisense.monitormanage.entity.Result; import com.hisense.monitormanage.service.SanitationService; import io.swagger.annotations.Api; diff --git a/src/main/java/com/hisense/monitormanage/controller/StaticController.java b/src/main/java/com/hisense/monitormanage/controller/StaticController.java index 059fc45..b7ca29b 100644 --- a/src/main/java/com/hisense/monitormanage/controller/StaticController.java +++ b/src/main/java/com/hisense/monitormanage/controller/StaticController.java @@ -3,24 +3,15 @@ package com.hisense.monitormanage.controller; import cn.hutool.core.date.DateUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.hisense.monitormanage.dto.ChengguanDto; -import com.hisense.monitormanage.dto.ScenicCameraDto; import com.hisense.monitormanage.entity.Camera; -import com.hisense.monitormanage.entity.Picture; -import com.hisense.monitormanage.entity.Project; import com.hisense.monitormanage.entity.Result; import com.hisense.monitormanage.mapper.CameraMapper; -import com.hisense.monitormanage.mapper.ProjectMapper; -import com.hisense.monitormanage.mapper.ScenicMapper; -import com.hisense.monitormanage.service.MonitorService; -import io.swagger.annotations.Api; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import java.util.Date; import java.util.HashMap; -import java.util.List; @RestController @RequestMapping("api/static") diff --git a/src/main/java/com/hisense/monitormanage/dto/ChengguanDto.java b/src/main/java/com/hisense/monitormanage/dto/ChengguanDto.java index d3e71e6..c006be8 100644 --- a/src/main/java/com/hisense/monitormanage/dto/ChengguanDto.java +++ b/src/main/java/com/hisense/monitormanage/dto/ChengguanDto.java @@ -1,12 +1,9 @@ package com.hisense.monitormanage.dto; -import com.fasterxml.jackson.annotation.JsonFormat; import com.hisense.monitormanage.entity.Camera; import lombok.Data; -import java.util.Date; - @Data public class ChengguanDto extends Camera { diff --git a/src/main/java/com/hisense/monitormanage/entity/CameraCheck.java b/src/main/java/com/hisense/monitormanage/entity/CameraCheck.java index 2b87861..3e32fd3 100644 --- a/src/main/java/com/hisense/monitormanage/entity/CameraCheck.java +++ b/src/main/java/com/hisense/monitormanage/entity/CameraCheck.java @@ -1,10 +1,8 @@ package com.hisense.monitormanage.entity; -import com.fasterxml.jackson.annotation.JsonFormat; import lombok.Getter; import lombok.Setter; -import java.time.ZonedDateTime; /** * @author admin diff --git a/src/main/java/com/hisense/monitormanage/entity/ChannelPicture.java b/src/main/java/com/hisense/monitormanage/entity/ChannelPicture.java index 5fbeabe..ae5e7ff 100644 --- a/src/main/java/com/hisense/monitormanage/entity/ChannelPicture.java +++ b/src/main/java/com/hisense/monitormanage/entity/ChannelPicture.java @@ -1,7 +1,5 @@ package com.hisense.monitormanage.entity; -import com.baomidou.mybatisplus.annotation.FieldFill; -import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import com.fasterxml.jackson.annotation.JsonFormat; diff --git a/src/main/java/com/hisense/monitormanage/entity/Project.java b/src/main/java/com/hisense/monitormanage/entity/Project.java index e77ee0f..18fb390 100644 --- a/src/main/java/com/hisense/monitormanage/entity/Project.java +++ b/src/main/java/com/hisense/monitormanage/entity/Project.java @@ -7,7 +7,6 @@ import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; import java.util.List; -import java.util.Map; @Data @TableName("t_project") diff --git a/src/main/java/com/hisense/monitormanage/entity/SedimentTrail.java b/src/main/java/com/hisense/monitormanage/entity/SedimentTrail.java index 81bce71..b2b1f12 100644 --- a/src/main/java/com/hisense/monitormanage/entity/SedimentTrail.java +++ b/src/main/java/com/hisense/monitormanage/entity/SedimentTrail.java @@ -7,7 +7,6 @@ import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; -import java.io.Serializable; import java.time.LocalDateTime; /** diff --git a/src/main/java/com/hisense/monitormanage/mapper/BuildingRecordsMapper.java b/src/main/java/com/hisense/monitormanage/mapper/BuildingRecordsMapper.java index 0406164..2c16f52 100644 --- a/src/main/java/com/hisense/monitormanage/mapper/BuildingRecordsMapper.java +++ b/src/main/java/com/hisense/monitormanage/mapper/BuildingRecordsMapper.java @@ -3,8 +3,6 @@ package com.hisense.monitormanage.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.hisense.monitormanage.dto.BuildingRecordsDto; import com.hisense.monitormanage.entity.BuildingRecords; -import com.hisense.monitormanage.entity.CameraChannel; -import com.hisense.monitormanage.entity.Label; import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Select; diff --git a/src/main/java/com/hisense/monitormanage/mapper/EventMapper.java b/src/main/java/com/hisense/monitormanage/mapper/EventMapper.java index 3a68efb..72e4a8f 100644 --- a/src/main/java/com/hisense/monitormanage/mapper/EventMapper.java +++ b/src/main/java/com/hisense/monitormanage/mapper/EventMapper.java @@ -12,6 +12,9 @@ public interface EventMapper extends BaseMapper { List selectEvent(@Param("page") Integer page,@Param("pageSize") Integer pageSize); + @Select("select count(*) from t_event where track_event = 'START'") + Integer selectCountEvent(); + @Select("SELECT * FROM t_event where TO_DAYS(capture_time) = TO_DAYS(NOW()) AND track_event = 'START'") List selectByTime(); diff --git a/src/main/java/com/hisense/monitormanage/mapper/ProjectMapper.java b/src/main/java/com/hisense/monitormanage/mapper/ProjectMapper.java index c5a361a..d86a379 100644 --- a/src/main/java/com/hisense/monitormanage/mapper/ProjectMapper.java +++ b/src/main/java/com/hisense/monitormanage/mapper/ProjectMapper.java @@ -3,8 +3,6 @@ package com.hisense.monitormanage.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.hisense.monitormanage.entity.Project; -import java.util.List; - public interface ProjectMapper extends BaseMapper { } diff --git a/src/main/java/com/hisense/monitormanage/service/BuildingRecordsService.java b/src/main/java/com/hisense/monitormanage/service/BuildingRecordsService.java index 02e05b6..617bbb5 100644 --- a/src/main/java/com/hisense/monitormanage/service/BuildingRecordsService.java +++ b/src/main/java/com/hisense/monitormanage/service/BuildingRecordsService.java @@ -11,8 +11,6 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.ResponseEntity; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Service; -import org.springframework.util.LinkedMultiValueMap; -import org.springframework.util.MultiValueMap; import org.springframework.web.client.RestTemplate; import java.util.ArrayList; diff --git a/src/main/java/com/hisense/monitormanage/service/CameraChannelService.java b/src/main/java/com/hisense/monitormanage/service/CameraChannelService.java index 2b33b0e..519af63 100644 --- a/src/main/java/com/hisense/monitormanage/service/CameraChannelService.java +++ b/src/main/java/com/hisense/monitormanage/service/CameraChannelService.java @@ -2,13 +2,9 @@ package com.hisense.monitormanage.service; import com.alibaba.fastjson.JSONObject; import com.hisense.monitormanage.dto.CameraChannelDto; -import com.hisense.monitormanage.entity.CameraChannel; -import com.hisense.monitormanage.entity.Result; import com.hisense.monitormanage.mapper.CameraChannelMapper; import com.hisense.monitormanage.utils.EhcacheUtil; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.cache.Cache; -import org.springframework.cache.annotation.Cacheable; import org.springframework.cache.ehcache.EhCacheCacheManager; import org.springframework.stereotype.Service; import org.springframework.util.StringUtils; diff --git a/src/main/java/com/hisense/monitormanage/service/MonitorService.java b/src/main/java/com/hisense/monitormanage/service/MonitorService.java index 6f9cae3..28e3e6d 100644 --- a/src/main/java/com/hisense/monitormanage/service/MonitorService.java +++ b/src/main/java/com/hisense/monitormanage/service/MonitorService.java @@ -1,6 +1,5 @@ package com.hisense.monitormanage.service; -import cn.hutool.core.collection.ListUtil; import cn.hutool.crypto.SecureUtil; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; @@ -18,7 +17,6 @@ import org.springframework.beans.factory.annotation.Value; import org.springframework.http.*; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; import org.springframework.util.Base64Utils; import org.springframework.util.LinkedMultiValueMap; import org.springframework.util.MultiValueMap; @@ -39,7 +37,6 @@ import java.time.ZonedDateTime; import java.time.format.DateTimeFormatter; import java.util.*; import java.util.List; -import java.util.stream.Collectors; @Service @@ -90,7 +87,7 @@ public class MonitorService { static int keepaliveCount = 16; @PostConstruct - public String init(){ + public void init(){ String loginUrl = monitorDomain + "/videoService/accounts/authorize"; HashMap loginParam = new HashMap<>(); @@ -128,13 +125,13 @@ public class MonitorService { String token = (String) reponse.get("token"); if (token== null || StringUtils.isEmpty(token)){ log.error("[monitor-capture]:" + "监控系统登录失败"); - return ""; + return; } this.token = token; Integer duration = (Integer) reponse.get("duration"); if (duration == null || duration < 20){ log.error("[monitor-capture]:" + "监控系统失效时间异常" + duration); - return ""; + return; } duration = duration - 20; @@ -171,14 +168,9 @@ public class MonitorService { timer.cancel(); thatMonitorService.start(); } - - - } }, 0, duration * 1000); } - - return token; } @Scheduled(cron = "0 0 8 * * ?") diff --git a/src/main/java/com/hisense/monitormanage/service/RoadDataService.java b/src/main/java/com/hisense/monitormanage/service/RoadDataService.java index 0bee607..64bdb41 100644 --- a/src/main/java/com/hisense/monitormanage/service/RoadDataService.java +++ b/src/main/java/com/hisense/monitormanage/service/RoadDataService.java @@ -12,7 +12,6 @@ import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Service; -import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.client.RestTemplate; import java.time.LocalDate; diff --git a/src/main/java/com/hisense/monitormanage/service/SJZTService.java b/src/main/java/com/hisense/monitormanage/service/SJZTService.java index 62b263d..adcf06f 100644 --- a/src/main/java/com/hisense/monitormanage/service/SJZTService.java +++ b/src/main/java/com/hisense/monitormanage/service/SJZTService.java @@ -6,7 +6,6 @@ import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.incrementer.DefaultIdentifierGenerator; import com.baomidou.mybatisplus.core.incrementer.IdentifierGenerator; -import com.baomidou.mybatisplus.extension.api.R; import com.google.common.collect.Lists; import com.hisense.monitormanage.entity.CaseCityLaw; import com.hisense.monitormanage.entity.Result; @@ -22,8 +21,6 @@ import org.springframework.util.LinkedMultiValueMap; import org.springframework.util.MultiValueMap; import org.springframework.web.client.RestTemplate; -import java.io.UnsupportedEncodingException; -import java.net.URLEncoder; import java.time.LocalDate; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; diff --git a/src/main/java/com/hisense/monitormanage/service/SedimentTrailService.java b/src/main/java/com/hisense/monitormanage/service/SedimentTrailService.java index 90bbb20..beb3843 100644 --- a/src/main/java/com/hisense/monitormanage/service/SedimentTrailService.java +++ b/src/main/java/com/hisense/monitormanage/service/SedimentTrailService.java @@ -5,18 +5,14 @@ import com.google.common.collect.Lists; import com.hisense.monitormanage.entity.SedimentTrail; import com.hisense.monitormanage.mapper.SedimentTrailMapper; import com.hisense.monitormanage.utils.LongLatUtil; -import lombok.extern.log4j.Log4j2; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; -import org.springframework.web.bind.annotation.RequestParam; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.stream.Collector; import java.util.stream.Collectors; /** diff --git a/src/main/java/com/hisense/monitormanage/service/TrailSanitationService.java b/src/main/java/com/hisense/monitormanage/service/TrailSanitationService.java index 113663d..313a4d8 100644 --- a/src/main/java/com/hisense/monitormanage/service/TrailSanitationService.java +++ b/src/main/java/com/hisense/monitormanage/service/TrailSanitationService.java @@ -2,7 +2,6 @@ package com.hisense.monitormanage.service; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.google.common.collect.Lists; -import com.hisense.monitormanage.entity.SedimentTrail; import com.hisense.monitormanage.entity.TrailSanitation; import com.hisense.monitormanage.mapper.TrailSanitationMapper; import com.hisense.monitormanage.utils.LongLatUtil;