@@ -50,7 +50,7 @@ public class AirPortCallbackController { | |||
* 被硬件调用,存飞行轨迹 | |||
*/ | |||
@PostMapping("/track") | |||
public OperationEnum track(@RequestBody @Valid InspectionRequest inspectionRequest) { | |||
public JsonResult track(@RequestBody @Valid InspectionRequest inspectionRequest) { | |||
log.info("被硬件调用,存飞行轨迹:{}", JSONObject.toJSONString(inspectionRequest)); | |||
return iInspectionService.track(inspectionRequest); | |||
} |
@@ -13,15 +13,15 @@ public enum AddUserCodeEnum { | |||
ADD_IS_FAILED(1100100, "添加失败"), | |||
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, "角色不能为空"), | |||
DEPT_ID_IS_NULL(1100105, "部门不能为空"), | |||
CLIENT_ID_IS_NULL(1100106, "ClientID不能为空"), | |||
TYPE_ID_IS_NULL(1100107, "用户类型不能为空"), | |||
TYPE_ID_IS_NOT_EXISTS(1100108, "用户类型不存在"), | |||
PHONE_NOT_IMATCH(1100109, "手机号不匹配"), | |||
USERNAME_ALREADY_EXISTS(1100110, "系统中已经存在该用户名"), | |||
USERNAME_ALREADY_EXISTS(1100110, "系统中已经存在该账号"), | |||
ROLE_IS_NOT_EXISTS(1100111, "该角色不存在"); | |||
/** |
@@ -19,10 +19,7 @@ import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.stereotype.Service; | |||
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; | |||
/** | |||
@@ -172,8 +169,13 @@ public class AddDeptService { | |||
} | |||
// 添加部门和公路数据 | |||
// 去重,防止前端提交了重复的数据 | |||
roadInformationList = roadInformationList.stream().collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(RoadInformation::getId))), ArrayList::new)); | |||
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); | |||
} | |||
@@ -201,6 +201,8 @@ public class UpdateDeptService { | |||
// 差集:新增公路 | |||
Collection<String> addRoadIdList = org.apache.commons.collections4.CollectionUtils.subtract(newRoadIdList, oldRoadIdList); | |||
if (!CollectionUtils.isEmpty(addRoadIdList)) { | |||
// 去重,防止前端提交了重复的数据 | |||
addRoadIdList= addRoadIdList.stream().distinct().collect(Collectors.toList()); | |||
this.addRoadToDept(tenantId, newEditDeptRequest.getId(), addRoadIdList); | |||
} | |||
@@ -301,6 +303,8 @@ public class UpdateDeptService { | |||
Collection<String> addSectionIdList = org.apache.commons.collections4.CollectionUtils.subtract(newSectionIdList, oldSectionIdList); | |||
if (!CollectionUtils.isEmpty(addSectionIdList)) { | |||
// 去重,防止前端提交了重复的数据 | |||
addSectionIdList= addSectionIdList.stream().distinct().collect(Collectors.toList()); | |||
// 添加路段和部门数据 | |||
this.addSectionToDept(tenantId, newEditDeptRequest.getId(), addSectionIdList); | |||
} |
@@ -9,6 +9,7 @@ import com.tuoheng.admin.request.inspection.InspectionRequest; | |||
import com.tuoheng.common.core.common.OperationEnum; | |||
import com.tuoheng.common.core.enums.ServiceExceptionEnum; | |||
import com.tuoheng.common.core.exception.ServiceException; | |||
import com.tuoheng.common.core.utils.JsonResult; | |||
import com.tuoheng.common.core.utils.RedisUtils; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.springframework.beans.BeanUtils; | |||
@@ -32,12 +33,11 @@ public class QueryFlightDataTrackService { | |||
@Autowired | |||
private InspectionMapper inspectionMapper; | |||
public OperationEnum track(InspectionRequest inspectionRequest) { | |||
public JsonResult track(InspectionRequest inspectionRequest) { | |||
Inspection inspection = inspectionMapper.selectById(inspectionRequest.getRequestId()); | |||
if (ObjectUtil.isEmpty(inspection)) { | |||
throw new ServiceException(ServiceExceptionEnum.TASK_DOES_NOT_EXIST); | |||
} | |||
FlightData flightData = new FlightData(); | |||
BeanUtils.copyProperties(inspectionRequest, flightData); | |||
flightData.setTenantId(inspection.getTenantId()); | |||
@@ -49,6 +49,6 @@ public class QueryFlightDataTrackService { | |||
//将最新一条数据放入缓存,并设置过期时间 | |||
redisUtils.set(String.valueOf(inspection.getId()), flightData, 10); | |||
flightDataMapper.insert(flightData); | |||
return OperationEnum.OPERATION_SUCCESS; | |||
return JsonResult.success(OperationEnum.OPERATION_SUCCESS.getMessage()); | |||
} | |||
} |
@@ -128,7 +128,7 @@ public interface IInspectionService { | |||
* @param inspectionRequest | |||
* @return | |||
*/ | |||
OperationEnum track(InspectionRequest inspectionRequest); | |||
JsonResult track(InspectionRequest inspectionRequest); | |||
/** | |||
* 上传离线视频 |
@@ -263,7 +263,7 @@ public class InspectionServiceImpl implements IInspectionService { | |||
* @return | |||
*/ | |||
@Override | |||
public OperationEnum track(InspectionRequest inspectionRequest) { | |||
public JsonResult track(InspectionRequest inspectionRequest) { | |||
return queryFlightDataTrackService.track(inspectionRequest); | |||
} | |||
@@ -32,10 +32,6 @@ public class ProblemCountHandle implements GenerateInspectionFieldHander { | |||
@Override | |||
public void handler(User user, Dept dept, InspectionVo inspectionVo) { | |||
// log.info("处理问题数字段"); | |||
if (InspectionStatusEnum.WAIT_FLIGHT.getCode() == inspectionVo.getStatus()) { | |||
inspectionVo.setExecute(true); | |||
} | |||
List<InspectionFile> inspectionFileList = inspectionFileMapper.selectList(new LambdaQueryWrapper<InspectionFile>() | |||
.eq(InspectionFile::getInspectionId, inspectionVo.getId()) | |||
.eq(InspectionFile::getMark, 1)); |
@@ -21,9 +21,6 @@ public class ProblemDetailsHandle implements GenerateInspectionFieldHander { | |||
@Override | |||
public void handler(User user, Dept dept, InspectionVo inspectionVo) { | |||
// log.info("处理问题详情字段"); | |||
if (InspectionStatusEnum.WAIT_FLIGHT.getCode() == inspectionVo.getStatus()) { | |||
inspectionVo.setExecute(true); | |||
} | |||
if (!user.getDeptId().equals(inspectionVo.getDeptId())) { | |||
inspectionVo.setProblemVerify(true); | |||
} |
@@ -21,9 +21,6 @@ public class ProblemVerifyHandle implements GenerateInspectionFieldHander { | |||
@Override | |||
public void handler(User user, Dept dept, InspectionVo inspectionVo) { | |||
// log.info("处理问题核实字段"); | |||
if (InspectionStatusEnum.WAIT_FLIGHT.getCode() == inspectionVo.getStatus()) { | |||
inspectionVo.setExecute(true); | |||
} | |||
if (user.getDeptId().equals(inspectionVo.getDeptId())) { | |||
inspectionVo.setProblemVerify(true); | |||
} |