e472883eef3d65f52622316362eae3ad84316e8e.svn-base 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. package com.sinosoft.am.plan.dao;
  2. import java.util.ArrayList;
  3. import java.util.List;
  4. import java.util.Map;
  5. import net.sf.json.JSONArray;
  6. import org.apache.log4j.Logger;
  7. import com.persistence.service.PersistenceFactory;
  8. import com.persistence.service.SysPersistence;
  9. import com.persistence.service.exception.PersistenceException;
  10. import com.sinosoft.am.filemanger.laws.vo.FileBean;
  11. import com.sysmodel.datamodel.xmlmodel.ModelFactory;
  12. import com.sysmodel.datamodel.xmlmodel.able.SysModel;
  13. public class getPlanInfoInitDao {
  14. private Logger log = Logger.getLogger(this.getClass());
  15. SysModel sysmodel = ModelFactory.getSysmodel();
  16. SysPersistence persistence = PersistenceFactory.getInstance(sysmodel);
  17. StringBuffer json = new StringBuffer();
  18. //应急预案新增的个数、修编个数、快要过期个数
  19. public String getPlanInfoNewAdd(String id,String startTime,String endTime){
  20. //select count(1) num,'B' from ECM_AM_YJYASERVER where updatedate between '"+startTime+"' and '"+endTime+"' and IS_DEL='0' and (UNITS='"+id+"' or UNITS in ((select dept_id from SYS_DEPARTMENT where parent_id='"+id+"')) )
  21. //select count(1) num,'B' from ECM_AM_YJYASERVER where is_del='0' and plan_biaozhi!='0' and PLAN_STAT='1' and PLAN_STAT1='1' and units='"+id+"' or UNITS in ((select dept_id from SYS_DEPARTMENT where parent_id='"+id+"') )
  22. //select count(1) num,'A' from ECM_AM_YJYASERVER where DATEDIFF(MONTH,take_date , DATE '"+startTime+"') >25 and IS_DEL='0' and (UNITS='"+id+"' or UNITS in ( (select dept_id from SYS_DEPARTMENT where parent_id='"+id+"') ) )
  23. String sql="select count(1) num, 'A' a from ECM_AM_YJYASERVER where PLAN_STAT='1' and PLAN_STAT1='1' and to_char(updatedate,'yyyy-mm-dd') between '"+startTime+"' and '"+endTime+"' and IS_DEL='0' and (UNITS='"+id+"' or UNITS in ((select dept_id from SYS_DEPARTMENT where parent_id='"+id+"')) )"
  24. + "union "
  25. + "select count(1) num, 'B' a from ECM_AM_YJYASERVER where is_del='0' and plan_biaozhi!='0' and PLAN_STAT='1' and PLAN_STAT1='1' and to_char(updatedate,'yyyy-mm-dd') between '"+startTime+"' and '"+endTime+"' and (units='"+id+"' or UNITS in ((select dept_id from SYS_DEPARTMENT where parent_id='"+id+"') ) ) "
  26. + "union "
  27. + "select count(1) num, 'C' a from ECM_AM_YJYASERVER where PLAN_STAT='1' and PLAN_STAT1='1' and DATEDIFF(MONTH,take_date ,sysdate) >25 and IS_DEL='0' and (UNITS='"+id+"' or UNITS in ( (select dept_id from SYS_DEPARTMENT where parent_id='"+id+"') ) ) ";
  28. //where is_del='0' and plan_biaozhi!='0' and PLAN_STAT='1' and PLAN_STAT1='1' and units='"+list.get(i)+"'
  29. log.info(sql);
  30. List<Map<String, String>> list = null;
  31. FileBean fb=new FileBean();
  32. try {
  33. list = PersistenceFactory.getInstance( ModelFactory.getSysmodel()).getSearchResultToMap(99, sql);
  34. } catch (PersistenceException e) {
  35. log.error(e.getMessage());
  36. }
  37. String result = "{\"rows\":" + JSONArray.fromObject(list).toString() + "}";
  38. log.info("result: ==========================================="+result);
  39. return result;
  40. }
  41. public String getUserInfo(String id,String firstPageNum,String limit) throws PersistenceException{
  42. int start = 0; int end = 0;
  43. if((Integer.parseInt(firstPageNum)-1)*Integer.parseInt(limit)>=0){
  44. start=(Integer.parseInt(firstPageNum)-1)*Integer.parseInt(limit)+1;
  45. end = Integer.parseInt(firstPageNum)*Integer.parseInt(limit);
  46. }
  47. String sql="select corp_name,USER_ID,dept_id,REAL_NAME,EMAIL,dept_name,MOBILE,dept_type,parent_id from (select c.dept_name as corp_name,"
  48. + "a.USER_ID,a.dept_id,a.REAL_NAME,a.EMAIL,b.dept_name,a.MOBILE,b.dept_type,b.parent_id,rownum rn from "
  49. + "sys_user_info a ,sys_department b,sys_department c where a.dept_id =b.dept_id and b.corp_id = c.dept_id and a.is_del ='0' "
  50. + "and b.dept_id ='"+id+"') where rn >= '"+start+"' and rn <= '"+end+"';";
  51. log.info(sql);
  52. List<Map<String, String>> list = null;
  53. FileBean fb=new FileBean();
  54. try {
  55. list = PersistenceFactory.getInstance( ModelFactory.getSysmodel()).getSearchResultToMap(99, sql);
  56. } catch (PersistenceException e) {
  57. log.error(e.getMessage());
  58. }
  59. String sql1="select c.dept_name as corp_name,a.USER_ID ,a.dept_id ,a.REAL_NAME,a.EMAIL,b.dept_id ,b.dept_name,a.MOBILE,b.dept_type,b.parent_id from"
  60. + " sys_user_info a,sys_department b,sys_department c where a.dept_id =b.dept_id and b.corp_id= c.dept_id and a.is_del ='0' and b.dept_id='"+id+"';";
  61. List<String[]>tempList= persistence.getSearchResult(99, sql1.toString());
  62. log.info("getCmpList.tempList.size===="+tempList.size());
  63. int totalPage = tempList.size();
  64. String result = "{\"pager.pageNo\":"+firstPageNum+",\"pager.totalRows\":"+totalPage+",\"rows\":" + JSONArray.fromObject(list).toString() + "}";
  65. log.info("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"+result);
  66. return result;
  67. }
  68. public String getUserInfo2(String firstPageNum,String limit,String convalue) throws PersistenceException{
  69. int start = 0; int end = 0;
  70. if((Integer.parseInt(firstPageNum)-1)*Integer.parseInt(limit)>=0){
  71. start=(Integer.parseInt(firstPageNum)-1)*Integer.parseInt(limit)+1;
  72. end = Integer.parseInt(firstPageNum)*Integer.parseInt(limit);
  73. }
  74. String sql="select corp_name,USER_ID,dept_id,REAL_NAME,EMAIL,dept_name,MOBILE,dept_type,parent_id from (select c.dept_name as corp_name,"
  75. + "a.USER_ID,a.dept_id,a.REAL_NAME,a.EMAIL,b.dept_name,a.MOBILE,b.dept_type,b.parent_id,rownum rn from "
  76. + "sys_user_info a ,sys_department b,sys_department c where a.dept_id =b.dept_id and b.corp_id = c.dept_id and a.is_del ='0' "
  77. + "and "+convalue+") where rn >= '"+start+"' and rn <= '"+end+"';";
  78. log.info(sql);
  79. List<Map<String, String>> list = null;
  80. FileBean fb=new FileBean();
  81. try {
  82. list = PersistenceFactory.getInstance( ModelFactory.getSysmodel()).getSearchResultToMap(99, sql);
  83. } catch (PersistenceException e) {
  84. log.error(e.getMessage());
  85. }
  86. String sql1="select c.dept_name as corp_name,a.USER_ID ,a.dept_id ,a.REAL_NAME,a.EMAIL,b.dept_id ,b.dept_name,a.MOBILE,b.dept_type,b.parent_id from"
  87. + " sys_user_info a,sys_department b,sys_department c where a.dept_id =b.dept_id and b.corp_id= c.dept_id and a.is_del ='0' and "+convalue+" ;";
  88. List<String[]>tempList= persistence.getSearchResult(99, sql1.toString());
  89. log.info("getCmpList.tempList.size===="+tempList.size());
  90. int totalPage = tempList.size();
  91. String result = "{\"pager.pageNo\":"+firstPageNum+",\"pager.totalRows\":"+totalPage+",\"rows\":" + JSONArray.fromObject(list).toString() + "}";
  92. log.info("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"+result);
  93. return result;
  94. }
  95. }