6139f26d7fa3e721c6ae9699bc7a1917154b06c8.svn-base 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. /**
  2. * @author GEL
  3. *
  4. */
  5. package com.sinosoft.em.alert.getNext;
  6. import java.io.UnsupportedEncodingException;
  7. import java.sql.Connection;
  8. import java.sql.PreparedStatement;
  9. import java.sql.ResultSet;
  10. import java.sql.SQLException;
  11. import javax.ws.rs.POST;
  12. import javax.ws.rs.Path;
  13. import javax.ws.rs.ProduceMime;
  14. import com.persistence.DbConnection;
  15. import com.sinosoft.lz.system.Utils;
  16. @Path("/getNextRoleService/")
  17. public class getNextRoleService{
  18. @POST
  19. @ProduceMime("application/json")
  20. @Path("/getNextRole/")
  21. public String getNextRole(String params){
  22. getNextRoleDao gnrDao = new getNextRoleDao();
  23. return gnrDao.getNextRoles(params);
  24. }
  25. @ProduceMime("application/text")
  26. @POST
  27. @Path("/getNotesNum")
  28. public int getNotesNum(String params){//通知单主页面——解除
  29. try {
  30. // params = java.net.URLDecoder.decode(params, "UTF-8");
  31. // params = new String(params.getBytes("ISO8859-1"), "UTF-8");
  32. params = java.net.URLDecoder.decode(java.net.URLDecoder.decode(params, "utf-8"), "utf-8");
  33. } catch (UnsupportedEncodingException e1) {
  34. // TODO Auto-generated catch block
  35. e1.printStackTrace();
  36. }
  37. String alertNumb = Utils.getParameter("EARLY_WARNING_ID", params) == null ? "" : Utils.getParameter("EARLY_WARNING_ID", params);
  38. String writerDept = Utils.getParameter("WRITE_DEPT", params) == null ? "" : Utils.getParameter("WRITE_DEPT", params);
  39. String is_alert = Utils.getParameter("is_alert", params) == null ? "" : Utils.getParameter("is_alert", params);
  40. String sqlSql = "select count(1) from ECM_EM_PUBLISH_ALERT_NOTICE where EARLY_WARNING_ID=? and EARLY_WARNING_PROPERTY='51' and WRITE_DEPT=? and IS_DEL='0' and is_send<'6' and is_alert=?";
  41. DbConnection dbConn = new DbConnection();
  42. Connection conn = null;
  43. PreparedStatement pstm = null;
  44. ResultSet rs = null;
  45. int notesNumb = 0;
  46. try {
  47. conn = dbConn.getConnection();
  48. pstm = conn.prepareStatement(sqlSql);
  49. pstm.setString(1, alertNumb);
  50. pstm.setString(2, writerDept);
  51. pstm.setString(3, is_alert);
  52. rs = pstm.executeQuery();
  53. while(rs.next()){
  54. notesNumb = rs.getInt("count(1)");
  55. }
  56. }catch(Exception e){
  57. e.printStackTrace();
  58. }finally{
  59. try {
  60. rs.close();
  61. pstm.close();
  62. conn.close();
  63. } catch (SQLException e) {
  64. e.printStackTrace();
  65. }
  66. }
  67. return notesNumb;
  68. }
  69. @ProduceMime("application/text")
  70. @POST
  71. @Path("/getNotesNum_alertToResp")
  72. public int getNotesNum_alertToResp(String params){//通知单主页面——解除
  73. String fdobjectId = Utils.getParameter("FD_OBJECTID", params) == null ? "" : Utils.getParameter("FD_OBJECTID", params);
  74. String sqlSql = "select count(1) from ECM_EM_PUBLISH_ALERT_NOTICE where IS_LAST_ID=? and IS_DEL='0'";
  75. DbConnection dbConn = new DbConnection();
  76. Connection conn = null;
  77. PreparedStatement pstm = null;
  78. ResultSet rs = null;
  79. int notesNumb = 0;
  80. try {
  81. conn = dbConn.getConnection();
  82. pstm = conn.prepareStatement(sqlSql);
  83. pstm.setString(1, fdobjectId);
  84. rs = pstm.executeQuery();
  85. while(rs.next()){
  86. notesNumb = rs.getInt("count(1)");
  87. }
  88. }catch(Exception e){
  89. e.printStackTrace();
  90. }finally{
  91. try {
  92. rs.close();
  93. pstm.close();
  94. conn.close();
  95. } catch (SQLException e) {
  96. e.printStackTrace();
  97. }
  98. }
  99. return notesNumb;
  100. }
  101. @ProduceMime("application/text")
  102. @POST
  103. @Path("/getParentCorpId")
  104. public String getParentCorpId(String params){//通知单主页面——解除
  105. String corpId = Utils.getParameter("CORP_ID", params) == null ? "" : Utils.getParameter("CORP_ID", params);
  106. String sqlSql = "select CORP_ID from SYS_DEPARTMENT where DEPT_ID in( select PARENT_ID from SYS_DEPARTMENT where DEPT_ID=? )";
  107. DbConnection dbConn = new DbConnection();
  108. Connection conn = null;
  109. PreparedStatement pstm = null;
  110. ResultSet rs = null;
  111. String parentCorpId = "";
  112. try {
  113. conn = dbConn.getConnection();
  114. pstm = conn.prepareStatement(sqlSql);
  115. pstm.setString(1, corpId);
  116. // pstm.setString(2, corpId);
  117. rs = pstm.executeQuery();
  118. while(rs.next()){
  119. parentCorpId = rs.getString("CORP_ID");
  120. }
  121. }catch(Exception e){
  122. e.printStackTrace();
  123. }finally{
  124. try {
  125. rs.close();
  126. pstm.close();
  127. conn.close();
  128. } catch (SQLException e) {
  129. e.printStackTrace();
  130. }
  131. }
  132. return parentCorpId;
  133. }
  134. @ProduceMime("application/text")
  135. @POST
  136. @Path("/getExplain")
  137. public String getExplain(String params){//通知单详情页面查询回退信息
  138. String Fd_ObjectId = Utils.getParameter("fdObjectId", params) == null ? "" : Utils.getParameter("fdObjectId", params);
  139. String sqlSql = "select EXPLAIN from ECM_EM_TREATED_HUMAN where BUSINESS_ID=? and STATUES='2' and is_del='0'";
  140. DbConnection dbConn = new DbConnection();
  141. Connection conn = null;
  142. PreparedStatement pstm = null;
  143. ResultSet rs = null;
  144. StringBuffer sb = new StringBuffer();
  145. try {
  146. conn = dbConn.getConnection();
  147. pstm = conn.prepareStatement(sqlSql);
  148. pstm.setString(1, Fd_ObjectId);
  149. rs = pstm.executeQuery();
  150. while(rs.next()){
  151. sb.append(rs.getString("EXPLAIN"));
  152. }
  153. }catch(Exception e){
  154. e.printStackTrace();
  155. }finally{
  156. try {
  157. rs.close();
  158. pstm.close();
  159. conn.close();
  160. } catch (SQLException e) {
  161. e.printStackTrace();
  162. }
  163. }
  164. return sb.toString();
  165. }
  166. }