bc08e88b972b0bb40101ffbe053c8a2ec73a9905.svn-base 40 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018
  1. package com.sinosoft.em.alert.report.manage.service;
  2. import java.io.UnsupportedEncodingException;
  3. import java.sql.SQLException;
  4. import java.text.ParseException;
  5. import java.text.SimpleDateFormat;
  6. import java.util.ArrayList;
  7. import java.util.Calendar;
  8. import java.util.Date;
  9. import java.util.HashMap;
  10. import java.util.List;
  11. import java.util.Map;
  12. import javax.servlet.http.HttpServletRequest;
  13. import javax.ws.rs.POST;
  14. import javax.ws.rs.Path;
  15. import javax.ws.rs.ProduceMime;
  16. import org.apache.log4j.Logger;
  17. import org.jfree.data.KeyedValue;
  18. import org.jfree.util.Log;
  19. import org.quartz.Job;
  20. import org.quartz.JobExecutionContext;
  21. import org.quartz.JobExecutionException;
  22. import org.springframework.web.context.request.RequestContextHolder;
  23. import org.springframework.web.context.request.ServletRequestAttributes;
  24. import com.formaction.Utils;
  25. import com.persistence.service.PersistenceFactory;
  26. import com.persistence.service.SysPersistence;
  27. import com.persistence.service.exception.PersistenceException;
  28. import com.sinosoft.am.org.jdbcUtil.ORGTemplate;
  29. import com.sinosoft.em.alert.report.manage.dao.QueryReportProgrammeDao;
  30. import com.sinosoft.em.alert.report.manage.dao.QueryReportProgrammeDaoImpl;
  31. import com.sinosoft.em.alert.report.manage.vo.ReportKV;
  32. import com.sinosoft.em.alert.report.manage.vo.ReportProgress;
  33. import com.sinosoft.em.alert.report.manage.vo.reportDept;
  34. import com.sinosoft.em.alert.report.manage.vo.reportPlan;
  35. import com.sinosoft.em.alert.report.reportInputPlan.vo.KeyValue;
  36. import com.sinosoft.em.baobiao.xianlutingyun.dao.ReportPlanDao;
  37. import com.sinosoft.lz.system.sms.dao.SmsDao;
  38. import com.sinosoft.lz.system.userFriend.dao.SendMsgDao;
  39. import com.sinosoft.lz.system.userFriend.vo.MsgInfo;
  40. import com.sysmodel.datamodel.xmlmodel.ModelFactory;
  41. import com.sysmodel.datamodel.xmlmodel.able.SysModel;
  42. import net.sf.json.JSONArray;
  43. import net.sf.json.JSONObject;
  44. @Path("/QueryReportProgrammeService/")
  45. public class QueryReportProgrammeServiceImpl implements QueryReportProgrammeService,Job {
  46. private final static Logger log = Logger.getLogger(QueryReportProgrammeServiceImpl.class);
  47. /**
  48. * 功能:查询该用户所在单位所有有关的未完成的填报要求
  49. */
  50. @POST
  51. @ProduceMime("application/json")
  52. @Path("/loadReportPlan/")
  53. public String loadReportPlan(String params) {
  54. String deptId = Utils.getParameter("deptId", params) == null ? "" : Utils
  55. .getParameter("deptId", params);
  56. String isAlert = Utils.getParameter("is_alert", params) == null ? "" : Utils
  57. .getParameter("is_alert", params);
  58. QueryReportProgrammeDao dao = new QueryReportProgrammeDaoImpl();
  59. try {
  60. List<Map<String, String>> list = dao.loadReportPlan(deptId,isAlert);
  61. return JSONArray.fromObject(list).toString();
  62. } catch (Exception e) {
  63. e.printStackTrace();
  64. }
  65. return null;
  66. }
  67. /**
  68. * 功能:查询该用户所在单位所有有关的未完成的填报要求
  69. */
  70. @POST
  71. @ProduceMime("application/json")
  72. @Path("/getEventByPlanId/")
  73. public String getEventByPlanId(String params) {
  74. String planId = Utils.getParameter("planId", params) == null ? "" : Utils
  75. .getParameter("planId", params);
  76. QueryReportProgrammeDaoImpl dao = new QueryReportProgrammeDaoImpl();
  77. String result = "";
  78. try {
  79. result = dao.getEventByPlanId(planId);
  80. } catch (Exception e) {
  81. e.printStackTrace();
  82. }
  83. return result;
  84. }
  85. /**
  86. * 查询报告详细
  87. */
  88. @SuppressWarnings({ "rawtypes", "unchecked" })
  89. @POST
  90. @ProduceMime("application/json")
  91. @Path("/loadReportInputDetail/")
  92. public String loadReportInputDetail(String params) {
  93. String tbzt = Utils.getParameter("tbzt", params) == null ? "" : Utils
  94. .getParameter("tbzt", params);//填报状态,已填报、未填报
  95. String planId = Utils.getParameter("planId", params) == null ? "" : Utils
  96. .getParameter("planId", params);//填报要求id
  97. String EARLY_WARNING_ID = Utils.getParameter("EARLY_WARNING_ID", params) == null ? "" : Utils
  98. .getParameter("EARLY_WARNING_ID", params);//预警编号
  99. String START_TIME = Utils.getParameter("START_TIME", params) == null ? "" : Utils
  100. .getParameter("START_TIME", params);//开始日期
  101. String CIRCLE_TIME = Utils.getParameter("CIRCLE_TIME", params) == null ? "" : Utils
  102. .getParameter("CIRCLE_TIME", params);//截止日期
  103. String WRITE_DATE_TYPE = Utils.getParameter("WRITE_DATE_TYPE", params) == null ? "" : Utils
  104. .getParameter("WRITE_DATE_TYPE", params);//填报类型
  105. String TEMPORARY_TIME = Utils.getParameter("TEMPORARY_TIME", params) == null ? "" : Utils
  106. .getParameter("TEMPORARY_TIME", params);//临时性
  107. String WRITE_DEPT_ID = Utils.getParameter("WRITE_DEPT_ID", params) == null ? "" : Utils
  108. .getParameter("WRITE_DEPT_ID", params);//周期性
  109. String REPORT_TYPE = Utils.getParameter("REPORT_TYPE", params) == null ? "" : Utils
  110. .getParameter("REPORT_TYPE", params);//报告类别
  111. String UPDATEDATE = Utils.getParameter("UPDATEDATE", params) == null ? "" : Utils
  112. .getParameter("UPDATEDATE", params);//更新时间---发布时间
  113. String INPUT_UNIT_ID = Utils.getParameter("INPUT_UNIT_ID", params) == null ? "" : Utils
  114. .getParameter("INPUT_UNIT_ID", params);//填报角色/单位
  115. String UNIT = Utils.getParameter("UNIT", params) == null ? "" : Utils
  116. .getParameter("UNIT", params);//本单位
  117. String ROLES = Utils.getParameter("ROLES", params) == null ? "" : Utils
  118. .getParameter("ROLES", params);//填报角色
  119. String selectDate = Utils.getParameter("selectDate", params) == null ? "" : Utils
  120. .getParameter("selectDate", params);//填报角色
  121. if(!"tbzt=".equals(tbzt)){
  122. tbzt = tbzt.split("[=]")[1];
  123. }else{
  124. tbzt = "";
  125. }
  126. String data = getBaoGaoDetail(WRITE_DATE_TYPE, CIRCLE_TIME, TEMPORARY_TIME, UPDATEDATE, selectDate, REPORT_TYPE, WRITE_DEPT_ID, INPUT_UNIT_ID, ROLES, UNIT, planId, tbzt);
  127. return data;
  128. }
  129. public String getBaoGaoDetail(String WRITE_DATE_TYPE, String CIRCLE_TIME, String TEMPORARY_TIME, String UPDATEDATE,
  130. String selectDate, String REPORT_TYPE, String WRITE_DEPT_ID, String INPUT_UNIT_ID, String ROLES, String UNIT,
  131. String planId, String tbzt){
  132. QueryReportProgrammeDaoImpl dao = new QueryReportProgrammeDaoImpl();
  133. String data = "";
  134. log.info(111);
  135. try {
  136. log.info(222);
  137. String progressTime = getProgressTime(WRITE_DATE_TYPE, CIRCLE_TIME, TEMPORARY_TIME,UPDATEDATE,selectDate);//获取计划时间
  138. log.info("progressTime==="+progressTime);
  139. ArrayList<ReportKV>reportTypes = new ArrayList<ReportKV>();
  140. reportTypes = dao.loadReportTypeName(REPORT_TYPE);//通过reportType的常量编号查询响应的报告类别名称
  141. log.info(333);
  142. String[] currProArr = progressTime.split("[|]");
  143. log.info("WRITE_DEPT_ID===="+WRITE_DEPT_ID);
  144. String[] deptIdArr = WRITE_DEPT_ID.split(",");//填报单位id
  145. SimpleDateFormat dateformat = new SimpleDateFormat("yyyy-MM-dd HH:mm");
  146. ArrayList<ReportProgress> datalist = new ArrayList<ReportProgress>();
  147. log.info("REPORT_TYPE===="+REPORT_TYPE);
  148. List<ReportProgress> deptList = dao.loadDeptById(deptIdArr,REPORT_TYPE,INPUT_UNIT_ID,UNIT,ROLES);//通过单位id获取单位名称和id的集合
  149. for (int h = 0; h < deptList.size(); h++) {//循环单位
  150. String deptId = deptList.get(h).getDeptId();
  151. String deptName = deptList.get(h).getDeptName();
  152. for (int j = 0; j < currProArr.length; j++) {//循环周期性或临时性时间
  153. String times = currProArr[j];
  154. //计划中要求有填报哪个报告类别就生成几条数据
  155. for (int i = 0; i < reportTypes.size(); i++) {//循环报告类别
  156. String proid = reportTypes.get(i).getId();
  157. List<ReportProgress> proList= dao.loadReportProgramme(deptId,planId,proid,times,REPORT_TYPE,INPUT_UNIT_ID,UNIT,WRITE_DATE_TYPE,selectDate);
  158. //判断是否填报了
  159. if(proList.size() < 1){
  160. //未填报
  161. ReportProgress pro = new ReportProgress();
  162. pro = new ReportProgress();
  163. pro.setDeptId(deptId);
  164. pro.setDeptName(deptName);
  165. //pro.setIconClass("icon_list");
  166. pro.setRESPONSIBLE_NAME_322(reportTypes.get(i).getName());
  167. pro.setPROGRAMME_TIME_322(times);
  168. //判断是否超时。
  169. /*Date curr = new Date();
  170. if(curr.after(dateformat.parse(pro.getPROGRAMME_TIME_322()))){
  171. //如果修改时间在计划时间之后则超时
  172. pro.setIS_OVERTIME_322("是");
  173. }else{
  174. pro.setIS_OVERTIME_322("否");
  175. }*/
  176. pro.setWRITER_STATE_322("未填报");
  177. if("".equals(tbzt)){//未筛选填报状态时,两者数据(未填报和已填报)都添加到datalist
  178. datalist.add(pro);
  179. }else if(!"".equals(tbzt) && tbzt.contains("1")){//若其中选择了未填报,则添加
  180. datalist.add(pro);
  181. }
  182. }else{
  183. //填报状态
  184. ReportProgress pro = proList.get(0);
  185. pro.setDeptId(deptId);
  186. pro.setDeptName(deptName);
  187. pro.setWRITER_STATE_322("已填报");
  188. pro.setRESPONSIBLE_NAME_322(reportTypes.get(i).getName());
  189. //设置计划时间
  190. pro.setPROGRAMME_TIME_322(times);
  191. /*//判断是否超时。
  192. if(pro.getUpdateTime()!=null &&
  193. dateformat.parse(pro.getUpdateTime()).after(dateformat.parse(pro.getPROGRAMME_TIME_322()))){
  194. //如果修改时间在计划时间之后则超时
  195. pro.setIS_OVERTIME_322("是");
  196. }else{
  197. pro.setIS_OVERTIME_322("否");
  198. }*/
  199. if("".equals(tbzt)){//未筛选填报状态时,两者数据(未填报和已填报)都添加到datalist
  200. datalist.add(pro);
  201. }else if(!"".equals(tbzt) && tbzt.contains("0")){//若选择了已填报,则添加
  202. datalist.add(pro);
  203. }
  204. }
  205. }
  206. }
  207. }
  208. StringBuffer tem = new StringBuffer();
  209. tem.append("{\"rows\":");
  210. tem.append(JSONArray.fromObject(datalist));
  211. tem.append("}");
  212. data = tem.toString();
  213. log.info(data);
  214. } catch (Exception e) {
  215. e.printStackTrace();
  216. }
  217. return data;
  218. }
  219. /**
  220. * 根据单位id,任务id,查询当前时段是否有上报的报告
  221. */
  222. @SuppressWarnings({ "rawtypes", "unchecked" })
  223. @POST
  224. @ProduceMime("html/text")
  225. @Path("/loadReportInputByDeptAndTaskId/")
  226. public String loadReportInputByDeptAndTaskId(String params) {
  227. String planId = Utils.getParameter("planId", params) == null ? "" : Utils
  228. .getParameter("planId", params);//填报要求id
  229. String deptId = Utils.getParameter("deptId", params) == null ? "" : Utils
  230. .getParameter("deptId", params);//填报要求id
  231. String reportType = Utils.getParameter("reportType", params) == null ? "" : Utils
  232. .getParameter("reportType", params);//填报要求id
  233. String roleId = Utils.getParameter("roleId", params) == null ? "" : Utils
  234. .getParameter("roleId", params);//填报要求id
  235. QueryReportProgrammeDaoImpl dao = new QueryReportProgrammeDaoImpl();
  236. SimpleDateFormat dateformat = new SimpleDateFormat("yyyy-MM-dd");
  237. List<Map<String, String>> list = dao.loadReportPlanById(planId);//根据计划id查询计划记录
  238. try {
  239. Map<String, String> map = list.get(0);
  240. Date exp = map.get("EXPIRATION_DATE")==null?null:dateformat.parse(map.get("EXPIRATION_DATE"));
  241. String progressTime = dao.judgeTime(dateformat.parse(map.get("START_TIME")),exp,map.get("WRITE_DATE_TYPE"),map.get("CIRCLE_TIME"),map.get("TEMPORARY_TIME"),map.get("UPDATEDATE"));
  242. String preTime = getETime(progressTime.split(",")[1],-1);// progressTime.split(",")[0];
  243. String aftTime = getETime(progressTime.split(",")[1],1);//progressTime.split(",")[2];
  244. List<String[]> list1 = dao.loadReportPlanByDeptId(preTime,aftTime,planId,deptId,reportType,roleId);
  245. if(list1.size()>0){
  246. return "true";
  247. }
  248. } catch (Exception e) {
  249. e.printStackTrace();
  250. }
  251. return "false";
  252. }
  253. /**
  254. * 获取dept_level
  255. */
  256. public String getDeptLevel(String corpId) {
  257. String sql = "select dept_level from SYS_DEPARTMENT where dept_id='"+corpId+"' ";
  258. List<Map<String, String>> list = null;
  259. String dept_level = "";
  260. try {
  261. list = new ORGTemplate().query(sql);
  262. if(list.size()==1){
  263. dept_level = list.get(0).get("DEPT_LEVEL");
  264. }
  265. } catch (SQLException e) {
  266. e.printStackTrace();
  267. }
  268. return dept_level;
  269. }
  270. /**
  271. * 查询工作动态对应角色表的角色信息
  272. */
  273. @POST
  274. @ProduceMime("application/json")
  275. @Path("/loadJBRole/")
  276. public String loadJBRole(String params) {
  277. String corpId = Utils.getParameter("corpId", params) == null ? "" : Utils
  278. .getParameter("corpId", params);//填报要求id
  279. String dept_level = getDeptLevel(corpId);
  280. String condition = " ";
  281. if("2".equals(dept_level)){
  282. condition += " where gongsi=1 ";
  283. }else if("3".equals(dept_level)){
  284. condition += " where geju=1 ";
  285. }
  286. String sql = "select ROLE_ID,ROLE_NAME from ECM_EM_GZJB_ROLE"+condition;
  287. try {
  288. List<Map<String, String>> list = new ORGTemplate().query(sql);
  289. return JSONArray.fromObject(list).toString();
  290. } catch (SQLException e) {
  291. // TODO Auto-generated catch block
  292. e.printStackTrace();
  293. }
  294. return null;
  295. }
  296. /**
  297. * 查询专业管理角色id-name
  298. * 加了应急办
  299. *
  300. */
  301. @POST
  302. @ProduceMime("application/json")
  303. @Path("/loadJBRole1/")
  304. public String loadJBRole1(String params) {
  305. String corpId = Utils.getParameter("corpId", params) == null ? "" : Utils
  306. .getParameter("corpId", params);//填报要求id
  307. String dept_level = getDeptLevel(corpId);
  308. String condition = " ";
  309. if("2".equals(dept_level)){
  310. condition += " where gongsi=1 ";
  311. }else if("3".equals(dept_level)){
  312. condition += " where geju=1 ";
  313. }
  314. String sql = "select ROLE_ID,ROLE_NAME from ECM_EM_GZJB_ROLE"+condition;
  315. try {
  316. List<Map<String, String>> list = new ORGTemplate().query(sql);
  317. Map<String, String> map = new HashMap<String, String>();
  318. for (int i = 0; i < list.size(); i++) {
  319. Map<String, String> map1 = list.get(i);
  320. map.put(map1.get("ROLE_ID"),map1.get("ROLE_NAME"));
  321. }
  322. return JSONArray.fromObject(map).toString();
  323. } catch (SQLException e) {
  324. // TODO Auto-generated catch block
  325. e.printStackTrace();
  326. }
  327. return null;
  328. }
  329. /**
  330. * 通过通知单编号和单位id查询各部门报表填报情况
  331. */
  332. @POST
  333. @ProduceMime("application/json")
  334. @Path("/loadBaoBiaoDetail/")
  335. public String loadBaoBiaoDetail(String params) {
  336. String earlyWarningId = Utils.getParameter("earlyWarningId", params) == null ? "" : Utils
  337. .getParameter("earlyWarningId", params);//预警编号
  338. String comp_id = Utils.getParameter("comp_id", params) == null ? "" : Utils
  339. .getParameter("comp_id", params);//单位id
  340. String parent_id = Utils.getParameter("parent_id", params) == null ? "" : Utils
  341. .getParameter("parent_id", params);//父单位id
  342. String sql = "select b.FD_OBJECTID , b.FILL_IN_SCHEDULE, b.ROUND_TIME , b.TEMPORARY_TIME , b.REPORT_DEPT,b.START_TIME from "
  343. + "ecm_em_publish_alert_notice a, report_schedule b where a.is_del ='0' and a.RELEASE_UNIT =? "
  344. + " and a.IS_SEND ='5' and a.CHECK_STATUS <>'43' and a.plan_type_id = ( "
  345. + "select plan_type_id from ecm_em_publish_alert_notice where is_del ='0' and (RELEASE_UNIT =? or RELEASE_UNIT =? ) and "
  346. + "EARLY_WARNING_ID=? and IS_SEND ='5' and CHECK_STATUS <>'43' ) and b.role_id ='R002105430205' and "
  347. + "b.COMP_ID =? and b.is_del ='0' and b.send_stat ='1' order by b.updatedate desc ";
  348. try {
  349. List<Map<String, String>> list = new ORGTemplate().query(sql,comp_id,parent_id,comp_id,earlyWarningId,comp_id);
  350. //先从报表填报要求表查询出相关数据
  351. String FILL_IN_SCHEDULE = "";
  352. String ROUND_TIME = "";
  353. String TEMPORARY_TIME = "";
  354. String REPORT_DEPT = "";
  355. String plan_id = "";
  356. String result = "";
  357. String START_TIME = "";
  358. if(list!=null && list.size()>0){
  359. Map<String, String> map = list.get(0);
  360. FILL_IN_SCHEDULE = map.get("FILL_IN_SCHEDULE");
  361. ROUND_TIME = map.get("ROUND_TIME");
  362. TEMPORARY_TIME = map.get("TEMPORARY_TIME");
  363. START_TIME = map.get("START_TIME");
  364. REPORT_DEPT = map.get("REPORT_DEPT");
  365. plan_id = map.get("FD_OBJECTID");
  366. String params1 = "CIRCLE_TIME="+ROUND_TIME+"&WRITE_DATE_TYPE="+FILL_IN_SCHEDULE+"&TEMPORARY_TIME="+TEMPORARY_TIME+"&WRITE_DEPT_ID="+REPORT_DEPT+"&role_id=R002105430205&planId="+plan_id+"&tbzt=tbzt=&is_zhuanbao=0&corp_id="+comp_id+"&START_TIME="+START_TIME;
  367. com.sinosoft.em.baobiao.xianlutingyun.service.QueryReportProgrammeServiceImpl quer = new com.sinosoft.em.baobiao.xianlutingyun.service.QueryReportProgrammeServiceImpl();
  368. result = quer.loadReportInputDetail(params1);
  369. }
  370. return result;
  371. } catch (SQLException e) {
  372. // TODO Auto-generated catch block
  373. e.printStackTrace();
  374. }
  375. return null;
  376. }
  377. /**
  378. * 查询部门下报告信息
  379. */
  380. /*@POST
  381. @ProduceMime("application/json")
  382. @Path("/queryReportPra/")
  383. public String queryReportPro() throws UnsupportedEncodingException {
  384. QueryReportProgrammeDao dao = new QueryReportProgrammeDaoImpl();
  385. HttpServletRequest request = ((ServletRequestAttributes)RequestContextHolder.getRequestAttributes()).getRequest();
  386. String params = request.getParameter("params");
  387. //参数顺序:部门ID,预警编号,计划时间,报告类别
  388. //打桩
  389. byte b[] =params.getBytes("ISO8859-1");
  390. params=new String(b);
  391. log.info("queryReportPra__params:"+params);
  392. String[] paramsArr = params.split(",");
  393. //填报部门id
  394. String deptId = paramsArr[0];
  395. //计划id
  396. String planId = paramsArr[1];
  397. //上一个时间
  398. //String preproTime = paramsArr[2];
  399. //当前计划时间
  400. String currprogressTime = paramsArr[2];
  401. //后一个时间
  402. //String aftProTime = paramsArr[4];
  403. //报告类别
  404. String reportType = "";
  405. String tbzt = "";
  406. if(paramsArr.length>0 && paramsArr.length==5){
  407. reportType = paramsArr[3];
  408. tbzt = paramsArr[4];
  409. }else if(paramsArr.length>0 && paramsArr.length==6){
  410. reportType = ""+paramsArr[3]+","+paramsArr[4];
  411. tbzt = paramsArr[5];
  412. }
  413. if(!"tbzt=".equals(tbzt)){
  414. tbzt = tbzt.split("[=]")[1];
  415. }else{
  416. tbzt = "";
  417. }
  418. String[] currProArr = currprogressTime.split("[|]");
  419. ArrayList<String> timeList = new ArrayList<String>();
  420. for (int i = 0; i < currProArr.length; i++) {
  421. String preproTime = getETime(currProArr[i],-1);
  422. String aftProTime = getETime(currProArr[i],1);
  423. timeList.add(preproTime+","+currProArr[i]+","+aftProTime);
  424. }
  425. try {
  426. ArrayList<ReportKV>reportTypes = new ArrayList<ReportKV>();
  427. //通过reportType的常量编号查询响应的报告类别名称
  428. reportTypes = dao.loadReportTypeName(reportType);
  429. SimpleDateFormat dateformat = new SimpleDateFormat("yyyy-MM-dd HH:mm");
  430. SimpleDateFormat dateformat1 = new SimpleDateFormat("yyyy-MM-dd");
  431. ArrayList<ReportProgress> datalist = new ArrayList<ReportProgress>();
  432. for (int j = 0; j < timeList.size(); j++) {
  433. String[] times = timeList.get(j).split(",");
  434. //计划中要求有填报哪个报告类别就生成几条数据
  435. for (int i = 0; i < reportTypes.size(); i++) {
  436. String proid = reportTypes.get(i).getId();
  437. //List<ReportProgress> proList= dao.loadReportProgramme(deptId,planId,proid,preproTime,currprogressTime,aftProTime);
  438. List<ReportProgress> proList= dao.loadReportProgramme(deptId,planId,proid,times[0],times[1],times[2], reportType,INPUT_UNIT_ID);
  439. //判断是否填报了
  440. if(proList.size() < 1){
  441. //未填报
  442. ReportProgress pro = new ReportProgress();
  443. pro = new ReportProgress();
  444. //pro.setIconClass("icon_list");
  445. pro.setRESPONSIBLE_NAME_322(reportTypes.get(i).getName());
  446. pro.setPROGRAMME_TIME_322(times[1]);
  447. //判断是否超时。
  448. Date curr = new Date();
  449. if(curr.after(dateformat.parse(pro.getPROGRAMME_TIME_322()))){
  450. //如果修改时间在计划时间之后则超时
  451. pro.setIS_OVERTIME_322("是");
  452. }else{
  453. pro.setIS_OVERTIME_322("否");
  454. }
  455. pro.setWRITER_STATE_322("未填报");
  456. if("".equals(tbzt)){
  457. datalist.add(pro);
  458. }else if(!"".equals(tbzt) && tbzt.contains("1")){
  459. datalist.add(pro);
  460. }
  461. }else{
  462. //填报状态
  463. ReportProgress pro = proList.get(0);
  464. pro.setWRITER_STATE_322("已填报");
  465. pro.setRESPONSIBLE_NAME_322(reportTypes.get(i).getName());
  466. //设置计划时间
  467. pro.setPROGRAMME_TIME_322(times[1]);
  468. //判断是否超时。
  469. if(pro.getUpdateTime()!=null &&
  470. dateformat.parse(pro.getUpdateTime()).after(dateformat.parse(pro.getPROGRAMME_TIME_322()))){
  471. //如果修改时间在计划时间之后则超时
  472. pro.setIS_OVERTIME_322("是");
  473. }else{
  474. pro.setIS_OVERTIME_322("否");
  475. }
  476. if("".equals(tbzt)){
  477. datalist.add(pro);
  478. }else if(!"".equals(tbzt) && tbzt.contains("0")){
  479. datalist.add(pro);
  480. }
  481. }
  482. }
  483. }
  484. StringBuffer tem = new StringBuffer();
  485. tem.append("{\"rows\":");
  486. tem.append(JSONArray.fromObject(datalist));
  487. tem.append("}");
  488. String data = tem.toString();
  489. log.info(data);
  490. return data;
  491. } catch (Exception e) {
  492. e.printStackTrace();
  493. }
  494. return null;
  495. }*/
  496. /**
  497. * 查询计划下部门信息
  498. */
  499. @SuppressWarnings({ "rawtypes", "unchecked" })
  500. @POST
  501. @ProduceMime("application/json")
  502. @Path("/queryReportDept/")
  503. public String queryReportDept(String params) {
  504. String planId = Utils.getParameter("planId", params) == null ? "" : Utils
  505. .getParameter("planId", params);
  506. String tbzt = Utils.getParameter("tbzt", params) == null ? "" : Utils
  507. .getParameter("tbzt", params);
  508. if("".equals(planId)){
  509. return null;
  510. }
  511. planId = planId.substring(0, planId.length()-1);
  512. Log.info("planId:"+planId);
  513. QueryReportProgrammeDao dao = new QueryReportProgrammeDaoImpl();
  514. try {
  515. List<reportDept> list = dao.loadReportDept(planId,tbzt);
  516. Map map = new HashMap();
  517. map.put("rows", list);
  518. JSONObject jsonData = JSONObject.fromObject(map);
  519. String tem = jsonData.toString();
  520. log.info("deptList:"+tem);
  521. return tem;
  522. } catch (Exception e) {
  523. e.printStackTrace();
  524. }
  525. return null;
  526. }
  527. /**
  528. * 功能:查询该用户所在单位所有未完成的填报计划
  529. */
  530. /*@POST
  531. @ProduceMime("application/json")
  532. @Path("/queryReportPlan/")
  533. public String queryReportPlan(String params) {
  534. String deptId = Utils.getParameter("deptId", params) == null ? "" : Utils
  535. .getParameter("deptId", params);
  536. String isAlert = Utils.getParameter("is_alert", params) == null ? "" : Utils
  537. .getParameter("is_alert", params);
  538. QueryReportProgrammeDao dao = new QueryReportProgrammeDaoImpl();
  539. try {
  540. List<reportPlan> list = dao.loadReportPlan(deptId,isAlert);
  541. return JSONArray.fromObject(list).toString();
  542. } catch (Exception e) {
  543. e.printStackTrace();
  544. }
  545. return null;
  546. }*/
  547. /**
  548. * 功能:计划发布后,查询该计划的所有填报部门应急办成员,并向这些成员发送短信提醒
  549. */
  550. @POST
  551. @ProduceMime("application/json")
  552. @Path("/reportPlanSendMsg/")
  553. public String sendMsg(String params) {
  554. /*String fd_id = Utils.getParameter("fd_id", params) == null ? "" : Utils
  555. .getParameter("fd_id", params);
  556. String userId = Utils.getParameter("userId", params) == null ? "" : Utils
  557. .getParameter("userId", params);*/
  558. String comp_id = Utils.getParameter("comp_id", params) == null ? "" : Utils
  559. .getParameter("comp_id", params);
  560. String reportType = Utils.getParameter("reportType", params) == null ? "" : Utils
  561. .getParameter("reportType", params);
  562. String input_dept = Utils.getParameter("input_dept", params) == null ? "" : Utils
  563. .getParameter("input_dept", params);
  564. comp_id = toFormat(comp_id);
  565. QueryReportProgrammeDao dao = new QueryReportProgrammeDaoImpl();
  566. String result = "";
  567. try {
  568. result = dao.send(/* fd_id, userId,*/ comp_id,reportType,input_dept);
  569. } catch (Exception e) {
  570. e.printStackTrace();
  571. }
  572. return result;
  573. }
  574. private String toFormat(String comp_id) {
  575. String[] arr = comp_id.split(",");
  576. StringBuffer sb = new StringBuffer();
  577. for (int i = 0; i < arr.length; i++) {
  578. sb.append("'"+arr[i]+"'");
  579. if(i!=arr.length-1){
  580. sb.append("");
  581. }
  582. }
  583. return sb.toString();
  584. }
  585. public void getBGList(){
  586. SysModel sysmodel = ModelFactory.getSysmodel();
  587. SysPersistence persistence = PersistenceFactory.getInstance(sysmodel);
  588. List<String>List=new ArrayList<String>();
  589. QueryReportProgrammeDaoImpl rpd=new QueryReportProgrammeDaoImpl();
  590. try {
  591. String sql = "select FD_OBJECTID ,PROGRAMME_NAME,START_TIME , EXPIRATION_DATE,REPORT_TYPE,"
  592. + "WRITE_DATE_TYPE,CIRCLE_TIME,TEMPORARY_TIME,IS_ALERT,WRITER,WRITE_DEPT_ID,UPDATEDATE from "
  593. + "ECM_EM_ALERT_REPORT_PLAN where IS_DEL=0 and IS_RELEASE=1 ";
  594. List<String[]> tempList;
  595. tempList = persistence.getSearchResult(99, sql.toString());
  596. log.info("tempList.size===="+tempList.size());
  597. for(int i=0;i<tempList.size();i++){
  598. String[] arr = tempList.get(i);
  599. String plan_id = arr[0];
  600. String plan_name = arr[1];
  601. String starttime = arr[2];
  602. String endtime = arr[3];
  603. String report_type = arr[4];
  604. String fill_in_schedule = arr[5];
  605. String round_time = arr[6];
  606. String temporary_time = arr[7];
  607. String is_alert = arr[8];
  608. String real_name = arr[9];
  609. String dept_ids = arr[10];
  610. String updatedate = arr[11];
  611. SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
  612. Date start_time=formatter.parse(starttime);
  613. Date end_time=formatter.parse(("".equals(endtime)||endtime==null)?formatter.format(new Date()):endtime);
  614. List<String>deptList=new ArrayList<String>();
  615. List<String[]>tabList=new ArrayList<String[]>();
  616. String[] deptsArr = dept_ids.split(",");
  617. for (String str : deptsArr) {
  618. deptList.add(str);
  619. }
  620. for (int j = 0; j < deptList.size(); j++) {
  621. if("周期性".equals(fill_in_schedule)){
  622. if(report_type.length()>1){
  623. String[] types = report_type.split(",");
  624. for (int k = 0; k < types.length; k++) {
  625. Date data=new Date();
  626. SimpleDateFormat sdf=new SimpleDateFormat("HH:mm");
  627. String curDate=sdf.format(data);
  628. if("".equals(round_time) || "NULL".equals(round_time)){
  629. continue;
  630. }
  631. int curTime=Integer.parseInt(curDate.split(":")[0])*60+Integer.parseInt(curDate.split(":")[1]);
  632. log.info("round_time==="+round_time);
  633. round_time = round_time.replace(",,", ",");
  634. int kkk = round_time.lastIndexOf(",");
  635. int ddd = round_time.length()-1;
  636. if(round_time.lastIndexOf(",")==round_time.length()-1){
  637. round_time = round_time.substring(0,round_time.length()-1);
  638. }
  639. String[] timeArr=round_time.split(";");
  640. for(int l=0;l<timeArr.length;l++){
  641. int time=Integer.parseInt(timeArr[l].split(":")[0])*60+Integer.parseInt(timeArr[l].split(":")[1]);
  642. String progressTime = rpd.judgeTime(start_time,end_time, fill_in_schedule, round_time, temporary_time,updatedate);
  643. String preproTime=progressTime.split(";")[0];
  644. SimpleDateFormat sdf1=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
  645. String currprogressTimeE=sdf1.format(new Date());
  646. SmsDao sd=new SmsDao();
  647. SendMsgDao smd = new SendMsgDao();
  648. List<String> telList = new ArrayList<String>();
  649. List<String> idList = new ArrayList<String>();
  650. List<String[]> list= getMsg(report_type, deptList.get(j));
  651. if(list==null||list.size()==0){}else{
  652. for(int r=0;r<list.size();r++){
  653. telList.add(list.get(r)[0]);
  654. idList.add(list.get(r)[1]);
  655. }
  656. }
  657. MsgInfo msg = new MsgInfo();
  658. msg.setRecivedUser(idList);
  659. msg.setSendUser("zkradmin");
  660. if(curTime-time>0&&curTime-time<=60){
  661. if(checkBG(deptList.get(j), preproTime, currprogressTimeE, types[k], plan_id)){
  662. msg.setSendMsg(plan_name+"的"+getreportTypeById(types[k])+"报告填报时间已超时,请尽快填报");
  663. //sd.saveSms("", telList, time, "", "");
  664. //saveSms(String title,List<String> recList,String time,String content,String sendId)
  665. sd.saveSms("", telList, sdf1.format(new Date()), plan_name+"的"+getreportTypeById(types[k])+"报告填报时间已超时,请尽快填报", "zkradmin");
  666. smd.saveMsg(msg);
  667. log.info("超时一个小时催报--"+plan_name+"--"+deptList.get(j)+"--"+getreportTypeById(types[k]));
  668. }
  669. }else if(curTime-time<0&&curTime-time>=-60){
  670. if(checkBG(deptList.get(j), preproTime, currprogressTimeE, report_type,plan_id)){
  671. sd.saveSms("", telList, sdf1.format(new Date()), plan_name+"的"+getreportTypeById(types[k])+"报告离填报时间还有一个小时,请尽快填报", "zkradmin");
  672. msg.setSendMsg(plan_name+"的"+getreportTypeById(types[k])+"报告离填报时间还有一个小时,请尽快填报");
  673. smd.saveMsg(msg);
  674. log.info("超时一个小时催报--"+plan_name+deptList.get(j)+"--"+"--"+getreportTypeById(types[k]));
  675. }
  676. }
  677. }
  678. }
  679. }else if(report_type.length()==1){
  680. Date data=new Date();
  681. SimpleDateFormat sdf=new SimpleDateFormat("HH:mm");
  682. String curDate=sdf.format(data);
  683. int curTime=Integer.parseInt(curDate.split(":")[0])*60+Integer.parseInt(curDate.split(":")[1]);
  684. String[] timeArr=round_time.split(";");
  685. for(int l=0;l<timeArr.length;l++){
  686. int time=Integer.parseInt(timeArr[l].split(":")[0])*60+Integer.parseInt(timeArr[l].split(":")[1]);
  687. String progressTime = rpd.judgeTime(start_time,end_time, fill_in_schedule, round_time, temporary_time,updatedate);
  688. String preproTime=progressTime.split(",")[0];
  689. SimpleDateFormat sdf1=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
  690. String currprogressTimeE=sdf1.format(new Date());
  691. SmsDao sd=new SmsDao();
  692. SendMsgDao smd = new SendMsgDao();
  693. List<String> telList = new ArrayList<String>();
  694. List<String> idList = new ArrayList<String>();
  695. List<String[]> list= getMsg(report_type, deptList.get(j));
  696. if(list==null||list.size()==0){}else{
  697. for(int r=0;r<list.size();r++){
  698. telList.add(list.get(r)[0]);
  699. idList.add(list.get(r)[1]);
  700. }
  701. }
  702. MsgInfo msg = new MsgInfo();
  703. msg.setRecivedUser(idList);
  704. msg.setSendUser("zkradmin");
  705. if(curTime-time>0&&curTime-time<=60){
  706. if(checkBG(deptList.get(j), preproTime, currprogressTimeE, report_type, plan_id)){
  707. msg.setSendMsg(plan_name+"的"+getreportTypeById(report_type)+"报告填报时间已超时,请尽快填报");
  708. //sd.saveSms("", telList, time, "", "");
  709. //saveSms(String title,List<String> recList,String time,String content,String sendId)
  710. sd.saveSms("", telList, sdf1.format(new Date()), plan_name+"的"+getreportTypeById(report_type)+"报告填报时间已超时,请尽快填报", "zkradmin");
  711. smd.saveMsg(msg);
  712. log.info("超时一个小时催报--"+plan_name+"--"+deptList.get(j)+"--"+getreportTypeById(report_type));
  713. }
  714. }else if(curTime-time<0&&curTime-time>=-60){
  715. if(checkBG(deptList.get(j), preproTime, currprogressTimeE, report_type,plan_id)){
  716. sd.saveSms("", telList, sdf1.format(new Date()), plan_name+"的"+getreportTypeById(report_type)+"报告离填报时间还有一个小时,请尽快填报", "zkradmin");
  717. msg.setSendMsg(plan_name+"的"+getreportTypeById(report_type)+"报告离填报时间还有一个小时,请尽快填报");
  718. smd.saveMsg(msg);
  719. log.info("超时一个小时催报--"+plan_name+deptList.get(j)+"--"+"--"+getreportTypeById(report_type));
  720. }
  721. }
  722. }
  723. }
  724. }else{
  725. if(report_type.length()>1){
  726. String[] types = report_type.split(",");
  727. for (int k = 0; k < types.length; k++) {
  728. Date data=new Date();
  729. SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
  730. SimpleDateFormat sdf2=new SimpleDateFormat("yyyy-MM-dd");
  731. String curDate=sdf.format(data);
  732. String curDate1=sdf2.format(data);
  733. int curTime=Integer.parseInt(curDate.split(" ")[1].split(":")[0])*60+Integer.parseInt(curDate.split(" ")[1].split(":")[1]);
  734. String[] timeArr=temporary_time.split(";");
  735. for(int l=0;l<timeArr.length;l++){
  736. if(curDate1.equals(timeArr[l].split(" ")[0])){
  737. String trueTime=timeArr[l].split(" ")[1];
  738. int time=Integer.parseInt(trueTime.split(":")[0])*60+Integer.parseInt(trueTime.split(":")[1]);
  739. String progressTime = rpd.judgeTime(start_time,end_time, fill_in_schedule, round_time, temporary_time,updatedate);
  740. String preproTime=progressTime.split(",")[0];
  741. SimpleDateFormat sdf1=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
  742. String currprogressTimeE=sdf1.format(new Date());
  743. SmsDao sd=new SmsDao();
  744. SendMsgDao smd = new SendMsgDao();
  745. List<String> telList = new ArrayList<String>();
  746. List<String> idList = new ArrayList<String>();
  747. List<String[]> list= getMsg(report_type, deptList.get(j));
  748. if(list==null||list.size()==0){}else{
  749. for(int r=0;r<list.size();r++){
  750. telList.add(list.get(r)[0]);
  751. idList.add(list.get(r)[1]);
  752. }
  753. }
  754. MsgInfo msg = new MsgInfo();
  755. msg.setRecivedUser(idList);
  756. msg.setSendUser("zkradmin");
  757. if(curTime-time>0&&curTime-time<60){
  758. if(checkBG(deptList.get(j), preproTime, currprogressTimeE, report_type,plan_id)){
  759. msg.setSendMsg(plan_name+"的"+getreportTypeById(types[k])+"报告填报时间已超时,请尽快填报");
  760. sd.saveSms("", telList, sdf1.format(new Date()), plan_name+"的"+getreportTypeById(types[k])+"报告填报时间已超时,请尽快填报", "zkradmin");
  761. smd.saveMsg(msg);
  762. log.info("提前一个小时催报--"+plan_name+"--"+getreportTypeById(types[k]));
  763. }
  764. }else if(curTime-time<0&&curTime-time>-60){
  765. if(checkBG(deptList.get(j), preproTime, currprogressTimeE, report_type,plan_id)){
  766. sd.saveSms("", telList, sdf1.format(new Date()), plan_name+"的"+getreportTypeById(types[k])+"报告离填报时间还有一个小时,请尽快填报", "zkradmin");
  767. msg.setSendMsg(plan_name+"的"+getreportTypeById(types[k])+"报告离填报时间超时还有一个小时,请尽快填报");
  768. smd.saveMsg(msg);
  769. log.info("超时一个小时催报--"+plan_name+"--"+getreportTypeById(types[k]));
  770. }
  771. }
  772. }
  773. }
  774. }
  775. }else if(report_type.length()==1){
  776. }
  777. }
  778. }
  779. SmsDao sd=new SmsDao();
  780. List<String>l=new ArrayList<String>();
  781. //l.add(mobile);
  782. //String content=name+",您好!你指定的应急演练计划:"+drill_name+"将于"+plan_time+"到达计划完成时间,特此提醒!";
  783. //sd.saveSms("应急演练计划执行提醒", l, new Date()+"", content, "zkradmin");
  784. }
  785. }catch(Exception e){
  786. this.log.error(e.getMessage(), e);
  787. }
  788. }
  789. private String getreportTypeById(String string) {
  790. String result="";
  791. SysModel sysmodel = ModelFactory.getSysmodel();
  792. SysPersistence persistence = PersistenceFactory.getInstance(sysmodel);
  793. String sql="select FD_DESCRIPTION from BM_MAPVALUECANST where fd_type='BM_AlertRespReportInputState' and fd_code='"+string+"'";
  794. try {
  795. List<String[]>tempList= persistence.getSearchResult(99, sql.toString());
  796. if(tempList==null||tempList.size()==0){
  797. }else{
  798. result=tempList.get(0)[0];
  799. log.info("report_type===="+result);
  800. }
  801. } catch (PersistenceException e) {
  802. // TODO Auto-generated catch block
  803. e.printStackTrace();
  804. return result;
  805. }
  806. return result;
  807. }
  808. public List<String[]> getMsg(String report_type,String comp_id){
  809. List<String[]>tempList=new ArrayList<String[]>();
  810. SysModel sysmodel = ModelFactory.getSysmodel();
  811. // List<String[]>tempList=new ArrayList<String[]>();
  812. SysPersistence persistence = PersistenceFactory.getInstance(sysmodel);
  813. String sql = "select a.mobile ,a.user_id,a.real_name from sys_user_info a , sys_dept_user b where "
  814. + " a.user_id = b.user_id and a.user_id in (select user_id from sys_user_role_rel where role_id in (select role_id from bm_mapforreport where"
  815. + " report_type='"+report_type+"')) and (b.dept_id ='"+comp_id+"' or b.dept_id in(select dept_id from sys_department where CORP_ID='"+comp_id+"' and dept_type='DEPT'))";
  816. log.info(sql+"===========getMsgsql");
  817. // List<String[]> telList = new ArrayList<String[]>();
  818. try {
  819. tempList= persistence.getSearchResult(99, sql.toString());
  820. if(tempList==null||tempList.size()==0){
  821. }else{
  822. return tempList;
  823. }
  824. } catch (Exception e) {
  825. e.printStackTrace();
  826. }
  827. return tempList;
  828. }
  829. /**
  830. * 解析字符串,返回相差n小时的时间
  831. * n==-1则是前一个小时,若为正数,则为后n小时
  832. * 解析16:30字符串,返回15:30字符串
  833. * @param time
  834. * @return
  835. */
  836. private String getETime(String time,int n){
  837. String time1 = time;
  838. time = time.split(" ")[1];
  839. String hour = time.substring(0,time.indexOf(":"));
  840. String minit = time.substring(time.indexOf(":"),time.length());
  841. Integer prehour = null;
  842. if("23".equals(hour) && n==1){
  843. prehour = 23;
  844. minit = ":59:59";
  845. }else{
  846. prehour = Integer.parseInt(hour)+n;
  847. }
  848. if("00".equals(hour) && n==-1){
  849. prehour = 0;
  850. minit = ":00:00";
  851. }
  852. String prehourstr = prehour<10 && prehour>=0?"0"+prehour:""+prehour;
  853. return time1.split(" ")[0] +" "+prehourstr+""+minit;
  854. }
  855. private boolean checkBG(String company_id, String preproTime,
  856. String currprogressTimeE, String report_type, String plan_id) {
  857. boolean flag=false;
  858. String sql = "select FD_OBJECTID from ECM_EM_ALERT_REPORT_INPUT where PLAN_ID='"+plan_id+"' and "
  859. + "INPUT_UNIT='"+company_id+"' and report_type='"+report_type+"' and IS_DEL=0 and OPR_STATE=1 AND UPDATEDATE BETWEEN '"+preproTime+"' AND '"+currprogressTimeE+"' ";
  860. log.info("checkBG_sql:"+sql);
  861. try {
  862. List<Map<String, String>> list1 = PersistenceFactory.getInstance(ModelFactory.getSysmodel())
  863. .getSearchResultToMap(99, sql);
  864. if(list1==null||list1.size()==0){
  865. flag=true;
  866. }else{
  867. log.info("");
  868. flag= false;
  869. }
  870. } catch (PersistenceException e) {
  871. // TODO Auto-generated catch block
  872. e.printStackTrace();
  873. }
  874. return flag;
  875. }
  876. @Override
  877. public void execute(JobExecutionContext arg0) throws JobExecutionException {
  878. getBGList();
  879. }
  880. /***
  881. * 获取计划时间
  882. * @param writeDataType
  883. * @param circleTime
  884. * @param temporaryTime
  885. * @param updatedate
  886. * @param selectDate
  887. * @return
  888. * @throws ParseException
  889. */
  890. private String getProgressTime(String writeDataType, String circleTime, String temporaryTime, String updatedate, String selectDate) throws ParseException {
  891. //计划时间
  892. String prograssTime = "";
  893. if("周期性".equals(writeDataType)){
  894. String[] cirTimeArr1 = circleTime.split(";");
  895. for (int i = 0; i < cirTimeArr1.length; i++) {
  896. if(!"".equals(cirTimeArr1[i].trim())){
  897. String timea = cirTimeArr1[i].trim();
  898. prograssTime += timea;
  899. if(i<cirTimeArr1.length-1){
  900. prograssTime += "|";
  901. }
  902. //}
  903. }
  904. }
  905. }else if("临时性".equals(writeDataType)){
  906. String[] temArr = temporaryTime.split(";");
  907. for (int i = 0; i < temArr.length; i++) {
  908. prograssTime += temArr[i];
  909. if(i<temArr.length-1){
  910. prograssTime += "|";
  911. }
  912. }
  913. }
  914. return prograssTime;
  915. }
  916. /**
  917. * 查询计划下部门信息
  918. */
  919. @SuppressWarnings({ "rawtypes", "unchecked" })
  920. @POST
  921. @ProduceMime("application/json")
  922. @Path("/queryReportSubByReportId/")
  923. public String queryReportSubByReportId(String params) {
  924. String reportId = Utils.getParameter("reportId", params) == null ? "" : Utils
  925. .getParameter("reportId", params);
  926. String sql = "select FD_OBJECTID FD_OBJECTID323,FD_OBJECTID FD_OBJECTID_323,TQZW TQZW_323,YJDT YJDT_323,REPORT_ID REPORT_ID_323 from ECM_EM_ALERT_REPORT_INPUT_SUB1 where report_id=? ";
  927. try {
  928. List<Map<String, String>> list = new ORGTemplate().query(sql, reportId);
  929. String tem = JSONArray.fromObject(list).toString();
  930. log.info("deptList:"+tem);
  931. return tem;
  932. } catch (Exception e) {
  933. e.printStackTrace();
  934. }
  935. return null;
  936. }
  937. }