重点区域列表添加字段

重点区域场景添加事件
This commit is contained in:
wuweida 2022-08-19 10:36:03 +08:00
parent e225cf9221
commit e8e096719f
4 changed files with 52 additions and 10 deletions

View File

@ -74,6 +74,7 @@ public class KeyAreaController {
*/ */
@GetMapping("selectByLikeName") @GetMapping("selectByLikeName")
@ApiOperation("根据名称查询重点区域名称") @ApiOperation("根据名称查询重点区域名称")
@ApiImplicitParam(name = "areaName",value = "重点区域名称",required = true,dataType = "String")
public Result selectByLikeName(String areaName){ public Result selectByLikeName(String areaName){
List<KeyArea> keyAreaLocations = keyAreaMapper.selectByLikeName(areaName); List<KeyArea> keyAreaLocations = keyAreaMapper.selectByLikeName(areaName);
Result success = Result.success(keyAreaLocations); Result success = Result.success(keyAreaLocations);
@ -84,14 +85,14 @@ public class KeyAreaController {
* 重点区域场景查询所有事件 * 重点区域场景查询所有事件
* @return * @return
*/ */
@GetMapping("selectAreaEvent") @GetMapping("selectByAreaEvent")
@ApiOperation("重点区域场景查询所有事件") @ApiOperation("重点区域场景查询所有事件")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "page", value = "页码", required = false, dataType = "Integer"), @ApiImplicitParam(name = "page", value = "页码", required = true, dataType = "Integer"),
@ApiImplicitParam(name = "pageSize", value = "页码大小", required = false, dataType = "Integer") @ApiImplicitParam(name = "pageSize", value = "页码大小", required = true, dataType = "Integer")
}) })
public Result selectAreaEvent(Integer page,Integer pageSize){ public Result selectByAreaEvent(Integer page,Integer pageSize){
List<EventDto> events = eventMapper.selectEvent(page,pageSize); List<EventDto> events = keyAreaMapper.selectByAreaEvent(page,pageSize);
events.forEach(event -> { events.forEach(event -> {
if (event.getEventCnName().equals("街头伞篷") || event.getEventCnName().equals("水果和食品摊") if (event.getEventCnName().equals("街头伞篷") || event.getEventCnName().equals("水果和食品摊")
|| event.getEventCnName().equals("地摊")|| event.getEventCnName().equals("户外桌椅")){ || event.getEventCnName().equals("地摊")|| event.getEventCnName().equals("户外桌椅")){
@ -107,10 +108,9 @@ public class KeyAreaController {
event.setEventNewName(event.getEventCnName()); event.setEventNewName(event.getEventCnName());
} }
}); });
Integer integer = eventMapper.selectCountEvent(); Integer integer = keyAreaMapper.selectCountAreaEvent();
page = integer/pageSize + 1;
Map<String,Object> map = new HashMap<>(); Map<String,Object> map = new HashMap<>();
map.put("page",page); map.put("sum",integer);
map.put("events",events); map.put("events",events);
Result success = Result.success(map); Result success = Result.success(map);

View File

@ -13,6 +13,22 @@ public class KeyAreaDto {
private String allNums; private String allNums;
private String localNums;
private String nonlocalNums;
private String timeId; private String timeId;
private String serviceTime;//投用时间
private String management;//管理单位
private String scenicLevel;//景区级别
private String about;//简介
private Double longitude;
private Double latitude;
} }

View File

@ -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.EventDto;
import com.hisense.monitormanage.dto.KeyAreaDto; import com.hisense.monitormanage.dto.KeyAreaDto;
import com.hisense.monitormanage.entity.KeyArea; import com.hisense.monitormanage.entity.KeyArea;
import com.hisense.monitormanage.entity.KeyAreaLocation; import com.hisense.monitormanage.entity.KeyAreaLocation;
@ -13,7 +14,6 @@ import java.util.List;
@Repository @Repository
public interface KeyAreaMapper extends BaseMapper<KeyArea> { 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); 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}") @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}")
@ -22,6 +22,11 @@ public interface KeyAreaMapper extends BaseMapper<KeyArea> {
@Select("select * from t_key_area where area_name like concat('%',#{areaName},'%')") @Select("select * from t_key_area where area_name like concat('%',#{areaName},'%')")
List<KeyArea> selectByLikeName(String areaName); List<KeyArea> selectByLikeName(String areaName);
List<EventDto> selectByAreaEvent(@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' AND tse.scene_id = 2")
Integer selectCountAreaEvent();
} }

View File

@ -1,5 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.hisense.monitormanage.mapper.KeyAreaMapper"> <mapper namespace="com.hisense.monitormanage.mapper.KeyAreaMapper">
<select id="selectKeyAreaList" resultType="com.hisense.monitormanage.dto.KeyAreaDto">
SELECT * FROM
(SELECT ka.type,ka.location,ka.service_time,ka.management,ka.scenic_level,
ka.about,ka.area_id,ss.area_name,ss.allNums,ss.localNums,ss.nonlocalNums
FROM t_key_area ka LEFT JOIN
(SELECT pt.area_name,SUM(pf.all_nums) AS allNums,SUM(pf.local_nums) AS localNums,
SUM(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 pf.time_id = #{timeId} AND pt.type IN (${type}) GROUP BY pt.area_name)
ss ON ka.area_name = ss.area_name WHERE ka.type IN (${type})) a
LEFT JOIN t_key_area_location kal ON kal.area_id = a.area_id
</select>
<select id="selectByAreaEvent" resultType="com.hisense.monitormanage.dto.EventDto">
SELECT * 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
<if test="page!=null and '' != page and pageSize != null and '' != pageSize">
<bind name="page" value="(page-1)*pageSize"/>
limit #{page},#{pageSize}
</if>
</select>
</mapper> </mapper>