123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117 |
- package com.sinosoft.am.plan.dao;
- import java.util.ArrayList;
- import java.util.List;
- import java.util.Map;
- import net.sf.json.JSONArray;
- import org.apache.log4j.Logger;
- import com.persistence.service.PersistenceFactory;
- import com.persistence.service.SysPersistence;
- import com.persistence.service.exception.PersistenceException;
- import com.sinosoft.am.filemanger.laws.vo.FileBean;
- import com.sysmodel.datamodel.xmlmodel.ModelFactory;
- import com.sysmodel.datamodel.xmlmodel.able.SysModel;
- public class getPlanInfoInitDao {
- private Logger log = Logger.getLogger(this.getClass());
- SysModel sysmodel = ModelFactory.getSysmodel();
- SysPersistence persistence = PersistenceFactory.getInstance(sysmodel);
- StringBuffer json = new StringBuffer();
-
-
-
-
-
- //应急预案新增的个数、修编个数、快要过期个数
- public String getPlanInfoNewAdd(String id,String startTime,String endTime){
- //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+"')) )
- //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+"') )
- //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+"') ) )
- 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+"')) )"
- + "union "
- + "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+"') ) ) "
- + "union "
- + "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+"') ) ) ";
- //where is_del='0' and plan_biaozhi!='0' and PLAN_STAT='1' and PLAN_STAT1='1' and units='"+list.get(i)+"'
- log.info(sql);
- List<Map<String, String>> list = null;
- FileBean fb=new FileBean();
- try {
- list = PersistenceFactory.getInstance( ModelFactory.getSysmodel()).getSearchResultToMap(99, sql);
- } catch (PersistenceException e) {
- log.error(e.getMessage());
- }
- String result = "{\"rows\":" + JSONArray.fromObject(list).toString() + "}";
- log.info("result: ==========================================="+result);
- return result;
- }
-
- public String getUserInfo(String id,String firstPageNum,String limit) throws PersistenceException{
-
- int start = 0; int end = 0;
- if((Integer.parseInt(firstPageNum)-1)*Integer.parseInt(limit)>=0){
- start=(Integer.parseInt(firstPageNum)-1)*Integer.parseInt(limit)+1;
- end = Integer.parseInt(firstPageNum)*Integer.parseInt(limit);
- }
-
- 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,"
- + "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 "
- + "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+"') where rn >= '"+start+"' and rn <= '"+end+"';";
- log.info(sql);
- List<Map<String, String>> list = null;
- FileBean fb=new FileBean();
- try {
- list = PersistenceFactory.getInstance( ModelFactory.getSysmodel()).getSearchResultToMap(99, sql);
- } catch (PersistenceException e) {
- log.error(e.getMessage());
- }
-
- 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"
- + " 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+"';";
- List<String[]>tempList= persistence.getSearchResult(99, sql1.toString());
- log.info("getCmpList.tempList.size===="+tempList.size());
- int totalPage = tempList.size();
-
- String result = "{\"pager.pageNo\":"+firstPageNum+",\"pager.totalRows\":"+totalPage+",\"rows\":" + JSONArray.fromObject(list).toString() + "}";
-
- log.info("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"+result);
- return result;
- }
-
-
- public String getUserInfo2(String firstPageNum,String limit,String convalue) throws PersistenceException{
-
- int start = 0; int end = 0;
- if((Integer.parseInt(firstPageNum)-1)*Integer.parseInt(limit)>=0){
- start=(Integer.parseInt(firstPageNum)-1)*Integer.parseInt(limit)+1;
- end = Integer.parseInt(firstPageNum)*Integer.parseInt(limit);
- }
-
- 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,"
- + "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 "
- + "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+") where rn >= '"+start+"' and rn <= '"+end+"';";
- log.info(sql);
- List<Map<String, String>> list = null;
- FileBean fb=new FileBean();
- try {
- list = PersistenceFactory.getInstance( ModelFactory.getSysmodel()).getSearchResultToMap(99, sql);
- } catch (PersistenceException e) {
- log.error(e.getMessage());
- }
-
- 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"
- + " 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+" ;";
- List<String[]>tempList= persistence.getSearchResult(99, sql1.toString());
- log.info("getCmpList.tempList.size===="+tempList.size());
- int totalPage = tempList.size();
-
- String result = "{\"pager.pageNo\":"+firstPageNum+",\"pager.totalRows\":"+totalPage+",\"rows\":" + JSONArray.fromObject(list).toString() + "}";
-
- log.info("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"+result);
- return result;
- }
- }
|