重点区域添加接口

工地场景实体类添加字段
This commit is contained in:
wuweida 2022-08-24 17:38:58 +08:00
parent 52b9340440
commit 6d63adfe58
7 changed files with 197 additions and 14 deletions

View File

@ -238,5 +238,68 @@ public class KeyAreaController {
return success;
}
/**
* 统计事件类型
* @return
*/
@GetMapping("selectEventType")
@ApiOperation("统计事件类型")
public Result selectEventType(){
List<KeyAreaDtos> keyAreaDtos = keyAreaMapper.selectEventType();
keyAreaDtos.forEach(keyAreaDtos1 -> {
if (keyAreaDtos1.getEventCnName().equals("街头伞篷") || keyAreaDtos1.getEventCnName().equals("水果和食品摊")
|| keyAreaDtos1.getEventCnName().equals("地摊")|| keyAreaDtos1.getEventCnName().equals("户外桌椅")){
keyAreaDtos1.setEventNewName("占道经营");
}else if (keyAreaDtos1.getEventCnName().equals("纸箱")|| keyAreaDtos1.getEventCnName().equals("街头散落垃圾")
||keyAreaDtos1.getEventCnName().equals("塑料篮子")){
keyAreaDtos1.setEventNewName("环境卫生");
}else if (keyAreaDtos1.getEventCnName().equals("沿街晾晒衣物被单")){
keyAreaDtos1.setEventNewName("沿街晾晒");
}else if (keyAreaDtos1.getEventCnName().equals("机动车违停")){
keyAreaDtos1.setEventNewName("违章停车");
}else {
keyAreaDtos1.setEventNewName(keyAreaDtos1.getEventCnName());
}
});
Result success = Result.success(keyAreaDtos);
return success;
}
/**
* 查询近7天重点区域本地外地人流峰值按每一天输出
* @return
*/
@GetMapping("selectLocalWeekArea")
@ApiOperation("查询近7天重点区域本地外地人流峰值按每一天输出")
public Result selectLocalWeekArea(String areaName){
List<KeyAreaDtos> keyAreaDtos = keyAreaMapper.selectLocalWeekArea(areaName);
keyAreaDtos.forEach(keyAreaDtos1 -> {
if (keyAreaDtos1.getLocalNums() == null && keyAreaDtos1.getNonlocalNums() == null){
keyAreaDtos1.setLocalNums(0);
keyAreaDtos1.setNonlocalNums(0);
}
});
Result success = Result.success(keyAreaDtos);
return success;
}
/**
* 查询近30天重点区域本地外地人流峰值按每一天输出
* @return
*/
@GetMapping("selectLocalMonthArea")
@ApiOperation("查询近30天重点区域本地外地人流峰值按每一天输出")
public Result selectLocalMonthArea(String areaName){
List<KeyAreaDtos> keyAreaDtos = keyAreaMapper.selectLocalMonthArea(areaName);
keyAreaDtos.forEach(keyAreaDtos1 -> {
if (keyAreaDtos1.getLocalNums() == null && keyAreaDtos1.getNonlocalNums() == null){
keyAreaDtos1.setLocalNums(0);
keyAreaDtos1.setNonlocalNums(0);
}
});
Result success = Result.success(keyAreaDtos);
return success;
}
}

View File

@ -31,4 +31,6 @@ public class KeyAreaDto {
private Double latitude;
private String point;
}

View File

@ -8,4 +8,13 @@ public class KeyAreaDtos {
private String pushTime;
private Integer number;
private String eventCnName;
private String eventNewName;
private Integer localNums;
private Integer nonlocalNums;
}

View File

@ -13,4 +13,6 @@ public class KeyAreaLocation {
private Double latitude;
private String point;
}

View File

@ -40,6 +40,11 @@ public interface KeyAreaMapper extends BaseMapper<KeyArea> {
List<KeyAreaDtos> selectMonthAreaEvent();
@Select("SELECT te.event_cn_name,COUNT(*) AS number 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 = 2 GROUP BY te.event_cn_name")
List<KeyAreaDtos> selectEventType();
List<KeyAreaDtos> selectLocalWeekArea(@Param("areaName") String areaName);
List<KeyAreaDtos> selectLocalMonthArea(@Param("areaName") String areaName);
}

View File

@ -47,11 +47,11 @@
<select id="selectNoiceEvent" resultType="com.hisense.monitormanage.dto.BuildingRecordsDto">
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
(SELECT br.noice,br.push_time,br.project_name,br.pm10,br.build_license,bs.jd,bs.wd,bs.channel_name,bs.sgwz,bs.ssdq,bs.channel_code 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,br.project_name,bs.jd,bs.wd,bs.channel_name,bs.sgwz,bs.ssdq,bs.channel_code FROM
SELECT br.noice,br.push_time,br.project_name,br.pm10,br.build_license,bs.jd,bs.wd,bs.channel_name,bs.sgwz,bs.ssdq,bs.channel_code 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) a ) b
LEFT JOIN t_channel_picture cp ON b.channel_code = cp.channel_code

View File

@ -36,7 +36,7 @@
ON pf.longitude = pt.longitude AND pf.latitude = pt.latitude
WHERE pf.time_id = #{timeId} AND pt.type IN (${type3}) GROUP BY pt.area_name)
ss ON ka.area_name = ss.area_name WHERE ka.type IN (${type3})) a
LEFT JOIN t_key_area_location1 kal1 ON kal1.area_id = a.area_id
LEFT JOIN t_key_area_location kal ON kal.area_id = a.area_id
</select>
<select id="selectKeyArea" resultType="com.hisense.monitormanage.dto.KeyAreaDto">
SELECT * FROM
@ -141,4 +141,106 @@
GROUP BY pushTime) a
ON b.pushTime = a.pushTime ORDER BY b.pushTime
</select>
<select id="selectLocalWeekArea" resultType="com.hisense.monitormanage.dto.KeyAreaDtos">
SELECT a.*,b.localNums,b.nonlocalNums
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 str_to_date(LEFT(pf.time_id,8),'%Y%m%d') as pushTime,
MAX(pf.local_nums) AS localNums,MAX(pf.nonlocal_nums) AS nonlocalNums
FROM t_passenger_flow pf JOIN t_passenger_test pt
ON pf.longitude = pt.longitude AND pf.latitude = pt.latitude
WHERE pt.area_name = #{areaName} AND DATE_SUB(CURDATE(), INTERVAL 7 DAY) &lt; DATE(
str_to_date(pf.time_id,'%Y%m%d%H%i')) GROUP BY str_to_date(LEFT(pf.time_id,8),'%Y%m%d')
) b
ON a.pushTime = b.pushTime ORDER BY a.pushTime DESC
</select>
<select id="selectLocalMonthArea" resultType="com.hisense.monitormanage.dto.KeyAreaDtos">
SELECT a.*,b.localNums,b.nonlocalNums
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 str_to_date(LEFT(pf.time_id,8),'%Y%m%d') as pushTime,
MAX(pf.local_nums) AS localNums,MAX(pf.nonlocal_nums) AS nonlocalNums
FROM t_passenger_flow pf JOIN t_passenger_test pt
ON pf.longitude = pt.longitude AND pf.latitude = pt.latitude
WHERE pt.area_name = #{areaName} AND DATE_SUB(CURDATE(), INTERVAL 30 DAY) &lt; DATE(
str_to_date(pf.time_id,'%Y%m%d%H%i')) GROUP BY str_to_date(LEFT(pf.time_id,8),'%Y%m%d')
) b
ON a.pushTime = b.pushTime ORDER BY a.pushTime DESC
</select>
</mapper>