* @team tuoheng | * @team tuoheng | ||||
* @date 2022-11-23 | * @date 2022-11-23 | ||||
*/ | */ | ||||
public enum InspectionWayEnum { | |||||
public enum InspectionTypeEnum { | |||||
DRONE(1,"无人机"), | DRONE(1,"无人机"), | ||||
AIRPORT(2,"机场巡逻"), | AIRPORT(2,"机场巡逻"), | ||||
MABNNEDFLIGHT(3,"飞手值飞"); | MABNNEDFLIGHT(3,"飞手值飞"); | ||||
InspectionWayEnum(int code, String description){ | |||||
InspectionTypeEnum(int code, String description){ | |||||
this.code = code; | this.code = code; | ||||
this.description = description; | this.description = description; | ||||
} | } |
DELETE_IS_FAILED(1230200, "删除任务失败"), | DELETE_IS_FAILED(1230200, "删除任务失败"), | ||||
ID_IS_NULL(1230201, "任务ID为空"), | ID_IS_NULL(1230201, "任务ID为空"), | ||||
INSPECTION_IS_NOT_EXIST(1230202, "任务不存在"), | INSPECTION_IS_NOT_EXIST(1230202, "任务不存在"), | ||||
IN_FLIGHT_NOT_DELETE(1230203, "飞行中时无法删除"), | |||||
IN_FLIGHT_NOT_DELETE(1230203, "飞行中无法删除"), | |||||
ADMIN_NOT_DELETE_CHILD_INSPECTION(1230204, "管理员不能删除子部门任务"), | ADMIN_NOT_DELETE_CHILD_INSPECTION(1230204, "管理员不能删除子部门任务"), | ||||
ORDINARY_USER_NO_PERMISSION_TO_DELETE(1230205, "普通用户无权限删除任务"); | |||||
ORDINARY_USER_NO_PERMISSION_TO_DELETE(1230205, "普通用户无删除任务权限"); | |||||
/** | /** | ||||
* 错误码 | * 错误码 |
/** | /** | ||||
* 关键字,匹配任务编号和任务名称 | * 关键字,匹配任务编号和任务名称 | ||||
*/ | */ | ||||
private String key; | |||||
// private String key; | |||||
/** | /** | ||||
* 任务编号 | * 任务编号 |
import com.tuoheng.admin.conver.InspectionConverMapper; | import com.tuoheng.admin.conver.InspectionConverMapper; | ||||
import com.tuoheng.admin.entity.*; | import com.tuoheng.admin.entity.*; | ||||
import com.tuoheng.admin.enums.InspectionStatusEnum; | 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.enums.code.inspection.AddInspectionCodeEnum; | ||||
import com.tuoheng.admin.mapper.*; | import com.tuoheng.admin.mapper.*; | ||||
import com.tuoheng.admin.request.inspection.AddInspectionRequest; | import com.tuoheng.admin.request.inspection.AddInspectionRequest; | ||||
import com.tuoheng.admin.utils.GaodeUtil; | |||||
import com.tuoheng.admin.utils.ShiroUtils; | import com.tuoheng.admin.utils.ShiroUtils; | ||||
import com.tuoheng.common.core.utils.DateUtils; | import com.tuoheng.common.core.utils.DateUtils; | ||||
import com.tuoheng.common.core.utils.JsonResult; | import com.tuoheng.common.core.utils.JsonResult; | ||||
import lombok.extern.slf4j.Slf4j; | import lombok.extern.slf4j.Slf4j; | ||||
import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
import org.springframework.stereotype.Service; | import org.springframework.stereotype.Service; | ||||
import org.springframework.transaction.annotation.Transactional; | |||||
/** | /** | ||||
* 添加任务业务层处理 | * 添加任务业务层处理 | ||||
return JsonResult.error(AddInspectionCodeEnum.INSPECTION_TYPE_IS_NULL.getCode(), AddInspectionCodeEnum.INSPECTION_TYPE_IS_NULL.getMsg()); | 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())) { | if (null == addInspectionRequest.getRoadId() || StringUtils.isEmpty(addInspectionRequest.getRoadName())) { | ||||
return JsonResult.error(AddInspectionCodeEnum.ROAD_IS_NULL.getCode(), AddInspectionCodeEnum.ROAD_IS_NULL.getMsg()); | return JsonResult.error(AddInspectionCodeEnum.ROAD_IS_NULL.getCode(), AddInspectionCodeEnum.ROAD_IS_NULL.getMsg()); | ||||
if (null == addInspectionRequest.getSectionId() || StringUtils.isEmpty(addInspectionRequest.getSectionName())) { | if (null == addInspectionRequest.getSectionId() || StringUtils.isEmpty(addInspectionRequest.getSectionName())) { | ||||
return JsonResult.error(AddInspectionCodeEnum.SECTION_IS_NULL.getCode(), AddInspectionCodeEnum.SECTION_IS_NULL.getMsg()); | 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()) { | if (null == addInspectionRequest.getIsLive()) { | ||||
return JsonResult.error(AddInspectionCodeEnum.LIVE_IS_NULL.getCode(), AddInspectionCodeEnum.LIVE_IS_NULL.getMsg()); | return JsonResult.error(AddInspectionCodeEnum.LIVE_IS_NULL.getCode(), AddInspectionCodeEnum.LIVE_IS_NULL.getMsg()); |
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); | |||||
} |
import cn.hutool.core.collection.CollectionUtil; | import cn.hutool.core.collection.CollectionUtil; | ||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | 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.entity.InspectionFile; | ||||
import com.tuoheng.admin.enums.InspectionFileStatusEnum; | import com.tuoheng.admin.enums.InspectionFileStatusEnum; | ||||
import com.tuoheng.admin.enums.InspectionWayEnum; | |||||
import com.tuoheng.admin.enums.code.inspection.QueryInspectionPageListCodeEnum; | import com.tuoheng.admin.enums.code.inspection.QueryInspectionPageListCodeEnum; | ||||
import com.tuoheng.admin.mapper.DeptMapper; | import com.tuoheng.admin.mapper.DeptMapper; | ||||
import com.tuoheng.admin.mapper.InspectionFileMapper; | import com.tuoheng.admin.mapper.InspectionFileMapper; | ||||
import com.tuoheng.admin.mapper.InspectionMapper; | import com.tuoheng.admin.mapper.InspectionMapper; | ||||
import com.tuoheng.admin.request.inspection.QueryInspectionPageListRequest; | |||||
import com.tuoheng.admin.utils.ShiroUtils; | 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.JsonResult; | ||||
import com.tuoheng.common.core.utils.StringUtils; | import com.tuoheng.common.core.utils.StringUtils; | ||||
import lombok.extern.slf4j.Slf4j; | import lombok.extern.slf4j.Slf4j; | ||||
private InspectionFileMapper inspectionFileMapper; | private InspectionFileMapper inspectionFileMapper; | ||||
public JsonResult getInfo(String id) { | public JsonResult getInfo(String id) { | ||||
log.info("进入查询巡检任务分页列表业务"); | |||||
log.info("进入查询巡检任务详情业务"); | |||||
String userId = ShiroUtils.getUserId(); | String userId = ShiroUtils.getUserId(); | ||||
String tenantId = ShiroUtils.getTenantId(); | String tenantId = ShiroUtils.getTenantId(); | ||||
JsonResult result = this.check(tenantId, id); | JsonResult result = this.check(tenantId, id); | ||||
if (0 != result.getCode()) { | if (0 != result.getCode()) { | ||||
log.info("进入查询巡检任务分页列表业务:校验失败:{}", result.getMsg()); | |||||
log.info("进入查询巡检任务详情业务:校验失败:{}", result.getMsg()); | |||||
return result; | return result; | ||||
} | } | ||||
package com.tuoheng.admin.service.inspection.query; | 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.conditions.query.LambdaQueryWrapper; | ||||
import com.baomidou.mybatisplus.core.metadata.IPage; | import com.baomidou.mybatisplus.core.metadata.IPage; | ||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | ||||
import com.tuoheng.admin.conver.InspectionConverMapper; | import com.tuoheng.admin.conver.InspectionConverMapper; | ||||
import com.tuoheng.admin.entity.Dept; | import com.tuoheng.admin.entity.Dept; | ||||
import com.tuoheng.admin.entity.Inspection; | 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.DeptMapper; | ||||
import com.tuoheng.admin.mapper.InspectionFileMapper; | import com.tuoheng.admin.mapper.InspectionFileMapper; | ||||
import com.tuoheng.admin.mapper.InspectionMapper; | import com.tuoheng.admin.mapper.InspectionMapper; | ||||
import com.tuoheng.admin.mapper.UserMapper; | |||||
import com.tuoheng.admin.request.inspection.QueryInspectionPageListRequest; | 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.utils.ShiroUtils; | ||||
import com.tuoheng.admin.vo.InspectionVo; | import com.tuoheng.admin.vo.InspectionVo; | ||||
import com.tuoheng.common.core.utils.JsonResult; | import com.tuoheng.common.core.utils.JsonResult; | ||||
import com.tuoheng.common.core.utils.StringUtils; | |||||
import lombok.extern.slf4j.Slf4j; | import lombok.extern.slf4j.Slf4j; | ||||
import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
import org.springframework.beans.factory.annotation.Qualifier; | |||||
import org.springframework.stereotype.Service; | import org.springframework.stereotype.Service; | ||||
import javax.annotation.PostConstruct; | |||||
import java.util.List; | import java.util.List; | ||||
/** | /** | ||||
@Service | @Service | ||||
public class QueryInspectionPageListService { | public class QueryInspectionPageListService { | ||||
@Autowired | |||||
private UserMapper userMapper; | |||||
@Autowired | @Autowired | ||||
private DeptMapper deptMapper; | private DeptMapper deptMapper; | ||||
@Autowired | @Autowired | ||||
private InspectionMapper inspectionMapper; | private InspectionMapper inspectionMapper; | ||||
@Autowired | |||||
private InspectionFileMapper inspectionFileMapper; | 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) { | public JsonResult getPageList(QueryInspectionPageListRequest queryInspectionRequest) { | ||||
log.info("进入查询巡检任务分页列表业务"); | log.info("进入查询巡检任务分页列表业务"); | ||||
return result; | 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列表 | // 获取本部门及子孙部门id列表 | ||||
List<String> deptIdList = deptMapper.selectAllChildListById(queryInspectionRequest.getDeptId()); | List<String> deptIdList = deptMapper.selectAllChildListById(queryInspectionRequest.getDeptId()); | ||||
List<Inspection> inspectionList = pageData.getRecords(); | 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); | |||||
} | } | ||||
/** | /** | ||||
*/ | */ | ||||
private JsonResult check(String tenantId, QueryInspectionPageListRequest queryInspectionRequest) { | private JsonResult check(String tenantId, QueryInspectionPageListRequest queryInspectionRequest) { | ||||
// 判断部门id是否为空 | // 判断部门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; | |||||
} | } | ||||
} | } |
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); | |||||
} | |||||
} | |||||
} |
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); | |||||
} |
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); | |||||
} | |||||
} | |||||
} |
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; | |||||
} | |||||
} | |||||
} |
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; | |||||
} | |||||
} | |||||
} |
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; | |||||
} | |||||
} | |||||
} |
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; | |||||
} | |||||
} | |||||
} |
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); | |||||
} | |||||
} | |||||
} |
/** | /** | ||||
* 部门ID | * 部门ID | ||||
* / | |||||
private String deptId; | |||||
*/ | |||||
private String deptId; | |||||
/** | /** | ||||
* 部门名称 | * 部门名称 | ||||
*/ | */ | ||||
private Integer inspectionType; | private Integer inspectionType; | ||||
/** 巡检机场id */ | |||||
/** | |||||
* 巡检机场id | |||||
*/ | |||||
private Integer airportId; | private Integer airportId; | ||||
/** 巡检机场名称 */ | |||||
/** | |||||
* 巡检机场名称 | |||||
*/ | |||||
private String airportName; | private String airportName; | ||||
/** 巡检线路id */ | |||||
/** | |||||
* 巡检线路id | |||||
*/ | |||||
private Integer inspectionLine; | private Integer inspectionLine; | ||||
/** 巡检线路名称 */ | |||||
/** | |||||
* 巡检线路名称 | |||||
*/ | |||||
private String inspectionLineName; | private String inspectionLineName; | ||||
/** 飞行设备 */ | |||||
/** | |||||
* 飞行设备 | |||||
*/ | |||||
private String equipmentId; | private String equipmentId; | ||||
/** 飞行设备名称 */ | |||||
/** | |||||
* 飞行设备名称 | |||||
*/ | |||||
private String equipmentName; | private String equipmentName; | ||||
/** 挂载设备(多选逗号","分隔) */ | |||||
/** | |||||
* 挂载设备(多选逗号","分隔) | |||||
*/ | |||||
private String equipmentMountId; | private String equipmentMountId; | ||||
/** 挂载设备名称(多选逗号","分隔) */ | |||||
/** | |||||
* 挂载设备名称(多选逗号","分隔) | |||||
*/ | |||||
private String equipmentMountName; | private String equipmentMountName; | ||||
/** 5G云盒ID */ | |||||
/** | |||||
* 5G云盒ID | |||||
*/ | |||||
private String cloudBoxId; | private String cloudBoxId; | ||||
/** 云盒名称 */ | |||||
/** | |||||
* 云盒名称 | |||||
*/ | |||||
private String cloudBoxName; | private String cloudBoxName; | ||||
/** 云盒SN号 */ | |||||
/** | |||||
* 云盒SN号 | |||||
*/ | |||||
private String boxSn; | private String boxSn; | ||||
/** 飞手(多选逗号","分隔) */ | |||||
/** | |||||
* 飞手(多选逗号","分隔) | |||||
*/ | |||||
private String flightHand; | private String flightHand; | ||||
/** 飞手姓名(多选逗号","分隔) */ | |||||
/** | |||||
* 飞手姓名(多选逗号","分隔) | |||||
*/ | |||||
private String flightHandName; | private String flightHandName; | ||||
/** 计划巡检日期 */ | |||||
/** | |||||
* 计划巡检日期 | |||||
*/ | |||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") | ||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") | ||||
private Date inspectionTime; | private Date inspectionTime; | ||||
/** 执行开始时间 */ | |||||
/** | |||||
* 执行开始时间 | |||||
*/ | |||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") | ||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") | ||||
private Date executionStartTime; | private Date executionStartTime; | ||||
/** 执行结束时间 */ | |||||
/** | |||||
* 执行结束时间 | |||||
*/ | |||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") | ||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") | ||||
private Date executionEndTime; | private Date executionEndTime; | ||||
/** 是否实时,1:实时 2:离线 默认:null */ | |||||
/** | |||||
* 是否实时,1:实时 2:离线 默认:null */ | |||||
private Integer isLive; | private Integer isLive; | ||||
/** 是否正摄:1是 2否 */ | |||||
/** | |||||
* 是否正摄:1是 2否 */ | |||||
private Integer isTaken; | private Integer isTaken; | ||||
/** 是否倾斜摄影:1是 2否 */ | |||||
/** | |||||
* 是否倾斜摄影:1是 2否 | |||||
*/ | |||||
private Integer isTilt; | private Integer isTilt; | ||||
/** 原视频地址 */ | |||||
/** | |||||
* 原视频地址 | |||||
*/ | |||||
private String videoUrl; | private String videoUrl; | ||||
/** AI识别后视频地址 */ | |||||
/** | |||||
* AI识别后视频地址 | |||||
*/ | |||||
private String aiVideoUrl; | private String aiVideoUrl; | ||||
/** 报告地址 */ | |||||
/** | |||||
* 报告地址 | |||||
*/ | |||||
private String reportUrl; | private String reportUrl; | ||||
/** SRT文件地址 */ | |||||
/** | |||||
* SRT文件地址 | |||||
*/ | |||||
private String srtUrl; | private String srtUrl; | ||||
/** 任务状态 5任务待飞行 7飞行失败 10任务飞行中 15任务飞行完成 */ | |||||
/** | |||||
* 任务状态 5任务待飞行 7飞行失败 10任务飞行中 15任务飞行完成 | |||||
*/ | |||||
private Integer status; | private Integer status; | ||||
/** 算法处理状态:0默认 1待上传 2待分析 3分析中 4成功 5超时 6失败 */ | |||||
/** | |||||
* 算法处理状态:0默认 1待上传 2待分析 3分析中 4成功 5超时 6失败 | |||||
*/ | |||||
private Integer analyseStatus; | private Integer analyseStatus; | ||||
/** ai任务分析进度 */ | |||||
/** | |||||
* | |||||
* ai任务分析进度 | |||||
*/ | |||||
private BigDecimal progressbar; | private BigDecimal progressbar; | ||||
/** 备注 */ | |||||
/** | |||||
* 备注 | |||||
*/ | |||||
private String note; | private String note; | ||||
/** 巡检时天气情况 */ | |||||
/** | |||||
* 巡检时天气情况 | |||||
*/ | |||||
private String weather; | private String weather; | ||||
/** 飞行高度 */ | |||||
/** | |||||
* 飞行高度 | |||||
*/ | |||||
private String flyHeight; | private String flyHeight; | ||||
/** srt文件名称 */ | |||||
/** | |||||
* srt文件名称 | |||||
*/ | |||||
private String srtName; | private String srtName; | ||||
/** ai心跳更新时间 */ | |||||
/** | |||||
* ai心跳更新时间 | |||||
*/ | |||||
private Long heartbeatTime; | private Long heartbeatTime; | ||||
/** 定时任务的执行状态。1:未执行,2:已执行 */ | |||||
/** | |||||
* 定时任务的执行状态。1:未执行,2:已执行 | |||||
*/ | |||||
private Long executionStatus; | private Long executionStatus; | ||||
/** 起点经度 */ | |||||
/** | |||||
* 起点经度 | |||||
*/ | |||||
private String startLongitude; | private String startLongitude; | ||||
/** 起点纬度 */ | |||||
/** | |||||
* 起点纬度 | |||||
*/ | |||||
private String startLatitude; | private String startLatitude; | ||||
/** 终点经度 */ | |||||
/** | |||||
* 终点经度 | |||||
*/ | |||||
private String endLongitude; | private String endLongitude; | ||||
/** 终点纬度 */ | |||||
/** | |||||
* 终点纬度 | |||||
*/ | |||||
private String endLatitude; | private String endLatitude; | ||||
/** 联系方式 */ | |||||
/** | |||||
* 联系方式 | |||||
*/ | |||||
private String mobile; | private String mobile; | ||||
/** 巡逻地点 */ | |||||
/** | |||||
* 巡逻地点 | |||||
*/ | |||||
private String patrolLocation; | private String patrolLocation; | ||||
/** | /** | ||||
*/ | */ | ||||
private Integer discoverProblemCount; | private Integer discoverProblemCount; | ||||
/** | |||||
* 立即执行 | |||||
*/ | |||||
private boolean execute; | |||||
/** | |||||
* 直播 | |||||
*/ | |||||
private boolean live; | |||||
/** | |||||
* 回放 | |||||
*/ | |||||
private boolean playback; | |||||
/** | |||||
* 问题详情 | |||||
*/ | |||||
private boolean problemDetails; | |||||
/** | |||||
* 问题核实 | |||||
*/ | |||||
private boolean problemVerify; | |||||
/** | |||||
* 重新提交 | |||||
*/ | |||||
private boolean resubmit; | |||||
} | } |