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
.commons
.util
.ApplicationArgumentUtils
;
25 import com
.hangum
.tadpole
.engine
.initialize
.TadpoleEngineUserDB
;
26 import com
.hangum
.tadpole
.engine
.manager
.TadpoleSQLManager
;
27 import com
.hangum
.tadpole
.engine
.query
.dao
.system
.UserDBDAO
;
28 import com
.hangum
.tadpole
.engine
.query
.dao
.system
.ledger
.DelegerHistoryDAO
;
29 import com
.hangum
.tadpole
.engine
.query
.dao
.system
.ledger
.LedgerDAO
;
30 import com
.ibatis
.sqlmap
.client
.SqlMapClient
;
33 * Tadpole System ledger query
38 public class TadpoleSystemLedger
{
40 * Logger for this class
42 private static final Logger logger
= Logger
.getLogger(TadpoleSystemLedger
.class);
50 * @throws TadpoleSQLManagerException
51 * @throws SQLException
53 public static List
<DelegerHistoryDAO
> getOracleDetailListLedger(UserDBDAO userDBDAO
, LedgerDAO ledgerDAO
) throws TadpoleSQLManagerException
, SQLException
{
55 SqlMapClient sqlClient
= TadpoleSQLManager
.getInstance(userDBDAO
);
56 return sqlClient
.queryForList("getOracleDetailListLedger", ledgerDAO
);
66 * @throws TadpoleSQLManagerException
67 * @throws SQLException
69 public static List
<LedgerDAO
> getMySQLListLedger(String strUser
, String crNumber
, long startTime
, long endTime
) throws TadpoleSQLManagerException
, SQLException
{
70 Map
<String
, Object
> mapParam
= new HashMap
<String
, Object
>();
71 mapParam
.put("strUser", "%" + strUser
+ "%");
72 mapParam
.put("crNumber", "%" + crNumber
+ "%");
74 if(ApplicationArgumentUtils
.isDBServer()) {
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 Date dateSt
= new Date(startTime
);
83 DateFormat formatter
= new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS");
85 mapParam
.put("startTime", formatter
.format(dateSt
));
87 Date dateEd
= new Date(endTime
);
88 mapParam
.put("endTime", formatter
.format(dateEd
));
91 SqlMapClient sqlClient
= TadpoleSQLManager
.getInstance(TadpoleEngineUserDB
.getUserDB());
92 return sqlClient
.queryForList("getMySQLListLedger", mapParam
);
99 * @throws TadpoleSQLManagerException, SQLException
101 public static LedgerDAO
insertLedger(LedgerDAO ledger
) throws TadpoleSQLManagerException
, SQLException
{
102 SqlMapClient sqlClient
= TadpoleSQLManager
.getInstance(TadpoleEngineUserDB
.getUserDB());
103 java
.lang
.Integer intSeq
= (java
.lang
.Integer
)sqlClient
.insert("insert_ledger", ledger
);
104 ledger
.setSeq(intSeq
);
110 * 원장 데이터 저장 상태를 기록한다.
114 public static void insertLedgerResult(LedgerDAO ledgerDAO
) throws TadpoleSQLManagerException
, SQLException
{
115 SqlMapClient sqlClient
= TadpoleSQLManager
.getInstance(TadpoleEngineUserDB
.getUserDB());
116 sqlClient
.update("update_ledger_result", ledgerDAO
);