@@ -49,5 +49,15 @@ public class AccidentController { | |||
return accidentService.index(query); | |||
} | |||
/** | |||
* 事故详情 | |||
* @param id | |||
* @return | |||
*/ | |||
@GetMapping("/details/{id}") | |||
public JsonResult accidentDetails(@PathVariable("id") String id){ | |||
return accidentService.accidentDetails(id); | |||
} | |||
} |
@@ -9,7 +9,8 @@ public enum AccidentEnum { | |||
DATA_IS_NULL(1210101, "数据为空"), | |||
USER_IS_NOT_EXIST(1210102, "用户为空"), | |||
TENANT_ID_IS_NULL(1210103,"租户id为空"), | |||
ACCIDENT_DATA_IS_NULL(1210104,"应急数据不存在"); | |||
ACCIDENT_ID_IS_NULL(1210104,"事故id为空"), | |||
ACCIDENT_DATA_IS_NULL(1210105,"应急数据不存在"); | |||
/** | |||
* 错误码 |
@@ -3,6 +3,7 @@ package com.tuoheng.admin.service.accident; | |||
import com.tuoheng.admin.query.AccidentQuery; | |||
import com.tuoheng.admin.request.accident.QueryAccidentPageListRequest; | |||
import com.tuoheng.admin.service.accident.query.QueryAccidentByIdService; | |||
import com.tuoheng.admin.service.accident.query.QueryAccidentDetailsService; | |||
import com.tuoheng.admin.service.accident.query.QueryAccidentPageListService; | |||
import com.tuoheng.common.core.utils.JsonResult; | |||
import lombok.extern.slf4j.Slf4j; | |||
@@ -23,6 +24,9 @@ public class AccidentServiceImpl implements IAccidentService { | |||
@Autowired | |||
private QueryAccidentByIdService queryAccidentByIdService; | |||
@Autowired | |||
private QueryAccidentDetailsService queryAccidentDetailsService; | |||
@Override | |||
public JsonResult getPageList(QueryAccidentPageListRequest request) { | |||
return queryAccidentPageListService.getPageList(request); | |||
@@ -37,4 +41,9 @@ public class AccidentServiceImpl implements IAccidentService { | |||
public JsonResult index(AccidentQuery query) { | |||
return queryAccidentPageListService.index(query); | |||
} | |||
@Override | |||
public JsonResult accidentDetails(String id) { | |||
return queryAccidentDetailsService.accidentDetailsById(id); | |||
} | |||
} |
@@ -31,6 +31,17 @@ public interface IAccidentService { | |||
*/ | |||
JsonResult getAccidentInfo(String id); | |||
/** | |||
* 应急列表分页 | |||
* @param query | |||
* @return | |||
*/ | |||
JsonResult index(AccidentQuery query); | |||
/** | |||
* 事故详情 | |||
* @param id | |||
* @return | |||
*/ | |||
JsonResult accidentDetails(String id); | |||
} |
@@ -0,0 +1,131 @@ | |||
package com.tuoheng.admin.service.accident.query; | |||
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; | |||
import com.tuoheng.admin.entity.*; | |||
import com.tuoheng.admin.enums.AccidentEnum; | |||
import com.tuoheng.admin.mapper.*; | |||
import com.tuoheng.admin.vo.accident.AccidentDetailsVo; | |||
import com.tuoheng.common.core.config.common.CommonConfig; | |||
import com.tuoheng.common.core.utils.JsonResult; | |||
import com.tuoheng.common.core.utils.StringUtils; | |||
import org.springframework.beans.BeanUtils; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.stereotype.Service; | |||
/** | |||
* @Author ChengWang | |||
* @Date 2023/3/9 | |||
*/ | |||
@Service | |||
public class QueryAccidentDetailsService { | |||
@Autowired | |||
private AccidentMapper accidentMapper; | |||
@Autowired | |||
private DeptMapper deptMapper; | |||
@Autowired | |||
private InspectionMapper inspectionMapper; | |||
@Autowired | |||
private SectionMapper sectionMapper; | |||
@Autowired | |||
private InspectionFileMapper inspectionFileMapper; | |||
/** | |||
* 事故详情 | |||
* @param id | |||
* @return | |||
*/ | |||
public JsonResult accidentDetailsById(String id) { | |||
//校验 | |||
if(StringUtils.isEmpty(id)){ | |||
return JsonResult.error(AccidentEnum.ACCIDENT_ID_IS_NULL.getCode(),AccidentEnum.ACCIDENT_ID_IS_NULL.getMsg()); | |||
} | |||
//根据事故id查询事故详情 | |||
Accident accident = accidentMapper.selectById(id); | |||
if(ObjectUtils.isEmpty(accident)){ | |||
return JsonResult.error(AccidentEnum.ACCIDENT_DATA_IS_NULL.getCode(),AccidentEnum.ACCIDENT_DATA_IS_NULL.getMsg()); | |||
} | |||
AccidentDetailsVo vo = new AccidentDetailsVo(); | |||
BeanUtils.copyProperties(accident,vo); | |||
//监管部门 | |||
if(StringUtils.isNotEmpty(accident.getDeptId())){ | |||
Dept dept = deptMapper.selectById(accident.getDeptId()); | |||
if(dept.getName() !=null){ | |||
vo.setDeptName(dept.getName()); | |||
} | |||
} | |||
//任务机场名称 任务执行时间 任务结束时间 任务名称 任务现场视频 | |||
this.getInspectionById(accident, vo); | |||
//所属公路路段范围 | |||
this.getSectionById(accident, vo); | |||
//问题图片 | |||
this.getInspectionFileById(accident, vo); | |||
return JsonResult.success(vo); | |||
} | |||
/** | |||
* 根据问题id查询相关属性 | |||
* @param accident | |||
* @param vo | |||
*/ | |||
private void getInspectionFileById(Accident accident, AccidentDetailsVo vo) { | |||
if(StringUtils.isNotEmpty(accident.getInspectionFileId())){ | |||
InspectionFile inspectionFile = inspectionFileMapper.selectById(accident.getInspectionFileId()); | |||
if(inspectionFile.getFileThumbnail() !=null){ | |||
vo.setFileThumbnail(CommonConfig.imageURL+inspectionFile.getFileThumbnail()); | |||
} | |||
if(inspectionFile.getFileOriginal() !=null){ | |||
vo.setFileOriginal(CommonConfig.imageURL+inspectionFile.getFileOriginal()); | |||
} | |||
if(inspectionFile.getFileImage() !=null){ | |||
vo.setFileImage(CommonConfig.imageURL+inspectionFile.getFileImage()); | |||
} | |||
} | |||
} | |||
/** | |||
* 根据路段id查询路段相关属性 | |||
* @param accident | |||
* @param vo | |||
*/ | |||
private void getSectionById(Accident accident, AccidentDetailsVo vo) { | |||
if(StringUtils.isNotEmpty(accident.getSectionId())){ | |||
Section section = sectionMapper.selectById(accident.getSectionId()); | |||
if(section.getSectionRange() !=null){ | |||
vo.setSectionRange(section.getSectionRange()); | |||
} | |||
} | |||
} | |||
/** | |||
* 根据任务id查询任务相关属性值 | |||
* @param accident | |||
* @param vo | |||
*/ | |||
private void getInspectionById(Accident accident, AccidentDetailsVo vo) { | |||
if(StringUtils.isNotEmpty(accident.getAccidentInspectionId())){ | |||
Inspection inspection = inspectionMapper.selectById(accident.getAccidentInspectionId()); | |||
if(inspection.getAirportName() !=null){ | |||
vo.setAirPortName(inspection.getAirportName()); | |||
} | |||
if(inspection.getExecutionStartTime() !=null){ | |||
vo.setExecutionStartTime(inspection.getExecutionStartTime()); | |||
} | |||
if(inspection.getExecutionEndTime() !=null){ | |||
vo.setExecutionEndTime(inspection.getExecutionEndTime()); | |||
} | |||
if(inspection.getName() !=null){ | |||
vo.setInspectionName(inspection.getName()); | |||
} | |||
if(inspection.getAiVideoUrl() !=null){ | |||
vo.setAiVideoUrl(inspection.getAiVideoUrl()); | |||
} | |||
} | |||
} | |||
} |
@@ -0,0 +1,120 @@ | |||
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; | |||
/** | |||
* 事故详情 返回实体类 | |||
* @Author ChengWang | |||
* @Date 2023/3/9 | |||
*/ | |||
@Data | |||
public class AccidentDetailsVo { | |||
//事故详情 | |||
/** | |||
* 事故经度 | |||
*/ | |||
private String longitude; | |||
/** | |||
* 事故纬度 | |||
*/ | |||
private String latitude; | |||
/** | |||
* 监管部分 | |||
*/ | |||
private String deptName; | |||
/** | |||
* 任务机场 | |||
*/ | |||
private String AirPortName; | |||
/** | |||
* 事故发生公路 | |||
*/ | |||
private String roadCode; | |||
/** | |||
* 所属公路范围路段 | |||
*/ | |||
private String sectionRange; | |||
/** | |||
* 所属路段范围id | |||
*/ | |||
private String sectionId; | |||
/** | |||
* 任务执行时间 | |||
*/ | |||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") | |||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") | |||
private Date executionStartTime; | |||
/** | |||
* 发现事件任务名称 | |||
*/ | |||
private String inspectionName; | |||
/** | |||
* 任务结束时间 | |||
*/ | |||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") | |||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") | |||
private Date executionEndTime; | |||
//核实报告 | |||
/** | |||
* 死亡/受伤 是否有伤亡:0:无;1:有 | |||
*/ | |||
private Integer isCasualties; | |||
/** | |||
* 是否影响驾驶安全:0:无;1:有 | |||
*/ | |||
private Integer isDrivingSafety; | |||
/** | |||
* 是否有明火:0:无;1:有 | |||
*/ | |||
private Integer isFire; | |||
/** | |||
* 现场情况描述 | |||
*/ | |||
private String checkResult; | |||
/** | |||
* 巡检任务问题id | |||
*/ | |||
private String inspectionFileId; | |||
/** | |||
* 问题缩略图 | |||
*/ | |||
private String fileThumbnail; | |||
/** | |||
* 问题原图 | |||
*/ | |||
private String fileOriginal; | |||
/** | |||
* 问题标记图 | |||
*/ | |||
private String fileImage; | |||
/** | |||
* 任务现场视频url | |||
*/ | |||
private String aiVideoUrl; | |||
} |