|
|
|
@ -29,6 +29,7 @@ import org.json.simple.JSONObject;
|
|
|
|
|
import org.json.simple.parser.JSONParser; |
|
|
|
|
import org.json.simple.parser.ParseException; |
|
|
|
|
import org.locationtech.jts.geom.Coordinate; |
|
|
|
|
import org.springframework.beans.factory.annotation.Value; |
|
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
|
@ -47,6 +48,12 @@ import java.util.*;
|
|
|
|
|
@Service |
|
|
|
|
public class CtrCntrlService { |
|
|
|
|
|
|
|
|
|
@Value("${weather.api.url}") |
|
|
|
|
private String weatherUrl; |
|
|
|
|
|
|
|
|
|
@Value("${weather.api.key}") |
|
|
|
|
private String weatherKey; |
|
|
|
|
|
|
|
|
|
private final JwtTokenUtil jwtTokenUtil; |
|
|
|
|
private final CtrTrnsLctnService ctrTrnsLctnService; |
|
|
|
|
private final FltPlanCtrCntrlRelRepository relRepository; |
|
|
|
@ -556,7 +563,7 @@ public class CtrCntrlService {
|
|
|
|
|
|
|
|
|
|
public JSONObject getWeather(CtrCntrlWeatherModel rq) throws IOException, ParseException { |
|
|
|
|
|
|
|
|
|
StringBuilder urlBuilder = new StringBuilder("http://apis.data.go.kr/1360000/VilageFcstInfoService_2.0/getVilageFcst"); |
|
|
|
|
StringBuilder urlBuilder = new StringBuilder(weatherUrl); |
|
|
|
|
|
|
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd"); |
|
|
|
|
Calendar c1 = Calendar.getInstance(); |
|
|
|
@ -636,7 +643,7 @@ public class CtrCntrlService {
|
|
|
|
|
String Snx = String.format("%.0f",nx); |
|
|
|
|
String Sny = String.format("%.0f",ny); |
|
|
|
|
|
|
|
|
|
urlBuilder.append("?" + URLEncoder.encode("serviceKey","UTF-8") + "=r6RMUsk3Vtama7D6uq7MiWV9dTC9MwfIIr4%2F45y0uVNw6BaYbgpKmL%2BLUDFVTfIYUmEe4K%2FaniEjdV9mg5t82Q%3D%3D"); |
|
|
|
|
urlBuilder.append("?" + URLEncoder.encode("serviceKey","UTF-8") + weatherKey); |
|
|
|
|
urlBuilder.append("&" + URLEncoder.encode("pageNo","UTF-8") + "=" + URLEncoder.encode("1","UTF-8")); |
|
|
|
|
urlBuilder.append("&" + URLEncoder.encode("numOfRows","UTF-8") + "=" + URLEncoder.encode("14", "UTF-8")); /*한 페이지 결과 수*/ |
|
|
|
|
urlBuilder.append("&" + URLEncoder.encode("dataType","UTF-8") + "=" + URLEncoder.encode("JSON", "UTF-8")); /*요청자료형식(XML/JSON) Default: XML*/ |
|
|
|
|