feat : Bssh관련 서비스 추가

dev
Leeyh1121 5 months ago
parent 0365c210e4
commit dd72ddff41

@ -0,0 +1,161 @@
package cokr.xit.adds.nims;
import cokr.xit.foundation.component.QueryRequest;
/**
*
* <p> :
*
* <pre>
* ============ ============
* 2023-06-23 leebj
* ================================
* </pre>
*/
public class BsshQuery extends QueryRequest{
private static final long serialVersionUID = 1L;
//검색조건
private String schBsshCd; // 취급자 식별번호
private String schBsshNm; // 취급자 명
//저장소 정보
private String bsshCd; // 취급자 식별번호
private String bsshNm; // 취급자명
private String indutyNm; // 업종명
private String hdntCd; // 의료업자 구분
private String hdntNm; // 의료업자 구분명
private String bizrno; // 사업자등록번호
private String rprsntvNm; // 대표자 명
private String chrgNm; // 담당자 명
private String hptlNo; // 요양기관 기호
private String joinYn; // 획원가입 여부
private String bsshSttsNm; // 상태
private String prmisnNo; // 허가 번호
public String getSchBsshCd() {
return ifEmpty(schBsshCd, () -> null);
}
public <T extends BsshQuery> T setSchBsshCd(String schBsshCd) {
this.schBsshCd = schBsshCd;
return self();
}
public String getSchBsshNm() {
return ifEmpty(schBsshNm, () -> null);
}
public <T extends BsshQuery> T setSchBsshNm(String schBsshNm) {
this.schBsshNm = schBsshNm;
return self();
}
public String getbsshCd() {
return ifEmpty(bsshCd, () -> null);
}
public <T extends BsshQuery> T setbsshCd(String bsshCd) {
this.bsshCd = bsshCd;
return self();
}
public String getbsshNm() {
return ifEmpty(bsshNm, () -> null);
}
public <T extends BsshQuery> T setbsshNm(String bsshNm) {
this.bsshNm = bsshNm;
return self();
}
public String getindutyNm() {
return ifEmpty(indutyNm, () -> null);
}
public <T extends BsshQuery> T setindutyNm(String indutyNm) {
this.indutyNm = indutyNm;
return self();
}
public String gethdntCd() {
return ifEmpty(hdntCd, () -> null);
}
public <T extends BsshQuery> T sethdntCd(String hdntCd) {
this.hdntCd = hdntCd;
return self();
}
public String gethdntNm() {
return ifEmpty(hdntNm, () -> null);
}
public <T extends BsshQuery> T sethdntNm(String hdntNm) {
this.hdntNm = hdntNm;
return self();
}
public String getbizrno() {
return ifEmpty(bizrno, () -> null);
}
public <T extends BsshQuery> T setbizrno(String bizrno) {
this.bizrno = bizrno;
return self();
}
public String getrprsntvNm() {
return ifEmpty(rprsntvNm, () -> null);
}
public <T extends BsshQuery> T setrprsntvNm(String rprsntvNm) {
this.rprsntvNm = rprsntvNm;
return self();
}
public String getchrgNm() {
return ifEmpty(chrgNm, () -> null);
}
public <T extends BsshQuery> T setchrgNm(String chrgNm) {
this.chrgNm = chrgNm;
return self();
}
public String gethptlNo() {
return ifEmpty(hptlNo, () -> null);
}
public <T extends BsshQuery> T sethptlNo(String hptlNo) {
this.hptlNo = hptlNo;
return self();
}
public String getjoinYn() {
return ifEmpty(joinYn, () -> null);
}
public <T extends BsshQuery> T setjoinYn(String joinYn) {
this.joinYn = joinYn;
return self();
}
public String getbsshSttsNm() {
return ifEmpty(bsshSttsNm, () -> null);
}
public <T extends BsshQuery> T setbsshSttsNm(String bsshSttsNm) {
this.bsshSttsNm = bsshSttsNm;
return self();
}
public String getprmisnNo() {
return ifEmpty(prmisnNo, () -> null);
}
public <T extends BsshQuery> T setprmisnNo(String prmisnNo) {
this.prmisnNo = prmisnNo;
return self();
}
}

@ -0,0 +1,30 @@
package cokr.xit.adds.nims.dao;
import java.util.List;
import org.egovframe.rte.psl.dataaccess.mapper.Mapper;
import cokr.xit.adds.nims.BsshQuery;
import cokr.xit.foundation.component.AbstractMapper;
import cokr.xit.foundation.data.DataObject;
/** DAO
*
* <p> :
*
* <pre>
* ============ ============
* 2023-12-04 JoJH
* ================================
* </pre>
*/
@Mapper("bsshMapper")
public interface BsshMapper extends AbstractMapper {
/** .<br />
* @param req
* @return
*/
List<DataObject> selectBsshList(BsshQuery req);
}

