1 /*******************************************************************************
2 * Copyright (c) 2017 hangum.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the GNU Lesser Public License v2.1
5 * which accompanies this distribution, and is available at
6 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
9 * hangum - initial API and implementation
10 ******************************************************************************/
11 package com
.hangum
.tadpole
.engine
.query
.sql
;
13 import java
.sql
.SQLException
;
14 import java
.text
.DateFormat
;
15 import java
.text
.SimpleDateFormat
;
16 import java
.util
.Date
;
17 import java
.util
.HashMap
;
18 import java
.util
.List
;
21 import org
.apache
.log4j
.Logger
;
23 import com
.hangum
.tadpole
.commons
.exception
.TadpoleSQLManagerException
;
24 import com
.hangum
.tadpole
.engine
.initialize
.TadpoleEngineUserDB
;
25 import com
.hangum
.tadpole
.engine
.manager
.TadpoleSQLManager
;
26 import com
.hangum
.tadpole
.engine
.query
.dao
.system
.UserDBDAO
;
27 import com
.hangum
.tadpole
.engine
.query
.dao
.system
.ledger
.DelegerHistoryDAO
;
28 import com
.hangum
.tadpole
.engine
.query
.dao
.system
.ledger
.LedgerDAO
;
29 import com
.ibatis
.sqlmap
.client
.SqlMapClient
;
32 * Tadpole System ledger query
37 public class TadpoleSystemLedger
{
39 * Logger for this class
41 private static final Logger logger
= Logger
.getLogger(TadpoleSystemLedger
.class);
49 * @throws TadpoleSQLManagerException
50 * @throws SQLException
52 public static List
<DelegerHistoryDAO
> getOracleDetailListLedger(UserDBDAO userDBDAO
, LedgerDAO ledgerDAO
) throws TadpoleSQLManagerException
, SQLException
{
54 SqlMapClient sqlClient
= TadpoleSQLManager
.getInstance(userDBDAO
);
55 return sqlClient
.queryForList("getOracleDetailListLedger", ledgerDAO
);
66 * @throws TadpoleSQLManagerException
67 * @throws SQLException
69 public static List
<LedgerDAO
> getMySQLListLedger(String strResult
, String strUser
, String crNumber
, long startTime
, long endTime
) throws TadpoleSQLManagerException
, SQLException
{
70 Map
<String
, Object
> mapParam
= new HashMap
<String
, Object
>();
71 mapParam
.put("strResult", strResult
);
72 mapParam
.put("strUser", "%" + strUser
+ "%");
73 mapParam
.put("crNumber", "%" + crNumber
+ "%");
75 Date dateSt
= new Date(startTime
);
76 DateFormat formatter
= new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS");
77 mapParam
.put("startTime", formatter
.format(dateSt
));
79 Date dateEd
= new Date(endTime
);
80 mapParam
.put("endTime", formatter
.format(dateEd
));
82 SqlMapClient sqlClient
= TadpoleSQLManager
.getInstance(TadpoleEngineUserDB
.getUserDB());
83 return sqlClient
.queryForList("getMySQLListLedger", mapParam
);
90 * @throws TadpoleSQLManagerException, SQLException
92 public static LedgerDAO
insertLedger(LedgerDAO ledger
) throws TadpoleSQLManagerException
, SQLException
{
93 SqlMapClient sqlClient
= TadpoleSQLManager
.getInstance(TadpoleEngineUserDB
.getUserDB());
94 java
.lang
.Integer intSeq
= (java
.lang
.Integer
)sqlClient
.insert("insert_ledger", ledger
);
95 ledger
.setSeq(intSeq
);
101 * 원장 데이터 저장 상태를 기록한다.
105 public static void insertLedgerResult(LedgerDAO ledgerDAO
) throws TadpoleSQLManagerException
, SQLException
{
106 SqlMapClient sqlClient
= TadpoleSQLManager
.getInstance(TadpoleEngineUserDB
.getUserDB());
107 sqlClient
.update("update_ledger_result", ledgerDAO
);
115 * @throws TadpoleSQLManagerException
116 * @throws SQLException
118 public static boolean isDuplicationRefenceNumber(String cp_seq
) throws TadpoleSQLManagerException
, SQLException
{
119 SqlMapClient sqlClient
= TadpoleSQLManager
.getInstance(TadpoleEngineUserDB
.getUserDB());
120 List listKey
= sqlClient
.queryForList("isDuplicationRefenceNumber", cp_seq
);
122 if(listKey
.size() == 0) return false;