Browse Source

Merge branch 'develop' of http://192.168.11.14:51037/gitadmin/tuoheng_freeway into develop

tags/v1.2.0^2
wanjing 1 year ago
parent
commit
1be33a0de6
2 changed files with 33 additions and 8 deletions
  1. +28
    -8
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/accident/query/QueryAccidentCardListService.java
  2. +5
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/vo/accident/AccidentVo.java

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

@@ -3,17 +3,13 @@ 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.toolkit.ObjectUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
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.entity.*;
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.mapper.*;
import com.tuoheng.admin.request.accident.QueryAccidentCardListRequest;
import com.tuoheng.admin.utils.CurrentUserUtil;
import com.tuoheng.admin.vo.accident.AccidentVo;
@@ -51,6 +47,9 @@ public class QueryAccidentCardListService {
@Autowired
private AccidentMapper accidentMapper;

@Autowired
private InspectionMapper inspectionMapper;

public JsonResult getList(QueryAccidentCardListRequest request) {
// log.info("进入查询事件列表业务");
String tenantId = CurrentUserUtil.getTenantId();
@@ -88,10 +87,12 @@ public class QueryAccidentCardListService {
Map<String, String> deptNameMap = this.getDeptMap(accidentList);
Map<String, User> userMap = this.getUserMap(deptNameMap);
Map<String, InspectionFile> inspectionFileMap = this.getInspectionFileMap(accidentList);
Map<String, Inspection> inspectionMap = this.getInspectionMap(accidentList);
List<AccidentVo> accidentVoList = AccidentConverMapper.INSTANCE.accidentListToAccidentVoList(accidentList);
String deptName;
User user;
InspectionFile inspectionFile;
Inspection inspection;
for (AccidentVo accidentVo : accidentVoList) {
if (ObjectUtil.isNotNull(deptNameMap)) {
deptName = deptNameMap.get(accidentVo.getDeptId());
@@ -113,10 +114,29 @@ public class QueryAccidentCardListService {
accidentVo.setFileThumbnail(CommonConfig.imageURL + inspectionFile.getFileThumbnail());
}
}
if(ObjectUtil.isNotNull(inspectionMap)){
inspection = inspectionMap.get(accidentVo.getInspectionId());
if(ObjectUtil.isNotNull(inspection)){
accidentVo.setInspectionStatus(inspection.getStatus());
}
}
}
return accidentVoList;
}

private Map<String, Inspection> getInspectionMap(List<Accident> accidentList) {
if (CollectionUtil.isEmpty(accidentList)) {
return null;
}
List<String> inspectionIdList = accidentList.stream().map(o -> o.getInspectionId()).collect(Collectors.toList());
List<Inspection> inspectionList = inspectionMapper.selectList(Wrappers.<Inspection>lambdaQuery()
.eq(Inspection::getMark, MarkEnum.VALID.getCode())
.in(Inspection::getId, inspectionIdList));
Map<String, Inspection> inspectionMap = inspectionList.stream().collect(HashMap::new, (m, v) -> m.put(v.getId(), v), HashMap::putAll);

return inspectionMap;
}

/**
* 设置列表中每一个的部门名称
* 查询到的列表中的部门Id,作为部门id列表,查询所有的部门,该结果数据量不会太大,放到map中

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

@@ -131,4 +131,9 @@ public class AccidentVo extends BaseEntity {
*/
private Integer status;

/**
* 巡检任务状态 5任务待飞行 7飞行失败 10任务飞行中 15任务飞行完成
*/
private Integer inspectionStatus;

}

Loading…
Cancel
Save