package com.multictrl.modules.sys.controller;

import com.google.common.collect.Maps;
import com.multictrl.common.annotation.ApiOrder;
import com.multictrl.common.utils.Result;
import com.multictrl.modules.business.influxdb.UavReport;
import com.multictrl.modules.business.service.InfluxService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.List;

/**
 * 首页提示
 *
 * @author Sdy
 */
@ApiOrder(100)
@Tag(name = "系统测试")
@RestController
@RequiredArgsConstructor
public class IndexController {
    private final InfluxService influxService;

    @GetMapping("/")
    public Result<String> index() {
        String tips = "你好，DJ-MultiCtrl已启动，请启动DJ-MultiCtrl-ui，才能访问页面！";
        return new Result<String>().ok(tips);
    }

    @Operation(summary = "测试")
    @GetMapping("/test")
    public Result<String> test() {
        HashMap<String, Object> condition = Maps.newHashMap();
        condition.put("dockSn", "8UUXP1P00A107D");
        List<UavReport> flyList = influxService.queryData("2026-05-06 14:22:16", "2026-05-06 14:32:16", "uav_osd", condition, UavReport.class,
                "longitude", "latitude", "elevation", "_time");
        System.out.println(flyList);
        return new Result<>();
    }
}
