Browse Source

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

tags/v1.2.0^2
chengwang 1 year ago
parent
commit
f33e0c4631
5 changed files with 53 additions and 70 deletions
  1. +4
    -4
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/controller/AccidentController.java
  2. +1
    -1
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/accident/AccidentServiceImpl.java
  3. +1
    -1
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/accident/IAccidentService.java
  4. +36
    -19
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/accident/query/QueryAccidentPageListService.java
  5. +11
    -45
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/vo/accident/AccidentVo.java

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

@@ -21,12 +21,12 @@ public class AccidentController {
private IAccidentService accidentService;

/**
* 查询巡检任务分页列表
* 查询事故卡片分页列表
*/
@GetMapping("/page/list")
public JsonResult list(QueryAccidentPageListRequest request) {
@GetMapping("/card/page/list")
public JsonResult getAccidentCardPageList(QueryAccidentPageListRequest request) {
// log.info("进入查询事故分页列表接口");
return accidentService.getPageList(request);
return accidentService.getAccidentCardPageList(request);
}

/**

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

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

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


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

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

/**
* 查询事故信息

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

@@ -2,17 +2,22 @@ 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;
@@ -35,7 +40,7 @@ import java.util.Map;
import java.util.stream.Collectors;

/**
* 查询事分页列表业务层处理
* 查询事故卡片分页列表业务层处理
*
* @author wanjing
* @team tuoheng
@@ -47,6 +52,10 @@ public class QueryAccidentPageListService {

@Autowired
private DeptMapper deptMapper;

@Autowired
private UserMapper userMapper;

@Autowired
private AccidentMapper accidentMapper;

@@ -54,22 +63,12 @@ public class QueryAccidentPageListService {
// log.info("进入查询事件分页列表业务");
String tenantId = CurrentUserUtil.getTenantId();
request.setTenantId(tenantId);

JsonResult result = this.check(tenantId, request);
if (0 != result.getCode()) {
log.info("进入查询巡检任务分页列表业务:校验失败:{}", result.getMsg());
log.info("进入查询事故卡片分页列表业务:校验失败:{}", result.getMsg());
return result;
}

List<String> deptIdList = null;
List<Dept> deptList = deptMapper.selectList(Wrappers.<Dept>lambdaQuery()
.like(Dept::getName, request.getDeptName())
.eq(Dept::getMark, 1));
if (CollectionUtil.isNotEmpty(deptList)) {
deptIdList = deptList.stream().map(o -> o.getId()).collect(Collectors.toList());
}
request.setDeptIdList(deptIdList);

// 设置分页参数
IPage<Accident> page = new Page<>(request.getPage(), request.getLimit());
IPage<Accident> pageData = accidentMapper.selectPageList(page, request);
@@ -103,14 +102,23 @@ public class QueryAccidentPageListService {
* @return
*/
private List<AccidentVo> buildAccidentVoList(List<Accident> accidentList) {
Map<String, String> deptMap = this.getDeptMap(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(deptMap)) {
deptName = deptMap.get(accidentVo.getDeptId());
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;
}
@@ -123,13 +131,22 @@ public class QueryAccidentPageListService {
* @return
*/
private Map<String, String> getDeptMap(List<Accident> accidentList) {
Map<String, String> map = new HashMap<>();
List<String> deptIdList = accidentList.stream().map(o -> o.getDeptId()).collect(Collectors.toList());
List<Dept> deptList = deptMapper.selectListByIdList(deptIdList);
for (Dept dept : deptList) {
map.put(dept.getId(), dept.getName());
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;
}
return map;
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) {

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

@@ -30,6 +30,15 @@ public class AccidentVo extends BaseEntity {
*/
private String deptName;

/**
* 部门负责人
*/
private String departmentHead;

/**
* 部门负责人联系方式
*/
private String departmentHeadTelephone;

/**
* 巡检任务id
@@ -52,9 +61,9 @@ public class AccidentVo extends BaseEntity {
private String roadId;

/**
* 公路名称
* 公路编码
*/
private String roadName;
private String roadCode;

/**
* 路段ID
@@ -81,26 +90,6 @@ public class AccidentVo extends BaseEntity {
*/
private String questionName;

/**
* 是否有伤亡:0:无;1:有
*/
private Integer isCasualties;

/**
* 是否影响驾驶安全:0:无;1:有
*/
private Integer isDrivingSafety;

/**
* 是否有明火:0:无;1:有
*/
private Integer isFire;

/**
* 事故现场描述
*/
private String record;

/**
* 经度
*/
@@ -111,32 +100,9 @@ public class AccidentVo extends BaseEntity {
*/
private String latitude;

/**
* 无人机回仓:0未回仓;1:已回仓
*/
private Integer uavReturn;

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

/**
*处理人
*/
private String checkUser;

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

/**
* 处理结果
*/
private String checkResult;


}

Loading…
Cancel
Save