This commit is contained in:
DESKTOP-8UJMF34\liwen 2022-09-02 11:12:46 +08:00
parent b0d7f9dc09
commit 7e1a9195a0
74 changed files with 1299 additions and 1206 deletions

View File

@ -1,6 +1,4 @@
# 工程简介 # 工程简介
# 延伸阅读 # 延伸阅读

20
pom.xml
View File

@ -87,16 +87,16 @@
<artifactId>javacv</artifactId> <artifactId>javacv</artifactId>
<version>1.5.7</version> <version>1.5.7</version>
</dependency>--> </dependency>-->
<!-- <dependency>--> <!-- <dependency>-->
<!-- <groupId>org.bytedeco</groupId>--> <!-- <groupId>org.bytedeco</groupId>-->
<!-- <artifactId>ffmpeg-platform</artifactId>--> <!-- <artifactId>ffmpeg-platform</artifactId>-->
<!-- <version>1.5.7</version>--> <!-- <version>1.5.7</version>-->
<!-- </dependency>--> <!-- </dependency>-->
<!-- <dependency>--> <!-- <dependency>-->
<!-- <groupId>org.bytedeco</groupId>--> <!-- <groupId>org.bytedeco</groupId>-->
<!-- <artifactId>opencv-platform</artifactId>--> <!-- <artifactId>opencv-platform</artifactId>-->
<!-- <version>1.5.7</version>--> <!-- <version>1.5.7</version>-->
<!-- </dependency>--> <!-- </dependency>-->
<dependency> <dependency>

View File

@ -26,7 +26,7 @@ public class GlobalCorsConfig {
//2. 添加映射路径 //2. 添加映射路径
UrlBasedCorsConfigurationSource corsConfigurationSource = new UrlBasedCorsConfigurationSource(); UrlBasedCorsConfigurationSource corsConfigurationSource = new UrlBasedCorsConfigurationSource();
corsConfigurationSource.registerCorsConfiguration("/**",config); corsConfigurationSource.registerCorsConfiguration("/**", config);
//3. 返回新的CorsFilter //3. 返回新的CorsFilter
return new CorsFilter(corsConfigurationSource); return new CorsFilter(corsConfigurationSource);
} }

View File

