浏览代码

Merge remote-tracking branch 'origin/develop' into develop

tags/v1.2.0^2
xiaoying 1年前
父节点
当前提交
7fa22ddc92
共有 8 个文件被更改,包括 148 次插入67 次删除
  1. +10
    -1
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/entity/QuestionType.java
  2. +1
    -1
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/request/third/QuestionFile.java
  3. +19
    -5
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspection/query/QueryVideoService.java
  4. +34
    -1
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspection/update/status/UpdateInspectionStatusService.java
  5. +72
    -57
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/third/dsp/DspCallbackServiceImpl.java
  6. +1
    -1
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/vo/accident/AccidentDetailsVo.java
  7. +1
    -1
      tuoheng-service/tuoheng-admin/src/main/resources/application-test.yml
  8. +10
    -0
      tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/entity/QuestionType.java

+ 10
- 1
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/entity/QuestionType.java 查看文件

@@ -15,10 +15,11 @@ import lombok.experimental.Accessors;
@Accessors(chain = true)
@TableName("th_question_type")
public class QuestionType extends BaseEntity {

private static final long serialVersionUID = 1L;

/**
*编号
* 编号
*/
private String code;

@@ -37,5 +38,13 @@ public class QuestionType extends BaseEntity {
*/
private Integer sort;

/**
* 事故问题:0:否;1:是
*/
private Integer accidentQuestion;

/**
* 是否展示问题 0:否;1是
*/
private Integer isShow;
}

+ 1
- 1
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/request/third/QuestionFile.java 查看文件

@@ -24,7 +24,7 @@ public class QuestionFile {
* 文件编号
*/
@NotBlank
@Pattern(regexp = "^[A-Z0-9]{0,20}$")
@Pattern(regexp = "^[A-Z0-9]{0,32}$")
private String fileCode;

/**

+ 19
- 5
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspection/query/QueryVideoService.java 查看文件

@@ -2,6 +2,7 @@ package com.tuoheng.admin.service.inspection.query;

import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.tuoheng.admin.entity.Inspection;
@@ -20,6 +21,9 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Collections;
import java.util.List;

/**
* 根据任务id查询视频直播和回放
*
@@ -78,16 +82,26 @@ public class QueryVideoService {
return JsonResult.error(QueryVideoServiceEnum.AIRPORT_ID_IS_NULL.getCode(), QueryVideoServiceEnum.AIRPORT_ID_IS_NULL.getMsg());
}
//根据机场id查询对应正在巡检的任务
Inspection inspection = inspectionMapper.selectInspectionByAirport(id);
if(ObjectUtils.isEmpty(inspection)){
//Inspection inspection = inspectionMapper.selectInspectionByAirport(id);
List<Inspection> inspectionList = inspectionMapper.selectList(Wrappers.<Inspection>lambdaQuery()
.eq(Inspection::getStatus, InspectionStatusEnum.IN_FLIGHT.getCode())
.eq(Inspection::getMark, MarkEnum.VALID.getCode()).eq(Inspection::getAirportId, id));
if(CollectionUtils.isEmpty(inspectionList)){
return JsonResult.error(QueryVideoServiceEnum.INSPECTION_IS_NOT_EXIST.getCode(), QueryVideoServiceEnum.INSPECTION_IS_NOT_EXIST.getMsg());

}
if(inspectionList.size()>1){
return JsonResult.error("当前机场对应的正在飞行的任务存在多个,请检查!");
}
// if(ObjectUtils.isEmpty(inspection)){
// return JsonResult.error(QueryVideoServiceEnum.INSPECTION_IS_NOT_EXIST.getCode(), QueryVideoServiceEnum.INSPECTION_IS_NOT_EXIST.getMsg());
// }
InspectionVideoVo vo = new InspectionVideoVo();
if (10 == inspection.getStatus()) {
if (10 == inspectionList.get(0).getStatus()) {
//任务状态为任务飞行中10视频直播
LiveChannel liveChannel = liveChannelMapper.selectOne(new LambdaQueryWrapper<LiveChannel>()
.eq(LiveChannel::getMark, 1)
.eq(LiveChannel::getInspectionId, inspection.getId())
.eq(LiveChannel::getInspectionId, inspectionList.get(0).getId())
.eq(LiveChannel::getStatus, 1));
if (ObjectUtil.isNull(liveChannel)) {
return JsonResult.error(QueryVideoServiceEnum.LIVE_CHANNEL_IS_NOT_EXIST.getCode(), QueryVideoServiceEnum.LIVE_CHANNEL_IS_NOT_EXIST.getMsg());
@@ -96,7 +110,7 @@ public class QueryVideoService {
return JsonResult.error(QueryVideoServiceEnum.AIPULL_URL_IS_NOT_NULL.getCode(), QueryVideoServiceEnum.AIPULL_URL_IS_NOT_NULL.getMsg());
}
vo.setAipullUrl(liveChannel.getAipullUrl());
vo.setInspectionId(inspection.getId());
vo.setInspectionId(inspectionList.get(0).getId());
}

return JsonResult.success(vo);

+ 34
- 1
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspection/update/status/UpdateInspectionStatusService.java 查看文件

@@ -4,6 +4,7 @@ import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.tuoheng.admin.entity.Inspection;
import com.tuoheng.admin.enums.AirPortTaskStatusEnum;
import com.tuoheng.admin.enums.InspectionStatusEnum;
import com.tuoheng.admin.enums.MarkEnum;
import com.tuoheng.admin.enums.code.inspection.EditInspectionStatusCodeEnum;
import com.tuoheng.admin.mapper.InspectionMapper;
@@ -47,7 +48,7 @@ public class UpdateInspectionStatusService {
}

Inspection inspection = (Inspection) result.getData();
Integer status = null;
if (AirPortTaskStatusEnum.FLIGHT.getCode() != missionStatusRequest.getStatus() && AirPortTaskStatusEnum.WAIT.getCode() != missionStatusRequest.getStatus()) {
log.info("修改任务状态业务接口:飞行状态出错!");
return JsonResult.error(EditInspectionStatusCodeEnum.TASK_NOT_STATUS.getCode(), EditInspectionStatusCodeEnum.TASK_NOT_STATUS.getMsg());
@@ -55,12 +56,16 @@ public class UpdateInspectionStatusService {

if (AirPortTaskStatusEnum.FLIGHT.getCode() == missionStatusRequest.getStatus()) {
log.info("修改任务状态业务接口:修改执行中状态");
status = InspectionStatusEnum.IN_FLIGHT.getCode();
updateFlightStatusService.updateFlightStatus(inspection, missionStatusRequest);
} else if (AirPortTaskStatusEnum.WAIT.getCode() == missionStatusRequest.getStatus()) {
log.info("修改任务状态业务接口:修改待执行状态");
status = InspectionStatusEnum.FLIGHT_COMPLETED.getCode();
updateWaittStatusService.updateWaittStatus(inspection);
}

this.updateEmergencyStatus(inspection, status);

log.info("修改任务业务接口:修改任务成功:{}");
return JsonResult.success();
}
@@ -83,4 +88,32 @@ public class UpdateInspectionStatusService {
return JsonResult.success(inspection);
}

/**
* 修改应急任务数据
*
* @param oldInspection
* @param status
*/
public void updateEmergencyStatus(Inspection oldInspection, Integer status) {
log.info("修改应急任务数据, type:{}, emergencyDataInspectionId:{}, status={}", oldInspection.getType(), oldInspection.getEmergencyDataInspectionId(), status);
Inspection emergencyInspection = inspectionMapper.selectOne(new LambdaQueryWrapper<Inspection>()
.eq(Inspection::getEmergencyDataInspectionId, oldInspection.getId())
.eq(Inspection::getMark, MarkEnum.VALID.getCode()));
if (ObjectUtil.isNull(emergencyInspection)) {
log.info("修改应急任务数据,该巡检任务没有对应的应急任务");
return;
}
// 在查询一次,保证数据是最新的
Inspection inspection = inspectionMapper.selectOne(new LambdaQueryWrapper<Inspection>()
.eq(Inspection::getId, oldInspection.getId())
.eq(Inspection::getMark, MarkEnum.VALID.getCode()));
if (ObjectUtil.isNotNull(status)) {
emergencyInspection.setStatus(status);
}
emergencyInspection.setAnalyseStatus(inspection.getAnalyseStatus());
emergencyInspection.setVideoUrl(inspection.getVideoUrl());
emergencyInspection.setAiVideoUrl(inspection.getAiVideoUrl());
inspectionMapper.updateById(inspection);
log.info("修改应急任务数据完成");
}
}

+ 72
- 57
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/third/dsp/DspCallbackServiceImpl.java 查看文件

@@ -13,13 +13,12 @@ import com.tuoheng.admin.mapper.*;
import com.tuoheng.admin.request.third.DspCallbackRequest;
import com.tuoheng.admin.request.third.QuestionFile;
import com.tuoheng.admin.service.accident.IAccidentService;
import com.tuoheng.admin.utils.CurrentUserUtil;
import com.tuoheng.admin.utils.GaodeUtil;
import com.tuoheng.common.core.config.common.CommonConfig;
import com.tuoheng.common.core.enums.ServiceExceptionEnum;
import com.tuoheng.common.core.exception.ServiceException;
import com.tuoheng.common.core.utils.*;
import lombok.extern.slf4j.Slf4j;
import org.jetbrains.annotations.NotNull;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
@@ -265,6 +264,12 @@ public class DspCallbackServiceImpl implements IDspCallbackService {
inspectionFile.setGaodeAddress(gaodeAddress_live);
}
}

