Переглянути джерело

去掉accident_task字段

tags/v1.2.0^2
wanjing 1 рік тому
джерело
коміт
d4998ed2a4
6 змінених файлів з 35 додано та 50 видалено
  1. +0
    -5
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/entity/Inspection.java
  2. +30
    -34
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/third/airport/PointFlightService.java
  3. +1
    -1
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/third/dsp/DspCallbackServiceImpl.java
  4. +3
    -3
      tuoheng-service/tuoheng-admin/src/main/resources/mapper/InspectionMapper.xml
  5. +1
    -6
      tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/entity/Inspection.java
  6. +0
    -1
      tuoheng-service/tuoheng-miniprogram/src/main/resources/mapper/InspectionMapper.xml

+ 0
- 5
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/entity/Inspection.java Переглянути файл

@@ -281,11 +281,6 @@ public class Inspection extends BaseEntity {
*/
private String patrolLocation;

/**
* 任务类型:0巡检任务 1应急任务
*/
private Integer accidentTask;

/**
* 应急任务关联数据任务ID
*/

+ 30
- 34
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/third/airport/PointFlightService.java Переглянути файл

@@ -18,7 +18,6 @@ import com.tuoheng.common.core.utils.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

/**
@@ -35,38 +34,36 @@ public class PointFlightService {
@Autowired
private TenantMapper tenantMapper;



@Transactional
public JsonResult pointFlight(AccidentFlightRequest request) {
log.info("执行应急飞行起飞,request={}",request);
log.info("执行应急飞行起飞,request={}", request);
//先创建应急任务--->执行定点飞行任务
//校验
if(StringUtils.isEmpty(request.getLongitude())){
log.info("经度,lon={}",request.getLongitude());
return JsonResult.error(AccidentEnum.LONGITUDE_IS_NULL.getCode(),AccidentEnum.LONGITUDE_IS_NULL.getMsg());
if (StringUtils.isEmpty(request.getLongitude())) {
log.info("经度,lon={}", request.getLongitude());
return JsonResult.error(AccidentEnum.LONGITUDE_IS_NULL.getCode(), AccidentEnum.LONGITUDE_IS_NULL.getMsg());
}
if(StringUtils.isEmpty(request.getLatitude())){
log.info("经度,lat={}",request.getLatitude());
return JsonResult.error(AccidentEnum.LATITUDE_IS_NULL.getCode(),AccidentEnum.LATITUDE_IS_NULL.getMsg());
if (StringUtils.isEmpty(request.getLatitude())) {
log.info("经度,lat={}", request.getLatitude());
return JsonResult.error(AccidentEnum.LATITUDE_IS_NULL.getCode(), AccidentEnum.LATITUDE_IS_NULL.getMsg());
}
if(null == request.getAirportId()){
log.info("机场id,id={}",request.getAirportId());
return JsonResult.error(AccidentEnum.AIRPORT_ID_IS_NULL.getCode(),AccidentEnum.AIRPORT_ID_IS_NULL.getMsg());
if (null == request.getAirportId()) {
log.info("机场id,id={}", request.getAirportId());
return JsonResult.error(AccidentEnum.AIRPORT_ID_IS_NULL.getCode(), AccidentEnum.AIRPORT_ID_IS_NULL.getMsg());
}
if(StringUtils.isEmpty(request.getAirportName())){
log.info("机场名称,airportName={}",request.getAirportName());
return JsonResult.error(AccidentEnum.AIRPORT_NAME_IS_NULL.getCode(),AccidentEnum.AIRPORT_NAME_IS_NULL.getMsg());
if (StringUtils.isEmpty(request.getAirportName())) {
log.info("机场名称,airportName={}", request.getAirportName());
return JsonResult.error(AccidentEnum.AIRPORT_NAME_IS_NULL.getCode(), AccidentEnum.AIRPORT_NAME_IS_NULL.getMsg());
}
//获取当前用户及租户信息
User user = CurrentUserUtil.getUserInfo();
String tenantId = CurrentUserUtil.getTenantId();
//获取租户信息
Tenant tenant = this.getTenant(tenantId);
log.info("当前登录用户租户id,tenantId={}",tenant);
log.info("当前登录用户租户id,tenantId={}", tenant);
//创建应急任务
Inspection inspection = this.createInspection(user, request);
log.info("生成的应急任务,inspection={}",inspection);
log.info("生成的应急任务,inspection={}", inspection);

//调用机场平台进行飞行
//因任务为原来新的应急任务不用关心其他正在巡检飞行的任务
@@ -80,28 +77,29 @@ public class PointFlightService {

/**
* 调用机场平台
*
* @param tenant
* @param request
* @param inspectionId
*/
private void callNewAirport(Tenant tenant,AccidentFlightRequest request,String inspectionId){
private void callNewAirport(Tenant tenant, AccidentFlightRequest request, String inspectionId) {
String url = CommonConfig.airportURL + SystemConstant.API_AIRPORT_POINT_FLIGH;
//高度设置为60
request.setAlt("100");
JSONObject jsonObject = new JSONObject();
jsonObject.put("airportId",request.getAirportId());
jsonObject.put("requestId",inspectionId);
jsonObject.put("code",SystemConstant.PLATFORM_CODE);
jsonObject.put("tenantCode",tenant.getCode());
jsonObject.put("alt",request.getAlt());
jsonObject.put("airportId", request.getAirportId());
jsonObject.put("requestId", inspectionId);
jsonObject.put("code", SystemConstant.PLATFORM_CODE);
jsonObject.put("tenantCode", tenant.getCode());
jsonObject.put("alt", request.getAlt());
jsonObject.put("lon", request.getLongitude());
jsonObject.put("lat", request.getLatitude());

log.info("调用机场,新无人机执行定点飞行:url:{}",url);
log.info("调用机场,新无人机执行定点飞行:jsonObject:{}",jsonObject);
log.info("调用机场,新无人机执行定点飞行:url:{}", url);
log.info("调用机场,新无人机执行定点飞行:jsonObject:{}", jsonObject);

String airPortStr = HttpUtils.doSend(url, jsonObject, null, "POST");
if(StringUtils.isEmpty(airPortStr)){
if (StringUtils.isEmpty(airPortStr)) {
log.info("新无人机执行定点飞行:机场接口返回数据为空,飞行失败,jsonObject:{}", jsonObject);
throw new ServiceException("机场接口返回数据为空,飞行失败");
}
@@ -110,24 +108,23 @@ public class PointFlightService {
log.info("调用机场平台,无人机执行定点飞行:飞行失败,jsonResult:{}", jsonResult.getMsg());
throw new com.tuoheng.common.core.exception.ServiceException("机场平台返回,飞行失败");
}


}

/**
* 创建应急任务
*
* @param user
* @param request
* @return
*/
private Inspection createInspection(User user,AccidentFlightRequest request){
private Inspection createInspection(User user, AccidentFlightRequest request) {
Inspection inspection = new Inspection();
inspection.setTenantId(user.getTenantId());
String code = DateUtils.generateCode("XJRW");
inspection.setCode(code);
inspection.setDeptId(user.getDeptId());
inspection.setName("应急任务"+code);
inspection.setType(1);
inspection.setName("应急任务" + code);
inspection.setType(2);
inspection.setStatus(TaskStatusEnum.INFLIGHT.getCode());// 设置应急任务状态为飞行中
inspection.setRoadId("");
inspection.setSectionId("");
@@ -139,11 +136,10 @@ public class PointFlightService {
inspection.setExecutionStartTime(DateUtils.now());
inspection.setCreateUser(user.getId());
inspection.setCreateTime(DateUtils.now());
inspection.setAccidentTask(1);
inspection.setIsLive(1);
inspection.setDroneId(request.getDroneId());
int result = inspectionMapper.insert(inspection);
if(result<=0){
if (result <= 0) {
log.info("创建应急任务失败");
throw new ServiceException("创建应急任务失败");
}

+ 1
- 1
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/third/dsp/DspCallbackServiceImpl.java Переглянути файл

@@ -316,7 +316,7 @@ public class DspCallbackServiceImpl implements IDspCallbackService {
accident.setSectionName(inspection.getSectionName());

//根据巡检任务类型判断当前应急事故类型flag设值
if (AccidentTaskEnum.INSPECTION_ACCIDENT_TASK.getCode() == inspection.getAccidentTask()) {
if (2 == inspection.getType()) {
accident.setFlag(FlagEnum.ACCIDENT.getCode());
} else {
// 该巡检任务存在应急任务,将后面发现的预警直接设置为不展示

+ 3
- 3
tuoheng-service/tuoheng-admin/src/main/resources/mapper/InspectionMapper.xml Переглянути файл

@@ -70,7 +70,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
execution_start_time, execution_end_time, is_live, is_taken, is_tilt, video_url, ai_video_url, report_url, srt_url,
status, analyse_status, progressbar, note, weather, fly_height, srt_name, heartbeat_time, execution_status,
start_longitude, start_latitude, end_longitude, end_latitude, mobile, patrol_location,
create_user, create_time, update_user, update_time, accident_task, mark
create_user, create_time, update_user, update_time, mark
</sql>

<sql id="selectInspectionVo">
@@ -80,7 +80,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
execution_start_time, execution_end_time, is_live, is_taken, is_tilt, video_url, ai_video_url, report_url, srt_url,
status, analyse_status, progressbar, note, weather, fly_height, srt_name, heartbeat_time, execution_status,
start_longitude, start_latitude, end_longitude, end_latitude, mobile, patrol_location,
create_user, create_time, update_user, update_time, accident_task, mark
create_user, create_time, update_user, update_time, mark
from th_inspection
</sql>

@@ -94,7 +94,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectPageList" parameterType="com.tuoheng.admin.request.inspection.QueryInspectionPageListRequest" resultMap="InspectionResult">
<include refid="selectInspectionVo"/>
<where>
<if test="1 == 1"> and mark = 1 and accident_task = 0 </if>
<if test="1 == 1"> and mark = 1 </if>
<if test="request.code != null and request.code != ''"> and code like concat('%', #{request.code}, '%') </if>
<if test="request.tenantId != null and request.tenantId != ''"> and tenant_id = #{request.tenantId} </if>
<if test="request.airportId != null and request.airportId != 0"> and airport_id = #{request.airportId} </if>

+ 1
- 6
tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/entity/Inspection.java Переглянути файл

@@ -45,7 +45,7 @@ public class Inspection extends BaseEntity {
private String name;

/**
* 巡检任务类型 1临时巡检
* 巡检任务类型: 2:临时巡检 2:应急任务
*/
private Integer type;

@@ -275,11 +275,6 @@ public class Inspection extends BaseEntity {
*/
private String patrolLocation;

/**
* 任务类型:0:巡检任务 1应急任务
*/
private Integer accidentTask;

/**
* 应急任务数据关联任务id
*/

+ 0
- 1
tuoheng-service/tuoheng-miniprogram/src/main/resources/mapper/InspectionMapper.xml Переглянути файл

@@ -53,7 +53,6 @@
<result property="endLatitude" column="end_latitude" />
<result property="mobile" column="mobile" />
<result property="patrolLocation" column="patrol_location" />
<result property="accidentTask" column="accident_task" />
<result property="emergencyDataInspectionId" column="emergency_data_inspection_id" />
<result property="createUser" column="create_user" />
<result property="createTime" column="create_time" />

Завантаження…
Відмінити
Зберегти