|
|
@@ -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; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 获取飞行坐标 |
|
|
|
* |