This commit is contained in:
parent
dc9a7b0099
commit
e225cf9221
|
@ -135,10 +135,12 @@ public class BuildingController {
|
||||||
@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 = "startTime",value = "开始时间",required = false,dataType = "String"),
|
||||||
|
@ApiImplicitParam(name = "endTime",value = "结束时间",required = false,dataType = "String")
|
||||||
})
|
})
|
||||||
public Result selectRaise(Integer page,Integer pageSize){
|
public Result selectRaise(Integer page,Integer pageSize,String startTime,String endTime){
|
||||||
List<BuildingRecordsDto> records = buildingRecordsMapper.selectRaise(page,pageSize);
|
List<BuildingRecordsDto> records = buildingRecordsMapper.selectRaise(page,pageSize,startTime,endTime);
|
||||||
Integer integer = buildingRecordsMapper.selectCountRaise();
|
Integer integer = buildingRecordsMapper.selectCountRaise();
|
||||||
Map<String,Object> map = new HashMap<>();
|
Map<String,Object> map = new HashMap<>();
|
||||||
map.put("sum",integer);
|
map.put("sum",integer);
|
||||||
|
@ -291,8 +293,9 @@ public class BuildingController {
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("exportEvent")
|
@GetMapping("exportEvent")
|
||||||
public void exportRaiseEvent() throws Exception {
|
public String exportRaiseEvent(String startTime,String endTime) throws Exception {
|
||||||
buildingRecordsService.testHSSF();
|
buildingRecordsService.testHSSF(startTime,endTime);
|
||||||
|
return "导出成功";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -37,13 +37,13 @@ public interface BuildingRecordsMapper extends BaseMapper<BuildingRecords> {
|
||||||
|
|
||||||
List<BuildingRecordsDtos> selectMonthPmAndNoice(@Param("buildLicense") String buildLicense);
|
List<BuildingRecordsDtos> selectMonthPmAndNoice(@Param("buildLicense") String buildLicense);
|
||||||
|
|
||||||
List<BuildingRecordsDto> selectRaise(@Param("page") Integer page,@Param("pageSize") Integer pageSize);
|
List<BuildingRecordsDto> selectRaise(@Param("page") Integer page,@Param("pageSize") Integer pageSize,@Param("startTime")String startTime,@Param("endTime") String endTime);
|
||||||
|
|
||||||
List<BuildingRecordsDto> selectNoiceEvent(@Param("page") Integer page,@Param("pageSize") Integer pageSize);
|
List<BuildingRecordsDto> selectNoiceEvent(@Param("page") Integer page,@Param("pageSize") Integer pageSize);
|
||||||
|
|
||||||
List<EventDto> selectByAllEvent(@Param("page") Integer page,@Param("pageSize") Integer pageSize);
|
List<EventDto> selectByAllEvent(@Param("page") Integer page,@Param("pageSize") Integer pageSize);
|
||||||
|
|
||||||
@Select("select COUNT(*) from t_event te JOIN t_scene_event tse ON te.camera_name = tse.channel_name where te.track_event = 'START'")
|
@Select("select COUNT(*) from t_event te JOIN t_scene_event tse ON te.camera_name = tse.channel_name where te.track_event = 'START' and tse.scene_id = 1 ")
|
||||||
Integer selectCountEvent();
|
Integer selectCountEvent();
|
||||||
|
|
||||||
@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 ")
|
@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 ")
|
||||||
|
|
|
@ -108,13 +108,14 @@ public class BuildingRecordsService {
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testHSSF() throws Exception {
|
//导出excel表格
|
||||||
|
public void testHSSF(String startTime,String endTime) throws Exception {
|
||||||
// 1. 创建一个工作簿
|
// 1. 创建一个工作簿
|
||||||
HSSFWorkbook wb = new HSSFWorkbook();
|
HSSFWorkbook wb = new HSSFWorkbook();
|
||||||
// 2. 创建一个工作表
|
// 2. 创建一个工作表
|
||||||
HSSFSheet sheet = wb.createSheet();
|
HSSFSheet sheet = wb.createSheet();
|
||||||
// 3. 获取数据库数据
|
// 3. 获取数据库数据
|
||||||
List<BuildingRecordsDto> buildingRecordsDtos = buildingRecordsMapper.selectRaise(null, null);
|
List<BuildingRecordsDto> buildingRecordsDtos = buildingRecordsMapper.selectRaise(null, null,startTime,endTime);
|
||||||
for (int i = 0; i < buildingRecordsDtos.size(); i++) {
|
for (int i = 0; i < buildingRecordsDtos.size(); i++) {
|
||||||
// 4. 创建行
|
// 4. 创建行
|
||||||
HSSFRow row = sheet.createRow(i);
|
HSSFRow row = sheet.createRow(i);
|
||||||
|
@ -130,7 +131,7 @@ public class BuildingRecordsService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 7.写文件
|
// 7.写文件
|
||||||
FileOutputStream fos = new FileOutputStream("C:/Users/szkingdom/"+System.currentTimeMillis()+".xls");
|
FileOutputStream fos = new FileOutputStream("D:/"+System.currentTimeMillis()+".xls");
|
||||||
// 8.关闭流
|
// 8.关闭流
|
||||||
wb.write(fos);
|
wb.write(fos);
|
||||||
fos.close();
|
fos.close();
|
||||||
|
|
|
@ -32,7 +32,11 @@
|
||||||
|
|
||||||
<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
|
||||||
|
<if test="startTime !=null and '' != startTime and endTime != null and '' != endTime">
|
||||||
|
AND br.push_time BETWEEN 'startTime' AND 'endTime'
|
||||||
|
</if>
|
||||||
|
ORDER BY br.push_time DESC
|
||||||
<if test="page!=null and '' != page and pageSize != null and '' != pageSize">
|
<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}
|
||||||
|
@ -205,13 +209,13 @@
|
||||||
|
|
||||||
<select id="selectByWeekEvent" resultType="com.hisense.monitormanage.dto.EventDto">
|
<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
|
SELECT * FROM t_event te JOIN t_scene_event tse ON te.camera_name = tse.channel_name
|
||||||
WHERE te.track_event = 'START'
|
WHERE te.track_event = 'START' AND tse.scene_id = 1
|
||||||
AND DATE_SUB(CURDATE(), INTERVAL 7 DAY) < DATE(te.capture_time)
|
AND DATE_SUB(CURDATE(), INTERVAL 7 DAY) < DATE(te.capture_time)
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectByMonthEvent" resultType="com.hisense.monitormanage.dto.EventDto">
|
<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
|
SELECT * FROM t_event te JOIN t_scene_event tse ON te.camera_name = tse.channel_name
|
||||||
WHERE te.track_event = 'START'
|
WHERE te.track_event = 'START' AND tse.scene_id = 1
|
||||||
AND DATE_SUB(CURDATE(), INTERVAL 30 DAY) < DATE(te.capture_time)
|
AND DATE_SUB(CURDATE(), INTERVAL 30 DAY) < DATE(te.capture_time)
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue