2f62c2ea27964cc234a3533d4a329d1802024652.svn-base 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. package com.sinosoft.em.baobiao.rcbb.service;
  2. import java.util.List;
  3. import java.util.Map;
  4. import javax.ws.rs.POST;
  5. import javax.ws.rs.Path;
  6. import javax.ws.rs.ProduceMime;
  7. import net.sf.json.JSONArray;
  8. import org.apache.log4j.Logger;
  9. import com.formaction.Utils;
  10. import com.persistence.service.PersistenceFactory;
  11. import com.persistence.service.exception.PersistenceException;
  12. import com.sinosoft.am.org.jdbcUtil.ORGTemplate;
  13. import com.sysmodel.datamodel.xmlmodel.ModelFactory;
  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 sql = "select classid from bm_mapforreport where report_type = ?";
  23. List<Map<String,String>> list = null;
  24. try {
  25. list = new ORGTemplate().query(sql, report_type);
  26. } catch (Exception e) {
  27. log.error(e.getMessage());
  28. }
  29. log.info("getReport.list.size()"+list.size());
  30. String result = "{\"rows\":" + JSONArray.fromObject(list).toString()
  31. + "}";
  32. log.info("getReport===" + result);
  33. return result;
  34. }
  35. @POST
  36. @ProduceMime("application/json")
  37. @Path("/getColumn/")
  38. public String getColumn(String params){
  39. String report_type = Utils.getParameter("report_type", params) ==null ? "" : Utils.getParameter("report_type", params) ;
  40. String sql = "select table_column from EMC_AM_REPORT_DICTIONARY where report_type=? and is_used=?";
  41. List<Map<String,String>> list = null;
  42. try {
  43. list = new ORGTemplate().query(sql, report_type,"1");
  44. } catch (Exception e) {
  45. log.error(e.getMessage());
  46. }
  47. log.info("getColumn.list.size()"+list.size());
  48. String result = "{\"rows\":" + JSONArray.fromObject(list).toString()
  49. + "}";
  50. log.info("getColumn===" + result);
  51. return result;
  52. }
  53. }