3130f2b4bb7878d1765cf7b98d695ac3d324b68d.svn-base 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. package com.sinosoft.em.baobiao.xianlutingyun.service;
  2. import java.sql.SQLException;
  3. import java.util.List;
  4. import java.util.Map;
  5. import java.util.Set;
  6. import javax.ws.rs.POST;
  7. import javax.ws.rs.Path;
  8. import javax.ws.rs.ProduceMime;
  9. import net.sf.json.JSONArray;
  10. import org.apache.log4j.Logger;
  11. import com.formaction.Utils;
  12. import com.sinosoft.am.org.jdbcUtil.ORGTemplate;
  13. import com.sinosoft.lz.system.AppContext;
  14. @Path("/ExportExcelService/")
  15. public class ExportExcelServiceImpl implements ExportExcelService {
  16. private final Logger log = Logger.getLogger(getClass());
  17. @POST
  18. @ProduceMime("application/json")
  19. @Path("/getReportClassId/")
  20. public String getReport(String params){
  21. String report_type = Utils.getParameter("report_type", params)==null ?"": Utils.getParameter("report_type", params);
  22. String logname = Utils.getParameter("logname", params)==null ?"": Utils.getParameter("logname", params);
  23. String sql = "select REPORT_TYPE from bm_mapforreport where report_type = ?";
  24. //Set userSet = AppContext.getInstance().getLoginUserMap().keySet();
  25. /* if(userSet.contains(logname)){*/
  26. List<Map<String,String>> list = null;
  27. try {
  28. list = new ORGTemplate().query(sql, report_type);
  29. } catch (SQLException e) {
  30. e.printStackTrace();
  31. }
  32. log.info("getReport.list.size()"+list.size());
  33. String result = "{\"rows\":" + JSONArray.fromObject(list).toString()
  34. + "}";
  35. log.info("getReport===" + result);
  36. return result;
  37. /*}
  38. return null;*/
  39. }
  40. @POST
  41. @ProduceMime("application/json")
  42. @Path("/getColumn/")
  43. public String getColumn(String params){
  44. String report_type = Utils.getParameter("report_type", params) ==null ? "" : Utils.getParameter("report_type", params) ;
  45. String dept_level = Utils.getParameter("dept_level", params) ==null ? "" : Utils.getParameter("dept_level", params) ;
  46. String role_id = Utils.getParameter("role_id", params) ==null ? "" : Utils.getParameter("role_id", params) ;
  47. //String logname = Utils.getParameter("logname", params) ==null ? "" : Utils.getParameter("logname", params) ;
  48. //Set userSet = AppContext.getInstance().getLoginUserMap().keySet();
  49. /* if(userSet.contains(logname)){*/
  50. String sql;
  51. if("R002105430210".equals(role_id) && Integer.valueOf(dept_level)>=3){
  52. sql = "select table_column from EMC_AM_REPORT_DICTIONARY where report_type = ? and is_used = ? union select table_column from EMC_AM_REPORT_DICTIONARY where report_type = '"+report_type+"' and table_head in ('500KV线路','220KV线路')";
  53. }else if("R002105430211".equals(role_id) && "5".equals(dept_level)){
  54. sql = "select table_column from EMC_AM_REPORT_DICTIONARY where report_type = ? and is_used = ? union select table_column from EMC_AM_REPORT_DICTIONARY where report_type = '"+report_type+"' and table_head in ('500KV','220KV','110KV')";
  55. }else{
  56. sql = "select table_column from EMC_AM_REPORT_DICTIONARY where report_type= ? and is_used= ?";
  57. }
  58. List<Map<String,String>> list = null;
  59. try {
  60. list = new ORGTemplate().query(sql, report_type,"1");
  61. } catch (SQLException e) {
  62. e.printStackTrace();
  63. }
  64. log.info("getColumn.list.size()"+list.size());
  65. String result = "{\"rows\":" + JSONArray.fromObject(list).toString()
  66. + "}";
  67. log.info("getColumn===" + result);
  68. return result;
  69. /* }
  70. return null;*/
  71. }
  72. }