123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711 |
- package com.sinosoft.lz.system.sms.service;
- import java.sql.Connection;
- import java.sql.PreparedStatement;
- import java.sql.ResultSet;
- import java.sql.SQLException;
- import java.util.ArrayList;
- import java.util.List;
- import javax.ws.rs.POST;
- import javax.ws.rs.Path;
- import javax.ws.rs.ProduceMime;
- import org.apache.log4j.Logger;
- import com.formaction.Utils;
- import com.formaction.vo.Msg;
- import com.persistence.DbConnection;
- import com.sinosoft.lz.system.sms.dao.SmsDao;
- @Path("/SendSmsService/")
- public class SendSmsService{
- private Logger log = Logger.getLogger(this.getClass());
- @ProduceMime("application/json")
- @POST
- @Path("/saveSms")
- public Msg sendMsg(String params) throws ClassNotFoundException {
- Msg m=new Msg();
- log.info("params===" + params);
- String smsTitle=Utils.getParameter("smsTitle", params) == null ? "" : Utils.getParameter(
- "smsTitle", params);
- String smsRecTel=Utils.getParameter("smsRecTel", params) == null ? "" : Utils.getParameter(
- "smsRecTel", params);
- String smsTime=Utils.getParameter("smsTime", params) == null ? "" : Utils.getParameter(
- "smsTime", params);
- String smsContent=Utils.getParameter("smsContent", params) == null ? "" : Utils.getParameter(
- "smsContent", params);
- String smsSendId=Utils.getParameter("smsSendId", params) == null ? "" : Utils.getParameter(
- "smsSendId", params);
-
- List<String> recTel = new ArrayList<String>();
- String[] arr = smsRecTel.split(";");
- for (int i = 0; i < arr.length; i++) {
- recTel.add(arr[i]);
- }
- SmsDao sd = null;
- try {
- sd = new SmsDao();
- } catch (Exception e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- m= sd.saveSms(smsTitle, recTel, smsTime, smsContent,smsSendId);
- return m;
- }
-
- @ProduceMime("application/json")
- @POST
- @Path("/saveMessage")
- public Msg sendMessage(String params) throws ClassNotFoundException {
- Msg m=new Msg();
- log.info("params===" + params);
- String realName=Utils.getParameter("realName", params) == null ? "" : Utils.getParameter(
- "realName", params);
- String smsRecTel=Utils.getParameter("smsRecTel", params) == null ? "" : Utils.getParameter(
- "smsRecTel", params);
- String smsTime=Utils.getParameter("smsTime", params) == null ? "" : Utils.getParameter(
- "smsTime", params);
- String smsContent=Utils.getParameter("smsContent", params) == null ? "" : Utils.getParameter(
- "smsContent", params);
- String smsSendId=Utils.getParameter("smsSendId", params) == null ? "" : Utils.getParameter(
- "smsSendId", params);
- String smsPeople = Utils.getParameter("smsPeople", params)==null ? "" :Utils.getParameter
- ("smsPeople", params);
- /*String deptName = Utils.getParameter("deptName", params)==null ? "" :Utils.getParameter
- ("deptName", params);*/
- String type = Utils.getParameter("type", params)==null ? "" :Utils.getParameter
- ("type", params);
- String recList = Utils.getParameter("list", params)==null ? "" :Utils.getParameter
- ("list", params);
- List<String> recTel = new ArrayList<String>();
- List<String> people = new ArrayList<String>();
- //List<String> tel = new ArrayList<String>();
- String[] arr = smsRecTel.split(";");
- String[] arr1 = smsPeople.split(";");
- String[] arr3 =null;
- if(recList!=null&&!"".equals(recList)){
- arr3 = recList.split(";");
- }
-
- for (int i = 0; i < arr.length; i++) {
- recTel.add(arr[i]);
- }
- if(arr3!=null){
- for(int k=0;k<arr3.length;k++){
- recTel.add(arr3[k]);
- }
- }
- for(int j=0;j<arr1.length;j++){
- people.add(arr1[j]);
- }
- SmsDao sd = null;
- try {
- sd = new SmsDao();
- } catch (Exception e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- m= sd.saveMessage(realName, recTel, smsTime, smsContent,smsSendId,people,type);
- return m;
- }
-
-
- @ProduceMime("application/json")
- @POST
- @Path("/saveModel")
- public Msg saveModel(String params) throws Exception {
- Msg m=new Msg();
- log.info("params===" + params);
- String modelTitle=Utils.getParameter("modelTitle", params) == null ? "" : Utils.getParameter(
- "modelTitle", params);
- String userId=Utils.getParameter("userId", params) == null ? "" : Utils.getParameter(
- "userId", params);
- String modelTime=Utils.getParameter("modelTime", params) == null ? "" : Utils.getParameter(
- "modelTime", params);
- String modelType=Utils.getParameter("modelType", params) == null ? "" : Utils.getParameter(
- "modelType", params);
- String modelRange=Utils.getParameter("modelRange", params) == null ? "" : Utils.getParameter(
- "modelRange", params);
- String modelContent=Utils.getParameter("modelContent", params) == null ? "" : Utils.getParameter(
- "modelContent", params);
- String modelComp = Utils.getParameter("modelComp", params)==null ? "" :Utils.getParameter(
- "modelComp", params);
- String real_name = Utils.getParameter("real_name", params)==null ? "" :Utils.getParameter(
- "real_name", params);
- String msg_model_dept = Utils.getParameter("msg_model_dept", params)==null ? "" :Utils.getParameter(
- "msg_model_dept", params);
- SmsDao sd = null;
- try {
- sd = new SmsDao();
- } catch (Exception e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- m= sd.saveModel(userId, modelTitle, modelType, modelContent, modelRange, modelTime,modelComp,real_name,msg_model_dept);
- return m;
- }
-
- @ProduceMime("application/json")
- @POST
- @Path("/getModel")
- public String getModel(String params){
- SmsDao sd=new SmsDao();
- String modelTitle=Utils.getParameter("modelTitle", params) == null ? "" : Utils.getParameter(
- "modelTitle", params);
- String modelContent=Utils.getParameter("modelContent", params) == null ? "" : Utils.getParameter(
- "modelContent", params);
- String modelType=Utils.getParameter("modelType", params) == null ? "" : Utils.getParameter(
- "modelType", params);
- String modelRange=Utils.getParameter("modelRange", params) == null ? "" : Utils.getParameter(
- "modelRange", params);
- String deptName=Utils.getParameter("deptName", params) == null ? "" : Utils.getParameter(
- "deptName", params);
- String userName=Utils.getParameter("userName", params) == null ? "" : Utils.getParameter(
- "userName", params);
- String modelTime=Utils.getParameter("modelTime", params) == null ? "" : Utils.getParameter(
- "modelTime", params);
- String endTime=Utils.getParameter("endTime", params) == null ? "" : Utils.getParameter(
- "endTime", params);
- String firstPageNum = Utils.getParameter("pager.pageNo", params) == null ? "0" : Utils
- .getParameter("pager.pageNo", params);
- String limit = Utils.getParameter("pager.pageSize", params) == null ? "10" : Utils
- .getParameter("pager.pageSize", params);
- String dept=Utils.getParameter("dept", params) == null ? "" : Utils.getParameter(
- "dept", params);
- String result=sd.getmodelGrid( modelTitle, modelContent, modelType, modelRange, deptName, userName, modelTime ,endTime,Integer.parseInt(firstPageNum),Integer.parseInt(limit),dept);
- return result;
- }
-
- @ProduceMime("application/json")
- @POST
- @Path("/getSms")
- public String getSms(String params){
- String recName=Utils.getParameter("recName", params) == null ? "" : Utils.getParameter(
- "recName", params);
- String recTel=Utils.getParameter("recTel", params) == null ? "" : Utils.getParameter(
- "recTel", params);
- String msg_content=Utils.getParameter("msg_content", params) == null ? "" : Utils.getParameter(
- "msg_content", params);
- String msg_type=Utils.getParameter("msg_type", params) == null ? "" : Utils.getParameter(
- "msg_type", params);
- String send_user=Utils.getParameter("send_user", params) == null ? "" : Utils.getParameter(
- "send_user", params);
- String send_dept=Utils.getParameter("send_dept", params) == null ? "" : Utils.getParameter(
- "send_dept", params);
- String msg_stat=Utils.getParameter("msg_stat", params) == null ? "" : Utils.getParameter(
- "msg_stat", params);
- String msg_time=Utils.getParameter("msg_time", params) == null ? "" : Utils.getParameter(
- "msg_time", params);
- String end_time=Utils.getParameter("end_time", params) == null ? "" : Utils.getParameter(
- "end_time", params);
- String title=Utils.getParameter("title", params) == null ? "" : Utils.getParameter(
- "title", params);
- String firstPageNum = Utils.getParameter("pager.pageNo", params) == null ? "0" : Utils
- .getParameter("pager.pageNo", params);
- String limit = Utils.getParameter("pager.pageSize", params) == null ? "10" : Utils
- .getParameter("pager.pageSize", params);
- String user_id = Utils.getParameter("user_id", params) == null ? "" : Utils
- .getParameter("user_id", params);
- String dept_id = Utils.getParameter("dept_id", params) == null ? "" : Utils
- .getParameter("dept_id", params);
- SmsDao sd=new SmsDao();
- 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);
- return result;
- }
-
- @ProduceMime("application/json")
- @POST
- @Path("/delMsg")
- public Msg delMsg(String params) throws Exception{
- Msg m=new Msg();
- String fd_id=Utils.getParameter("fd_id", params) == null ? "" : Utils.getParameter(
- "fd_id", params);
- String stat=Utils.getParameter("stat", params) == null ? "" : Utils.getParameter(
- "stat", params);
- SmsDao sd=new SmsDao();
- m=sd.delSms(fd_id, stat);
- return m;
- }
-
- @ProduceMime("application/json")
- @POST
- @Path("/editModel")
- public Msg editModel(String params) throws Exception{
- Msg m=new Msg();
- String fd_id=Utils.getParameter("fd_id", params) == null ? "" : Utils.getParameter(
- "fd_id", params);
- /*String user_id=Utils.getParameter("user_id", params) == null ? "" : Utils.getParameter(
- "user_id", params);*/
- String model_title=Utils.getParameter("model_title", params) == null ? "" : Utils.getParameter(
- "model_title", params);
- String model_type=Utils.getParameter("model_type", params) == null ? "" : Utils.getParameter(
- "model_type", params);
- String model_content=Utils.getParameter("model_content", params) == null ? "" : Utils.getParameter(
- "model_content", params);
- String model_range=Utils.getParameter("model_range", params) == null ? "" : Utils.getParameter(
- "model_range", params);
- String model_time=Utils.getParameter("model_time", params) == null ? "" : Utils.getParameter(
- "model_time", params);
- SmsDao sd=new SmsDao();
- m=sd.editModel(fd_id, model_title, model_type, model_content, model_range, model_time);
- log.info(m+"==========m");
- return m;
- }
-
- //@SuppressWarnings("unused")
- @ProduceMime("application/json")
- @POST
- @Path("/getPeople")
- public String getPeople(String params){
- log.info("getPeople.params======="+params);
- SmsDao sd=new SmsDao();
- String real_name=Utils.getParameter("real_name", params) == null ? "" : Utils.getParameter(
- "real_name", params);
- String dept=Utils.getParameter("dept", params) == null ? "" : Utils.getParameter(
- "dept", params);
- String comp=Utils.getParameter("comp", params) == null ? "" : Utils.getParameter(
- "comp", params);
- String mobile=Utils.getParameter("mobile", params) == null ? "" : Utils.getParameter(
- "mobile", params);
- String firstPageNum = Utils.getParameter("pager.pageNo", params) == null ? "0" : Utils
- .getParameter("pager.pageNo", params);
- String limit = Utils.getParameter("pager.pageSize", params) == null ? "10" : Utils
- .getParameter("pager.pageSize", params);
- String comp_id = Utils.getParameter("comp_id", params) == null ? "" : Utils.getParameter(
- "comp_id", params);
- String result = sd.getPeople(real_name, dept, comp, mobile,Integer.parseInt(firstPageNum),Integer.parseInt(limit),comp_id);
- log.info(result+"================getpeople");
- return result;
- }
-
- @ProduceMime("application/json")
- @POST
- @Path("/addContact")
- public Msg addContact(String params){
- Msg m=new Msg();
- String user_id=Utils.getParameter("user_id", params) == null ? "" : Utils.getParameter(
- "user_id", params);
- String contact_user_id=Utils.getParameter("contact_user_id", params) == null ? "" : Utils.getParameter(
- "contact_user_id", params);
- String contact_user_name=Utils.getParameter("contact_user_name", params) == null ? "" : Utils.getParameter(
- "contact_user_name", params);
- String contact_dept=Utils.getParameter("contact_dept", params) == null ? "" : Utils.getParameter(
- "contact_dept", params);
- String contact_comp = Utils.getParameter("contact_comp", params) == null ? "0" : Utils
- .getParameter("contact_comp", params);
- String contact_tel = Utils.getParameter("contact_tel", params) == null ? "0" : Utils
- .getParameter("contact_tel", params);
- SmsDao sd=new SmsDao();
- m=sd.addContact(user_id, contact_user_id, contact_user_name, contact_dept, contact_comp, contact_tel);
- return m;
- }
-
- @ProduceMime("application/json")
- @POST
- @Path("/getContactList")
- public String getContactList(String params){
- String user_id= Utils.getParameter("user_id", params) == null ? "0" : Utils
- .getParameter("user_id", params);
- String result="";
- SmsDao sd=new SmsDao();
- result=sd.getContactList(user_id);
- return result;
- }
-
- @ProduceMime("application/json")
- @POST
- @Path("/getContactTel")
- public String getContactTel(String params){
- String user_id = Utils.getParameter("user_id", params) ==null?"":Utils.getParameter("user_id", params);
- String result = "";
- SmsDao dao = new SmsDao();
- result = dao.getContactTel(user_id);
- return result;
- }
-
- @ProduceMime("application/json")
- @POST
- @Path("/getMsgContents")
- public String getMsgContents(String params){
- String fd_id = Utils.getParameter("fd_id", params) ==null?"":Utils.getParameter("fd_id", params);
- SmsDao dao = new SmsDao();
- String result = dao.getMsgContents(fd_id);
- return result;
- }
-
- @ProduceMime("application/json")
- @POST
- @Path("/getMsgContentInfo")
- public String getMsgContentInfo(String params){
- String fd_id = Utils.getParameter("fd_id", params) ==null?"":Utils.getParameter("fd_id", params);
- SmsDao dao = new SmsDao();
- String result = dao.getMsgContentInfo(fd_id);
- return result;
- }
-
- @POST
- @ProduceMime("application/json")
- @Path("/getUniteNAME/")
- public String getUniteNAME(String param){
- String corpId = Utils.getParameter("fbdw", param);
- String sql = "select distinct CORP_NAME from SYS_DEPARTMENT where CORP_ID='"+corpId+"'";
- DbConnection dbConn = new DbConnection();//数据库连接
- Connection conn = null;
- PreparedStatement pstm = null;//sql语句的执行者
- ResultSet rs = null;//结果集
- StringBuffer sb = new StringBuffer();
- try {
- conn = dbConn.getConnection();
- pstm = conn.prepareStatement(sql);
- // pstm.setString(1, param);
- rs = pstm.executeQuery();
- while(rs.next()){
- sb.append(rs.getString("CORP_NAME") == null ? "" : rs.getString("CORP_NAME"));
- }
- } catch (SQLException e) {
- e.printStackTrace();
- } catch (ClassNotFoundException e) {
- e.printStackTrace();
- }finally{
- try {
- if(rs!=null)
- rs.close();
- if(pstm!=null)
- pstm.close();
- if(conn!=null)
- conn.close();
- } catch (SQLException e) {
- e.printStackTrace();
- }
- }
- return sb.toString();
- }
-
-
- @POST
- @ProduceMime("application/text")
- @Path("/getPepTel/")
- public String getPepTel(String params){
- String comp_id = Utils.getParameter("comp_id", params) ==null?"":Utils.getParameter("comp_id", params);
- String result = new SmsDao().getPepTel(comp_id);
- return result;
- }
-
- @POST
- @ProduceMime("application/json")
- @Path("/updateIs_Seen/")
- public void updateIs_Seen(String params){//修改(队伍/装备)需求表的IS_SEEN字段为【下一处理人ID,0】--0-下一节点处理人还没查看;1-下一节点处理人已查看
- String tableName = Utils.getParameter("tableName", params) ==null?"":Utils.getParameter("tableName", params);//(队伍/装备)需求表名
- String fdId = Utils.getParameter("fdId", params) ==null?"":Utils.getParameter("fdId", params);//(队伍/装备)需求ID
- String nextPeopId = Utils.getParameter("nextPeopId", params) ==null?"":Utils.getParameter("nextPeopId", params);//下一处理人ID
- String userId = Utils.getParameter("userId", params) ==null?"":Utils.getParameter("userId", params);//处理人ID
- String isSeen = nextPeopId+",0,"+userId;
-
- String sql = " update "+tableName+" set IS_SEEN='"+isSeen+"' where FD_OBJECTID='"+fdId+"' ";
-
- DbConnection dbConn = new DbConnection();
- Connection conn = null;
- PreparedStatement pstm = null;
- int n = 0;
- try {
- conn = dbConn.getConnection();
- pstm = conn.prepareStatement(sql);
- n = pstm.executeUpdate();
- } catch (SQLException e) {
- e.printStackTrace();
- } catch (ClassNotFoundException e) {
- e.printStackTrace();
- }finally{
- try {
- if(pstm!=null)
- pstm.close();
- if(conn!=null)
- conn.close();
- } catch (SQLException e) {
- e.printStackTrace();
- }
- }
- }
-
- @POST
- @ProduceMime("application/json")
- @Path("/updateIs_Seen_1/")
- public void updateIs_Seen_1(String params){//修改(队伍/装备)需求表的IS_SEEN字段为【下一处理人ID,1】--0-下一节点处理人还没查看;1-下一节点处理人已查看
- String tableName = Utils.getParameter("tableName", params) ==null?"":Utils.getParameter("tableName", params);//(队伍/装备)需求表名
- String fdId = Utils.getParameter("fdId", params) ==null?"":Utils.getParameter("fdId", params);//(队伍/装备)需求ID
- String nextPeopId = Utils.getParameter("nextPeopId", params) ==null?"":Utils.getParameter("nextPeopId", params);//下一处理人ID
- String userId = Utils.getParameter("userId", params) ==null?"":Utils.getParameter("userId", params);//处理人ID
- String isSeen = nextPeopId+",1,"+userId;
-
- String sql = " update "+tableName+" set IS_SEEN='"+isSeen+"' where FD_OBJECTID='"+fdId+"' ";
-
- DbConnection dbConn = new DbConnection();
- Connection conn = null;
- PreparedStatement pstm = null;
- int n = 0;
- try {
- conn = dbConn.getConnection();
- pstm = conn.prepareStatement(sql);
- n = pstm.executeUpdate();
- } catch (SQLException e) {
- e.printStackTrace();
- } catch (ClassNotFoundException e) {
- e.printStackTrace();
- }finally{
- try {
- if(pstm!=null)
- pstm.close();
- if(conn!=null)
- conn.close();
- } catch (SQLException e) {
- e.printStackTrace();
- }
- }
- }
-
- @POST
- @ProduceMime("application/json")
- @Path("/getUserMsg/")
- public String getUserMsg(String param){
- String userId = Utils.getParameter("userId", param) == null ? "" : Utils.getParameter("userId", param);
- String sql = "select distinct REAL_NAME,MOBILE from SYS_USER_INFO where USER_ID='"+userId+"'";
- DbConnection dbConn = new DbConnection();//数据库连接
- Connection conn = null;
- PreparedStatement pstm = null;//sql语句的执行者
- ResultSet rs = null;//结果集
- StringBuffer sb = new StringBuffer();
-
- try {
- conn = dbConn.getConnection();
- pstm = conn.prepareStatement(sql);
- rs = pstm.executeQuery();
- while(rs.next()){
- String realName = rs.getString("REAL_NAME") == null ? "" : rs.getString("REAL_NAME");
- String phoneNum = rs.getString("MOBILE") == null ? "" : rs.getString("MOBILE");
-
- sb.append("{\"realName\":\""+realName+"\",\"phoneNum\":\""+phoneNum+"\"},");
- }
- if(sb.lastIndexOf(",") > -1){
- sb.deleteCharAt(sb.lastIndexOf(","));
- }
- } catch (SQLException e) {
- e.printStackTrace();
- } catch (ClassNotFoundException e) {
- e.printStackTrace();
- }finally{
- try {
- if(rs!=null)
- rs.close();
- if(pstm!=null)
- pstm.close();
- if(conn!=null)
- conn.close();
- } catch (SQLException e) {
- e.printStackTrace();
- }
- }
- return sb.toString();
- }
-
- /**
- * 通知单详情页面用到
- * @param param
- * @return
- */
- @POST
- @ProduceMime("application/json")
- @Path("/getHumanMsg/")
- public String getHumanMsg(String param){
- String objectId = Utils.getParameter("fd_id", param) == null ? "" : Utils.getParameter("fd_id", param);//通知单ID
- String tzdState = Utils.getParameter("isSend", param) == null ? "" : Utils.getParameter("isSend", param);//通知单状态
-
- String sql = "select top 1 PERSON_ID from ECM_EM_TREATED_HUMAN where BUSINESS_ID='"+objectId+"' and STATUES='"+tzdState+"' order by UPDATEDATE desc";
- DbConnection dbConn = new DbConnection();//数据库连接
- Connection conn = null;
- PreparedStatement pstm = null;//sql语句的执行者
- ResultSet rs = null;//结果集
- StringBuffer sb = new StringBuffer();
-
- try {
- conn = dbConn.getConnection();
- pstm = conn.prepareStatement(sql);
- rs = pstm.executeQuery();
- while(rs.next()){
- String personId = rs.getString("PERSON_ID") == null ? "" : rs.getString("PERSON_ID");
-
- sb.append("{\"personId\":\""+personId+"\"}");
- }
- if(sb.lastIndexOf(",") > -1){
- sb.deleteCharAt(sb.lastIndexOf(","));
- }
- } catch (SQLException e) {
- e.printStackTrace();
- } catch (ClassNotFoundException e) {
- e.printStackTrace();
- }finally{
- try {
- if(rs!=null)
- rs.close();
- if(pstm!=null)
- pstm.close();
- if(conn!=null)
- conn.close();
- } catch (SQLException e) {
- e.printStackTrace();
- }
- }
- return sb.toString();
- }
-
- /**
- * 通知单聚合页面用到
- * @param param
- * @return
- */
- @POST
- @ProduceMime("application/json")
- @Path("/getLetterOfNoticeInfo/")
- public String getLetterOfNoticeInfo(String param){
- String enentId = Utils.getParameter("eventId", param) == null ? "" : Utils.getParameter("eventId", param);//关联的事件ID
- String issueUnit = Utils.getParameter("deptId", param) == null ? "" : Utils.getParameter("deptId", param);//通知单登录人ID
-
- //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+"'";
- String sql = " select "+
- " event.EVENT_NAME a,"+//事件名称
- " dept.DEPT_NAME b,"+//发布单位名称
- " notice.EARLY_WARNING_NAME c,"+//预警/响应名称
- " notice.EARLY_WARNING_ID d,"+//预警/响应编号
- " notice.EARLY_WARNING_AREA_NAME e,"+//预警/响应范围
- " notice.RELEASE_RELIEVE_DATE f,"+//发布时间
- " notice.FD_OBJECTID g,"+//通知单id365
- " notice.IS_ALERT h"+//预警0或响应1
- " from "+
- " ECM_EM_PUBLISH_ALERT_NOTICE notice,"+
- " ECM_EM_EVENT_NAME event,"+
- " SYS_DEPARTMENT dept"+
- " where"+
- " ("+
- " notice.RELEASE_UNIT ='"+issueUnit+"'"+
- " or notice.RELEASE_UNIT in"+
- "( select DEPT_ID from SYS_DEPARTMENT where PARENT_ID='"+issueUnit+"' )"+
- " )"+
- " and notice.RELEASE_UNIT = DEPT_ID"+
- " and notice.EVENT_ID = '"+enentId+"'"+
- " and notice.EVENT_ID = event.FD_OBJECTID";
- DbConnection dbConn = new DbConnection();//数据库连接
- Connection conn = null;
- PreparedStatement pstm = null;//sql语句的执行者
- ResultSet rs = null;//结果集
- StringBuffer sb = new StringBuffer();
-
- try {
- conn = dbConn.getConnection();
- pstm = conn.prepareStatement(sql);
- rs = pstm.executeQuery();
- sb.append("[");
- while(rs.next()){
- String a = rs.getString("a") == null ? "" : rs.getString("a");
- String b = rs.getString("b") == null ? "" : rs.getString("b");
- String c = rs.getString("c") == null ? "" : rs.getString("c");
- String d = rs.getString("d") == null ? "" : rs.getString("d");
- String e = rs.getString("e") == null ? "" : rs.getString("e");
- String f = rs.getString("f") == null ? "" : rs.getString("f");
- String g = rs.getString("g") == null ? "" : rs.getString("g");
- String h = rs.getString("h") == null ? "" : rs.getString("h");
- sb.append("{\"eventName\":\""+a+"\","+
- "\"issueUnitName\":\""+b+"\","+
- "\"noticeName\":\""+c+"\","+
- "\"noticeNum\":\""+d+"\","+
- "\"noticeAreaName\":\""+e+"\","+
- "\"issueDate\":\""+f+"\","+
- "\"fdId365\":\""+g+"\","+
- "\"isAlert\":\""+h+"\"},");
- }
- if(sb.lastIndexOf(",") > -1){
- sb.deleteCharAt(sb.lastIndexOf(","));
- }
- sb.append("]");
- } catch (SQLException e) {
- e.printStackTrace();
- } catch (ClassNotFoundException e) {
- e.printStackTrace();
- }finally{
- try {
- if(rs!=null)
- rs.close();
- if(pstm!=null)
- pstm.close();
- if(conn!=null)
- conn.close();
- } catch (SQLException e) {
- e.printStackTrace();
- }
- }
- return sb.toString();
- }
-
- /**
- * 队伍需求退回时,查询上一处理人信息
- * @param param
- * @return
- */
- @POST
- @ProduceMime("application/json")
- @Path("/getLastPersonMsg/")
- public String getLastPersonMsg(String param){
- String fdId = Utils.getParameter("fd_id", param) == null ? "" : Utils.getParameter("fd_id", param);//需求ID
- String stat = Utils.getParameter("STATE", param) == null ? "" : Utils.getParameter("STATE", param);//状态
-
- 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";
- DbConnection dbConn = new DbConnection();//数据库连接
- Connection conn = null;
- PreparedStatement pstm = null;//sql语句的执行者
- ResultSet rs = null;//结果集
- StringBuffer sb = new StringBuffer();
-
- try {
- conn = dbConn.getConnection();
- pstm = conn.prepareStatement(sql);
- rs = pstm.executeQuery();
- while(rs.next()){
- String a = rs.getString("a") == null ? "" : rs.getString("a");
- String b = rs.getString("b") == null ? "" : rs.getString("b");
-
- sb.append("{\"name\":\""+b+"\","+
- "\"id\":\""+a+"\"},");
- }
- if(sb.lastIndexOf(",") > -1){
- sb.deleteCharAt(sb.lastIndexOf(","));
- }
- } catch (SQLException e) {
- e.printStackTrace();
- } catch (ClassNotFoundException e) {
- e.printStackTrace();
- }finally{
- try {
- if(rs!=null)
- rs.close();
- if(pstm!=null)
- pstm.close();
- if(conn!=null)
- conn.close();
- } catch (SQLException e) {
- e.printStackTrace();
- }
- }
- log.info("****"+sb.toString());
- return sb.toString();
- }
-
-
-
-
- }
|