parent
e3264d71c5
commit
103eb5be5a
|
@ -1,6 +1,7 @@
|
||||||
package com.hisense.monitormanage.controller;
|
package com.hisense.monitormanage.controller;
|
||||||
|
|
||||||
import com.hisense.monitormanage.dto.PassengerFlowDto;
|
import com.hisense.monitormanage.dto.PassengerFlowDto;
|
||||||
|
import com.hisense.monitormanage.dto.RoadDataDtos;
|
||||||
import com.hisense.monitormanage.entity.*;
|
import com.hisense.monitormanage.entity.*;
|
||||||
import com.hisense.monitormanage.mapper.*;
|
import com.hisense.monitormanage.mapper.*;
|
||||||
import com.hisense.monitormanage.service.*;
|
import com.hisense.monitormanage.service.*;
|
||||||
|
@ -283,18 +284,15 @@ public class QidiController {
|
||||||
@GetMapping(value="listRoadDataByTimeRegion")
|
@GetMapping(value="listRoadDataByTimeRegion")
|
||||||
@ApiOperation("根据输入的日期间隔查询道路污染数据(例如:2022-05-10 00:00:00至2022-05-11 00:00:00)")
|
@ApiOperation("根据输入的日期间隔查询道路污染数据(例如:2022-05-10 00:00:00至2022-05-11 00:00:00)")
|
||||||
@ApiImplicitParams({
|
@ApiImplicitParams({
|
||||||
@ApiImplicitParam(name = "start", value = "开始日期", paramType = "query", dataType = "string", required = true),
|
@ApiImplicitParam(name = "begin", value = "开始日期", paramType = "query", dataType = "string", required = true),
|
||||||
@ApiImplicitParam(name = "end", value = "结束日期", paramType = "query", dataType = "string", required = true)
|
@ApiImplicitParam(name = "over", value = "结束日期", paramType = "query", dataType = "string", required = true)
|
||||||
})
|
})
|
||||||
public Result listRoadDataByTimeRegion(
|
public Result listRoadDataByTimeRegion(String begin, String over){
|
||||||
@RequestParam(value="start") String start,
|
List<RoadDataDtos> roadDataDtos = roadDataMapper.listRoadDataByTimeRegion(begin, over);
|
||||||
@RequestParam(value="end") String end
|
roadDataDtos.forEach(roadData1 -> {
|
||||||
){
|
|
||||||
List<RoadData> roadData = roadDataService.listRoadDataByTimeRegion(start,end);
|
|
||||||
roadData.forEach(roadData1 -> {
|
|
||||||
roadData1.setDt(roadData1.getDt().substring(0,10));
|
roadData1.setDt(roadData1.getDt().substring(0,10));
|
||||||
});
|
});
|
||||||
return Result.success(roadData);
|
return Result.success(roadDataDtos);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -0,0 +1,44 @@
|
||||||
|
package com.hisense.monitormanage.dto;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class RoadDataDtos {
|
||||||
|
private String regionName;
|
||||||
|
|
||||||
|
private String streetName;
|
||||||
|
|
||||||
|
private String roadName;
|
||||||
|
|
||||||
|
private String start;
|
||||||
|
|
||||||
|
private String end;
|
||||||
|
|
||||||
|
private double lng;
|
||||||
|
|
||||||
|
private double lat;
|
||||||
|
|
||||||
|
private double pm10;
|
||||||
|
|
||||||
|
private double pm25;
|
||||||
|
|
||||||
|
private Integer descPm10Rank;
|
||||||
|
|
||||||
|
private Integer ascPm10Rank;
|
||||||
|
|
||||||
|
private Integer descPm25Rank;
|
||||||
|
|
||||||
|
private Integer ascPm25Rank;
|
||||||
|
|
||||||
|
private String points;
|
||||||
|
|
||||||
|
@JsonFormat(pattern="yyyy-MM-dd mm:HH:ss",timezone = "GMT+8")
|
||||||
|
private String dt;
|
||||||
|
|
||||||
|
@JsonFormat(pattern="yyyy-MM-dd mm:HH:ss",timezone = "GMT+8")
|
||||||
|
private String begin;
|
||||||
|
|
||||||
|
@JsonFormat(pattern="yyyy-MM-dd mm:HH:ss",timezone = "GMT+8")
|
||||||
|
private String over;
|
||||||
|
}
|
|
@ -16,7 +16,7 @@ import lombok.NoArgsConstructor;
|
||||||
@Data
|
@Data
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@TableName("t_building_new_site")
|
@TableName("t_building_site")
|
||||||
public class BuildingSite {
|
public class BuildingSite {
|
||||||
|
|
||||||
@TableId
|
@TableId
|
||||||
|
|
|
@ -53,8 +53,7 @@ public interface BuildingRecordsMapper extends BaseMapper<BuildingRecords> {
|
||||||
"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")
|
"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();
|
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" +
|
@Select("select * from t_building_new_site bs JOIN (select a.*,br.appid,br.noice,br.pm10,br.project_name FROM t_building_records br JOIN (select build_license,MAX(push_time) AS push_time from t_building_records GROUP BY build_license) a ON br.build_license = a.build_license AND br.push_time = a.push_time) b on b.project_name = bs.gdmc where b.project_name like concat('%',#{projectName},'%') ORDER BY b.push_time DESC")
|
||||||
" where br.project_name like concat('%',#{projectName},'%') ORDER BY br.push_time DESC LIMIT 1")
|
|
||||||
List<BuildingRecordsDto> selectByProjectName(String projectName);
|
List<BuildingRecordsDto> selectByProjectName(String projectName);
|
||||||
|
|
||||||
@Select("select rns.*,cp.pic_url from (select bs.*,br.project_name,br.push_time,br.pm10,br.noice from (select * from t_building_records ORDER BY push_time DESC LIMIT 1639) br JOIN t_building_new_site bs on br.project_name = bs.gdmc where (bs.jd between #{jd} and #{jd1}) and (bs.wd between #{wd} and #{wd1} ) ORDER BY br.push_time DESC LIMIT 93) rns " +
|
@Select("select rns.*,cp.pic_url from (select bs.*,br.project_name,br.push_time,br.pm10,br.noice from (select * from t_building_records ORDER BY push_time DESC LIMIT 1639) br JOIN t_building_new_site bs on br.project_name = bs.gdmc where (bs.jd between #{jd} and #{jd1}) and (bs.wd between #{wd} and #{wd1} ) ORDER BY br.push_time DESC LIMIT 93) rns " +
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package com.hisense.monitormanage.mapper;
|
package com.hisense.monitormanage.mapper;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.hisense.monitormanage.dto.RoadDataDtos;
|
||||||
import com.hisense.monitormanage.entity.PassengerFlow;
|
import com.hisense.monitormanage.entity.PassengerFlow;
|
||||||
import com.hisense.monitormanage.entity.RoadData;
|
import com.hisense.monitormanage.entity.RoadData;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
@ -34,4 +35,7 @@ public interface RoadDataMapper extends BaseMapper<RoadData> {
|
||||||
Integer selectCountMonthRoadData();
|
Integer selectCountMonthRoadData();
|
||||||
|
|
||||||
RoadData getByMaxId();
|
RoadData getByMaxId();
|
||||||
|
|
||||||
|
@Select("select * from t_road_data where dt between #{begin} and #{over} and pm10 > 150 order by dt desc ")
|
||||||
|
List<RoadDataDtos> listRoadDataByTimeRegion(@Param("begin") String begin, @Param("over") String over);
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,7 @@ 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.RoadDataDtos;
|
||||||
import com.hisense.monitormanage.entity.RoadData;
|
import com.hisense.monitormanage.entity.RoadData;
|
||||||
import com.hisense.monitormanage.mapper.RoadDataMapper;
|
import com.hisense.monitormanage.mapper.RoadDataMapper;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
@ -112,13 +113,6 @@ public class RoadDataService {
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<RoadData> listRoadDataByTimeRegion(String start,String end){
|
|
||||||
QueryWrapper<RoadData> wrapper = new QueryWrapper<>();
|
|
||||||
wrapper.between("dt",start,end).gt("pm10",150);
|
|
||||||
List<RoadData> list = roadDataMapper.selectList(wrapper);
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
|
|
||||||
//获取当前日期的时间串,2022-05-08 00:00:00
|
//获取当前日期的时间串,2022-05-08 00:00:00
|
||||||
private String dateTimeStr(){
|
private String dateTimeStr(){
|
||||||
LocalDate localDate = LocalDate.now();
|
LocalDate localDate = LocalDate.now();
|
||||||
|
|
|
@ -31,12 +31,13 @@
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
<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
|
||||||
ON br.project_name = bs.gdmc WHERE br.pm10 > 80
|
(SELECT br.project_name,br.build_license,br.noice,br.pm10,br.push_time,bs.channel_code,
|
||||||
<if test="startTime !=null and '' != startTime and endTime != null and '' != endTime">
|
bs.channel_name,bs.jd,bs.wd,bs.ssdq,bs.yjsg,bs.sgwz FROM t_building_records br
|
||||||
AND br.push_time BETWEEN 'startTime' AND 'endTime'
|
JOIN t_building_new_site bs
|
||||||
</if>
|
ON br.project_name = bs.gdmc WHERE br.pm10 > 80 ) ss
|
||||||
ORDER BY br.push_time DESC
|
LEFT JOIN t_channel_picture cp ON ss.channel_code = cp.channel_code
|
||||||
|
ORDER BY ss.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}
|
||||||
|
@ -44,14 +45,16 @@
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectNoiceEvent" resultType="com.hisense.monitormanage.dto.BuildingRecordsDto">
|
<select id="selectNoiceEvent" resultType="com.hisense.monitormanage.dto.BuildingRecordsDto">
|
||||||
SELECT a.* FROM
|
SELECT * FROM
|
||||||
(SELECT br.noice,br.push_time,br.project_name,bs.jd,bs.wd,bs.channel_name,bs.sgwz,bs.ssdq FROM
|
(SELECT a.* FROM
|
||||||
|
(SELECT br.noice,br.push_time,br.project_name,bs.jd,bs.wd,bs.channel_name,bs.sgwz,bs.ssdq,bs.channel_code 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 (HOUR(br.push_time)>=22 OR 6 > HOUR(br.push_time)) AND br.noice > 55
|
WHERE (HOUR(br.push_time)>=22 OR 6 > HOUR(br.push_time)) AND br.noice > 55
|
||||||
UNION
|
UNION
|
||||||
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,bs.channel_code 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) b
|
||||||
|
LEFT JOIN t_channel_picture cp ON b.channel_code = cp.channel_code
|
||||||
<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}
|
||||||
|
|
Loading…
Reference in New Issue