Browse Source

Merge branch 'develop' of gitadmin/tuoheng_freeway into release

tags/v1.2.0^2
xuziqing 1 year ago
parent
commit
0ca662e78a
30 changed files with 645 additions and 161 deletions
  1. +10
    -1
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/controller/AccidentController.java
  2. +9
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/controller/InspectionController.java
  3. +7
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/entity/Accident.java
  4. +2
    -4
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/enums/AccidentStatusEnum.java
  5. +2
    -1
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/enums/code/inspection/QueryVideoServiceEnum.java
  6. +13
    -2
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/mapper/AccidentMapper.java
  7. +35
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/request/accident/QueryAccidentCardListRequest.java
  8. +2
    -2
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/request/accident/QueryAccidentCardPageListRequest.java
  9. +12
    -4
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/accident/AccidentNoticeService.java
  10. +14
    -5
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/accident/AccidentServiceImpl.java
  11. +10
    -2
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/accident/IAccidentService.java
  12. +4
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/accident/TimeAxisService.java
  13. +1
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/accident/ignore/AccidentIgnoreService.java
  14. +0
    -14
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/accident/query/QueryAccidentByIdService.java
  15. +153
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/accident/query/QueryAccidentCardListService.java
  16. +208
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/accident/query/QueryAccidentCardPageListService.java
  17. +11
    -112
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/accident/query/QueryAccidentPageListService.java
  18. +2
    -1
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/accident/verify/AccidentVerifyCompletedService.java
  19. +4
    -6
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/accident/verify/AccidentVerifyService.java
  20. +0
    -1
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/dept/DeptServiceImpl.java
  21. +7
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspection/IInspectionService.java
  22. +10
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspection/InspectionServiceImpl.java
  23. +3
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspection/delete/DeleteInspectionService.java
  24. +36
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspection/query/QueryVideoService.java
  25. +3
    -2
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/third/dsp/DspCallbackServiceImpl.java
  26. +5
    -1
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/third/oidc/OidcServiceImpl.java
  27. +16
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/vo/InspectionVideoVo.java
  28. +7
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/vo/accident/AccidentTimeAxisVo.java
  29. +26
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/vo/accident/AccidentVo.java
  30. +33
    -3
      tuoheng-service/tuoheng-admin/src/main/resources/mapper/AccidentMapper.xml

+ 10
- 1
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/controller/AccidentController.java View File

