7896c01e8a9142ba6cf66ea423023d8067bfd994.svn-base 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. package com.sinosoft.em.baobiao.xianlutingyun.service;
  2. import java.io.File;
  3. import java.io.UnsupportedEncodingException;
  4. import java.util.List;
  5. import java.util.Map;
  6. import javax.servlet.http.HttpServletRequest;
  7. import javax.servlet.http.HttpServletResponse;
  8. import javax.ws.rs.POST;
  9. import javax.ws.rs.Path;
  10. import javax.ws.rs.ProduceMime;
  11. import javax.ws.rs.core.Context;
  12. import org.apache.log4j.Logger;
  13. import org.springframework.context.support.ClassPathXmlApplicationContext;
  14. import com.formaction.Utils;
  15. import com.sinosoft.am.org.jdbcUtil.ORGTemplate;
  16. import com.sinosoft.common.word.BbzbUtil;
  17. import com.sinosoft.em.baobiao.xianlutingyun.dao.BaoBiaoDao;
  18. import com.system.configer.vo.WSClientConfigure;
  19. /*@Path("/XianlutingyunService/")*/
  20. @Path("/BaobiaozhuanbaoService/")
  21. public class BaobiaozhuanbaoService{
  22. private final Logger log = Logger.getLogger(getClass());
  23. @Context
  24. private org.apache.cxf.jaxrs.ext.MessageContext mc;
  25. @POST
  26. @ProduceMime("application/json")
  27. @Path("/getWord/")
  28. public String getWord(String params){
  29. try {
  30. params = java.net.URLDecoder.decode(params, "UTF-8");
  31. } catch (UnsupportedEncodingException e1) {
  32. e1.printStackTrace();
  33. }
  34. String dept_id = Utils.getParameter("dept_id", params) == null ? "" : Utils.getParameter("dept_id", params);
  35. //HttpServletRequest req = mc.getHttpServletRequest();
  36. // String deptId=request.getParameter("deptID")==null?"":request.getParameter("deptID");
  37. //String role_Id=request.getParameter("role_Id")==null?"":request.getParameter("role_Id");
  38. //deptId="11";
  39. //WSClientConfigure configure = (WSClientConfigure)
  40. // new ClassPathXmlApplicationContext("applicationContext.xml").getBean("WSClientConfigure");
  41. //String uploadPath = request.getSession().getServletContext().getRealPath(configure.getUploadPath());
  42. //String uploadPath1 =request.getSession().getServletContext().getContextPath()+"/upload";
  43. //uploadPath="d:\\test";
  44. //String projectDeployPath = request.getSession().getServletContext().getRealPath("");
  45. //String login_name =(String) request.getSession().getAttribute("User_Name");
  46. //String dept_id=getDeptByLogin(login_name);
  47. //BbzbUtil wu=new BbzbUtil();
  48. //File f=new File(uploadPath);
  49. //wu.getWord(uploadPath+f.separator+"outlinkmen.doc", projectDeployPath,dept_id,role_Id);
  50. /**第二段标题 电网受影响情况*/
  51. return new BaoBiaoDao().getDWQQ(dept_id);
  52. }
  53. @POST
  54. @ProduceMime("application/json")
  55. @Path("/getWord2/")
  56. public String getWord2(String params){
  57. String dept_id = Utils.getParameter("dept_id", params) == null ? "" : Utils.getParameter("dept_id", params);
  58. String EVENT_ID = Utils.getParameter("EVENT_ID", params) == null ? "" : Utils.getParameter("dept_id", params);//事件id
  59. /**获取第四段标题 响应预警*/
  60. return new BaoBiaoDao().getAlertWord(dept_id,EVENT_ID);
  61. }
  62. public String getDeptByLogin(String login_name) {
  63. String result="";
  64. 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=?";
  65. try {
  66. List<Map<String, String>>tempList=new ORGTemplate().query(sql, login_name);
  67. if(tempList!=null&&tempList.size()>0){
  68. result=tempList.get(0).get("CORP_ID");
  69. }
  70. } catch (Exception e) {
  71. e.printStackTrace();
  72. }
  73. return result;
  74. }
  75. }