1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180 |
- package com.sinosoft.em.baobiao.xianlutingyun.dao;
- import java.sql.Connection;
- import java.sql.PreparedStatement;
- import java.sql.ResultSet;
- import java.text.ParseException;
- import java.text.SimpleDateFormat;
- import java.util.ArrayList;
- import java.util.Arrays;
- import java.util.Calendar;
- import java.util.Collections;
- import java.util.Comparator;
- import java.util.Date;
- import java.util.HashMap;
- import java.util.List;
- import java.util.Map;
- import org.apache.log4j.Logger;
- import com.formaction.vo.Msg;
- import com.persistence.DbConnection;
- import com.persistence.service.PersistenceFactory;
- import com.persistence.service.SysPersistence;
- import com.persistence.service.exception.PersistenceException;
- import com.sinosoft.am.org.jdbcUtil.ORGTemplate;
- import com.sinosoft.cm.ex.SQLStringException;
- import com.sinosoft.em.alert.report.manage.SQLPreparedUtil;
- import com.sinosoft.em.alert.report.manage.vo.ReportKV;
- import com.sinosoft.em.alert.report.manage.vo.ReportProgress;
- import com.sinosoft.em.alert.report.manage.vo.reportDept;
- import com.sinosoft.em.baobiao.xianlutingyun.vo.ProjectNameVo;
- import com.sysmodel.datamodel.xmlmodel.ModelFactory;
- import com.sysmodel.datamodel.xmlmodel.able.SysModel;
- public class QueryReportProgrammeDaoImpl implements QueryReportProgrammeDao {
- private static SysModel sysmodel = ModelFactory.getSysmodel();
- @SuppressWarnings("unused")
- private static SysPersistence persistence = PersistenceFactory.getInstance(sysmodel);
- private final static Logger log = Logger.getLogger(QueryReportProgrammeDaoImpl.class);
- /**
- * 查询部门下报告填报信息
- */
- public List<ReportProgress> loadReportProgramme(String deptId,String planId,String reportType,
- String preproTime,String currprogressTime,String aftTime) throws Exception {
- try {
- String sql = "SELECT a.FD_OBJECTID,to_char(a.REPORT_TIME,'yyyy-mm-dd hh24:mi:ss'),b.real_name REPORTER_ID,to_char(a.appear_time,'yyyy-mm-dd hh24:mi:ss'),a.REPORT_TYPE,a.comp_id,b.user_id FROM REPORT_RECORDS a,sys_user_info b WHERE a.REPORTER_ID=b.user_id and "+
- "a.COMP_ID='"+deptId+"'"+
- " AND a.IS_DEL=0 AND a.SEND_STAT='1' AND a.appear_time>=to_char(to_date('"+currprogressTime+"','yyyy-mm-dd hh24:mi:ss')- interval '1' hour,'yyyy-mm-dd hh24:mi:ss') AND a.appear_time<=to_char(to_date('"+currprogressTime+"','yyyy-mm-dd hh24:mi:ss')+ interval '1' hour,'yyyy-mm-dd hh24:mi:ss') and a.report_type='"+reportType+"' and report_id like'%"+planId+"%' order by updatedate desc";
- log.info("loadReportProgramme_sql:"+sql);
- List<String[]> tempList = persistence.getSearchResult(99, sql.toString());
- ArrayList<ReportProgress> list = new ArrayList<ReportProgress>();
- if(tempList!=null && tempList.size()>0){
- String[] arr = tempList.get(0);
- ReportProgress pro = new ReportProgress();
- pro.setFd_object_id(arr[0]);
- pro.setWRITE_TIME_322(arr[1]);
- pro.setWRITER_322(arr[2]);
- pro.setUpdateTime(arr[3]);
- pro.setWRITER_ID_322(arr[6]);
- list.add(pro);
- }
- log.info("proList:"+list);
- return list;
-
- } catch (Exception e) {
- throw e;
- }
- }
- /**
- * 查询部门
- */
- public List<reportDept> loadReportDept(String planId,String tbzt) throws Exception {
-
- DbConnection db = new DbConnection();
- Connection conn = null;
- PreparedStatement ps = null;
- ResultSet rs = null;
- SimpleDateFormat dateformat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
- try {
- String sql = "select WRITE_DEPT_ID,EARLY_WARNING_ID,REPORT_TYPE,START_TIME,(case when "
- + "EXPIRATION_DATE='' then to_char(sysdate,'yyyy-mm-dd')||' 23:59:59' else EXPIRATION_DATE end)"
- + " as EXPIRATION_DATE,WRITE_DATE_TYPE,CIRCLE_TIME,TEMPORARY_TIME,UPDATEDATE FROM ECM_EM_ALERT_REPORT_PLAN "
- +"WHERE FD_OBJECTID='"+planId+"' AND IS_DEL=0 AND IS_RELEASE=1";
-
- log.info("loadReportProgramme_sql:"+sql);
- conn = db.getConnection();
- ps = conn.prepareStatement(sql);
- rs = ps.executeQuery();
- //填报部门ID,可以有多个,要进行字符串截取
- String deptIds = "";
- //预警编号
- String earlyWarningId = "";
- //报告类别
- String reportType = "";
- //截止日期
- Date expirationData = new Date();
- //开始日期
- Date startDate = new Date();
- //填报时间表
- String writeDataType = "";
- //周期性
- String circleTime = "";
- //临时性
- String temporaryTime = "";
- String updatedate = "";
- while(rs.next()){
- deptIds = rs.getString("WRITE_DEPT_ID");
- earlyWarningId = rs.getString("EARLY_WARNING_ID");
- reportType = rs.getString("REPORT_TYPE");
- expirationData = rs.getDate("EXPIRATION_DATE");
- writeDataType = rs.getString("WRITE_DATE_TYPE");
- circleTime = rs.getString("CIRCLE_TIME");
- temporaryTime = rs.getString("TEMPORARY_TIME");
- startDate = rs.getDate("START_TIME");
- //updatedate = rs.getString("UPDATEDATE").split(" ")[0];
- updatedate = rs.getString("UPDATEDATE");
- }
- //通过判断获取离当前时间最近的计划时间
- //String progressTime = judgeTime(startDate,expirationData, writeDataType, circleTime, temporaryTime,updatedate);
- String progressTime = getProgressTime(writeDataType, circleTime, temporaryTime,updatedate);
- String[] deptIdArr = deptIds.split(",");
- /*********打桩**********************************************/
- log.info("deptIdArr:"+Arrays.toString(deptIdArr));
- List<reportDept> depts = loadReportDeptById(deptIdArr, earlyWarningId, reportType,progressTime,planId,tbzt);
- return depts;
- } catch (Exception e) {
- throw e;
- }finally{
- rs.close();
- ps.close();
- conn.close();
- }
- }
-
- /**
- * 通过部门ID到部门表中查询出相应的部门名称
- * @param planId
- * @param tbzt
- * @throws Exception
- * **/
- public List<ReportProgress> loadDeptById(List<String> list) throws Exception{
- DbConnection db = new DbConnection();
- Connection conn = null;
- PreparedStatement ps = null;
- ResultSet rs = null;
- try {
-
- conn = db.getConnection();
- //生成sql语句中in的问号
- String inCondition =
- SQLPreparedUtil.preparePlaceHolders(list.size());
- log.info("inCondition:"+inCondition);
-
- String sql = "select DEPT_NAME,DEPT_ID FROM SYS_DEPARTMENT "+
- "WHERE DEPT_ID "+
- "IN("+inCondition+")";
- log.info("sql_write_dept:"+sql);
- ps = conn.prepareStatement(sql);
- for (int i = 0; i < list.size(); i++) {
- ps.setString(i+1,list.get(i));
- }
-
- rs = ps.executeQuery();
- //用于存储部门信息
- ArrayList<ReportProgress> depts = new ArrayList<ReportProgress>();
- while(rs.next()){
- ReportProgress dept = new ReportProgress();
- dept.setDeptId(rs.getString("DEPT_ID"));
- dept.setDeptName(rs.getString("DEPT_NAME"));
- depts.add(dept);
- }
- //部门id和部门名打桩
- log.info("depts:"+depts);
-
- return depts ;
- } catch (Exception e) {
- throw e;
- }finally{
- rs.close();
- ps.close();
- conn.close();
- }
- }
-
- /**
- * 通过部门ID到部门表中查询出相应的部门名称
- * @param planId
- * @param tbzt
- * **/
- public List<reportDept> loadReportDeptById(String[] deptIdArr,String earlyWarningId,
- String reportType,String progressTime, String planId, String tbzt) throws Exception{
- DbConnection db = new DbConnection();
- Connection conn = null;
- PreparedStatement ps = null;
- ResultSet rs = null;
- try {
-
- conn = db.getConnection();
- //生成sql语句中in的问号
- String inCondition =
- SQLPreparedUtil.preparePlaceHolders(deptIdArr.length);
- log.info("inCondition:"+inCondition);
-
- String sql = "select DEPT_NAME,DEPT_ID FROM SYS_DEPARTMENT "+
- "WHERE DEPT_ID "+
- "IN("+inCondition+")";
- log.info("sql_write_dept:"+sql);
- ps = conn.prepareStatement(sql);
- for (int i = 0; i < deptIdArr.length; i++) {
- ps.setString(i+1,deptIdArr[i]);
- }
-
- rs = ps.executeQuery();
- //用于存储部门信息
- ArrayList<reportDept> depts = new ArrayList<reportDept>();
- while(rs.next()){
- reportDept dept = new reportDept();
- dept.setID(rs.getString("DEPT_ID"));
- dept.setRESPONSIBLE_NAME_322(rs.getString("DEPT_NAME"));
- dept.setIconClass("icon_home");
- dept.setOpen(false);
- dept.setEarlyWarningId(earlyWarningId);//预警编号
- dept.setReportType(reportType);//报告类别
- //参数,查看部门下报告填报情况时所用
- dept.setParams(dept.getID()+","+planId+","+progressTime+","+dept.getReportType()+","+tbzt);
- depts.add(dept);
- }
- //部门id和部门名打桩
- log.info("depts:"+depts);
-
- return depts ;
- } catch (Exception e) {
- throw e;
- }finally{
- rs.close();
- ps.close();
- conn.close();
- }
- }
-
- /**
- * 根据单位id和预警还是响应is_alert,查询相应未完成的填报要求
- */
- public List<ProjectNameVo> loadReportPlan(String deptId,String role_id) throws Exception {
-
-
- //系统当前时间
- Long currentTime = System.currentTimeMillis();
- Date currDate = new Date(currentTime);
- SimpleDateFormat dateformat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
- SimpleDateFormat dateformat1 = new SimpleDateFormat("yyyy-MM-dd HH:mm");
- String strcurr = dateformat.format(currDate);
- String sql="";
- List<ProjectNameVo> list1 = new ArrayList<ProjectNameVo>();
- List<Map<String,String>> allList = new ArrayList<Map<String,String>>();
- List<Map<String,String>> corpList = new ArrayList<Map<String,String>>();
- List<Map<String,String>> deptList = new ArrayList<Map<String,String>>();
- List<Map<String, String>> list = new ArrayList<Map<String,String>>();
- List<String> nameList = new ArrayList<String>();
- Map<String ,ProjectNameVo> voMap = new HashMap<String,ProjectNameVo>();
- if("R002105430205".equals(role_id)||"R002105430204".equals(role_id)||"R002105430203".equals(role_id)||"R002105430202".equals(role_id)||"R002105430201".equals(role_id)||"R002105430200".equals(role_id)){//应急办角色查看本级应急办填报的计划和同级专业管理部门已发布的计划
- sql="select comp_id,project_name,warning_number,FD_OBJECTID,START_TIME,UPDATEDATE,SEND_TIME,FILL_IN_SCHEDULE,ROUND_TIME,TEMPORARY_TIME,report_dept,role_id,end_time,send_stat from REPORT_SCHEDULE where (END_TIME>=TO_CHAR(TO_DATE(?,'yyyy-mm-dd'),'yyyy-mm-dd') or END_TIME IS NULL or end_time='') and TO_CHAR(TO_DATE(START_TIME,'yyyy-mm-dd'),'yyyy-mm-dd')<=TO_CHAR(TO_DATE(?,'yyyy-mm-dd'),'yyyy-mm-dd') and ((role_id=? and comp_id=?) or (role_id <>? and send_stat='1' and comp_id=?)) and is_del='0' and send_stat='1' AND (round_time is not null or TEMPORARY_TIME is not null ) order by to_number(substr(role_id,4))";
- list=new ORGTemplate().query(sql, strcurr,strcurr,role_id,deptId,role_id,deptId);
- }else{//专业管理部门角色查看本级应急办已发布的计划和上级专业管理部门已发布的计划还有给下级的计划
- sql="select comp_id,project_name,warning_number,FD_OBJECTID,START_TIME,UPDATEDATE,SEND_TIME,FILL_IN_SCHEDULE,ROUND_TIME,TEMPORARY_TIME,report_dept,role_id,end_time,send_stat from REPORT_SCHEDULE where (END_TIME>=TO_CHAR(TO_DATE(?,'yyyy-mm-dd'),'yyyy-mm-dd') or END_TIME IS NULL or end_time='') and TO_CHAR(TO_DATE(START_TIME,'yyyy-mm-dd'),'yyyy-mm-dd')<=TO_CHAR(TO_DATE(?,'yyyy-mm-dd'),'yyyy-mm-dd') and ((role_id='R002105430205'and comp_id=? and send_stat='1' and report_dept like ?) or (role_id =? and send_stat='1' and comp_id in(select parent_id from sys_department where dept_id=?)) or(comp_id=? and role_id=?)) and send_stat='1' order by to_number(substr(role_id,4))";
- list=new ORGTemplate().query(sql, strcurr,strcurr,deptId,"%"+role_id+"%",role_id,deptId,deptId,role_id);
- }
-
-
- log.info("loadReportProgramme_sql:"+sql);
-
- try {
- for (int i = 0; i < list.size(); i++) {
- Map<String, String> map = list.get(i);
- String WRITE_DATE_TYPE = map.get("FILL_IN_SCHEDULE");//填报类型
- String send_stat= map.get("SEND_STAT");//发布状态
- if("2".equals(send_stat)){
- map.put("PROJECT_NAME", map.get("PROJECT_NAME")+"(已结束)");
- }
-
- if("周期性".equals(WRITE_DATE_TYPE)){//周期性
- String CIRCLE_TIME = map.get("ROUND_TIME");//周期性时间
- if(!"".equals(CIRCLE_TIME.trim()) && CIRCLE_TIME.indexOf("NaN")==-1){//只有当周期性时间不为空 且 没有有错误时间格式时,才添加该条数据
- String sendTime = map.get("SEND_TIME");
- String sendTime1 = "";
- if(sendTime!=null && !"".equals(sendTime)){
- sendTime1 = sendTime.split(" ")[0];
- }
- String currTime = strcurr.split(" ")[0];//年月日
- if(sendTime1.equals(currTime)){//当发布日期与当前日期处于同一日时,再判断周期性最后那个时间点是否已经超过当前时间的时间点,比如发布时间:2-7 17:30 周期性时间:8:00,17:00
- // int lastRoundTime = getLastRoundTime(CIRCLE_TIME);//取得周期性时间的最大时间的小时值
- //String currHour = strcurr.split(" ")[1].split(":")[0];
- // if(Integer.parseInt(currHour) < lastRoundTime){
-
- if("R002105430205".equals(map.get("ROLE_ID"))&& deptId.equals(map.get("COMP_ID"))){
- if(!voMap.containsKey("本级计划")){
- ProjectNameVo allVo = new ProjectNameVo();
- allVo.setName("本级计划");
- allList.add(map);
- allVo.setList(allList);
- if(!nameList.contains("本级计划")){
- nameList.add("本级计划");
- }
- voMap.put("本级计划", allVo);
- }else {
- ProjectNameVo allVo = voMap.get("本级计划");
- List<Map<String,String>> li = allVo.getList();
- li.add(map);
- allVo.setList(li);
- voMap.put("本级计划", allVo);
- }
- }
- if(!"R002105430205".equals(role_id)){
- if(checkLevel(deptId, role_id,map.get("FD_OBJECTID"))){
- if(!voMap.containsKey("上级计划")){
- ProjectNameVo corpVo = new ProjectNameVo();
- corpVo.setName("上级计划");
- corpList.add(map);
- corpVo.setList(corpList);
- if(!nameList.contains("上级计划")){
- nameList.add("上级计划");
- }
- voMap.put("上级计划", corpVo);
- }else {
- ProjectNameVo corpVo = voMap.get("上级计划");
- List<Map<String,String>> li = corpVo.getList();
- li.add(map);
- corpVo.setList(li);
- voMap.put("上级计划", corpVo);
- }
- }
-
- if(!"R002105430205".equals(map.get("ROLE_ID"))&& deptId.equals(map.get("COMP_ID"))){
- if(!voMap.containsKey("下级计划")){
- ProjectNameVo deptVo = new ProjectNameVo();
- deptVo.setName("下级计划");
- deptList.add(map);
- deptVo.setList(deptList);
- if(!nameList.contains("下级计划")){
- nameList.add("下级计划");
- }
- voMap.put("下级计划", deptVo);
- }else {
- ProjectNameVo deptVo = voMap.get("下级计划");
- List<Map<String,String>> li = deptVo.getList();
- li.add(map);
- deptVo.setList(li);
- voMap.put("下级计划", deptVo);
- }
- }
- }
- }else{
- if("R002105430205".equals(map.get("ROLE_ID"))&& deptId.equals(map.get("COMP_ID"))){
- if(!voMap.containsKey("本级计划")){
- ProjectNameVo allVo = new ProjectNameVo();
- allVo.setName("本级计划");
- allList.add(map);
- allVo.setList(allList);
- if(!nameList.contains("本级计划")){
- nameList.add("本级计划");
- }
- voMap.put("本级计划", allVo);
- }else {
- ProjectNameVo allVo = voMap.get("本级计划");
- List<Map<String,String>> li = allVo.getList();
- li.add(map);
- allVo.setList(li);
- voMap.put("本级计划", allVo);
- }
- }
-
-
- if(!"R002105430205".equals(role_id)){
- if(checkLevel(deptId, role_id,map.get("FD_OBJECTID"))){
- if(!voMap.containsKey("上级计划")){
- ProjectNameVo corpVo = new ProjectNameVo();
- corpVo.setName("上级计划");
- corpList.add(map);
- corpVo.setList(corpList);
- if(!nameList.contains("上级计划")){
- nameList.add("上级计划");
- }
- voMap.put("上级计划", corpVo);
- }else {
- ProjectNameVo corpVo = voMap.get("上级计划");
- List<Map<String,String>> li = corpVo.getList();
- li.add(map);
- corpVo.setList(li);
- voMap.put("上级计划", corpVo);
- }
- }
-
- if(!"R002105430205".equals(map.get("ROLE_ID"))&& deptId.equals(map.get("COMP_ID"))){
- if(!voMap.containsKey("下级计划")){
- ProjectNameVo deptVo = new ProjectNameVo();
- deptVo.setName("下级计划");
- deptList.add(map);
- deptVo.setList(deptList);
- if(!nameList.contains("下级计划")){
- nameList.add("下级计划");
- }
- voMap.put("下级计划", deptVo);
- }else {
- ProjectNameVo deptVo = voMap.get("下级计划");
- List<Map<String,String>> li = deptVo.getList();
- li.add(map);
- deptVo.setList(li);
- voMap.put("下级计划", deptVo);
- }
- }
- }
- }
- }
- }else{//临时性
- String TEMPORARY_TIME = map.get("TEMPORARY_TIME");
- if(TEMPORARY_TIME!=null && !"".equals(TEMPORARY_TIME.trim()) && TEMPORARY_TIME.indexOf("NaN")==-1){//只有当周期性时间不为空 且 没有有错误时间格式时,才添加该条数据
- if("R002105430205".equals(map.get("ROLE_ID"))&& deptId.equals(map.get("COMP_ID"))){
- if(!voMap.containsKey("本级计划")){
- ProjectNameVo allVo = new ProjectNameVo();
- allVo.setName("本级计划");
- allList.add(map);
- allVo.setList(allList);
- if(!nameList.contains("本级计划")){
- nameList.add("本级计划");
- }
- voMap.put("本级计划", allVo);
- }else {
- ProjectNameVo allVo = voMap.get("本级计划");
- List<Map<String,String>> li = allVo.getList();
- li.add(map);
- allVo.setList(li);
- voMap.put("本级计划", allVo);
- }
- }
-
-
- if(!"R002105430205".equals(role_id)){
-
-
- if(checkLevel(deptId, role_id,map.get("FD_OBJECTID"))){
-
- if(!voMap.containsKey("上级计划")){
- ProjectNameVo corpVo = new ProjectNameVo();
- corpVo.setName("上级计划");
- corpList.add(map);
- corpVo.setList(corpList);
- if(!nameList.contains("上级计划")){
- nameList.add("上级计划");
- }
- voMap.put("上级计划", corpVo);
- }else {
- ProjectNameVo corpVo = voMap.get("上级计划");
- List<Map<String,String>> li = corpVo.getList();
- li.add(map);
- corpVo.setList(li);
- voMap.put("上级计划", corpVo);
- }
- }
-
- if(!"R002105430205".equals(map.get("ROLE_ID"))&& deptId.equals(map.get("COMP_ID"))){
- if(!voMap.containsKey("下级计划")){
- ProjectNameVo deptVo = new ProjectNameVo();
- deptVo.setName("下级计划");
- deptList.add(map);
- deptVo.setList(deptList);
- if(!nameList.contains("下级计划")){
- nameList.add("下级计划");
- }
- voMap.put("下级计划", deptVo);
- }else {
- ProjectNameVo deptVo = voMap.get("下级计划");
- List<Map<String,String>> li = deptVo.getList();
- li.add(map);
- deptVo.setList(li);
- voMap.put("下级计划", deptVo);
- }
- }
- }
- }
- }
-
- }
-
- Collections.sort(nameList, new compareList());
- for(int k=0;k<nameList.size();k++){
- log.info(nameList.get(k)+"=====k");
- list1.add(voMap.get(nameList.get(k)));
- }
- return list1;
- } catch (Exception e) {
- e.printStackTrace();
- }
- return null;
- }
-
-
- /**
- * 根据单位id和预警还是响应is_alert,查询相应未完成的填报要求
- */
- public List<ProjectNameVo> loadReportPlan(String deptId,String role_id,String flag,String task_id) throws Exception {
- //系统当前时间
- Long currentTime = System.currentTimeMillis();
- Date currDate = new Date(currentTime);
- SimpleDateFormat dateformat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
- SimpleDateFormat dateformat1 = new SimpleDateFormat("yyyy-MM-dd HH:mm");
- String strcurr = dateformat.format(currDate);
- List<ProjectNameVo> list1 = new ArrayList<ProjectNameVo>();
- List<Map<String,String>> allList = new ArrayList<Map<String,String>>();
- List<Map<String,String>> corpList = new ArrayList<Map<String,String>>();
- List<Map<String,String>> deptList = new ArrayList<Map<String,String>>();
- List<Map<String, String>> list = new ArrayList<Map<String,String>>();
- List<String> nameList = new ArrayList<String>();
- Map<String ,ProjectNameVo> voMap = new HashMap<String,ProjectNameVo>();
- StringBuffer sb = new StringBuffer();
- if(task_id.indexOf(",")>-1){
- String[] arr = task_id.split(",");
- for (int i = 0; i < arr.length; i++) {
- sb.append("'"+arr[i]+"',");
- }
- sb.deleteCharAt(sb.lastIndexOf(","));
- }else{
- sb.append("'"+task_id+"'");
- }
- //根据任务ID查询
- String sql = "select comp_id,project_name,warning_number,FD_OBJECTID,START_TIME,UPDATEDATE,SEND_TIME,FILL_IN_SCHEDULE,ROUND_TIME,TEMPORARY_TIME,report_dept,role_id,end_time,send_stat from REPORT_SCHEDULE where fd_objectid in("+sb.toString()+")";
- log.info("loadReportProgramme_sql:"+sql);
- list = new ORGTemplate().query(sql);
-
- try {
- for (int i = 0; i < list.size(); i++) {
- Map<String, String> map = list.get(i);
- String WRITE_DATE_TYPE = map.get("FILL_IN_SCHEDULE");//填报类型
- String send_stat= map.get("SEND_STAT");//发布状态
- if("2".equals(send_stat)){
- map.put("PROJECT_NAME", map.get("PROJECT_NAME")+"(已结束)");
- }
-
- if("周期性".equals(WRITE_DATE_TYPE)){//周期性
- String CIRCLE_TIME = map.get("ROUND_TIME");//周期性时间
- if(!"".equals(CIRCLE_TIME.trim()) && CIRCLE_TIME.indexOf("NaN")==-1){//只有当周期性时间不为空 且 没有有错误时间格式时,才添加该条数据
- String sendTime = map.get("SEND_TIME");
- String sendTime1 = "";
- if(sendTime!=null && !"".equals(sendTime)){
- sendTime1 = sendTime.split(" ")[0];
- }
- String currTime = strcurr.split(" ")[0];//年月日
- if(sendTime1.equals(currTime)){//当发布日期与当前日期处于同一日时,再判断周期性最后那个时间点是否已经超过当前时间的时间点,比如发布时间:2-7 17:30 周期性时间:8:00,17:00
- // int lastRoundTime = getLastRoundTime(CIRCLE_TIME);//取得周期性时间的最大时间的小时值
- //String currHour = strcurr.split(" ")[1].split(":")[0];
- // if(Integer.parseInt(currHour) < lastRoundTime){
-
- if("R002105430205".equals(map.get("ROLE_ID"))&& deptId.equals(map.get("COMP_ID"))){
- if(!voMap.containsKey("本级计划")){
- ProjectNameVo allVo = new ProjectNameVo();
- allVo.setName("本级计划");
- allList.add(map);
- allVo.setList(allList);
- if(!nameList.contains("本级计划")){
- nameList.add("本级计划");
- }
- voMap.put("本级计划", allVo);
- }else {
- ProjectNameVo allVo = voMap.get("本级计划");
- List<Map<String,String>> li = allVo.getList();
- li.add(map);
- allVo.setList(li);
- voMap.put("本级计划", allVo);
- }
- }
- if(!"R002105430205".equals(role_id)){
- if(checkLevel(deptId, role_id,map.get("FD_OBJECTID"))){
- if(!voMap.containsKey("上级计划")){
- ProjectNameVo corpVo = new ProjectNameVo();
- corpVo.setName("上级计划");
- corpList.add(map);
- corpVo.setList(corpList);
- if(!nameList.contains("上级计划")){
- nameList.add("上级计划");
- }
- voMap.put("上级计划", corpVo);
- }else {
- ProjectNameVo corpVo = voMap.get("上级计划");
- List<Map<String,String>> li = corpVo.getList();
- li.add(map);
- corpVo.setList(li);
- voMap.put("上级计划", corpVo);
- }
- }
-
- if(!"R002105430205".equals(map.get("ROLE_ID"))&& deptId.equals(map.get("COMP_ID"))){
- if(!voMap.containsKey("下级计划")){
- ProjectNameVo deptVo = new ProjectNameVo();
- deptVo.setName("下级计划");
- deptList.add(map);
- deptVo.setList(deptList);
- if(!nameList.contains("下级计划")){
- nameList.add("下级计划");
- }
- voMap.put("下级计划", deptVo);
- }else {
- ProjectNameVo deptVo = voMap.get("下级计划");
- List<Map<String,String>> li = deptVo.getList();
- li.add(map);
- deptVo.setList(li);
- voMap.put("下级计划", deptVo);
- }
- }
- }
- }else{
- if("R002105430205".equals(map.get("ROLE_ID"))&& deptId.equals(map.get("COMP_ID"))){
- if(!voMap.containsKey("本级计划")){
- ProjectNameVo allVo = new ProjectNameVo();
- allVo.setName("本级计划");
- allList.add(map);
- allVo.setList(allList);
- if(!nameList.contains("本级计划")){
- nameList.add("本级计划");
- }
- voMap.put("本级计划", allVo);
- }else {
- ProjectNameVo allVo = voMap.get("本级计划");
- List<Map<String,String>> li = allVo.getList();
- li.add(map);
- allVo.setList(li);
- voMap.put("本级计划", allVo);
- }
- }
-
-
- if(!"R002105430205".equals(role_id)){
- if(checkLevel(deptId, role_id,map.get("FD_OBJECTID"))){
- if(!voMap.containsKey("上级计划")){
- ProjectNameVo corpVo = new ProjectNameVo();
- corpVo.setName("上级计划");
- corpList.add(map);
- corpVo.setList(corpList);
- if(!nameList.contains("上级计划")){
- nameList.add("上级计划");
- }
- voMap.put("上级计划", corpVo);
- }else {
- ProjectNameVo corpVo = voMap.get("上级计划");
- List<Map<String,String>> li = corpVo.getList();
- li.add(map);
- corpVo.setList(li);
- voMap.put("上级计划", corpVo);
- }
- }
-
- if(!"R002105430205".equals(map.get("ROLE_ID"))&& deptId.equals(map.get("COMP_ID"))){
- if(!voMap.containsKey("下级计划")){
- ProjectNameVo deptVo = new ProjectNameVo();
- deptVo.setName("下级计划");
- deptList.add(map);
- deptVo.setList(deptList);
- if(!nameList.contains("下级计划")){
- nameList.add("下级计划");
- }
- voMap.put("下级计划", deptVo);
- }else {
- ProjectNameVo deptVo = voMap.get("下级计划");
- List<Map<String,String>> li = deptVo.getList();
- li.add(map);
- deptVo.setList(li);
- voMap.put("下级计划", deptVo);
- }
- }
- }
- }
- }
- }else{//临时性
- String TEMPORARY_TIME = map.get("TEMPORARY_TIME");
- if(TEMPORARY_TIME!=null && !"".equals(TEMPORARY_TIME.trim()) && TEMPORARY_TIME.indexOf("NaN")==-1){//只有当周期性时间不为空 且 没有有错误时间格式时,才添加该条数据
- if("R002105430205".equals(map.get("ROLE_ID"))&& deptId.equals(map.get("COMP_ID"))){
- if(!voMap.containsKey("本级计划")){
- ProjectNameVo allVo = new ProjectNameVo();
- allVo.setName("本级计划");
- allList.add(map);
- allVo.setList(allList);
- if(!nameList.contains("本级计划")){
- nameList.add("本级计划");
- }
- voMap.put("本级计划", allVo);
- }else {
- ProjectNameVo allVo = voMap.get("本级计划");
- List<Map<String,String>> li = allVo.getList();
- li.add(map);
- allVo.setList(li);
- voMap.put("本级计划", allVo);
- }
- }
-
-
- if(!"R002105430205".equals(role_id)){
-
-
- if(checkLevel(deptId, role_id,map.get("FD_OBJECTID"))){
-
- if(!voMap.containsKey("上级计划")){
- ProjectNameVo corpVo = new ProjectNameVo();
- corpVo.setName("上级计划");
- corpList.add(map);
- corpVo.setList(corpList);
- if(!nameList.contains("上级计划")){
- nameList.add("上级计划");
- }
- voMap.put("上级计划", corpVo);
- }else {
- ProjectNameVo corpVo = voMap.get("上级计划");
- List<Map<String,String>> li = corpVo.getList();
- li.add(map);
- corpVo.setList(li);
- voMap.put("上级计划", corpVo);
- }
- }
-
- if(!"R002105430205".equals(map.get("ROLE_ID"))&& deptId.equals(map.get("COMP_ID"))){
- if(!voMap.containsKey("下级计划")){
- ProjectNameVo deptVo = new ProjectNameVo();
- deptVo.setName("下级计划");
- deptList.add(map);
- deptVo.setList(deptList);
- if(!nameList.contains("下级计划")){
- nameList.add("下级计划");
- }
- voMap.put("下级计划", deptVo);
- }else {
- ProjectNameVo deptVo = voMap.get("下级计划");
- List<Map<String,String>> li = deptVo.getList();
- li.add(map);
- deptVo.setList(li);
- voMap.put("下级计划", deptVo);
- }
- }
- }
- }
- }
-
- }
-
- Collections.sort(nameList, new compareList());
- for(int k=0;k<nameList.size();k++){
- log.info(nameList.get(k)+"=====k");
- list1.add(voMap.get(nameList.get(k)));
- }
- return list1;
- } catch (Exception e) {
- e.printStackTrace();
- }
- return null;
- }
-
- /**
- * 根据报告类别的常量id查询相应的报告类别名称
- */
- @Override
- public ArrayList<ReportKV> loadReportTypeName(String[] id,boolean flag) throws Exception {
- DbConnection db = new DbConnection();
- Connection conn = null;
- PreparedStatement ps = null;
- ResultSet rs = null;
- try {
- // String conditionOfReportType = "";
- // String bm = "BM_AlertRespReportInputState";
- // if(id.length==1){
- // conditionOfReportType = " FD_CODE='"+id+"'";
- // }else if(id.length()==3){
- // String[] reportArr = id.split(",");
- // conditionOfReportType = " FD_CODE in ('"+reportArr[0]+"','"+reportArr[1]+"')";
- // }
- StringBuffer condition=new StringBuffer();
- for(int i=0;i<id.length;i++){
- condition.append("'"+id[i]+"',");
- }
- if(condition.lastIndexOf(",")>-1){
- condition.deleteCharAt(condition.lastIndexOf(","));
- }
- String sql ="";
- if(flag){
- sql = "select report_name,report_type from bm_mapforreport "+
- "where report_name in("+condition.toString()+")";
- }else{
- sql = "select report_name,report_type from bm_mapforreport "+
- "where report_type in("+condition.toString()+")";
- }
-
- conn = db.getConnection();
- ps = conn.prepareStatement(sql);
- rs = ps.executeQuery();
- ArrayList<ReportKV>list = new ArrayList<ReportKV>();
- while(rs.next()){
- ReportKV rkv = new ReportKV();
- String name = rs.getString("REPORT_NAME");
- String proid = rs.getString("REPORT_TYPE");
- rkv.setId(proid);
- rkv.setName(name);
- list.add(rkv);
- }
-
- return list;
- } catch (Exception e) {
- throw e;
- }finally{
- rs.close();
- ps.close();
- conn.close();
- }
- }
- private String getProgressTime(String writeDataType, String circleTime, String temporaryTime, String updatedate) throws ParseException {
- //系统当前时间
- Long currentTime = System.currentTimeMillis();
- Date currDate = new Date(currentTime);
- //当前时间
- Calendar curr = Calendar.getInstance();
- curr.setTime(currDate);
- //日期
- String _date = ""+curr.get(Calendar.YEAR)+"-"
- +(curr.get(Calendar.MONTH)+1)+"-"+curr.get(Calendar.DATE);
- //计划时间
- String prograssTime = "";
- SimpleDateFormat dateformat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
- if("周期性".equals(writeDataType)){
- String[] cirTimeArr1 = circleTime.split(";");
- for (int i = 0; i < cirTimeArr1.length; i++) {
- if(!"".equals(cirTimeArr1[i].trim())){
- String timea = _date + " " +cirTimeArr1[i].trim()+":00";
- if(dateformat.parse(timea).after(dateformat.parse(updatedate))){//计划时间要在发布时间之后
- prograssTime += timea;
- if(i<cirTimeArr1.length-1){
- prograssTime += "|";
- }
- }
- }
- }
- }else if("临时性".equals(writeDataType)){
- String[] temArr = temporaryTime.split(";");
- for (int i = 0; i < temArr.length; i++) {
- prograssTime += temArr[i];
- if(i<temArr.length-1){
- prograssTime += "|";
- }
- }
- }
-
- return prograssTime;
- }
-
- public String judgeTime(Date startDate,Date expirationData, String writeDataType,String circleTime,
- String temporaryTime, String updatedate) throws ParseException{
- //系统当前时间
- Long currentTime = System.currentTimeMillis();
- Date currDate = new Date(currentTime);
- //当前时间
- Calendar curr = Calendar.getInstance();
- curr.setTime(currDate);
- //日期
- String _date = ""+curr.get(Calendar.YEAR)+"-"
- +(curr.get(Calendar.MONTH)+1)+"-"+curr.get(Calendar.DATE);
- //时间
- Integer _time = curr.get(Calendar.HOUR_OF_DAY);
- if(expirationData==null){
- expirationData = new Date(curr.get(Calendar.YEAR), (curr.get(Calendar.MONTH)+1),
- curr.get(Calendar.DATE));
- }
- //计划时间
- String prograssTime = ""+_date+" ";
- //当前计划时间监控的范围之开始时间
- String preProTime = _date + " 00:00";
- String aftProTime = _date + " 23:59";
- SimpleDateFormat dateformat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
- SimpleDateFormat dateformat1 = new SimpleDateFormat("yyyy-MM-dd HH:mm");
- //判断填报时间表类型
- if("周期性".equals(writeDataType)){
- if(updatedate.equals(_date)){
- String[] cirTimeArr = circleTime.split(",");
- int k = 0;
- for (int i = 0; i < cirTimeArr.length; i++) {
- String hour1 = cirTimeArr[i].substring(0,cirTimeArr[i].indexOf(":"));
- if(_time<=Integer.parseInt(hour1)){
- k = i;
- if(k != 0){ //若当前计划时间不是第一个
- preProTime = _date + " " + pretime(cirTimeArr[k]);
- }
- if(k != (cirTimeArr.length-1)){ //若当前计划时间不是最后一个
- aftProTime = _date + " " + pretime(cirTimeArr[k+1]);
- }
- }
- }
- }else{
- //如果填报时间表类型是周期性,可能存有多个时间点
- String[] cirTimeArr1 = circleTime.split(";");
- ArrayList<String> cirTimeArr = new ArrayList<String>();
- SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
- SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd");
- //计划截止时间
- Date expirationTime;
- expirationTime = sdf.parse(sdf1.format(expirationData)+" 23:59:59");/*+cirTimeArr[cirTimeArr.length-1]);*/
- if(expirationTime != null && expirationTime.before(currDate)){
- /*************/ return "";//抛出异常:当前计划已结束(过期)
- }
- for (int i = 0; i < cirTimeArr1.length; i++) {
- if(!"".equals(cirTimeArr1[i].trim())){
- cirTimeArr.add(cirTimeArr1[i].trim());
- }
- }
- //用于记录当前计划时间下标
- int k = 0;
- if(cirTimeArr.size()>1){
- //如果劈开有多个时间点,则判断哪个时间最近,取最近的时间
- //cirTimeArr.get(0)格式为16:30,需再劈开
- //数组长度
- int arrLength = cirTimeArr.size();
- //数组中第一个时间点
- String hour1 = cirTimeArr.get(0).substring(0,cirTimeArr.get(0).indexOf(":"));
- //数组中最后一个时间点
- String hour2 = cirTimeArr.get(arrLength-1).substring(0,cirTimeArr.get(arrLength-1).indexOf(":"));
- if(_time <= Integer.parseInt(hour1)){//如果在第一个时间点之前,则计划时间为第一个时间点
- k = 0;
- //第二个时间点
- aftProTime = _date + " " + pretime(cirTimeArr.get(1));
- }else if(_time >= Integer.parseInt(hour2)){//如果在最后一个时间点之后,则计划时间为最后一个时间点
- k = arrLength-1;
- //最后一个时间点
- preProTime = _date + " " + pretime(cirTimeArr.get(arrLength-1));
- }else if(Integer.parseInt(hour1) < _time && _time< Integer.parseInt(hour2)){//若是在第一个和最后一个时间点之间
- int j = 0;
- //遍历周期性时间,判断当前时间处于哪两个时间点之间
- while((j+1) <= cirTimeArr.size()-1){
- hour1 = cirTimeArr.get(j).substring(0,cirTimeArr.get(j).indexOf(":"));
- hour2 = cirTimeArr.get(j+1).substring(0,cirTimeArr.get(j+1).indexOf(":"));
- if(Integer.parseInt(hour1) <= _time && _time< Integer.parseInt(hour2)){
- if(_time < Integer.parseInt(hour2)-1){//如果在第二个计划时间-1小时之前,则第一个时间为计划时间
- k = j;
- if(k != 0){ //若当前计划时间不是第一个
- preProTime = _date + " " + pretime(cirTimeArr.get(k));
- }
- aftProTime = _date + " " + pretime(cirTimeArr.get(k+1));
- }else{
- k = j+1;
- if(k != (arrLength-1)){ //若当前计划时间不是最后一个
- aftProTime = _date + " " + pretime(cirTimeArr.get(k+1));
- }
- preProTime = _date + " " + pretime(cirTimeArr.get(k));
- }
- }
- j++;
- }
- }
- prograssTime += cirTimeArr.get(k);
-
- }else{
- //若数组中只有一个值
- prograssTime += cirTimeArr.get(0);
- }
-
- }
-
- }else if("临时性".equals(writeDataType)){
- preProTime = dateformat.format(startDate);
- aftProTime = _date + " 23:59";
- //如果填报时间表类型是临时性,临时性时间格式为:“2015-11-27 11:28,2015-12-17 10:28,2015-12-27 11:28”;
- String[] temArr = temporaryTime.split(",");
- int temArrLength = temArr.length;
- int k = 0;
- if(temArr.length>1){//两个或两个以上时间点
- if(currDate.before(dateformat1.parse(temArr[0]))){//若当前时间在第一个时间点之前,则计划时间为第一个时间,监控的结尾时间为下个时间点点前一个小时
- String aftDay = temArr[1].substring(0,10);
- String afthour = temArr[1].substring(11,13);
- aftProTime = aftDay + " " + afthour + ":00";
- }else if(currDate.after(dateformat1.parse(temArr[temArrLength-1]))){
- //若当前时间在最后时间点之后,则计划时间为最后后一个时间,监控的开始时间为上一个计划时间,监控的结尾时间为今日23点59分
- k = temArrLength-1;
- preProTime = temArr[temArrLength-2];
- }else{
- int j = 0;
- while((j+1) <= temArrLength-1){
- Date date1 = dateformat1.parse(temArr[j]);
- Date date2 = dateformat1.parse(temArr[j+1]);
- if(currDate.before(date2) && currDate.after(date1)){
- Calendar caldate2 = Calendar.getInstance();
- caldate2.setTime(date2);//date 换成已经已知的Date对象
- caldate2.add(Calendar.HOUR_OF_DAY, -1);// 第二个计划时间的前一个小时
- if(currDate.before(caldate2.getTime())){//如果在第二个计划时间-1小时之前,则第一个时间为计划时间
- k = j;
- if(k != 0){ //若当前计划时间不是第一个,则监控开始时间为k前一个计划时间
- Calendar caldate1 = Calendar.getInstance();
- caldate1.setTime(dateformat1.parse(temArr[k]));
- caldate1.add(Calendar.HOUR_OF_DAY, -1);// 前一个小时
- preProTime = dateformat1.format(caldate1.getTime());
- }
- aftProTime = dateformat1.format(caldate2.getTime());
- }else{
- k = j+1;
- if(k != (temArrLength-1)){ //若当前计划时间不是最后一个
- Calendar caldate3 = Calendar.getInstance();
- caldate3.setTime(dateformat1.parse(temArr[k+1]));
- caldate3.add(Calendar.HOUR_OF_DAY, -1);
- aftProTime = dateformat1.format(caldate3.getTime());
- }
- Calendar caldate4 = Calendar.getInstance();
- caldate4.setTime(dateformat1.parse(temArr[k]));
- caldate4.add(Calendar.HOUR_OF_DAY, -1);
- preProTime = dateformat1.format(caldate4.getTime());
- }
- }
- j++;
- }
- }
- prograssTime = temArr[k];
- }else{
- prograssTime = temArr[0];
- }
- }
- return preProTime + "," + prograssTime + "," + aftProTime;
- }
- /**
- * 解析字符串,返回前一个小时时间
- * 解析16:30字符串,返回15:30字符串
- * @param time
- * @return
- */
- private String pretime(String time){
- String hour = time.substring(0,time.indexOf(":"));
- String minit = time.substring(time.indexOf(":"),time.length());
- Integer prehour = Integer.parseInt(hour)-1;
- return prehour.toString()+""+minit;
- }
-
-
- // public static void main(String[] args) {
- // QueryReportProgrammeDaoImpl dao = new QueryReportProgrammeDaoImpl();
- // try {
- // dao.loadReportProgramme("320144176508172800000071100000");
- // } catch (Exception e) {
- //
- // e.printStackTrace();
- // }
- // }
- @Override
- public String send(/*String fd_id, String userId,*/ String comp_id) {
- Msg m = new Msg();
- String sql = "select c.real_name,c.mobile from sys_user_role_rel a,sys_dept_user b,sys_user_info c "
- + "where a.role_id='R002105430205' and a.user_id=b.user_id and b.dept_id in ("
- + comp_id+ ") and a.user_id=c.user_id";
- log.info("sendMsgToEmergencysql====" + sql);
- StringBuffer sbtel = new StringBuffer();
- StringBuffer sbname = new StringBuffer();
- StringBuffer sb = new StringBuffer();
- sbtel.append("");
- sb.append("");
- sbname.append("");
- sb.append("{\"list\":");
- try {
- List<String[]> tempList = persistence.getSearchResult(99, sql.toString());
- if (tempList == null || tempList.size() == 0) {
- } else {
- for (int i = 0; i < tempList.size(); i++) {
- sbtel.append(tempList.get(i)[1]==null?"18588592971":tempList.get(i)[1]+";");
- sbname.append(tempList.get(i)[0]+";");
- }
- }
- sb.append("\"");
- if(sbname.length()>0){
- sb.append(sbname.substring(0, sbname.length()-1));
- }
- sb.append("|");
- if(sbtel.length()>0){
- sb.append(sbtel.substring(0, sbtel.length()-1));
- }
- sb.append("\"}");
- } catch (PersistenceException e) {
-
- e.printStackTrace();
- }
-
- return sb.toString();
- }
- @Override
- public List<reportDept> loadReportDeptById(String[] deptIdArr,
- String earlyWarningId, String reportType, String progressTime,
- String planId) throws Exception {
-
- return null;
- }
- public List<Map<String, String>> loadReportPlanById(String planId){
- String sql = "select FD_OBJECTID,EARLY_WARNING_ID,PROGRAMME_NAME,START_TIME,EXPIRATION_DATE,REPORT_TYPE,WRITE_DEPT_ID,WRITE_DATE_TYPE,CIRCLE_TIME,TEMPORARY_TIME,WRITER,WRITE_TIME,INPUT_DEPT,EARLY_WARNING_NAME,UPDATEDATE,IS_DEL,WRITE_DEPT_NAME,IS_RELEASE,IS_ALERT,EARLY_WARNING,USER_ID from ECM_EM_ALERT_REPORT_PLAN where FD_OBJECTID='"+planId+"'";
- try {
- List<Map<String, String>> list = PersistenceFactory.getInstance(ModelFactory.getSysmodel()).getSearchResultToMap(320, sql);
- return list;
- } catch (PersistenceException e) {
-
- e.printStackTrace();
- }
- return null;
-
- }
- public List<String[]> loadReportPlanByDeptId(String preTime,
- String aftTime, String planId, String deptId, String reportType) {
- String sql = "select FD_OBJECTID from ECM_EM_ALERT_REPORT_INPUT where PLAN_ID='"+planId+"' and INPUT_UNIT='"+deptId+"' and IS_RELEASE=1 and UPDATEDATE between '"+preTime+"' and '"+aftTime+"' and is_del=0 and report_type='"+reportType+"'";
- try {
- List<String[]> tempList = persistence.getSearchResult(99, sql.toString());
- return tempList;
- } catch (PersistenceException e) {
-
- e.printStackTrace();
- }
- return null;
- }
-
- public int getLastRoundTime(String params){
- if(params!=null || !"".equals(params)){
- if(params.indexOf(";")==-1 && params.indexOf(":")>0){
- return Integer.parseInt(params.split(":")[0]);
- }else{
- String[] timeArr = params.split(";");
- int num = 0;
- for(int i=0;i<timeArr.length;i++){
- int hour = Integer.parseInt(timeArr[i].split(":")[0]);
- if(num<hour){
- num = hour;
- }
- }
- return num;
- }
- }
- return 0;
- }
-
-
- public boolean checkLevel(String compId,String roleId,String fd_id){
- String sql = "select report_dept from report_schedule where comp_id in (select parent_id from sys_department where dept_id =?) and report_dept like ? and send_stat = '1' and role_id = ? and sysdate >= to_char(to_date(start_time,'yyyy-mm-dd hh24:mi:ss')) AND FD_OBJECTID=?";
- boolean flag = false;
- try {
- List<String> list = new ORGTemplate().getResultList(sql, compId,"%"+compId+"%",roleId,fd_id);
- if(list!=null&&list.size()>0){
- flag = true;
- }
- } catch (SQLStringException e) {
-
- e.printStackTrace();
- }
-
- return flag;
- }
-
- }
- class compareList implements Comparator<String>{
- @Override
- public int compare(String o1, String o2) {
- int i = o1.compareTo(o2);
- if(i==0){
- return 0;
- }else if(i>0){
- return 1;
- }else{
-
- //return -1;
- if(o1.equals("本级计划") && !o2.equals("上级计划")|| o2.equals("本级计划")&&!o1.equals("上级计划")){
- return 1;
- }else{
- return -1;
- }
-
- }
- }
-
- }
|