@ -0,0 +1,19 @@
package cokr.xit.adds.nims.service;
import java.util.List;
import cokr.xit.adds.nims.BsshQuery;
import cokr.xit.foundation.data.DataObject;
public interface BsshService {
/** .
* @param query
* <ul><li>pageNum: </li>
* <li>fetchSize: </li>
* </ul>
* @return
*/
List<DataObject> getbsshList(BsshQuery query);
}

@ -0,0 +1,145 @@
package cokr.xit.adds.nims.service.bean;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FilenameFilter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.net.URL;
import java.nio.charset.Charset;
import javax.annotation.Resource;
import javax.net.ssl.HttpsURLConnection;
import org.springframework.stereotype.Service;
import com.fasterxml.jackson.databind.ObjectMapper;
import cokr.xit.adds.nims.BsshQuery;
import cokr.xit.adds.nims.dao.BsshMapper;
import cokr.xit.adds.nims.service.BsshService;
import cokr.xit.foundation.component.AbstractServiceBean;
import cokr.xit.foundation.data.DataObject;
@Service("bsshService")
public class BsshtServiceBean extends AbstractServiceBean implements BsshService {
/** 전자우편 안내문 정보 DAO */
@Resource(name = "bsshMapper")
private BsshMapper bsshMapper;
@Override
public List<DataObject> getbsshList(BsshQuery query){
ObjectMapper mapper = new ObjectMapper();
String sUrl = "http://localhost:9076/api/biz/nims/v1/getNimsBsshInfoSt";
String sJsonData = "";
String rtnMsg = ""; // 처리 결과 메시지
// Json 파라미터 설정
sJsonData = "{ "
+ " \"k\":" + "\"" + "\""
+ ", \"fg\":" + "\"1\""
+ ", \"pg\":" + "\"1\""
+ ", \"bi\":\"\""
+ ", \"hp\":\"\""
+ ", \"bn\":" + query.getSchBsshNm() + "\""
+ ", \"bc\":" + query.getSchBsshCd() + "\""
+ ", \"ymd\":\"\""
+ ", \"fg2\":\"\"1\""
+ ", \"dbSkipYn\":\"\"N\""
+ ", \"userId\":\"suji\""
+ " }";
rtnMsg = callHttpsJson(sUrl, "POST", sJsonData);
return bsshMapper.selectBsshList(query);
}
/** .
* @param req
* @return
*/
public String callHttpsJson(String sUrl, String sMethod, String sJsonData) {
//
String returnMsg = "";
//
HttpsURLConnection httpsConn = null;
try {
// HTTPS 통신을 위한 URL 생성
URL url = new URL(sUrl);
// HttpsURLConnection 객체 생성
httpsConn = (HttpsURLConnection) url.openConnection();
// Content-Type
httpsConn.setRequestProperty("Content-Type", "application/json");
// Method Setting(GET/POST)
httpsConn.setRequestMethod(sMethod); // GET, POST, DELETE
// Connection Timeout setting
httpsConn.setConnectTimeout(10000); // 컨텍션타임아웃 10초
// Read Timeout Setting
httpsConn.setReadTimeout(10000); // 컨텐츠조회 타임아웃 10초
if (sMethod.equals("POST")) {
// Input setting
httpsConn.setDoInput(true);
// Output setting
httpsConn.setDoOutput(true); // 항상 갱신된내용을 가져옴
// POST방식으로 송신할 json 데이터 전송
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(httpsConn.getOutputStream()));
bw.write(sJsonData);
bw.flush();
bw.close();
} else {
// Input setting
httpsConn.setDoInput(false);
// Output setting
httpsConn.setDoOutput(false);
}
// HTTP 응답 코드 수신, 서버에서 보낸 응답 데이터 수신 받기
int responseCode = httpsConn.getResponseCode();
Charset charset = Charset.forName("UTF-8");
String inputLine;
StringBuffer response = new StringBuffer();
if (responseCode == 200) {
BufferedReader in = new BufferedReader(new InputStreamReader(httpsConn.getInputStream(), charset));
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
} else {
BufferedReader in = new BufferedReader(new InputStreamReader(httpsConn.getErrorStream(), charset));
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
}
returnMsg = response.toString();
} catch (IOException e) {
returnMsg = "IOException :" + e;
} catch (Exception e) {
returnMsg = "Exception :" + e;
} finally {
if (httpsConn != null) {
httpsConn.disconnect();
}
}
return returnMsg;
}
}
Loading…
Cancel
Save