/** * @author GEL * */ package com.sinosoft.em.alert.getNext; import java.io.UnsupportedEncodingException; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import javax.ws.rs.POST; import javax.ws.rs.Path; import javax.ws.rs.ProduceMime; import com.persistence.DbConnection; import com.sinosoft.lz.system.Utils; @Path("/getNextRoleService/") public class getNextRoleService{ @POST @ProduceMime("application/json") @Path("/getNextRole/") public String getNextRole(String params){ getNextRoleDao gnrDao = new getNextRoleDao(); return gnrDao.getNextRoles(params); } @ProduceMime("application/text") @POST @Path("/getNotesNum") public int getNotesNum(String params){//通知单主页面——解除 try { // params = java.net.URLDecoder.decode(params, "UTF-8"); // params = new String(params.getBytes("ISO8859-1"), "UTF-8"); params = java.net.URLDecoder.decode(java.net.URLDecoder.decode(params, "utf-8"), "utf-8"); } catch (UnsupportedEncodingException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } String alertNumb = Utils.getParameter("EARLY_WARNING_ID", params) == null ? "" : Utils.getParameter("EARLY_WARNING_ID", params); String writerDept = Utils.getParameter("WRITE_DEPT", params) == null ? "" : Utils.getParameter("WRITE_DEPT", params); String is_alert = Utils.getParameter("is_alert", params) == null ? "" : Utils.getParameter("is_alert", params); 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=?"; DbConnection dbConn = new DbConnection(); Connection conn = null; PreparedStatement pstm = null; ResultSet rs = null; int notesNumb = 0; try { conn = dbConn.getConnection(); pstm = conn.prepareStatement(sqlSql); pstm.setString(1, alertNumb); pstm.setString(2, writerDept); pstm.setString(3, is_alert); rs = pstm.executeQuery(); while(rs.next()){ notesNumb = rs.getInt("count(1)"); } }catch(Exception e){ e.printStackTrace(); }finally{ try { rs.close(); pstm.close(); conn.close(); } catch (SQLException e) { e.printStackTrace(); } } return notesNumb; } @ProduceMime("application/text") @POST @Path("/getNotesNum_alertToResp") public int getNotesNum_alertToResp(String params){//通知单主页面——解除 String fdobjectId = Utils.getParameter("FD_OBJECTID", params) == null ? "" : Utils.getParameter("FD_OBJECTID", params); String sqlSql = "select count(1) from ECM_EM_PUBLISH_ALERT_NOTICE where IS_LAST_ID=? and IS_DEL='0'"; DbConnection dbConn = new DbConnection(); Connection conn = null; PreparedStatement pstm = null; ResultSet rs = null; int notesNumb = 0; try { conn = dbConn.getConnection(); pstm = conn.prepareStatement(sqlSql); pstm.setString(1, fdobjectId); rs = pstm.executeQuery(); while(rs.next()){ notesNumb = rs.getInt("count(1)"); } }catch(Exception e){ e.printStackTrace(); }finally{ try { rs.close(); pstm.close(); conn.close(); } catch (SQLException e) { e.printStackTrace(); } } return notesNumb; } @ProduceMime("application/text") @POST @Path("/getParentCorpId") public String getParentCorpId(String params){//通知单主页面——解除 String corpId = Utils.getParameter("CORP_ID", params) == null ? "" : Utils.getParameter("CORP_ID", params); String sqlSql = "select CORP_ID from SYS_DEPARTMENT where DEPT_ID in( select PARENT_ID from SYS_DEPARTMENT where DEPT_ID=? )"; DbConnection dbConn = new DbConnection(); Connection conn = null; PreparedStatement pstm = null; ResultSet rs = null; String parentCorpId = ""; try { conn = dbConn.getConnection(); pstm = conn.prepareStatement(sqlSql); pstm.setString(1, corpId); // pstm.setString(2, corpId); rs = pstm.executeQuery(); while(rs.next()){ parentCorpId = rs.getString("CORP_ID"); } }catch(Exception e){ e.printStackTrace(); }finally{ try { rs.close(); pstm.close(); conn.close(); } catch (SQLException e) { e.printStackTrace(); } } return parentCorpId; } @ProduceMime("application/text") @POST @Path("/getExplain") public String getExplain(String params){//通知单详情页面查询回退信息 String Fd_ObjectId = Utils.getParameter("fdObjectId", params) == null ? "" : Utils.getParameter("fdObjectId", params); String sqlSql = "select EXPLAIN from ECM_EM_TREATED_HUMAN where BUSINESS_ID=? and STATUES='2' and is_del='0'"; DbConnection dbConn = new DbConnection(); Connection conn = null; PreparedStatement pstm = null; ResultSet rs = null; StringBuffer sb = new StringBuffer(); try { conn = dbConn.getConnection(); pstm = conn.prepareStatement(sqlSql); pstm.setString(1, Fd_ObjectId); rs = pstm.executeQuery(); while(rs.next()){ sb.append(rs.getString("EXPLAIN")); } }catch(Exception e){ e.printStackTrace(); }finally{ try { rs.close(); pstm.close(); conn.close(); } catch (SQLException e) { e.printStackTrace(); } } return sb.toString(); } }