연계 IP 정보 수정

main
이범준 4 months ago
parent 426af3db95
commit 2220903d9f

@ -36,30 +36,29 @@ public class ApiMainServiceImpl implements ApiMainService {
@Override
public List<Map<String, Object>> sisulDefaultList(Map<String, Object> data) {
List<Map<String, Object>> result = new ArrayList<Map<String,Object>>();
try {
String resource = "../api.properties";
Properties properties = new Properties();
Reader reader = Resources.getResourceAsReader(resource);
properties.load(reader);
System.out.println(properties.getProperty("URL"));
URL obj = null;
obj = new URL(properties.getProperty("URL")); // API URL
HttpURLConnection con = (HttpURLConnection)obj.openConnection();
con.setRequestMethod("POST"); // GET, POST
con.setRequestProperty("Content-type", "application/json; charset=UTF-8");
con.setDoOutput(true);
// DATA
JSONObject param = new JSONObject();
param.put("stDate", data.get("stDate"));
param.put("edDate", data.get("edDate"));
// param.put("residentNo", data.get("residentNo"));
param.put("carNo", data.get("carNo"));
OutputStreamWriter wr= new OutputStreamWriter(con.getOutputStream());
wr.write(param.toString());
wr.flush();
@ -70,74 +69,70 @@ public class ApiMainServiceImpl implements ApiMainService {
while((line = in.readLine()) != null){
sb.append(line);
}
// System.out.println(sb.toString());
JSONParser parser = new JSONParser();
JSONArray jsonResult = (JSONArray)parser.parse(sb.toString());
Map<String, Object> resCode = new HashMap<>();
resCode.put("resCode", con.getResponseCode());
result.add(resCode);
if(jsonResult.size() != 0) {
result = getListMapFromJsonArray(jsonResult);
}
in.close();
con.disconnect();
// String text = sb.toString();
// ObjectMapper mapper = new ObjectMapper();
//
// Map<String, Object> map = mapper.readValue(text, Map.class);
} catch (JsonMappingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (JsonProcessingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
// return map;
return result;
}
public List<Map<String, Object>> sisulPenaltyList(Map<String, Object> data) {
@Override
public List<Map<String, Object>> sisulPenaltyList(Map<String, Object> data) {
List<Map<String, Object>> result = new ArrayList<Map<String,Object>>();
try {
String resource = "../api.properties";
Properties properties = new Properties();
Reader reader = Resources.getResourceAsReader(resource);
properties.load(reader);
// System.out.println(properties.getProperty("URL"));
URL obj = null;
obj = new URL(properties.getProperty("PENALTY")); // API URL
HttpURLConnection con = (HttpURLConnection)obj.openConnection();
con.setRequestMethod("POST"); // GET, POST
con.setRequestProperty("Content-type", "application/json; charset=UTF-8");
con.setDoOutput(true);
// DATA
JSONObject param = new JSONObject();
param.put("workerId", data.get("workerId"));
param.put("fareOfficeId", data.get("fareOfficeId"));
param.put("boothId", data.get("boothId"));
param.put("passDate", data.get("passDate"));
param.put("workTimes", data.get("workTimes"));
param.put("seqno", data.get("seqno"));
OutputStreamWriter wr= new OutputStreamWriter(con.getOutputStream());
wr.write(param.toString());
wr.flush();
@ -148,63 +143,64 @@ public class ApiMainServiceImpl implements ApiMainService {
while((line = in.readLine()) != null){
sb.append(line);
}
JSONParser parser = new JSONParser();
JSONArray jsonResult = (JSONArray)parser.parse(sb.toString());
Map<String, Object> resCode = new HashMap<>();
resCode.put("resCode", con.getResponseCode());
result.add(resCode);
if(jsonResult.size() != 0) {
result = getListMapFromJsonArray(jsonResult);
}
in.close();
con.disconnect();
} catch (JsonMappingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (JsonProcessingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
// return map;
return result;
}
public List<Map<String, Object>> selectSisulDefaultResiList(Map<String, Object> data) {
@Override
public List<Map<String, Object>> selectSisulDefaultResiList(Map<String, Object> data) {
List<Map<String, Object>> result = new ArrayList<Map<String,Object>>();
try {
String resource = "../api.properties";
Properties properties = new Properties();
Reader reader = Resources.getResourceAsReader(resource);
properties.load(reader);
// System.out.println(properties.getProperty("URL"));
URL obj = null;
obj = new URL(properties.getProperty("DEFAULT")); // API URL
HttpURLConnection con = (HttpURLConnection)obj.openConnection();
con.setRequestMethod("POST"); // GET, POST
con.setRequestProperty("Content-type", "application/json; charset=UTF-8");
con.setDoOutput(true);
// DATA
JSONObject param = new JSONObject();
param.put("carNo", data.get("carNo"));
param.put("residentNo", data.get("residentNo"));
OutputStreamWriter wr= new OutputStreamWriter(con.getOutputStream());
wr.write(param.toString());
wr.flush();
@ -215,64 +211,64 @@ public class ApiMainServiceImpl implements ApiMainService {
while((line = in.readLine()) != null){
sb.append(line);
}
JSONParser parser = new JSONParser();
JSONArray jsonResult = (JSONArray)parser.parse(sb.toString());
Map<String, Object> resCode = new HashMap<>();
resCode.put("resCode", con.getResponseCode());
result.add(resCode);
System.out.println("jsonResult"+ jsonResult.toJSONString());
if(jsonResult.size() != 0) {
result = getListMapFromJsonArray(jsonResult);
}
in.close();
con.disconnect();
} catch (JsonMappingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (JsonProcessingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
// return map;
return result;
}
public List<Map<String, Object>> selectSisulOverList(Map<String, Object> data) {
@Override
public List<Map<String, Object>> selectSisulOverList(Map<String, Object> data) {
List<Map<String, Object>> result = new ArrayList<Map<String,Object>>();
try {
String resource = "../api.properties";
Properties properties = new Properties();
Reader reader = Resources.getResourceAsReader(resource);
properties.load(reader);
// System.out.println(properties.getProperty("URL"));
URL obj = null;
obj = new URL(properties.getProperty("OVER")); // API URL
HttpURLConnection con = (HttpURLConnection)obj.openConnection();
con.setRequestMethod("POST"); // GET, POST
con.setRequestProperty("Content-type", "application/json; charset=UTF-8");
con.setDoOutput(true);
// DATA
JSONObject param = new JSONObject();
param.put("carNo", data.get("carNo"));
OutputStreamWriter wr= new OutputStreamWriter(con.getOutputStream());
wr.write(param.toString());
wr.flush();
@ -283,41 +279,40 @@ public class ApiMainServiceImpl implements ApiMainService {
while((line = in.readLine()) != null){
sb.append(line);
}
JSONParser parser = new JSONParser();
JSONArray jsonResult = (JSONArray)parser.parse(sb.toString());
Map<String, Object> resCode = new HashMap<>();
resCode.put("resCode", con.getResponseCode());
result.add(resCode);
System.out.println("jsonResult"+ jsonResult.toJSONString());
if(jsonResult.size() != 0) {
result = getListMapFromJsonArray(jsonResult);
}
in.close();
con.disconnect();
} catch (JsonMappingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (JsonProcessingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
// return map;
return result;
}
/**
* jsonObject --> map
* JSONObject JSONArray .
@ -335,7 +330,7 @@ public class ApiMainServiceImpl implements ApiMainService {
throw new RuntimeException(e);
}
}
/**
* json array list map .
*
@ -352,6 +347,6 @@ public class ApiMainServiceImpl implements ApiMainService {
}
return list;
}
}

@ -1,16 +1,12 @@
#연계 서비스 URL
#미납 기간 조회 api
#\uc5f0\uacc4 \uc11c\ube44\uc2a4 URL
#\ubbf8\ub0a9 \uae30\uac04\uc9c0\uc815 \uc870\ud68c api
URL=http://175.193.201:92/rest/cfs/sisulDefaultNotification.do
#과태료 조회 api
#\uacfc\ud0dc\ub8cc \uc870\ud68c api
PENALTY=http://175.193.201:92/rest/cfs/sisulPenaltyNotification.do
#미납 전체 조회 api
#DEFAULT=http://175.193.201:92/rest/cfs/selectSisulDefaultResiList.do
DEFAULT=http://localhost:8080/rest/cfs/selectSisulDefaultResiList.do
#URL=http://98.43.129.52:8080/rest/cfs/sisulDefaultNotification.do
#URL=http://175.193.201:92/rest/cfs/sisulDefaultNotification.do
#\ubbf8\ub0a9 \uc870\ud68c api
DEFAULT=http://175.193.201:92/rest/cfs/selectSisulDefaultResiList.do
#과오납 조회 api
#OVER=http://175.193.201:92/rest/cfs/selectSisulOverFareList.do
OVER=http://localhost:8080/rest/cfs/selectSisulOverFareList.do
#\uacfc\uc624\ub0a9 \uc870\ud68c api
OVER=http://175.193.201:92/rest/cfs/selectSisulOverFareList.do

Loading…
Cancel
Save