Browse Source

应急数据入库接口

tags/v1.2.0^2
chengwang 1 year ago
parent
commit
9994410381
1 changed files with 15 additions and 12 deletions
  1. +15
    -12
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/third/dsp/DspCallbackServiceImpl.java

+ 15
- 12
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/third/dsp/DspCallbackServiceImpl.java View File

@@ -142,6 +142,10 @@ public class DspCallbackServiceImpl implements IDspCallbackService {
}
inspection.setUpdateTime(DateUtils.now());
inspectionMapper.updateByPrimaryKey(inspection);

//获取当前任务对应的部门id
String deptId = inspection.getDeptId();

log.info("巡检任务状态更新成功");

log.info("巡检任务分析问题图片处理开始,此处图片数量为:{}张", StringUtils.isNull(dspCallbackRequest.getQuestionFiles()) ? 0 : dspCallbackRequest.getQuestionFiles().size());
@@ -267,8 +271,11 @@ public class DspCallbackServiceImpl implements IDspCallbackService {
log.info("批量插入问题图片数据");
CommonUtils.batchOperate((x) -> inspectionFileMapper.addBatch(x), thirstyQuestionFiles, 1000);

//批量插入问题之后调用saveAccidentData方法保存应急记录数据入库

log.info("调用saveAccidentData方法保存应急记录数据...");

Boolean flag = this.saveAccidentData(thirstyQuestionFiles);

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

}
@@ -281,14 +288,8 @@ public class DspCallbackServiceImpl implements IDspCallbackService {
* @return
*/
private Boolean saveAccidentData(List<InspectionFile> inspectionFileList){
log.info("应急数据入库开始....");
//获取当前登录用户
User user = CurrentUserUtil.getUserInfo();
//部门
String deptId = user.getDeptId();
if(StringUtils.isEmpty(deptId)){
throw new ServiceException(ServiceExceptionEnum.PARAMETER_IS_NULL);
}
log.info("调用保存应急数据方法,应急数据入库开始....");

List<Accident> accidentList = new ArrayList<>();
List<QuestionType> questionTypeList = questionTypeMapper.selectList(Wrappers.<QuestionType>lambdaQuery()
.eq(QuestionType::getMark, MarkEnum.VALID.getCode()));
@@ -303,7 +304,7 @@ public class DspCallbackServiceImpl implements IDspCallbackService {
if(inspectionFile.getQuestionCode().equals(QuestionCodeEnum.PONDING.getCode())
|| inspectionFile.getQuestionCode().equals(QuestionCodeEnum.PIT_GROOVE.getCode())){
accident.setTenantId(inspectionFile.getTenantId());
accident.setDeptId(deptId);
accident.setInspectionId(inspectionFile.getInspectionId());
accident.setInspectionFileId(inspectionFile.getId());
//应急任务id
@@ -315,7 +316,7 @@ public class DspCallbackServiceImpl implements IDspCallbackService {
accident.setSectionId(inspection.getSectionId());
accident.setSectionName(inspection.getSectionName());

//根据巡检任务类型判断当前应急事故类型
//根据巡检任务类型判断当前应急事故类型flag设值
if (AccidentTaskEnum.INSPECTION_ACCIDENT_TASK.getCode() == inspection.getType()) {
accident.setFlag(FlagEnum.ACCIDENT.getCode());
} else {
@@ -329,6 +330,8 @@ public class DspCallbackServiceImpl implements IDspCallbackService {
accident.setFlag(FlagEnum.INSPECTION_ACCIDENT.getCode());
}
}
String deptId = inspection.getDeptId();
accident.setDeptId(deptId);
}

//公路代号
@@ -346,7 +349,7 @@ public class DspCallbackServiceImpl implements IDspCallbackService {
accident.setLatitude(inspectionFile.getLatitude());
accident.setUavReturn(UavReturnEnum.UAV_RETURN_IS_NOT.getCode());
accident.setStatus(AccidentStatusEnum.UNTREATED.getCode());
accident.setCreateUser(user.getUsername());
accident.setCreateUser(inspectionFile.getCreateUser());
accident.setCreateTime(inspectionFile.getCreateTime());
accidentList.add(accident);
}

Loading…
Cancel
Save