dlqorgod
396
2015-07-09 07:27:25
0
2009

기관코드 전체자료를 전자정부 표준프레임워크 기관코드(COMTNINSTTCODE) 테이블에 저장하기


http://blog.naver.com/dlqorgod/220414644864

alter table TELNO VARCHAR2 (200 Byte)
alter table FXNUM VARCHAR2 (200 Byte)


package egovframework.com.sym.ccm.icr.service.impl;

import java.io.File;
import java.util.List;

import javax.annotation.Resource;

import org.apache.commons.io.FileUtils;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import egovframework.com.sym.ccm.icr.service.InsttCodeRecptn;

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = { "classpath:egovframework/spring/com/test-dao-context.xml", })
public class InsttCodeRecptnDAOTest {

@Resource(name = "InsttCodeRecptnDAO")
private InsttCodeRecptnDAO insttCodeRecptnDAO;

@Test
public void test() throws Exception {
insertInsttCode();
}

public void insertInsttCode() throws Exception {
String userHome = System.getProperty("user.home");
// String fileSeparator = System.getProperty("file.separator");

// TRUNCATE TABLE comtninsttcode;
// http://www.mogaha.go.kr/frt/sub/a06/b04/codeSearch/screen.do
// 자주찾는 코드 > 조회 순위 > 기관 > 기관코드 전체자료
List<String> readLines = FileUtils.readLines(new File(userHome
+ "/Downloads/기관코드 전체자료/기관코드 전체자료.txt"));


// insttCodeRecptnDAO.getSqlMapClient().startBatch();

int i = 0;

for (String readLine : readLines) {
if (i == 0) {
i++;

continue;
}

System.out.println(readLine);

String[] readLineSplit = readLine.split("\t");

// INSTT_CODE 기관코드
String insttCode = readLineSplit[0];

// ALL_INSTT_NM 전체기관명
String allInsttNm = readLineSplit[1];

// LOWEST_INSTT_NM 최하위기관명
String lowestInsttNm = readLineSplit[2];

// ODR 차수
String odr = readLineSplit[3];

// ORD 서열
String ord = readLineSplit[4];

// INSTT_ODR 기관차수
String insttOdr = readLineSplit[5];

// UPPER_INSTT_CODE 상위기관코드
String upperInsttCode = readLineSplit[6];

// BEST_INSTT_CODE 최상위기관코드
String bestInsttCode = readLineSplit[7];

// REPRSNT_INSTT_CODE 대표기관코드
String reprsntInsttCode = readLineSplit[8];

// INSTT_TY_LCLAS 기관유형대분류
String insttTyLclas = readLineSplit[9];

// INSTT_TY_MLSFC 기관유형중분류
String insttTyMclas = readLineSplit[10];

// INSTT_TY_SCLAS 기관유형소분류
String insttTySclas = readLineSplit[11];

// 우편번호
String zip = readLineSplit[12];

// 행정동코드
String adstrdCode = readLineSplit[13];

// 소재지코드
String locplcCode = readLineSplit[14];

// 나머지주소
String rmndrAdres = readLineSplit[15];

// 지번
String lnm = readLineSplit[16];

// TELNO 전화번호
String telno = readLineSplit[17];

// FXNUM 팩스번호
String fxnum = readLineSplit[18];

// CREAT_DE 생성일
String creatDe = readLineSplit[19];

// ABL_DE 폐지일
String ablDe = readLineSplit[20];

// CHANGE_DE 변경일 변경일자
String changede = readLineSplit[21];

// ABL_ENNC 폐지유무
String ablEnnc = readLineSplit[22];

// 이전기관코드
String beforeInsttCode = null;

if (readLineSplit.length > 23) {
beforeInsttCode = readLineSplit[23];
}

// INSTT_ABRV_NM 기관약어명
String insttAbrvNm = null;

InsttCodeRecptn insttCodeRecptn = new InsttCodeRecptn();
insttCodeRecptn.setInsttCode(insttCode);
insttCodeRecptn.setAllInsttNm(allInsttNm);
insttCodeRecptn.setLowestInsttNm(lowestInsttNm);
insttCodeRecptn.setInsttAbrvNm(insttAbrvNm);
insttCodeRecptn.setOdr(odr);
insttCodeRecptn.setOrd(ord);
insttCodeRecptn.setInsttOdr(insttOdr);
insttCodeRecptn.setUpperInsttCode(upperInsttCode);
insttCodeRecptn.setBestInsttCode(bestInsttCode);
insttCodeRecptn.setReprsntInsttCode(reprsntInsttCode);
insttCodeRecptn.setInsttTyLclas(insttTyLclas);
insttCodeRecptn.setInsttTyMclas(insttTyMclas);
insttCodeRecptn.setInsttTySclas(insttTySclas);
insttCodeRecptn.setTelno(telno);
insttCodeRecptn.setFxnum(fxnum);
insttCodeRecptn.setCreatDe(creatDe);
insttCodeRecptn.setAblDe(ablDe);
insttCodeRecptn.setAblEnnc(ablEnnc);
insttCodeRecptn.setChangede(changede);

Object insert = insttCodeRecptnDAO.insert(
"InsttCodeRecptnDAO.insertInsttCode", insttCodeRecptn);

System.out.println("insert=" + insert);

System.out.println("기관코드=" + insttCode);
System.out.println("전체기관명=" + allInsttNm);
System.out.println("최하위기관명=" + lowestInsttNm);
System.out.println("차수=" + odr);
System.out.println("서열=" + ord);
System.out.println("소속기관차수=" + insttOdr);
System.out.println("차상위기관코드=" + upperInsttCode);
System.out.println("최상위기관코드=" + bestInsttCode);
System.out.println("대표기관코드=" + reprsntInsttCode);
System.out.println("유형분류_대=" + insttTyLclas);
System.out.println("유형분류_중=" + insttTyMclas);
System.out.println("유형분류_소=" + insttTySclas);
System.out.println("x 우편번호=" + zip);
System.out.println("x 행정동코드=" + adstrdCode);
System.out.println("x 소재지코드=" + locplcCode);
System.out.println("x 나머지주소=" + rmndrAdres);
System.out.println("x 지번=" + lnm);
System.out.println("전화번호=" + telno);
System.out.println("팩스번호=" + fxnum);
System.out.println("생성일자=" + creatDe);
System.out.println("폐지일자=" + ablDe);
System.out.println("변경일자=" + changede);
System.out.println("존폐여부=" + ablEnnc);
System.out.println("x 이전기관코드=" + beforeInsttCode);

System.out.println("기관약어명=" + insttAbrvNm);

i++;
}

// int executeBatch =
// insttCodeRecptnDAO.getSqlMapClient().executeBatch();
//
// System.out.println("executeBatch=" + executeBatch);
}

}

1
  • 댓글 0

  • 로그인을 하시면 댓글을 등록할 수 있습니다.