| | |
| | | package com.moral.api.controller; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; |
| | | import com.moral.api.entity.HistorySecondUav; |
| | | import com.moral.api.mapper.HistorySecondUavMapper; |
| | | import com.moral.api.pojo.dto.uav.UAVGetBD; |
| | | import com.moral.api.pojo.dto.uav.UAVGteForDTO; |
| | | import com.moral.api.pojo.dto.uav.UAVQueryTimeSlotDTO; |
| | | import com.moral.api.pojo.dto.uav.UAVResultDTO; |
| | | import com.moral.api.pojo.form.uav.UAVQueryTimeSlotForm; |
| | | import com.moral.api.pojo.vo.uav.HistorySecondUavVOs; |
| | | import com.moral.api.pojo.vo.uav.UAVQueryDateVO; |
| | | import com.moral.api.pojo.vo.uav.UAVQueryTimeSlotVO; |
| | | import com.moral.api.pojo.vo.uav.UAVQueryTimeSlotVOs; |
| | | import com.moral.api.service.HistorySecondUavService; |
| | | import com.moral.api.service.UAVService; |
| | | import com.moral.constant.ResponseCodeEnum; |
| | | import com.moral.constant.ResultMessage; |
| | | import com.moral.util.DateUtils; |
| | | 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 org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.awt.geom.GeneralPath; |
| | | import java.awt.geom.Point2D; |
| | | import java.math.BigDecimal; |
| | | import java.text.DecimalFormat; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * @ClassName UAVController |
| | |
| | | HistorySecondUavService historySecondUavService; |
| | | @Autowired |
| | | HistorySecondUavMapper historySecondUavMapper; |
| | | @Autowired |
| | | UAVService uavService; |
| | | |
| | | /** |
| | | * @Description: 根据批次号查询无人机飞行数据 |
| | |
| | | return new ResultMessage(ResponseCodeEnum.SUCCESS.getCode(), ResponseCodeEnum.SUCCESS.getMsg(),vo); |
| | | } |
| | | |
| | | @RequestMapping("test") |
| | | public ResultMessage test(String batch){ |
| | | QueryWrapper<HistorySecondUav> wrapper = new QueryWrapper(); |
| | | wrapper.select("value"); |
| | | wrapper.eq("batch", "2021-07-08 01:00:00"); |
| | | List<HistorySecondUav> datas = historySecondUavMapper.selectList(wrapper); |
| | | return new ResultMessage(ResponseCodeEnum.SUCCESS.getCode(), ResponseCodeEnum.SUCCESS.getMsg(),datas); |
| | | @PostMapping("getUav") |
| | | public ResultMessage test(@RequestBody Map<String, Object> params){ |
| | | //判断是否缺少参数 |
| | | if (!params.containsKey("mac") || !params.containsKey("batch") || !params.containsKey("height1")|| !params.containsKey("uvasize")|| !params.containsKey("height2")) { |
| | | return ResultMessage.fail(ResponseCodeEnum.PARAMETERS_IS_MISSING.getCode(), ResponseCodeEnum.PARAMETERS_IS_MISSING.getMsg()); |
| | | } |
| | | List<UAVResultDTO> uavResultDTOS = uavService.getUav(params); |
| | | if (ObjectUtils.isEmpty(uavResultDTOS)){ |
| | | return new ResultMessage(ResponseCodeEnum.SENSOR_IS_NOT_EXIST,"null"); |
| | | } |
| | | return new ResultMessage(ResponseCodeEnum.SUCCESS.getCode(), ResponseCodeEnum.SUCCESS.getMsg(),uavResultDTOS); |
| | | } |
| | | |
| | | |
| | |
| | | ResponseCodeEnum.PARAMETERS_IS_MISSING.getMsg()); |
| | | //处理查询业务 |
| | | List<UAVQueryTimeSlotDTO> dtos = historySecondUavService.queryTimeSlot(form); |
| | | if (ObjectUtils.isEmpty(dtos)){ |
| | | return new ResultMessage(ResponseCodeEnum.TARGET_IS_NULL,null); |
| | | } |
| | | //封装vo层 |
| | | UAVQueryTimeSlotVOs vo = UAVQueryTimeSlotVOs.convert(dtos); |
| | | |
| | | //返回数据 |
| | | return new ResultMessage(ResponseCodeEnum.SUCCESS.getCode(), ResponseCodeEnum.SUCCESS.getMsg(),vo); |
| | | } |
| | | |
| | | @GetMapping("UAVTest") |
| | | public ResultMessage UAVTest(BigDecimal lat, BigDecimal lon, String batch){ |
| | | historySecondUavService.UAVTest(lat, lon, batch); |
| | | return new ResultMessage(); |
| | | } |
| | | |
| | | } |