d7ca74159d36385a27d3d26dc6576a59cb272779.svn-base 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397
  1. package com.sinosoft.lz.system.menu.dao;
  2. import java.sql.SQLException;
  3. import java.util.ArrayList;
  4. import java.util.HashMap;
  5. import java.util.List;
  6. import java.util.Map;
  7. import net.sf.json.JSONArray;
  8. import org.apache.log4j.Logger;
  9. import com.sinosoft.am.org.jdbcUtil.ORGTemplate;
  10. import com.sinosoft.lz.system.menu.vo.NoticeVo;
  11. public class NoticeDao {
  12. private final Logger log = Logger.getLogger(getClass());
  13. public String getNotice(String params) throws ClassNotFoundException{
  14. // System.out.println("**********///////////***********"+params);
  15. /*String sql = "select A.FD_OBJECTID ,A.EARLY_WARNING_NAME,A.WRITE_TIME ,B.DEPT_NAME , A.CURRENT_EW_LEVEL , A.CURRENT_ER_LEVEL ,A.IS_ALERT "+
  16. "from ECM_EM_PUBLISH_ALERT_NOTICE A,SYS_DEPARTMENT B "+
  17. "where is_alert='0' AND A.RELEASE_UNIT IN "+
  18. "(select corp_id from sys_department where ( parent_id='"+params+"' or corp_id='"+params+"') and dept_type=1 "+
  19. "union select parent_id from sys_department where dept_id='"+params+"' ) AND "+
  20. "write_time IN (SELECT MAX(WRITE_TIME) FROM ECM_EM_PUBLISH_ALERT_NOTICE WHERE IS_ALERT='0' AND IS_SEND='5') AND IS_SEND='5' "+
  21. "UNION "+
  22. "select A.FD_OBJECTID ,A.EARLY_WARNING_NAME,A.WRITE_TIME, B.DEPT_NAME , A.CURRENT_EW_LEVEL , A.CURRENT_ER_LEVEL ,A.IS_ALERT "+
  23. "from ECM_EM_PUBLISH_ALERT_NOTICE A,SYS_DEPARTMENT B "+
  24. "where is_alert='1' AND A.RELEASE_UNIT IN "+
  25. "(select corp_id from sys_department where ( parent_id='"+params+"' or corp_id='"+params+"') and dept_type=1 "+
  26. "union select parent_id from sys_department where dept_id='"+params+"' )AND "+
  27. " write_time IN (SELECT MAX(WRITE_TIME) FROM ECM_EM_PUBLISH_ALERT_NOTICE WHERE IS_ALERT='1' AND IS_SEND='5') AND IS_SEND='5' " ;*/
  28. String sql = " select A.FD_OBJECTID , A.EARLY_WARNING_NAME, A.RELEASE_RELIEVE_DATE , B.CORP_NAME , A.CURRENT_EW_LEVEL , A.CURRENT_ER_LEVEL , A.IS_ALERT " +
  29. " from ECM_EM_PUBLISH_ALERT_NOTICE A, SYS_DEPARTMENT B " +
  30. " where A.is_alert ='0' AND A.RELEASE_RELIEVE_DATE IN " +
  31. " (SELECT MAX(RELEASE_RELIEVE_DATE) FROM ECM_EM_PUBLISH_ALERT_NOTICE C " +
  32. " WHERE C.IS_ALERT='0' AND C.IS_SEND ='5' and " +
  33. " RELEASE_UNIT IN (select corp_id from sys_department " +
  34. " where (parent_id='" +params+ "' or corp_id='" +params+ "' ) and dept_type='1' " +
  35. " union " +
  36. " select parent_id from sys_department where dept_id='" +params+ "') " +
  37. " )AND A.IS_SEND='5' AND A.RELEASE_UNIT=B.dept_id " +
  38. " UNION " +
  39. " select A.FD_OBJECTID , A.EARLY_WARNING_NAME, A.RELEASE_RELIEVE_DATE , B.CORP_NAME , A.CURRENT_EW_LEVEL , A.CURRENT_ER_LEVEL ,A.IS_ALERT " +
  40. " from ECM_EM_PUBLISH_ALERT_NOTICE A, SYS_DEPARTMENT B " +
  41. " where A.is_alert ='1' AND A.RELEASE_RELIEVE_DATE IN " +
  42. " (SELECT MAX(RELEASE_RELIEVE_DATE) FROM ECM_EM_PUBLISH_ALERT_NOTICE C " +
  43. " WHERE C.IS_ALERT='1' AND C.IS_SEND ='5' and " +
  44. " RELEASE_UNIT IN (select corp_id from sys_department " +
  45. " where (parent_id='" +params+ "' or corp_id='" +params+ "')and dept_type='1' " +
  46. " union " +
  47. " select parent_id from sys_department where dept_id='" +params+ "') " +
  48. " )AND A.IS_SEND='5' AND A.RELEASE_UNIT=B.dept_id " ;
  49. List<NoticeVo> list2 = new ArrayList<NoticeVo>();
  50. try {
  51. List<Map<String,String>> list = new ORGTemplate().query(sql);
  52. for(int i=0;i<list.size();i++){
  53. Map<String,String> map = list.get(i);
  54. NoticeVo vo = new NoticeVo();
  55. vo.setCorpName(map.get("CORP_NAME"));
  56. vo.setFd_objectid(map.get("FD_OBJECTID"));
  57. vo.setIsAlert(map.get("IS_ALERT"));
  58. vo.setWarningName(map.get("EARLY_WARNING_NAME"));
  59. vo.setWriteTime(map.get("RELEASE_RELIEVE_DATE"));
  60. vo.setAlertcol(map.get("CURRENT_EW_LEVEL"));
  61. vo.setResponsecol(map.get("CURRENT_ER_LEVEL"));
  62. list2.add(vo);
  63. }
  64. } catch (SQLException e) {
  65. log.error(e.getMessage(),e);
  66. }
  67. return JSONArray.fromObject(list2).toString();
  68. }
  69. public String getIndexNotice(String corp_id,String parentID, String flag) throws ClassNotFoundException {
  70. StringBuffer sql = new StringBuffer();
  71. sql.append(" select distinct A.FD_OBJECTID ,A.PLAN_TYPE_ID,A.UPDATEDATE, A.EARLY_WARNING_NAME,A.EARLY_WARNING_ID, A.RELEASE_RELIEVE_DATE , B.CORP_NAME , A.CURRENT_EW_LEVEL ,A.IS_SEND, A.CURRENT_ER_LEVEL ,A.IS_ALERT ");
  72. sql.append(" from ECM_EM_PUBLISH_ALERT_NOTICE A left join SYS_DEPARTMENT B ON B.DEPT_ID = A.RELEASE_UNIT ");
  73. sql.append(" left join ECM_EM_TREATED_HUMAN H ON A.FD_OBJECTID = H.BUSINESS_ID ");
  74. sql.append(" where A.is_del='0' and A.IS_SEND =='5' ");
  75. if("3".equals(flag)){
  76. sql.append(" and A.RELEASE_UNIT in ('"+corp_id+"') ");
  77. }else if("2".equals(flag)){
  78. sql.append(" and A.RELEASE_UNIT in ( '"+parentID+"' ) ");
  79. }else if("4".equals(flag)){
  80. sql.append(" and A.RELEASE_UNIT in (select DEPT_ID from SYS_DEPARTMENT where PARENT_ID='"+corp_id+"' ) ");
  81. }else{
  82. sql.append(" and ( A.RELEASE_UNIT in ('"+corp_id+"') or A.RELEASE_UNIT in ( '"+parentID+"' ) or A.RELEASE_UNIT in (select DEPT_ID from SYS_DEPARTMENT where PARENT_ID='"+corp_id+"' ) ) ");
  83. }
  84. sql.append(" order by A.UPDATEDATE DESC ");
  85. log.info("新预警与响应:"+sql);
  86. List<NoticeVo> list2 = new ArrayList<NoticeVo>();
  87. try {
  88. List<Map<String,String>> list = new ORGTemplate().query(sql.toString());
  89. for(int i=0;i<list.size();i++){
  90. Map<String,String> map = list.get(i);
  91. NoticeVo vo = new NoticeVo();
  92. vo.setCorpName(map.get("CORP_NAME"));
  93. vo.setFd_objectid(map.get("FD_OBJECTID"));
  94. vo.setIsAlert(map.get("IS_ALERT"));
  95. vo.setWarningName(map.get("EARLY_WARNING_NAME"));
  96. vo.setWriteTime(map.get("RELEASE_RELIEVE_DATE"));
  97. vo.setAlertcol(map.get("CURRENT_EW_LEVEL"));
  98. vo.setResponsecol(map.get("CURRENT_ER_LEVEL"));
  99. vo.setWarningId(map.get("EARLY_WARNING_ID"));
  100. list2.add(vo);
  101. }
  102. } catch (SQLException e) {
  103. log.error(e.getMessage(),e);
  104. }
  105. log.info("新预警与响应数据:"+JSONArray.fromObject(list2).toString());
  106. return JSONArray.fromObject(list2).toString();
  107. }
  108. public String getNumbData(String corp_id, String parentID, String flag) {
  109. String result = "";
  110. StringBuffer sql1 = new StringBuffer();
  111. StringBuffer sql2 = new StringBuffer();
  112. StringBuffer sql3 = new StringBuffer();
  113. sql1.append(" select distinct A.FD_OBJECTID ,A.PLAN_TYPE_ID,A.UPDATEDATE, A.EARLY_WARNING_NAME,A.EARLY_WARNING_ID, A.RELEASE_RELIEVE_DATE , B.CORP_NAME , A.CURRENT_EW_LEVEL ,A.IS_SEND, A.CURRENT_ER_LEVEL ,A.IS_ALERT ");
  114. sql1.append(" from ECM_EM_PUBLISH_ALERT_NOTICE A left join SYS_DEPARTMENT B ON B.DEPT_ID = A.RELEASE_UNIT ");
  115. sql1.append(" left join ECM_EM_TREATED_HUMAN H ON A.FD_OBJECTID = H.BUSINESS_ID ");
  116. sql1.append(" where A.is_del='0' and A.IS_SEND =='5' ");
  117. sql1.append(" and A.RELEASE_UNIT in ( '"+parentID+"' ) ");
  118. sql1.append(" order by A.UPDATEDATE DESC ");
  119. //sql.append(" UNION ALL ");
  120. sql2.append(" select distinct A.FD_OBJECTID ,A.PLAN_TYPE_ID,A.UPDATEDATE, A.EARLY_WARNING_NAME,A.EARLY_WARNING_ID, A.RELEASE_RELIEVE_DATE , B.CORP_NAME , A.CURRENT_EW_LEVEL ,A.IS_SEND, A.CURRENT_ER_LEVEL ,A.IS_ALERT ");
  121. sql2.append(" from ECM_EM_PUBLISH_ALERT_NOTICE A left join SYS_DEPARTMENT B ON B.DEPT_ID = A.RELEASE_UNIT ");
  122. sql2.append(" left join ECM_EM_TREATED_HUMAN H ON A.FD_OBJECTID = H.BUSINESS_ID ");
  123. sql2.append(" where A.is_del='0' and A.IS_SEND =='5' ");
  124. sql2.append(" and A.RELEASE_UNIT in ('"+corp_id+"') ");
  125. sql2.append(" order by A.UPDATEDATE DESC ");
  126. //sql.append(" UNION ALL ");
  127. sql3.append(" select distinct A.FD_OBJECTID ,A.PLAN_TYPE_ID,A.UPDATEDATE, A.EARLY_WARNING_NAME,A.EARLY_WARNING_ID, A.RELEASE_RELIEVE_DATE , B.CORP_NAME , A.CURRENT_EW_LEVEL ,A.IS_SEND, A.CURRENT_ER_LEVEL ,A.IS_ALERT ");
  128. sql3.append(" from ECM_EM_PUBLISH_ALERT_NOTICE A left join SYS_DEPARTMENT B ON B.DEPT_ID = A.RELEASE_UNIT ");
  129. sql3.append(" left join ECM_EM_TREATED_HUMAN H ON A.FD_OBJECTID = H.BUSINESS_ID ");
  130. sql3.append(" where A.is_del='0' and A.IS_SEND =='5' ");
  131. sql3.append(" and A.RELEASE_UNIT in (select DEPT_ID from SYS_DEPARTMENT where PARENT_ID='"+corp_id+"' ) ");
  132. sql3.append(" order by A.UPDATEDATE DESC ");
  133. //log.info("新预警与响应SQL:"+sql);
  134. List<NoticeVo> list = new ArrayList<NoticeVo>();
  135. try {
  136. List<Map<String,String>> list1 = new ORGTemplate().query(sql1.toString());
  137. for(int i=0;i<list1.size();i++){
  138. Map<String,String> map = list1.get(i);
  139. NoticeVo vo = new NoticeVo();
  140. vo.setCorpName(map.get("CORP_NAME"));
  141. vo.setFd_objectid(map.get("FD_OBJECTID"));
  142. vo.setIsAlert(map.get("IS_ALERT"));
  143. vo.setWarningName(map.get("EARLY_WARNING_NAME"));
  144. vo.setWriteTime(map.get("RELEASE_RELIEVE_DATE"));
  145. vo.setAlertcol(map.get("CURRENT_EW_LEVEL"));
  146. vo.setResponsecol(map.get("CURRENT_ER_LEVEL"));
  147. vo.setWarningId(map.get("EARLY_WARNING_ID"));
  148. list.add(vo);
  149. }
  150. List<Map<String,String>> list2 = new ORGTemplate().query(sql2.toString());
  151. for(int i=0;i<list2.size();i++){
  152. Map<String,String> map = list2.get(i);
  153. NoticeVo vo = new NoticeVo();
  154. vo.setCorpName(map.get("CORP_NAME"));
  155. vo.setFd_objectid(map.get("FD_OBJECTID"));
  156. vo.setIsAlert(map.get("IS_ALERT"));
  157. vo.setWarningName(map.get("EARLY_WARNING_NAME"));
  158. vo.setWriteTime(map.get("RELEASE_RELIEVE_DATE"));
  159. vo.setAlertcol(map.get("CURRENT_EW_LEVEL"));
  160. vo.setResponsecol(map.get("CURRENT_ER_LEVEL"));
  161. vo.setWarningId(map.get("EARLY_WARNING_ID"));
  162. list.add(vo);
  163. }
  164. List<Map<String,String>> list3 = new ORGTemplate().query(sql3.toString());
  165. for(int i=0;i<list3.size();i++){
  166. Map<String,String> map = list3.get(i);
  167. NoticeVo vo = new NoticeVo();
  168. vo.setCorpName(map.get("CORP_NAME"));
  169. vo.setFd_objectid(map.get("FD_OBJECTID"));
  170. vo.setIsAlert(map.get("IS_ALERT"));
  171. vo.setWarningName(map.get("EARLY_WARNING_NAME"));
  172. vo.setWriteTime(map.get("RELEASE_RELIEVE_DATE"));
  173. vo.setAlertcol(map.get("CURRENT_EW_LEVEL"));
  174. vo.setResponsecol(map.get("CURRENT_ER_LEVEL"));
  175. vo.setWarningId(map.get("EARLY_WARNING_ID"));
  176. list.add(vo);
  177. }
  178. int num1=list1.size();
  179. int num2=list2.size();
  180. int num3=list3.size();
  181. int num4=num1+num2+num3;
  182. List<Map<String,String>> list4 = new ArrayList<Map<String,String>>();
  183. Map<String,String> map1 = new HashMap<String, String>();
  184. map1.put("num1", num4+"");
  185. map1.put("num2", num1+"");
  186. map1.put("num3", num2+"");
  187. map1.put("num4", num3+"");
  188. list4.add(map1);
  189. result = "[{\"listData\":"+JSONArray.fromObject(list).toString()+",\"numbdata\":"+JSONArray.fromObject(list4).toString()+"}]";
  190. } catch (SQLException e) {
  191. log.error(e.getMessage(),e);
  192. }
  193. //log.info("新预警与响应数据:"+JSONArray.fromObject(list).toString());
  194. log.info("新预警与响应数据:"+result);
  195. return result;
  196. }
  197. /**
  198. *
  199. * @param corp_id
  200. * @param parentID
  201. * @param flag
  202. * @return
  203. * @throws ClassNotFoundException
  204. */
  205. public String getIndexNotice1(String corp_id,String parentID, String flag) throws ClassNotFoundException {
  206. StringBuffer sql = new StringBuffer();
  207. sql.append(" select distinct A.FD_OBJECTID ,A.PLAN_TYPE_ID,A.UPDATEDATE, A.EARLY_WARNING_NAME,A.EARLY_WARNING_ID, A.RELEASE_RELIEVE_DATE , R.PROVINCE_NAME_TWO CORP_NAME, A.CURRENT_EW_LEVEL ,A.IS_SEND, A.CURRENT_ER_LEVEL ,A.IS_ALERT ");
  208. sql.append(" from ECM_EM_PUBLISH_ALERT_NOTICE A left join SYS_DEPARTMENT B ON B.DEPT_ID = A.RELEASE_UNIT ");
  209. sql.append(" left join ECM_EM_TREATED_HUMAN H ON A.FD_OBJECTID = H.BUSINESS_ID ");
  210. sql.append(" left join DEPARTMENT_ABBR R on B.DEPT_ID=R.FD_OBJECTID ");//单位简称
  211. sql.append(" where A.is_del='0' and A.IS_SEND =='5' ");
  212. if("2".equals(flag)){
  213. sql.append(" and A.RELEASE_UNIT in (select dept_id from sys_department where dept_level='1' and dept_type='1' and is_del='0') ");
  214. }else if("3".equals(flag)){
  215. sql.append(" and A.RELEASE_UNIT in (select dept_id from sys_department where dept_level='2' and dept_type='1' and is_del='0') ");
  216. }else if("4".equals(flag)){
  217. sql.append(" and A.RELEASE_UNIT in (select dept_id from sys_department where dept_level='3' and dept_type='1' and is_del='0') ");
  218. }else if("5".equals(flag)){
  219. sql.append(" and A.RELEASE_UNIT in (select dept_id from sys_department where dept_level='4' and dept_type='1' and is_del='0') ");
  220. }
  221. sql.append(" order by A.UPDATEDATE DESC ");
  222. log.info("新预警与响应:"+sql);
  223. List<NoticeVo> list2 = new ArrayList<NoticeVo>();
  224. try {
  225. List<Map<String,String>> list = new ORGTemplate().query(sql.toString());
  226. for(int i=0;i<list.size();i++){
  227. Map<String,String> map = list.get(i);
  228. NoticeVo vo = new NoticeVo();
  229. vo.setCorpName(map.get("CORP_NAME"));
  230. vo.setFd_objectid(map.get("FD_OBJECTID"));
  231. vo.setIsAlert(map.get("IS_ALERT"));
  232. vo.setWarningName(map.get("EARLY_WARNING_NAME"));
  233. vo.setWriteTime(map.get("RELEASE_RELIEVE_DATE"));
  234. vo.setAlertcol(map.get("CURRENT_EW_LEVEL"));
  235. vo.setResponsecol(map.get("CURRENT_ER_LEVEL"));
  236. vo.setWarningId(map.get("EARLY_WARNING_ID"));
  237. list2.add(vo);
  238. }
  239. } catch (SQLException e) {
  240. log.error(e.getMessage(),e);
  241. }
  242. log.info("新预警与响应数据:"+JSONArray.fromObject(list2).toString());
  243. return JSONArray.fromObject(list2).toString();
  244. }
  245. public String getNumbData1(String corp_id, String parentID, String flag) {
  246. String result = "";
  247. StringBuffer sql1 = new StringBuffer();
  248. StringBuffer sql2 = new StringBuffer();
  249. StringBuffer sql3 = new StringBuffer();
  250. StringBuffer sql4 = new StringBuffer();
  251. //网
  252. sql1.append(" select distinct A.FD_OBJECTID ,A.PLAN_TYPE_ID,A.UPDATEDATE, A.EARLY_WARNING_NAME,A.EARLY_WARNING_ID, A.RELEASE_RELIEVE_DATE , R.PROVINCE_NAME_TWO CORP_NAME , A.CURRENT_EW_LEVEL ,A.IS_SEND, A.CURRENT_ER_LEVEL ,A.IS_ALERT ");
  253. sql1.append(" from ECM_EM_PUBLISH_ALERT_NOTICE A left join SYS_DEPARTMENT B ON B.DEPT_ID = A.RELEASE_UNIT ");
  254. sql1.append(" left join ECM_EM_TREATED_HUMAN H ON A.FD_OBJECTID = H.BUSINESS_ID ");
  255. sql1.append(" left join DEPARTMENT_ABBR R on B.DEPT_ID=R.FD_OBJECTID ");//单位简称
  256. sql1.append(" where A.is_del='0' and A.IS_SEND =='5' ");
  257. sql1.append(" and A.RELEASE_UNIT in (select dept_id from sys_department where dept_level='1' and dept_type='1' and is_del='0') ");
  258. sql1.append(" order by A.UPDATEDATE DESC ");
  259. //省
  260. sql2.append(" select distinct A.FD_OBJECTID ,A.PLAN_TYPE_ID,A.UPDATEDATE, A.EARLY_WARNING_NAME,A.EARLY_WARNING_ID, A.RELEASE_RELIEVE_DATE , R.PROVINCE_NAME_TWO CORP_NAME , A.CURRENT_EW_LEVEL ,A.IS_SEND, A.CURRENT_ER_LEVEL ,A.IS_ALERT ");
  261. sql2.append(" from ECM_EM_PUBLISH_ALERT_NOTICE A left join SYS_DEPARTMENT B ON B.DEPT_ID = A.RELEASE_UNIT ");
  262. sql2.append(" left join ECM_EM_TREATED_HUMAN H ON A.FD_OBJECTID = H.BUSINESS_ID ");
  263. sql2.append(" left join DEPARTMENT_ABBR R on B.DEPT_ID=R.FD_OBJECTID ");//单位简称
  264. sql2.append(" where A.is_del='0' and A.IS_SEND =='5' ");
  265. sql2.append(" and A.RELEASE_UNIT in (select dept_id from sys_department where dept_level='2' and dept_type='1' and is_del='0') ");
  266. sql2.append(" order by A.UPDATEDATE DESC ");
  267. //地
  268. sql3.append(" select distinct A.FD_OBJECTID ,A.PLAN_TYPE_ID,A.UPDATEDATE, A.EARLY_WARNING_NAME,A.EARLY_WARNING_ID, A.RELEASE_RELIEVE_DATE , R.PROVINCE_NAME_TWO CORP_NAME , A.CURRENT_EW_LEVEL ,A.IS_SEND, A.CURRENT_ER_LEVEL ,A.IS_ALERT ");
  269. sql3.append(" from ECM_EM_PUBLISH_ALERT_NOTICE A left join SYS_DEPARTMENT B ON B.DEPT_ID = A.RELEASE_UNIT ");
  270. sql3.append(" left join ECM_EM_TREATED_HUMAN H ON A.FD_OBJECTID = H.BUSINESS_ID ");
  271. sql3.append(" left join DEPARTMENT_ABBR R on B.DEPT_ID=R.FD_OBJECTID ");//单位简称
  272. sql3.append(" where A.is_del='0' and A.IS_SEND =='5' ");
  273. sql3.append(" and A.RELEASE_UNIT in (select dept_id from sys_department where dept_level='3' and dept_type='1' and is_del='0' ) ");
  274. sql3.append(" order by A.UPDATEDATE DESC ");
  275. //县
  276. sql4.append(" select distinct A.FD_OBJECTID ,A.PLAN_TYPE_ID,A.UPDATEDATE, A.EARLY_WARNING_NAME,A.EARLY_WARNING_ID, A.RELEASE_RELIEVE_DATE , R.PROVINCE_NAME_TWO CORP_NAME , A.CURRENT_EW_LEVEL ,A.IS_SEND, A.CURRENT_ER_LEVEL ,A.IS_ALERT ");
  277. sql4.append(" from ECM_EM_PUBLISH_ALERT_NOTICE A left join SYS_DEPARTMENT B ON B.DEPT_ID = A.RELEASE_UNIT ");
  278. sql4.append(" left join ECM_EM_TREATED_HUMAN H ON A.FD_OBJECTID = H.BUSINESS_ID ");
  279. sql4.append(" left join DEPARTMENT_ABBR R on B.DEPT_ID=R.FD_OBJECTID ");//单位简称
  280. sql4.append(" where A.is_del='0' and A.IS_SEND =='5' ");
  281. sql4.append(" and A.RELEASE_UNIT in (select dept_id from sys_department where dept_level='4' and dept_type='1' and is_del='0' ) ");
  282. sql4.append(" order by A.UPDATEDATE DESC ");
  283. //log.info("新预警与响应SQL:"+sql);
  284. List<NoticeVo> list = new ArrayList<NoticeVo>();
  285. try {
  286. List<Map<String,String>> list1 = new ORGTemplate().query(sql1.toString());
  287. for(int i=0;i<list1.size();i++){
  288. Map<String,String> map = list1.get(i);
  289. NoticeVo vo = new NoticeVo();
  290. vo.setCorpName(map.get("CORP_NAME"));
  291. vo.setFd_objectid(map.get("FD_OBJECTID"));
  292. vo.setIsAlert(map.get("IS_ALERT"));
  293. vo.setWarningName(map.get("EARLY_WARNING_NAME"));
  294. vo.setWriteTime(map.get("RELEASE_RELIEVE_DATE"));
  295. vo.setAlertcol(map.get("CURRENT_EW_LEVEL"));
  296. vo.setResponsecol(map.get("CURRENT_ER_LEVEL"));
  297. vo.setWarningId(map.get("EARLY_WARNING_ID"));
  298. list.add(vo);
  299. }
  300. List<Map<String,String>> list2 = new ORGTemplate().query(sql2.toString());
  301. for(int i=0;i<list2.size();i++){
  302. Map<String,String> map = list2.get(i);
  303. NoticeVo vo = new NoticeVo();
  304. vo.setCorpName(map.get("CORP_NAME"));
  305. vo.setFd_objectid(map.get("FD_OBJECTID"));
  306. vo.setIsAlert(map.get("IS_ALERT"));
  307. vo.setWarningName(map.get("EARLY_WARNING_NAME"));
  308. vo.setWriteTime(map.get("RELEASE_RELIEVE_DATE"));
  309. vo.setAlertcol(map.get("CURRENT_EW_LEVEL"));
  310. vo.setResponsecol(map.get("CURRENT_ER_LEVEL"));
  311. vo.setWarningId(map.get("EARLY_WARNING_ID"));
  312. list.add(vo);
  313. }
  314. List<Map<String,String>> list3 = new ORGTemplate().query(sql3.toString());
  315. for(int i=0;i<list3.size();i++){
  316. Map<String,String> map = list3.get(i);
  317. NoticeVo vo = new NoticeVo();
  318. vo.setCorpName(map.get("CORP_NAME"));
  319. vo.setFd_objectid(map.get("FD_OBJECTID"));
  320. vo.setIsAlert(map.get("IS_ALERT"));
  321. vo.setWarningName(map.get("EARLY_WARNING_NAME"));
  322. vo.setWriteTime(map.get("RELEASE_RELIEVE_DATE"));
  323. vo.setAlertcol(map.get("CURRENT_EW_LEVEL"));
  324. vo.setResponsecol(map.get("CURRENT_ER_LEVEL"));
  325. vo.setWarningId(map.get("EARLY_WARNING_ID"));
  326. list.add(vo);
  327. }
  328. List<Map<String,String>> list4 = new ORGTemplate().query(sql4.toString());
  329. for(int i=0;i<list4.size();i++){
  330. Map<String,String> map = list4.get(i);
  331. NoticeVo vo = new NoticeVo();
  332. vo.setCorpName(map.get("CORP_NAME"));
  333. vo.setFd_objectid(map.get("FD_OBJECTID"));
  334. vo.setIsAlert(map.get("IS_ALERT"));
  335. vo.setWarningName(map.get("EARLY_WARNING_NAME"));
  336. vo.setWriteTime(map.get("RELEASE_RELIEVE_DATE"));
  337. vo.setAlertcol(map.get("CURRENT_EW_LEVEL"));
  338. vo.setResponsecol(map.get("CURRENT_ER_LEVEL"));
  339. vo.setWarningId(map.get("EARLY_WARNING_ID"));
  340. list.add(vo);
  341. }
  342. int num1=list1.size();
  343. int num2=list2.size();
  344. int num3=list3.size();
  345. int num4=list4.size();
  346. int num5=num1+num2+num3+num4;
  347. List<Map<String,String>> list5 = new ArrayList<Map<String,String>>();
  348. Map<String,String> map1 = new HashMap<String, String>();
  349. map1.put("num1", num5+"");
  350. map1.put("num2", num1+"");
  351. map1.put("num3", num2+"");
  352. map1.put("num4", num3+"");
  353. map1.put("num5", num4+"");
  354. list5.add(map1);
  355. result = "[{\"listData\":"+JSONArray.fromObject(list).toString()+",\"numbdata\":"+JSONArray.fromObject(list5).toString()+"}]";
  356. } catch (SQLException e) {
  357. log.error(e.getMessage(),e);
  358. }
  359. //log.info("新预警与响应数据:"+JSONArray.fromObject(list).toString());
  360. log.info("新预警与响应数据:"+result);
  361. return result;
  362. }
  363. }