befb7860c2396dc11d7d5b33f022f110a749c61d.svn-base 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544
  1. package com.sinosoft.em.response.equipment.records.service;
  2. import java.sql.Connection;
  3. import java.sql.PreparedStatement;
  4. import java.sql.ResultSet;
  5. import java.sql.SQLException;
  6. import javax.ws.rs.POST;
  7. import javax.ws.rs.Path;
  8. import javax.ws.rs.ProduceMime;
  9. import com.persistence.DbConnection;
  10. import com.sinosoft.lz.system.Utils;
  11. @Path("EquipAllotUpdateEquipState")
  12. public class EquipAllotUpdateEquipState {
  13. @POST
  14. @ProduceMime("application/json")
  15. @Path("/updateEquipStateToBusy/")
  16. public String updateEquipStateToBusy(String param){//修改应急装备的状态
  17. //param = param.toString().split("=")[1];
  18. //String sql="update EMC_AM_GENERATOR_CAR set IS_USED='2' , USED_STAT='2' where FD_OBJECTID='"+param+"' and is_del='0'";
  19. String equipId = Utils.getParameter("FD_OBJECTID", param) == null ? "" : Utils.getParameter("FD_OBJECTID", param);//装备ID
  20. String equipType = Utils.getParameter("EQUIPMENT_TYPE", param) == null ? "" : Utils.getParameter("EQUIPMENT_TYPE", param);//装备类型,用于判断sql从哪张表里面查
  21. String sql = "";
  22. if("265".equals(equipType)){
  23. //sql = "select CAR_NUM,IS_USED from EMC_AM_GENERATOR_CAR where FD_OBJECTID='"+equipId+"'";
  24. sql = "update EMC_AM_GENERATOR_CAR set IS_USED = '2' , USED_STAT = '2' where FD_OBJECTID = '"+equipId+"' and is_del='0'";//IS_USED = '2' 不可调用
  25. } else if("266".equals(equipType)){
  26. //sql = "select NUM,USED_STAT from EMC_AM_GENERATOR where FD_OBJECTID='"+equipId+"'";
  27. sql = "update EMC_AM_GENERATOR set USED_STAT = '2' , IS_USED = '2' where FD_OBJECTID = '"+equipId+"' and is_del='0'";//USED_STAT = '2' 调拨中
  28. } else if("270".equals(equipType)){
  29. //sql = "select CAR_NUM,USED_STAT from EMC_AM_DINING_CAR where FD_OBJECTID='"+equipId+"'";
  30. sql = "update EMC_AM_DINING_CAR set IS_USED = '2' , USED_STAT = '2' where FD_OBJECTID = '"+equipId+"' and is_del='0'";//IS_USED = '2' 不可调用
  31. } else if("269".equals(equipType)){
  32. //sql = "select CAR_NUM,USED_STAT from EMC_AM_EMERGENCY_COMMAND_CAR where FD_OBJECTID='"+equipId+"'";
  33. sql = "update EMC_AM_EMERGENCY_COMMAND_CAR set USED_STAT = '2' , IS_USED = '2' where FD_OBJECTID = '"+equipId+"' and is_del='0'";//USED_STAT = '2' 调拨中
  34. }
  35. //System.out.println("******//////////***********"+sql);
  36. DbConnection dbConn = new DbConnection();//数据库连接
  37. Connection conn = null;
  38. PreparedStatement pstm = null;//sql语句的执行者
  39. int n = 0;
  40. try {
  41. conn = dbConn.getConnection();
  42. pstm = conn.prepareStatement(sql);
  43. n = pstm.executeUpdate();
  44. } catch (SQLException e) {
  45. e.printStackTrace();
  46. } catch (ClassNotFoundException e) {
  47. e.printStackTrace();
  48. }finally{
  49. try {
  50. if(pstm!=null)
  51. pstm.close();
  52. if(conn!=null)
  53. conn.close();
  54. } catch (SQLException e) {
  55. e.printStackTrace();
  56. }
  57. }
  58. return "";
  59. }
  60. @POST
  61. @ProduceMime("application/json")
  62. @Path("/getEquipRealName/")
  63. public String getEquipRealName(String param){//修改应急装备的状态
  64. String equipName = Utils.getParameter("EQUIPMENT_NAME", param) == null ? "" : Utils.getParameter("EQUIPMENT_NAME", param);//装备名称
  65. String equipType1 = Utils.getParameter("EQUIPMENT_TYPE", param) == null ? "" : Utils.getParameter("EQUIPMENT_TYPE", param);//装备类型,用于判断sql从哪张表里面查
  66. String sql = "";
  67. if("265".equals(equipType1)){
  68. sql = "select CAR_NAME from EMC_AM_GENERATOR_CAR where FD_OBJECTID='"+equipName+"'";
  69. } else if("266".equals(equipType1)){
  70. sql = "select NAME from EMC_AM_GENERATOR where FD_OBJECTID='"+equipName+"'";
  71. } else if("270".equals(equipType1)){
  72. sql = "select CAR_NAME from EMC_AM_DINING_CAR where FD_OBJECTID='"+equipName+"'";
  73. } else if("269".equals(equipType1)){
  74. sql = "select CAR_NAME from EMC_AM_EMERGENCY_COMMAND_CAR where FD_OBJECTID='"+equipName+"'";
  75. }
  76. System.out.println("**************"+sql);
  77. DbConnection dbConn = new DbConnection();//数据库连接
  78. Connection conn = null;
  79. PreparedStatement pstm = null;//sql语句的执行者
  80. ResultSet rs = null;//结果集
  81. StringBuffer sb = new StringBuffer();
  82. // sb.append("{\"result\":[");
  83. try {
  84. conn = dbConn.getConnection();
  85. pstm = conn.prepareStatement(sql);
  86. rs = pstm.executeQuery();
  87. while(rs.next()){
  88. if("265".equals(equipType1)){
  89. sb.append(rs.getString("CAR_NAME"));
  90. } else if("266".equals(equipType1)){
  91. sb.append(rs.getString("NAME"));
  92. } else if("270".equals(equipType1)){
  93. sb.append(rs.getString("CAR_NAME"));
  94. } else if("269".equals(equipType1)){
  95. sb.append( rs.getString("CAR_NAME"));
  96. }
  97. }
  98. // sb.append("]}");
  99. } catch (SQLException e) {
  100. e.printStackTrace();
  101. } catch (ClassNotFoundException e) {
  102. e.printStackTrace();
  103. }finally{
  104. try {
  105. if(rs!=null){
  106. rs.close();}
  107. if(pstm!=null)
  108. pstm.close();
  109. if(conn!=null)
  110. conn.close();
  111. } catch (SQLException e) {
  112. e.printStackTrace();
  113. }
  114. }
  115. return sb.toString();
  116. }
  117. @POST
  118. @ProduceMime("application/json")
  119. @Path("/updateEquipStateToFree/")
  120. public String updateEquipStateToFree(String param){//修改应急装备的状态
  121. //param = param.toString().split("=")[1];
  122. //String sql="update EMC_AM_GENERATOR_CAR set IS_USED='2' , USED_STAT='2' where FD_OBJECTID='"+param+"' and is_del='0'";
  123. String equipId = Utils.getParameter("FD_OBJECTID", param) == null ? "" : Utils.getParameter("FD_OBJECTID", param);//装备ID
  124. String equipType = Utils.getParameter("EQUIPMENT_TYPE", param) == null ? "" : Utils.getParameter("EQUIPMENT_TYPE", param);//装备类型,用于判断sql从哪张表里面查
  125. String sql = "";
  126. if("265".equals(equipType)){
  127. //sql = "select CAR_NUM,IS_USED from EMC_AM_GENERATOR_CAR where FD_OBJECTID='"+equipId+"'";
  128. sql = "update EMC_AM_GENERATOR_CAR set IS_USED = '1' , USED_STAT = '1' where FD_OBJECTID = '"+equipId+"' and is_del='0'";//IS_USED = '2' 不可调用
  129. } else if("266".equals(equipType)){
  130. //sql = "select NUM,USED_STAT from EMC_AM_GENERATOR where FD_OBJECTID='"+equipId+"'";
  131. sql = "update EMC_AM_GENERATOR set USED_STAT = '1' , IS_USED = '1' where FD_OBJECTID = '"+equipId+"' and is_del='0'";//USED_STAT = '2' 调拨中
  132. } else if("270".equals(equipType)){
  133. //sql = "select CAR_NUM,USED_STAT from EMC_AM_DINING_CAR where FD_OBJECTID='"+equipId+"'";
  134. sql = "update EMC_AM_DINING_CAR set IS_USED = '1' , USED_STAT = '1' where FD_OBJECTID = '"+equipId+"' and is_del='0'";//IS_USED = '2' 不可调用
  135. } else if("269".equals(equipType)){
  136. //sql = "select CAR_NUM,USED_STAT from EMC_AM_EMERGENCY_COMMAND_CAR where FD_OBJECTID='"+equipId+"'";
  137. sql = "update EMC_AM_EMERGENCY_COMMAND_CAR set USED_STAT = '1' , IS_USED = '1' where FD_OBJECTID = '"+equipId+"' and is_del='0'";//USED_STAT = '2' 调拨中
  138. }
  139. //System.out.println("******//////////***********"+sql);
  140. DbConnection dbConn = new DbConnection();//数据库连接
  141. Connection conn = null;
  142. PreparedStatement pstm = null;//sql语句的执行者
  143. int n = 0;
  144. try {
  145. conn = dbConn.getConnection();
  146. pstm = conn.prepareStatement(sql);
  147. n = pstm.executeUpdate();
  148. } catch (SQLException e) {
  149. e.printStackTrace();
  150. } catch (ClassNotFoundException e) {
  151. e.printStackTrace();
  152. }finally{
  153. try {
  154. if(pstm!=null)
  155. pstm.close();
  156. if(conn!=null)
  157. conn.close();
  158. } catch (SQLException e) {
  159. e.printStackTrace();
  160. }
  161. }
  162. return "";
  163. }
  164. @POST
  165. @ProduceMime("application/json")
  166. @Path("/updateEquipDemandStateTo56/")
  167. public String updateEquipDemandStateTo56(String param){//修改应急装备的状态
  168. String taskName = Utils.getParameter("FD_OBJECTID", param) == null ? "" : Utils.getParameter("FD_OBJECTID", param);//装备ID
  169. String sql = "update ECM_EM_EQUIPMENT_DEMAND set AUDIT_STATE = '56' where FD_OBJECTID = '"+taskName+"' and is_del='0'";
  170. DbConnection dbConn = new DbConnection();//数据库连接
  171. Connection conn = null;
  172. PreparedStatement pstm = null;//sql语句的执行者
  173. int n = 0;
  174. try {
  175. conn = dbConn.getConnection();
  176. pstm = conn.prepareStatement(sql);
  177. n = pstm.executeUpdate();
  178. } catch (SQLException e) {
  179. e.printStackTrace();
  180. } catch (ClassNotFoundException e) {
  181. e.printStackTrace();
  182. }finally{
  183. try {
  184. if(pstm!=null)
  185. pstm.close();
  186. if(conn!=null)
  187. conn.close();
  188. } catch (SQLException e) {
  189. e.printStackTrace();
  190. }
  191. }
  192. return "";
  193. }
  194. @POST
  195. @ProduceMime("application/json")
  196. @Path("/updateEquipDemandStateTo57/")
  197. public String updateEquipDemandStateTo57(String param){//修改应急装备的状态
  198. String taskName = Utils.getParameter("FD_OBJECTID", param) == null ? "" : Utils.getParameter("FD_OBJECTID", param);//装备ID
  199. String sql = "update ECM_EM_EQUIPMENT_DEMAND set AUDIT_STATE = '57' where FD_OBJECTID = '"+taskName+"' and is_del='0'";
  200. DbConnection dbConn = new DbConnection();//数据库连接
  201. Connection conn = null;
  202. PreparedStatement pstm = null;//sql语句的执行者
  203. int n = 0;
  204. try {
  205. conn = dbConn.getConnection();
  206. pstm = conn.prepareStatement(sql);
  207. n = pstm.executeUpdate();
  208. } catch (SQLException e) {
  209. e.printStackTrace();
  210. } catch (ClassNotFoundException e) {
  211. e.printStackTrace();
  212. }finally{
  213. try {
  214. if(pstm!=null)
  215. pstm.close();
  216. if(conn!=null)
  217. conn.close();
  218. } catch (SQLException e) {
  219. e.printStackTrace();
  220. }
  221. }
  222. return "";
  223. }
  224. @POST
  225. @ProduceMime("application/json")
  226. @Path("/getDeptName/")
  227. public String getDeptName(String params){ //装备需求详细信息页面用到
  228. params = Utils.getParameter("DEPT_ID", params) == null ? "" : Utils.getParameter("DEPT_ID", params);
  229. String sql = "select DEPT_NAME from SYS_DEPARTMENT where DEPT_ID=?";
  230. //System.out.println("-------------------------------------------------"+sql);
  231. DbConnection dbConn = new DbConnection();//数据库连接
  232. Connection conn = null;
  233. PreparedStatement pstm = null;//sql语句的执行者
  234. ResultSet rs = null;//结果集
  235. StringBuffer sb = new StringBuffer();
  236. /*List userList = new ArrayList();*/
  237. sb.append("{\"result\":\"");
  238. try {
  239. conn = dbConn.getConnection();
  240. pstm = conn.prepareStatement(sql);
  241. pstm.setString(1, params);
  242. rs = pstm.executeQuery();
  243. while(rs.next()){
  244. // sb.append("{\"TEAM_TYPE\":\""+rs.getString("TEAM_TYPE")+"\"},");
  245. sb.append( rs.getString("DEPT_NAME") );
  246. }
  247. sb.append("\"}");
  248. } catch (SQLException e) {
  249. e.printStackTrace();
  250. } catch (ClassNotFoundException e) {
  251. e.printStackTrace();
  252. }finally{
  253. try {
  254. if(rs!=null){
  255. rs.close();}
  256. if(pstm!=null)
  257. pstm.close();
  258. if(conn!=null)
  259. conn.close();
  260. } catch (SQLException e) {
  261. e.printStackTrace();
  262. }
  263. }
  264. /*String usersJson = JsonPluginsUtil.listToJson(userList);
  265. Log.info(usersJson);
  266. return usersJson;*/
  267. // System.out.println("-------------------------------------------------"+sb.toString());
  268. return sb.toString();
  269. }
  270. @POST
  271. @ProduceMime("application/json")
  272. @Path("/getEquipAmount/")
  273. public String getEquipAmount(String params){ //装备需求详细信息页面用到
  274. String equipId = Utils.getParameter("FD_OBJECTID", params) == null ? "" : Utils.getParameter("FD_OBJECTID", params);//装备ID
  275. String equipType = Utils.getParameter("EQUIPMENT_TYPE", params) == null ? "" : Utils.getParameter("EQUIPMENT_TYPE", params);//装备类型,用于判断sql从哪张表里面查
  276. String sql = "";
  277. if("265".equals(equipType)){
  278. sql = "select CAR_NUM,IS_USED from EMC_AM_GENERATOR_CAR where FD_OBJECTID='"+equipId+"'";
  279. } else if("266".equals(equipType)){
  280. sql = "select NUM,USED_STAT from EMC_AM_GENERATOR where FD_OBJECTID='"+equipId+"'";
  281. } else if("270".equals(equipType)){
  282. sql = "select CAR_NUM,USED_STAT from EMC_AM_DINING_CAR where FD_OBJECTID='"+equipId+"'";
  283. } else if("269".equals(equipType)){
  284. sql = "select CAR_NUM,USED_STAT from EMC_AM_EMERGENCY_COMMAND_CAR where FD_OBJECTID='"+equipId+"'";
  285. }
  286. DbConnection dbConn = new DbConnection();//数据库连接
  287. Connection conn = null;
  288. PreparedStatement pstm = null;//sql语句的执行者
  289. ResultSet rs = null;//结果集
  290. StringBuffer sb = new StringBuffer();
  291. /*List userList = new ArrayList();*/
  292. sb.append("{\"result\":[");
  293. try {
  294. conn = dbConn.getConnection();
  295. pstm = conn.prepareStatement(sql);
  296. //pstm.setString(1, params);
  297. rs = pstm.executeQuery();
  298. while(rs.next()){
  299. if("265".equals(equipType)){
  300. sb.append(rs.getString("CAR_NUM") +","+rs.getString("IS_USED"));
  301. } else if("266".equals(equipType)){
  302. sb.append(rs.getString("NUM") +","+rs.getString("USED_STAT"));
  303. } else if("270".equals(equipType)){
  304. sb.append(rs.getString("CAR_NUM") +","+rs.getString("USED_STAT"));
  305. } else if("269".equals(equipType)){
  306. sb.append( rs.getString("CAR_NUM") +","+rs.getString("USED_STAT"));
  307. }
  308. }
  309. sb.append("]}");
  310. } catch (SQLException e) {
  311. e.printStackTrace();
  312. } catch (ClassNotFoundException e) {
  313. e.printStackTrace();
  314. }finally{
  315. try {
  316. if(rs!=null){
  317. rs.close();}
  318. if(pstm!=null)
  319. pstm.close();
  320. if(conn!=null)
  321. conn.close();
  322. } catch (SQLException e) {
  323. e.printStackTrace();
  324. }
  325. }
  326. /*String usersJson = JsonPluginsUtil.listToJson(userList);
  327. Log.info(usersJson);
  328. return usersJson;*/
  329. return sb.toString();
  330. }
  331. @POST
  332. @ProduceMime("application/json")
  333. @Path("/getSubDeptIds/")
  334. public String getSubDeptIds(String params){ //装备需求详细信息页面用到
  335. params = Utils.getParameter("PARENT_ID", params) == null ? "" : Utils.getParameter("PARENT_ID", params);
  336. String sql = "select DEPT_ID from SYS_DEPARTMENT where PARENT_ID=?";
  337. //System.out.println("-------------------------------------------------"+sql);
  338. DbConnection dbConn = new DbConnection();//数据库连接
  339. Connection conn = null;
  340. PreparedStatement pstm = null;//sql语句的执行者
  341. ResultSet rs = null;//结果集
  342. StringBuffer sb = new StringBuffer();
  343. /*List userList = new ArrayList();*/
  344. // sb.append("{\"result\":\"");
  345. try {
  346. conn = dbConn.getConnection();
  347. pstm = conn.prepareStatement(sql);
  348. pstm.setString(1, params);
  349. rs = pstm.executeQuery();
  350. while(rs.next()){
  351. sb.append("'" + rs.getString("DEPT_ID") + "'," );
  352. }
  353. sb.deleteCharAt(sb.length()-1);
  354. // sb.append("\"}");
  355. } catch (SQLException e) {
  356. e.printStackTrace();
  357. } catch (ClassNotFoundException e) {
  358. e.printStackTrace();
  359. }finally{
  360. try {
  361. if(rs!=null){
  362. rs.close();}
  363. if(pstm!=null)
  364. pstm.close();
  365. if(conn!=null)
  366. conn.close();
  367. } catch (SQLException e) {
  368. e.printStackTrace();
  369. }
  370. }
  371. /*String usersJson = JsonPluginsUtil.listToJson(userList);
  372. Log.info(usersJson);
  373. return usersJson;*/
  374. // System.out.println("-------------------------------------------------"+sb.toString());
  375. return sb.toString();
  376. }
  377. @POST
  378. @ProduceMime("application/json")
  379. @Path("/getPersonId/")
  380. public String getPersonId(String params){ //装备需求详细信息页面用到
  381. String businessId = Utils.getParameter("BUSINESS_ID", params) == null ? "" : Utils.getParameter("BUSINESS_ID", params);
  382. String state = Utils.getParameter("state", params) == null ? "" : Utils.getParameter("state", params);
  383. String sql = "select distinct PERSON_ID from ECM_EM_TREATED_HUMAN where BUSINESS_ID=? and STATUES=?";
  384. //System.out.println("-------------------------------------------------"+sql);
  385. DbConnection dbConn = new DbConnection();//数据库连接
  386. Connection conn = null;
  387. PreparedStatement pstm = null;//sql语句的执行者
  388. ResultSet rs = null;//结果集
  389. StringBuffer sb = new StringBuffer();
  390. /*List userList = new ArrayList();*/
  391. // sb.append("{\"result\":\"");
  392. try {
  393. conn = dbConn.getConnection();
  394. pstm = conn.prepareStatement(sql);
  395. pstm.setString(1, businessId);
  396. pstm.setString(2, state);
  397. rs = pstm.executeQuery();
  398. while(rs.next()){
  399. // sb.append("{\"TEAM_TYPE\":\""+rs.getString("TEAM_TYPE")+"\"},");
  400. sb.append(rs.getString("PERSON_ID"));
  401. }
  402. // sb.append("\"}");
  403. } catch (SQLException e) {
  404. e.printStackTrace();
  405. } catch (ClassNotFoundException e) {
  406. e.printStackTrace();
  407. }finally{
  408. try {
  409. if(rs!=null){
  410. rs.close();}
  411. if(pstm!=null)
  412. pstm.close();
  413. if(conn!=null)
  414. conn.close();
  415. } catch (SQLException e) {
  416. e.printStackTrace();
  417. }
  418. }
  419. /*String usersJson = JsonPluginsUtil.listToJson(userList);
  420. Log.info(usersJson);
  421. return usersJson;*/
  422. return sb.toString();
  423. }
  424. @POST
  425. @ProduceMime("application/json")
  426. @Path("/getNeedUnit/")
  427. public String getNeedUnit(String params){ //装备需求详细信息页面用到
  428. params = Utils.getParameter("FD_OBJECTID", params) == null ? "" : Utils.getParameter("FD_OBJECTID", params);
  429. String sql = "select DEPT_NAME from SYS_DEPARTMENT where DEPT_ID=(select RECIPIENT_DEPARTMENT from ECM_EM_EQUIPMENT_DEMAND where FD_OBJECTID=?)";
  430. DbConnection dbConn = new DbConnection();//数据库连接
  431. Connection conn = null;
  432. PreparedStatement pstm = null;//sql语句的执行者
  433. ResultSet rs = null;//结果集
  434. StringBuffer sb = new StringBuffer();
  435. // List userList = new ArrayList();
  436. // sb.append("{\"result\":\"");
  437. try {
  438. conn = dbConn.getConnection();
  439. pstm = conn.prepareStatement(sql);
  440. pstm.setString(1, params);
  441. rs = pstm.executeQuery();
  442. while(rs.next()){
  443. sb.append( rs.getString("DEPT_NAME") );
  444. }
  445. // sb.append("\"}");
  446. } catch (SQLException e) {
  447. e.printStackTrace();
  448. } catch (ClassNotFoundException e) {
  449. e.printStackTrace();
  450. }finally{
  451. try {
  452. if(rs!=null){
  453. rs.close();}
  454. if(pstm!=null)
  455. pstm.close();
  456. if(conn!=null)
  457. conn.close();
  458. } catch (SQLException e) {
  459. e.printStackTrace();
  460. }
  461. }
  462. return sb.toString();
  463. }
  464. @POST
  465. @ProduceMime("application/text")
  466. @Path("/getNextHandlerFrom378/")
  467. public String getNextHandlerFrom378(String params){ //装备需求详细信息页面用到
  468. String businessId = Utils.getParameter("BUSINESS_ID", params) == null ? "" : Utils.getParameter("BUSINESS_ID", params);
  469. String statues = Utils.getParameter("STATUES", params) == null ? "" : Utils.getParameter("STATUES", params);
  470. String sql = "select top 1 PERSON_ID,PERSON_NAME from ECM_EM_TREATED_HUMAN where BUSINESS_ID=? and STATUES=? order by updatedate desc";
  471. DbConnection dbConn = new DbConnection();//数据库连接
  472. Connection conn = null;
  473. PreparedStatement pstm = null;//sql语句的执行者
  474. ResultSet rs = null;//结果集
  475. StringBuffer sb = new StringBuffer();
  476. // List userList = new ArrayList();
  477. // sb.append("{\"result\":\"");
  478. try {
  479. conn = dbConn.getConnection();
  480. pstm = conn.prepareStatement(sql);
  481. pstm.setString(1, businessId);
  482. pstm.setString(2, statues);
  483. rs = pstm.executeQuery();
  484. while(rs.next()){
  485. sb.append( rs.getString("PERSON_ID") );
  486. }
  487. // sb.append("\"}");
  488. } catch (SQLException e) {
  489. e.printStackTrace();
  490. } catch (ClassNotFoundException e) {
  491. e.printStackTrace();
  492. }finally{
  493. try {
  494. if(rs!=null){
  495. rs.close();}
  496. if(pstm!=null)
  497. pstm.close();
  498. if(conn!=null)
  499. conn.close();
  500. } catch (SQLException e) {
  501. e.printStackTrace();
  502. }
  503. }
  504. // System.out.println("**************************"+sb.toString());
  505. return sb.toString();
  506. }
  507. }