diff --git a/src/main/java/com/hisense/monitormanage/controller/KeyAreaController.java b/src/main/java/com/hisense/monitormanage/controller/KeyAreaController.java new file mode 100644 index 0000000..17cabda --- /dev/null +++ b/src/main/java/com/hisense/monitormanage/controller/KeyAreaController.java @@ -0,0 +1,38 @@ +package com.hisense.monitormanage.controller; + +import com.hisense.monitormanage.dto.KeyAreaDto; +import com.hisense.monitormanage.entity.PassengerFlow; +import com.hisense.monitormanage.entity.Result; +import com.hisense.monitormanage.mapper.KeyAreaMapper; +import com.hisense.monitormanage.mapper.PassengerFlowMapper; +import io.swagger.annotations.Api; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; + +@RestController +@RequestMapping("api/project/keyArea") +@Api(tags = "重点区域") +public class KeyAreaController { + + @Autowired + private KeyAreaMapper keyAreaMapper; + + @Autowired + private PassengerFlowMapper passengerFlowMapper; + + @GetMapping("seelctKeyAreaList") + public Result seelctKeyAreaList(String type){ + PassengerFlow maxId = passengerFlowMapper.getByMaxId(); + String timeId = maxId.getTimeId(); + List keyAreaDtos = keyAreaMapper.seelctKeyAreaList(type,timeId); + keyAreaDtos.forEach(keyAreaDto -> { + keyAreaDto.setTimeId(timeId); + }); + Result success = Result.success(keyAreaDtos); + return success; + } +} diff --git a/src/main/java/com/hisense/monitormanage/dto/KeyAreaDto.java b/src/main/java/com/hisense/monitormanage/dto/KeyAreaDto.java new file mode 100644 index 0000000..7778a8b --- /dev/null +++ b/src/main/java/com/hisense/monitormanage/dto/KeyAreaDto.java @@ -0,0 +1,12 @@ +package com.hisense.monitormanage.dto; + +import lombok.Data; + +@Data +public class KeyAreaDto { + private String type; + private String areaName; + private String location; + private String allNums; + private String timeId; +} diff --git a/src/main/java/com/hisense/monitormanage/mapper/CameraChannelMapper.java b/src/main/java/com/hisense/monitormanage/mapper/CameraChannelMapper.java index d390b87..995e3af 100644 --- a/src/main/java/com/hisense/monitormanage/mapper/CameraChannelMapper.java +++ b/src/main/java/com/hisense/monitormanage/mapper/CameraChannelMapper.java @@ -58,6 +58,6 @@ public interface CameraChannelMapper extends BaseMapper { List selectNLAll(@Param("page") Integer page,@Param("pageSize") Integer pageSize); - @Select("SELECT * FROM t_camera_channel WHERE channel_code < '404_37020323541317325139' AND channel_code > '404_37020300001310016729' ORDER BY channel_code DESC" ) + @Select("SELECT * FROM t_camera_channel WHERE channel_code < '404_37020310541317325240' AND channel_code > '404_37020300001310016729' ORDER BY channel_code DESC" ) List selectCameraChannel(); } diff --git a/src/main/java/com/hisense/monitormanage/mapper/KeyAreaMapper.java b/src/main/java/com/hisense/monitormanage/mapper/KeyAreaMapper.java index 89b7a59..32b533c 100644 --- a/src/main/java/com/hisense/monitormanage/mapper/KeyAreaMapper.java +++ b/src/main/java/com/hisense/monitormanage/mapper/KeyAreaMapper.java @@ -1,8 +1,10 @@ package com.hisense.monitormanage.mapper; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.hisense.monitormanage.dto.KeyAreaDto; import com.hisense.monitormanage.entity.KeyArea; +import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Select; import org.springframework.stereotype.Repository; import java.util.List; @@ -10,5 +12,9 @@ import java.util.List; @Repository public interface KeyAreaMapper extends BaseMapper { - List seelctKeyAreaList(String timeId); + @Select("select ka.type,ka.area_name,ka.location,ss.allNums from t_key_area ka LEFT JOIN (select pt.area_name,SUM(pf.all_nums) as allNums from t_passenger_flow pf JOIN t_passenger_test pt ON pf.longitude = pt.longitude AND pf.latitude = pt.latitude WHERE pf.time_id = #{timeId} AND pt.type = #{type} GROUP BY pt.area_name) ss ON ka.area_name = ss.area_name WHERE ka.type = #{type}") + List seelctKeyAreaList(@Param("type") String type,@Param("timeId") String timeId); + + + } diff --git a/src/main/java/com/hisense/monitormanage/service/MonitorService.java b/src/main/java/com/hisense/monitormanage/service/MonitorService.java index fb215ce..0ee98aa 100644 --- a/src/main/java/com/hisense/monitormanage/service/MonitorService.java +++ b/src/main/java/com/hisense/monitormanage/service/MonitorService.java @@ -298,7 +298,7 @@ public class MonitorService { } } - @Scheduled(cron = "0 0 7 * * ?") + @Scheduled(cron = "0 30 8 * * ?") public void CameraScreenshot () { try { log.info("[monitor-capture]: start capture");