개별, 특화 동시 지원을 위한 설정/소스 변경

master
mjkhan21 1 year ago
parent 38c8e38b52
commit ea41d7aa40

@ -0,0 +1,13 @@
package cokr.xit.interfaces.lntris;
/**
* @param <Q>
* @param <R>
* @author mjkhan
*/
public abstract class BasicInterface<Q extends SourceMessage.Request, R extends TargetMessage.Response> extends InterfaceInfo<Q, R> {
@Override
public String type() {
return "basic";
}
}

@ -1,6 +1,7 @@
package cokr.xit.interfaces.lntris; package cokr.xit.interfaces.lntris;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.function.Supplier; import java.util.function.Supplier;
import org.springframework.core.io.ClassPathResource; import org.springframework.core.io.ClassPathResource;
@ -142,7 +143,7 @@ public class InterfaceConfig extends AbstractComponent {
public static class EndPoint { public static class EndPoint {
private String organization; private String organization;
private List<String> systems; private List<String> systems;
private String url; private Map<String, String> urls;
/**/ . /**/ .
* @return / * @return /
@ -166,14 +167,15 @@ public class InterfaceConfig extends AbstractComponent {
return !orgSys.isEmpty() ? orgSys.get(0) : ""; return !orgSys.isEmpty() ? orgSys.get(0) : "";
} }
/**/ url . /** url .
* @return / url * @param target
* <ul><li>/ url true</li> * <ul><li>basic - </li>
* <li> false</li> * <li>special - </li>
* </ul> * </ul>
* @return url
*/ */
public boolean isLocal() { public String getUrl(String target) {
return ifEmpty(url, "").contains("localhost"); return urls.get(target);
} }
} }
} }

@ -28,6 +28,16 @@ public abstract class InterfaceInfo<Q extends SourceMessage.Request, R extends T
protected TargetMessage<R> targetMessage; protected TargetMessage<R> targetMessage;
private JSON json; private JSON json;
/** .
* @return
* <ul><li>basic - </li>
* <li>special - </li>
* </ul>
*/
public String type() {
return "";
}
/**() . /**() .
* @return () * @return ()
*/ */

@ -64,7 +64,7 @@ public class Requestor {
String src = intfInfo.getSourceMessage().getHeader().getSource(); String src = intfInfo.getSourceMessage().getHeader().getSource();
HttpResponse<String> hresp = webClient.post(req -> req HttpResponse<String> hresp = webClient.post(req -> req
.uri(InterfaceConfig.remote().getUrl()) .uri(InterfaceConfig.remote().getUrl(intfInfo.type()))
.json(json) .json(json)
.header("Accept-Charset", "UTF-8") .header("Accept-Charset", "UTF-8")

@ -0,0 +1,13 @@
package cokr.xit.interfaces.lntris;
/**
* @param <Q>
* @param <R>
* @author mjkhan
*/
public abstract class SpecialInterface<Q extends SourceMessage.Request, R extends TargetMessage.Response> extends InterfaceInfo<Q, R> {
@Override
public String type() {
return "special";
}
}

@ -1,4 +1,6 @@
{ {
"useDatabase": false,
"locals": [ "locals": [
{"organization": "4060000",/* 지역 자치단체 코드(7자리) */ {"organization": "4060000",/* 지역 자치단체 코드(7자리) */
/* 지역 시스템 코드(3자리) */ /* 지역 시스템 코드(3자리) */
@ -8,8 +10,12 @@
"remote": { "remote": {
"organization": "1741000", /* 지방세외수입 기관 코드(7자리) */ "organization": "1741000", /* 지방세외수입 기관 코드(7자리) */
"systems": ["NIS"], /* 지방세외수입 시스템 코드(3자리) */ "systems": ["NIS"], /* 지방세외수입 시스템 코드(3자리) */
/*"url": "https://10.60.75.57:22411/mediate/ltis" /* 연계 운영 url */ "urls": {
"url": "https://10.60.75.138:22411/mediate/ltis" /* 연계 검증 url */ "basic": "https://10.60.75.57:22411/mediate/ltis", /* 연계(개별) 운영 url */
/*"basic": "https://10.60.75.138:22411/mediate/ltis", /* 연계(개별) 검증 url */
"special": "https://10.60.75.57:32411/mediate/ltis" /* 연계(특화) 운영 url */
}
} }
} }

@ -15,7 +15,8 @@ public class InterfaceConfigTest extends TestSupport {
System.out.println("organization: " + remote.getOrganization()); System.out.println("organization: " + remote.getOrganization());
System.out.println("systems: " + remote.getSystems().stream().collect(Collectors.joining(", "))); System.out.println("systems: " + remote.getSystems().stream().collect(Collectors.joining(", ")));
System.out.println("organizationSystem: " + remote.getOrganizationSystem()); System.out.println("organizationSystem: " + remote.getOrganizationSystem());
System.out.println("url: " + remote.getUrl()); System.out.println("basic url: " + remote.getUrl("basic"));
System.out.println("special url: " + remote.getUrl("special"));
System.out.println("========== locals =========="); System.out.println("========== locals ==========");
InterfaceConfig.locals().forEach(local -> { InterfaceConfig.locals().forEach(local -> {

Loading…
Cancel
Save