package com.goldenwater.slgc.controller.proxy;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.goldenwater.common.core.controller.BaseController;
import com.goldenwater.common.core.domain.AjaxResult;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;

@Tag(name = "26. 天气管理")
@RestController
@RequestMapping("/slgc/weather")
public class WeatherController extends BaseController {

    private static final String ORCL_TBA = "http://10.8.4.68:8888/WebService/Orcl_Tba.asmx/ToStrong";

    @Operation(summary = "26.01 查询云图数据")
    @GetMapping("/yuntu")
    public AjaxResult yuntu(@RequestParam(defaultValue = "") String type,
                            @RequestParam(defaultValue = "") String startDate,
                            @RequestParam(defaultValue = "") String endDate) {
        return success(ProxyHelper.fetchSoapXmlToJson(ORCL_TBA + "?filedown=1&strdate=" + startDate + "&strdate2=" + endDate));
    }

    @Operation(summary = "26.02 查询福建云图数据")
    @GetMapping("/fujian")
    public AjaxResult fujian(@RequestParam(defaultValue = "1") String type,
                             @RequestParam(defaultValue = "") String startDate,
                             @RequestParam(defaultValue = "") String endDate) {
        return success(ProxyHelper.fetchSoapXmlToJson(ORCL_TBA + "?filedown=" + type + "&strdate=" + startDate + "&strdate2=" + endDate));
    }
}
