48fe8d7eb301081ef31b5322c58d50aa1fcbd281.svn-base 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987
  1. /**
  2. *
  3. */
  4. /**
  5. * @author Administrator
  6. *
  7. */
  8. package com.sinosoft.gps.bgd_mxb.DAO;
  9. import java.io.Serializable;
  10. import java.sql.Connection;
  11. import java.sql.PreparedStatement;
  12. import java.sql.ResultSet;
  13. import java.sql.SQLException;
  14. import java.text.DateFormat;
  15. import java.text.SimpleDateFormat;
  16. import java.util.ArrayList;
  17. import java.util.Date;
  18. import java.util.List;
  19. import org.apache.log4j.Logger;
  20. import com.formaction.Parameter;
  21. import com.mchange.v2.ser.SerializableUtils;
  22. import com.persistence.DbConnection;
  23. import com.persistence.service.PersistenceFactory;
  24. import com.persistence.service.SysPersistence;
  25. import com.persistence.service.assitant.generator.IdentityGenerator;
  26. import com.persistence.service.exception.PersistenceException;
  27. import com.sinosoft.common.util.DateUtil;
  28. import com.sinosoft.em.alert.report.manage.dao.QueryReportProgrammeDaoImpl;
  29. import com.sinosoft.em.alert.report.manage.vo.ReportProgress;
  30. import com.sinosoft.gps.bgd_mxb.vo.BGDBaoBiao;
  31. import com.sinosoft.gps.bgd_mxb.vo.BGDmingxi;
  32. import com.sinosoft.gps.bgd_mxb.vo.BaoGongDianTask;
  33. import com.sinosoft.gps.bgd_mxb.vo.ECMGPSLIST;
  34. import com.sinosoft.gps.bgd_mxb.vo.ECMGPSLIST2;
  35. import com.sysmodel.datamodel.xmlmodel.ModelFactory;
  36. import com.sysmodel.datamodel.xmlmodel.able.SysModel;
  37. public class ECMGPSLIST_Dao {
  38. private static SysModel sysmodel = ModelFactory.getSysmodel();
  39. @SuppressWarnings("unused")
  40. private static SysPersistence persistence = PersistenceFactory.getInstance(sysmodel);
  41. private final static Logger log = Logger.getLogger(QueryReportProgrammeDaoImpl.class);
  42. //主键生成方式
  43. //String fD_OBJECTID = IdentityGenerator.getIdentityGenerator().gerenalIdentity(887);
  44. //该方法(用于保存两张表)的第一个参数是第一张表的实体类的对象,第二个参数是保存第二张表内容的list集合<泛型>
  45. // public boolean saveDutyBatch(ECMGPSLIST list1,List<ECMGPSLIST2> list2){
  46. public boolean saveListBatch(ECMGPSLIST list1,List<ECMGPSLIST2> list2){
  47. boolean flag=false;
  48. DbConnection dbConn = new DbConnection();//Java类,链接数据库
  49. Connection conn = null;
  50. PreparedStatement pstm = null;
  51. PreparedStatement pstm2 = null;
  52. /*String dutySQL = "insert into ECM_EM_DUTY(FD_OBJECTID, NAME, DEPT_NAMES, STATE, DUTY_TYPE, OPER_DEPT, OPER_NAME, OPER_TIME, IS_DEL, UPDATEDATE,RELEASE) "
  53. +" VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ? ,?)";*/
  54. /*String detailSQL = "insert into ECM_EM_DUTY_DETAIL(FD_OBJECTID, DUTY_ID, NAME, LEADER, LEADER_TEL, DUTY_DATE, START_TIME, END_TIME, TELEPHONE, DUTY_WAY, IS_DEL, UPDATEDATE) "
  55. +" VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) ";*/
  56. String list1_SQL = "insert into ECM_GPS_LIST(FD_OBJECTID, TASK_NAME, LEVEL, DEPT, IS_DEL, UPDATEDATE, WRITER, WRITE_TIME, WRITE_DEPT) "
  57. +" VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?)";
  58. String list2_SQL = "insert into ECM_GPS_LIST_2(FD_OBJECTID, TASK_TIME, INPUT_MEN, INPUT_CAR, IS_DEL, UPDATEDATE, WRITER, WRITE_TIME, WRITE_DEPT,CONNECTIONID) "
  59. +" VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?) ";
  60. try {
  61. conn = dbConn.getConnection();
  62. conn.setAutoCommit(false);
  63. pstm = conn.prepareStatement(list1_SQL);
  64. pstm2 = conn.prepareStatement(list2_SQL);
  65. String fD_OBJECTID = IdentityGenerator.getIdentityGenerator().gerenalIdentity(615);//获取ID
  66. // pstm.setString(1, fD_OBJECTID);
  67. pstm.setString(1, fD_OBJECTID);
  68. pstm.setString(2, list1.getTask_name());
  69. pstm.setString(3, list1.getLevel());
  70. pstm.setString(4, list1.getDept());
  71. pstm.setString(5, "0");//0是未删除,1是删除
  72. pstm.setString(6, DateUtil.getCurrDateTimeStr());
  73. pstm.setString(7, list1.getWriter());
  74. pstm.setString(8, list1.getWrite_time());//这个时间在前台获取了
  75. pstm.setString(9, list1.getWrite_dept());
  76. // pstm.setString(9, "0");
  77. // pstm.setString(10, DateUtil.getCurrDateTimeStr());
  78. // pstm.setString(11, "0");
  79. pstm.executeUpdate();//执行SQL语句
  80. // List<EcmDutyDetail> detailList = duty.getDutyDetailList();
  81. if(list2!=null && !list2.isEmpty()){
  82. for(int i=0;i<list2.size();i++){
  83. ECMGPSLIST2 gpsList2 = list2.get(i);
  84. String OBJECTID = IdentityGenerator.getIdentityGenerator().gerenalIdentity(616);
  85. pstm2.setString(1, OBJECTID);
  86. pstm2.setString(2, gpsList2.getTask_time());
  87. pstm2.setString(3, gpsList2.getInput_men());
  88. pstm2.setString(4, gpsList2.getInput_car());
  89. pstm2.setString(5, "0");//0代表未删除,1代表删除
  90. pstm2.setString(6, DateUtil.getCurrDateTimeStr());
  91. pstm2.setString(7, gpsList2.getWriter());
  92. pstm2.setString(8, DateUtil.getCurrDateTimeStr());
  93. pstm2.setString(9, gpsList2.getWrite_dept());
  94. pstm2.setString(10, fD_OBJECTID); //主副表关联
  95. // pstm2.setString(11, "0");
  96. // pstm2.setString(12, DateUtil.getCurrDateTimeStr());
  97. pstm2.addBatch();
  98. }
  99. pstm2.executeBatch(); //批量保存
  100. }
  101. conn.commit();
  102. conn.setAutoCommit(true);
  103. flag=true;
  104. }catch(Exception e){
  105. try {
  106. conn.rollback();
  107. conn.setAutoCommit(true);
  108. } catch (SQLException e1) {
  109. e1.printStackTrace();
  110. }
  111. e.printStackTrace();
  112. }finally{
  113. try {
  114. pstm2.close();
  115. pstm.close();
  116. conn.close();
  117. } catch (SQLException e) {
  118. e.printStackTrace();
  119. }
  120. }
  121. return flag;
  122. }
  123. //第一张表的保存方法(ECM_GPS_LIST)
  124. // public void saveDuty(EcmEmDuty duty){
  125. public void saveList(ECMGPSLIST list1){
  126. DbConnection dbConn = new DbConnection();
  127. Connection conn = null;
  128. PreparedStatement pstm = null;
  129. /*String dutySQL = "insert into ECM_EM_DUTY(FD_OBJECTID, NAME, DEPT_NAMES, STATE, DUTY_TYPE, OPER_DEPT, OPER_NAME, OPER_TIME, IS_DEL, UPDATEDATE, RELEASE) "
  130. +" VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ? ,?)";*/
  131. String list1SQL = "insert into ECM_GPS_LIST(FD_OBJECTID, TASK_NAME, LEVEL, DEPT, IS_DEL, UPDATEDATE, WRITER, WRITE_TIME, WRITE_DEPT) "
  132. +" VALUES(?, ?, ?, ?, ?, ?, ?, ?, ? )";
  133. try {
  134. conn = dbConn.getConnection();
  135. conn.setAutoCommit(false);
  136. pstm = conn.prepareStatement(list1SQL);
  137. pstm.setString(1, list1.getFd_objectid());
  138. pstm.setString(2, list1.getTask_name());
  139. pstm.setString(3, list1.getLevel());
  140. pstm.setString(4, list1.getDept());
  141. pstm.setString(5, "0"); //0,未删除;1,删除
  142. pstm.setString(6, list1.getUpdatedate());
  143. pstm.setString(7, list1.getWriter());
  144. pstm.setString(8, list1.getWrite_time());
  145. pstm.setString(9, list1.getWrite_dept());
  146. /*pstm.setString(1, duty.getFd_objectid());
  147. pstm.setString(2, duty.getName());
  148. pstm.setString(3, duty.getDept_names());
  149. pstm.setString(4, "0");
  150. pstm.setString(5, "2"); //duty.getDuty_type()值班类型 1为预警 2为响应
  151. pstm.setString(6, duty.getOper_dept());
  152. pstm.setString(7, duty.getOper_name());
  153. pstm.setString(8, duty.getOper_time());
  154. pstm.setString(9, "0");
  155. pstm.setString(10, DateUtil.getCurrDateTimeStr());
  156. pstm.setString(11, "0");*/
  157. pstm.executeUpdate();
  158. conn.commit();
  159. conn.setAutoCommit(true);
  160. }catch(Exception e){
  161. try {
  162. conn.rollback();
  163. conn.setAutoCommit(true);
  164. } catch (SQLException e1) {
  165. e1.printStackTrace();
  166. }
  167. e.printStackTrace();
  168. }finally{
  169. try {
  170. pstm.close();
  171. conn.close();
  172. } catch (SQLException e) {
  173. e.printStackTrace();
  174. }
  175. }
  176. }
  177. //第一张表的修改方法(参数是第一张表实体类的一个对象)
  178. // public boolean updateDuty(EcmEmDuty duty){
  179. public boolean updateList1(ECMGPSLIST list1){
  180. boolean flag = false;
  181. DbConnection dbConn = new DbConnection();
  182. Connection conn = null;
  183. PreparedStatement pstm = null;
  184. /*String dutySQL = "update ECM_EM_DUTY set NAME = ?, DEPT_NAMES = ?, OPER_DEPT = ?, OPER_NAME = ?, OPER_TIME = ? , UPDATEDATE = ? "
  185. + " where FD_OBJECTID = ?"; */
  186. String list1SQL = "update ECM_GPS_LIST set TASK_NAME = ?, LEVEL = ?, DEPT = ?, UPDATEDATE = ?, WRITER = ?, WRITE_TIME = ?, WRITE_DEPT = ? where FD_OBJECTID = ?";
  187. try {
  188. conn = dbConn.getConnection();
  189. conn.setAutoCommit(false);
  190. pstm = conn.prepareStatement(list1SQL);
  191. pstm.setString(1, list1.getTask_name());
  192. pstm.setString(2, list1.getLevel());
  193. pstm.setString(3, list1.getDept());
  194. pstm.setString(4, DateUtil.getCurrDateTimeStr());
  195. pstm.setString(5, list1.getWriter());
  196. pstm.setString(6, DateUtil.getCurrDateTimeStr());
  197. pstm.setString(7, list1.getWrite_dept());
  198. pstm.setString(8, list1.getFd_objectid());
  199. /*pstm = conn.prepareStatement(dutySQL);
  200. pstm.setString(1, duty.getName());
  201. pstm.setString(2, duty.getDept_names());
  202. pstm.setString(3, duty.getOper_dept());
  203. pstm.setString(4, duty.getOper_name());
  204. pstm.setString(5, duty.getOper_time());
  205. pstm.setString(6, DateUtil.getCurrDateTimeStr());
  206. pstm.setString(7, duty.getFd_objectid());*/
  207. pstm.executeUpdate();
  208. conn.commit();
  209. conn.setAutoCommit(true);
  210. flag = true;
  211. }catch(Exception e){
  212. try {
  213. conn.rollback();
  214. conn.setAutoCommit(true);
  215. } catch (SQLException e1) {
  216. e1.printStackTrace();
  217. }
  218. e.printStackTrace();
  219. }finally{
  220. try {
  221. if(pstm!=null)
  222. pstm.close();
  223. if(conn!=null)
  224. conn.close();
  225. } catch (SQLException e) {
  226. e.printStackTrace();
  227. }
  228. }
  229. return flag;
  230. }
  231. /*public EcmEmDuty queryEcmDuty(String fd_objectid){
  232. EcmEmDuty duty = null;
  233. return duty;
  234. }*/
  235. //第二张表的删除
  236. // public boolean deleteDetail(String fd_id){
  237. public boolean deleteList2(String fd_id){
  238. boolean ret = false;
  239. DbConnection dbConn = new DbConnection();
  240. Connection conn = null;
  241. PreparedStatement pstm = null;
  242. //String delSQL = "delete from ECM_EM_DUTY_DETAIL t where t.FD_OBJECTID = ? ";
  243. String delSQL = "update ECM_GPS_LIST_2 t set t.IS_DEL = '1' where t.FD_OBJECTID = ? ";
  244. try{
  245. conn = dbConn.getConnection();
  246. conn.setAutoCommit(false);
  247. pstm = conn.prepareStatement(delSQL);
  248. pstm.setString(1, fd_id);
  249. pstm.executeUpdate();
  250. conn.commit();
  251. conn.setAutoCommit(true);
  252. ret = true;
  253. }catch(Exception e){
  254. e.printStackTrace();
  255. }finally{
  256. try {
  257. pstm.close();
  258. conn.close();
  259. } catch (SQLException e) {
  260. e.printStackTrace();
  261. }
  262. }
  263. return ret;
  264. }
  265. //第二张表的保存方法(ECM_GPS_LIST_2)
  266. // public boolean saveDetail(EcmDutyDetail detail){
  267. public boolean savelist2(ECMGPSLIST2 list2){
  268. boolean flag = false;
  269. DbConnection dbConn = new DbConnection();
  270. Connection conn = null;
  271. PreparedStatement pstm = null;
  272. // String detailSQL = "insert into ECM_EM_DUTY_DETAIL(FD_OBJECTID, DUTY_ID, NAME, LEADER, LEADER_TEL, DUTY_DATE, START_TIME, END_TIME, TELEPHONE, DUTY_WAY, IS_DEL, UPDATEDATE) "
  273. // +" VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) ";
  274. String list2SQL = "insert into ECM_GPS_LIST_2(FD_OBJECTID, TASK_TIME, INPUT_MEN, INPUT_CAR, IS_DEL, UPDATEDATE, WRITER, WRITE_TIME, WRITE_DEPT, CONNECTIONID) VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?) ";
  275. try {
  276. conn = dbConn.getConnection();
  277. conn.setAutoCommit(false);
  278. pstm = conn.prepareStatement(list2SQL);
  279. String OBJECTID = IdentityGenerator.getIdentityGenerator().gerenalIdentity(616);
  280. pstm.setString(1, OBJECTID);
  281. pstm.setString(2, list2.getTask_time());
  282. pstm.setString(3, list2.getInput_men());
  283. pstm.setString(4, list2.getInput_car());
  284. pstm.setString(5, "0");
  285. pstm.setString(6, list2.getUpdatedate());
  286. pstm.setString(7, list2.getWriter());
  287. pstm.setString(8, DateUtil.getCurrDateTimeStr());
  288. pstm.setString(9, list2.getWrite_dept());
  289. pstm.setString(10, list2.getConnectionid()); //主副表关联
  290. /*pstm.setString(1, OBJECTID);
  291. pstm.setString(2, detail.getDuty_id()); //主副表关联
  292. pstm.setString(3, detail.getName());
  293. pstm.setString(4, detail.getLeader());
  294. pstm.setString(5, detail.getLeader_tel());
  295. pstm.setString(6, detail.getDuty_date());
  296. pstm.setString(7, detail.getStart_time());
  297. pstm.setString(8, detail.getEnd_time());
  298. pstm.setString(9, detail.getTelephone());
  299. pstm.setString(10, detail.getDuty_way());
  300. pstm.setString(11, "0");
  301. pstm.setString(12, DateUtil.getCurrDateTimeStr());*/
  302. pstm.executeUpdate();
  303. conn.commit();
  304. conn.setAutoCommit(true);
  305. flag = true;
  306. }catch(Exception e){
  307. try {
  308. conn.rollback();
  309. conn.setAutoCommit(true);
  310. } catch (SQLException e1) {
  311. e1.printStackTrace();
  312. }
  313. e.printStackTrace();
  314. }finally{
  315. try {
  316. pstm.close();
  317. conn.close();
  318. } catch (SQLException e) {
  319. e.printStackTrace();
  320. }
  321. }
  322. return flag;
  323. }
  324. //修改第二章表(ECM_GPS_LIST_2)
  325. // public boolean updateDetail(EcmDutyDetail detail){
  326. public boolean updateList2(ECMGPSLIST2 list2){
  327. boolean flag = false;
  328. DbConnection dbConn = new DbConnection();
  329. Connection conn = null;
  330. PreparedStatement pstm = null;
  331. /*String detailSQL = "update ECM_EM_DUTY_DETAIL " //DUTY_ID = ?,
  332. +" set FD_OBJECTID = ?, NAME = ?, LEADER = ?, LEADER_TEL = ?, DUTY_DATE = ?, START_TIME = ?, END_TIME = ?, TELEPHONE = ?, DUTY_WAY = ?, IS_DEL = ?, UPDATEDATE = ? "
  333. + " where FD_OBJECTID = ?";*/
  334. String list2SQL = "update ECM_GPS_LIST_2 "
  335. +" set FD_OBJECTID = ?, TASK_TIME = ?, INPUT_MEN = ?, INPUT_CAR = ?, UPDATEDATE = ?, WRITER = ?, WRITE_TIME = ?, WRITE_DEPT = ?"
  336. + " where FD_OBJECTID = ?";
  337. try {
  338. conn = dbConn.getConnection();
  339. conn.setAutoCommit(false);
  340. pstm = conn.prepareStatement(list2SQL);
  341. pstm.setString(1, list2.getFd_objectid());
  342. pstm.setString(2, list2.getTask_time());
  343. pstm.setString(3, list2.getInput_men());
  344. pstm.setString(4, list2.getInput_car());
  345. pstm.setString(5, DateUtil.getCurrDateTimeStr());
  346. pstm.setString(6, list2.getWriter());
  347. pstm.setString(7, DateUtil.getCurrDateTimeStr());
  348. pstm.setString(8, list2.getWrite_dept());
  349. /*pstm = conn.prepareStatement(detailSQL);
  350. pstm.setString(1, detail.getFd_objectid());
  351. // pstm.setString(2, detail.getDuty_id()); //主副表关联
  352. pstm.setString(2, detail.getName());
  353. pstm.setString(3, detail.getLeader());
  354. pstm.setString(4, detail.getLeader_tel());
  355. pstm.setString(5, detail.getDuty_date());
  356. pstm.setString(6, detail.getStart_time());
  357. pstm.setString(7, detail.getEnd_time());
  358. pstm.setString(8, detail.getTelephone());
  359. pstm.setString(9, detail.getDuty_way());
  360. pstm.setString(10, "0");
  361. pstm.setString(11, DateUtil.getCurrDateTimeStr());
  362. pstm.setString(12, detail.getFd_objectid());*/
  363. pstm.executeUpdate();
  364. conn.commit();
  365. conn.setAutoCommit(true);
  366. flag = true;
  367. }catch(Exception e){
  368. try {
  369. conn.rollback();
  370. conn.setAutoCommit(true);
  371. } catch (SQLException e1) {
  372. e1.printStackTrace();
  373. }
  374. e.printStackTrace();
  375. }finally{
  376. try {
  377. pstm.close();
  378. conn.close();
  379. } catch (SQLException e) {
  380. e.printStackTrace();
  381. }
  382. }
  383. return flag;
  384. }
  385. //分页查询 达梦分页方式
  386. @SuppressWarnings("rawtypes")
  387. // public List queryDetailByDutyid(String dutyid){
  388. public List queryListByConnectionid(String connectionid){
  389. //,int pageStart,int pageSize
  390. DbConnection dbConn = new DbConnection();
  391. Connection conn = null;
  392. PreparedStatement pstm = null;
  393. ResultSet rs = null;
  394. String strSQL = "select FD_OBJECTID, TASK_TIME, INPUT_MEN, INPUT_CAR, IS_DEL, UPDATEDATE, WRITER, WRITE_TIME, WRITE_DEPT"
  395. + " from ECM_GPS_LIST_2 "
  396. + " where CONNECTIONID = ? and IS_DEL='0' "
  397. + " order by TASK_TIME desc ";
  398. /* // String strSQL = "select top "+pageStart+","+pageSize+" FD_OBJECTID,DUTY_ID,NAME,LEADER,LEADER_TEL,DUTY_DATE,START_TIME,END_TIME,TELEPHONE,DUTY_WAY,IS_DEL,UPDATEDATE "
  399. +" from ECM_EM_DUTY_DETAIL "
  400. +" where DUTY_ID = ? and IS_DEL='0' "
  401. +" order by duty_date desc ,start_time desc ";*/
  402. // List<EcmDutyDetail> detailList = new ArrayList<EcmDutyDetail>();
  403. List<ECMGPSLIST2> gpsList2 = new ArrayList<ECMGPSLIST2>();
  404. try {
  405. conn = dbConn.getConnection();
  406. pstm = conn.prepareStatement(strSQL);
  407. pstm.setString(1, connectionid);
  408. rs = pstm.executeQuery();
  409. while(rs.next()){
  410. ECMGPSLIST2 list2 = new ECMGPSLIST2();
  411. list2.setFd_objectid(rs.getString("FD_OBJECTID"));
  412. list2.setTask_time(rs.getString("TASK_TIME"));
  413. list2.setInput_men(rs.getString("INPUT_MEN"));
  414. list2.setInput_car(rs.getString("INPUT_CAR"));
  415. list2.setIs_del(rs.getString("IS_DEL"));
  416. list2.setUpdatedate(rs.getString("UPDATEDATE"));
  417. list2.setWriter(rs.getString("WRITER"));
  418. list2.setWrite_time(rs.getString("WRITE_TIME"));
  419. list2.setWrite_dept(rs.getString("WRITE_DEPT"));
  420. gpsList2.add(list2);
  421. /*EcmDutyDetail detail = new EcmDutyDetail();
  422. detail.setFd_objectid(rs.getString("FD_OBJECTID"));
  423. detail.setDuty_id(rs.getString("DUTY_ID"));
  424. detail.setName(rs.getString("NAME"));
  425. detail.setLeader(rs.getString("LEADER"));
  426. detail.setLeader_tel(rs.getString("LEADER_TEL"));
  427. detail.setDuty_date(rs.getString("DUTY_DATE"));
  428. detail.setStart_time(rs.getString("START_TIME"));
  429. detail.setEnd_time(rs.getString("END_TIME"));
  430. detail.setTelephone(rs.getString("TELEPHONE"));
  431. detail.setDuty_way(rs.getString("DUTY_WAY"));
  432. detail.setIs_del(rs.getString("IS_DEL"));
  433. detail.setUpdatedate(rs.getString("UPDATEDATE"));
  434. detailList.add(detail);*/
  435. }
  436. }catch(Exception e){
  437. e.printStackTrace();
  438. }finally{
  439. try {
  440. rs.close();
  441. pstm.close();
  442. conn.close();
  443. } catch (SQLException e) {
  444. e.printStackTrace();
  445. }
  446. }
  447. return gpsList2;
  448. }
  449. //根据id获取第一张表的数据(ECM_GPS_LIST)
  450. // public EcmEmDuty getDutyById(String dutyid){
  451. public ECMGPSLIST getListById(String listid){
  452. String sqlSql = "select FD_OBJECTID, TASK_NAME, LEVEL, DEPT, IS_DEL, UPDATEDATE, WRITER, WRITE_TIME, WRITE_DEPT "
  453. + " from ECM_GPS_LIST where FD_OBJECTID = ? ";
  454. /*String sqlSql = "select FD_OBJECTID,NAME,DEPT_NAMES,STATE,DUTY_TYPE,OPER_DEPT,OPER_NAME,OPER_TIME,IS_DEL,UPDATEDATE "
  455. +" from ECM_EM_DUTY where FD_OBJECTID = ? ";*/
  456. DbConnection dbConn = new DbConnection();
  457. Connection conn = null;
  458. PreparedStatement pstm = null;
  459. ResultSet rs = null;
  460. // EcmEmDuty duty = null;
  461. ECMGPSLIST list1 = null;
  462. try {
  463. conn = dbConn.getConnection();
  464. pstm = conn.prepareStatement(sqlSql);
  465. pstm.setString(1, listid);
  466. rs = pstm.executeQuery();
  467. while(rs.next()){
  468. list1 = new ECMGPSLIST();
  469. list1.setFd_objectid(rs.getString("FD_OBJECTID"));
  470. list1.setTask_name(rs.getString("TASK_NAME"));
  471. list1.setLevel(rs.getString("LEVEL"));
  472. list1.setDept(rs.getString("DEPT"));
  473. list1.setIs_del(rs.getString("IS_DEL"));
  474. list1.setUpdatedate(rs.getString("UPDATEDATE"));
  475. list1.setWriter(rs.getString("WRITER"));
  476. list1.setWrite_time(rs.getString("WRITE_TIME"));
  477. list1.setWrite_dept(rs.getString("WRITE_DEPT"));
  478. /*duty = new EcmEmDuty();
  479. duty.setFd_objectid(rs.getString("FD_OBJECTID"));
  480. duty.setName(rs.getString("NAME"));
  481. duty.setDept_names(rs.getString("DEPT_NAMES"));
  482. duty.setState(rs.getString("STATE"));
  483. duty.setDuty_type(rs.getString("DUTY_TYPE"));
  484. duty.setOper_dept(rs.getString("OPER_DEPT"));
  485. duty.setOper_name(rs.getString("OPER_NAME"));
  486. duty.setOper_time(rs.getString("OPER_TIME"));
  487. duty.setIs_del(rs.getString("IS_DEL"));
  488. duty.setUpdatedate(rs.getString("UPDATEDATE"));*/
  489. }
  490. }catch(Exception e){
  491. e.printStackTrace();
  492. }finally{
  493. try {
  494. rs.close();
  495. pstm.close();
  496. conn.close();
  497. } catch (SQLException e) {
  498. e.printStackTrace();
  499. }
  500. }
  501. return list1;
  502. }
  503. /*
  504. public boolean updateStat(String[] fdids,String svalue,String rvalue,String releasetime,String reporttime){
  505. boolean flag = false;
  506. int handlestate = 0;
  507. String strSql = " update ECM_EM_DUTY set STATE = ?, RELEASE = ? where FD_OBJECTID = ?" ;
  508. if(releasetime!=null){
  509. handlestate = 1;
  510. strSql = " update ECM_EM_DUTY set STATE = ?, RELEASE = ?,RELEASE_TIME = ? where FD_OBJECTID = ?" ;
  511. }
  512. if(reporttime!=null){
  513. handlestate = 2;
  514. strSql = " update ECM_EM_DUTY set STATE = ?, RELEASE = ?,REPORTING_TIME = ? where FD_OBJECTID = ?" ;
  515. }
  516. if(releasetime!=null && reporttime!=null){
  517. handlestate = 3;
  518. strSql = " update ECM_EM_DUTY set STATE = ?, RELEASE = ?,REPORTING_TIME = ?,RELEASE_TIME = ? where FD_OBJECTID = ?" ;
  519. }
  520. DbConnection dbConn = new DbConnection();
  521. Connection conn = null;
  522. PreparedStatement pstm = null;
  523. try {
  524. conn = dbConn.getConnection();
  525. conn.setAutoCommit(false);
  526. pstm = conn.prepareStatement(strSql);
  527. for(int i=0;i<fdids.length;i++){
  528. pstm.setString(1, svalue);
  529. pstm.setString(2, rvalue);
  530. if(handlestate==0){
  531. pstm.setString(3, fdids[i]);
  532. }
  533. if(handlestate==1){
  534. pstm.setString(3, releasetime);
  535. pstm.setString(4, fdids[i]);
  536. }
  537. if(handlestate==2){
  538. pstm.setString(3, reporttime);
  539. pstm.setString(4, fdids[i]);
  540. }
  541. if(handlestate==3){
  542. pstm.setString(3, reporttime);
  543. pstm.setString(4, releasetime);
  544. pstm.setString(5, fdids[i]);
  545. }
  546. pstm.addBatch();
  547. }
  548. pstm.executeBatch();
  549. conn.commit();
  550. conn.setAutoCommit(true);
  551. flag = true;
  552. }catch(Exception e){
  553. e.printStackTrace();
  554. }finally{
  555. try {
  556. pstm.close();
  557. conn.close();
  558. } catch (SQLException e) {
  559. e.printStackTrace();
  560. }
  561. }
  562. return flag;
  563. }*/
  564. //首页的删除(删除第一张表信息的同时也删除第二张表对应的信息)--批量删除
  565. // public boolean deleteDuty(String[] objectIDs){
  566. public boolean deleteLIST(String[] objectIDs){
  567. boolean ret = false;
  568. DbConnection dbConn = new DbConnection();
  569. Connection conn = null;
  570. PreparedStatement pstm = null;
  571. PreparedStatement pstm2 = null;
  572. String delList1 = "update ECM_GPS_LIST t set t.IS_DEL = '1' where t.FD_OBJECTID = ? ";
  573. String delList2 = "update ECM_GPS_LIST_2 t set t.IS_DEL = '1' where t.CONNECTIONID = ? ";
  574. try{
  575. conn = dbConn.getConnection();
  576. conn.setAutoCommit(false);
  577. pstm = conn.prepareStatement(delList1);
  578. pstm2 = conn.prepareStatement(delList2);
  579. for(int i=0;i<objectIDs.length;i++){
  580. String fd_id = objectIDs[i];
  581. pstm.setString(1, fd_id);
  582. pstm.addBatch();
  583. pstm2.setString(1, fd_id);
  584. pstm2.addBatch();
  585. }
  586. pstm.executeBatch();
  587. pstm2.executeBatch();
  588. conn.commit();
  589. conn.setAutoCommit(true);
  590. ret = true;
  591. }catch(Exception e){
  592. try {
  593. conn.rollback();
  594. conn.setAutoCommit(true);
  595. } catch (SQLException e1) {
  596. e1.printStackTrace();
  597. }
  598. e.printStackTrace();
  599. return ret;
  600. }finally{
  601. try {
  602. pstm2.close();
  603. pstm.close();
  604. conn.close();
  605. } catch (SQLException e) {
  606. e.printStackTrace();
  607. }
  608. }
  609. return ret;
  610. }
  611. //首页的删除(删除第一张表信息的同时也删除第二张表对应的信息)--批量删除
  612. // public boolean deDutyDetail(String[] params){
  613. public boolean delBothList(String[] params){
  614. // TODO Auto-generated method stub
  615. boolean flag=false;
  616. DbConnection dbConn = new DbConnection();
  617. Connection conn = null;
  618. PreparedStatement pstm1 = null;
  619. PreparedStatement pstm2 = null;
  620. String delList1SQL="update ECM_EM_DUTY set IS_DEL ='1' where FD_OBJECTID=?";
  621. String delList2SQL ="update ECM_EM_DUTY_DETAIL set IS_DEL ='1' where DUTY_ID=?";
  622. try{
  623. conn=dbConn.getConnection();
  624. conn.setAutoCommit(false);
  625. pstm1=conn.prepareStatement(delList1SQL);
  626. pstm2=conn.prepareStatement(delList2SQL);
  627. for(int i=0;i<params.length;i++){
  628. pstm1.setString(1, params[i]);
  629. pstm2.setString(1, params[i]);
  630. pstm1.executeUpdate();
  631. pstm2.executeUpdate();
  632. }
  633. conn.commit();
  634. conn.setAutoCommit(true);
  635. flag=true;
  636. //System.out.println(123123123);
  637. }catch(Exception e){
  638. try {
  639. conn.rollback();
  640. conn.setAutoCommit(true);
  641. } catch (SQLException e1) {
  642. e1.printStackTrace();
  643. }
  644. e.printStackTrace();
  645. }finally{
  646. try {
  647. if(pstm1!=null)
  648. pstm1.close();
  649. if(pstm2!=null)
  650. pstm2.close();
  651. if(conn!=null)
  652. conn.close();
  653. } catch (SQLException e) {
  654. e.printStackTrace();
  655. }
  656. }
  657. return flag;
  658. }
  659. public boolean saveBGDmingxi(List<BGDmingxi> gsplist2, String taskId) throws Exception {
  660. Connection conn = null;
  661. PreparedStatement st = null;
  662. DbConnection db = new DbConnection();
  663. DateFormat format=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
  664. try {
  665. String sql = "select PROGRAM_NAME,TO_CHAR(UPDATEDATE,'yyyy-mm-dd hh24:mi:ss'),GPS_LEVEL from ECM_GPS_PROGRAM_MANAGEMENT where FD_OBJECTID='"+taskId+"'";
  666. log.info("queryTask_sql:"+sql);
  667. List<String[]> tempList = persistence.getSearchResult(610, sql.toString());
  668. String taskName = "";
  669. String taskTime = "";
  670. String taskLevel = "";
  671. if(tempList!=null && tempList.size()>0){
  672. String[] arr = tempList.get(0);
  673. taskName = arr[0];
  674. taskTime = arr[1];
  675. taskLevel = arr[2];
  676. }
  677. if("0".equals(taskLevel)){
  678. taskLevel = "特级";
  679. }else if("1".equals(taskLevel)){
  680. taskLevel = "一级";
  681. }else if("2".equals(taskLevel)){
  682. taskLevel = "二级";
  683. }else if("3".equals(taskLevel)){
  684. taskLevel = "三级";
  685. }
  686. String sql1 = "insert into ECM_GPS_JOURNALING ( FD_OBJECTID, INPUT_NAME, INPUT_TIME, INPUT_DEPT, MAN_COUNT, CAR_COUNT, IS_DEL, UPDATEDATE, FD_TASK, FD_TASK_NAME, BGD_FDC, BGD_FDJ, BGD_RW_TIME, BGD_DW ,BGD_LEVEL,XINGHAO,RONGLIANG,CHANJIA,QTZHUNGBEI)VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
  687. conn = db.getConnection();
  688. int num=0;
  689. conn.setAutoCommit(false);
  690. //系统当前时间
  691. Date date=new Date();
  692. String time=format.format(date);
  693. st = conn.prepareStatement(sql1);
  694. for (int i = 0; i < gsplist2.size(); i++) {
  695. BGDmingxi mx = gsplist2.get(i);
  696. System.out.println(mx.getFD_OBJECTID());
  697. String fd_id=IdentityGenerator.getIdentityGenerator().gerenalIdentity(613);
  698. st.setString(1, fd_id);
  699. st.setString(2, mx.getINPUT_NAME());
  700. st.setString(3, time);
  701. st.setString(4, mx.getINPUT_DEPT());
  702. st.setString(5, mx.getMAN_COUNT());
  703. st.setString(6, mx.getCAR_COUNT());
  704. st.setString(7, "0");
  705. st.setString(8, time);
  706. st.setString(9, taskId);
  707. st.setString(10, taskName);
  708. st.setString(11, mx.getBGD_FDC());
  709. st.setString(12, mx.getBGD_FDJ());
  710. st.setString(13, taskTime);
  711. st.setString(14, mx.getBGD_DW());
  712. st.setString(15, taskLevel);
  713. st.setString(16, mx.getXINGHAO());
  714. st.setString(17, mx.getRONGLIANG());
  715. st.setString(18, mx.getCHANJIA());
  716. st.setString(19, mx.getQTZHUNGBEI());
  717. st.executeUpdate();
  718. num++;
  719. }
  720. if(num==gsplist2.size()){
  721. log.info("保存成功");
  722. conn.commit();
  723. return true;
  724. }else{
  725. // st.executeBatch();
  726. conn.rollback();
  727. log.info("保存失败");
  728. return false;
  729. }
  730. } catch (Exception e) {
  731. throw e;
  732. }finally{
  733. try {
  734. if(st!= null)
  735. st.close();
  736. if(conn!= null)
  737. conn.close();
  738. } catch (SQLException e) {
  739. e.printStackTrace();
  740. }
  741. }
  742. }
  743. public List<String[]> getBGDCorpByTaskId(String taskId){
  744. String sql = "select GPS_AREA_NAME from ECM_GPS_PROGRAM_MANAGEMENT where FD_OBJECTID='"+taskId+"'";
  745. log.info("queryTask_sql:"+sql);
  746. List<String[]> tempList = null;
  747. try {
  748. tempList = persistence.getSearchResult(610, sql.toString());
  749. } catch (PersistenceException e) {
  750. // TODO Auto-generated catch block
  751. e.printStackTrace();
  752. }
  753. return tempList;
  754. }
  755. public List<String[]> getBGDNumByTaskId(String taskId){
  756. String sql = "select GPS_TASK_NUMBER,PROGRAM_NAME,START_TIME,END_TIME,GPS_CONTINATION_TIME from ECM_GPS_PROGRAM_MANAGEMENT where FD_OBJECTID='"+taskId+"'";
  757. log.info("queryTask_sql:"+sql);
  758. List<String[]> tempList = null;
  759. try {
  760. tempList = persistence.getSearchResult(610, sql.toString());
  761. } catch (PersistenceException e) {
  762. // TODO Auto-generated catch block
  763. e.printStackTrace();
  764. }
  765. return tempList;
  766. }
  767. public boolean saveBGDBaoBiao(List<BGDBaoBiao> gsplist2, String taskId, String bgdNum, String bgdName) throws Exception {
  768. Connection conn = null;
  769. PreparedStatement st = null;
  770. DbConnection db = new DbConnection();
  771. DateFormat format=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
  772. try {
  773. String sql1 = "insert into NWYJ.ECM_GPS_ZIYUANBAOBIAO(FD_OBJECTID, INPUT_UNIT_ID, INPUT_UNIT_NAME, INPUT_NAME, "
  774. + "INPUT_NAME_ID, UPDATEDATE, INPUT_TIME, IS_DEL, GPS_TASK_NUMBER, GPS_TASK_FDC_DAY, GPS_TASK__FDC_TOTAL,"
  775. + " GPS_TASK_FDJ_DAY, GPS_TASK_FDJ_TOTAL, GPS_TASK_CAR, GPS_TASK_ZBZHGLRY, GPS_TASK_BDWBZRY, GPS_TASK_ABRY,"
  776. + " GPS_TASK_WWSCRY, TASK_ID, TASK_NAME) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
  777. conn = db.getConnection();
  778. int num=0;
  779. conn.setAutoCommit(false);
  780. //系统当前时间
  781. Date date=new Date();
  782. String time=format.format(date);
  783. st = conn.prepareStatement(sql1);
  784. for (int i = 0; i < gsplist2.size(); i++) {
  785. BGDBaoBiao mx = gsplist2.get(i);
  786. System.out.println(mx.getFD_OBJECTID());
  787. String fd_id=IdentityGenerator.getIdentityGenerator().gerenalIdentity(620);
  788. st.setString(1, fd_id);
  789. st.setString(2, mx.getINPUT_UNIT_ID());
  790. st.setString(3, mx.getINPUT_UNIT_NAME());
  791. st.setString(4, mx.getINPUT_TIME());
  792. st.setString(5, mx.getINPUT_NAME_ID());
  793. st.setString(6, time);
  794. st.setString(7, time);
  795. st.setString(8, "0");
  796. st.setString(9, bgdNum);
  797. st.setString(10, mx.getGPS_TASK_FDC_DAY());
  798. st.setString(11, mx.getGPS_TASK__FDC_TOTAL());
  799. st.setString(12, mx.getGPS_TASK_FDJ_DAY());
  800. st.setString(13, mx.getGPS_TASK_FDJ_TOTAL());
  801. st.setString(14, mx.getGPS_TASK_CAR());
  802. st.setString(15, mx.getGPS_TASK_ZBZHGLRY());
  803. st.setString(16, mx.getGPS_TASK_BDWBZRY());
  804. st.setString(17, mx.getGPS_TASK_ABRY());
  805. st.setString(18, mx.getGPS_TASK_WWSCRY());
  806. st.setString(19, taskId);
  807. st.setString(20, bgdName);
  808. st.executeUpdate();
  809. num++;
  810. }
  811. if(num==gsplist2.size()){
  812. log.info("保存成功");
  813. conn.commit();
  814. return true;
  815. }else{
  816. // st.executeBatch();
  817. conn.rollback();
  818. log.info("保存失败");
  819. return false;
  820. }
  821. } catch (Exception e) {
  822. throw e;
  823. }finally{
  824. try {
  825. if(st!= null)
  826. st.close();
  827. if(conn!= null)
  828. conn.close();
  829. } catch (SQLException e) {
  830. e.printStackTrace();
  831. }
  832. }
  833. }
  834. public boolean saveBGDTask(List<BaoGongDianTask> gpsList2) throws Exception {
  835. boolean flag = false;
  836. Connection conn = null;
  837. PreparedStatement st = null;
  838. DbConnection db = new DbConnection();
  839. try {
  840. String sql1 = "insert into NWYJ.ECM_GPS_PROGRAM_MANAGEMENT(FD_OBJECTID, PROGRAM_NAME, GPS_LEVEL, GPS_AREA_NAME, "
  841. + "IMPLEMENT_TIME, PROGRAM_STATE, INPUT_UNIT_ID, INPUT_TIME, INPUT_NAME, START_TIME, END_TIME, COMMENT_TEXT,"
  842. + " TASK_STATE, UPDATEDATE, IS_DEL, GPS_AREA_ID, INPUT_UNIT_NAME, GPS_AREA_CITY, HAS_DUTY, GPS_YEAR,"
  843. + " GPS_AREA_ID_FU, ISSUE_DEPT, INPUT_NAME_ID, ISSUE_TIME, PARENT_DEPT_ID, GPS_AREA_CITY_ID, GPS_SM, GPS_SIREL,"
  844. + " GPS_SIREL_FILE, GPS_TASK_NUMBER, GPS_TASK_PROPERTY, GPS_TASK_TYPE, GPS_TASK_PLAN_TYPE, GPS_TASK_QUYU,"
  845. + " GPS_TASK_FDC_DAY, GPS_TASK__FDC_TOTAL, GPS_TASK_FDJ_DAY, GPS_TASK_FDJ_TOTAL, GPS_TASK_CAR, GPS_TASK_ZBZHGLRY,"
  846. + " GPS_TASK_BDWBZRY, GPS_TASK_ABRY, GPS_TASK_WWSCRY, GPS_CONTINATION_TIME) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?);";
  847. conn = db.getConnection();
  848. conn.setAutoCommit(false);
  849. //系统当前时间
  850. Date date=new Date();
  851. st = conn.prepareStatement(sql1);
  852. for (int i = 0; i < gpsList2.size(); i++) {
  853. BaoGongDianTask mx = gpsList2.get(i);
  854. st.setString(1, mx.getFD_OBJECTID());
  855. st.setString(2, mx.getPROGRAM_NAME());
  856. st.setString(3, mx.getGPS_LEVEL());
  857. st.setString(4, mx.getGPS_AREA_NAME());
  858. st.setString(5, mx.getIMPLEMENT_TIME());
  859. st.setString(6, mx.getPROGRAM_STATE());
  860. st.setString(7, mx.getINPUT_UNIT_ID());
  861. st.setString(8, mx.getINPUT_TIME());
  862. st.setString(9, mx.getINPUT_NAME());
  863. st.setString(10, mx.getSTART_TIME());
  864. st.setString(11, mx.getEND_TIME());
  865. st.setString(12, mx.getCOMMENT_TEXT());
  866. st.setString(13, mx.getTASK_STATE());
  867. st.setString(14, mx.getUPDATEDATE());
  868. st.setString(15, mx.getIS_DEL());
  869. st.setString(16, mx.getGPS_AREA_ID());
  870. st.setString(17, mx.getINPUT_UNIT_NAME());
  871. st.setString(18, mx.getGPS_AREA_CITY());
  872. st.setString(19, mx.getHAS_DUTY());
  873. st.setString(20, mx.getGPS_YEAR());
  874. st.setString(21, mx.getGPS_AREA_ID_FU());
  875. st.setString(22, mx.getISSUE_DEPT());
  876. st.setString(23, mx.getINPUT_NAME_ID());
  877. st.setString(24, mx.getISSUE_TIME());
  878. st.setString(25, mx.getPARENT_DEPT_ID());
  879. st.setString(26, mx.getGPS_AREA_CITY_ID());
  880. st.setString(27, mx.getGPS_SM());
  881. st.setString(28, mx.getGPS_SIREL());
  882. st.setString(29, mx.getGPS_SIREL_FILE());
  883. st.setString(30, mx.getGPS_TASK_NUMBER());
  884. st.setString(31, mx.getGPS_TASK_PROPERTY());
  885. st.setString(32, mx.getGPS_TASK_TYPE());
  886. st.setString(33, mx.getGPS_TASK_PLAN_TYPE());
  887. st.setString(34, mx.getGPS_TASK_QUYU());
  888. st.setString(35, mx.getGPS_TASK_FDC_DAY());
  889. st.setString(36, mx.getGPS_TASK__FDC_TOTAL());
  890. st.setString(37, mx.getGPS_TASK_FDJ_DAY());
  891. st.setString(38, mx.getGPS_TASK_FDJ_TOTAL());
  892. st.setString(39, mx.getGPS_TASK_CAR());
  893. st.setString(40, mx.getGPS_TASK_ZBZHGLRY());
  894. st.setString(41, mx.getGPS_TASK_BDWBZRY());
  895. st.setString(42, mx.getGPS_TASK_ABRY());
  896. st.setString(43, mx.getGPS_TASK_WWSCRY());
  897. st.setString(44, mx.getGPS_CONTINATION_TIME());
  898. st.addBatch();
  899. log.info("saveBGDTask__"+i);
  900. }
  901. st.executeBatch();
  902. conn.commit();
  903. flag = true;
  904. } catch (Exception e) {
  905. conn.rollback();
  906. throw e;
  907. }finally{
  908. try {
  909. if(st!= null)
  910. st.close();
  911. if(conn!= null)
  912. conn.close();
  913. } catch (SQLException e) {
  914. e.printStackTrace();
  915. }
  916. }
  917. return flag;
  918. }
  919. }