7038c041289e0278863ee136ebe474e6d37a5ae9.svn-base 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627
  1. package com.sinosoft.em.response.team.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("TeamAllotUpdateTeamState")
  12. public class TeamAllotUpdateTeamState {
  13. @POST
  14. @ProduceMime("application/json")
  15. @Path("/updateTeamStateToBusiness/")
  16. public String updateTeamStateToBusiness(String param){
  17. String fdObjectid = Utils.getParameter("FD_OBJECTID", param) == null ? "" : Utils.getParameter("FD_OBJECTID", param);
  18. String sql="update ECM_AM_EMERGENCY_TEAM set TEAM_STAT='2' where FD_OBJECTID=? and is_del='0'";
  19. DbConnection dbConn = new DbConnection();//数据库连接
  20. Connection conn = null;
  21. PreparedStatement pstm = null;//sql语句的执行者
  22. int n = 0;
  23. try {
  24. conn = dbConn.getConnection();
  25. pstm = conn.prepareStatement(sql);
  26. pstm.setString(1, fdObjectid);
  27. n = pstm.executeUpdate();
  28. } catch (SQLException e) {
  29. e.printStackTrace();
  30. } catch (ClassNotFoundException e) {
  31. e.printStackTrace();
  32. }finally{
  33. try {
  34. if(pstm!=null)
  35. pstm.close();
  36. if(conn!=null)
  37. conn.close();
  38. } catch (SQLException e) {
  39. e.printStackTrace();
  40. }
  41. }
  42. /*String usersJson = JsonPluginsUtil.listToJson(userList);
  43. Log.info(usersJson);
  44. return usersJson;*/
  45. return "00";
  46. }
  47. @POST
  48. @ProduceMime("application/json")
  49. @Path("/updateTeamStateToFree/")
  50. public String updateTeamStateToFree(String param){
  51. String fdObjectid = Utils.getParameter("FD_OBJECTID", param) == null ? "" : Utils.getParameter("FD_OBJECTID", param);
  52. String sql="update ECM_AM_EMERGENCY_TEAM set TEAM_STAT='1' where FD_OBJECTID=? and is_del='0'";
  53. DbConnection dbConn = new DbConnection();//数据库连接
  54. Connection conn = null;
  55. PreparedStatement pstm = null;//sql语句的执行者
  56. /*List userList = new ArrayList();*/
  57. //sb.append("{\"result\":");
  58. int n = 0;
  59. try {
  60. conn = dbConn.getConnection();
  61. pstm = conn.prepareStatement(sql);
  62. pstm.setString(1, fdObjectid);
  63. n = pstm.executeUpdate();
  64. //while(rs.next()){
  65. //sb.append("{\"key\":\"" + rs.getString("REAL_NAME") + "\",\"value\":\""+rs.getString("USER_ID")+"\"},");
  66. //sb.append("true}");
  67. //}
  68. //sb.append("]}");
  69. } catch (SQLException e) {
  70. e.printStackTrace();
  71. } catch (ClassNotFoundException e) {
  72. e.printStackTrace();
  73. }finally{
  74. try {
  75. if(pstm!=null)
  76. pstm.close();
  77. if(conn!=null)
  78. conn.close();
  79. } catch (SQLException e) {
  80. e.printStackTrace();
  81. }
  82. }
  83. return "";
  84. }
  85. @POST
  86. @ProduceMime("application/json")
  87. @Path("/updateTeamDemandStateToAlloting/")
  88. public String updateTeamDemandStateToAlloting(String param){
  89. String fdObjectid = Utils.getParameter("FD_OBJECTID", param) == null ? "" : Utils.getParameter("FD_OBJECTID", param);
  90. // String sql="update ECM_EM_TEAM_WRR set STATE='136' where FD_OBJECTID=? and is_del='0'";
  91. String sql="update ECM_EM_TEAM_WRR set ISALLOT='1' where FD_OBJECTID=? and is_del='0'";//20160920
  92. DbConnection dbConn = new DbConnection();//数据库连接
  93. Connection conn = null;
  94. PreparedStatement pstm = null;//sql语句的执行者
  95. int n = 0;
  96. try {
  97. conn = dbConn.getConnection();
  98. pstm = conn.prepareStatement(sql);
  99. pstm.setString(1, fdObjectid);
  100. n = pstm.executeUpdate();
  101. } catch (SQLException e) {
  102. e.printStackTrace();
  103. } catch (ClassNotFoundException e) {
  104. e.printStackTrace();
  105. }finally{
  106. try {
  107. if(pstm!=null)
  108. pstm.close();
  109. if(conn!=null)
  110. conn.close();
  111. } catch (SQLException e) {
  112. e.printStackTrace();
  113. }
  114. }
  115. /*String usersJson = JsonPluginsUtil.listToJson(userList);
  116. Log.info(usersJson);
  117. return usersJson;*/
  118. return "11";
  119. }
  120. /*@POST
  121. @ProduceMime("application/json")
  122. @Path("/updateTeamDemandStateToEnd/")
  123. public String updateTeamDemandStateToEnd(String param){*/
  124. public String updateTeamDemandStateToEnd(String fdObjectid){//设置队伍需求的状态为结束-----如果需求的调拨单位字段的长度(,)和UNITS_GETBACK的长度相等,再改
  125. //String fdObjectid = Utils.getParameter("FD_OBJECTID", param) == null ? "" : Utils.getParameter("FD_OBJECTID", param);
  126. String sql="update ECM_EM_TEAM_WRR set STATE='137' where FD_OBJECTID=? and is_del='0'";
  127. DbConnection dbConn = new DbConnection();//数据库连接
  128. Connection conn = null;
  129. PreparedStatement pstm = null;//sql语句的执行者
  130. int n = 0;
  131. try {
  132. conn = dbConn.getConnection();
  133. pstm = conn.prepareStatement(sql);
  134. pstm.setString(1, fdObjectid);
  135. n = pstm.executeUpdate();
  136. } catch (SQLException e) {
  137. e.printStackTrace();
  138. } catch (ClassNotFoundException e) {
  139. e.printStackTrace();
  140. }finally{
  141. try {
  142. if(pstm!=null)
  143. pstm.close();
  144. if(conn!=null)
  145. conn.close();
  146. } catch (SQLException e) {
  147. e.printStackTrace();
  148. }
  149. }
  150. /*String usersJson = JsonPluginsUtil.listToJson(userList);
  151. Log.info(usersJson);
  152. return usersJson;*/
  153. return "11";
  154. }
  155. @POST
  156. @ProduceMime("application/json")
  157. @Path("/addUnitIdToUNITS_GETBACK/")
  158. public String addUnitIdToUNITS_GETBACK(String param){
  159. String fdObjectid = Utils.getParameter("FD_OBJECTID", param) == null ? "" : Utils.getParameter("FD_OBJECTID", param);
  160. String unitId = Utils.getParameter("unitId", param) == null ? "" : Utils.getParameter("unitId", param);
  161. addUnitIdToUNITS_GETBACK1(param);//更新ECM_EM_TEAM_WRR.UNITS_GETBACK的值
  162. String allTwoTypeUnits = getAllTwoTypeUnits(fdObjectid);//获取调拨单位ID和已返回的单位ID
  163. int allotUnitsLen = allTwoTypeUnits.split("-")[0].split(",").length;//调拨单位ID的长度(单位个数)
  164. String unitsGetBack = allTwoTypeUnits.split("-")[1];
  165. int unitsGetBackLen = -1;//已返回的单位ID的长度(单位个数)
  166. if("kong".equals(unitsGetBack)){
  167. unitsGetBackLen = 0;
  168. }else{
  169. unitsGetBackLen = unitsGetBack.split(",").length;
  170. }
  171. if(allotUnitsLen == unitsGetBackLen){
  172. updateTeamDemandStateToEnd(fdObjectid);//设置队伍需求的状态为结束-----如果需求的调拨单位字段的长度(,)和UNITS_GETBACK的长度相等,再改
  173. }
  174. return "";
  175. }
  176. public String addUnitIdToUNITS_GETBACK1(String param){//更新ECM_EM_TEAM_WRR.UNITS_GETBACK的值
  177. String fdObjectid = Utils.getParameter("FD_OBJECTID", param) == null ? "" : Utils.getParameter("FD_OBJECTID", param);
  178. String unitId = Utils.getParameter("unitId", param) == null ? "" : Utils.getParameter("unitId", param);
  179. //判断ECM_EM_TEAM_WRR.UNITS_GETBACK是否包含unitId的值,如果包含就不添加,否则添加进去
  180. boolean isContainsUnit = false;
  181. isContainsUnit = isContainsTheUnit(fdObjectid,unitId);
  182. if(isContainsUnit){//如果包含,结束该方法
  183. return "";
  184. }else{//否则,添加单位ID到ECM_EM_TEAM_WRR.UNITS_GETBACK
  185. String units_getBack = getUnits_getBack(fdObjectid);
  186. if(units_getBack.equals(null) || "null".equals(units_getBack) || "".equals(units_getBack)){
  187. units_getBack = unitId;
  188. }else{
  189. units_getBack += ","+unitId;
  190. }
  191. String sql="update ECM_EM_TEAM_WRR set UNITS_GETBACK='"+units_getBack+"' where FD_OBJECTID=? and is_del='0'";
  192. DbConnection dbConn = new DbConnection();//数据库连接
  193. Connection conn = null;
  194. PreparedStatement pstm = null;//sql语句的执行者
  195. int n = 0;
  196. try {
  197. conn = dbConn.getConnection();
  198. pstm = conn.prepareStatement(sql);
  199. pstm.setString(1, fdObjectid);
  200. n = pstm.executeUpdate();
  201. } catch (SQLException e) {
  202. e.printStackTrace();
  203. } catch (ClassNotFoundException e) {
  204. e.printStackTrace();
  205. }finally{
  206. try {
  207. if(pstm!=null)
  208. pstm.close();
  209. if(conn!=null)
  210. conn.close();
  211. } catch (SQLException e) {
  212. e.printStackTrace();
  213. }
  214. }
  215. return "11";
  216. }
  217. }
  218. public String getUnits_getBack(String fdObjectid){//查询ECM_EM_TEAM_WRR.UNITS_GETBACK的值
  219. String sql = "select UNITS_GETBACK from ECM_EM_TEAM_WRR where FD_OBJECTID ='"+fdObjectid+"'";
  220. DbConnection dbConn = new DbConnection();//数据库连接
  221. Connection conn = null;
  222. PreparedStatement pstm = null;//sql语句的执行者
  223. ResultSet rs = null;//结果集
  224. StringBuffer sb = new StringBuffer();
  225. try {
  226. conn = dbConn.getConnection();
  227. pstm = conn.prepareStatement(sql);
  228. rs = pstm.executeQuery();
  229. while(rs.next()){
  230. sb.append(rs.getString("UNITS_GETBACK") == null ? "" : rs.getString("UNITS_GETBACK"));
  231. }
  232. } catch (SQLException e) {
  233. e.printStackTrace();
  234. } catch (ClassNotFoundException e) {
  235. e.printStackTrace();
  236. }finally{
  237. try {
  238. if(pstm!=null)
  239. pstm.close();
  240. if(conn!=null)
  241. conn.close();
  242. } catch (SQLException e) {
  243. e.printStackTrace();
  244. }
  245. }
  246. return sb.toString();
  247. }
  248. public boolean isContainsTheUnit(String fdObjectid,String unitId){//
  249. String allTwoTypeUnits = getAllTwoTypeUnits(fdObjectid);//获取调拨单位ID和已返回的单位ID
  250. //String allotUnits = allTwoTypeUnits.split("-")[0];//获取调拨单位ID
  251. String unitsGetBack = allTwoTypeUnits.split("-")[1];//获取已返回的单位ID
  252. boolean isContainsTheUnit = unitsGetBack.contains(unitId);
  253. return isContainsTheUnit;
  254. }
  255. public String getAllTwoTypeUnits(String fdObjectid){//获取调拨单位ID和已返回单位
  256. String sql = "select RANGE_UNITS_ID,UNITS_GETBACK from ECM_EM_TEAM_WRR where FD_OBJECTID ='"+fdObjectid+"'";
  257. DbConnection dbConn = new DbConnection();//数据库连接
  258. Connection conn = null;
  259. PreparedStatement pstm = null;//sql语句的执行者
  260. ResultSet rs = null;//结果集
  261. StringBuffer sb = new StringBuffer();
  262. try {
  263. conn = dbConn.getConnection();
  264. pstm = conn.prepareStatement(sql);
  265. rs = pstm.executeQuery();
  266. while(rs.next()){
  267. String allotUnits = rs.getString("RANGE_UNITS_ID") == null ? "" : rs.getString("RANGE_UNITS_ID");
  268. String unitsGetBack = rs.getString("UNITS_GETBACK") == null ? "kong" : rs.getString("UNITS_GETBACK");
  269. sb.append(allotUnits+"-"+unitsGetBack);
  270. }
  271. } catch (SQLException e) {
  272. e.printStackTrace();
  273. } catch (ClassNotFoundException e) {
  274. e.printStackTrace();
  275. }finally{
  276. try {
  277. if(pstm!=null)
  278. pstm.close();
  279. if(conn!=null)
  280. conn.close();
  281. } catch (SQLException e) {
  282. e.printStackTrace();
  283. }
  284. }
  285. return sb.toString();
  286. }
  287. @POST
  288. @ProduceMime("application/json")
  289. @Path("/getTeamMsgFromDailyTeam/")
  290. public String getTeamMsgFromDailyTeam(String params){
  291. String fdObjectid = Utils.getParameter("FD_OBJECTID", params) == null ? "" : Utils.getParameter("FD_OBJECTID", params);
  292. String sql = "select e.TEAM_TYPE,e.TEAM_LEVEL,e.TEAM_LEADER,e.TEAM_PHONE,e.TEAM_MEMBER_NUMBER from ECM_AM_EMERGENCY_TEAM e where FD_OBJECTID =?";
  293. //System.out.println("-------------------------------------------------"+sql);
  294. DbConnection dbConn = new DbConnection();//数据库连接
  295. Connection conn = null;
  296. PreparedStatement pstm = null;//sql语句的执行者
  297. ResultSet rs = null;//结果集
  298. StringBuffer sb = new StringBuffer();
  299. /*List userList = new ArrayList();*/
  300. sb.append("{\"result\":[");
  301. try {
  302. conn = dbConn.getConnection();
  303. pstm = conn.prepareStatement(sql);
  304. pstm.setString(1, fdObjectid);
  305. rs = pstm.executeQuery();
  306. while(rs.next()){
  307. sb.append("{\"TEAM_TYPE\":\""+rs.getString("TEAM_TYPE")+"\"},");
  308. sb.append("{\"TEAM_LEVEL\":\""+rs.getString("TEAM_LEVEL")+"\"},");
  309. sb.append("{\"TEAM_LEADER\":\""+rs.getString("TEAM_LEADER")+"\"},");
  310. sb.append("{\"TEAM_PHONE\":\""+rs.getString("TEAM_PHONE")+"\"},");
  311. sb.append("{\"TEAM_MEMBER_NUMBER\":\""+rs.getString("TEAM_MEMBER_NUMBER")+"\"}");
  312. }
  313. sb.append("]}");
  314. } catch (SQLException e) {
  315. e.printStackTrace();
  316. } catch (ClassNotFoundException e) {
  317. e.printStackTrace();
  318. }finally{
  319. try {
  320. if(pstm!=null)
  321. pstm.close();
  322. if(conn!=null)
  323. conn.close();
  324. } catch (SQLException e) {
  325. e.printStackTrace();
  326. }
  327. }
  328. /*String usersJson = JsonPluginsUtil.listToJson(userList);
  329. Log.info(usersJson);
  330. return usersJson;*/
  331. // System.out.println("-------------------------------------------------"+sb.toString());
  332. return sb.toString();
  333. }
  334. @POST
  335. @ProduceMime("application/json")
  336. @Path("/getTeamType/")
  337. public String getTeamType(String params){
  338. String fdCode = Utils.getParameter("FD_CODE", params) == null ? "" : Utils.getParameter("FD_CODE", params);
  339. String sql = "select FD_DESCRIPTION from BM_MAPVALUECANST where FD_TYPE='BM_TEAMTYPE' and FD_CODE=?";
  340. DbConnection dbConn = new DbConnection();//数据库连接
  341. Connection conn = null;
  342. PreparedStatement pstm = null;//sql语句的执行者
  343. ResultSet rs = null;//结果集
  344. StringBuffer sb = new StringBuffer();
  345. /*List userList = new ArrayList();*/
  346. sb.append("{\"result\":\"");
  347. try {
  348. conn = dbConn.getConnection();
  349. pstm = conn.prepareStatement(sql);
  350. pstm.setString(1, fdCode);
  351. rs = pstm.executeQuery();
  352. while(rs.next()){
  353. sb.append(rs.getString("FD_DESCRIPTION"));
  354. }
  355. sb.append("\"}");
  356. } catch (SQLException e) {
  357. e.printStackTrace();
  358. } catch (ClassNotFoundException e) {
  359. e.printStackTrace();
  360. }finally{
  361. try {
  362. if(pstm!=null)
  363. pstm.close();
  364. if(conn!=null)
  365. conn.close();
  366. } catch (SQLException e) {
  367. e.printStackTrace();
  368. }
  369. }
  370. /*String usersJson = JsonPluginsUtil.listToJson(userList);
  371. Log.info(usersJson);
  372. return usersJson;*/
  373. return sb.toString();
  374. }
  375. @POST
  376. @ProduceMime("application/json")
  377. @Path("/getTeamLevel/")
  378. public String getTeamLevel(String params){
  379. String fdCode = Utils.getParameter("FD_CODE", params) == null ? "" : Utils.getParameter("FD_CODE", params);
  380. String sql = "select FD_DESCRIPTION from BM_MAPVALUECANST where FD_TYPE='BM_DYDJ' and FD_CODE=?";
  381. DbConnection dbConn = new DbConnection();//数据库连接
  382. Connection conn = null;
  383. PreparedStatement pstm = null;//sql语句的执行者
  384. ResultSet rs = null;//结果集
  385. StringBuffer sb = new StringBuffer();
  386. /*List userList = new ArrayList();*/
  387. sb.append("{\"result\":\"");
  388. try {
  389. conn = dbConn.getConnection();
  390. pstm = conn.prepareStatement(sql);
  391. pstm.setString(1, fdCode);
  392. rs = pstm.executeQuery();
  393. while(rs.next()){
  394. sb.append(rs.getString("FD_DESCRIPTION"));
  395. }
  396. sb.append("\"}");
  397. } catch (SQLException e) {
  398. e.printStackTrace();
  399. } catch (ClassNotFoundException e) {
  400. e.printStackTrace();
  401. }finally{
  402. try {
  403. if(pstm!=null)
  404. pstm.close();
  405. if(conn!=null)
  406. conn.close();
  407. } catch (SQLException e) {
  408. e.printStackTrace();
  409. }
  410. }
  411. return sb.toString();
  412. }
  413. @POST
  414. @ProduceMime("application/json")
  415. @Path("/getTeamName/")
  416. public String getTeamName(String params){
  417. String fdObjectid = Utils.getParameter("FD_OBJECTID", params) == null ? "" : Utils.getParameter("FD_OBJECTID", params);
  418. String sql = "select TEAM_NAME from ECM_AM_EMERGENCY_TEAM where FD_OBJECTID=?";
  419. DbConnection dbConn = new DbConnection();//数据库连接
  420. Connection conn = null;
  421. PreparedStatement pstm = null;//sql语句的执行者
  422. ResultSet rs = null;//结果集
  423. StringBuffer sb = new StringBuffer();
  424. /*List userList = new ArrayList();*/
  425. sb.append("{\"result\":\"");
  426. try {
  427. conn = dbConn.getConnection();
  428. pstm = conn.prepareStatement(sql);
  429. pstm.setString(1, fdObjectid);
  430. rs = pstm.executeQuery();
  431. while(rs.next()){
  432. sb.append(rs.getString("TEAM_NAME"));
  433. }
  434. sb.append("\"}");
  435. } catch (SQLException e) {
  436. e.printStackTrace();
  437. } catch (ClassNotFoundException e) {
  438. e.printStackTrace();
  439. }finally{
  440. try {
  441. if(pstm!=null)
  442. pstm.close();
  443. if(conn!=null)
  444. conn.close();
  445. } catch (SQLException e) {
  446. e.printStackTrace();
  447. }
  448. }
  449. return sb.toString();
  450. }
  451. @POST
  452. @ProduceMime("application/json")
  453. @Path("/getTeamCallerRealName/")
  454. public String getTeamCallerRealName(String params){
  455. String userId = Utils.getParameter("USER_ID", params) == null ? "" : Utils.getParameter("USER_ID", params);
  456. String sql = "select REAL_NAME from SYS_USER_INFO where USER_ID=?";
  457. DbConnection dbConn = new DbConnection();//数据库连接
  458. Connection conn = null;
  459. PreparedStatement pstm = null;//sql语句的执行者
  460. ResultSet rs = null;//结果集
  461. StringBuffer sb = new StringBuffer();
  462. /*List userList = new ArrayList();*/
  463. sb.append("{\"result\":\"");
  464. try {
  465. conn = dbConn.getConnection();
  466. pstm = conn.prepareStatement(sql);
  467. pstm.setString(1, userId);
  468. rs = pstm.executeQuery();
  469. while(rs.next()){
  470. sb.append(rs.getString("REAL_NAME"));
  471. }
  472. sb.append("\"}");
  473. } catch (SQLException e) {
  474. e.printStackTrace();
  475. } catch (ClassNotFoundException e) {
  476. e.printStackTrace();
  477. }finally{
  478. try {
  479. if(pstm!=null)
  480. pstm.close();
  481. if(conn!=null)
  482. conn.close();
  483. } catch (SQLException e) {
  484. e.printStackTrace();
  485. }
  486. }
  487. return sb.toString();
  488. }
  489. @POST
  490. @ProduceMime("application/json")
  491. @Path("/getLinkMenMsg/")
  492. public String getLinkMenMsg(String params){
  493. String fdObjectid = Utils.getParameter("objectId391", params) == null ? "" : Utils.getParameter("objectId391", params);
  494. String sql = "select ENTRY_UNIT_ATTN,ENTRY_UNIT_ATTN_TEL,ENTRY_ALTERNATIVE,ENTRY_ALTERNATIVE_TEL from ECM_EM_TEAM_WRR where FD_OBJECTID='"+fdObjectid+"'";
  495. DbConnection dbConn = new DbConnection();//数据库连接
  496. Connection conn = null;
  497. PreparedStatement pstm = null;//sql语句的执行者
  498. ResultSet rs = null;//结果集
  499. StringBuffer sb = new StringBuffer();
  500. sb.append("{\"result\":[");
  501. try {
  502. conn = dbConn.getConnection();
  503. pstm = conn.prepareStatement(sql);
  504. rs = pstm.executeQuery();
  505. while(rs.next()){
  506. String linkManId1 = rs.getString("ENTRY_UNIT_ATTN") == null ? "" : rs.getString("ENTRY_UNIT_ATTN");//联系人ID
  507. String linkPhone1 = rs.getString("ENTRY_UNIT_ATTN_TEL") == null ? "" : rs.getString("ENTRY_UNIT_ATTN_TEL");//联系人电话
  508. String linkManName1 = "";//联系人NAME
  509. String linkManId2 = rs.getString("ENTRY_ALTERNATIVE") == null ? "" : rs.getString("ENTRY_ALTERNATIVE");//联系人ID
  510. String linkPhone2 = rs.getString("ENTRY_ALTERNATIVE_TEL") == null ? "" : rs.getString("ENTRY_ALTERNATIVE_TEL");//联系人电话
  511. String linkManName2 = "";//联系人NAME
  512. if(!"".equals(linkManId1)){
  513. linkManName1 = getRealName(linkManId1);
  514. }
  515. if(!"".equals(linkManId2)){
  516. linkManName2 = getRealName(linkManId2);
  517. }
  518. sb.append("{\"linkManId1\":\""+linkManId1+"\"},{\"linkManName1\":\""+linkManName1+"\"},{\"linkPhone1\":\""+linkPhone1+"\"},"+
  519. "{\"linkManId2\":\""+linkManId2+"\"},{\"linkManName2\":\""+linkManName2+"\"},{\"linkPhone2\":\""+linkPhone2+"\"}");
  520. }
  521. sb.append("]}");
  522. } catch (SQLException e) {
  523. e.printStackTrace();
  524. } catch (ClassNotFoundException e) {
  525. e.printStackTrace();
  526. }finally{
  527. try {
  528. if(pstm!=null)
  529. pstm.close();
  530. if(conn!=null)
  531. conn.close();
  532. } catch (SQLException e) {
  533. e.printStackTrace();
  534. }
  535. }
  536. /*String usersJson = JsonPluginsUtil.listToJson(userList);
  537. Log.info(usersJson);
  538. return usersJson;*/
  539. // System.out.println("-------------------------------------------------"+sb.toString());
  540. return sb.toString();
  541. }
  542. public String getRealName(String userId){
  543. String sql = " select REAL_NAME from SYS_USER_INFO where USER_ID='"+userId+"' ";
  544. DbConnection dbConn = new DbConnection();//数据库连接
  545. Connection conn = null;
  546. PreparedStatement pstm = null;//sql语句的执行者
  547. ResultSet rs = null;//结果集
  548. String realName = "";
  549. try {
  550. conn = dbConn.getConnection();
  551. pstm = conn.prepareStatement(sql);
  552. rs = pstm.executeQuery();
  553. while(rs.next()){
  554. realName = rs.getString("REAL_NAME") == null ? "" : rs.getString("REAL_NAME");//联系人NAME
  555. }
  556. } catch (SQLException e) {
  557. e.printStackTrace();
  558. } catch (ClassNotFoundException e) {
  559. e.printStackTrace();
  560. }finally{
  561. try {
  562. if(pstm!=null)
  563. pstm.close();
  564. if(conn!=null)
  565. conn.close();
  566. } catch (SQLException e) {
  567. e.printStackTrace();
  568. }
  569. }
  570. return realName;
  571. }
  572. }