This commit is contained in:
wuweida 2022-08-23 13:55:17 +08:00
parent 103eb5be5a
commit a5ab06eee5
8 changed files with 56 additions and 45 deletions

View File

@ -1,5 +1,6 @@
package com.hisense.monitormanage.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.hisense.monitormanage.dto.PassengerFlowDto;
import com.hisense.monitormanage.dto.RoadDataDtos;
import com.hisense.monitormanage.entity.*;
@ -55,6 +56,9 @@ public class QidiController {
@Autowired
private RoadDataMapper roadDataMapper;
@Autowired
private SedimentTrailMapper sedimentTrailMapper;
//道路统计数据与排名
@GetMapping("roadData")
@ApiOperation("道路统计数据与排名根据后台dt调用接口")
@ -141,10 +145,12 @@ public class QidiController {
@RequestParam(value="start") String start,
@RequestParam(value = "end") String end
){
Map<String,List<SedimentTrail>> map = sedimentTrailService.listSedimentTrailByPoints(longitude,latitude,radius,start,end);
List<SedimentTrail> map = sedimentTrailService.listSedimentTrailByPoints(longitude,latitude,radius,start,end);
return Result.success(map);
}
//测试获取最新的客流列表从接口获取
@GetMapping("passengerFlow")
@ApiOperation("获取最新的客流列表,测试接口,调用接口获取")
@ -268,6 +274,18 @@ public class QidiController {
return success;
}
/**
* 查询全部渣土车轨迹信息
* @return
*/
@GetMapping("selectAllSedimentTrail")
@ApiOperation("查询全部渣土车轨迹信息")
public Result selectAllSedimentTrail(){
List<SedimentTrail> trailSanitations = sedimentTrailMapper.selectAllSedimentTrail();
Result success = Result.success(trailSanitations);
return success;
}
//查询道路污染数据
//输入参考2022-05-10 00:00:00只能查询当前日期前一天及以前的
@GetMapping(value="listRoadData")
@ -341,5 +359,4 @@ public class QidiController {
return success;
}
}

View File

