2c3a5331fa74a99e1c855ad509866197fd2cf316.svn-base 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711
  1. package com.sinosoft.lz.system.sms.service;
  2. import java.sql.Connection;
  3. import java.sql.PreparedStatement;
  4. import java.sql.ResultSet;
  5. import java.sql.SQLException;
  6. import java.util.ArrayList;
  7. import java.util.List;
  8. import javax.ws.rs.POST;
  9. import javax.ws.rs.Path;
  10. import javax.ws.rs.ProduceMime;
  11. import org.apache.log4j.Logger;
  12. import com.formaction.Utils;
  13. import com.formaction.vo.Msg;
  14. import com.persistence.DbConnection;
  15. import com.sinosoft.lz.system.sms.dao.SmsDao;
  16. @Path("/SendSmsService/")
  17. public class SendSmsService{
  18. private Logger log = Logger.getLogger(this.getClass());
  19. @ProduceMime("application/json")
  20. @POST
  21. @Path("/saveSms")
  22. public Msg sendMsg(String params) throws ClassNotFoundException {
  23. Msg m=new Msg();
  24. log.info("params===" + params);
  25. String smsTitle=Utils.getParameter("smsTitle", params) == null ? "" : Utils.getParameter(
  26. "smsTitle", params);
  27. String smsRecTel=Utils.getParameter("smsRecTel", params) == null ? "" : Utils.getParameter(
  28. "smsRecTel", params);
  29. String smsTime=Utils.getParameter("smsTime", params) == null ? "" : Utils.getParameter(
  30. "smsTime", params);
  31. String smsContent=Utils.getParameter("smsContent", params) == null ? "" : Utils.getParameter(
  32. "smsContent", params);
  33. String smsSendId=Utils.getParameter("smsSendId", params) == null ? "" : Utils.getParameter(
  34. "smsSendId", params);
  35. List<String> recTel = new ArrayList<String>();
  36. String[] arr = smsRecTel.split(";");
  37. for (int i = 0; i < arr.length; i++) {
  38. recTel.add(arr[i]);
  39. }
  40. SmsDao sd = null;
  41. try {
  42. sd = new SmsDao();
  43. } catch (Exception e) {
  44. // TODO Auto-generated catch block
  45. e.printStackTrace();
  46. }
  47. m= sd.saveSms(smsTitle, recTel, smsTime, smsContent,smsSendId);
  48. return m;
  49. }
  50. @ProduceMime("application/json")
  51. @POST
  52. @Path("/saveMessage")
  53. public Msg sendMessage(String params) throws ClassNotFoundException {
  54. Msg m=new Msg();
  55. log.info("params===" + params);
  56. String realName=Utils.getParameter("realName", params) == null ? "" : Utils.getParameter(
  57. "realName", params);
  58. String smsRecTel=Utils.getParameter("smsRecTel", params) == null ? "" : Utils.getParameter(
  59. "smsRecTel", params);
  60. String smsTime=Utils.getParameter("smsTime", params) == null ? "" : Utils.getParameter(
  61. "smsTime", params);
  62. String smsContent=Utils.getParameter("smsContent", params) == null ? "" : Utils.getParameter(
  63. "smsContent", params);
  64. String smsSendId=Utils.getParameter("smsSendId", params) == null ? "" : Utils.getParameter(
  65. "smsSendId", params);
  66. String smsPeople = Utils.getParameter("smsPeople", params)==null ? "" :Utils.getParameter
  67. ("smsPeople", params);
  68. /*String deptName = Utils.getParameter("deptName", params)==null ? "" :Utils.getParameter
  69. ("deptName", params);*/
  70. String type = Utils.getParameter("type", params)==null ? "" :Utils.getParameter
  71. ("type", params);
  72. String recList = Utils.getParameter("list", params)==null ? "" :Utils.getParameter
  73. ("list", params);
  74. List<String> recTel = new ArrayList<String>();
  75. List<String> people = new ArrayList<String>();
  76. //List<String> tel = new ArrayList<String>();
  77. String[] arr = smsRecTel.split(";");
  78. String[] arr1 = smsPeople.split(";");
  79. String[] arr3 =null;
  80. if(recList!=null&&!"".equals(recList)){
  81. arr3 = recList.split(";");
  82. }
  83. for (int i = 0; i < arr.length; i++) {
  84. recTel.add(arr[i]);
  85. }
  86. if(arr3!=null){
  87. for(int k=0;k<arr3.length;k++){
  88. recTel.add(arr3[k]);
  89. }
  90. }
  91. for(int j=0;j<arr1.length;j++){
  92. people.add(arr1[j]);
  93. }
  94. SmsDao sd = null;
  95. try {
  96. sd = new SmsDao();
  97. } catch (Exception e) {
  98. // TODO Auto-generated catch block
  99. e.printStackTrace();
  100. }
  101. m= sd.saveMessage(realName, recTel, smsTime, smsContent,smsSendId,people,type);
  102. return m;
  103. }
  104. @ProduceMime("application/json")
  105. @POST
  106. @Path("/saveModel")
  107. public Msg saveModel(String params) throws Exception {
  108. Msg m=new Msg();
  109. log.info("params===" + params);
  110. String modelTitle=Utils.getParameter("modelTitle", params) == null ? "" : Utils.getParameter(
  111. "modelTitle", params);
  112. String userId=Utils.getParameter("userId", params) == null ? "" : Utils.getParameter(
  113. "userId", params);
  114. String modelTime=Utils.getParameter("modelTime", params) == null ? "" : Utils.getParameter(
  115. "modelTime", params);
  116. String modelType=Utils.getParameter("modelType", params) == null ? "" : Utils.getParameter(
  117. "modelType", params);
  118. String modelRange=Utils.getParameter("modelRange", params) == null ? "" : Utils.getParameter(
  119. "modelRange", params);
  120. String modelContent=Utils.getParameter("modelContent", params) == null ? "" : Utils.getParameter(
  121. "modelContent", params);
  122. String modelComp = Utils.getParameter("modelComp", params)==null ? "" :Utils.getParameter(
  123. "modelComp", params);
  124. String real_name = Utils.getParameter("real_name", params)==null ? "" :Utils.getParameter(
  125. "real_name", params);
  126. String msg_model_dept = Utils.getParameter("msg_model_dept", params)==null ? "" :Utils.getParameter(
  127. "msg_model_dept", params);
  128. SmsDao sd = null;
  129. try {
  130. sd = new SmsDao();
  131. } catch (Exception e) {
  132. // TODO Auto-generated catch block
  133. e.printStackTrace();
  134. }
  135. m= sd.saveModel(userId, modelTitle, modelType, modelContent, modelRange, modelTime,modelComp,real_name,msg_model_dept);
  136. return m;
  137. }
  138. @ProduceMime("application/json")
  139. @POST
  140. @Path("/getModel")
  141. public String getModel(String params){
  142. SmsDao sd=new SmsDao();
  143. String modelTitle=Utils.getParameter("modelTitle", params) == null ? "" : Utils.getParameter(
  144. "modelTitle", params);
  145. String modelContent=Utils.getParameter("modelContent", params) == null ? "" : Utils.getParameter(
  146. "modelContent", params);
  147. String modelType=Utils.getParameter("modelType", params) == null ? "" : Utils.getParameter(
  148. "modelType", params);
  149. String modelRange=Utils.getParameter("modelRange", params) == null ? "" : Utils.getParameter(
  150. "modelRange", params);
  151. String deptName=Utils.getParameter("deptName", params) == null ? "" : Utils.getParameter(
  152. "deptName", params);
  153. String userName=Utils.getParameter("userName", params) == null ? "" : Utils.getParameter(
  154. "userName", params);
  155. String modelTime=Utils.getParameter("modelTime", params) == null ? "" : Utils.getParameter(
  156. "modelTime", params);
  157. String endTime=Utils.getParameter("endTime", params) == null ? "" : Utils.getParameter(
  158. "endTime", params);
  159. String firstPageNum = Utils.getParameter("pager.pageNo", params) == null ? "0" : Utils
  160. .getParameter("pager.pageNo", params);
  161. String limit = Utils.getParameter("pager.pageSize", params) == null ? "10" : Utils
  162. .getParameter("pager.pageSize", params);
  163. String dept=Utils.getParameter("dept", params) == null ? "" : Utils.getParameter(
  164. "dept", params);
  165. String result=sd.getmodelGrid( modelTitle, modelContent, modelType, modelRange, deptName, userName, modelTime ,endTime,Integer.parseInt(firstPageNum),Integer.parseInt(limit),dept);
  166. return result;
  167. }
  168. @ProduceMime("application/json")
  169. @POST
  170. @Path("/getSms")
  171. public String getSms(String params){
  172. String recName=Utils.getParameter("recName", params) == null ? "" : Utils.getParameter(
  173. "recName", params);
  174. String recTel=Utils.getParameter("recTel", params) == null ? "" : Utils.getParameter(
  175. "recTel", params);
  176. String msg_content=Utils.getParameter("msg_content", params) == null ? "" : Utils.getParameter(
  177. "msg_content", params);
  178. String msg_type=Utils.getParameter("msg_type", params) == null ? "" : Utils.getParameter(
  179. "msg_type", params);
  180. String send_user=Utils.getParameter("send_user", params) == null ? "" : Utils.getParameter(
  181. "send_user", params);
  182. String send_dept=Utils.getParameter("send_dept", params) == null ? "" : Utils.getParameter(
  183. "send_dept", params);
  184. String msg_stat=Utils.getParameter("msg_stat", params) == null ? "" : Utils.getParameter(
  185. "msg_stat", params);
  186. String msg_time=Utils.getParameter("msg_time", params) == null ? "" : Utils.getParameter(
  187. "msg_time", params);
  188. String end_time=Utils.getParameter("end_time", params) == null ? "" : Utils.getParameter(
  189. "end_time", params);
  190. String title=Utils.getParameter("title", params) == null ? "" : Utils.getParameter(
  191. "title", params);
  192. String firstPageNum = Utils.getParameter("pager.pageNo", params) == null ? "0" : Utils
  193. .getParameter("pager.pageNo", params);
  194. String limit = Utils.getParameter("pager.pageSize", params) == null ? "10" : Utils
  195. .getParameter("pager.pageSize", params);
  196. String user_id = Utils.getParameter("user_id", params) == null ? "" : Utils
  197. .getParameter("user_id", params);
  198. String dept_id = Utils.getParameter("dept_id", params) == null ? "" : Utils
  199. .getParameter("dept_id", params);
  200. SmsDao sd=new SmsDao();
  201. String result=sd.getSmsGrid( title,recName, recTel, msg_type, msg_content, send_user, send_dept, msg_stat, msg_time,end_time,Integer.parseInt(firstPageNum),Integer.parseInt(limit),user_id,dept_id);
  202. return result;
  203. }
  204. @ProduceMime("application/json")
  205. @POST
  206. @Path("/delMsg")
  207. public Msg delMsg(String params) throws Exception{
  208. Msg m=new Msg();
  209. String fd_id=Utils.getParameter("fd_id", params) == null ? "" : Utils.getParameter(
  210. "fd_id", params);
  211. String stat=Utils.getParameter("stat", params) == null ? "" : Utils.getParameter(
  212. "stat", params);
  213. SmsDao sd=new SmsDao();
  214. m=sd.delSms(fd_id, stat);
  215. return m;
  216. }
  217. @ProduceMime("application/json")
  218. @POST
  219. @Path("/editModel")
  220. public Msg editModel(String params) throws Exception{
  221. Msg m=new Msg();
  222. String fd_id=Utils.getParameter("fd_id", params) == null ? "" : Utils.getParameter(
  223. "fd_id", params);
  224. /*String user_id=Utils.getParameter("user_id", params) == null ? "" : Utils.getParameter(
  225. "user_id", params);*/
  226. String model_title=Utils.getParameter("model_title", params) == null ? "" : Utils.getParameter(
  227. "model_title", params);
  228. String model_type=Utils.getParameter("model_type", params) == null ? "" : Utils.getParameter(
  229. "model_type", params);
  230. String model_content=Utils.getParameter("model_content", params) == null ? "" : Utils.getParameter(
  231. "model_content", params);
  232. String model_range=Utils.getParameter("model_range", params) == null ? "" : Utils.getParameter(
  233. "model_range", params);
  234. String model_time=Utils.getParameter("model_time", params) == null ? "" : Utils.getParameter(
  235. "model_time", params);
  236. SmsDao sd=new SmsDao();
  237. m=sd.editModel(fd_id, model_title, model_type, model_content, model_range, model_time);
  238. log.info(m+"==========m");
  239. return m;
  240. }
  241. //@SuppressWarnings("unused")
  242. @ProduceMime("application/json")
  243. @POST
  244. @Path("/getPeople")
  245. public String getPeople(String params){
  246. log.info("getPeople.params======="+params);
  247. SmsDao sd=new SmsDao();
  248. String real_name=Utils.getParameter("real_name", params) == null ? "" : Utils.getParameter(
  249. "real_name", params);
  250. String dept=Utils.getParameter("dept", params) == null ? "" : Utils.getParameter(
  251. "dept", params);
  252. String comp=Utils.getParameter("comp", params) == null ? "" : Utils.getParameter(
  253. "comp", params);
  254. String mobile=Utils.getParameter("mobile", params) == null ? "" : Utils.getParameter(
  255. "mobile", params);
  256. String firstPageNum = Utils.getParameter("pager.pageNo", params) == null ? "0" : Utils
  257. .getParameter("pager.pageNo", params);
  258. String limit = Utils.getParameter("pager.pageSize", params) == null ? "10" : Utils
  259. .getParameter("pager.pageSize", params);
  260. String comp_id = Utils.getParameter("comp_id", params) == null ? "" : Utils.getParameter(
  261. "comp_id", params);
  262. String result = sd.getPeople(real_name, dept, comp, mobile,Integer.parseInt(firstPageNum),Integer.parseInt(limit),comp_id);
  263. log.info(result+"================getpeople");
  264. return result;
  265. }
  266. @ProduceMime("application/json")
  267. @POST
  268. @Path("/addContact")
  269. public Msg addContact(String params){
  270. Msg m=new Msg();
  271. String user_id=Utils.getParameter("user_id", params) == null ? "" : Utils.getParameter(
  272. "user_id", params);
  273. String contact_user_id=Utils.getParameter("contact_user_id", params) == null ? "" : Utils.getParameter(
  274. "contact_user_id", params);
  275. String contact_user_name=Utils.getParameter("contact_user_name", params) == null ? "" : Utils.getParameter(
  276. "contact_user_name", params);
  277. String contact_dept=Utils.getParameter("contact_dept", params) == null ? "" : Utils.getParameter(
  278. "contact_dept", params);
  279. String contact_comp = Utils.getParameter("contact_comp", params) == null ? "0" : Utils
  280. .getParameter("contact_comp", params);
  281. String contact_tel = Utils.getParameter("contact_tel", params) == null ? "0" : Utils
  282. .getParameter("contact_tel", params);
  283. SmsDao sd=new SmsDao();
  284. m=sd.addContact(user_id, contact_user_id, contact_user_name, contact_dept, contact_comp, contact_tel);
  285. return m;
  286. }
  287. @ProduceMime("application/json")
  288. @POST
  289. @Path("/getContactList")
  290. public String getContactList(String params){
  291. String user_id= Utils.getParameter("user_id", params) == null ? "0" : Utils
  292. .getParameter("user_id", params);
  293. String result="";
  294. SmsDao sd=new SmsDao();
  295. result=sd.getContactList(user_id);
  296. return result;
  297. }
  298. @ProduceMime("application/json")
  299. @POST
  300. @Path("/getContactTel")
  301. public String getContactTel(String params){
  302. String user_id = Utils.getParameter("user_id", params) ==null?"":Utils.getParameter("user_id", params);
  303. String result = "";
  304. SmsDao dao = new SmsDao();
  305. result = dao.getContactTel(user_id);
  306. return result;
  307. }
  308. @ProduceMime("application/json")
  309. @POST
  310. @Path("/getMsgContents")
  311. public String getMsgContents(String params){
  312. String fd_id = Utils.getParameter("fd_id", params) ==null?"":Utils.getParameter("fd_id", params);
  313. SmsDao dao = new SmsDao();
  314. String result = dao.getMsgContents(fd_id);
  315. return result;
  316. }
  317. @ProduceMime("application/json")
  318. @POST
  319. @Path("/getMsgContentInfo")
  320. public String getMsgContentInfo(String params){
  321. String fd_id = Utils.getParameter("fd_id", params) ==null?"":Utils.getParameter("fd_id", params);
  322. SmsDao dao = new SmsDao();
  323. String result = dao.getMsgContentInfo(fd_id);
  324. return result;
  325. }
  326. @POST
  327. @ProduceMime("application/json")
  328. @Path("/getUniteNAME/")
  329. public String getUniteNAME(String param){
  330. String corpId = Utils.getParameter("fbdw", param);
  331. String sql = "select distinct CORP_NAME from SYS_DEPARTMENT where CORP_ID='"+corpId+"'";
  332. DbConnection dbConn = new DbConnection();//数据库连接
  333. Connection conn = null;
  334. PreparedStatement pstm = null;//sql语句的执行者
  335. ResultSet rs = null;//结果集
  336. StringBuffer sb = new StringBuffer();
  337. try {
  338. conn = dbConn.getConnection();
  339. pstm = conn.prepareStatement(sql);
  340. // pstm.setString(1, param);
  341. rs = pstm.executeQuery();
  342. while(rs.next()){
  343. sb.append(rs.getString("CORP_NAME") == null ? "" : rs.getString("CORP_NAME"));
  344. }
  345. } catch (SQLException e) {
  346. e.printStackTrace();
  347. } catch (ClassNotFoundException e) {
  348. e.printStackTrace();
  349. }finally{
  350. try {
  351. if(rs!=null)
  352. rs.close();
  353. if(pstm!=null)
  354. pstm.close();
  355. if(conn!=null)
  356. conn.close();
  357. } catch (SQLException e) {
  358. e.printStackTrace();
  359. }
  360. }
  361. return sb.toString();
  362. }
  363. @POST
  364. @ProduceMime("application/text")
  365. @Path("/getPepTel/")
  366. public String getPepTel(String params){
  367. String comp_id = Utils.getParameter("comp_id", params) ==null?"":Utils.getParameter("comp_id", params);
  368. String result = new SmsDao().getPepTel(comp_id);
  369. return result;
  370. }
  371. @POST
  372. @ProduceMime("application/json")
  373. @Path("/updateIs_Seen/")
  374. public void updateIs_Seen(String params){//修改(队伍/装备)需求表的IS_SEEN字段为【下一处理人ID,0】--0-下一节点处理人还没查看;1-下一节点处理人已查看
  375. String tableName = Utils.getParameter("tableName", params) ==null?"":Utils.getParameter("tableName", params);//(队伍/装备)需求表名
  376. String fdId = Utils.getParameter("fdId", params) ==null?"":Utils.getParameter("fdId", params);//(队伍/装备)需求ID
  377. String nextPeopId = Utils.getParameter("nextPeopId", params) ==null?"":Utils.getParameter("nextPeopId", params);//下一处理人ID
  378. String userId = Utils.getParameter("userId", params) ==null?"":Utils.getParameter("userId", params);//处理人ID
  379. String isSeen = nextPeopId+",0,"+userId;
  380. String sql = " update "+tableName+" set IS_SEEN='"+isSeen+"' where FD_OBJECTID='"+fdId+"' ";
  381. DbConnection dbConn = new DbConnection();
  382. Connection conn = null;
  383. PreparedStatement pstm = null;
  384. int n = 0;
  385. try {
  386. conn = dbConn.getConnection();
  387. pstm = conn.prepareStatement(sql);
  388. n = pstm.executeUpdate();
  389. } catch (SQLException e) {
  390. e.printStackTrace();
  391. } catch (ClassNotFoundException e) {
  392. e.printStackTrace();
  393. }finally{
  394. try {
  395. if(pstm!=null)
  396. pstm.close();
  397. if(conn!=null)
  398. conn.close();
  399. } catch (SQLException e) {
  400. e.printStackTrace();
  401. }
  402. }
  403. }
  404. @POST
  405. @ProduceMime("application/json")
  406. @Path("/updateIs_Seen_1/")
  407. public void updateIs_Seen_1(String params){//修改(队伍/装备)需求表的IS_SEEN字段为【下一处理人ID,1】--0-下一节点处理人还没查看;1-下一节点处理人已查看
  408. String tableName = Utils.getParameter("tableName", params) ==null?"":Utils.getParameter("tableName", params);//(队伍/装备)需求表名
  409. String fdId = Utils.getParameter("fdId", params) ==null?"":Utils.getParameter("fdId", params);//(队伍/装备)需求ID
  410. String nextPeopId = Utils.getParameter("nextPeopId", params) ==null?"":Utils.getParameter("nextPeopId", params);//下一处理人ID
  411. String userId = Utils.getParameter("userId", params) ==null?"":Utils.getParameter("userId", params);//处理人ID
  412. String isSeen = nextPeopId+",1,"+userId;
  413. String sql = " update "+tableName+" set IS_SEEN='"+isSeen+"' where FD_OBJECTID='"+fdId+"' ";
  414. DbConnection dbConn = new DbConnection();
  415. Connection conn = null;
  416. PreparedStatement pstm = null;
  417. int n = 0;
  418. try {
  419. conn = dbConn.getConnection();
  420. pstm = conn.prepareStatement(sql);
  421. n = pstm.executeUpdate();
  422. } catch (SQLException e) {
  423. e.printStackTrace();
  424. } catch (ClassNotFoundException e) {
  425. e.printStackTrace();
  426. }finally{
  427. try {
  428. if(pstm!=null)
  429. pstm.close();
  430. if(conn!=null)
  431. conn.close();
  432. } catch (SQLException e) {
  433. e.printStackTrace();
  434. }
  435. }
  436. }
  437. @POST
  438. @ProduceMime("application/json")
  439. @Path("/getUserMsg/")
  440. public String getUserMsg(String param){
  441. String userId = Utils.getParameter("userId", param) == null ? "" : Utils.getParameter("userId", param);
  442. String sql = "select distinct REAL_NAME,MOBILE from SYS_USER_INFO where USER_ID='"+userId+"'";
  443. DbConnection dbConn = new DbConnection();//数据库连接
  444. Connection conn = null;
  445. PreparedStatement pstm = null;//sql语句的执行者
  446. ResultSet rs = null;//结果集
  447. StringBuffer sb = new StringBuffer();
  448. try {
  449. conn = dbConn.getConnection();
  450. pstm = conn.prepareStatement(sql);
  451. rs = pstm.executeQuery();
  452. while(rs.next()){
  453. String realName = rs.getString("REAL_NAME") == null ? "" : rs.getString("REAL_NAME");
  454. String phoneNum = rs.getString("MOBILE") == null ? "" : rs.getString("MOBILE");
  455. sb.append("{\"realName\":\""+realName+"\",\"phoneNum\":\""+phoneNum+"\"},");
  456. }
  457. if(sb.lastIndexOf(",") > -1){
  458. sb.deleteCharAt(sb.lastIndexOf(","));
  459. }
  460. } catch (SQLException e) {
  461. e.printStackTrace();
  462. } catch (ClassNotFoundException e) {
  463. e.printStackTrace();
  464. }finally{
  465. try {
  466. if(rs!=null)
  467. rs.close();
  468. if(pstm!=null)
  469. pstm.close();
  470. if(conn!=null)
  471. conn.close();
  472. } catch (SQLException e) {
  473. e.printStackTrace();
  474. }
  475. }
  476. return sb.toString();
  477. }
  478. /**
  479. * 通知单详情页面用到
  480. * @param param
  481. * @return
  482. */
  483. @POST
  484. @ProduceMime("application/json")
  485. @Path("/getHumanMsg/")
  486. public String getHumanMsg(String param){
  487. String objectId = Utils.getParameter("fd_id", param) == null ? "" : Utils.getParameter("fd_id", param);//通知单ID
  488. String tzdState = Utils.getParameter("isSend", param) == null ? "" : Utils.getParameter("isSend", param);//通知单状态
  489. String sql = "select top 1 PERSON_ID from ECM_EM_TREATED_HUMAN where BUSINESS_ID='"+objectId+"' and STATUES='"+tzdState+"' order by UPDATEDATE desc";
  490. DbConnection dbConn = new DbConnection();//数据库连接
  491. Connection conn = null;
  492. PreparedStatement pstm = null;//sql语句的执行者
  493. ResultSet rs = null;//结果集
  494. StringBuffer sb = new StringBuffer();
  495. try {
  496. conn = dbConn.getConnection();
  497. pstm = conn.prepareStatement(sql);
  498. rs = pstm.executeQuery();
  499. while(rs.next()){
  500. String personId = rs.getString("PERSON_ID") == null ? "" : rs.getString("PERSON_ID");
  501. sb.append("{\"personId\":\""+personId+"\"}");
  502. }
  503. if(sb.lastIndexOf(",") > -1){
  504. sb.deleteCharAt(sb.lastIndexOf(","));
  505. }
  506. } catch (SQLException e) {
  507. e.printStackTrace();
  508. } catch (ClassNotFoundException e) {
  509. e.printStackTrace();
  510. }finally{
  511. try {
  512. if(rs!=null)
  513. rs.close();
  514. if(pstm!=null)
  515. pstm.close();
  516. if(conn!=null)
  517. conn.close();
  518. } catch (SQLException e) {
  519. e.printStackTrace();
  520. }
  521. }
  522. return sb.toString();
  523. }
  524. /**
  525. * 通知单聚合页面用到
  526. * @param param
  527. * @return
  528. */
  529. @POST
  530. @ProduceMime("application/json")
  531. @Path("/getLetterOfNoticeInfo/")
  532. public String getLetterOfNoticeInfo(String param){
  533. String enentId = Utils.getParameter("eventId", param) == null ? "" : Utils.getParameter("eventId", param);//关联的事件ID
  534. String issueUnit = Utils.getParameter("deptId", param) == null ? "" : Utils.getParameter("deptId", param);//通知单登录人ID
  535. //String sql = "select * from ECM_EM_PUBLISH_ALERT_NOTICE where (RELEASE_UNIT='"+issueUnit+"' or RELEASE_UNIT in ( select DEPT_ID from SYS_DEPARTMENT where PARENT_ID='"+issueUnit+"' )) and EVENT_ID='"+enentId+"'";
  536. String sql = " select "+
  537. " event.EVENT_NAME a,"+//事件名称
  538. " dept.DEPT_NAME b,"+//发布单位名称
  539. " notice.EARLY_WARNING_NAME c,"+//预警/响应名称
  540. " notice.EARLY_WARNING_ID d,"+//预警/响应编号
  541. " notice.EARLY_WARNING_AREA_NAME e,"+//预警/响应范围
  542. " notice.RELEASE_RELIEVE_DATE f,"+//发布时间
  543. " notice.FD_OBJECTID g,"+//通知单id365
  544. " notice.IS_ALERT h"+//预警0或响应1
  545. " from "+
  546. " ECM_EM_PUBLISH_ALERT_NOTICE notice,"+
  547. " ECM_EM_EVENT_NAME event,"+
  548. " SYS_DEPARTMENT dept"+
  549. " where"+
  550. " ("+
  551. " notice.RELEASE_UNIT ='"+issueUnit+"'"+
  552. " or notice.RELEASE_UNIT in"+
  553. "( select DEPT_ID from SYS_DEPARTMENT where PARENT_ID='"+issueUnit+"' )"+
  554. " )"+
  555. " and notice.RELEASE_UNIT = DEPT_ID"+
  556. " and notice.EVENT_ID = '"+enentId+"'"+
  557. " and notice.EVENT_ID = event.FD_OBJECTID";
  558. DbConnection dbConn = new DbConnection();//数据库连接
  559. Connection conn = null;
  560. PreparedStatement pstm = null;//sql语句的执行者
  561. ResultSet rs = null;//结果集
  562. StringBuffer sb = new StringBuffer();
  563. try {
  564. conn = dbConn.getConnection();
  565. pstm = conn.prepareStatement(sql);
  566. rs = pstm.executeQuery();
  567. sb.append("[");
  568. while(rs.next()){
  569. String a = rs.getString("a") == null ? "" : rs.getString("a");
  570. String b = rs.getString("b") == null ? "" : rs.getString("b");
  571. String c = rs.getString("c") == null ? "" : rs.getString("c");
  572. String d = rs.getString("d") == null ? "" : rs.getString("d");
  573. String e = rs.getString("e") == null ? "" : rs.getString("e");
  574. String f = rs.getString("f") == null ? "" : rs.getString("f");
  575. String g = rs.getString("g") == null ? "" : rs.getString("g");
  576. String h = rs.getString("h") == null ? "" : rs.getString("h");
  577. sb.append("{\"eventName\":\""+a+"\","+
  578. "\"issueUnitName\":\""+b+"\","+
  579. "\"noticeName\":\""+c+"\","+
  580. "\"noticeNum\":\""+d+"\","+
  581. "\"noticeAreaName\":\""+e+"\","+
  582. "\"issueDate\":\""+f+"\","+
  583. "\"fdId365\":\""+g+"\","+
  584. "\"isAlert\":\""+h+"\"},");
  585. }
  586. if(sb.lastIndexOf(",") > -1){
  587. sb.deleteCharAt(sb.lastIndexOf(","));
  588. }
  589. sb.append("]");
  590. } catch (SQLException e) {
  591. e.printStackTrace();
  592. } catch (ClassNotFoundException e) {
  593. e.printStackTrace();
  594. }finally{
  595. try {
  596. if(rs!=null)
  597. rs.close();
  598. if(pstm!=null)
  599. pstm.close();
  600. if(conn!=null)
  601. conn.close();
  602. } catch (SQLException e) {
  603. e.printStackTrace();
  604. }
  605. }
  606. return sb.toString();
  607. }
  608. /**
  609. * 队伍需求退回时,查询上一处理人信息
  610. * @param param
  611. * @return
  612. */
  613. @POST
  614. @ProduceMime("application/json")
  615. @Path("/getLastPersonMsg/")
  616. public String getLastPersonMsg(String param){
  617. String fdId = Utils.getParameter("fd_id", param) == null ? "" : Utils.getParameter("fd_id", param);//需求ID
  618. String stat = Utils.getParameter("STATE", param) == null ? "" : Utils.getParameter("STATE", param);//状态
  619. String sql = "select top(1) PERSON_ID a,PERSON_NAME b from ECM_EM_TREATED_HUMAN where BUSINESS_ID='"+fdId+"' and STATUES='"+stat+"' order by updatedate desc";
  620. DbConnection dbConn = new DbConnection();//数据库连接
  621. Connection conn = null;
  622. PreparedStatement pstm = null;//sql语句的执行者
  623. ResultSet rs = null;//结果集
  624. StringBuffer sb = new StringBuffer();
  625. try {
  626. conn = dbConn.getConnection();
  627. pstm = conn.prepareStatement(sql);
  628. rs = pstm.executeQuery();
  629. while(rs.next()){
  630. String a = rs.getString("a") == null ? "" : rs.getString("a");
  631. String b = rs.getString("b") == null ? "" : rs.getString("b");
  632. sb.append("{\"name\":\""+b+"\","+
  633. "\"id\":\""+a+"\"},");
  634. }
  635. if(sb.lastIndexOf(",") > -1){
  636. sb.deleteCharAt(sb.lastIndexOf(","));
  637. }
  638. } catch (SQLException e) {
  639. e.printStackTrace();
  640. } catch (ClassNotFoundException e) {
  641. e.printStackTrace();
  642. }finally{
  643. try {
  644. if(rs!=null)
  645. rs.close();
  646. if(pstm!=null)
  647. pstm.close();
  648. if(conn!=null)
  649. conn.close();
  650. } catch (SQLException e) {
  651. e.printStackTrace();
  652. }
  653. }
  654. log.info("****"+sb.toString());
  655. return sb.toString();
  656. }
  657. }