7349503567f9b507e4e7530ce94b5617f4d03bdf.svn-base 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. package com.cockpit.service;
  2. import java.util.ArrayList;
  3. import java.util.List;
  4. import java.util.Map;
  5. import javax.ws.rs.POST;
  6. import javax.ws.rs.Path;
  7. import javax.ws.rs.ProduceMime;
  8. import net.sf.json.JSONArray;
  9. import org.slf4j.LoggerFactory;
  10. import com.cockpit.dao.CZYingjiziyuanDao;
  11. import com.cockpit.util.CockpitUtil;
  12. import com.cockpit.vo.YiJiZiYuan;
  13. import com.formaction.Utils;
  14. /**
  15. * 驾驶舱服务类--专题图表
  16. * @author zhumingyue
  17. *
  18. */
  19. @Path("/CockpitChartsService/")
  20. public class CockpitChartsService {
  21. private static final org.slf4j.Logger log = LoggerFactory.getLogger(CockpitChartsService.class);
  22. private CZYingjiziyuanDao czyDao = new CZYingjiziyuanDao();
  23. private CockpitUtil cutil = new CockpitUtil();
  24. @POST
  25. @ProduceMime("application/")
  26. @Path("/czYingjiziyuan/")
  27. public String czYingjiziyuan(String params){
  28. log.info(params);
  29. String dept_id = Utils.getParameter("dept_id", params) ;//发布单位
  30. String warning_number = Utils.getParameter("number", params);//预警响应单号
  31. if(cutil.verifyParams(dept_id) && cutil.verifyParams(warning_number)){
  32. /*String sql = "SELECT * FROM(SELECT CASE FLAG WHEN '' THEN '0' ELSE FLAG END FLAG,WARNING_NUMBER, " +
  33. "T4.DEPT_NAME,T4.PARENT_ID,T4.SORT,T2.COMP_ID, " +
  34. "T2.REPORT_ID,T2.PERSON_BD,T2.CAR_BD,T2.FADIAN_CAR_BD,T2.FADIAN_JI_BD,T2.PERSON_KQ," +
  35. "T2.CAR_KQ,T2.FADIAN_CAR_KQ,T2.FADIAN_JI_KQ,T2.DATA_TYPE,T1.REPORTER_ID,T1.APPEAR_TIME," +
  36. "T1.SEND_TIME,T1.REPORTER,ROW_NUMBER() OVER(PARTITION BY T2.COMP_ID ORDER BY APPEAR_TIME " +
  37. "DESC) AS NUM FROM NWYJ.REPORT_RECORDS T1 LEFT JOIN NWYJ.REPORT_YINGJI_ZIYUAN T2 ON " +
  38. "T1.FD_OBJECTID = T2.REPORT_ID LEFT JOIN NWYJ.REPORT_SCHEDULE T3 ON T1.REPORT_ID LIKE " +
  39. "'%'||T3.FD_OBJECTID||'%' LEFT JOIN NWYJ.SYS_DEPARTMENT T4 ON T2.COMP_ID = T4.DEPT_ID " +
  40. "WHERE REPORT_TYPE = '8' AND T2.COMP_ID <>'zj' AND APPEAR_DEL = '0' AND T1.SEND_STAT = '1' " +
  41. "AND T3.SEND_STAT = '1' AND T1.APPEAR_STAT = '1' AND WARNING_NUMBER = ? AND FLAG = ? " +
  42. "AND T4.PARENT_ID = ? OR T2.COMP_ID = ?) T1 WHERE NUM = '1' ORDER BY SORT NULLS LAST" ;*/
  43. String sql = "SELECT * FROM ( SELECT CASE FLAG WHEN '' THEN '0' ELSE FLAG END FLAG, WARNING_NUMBER , T4.DEPT_NAME , T4.PARENT_ID , T4.SORT ,"
  44. + " T3.COMP_ID , T3.REPORT_ID , T3.PERSON_BD , T3.CAR_BD , T3.FADIAN_CAR_BD , T3.FADIAN_JI_BD , T3.PERSON_KQ , T3.CAR_KQ , T3.FADIAN_CAR_KQ ,"
  45. + " T3.FADIAN_JI_KQ , T3.DATA_TYPE , T2.REPORTER_ID , T2.APPEAR_TIME , T2.SEND_TIME , T2.REPORTER ,"
  46. + " ROW_NUMBER() OVER(PARTITION BY T3.COMP_ID ORDER BY APPEAR_TIME DESC) AS NUM FROM REPORT_SCHEDULE T1 LEFT JOIN REPORT_RECORDS T2 on"
  47. + " T2.REPORT_ID LIKE '%' ||T1.FD_OBJECTID ||'%' left join REPORT_YINGJI_ZIYUAN T3 on T3.REPORT_ID = T2.FD_OBJECTID LEFT JOIN SYS_DEPARTMENT T4"
  48. + " ON T3.COMP_ID=T4.DEPT_ID where T2.REPORT_TYPE ='8' AND T1.SEND_STAT <> '0' and T3.COMP_ID <>'zj' AND T2.SEND_STAT = '1'"
  49. + " AND T2.APPEAR_STAT = '1' and T1.WARNING_NUMBER=? AND( T4.PARENT_ID = ? OR T3.COMP_ID = ?)) WHERE NUM='1' ORDER BY SORT NULLS LAST";
  50. List<YiJiZiYuan> list = new ArrayList<YiJiZiYuan>();
  51. list = czyDao.getYingjiziyuan(sql, warning_number, "0", dept_id, list);
  52. //list = czyDao.getYingjiziyuan(sql, warning_number, "1", dept_id, list);
  53. /*Map<String, YiJiZiYuan> map = null;
  54. String sql = "SELECT * FROM(SELECT FLAG,WARNING_NUMBER,T4.DEPT_NAME,T4.PARENT_ID,T4.SORT,T2.COMP_ID, " +
  55. "T2.REPORT_ID,T2.PERSON_BD,T2.CAR_BD,T2.FADIAN_CAR_BD,T2.FADIAN_JI_BD,T2.PERSON_KQ," +
  56. "T2.CAR_KQ,T2.FADIAN_CAR_KQ,T2.FADIAN_JI_KQ,T2.DATA_TYPE,T1.REPORTER_ID,T1.APPEAR_TIME," +
  57. "T1.SEND_TIME,T1.REPORTER,ROW_NUMBER() OVER(PARTITION BY T2.COMP_ID ORDER BY APPEAR_TIME " +
  58. "DESC) AS NUM FROM NWYJ.REPORT_RECORDS T1 LEFT JOIN NWYJ.REPORT_YINGJI_ZIYUAN T2 ON " +
  59. "T1.FD_OBJECTID = T2.REPORT_ID LEFT JOIN NWYJ.REPORT_SCHEDULE T3 ON T1.REPORT_ID LIKE " +
  60. "'%'||T3.FD_OBJECTID||'%' LEFT JOIN NWYJ.SYS_DEPARTMENT T4 ON T2.COMP_ID = T4.DEPT_ID " +
  61. "WHERE REPORT_TYPE = '8' AND T2.COMP_ID <>'zj' AND APPEAR_DEL = '0' AND T1.SEND_STAT = '1' " +
  62. "AND T3.SEND_STAT = '1' AND T1.APPEAR_STAT = '1' AND WARNING_NUMBER = ? AND FLAG = ? " +
  63. "AND T4.PARENT_ID = ? ) T1 WHERE NUM = '1' ORDER BY SORT NULLS LAST" ;
  64. //本地跨区查询时分开查一起返回
  65. map = czyDao.getYingjiziyuanNative(sql, warning_number, "0", dept_id);
  66. map = czyDao.getYingjiziyuanCross(sql, warning_number, "1", dept_id, map);
  67. List<YiJiZiYuan> list = cutil.mapToList(map);*/
  68. // return "{\"state\":\""+state+"\",\"total\":"+count+",\"rows\":"+data+"}";
  69. String res= "{\"rows\":"+JSONArray.fromObject(list).toString()+"}";
  70. log.info("返回结果 : "+res);
  71. return res;
  72. }
  73. return null;
  74. }
  75. }