@@ -24,11 +24,20 @@ public class AccidentController {
* 查询事故卡片分页列表
*/
@GetMapping("/card/page/list")
public JsonResult getAccidentCardPageList(QueryAccidentPageListRequest request) {
public JsonResult getAccidentCardPageList(QueryAccidentCardPageListRequest request) {
// log.info("进入查询事故分页列表接口");
return accidentService.getAccidentCardPageList(request);
}

/**
* 查询事故卡片列表
*/
@GetMapping("/card/list")
public JsonResult getAccidentCardList(QueryAccidentCardListRequest request) {
// log.info("进入查询事故分页列表接口");
return accidentService.getAccidentCardList(request);
}

/**
* 获取巡检任务信息信息
*/

+ 9
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/controller/InspectionController.java View File

@@ -100,6 +100,15 @@ public class InspectionController {
return iInspectionService.getVideoById(id);
}

/**
* 根据机场id获取正在巡任务的直播
* @param id
* @return
*/
@GetMapping("/videoByAirportId/{id}")
public JsonResult videoByAirportId(@PathVariable("id") String id){
return iInspectionService.videoByAirportId(id);
}

/**
* 获取飞行轨迹

+ 7
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/entity/Accident.java View File

@@ -163,6 +163,13 @@ public class Accident extends BaseEntity {
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date reportTime;

/**
* 忽略时间
*/
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date ignoreTime;

/**
* 结束时间
*/

+ 2
- 4
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/enums/AccidentStatusEnum.java View File

@@ -9,12 +9,10 @@ import lombok.Getter;
public enum AccidentStatusEnum {

UNTREATED(1,"未处理"),

PROCESSING(2,"处理中"),

IGNORED(3,"已忽略"),
PROCESSED(4,"已处理");
PROCESSED(4,"已处理"),
COMPLETED(5,"已完成");

AccidentStatusEnum(int code, String description){
this.code = code;

+ 2
- 1
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/enums/code/inspection/QueryVideoServiceEnum.java View File

@@ -11,7 +11,8 @@ public enum QueryVideoServiceEnum {
LIVE_CHANNEL_IS_NOT_EXIST(1230702, "直播通道为空"),
AIPULL_URL_IS_NOT_NULL(1230703, "直播地址为空"),
AIVIDEO_URL_IS_NOT_NULL(1230704, "回放地址为空"),
INSPECTION_IS_NOT_EXIST(1230705, "任务不存在");
INSPECTION_IS_NOT_EXIST(1230705, "任务不存在"),
AIRPORT_ID_IS_NULL(1230706, "机场id为空");

/**
* 错误码

+ 13
- 2
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/mapper/AccidentMapper.java View File

@@ -4,9 +4,12 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.tuoheng.admin.entity.Accident;
import com.tuoheng.admin.request.accident.QueryAccidentPageListRequest;
import com.tuoheng.admin.request.accident.QueryAccidentCardListRequest;
import com.tuoheng.admin.request.accident.QueryAccidentCardPageListRequest;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
* @Author ChengWang
* @Date 2023/3/2
@@ -19,6 +22,14 @@ public interface AccidentMapper extends BaseMapper<Accident> {
* @param request 事故查询实体
* @return 事故集合
*/
Page<Accident> selectPageList(@Param("page") IPage page, @Param("request") QueryAccidentPageListRequest request);
Page<Accident> selectPageList(@Param("page") IPage page, @Param("request") QueryAccidentCardPageListRequest request);

/**
* 查询事故分页列表
*
* @param request 事故查询实体
* @return 事故集合
*/
List<Accident> selectAccidentCardList(@Param("request") QueryAccidentCardListRequest request);

}

+ 35
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/request/accident/QueryAccidentCardListRequest.java View File

@@ -0,0 +1,35 @@
package com.tuoheng.admin.request.accident;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;
import java.util.List;

/**
* 查询事故卡片请求实体
*
* @author wanjing
* @team tuoheng
* @date 2023-03-20
*/
@Data
public class QueryAccidentCardListRequest {

/**
* 任务状态
*/
private List<Integer> statusList;

/**
* 租户Id
*/
private String tenantId;

/**
* 部门Id list
*/
private List<String> deptIdList;

}

tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/request/accident/QueryAccidentPageListRequest.java → tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/request/accident/QueryAccidentCardPageListRequest.java View File

@@ -9,14 +9,14 @@ import java.util.Date;
import java.util.List;

/**
* 查询巡检任务请求实体
* 查询事故卡片分页请求实体
*
* @author wanjing
* @team tuoheng
* @date 2022-11-17
*/
@Data
public class QueryAccidentPageListRequest extends BaseQuery {
public class QueryAccidentCardPageListRequest extends BaseQuery {

/**
* 公路名称

+ 12
- 4
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/accident/AccidentNoticeService.java View File

@@ -83,11 +83,19 @@ public class AccidentNoticeService {
}
List<String> accidentIdList = oldList.stream().map(o -> o.getId()).collect(Collectors.toList());
newList = accidentMapper.selectList(Wrappers.<Accident>lambdaQuery()
.notIn(Accident::getId, accidentIdList));

.in(Accident::getId, accidentIdList));
accidentList.removeAll(newList);
//下面可以同样实现,只是要查数据库接口影响性能
// newList = accidentMapper.selectList(Wrappers.<Accident>lambdaQuery()
// .notIn(Accident::getId, accidentIdList)
// .eq(Accident::getTenantId, tenantId)
// .eq(Accident::getStatus, AccidentStatusEnum.UNTREATED.getCode())
// .eq(Accident::getFlag, FlagEnum.INSPECTION_ACCIDENT.getCode())
// .eq(Accident::getMark, MarkEnum.VALID.getCode()));
//
//对应list集合排序
newList = newList.stream().sorted(Comparator.comparing(Accident::getCreateTime)).collect(Collectors.toList());
accidentList = accidentList.stream().sorted(Comparator.comparing(Accident::getCreateTime)).collect(Collectors.toList());

return JsonResult.success(newList);
return JsonResult.success(accidentList);
}
}

+ 14
- 5
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/accident/AccidentServiceImpl.java View File

@@ -5,9 +5,7 @@ import com.tuoheng.admin.mapper.AccidentMapper;
import com.tuoheng.admin.query.AccidentQuery;
import com.tuoheng.admin.request.accident.*;
import com.tuoheng.admin.service.accident.ignore.AccidentIgnoreService;
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.admin.service.accident.query.*;
import com.tuoheng.admin.service.accident.reoprt.ReportAccidentService;
import com.tuoheng.admin.service.accident.reoprt.ReportNoAccidentService;
import com.tuoheng.admin.service.accident.verify.AccidentVerifyCompletedService;
@@ -26,6 +24,12 @@ import org.springframework.stereotype.Service;
@Slf4j
public class AccidentServiceImpl extends BaseServiceImpl<AccidentMapper, Accident> implements IAccidentService {

@Autowired
private QueryAccidentCardPageListService queryAccidentCardPageListService;

@Autowired
private QueryAccidentCardListService queryAccidentCardListService;

@Autowired
private QueryAccidentPageListService queryAccidentPageListService;

@@ -60,8 +64,13 @@ public class AccidentServiceImpl extends BaseServiceImpl<AccidentMapper, Acciden
private AccidentIgnoreService accidentIgnoreService;

@Override
public JsonResult getAccidentCardPageList(QueryAccidentPageListRequest request) {
return queryAccidentPageListService.getPageList(request);
public JsonResult getAccidentCardPageList(QueryAccidentCardPageListRequest request) {
return queryAccidentCardPageListService.getPageList(request);
}

@Override
public JsonResult getAccidentCardList(QueryAccidentCardListRequest request) {
return queryAccidentCardListService.getList(request);
}

@Override

+ 10
- 2
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/accident/IAccidentService.java View File

@@ -15,10 +15,18 @@ public interface IAccidentService extends IBaseService<Accident> {
/**
* 查询事故列表(分页)
*
* @param request 事故分页查询实体
* @param request 事故分页列表查询实体
* @return 巡检任务集合
*/
JsonResult getAccidentCardPageList(QueryAccidentPageListRequest request);
JsonResult getAccidentCardPageList(QueryAccidentCardPageListRequest request);

/**
* 查询事故列表
*
* @param request 事故列表查询实体
* @return 巡检任务集合
*/
JsonResult getAccidentCardList(QueryAccidentCardListRequest request);

/**
* 查询事故信息

+ 4
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/accident/TimeAxisService.java View File

@@ -80,6 +80,10 @@ public class TimeAxisService {
if(accident.getReportTime() != null){
vo.setReportTime(accident.getReportTime());
}
//忽略时间
if(accident.getIgnoreTime() != null){
vo.setIgnoreTime(accident.getIgnoreTime());
}
//无事故时间
if(accident.getNoAccidentTime() != null){
vo.setNoAccidentTime(accident.getNoAccidentTime());

+ 1
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/accident/ignore/AccidentIgnoreService.java View File

@@ -84,6 +84,7 @@ public class AccidentIgnoreService {
accidentUpdate.setStatus(AccidentStatusEnum.IGNORED.getCode());
accidentUpdate.setUpdateUser(userId);
accidentUpdate.setUpdateTime(DateUtils.now());
accidentUpdate.setIgnoreTime(DateUtils.now());
Integer count = accidentMapper.updateById(accidentUpdate);
if (count <= 0) {
log.info("事故忽略,修改预警信息失败");

+ 0
- 14
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/accident/query/QueryAccidentByIdService.java View File

@@ -1,20 +1,11 @@
package com.tuoheng.admin.service.accident.query;

import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.tuoheng.admin.conver.AccidentConverMapper;
import com.tuoheng.admin.entity.Accident;
import com.tuoheng.admin.entity.Dept;
import com.tuoheng.admin.enums.MarkEnum;
import com.tuoheng.admin.mapper.AccidentMapper;
import com.tuoheng.admin.mapper.DeptMapper;
import com.tuoheng.admin.request.accident.QueryAccidentPageListRequest;
import com.tuoheng.admin.utils.CurrentUserUtil;
import com.tuoheng.admin.vo.accident.AccidentVo;
import com.tuoheng.common.core.exception.ServiceException;
import com.tuoheng.common.core.utils.JsonResult;
import com.tuoheng.common.core.utils.StringUtils;
@@ -22,11 +13,6 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

/**
* 根据ID查询事件业务层处理
*

+ 153
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/accident/query/QueryAccidentCardListService.java View File

@@ -0,0 +1,153 @@
package com.tuoheng.admin.service.accident.query;

import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.tuoheng.admin.conver.AccidentConverMapper;
import com.tuoheng.admin.entity.Accident;
import com.tuoheng.admin.entity.Dept;
import com.tuoheng.admin.entity.InspectionFile;
import com.tuoheng.admin.entity.User;
import com.tuoheng.admin.enums.MarkEnum;
import com.tuoheng.admin.enums.RoleEnum;
import com.tuoheng.admin.mapper.AccidentMapper;
import com.tuoheng.admin.mapper.DeptMapper;
import com.tuoheng.admin.mapper.InspectionFileMapper;
import com.tuoheng.admin.mapper.UserMapper;
import com.tuoheng.admin.request.accident.QueryAccidentCardListRequest;
import com.tuoheng.admin.utils.CurrentUserUtil;
import com.tuoheng.admin.vo.accident.AccidentVo;
import com.tuoheng.common.core.config.common.CommonConfig;
import com.tuoheng.common.core.utils.JsonResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

/**
* 查询事故卡片列表业务层处理
*
* @author wanjing
* @team tuoheng
* @date 2023-03-03
*/
@Slf4j
@Service
public class QueryAccidentCardListService {

@Autowired
private DeptMapper deptMapper;

@Autowired
private UserMapper userMapper;

@Autowired
private InspectionFileMapper inspectionFileMapper;

@Autowired
private AccidentMapper accidentMapper;

public JsonResult getList(QueryAccidentCardListRequest request) {
// log.info("进入查询事件列表业务");
String tenantId = CurrentUserUtil.getTenantId();
request.setTenantId(tenantId);
JsonResult result = this.check(tenantId, request);
if (0 != result.getCode()) {
log.info("进入查询事故卡片列表业务:校验失败:{}", result.getMsg());
return result;
}

List<Accident> accidentList = accidentMapper.selectAccidentCardList(request);

// 构造返回结果对象
List<AccidentVo> accidentVoList = this.buildAccidentVoList(accidentList);

return JsonResult.success(accidentVoList);
}

/**
* 检查参数
*
* @param tenantId
* @param request
* @return
*/
private JsonResult check(String tenantId, QueryAccidentCardListRequest request) {
return JsonResult.success();
}

/**
* @param accidentList
* @return
*/
private List<AccidentVo> buildAccidentVoList(List<Accident> accidentList) {
Map<String, String> deptNameMap = this.getDeptMap(accidentList);
Map<String, User> userMap = this.getUserMap(deptNameMap);
Map<String, InspectionFile> inspectionFileMap = this.getInspectionFileMap(accidentList);
List<AccidentVo> accidentVoList = AccidentConverMapper.INSTANCE.accidentListToAccidentVoList(accidentList);
String deptName;
User user;
InspectionFile inspectionFile;
for (AccidentVo accidentVo : accidentVoList) {
if (ObjectUtil.isNotNull(deptNameMap)) {
deptName = deptNameMap.get(accidentVo.getDeptId());
accidentVo.setDeptName(deptName);
}
if (ObjectUtil.isNotNull(userMap)) {
user = userMap.get(accidentVo.getDeptId());
if (ObjectUtil.isNotNull(user)) {
accidentVo.setDepartmentHead(user.getRealname());
accidentVo.setDepartmentHeadTelephone(user.getMobile());
}
}
if (ObjectUtil.isNotNull(inspectionFileMap)) {
inspectionFile = inspectionFileMap.get(accidentVo.getInspectionFileId());
if (ObjectUtil.isNotNull(inspectionFile)) {
accidentVo.setFileName(inspectionFile.getFileName());
accidentVo.setFileImage(CommonConfig.imageURL + inspectionFile.getFileImage());
accidentVo.setFileOriginal(CommonConfig.imageURL + inspectionFile.getFileOriginal());
accidentVo.setFileThumbnail(CommonConfig.imageURL + inspectionFile.getFileThumbnail());
}
}
}
return accidentVoList;
}

/**
* 设置列表中每一个的部门名称
* 查询到的列表中的部门Id,作为部门id列表,查询所有的部门,该结果数据量不会太大,放到map中
*
* @param accidentList
* @return
*/
private Map<String, String> getDeptMap(List<Accident> accidentList) {
List<String> deptIdList = accidentList.stream().map(o -> o.getDeptId()).collect(Collectors.toList());
List<Dept> deptList = deptMapper.selectListByIdList(deptIdList);
Map<String, String> deptNameMap = deptList.stream().collect(HashMap::new, (m, v) -> m.put(v.getId(), v.getName()), HashMap::putAll);
return deptNameMap;
}

private Map<String, User> getUserMap(Map<String, String> deptMap) {
if (ObjectUtil.isNull(deptMap)) {
return null;
}
List<String> deptIdList = deptMap.keySet().stream().collect(Collectors.toList());
List<User> userList = userMapper.selectList(new LambdaQueryWrapper<User>()
.in(User::getDeptId, deptIdList)
.eq(User::getRoleId, RoleEnum.ADMIN.getCode()));
Map<String, User> userMap = userList.stream().collect(HashMap::new, (m, v) -> m.put(v.getDeptId(), v), HashMap::putAll);
return userMap;
}

private Map<String, InspectionFile> getInspectionFileMap(List<Accident> accidentList) {
List<String> inspectionFileIdList = accidentList.stream().map(o -> o.getInspectionFileId()).collect(Collectors.toList());
List<InspectionFile> inspectionFileList = inspectionFileMapper.selectList(new LambdaQueryWrapper<InspectionFile>()
.in(InspectionFile::getId, inspectionFileIdList)
.eq(InspectionFile::getMark, MarkEnum.VALID.getCode()));
Map<String, InspectionFile> inspectionFileMap = inspectionFileList.stream().collect(HashMap::new, (m, v) -> m.put(v.getId(), v), HashMap::putAll);
return inspectionFileMap;
}
}

+ 208
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/accident/query/QueryAccidentCardPageListService.java View File

@@ -0,0 +1,208 @@
package com.tuoheng.admin.service.accident.query;

import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.tuoheng.admin.conver.AccidentConverMapper;
import com.tuoheng.admin.entity.Accident;
import com.tuoheng.admin.entity.Dept;
import com.tuoheng.admin.entity.User;
import com.tuoheng.admin.enums.AccidentEnum;
import com.tuoheng.admin.enums.FlagEnum;
import com.tuoheng.admin.enums.MarkEnum;
import com.tuoheng.admin.enums.RoleEnum;
import com.tuoheng.admin.mapper.AccidentMapper;
import com.tuoheng.admin.mapper.DeptMapper;
import com.tuoheng.admin.mapper.UserMapper;
import com.tuoheng.admin.query.AccidentQuery;
import com.tuoheng.admin.request.accident.QueryAccidentCardPageListRequest;
import com.tuoheng.admin.utils.CurrentUserUtil;
import com.tuoheng.admin.vo.accident.AccidentVo;
import com.tuoheng.admin.vo.accident.QueryAccidentPageVO;
import com.tuoheng.common.core.enums.ServiceExceptionEnum;
import com.tuoheng.common.core.exception.ServiceException;
import com.tuoheng.common.core.utils.DateUtils;
import com.tuoheng.common.core.utils.JsonResult;
import com.tuoheng.common.core.utils.StringUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

/**
* 查询事故卡片分页列表业务层处理
*
* @author wanjing
* @team tuoheng
* @date 2023-03-03
*/
@Slf4j
@Service
public class QueryAccidentCardPageListService {

@Autowired
private DeptMapper deptMapper;

@Autowired
private UserMapper userMapper;

@Autowired
private AccidentMapper accidentMapper;

public JsonResult getPageList(QueryAccidentCardPageListRequest request) {
// log.info("进入查询事件分页列表业务");
String tenantId = CurrentUserUtil.getTenantId();
request.setTenantId(tenantId);
JsonResult result = this.check(tenantId, request);
if (0 != result.getCode()) {
log.info("进入查询事故卡片分页列表业务:校验失败:{}", result.getMsg());
return result;
}

// 设置分页参数
IPage<Accident> page = new Page<>(request.getPage(), request.getLimit());
IPage<Accident> pageData = accidentMapper.selectPageList(page, request);

// 构造返回结果对象
List<AccidentVo> accidentVoList = this.buildAccidentVoList(pageData.getRecords());

// 重写返回结果对象
IPage<AccidentVo> accidentVoPageData = new Page<>();
accidentVoPageData.setPages(pageData.getPages());
accidentVoPageData.setCurrent(pageData.getCurrent());
accidentVoPageData.setSize(pageData.getSize());
accidentVoPageData.setTotal(pageData.getTotal());
accidentVoPageData.setRecords(accidentVoList);
return JsonResult.success(accidentVoPageData);
}

/**
* 检查参数
*
* @param tenantId
* @param request
* @return
*/
private JsonResult check(String tenantId, QueryAccidentCardPageListRequest request) {
return JsonResult.success();
}

/**
* @param accidentList
* @return
*/
private List<AccidentVo> buildAccidentVoList(List<Accident> accidentList) {
Map<String, String> deptNameMap = this.getDeptMap(accidentList);
Map<String, User> userMap = this.getUserMap(deptNameMap);
List<AccidentVo> accidentVoList = AccidentConverMapper.INSTANCE.accidentListToAccidentVoList(accidentList);
String deptName;
User user;
for (AccidentVo accidentVo : accidentVoList) {
if (ObjectUtil.isNotNull(deptNameMap)) {
deptName = deptNameMap.get(accidentVo.getDeptId());
accidentVo.setDeptName(deptName);
}
if (ObjectUtil.isNotNull(userMap)) {
user = userMap.get(accidentVo.getDeptId());
if (ObjectUtil.isNotNull(user)) {
accidentVo.setDepartmentHead(user.getRealname());
accidentVo.setDepartmentHeadTelephone(user.getMobile());
}
}
}
return accidentVoList;
}

/**
* 设置列表中每一个的部门名称
* 查询到的列表中的部门Id,作为部门id列表,查询所有的部门,该结果数据量不会太大,放到map中
*
* @param accidentList
* @return
*/
private Map<String, String> getDeptMap(List<Accident> accidentList) {
List<String> deptIdList = accidentList.stream().map(o -> o.getDeptId()).collect(Collectors.toList());
List<Dept> deptList = deptMapper.selectListByIdList(deptIdList);
Map<String, String> deptNameMap = deptList.stream().collect(HashMap::new, (m, v) -> m.put(v.getId(), v.getName()), HashMap::putAll);
return deptNameMap;
}

private Map<String, User> getUserMap(Map<String, String> deptMap) {
if (ObjectUtil.isNull(deptMap)) {
return null;
}
List<String> deptIdList = deptMap.keySet().stream().collect(Collectors.toList());
List<User> userList = userMapper.selectList(new LambdaQueryWrapper<User>()
.in(User::getDeptId, deptIdList)
.eq(User::getRoleId, RoleEnum.ADMIN.getCode()));
Map<String, User> userMap = userList.stream().collect(HashMap::new, (m, v) -> m.put(v.getDeptId(), v), HashMap::putAll);
return userMap;
}

public JsonResult index(AccidentQuery query) {
//校验
if(query.getLimit() == null && query.getPage() == null){
throw new ServiceException(ServiceExceptionEnum.PARAMETER_IS_NULL);
}

//当前租户下
String tenantId = CurrentUserUtil.getTenantId();
if(tenantId == null){
return JsonResult.error(AccidentEnum.TENANT_ID_IS_NULL.getCode(),AccidentEnum.TENANT_ID_IS_NULL.getMsg());
}
query.setTenantId(tenantId);
IPage<Accident> page = new Page<>(query.getPage(),query.getLimit());
IPage<QueryAccidentPageVO> pageData = new Page<>(query.getPage(),query.getLimit());
//搜索时间
Date startTime = null;
Date endTime = null;
if(StringUtils.isNotEmpty(query.getStartTime()) && StringUtils.isNotEmpty(query.getEndTime())){
startTime = DateUtils.dateTime(DateUtils.YYYY_MM_DD_HH_MM_SS,query.getStartTime()+" 00:00:00");
endTime = DateUtils.dateTime(DateUtils.YYYY_MM_DD_HH_MM_SS,query.getEndTime()+" 23:59:59");
}
query.setAccidentStartTime(startTime);
query.setAccidentEndTime(endTime);
//获取分页数据
IPage<Accident> accidentPageData = accidentMapper.selectPage(page, Wrappers.<Accident>lambdaQuery()
.eq(null != query.getCode(),Accident::getRoadCode,query.getCode())
.eq(null != query.getDeptId(),Accident::getDeptId,query.getDeptId())
.between(null != query.getAccidentStartTime() && null != query.getAccidentEndTime(),
Accident::getCreateTime, query.getAccidentStartTime(), query.getAccidentEndTime())
.eq(Accident::getFlag, FlagEnum.INSPECTION_ACCIDENT.getCode())
.eq(Accident::getMark, MarkEnum.VALID.getCode())
.orderByDesc(Accident::getCreateTime));
//属性复制
List<QueryAccidentPageVO> result = accidentPageData.getRecords().stream().map(x -> {
QueryAccidentPageVO vo = new QueryAccidentPageVO();
BeanUtils.copyProperties(x, vo);
//公路代号
if (StringUtils.isNotEmpty(x.getRoadCode())) {
vo.setCode(x.getRoadCode());
}
//监管部门
if (StringUtils.isNotEmpty(x.getDeptId())) {
//根据当前部门id查询对应的部门名称
Dept dept = deptMapper.selectById(x.getDeptId());
vo.setName(dept.getName() !=null?dept.getName():"");
}

return vo;
}).collect(Collectors.toList());
pageData.setPages(accidentPageData.getPages());
pageData.setRecords(result);
pageData.setTotal(accidentPageData.getTotal());
pageData.setCurrent(accidentPageData.getCurrent());

return JsonResult.success(pageData);


}
}

+ 11
- 112
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/accident/query/QueryAccidentPageListService.java View File

@@ -1,27 +1,18 @@
package com.tuoheng.admin.service.accident.query;

import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.tuoheng.admin.conver.AccidentConverMapper;
import com.tuoheng.admin.entity.Accident;
import com.tuoheng.admin.entity.Dept;
import com.tuoheng.admin.entity.InspectionFileHandle;
import com.tuoheng.admin.entity.User;
import com.tuoheng.admin.enums.AccidentEnum;
import com.tuoheng.admin.enums.FlagEnum;
import com.tuoheng.admin.enums.MarkEnum;
import com.tuoheng.admin.enums.RoleEnum;
import com.tuoheng.admin.mapper.AccidentMapper;
import com.tuoheng.admin.mapper.DeptMapper;
import com.tuoheng.admin.mapper.UserMapper;
import com.tuoheng.admin.query.AccidentQuery;
import com.tuoheng.admin.request.accident.QueryAccidentPageListRequest;
import com.tuoheng.admin.utils.CurrentUserUtil;
import com.tuoheng.admin.vo.accident.AccidentVo;
import com.tuoheng.admin.vo.accident.QueryAccidentPageVO;
import com.tuoheng.common.core.enums.ServiceExceptionEnum;
import com.tuoheng.common.core.exception.ServiceException;
@@ -34,9 +25,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

/**
@@ -59,123 +48,33 @@ public class QueryAccidentPageListService {
@Autowired
private AccidentMapper accidentMapper;

public JsonResult getPageList(QueryAccidentPageListRequest request) {
// log.info("进入查询事件分页列表业务");
String tenantId = CurrentUserUtil.getTenantId();
request.setTenantId(tenantId);
JsonResult result = this.check(tenantId, request);
if (0 != result.getCode()) {
log.info("进入查询事故卡片分页列表业务:校验失败:{}", result.getMsg());
return result;
}

// 设置分页参数
IPage<Accident> page = new Page<>(request.getPage(), request.getLimit());
IPage<Accident> pageData = accidentMapper.selectPageList(page, request);

// 构造返回结果对象
List<AccidentVo> accidentVoList = this.buildAccidentVoList(pageData.getRecords());

// 重写返回结果对象
IPage<AccidentVo> accidentVoPageData = new Page<>();
accidentVoPageData.setPages(pageData.getPages());
accidentVoPageData.setCurrent(pageData.getCurrent());
accidentVoPageData.setSize(pageData.getSize());
accidentVoPageData.setTotal(pageData.getTotal());
accidentVoPageData.setRecords(accidentVoList);
return JsonResult.success(accidentVoPageData);
}

/**
* 检查参数
*
* @param tenantId
* @param request
* @return
*/
private JsonResult check(String tenantId, QueryAccidentPageListRequest request) {
return JsonResult.success();
}

/**
* @param accidentList
* @return
*/
private List<AccidentVo> buildAccidentVoList(List<Accident> accidentList) {
Map<String, String> deptNameMap = this.getDeptMap(accidentList);
Map<String, User> userMap = this.getUserMap(deptNameMap);
List<AccidentVo> accidentVoList = AccidentConverMapper.INSTANCE.accidentListToAccidentVoList(accidentList);
String deptName;
User user;
for (AccidentVo accidentVo : accidentVoList) {
if (ObjectUtil.isNotNull(deptNameMap)) {
deptName = deptNameMap.get(accidentVo.getDeptId());
accidentVo.setDeptName(deptName);
}
if (ObjectUtil.isNotNull(userMap)) {
user = userMap.get(accidentVo.getDeptId());
if (ObjectUtil.isNotNull(user)) {
accidentVo.setDepartmentHead(user.getRealname());
accidentVo.setDepartmentHeadTelephone(user.getMobile());
}
}
}
return accidentVoList;
}

/**
* 设置列表中每一个的部门名称
* 查询到的列表中的部门Id,作为部门id列表,查询所有的部门,该结果数据量不会太大,放到map中
*
* @param accidentList
* @return
*/
private Map<String, String> getDeptMap(List<Accident> accidentList) {
List<String> deptIdList = accidentList.stream().map(o -> o.getDeptId()).collect(Collectors.toList());
List<Dept> deptList = deptMapper.selectListByIdList(deptIdList);
Map<String, String> deptNameMap = deptList.stream().collect(HashMap::new, (m, v) -> m.put(v.getId(), v.getName()), HashMap::putAll);
return deptNameMap;
}

private Map<String, User> getUserMap(Map<String, String> deptMap) {
if (ObjectUtil.isNull(deptMap)) {
return null;
}
List<String> deptIdList = deptMap.keySet().stream().collect(Collectors.toList());
List<User> userList = userMapper.selectList(new LambdaQueryWrapper<User>()
.in(User::getDeptId, deptIdList)
.eq(User::getRoleId, RoleEnum.ADMIN.getCode()));
Map<String, User> userMap = userList.stream().collect(HashMap::new, (m, v) -> m.put(v.getDeptId(), v), HashMap::putAll);
return userMap;
}

public JsonResult index(AccidentQuery query) {
//校验
if(query.getLimit() == null && query.getPage() == null){
if (query.getLimit() == null && query.getPage() == null) {
throw new ServiceException(ServiceExceptionEnum.PARAMETER_IS_NULL);
}

//当前租户下
String tenantId = CurrentUserUtil.getTenantId();
if(tenantId == null){
return JsonResult.error(AccidentEnum.TENANT_ID_IS_NULL.getCode(),AccidentEnum.TENANT_ID_IS_NULL.getMsg());
if (tenantId == null) {
return JsonResult.error(AccidentEnum.TENANT_ID_IS_NULL.getCode(), AccidentEnum.TENANT_ID_IS_NULL.getMsg());
}
query.setTenantId(tenantId);
IPage<Accident> page = new Page<>(query.getPage(),query.getLimit());
IPage<QueryAccidentPageVO> pageData = new Page<>(query.getPage(),query.getLimit());
IPage<Accident> page = new Page<>(query.getPage(), query.getLimit());
IPage<QueryAccidentPageVO> pageData = new Page<>(query.getPage(), query.getLimit());
//搜索时间
Date startTime = null;
Date endTime = null;
if(StringUtils.isNotEmpty(query.getStartTime()) && StringUtils.isNotEmpty(query.getEndTime())){
startTime = DateUtils.dateTime(DateUtils.YYYY_MM_DD_HH_MM_SS,query.getStartTime()+" 00:00:00");
endTime = DateUtils.dateTime(DateUtils.YYYY_MM_DD_HH_MM_SS,query.getEndTime()+" 23:59:59");
if (StringUtils.isNotEmpty(query.getStartTime()) && StringUtils.isNotEmpty(query.getEndTime())) {
startTime = DateUtils.dateTime(DateUtils.YYYY_MM_DD_HH_MM_SS, query.getStartTime() + " 00:00:00");
endTime = DateUtils.dateTime(DateUtils.YYYY_MM_DD_HH_MM_SS, query.getEndTime() + " 23:59:59");
}
query.setAccidentStartTime(startTime);
query.setAccidentEndTime(endTime);
//获取分页数据
IPage<Accident> accidentPageData = accidentMapper.selectPage(page, Wrappers.<Accident>lambdaQuery()
.eq(null != query.getCode(),Accident::getRoadCode,query.getCode())
.eq(null != query.getDeptId(),Accident::getDeptId,query.getDeptId())
.eq(null != query.getCode(), Accident::getRoadCode, query.getCode())
.eq(null != query.getDeptId(), Accident::getDeptId, query.getDeptId())
.between(null != query.getAccidentStartTime() && null != query.getAccidentEndTime(),
Accident::getCreateTime, query.getAccidentStartTime(), query.getAccidentEndTime())
.eq(Accident::getFlag, FlagEnum.INSPECTION_ACCIDENT.getCode())
@@ -193,7 +92,7 @@ public class QueryAccidentPageListService {
if (StringUtils.isNotEmpty(x.getDeptId())) {
//根据当前部门id查询对应的部门名称
Dept dept = deptMapper.selectById(x.getDeptId());
vo.setName(dept.getName() !=null?dept.getName():"");
vo.setName(dept.getName() != null ? dept.getName() : "");
}

return vo;

+ 2
- 1
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/accident/verify/AccidentVerifyCompletedService.java View File

@@ -99,7 +99,7 @@ public class AccidentVerifyCompletedService {
if (ObjectUtil.isNull(accident)) {
throw new ServiceException("事故不存在");
}
if (AccidentStatusEnum.PROCESSED.getCode() == accident.getStatus()) {
if (AccidentStatusEnum.PROCESSED.getCode() != accident.getStatus()) {
throw new ServiceException("该事故未处理,不能核实完成");
}
return JsonResult.success(accident);
@@ -138,6 +138,7 @@ public class AccidentVerifyCompletedService {
accidentUpdate.setUpdateUser(userId);
accidentUpdate.setUpdateTime(DateUtils.now());
accidentUpdate.setEndTime(DateUtils.now());
accidentUpdate.setStatus(AccidentStatusEnum.COMPLETED.getCode());
Integer count = accidentMapper.updateById(accidentUpdate);
if (count <= 0) {
log.info("事故核实完成,修改预警信息失败");

+ 4
- 6
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/accident/verify/AccidentVerifyService.java View File

@@ -94,7 +94,7 @@ public class AccidentVerifyService {
if (ObjectUtil.isNull(accident)) {
throw new ServiceException("事故不存在");
}
if (AccidentStatusEnum.UNTREATED.getCode() == accident.getStatus()) {
if (AccidentStatusEnum.UNTREATED.getCode() != accident.getStatus()) {
throw new ServiceException("该事故已处理,不能在核实");
}
return JsonResult.success(accident);
@@ -125,12 +125,10 @@ public class AccidentVerifyService {
inspection.setCreateUser(userid);
inspection.setCreateTime(DateUtils.now());
inspection.setEmergencyDataInspectionId(oldInspection.getId());

inspection.setRoadId("");
inspection.setRoadName("");
inspection.setSectionId("");
inspection.setSectionName("");

Integer count = inspectionMapper.insert(inspection);
if (count <= 0) {
log.info("创建应急任务失败");
@@ -152,7 +150,7 @@ public class AccidentVerifyService {
JSONObject jsonObject = new JSONObject();
jsonObject.put("taskId", inspection.getId());
jsonObject.put("airportId", inspection.getAirportId());
jsonObject.put("zalt", "");
jsonObject.put("zalt", "100");
jsonObject.put("zlon", inspectionFile.getLongitude());
jsonObject.put("zlat", inspectionFile.getLatitude());

@@ -162,13 +160,13 @@ public class AccidentVerifyService {
String airPortStr = HttpUtils.doSend(url, jsonObject, null, "POST");
if (StringUtils.isEmpty(airPortStr)) {
log.info("调用机场平台,无人机执行定点飞行:返回数据为空,飞行失败,jsonObject:{}", jsonObject);
throw new ServiceException("机场平台返回数据为空,飞行失败");
// throw new ServiceException("机场平台返回数据为空,飞行失败");
}

JsonResult jsonResult = JacksonUtil.json2pojo(airPortStr, JsonResult.class);
if (0 != jsonResult.getCode()) {
log.info("调用机场平台,无人机执行定点飞行:飞行失败,jsonResult:{}", jsonResult.getMsg());
throw new ServiceException("机场平台返回,飞行失败");
// throw new ServiceException("机场平台返回,飞行失败");
}
}


+ 0
- 1
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/dept/DeptServiceImpl.java View File

@@ -3,7 +3,6 @@ package com.tuoheng.admin.service.dept;
import com.tuoheng.admin.mapper.DeptMapper;
import com.tuoheng.admin.request.dept.AddDeptRequest;
import com.tuoheng.admin.request.dept.EditDeptRequest;
import com.tuoheng.admin.service.accident.query.QueryAccidentPageListService;
import com.tuoheng.admin.service.dept.add.AddDeptService;
import com.tuoheng.admin.service.dept.delete.DeleteDeptService;
import com.tuoheng.admin.service.dept.query.*;

+ 7
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspection/IInspectionService.java View File

@@ -145,4 +145,11 @@ public interface IInspectionService {
* @return
*/
JsonResult updateTaskByCode(UpdateTaskByCodeRequest request);

/**
* 根据机场id获取正在巡任务的直播
* @param id
* @return
*/
JsonResult videoByAirportId(String id);
}

+ 10
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspection/InspectionServiceImpl.java View File

@@ -289,4 +289,14 @@ public class InspectionServiceImpl implements IInspectionService {
return updateFlyerService.update(request);
}

/**
* 根据机场id获取正在巡任务的直播
* @param id
* @return
*/
@Override
public JsonResult videoByAirportId(String id) {
return queryVideoService.videoByAirportId(id);
}

}

+ 3
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspection/delete/DeleteInspectionService.java View File

@@ -331,6 +331,9 @@ public class DeleteInspectionService {
* @return
*/
private JsonResult deleteInspectionFileHandleByPhysical(Inspection inspection, List<String> inspectionFileIdList) {
if (CollectionUtil.isEmpty(inspectionFileIdList)) {
return JsonResult.success();
}
Integer rowId = inspectionFileHandleMapper.deleteByInspectionFileIdList(inspectionFileIdList);
log.info("删除任务, 返回结果: rowId={}", rowId);
if (rowId < 0) {

+ 36
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspection/query/QueryVideoService.java View File

@@ -2,11 +2,16 @@ 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.ObjectUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.tuoheng.admin.entity.Inspection;
import com.tuoheng.admin.entity.LiveChannel;
import com.tuoheng.admin.enums.InspectionStatusEnum;
import com.tuoheng.admin.enums.MarkEnum;
import com.tuoheng.admin.enums.code.inspection.QueryVideoServiceEnum;
import com.tuoheng.admin.mapper.InspectionMapper;
import com.tuoheng.admin.mapper.LiveChannelMapper;
import com.tuoheng.admin.vo.InspectionVideoVo;
import com.tuoheng.admin.vo.LiveChannelVo;
import com.tuoheng.common.core.config.common.CommonConfig;
import com.tuoheng.common.core.utils.JsonResult;
@@ -67,4 +72,35 @@ public class QueryVideoService {
}
return JsonResult.success(liveChannelVo);
}

public JsonResult videoByAirportId(String id) {
if (StringUtils.isEmpty(id)) {
return JsonResult.error(QueryVideoServiceEnum.AIRPORT_ID_IS_NULL.getCode(), QueryVideoServiceEnum.AIRPORT_ID_IS_NULL.getMsg());
}
//根据机场id查询对应正在巡检的任务
Inspection inspection = inspectionMapper.selectOne(Wrappers.<Inspection>lambdaQuery()
.eq(Inspection::getAirportId, id)
.eq(Inspection::getStatus, InspectionStatusEnum.IN_FLIGHT.getCode())
.eq(Inspection::getMark, MarkEnum.VALID.getCode()));
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()) {
//任务状态为任务飞行中10视频直播
LiveChannel liveChannel = liveChannelMapper.selectOne(new LambdaQueryWrapper<LiveChannel>()
.eq(LiveChannel::getMark, 1)
.eq(LiveChannel::getInspectionId, inspection.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());
}
if (StringUtils.isEmpty(liveChannel.getAipullUrl())) {
return JsonResult.error(QueryVideoServiceEnum.AIPULL_URL_IS_NOT_NULL.getCode(), QueryVideoServiceEnum.AIPULL_URL_IS_NOT_NULL.getMsg());
}
vo.setAipullUrl(liveChannel.getAipullUrl());
}

return JsonResult.success(vo);
}
}

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

@@ -9,7 +9,6 @@ import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.tuoheng.admin.entity.*;
import com.tuoheng.admin.enums.*;
import com.tuoheng.admin.enums.code.questiontype.QuestionTypeEnum;
import com.tuoheng.admin.mapper.*;
import com.tuoheng.admin.request.third.DspCallbackRequest;
import com.tuoheng.admin.request.third.QuestionFile;
@@ -301,11 +300,13 @@ public class DspCallbackServiceImpl implements IDspCallbackService {
for (InspectionFile inspectionFile : inspectionFileList) {
Accident accident = new Accident();
//问题类型为应急类型时添加数据
if(inspectionFile.getQuestionCode().equals(QuestionCodeEnum.TURN_OVER.getCode()) || inspectionFile.getQuestionCode().equals(QuestionCodeEnum.REAR_END_COLLISION.getCode())){
if(inspectionFile.getQuestionCode().equals(QuestionCodeEnum.PONDING.getCode())
|| inspectionFile.getQuestionCode().equals(QuestionCodeEnum.BIOCKY_CRACK.getCode())){
accident.setTenantId(inspectionFile.getTenantId());
accident.setDeptId(deptId);
accident.setInspectionId(inspectionFile.getInspectionId());
accident.setInspectionFileId(inspectionFile.getId());
//应急任务id
accident.setAccidentInspectionId(inspectionFile.getInspectionId());
//根据巡检任务查询对应的公路id
Inspection inspection = inspectionMapper.selectById(inspectionFile.getInspectionId());

+ 5
- 1
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/third/oidc/OidcServiceImpl.java View File

@@ -7,7 +7,9 @@ import com.tuoheng.admin.query.RoleClientQuery;
import com.tuoheng.admin.request.third.oidc.CreateOidcTenantRequest;
import com.tuoheng.admin.request.third.oidc.DeletedOidcTenantRequest;
import com.tuoheng.admin.request.third.oidc.EditOidcTenantRequest;
import com.tuoheng.admin.service.permissions.OpPermissionsService;
import com.tuoheng.admin.service.role.IRoleService;
import com.tuoheng.admin.service.role.OpRolePermissionService;
import com.tuoheng.common.core.utils.JsonResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
@@ -37,6 +39,8 @@ public class OidcServiceImpl implements OidcService {

@Autowired
private IRoleService roleService;
@Autowired
private OpPermissionsService opPermissionsService;


public JsonResult addUser(User user, String password, Tenant tenant) {
@@ -89,6 +93,6 @@ public class OidcServiceImpl implements OidcService {

RoleClientQuery query = new RoleClientQuery();
query.setRoleId(roleId);
return roleService.getMenuList(query);
return opPermissionsService.getRolePermissionByRoleId(query);
}
}

+ 16
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/vo/InspectionVideoVo.java View File

@@ -0,0 +1,16 @@
package com.tuoheng.admin.vo;

import lombok.Data;

/**
* @Author ChengWang
* @Date 2023/3/20
*/
@Data
public class InspectionVideoVo {

/**
* 直播地址
*/
private String aipullUrl;
}

+ 7
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/vo/accident/AccidentTimeAxisVo.java View File

@@ -33,6 +33,13 @@ public class AccidentTimeAxisVo {
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date verificationTime;

/**
* 忽略时间
*/
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date ignoreTime;

/**
* 上报时间
*/

+ 26
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/vo/accident/AccidentVo.java View File

@@ -100,6 +100,32 @@ public class AccidentVo extends BaseEntity {
*/
private String latitude;

/**
* 位置信息
*/
private String location;

/**
* 文件名称
*/
private String fileName;

/**
* 标记图
*/
private String fileImage;

/**
* 缩略图
*/
private String fileThumbnail;

/**
* 原图
*/
private String fileOriginal;


/**
* 事故状态:1未处理 2处理中 3已忽略 4已处理
*/

+ 33
- 3
tuoheng-service/tuoheng-admin/src/main/resources/mapper/AccidentMapper.xml View File

@@ -29,22 +29,30 @@
<result property="checkUser" column="check_user" />
<result property="checkTime" column="check_time" />
<result property="checkResult" column="check_result" />
<result property="verificationTime" column="verification_time" />
<result property="reportTime" column="report_time" />
<result property="noAccidentTime" column="no_accident_time" />
<result property="ignoreTime" column="ignore_time" />
<result property="endTime" column="end_time" />
<result property="flag" column="flag" />
<result property="mark" column="mark" />
</resultMap>


<sql id="Base_Column_List">
id, tenant_id, dept_id, inspection_id, inspection_file_id, accident_inspection_id, road_id, section_id, question_id, question_code, question_name,
is_casualties, is_driving_safety, is_fire, record, longitude, latitude, uav_return, status, create_user, create_time, update_user, update_time,
check_user, check_time, check_result, mark
check_user, check_time, check_result, verification_time, report_time, no_accident_time, ignore_time, end_time, flag, mark
</sql>

<sql id="selectThAccidentVo">
select id, tenant_id, dept_id, inspection_id, inspection_file_id, accident_inspection_id, road_id, section_id, question_id, question_code, question_name,
is_casualties, is_driving_safety, is_fire, record, longitude, latitude, uav_return, status, create_user, create_time, update_user, update_time,
check_user, check_time, check_result, mark from th_accident
check_user, check_time, check_result, verification_time, report_time, no_accident_time, ignore_time, end_time, flag, mark
from th_accident
</sql>

<select id="selectPageList" parameterType="com.tuoheng.admin.request.accident.QueryAccidentPageListRequest" resultMap="AccidentResult">
<select id="selectPageList" parameterType="com.tuoheng.admin.request.accident.QueryAccidentCardPageListRequest" resultMap="AccidentResult">
select <include refid="Base_Column_List"/>
from th_accident
<where>
@@ -73,4 +81,26 @@
order by create_time desc
</select>

<select id="selectAccidentCardList" parameterType="com.tuoheng.admin.request.accident.QueryAccidentCardListRequest" resultMap="AccidentResult">
select <include refid="Base_Column_List"/>
from th_accident
<where>
<if test="1 == 1"> and mark = 1 </if>
<if test="request.tenantId != null and request.tenantId != ''"> and tenant_id = #{request.tenantId} </if>
<if test="request.statusList != null and request.statusList.size() > 0">
and status in
<foreach item="status" collection="request.statusList" open="(" separator="," close=")">
#{status}
</foreach>
</if>
<if test="request.deptIdList != null and request.deptIdList.size() > 0">
and dept_id in
<foreach item="deptId" collection="request.deptIdList" open="(" separator="," close=")">
#{deptId}
</foreach>
</if>
</where>
order by create_time desc
</select>

</mapper>

Loading…
Cancel
Save