PrepaymentMiddleSignDriver.java 47 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852
  1. /**
  2. * @(#)file PrepaymentMiddleSignDriver.java
  3. * @(#)author OK
  4. * @(#)version 1.0
  5. * @(#)date 2014-09-15
  6. * @(#)since JDK 1.6.21
  7. *
  8. * Copyright (c) www.udapsoft.co.kr, Inc.
  9. * 대급지급신청서(중도) 처리 드라이브
  10. *
  11. */
  12. package kr.co.udapsoft.common.commonSign.driver;
  13. import java.io.OutputStream;
  14. import java.sql.CallableStatement;
  15. import java.sql.Connection;
  16. import java.sql.PreparedStatement;
  17. import java.sql.ResultSet;
  18. import java.sql.Statement;
  19. import java.sql.Types;
  20. import kr.co.hsnc.common.base.WAFLogger;
  21. import kr.co.hsnc.common.logger.Logger;
  22. import kr.co.hsnc.common.sql.Row;
  23. import kr.co.hsnc.common.sql.RowSet;
  24. import kr.co.hsnc.common.sql.RowSetImpl;
  25. import kr.co.hsnc.common.sql.WAFSQLException;
  26. import kr.co.hsnc.common.sql.persistent.Persistent;
  27. import kr.co.hsnc.common.sql.persistent.PersistentImpl;
  28. import kr.co.hsnc.common.sql.search.Search;
  29. import kr.co.hsnc.common.sql.search.SearchImpl;
  30. import kr.co.hsnc.common.sql.util.RowSetUtility;
  31. import kr.co.hsnc.common.util.StringUtil;
  32. import kr.co.hsnc.common.util.ValueObject;
  33. import kr.co.udapsoft.common.commonSign.CommonSignInterface;
  34. import kr.co.udapsoft.common.commonSign.util.SACDOCreatePDF7;
  35. import kr.co.udapsoft.common.commonSign.util.SACDOCreatePDF8;
  36. import weblogic.jdbc.vendor.oracle.OracleThinBlob;
  37. public class PrepaymentMiddleSignDriver implements CommonSignInterface {
  38. /**
  39. *
  40. */
  41. public PrepaymentMiddleSignDriver() {
  42. super();
  43. }
  44. /*
  45. * (non-Javadoc)
  46. * @see kr.co.udap.ehr.common.sign.SignInterface#doCallSign(java.sql.Connection, com.udapsoft.common.util.ValueObject)
  47. */
  48. public void doCallSign(Connection connection, ValueObject signDoc) throws Exception {
  49. System.out.println("1");
  50. }
  51. /*
  52. * (non-Javadoc)
  53. * @see kr.co.udap.ehr.common.sign.SignInterface#doStartSign(java.sql.Connection, com.udapsoft.common.util.ValueObject)
  54. */
  55. public void doStartSign(Connection connection, ValueObject signDoc) throws Exception {
  56. System.out.println("2");
  57. }
  58. /*
  59. * (non-Javadoc)
  60. * @see kr.co.udap.ehr.common.sign.SignInterface#doFirstFinishSign(java.sql.Connection, com.udapsoft.common.util.ValueObject)
  61. */
  62. public void doFirstFinishSign(Connection connection, ValueObject signDoc) throws Exception {
  63. System.out.println("3");
  64. /* 운영에 반영할때는 변경해야함*/
  65. RowSet signUserInfo = getIFSignUser(signDoc.get("DOC_ID"));
  66. for ( int j = 0 ; j < signUserInfo.size() ; j ++ ) {
  67. ValueObject signUser = new ValueObject();
  68. signUser.set("SIGN_SEQ", ""+(j+1));
  69. signUser.set("DOC_ID", signDoc.get("DOC_ID"));
  70. signUser.set("APPROVAL_DATE", signUserInfo.getRow(j).get("PROCESSDATE"));
  71. signUser.set("APPROVAL_SABUN", signUserInfo.getRow(j).get("SABUN"));
  72. signUser.set("APPROVAL_USER", signUserInfo.getRow(j).get("APRMEMBERNAME"));
  73. signUser.set("A_POSITION", signUserInfo.getRow(j).get("APRMEMBERJOBTITLE"));
  74. signUser.set("SIGN_RESULT", signUserInfo.getRow(j).get("APRSTATE"));
  75. signUser.set("SIGN_TYPE", signDoc.get("SIGN_TYPE"));
  76. signUser.set("ACCT_TYPE", signDoc.get("ACCT_TYPE"));
  77. signUser.set("SLIP_DEPT", signDoc.get("KEY_COL2"));
  78. signUser.set("ACCSLIP_NO", "");
  79. signUser.set("SLIP_DT", signDoc.get("KEY_COL4"));
  80. signUser.set("SLIP_NO", signDoc.get("KEY_COL5"));
  81. insertSign002t(connection, signUser);
  82. }
  83. updateSUB1040T(connection, signDoc);
  84. }
  85. /*
  86. * (non-Javadoc)
  87. * @see kr.co.udap.ehr.common.sign.SignInterface#doFinishSign(java.sql.Connection, com.udapsoft.common.util.ValueObject)
  88. */
  89. public void doFinishSign(Connection connection, ValueObject signDoc) throws Exception {
  90. System.out.println("4");
  91. updateSUB1040T(connection, signDoc);
  92. }
  93. /*
  94. * (non-Javadoc)
  95. * @see kr.co.udap.ehr.common.sign.SignInterface#doRejectSign(java.sql.Connection, com.udapsoft.common.util.ValueObject)
  96. */
  97. public void doFirstRejectSign(Connection connection, ValueObject signDoc) throws Exception {
  98. System.out.println("5");
  99. updateSUB1040T(connection, signDoc);
  100. }
  101. /*
  102. * (non-Javadoc)
  103. * @see kr.co.udap.ehr.common.sign.SignInterface#doRejectSign(java.sql.Connection, com.udapsoft.common.util.ValueObject)
  104. */
  105. public void doRejectSign(Connection connection, ValueObject signDoc) throws Exception {
  106. System.out.println("6");
  107. updateSUB1040T(connection, signDoc);
  108. }
  109. /*
  110. * (non-Javadoc)
  111. * @see kr.co.udap.ehr.common.sign.SignInterface#doCancelSign(java.sql.Connection, com.udapsoft.common.util.ValueObject)
  112. */
  113. public void doCancelSign(Connection connection, ValueObject signDoc) throws Exception {
  114. }
  115. private RowSet getIFSignUser(String docId) throws Exception{
  116. Search search = new SearchImpl();
  117. search.setDSName("jdbc/gwsql");
  118. RowSet rowSet = new RowSetImpl();
  119. StringBuffer sqlstr = new StringBuffer();
  120. try {
  121. sqlstr.append(" SELECT APRSTATE \n");
  122. sqlstr.append(" ,REPLACE(APRMEMBERID,SUBSTRING(APRMEMBERID,1,4),'') AS SABUN \n");
  123. sqlstr.append(" ,APRMEMBERNAME \n");
  124. sqlstr.append(" ,APRMEMBERJOBTITLE \n");
  125. sqlstr.append(" ,APRMEMBERDEPTNAME \n");
  126. sqlstr.append(" ,REPLACE(CONVERT(VARCHAR(10),PROCESSDATE,120),'-','') AS PROCESSDATE \n");
  127. sqlstr.append(" FROM TBENDAPRLINEINFO \n");
  128. sqlstr.append(" WHERE APRTYPE = 'A03001' \n");
  129. sqlstr.append(" AND DOCID = '"+docId+"' \n");
  130. sqlstr.append(" ORDER BY APRMEMBERSN \n");
  131. search.setStatement(sqlstr.toString());
  132. rowSet = search.execute();
  133. System.out.println(sqlstr.toString());
  134. return rowSet;
  135. }catch(WAFSQLException se) {
  136. Logger.err.println("SQL : \n" + se.getStatement());
  137. Logger.err.println("PARAM : \n" + se.getParameter());
  138. throw se;
  139. }
  140. }
  141. public void insertSign002t(Connection connection, ValueObject vo) throws Exception {
  142. Persistent persistent = new PersistentImpl(connection);
  143. StringBuffer sqlstr = null;
  144. try {
  145. sqlstr = new StringBuffer();
  146. sqlstr.append(" INSERT INTO SIGN002T \n");
  147. sqlstr.append(" (SIGN_HIS_ID \n");
  148. sqlstr.append(" ,SIGN_SEQ \n");
  149. sqlstr.append(" ,DOC_ID \n");
  150. sqlstr.append(" ,APPROVAL_DATE \n");
  151. sqlstr.append(" ,APPROVAL_SABUN \n");
  152. sqlstr.append(" ,APPROVAL_USER \n");
  153. sqlstr.append(" ,A_POSITION \n");
  154. sqlstr.append(" ,SIGN_RESULT \n");
  155. sqlstr.append(" ,SLIP_DEPT \n");
  156. sqlstr.append(" ,SLIP_DT \n");
  157. sqlstr.append(" ,SLIP_NO \n");
  158. sqlstr.append(" ,SIGN_TYPE \n");
  159. sqlstr.append(" ,COMON_DCR \n");
  160. sqlstr.append(" ) VALUES \n");
  161. sqlstr.append(" ( \n");
  162. sqlstr.append(" SIGN002T_S.NEXTVAL \n");
  163. sqlstr.append(" ,? \n");
  164. sqlstr.append(" ,? \n");
  165. sqlstr.append(" ,TO_DATE(?,'YYYYMMDD') \n");
  166. sqlstr.append(" ,? \n");
  167. sqlstr.append(" ,? \n");
  168. sqlstr.append(" ,? \n");
  169. sqlstr.append(" ,? \n");
  170. sqlstr.append(" ,? \n");
  171. sqlstr.append(" ,? \n");
  172. sqlstr.append(" ,? \n");
  173. sqlstr.append(" ,1 \n");
  174. sqlstr.append(" ,2 \n");
  175. sqlstr.append(" ) \n");
  176. persistent.setStatement(sqlstr.toString());
  177. persistent.addParameter(vo.get("SIGN_SEQ"));
  178. persistent.addParameter(vo.get("DOC_ID"));
  179. persistent.addParameter(vo.get("APPROVAL_DATE"));
  180. persistent.addParameter(vo.get("APPROVAL_SABUN"));
  181. persistent.addParameter(vo.get("APPROVAL_USER"));
  182. persistent.addParameter(vo.get("A_POSITION"));
  183. persistent.addParameter(vo.get("SIGN_RESULT"));
  184. persistent.addParameter(vo.get("SLIP_DEPT"));
  185. persistent.addParameter(vo.get("SLIP_DT"));
  186. persistent.addParameter(vo.get("SLIP_NO"));
  187. persistent.execute();
  188. }
  189. catch(Exception e) {
  190. WAFLogger.error(this.getClass().getName() + " --> insertSign002t() : " + e.getMessage());
  191. WAFLogger.error("SQL : " + sqlstr);
  192. WAFLogger.error(e);
  193. throw e;
  194. }
  195. }
  196. public void updateSUB1040T(Connection connection, ValueObject vo) throws Exception {
  197. Persistent persistent = new PersistentImpl(connection);
  198. StringBuffer sqlstr = null;
  199. try {
  200. sqlstr = new StringBuffer();
  201. sqlstr.append(" UPDATE SUB1040T \n");
  202. sqlstr.append(" SET STATUS_CD = ? \n");
  203. sqlstr.append(" , UPD_DATE = SYSDATE \n");
  204. sqlstr.append(" WHERE ACMP_ID = ? \n");
  205. persistent.setStatement(sqlstr.toString());
  206. persistent.addParameter("10"); // 완료
  207. persistent.addParameter(vo.get("KEY_COL1"));
  208. persistent.execute();
  209. //대급지급 신청서(중도) 전표집계
  210. prepaymentMiddle(connection, vo);
  211. }catch(Exception e) {
  212. WAFLogger.error(this.getClass().getName() + " --> updateSUB1040T() : " + e.getMessage());
  213. WAFLogger.error("SQL : " + sqlstr);
  214. WAFLogger.error(e);
  215. throw e;
  216. }
  217. }
  218. public void prepaymentMiddle(Connection connection, ValueObject vo) throws Exception {
  219. Search search = new SearchImpl();
  220. RowSet listRowSet = null;
  221. StringBuffer sql = new StringBuffer();
  222. ValueObject selectResult = new ValueObject();
  223. try {
  224. sql.append(" SELECT B.DEPT_CD ,(SELECT ACCT_ID FROM PUB0120T WHERE USER_SABUN = '"+vo.get("APPROVAL_SABUN")+"') as ACCT_ID, B.ACMP_ID \n"); //2015.9.1 a.dept_cd->b.dept_cd로 변경. P158->1631
  225. sql.append(" FROM SUB1000T A, \n");
  226. sql.append(" SUB1040T B \n");
  227. sql.append(" WHERE A.SUB_CONT_ID = B.SUB_CONT_ID \n");
  228. sql.append(" AND B.ACMP_ID = "+vo.get("KEY_COL1")+" \n");
  229. search.setStatement(sql.toString());
  230. listRowSet = search.execute();
  231. selectResult = RowSetUtility.getValueObject(listRowSet.getRow(0));
  232. doJipge(connection, selectResult);
  233. RowSet result = getListRow(connection, selectResult);
  234. //result.set("ACCT_ID", selectResult.getObject("ACCT_ID"));
  235. String acctId = selectResult.get("ACCT_ID");
  236. for( int i = 0 ; i < result.size() ; i++ ) {
  237. Row row = result.getRow(i);
  238. //외주기성고 PDF작성
  239. prcDoc020t(connection, row.get("TMPSLIP_ID"), acctId, selectResult.get("ACMP_ID"), row.get("END_YN"));
  240. }
  241. }catch(Exception e) {
  242. WAFLogger.error(this.getClass().getName() + " --> prepaymentMiddle() : " + e.getMessage());
  243. //WAFLogger.error("SQL : " + sqlstr);
  244. WAFLogger.error(e);
  245. throw e;
  246. }
  247. }
  248. public RowSet getListRow(Connection connection, ValueObject vo) throws Exception {
  249. Persistent persistent_c = null;
  250. Search search = new SearchImpl();
  251. RowSet listRowSet = null;
  252. StringBuffer sql = new StringBuffer();
  253. try {
  254. persistent_c = new PersistentImpl(connection);
  255. sql.append(" SELECT MAIN.ACMP_ID -- 기성ID \n");
  256. sql.append(" , '' CHK -- \n");
  257. sql.append(" , MAIN.TMPSLIP_ID -- 외주기성전표 ID \n");
  258. sql.append(" , TO_CHAR(MAIN.PROOFDATE, 'YYYY-MM-DD') PROOFDATE -- 거래일자 \n");
  259. sql.append(" , MAIN.DEPT_CD -- 현장코드 \n");
  260. sql.append(" , CONTRACT.DEPT_NAME -- 현장명 \n");
  261. sql.append(" , CONTRACT.CON_DOC_NO -- 외주계약번호 \n");
  262. sql.append(" , CONTRACT.BUILD_NAME -- 계약명 \n");
  263. sql.append(" , MAIN.DCERTI_NO -- 사업자번호 \n");
  264. sql.append(" , SUBVENDOR.CORP_KOR -- 사업자명 \n");
  265. sql.append(" , SUBVENDOR.CORP_ID -- 협력업체_ID \n");
  266. sql.append(" , MAIN.PREREQTFLG -- 선급/기성구분 \n");
  267. sql.append(" , MAIN.ACMP_NO -- 기성차수 \n");
  268. sql.append(" , MAIN.PROOF_CLASS -- 증빙구분 \n");
  269. sql.append(" , MAIN.ORDACCDESC -- 적요 \n");
  270. sql.append(" , MAIN.CON_CUR_CD -- 계약통화 \n");
  271. sql.append(" , MAIN.SUPPLY_AMT -- 공급가 \n");
  272. sql.append(" , MAIN.SURTAX_AMT -- 부가세 \n");
  273. sql.append(" , MAIN.SUPPLY_AMT + MAIN.SURTAX_AMT REQ_AMT -- 합계 \n");
  274. sql.append(" , CONTRACT.CON_CHARGE_ID -- 담당자 ID \n");
  275. sql.append(" , CONTRACT.CON_CHARGE_NAME -- 담당자 명 \n");
  276. sql.append(" , MAIN.DEALR_CD -- 거래처코드 \n");
  277. sql.append(" , MAIN.PAYITEM -- PAY ITEM \n");
  278. sql.append(" , MAIN.COSTCODE -- COST CODE \n");
  279. sql.append(" , MAIN.COSTTYPE -- COST TYPE \n");
  280. sql.append(" , MAIN.ACC_CLASS -- 계정구분 \n");
  281. sql.append(" , MAIN.PAY_GROUP -- PAY_GROUP \n");
  282. sql.append(" , MAIN.PAYMENT_TERMS -- PAYMENT_TERMS \n");
  283. sql.append(" , MAIN.TMPSLIP_DEPT -- 작성부서 \n");
  284. sql.append(" , MAIN.TMPSLIP_DT -- 작성일자 \n");
  285. sql.append(" , MAIN.TMPSLIP_NO -- 작성번호 \n");
  286. sql.append(" , MAIN.TMPSLIP_YN -- 전표생성유무 \n");
  287. sql.append(" , MAIN.SLIP_YN -- 결의서작성유무 \n");
  288. sql.append(" , MAIN.PREPAY_ID -- 선급ID \n");
  289. sql.append(" , ACMP.CON_CORP_ID -- 계약업체 ID \n");
  290. sql.append(" , ACMP.ACMP_YYYYMM -- 기성년월 \n");
  291. sql.append(" , ACMP.ACMP_NO CHASU -- 차수 \n");
  292. sql.append(" , ACMP.TAX_METHOD_CD \n");
  293. sql.append(" , CONTRACT.SUB_CONT_ID -- 외주게약서 ID \n");
  294. sql.append(" , CASE \n");
  295. sql.append(" WHEN ACMP.TOT_FUND_AMT >= ACMP.CON_SUPPLY_AMT THEN 'J' \n");
  296. sql.append(" ELSE 'K' \n");
  297. sql.append(" END END_YN \n");
  298. sql.append(" FROM SUB1050T MAIN -- << 집계 >> \n");
  299. sql.append(" LEFT OUTER JOIN SUB1040T ACMP -- << 기성내역 >> \n");
  300. sql.append(" ON MAIN.ACMP_ID = ACMP.ACMP_ID \n");
  301. sql.append(" LEFT OUTER JOIN SUB1020T SUBVENDOR -- << 계약업체 >> \n");
  302. sql.append(" ON ACMP.CON_CORP_ID = SUBVENDOR.CON_CORP_ID \n");
  303. sql.append(" LEFT OUTER JOIN SUB2000T CONTRACT -- << 계약서 >> \n");
  304. sql.append(" ON ACMP.SUB_CONT_ID = CONTRACT.SUB_CONT_ID \n");
  305. sql.append(" AND ACMP.MOD_NO = CONTRACT.MOD_NO \n");
  306. sql.append(" WHERE PREREQTFLG IN ('ACMP', 'PREPAY_DED') -- PREPAY:선급, ACMP:기성, PREPAY_DED: 선급금공제 \n");
  307. sql.append(" AND MAIN.ACMP_ID = "+vo.get("ACMP_ID")+" \n");
  308. sql.append(" ORDER BY PROOFDATE desc, MAIN.ACMP_ID, DEPT_NAME, CON_DOC_NO, CORP_KOR, MAIN.PREREQTFLG \n");
  309. System.out.println(sql.toString());
  310. //search.setStatement(sql.toString());
  311. //listRowSet = search.execute();
  312. //selectResult = RowSetUtility.getValueObject(search.execute().getRow(0));
  313. persistent_c.setStatement(sql.toString());
  314. listRowSet = persistent_c.query();
  315. //selectResult = RowSetUtility.getValueObject(listRowSet.getRow(0));
  316. } catch(Exception e) {
  317. WAFLogger.error(this.getClass().getName() + " --> getListRowSet() : \n" + e.getMessage());
  318. WAFLogger.error("SQL : " + search.getStatement());
  319. WAFLogger.error(e);
  320. throw e;
  321. } finally {
  322. if( listRowSet == null ) listRowSet = new RowSetImpl();
  323. }
  324. return listRowSet;
  325. }
  326. private void doJipge(Connection connection, ValueObject vo) throws Exception {
  327. Persistent persistent = new PersistentImpl(connection);
  328. Persistent persistent2 = new PersistentImpl(connection);
  329. Persistent persistent3 = new PersistentImpl(connection);
  330. Persistent persistent4 = new PersistentImpl(connection);
  331. Persistent persistent_u = new PersistentImpl(connection);
  332. StringBuffer sql = new StringBuffer();
  333. StringBuffer sql2 = new StringBuffer();
  334. StringBuffer sql3 = new StringBuffer();
  335. StringBuffer sql4 = new StringBuffer();
  336. StringBuffer sql_u = new StringBuffer();
  337. /*면세 기성*/
  338. prepareSql(sql);
  339. /*면세 공제*/
  340. prepareSql2(sql2);
  341. /*과세 기성*/
  342. prepareSql3(sql3);
  343. /*과세 공제*/
  344. prepareSql4(sql4);
  345. updateSql(sql_u);
  346. persistent.setStatement(sql.toString());
  347. persistent2.setStatement(sql2.toString());
  348. persistent3.setStatement(sql3.toString());
  349. persistent4.setStatement(sql4.toString());
  350. persistent_u.setStatement(sql_u.toString());
  351. try {
  352. //ValueObject user = storage.getUser();
  353. RowSet rs = getListRowSet(connection, vo);
  354. if(rs.size() > 0){
  355. for(int i = 0; rs.size() > i; i++){
  356. // 기성집계 과세
  357. persistent.addParameter(vo.get("ACCT_ID"));
  358. persistent.addParameter(rs.getRow(i).get("ACMP_ID"));
  359. persistent.execute();
  360. persistent.clearParameters();
  361. // 선급금 공제 집계 과세 (선급금공제금액이 있는 놈만 집계)
  362. persistent2.addParameter(vo.get("ACCT_ID"));
  363. persistent2.addParameter(rs.getRow(i).get("ACMP_ID"));
  364. persistent2.execute();
  365. persistent2.clearParameters();
  366. // 기성집계 면세
  367. persistent3.addParameter(vo.get("ACCT_ID"));
  368. persistent3.addParameter(rs.getRow(i).get("ACMP_ID"));
  369. persistent3.execute();
  370. persistent3.clearParameters();
  371. // 선급금 공제 집계 면세 (선급금공제금액이 있는 놈만 집계)
  372. persistent4.addParameter(vo.get("ACCT_ID"));
  373. persistent4.addParameter(rs.getRow(i).get("ACMP_ID"));
  374. persistent4.execute();
  375. persistent4.clearParameters();
  376. // 전표집계유무 상태값 변경
  377. persistent_u.addParameter(rs.getRow(i).get("ACMP_ID"));
  378. persistent_u.execute();
  379. persistent_u.clearParameters();
  380. }
  381. }
  382. } catch(Exception e) {
  383. WAFLogger.error(this.getClass().getName() + " --> doJipge() : " + e.getMessage());
  384. WAFLogger.error(e);
  385. throw e;
  386. }
  387. }
  388. /**
  389. * 면세금
  390. * @param sql
  391. */
  392. private void prepareSql(StringBuffer sql) {
  393. sql.append(" INSERT INTO SUB1050T(TMPSLIP_ID, PROOFDATE, DEPT_CD, PREREQTFLG, ACMP_NO, PROOF_CLASS, ORDACCDESC, SUPPLY_AMT, SURTAX_AMT, DEALR_CD, DCERTI_NO, TAX_DATE, ELECTAX_YN, PAYITEM, COSTCODE, COSTTYPE, ACC_CLASS, PAY_GROUP, PAYMENT_TERMS, TMPSLIP_DEPT, TMPSLIP_DT, TMPSLIP_NO, TMPSLIP_YN, SLIP_YN, CON_CUR_CD, ACMP_ID, PREPAY_ID, CRE_BY, CRE_DATE, UPD_BY, UPD_DATE, CORP_ID, TAX_GB) \n");
  394. sql.append(" SELECT SUB1050T_S.NEXTVAL -- ID \n");
  395. sql.append(" , A.TAX_DY -- 기성일자 \n");
  396. sql.append(" , A.DEPT_CD -- 현장코드 \n");
  397. sql.append(" , 'ACMP' -- 선급기성구분 (ACMP= 기성) \n");
  398. sql.append(" , A.ACMP_NO -- 기성차수 \n");
  399. sql.append(" , DECODE(B.PROOF_CD,'21','26', B.PROOF_CD) -- 증빙구분 \n");
  400. sql.append(" , A.TAX_DY || ' 외주기성전표 - ' || A.ACMP_NO \n");
  401. sql.append(" || ' (' || BUILD_NAME || ') ' -- 적요 \n");
  402. sql.append(" , A.REQU_SUPPLY_NAMT -- 면세 \n");
  403. sql.append(" , 0 -- 면세보증금 \n");
  404. sql.append(" , F_GET_DEALR_CD_EBID(C.CORP_ID) AS DEALR_CD -- 거래처코드 \n");
  405. sql.append(" , F_GET_DEALR_NO_EBID(C.CORP_ID) AS DCERTI_NO -- 사업자번호 \n");
  406. sql.append(" , TO_DATE(A.TAX_DY, 'YYYY-MM-DD') -- 세금계산서일자 \n");
  407. sql.append(" , 'Y' -- 전자계약여부 \n");
  408. sql.append(" , B.PAY_ITEM -- PAY_ITEM \n");
  409. sql.append(" , B.COST_CODE -- COST_CODE \n");
  410. sql.append(" , B.COST_TYPE -- COST_TYPE \n");
  411. sql.append(" , B.ACCT_GB -- 계정구분 (=분개유형 ) \n");
  412. sql.append(" , B.PAY_GROUP -- PAY_GROUP \n");
  413. sql.append(" , B.PAYMENT_TERMS -- PAYMENT_TERMS \n");
  414. sql.append(" , NULL -- 작성부서 \n");
  415. sql.append(" , NULL -- 작성일자 \n");
  416. sql.append(" , NULL -- 작성번호 \n");
  417. sql.append(" , 'N' -- 전표생성유무 \n");
  418. sql.append(" , 'N' -- 결의서작성유무 \n");
  419. sql.append(" , B.CON_CUR_CD -- 계약통화 \n");
  420. sql.append(" , A.ACMP_ID -- 기성ID \n");
  421. sql.append(" , NULL -- 선급ID \n");
  422. sql.append(" , ? -- 등록자 \n");
  423. sql.append(" , SYSDATE -- 등록일시 \n");
  424. sql.append(" , NULL -- 수정자 \n");
  425. sql.append(" , NULL -- 수정일시 \n");
  426. sql.append(" , C.CORP_ID -- 협력업체ID \n");
  427. sql.append(" , 'N' -- 면과세 구분 \n");
  428. sql.append(" FROM SUB1040T A -- << 기성내역 >> \n");
  429. sql.append(" ,SUB2000T B -- << 계약서 >> \n");
  430. sql.append(" ,SUB1020T C -- << 업체 >> \n");
  431. sql.append(" WHERE A.SUB_CONT_ID = B.SUB_CONT_ID \n");
  432. sql.append(" AND A.MOD_NO = B.MOD_NO \n");
  433. sql.append(" AND A.SUB_CONT_ID = C.SUB_CONT_ID \n");
  434. sql.append(" AND A.ACMP_ID = ? \n");
  435. sql.append(" AND A.REQU_SUPPLY_NAMT > 0 -- 면세금액이 있음 \n");
  436. sql.append(" AND A.STATUS_CD = '10' -- 결제완료된 내역 \n");
  437. System.out.println(sql.toString());
  438. }
  439. /**
  440. * 선급공제액_면세금액
  441. * @param sql
  442. */
  443. private void prepareSql2(StringBuffer sql) {
  444. sql.append(" INSERT INTO SUB1050T(TMPSLIP_ID, PROOFDATE, DEPT_CD, PREREQTFLG, ACMP_NO, PROOF_CLASS, ORDACCDESC, SUPPLY_AMT, SURTAX_AMT, DEALR_CD, DCERTI_NO, TAX_DATE, ELECTAX_YN, PAYITEM, COSTCODE, COSTTYPE, ACC_CLASS, PAY_GROUP, PAYMENT_TERMS, TMPSLIP_DEPT, TMPSLIP_DT, TMPSLIP_NO, TMPSLIP_YN, SLIP_YN, CON_CUR_CD, ACMP_ID, PREPAY_ID, CRE_BY, CRE_DATE, UPD_BY, UPD_DATE, CORP_ID, TAX_GB) \n");
  445. sql.append(" SELECT SUB1050T_S.NEXTVAL -- ID \n");
  446. sql.append(" , A.TAX_DY -- 기성일자 \n");
  447. sql.append(" , A.DEPT_CD -- 현장코드 \n");
  448. sql.append(" , 'PREPAY_DED' -- 선급기성구분 (ACMP= 기성) \n");
  449. sql.append(" , A.ACMP_NO -- 기성차수 \n");
  450. /*제경팀 요청(정승우) 선급금 공제인 경우 증빙구분이 기타로 요청*/
  451. sql.append(" , 'Z99' -- 증빙구분 \n");
  452. sql.append(" , A.TAX_DY || ' 외주선급공제전표 - ' || A.ACMP_NO \n");
  453. sql.append(" || ' (' || BUILD_NAME || ') ' -- 적요 \n");
  454. sql.append(" , A.PAY_DEDUCT_NAMT -- 선급공제금_면세 \n");
  455. sql.append(" , 0 -- 부가세 \n");
  456. sql.append(" , F_GET_DEALR_CD_EBID(C.CORP_ID) AS DEALR_CD -- 거래처코드 \n");
  457. sql.append(" , F_GET_DEALR_NO_EBID(C.CORP_ID) AS DCERTI_NO -- 사업자번호 \n");
  458. sql.append(" , TO_DATE(A.TAX_DY, 'YYYY-MM-DD') -- 세금계산서일자 \n");
  459. sql.append(" , 'Y' -- 전자계약여부 \n");
  460. sql.append(" , B.PAY_ITEM -- PAY_ITEM \n");
  461. sql.append(" , B.COST_CODE -- COST_CODE \n");
  462. sql.append(" , B.COST_TYPE -- COST_TYPE \n");
  463. sql.append(" , B.ACCT_GB -- 계정구분 (=분개유형 ) \n");
  464. sql.append(" , CASE E.AC_UNIT_CD WHEN '10' THEN '22' \n");
  465. sql.append(" ELSE '21' \n");
  466. sql.append(" END -- PAY_GROUP \n");
  467. sql.append(" , B.PAYMENT_TERMS -- PAYMENT_TERMS \n");
  468. sql.append(" , NULL -- 작성부서 \n");
  469. sql.append(" , NULL -- 작성일자 \n");
  470. sql.append(" , NULL -- 작성번호 \n");
  471. sql.append(" , 'N' -- 전표생성유무 \n");
  472. sql.append(" , 'N' -- 결의서작성유무 \n");
  473. sql.append(" , B.CON_CUR_CD -- 계약통화 \n");
  474. sql.append(" , A.ACMP_ID -- 기성ID \n");
  475. sql.append(" , NULL -- 선급ID \n");
  476. sql.append(" , ? -- 등록자 \n");
  477. sql.append(" , SYSDATE -- 등록일시 \n");
  478. sql.append(" , NULL -- 수정자 \n");
  479. sql.append(" , NULL -- 수정일시 \n");
  480. sql.append(" , C.CORP_ID -- 협력업체ID \n");
  481. sql.append(" , 'N' -- 면과세구분 \n");
  482. sql.append(" FROM SUB1040T A -- << 기성내역 >> \n");
  483. sql.append(" ,SUB2000T B -- << 계약서 >> \n");
  484. sql.append(" ,SUB1020T C -- << 업체 >> \n");
  485. sql.append(" ,ETEC_ERPIF.ACZ10100 E -- << 사업부 >> \n");
  486. sql.append(" WHERE A.SUB_CONT_ID = B.SUB_CONT_ID \n");
  487. sql.append(" AND A.MOD_NO = B.MOD_NO \n");
  488. sql.append(" AND A.SUB_CONT_ID = C.SUB_CONT_ID \n");
  489. sql.append(" AND A.ACMP_ID = ? \n");
  490. sql.append(" AND A.PAY_DEDUCT_NAMT > 0 -- 선급공제액_면세금액이 있음 \n");
  491. sql.append(" AND A.DEPT_CD = E.DEPT_CD \n");
  492. sql.append(" AND A.STATUS_CD = '10' -- 결제완료된 내역 \n");
  493. System.out.println(sql.toString());
  494. }
  495. /**
  496. * 과세금액
  497. * @param sql
  498. */
  499. private void prepareSql3(StringBuffer sql) {
  500. sql.append(" INSERT INTO SUB1050T(TMPSLIP_ID, PROOFDATE, DEPT_CD, PREREQTFLG, ACMP_NO, PROOF_CLASS, ORDACCDESC, SUPPLY_AMT, SURTAX_AMT, DEALR_CD, DCERTI_NO, TAX_DATE, ELECTAX_YN, PAYITEM, COSTCODE, COSTTYPE, ACC_CLASS, PAY_GROUP, PAYMENT_TERMS, TMPSLIP_DEPT, TMPSLIP_DT, TMPSLIP_NO, TMPSLIP_YN, SLIP_YN, CON_CUR_CD, ACMP_ID, PREPAY_ID, CRE_BY, CRE_DATE, UPD_BY, UPD_DATE, CORP_ID, TAX_GB) \n");
  501. sql.append(" SELECT SUB1050T_S.NEXTVAL -- ID \n");
  502. sql.append(" , A.TAX_DY -- 기성일자 \n");
  503. sql.append(" , A.DEPT_CD -- 현장코드 \n");
  504. sql.append(" , 'ACMP' -- 선급기성구분 (ACMP= 기성) \n");
  505. sql.append(" , A.ACMP_NO -- 기성차수 \n");
  506. sql.append(" , B.PROOF_CD -- 증빙구분 \n");
  507. sql.append(" , A.TAX_DY || ' 외주기성전표 - ' || A.ACMP_NO \n");
  508. sql.append(" || ' (' || BUILD_NAME || ') ' -- 적요 \n");
  509. sql.append(" , A.REQU_SUPPLY_TAMT -- 과세 \n");
  510. sql.append(" , A.REQU_SURTAX_AMT -- 과세보증금 \n");
  511. sql.append(" , F_GET_DEALR_CD_EBID(C.CORP_ID) AS DEALR_CD -- 거래처코드 \n");
  512. sql.append(" , F_GET_DEALR_NO_EBID(C.CORP_ID) AS DCERTI_NO -- 사업자번호 \n");
  513. sql.append(" , TO_DATE(A.TAX_DY, 'YYYY-MM-DD') -- 세금계산서일자 \n");
  514. sql.append(" , 'Y' -- 전자계약여부 \n");
  515. sql.append(" , B.PAY_ITEM -- PAY_ITEM \n");
  516. sql.append(" , B.COST_CODE -- COST_CODE \n");
  517. sql.append(" , B.COST_TYPE -- COST_TYPE \n");
  518. sql.append(" , B.ACCT_GB -- 계정구분 (=분개유형 ) \n");
  519. sql.append(" , B.PAY_GROUP -- PAY_GROUP \n");
  520. sql.append(" , B.PAYMENT_TERMS -- PAYMENT_TERMS \n");
  521. sql.append(" , NULL -- 작성부서 \n");
  522. sql.append(" , NULL -- 작성일자 \n");
  523. sql.append(" , NULL -- 작성번호 \n");
  524. sql.append(" , 'N' -- 전표생성유무 \n");
  525. sql.append(" , 'N' -- 결의서작성유무 \n");
  526. sql.append(" , B.CON_CUR_CD -- 계약통화 \n");
  527. sql.append(" , A.ACMP_ID -- 기성ID \n");
  528. sql.append(" , NULL -- 선급ID \n");
  529. sql.append(" , ? -- 등록자 \n");
  530. sql.append(" , SYSDATE -- 등록일시 \n");
  531. sql.append(" , NULL -- 수정자 \n");
  532. sql.append(" , NULL -- 수정일시 \n");
  533. sql.append(" , C.CORP_ID -- 협력업체ID \n");
  534. sql.append(" , 'T' -- 면과세구분 \n");
  535. sql.append(" FROM SUB1040T A -- << 기성내역 >> \n");
  536. sql.append(" ,SUB2000T B -- << 계약서 >> \n");
  537. sql.append(" ,SUB1020T C -- << 업체 >> \n");
  538. sql.append(" WHERE A.SUB_CONT_ID = B.SUB_CONT_ID \n");
  539. sql.append(" AND A.MOD_NO = B.MOD_NO \n");
  540. sql.append(" AND A.SUB_CONT_ID = C.SUB_CONT_ID \n");
  541. sql.append(" AND A.ACMP_ID = ? \n");
  542. sql.append(" AND A.REQU_SUPPLY_TAMT > 0 -- 과세금액이 있음 \n");
  543. sql.append(" AND A.STATUS_CD = '10' -- 결제완료된 내역 \n");
  544. System.out.println(sql.toString());
  545. }
  546. /**
  547. * 선급공제액_과세금액
  548. * @param sql
  549. */
  550. private void prepareSql4(StringBuffer sql) {
  551. sql.append(" INSERT INTO SUB1050T(TMPSLIP_ID, PROOFDATE, DEPT_CD, PREREQTFLG, ACMP_NO, PROOF_CLASS, ORDACCDESC, SUPPLY_AMT, SURTAX_AMT, DEALR_CD, DCERTI_NO, TAX_DATE, ELECTAX_YN, PAYITEM, COSTCODE, COSTTYPE, ACC_CLASS, PAY_GROUP, PAYMENT_TERMS, TMPSLIP_DEPT, TMPSLIP_DT, TMPSLIP_NO, TMPSLIP_YN, SLIP_YN, CON_CUR_CD, ACMP_ID, PREPAY_ID, CRE_BY, CRE_DATE, UPD_BY, UPD_DATE, CORP_ID, TAX_GB) \n");
  552. sql.append(" SELECT SUB1050T_S.NEXTVAL -- ID \n");
  553. sql.append(" , A.TAX_DY -- 기성일자 \n");
  554. sql.append(" , A.DEPT_CD -- 현장코드 \n");
  555. sql.append(" , 'PREPAY_DED' -- 선급기성구분 (ACMP= 기성) \n");
  556. sql.append(" , A.ACMP_NO -- 기성차수 \n");
  557. sql.append(" , 'Z99' -- 증빙구분 \n");
  558. sql.append(" , A.TAX_DY || ' 외주선급공제전표 - ' || A.ACMP_NO \n");
  559. sql.append(" || ' (' || BUILD_NAME || ') ' -- 적요 \n");
  560. sql.append(" , A.PAY_DEDUCT_TAMT -- 선급공제금_과세 \n");
  561. sql.append(" , 0 -- 부가세 \n");
  562. sql.append(" , F_GET_DEALR_CD_EBID(C.CORP_ID) AS DEALR_CD -- 거래처코드 \n");
  563. sql.append(" , F_GET_DEALR_NO_EBID(C.CORP_ID) AS DCERTI_NO -- 사업자번호 \n");
  564. sql.append(" , TO_DATE(A.TAX_DY, 'YYYY-MM-DD') -- 세금계산서일자 \n");
  565. sql.append(" , 'Y' -- 전자계약여부 \n");
  566. sql.append(" , B.PAY_ITEM -- PAY_ITEM \n");
  567. sql.append(" , B.COST_CODE -- COST_CODE \n");
  568. sql.append(" , B.COST_TYPE -- COST_TYPE \n");
  569. sql.append(" , B.ACCT_GB -- 계정구분 (=분개유형 ) \n");
  570. sql.append(" , CASE E.AC_UNIT_CD WHEN '10' THEN '22' \n");
  571. sql.append(" ELSE '21' \n");
  572. sql.append(" END -- PAY_GROUP \n");
  573. sql.append(" , B.PAYMENT_TERMS -- PAYMENT_TERMS \n");
  574. sql.append(" , NULL -- 작성부서 \n");
  575. sql.append(" , NULL -- 작성일자 \n");
  576. sql.append(" , NULL -- 작성번호 \n");
  577. sql.append(" , 'N' -- 전표생성유무 \n");
  578. sql.append(" , 'N' -- 결의서작성유무 \n");
  579. sql.append(" , B.CON_CUR_CD -- 계약통화 \n");
  580. sql.append(" , A.ACMP_ID -- 기성ID \n");
  581. sql.append(" , NULL -- 선급ID \n");
  582. sql.append(" , ? -- 등록자 \n");
  583. sql.append(" , SYSDATE -- 등록일시 \n");
  584. sql.append(" , NULL -- 수정자 \n");
  585. sql.append(" , NULL -- 수정일시 \n");
  586. sql.append(" , C.CORP_ID -- 협력업체ID \n");
  587. sql.append(" , 'T' -- 면과세구분 \n");
  588. sql.append(" FROM SUB1040T A -- << 기성내역 >> \n");
  589. sql.append(" ,SUB2000T B -- << 계약서 >> \n");
  590. sql.append(" ,SUB1020T C -- << 업체 >> \n");
  591. sql.append(" ,ETEC_ERPIF.ACZ10100 E -- << 사업부 >> \n");
  592. sql.append(" WHERE A.SUB_CONT_ID = B.SUB_CONT_ID \n");
  593. sql.append(" AND A.MOD_NO = B.MOD_NO \n");
  594. sql.append(" AND A.SUB_CONT_ID = C.SUB_CONT_ID \n");
  595. sql.append(" AND A.ACMP_ID = ? \n");
  596. sql.append(" AND A.PAY_DEDUCT_TAMT > 0 -- 선급공제액_과세금액이 있음 \n");
  597. sql.append(" AND A.DEPT_CD = E.DEPT_CD \n");
  598. sql.append(" AND A.STATUS_CD = '10' -- 결제완료된 내역 \n");
  599. System.out.println(sql.toString());
  600. }
  601. private void updateSql(StringBuffer sql){
  602. sql.append(" UPDATE SUB1040T SET TRANS_CD = 'Y' \n");
  603. sql.append(" WHERE ACMP_ID = ? \n");
  604. sql.append(" AND STATUS_CD = '10' \n");
  605. }
  606. private RowSet getListRowSet(Connection connection, ValueObject vo) throws Exception {
  607. RowSet listRowSet = null;
  608. StringBuffer sql = new StringBuffer();
  609. Persistent persistent = new PersistentImpl(connection);
  610. try {
  611. sql.append(" SELECT MAIN.ACMP_ID -- 기성아이디 \n");
  612. sql.append(" FROM SUB1040T MAIN -- << 기성내역 >> \n");
  613. sql.append(" WHERE MAIN.DEPT_CD = ? \n");
  614. sql.append(" AND MAIN.TRANS_CD = 'N' \n");
  615. sql.append(" AND MAIN.STATUS_CD = '10' \n");
  616. sql.append(" AND MAIN.ACMP_ID = ? \n");
  617. persistent.setStatement(sql.toString());
  618. persistent.addParameter(vo.get("dept_cd"));
  619. persistent.addParameter(vo.get("ACMP_ID"));
  620. listRowSet = persistent.query();
  621. } catch(Exception e) {
  622. WAFLogger.error(this.getClass().getName() + " --> getListRowSet() : \n" + e.getMessage());
  623. WAFLogger.error(e);
  624. throw e;
  625. } finally {
  626. if( listRowSet == null ) listRowSet = new RowSetImpl();
  627. }
  628. return listRowSet;
  629. }
  630. private void prcDoc020t(Connection con, String tmpslipID, String userID, String acmp_id, String endYn) throws Exception {
  631. String strResult = null;
  632. String message = "";
  633. String SPStateMent = "";
  634. CallableStatement cs = null;
  635. String arrDocNm [] = {"외주기성고 계산서"};
  636. String arrProofGu [] = {"12"};
  637. try {
  638. // 증빙정보 생성 프로시저
  639. // - 외주 기성고 계산서만 새로 생성해야만 한다.
  640. SPStateMent = "{call SAC_DOCUMENTATIVE.prc_subinvoicebiz2(?, ?, ?, ?, ?)}";
  641. cs = con.prepareCall(SPStateMent);
  642. // 라인당, 기성고계산서 한라인만 생성.
  643. for(int iCount=0; iCount<arrDocNm.length; iCount++) {
  644. int i = 1;
  645. cs.setString(i++, tmpslipID);
  646. cs.setInt(i++, Integer.parseInt(userID));
  647. cs.setString(i++, arrDocNm[iCount]);
  648. cs.setString(i++, arrProofGu[iCount]);
  649. cs.registerOutParameter(i++, Types.VARCHAR);
  650. cs.execute();
  651. strResult = cs.getString(5);
  652. if(endYn.equals("J")){ //준공
  653. /*// 입력된 증빙데이터 라인을 기준으로 실제 증빙을 */
  654. String arrKeys[] = strResult.split("@"); // proof_dept, proofdate, proof_no, proof_seq
  655. OutputStream outputStream = getOS(con, arrKeys[0], arrKeys[1], arrKeys[2], Integer.parseInt(arrKeys[3]));
  656. // 기성고 계산서 PDF 생성
  657. SACDOCreatePDF7 sacDOCreatePDF7 = new SACDOCreatePDF7();
  658. sacDOCreatePDF7.doBiz1(con, outputStream, acmp_id, null);
  659. }else{ //중도
  660. /*// 입력된 증빙데이터 라인을 기준으로 실제 증빙을 */
  661. String arrKeys[] = strResult.split("@"); // proof_dept, proofdate, proof_no, proof_seq
  662. OutputStream outputStream = getOS(con, arrKeys[0], arrKeys[1], arrKeys[2], Integer.parseInt(arrKeys[3]));
  663. // 기성고 계산서 PDF 생성
  664. SACDOCreatePDF8 sacDOCreatePDF8 = new SACDOCreatePDF8();
  665. sacDOCreatePDF8.doBiz1(con, outputStream, acmp_id, null);
  666. }
  667. }
  668. // 라인당, 기성고계산서 한라인만 생성. - 종료
  669. }
  670. catch(Exception e) {
  671. //super.doException(e);
  672. message = this.getClass().getName() + "\n" + e.getMessage();
  673. message = StringUtil.replace(message, "\"", "");
  674. //storage.setDetailMessage(message);
  675. throw e;
  676. }
  677. finally{
  678. try {
  679. if (cs != null) cs.close();
  680. }
  681. catch (Exception ex_close) {
  682. WAFLogger.error(ex_close);
  683. }
  684. }
  685. }
  686. public static OutputStream getOS(Connection con, String proof_dept, String proof_dt, String proof_no,
  687. int proof_seq) throws Exception {
  688. OutputStream outputStream = null;
  689. PreparedStatement pstmt = null;
  690. ResultSet resultSet = null;
  691. Statement stmt = null;
  692. try {
  693. String strSQL = "SELECT photo "
  694. + " FROM DOC021T "
  695. + " WHERE proof_dept = '"+ proof_dept +"'"
  696. + " AND TO_CHAR (proofdate, 'yyyymmdd') = '"+ proof_dt +"' "
  697. + " AND proof_no = " + proof_no
  698. + " AND proof_seq = "+ proof_seq
  699. + " AND proc_gu = '30' "
  700. + " FOR UPDATE";
  701. pstmt = con.prepareStatement(strSQL);
  702. resultSet = pstmt.executeQuery();
  703. if (resultSet.next()) {
  704. OracleThinBlob blob = (OracleThinBlob)resultSet.getBlob(1);
  705. outputStream = blob.getBinaryOutputStream();
  706. } else {
  707. throw new Exception("증빙화일을 저장할 레코드가 존재하지 않습니다.");
  708. }
  709. } catch (Exception e) {
  710. WAFLogger.error(e);
  711. } finally {
  712. if( stmt != null ) stmt.close();
  713. resultSet.close();
  714. pstmt.close();
  715. return outputStream;
  716. }
  717. }
  718. }