@@ -1,8 +1,8 @@ | |||
package com.tuoheng.admin.controller; | |||
import com.aliyuncs.sts.model.v20150401.AssumeRoleResponse; | |||
import com.tuoheng.admin.service.IAliyunOssService; | |||
import com.tuoheng.admin.service.impl.AliyunOssServiceImpl; | |||
import com.tuoheng.admin.service.aliyun.IAliyunOssService; | |||
import com.tuoheng.admin.service.aliyun.AliyunOssServiceImpl; | |||
import com.tuoheng.common.core.utils.JsonResult; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.web.bind.annotation.GetMapping; |
@@ -1,6 +1,6 @@ | |||
package com.tuoheng.admin.controller; | |||
import com.tuoheng.admin.service.IAliyuncsVodService; | |||
import com.tuoheng.admin.service.aliyun.IAliyuncsVodService; | |||
import com.tuoheng.common.core.utils.JsonResult; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.web.bind.annotation.GetMapping; |
@@ -3,8 +3,7 @@ package com.tuoheng.admin.controller; | |||
import com.baomidou.mybatisplus.core.metadata.IPage; | |||
import com.tuoheng.admin.entity.FlightData; | |||
import com.tuoheng.admin.query.FlightDataQuery; | |||
import com.tuoheng.admin.service.IFlightDataService; | |||
import com.tuoheng.common.core.common.OperationEnum; | |||
import com.tuoheng.admin.service.flightdata.IFlightDataService; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.web.bind.annotation.*; | |||
@@ -1,10 +1,9 @@ | |||
package com.tuoheng.admin.controller.callback; | |||
import com.tuoheng.admin.entity.FlightData; | |||
import com.tuoheng.admin.service.IFlightDataService; | |||
import com.tuoheng.admin.service.flightdata.IFlightDataService; | |||
import com.tuoheng.common.core.common.OperationEnum; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.web.bind.annotation.PostMapping; | |||
import org.springframework.web.bind.annotation.RequestBody; | |||
import org.springframework.web.bind.annotation.RequestMapping; | |||
import org.springframework.web.bind.annotation.RestController; |
@@ -1,4 +1,4 @@ | |||
package com.tuoheng.admin.service.impl; | |||
package com.tuoheng.admin.service.aliyun; | |||
import com.aliyun.oss.OSS; | |||
import com.aliyun.oss.OSSClientBuilder; | |||
@@ -11,7 +11,7 @@ import com.aliyuncs.profile.IClientProfile; | |||
import com.aliyuncs.sts.model.v20150401.AssumeRoleRequest; | |||
import com.aliyuncs.sts.model.v20150401.AssumeRoleResponse; | |||
import com.tuoheng.admin.config.AliyuncsVodConfig; | |||
import com.tuoheng.admin.service.IAliyunOssService; | |||
import com.tuoheng.admin.service.aliyun.IAliyunOssService; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.springframework.stereotype.Service; | |||
@@ -1,4 +1,4 @@ | |||
package com.tuoheng.admin.service.impl; | |||
package com.tuoheng.admin.service.aliyun; | |||
import com.aliyun.oss.ClientException; | |||
import com.aliyun.tea.TeaModel; | |||
@@ -10,7 +10,7 @@ import com.aliyuncs.DefaultAcsClient; | |||
import com.aliyuncs.profile.DefaultProfile; | |||
import com.aliyuncs.vod.model.v20170321.*; | |||
import com.tuoheng.admin.config.AliyuncsVodConfig; | |||
import com.tuoheng.admin.service.IAliyuncsVodService; | |||
import com.tuoheng.admin.service.aliyun.IAliyuncsVodService; | |||
import com.tuoheng.common.core.utils.StringUtils; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.springframework.beans.factory.annotation.Autowired; |
@@ -1,4 +1,4 @@ | |||
package com.tuoheng.admin.service; | |||
package com.tuoheng.admin.service.aliyun; | |||
import java.net.URL; | |||
import java.util.List; |
@@ -1,4 +1,4 @@ | |||
package com.tuoheng.admin.service; | |||
package com.tuoheng.admin.service.aliyun; | |||
import com.aliyuncs.vod.model.v20170321.CreateUploadVideoResponse; | |||
import com.aliyuncs.vod.model.v20170321.GetVideoInfoResponse; |
@@ -1,4 +1,4 @@ | |||
package com.tuoheng.admin.service.impl; | |||
package com.tuoheng.admin.service.flightdata; | |||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | |||
import com.baomidou.mybatisplus.core.metadata.IPage; | |||
@@ -8,7 +8,6 @@ import com.tuoheng.admin.entity.Inspection; | |||
import com.tuoheng.admin.mapper.FlightDataMapper; | |||
import com.tuoheng.admin.mapper.InspectionMapper; | |||
import com.tuoheng.admin.query.FlightDataQuery; | |||
import com.tuoheng.admin.service.IFlightDataService; | |||
import com.tuoheng.common.core.common.BaseServiceImpl; | |||
import com.tuoheng.common.core.enums.ServiceExceptionEnum; | |||
import com.tuoheng.common.core.exception.ServiceException; | |||
@@ -40,42 +39,43 @@ public class FlightDataServiceImpl extends BaseServiceImpl<FlightDataMapper, Fli | |||
/** | |||
* 获取巡检任务飞行轨迹坐标列表 | |||
* | |||
* @param flightDataQuery | |||
* @return | |||
*/ | |||
@Override | |||
public IPage<FlightData> getFlightDataList(FlightDataQuery flightDataQuery) { | |||
if(StringUtils.isEmpty(flightDataQuery.getInspectionId())){ | |||
if (StringUtils.isEmpty(flightDataQuery.getInspectionId())) { | |||
throw new ServiceException(ServiceExceptionEnum.PARAMETER_IS_NULL); | |||
} | |||
QueryWrapper<FlightData> queryWrapper = new QueryWrapper<>(); | |||
queryWrapper.eq("inspection_id",flightDataQuery.getInspectionId()); | |||
queryWrapper.eq("mark",1); | |||
queryWrapper.eq("inspection_id", flightDataQuery.getInspectionId()); | |||
queryWrapper.eq("mark", 1); | |||
//飞机坐标不关联租户id | |||
//queryWrapper.eq("tenant_id", ShiroUtils.getTenantId()) | |||
queryWrapper.orderByDesc("id"); | |||
//查询分页数据 | |||
IPage<FlightData> page = new Page<>(flightDataQuery.getPage(),flightDataQuery.getLimit()); | |||
IPage<FlightData> pageData = flightDataMapper.selectPage(page,queryWrapper); | |||
IPage<FlightData> page = new Page<>(flightDataQuery.getPage(), flightDataQuery.getLimit()); | |||
IPage<FlightData> pageData = flightDataMapper.selectPage(page, queryWrapper); | |||
return pageData; | |||
} | |||
@Override | |||
public void addCallback(FlightData entity) { | |||
if(entity !=null && StringUtils.isNotEmpty(entity.getBoxSn())){ | |||
log.info("addCallback接口入参:"+entity); | |||
if (entity != null && StringUtils.isNotEmpty(entity.getBoxSn())) { | |||
log.info("addCallback接口入参:" + entity); | |||
//查询正在执行的云盒所对应的任务 | |||
List<Inspection> inspectionList = inspectionMapper.getListByBox(entity.getBoxSn()); | |||
if(StringUtils.isNotEmpty(inspectionList)){ | |||
if (StringUtils.isNotEmpty(inspectionList)) { | |||
entity.setTenantId(inspectionList.get(0).getTenantId()); | |||
entity.setInspectionId(inspectionList.get(0).getId()); | |||
//将最新一条数据存放入缓存,并设置过期时间 | |||
redisUtils.set(inspectionList.get(0).getId(),entity,10); | |||
redisUtils.set(inspectionList.get(0).getId(), entity, 10); | |||
} | |||
entity.setCreateTime(DateUtils.now()); | |||
flightDataMapper.insert(entity); | |||
log.info("addCallback接口入库成功:"+entity.getId()); | |||
log.info("addCallback接口入库成功:" + entity.getId()); | |||
} | |||
} | |||
} |
@@ -1,4 +1,4 @@ | |||
package com.tuoheng.admin.service; | |||
package com.tuoheng.admin.service.flightdata; | |||
import com.baomidou.mybatisplus.core.metadata.IPage; | |||
import com.tuoheng.admin.entity.FlightData; |
@@ -1,7 +1,6 @@ | |||
package com.tuoheng.admin.service.inspection.query; | |||
package com.tuoheng.admin.service.flightdata.query; | |||
import cn.hutool.core.util.ObjectUtil; | |||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||
import com.tuoheng.admin.entity.FlightData; | |||
import com.tuoheng.admin.mapper.FlightDataMapper; | |||
import com.tuoheng.admin.mapper.InspectionMapper; | |||
@@ -31,7 +30,6 @@ public class QueryFindFlightDataByInspectionIdService { | |||
@Autowired | |||
private RedisUtils redisUtils; | |||
public FlightData getFlightData(String inspectionId) { | |||
//拉取最新一条经纬度信息 | |||
// FlightData flightData = flightDataMapper.selectOne(Wrappers.<FlightData>lambdaQuery() | |||
@@ -41,9 +39,9 @@ public class QueryFindFlightDataByInspectionIdService { | |||
//从缓存中拿出遥测数据 | |||
Object obj = redisUtils.get(inspectionId); | |||
FlightData flightData = null; | |||
if(ObjectUtil.isNull(obj)){ | |||
if (ObjectUtil.isNull(obj)) { | |||
throw new ServiceException(ServiceExceptionEnum.PARAMETER_IS_NULL); | |||
}else { | |||
} else { | |||
flightData = (FlightData) obj; | |||
} | |||
return flightData; |
@@ -1,9 +1,8 @@ | |||
package com.tuoheng.admin.service.inspection.query; | |||
package com.tuoheng.admin.service.flightdata.query; | |||
import com.tuoheng.admin.entity.FlightData; | |||
import com.tuoheng.admin.enums.code.inspection.QueryInspectionInfoByIdCodeEnum; | |||
import com.tuoheng.admin.mapper.FlightDataMapper; | |||
import com.tuoheng.admin.mapper.InspectionMapper; | |||
import com.tuoheng.common.core.utils.JsonResult; | |||
import com.tuoheng.common.core.utils.StringUtils; | |||
import lombok.extern.slf4j.Slf4j; | |||
@@ -22,17 +21,12 @@ import java.util.List; | |||
@Slf4j | |||
public class QueryFindFlightDataService { | |||
@Autowired | |||
private InspectionMapper inspectionMapper; | |||
@Autowired | |||
private FlightDataMapper flightDataMapper; | |||
public JsonResult findFlightData(String id) { | |||
if(StringUtils.isEmpty(id)){ | |||
return JsonResult.error(QueryInspectionInfoByIdCodeEnum.INSPECTION_ID_IS_NULL.getCode(),QueryInspectionInfoByIdCodeEnum.INSPECTION_ID_IS_NULL.getMsg()); | |||
public JsonResult findFlightData(String id) { | |||
if (StringUtils.isEmpty(id)) { | |||
return JsonResult.error(QueryInspectionInfoByIdCodeEnum.INSPECTION_ID_IS_NULL.getCode(), QueryInspectionInfoByIdCodeEnum.INSPECTION_ID_IS_NULL.getMsg()); | |||
} | |||
//根据任务id查询对应的云盒遥测数据 | |||
List<FlightData> listData = flightDataMapper.selectListByInspectionId(id); |
@@ -1,4 +1,4 @@ | |||
package com.tuoheng.admin.service.inspection.query; | |||
package com.tuoheng.admin.service.flightdata.query; | |||
import cn.hutool.core.util.ObjectUtil; | |||
import com.tuoheng.admin.entity.FlightData; | |||
@@ -32,7 +32,6 @@ public class QueryFlightDataTrackService { | |||
@Autowired | |||
private InspectionMapper inspectionMapper; | |||
public OperationEnum track(InspectionRequest inspectionRequest) { | |||
Inspection inspection = inspectionMapper.selectById(inspectionRequest.getRequestId()); | |||
if (ObjectUtil.isEmpty(inspection)) { |
@@ -1,7 +1,7 @@ | |||
package com.tuoheng.admin.service.impl; | |||
import com.tuoheng.admin.service.AsyncService; | |||
import com.tuoheng.admin.service.IFlightDataService; | |||
import com.tuoheng.admin.service.flightdata.IFlightDataService; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.scheduling.annotation.Async; | |||
@@ -9,7 +9,6 @@ import org.springframework.stereotype.Service; | |||
import java.util.List; | |||
/** | |||
* 异步任务接口实现 | |||
*/ | |||
@@ -21,7 +20,7 @@ public class AsyncServiceImpl implements AsyncService { | |||
private IFlightDataService flightDataService; | |||
@Async("asyncServiceExecutor") | |||
public void flightDataSaveBatch(List list){ | |||
public void flightDataSaveBatch(List list) { | |||
log.info("线程-" + Thread.currentThread().getId() + "在执行写入"); | |||
flightDataService.saveBatch(list); | |||
} |
@@ -4,6 +4,9 @@ import com.tuoheng.admin.dto.InspectionDto; | |||
import com.tuoheng.admin.entity.FlightData; | |||
import com.tuoheng.admin.mapper.InspectionMapper; | |||
import com.tuoheng.admin.request.inspection.*; | |||
import com.tuoheng.admin.service.flightdata.query.QueryFindFlightDataByInspectionIdService; | |||
import com.tuoheng.admin.service.flightdata.query.QueryFindFlightDataService; | |||
import com.tuoheng.admin.service.flightdata.query.QueryFlightDataTrackService; | |||
import com.tuoheng.admin.service.inspection.add.AddInspectionService; | |||
import com.tuoheng.admin.service.inspection.execute.ExecuteInspectionService; | |||
import com.tuoheng.admin.service.inspection.resubmit.ResubmitInspectionService; |
@@ -121,9 +121,9 @@ public class QueryInspectionPageListService { | |||
if (RoleEnum.SUPER_ADMIN.getCode() == user.getRoleId()) { | |||
pageData = this.getAllList(request); | |||
} else if (RoleEnum.ADMIN.getCode() == user.getRoleId()) { | |||
pageData = this.getListByDept(request); | |||
pageData = this.getListByDept(request, user); | |||
} else if (RoleEnum.ORDINARY_USER.getCode() == user.getRoleId()) { | |||
pageData = this.getListByDept(request); | |||
pageData = this.getListByDept(request, user); | |||
} | |||
if (null == pageData || pageData.getTotal() == 0) { | |||
@@ -191,10 +191,10 @@ public class QueryInspectionPageListService { | |||
* @param request | |||
* @return | |||
*/ | |||
private IPage<Inspection> getListByDept(QueryInspectionPageListRequest request) { | |||
private IPage<Inspection> getListByDept(QueryInspectionPageListRequest request, User user) { | |||
// 获取本部门及子孙部门id列表 | |||
if (StringUtils.isEmpty(request.getDeptId())) { | |||
List<String> deptIdList = deptMapper.selectAllChildListById(request.getDeptId()); | |||
List<String> deptIdList = deptMapper.selectAllChildListById(user.getDeptId()); | |||
request.setDeptIdList(deptIdList); | |||
} | |||