Просмотр исходного кода

修改事故卡片接口

tags/v1.2.0^2
wanjing 1 год назад
Родитель
Сommit
053546fce5
5 измененных файлов: 53 добавлений и 70 удалений
  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 Просмотреть файл

private IAccidentService accidentService; private IAccidentService accidentService;


/** /**
* 查询巡检任务分页列表
* 查询事故卡片分页列表
*/ */
@GetMapping("/page/list")
public JsonResult list(QueryAccidentPageListRequest request) {
@GetMapping("/card/page/list")
public JsonResult getAccidentCardPageList(QueryAccidentPageListRequest request) {
// log.info("进入查询事故分页列表接口"); // 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 Просмотреть файл

private AccidentIgnoreService accidentIgnoreService; private AccidentIgnoreService accidentIgnoreService;


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



+ 1
- 1
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/accident/IAccidentService.java Просмотреть файл

* @param request 事故分页查询实体 * @param request 事故分页查询实体
* @return 巡检任务集合 * @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 Просмотреть файл



import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.ObjectUtil; 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.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.tuoheng.admin.conver.AccidentConverMapper; import com.tuoheng.admin.conver.AccidentConverMapper;
import com.tuoheng.admin.entity.Accident; import com.tuoheng.admin.entity.Accident;
import com.tuoheng.admin.entity.Dept; 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.AccidentEnum;
import com.tuoheng.admin.enums.FlagEnum; import com.tuoheng.admin.enums.FlagEnum;
import com.tuoheng.admin.enums.MarkEnum; import com.tuoheng.admin.enums.MarkEnum;
import com.tuoheng.admin.enums.RoleEnum;
import com.tuoheng.admin.mapper.AccidentMapper; import com.tuoheng.admin.mapper.AccidentMapper;
import com.tuoheng.admin.mapper.DeptMapper; import com.tuoheng.admin.mapper.DeptMapper;
import com.tuoheng.admin.mapper.UserMapper;
import com.tuoheng.admin.query.AccidentQuery; import com.tuoheng.admin.query.AccidentQuery;
import com.tuoheng.admin.request.accident.QueryAccidentPageListRequest; import com.tuoheng.admin.request.accident.QueryAccidentPageListRequest;
import com.tuoheng.admin.utils.CurrentUserUtil; import com.tuoheng.admin.utils.CurrentUserUtil;
import java.util.stream.Collectors; import java.util.stream.Collectors;


/** /**
* 查询事分页列表业务层处理
* 查询事故卡片分页列表业务层处理
* *
* @author wanjing * @author wanjing
* @team tuoheng * @team tuoheng


@Autowired @Autowired
private DeptMapper deptMapper; private DeptMapper deptMapper;

@Autowired
private UserMapper userMapper;

@Autowired @Autowired
private AccidentMapper accidentMapper; private AccidentMapper accidentMapper;


// log.info("进入查询事件分页列表业务"); // log.info("进入查询事件分页列表业务");
String tenantId = CurrentUserUtil.getTenantId(); String tenantId = CurrentUserUtil.getTenantId();
request.setTenantId(tenantId); request.setTenantId(tenantId);

JsonResult result = this.check(tenantId, request); JsonResult result = this.check(tenantId, request);
if (0 != result.getCode()) { if (0 != result.getCode()) {
log.info("进入查询巡检任务分页列表业务:校验失败:{}", result.getMsg());
log.info("进入查询事故卡片分页列表业务:校验失败:{}", result.getMsg());
return result; 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> page = new Page<>(request.getPage(), request.getLimit());
IPage<Accident> pageData = accidentMapper.selectPageList(page, request); IPage<Accident> pageData = accidentMapper.selectPageList(page, request);
* @return * @return
*/ */
private List<AccidentVo> buildAccidentVoList(List<Accident> accidentList) { 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); List<AccidentVo> accidentVoList = AccidentConverMapper.INSTANCE.accidentListToAccidentVoList(accidentList);
String deptName; String deptName;
User user;
for (AccidentVo accidentVo : accidentVoList) { 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); 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; return accidentVoList;
} }
* @return * @return
*/ */
private Map<String, String> getDeptMap(List<Accident> accidentList) { 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<String> deptIdList = accidentList.stream().map(o -> o.getDeptId()).collect(Collectors.toList());
List<Dept> deptList = deptMapper.selectListByIdList(deptIdList); 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) { public JsonResult index(AccidentQuery query) {

+ 11
- 45
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/vo/accident/AccidentVo.java Просмотреть файл

*/ */
private String deptName; private String deptName;


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

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


/** /**
* 巡检任务id * 巡检任务id
private String roadId; private String roadId;


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


/** /**
* 路段ID * 路段ID
*/ */
private String questionName; private String questionName;


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

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

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

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

/** /**
* 经度 * 经度
*/ */
*/ */
private String latitude; private String latitude;


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

/** /**
* 事故状态:1未处理 2处理中 3已忽略 4已处理 * 事故状态:1未处理 2处理中 3已忽略 4已处理
*/ */
private Integer status; 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;


} }

Загрузка…
Отмена
Сохранить