@ -25,16 +25,16 @@ public class SedimentTrail{
@TableId
private Integer id;
private double speed;
private String speed;
private String simCardNum;
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
private LocalDateTime uploadtime;
private double coordinateX;
private String coordinateX;
private double coordinateY;
private String coordinateY;
private double longitude;
@ -43,13 +43,13 @@ public class SedimentTrail{
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
private LocalDateTime recordTime;
private double angle;
private String angle;
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
private LocalDateTime updateTime;
private String status;
private double fuel;
private String fuel;
}

View File

@ -29,8 +29,7 @@ public interface BuildingRecordsMapper extends BaseMapper<BuildingRecords> {
void batchUpdate(@Param("list") List<Map> list);
@Select("select * from (SELECT bns.*,br.project_name,br.push_time,br.pm10,br.noice,br.build_license FROM t_building_records br JOIN t_building_new_site bns " +
"ON br.project_name = bns.gdmc ORDER BY br.push_time DESC LIMIT 93) bs LEFT JOIN t_channel_picture cp ON bs.channel_code = cp.channel_code")
@Select("select * from (select bs.sgwz,bs.jd,bs.wd,bs.ssdq,bs.yjsg,bs.channel_code,bs.channel_name,b.* from t_building_site bs LEFT 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 bs.gdmc = b.project_name ) c LEFT JOIN t_channel_picture cp ON c.channel_code = cp.channel_code")
List<BuildingRecordsDto> selectAllBuilding();
List<BuildingRecordsDtos> selectWeekPmAndNoice(@Param("buildLicense") String buildLicense);
@ -46,26 +45,25 @@ public interface BuildingRecordsMapper extends BaseMapper<BuildingRecords> {
@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();
@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_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")
@Select("SELECT COUNT(*) FROM (SELECT br.noice,br.push_time FROM t_building_records br JOIN t_building_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_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 * 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")
@Select("select * from t_building_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")
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 " +
"LEFT JOIN t_channel_picture cp ON rns.channel_code = cp.channel_code")
@Select("select * from t_building_site bs LEFT 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 (bs.jd between #{jd} and #{jd1}) and (bs.wd between #{wd} and #{wd1}")
List<BuildingRecordsDto> selectByJdWd(@Param("jd") Double jd,
@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")
@Select("select * from t_building_records br JOIN t_building_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")
@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_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_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}")

View File

@ -17,9 +17,9 @@ import java.util.List;
@Repository
public interface BuildingSiteMapper extends BaseMapper<BuildingSite> {
@Select("select * from t_building_new_site")
@Select("select * from t_building_site")
List<BuildingSite> selectBuildSite();
@Select("select * from t_building_new_site where channel_code is not null")
@Select("select * from t_building_site where channel_code is not null")
List<BuildingSite> selectByList();
}

View File

@ -36,6 +36,6 @@ public interface RoadDataMapper extends BaseMapper<RoadData> {
RoadData getByMaxId();
@Select("select * from t_road_data where dt between #{begin} and #{over} and pm10 > 150 order by dt desc ")
@Select("select * from t_road_data where dt between #{begin} and #{over} and pm10 > 150 order by dt asc ")
List<RoadDataDtos> listRoadDataByTimeRegion(@Param("begin") String begin, @Param("over") String over);
}

View File

@ -2,6 +2,7 @@ package com.hisense.monitormanage.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hisense.monitormanage.entity.SedimentTrail;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;
import java.util.List;
@ -19,4 +20,7 @@ public interface SedimentTrailMapper extends BaseMapper<SedimentTrail> {
void batchaSave(List<Map> list);
@Select("select * from t_trail_sediment")
List<SedimentTrail> selectAllSedimentTrail();
}

View File

@ -51,20 +51,12 @@ public class SedimentTrailService {
* @param longitude经度 latitude纬度 radius() start(时间) end(时间)
*
*/
public Map<String,List<SedimentTrail>> listSedimentTrailByPoints(double longitude, double latitude, Integer radius,String start,String end){
public List<SedimentTrail> listSedimentTrailByPoints(double longitude, double latitude, Integer radius,String start,String end){
double[] points = LongLatUtil.getAround(longitude,latitude,radius);
QueryWrapper<SedimentTrail> wrapper = new QueryWrapper<>();
wrapper.between("update_time",start,end).between("longitude",points[0],points[2]).between("latitude",points[1],points[3])
.orderByAsc("sim_card_num","record_time");
List<Map> maps = new ArrayList<>();
Map<String, List<SedimentTrail>> map = new HashMap<>();
try{
List<SedimentTrail> list = sedimentTrailMapper.selectList(wrapper);
map = list.stream().collect(Collectors.groupingBy(SedimentTrail::getSimCardNum));
}catch (Exception e){
log.error("[listSedimentTrailByPoints] Exception:",e.getMessage());
}
return map;
List<SedimentTrail> list = sedimentTrailMapper.selectList(wrapper);
return list;
}
}

View File

@ -34,7 +34,7 @@
SELECT * FROM
(SELECT br.project_name,br.build_license,br.noice,br.pm10,br.push_time,bs.channel_code,
bs.channel_name,bs.jd,bs.wd,bs.ssdq,bs.yjsg,bs.sgwz FROM t_building_records br
JOIN t_building_new_site bs
JOIN t_building_site bs
ON br.project_name = bs.gdmc WHERE br.pm10 > 80 ) ss
LEFT JOIN t_channel_picture cp ON ss.channel_code = cp.channel_code
ORDER BY ss.push_time DESC
@ -48,11 +48,11 @@
SELECT * 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_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,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_site bs ON br.project_name = bs.gdmc
WHERE DATE_FORMAT(br.push_time,'%H')>=6 AND DATE_FORMAT(br.push_time,'%H') &lt; 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">
@ -91,7 +91,7 @@
) a
LEFT JOIN (
SELECT DATE_FORMAT(br.push_time,'%Y%-%m-%d') pushTime,ROUND(AVG(br.pm10)) pm10,ROUND(AVG(br.noice)) noice
FROM t_building_records br JOIN t_building_new_site bns ON br.project_name = bns.gdmc
FROM t_building_records br JOIN t_building_site bns ON br.project_name = bns.gdmc
WHERE br.build_license = #{buildLicense}
AND DATE_SUB(CURDATE(), INTERVAL 7 DAY) &lt; DATE(br.push_time) GROUP BY pushTime) b
ON a.pushTime = b.pushTime ORDER BY a.pushTime
@ -162,7 +162,7 @@
) a
LEFT JOIN (
SELECT DATE_FORMAT(br.push_time,'%Y%-%m-%d') pushTime,ROUND(AVG(br.pm10)) pm10,ROUND(AVG(br.noice)) noice
FROM t_building_records br JOIN t_building_new_site bns ON br.project_name = bns.gdmc
FROM t_building_records br JOIN t_building_site bns ON br.project_name = bns.gdmc
WHERE br.build_license = #{buildLicense}
AND DATE_SUB(CURDATE(), INTERVAL 30 DAY) &lt; DATE(br.push_time) GROUP BY pushTime) b
ON a.pushTime = b.pushTime ORDER BY a.pushTime
@ -171,13 +171,13 @@
<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
t_building_records br JOIN t_building_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) &lt; 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
t_building_records br JOIN t_building_site bs ON br.project_name = bs.gdmc
WHERE DATE_FORMAT(br.push_time,'%H')>=6 AND DATE_FORMAT(br.push_time,'%H') &lt; 22
AND br.noice > 70 AND DATE_SUB(CURDATE(), INTERVAL 7 DAY) &lt; DATE(br.push_time)
</select>
@ -185,27 +185,27 @@
<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
t_building_records br JOIN t_building_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) &lt; 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
t_building_records br JOIN t_building_site bs ON br.project_name = bs.gdmc
WHERE DATE_FORMAT(br.push_time,'%H')>=6 AND DATE_FORMAT(br.push_time,'%H') &lt; 22
AND br.noice > 70 AND DATE_SUB(CURDATE(), INTERVAL 30 DAY) &lt; 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
FROM t_building_records br JOIN t_building_site bs ON br.project_name = bs.gdmc
WHERE br.pm10 > 80 AND
DATE_SUB(CURDATE(), INTERVAL 7 DAY) &lt; 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
FROM t_building_records br JOIN t_building_site bs ON br.project_name = bs.gdmc
WHERE br.pm10 > 80 AND
DATE_SUB(CURDATE(), INTERVAL 30 DAY) &lt; DATE(br.push_time)
</select>
@ -287,18 +287,18 @@
LEFT JOIN (
SELECT DATE_FORMAT(a.push_time,'%Y%-%m-%d') AS pushTime,COUNT(*) AS number 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
FROM t_building_records br JOIN t_building_site bs
ON br.project_name = bs.gdmc
WHERE br.pm10 > 80 AND DATE_SUB(CURDATE(), INTERVAL 30 DAY) &lt;= 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
FROM t_building_records br JOIN t_building_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) &lt;= 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
FROM t_building_records br JOIN t_building_site bs
ON br.project_name = bs.gdmc
WHERE DATE_FORMAT(br.push_time,'%H')>=6 AND DATE_FORMAT(br.push_time,'%H') &lt; 22
AND br.noice > 70 AND DATE_SUB(CURDATE(), INTERVAL 30 DAY) &lt;= DATE(br.push_time)