@@ -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,42 @@ | |||
package com.tuoheng.admin.config; | |||
public interface SystemConstant { | |||
/** | |||
* 机场平台:获取机场列表接口 | |||
*/ | |||
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/createPointLine/droneCommand"; | |||
} |
@@ -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); | |||
} | |||
/** |
@@ -131,5 +131,16 @@ public class InspectionController { | |||
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; | |||
@@ -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(@RequestBody 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("/status/{id}/{status}") | |||
public JsonResult editStatusById(@PathVariable("id") Integer id,@PathVariable("status") Integer status){ | |||
return warningService.editStatusById(id,status); | |||
} | |||
} |
@@ -0,0 +1,32 @@ | |||
package com.tuoheng.admin.controller; | |||
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); | |||
} | |||
} |
@@ -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.Warning; | |||
import com.tuoheng.admin.entity.vo.warning.WarningListVo; | |||
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); | |||
} |
@@ -0,0 +1,65 @@ | |||
package com.tuoheng.admin.entity.domain; | |||
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; | |||
} |
@@ -0,0 +1,56 @@ | |||
package com.tuoheng.admin.entity.domain; | |||
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; | |||
} |
@@ -61,6 +61,11 @@ public class ThInspection extends BaseEntity implements Serializable { | |||
*/ | |||
private String altitude; | |||
/** | |||
* 飞行速度 | |||
*/ | |||
private String speed; | |||
/** | |||
* 经度 | |||
*/ | |||
@@ -77,4 +82,14 @@ public class ThInspection extends BaseEntity implements Serializable { | |||
*/ | |||
private Long flyTime; | |||
/** | |||
* 距离机场距离(米) | |||
*/ | |||
private String distHome; | |||
/** | |||
* 遥测信号 | |||
*/ | |||
private String ysingal; | |||
} |
@@ -192,4 +192,10 @@ public class ThMission extends BaseEntity implements Serializable { | |||
* DSP交互ID | |||
*/ | |||
private String requestId; | |||
/** | |||
* 机场飞行类型 0默认 1机场巡逻 2指点飞行 | |||
*/ | |||
private Integer airportFlyType; | |||
} |
@@ -0,0 +1,51 @@ | |||
package com.tuoheng.admin.entity.domain; | |||
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; | |||
} |
@@ -0,0 +1,70 @@ | |||
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; | |||
/** | |||
* 发现方式 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,0 +1,47 @@ | |||
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; | |||
} |
@@ -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; | |||
} |
@@ -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,53 @@ | |||
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 airportId; | |||
@ApiModelProperty(value = "机场名称") | |||
private String airportName; | |||
@ApiModelProperty(value = "路线id") | |||
private Integer inspectionLine; | |||
@ApiModelProperty(value = "路线名称") | |||
private String inspectionLineName; | |||
@ApiModelProperty(value = "无人机ID") | |||
private Integer droneId; | |||
@ApiModelProperty(value = "无人机名称") | |||
private String droneName; | |||
@ApiModelProperty(value = "业务系统标识") | |||
private String code; | |||
@ApiModelProperty(value = "租户代码") | |||
private String tenantCode; | |||
@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机场巡逻 2指点飞行") | |||
private Integer airportFlyType; | |||
@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,26 @@ | |||
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; | |||
} |
@@ -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; | |||
} |
@@ -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,22 @@ | |||
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:待确认;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 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,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 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 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,58 @@ | |||
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; | |||
} |
@@ -0,0 +1,78 @@ | |||
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; | |||
/** | |||
* 发现方式 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; | |||
} |
@@ -0,0 +1,29 @@ | |||
package com.tuoheng.admin.enums; | |||
import lombok.Getter; | |||
/** | |||
* 机场飞行类型 0默认 1机场巡逻 2指点飞行 | |||
* | |||
* @author wanjing | |||
* @team tuoheng | |||
* @date 2023-02-13 | |||
*/ | |||
public enum AirportFlyTypeEnum { | |||
NULL(0, "无"), | |||
AIRPORT_PATROL(1,"机场巡逻"), | |||
POINTING_FLIGHT(2,"指点飞行"); | |||
AirportFlyTypeEnum(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,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,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; | |||
} | |||
} |
@@ -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); | |||
} |
@@ -2,8 +2,12 @@ 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; | |||
public interface ThInspectionMapper extends BaseMapper<ThInspection> { | |||
List<ThInspection> selectListByMissionId(Integer missionId); | |||
} |
@@ -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); | |||
} |
@@ -6,10 +6,11 @@ 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.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; | |||
@@ -60,4 +61,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,98 @@ | |||
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.Tenant; | |||
import com.tuoheng.admin.entity.domain.ThInspection; | |||
import com.tuoheng.admin.entity.domain.ThMission; | |||
import com.tuoheng.admin.entity.vo.index.DroneDataVo; | |||
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.List; | |||
@Slf4j | |||
@Service | |||
public class QueryDroneDataService { | |||
@Autowired | |||
private TenantMapper tenantMapper; | |||
@Autowired | |||
private ThMissionMapper missionMapper; | |||
@Autowired | |||
private ThInspectionMapper inspectionMapper; | |||
public JsonResult getDroneDataById(String airportId) { | |||
log.info("获取无人机数据信息"); | |||
this.check(airportId); | |||
// 读取不同租户的机场平台url | |||
User user = ShiroUtils.getUserInfo(); | |||
Integer tenantId = user.getTenantId(); | |||
ThMission mission = missionMapper.selectOne(new LambdaQueryWrapper<ThMission>() | |||
.eq(ThMission::getTenantId, tenantId) | |||
.eq(ThMission::getStatus, TaskStatusEnum.FLIGHT.getCode()) | |||
.eq(ThMission::getAirportId, airportId) | |||
.eq(ThMission::getMark, 1)); | |||
if (ObjectUtil.isNull(mission)) { | |||
throw new ServiceException("没有正在飞行的任务"); | |||
} | |||
List<ThInspection> inspectionList = inspectionMapper.selectListByMissionId(mission.getId()); | |||
if (CollectionUtil.isEmpty(inspectionList)) { | |||
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)) { | |||
throw new ServiceException("机场ID为空"); | |||
} | |||
} | |||
/** | |||
* 获取租户 | |||
* | |||
* @param tenantId | |||
* @return | |||
*/ | |||
private Tenant getTenant(Integer tenantId) { | |||
Tenant tenant = tenantMapper.selectById(tenantId); | |||
if (ObjectUtil.isEmpty(tenant)) { | |||
log.info("调用机场平台,操作无人机: 租户不存在"); | |||
throw new ServiceException("租户不存在"); | |||
} | |||
if (StringUtils.isEmpty(tenant.getAirportUrl())) { | |||
log.info("调用机场平台,操作无人机: 机场平台URL为空"); | |||
throw new ServiceException("机场平台URL为空"); | |||
} | |||
return tenant; | |||
} | |||
} |
@@ -0,0 +1,108 @@ | |||
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.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; | |||
/** | |||
* 查询摄像头列表 | |||
* | |||
* @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); | |||
} | |||
if(StringUtils.isNotEmpty(entity.getLongitude()) && StringUtils.isNotEmpty(entity.getLatitude())){ | |||
String gaodeAddress = GaodeUtil.getGaodeAddress(entity.getLongitude(), entity.getLatitude()); | |||
entity.setLocation(gaodeAddress); | |||
} | |||
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()) | |||
.like(StringUtils.isNotEmpty(request.getCameraName()), Camera::getCameraName, request.getCameraName()) | |||
.orderByDesc(Camera::getCreateTime)); | |||
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,69 @@ | |||
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); | |||
} | |||
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(); | |||
} | |||
} |
@@ -86,10 +86,10 @@ public class IndexServiceImpl implements IndexService { | |||
} | |||
@Override | |||
public JsonResult getAirportDetail(GetAirportDetailDto getAirportDetailDto){ | |||
public JsonResult getAirportDetail(Integer airportId){ | |||
Tenant tenant = tenantMapper.selectById(ShiroUtils.getTenantId()); | |||
String url = tenant.getAirportUrl() +"/api/airportInterface/getAirportStatus"; | |||
String param = "airportId=" + getAirportDetailDto.getAirportId(); | |||
String param = "airportId=" + airportId; | |||
String result = HttpUtils.sendGet(url, param); | |||
JsonResult jsonResult = JacksonUtil.json2pojo(result, JsonResult.class); | |||
AirportDetailDto airportDetailDto = new AirportDetailDto(); | |||
@@ -97,6 +97,12 @@ public class IndexServiceImpl implements IndexService { | |||
JSONObject wthJson = dataObject.getJSONObject("WTH"); | |||
if(Objects.nonNull(wthJson)){ | |||
JSONObject parmJson = wthJson.getJSONObject("parm"); | |||
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") + "度"); | |||
//用角度表示风向,是把圆周分成360度,北风(N)是0度(即360度),东风(E)是90度,南风(S)是180度,西风(W)是270度 | |||
@@ -108,7 +114,7 @@ public class IndexServiceImpl implements IndexService { | |||
} | |||
JSONObject tahJson = dataObject.getJSONObject("TAH"); | |||
if(Objects.nonNull(tahJson)){ | |||
JSONObject parmJson = wthJson.getJSONObject("parm"); | |||
JSONObject parmJson = tahJson.getJSONObject("parm"); | |||
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); |
@@ -1,6 +1,5 @@ | |||
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; | |||
@@ -13,7 +12,10 @@ 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.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 +23,17 @@ 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.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 +41,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; | |||
@@ -78,6 +78,12 @@ public class MissionServiceImpl extends BaseServiceImpl<ThMissionMapper, ThMissi | |||
@Lazy | |||
private IThInspectionService inspectionService; | |||
@Resource | |||
private QueryMissionListService queryMissionListService; | |||
@Resource | |||
private QueryEmergencyListService queryEmergencyListService; | |||
@Value("${tuoheng.dsp-callback-url:}") | |||
private String dspCallbackUrl; | |||
@@ -378,4 +384,46 @@ 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()); | |||
} | |||
ThMission thMission = thMissionMapper.selectById(id); | |||
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); | |||
} | |||
} |
@@ -16,12 +16,15 @@ 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.warning.IWarningService; | |||
import com.tuoheng.admin.service.warning.WarningServiceImpl; | |||
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; | |||
@@ -40,6 +43,7 @@ import java.util.*; | |||
* @since 2022-08-03 | |||
*/ | |||
@Service | |||
@Slf4j | |||
public class QuestionServiceImpl extends BaseServiceImpl<QuestionMapper, Question> implements IQuestionService { | |||
@Autowired | |||
@@ -60,6 +64,12 @@ public class QuestionServiceImpl extends BaseServiceImpl<QuestionMapper, Questio | |||
@Autowired | |||
private IQuestionTypeService questionTypeService; | |||
@Autowired | |||
private WarningMapper warningMapper; | |||
@Autowired | |||
private IWarningService iWarningService; | |||
private final static SimpleDateFormat dateformat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | |||
@Override | |||
@@ -325,6 +335,9 @@ public class QuestionServiceImpl extends BaseServiceImpl<QuestionMapper, Questio | |||
//获取当前飞行坐标,存问题的经纬度 | |||
List<ThInspection> flightDataList = getThInspections(mission); | |||
List<Question> questionList = getQuestionList(mission, questionFiles, flightDataList); | |||
//保存问题数据时调用saveWarningData方法保存预警数据入库 | |||
Boolean aBoolean = saveWarningData(mission, questionFiles, flightDataList); | |||
log.info("预警表数据入库结束, {}",aBoolean); | |||
if(questionList.size()==0){ | |||
return true; | |||
} | |||
@@ -369,6 +382,35 @@ public class QuestionServiceImpl extends BaseServiceImpl<QuestionMapper, Questio | |||
return questionList; | |||
} | |||
//根据获取的问题列表问题类型code为002004,添加数据入库到预警表 | |||
private Boolean saveWarningData(ThMission mission, List<CallbackRequest.QuestionFilesDTO> questionFiles, List<ThInspection> flightDataList){ | |||
log.info("预警表数据入库开始..."); | |||
List<Warning> warningList = new ArrayList<>(); | |||
List<QuestionType> questionType = questionTypeService.getQuestionType(); | |||
Map<String,QuestionType> typeMap=new HashMap<>(); | |||
for (QuestionType type : questionType) { | |||
typeMap.put(type.getCode(),type); | |||
} | |||
//调用添加问题列表接口 | |||
List<Question> questionList = this.getQuestionList(mission, questionFiles, flightDataList); | |||
for (Question question : questionList) { | |||
Warning warning = new Warning(); | |||
//问题类型为火灾隐患时添加数据 | |||
if(question.getType().equals(QuestionTypeEnum.Q4.getCode())){ | |||
warning.setTenantId(question.getTenantId()); | |||
warning.setDiscoveryWay(DiscoveryWayEnum.UAV_PATROL.getCode()); | |||
warning.setLocation(""); | |||
warning.setStatus(WarningStatusEnum.WAIT_CONFIRM.getCode()); | |||
warning.setQuestionId(question.getId()); | |||
warning.setCreateUser(question.getCreateUser()); | |||
warning.setCreateTime(question.getCreateTime()); | |||
warning.setMark(MarkTypeEnum.VALID.getCode()); | |||
warningList.add(warning); | |||
} | |||
} | |||
return iWarningService.saveBatch(warningList); | |||
} | |||
private ThMission getThMission(String requestId) { | |||
LambdaQueryWrapper<ThMission> lambdaQueryWrapper=new LambdaQueryWrapper<>(); | |||
lambdaQueryWrapper.eq(ThMission::getMark,MarkTypeEnum.VALID.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,6 +5,7 @@ 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.Tenant; | |||
import com.tuoheng.admin.entity.domain.ThInspection; | |||
import com.tuoheng.admin.entity.domain.ThMission; | |||
@@ -223,5 +224,17 @@ 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查询对应的遥测数据 | |||
List<ThInspection> listData = inspectionMapper.selectListByMissionId(id); | |||
return JsonResult.success(listData); | |||
} | |||
} |
@@ -0,0 +1,73 @@ | |||
package com.tuoheng.admin.service.mission.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.Camera; | |||
import com.tuoheng.admin.entity.domain.ThMission; | |||
import com.tuoheng.admin.entity.request.camera.QueryCameraListRequest; | |||
import com.tuoheng.admin.entity.request.emergency.QueryEmergencyListRequest; | |||
import com.tuoheng.admin.enums.MarkEnum; | |||
import com.tuoheng.admin.enums.MissionEnum; | |||
import com.tuoheng.admin.enums.TaskStatusEnum; | |||
import com.tuoheng.admin.mapper.CameraMapper; | |||
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.ArrayList; | |||
import java.util.List; | |||
/** | |||
* 查询应急任务列表业务层处理 | |||
* | |||
* @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(ObjectUtil.isNotEmpty(request.getAirportFlyType()), ThMission::getAirportFlyType, request.getAirportFlyType()) | |||
.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, QueryEmergencyListRequest request) { | |||
return JsonResult.success(); | |||
} | |||
} |
@@ -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,93 @@ | |||
package com.tuoheng.admin.service.third.airport; | |||
import cn.hutool.core.util.ObjectUtil; | |||
import com.alibaba.fastjson.JSONObject; | |||
import com.tuoheng.admin.config.SystemConstant; | |||
import com.tuoheng.admin.entity.domain.Tenant; | |||
import com.tuoheng.admin.entity.request.airport.DroneControlRequest; | |||
import com.tuoheng.admin.entity.request.airport.PointFlightRequest; | |||
import com.tuoheng.admin.mapper.TenantMapper; | |||
import com.tuoheng.common.exception.ServiceException; | |||
import com.tuoheng.common.utils.HttpUtils; | |||
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 io.swagger.models.auth.In; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.stereotype.Service; | |||
import java.util.ArrayList; | |||
import java.util.HashMap; | |||
import java.util.List; | |||
import java.util.Map; | |||
@Slf4j | |||
@Service | |||
public class DroneControlService { | |||
@Autowired | |||
private TenantMapper tenantMapper; | |||
public JsonResult execute(DroneControlRequest request) { | |||
log.info("进入调用机场平台,操作无人机"); | |||
this.check(request); | |||
// 读取不同租户的机场平台url | |||
User user = ShiroUtils.getUserInfo(); | |||
Integer tenantId = user.getTenantId(); | |||
Tenant tenant = this.getTenant(tenantId); | |||
String url = tenant.getAirportUrl() + SystemConstant.API_AIRPORT_POINT_FLIGH; | |||
JSONObject jsonObject = new JSONObject().parseObject(request.getValue()); | |||
log.info("调用机场平台,操作无人机: url:{}", url); | |||
log.info("调用机场平台,操作无人机: jsonObject:{}", jsonObject); | |||
String airPortStr = HttpUtils.doSend(url, jsonObject, null, "POST"); | |||
if (StringUtils.isEmpty(airPortStr)) { | |||
log.info("执行定点飞行:机场接口返回数据为空,飞行失败,jsonObject:{}", jsonObject); | |||
return JsonResult.error(-1, "机场接口返回数据为空"); | |||
} | |||
log.info("调用机场平台方法: 操作无人机结束"); | |||
return JsonResult.success(); | |||
} | |||
/** | |||
* 检查参数 | |||
* | |||
* @param request | |||
* @return | |||
*/ | |||
private void check(DroneControlRequest request) { | |||
if (StringUtils.isEmpty(request.getValue())) { | |||
throw new ServiceException("操作无人机,传参空"); | |||
} | |||
} | |||
/** | |||
* 获取租户 | |||
* | |||
* @param tenantId | |||
* @return | |||
*/ | |||
private Tenant getTenant(Integer tenantId) { | |||
Tenant tenant = tenantMapper.selectById(tenantId); | |||
if (ObjectUtil.isEmpty(tenant)) { | |||
log.info("调用机场平台,操作无人机: 租户不存在"); | |||
throw new ServiceException("租户不存在"); | |||
} | |||
if (StringUtils.isEmpty(tenant.getAirportUrl())) { | |||
log.info("调用机场平台,操作无人机: 机场平台URL为空"); | |||
throw new ServiceException("机场平台URL为空"); | |||
} | |||
return tenant; | |||
} | |||
} |
@@ -0,0 +1,103 @@ | |||
package com.tuoheng.admin.service.third.airport; | |||
import cn.hutool.core.util.ObjectUtil; | |||
import com.alibaba.fastjson.JSONObject; | |||
import com.tuoheng.admin.config.SystemConstant; | |||
import com.tuoheng.admin.entity.domain.Tenant; | |||
import com.tuoheng.admin.entity.domain.ThMission; | |||
import com.tuoheng.admin.entity.request.airport.PointFlightRequest; | |||
import com.tuoheng.admin.enums.AirportFlyTypeEnum; | |||
import com.tuoheng.admin.enums.InspectionTypeEnum; | |||
import com.tuoheng.admin.enums.UpdateOrCreateEnum; | |||
import com.tuoheng.admin.mapper.TenantMapper; | |||
import com.tuoheng.admin.mapper.ThMissionMapper; | |||
import com.tuoheng.admin.utils.CodeUtil; | |||
import com.tuoheng.common.exception.ServiceException; | |||
import com.tuoheng.common.utils.DateUtils; | |||
import com.tuoheng.common.utils.HttpUtils; | |||
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; | |||
@Slf4j | |||
@Service | |||
public class PointFlightService { | |||
@Autowired | |||
private TenantMapper tenantMapper; | |||
@Autowired | |||
private ThMissionMapper missionMapper; | |||
public JsonResult executePointFligh(PointFlightRequest request) { | |||
log.info("进入调用机场平台,执行定点飞行"); | |||
// 读取不同租户的机场平台url | |||
User user = ShiroUtils.getUserInfo(); | |||
Integer tenantId = user.getTenantId(); | |||
Tenant tenant = tenantMapper.selectById(tenantId); | |||
if (ObjectUtil.isEmpty(tenant)) { | |||
log.info("调用机场平台,执行定点飞行: 租户不存在"); | |||
throw new ServiceException("租户不存在"); | |||
} | |||
if (StringUtils.isEmpty(tenant.getAirportUrl())) { | |||
log.info("调用机场平台,执行定点飞行: 机场平台URL为空"); | |||
throw new ServiceException("机场平台URL为空"); | |||
} | |||
// 创建应急任务 | |||
this.createMission(user, request); | |||
String url = tenant.getAirportUrl() + SystemConstant.API_AIRPORT_POINT_FLIGH; | |||
JSONObject jsonObject = new JSONObject(); | |||
jsonObject.put("airportId", request.getAirportId()); | |||
jsonObject.put("requestId", request.getInspectionLine()); | |||
jsonObject.put("code", "gs"); // 与机场平台约定好的 | |||
jsonObject.put("tenantCode", tenant.getCode()); | |||
jsonObject.put("alt", request.getAlt()); | |||
jsonObject.put("lon", request.getLon()); | |||
jsonObject.put("lat", request.getLat()); | |||
log.info("调用机场平台,执行定点飞行: url:{}", url); | |||
log.info("调用机场平台,执行定点飞行: jsonObject:{}", jsonObject); | |||
String airPortStr = HttpUtils.doSend(url, jsonObject, null, "POST"); | |||
if (StringUtils.isEmpty(airPortStr)) { | |||
log.info("执行定点飞行:机场接口返回数据为空,飞行失败,jsonObject:{}", jsonObject); | |||
return JsonResult.error(-1, "机场接口返回数据为空"); | |||
} | |||
log.info("调用机场平台方法: 执行定点飞行结束"); | |||
return JsonResult.success(); | |||
} | |||
private void createMission(User user, PointFlightRequest request) { | |||
ThMission mission = new ThMission(UpdateOrCreateEnum.CREATE.getCode()); | |||
String code = "XJRW" + CodeUtil.createCodeNo(); | |||
mission.setCode(code); | |||
mission.setName("应急任务" + code); | |||
mission.setTenantId(user.getTenantId()); | |||
mission.setInspectionType(InspectionTypeEnum.AIRPORT.getCode()); | |||
mission.setAirportId(request.getAirportId()); | |||
mission.setAirportName(request.getAirportName()); | |||
mission.setInspectionLine(request.getInspectionLine()); | |||
mission.setInspectionLineName(request.getInspectionLineName()); | |||
mission.setDroneId(request.getDroneId()); | |||
mission.setDroneName(request.getDroneName()); | |||
mission.setExecutionStartTime(DateUtils.now()); | |||
mission.setAirportFlyType(AirportFlyTypeEnum.POINTING_FLIGHT.getCode()); | |||
mission.setCreateUser(user.getId()); | |||
mission.setCreateTime(DateUtils.now()); | |||
Integer count = missionMapper.insert(mission); | |||
if (count <= 0) { | |||
log.info("创建应急任务失败"); | |||
throw new ServiceException("创建应急任务失败"); | |||
} | |||
} | |||
} |
@@ -0,0 +1,49 @@ | |||
package com.tuoheng.admin.service.warehouse; | |||
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.common.common.IBaseService; | |||
import com.tuoheng.common.utils.JsonResult; | |||
/** | |||
* 仓库Service接口 | |||
* | |||
* @author wanjing | |||
* @team tuoheng | |||
* @date 2023-02-06 | |||
*/ | |||
public interface IWarehouseService extends IBaseService<Warehouse> { | |||
/** | |||
* 查询仓库列表 | |||
* | |||
* @param request 仓库 | |||
* @return 仓库集合 | |||
*/ | |||
JsonResult getList(QueryWarehouseListRequest request); | |||
/** | |||
* 查询仓库分页列表 | |||
* | |||
* @param request 仓库 | |||
* @return 仓库集合 | |||
*/ | |||
JsonResult getPageList(QueryWarehousePageListRequest request); | |||
/** | |||
* 查询仓库 | |||
* | |||
* @param id 仓库主键 | |||
* @return 仓库 | |||
*/ | |||
JsonResult getOneById(Integer id); | |||
/** | |||
* 新增或编辑仓库 | |||
* | |||
* @param entity | |||
* @return | |||
*/ | |||
JsonResult editInfo(Warehouse entity); | |||
} |
@@ -0,0 +1,85 @@ | |||
package com.tuoheng.admin.service.warehouse; | |||
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.mapper.WarehouseMapper; | |||
import com.tuoheng.admin.service.warehouse.query.QueryWarehouseListService; | |||
import com.tuoheng.admin.service.warehouse.query.QueryWarehousePageListService; | |||
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 WarehouseServiceImpl extends BaseServiceImpl<WarehouseMapper, Warehouse> implements IWarehouseService { | |||
@Autowired | |||
private QueryWarehouseListService queryWarehouseListService; | |||
@Autowired | |||
private QueryWarehousePageListService queryWarehousePageListService; | |||
/** | |||
* 查询仓库列表 | |||
* | |||
* @param request 仓库 | |||
* @return 仓库 | |||
*/ | |||
@Override | |||
public JsonResult getList(QueryWarehouseListRequest request) { | |||
return queryWarehouseListService.getList(request); | |||
} | |||
/** | |||
* 查询仓库分页列表 | |||
* | |||
* @param request 仓库 | |||
* @return 仓库 | |||
*/ | |||
@Override | |||
public JsonResult getPageList(QueryWarehousePageListRequest request) { | |||
return queryWarehousePageListService.getPageList(request); | |||
} | |||
/** | |||
* 查询仓库 | |||
* | |||
* @param id 仓库主键 | |||
* @return 仓库 | |||
*/ | |||
@Override | |||
public JsonResult getOneById(Integer id) { | |||
return null; | |||
} | |||
@Override | |||
public JsonResult editInfo(Warehouse entity) { | |||
//新增 | |||
if (StringUtils.isNull(entity.getId())) { | |||
if (StringUtils.isEmpty(entity.getWarehouseName())) { | |||
throw new ServiceException("仓库名称不能为空"); | |||
} | |||
Integer tenantId = ShiroUtils.getTenantId(); | |||
entity.setTenantId(tenantId); | |||
} | |||
if (StringUtils.isNotEmpty(entity.getLongitude()) && StringUtils.isNotEmpty(entity.getLatitude())) { | |||
String gaodeAddress = GaodeUtil.getGaodeAddress(entity.getLongitude(), entity.getLatitude()); | |||
entity.setLocation(gaodeAddress); | |||
} | |||
super.edit(entity); | |||
return JsonResult.success(); | |||
} | |||
} |
@@ -0,0 +1,65 @@ | |||
package com.tuoheng.admin.service.warehouse.query; | |||
import cn.hutool.core.collection.CollectionUtil; | |||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |||
import com.tuoheng.admin.entity.domain.Warehouse; | |||
import com.tuoheng.admin.entity.request.warehouse.QueryWarehouseListRequest; | |||
import com.tuoheng.admin.enums.MarkTypeEnum; | |||
import com.tuoheng.admin.mapper.WarehouseMapper; | |||
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 QueryWarehouseListService { | |||
@Autowired | |||
private WarehouseMapper warehouseMapper; | |||
public JsonResult getList(QueryWarehouseListRequest 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<Warehouse> warehouseList = warehouseMapper.selectList(new LambdaQueryWrapper<Warehouse>() | |||
.eq(Warehouse::getMark, MarkTypeEnum.VALID) | |||
.eq(Warehouse::getTenantId, request.getTenantId())); | |||
if (CollectionUtil.isEmpty(warehouseList)) { | |||
log.info("仓库列表数据为空"); | |||
} | |||
return JsonResult.success(warehouseList); | |||
} | |||
/** | |||
* 检查参数 | |||
* | |||
* @param tenantId | |||
* @param request | |||
* @return | |||
*/ | |||
private JsonResult check(Integer tenantId, QueryWarehouseListRequest request) { | |||
return JsonResult.success(); | |||
} | |||
} |
@@ -0,0 +1,67 @@ | |||
package com.tuoheng.admin.service.warehouse.query; | |||
import cn.hutool.core.collection.CollectionUtil; | |||
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.domain.Warning; | |||
import com.tuoheng.admin.entity.request.warehouse.QueryWarehousePageListRequest; | |||
import com.tuoheng.admin.entity.request.warning.QueryWarningListRequest; | |||
import com.tuoheng.admin.mapper.WarehouseMapper; | |||
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 QueryWarehousePageListService { | |||
@Autowired | |||
private WarehouseMapper warehouseMapper; | |||
public JsonResult getPageList(QueryWarehousePageListRequest 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; | |||
} | |||
// 设置分页参数 | |||
IPage<Warehouse> page = new Page<>(request.getPage(), request.getLimit()); | |||
// 查询结果 | |||
IPage<Warehouse> pageData = warehouseMapper.selectPageList(page, request); | |||
if (CollectionUtil.isEmpty(pageData.getRecords())) { | |||
log.info("仓库分页列表数据为空"); | |||
} | |||
return JsonResult.success(pageData); | |||
} | |||
/** | |||
* 检查参数 | |||
* | |||
* @param tenantId | |||
* @param request | |||
* @return | |||
*/ | |||
private JsonResult check(Integer tenantId, QueryWarehousePageListRequest request) { | |||
return JsonResult.success(); | |||
} | |||
} |
@@ -0,0 +1,79 @@ | |||
package com.tuoheng.admin.service.warning; | |||
import com.tuoheng.admin.entity.domain.Warning; | |||
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.common.common.IBaseService; | |||
import com.tuoheng.common.utils.JsonResult; | |||
/** | |||
* 预警Service接口 | |||
* | |||
* @author wanjing | |||
* @team tuoheng | |||
* @date 2023-02-06 | |||
*/ | |||
public interface IWarningService extends IBaseService<Warning> { | |||
/** | |||
* 查询预警列表 | |||
* | |||
* @param request 预警 | |||
* @return 预警集合 | |||
*/ | |||
JsonResult getList(QueryWarningListRequest request); | |||
/** | |||
* 查询预警 | |||
* | |||
* @param id 预警主键 | |||
* @return 预警 | |||
*/ | |||
JsonResult getOneById(Integer id); | |||
/** | |||
* 告警列表 分页 | |||
* @param query | |||
* @return | |||
*/ | |||
JsonResult index(WarningQuery query); | |||
/** | |||
* | |||
* 确认 | |||
* | |||
* @param request | |||
* @return | |||
*/ | |||
JsonResult confirm(WarningConfirmRequest request); | |||
/** | |||
* | |||
* 忽略 | |||
* | |||
* @param id | |||
* @return | |||
*/ | |||
JsonResult ignore(Integer id); | |||
/** | |||
* 预警详情 | |||
* @param id | |||
* @return | |||
*/ | |||
JsonResult details(Integer id); | |||
/** | |||
* 预警通知下发 | |||
* @return | |||
*/ | |||
JsonResult notice(); | |||
/** | |||
* 通知预警与处理 | |||
* @param id | |||
* @return | |||
*/ | |||
JsonResult editStatusById(Integer id,Integer status); | |||
} |
@@ -0,0 +1,112 @@ | |||
package com.tuoheng.admin.service.warning; | |||
import com.tuoheng.admin.entity.domain.Warning; | |||
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.mapper.WarningMapper; | |||
import com.tuoheng.admin.service.warning.confirm.WarningConfirmService; | |||
import com.tuoheng.admin.service.warning.details.WarningDetailsService; | |||
import com.tuoheng.admin.service.warning.edit.WarningStatusService; | |||
import com.tuoheng.admin.service.warning.ignore.WarningIgnoreService; | |||
import com.tuoheng.admin.service.warning.notice.WarningNoticeService; | |||
import com.tuoheng.admin.service.warning.query.QueryWarningByIdService; | |||
import com.tuoheng.admin.service.warning.query.QueryWarningListService; | |||
import com.tuoheng.admin.service.warning.query.QueryWarningPageListService; | |||
import com.tuoheng.common.common.BaseServiceImpl; | |||
import com.tuoheng.common.utils.JsonResult; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.stereotype.Service; | |||
/** | |||
* 预警Service业务层处理 | |||
* | |||
* @author wanjing | |||
* @team tuoheng | |||
* @date 2023-02-06 | |||
*/ | |||
@Service | |||
@Slf4j | |||
public class WarningServiceImpl extends BaseServiceImpl<WarningMapper, Warning> implements IWarningService { | |||
@Autowired | |||
private QueryWarningListService queryWarningListService; | |||
@Autowired | |||
private QueryWarningByIdService queryWarningByIdService; | |||
@Autowired | |||
private QueryWarningPageListService queryWarningPageListService; | |||
@Autowired | |||
private WarningConfirmService warningConfirmService; | |||
@Autowired | |||
private WarningIgnoreService warningIgnoreService; | |||
@Autowired | |||
private WarningDetailsService warningDetailsService; | |||
@Autowired | |||
private WarningNoticeService warningNoticeService; | |||
@Autowired | |||
private WarningStatusService warningStatusService; | |||
/** | |||
* 查询预警列表 | |||
* | |||
* @param request 预警 | |||
* @return 预警 | |||
*/ | |||
@Override | |||
public JsonResult getList(QueryWarningListRequest request) { | |||
return queryWarningListService.getList(request); | |||
} | |||
/** | |||
* 查询预警 | |||
* | |||
* @param id 预警主键 | |||
* @return 预警 | |||
*/ | |||
@Override | |||
public JsonResult getOneById(Integer id) { | |||
return queryWarningByIdService.getOneById(id); | |||
} | |||
@Override | |||
public JsonResult index(WarningQuery query) { | |||
return queryWarningPageListService.index(query); | |||
} | |||
@Override | |||
public JsonResult confirm(WarningConfirmRequest request) { | |||
return warningConfirmService.confirm(request); | |||
} | |||
@Override | |||
public JsonResult ignore(Integer id) { | |||
return warningIgnoreService.ignore(id); | |||
} | |||
@Override | |||
public JsonResult details(Integer id) { | |||
return warningDetailsService.details(id); | |||
} | |||
@Override | |||
public JsonResult notice() { | |||
return warningNoticeService.notice(); | |||
} | |||
@Override | |||
public JsonResult editStatusById(Integer id,Integer status) { | |||
return warningStatusService.editStatusById(id,status); | |||
} | |||
} |
@@ -0,0 +1,98 @@ | |||
package com.tuoheng.admin.service.warning.confirm; | |||
import cn.hutool.core.util.ObjectUtil; | |||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |||
import com.tuoheng.admin.entity.domain.Warning; | |||
import com.tuoheng.admin.entity.request.warning.WarningConfirmRequest; | |||
import com.tuoheng.admin.enums.MarkEnum; | |||
import com.tuoheng.admin.enums.WarningStatusEnum; | |||
import com.tuoheng.admin.mapper.WarningMapper; | |||
import com.tuoheng.common.exception.ServiceException; | |||
import com.tuoheng.common.utils.DateUtils; | |||
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.HashMap; | |||
import java.util.Map; | |||
/** | |||
* 预警确认业务层处理 | |||
* | |||
* @author wanjing | |||
* @team tuoheng | |||
* @date 2023-02-07 | |||
*/ | |||
@Slf4j | |||
@Service | |||
public class WarningConfirmService { | |||
@Autowired | |||
private WarningMapper warningMapper; | |||
public JsonResult confirm(WarningConfirmRequest request) { | |||
log.info("进入预警确认业务, request:{}", request); | |||
User user = ShiroUtils.getUserInfo(); | |||
Integer tenantId = user.getTenantId(); | |||
JsonResult result = this.check(tenantId, request); | |||
if (0 != result.getCode()) { | |||
log.info("进入任务问题确认业务:校验失败:{}", result.getMsg()); | |||
return result; | |||
} | |||
// 确认预警 | |||
result = this.updateStatus(user, request); | |||
return result; | |||
} | |||
/** | |||
* 检查参数 | |||
* | |||
* @param tenantId | |||
* @param request | |||
* @return | |||
*/ | |||
private JsonResult check(Integer tenantId, WarningConfirmRequest request) { | |||
// 判断预警id是否为空 | |||
if (ObjectUtil.isNotNull(request.getId())) { | |||
throw new ServiceException("预警ID为空"); | |||
} | |||
Warning warning = warningMapper.selectOne(new LambdaQueryWrapper<Warning>() | |||
.eq(Warning::getId, request.getId()) | |||
.eq(Warning::getTenantId, tenantId) | |||
.eq(Warning::getMark, MarkEnum.VALID.getCode())); | |||
if (ObjectUtil.isNull(warning)) { | |||
throw new ServiceException("预警信息不存在"); | |||
} | |||
if (!tenantId.equals(warning.getTenantId())) { | |||
throw new ServiceException("该租户没有查询该预警信息的权限"); | |||
} | |||
return JsonResult.success(warning); | |||
} | |||
/** | |||
* 预警状态,改为确认 | |||
* | |||
* @param user | |||
* @param request | |||
*/ | |||
private JsonResult updateStatus(User user, WarningConfirmRequest request) { | |||
Map<String, Object> map = new HashMap<>(); | |||
map.put("id", request.getId()); | |||
map.put("status", WarningStatusEnum.CONFIRM.getCode()); | |||
map.put("updateUser", user.getId()); | |||
map.put("updateTime", DateUtils.now()); | |||
map.put("checkUser", user.getId()); | |||
map.put("checkTime", DateUtils.now()); | |||
map.put("checkResult", request.getCheckResult()); | |||
Integer rowCount = warningMapper.confirm(map); | |||
if (rowCount <= 0) { | |||
log.info("修改预警状态, 确认失败"); | |||
throw new ServiceException("修改预警状态, 确认失败"); | |||
} | |||
return JsonResult.success(); | |||
} | |||
} |
@@ -0,0 +1,136 @@ | |||
package com.tuoheng.admin.service.warning.details; | |||
import cn.hutool.core.collection.CollectionUtil; | |||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |||
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; | |||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||
import com.tuoheng.admin.common.ServiceExceptionEnum; | |||
import com.tuoheng.admin.entity.domain.Question; | |||
import com.tuoheng.admin.entity.domain.ThMission; | |||
import com.tuoheng.admin.entity.domain.Warning; | |||
import com.tuoheng.admin.entity.domain.WarningRecord; | |||
import com.tuoheng.admin.entity.vo.WarningDetailsVO; | |||
import com.tuoheng.admin.entity.vo.WarningRecordVO; | |||
import com.tuoheng.admin.enums.MarkTypeEnum; | |||
import com.tuoheng.admin.enums.WarningEnum; | |||
import com.tuoheng.admin.mapper.QuestionMapper; | |||
import com.tuoheng.admin.mapper.ThMissionMapper; | |||
import com.tuoheng.admin.mapper.WarningMapper; | |||
import com.tuoheng.admin.mapper.WarningRecordMapper; | |||
import com.tuoheng.common.config.CommonConfig; | |||
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.ArrayList; | |||
import java.util.List; | |||
import java.util.stream.Collectors; | |||
/** | |||
* 预警详情业务处理层 | |||
* @Author ChengWang | |||
* @Date 2023/2/8 | |||
*/ | |||
@Service | |||
@Slf4j | |||
public class WarningDetailsService { | |||
@Autowired | |||
private WarningMapper warningMapper; | |||
@Autowired | |||
private QuestionMapper questionMapper; | |||
@Autowired | |||
private WarningRecordMapper warningRecordMapper; | |||
@Autowired | |||
private ThMissionMapper missionMapper; | |||
public JsonResult details(Integer id) { | |||
User user = ShiroUtils.getUserInfo(); | |||
Integer tenantId = user.getTenantId(); | |||
//校验 | |||
if(null == id){ | |||
throw new ServiceException(ServiceExceptionEnum.PARAMETER_IS_NULL); | |||
} | |||
//根据id查询预警详情 | |||
Warning warning = warningMapper.selectOne(Wrappers.<Warning>lambdaQuery() | |||
.eq(Warning::getId, id) | |||
.eq(Warning::getTenantId,tenantId) | |||
.eq(Warning::getMark, MarkTypeEnum.VALID.getCode())); | |||
if(ObjectUtils.isEmpty(warning)){ | |||
return JsonResult.error(WarningEnum.WARNING_DATA_IS_NULL.getCode(),WarningEnum.WARNING_DATA_IS_NULL.getMsg()); | |||
} | |||
WarningDetailsVO vo = new WarningDetailsVO(); | |||
vo.setLocation(warning.getLocation()); | |||
vo.setDiscoveryWay(warning.getDiscoveryWay()); | |||
vo.setCreateTime(warning.getCreateTime()); | |||
//当前预警记录对应的问题 | |||
Question question = questionMapper.selectOne(Wrappers.<Question>lambdaQuery() | |||
.eq(Question::getId, warning.getQuestionId()) | |||
.eq(Question::getMark, 1)); | |||
if(ObjectUtils.isEmpty(question)){ | |||
return JsonResult.error(WarningEnum.QUESTION_IS_NOT_EXIST.getCode(),WarningEnum.QUESTION_IS_NOT_EXIST.getMsg()); | |||
} | |||
String fileOriginalUrl = question.getFileOriginalUrl(); | |||
if(StringUtils.isNotEmpty(fileOriginalUrl)){ | |||
vo.setFileOriginalUrl(CommonConfig.imageURL+fileOriginalUrl); | |||
} | |||
//火灾核实记录 一条预警对应多条火灾预警记录 | |||
List<WarningRecordVO> warningRecordVo = new ArrayList<>(); | |||
List<WarningRecord> warningRecords = warningRecordMapper.selectList(new LambdaQueryWrapper<WarningRecord>() | |||
.eq(WarningRecord::getWarningId, id).eq(WarningRecord::getMark, 1) | |||
.eq(WarningRecord::getTenantId, tenantId)); | |||
if(CollectionUtil.isNotEmpty(warningRecords)){ | |||
List<WarningRecordVO> list = warningRecords.stream().map(x -> { | |||
WarningRecordVO warningRecordVO = new WarningRecordVO(); | |||
warningRecordVO.setRecordStartTime(x.getCreateTime()); | |||
//巡检机场名称 | |||
ThMission thMission = missionMapper.selectOne(new LambdaQueryWrapper<ThMission>() | |||
.eq(ThMission::getId, x.getMissionId()) | |||
.eq(ThMission::getMark, 1)); | |||
if (ObjectUtils.isNotEmpty(thMission)) { | |||
//获取巡检机场 | |||
String airportName = thMission.getAirportName(); | |||
if (StringUtils.isNotEmpty(airportName)) { | |||
warningRecordVO.setAirportName(airportName); | |||
} | |||
//巡检任务id | |||
Integer missionId = thMission.getId(); | |||
if(missionId != null){ | |||
warningRecordVO.setMissionId(missionId); | |||
} | |||
//巡检任务状态 | |||
Integer status = thMission.getStatus(); | |||
if(status != null){ | |||
warningRecordVO.setStatus(thMission.getStatus()); | |||
} | |||
} | |||
return warningRecordVO; | |||
}).collect(Collectors.toList()); | |||
for (WarningRecordVO warningRecordVO : list) { | |||
warningRecordVo.add(warningRecordVO); | |||
} | |||
} | |||
vo.setWarningRecordVOList(warningRecordVo); | |||
//处理记录 | |||
if(StringUtils.isNotEmpty(warning.getCheckResult())){ | |||
vo.setCheckResult(warning.getCheckResult()); | |||
} | |||
if(warning.getCheckUser() != null){ | |||
vo.setCheckUser(warning.getCheckUser()); | |||
} | |||
if(warning.getCheckTime() != null){ | |||
vo.setCheckTime(warning.getCheckTime()); | |||
} | |||
return JsonResult.success(vo); | |||
} | |||
} |
@@ -0,0 +1,44 @@ | |||
package com.tuoheng.admin.service.warning.edit; | |||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; | |||
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; | |||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||
import com.tuoheng.admin.entity.domain.Warning; | |||
import com.tuoheng.admin.enums.MarkTypeEnum; | |||
import com.tuoheng.admin.mapper.WarningMapper; | |||
import com.tuoheng.common.utils.JsonResult; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.stereotype.Service; | |||
/** | |||
* @Author ChengWang | |||
* @Date 2023/2/9 | |||
*/ | |||
@Service | |||
@Slf4j | |||
public class WarningStatusService { | |||
@Autowired | |||
private WarningMapper warningMapper; | |||
/** | |||
* 通知忽略与处理 | |||
* @param id | |||
* @param status | |||
* @return | |||
*/ | |||
public JsonResult editStatusById(Integer id,Integer status) { | |||
//根据id查询并更新预警状态 | |||
Warning warning = warningMapper.selectById(id); | |||
if(ObjectUtils.isNotEmpty(warning)){ | |||
warning.setStatus(status); | |||
int result = warningMapper.updateById(warning); | |||
if(result<=0){ | |||
return JsonResult.error(); | |||
} | |||
} | |||
return JsonResult.success(); | |||
} | |||
} |
@@ -0,0 +1,97 @@ | |||
package com.tuoheng.admin.service.warning.ignore; | |||
import cn.hutool.core.util.ObjectUtil; | |||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |||
import com.tuoheng.admin.entity.domain.Warning; | |||
import com.tuoheng.admin.enums.MarkEnum; | |||
import com.tuoheng.admin.enums.WarningStatusEnum; | |||
import com.tuoheng.admin.mapper.WarningMapper; | |||
import com.tuoheng.common.exception.ServiceException; | |||
import com.tuoheng.common.utils.DateUtils; | |||
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.HashMap; | |||
import java.util.Map; | |||
/** | |||
* 预警忽略业务层处理 | |||
* | |||
* @author wanjing | |||
* @team tuoheng | |||
* @date 2023-02-07 | |||
*/ | |||
@Slf4j | |||
@Service | |||
public class WarningIgnoreService { | |||
@Autowired | |||
private WarningMapper warningMapper; | |||
public JsonResult ignore(Integer id) { | |||
log.info("进入预警忽略业务, id:{}", id); | |||
User user = ShiroUtils.getUserInfo(); | |||
Integer tenantId = user.getTenantId(); | |||
JsonResult result = this.check(tenantId, id); | |||
if (0 != result.getCode()) { | |||
log.info("进入预警忽略业务:校验失败:{}", result.getMsg()); | |||
return result; | |||
} | |||
// 忽略任务问题 | |||
result = this.updateStatus(user, id); | |||
return result; | |||
} | |||
/** | |||
* 检查参数 | |||
* | |||
* @param tenantId | |||
* @param id | |||
* @return | |||
*/ | |||
private JsonResult check(Integer tenantId, Integer id) { | |||
// 判断预警id是否为空 | |||
if (ObjectUtil.isNotNull(id)) { | |||
throw new ServiceException("预警ID为空"); | |||
} | |||
Warning warning = warningMapper.selectOne(new LambdaQueryWrapper<Warning>() | |||
.in(Warning::getId, id) | |||
.eq(Warning::getMark, MarkEnum.VALID.getCode())); | |||
if (ObjectUtil.isNull(warning)) { | |||
throw new ServiceException("预警信息不存在"); | |||
} | |||
if (!tenantId.equals(warning.getTenantId())) { | |||
throw new ServiceException("该租户没有查询该预警信息的权限"); | |||
} | |||
return JsonResult.success(warning); | |||
} | |||
/** | |||
* 预警状态,改为忽略 | |||
* | |||
* @param user | |||
* @param id | |||
*/ | |||
private JsonResult updateStatus(User user, Integer id) { | |||
Map<String, Object> map = new HashMap<>(); | |||
map.put("id", id); | |||
map.put("status", WarningStatusEnum.CONFIRM.getCode()); | |||
map.put("updateUser", user.getId()); | |||
map.put("updateTime", DateUtils.now()); | |||
map.put("checkUser", user.getId()); | |||
map.put("checkTime", DateUtils.now()); | |||
Integer rowCount = warningMapper.confirm(map); | |||
if (rowCount <= 0) { | |||
log.info("修改预警状态, 确认失败"); | |||
throw new ServiceException("修改预警状态, 确认失败"); | |||
} | |||
return JsonResult.success(); | |||
} | |||
} |
@@ -0,0 +1,49 @@ | |||
package com.tuoheng.admin.service.warning.notice; | |||
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; | |||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||
import com.tuoheng.admin.entity.domain.Warning; | |||
import com.tuoheng.admin.enums.MarkTypeEnum; | |||
import com.tuoheng.admin.enums.WarningStatusEnum; | |||
import com.tuoheng.admin.mapper.WarningMapper; | |||
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 ChengWang | |||
* @Date 2023/2/9 | |||
*/ | |||
@Service | |||
@Slf4j | |||
public class WarningNoticeService { | |||
@Autowired | |||
private WarningMapper warningMapper; | |||
/** | |||
* 火灾通知下发弹窗 | |||
* @return | |||
*/ | |||
public JsonResult notice() { | |||
//当前登录用户 | |||
User user = ShiroUtils.getUserInfo(); | |||
Integer tenantId = ShiroUtils.getTenantId(); | |||
//查询预警表是否有预警数据 | |||
List<Warning> warningList = warningMapper.selectList(Wrappers.<Warning>lambdaQuery() | |||
.eq(Warning::getTenantId, tenantId) | |||
.eq(Warning::getStatus, WarningStatusEnum.WAIT_CONFIRM.getCode()) | |||
.eq(Warning::getMark, MarkTypeEnum.VALID.getCode())); | |||
if(CollectionUtils.isEmpty(warningList) || warningList.size() == 0){ | |||
return JsonResult.success(); | |||
} | |||
return JsonResult.success(warningList); | |||
} | |||
} |
@@ -0,0 +1,69 @@ | |||
package com.tuoheng.admin.service.warning.query; | |||
import cn.hutool.core.util.ObjectUtil; | |||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |||
import com.tuoheng.admin.entity.domain.Warning; | |||
import com.tuoheng.admin.enums.MarkEnum; | |||
import com.tuoheng.admin.mapper.QuestionMapper; | |||
import com.tuoheng.admin.mapper.WarningMapper; | |||
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; | |||
/** | |||
* 根据Id查询预警信息业务层处理 | |||
* | |||
* @author wanjing | |||
* @team tuoheng | |||
* @date 2023-02-07 | |||
*/ | |||
@Slf4j | |||
@Service | |||
public class QueryWarningByIdService { | |||
@Autowired | |||
private WarningMapper warningMapper; | |||
@Autowired | |||
private QuestionMapper questionMapper; | |||
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; | |||
} | |||
Warning warning = (Warning) result.getData(); | |||
return JsonResult.success(warning); | |||
} | |||
/** | |||
* 检查参数 | |||
* | |||
* @param tenantId | |||
* @param id | |||
* @return | |||
*/ | |||
private JsonResult check(Integer tenantId, Integer id) { | |||
// 判断预警id是否为空 | |||
if (ObjectUtil.isNotNull(id)) { | |||
throw new ServiceException("预警ID为空"); | |||
} | |||
Warning warning = warningMapper.selectOne(new LambdaQueryWrapper<Warning>() | |||
.eq(Warning::getId, id) | |||
.eq(Warning::getTenantId, tenantId) | |||
.eq(Warning::getMark, MarkEnum.VALID.getCode())); | |||
if (ObjectUtil.isNull(warning)) { | |||
throw new ServiceException("预警信息不存在"); | |||
} | |||
return JsonResult.success(warning); | |||
} | |||
} |
@@ -0,0 +1,118 @@ | |||
package com.tuoheng.admin.service.warning.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.conver.WarningConverMapper; | |||
import com.tuoheng.admin.entity.domain.Question; | |||
import com.tuoheng.admin.entity.domain.Warning; | |||
import com.tuoheng.admin.entity.request.warning.QueryWarningListRequest; | |||
import com.tuoheng.admin.entity.vo.warning.WarningListVo; | |||
import com.tuoheng.admin.enums.MarkEnum; | |||
import com.tuoheng.admin.mapper.QuestionMapper; | |||
import com.tuoheng.admin.mapper.WarningMapper; | |||
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.HashMap; | |||
import java.util.List; | |||
import java.util.Map; | |||
import java.util.stream.Collectors; | |||
/** | |||
* 查询预警业务层处理 | |||
* | |||
* @author wanjing | |||
* @team tuoheng | |||
* @date 2022-11-22 | |||
*/ | |||
@Slf4j | |||
@Service | |||
public class QueryWarningListService { | |||
@Autowired | |||
private WarningMapper warningMapper; | |||
@Autowired | |||
private QuestionMapper questionMapper; | |||
public JsonResult getList(QueryWarningListRequest 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<Warning> warningList = warningMapper.getList(request); | |||
if (CollectionUtil.isEmpty(warningList)) { | |||
log.info("预警列表数据为空"); | |||
} | |||
// 构造返回结果对象 | |||
List<WarningListVo> warningListVoList = this.buildWarningListVo(warningList); | |||
return JsonResult.success(warningListVoList); | |||
} | |||
/** | |||
* 检查参数 | |||
* | |||
* @param tenantId | |||
* @param request | |||
* @return | |||
*/ | |||
private JsonResult check(Integer tenantId, QueryWarningListRequest request) { | |||
return JsonResult.success(); | |||
} | |||
/** | |||
* 1)、完善经纬度坐标字段 | |||
* | |||
* @param warningList | |||
* @return | |||
*/ | |||
private List<WarningListVo> buildWarningListVo(List<Warning> warningList) { | |||
List<WarningListVo> warningListVoList = WarningConverMapper.INSTANCE.fromWarningListToWarningListVoList(warningList); | |||
Map<Integer, Question> questionMap = this.getQuestionMap( warningList); | |||
Question question; | |||
for (WarningListVo warningListVo : warningListVoList) { | |||
question = questionMap.get(warningListVo.getQuestionId()); | |||
if (ObjectUtil.isNotNull(question)) { | |||
warningListVo.setLng(question.getLng()); | |||
warningListVo.setLat(question.getLat()); | |||
} | |||
} | |||
return warningListVoList; | |||
} | |||
/** | |||
* 查询到的任务列表,放到map中 | |||
* | |||
* @param warningList | |||
* @return | |||
*/ | |||
private Map<Integer, Question> getQuestionMap(List<Warning> warningList) { | |||
Map<Integer, Question> map = new HashMap<>(); | |||
List<Integer> questionIdList = warningList.stream().map(o -> o.getQuestionId()).collect(Collectors.toList()); | |||
if (CollectionUtil.isEmpty(questionIdList)) { | |||
log.info("questionIdList为空"); | |||
return null; | |||
} | |||
List<Question> questionList = questionMapper.selectList(new LambdaQueryWrapper<Question>() | |||
.in(Question::getId, questionIdList) | |||
.eq(Question::getMark, MarkEnum.VALID.getCode())); | |||
for (Question question : questionList) { | |||
map.put(question.getId(), question); | |||
} | |||
return map; | |||
} | |||
} |
@@ -0,0 +1,114 @@ | |||
package com.tuoheng.admin.service.warning.query; | |||
import com.baomidou.mybatisplus.core.metadata.IPage; | |||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |||
import com.tuoheng.admin.common.ServiceExceptionEnum; | |||
import com.tuoheng.admin.entity.domain.Warning; | |||
import com.tuoheng.admin.entity.query.WarningQuery; | |||
import com.tuoheng.admin.entity.vo.WarningVO; | |||
import com.tuoheng.admin.enums.DiscoveryWayEnum; | |||
import com.tuoheng.admin.enums.MarkTypeEnum; | |||
import com.tuoheng.admin.enums.WarningEnum; | |||
import com.tuoheng.admin.enums.WarningStatusEnum; | |||
import com.tuoheng.admin.mapper.WarningMapper; | |||
import com.tuoheng.common.exception.ServiceException; | |||
import com.tuoheng.common.utils.DateUtils; | |||
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.BeanUtils; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.stereotype.Service; | |||
import java.util.Date; | |||
import java.util.List; | |||
import java.util.stream.Collectors; | |||
/** | |||
* @Author ChengWang | |||
* @Date 2023/2/7 | |||
*/ | |||
@Slf4j | |||
@Service | |||
public class QueryWarningPageListService { | |||
@Autowired | |||
private WarningMapper warningMapper; | |||
/** | |||
* 告警列表查询 分页 | |||
* | |||
* @param query | |||
* @return | |||
*/ | |||
public JsonResult index(WarningQuery query) { | |||
//校验 | |||
if (query.getLimit() == null && query.getPage() == null) { | |||
throw new ServiceException(ServiceExceptionEnum.PARAMETER_IS_NULL); | |||
} | |||
User user = ShiroUtils.getUserInfo(); | |||
Integer tenantId = user.getTenantId(); | |||
if (null == tenantId) { | |||
return JsonResult.error(WarningEnum.TENANT_ID_IS_NULL.getCode(), WarningEnum.TENANT_ID_IS_NULL.getMsg()); | |||
} | |||
query.setTenantId(tenantId); | |||
IPage<Warning> page = new Page<>(query.getPage(), query.getLimit()); | |||
IPage<WarningVO> pageData = new Page<>(query.getPage(), query.getLimit()); | |||
//时间 | |||
Date startTime = null; | |||
Date endTime = null; | |||
if (StringUtils.isNotEmpty(query.getStartTime()) && StringUtils.isNotEmpty(query.getEndTime())) { | |||
startTime = DateUtils.dateTime(DateUtils.YYYY_MM_DD_HH_MM_SSS,query.getStartTime()+" 00:00:00"); | |||
endTime = DateUtils.dateTime(DateUtils.YYYY_MM_DD_HH_MM_SSS,query.getEndTime()+" 23:59:59"); | |||
} | |||
query.setWaringStartTime(startTime); | |||
query.setWaringEndTime(endTime); | |||
//获取分页数据 | |||
IPage<Warning> warningPageData = warningMapper.selectPage(page, Wrappers.<Warning>lambdaQuery() | |||
.eq(null != query.getDiscoveryWay(), Warning::getDiscoveryWay, query.getDiscoveryWay()) | |||
.eq(null != query.getStatus(), Warning::getStatus, query.getStatus()) | |||
.eq(Warning::getTenantId,tenantId) | |||
.eq(Warning::getMark,MarkTypeEnum.VALID.getCode()) | |||
.between(null != query.getWaringStartTime() && null != query.getWaringEndTime(), Warning::getCreateTime, query.getWaringStartTime(), query.getWaringEndTime()) | |||
.eq(Warning::getMark, MarkTypeEnum.VALID.getCode())); | |||
if (null == warningPageData) { | |||
return null; | |||
} | |||
//属性赋值 | |||
List<WarningVO> collect = warningPageData.getRecords().stream().map(x -> { | |||
WarningVO vo = new WarningVO(); | |||
BeanUtils.copyProperties(x, vo); | |||
//时间 | |||
vo.setWaringTime(x.getCreateTime()); | |||
//预警来源 | |||
if(x.getDiscoveryWay() == DiscoveryWayEnum.SURVEILLANCE_CAMERA.getCode()){ | |||
vo.setDiscoverWayName(DiscoveryWayEnum.SURVEILLANCE_CAMERA.getDescription()); | |||
} | |||
if(x.getDiscoveryWay() == DiscoveryWayEnum.UAV_PATROL.getCode()){ | |||
vo.setDiscoverWayName(DiscoveryWayEnum.UAV_PATROL.getDescription()); | |||
} | |||
if(x.getDiscoveryWay() == DiscoveryWayEnum.MANUAL_INSPECTION.getCode()){ | |||
vo.setDiscoverWayName(DiscoveryWayEnum.MANUAL_INSPECTION.getDescription()); | |||
} | |||
//状态 | |||
if(x.getStatus() == WarningStatusEnum.WAIT_CONFIRM.getCode()){ | |||
vo.setStatusName(WarningStatusEnum.WAIT_CONFIRM.getDescription()); | |||
} | |||
if(x.getStatus() == WarningStatusEnum.CONFIRM.getCode()){ | |||
vo.setStatusName(WarningStatusEnum.CONFIRM.getDescription()); | |||
} | |||
if(x.getStatus() == WarningStatusEnum.IGNORE.getCode()){ | |||
vo.setStatusName(WarningStatusEnum.IGNORE.getDescription()); | |||
} | |||
return vo; | |||
}).collect(Collectors.toList()); | |||
pageData.setRecords(collect); | |||
return JsonResult.success(pageData); | |||
} | |||
} |
@@ -0,0 +1,31 @@ | |||
package com.tuoheng.admin.service.warningrecord; | |||
import com.tuoheng.admin.entity.request.warningrecord.QueryWarningRecordListByWarningIdRequest; | |||
import com.tuoheng.common.utils.JsonResult; | |||
/** | |||
* 预警记录Service接口 | |||
* | |||
* @author wanjing | |||
* @team tuoheng | |||
* @date 2023-02-06 | |||
*/ | |||
public interface IWarningRecordService { | |||
/** | |||
* 查询预警记录列表 | |||
* | |||
* @param request 预警记录 | |||
* @return 预警记录集合 | |||
*/ | |||
JsonResult getListByWarningId(QueryWarningRecordListByWarningIdRequest request); | |||
/** | |||
* 查询预警记录 | |||
* | |||
* @param id 预警记录主键 | |||
* @return 预警记录 | |||
*/ | |||
JsonResult getOneById(String id); | |||
} |
@@ -0,0 +1,43 @@ | |||
package com.tuoheng.admin.service.warningrecord; | |||
import com.tuoheng.admin.entity.request.warningrecord.QueryWarningRecordListByWarningIdRequest; | |||
import com.tuoheng.admin.service.warningrecord.query.QueryWarningRecordListByWarningIdService; | |||
import com.tuoheng.common.utils.JsonResult; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.stereotype.Service; | |||
/** | |||
* 预警记录Service业务层处理 | |||
* | |||
* @author wanjing | |||
* @team tuoheng | |||
* @date 2023-02-06 | |||
*/ | |||
@Service | |||
public class WarningRecordServiceImpl implements IWarningRecordService { | |||
@Autowired | |||
private QueryWarningRecordListByWarningIdService queryWarningRecordListByWarningIdService; | |||
/** | |||
* 查询预警记录列表 | |||
* | |||
* @param request 预警记录 | |||
* @return 预警记录 | |||
*/ | |||
@Override | |||
public JsonResult getListByWarningId(QueryWarningRecordListByWarningIdRequest request) { | |||
return queryWarningRecordListByWarningIdService.getListByWarningId(request); | |||
} | |||
/** | |||
* 查询预警记录 | |||
* | |||
* @param id 预警记录主键 | |||
* @return 预警记录 | |||
*/ | |||
@Override | |||
public JsonResult getOneById(String id) { | |||
return null; | |||
} | |||
} |
@@ -0,0 +1,80 @@ | |||
package com.tuoheng.admin.service.warningrecord.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.Warning; | |||
import com.tuoheng.admin.entity.domain.WarningRecord; | |||
import com.tuoheng.admin.entity.request.warningrecord.QueryWarningRecordListByWarningIdRequest; | |||
import com.tuoheng.admin.enums.MarkEnum; | |||
import com.tuoheng.admin.mapper.WarningMapper; | |||
import com.tuoheng.admin.mapper.WarningRecordMapper; | |||
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; | |||
/** | |||
* 查询预警记录业务层处理 | |||
* | |||
* @author wanjing | |||
* @team tuoheng | |||
* @date 2022-11-22 | |||
*/ | |||
@Slf4j | |||
@Service | |||
public class QueryWarningRecordListByWarningIdService { | |||
@Autowired | |||
private WarningMapper warningMapper; | |||
@Autowired | |||
private WarningRecordMapper warningRecordMapper; | |||
public JsonResult getListByWarningId(QueryWarningRecordListByWarningIdRequest request) { | |||
// log.info("进入根据预警ID查询预警记录列表业务"); | |||
User user = ShiroUtils.getUserInfo(); | |||
Integer tenantId = user.getTenantId(); | |||
request.setTenantId(tenantId); | |||
JsonResult result = this.check(tenantId, request); | |||
if (0 != result.getCode()) { | |||
log.info("进入根据预警ID查询预警记录列表业务:校验失败:{}", result.getMsg()); | |||
return result; | |||
} | |||
List<WarningRecord> warningRecordList = warningRecordMapper.getList(request); | |||
if (CollectionUtil.isEmpty(warningRecordList)) { | |||
log.info("预警记录列表数据为空"); | |||
} | |||
return JsonResult.success(warningRecordList); | |||
} | |||
/** | |||
* 检查参数 | |||
* | |||
* @param tenantId | |||
* @param request | |||
* @return | |||
*/ | |||
private JsonResult check(Integer tenantId, QueryWarningRecordListByWarningIdRequest request) { | |||
// 判断预警id是否为空 | |||
if (ObjectUtil.isNotNull(request.getWarningId())) { | |||
throw new ServiceException("预警ID为空"); | |||
} | |||
Warning warning = warningMapper.selectOne(new LambdaQueryWrapper<Warning>() | |||
.eq(Warning::getId, request.getWarningId()) | |||
.eq(Warning::getTenantId, tenantId) | |||
.eq(Warning::getMark, MarkEnum.VALID.getCode())); | |||
if (ObjectUtil.isNull(warning)) { | |||
throw new ServiceException("预警信息不存在"); | |||
} | |||
return JsonResult.success(); | |||
} | |||
} |
@@ -64,6 +64,8 @@ public class ScheduledTask { | |||
} | |||
} | |||
log.info("lcAirportTaskHandler执行结束"); | |||
} | |||
} |
@@ -38,9 +38,12 @@ spring: | |||
type: com.alibaba.druid.pool.DruidDataSource | |||
driver-class-name: com.mysql.cj.jdbc.Driver | |||
# 填写你数据库的url、登录名、密码和数据库名 | |||
url: jdbc:mysql://localhost:3306/tuoheng_lc?useUnicode=true&characterEncoding=UTF-8&serverTimezone=GMT%2b8&useSSL=true&tinyInt1isBit=false | |||
url: jdbc:mysql://192.168.11.13:3306/tuoheng_lc?useUnicode=true&characterEncoding=UTF-8&serverTimezone=GMT%2b8&useSSL=true&tinyInt1isBit=false | |||
username: root | |||
password: qweasd | |||
password: idontcare | |||
# url: jdbc:mysql://localhost:3306/tuoheng_lc?useUnicode=true&characterEncoding=UTF-8&serverTimezone=GMT%2b8&useSSL=true&tinyInt1isBit=false | |||
# username: root | |||
# password: qweasd | |||
druid: | |||
# 连接池的配置信息 | |||
# 初始连接数 | |||
@@ -195,17 +198,17 @@ generate: | |||
autoRemovePre: true | |||
# 表前缀(生成类名不会包含表前缀,多个用逗号分隔) | |||
tablePrefix: sys_ | |||
xxl: | |||
enable: true | |||
job: | |||
admin: | |||
addresses: http://192.168.11.11:8110/xxl-job-admin | |||
accessToken: tuoheng | |||
executor: | |||
appname: xxl-job-executor-lc | |||
address: | |||
ip: | |||
# 多个后台,端口号不能相同 | |||
port: 9998 | |||
logpath: /data/java/logs/xxl-job/jobhandler | |||
logretentiondays: 15 | |||
#xxl: | |||
# enable: true | |||
# job: | |||
# admin: | |||
# addresses: http://192.168.11.11:8110/xxl-job-admin | |||
# accessToken: tuoheng | |||
# executor: | |||
# appname: xxl-job-executor-lc | |||
# address: | |||
# ip: | |||
# # 多个后台,端口号不能相同 | |||
# port: 9998 | |||
# logpath: /data/java/logs/xxl-job/jobhandler | |||
# logretentiondays: 15 |
@@ -0,0 +1,42 @@ | |||
<?xml version="1.0" encoding="UTF-8" ?> | |||
<!DOCTYPE mapper | |||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | |||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |||
<mapper namespace="com.tuoheng.admin.mapper.CameraMapper"> | |||
<resultMap type="com.tuoheng.admin.entity.domain.Camera" id="CameraResult"> | |||
<result property="id" column="id" /> | |||
<result property="tenantId" column="tenant_id" /> | |||
<result property="cameraName" column="camera_name" /> | |||
<result property="cameraType" column="camera_type" /> | |||
<result property="longitude" column="longitude" /> | |||
<result property="latitude" column="latitude" /> | |||
<result property="location" column="location" /> | |||
<result property="flvUrl" column="flv_url" /> | |||
<result property="remark" column="remark" /> | |||
<result property="createUser" column="create_user" /> | |||
<result property="createTime" column="create_time" /> | |||
<result property="updateUser" column="update_user" /> | |||
<result property="updateTime" column="update_time" /> | |||
<result property="mark" column="mark" /> | |||
</resultMap> | |||
<sql id="selectCameraVo"> | |||
select id, tenant_id, camera_name, camera_type, longitude, latitude, location, flv_url, remark, create_user, create_time, update_user, update_time, mark from th_camera | |||
</sql> | |||
<select id="selectList" parameterType="com.tuoheng.admin.entity.request.camera.QueryCameraListRequest" resultMap="CameraResult"> | |||
<include refid="selectCameraVo"/> | |||
<where> | |||
<if test="1 == 1"> and mark = 1 </if> | |||
<if test="tenantId != null "> and tenant_id = #{tenantId}</if> | |||
</where> | |||
order by create_time desc | |||
</select> | |||
<select id="selectOneById" parameterType="Integer" resultMap="CameraResult"> | |||
<include refid="selectCameraVo"/> | |||
where mark = 1 and id = #{id} | |||
</select> | |||
</mapper> |
@@ -0,0 +1,41 @@ | |||
<?xml version="1.0" encoding="UTF-8" ?> | |||
<!DOCTYPE mapper | |||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | |||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |||
<mapper namespace="com.tuoheng.admin.mapper.GoodsMapper"> | |||
<resultMap type="com.tuoheng.admin.entity.domain.Goods" id="GoodsResult"> | |||
<result property="id" column="id" /> | |||
<result property="tenantId" column="tenant_id" /> | |||
<result property="warehouseId" column="warehouse_id" /> | |||
<result property="goodsName" column="goods_name" /> | |||
<result property="goodsType" column="goods_type" /> | |||
<result property="goodsStock" column="goods_stock" /> | |||
<result property="goodsAction" column="goods_action" /> | |||
<result property="createUser" column="create_user" /> | |||
<result property="createTime" column="create_time" /> | |||
<result property="updateUser" column="update_user" /> | |||
<result property="updateTime" column="update_time" /> | |||
<result property="mark" column="mark" /> | |||
</resultMap> | |||
<sql id="selectGoodsVo"> | |||
select id, tenant_id, warehouse_id, goods_name, goods_type, goods_stock, goods_action, create_user, create_time, update_user, update_time, mark from th_goods | |||
</sql> | |||
<select id="getListByWarehouseId" parameterType="com.tuoheng.admin.entity.request.goods.QueryGoodsListByWarehouseIdRequest" resultMap="GoodsResult"> | |||
<include refid="selectGoodsVo"/> | |||
<where> | |||
<if test="1 == 1"> and mark = 1 </if> | |||
<if test="tenantId != null "> and tenant_id = #{tenantId}</if> | |||
<if test="warehouseId != null "> and warehouse_id = #{warehouseId}</if> | |||
</where> | |||
order by create_time desc | |||
</select> | |||
<select id="getOneById" parameterType="Integer" resultMap="GoodsResult"> | |||
<include refid="selectGoodsVo"/> | |||
where mark = 1 and id = #{id} | |||
</select> | |||
</mapper> |
@@ -1,4 +1,38 @@ | |||
<?xml version="1.0" encoding="UTF-8"?> | |||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |||
<mapper namespace="com.tuoheng.admin.mapper.ThInspectionMapper"> | |||
<resultMap id="BaseResultMap" type="com.tuoheng.admin.entity.domain.ThInspection"> | |||
<id column="id" jdbcType="INTEGER" property="id" /> | |||
<result column="tenant_id" jdbcType="VARCHAR" property="tenantId" /> | |||
<result column="inspection_id" jdbcType="INTEGER" property="inspectionId" /> | |||
<result column="mission_id" jdbcType="INTEGER" property="missionId" /> | |||
<result column="lng" jdbcType="VARCHAR" property="lng" /> | |||
<result column="lat" jdbcType="VARCHAR" property="lat" /> | |||
<result column="host_ip" jdbcType="VARCHAR" property="hostIp" /> | |||
<result column="altitude" jdbcType="VARCHAR" property="altitude" /> | |||
<result column="speed" jdbcType="VARCHAR" property="speed" /> | |||
<result column="fly_time" jdbcType="INTEGER" property="flyTime" /> | |||
<result column="dist_home" jdbcType="VARCHAR" property="distHome" /> | |||
<result column="ysingal" jdbcType="VARCHAR" property="ysingal" /> | |||
<result column="create_user" jdbcType="INTEGER" property="createUser" /> | |||
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" /> | |||
<result column="update_user" jdbcType="INTEGER" property="updateUser" /> | |||
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" /> | |||
<result column="mark" jdbcType="INTEGER" property="mark" /> | |||
</resultMap> | |||
<sql id="Base_Column_List"> | |||
id, tenant_id, inspection_id, mission_id, lng, lat, host_ip, altitude, speed, fly_time, dist_home, ysingal | |||
create_user, create_time, update_user, update_time, mark | |||
</sql> | |||
<select id="selectListByMissionId" resultType="com.tuoheng.admin.entity.domain.ThInspection"> | |||
select | |||
<include refid="Base_Column_List"/> | |||
from th_inspection | |||
where mission_id = #{id} | |||
and mark = 1 | |||
order by create_time asc | |||
</select> | |||
</mapper> |
@@ -0,0 +1,42 @@ | |||
<?xml version="1.0" encoding="UTF-8" ?> | |||
<!DOCTYPE mapper | |||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | |||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |||
<mapper namespace="com.tuoheng.admin.mapper.WarehouseMapper"> | |||
<resultMap type="com.tuoheng.admin.entity.domain.Warehouse" id="WarehouseResult"> | |||
<result property="id" column="id" /> | |||
<result property="tenantId" column="tenant_id" /> | |||
<result property="warehouseName" column="warehouse_name" /> | |||
<result property="longitude" column="longitude" /> | |||
<result property="latitude" column="latitude" /> | |||
<result property="location" column="location" /> | |||
<result property="createUser" column="create_user" /> | |||
<result property="createTime" column="create_time" /> | |||
<result property="updateUser" column="update_user" /> | |||
<result property="updateTime" column="update_time" /> | |||
<result property="mark" column="mark" /> | |||
</resultMap> | |||
<sql id="selectWarehouseVo"> | |||
select id, tenant_id, warehouse_name, longitude, latitude, location, create_user, create_time, update_user, update_time, mark from th_warehouse | |||
</sql> | |||
<select id="selectPageList" parameterType="com.tuoheng.admin.entity.request.warehouse.QueryWarehousePageListRequest" resultMap="WarehouseResult"> | |||
<include refid="selectWarehouseVo"/> | |||
<where> | |||
<if test="1 == 1"> and mark = 1 </if> | |||
<if test="request.tenantId != null and request.tenantId != 0"> and tenant_id = #{request.tenantId}</if> | |||
<if test="request.warehouseName != null and request.warehouseName != ''"> | |||
and warehouse_name like concat('%',#{request.warehouseName},'%') | |||
</if> | |||
</where> | |||
order by create_time desc | |||
</select> | |||
<select id="getOneById" parameterType="Integer" resultMap="WarehouseResult"> | |||
<include refid="selectWarehouseVo"/> | |||
where mark = 1 and id = #{id} | |||
</select> | |||
</mapper> |
@@ -0,0 +1,67 @@ | |||
<?xml version="1.0" encoding="UTF-8" ?> | |||
<!DOCTYPE mapper | |||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | |||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |||
<mapper namespace="com.tuoheng.admin.mapper.WarningMapper"> | |||
<resultMap type="com.tuoheng.admin.entity.domain.Warning" id="WarningResult"> | |||
<result property="id" column="id" /> | |||
<result property="tenantId" column="tenant_id" /> | |||
<result property="discoveryWay" column="discovery_way" /> | |||
<result property="location" column="location" /> | |||
<result property="status" column="status" /> | |||
<result property="questionId" column="question_id" /> | |||
<result property="createUser" column="create_user" /> | |||
<result property="createTime" column="create_time" /> | |||
<result property="updateUser" column="update_user" /> | |||
<result property="updateTime" column="update_time" /> | |||
<result property="checkUser" column="check_user" /> | |||
<result property="checkTime" column="check_time" /> | |||
<result property="checkResult" column="check_result" /> | |||
<result property="mark" column="mark" /> | |||
</resultMap> | |||
<sql id="selectWarningVo"> | |||
select id, tenant_id, discovery_way, location, status, question_id, create_user, create_time, update_user, update_time, check_user, check_time, check_result, mark from th_warning | |||
</sql> | |||
<select id="getList" parameterType="com.tuoheng.admin.entity.request.warning.QueryWarningListRequest" resultMap="WarningResult"> | |||
<include refid="selectWarningVo"/> | |||
<where> | |||
<if test="1 == 1"> and mark = 1 </if> | |||
<if test="tenantId != null "> and tenant_id = #{tenantId} </if> | |||
<if test="status != null and status != 0 "> and status = #{status}</if> | |||
</where> | |||
order by create_time desc | |||
</select> | |||
<select id="getOneById" parameterType="Integer" resultMap="WarningResult"> | |||
<include refid="selectWarningVo"/> | |||
where mark = 1 and id = #{id} | |||
</select> | |||
<update id="confirm" parameterType="hashmap"> | |||
update th_inspection_file | |||
<trim prefix="SET" suffixOverrides=","> | |||
<if test="status != null"> status = #{status}, </if> | |||
<if test="updateUser != null and updateUser != ''"> update_user = #{updateUser}, </if> | |||
<if test="updateTime != null"> update_time = #{updateTime}, </if> | |||
<if test="checkUser != null and checkUser != ''"> check_user = #{checkUser}, </if> | |||
<if test="checkTime != null"> check_time = #{checkTime}, </if> | |||
<if test="checkResult != null and checkResult != ''"> check_result = #{checkResult}, </if> | |||
</trim> | |||
where id = #{id} | |||
</update> | |||
<update id="ignore" parameterType="hashmap"> | |||
update th_inspection_file | |||
<trim prefix="SET" suffixOverrides=","> | |||
<if test="status != null"> status = #{status}, </if> | |||
<if test="updateUser != null and updateUser != ''"> update_user = #{updateUser}, </if> | |||
<if test="updateTime != null"> update_time = #{updateTime}, </if> | |||
<if test="checkUser != null and checkUser != ''"> check_user = #{checkUser}, </if> | |||
<if test="checkTime != null"> check_time = #{checkTime}, </if> | |||
</trim> | |||
where id = #{id} | |||
</update> | |||
</mapper> |