연계 방식 case에 따른 처리 소스 추가

main
이범준 4 months ago
parent 1219d728f6
commit 14536865b4

@ -1,5 +1,6 @@
package cokr.xit.fims.cvlc.service.bean;
import java.net.http.HttpResponse;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
@ -10,6 +11,11 @@ import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import cokr.xit.base.file.service.FileQuery;
import cokr.xit.base.file.service.bean.FileBean;
import cokr.xit.fims.cmmn.CmmnUtil;
@ -33,10 +39,13 @@ import cokr.xit.fims.sprt.Sprt;
import cokr.xit.fims.sprt.service.bean.MediaBean;
import cokr.xit.foundation.component.AbstractServiceBean;
import cokr.xit.foundation.data.DataObject;
import cokr.xit.foundation.web.WebClient;
import cokr.xit.interfaces.disabledparking.service.bean.DisabledParkingBean;
@Service("crdnCvlcptService")
public class CrdnCvlcptServiceBean extends AbstractServiceBean implements CrdnCvlcptService {
@Resource(name="objectMapper")
private ObjectMapper objectMapper;
@Resource(name="fileBean")
private FileBean fileBean;
@ -463,8 +472,28 @@ public class CrdnCvlcptServiceBean extends AbstractServiceBean implements CrdnCv
}
if(!vehicleResultMap.containsKey(vhrno)) {
DataObject inquireResult;
if(1 != 1) { //TODO:별도서비스여부
String LINK_SRVC_PROTOCOL_IP_PORT = "http://127.0.0.1:9078";
DataObject inquireResult = disabledParkingBean.getParkingInfo(crdnInfo.string("VHRNO"));
HttpResponse<String> apiRslt = new WebClient().post(request -> {
request.contentType(WebClient.Request.ContentType.JSON);
request.uri(LINK_SRVC_PROTOCOL_IP_PORT+"/intf/disabledParking/parkingInfo");
request.data("vehicleNo", crdnInfo.string("VHRNO"));
});
String rslt = apiRslt.body();
try {
inquireResult = objectMapper.readValue(rslt, new TypeReference<DataObject>() {});
} catch (JsonMappingException e) {
e.printStackTrace();
} catch (JsonProcessingException e) {
e.printStackTrace();
}
} else {
inquireResult = disabledParkingBean.getParkingInfo(crdnInfo.string("VHRNO"));
}
String parkingPsblYn = inquireResult.string("PARKING_PSBL_YN");
String bohunParkingPsblYn = inquireResult.string("BOHUN_PARKING_PSBL_YN");

@ -7,6 +7,7 @@ import java.io.FilenameFilter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.lang.reflect.Field;
import java.net.URL;
import java.nio.charset.Charset;
import java.security.cert.CertificateException;
@ -27,6 +28,7 @@ import javax.net.ssl.X509TrustManager;
import org.springframework.stereotype.Component;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import cokr.xit.base.code.CommonCode;
@ -56,6 +58,11 @@ import cokr.xit.fims.nxrp.support.OnlyImageMaker;
import cokr.xit.foundation.component.AbstractBean;
import cokr.xit.foundation.data.DataObject;
import cokr.xit.interfaces.filejob.JobConf;
import cokr.xit.interfaces.lntris.basic.a.LntrisA01;
import cokr.xit.interfaces.lntris.basic.a.LntrisA01.A01Response;
import cokr.xit.interfaces.lntris.basic.a.LntrisA03;
import cokr.xit.interfaces.lntris.basic.a.LntrisA03.A03Response;
import cokr.xit.interfaces.lntris.basic.a.service.LntrisAService;
/** Bean
*
@ -70,6 +77,12 @@ import cokr.xit.interfaces.filejob.JobConf;
@Component("nisIndivBean")
public class NisIndivBean extends AbstractBean {
@Resource(name="objectMapper")
private ObjectMapper objectMapper;
@Resource(name = "lntrisAService")
private LntrisAService lntrisAService;
/** 과태료 대장 단속 정보 등록 정보 DAO */
@Resource(name = "nisA01Mapper")
private NisA01Mapper nisA01Mapper;
@ -279,9 +292,13 @@ public class NisIndivBean extends AbstractBean {
a01.setCreatedBy(userInfo.string("USER_ID"));
a01.setModifiedBy(userInfo.string("USER_ID"));
// 차세대 세외수입 연계 서비스 호출 - A01 과태료 대장 단속 정보 등록
ObjectMapper mapper = new ObjectMapper();
if(1 == 1) { //TODO:별도연계서비스여부
String sUrl = deptInfo.string("NXRP_LINK_SRVC_URL") + "/intf/lntris/a01/register"; // create
ObjectMapper mapper = new ObjectMapper();
String sJsonData = "";
// Json 파라미터 설정
@ -296,6 +313,20 @@ public class NisIndivBean extends AbstractBean {
// 연계 서비스 호출 후 메세지 return
rtnMsg = callHttpsJson(sUrl, "POST", sJsonData);
} else {
LntrisA01.A01ReqDetail rd = (LntrisA01.A01ReqDetail) this.convert(a01, LntrisA01.A01ReqDetail.class);
List<A01Response> res = lntrisAService.registerA01s(a01.getTaskSeCd(), List.of(rd));
A01Response res0 = !res.isEmpty() ? res.get(0) : null;
try {
rtnMsg = objectMapper.writeValueAsString(res0);
} catch (JsonProcessingException e) {
e.printStackTrace();
}
}
return rtnMsg;
}
@ -360,8 +391,10 @@ public class NisIndivBean extends AbstractBean {
a03Rqst.setLinkMngKey(req.getLinkMngKey()); // 연계관리키 시군구코드 + 단속 ID + 년월일시분초
// 차세대 세외수입 연계 서비스 호출 - A01 과태료 대장 단속 정보 등록
ObjectMapper mapper = new ObjectMapper();
if(1 == 1) { //TODO:별도연계서비스여부
String sUrl = deptInfo.string("NXRP_LINK_SRVC_URL") + "/intf/lntris/a03/info"; // create
ObjectMapper mapper = new ObjectMapper();
String sJsonData = "";
// Json 파라미터 설정
@ -377,6 +410,24 @@ public class NisIndivBean extends AbstractBean {
// 연계 서비스 호출 후 메세지 return
rtnMsg = callHttpsJson(sUrl, "POST", sJsonData);
} else {
LntrisA03.A03ReqDetail rd = new LntrisA03.A03ReqDetail();
rd.setSgbCd(a03Rqst.getSgbCd());
rd.setFinScrgAcbKey(a03Rqst.getFinScrgAcbKey());
rd.setLinkMngKey(a03Rqst.getLinkMngKey());
rd.setLinkTrgtCd(a03Rqst.getLinkTrgtCd());
A03Response res = lntrisAService.getA03(a03Rqst.getTaskSeCd(), rd);
try {
rtnMsg = objectMapper.writeValueAsString(res);
} catch (JsonProcessingException e) {
e.printStackTrace();
}
}
return rtnMsg;
}
@ -700,4 +751,17 @@ public class NisIndivBean extends AbstractBean {
return rtnMsg;
}
private Object convert(Object s, Class<? extends Object> t) {
DataObject convert = new DataObject();
DataObject convert2 = new DataObject();
convert = objectMapper.convertValue(s, DataObject.class);
Field[] fs = t.getDeclaredFields();
for(Field f : fs) {
String fn = f.getName();
String val = convert.string(fn);
convert2.set(fn, val);
}
return objectMapper.convertValue(convert2, t);
}
}

Loading…
Cancel
Save