@@ -7,4 +7,23 @@ use tuoheng_freeway; | |||
-- 事件表 | |||
alter table tuoheng_freeway.th_accident add name varchar(20) default '' not null comment '事件名称' after dept_id; | |||
alter table tuoheng_freeway.th_accident add report_type tinyint(1) default 1 not null comment '上报类型:1:自动上报(默认);2:手动上报' after dept_id; | |||
alter table tuoheng_freeway.th_accident add image varchar(255) default '' not null comment '图片' after question_name; | |||
alter table tuoheng_freeway.th_accident add image varchar(255) default '' not null comment '图片' after question_name; | |||
-- 应急事件与应急任务关联表 | |||
create table th_accident_inspection | |||
( | |||
id varchar(36) not null comment 'ID' | |||
primary key, | |||
tenant_id varchar(36) default '' not null comment '租户ID', | |||
accident_id varchar(36) default '' not null comment '事故ID', | |||
inspection_id varchar(36) default '' not null comment '巡检任务ID', | |||
name varchar(255) default '' null comment '记录名称', | |||
drone_forward_type tinyint(1) default 1 not null comment '无人机前往类型:1:原无人机直接前往;2:新无人机前往;3:手动添加的应急事故,无人机前往;', | |||
remark varchar(255) null comment '备注', | |||
create_user varchar(36) default '' null comment '添加人', | |||
create_time timestamp default CURRENT_TIMESTAMP null comment '创建时间', | |||
update_user varchar(36) default '' null comment '更新人', | |||
update_time timestamp default CURRENT_TIMESTAMP null on update CURRENT_TIMESTAMP comment '更新时间', | |||
mark tinyint unsigned default '1' not null comment '有效标识' | |||
) | |||
comment '应急事件与应急任务关联表'; |
@@ -40,6 +40,15 @@ public class AccidentController { | |||
return accidentService.getHistoryPageList(request); | |||
} | |||
/** | |||
* 事件机场调度列表 | |||
*/ | |||
@GetMapping("/airport/dispatch/{id}") | |||
public JsonResult getAirportDispatchList(@PathVariable("id") String id) { | |||
// log.info("进入查询事件事件调度列表接口"); | |||
return accidentService.getAirportDispatchList(id); | |||
} | |||
/** | |||
* 忽略 | |||
* |
@@ -0,0 +1,51 @@ | |||
package com.tuoheng.admin.entity; | |||
import com.baomidou.mybatisplus.annotation.TableName; | |||
import com.tuoheng.common.core.common.BaseEntity; | |||
import lombok.Data; | |||
import lombok.EqualsAndHashCode; | |||
import lombok.experimental.Accessors; | |||
/** | |||
* @Author ChengWang | |||
* @Date 2023/3/2 | |||
*/ | |||
@Data | |||
@EqualsAndHashCode(callSuper = true) | |||
@Accessors(chain = true) | |||
@TableName("th_accident_inspection") | |||
public class AccidentInspection extends BaseEntity { | |||
private static final long serialVersionUID = 1L; | |||
/** | |||
* 租户id | |||
*/ | |||
private String tenantId; | |||
/** | |||
* 事故ID | |||
*/ | |||
private String accidentId; | |||
/** | |||
* 巡检任务ID | |||
*/ | |||
private String inspectionId; | |||
/** | |||
* 无人机前往类型:1:原无人机直接前往;2:新无人机前往;3:手动添加的应急事故,无人机前往; | |||
*/ | |||
private Integer droneForwardType; | |||
/** | |||
* 记录名称 | |||
*/ | |||
private String name; | |||
/** | |||
* 备注 | |||
*/ | |||
private String remark; | |||
} |
@@ -0,0 +1,13 @@ | |||
package com.tuoheng.admin.mapper; | |||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |||
import com.tuoheng.admin.entity.AccidentInspection; | |||
/** | |||
* @Author ChengWang | |||
* @Date 2023/3/2 | |||
*/ | |||
public interface AccidentInspectionMapper extends BaseMapper<AccidentInspection> { | |||
} |
@@ -37,6 +37,9 @@ public class AccidentServiceImpl extends BaseServiceImpl<AccidentMapper, Acciden | |||
@Autowired | |||
private QueryAccidentHistoryListService queryAccidentHistoryListService; | |||
@Autowired | |||
private QueryAccidentAirportDispatchListService queryAccidentAirportDispatchListService; | |||
@Autowired | |||
private QueryAccidentCardListService queryAccidentCardListService; | |||
@@ -86,6 +89,17 @@ public class AccidentServiceImpl extends BaseServiceImpl<AccidentMapper, Acciden | |||
return queryAccidentHistoryListService.getPageList(request); | |||
} | |||
/** | |||
* 查询机场调度列表 | |||
* | |||
* @param id 事件Id | |||
* @return 事件集合 | |||
*/ | |||
@Override | |||
public JsonResult getAirportDispatchList(String id) { | |||
return queryAccidentAirportDispatchListService.getList(id); | |||
} | |||
@Override | |||
public JsonResult getAccidentCardList(QueryAccidentCardListRequest request) { | |||
return queryAccidentCardListService.getList(request); |
@@ -30,6 +30,14 @@ public interface IAccidentService extends IBaseService<Accident> { | |||
*/ | |||
JsonResult getHistoryPageList(QueryHistoryPageListRequest request); | |||
/** | |||
* 查询机场调度列表 | |||
* | |||
* @param id 事件Id | |||
* @return 事件集合 | |||
*/ | |||
JsonResult getAirportDispatchList(String id); | |||
/** | |||
* 查询事故列表 | |||
* |
@@ -0,0 +1,111 @@ | |||
package com.tuoheng.admin.service.accident.query; | |||
import cn.hutool.core.collection.CollectionUtil; | |||
import cn.hutool.core.util.ObjectUtil; | |||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||
import com.tuoheng.admin.entity.AccidentInspection; | |||
import com.tuoheng.admin.entity.Inspection; | |||
import com.tuoheng.admin.entity.User; | |||
import com.tuoheng.admin.enums.MarkEnum; | |||
import com.tuoheng.admin.mapper.AccidentInspectionMapper; | |||
import com.tuoheng.admin.mapper.AccidentMapper; | |||
import com.tuoheng.admin.mapper.InspectionMapper; | |||
import com.tuoheng.admin.utils.CurrentUserUtil; | |||
import com.tuoheng.admin.vo.accident.AccidentInspectionVo; | |||
import com.tuoheng.common.core.exception.ServiceException; | |||
import com.tuoheng.common.core.utils.JsonResult; | |||
import com.tuoheng.common.core.utils.StringUtils; | |||
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 wanjing | |||
* @team tuoheng | |||
* @date 2023-03-03 | |||
*/ | |||
@Slf4j | |||
@Service | |||
public class QueryAccidentAirportDispatchListService { | |||
@Autowired | |||
private AccidentInspectionMapper accidentInspectionMapper; | |||
@Autowired | |||
private AccidentMapper accidentMapper; | |||
@Autowired | |||
private InspectionMapper inspectionMapper; | |||
public JsonResult getList(String id) { | |||
// log.info("进入查询事件机场调度列表业务"); | |||
User user = CurrentUserUtil.getUserInfo(); | |||
String tenantId = user.getTenantId(); | |||
JsonResult result = this.check(tenantId, id); | |||
if (0 != result.getCode()) { | |||
log.info("进入查询事件机场调度列表业务:校验失败:{}", result.getMsg()); | |||
return result; | |||
} | |||
List<AccidentInspection> accidentInspectionList = accidentInspectionMapper.selectList(new LambdaQueryWrapper<AccidentInspection>() | |||
.eq(AccidentInspection::getAccidentId, id) | |||
.eq(AccidentInspection::getMark, MarkEnum.VALID.getCode())); | |||
if (ObjectUtil.isEmpty(accidentInspectionList)) { | |||
log.info("该应急事件没有对应的应急任务,accidentId={}", id); | |||
return JsonResult.success(); | |||
} | |||
// 构造返回结果对象 | |||
List<AccidentInspectionVo> accidentInspectionVoList = this.buildAccidentInspectionVoList(accidentInspectionList); | |||
return JsonResult.success(accidentInspectionVoList); | |||
} | |||
/** | |||
* 检查参数 | |||
* | |||
* @param tenantId | |||
* @param id | |||
* @return | |||
*/ | |||
private JsonResult check(String tenantId, String id) { | |||
if (StringUtils.isEmpty(id)) { | |||
throw new ServiceException("应急事件ID为空"); | |||
} | |||
return JsonResult.success(); | |||
} | |||
/** | |||
* @param accidentInspectionList | |||
* @return | |||
*/ | |||
private List<AccidentInspectionVo> buildAccidentInspectionVoList(List<AccidentInspection> accidentInspectionList) { | |||
if (CollectionUtil.isEmpty(accidentInspectionList)) { | |||
return null; | |||
} | |||
List<String> inspectionIdList = accidentInspectionList.stream().map(o -> o.getInspectionId()).collect(Collectors.toList()); | |||
List<Inspection> inspectionList = inspectionMapper.selectList(Wrappers.<Inspection>lambdaQuery() | |||
.eq(Inspection::getMark, MarkEnum.VALID.getCode()) | |||
.in(Inspection::getId, inspectionIdList)); | |||
List<AccidentInspectionVo> accidentInspectionVoList = new ArrayList<>(); | |||
AccidentInspectionVo accidentInspectionVo; | |||
for (Inspection inspection : inspectionList) { | |||
accidentInspectionVo = new AccidentInspectionVo(); | |||
accidentInspectionVo.setInspectionId(inspection.getId()); | |||
accidentInspectionVo.setInspectionCode(inspection.getCode()); | |||
accidentInspectionVo.setInspectionName(inspection.getName()); | |||
accidentInspectionVo.setStatus(inspection.getStatus()); | |||
accidentInspectionVoList.add(accidentInspectionVo); | |||
} | |||
return accidentInspectionVoList; | |||
} | |||
} |
@@ -19,7 +19,7 @@ public class DroneReturnHomeService { | |||
* @return | |||
*/ | |||
public JsonResult returnHome(Integer airportId) { | |||
log.info("南京海事局, 一键返航, airportId={}", airportId); | |||
log.info("一键返航, airportId={}", airportId); | |||
JSONObject jsonObject = this.getJSONObject(airportId); | |||
JsonResult result = airportDroneControlService.exec(jsonObject); | |||
return result; |
@@ -0,0 +1,44 @@ | |||
package com.tuoheng.admin.vo.accident; | |||
import com.fasterxml.jackson.annotation.JsonFormat; | |||
import lombok.Data; | |||
import org.springframework.format.annotation.DateTimeFormat; | |||
import java.util.Date; | |||
import java.util.List; | |||
/** | |||
* @Author xiaoying | |||
* @Date 2023/4/13 17:10 | |||
*/ | |||
@Data | |||
public class AccidentInspectionVo { | |||
/** | |||
* 任务ID | |||
*/ | |||
private String inspectionId; | |||
/** | |||
* 任务ID | |||
*/ | |||
private String inspectionCode; | |||
/** | |||
* 任务名称 | |||
*/ | |||
private String inspectionName; | |||
/** | |||
* 任务状态 | |||
*/ | |||
private Integer status; | |||
/** | |||
* 时间 | |||
*/ | |||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") | |||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") | |||
private Date createTime; | |||
} |
@@ -0,0 +1,6 @@ | |||
<?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.AccidentInspectionMapper"> | |||
</mapper> |