添加当天道路污染事件

添加当天扬尘和噪声事件
优化事件接口
This commit is contained in:
wuweida 2022-07-21 11:27:42 +08:00
parent 720a57d40d
commit ec821744db
9 changed files with 95 additions and 47 deletions

View File

@ -4,7 +4,9 @@ import com.hisense.monitormanage.dto.BuildingRecordsDto;
import com.hisense.monitormanage.dto.BuildingRecordsDtos;
import com.hisense.monitormanage.entity.BuildingRecords;
import com.hisense.monitormanage.entity.Result;
import com.hisense.monitormanage.entity.RoadData;
import com.hisense.monitormanage.mapper.BuildingRecordsMapper;
import com.hisense.monitormanage.mapper.RoadDataMapper;
import com.hisense.monitormanage.service.BuildingRecordsService;
import com.hisense.monitormanage.utils.LongLatUtil;
import io.swagger.annotations.Api;
@ -17,6 +19,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.time.LocalDateTime;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -39,6 +42,9 @@ public class BuildingController {
@Autowired
private BuildingRecordsMapper buildingRecordsMapper;
@Autowired
private RoadDataMapper roadDataMapper;
@GetMapping("/getRecords")
@ApiOperation("测试,获取工地实时数据--调用接口")
public List<Map> getRecords(){
@ -73,8 +79,8 @@ public class BuildingController {
@GetMapping("selectAllBuilding")
@ApiOperation("查询所有工地")
public Result selectAllBuilding(){
List<BuildingRecordsDto> recordsDtos = buildingRecordsMapper.selectAllBuilding();
Result success = Result.success(recordsDtos);
List<BuildingRecordsDto> records = buildingRecordsMapper.selectAllBuilding();
Result success = Result.success(records);
return success;
}
@ -103,14 +109,14 @@ public class BuildingController {
@GetMapping("selectMonthPmAndNoice")
@ApiOperation("查询近30天工地噪声和扬尘的信息")
public Result selectMonthPmAndNoice(String buildLicense){
List<BuildingRecordsDtos> recordsDtos = buildingRecordsMapper.selectMonthPmAndNoice(buildLicense);
recordsDtos.forEach(record ->{
List<BuildingRecordsDtos> records = buildingRecordsMapper.selectMonthPmAndNoice(buildLicense);
records.forEach(record ->{
if (record.getPm10() == null && record.getNoice() == null){
record.setPm10(0);
record.setNoice(0);
}
});
Result success = Result.success(recordsDtos);
Result success = Result.success(records);
return success;
}
@ -121,11 +127,10 @@ public class BuildingController {
@GetMapping("selectRaise")
@ApiOperation("查询工地扬尘事件")
public Result selectRaise(Integer page,Integer pageSize){
List<BuildingRecordsDto> recordsDtos = buildingRecordsMapper.selectRaise(page,pageSize);
Integer integer = buildingRecordsMapper.selectCountRaise();
List<BuildingRecordsDto> records = buildingRecordsMapper.selectRaise(page,pageSize);
Map<String,Object> map = new HashMap<>();
map.put("sum",integer);
map.put("data",recordsDtos);
map.put("sum",records.size());
map.put("data",records);
Result success = Result.success(map);
return success;
}
@ -137,11 +142,10 @@ public class BuildingController {
@GetMapping("selectNoiceEvent")
@ApiOperation("查询工地噪声事件")
public Result selectNoiceEvent(Integer page,Integer pageSize){
List<BuildingRecordsDto> recordsDtos = buildingRecordsMapper.selectNoiceEvent(page,pageSize);
Integer integer = buildingRecordsMapper.selectCountNoice();
List<BuildingRecordsDto> records = buildingRecordsMapper.selectNoiceEvent(page,pageSize);
Map<String,Object> map = new HashMap<>();
map.put("sum",integer);
map.put("data",recordsDtos);
map.put("sum",records.size());
map.put("data",records);
Result success = Result.success(map);
return success;
}
@ -155,8 +159,8 @@ public class BuildingController {
@ApiOperation("根据工地名称搜索工地")
@ApiImplicitParam(name = "projectName", value = "工地名称",required = true,dataType ="String")
public Result selectByProjectName(String projectName){
List<BuildingRecordsDto> recordsDtos = buildingRecordsMapper.selectByProjectName(projectName);
Result success = Result.success(recordsDtos);
List<BuildingRecordsDto> records = buildingRecordsMapper.selectByProjectName(projectName);
Result success = Result.success(records);
return success;
}
@ -181,5 +185,52 @@ public class BuildingController {
return success;
}
/**
* 查询当天扬尘事件
* @return
*/
@GetMapping("selectByDayRaise")
@ApiOperation("查询当天扬尘事件")
public Result selectByDayRaise(){
List<BuildingRecordsDto> records = buildingRecordsMapper.selectByDayRaise();
Map<String,Object> map = new HashMap<>();
map.put("sum",records.size());
map.put("data",records);
Result success = Result.success(map);
return success;
}
/**
* 查询当天噪声事件
* @return
*/
@GetMapping("selectByDayNoice")
@ApiOperation("查询当天噪声事件")
public Result selectByDayNoice(){
List<BuildingRecordsDto> records = buildingRecordsMapper.selectByDayNoice();
Map<String,Object> map = new HashMap<>();
map.put("sum",records.size());
map.put("data",records);
Result success = Result.success(map);
return success;
}
/**
* 查询当天道路污染事件
* @return
*/
@GetMapping("selectByDayRoadData")
@ApiOperation("查询当天道路污染事件")
public Result selectByDayRoadData(){
RoadData byMaxId = roadDataMapper.getByMaxId();
String dt = byMaxId.getDt();
List<RoadData> roadData = buildingRecordsMapper.selectByDayRoadData(dt);
Map<String,Object> map = new HashMap<>();
map.put("sum",roadData.size());
map.put("data",roadData);
Result success = Result.success(map);
return success;
}
}

View File

@ -208,9 +208,8 @@ public class EventController {
for (EventDto list: lists) {
list.setEventNewName("环境卫生");
}
Integer integer = eventMapper.selectCountByName("'塑料篮子','纸箱','街头散落垃圾'");
Map<String,Object> map = new HashMap<>();
map.put("sum",integer);
map.put("sum",lists.size());
map.put("events",lists);
Result success = Result.success(map);
return success;
@ -219,9 +218,8 @@ public class EventController {
for (EventDto list: lists) {
list.setEventNewName("占道经营");
}
Integer integer = eventMapper.selectCountByName("'街头伞篷','水果和食品摊','地摊','户外桌椅'");
Map<String,Object> map = new HashMap<>();
map.put("sum",integer);
map.put("sum",lists.size());
map.put("events",lists);
Result success = Result.success(map);
return success;
@ -230,9 +228,8 @@ public class EventController {
for (EventDto list: lists) {
list.setEventNewName("沿街晾晒");
}
Integer integer = eventMapper.selectCountByName("'沿街晾晒衣物被单'");
Map<String,Object> map = new HashMap<>();
map.put("sum",integer);
map.put("sum",lists.size());
map.put("events",lists);
Result success = Result.success(map);
return success;
@ -241,9 +238,8 @@ public class EventController {
for (EventDto list: lists) {
list.setEventNewName("违章停车");
}
Integer integer = eventMapper.selectCountByName("'机动车违停'");
Map<String,Object> map = new HashMap<>();
map.put("sum",integer);
map.put("sum",lists.size());
map.put("events",lists);
Result success = Result.success(map);
return success;
@ -252,9 +248,8 @@ public class EventController {
for (EventDto list : lists) {
list.setEventNewName("渣土车发现");
}
Integer integer = eventMapper.selectCountByName("'渣土车发现'");
Map<String,Object> map = new HashMap<>();
map.put("sum",integer);
map.put("sum",lists.size());
map.put("events",lists);
Result success = Result.success(map);
return success;
@ -263,9 +258,8 @@ public class EventController {
for (EventDto list : lists) {
list.setEventNewName("安保区域人员滞留");
}
Integer integer = eventMapper.selectCountByName("'安保区域人员滞留'");
Map<String,Object> map = new HashMap<>();
map.put("sum",integer);
map.put("sum",lists.size());
map.put("events",lists);
Result success = Result.success(map);
return success;
@ -274,9 +268,8 @@ public class EventController {
for (EventDto list : lists) {
list.setEventNewName("安保区域人员徘徊");
}
Integer integer = eventMapper.selectCountByName("'安保区域人员徘徊'");
Map<String,Object> map = new HashMap<>();
map.put("sum",integer);
map.put("sum",lists.size());
map.put("events",lists);
Result success = Result.success(map);
return success;
@ -285,9 +278,8 @@ public class EventController {
for (EventDto list : lists) {
list.setEventNewName("渣土车未密闭");
}
Integer integer = eventMapper.selectCountByName("'渣土车未密闭'");
Map<String,Object> map = new HashMap<>();
map.put("sum",integer);
map.put("sum",lists.size());
map.put("events",lists);
Result success = Result.success(map);
return success;
@ -296,9 +288,8 @@ public class EventController {
for (EventDto list : lists) {
list.setEventNewName("道路积水事件");
}
Integer integer = eventMapper.selectCountByName("'道路积水事件'");
Map<String,Object> map = new HashMap<>();
map.put("sum",integer);
map.put("sum",lists.size());
map.put("events",lists);
Result success = Result.success(map);
return success;

View File

@ -54,6 +54,6 @@ public class RoadData {
private String points;
@JsonFormat(pattern="yyyy-MM-dd mm:HH:ss",timezone = "GMT+8")
private LocalDateTime dt;
private String dt;
}

View File

@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hisense.monitormanage.dto.BuildingRecordsDto;
import com.hisense.monitormanage.dto.BuildingRecordsDtos;
import com.hisense.monitormanage.entity.BuildingRecords;
import com.hisense.monitormanage.entity.RoadData;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;
@ -21,7 +22,7 @@ import java.util.Map;
@Repository
public interface BuildingRecordsMapper extends BaseMapper<BuildingRecords> {
public void batchSave(@Param("list") List<Map> list);
void batchSave(@Param("list") List<Map> list);
void batchUpdate(@Param("list") List<Map> list);
@ -37,13 +38,6 @@ public interface BuildingRecordsMapper extends BaseMapper<BuildingRecords> {
List<BuildingRecordsDto> selectNoiceEvent(@Param("page") Integer page,@Param("pageSize") Integer pageSize);
@Select("select COUNT(*) from (select br.pm10 from t_building_records br JOIN t_building_new_site bs ON br.project_name = bs.gdmc where br.pm10 > 80) a ")
Integer selectCountRaise();
@Select("SELECT COUNT(*) FROM (SELECT br.noice,br.push_time FROM t_building_records br JOIN t_building_new_site bs ON br.project_name = bs.gdmc WHERE (hour(br.push_time)>=22 or 6 > hour(br.push_time)) AND br.noice > 55 " +
"UNION SELECT br.noice,br.push_time FROM t_building_records br JOIN t_building_new_site bs ON br.project_name = bs.gdmc WHERE DATE_FORMAT(br.push_time,'%H')>=6 AND DATE_FORMAT(br.push_time,'%H')<=22 AND br.noice > 70) a")
Integer selectCountNoice();
@Select("select br.*,bs.sgwz,bs.jd,bs.wd,bs.ssdq,bs.yjsg from t_building_records br JOIN t_building_new_site bs on br.project_name = bs.gdmc" +
" where br.project_name like concat('%',#{projectName},'%')")
List<BuildingRecordsDto> selectByProjectName(String projectName);
@ -55,4 +49,12 @@ public interface BuildingRecordsMapper extends BaseMapper<BuildingRecords> {
@Param("jd1") Double jd1,
@Param("wd") Double wd,
@Param("wd1") Double wd1);
@Select("select * from t_building_records br JOIN t_building_new_site bs ON br.project_name = bs.gdmc where TO_DAYS(push_time) = TO_DAYS(NOW()) AND br.pm10 > 80")
List<BuildingRecordsDto> selectByDayRaise();
@Select("SELECT a.* FROM (SELECT br.noice,br.push_time,br.project_name,bs.jd,bs.wd,bs.channel_name,bs.sgwz,bs.ssdq FROM t_building_records br JOIN t_building_new_site bs ON br.project_name = bs.gdmc WHERE (hour(br.push_time)>=22 or 6 > hour(br.push_time)) AND br.noice > 55 AND TO_DAYS(br.push_time) = TO_DAYS(NOW()) UNION SELECT br.noice,br.push_time,br.project_name,bs.jd,bs.wd,bs.channel_name,bs.sgwz,bs.ssdq FROM t_building_records br JOIN t_building_new_site bs ON br.project_name = bs.gdmc WHERE DATE_FORMAT(br.push_time,'%H')>=6 AND DATE_FORMAT(br.push_time,'%H') < 22 AND br.noice > 70 AND TO_DAYS(br.push_time) = TO_DAYS(NOW())) a")
List<BuildingRecordsDto> selectByDayNoice();
@Select("select * from t_road_data where pm10 > 150 AND dt = #{dt}")
List<RoadData> selectByDayRoadData(String dt);
}

View File

@ -58,6 +58,6 @@ public interface CameraChannelMapper extends BaseMapper<CameraChannel> {
List<CameraChannelNLDto> selectNLAll(@Param("page") Integer page,@Param("pageSize") Integer pageSize);
@Select("SELECT * FROM t_camera_channel WHERE channel_code < '183_37028301831321232723' AND channel_code > '183_37028301831321231067' ORDER BY channel_code DESC" )
@Select("SELECT * FROM t_camera_channel WHERE channel_code < '183_37028301831321231117' AND channel_code > '183_37028301001328630804' ORDER BY channel_code DESC")
List<CameraChannel> selectCameraChannel();
}

View File

@ -22,9 +22,6 @@ public interface EventMapper extends BaseMapper<Event> {
List<EventDto> selectByName(@Param("eventNewName") String eventNewName,@Param("page") Integer page,@Param("pageSize") Integer pageSize);
@Select("select count(*) from t_event where track_event = 'START' and event_cn_name in (${eventNewName})")
Integer selectCountByName(@Param("eventNewName")String eventNewName);
@Select("SELECT * FROM t_event where TO_DAYS(capture_time) = TO_DAYS(NOW()) AND event_cn_name in (${eventNewName}) AND track_event = 'START'")
List<EventDto> selectByTimeAndName(@Param("eventNewName") String eventNewName);
}

View File

@ -1,6 +1,7 @@
package com.hisense.monitormanage.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hisense.monitormanage.entity.PassengerFlow;
import com.hisense.monitormanage.entity.RoadData;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
@ -25,4 +26,6 @@ public interface RoadDataMapper extends BaseMapper<RoadData> {
@Select("select count(*) from t_road_data where pm10 > 150")
Integer selectCountRoadData();
RoadData getByMaxId();
}

View File

@ -307,7 +307,7 @@ public class MonitorService {
/**
* 所有摄像头抓图 sql持续更新
*/
//@Scheduled(cron = "0 0 6 * * ?")
@Scheduled(cron = "0 0 6 * * ?")
public void CameraScreenshot () {
try {
log.info("[monitor-capture]: start capture");

View File

@ -22,4 +22,8 @@
limit #{page},#{pageSize}
</select>
<select id="getByMaxId" resultType="com.hisense.monitormanage.entity.RoadData">
select * from t_road_data ORDER BY id DESC limit 1
</select>
</mapper>