Browse Source

修改核实完成代码

tags/v1.2.0^2
wanjing 1 year ago
parent
commit
1b372ac4c6
1 changed files with 5 additions and 8 deletions
  1. +5
    -8
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/accident/verify/AccidentVerifyCompletedService.java

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

User user = CurrentUserUtil.getUserInfo(); User user = CurrentUserUtil.getUserInfo();
String userId = user.getId(); String userId = user.getId();
String tenantId = user.getTenantId(); String tenantId = user.getTenantId();

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());
} }
Accident accident = (Accident) result.getData(); Accident accident = (Accident) result.getData();


this.updateAccident(accident.getId(), userId);

// 无人机回仓 // 无人机回仓
this.droneReturn(accident.getInspectionId()); this.droneReturn(accident.getInspectionId());


this.updateAccident(accident.getId(), userId);

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


if (ObjectUtil.isNull(accident)) { if (ObjectUtil.isNull(accident)) {
throw new ServiceException("事故不存在"); throw new ServiceException("事故不存在");
} }
if (AccidentStatusEnum.UNTREATED.getCode() == accident.getStatus()) {
throw new ServiceException("该事故已处理,不能在核实");
if (AccidentStatusEnum.PROCESSED.getCode() == accident.getStatus()) {
throw new ServiceException("该事故未处理,不能核实完成");
} }
return JsonResult.success(accident); return JsonResult.success(accident);
} }
jsonObject.put("taskId", inspection.getId()); jsonObject.put("taskId", inspection.getId());
jsonObject.put("airportId", inspection.getAirportId()); jsonObject.put("airportId", inspection.getAirportId());
jsonObject.put("msg", "回仓"); jsonObject.put("msg", "回仓");

JsonResult jsonResult = droneControlService.execute(jsonObject); JsonResult jsonResult = droneControlService.execute(jsonObject);
if (0 != jsonResult.getCode()) { if (0 != jsonResult.getCode()) {
throw new ServiceException("机场平台返回,返回无人机回仓失败");
log.info("事故核实完成,调用机场平台,返回无人机回仓失败");
} }
} }


private void updateAccident(String id, String userId) { private void updateAccident(String id, String userId) {
Accident accidentUpdate = new Accident(); Accident accidentUpdate = new Accident();
accidentUpdate.setId(id); accidentUpdate.setId(id);
accidentUpdate.setStatus(AccidentStatusEnum.PROCESSED.getCode());
accidentUpdate.setUpdateUser(userId); accidentUpdate.setUpdateUser(userId);
accidentUpdate.setUpdateTime(DateUtils.now()); accidentUpdate.setUpdateTime(DateUtils.now());
accidentUpdate.setEndTime(DateUtils.now()); accidentUpdate.setEndTime(DateUtils.now());

Loading…
Cancel
Save