import com.tuoheng.admin.entity.domain.ThMission; | import com.tuoheng.admin.entity.domain.ThMission; | ||||
import com.tuoheng.admin.entity.request.MissionQuery; | import com.tuoheng.admin.entity.request.MissionQuery; | ||||
import com.tuoheng.admin.entity.request.MissionRequest; | import com.tuoheng.admin.entity.request.MissionRequest; | ||||
import com.tuoheng.admin.entity.request.emergency.QueryEmergencyListRequest; | |||||
import com.tuoheng.admin.entity.request.emergency.QueryMissionListRequest; | |||||
import com.tuoheng.admin.entity.vo.MissionLiveVO; | import com.tuoheng.admin.entity.vo.MissionLiveVO; | ||||
import com.tuoheng.admin.entity.vo.MissionVO; | import com.tuoheng.admin.entity.vo.MissionVO; | ||||
import com.tuoheng.admin.service.IMissionService; | import com.tuoheng.admin.service.IMissionService; | ||||
return missionService.getVideoById(id); | return missionService.getVideoById(id); | ||||
} | } | ||||
/** | |||||
* 查询巡检任务列表 | |||||
*/ | |||||
@GetMapping("/list") | |||||
@ApiOperation(value = "查询应急任务列表", notes = "查询任务列表") | |||||
public JsonResult getList(QueryMissionListRequest request) { | |||||
return missionService.getList(request); | |||||
} | |||||
/** | |||||
* 查询巡检任务列表 | |||||
*/ | |||||
@GetMapping("/emergency/list") | |||||
@ApiOperation(value = "查询应急任务列表", notes = "查询应急任务列表") | |||||
public JsonResult getEmergencyList(QueryEmergencyListRequest request) { | |||||
return missionService.getEmergencyList(request); | |||||
} | |||||
} | } |
* DSP交互ID | * DSP交互ID | ||||
*/ | */ | ||||
private String requestId; | private String requestId; | ||||
/** | |||||
* 机场飞行类型 0默认 1机场巡逻 2指点飞行 | |||||
*/ | |||||
private Integer airportFlyType; | |||||
} | } |
package com.tuoheng.admin.entity.request.emergency; | |||||
import io.swagger.annotations.ApiModelProperty; | |||||
import lombok.Data; | |||||
import java.io.Serializable; | |||||
import java.util.List; | |||||
/** | |||||
* 查询应急列表请求实体 | |||||
* | |||||
* @author wanjing | |||||
* @team tuoheng | |||||
* @date 2023-02-13 | |||||
*/ | |||||
@Data | |||||
public class QueryEmergencyListRequest implements Serializable { | |||||
private static final long serialVersionUID = 1L; | |||||
@ApiModelProperty(value = "租户Id",hidden = true) | |||||
private Integer tenantId; | |||||
@ApiModelProperty(value = "机场飞行类型 0默认 1机场巡逻 2指点飞行") | |||||
private Integer airportFlyType; | |||||
@ApiModelProperty(value = "任务状态:1任务待飞行 2任务飞行中 3任务执行失败 4任务飞行完成") | |||||
private List<String> statusList; | |||||
} |
package com.tuoheng.admin.entity.request.emergency; | |||||
import io.swagger.annotations.ApiModelProperty; | |||||
import lombok.Data; | |||||
import java.io.Serializable; | |||||
import java.util.List; | |||||
/** | |||||
* 查询应急列表请求实体 | |||||
* @author: qiujinyang | |||||
*/ | |||||
@Data | |||||
public class QueryMissionListRequest implements Serializable { | |||||
private static final long serialVersionUID = 1L; | |||||
@ApiModelProperty(value = "租户Id",hidden = true) | |||||
private Integer tenantId; | |||||
@ApiModelProperty(value = "任务状态:1任务待飞行 2任务飞行中 3任务执行失败 4任务飞行完成") | |||||
private List<String> statusList; | |||||
} |
package com.tuoheng.admin.enums; | |||||
import lombok.Getter; | |||||
/** | |||||
* 机场飞行类型 0默认 1机场巡逻 2指点飞行 | |||||
* | |||||
* @author wanjing | |||||
* @team tuoheng | |||||
* @date 2023-02-13 | |||||
*/ | |||||
public enum AirportFlyTypeEnum { | |||||
NULL(0, "无"), | |||||
AIRPORT_PATROL(1,"机场巡逻"), | |||||
POINTING_FLIGHT(2,"指点飞行"); | |||||
AirportFlyTypeEnum(int code, String description){ | |||||
this.code = code; | |||||
this.description = description; | |||||
} | |||||
@Getter | |||||
private int code; | |||||
@Getter | |||||
private String description; | |||||
} |
import com.tuoheng.admin.entity.request.MissionQuery; | import com.tuoheng.admin.entity.request.MissionQuery; | ||||
import com.tuoheng.admin.entity.request.MissionRequest; | import com.tuoheng.admin.entity.request.MissionRequest; | ||||
import com.tuoheng.admin.entity.request.MissionStatusRequest; | import com.tuoheng.admin.entity.request.MissionStatusRequest; | ||||
import com.tuoheng.admin.entity.request.emergency.QueryEmergencyListRequest; | |||||
import com.tuoheng.admin.entity.request.emergency.QueryMissionListRequest; | |||||
import com.tuoheng.admin.entity.vo.MissionLiveVO; | import com.tuoheng.admin.entity.vo.MissionLiveVO; | ||||
import com.tuoheng.admin.entity.vo.MissionVO; | import com.tuoheng.admin.entity.vo.MissionVO; | ||||
import com.tuoheng.common.common.IBaseService; | import com.tuoheng.common.common.IBaseService; | ||||
import com.tuoheng.common.common.OperationEnum; | |||||
import com.tuoheng.common.exception.ServiceException; | import com.tuoheng.common.exception.ServiceException; | ||||
import com.tuoheng.common.utils.JsonResult; | import com.tuoheng.common.utils.JsonResult; | ||||
MissionLiveVO live(Integer id); | MissionLiveVO live(Integer id); | ||||
JsonResult getVideoById(String id); | JsonResult getVideoById(String id); | ||||
/** | |||||
* 查询任务列表 | |||||
* | |||||
* @return | |||||
*/ | |||||
JsonResult getList(QueryMissionListRequest request); | |||||
/** | |||||
* 查询应急任务列表 | |||||
* | |||||
* @return | |||||
*/ | |||||
JsonResult getEmergencyList(QueryEmergencyListRequest request); | |||||
} | } |
package com.tuoheng.admin.service.impl; | package com.tuoheng.admin.service.impl; | ||||
import cn.hutool.core.collection.CollectionUtil; | |||||
import cn.hutool.core.util.ObjectUtil; | import cn.hutool.core.util.ObjectUtil; | ||||
import com.alibaba.fastjson.JSONArray; | import com.alibaba.fastjson.JSONArray; | ||||
import com.alibaba.fastjson.JSONObject; | import com.alibaba.fastjson.JSONObject; | ||||
import com.tuoheng.admin.entity.request.MissionRequest; | import com.tuoheng.admin.entity.request.MissionRequest; | ||||
import com.tuoheng.admin.entity.request.MissionQuery; | import com.tuoheng.admin.entity.request.MissionQuery; | ||||
import com.tuoheng.admin.entity.request.MissionStatusRequest; | import com.tuoheng.admin.entity.request.MissionStatusRequest; | ||||
import com.tuoheng.admin.entity.request.emergency.QueryEmergencyListRequest; | |||||
import com.tuoheng.admin.entity.request.emergency.QueryMissionListRequest; | |||||
import com.tuoheng.admin.entity.vo.AirWeatherVO; | import com.tuoheng.admin.entity.vo.AirWeatherVO; | ||||
import com.tuoheng.admin.entity.vo.LiveChannelVO; | import com.tuoheng.admin.entity.vo.LiveChannelVO; | ||||
import com.tuoheng.admin.entity.vo.MissionLiveVO; | import com.tuoheng.admin.entity.vo.MissionLiveVO; | ||||
import com.tuoheng.admin.service.IDspService; | import com.tuoheng.admin.service.IDspService; | ||||
import com.tuoheng.admin.service.IMissionService; | import com.tuoheng.admin.service.IMissionService; | ||||
import com.tuoheng.admin.service.IThInspectionService; | import com.tuoheng.admin.service.IThInspectionService; | ||||
import com.tuoheng.admin.service.mission.query.QueryEmergencyListService; | |||||
import com.tuoheng.admin.service.mission.query.QueryMissionListService; | |||||
import com.tuoheng.admin.utils.CodeUtil; | import com.tuoheng.admin.utils.CodeUtil; | ||||
import com.tuoheng.admin.utils.TimeUtil; | import com.tuoheng.admin.utils.TimeUtil; | ||||
import com.tuoheng.admin.utils.WeatherUtil; | import com.tuoheng.admin.utils.WeatherUtil; | ||||
import com.tuoheng.common.common.BaseServiceImpl; | import com.tuoheng.common.common.BaseServiceImpl; | ||||
import com.tuoheng.common.common.OperationEnum; | |||||
import com.tuoheng.common.config.CommonConfig; | |||||
import com.tuoheng.common.exception.ServiceException; | import com.tuoheng.common.exception.ServiceException; | ||||
import com.tuoheng.common.utils.*; | import com.tuoheng.common.utils.*; | ||||
import com.tuoheng.system.entity.User; | import com.tuoheng.system.entity.User; | ||||
import com.tuoheng.system.mapper.UserMapper; | import com.tuoheng.system.mapper.UserMapper; | ||||
import com.tuoheng.system.utils.ShiroUtils; | import com.tuoheng.system.utils.ShiroUtils; | ||||
import io.swagger.models.auth.In; | |||||
import lombok.extern.slf4j.Slf4j; | import lombok.extern.slf4j.Slf4j; | ||||
import org.springframework.beans.BeanUtils; | import org.springframework.beans.BeanUtils; | ||||
import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
import org.springframework.context.annotation.Lazy; | import org.springframework.context.annotation.Lazy; | ||||
import org.springframework.http.HttpStatus; | import org.springframework.http.HttpStatus; | ||||
import org.springframework.stereotype.Service; | import org.springframework.stereotype.Service; | ||||
import org.springframework.transaction.annotation.Transactional; | |||||
import org.springframework.util.Assert; | import org.springframework.util.Assert; | ||||
import javax.annotation.Resource; | import javax.annotation.Resource; | ||||
@Lazy | @Lazy | ||||
private IThInspectionService inspectionService; | private IThInspectionService inspectionService; | ||||
@Resource | |||||
private QueryMissionListService queryMissionListService; | |||||
@Resource | |||||
private QueryEmergencyListService queryEmergencyListService; | |||||
@Value("${tuoheng.dsp-callback-url:}") | @Value("${tuoheng.dsp-callback-url:}") | ||||
private String dspCallbackUrl; | private String dspCallbackUrl; | ||||
return JsonResult.success(liveChannelVo); | return JsonResult.success(liveChannelVo); | ||||
} | } | ||||
/** | |||||
* 查询任务列表 | |||||
* | |||||
* @return | |||||
*/ | |||||
@Override | |||||
public JsonResult getList(QueryMissionListRequest request) { | |||||
return queryMissionListService.getList(request); | |||||
} | |||||
@Override | |||||
public JsonResult getEmergencyList(QueryEmergencyListRequest request) { | |||||
return queryEmergencyListService.getList(request); | |||||
} | |||||
} | } |
package com.tuoheng.admin.service.mission.query; | |||||
import cn.hutool.core.collection.CollectionUtil; | |||||
import cn.hutool.core.util.ObjectUtil; | |||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |||||
import com.tuoheng.admin.entity.domain.Camera; | |||||
import com.tuoheng.admin.entity.domain.ThMission; | |||||
import com.tuoheng.admin.entity.request.camera.QueryCameraListRequest; | |||||
import com.tuoheng.admin.entity.request.emergency.QueryEmergencyListRequest; | |||||
import com.tuoheng.admin.enums.MarkEnum; | |||||
import com.tuoheng.admin.enums.MissionEnum; | |||||
import com.tuoheng.admin.enums.TaskStatusEnum; | |||||
import com.tuoheng.admin.mapper.CameraMapper; | |||||
import com.tuoheng.admin.mapper.ThMissionMapper; | |||||
import com.tuoheng.common.utils.JsonResult; | |||||
import com.tuoheng.system.entity.User; | |||||
import lombok.extern.slf4j.Slf4j; | |||||
import org.springframework.beans.factory.annotation.Autowired; | |||||
import org.springframework.stereotype.Service; | |||||
import java.util.ArrayList; | |||||
import java.util.List; | |||||
/** | |||||
* 查询应急任务列表业务层处理 | |||||
* | |||||
* @author wanjing | |||||
* @team tuoheng | |||||
* @date 2023-02-13 | |||||
*/ | |||||
@Slf4j | |||||
@Service | |||||
public class QueryEmergencyListService { | |||||
@Autowired | |||||
private ThMissionMapper thMissionMapper; | |||||
public JsonResult getList(QueryEmergencyListRequest request) { | |||||
// log.info("进入查询应急任务列表业务"); | |||||
// User user = ShiroUtils.getUserInfo(); | |||||
// Integer tenantId = user.getTenantId(); | |||||
Integer tenantId = 1; | |||||
request.setTenantId(tenantId); | |||||
JsonResult result = this.check(tenantId, request); | |||||
if (0 != result.getCode()) { | |||||
log.info("进入查询应急任务列表业务:校验失败:{}", result.getMsg()); | |||||
return result; | |||||
} | |||||
List<ThMission> missionList = thMissionMapper.selectList(new LambdaQueryWrapper<ThMission>() | |||||
.eq(ThMission::getMark, MarkEnum.VALID.getCode()) | |||||
.eq(ThMission::getTenantId, tenantId) | |||||
.eq(ObjectUtil.isNotEmpty(request.getAirportFlyType()), ThMission::getAirportFlyType, request.getAirportFlyType()) | |||||
.in(CollectionUtil.isNotEmpty(request.getStatusList()), ThMission::getStatus, request.getStatusList())); | |||||
if (CollectionUtil.isEmpty(missionList)) { | |||||
log.info("应急任务列表数据为空"); | |||||
} | |||||
return JsonResult.success(missionList); | |||||
} | |||||
/** | |||||
* 检查参数 | |||||
* | |||||
* @param tenantId | |||||
* @param request | |||||
* @return | |||||
*/ | |||||
private JsonResult check(Integer tenantId, QueryEmergencyListRequest request) { | |||||
return JsonResult.success(); | |||||
} | |||||
} |
package com.tuoheng.admin.service.mission.query; | |||||
import cn.hutool.core.collection.CollectionUtil; | |||||
import com.alibaba.fastjson.JSONArray; | |||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |||||
import com.tuoheng.admin.entity.domain.ThMission; | |||||
import com.tuoheng.admin.entity.request.emergency.QueryMissionListRequest; | |||||
import com.tuoheng.admin.enums.MarkEnum; | |||||
import com.tuoheng.admin.mapper.ThMissionMapper; | |||||
import com.tuoheng.common.utils.JsonResult; | |||||
import lombok.extern.slf4j.Slf4j; | |||||
import org.springframework.beans.factory.annotation.Autowired; | |||||
import org.springframework.stereotype.Service; | |||||
import java.util.List; | |||||
/** | |||||
* 查询任务列表业务层处理 | |||||
* | |||||
* @author wanjing | |||||
* @team tuoheng | |||||
* @date 2023-02-13 | |||||
*/ | |||||
@Slf4j | |||||
@Service | |||||
public class QueryMissionListService { | |||||
@Autowired | |||||
private ThMissionMapper thMissionMapper; | |||||
public JsonResult getList(QueryMissionListRequest request) { | |||||
// log.info("进入查询任务列表业务"); | |||||
// User user = ShiroUtils.getUserInfo(); | |||||
// Integer tenantId = user.getTenantId(); | |||||
Integer tenantId = 1; | |||||
request.setTenantId(tenantId); | |||||
JsonResult result = this.check(tenantId, request); | |||||
if (0 != result.getCode()) { | |||||
log.info("进入查询任务列表业务:校验失败:{}", result.getMsg()); | |||||
return result; | |||||
} | |||||
List<ThMission> missionList = thMissionMapper.selectList(new LambdaQueryWrapper<ThMission>() | |||||
.eq(ThMission::getMark, MarkEnum.VALID.getCode()) | |||||
.eq(ThMission::getTenantId, tenantId) | |||||
.in(CollectionUtil.isNotEmpty(request.getStatusList()), ThMission::getStatus, request.getStatusList())); | |||||
if (CollectionUtil.isEmpty(missionList)) { | |||||
log.info("任务列表数据为空"); | |||||
} | |||||
return JsonResult.success(missionList); | |||||
} | |||||
/** | |||||
* 检查参数 | |||||
* | |||||
* @param tenantId | |||||
* @param request | |||||
* @return | |||||
*/ | |||||
private JsonResult check(Integer tenantId, QueryMissionListRequest request) { | |||||
return JsonResult.success(); | |||||
} | |||||
} |