Map<String, QuestionType> questionTypeMap = getStringQuestionTypeMap();
QuestionType questionType = questionTypeMap.get(inspectionFile.getQuestionCode());
if(0 == questionType.getIsShow()){
inspectionFile.setMark(MarkEnum.NOTVALID.getCode());
}
return inspectionFile;
}).collect(Collectors.toList());

@@ -276,7 +281,7 @@ public class DspCallbackServiceImpl implements IDspCallbackService {

Boolean flag = this.saveAccidentData(thirstyQuestionFiles);

log.info("预警数据入库结束,{}",flag);
log.info("预警数据入库结束,{}", flag);

}
return JsonResult.success();
@@ -284,78 +289,88 @@ public class DspCallbackServiceImpl implements IDspCallbackService {

/**
* 应急记录数据入库
*
* @param inspectionFileList
* @return
*/
private Boolean saveAccidentData(List<InspectionFile> inspectionFileList){
private Boolean saveAccidentData(List<InspectionFile> inspectionFileList) {
log.info("调用保存应急数据方法,应急数据入库开始....");

List<Accident> accidentList = new ArrayList<>();
List<QuestionType> questionTypeList = questionTypeMapper.selectList(Wrappers.<QuestionType>lambdaQuery()
.eq(QuestionType::getMark, MarkEnum.VALID.getCode()));
Map<String,QuestionType> typeMap = new HashMap<>();
for (QuestionType type : questionTypeList) {
typeMap.put(type.getCode(),type);
}
//调用问题列表接口
Map<String, QuestionType> questionTypeMap = getStringQuestionTypeMap();
for (InspectionFile inspectionFile : inspectionFileList) {
QuestionType questionType = questionTypeMap.get(inspectionFile.getQuestionCode());
if (0 == questionType.getAccidentQuestion()) {
// 非事故问题,不用添加到事故表
continue;
}
Accident accident = new Accident();
//问题类型为应急类型时添加数据
if(inspectionFile.getQuestionCode().equals(QuestionCodeEnum.RETICULAR_CRACK.getCode())){
accident.setTenantId(inspectionFile.getTenantId());

accident.setInspectionId(inspectionFile.getInspectionId());
accident.setInspectionFileId(inspectionFile.getId());
//应急任务id
accident.setAccidentInspectionId(inspectionFile.getInspectionId());
//根据巡检任务查询对应的公路id
Inspection inspection = inspectionMapper.selectById(inspectionFile.getInspectionId());
if(ObjectUtils.isNotEmpty(inspection)){
accident.setRoadId(inspection.getRoadId());
accident.setSectionId(inspection.getSectionId());
accident.setSectionName(inspection.getSectionName());

//根据巡检任务类型判断当前应急事故类型flag设值
if (2 == inspection.getType()) {
accident.setTenantId(inspectionFile.getTenantId());
accident.setInspectionId(inspectionFile.getInspectionId());
accident.setInspectionFileId(inspectionFile.getId());
//应急任务id
accident.setAccidentInspectionId(inspectionFile.getInspectionId());
//根据巡检任务查询对应的公路id
Inspection inspection = inspectionMapper.selectById(inspectionFile.getInspectionId());
if (ObjectUtils.isNotEmpty(inspection)) {
accident.setRoadId(inspection.getRoadId());
accident.setSectionId(inspection.getSectionId());
accident.setSectionName(inspection.getSectionName());

//根据巡检任务类型判断当前应急事故类型flag设值
if (2 == inspection.getType()) {
accident.setFlag(FlagEnum.ACCIDENT.getCode());
} else {
// 该巡检任务存在应急任务,将后面发现的预警直接设置为不展示
Inspection emergencyInspection = inspectionMapper.selectOne(new LambdaQueryWrapper<Inspection>()
.eq(Inspection::getEmergencyDataInspectionId, inspectionFile.getInspectionId())
.eq(Inspection::getMark, MarkEnum.VALID.getCode()));
if (ObjectUtils.isNotEmpty(emergencyInspection)) {
accident.setFlag(FlagEnum.ACCIDENT.getCode());
} else {
// 该巡检任务存在应急任务,将后面发现的预警直接设置为不展示
Inspection emergencyInspection = inspectionMapper.selectOne(new LambdaQueryWrapper<Inspection>()
.eq(Inspection::getEmergencyDataInspectionId, inspectionFile.getInspectionId())
.eq(Inspection::getMark, MarkEnum.VALID.getCode()));
if (ObjectUtils.isNotEmpty(emergencyInspection)) {
accident.setFlag(FlagEnum.ACCIDENT.getCode());
} else {
accident.setFlag(FlagEnum.INSPECTION_ACCIDENT.getCode());
}
accident.setFlag(FlagEnum.INSPECTION_ACCIDENT.getCode());
}
String deptId = inspection.getDeptId();
accident.setDeptId(deptId);
}
String deptId = inspection.getDeptId();
accident.setDeptId(deptId);
}

//公路代号
RoadInformation roadInformation = roadInformationMapper.selectById(inspection.getRoadId());
if(ObjectUtils.isNotEmpty(roadInformation)){
accident.setRoadCode(roadInformation.getCode());
}
accident.setQuestionId(inspectionFile.getQuestionId());
accident.setQuestionCode(inspectionFile.getQuestionCode());
accident.setQuestionName(inspectionFile.getQuestionName());
accident.setIsCasualties(IsCasualtiesEnum.IS_NO_CASUALTIES.getCode());
accident.setIsDrivingSafety(IsDrivingSafetyEnum.IS_NO_DRIVING_SAFETY.getCode());
accident.setIsFire(IsFireEnum.IS_NO_FIRE.getCode());
accident.setLongitude(inspectionFile.getLongitude());
accident.setLatitude(inspectionFile.getLatitude());
accident.setUavReturn(UavReturnEnum.UAV_RETURN_IS_NOT.getCode());
accident.setStatus(AccidentStatusEnum.UNTREATED.getCode());
accident.setCreateUser(inspectionFile.getCreateUser());
accident.setCreateTime(inspectionFile.getCreateTime());
accidentList.add(accident);
//公路代号
RoadInformation roadInformation = roadInformationMapper.selectById(inspection.getRoadId());
if (ObjectUtils.isNotEmpty(roadInformation)) {
accident.setRoadCode(roadInformation.getCode());
}
accident.setQuestionId(inspectionFile.getQuestionId());
accident.setQuestionCode(inspectionFile.getQuestionCode());
accident.setQuestionName(inspectionFile.getQuestionName());
accident.setIsCasualties(IsCasualtiesEnum.IS_NO_CASUALTIES.getCode());
accident.setIsDrivingSafety(IsDrivingSafetyEnum.IS_NO_DRIVING_SAFETY.getCode());
accident.setIsFire(IsFireEnum.IS_NO_FIRE.getCode());
accident.setLongitude(inspectionFile.getLongitude());
accident.setLatitude(inspectionFile.getLatitude());
accident.setUavReturn(UavReturnEnum.UAV_RETURN_IS_NOT.getCode());
accident.setStatus(AccidentStatusEnum.UNTREATED.getCode());
accident.setCreateUser(inspectionFile.getCreateUser());
accident.setCreateTime(inspectionFile.getCreateTime());
accidentList.add(accident);
}
return accidentService.saveBatch(accidentList);
}

/**
* 根据问题类型封装成map
* @return
*/
private Map<String, QuestionType> getStringQuestionTypeMap() {
List<QuestionType> questionTypeList = questionTypeMapper.selectList(Wrappers.<QuestionType>lambdaQuery()
.eq(QuestionType::getMark, MarkEnum.VALID.getCode()));
Map<String, QuestionType> questionTypeMap = new HashMap<>();
for (QuestionType type : questionTypeList) {
questionTypeMap.put(type.getCode(), type);
}
return questionTypeMap;
}

/**
* 获取飞行坐标
*

+ 1
- 1
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/vo/accident/AccidentDetailsVo.java 查看文件

@@ -98,7 +98,7 @@ public class AccidentDetailsVo {
/**
* 现场情况描述
*/
private String checkResult;
private String record;

/**
* 巡检任务问题id

+ 1
- 1
tuoheng-service/tuoheng-admin/src/main/resources/application-test.yml 查看文件

@@ -139,7 +139,7 @@ tuoheng:
# DSP服务域名
dsp-domain-url: http://172.15.1.11:7011
# DSP服务实例Id
dsp-service-inst-id: 0d8166ba7a3081aa1179c37fa57d7d6b
dsp-service-inst-id: b1fa285f1c2567f02066b365dc84e069
# DSP回调地址
dsp-callback-url: https://freeway-test.t-aaron.com/freeway/admin/dsp/callback/{requestId}
#飞手平台地址

+ 10
- 0
tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/entity/QuestionType.java 查看文件

@@ -39,4 +39,14 @@ public class QuestionType extends BaseEntity {
*/
private Integer sort;

/**
* 事故问题:0:否;1:是
*/
private Integer accidentQuestion;

/**
* 是否展示问题 0:否;1是
*/
private Integer isShow;

}

正在加载...
取消
保存