package com.moral.api.controller;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.moral.api.entity.HistorySecondUav;
|
import com.moral.api.mapper.HistorySecondUavMapper;
|
import com.moral.api.pojo.vo.uav.UAVQueryDateVO;
|
import com.moral.api.service.HistorySecondUavService;
|
import com.moral.constant.ResponseCodeEnum;
|
import com.moral.constant.ResultMessage;
|
import io.swagger.annotations.Api;
|
import lombok.extern.slf4j.Slf4j;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.web.bind.annotation.CrossOrigin;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RestController;
|
|
import java.util.Date;
|
import java.util.List;
|
|
/**
|
* @ClassName UAVController
|
* @Description 无人机控制器
|
* @Author 陈凯裕
|
* @Date 2021/8/31 15:08
|
* @Version TODO
|
**/
|
@Slf4j
|
@Api(tags = {"无人机控制器"})
|
@RestController
|
@CrossOrigin(origins = "*", maxAge = 3600)
|
@RequestMapping("/uav")
|
public class UAVController {
|
|
@Autowired
|
HistorySecondUavMapper historySecondUavMapper;
|
@Autowired
|
HistorySecondUavService historySecondUavService;
|
/**
|
* @Description: 根据组织id,mac以及时间查询无人机数据
|
* @Param: []
|
* @return: com.moral.constant.ResultMessage
|
* @Author: 陈凯裕
|
* @Date: 2021/8/31
|
*/
|
@RequestMapping("query")
|
public ResultMessage query(){
|
List<HistorySecondUav> historySecondUavs = historySecondUavMapper.selectList(new QueryWrapper<>());
|
return new ResultMessage(ResponseCodeEnum.SUCCESS.getCode(), ResponseCodeEnum.SUCCESS.getMsg(),historySecondUavs);
|
}
|
|
|
/**
|
* @Description: 查询组织在哪天有无人机飞行,返回具体日期
|
* @Param: [organizationId]
|
* @return: com.moral.constant.ResultMessage
|
* @Author: 陈凯裕
|
* @Date: 2021/9/8
|
*/
|
@RequestMapping("queryDate")
|
public ResultMessage queryDate(Integer organizationId){
|
//处理查询业务
|
List<Date> dates = historySecondUavService.queryDate(organizationId);
|
//封装vo层
|
UAVQueryDateVO vo = UAVQueryDateVO.convert(dates);
|
//返回数据
|
return new ResultMessage(ResponseCodeEnum.SUCCESS.getCode(), ResponseCodeEnum.SUCCESS.getMsg(),vo);
|
}
|
|
}
|