73e4d2b550a3139ffca523044fa48beb3b2fa877.svn-base 56 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179
  1. package com.sinosoft.em.event.dao;
  2. import java.text.SimpleDateFormat;
  3. import java.util.ArrayList;
  4. import java.util.Date;
  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.persistence.service.JDBCHelper;
  10. import com.persistence.service.PersistenceFactory;
  11. import com.persistence.service.SysPersistence;
  12. import com.persistence.service.assitant.generator.IdentityGenerator;
  13. import com.persistence.service.exception.PersistenceException;
  14. import com.persistence.service.exception.TransformTypeException;
  15. import com.sinosoft.common.util.DateUtil;
  16. import com.sysmodel.datamodel.xmlmodel.ModelFactory;
  17. import com.sysmodel.datamodel.xmlmodel.able.MdpConstant;
  18. import com.sysmodel.datamodel.xmlmodel.able.SysModel;
  19. /**
  20. * 突发事件管理dao接口
  21. * @author zhuanghuiliang
  22. * @date 2015-10-28
  23. */
  24. public class EventDaoImpl implements EventDaoAble{
  25. //日志对象
  26. private static final Logger log = Logger.getLogger(EventDaoImpl.class);
  27. private static SysModel sysmodel = ModelFactory.getSysmodel();
  28. private static SysPersistence persistence = PersistenceFactory.getInstance(sysmodel);
  29. /**
  30. * 根据上次预警/响应单号查询上次预警/响应信息
  31. *
  32. * @param prevId 上次预警编号
  33. * @param fd_id
  34. * @return
  35. * @throws PersistenceException
  36. */
  37. public List<Map<String,String>> getInfoByPrevId(String prevId,String comp_id, String fd_id) throws PersistenceException {
  38. // TODO Auto-generated method stub
  39. // String sql = "SELECT EARLY_WARNING_NAME,EARLY_WARNING_ID,CURRENT_EW_LEVEL,CURRENT_ER_LEVEL,PREV_EW_ID,RELEASE_RELIEVE_DATE,IS_ALERT,EARLY_WARNING_AREA_NAME,RELEASE_RELIEVE_DATE,fd_description LEVEL_SHOW FROM ECM_EM_PUBLISH_ALERT_NOTICE left join BM_MapValueCanst on (CURRENT_EW_LEVEL =fd_code or CURRENT_ER_LEVEL=fd_code) and fd_type in('BM_WarningState','BM_REPONSELEVEL') WHERE EARLY_WARNING_ID = '"+prevId+"'";
  40. String sql = "SELECT A.FD_OBJECTID,A.EARLY_WARNING_NAME,A.IS_LAST_ID,A.EARLY_WARNING_ID,A.CURRENT_EW_LEVEL,A.CURRENT_ER_LEVEL,A.PREV_EW_ID,A.RELEASE_RELIEVE_DATE,A.IS_ALERT,"+
  41. "A.EARLY_WARNING_AREA_NAME,A.RELEASE_RELIEVE_DATE,B.fd_description LEVEL_SHOW "+
  42. "FROM ECM_EM_PUBLISH_ALERT_NOTICE A ,BM_MapValueCanst B "+
  43. "WHERE FD_OBJECTID = '"+prevId+"' and "+
  44. "RELEASE_UNIT = '"+comp_id+"' and "+
  45. "((A.CURRENT_EW_LEVEL =B.FD_CODE and b.fd_type='BM_WarningState' and is_alert='0') or "+
  46. " (A.CURRENT_ER_LEVEL =B.FD_CODE and b.fd_type='BM_REPONSELEVEL' and is_alert='1')) and A.FD_OBJECTID!='"+fd_id+"' ";
  47. log.info("==="+sql);
  48. List<Map<String,String>> list = persistence.getSearchResultToMap(365, sql);
  49. if(list!=null&&list.size()>0){
  50. Map<String,String> map = list.get(list.size()-1);
  51. String prev_ew_id = map.get("IS_LAST_ID");
  52. String prev_warning_id = map.get("FD_OBJECTID");
  53. if(prev_ew_id!=null&&!prev_ew_id.equals("")){
  54. //递归查询
  55. list.addAll(getInfoByPrevId(prev_ew_id,comp_id,prev_warning_id));
  56. }
  57. return list;
  58. }else{
  59. return null;
  60. }
  61. }
  62. @Override
  63. public String getEventInfoByPrevId(String prevId,String fd_id,String comp_id) throws PersistenceException{
  64. List<Map<String,String>> list = getNoticeInfoById(fd_id);
  65. List<Map<String,String>> list1 = getInfoByPrevId(prevId,comp_id,fd_id);
  66. if(list!=null&&list1!=null){
  67. list.addAll(list1);
  68. }
  69. log.info(JSONArray.fromObject(list).toString());
  70. return JSONArray.fromObject(list).toString();
  71. }
  72. /**
  73. * 根据预警/响应单号查询通知单信息
  74. *
  75. * @param fd_id 预警/响应编号
  76. * @return
  77. * @throws PersistenceException
  78. */
  79. public List<Map<String, String>> getNoticeInfoById(String fd_id) throws PersistenceException{
  80. //String sql = "SELECT EARLY_WARNING_NAME,EARLY_WARNING_ID,CURRENT_EW_LEVEL,CURRENT_ER_LEVEL,PREV_EW_ID,RELEASE_RELIEVE_DATE,IS_ALERT,EARLY_WARNING_AREA_NAME,RELEASE_RELIEVE_DATE,fd_description LEVEL_SHOW FROM ECM_EM_PUBLISH_ALERT_NOTICE left join BM_MapValueCanst on (CURRENT_EW_LEVEL =fd_code or CURRENT_ER_LEVEL=fd_code) and fd_type in('BM_WarningState','BM_REPONSELEVEL') WHERE fd_objectid = '"+fd_id+"'";
  81. String sql="SELECT A.EARLY_WARNING_NAME,A.EARLY_WARNING_ID,A.CURRENT_EW_LEVEL,A.CURRENT_ER_LEVEL,A.PREV_EW_ID,A.RELEASE_RELIEVE_DATE,A.IS_ALERT,A.EARLY_WARNING_AREA_NAME,A.RELEASE_RELIEVE_DATE,B.fd_description LEVEL_SHOW FROM ECM_EM_PUBLISH_ALERT_NOTICE A ,BM_MapValueCanst B WHERE a.fd_objectid = '"+fd_id+"' and ((A.CURRENT_EW_LEVEL =B.FD_CODE and b.fd_type='BM_WarningState' and is_alert='0') or (A.CURRENT_ER_LEVEL =B.FD_CODE and b.fd_type='BM_REPONSELEVEL' and is_alert='1'))";
  82. List<Map<String, String>> list=persistence.getSearchResultToMap(320, sql);
  83. return list;
  84. }
  85. /**
  86. * 根据预警/响应单号查询报告信息
  87. *
  88. * @param fd_id 预警/响应编号
  89. * @return
  90. * @throws PersistenceException
  91. */
  92. public String getReportInfoById(String fd_id) throws PersistenceException{
  93. String sql = "SELECT FD_OBJECTID FROM ECM_EM_ALERT_REPORT_PLAN WHERE EARLY_WARNING_ID='"+fd_id+"'";
  94. List<String[]> list=persistence.getSearchResult(320, sql);
  95. if(list!=null&&list.size()>0){
  96. return JSONArray.fromObject(list.get(0)).toString();
  97. }
  98. return null;
  99. }
  100. /**
  101. * 根据预警/响应单号查询报表信息
  102. *
  103. * @param fd_id 预警/响应编号
  104. * @return
  105. * @throws PersistenceException
  106. */
  107. public String getBaobiaoInfoById(String fd_id) throws PersistenceException{
  108. String sql = "SELECT FD_OBJECTID FROM REPORT_SCHEDULE WHERE WARNING_NUMBER='"+fd_id+"'";
  109. List<String[]> list=persistence.getSearchResult(337, sql);
  110. if(list!=null&&list.size()>0){
  111. return JSONArray.fromObject(list.get(0)).toString();
  112. }
  113. return null;
  114. }
  115. /**
  116. * 查询上下级单位当前预警/响应信息
  117. *
  118. * @param deptId 当前登录用户所属单位id
  119. * @return
  120. */
  121. public String getParentAndChildrenInfo(String deptId,String planTypeId)throws PersistenceException{
  122. String sql = "select dept_id from sys_department where parent_Id='"+deptId+"' or dept_id=(select parent_id from sys_department where dept_id='"+deptId+"')";
  123. List<String[]> list=persistence.getSearchResult(365, sql);
  124. String depts = "";
  125. if(list!=null&&list.size()>0){
  126. for(String[] s:list){
  127. depts += "'"+s[0]+"',";
  128. }
  129. if(!depts.equals("")){
  130. depts = depts.substring(0,depts.length()-1);
  131. sql = "SELECT RELEASE_UNIT,EARLY_WARNING_NAME,EARLY_WARNING_ID,CURRENT_EW_LEVEL,CURRENT_ER_LEVEL,PREV_EW_ID,RELEASE_RELIEVE_DATE," +
  132. "IS_ALERT,EARLY_WARNING_AREA_NAME,RELEASE_RELIEVE_DATE,fd_description LEVEL_SHOW,DEPT_NAME RELEASE_UNIT_SHOW " +
  133. "FROM ECM_EM_PUBLISH_ALERT_NOTICE left join BM_MapValueCanst on (CURRENT_EW_LEVEL =fd_code or CURRENT_ER_LEVEL=fd_code) and fd_type in('BM_WarningState','BM_REPONSELEVEL') " +
  134. "left join sys_department on dept_id=RELEASE_UNIT "+
  135. " WHERE RELEASE_UNIT in ("+depts+") and IS_SEND='5' and PLAN_TYPE_ID='"+planTypeId+"'";
  136. sql="SELECT A.RELEASE_UNIT , A.EARLY_WARNING_NAME , A.EARLY_WARNING_ID , A.CURRENT_EW_LEVEL , A.CURRENT_ER_LEVEL , A.PREV_EW_ID , A.RELEASE_RELIEVE_DATE , A.IS_ALERT , A.EARLY_WARNING_AREA_NAME , A.RELEASE_RELIEVE_DATE , B.fd_description LEVEL_SHOW, C.DEPT_NAME RELEASE_UNIT_SHOW "+
  137. " FROM ECM_EM_PUBLISH_ALERT_NOTICE A, BM_MapValueCanst B, sys_department C "+
  138. " WHERE (A.CURRENT_EW_LEVEL=fd_code OR CURRENT_ER_LEVEL =fd_code) AND B.fd_type in('BM_WarningState', 'BM_REPONSELEVEL') AND A.RELEASE_UNIT=C.DEPT_ID AND A.RELEASE_UNIT IN("+depts+") AND A.IS_SEND='5' and PLAN_TYPE_ID='"+planTypeId+"'";
  139. List<Map<String,String>> list1 =persistence.getSearchResultToMap(365, sql);
  140. return JSONArray.fromObject(list1).toString();
  141. }
  142. }
  143. return null;
  144. }
  145. public String getParentAndChildrenInfo(String deptId)throws PersistenceException{
  146. String sql = "select dept_id from sys_department where parent_Id='"+deptId+"' or dept_id=(select parent_id from sys_department where dept_id='"+deptId+"')";
  147. List<String[]> list=persistence.getSearchResult(365, sql);
  148. String depts = "";
  149. if(list!=null&&list.size()>0){
  150. for(String[] s:list){
  151. depts += "'"+s[0]+"',";
  152. }
  153. if(!depts.equals("")){
  154. depts = depts.substring(0,depts.length()-1);
  155. sql = "SELECT RELEASE_UNIT,EARLY_WARNING_NAME,EARLY_WARNING_ID,CURRENT_EW_LEVEL,CURRENT_ER_LEVEL,PREV_EW_ID,RELEASE_RELIEVE_DATE," +
  156. "IS_ALERT,EARLY_WARNING_AREA_NAME,RELEASE_RELIEVE_DATE,fd_description LEVEL_SHOW,DEPT_NAME RELEASE_UNIT_SHOW " +
  157. "FROM ECM_EM_PUBLISH_ALERT_NOTICE left join BM_MapValueCanst on (CURRENT_EW_LEVEL =fd_code or CURRENT_ER_LEVEL=fd_code) and fd_type in('BM_WarningState','BM_REPONSELEVEL') " +
  158. "left join sys_department on dept_id=RELEASE_UNIT WHERE RELEASE_UNIT in ("+depts+") and IS_SEND='5'";
  159. sql="SELECT A.RELEASE_UNIT , A.EARLY_WARNING_NAME , A.EARLY_WARNING_ID , A.CURRENT_EW_LEVEL , A.CURRENT_ER_LEVEL , A.PREV_EW_ID , A.RELEASE_RELIEVE_DATE , A.IS_ALERT , A.EARLY_WARNING_AREA_NAME , A.RELEASE_RELIEVE_DATE , B.fd_description LEVEL_SHOW, C.DEPT_NAME RELEASE_UNIT_SHOW FROM ECM_EM_PUBLISH_ALERT_NOTICE A, BM_MapValueCanst B, sys_department C WHERE (A.CURRENT_EW_LEVEL=fd_code OR CURRENT_ER_LEVEL =fd_code) AND B.fd_type in('BM_WarningState', 'BM_REPONSELEVEL') AND A.RELEASE_UNIT=C.DEPT_ID AND A.RELEASE_UNIT IN("+depts+") AND A.IS_SEND='5'";
  160. List<Map<String,String>> list1 =persistence.getSearchResultToMap(365, sql);
  161. return JSONArray.fromObject(list1).toString();
  162. }
  163. }
  164. return null;
  165. }
  166. @Override
  167. public List<String[]> getDeptIds(String deptId) throws PersistenceException {
  168. // TODO Auto-generated method stub
  169. String sql = "SELECT DEPT_ID,PARENT_ID,DEPT_NAME,DEPT_TYPE FROM SYS_DEPARTMENT WHERE "
  170. + "dept_type='1' AND"
  171. + "(DEPT_ID=(SELECT PARENT_ID FROM SYS_DEPARTMENT WHERE DEPT_ID='"+deptId+"') "
  172. + "OR DEPT_ID='"+deptId+"' "
  173. + "OR PARENT_ID='"+deptId+"')";
  174. List<String[]> list=persistence.getSearchResult(800, sql);
  175. if(list!=null&&list.size()>0){
  176. return list;
  177. }else{
  178. return null;
  179. }
  180. }
  181. @Override
  182. public List<String[]> getNoticeByDeptIds(String con) throws PersistenceException {
  183. // TODO Auto-generated method stub
  184. String sql = "SELECT FD_OBJECTID,RELEASE_UNIT,EARLY_WARNING_ID,IS_ALERT FROM ECM_EM_PUBLISH_ALERT_NOTICE "
  185. + "WHERE IS_DEL = 0 AND IS_SEND = 5 AND RELEASE_UNIT IN"+con;
  186. log.info(sql);
  187. List<String[]> list=persistence.getSearchResult(365, sql);
  188. if(list!=null&&list.size()>0){
  189. return list;
  190. }else{
  191. return null;
  192. }
  193. }
  194. @Override
  195. public List<String[]> getEventByDeptIds(String con,String eventId) throws PersistenceException {
  196. // TODO Auto-generated method stub
  197. String sql = "SELECT FD_OBJECTID,ISSUE_UNITE_ID,EVENT_NAME FROM ECM_EM_EVENT_NAME "
  198. + "WHERE IS_DEL = '0' AND EVENT_STATE = '1' and event_type=(select event_type from ECM_EM_EVENT_NAME where FD_OBJECTID='"+eventId+"') AND ISSUE_UNITE_ID IN "+con;
  199. log.info(sql);
  200. List<String[]> list=persistence.getSearchResult(365, sql);
  201. if(list!=null&&list.size()>0){
  202. return list;
  203. }else{
  204. return null;
  205. }
  206. }
  207. @Override
  208. public String saveBindInfo(String fd_id, String noticeIds,JDBCHelper jdbc) throws TransformTypeException, PersistenceException{
  209. // TODO Auto-generated method stub
  210. //先删除已绑定的记录
  211. String sql = "delete from ECM_EM_EVENT_BINDING where mainid='"+fd_id+"'";
  212. jdbc.executeUpdateSQL(sql);
  213. //如果通知单id为空,直接返回
  214. if(noticeIds==null||noticeIds.equals("")){
  215. return "true";
  216. }
  217. //存放sql语句的list
  218. ArrayList<String> list = new ArrayList<String>();
  219. for(int i=0;i<noticeIds.split(",").length;i++){
  220. sql = "insert into ECM_EM_EVENT_BINDING(MAINID,NOTICEID,TYPE) values('"+fd_id+"','"+noticeIds.split(",")[i]+"','1')";
  221. list.add(sql);
  222. }
  223. //批量插入
  224. jdbc.executeUpdateSQL(list);
  225. //直接返回true,service中直接捕获异常,未抛出异常都是true
  226. return "true";
  227. }
  228. @Override
  229. public List<String[]> getNoticeByEventId(String fd_id) throws PersistenceException {
  230. // TODO Auto-generated method stub
  231. String sql = "SELECT NOTICEID FROM ECM_EM_EVENT_BINDING "
  232. + "WHERE MAINID ='"+fd_id+"'";
  233. log.info(sql);
  234. List<String[]> list=persistence.getSearchResult(365, sql);
  235. if(list!=null&&list.size()>0){
  236. return list;
  237. }else{
  238. return null;
  239. }
  240. }
  241. @Override
  242. public List<String[]> getSelectEventByEventId(String fd_id) throws PersistenceException {
  243. // TODO Auto-generated method stub
  244. String sql = "SELECT b.EVENT_ID FROM BM_ECM_EVENT_CONNECTION a,BM_ECM_EVENT_CONNECTION b "
  245. + "WHERE a.CONNECTION=b.CONNECTION and a.EVENT_ID ='"+fd_id+"' ";
  246. log.info(sql);
  247. List<String[]> list=persistence.getSearchResult(365, sql);
  248. if(list!=null&&list.size()>0){
  249. return list;
  250. }else{
  251. return null;
  252. }
  253. }
  254. /**
  255. * 根据事件id查询已绑定的通知单信息
  256. *
  257. * @param fd_id 事件id
  258. * @return
  259. * @throws PersistenceException
  260. */
  261. public String getNoticeInfoByEventId(String fd_id) throws PersistenceException{
  262. String sql = "SELECT NOTICEID FROM ECM_EM_EVENT_BINDING WHERE MAINID ='"+fd_id+"' ";
  263. List<String[]> list=persistence.getSearchResult(396, sql);
  264. String noticeIds = "";
  265. if(list!=null&&list.size()>0){
  266. for(String[] s:list){
  267. noticeIds += "'"+s[0]+"',";
  268. }
  269. if(!noticeIds.equals("")){
  270. noticeIds = noticeIds.substring(0,noticeIds.length()-1);
  271. sql = "SELECT RELEASE_UNIT,EARLY_WARNING_NAME,EARLY_WARNING_ID,CURRENT_EW_LEVEL,CURRENT_ER_LEVEL,PREV_EW_ID,RELEASE_RELIEVE_DATE," +
  272. "IS_ALERT,EARLY_WARNING_AREA_NAME,RELEASE_RELIEVE_DATE,fd_description LEVEL_SHOW,DEPT_NAME RELEASE_UNIT_SHOW,T.FD_OBJECTID " +
  273. "FROM ECM_EM_PUBLISH_ALERT_NOTICE t left join BM_MapValueCanst on CURRENT_EW_LEVEL =fd_code or CURRENT_ER_LEVEL=fd_code " +
  274. "left join sys_department on dept_id=RELEASE_UNIT WHERE t.FD_OBJECTID in ("+noticeIds+") and t.is_del=0 order by release_unit";
  275. List<Map<String,String>> list1 =persistence.getSearchResultToMap(365, sql);
  276. return JSONArray.fromObject(list1).toString();
  277. }
  278. }
  279. return null;
  280. }
  281. @Override
  282. public String deeteEvent(String mainids, JDBCHelper jdbc) throws PersistenceException{
  283. // TODO Auto-generated method stub
  284. if(mainids==null||mainids.equals("")){
  285. return "true";
  286. }
  287. String sql = "update ECM_EM_EVENT_NAME set is_del=1 where FD_OBJECTID IN ("+String2SqlString(mainids)+")";
  288. jdbc.executeUpdateSQL(sql);
  289. sql = "DELETE FROM BM_ECM_EVENT_CONNECTION WHERE EVENT_ID IN ("+String2SqlString(mainids)+")";
  290. jdbc.executeUpdateSQL(sql);
  291. System.out.println(mainids);
  292. return "true";
  293. }
  294. public String String2SqlString(String str){
  295. String s = "";
  296. if(str.indexOf(",")==-1){
  297. return "'"+str+"'";
  298. }else{
  299. String[] strs = str.split(",");
  300. for(int i=0;i<strs.length;i++){
  301. s +="'"+strs[i]+"',";
  302. }
  303. s = s.substring(0,s.length()-1);
  304. }
  305. return s;
  306. }
  307. /**
  308. * 查询值班信息
  309. *
  310. * @param jdbc
  311. * @return
  312. */
  313. @Override
  314. public String getDutyInfo(String deptId) throws PersistenceException {
  315. // TODO Auto-generated method stub
  316. String sql = "select dept_id from sys_department where parent_Id='"+deptId+"' or dept_id='"+deptId+"'";
  317. List<String[]> list=persistence.getSearchResult(365, sql);
  318. String depts = "";
  319. if(list!=null&&list.size()>0){
  320. for(String[] s:list){
  321. depts += "'"+s[0]+"',";
  322. }
  323. }
  324. if(!depts.equals("")){
  325. depts = depts.substring(0,depts.length()-1);
  326. sql = "select d1.leader_name leader_name,d1.leader_tel leader_tel,"
  327. + "d1.name name,d1.telephone telephone,d3.dept_id,sysdate, "
  328. + "start_time,END_TIME,d3.DEPT_NAME DEPT_NAME "
  329. + " from ECM_EM_DUTY_DETAIL d1 left join ECM_EM_DUTY d2"
  330. + " on d1.DUTY_ID =d2.fd_objectid"
  331. + " left join SYS_DEPARTMENT d3 "
  332. + " on d2.DEPT_NAMES=d3.dept_id "
  333. + " where sysdate between START_TIME and END_TIME and d2.DEPT_NAMES in("+depts+") and d1.is_del=0 and d2.RELEASE='1'"
  334. + " ORDER BY d3.dept_id";
  335. log.info("sql====="+sql);
  336. List<Map<String,String>> list1 = persistence.getSearchResultToMap(336, sql);
  337. log.info(JSONArray.fromObject(list1).toString());
  338. return JSONArray.fromObject(list1).toString();
  339. }else{
  340. return null;
  341. }
  342. }
  343. /**
  344. * 查询政府通知单信息
  345. * @param deptId 单位id
  346. * @return
  347. */
  348. @Override
  349. public String getGovInfo(String deptId) throws PersistenceException {
  350. // TODO Auto-generated method stub
  351. List<Map<String,String>> list = getGovWarningInfo(deptId);
  352. List<Map<String,String>> list1 = getGovResponseInfo(deptId);
  353. list.addAll(list1);
  354. List<Map<String,String>> list2 = new ArrayList<Map<String,String>>();
  355. SysModel sysmodel = ModelFactory.getSysmodel();
  356. //取得内存中的常量表数据
  357. MdpConstant m1 = sysmodel.getMdpConstantByName("BM_EMC_WarningName");
  358. MdpConstant m2 = sysmodel.getMdpConstantByName("BM_REPONSELEVEL");
  359. MdpConstant m3 = sysmodel.getMdpConstantByName("BM_WarningState");
  360. MdpConstant m4 = sysmodel.getMdpConstantByName("BM_PublishState");
  361. for(Map<String,String> map:list){
  362. map.put("NOTICETYPE", m1.getMdpConstantDisplayString(map.get("NOTICETYPE")));
  363. if("response".equalsIgnoreCase(map.get("TYPE"))){
  364. map.put("LEVEL", m2.getMdpConstantDisplayString(map.get("LEVEL")));
  365. }else{
  366. map.put("LEVEL", m3.getMdpConstantDisplayString(map.get("LEVEL")));
  367. }
  368. map.put("STATUS", m4.getMdpConstantDisplayString(map.get("STATUS")));
  369. list2.add(map);
  370. }
  371. log.info(JSONArray.fromObject(list2).toString());
  372. return JSONArray.fromObject(list2).toString();
  373. }
  374. @Override
  375. public String getGovInfo(String deptId,String planTypeId369,String eventId) throws PersistenceException {
  376. // TODO Auto-generated method stub
  377. List<Map<String,String>> list = getGovWarningInfo(deptId,planTypeId369,eventId);
  378. List<Map<String,String>> list1 = getGovResponseInfo(deptId,planTypeId369,eventId);
  379. list.addAll(list1);
  380. List<Map<String,String>> list2 = new ArrayList<Map<String,String>>();
  381. SysModel sysmodel = ModelFactory.getSysmodel();
  382. //取得内存中的常量表数据
  383. MdpConstant m1 = sysmodel.getMdpConstantByName("BM_EMC_WarningName");
  384. MdpConstant m2 = sysmodel.getMdpConstantByName("BM_REPONSELEVEL");
  385. MdpConstant m3 = sysmodel.getMdpConstantByName("BM_WarningState");
  386. MdpConstant m4 = sysmodel.getMdpConstantByName("BM_PublishState");
  387. for(Map<String,String> map:list){
  388. map.put("NOTICETYPE", m1.getMdpConstantDisplayString(map.get("NOTICETYPE")));
  389. if("response".equalsIgnoreCase(map.get("TYPE"))){
  390. map.put("LEVEL", m2.getMdpConstantDisplayString(map.get("LEVEL")));
  391. }else{
  392. map.put("LEVEL", m3.getMdpConstantDisplayString(map.get("LEVEL")));
  393. }
  394. map.put("STATUS", m4.getMdpConstantDisplayString(map.get("STATUS")));
  395. list2.add(map);
  396. }
  397. log.info(JSONArray.fromObject(list2).toString());
  398. return JSONArray.fromObject(list2).toString();
  399. }
  400. /**
  401. * 查询政府预警通知单信息
  402. * @param deptId 单位id
  403. * @param planTypeId369 政府或气象预警通知单--预警类别
  404. * @return
  405. */
  406. public List<Map<String,String>> getGovWarningInfo(String deptId) throws PersistenceException {
  407. // TODO Auto-generated method stub
  408. String sql = "select a.NAME, a.fd_objectid,a.RELEASE_UNIT,a.RELEASE_DATE,a.EARLY_WARNING_NAME as NOTICETYPE,a.CURRENT_EW_LEVEL AS LEVEL,a.EARLY_WARNING_AREA AS AREA,a.EARLY_WARNING_CONTENT AS CONTENT,a.EARLY_WARNING_STATUS AS STATUS,"
  409. + "b.corp_id,b.corp_name,'warning' as type"
  410. + " from ECM_EM_GOV_ALERT_NOTICE a left join sys_department b on a.WRITE_DEPT = b.dept_id "
  411. // + "where b.corp_id='"+deptId+"' and a.TYPE='39' and a.is_del = '0' and EARLY_WARNING_STATUS ='33' and to_char(RELEASE_DATE,'yyyy-mm-dd') between to_char(sysdate-interval '3'month,'yyyy-mm-dd') and to_char(sysdate+interval '3'month,'yyyy-mm-dd')";
  412. + "where b.corp_id='"+deptId+"' and a.TYPE='39' and a.is_del = '0' and EARLY_WARNING_STATUS ='33' and to_char(RELEASE_DATE,'yyyy-mm-dd') between to_char(sysdate-interval '90'day,'yyyy-mm-dd') and to_char(sysdate+interval '90'day,'yyyy-mm-dd')";
  413. return persistence.getSearchResultToMap(369, sql);
  414. }
  415. public List<Map<String,String>> getGovWarningInfo(String deptId,String planTypeId369,String eventId) throws PersistenceException {
  416. // TODO Auto-generated method stub
  417. String sql = "select a.NAME, a.fd_objectid,a.RELEASE_UNIT,a.RELEASE_DATE,a.EARLY_WARNING_NAME as NOTICETYPE,a.CURRENT_EW_LEVEL AS LEVEL,a.EARLY_WARNING_AREA AS AREA,a.EARLY_WARNING_CONTENT AS CONTENT,a.EARLY_WARNING_STATUS AS STATUS,"
  418. + "b.corp_id,b.corp_name,'warning' as type"
  419. + " from ECM_EM_GOV_ALERT_NOTICE a left join sys_department b on a.WRITE_DEPT = b.dept_id "
  420. // + "where b.corp_id='"+deptId+"' and a.TYPE='39' and a.is_del = '0' and EARLY_WARNING_STATUS ='33' and to_char(RELEASE_DATE,'yyyy-mm-dd') between to_char(sysdate-interval '3'month,'yyyy-mm-dd') and to_char(sysdate+interval '3'month,'yyyy-mm-dd') "
  421. + "where b.corp_id='"+deptId+"' and a.TYPE='39' and a.is_del = '0' and EARLY_WARNING_STATUS ='33' and to_char(RELEASE_DATE,'yyyy-mm-dd') between to_char(sysdate-interval '90'day,'yyyy-mm-dd') and to_char(sysdate+interval '90'day,'yyyy-mm-dd') "
  422. +" and EARLY_WARNING_NAME='"+planTypeId369+"'";//and EVENT_ID='"+eventId+"'";
  423. return persistence.getSearchResultToMap(369, sql);
  424. }
  425. /**
  426. * 查询政府响应通知单信息
  427. * @param deptId 单位id
  428. * @param planTypeId369 政府或气象预警通知单--预警类别
  429. * @return
  430. */
  431. public List<Map<String,String>> getGovResponseInfo(String deptId) throws PersistenceException {
  432. // TODO Auto-generated method stub
  433. String sql = "select a.NAME, a.fd_objectid,a.RELEASE_UNIT,a.RELEASE_DATE,a.RESPONSE_NAME as NOTICETYPE,a.RESPONSE_LEVEL AS LEVEL,a.RESPONSE_AREA AS AREA,a.RESPONSE_CONTENT AS CONTENT,a.RESPONSE_STATUS AS STATUS,"
  434. + "b.corp_id,b.corp_name,'response' as type"
  435. + " from ECM_EM_GOV_RESPONSE_NOTICE a left join sys_department b on a.WRITE_DEPT = b.dept_id "
  436. // + "where b.corp_id='"+deptId+"' and a.is_del = '0' and RESPONSE_STATUS ='33' and to_char(RELEASE_DATE,'yyyy-mm-dd') between to_char(sysdate-interval '3'month,'yyyy-mm-dd') and to_char(sysdate+interval '3'month,'yyyy-mm-dd')";
  437. + "where b.corp_id='"+deptId+"' and a.is_del = '0' and RESPONSE_STATUS ='33' and to_char(RELEASE_DATE,'yyyy-mm-dd') between to_char(sysdate-interval '90'day,'yyyy-mm-dd') and to_char(sysdate+interval '90'day,'yyyy-mm-dd')";
  438. return persistence.getSearchResultToMap(370, sql);
  439. }
  440. public List<Map<String,String>> getGovResponseInfo(String deptId,String planTypeId370,String eventId) throws PersistenceException {
  441. // TODO Auto-generated method stub
  442. String sql = "select a.NAME, a.fd_objectid,a.RELEASE_UNIT,a.RELEASE_DATE,a.RESPONSE_NAME as NOTICETYPE,a.RESPONSE_LEVEL AS LEVEL,a.RESPONSE_AREA AS AREA,a.RESPONSE_CONTENT AS CONTENT,a.RESPONSE_STATUS AS STATUS,"
  443. + "b.corp_id,b.corp_name,'response' as type"
  444. + " from ECM_EM_GOV_RESPONSE_NOTICE a left join sys_department b on a.WRITE_DEPT = b.dept_id "
  445. // + "where b.corp_id='"+deptId+"' and a.is_del = '0' and RESPONSE_STATUS ='33' and to_char(RELEASE_DATE,'yyyy-mm-dd') between to_char(sysdate-interval '3'month,'yyyy-mm-dd') and to_char(sysdate+interval '3'month,'yyyy-mm-dd') "
  446. + "where b.corp_id='"+deptId+"' and a.is_del = '0' and RESPONSE_STATUS ='33' and to_char(RELEASE_DATE,'yyyy-mm-dd') between to_char(sysdate-interval '90'day,'yyyy-mm-dd') and to_char(sysdate+interval '90'day,'yyyy-mm-dd') "
  447. +" and RESPONSE_NAME='"+planTypeId370+"'"; //and EVENT_ID='"+eventId+"'";
  448. return persistence.getSearchResultToMap(370, sql);
  449. }
  450. /**
  451. * 查询报表信息
  452. * @param deptId 单位id
  453. * @return
  454. */
  455. public String getBaobiaoInfo(String warningId,String deptId) throws PersistenceException {
  456. // TODO Auto-generated method stub
  457. //查询填报计划表返回的list
  458. List<String[]> list = new ArrayList<String[]>();
  459. List<String[]> list1 = null;
  460. //用于拼接
  461. String str0 = "应急办:R002105430210;";
  462. String str1 = "R002105430211;";
  463. String str2 = "R002105430212;";
  464. String str3 = "R002105430213;";
  465. String str = "";
  466. String sql = "select report_dept from REPORT_SCHEDULE "
  467. + "where warning_number like'"+warningId+"' and comp_id='"+deptId+"' and is_del='0' and SEND_STAT='1'"
  468. + " and ("
  469. + " report_dept like ('R002105430210%')"
  470. + " or report_dept like ('R002105430211%')"
  471. + " or report_dept like ('R002105430212%')"
  472. + " or report_dept like ('R002105430213%')"
  473. + " )";
  474. System.out.println("sql==============="+sql);
  475. //返回数据格式
  476. //应急办:R002105430210;线路停运及恢复情况表,变电站停运及恢复情况表|R002105430211;线路倒杆情况统计表,线路及配变受损情况表|R002105430212;供电损失及客户停电情况表,行政区域停电情况表|R002105430213;预警发布或响应启动情况表,应急资源情况表
  477. //应急办:R002105430210;线路停运及恢复情况表,变电站停运及恢复情况表|R002105430211;线路倒杆情况统计表,线路及配变受损情况表|R002105430212;供电损失及客户停电情况表,行政区域停电情况表|R002105430213;预警发布或响应启动情况表,应急资源情况表
  478. list1 =persistence.getSearchResult(337, sql);
  479. for(int i=0;i<list1.size();i++){
  480. if(list1.get(i)[0].indexOf("R002105430210")>-1){;
  481. str0+=list1.get(i)[0].split(";")[2]+",";
  482. }else if(list1.get(i)[0].indexOf("R002105430211")>-1){;
  483. str1+=list1.get(i)[0].split(";")[2]+",";
  484. }else if(list1.get(i)[0].indexOf("R002105430212")>-1){;
  485. str2+=list1.get(i)[0].split(";")[2]+",";
  486. }else if(list1.get(i)[0].indexOf("R002105430213")>-1){;
  487. str3+=list1.get(i)[0].split(";")[2]+",";
  488. }
  489. }
  490. str0 = str0.substring(0, str0.length()-1);
  491. str1 = str1.substring(0, str1.length()-1);
  492. str2 = str2.substring(0, str2.length()-1);
  493. str3 = str3.substring(0, str3.length()-1);
  494. str=str0+"|"+str1+"|"+str2+"|"+str3;
  495. String [] tempArray = new String []{str};
  496. list.add(tempArray);
  497. //存放计划表里查询出的报表类型
  498. StringBuffer typeName = new StringBuffer();
  499. String time =null;
  500. String temp = "";
  501. String[] temps =null;
  502. if(list!=null&&list.size()>0){
  503. temp =list.get(0)[0];
  504. //计划发布时间
  505. //time = list.get(0)[1];
  506. temp = temp.split(":")[1];
  507. temps = temp.split("\\|");
  508. for(int i=0;i<temps.length;i++){
  509. temp = temps[i];
  510. temp = temp.split(";")[1];
  511. if(temp.indexOf(",")!=-1){
  512. for(int j=0;j<temp.split(",").length;j++){
  513. typeName.append("'"+temp.split(",")[j]+"',");
  514. }
  515. }else{
  516. typeName.append("'"+temp+"',");
  517. }
  518. }
  519. }else{
  520. return "";
  521. }
  522. if(typeName.charAt(typeName.length()-1)==','){
  523. typeName.deleteCharAt(typeName.length()-1);
  524. }
  525. String result = getReportType(typeName.toString(),deptId,time,warningId);
  526. return result;
  527. }
  528. //查询报表报送情况,返回报表类型名称,责任部门,上报时间
  529. private String getReportType(String condition,String deptId,String time,String warningId) throws PersistenceException{
  530. if("".equals(condition)){
  531. return "";
  532. }
  533. // String sql = "SELECT A.REPORT_NAME,A.DEPT_NAME,B.REPORT_TIME FROM BM_MAPFORREPORT A LEFT JOIN "
  534. // + "(SELECT REPORT_TYPE, MAX(REPORT_TIME) REPORT_TIME FROM REPORT_RECORDS WHERE "
  535. // + "COMP_ID='"+deptId+"' AND REPORT_TIME>'"+time+"'GROUP BY REPORT_TYPE,COMP_ID) B "
  536. // + "ON A.REPORT_TYPE=B.REPORT_TYPE WHERE A.REPORT_NAME IN("+condition+") ORDER BY A.REPORT_TYPE";
  537. //为了演示 先去掉时间过滤
  538. String sql = "SELECT A.REPORT_NAME,A.DEPT_NAME,B.REPORT_TIME FROM BM_MAPFORREPORT A LEFT JOIN "
  539. + "(SELECT REPORT_TYPE, MAX(REPORT_TIME) REPORT_TIME FROM REPORT_RECORDS c WHERE "
  540. + "COMP_ID='"+deptId+"'"
  541. + " and c.report_id in(select fd_objectid from report_schedule where warning_number ='"+warningId+"' and comp_id='"+deptId+"' and (report_dept like 'R002105430210%' or report_dept like 'R002105430211%' or report_dept like 'R002105430212%' or report_dept like 'R002105430213%'))"
  542. + " GROUP BY REPORT_TYPE,COMP_ID) B "
  543. + "ON A.REPORT_TYPE=B.REPORT_TYPE WHERE A.REPORT_NAME IN("+condition+") ORDER BY A.REPORT_TYPE";
  544. List<Map<String,String>> list =persistence.getSearchResultToMap(780, sql);
  545. return JSONArray.fromObject(list).toString();
  546. }
  547. /**
  548. * 查询报告信息
  549. * @param deptId 单位id
  550. * @return
  551. */
  552. public String getBaogaoInfo(String warningId,String deptId,String is_alert) throws PersistenceException {
  553. List<Map<String,String>> planList=getBaogao(warningId);
  554. //填报要求id
  555. String planId = "";
  556. //报告类型
  557. String reportType = "";
  558. //填报要求中存放的填报部门id
  559. String compName ="";
  560. if(planList!=null&&planList.size()>0){
  561. Map<String,String> map = planList.get(0);
  562. planId = map.get("FD_OBJECTID");
  563. String temp = map.get("REPORT_TYPE");
  564. for(int i=0;i<temp.split(",").length;i++){
  565. reportType += "'"+temp.split(",")[i]+"',";
  566. }
  567. temp = map.get("WRITE_DEPT_NAME");
  568. }else{
  569. return "";
  570. }
  571. if(reportType.equals("")){
  572. return "";
  573. }else{
  574. reportType = reportType.substring(0,reportType.length()-1);
  575. }
  576. String sql = "SELECT A.FD_DESCRIPTION REPORT_TYPE,B.TIME,B.INPUT_UNIT FROM "
  577. + "(SELECT FD_DESCRIPTION,FD_CODE "
  578. + "FROM BM_MAPVALUECANST WHERE FD_TYPE='BM_AlertRespReportInputState' AND FD_CODE IN("+reportType+")) A "
  579. + "LEFT JOIN (SELECT MAX(UPDATEDATE) TIME,REPORT_TYPE,INPUT_UNIT FROM ECM_EM_ALERT_REPORT_INPUT "
  580. + "WHERE REPORT_TYPE IN ("+reportType+") AND IS_DEL=0 AND IS_RELEASE=1 and is_alert='"+is_alert+"'"
  581. + "AND PLAN_ID='"+planId+"' GROUP BY REPORT_TYPE,INPUT_UNIT)B "
  582. + "ON A.FD_CODE = B.REPORT_TYPE";
  583. List<Map<String,String>> list = persistence.getSearchResultToMap(321, sql);
  584. if(list!=null&&list.size()>0){
  585. List<Map<String,String>> list1 = new ArrayList<Map<String,String>>();
  586. for(Map<String,String> map:list){
  587. //单位名称
  588. map.put("INPUT_UNIT_SHOW", getComp_name(map.get("INPUT_UNIT")));
  589. list1.add(map);
  590. }
  591. String result = JSONArray.fromObject(list1).toString();
  592. log.info(result);
  593. return result;
  594. }
  595. return "";
  596. }
  597. //根据预警/响应编号查询报告填报要求
  598. private List<Map<String,String>> getBaogao(String warningId) throws PersistenceException{
  599. if(warningId==null||warningId.equals("")){
  600. return null;
  601. }
  602. String sql = "select fd_objectid,report_type,WRITE_DEPT_NAME from ECM_EM_ALERT_REPORT_PLAN where EARLY_WARNING_ID='"+warningId+"' and is_del=0 and IS_RELEASE=1";
  603. List<Map<String,String>> list = persistence.getSearchResultToMap(320, sql);
  604. return list;
  605. }
  606. //查询部门所属单位名称
  607. private String getComp_name(String deptId) throws PersistenceException{
  608. if(deptId==null||deptId.equals("")){
  609. return "";
  610. }
  611. String sql = "select corp_name from sys_department where dept_id='"+deptId+"'";
  612. List<Map<String,String>> list = persistence.getSearchResultToMap(321, sql);
  613. if(list!=null&&list.size()>0){
  614. return list.get(0).get("CORP_NAME");
  615. }else{
  616. return "";
  617. }
  618. }
  619. /**
  620. * 查询本单位当前处于发布状态的预警和响应通知单
  621. * @param params
  622. * @return
  623. * @throws PersistenceException
  624. */
  625. @Override
  626. public String getInfoByUnit(String deptId) throws PersistenceException{
  627. if(deptId==null||deptId.equals("")){
  628. return "";
  629. }
  630. String sql = "SELECT A.FD_OBJECTID,A.EARLY_WARNING_NAME,A.EARLY_WARNING_ID,A.RELEASE_UNIT,"
  631. + "B.DEPT_NAME RELEASE_UNIT_SHOW,A.RELEASE_RELIEVE_DATE,A.IS_ALERT "
  632. + "FROM ECM_EM_PUBLISH_ALERT_NOTICE A LEFT JOIN SYS_DEPARTMENT B "
  633. + "ON A.RELEASE_UNIT=B.DEPT_ID "
  634. + "WHERE IS_SEND = '5' AND A.IS_DEL=0 AND RELEASE_UNIT='"+deptId+"' ORDER BY A.RELEASE_RELIEVE_DATE DESC";
  635. List<Map<String,String>> list =persistence.getSearchResultToMap(365, sql);
  636. return JSONArray.fromObject(list).toString();
  637. }
  638. /**
  639. * 查询值班信息按照日期
  640. *
  641. * @param deptId 单位id
  642. * @param d 日期
  643. * @return
  644. */
  645. @Override
  646. public String getDutyInfoByDate(String deptId, String d) throws PersistenceException{
  647. // TODO Auto-generated method stub
  648. if(deptId==null||deptId.equals("")){
  649. return "";
  650. }
  651. //如果没传日期,默认查询当天的
  652. if(d==null||d.equals("")){
  653. d=DateUtil.format(new Date());
  654. }
  655. String sql = "";
  656. /*String sql = "select dept_id from sys_department where parent_Id='"+deptId+"' or dept_id='"+deptId+"'";
  657. List<String[]> list=persistence.getSearchResult(365, sql);
  658. String depts = "";
  659. if(list!=null&&list.size()>0){
  660. for(String[] s:list){
  661. depts += "'"+s[0]+"',";
  662. }
  663. } */
  664. if(!deptId.equals("")){
  665. //depts = depts.substring(0,depts.length()-1);
  666. sql = "select d1.DUTY_NAME leader_name,d1.DUTY_NAME_TEL leader_tel,"
  667. + "d1.DATE_TIME,d3.dept_id,substr(d1.DAY_TIME,0,10) DUTY_DATE, "
  668. + "d3.DEPT_NAME DEPT_NAME ,d3.CORP_NAME CORP_NAME "
  669. + " from ECM_EM_DUTY_ALERT_INFO d1 left join ECM_EM_DUTY d2"
  670. + " on d1.DUTY_ID =d2.fd_objectid"
  671. + " left join SYS_DEPARTMENT d3 "
  672. + " on d2.DEPT_NAMES=d3.dept_id "
  673. //+ " left join BM_MAPVALUECANST d4 "
  674. //+ " on d4.FD_TYPE='BM_DUTYWAYSTATE' AND d4.FD_CODE=d1.DUTY_WAY "
  675. + " where d1.DAY_TIME in ('"+d+"') and d3.CORP_ID in('"+deptId+"') and d2.is_del='0' and d2.RELEASE='1'"
  676. + " ORDER BY d1.DUTY_NAME";
  677. log.info("sql====="+sql);
  678. List<Map<String,String>> list1 = persistence.getSearchResultToMap(336, sql);
  679. log.info(JSONArray.fromObject(list1).toString());
  680. return JSONArray.fromObject(list1).toString();
  681. }else{
  682. return null;
  683. }
  684. }
  685. /**
  686. * 查询预案启动条件
  687. *
  688. * @param planId 预案id
  689. * @param gradeType 1突发事件 2预警 3响应 4应对措施
  690. * @return
  691. */
  692. @Override
  693. public String getStartCondition(String planId, String gradeType) throws PersistenceException{
  694. // TODO Auto-generated method stub
  695. String type = getPlanType(planId);
  696. String sql = "select FRIST_GRADE,SECOND_GRADE,THRID_GRADE,FOURTH_GRADE from EMC_EM_PLAN_GRADE_NEXUS "
  697. + "where FILLER1='"+planId+"' and GRADE_TYPE='" + type + "_" +gradeType+"'";
  698. log.info("sql====="+sql);
  699. List<Map<String,String>> list = persistence.getSearchResultToMap(215, sql);
  700. log.info(JSONArray.fromObject(list).toString());
  701. return JSONArray.fromObject(list).toString();
  702. }
  703. /**
  704. * 查询预案类型
  705. *
  706. * @param planId 预案id
  707. * @return
  708. */
  709. public String getPlanType(String planId) throws PersistenceException{
  710. String sql = "select PLAN_REFINE_CATEGORY from ECM_AM_YJYASERVER "
  711. + "where fd_objectid='"+planId+"'";
  712. log.info("sql====="+sql);
  713. List<String[]> list = persistence.getSearchResult(214, sql);
  714. log.info(JSONArray.fromObject(list).toString());
  715. if(list!=null&&list.size()>0){
  716. return list.get(0)[0];
  717. }else{
  718. return "";
  719. }
  720. }
  721. /**
  722. * 预警/响应信息接收中,解除上次预警/响应通知单
  723. *
  724. * @param objectid 通知单主键
  725. * @param classid
  726. * @return
  727. */
  728. @Override
  729. public void changeStatus(String objectid,String classid) throws PersistenceException{
  730. // TODO Auto-generated method stub
  731. String sql = "update ECM_EM_GOV_ALERT_NOTICE set EARLY_WARNING_STATUS='34',IS_DEL='1' where fd_objectid='"+objectid+"'";
  732. //状态 33:发布 34:解除
  733. //classid 369:预警 370:响应
  734. if("370".equals(classid)){
  735. sql = "update ECM_EM_GOV_RESPONSE_NOTICE set RESPONSE_STATUS='34',IS_DEL='1' where fd_objectid='"+objectid+"'";
  736. }
  737. persistence.executeUpdateSQL(369, sql);
  738. }
  739. /**
  740. * 新增突发事件类型报表配置数据
  741. * 2017-03-10 谢仲铠新增
  742. */
  743. @Override
  744. public String getEventTypeRepConfigs(List<Map<String,String>> list, JDBCHelper jdbc,String event_type_id)
  745. throws PersistenceException {
  746. String sql = "";
  747. String sql1 = "";
  748. String sql2 = "";//一级响应
  749. String sql3 = "";//二级响应
  750. String sql4 = "";//三级响应
  751. String sql5 = "";//四级响应
  752. String sql6 = "";//红色预警
  753. String sql7 = "";//橙色预警
  754. String sql8 = "";//黄色预警
  755. String sql9 = "";//蓝色预警
  756. String sql10 = "";//用于查询报表是否已配置了时间
  757. sql1 = "delete from ecm_em_emergency_type_config where event_type_id='"+event_type_id+"' and is_type='1'";
  758. log.info("sql1====="+sql1);
  759. int result = persistence.executeUpdateSQL(790, sql1);
  760. //存放sql语句的list
  761. ArrayList<String> sqlList = new ArrayList<String>();
  762. for(int i=0;i<list.size();i++){
  763. //String fd_objectid=IdentityGenerator.getIdentityGenerator().gerenalIdentity(790);
  764. String fd_objectid=list.get(i).get("serial_number")+"_"+list.get(i).get("event_type_id");
  765. String serial_number = list.get(i).get("serial_number");
  766. String event_type_name = list.get(i).get("event_type_name");
  767. String report_name = list.get(i).get("report_name");
  768. String role_name = list.get(i).get("role_name");
  769. String dept_id = list.get(i).get("dept_id");
  770. event_type_id = list.get(i).get("event_type_id");
  771. String role_id = list.get(i).get("role_id");
  772. SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
  773. Date date = new Date();
  774. String time = sdf.format(date);
  775. /*sql1 = "update ecm_em_emergency_type_config set REPORT_NAME='"+report_name+"' where role_id='"+role_id+"' "
  776. + "and event_type_id='"+event_type_id+"' and dept_id='"+dept_id+"' and report_name='"+report_name+"'";*/
  777. sql = "insert into ECM_EM_EMERGENCY_TYPE_CONFIG(FD_OBJECTID,SERIAL_NUMBER,EVENT_TYPE_NAME,REPORT_NAME,ROLE_NAME,DEPT_ID,EVENT_TYPE_ID,ROLE_ID,UPDATEDATE,IS_DEL,IS_TYPE) values('"
  778. +fd_objectid+"','"+serial_number+"','"+event_type_name+"','"+report_name+"','"+role_name+"','"+dept_id+"','"+event_type_id+"','"+role_id+"','"+time+ "','0','1');";
  779. log.info("sql====="+sql);
  780. String fd_id=IdentityGenerator.getIdentityGenerator().gerenalIdentity(791);
  781. String fd_id1=IdentityGenerator.getIdentityGenerator().gerenalIdentity(791);
  782. String fd_id2=IdentityGenerator.getIdentityGenerator().gerenalIdentity(791);
  783. String fd_id3=IdentityGenerator.getIdentityGenerator().gerenalIdentity(791);
  784. String fd_id4=IdentityGenerator.getIdentityGenerator().gerenalIdentity(791);
  785. String fd_id5=IdentityGenerator.getIdentityGenerator().gerenalIdentity(791);
  786. String fd_id6=IdentityGenerator.getIdentityGenerator().gerenalIdentity(791);
  787. String fd_id7=IdentityGenerator.getIdentityGenerator().gerenalIdentity(791);
  788. //sql2是默认给报表一级响应勾选中8:00,12:00,16:00,20:00的填报时间
  789. sql2 = "insert into ECM_EM_EVENT_REPORT(FD_OBJECTID,REPORT_ID,WAR_REP_LEVEL,DEPT_ID,DEPT_NAME,REPORT_TIME,IS_DEL,UPDATEDATE) values('"
  790. + fd_id+"','"+fd_objectid+"','1','"+role_id+"','"+role_name+"','8:00;12:00;16:00;20:00','0','"+time+"')";
  791. log.info("sql2====="+sql2);
  792. //sql3是默认给报表二级响应勾选中8:00,12:00,16:00,20:00的填报时间
  793. sql3 = "insert into ECM_EM_EVENT_REPORT(FD_OBJECTID,REPORT_ID,WAR_REP_LEVEL,DEPT_ID,DEPT_NAME,REPORT_TIME,IS_DEL,UPDATEDATE) values('"
  794. + fd_id1+"','"+fd_objectid+"','2','"+role_id+"','"+role_name+"','8:00;12:00;16:00;20:00','0','"+time+"')";
  795. log.info("sql3====="+sql3);
  796. //sql4是默认给报表三级响应勾选中8:00,16:00的填报时间
  797. sql4 = "insert into ECM_EM_EVENT_REPORT(FD_OBJECTID,REPORT_ID,WAR_REP_LEVEL,DEPT_ID,DEPT_NAME,REPORT_TIME,IS_DEL,UPDATEDATE) values('"
  798. + fd_id2+"','"+fd_objectid+"','3','"+role_id+"','"+role_name+"','8:00;16:00','0','"+time+"')";
  799. log.info("sql4====="+sql4);
  800. //sql5是默认给报表四级响应勾选中8:00,16:00的填报时间
  801. sql5 = "insert into ECM_EM_EVENT_REPORT(FD_OBJECTID,REPORT_ID,WAR_REP_LEVEL,DEPT_ID,DEPT_NAME,REPORT_TIME,IS_DEL,UPDATEDATE) values('"
  802. + fd_id3+"','"+fd_objectid+"','4','"+role_id+"','"+role_name+"','8:00;16:00','0','"+time+"')";
  803. log.info("sql5====="+sql5);
  804. //sql6是默认给报表红色预警勾选中8:00,12:00,16:00,20:00的填报时间
  805. sql6 = "insert into ECM_EM_EVENT_REPORT(FD_OBJECTID,REPORT_ID,WAR_REP_LEVEL,DEPT_ID,DEPT_NAME,REPORT_TIME,IS_DEL,UPDATEDATE) values('"
  806. + fd_id4+"','"+fd_objectid+"','5','"+role_id+"','"+role_name+"','8:00;12:00;16:00;20:00','0','"+time+"')";
  807. log.info("sql6====="+sql6);
  808. //sql7是默认给报表红色预警勾选中8:00,12:00,16:00,20:00的填报时间
  809. sql7 = "insert into ECM_EM_EVENT_REPORT(FD_OBJECTID,REPORT_ID,WAR_REP_LEVEL,DEPT_ID,DEPT_NAME,REPORT_TIME,IS_DEL,UPDATEDATE) values('"
  810. + fd_id5+"','"+fd_objectid+"','6','"+role_id+"','"+role_name+"','8:00;12:00;16:00;20:00','0','"+time+"')";
  811. log.info("sql7====="+sql7);
  812. //sql8是默认给报表橙色预警勾选中8:00,16:00的填报时间
  813. sql8 = "insert into ECM_EM_EVENT_REPORT(FD_OBJECTID,REPORT_ID,WAR_REP_LEVEL,DEPT_ID,DEPT_NAME,REPORT_TIME,IS_DEL,UPDATEDATE) values('"
  814. + fd_id6+"','"+fd_objectid+"','7','"+role_id+"','"+role_name+"','8:00;16:00','0','"+time+"')";
  815. log.info("sql8====="+sql8);
  816. //sql9是默认给报表四级响应勾选中8:00,16:00的填报时间
  817. sql9 = "insert into ECM_EM_EVENT_REPORT(FD_OBJECTID,REPORT_ID,WAR_REP_LEVEL,DEPT_ID,DEPT_NAME,REPORT_TIME,IS_DEL,UPDATEDATE) values('"
  818. + fd_id7+"','"+fd_objectid+"','8','"+role_id+"','"+role_name+"','8:00;16:00','0','"+time+"')";
  819. log.info("sql9====="+sql9);
  820. //查询报表是否已配置时间
  821. sql10 = "select * from ECM_EM_EVENT_REPORT where REPORT_ID='"+fd_objectid+"'";
  822. List<String[]> repList = persistence.getSearchResult(791, sql10);
  823. log.info(JSONArray.fromObject(repList).toString());
  824. sqlList.add(sql);
  825. if(repList==null||repList.size()==0){
  826. sqlList.add(sql2);
  827. sqlList.add(sql3);
  828. sqlList.add(sql4);
  829. sqlList.add(sql5);
  830. sqlList.add(sql6);
  831. sqlList.add(sql7);
  832. sqlList.add(sql8);
  833. sqlList.add(sql9);
  834. }
  835. }
  836. //批量插入
  837. jdbc.executeUpdateSQL(sqlList);
  838. //直接返回true,service中直接捕获异常,未抛出异常都是true
  839. return "true";
  840. }
  841. /**
  842. * 突发事件类型报表配置显示
  843. * 2017-03-13谢仲铠新增
  844. */
  845. @Override
  846. public String getEventConfigsShow(String event_type_id,String corp_id)
  847. throws PersistenceException {
  848. String sql="";
  849. if(corp_id.equals("C984DC9C294A486096C25FAA78C99AED")){
  850. sql = "select FD_OBJECTID,SERIAL_NUMBER,REPORT_NAME,EVENT_TYPE_NAME,DEPT_ID,ROLE_NAME,EVENT_TYPE_ID,ROLE_ID,IS_TYPE from ecm_em_emergency_type_config "
  851. + "where is_del='0' and SERIAL_NUMBER <> '2' and EVENT_TYPE_ID='"+event_type_id+"' order by ROLE_NAME";
  852. }else{
  853. sql = "select FD_OBJECTID,SERIAL_NUMBER,REPORT_NAME,EVENT_TYPE_NAME,DEPT_ID,ROLE_NAME,EVENT_TYPE_ID,ROLE_ID,IS_TYPE from ecm_em_emergency_type_config "
  854. + "where is_del='0' and SERIAL_NUMBER <> '101' and EVENT_TYPE_ID='"+event_type_id+"' order by ROLE_NAME";
  855. }
  856. log.info("sql====="+sql);
  857. List<Map<String,String>> list = persistence.getSearchResultToMap(790, sql);
  858. log.info(JSONArray.fromObject(list).toString());
  859. return JSONArray.fromObject(list).toString();
  860. }
  861. /**
  862. * 新增突发事件类型报表配置数据
  863. * 2017-03-10 谢仲铠新增
  864. */
  865. @Override
  866. public String getEventTypeReportTimeConfigDao(List<Map<String,String>> list, JDBCHelper jdbc)
  867. throws PersistenceException {
  868. String sql = "";
  869. String sql1 = "";
  870. //存放sql语句的list
  871. ArrayList<String> sqlList = new ArrayList<String>();
  872. for(int i=0;i<list.size();i++){
  873. String fdid=list.get(i).get("fd_id");
  874. String sql2 = "select * from ECM_EM_EMERGENCY_TYPE_CONFIG where fd_objectid = '"+fdid+"'";
  875. List<Map<String,String>> listMap = persistence.getSearchResultToMap(790, sql2);
  876. String fd_objectid=IdentityGenerator.getIdentityGenerator().gerenalIdentity(791);
  877. //String fd_objectid=list.get(i).get("fd_id");
  878. String report_id = list.get(i).get("fd_id");
  879. String war_rep_level = list.get(i).get("levelConfig");
  880. String dept_id = listMap.get(0).get("ROLE_ID");
  881. String dept_name = listMap.get(0).get("ROLE_NAME");
  882. String report_time = list.get(i).get("timeConfig");
  883. if(report_time.endsWith(",")){
  884. report_time = report_time.substring(0, report_time.length()-1);
  885. report_time = report_time.replaceAll(",", ";");
  886. }
  887. SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
  888. Date date = new Date();
  889. String time = sdf.format(date);
  890. /*sql1 = "update ecm_em_emergency_type_config set REPORT_NAME='"+report_name+"' where role_id='"+role_id+"' "
  891. + "and event_type_id='"+event_type_id+"' and dept_id='"+dept_id+"' and report_name='"+report_name+"'";*/
  892. sql1 = "delete from ECM_EM_EVENT_REPORT where report_id='"+report_id+"'";
  893. log.info("sql1====="+sql);
  894. sql = "insert into ECM_EM_EVENT_REPORT(FD_OBJECTID,REPORT_ID,WAR_REP_LEVEL,DEPT_ID,DEPT_NAME,REPORT_TIME,UPDATEDATE,IS_DEL) values('"
  895. +fd_objectid+"','"+report_id+"','"+war_rep_level+"','"+dept_id+"','"+dept_name+"','"+report_time+"','"+time+ "','0');";
  896. log.info("sql====="+sql);
  897. int result = persistence.executeUpdateSQL(791, sql1);
  898. if(report_time!=""){
  899. sqlList.add(sql);
  900. }
  901. }
  902. //批量插入
  903. jdbc.executeUpdateSQL(sqlList);
  904. //直接返回true,service中直接捕获异常,未抛出异常都是true
  905. return "true";
  906. }
  907. /**
  908. * 默认加载报表配置,勾选报表填报时间
  909. * 2017-03-17谢仲铠新增
  910. */
  911. @Override
  912. public String getEventTypeTimeConfig(String event_type_id)
  913. throws PersistenceException {
  914. String sql = "select a.is_type,a.serial_number,b.* from ecm_em_emergency_type_config a,ecm_em_event_report b where "
  915. + "a.event_type_id='"+event_type_id+"' and a.fd_objectid=b.report_id and b.is_del='0'";
  916. log.info("sql====="+sql);
  917. List<Map<String,String>> list = persistence.getSearchResultToMap(791, sql);
  918. log.info(JSONArray.fromObject(list).toString());
  919. return JSONArray.fromObject(list).toString();
  920. }
  921. /**
  922. * 查询突发事件任务要求
  923. * @param eventTypeId 事件类型id
  924. * @author laieryong 2017-03-17
  925. */
  926. @Override
  927. public String getEmergencyByTaskDemands(String eventTypeId) throws PersistenceException {
  928. String sql = "select typeConfig.FD_OBJECTID,typeConfig.SERIAL_NUMBER,typeConfig.EVENT_TYPE_NAME,typeConfig.REPORT_NAME,typeConfig.ROLE_ID,typeConfig.ROLE_NAME,typeConfig.IS_TYPE,typeConfig.EVENT_TYPE_ID,report.WAR_REP_LEVEL,report.REPORT_TIME "
  929. + "from ECM_EM_EMERGENCY_TYPE_CONFIG typeConfig ,ECM_EM_EVENT_REPORT report "
  930. + "WHERE typeConfig.FD_OBJECTID = report.REPORT_ID AND typeConfig.IS_DEL = '0' AND typeConfig.EVENT_TYPE_ID = '"+eventTypeId+"' "
  931. + " ORDER BY report.WAR_REP_LEVEL ASC,typeConfig.ROLE_NAME ASC";
  932. log.info("sql====="+sql);// TODO classid
  933. List<Map<String,String>> list = persistence.getSearchResultToMap(790, sql);
  934. log.info(JSONArray.fromObject(list).toString());
  935. return JSONArray.fromObject(list).toString();
  936. }
  937. /**
  938. * 新增突发事件类型报告
  939. * @param list
  940. * @param jdbc
  941. * @return
  942. * @author 谢仲铠 2017-03-20
  943. * @throws PersistenceException
  944. */
  945. @Override
  946. public String addEventReportNew(List<Map<String, String>> list,JDBCHelper jdbc) throws PersistenceException {
  947. String sql = "";
  948. String sql1 = "";
  949. String sql2 = "";//一级响应
  950. String sql3 = "";//二级响应
  951. String sql4 = "";//三级响应
  952. String sql5 = "";//四级响应
  953. String sql6 = "";//红色预警
  954. String sql7 = "";//橙色预警
  955. String sql8 = "";//黄色预警
  956. String sql9 = "";//蓝色预警
  957. String sql10 = "";//用于查询报告是否已配置了时间
  958. //存放sql语句的list
  959. ArrayList<String> sqlList = new ArrayList<String>();
  960. for(int i=0;i<list.size();i++){
  961. //String fd_objectid=IdentityGenerator.getIdentityGenerator().gerenalIdentity(790);
  962. String fd_objectid=list.get(i).get("serial_number")+"_"+list.get(i).get("event_type_id");
  963. String serial_number = list.get(i).get("serial_number");
  964. String event_type_name = list.get(i).get("event_type_name");
  965. String report_name = list.get(i).get("report_name");
  966. String role_name = list.get(i).get("role_name");
  967. String dept_id = list.get(i).get("dept_id");
  968. String event_type_id = list.get(i).get("event_type_id");
  969. String role_id = list.get(i).get("role_id");
  970. SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
  971. Date date = new Date();
  972. String time = sdf.format(date);
  973. /*sql1 = "update ecm_em_emergency_type_config set REPORT_NAME='"+report_name+"' where role_id='"+role_id+"' "
  974. + "and event_type_id='"+event_type_id+"' and dept_id='"+dept_id+"' and report_name='"+report_name+"'";*/
  975. sql1 = "delete from ecm_em_emergency_type_config where event_type_id='"+event_type_id+"' and is_type='2'";
  976. log.info("sql1====="+sql1);
  977. sql = "insert into ECM_EM_EMERGENCY_TYPE_CONFIG(FD_OBJECTID,SERIAL_NUMBER,EVENT_TYPE_NAME,REPORT_NAME,ROLE_NAME,DEPT_ID,EVENT_TYPE_ID,ROLE_ID,UPDATEDATE,IS_DEL,IS_TYPE) values('"
  978. +fd_objectid+"','"+serial_number+"','"+event_type_name+"','"+report_name+"','"+role_name+"','"+dept_id+"','"+event_type_id+"','"+role_id+"','"+time+ "','0','2');";
  979. log.info("sql====="+sql);
  980. int result = persistence.executeUpdateSQL(790, sql1);
  981. String fd_id=IdentityGenerator.getIdentityGenerator().gerenalIdentity(791);
  982. String fd_id1=IdentityGenerator.getIdentityGenerator().gerenalIdentity(791);
  983. String fd_id2=IdentityGenerator.getIdentityGenerator().gerenalIdentity(791);
  984. String fd_id3=IdentityGenerator.getIdentityGenerator().gerenalIdentity(791);
  985. String fd_id4=IdentityGenerator.getIdentityGenerator().gerenalIdentity(791);
  986. String fd_id5=IdentityGenerator.getIdentityGenerator().gerenalIdentity(791);
  987. String fd_id6=IdentityGenerator.getIdentityGenerator().gerenalIdentity(791);
  988. String fd_id7=IdentityGenerator.getIdentityGenerator().gerenalIdentity(791);
  989. //sql2是默认给报表一级响应勾选中8:00,17:00的填报时间
  990. sql2 = "insert into ECM_EM_EVENT_REPORT(FD_OBJECTID,REPORT_ID,WAR_REP_LEVEL,DEPT_ID,DEPT_NAME,REPORT_TIME,IS_DEL,UPDATEDATE) values('"
  991. + fd_id+"','"+fd_objectid+"','1','"+role_id+"','"+role_name+"','8:00;17:00','0','"+time+"')";
  992. log.info("sql2====="+sql2);
  993. //sql3是默认给报表二级响应勾选中8:00,17:00的填报时间
  994. sql3 = "insert into ECM_EM_EVENT_REPORT(FD_OBJECTID,REPORT_ID,WAR_REP_LEVEL,DEPT_ID,DEPT_NAME,REPORT_TIME,IS_DEL,UPDATEDATE) values('"
  995. + fd_id1+"','"+fd_objectid+"','2','"+role_id+"','"+role_name+"','8:00;17:00','0','"+time+"')";
  996. log.info("sql3====="+sql3);
  997. //sql4是默认给报表三级响应勾选中17:00的填报时间
  998. sql4 = "insert into ECM_EM_EVENT_REPORT(FD_OBJECTID,REPORT_ID,WAR_REP_LEVEL,DEPT_ID,DEPT_NAME,REPORT_TIME,IS_DEL,UPDATEDATE) values('"
  999. + fd_id2+"','"+fd_objectid+"','3','"+role_id+"','"+role_name+"','17:00','0','"+time+"')";
  1000. log.info("sql4====="+sql4);
  1001. //sql5是默认给报表四级响应勾选中17:00的填报时间
  1002. sql5 = "insert into ECM_EM_EVENT_REPORT(FD_OBJECTID,REPORT_ID,WAR_REP_LEVEL,DEPT_ID,DEPT_NAME,REPORT_TIME,IS_DEL,UPDATEDATE) values('"
  1003. + fd_id3+"','"+fd_objectid+"','4','"+role_id+"','"+role_name+"','17:00','0','"+time+"')";
  1004. log.info("sql5====="+sql5);
  1005. //sql6是默认给报表红色预警勾选中8:00,17:00的填报时间
  1006. sql6 = "insert into ECM_EM_EVENT_REPORT(FD_OBJECTID,REPORT_ID,WAR_REP_LEVEL,DEPT_ID,DEPT_NAME,REPORT_TIME,IS_DEL,UPDATEDATE) values('"
  1007. + fd_id4+"','"+fd_objectid+"','5','"+role_id+"','"+role_name+"','8:00;17:00','0','"+time+"')";
  1008. log.info("sql6====="+sql6);
  1009. //sql7是默认给报表红色预警勾选中8:00,17:00的填报时间
  1010. sql7 = "insert into ECM_EM_EVENT_REPORT(FD_OBJECTID,REPORT_ID,WAR_REP_LEVEL,DEPT_ID,DEPT_NAME,REPORT_TIME,IS_DEL,UPDATEDATE) values('"
  1011. + fd_id5+"','"+fd_objectid+"','6','"+role_id+"','"+role_name+"','8:00;17:00','0','"+time+"')";
  1012. log.info("sql7====="+sql7);
  1013. //sql8是默认给报表橙色预警勾选中17:00的填报时间
  1014. sql8 = "insert into ECM_EM_EVENT_REPORT(FD_OBJECTID,REPORT_ID,WAR_REP_LEVEL,DEPT_ID,DEPT_NAME,REPORT_TIME,IS_DEL,UPDATEDATE) values('"
  1015. + fd_id6+"','"+fd_objectid+"','7','"+role_id+"','"+role_name+"','17:00','0','"+time+"')";
  1016. log.info("sql8====="+sql8);
  1017. //sql9是默认给报表四级响应勾选中17:00的填报时间
  1018. sql9 = "insert into ECM_EM_EVENT_REPORT(FD_OBJECTID,REPORT_ID,WAR_REP_LEVEL,DEPT_ID,DEPT_NAME,REPORT_TIME,IS_DEL,UPDATEDATE) values('"
  1019. + fd_id7+"','"+fd_objectid+"','8','"+role_id+"','"+role_name+"','17:00','0','"+time+"')";
  1020. log.info("sql9====="+sql9);
  1021. sqlList.add(sql);
  1022. //查询报表是否已配置时间
  1023. sql10 = "select * from ECM_EM_EVENT_REPORT where REPORT_ID='"+fd_objectid+"'";
  1024. List<String[]> repList = persistence.getSearchResult(791, sql10);
  1025. log.info(JSONArray.fromObject(repList).toString());
  1026. if(repList==null || repList.size()==0){
  1027. if(serial_number=="988"){
  1028. sqlList.add(sql6);
  1029. sqlList.add(sql7);
  1030. sqlList.add(sql8);
  1031. sqlList.add(sql9);
  1032. }else if(serial_number=="987"||serial_number=="989"){
  1033. sqlList.add(sql2);
  1034. sqlList.add(sql3);
  1035. sqlList.add(sql4);
  1036. sqlList.add(sql5);
  1037. }
  1038. }
  1039. }
  1040. //批量插入
  1041. jdbc.executeUpdateSQL(sqlList);
  1042. //直接返回true,service中直接捕获异常,未抛出异常都是true
  1043. return "true";
  1044. }
  1045. /**
  1046. * 查询事件编号是否重复
  1047. * 2017-04-10 谢仲铠
  1048. */
  1049. public String selEventType(String PLAN_TYPE_ID){
  1050. String result="";
  1051. String sql = "select * from ECM_EM_EMERGENCY_TYPE where PLAN_TYPE_ID='"+PLAN_TYPE_ID+"'";
  1052. try {
  1053. List<Map<String,String>> list = persistence.getSearchResultToMap(789, sql);
  1054. if(list.size()==0){
  1055. result="success";
  1056. }else{
  1057. result="error";
  1058. }
  1059. } catch (PersistenceException e) {
  1060. e.printStackTrace();
  1061. }
  1062. return result;
  1063. }
  1064. /**
  1065. * 新增突发事件类型
  1066. * @param list
  1067. * @param jdbc
  1068. * @return
  1069. * @author 谢仲铠 2017-04-10
  1070. * @throws PersistenceException
  1071. */
  1072. @Override
  1073. public String saveEventTypes(List<Map<String, String>> list, JDBCHelper jdbc)
  1074. throws PersistenceException {
  1075. String FD_OBJECTID = list.get(0).get("FD_OBJECTID");
  1076. String EVENT_NUMBER = list.get(0).get("EVENT_NUMBER");
  1077. String EVENT_TYPE_NAME = list.get(0).get("EVENT_TYPE_NAME");
  1078. String LEAD_DEPARTMENT = list.get(0).get("LEAD_DEPARTMENT");
  1079. String INPUT_PERSON = list.get(0).get("INPUT_PERSON");
  1080. String INPUT_UNIT = list.get(0).get("INPUT_UNIT");
  1081. String INPUT_DEPARTMENT = list.get(0).get("INPUT_DEPARTMENT");
  1082. String INPUT_PERSON_ID = list.get(0).get("INPUT_PERSON_ID");
  1083. String INPUT_UNIT_ID = list.get(0).get("INPUT_UNIT_ID");
  1084. String INPUT_DEPARTMENT_ID = list.get(0).get("INPUT_DEPARTMENT_ID");
  1085. String PLAN_TYPE_ID = list.get(0).get("PLAN_TYPE_ID");
  1086. String EVENT_MESSAGE = list.get(0).get("EVENT_MESSAGE");
  1087. SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
  1088. Date date = new Date();
  1089. String time = sdf.format(date);
  1090. String sql = "insert into ECM_EM_EMERGENCY_TYPE(FD_OBJECTID,EVENT_NUMBER,EVENT_TYPE_NAME,LEAD_DEPARTMENT,INPUT_PERSON,INPUT_UNIT,INPUT_DEPARTMENT,INPUT_TIME,IS_DEL,UPDATEDATE,INPUT_PERSON_ID,INPUT_UNIT_ID,INPUT_DEPARTMENT_ID,PLAN_TYPE_ID,EVENT_MESSAGE) values('"
  1091. +FD_OBJECTID+"','"+EVENT_NUMBER+"','"+EVENT_TYPE_NAME+"','"+LEAD_DEPARTMENT+"','"+INPUT_PERSON+"','"+INPUT_UNIT+"','"+INPUT_DEPARTMENT+"','"+time+"','0','"+time+"','"+INPUT_PERSON_ID+"','"+INPUT_UNIT_ID+"','"+INPUT_DEPARTMENT_ID+"','"+PLAN_TYPE_ID+"','"+EVENT_MESSAGE+"')";
  1092. ArrayList<String> sqlList = new ArrayList<String>();
  1093. sqlList.add(sql);
  1094. //批量插入
  1095. jdbc.executeUpdateSQL(sqlList);
  1096. //直接返回true,service中直接捕获异常,未抛出异常都是true
  1097. return "success";
  1098. }
  1099. @Override
  1100. public String updateEventTypes(List<Map<String, String>> list,
  1101. JDBCHelper jdbc) throws PersistenceException {
  1102. String FD_OBJECTID = list.get(0).get("FD_OBJECTID");
  1103. String EVENT_NUMBER = list.get(0).get("EVENT_NUMBER");
  1104. String EVENT_TYPE_NAME = list.get(0).get("EVENT_TYPE_NAME");
  1105. String LEAD_DEPARTMENT = list.get(0).get("LEAD_DEPARTMENT");
  1106. String INPUT_PERSON = list.get(0).get("INPUT_PERSON");
  1107. String INPUT_UNIT = list.get(0).get("INPUT_UNIT");
  1108. String INPUT_DEPARTMENT = list.get(0).get("INPUT_DEPARTMENT");
  1109. String INPUT_PERSON_ID = list.get(0).get("INPUT_PERSON_ID");
  1110. String INPUT_UNIT_ID = list.get(0).get("INPUT_UNIT_ID");
  1111. String INPUT_DEPARTMENT_ID = list.get(0).get("INPUT_DEPARTMENT_ID");
  1112. String PLAN_TYPE_ID = list.get(0).get("PLAN_TYPE_ID");
  1113. String EVENT_MESSAGE = list.get(0).get("EVENT_MESSAGE");
  1114. String id = list.get(0).get("id");
  1115. SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
  1116. Date date = new Date();
  1117. String time = sdf.format(date);
  1118. String sql = "update ECM_EM_EMERGENCY_TYPE set FD_OBJECTID='"+FD_OBJECTID+"',EVENT_NUMBER='"+EVENT_NUMBER+"',EVENT_TYPE_NAME='"+EVENT_TYPE_NAME+"',"
  1119. + "LEAD_DEPARTMENT='"+LEAD_DEPARTMENT+"',INPUT_PERSON='"+INPUT_PERSON+"',INPUT_UNIT='"+INPUT_UNIT+"',INPUT_DEPARTMENT='"+INPUT_DEPARTMENT+"',"
  1120. + "UPDATEDATE='"+time+"',INPUT_PERSON_ID='"+INPUT_PERSON_ID+"',INPUT_UNIT_ID='"+INPUT_UNIT_ID+"',INPUT_DEPARTMENT_ID='"+INPUT_DEPARTMENT_ID+"',"
  1121. + "PLAN_TYPE_ID='"+PLAN_TYPE_ID+"',EVENT_MESSAGE='"+EVENT_MESSAGE+"' where FD_OBJECTID='"+id+"'";
  1122. ArrayList<String> sqlList = new ArrayList<String>();
  1123. sqlList.add(sql);
  1124. //批量插入
  1125. jdbc.executeUpdateSQL(sqlList);
  1126. //直接返回true,service中直接捕获异常,未抛出异常都是true
  1127. return "success";
  1128. }
  1129. }