* 被硬件调用,存飞行轨迹 | * 被硬件调用,存飞行轨迹 | ||||
*/ | */ | ||||
@PostMapping("/track") | @PostMapping("/track") | ||||
public OperationEnum track(@RequestBody @Valid InspectionRequest inspectionRequest) { | |||||
public JsonResult track(@RequestBody @Valid InspectionRequest inspectionRequest) { | |||||
log.info("被硬件调用,存飞行轨迹:{}", JSONObject.toJSONString(inspectionRequest)); | log.info("被硬件调用,存飞行轨迹:{}", JSONObject.toJSONString(inspectionRequest)); | ||||
return iInspectionService.track(inspectionRequest); | return iInspectionService.track(inspectionRequest); | ||||
} | } |
ADD_IS_FAILED(1100100, "添加失败"), | ADD_IS_FAILED(1100100, "添加失败"), | ||||
CODE_IS_NULL(1100101, "编号不能为空"), | CODE_IS_NULL(1100101, "编号不能为空"), | ||||
USERNAME_IS_NULL(1100102, "账号不能为空"), | |||||
REALNAME_IS_NULL(1100103, "姓名不能为空"), | |||||
USERNAME_IS_NULL(1100102, "员工账号不能为空"), | |||||
REALNAME_IS_NULL(1100103, "员工姓名不能为空"), | |||||
ROLE_ID_IS_NULL(1100104, "角色不能为空"), | ROLE_ID_IS_NULL(1100104, "角色不能为空"), | ||||
DEPT_ID_IS_NULL(1100105, "部门不能为空"), | DEPT_ID_IS_NULL(1100105, "部门不能为空"), | ||||
CLIENT_ID_IS_NULL(1100106, "ClientID不能为空"), | CLIENT_ID_IS_NULL(1100106, "ClientID不能为空"), | ||||
TYPE_ID_IS_NULL(1100107, "用户类型不能为空"), | TYPE_ID_IS_NULL(1100107, "用户类型不能为空"), | ||||
TYPE_ID_IS_NOT_EXISTS(1100108, "用户类型不存在"), | TYPE_ID_IS_NOT_EXISTS(1100108, "用户类型不存在"), | ||||
PHONE_NOT_IMATCH(1100109, "手机号不匹配"), | PHONE_NOT_IMATCH(1100109, "手机号不匹配"), | ||||
USERNAME_ALREADY_EXISTS(1100110, "系统中已经存在该用户名"), | |||||
USERNAME_ALREADY_EXISTS(1100110, "系统中已经存在该账号"), | |||||
ROLE_IS_NOT_EXISTS(1100111, "该角色不存在"); | ROLE_IS_NOT_EXISTS(1100111, "该角色不存在"); | ||||
/** | /** |
import org.springframework.stereotype.Service; | import org.springframework.stereotype.Service; | ||||
import org.springframework.util.CollectionUtils; | import org.springframework.util.CollectionUtils; | ||||
import java.util.ArrayList; | |||||
import java.util.HashMap; | |||||
import java.util.List; | |||||
import java.util.Map; | |||||
import java.util.*; | |||||
import java.util.stream.Collectors; | import java.util.stream.Collectors; | ||||
/** | /** | ||||
} | } | ||||
// 添加部门和公路数据 | // 添加部门和公路数据 | ||||
// 去重,防止前端提交了重复的数据 | |||||
roadInformationList = roadInformationList.stream().collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(RoadInformation::getId))), ArrayList::new)); | |||||
this.addRoadToDept(tenantId, deptId, roadInformationList); | this.addRoadToDept(tenantId, deptId, roadInformationList); | ||||
// 添加部门和路段数据 | |||||
// 去重,防止前端提交了重复的数据 | |||||
sectionList = sectionList.stream().collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(Section::getId))), ArrayList::new)); | |||||
this.addSectionToDept(tenantId, deptId, sectionList); | this.addSectionToDept(tenantId, deptId, sectionList); | ||||
} | } | ||||
// 差集:新增公路 | // 差集:新增公路 | ||||
Collection<String> addRoadIdList = org.apache.commons.collections4.CollectionUtils.subtract(newRoadIdList, oldRoadIdList); | Collection<String> addRoadIdList = org.apache.commons.collections4.CollectionUtils.subtract(newRoadIdList, oldRoadIdList); | ||||
if (!CollectionUtils.isEmpty(addRoadIdList)) { | if (!CollectionUtils.isEmpty(addRoadIdList)) { | ||||
// 去重,防止前端提交了重复的数据 | |||||
addRoadIdList= addRoadIdList.stream().distinct().collect(Collectors.toList()); | |||||
this.addRoadToDept(tenantId, newEditDeptRequest.getId(), addRoadIdList); | this.addRoadToDept(tenantId, newEditDeptRequest.getId(), addRoadIdList); | ||||
} | } | ||||
Collection<String> addSectionIdList = org.apache.commons.collections4.CollectionUtils.subtract(newSectionIdList, oldSectionIdList); | Collection<String> addSectionIdList = org.apache.commons.collections4.CollectionUtils.subtract(newSectionIdList, oldSectionIdList); | ||||
if (!CollectionUtils.isEmpty(addSectionIdList)) { | if (!CollectionUtils.isEmpty(addSectionIdList)) { | ||||
// 去重,防止前端提交了重复的数据 | |||||
addSectionIdList= addSectionIdList.stream().distinct().collect(Collectors.toList()); | |||||
// 添加路段和部门数据 | // 添加路段和部门数据 | ||||
this.addSectionToDept(tenantId, newEditDeptRequest.getId(), addSectionIdList); | this.addSectionToDept(tenantId, newEditDeptRequest.getId(), addSectionIdList); | ||||
} | } |
import com.tuoheng.common.core.common.OperationEnum; | import com.tuoheng.common.core.common.OperationEnum; | ||||
import com.tuoheng.common.core.enums.ServiceExceptionEnum; | import com.tuoheng.common.core.enums.ServiceExceptionEnum; | ||||
import com.tuoheng.common.core.exception.ServiceException; | import com.tuoheng.common.core.exception.ServiceException; | ||||
import com.tuoheng.common.core.utils.JsonResult; | |||||
import com.tuoheng.common.core.utils.RedisUtils; | import com.tuoheng.common.core.utils.RedisUtils; | ||||
import lombok.extern.slf4j.Slf4j; | import lombok.extern.slf4j.Slf4j; | ||||
import org.springframework.beans.BeanUtils; | import org.springframework.beans.BeanUtils; | ||||
@Autowired | @Autowired | ||||
private InspectionMapper inspectionMapper; | private InspectionMapper inspectionMapper; | ||||
public OperationEnum track(InspectionRequest inspectionRequest) { | |||||
public JsonResult track(InspectionRequest inspectionRequest) { | |||||
Inspection inspection = inspectionMapper.selectById(inspectionRequest.getRequestId()); | Inspection inspection = inspectionMapper.selectById(inspectionRequest.getRequestId()); | ||||
if (ObjectUtil.isEmpty(inspection)) { | if (ObjectUtil.isEmpty(inspection)) { | ||||
throw new ServiceException(ServiceExceptionEnum.TASK_DOES_NOT_EXIST); | throw new ServiceException(ServiceExceptionEnum.TASK_DOES_NOT_EXIST); | ||||
} | } | ||||
FlightData flightData = new FlightData(); | FlightData flightData = new FlightData(); | ||||
BeanUtils.copyProperties(inspectionRequest, flightData); | BeanUtils.copyProperties(inspectionRequest, flightData); | ||||
flightData.setTenantId(inspection.getTenantId()); | flightData.setTenantId(inspection.getTenantId()); | ||||
//将最新一条数据放入缓存,并设置过期时间 | //将最新一条数据放入缓存,并设置过期时间 | ||||
redisUtils.set(String.valueOf(inspection.getId()), flightData, 10); | redisUtils.set(String.valueOf(inspection.getId()), flightData, 10); | ||||
flightDataMapper.insert(flightData); | flightDataMapper.insert(flightData); | ||||
return OperationEnum.OPERATION_SUCCESS; | |||||
return JsonResult.success(OperationEnum.OPERATION_SUCCESS.getMessage()); | |||||
} | } | ||||
} | } |
* @param inspectionRequest | * @param inspectionRequest | ||||
* @return | * @return | ||||
*/ | */ | ||||
OperationEnum track(InspectionRequest inspectionRequest); | |||||
JsonResult track(InspectionRequest inspectionRequest); | |||||
/** | /** | ||||
* 上传离线视频 | * 上传离线视频 |
* @return | * @return | ||||
*/ | */ | ||||
@Override | @Override | ||||
public OperationEnum track(InspectionRequest inspectionRequest) { | |||||
public JsonResult track(InspectionRequest inspectionRequest) { | |||||
return queryFlightDataTrackService.track(inspectionRequest); | return queryFlightDataTrackService.track(inspectionRequest); | ||||
} | } | ||||
@Override | @Override | ||||
public void handler(User user, Dept dept, InspectionVo inspectionVo) { | public void handler(User user, Dept dept, InspectionVo inspectionVo) { | ||||
// log.info("处理问题数字段"); | // log.info("处理问题数字段"); | ||||
if (InspectionStatusEnum.WAIT_FLIGHT.getCode() == inspectionVo.getStatus()) { | |||||
inspectionVo.setExecute(true); | |||||
} | |||||
List<InspectionFile> inspectionFileList = inspectionFileMapper.selectList(new LambdaQueryWrapper<InspectionFile>() | List<InspectionFile> inspectionFileList = inspectionFileMapper.selectList(new LambdaQueryWrapper<InspectionFile>() | ||||
.eq(InspectionFile::getInspectionId, inspectionVo.getId()) | .eq(InspectionFile::getInspectionId, inspectionVo.getId()) | ||||
.eq(InspectionFile::getMark, 1)); | .eq(InspectionFile::getMark, 1)); |
@Override | @Override | ||||
public void handler(User user, Dept dept, InspectionVo inspectionVo) { | public void handler(User user, Dept dept, InspectionVo inspectionVo) { | ||||
// log.info("处理问题详情字段"); | // log.info("处理问题详情字段"); | ||||
if (InspectionStatusEnum.WAIT_FLIGHT.getCode() == inspectionVo.getStatus()) { | |||||
inspectionVo.setExecute(true); | |||||
} | |||||
if (!user.getDeptId().equals(inspectionVo.getDeptId())) { | if (!user.getDeptId().equals(inspectionVo.getDeptId())) { | ||||
inspectionVo.setProblemVerify(true); | inspectionVo.setProblemVerify(true); | ||||
} | } |
@Override | @Override | ||||
public void handler(User user, Dept dept, InspectionVo inspectionVo) { | public void handler(User user, Dept dept, InspectionVo inspectionVo) { | ||||
// log.info("处理问题核实字段"); | // log.info("处理问题核实字段"); | ||||
if (InspectionStatusEnum.WAIT_FLIGHT.getCode() == inspectionVo.getStatus()) { | |||||
inspectionVo.setExecute(true); | |||||
} | |||||
if (user.getDeptId().equals(inspectionVo.getDeptId())) { | if (user.getDeptId().equals(inspectionVo.getDeptId())) { | ||||
inspectionVo.setProblemVerify(true); | inspectionVo.setProblemVerify(true); | ||||
} | } |