@ -28,7 +28,7 @@ public class SwaggerConfig {
private boolean enable; private boolean enable;
@Bean @Bean
public Docket createRestApi(){ public Docket createRestApi() {
return new Docket(DocumentationType.SWAGGER_2) return new Docket(DocumentationType.SWAGGER_2)
.enable(enable) .enable(enable)
.select() .select()

View File

@ -49,40 +49,41 @@ public class BuildingController {
@GetMapping("/getRecords") @GetMapping("/getRecords")
@ApiOperation("测试,获取工地实时数据--调用接口") @ApiOperation("测试,获取工地实时数据--调用接口")
public List<Map> getRecords(){ public List<Map> getRecords() {
return buildingRecordsService.getRecords(); return buildingRecordsService.getRecords();
} }
@GetMapping("/getAndSaveRecords") @GetMapping("/getAndSaveRecords")
@ApiOperation("获取工地实时数据并保存到表中--调用接口获取") @ApiOperation("获取工地实时数据并保存到表中--调用接口获取")
public Result getAndSaveRecords(){ public Result getAndSaveRecords() {
boolean result = buildingRecordsService.getAndSaveRecords(); boolean result = buildingRecordsService.getAndSaveRecords();
if(result){ if (result) {
return Result.success(); return Result.success();
}else{ } else {
return Result.error(String.valueOf(result)); return Result.error(String.valueOf(result));
} }
} }
@GetMapping("/listRecords") @GetMapping("/listRecords")
@ApiOperation("获取工地实时数据列表-从t_building_records表中查询") @ApiOperation("获取工地实时数据列表-从t_building_records表中查询")
@ApiImplicitParam(name="pushTime",value="上传时间",paramType = "query",required = true,dataType = "string",example = "2022-01-01") @ApiImplicitParam(name = "pushTime", value = "上传时间", paramType = "query", required = true, dataType = "string", example = "2022-01-01")
public List<BuildingRecords> listRecords( public List<BuildingRecords> listRecords(
@RequestParam(value="pushTime") String pushTime @RequestParam(value = "pushTime") String pushTime
){ ) {
return buildingRecordsService.listRecords(pushTime); return buildingRecordsService.listRecords(pushTime);
} }
/** /**
* 查询所有工地最新列表 * 查询所有工地最新列表
*
* @return * @return
*/ */
@GetMapping("selectAllBuilding") @GetMapping("selectAllBuilding")
@ApiOperation("查询所有工地") @ApiOperation("查询所有工地")
public Result selectAllBuilding(){ public Result selectAllBuilding() {
List<BuildingRecordsDto> records = buildingRecordsMapper.selectAllBuilding(); List<BuildingRecordsDto> records = buildingRecordsMapper.selectAllBuilding();
records.forEach(record ->{ records.forEach(record -> {
record.setProjectName(record.getGdmc()); record.setProjectName(record.getGdmc());
}); });
Result success = Result.success(records); Result success = Result.success(records);
@ -91,15 +92,16 @@ public class BuildingController {
/** /**
* 根据建筑编号查询近7天工地噪声和扬尘的信息 * 根据建筑编号查询近7天工地噪声和扬尘的信息
*
* @return * @return
*/ */
@GetMapping("selectWeekPmAndNoice") @GetMapping("selectWeekPmAndNoice")
@ApiOperation("根据建筑编号查询近7天工地噪声和扬尘的信息") @ApiOperation("根据建筑编号查询近7天工地噪声和扬尘的信息")
@ApiImplicitParam(name = "buildLicense", value = "建筑许可编号", required = true, dataType = "String") @ApiImplicitParam(name = "buildLicense", value = "建筑许可编号", required = true, dataType = "String")
public Result selectWeekPmAndNoice(String buildLicense){ public Result selectWeekPmAndNoice(String buildLicense) {
List<BuildingRecordsDtos> records = buildingRecordsMapper.selectWeekPmAndNoice(buildLicense); List<BuildingRecordsDtos> records = buildingRecordsMapper.selectWeekPmAndNoice(buildLicense);
records.forEach(record ->{ records.forEach(record -> {
if (record.getPm10() == null && record.getNoice() == null){ if (record.getPm10() == null && record.getNoice() == null) {
record.setPm10(0); record.setPm10(0);
record.setNoice(0); record.setNoice(0);
} }
@ -110,15 +112,16 @@ public class BuildingController {
/** /**
* 根据建筑编号查询近30天工地噪声和扬尘的信息 * 根据建筑编号查询近30天工地噪声和扬尘的信息
*
* @return * @return
*/ */
@GetMapping("selectMonthPmAndNoice") @GetMapping("selectMonthPmAndNoice")
@ApiOperation("根据建筑编号查询近30天工地噪声和扬尘的信息") @ApiOperation("根据建筑编号查询近30天工地噪声和扬尘的信息")
@ApiImplicitParam(name = "buildLicense", value = "建筑许可编号", required = true, dataType = "String") @ApiImplicitParam(name = "buildLicense", value = "建筑许可编号", required = true, dataType = "String")
public Result selectMonthPmAndNoice(String buildLicense){ public Result selectMonthPmAndNoice(String buildLicense) {
List<BuildingRecordsDtos> records = buildingRecordsMapper.selectMonthPmAndNoice(buildLicense); List<BuildingRecordsDtos> records = buildingRecordsMapper.selectMonthPmAndNoice(buildLicense);
records.forEach(record ->{ records.forEach(record -> {
if (record.getPm10() == null && record.getNoice() == null){ if (record.getPm10() == null && record.getNoice() == null) {
record.setPm10(0); record.setPm10(0);
record.setNoice(0); record.setNoice(0);
} }
@ -129,6 +132,7 @@ public class BuildingController {
/** /**
* 查询工地扬尘事件 * 查询工地扬尘事件
*
* @return * @return
*/ */
@GetMapping("selectRaise") @GetMapping("selectRaise")
@ -136,21 +140,22 @@ public class BuildingController {
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "page", value = "页码", required = true, dataType = "Integer"), @ApiImplicitParam(name = "page", value = "页码", required = true, dataType = "Integer"),
@ApiImplicitParam(name = "pageSize", value = "页码大小", required = true, dataType = "Integer"), @ApiImplicitParam(name = "pageSize", value = "页码大小", required = true, dataType = "Integer"),
@ApiImplicitParam(name = "startTime",value = "开始时间",required = false,dataType = "String"), @ApiImplicitParam(name = "startTime", value = "开始时间", required = false, dataType = "String"),
@ApiImplicitParam(name = "endTime",value = "结束时间",required = false,dataType = "String") @ApiImplicitParam(name = "endTime", value = "结束时间", required = false, dataType = "String")
}) })
public Result selectRaise(Integer page,Integer pageSize,String startTime,String endTime){ public Result selectRaise(Integer page, Integer pageSize, String startTime, String endTime) {
List<BuildingRecordsDto> records = buildingRecordsMapper.selectRaise(page,pageSize,startTime,endTime); List<BuildingRecordsDto> records = buildingRecordsMapper.selectRaise(page, pageSize, startTime, endTime);
Integer integer = buildingRecordsMapper.selectCountRaise(); Integer integer = buildingRecordsMapper.selectCountRaise();
Map<String,Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
map.put("sum",integer); map.put("sum", integer);
map.put("data",records); map.put("data", records);
Result success = Result.success(map); Result success = Result.success(map);
return success; return success;
} }
/** /**
* 查询工地噪声事件 * 查询工地噪声事件
*
* @return * @return
*/ */
@GetMapping("selectNoiceEvent") @GetMapping("selectNoiceEvent")
@ -159,18 +164,19 @@ public class BuildingController {
@ApiImplicitParam(name = "page", value = "页码", required = true, dataType = "Integer"), @ApiImplicitParam(name = "page", value = "页码", required = true, dataType = "Integer"),
@ApiImplicitParam(name = "pageSize", value = "页码大小", required = true, dataType = "Integer") @ApiImplicitParam(name = "pageSize", value = "页码大小", required = true, dataType = "Integer")
}) })
public Result selectNoiceEvent(Integer page,Integer pageSize){ public Result selectNoiceEvent(Integer page, Integer pageSize) {
List<BuildingRecordsDto> records = buildingRecordsMapper.selectNoiceEvent(page,pageSize); List<BuildingRecordsDto> records = buildingRecordsMapper.selectNoiceEvent(page, pageSize);
Integer integer = buildingRecordsMapper.selectCountNoice(); Integer integer = buildingRecordsMapper.selectCountNoice();
Map<String,Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
map.put("sum",integer); map.put("sum", integer);
map.put("data",records); map.put("data", records);
Result success = Result.success(map); Result success = Result.success(map);
return success; return success;
} }
/** /**
* 查询工地视频感知事件 * 查询工地视频感知事件
*
* @return * @return
*/ */
@GetMapping("selectByAllEvent") @GetMapping("selectByAllEvent")
@ -179,28 +185,29 @@ public class BuildingController {
@ApiImplicitParam(name = "page", value = "页码", required = true, dataType = "Integer"), @ApiImplicitParam(name = "page", value = "页码", required = true, dataType = "Integer"),
@ApiImplicitParam(name = "pageSize", value = "页码大小", required = true, dataType = "Integer") @ApiImplicitParam(name = "pageSize", value = "页码大小", required = true, dataType = "Integer")
}) })
public Result selectByAllEvent(Integer page,Integer pageSize){ public Result selectByAllEvent(Integer page, Integer pageSize) {
List<EventDto> eventDtos = buildingRecordsMapper.selectByAllEvent(page, pageSize); List<EventDto> eventDtos = buildingRecordsMapper.selectByAllEvent(page, pageSize);
eventDtos.forEach(eventDto -> { eventDtos.forEach(eventDto -> {
eventDto.setEventNewName(eventDto.getEventCnName()); eventDto.setEventNewName(eventDto.getEventCnName());
}); });
Integer integer = buildingRecordsMapper.selectCountEvent(); Integer integer = buildingRecordsMapper.selectCountEvent();
Map<String,Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
map.put("sum",integer); map.put("sum", integer);
map.put("data",eventDtos); map.put("data", eventDtos);
Result success = Result.success(map); Result success = Result.success(map);
return success; return success;
} }
/** /**
* 根据工地名称搜索工地 * 根据工地名称搜索工地
*
* @param projectName * @param projectName
* @return * @return
*/ */
@GetMapping("selectByProjectName") @GetMapping("selectByProjectName")
@ApiOperation("根据工地名称搜索工地") @ApiOperation("根据工地名称搜索工地")
@ApiImplicitParam(name = "projectName", value = "工地名称",required = true,dataType ="String") @ApiImplicitParam(name = "projectName", value = "工地名称", required = true, dataType = "String")
public Result selectByProjectName(String projectName){ public Result selectByProjectName(String projectName) {
List<BuildingRecordsDto> records = buildingRecordsMapper.selectByProjectName(projectName); List<BuildingRecordsDto> records = buildingRecordsMapper.selectByProjectName(projectName);
Result success = Result.success(records); Result success = Result.success(records);
return success; return success;
@ -208,22 +215,23 @@ public class BuildingController {
/** /**
* 根据经纬度查询半径内所有的工地 * 根据经纬度查询半径内所有的工地
*
* @param jd * @param jd
* @param wd * @param wd
* @param radius * @param radius
* @return * @return
*/ */
@GetMapping ("selectByJdWd") @GetMapping("selectByJdWd")
@ApiOperation("根据经纬度查询半径内所有的工地") @ApiOperation("根据经纬度查询半径内所有的工地")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "jd", value = "经度",required = true,dataType ="Double"), @ApiImplicitParam(name = "jd", value = "经度", required = true, dataType = "Double"),
@ApiImplicitParam(name = "wd", value = "纬度",required = true,dataType ="Double"), @ApiImplicitParam(name = "wd", value = "纬度", required = true, dataType = "Double"),
@ApiImplicitParam(name = "radius", value = "半径,米",required = true,dataType ="Integer"),} @ApiImplicitParam(name = "radius", value = "半径,米", required = true, dataType = "Integer"),}
) )
public Result selectByJdWd(Double jd,Double wd,Integer radius){ public Result selectByJdWd(Double jd, Double wd, Integer radius) {
double[] around = LongLatUtil.getAround(jd, wd, radius); double[] around = LongLatUtil.getAround(jd, wd, radius);
List<BuildingRecordsDto> buildingRecordsDtos = buildingRecordsMapper.selectByJdWd(around[0], around[2], around[1], around[3]); List<BuildingRecordsDto> buildingRecordsDtos = buildingRecordsMapper.selectByJdWd(around[0], around[2], around[1], around[3]);
buildingRecordsDtos.forEach(buildingRecordsDto->{ buildingRecordsDtos.forEach(buildingRecordsDto -> {
buildingRecordsDto.setProjectName(buildingRecordsDto.getGdmc()); buildingRecordsDto.setProjectName(buildingRecordsDto.getGdmc());
}); });
Result success = Result.success(buildingRecordsDtos); Result success = Result.success(buildingRecordsDtos);
@ -232,181 +240,192 @@ public class BuildingController {
/** /**
* 查询当天工地视频感知事件 * 查询当天工地视频感知事件
*
* @return * @return
*/ */
@GetMapping("selectByEvent") @GetMapping("selectByEvent")
@ApiOperation("查询当天工地视频感知事件") @ApiOperation("查询当天工地视频感知事件")
public Result selectByEvent(){ public Result selectByEvent() {
List<EventDto> events = buildingRecordsMapper.selectByEvent(); List<EventDto> events = buildingRecordsMapper.selectByEvent();
events.forEach(eventDto -> { events.forEach(eventDto -> {
eventDto.setEventNewName(eventDto.getEventCnName()); eventDto.setEventNewName(eventDto.getEventCnName());
}); });
Map<String,Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
map.put("sum",events.size()); map.put("sum", events.size());
map.put("data",events); map.put("data", events);
Result success = Result.success(map); Result success = Result.success(map);
return success; return success;
} }
/** /**
* 查询当天扬尘事件 * 查询当天扬尘事件
*
* @return * @return
*/ */
@GetMapping("selectByDayRaise") @GetMapping("selectByDayRaise")
@ApiOperation("查询当天扬尘事件") @ApiOperation("查询当天扬尘事件")
public Result selectByDayRaise(){ public Result selectByDayRaise() {
List<BuildingRecordsDto> records = buildingRecordsMapper.selectByDayRaise(); List<BuildingRecordsDto> records = buildingRecordsMapper.selectByDayRaise();
Map<String,Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
map.put("sum",records.size()); map.put("sum", records.size());
map.put("data",records); map.put("data", records);
Result success = Result.success(map); Result success = Result.success(map);
return success; return success;
} }
/** /**
* 查询当天噪声事件 * 查询当天噪声事件
*
* @return * @return
*/ */
@GetMapping("selectByDayNoice") @GetMapping("selectByDayNoice")
@ApiOperation("查询当天噪声事件") @ApiOperation("查询当天噪声事件")
public Result selectByDayNoice(){ public Result selectByDayNoice() {
List<BuildingRecordsDto> records = buildingRecordsMapper.selectByDayNoice(); List<BuildingRecordsDto> records = buildingRecordsMapper.selectByDayNoice();
Map<String,Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
map.put("sum",records.size()); map.put("sum", records.size());
map.put("data",records); map.put("data", records);
Result success = Result.success(map); Result success = Result.success(map);
return success; return success;
} }
/** /**
* 查询当天道路污染事件 * 查询当天道路污染事件
*
* @return * @return
*/ */
@GetMapping("selectByDayRoadData") @GetMapping("selectByDayRoadData")
@ApiOperation("查询当天道路污染事件") @ApiOperation("查询当天道路污染事件")
public Result selectByDayRoadData(){ public Result selectByDayRoadData() {
RoadData byMaxId = roadDataMapper.getByMaxId(); RoadData byMaxId = roadDataMapper.getByMaxId();
String dt = byMaxId.getDt(); String dt = byMaxId.getDt();
List<RoadData> roadData = buildingRecordsMapper.selectByDayRoadData(dt); List<RoadData> roadData = buildingRecordsMapper.selectByDayRoadData(dt);
Map<String,Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
map.put("sum",roadData.size()); map.put("sum", roadData.size());
map.put("data",roadData); map.put("data", roadData);
Result success = Result.success(map); Result success = Result.success(map);
return success; return success;
} }
@GetMapping("exportEvent") @GetMapping("exportEvent")
public String exportRaiseEvent(String startTime,String endTime) throws Exception { public String exportRaiseEvent(String startTime, String endTime) throws Exception {
buildingRecordsService.testHSSF(startTime,endTime); buildingRecordsService.testHSSF(startTime, endTime);
return "导出成功"; return "导出成功";
} }
/** /**
* 查询近7天噪声事件 * 查询近7天噪声事件
*
* @return * @return
*/ */
@GetMapping("selectByWeekNoice") @GetMapping("selectByWeekNoice")
@ApiOperation("查询近7天噪声事件") @ApiOperation("查询近7天噪声事件")
public Result selectByWeekNoice(){ public Result selectByWeekNoice() {
List<BuildingRecordsDto> buildingRecordsDtos = buildingRecordsMapper.selectByWeekNoice(); List<BuildingRecordsDto> buildingRecordsDtos = buildingRecordsMapper.selectByWeekNoice();
Map<String,Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
map.put("sum",buildingRecordsDtos.size()); map.put("sum", buildingRecordsDtos.size());
map.put("data",buildingRecordsDtos); map.put("data", buildingRecordsDtos);
Result success = Result.success(map); Result success = Result.success(map);
return success; return success;
} }
/** /**
* 查询近30天噪声事件 * 查询近30天噪声事件
*
* @return * @return
*/ */
@GetMapping("selectByMonthNoice") @GetMapping("selectByMonthNoice")
@ApiOperation("查询近30天噪声事件") @ApiOperation("查询近30天噪声事件")
public Result selectByMonthNoice(){ public Result selectByMonthNoice() {
List<BuildingRecordsDto> buildingRecordsDtos = buildingRecordsMapper.selectByMonthNoice(); List<BuildingRecordsDto> buildingRecordsDtos = buildingRecordsMapper.selectByMonthNoice();
Map<String,Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
map.put("sum",buildingRecordsDtos.size()); map.put("sum", buildingRecordsDtos.size());
map.put("data",buildingRecordsDtos); map.put("data", buildingRecordsDtos);
Result success = Result.success(map); Result success = Result.success(map);
return success; return success;
} }
/** /**
* 查询近7天扬尘事件 * 查询近7天扬尘事件
*
* @return * @return
*/ */
@GetMapping("selectByWeekNaise") @GetMapping("selectByWeekNaise")
@ApiOperation("查询近7天扬尘事件") @ApiOperation("查询近7天扬尘事件")
public Result selectByWeekNaise(){ public Result selectByWeekNaise() {
List<BuildingRecordsDto> buildingRecordsDtos = buildingRecordsMapper.selectByWeekNaise(); List<BuildingRecordsDto> buildingRecordsDtos = buildingRecordsMapper.selectByWeekNaise();
Map<String,Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
map.put("sum",buildingRecordsDtos.size()); map.put("sum", buildingRecordsDtos.size());
map.put("data",buildingRecordsDtos); map.put("data", buildingRecordsDtos);
Result success = Result.success(map); Result success = Result.success(map);
return success; return success;
} }
/** /**
* 查询近30天扬尘事件 * 查询近30天扬尘事件
*
* @return * @return
*/ */
@GetMapping("selectByMonthNaise") @GetMapping("selectByMonthNaise")
@ApiOperation("查询近30天扬尘事件") @ApiOperation("查询近30天扬尘事件")
public Result selectByMonthNaise(){ public Result selectByMonthNaise() {
List<BuildingRecordsDto> buildingRecordsDtos = buildingRecordsMapper.selectByMonthNaise(); List<BuildingRecordsDto> buildingRecordsDtos = buildingRecordsMapper.selectByMonthNaise();
Map<String,Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
map.put("sum",buildingRecordsDtos.size()); map.put("sum", buildingRecordsDtos.size());
map.put("data",buildingRecordsDtos); map.put("data", buildingRecordsDtos);
Result success = Result.success(map); Result success = Result.success(map);
return success; return success;
} }
/** /**
* 查询近7天工地视频感知事件 * 查询近7天工地视频感知事件
*
* @return * @return
*/ */
@GetMapping("selectByWeekEvent") @GetMapping("selectByWeekEvent")
@ApiOperation("查询近7天工地视频感知事件") @ApiOperation("查询近7天工地视频感知事件")
public Result selectByWeekEvent(){ public Result selectByWeekEvent() {
List<EventDto> events = buildingRecordsMapper.selectByWeekEvent(); List<EventDto> events = buildingRecordsMapper.selectByWeekEvent();
events.forEach(eventDto -> { events.forEach(eventDto -> {
eventDto.setEventNewName(eventDto.getEventCnName()); eventDto.setEventNewName(eventDto.getEventCnName());
}); });
Map<String,Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
map.put("sum",events.size()); map.put("sum", events.size());
map.put("data",events); map.put("data", events);
Result success = Result.success(map); Result success = Result.success(map);
return success; return success;
} }
/** /**
* 查询近30天工地视频感知事件 * 查询近30天工地视频感知事件
*
* @return * @return
*/ */
@GetMapping("selectByMonthEvent") @GetMapping("selectByMonthEvent")
@ApiOperation("查询近30天工地视频感知事件") @ApiOperation("查询近30天工地视频感知事件")
public Result selectByMonthEvent(){ public Result selectByMonthEvent() {
List<EventDto> events = buildingRecordsMapper.selectByMonthEvent(); List<EventDto> events = buildingRecordsMapper.selectByMonthEvent();
events.forEach(eventDto -> { events.forEach(eventDto -> {
eventDto.setEventNewName(eventDto.getEventCnName()); eventDto.setEventNewName(eventDto.getEventCnName());
}); });
Map<String,Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
map.put("sum",events.size()); map.put("sum", events.size());
map.put("data",events); map.put("data", events);
Result success = Result.success(map); Result success = Result.success(map);
return success; return success;
} }
/** /**
* 查询近30天物联感知事件时间趋势 * 查询近30天物联感知事件时间趋势
*
* @return * @return
*/ */
@GetMapping("selectMonthCurrentByBuilding") @GetMapping("selectMonthCurrentByBuilding")
@ApiOperation("查询近30天物联感知事件时间趋势") @ApiOperation("查询近30天物联感知事件时间趋势")
public Result selectMonthCurrentByBuilding(){ public Result selectMonthCurrentByBuilding() {
List<BuildingRecordsDtos> buildingRecordsDtos = buildingRecordsMapper.selectMonthCurrentByBuilding(); List<BuildingRecordsDtos> buildingRecordsDtos = buildingRecordsMapper.selectMonthCurrentByBuilding();
buildingRecordsDtos.forEach(buildingRecordsDto -> { buildingRecordsDtos.forEach(buildingRecordsDto -> {
if (buildingRecordsDto.getNumber() == null){ if (buildingRecordsDto.getNumber() == null) {
buildingRecordsDto.setNumber(0); buildingRecordsDto.setNumber(0);
} }
}); });
@ -416,14 +435,15 @@ public class BuildingController {
/** /**
* 查询近30天工地视频感知事件时间趋势 * 查询近30天工地视频感知事件时间趋势
*
* @return * @return
*/ */
@GetMapping("selectMonthCurrentByEvent") @GetMapping("selectMonthCurrentByEvent")
@ApiOperation("查询近30天工地视频感知事件时间趋势") @ApiOperation("查询近30天工地视频感知事件时间趋势")
public Result selectMonthCurrentByEvent(){ public Result selectMonthCurrentByEvent() {
List<BuildingRecordsDtos> buildingRecordsDtos = buildingRecordsMapper.selectMonthCurrentByEvent(); List<BuildingRecordsDtos> buildingRecordsDtos = buildingRecordsMapper.selectMonthCurrentByEvent();
buildingRecordsDtos.forEach(buildingRecordsDto -> { buildingRecordsDtos.forEach(buildingRecordsDto -> {
if (buildingRecordsDto.getNumber() == null){ if (buildingRecordsDto.getNumber() == null) {
buildingRecordsDto.setNumber(0); buildingRecordsDto.setNumber(0);
} }
}); });
@ -433,62 +453,66 @@ public class BuildingController {
/** /**
* 查询走航监测top5全部道路污染事件 * 查询走航监测top5全部道路污染事件
*
* @return * @return
*/ */
@GetMapping("selectRoadDataCountEvent") @GetMapping("selectRoadDataCountEvent")
@ApiOperation("查询走航监测top5全部道路污染事件") @ApiOperation("查询走航监测top5全部道路污染事件")
public Result selectRoadDataCountEvent(){ public Result selectRoadDataCountEvent() {
List<RoadDataDto> roadDataDtos = buildingRecordsMapper.selectRoadDataCountEvent(); List<RoadDataDto> roadDataDtos = buildingRecordsMapper.selectRoadDataCountEvent();
Integer integer = roadDataMapper.selectCountRoadData(); Integer integer = roadDataMapper.selectCountRoadData();
Map<String,Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
map.put("sum",integer); map.put("sum", integer);
map.put("roadDataDtos",roadDataDtos); map.put("roadDataDtos", roadDataDtos);
Result success = Result.success(map); Result success = Result.success(map);
return success; return success;
} }
/** /**
* 查询走航监测top5近7天道路污染事件 * 查询走航监测top5近7天道路污染事件
*
* @return * @return
*/ */
@GetMapping("selectRoadDataWeekEvent") @GetMapping("selectRoadDataWeekEvent")
@ApiOperation("查询走航监测top5近7天道路污染事件") @ApiOperation("查询走航监测top5近7天道路污染事件")
public Result selectRoadDataWeekEvent(){ public Result selectRoadDataWeekEvent() {
List<RoadDataDto> roadDataDtos = buildingRecordsMapper.selectRoadDataWeekEvent(); List<RoadDataDto> roadDataDtos = buildingRecordsMapper.selectRoadDataWeekEvent();
Integer integer = roadDataMapper.selectCountWeekRoadData(); Integer integer = roadDataMapper.selectCountWeekRoadData();
Map<String,Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
map.put("sum",integer); map.put("sum", integer);
map.put("roadDataDtos",roadDataDtos); map.put("roadDataDtos", roadDataDtos);
Result success = Result.success(map); Result success = Result.success(map);
return success; return success;
} }
/** /**
* 查询走航监测top5近30天道路污染事件 * 查询走航监测top5近30天道路污染事件
*
* @return * @return
*/ */
@GetMapping("selectRoadDataMonthEvent") @GetMapping("selectRoadDataMonthEvent")
@ApiOperation("查询走航监测top5近30天道路污染事件") @ApiOperation("查询走航监测top5近30天道路污染事件")
public Result selectRoadDataMonthEvent(){ public Result selectRoadDataMonthEvent() {
List<RoadDataDto> roadDataDtos = buildingRecordsMapper.selectRoadDataMonthEvent(); List<RoadDataDto> roadDataDtos = buildingRecordsMapper.selectRoadDataMonthEvent();
Integer integer = roadDataMapper.selectCountMonthRoadData(); Integer integer = roadDataMapper.selectCountMonthRoadData();
Map<String,Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
map.put("sum",integer); map.put("sum", integer);
map.put("roadDataDtos",roadDataDtos); map.put("roadDataDtos", roadDataDtos);
Result success = Result.success(map); Result success = Result.success(map);
return success; return success;
} }
/** /**
* 查询近30天走航监测事件时间趋势 * 查询近30天走航监测事件时间趋势
*
* @return * @return
*/ */
@GetMapping("selectMonthCurrentByRoadData") @GetMapping("selectMonthCurrentByRoadData")
@ApiOperation("查询近30天走航监测事件时间趋势") @ApiOperation("查询近30天走航监测事件时间趋势")
public Result selectMonthCurrentByRoadData(){ public Result selectMonthCurrentByRoadData() {
List<BuildingRecordsDtos> buildingRecordsDtos = buildingRecordsMapper.selectMonthCurrentByRoadData(); List<BuildingRecordsDtos> buildingRecordsDtos = buildingRecordsMapper.selectMonthCurrentByRoadData();
buildingRecordsDtos.forEach(buildingRecordsDto -> { buildingRecordsDtos.forEach(buildingRecordsDto -> {
if (buildingRecordsDto.getNumber() == null){ if (buildingRecordsDto.getNumber() == null) {
buildingRecordsDto.setNumber(0); buildingRecordsDto.setNumber(0);
} }
}); });
@ -497,5 +521,4 @@ public class BuildingController {
} }
} }

View File

@ -13,11 +13,12 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import java.util.List; import java.util.List;
@RestController @RestController
@RequestMapping("api/project") @RequestMapping("api/project")
@Api(tags="视频监控") @Api(tags = "视频监控")
public class Controller { public class Controller {
@Autowired @Autowired
@ -45,7 +46,7 @@ public class Controller {
private ChannelPictureMapper channelPictureMapper; private ChannelPictureMapper channelPictureMapper;
@GetMapping("all") @GetMapping("all")
public Object all(){ public Object all() {
List<Project> projects = projectMapper.selectList(null); List<Project> projects = projectMapper.selectList(null);
projects.forEach(project -> { projects.forEach(project -> {
List<Picture> pics = cameraMapper.selectPicByProjectId(project.getId()); List<Picture> pics = cameraMapper.selectPicByProjectId(project.getId());
@ -57,10 +58,11 @@ public class Controller {
/** /**
* 推送给城管接口用的 * 推送给城管接口用的
*
* @return * @return
*/ */
@GetMapping("cameras") @GetMapping("cameras")
public Result cameras(){ public Result cameras() {
List<ChannelPictureDto> channelPictureDtos = channelPictureMapper.selectByProject(); List<ChannelPictureDto> channelPictureDtos = channelPictureMapper.selectByProject();
Result success = Result.success(channelPictureDtos); Result success = Result.success(channelPictureDtos);
success.setCount(channelPictureDtos.size()); success.setCount(channelPictureDtos.size());
@ -68,11 +70,10 @@ public class Controller {
} }
/** /**
*
* @return * @return
*/ */
@GetMapping("camera") @GetMapping("camera")
public Result camera(){ public Result camera() {
List<PictureDto> pictureDtos = channelPictureMapper.selectByPicture(); List<PictureDto> pictureDtos = channelPictureMapper.selectByPicture();
Result success = Result.success(pictureDtos); Result success = Result.success(pictureDtos);
return success; return success;
@ -80,10 +81,11 @@ public class Controller {
/** /**
* 景区人流识别 * 景区人流识别
*
* @return * @return
*/ */
@GetMapping("scenicCamera") @GetMapping("scenicCamera")
public Result scenicCamera(){ public Result scenicCamera() {
List<ScenicCameraDto> scenicCameraDtos = scenicMapper.selectScenicCameras(); List<ScenicCameraDto> scenicCameraDtos = scenicMapper.selectScenicCameras();
Result success = Result.success(scenicCameraDtos); Result success = Result.success(scenicCameraDtos);
success.setCount(scenicCameraDtos.size()); success.setCount(scenicCameraDtos.size());
@ -91,21 +93,21 @@ public class Controller {
} }
@GetMapping("capture") @GetMapping("capture")
public Object capture(){ public Object capture() {
monitorService.CameraScreenshot(); monitorService.CameraScreenshot();
return "finish capture"; return "finish capture";
} }
@GetMapping("startScenic") @GetMapping("startScenic")
public Object startScenic(){ public Object startScenic() {
monitorService.startScenic(); monitorService.startScenic();
return "startScenic finish"; return "startScenic finish";
} }
@GetMapping("capture1") @GetMapping("capture1")
public Object capture1(){ public Object capture1() {
monitorService.scenicSpotAndBathing1(); monitorService.scenicSpotAndBathing1();
return "finish capture"; return "finish capture";
@ -114,24 +116,26 @@ public class Controller {
/** /**
* 查询所有摄像头 * 查询所有摄像头
*
* @param * @param
* @return * @return
*/ */
@GetMapping("selectAll") @GetMapping("selectAll")
@ApiOperation("查询所有摄像头") @ApiOperation("查询所有摄像头")
public String selectAll(){ public String selectAll() {
return cameraChannelService.selectAll(); return cameraChannelService.selectAll();
} }
/** /**
* 根据channelCode查询摄像头详细信息 * 根据channelCode查询摄像头详细信息
*
* @param channelCode * @param channelCode
* @return * @return
*/ */
@GetMapping("selectByChannelCode") @GetMapping("selectByChannelCode")
@ApiOperation("根据摄像头编号查询摄像头详细信息") @ApiOperation("根据摄像头编号查询摄像头详细信息")
@ApiImplicitParam(name = "channelCode",value = "摄像头标识",required = true,dataType = "String") @ApiImplicitParam(name = "channelCode", value = "摄像头标识", required = true, dataType = "String")
public Result selectByChannelCode(String channelCode){ public Result selectByChannelCode(String channelCode) {
List<CameraChannelDto1> list = cameraChannelMapper.selectByChannelCode(channelCode); List<CameraChannelDto1> list = cameraChannelMapper.selectByChannelCode(channelCode);
@ -144,13 +148,14 @@ public class Controller {
/** /**
* 根据摄像头名字模糊查询摄像头 * 根据摄像头名字模糊查询摄像头
*
* @param channelName * @param channelName
* @return * @return
*/ */
@GetMapping("selectByChannelName") @GetMapping("selectByChannelName")
@ApiOperation("根据摄像头名字模糊查询摄像头") @ApiOperation("根据摄像头名字模糊查询摄像头")
@ApiImplicitParam(name = "channelName",value = "摄像头名称",required = true,dataType = "String") @ApiImplicitParam(name = "channelName", value = "摄像头名称", required = true, dataType = "String")
public Result selectByChannelName(String channelName){ public Result selectByChannelName(String channelName) {
List<CameraChannel> labels = cameraChannelMapper.selectByChannelName(channelName); List<CameraChannel> labels = cameraChannelMapper.selectByChannelName(channelName);
@ -161,18 +166,19 @@ public class Controller {
/** /**
* 根据parentId和checkStatus查询摄像头 * 根据parentId和checkStatus查询摄像头
*
* @param parentId * @param parentId
* @return * @return
*/ */
@GetMapping("selectByParentId") @GetMapping("selectByParentId")
@ApiOperation("根据摄像头的组织Id和异常状态查询摄像头") @ApiOperation("根据摄像头的组织Id和异常状态查询摄像头")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "parentId",value = "摄像头的组织Id",required = true,dataType = "String"), @ApiImplicitParam(name = "parentId", value = "摄像头的组织Id", required = true, dataType = "String"),
@ApiImplicitParam(name = "checkStatus",value = "异常状态 1正常,0异常",required = true,dataType = "String") @ApiImplicitParam(name = "checkStatus", value = "异常状态 1正常,0异常", required = true, dataType = "String")
}) })
public Result selectByParentId(String parentId,String checkStatus){ public Result selectByParentId(String parentId, String checkStatus) {
List<CameraChannel> list = cameraChannelMapper.selectByParentId(parentId,checkStatus); List<CameraChannel> list = cameraChannelMapper.selectByParentId(parentId, checkStatus);
Result success = Result.success(list); Result success = Result.success(list);
@ -182,16 +188,17 @@ public class Controller {
/** /**
* 根据标签查询对应摄像头 * 根据标签查询对应摄像头
*
* @return * @return
*/ */
@GetMapping("selectLabel") @GetMapping("selectLabel")
@ApiOperation("根据标签查询对应摄像头") @ApiOperation("根据标签查询对应摄像头")
@ApiImplicitParam(name = "labelCode",value = "标签号",required = true,dataType = "String") @ApiImplicitParam(name = "labelCode", value = "标签号", required = true, dataType = "String")
public Result selectLabel(String labelCode){ public Result selectLabel(String labelCode) {
List<ChannelLabelDto> channelLabelDtos = cameraChannelMapper.selectLabel(labelCode); List<ChannelLabelDto> channelLabelDtos = cameraChannelMapper.selectLabel(labelCode);
for (ChannelLabelDto channelLabelDto :channelLabelDtos) { for (ChannelLabelDto channelLabelDto : channelLabelDtos) {
String nodeName = channelLabelDto.getNodeName(); String nodeName = channelLabelDto.getNodeName();
String[] splits = nodeName.split("->"); String[] splits = nodeName.split("->");
String split = splits[1]; String split = splits[1];
@ -204,19 +211,20 @@ public class Controller {
/** /**
* 根据经纬度查询半径内所有的摄像头 * 根据经纬度查询半径内所有的摄像头
*
* @param gpsX * @param gpsX
* @param gpsY * @param gpsY
* @param radius * @param radius
* @return * @return
*/ */
@GetMapping ("selectAllByGps") @GetMapping("selectAllByGps")
@ApiOperation("根据经纬度查询半径内所有的摄像头") @ApiOperation("根据经纬度查询半径内所有的摄像头")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "gpsX", value = "经度",required = true,dataType ="Double"), @ApiImplicitParam(name = "gpsX", value = "经度", required = true, dataType = "Double"),
@ApiImplicitParam(name = "gpsY", value = "纬度",required = true,dataType ="Double"), @ApiImplicitParam(name = "gpsY", value = "纬度", required = true, dataType = "Double"),
@ApiImplicitParam(name = "radius", value = "半径,米",required = true,dataType ="Integer"),} @ApiImplicitParam(name = "radius", value = "半径,米", required = true, dataType = "Integer"),}
) )
public Result selectAllByGps(Double gpsX,Double gpsY,Integer radius){ public Result selectAllByGps(Double gpsX, Double gpsY, Integer radius) {
double[] around = LongLatUtil.getAround(gpsX, gpsY, radius); double[] around = LongLatUtil.getAround(gpsX, gpsY, radius);
List<CameraChannel> c = cameraChannelMapper.selectAllByGps(around[0], around[2], around[1], around[3]); List<CameraChannel> c = cameraChannelMapper.selectAllByGps(around[0], around[2], around[1], around[3]);
Result success = Result.success(c); Result success = Result.success(c);
@ -225,11 +233,12 @@ public class Controller {
/** /**
* 查询所有标签 * 查询所有标签
*
* @return * @return
*/ */
@GetMapping("selectAllLabel") @GetMapping("selectAllLabel")
@ApiOperation("查询所有标签") @ApiOperation("查询所有标签")
public Result selectAllLabel(){ public Result selectAllLabel() {
List<Label> labels = cameraChannelMapper.selectAllLabel(); List<Label> labels = cameraChannelMapper.selectAllLabel();
@ -240,11 +249,12 @@ public class Controller {
/** /**
* 查询city为1的标签 * 查询city为1的标签
*
* @return * @return
*/ */
@GetMapping("selectByLabelCity") @GetMapping("selectByLabelCity")
@ApiOperation("查询city为1的标签") @ApiOperation("查询city为1的标签")
public Result selectByLabelCity(){ public Result selectByLabelCity() {
List<Label> labels = cameraChannelMapper.selectByLabelCity(); List<Label> labels = cameraChannelMapper.selectByLabelCity();
@ -255,13 +265,14 @@ public class Controller {
/** /**
* 根据标签名字模糊查询标签 * 根据标签名字模糊查询标签
*
* @param labelName * @param labelName
* @return * @return
*/ */
@GetMapping("selectByLabelName") @GetMapping("selectByLabelName")
@ApiOperation("根据标签名字模糊查询标签") @ApiOperation("根据标签名字模糊查询标签")
@ApiImplicitParam(name = "labelName",value = "标签名称",required = true,dataType = "String") @ApiImplicitParam(name = "labelName", value = "标签名称", required = true, dataType = "String")
public Result selectByLabelName(String labelName){ public Result selectByLabelName(String labelName) {
List<Label> labels = cameraChannelMapper.selectByLabelName(labelName); List<Label> labels = cameraChannelMapper.selectByLabelName(labelName);
@ -272,14 +283,15 @@ public class Controller {
/** /**
* 根据parentId查询组织 * 根据parentId查询组织
*
* @param parentId * @param parentId
* @return * @return
*/ */
@GetMapping("selectSubOrgan") @GetMapping("selectSubOrgan")
@ApiOperation("根据上级组织id查询组织") @ApiOperation("根据上级组织id查询组织")
@ApiImplicitParam(name = "parentId",value = "上级组织id",required = true,dataType = "String") @ApiImplicitParam(name = "parentId", value = "上级组织id", required = true, dataType = "String")
public Result selectSubOrganization(String parentId){ public Result selectSubOrganization(String parentId) {
if (parentId == null){ if (parentId == null) {
parentId = ""; parentId = "";
} }
@ -292,6 +304,7 @@ public class Controller {
/** /**
* 提供给其他项目分页查询摄像头接口 * 提供给其他项目分页查询摄像头接口
*
* @param page * @param page
* @param pageSize * @param pageSize
* @return * @return
@ -299,11 +312,11 @@ public class Controller {
@GetMapping("selectCamera") @GetMapping("selectCamera")
@ApiOperation("提供给其他项目分页查询摄像头接口") @ApiOperation("提供给其他项目分页查询摄像头接口")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "page",value = "页码",required = true,dataType = "Integer"), @ApiImplicitParam(name = "page", value = "页码", required = true, dataType = "Integer"),
@ApiImplicitParam(name = "pageSize",value = "页码大小",required = true,dataType = "Integer") @ApiImplicitParam(name = "pageSize", value = "页码大小", required = true, dataType = "Integer")
}) })
public Result selectNLAll(Integer page,Integer pageSize){ public Result selectNLAll(Integer page, Integer pageSize) {
List<CameraChannelNLDto> selectNLAll = cameraChannelMapper.selectNLAll(page,pageSize); List<CameraChannelNLDto> selectNLAll = cameraChannelMapper.selectNLAll(page, pageSize);
Result success = Result.success(selectNLAll); Result success = Result.success(selectNLAll);
return success; return success;
} }

View File

@ -37,16 +37,18 @@ public class EventController {
/** /**
* 订阅任务下发接口 * 订阅任务下发接口
*
* @return * @return
*/ */
@GetMapping("subscribe") @GetMapping("subscribe")
public JSONObject subscribe(){ public JSONObject subscribe() {
return eventService.subscribe(); return eventService.subscribe();
} }
/** /**
* 订阅任务下发接口 * 订阅任务下发接口
*
* @param request * @param request
* @return * @return
* @throws IOException * @throws IOException
@ -68,9 +70,9 @@ public class EventController {
event.setEventCnName(jsonObject.getString("eventAlias")); event.setEventCnName(jsonObject.getString("eventAlias"));
event.setEventSerial(jsonObject.getString("eventSerial")); event.setEventSerial(jsonObject.getString("eventSerial"));
JSONObject attributes = jsonObject.getJSONObject("attributes"); JSONObject attributes = jsonObject.getJSONObject("attributes");
if (attributes!=null){ if (attributes != null) {
JSONObject text = attributes.getJSONObject("text"); JSONObject text = attributes.getJSONObject("text");
if (text != null){ if (text != null) {
event.setVehicle(text.getString("valueDescription")); event.setVehicle(text.getString("valueDescription"));
} }
JSONObject color = attributes.getJSONObject("color"); JSONObject color = attributes.getJSONObject("color");
@ -95,14 +97,14 @@ public class EventController {
} }
} }
JSONObject camera = jsonObject.getJSONObject("camera"); JSONObject camera = jsonObject.getJSONObject("camera");
if (camera!=null){ if (camera != null) {
event.setCameraName(camera.getString("cameraName")); event.setCameraName(camera.getString("cameraName"));
event.setDistrict(camera.getString("district")); event.setDistrict(camera.getString("district"));
event.setLatitude(camera.getBigDecimal("latitude")); event.setLatitude(camera.getBigDecimal("latitude"));
event.setLongitude(camera.getBigDecimal("longitude")); event.setLongitude(camera.getBigDecimal("longitude"));
} }
JSONObject image = jsonObject.getJSONObject("image"); JSONObject image = jsonObject.getJSONObject("image");
if (image!=null){ if (image != null) {
event.setImageUrl(image.getString("imageUrl")); event.setImageUrl(image.getString("imageUrl"));
} }
event.setTaskId(jsonObject.getString("taskId")); event.setTaskId(jsonObject.getString("taskId"));
@ -111,7 +113,7 @@ public class EventController {
try { try {
date = sdf.parse(sdf.format(jsonObject.get("captureTime"))); date = sdf.parse(sdf.format(jsonObject.get("captureTime")));
event.setCaptureTime(sdf.format(date)); event.setCaptureTime(sdf.format(date));
}catch (Exception e){ } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
event.setTrackEvent(jsonObject.getString("trackEvent")); event.setTrackEvent(jsonObject.getString("trackEvent"));
@ -123,17 +125,19 @@ public class EventController {
/** /**
* 事件模板分页查询接口 * 事件模板分页查询接口
*
* @return * @return
*/ */
@GetMapping("tamplate") @GetMapping("tamplate")
@ApiOperation("事件模板分页查询接口") @ApiOperation("事件模板分页查询接口")
public JSONObject tamplate(){ public JSONObject tamplate() {
return eventService.template(); return eventService.template();
} }
/** /**
* 查询所有事件 * 查询所有事件
*
* @return * @return
*/ */
@GetMapping("selectEvent") @GetMapping("selectEvent")
@ -142,28 +146,28 @@ public class EventController {
@ApiImplicitParam(name = "page", value = "页码", required = false, dataType = "Integer"), @ApiImplicitParam(name = "page", value = "页码", required = false, dataType = "Integer"),
@ApiImplicitParam(name = "pageSize", value = "页码大小", required = false, dataType = "Integer") @ApiImplicitParam(name = "pageSize", value = "页码大小", required = false, dataType = "Integer")
}) })
public Result selectEvent(Integer page,Integer pageSize){ public Result selectEvent(Integer page, Integer pageSize) {
List<EventDto> events = eventMapper.selectEvent(page,pageSize); List<EventDto> events = eventMapper.selectEvent(page, pageSize);
for (EventDto event: events) { for (EventDto event : events) {
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("户外桌椅")) {
event.setEventNewName("占道经营"); event.setEventNewName("占道经营");
}else if (event.getEventCnName().equals("纸箱")|| event.getEventCnName().equals("街头散落垃圾") } else if (event.getEventCnName().equals("纸箱") || event.getEventCnName().equals("街头散落垃圾")
||event.getEventCnName().equals("塑料篮子")){ || event.getEventCnName().equals("塑料篮子")) {
event.setEventNewName("环境卫生"); event.setEventNewName("环境卫生");
}else if (event.getEventCnName().equals("沿街晾晒衣物被单")){ } else if (event.getEventCnName().equals("沿街晾晒衣物被单")) {
event.setEventNewName("沿街晾晒"); event.setEventNewName("沿街晾晒");
}else if (event.getEventCnName().equals("机动车违停")){ } else if (event.getEventCnName().equals("机动车违停")) {
event.setEventNewName("违章停车"); event.setEventNewName("违章停车");
}else { } else {
event.setEventNewName(event.getEventCnName()); event.setEventNewName(event.getEventCnName());
} }
} }
Integer integer = eventMapper.selectCountEvent(); Integer integer = eventMapper.selectCountEvent();
page = integer/pageSize + 1; page = integer / pageSize + 1;
Map<String,Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
map.put("page",page); map.put("page", page);
map.put("events",events); map.put("events", events);
Result success = Result.success(map); Result success = Result.success(map);
return success; return success;
@ -171,24 +175,25 @@ public class EventController {
/** /**
* 查询当天事件 * 查询当天事件
*
* @return * @return
*/ */
@GetMapping("selectByTime") @GetMapping("selectByTime")
@ApiOperation("查询当天事件") @ApiOperation("查询当天事件")
public Result selectByTime(){ public Result selectByTime() {
List<EventDto> events = eventMapper.selectByTime(); List<EventDto> events = eventMapper.selectByTime();
for (EventDto event: events) { for (EventDto event : events) {
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("户外桌椅")) {
event.setEventNewName("占道经营"); event.setEventNewName("占道经营");
}else if (event.getEventCnName().equals("纸箱")|| event.getEventCnName().equals("街头散落垃圾") } else if (event.getEventCnName().equals("纸箱") || event.getEventCnName().equals("街头散落垃圾")
||event.getEventCnName().equals("塑料篮子")){ || event.getEventCnName().equals("塑料篮子")) {
event.setEventNewName("环境卫生"); event.setEventNewName("环境卫生");
}else if (event.getEventCnName().equals("沿街晾晒衣物被单")){ } else if (event.getEventCnName().equals("沿街晾晒衣物被单")) {
event.setEventNewName("沿街晾晒"); event.setEventNewName("沿街晾晒");
}else if (event.getEventCnName().equals("机动车违停")){ } else if (event.getEventCnName().equals("机动车违停")) {
event.setEventNewName("违章停车"); event.setEventNewName("违章停车");
}else { } else {
event.setEventNewName(event.getEventCnName()); event.setEventNewName(event.getEventCnName());
} }
} }
@ -201,6 +206,7 @@ public class EventController {
/** /**
* 根据事件名称查询事件 * 根据事件名称查询事件
*
* @param eventNewName * @param eventNewName
* @return * @return
*/ */
@ -211,62 +217,62 @@ public class EventController {
@ApiImplicitParam(name = "page", value = "页码", required = false, dataType = "Integer"), @ApiImplicitParam(name = "page", value = "页码", required = false, dataType = "Integer"),
@ApiImplicitParam(name = "pageSize", value = "页码大小", required = false, dataType = "Integer") @ApiImplicitParam(name = "pageSize", value = "页码大小", required = false, dataType = "Integer")
}) })
public Result selectByName(String eventNewName,Integer page,Integer pageSize){ public Result selectByName(String eventNewName, Integer page, Integer pageSize) {
if (eventNewName.equals("环境卫生")){ if (eventNewName.equals("环境卫生")) {
List<EventDto> lists = eventMapper.selectByName("'塑料篮子','纸箱','街头散落垃圾'",page,pageSize); List<EventDto> lists = eventMapper.selectByName("'塑料篮子','纸箱','街头散落垃圾'", page, pageSize);
lists.forEach(list ->{ lists.forEach(list -> {
list.setEventNewName("环境卫生"); list.setEventNewName("环境卫生");
}); });
Integer integer = eventMapper.selectCountByName("'塑料篮子','纸箱','街头散落垃圾'"); Integer integer = eventMapper.selectCountByName("'塑料篮子','纸箱','街头散落垃圾'");
Map<String,Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
map.put("sum",integer); map.put("sum", integer);
map.put("events",lists); map.put("events", lists);
Result success = Result.success(map); Result success = Result.success(map);
return success; return success;
}else if (eventNewName.equals("占道经营")){ } else if (eventNewName.equals("占道经营")) {
List<EventDto> lists = eventMapper.selectByName("'街头伞篷','水果和食品摊','地摊','户外桌椅'",page,pageSize); List<EventDto> lists = eventMapper.selectByName("'街头伞篷','水果和食品摊','地摊','户外桌椅'", page, pageSize);
lists.forEach(list ->{ lists.forEach(list -> {
list.setEventNewName("占道经营"); list.setEventNewName("占道经营");
}); });
Integer integer = eventMapper.selectCountByName("'街头伞篷','水果和食品摊','地摊','户外桌椅'"); Integer integer = eventMapper.selectCountByName("'街头伞篷','水果和食品摊','地摊','户外桌椅'");
Map<String,Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
map.put("sum",integer); map.put("sum", integer);
map.put("events",lists); map.put("events", lists);
Result success = Result.success(map); Result success = Result.success(map);
return success; return success;
}else if (eventNewName.equals("沿街晾晒")){ } else if (eventNewName.equals("沿街晾晒")) {
List<EventDto> lists = eventMapper.selectByName("'沿街晾晒衣物被单'",page,pageSize); List<EventDto> lists = eventMapper.selectByName("'沿街晾晒衣物被单'", page, pageSize);
lists.forEach(list ->{ lists.forEach(list -> {
list.setEventNewName("沿街晾晒"); list.setEventNewName("沿街晾晒");
}); });
Integer integer = eventMapper.selectCountByName("'沿街晾晒衣物被单'"); Integer integer = eventMapper.selectCountByName("'沿街晾晒衣物被单'");
Map<String,Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
map.put("sum",integer); map.put("sum", integer);
map.put("events",lists); map.put("events", lists);
Result success = Result.success(map); Result success = Result.success(map);
return success; return success;
}else if (eventNewName.equals("违章停车")){ } else if (eventNewName.equals("违章停车")) {
List<EventDto> lists = eventMapper.selectByName("'机动车违停'",page,pageSize); List<EventDto> lists = eventMapper.selectByName("'机动车违停'", page, pageSize);
lists.forEach(list ->{ lists.forEach(list -> {
list.setEventNewName("违章停车"); list.setEventNewName("违章停车");
}); });
Integer integer = eventMapper.selectCountByName("'机动车违停'"); Integer integer = eventMapper.selectCountByName("'机动车违停'");
Map<String,Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
map.put("sum",integer); map.put("sum", integer);
map.put("events",lists); map.put("events", lists);
Result success = Result.success(map); Result success = Result.success(map);
return success; return success;
}else { } else {
StringBuilder str = new StringBuilder(eventNewName); StringBuilder str = new StringBuilder(eventNewName);
String s = str.insert(0, "'").append("'").toString(); String s = str.insert(0, "'").append("'").toString();
List<EventDto> lists = eventMapper.selectByName(s, page, pageSize); List<EventDto> lists = eventMapper.selectByName(s, page, pageSize);
lists.forEach(list ->{ lists.forEach(list -> {
list.setEventNewName(list.getEventCnName()); list.setEventNewName(list.getEventCnName());
}); });
Integer integer = eventMapper.selectCountByName(s); Integer integer = eventMapper.selectCountByName(s);
Map<String,Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
map.put("sum",integer); map.put("sum", integer);
map.put("events",lists); map.put("events", lists);
Result success = Result.success(map); Result success = Result.success(map);
return success; return success;
} }
@ -274,12 +280,13 @@ public class EventController {
/** /**
* 查询当天根据事件名称查询事件 * 查询当天根据事件名称查询事件
*
* @param eventNewName * @param eventNewName
* @return * @return
*/ */
@GetMapping("selectByTimeAndName") @GetMapping("selectByTimeAndName")
@ApiOperation("查询当天根据事件名称查询事件") @ApiOperation("查询当天根据事件名称查询事件")
@ApiImplicitParam(name = "eventNewName",value = "事件名称",required = true,dataType = "String") @ApiImplicitParam(name = "eventNewName", value = "事件名称", required = true, dataType = "String")
public Result selectByTimeAndName(String eventNewName) { public Result selectByTimeAndName(String eventNewName) {
if (eventNewName.equals("环境卫生")) { if (eventNewName.equals("环境卫生")) {
List<EventDto> lists = eventMapper.selectByTimeAndName("'塑料篮子','纸箱','街头散落垃圾'"); List<EventDto> lists = eventMapper.selectByTimeAndName("'塑料篮子','纸箱','街头散落垃圾'");

View File

@ -14,7 +14,7 @@ import java.io.IOException;
@RestController @RestController
@RequestMapping("api/project") @RequestMapping("api/project")
@Api(tags="视频流") @Api(tags = "视频流")
public class FileController { public class FileController {
@Autowired @Autowired
@ -22,6 +22,7 @@ public class FileController {
/** /**
* 根据摄像头标识获取视频流 * 根据摄像头标识获取视频流
*
* @param channelCode * @param channelCode
* @return * @return
* @throws IOException * @throws IOException
@ -29,7 +30,7 @@ public class FileController {
@GetMapping("file") @GetMapping("file")
@ApiOperation("根据摄像头标识获取视频流") @ApiOperation("根据摄像头标识获取视频流")
@ApiImplicitParam(name = "channelCode", value = "摄像头标识", required = true, dataType = "String") @ApiImplicitParam(name = "channelCode", value = "摄像头标识", required = true, dataType = "String")
public Result File(String channelCode)throws IOException { public Result File(String channelCode) throws IOException {
String s = monitorService.fileCode(channelCode); String s = monitorService.fileCode(channelCode);
Result success = Result.success(s); Result success = Result.success(s);
return success; return success;

View File

@ -18,7 +18,7 @@ public class FordController {
@GetMapping("components/**") @GetMapping("components/**")
@ApiOperation("前端访问图片请求转发") @ApiOperation("前端访问图片请求转发")
public void ford(HttpServletRequest request, HttpServletResponse response){ public void ford(HttpServletRequest request, HttpServletResponse response) {
String imageDomain = "http://10.132.191.48:30080"; String imageDomain = "http://10.132.191.48:30080";
@ -48,7 +48,7 @@ public class FordController {
len = inputStream.read(buffer); len = inputStream.read(buffer);
} }
inputStream.close(); inputStream.close();
}catch(Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
} }

View File

@ -40,6 +40,7 @@ public class KeyAreaController {
/** /**
* 根据区域类型查询全部区域列表的最新时间的人数 * 根据区域类型查询全部区域列表的最新时间的人数
*
* @param type1 * @param type1
* @param type2 * @param type2
* @param type3 * @param type3
@ -47,10 +48,10 @@ public class KeyAreaController {
*/ */
@GetMapping("selectKeyAreaList") @GetMapping("selectKeyAreaList")
@ApiOperation("根据区域类型查询全部区域列表的最新时间的人数") @ApiOperation("根据区域类型查询全部区域列表的最新时间的人数")
public Result selectKeyAreaList(String type1,String type2,String type3){ public Result selectKeyAreaList(String type1, String type2, String type3) {
PassengerFlow maxId = passengerFlowMapper.getByMaxId(); PassengerFlow maxId = passengerFlowMapper.getByMaxId();
String timeId = maxId.getTimeId(); String timeId = maxId.getTimeId();
List<KeyAreaDto> keyAreaDtos = keyAreaMapper.selectKeyAreaList(type1,type2,type3,timeId); List<KeyAreaDto> keyAreaDtos = keyAreaMapper.selectKeyAreaList(type1, type2, type3, timeId);
keyAreaDtos.forEach(keyAreaDto -> { keyAreaDtos.forEach(keyAreaDto -> {
keyAreaDto.setTimeId(timeId); keyAreaDto.setTimeId(timeId);
}); });
@ -60,15 +61,16 @@ public class KeyAreaController {
/** /**
* 根据区域类型查询区域的最新时间的人数 * 根据区域类型查询区域的最新时间的人数
*
* @param type * @param type
* @return * @return
*/ */
@GetMapping("selectKeyArea") @GetMapping("selectKeyArea")
@ApiOperation("根据区域类型查询区域的最新时间的人数") @ApiOperation("根据区域类型查询区域的最新时间的人数")
public Result selectKeyArea(String type){ public Result selectKeyArea(String type) {
PassengerFlow maxId = passengerFlowMapper.getByMaxId(); PassengerFlow maxId = passengerFlowMapper.getByMaxId();
String timeId = maxId.getTimeId(); String timeId = maxId.getTimeId();
List<KeyAreaDto> keyAreaDtos = keyAreaMapper.selectKeyArea(type,timeId); List<KeyAreaDto> keyAreaDtos = keyAreaMapper.selectKeyArea(type, timeId);
keyAreaDtos.forEach(keyAreaDto -> { keyAreaDtos.forEach(keyAreaDto -> {
keyAreaDto.setTimeId(timeId); keyAreaDto.setTimeId(timeId);
}); });
@ -78,12 +80,13 @@ public class KeyAreaController {
/** /**
* 根据名称查询商圈范围 * 根据名称查询商圈范围
*
* @param areaName * @param areaName
* @return * @return
*/ */
@GetMapping("selectByAreaName") @GetMapping("selectByAreaName")
@ApiOperation("根据名称查询商圈范围") @ApiOperation("根据名称查询商圈范围")
public Result selectByAreaName(String areaName){ public Result selectByAreaName(String areaName) {
List<KeyAreaLocation> keyAreaLocations = keyAreaMapper.selectByAreaName(areaName); List<KeyAreaLocation> keyAreaLocations = keyAreaMapper.selectByAreaName(areaName);
Result success = Result.success(keyAreaLocations); Result success = Result.success(keyAreaLocations);
return success; return success;
@ -91,13 +94,14 @@ public class KeyAreaController {
/** /**
* 根据名称查询重点区域名称 * 根据名称查询重点区域名称
*
* @param areaName * @param areaName
* @return * @return
*/ */
@GetMapping("selectByLikeName") @GetMapping("selectByLikeName")
@ApiOperation("根据名称查询重点区域名称") @ApiOperation("根据名称查询重点区域名称")
@ApiImplicitParam(name = "areaName",value = "重点区域名称",required = true,dataType = "String") @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);
return success; return success;
@ -105,6 +109,7 @@ public class KeyAreaController {
/** /**
* 重点区域场景查询所有事件 * 重点区域场景查询所有事件
*
* @return * @return
*/ */
@GetMapping("selectByAreaEvent") @GetMapping("selectByAreaEvent")
@ -113,27 +118,27 @@ public class KeyAreaController {
@ApiImplicitParam(name = "page", value = "页码", required = true, dataType = "Integer"), @ApiImplicitParam(name = "page", value = "页码", required = true, dataType = "Integer"),
@ApiImplicitParam(name = "pageSize", value = "页码大小", required = true, dataType = "Integer") @ApiImplicitParam(name = "pageSize", value = "页码大小", required = true, dataType = "Integer")
}) })
public Result selectByAreaEvent(Integer page,Integer pageSize){ public Result selectByAreaEvent(Integer page, Integer pageSize) {
List<EventDto> events = keyAreaMapper.selectByAreaEvent(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("户外桌椅")) {
event.setEventNewName("占道经营"); event.setEventNewName("占道经营");
}else if (event.getEventCnName().equals("纸箱")|| event.getEventCnName().equals("街头散落垃圾") } else if (event.getEventCnName().equals("纸箱") || event.getEventCnName().equals("街头散落垃圾")
||event.getEventCnName().equals("塑料篮子")){ || event.getEventCnName().equals("塑料篮子")) {
event.setEventNewName("环境卫生"); event.setEventNewName("环境卫生");
}else if (event.getEventCnName().equals("沿街晾晒衣物被单")){ } else if (event.getEventCnName().equals("沿街晾晒衣物被单")) {
event.setEventNewName("沿街晾晒"); event.setEventNewName("沿街晾晒");
}else if (event.getEventCnName().equals("机动车违停")){ } else if (event.getEventCnName().equals("机动车违停")) {
event.setEventNewName("违章停车"); event.setEventNewName("违章停车");
}else { } else {
event.setEventNewName(event.getEventCnName()); event.setEventNewName(event.getEventCnName());
} }
}); });
Integer integer = keyAreaMapper.selectCountAreaEvent(); Integer integer = keyAreaMapper.selectCountAreaEvent();
Map<String,Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
map.put("sum",integer); map.put("sum", integer);
map.put("events",events); map.put("events", events);
Result success = Result.success(map); Result success = Result.success(map);
return success; return success;
@ -141,30 +146,31 @@ public class KeyAreaController {
/** /**
* 重点区域场景查询当天事件 * 重点区域场景查询当天事件
*
* @return * @return
*/ */
@GetMapping("selectByDayAreaEvent") @GetMapping("selectByDayAreaEvent")
@ApiOperation("重点区域场景查询当天事件") @ApiOperation("重点区域场景查询当天事件")
public Result selectByDayAreaEvent(){ public Result selectByDayAreaEvent() {
List<EventDto> events = keyAreaMapper.selectByDayAreaEvent(); List<EventDto> events = keyAreaMapper.selectByDayAreaEvent();
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("户外桌椅")) {
event.setEventNewName("占道经营"); event.setEventNewName("占道经营");
}else if (event.getEventCnName().equals("纸箱")|| event.getEventCnName().equals("街头散落垃圾") } else if (event.getEventCnName().equals("纸箱") || event.getEventCnName().equals("街头散落垃圾")
||event.getEventCnName().equals("塑料篮子")){ || event.getEventCnName().equals("塑料篮子")) {
event.setEventNewName("环境卫生"); event.setEventNewName("环境卫生");
}else if (event.getEventCnName().equals("沿街晾晒衣物被单")){ } else if (event.getEventCnName().equals("沿街晾晒衣物被单")) {
event.setEventNewName("沿街晾晒"); event.setEventNewName("沿街晾晒");
}else if (event.getEventCnName().equals("机动车违停")){ } else if (event.getEventCnName().equals("机动车违停")) {
event.setEventNewName("违章停车"); event.setEventNewName("违章停车");
}else { } else {
event.setEventNewName(event.getEventCnName()); event.setEventNewName(event.getEventCnName());
} }
}); });
Map<String,Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
map.put("sum",events.size()); map.put("sum", events.size());
map.put("events",events); map.put("events", events);
Result success = Result.success(map); Result success = Result.success(map);
return success; return success;
@ -172,50 +178,51 @@ public class KeyAreaController {
/** /**
* 重点区域场景根据事件名称查询事件 * 重点区域场景根据事件名称查询事件
*
* @param eventNewName * @param eventNewName
* @return * @return
*/ */
@GetMapping("selectByNameAreaEvent") @GetMapping("selectByNameAreaEvent")
@ApiOperation("重点区域场景根据事件名称查询事件") @ApiOperation("重点区域场景根据事件名称查询事件")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "eventNewName",value = "事件名称",required = true,dataType = "String"), @ApiImplicitParam(name = "eventNewName", value = "事件名称", required = true, dataType = "String"),
@ApiImplicitParam(name = "page", value = "页码", required = false, dataType = "Integer"), @ApiImplicitParam(name = "page", value = "页码", required = false, dataType = "Integer"),
@ApiImplicitParam(name = "pageSize", value = "页码大小", required = false, dataType = "Integer") @ApiImplicitParam(name = "pageSize", value = "页码大小", required = false, dataType = "Integer")
}) })
public Result selectByNameAreaEvent(String eventNewName,Integer page,Integer pageSize){ public Result selectByNameAreaEvent(String eventNewName, Integer page, Integer pageSize) {
if (eventNewName.equals("环境卫生")){ if (eventNewName.equals("环境卫生")) {
List<EventDto> lists = keyAreaMapper.selectByNameAreaEvent("'塑料篮子','纸箱','街头散落垃圾'",page,pageSize); List<EventDto> lists = keyAreaMapper.selectByNameAreaEvent("'塑料篮子','纸箱','街头散落垃圾'", page, pageSize);
lists.forEach(list ->{ lists.forEach(list -> {
list.setEventNewName("环境卫生"); list.setEventNewName("环境卫生");
}); });
Integer integer = keyAreaMapper.selectCountByNameAreaEvent("'塑料篮子','纸箱','街头散落垃圾'"); Integer integer = keyAreaMapper.selectCountByNameAreaEvent("'塑料篮子','纸箱','街头散落垃圾'");
Map<String,Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
map.put("sum",integer); map.put("sum", integer);
map.put("events",lists); map.put("events", lists);
Result success = Result.success(map); Result success = Result.success(map);
return success; return success;
}else if (eventNewName.equals("占道经营")){ } else if (eventNewName.equals("占道经营")) {
List<EventDto> lists = keyAreaMapper.selectByNameAreaEvent("'街头伞篷','水果和食品摊','地摊','户外桌椅'",page,pageSize); List<EventDto> lists = keyAreaMapper.selectByNameAreaEvent("'街头伞篷','水果和食品摊','地摊','户外桌椅'", page, pageSize);
lists.forEach(list ->{ lists.forEach(list -> {
list.setEventNewName("占道经营"); list.setEventNewName("占道经营");
}); });
Integer integer = keyAreaMapper.selectCountByNameAreaEvent("'街头伞篷','水果和食品摊','地摊','户外桌椅'"); Integer integer = keyAreaMapper.selectCountByNameAreaEvent("'街头伞篷','水果和食品摊','地摊','户外桌椅'");
Map<String,Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
map.put("sum",integer); map.put("sum", integer);
map.put("events",lists); map.put("events", lists);
Result success = Result.success(map); Result success = Result.success(map);
return success; return success;
}else { } else {
StringBuilder str = new StringBuilder(eventNewName); StringBuilder str = new StringBuilder(eventNewName);
String s = str.insert(0, "'").append("'").toString(); String s = str.insert(0, "'").append("'").toString();
List<EventDto> lists = keyAreaMapper.selectByNameAreaEvent(s, page, pageSize); List<EventDto> lists = keyAreaMapper.selectByNameAreaEvent(s, page, pageSize);
lists.forEach(list ->{ lists.forEach(list -> {
list.setEventNewName(list.getEventCnName()); list.setEventNewName(list.getEventCnName());
}); });
Integer integer = keyAreaMapper.selectCountByNameAreaEvent(s); Integer integer = keyAreaMapper.selectCountByNameAreaEvent(s);
Map<String,Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
map.put("sum",integer); map.put("sum", integer);
map.put("events",lists); map.put("events", lists);
Result success = Result.success(map); Result success = Result.success(map);
return success; return success;
} }
@ -223,14 +230,15 @@ public class KeyAreaController {
/** /**
* 查询近30天重点区域视频感知事件时间趋势 * 查询近30天重点区域视频感知事件时间趋势
*
* @return * @return
*/ */
@GetMapping("selectMonthAreaEvent") @GetMapping("selectMonthAreaEvent")
@ApiOperation("查询近30天重点区域视频感知事件时间趋势") @ApiOperation("查询近30天重点区域视频感知事件时间趋势")
public Result selectMonthAreaEvent(){ public Result selectMonthAreaEvent() {
List<KeyAreaDtos> keyAreaDtos = keyAreaMapper.selectMonthAreaEvent(); List<KeyAreaDtos> keyAreaDtos = keyAreaMapper.selectMonthAreaEvent();
keyAreaDtos.forEach(keyAreaDtos1 -> { keyAreaDtos.forEach(keyAreaDtos1 -> {
if (keyAreaDtos1.getNumber() == null){ if (keyAreaDtos1.getNumber() == null) {
keyAreaDtos1.setNumber(0); keyAreaDtos1.setNumber(0);
} }
}); });
@ -240,24 +248,25 @@ public class KeyAreaController {
/** /**
* 统计事件类型 * 统计事件类型
*
* @return * @return
*/ */
@GetMapping("selectEventType") @GetMapping("selectEventType")
@ApiOperation("统计事件类型") @ApiOperation("统计事件类型")
public Result selectEventType(){ public Result selectEventType() {
List<KeyAreaDtos> keyAreaDtos = keyAreaMapper.selectEventType(); List<KeyAreaDtos> keyAreaDtos = keyAreaMapper.selectEventType();
keyAreaDtos.forEach(keyAreaDtos1 -> { keyAreaDtos.forEach(keyAreaDtos1 -> {
if (keyAreaDtos1.getEventCnName().equals("街头伞篷") || keyAreaDtos1.getEventCnName().equals("水果和食品摊") if (keyAreaDtos1.getEventCnName().equals("街头伞篷") || keyAreaDtos1.getEventCnName().equals("水果和食品摊")
|| keyAreaDtos1.getEventCnName().equals("地摊")|| keyAreaDtos1.getEventCnName().equals("户外桌椅")){ || keyAreaDtos1.getEventCnName().equals("地摊") || keyAreaDtos1.getEventCnName().equals("户外桌椅")) {
keyAreaDtos1.setEventNewName("占道经营"); keyAreaDtos1.setEventNewName("占道经营");
}else if (keyAreaDtos1.getEventCnName().equals("纸箱")|| keyAreaDtos1.getEventCnName().equals("街头散落垃圾") } else if (keyAreaDtos1.getEventCnName().equals("纸箱") || keyAreaDtos1.getEventCnName().equals("街头散落垃圾")
||keyAreaDtos1.getEventCnName().equals("塑料篮子")){ || keyAreaDtos1.getEventCnName().equals("塑料篮子")) {
keyAreaDtos1.setEventNewName("环境卫生"); keyAreaDtos1.setEventNewName("环境卫生");
}else if (keyAreaDtos1.getEventCnName().equals("沿街晾晒衣物被单")){ } else if (keyAreaDtos1.getEventCnName().equals("沿街晾晒衣物被单")) {
keyAreaDtos1.setEventNewName("沿街晾晒"); keyAreaDtos1.setEventNewName("沿街晾晒");
}else if (keyAreaDtos1.getEventCnName().equals("机动车违停")){ } else if (keyAreaDtos1.getEventCnName().equals("机动车违停")) {
keyAreaDtos1.setEventNewName("违章停车"); keyAreaDtos1.setEventNewName("违章停车");
}else { } else {
keyAreaDtos1.setEventNewName(keyAreaDtos1.getEventCnName()); keyAreaDtos1.setEventNewName(keyAreaDtos1.getEventCnName());
} }
}); });
@ -267,14 +276,15 @@ public class KeyAreaController {
/** /**
* 查询近7天重点区域本地外地人流峰值按每一天输出 * 查询近7天重点区域本地外地人流峰值按每一天输出
*
* @return * @return
*/ */
@GetMapping("selectLocalWeekArea") @GetMapping("selectLocalWeekArea")
@ApiOperation("查询近7天重点区域本地外地人流峰值按每一天输出") @ApiOperation("查询近7天重点区域本地外地人流峰值按每一天输出")
public Result selectLocalWeekArea(String areaName){ public Result selectLocalWeekArea(String areaName) {
List<KeyAreaDtos> keyAreaDtos = keyAreaMapper.selectLocalWeekArea(areaName); List<KeyAreaDtos> keyAreaDtos = keyAreaMapper.selectLocalWeekArea(areaName);
keyAreaDtos.forEach(keyAreaDtos1 -> { keyAreaDtos.forEach(keyAreaDtos1 -> {
if (keyAreaDtos1.getLocalNums() == null && keyAreaDtos1.getNonlocalNums() == null){ if (keyAreaDtos1.getLocalNums() == null && keyAreaDtos1.getNonlocalNums() == null) {
keyAreaDtos1.setLocalNums(0); keyAreaDtos1.setLocalNums(0);
keyAreaDtos1.setNonlocalNums(0); keyAreaDtos1.setNonlocalNums(0);
} }
@ -285,14 +295,15 @@ public class KeyAreaController {
/** /**
* 查询近30天重点区域本地外地人流峰值按每一天输出 * 查询近30天重点区域本地外地人流峰值按每一天输出
*
* @return * @return
*/ */
@GetMapping("selectLocalMonthArea") @GetMapping("selectLocalMonthArea")
@ApiOperation("查询近30天重点区域本地外地人流峰值按每一天输出") @ApiOperation("查询近30天重点区域本地外地人流峰值按每一天输出")
public Result selectLocalMonthArea(String areaName){ public Result selectLocalMonthArea(String areaName) {
List<KeyAreaDtos> keyAreaDtos = keyAreaMapper.selectLocalMonthArea(areaName); List<KeyAreaDtos> keyAreaDtos = keyAreaMapper.selectLocalMonthArea(areaName);
keyAreaDtos.forEach(keyAreaDtos1 -> { keyAreaDtos.forEach(keyAreaDtos1 -> {
if (keyAreaDtos1.getLocalNums() == null && keyAreaDtos1.getNonlocalNums() == null){ if (keyAreaDtos1.getLocalNums() == null && keyAreaDtos1.getNonlocalNums() == null) {
keyAreaDtos1.setLocalNums(0); keyAreaDtos1.setLocalNums(0);
keyAreaDtos1.setNonlocalNums(0); keyAreaDtos1.setNonlocalNums(0);
} }
@ -303,11 +314,12 @@ public class KeyAreaController {
/** /**
* 查询重点区域抓图照片 * 查询重点区域抓图照片
*
* @return * @return
*/ */
@GetMapping("selectByAreaImage") @GetMapping("selectByAreaImage")
@ApiOperation("查询重点区域抓图照片") @ApiOperation("查询重点区域抓图照片")
public Result selectByAreaImage(String areaName){ public Result selectByAreaImage(String areaName) {
List<KeyAreaDto> keyAreaDtos = keyAreaMapper.selectByAreaImage(areaName); List<KeyAreaDto> keyAreaDtos = keyAreaMapper.selectByAreaImage(areaName);
Result success = Result.success(keyAreaDtos); Result success = Result.success(keyAreaDtos);
return success; return success;

View File

@ -23,11 +23,12 @@ public class PassengerTestController {
/** /**
* 查询全部人流测试点 * 查询全部人流测试点
*
* @return * @return
*/ */
@GetMapping("selectPassengerTest") @GetMapping("selectPassengerTest")
@ApiOperation("查询全部人流测试点") @ApiOperation("查询全部人流测试点")
public Result selectPassengerTest(){ public Result selectPassengerTest() {
QueryWrapper<PassengerTest> queryWrapper = new QueryWrapper<>(); QueryWrapper<PassengerTest> queryWrapper = new QueryWrapper<>();
List<PassengerTest> passengerTests = passengerTestMapper.selectList(queryWrapper); List<PassengerTest> passengerTests = passengerTestMapper.selectList(queryWrapper);
Result success = Result.success(passengerTests); Result success = Result.success(passengerTests);

View File

@ -26,13 +26,14 @@ public class PeopleRecognizeController {
/** /**
* 查询全部安保区域人流 * 查询全部安保区域人流
*
* @return * @return
*/ */
@GetMapping("selectPeopleRecognize") @GetMapping("selectPeopleRecognize")
@ApiOperation("查询全部安保区域人流") @ApiOperation("查询全部安保区域人流")
public Result selectPeopleRecognize(){ public Result selectPeopleRecognize() {
List<PeopleRecognizeDto> lists = peopleRecognizeMapper.selectPeopleRecognize(); List<PeopleRecognizeDto> lists = peopleRecognizeMapper.selectPeopleRecognize();
for (PeopleRecognizeDto list :lists) { for (PeopleRecognizeDto list : lists) {
String nodeName = list.getNodeName(); String nodeName = list.getNodeName();
list.setNewNodeName(nodeName); list.setNewNodeName(nodeName);
String[] splits = nodeName.split("->"); String[] splits = nodeName.split("->");
@ -44,7 +45,7 @@ public class PeopleRecognizeController {
} }
@GetMapping("recover") @GetMapping("recover")
public Object recover(){ public Object recover() {
monitorService.peopleRecognize(); monitorService.peopleRecognize();
return "finish recover"; return "finish recover";
} }

View File

@ -62,7 +62,7 @@ public class QidiController {
//道路统计数据与排名 //道路统计数据与排名
@GetMapping("roadData") @GetMapping("roadData")
@ApiOperation("道路统计数据与排名根据后台dt调用接口") @ApiOperation("道路统计数据与排名根据后台dt调用接口")
public List<Map> roadData(){ public List<Map> roadData() {
return roadDataService.roadData(); return roadDataService.roadData();
} }
@ -70,60 +70,61 @@ public class QidiController {
//登录 //登录
@GetMapping("qidiToken") @GetMapping("qidiToken")
@ApiOperation("启迪数据中台登录获取token") @ApiOperation("启迪数据中台登录获取token")
public String qidiToken(){ public String qidiToken() {
return qidiService.qidiToken(); return qidiService.qidiToken();
} }
//渣土车轨迹数据 //渣土车轨迹数据
@GetMapping("resCatalogApplyZTYS") @GetMapping("resCatalogApplyZTYS")
@ApiOperation("获取渣土车轨迹数据,根据后台UPLOADTIME调用接口") @ApiOperation("获取渣土车轨迹数据,根据后台UPLOADTIME调用接口")
public List<Map> resCatalogApply(){ public List<Map> resCatalogApply() {
return qidiService.resCatalogApplyZTYS(); return qidiService.resCatalogApplyZTYS();
} }
//环卫车轨迹数据 //环卫车轨迹数据
@GetMapping("resCatalogApplyHJWS") @GetMapping("resCatalogApplyHJWS")
@ApiOperation("环卫车轨迹数据根据后台updatetime调用接口") @ApiOperation("环卫车轨迹数据根据后台updatetime调用接口")
public List<Map> resCatalogApplyHJWS(){ public List<Map> resCatalogApplyHJWS() {
return qidiService.resCatalogApplyHJWS(); return qidiService.resCatalogApplyHJWS();
} }
//工地信息 //工地信息
@GetMapping("resCatalogApplyGDYS") @GetMapping("resCatalogApplyGDYS")
@ApiOperation("获取工地信息-表中获取") @ApiOperation("获取工地信息-表中获取")
public List<Map> resCatalogApplyGDYS(){ public List<Map> resCatalogApplyGDYS() {
return qidiService.resCatalogApplyGDYS(); return qidiService.resCatalogApplyGDYS();
} }
//环卫车辆数据1基础 //环卫车辆数据1基础
@GetMapping("resCatalogApplyHJWSBase") @GetMapping("resCatalogApplyHJWSBase")
@ApiOperation("环卫车辆数据1,基础--根据后台updatetime调用接口") @ApiOperation("环卫车辆数据1,基础--根据后台updatetime调用接口")
public List<Map> resCatalogApplyHJWSBase(){ public List<Map> resCatalogApplyHJWSBase() {
return qidiService.resCatalogApplyHJWSBase(); return qidiService.resCatalogApplyHJWSBase();
} }
//环卫车辆数据1作业 //环卫车辆数据1作业
@GetMapping("resCatalogApplyHJWSZY") @GetMapping("resCatalogApplyHJWSZY")
@ApiOperation("环卫车辆数据1作业--根据后台ZYRQ调用接口") @ApiOperation("环卫车辆数据1作业--根据后台ZYRQ调用接口")
public List<Map> resCatalogApplyHJWSZY(){ public List<Map> resCatalogApplyHJWSZY() {
return qidiService.resCatalogApplyHJWSZY(); return qidiService.resCatalogApplyHJWSZY();
} }
//环卫道路明细数据 //环卫道路明细数据
@GetMapping("resCatalogApplyHJWSRoad") @GetMapping("resCatalogApplyHJWSRoad")
@ApiOperation("环卫道路明细数据,根据后台updatetime调用接口") @ApiOperation("环卫道路明细数据,根据后台updatetime调用接口")
public List<Map> resCatalogApplyHJWSRoad(){ public List<Map> resCatalogApplyHJWSRoad() {
return qidiService.resCatalogApplyHJWSRoad(); return qidiService.resCatalogApplyHJWSRoad();
} }
//获取渣土车轨迹并保存到t_trail_sediment //获取渣土车轨迹并保存到t_trail_sediment
@GetMapping(value = "saveResCatalogApplyZTYS") @GetMapping(value = "saveResCatalogApplyZTYS")
@ApiOperation("取渣土车轨迹并保存到t_trail_sediment根据后台UPLOADTIME调用接口") @ApiOperation("取渣土车轨迹并保存到t_trail_sediment根据后台UPLOADTIME调用接口")
public Result resCatalogApplyZTYS(){ public Result resCatalogApplyZTYS() {
boolean result = sedimentTrailService.batchSaveSedimentTrail(); boolean result = sedimentTrailService.batchSaveSedimentTrail();
if(result){ if (result) {
return Result.success(); return Result.success();
}else{ } else {
return Result.error(String.valueOf(result)); return Result.error(String.valueOf(result));
} }
} }
@ -132,29 +133,28 @@ public class QidiController {
@GetMapping(value = "listSedimentTrailByPoints") @GetMapping(value = "listSedimentTrailByPoints")
@ApiOperation("渣土车轨迹信息,根据经纬度和半径从表中查询") @ApiOperation("渣土车轨迹信息,根据经纬度和半径从表中查询")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "longitude", value = "经度", paramType = "query",required = true,dataType ="double"), @ApiImplicitParam(name = "longitude", value = "经度", paramType = "query", required = true, dataType = "double"),
@ApiImplicitParam(name = "latitude", value = "纬度", paramType = "query",required = true,dataType ="double"), @ApiImplicitParam(name = "latitude", value = "纬度", paramType = "query", required = true, dataType = "double"),
@ApiImplicitParam(name = "radius", value = "半径,米", paramType = "query",required = true,dataType ="Integer"), @ApiImplicitParam(name = "radius", value = "半径,米", paramType = "query", required = true, dataType = "Integer"),
@ApiImplicitParam(name = "start", value = "开始时间2021-08-03 10:17:23", paramType = "query",required = true,dataType ="string"), @ApiImplicitParam(name = "start", value = "开始时间2021-08-03 10:17:23", paramType = "query", required = true, dataType = "string"),
@ApiImplicitParam(name = "end", value = "结束时间2021-08-03 12:17:23", paramType = "query",required = true,dataType ="string") @ApiImplicitParam(name = "end", value = "结束时间2021-08-03 12:17:23", paramType = "query", required = true, dataType = "string")
}) })
public Result listSedimentTrailByPoints( public Result listSedimentTrailByPoints(
@RequestParam(value="longitude") double longitude, @RequestParam(value = "longitude") double longitude,
@RequestParam(value="latitude") double latitude, @RequestParam(value = "latitude") double latitude,
@RequestParam(value="radius") Integer radius, @RequestParam(value = "radius") Integer radius,
@RequestParam(value="start") String start, @RequestParam(value = "start") String start,
@RequestParam(value = "end") String end @RequestParam(value = "end") String end
){ ) {
List<SedimentTrail> map = sedimentTrailService.listSedimentTrailByPoints(longitude,latitude,radius,start,end); List<SedimentTrail> map = sedimentTrailService.listSedimentTrailByPoints(longitude, latitude, radius, start, end);
return Result.success(map); return Result.success(map);
} }
//测试获取最新的客流列表从接口获取 //测试获取最新的客流列表从接口获取
@GetMapping("passengerFlow") @GetMapping("passengerFlow")
@ApiOperation("获取最新的客流列表,测试接口,调用接口获取") @ApiOperation("获取最新的客流列表,测试接口,调用接口获取")
public List<Map> passengerFlow(){ public List<Map> passengerFlow() {
List<Map> list = passengerFlowService.passengerFlow(); List<Map> list = passengerFlowService.passengerFlow();
return list; return list;
} }
@ -162,15 +162,16 @@ public class QidiController {
//获取最新的实时客流列表从表获取 //获取最新的实时客流列表从表获取
@GetMapping("listPassengerFlow") @GetMapping("listPassengerFlow")
@ApiOperation("获取最新的实时客流列表,从表获取,热力图") @ApiOperation("获取最新的实时客流列表,从表获取,热力图")
@ApiImplicitParam(name="timeId",value = "时间点",required = false,paramType = "query",dataType = "string") @ApiImplicitParam(name = "timeId", value = "时间点", required = false, paramType = "query", dataType = "string")
public List<PassengerFlow> listPassengerFlow(@RequestParam(value="timeId",required = false,defaultValue = "1970000000") String timeId){ public List<PassengerFlow> listPassengerFlow(@RequestParam(value = "timeId", required = false, defaultValue = "1970000000") String timeId) {
List<PassengerFlow> list = passengerFlowService.listPassengerFlow(timeId); List<PassengerFlow> list = passengerFlowService.listPassengerFlow(timeId);
return list; return list;
} }
//从表中获取最新的客流列表并筛选出all_nums >=5000的 //从表中获取最新的客流列表并筛选出all_nums >=5000的
@GetMapping("listPassengerFlowByAllNums") @GetMapping("listPassengerFlowByAllNums")
@ApiOperation("从表中获取最新的客流列表并筛选出all_nums >=5000的") @ApiOperation("从表中获取最新的客流列表并筛选出all_nums >=5000的")
public List<PassengerFlow> listPassengerFlowByAllNums(){ public List<PassengerFlow> listPassengerFlowByAllNums() {
List<PassengerFlow> list = passengerFlowService.listPassengerFlowByAllNums(); List<PassengerFlow> list = passengerFlowService.listPassengerFlowByAllNums();
return list; return list;
} }
@ -178,12 +179,12 @@ public class QidiController {
//获取实时客流并保存到表t_passenger_flow //获取实时客流并保存到表t_passenger_flow
@GetMapping("savePassengerFlow") @GetMapping("savePassengerFlow")
@ApiOperation("获取实时客流并保存到表t_passenger_flow,调用接口") @ApiOperation("获取实时客流并保存到表t_passenger_flow,调用接口")
public Result savePassengerFlow(){ public Result savePassengerFlow() {
List<Map> list = passengerFlowService.passengerFlow(); List<Map> list = passengerFlowService.passengerFlow();
boolean result = passengerFlowService.savePassengerFlow(list); boolean result = passengerFlowService.savePassengerFlow(list);
if(result){ if (result) {
return Result.success(); return Result.success();
}else{ } else {
return Result.error(String.valueOf(result)); return Result.error(String.valueOf(result));
} }
} }
@ -192,22 +193,23 @@ public class QidiController {
@GetMapping("getPassengerNum") @GetMapping("getPassengerNum")
@ApiOperation("查询游客总数根据经纬度和半径米、timeId从表中查询") @ApiOperation("查询游客总数根据经纬度和半径米、timeId从表中查询")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "longitude", value = "经度", paramType = "query",required = false,dataType ="double"), @ApiImplicitParam(name = "longitude", value = "经度", paramType = "query", required = false, dataType = "double"),
@ApiImplicitParam(name = "latitude", value = "纬度", paramType = "query",required = false,dataType ="double"), @ApiImplicitParam(name = "latitude", value = "纬度", paramType = "query", required = false, dataType = "double"),
@ApiImplicitParam(name = "radius", value = "半径,米", paramType = "query",required = false,dataType ="Integer"), @ApiImplicitParam(name = "radius", value = "半径,米", paramType = "query", required = false, dataType = "Integer"),
@ApiImplicitParam(name = "timeId", value = "时间点202205101600", paramType = "query",required = true,dataType ="string"), @ApiImplicitParam(name = "timeId", value = "时间点202205101600", paramType = "query", required = true, dataType = "string"),
}) })
public Result getPassengerNum( public Result getPassengerNum(
@RequestParam(value="longitude",required = false,defaultValue = "0.00") double longitude, @RequestParam(value = "longitude", required = false, defaultValue = "0.00") double longitude,
@RequestParam(value="latitude",required = false,defaultValue = "0.00") double latitude, @RequestParam(value = "latitude", required = false, defaultValue = "0.00") double latitude,
@RequestParam(value="radius",required = false,defaultValue = "0") Integer radius, @RequestParam(value = "radius", required = false, defaultValue = "0") Integer radius,
@RequestParam(value="timeId",required = true) String timeId @RequestParam(value = "timeId", required = true) String timeId
){ ) {
return Result.success(passengerFlowService.passengerNums(longitude,latitude,radius,timeId)); return Result.success(passengerFlowService.passengerNums(longitude, latitude, radius, timeId));
} }
/** /**
* 查询半径范围内格栅 * 查询半径范围内格栅
*
* @param longitude * @param longitude
* @param latitude * @param latitude
* @param radius * @param radius
@ -217,14 +219,14 @@ public class QidiController {
@GetMapping("selectPassenger") @GetMapping("selectPassenger")
@ApiOperation("查询半径范围内格栅根据经纬度和半径米、timeId从表中查询") @ApiOperation("查询半径范围内格栅根据经纬度和半径米、timeId从表中查询")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "longitude", value = "经度", paramType = "query",required = false,dataType ="double"), @ApiImplicitParam(name = "longitude", value = "经度", paramType = "query", required = false, dataType = "double"),
@ApiImplicitParam(name = "latitude", value = "纬度", paramType = "query",required = false,dataType ="double"), @ApiImplicitParam(name = "latitude", value = "纬度", paramType = "query", required = false, dataType = "double"),
@ApiImplicitParam(name = "radius", value = "半径,米", paramType = "query",required = false,dataType ="Integer"), @ApiImplicitParam(name = "radius", value = "半径,米", paramType = "query", required = false, dataType = "Integer"),
@ApiImplicitParam(name = "timeId", value = "时间点202205101600", paramType = "query",required = true,dataType ="string"), @ApiImplicitParam(name = "timeId", value = "时间点202205101600", paramType = "query", required = true, dataType = "string"),
}) })
public Result selectPassenger(Double longitude,Double latitude,Integer radius,String timeId){ public Result selectPassenger(Double longitude, Double latitude, Integer radius, String timeId) {
double[] around = LongLatUtil.getAround(longitude, latitude, radius); double[] around = LongLatUtil.getAround(longitude, latitude, radius);
List<PassengerFlowDto> c = passengerFlowlMapper.selectPassenger(around[0], around[2], around[1], around[3],timeId); List<PassengerFlowDto> c = passengerFlowlMapper.selectPassenger(around[0], around[2], around[1], around[3], timeId);
Result success = Result.success(c); Result success = Result.success(c);
return success; return success;
} }
@ -232,11 +234,11 @@ public class QidiController {
//查询并保存环卫车轨迹到表t_trail_sanitation //查询并保存环卫车轨迹到表t_trail_sanitation
@GetMapping("saveTrailSanitation") @GetMapping("saveTrailSanitation")
@ApiOperation("保存环卫车轨迹到表t_trail_sanitation,根据后台updatetime调用接口") @ApiOperation("保存环卫车轨迹到表t_trail_sanitation,根据后台updatetime调用接口")
public Result saveTrailSanitation(){ public Result saveTrailSanitation() {
boolean result = trailSanitationService.saveTrailSanitation(); boolean result = trailSanitationService.saveTrailSanitation();
if(result){ if (result) {
return Result.success(); return Result.success();
}else{ } else {
return Result.error(String.valueOf(result)); return Result.error(String.valueOf(result));
} }
} }
@ -245,30 +247,31 @@ public class QidiController {
@GetMapping(value = "listTrailSanitationByPoints") @GetMapping(value = "listTrailSanitationByPoints")
@ApiOperation("查询范围内环卫车轨迹信息,根据经纬度、半径米,时间从表中查询") @ApiOperation("查询范围内环卫车轨迹信息,根据经纬度、半径米,时间从表中查询")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "longitude", value = "经度", paramType = "query",required = true,dataType ="double"), @ApiImplicitParam(name = "longitude", value = "经度", paramType = "query", required = true, dataType = "double"),
@ApiImplicitParam(name = "latitude", value = "纬度", paramType = "query",required = true,dataType ="double"), @ApiImplicitParam(name = "latitude", value = "纬度", paramType = "query", required = true, dataType = "double"),
@ApiImplicitParam(name = "radius", value = "半径,米", paramType = "query",required = true,dataType ="Integer"), @ApiImplicitParam(name = "radius", value = "半径,米", paramType = "query", required = true, dataType = "Integer"),
@ApiImplicitParam(name = "start", value = "开始时间2021-03-17 00:00:00", paramType = "query",required = true,dataType ="string"), @ApiImplicitParam(name = "start", value = "开始时间2021-03-17 00:00:00", paramType = "query", required = true, dataType = "string"),
@ApiImplicitParam(name = "end", value = "结束时间2021-03-22 00:00:00", paramType = "query",required = true,dataType ="string"), @ApiImplicitParam(name = "end", value = "结束时间2021-03-22 00:00:00", paramType = "query", required = true, dataType = "string"),
}) })
public Result listTrailSanitationByPoints( public Result listTrailSanitationByPoints(
@RequestParam(value="longitude") double longitude, @RequestParam(value = "longitude") double longitude,
@RequestParam(value="latitude") double latitude, @RequestParam(value = "latitude") double latitude,
@RequestParam(value="radius") Integer radius, @RequestParam(value = "radius") Integer radius,
@RequestParam(value="start") String start, @RequestParam(value = "start") String start,
@RequestParam(value = "end") String end @RequestParam(value = "end") String end
){ ) {
List<TrailSanitation> list = trailSanitationService.listSedimentTrailByPoints(longitude,latitude,radius,start,end); List<TrailSanitation> list = trailSanitationService.listSedimentTrailByPoints(longitude, latitude, radius, start, end);
return Result.success(list); return Result.success(list);
} }
/** /**
* 查询全部环卫车轨迹信息 * 查询全部环卫车轨迹信息
*
* @return * @return
*/ */
@GetMapping("selectAllTrailSanitation") @GetMapping("selectAllTrailSanitation")
@ApiOperation("查询全部环卫车轨迹信息") @ApiOperation("查询全部环卫车轨迹信息")
public Result selectAllTrailSanitation(){ public Result selectAllTrailSanitation() {
List<TrailSanitation> trailSanitations = trailSanitationMapper.selectAllTrailSanitation(); List<TrailSanitation> trailSanitations = trailSanitationMapper.selectAllTrailSanitation();
Result success = Result.success(trailSanitations); Result success = Result.success(trailSanitations);
return success; return success;
@ -276,11 +279,12 @@ public class QidiController {
/** /**
* 查询全部渣土车轨迹信息 * 查询全部渣土车轨迹信息
*
* @return * @return
*/ */
@GetMapping("selectAllSedimentTrail") @GetMapping("selectAllSedimentTrail")
@ApiOperation("查询全部渣土车轨迹信息") @ApiOperation("查询全部渣土车轨迹信息")
public Result selectAllSedimentTrail(){ public Result selectAllSedimentTrail() {
List<SedimentTrail> trailSanitations = sedimentTrailMapper.selectAllSedimentTrail(); List<SedimentTrail> trailSanitations = sedimentTrailMapper.selectAllSedimentTrail();
Result success = Result.success(trailSanitations); Result success = Result.success(trailSanitations);
return success; return success;
@ -288,47 +292,49 @@ public class QidiController {
//查询道路污染数据 //查询道路污染数据
//查询道路污染数据,根据dt从表中最新时间的数据 //查询道路污染数据,根据dt从表中最新时间的数据
@GetMapping(value="listRoadData") @GetMapping(value = "listRoadData")
@ApiOperation("查询道路污染数据,根据dt从表中最新时间的数据") @ApiOperation("查询道路污染数据,根据dt从表中最新时间的数据")
public Result listRoadData(){ public Result listRoadData() {
RoadData byMaxId = roadDataMapper.getByMaxId(); RoadData byMaxId = roadDataMapper.getByMaxId();
String dt = byMaxId.getDt(); String dt = byMaxId.getDt();
List<RoadData> roadData = roadDataService.listRoadData(dt); List<RoadData> roadData = roadDataService.listRoadData(dt);
roadData.forEach(roadData1 -> { roadData.forEach(roadData1 -> {
roadData1.setDt(roadData1.getDt().substring(0,10)); roadData1.setDt(roadData1.getDt().substring(0, 10));
}); });
return Result.success(roadData); return Result.success(roadData);
} }
//根据输入的日期间隔查询道路污染数据(例如2022-05-10 00:00:00至2022-05-11 00:00:00 //根据输入的日期间隔查询道路污染数据(例如2022-05-10 00:00:00至2022-05-11 00:00:00
@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 = "begin", value = "开始日期", paramType = "query", dataType = "string", required = true), @ApiImplicitParam(name = "begin", value = "开始日期", paramType = "query", dataType = "string", required = true),
@ApiImplicitParam(name = "over", value = "结束日期", paramType = "query", dataType = "string", required = true) @ApiImplicitParam(name = "over", value = "结束日期", paramType = "query", dataType = "string", required = true)
}) })
public Result listRoadDataByTimeRegion(String begin, String over){ public Result listRoadDataByTimeRegion(String begin, String over) {
List<RoadDataDtos> roadDataDtos = roadDataMapper.listRoadDataByTimeRegion(begin, over); List<RoadDataDtos> roadDataDtos = roadDataMapper.listRoadDataByTimeRegion(begin, over);
roadDataDtos.forEach(roadData1 -> { roadDataDtos.forEach(roadData1 -> {
roadData1.setDt(roadData1.getDt().substring(0,10)); roadData1.setDt(roadData1.getDt().substring(0, 10));
}); });
return Result.success(roadDataDtos); return Result.success(roadDataDtos);
} }
/** /**
* 查询全部道路污染累计事件数量 * 查询全部道路污染累计事件数量
*
* @return * @return
*/ */
@GetMapping("selectRoadData") @GetMapping("selectRoadData")
@ApiOperation("查询全部道路污染累计事件数量") @ApiOperation("查询全部道路污染累计事件数量")
public Result selectRoadData(Integer page,Integer pageSize){ public Result selectRoadData(Integer page, Integer pageSize) {
List<RoadData> roadData = roadDataMapper.selectRoadData(page,pageSize); List<RoadData> roadData = roadDataMapper.selectRoadData(page, pageSize);
roadData.forEach(roadData1 -> { roadData.forEach(roadData1 -> {
roadData1.setDt(roadData1.getDt().substring(0,10)); roadData1.setDt(roadData1.getDt().substring(0, 10));
}); });
Integer integer = roadDataMapper.selectCountRoadData(); Integer integer = roadDataMapper.selectCountRoadData();
Map<String,Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
map.put("sum",integer); map.put("sum", integer);
map.put("roadData",roadData); map.put("roadData", roadData);
Result success = Result.success(map); Result success = Result.success(map);
return success; return success;
} }
@ -338,23 +344,24 @@ public class QidiController {
@GetMapping(value = "listBuildingSiteByPoints") @GetMapping(value = "listBuildingSiteByPoints")
@ApiOperation("查询工地信息,根据经纬度和半径从表中查询") @ApiOperation("查询工地信息,根据经纬度和半径从表中查询")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name="longitude",value = "经度",paramType = "query",required = true,dataType = "double"), @ApiImplicitParam(name = "longitude", value = "经度", paramType = "query", required = true, dataType = "double"),
@ApiImplicitParam(name="longitude",value = "经度",paramType = "query",required = true,dataType = "double"), @ApiImplicitParam(name = "longitude", value = "经度", paramType = "query", required = true, dataType = "double"),
@ApiImplicitParam(name = "radius",value = "半径",paramType = "query",required = true,dataType = "Integer") @ApiImplicitParam(name = "radius", value = "半径", paramType = "query", required = true, dataType = "Integer")
}) })
public Result listBuildingSiteByPoints(double longitude,double latitude,Integer radius){ public Result listBuildingSiteByPoints(double longitude, double latitude, Integer radius) {
List<BuildingSite> list = new ArrayList<>(); List<BuildingSite> list = new ArrayList<>();
list = buildingSitrService.listBuildingSiteByPoints(longitude,latitude,radius); list = buildingSitrService.listBuildingSiteByPoints(longitude, latitude, radius);
return Result.success(list); return Result.success(list);
} }
/** /**
* 查询全部工地信息 * 查询全部工地信息
*
* @return * @return
*/ */
@GetMapping("selectBuildSite") @GetMapping("selectBuildSite")
@ApiOperation("查询全部工地信息") @ApiOperation("查询全部工地信息")
public Result selectBuildSite(){ public Result selectBuildSite() {
List<BuildingSite> buildingSites = buildingSiteMapper.selectBuildSite(); List<BuildingSite> buildingSites = buildingSiteMapper.selectBuildSite();
Result success = Result.success(buildingSites); Result success = Result.success(buildingSites);
return success; return success;

View File

@ -24,30 +24,30 @@ public class SJZTController {
//从接口获取案件数据 //从接口获取案件数据
@GetMapping("listSJZTDatas") @GetMapping("listSJZTDatas")
@ApiOperation("获取案件数据,根据后台条件调用接口获取") @ApiOperation("获取案件数据,根据后台条件调用接口获取")
public List<Map> listSJZTDatas(){ public List<Map> listSJZTDatas() {
return sjztService.listSJZTDatas(); return sjztService.listSJZTDatas();
} }
//测试保存 //测试保存
@GetMapping("batchSaveSJZT") @GetMapping("batchSaveSJZT")
@ApiOperation("测试保存,根据后台条件调用接口获取并保存到表,这个后台条件需要改动,也可能是做成自动任务调度") @ApiOperation("测试保存,根据后台条件调用接口获取并保存到表,这个后台条件需要改动,也可能是做成自动任务调度")
public void batchSaveSJZT(){ public void batchSaveSJZT() {
sjztService.batchSave(); sjztService.batchSave();
} }
//从表中查询案件数据,需要根据要求增加条件 //从表中查询案件数据,需要根据要求增加条件
@GetMapping("listSJZTByDt") @GetMapping("listSJZTByDt")
@ApiOperation("获取案件数据根据ajjlsj从表中获取") @ApiOperation("获取案件数据根据ajjlsj从表中获取")
@ApiImplicitParam(name="ajjlsj",value="案件建立时间2021-01-01",paramType = "query",required = true,dataType = "string") @ApiImplicitParam(name = "ajjlsj", value = "案件建立时间2021-01-01", paramType = "query", required = true, dataType = "string")
public List<CaseCityLaw> listSJZTByDt( public List<CaseCityLaw> listSJZTByDt(
@RequestParam(value="ajjlsj") String ajjlsj @RequestParam(value = "ajjlsj") String ajjlsj
){ ) {
return sjztService.listSJZTByDt(ajjlsj); return sjztService.listSJZTByDt(ajjlsj);
} }
@PostMapping("upStream") @PostMapping("upStream")
@ApiOperation("案件上报,调用接口上报,暂时未测试") @ApiOperation("案件上报,调用接口上报,暂时未测试")
public Result upStream(@ApiParam(value="data,直接以json字符串的形式传递",required = true) @RequestBody String data){ public Result upStream(@ApiParam(value = "data,直接以json字符串的形式传递", required = true) @RequestBody String data) {
System.out.println("案件上报,调用接口上报"); System.out.println("案件上报,调用接口上报");
return sjztService.upStream(JSONObject.parseObject(data)); return sjztService.upStream(JSONObject.parseObject(data));
} }

View File

@ -25,20 +25,20 @@ public class SanitationController {
@GetMapping("/saveSantation") @GetMapping("/saveSantation")
@ApiOperation("测试获取环卫车辆基础数据并保存到表中") @ApiOperation("测试获取环卫车辆基础数据并保存到表中")
public Result saveSantation(){ public Result saveSantation() {
return null; return null;
} }
@GetMapping("/saveSanitationRoad") @GetMapping("/saveSanitationRoad")
@ApiOperation("测试获取环卫道路数据并保存到表中") @ApiOperation("测试获取环卫道路数据并保存到表中")
public Result saveSanitationRoad(){ public Result saveSanitationRoad() {
return sanitationService.saveSanitationRoad(); return sanitationService.saveSanitationRoad();
} }
@GetMapping("saveSanitationTask") @GetMapping("saveSanitationTask")
@ApiOperation("测试获取环卫车作业数据并保存到表中") @ApiOperation("测试获取环卫车作业数据并保存到表中")
public Result saveSanitationTask(){ public Result saveSanitationTask() {
return sanitationService.saveSanitationTask(); return sanitationService.saveSanitationTask();
} }
} }

View File

@ -21,7 +21,7 @@ public class StaticController {
private CameraMapper cameraMapper; private CameraMapper cameraMapper;
@RequestMapping("all") @RequestMapping("all")
public Object all(){ public Object all() {
HashMap<Object, Object> map = new HashMap<>(); HashMap<Object, Object> map = new HashMap<>();
// //
Integer cameraCount = cameraMapper.selectCount(null); Integer cameraCount = cameraMapper.selectCount(null);

View File

@ -16,7 +16,7 @@ public class UserLoginController {
private UserLoginService userLoginService; private UserLoginService userLoginService;
@PostMapping("login") @PostMapping("login")
public Result login(String username,String password){ public Result login(String username, String password) {
UserLoginDto login = userLoginService.login(username, password); UserLoginDto login = userLoginService.login(username, password);
Result success = Result.success(login); Result success = Result.success(login);
return success; return success;

View File

@ -29,11 +29,12 @@ public class WaterPointController {
/** /**
* 查询积水点列表 * 查询积水点列表
*
* @return * @return
*/ */
@GetMapping("selectWaterPoint") @GetMapping("selectWaterPoint")
@ApiOperation("查询积水点列表") @ApiOperation("查询积水点列表")
public Result selectWaterPoint(){ public Result selectWaterPoint() {
List<WaterPointDto> waterPoints = waterPointMapper.selectWaterPoint(); List<WaterPointDto> waterPoints = waterPointMapper.selectWaterPoint();
Result success = Result.success(waterPoints); Result success = Result.success(waterPoints);
return success; return success;
@ -41,13 +42,14 @@ public class WaterPointController {
/** /**
* 查询积水点等级 * 查询积水点等级
*
* @param reportOrigin * @param reportOrigin
* @return * @return
*/ */
@GetMapping("selectReportOrigin") @GetMapping("selectReportOrigin")
@ApiOperation("查询积水点等级") @ApiOperation("查询积水点等级")
@ApiImplicitParam(name = "reportOrigin",value = "等级标识",required = true,dataType = "String") @ApiImplicitParam(name = "reportOrigin", value = "等级标识", required = true, dataType = "String")
public Result selectReportOrigin(String reportOrigin){ public Result selectReportOrigin(String reportOrigin) {
List<WaterPointDto> waterPoints = waterPointMapper.selectReportOrigin(reportOrigin); List<WaterPointDto> waterPoints = waterPointMapper.selectReportOrigin(reportOrigin);
Result success = Result.success(waterPoints); Result success = Result.success(waterPoints);
return success; return success;
@ -55,13 +57,14 @@ public class WaterPointController {
/** /**
* 根据名称查询积水点详细信息 * 根据名称查询积水点详细信息
*
* @param waterPointName * @param waterPointName
* @return * @return
*/ */
@GetMapping("selectCameraByName") @GetMapping("selectCameraByName")
@ApiOperation("根据名称查询积水点详细信息") @ApiOperation("根据名称查询积水点详细信息")
@ApiImplicitParam(name = "waterPointName",value = "积水点名称",required = true,dataType = "String") @ApiImplicitParam(name = "waterPointName", value = "积水点名称", required = true, dataType = "String")
public Result selectCameraByName(String waterPointName){ public Result selectCameraByName(String waterPointName) {
List<WaterCameraDto> waterCameras = waterPointMapper.selectCameraByName(waterPointName); List<WaterCameraDto> waterCameras = waterPointMapper.selectCameraByName(waterPointName);
Result success = Result.success(waterCameras); Result success = Result.success(waterCameras);
return success; return success;
@ -69,11 +72,12 @@ public class WaterPointController {
/** /**
* 统计分析积水点市区分布 * 统计分析积水点市区分布
*
* @return * @return
*/ */
@GetMapping("selectCountWater") @GetMapping("selectCountWater")
@ApiOperation("统计分析积水点市区分布") @ApiOperation("统计分析积水点市区分布")
public Result selectCountWater(){ public Result selectCountWater() {
List<WaterPointDtos> waterCameras = waterPointMapper.selectCountWater(); List<WaterPointDtos> waterCameras = waterPointMapper.selectCountWater();
Result success = Result.success(waterCameras); Result success = Result.success(waterCameras);
return success; return success;
@ -81,11 +85,12 @@ public class WaterPointController {
/** /**
* 统计分析积水点来源 * 统计分析积水点来源
*
* @return * @return
*/ */
@GetMapping("selectCountWaters") @GetMapping("selectCountWaters")
@ApiOperation("统计分析积水点来源") @ApiOperation("统计分析积水点来源")
public Result selectCountWaters(){ public Result selectCountWaters() {
List<WaterPointDtos> waterCameras = waterPointMapper.selectCountWaters(); List<WaterPointDtos> waterCameras = waterPointMapper.selectCountWaters();
Result success = Result.success(waterCameras); Result success = Result.success(waterCameras);
return success; return success;
@ -93,11 +98,12 @@ public class WaterPointController {
/** /**
* 统计分析积水点等级 * 统计分析积水点等级
*
* @return * @return
*/ */
@GetMapping("selectCountLevel") @GetMapping("selectCountLevel")
@ApiOperation("统计分析积水点等级") @ApiOperation("统计分析积水点等级")
public Result selectCountLevel(){ public Result selectCountLevel() {
List<WaterPointDtos> waterCameras = waterPointMapper.selectCountLevel(); List<WaterPointDtos> waterCameras = waterPointMapper.selectCountLevel();
Result success = Result.success(waterCameras); Result success = Result.success(waterCameras);
return success; return success;
@ -105,19 +111,20 @@ public class WaterPointController {
/** /**
* 根据经纬度查询积水点周边监控 * 根据经纬度查询积水点周边监控
*
* @param longitude * @param longitude
* @param latitude * @param latitude
* @param radius * @param radius
* @return * @return
*/ */
@GetMapping ("selectByLongAndLiti") @GetMapping("selectByLongAndLiti")
@ApiOperation("根据经纬度查询积水点周边监控") @ApiOperation("根据经纬度查询积水点周边监控")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "longitude", value = "经度",required = true,dataType ="Double"), @ApiImplicitParam(name = "longitude", value = "经度", required = true, dataType = "Double"),
@ApiImplicitParam(name = "latitude", value = "纬度",required = true,dataType ="Double"), @ApiImplicitParam(name = "latitude", value = "纬度", required = true, dataType = "Double"),
@ApiImplicitParam(name = "radius", value = "半径,米",required = true,dataType ="Integer"),} @ApiImplicitParam(name = "radius", value = "半径,米", required = true, dataType = "Integer"),}
) )
public Result selectByLongAndLiti(Double longitude,Double latitude,Integer radius){ public Result selectByLongAndLiti(Double longitude, Double latitude, Integer radius) {
double[] around = LongLatUtil.getAround(longitude, latitude, radius); double[] around = LongLatUtil.getAround(longitude, latitude, radius);
List<WaterPoint> c = waterPointMapper.selectByLongAndLiti(around[0], around[2], around[1], around[3]); List<WaterPoint> c = waterPointMapper.selectByLongAndLiti(around[0], around[2], around[1], around[3]);
Result success = Result.success(c); Result success = Result.success(c);
@ -126,11 +133,12 @@ public class WaterPointController {
/** /**
* 查询交警提供积水点列表 * 查询交警提供积水点列表
*
* @return * @return
*/ */
@GetMapping("selectWaterPoliceList") @GetMapping("selectWaterPoliceList")
@ApiOperation("查询交警提供积水点列表") @ApiOperation("查询交警提供积水点列表")
public Result selectWaterPoliceList(){ public Result selectWaterPoliceList() {
List<WaterPointPolice> pointPolices = waterPointMapper.selectWaterPoliceList(); List<WaterPointPolice> pointPolices = waterPointMapper.selectWaterPoliceList();
Result success = Result.success(pointPolices); Result success = Result.success(pointPolices);
return success; return success;

View File

@ -7,49 +7,49 @@ import lombok.Data;
@Data @Data
public class BuildingRecordsDto { public class BuildingRecordsDto {
@ExcelProperty(value = {"工地名称"},index = 0) @ExcelProperty(value = {"工地名称"}, index = 0)
private String projectName;//工地名称 private String projectName;//工地名称
private String gdmc;//工地名称 private String gdmc;//工地名称
@ExcelProperty(value = {"建筑编号"},index = 1) @ExcelProperty(value = {"建筑编号"}, index = 1)
private String buildLicense;//建筑编号 private String buildLicense;//建筑编号
@ExcelProperty(value = {"推送时间"},index = 2) @ExcelProperty(value = {"推送时间"}, index = 2)
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private String pushTime;//推送时间 private String pushTime;//推送时间
@ExcelProperty(value = {"appid"},index = 3) @ExcelProperty(value = {"appid"}, index = 3)
private String appid; private String appid;
@ExcelProperty(value = {"施工位置"},index = 4) @ExcelProperty(value = {"施工位置"}, index = 4)
private String sgwz;//施工位置 private String sgwz;//施工位置
@ExcelProperty(value = {"经度"},index = 5) @ExcelProperty(value = {"经度"}, index = 5)
private double jd;//经度 private double jd;//经度
@ExcelProperty(value = {"纬度"},index = 6) @ExcelProperty(value = {"纬度"}, index = 6)
private double wd;//纬度 private double wd;//纬度
@ExcelProperty(value = {"所属区域"},index = 7) @ExcelProperty(value = {"所属区域"}, index = 7)
private String ssdq;//所属区域 private String ssdq;//所属区域
@ExcelProperty(value = {"扬尘"},index = 8) @ExcelProperty(value = {"扬尘"}, index = 8)
private double pm10;//扬尘 private double pm10;//扬尘
@ExcelProperty(value = {"噪声"},index = 9) @ExcelProperty(value = {"噪声"}, index = 9)
private double noice;//噪声 private double noice;//噪声
@ExcelProperty(value = {"夜间施工"},index = 10) @ExcelProperty(value = {"夜间施工"}, index = 10)
private String yjsg;//夜间施工 private String yjsg;//夜间施工
@ExcelProperty(value = {"图片路径"},index = 11) @ExcelProperty(value = {"图片路径"}, index = 11)
private String picUrl;//图片路径 private String picUrl;//图片路径
@ExcelProperty(value = {"摄像头编号"},index = 12) @ExcelProperty(value = {"摄像头编号"}, index = 12)
private String channelCode;//摄像头编号 private String channelCode;//摄像头编号
@ExcelProperty(value = {"摄像头名称"},index = 13) @ExcelProperty(value = {"摄像头名称"}, index = 13)
private String channelName;//摄像头名称 private String channelName;//摄像头名称
} }

View File

@ -18,7 +18,7 @@ public class ChannelPictureDto {
private String PicUrl; private String PicUrl;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date insertTime; private Date insertTime;
} }

View File

@ -32,7 +32,7 @@ public class EventDto {
private String taskId; private String taskId;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private String captureTime; private String captureTime;
private String trackEvent; private String trackEvent;

View File

@ -16,7 +16,7 @@ public class PeopleRecognizeDto {
private Integer personNum; private Integer personNum;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date insertTime; private Date insertTime;
private String gpsX; private String gpsX;

View File

@ -24,7 +24,7 @@ public class PictureDto {
private String pic; private String pic;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date captureTime; private Date captureTime;
} }

View File

@ -33,12 +33,12 @@ public class RoadDataDtos {
private String points; private String points;
@JsonFormat(pattern="yyyy-MM-dd mm:HH:ss",timezone = "GMT+8") @JsonFormat(pattern = "yyyy-MM-dd mm:HH:ss", timezone = "GMT+8")
private String dt; private String dt;
@JsonFormat(pattern="yyyy-MM-dd mm:HH:ss",timezone = "GMT+8") @JsonFormat(pattern = "yyyy-MM-dd mm:HH:ss", timezone = "GMT+8")
private String begin; private String begin;
@JsonFormat(pattern="yyyy-MM-dd mm:HH:ss",timezone = "GMT+8") @JsonFormat(pattern = "yyyy-MM-dd mm:HH:ss", timezone = "GMT+8")
private String over; private String over;
} }

View File

@ -35,7 +35,7 @@ public class BuildingRecords {
@ApiModelProperty("项目建筑批准编号") @ApiModelProperty("项目建筑批准编号")
private String buildLicense; private String buildLicense;
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@ApiModelProperty("数据上传时间") @ApiModelProperty("数据上传时间")
private LocalDateTime pushTime; private LocalDateTime pushTime;

View File

@ -23,7 +23,7 @@ public class Camera {
private String latitude; private String latitude;
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date captureTime; private Date captureTime;
private String pic; private String pic;

View File

@ -26,7 +26,7 @@ public class CaseCityLaw {
@TableId(type = IdType.ASSIGN_ID) @TableId(type = IdType.ASSIGN_ID)
private Long id; private Long id;
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private LocalDateTime ajjlsj; private LocalDateTime ajjlsj;
private String dzms; private String dzms;
@ -65,13 +65,13 @@ public class CaseCityLaw {
private String yzb; private String yzb;
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private LocalDateTime pqsj; private LocalDateTime pqsj;
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private LocalDateTime ajjssj; private LocalDateTime ajjssj;
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private LocalDateTime ajzfsj; private LocalDateTime ajzfsj;
private String czsxcqjaaqjacqwjayqja; private String czsxcqjaaqjacqwjayqja;

View File

@ -18,7 +18,7 @@ public class ChannelPicture {
private String PicUrl; private String PicUrl;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date insertTime; private Date insertTime;
} }

View File

@ -36,7 +36,7 @@ public class Event {
private String taskId; private String taskId;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private String captureTime; private String captureTime;
private String trackEvent; private String trackEvent;

View File

@ -22,7 +22,7 @@ public class PeopleRecognize {
private Integer personNum; private Integer personNum;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date insertTime; private Date insertTime;
} }

View File

@ -8,7 +8,7 @@ import java.util.Date;
@Data @Data
public class Picture { public class Picture {
@JsonFormat(pattern="yyyy-MM-dd mm:HH:ss",timezone = "GMT+8") @JsonFormat(pattern = "yyyy-MM-dd mm:HH:ss", timezone = "GMT+8")
private Date captureTime; private Date captureTime;
private String pic; private String pic;

View File

@ -16,14 +16,14 @@ public class Result<T> {
private int count; private int count;
static public Result success(){ static public Result success() {
return Result.builder() return Result.builder()
.code(1) .code(1)
.message("success") .message("success")
.build(); .build();
} }
static public Result success(Object obj){ static public Result success(Object obj) {
return Result.builder() return Result.builder()
.code(1) .code(1)
.message("success") .message("success")
@ -31,7 +31,7 @@ public class Result<T> {
.build(); .build();
} }
static public Result error(String errMsg){ static public Result error(String errMsg) {
return Result.builder() return Result.builder()
.code(0) .code(0)
.message(errMsg) .message(errMsg)

View File

@ -53,7 +53,7 @@ public class RoadData {
private String points; private String points;
@JsonFormat(pattern="yyyy-MM-dd mm:HH:ss",timezone = "GMT+8") @JsonFormat(pattern = "yyyy-MM-dd mm:HH:ss", timezone = "GMT+8")
private String dt; private String dt;
} }

View File

@ -35,7 +35,7 @@ public class Sanitation {
@ApiModelProperty("驾驶员") @ApiModelProperty("驾驶员")
private String jsy; private String jsy;
@JsonFormat(pattern="yyyy-MM-dd mm:HH:ss",timezone = "GMT+8") @JsonFormat(pattern = "yyyy-MM-dd mm:HH:ss", timezone = "GMT+8")
@ApiModelProperty("购买日期") @ApiModelProperty("购买日期")
private LocalDateTime gmri; private LocalDateTime gmri;

View File

@ -47,7 +47,7 @@ public class SanitationTask {
@ApiModelProperty("作业完成率") @ApiModelProperty("作业完成率")
private double zywcl; private double zywcl;
@JsonFormat(pattern="yyyy-MM-dd mm:HH:ss",timezone = "GMT+8") @JsonFormat(pattern = "yyyy-MM-dd mm:HH:ss", timezone = "GMT+8")
@ApiModelProperty("作业日期") @ApiModelProperty("作业日期")
private LocalDateTime zyrq; private LocalDateTime zyrq;
@ -81,7 +81,7 @@ public class SanitationTask {
@ApiModelProperty("作业GPS点数") @ApiModelProperty("作业GPS点数")
private double zygpsds; private double zygpsds;
@JsonFormat(pattern="yyyy-MM-dd mm:HH:ss",timezone = "GMT+8") @JsonFormat(pattern = "yyyy-MM-dd mm:HH:ss", timezone = "GMT+8")
@ApiModelProperty("上传时间") @ApiModelProperty("上传时间")
private LocalDateTime updatetime; private LocalDateTime updatetime;

View File

@ -13,7 +13,7 @@ import java.io.Serializable;
*/ */
@Data @Data
@TableName("t_scenic" ) @TableName("t_scenic")
public class Scenic implements Serializable { public class Scenic implements Serializable {
private static final long serialVersionUID = 4864551986417177990L; private static final long serialVersionUID = 4864551986417177990L;

View File

@ -20,7 +20,7 @@ import java.time.LocalDateTime;
@AllArgsConstructor @AllArgsConstructor
@NoArgsConstructor @NoArgsConstructor
@TableName("t_trail_sediment") @TableName("t_trail_sediment")
public class SedimentTrail{ public class SedimentTrail {
@TableId @TableId
private Integer id; private Integer id;
@ -29,7 +29,7 @@ public class SedimentTrail{
private String simCardNum; private String simCardNum;
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private LocalDateTime uploadtime; private LocalDateTime uploadtime;
private String coordinateX; private String coordinateX;
@ -40,12 +40,12 @@ public class SedimentTrail{
private double latitude; private double latitude;
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private LocalDateTime recordTime; private LocalDateTime recordTime;
private String angle; private String angle;
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private LocalDateTime updateTime; private LocalDateTime updateTime;
private String status; private String status;

View File

@ -31,7 +31,7 @@ public class TrailSanitation {
private String wz; private String wz;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private String fssj; private String fssj;
private String jd; private String jd;
@ -58,7 +58,7 @@ public class TrailSanitation {
private String gd; private String gd;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private String updatetime; private String updatetime;
} }

View File

@ -36,11 +36,11 @@ public interface BuildingRecordsMapper extends BaseMapper<BuildingRecords> {
List<BuildingRecordsDtos> selectMonthPmAndNoice(@Param("buildLicense") String buildLicense); List<BuildingRecordsDtos> selectMonthPmAndNoice(@Param("buildLicense") String buildLicense);
List<BuildingRecordsDto> selectRaise(@Param("page") Integer page,@Param("pageSize") Integer pageSize,@Param("startTime")String startTime,@Param("endTime") String endTime); List<BuildingRecordsDto> selectRaise(@Param("page") Integer page, @Param("pageSize") Integer pageSize, @Param("startTime") String startTime, @Param("endTime") String endTime);
List<BuildingRecordsDto> selectNoiceEvent(@Param("page") Integer page,@Param("pageSize") Integer pageSize); List<BuildingRecordsDto> selectNoiceEvent(@Param("page") Integer page, @Param("pageSize") Integer pageSize);
List<EventDto> selectByAllEvent(@Param("page") Integer page,@Param("pageSize") Integer pageSize); List<EventDto> selectByAllEvent(@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 = 1 ") @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(); Integer selectCountEvent();
@ -60,6 +60,7 @@ public interface BuildingRecordsMapper extends BaseMapper<BuildingRecords> {
@Param("jd1") Double jd1, @Param("jd1") Double jd1,
@Param("wd") Double wd, @Param("wd") Double wd,
@Param("wd1") Double wd1); @Param("wd1") Double wd1);
@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") @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(); List<BuildingRecordsDto> selectByDayRaise();

View File

@ -54,7 +54,7 @@ public interface CameraChannelMapper extends BaseMapper<CameraChannel> {
@Param("gpsY") Double gpsY, @Param("gpsY") Double gpsY,
@Param("gpsY1") Double gpsY1); @Param("gpsY1") Double gpsY1);
List<CameraChannelNLDto> selectNLAll(@Param("page") Integer page,@Param("pageSize") Integer pageSize); List<CameraChannelNLDto> selectNLAll(@Param("page") Integer page, @Param("pageSize") Integer pageSize);
@Select("SELECT * FROM t_camera_channel WHERE channel_code < '009_37021544001321925022' AND channel_code > '009_37021502001321352341' ORDER BY channel_code DESC") @Select("SELECT * FROM t_camera_channel WHERE channel_code < '009_37021544001321925022' AND channel_code > '009_37021502001321352341' ORDER BY channel_code DESC")
List<CameraChannel> selectCameraChannel(); List<CameraChannel> selectCameraChannel();

View File

@ -8,6 +8,7 @@ import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import java.util.List; import java.util.List;
@Repository @Repository
public interface ChannelPictureMapper extends BaseMapper<ChannelPicture> { public interface ChannelPictureMapper extends BaseMapper<ChannelPicture> {

View File

@ -12,7 +12,7 @@ import java.util.List;
@Repository @Repository
public interface EventMapper extends BaseMapper<Event> { public interface EventMapper extends BaseMapper<Event> {
List<EventDto> selectEvent(@Param("page") Integer page,@Param("pageSize") Integer pageSize); List<EventDto> selectEvent(@Param("page") Integer page, @Param("pageSize") Integer pageSize);
@Select("select count(*) from t_event where track_event = 'START'") @Select("select count(*) from t_event where track_event = 'START'")
Integer selectCountEvent(); Integer selectCountEvent();
@ -20,10 +20,10 @@ public interface EventMapper extends BaseMapper<Event> {
@Select("SELECT * FROM t_event where TO_DAYS(capture_time) = TO_DAYS(NOW()) AND track_event = 'START'") @Select("SELECT * FROM t_event where TO_DAYS(capture_time) = TO_DAYS(NOW()) AND track_event = 'START'")
List<EventDto> selectByTime(); List<EventDto> selectByTime();
List<EventDto> selectByName(@Param("eventNewName") String eventNewName,@Param("page") Integer page,@Param("pageSize") Integer pageSize); List<EventDto> selectByName(@Param("eventNewName") String eventNewName, @Param("page") Integer page, @Param("pageSize") Integer pageSize);
@Select("select count(*) from t_event where track_event = 'START' and event_cn_name in (${eventNewName})") @Select("select count(*) from t_event where track_event = 'START' and event_cn_name in (${eventNewName})")
Integer selectCountByName(@Param("eventNewName")String eventNewName); Integer selectCountByName(@Param("eventNewName") String eventNewName);
@Select("SELECT * FROM t_event where TO_DAYS(capture_time) = TO_DAYS(NOW()) AND event_cn_name in (${eventNewName}) AND track_event = 'START'") @Select("SELECT * FROM t_event where TO_DAYS(capture_time) = TO_DAYS(NOW()) AND event_cn_name in (${eventNewName}) AND track_event = 'START'")
List<EventDto> selectByTimeAndName(@Param("eventNewName") String eventNewName); List<EventDto> selectByTimeAndName(@Param("eventNewName") String eventNewName);

View File

@ -15,9 +15,9 @@ import java.util.List;
@Repository @Repository
public interface KeyAreaMapper extends BaseMapper<KeyArea> { public interface KeyAreaMapper extends BaseMapper<KeyArea> {
List<KeyAreaDto> selectKeyAreaList(@Param("type1") String type1,@Param("type2") String type2,@Param("type3") String type3,@Param("timeId") String timeId); List<KeyAreaDto> selectKeyAreaList(@Param("type1") String type1, @Param("type2") String type2, @Param("type3") String type3, @Param("timeId") String timeId);
List<KeyAreaDto> selectKeyArea(@Param("type") String type,@Param("timeId") String timeId); List<KeyAreaDto> selectKeyArea(@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}")
List<KeyAreaLocation> selectByAreaName(String areaName); List<KeyAreaLocation> selectByAreaName(String areaName);
@ -25,7 +25,7 @@ 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); 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") @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(); Integer selectCountAreaEvent();
@ -33,10 +33,10 @@ public interface KeyAreaMapper extends BaseMapper<KeyArea> {
@Select("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 AND TO_DAYS(te.capture_time) = TO_DAYS(NOW())") @Select("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 AND TO_DAYS(te.capture_time) = TO_DAYS(NOW())")
List<EventDto> selectByDayAreaEvent(); List<EventDto> selectByDayAreaEvent();
List<EventDto> selectByNameAreaEvent(@Param("eventNewName") String eventNewName,@Param("page") Integer page,@Param("pageSize") Integer pageSize); List<EventDto> selectByNameAreaEvent(@Param("eventNewName") String eventNewName, @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 AND event_cn_name IN (${eventNewName})") @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 AND event_cn_name IN (${eventNewName})")
Integer selectCountByNameAreaEvent(@Param("eventNewName")String eventNewName); Integer selectCountByNameAreaEvent(@Param("eventNewName") String eventNewName);
List<KeyAreaDtos> selectMonthAreaEvent(); List<KeyAreaDtos> selectMonthAreaEvent();

View File

@ -23,7 +23,7 @@ public interface RoadDataMapper extends BaseMapper<RoadData> {
void batchSave(List<Map> list); void batchSave(List<Map> list);
List<RoadData> selectRoadData(@Param("page") Integer page,@Param("pageSize") Integer pageSize); List<RoadData> selectRoadData(@Param("page") Integer page, @Param("pageSize") Integer pageSize);
@Select("select count(*) from t_road_data where pm10 > 150") @Select("select count(*) from t_road_data where pm10 > 150")
Integer selectCountRoadData(); Integer selectCountRoadData();

View File

@ -109,13 +109,13 @@ public class BuildingRecordsService {
} }
//导出excel表格 //导出excel表格
public void testHSSF(String startTime,String endTime) throws Exception { public void testHSSF(String startTime, String endTime) throws Exception {
// 1. 创建一个工作簿 // 1. 创建一个工作簿
HSSFWorkbook wb = new HSSFWorkbook(); HSSFWorkbook wb = new HSSFWorkbook();
// 2. 创建一个工作表 // 2. 创建一个工作表
HSSFSheet sheet = wb.createSheet(); HSSFSheet sheet = wb.createSheet();
// 3. 获取数据库数据 // 3. 获取数据库数据
List<BuildingRecordsDto> buildingRecordsDtos = buildingRecordsMapper.selectRaise(null, null,startTime,endTime); List<BuildingRecordsDto> buildingRecordsDtos = buildingRecordsMapper.selectRaise(null, null, startTime, endTime);
for (int i = 0; i < buildingRecordsDtos.size(); i++) { for (int i = 0; i < buildingRecordsDtos.size(); i++) {
// 4. 创建行 // 4. 创建行
HSSFRow row = sheet.createRow(i); HSSFRow row = sheet.createRow(i);
@ -131,7 +131,7 @@ public class BuildingRecordsService {
} }
} }
// 7.写文件 // 7.写文件
FileOutputStream fos = new FileOutputStream("D:/"+System.currentTimeMillis()+".xls"); FileOutputStream fos = new FileOutputStream("D:/" + System.currentTimeMillis() + ".xls");
// 8.关闭流 // 8.关闭流
wb.write(fos); wb.write(fos);
fos.close(); fos.close();

View File

@ -24,15 +24,15 @@ public class BuildingSiteService {
@Autowired @Autowired
private BuildingSiteMapper buildingSiteMapper; private BuildingSiteMapper buildingSiteMapper;
public List<BuildingSite> listBuildingSiteByPoints(double longitude,double latitude,Integer radius){ public List<BuildingSite> listBuildingSiteByPoints(double longitude, double latitude, Integer radius) {
List<BuildingSite> list = new ArrayList<>(); List<BuildingSite> list = new ArrayList<>();
try{ try {
double[] points = LongLatUtil.getAround(longitude,latitude,radius); double[] points = LongLatUtil.getAround(longitude, latitude, radius);
QueryWrapper<BuildingSite> wrapper = new QueryWrapper(); QueryWrapper<BuildingSite> wrapper = new QueryWrapper();
wrapper.between("jd",points[0],points[2]).between("wd",points[1],points[3]); wrapper.between("jd", points[0], points[2]).between("wd", points[1], points[3]);
list = buildingSiteMapper.selectList(wrapper); list = buildingSiteMapper.selectList(wrapper);
}catch (Exception e){ } catch (Exception e) {
log.error("[listBuildingSiteByPoints] Exception:"+e.getMessage()); log.error("[listBuildingSiteByPoints] Exception:" + e.getMessage());
} }
return list; return list;
} }

View File

@ -28,12 +28,12 @@ public class CameraChannelService {
//查询所有摄像头 //查询所有摄像头
//@Cacheable(value = "fillIn") //@Cacheable(value = "fillIn")
public String selectAll(){ public String selectAll() {
String list = (String)EhcacheUtil.getInstance().get("fillIn", "allCameraList"); String list = (String) EhcacheUtil.getInstance().get("fillIn", "allCameraList");
if(StringUtils.isEmpty(list)){ if (StringUtils.isEmpty(list)) {
List<CameraChannelDto> cameraChannelDtos = cameraChannelMapper.selectAll(); List<CameraChannelDto> cameraChannelDtos = cameraChannelMapper.selectAll();
list = JSONObject.toJSONString(cameraChannelDtos); list = JSONObject.toJSONString(cameraChannelDtos);
EhcacheUtil.getInstance().put("fillIn", "allCameraList",list); EhcacheUtil.getInstance().put("fillIn", "allCameraList", list);
} }
return list; return list;
} }

View File

@ -28,15 +28,15 @@ public class EventService {
//1.登录 //1.登录
//2.获取token //2.获取token
public String shangtangToken () { public String shangtangToken() {
String url = "http://10.132.191.54:10270/whale-open-api/tenant/token"; String url = "http://10.132.191.54:10270/whale-open-api/tenant/token";
Map<String,Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
map.put("accessKey","a1ddCV7z7Jhv0SBGx5O3hblO"); map.put("accessKey", "a1ddCV7z7Jhv0SBGx5O3hblO");
map.put("secretKey","glIixzORLgoFJz0VdF1aXICR"); map.put("secretKey", "glIixzORLgoFJz0VdF1aXICR");
ResponseEntity<JSONObject> responseEntity; ResponseEntity<JSONObject> responseEntity;
try { try {
responseEntity = restTemplate.postForEntity(url,map,JSONObject.class); responseEntity = restTemplate.postForEntity(url, map, JSONObject.class);
JSONObject body = responseEntity.getBody(); JSONObject body = responseEntity.getBody();
JSONObject data = body.getJSONObject("data"); JSONObject data = body.getJSONObject("data");
String token = data.getString("token"); String token = data.getString("token");
@ -49,7 +49,7 @@ public class EventService {
} }
//订阅任务下发接口 //订阅任务下发接口
public JSONObject subscribe(){ public JSONObject subscribe() {
String token = this.shangtangToken(); String token = this.shangtangToken();
String url = "http://10.132.191.54:10270/whale-open-api/subscribe"; String url = "http://10.132.191.54:10270/whale-open-api/subscribe";
@ -57,39 +57,39 @@ public class EventService {
headers.setContentType(MediaType.APPLICATION_JSON); headers.setContentType(MediaType.APPLICATION_JSON);
headers.add("token", token); headers.add("token", token);
headers.add("tid","default"); headers.add("tid", "default");
Map<String,Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
map.put("callBackUrl","http://15.2.23.205:7009/STapi/project/receive"); map.put("callBackUrl", "http://15.2.23.205:7009/STapi/project/receive");
// map.put("certPubKey",""); // map.put("certPubKey","");
map.put("subscribeType",3); map.put("subscribeType", 3);
// map.put("taskId","serial"); // map.put("taskId","serial");
ResponseEntity<JSONObject> responseEntity; ResponseEntity<JSONObject> responseEntity;
HttpEntity<String> entity = new HttpEntity<>(JSONObject.toJSONString(map), headers); HttpEntity<String> entity = new HttpEntity<>(JSONObject.toJSONString(map), headers);
try { try {
responseEntity = restTemplate.exchange(url, HttpMethod.POST,entity,JSONObject.class); responseEntity = restTemplate.exchange(url, HttpMethod.POST, entity, JSONObject.class);
JSONObject body = responseEntity.getBody(); JSONObject body = responseEntity.getBody();
return body; return body;
}catch (Exception e){ } catch (Exception e) {
log.info( "[subscribe] exception:{}",e.getMessage()); log.info("[subscribe] exception:{}", e.getMessage());
return null; return null;
} }
} }
//事件模板分页查询接口 //事件模板分页查询接口
public JSONObject template(){ public JSONObject template() {
String token = this.shangtangToken(); String token = this.shangtangToken();
String url = "http://10.132.191.54:10270/whale-open-api/scenario/event/template?pageNum=1&pageSize=1000"; String url = "http://10.132.191.54:10270/whale-open-api/scenario/event/template?pageNum=1&pageSize=1000";
HttpHeaders headers = new HttpHeaders(); HttpHeaders headers = new HttpHeaders();
headers.add("token",token); headers.add("token", token);
headers.add("tid","default"); headers.add("tid", "default");
ResponseEntity<JSONObject> responseEntity; ResponseEntity<JSONObject> responseEntity;
try { try {
responseEntity = restTemplate.exchange(url,HttpMethod.GET,new HttpEntity<>(headers),JSONObject.class); responseEntity = restTemplate.exchange(url, HttpMethod.GET, new HttpEntity<>(headers), JSONObject.class);
JSONObject jsonObject = responseEntity.getBody(); JSONObject jsonObject = responseEntity.getBody();
return jsonObject; return jsonObject;
} catch (Exception e) { } catch (Exception e) {
@ -99,7 +99,7 @@ public class EventService {
} }
public void screenshot(){ public void screenshot() {
String url = "http://218.58.65.132:2580/api/haixin"; String url = "http://218.58.65.132:2580/api/haixin";
String image = "http://120.221.72.8:7002"; String image = "http://120.221.72.8:7002";
QueryWrapper<Event> queryWrapper = new QueryWrapper<>(); QueryWrapper<Event> queryWrapper = new QueryWrapper<>();
@ -107,22 +107,22 @@ public class EventService {
events.forEach(event -> { events.forEach(event -> {
String key = "NcjzgcBOJaD79xQm"; String key = "NcjzgcBOJaD79xQm";
String sign = "cjname=" + event.getEventCnName() + "&datetime=" + event.getCaptureTime() + "&piclatitude=" + event.getLatitude() + String sign = "cjname=" + event.getEventCnName() + "&datetime=" + event.getCaptureTime() + "&piclatitude=" + event.getLatitude() +
"&piclongitude=" + event.getLongitude() + "&resultpicurl1=" + event.getImageUrl()+ "&vidorpic=" + 0 + "&key=" + key; "&piclongitude=" + event.getLongitude() + "&resultpicurl1=" + event.getImageUrl() + "&vidorpic=" + 0 + "&key=" + key;
Map<String,Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
map.put("cjname",event.getEventCnName()); map.put("cjname", event.getEventCnName());
map.put("datetime",event.getCaptureTime()); map.put("datetime", event.getCaptureTime());
map.put("vidorpic",0); map.put("vidorpic", 0);
String substring = event.getImageUrl().substring(26); String substring = event.getImageUrl().substring(26);
map.put("resultpicurl1",image + substring); map.put("resultpicurl1", image + substring);
map.put("piclongitude",event.getLongitude()); map.put("piclongitude", event.getLongitude());
map.put("piclatitude",event.getLatitude()); map.put("piclatitude", event.getLatitude());
map.put("sign", SecureUtil.md5(sign)); map.put("sign", SecureUtil.md5(sign));
ResponseEntity<JSONObject> responseEntity; ResponseEntity<JSONObject> responseEntity;
try { try {
responseEntity = restTemplate.postForEntity(url,map,JSONObject.class); responseEntity = restTemplate.postForEntity(url, map, JSONObject.class);
JSONObject body = responseEntity.getBody(); JSONObject body = responseEntity.getBody();
System.out.println(body); System.out.println(body);
}catch (Exception e){ } catch (Exception e) {
log.info("[screenshot] exception:{}", e.getMessage()); log.info("[screenshot] exception:{}", e.getMessage());
} }
}); });

View File

@ -41,7 +41,7 @@ import java.util.List;
@Service @Service
@Log4j2 @Log4j2
public class MonitorService{ public class MonitorService {
@Autowired @Autowired
private RestTemplate restTemplate; private RestTemplate restTemplate;
@ -99,7 +99,7 @@ public class MonitorService{
static int keepaliveCount = 16; static int keepaliveCount = 16;
@PostConstruct @PostConstruct
public void init(){ public void init() {
String loginUrl = monitorDomain + "/videoService/accounts/authorize"; String loginUrl = monitorDomain + "/videoService/accounts/authorize";
HashMap<String, String> loginParam = new HashMap<>(); HashMap<String, String> loginParam = new HashMap<>();
@ -111,14 +111,14 @@ public class MonitorService{
try { try {
ResponseEntity<HashMap> loginResEntity = restTemplate.postForEntity(loginUrl, loginParam, HashMap.class, new HashMap<>()); ResponseEntity<HashMap> loginResEntity = restTemplate.postForEntity(loginUrl, loginParam, HashMap.class, new HashMap<>());
reponse = loginResEntity.getBody(); reponse = loginResEntity.getBody();
}catch (HttpClientErrorException e){ } catch (HttpClientErrorException e) {
if (e.getStatusCode() == HttpStatus.UNAUTHORIZED) { if (e.getStatusCode() == HttpStatus.UNAUTHORIZED) {
String responseString = e.getResponseBodyAsString(); String responseString = e.getResponseBodyAsString();
reponse = JSONObject.parseObject(responseString, HashMap.class); reponse = JSONObject.parseObject(responseString, HashMap.class);
} }
} }
if (reponse == null){ if (reponse == null) {
log.error("[monitor-capture]:" + "监控系统登录握手失败"); log.error("[monitor-capture]:" + "监控系统登录握手失败");
throw new RuntimeException("监控系统登录握手失败"); throw new RuntimeException("监控系统登录握手失败");
} }
@ -126,22 +126,22 @@ public class MonitorService{
//登录 //登录
loginParam.putAll(reponse); loginParam.putAll(reponse);
String sigin = SecureUtil.md5(password); String sigin = SecureUtil.md5(password);
sigin = SecureUtil.md5(userName+sigin); sigin = SecureUtil.md5(userName + sigin);
sigin = SecureUtil.md5(sigin); sigin = SecureUtil.md5(sigin);
sigin = SecureUtil.md5(userName+":"+loginParam.get("realm")+":"+sigin); sigin = SecureUtil.md5(userName + ":" + loginParam.get("realm") + ":" + sigin);
sigin = SecureUtil.md5(sigin+":"+loginParam.get("randomKey")); sigin = SecureUtil.md5(sigin + ":" + loginParam.get("randomKey"));
loginParam.put("signature", sigin); loginParam.put("signature", sigin);
reponse = restTemplate.postForEntity(loginUrl, loginParam, HashMap.class, new HashMap<>()).getBody(); reponse = restTemplate.postForEntity(loginUrl, loginParam, HashMap.class, new HashMap<>()).getBody();
if (reponse != null){ if (reponse != null) {
String token = (String) reponse.get("token"); String token = (String) reponse.get("token");
if (token== null || StringUtils.isEmpty(token)){ if (token == null || StringUtils.isEmpty(token)) {
log.error("[monitor-capture]:" + "监控系统登录失败"); log.error("[monitor-capture]:" + "监控系统登录失败");
return; return;
} }
this.token = token; this.token = token;
Integer duration = (Integer) reponse.get("duration"); Integer duration = (Integer) reponse.get("duration");
if (duration == null || duration < 20){ if (duration == null || duration < 20) {
log.error("[monitor-capture]:" + "监控系统失效时间异常" + duration); log.error("[monitor-capture]:" + "监控系统失效时间异常" + duration);
return; return;
} }
@ -152,27 +152,27 @@ public class MonitorService{
//会话保活 //会话保活
Timer timer = new Timer("monitor-capture-keepalive"); Timer timer = new Timer("monitor-capture-keepalive");
timer.scheduleAtFixedRate(new TimerTask(){ timer.scheduleAtFixedRate(new TimerTask() {
@Override @Override
public void run() { public void run() {
try{ try {
String keepaliveUrl = monitorDomain + "/videoService/accounts/token/keepalive"; String keepaliveUrl = monitorDomain + "/videoService/accounts/token/keepalive";
HttpHeaders headers = new HttpHeaders(); HttpHeaders headers = new HttpHeaders();
headers.add("X-Subject-Token",token); headers.add("X-Subject-Token", token);
HashMap<Object, Object> keepaliveParam = new HashMap<>(); HashMap<Object, Object> keepaliveParam = new HashMap<>();
keepaliveParam.put("token", token); keepaliveParam.put("token", token);
HttpEntity<Object> httpEntity = new HttpEntity<>(keepaliveParam, headers); HttpEntity<Object> httpEntity = new HttpEntity<>(keepaliveParam, headers);
restTemplate.put(keepaliveUrl, httpEntity); restTemplate.put(keepaliveUrl, httpEntity);
if (keepaliveCount++ > 12){//大概36分钟输出一次日志 if (keepaliveCount++ > 12) {//大概36分钟输出一次日志
log.info("[monitor-capture]: keepalive success"); log.info("[monitor-capture]: keepalive success");
keepaliveCount = 0; keepaliveCount = 0;
} }
}catch (Exception e){ } catch (Exception e) {
log.info("[monitor-capture]: keepalive faild, restart....."); log.info("[monitor-capture]: keepalive faild, restart.....");
e.printStackTrace(); e.printStackTrace();
@ -204,14 +204,14 @@ public class MonitorService{
camera.setPic(picUrl); camera.setPic(picUrl);
camera.setCaptureTime(new Date()); camera.setCaptureTime(new Date());
cameraMapper.updateById(camera); cameraMapper.updateById(camera);
}catch (Exception e){ } catch (Exception e) {
log.info( "[monitor-capture] " +cameraCode + " 截图图片失败 " + e.getMessage()); log.info("[monitor-capture] " + cameraCode + " 截图图片失败 " + e.getMessage());
} }
}); });
log.info("[monitor-capture]: end capture1"); log.info("[monitor-capture]: end capture1");
}catch (Exception exception){ } catch (Exception exception) {
exception.printStackTrace(); exception.printStackTrace();
} }
} }
@ -241,22 +241,22 @@ public class MonitorService{
picture.setPicUrl(picUrl); picture.setPicUrl(picUrl);
/*picture.setInsertTime(new Date()); /*picture.setInsertTime(new Date());
channelPictureMapper.insert(picture);*/ channelPictureMapper.insert(picture);*/
if (channelCode == null){ if (channelCode == null) {
channelPictureMapper.insert(picture); channelPictureMapper.insert(picture);
}else { } else {
QueryWrapper<ChannelPicture> queryWrapper = new QueryWrapper<>(); QueryWrapper<ChannelPicture> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("channel_code", channelCode); queryWrapper.eq("channel_code", channelCode);
picture.setInsertTime(new Date()); picture.setInsertTime(new Date());
channelPictureMapper.update(picture, queryWrapper); channelPictureMapper.update(picture, queryWrapper);
} }
}catch (Exception e){ } catch (Exception e) {
log.info( "[monitor-capture] " +channelCode + " 截图图片失败 " + e.getMessage()); log.info("[monitor-capture] " + channelCode + " 截图图片失败 " + e.getMessage());
} }
}); });
log.info("[monitor-capture]: end capture1"); log.info("[monitor-capture]: end capture1");
}catch (Exception exception){ } catch (Exception exception) {
exception.printStackTrace(); exception.printStackTrace();
} }
} }
@ -284,22 +284,22 @@ public class MonitorService{
picture.setPicUrl(picUrl); picture.setPicUrl(picUrl);
/*picture.setInsertTime(new Date()); /*picture.setInsertTime(new Date());
channelPictureMapper.insert(picture);*/ channelPictureMapper.insert(picture);*/
if (channelCode == null){ if (channelCode == null) {
channelPictureMapper.insert(picture); channelPictureMapper.insert(picture);
}else { } else {
QueryWrapper<ChannelPicture> queryWrapper = new QueryWrapper<>(); QueryWrapper<ChannelPicture> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("channel_code", channelCode); queryWrapper.eq("channel_code", channelCode);
picture.setInsertTime(new Date()); picture.setInsertTime(new Date());
channelPictureMapper.update(picture, queryWrapper); channelPictureMapper.update(picture, queryWrapper);
} }
}catch (Exception e){ } catch (Exception e) {
log.info( "[monitor-capture] " +channelCode + " 截图图片失败 " + e.getMessage()); log.info("[monitor-capture] " + channelCode + " 截图图片失败 " + e.getMessage());
} }
}); });
log.info("[monitor-capture]: end capture"); log.info("[monitor-capture]: end capture");
}catch (Exception exception){ } catch (Exception exception) {
exception.printStackTrace(); exception.printStackTrace();
} }
} }
@ -327,22 +327,22 @@ public class MonitorService{
picture.setPicUrl(picUrl); picture.setPicUrl(picUrl);
/*picture.setInsertTime(new Date()); /*picture.setInsertTime(new Date());
channelPictureMapper.insert(picture);*/ channelPictureMapper.insert(picture);*/
if (channelCode == null){ if (channelCode == null) {
channelPictureMapper.insert(picture); channelPictureMapper.insert(picture);
}else { } else {
QueryWrapper<ChannelPicture> queryWrapper = new QueryWrapper<>(); QueryWrapper<ChannelPicture> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("channel_code", channelCode); queryWrapper.eq("channel_code", channelCode);
picture.setInsertTime(new Date()); picture.setInsertTime(new Date());
channelPictureMapper.update(picture, queryWrapper); channelPictureMapper.update(picture, queryWrapper);
} }
}catch (Exception e){ } catch (Exception e) {
log.info( "[monitor-capture] " +channelCode + " 截图图片失败 " + e.getMessage()); log.info("[monitor-capture] " + channelCode + " 截图图片失败 " + e.getMessage());
} }
}); });
log.info("[monitor-capture]: end capture"); log.info("[monitor-capture]: end capture");
}catch (Exception exception){ } catch (Exception exception) {
exception.printStackTrace(); exception.printStackTrace();
} }
} }
@ -398,15 +398,15 @@ public class MonitorService{
picture.setPicUrl(picUrl); picture.setPicUrl(picUrl);
picture.setInsertTime(new Date()); picture.setInsertTime(new Date());
channelPictureMapper.insert(picture); channelPictureMapper.insert(picture);
}catch (Exception e){ } catch (Exception e) {
log.info( "[monitor-capture] " +channelCode + " 截图图片失败 " + e.getMessage()); log.info("[monitor-capture] " + channelCode + " 截图图片失败 " + e.getMessage());
TestCode testCode = new TestCode(); TestCode testCode = new TestCode();
testCode.setChannelCode(channelCode); testCode.setChannelCode(channelCode);
testCodeMapper.insert(testCode); testCodeMapper.insert(testCode);
} }
}); });
log.info("[monitor-capture]: end capture"); log.info("[monitor-capture]: end capture");
}catch (Exception exception){ } catch (Exception exception) {
exception.printStackTrace(); exception.printStackTrace();
} }
} }
@ -414,7 +414,7 @@ public class MonitorService{
/** /**
* 海水浴场人群图片算法识别 * 海水浴场人群图片算法识别
*/ */
public void bathingBeach () { public void bathingBeach() {
try { try {
log.info("[monitor-capture]: start capture"); log.info("[monitor-capture]: start capture");
@ -438,17 +438,17 @@ public class MonitorService{
personImage.put("img_base64", imgBase64); personImage.put("img_base64", imgBase64);
ResponseEntity<HashMap> responseEntity = restTemplate.postForEntity(personNumUrl, personImage, HashMap.class); ResponseEntity<HashMap> responseEntity = restTemplate.postForEntity(personNumUrl, personImage, HashMap.class);
HashMap body = responseEntity.getBody(); HashMap body = responseEntity.getBody();
if (body != null && (Integer) body.get("code") == 200){ if (body != null && (Integer) body.get("code") == 200) {
Map data = (Map) body.get("data"); Map data = (Map) body.get("data");
log.info(picUrl); log.info(picUrl);
log.info("人流识别算法" + data); log.info("人流识别算法" + data);
} }
}catch (Exception e){ } catch (Exception e) {
log.info( "[monitor-capture] " +channelCode + " 截图图片失败 " + e.getMessage()); log.info("[monitor-capture] " + channelCode + " 截图图片失败 " + e.getMessage());
} }
}); });
log.info("[monitor-capture]: end capture"); log.info("[monitor-capture]: end capture");
}catch (Exception exception){ } catch (Exception exception) {
exception.printStackTrace(); exception.printStackTrace();
} }
} }
@ -480,7 +480,7 @@ public class MonitorService{
personImage.put("img_base64", imgBase64); personImage.put("img_base64", imgBase64);
ResponseEntity<HashMap> responseEntity = restTemplate.postForEntity(personNumUrl, personImage, HashMap.class); ResponseEntity<HashMap> responseEntity = restTemplate.postForEntity(personNumUrl, personImage, HashMap.class);
HashMap body = responseEntity.getBody(); HashMap body = responseEntity.getBody();
if (body != null && (Integer) body.get("code") == 200){ if (body != null && (Integer) body.get("code") == 200) {
Map data = (Map) body.get("data"); Map data = (Map) body.get("data");
Integer personNum = (Integer) data.get("person_num"); Integer personNum = (Integer) data.get("person_num");
PeopleRecognize peopleRecognize = new PeopleRecognize(); PeopleRecognize peopleRecognize = new PeopleRecognize();
@ -488,21 +488,21 @@ public class MonitorService{
peopleRecognize.setChannelName(label.getChannelName()); peopleRecognize.setChannelName(label.getChannelName());
peopleRecognize.setPicUrl(picUrl); peopleRecognize.setPicUrl(picUrl);
peopleRecognize.setPersonNum(personNum); peopleRecognize.setPersonNum(personNum);
if (channelCode == null){ if (channelCode == null) {
peopleRecognizeMapper.insert(peopleRecognize); peopleRecognizeMapper.insert(peopleRecognize);
}else { } else {
QueryWrapper<PeopleRecognize> queryWrapper = new QueryWrapper<>(); QueryWrapper<PeopleRecognize> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("channel_code", channelCode); queryWrapper.eq("channel_code", channelCode);
peopleRecognize.setInsertTime(new Date()); peopleRecognize.setInsertTime(new Date());
peopleRecognizeMapper.update(peopleRecognize, queryWrapper); peopleRecognizeMapper.update(peopleRecognize, queryWrapper);
} }
} }
}catch (Exception e){ } catch (Exception e) {
log.info( "[monitor-capture] " +channelCode + " 截图图片失败 " + e.getMessage()); log.info("[monitor-capture] " + channelCode + " 截图图片失败 " + e.getMessage());
} }
}); });
log.info("[monitor-capture]: end capture"); log.info("[monitor-capture]: end capture");
}catch (Exception exception){ } catch (Exception exception) {
exception.printStackTrace(); exception.printStackTrace();
} }
} }
@ -539,7 +539,7 @@ public class MonitorService{
personImage.put("img_base64", imgBase64); personImage.put("img_base64", imgBase64);
ResponseEntity<HashMap> responseEntity = restTemplate.postForEntity(personNumUrl, personImage, HashMap.class); ResponseEntity<HashMap> responseEntity = restTemplate.postForEntity(personNumUrl, personImage, HashMap.class);
HashMap body = responseEntity.getBody(); HashMap body = responseEntity.getBody();
if (body != null && (Integer) body.get("code") == 200){ if (body != null && (Integer) body.get("code") == 200) {
Map data = (Map) body.get("data"); Map data = (Map) body.get("data");
Integer personNum = (Integer) data.get("person_num"); Integer personNum = (Integer) data.get("person_num");
CameraScenic cameraScenic = new CameraScenic(); CameraScenic cameraScenic = new CameraScenic();
@ -547,33 +547,33 @@ public class MonitorService{
cameraScenic.setPersonNum(personNum); cameraScenic.setPersonNum(personNum);
CameraScenic cs = cameraScenicMapper.selectById(cameraCode); CameraScenic cs = cameraScenicMapper.selectById(cameraCode);
if (cs == null){ if (cs == null) {
cameraScenicMapper.insert(cameraScenic); cameraScenicMapper.insert(cameraScenic);
}else { } else {
cameraScenicMapper.updateById(cameraScenic); cameraScenicMapper.updateById(cameraScenic);
} }
} }
} } catch (Exception e) {
catch (Exception e){
log.info( "[monitor-capture] " +cameraCode + " 人流识别失败 " + e.getMessage()); log.info("[monitor-capture] " + cameraCode + " 人流识别失败 " + e.getMessage());
} }
}); });
log.info("[monitor-capture]: startScenic end capture"); log.info("[monitor-capture]: startScenic end capture");
}catch (Exception exception){ } catch (Exception exception) {
exception.printStackTrace(); exception.printStackTrace();
} }
} }
private BufferedImage capturecreenshot(String code) throws IOException { private BufferedImage capturecreenshot(String code) throws IOException {
String url = monitorDomain + "/videoService/realmonitor/uri?scheme=HLS&channelId=" + code; String url = monitorDomain + "/videoService/realmonitor/uri?scheme=HLS&channelId=" + code;
HttpHeaders headers = new HttpHeaders(); HttpHeaders headers = new HttpHeaders();
headers.add("X-Subject-Token",token); headers.add("X-Subject-Token", token);
ResponseEntity<HashMap> forEntity = restTemplate.exchange(url, HttpMethod.GET, new HttpEntity(headers), HashMap.class ); ResponseEntity<HashMap> forEntity = restTemplate.exchange(url, HttpMethod.GET, new HttpEntity(headers), HashMap.class);
HashMap body = forEntity.getBody(); HashMap body = forEntity.getBody();
@ -593,7 +593,7 @@ public class MonitorService{
int frameIndex = 60; int frameIndex = 60;
Java2DFrameConverter converter = new Java2DFrameConverter(); Java2DFrameConverter converter = new Java2DFrameConverter();
while (true){ while (true) {
Frame frame = grabber.grabImage(); Frame frame = grabber.grabImage();
if (frame != null) { if (frame != null) {
log.debug("grabber 跳帧:" + frameIndex); log.debug("grabber 跳帧:" + frameIndex);
@ -602,9 +602,9 @@ public class MonitorService{
return bufferedImage; return bufferedImage;
} }
} }
}catch (Exception e){ } catch (Exception e) {
throw e; throw e;
}finally { } finally {
grabber.stop(); grabber.stop();
grabber.release(); grabber.release();
} }
@ -612,19 +612,20 @@ public class MonitorService{
/** /**
* 获取路径返回给前端 * 获取路径返回给前端
*
* @param code * @param code
* @return * @return
* @throws IOException * @throws IOException
*/ */
public String fileCode(String code)throws IOException{ public String fileCode(String code) throws IOException {
String url = monitorDomain + "/videoService/realmonitor/uri?scheme=HLS&channelId=" + code; String url = monitorDomain + "/videoService/realmonitor/uri?scheme=HLS&channelId=" + code;
HttpHeaders headers = new HttpHeaders(); HttpHeaders headers = new HttpHeaders();
headers.add("X-Subject-Token",token); headers.add("X-Subject-Token", token);
System.out.println(token); System.out.println(token);
ResponseEntity<HashMap> forEntity = restTemplate.exchange(url, HttpMethod.GET, new HttpEntity(headers), HashMap.class ); ResponseEntity<HashMap> forEntity = restTemplate.exchange(url, HttpMethod.GET, new HttpEntity(headers), HashMap.class);
HashMap body = forEntity.getBody(); HashMap body = forEntity.getBody();
@ -639,6 +640,7 @@ public class MonitorService{
/** /**
* 调用接口获取摄像头和组织 * 调用接口获取摄像头和组织
*
* @param parentId * @param parentId
* @param path * @param path
* @throws IOException * @throws IOException
@ -650,17 +652,17 @@ public class MonitorService{
HttpHeaders headers = new HttpHeaders(); HttpHeaders headers = new HttpHeaders();
headers.add("X-Subject-Token",token); headers.add("X-Subject-Token", token);
ResponseEntity<List> forEntity = null; ResponseEntity<List> forEntity = null;
for (int i = 0; i < 10; i++) { for (int i = 0; i < 10; i++) {
try { try {
forEntity = restTemplate.exchange(url, HttpMethod.GET, new HttpEntity(headers), List.class ); forEntity = restTemplate.exchange(url, HttpMethod.GET, new HttpEntity(headers), List.class);
break; break;
}catch (Exception e){ } catch (Exception e) {
log.error("重试次数:{} url:{}",i,url); log.error("重试次数:{} url:{}", i, url);
log.error(e); log.error(e);
Thread.sleep(5*1000); Thread.sleep(5 * 1000);
} }
} }
@ -673,17 +675,17 @@ public class MonitorService{
for (Map result : results) { for (Map result : results) {
Boolean isParent = (Boolean) result.get("isParent"); Boolean isParent = (Boolean) result.get("isParent");
if (isParent){ if (isParent) {
CameraOrganization cameraOrganization = JSONObject.parseObject(JSONObject.toJSONString(result), CameraOrganization.class); CameraOrganization cameraOrganization = JSONObject.parseObject(JSONObject.toJSONString(result), CameraOrganization.class);
cameraOrgenMapper.insert(cameraOrganization); cameraOrgenMapper.insert(cameraOrganization);
videoService((String) result.get("id"),path + sep + result.get("name")); videoService((String) result.get("id"), path + sep + result.get("name"));
}else { } else {
if (result.get("channelId") != null){ if (result.get("channelId") != null) {
CameraChannel cameraChannel = JSONObject.parseObject(JSONObject.toJSONString(result), CameraChannel.class); CameraChannel cameraChannel = JSONObject.parseObject(JSONObject.toJSONString(result), CameraChannel.class);
String id = (String)result.get("orgCode"); String id = (String) result.get("orgCode");
if (path != null && path.startsWith(sep)) { if (path != null && path.startsWith(sep)) {
path = path.substring(sep.length()); path = path.substring(sep.length());
@ -701,67 +703,67 @@ public class MonitorService{
} }
//查询视频点播巡检结果 //查询视频点播巡检结果
@Scheduled(cron="0 5 6 * * ?") @Scheduled(cron = "0 5 6 * * ?")
public Result listChannelPlayStates(){ public Result listChannelPlayStates() {
//获取当前时间和前一天的UTC时间 //获取当前时间和前一天的UTC时间
Map<String,Object> condition = new HashMap<>(); Map<String, Object> condition = new HashMap<>();
ZonedDateTime endUTC = ZonedDateTime.now(ZoneOffset.UTC); ZonedDateTime endUTC = ZonedDateTime.now(ZoneOffset.UTC);
ZonedDateTime startUTC = endUTC.minusDays(90); ZonedDateTime startUTC = endUTC.minusDays(90);
DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyyMMdd'T'HHmmss'Z'"); DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyyMMdd'T'HHmmss'Z'");
condition.put("checkStatus",0); condition.put("checkStatus", 0);
condition.put("startTime",dateTimeFormatter.format(startUTC)); condition.put("startTime", dateTimeFormatter.format(startUTC));
condition.put("endTime",dateTimeFormatter.format(endUTC)); condition.put("endTime", dateTimeFormatter.format(endUTC));
//组装查询条件经过验证pageSize设置过大也没效果最大512 //组装查询条件经过验证pageSize设置过大也没效果最大512
Map<String,Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
map.put("condition",condition); map.put("condition", condition);
map.put("page",1); map.put("page", 1);
map.put("pageSize",500);//最多一次512条 map.put("pageSize", 500);//最多一次512条
//查询路径和请求头信息 //查询路径和请求头信息
String url = monitorDomain + "/nms/api/channel/play/list"; String url = monitorDomain + "/nms/api/channel/play/list";
HttpHeaders headers = new HttpHeaders(); HttpHeaders headers = new HttpHeaders();
headers.add("X-Subject-Token",token); headers.add("X-Subject-Token", token);
//查询数据的页数 //查询数据的页数
int pageCount = 0; int pageCount = 0;
//查询结果 //查询结果
List<Map> list = new ArrayList<>(); List<Map> list = new ArrayList<>();
HttpEntity<Map<String,Object>> request = new HttpEntity<>(map,headers); HttpEntity<Map<String, Object>> request = new HttpEntity<>(map, headers);
ResponseEntity<JSONObject> responseEntity = restTemplate.exchange(url, HttpMethod.POST, request, JSONObject.class ); ResponseEntity<JSONObject> responseEntity = restTemplate.exchange(url, HttpMethod.POST, request, JSONObject.class);
JSONObject entityBody = responseEntity.getBody(); JSONObject entityBody = responseEntity.getBody();
if (entityBody.get("i18n") != null && entityBody.get("i18n").toString() == "error"){ if (entityBody.get("i18n") != null && entityBody.get("i18n").toString() == "error") {
log.info("{}程序异常{}",entityBody.get("message").toString()); log.info("{}程序异常{}", entityBody.get("message").toString());
} }
List<Map> results = (List<Map>) entityBody.get("results"); List<Map> results = (List<Map>) entityBody.get("results");
if(!results.isEmpty()){ if (!results.isEmpty()) {
list.addAll(results); list.addAll(results);
pageCount = entityBody.getIntValue("totalCount")/500 + 1; pageCount = entityBody.getIntValue("totalCount") / 500 + 1;
} }
for(int i = 2;i<=pageCount;i++){ for (int i = 2; i <= pageCount; i++) {
map.put("page",i); map.put("page", i);
HttpEntity<Map<String,Object>> request2 = new HttpEntity<>(map,headers); HttpEntity<Map<String, Object>> request2 = new HttpEntity<>(map, headers);
ResponseEntity<JSONObject> responseEntity2 = restTemplate.exchange(url, HttpMethod.POST, request2, JSONObject.class ); ResponseEntity<JSONObject> responseEntity2 = restTemplate.exchange(url, HttpMethod.POST, request2, JSONObject.class);
JSONObject entityBody2 = responseEntity2.getBody(); JSONObject entityBody2 = responseEntity2.getBody();
List<Map> results2 = (List<Map>) entityBody2.get("results"); List<Map> results2 = (List<Map>) entityBody2.get("results");
log.info("循环次数:" + i); log.info("循环次数:" + i);
if(!results2.isEmpty()){ if (!results2.isEmpty()) {
list.addAll(results); list.addAll(results);
} }
} }
//通过set对channel_code去重 //通过set对channel_code去重
Set<String> set = new HashSet<>(); Set<String> set = new HashSet<>();
for(Map m:list){ for (Map m : list) {
set.add(m.get("channelCode").toString()); set.add(m.get("channelCode").toString());
} }
List<String> lists = new ArrayList<>(set.size()); List<String> lists = new ArrayList<>(set.size());
lists.addAll(set); lists.addAll(set);
//根据channel_code对t_camera_channel表的status字段进行更新0 //根据channel_code对t_camera_channel表的status字段进行更新0
List<List<String>> listMap = Lists.partition(lists,100); List<List<String>> listMap = Lists.partition(lists, 100);
for(List<String> ll:listMap){ for (List<String> ll : listMap) {
cameraChannelMapper.updateCameraStatus(ll); cameraChannelMapper.updateCameraStatus(ll);
} }
log.info("{} 查询视频点播巡检成功,发现异常数量:{}",LocalDateTime.now(),set.size()); log.info("{} 查询视频点播巡检成功,发现异常数量:{}", LocalDateTime.now(), set.size());
return Result.success(); return Result.success();
} }
@ -788,25 +790,26 @@ public class MonitorService{
picture.setPicUrl(picUrl); picture.setPicUrl(picUrl);
/*picture.setInsertTime(new Date()); /*picture.setInsertTime(new Date());
channelPictureMapper.insert(picture);*/ channelPictureMapper.insert(picture);*/
if (channelCode == null){ if (channelCode == null) {
channelPictureMapper.insert(picture); channelPictureMapper.insert(picture);
}else { } else {
QueryWrapper<ChannelPicture> queryWrapper = new QueryWrapper<>(); QueryWrapper<ChannelPicture> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("channel_code", channelCode); queryWrapper.eq("channel_code", channelCode);
picture.setInsertTime(new Date()); picture.setInsertTime(new Date());
channelPictureMapper.update(picture, queryWrapper); channelPictureMapper.update(picture, queryWrapper);
} }
}catch (Exception e){ } catch (Exception e) {
log.info( "[monitor-capture] " +channelCode + " 截图图片失败 " + e.getMessage()); log.info("[monitor-capture] " + channelCode + " 截图图片失败 " + e.getMessage());
} }
}); });
log.info("[monitor-capture]: end capture1"); log.info("[monitor-capture]: end capture1");
}catch (Exception exception){ } catch (Exception exception) {
exception.printStackTrace(); exception.printStackTrace();
} }
} }
/** /**
* 特定摊点8:50抓图 * 特定摊点8:50抓图
*/ */
@ -830,25 +833,26 @@ public class MonitorService{
picture.setPicUrl(picUrl); picture.setPicUrl(picUrl);
/*picture.setInsertTime(new Date()); /*picture.setInsertTime(new Date());
channelPictureMapper.insert(picture);*/ channelPictureMapper.insert(picture);*/
if (channelCode == null){ if (channelCode == null) {
channelPictureMapper.insert(picture); channelPictureMapper.insert(picture);
}else { } else {
QueryWrapper<ChannelPicture> queryWrapper = new QueryWrapper<>(); QueryWrapper<ChannelPicture> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("channel_code", channelCode); queryWrapper.eq("channel_code", channelCode);
picture.setInsertTime(new Date()); picture.setInsertTime(new Date());
channelPictureMapper.update(picture, queryWrapper); channelPictureMapper.update(picture, queryWrapper);
} }
}catch (Exception e){ } catch (Exception e) {
log.info( "[monitor-capture] " +channelCode + " 截图图片失败 " + e.getMessage()); log.info("[monitor-capture] " + channelCode + " 截图图片失败 " + e.getMessage());
} }
}); });
log.info("[monitor-capture]: end capture1"); log.info("[monitor-capture]: end capture1");
}catch (Exception exception){ } catch (Exception exception) {
exception.printStackTrace(); exception.printStackTrace();
} }
} }
/** /**
* 特定摊点9:50抓图 * 特定摊点9:50抓图
*/ */
@ -872,25 +876,26 @@ public class MonitorService{
picture.setPicUrl(picUrl); picture.setPicUrl(picUrl);
/*picture.setInsertTime(new Date()); /*picture.setInsertTime(new Date());
channelPictureMapper.insert(picture);*/ channelPictureMapper.insert(picture);*/
if (channelCode == null){ if (channelCode == null) {
channelPictureMapper.insert(picture); channelPictureMapper.insert(picture);
}else { } else {
QueryWrapper<ChannelPicture> queryWrapper = new QueryWrapper<>(); QueryWrapper<ChannelPicture> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("channel_code", channelCode); queryWrapper.eq("channel_code", channelCode);
picture.setInsertTime(new Date()); picture.setInsertTime(new Date());
channelPictureMapper.update(picture, queryWrapper); channelPictureMapper.update(picture, queryWrapper);
} }
}catch (Exception e){ } catch (Exception e) {
log.info( "[monitor-capture] " +channelCode + " 截图图片失败 " + e.getMessage()); log.info("[monitor-capture] " + channelCode + " 截图图片失败 " + e.getMessage());
} }
}); });
log.info("[monitor-capture]: end capture1"); log.info("[monitor-capture]: end capture1");
}catch (Exception exception){ } catch (Exception exception) {
exception.printStackTrace(); exception.printStackTrace();
} }
} }
/** /**
* 特定摊点9:20抓图 * 特定摊点9:20抓图
*/ */
@ -914,25 +919,26 @@ public class MonitorService{
picture.setPicUrl(picUrl); picture.setPicUrl(picUrl);
/*picture.setInsertTime(new Date()); /*picture.setInsertTime(new Date());
channelPictureMapper.insert(picture);*/ channelPictureMapper.insert(picture);*/
if (channelCode == null){ if (channelCode == null) {
channelPictureMapper.insert(picture); channelPictureMapper.insert(picture);
}else { } else {
QueryWrapper<ChannelPicture> queryWrapper = new QueryWrapper<>(); QueryWrapper<ChannelPicture> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("channel_code", channelCode); queryWrapper.eq("channel_code", channelCode);
picture.setInsertTime(new Date()); picture.setInsertTime(new Date());
channelPictureMapper.update(picture, queryWrapper); channelPictureMapper.update(picture, queryWrapper);
} }
}catch (Exception e){ } catch (Exception e) {
log.info( "[monitor-capture] " +channelCode + " 截图图片失败 " + e.getMessage()); log.info("[monitor-capture] " + channelCode + " 截图图片失败 " + e.getMessage());
} }
}); });
log.info("[monitor-capture]: end capture1"); log.info("[monitor-capture]: end capture1");
}catch (Exception exception){ } catch (Exception exception) {
exception.printStackTrace(); exception.printStackTrace();
} }
} }
/** /**
* 特定摊点11:20抓图 * 特定摊点11:20抓图
*/ */
@ -956,25 +962,26 @@ public class MonitorService{
picture.setPicUrl(picUrl); picture.setPicUrl(picUrl);
/*picture.setInsertTime(new Date()); /*picture.setInsertTime(new Date());
channelPictureMapper.insert(picture);*/ channelPictureMapper.insert(picture);*/
if (channelCode == null){ if (channelCode == null) {
channelPictureMapper.insert(picture); channelPictureMapper.insert(picture);
}else { } else {
QueryWrapper<ChannelPicture> queryWrapper = new QueryWrapper<>(); QueryWrapper<ChannelPicture> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("channel_code", channelCode); queryWrapper.eq("channel_code", channelCode);
picture.setInsertTime(new Date()); picture.setInsertTime(new Date());
channelPictureMapper.update(picture, queryWrapper); channelPictureMapper.update(picture, queryWrapper);
} }
}catch (Exception e){ } catch (Exception e) {
log.info( "[monitor-capture] " +channelCode + " 截图图片失败 " + e.getMessage()); log.info("[monitor-capture] " + channelCode + " 截图图片失败 " + e.getMessage());
} }
}); });
log.info("[monitor-capture]: end capture1"); log.info("[monitor-capture]: end capture1");
}catch (Exception exception){ } catch (Exception exception) {
exception.printStackTrace(); exception.printStackTrace();
} }
} }
/** /**
* 特定摊点12:20抓图 * 特定摊点12:20抓图
*/ */
@ -998,25 +1005,26 @@ public class MonitorService{
picture.setPicUrl(picUrl); picture.setPicUrl(picUrl);
/*picture.setInsertTime(new Date()); /*picture.setInsertTime(new Date());
channelPictureMapper.insert(picture);*/ channelPictureMapper.insert(picture);*/
if (channelCode == null){ if (channelCode == null) {
channelPictureMapper.insert(picture); channelPictureMapper.insert(picture);
}else { } else {
QueryWrapper<ChannelPicture> queryWrapper = new QueryWrapper<>(); QueryWrapper<ChannelPicture> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("channel_code", channelCode); queryWrapper.eq("channel_code", channelCode);
picture.setInsertTime(new Date()); picture.setInsertTime(new Date());
channelPictureMapper.update(picture, queryWrapper); channelPictureMapper.update(picture, queryWrapper);
} }
}catch (Exception e){ } catch (Exception e) {
log.info( "[monitor-capture] " +channelCode + " 截图图片失败 " + e.getMessage()); log.info("[monitor-capture] " + channelCode + " 截图图片失败 " + e.getMessage());
} }
}); });
log.info("[monitor-capture]: end capture1"); log.info("[monitor-capture]: end capture1");
}catch (Exception exception){ } catch (Exception exception) {
exception.printStackTrace(); exception.printStackTrace();
} }
} }
/** /**
* 特定摊点19:20抓图 * 特定摊点19:20抓图
*/ */
@ -1040,25 +1048,26 @@ public class MonitorService{
picture.setPicUrl(picUrl); picture.setPicUrl(picUrl);
/*picture.setInsertTime(new Date()); /*picture.setInsertTime(new Date());
channelPictureMapper.insert(picture);*/ channelPictureMapper.insert(picture);*/
if (channelCode == null){ if (channelCode == null) {
channelPictureMapper.insert(picture); channelPictureMapper.insert(picture);
}else { } else {
QueryWrapper<ChannelPicture> queryWrapper = new QueryWrapper<>(); QueryWrapper<ChannelPicture> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("channel_code", channelCode); queryWrapper.eq("channel_code", channelCode);
picture.setInsertTime(new Date()); picture.setInsertTime(new Date());
channelPictureMapper.update(picture, queryWrapper); channelPictureMapper.update(picture, queryWrapper);
} }
}catch (Exception e){ } catch (Exception e) {
log.info( "[monitor-capture] " +channelCode + " 截图图片失败 " + e.getMessage()); log.info("[monitor-capture] " + channelCode + " 截图图片失败 " + e.getMessage());
} }
}); });
log.info("[monitor-capture]: end capture1"); log.info("[monitor-capture]: end capture1");
}catch (Exception exception){ } catch (Exception exception) {
exception.printStackTrace(); exception.printStackTrace();
} }
} }
/** /**
* 特定摊点20:20抓图 * 特定摊点20:20抓图
*/ */
@ -1082,22 +1091,22 @@ public class MonitorService{
picture.setPicUrl(picUrl); picture.setPicUrl(picUrl);
/*picture.setInsertTime(new Date()); /*picture.setInsertTime(new Date());
channelPictureMapper.insert(picture);*/ channelPictureMapper.insert(picture);*/
if (channelCode == null){ if (channelCode == null) {
channelPictureMapper.insert(picture); channelPictureMapper.insert(picture);
}else { } else {
QueryWrapper<ChannelPicture> queryWrapper = new QueryWrapper<>(); QueryWrapper<ChannelPicture> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("channel_code", channelCode); queryWrapper.eq("channel_code", channelCode);
picture.setInsertTime(new Date()); picture.setInsertTime(new Date());
channelPictureMapper.update(picture, queryWrapper); channelPictureMapper.update(picture, queryWrapper);
} }
}catch (Exception e){ } catch (Exception e) {
log.info( "[monitor-capture] " +channelCode + " 截图图片失败 " + e.getMessage()); log.info("[monitor-capture] " + channelCode + " 截图图片失败 " + e.getMessage());
} }
}); });
log.info("[monitor-capture]: end capture1"); log.info("[monitor-capture]: end capture1");
}catch (Exception exception){ } catch (Exception exception) {
exception.printStackTrace(); exception.printStackTrace();
} }
} }
@ -1123,12 +1132,12 @@ public class MonitorService{
QueryWrapper<WCamera> queryWrapper1 = new QueryWrapper<>(); QueryWrapper<WCamera> queryWrapper1 = new QueryWrapper<>();
queryWrapper1.eq("channel_code", channelCode); queryWrapper1.eq("channel_code", channelCode);
wCameraMapper.update(wCamera, queryWrapper1); wCameraMapper.update(wCamera, queryWrapper1);
}catch (Exception e){ } catch (Exception e) {
log.info( "[monitor-capture] " +channelCode + " 截图图片失败 " + e.getMessage()); log.info("[monitor-capture] " + channelCode + " 截图图片失败 " + e.getMessage());
} }
}); });
log.info("[monitor-capture]: end capture"); log.info("[monitor-capture]: end capture");
}catch (Exception exception){ } catch (Exception exception) {
exception.printStackTrace(); exception.printStackTrace();
} }
} }

View File

@ -53,12 +53,13 @@ public class PassengerFlowService {
/** /**
* 最新的实时客流 * 最新的实时客流
*
* @param * @param
* @return List * @return List
*/ */
//{"APIKEY":"202204141052331249fcc8-046","ParamJson":{"data":"{\"appId\":\"apitest\",\"mac\":\"f51093001255129b88deba6c5045ee26\",\"timeStamp\":\"20220510152759\",\"hourId\":\"2022051013\",\"timeId\":\"202205101300\"}"}} //{"APIKEY":"202204141052331249fcc8-046","ParamJson":{"data":"{\"appId\":\"apitest\",\"mac\":\"f51093001255129b88deba6c5045ee26\",\"timeStamp\":\"20220510152759\",\"hourId\":\"2022051013\",\"timeId\":\"202205101300\"}"}}
public List<Map> passengerFlow(){ public List<Map> passengerFlow() {
Map<String,Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
DateTimeFormatter dateTimeFormatter1 = DateTimeFormatter.ofPattern("yyyyMMddHHmmss"); DateTimeFormatter dateTimeFormatter1 = DateTimeFormatter.ofPattern("yyyyMMddHHmmss");
LocalDateTime dateNow = LocalDateTime.now(); LocalDateTime dateNow = LocalDateTime.now();
@ -66,206 +67,211 @@ public class PassengerFlowService {
String[] tt = this.newMinusMinutesStr(dateNow); String[] tt = this.newMinusMinutesStr(dateNow);
String url = "http://15.72.158.72:8081/getway/api/Proxy/HandleByKey/1249fcc8-0466-4897-87b4-d2111a9baf4f"; String url = "http://15.72.158.72:8081/getway/api/Proxy/HandleByKey/1249fcc8-0466-4897-87b4-d2111a9baf4f";
map.put("APIKEY",APIKEY); map.put("APIKEY", APIKEY);
JSONObject jsonObject = new JSONObject(); JSONObject jsonObject = new JSONObject();
jsonObject.put("appId",appId); jsonObject.put("appId", appId);
//安全认证 MD5(appId+-+timeStamp+-+ appSecret) //安全认证 MD5(appId+-+timeStamp+-+ appSecret)
String code = appId+"-"+timeStamp+"-"+ appSecret; String code = appId + "-" + timeStamp + "-" + appSecret;
String md5Str = DigestUtils.md5DigestAsHex(code.getBytes(StandardCharsets.UTF_8)); String md5Str = DigestUtils.md5DigestAsHex(code.getBytes(StandardCharsets.UTF_8));
jsonObject.put("mac",md5Str); jsonObject.put("mac", md5Str);
jsonObject.put("timeStamp",timeStamp); jsonObject.put("timeStamp", timeStamp);
jsonObject.put("hourId",tt[1]); jsonObject.put("hourId", tt[1]);
jsonObject.put("timeId",tt[0]); jsonObject.put("timeId", tt[0]);
JSONObject para = new JSONObject(); JSONObject para = new JSONObject();
para.put("data",JSONObject.toJSONString(jsonObject)); para.put("data", JSONObject.toJSONString(jsonObject));
map.put("ParamJson",para); map.put("ParamJson", para);
System.out.println("multimap->"+map.toString()); System.out.println("multimap->" + map.toString());
log.info("[passengerFlow] ->",map.toString()); log.info("[passengerFlow] ->", map.toString());
ResponseEntity<String> responseEntity; ResponseEntity<String> responseEntity;
List<Map> list = new ArrayList<>(); List<Map> list = new ArrayList<>();
try{ try {
responseEntity = restTemplate.postForEntity(url,map,String.class); responseEntity = restTemplate.postForEntity(url, map, String.class);
if(responseEntity.getStatusCodeValue() == 200){ if (responseEntity.getStatusCodeValue() == 200) {
String result = responseEntity.getBody(); String result = responseEntity.getBody();
JSONObject jsonResult = JSONObject.parseObject(result); JSONObject jsonResult = JSONObject.parseObject(result);
System.out.println(jsonResult.keySet().toString()); System.out.println(jsonResult.keySet().toString());
if(jsonResult.getIntValue("code") == 0){ if (jsonResult.getIntValue("code") == 0) {
JSONArray jsonArray = jsonResult.getJSONArray("result"); JSONArray jsonArray = jsonResult.getJSONArray("result");
list = JSONObject.parseArray(JSONObject.toJSONString(jsonArray),Map.class); list = JSONObject.parseArray(JSONObject.toJSONString(jsonArray), Map.class);
} }
} }
} catch (Exception e){ } catch (Exception e) {
log.error("[passengerFlow] Exception:"+e.getMessage()); log.error("[passengerFlow] Exception:" + e.getMessage());
} }
return list; return list;
} }
//从表中获取最新的实时客流 //从表中获取最新的实时客流
public List<PassengerFlow> listPassengerFlow(String timeId){ public List<PassengerFlow> listPassengerFlow(String timeId) {
List<PassengerFlow> lists = new ArrayList<>(); List<PassengerFlow> lists = new ArrayList<>();
long longTimeId = Long.valueOf(timeId); long longTimeId = Long.valueOf(timeId);
if(longTimeId == 1970000000){ if (longTimeId == 1970000000) {
PassengerFlow passengerFlow = passengerFlowMapper.getByMaxId(); PassengerFlow passengerFlow = passengerFlowMapper.getByMaxId();
timeId = passengerFlow.getTimeId(); timeId = passengerFlow.getTimeId();
} }
QueryWrapper<PassengerFlow> wrapper = new QueryWrapper<>(); QueryWrapper<PassengerFlow> wrapper = new QueryWrapper<>();
wrapper.eq("time_id",timeId); wrapper.eq("time_id", timeId);
lists = passengerFlowMapper.selectList(wrapper); lists = passengerFlowMapper.selectList(wrapper);
return lists; return lists;
} }
//从表中获取获取最新的实时客流并筛选出all_nums>=5000,并desc排序 //从表中获取获取最新的实时客流并筛选出all_nums>=5000,并desc排序
public List<PassengerFlow> listPassengerFlowByAllNums(){ public List<PassengerFlow> listPassengerFlowByAllNums() {
List<PassengerFlow> lists = new ArrayList<>(); List<PassengerFlow> lists = new ArrayList<>();
String timeId = passengerFlowMapper.getByMaxId().getTimeId(); String timeId = passengerFlowMapper.getByMaxId().getTimeId();
QueryWrapper<PassengerFlow> wrapper = new QueryWrapper<>(); QueryWrapper<PassengerFlow> wrapper = new QueryWrapper<>();
wrapper.eq("time_id",timeId).ge("all_nums",5000).orderByDesc("all_nums"); wrapper.eq("time_id", timeId).ge("all_nums", 5000).orderByDesc("all_nums");
lists = passengerFlowMapper.selectList(wrapper); lists = passengerFlowMapper.selectList(wrapper);
return lists; return lists;
} }
@Scheduled(cron = "0 31 10-22/1 * * ? ") @Scheduled(cron = "0 31 10-22/1 * * ? ")
//提供的接口能查到当前时间2个小时之前的数据每隔15分钟一次我们只取整点从早8点到晚8点的整点数据 //提供的接口能查到当前时间2个小时之前的数据每隔15分钟一次我们只取整点从早8点到晚8点的整点数据
//10:31 到晚上1031每小时的31分执行一次 //10:31 到晚上1031每小时的31分执行一次
public void passengerFlowSchedule(){ public void passengerFlowSchedule() {
if (enable){ if (enable) {
Map<String,Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
DateTimeFormatter dateTimeFormatter1 = DateTimeFormatter.ofPattern("yyyyMMddHHmmss"); DateTimeFormatter dateTimeFormatter1 = DateTimeFormatter.ofPattern("yyyyMMddHHmmss");
LocalDateTime dateNow = LocalDateTime.now(); LocalDateTime dateNow = LocalDateTime.now();
String timeStamp = dateNow.format(dateTimeFormatter1);//yyyyMMddHHmmss String timeStamp = dateNow.format(dateTimeFormatter1);//yyyyMMddHHmmss
String[] tt = this.minusMinutesStr(dateNow,120); String[] tt = this.minusMinutesStr(dateNow, 120);
String url = "http://15.72.158.72:8081/getway/api/Proxy/HandleByKey/1249fcc8-0466-4897-87b4-d2111a9baf4f"; String url = "http://15.72.158.72:8081/getway/api/Proxy/HandleByKey/1249fcc8-0466-4897-87b4-d2111a9baf4f";
map.put("APIKEY",APIKEY); map.put("APIKEY", APIKEY);
JSONObject jsonObject = new JSONObject(); JSONObject jsonObject = new JSONObject();
jsonObject.put("appId",appId); jsonObject.put("appId", appId);
//安全认证 MD5(appId+-+timeStamp+-+ appSecret) //安全认证 MD5(appId+-+timeStamp+-+ appSecret)
String code = appId+"-"+timeStamp+"-"+ appSecret; String code = appId + "-" + timeStamp + "-" + appSecret;
String md5Str = DigestUtils.md5DigestAsHex(code.getBytes(StandardCharsets.UTF_8)); String md5Str = DigestUtils.md5DigestAsHex(code.getBytes(StandardCharsets.UTF_8));
jsonObject.put("mac",md5Str); jsonObject.put("mac", md5Str);
jsonObject.put("timeStamp",timeStamp); jsonObject.put("timeStamp", timeStamp);
jsonObject.put("hourId",tt[1]); jsonObject.put("hourId", tt[1]);
jsonObject.put("timeId",tt[0]); jsonObject.put("timeId", tt[0]);
JSONObject para = new JSONObject(); JSONObject para = new JSONObject();
para.put("data",JSONObject.toJSONString(jsonObject)); para.put("data", JSONObject.toJSONString(jsonObject));
map.put("ParamJson",para); map.put("ParamJson", para);
System.out.println("multimap->"+map.toString()); System.out.println("multimap->" + map.toString());
ResponseEntity<String> responseEntity; ResponseEntity<String> responseEntity;
List<Map> list = new ArrayList<>(); List<Map> list = new ArrayList<>();
try{ try {
responseEntity = restTemplate.postForEntity(url,map,String.class); responseEntity = restTemplate.postForEntity(url, map, String.class);
if(responseEntity.getStatusCodeValue() == 200){ if (responseEntity.getStatusCodeValue() == 200) {
String result = responseEntity.getBody(); String result = responseEntity.getBody();
JSONObject jsonResult = JSONObject.parseObject(result); JSONObject jsonResult = JSONObject.parseObject(result);
System.out.println(jsonResult.keySet().toString()); System.out.println(jsonResult.keySet().toString());
if(jsonResult.getIntValue("code") == 0){ if (jsonResult.getIntValue("code") == 0) {
JSONArray jsonArray = jsonResult.getJSONArray("result"); JSONArray jsonArray = jsonResult.getJSONArray("result");
list = JSONObject.parseArray(JSONObject.toJSONString(jsonArray),Map.class); list = JSONObject.parseArray(JSONObject.toJSONString(jsonArray), Map.class);
List<List<Map>> lists = Lists.partition(list,200); List<List<Map>> lists = Lists.partition(list, 200);
lists.forEach(ll ->passengerFlowMapper.batchSave(ll)); lists.forEach(ll -> passengerFlowMapper.batchSave(ll));
} }
} }
} catch (Exception e){ } catch (Exception e) {
log.error("[passengerFlowSchedule] Exception:"+e.getMessage()); log.error("[passengerFlowSchedule] Exception:" + e.getMessage());
} }
} }
} }
//保存实时客流 //保存实时客流
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public boolean savePassengerFlow(List<Map> maps){ public boolean savePassengerFlow(List<Map> maps) {
List<List<Map>> lists = Lists.partition(maps,200); List<List<Map>> lists = Lists.partition(maps, 200);
try{ try {
lists.forEach(list ->passengerFlowMapper.batchSave(list)); lists.forEach(list -> passengerFlowMapper.batchSave(list));
return true; return true;
}catch (Exception e){ } catch (Exception e) {
log.error("[savePassengerFlow] Exception:"+e.getMessage()); log.error("[savePassengerFlow] Exception:" + e.getMessage());
return false; return false;
} }
} }
//根据半径一个经纬度和timeId查询游客总数 //根据半径一个经纬度和timeId查询游客总数
public JSONObject passengerNums(double longitude, double latitude, Integer radius,String timeId){ public JSONObject passengerNums(double longitude, double latitude, Integer radius, String timeId) {
int allCount = 0; int allCount = 0;
int localCount = 0; int localCount = 0;
int nonLocalCount = 0; int nonLocalCount = 0;
JSONObject result = new JSONObject(); JSONObject result = new JSONObject();
try{ try {
double[] around = LongLatUtil.getAround(longitude, latitude, radius); double[] around = LongLatUtil.getAround(longitude, latitude, radius);
List<PassengerFlowDto> list = passengerFlowMapper.selectPassenger(around[0], around[2], around[1], around[3],timeId); List<PassengerFlowDto> list = passengerFlowMapper.selectPassenger(around[0], around[2], around[1], around[3], timeId);
for(PassengerFlowDto p:list){ for (PassengerFlowDto p : list) {
allCount+=Integer.parseInt(p.getAllNums()); allCount += Integer.parseInt(p.getAllNums());
localCount+=Integer.parseInt(p.getLocalNums()); localCount += Integer.parseInt(p.getLocalNums());
nonLocalCount+=Integer.parseInt(p.getNonlocalNums()); nonLocalCount += Integer.parseInt(p.getNonlocalNums());
} }
result.put("local_nums",localCount); result.put("local_nums", localCount);
result.put("nonlocal_nums",nonLocalCount); result.put("nonlocal_nums", nonLocalCount);
result.put("all_nums",allCount); result.put("all_nums", allCount);
}catch (Exception e){ } catch (Exception e) {
log.error("[passengerNums] Exception:"+e.getMessage()); log.error("[passengerNums] Exception:" + e.getMessage());
return result; return result;
} }
return result; return result;
} }
//当前时间减去固定的分钟数然后分钟取30 //当前时间减去固定的分钟数然后分钟取30
private String[] minusMinutesStr(LocalDateTime datetime,long minutes){ private String[] minusMinutesStr(LocalDateTime datetime, long minutes) {
String t1,t2;//t1 yyyyMMddHHmm t2 yyyyMMddHH String t1, t2;//t1 yyyyMMddHHmm t2 yyyyMMddHH
LocalDateTime minus = datetime.minus(minutes, ChronoUnit.MINUTES); LocalDateTime minus = datetime.minus(minutes, ChronoUnit.MINUTES);
DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyyMMddHHmm"); DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyyMMddHHmm");
DateTimeFormatter dateTimeFormatter2 = DateTimeFormatter.ofPattern("yyyyMMddHH"); DateTimeFormatter dateTimeFormatter2 = DateTimeFormatter.ofPattern("yyyyMMddHH");
String time1 = minus.format(dateTimeFormatter); String time1 = minus.format(dateTimeFormatter);
System.out.println(time1); System.out.println(time1);
String mm = time1.substring(time1.length() -2,time1.length()); String mm = time1.substring(time1.length() - 2, time1.length());
System.out.println(mm); System.out.println(mm);
if(0 < Integer.parseInt(mm) &&Integer.parseInt(mm)>=30){ if (0 < Integer.parseInt(mm) && Integer.parseInt(mm) >= 30) {
t1 = time1.substring(0,time1.length() -2)+"00"; t1 = time1.substring(0, time1.length() - 2) + "00";
}else if(Integer.parseInt(mm)<30){ } else if (Integer.parseInt(mm) < 30) {
LocalDateTime lastHour = LocalDateTime.parse(time1,dateTimeFormatter).plus(1,ChronoUnit.HOURS); LocalDateTime lastHour = LocalDateTime.parse(time1, dateTimeFormatter).plus(1, ChronoUnit.HOURS);
t1 = lastHour.format(dateTimeFormatter2)+"00"; t1 = lastHour.format(dateTimeFormatter2) + "00";
}else{ } else {
t1 = time1; t1 = time1;
} }
t2 = t1.substring(0,t1.length()-2); t2 = t1.substring(0, t1.length() - 2);
System.out.println("t1->"+t1+"...t2->"+t2); System.out.println("t1->" + t1 + "...t2->" + t2);
return new String[]{t1,t2}; return new String[]{t1, t2};
} }
//查询出最新有游客数据的时间点 //查询出最新有游客数据的时间点
private String[] newMinusMinutesStr(LocalDateTime datetime){ private String[] newMinusMinutesStr(LocalDateTime datetime) {
String t1,t2;//t1 yyyyMMddHHmm t2 yyyyMMddHH String t1, t2;//t1 yyyyMMddHHmm t2 yyyyMMddHH
LocalDateTime minus = datetime.minus(125, ChronoUnit.MINUTES); LocalDateTime minus = datetime.minus(125, ChronoUnit.MINUTES);
DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyyMMddHHmm"); DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyyMMddHHmm");
DateTimeFormatter dateTimeFormatter2 = DateTimeFormatter.ofPattern("yyyyMMddHH"); DateTimeFormatter dateTimeFormatter2 = DateTimeFormatter.ofPattern("yyyyMMddHH");
String time1 = minus.format(dateTimeFormatter); String time1 = minus.format(dateTimeFormatter);
System.out.println(time1); System.out.println(time1);
String mm = time1.substring(time1.length() -2,time1.length()); String mm = time1.substring(time1.length() - 2, time1.length());
System.out.println(mm); System.out.println(mm);
Integer i = Integer.parseInt(mm)/15; Integer i = Integer.parseInt(mm) / 15;
if(i == 0){ if (i == 0) {
t1 = time1.substring(0,time1.length() -2)+"00"; t1 = time1.substring(0, time1.length() - 2) + "00";
}else{ } else {
t1 = time1.substring(0,time1.length() -2)+String.valueOf(15*i); t1 = time1.substring(0, time1.length() - 2) + String.valueOf(15 * i);
} }
t2 = t1.substring(0,t1.length()-2); t2 = t1.substring(0, t1.length() - 2);
System.out.println("t1->"+t1+"...t2->"+t2); System.out.println("t1->" + t1 + "...t2->" + t2);
return new String[]{t1,t2}; return new String[]{t1, t2};
} }
/** @param vertX polygon coordinates latitudes /**
* @param vertX polygon coordinates latitudes
* @param vertY polygon coordinates longitudes * @param vertY polygon coordinates longitudes
* @return true indicate inside of the polygon false indicate outside of the polygon * @return true indicate inside of the polygon false indicate outside of the polygon
*/ */
public Integer pnpolyAlgorithm(List<Double> vertX, List<Double> vertY,String timeId) { public Integer pnpolyAlgorithm(List<Double> vertX, List<Double> vertY, String timeId) {
List<PassengerFlow> passengerFlows = passengerFlowMapper.selectByTime(timeId); List<PassengerFlow> passengerFlows = passengerFlowMapper.selectByTime(timeId);
int people = 0; int people = 0;
for (PassengerFlow passengerFlow: passengerFlows) { for (PassengerFlow passengerFlow : passengerFlows) {
double latitude = Double.parseDouble(passengerFlow.getLatitude()); double latitude = Double.parseDouble(passengerFlow.getLatitude());
double longitude = Double.parseDouble(passengerFlow.getLongitude()); double longitude = Double.parseDouble(passengerFlow.getLongitude());
if (CollectionUtils.isEmpty(vertX) || CollectionUtils.isEmpty(vertY)) { if (CollectionUtils.isEmpty(vertX) || CollectionUtils.isEmpty(vertY)) {
@ -290,7 +296,7 @@ public class PassengerFlowService {
result = !result; result = !result;
} }
} }
if (result){ if (result) {
Integer allNums = Integer.parseInt(passengerFlow.getAllNums()); Integer allNums = Integer.parseInt(passengerFlow.getAllNums());
people += allNums; people += allNums;
} }

View File

@ -31,7 +31,7 @@ public class QidiService {
//启迪数据中台相关 //启迪数据中台相关
//1.登录 //1.登录
public String qidiToken () { public String qidiToken() {
String url = "http://120.221.95.13:9090/apin/authorization/oauth/token"; String url = "http://120.221.95.13:9090/apin/authorization/oauth/token";
HttpHeaders headers = new HttpHeaders(); HttpHeaders headers = new HttpHeaders();
headers.add("Authorization", "Basic dGVzdF9jbGllbnQ6ZTk4OWQ0NmZkYmMxYzM3NmMxOWE0M2FhZjg1MjI3YTQ="); headers.add("Authorization", "Basic dGVzdF9jbGllbnQ6ZTk4OWQ0NmZkYmMxYzM3NmMxOWE0M2FhZjg1MjI3YTQ=");
@ -62,7 +62,7 @@ public class QidiService {
} }
//渣土车轨迹数据,最新的 //渣土车轨迹数据,最新的
public List<Map> resCatalogApplyZTYS () { public List<Map> resCatalogApplyZTYS() {
String token = this.qidiToken(); String token = this.qidiToken();
HttpHeaders headers = new HttpHeaders(); HttpHeaders headers = new HttpHeaders();
headers.add("Authorization", "Bearer " + token); headers.add("Authorization", "Bearer " + token);
@ -76,7 +76,7 @@ public class QidiService {
JSONObject jsonObject = responseEntity.getBody(); JSONObject jsonObject = responseEntity.getBody();
JSONArray jsonArray = jsonObject.getJSONArray("list"); JSONArray jsonArray = jsonObject.getJSONArray("list");
log.info("[resCatalogApplyZTYS] 返回数据的数量:{}",jsonArray.size()); log.info("[resCatalogApplyZTYS] 返回数据的数量:{}", jsonArray.size());
return JSONObject.parseArray(JSONObject.toJSONString(jsonArray), Map.class); return JSONObject.parseArray(JSONObject.toJSONString(jsonArray), Map.class);
} catch (Exception e) { } catch (Exception e) {
log.info("[resCatalogApplyZTYS] exception:{}", e.getMessage()); log.info("[resCatalogApplyZTYS] exception:{}", e.getMessage());
@ -85,7 +85,7 @@ public class QidiService {
} }
//环卫车轨迹数据 //环卫车轨迹数据
public List<Map> resCatalogApplyHJWS () { public List<Map> resCatalogApplyHJWS() {
String token = this.qidiToken(); String token = this.qidiToken();
String url = "http://120.221.95.13:9090/catalog/resCatalogApply/getData/UC_QUERY_HJWS_307013400000000442_1"; String url = "http://120.221.95.13:9090/catalog/resCatalogApply/getData/UC_QUERY_HJWS_307013400000000442_1";
HttpHeaders headers = new HttpHeaders(); HttpHeaders headers = new HttpHeaders();
@ -105,18 +105,18 @@ public class QidiService {
} }
//工地信息 //工地信息
public List<Map> resCatalogApplyGDYS () { public List<Map> resCatalogApplyGDYS() {
String token = this.qidiToken(); String token = this.qidiToken();
String url = "http://120.221.95.13:9090/catalog/resCatalogApply/getData/UC_QUERY_ZTYS_307013600000000025_1"; String url = "http://120.221.95.13:9090/catalog/resCatalogApply/getData/UC_QUERY_ZTYS_307013600000000025_1";
HttpHeaders headers = new HttpHeaders(); HttpHeaders headers = new HttpHeaders();
headers.add("Authorization", "Bearer " + token); headers.add("Authorization", "Bearer " + token);
Map<String,Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
JSONObject search = new JSONObject(); JSONObject search = new JSONObject();
search.put("opt","LIKE"); search.put("opt", "LIKE");
search.put("key","updatetime"); search.put("key", "updatetime");
search.put("val",this.dateStr()); search.put("val", this.dateStr());
map.put("json",search); map.put("json", search);
HttpEntity<MultiValueMap<String, String>> request = new HttpEntity<>(null, headers); HttpEntity<MultiValueMap<String, String>> request = new HttpEntity<>(null, headers);
ResponseEntity<JSONObject> responseEntity; ResponseEntity<JSONObject> responseEntity;
@ -132,18 +132,18 @@ public class QidiService {
} }
//环卫车辆数据1基础 //环卫车辆数据1基础
public List<Map> resCatalogApplyHJWSBase () { public List<Map> resCatalogApplyHJWSBase() {
String token = this.qidiToken(); String token = this.qidiToken();
String url = "http://120.221.95.13:9090/catalog/resCatalogApply/getData/UC_QUERY_HJWS_307013400000000365_1"; String url = "http://120.221.95.13:9090/catalog/resCatalogApply/getData/UC_QUERY_HJWS_307013400000000365_1";
HttpHeaders headers = new HttpHeaders(); HttpHeaders headers = new HttpHeaders();
headers.add("Authorization", "Bearer " + token); headers.add("Authorization", "Bearer " + token);
Map<String,Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
JSONObject search = new JSONObject(); JSONObject search = new JSONObject();
search.put("opt","EQ"); search.put("opt", "EQ");
search.put("key","SSQY"); search.put("key", "SSQY");
search.put("val","胶州市"); search.put("val", "胶州市");
map.put("json",search); map.put("json", search);
HttpEntity<MultiValueMap<String, String>> request = new HttpEntity<>(null, headers); HttpEntity<MultiValueMap<String, String>> request = new HttpEntity<>(null, headers);
ResponseEntity<JSONObject> responseEntity; ResponseEntity<JSONObject> responseEntity;
@ -159,20 +159,20 @@ public class QidiService {
} }
//环卫车辆数据2,作业,5月20号已经把能查到的都保存到表中了(忘了保存updatetime) //环卫车辆数据2,作业,5月20号已经把能查到的都保存到表中了(忘了保存updatetime)
public List<Map> resCatalogApplyHJWSZY () { public List<Map> resCatalogApplyHJWSZY() {
String token = this.qidiToken(); String token = this.qidiToken();
String url = "http://120.221.95.13:9090/catalog/resCatalogApply/getData/UC_QUERY_HJWS_307013400000000363_1"; String url = "http://120.221.95.13:9090/catalog/resCatalogApply/getData/UC_QUERY_HJWS_307013400000000363_1";
HttpHeaders headers = new HttpHeaders(); HttpHeaders headers = new HttpHeaders();
headers.add("Authorization", "Bearer " + token); headers.add("Authorization", "Bearer " + token);
Map<String,Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
JSONObject search = new JSONObject(); JSONObject search = new JSONObject();
map.put("json",search); map.put("json", search);
HttpEntity<MultiValueMap<String, String>> request = new HttpEntity<>(null, headers); HttpEntity<MultiValueMap<String, String>> request = new HttpEntity<>(null, headers);
ResponseEntity<JSONObject> responseEntity; ResponseEntity<JSONObject> responseEntity;
try { try {
responseEntity = restTemplate.exchange(url, HttpMethod.GET, request, JSONObject.class,map); responseEntity = restTemplate.exchange(url, HttpMethod.GET, request, JSONObject.class, map);
JSONObject jsonObject = responseEntity.getBody(); JSONObject jsonObject = responseEntity.getBody();
JSONArray jsonArray = jsonObject.getJSONArray("list"); JSONArray jsonArray = jsonObject.getJSONArray("list");
return JSONObject.parseArray(JSONObject.toJSONString(jsonArray), Map.class); return JSONObject.parseArray(JSONObject.toJSONString(jsonArray), Map.class);
@ -182,37 +182,38 @@ public class QidiService {
} }
} }
public List<Map> resCatalogApplyHJWSZY(String updatetime) throws Exception{ public List<Map> resCatalogApplyHJWSZY(String updatetime) throws Exception {
String token = this.qidiToken(); String token = this.qidiToken();
String url = "http://120.221.95.13:9090/catalog/resCatalogApply/getData/UC_QUERY_HJWS_307013400000000363_1?search=[{json}]"; String url = "http://120.221.95.13:9090/catalog/resCatalogApply/getData/UC_QUERY_HJWS_307013400000000363_1?search=[{json}]";
HttpHeaders headers = new HttpHeaders(); HttpHeaders headers = new HttpHeaders();
headers.add("Authorization", "Bearer " + token); headers.add("Authorization", "Bearer " + token);
List<Map> maps = new ArrayList<>(); List<Map> maps = new ArrayList<>();
Map<String,Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
JSONObject search = new JSONObject(); JSONObject search = new JSONObject();
search.put("opt","GT"); search.put("opt", "GT");
search.put("key","updatetime"); search.put("key", "updatetime");
search.put("val",updatetime); search.put("val", updatetime);
map.put("json",search); map.put("json", search);
HttpEntity<MultiValueMap<String, String>> request = new HttpEntity<>(null, headers); HttpEntity<MultiValueMap<String, String>> request = new HttpEntity<>(null, headers);
ResponseEntity<JSONObject> responseEntity; ResponseEntity<JSONObject> responseEntity;
responseEntity = restTemplate.exchange(url, HttpMethod.GET, request, JSONObject.class,map); responseEntity = restTemplate.exchange(url, HttpMethod.GET, request, JSONObject.class, map);
JSONObject jsonObject = responseEntity.getBody(); JSONObject jsonObject = responseEntity.getBody();
JSONArray jsonArray = jsonObject.getJSONArray("list"); JSONArray jsonArray = jsonObject.getJSONArray("list");
maps = JSONObject.parseArray(JSONObject.toJSONString(jsonArray), Map.class); maps = JSONObject.parseArray(JSONObject.toJSONString(jsonArray), Map.class);
return maps; return maps;
} }
//环卫道路明细数据 //环卫道路明细数据
public List<Map> resCatalogApplyHJWSRoad () { public List<Map> resCatalogApplyHJWSRoad() {
String token = this.qidiToken(); String token = this.qidiToken();
String url = "http://120.221.95.13:9090/catalog/resCatalogApply/getData/UC_QUERY_HJWS_307013400000000370_2"; String url = "http://120.221.95.13:9090/catalog/resCatalogApply/getData/UC_QUERY_HJWS_307013400000000370_2";
HttpHeaders headers = new HttpHeaders(); HttpHeaders headers = new HttpHeaders();
headers.add("Authorization", "Bearer " + token); headers.add("Authorization", "Bearer " + token);
Map<String,Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
HttpEntity<MultiValueMap<String, String>> request = new HttpEntity<>(null, headers); HttpEntity<MultiValueMap<String, String>> request = new HttpEntity<>(null, headers);
ResponseEntity<JSONObject> responseEntity; ResponseEntity<JSONObject> responseEntity;
@ -226,16 +227,18 @@ public class QidiService {
return new ArrayList<>(); return new ArrayList<>();
} }
} }
//获取当前日期的时间串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();
LocalDate yestDay = localDate.minusDays(1); LocalDate yestDay = localDate.minusDays(1);
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
LocalDateTime dateTime = LocalDateTime.of(yestDay.getYear(),yestDay.getMonth(),yestDay.getDayOfMonth(),0,0,0); LocalDateTime dateTime = LocalDateTime.of(yestDay.getYear(), yestDay.getMonth(), yestDay.getDayOfMonth(), 0, 0, 0);
return dateTime.format(formatter); return dateTime.format(formatter);
} }
//获取当前日期的时间串2022-05-08 //获取当前日期的时间串2022-05-08
private String dateStr(){ private String dateStr() {
LocalDate localDate = LocalDate.now(); LocalDate localDate = LocalDate.now();
LocalDate yestDay = localDate.minusDays(1); LocalDate yestDay = localDate.minusDays(1);
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");

View File

@ -40,14 +40,14 @@ public class RoadDataService {
private RoadDataMapper roadDataMapper; private RoadDataMapper roadDataMapper;
//道路统计数据与排名调用公开接口 //道路统计数据与排名调用公开接口
public List<Map> roadData(){ public List<Map> roadData() {
String url = "http://outerdata.novaecs.com/api/qingdaoData/roadData?groupId={groupId}&timeType={timeType}&dt={dt}"; String url = "http://outerdata.novaecs.com/api/qingdaoData/roadData?groupId={groupId}&timeType={timeType}&dt={dt}";
Map<String,Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
map.put("dt",this.dateTimeStr()); map.put("dt", this.dateTimeStr());
map.put("groupId",1); map.put("groupId", 1);
map.put("timeType",""); map.put("timeType", "");
ResponseEntity<JSONObject> responseEntity; ResponseEntity<JSONObject> responseEntity;
List<Map> list = new ArrayList<>(); List<Map> list = new ArrayList<>();
@ -69,15 +69,15 @@ public class RoadDataService {
} }
//道路统计数据与排名(道路污染)调用公开接口并保存到表t_road_data //道路统计数据与排名(道路污染)调用公开接口并保存到表t_road_data
@Scheduled(cron="0 0 7 * * ?") @Scheduled(cron = "0 0 7 * * ?")
public void saveRoadData(){ public void saveRoadData() {
String url = "http://outerdata.novaecs.com/api/qingdaoData/roadData?groupId={groupId}&timeType={timeType}&dt={dt}"; String url = "http://outerdata.novaecs.com/api/qingdaoData/roadData?groupId={groupId}&timeType={timeType}&dt={dt}";
Map<String,Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
map.put("dt",this.dateTimeStr()); map.put("dt", this.dateTimeStr());
map.put("groupId",1); map.put("groupId", 1);
map.put("timeType",""); map.put("timeType", "");
ResponseEntity<JSONObject> responseEntity; ResponseEntity<JSONObject> responseEntity;
List<Map> list = new ArrayList<>(); List<Map> list = new ArrayList<>();
@ -94,36 +94,36 @@ public class RoadDataService {
} catch (Exception e) { } catch (Exception e) {
log.info("[roadData] exception:{}", e.getMessage()); log.info("[roadData] exception:{}", e.getMessage());
} }
if(list.size() > 0){ if (list.size() > 0) {
List<Map> maps = list.stream().map(l->{ List<Map> maps = list.stream().map(l -> {
l.put("points",JSONObject.toJSONString(l.get("points"))); l.put("points", JSONObject.toJSONString(l.get("points")));
l.put("dt",this.dateTimeStr()); l.put("dt", this.dateTimeStr());
return l; return l;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
List<List<Map>> lists = Lists.partition(maps,200); List<List<Map>> lists = Lists.partition(maps, 200);
lists.forEach(ll->roadDataMapper.batchSave(ll)); lists.forEach(ll -> roadDataMapper.batchSave(ll));
} }
} }
//根据日期查询道路污染数据 //根据日期查询道路污染数据
public List<RoadData> listRoadData(String dt){ public List<RoadData> listRoadData(String dt) {
QueryWrapper<RoadData> wrapper = new QueryWrapper<>(); QueryWrapper<RoadData> wrapper = new QueryWrapper<>();
wrapper.eq("dt",dt); wrapper.eq("dt", dt);
List<RoadData> list = roadDataMapper.selectList(wrapper); List<RoadData> list = roadDataMapper.selectList(wrapper);
return list; 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();
LocalDate yestDay = localDate.minusDays(1); LocalDate yestDay = localDate.minusDays(1);
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
LocalDateTime dateTime = LocalDateTime.of(yestDay.getYear(),yestDay.getMonth(),yestDay.getDayOfMonth(),0,0,0); LocalDateTime dateTime = LocalDateTime.of(yestDay.getYear(), yestDay.getMonth(), yestDay.getDayOfMonth(), 0, 0, 0);
return dateTime.format(formatter); return dateTime.format(formatter);
} }
//获取当前日期的时间串2022-05-08 //获取当前日期的时间串2022-05-08
private String dateStr(){ private String dateStr() {
LocalDate localDate = LocalDate.now(); LocalDate localDate = LocalDate.now();
LocalDate yestDay = localDate.minusDays(1); LocalDate yestDay = localDate.minusDays(1);
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");

View File

@ -33,7 +33,7 @@ import java.util.Map;
* @author admin * @author admin
* @version 1.0.0 * @version 1.0.0
* @ClassName SJZTService.java * @ClassName SJZTService.java
* @Description 数交中台service,城市执法 * @Description 数交中台service, 城市执法
* @createTime 2022年05月12日 18:00:00 * @createTime 2022年05月12日 18:00:00
*/ */
@Service @Service
@ -46,7 +46,7 @@ public class SJZTService {
//数交中台 //数交中台
//1.登录 //1.登录
public String sjztToken () { public String sjztToken() {
String url = "http://120.221.95.13:9090/apin/authorization/oauth/token"; String url = "http://120.221.95.13:9090/apin/authorization/oauth/token";
HttpHeaders headers = new HttpHeaders(); HttpHeaders headers = new HttpHeaders();
headers.add("Authorization", "Basic dGVzdF9jbGllbnQ6ZTk4OWQ0NmZkYmMxYzM3NmMxOWE0M2FhZjg1MjI3YTQ="); headers.add("Authorization", "Basic dGVzdF9jbGllbnQ6ZTk4OWQ0NmZkYmMxYzM3NmMxOWE0M2FhZjg1MjI3YTQ=");
@ -83,132 +83,133 @@ public class SJZTService {
HttpHeaders headers = new HttpHeaders(); HttpHeaders headers = new HttpHeaders();
headers.add("Authorization", "Bearer " + token); headers.add("Authorization", "Bearer " + token);
Map<String,Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
JSONObject search = new JSONObject(); JSONObject search = new JSONObject();
search.put("opt","LIKE"); search.put("opt", "LIKE");
search.put("key","WTLYMC"); search.put("key", "WTLYMC");
search.put("val","微信举报"); search.put("val", "微信举报");
map.put("json",search); map.put("json", search);
int i = 1; int i = 1;
int roundCount = 0; int roundCount = 0;
int count = 0; int count = 0;
List<Map> maps = new ArrayList<>(); List<Map> maps = new ArrayList<>();
do{ do {
String url = "http://120.221.95.13:9090/catalog/resCatalogApply/getData/UC_QUERY_QDZWT_307013311122000064_1?pageSize=10000&pageNo={1}&search=[{2}]"; String url = "http://120.221.95.13:9090/catalog/resCatalogApply/getData/UC_QUERY_QDZWT_307013311122000064_1?pageSize=10000&pageNo={1}&search=[{2}]";
HttpEntity<Map> httpEntity = new HttpEntity<>(null, headers); HttpEntity<Map> httpEntity = new HttpEntity<>(null, headers);
ResponseEntity<JSONObject> responseEntity; ResponseEntity<JSONObject> responseEntity;
try { try {
responseEntity = restTemplate.exchange(url, HttpMethod.GET, httpEntity, JSONObject.class,i,search); responseEntity = restTemplate.exchange(url, HttpMethod.GET, httpEntity, JSONObject.class, i, search);
JSONObject jsonObject = responseEntity.getBody(); JSONObject jsonObject = responseEntity.getBody();
count = jsonObject.getIntValue("count"); count = jsonObject.getIntValue("count");
JSONArray jsonArray = jsonObject.getJSONArray("list"); JSONArray jsonArray = jsonObject.getJSONArray("list");
maps.addAll(JSONObject.parseArray(JSONObject.toJSONString(jsonArray), Map.class)); maps.addAll(JSONObject.parseArray(JSONObject.toJSONString(jsonArray), Map.class));
i++; i++;
roundCount = i*10000; roundCount = i * 10000;
} catch (Exception e) { } catch (Exception e) {
log.info("[listSJZTDatas] exception:{}", e.getMessage()); log.info("[listSJZTDatas] exception:{}", e.getMessage());
return null; return null;
} }
} while(roundCount <=count); } while (roundCount <= count);
log.info("[listSJZTDatas] 返回数据的数量:{}",maps.size()); log.info("[listSJZTDatas] 返回数据的数量:{}", maps.size());
return maps; return maps;
} }
//从接口获取案件数据并保存 //从接口获取案件数据并保存
public void batchSave(){ public void batchSave() {
String token = this.sjztToken(); String token = this.sjztToken();
HttpHeaders headers = new HttpHeaders(); HttpHeaders headers = new HttpHeaders();
headers.add("Authorization", "Bearer " + token); headers.add("Authorization", "Bearer " + token);
Map<String,Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
JSONObject search = new JSONObject(); JSONObject search = new JSONObject();
search.put("opt","LIKE"); search.put("opt", "LIKE");
search.put("key","AJJLSJ"); search.put("key", "AJJLSJ");
// search.put("val",this.dateStr()); // search.put("val",this.dateStr());
search.put("val","2017"); search.put("val", "2017");
map.put("json",search); map.put("json", search);
int i = 1; int i = 1;
int roundCount = 0; int roundCount = 0;
int count = 0; int count = 0;
List<Map> mapList = new ArrayList<>(); List<Map> mapList = new ArrayList<>();
do{ do {
String url = "http://120.221.95.13:9090/catalog/resCatalogApply/getData/UC_QUERY_QDZWT_307013311122000064_1?pageSize=10000&pageNo={1}&search=[{2}]"; String url = "http://120.221.95.13:9090/catalog/resCatalogApply/getData/UC_QUERY_QDZWT_307013311122000064_1?pageSize=10000&pageNo={1}&search=[{2}]";
HttpEntity<Map> httpEntity = new HttpEntity<>(null, headers); HttpEntity<Map> httpEntity = new HttpEntity<>(null, headers);
ResponseEntity<JSONObject> responseEntity; ResponseEntity<JSONObject> responseEntity;
try { try {
responseEntity = restTemplate.exchange(url, HttpMethod.GET, httpEntity, JSONObject.class,i,search); responseEntity = restTemplate.exchange(url, HttpMethod.GET, httpEntity, JSONObject.class, i, search);
JSONObject jsonObject = responseEntity.getBody(); JSONObject jsonObject = responseEntity.getBody();
count = jsonObject.getIntValue("count"); count = jsonObject.getIntValue("count");
JSONArray jsonArray = jsonObject.getJSONArray("list"); JSONArray jsonArray = jsonObject.getJSONArray("list");
mapList.addAll(JSONObject.parseArray(JSONObject.toJSONString(jsonArray), Map.class)); mapList.addAll(JSONObject.parseArray(JSONObject.toJSONString(jsonArray), Map.class));
i++; i++;
roundCount = i*10000; roundCount = i * 10000;
} catch (Exception e) { } catch (Exception e) {
log.info("[SJZTService-batchSave] exception:{}", e.getMessage()); log.info("[SJZTService-batchSave] exception:{}", e.getMessage());
} }
} while(roundCount <=count); } while (roundCount <= count);
System.out.println(mapList.size()); System.out.println(mapList.size());
IdentifierGenerator identifierGenerator=new DefaultIdentifierGenerator(); IdentifierGenerator identifierGenerator = new DefaultIdentifierGenerator();
mapList.forEach(m-> m.put("id",identifierGenerator.nextId(new Object())));//给id赋值 mapList.forEach(m -> m.put("id", identifierGenerator.nextId(new Object())));//给id赋值
List<List<Map>> lists = Lists.partition(mapList,50); List<List<Map>> lists = Lists.partition(mapList, 50);
try{ try {
lists.forEach(l->caseCityLawMapper.batchSave(l)); lists.forEach(l -> caseCityLawMapper.batchSave(l));
}catch (Exception e){ } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
log.error("[SJZTService batchsave Exception]:",e.getMessage()); log.error("[SJZTService batchsave Exception]:", e.getMessage());
} }
} }
public List<CaseCityLaw> listSJZTByDt(String ajjlsj){ public List<CaseCityLaw> listSJZTByDt(String ajjlsj) {
QueryWrapper<CaseCityLaw> wrapper = new QueryWrapper<>(); QueryWrapper<CaseCityLaw> wrapper = new QueryWrapper<>();
wrapper.like("ajjlsj",ajjlsj); wrapper.like("ajjlsj", ajjlsj);
return caseCityLawMapper.selectList(wrapper); return caseCityLawMapper.selectList(wrapper);
} }
public Result upStream(JSONObject data){ public Result upStream(JSONObject data) {
String url = "?actionType={1}&senderCode={2}&data={3}"; String url = "?actionType={1}&senderCode={2}&data={3}";
String senderCode = "";//发送方标识 String senderCode = "";//发送方标识
String actionType = "UP_REC_REPORT";//调用方法固定值 String actionType = "UP_REC_REPORT";//调用方法固定值
boolean result = false; boolean result = false;
ResponseEntity<JSONObject> responseEntity; ResponseEntity<JSONObject> responseEntity;
try{ try {
responseEntity = restTemplate.postForEntity(url, null, JSONObject.class,senderCode,actionType,data); responseEntity = restTemplate.postForEntity(url, null, JSONObject.class, senderCode, actionType, data);
JSONObject responseJSON = responseEntity.getBody(); JSONObject responseJSON = responseEntity.getBody();
if(responseEntity.getStatusCodeValue() == 200){ if (responseEntity.getStatusCodeValue() == 200) {
if(responseJSON.getBooleanValue("success") && responseJSON.getIntValue("code") == 0){ if (responseJSON.getBooleanValue("success") && responseJSON.getIntValue("code") == 0) {
return Result.success(responseJSON.get("data")); return Result.success(responseJSON.get("data"));
}else{ } else {
return Result.error(responseJSON.getString("data")); return Result.error(responseJSON.getString("data"));
} }
}else{ } else {
return Result.error(String.valueOf(responseEntity.getStatusCodeValue())); return Result.error(String.valueOf(responseEntity.getStatusCodeValue()));
} }
}catch (Exception e){ } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
log.error("[SJZTService upStream] Exception:"+e.getMessage()); log.error("[SJZTService upStream] Exception:" + e.getMessage());
return Result.error(e.getMessage()); return Result.error(e.getMessage());
} }
} }
//获取当前日期的时间串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();
LocalDate yestDay = localDate.minusDays(1); LocalDate yestDay = localDate.minusDays(1);
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
LocalDateTime dateTime = LocalDateTime.of(yestDay.getYear(),yestDay.getMonth(),yestDay.getDayOfMonth(),0,0,0); LocalDateTime dateTime = LocalDateTime.of(yestDay.getYear(), yestDay.getMonth(), yestDay.getDayOfMonth(), 0, 0, 0);
return dateTime.format(formatter); return dateTime.format(formatter);
} }
//获取当前日期的时间串2022-05-08 //获取当前日期的时间串2022-05-08
private String dateStr(){ private String dateStr() {
LocalDate localDate = LocalDate.now(); LocalDate localDate = LocalDate.now();
LocalDate yestDay = localDate.minusDays(1); LocalDate yestDay = localDate.minusDays(1);
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");

View File

@ -35,59 +35,59 @@ public class SanitationService {
@Autowired @Autowired
private SanitationTaskMapper sanitationTaskMapper; private SanitationTaskMapper sanitationTaskMapper;
public Result saveSanitationRoad(){ public Result saveSanitationRoad() {
List<Map> list = qidiService.resCatalogApplyHJWSRoad(); List<Map> list = qidiService.resCatalogApplyHJWSRoad();
try{ try {
if(list.size() > 0){ if (list.size() > 0) {
List<List<Map>> maps = Lists.partition(list,100); List<List<Map>> maps = Lists.partition(list, 100);
maps.forEach(m->sanitationMapper.batchSaveSanitationRoad(m)); maps.forEach(m -> sanitationMapper.batchSaveSanitationRoad(m));
} }
return Result.success(); return Result.success();
}catch (Exception e){ } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
log.error("[SanitationService saveSanitationRoad] Exception:"+e.getMessage()); log.error("[SanitationService saveSanitationRoad] Exception:" + e.getMessage());
return Result.error(e.getMessage()); return Result.error(e.getMessage());
} }
} }
public Result saveSanitationTask(){ public Result saveSanitationTask() {
List<Map> list = qidiService.resCatalogApplyHJWSZY(); List<Map> list = qidiService.resCatalogApplyHJWSZY();
try{ try {
if(list.size() > 0){ if (list.size() > 0) {
List<List<Map>> maps = Lists.partition(list,100); List<List<Map>> maps = Lists.partition(list, 100);
maps.forEach(m->sanitationMapper.batchSaveSanitationTask(m)); maps.forEach(m -> sanitationMapper.batchSaveSanitationTask(m));
} }
return Result.success(); return Result.success();
}catch (Exception e){ } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
log.error("[SanitationService saveSanitationTask] Exception:"+e.getMessage()); log.error("[SanitationService saveSanitationTask] Exception:" + e.getMessage());
return Result.error(e.getMessage()); return Result.error(e.getMessage());
} }
} }
//批量查询环卫车作业数据并保存可以根据实际需求更改 //批量查询环卫车作业数据并保存可以根据实际需求更改
@Scheduled(cron = "0 0 8 * * ?") @Scheduled(cron = "0 0 8 * * ?")
public void saveSanitationTaskScheduled(){ public void saveSanitationTaskScheduled() {
QueryWrapper<SanitationTask> wrapper = new QueryWrapper<>(); QueryWrapper<SanitationTask> wrapper = new QueryWrapper<>();
wrapper.orderByDesc("updatetime").last("limit 1"); wrapper.orderByDesc("updatetime").last("limit 1");
SanitationTask sanitationTask = sanitationTaskMapper.selectOne(wrapper); SanitationTask sanitationTask = sanitationTaskMapper.selectOne(wrapper);
List<Map> maps = new ArrayList<>(); List<Map> maps = new ArrayList<>();
try{ try {
if(sanitationTask != null){ if (sanitationTask != null) {
maps = qidiService.resCatalogApplyHJWSZY(String.valueOf(sanitationTask.getUpdatetime())); maps = qidiService.resCatalogApplyHJWSZY(String.valueOf(sanitationTask.getUpdatetime()));
}else{ } else {
maps = qidiService.resCatalogApplyHJWSZY(); maps = qidiService.resCatalogApplyHJWSZY();
} }
if(maps.size() > 0){ if (maps.size() > 0) {
List<List<Map>> lists = Lists.partition(maps,100); List<List<Map>> lists = Lists.partition(maps, 100);
lists.forEach(list->sanitationMapper.batchSaveSanitationTask(list)); lists.forEach(list -> sanitationMapper.batchSaveSanitationTask(list));
} }
}catch (Exception e){ } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
log.error("[SanitationService saveSanitationTaskScheduled] Exception:"+e.getMessage()); log.error("[SanitationService saveSanitationTaskScheduled] Exception:" + e.getMessage());
} }
} }

View File

@ -33,29 +33,29 @@ public class SedimentTrailService {
//获取渣土车轨迹并保存到表t_trail_sediment //获取渣土车轨迹并保存到表t_trail_sediment
//@Transactional(rollbackFor = Exception.class) //@Transactional(rollbackFor = Exception.class)
public boolean batchSaveSedimentTrail(){ public boolean batchSaveSedimentTrail() {
try{ try {
List<Map> maps = qidiService.resCatalogApplyZTYS(); List<Map> maps = qidiService.resCatalogApplyZTYS();
Lists.partition(maps,200).forEach( Lists.partition(maps, 200).forEach(
item-> sedimentTrailMapper.batchaSave(item) item -> sedimentTrailMapper.batchaSave(item)
); );
return true; return true;
}catch (Exception e){ } catch (Exception e) {
log.error("[batchSaveSedimentTrail] exception:{}",e.getMessage()); log.error("[batchSaveSedimentTrail] exception:{}", e.getMessage());
return false; return false;
} }
} }
/** /**
* 根据输入的经纬度和查询的半径查询范围内的渣土车轨迹信息 * 根据输入的经纬度和查询的半径查询范围内的渣土车轨迹信息
* @param longitude经度 latitude纬度 radius() start(时间) end(时间)
* *
* @param longitude经度 latitude纬度 radius() start(时间) end(时间)
*/ */
public 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); double[] points = LongLatUtil.getAround(longitude, latitude, radius);
QueryWrapper<SedimentTrail> wrapper = new QueryWrapper<>(); QueryWrapper<SedimentTrail> wrapper = new QueryWrapper<>();
wrapper.between("update_time",start,end).between("longitude",points[0],points[2]).between("latitude",points[1],points[3]) wrapper.between("update_time", start, end).between("longitude", points[0], points[2]).between("latitude", points[1], points[3])
.orderByAsc("sim_card_num","record_time"); .orderByAsc("sim_card_num", "record_time");
List<SedimentTrail> list = sedimentTrailMapper.selectList(wrapper); List<SedimentTrail> list = sedimentTrailMapper.selectList(wrapper);
return list; return list;
} }

View File

@ -20,28 +20,28 @@ public class TrailSanitationService {
@Autowired @Autowired
private QidiService qidiService; private QidiService qidiService;
public boolean saveTrailSanitation(){ public boolean saveTrailSanitation() {
boolean result = false; boolean result = false;
try{ try {
List<Map> list = qidiService.resCatalogApplyHJWS(); List<Map> list = qidiService.resCatalogApplyHJWS();
List<List<Map>> lists = Lists.partition(list,200); List<List<Map>> lists = Lists.partition(list, 200);
lists.forEach(l->trailSanitationMapper.batchaSave(l)); lists.forEach(l -> trailSanitationMapper.batchaSave(l));
result = true; result = true;
}catch (Exception e){ } catch (Exception e) {
log.error("[saveTrailSanitation] Exception:",e.getMessage()); log.error("[saveTrailSanitation] Exception:", e.getMessage());
} }
return result; return result;
} }
/** /**
* 根据输入的经纬度和查询的半径查询范围内的环卫车轨迹信息 * 根据输入的经纬度和查询的半径查询范围内的环卫车轨迹信息
* @param longitude经度 latitude纬度 raidus() start(时间) end(时间)
* *
* @param longitude经度 latitude纬度 raidus() start(时间) end(时间)
*/ */
public List<TrailSanitation> listSedimentTrailByPoints(double longitude, double latitude, Integer radius, String start, String end){ public List<TrailSanitation> listSedimentTrailByPoints(double longitude, double latitude, Integer radius, String start, String end) {
double[] points = LongLatUtil.getAround(longitude,latitude,radius); double[] points = LongLatUtil.getAround(longitude, latitude, radius);
QueryWrapper<TrailSanitation> wrapper = new QueryWrapper<>(); QueryWrapper<TrailSanitation> wrapper = new QueryWrapper<>();
wrapper.between("fssj",start,end).between("jd",points[0],points[2]).between("wd",points[1],points[3]); wrapper.between("fssj", start, end).between("jd", points[0], points[2]).between("wd", points[1], points[3]);
return trailSanitationMapper.selectList(wrapper); return trailSanitationMapper.selectList(wrapper);
} }

View File

@ -15,10 +15,10 @@ public class UserLoginService {
@Autowired @Autowired
private UserLoginMapper userLoginMapper; private UserLoginMapper userLoginMapper;
public UserLoginDto login(String username, String password){ public UserLoginDto login(String username, String password) {
UserLogin user = userLoginMapper.getUserByName(); UserLogin user = userLoginMapper.getUserByName();
UserLoginDto userLoginDto = new UserLoginDto(); UserLoginDto userLoginDto = new UserLoginDto();
if (user.getUsername().equals(username) && user.getPassword().equals(SecureUtil.md5(password))){ if (user.getUsername().equals(username) && user.getPassword().equals(SecureUtil.md5(password))) {
userLoginDto.setUsername(username); userLoginDto.setUsername(username);
userLoginDto.setStatus("登录成功"); userLoginDto.setStatus("登录成功");
return userLoginDto; return userLoginDto;

View File

@ -1,7 +1,9 @@
package com.hisense.monitormanage.utils; package com.hisense.monitormanage.utils;
import net.sf.ehcache.CacheManager; import net.sf.ehcache.CacheManager;
import java.net.URL; import java.net.URL;
import net.sf.ehcache.Cache; import net.sf.ehcache.Cache;
import net.sf.ehcache.Element; import net.sf.ehcache.Element;
@ -17,14 +19,15 @@ public class EhcacheUtil {
private URL url; private URL url;
private CacheManager manager; private CacheManager manager;
private static EhcacheUtil ehCache; private static EhcacheUtil ehCache;
private EhcacheUtil(String path) { private EhcacheUtil(String path) {
url = getClass().getResource(path); url = getClass().getResource(path);
manager = CacheManager.create(url); manager = CacheManager.create(url);
} }
public static EhcacheUtil getInstance() { public static EhcacheUtil getInstance() {
if (ehCache== null) { if (ehCache == null) {
ehCache= new EhcacheUtil(path); ehCache = new EhcacheUtil(path);
} }
return ehCache; return ehCache;
} }

View File

@ -9,6 +9,7 @@ package com.hisense.monitormanage.utils;
*/ */
public class LongLatUtil { public class LongLatUtil {
private static final double PI = 3.1415926; private static final double PI = 3.1415926;
/** /**
* 计算地球上任意两点(经纬度)距离 * 计算地球上任意两点(经纬度)距离
* *
@ -39,7 +40,7 @@ public class LongLatUtil {
* @param radius 单位米 * @param radius 单位米
* @return minLat, minLng, maxLat, maxLng * @return minLat, minLng, maxLat, maxLng
*/ */
public static double[] getAround(double lon,double lat, int radius) { public static double[] getAround(double lon, double lat, int radius) {
Double latitude = lat; Double latitude = lat;
Double longitude = lon; Double longitude = lon;
@ -57,7 +58,7 @@ public class LongLatUtil {
Double radiusLng = dpmLng * radiusMile; Double radiusLng = dpmLng * radiusMile;
Double minLng = longitude - radiusLng; Double minLng = longitude - radiusLng;
Double maxLng = longitude + radiusLng; Double maxLng = longitude + radiusLng;
return new double[]{minLng,minLat, maxLng, maxLat}; return new double[]{minLng, minLat, maxLng, maxLat};
} }
} }

View File

@ -1,8 +1,6 @@
# 应用名称 # 应用名称
spring.application.name=monitor-manage spring.application.name=monitor-manage
logging.level.com.hisense.monitormanage=INFO logging.level.com.hisense.monitormanage=INFO
# 应用服务 WEB 访问端口 # 应用服务 WEB 访问端口
server.port=7009 server.port=7009
# 数据库驱动: # 数据库驱动:
@ -14,7 +12,6 @@ spring.datasource.url=jdbc:mysql://15.72.183.91:3306/monitor_manage?useUnicode=t
# 数据库用户名&密码: # 数据库用户名&密码:
spring.datasource.username=root spring.datasource.username=root
spring.datasource.password=w@CmM1mBVQkPhdrc spring.datasource.password=w@CmM1mBVQkPhdrc
hwx.file.work-path=/data/services/monitor/ hwx.file.work-path=/data/services/monitor/
#用于生成图片地址 #用于生成图片地址
hwx.file.pic-host=http://15.72.183.90:7009 hwx.file.pic-host=http://15.72.183.90:7009

View File

@ -1,8 +1,6 @@
# 应用名称 # 应用名称
spring.application.name=monitor-manage spring.application.name=monitor-manage
logging.level.com.hisense.monitormanage=DEBUG logging.level.com.hisense.monitormanage=DEBUG
# 应用服务 WEB 访问端口 # 应用服务 WEB 访问端口
server.port=7009 server.port=7009
# 数据库驱动: # 数据库驱动:
@ -16,14 +14,12 @@ spring.datasource.url=jdbc:mysql://15.72.183.91:3306/monitor_manage?useUnicode=t
spring.datasource.username=root spring.datasource.username=root
spring.datasource.password=w@CmM1mBVQkPhdrc spring.datasource.password=w@CmM1mBVQkPhdrc
#spring.datasource.password=123456 #spring.datasource.password=123456
hwx.file.work-path=D:/tupian/ hwx.file.work-path=D:/tupian/
hwx.file.pic-host=http://127.0.0.1:7009 hwx.file.pic-host=http://127.0.0.1:7009
spring.resources.static-locations=classpath:/static,classpath:/public,file:${hwx.file.work-path} spring.resources.static-locations=classpath:/static,classpath:/public,file:${hwx.file.work-path}
mybatis-plus.mapper-locations=classpath*:/mapper/*.xml mybatis-plus.mapper-locations=classpath*:/mapper/*.xml
#??????swagger,true???false?? #??????swagger,true???false??
swagger.enable=true swagger.enable=true
scheduled.enable=false scheduled.enable=false

View File

@ -47,11 +47,15 @@
<select id="selectNoiceEvent" resultType="com.hisense.monitormanage.dto.BuildingRecordsDto"> <select id="selectNoiceEvent" resultType="com.hisense.monitormanage.dto.BuildingRecordsDto">
SELECT * FROM SELECT * FROM
(SELECT a.* FROM (SELECT a.* 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 (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 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 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,br.pm10,br.build_license,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 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 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 LEFT JOIN t_channel_picture cp ON b.channel_code = cp.channel_code
@ -441,12 +445,10 @@
SELECT date_sub(curdate(), INTERVAL 30 DAY) AS pushTime SELECT date_sub(curdate(), INTERVAL 30 DAY) AS pushTime
) b LEFT JOIN ( ) b LEFT JOIN (
SELECT DATE_FORMAT(rd.dt,'%Y%-%m-%d') AS pushTime,COUNT(1) AS number SELECT DATE_FORMAT(rd.dt,'%Y%-%m-%d') AS pushTime,COUNT(1) AS number
from t_road_data rd where pm10 > 150 AND DATE_SUB(CURDATE(), INTERVAL 30 DAY) &lt;= DATE(rd.dt) GROUP BY pushTime) a from t_road_data rd where pm10 > 150 AND DATE_SUB(CURDATE(), INTERVAL 30 DAY) &lt;= DATE(rd.dt) GROUP BY
pushTime) a
ON a.pushTime = b.pushTime ORDER BY b.pushTime ON a.pushTime = b.pushTime ORDER BY b.pushTime
</select> </select>
</mapper> </mapper>

View File

@ -8,7 +8,7 @@
jdmc,sqbs,sqmc,xzb,yzb,pqsj,ajjssj,ajzfsj,czsxcqjaaqjacqwjayqja,sbtpsl,cztpsl jdmc,sqbs,sqmc,xzb,yzb,pqsj,ajjssj,ajzfsj,czsxcqjaaqjacqwjayqja,sbtpsl,cztpsl
) )
VALUES VALUES
<foreach collection="list" item="item" separator="," > <foreach collection="list" item="item" separator=",">
( (
#{item.id},#{item.AJJLSJ},#{item.DZMS},#{item.WTMS},#{item.WTLYBS},#{item.WTLYMC}, #{item.id},#{item.AJJLSJ},#{item.DZMS},#{item.WTMS},#{item.WTLYBS},#{item.WTLYMC},
#{item.AJLXBS},#{item.AJLXMC},#{item.DLBS},#{item.DLMC},#{item.XLBS}, #{item.AJLXBS},#{item.AJLXMC},#{item.DLBS},#{item.DLMC},#{item.XLBS},

View File

@ -10,7 +10,8 @@
</select> </select>
<select id="selectByName" resultType="com.hisense.monitormanage.dto.EventDto"> <select id="selectByName" resultType="com.hisense.monitormanage.dto.EventDto">
SELECT * FROM t_event WHERE track_event = 'START' AND event_cn_name IN (${eventNewName}) ORDER BY capture_time DESC SELECT * FROM t_event WHERE track_event = 'START' AND event_cn_name IN (${eventNewName}) ORDER BY capture_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}

View File

@ -6,7 +6,7 @@
INSERT INTO t_passenger_flow INSERT INTO t_passenger_flow
(hour_id,time_id,longitude,latitude,all_nums,local_nums,nonlocal_nums) (hour_id,time_id,longitude,latitude,all_nums,local_nums,nonlocal_nums)
VALUES VALUES
<foreach collection="list" item="item" separator="," > <foreach collection="list" item="item" separator=",">
( (
#{item.hour_id},#{item.time_id},#{item.longitude},#{item.latitude},#{item.all_nums}, #{item.hour_id},#{item.time_id},#{item.longitude},#{item.latitude},#{item.all_nums},
#{item.local_nums},#{item.nonlocal_nums} #{item.local_nums},#{item.nonlocal_nums}

View File

@ -7,7 +7,7 @@
(region_name,street_name,road_name,start,end,lng,lat,pm10,pm25,desc_pm10_rank,asc_pm10_rank, (region_name,street_name,road_name,start,end,lng,lat,pm10,pm25,desc_pm10_rank,asc_pm10_rank,
desc_pm25_rank,asc_pm25_rank,points,dt) desc_pm25_rank,asc_pm25_rank,points,dt)
VALUES VALUES
<foreach collection="list" item="item" separator="," > <foreach collection="list" item="item" separator=",">
( (
#{item.regionName},#{item.streetName},#{item.roadName},#{item.start},#{item.end}, #{item.regionName},#{item.streetName},#{item.roadName},#{item.start},#{item.end},
#{item.lng},#{item.lat},#{item.pm10},#{item.pm25},#{item.desc_pm10_rank}, #{item.lng},#{item.lat},#{item.pm10},#{item.pm25},#{item.desc_pm10_rank},

View File

@ -3,7 +3,7 @@
<mapper namespace="com.hisense.monitormanage.mapper.SedimentTrailMapper"> <mapper namespace="com.hisense.monitormanage.mapper.SedimentTrailMapper">
<insert id="batchaSave" parameterType="java.util.List"> <insert id="batchaSave" parameterType="java.util.List">
<foreach collection="list" item="item" separator=";" > <foreach collection="list" item="item" separator=";">
INSERT INTO t_trail_sediment INSERT INTO t_trail_sediment
(speed,sim_card_num,uploadtime,coordinate_x,coordinate_y, (speed,sim_card_num,uploadtime,coordinate_x,coordinate_y,
longitude,latitude,record_time,angle,update_time,status,fuel) longitude,latitude,record_time,angle,update_time,status,fuel)

View File

@ -6,7 +6,7 @@
INSERT INTO t_trail_sanitation INSERT INTO t_trail_sanitation
(simkh,cph,fssj,jd,wd,sd,fx,zt,yl,lc,sfzx,bjzt,gd,updatetime) (simkh,cph,fssj,jd,wd,sd,fx,zt,yl,lc,sfzx,bjzt,gd,updatetime)
VALUES VALUES
<foreach collection="list" item="item" separator="," > <foreach collection="list" item="item" separator=",">
( (
#{item.SIMKH},#{item.CPH},#{item.FSSJ},#{item.JD},#{item.WD}, #{item.SIMKH},#{item.CPH},#{item.FSSJ},#{item.JD},#{item.WD},
#{item.SD},#{item.FX},#{item.ZT},#{item.YL},#{item.LC}, #{item.SD},#{item.FX},#{item.ZT},#{item.YL},#{item.LC},

View File

@ -22,7 +22,8 @@
ORDER BY waterPointDepth DESC ORDER BY waterPointDepth DESC
</select> </select>
<select id="selectCountWaters" resultType="com.hisense.monitormanage.dto.WaterPointDtos"> <select id="selectCountWaters" resultType="com.hisense.monitormanage.dto.WaterPointDtos">
SELECT c.report_origin,COUNT(*) as count,MAX(waterPointDepth) AS waterPointDepth FROM (SELECT a.*,b.updated_date AS waterPointDepth SELECT c.report_origin,COUNT(*) as count,MAX(waterPointDepth) AS waterPointDepth FROM (SELECT a.*,b.updated_date
AS waterPointDepth
FROM FROM
(SELECT wp.*,wpr.point_level (SELECT wp.*,wpr.point_level
FROM water_point wp FROM water_point wp

View File

@ -29,21 +29,21 @@ class MonitorManageApplicationTests {
// } // }
@Test @Test
void start1(){ void start1() {
buildingRecordsService.getAndSaveRecords(); buildingRecordsService.getAndSaveRecords();
} }
@Test @Test
void start2(){ void start2() {
roadDataService.saveRoadData(); roadDataService.saveRoadData();
} }
@Test @Test
void videoService()throws IOException ,InterruptedException{ void videoService() throws IOException, InterruptedException {
monitorService.videoService("",""); monitorService.videoService("", "");
System.out.println(JSONObject.toJSONString(MonitorService.cameras)); System.out.println(JSONObject.toJSONString(MonitorService.cameras));