@@ -178,6 +178,20 @@ | |||
<systemPath>${project.basedir}/src/main/resources/lib/aliyun-java-vod-upload-1.4.14.jar</systemPath> | |||
</dependency> | |||
<!--mapStruct依赖 高性能对象映射--> | |||
<!--mapstruct核心--> | |||
<dependency> | |||
<groupId>org.mapstruct</groupId> | |||
<artifactId>mapstruct</artifactId> | |||
<version>1.5.3.Final</version> | |||
</dependency> | |||
<!--mapstruct编译--> | |||
<dependency> | |||
<groupId>org.mapstruct</groupId> | |||
<artifactId>mapstruct-processor</artifactId> | |||
<version>1.5.3.Final</version> | |||
</dependency> | |||
</dependencies> | |||
@@ -0,0 +1,38 @@ | |||
package com.tuoheng.admin.config; | |||
import org.springframework.context.annotation.Bean; | |||
import org.springframework.context.annotation.Configuration; | |||
import org.springframework.web.cors.CorsConfiguration; | |||
import org.springframework.web.cors.UrlBasedCorsConfigurationSource; | |||
import org.springframework.web.filter.CorsFilter; | |||
import org.springframework.web.servlet.config.annotation.CorsRegistry; | |||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; | |||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; | |||
import java.util.Collections; | |||
/** | |||
* 解决跨域问题 | |||
* | |||
* @author wanjing | |||
* @team tuoheng | |||
* @date 2022-11-28 | |||
*/ | |||
@Configuration | |||
public class CORSConfig implements WebMvcConfigurer { | |||
@Bean | |||
public WebMvcConfigurer corsConfigurer() { | |||
return new WebMvcConfigurerAdapter() { | |||
@Override | |||
public void addCorsMappings(CorsRegistry registry) { | |||
registry.addMapping("/**") | |||
.allowedOrigins("*") | |||
.allowedMethods("*") | |||
.allowedOrigins("*"); | |||
} | |||
}; | |||
} | |||
} |
@@ -0,0 +1,52 @@ | |||
package com.tuoheng.admin.config; | |||
public interface SystemConstant { | |||
/** | |||
* 平台code | |||
*/ | |||
String PLATFORM_CODE = "treefarm"; | |||
/** | |||
* 机场平台:获取机场列表接口 | |||
*/ | |||
String API_AIRPORT_LIST = "/api/airportInterface/airportList"; | |||
/** | |||
* 机场平台:获取机场路线列表接口 | |||
*/ | |||
String API_AIRPORT_LINE_LIST = "/api/airportInterface/taskByDroneId"; | |||
/** | |||
* 机场平台:执行接口 | |||
*/ | |||
String API_AIRPORT_EXECUTE_TASK = "/api/airportInterface/executeTaskAnsy"; | |||
/** | |||
* 机场平台:获取天气 | |||
*/ | |||
String API_AIRPORT_GET_WEATHER = "/api/airportInterface/getWeather"; | |||
// 飞手平台不同接口url | |||
/** | |||
* 新增任务接口 | |||
*/ | |||
String ADD_PILOTTASK = "apiTask/add"; | |||
/** | |||
* 机场平台:定点飞行 | |||
*/ | |||
String API_AIRPORT_POINT_FLIGH = "/api/airportInterface/createPointLine"; | |||
/** | |||
* 机场平台:控制无人机 | |||
*/ | |||
String API_AIRPORT_DRONE_CONTROL = "/api/airportInterface/droneCommand"; | |||
/** | |||
* 机场平台:获取机场状态 | |||
*/ | |||
String API_AIRPORT_STATUS_BY_AIRPORT_ID = "/api/airportInterface/getAirportStatusByAirportId"; | |||
} |
@@ -0,0 +1,57 @@ | |||
package com.tuoheng.admin.controller; | |||
import com.tuoheng.admin.entity.request.airport.DroneControlRequest; | |||
import com.tuoheng.admin.entity.request.airport.PointFlightRequest; | |||
import com.tuoheng.admin.service.airport.AirportService; | |||
import com.tuoheng.common.utils.JsonResult; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.web.bind.annotation.*; | |||
/** | |||
* 机场前端控制器 | |||
* | |||
* @author wanjing | |||
* @team tuoheng | |||
* @date 2023-02-10 | |||
*/ | |||
@Slf4j | |||
@RestController | |||
@RequestMapping("/airport") | |||
public class AirPortController { | |||
@Autowired | |||
private AirportService airportService; | |||
/** | |||
* 获取巡检机场列表 | |||
*/ | |||
@GetMapping("/list") | |||
public JsonResult getList() { | |||
return airportService.getList(); | |||
} | |||
/** | |||
* 定点飞行 | |||
*/ | |||
@PostMapping("/pointflight") | |||
public JsonResult pointFlight(PointFlightRequest request) { | |||
return airportService.pointFlight(request); | |||
} | |||
/** | |||
* 无人机信息 | |||
*/ | |||
@GetMapping("/drone/data/{airportId}") | |||
public JsonResult getDroneDataById(@PathVariable("airportId") String airportId) { | |||
return airportService.getDroneDataById(airportId); | |||
} | |||
/** | |||
* 操制无人机 | |||
*/ | |||
@PostMapping("/drone/control") | |||
public JsonResult droneControl(DroneControlRequest request) { | |||
return airportService.droneControl(request); | |||
} | |||
} |
@@ -0,0 +1,83 @@ | |||
package com.tuoheng.admin.controller; | |||
import com.tuoheng.admin.entity.domain.Camera; | |||
import com.tuoheng.admin.entity.request.camera.QueryCameraListRequest; | |||
import com.tuoheng.admin.service.camera.ICameraService; | |||
import com.tuoheng.common.common.OperationEnum; | |||
import com.tuoheng.common.utils.JsonResult; | |||
import com.tuoheng.system.utils.ShiroUtils; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.web.bind.annotation.*; | |||
/** | |||
* @desc: 摄像头 前端控制器 | |||
* @team: tuoheng | |||
* @author: wanjing | |||
* @date: 2023-02-06 | |||
*/ | |||
@RestController | |||
@RequestMapping("/camera") | |||
public class CameraController { | |||
@Autowired | |||
private ICameraService cameraService; | |||
/** | |||
* 查询摄像头列表 | |||
*/ | |||
@GetMapping("/list") | |||
public JsonResult getList(QueryCameraListRequest request) { | |||
return cameraService.getList(request); | |||
} | |||
/** | |||
* 查询摄像头分页列表 | |||
*/ | |||
@GetMapping("/page") | |||
public JsonResult getPage(QueryCameraListRequest request) { | |||
return cameraService.getPage(request); | |||
} | |||
/** | |||
* 获取摄像头详细信息 | |||
*/ | |||
@GetMapping(value = "/{id}") | |||
public JsonResult getOneById(@PathVariable("id") Integer id) { | |||
return cameraService.getOneById(id); | |||
} | |||
/** | |||
* 添加摄像头 | |||
* | |||
* @param entity 实体对象 | |||
* @return | |||
*/ | |||
@PostMapping("/add") | |||
public JsonResult add(@RequestBody Camera entity) { | |||
return cameraService.editInfo(entity); | |||
} | |||
/** | |||
* 编辑摄像头 | |||
* | |||
* @param entity 实体对象 | |||
* @return | |||
*/ | |||
@PutMapping("/edit") | |||
public JsonResult edit(@RequestBody Camera entity) { | |||
return cameraService.editInfo(entity); | |||
} | |||
/** | |||
* 删除摄像头 | |||
* | |||
* @param ids 摄像头ID | |||
* @return | |||
*/ | |||
@DeleteMapping("/delete/{ids}") | |||
public JsonResult delete(@PathVariable("ids") Integer[] ids) { | |||
return cameraService.deleteByIds(ids); | |||
} | |||
} |
@@ -0,0 +1,65 @@ | |||
package com.tuoheng.admin.controller; | |||
import com.tuoheng.admin.entity.domain.Goods; | |||
import com.tuoheng.admin.entity.request.goods.QueryGoodsListByWarehouseIdRequest; | |||
import com.tuoheng.admin.service.goods.IGoodsService; | |||
import com.tuoheng.common.utils.JsonResult; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.web.bind.annotation.*; | |||
/** | |||
* @desc: 仓库物资 前端控制器 | |||
* @team: tuoheng | |||
* @author: wanjing | |||
* @date: 2023-02-06 | |||
*/ | |||
@RestController | |||
@RequestMapping("/goods") | |||
public class GoodsController { | |||
@Autowired | |||
private IGoodsService goodsService; | |||
/** | |||
* 根据仓库ID查询物资列表 | |||
*/ | |||
@GetMapping("/list/by/warehouseid") | |||
public JsonResult getListByWarehouseId(QueryGoodsListByWarehouseIdRequest request) { | |||
return goodsService.getListByWarehouseId(request); | |||
} | |||
/** | |||
* 添加物资 | |||
* | |||
* @param entity 实体对象 | |||
* @return | |||
*/ | |||
@PostMapping("/add") | |||
public JsonResult add(@RequestBody Goods entity) { | |||
return goodsService.editInfo(entity); | |||
} | |||
/** | |||
* 编辑物资 | |||
* | |||
* @param entity 实体对象 | |||
* @return | |||
*/ | |||
@PutMapping("/edit") | |||
public JsonResult edit(@RequestBody Goods entity) { | |||
return goodsService.editInfo(entity); | |||
} | |||
/** | |||
* 删除物资 | |||
* | |||
* @param ids 物资ID | |||
* @return | |||
*/ | |||
@DeleteMapping("/delete/{ids}") | |||
public JsonResult delete(@PathVariable("ids") Integer[] ids) { | |||
return goodsService.deleteByIds(ids); | |||
} | |||
} |
@@ -5,6 +5,7 @@ import com.tuoheng.admin.entity.request.index.GetQuestionListDto; | |||
import com.tuoheng.admin.service.IndexService; | |||
import com.tuoheng.common.common.BaseQuery; | |||
import com.tuoheng.common.utils.JsonResult; | |||
import io.swagger.annotations.ApiImplicitParam; | |||
import io.swagger.annotations.ApiOperation; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
@@ -38,13 +39,13 @@ public class IndexGisController { | |||
/** | |||
* 获取机场详细信息 | |||
* @param getAirportDetailDto | |||
* @param airportId | |||
* @return | |||
*/ | |||
@PostMapping("/getAirportDetail") | |||
public JsonResult getAirportDetail(@RequestBody GetAirportDetailDto getAirportDetailDto) { | |||
log.info("Index getAirportDetail start... param:{}", getAirportDetailDto.toString()); | |||
return indexService.getAirportDetail(getAirportDetailDto); | |||
@GetMapping("/getAirportDetail/{airportId}") | |||
public JsonResult getAirportDetail(@PathVariable("airportId") Integer airportId) { | |||
log.info("Index getAirportDetail start... param:{}", airportId.toString()); | |||
return indexService.getAirportDetail(airportId); | |||
} | |||
/** |
@@ -8,6 +8,7 @@ import com.tuoheng.admin.entity.domain.ThMission; | |||
import com.tuoheng.admin.entity.request.InspectionRequest; | |||
import com.tuoheng.admin.entity.request.MissionStatusRequest; | |||
import com.tuoheng.admin.entity.request.PushAndPullURLRequest; | |||
import com.tuoheng.admin.entity.request.airport.ExecuteTaskStatusRequest; | |||
import com.tuoheng.admin.entity.vo.InspectionVO; | |||
import com.tuoheng.admin.service.IMissionService; | |||
import com.tuoheng.admin.service.IThInspectionService; | |||
@@ -110,6 +111,14 @@ public class InspectionController { | |||
return JsonResult.success(inspectionService.getWeather(airportId)); | |||
} | |||
/** | |||
* 被硬件调用,执行任务后,回调执行状态 | |||
*/ | |||
@PostMapping("/executeTaskStatus") | |||
public JsonResult updateExecuteTaskStatus(@RequestBody @Valid ExecuteTaskStatusRequest executeTaskStatusRequest) { | |||
log.info("被硬件调用,执行任务后,回调执行状态:{}", JSONObject.toJSONString(executeTaskStatusRequest)); | |||
return missionService.updateExecuteTaskStatus(executeTaskStatusRequest); | |||
} | |||
/** | |||
* 被硬件调用,存任务状态 | |||
@@ -128,8 +137,20 @@ public class InspectionController { | |||
@PostMapping("/track") | |||
@ApiOperation(value = "被硬件调用,存飞行轨迹", notes = "被硬件调用,存飞行轨迹") | |||
public JsonResult<Integer> track(@RequestBody @Valid InspectionRequest inspectionRequest) { | |||
log.info("被硬件调用,存飞行轨迹:{}", JSONObject.toJSONString(inspectionRequest)); | |||
return JsonResult.success(inspectionService.track(inspectionRequest)); | |||
} | |||
/** | |||
* 获取飞行轨迹 | |||
* @param id | |||
* @return | |||
*/ | |||
@GetMapping("/fightData/{id}") | |||
public JsonResult fightData(@PathVariable("id") Integer id){ | |||
return inspectionService.fightData(id); | |||
} | |||
} |
@@ -5,6 +5,8 @@ import com.baomidou.mybatisplus.core.metadata.IPage; | |||
import com.tuoheng.admin.entity.domain.ThMission; | |||
import com.tuoheng.admin.entity.request.MissionQuery; | |||
import com.tuoheng.admin.entity.request.MissionRequest; | |||
import com.tuoheng.admin.entity.request.emergency.QueryEmergencyListRequest; | |||
import com.tuoheng.admin.entity.request.emergency.QueryMissionListRequest; | |||
import com.tuoheng.admin.entity.vo.MissionLiveVO; | |||
import com.tuoheng.admin.entity.vo.MissionVO; | |||
import com.tuoheng.admin.service.IMissionService; | |||
@@ -68,7 +70,7 @@ public class MissionController { | |||
LambdaQueryWrapper<ThMission> lambdaQueryTimeWrapper= new LambdaQueryWrapper<>(); | |||
lambdaQueryTimeWrapper.eq(ThMission::getInspectionLine, request.getInspectionLine()); | |||
lambdaQueryTimeWrapper.between(ThMission::getExecutionStartTime, startTime,endTime); | |||
//lambdaQueryTimeWrapper.eq(ThMission::getTenantId, ShiroUtils.getTenantId()); | |||
lambdaQueryTimeWrapper.eq(ThMission::getTenantId, ShiroUtils.getTenantId()); | |||
List<ThMission> missionListTime = missionService.getList(lambdaQueryTimeWrapper); | |||
if(!ObjectUtils.isEmpty(missionListTime) || missionListTime.size() >0 ){ | |||
throw new ServiceException(HttpStatus.SC_BAD_REQUEST,"同一个航线已存在相同的巡检时间!"); | |||
@@ -126,4 +128,32 @@ public class MissionController { | |||
return JsonResult.success(missionService.live(id)); | |||
} | |||
/** | |||
* 根据id获取任务视频回放和直播 | |||
* | |||
* @param id | |||
* @return | |||
*/ | |||
@GetMapping("/videoById/{id}") | |||
public JsonResult videoById(@PathVariable("id") String id) { | |||
return missionService.getVideoById(id); | |||
} | |||
/** | |||
* 查询巡检任务列表 | |||
*/ | |||
@GetMapping("/list") | |||
@ApiOperation(value = "查询应急任务列表", notes = "查询任务列表") | |||
public JsonResult getList(QueryMissionListRequest request) { | |||
return missionService.getList(request); | |||
} | |||
/** | |||
* 查询巡检任务列表 | |||
*/ | |||
@GetMapping("/emergency/list") | |||
@ApiOperation(value = "查询应急任务列表", notes = "查询应急任务列表") | |||
public JsonResult getEmergencyList(QueryEmergencyListRequest request) { | |||
return missionService.getEmergencyList(request); | |||
} | |||
} |
@@ -0,0 +1,81 @@ | |||
package com.tuoheng.admin.controller; | |||
import com.tuoheng.admin.entity.domain.Warehouse; | |||
import com.tuoheng.admin.entity.request.warehouse.QueryWarehouseListRequest; | |||
import com.tuoheng.admin.entity.request.warehouse.QueryWarehousePageListRequest; | |||
import com.tuoheng.admin.service.warehouse.IWarehouseService; | |||
import com.tuoheng.common.utils.JsonResult; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.web.bind.annotation.*; | |||
/** | |||
* @desc: 仓库 前端控制器 | |||
* @team: tuoheng | |||
* @author: wanjing | |||
* @date: 2023-02-06 | |||
*/ | |||
@RestController | |||
@RequestMapping("/warehouse") | |||
public class WarehouseController { | |||
@Autowired | |||
private IWarehouseService warehouseService; | |||
/** | |||
* 查询仓库列表 | |||
*/ | |||
@GetMapping("/list") | |||
public JsonResult getlist(QueryWarehouseListRequest request) { | |||
return warehouseService.getList(request); | |||
} | |||
/** | |||
* 查询仓库分页列表 | |||
*/ | |||
@GetMapping("/page/list") | |||
public JsonResult getPagelist(QueryWarehousePageListRequest request) { | |||
return warehouseService.getPageList(request); | |||
} | |||
/** | |||
* 获取仓库详细信息 | |||
*/ | |||
@GetMapping(value = "/{id}") | |||
public JsonResult getOneById(@PathVariable("id") Integer id) { | |||
return warehouseService.getOneById(id); | |||
} | |||
/** | |||
* 添加仓库 | |||
* | |||
* @param entity 实体对象 | |||
* @return | |||
*/ | |||
@PostMapping("/add") | |||
public JsonResult add(@RequestBody Warehouse entity) { | |||
return warehouseService.editInfo(entity); | |||
} | |||
/** | |||
* 编辑仓库 | |||
* | |||
* @param entity 实体对象 | |||
* @return | |||
*/ | |||
@PutMapping("/edit") | |||
public JsonResult edit(@RequestBody Warehouse entity) { | |||
return warehouseService.editInfo(entity); | |||
} | |||
/** | |||
* 删除仓库 | |||
* | |||
* @param ids 摄像头ID | |||
* @return | |||
*/ | |||
@DeleteMapping("/delete/{ids}") | |||
public JsonResult delete(@PathVariable("ids") Integer[] ids) { | |||
return warehouseService.deleteByIds(ids); | |||
} | |||
} |
@@ -0,0 +1,96 @@ | |||
package com.tuoheng.admin.controller; | |||
import com.tuoheng.admin.entity.query.WarningQuery; | |||
import com.tuoheng.admin.entity.request.warning.QueryWarningListRequest; | |||
import com.tuoheng.admin.entity.request.warning.WarningConfirmRequest; | |||
import com.tuoheng.admin.service.warning.IWarningService; | |||
import com.tuoheng.common.utils.JsonResult; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.web.bind.annotation.*; | |||
/** | |||
* @desc: 预警 前端控制器 | |||
* @team: tuoheng | |||
* @author: wanjing | |||
* @date: 2023-02-06 | |||
*/ | |||
@RestController | |||
@RequestMapping("/warning") | |||
public class WarningController { | |||
@Autowired | |||
private IWarningService warningService; | |||
/** | |||
* 告警列表查询 分页 | |||
* @param query | |||
* @return | |||
*/ | |||
@GetMapping("/index") | |||
public JsonResult index(WarningQuery query){ | |||
return warningService.index(query); | |||
} | |||
/** | |||
* 查询预警列表 | |||
*/ | |||
@GetMapping("/list") | |||
public JsonResult list(QueryWarningListRequest request) { | |||
return warningService.getList(request); | |||
} | |||
/** | |||
* 获取预警详细信息 | |||
*/ | |||
@GetMapping(value = "/{id}") | |||
public JsonResult getOneById(@PathVariable("id") Integer id) { | |||
return warningService.getOneById(id); | |||
} | |||
/** | |||
* 预警确认 | |||
*/ | |||
@PostMapping("/confirm") | |||
public JsonResult confirm(WarningConfirmRequest request){ | |||
return warningService.confirm(request); | |||
} | |||
/** | |||
* 预警忽略 | |||
* | |||
* @return | |||
*/ | |||
@PostMapping("/ignore/{id}") | |||
public JsonResult ignore(@PathVariable("id") Integer id){ | |||
return warningService.ignore(id); | |||
} | |||
/** | |||
* 预警详情 | |||
* @param id | |||
* @return | |||
*/ | |||
@GetMapping("/details/{id}") | |||
public JsonResult details(@PathVariable("id") Integer id){ | |||
return warningService.details(id); | |||
} | |||
/** | |||
* 火灾通知下发 | |||
* @return | |||
*/ | |||
@GetMapping("/notice") | |||
public JsonResult notice(){ | |||
return warningService.notice(); | |||
} | |||
/** | |||
* 通知预警与处理 | |||
* @param id | |||
* @return | |||
*/ | |||
@PutMapping("/messageRead/status/{id}") | |||
public JsonResult editStatusById(@PathVariable("id") Integer id){ | |||
return warningService.editStatusById(id); | |||
} | |||
} |
@@ -0,0 +1,41 @@ | |||
package com.tuoheng.admin.controller; | |||
import com.tuoheng.admin.entity.request.warningrecord.QueryWarningRecordByEmergencyMissionIdRequest; | |||
import com.tuoheng.admin.entity.request.warningrecord.QueryWarningRecordListByWarningIdRequest; | |||
import com.tuoheng.admin.service.warningrecord.IWarningRecordService; | |||
import com.tuoheng.common.utils.JsonResult; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.web.bind.annotation.GetMapping; | |||
import org.springframework.web.bind.annotation.RequestMapping; | |||
import org.springframework.web.bind.annotation.RestController; | |||
/** | |||
* @desc: 预警记录 前端控制器 | |||
* @team: tuoheng | |||
* @author: wanjing | |||
* @date: 2023-02-06 | |||
*/ | |||
@RestController | |||
@RequestMapping("/warning/record") | |||
public class WarningRecordController { | |||
@Autowired | |||
private IWarningRecordService warningRecordService; | |||
/** | |||
* 查询预警记录列表 | |||
*/ | |||
@GetMapping("/list/by/warningid") | |||
public JsonResult getListByWarningId(QueryWarningRecordListByWarningIdRequest request) { | |||
return warningRecordService.getListByWarningId(request); | |||
} | |||
/** | |||
* 根据应急任务ID查询预警记录 | |||
*/ | |||
@GetMapping("/one/by/emergencyMissionId") | |||
public JsonResult getOneByEmergencyMissionId(QueryWarningRecordByEmergencyMissionIdRequest request) { | |||
return warningRecordService.getOneByEmergencyMissionId(request); | |||
} | |||
} |
@@ -0,0 +1,20 @@ | |||
package com.tuoheng.admin.conver; | |||
import com.tuoheng.admin.entity.domain.ThInspection; | |||
import com.tuoheng.admin.entity.domain.Warning; | |||
import com.tuoheng.admin.entity.vo.index.DroneDataVo; | |||
import com.tuoheng.admin.entity.vo.warning.WarningListVo; | |||
import org.mapstruct.Mapper; | |||
import org.mapstruct.factory.Mappers; | |||
import java.util.List; | |||
@Mapper | |||
public interface InspectionConverMapper { | |||
InspectionConverMapper INSTANCE = Mappers.getMapper(InspectionConverMapper.class); | |||
List<DroneDataVo> fromInspectionListToDroneDataVoList(List<ThInspection> inspectionList); | |||
} |
@@ -0,0 +1,18 @@ | |||
package com.tuoheng.admin.conver; | |||
import com.tuoheng.admin.entity.domain.ThMission; | |||
import com.tuoheng.admin.entity.vo.EmergencyMissionVO; | |||
import org.mapstruct.Mapper; | |||
import org.mapstruct.factory.Mappers; | |||
import java.util.List; | |||
@Mapper | |||
public interface MissionConverMapper { | |||
MissionConverMapper INSTANCE = Mappers.getMapper(MissionConverMapper.class); | |||
List<EmergencyMissionVO> fromMissionListToEmergencyMissionVOList(List<ThMission> missionList); | |||
} |
@@ -0,0 +1,19 @@ | |||
package com.tuoheng.admin.conver; | |||
import com.tuoheng.admin.entity.domain.Warning; | |||
import com.tuoheng.admin.entity.vo.warning.WarningListVo; | |||
import com.tuoheng.admin.entity.vo.warning.WarningVo; | |||
import org.mapstruct.Mapper; | |||
import org.mapstruct.factory.Mappers; | |||
import java.util.List; | |||
@Mapper | |||
public interface WarningConverMapper { | |||
WarningConverMapper INSTANCE = Mappers.getMapper(WarningConverMapper.class); | |||
List<WarningListVo> fromWarningListToWarningListVoList(List<Warning> warningList); | |||
WarningVo fromWarningToWarningVo(Warning warning); | |||
} |
@@ -0,0 +1,18 @@ | |||
package com.tuoheng.admin.conver; | |||
import com.tuoheng.admin.entity.domain.WarningRecord; | |||
import com.tuoheng.admin.entity.vo.warning.WarningRecordVo; | |||
import org.mapstruct.Mapper; | |||
import org.mapstruct.factory.Mappers; | |||
import java.util.List; | |||
@Mapper | |||
public interface WarningRecordConverMapper { | |||
WarningRecordConverMapper INSTANCE = Mappers.getMapper(WarningRecordConverMapper.class); | |||
List<WarningRecordVo> fromWarningRecordListToWarningRecordListVoList(List<WarningRecord> warningRecordList); | |||
} |
@@ -0,0 +1,69 @@ | |||
package com.tuoheng.admin.entity.domain; | |||
import com.baomidou.mybatisplus.annotation.TableField; | |||
import com.baomidou.mybatisplus.annotation.TableName; | |||
import com.tuoheng.common.common.BaseEntity; | |||
import lombok.Data; | |||
import lombok.EqualsAndHashCode; | |||
import lombok.experimental.Accessors; | |||
import java.io.Serializable; | |||
/** | |||
* 摄像头对象 th_camera | |||
* | |||
* @author wanjing | |||
* @team tuoheng | |||
* @date 2023-02-06 | |||
*/ | |||
@Data | |||
@EqualsAndHashCode(callSuper = true) | |||
@Accessors(chain = true) | |||
@TableName("th_camera") | |||
public class Camera extends BaseEntity implements Serializable { | |||
private static final long serialVersionUID = 1L; | |||
/** | |||
* 租户ID | |||
*/ | |||
private Integer tenantId; | |||
/** | |||
* 摄像头名称 | |||
*/ | |||
private String cameraName; | |||
/** | |||
* 设备类型 1枪机 2球机 | |||
*/ | |||
private Integer cameraType; | |||
/** | |||
* 经度 | |||
*/ | |||
private String longitude; | |||
/** | |||
* 纬度 | |||
*/ | |||
private String latitude; | |||
/** | |||
* 位置名称 | |||
*/ | |||
private String location; | |||
/** | |||
* flv地址 | |||
*/ | |||
private String flvUrl; | |||
/** | |||
* 备注 | |||
*/ | |||
private String remark; | |||
@TableField(exist = false) | |||
private String updateUserName; | |||
} |
@@ -0,0 +1,60 @@ | |||
package com.tuoheng.admin.entity.domain; | |||
import com.baomidou.mybatisplus.annotation.TableField; | |||
import com.baomidou.mybatisplus.annotation.TableName; | |||
import com.tuoheng.common.common.BaseEntity; | |||
import lombok.Data; | |||
import lombok.EqualsAndHashCode; | |||
import lombok.experimental.Accessors; | |||
import java.io.Serializable; | |||
/** | |||
* 物资对象 th_goods | |||
* | |||
* @author wanjing | |||
* @team tuoheng | |||
* @date 2023-02-06 | |||
*/ | |||
@Data | |||
@EqualsAndHashCode(callSuper = true) | |||
@Accessors(chain = true) | |||
@TableName("th_goods") | |||
public class Goods extends BaseEntity implements Serializable { | |||
private static final long serialVersionUID = 1L; | |||
/** | |||
* 租户ID | |||
*/ | |||
private Integer tenantId; | |||
/** | |||
* 仓库ID | |||
*/ | |||
private Integer warehouseId; | |||
/** | |||
* 物资名称 | |||
*/ | |||
private String goodsName; | |||
/** | |||
* 物资类型 1个人防护装备 2搜救装备 3医疗及防疫设备及常用应急药品 4应急照明设备 5灭火处置设备 | |||
*/ | |||
private Integer goodsType; | |||
/** | |||
* 物资库存 | |||
*/ | |||
private String goodsStock; | |||
/** | |||
* 物资作用 | |||
*/ | |||
private String goodsAction; | |||
@TableField(exist = false) | |||
private String updateUserName; | |||
} |
@@ -26,6 +26,11 @@ public class QuestionHandle extends BaseEntity implements Serializable { | |||
private static final long serialVersionUID = 1L; | |||
/** | |||
* 租户id | |||
*/ | |||
private Integer tenantId; | |||
/** | |||
* 巡检问题文件ID | |||
*/ |
@@ -75,11 +75,6 @@ public class Tenant extends BaseEntity implements Serializable { | |||
*/ | |||
private String email; | |||
/** | |||
* 机场调用邮箱 | |||
*/ | |||
private String airportUrl; | |||
/** | |||
* 省份编号 | |||
*/ |
@@ -61,6 +61,11 @@ public class ThInspection extends BaseEntity implements Serializable { | |||
*/ | |||
private String altitude; | |||
/** | |||
* 飞行速度 | |||
*/ | |||
private String speed; | |||
/** | |||
* 经度 | |||
*/ | |||
@@ -77,4 +82,18 @@ public class ThInspection extends BaseEntity implements Serializable { | |||
*/ | |||
private Long flyTime; | |||
/** | |||
* 距离机场距离(米) | |||
*/ | |||
private String distHome; | |||
/** | |||
* 遥测信号 | |||
*/ | |||
private String ysingal; | |||
/** | |||
* 飞行模式 | |||
*/ | |||
private String mode; | |||
} |
@@ -49,7 +49,7 @@ public class ThMission extends BaseEntity implements Serializable { | |||
private String name; | |||
/** | |||
* 巡检任务类型 1 日常,2 应急巡检 | |||
* 任务类型:1:巡检任务 2:应急任务 | |||
*/ | |||
private Integer type; | |||
@@ -192,4 +192,10 @@ public class ThMission extends BaseEntity implements Serializable { | |||
* DSP交互ID | |||
*/ | |||
private String requestId; | |||
/** | |||
* 应急任务关联数据任务ID | |||
*/ | |||
private Integer emergencyDataMissionId; | |||
} |
@@ -0,0 +1,55 @@ | |||
package com.tuoheng.admin.entity.domain; | |||
import com.baomidou.mybatisplus.annotation.TableField; | |||
import com.baomidou.mybatisplus.annotation.TableName; | |||
import com.tuoheng.common.common.BaseEntity; | |||
import lombok.Data; | |||
import lombok.EqualsAndHashCode; | |||
import lombok.experimental.Accessors; | |||
import java.io.Serializable; | |||
/** | |||
* 仓库对象 th_warehouse | |||
* | |||
* @author wanjing | |||
* @team tuoheng | |||
* @date 2023-02-06 | |||
*/ | |||
@Data | |||
@EqualsAndHashCode(callSuper = true) | |||
@Accessors(chain = true) | |||
@TableName("th_warehouse") | |||
public class Warehouse extends BaseEntity implements Serializable { | |||
private static final long serialVersionUID = 1L; | |||
/** | |||
* 租户ID | |||
*/ | |||
private Integer tenantId; | |||
/** | |||
* 仓库名称 | |||
*/ | |||
private String warehouseName; | |||
/** | |||
* 经度 | |||
*/ | |||
private String longitude; | |||
/** | |||
* 纬度 | |||
*/ | |||
private String latitude; | |||
/** | |||
* 位置名称 | |||
*/ | |||
private String location; | |||
@TableField(exist = false) | |||
private String updateUserName; | |||
} |
@@ -0,0 +1,85 @@ | |||
package com.tuoheng.admin.entity.domain; | |||
import com.baomidou.mybatisplus.annotation.TableName; | |||
import com.fasterxml.jackson.annotation.JsonFormat; | |||
import com.tuoheng.common.common.BaseEntity; | |||
import lombok.Data; | |||
import lombok.EqualsAndHashCode; | |||
import lombok.experimental.Accessors; | |||
import org.springframework.format.annotation.DateTimeFormat; | |||
import java.io.Serializable; | |||
import java.util.Date; | |||
/** | |||
* 预警对象 th_warning | |||
* | |||
* @author wanjing | |||
* @team tuoheng | |||
* @date 2023-02-06 | |||
*/ | |||
@Data | |||
@EqualsAndHashCode(callSuper = true) | |||
@Accessors(chain = true) | |||
@TableName("th_warning") | |||
public class Warning extends BaseEntity implements Serializable { | |||
private static final long serialVersionUID = 1L; | |||
/** | |||
* 租户ID | |||
*/ | |||
private Integer tenantId; | |||
/** | |||
* 任务ID | |||
*/ | |||
private Integer missionId; | |||
/** | |||
* 发现方式 1监控摄像 2无人机巡检 3人工巡检 | |||
*/ | |||
private Integer discoveryWay; | |||
/** | |||
* 火灾位置名称 | |||
*/ | |||
private String location; | |||
/** | |||
* 预警状态 1待确认 2确认 3忽略 | |||
*/ | |||
private Integer status; | |||
/** | |||
* 问题ID | |||
*/ | |||
private Integer questionId; | |||
/** | |||
* 处理人 | |||
*/ | |||
private Integer checkUser; | |||
/** | |||
* 处理时间 | |||
*/ | |||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") | |||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") | |||
private Date checkTime; | |||
/** | |||
* 处理结果 | |||
*/ | |||
private String checkResult; | |||
/** | |||
* 消息读取标识 0:未读 1已读 | |||
*/ | |||
private Integer messageRead; | |||
/** | |||
* 对应任务的应急类型: 0:巡检任务应急记录 1:应急任务应急记录 | |||
*/ | |||
private Integer flag; | |||
} |
@@ -0,0 +1,52 @@ | |||
package com.tuoheng.admin.entity.domain; | |||
import com.baomidou.mybatisplus.annotation.TableName; | |||
import com.tuoheng.common.common.BaseEntity; | |||
import io.swagger.models.auth.In; | |||
import lombok.Data; | |||
import lombok.EqualsAndHashCode; | |||
import lombok.experimental.Accessors; | |||
import java.io.Serializable; | |||
/** | |||
* 预警记录对象 th_warning_record | |||
* | |||
* @author wanjing | |||
* @team tuoheng | |||
* @date 2023-02-06 | |||
*/ | |||
@Data | |||
@EqualsAndHashCode(callSuper = true) | |||
@Accessors(chain = true) | |||
@TableName("th_warning_record") | |||
public class WarningRecord extends BaseEntity implements Serializable { | |||
private static final long serialVersionUID = 1L; | |||
/** | |||
* 租户ID | |||
*/ | |||
private Integer tenantId; | |||
/** | |||
* 预警ID | |||
*/ | |||
private Integer warningId; | |||
/** | |||
* 记录名称 | |||
*/ | |||
private String name; | |||
/** | |||
* 任务ID | |||
*/ | |||
private Integer missionId; | |||
/** | |||
* 应急任务ID | |||
*/ | |||
private Integer emergencyMissionId; | |||
} |
@@ -46,6 +46,11 @@ public class WorkOrder extends BaseEntity implements Serializable { | |||
*/ | |||
private String assignNote; | |||
/** | |||
* 租户id | |||
*/ | |||
private Integer tenantId; | |||
/** | |||
* 指派时间 | |||
*/ |
@@ -26,6 +26,11 @@ public class AirportDetailDto { | |||
*/ | |||
private String wdir; | |||
/** | |||
* 风向名称 | |||
*/ | |||
private String wdirName; | |||
/** | |||
* 大气压力 | |||
*/ | |||
@@ -51,4 +56,9 @@ public class AirportDetailDto { | |||
*/ | |||
private String mountName; | |||
/** | |||
* 降雨量 | |||
*/ | |||
private String rainfull; | |||
} |
@@ -0,0 +1,56 @@ | |||
package com.tuoheng.admin.entity.query; | |||
import com.fasterxml.jackson.annotation.JsonFormat; | |||
import com.tuoheng.common.common.BaseQuery; | |||
import lombok.Data; | |||
import org.springframework.format.annotation.DateTimeFormat; | |||
import java.util.Date; | |||
/** | |||
* @Author ChengWang | |||
* @Date 2023/2/7 | |||
*/ | |||
@Data | |||
public class WarningQuery extends BaseQuery { | |||
/** | |||
* 租户id | |||
*/ | |||
private Integer tenantId; | |||
/** | |||
* 发现方式 | |||
*/ | |||
private Integer discoveryWay; | |||
/** | |||
* 预警状态 1待确认 2确认 3忽略 | |||
*/ | |||
private Integer status; | |||
/** | |||
* 起始日期 | |||
*/ | |||
private String startTime; | |||
/** | |||
* 结束日期 | |||
*/ | |||
private String endTime; | |||
/** | |||
* 起始日期 | |||
*/ | |||
private Date waringStartTime; | |||
/** | |||
* 结束日期 | |||
*/ | |||
private Date waringEndTime; | |||
} |
@@ -1,12 +1,10 @@ | |||
package com.tuoheng.admin.entity.request; | |||
import com.fasterxml.jackson.annotation.JsonFormat; | |||
import io.swagger.annotations.ApiModelProperty; | |||
import lombok.Data; | |||
import org.springframework.format.annotation.DateTimeFormat; | |||
import java.io.Serializable; | |||
import javax.validation.constraints.NotNull; | |||
import java.io.Serializable; | |||
/** | |||
* @User qiujinyang | |||
* @Description | |||
@@ -17,6 +15,10 @@ public class InspectionRequest implements Serializable { | |||
private static final long serialVersionUID = 1L; | |||
@ApiModelProperty(value = "巡检的ID,跟硬件对接的时候,硬件的巡检ID") | |||
@NotNull(message = "巡检任务ID不能为空!") | |||
private String requestId; | |||
@ApiModelProperty(value = "巡检的ID,跟硬件对接的时候,硬件的巡检ID") | |||
@NotNull(message = "巡检的ID不能为空!") | |||
private Integer inspectionId; | |||
@@ -37,9 +39,19 @@ public class InspectionRequest implements Serializable { | |||
@NotNull(message = "地面基站不能为空!") | |||
private String hostIp; | |||
@ApiModelProperty(value = "飞行时间") | |||
@NotNull(message = "飞行时间不能为空!") | |||
private Long flyTime; | |||
@ApiModelProperty(value = "水平速度") | |||
private String hspeed; | |||
@ApiModelProperty(value = "垂直速度") | |||
private String vspeed; | |||
@ApiModelProperty(value = "遥测信号") | |||
private String ysingal; | |||
@ApiModelProperty(value = "飞行模式") | |||
private String mode; | |||
} |
@@ -0,0 +1,22 @@ | |||
package com.tuoheng.admin.entity.request.airport; | |||
import io.swagger.annotations.ApiModelProperty; | |||
import lombok.Data; | |||
import java.io.Serializable; | |||
/** | |||
* 无人机控制请求实体 | |||
* | |||
* @author wanjing | |||
* @team tuoheng | |||
* @date 2023-02-15 | |||
*/ | |||
@Data | |||
public class DroneControlRequest implements Serializable { | |||
private static final long serialVersionUID = 1L; | |||
private String value; | |||
} |
@@ -0,0 +1,35 @@ | |||
package com.tuoheng.admin.entity.request.airport; | |||
import lombok.Data; | |||
import java.io.Serializable; | |||
/** | |||
* 修改任务请求参数 | |||
* | |||
* @author wanjing | |||
* @team tuoheng | |||
* @date 2023-01-10 | |||
*/ | |||
@Data | |||
public class ExecuteTaskStatusRequest implements Serializable { | |||
private static final long serialVersionUID = 1L; | |||
/** | |||
* 0:成功,500:失败 | |||
*/ | |||
private String code; | |||
/** | |||
* 业务平台任务id | |||
*/ | |||
private String requestId; | |||
/** | |||
* 执行结果 | |||
*/ | |||
private String msg; | |||
} |
@@ -0,0 +1,41 @@ | |||
package com.tuoheng.admin.entity.request.airport; | |||
import io.swagger.annotations.ApiModelProperty; | |||
import lombok.Data; | |||
import java.io.Serializable; | |||
/** | |||
* 定点飞行请求实体 | |||
* | |||
* @author wanjing | |||
* @team tuoheng | |||
* @date 2023-02-15 | |||
*/ | |||
@Data | |||
public class PointFlightRequest implements Serializable { | |||
private static final long serialVersionUID = 1L; | |||
@ApiModelProperty(value = "预警id") | |||
private Integer warningId; | |||
@ApiModelProperty(value = "巡检任务id") | |||
private Integer missionId; | |||
@ApiModelProperty(value = "机场id") | |||
private Integer airportId; | |||
@ApiModelProperty(value = "机场名称") | |||
private String airportName; | |||
@ApiModelProperty(value = "指点高度") | |||
private String alt; | |||
@ApiModelProperty(value = "经度") | |||
private String lon; | |||
@ApiModelProperty(value = "纬度") | |||
private String lat; | |||
} |
@@ -0,0 +1,25 @@ | |||
package com.tuoheng.admin.entity.request.camera; | |||
import com.tuoheng.common.common.BaseQuery; | |||
import io.swagger.annotations.ApiModelProperty; | |||
import lombok.Data; | |||
import java.io.Serializable; | |||
/** | |||
* 查询摄像头列表任务请求实体 | |||
* | |||
* @author: qiujinyang | |||
*/ | |||
@Data | |||
public class QueryCameraListRequest extends BaseQuery implements Serializable { | |||
private static final long serialVersionUID = 1L; | |||
@ApiModelProperty(value = "租户Id", hidden = true) | |||
private Integer tenantId; | |||
@ApiModelProperty(value = "摄像头名称", hidden = true) | |||
private String cameraName; | |||
} |
@@ -0,0 +1,29 @@ | |||
package com.tuoheng.admin.entity.request.emergency; | |||
import io.swagger.annotations.ApiModelProperty; | |||
import lombok.Data; | |||
import java.io.Serializable; | |||
import java.util.List; | |||
/** | |||
* 查询应急列表请求实体 | |||
* | |||
* @author wanjing | |||
* @team tuoheng | |||
* @date 2023-02-13 | |||
*/ | |||
@Data | |||
public class QueryEmergencyListRequest implements Serializable { | |||
private static final long serialVersionUID = 1L; | |||
@ApiModelProperty(value = "租户Id",hidden = true) | |||
private Integer tenantId; | |||
@ApiModelProperty(value = "任务类型:0:巡检任务 1:应急任务") | |||
private Integer accidentTask; | |||
@ApiModelProperty(value = "任务状态:1任务待飞行 2任务飞行中 3任务执行失败 4任务飞行完成") | |||
private List<String> statusList; | |||
} |
@@ -0,0 +1,23 @@ | |||
package com.tuoheng.admin.entity.request.emergency; | |||
import io.swagger.annotations.ApiModelProperty; | |||
import lombok.Data; | |||
import java.io.Serializable; | |||
import java.util.List; | |||
/** | |||
* 查询应急列表请求实体 | |||
* @author: qiujinyang | |||
*/ | |||
@Data | |||
public class QueryMissionListRequest implements Serializable { | |||
private static final long serialVersionUID = 1L; | |||
@ApiModelProperty(value = "租户Id",hidden = true) | |||
private Integer tenantId; | |||
@ApiModelProperty(value = "任务状态:1任务待飞行 2任务飞行中 3任务执行失败 4任务飞行完成") | |||
private List<String> statusList; | |||
} |
@@ -0,0 +1,36 @@ | |||
package com.tuoheng.admin.entity.request.goods; | |||
import io.swagger.annotations.ApiModelProperty; | |||
import lombok.Data; | |||
import java.io.Serializable; | |||
/** | |||
* 查询摄像头列表请求实体 | |||
* | |||
* @author: qiujinyang | |||
*/ | |||
@Data | |||
public class QueryGoodsListByWarehouseIdRequest implements Serializable { | |||
private static final long serialVersionUID = 1L; | |||
@ApiModelProperty(value = "租户Id", hidden = true) | |||
private Integer tenantId; | |||
/** | |||
* 仓库ID | |||
*/ | |||
private Integer warehouseId; | |||
/** | |||
* 物资类型 | |||
*/ | |||
private Integer goodsType; | |||
/** | |||
* 物资名称 | |||
*/ | |||
private String goodsName; | |||
} |
@@ -0,0 +1,21 @@ | |||
package com.tuoheng.admin.entity.request.goods; | |||
import io.swagger.annotations.ApiModelProperty; | |||
import lombok.Data; | |||
import java.io.Serializable; | |||
/** | |||
* 查询摄像头列表请求实体 | |||
* | |||
* @author: qiujinyang | |||
*/ | |||
@Data | |||
public class QueryGoodsPageListRequest implements Serializable { | |||
private static final long serialVersionUID = 1L; | |||
@ApiModelProperty(value = "租户Id", hidden = true) | |||
private Integer tenantId; | |||
} |
@@ -15,6 +15,8 @@ import javax.validation.constraints.NotEmpty; | |||
@Data | |||
public class GetQuestionListDto { | |||
private Integer tenantId;//新增 | |||
@NotEmpty(message = "startTime can not be empty!") | |||
private String startTime; | |||
@@ -0,0 +1,21 @@ | |||
package com.tuoheng.admin.entity.request.warehouse; | |||
import com.tuoheng.common.common.BaseQuery; | |||
import io.swagger.annotations.ApiModelProperty; | |||
import lombok.Data; | |||
import java.io.Serializable; | |||
/** | |||
* 查询仓库列表请求实体 | |||
* @author: qiujinyang | |||
*/ | |||
@Data | |||
public class QueryWarehouseListRequest extends BaseQuery implements Serializable { | |||
private static final long serialVersionUID = 1L; | |||
@ApiModelProperty(value = "租户Id",hidden = true) | |||
private Integer tenantId; | |||
} |
@@ -0,0 +1,24 @@ | |||
package com.tuoheng.admin.entity.request.warehouse; | |||
import com.tuoheng.common.common.BaseQuery; | |||
import io.swagger.annotations.ApiModelProperty; | |||
import lombok.Data; | |||
import java.io.Serializable; | |||
/** | |||
* 查询仓库分页列表请求实体 | |||
* @author: qiujinyang | |||
*/ | |||
@Data | |||
public class QueryWarehousePageListRequest extends BaseQuery implements Serializable { | |||
private static final long serialVersionUID = 1L; | |||
@ApiModelProperty(value = "租户Id",hidden = true) | |||
private Integer tenantId; | |||
@ApiModelProperty(value = "仓库名称", hidden = true) | |||
private String warehouseName; | |||
} |
@@ -0,0 +1,26 @@ | |||
package com.tuoheng.admin.entity.request.warning; | |||
import io.swagger.annotations.ApiModelProperty; | |||
import lombok.Data; | |||
import java.io.Serializable; | |||
/** | |||
* 查询预警列表请求实体 | |||
* @author: qiujinyang | |||
*/ | |||
@Data | |||
public class QueryWarningListRequest implements Serializable { | |||
private static final long serialVersionUID = 1L; | |||
@ApiModelProperty(value = "租户Id", hidden = true) | |||
private Integer tenantId; | |||
@ApiModelProperty(value = "对应任务的应急类型: 0:巡检任务应急记录 1:应急任务应急记录") | |||
private Integer flag; | |||
@ApiModelProperty(value = "预警状态: 0:全部;1:待确认;2:确认;3:忽略;") | |||
private Integer status; | |||
} |
@@ -0,0 +1,23 @@ | |||
package com.tuoheng.admin.entity.request.warning; | |||
import io.swagger.annotations.ApiModelProperty; | |||
import lombok.Data; | |||
import java.io.Serializable; | |||
/** | |||
* 预警确认请求实体 | |||
* @author: qiujinyang | |||
*/ | |||
@Data | |||
public class WarningConfirmRequest implements Serializable { | |||
private static final long serialVersionUID = 1L; | |||
@ApiModelProperty(value = "预警ID") | |||
private Integer id; | |||
@ApiModelProperty(value = "处理内容") | |||
private String checkResult; | |||
} |
@@ -0,0 +1,24 @@ | |||
package com.tuoheng.admin.entity.request.warningrecord; | |||
import io.swagger.annotations.ApiModelProperty; | |||
import lombok.Data; | |||
import java.io.Serializable; | |||
/** | |||
* 查询预警记录列表请求实体 | |||
* | |||
* @author: qiujinyang | |||
*/ | |||
@Data | |||
public class QueryWarningRecordByEmergencyMissionIdRequest implements Serializable { | |||
private static final long serialVersionUID = 1L; | |||
@ApiModelProperty(value = "租户Id", hidden = true) | |||
private Integer tenantId; | |||
@ApiModelProperty(value = "预警Id", hidden = true) | |||
private Integer emergencyMissionId; | |||
} |
@@ -0,0 +1,24 @@ | |||
package com.tuoheng.admin.entity.request.warningrecord; | |||
import io.swagger.annotations.ApiModelProperty; | |||
import lombok.Data; | |||
import java.io.Serializable; | |||
/** | |||
* 查询预警记录列表请求实体 | |||
* | |||
* @author: qiujinyang | |||
*/ | |||
@Data | |||
public class QueryWarningRecordListByWarningIdRequest implements Serializable { | |||
private static final long serialVersionUID = 1L; | |||
@ApiModelProperty(value = "租户Id", hidden = true) | |||
private Integer tenantId; | |||
@ApiModelProperty(value = "预警Id", hidden = true) | |||
private Integer warningId; | |||
} |
@@ -0,0 +1,32 @@ | |||
package com.tuoheng.admin.entity.vo; | |||
import io.swagger.annotations.ApiModelProperty; | |||
import lombok.Data; | |||
import lombok.NoArgsConstructor; | |||
import java.io.Serializable; | |||
/** | |||
* 机场状态视图Vo | |||
* | |||
* @author wanjing | |||
* @team tuoheng | |||
* @date 2023-02-07 | |||
*/ | |||
@NoArgsConstructor | |||
@Data | |||
public class AirPortStatusVO implements Serializable { | |||
private static final long serialVersionUID = 1L; | |||
@ApiModelProperty(value = "机场id") | |||
private Integer airportId; | |||
@ApiModelProperty(value = "机场名称") | |||
private String airportName; | |||
@ApiModelProperty(value = "状态") | |||
private String msg; | |||
} |
@@ -71,4 +71,10 @@ public class AirPortVO implements Serializable { | |||
@ApiModelProperty(value = "修改时间",hidden = true) | |||
private String updateTime; | |||
@ApiModelProperty(value = "状态: 1:空闲 2:飞行中" ,hidden = true) | |||
private Integer status; | |||
@ApiModelProperty(value = "是否在线:true:在线 false:离线", hidden = true) | |||
private Boolean online; | |||
} |
@@ -32,7 +32,7 @@ public class AirWeatherVO implements Serializable { | |||
@ApiModelProperty(value = "parm") | |||
private ParmDTO parm; | |||
@ApiModelProperty(value = "mid") | |||
private Integer mid; | |||
private Double mid; | |||
@ApiModelProperty(value = "deviceid") | |||
private String deviceid; | |||
@ApiModelProperty(value = "timestamp") | |||
@@ -51,12 +51,13 @@ public class AirWeatherVO implements Serializable { | |||
public static class WTHDTO { | |||
@ApiModelProperty(value = "parm") | |||
private ParmDTO parm; | |||
private ParmNewDTO parmNew; | |||
@ApiModelProperty(value = "mid") | |||
private Integer mid; | |||
private Double mid; | |||
@ApiModelProperty(value = "deviceid") | |||
private String deviceid; | |||
@ApiModelProperty(value = "timestamp") | |||
private Integer timestamp; | |||
private Double timestamp; | |||
@NoArgsConstructor | |||
@Data | |||
@@ -88,6 +89,21 @@ public class AirWeatherVO implements Serializable { | |||
@ApiModelProperty(value = "WDIR") | |||
private Integer wdir; | |||
} | |||
@NoArgsConstructor | |||
@Data | |||
public static class ParmNewDTO { | |||
private Double hum; | |||
private Double noise; | |||
private Double rainfull; | |||
private Double tmp; | |||
private String wdirname; | |||
private Double dew; | |||
private Double wspd; | |||
private Double hpa; | |||
private Double wdir; | |||
private Double lux; | |||
} | |||
} | |||
@NoArgsConstructor | |||
@@ -96,11 +112,11 @@ public class AirWeatherVO implements Serializable { | |||
@ApiModelProperty(value = "parm") | |||
private ParmDTO parm; | |||
@ApiModelProperty(value = "mid") | |||
private Integer mid; | |||
private Double mid; | |||
@ApiModelProperty(value = "deviceid") | |||
private String deviceid; | |||
@ApiModelProperty(value = "timestamp") | |||
private Integer timestamp; | |||
private Double timestamp; | |||
@NoArgsConstructor | |||
@Data |
@@ -0,0 +1,105 @@ | |||
package com.tuoheng.admin.entity.vo; | |||
import com.fasterxml.jackson.annotation.JsonFormat; | |||
import io.swagger.annotations.ApiModelProperty; | |||
import lombok.Data; | |||
import org.springframework.format.annotation.DateTimeFormat; | |||
import java.io.Serializable; | |||
import java.util.Date; | |||
/** | |||
* 巡检任务 新增或修改请求参数 2022/7/27 | |||
* @author : qiujinyang | |||
*/ | |||
@Data | |||
public class EmergencyMissionVO implements Serializable { | |||
private static final long serialVersionUID = 1L; | |||
@ApiModelProperty(value = "任务id") | |||
private Integer id; | |||
@ApiModelProperty(value = "巡检任务编号") | |||
private String code; | |||
@ApiModelProperty(value = "任务名称") | |||
private String name; | |||
@ApiModelProperty(value = "巡检方式 1 机场服务,2 人工巡检") | |||
private Integer inspectionType; | |||
@ApiModelProperty(value = "巡检机场") | |||
private Integer airportId; | |||
@ApiModelProperty(value = "巡检机场名称") | |||
private String airportName; | |||
@ApiModelProperty(value = "巡检机场状态") | |||
private String airportStatus; | |||
@ApiModelProperty(value = "巡检线路") | |||
private Integer inspectionLine; | |||
@ApiModelProperty(value = "巡检线路名称") | |||
private String inspectionLineName; | |||
@ApiModelProperty(value = "飞机Id") | |||
private Integer droneId; | |||
@ApiModelProperty(value = "飞机名称") | |||
private String droneName; | |||
@ApiModelProperty(value = "巡检里程") | |||
private String mileage; | |||
@ApiModelProperty(value = "任务类型 1 日常,2 应急巡检") | |||
private Integer type; | |||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") | |||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") | |||
@ApiModelProperty(value = "巡检时间") | |||
private Date executionStartTime; | |||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") | |||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") | |||
@ApiModelProperty(value = "巡检结束时间") | |||
private Date executionEndTime; | |||
//直播的两个通道 | |||
@ApiModelProperty(value = "视频拉流地址") | |||
private String pullUrl; | |||
@ApiModelProperty(value = "AI拉流地址") | |||
private String aipullUrl; | |||
//直播的视频地址 | |||
@ApiModelProperty(value = "视频地址") | |||
private String playUrl; | |||
@ApiModelProperty(value = "AI识别后视频地址") | |||
private String aiplayUrl; | |||
//回放视频的两个地址 | |||
@ApiModelProperty(value = "原视频地址") | |||
private String videoUrl; | |||
@ApiModelProperty(value = "AI识别后视频地址") | |||
private String aiVideoUrl; | |||
@ApiModelProperty(value = "任务飞行状态:1任务待飞行 2任务飞行中 3任务执行失败 4任务飞行完成") | |||
private Integer status; | |||
@ApiModelProperty(value = "巡检报告是否生成 是否生成 0 未生成 1 需修改 2 已生成") | |||
private Integer reportStatus; | |||
@ApiModelProperty(value = "备注") | |||
private String note; | |||
@ApiModelProperty(value = "创建人") | |||
private String createUser; | |||
@ApiModelProperty(value = "飞行时间") | |||
private String flyTime; | |||
@ApiModelProperty(value = "租户id",hidden = true) | |||
private Integer tenantId; | |||
} |
@@ -0,0 +1,21 @@ | |||
package com.tuoheng.admin.entity.vo; | |||
import lombok.Data; | |||
/** | |||
* @Author ChengWang | |||
* @Date 2022/12/1 | |||
*/ | |||
@Data | |||
public class LiveChannelVO { | |||
/** | |||
* 直播地址 | |||
*/ | |||
private String aiPullUrl; | |||
/** | |||
* AI识别后视频地址 | |||
*/ | |||
private String aiVideoUrl; | |||
} |
@@ -0,0 +1,63 @@ | |||
package com.tuoheng.admin.entity.vo; | |||
import com.fasterxml.jackson.annotation.JsonFormat; | |||
import lombok.Data; | |||
import org.springframework.format.annotation.DateTimeFormat; | |||
import java.util.Date; | |||
import java.util.List; | |||
/** | |||
* @Author ChengWang | |||
* @Date 2023/2/8 | |||
*/ | |||
@Data | |||
public class WarningDetailsVO { | |||
/** | |||
* 火灾位置 | |||
*/ | |||
private String location; | |||
/** | |||
* 发现方式 1监控摄像 2无人机巡检 3人工巡检 | |||
*/ | |||
private Integer discoveryWay; | |||
/** | |||
*上报时间 | |||
*/ | |||
@DateTimeFormat(pattern = "yyyy.MM.dd HH:mm:ss") | |||
@JsonFormat(pattern = "yyyy.MM.dd HH:mm:ss", timezone = "GMT+8") | |||
private Date createTime; | |||
/** | |||
* 问题图片 | |||
*/ | |||
private String fileOriginalUrl; | |||
/** | |||
* 处理结果 | |||
*/ | |||
private String checkResult; | |||
/** | |||
* 处理人 | |||
*/ | |||
private String checkUser; | |||
/** | |||
* 处理时间 | |||
*/ | |||
@DateTimeFormat(pattern = "yyyy.MM.dd HH:mm:ss") | |||
@JsonFormat(pattern = "yyyy.MM.dd HH:mm:ss",timezone = "GMT+8") | |||
private Date checkTime; | |||
/** | |||
* 灾情记录 | |||
*/ | |||
private List<WarningRecordVO> warningRecordVOList; | |||
} |
@@ -0,0 +1,38 @@ | |||
package com.tuoheng.admin.entity.vo; | |||
import com.fasterxml.jackson.annotation.JsonFormat; | |||
import lombok.Data; | |||
import org.springframework.format.annotation.DateTimeFormat; | |||
import java.util.Date; | |||
/** | |||
* @Author ChengWang | |||
* @Date 2023/2/8 | |||
*/ | |||
@Data | |||
public class WarningRecordVO { | |||
/** | |||
* 任务id | |||
*/ | |||
private Integer missionId; | |||
/** | |||
* 任务状态:1任务待飞行 2任务飞行中 3任务执行失败 4任务飞行完成 | |||
*/ | |||
private Integer status; | |||
/** | |||
*记录创建时间 | |||
*/ | |||
@DateTimeFormat(pattern = "yyyy.MM.dd HH:mm:ss") | |||
@JsonFormat(pattern = "yyyy.MM.dd HH:mm:ss", timezone = "GMT+8") | |||
private Date recordStartTime; | |||
/** | |||
* 巡检机场名称 | |||
*/ | |||
private String airportName; | |||
} |
@@ -0,0 +1,54 @@ | |||
package com.tuoheng.admin.entity.vo; | |||
import com.fasterxml.jackson.annotation.JsonFormat; | |||
import lombok.Data; | |||
import org.springframework.format.annotation.DateTimeFormat; | |||
import java.util.Date; | |||
/** | |||
* @Author ChengWang | |||
* @Date 2023/2/7 | |||
*/ | |||
@Data | |||
public class WarningVO { | |||
/** | |||
*主键id | |||
*/ | |||
private Integer id; | |||
/** | |||
* 预警时间 | |||
*/ | |||
@DateTimeFormat(pattern = "yyyy.MM.dd HH:mm:ss") | |||
@JsonFormat(pattern = "yyyy.MM.dd HH:mm:ss", timezone = "GMT+8") | |||
private Date waringTime; | |||
/** | |||
* 预警来源 | |||
*/ | |||
private Integer discoveryWay; | |||
/** | |||
* 预警来源名称 | |||
*/ | |||
private String discoverWayName; | |||
/** | |||
* 火灾位置 | |||
*/ | |||
private String location; | |||
/** | |||
* 火灾核实 | |||
*/ | |||
private Integer status; | |||
/** | |||
* 火灾核实名称 | |||
*/ | |||
private String statusName; | |||
} |
@@ -0,0 +1,62 @@ | |||
package com.tuoheng.admin.entity.vo.index; | |||
import lombok.Data; | |||
@Data | |||
public class DroneDataVo { | |||
/** | |||
* 任务ID | |||
*/ | |||
private Integer missionId; | |||
/** | |||
* 巡检ID,跟硬件对接的时候,硬件的巡检ID | |||
*/ | |||
private Integer inspectionId; | |||
/** | |||
* 地面站标识 | |||
*/ | |||
private String hostIp; | |||
/** | |||
* 飞行高度 | |||
*/ | |||
private String altitude; | |||
/** | |||
* 飞行速度 | |||
*/ | |||
private String speed; | |||
/** | |||
* 经度 | |||
*/ | |||
private String lng; | |||
/** | |||
* 纬度 | |||
*/ | |||
private String lat; | |||
/** | |||
* 飞行时间 | |||
*/ | |||
private Long flyTime; | |||
/** | |||
* 距离机场距离(米) | |||
*/ | |||
private String distHome; | |||
/** | |||
* 遥测信号 | |||
*/ | |||
private String ysingal; | |||
/** | |||
* 飞行模式 | |||
*/ | |||
private String mode; | |||
} |
@@ -0,0 +1,103 @@ | |||
package com.tuoheng.admin.entity.vo.warning; | |||
import com.baomidou.mybatisplus.annotation.TableName; | |||
import com.fasterxml.jackson.annotation.JsonFormat; | |||
import com.tuoheng.common.common.BaseEntity; | |||
import lombok.Data; | |||
import lombok.EqualsAndHashCode; | |||
import lombok.experimental.Accessors; | |||
import org.springframework.format.annotation.DateTimeFormat; | |||
import java.io.Serializable; | |||
import java.util.Date; | |||
/** | |||
* 返回预警列表视图Vo | |||
* | |||
* @author wanjing | |||
* @team tuoheng | |||
* @date 2023-02-07 | |||
*/ | |||
@Data | |||
public class WarningListVo extends BaseEntity implements Serializable { | |||
private static final long serialVersionUID = 1L; | |||
/** | |||
* 租户ID | |||
*/ | |||
private Integer tenantId; | |||
/** | |||
* 任务ID | |||
*/ | |||
private Integer missionId; | |||
/** | |||
* 发现方式 1监控摄像 2无人机巡检 3人工巡检 | |||
*/ | |||
private String discoveryWay; | |||
/** | |||
* 火灾位置名称 | |||
*/ | |||
private String location; | |||
/** | |||
* 预警状态 1待确认 2确认 3忽略 | |||
*/ | |||
private String status; | |||
/** | |||
* 问题ID | |||
*/ | |||
private Integer questionId; | |||
/** | |||
* 处理人 | |||
*/ | |||
private Integer checkUser; | |||
/** | |||
* 处理时间 | |||
*/ | |||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") | |||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") | |||
private Date checkTime; | |||
/** | |||
* 处理结果 | |||
*/ | |||
private String checkResult; | |||
/** | |||
* 经度 | |||
*/ | |||
private String lng; | |||
/** | |||
* 纬度 | |||
*/ | |||
private String lat; | |||
/** | |||
* 巡检机场 | |||
*/ | |||
private Integer airportId; | |||
/** | |||
* 巡检线路 | |||
*/ | |||
private Integer inspectionLine; | |||
/** | |||
* 巡检机场名称 | |||
*/ | |||
private String airportName; | |||
/** | |||
* 巡检线路名称 | |||
*/ | |||
private String inspectionLineName; | |||
} |
@@ -0,0 +1,49 @@ | |||
package com.tuoheng.admin.entity.vo.warning; | |||
import com.tuoheng.common.common.BaseEntity; | |||
import lombok.Data; | |||
import lombok.EqualsAndHashCode; | |||
import lombok.experimental.Accessors; | |||
import java.io.Serializable; | |||
/** | |||
* 预警记录对象 th_warning_record | |||
* | |||
* @author wanjing | |||
* @team tuoheng | |||
* @date 2023-02-06 | |||
*/ | |||
@Data | |||
@EqualsAndHashCode(callSuper = true) | |||
@Accessors(chain = true) | |||
public class WarningRecordVo extends BaseEntity implements Serializable { | |||
private static final long serialVersionUID = 1L; | |||
/** | |||
* 预警ID | |||
*/ | |||
private Integer warningId; | |||
/** | |||
* 记录名称 | |||
*/ | |||
private String name; | |||
/** | |||
* 任务ID | |||
*/ | |||
private Integer missionId; | |||
/** | |||
* 应急任务ID | |||
*/ | |||
private Integer emergencyMissionId; | |||
/** | |||
* 任务状态:1任务待飞行 2任务飞行中 3任务执行失败 4任务飞行完成 | |||
*/ | |||
private Integer status; | |||
} |
@@ -0,0 +1,147 @@ | |||
package com.tuoheng.admin.entity.vo.warning; | |||
import com.baomidou.mybatisplus.annotation.TableName; | |||
import com.fasterxml.jackson.annotation.JsonFormat; | |||
import com.tuoheng.common.common.BaseEntity; | |||
import lombok.Data; | |||
import lombok.EqualsAndHashCode; | |||
import lombok.experimental.Accessors; | |||
import org.springframework.format.annotation.DateTimeFormat; | |||
import java.io.Serializable; | |||
import java.util.Date; | |||
/** | |||
* 预警对象 th_warning | |||
* | |||
* @author wanjing | |||
* @team tuoheng | |||
* @date 2023-02-06 | |||
*/ | |||
@Data | |||
@EqualsAndHashCode(callSuper = true) | |||
@Accessors(chain = true) | |||
public class WarningVo extends BaseEntity implements Serializable { | |||
private static final long serialVersionUID = 1L; | |||
/** | |||
* 租户ID | |||
*/ | |||
private Integer tenantId; | |||
/** | |||
* 任务ID | |||
*/ | |||
private Integer missionId; | |||
/** | |||
* 发现方式 1监控摄像 2无人机巡检 3人工巡检 | |||
*/ | |||
private Integer discoveryWay; | |||
/** | |||
* 火灾位置名称 | |||
*/ | |||
private String location; | |||
/** | |||
* 预警状态 1待确认 2确认 3忽略 | |||
*/ | |||
private Integer status; | |||
/** | |||
* 问题ID | |||
*/ | |||
private Integer questionId; | |||
/** | |||
* 处理人 | |||
*/ | |||
private Integer checkUser; | |||
/** | |||
* 处理时间 | |||
*/ | |||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") | |||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") | |||
private Date checkTime; | |||
/** | |||
* 处理结果 | |||
*/ | |||
private String checkResult; | |||
/** | |||
* 消息读取标识 0:未读 1已读 | |||
*/ | |||
private Integer messageRead; | |||
/** | |||
* 巡检机场 | |||
*/ | |||
private Integer airportId; | |||
/** | |||
* 巡检机场名称 | |||
*/ | |||
private String airportName; | |||
/** | |||
* 巡检线路 | |||
*/ | |||
private Integer inspectionLine; | |||
/** | |||
* 巡检线路名称 | |||
*/ | |||
private String inspectionLineName; | |||
/** | |||
* 问题类型 | |||
*/ | |||
private String questionType; | |||
/** | |||
* 问题类型名称 | |||
*/ | |||
private String questionName; | |||
/** | |||
* 问题描述 | |||
*/ | |||
private String questionDesc; | |||
/** | |||
* 文件编码 | |||
*/ | |||
private String fileCode; | |||
/** | |||
* 文件名称 | |||
*/ | |||
private String fileName; | |||
/** | |||
* 原图片位置 | |||
*/ | |||
private String fileOriginalUrl; | |||
/** | |||
* 分析后的图片位置 | |||
*/ | |||
private String fileMarkerUrl; | |||
/** | |||
* 经度 | |||
*/ | |||
private String lng; | |||
/** | |||
* 纬度 | |||
*/ | |||
private String lat; | |||
} |
@@ -0,0 +1,28 @@ | |||
package com.tuoheng.admin.enums; | |||
import lombok.Getter; | |||
/** | |||
* 机场飞行类型 0默认 1机场巡逻 2指点飞行 | |||
* | |||
* @author wanjing | |||
* @team tuoheng | |||
* @date 2023-02-13 | |||
*/ | |||
public enum AccidentTaskEnum { | |||
INSPECTION_TASK(1,"巡检任务"), | |||
ACCIDENT_TASK(2,"应急任务"); | |||
AccidentTaskEnum(int code, String description){ | |||
this.code = code; | |||
this.description = description; | |||
} | |||
@Getter | |||
private int code; | |||
@Getter | |||
private String description; | |||
} |
@@ -0,0 +1,27 @@ | |||
package com.tuoheng.admin.enums; | |||
import lombok.Getter; | |||
/** | |||
* @Author ChengWang | |||
* @Date 2023/2/7 | |||
*/ | |||
public enum DiscoveryWayEnum { | |||
SURVEILLANCE_CAMERA(1,"监控摄像"), | |||
UAV_PATROL(2,"无人机巡检"), | |||
MANUAL_INSPECTION(3,"人工巡检"); | |||
DiscoveryWayEnum(int code, String description){ | |||
this.code = code; | |||
this.description = description; | |||
} | |||
@Getter | |||
private int code; | |||
@Getter | |||
private String description; | |||
} |
@@ -0,0 +1,25 @@ | |||
package com.tuoheng.admin.enums; | |||
import lombok.Getter; | |||
/** | |||
* @Author ChengWang | |||
* @Date 2023/3/9 | |||
*/ | |||
public enum FlagEnum { | |||
ACCIDENT(1,"应急任务应急记录"), | |||
INSPECTION_ACCIDENT(0,"巡检任务应急记录"); | |||
FlagEnum(int code, String description){ | |||
this.code = code; | |||
this.description = description; | |||
} | |||
@Getter | |||
private int code; | |||
@Getter | |||
private String description; | |||
} |
@@ -0,0 +1,28 @@ | |||
package com.tuoheng.admin.enums; | |||
import lombok.Getter; | |||
/** | |||
* 巡检方式类型 | |||
* | |||
* @author wanjing | |||
* @team tuoheng | |||
* @date 2022-11-23 | |||
*/ | |||
public enum InspectionTypeEnum { | |||
AIRPORT(1,"机场巡逻"), | |||
MABNNEDFLIGHT(2,"人工巡检"); | |||
InspectionTypeEnum(int code, String description){ | |||
this.code = code; | |||
this.description = description; | |||
} | |||
@Getter | |||
private int code; | |||
@Getter | |||
private String description; | |||
} |
@@ -0,0 +1,25 @@ | |||
package com.tuoheng.admin.enums; | |||
import lombok.Getter; | |||
/** | |||
* 逻辑删除标记类型 | |||
* @author chenyukun | |||
*/ | |||
public enum MarkEnum { | |||
VALID(1,"有效"), | |||
NOTVALID(0,"失效"); | |||
MarkEnum(int code, String description){ | |||
this.code = code; | |||
this.description = description; | |||
} | |||
@Getter | |||
private int code; | |||
@Getter | |||
private String description; | |||
} |
@@ -0,0 +1,25 @@ | |||
package com.tuoheng.admin.enums; | |||
import lombok.Getter; | |||
/** | |||
* @Author ChengWang | |||
* @Date 2023/3/3 | |||
*/ | |||
public enum MessageReadEnum { | |||
MESSAGE_IS_READ(1,"已读"), | |||
MESSAGE_IS_NO_READ(0,"未读"); | |||
MessageReadEnum(int code, String description){ | |||
this.code = code; | |||
this.description = description; | |||
} | |||
@Getter | |||
private int code; | |||
@Getter | |||
private String description; | |||
} |
@@ -0,0 +1,44 @@ | |||
package com.tuoheng.admin.enums; | |||
import lombok.Getter; | |||
/** | |||
* @Author ChengWang | |||
* @Date 2023/2/8 | |||
*/ | |||
public enum MissionEnum { | |||
MISSION_IS_NOT_EXIST(1230901, "任务为空"), | |||
MISSION_ID_IS_NULL(1230902, "任务id不存在"); | |||
/** | |||
* 错误码 | |||
*/ | |||
private int code; | |||
/** | |||
* 错误信息 | |||
*/ | |||
private String msg; | |||
MissionEnum(int code, String msg){ | |||
this.code = code; | |||
this.msg = msg; | |||
} | |||
public int getCode() { | |||
return code; | |||
} | |||
public void setCode(int code) { | |||
this.code = code; | |||
} | |||
public String getMsg() { | |||
return msg; | |||
} | |||
public void setMsg(String msg) { | |||
this.msg = msg; | |||
} | |||
} |
@@ -0,0 +1,47 @@ | |||
package com.tuoheng.admin.enums; | |||
/** | |||
* @Author ChengWang | |||
* @Date 2022/12/1 | |||
*/ | |||
public enum QueryVideoServiceEnum { | |||
QUERY_IS_FAILED(1230700, "获取数据失败"), | |||
MISSION_ID_IS_NULL(1230701, "任务id为空"), | |||
LIVE_CHANNEL_IS_NOT_EXIST(1230702, "直播通道为空"), | |||
AIPULL_URL_IS_NOT_NULL(1230703, "直播地址为空"), | |||
AIVIDEO_URL_IS_NOT_NULL(1230704, "回放地址为空"), | |||
MISSION_IS_NOT_EXIST(1230705, "任务不存在"); | |||
/** | |||
* 错误码 | |||
*/ | |||
private int code; | |||
/** | |||
* 错误信息 | |||
*/ | |||
private String msg; | |||
QueryVideoServiceEnum(int code, String msg){ | |||
this.code = code; | |||
this.msg = msg; | |||
} | |||
public int getCode() { | |||
return code; | |||
} | |||
public void setCode(int code) { | |||
this.code = code; | |||
} | |||
public String getMsg() { | |||
return msg; | |||
} | |||
public void setMsg(String msg) { | |||
this.msg = msg; | |||
} | |||
} |
@@ -11,9 +11,9 @@ public enum QuestionTypeEnum { | |||
Q2("002001","病死树"), | |||
Q3("002003","人员活动"), | |||
Q3("002003","火焰"), | |||
Q4("002004","火灾隐患"); | |||
Q4("002004","烟雾"); | |||
QuestionTypeEnum(String code, String description){ | |||
this.code = code; |
@@ -0,0 +1,45 @@ | |||
package com.tuoheng.admin.enums; | |||
/** | |||
* @Author ChengWang | |||
* @Date 2023/2/7 | |||
*/ | |||
public enum WarningEnum { | |||
DATA_IS_NULL(1210101, "数据为空"), | |||
USER_IS_NOT_EXIST(1210102, "用户为空"), | |||
TENANT_ID_IS_NULL(1210103,"租户id为空"), | |||
WARNING_DATA_IS_NULL(1210104,"预警数据不存在"), | |||
QUESTION_IS_NOT_EXIST(1210105,"预警对应的问题不存在"); | |||
/** | |||
* 错误码 | |||
*/ | |||
private int code; | |||
/** | |||
* 错误信息 | |||
*/ | |||
private String msg; | |||
WarningEnum(int code, String msg){ | |||
this.code = code; | |||
this.msg = msg; | |||
} | |||
public int getCode() { | |||
return code; | |||
} | |||
public void setCode(int code) { | |||
this.code = code; | |||
} | |||
public String getMsg() { | |||
return msg; | |||
} | |||
public void setMsg(String msg) { | |||
this.msg = msg; | |||
} | |||
} |
@@ -0,0 +1,28 @@ | |||
package com.tuoheng.admin.enums; | |||
import lombok.Getter; | |||
/** | |||
* 预警状态类型 | |||
* | |||
* @author wanjing | |||
* @team tuoheng | |||
* @date 2023-02-06 | |||
*/ | |||
public enum WarningStatusEnum { | |||
WAIT_CONFIRM (1,"待确认"), | |||
CONFIRM(2,"确认"), | |||
IGNORE(3,"忽略"); | |||
WarningStatusEnum(int code, String description){ | |||
this.code = code; | |||
this.description = description; | |||
} | |||
@Getter | |||
private int code; | |||
@Getter | |||
private String description; | |||
} |
@@ -0,0 +1,34 @@ | |||
package com.tuoheng.admin.mapper; | |||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |||
import com.tuoheng.admin.entity.domain.Camera; | |||
import com.tuoheng.admin.entity.request.camera.QueryCameraListRequest; | |||
import java.util.List; | |||
/** | |||
* 摄像头Mapper接口 | |||
* | |||
* @author wanjing | |||
* @team tuoheng | |||
* @date 2023-02-06 | |||
*/ | |||
public interface CameraMapper extends BaseMapper<Camera> { | |||
/** | |||
* 查询摄像头列表 | |||
* | |||
* @param request 摄像头 | |||
* @return 摄像头集合 | |||
*/ | |||
List<Camera> selectList(QueryCameraListRequest request); | |||
/** | |||
* 查询摄像头 | |||
* | |||
* @param id 摄像头主键 | |||
* @return 摄像头 | |||
*/ | |||
Camera selectOneById(String id); | |||
} |
@@ -0,0 +1,35 @@ | |||
package com.tuoheng.admin.mapper; | |||
import java.util.List; | |||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |||
import com.tuoheng.admin.entity.domain.Goods; | |||
import com.tuoheng.admin.entity.request.goods.QueryGoodsListByWarehouseIdRequest; | |||
/** | |||
* 物资Mapper接口 | |||
* | |||
* @team tuoheng | |||
* @author wanjing | |||
* @date 2023-02-06 | |||
*/ | |||
public interface GoodsMapper extends BaseMapper<Goods> { | |||
/** | |||
* 查询物资列表 | |||
* | |||
* @param request 物资 | |||
* @return 物资集合 | |||
*/ | |||
List<Goods> getListByWarehouseId(QueryGoodsListByWarehouseIdRequest request); | |||
/** | |||
* 查询物资 | |||
* | |||
* @param id 物资主键 | |||
* @return 物资 | |||
*/ | |||
Goods getOneById(Integer id); | |||
} |
@@ -17,7 +17,7 @@ import java.util.List; | |||
*/ | |||
public interface QuestionMapper extends BaseMapper<Question> { | |||
List<QuestionCountVO> analyze(Integer missionId); | |||
List<QuestionCountVO> analyze(Integer missionId, Integer tenantId); | |||
List<QuestionTypeCountVO> analyzeType(Integer missionId, Integer tenantId); | |||
@@ -2,8 +2,13 @@ package com.tuoheng.admin.mapper; | |||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |||
import com.tuoheng.admin.entity.domain.ThInspection; | |||
import com.tuoheng.admin.entity.domain.ThMission; | |||
import java.util.List; | |||
import java.util.Map; | |||
public interface ThInspectionMapper extends BaseMapper<ThInspection> { | |||
List<ThInspection> selectListByMissionId(Map<String, Object> map); | |||
} |
@@ -0,0 +1,36 @@ | |||
package com.tuoheng.admin.mapper; | |||
import java.util.List; | |||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |||
import com.baomidou.mybatisplus.core.metadata.IPage; | |||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |||
import com.tuoheng.admin.entity.domain.Warehouse; | |||
import com.tuoheng.admin.entity.request.warehouse.QueryWarehousePageListRequest; | |||
import org.apache.ibatis.annotations.Param; | |||
/** | |||
* 仓库Mapper接口 | |||
* | |||
* @team tuoheng | |||
* @author wanjing | |||
* @date 2023-02-06 | |||
*/ | |||
public interface WarehouseMapper extends BaseMapper<Warehouse> { | |||
/** | |||
* 查询仓库分页列表 | |||
* | |||
* @param request 仓库 | |||
* @return 仓库集合 | |||
*/ | |||
Page<Warehouse> selectPageList(@Param("page") IPage page, @Param("request") QueryWarehousePageListRequest request); | |||
/** | |||
* 查询仓库 | |||
* | |||
* @param id 仓库主键 | |||
* @return 仓库 | |||
*/ | |||
Warehouse getOneById(Integer id); | |||
} |
@@ -0,0 +1,50 @@ | |||
package com.tuoheng.admin.mapper; | |||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |||
import com.tuoheng.admin.entity.domain.Warning; | |||
import com.tuoheng.admin.entity.request.warning.QueryWarningListRequest; | |||
import java.util.List; | |||
import java.util.Map; | |||
/** | |||
* 预警Mapper接口 | |||
* | |||
* @team tuoheng | |||
* @author wanjing | |||
* @date 2023-02-06 | |||
*/ | |||
public interface WarningMapper extends BaseMapper<Warning> { | |||
/** | |||
* 查询预警列表 | |||
* | |||
* @param thWarning 预警 | |||
* @return 预警集合 | |||
*/ | |||
List<Warning> getList(QueryWarningListRequest thWarning); | |||
/** | |||
* 查询预警 | |||
* | |||
* @param id 预警主键 | |||
* @return 预警 | |||
*/ | |||
Warning getOneById(Integer id); | |||
/** | |||
* 确认 | |||
* | |||
* @param map | |||
* @return | |||
*/ | |||
int confirm(Map<String, Object> map); | |||
/** | |||
* 忽略 | |||
* | |||
* @param map | |||
* @return | |||
*/ | |||
int ignore(Map<String, Object> map); | |||
} |
@@ -0,0 +1,34 @@ | |||
package com.tuoheng.admin.mapper; | |||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |||
import com.tuoheng.admin.entity.domain.WarningRecord; | |||
import com.tuoheng.admin.entity.request.warningrecord.QueryWarningRecordListByWarningIdRequest; | |||
import java.util.List; | |||
/** | |||
* 预警记录Mapper接口 | |||
* | |||
* @author wanjing | |||
* @team tuoheng | |||
* @date 2023-02-06 | |||
*/ | |||
public interface WarningRecordMapper extends BaseMapper<WarningRecord> { | |||
/** | |||
* 查询预警记录列表 | |||
* | |||
* @param request 预警记录 | |||
* @return 预警记录集合 | |||
*/ | |||
List<WarningRecord> getList(QueryWarningRecordListByWarningIdRequest request); | |||
/** | |||
* 查询预警记录 | |||
* | |||
* @param id 预警记录主键 | |||
* @return 预警记录 | |||
*/ | |||
WarningRecord getOneById(Integer id); | |||
} |
@@ -9,5 +9,5 @@ import org.apache.ibatis.annotations.Param; | |||
public interface WorkOrderMapper extends BaseMapper<WorkOrder> { | |||
IPage<WorkOrderQuestionVO> questionPage(@Param("page") IPage page, @Param("request") WorkOrderQuestionRequest request); | |||
IPage<WorkOrderQuestionVO> questionPage(@Param("page") IPage page, @Param("request") WorkOrderQuestionRequest request, int tenantId); | |||
} |
@@ -6,10 +6,12 @@ import com.tuoheng.admin.entity.domain.ThMission; | |||
import com.tuoheng.admin.entity.request.MissionQuery; | |||
import com.tuoheng.admin.entity.request.MissionRequest; | |||
import com.tuoheng.admin.entity.request.MissionStatusRequest; | |||
import com.tuoheng.admin.entity.request.airport.ExecuteTaskStatusRequest; | |||
import com.tuoheng.admin.entity.request.emergency.QueryEmergencyListRequest; | |||
import com.tuoheng.admin.entity.request.emergency.QueryMissionListRequest; | |||
import com.tuoheng.admin.entity.vo.MissionLiveVO; | |||
import com.tuoheng.admin.entity.vo.MissionVO; | |||
import com.tuoheng.common.common.IBaseService; | |||
import com.tuoheng.common.common.OperationEnum; | |||
import com.tuoheng.common.exception.ServiceException; | |||
import com.tuoheng.common.utils.JsonResult; | |||
@@ -24,6 +26,11 @@ public interface IMissionService extends IBaseService<ThMission> { | |||
List<ThMission> getList(LambdaQueryWrapper<ThMission> lambdaQueryWrapper); | |||
/** | |||
* 被硬件调用,执行任务后,回调执行状态 | |||
*/ | |||
JsonResult updateExecuteTaskStatus(ExecuteTaskStatusRequest executeTaskStatusRequest); | |||
/** | |||
* 更新巡检任务 | |||
* | |||
@@ -60,4 +67,20 @@ public interface IMissionService extends IBaseService<ThMission> { | |||
boolean deleteBatch(List<Integer> idList); | |||
MissionLiveVO live(Integer id); | |||
JsonResult getVideoById(String id); | |||
/** | |||
* 查询任务列表 | |||
* | |||
* @return | |||
*/ | |||
JsonResult getList(QueryMissionListRequest request); | |||
/** | |||
* 查询应急任务列表 | |||
* | |||
* @return | |||
*/ | |||
JsonResult getEmergencyList(QueryEmergencyListRequest request); | |||
} |
@@ -33,4 +33,7 @@ public interface IThInspectionService extends IBaseService<ThInspection> { | |||
JsonResult executeTask(String missionId,PushAndPullURLRequest pushAndPull) throws ServiceException; | |||
JsonResult lineTrack(Integer missionId); | |||
JsonResult fightData(Integer id); | |||
} |
@@ -19,7 +19,7 @@ public interface IndexService { | |||
IPage<MissionVO> getMissionList(BaseQuery baseQuery); | |||
JsonResult getAirportDetail(GetAirportDetailDto getAirportDetailDto); | |||
JsonResult getAirportDetail(Integer airportId); | |||
List<QuestionListDto> getQuestionList(GetQuestionListDto getQuestionListDto); | |||
@@ -0,0 +1,37 @@ | |||
package com.tuoheng.admin.service.airport; | |||
import com.tuoheng.admin.entity.request.airport.DroneControlRequest; | |||
import com.tuoheng.admin.entity.request.airport.PointFlightRequest; | |||
import com.tuoheng.common.utils.JsonResult; | |||
import org.springframework.web.bind.annotation.PostMapping; | |||
public interface AirportService { | |||
/** | |||
* 获取机场列表 | |||
* | |||
* @return | |||
*/ | |||
JsonResult getList(); | |||
/** | |||
* 定点飞行 | |||
* @param airportId | |||
* @return | |||
*/ | |||
JsonResult getDroneDataById(String airportId); | |||
/** | |||
* 定点飞行 | |||
* @param request | |||
* @return | |||
*/ | |||
JsonResult pointFlight(PointFlightRequest request); | |||
/** | |||
* 操制无人机 | |||
* @param request | |||
* @return | |||
*/ | |||
JsonResult droneControl(DroneControlRequest request); | |||
} |
@@ -0,0 +1,63 @@ | |||
package com.tuoheng.admin.service.airport; | |||
import com.tuoheng.admin.entity.request.airport.DroneControlRequest; | |||
import com.tuoheng.admin.entity.request.airport.PointFlightRequest; | |||
import com.tuoheng.admin.service.airport.drone.QueryDroneDataService; | |||
import com.tuoheng.admin.service.third.airport.DroneControlService; | |||
import com.tuoheng.admin.service.third.airport.PointFlightService; | |||
import com.tuoheng.common.utils.JsonResult; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.stereotype.Service; | |||
@Service | |||
public class AirportServiceImpl implements AirportService { | |||
@Autowired | |||
private QueryDroneDataService queryDroneDataService; | |||
@Autowired | |||
private PointFlightService pointFlightService; | |||
@Autowired | |||
private DroneControlService droneControlService; | |||
/** | |||
* 获取机场列表 | |||
* | |||
* @return | |||
*/ | |||
@Override | |||
public JsonResult getList() { | |||
return JsonResult.success(); | |||
} | |||
/** | |||
* 无人机信息 | |||
* @param airportId | |||
* @return | |||
*/ | |||
@Override | |||
public JsonResult getDroneDataById(String airportId) { | |||
return queryDroneDataService.getDroneDataById(airportId); | |||
} | |||
/** | |||
* 定点飞行 | |||
* @param request | |||
* @return | |||
*/ | |||
@Override | |||
public JsonResult pointFlight(PointFlightRequest request) { | |||
return pointFlightService.executePointFligh(request); | |||
} | |||
/** | |||
* 操制无人机 | |||
* @param request | |||
* @return | |||
*/ | |||
@Override | |||
public JsonResult droneControl(DroneControlRequest request) { | |||
return droneControlService.execute(request); | |||
} | |||
} |
@@ -0,0 +1,88 @@ | |||
package com.tuoheng.admin.service.airport.drone; | |||
import cn.hutool.core.collection.CollectionUtil; | |||
import cn.hutool.core.util.ObjectUtil; | |||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |||
import com.tuoheng.admin.conver.InspectionConverMapper; | |||
import com.tuoheng.admin.entity.domain.ThInspection; | |||
import com.tuoheng.admin.entity.domain.ThMission; | |||
import com.tuoheng.admin.entity.domain.WarningRecord; | |||
import com.tuoheng.admin.entity.vo.index.DroneDataVo; | |||
import com.tuoheng.admin.enums.MarkTypeEnum; | |||
import com.tuoheng.admin.enums.TaskStatusEnum; | |||
import com.tuoheng.admin.mapper.TenantMapper; | |||
import com.tuoheng.admin.mapper.ThInspectionMapper; | |||
import com.tuoheng.admin.mapper.ThMissionMapper; | |||
import com.tuoheng.common.exception.ServiceException; | |||
import com.tuoheng.common.utils.JsonResult; | |||
import com.tuoheng.common.utils.StringUtils; | |||
import com.tuoheng.system.entity.User; | |||
import com.tuoheng.system.utils.ShiroUtils; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.stereotype.Service; | |||
import java.util.HashMap; | |||
import java.util.List; | |||
import java.util.Map; | |||
@Slf4j | |||
@Service | |||
public class QueryDroneDataService { | |||
@Autowired | |||
private TenantMapper tenantMapper; | |||
@Autowired | |||
private ThMissionMapper missionMapper; | |||
@Autowired | |||
private ThInspectionMapper inspectionMapper; | |||
public JsonResult getDroneDataById(String airportId) { | |||
log.info("获取无人机数据信息, airportId={}", airportId); | |||
// 读取不同租户的机场平台url | |||
User user = ShiroUtils.getUserInfo(); | |||
Integer tenantId = user.getTenantId(); | |||
this.check(airportId); | |||
ThMission mission = missionMapper.selectOne(new LambdaQueryWrapper<ThMission>() | |||
.eq(ThMission::getTenantId, tenantId) | |||
.eq(ThMission::getAirportId, airportId) | |||
.eq(ThMission::getStatus, TaskStatusEnum.FLIGHT.getCode()) | |||
.eq(ThMission::getMark, MarkTypeEnum.VALID.getCode())); | |||
if (ObjectUtil.isNull(mission)) { | |||
log.info("获取无人机数据信息, 没有正在飞行的任务"); | |||
// throw new ServiceException("没有正在飞行的任务"); | |||
return JsonResult.success("没有正在飞行的任务"); | |||
} | |||
Integer missionId; | |||
if (0 == mission.getEmergencyDataMissionId()) { | |||
missionId = mission.getId(); | |||
} else { | |||
missionId = mission.getEmergencyDataMissionId(); | |||
} | |||
Map<String, Object> map = new HashMap<>(); | |||
map.put("id", missionId); | |||
map.put("tenantId", tenantId); | |||
List<ThInspection> inspectionList = inspectionMapper.selectListByMissionId(map); | |||
if (CollectionUtil.isEmpty(inspectionList)) { | |||
log.info("获取无人机数据信息, 数据为空"); | |||
return JsonResult.success("数据为空"); | |||
} | |||
List<DroneDataVo> droneDataVoList = InspectionConverMapper.INSTANCE.fromInspectionListToDroneDataVoList(inspectionList); | |||
return JsonResult.success(droneDataVoList); | |||
} | |||
/** | |||
* 检查参数 | |||
* | |||
* @param airportId | |||
* @return | |||
*/ | |||
private void check(String airportId) { | |||
if (StringUtils.isEmpty(airportId)) { | |||
log.info("获取无人机数据信息, 机场ID为空"); | |||
throw new ServiceException("机场ID为空"); | |||
} | |||
} | |||
} |
@@ -0,0 +1,121 @@ | |||
package com.tuoheng.admin.service.camera; | |||
import cn.hutool.core.util.ObjectUtil; | |||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |||
import com.baomidou.mybatisplus.core.metadata.IPage; | |||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |||
import com.tuoheng.admin.common.ServiceExceptionEnum; | |||
import com.tuoheng.admin.entity.domain.Camera; | |||
import com.tuoheng.admin.entity.request.camera.QueryCameraListRequest; | |||
import com.tuoheng.admin.enums.MarkTypeEnum; | |||
import com.tuoheng.admin.mapper.CameraMapper; | |||
import com.tuoheng.admin.service.camera.query.QueryCameraListService; | |||
import com.tuoheng.admin.utils.GaodeUtil; | |||
import com.tuoheng.common.common.BaseServiceImpl; | |||
import com.tuoheng.common.exception.ServiceException; | |||
import com.tuoheng.common.utils.JsonResult; | |||
import com.tuoheng.common.utils.StringUtils; | |||
import com.tuoheng.system.entity.User; | |||
import com.tuoheng.system.mapper.UserMapper; | |||
import com.tuoheng.system.utils.ShiroUtils; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.stereotype.Service; | |||
/** | |||
* 摄像头Service业务层处理 | |||
* | |||
* @team tuoheng | |||
* @author wanjing | |||
* @date 2023-02-06 | |||
*/ | |||
@Service | |||
public class CameraServiceImpl extends BaseServiceImpl<CameraMapper, Camera> implements ICameraService { | |||
@Autowired | |||
private QueryCameraListService queryCameraListService; | |||
@Autowired | |||
private CameraMapper cameraMapper; | |||
@Autowired | |||
private UserMapper userMapper; | |||
/** | |||
* 查询摄像头列表 | |||
* | |||
* @param request 摄像头 | |||
* @return 摄像头 | |||
*/ | |||
@Override | |||
public JsonResult getList(QueryCameraListRequest request) { | |||
return queryCameraListService.getList(request); | |||
} | |||
/** | |||
* 查询摄像头 | |||
* | |||
* @param id 摄像头主键 | |||
* @return 摄像头 | |||
*/ | |||
@Override | |||
public JsonResult getOneById(Integer id) { | |||
return null; | |||
} | |||
@Override | |||
public JsonResult editInfo(Camera entity) { | |||
//新增 | |||
if (StringUtils.isNull(entity.getId())) { | |||
if (StringUtils.isEmpty(entity.getCameraName())) { | |||
throw new ServiceException("摄像头名称不能为空"); | |||
} | |||
if (ObjectUtil.isEmpty(entity.getCameraType())) { | |||
throw new ServiceException("设备类型不能为空"); | |||
} | |||
if (StringUtils.isEmpty(entity.getLongitude())) { | |||
throw new ServiceException("经度不能为空"); | |||
} | |||
if (StringUtils.isEmpty(entity.getLatitude())) { | |||
throw new ServiceException("纬度不能为空"); | |||
} | |||
if (StringUtils.isEmpty(entity.getFlvUrl())) { | |||
throw new ServiceException("摄像头地址不能为空"); | |||
} | |||
Integer tenantId = ShiroUtils.getTenantId(); | |||
entity.setTenantId(tenantId); | |||
entity.setCreateUser(ShiroUtils.getUserId()); | |||
} | |||
if(StringUtils.isNotEmpty(entity.getLongitude()) && StringUtils.isNotEmpty(entity.getLatitude())){ | |||
String gaodeAddress = GaodeUtil.getGaodeAddress(entity.getLongitude(), entity.getLatitude()); | |||
entity.setLocation(gaodeAddress); | |||
} | |||
entity.setUpdateUser(ShiroUtils.getUserId()); | |||
super.edit(entity); | |||
return JsonResult.success(); | |||
} | |||
@Override | |||
public JsonResult getPage(QueryCameraListRequest request) { | |||
if (null == request.getPage() || null == request.getLimit()) { | |||
throw new ServiceException(ServiceExceptionEnum.PARAMETER_IS_NULL); | |||
} | |||
// 获取分页数据 | |||
IPage<Camera> page = new Page<>(request.getPage(), request.getLimit()); | |||
IPage<Camera> pageData = cameraMapper.selectPage(page, new LambdaQueryWrapper<Camera>() | |||
.eq(Camera::getMark, MarkTypeEnum.VALID.getCode()) | |||
.eq(Camera::getTenantId, ShiroUtils.getTenantId()) | |||
.like(StringUtils.isNotEmpty(request.getCameraName()), Camera::getCameraName, request.getCameraName()) | |||
.orderByDesc(Camera::getCreateTime)); | |||
for (Camera record : pageData.getRecords()) { | |||
User user = userMapper.selectById(record.getUpdateUser()); | |||
if(ObjectUtil.isNotNull(user)){ | |||
record.setUpdateUserName(user.getRealname()); | |||
} | |||
} | |||
return JsonResult.success(pageData); | |||
} | |||
} |
@@ -0,0 +1,47 @@ | |||
package com.tuoheng.admin.service.camera; | |||
import com.tuoheng.admin.entity.domain.Camera; | |||
import com.tuoheng.admin.entity.request.camera.QueryCameraListRequest; | |||
import com.tuoheng.common.common.IBaseService; | |||
import com.tuoheng.common.utils.JsonResult; | |||
/** | |||
* 摄像头Service接口 | |||
* | |||
* @team tuoheng | |||
* @author wanjing | |||
* @date 2023-02-06 | |||
*/ | |||
public interface ICameraService extends IBaseService<Camera> { | |||
/** | |||
* 查询摄像头列表 | |||
* | |||
* @param request 查询摄像头列表实体 | |||
* @return 摄像头集合 | |||
*/ | |||
JsonResult getList(QueryCameraListRequest request); | |||
/** | |||
* 查询摄像头 | |||
* | |||
* @param id 摄像头主键 | |||
* @return 摄像头 | |||
*/ | |||
JsonResult getOneById(Integer id); | |||
/** | |||
* 新增或编辑摄像头 | |||
* @param entity | |||
* @return | |||
*/ | |||
JsonResult editInfo(Camera entity); | |||
/** | |||
* 查询摄像头分页列表 | |||
* | |||
* @param request | |||
* @return | |||
*/ | |||
JsonResult getPage(QueryCameraListRequest request); | |||
} |
@@ -0,0 +1,70 @@ | |||
package com.tuoheng.admin.service.camera.query; | |||
import cn.hutool.core.util.ObjectUtil; | |||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |||
import com.tuoheng.admin.entity.domain.Camera; | |||
import com.tuoheng.admin.enums.MarkTypeEnum; | |||
import com.tuoheng.admin.mapper.CameraMapper; | |||
import com.tuoheng.common.exception.ServiceException; | |||
import com.tuoheng.common.utils.JsonResult; | |||
import com.tuoheng.system.entity.User; | |||
import com.tuoheng.system.utils.ShiroUtils; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.stereotype.Service; | |||
import java.util.Optional; | |||
/** | |||
* 根据Id查询摄像头业务层处理 | |||
* | |||
* @author wanjing | |||
* @team tuoheng | |||
* @date 2022-11-22 | |||
*/ | |||
@Slf4j | |||
@Service | |||
public class QueryCameraByIdService { | |||
@Autowired | |||
private CameraMapper cameraMapper; | |||
public JsonResult getOneById(Integer id) { | |||
// log.info("进入根据Id查询摄像头业务"); | |||
User user = ShiroUtils.getUserInfo(); | |||
Integer tenantId = user.getTenantId(); | |||
JsonResult result = this.check(tenantId, id); | |||
if (0 != result.getCode()) { | |||
log.info("进入根据ID查询摄像头业务:校验失败:{}", result.getMsg()); | |||
return result; | |||
} | |||
Camera camera = (Camera) result.getData(); | |||
return JsonResult.success(camera); | |||
} | |||
/** | |||
* 检查参数 | |||
* | |||
* @param tenantId | |||
* @param id | |||
* @return | |||
*/ | |||
private JsonResult check(Integer tenantId, Integer id) { | |||
// 判断部门id是否为空 | |||
if (Optional.ofNullable(id).orElse(0) == 0) { | |||
log.info("摄像头ID为空, id:{}", id); | |||
throw new ServiceException("摄像头ID为空"); | |||
} | |||
// 判断摄像头是否存在 | |||
Camera camera = cameraMapper.selectOne(new LambdaQueryWrapper<Camera>() | |||
.eq(Camera::getTenantId, tenantId) | |||
.eq(Camera::getId, id) | |||
.eq(Camera::getMark, MarkTypeEnum.VALID)); | |||
if (ObjectUtil.isNull(camera)) { | |||
log.info("摄像头不存在, id:{}", id); | |||
throw new ServiceException("摄像头不存在"); | |||
} | |||
return JsonResult.success(camera); | |||
} | |||
} |
@@ -0,0 +1,59 @@ | |||
package com.tuoheng.admin.service.camera.query; | |||
import cn.hutool.core.collection.CollectionUtil; | |||
import com.tuoheng.admin.entity.domain.Camera; | |||
import com.tuoheng.admin.entity.request.camera.QueryCameraListRequest; | |||
import com.tuoheng.admin.mapper.CameraMapper; | |||
import com.tuoheng.common.utils.JsonResult; | |||
import com.tuoheng.system.entity.User; | |||
import com.tuoheng.system.utils.ShiroUtils; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.stereotype.Service; | |||
import java.util.List; | |||
/** | |||
* 查询监控列表业务层处理 | |||
* | |||
* @author wanjing | |||
* @team tuoheng | |||
* @date 2022-11-22 | |||
*/ | |||
@Slf4j | |||
@Service | |||
public class QueryCameraListService { | |||
@Autowired | |||
private CameraMapper cameraMapper; | |||
public JsonResult getList(QueryCameraListRequest request) { | |||
// log.info("进入查询监控列表业务"); | |||
User user = ShiroUtils.getUserInfo(); | |||
Integer tenantId = user.getTenantId(); | |||
request.setTenantId(tenantId); | |||
JsonResult result = this.check(tenantId, request); | |||
if (0 != result.getCode()) { | |||
log.info("进入查询监控列表业务:校验失败:{}", result.getMsg()); | |||
return result; | |||
} | |||
List<Camera> cameraList = cameraMapper.selectList(request); | |||
if (CollectionUtil.isEmpty(cameraList)) { | |||
log.info("监控列表数据为空"); | |||
} | |||
return JsonResult.success(cameraList); | |||
} | |||
/** | |||
* 检查参数 | |||
* | |||
* @param tenantId | |||
* @param request | |||
* @return | |||
*/ | |||
private JsonResult check(Integer tenantId, QueryCameraListRequest request) { | |||
return JsonResult.success(); | |||
} | |||
} |
@@ -0,0 +1,71 @@ | |||
package com.tuoheng.admin.service.goods; | |||
import cn.hutool.core.util.ObjectUtil; | |||
import com.tuoheng.admin.entity.domain.Goods; | |||
import com.tuoheng.admin.entity.request.goods.QueryGoodsListByWarehouseIdRequest; | |||
import com.tuoheng.admin.mapper.GoodsMapper; | |||
import com.tuoheng.admin.service.goods.query.QueryGoodsListByWarehouseIdService; | |||
import com.tuoheng.admin.utils.GaodeUtil; | |||
import com.tuoheng.common.common.BaseServiceImpl; | |||
import com.tuoheng.common.exception.ServiceException; | |||
import com.tuoheng.common.utils.JsonResult; | |||
import com.tuoheng.common.utils.StringUtils; | |||
import com.tuoheng.system.utils.ShiroUtils; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.stereotype.Service; | |||
/** | |||
* 物资Service业务层处理 | |||
* | |||
* @author wanjing | |||
* @team tuoheng | |||
* @date 2023-02-06 | |||
*/ | |||
@Service | |||
public class GoodsServiceImpl extends BaseServiceImpl<GoodsMapper, Goods> implements IGoodsService { | |||
@Autowired | |||
private QueryGoodsListByWarehouseIdService queryGoodsListService; | |||
/** | |||
* 根据仓库Id查询物资列表 | |||
* | |||
* @param request 查询物资列表实体 | |||
* @return 摄像头集合 | |||
*/ | |||
@Override | |||
public JsonResult getListByWarehouseId(QueryGoodsListByWarehouseIdRequest request) { | |||
return queryGoodsListService.getListByWarehouseId(request); | |||
} | |||
/** | |||
* 查询物资 | |||
* | |||
* @param id 物资主键 | |||
* @return 物资 | |||
*/ | |||
@Override | |||
public JsonResult getOnesById(String id) { | |||
return null; | |||
} | |||
@Override | |||
public JsonResult editInfo(Goods entity) { | |||
//新增 | |||
if (StringUtils.isNull(entity.getId())) { | |||
if (StringUtils.isEmpty(entity.getGoodsName())) { | |||
throw new ServiceException("物资名称不能为空"); | |||
} | |||
if (ObjectUtil.isEmpty(entity.getGoodsType())) { | |||
throw new ServiceException("物资类型不能为空"); | |||
} | |||
Integer tenantId = ShiroUtils.getTenantId(); | |||
entity.setTenantId(tenantId); | |||
entity.setCreateUser(ShiroUtils.getUserId()); | |||
} | |||
entity.setUpdateUser(ShiroUtils.getUserId()); | |||
super.edit(entity); | |||
return JsonResult.success(); | |||
} | |||
} |
@@ -0,0 +1,41 @@ | |||
package com.tuoheng.admin.service.goods; | |||
import com.tuoheng.admin.entity.domain.Goods; | |||
import com.tuoheng.admin.entity.request.goods.QueryGoodsListByWarehouseIdRequest; | |||
import com.tuoheng.common.common.IBaseService; | |||
import com.tuoheng.common.utils.JsonResult; | |||
/** | |||
* 物资Service接口 | |||
* | |||
* @author wanjing | |||
* @team tuoheng | |||
* @date 2023-02-06 | |||
*/ | |||
public interface IGoodsService extends IBaseService<Goods> { | |||
/** | |||
* 根据仓库Id查询物资列表 | |||
* | |||
* @param request 查询物资列表实体 | |||
* @return 摄像头集合 | |||
*/ | |||
JsonResult getListByWarehouseId(QueryGoodsListByWarehouseIdRequest request); | |||
/** | |||
* 查询物资 | |||
* | |||
* @param id 物资主键 | |||
* @return 物资 | |||
*/ | |||
JsonResult getOnesById(String id); | |||
/** | |||
* 新增或编辑物资 | |||
* | |||
* @param entity | |||
* @return | |||
*/ | |||
JsonResult editInfo(Goods entity); | |||
} |
@@ -0,0 +1,79 @@ | |||
package com.tuoheng.admin.service.goods.query; | |||
import cn.hutool.core.collection.CollectionUtil; | |||
import cn.hutool.core.util.ObjectUtil; | |||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |||
import com.tuoheng.admin.entity.domain.Goods; | |||
import com.tuoheng.admin.entity.domain.Warehouse; | |||
import com.tuoheng.admin.entity.request.goods.QueryGoodsListByWarehouseIdRequest; | |||
import com.tuoheng.admin.enums.MarkTypeEnum; | |||
import com.tuoheng.admin.mapper.GoodsMapper; | |||
import com.tuoheng.admin.mapper.WarehouseMapper; | |||
import com.tuoheng.common.exception.ServiceException; | |||
import com.tuoheng.common.utils.JsonResult; | |||
import com.tuoheng.system.entity.User; | |||
import com.tuoheng.system.utils.ShiroUtils; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.stereotype.Service; | |||
import java.util.List; | |||
/** | |||
* 根据仓库ID查询物质表业务层处理 | |||
* | |||
* @author wanjing | |||
* @team tuoheng | |||
* @date 2022-11-22 | |||
*/ | |||
@Slf4j | |||
@Service | |||
public class QueryGoodsListByWarehouseIdService { | |||
@Autowired | |||
private GoodsMapper goodsMapper; | |||
@Autowired | |||
private WarehouseMapper warehouseMapper; | |||
public JsonResult getListByWarehouseId(QueryGoodsListByWarehouseIdRequest request) { | |||
// log.info("进入查询物质列表业务"); | |||
User user = ShiroUtils.getUserInfo(); | |||
Integer tenantId = user.getTenantId(); | |||
request.setTenantId(tenantId); | |||
JsonResult result = this.check(request); | |||
if (0 != result.getCode()) { | |||
log.info("进入查询物质列表业务:校验失败:{}", result.getMsg()); | |||
return result; | |||
} | |||
List<Goods> cameraList = goodsMapper.getListByWarehouseId(request); | |||
if (CollectionUtil.isEmpty(cameraList)) { | |||
log.info("物质列表数据为空"); | |||
} | |||
return JsonResult.success(cameraList); | |||
} | |||
/** | |||
* 检查参数 | |||
* | |||
* @param request | |||
* @return | |||
*/ | |||
private JsonResult check(QueryGoodsListByWarehouseIdRequest request) { | |||
if (ObjectUtil.isNull(request.getWarehouseId())) { | |||
log.info("仓库ID为空, warehouseId:{}", request.getWarehouseId()); | |||
throw new ServiceException("仓库ID为空"); | |||
} | |||
Warehouse warehouse = warehouseMapper.selectOne(new LambdaQueryWrapper<Warehouse>() | |||
.eq(Warehouse::getTenantId, request.getTenantId()) | |||
.eq(Warehouse::getMark, MarkTypeEnum.VALID.getCode()) | |||
.eq(Warehouse::getId, request.getWarehouseId())); | |||
if (ObjectUtil.isNull(warehouse)) { | |||
log.info("仓库不存在, warehouseId:{}", request.getWarehouseId()); | |||
throw new ServiceException("仓库不存在"); | |||
} | |||
return JsonResult.success(); | |||
} | |||
} |
@@ -25,6 +25,7 @@ import com.tuoheng.common.utils.HttpUtils; | |||
import com.tuoheng.common.utils.JacksonUtil; | |||
import com.tuoheng.common.utils.JsonResult; | |||
import com.tuoheng.common.utils.StringUtils; | |||
import com.tuoheng.system.entity.User; | |||
import com.tuoheng.system.utils.ShiroUtils; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.apache.commons.compress.utils.Lists; | |||
@@ -64,7 +65,9 @@ public class IndexServiceImpl implements IndexService { | |||
page.setSize(baseQuery.getLimit() != null ? baseQuery.getLimit() : 10); | |||
page.setCurrent(baseQuery.getPage() != null ? baseQuery.getPage() : 0); | |||
LambdaQueryWrapper<ThMission> queryMission=new LambdaQueryWrapper<>(); | |||
queryMission.eq(ThMission::getMark,MarkTypeEnum.VALID.getCode()).orderByDesc(ThMission::getCreateTime); | |||
queryMission.eq(ThMission::getTenantId,ShiroUtils.getTenantId())//xz | |||
.eq(ThMission::getMark,MarkTypeEnum.VALID.getCode()) | |||
.orderByDesc(ThMission::getCreateTime); | |||
queryMission.in(ThMission::getStatus, Arrays.asList(TaskStatusEnum.FLIGHT.getCode(),TaskStatusEnum.WAIT.getCode())); | |||
IPage<ThMission> thMissionIPage = thMissionMapper.selectPage(page, queryMission); | |||
List<ThMission> records = thMissionIPage.getRecords(); | |||
@@ -86,29 +89,37 @@ public class IndexServiceImpl implements IndexService { | |||
} | |||
@Override | |||
public JsonResult getAirportDetail(GetAirportDetailDto getAirportDetailDto){ | |||
Tenant tenant = tenantMapper.selectById(ShiroUtils.getTenantId()); | |||
String url = tenant.getAirportUrl() +"/api/airportInterface/getAirportStatus"; | |||
String param = "airportId=" + getAirportDetailDto.getAirportId(); | |||
public JsonResult getAirportDetail(Integer airportId){ | |||
String url = CommonConfig.airportURL + "/api/airportInterface/getAirportStatus"; | |||
String param = "airportId=" + airportId; | |||
String result = HttpUtils.sendGet(url, param); | |||
JsonResult jsonResult = JacksonUtil.json2pojo(result, JsonResult.class); | |||
AirportDetailDto airportDetailDto = new AirportDetailDto(); | |||
JSONObject dataObject = (JSONObject) JSONObject.toJSON(jsonResult.getData()); | |||
JSONObject wthJson = dataObject.getJSONObject("WTH"); | |||
if(Objects.nonNull(wthJson)){ | |||
JSONObject parmJson = wthJson.getJSONObject("parm"); | |||
JSONObject parmJson = wthJson.getJSONObject("parmNew"); | |||
BigDecimal hum = parmJson.getBigDecimal("Hum").divide(new BigDecimal(10), 1, BigDecimal.ROUND_HALF_UP); | |||
airportDetailDto.setHum(hum + "rh"); | |||
BigDecimal tmp = parmJson.getBigDecimal("Tmp").divide(new BigDecimal(10), 1, BigDecimal.ROUND_HALF_UP); | |||
airportDetailDto.setTmp(tmp + "℃"); | |||
airportDetailDto.setWspd(parmJson.getString("WSPD") + "m/s") | |||
.setWdir(parmJson.getString("WDIR") + "度"); | |||
.setWdir(parmJson.getString("WDIR") + "度") | |||
.setRainfull(parmJson.getString("Rainfull") + "mm") | |||
.setWdirName(parmJson.getString("WDIRNAME")); | |||
//用角度表示风向,是把圆周分成360度,北风(N)是0度(即360度),东风(E)是90度,南风(S)是180度,西风(W)是270度 | |||
BigDecimal hpa = parmJson.getBigDecimal("Hpa"); | |||
if(hpa != null){ | |||
BigDecimal mpa = hpa.divide(new BigDecimal(100000), 1, BigDecimal.ROUND_HALF_UP); | |||
airportDetailDto.setHpa(mpa + "Mpa"); | |||
airportDetailDto.setHpa(hpa + "Mpa"); | |||
} | |||
} | |||
JSONObject tahJson = dataObject.getJSONObject("TAH"); | |||
if(Objects.nonNull(tahJson)){ | |||
JSONObject parmJson = wthJson.getJSONObject("parm"); | |||
JSONObject parmJson = tahJson.getJSONObject("parmNew"); | |||
BigDecimal hum = parmJson.getBigDecimal("Hum").divide(new BigDecimal(10), 1, BigDecimal.ROUND_HALF_UP); | |||
airportDetailDto.setHum(hum + "rh"); | |||
BigDecimal tmp = parmJson.getBigDecimal("Tmp").divide(new BigDecimal(10), 1, BigDecimal.ROUND_HALF_UP); | |||
@@ -128,10 +139,12 @@ public class IndexServiceImpl implements IndexService { | |||
@Override | |||
@Transactional(readOnly = true) | |||
public List<QuestionListDto> getQuestionList(GetQuestionListDto getQuestionListDto){ | |||
getQuestionListDto.setTenantId(ShiroUtils.getTenantId());//新增 | |||
if(ObjectUtil.isNotEmpty(getQuestionListDto.getStartTime()) && ObjectUtil.isNotEmpty(getQuestionListDto.getEndTime())){ | |||
getQuestionListDto.setStartTime(getQuestionListDto.getStartTime() + " 00:00:00"); | |||
getQuestionListDto.setEndTime(getQuestionListDto.getEndTime() + " 23:59:59"); | |||
} | |||
List<QuestionListDto> questionListDtoList = questionMapper.getIndexQuestion(getQuestionListDto); | |||
for(QuestionListDto questionListDto : questionListDtoList){ | |||
if(questionListDto.getHandlerImage() != null){ |
@@ -1,10 +1,10 @@ | |||
package com.tuoheng.admin.service.impl; | |||
import cn.hutool.core.collection.CollectionUtil; | |||
import cn.hutool.core.util.ObjectUtil; | |||
import com.alibaba.fastjson.JSONArray; | |||
import com.alibaba.fastjson.JSONObject; | |||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | |||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; | |||
import com.baomidou.mybatisplus.core.metadata.IPage; | |||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |||
@@ -13,7 +13,11 @@ import com.tuoheng.admin.entity.domain.*; | |||
import com.tuoheng.admin.entity.request.MissionRequest; | |||
import com.tuoheng.admin.entity.request.MissionQuery; | |||
import com.tuoheng.admin.entity.request.MissionStatusRequest; | |||
import com.tuoheng.admin.entity.request.airport.ExecuteTaskStatusRequest; | |||
import com.tuoheng.admin.entity.request.emergency.QueryEmergencyListRequest; | |||
import com.tuoheng.admin.entity.request.emergency.QueryMissionListRequest; | |||
import com.tuoheng.admin.entity.vo.AirWeatherVO; | |||
import com.tuoheng.admin.entity.vo.LiveChannelVO; | |||
import com.tuoheng.admin.entity.vo.MissionLiveVO; | |||
import com.tuoheng.admin.entity.vo.MissionVO; | |||
import com.tuoheng.admin.enums.*; | |||
@@ -21,18 +25,18 @@ import com.tuoheng.admin.mapper.*; | |||
import com.tuoheng.admin.service.IDspService; | |||
import com.tuoheng.admin.service.IMissionService; | |||
import com.tuoheng.admin.service.IThInspectionService; | |||
import com.tuoheng.admin.service.mission.query.QueryEmergencyListService; | |||
import com.tuoheng.admin.service.mission.query.QueryMissionListService; | |||
import com.tuoheng.admin.service.third.airport.AirportCallBackUpdateStatusService; | |||
import com.tuoheng.admin.utils.CodeUtil; | |||
import com.tuoheng.admin.utils.TimeUtil; | |||
import com.tuoheng.admin.utils.WeatherUtil; | |||
import com.tuoheng.common.common.BaseServiceImpl; | |||
import com.tuoheng.common.common.OperationEnum; | |||
import com.tuoheng.common.config.CommonConfig; | |||
import com.tuoheng.common.exception.ServiceException; | |||
import com.tuoheng.common.utils.*; | |||
import com.tuoheng.system.entity.User; | |||
import com.tuoheng.system.mapper.UserMapper; | |||
import com.tuoheng.system.utils.ShiroUtils; | |||
import io.swagger.models.auth.In; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.springframework.beans.BeanUtils; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
@@ -40,7 +44,6 @@ import org.springframework.beans.factory.annotation.Value; | |||
import org.springframework.context.annotation.Lazy; | |||
import org.springframework.http.HttpStatus; | |||
import org.springframework.stereotype.Service; | |||
import org.springframework.transaction.annotation.Transactional; | |||
import org.springframework.util.Assert; | |||
import javax.annotation.Resource; | |||
@@ -68,9 +71,6 @@ public class MissionServiceImpl extends BaseServiceImpl<ThMissionMapper, ThMissi | |||
@Autowired | |||
private ReportMapper reportMapper; | |||
@Autowired | |||
private IDspService dspService; | |||
@Autowired | |||
private UserMapper userMapper; | |||
@@ -78,9 +78,14 @@ public class MissionServiceImpl extends BaseServiceImpl<ThMissionMapper, ThMissi | |||
@Lazy | |||
private IThInspectionService inspectionService; | |||
@Value("${tuoheng.dsp-callback-url:}") | |||
private String dspCallbackUrl; | |||
@Resource | |||
private QueryMissionListService queryMissionListService; | |||
@Resource | |||
private QueryEmergencyListService queryEmergencyListService; | |||
@Resource | |||
private AirportCallBackUpdateStatusService airportCallBackUpdateStatusService; | |||
@Override | |||
public Integer addMission(MissionRequest addThMissionRequest) throws ServiceException { | |||
@@ -91,8 +96,10 @@ public class MissionServiceImpl extends BaseServiceImpl<ThMissionMapper, ThMissi | |||
BeanUtils.copyProperties(addThMissionRequest,tm); | |||
//任务名称不能重复 | |||
List<ThMission> thMissions = thMissionMapper.selectList(new LambdaQueryWrapper<ThMission>().eq(ThMission::getName, addThMissionRequest.getName()) | |||
.eq(ThMission::getMark, MarkTypeEnum.VALID.getCode())); | |||
List<ThMission> thMissions = thMissionMapper.selectList(new LambdaQueryWrapper<ThMission>() | |||
.eq(ThMission::getTenantId, ShiroUtils.getTenantId())//xz | |||
.eq(ThMission::getName, addThMissionRequest.getName()) | |||
.eq(ThMission::getMark, MarkTypeEnum.VALID.getCode())); | |||
if(thMissions.size()>0){ | |||
throw new ServiceException(HttpStatus.BAD_REQUEST.value(),"任务名称不能重复!"); | |||
@@ -102,6 +109,7 @@ public class MissionServiceImpl extends BaseServiceImpl<ThMissionMapper, ThMissi | |||
String code = "XJRW" +CodeUtil.createCodeNo(); | |||
tm.setCode(code); | |||
tm.setReportStatus(ReportStatusEnum.GENERATE.getCode()); | |||
tm.setTenantId(ShiroUtils.getTenantId());//xz | |||
thMissionMapper.insert(tm); | |||
return tm.getId(); | |||
} | |||
@@ -112,147 +120,72 @@ public class MissionServiceImpl extends BaseServiceImpl<ThMissionMapper, ThMissi | |||
return thMissionMapper.selectList(lambdaQueryWrapper); | |||
} | |||
/** | |||
* 被硬件调用,执行任务后,回调执行状态 | |||
*/ | |||
@Override | |||
public boolean updateStatus(MissionStatusRequest missionStatusRequest) throws ServiceException { | |||
//如果发送过来的状态是执行中,那么就说明之前是待执行,查询等待执行的数据,开始飞行 | |||
if(AirPortTaskStatusEnum.FLIGHT.getCode()==missionStatusRequest.getStatus()){ | |||
ThMission thMission = getRecentlyRecord(missionStatusRequest,TaskStatusEnum.WAIT.getCode()); | |||
Assert.notNull(thMission, "飞行任务不能为空!"); | |||
ThMission thMissionUpdate = setStatus(missionStatusRequest, thMission,AirPortTaskStatusEnum.FLIGHT); | |||
//开始分析 | |||
try { | |||
JSONObject jsonObject = startAI(missionStatusRequest); | |||
thMissionUpdate.setRequestId(jsonObject.getJSONObject("data").getString("requestId")); | |||
thMissionUpdate.setAipullUrl(jsonObject.getJSONObject("data").getString("aipullUrl")); | |||
thMissionUpdate.setAipushUrl(jsonObject.getJSONObject("data").getString("aipushUrl")); | |||
thMissionUpdate.setPlayUrl(jsonObject.getJSONObject("data").getString("playUrl")); | |||
thMissionUpdate.setAiplayUrl(jsonObject.getJSONObject("data").getString("aiplayUrl")); | |||
thMissionUpdate.setAnalyseStatus(AiAnalyseStatusEnum.WAITING.getCode()); | |||
}catch (ServiceException e){ | |||
//如果调用DSP失败就直接失败! | |||
log.error("调用DSP数据失败:{}",e.getMessage()); | |||
thMissionUpdate.setStatus(TaskStatusEnum.FAIL.getCode()); | |||
thMissionMapper.updateById(thMissionUpdate); | |||
throw new ServiceException(HttpStatus.BAD_REQUEST.value(),"任务分析失败!"); | |||
} | |||
log.info("修改飞行状态:{}",JSONObject.toJSONString(thMissionUpdate)); | |||
return thMissionMapper.updateById(thMissionUpdate) > 0; | |||
}else if(AirPortTaskStatusEnum.WAIT.getCode()==missionStatusRequest.getStatus()){ | |||
//硬件停止后,停止AI分析 | |||
return stopAI(missionStatusRequest); | |||
}else{ | |||
throw new ServiceException(ServiceExceptionEnum.TASK_NOT_STATUS); | |||
public JsonResult updateExecuteTaskStatus(ExecuteTaskStatusRequest executeTaskStatusRequest) { | |||
JsonResult result = this.check(executeTaskStatusRequest); | |||
if (0 != result.getCode()) { | |||
log.info("被硬件调用,执行任务后,回调执行状态业务:校验失败:{}", result.getMsg()); | |||
return result; | |||
} | |||
} | |||
private JSONObject startAI(MissionStatusRequest missionStatusRequest) throws ServiceException { | |||
//任务调用完成之后,调用发送通道,请求DSP需要分析 | |||
//调用DSP接口 | |||
JSONObject request = new JSONObject(); | |||
JSONArray configList = new JSONArray(); | |||
JSONObject instConfigMode = new JSONObject(); | |||
instConfigMode.put("ename","service_mode"); | |||
instConfigMode.put("evalue","1"); | |||
configList.add(instConfigMode); | |||
JSONObject instConfigUrl = new JSONObject(); | |||
instConfigUrl.put("ename","callback_url"); | |||
instConfigUrl.put("evalue",dspCallbackUrl); | |||
configList.add(instConfigUrl); | |||
request.put("serviceInstConfigList",configList); | |||
JSONArray reqList = new JSONArray(); | |||
JSONObject instReqUrlPush = new JSONObject(); | |||
instReqUrlPush.put("ename","push_url"); | |||
instReqUrlPush.put("evalue", missionStatusRequest.getPushUrl()); | |||
reqList.add(instReqUrlPush); | |||
JSONObject instReqUrlPull = new JSONObject(); | |||
instReqUrlPull.put("ename","pull_url"); | |||
instReqUrlPull.put("evalue", missionStatusRequest.getPullUrl()); | |||
reqList.add(instReqUrlPull); | |||
request.put("serviceInstReqList", reqList); | |||
JSONObject responseJson = dspService.serviceInstApplication(request); | |||
if(responseJson.getIntValue("code") == 0){ | |||
String requestId = responseJson.getJSONObject("data").getString("requestId"); | |||
log.info("dsp实时调用响应requestId:{}",requestId); | |||
}else { | |||
log.error("dsp实时调用失败:{}", responseJson); | |||
throw new ServiceException(HttpStatus.BAD_REQUEST.value(),"任务失败!"); | |||
ThMission mission = (ThMission) result.getData(); | |||
if (!"0".equals(executeTaskStatusRequest.getCode())) { | |||
log.info("被硬件调用,执行任务后,回调执行状态业务, 机场接口返回结果:失败:{}", executeTaskStatusRequest.getMsg()); | |||
mission.setStatus(TaskStatusEnum.FAIL.getCode()); | |||
this.updateMission(null, mission); | |||
} else { | |||
mission.setStatus(TaskStatusEnum.FLIGHT.getCode()); | |||
this.updateMission(null, mission); | |||
} | |||
return responseJson; | |||
log.info("被硬件调用,任务执行后,回调执行状态业务成功"); | |||
return JsonResult.success("被硬件调用,任务执行后,回调执行状态业务成功"); | |||
} | |||
private Boolean stopAI(MissionStatusRequest missionStatusRequest) { | |||
ThMission thMission = getRecentlyRecord(missionStatusRequest,TaskStatusEnum.FLIGHT.getCode()); | |||
Assert.notNull(thMission, "飞行任务不能为空!"); | |||
ThMission thMissionUpdate = new ThMission(UpdateOrCreateEnum.UPDATE.getCode()); | |||
thMissionUpdate.setId(thMission.getId()); | |||
thMissionUpdate.setMileage(missionStatusRequest.getMileage()); | |||
boolean result=false; | |||
try { | |||
AirWeatherVO weather = inspectionService.getWeather(thMission.getAirportId()); | |||
String weatherStr = WeatherUtil.getWeather(weather); | |||
thMissionUpdate.setWeather(weatherStr); | |||
}catch (Exception e){ | |||
thMissionUpdate.setWeather(""); | |||
log.info("获取天气信息失败,请重试"); | |||
} | |||
//任务调用完成之后,调用发送通道,请求DSP关闭请求 | |||
//调用DSP接口 | |||
JSONObject jsonObject = new JSONObject(); | |||
jsonObject.put("requestId",thMission.getRequestId()); | |||
JSONObject responseJson=new JSONObject(); | |||
try { | |||
responseJson = dspService.serviceStopApplication(jsonObject); | |||
if(responseJson.getIntValue("code") == 0){ | |||
if(responseJson.containsKey("data") && ObjectUtil.isNotEmpty(responseJson.get("data"))) { | |||
String requestId = responseJson.getJSONObject("data").getString("requestId"); | |||
log.info("dsp实时调用响应requestId:{}", requestId); | |||
}else{ | |||
log.info("dsp实时调用响应:{}",responseJson); | |||
} | |||
result=true; | |||
}else { | |||
log.error("dsp实时调用失败:{}", responseJson); | |||
thMissionUpdate.setAnalyseStatus(AiAnalyseStatusEnum.FAILED.getCode()); | |||
} | |||
thMissionMapper.updateById(thMissionUpdate); | |||
}catch (Exception e){ | |||
log.error("dsp实时调用失败:{}", responseJson); | |||
thMissionUpdate.setAnalyseStatus(AiAnalyseStatusEnum.FAILED.getCode()); | |||
thMissionMapper.updateById(thMissionUpdate); | |||
/** | |||
* 检查参数 | |||
* | |||
* @param executeTaskStatusRequest | |||
* @return | |||
*/ | |||
private JsonResult check(ExecuteTaskStatusRequest executeTaskStatusRequest) { | |||
//查询出对应的巡检任务 | |||
ThMission mission = thMissionMapper.selectOne(new LambdaQueryWrapper<ThMission>() | |||
.eq(ThMission::getMark, MarkEnum.VALID.getCode()) | |||
.eq(ThMission::getId, executeTaskStatusRequest.getRequestId())); | |||
if (ObjectUtil.isEmpty(mission)) { | |||
log.info("任务不存在, missionId:{}", executeTaskStatusRequest.getRequestId()); | |||
return JsonResult.error(500, "任务不存在" + executeTaskStatusRequest.getRequestId()); | |||
} | |||
return result; | |||
return JsonResult.success(mission); | |||
} | |||
private ThMission setStatus(MissionStatusRequest missionStatusRequest, ThMission thMission,AirPortTaskStatusEnum airPortTaskStatusEnum) { | |||
ThMission thMissionUpdate = new ThMission(UpdateOrCreateEnum.UPDATE.getCode()); | |||
thMissionUpdate.setId(thMission.getId()); | |||
if(missionStatusRequest.getStatus()==AirPortTaskStatusEnum.FLIGHT.getCode() && airPortTaskStatusEnum.getCode()==AirPortTaskStatusEnum.FLIGHT.getCode()) { | |||
thMissionUpdate.setPushUrl(missionStatusRequest.getPushUrl()); | |||
thMissionUpdate.setPullUrl(missionStatusRequest.getPullUrl()); | |||
thMissionUpdate.setStatus(TaskStatusEnum.FLIGHT.getCode()); | |||
} | |||
return thMissionUpdate; | |||
/** | |||
* 修改任务执行时数据 | |||
* | |||
* @param userId | |||
* @param mission | |||
*/ | |||
private void updateMission(Integer userId, ThMission mission) { | |||
mission.setStatus(mission.getStatus()); | |||
mission.setUpdateUser(userId); | |||
mission.setUpdateTime(DateUtils.now()); | |||
mission.setExecutionStartTime(DateUtils.now()); | |||
thMissionMapper.updateById(mission); | |||
} | |||
private ThMission getRecentlyRecord(MissionStatusRequest missionStatusRequest,Integer status) { | |||
//获取当前任务里面这个巡检的最近的那一条,修改对应的任务的状态 | |||
LambdaQueryWrapper<ThMission> lambdaQueryWrapper=new LambdaQueryWrapper<>(); | |||
lambdaQueryWrapper.orderByAsc(ThMission::getExecutionStartTime); | |||
lambdaQueryWrapper.eq(ThMission::getInspectionLine, missionStatusRequest.getId()); | |||
lambdaQueryWrapper.eq(ThMission::getId,missionStatusRequest.getRequestId()); | |||
lambdaQueryWrapper.eq(ThMission::getStatus,status); | |||
//lambdaQueryWrapper.eq(ThMission::getTenantId,ShiroUtils.getTenantId()); | |||
List<ThMission> thMissions = thMissionMapper.selectList(lambdaQueryWrapper); | |||
return thMissions.size()>0? thMissions.get(0) : null; | |||
/** | |||
* 机场平台回调,修改任务状态 | |||
* | |||
* @param request | |||
* @return | |||
* @throws ServiceException | |||
*/ | |||
@Override | |||
public boolean updateStatus(MissionStatusRequest request) throws ServiceException { | |||
return airportCallBackUpdateStatusService.updateStatus(request); | |||
} | |||
@Override | |||
@@ -260,10 +193,11 @@ public class MissionServiceImpl extends BaseServiceImpl<ThMissionMapper, ThMissi | |||
Page<ThMission> page = new Page<>(); | |||
page.setSize(queryInspectionRequest.getLimit()); | |||
page.setCurrent(queryInspectionRequest.getPage()); | |||
queryInspectionRequest.setTenantId(ShiroUtils.getTenantId()); | |||
LambdaQueryWrapper<ThMission> queryMission=new LambdaQueryWrapper<>(); | |||
queryParam(queryInspectionRequest, queryMission); | |||
queryMission.eq(ThMission::getMark,MarkTypeEnum.VALID.getCode()).orderByDesc(ThMission::getCreateTime); | |||
queryMission.eq(ThMission::getTenantId, ShiroUtils.getTenantId())//xz | |||
.eq(ThMission::getMark,MarkTypeEnum.VALID.getCode()) | |||
.orderByDesc(ThMission::getCreateTime); | |||
IPage<ThMission> thMissionIPage = thMissionMapper.selectPage(page, queryMission); | |||
List<ThMission> records = thMissionIPage.getRecords(); | |||
@@ -339,7 +273,9 @@ public class MissionServiceImpl extends BaseServiceImpl<ThMissionMapper, ThMissi | |||
@Override | |||
public MissionVO findById(Integer id) { | |||
MissionVO missionVO=new MissionVO(); | |||
BeanUtils.copyProperties(thMissionMapper.selectById(id),missionVO); | |||
LambdaQueryWrapper<ThMission> queryWrapper = new LambdaQueryWrapper<>();//xz | |||
queryWrapper.eq(ThMission::getTenantId, ShiroUtils.getTenantId()).eq(ThMission::getId, id);//xz | |||
BeanUtils.copyProperties(thMissionMapper.selectOne(queryWrapper),missionVO);//xz | |||
return missionVO; | |||
} | |||
@@ -350,6 +286,7 @@ public class MissionServiceImpl extends BaseServiceImpl<ThMissionMapper, ThMissi | |||
ThMission mission=new ThMission(UpdateOrCreateEnum.UPDATE.getCode()); | |||
mission.setMark(MarkTypeEnum.NOTVALID.getCode()); | |||
boolean result=false; | |||
//如果成功更新 | |||
if(thMissionMapper.update(mission,new LambdaUpdateWrapper<ThMission>().in(ThMission::getId,idList))>0){ | |||
Integer missionId = mission.getId(); | |||
questionMapper.delete(new LambdaQueryWrapper<Question>().eq(Question::getMissionId,missionId)); | |||
@@ -364,6 +301,7 @@ public class MissionServiceImpl extends BaseServiceImpl<ThMissionMapper, ThMissi | |||
public MissionLiveVO live(Integer id) { | |||
//根据机场的Id查询出来直播的对象 | |||
LambdaQueryWrapper<ThMission> lambdaQueryWrapper=new LambdaQueryWrapper<>(); | |||
lambdaQueryWrapper.eq(ThMission::getTenantId,ShiroUtils.getTenantId());//xz | |||
lambdaQueryWrapper.eq(ThMission::getMark,MarkTypeEnum.VALID.getCode()); | |||
lambdaQueryWrapper.eq(ThMission::getAirportId,id); | |||
lambdaQueryWrapper.eq(ThMission::getStatus,TaskStatusEnum.FLIGHT.getCode()).orderByDesc(ThMission::getExecutionStartTime); | |||
@@ -378,4 +316,47 @@ public class MissionServiceImpl extends BaseServiceImpl<ThMissionMapper, ThMissi | |||
return missionLiveVO; | |||
} | |||
@Override | |||
public JsonResult getVideoById(String id) { | |||
if (StringUtils.isEmpty(id)) { | |||
return JsonResult.error(QueryVideoServiceEnum.MISSION_ID_IS_NULL.getCode(), QueryVideoServiceEnum.MISSION_ID_IS_NULL.getMsg()); | |||
} | |||
LambdaQueryWrapper<ThMission> queryWrapper = new LambdaQueryWrapper<>(); | |||
queryWrapper.eq(ThMission::getTenantId, ShiroUtils.getTenantId()).eq(ThMission::getId, id); | |||
ThMission thMission = thMissionMapper.selectOne(queryWrapper);//xz | |||
if (ObjectUtil.isNull(thMission)) { | |||
return JsonResult.error(QueryVideoServiceEnum.MISSION_IS_NOT_EXIST.getCode(), QueryVideoServiceEnum.MISSION_IS_NOT_EXIST.getMsg()); | |||
} | |||
LiveChannelVO liveChannelVo = new LiveChannelVO(); | |||
if(TaskStatusEnum.FLIGHT.getCode() == thMission.getStatus()){ | |||
//任务飞行中进行直播 | |||
if(StringUtils.isNotEmpty(thMission.getAipullUrl())){ | |||
liveChannelVo.setAiPullUrl(thMission.getAipullUrl()); | |||
} | |||
} | |||
if(TaskStatusEnum.COMPLETE.getCode() == thMission.getStatus()){ | |||
//任务飞行完成,回放视频 | |||
if(StringUtils.isNotEmpty(thMission.getAiVideoUrl())){ | |||
liveChannelVo.setAiVideoUrl(thMission.getAiVideoUrl()); | |||
} | |||
} | |||
return JsonResult.success(liveChannelVo); | |||
} | |||
/** | |||
* 查询任务列表 | |||
* | |||
* @return | |||
*/ | |||
@Override | |||
public JsonResult getList(QueryMissionListRequest request) { | |||
return queryMissionListService.getList(request); | |||
} | |||
@Override | |||
public JsonResult getEmergencyList(QueryEmergencyListRequest request) { | |||
return queryEmergencyListService.getList(request); | |||
} | |||
} |
@@ -3,6 +3,7 @@ package com.tuoheng.admin.service.impl; | |||
import cn.hutool.core.util.ObjectUtil; | |||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; | |||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; | |||
import com.baomidou.mybatisplus.core.metadata.IPage; | |||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |||
import com.tuoheng.admin.common.ServiceExceptionEnum; | |||
@@ -16,16 +17,22 @@ import com.tuoheng.admin.enums.*; | |||
import com.tuoheng.admin.mapper.*; | |||
import com.tuoheng.admin.service.IQuestionService; | |||
import com.tuoheng.admin.service.IQuestionTypeService; | |||
import com.tuoheng.admin.service.third.dsp.DspCallBackService; | |||
import com.tuoheng.admin.service.warning.IWarningService; | |||
import com.tuoheng.admin.service.warning.WarningServiceImpl; | |||
import com.tuoheng.admin.utils.GaodeUtil; | |||
import com.tuoheng.admin.utils.TimeUtil; | |||
import com.tuoheng.common.common.BaseServiceImpl; | |||
import com.tuoheng.common.exception.ServiceException; | |||
import com.tuoheng.common.utils.JsonResult; | |||
import com.tuoheng.common.utils.StringUtils; | |||
import com.tuoheng.system.utils.ShiroUtils; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.springframework.beans.BeanUtils; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.http.HttpStatus; | |||
import org.springframework.stereotype.Service; | |||
import org.springframework.transaction.annotation.Propagation; | |||
import org.springframework.transaction.annotation.Transactional; | |||
import org.springframework.util.CollectionUtils; | |||
@@ -40,6 +47,7 @@ import java.util.*; | |||
* @since 2022-08-03 | |||
*/ | |||
@Service | |||
@Slf4j | |||
public class QuestionServiceImpl extends BaseServiceImpl<QuestionMapper, Question> implements IQuestionService { | |||
@Autowired | |||
@@ -60,48 +68,52 @@ public class QuestionServiceImpl extends BaseServiceImpl<QuestionMapper, Questio | |||
@Autowired | |||
private IQuestionTypeService questionTypeService; | |||
@Autowired | |||
private DspCallBackService dspCallBackService; | |||
private final static SimpleDateFormat dateformat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | |||
@Override | |||
@Transactional(readOnly = true) | |||
public IPage<QuestionVO> queryPage(QuestionQuery query) throws ParseException { | |||
if(null == query.getPage() || null == query.getLimit()){ | |||
if (null == query.getPage() || null == query.getLimit()) { | |||
throw new ServiceException(ServiceExceptionEnum.PARAMETER_IS_NULL); | |||
} | |||
// 获取分页数据 | |||
IPage<Question> page = new Page<>(query.getPage(), query.getLimit()); | |||
LambdaQueryWrapper<Question> questionLambdaQueryWrapper = new LambdaQueryWrapper<Question>() | |||
.eq(Question::getTenantId, ShiroUtils.getTenantId())//xz | |||
.eq(ObjectUtil.isNotEmpty(query.getMissionId()), Question::getMissionId, query.getMissionId()) | |||
.like(ObjectUtil.isNotEmpty(query.getName()), Question::getMissionName, query.getName()) | |||
.eq(ObjectUtil.isNotEmpty(query.getType()), Question::getType, query.getType()) | |||
.eq(ObjectUtil.isNotEmpty(query.getStatus()), Question::getStatus, query.getStatus()) | |||
//.eq(Question::getTenantId, ShiroUtils.getTenantId()) | |||
.eq(Question::getMark, MarkTypeEnum.VALID.getCode()).orderByDesc(Question::getCreateTime); | |||
if(ObjectUtil.isNotEmpty(query.getStartTime()) && ObjectUtil.isNotEmpty(query.getEndTime())){ | |||
query.setStartTime(query.getStartTime()+" 00:00:00"); | |||
query.setEndTime(query.getEndTime()+" 23:59:59"); | |||
if (ObjectUtil.isNotEmpty(query.getStartTime()) && ObjectUtil.isNotEmpty(query.getEndTime())) { | |||
query.setStartTime(query.getStartTime() + " 00:00:00"); | |||
query.setEndTime(query.getEndTime() + " 23:59:59"); | |||
questionLambdaQueryWrapper.between(Question::getCreateTime, dateformat.parse(query.getStartTime()), dateformat.parse(query.getEndTime())); | |||
} | |||
IPage<Question> pageData = questionMapper.selectPage(page, questionLambdaQueryWrapper); | |||
List<Question> questions = pageData.getRecords(); | |||
List<QuestionVO> questionVOList = new ArrayList<>(); | |||
questions.forEach(question->{ | |||
questions.forEach(question -> { | |||
QuestionVO questionVO = new QuestionVO(); | |||
BeanUtils.copyProperties(question,questionVO); | |||
BeanUtils.copyProperties(question, questionVO); | |||
LambdaQueryWrapper<WorkOrderQuestion> lambdaQueryWrapper = new LambdaQueryWrapper<>(); | |||
lambdaQueryWrapper.eq(WorkOrderQuestion::getQuestionId, question.getId()); | |||
lambdaQueryWrapper.eq(WorkOrderQuestion::getTenantId, question.getTenantId())//xz | |||
.eq(WorkOrderQuestion::getQuestionId, question.getId()); | |||
WorkOrderQuestion workOrderQuestion = workOrderQuestionMapper.selectOne(lambdaQueryWrapper); | |||
if(workOrderQuestion != null){ | |||
if (workOrderQuestion != null) { | |||
questionVO.setWordOrderStatus(1); | |||
questionVO.setHandleStatus(workOrderQuestion.getStatus()); | |||
}else { | |||
} else { | |||
questionVO.setWordOrderStatus(0); | |||
questionVO.setHandleStatus(0); | |||
} | |||
questionVOList.add(questionVO); | |||
}); | |||
IPage<QuestionVO> resultPage=new Page<>(); | |||
IPage<QuestionVO> resultPage = new Page<>(); | |||
resultPage.setCurrent(pageData.getCurrent()); | |||
resultPage.setPages(pageData.getPages()); | |||
resultPage.setSize(pageData.getSize()); | |||
@@ -114,38 +126,40 @@ public class QuestionServiceImpl extends BaseServiceImpl<QuestionMapper, Questio | |||
@Override | |||
public List<Question> distributed(QuestionQuery query) { | |||
List<ThMission> thMissions = missionMapper.selectList(new LambdaQueryWrapper<ThMission>() | |||
.eq(ThMission::getMark, MarkTypeEnum.VALID.getCode()) | |||
.in(ThMission::getStatus, Arrays.asList(TaskStatusEnum.FLIGHT.getCode(),TaskStatusEnum.FAIL.getCode(),TaskStatusEnum.COMPLETE.getCode())) | |||
.orderByDesc(ThMission::getUpdateTime)); | |||
return getQuestions(query, thMissions); | |||
.eq(ThMission::getTenantId, ShiroUtils.getTenantId()) | |||
.eq(ThMission::getType, AccidentTaskEnum.INSPECTION_TASK.getCode()) | |||
.eq(ThMission::getMark, MarkTypeEnum.VALID.getCode()) | |||
.in(ThMission::getStatus, Arrays.asList(TaskStatusEnum.FLIGHT.getCode(), TaskStatusEnum.FAIL.getCode(), TaskStatusEnum.COMPLETE.getCode())) | |||
.orderByDesc(ThMission::getUpdateTime)); | |||
return this.getQuestions(query, thMissions); | |||
} | |||
private List<Question> getQuestions(QuestionQuery query, List<ThMission> thMissions) { | |||
if(thMissions.size()==0){ | |||
if (thMissions.size() == 0) { | |||
return new ArrayList<>(); | |||
} | |||
try { | |||
LambdaQueryWrapper<Question> questionLambdaQueryWrapper = new LambdaQueryWrapper<Question>() | |||
.eq(ObjectUtil.isNotEmpty(query.getType()), Question::getType, query.getType()) | |||
.eq(Question::getStatus, QuestionStatusEnum.CONFIRM.getCode()) | |||
//.eq(Question::getTenantId, ShiroUtils.getTenantId()) | |||
.eq(Question::getTenantId, ShiroUtils.getTenantId())//xz | |||
.eq(Question::getMark, MarkTypeEnum.VALID.getCode()).orderByDesc(Question::getCreateTime); | |||
if(ObjectUtil.isNotEmpty(query.getStartTime()) && ObjectUtil.isNotEmpty(query.getEndTime())){ | |||
query.setStartTime(query.getStartTime()+" 00:00:00"); | |||
query.setEndTime(query.getEndTime()+" 23:59:59"); | |||
if (ObjectUtil.isNotEmpty(query.getStartTime()) && ObjectUtil.isNotEmpty(query.getEndTime())) { | |||
query.setStartTime(query.getStartTime() + " 00:00:00"); | |||
query.setEndTime(query.getEndTime() + " 23:59:59"); | |||
questionLambdaQueryWrapper.between(Question::getCreateTime, dateformat.parse(query.getStartTime()), dateformat.parse(query.getEndTime())); | |||
} | |||
if((ObjectUtil.isNotEmpty(query.getStartTime()) && ObjectUtil.isNotEmpty(query.getEndTime())) | |||
|| StringUtils.isNotEmpty(query.getMissionName())){ | |||
if ((ObjectUtil.isNotEmpty(query.getStartTime()) && ObjectUtil.isNotEmpty(query.getEndTime())) | |||
|| StringUtils.isNotEmpty(query.getMissionName())) { | |||
questionLambdaQueryWrapper.like(StringUtils.isNotEmpty(query.getMissionName()), Question::getMissionName, query.getMissionName()); | |||
}else { | |||
} else { | |||
//只需要取最上面的那一条 | |||
questionLambdaQueryWrapper.eq(Question::getMissionId, thMissions.get(0).getId()); | |||
} | |||
return questionMapper.selectList(questionLambdaQueryWrapper); | |||
}catch (Exception e){ | |||
} catch (Exception e) { | |||
e.printStackTrace(); | |||
log.error("查询出错!"); | |||
return null; | |||
@@ -157,91 +171,92 @@ public class QuestionServiceImpl extends BaseServiceImpl<QuestionMapper, Questio | |||
//已经生成工单的问题无法修改 | |||
for (Integer id : entity.getId()) { | |||
List<WorkOrderQuestion> workOrderQuestions = workOrderQuestionMapper.selectList(new LambdaQueryWrapper<WorkOrderQuestion>() | |||
.eq(WorkOrderQuestion::getQuestionId, id)); | |||
if(StringUtils.isNotEmpty(workOrderQuestions)){ | |||
.eq(WorkOrderQuestion::getTenantId, ShiroUtils.getTenantId())//xz | |||
.eq(WorkOrderQuestion::getQuestionId, id)); | |||
if (StringUtils.isNotEmpty(workOrderQuestions)) { | |||
return JsonResult.error("问题已生成工单,无法修改!"); | |||
} | |||
} | |||
//根据ID的数量来判断是否是批量确认和忽略 | |||
Question question=new Question(UpdateOrCreateEnum.UPDATE.getCode()); | |||
Question question = new Question(UpdateOrCreateEnum.UPDATE.getCode()); | |||
question.setStatus(entity.getStatus()); | |||
int update; | |||
Integer qId; | |||
if(entity.getId().length>1){ | |||
qId= entity.getId()[0]; | |||
if (entity.getId().length > 1) { | |||
qId = entity.getId()[0]; | |||
//批量 | |||
update= questionMapper.update(question, new LambdaUpdateWrapper<Question>().in(Question::getId, Arrays.asList(entity.getId()))); | |||
}else{ | |||
update = questionMapper.update(question, new LambdaUpdateWrapper<Question>().in(Question::getId, Arrays.asList(entity.getId()))); | |||
} else { | |||
//查询巡检问题分类 | |||
List<QuestionType> questionTypeList = questionTypeMapper.selectList(new LambdaQueryWrapper<QuestionType>() | |||
.eq(QuestionType::getCode, entity.getType()) | |||
.eq(QuestionType::getMark, 1)); | |||
if(StringUtils.isNotEmpty(questionTypeList)){ | |||
if (StringUtils.isNotEmpty(questionTypeList)) { | |||
question.setQuestionName(questionTypeList.get(0).getContent()); | |||
question.setQuestionDesc(questionTypeList.get(0).getContent()); | |||
} | |||
//单个 | |||
qId= entity.getId()[0]; | |||
qId = entity.getId()[0]; | |||
question.setId(qId); | |||
question.setType(entity.getType()); | |||
update = questionMapper.updateById(question); | |||
} | |||
Integer missionId = questionMapper.selectById(qId).getMissionId(); | |||
ThMission thMission=new ThMission(UpdateOrCreateEnum.UPDATE.getCode()); | |||
ThMission thMission = new ThMission(UpdateOrCreateEnum.UPDATE.getCode()); | |||
thMission.setReportStatus(ReportStatusEnum.UPDATE.getCode()); | |||
thMission.setId(missionId); | |||
missionMapper.updateById(thMission); | |||
return JsonResult.success(update>0); | |||
return JsonResult.success(update > 0); | |||
} | |||
@Override | |||
public JsonResult<List<QuestionCountVO>> analyze(Integer missionId) { | |||
List<QuestionCountVO> resultMap= questionMapper.analyze(missionId); | |||
List<QuestionCountVO> resultMap = questionMapper.analyze(missionId, ShiroUtils.getTenantId()); | |||
return JsonResult.success(resultMap); | |||
} | |||
@Override | |||
public JsonResult<Map<String, Integer>> analyzeController(Integer missionId) { | |||
List<QuestionCountVO> questionCountVoList= questionMapper.analyze(missionId); | |||
Map<String,Integer> resultMap=new HashMap<>(); | |||
List<QuestionCountVO> questionCountVoList = questionMapper.analyze(missionId, ShiroUtils.getTenantId()); | |||
Map<String, Integer> resultMap = new HashMap<>(); | |||
for (QuestionCountVO questionCountVo : questionCountVoList) { | |||
setInfo(resultMap, questionCountVo,QuestionStatusEnum.CONFIRM.getCode(),QuestionStatusEnum.CONFIRM.name().toLowerCase()); | |||
setInfo(resultMap, questionCountVo,QuestionStatusEnum.NEGLECT.getCode(),QuestionStatusEnum.NEGLECT.name().toLowerCase()); | |||
setInfo(resultMap, questionCountVo,QuestionStatusEnum.NOTREVIEWED.getCode(),QuestionStatusEnum.NOTREVIEWED.name().toLowerCase()); | |||
setInfo(resultMap, questionCountVo, QuestionStatusEnum.CONFIRM.getCode(), QuestionStatusEnum.CONFIRM.name().toLowerCase()); | |||
setInfo(resultMap, questionCountVo, QuestionStatusEnum.NEGLECT.getCode(), QuestionStatusEnum.NEGLECT.name().toLowerCase()); | |||
setInfo(resultMap, questionCountVo, QuestionStatusEnum.NOTREVIEWED.getCode(), QuestionStatusEnum.NOTREVIEWED.name().toLowerCase()); | |||
} | |||
int sum=0; | |||
if(!resultMap.containsKey(QuestionStatusEnum.CONFIRM.name().toLowerCase())){ | |||
resultMap.put(QuestionStatusEnum.CONFIRM.name().toLowerCase(),0); | |||
}else{ | |||
sum+=resultMap.get(QuestionStatusEnum.CONFIRM.name().toLowerCase()); | |||
int sum = 0; | |||
if (!resultMap.containsKey(QuestionStatusEnum.CONFIRM.name().toLowerCase())) { | |||
resultMap.put(QuestionStatusEnum.CONFIRM.name().toLowerCase(), 0); | |||
} else { | |||
sum += resultMap.get(QuestionStatusEnum.CONFIRM.name().toLowerCase()); | |||
} | |||
if(!resultMap.containsKey(QuestionStatusEnum.NEGLECT.name().toLowerCase())){ | |||
resultMap.put(QuestionStatusEnum.NEGLECT.name().toLowerCase(),0); | |||
}else{ | |||
sum+=resultMap.get(QuestionStatusEnum.NEGLECT.name().toLowerCase()); | |||
if (!resultMap.containsKey(QuestionStatusEnum.NEGLECT.name().toLowerCase())) { | |||
resultMap.put(QuestionStatusEnum.NEGLECT.name().toLowerCase(), 0); | |||
} else { | |||
sum += resultMap.get(QuestionStatusEnum.NEGLECT.name().toLowerCase()); | |||
} | |||
resultMap.remove(QuestionStatusEnum.NEGLECT.name().toLowerCase()); | |||
resultMap.put(QuestionStatusEnum.CONFIRM.name().toLowerCase(),sum); | |||
resultMap.put(QuestionStatusEnum.CONFIRM.name().toLowerCase(), sum); | |||
if(!resultMap.containsKey(QuestionStatusEnum.NOTREVIEWED.name().toLowerCase())){ | |||
resultMap.put(QuestionStatusEnum.NOTREVIEWED.name().toLowerCase(),0); | |||
if (!resultMap.containsKey(QuestionStatusEnum.NOTREVIEWED.name().toLowerCase())) { | |||
resultMap.put(QuestionStatusEnum.NOTREVIEWED.name().toLowerCase(), 0); | |||
} | |||
return JsonResult.success(resultMap); | |||
} | |||
private static void setInfo(Map<String, Integer> resultMap, QuestionCountVO questionCountVo, Integer code, String name) { | |||
if(questionCountVo.getStatus().equals(code)){ | |||
if(resultMap.containsKey(name)){ | |||
if (questionCountVo.getStatus().equals(code)) { | |||
if (resultMap.containsKey(name)) { | |||
Integer current = resultMap.get(name); | |||
current=current+questionCountVo.getQuantity(); | |||
resultMap.put(name,current); | |||
}else{ | |||
current = current + questionCountVo.getQuantity(); | |||
resultMap.put(name, current); | |||
} else { | |||
resultMap.put(name, questionCountVo.getQuantity()); | |||
} | |||
} | |||
@@ -249,24 +264,18 @@ public class QuestionServiceImpl extends BaseServiceImpl<QuestionMapper, Questio | |||
@Override | |||
public JsonResult<List<QuestionTypeCountVO>> analyzeType(Integer missionId) { | |||
List<QuestionTypeCountVO> questionTypeCountList= questionMapper.analyzeType(missionId, ShiroUtils.getTenantId()); | |||
//id | |||
//name | |||
//code | |||
//type | |||
//content | |||
List<QuestionTypeCountVO> questionTypeCountList = questionMapper.analyzeType | |||
(missionId, ShiroUtils.getTenantId()); | |||
//添加问题的分类 | |||
List<QuestionType> questionTypeList=new ArrayList<>(); | |||
List<QuestionType> questionTypeList = new ArrayList<>(); | |||
try { | |||
questionTypeList = questionTypeService.getQuestionType(); | |||
}catch (Exception e){ | |||
} catch (Exception e) { | |||
e.printStackTrace(); | |||
} | |||
Map<String,String> codeMap=new HashMap<>(); | |||
Map<String, String> codeMap = new HashMap<>(); | |||
for (QuestionType questionType : questionTypeList) { | |||
codeMap.put(questionType.getCode(),questionType.getContent()); | |||
codeMap.put(questionType.getCode(), questionType.getContent()); | |||
} | |||
for (QuestionTypeCountVO questionTypeCountVO : questionTypeCountList) { | |||
questionTypeCountVO.setContent(codeMap.get(questionTypeCountVO.getType())); | |||
@@ -274,135 +283,16 @@ public class QuestionServiceImpl extends BaseServiceImpl<QuestionMapper, Questio | |||
return JsonResult.success(questionTypeCountList); | |||
} | |||
@Override | |||
public JsonResult process(String requestId, CallbackRequest callbackRequest) throws ServiceException { | |||
ThMission mission = getThMission(requestId); | |||
Boolean aBoolean = saveQuestion(callbackRequest, mission); | |||
//如果任务已经完成就修改任务状态 | |||
ThMission thMissionUpdate=new ThMission(UpdateOrCreateEnum.UPDATE.getCode()); | |||
thMissionUpdate.setProgressbar(callbackRequest.getProgress()); | |||
if(aBoolean){ | |||
setComplate(callbackRequest, mission, thMissionUpdate); | |||
}else{ | |||
setTaskStatusEnum(thMissionUpdate, TaskStatusEnum.FAIL, mission); | |||
} | |||
return JsonResult.success(); | |||
} | |||
private void setTaskStatusEnum(ThMission thMissionUpdate, TaskStatusEnum statusEnum, ThMission mission) { | |||
thMissionUpdate.setStatus(statusEnum.getCode()); | |||
thMissionUpdate.setId(mission.getId()); | |||
thMissionUpdate.setExecutionEndTime(new Date()); | |||
missionMapper.updateById(thMissionUpdate); | |||
} | |||
private void setComplate(CallbackRequest callbackRequest, ThMission mission, ThMission thMissionUpdate) { | |||
if(callbackRequest.getAnalyseStatus()== AiAnalyseStatusEnum.SUCCESS.getCode() || callbackRequest.getAnalyseStatus()== AiAnalyseStatusEnum.SUCCESS_TIMEOUT.getCode()){ | |||
//这边存回放的视频地址 | |||
thMissionUpdate.setVideoUrl(callbackRequest.getVideoUrl()); | |||
thMissionUpdate.setAiVideoUrl(callbackRequest.getAiVideoUrl()); | |||
if(callbackRequest.getAnalyseStatus()== AiAnalyseStatusEnum.SUCCESS_TIMEOUT.getCode()){ | |||
thMissionUpdate.setAnalyseStatus(AiAnalyseStatusEnum.SUCCESS_TIMEOUT.getCode()); | |||
}else{ | |||
thMissionUpdate.setAnalyseStatus(AiAnalyseStatusEnum.SUCCESS.getCode()); | |||
} | |||
setTaskStatusEnum(thMissionUpdate, TaskStatusEnum.COMPLETE, mission); | |||
}else if(callbackRequest.getAnalyseStatus()== AiAnalyseStatusEnum.FAILED.getCode()){ | |||
setTaskStatusEnum(thMissionUpdate, TaskStatusEnum.FAIL, mission); | |||
}else{ | |||
thMissionUpdate.setAnalyseStatus(AiAnalyseStatusEnum.RUNNING.getCode()); | |||
setTaskStatusEnum(thMissionUpdate, TaskStatusEnum.FLIGHT, mission); | |||
} | |||
} | |||
private Boolean saveQuestion(CallbackRequest callbackRequest, ThMission mission) { | |||
List<CallbackRequest.QuestionFilesDTO> questionFiles = callbackRequest.getQuestionFiles(); | |||
//获取当前飞行坐标,存问题的经纬度 | |||
List<ThInspection> flightDataList = getThInspections(mission); | |||
List<Question> questionList = getQuestionList(mission, questionFiles, flightDataList); | |||
if(questionList.size()==0){ | |||
return true; | |||
} | |||
return saveBatch(questionList); | |||
} | |||
private List<ThInspection> getThInspections(ThMission mission) { | |||
return inspectionMapper.selectList(new LambdaQueryWrapper<ThInspection>() | |||
.eq(ThInspection::getMissionId, mission.getId()) | |||
.eq(ThInspection::getMark, MarkTypeEnum.VALID.getCode()) | |||
.orderByDesc(ThInspection::getCreateTime)); | |||
} | |||
private List<Question> getQuestionList(ThMission mission, List<CallbackRequest.QuestionFilesDTO> questionFiles, List<ThInspection> flightDataList) { | |||
List<Question> questionList=new ArrayList<>(); | |||
if(ObjectUtil.isEmpty(questionFiles)){ | |||
return questionList; | |||
} | |||
List<QuestionType> questionType = questionTypeService.getQuestionType(); | |||
Map<String,QuestionType> typeMap=new HashMap<>(); | |||
for (QuestionType type : questionType) { | |||
typeMap.put(type.getCode(),type); | |||
} | |||
for (CallbackRequest.QuestionFilesDTO questionFile : questionFiles) { | |||
Question question=new Question(UpdateOrCreateEnum.CREATE.getCode()); | |||
BeanUtils.copyProperties(questionFile,question); | |||
ThInspection flightDataByTime = getFlightDataByTime(flightDataList, questionFile.getAnalyseTime().getTime()); | |||
question.setMissionId(mission.getId()); | |||
question.setMissionName(mission.getName()); | |||
question.setLat(flightDataByTime.getLat()); | |||
question.setLng(flightDataByTime.getLng()); | |||
//待确认 | |||
question.setStatus(QuestionStatusEnum.NOTREVIEWED.getCode()); | |||
//问题类型 | |||
QuestionType questionTypeInfo = typeMap.get(questionFile.getQuestionCode()); | |||
question.setType(ObjectUtil.isNotEmpty(questionTypeInfo)? questionTypeInfo.getCode():""); | |||
question.setQuestionName(ObjectUtil.isNotEmpty(questionTypeInfo)? questionTypeInfo.getContent():""); | |||
question.setQuestionDesc(ObjectUtil.isNotEmpty(questionTypeInfo)? questionTypeInfo.getDescription():""); | |||
questionList.add(question); | |||
} | |||
return questionList; | |||
} | |||
private ThMission getThMission(String requestId) { | |||
LambdaQueryWrapper<ThMission> lambdaQueryWrapper=new LambdaQueryWrapper<>(); | |||
lambdaQueryWrapper.eq(ThMission::getMark,MarkTypeEnum.VALID.getCode()) | |||
.eq(ThMission::getRequestId, requestId) | |||
.eq(ThMission::getStatus,TaskStatusEnum.FLIGHT.getCode()).orderByDesc(ThMission::getExecutionStartTime); | |||
List<ThMission> thMissions = missionMapper.selectList(lambdaQueryWrapper); | |||
if(ObjectUtil.isEmpty(thMissions) || thMissions.size()==0){ | |||
throw new ServiceException(HttpStatus.BAD_REQUEST.value(),"正在执行的任务不存在!"); | |||
} | |||
return thMissions.get(0); | |||
} | |||
/** | |||
* 获取飞行坐标 | |||
* | |||
* @param inspectionList 飞行坐标集合 | |||
* @param time 当前时间 | |||
* @return 当前飞行对象 | |||
* DSP分析处理逻辑 | |||
* @param requestId | |||
* @param callbackRequest | |||
* @return | |||
* @throws ServiceException | |||
*/ | |||
private ThInspection getFlightDataByTime(List<ThInspection> inspectionList, long time) { | |||
if (CollectionUtils.isEmpty(inspectionList)) { | |||
throw new ServiceException(HttpStatus.BAD_REQUEST.value(), "获取无人机飞行坐标失败!"); | |||
} | |||
List<ThInspection> inspectionData =new ArrayList<>(); | |||
for (ThInspection thInspection : inspectionList) { | |||
if(thInspection.getUpdateTime().getTime() <= time){ | |||
inspectionData.add(thInspection); | |||
} | |||
} | |||
if (CollectionUtils.isEmpty(inspectionData)) { | |||
throw new ServiceException(HttpStatus.BAD_REQUEST.value(), "获取无人机飞行坐标失败!"); | |||
} | |||
return inspectionData.get(0); | |||
@Override | |||
public JsonResult process(String requestId, CallbackRequest callbackRequest) throws ServiceException { | |||
return dspCallBackService.process(requestId, callbackRequest); | |||
} | |||
} |
@@ -3,6 +3,7 @@ package com.tuoheng.admin.service.impl; | |||
import cn.hutool.core.lang.Assert; | |||
import cn.hutool.core.util.ObjectUtil; | |||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | |||
import com.baomidou.mybatisplus.core.metadata.IPage; | |||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |||
import com.lowagie.text.*; | |||
@@ -28,6 +29,7 @@ import com.tuoheng.common.utils.DateUtils; | |||
import com.tuoheng.common.utils.JsonResult; | |||
import com.tuoheng.common.utils.StringUtils; | |||
import com.tuoheng.system.service.impl.UserServiceImpl; | |||
import com.tuoheng.system.utils.ShiroUtils; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.springframework.beans.BeanUtils; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
@@ -81,7 +83,9 @@ public class ReportServiceImpl extends BaseServiceImpl<ReportMapper, Report> imp | |||
Assert.notNull(missionId,"任务ID为空"); | |||
String reportNo = createReportNo(); | |||
//查询巡检信息 | |||
ThMission mission = missionMapper.selectById(missionId); | |||
LambdaQueryWrapper<ThMission> queryWrapper = new LambdaQueryWrapper<>();//xz | |||
queryWrapper.eq(ThMission::getTenantId, ShiroUtils.getTenantId()).eq(ThMission::getId, missionId);//xz | |||
ThMission mission = missionMapper.selectOne(queryWrapper);//xz | |||
Assert.notNull(mission,"任务不能为空!"); | |||
//如果报告已经生成,就修改,如果未生成就创建 | |||
@@ -90,7 +94,8 @@ public class ReportServiceImpl extends BaseServiceImpl<ReportMapper, Report> imp | |||
Report report = setInfo(missionId, reportNo, mission); | |||
reportMapper.insert(report); | |||
}else if(mission.getReportStatus() == ReportStatusEnum.UPDATE.getCode()){ | |||
Report update = reportMapper.selectOne(new LambdaQueryWrapper<Report>().eq(Report::getMissionId, missionId)); | |||
Report update = reportMapper.selectOne(new LambdaQueryWrapper<Report>().eq(Report::getMissionId, missionId). | |||
eq(Report::getTenantId, ShiroUtils.getTenantId()));//xz | |||
if(ObjectUtil.isEmpty(update)){ | |||
//生成报告 | |||
@@ -113,6 +118,7 @@ public class ReportServiceImpl extends BaseServiceImpl<ReportMapper, Report> imp | |||
private Report setInfo(Integer missionId, String reportNo, ThMission mission) { | |||
Report report = new Report(UpdateOrCreateEnum.CREATE.getCode()); | |||
report.setTenantId(ShiroUtils.getTenantId());//xz | |||
report.setReportNo(reportNo); | |||
report.setMissionId(missionId); | |||
report.setMissionName(mission.getName()); | |||
@@ -135,12 +141,12 @@ public class ReportServiceImpl extends BaseServiceImpl<ReportMapper, Report> imp | |||
// 获取分页数据 | |||
IPage<Report> page = new Page<>(request.getPage(), request.getLimit()); | |||
IPage<Report> pageData = reportMapper.selectPage(page, new LambdaQueryWrapper<Report>() | |||
.eq(Report::getTenantId, ShiroUtils.getTenantId())//xz | |||
.like(StringUtils.isNotEmpty(request.getReportNo()), Report::getReportNo, request.getReportNo()) | |||
.like(StringUtils.isNotEmpty(request.getName()), Report::getMissionName, request.getName()) | |||
.eq(StringUtils.isNotEmpty(request.getAirportId()), Report::getAirportId, request.getAirportId()) | |||
.eq(ObjectUtil.isNotEmpty(request.getType()), Report::getType, request.getType()) | |||
.eq(Report::getMark, MarkTypeEnum.VALID.getCode()) | |||
//.eq(Report::getTenantId, ShiroUtils.getTenantId()) | |||
.orderByDesc(Report::getCreateTime)); | |||
return JsonResult.success(pageData); | |||
} | |||
@@ -149,7 +155,9 @@ public class ReportServiceImpl extends BaseServiceImpl<ReportMapper, Report> imp | |||
public ReportInfoVO detail(Integer reportId) { | |||
ReportInfoVO reportInfoVO = new ReportInfoVO(); | |||
//查询报告 | |||
Report report = reportMapper.selectById(reportId); | |||
LambdaQueryWrapper<Report> queryWrapper = new LambdaQueryWrapper<>();//xz | |||
queryWrapper.eq(Report::getTenantId,ShiroUtils.getTenantId()).eq(Report::getId, reportId);//xz | |||
Report report = reportMapper.selectOne(queryWrapper);//xz | |||
Integer missionId = report.getMissionId(); | |||
reportInfoVO.setReportNo(report.getReportNo()); | |||
reportInfoVO.setMissionId(missionId); | |||
@@ -174,7 +182,9 @@ public class ReportServiceImpl extends BaseServiceImpl<ReportMapper, Report> imp | |||
// } | |||
private void setMission(ReportInfoVO reportInfoVO, Integer missionId) { | |||
ThMission thMission = missionMapper.selectById(missionId); | |||
LambdaQueryWrapper<ThMission> lambdaQueryWrapper = new LambdaQueryWrapper<>(); | |||
lambdaQueryWrapper.eq(ThMission::getTenantId, ShiroUtils.getTenantId()).eq(ThMission::getId, missionId); | |||
ThMission thMission = missionMapper.selectOne(lambdaQueryWrapper); | |||
if(ObjectUtil.isEmpty(thMission)){ | |||
thMission=new ThMission(UpdateOrCreateEnum.CREATE.getCode()); | |||
} |
@@ -84,7 +84,7 @@ public class TenantServiceImpl extends BaseServiceImpl<TenantMapper, Tenant> imp | |||
.eq(User::getUsername, tenantDto.getUsername()) | |||
.eq(User::getMark, 1)); | |||
if (count2 > 0) { | |||
throw new ServiceException(0, "系统中已经存在相同的账号信息"); | |||
throw new ServiceException("系统中已经存在相同的账号信息"); | |||
} | |||
// 参数转换 | |||
Tenant tenant = new Tenant(); | |||
@@ -96,7 +96,7 @@ public class TenantServiceImpl extends BaseServiceImpl<TenantMapper, Tenant> imp | |||
// 新建租户数据 | |||
int count = tenantMapper.insert(tenant); | |||
if (count == 0) { | |||
throw new ServiceException(0, "租户创建失败"); | |||
throw new ServiceException("租户创建失败"); | |||
} | |||
// 创建租户账号 | |||
User user = new User(); | |||
@@ -110,7 +110,7 @@ public class TenantServiceImpl extends BaseServiceImpl<TenantMapper, Tenant> imp | |||
user.setCreateTime(DateUtils.now()); | |||
int count3 = userMapper.insert(user); | |||
if (count3 == 0) { | |||
throw new ServiceException(0, "租户登录账号创建失败"); | |||
throw new ServiceException("租户登录账号创建失败"); | |||
} | |||
return true; | |||
@@ -127,7 +127,7 @@ public class TenantServiceImpl extends BaseServiceImpl<TenantMapper, Tenant> imp | |||
// 查询租户信息 | |||
Tenant tenant = tenantMapper.selectById(tenantDto.getId()); | |||
if (StringUtils.isNull(tenant)) { | |||
throw new ServiceException(0, "租户信息不存在"); | |||
throw new ServiceException("租户信息不存在"); | |||
} | |||
BeanUtils.copyProperties(tenantDto, tenant); | |||
// 租户头像 | |||
@@ -137,7 +137,7 @@ public class TenantServiceImpl extends BaseServiceImpl<TenantMapper, Tenant> imp | |||
// 更新租户信息 | |||
int count = tenantMapper.updateById(tenant); | |||
if (count == 0) { | |||
throw new ServiceException(0, "更新租户信息失败"); | |||
throw new ServiceException("更新租户信息失败"); | |||
} | |||
// 验证账号 | |||
@@ -146,13 +146,13 @@ public class TenantServiceImpl extends BaseServiceImpl<TenantMapper, Tenant> imp | |||
.eq(User::getUsername, tenantDto.getUsername()) | |||
.eq(User::getMark, 1)); | |||
if (count2 > 0) { | |||
throw new ServiceException(0, "系统中已经存在相同的账号信息"); | |||
throw new ServiceException("系统中已经存在相同的账号信息"); | |||
} | |||
// 查询租户账号信息 | |||
User user = userMapper.selectOne(new LambdaQueryWrapper<User>().eq(User::getTenantId, tenant.getId()).eq(User::getMark, 1)); | |||
if (StringUtils.isNull(user)) { | |||
throw new ServiceException(0, "租户账号信息不存在"); | |||
throw new ServiceException("租户账号信息不存在"); | |||
} | |||
user.setRealname(tenantDto.getName()); | |||
user.setNickname(tenantDto.getName()); | |||
@@ -161,7 +161,7 @@ public class TenantServiceImpl extends BaseServiceImpl<TenantMapper, Tenant> imp | |||
user.setUpdateTime(DateUtils.now()); | |||
int count3 = userMapper.updateById(user); | |||
if (count3 == 0) { | |||
throw new ServiceException(0, "租户账号信息更新失败"); | |||
throw new ServiceException("租户账号信息更新失败"); | |||
} | |||
return true; | |||
} |
@@ -5,21 +5,30 @@ import cn.hutool.core.util.ObjectUtil; | |||
import com.alibaba.fastjson.JSONArray; | |||
import com.alibaba.fastjson.JSONObject; | |||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |||
import com.tuoheng.admin.common.ServiceExceptionEnum; | |||
import com.tuoheng.admin.config.SystemConstant; | |||
import com.tuoheng.admin.entity.domain.Tenant; | |||
import com.tuoheng.admin.entity.domain.ThInspection; | |||
import com.tuoheng.admin.entity.domain.ThMission; | |||
import com.tuoheng.admin.entity.domain.WarningRecord; | |||
import com.tuoheng.admin.entity.request.InspectionRequest; | |||
import com.tuoheng.admin.entity.request.PushAndPullURLRequest; | |||
import com.tuoheng.admin.entity.vo.*; | |||
import com.tuoheng.admin.entity.vo.AirLineVO; | |||
import com.tuoheng.admin.entity.vo.AirPortVO; | |||
import com.tuoheng.admin.entity.vo.AirWeatherVO; | |||
import com.tuoheng.admin.entity.vo.InspectionVO; | |||
import com.tuoheng.admin.enums.AccidentTaskEnum; | |||
import com.tuoheng.admin.enums.MarkTypeEnum; | |||
import com.tuoheng.admin.enums.TaskStatusEnum; | |||
import com.tuoheng.admin.enums.UpdateOrCreateEnum; | |||
import com.tuoheng.admin.mapper.TenantMapper; | |||
import com.tuoheng.admin.mapper.ThInspectionMapper; | |||
import com.tuoheng.admin.mapper.ThMissionMapper; | |||
import com.tuoheng.admin.mapper.WarningRecordMapper; | |||
import com.tuoheng.admin.service.IMissionService; | |||
import com.tuoheng.admin.service.IThInspectionService; | |||
import com.tuoheng.common.common.BaseServiceImpl; | |||
import com.tuoheng.common.config.CommonConfig; | |||
import com.tuoheng.common.exception.ServiceException; | |||
import com.tuoheng.common.utils.*; | |||
import com.tuoheng.system.entity.User; | |||
@@ -32,10 +41,7 @@ import org.springframework.http.HttpStatus; | |||
import org.springframework.stereotype.Service; | |||
import java.io.UnsupportedEncodingException; | |||
import java.util.ArrayList; | |||
import java.util.Date; | |||
import java.util.List; | |||
import java.util.Objects; | |||
import java.util.*; | |||
/** | |||
* @User qiujinyang | |||
@@ -65,37 +71,51 @@ public class ThInspectionServiceImpl extends BaseServiceImpl<ThInspectionMapper, | |||
@Autowired | |||
private IMissionService missionService; | |||
@Autowired | |||
private WarningRecordMapper warningRecordMapper; | |||
@Override | |||
public List<InspectionVO> track(Integer id) { | |||
ThMission mission = missionMapper.selectOne(new LambdaQueryWrapper<ThMission>() | |||
.eq(ThMission::getId, id) | |||
.eq(ThMission::getMark, MarkTypeEnum.VALID.getCode())); | |||
if (ObjectUtil.isNull(mission)) { | |||
throw new ServiceException("没有该任务记录"); | |||
} | |||
if (2 == mission.getType() && mission.getEmergencyDataMissionId() != 0) { | |||
id = mission.getEmergencyDataMissionId(); | |||
} | |||
LambdaQueryWrapper<ThInspection> lambdaQueryWrapper = new LambdaQueryWrapper<>(); | |||
LambdaQueryWrapper<ThInspection> lambdaQueryWrapper=new LambdaQueryWrapper<>(); | |||
lambdaQueryWrapper.eq(ThInspection::getMissionId,id).orderByAsc(ThInspection::getCreateTime); | |||
//lambdaQueryWrapper.eq(ThInspection::getTenantId, ShiroUtils.getTenantId()); | |||
List<InspectionVO> result=new ArrayList<>(); | |||
lambdaQueryWrapper.eq(ThInspection::getMissionId, id) | |||
.orderByAsc(ThInspection::getCreateTime); | |||
List<InspectionVO> result = new ArrayList<>(); | |||
List<ThInspection> thInspections = inspectionMapper.selectList(lambdaQueryWrapper); | |||
for (ThInspection thInspection : thInspections) { | |||
InspectionVO inspectionVO=new InspectionVO(); | |||
BeanUtils.copyProperties(thInspection,inspectionVO); | |||
InspectionVO inspectionVO = new InspectionVO(); | |||
BeanUtils.copyProperties(thInspection, inspectionVO); | |||
result.add(inspectionVO); | |||
} | |||
return result; | |||
} | |||
@Override | |||
public Integer track(InspectionRequest inspectionRequest) throws ServiceException { | |||
ThInspection inspection=new ThInspection(UpdateOrCreateEnum.CREATE.getCode()); | |||
BeanUtils.copyProperties(inspectionRequest,inspection); | |||
ThInspection inspection = new ThInspection(UpdateOrCreateEnum.CREATE.getCode()); | |||
BeanUtils.copyProperties(inspectionRequest, inspection); | |||
//获取当前巡检正在执行的任务 | |||
List<ThMission> thMissions = missionMapper.selectList(new LambdaQueryWrapper<ThMission>() | |||
.eq(ThMission::getInspectionLine, inspectionRequest.getInspectionId()) | |||
.eq(ThMission::getStatus, TaskStatusEnum.FLIGHT.getCode()) | |||
.eq(ThMission::getMark, MarkTypeEnum.VALID.getCode()).orderByAsc(ThMission::getExecutionStartTime)); | |||
if(ObjectUtil.isEmpty(thMissions) || thMissions.size()==0){ | |||
throw new ServiceException(HttpStatus.BAD_REQUEST.value(),"没有正在飞行的任务!"); | |||
.eq(ThMission::getId, inspectionRequest.getRequestId()) | |||
.eq(ThMission::getMark, MarkTypeEnum.VALID.getCode()) | |||
.orderByAsc(ThMission::getExecutionStartTime)); | |||
if (ObjectUtil.isEmpty(thMissions) || thMissions.size() == 0) { | |||
throw new ServiceException(HttpStatus.BAD_REQUEST.value(), "没有该任务!"); | |||
} | |||
ThMission mission = thMissions.get(0); | |||
inspection.setSpeed(inspectionRequest.getHspeed()); | |||
inspection.setYsingal(inspectionRequest.getYsingal()); | |||
inspection.setMode(inspectionRequest.getMode()); | |||
inspection.setMissionId(mission.getId()); | |||
inspection.setTenantId(mission.getTenantId()); | |||
inspectionMapper.insert(inspection); | |||
@@ -103,15 +123,14 @@ public class ThInspectionServiceImpl extends BaseServiceImpl<ThInspectionMapper, | |||
} | |||
@Override | |||
public List<AirPortVO> airport() throws ServiceException, UnsupportedEncodingException { | |||
//这边需要配置到yml文件里面 | |||
public List<AirPortVO> airport() throws ServiceException, UnsupportedEncodingException { | |||
Tenant tenant = tenantMapper.selectById(ShiroUtils.getTenantId()); | |||
String url = tenant.getAirportUrl() +"/api/airportInterface/airportList"; | |||
String url = CommonConfig.airportURL + "/api/airportInterface/airportList"; | |||
String param = "page=1&limit=1000&tenantCode=" + tenant.getCode(); | |||
log.info("****** airportList param tenantCode:{}", tenant.getCode()); | |||
String airPortStr = HttpUtils.sendGet(url, param); | |||
JsonResult jsonResult = JacksonUtil.json2pojo(airPortStr, JsonResult.class); | |||
if(ObjectUtil.isEmpty(jsonResult) || (!ObjectUtil.isEmpty(jsonResult.getData()) &&jsonResult.getCode() != 0)) { | |||
if (ObjectUtil.isEmpty(jsonResult) || (!ObjectUtil.isEmpty(jsonResult.getData()) && jsonResult.getCode() != 0)) { | |||
throw new ServiceException(HttpStatus.BAD_REQUEST.value(), "获取机场信息失败,请重试"); | |||
} | |||
return JSONObject.parseArray(JSONObject.parseObject(JSONObject.toJSONString(jsonResult.getData())).get("records").toString(), AirPortVO.class); | |||
@@ -119,33 +138,39 @@ public class ThInspectionServiceImpl extends BaseServiceImpl<ThInspectionMapper, | |||
@Override | |||
public List<AirLineVO> airLine(Integer droneId) throws ServiceException { | |||
Tenant tenant = tenantMapper.selectById(ShiroUtils.getTenantId()); | |||
//这边需要配置到yml文件里面 | |||
String url = tenant.getAirportUrl() +"/api/airportInterface/taskByDroneId"; | |||
String param="page=1&limit=100&droneId="+droneId; | |||
String url = CommonConfig.airportURL + "/api/airportInterface/taskByDroneId"; | |||
String param = "page=1&limit=100&droneId=" + droneId; | |||
String airPortStr = HttpUtils.sendGet(url, param); | |||
JsonResult<AirLineVO> jsonResult = JacksonUtil.json2pojo(airPortStr, JsonResult.class); | |||
if(ObjectUtil.isEmpty(jsonResult) || (!ObjectUtil.isEmpty(Objects.requireNonNull(jsonResult).getData()) && jsonResult.getCode() != 0)) { | |||
if (ObjectUtil.isEmpty(jsonResult) || (!ObjectUtil.isEmpty(Objects.requireNonNull(jsonResult).getData()) && jsonResult.getCode() != 0)) { | |||
throw new ServiceException(HttpStatus.BAD_REQUEST.value(), "获取航线信息失败,请重试"); | |||
} | |||
return JSONObject.parseArray(JSONObject.parseObject(JSONObject.toJSONString(jsonResult.getData())).get("records").toString(), AirLineVO.class); | |||
} | |||
@Override | |||
public JsonResult executeTask(String missionId,PushAndPullURLRequest pushAndPull) throws ServiceException{ | |||
public JsonResult executeTask(String missionId, PushAndPullURLRequest pushAndPull) throws ServiceException { | |||
log.info("executeTask准备就绪"); | |||
ThMission thMission = missionMapper.selectById(Integer.parseInt(missionId)); | |||
if (ObjectUtil.isNull(thMission)) { | |||
log.error("该任务不存在,missionId={}", missionId); | |||
return JsonResult.error("该任务不存在"); | |||
} | |||
if (2 == thMission.getExecutionStatus()) { | |||
log.error("该任务已经被执行,missionId={}", missionId); | |||
return JsonResult.error("该任务已经被执行"); | |||
} | |||
log.info("mission查询完成"); | |||
User user = userMapper.selectById(thMission.getCreateUser()); | |||
log.info("user查询完成"); | |||
Tenant tenant = tenantMapper.selectById(user.getTenantId()); | |||
log.info("tenant查询完成"); | |||
//这边需要配置到yml文件里面 | |||
log.info("executeTask准备入参"); | |||
String url = tenant.getAirportUrl() + "/api/airportInterface/executeTask"; | |||
String url = CommonConfig.airportURL + "/api/airportInterface/executeTaskAnsy"; | |||
JSONObject jsonObject = new JSONObject(); | |||
jsonObject.put("code", "lc"); | |||
jsonObject.put("code", SystemConstant.PLATFORM_CODE); | |||
jsonObject.put("tenantCode", tenant.getCode()); | |||
jsonObject.put("taskId", thMission.getInspectionLine()); | |||
jsonObject.put("requestId", missionId); | |||
@@ -154,10 +179,10 @@ public class ThInspectionServiceImpl extends BaseServiceImpl<ThInspectionMapper, | |||
try { | |||
airPortStr = HttpUtils.doSend(url, jsonObject, null, "POST"); | |||
} catch (Exception e) { | |||
log.error("调用机场executeTask接口异常:",e); | |||
log.error("调用机场executeTask接口异常:", e); | |||
return JsonResult.error("调用机场executeTask接口异常"); | |||
} | |||
if(StringUtils.isEmpty(airPortStr)){ | |||
if (StringUtils.isEmpty(airPortStr)) { | |||
return JsonResult.error("机场接口返回数据为空"); | |||
} | |||
JsonResult jsonResult = JacksonUtil.json2pojo(airPortStr, JsonResult.class); | |||
@@ -175,46 +200,49 @@ public class ThInspectionServiceImpl extends BaseServiceImpl<ThInspectionMapper, | |||
} | |||
@Override | |||
public AirWeatherVO getWeather(Integer airportId) throws ServiceException{ | |||
Tenant tenant = tenantMapper.selectById(ShiroUtils.getTenantId()); | |||
//这边需要配置到yml文件里面 | |||
String url = tenant.getAirportUrl() + "/api/airportInterface/getWeather"; | |||
String param="airportId="+airportId; | |||
public AirWeatherVO getWeather(Integer airportId) throws ServiceException { | |||
String url = CommonConfig.airportURL + "/api/airportInterface/getWeather"; | |||
String param = "airportId=" + airportId; | |||
String weatherStr = HttpUtils.sendGet(url, param); | |||
JsonResult jsonResult; | |||
try { | |||
jsonResult = JacksonUtil.json2pojo(weatherStr, JsonResult.class); | |||
if (ObjectUtil.isEmpty(jsonResult) || Objects.requireNonNull(jsonResult).getCode() != 0) { | |||
log.info("获取天气信息失败,返回为空或code不为0"); | |||
log.info("获取天气信息失败,url={}", url); | |||
log.info("获取天气信息失败,param={}", param); | |||
throw new ServiceException(HttpStatus.BAD_REQUEST.value(), "获取天气信息失败,请重试"); | |||
} | |||
if(ObjectUtil.isEmpty(jsonResult.getData())){ | |||
if (ObjectUtil.isEmpty(jsonResult.getData())) { | |||
log.info("获取天气信息,返回数据为空"); | |||
return new AirWeatherVO(); | |||
} | |||
return JSONObject.parseObject(JSONObject.toJSONString(jsonResult.getData()),AirWeatherVO.class); | |||
}catch (Exception e){ | |||
throw new ServiceException(HttpStatus.BAD_REQUEST.value(), "获取天气信息失败,请重试"); | |||
return JSONObject.parseObject(JSONObject.toJSONString(jsonResult.getData()), AirWeatherVO.class); | |||
} catch (Exception e) { | |||
log.info("获取天气信息异常,url={}", url); | |||
log.info("获取天气信息异常,param={}", param); | |||
throw new ServiceException(HttpStatus.BAD_REQUEST.value(), "获取天气信息异常,请重试"); | |||
} | |||
} | |||
@Override | |||
public JsonResult lineTrack(Integer missionId) { | |||
Tenant tenant = tenantMapper.selectById(ShiroUtils.getTenantId()); | |||
ThMission thMission = missionMapper.selectById(missionId); | |||
Assert.notNull(thMission,"任务不能为空!"); | |||
Integer taskId= thMission.getInspectionLine(); | |||
Assert.notNull(thMission, "任务不能为空!"); | |||
Integer taskId = thMission.getInspectionLine(); | |||
//解析标准srt文件里面的坐标,调用硬件接口,返回数据 | |||
String url = tenant.getAirportUrl() + "/api/airportInterface/getLocationById"; | |||
String param="id="+taskId; | |||
String url = CommonConfig.airportURL + "/api/airportInterface/getLocationById"; | |||
String param = "id=" + taskId; | |||
String airportLine = HttpUtils.sendGet(url, param); | |||
JsonResult jsonResult = JacksonUtil.json2pojo(airportLine, JsonResult.class); | |||
if(ObjectUtil.isEmpty(jsonResult) || Objects.requireNonNull(jsonResult).getCode() != 0) { | |||
if (ObjectUtil.isEmpty(jsonResult) || Objects.requireNonNull(jsonResult).getCode() != 0) { | |||
throw new ServiceException(HttpStatus.BAD_REQUEST.value(), "获取标准航线信息失败,请重试"); | |||
} | |||
JSONArray resultData = JSONArray.parseArray(JSONObject.toJSONString( jsonResult.getData())); | |||
JSONArray resultData = JSONArray.parseArray(JSONObject.toJSONString(jsonResult.getData())); | |||
for (Object o : resultData) { | |||
JSONObject jsonObject=(JSONObject)o; | |||
jsonObject.put("lng",jsonObject.getString("lon")); | |||
JSONObject jsonObject = (JSONObject) o; | |||
jsonObject.put("lng", jsonObject.getString("lon")); | |||
jsonObject.remove("lon"); | |||
} | |||
jsonResult.setData(resultData); | |||
@@ -223,5 +251,18 @@ public class ThInspectionServiceImpl extends BaseServiceImpl<ThInspectionMapper, | |||
return jsonResult; | |||
} | |||
@Override | |||
public JsonResult fightData(Integer id) { | |||
//校验 | |||
if (null == id) { | |||
throw new ServiceException(ServiceExceptionEnum.PARAMETER_IS_NULL); | |||
} | |||
//根据任务id查询对应的遥测数据 | |||
Map<String, Object> map = new HashMap<>(); | |||
map.put("id", id); | |||
map.put("tenantId", ShiroUtils.getTenantId()); | |||
List<ThInspection> listData = inspectionMapper.selectListByMissionId(map); | |||
return JsonResult.success(listData); | |||
} | |||
} |
@@ -2,6 +2,7 @@ package com.tuoheng.admin.service.impl; | |||
import cn.hutool.core.util.ObjectUtil; | |||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | |||
import com.baomidou.mybatisplus.core.metadata.IPage; | |||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |||
import com.tuoheng.admin.common.ServiceExceptionEnum; | |||
@@ -77,6 +78,7 @@ public class WorkOrderServiceImpl extends BaseServiceImpl<WorkOrderMapper, WorkO | |||
// 获取分页数据 | |||
IPage<WorkOrder> page = new Page<>(request.getPage(), request.getLimit()); | |||
IPage<WorkOrder> pageData = workOrderMapper.selectPage(page, new LambdaQueryWrapper<WorkOrder>() | |||
.eq(WorkOrder::getTenantId, ShiroUtils.getTenantId())//xz | |||
.like(StringUtils.isNotEmpty(request.getCode()), WorkOrder::getCode, request.getCode()) | |||
.eq(ObjectUtil.isNotEmpty(request.getStatus()), WorkOrder::getStatus, request.getStatus()) | |||
.between(ObjectUtil.isNotNull(startDate),WorkOrder::getCreateTime, startDate, endDate) | |||
@@ -88,11 +90,13 @@ public class WorkOrderServiceImpl extends BaseServiceImpl<WorkOrderMapper, WorkO | |||
//查询问题总数 | |||
Integer questionTotal = workOrderQuestionMapper.selectCount(new LambdaQueryWrapper<WorkOrderQuestion>() | |||
.eq(WorkOrderQuestion::getTenantId, ShiroUtils.getTenantId())//xz | |||
.eq(WorkOrderQuestion::getWorkOrderId, vo.getId())); | |||
vo.setQuestionTotal(questionTotal); | |||
//查询未处理问题数 | |||
Integer unhandledTotal = workOrderQuestionMapper.selectCount(new LambdaQueryWrapper<WorkOrderQuestion>() | |||
.eq(WorkOrderQuestion::getTenantId, ShiroUtils.getTenantId())//xz | |||
.eq(WorkOrderQuestion::getWorkOrderId, vo.getId()) | |||
.eq(WorkOrderQuestion::getStatus, 0)); | |||
vo.setUnhandledTotal(unhandledTotal); | |||
@@ -115,6 +119,8 @@ public class WorkOrderServiceImpl extends BaseServiceImpl<WorkOrderMapper, WorkO | |||
@Override | |||
@Transactional | |||
public JsonResult generate(Integer[] ids) { | |||
Integer questionId = ids[0]; | |||
Question question = questionMapper.selectById(questionId); | |||
//校验,已生成工单的问题,无法生成工单 | |||
Integer count = workOrderQuestionMapper.selectCount(new LambdaQueryWrapper<WorkOrderQuestion>() | |||
.in(WorkOrderQuestion::getQuestionId, ids)); | |||
@@ -126,6 +132,7 @@ public class WorkOrderServiceImpl extends BaseServiceImpl<WorkOrderMapper, WorkO | |||
WorkOrder workOrder = new WorkOrder(); | |||
workOrder.setCode(code); | |||
workOrder.setTenantId(question.getTenantId());//xz | |||
workOrderMapper.insert(workOrder); | |||
for (Integer id : ids) { | |||
@@ -133,6 +140,7 @@ public class WorkOrderServiceImpl extends BaseServiceImpl<WorkOrderMapper, WorkO | |||
WorkOrderQuestion workOrderQuestion = new WorkOrderQuestion(); | |||
workOrderQuestion.setWorkOrderId(workOrder.getId()); | |||
workOrderQuestion.setQuestionId(id); | |||
workOrderQuestion.setTenantId(question.getTenantId());//xz | |||
workOrderQuestionMapper.insert(workOrderQuestion); | |||
} | |||
return JsonResult.success(); | |||
@@ -154,6 +162,7 @@ public class WorkOrderServiceImpl extends BaseServiceImpl<WorkOrderMapper, WorkO | |||
public JsonResult handle(WorkOrderHandleRequest request) { | |||
//校验,已处理的问题,无法再处理 | |||
Integer handleCount = workOrderQuestionMapper.selectCount(new LambdaQueryWrapper<WorkOrderQuestion>() | |||
.eq(WorkOrderQuestion::getTenantId, ShiroUtils.getTenantId())//xz | |||
.eq(WorkOrderQuestion::getQuestionId, request.getQuestionId()) | |||
.eq(WorkOrderQuestion::getStatus, 1) | |||
.eq(WorkOrderQuestion::getMark, MarkTypeEnum.VALID.getCode())); | |||
@@ -166,6 +175,7 @@ public class WorkOrderServiceImpl extends BaseServiceImpl<WorkOrderMapper, WorkO | |||
BeanUtils.copyProperties(request, workOrderQuestion); | |||
workOrderQuestion.setStatus(1); | |||
workOrderQuestionMapper.update(workOrderQuestion, new LambdaQueryWrapper<WorkOrderQuestion>() | |||
// .eq(WorkOrderQuestion::getTenantId, ShiroUtils.getTenantId())//xz | |||
.eq(WorkOrderQuestion::getWorkOrderId, request.getWorkOrderId()) | |||
.eq(WorkOrderQuestion::getQuestionId, request.getQuestionId())); | |||
@@ -174,10 +184,12 @@ public class WorkOrderServiceImpl extends BaseServiceImpl<WorkOrderMapper, WorkO | |||
BeanUtils.copyProperties(request, questionHandle); | |||
questionHandle.setHandlerUser(ShiroUtils.getUserId()); | |||
questionHandle.setHandlerTime(new Date()); | |||
questionHandle.setTenantId(ShiroUtils.getTenantId());//xz | |||
questionHandleMapper.insert(questionHandle); | |||
//查询工单下待处理的问题,如全部处理完,将工单状态修改为已完成 | |||
Integer count = workOrderQuestionMapper.selectCount(new LambdaQueryWrapper<WorkOrderQuestion>() | |||
.eq(WorkOrderQuestion::getTenantId, ShiroUtils.getTenantId())//xz | |||
.eq(WorkOrderQuestion::getWorkOrderId, request.getWorkOrderId()) | |||
.eq(WorkOrderQuestion::getStatus, 0)); | |||
if(count == 0){ | |||
@@ -196,7 +208,8 @@ public class WorkOrderServiceImpl extends BaseServiceImpl<WorkOrderMapper, WorkO | |||
// 设置分页参数 | |||
IPage<WorkOrderQuestionVO> page = new Page<>(request.getPage(), request.getLimit()); | |||
// 查询结果 | |||
IPage<WorkOrderQuestionVO> pageInfo = workOrderMapper.questionPage(page, request); | |||
int tenantId = ShiroUtils.getTenantId(); | |||
IPage<WorkOrderQuestionVO> pageInfo = workOrderMapper.questionPage(page, request, tenantId); | |||
for (WorkOrderQuestionVO record : pageInfo.getRecords()) { | |||
if(StringUtils.isNotEmpty(record.getHandlerImage())){ | |||
String[] imgHanders = record.getHandlerImage().split(","); | |||
@@ -214,11 +227,14 @@ public class WorkOrderServiceImpl extends BaseServiceImpl<WorkOrderMapper, WorkO | |||
public JsonResult questionDetail(Integer questionId) { | |||
QuestionDetailVO questionDetailVO = new QuestionDetailVO(); | |||
//查询问题详情 | |||
Question question = questionMapper.selectById(questionId); | |||
QueryWrapper<Question> queryWrapper = new QueryWrapper<>();//xz | |||
queryWrapper.lambda().eq(Question::getTenantId, ShiroUtils.getTenantId()).eq(Question::getId, questionId);//xz | |||
Question question = questionMapper.selectOne(queryWrapper);//xz | |||
questionDetailVO.setQuestion(question); | |||
//查询问题处理详情 | |||
QuestionHandle questionHandle = questionHandleMapper.selectOne(new LambdaQueryWrapper<QuestionHandle>() | |||
.eq(QuestionHandle::getTenantId, ShiroUtils.getTenantId())//xz | |||
.eq(QuestionHandle::getQuestionId, questionId) | |||
.eq(QuestionHandle::getMark, MarkTypeEnum.VALID.getCode())); | |||
//拼接图片域名 | |||
@@ -239,6 +255,7 @@ public class WorkOrderServiceImpl extends BaseServiceImpl<WorkOrderMapper, WorkO | |||
//查询问题处理状态 | |||
WorkOrderQuestion workOrderQuestion = workOrderQuestionMapper.selectOne(new LambdaQueryWrapper<WorkOrderQuestion>() | |||
.eq(WorkOrderQuestion::getTenantId, ShiroUtils.getTenantId())//xz | |||
.eq(WorkOrderQuestion::getQuestionId, questionId)); | |||
questionDetailVO.setQuestionHandle(questionHandle); | |||
questionHandle.setStatus(workOrderQuestion.getStatus()); |
@@ -0,0 +1,114 @@ | |||
package com.tuoheng.admin.service.mission.query; | |||
import cn.hutool.core.collection.CollectionUtil; | |||
import cn.hutool.core.util.ObjectUtil; | |||
import com.alibaba.fastjson.JSONObject; | |||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |||
import com.tuoheng.admin.config.SystemConstant; | |||
import com.tuoheng.admin.conver.MissionConverMapper; | |||
import com.tuoheng.admin.entity.domain.ThMission; | |||
import com.tuoheng.admin.entity.request.emergency.QueryEmergencyListRequest; | |||
import com.tuoheng.admin.entity.vo.AirPortStatusVO; | |||
import com.tuoheng.admin.entity.vo.EmergencyMissionVO; | |||
import com.tuoheng.admin.enums.MarkEnum; | |||
import com.tuoheng.admin.mapper.ThMissionMapper; | |||
import com.tuoheng.common.config.CommonConfig; | |||
import com.tuoheng.common.exception.ServiceException; | |||
import com.tuoheng.common.utils.HttpUtils; | |||
import com.tuoheng.common.utils.JacksonUtil; | |||
import com.tuoheng.common.utils.JsonResult; | |||
import com.tuoheng.common.utils.StringUtils; | |||
import com.tuoheng.system.entity.City; | |||
import com.tuoheng.system.entity.User; | |||
import com.tuoheng.system.utils.ShiroUtils; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.stereotype.Service; | |||
import java.util.HashMap; | |||
import java.util.List; | |||
import java.util.Map; | |||
import java.util.stream.Collectors; | |||
/** | |||
* 查询应急任务列表业务层处理 | |||
* | |||
* @author wanjing | |||
* @team tuoheng | |||
* @date 2023-02-13 | |||
*/ | |||
@Slf4j | |||
@Service | |||
public class QueryEmergencyListService { | |||
@Autowired | |||
private ThMissionMapper thMissionMapper; | |||
public JsonResult getList(QueryEmergencyListRequest request) { | |||
// log.info("进入查询应急任务列表业务"); | |||
User user = ShiroUtils.getUserInfo(); | |||
Integer tenantId = user.getTenantId(); | |||
request.setTenantId(tenantId); | |||
JsonResult result = this.check(tenantId, request); | |||
if (0 != result.getCode()) { | |||
log.info("进入查询应急任务列表业务:校验失败:{}", result.getMsg()); | |||
return result; | |||
} | |||
List<ThMission> missionList = thMissionMapper.selectList(new LambdaQueryWrapper<ThMission>() | |||
.eq(ThMission::getMark, MarkEnum.VALID.getCode()) | |||
.eq(ThMission::getTenantId, tenantId) | |||
.eq(ThMission::getType, 2) | |||
.in(CollectionUtil.isNotEmpty(request.getStatusList()), ThMission::getStatus, request.getStatusList())); | |||
if (CollectionUtil.isEmpty(missionList)) { | |||
log.info("应急任务列表数据为空"); | |||
return JsonResult.success(); | |||
} | |||
List<EmergencyMissionVO> emergencyMissionVOList = MissionConverMapper.INSTANCE.fromMissionListToEmergencyMissionVOList(missionList); | |||
Map<Integer, AirPortStatusVO> airPortStatusVOMap = getAirPortStatusVOMap(missionList); | |||
AirPortStatusVO airPortStatusVO; | |||
for (EmergencyMissionVO emergencyMissionVO : emergencyMissionVOList) { | |||
if (ObjectUtil.isNotNull(airPortStatusVOMap)) { | |||
airPortStatusVO = airPortStatusVOMap.get(emergencyMissionVO.getAirportId()); | |||
if (ObjectUtil.isNotNull(airPortStatusVO)) { | |||
emergencyMissionVO.setAirportStatus(airPortStatusVO.getMsg()); | |||
} | |||
} | |||
} | |||
return JsonResult.success(emergencyMissionVOList); | |||
} | |||
/** | |||
* 检查参数 | |||
* | |||
* @param tenantId | |||
* @param request | |||
* @return | |||
*/ | |||
private JsonResult check(Integer tenantId, QueryEmergencyListRequest request) { | |||
return JsonResult.success(); | |||
} | |||
private Map<Integer, AirPortStatusVO> getAirPortStatusVOMap(List<ThMission> missionList) { | |||
String airportIds = ""; | |||
for (ThMission mission : missionList) { | |||
airportIds += mission.getAirportId() + ","; | |||
} | |||
airportIds = airportIds.substring(0, airportIds.length() - 1); | |||
String url = CommonConfig.airportURL + SystemConstant.API_AIRPORT_STATUS_BY_AIRPORT_ID; | |||
String param = "airportIds=" + airportIds; | |||
String airPortStatusStr = HttpUtils.sendGet(url, param); | |||
if (StringUtils.isEmpty(airPortStatusStr)) { | |||
log.info("调用机场平台,查询飞行状态:机场接口返回数据为空,查询飞行状态失败"); | |||
return null; | |||
} | |||
JsonResult jsonResult = JacksonUtil.json2pojo(airPortStatusStr, JsonResult.class); | |||
List<AirPortStatusVO> airPortStatusVOList = JSONObject.parseArray(JSONObject.toJSONString(jsonResult.getData()), AirPortStatusVO.class); | |||
Map<Integer, AirPortStatusVO> map = new HashMap<>(); | |||
for (AirPortStatusVO airPortStatusVO : airPortStatusVOList) { | |||
map.put(airPortStatusVO.getAirportId(), airPortStatusVO); | |||
} | |||
return map; | |||
} | |||
} |
@@ -0,0 +1,66 @@ | |||
package com.tuoheng.admin.service.mission.query; | |||
import cn.hutool.core.collection.CollectionUtil; | |||
import com.alibaba.fastjson.JSONArray; | |||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |||
import com.tuoheng.admin.entity.domain.ThMission; | |||
import com.tuoheng.admin.entity.request.emergency.QueryMissionListRequest; | |||
import com.tuoheng.admin.enums.MarkEnum; | |||
import com.tuoheng.admin.mapper.ThMissionMapper; | |||
import com.tuoheng.common.utils.JsonResult; | |||
import com.tuoheng.system.entity.User; | |||
import com.tuoheng.system.utils.ShiroUtils; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.stereotype.Service; | |||
import java.util.List; | |||
/** | |||
* 查询任务列表业务层处理 | |||
* | |||
* @author wanjing | |||
* @team tuoheng | |||
* @date 2023-02-13 | |||
*/ | |||
@Slf4j | |||
@Service | |||
public class QueryMissionListService { | |||
@Autowired | |||
private ThMissionMapper thMissionMapper; | |||
public JsonResult getList(QueryMissionListRequest request) { | |||
// log.info("进入查询任务列表业务"); | |||
User user = ShiroUtils.getUserInfo(); | |||
Integer tenantId = user.getTenantId(); | |||
request.setTenantId(tenantId); | |||
JsonResult result = this.check(tenantId, request); | |||
if (0 != result.getCode()) { | |||
log.info("进入查询任务列表业务:校验失败:{}", result.getMsg()); | |||
return result; | |||
} | |||
List<ThMission> missionList = thMissionMapper.selectList(new LambdaQueryWrapper<ThMission>() | |||
.eq(ThMission::getMark, MarkEnum.VALID.getCode()) | |||
.eq(ThMission::getTenantId, tenantId) | |||
.in(CollectionUtil.isNotEmpty(request.getStatusList()), ThMission::getStatus, request.getStatusList())); | |||
if (CollectionUtil.isEmpty(missionList)) { | |||
log.info("任务列表数据为空"); | |||
} | |||
return JsonResult.success(missionList); | |||
} | |||
/** | |||
* 检查参数 | |||
* | |||
* @param tenantId | |||
* @param request | |||
* @return | |||
*/ | |||
private JsonResult check(Integer tenantId, QueryMissionListRequest request) { | |||
return JsonResult.success(); | |||
} | |||
} |
@@ -0,0 +1,59 @@ | |||
package com.tuoheng.admin.service.third; | |||
import cn.hutool.core.util.ObjectUtil; | |||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |||
import com.tuoheng.admin.entity.domain.ThMission; | |||
import com.tuoheng.admin.entity.domain.WarningRecord; | |||
import com.tuoheng.admin.enums.MarkEnum; | |||
import com.tuoheng.admin.enums.MarkTypeEnum; | |||
import com.tuoheng.admin.mapper.ThMissionMapper; | |||
import com.tuoheng.admin.mapper.WarningRecordMapper; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.stereotype.Service; | |||
@Slf4j | |||
@Service | |||
public class UpdateEmergencyMissionStatusService { | |||
@Autowired | |||
private WarningRecordMapper warningRecordMapper; | |||
@Autowired | |||
private ThMissionMapper thMissionMapper; | |||
/** | |||
* 修改应急任务数据 | |||
* | |||
* @param oldMission | |||
*/ | |||
public void updateStatus(ThMission oldMission, Integer status) { | |||
log.info("修改应急任务数据, type:{}, emergencyDataMissionId:{}, status={}", oldMission.getType(), oldMission.getEmergencyDataMissionId(), status); | |||
ThMission emergencyMission = thMissionMapper.selectOne(new LambdaQueryWrapper<ThMission>() | |||
.eq(ThMission::getEmergencyDataMissionId, oldMission.getId()) | |||
.eq(ThMission::getMark, MarkEnum.VALID.getCode())); | |||
if (ObjectUtil.isNull(emergencyMission)) { | |||
log.info("修改应急任务数据,该巡检任务没有对应的应急任务"); | |||
return; | |||
} | |||
// 在查询一次,保证数据是最新的 | |||
ThMission mission = thMissionMapper.selectOne(new LambdaQueryWrapper<ThMission>() | |||
.eq(ThMission::getId, oldMission.getId()) | |||
.eq(ThMission::getMark, MarkEnum.VALID.getCode())); | |||
if (ObjectUtil.isNotNull(status)) { | |||
emergencyMission.setStatus(status); | |||
} | |||
emergencyMission.setPlayUrl(mission.getPlayUrl()); | |||
emergencyMission.setAiplayUrl(mission.getAiplayUrl()); | |||
emergencyMission.setPullUrl(mission.getAipullUrl()); | |||
emergencyMission.setPushUrl(mission.getAipushUrl()); | |||
emergencyMission.setAipullUrl(mission.getAipullUrl()); | |||
emergencyMission.setAipushUrl(mission.getAipushUrl()); | |||
emergencyMission.setAnalyseStatus(mission.getAnalyseStatus()); | |||
emergencyMission.setVideoUrl(mission.getVideoUrl()); | |||
emergencyMission.setAiVideoUrl(mission.getAiVideoUrl()); | |||
thMissionMapper.updateById(emergencyMission); | |||
log.info("修改应急任务数据完成"); | |||
} | |||
} |
@@ -0,0 +1,229 @@ | |||
package com.tuoheng.admin.service.third.airport; | |||
import cn.hutool.core.util.ObjectUtil; | |||
import com.alibaba.fastjson.JSONArray; | |||
import com.alibaba.fastjson.JSONObject; | |||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |||
import com.tuoheng.admin.common.ServiceExceptionEnum; | |||
import com.tuoheng.admin.entity.domain.ThMission; | |||
import com.tuoheng.admin.entity.request.MissionStatusRequest; | |||
import com.tuoheng.admin.entity.vo.AirWeatherVO; | |||
import com.tuoheng.admin.enums.*; | |||
import com.tuoheng.admin.mapper.ThMissionMapper; | |||
import com.tuoheng.admin.service.IDspService; | |||
import com.tuoheng.admin.service.IThInspectionService; | |||
import com.tuoheng.admin.service.third.UpdateEmergencyMissionStatusService; | |||
import com.tuoheng.admin.utils.WeatherUtil; | |||
import com.tuoheng.common.exception.ServiceException; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.beans.factory.annotation.Value; | |||
import org.springframework.context.annotation.Lazy; | |||
import org.springframework.http.HttpStatus; | |||
import org.springframework.stereotype.Service; | |||
import org.springframework.util.Assert; | |||
import javax.annotation.Resource; | |||
import java.util.Date; | |||
import java.util.List; | |||
@Slf4j | |||
@Service | |||
public class AirportCallBackUpdateStatusService { | |||
@Autowired | |||
private ThMissionMapper thMissionMapper; | |||
@Resource | |||
@Lazy | |||
private IThInspectionService inspectionService; | |||
@Autowired | |||
private IDspService dspService; | |||
@Value("${tuoheng.dsp-callback-url:}") | |||
private String dspCallbackUrl; | |||
@Autowired | |||
private UpdateEmergencyMissionStatusService updateEmergencyMissionStatusService; | |||
/** | |||
* 机场平台回调,修改任务状态 | |||
* | |||
* @param missionStatusRequest | |||
* @return | |||
* @throws ServiceException | |||
*/ | |||
public boolean updateStatus(MissionStatusRequest missionStatusRequest) throws ServiceException { | |||
//如果发送过来的状态是执行中,那么就说明之前是待执行,查询等待执行的数据,开始飞行 | |||
ThMission thMission = thMissionMapper.selectOne(new LambdaQueryWrapper<ThMission>() | |||
.eq(ThMission::getId, missionStatusRequest.getRequestId()) | |||
.eq(ThMission::getMark, MarkEnum.VALID.getCode())); | |||
Integer status = null; | |||
if (AirPortTaskStatusEnum.FLIGHT.getCode() == missionStatusRequest.getStatus()) { | |||
log.info("被硬件调用,存任务状态:执行中"); | |||
// ThMission thMission = getRecentlyRecord(missionStatusRequest,TaskStatusEnum.WAIT.getCode()); | |||
Assert.notNull(thMission, "飞行任务不能为空!"); | |||
ThMission thMissionUpdate = setStatus(missionStatusRequest, thMission, AirPortTaskStatusEnum.FLIGHT); | |||
try { | |||
//开始分析 | |||
log.info("被硬件调用,存任务状态:开始分析"); | |||
JSONObject jsonObject = this.startAI(missionStatusRequest); | |||
thMissionUpdate.setRequestId(jsonObject.getJSONObject("data").getString("requestId")); | |||
thMissionUpdate.setAipullUrl(jsonObject.getJSONObject("data").getString("aipullUrl")); | |||
thMissionUpdate.setAipushUrl(jsonObject.getJSONObject("data").getString("aipushUrl")); | |||
thMissionUpdate.setPlayUrl(missionStatusRequest.getPlayUrl()); | |||
thMissionUpdate.setAiplayUrl(jsonObject.getJSONObject("data").getString("aiplayUrl")); | |||
thMissionUpdate.setAnalyseStatus(AiAnalyseStatusEnum.WAITING.getCode()); | |||
log.info("被硬件调用,原任务状态:status:{}", thMission.getStatus()); | |||
thMissionMapper.updateById(thMissionUpdate); | |||
status = TaskStatusEnum.FLIGHT.getCode(); | |||
} catch (ServiceException e) { | |||
//如果调用DSP失败就直接失败! | |||
log.error("调用DSP数据失败:{}", e.getMessage()); | |||
thMissionUpdate.setStatus(TaskStatusEnum.FAIL.getCode()); | |||
thMissionMapper.updateById(thMissionUpdate); | |||
status = TaskStatusEnum.FAIL.getCode(); | |||
// throw new ServiceException(HttpStatus.BAD_REQUEST.value(), "任务分析失败!"); | |||
} | |||
updateEmergencyMissionStatusService.updateStatus(thMission, status); | |||
} else if (AirPortTaskStatusEnum.WAIT.getCode() == missionStatusRequest.getStatus()) { | |||
log.info("被硬件调用,存任务状态:已完成"); | |||
// 机场飞行完成,立即修改任务状态为已完成 | |||
ThMission thMissionUpdate = new ThMission(UpdateOrCreateEnum.UPDATE.getCode()); | |||
thMissionUpdate.setId(Integer.parseInt(missionStatusRequest.getRequestId())); | |||
thMissionUpdate.setStatus(TaskStatusEnum.COMPLETE.getCode()); | |||
thMissionUpdate.setExecutionEndTime(new Date()); | |||
try { | |||
AirWeatherVO weather = inspectionService.getWeather(thMission.getAirportId()); | |||
String weatherStr = WeatherUtil.getWeather(weather); | |||
thMissionUpdate.setWeather(weatherStr); | |||
} catch (Exception e) { | |||
thMissionUpdate.setWeather(""); | |||
log.info("获取天气信息失败,请重试"); | |||
} | |||
log.info("被硬件调用,任务状态:status:{}", thMissionUpdate.getStatus()); | |||
thMissionMapper.updateById(thMissionUpdate); | |||
status = TaskStatusEnum.COMPLETE.getCode(); | |||
updateEmergencyMissionStatusService.updateStatus(thMission, status); | |||
//硬件停止后,停止AI分析 | |||
this.stopAI(missionStatusRequest, thMission); | |||
} else { | |||
log.info("机场平台回调,修改任务状态,不存在的任务状态"); | |||
throw new ServiceException(ServiceExceptionEnum.TASK_NOT_STATUS); | |||
} | |||
log.info("机场平台回调,修改任务状态结束"); | |||
return true; | |||
} | |||
private JSONObject startAI(MissionStatusRequest missionStatusRequest) throws ServiceException { | |||
log.info("开始AI分析"); | |||
//任务调用完成之后,调用发送通道,请求DSP需要分析 | |||
//调用DSP接口 | |||
JSONObject request = new JSONObject(); | |||
JSONArray configList = new JSONArray(); | |||
JSONObject instConfigMode = new JSONObject(); | |||
instConfigMode.put("ename", "service_mode"); | |||
instConfigMode.put("evalue", "1"); | |||
configList.add(instConfigMode); | |||
JSONObject instConfigUrl = new JSONObject(); | |||
instConfigUrl.put("ename", "callback_url"); | |||
instConfigUrl.put("evalue", dspCallbackUrl); | |||
configList.add(instConfigUrl); | |||
request.put("serviceInstConfigList", configList); | |||
JSONArray reqList = new JSONArray(); | |||
JSONObject instReqUrlPush = new JSONObject(); | |||
instReqUrlPush.put("ename", "push_url"); | |||
instReqUrlPush.put("evalue", missionStatusRequest.getPushUrl()); | |||
reqList.add(instReqUrlPush); | |||
JSONObject instReqUrlPull = new JSONObject(); | |||
instReqUrlPull.put("ename", "pull_url"); | |||
instReqUrlPull.put("evalue", missionStatusRequest.getPullUrl()); | |||
reqList.add(instReqUrlPull); | |||
request.put("serviceInstReqList", reqList); | |||
JSONObject responseJson = dspService.serviceInstApplication(request); | |||
if (responseJson.getIntValue("code") == 0) { | |||
String requestId = responseJson.getJSONObject("data").getString("requestId"); | |||
log.info("dsp实时调用响应requestId:{}", requestId); | |||
} else { | |||
log.error("dsp实时调用失败:{}", responseJson); | |||
throw new ServiceException(HttpStatus.BAD_REQUEST.value(), "任务失败!"); | |||
} | |||
return responseJson; | |||
} | |||
private Boolean stopAI(MissionStatusRequest missionStatusRequest, ThMission thMission) { | |||
log.info("停止AI分析"); | |||
Assert.notNull(thMission, "飞行任务不能为空!"); | |||
ThMission thMissionUpdate = new ThMission(UpdateOrCreateEnum.UPDATE.getCode()); | |||
thMissionUpdate.setId(thMission.getId()); | |||
thMissionUpdate.setMileage(missionStatusRequest.getMileage()); | |||
boolean result = false; | |||
// 任务调用完成之后,调用发送通道,请求DSP关闭请求 | |||
// 调用DSP接口 | |||
JSONObject jsonObject = new JSONObject(); | |||
jsonObject.put("requestId", thMission.getRequestId()); | |||
JSONObject responseJson = new JSONObject(); | |||
try { | |||
responseJson = dspService.serviceStopApplication(jsonObject); | |||
if (responseJson.getIntValue("code") == 0) { | |||
if (responseJson.containsKey("data") && ObjectUtil.isNotEmpty(responseJson.get("data"))) { | |||
String requestId = responseJson.getJSONObject("data").getString("requestId"); | |||
log.info("dsp实时调用响应requestId:{}", requestId); | |||
} else { | |||
log.info("dsp实时调用响应:{}", responseJson); | |||
} | |||
result = true; | |||
} else { | |||
log.error("dsp实时调用失败:{}", responseJson); | |||
thMissionUpdate.setAnalyseStatus(AiAnalyseStatusEnum.FAILED.getCode()); | |||
} | |||
thMissionMapper.updateById(thMissionUpdate); | |||
} catch (Exception e) { | |||
log.error("dsp实时调用失败:{}", responseJson); | |||
thMissionUpdate.setAnalyseStatus(AiAnalyseStatusEnum.FAILED.getCode()); | |||
thMissionMapper.updateById(thMissionUpdate); | |||
} | |||
return result; | |||
} | |||
private ThMission setStatus(MissionStatusRequest missionStatusRequest, ThMission thMission, AirPortTaskStatusEnum airPortTaskStatusEnum) { | |||
ThMission thMissionUpdate = new ThMission(UpdateOrCreateEnum.UPDATE.getCode()); | |||
thMissionUpdate.setId(thMission.getId()); | |||
if (missionStatusRequest.getStatus() == AirPortTaskStatusEnum.FLIGHT.getCode() && airPortTaskStatusEnum.getCode() == AirPortTaskStatusEnum.FLIGHT.getCode()) { | |||
thMissionUpdate.setPushUrl(missionStatusRequest.getPushUrl()); | |||
thMissionUpdate.setPullUrl(missionStatusRequest.getPullUrl()); | |||
thMissionUpdate.setStatus(TaskStatusEnum.FLIGHT.getCode()); | |||
} | |||
return thMissionUpdate; | |||
} | |||
private ThMission getRecentlyRecord(MissionStatusRequest missionStatusRequest, Integer status) { | |||
//获取当前任务里面这个巡检的最近的那一条,修改对应的任务的状态 | |||
LambdaQueryWrapper<ThMission> lambdaQueryWrapper = new LambdaQueryWrapper<>(); | |||
lambdaQueryWrapper.orderByAsc(ThMission::getExecutionStartTime); | |||
lambdaQueryWrapper.eq(ThMission::getInspectionLine, missionStatusRequest.getId()); | |||
lambdaQueryWrapper.eq(ThMission::getId, missionStatusRequest.getRequestId()); | |||
lambdaQueryWrapper.eq(ThMission::getStatus, status); | |||
//lambdaQueryWrapper.eq(ThMission::getTenantId,ShiroUtils.getTenantId()); | |||
List<ThMission> thMissions = thMissionMapper.selectList(lambdaQueryWrapper); | |||
return thMissions.size() > 0 ? thMissions.get(0) : null; | |||
} | |||
} |