@@ -9,13 +9,13 @@ import lombok.Getter; | |||
* @team tuoheng | |||
* @date 2022-11-23 | |||
*/ | |||
public enum InspectionWayEnum { | |||
public enum InspectionTypeEnum { | |||
DRONE(1,"无人机"), | |||
AIRPORT(2,"机场巡逻"), | |||
MABNNEDFLIGHT(3,"飞手值飞"); | |||
InspectionWayEnum(int code, String description){ | |||
InspectionTypeEnum(int code, String description){ | |||
this.code = code; | |||
this.description = description; | |||
} |
@@ -14,9 +14,9 @@ public enum DeleteInspectionCodeEnum { | |||
DELETE_IS_FAILED(1230200, "删除任务失败"), | |||
ID_IS_NULL(1230201, "任务ID为空"), | |||
INSPECTION_IS_NOT_EXIST(1230202, "任务不存在"), | |||
IN_FLIGHT_NOT_DELETE(1230203, "飞行中时无法删除"), | |||
IN_FLIGHT_NOT_DELETE(1230203, "飞行中无法删除"), | |||
ADMIN_NOT_DELETE_CHILD_INSPECTION(1230204, "管理员不能删除子部门任务"), | |||
ORDINARY_USER_NO_PERMISSION_TO_DELETE(1230205, "普通用户无权限删除任务"); | |||
ORDINARY_USER_NO_PERMISSION_TO_DELETE(1230205, "普通用户无删除任务权限"); | |||
/** | |||
* 错误码 |
@@ -26,7 +26,7 @@ public class QueryInspectionPageListRequest extends BaseQuery { | |||
/** | |||
* 关键字,匹配任务编号和任务名称 | |||
*/ | |||
private String key; | |||
// private String key; | |||
/** | |||
* 任务编号 |
@@ -5,11 +5,10 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||
import com.tuoheng.admin.conver.InspectionConverMapper; | |||
import com.tuoheng.admin.entity.*; | |||
import com.tuoheng.admin.enums.InspectionStatusEnum; | |||
import com.tuoheng.admin.enums.InspectionWayEnum; | |||
import com.tuoheng.admin.enums.InspectionTypeEnum; | |||
import com.tuoheng.admin.enums.code.inspection.AddInspectionCodeEnum; | |||
import com.tuoheng.admin.mapper.*; | |||
import com.tuoheng.admin.request.inspection.AddInspectionRequest; | |||
import com.tuoheng.admin.utils.GaodeUtil; | |||
import com.tuoheng.admin.utils.ShiroUtils; | |||
import com.tuoheng.common.core.utils.DateUtils; | |||
import com.tuoheng.common.core.utils.JsonResult; | |||
@@ -17,7 +16,6 @@ import com.tuoheng.common.core.utils.StringUtils; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.stereotype.Service; | |||
import org.springframework.transaction.annotation.Transactional; | |||
/** | |||
* 添加任务业务层处理 | |||
@@ -103,7 +101,7 @@ public class AddInspectionService { | |||
return JsonResult.error(AddInspectionCodeEnum.INSPECTION_TYPE_IS_NULL.getCode(), AddInspectionCodeEnum.INSPECTION_TYPE_IS_NULL.getMsg()); | |||
} | |||
if (InspectionWayEnum.AIRPORT.getCode() == addInspectionRequest.getInspectionType()) { | |||
if (InspectionTypeEnum.AIRPORT.getCode() == addInspectionRequest.getInspectionType()) { | |||
// 巡检方式:机场巡逻,可选择巡检机场和巡检路线 | |||
if (null == addInspectionRequest.getRoadId() || StringUtils.isEmpty(addInspectionRequest.getRoadName())) { | |||
return JsonResult.error(AddInspectionCodeEnum.ROAD_IS_NULL.getCode(), AddInspectionCodeEnum.ROAD_IS_NULL.getMsg()); | |||
@@ -112,7 +110,7 @@ public class AddInspectionService { | |||
if (null == addInspectionRequest.getSectionId() || StringUtils.isEmpty(addInspectionRequest.getSectionName())) { | |||
return JsonResult.error(AddInspectionCodeEnum.SECTION_IS_NULL.getCode(), AddInspectionCodeEnum.SECTION_IS_NULL.getMsg()); | |||
} | |||
} else if (InspectionWayEnum.MABNNEDFLIGHT.getCode() == addInspectionRequest.getInspectionType()) { | |||
} else if (InspectionTypeEnum.MABNNEDFLIGHT.getCode() == addInspectionRequest.getInspectionType()) { | |||
// 巡检方式:飞手值飞,可选择是否直播,起点坐标,终点坐标 | |||
if (null == addInspectionRequest.getIsLive()) { | |||
return JsonResult.error(AddInspectionCodeEnum.LIVE_IS_NULL.getCode(), AddInspectionCodeEnum.LIVE_IS_NULL.getMsg()); |
@@ -1,10 +0,0 @@ | |||
package com.tuoheng.admin.service.inspection.delete; | |||
import com.tuoheng.admin.entity.Inspection; | |||
import com.tuoheng.common.core.utils.JsonResult; | |||
public interface DeleteInspectionStrategy { | |||
JsonResult delete(Inspection inspection); | |||
} |
@@ -2,21 +2,13 @@ package com.tuoheng.admin.service.inspection.query; | |||
import cn.hutool.core.collection.CollectionUtil; | |||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |||
import com.baomidou.mybatisplus.core.metadata.IPage; | |||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |||
import com.tuoheng.admin.conver.InspectionConverMapper; | |||
import com.tuoheng.admin.entity.Dept; | |||
import com.tuoheng.admin.entity.Inspection; | |||
import com.tuoheng.admin.entity.InspectionFile; | |||
import com.tuoheng.admin.enums.InspectionFileStatusEnum; | |||
import com.tuoheng.admin.enums.InspectionWayEnum; | |||
import com.tuoheng.admin.enums.code.inspection.QueryInspectionPageListCodeEnum; | |||
import com.tuoheng.admin.mapper.DeptMapper; | |||
import com.tuoheng.admin.mapper.InspectionFileMapper; | |||
import com.tuoheng.admin.mapper.InspectionMapper; | |||
import com.tuoheng.admin.request.inspection.QueryInspectionPageListRequest; | |||
import com.tuoheng.admin.utils.ShiroUtils; | |||
import com.tuoheng.admin.vo.InspectionVo; | |||
import com.tuoheng.common.core.utils.JsonResult; | |||
import com.tuoheng.common.core.utils.StringUtils; | |||
import lombok.extern.slf4j.Slf4j; | |||
@@ -44,14 +36,14 @@ public class QueryInspectionByIdService { | |||
private InspectionFileMapper inspectionFileMapper; | |||
public JsonResult getInfo(String id) { | |||
log.info("进入查询巡检任务分页列表业务"); | |||
log.info("进入查询巡检任务详情业务"); | |||
String userId = ShiroUtils.getUserId(); | |||
String tenantId = ShiroUtils.getTenantId(); | |||
JsonResult result = this.check(tenantId, id); | |||
if (0 != result.getCode()) { | |||
log.info("进入查询巡检任务分页列表业务:校验失败:{}", result.getMsg()); | |||
log.info("进入查询巡检任务详情业务:校验失败:{}", result.getMsg()); | |||
return result; | |||
} | |||
@@ -1,28 +1,30 @@ | |||
package com.tuoheng.admin.service.inspection.query; | |||
import cn.hutool.core.collection.CollectionUtil; | |||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |||
import com.baomidou.mybatisplus.core.metadata.IPage; | |||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |||
import com.tuoheng.admin.conver.InspectionConverMapper; | |||
import com.tuoheng.admin.entity.Dept; | |||
import com.tuoheng.admin.entity.Inspection; | |||
import com.tuoheng.admin.entity.InspectionFile; | |||
import com.tuoheng.admin.enums.InspectionFileStatusEnum; | |||
import com.tuoheng.admin.enums.InspectionWayEnum; | |||
import com.tuoheng.admin.enums.code.inspection.QueryInspectionPageListCodeEnum; | |||
import com.tuoheng.admin.entity.User; | |||
import com.tuoheng.admin.enums.InspectionTypeEnum; | |||
import com.tuoheng.admin.enums.UserTypeEnum; | |||
import com.tuoheng.admin.enums.code.inspection.AddInspectionCodeEnum; | |||
import com.tuoheng.admin.mapper.DeptMapper; | |||
import com.tuoheng.admin.mapper.InspectionFileMapper; | |||
import com.tuoheng.admin.mapper.InspectionMapper; | |||
import com.tuoheng.admin.mapper.UserMapper; | |||
import com.tuoheng.admin.request.inspection.QueryInspectionPageListRequest; | |||
import com.tuoheng.admin.service.inspection.query.handle.GenerateInspectionFieldHander; | |||
import com.tuoheng.admin.utils.ShiroUtils; | |||
import com.tuoheng.admin.vo.InspectionVo; | |||
import com.tuoheng.common.core.utils.JsonResult; | |||
import com.tuoheng.common.core.utils.StringUtils; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.beans.factory.annotation.Qualifier; | |||
import org.springframework.stereotype.Service; | |||
import javax.annotation.PostConstruct; | |||
import java.util.List; | |||
/** | |||
@@ -36,13 +38,55 @@ import java.util.List; | |||
@Service | |||
public class QueryInspectionPageListService { | |||
@Autowired | |||
private UserMapper userMapper; | |||
@Autowired | |||
private DeptMapper deptMapper; | |||
@Autowired | |||
private InspectionMapper inspectionMapper; | |||
@Autowired | |||
private InspectionFileMapper inspectionFileMapper; | |||
@Autowired | |||
@Qualifier("executeHandle") | |||
private GenerateInspectionFieldHander executeHandle; | |||
@Autowired | |||
@Qualifier("liveHandle") | |||
private GenerateInspectionFieldHander liveHandle; | |||
@Autowired | |||
@Qualifier("playBackHandle") | |||
private GenerateInspectionFieldHander playBackHandle; | |||
@Autowired | |||
@Qualifier("problemVerifyHandleHandle") | |||
private GenerateInspectionFieldHander problemVerifyHandleHandle; | |||
@Autowired | |||
@Qualifier("problemDetailsHandleHandle") | |||
private GenerateInspectionFieldHander problemDetailsHandleHandle; | |||
@Autowired | |||
@Qualifier("problemCountHandle") | |||
private GenerateInspectionFieldHander problemCountHandle; | |||
@Autowired | |||
@Qualifier("resubmitHandle") | |||
private GenerateInspectionFieldHander resubmitHandle; | |||
@PostConstruct | |||
public void start() { | |||
executeHandle.setNextHandler(liveHandle); | |||
liveHandle.setNextHandler(playBackHandle); | |||
playBackHandle.setNextHandler(problemVerifyHandleHandle); | |||
problemVerifyHandleHandle.setNextHandler(problemDetailsHandleHandle); | |||
problemDetailsHandleHandle.setNextHandler(problemCountHandle); | |||
problemCountHandle.setNextHandler(resubmitHandle); | |||
} | |||
public JsonResult getPageList(QueryInspectionPageListRequest queryInspectionRequest) { | |||
log.info("进入查询巡检任务分页列表业务"); | |||
@@ -55,11 +99,29 @@ public class QueryInspectionPageListService { | |||
return result; | |||
} | |||
if (InspectionWayEnum.MABNNEDFLIGHT.getCode() == queryInspectionRequest.getInspectionType()) { | |||
queryInspectionRequest.setAirportId(0); | |||
queryInspectionRequest.setInspectionLine(0); | |||
User user = userMapper.selectOne(new LambdaQueryWrapper<User>() | |||
.eq(User::getTenantId, tenantId) | |||
.eq(User::getId, userId) | |||
.eq(User::getMark, 1)); | |||
Dept dept = deptMapper.selectOne(new LambdaQueryWrapper<Dept>() | |||
.eq(Dept::getTenantId, tenantId) | |||
.eq(Dept::getId, user.getDeptId()) | |||
.eq(Dept::getMark, 1)); | |||
if (UserTypeEnum.SUPER_ADMIN.getCode() == user.getType()) { | |||
} else if (UserTypeEnum.ADMIN.getCode() == user.getType()) { | |||
} else if (UserTypeEnum.ORDINARY_USER.getCode() == user.getType()) { | |||
} | |||
// if (InspectionTypeEnum.MABNNEDFLIGHT.getCode() == queryInspectionRequest.getInspectionType()) { | |||
// queryInspectionRequest.setAirportId(0); | |||
// queryInspectionRequest.setInspectionLine(0); | |||
// } | |||
// 获取本部门及子孙部门id列表 | |||
List<String> deptIdList = deptMapper.selectAllChildListById(queryInspectionRequest.getDeptId()); | |||
@@ -71,29 +133,10 @@ public class QueryInspectionPageListService { | |||
List<Inspection> inspectionList = pageData.getRecords(); | |||
List<InspectionVo> inspectionVoList = InspectionConverMapper.INSTANCE.fromInspectionListToInspectionVoList(inspectionList); | |||
List<InspectionVo> inspectionVoList = buildIspectionVoList(user, dept, inspectionList); | |||
List<InspectionFile> inspectionFileList; | |||
Integer confirmedProblemCount = 0; | |||
Integer discoverProblemCount = 0; | |||
for (InspectionVo inspectionVo : inspectionVoList) { | |||
inspectionFileList = inspectionFileMapper.selectList(new LambdaQueryWrapper<InspectionFile>() | |||
.eq(InspectionFile::getTenantId, tenantId) | |||
.eq(InspectionFile::getInspectionId, inspectionVo.getId()) | |||
.eq(InspectionFile::getMark, 1)); | |||
if (CollectionUtil.isEmpty(inspectionFileList)) { | |||
discoverProblemCount = inspectionFileList.size(); | |||
for (InspectionFile inspectionFile : inspectionFileList) { | |||
if (InspectionFileStatusEnum.CONFIRMED.getCode() == inspectionFile.getStatus()) { | |||
confirmedProblemCount++; | |||
} | |||
} | |||
} | |||
inspectionVo.setConfirmedProblemCount(confirmedProblemCount); | |||
inspectionVo.setDiscoverProblemCount(discoverProblemCount); | |||
} | |||
return JsonResult.success(); | |||
return JsonResult.success(inspectionVoList); | |||
} | |||
/** | |||
@@ -104,19 +147,27 @@ public class QueryInspectionPageListService { | |||
*/ | |||
private JsonResult check(String tenantId, QueryInspectionPageListRequest queryInspectionRequest) { | |||
// 判断部门id是否为空 | |||
if (StringUtils.isEmpty(queryInspectionRequest.getDeptId())) { | |||
return JsonResult.error(QueryInspectionPageListCodeEnum.DEPT_ID_IS_NULL.getCode(), QueryInspectionPageListCodeEnum.DEPT_ID_IS_NULL.getMsg()); | |||
} | |||
// if (StringUtils.isEmpty(queryInspectionRequest.getDeptId())) { | |||
// return JsonResult.error(QueryInspectionPageListCodeEnum.DEPT_ID_IS_NULL.getCode(), QueryInspectionPageListCodeEnum.DEPT_ID_IS_NULL.getMsg()); | |||
// } | |||
// | |||
// // 判断部门是否存在 | |||
// Dept dept = deptMapper.selectOne(new LambdaQueryWrapper<Dept>() | |||
// .eq(Dept::getTenantId, tenantId) | |||
// .eq(Dept::getId, queryInspectionRequest.getDeptId()) | |||
// .eq(Dept::getMark, 1)); | |||
// if (null == dept) { | |||
// return JsonResult.error(QueryInspectionPageListCodeEnum.DEPT_IS_NOT_EXIST.getCode(), QueryInspectionPageListCodeEnum.DEPT_IS_NOT_EXIST.getMsg()); | |||
// } | |||
return JsonResult.success(); | |||
} | |||
// 判断部门是否存在 | |||
Dept dept = deptMapper.selectOne(new LambdaQueryWrapper<Dept>() | |||
.eq(Dept::getTenantId, tenantId) | |||
.eq(Dept::getId, queryInspectionRequest.getDeptId()) | |||
.eq(Dept::getMark, 1)); | |||
if (null == dept) { | |||
return JsonResult.error(QueryInspectionPageListCodeEnum.DEPT_IS_NOT_EXIST.getCode(), QueryInspectionPageListCodeEnum.DEPT_IS_NOT_EXIST.getMsg()); | |||
private List<InspectionVo> buildIspectionVoList(User user, Dept dept, List<Inspection> inspectionList) { | |||
List<InspectionVo> inspectionVoList = InspectionConverMapper.INSTANCE.fromInspectionListToInspectionVoList(inspectionList); | |||
for (InspectionVo inspectionVo : inspectionVoList) { | |||
executeHandle.handler(user, dept, inspectionVo); | |||
} | |||
return JsonResult.success(); | |||
return inspectionVoList; | |||
} | |||
} |
@@ -0,0 +1,67 @@ | |||
package com.tuoheng.admin.service.inspection.query.handle; | |||
import com.tuoheng.admin.entity.Dept; | |||
import com.tuoheng.admin.entity.User; | |||
import com.tuoheng.admin.enums.InspectionStatusEnum; | |||
import com.tuoheng.admin.enums.InspectionTypeEnum; | |||
import com.tuoheng.admin.enums.UserTypeEnum; | |||
import com.tuoheng.admin.vo.InspectionVo; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.springframework.stereotype.Service; | |||
@Slf4j | |||
@Service("executeHandle") | |||
public class ExecuteHandle implements GenerateInspectionFieldHander { | |||
private GenerateInspectionFieldHander handler; | |||
@Override | |||
public void setNextHandler(GenerateInspectionFieldHander handler) { | |||
this.handler = handler; | |||
} | |||
/** | |||
* 当处于任务待飞行状态时显示 | |||
* 1)、仅巡检方式为机场巡逻的任务有此功能 | |||
* 2)、管理员可对本部门的任务执行此操作 | |||
* 3)、普通用户可对自己创建的任务执行此操作 | |||
* | |||
* @param inspectionVo | |||
*/ | |||
@Override | |||
public void handler(User user, Dept dept, InspectionVo inspectionVo) { | |||
log.info("处理立即执行字段"); | |||
if (InspectionStatusEnum.WAIT_FLIGHT.getCode() != inspectionVo.getStatus()) { | |||
if (null != handler) { | |||
handler.handler(user, dept, inspectionVo); | |||
return; | |||
} | |||
} | |||
if (InspectionTypeEnum.AIRPORT.getCode() != inspectionVo.getInspectionType()) { | |||
if (null != handler) { | |||
handler.handler(user, dept, inspectionVo); | |||
return; | |||
} | |||
} | |||
if (UserTypeEnum.ADMIN.getCode() == user.getType()) { | |||
// 管理员可对本部门的任务执行此操作 | |||
if (user.getDeptId().equals(inspectionVo.getDeptId())) { | |||
inspectionVo.setExecute(true); | |||
} | |||
} else if (UserTypeEnum.ORDINARY_USER.getCode() == user.getType()) { | |||
// 普通用户可对自己创建的任务执行此操作 | |||
if (user.getId().equals(inspectionVo.getCreateUser())) { | |||
inspectionVo.setExecute(true); | |||
} | |||
} | |||
if (null != handler) { | |||
handler.handler(user, dept, inspectionVo); | |||
} | |||
} | |||
} |
@@ -0,0 +1,13 @@ | |||
package com.tuoheng.admin.service.inspection.query.handle; | |||
import com.tuoheng.admin.entity.Dept; | |||
import com.tuoheng.admin.entity.User; | |||
import com.tuoheng.admin.vo.InspectionVo; | |||
public interface GenerateInspectionFieldHander { | |||
void setNextHandler(GenerateInspectionFieldHander handler); | |||
void handler(User user, Dept dept, InspectionVo inspectionVo); | |||
} |
@@ -0,0 +1,55 @@ | |||
package com.tuoheng.admin.service.inspection.query.handle; | |||
import com.tuoheng.admin.entity.Dept; | |||
import com.tuoheng.admin.entity.User; | |||
import com.tuoheng.admin.enums.InspectionStatusEnum; | |||
import com.tuoheng.admin.enums.InspectionTypeEnum; | |||
import com.tuoheng.admin.vo.InspectionVo; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.springframework.stereotype.Service; | |||
@Slf4j | |||
@Service("liveHandle") | |||
public class LiveHandle implements GenerateInspectionFieldHander { | |||
private GenerateInspectionFieldHander handler; | |||
@Override | |||
public void setNextHandler(GenerateInspectionFieldHander handler) { | |||
this.handler = handler; | |||
} | |||
/** | |||
* | |||
* 直播: | |||
* 1)、处于任务飞行中状态时显示直播 | |||
* 1)、飞手值飞,创建任务时选择不直播的任务,无此按钮 | |||
* | |||
* @param inspectionVo | |||
*/ | |||
@Override | |||
public void handler(User user, Dept dept, InspectionVo inspectionVo) { | |||
log.info("处理直播执行字段"); | |||
if (InspectionStatusEnum.IN_FLIGHT.getCode() != inspectionVo.getStatus()) { | |||
if (null != handler) { | |||
handler.handler(user, dept, inspectionVo); | |||
return; | |||
} | |||
} | |||
if (InspectionTypeEnum.MABNNEDFLIGHT.getCode() != inspectionVo.getInspectionType()) { | |||
if (null != handler) { | |||
handler.handler(user, dept, inspectionVo); | |||
return; | |||
} | |||
} | |||
if (1 == inspectionVo.getIsLive()) { | |||
inspectionVo.setLive(true); | |||
} | |||
if (null != handler) { | |||
handler.handler(user, dept, inspectionVo); | |||
} | |||
} | |||
} |
@@ -0,0 +1,38 @@ | |||
package com.tuoheng.admin.service.inspection.query.handle; | |||
import com.tuoheng.admin.entity.Dept; | |||
import com.tuoheng.admin.entity.User; | |||
import com.tuoheng.admin.enums.InspectionStatusEnum; | |||
import com.tuoheng.admin.vo.InspectionVo; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.springframework.stereotype.Service; | |||
@Slf4j | |||
@Service("playBackHandle") | |||
public class PlayBackHandle implements GenerateInspectionFieldHander { | |||
private GenerateInspectionFieldHander handler; | |||
@Override | |||
public void setNextHandler(GenerateInspectionFieldHander handler) { | |||
this.handler = handler; | |||
} | |||
/** | |||
* 处于任务已完成状态时显示 | |||
* | |||
* @param inspectionVo | |||
*/ | |||
@Override | |||
public void handler(User user, Dept dept, InspectionVo inspectionVo) { | |||
log.info("处理回放执行字段"); | |||
if (InspectionStatusEnum.FLIGHT_COMPLETED.getCode() == inspectionVo.getStatus()) { | |||
inspectionVo.setPlayback(true); | |||
} | |||
if (null != handler) { | |||
handler.handler(user, dept,inspectionVo); | |||
return; | |||
} | |||
} | |||
} |
@@ -0,0 +1,61 @@ | |||
package com.tuoheng.admin.service.inspection.query.handle; | |||
import cn.hutool.core.collection.CollectionUtil; | |||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |||
import com.tuoheng.admin.entity.Dept; | |||
import com.tuoheng.admin.entity.InspectionFile; | |||
import com.tuoheng.admin.entity.User; | |||
import com.tuoheng.admin.enums.InspectionFileStatusEnum; | |||
import com.tuoheng.admin.enums.InspectionStatusEnum; | |||
import com.tuoheng.admin.mapper.InspectionFileMapper; | |||
import com.tuoheng.admin.vo.InspectionVo; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.stereotype.Service; | |||
import java.util.List; | |||
@Slf4j | |||
@Service("problemCountHandle") | |||
public class ProblemCountHandle implements GenerateInspectionFieldHander { | |||
private GenerateInspectionFieldHander handler; | |||
@Autowired | |||
private InspectionFileMapper inspectionFileMapper; | |||
@Override | |||
public void setNextHandler(GenerateInspectionFieldHander handler) { | |||
this.handler = handler; | |||
} | |||
@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)); | |||
Integer confirmedProblemCount = 0; | |||
Integer discoverProblemCount = 0; | |||
if (CollectionUtil.isEmpty(inspectionFileList)) { | |||
discoverProblemCount = inspectionFileList.size(); | |||
for (InspectionFile inspectionFile : inspectionFileList) { | |||
if (InspectionFileStatusEnum.CONFIRMED.getCode() == inspectionFile.getStatus()) { | |||
confirmedProblemCount++; | |||
} | |||
} | |||
} | |||
inspectionVo.setConfirmedProblemCount(confirmedProblemCount); | |||
inspectionVo.setDiscoverProblemCount(discoverProblemCount); | |||
if (null != handler) { | |||
handler.handler(user, dept, inspectionVo); | |||
return; | |||
} | |||
} | |||
} |
@@ -0,0 +1,36 @@ | |||
package com.tuoheng.admin.service.inspection.query.handle; | |||
import com.tuoheng.admin.entity.Dept; | |||
import com.tuoheng.admin.entity.User; | |||
import com.tuoheng.admin.enums.InspectionStatusEnum; | |||
import com.tuoheng.admin.vo.InspectionVo; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.springframework.stereotype.Service; | |||
@Slf4j | |||
@Service("problemDetailsHandleHandle") | |||
public class ProblemDetailsHandle implements GenerateInspectionFieldHander { | |||
private GenerateInspectionFieldHander handler; | |||
@Override | |||
public void setNextHandler(GenerateInspectionFieldHander handler) { | |||
this.handler = handler; | |||
} | |||
@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); | |||
} | |||
if (null != handler) { | |||
handler.handler(user, dept, inspectionVo); | |||
return; | |||
} | |||
} | |||
} |
@@ -0,0 +1,36 @@ | |||
package com.tuoheng.admin.service.inspection.query.handle; | |||
import com.tuoheng.admin.entity.Dept; | |||
import com.tuoheng.admin.entity.User; | |||
import com.tuoheng.admin.enums.InspectionStatusEnum; | |||
import com.tuoheng.admin.vo.InspectionVo; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.springframework.stereotype.Service; | |||
@Slf4j | |||
@Service("problemVerifyHandleHandle") | |||
public class ProblemVerifyHandle implements GenerateInspectionFieldHander { | |||
private GenerateInspectionFieldHander handler; | |||
@Override | |||
public void setNextHandler(GenerateInspectionFieldHander handler) { | |||
this.handler = handler; | |||
} | |||
@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); | |||
} | |||
if (null != handler) { | |||
handler.handler(user, dept,inspectionVo); | |||
return; | |||
} | |||
} | |||
} |
@@ -0,0 +1,50 @@ | |||
package com.tuoheng.admin.service.inspection.query.handle; | |||
import com.tuoheng.admin.entity.Dept; | |||
import com.tuoheng.admin.entity.User; | |||
import com.tuoheng.admin.enums.InspectionStatusEnum; | |||
import com.tuoheng.admin.enums.InspectionTypeEnum; | |||
import com.tuoheng.admin.service.inspection.query.handle.GenerateInspectionFieldHander; | |||
import com.tuoheng.admin.vo.InspectionVo; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.springframework.stereotype.Service; | |||
@Slf4j | |||
@Service("resubmitHandle") | |||
public class ResubmitHandle implements GenerateInspectionFieldHander { | |||
private GenerateInspectionFieldHander handler; | |||
@Override | |||
public void setNextHandler(GenerateInspectionFieldHander handler) { | |||
this.handler = handler; | |||
} | |||
/** | |||
* 1)、当任务处于任务失败状态时显示 | |||
* 2)、仅巡检方式为机场巡逻的任务有此功能 | |||
* | |||
* @param inspectionVo | |||
*/ | |||
@Override | |||
public void handler(User user, Dept dept, InspectionVo inspectionVo) { | |||
log.info("处理重新提交字段"); | |||
if (InspectionStatusEnum.FLIGHT_FAILED.getCode() != inspectionVo.getStatus()) { | |||
if (null != handler) { | |||
handler.handler(user, dept, inspectionVo); | |||
return; | |||
} | |||
} | |||
if (InspectionTypeEnum.AIRPORT.getCode() != inspectionVo.getInspectionType()) { | |||
if (null != handler) { | |||
handler.handler(user, dept,inspectionVo); | |||
return; | |||
} | |||
} | |||
inspectionVo.setResubmit(true); | |||
if (null != handler) { | |||
handler.handler(user, dept,inspectionVo); | |||
} | |||
} | |||
} |
@@ -27,8 +27,8 @@ public class InspectionVo extends BaseEntity { | |||
/** | |||
* 部门ID | |||
* / | |||
private String deptId; | |||
*/ | |||
private String deptId; | |||
/** | |||
* 部门名称 | |||
@@ -75,124 +75,199 @@ public class InspectionVo extends BaseEntity { | |||
*/ | |||
private Integer inspectionType; | |||
/** 巡检机场id */ | |||
/** | |||
* 巡检机场id | |||
*/ | |||
private Integer airportId; | |||
/** 巡检机场名称 */ | |||
/** | |||
* 巡检机场名称 | |||
*/ | |||
private String airportName; | |||
/** 巡检线路id */ | |||
/** | |||
* 巡检线路id | |||
*/ | |||
private Integer inspectionLine; | |||
/** 巡检线路名称 */ | |||
/** | |||
* 巡检线路名称 | |||
*/ | |||
private String inspectionLineName; | |||
/** 飞行设备 */ | |||
/** | |||
* 飞行设备 | |||
*/ | |||
private String equipmentId; | |||
/** 飞行设备名称 */ | |||
/** | |||
* 飞行设备名称 | |||
*/ | |||
private String equipmentName; | |||
/** 挂载设备(多选逗号","分隔) */ | |||
/** | |||
* 挂载设备(多选逗号","分隔) | |||
*/ | |||
private String equipmentMountId; | |||
/** 挂载设备名称(多选逗号","分隔) */ | |||
/** | |||
* 挂载设备名称(多选逗号","分隔) | |||
*/ | |||
private String equipmentMountName; | |||
/** 5G云盒ID */ | |||
/** | |||
* 5G云盒ID | |||
*/ | |||
private String cloudBoxId; | |||
/** 云盒名称 */ | |||
/** | |||
* 云盒名称 | |||
*/ | |||
private String cloudBoxName; | |||
/** 云盒SN号 */ | |||
/** | |||
* 云盒SN号 | |||
*/ | |||
private String boxSn; | |||
/** 飞手(多选逗号","分隔) */ | |||
/** | |||
* 飞手(多选逗号","分隔) | |||
*/ | |||
private String flightHand; | |||
/** 飞手姓名(多选逗号","分隔) */ | |||
/** | |||
* 飞手姓名(多选逗号","分隔) | |||
*/ | |||
private String flightHandName; | |||
/** 计划巡检日期 */ | |||
/** | |||
* 计划巡检日期 | |||
*/ | |||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") | |||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") | |||
private Date inspectionTime; | |||
/** 执行开始时间 */ | |||
/** | |||
* 执行开始时间 | |||
*/ | |||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") | |||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") | |||
private Date executionStartTime; | |||
/** 执行结束时间 */ | |||
/** | |||
* 执行结束时间 | |||
*/ | |||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") | |||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") | |||
private Date executionEndTime; | |||
/** 是否实时,1:实时 2:离线 默认:null */ | |||
/** | |||
* 是否实时,1:实时 2:离线 默认:null */ | |||
private Integer isLive; | |||
/** 是否正摄:1是 2否 */ | |||
/** | |||
* 是否正摄:1是 2否 */ | |||
private Integer isTaken; | |||
/** 是否倾斜摄影:1是 2否 */ | |||
/** | |||
* 是否倾斜摄影:1是 2否 | |||
*/ | |||
private Integer isTilt; | |||
/** 原视频地址 */ | |||
/** | |||
* 原视频地址 | |||
*/ | |||
private String videoUrl; | |||
/** AI识别后视频地址 */ | |||
/** | |||
* AI识别后视频地址 | |||
*/ | |||
private String aiVideoUrl; | |||
/** 报告地址 */ | |||
/** | |||
* 报告地址 | |||
*/ | |||
private String reportUrl; | |||
/** SRT文件地址 */ | |||
/** | |||
* SRT文件地址 | |||
*/ | |||
private String srtUrl; | |||
/** 任务状态 5任务待飞行 7飞行失败 10任务飞行中 15任务飞行完成 */ | |||
/** | |||
* 任务状态 5任务待飞行 7飞行失败 10任务飞行中 15任务飞行完成 | |||
*/ | |||
private Integer status; | |||
/** 算法处理状态:0默认 1待上传 2待分析 3分析中 4成功 5超时 6失败 */ | |||
/** | |||
* 算法处理状态:0默认 1待上传 2待分析 3分析中 4成功 5超时 6失败 | |||
*/ | |||
private Integer analyseStatus; | |||
/** ai任务分析进度 */ | |||
/** | |||
* | |||
* ai任务分析进度 | |||
*/ | |||
private BigDecimal progressbar; | |||
/** 备注 */ | |||
/** | |||
* 备注 | |||
*/ | |||
private String note; | |||
/** 巡检时天气情况 */ | |||
/** | |||
* 巡检时天气情况 | |||
*/ | |||
private String weather; | |||
/** 飞行高度 */ | |||
/** | |||
* 飞行高度 | |||
*/ | |||
private String flyHeight; | |||
/** srt文件名称 */ | |||
/** | |||
* srt文件名称 | |||
*/ | |||
private String srtName; | |||
/** ai心跳更新时间 */ | |||
/** | |||
* ai心跳更新时间 | |||
*/ | |||
private Long heartbeatTime; | |||
/** 定时任务的执行状态。1:未执行,2:已执行 */ | |||
/** | |||
* 定时任务的执行状态。1:未执行,2:已执行 | |||
*/ | |||
private Long executionStatus; | |||
/** 起点经度 */ | |||
/** | |||
* 起点经度 | |||
*/ | |||
private String startLongitude; | |||
/** 起点纬度 */ | |||
/** | |||
* 起点纬度 | |||
*/ | |||
private String startLatitude; | |||
/** 终点经度 */ | |||
/** | |||
* 终点经度 | |||
*/ | |||
private String endLongitude; | |||
/** 终点纬度 */ | |||
/** | |||
* 终点纬度 | |||
*/ | |||
private String endLatitude; | |||
/** 联系方式 */ | |||
/** | |||
* 联系方式 | |||
*/ | |||
private String mobile; | |||
/** 巡逻地点 */ | |||
/** | |||
* 巡逻地点 | |||
*/ | |||
private String patrolLocation; | |||
/** | |||
@@ -205,4 +280,34 @@ public class InspectionVo extends BaseEntity { | |||
*/ | |||
private Integer discoverProblemCount; | |||
/** | |||
* 立即执行 | |||
*/ | |||
private boolean execute; | |||
/** | |||
* 直播 | |||
*/ | |||
private boolean live; | |||
/** | |||
* 回放 | |||
*/ | |||
private boolean playback; | |||
/** | |||
* 问题详情 | |||
*/ | |||
private boolean problemDetails; | |||
/** | |||
* 问题核实 | |||
*/ | |||
private boolean problemVerify; | |||
/** | |||
* 重新提交 | |||
*/ | |||
private boolean resubmit; | |||
} |