package com.sinosoft.em.baobiao.xianlutingyun.service; import java.io.File; import java.io.UnsupportedEncodingException; import java.util.List; import java.util.Map; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.ws.rs.POST; import javax.ws.rs.Path; import javax.ws.rs.ProduceMime; import javax.ws.rs.core.Context; import org.apache.log4j.Logger; import org.springframework.context.support.ClassPathXmlApplicationContext; import com.formaction.Utils; import com.sinosoft.am.org.jdbcUtil.ORGTemplate; import com.sinosoft.common.word.BbzbUtil; import com.sinosoft.em.baobiao.xianlutingyun.dao.BaoBiaoDao; import com.system.configer.vo.WSClientConfigure; /*@Path("/XianlutingyunService/")*/ @Path("/BaobiaozhuanbaoService/") public class BaobiaozhuanbaoService{ private final Logger log = Logger.getLogger(getClass()); @Context private org.apache.cxf.jaxrs.ext.MessageContext mc; @POST @ProduceMime("application/json") @Path("/getWord/") public String getWord(String params){ try { params = java.net.URLDecoder.decode(params, "UTF-8"); } catch (UnsupportedEncodingException e1) { e1.printStackTrace(); } String dept_id = Utils.getParameter("dept_id", params) == null ? "" : Utils.getParameter("dept_id", params); //HttpServletRequest req = mc.getHttpServletRequest(); // String deptId=request.getParameter("deptID")==null?"":request.getParameter("deptID"); //String role_Id=request.getParameter("role_Id")==null?"":request.getParameter("role_Id"); //deptId="11"; //WSClientConfigure configure = (WSClientConfigure) // new ClassPathXmlApplicationContext("applicationContext.xml").getBean("WSClientConfigure"); //String uploadPath = request.getSession().getServletContext().getRealPath(configure.getUploadPath()); //String uploadPath1 =request.getSession().getServletContext().getContextPath()+"/upload"; //uploadPath="d:\\test"; //String projectDeployPath = request.getSession().getServletContext().getRealPath(""); //String login_name =(String) request.getSession().getAttribute("User_Name"); //String dept_id=getDeptByLogin(login_name); //BbzbUtil wu=new BbzbUtil(); //File f=new File(uploadPath); //wu.getWord(uploadPath+f.separator+"outlinkmen.doc", projectDeployPath,dept_id,role_Id); /**第二段标题 电网受影响情况*/ return new BaoBiaoDao().getDWQQ(dept_id); } @POST @ProduceMime("application/json") @Path("/getWord2/") public String getWord2(String params){ String dept_id = Utils.getParameter("dept_id", params) == null ? "" : Utils.getParameter("dept_id", params); String EVENT_ID = Utils.getParameter("EVENT_ID", params) == null ? "" : Utils.getParameter("dept_id", params);//事件id /**获取第四段标题 响应预警*/ return new BaoBiaoDao().getAlertWord(dept_id,EVENT_ID); } public String getDeptByLogin(String login_name) { String result=""; String sql="select c.corp_id,c.corp_name from sys_user_info a ,sys_department c where a.dept_id=c.dept_id and login_name=?"; try { List>tempList=new ORGTemplate().query(sql, login_name); if(tempList!=null&&tempList.size()>0){ result=tempList.get(0).get("CORP_ID"); } } catch (Exception e) { e.printStackTrace(); } return result; } }