添加李村商圈接口

修改工地近7天近30天接口
This commit is contained in:
wuweida 2022-07-19 17:44:29 +08:00
parent 0945c74ad3
commit 03a02d4644
7 changed files with 142 additions and 5 deletions

View File

@ -86,6 +86,12 @@ public class BuildingController {
@ApiOperation("查询近7天工地噪声和扬尘的信息")
public Result selectWeekPmAndNoice(String buildLicense){
List<BuildingRecordsDtos> recordsDtos = buildingRecordsMapper.selectWeekPmAndNoice(buildLicense);
recordsDtos.forEach(record ->{
if (record.getPm10() == null && record.getNoice() == null){
record.setPm10(0);
record.setNoice(0);
}
});
Result success = Result.success(recordsDtos);
return success;
}
@ -98,6 +104,12 @@ public class BuildingController {
@ApiOperation("查询近30天工地噪声和扬尘的信息")
public Result selectMonthPmAndNoice(String buildLicense){
List<BuildingRecordsDtos> recordsDtos = buildingRecordsMapper.selectMonthPmAndNoice(buildLicense);
recordsDtos.forEach(record ->{
if (record.getPm10() == null && record.getNoice() == null){
record.setPm10(0);
record.setNoice(0);
}
});
Result success = Result.success(recordsDtos);
return success;
}

View File

@ -1,6 +1,7 @@
package com.hisense.monitormanage.controller;
import com.hisense.monitormanage.dto.KeyAreaDto;
import com.hisense.monitormanage.entity.KeyAreaLocation;
import com.hisense.monitormanage.entity.PassengerFlow;
import com.hisense.monitormanage.entity.Result;
import com.hisense.monitormanage.mapper.KeyAreaMapper;
@ -42,4 +43,18 @@ public class KeyAreaController {
Result success = Result.success(keyAreaDtos);
return success;
}
/**
* 根据名称查询商圈范围
* @param areaName
* @return
*/
@GetMapping("selectByAreaName")
@ApiOperation("根据名称查询商圈范围")
public Result selectByAreaName(String areaName){
List<KeyAreaLocation> keyAreaLocations = keyAreaMapper.selectByAreaName(areaName);
Result success = Result.success(keyAreaLocations);
return success;
}
}

View File

@ -0,0 +1,12 @@
package com.hisense.monitormanage.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
@Data
@TableName("t_key_area_location")
public class KeyAreaLocation {
private Integer areaId;
private Double longitude;
private Double latitude;
}

View File

@ -28,11 +28,9 @@ public interface BuildingRecordsMapper extends BaseMapper<BuildingRecords> {
"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")
List<BuildingRecordsDto> selectAllBuilding();
@Select("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 WHERE br.build_license = #{buildLicense} AND DATE_SUB(CURDATE(), INTERVAL 7 DAY) < date(br.push_time) group by pushTime")
List<BuildingRecordsDtos> selectWeekPmAndNoice(String buildLicense);
List<BuildingRecordsDtos> selectWeekPmAndNoice(@Param("buildLicense") String buildLicense);
@Select("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 WHERE br.build_license = #{buildLicense} AND DATE_SUB(CURDATE(), INTERVAL 30 DAY) < date(br.push_time) group by pushTime")
List<BuildingRecordsDtos> selectMonthPmAndNoice(String buildLicense);
List<BuildingRecordsDtos> selectMonthPmAndNoice(@Param("buildLicense") String buildLicense);
List<BuildingRecordsDto> selectRaise(@Param("page") Integer page,@Param("pageSize") Integer pageSize);

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 < '404_37020300001310016759' AND channel_code > '183_37028352001328635450' ORDER BY channel_code DESC" )
@Select("SELECT * FROM t_camera_channel WHERE channel_code < '183_37028301831321234380' AND channel_code > '183_37028301831321232834' ORDER BY channel_code DESC\n" )
List<CameraChannel> selectCameraChannel();
}

View File

