소스정리

main
이범준 4 months ago
parent 2220903d9f
commit 63492b7efc

@ -20,11 +20,6 @@ public class ApiMainController {
@Resource(name = "apiMainService")
private ApiMainService apiMainService;
@RequestMapping(value = "/sisulDefaultList", produces = "application/json; charset=utf8", method=RequestMethod.POST)
public List<Map<String, Object>> sisulDefaultList(@RequestBody Map<String, Object> data) {
return apiMainService.sisulDefaultList(data);
}
@RequestMapping(value = "/sisulPenaltyList", produces = "application/json; charset=utf8", method=RequestMethod.POST)
public List<Map<String, Object>> sisulPenaltyList(@RequestBody Map<String, Object> data) {
return apiMainService.sisulPenaltyList(data);
@ -40,4 +35,9 @@ public class ApiMainController {
return apiMainService.selectSisulOverList(data);
}
@RequestMapping(value = "/sisulDefaultList", produces = "application/json; charset=utf8", method=RequestMethod.POST)
public List<Map<String, Object>> sisulDefaultList(@RequestBody Map<String, Object> data) {
return apiMainService.sisulDefaultList(data);
}
}

@ -5,7 +5,6 @@ import java.util.Map;
public interface ApiMainService {
List<Map<String, Object>> sisulDefaultList(Map<String, Object> data);
List<Map<String, Object>> sisulPenaltyList(Map<String, Object> data);
@ -13,5 +12,6 @@ public interface ApiMainService {
List<Map<String, Object>> selectSisulOverList(Map<String, Object> data);
List<Map<String, Object>> sisulDefaultList(Map<String, Object> data);
}

@ -32,9 +32,8 @@ import com.ibatis.common.resources.Resources;
@Transactional
public class ApiMainServiceImpl implements ApiMainService {
@SuppressWarnings("unchecked")
@Override
public List<Map<String, Object>> sisulDefaultList(Map<String, Object> data) {
public List<Map<String, Object>> sisulPenaltyList(Map<String, Object> data) {
List<Map<String, Object>> result = new ArrayList<Map<String,Object>>();
try {
@ -44,7 +43,7 @@ public class ApiMainServiceImpl implements ApiMainService {
properties.load(reader);
URL obj = null;
obj = new URL(properties.getProperty("URL")); // API URL
obj = new URL(properties.getProperty("PENALTY")); // API URL
HttpURLConnection con = (HttpURLConnection)obj.openConnection();
con.setRequestMethod("POST"); // GET, POST
@ -55,9 +54,12 @@ public class ApiMainServiceImpl implements ApiMainService {
// DATA
JSONObject param = new JSONObject();
param.put("stDate", data.get("stDate"));
param.put("edDate", data.get("edDate"));
param.put("carNo", data.get("carNo"));
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());
@ -70,7 +72,6 @@ public class ApiMainServiceImpl implements ApiMainService {
sb.append(line);
}
JSONParser parser = new JSONParser();
JSONArray jsonResult = (JSONArray)parser.parse(sb.toString());
@ -86,7 +87,6 @@ public class ApiMainServiceImpl implements ApiMainService {
in.close();
con.disconnect();
} catch (JsonMappingException e) {
e.printStackTrace();
@ -105,7 +105,7 @@ public class ApiMainServiceImpl implements ApiMainService {
}
@Override
public List<Map<String, Object>> sisulPenaltyList(Map<String, Object> data) {
public List<Map<String, Object>> selectSisulDefaultResiList(Map<String, Object> data) {
List<Map<String, Object>> result = new ArrayList<Map<String,Object>>();
try {
@ -115,7 +115,7 @@ public class ApiMainServiceImpl implements ApiMainService {
properties.load(reader);
URL obj = null;
obj = new URL(properties.getProperty("PENALTY")); // API URL
obj = new URL(properties.getProperty("DEFAULT")); // API URL
HttpURLConnection con = (HttpURLConnection)obj.openConnection();
con.setRequestMethod("POST"); // GET, POST
@ -126,12 +126,8 @@ public class ApiMainServiceImpl implements ApiMainService {
// 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"));
param.put("carNo", data.get("carNo"));
param.put("residentNo", data.get("residentNo"));
OutputStreamWriter wr= new OutputStreamWriter(con.getOutputStream());
wr.write(param.toString());
@ -150,6 +146,7 @@ public class ApiMainServiceImpl implements ApiMainService {
Map<String, Object> resCode = new HashMap<>();
resCode.put("resCode", con.getResponseCode());
result.add(resCode);
if(jsonResult.size() != 0) {
result = getListMapFromJsonArray(jsonResult);
}
@ -177,7 +174,7 @@ public class ApiMainServiceImpl implements ApiMainService {
}
@Override
public List<Map<String, Object>> selectSisulDefaultResiList(Map<String, Object> data) {
public List<Map<String, Object>> selectSisulOverList(Map<String, Object> data) {
List<Map<String, Object>> result = new ArrayList<Map<String,Object>>();
try {
@ -187,7 +184,7 @@ public class ApiMainServiceImpl implements ApiMainService {
properties.load(reader);
URL obj = null;
obj = new URL(properties.getProperty("DEFAULT")); // API URL
obj = new URL(properties.getProperty("OVER")); // API URL
HttpURLConnection con = (HttpURLConnection)obj.openConnection();
con.setRequestMethod("POST"); // GET, POST
@ -199,7 +196,6 @@ public class ApiMainServiceImpl implements ApiMainService {
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());
@ -245,8 +241,10 @@ public class ApiMainServiceImpl implements ApiMainService {
return result;
}
@SuppressWarnings("unchecked")
@Override
public List<Map<String, Object>> selectSisulOverList(Map<String, Object> data) {
public List<Map<String, Object>> sisulDefaultList(Map<String, Object> data) {
List<Map<String, Object>> result = new ArrayList<Map<String,Object>>();
try {
@ -256,7 +254,7 @@ public class ApiMainServiceImpl implements ApiMainService {
properties.load(reader);
URL obj = null;
obj = new URL(properties.getProperty("OVER")); // API URL
obj = new URL(properties.getProperty("URL")); // API URL
HttpURLConnection con = (HttpURLConnection)obj.openConnection();
con.setRequestMethod("POST"); // GET, POST
@ -267,6 +265,8 @@ public class ApiMainServiceImpl implements ApiMainService {
// DATA
JSONObject param = new JSONObject();
param.put("stDate", data.get("stDate"));
param.put("edDate", data.get("edDate"));
param.put("carNo", data.get("carNo"));
OutputStreamWriter wr= new OutputStreamWriter(con.getOutputStream());
@ -280,13 +280,13 @@ public class ApiMainServiceImpl implements ApiMainService {
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);
}
@ -296,6 +296,7 @@ public class ApiMainServiceImpl implements ApiMainService {
in.close();
con.disconnect();
} catch (JsonMappingException e) {
e.printStackTrace();

Loading…
Cancel
Save