工地接口添加近7天近30天扬尘 噪声 和视频感知事件
This commit is contained in:
parent
ecd9d97bef
commit
e541fba4a0
11
pom.xml
11
pom.xml
|
@ -123,6 +123,17 @@
|
||||||
<version>1.9.2</version>
|
<version>1.9.2</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.poi</groupId>
|
||||||
|
<artifactId>poi-ooxml</artifactId>
|
||||||
|
<version>3.11</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.alibaba</groupId>
|
||||||
|
<artifactId>easyexcel</artifactId>
|
||||||
|
<version>2.2.6</version>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<dependencyManagement>
|
<dependencyManagement>
|
||||||
|
|
|
@ -286,5 +286,107 @@ public class BuildingController {
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*@GetMapping("exportEvent")
|
||||||
|
public void exportRaiseEvent() throws Exception {
|
||||||
|
buildingRecordsService.testHSSF();
|
||||||
|
}*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询近7天噪声事件
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping("selectByWeekNoice")
|
||||||
|
@ApiOperation("查询近7天噪声事件")
|
||||||
|
public Result selectByWeekNoice(){
|
||||||
|
List<BuildingRecordsDto> buildingRecordsDtos = buildingRecordsMapper.selectByWeekNoice();
|
||||||
|
Map<String,Object> map = new HashMap<>();
|
||||||
|
map.put("sum",buildingRecordsDtos.size());
|
||||||
|
map.put("data",buildingRecordsDtos);
|
||||||
|
Result success = Result.success(map);
|
||||||
|
return success;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询近30天噪声事件
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping("selectByMonthNoice")
|
||||||
|
@ApiOperation("查询近30天噪声事件")
|
||||||
|
public Result selectByMonthNoice(){
|
||||||
|
List<BuildingRecordsDto> buildingRecordsDtos = buildingRecordsMapper.selectByMonthNoice();
|
||||||
|
Map<String,Object> map = new HashMap<>();
|
||||||
|
map.put("sum",buildingRecordsDtos.size());
|
||||||
|
map.put("data",buildingRecordsDtos);
|
||||||
|
Result success = Result.success(map);
|
||||||
|
return success;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询近7天扬尘事件
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping("selectByWeekNaise")
|
||||||
|
@ApiOperation("查询近7天扬尘事件")
|
||||||
|
public Result selectByWeekNaise(){
|
||||||
|
List<BuildingRecordsDto> buildingRecordsDtos = buildingRecordsMapper.selectByWeekNaise();
|
||||||
|
Map<String,Object> map = new HashMap<>();
|
||||||
|
map.put("sum",buildingRecordsDtos.size());
|
||||||
|
map.put("data",buildingRecordsDtos);
|
||||||
|
Result success = Result.success(map);
|
||||||
|
return success;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询近30天扬尘事件
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping("selectByMonthNaise")
|
||||||
|
@ApiOperation("查询近30天扬尘事件")
|
||||||
|
public Result selectByMonthNaise(){
|
||||||
|
List<BuildingRecordsDto> buildingRecordsDtos = buildingRecordsMapper.selectByMonthNaise();
|
||||||
|
Map<String,Object> map = new HashMap<>();
|
||||||
|
map.put("sum",buildingRecordsDtos.size());
|
||||||
|
map.put("data",buildingRecordsDtos);
|
||||||
|
Result success = Result.success(map);
|
||||||
|
return success;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询近7天工地视频感知事件
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping("selectByWeekEvent")
|
||||||
|
@ApiOperation("查询近7天工地视频感知事件")
|
||||||
|
public Result selectByWeekEvent(){
|
||||||
|
List<EventDto> events = buildingRecordsMapper.selectByWeekEvent();
|
||||||
|
events.forEach(eventDto -> {
|
||||||
|
eventDto.setEventNewName(eventDto.getEventCnName());
|
||||||
|
});
|
||||||
|
Map<String,Object> map = new HashMap<>();
|
||||||
|
map.put("sum",events.size());
|
||||||
|
map.put("data",events);
|
||||||
|
Result success = Result.success(map);
|
||||||
|
return success;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询近30天工地视频感知事件
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping("selectByMonthEvent")
|
||||||
|
@ApiOperation("查询近30天工地视频感知事件")
|
||||||
|
public Result selectByMonthEvent(){
|
||||||
|
List<EventDto> events = buildingRecordsMapper.selectByMonthEvent();
|
||||||
|
events.forEach(eventDto -> {
|
||||||
|
eventDto.setEventNewName(eventDto.getEventCnName());
|
||||||
|
});
|
||||||
|
Map<String,Object> map = new HashMap<>();
|
||||||
|
map.put("sum",events.size());
|
||||||
|
map.put("data",events);
|
||||||
|
Result success = Result.success(map);
|
||||||
|
return success;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,36 +1,53 @@
|
||||||
package com.hisense.monitormanage.dto;
|
package com.hisense.monitormanage.dto;
|
||||||
|
|
||||||
|
import com.alibaba.excel.annotation.ExcelProperty;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class BuildingRecordsDto {
|
public class BuildingRecordsDto {
|
||||||
|
|
||||||
|
@ExcelProperty(value = {"工地名称"},index = 0)
|
||||||
private String projectName;//工地名称
|
private String projectName;//工地名称
|
||||||
|
|
||||||
|
@ExcelProperty(value = {"建筑编号"},index = 1)
|
||||||
private String buildLicense;//建筑编号
|
private String buildLicense;//建筑编号
|
||||||
|
|
||||||
|
@ExcelProperty(value = {"推送时间"},index = 2)
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
|
||||||
private String pushTime;//推送时间
|
private String pushTime;//推送时间
|
||||||
|
|
||||||
|
@ExcelProperty(value = {"appid"},index = 3)
|
||||||
private String appid;
|
private String appid;
|
||||||
|
|
||||||
|
@ExcelProperty(value = {"施工位置"},index = 4)
|
||||||
private String sgwz;//施工位置
|
private String sgwz;//施工位置
|
||||||
|
|
||||||
|
@ExcelProperty(value = {"经度"},index = 5)
|
||||||
private double jd;//经度
|
private double jd;//经度
|
||||||
|
|
||||||
|
@ExcelProperty(value = {"纬度"},index = 6)
|
||||||
private double wd;//纬度
|
private double wd;//纬度
|
||||||
|
|
||||||
|
@ExcelProperty(value = {"所属区域"},index = 7)
|
||||||
private String ssdq;//所属区域
|
private String ssdq;//所属区域
|
||||||
|
|
||||||
|
@ExcelProperty(value = {"扬尘"},index = 8)
|
||||||
private double pm10;//扬尘
|
private double pm10;//扬尘
|
||||||
|
|
||||||
|
@ExcelProperty(value = {"噪声"},index = 9)
|
||||||
private double noice;//噪声
|
private double noice;//噪声
|
||||||
|
|
||||||
|
@ExcelProperty(value = {"夜间施工"},index = 10)
|
||||||
private String yjsg;//夜间施工
|
private String yjsg;//夜间施工
|
||||||
|
|
||||||
|
@ExcelProperty(value = {"图片路径"},index = 11)
|
||||||
private String picUrl;//图片路径
|
private String picUrl;//图片路径
|
||||||
|
|
||||||
|
@ExcelProperty(value = {"摄像头编号"},index = 12)
|
||||||
private String channelCode;//摄像头编号
|
private String channelCode;//摄像头编号
|
||||||
|
|
||||||
|
@ExcelProperty(value = {"摄像头名称"},index = 13)
|
||||||
private String channelName;//摄像头名称
|
private String channelName;//摄像头名称
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,4 +74,16 @@ public interface BuildingRecordsMapper extends BaseMapper<BuildingRecords> {
|
||||||
@Select("select * from t_event te JOIN t_scene_event tse ON te.camera_name = tse.channel_name where te.track_event = 'START' AND TO_DAYS(te.capture_time) = TO_DAYS(NOW())")
|
@Select("select * from t_event te JOIN t_scene_event tse ON te.camera_name = tse.channel_name where te.track_event = 'START' AND TO_DAYS(te.capture_time) = TO_DAYS(NOW())")
|
||||||
List<EventDto> selectByEvent();
|
List<EventDto> selectByEvent();
|
||||||
|
|
||||||
|
List<BuildingRecordsDto> selectByWeekNoice();
|
||||||
|
|
||||||
|
List<BuildingRecordsDto> selectByMonthNoice();
|
||||||
|
|
||||||
|
List<BuildingRecordsDto> selectByWeekNaise();
|
||||||
|
|
||||||
|
List<BuildingRecordsDto> selectByMonthNaise();
|
||||||
|
|
||||||
|
List<EventDto> selectByWeekEvent();
|
||||||
|
|
||||||
|
List<EventDto> selectByMonthEvent();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,19 +4,23 @@ import com.alibaba.fastjson.JSONArray;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
|
import com.hisense.monitormanage.dto.BuildingRecordsDto;
|
||||||
import com.hisense.monitormanage.entity.BuildingRecords;
|
import com.hisense.monitormanage.entity.BuildingRecords;
|
||||||
import com.hisense.monitormanage.mapper.BuildingRecordsMapper;
|
import com.hisense.monitormanage.mapper.BuildingRecordsMapper;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.poi.hssf.usermodel.HSSFCell;
|
||||||
|
import org.apache.poi.hssf.usermodel.HSSFRow;
|
||||||
|
import org.apache.poi.hssf.usermodel.HSSFSheet;
|
||||||
|
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.scheduling.annotation.Scheduled;
|
import org.springframework.scheduling.annotation.Scheduled;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.web.client.RestTemplate;
|
import org.springframework.web.client.RestTemplate;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.io.FileOutputStream;
|
||||||
import java.util.HashMap;
|
import java.lang.reflect.Field;
|
||||||
import java.util.List;
|
import java.util.*;
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author admin
|
* @author admin
|
||||||
|
@ -35,72 +39,100 @@ public class BuildingRecordsService {
|
||||||
@Autowired
|
@Autowired
|
||||||
private RestTemplate restTemplate;
|
private RestTemplate restTemplate;
|
||||||
|
|
||||||
public List<Map> getRecords(){
|
public List<Map> getRecords() {
|
||||||
String url = "http://scxjsw.qingdao.gov.cn/monitorData/real-time";
|
String url = "http://scxjsw.qingdao.gov.cn/monitorData/real-time";
|
||||||
Map<String,String> map = new HashMap<>();
|
Map<String, String> map = new HashMap<>();
|
||||||
map.put("appid","");
|
map.put("appid", "");
|
||||||
map.put("timestamp","");
|
map.put("timestamp", "");
|
||||||
map.put("sign","");
|
map.put("sign", "");
|
||||||
map.put("data","");
|
map.put("data", "");
|
||||||
ResponseEntity<JSONObject> responseEntity;
|
ResponseEntity<JSONObject> responseEntity;
|
||||||
List<Map> maps = new ArrayList<>();
|
List<Map> maps = new ArrayList<>();
|
||||||
try{
|
try {
|
||||||
responseEntity = restTemplate.postForEntity(url,map,JSONObject.class);
|
responseEntity = restTemplate.postForEntity(url, map, JSONObject.class);
|
||||||
if (responseEntity.getStatusCodeValue() == 200) {
|
if (responseEntity.getStatusCodeValue() == 200) {
|
||||||
JSONObject result = responseEntity.getBody();
|
JSONObject result = responseEntity.getBody();
|
||||||
if(result.getIntValue("code") == 0){
|
if (result.getIntValue("code") == 0) {
|
||||||
JSONArray jsonArray = result.getJSONArray("data");
|
JSONArray jsonArray = result.getJSONArray("data");
|
||||||
if(jsonArray != null){
|
if (jsonArray != null) {
|
||||||
maps = JSONObject.parseArray(JSONArray.toJSONString(jsonArray),Map.class);
|
maps = JSONObject.parseArray(JSONArray.toJSONString(jsonArray), Map.class);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}catch (Exception e){
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
log.error("[BuildingRecordsService-getRecords] Exception:"+e.getMessage());
|
log.error("[BuildingRecordsService-getRecords] Exception:" + e.getMessage());
|
||||||
}
|
}
|
||||||
return maps;
|
return maps;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Scheduled(cron = "0 0 8/1 * * ?")
|
@Scheduled(cron = "0 0 8/1 * * ?")
|
||||||
public boolean getAndSaveRecords(){
|
public boolean getAndSaveRecords() {
|
||||||
List<Map> maps = this.getRecords();
|
List<Map> maps = this.getRecords();
|
||||||
boolean result = false;
|
boolean result = false;
|
||||||
if(maps.size() > 0){
|
if (maps.size() > 0) {
|
||||||
List<List<Map>> lists = Lists.partition(maps,200);
|
List<List<Map>> lists = Lists.partition(maps, 200);
|
||||||
try{
|
try {
|
||||||
lists.forEach(l->buildingRecordsMapper.batchSave(l));
|
lists.forEach(l -> buildingRecordsMapper.batchSave(l));
|
||||||
result = true;
|
result = true;
|
||||||
}catch (Exception e){
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
log.error("[BuildingRecordsService-getAndSaveRecords] Exception:"+e.getMessage());
|
log.error("[BuildingRecordsService-getAndSaveRecords] Exception:" + e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public boolean getUpdateRecords(){
|
public boolean getUpdateRecords() {
|
||||||
List<Map> maps = this.getRecords();
|
List<Map> maps = this.getRecords();
|
||||||
boolean result = false;
|
boolean result = false;
|
||||||
if(maps.size() > 0){
|
if (maps.size() > 0) {
|
||||||
List<List<Map>> lists = Lists.partition(maps,200);
|
List<List<Map>> lists = Lists.partition(maps, 200);
|
||||||
try{
|
try {
|
||||||
lists.forEach(l->buildingRecordsMapper.batchUpdate(l));
|
lists.forEach(l -> buildingRecordsMapper.batchUpdate(l));
|
||||||
result = true;
|
result = true;
|
||||||
}catch (Exception e){
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
log.error("[BuildingRecordsService-getUpdateRecords] Exception:"+e.getMessage());
|
log.error("[BuildingRecordsService-getUpdateRecords] Exception:" + e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<BuildingRecords> listRecords(String pushTime){
|
public List<BuildingRecords> listRecords(String pushTime) {
|
||||||
QueryWrapper<BuildingRecords> wrapper = new QueryWrapper<>();
|
QueryWrapper<BuildingRecords> wrapper = new QueryWrapper<>();
|
||||||
wrapper.like("push_time",pushTime);
|
wrapper.like("push_time", pushTime);
|
||||||
List<BuildingRecords> list = new ArrayList<>();
|
List<BuildingRecords> list = new ArrayList<>();
|
||||||
list = buildingRecordsMapper.selectList(wrapper);
|
list = buildingRecordsMapper.selectList(wrapper);
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void testHSSF() throws Exception {
|
||||||
|
// 1. 创建一个工作簿
|
||||||
|
HSSFWorkbook wb = new HSSFWorkbook();
|
||||||
|
// 2. 创建一个工作表
|
||||||
|
HSSFSheet sheet = wb.createSheet();
|
||||||
|
// 3. 获取数据库数据
|
||||||
|
List<BuildingRecordsDto> buildingRecordsDtos = buildingRecordsMapper.selectRaise(null, null);
|
||||||
|
for (int i = 0; i < buildingRecordsDtos.size(); i++) {
|
||||||
|
// 4. 创建行
|
||||||
|
HSSFRow row = sheet.createRow(i);
|
||||||
|
// 5. 使用反射获取实体的元素的总量
|
||||||
|
Class<? extends BuildingRecordsDto> aClass = buildingRecordsDtos.get(i).getClass();
|
||||||
|
Field[] fields = aClass.getDeclaredFields();
|
||||||
|
// 6. 行内单元格赋值
|
||||||
|
for (int j = 0; j < fields.length; j++) {
|
||||||
|
Field f = fields[j];
|
||||||
|
f.setAccessible(true);
|
||||||
|
HSSFCell cell = row.createCell(j);
|
||||||
|
cell.setCellValue(String.valueOf(f.get(buildingRecordsDtos.get(i))));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 7.写文件
|
||||||
|
FileOutputStream fos = new FileOutputStream("C:/Users/szkingdom/"+System.currentTimeMillis()+".xls");
|
||||||
|
// 8.关闭流
|
||||||
|
wb.write(fos);
|
||||||
|
fos.close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,8 +33,10 @@
|
||||||
<select id="selectRaise" resultType="com.hisense.monitormanage.dto.BuildingRecordsDto">
|
<select id="selectRaise" resultType="com.hisense.monitormanage.dto.BuildingRecordsDto">
|
||||||
SELECT * FROM t_building_records br JOIN t_building_new_site bs
|
SELECT * FROM t_building_records br JOIN t_building_new_site bs
|
||||||
ON br.project_name = bs.gdmc WHERE br.pm10 > 80 ORDER BY br.push_time DESC
|
ON br.project_name = bs.gdmc WHERE br.pm10 > 80 ORDER BY br.push_time DESC
|
||||||
|
<if test="page!=null and '' != page and pageSize != null and '' != pageSize">
|
||||||
<bind name="page" value="(page-1)*pageSize"/>
|
<bind name="page" value="(page-1)*pageSize"/>
|
||||||
limit #{page},#{pageSize}
|
limit #{page},#{pageSize}
|
||||||
|
</if>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectNoiceEvent" resultType="com.hisense.monitormanage.dto.BuildingRecordsDto">
|
<select id="selectNoiceEvent" resultType="com.hisense.monitormanage.dto.BuildingRecordsDto">
|
||||||
|
@ -46,8 +48,10 @@
|
||||||
SELECT br.noice,br.push_time,br.project_name,bs.jd,bs.wd,bs.channel_name,bs.sgwz,bs.ssdq 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
|
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 ORDER BY a.push_time DESC
|
WHERE DATE_FORMAT(br.push_time,'%H')>=6 AND DATE_FORMAT(br.push_time,'%H') <22 AND br.noice > 70) a ORDER BY a.push_time DESC
|
||||||
|
<if test="page!=null and '' != page and pageSize != null and '' != pageSize">
|
||||||
<bind name="page" value="(page-1)*pageSize"/>
|
<bind name="page" value="(page-1)*pageSize"/>
|
||||||
limit #{page},#{pageSize}
|
limit #{page},#{pageSize}
|
||||||
|
</if>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectByAllEvent" resultType="com.hisense.monitormanage.dto.EventDto">
|
<select id="selectByAllEvent" resultType="com.hisense.monitormanage.dto.EventDto">
|
||||||
|
@ -55,8 +59,10 @@
|
||||||
JOIN t_scene_event tse ON te.camera_name = tse.channel_name
|
JOIN t_scene_event tse ON te.camera_name = tse.channel_name
|
||||||
WHERE te.track_event = 'START'
|
WHERE te.track_event = 'START'
|
||||||
ORDER BY te.capture_time DESC
|
ORDER BY te.capture_time DESC
|
||||||
|
<if test="page!=null and '' != page and pageSize != null and '' != pageSize">
|
||||||
<bind name="page" value="(page-1)*pageSize"/>
|
<bind name="page" value="(page-1)*pageSize"/>
|
||||||
limit #{page},#{pageSize}
|
limit #{page},#{pageSize}
|
||||||
|
</if>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectWeekPmAndNoice" resultType="com.hisense.monitormanage.dto.BuildingRecordsDtos">
|
<select id="selectWeekPmAndNoice" resultType="com.hisense.monitormanage.dto.BuildingRecordsDtos">
|
||||||
|
@ -155,4 +161,62 @@
|
||||||
ON a.pushTime = b.pushTime ORDER BY a.pushTime
|
ON a.pushTime = b.pushTime ORDER BY a.pushTime
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="selectByWeekNoice" resultType="com.hisense.monitormanage.dto.BuildingRecordsDto">
|
||||||
|
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 DATE_SUB(CURDATE(), INTERVAL 7 DAY) < DATE(br.push_time)
|
||||||
|
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 DATE_SUB(CURDATE(), INTERVAL 7 DAY) < DATE(br.push_time)
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectByMonthNoice" resultType="com.hisense.monitormanage.dto.BuildingRecordsDto">
|
||||||
|
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 DATE_SUB(CURDATE(), INTERVAL 30 DAY) < DATE(br.push_time)
|
||||||
|
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 DATE_SUB(CURDATE(), INTERVAL 30 DAY) < DATE(br.push_time)
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectByWeekNaise" resultType="com.hisense.monitormanage.dto.BuildingRecordsDto">
|
||||||
|
SELECT *
|
||||||
|
FROM t_building_records br JOIN t_building_new_site bs ON br.project_name = bs.gdmc
|
||||||
|
WHERE br.pm10 > 80 AND
|
||||||
|
DATE_SUB(CURDATE(), INTERVAL 7 DAY) < DATE(br.push_time)
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectByMonthNaise" resultType="com.hisense.monitormanage.dto.BuildingRecordsDto">
|
||||||
|
SELECT *
|
||||||
|
FROM t_building_records br JOIN t_building_new_site bs ON br.project_name = bs.gdmc
|
||||||
|
WHERE br.pm10 > 80 AND
|
||||||
|
DATE_SUB(CURDATE(), INTERVAL 30 DAY) < DATE(br.push_time)
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectByWeekEvent" resultType="com.hisense.monitormanage.dto.EventDto">
|
||||||
|
SELECT * FROM t_event te JOIN t_scene_event tse ON te.camera_name = tse.channel_name
|
||||||
|
WHERE te.track_event = 'START'
|
||||||
|
AND DATE_SUB(CURDATE(), INTERVAL 7 DAY) < DATE(te.capture_time)
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectByMonthEvent" resultType="com.hisense.monitormanage.dto.EventDto">
|
||||||
|
SELECT * FROM t_event te JOIN t_scene_event tse ON te.camera_name = tse.channel_name
|
||||||
|
WHERE te.track_event = 'START'
|
||||||
|
AND DATE_SUB(CURDATE(), INTERVAL 30 DAY) < DATE(te.capture_time)
|
||||||
|
</select>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
Loading…
Reference in New Issue