@ -3,6 +3,7 @@ package com.hisense.monitormanage.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hisense.monitormanage.dto.KeyAreaDto;
import com.hisense.monitormanage.entity.KeyArea;
import com.hisense.monitormanage.entity.KeyAreaLocation;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;
@ -15,4 +16,7 @@ public interface KeyAreaMapper extends BaseMapper<KeyArea> {
@Select("select ka.type,ka.area_name,ka.location,ss.allNums from t_key_area ka LEFT JOIN (select pt.area_name,SUM(pf.all_nums) as allNums from t_passenger_flow pf JOIN t_passenger_test pt ON pf.longitude = pt.longitude AND pf.latitude = pt.latitude WHERE pf.time_id = #{timeId} AND pt.type = #{type} GROUP BY pt.area_name) ss ON ka.area_name = ss.area_name WHERE ka.type = #{type}")
List<KeyAreaDto> selectKeyAreaList(@Param("type") String type,@Param("timeId") String timeId);
@Select("SELECT * FROM t_key_area_location kal JOIN t_key_area ka ON kal.area_id = ka.area_id WHERE ka.area_name = #{areaName}")
List<KeyAreaLocation> selectByAreaName(String areaName);
}

View File

@ -50,4 +50,100 @@
limit #{page},#{pageSize}
</select>
<select id="selectWeekPmAndNoice" resultType="com.hisense.monitormanage.dto.BuildingRecordsDtos">
select a.pushTime,b.pm10,b.noice
from (
SELECT date_sub(curdate(), interval 1 day) as pushTime
union all
SELECT date_sub(curdate(), interval 2 day) as pushTime
union all
SELECT date_sub(curdate(), interval 3 day) as pushTime
union all
SELECT date_sub(curdate(), interval 4 day) as pushTime
union all
SELECT date_sub(curdate(), interval 5 day) as pushTime
union all
SELECT date_sub(curdate(), interval 6 day) as pushTime
union all
SELECT date_sub(curdate(), interval 7 day) as pushTime
) 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
WHERE br.build_license = 'JZ安许证字{2005}140001-12'
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
</select>
<select id="selectMonthPmAndNoice" resultType="com.hisense.monitormanage.dto.BuildingRecordsDtos">
select a.pushTime,b.pm10,b.noice
from (
SELECT date_sub(curdate(), interval 1 day) as pushTime
union all
SELECT date_sub(curdate(), interval 2 day) as pushTime
union all
SELECT date_sub(curdate(), interval 3 day) as pushTime
union all
SELECT date_sub(curdate(), interval 4 day) as pushTime
union all
SELECT date_sub(curdate(), interval 5 day) as pushTime
union all
SELECT date_sub(curdate(), interval 6 day) as pushTime
union all
SELECT date_sub(curdate(), interval 7 day) as pushTime
union all
SELECT date_sub(curdate(), interval 8 day) as pushTime
union all
SELECT date_sub(curdate(), interval 9 day) as pushTime
union all
SELECT date_sub(curdate(), interval 10 day) as pushTime
union all
SELECT date_sub(curdate(), interval 11 day) as pushTime
union all
SELECT date_sub(curdate(), interval 12 day) as pushTime
union all
SELECT date_sub(curdate(), interval 13 day) as pushTime
union all
SELECT date_sub(curdate(), interval 14 day) as pushTime
union all
SELECT date_sub(curdate(), interval 15 day) as pushTime
union all
SELECT date_sub(curdate(), interval 16 day) as pushTime
union all
SELECT date_sub(curdate(), interval 17 day) as pushTime
union all
SELECT date_sub(curdate(), interval 18 day) as pushTime
union all
SELECT date_sub(curdate(), interval 19 day) as pushTime
union all
SELECT date_sub(curdate(), interval 20 day) as pushTime
union all
SELECT date_sub(curdate(), interval 21 day) as pushTime
union all
SELECT date_sub(curdate(), interval 22 day) as pushTime
union all
SELECT date_sub(curdate(), interval 23 day) as pushTime
union all
SELECT date_sub(curdate(), interval 24 day) as pushTime
union all
SELECT date_sub(curdate(), interval 25 day) as pushTime
union all
SELECT date_sub(curdate(), interval 26 day) as pushTime
union all
SELECT date_sub(curdate(), interval 27 day) as pushTime
union all
SELECT date_sub(curdate(), interval 28 day) as pushTime
union all
SELECT date_sub(curdate(), interval 29 day) as pushTime
union all
SELECT date_sub(curdate(), interval 30 day) as pushTime
) 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
WHERE br.build_license = 'JZ安许证字{2005}140001-12'
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
</select>
</mapper>