package com.sinosoft.em.event.dao; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; import java.util.List; import java.util.Map; import net.sf.json.JSONArray; import org.apache.log4j.Logger; import com.persistence.service.JDBCHelper; import com.persistence.service.PersistenceFactory; import com.persistence.service.SysPersistence; import com.persistence.service.assitant.generator.IdentityGenerator; import com.persistence.service.exception.PersistenceException; import com.persistence.service.exception.TransformTypeException; import com.sinosoft.common.util.DateUtil; import com.sysmodel.datamodel.xmlmodel.ModelFactory; import com.sysmodel.datamodel.xmlmodel.able.MdpConstant; import com.sysmodel.datamodel.xmlmodel.able.SysModel; /** * 突发事件管理dao接口 * @author zhuanghuiliang * @date 2015-10-28 */ public class EventDaoImpl implements EventDaoAble{ //日志对象 private static final Logger log = Logger.getLogger(EventDaoImpl.class); private static SysModel sysmodel = ModelFactory.getSysmodel(); private static SysPersistence persistence = PersistenceFactory.getInstance(sysmodel); /** * 根据上次预警/响应单号查询上次预警/响应信息 * * @param prevId 上次预警编号 * @param fd_id * @return * @throws PersistenceException */ public List> getInfoByPrevId(String prevId,String comp_id, String fd_id) throws PersistenceException { // TODO Auto-generated method stub // 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+"'"; 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,"+ "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 FD_OBJECTID = '"+prevId+"' and "+ "RELEASE_UNIT = '"+comp_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')) and A.FD_OBJECTID!='"+fd_id+"' "; log.info("==="+sql); List> list = persistence.getSearchResultToMap(365, sql); if(list!=null&&list.size()>0){ Map map = list.get(list.size()-1); String prev_ew_id = map.get("IS_LAST_ID"); String prev_warning_id = map.get("FD_OBJECTID"); if(prev_ew_id!=null&&!prev_ew_id.equals("")){ //递归查询 list.addAll(getInfoByPrevId(prev_ew_id,comp_id,prev_warning_id)); } return list; }else{ return null; } } @Override public String getEventInfoByPrevId(String prevId,String fd_id,String comp_id) throws PersistenceException{ List> list = getNoticeInfoById(fd_id); List> list1 = getInfoByPrevId(prevId,comp_id,fd_id); if(list!=null&&list1!=null){ list.addAll(list1); } log.info(JSONArray.fromObject(list).toString()); return JSONArray.fromObject(list).toString(); } /** * 根据预警/响应单号查询通知单信息 * * @param fd_id 预警/响应编号 * @return * @throws PersistenceException */ public List> getNoticeInfoById(String fd_id) throws PersistenceException{ //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+"'"; 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'))"; List> list=persistence.getSearchResultToMap(320, sql); return list; } /** * 根据预警/响应单号查询报告信息 * * @param fd_id 预警/响应编号 * @return * @throws PersistenceException */ public String getReportInfoById(String fd_id) throws PersistenceException{ String sql = "SELECT FD_OBJECTID FROM ECM_EM_ALERT_REPORT_PLAN WHERE EARLY_WARNING_ID='"+fd_id+"'"; List list=persistence.getSearchResult(320, sql); if(list!=null&&list.size()>0){ return JSONArray.fromObject(list.get(0)).toString(); } return null; } /** * 根据预警/响应单号查询报表信息 * * @param fd_id 预警/响应编号 * @return * @throws PersistenceException */ public String getBaobiaoInfoById(String fd_id) throws PersistenceException{ String sql = "SELECT FD_OBJECTID FROM REPORT_SCHEDULE WHERE WARNING_NUMBER='"+fd_id+"'"; List list=persistence.getSearchResult(337, sql); if(list!=null&&list.size()>0){ return JSONArray.fromObject(list.get(0)).toString(); } return null; } /** * 查询上下级单位当前预警/响应信息 * * @param deptId 当前登录用户所属单位id * @return */ public String getParentAndChildrenInfo(String deptId,String planTypeId)throws PersistenceException{ 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+"')"; List list=persistence.getSearchResult(365, sql); String depts = ""; if(list!=null&&list.size()>0){ for(String[] s:list){ depts += "'"+s[0]+"',"; } if(!depts.equals("")){ depts = depts.substring(0,depts.length()-1); sql = "SELECT RELEASE_UNIT,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,DEPT_NAME RELEASE_UNIT_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') " + "left join sys_department on dept_id=RELEASE_UNIT "+ " WHERE RELEASE_UNIT in ("+depts+") and IS_SEND='5' and PLAN_TYPE_ID='"+planTypeId+"'"; 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' and PLAN_TYPE_ID='"+planTypeId+"'"; List> list1 =persistence.getSearchResultToMap(365, sql); return JSONArray.fromObject(list1).toString(); } } return null; } public String getParentAndChildrenInfo(String deptId)throws PersistenceException{ 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+"')"; List list=persistence.getSearchResult(365, sql); String depts = ""; if(list!=null&&list.size()>0){ for(String[] s:list){ depts += "'"+s[0]+"',"; } if(!depts.equals("")){ depts = depts.substring(0,depts.length()-1); sql = "SELECT RELEASE_UNIT,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,DEPT_NAME RELEASE_UNIT_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') " + "left join sys_department on dept_id=RELEASE_UNIT WHERE RELEASE_UNIT in ("+depts+") and IS_SEND='5'"; 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'"; List> list1 =persistence.getSearchResultToMap(365, sql); return JSONArray.fromObject(list1).toString(); } } return null; } @Override public List getDeptIds(String deptId) throws PersistenceException { // TODO Auto-generated method stub String sql = "SELECT DEPT_ID,PARENT_ID,DEPT_NAME,DEPT_TYPE FROM SYS_DEPARTMENT WHERE " + "dept_type='1' AND" + "(DEPT_ID=(SELECT PARENT_ID FROM SYS_DEPARTMENT WHERE DEPT_ID='"+deptId+"') " + "OR DEPT_ID='"+deptId+"' " + "OR PARENT_ID='"+deptId+"')"; List list=persistence.getSearchResult(800, sql); if(list!=null&&list.size()>0){ return list; }else{ return null; } } @Override public List getNoticeByDeptIds(String con) throws PersistenceException { // TODO Auto-generated method stub String sql = "SELECT FD_OBJECTID,RELEASE_UNIT,EARLY_WARNING_ID,IS_ALERT FROM ECM_EM_PUBLISH_ALERT_NOTICE " + "WHERE IS_DEL = 0 AND IS_SEND = 5 AND RELEASE_UNIT IN"+con; log.info(sql); List list=persistence.getSearchResult(365, sql); if(list!=null&&list.size()>0){ return list; }else{ return null; } } @Override public List getEventByDeptIds(String con,String eventId) throws PersistenceException { // TODO Auto-generated method stub String sql = "SELECT FD_OBJECTID,ISSUE_UNITE_ID,EVENT_NAME FROM ECM_EM_EVENT_NAME " + "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; log.info(sql); List list=persistence.getSearchResult(365, sql); if(list!=null&&list.size()>0){ return list; }else{ return null; } } @Override public String saveBindInfo(String fd_id, String noticeIds,JDBCHelper jdbc) throws TransformTypeException, PersistenceException{ // TODO Auto-generated method stub //先删除已绑定的记录 String sql = "delete from ECM_EM_EVENT_BINDING where mainid='"+fd_id+"'"; jdbc.executeUpdateSQL(sql); //如果通知单id为空,直接返回 if(noticeIds==null||noticeIds.equals("")){ return "true"; } //存放sql语句的list ArrayList list = new ArrayList(); for(int i=0;i getNoticeByEventId(String fd_id) throws PersistenceException { // TODO Auto-generated method stub String sql = "SELECT NOTICEID FROM ECM_EM_EVENT_BINDING " + "WHERE MAINID ='"+fd_id+"'"; log.info(sql); List list=persistence.getSearchResult(365, sql); if(list!=null&&list.size()>0){ return list; }else{ return null; } } @Override public List getSelectEventByEventId(String fd_id) throws PersistenceException { // TODO Auto-generated method stub String sql = "SELECT b.EVENT_ID FROM BM_ECM_EVENT_CONNECTION a,BM_ECM_EVENT_CONNECTION b " + "WHERE a.CONNECTION=b.CONNECTION and a.EVENT_ID ='"+fd_id+"' "; log.info(sql); List list=persistence.getSearchResult(365, sql); if(list!=null&&list.size()>0){ return list; }else{ return null; } } /** * 根据事件id查询已绑定的通知单信息 * * @param fd_id 事件id * @return * @throws PersistenceException */ public String getNoticeInfoByEventId(String fd_id) throws PersistenceException{ String sql = "SELECT NOTICEID FROM ECM_EM_EVENT_BINDING WHERE MAINID ='"+fd_id+"' "; List list=persistence.getSearchResult(396, sql); String noticeIds = ""; if(list!=null&&list.size()>0){ for(String[] s:list){ noticeIds += "'"+s[0]+"',"; } if(!noticeIds.equals("")){ noticeIds = noticeIds.substring(0,noticeIds.length()-1); sql = "SELECT RELEASE_UNIT,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,DEPT_NAME RELEASE_UNIT_SHOW,T.FD_OBJECTID " + "FROM ECM_EM_PUBLISH_ALERT_NOTICE t left join BM_MapValueCanst on CURRENT_EW_LEVEL =fd_code or CURRENT_ER_LEVEL=fd_code " + "left join sys_department on dept_id=RELEASE_UNIT WHERE t.FD_OBJECTID in ("+noticeIds+") and t.is_del=0 order by release_unit"; List> list1 =persistence.getSearchResultToMap(365, sql); return JSONArray.fromObject(list1).toString(); } } return null; } @Override public String deeteEvent(String mainids, JDBCHelper jdbc) throws PersistenceException{ // TODO Auto-generated method stub if(mainids==null||mainids.equals("")){ return "true"; } String sql = "update ECM_EM_EVENT_NAME set is_del=1 where FD_OBJECTID IN ("+String2SqlString(mainids)+")"; jdbc.executeUpdateSQL(sql); sql = "DELETE FROM BM_ECM_EVENT_CONNECTION WHERE EVENT_ID IN ("+String2SqlString(mainids)+")"; jdbc.executeUpdateSQL(sql); System.out.println(mainids); return "true"; } public String String2SqlString(String str){ String s = ""; if(str.indexOf(",")==-1){ return "'"+str+"'"; }else{ String[] strs = str.split(","); for(int i=0;i list=persistence.getSearchResult(365, sql); String depts = ""; if(list!=null&&list.size()>0){ for(String[] s:list){ depts += "'"+s[0]+"',"; } } if(!depts.equals("")){ depts = depts.substring(0,depts.length()-1); sql = "select d1.leader_name leader_name,d1.leader_tel leader_tel," + "d1.name name,d1.telephone telephone,d3.dept_id,sysdate, " + "start_time,END_TIME,d3.DEPT_NAME DEPT_NAME " + " from ECM_EM_DUTY_DETAIL d1 left join ECM_EM_DUTY d2" + " on d1.DUTY_ID =d2.fd_objectid" + " left join SYS_DEPARTMENT d3 " + " on d2.DEPT_NAMES=d3.dept_id " + " where sysdate between START_TIME and END_TIME and d2.DEPT_NAMES in("+depts+") and d1.is_del=0 and d2.RELEASE='1'" + " ORDER BY d3.dept_id"; log.info("sql====="+sql); List> list1 = persistence.getSearchResultToMap(336, sql); log.info(JSONArray.fromObject(list1).toString()); return JSONArray.fromObject(list1).toString(); }else{ return null; } } /** * 查询政府通知单信息 * @param deptId 单位id * @return */ @Override public String getGovInfo(String deptId) throws PersistenceException { // TODO Auto-generated method stub List> list = getGovWarningInfo(deptId); List> list1 = getGovResponseInfo(deptId); list.addAll(list1); List> list2 = new ArrayList>(); SysModel sysmodel = ModelFactory.getSysmodel(); //取得内存中的常量表数据 MdpConstant m1 = sysmodel.getMdpConstantByName("BM_EMC_WarningName"); MdpConstant m2 = sysmodel.getMdpConstantByName("BM_REPONSELEVEL"); MdpConstant m3 = sysmodel.getMdpConstantByName("BM_WarningState"); MdpConstant m4 = sysmodel.getMdpConstantByName("BM_PublishState"); for(Map map:list){ map.put("NOTICETYPE", m1.getMdpConstantDisplayString(map.get("NOTICETYPE"))); if("response".equalsIgnoreCase(map.get("TYPE"))){ map.put("LEVEL", m2.getMdpConstantDisplayString(map.get("LEVEL"))); }else{ map.put("LEVEL", m3.getMdpConstantDisplayString(map.get("LEVEL"))); } map.put("STATUS", m4.getMdpConstantDisplayString(map.get("STATUS"))); list2.add(map); } log.info(JSONArray.fromObject(list2).toString()); return JSONArray.fromObject(list2).toString(); } @Override public String getGovInfo(String deptId,String planTypeId369,String eventId) throws PersistenceException { // TODO Auto-generated method stub List> list = getGovWarningInfo(deptId,planTypeId369,eventId); List> list1 = getGovResponseInfo(deptId,planTypeId369,eventId); list.addAll(list1); List> list2 = new ArrayList>(); SysModel sysmodel = ModelFactory.getSysmodel(); //取得内存中的常量表数据 MdpConstant m1 = sysmodel.getMdpConstantByName("BM_EMC_WarningName"); MdpConstant m2 = sysmodel.getMdpConstantByName("BM_REPONSELEVEL"); MdpConstant m3 = sysmodel.getMdpConstantByName("BM_WarningState"); MdpConstant m4 = sysmodel.getMdpConstantByName("BM_PublishState"); for(Map map:list){ map.put("NOTICETYPE", m1.getMdpConstantDisplayString(map.get("NOTICETYPE"))); if("response".equalsIgnoreCase(map.get("TYPE"))){ map.put("LEVEL", m2.getMdpConstantDisplayString(map.get("LEVEL"))); }else{ map.put("LEVEL", m3.getMdpConstantDisplayString(map.get("LEVEL"))); } map.put("STATUS", m4.getMdpConstantDisplayString(map.get("STATUS"))); list2.add(map); } log.info(JSONArray.fromObject(list2).toString()); return JSONArray.fromObject(list2).toString(); } /** * 查询政府预警通知单信息 * @param deptId 单位id * @param planTypeId369 政府或气象预警通知单--预警类别 * @return */ public List> getGovWarningInfo(String deptId) throws PersistenceException { // TODO Auto-generated method stub 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," + "b.corp_id,b.corp_name,'warning' as type" + " from ECM_EM_GOV_ALERT_NOTICE a left join sys_department b on a.WRITE_DEPT = b.dept_id " // + "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')"; + "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')"; return persistence.getSearchResultToMap(369, sql); } public List> getGovWarningInfo(String deptId,String planTypeId369,String eventId) throws PersistenceException { // TODO Auto-generated method stub 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," + "b.corp_id,b.corp_name,'warning' as type" + " from ECM_EM_GOV_ALERT_NOTICE a left join sys_department b on a.WRITE_DEPT = b.dept_id " // + "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') " + "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') " +" and EARLY_WARNING_NAME='"+planTypeId369+"'";//and EVENT_ID='"+eventId+"'"; return persistence.getSearchResultToMap(369, sql); } /** * 查询政府响应通知单信息 * @param deptId 单位id * @param planTypeId369 政府或气象预警通知单--预警类别 * @return */ public List> getGovResponseInfo(String deptId) throws PersistenceException { // TODO Auto-generated method stub 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," + "b.corp_id,b.corp_name,'response' as type" + " from ECM_EM_GOV_RESPONSE_NOTICE a left join sys_department b on a.WRITE_DEPT = b.dept_id " // + "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')"; + "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')"; return persistence.getSearchResultToMap(370, sql); } public List> getGovResponseInfo(String deptId,String planTypeId370,String eventId) throws PersistenceException { // TODO Auto-generated method stub 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," + "b.corp_id,b.corp_name,'response' as type" + " from ECM_EM_GOV_RESPONSE_NOTICE a left join sys_department b on a.WRITE_DEPT = b.dept_id " // + "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') " + "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') " +" and RESPONSE_NAME='"+planTypeId370+"'"; //and EVENT_ID='"+eventId+"'"; return persistence.getSearchResultToMap(370, sql); } /** * 查询报表信息 * @param deptId 单位id * @return */ public String getBaobiaoInfo(String warningId,String deptId) throws PersistenceException { // TODO Auto-generated method stub //查询填报计划表返回的list List list = new ArrayList(); List list1 = null; //用于拼接 String str0 = "应急办:R002105430210;"; String str1 = "R002105430211;"; String str2 = "R002105430212;"; String str3 = "R002105430213;"; String str = ""; String sql = "select report_dept from REPORT_SCHEDULE " + "where warning_number like'"+warningId+"' and comp_id='"+deptId+"' and is_del='0' and SEND_STAT='1'" + " and (" + " report_dept like ('R002105430210%')" + " or report_dept like ('R002105430211%')" + " or report_dept like ('R002105430212%')" + " or report_dept like ('R002105430213%')" + " )"; System.out.println("sql==============="+sql); //返回数据格式 //应急办:R002105430210;线路停运及恢复情况表,变电站停运及恢复情况表|R002105430211;线路倒杆情况统计表,线路及配变受损情况表|R002105430212;供电损失及客户停电情况表,行政区域停电情况表|R002105430213;预警发布或响应启动情况表,应急资源情况表 //应急办:R002105430210;线路停运及恢复情况表,变电站停运及恢复情况表|R002105430211;线路倒杆情况统计表,线路及配变受损情况表|R002105430212;供电损失及客户停电情况表,行政区域停电情况表|R002105430213;预警发布或响应启动情况表,应急资源情况表 list1 =persistence.getSearchResult(337, sql); for(int i=0;i-1){; str0+=list1.get(i)[0].split(";")[2]+","; }else if(list1.get(i)[0].indexOf("R002105430211")>-1){; str1+=list1.get(i)[0].split(";")[2]+","; }else if(list1.get(i)[0].indexOf("R002105430212")>-1){; str2+=list1.get(i)[0].split(";")[2]+","; }else if(list1.get(i)[0].indexOf("R002105430213")>-1){; str3+=list1.get(i)[0].split(";")[2]+","; } } str0 = str0.substring(0, str0.length()-1); str1 = str1.substring(0, str1.length()-1); str2 = str2.substring(0, str2.length()-1); str3 = str3.substring(0, str3.length()-1); str=str0+"|"+str1+"|"+str2+"|"+str3; String [] tempArray = new String []{str}; list.add(tempArray); //存放计划表里查询出的报表类型 StringBuffer typeName = new StringBuffer(); String time =null; String temp = ""; String[] temps =null; if(list!=null&&list.size()>0){ temp =list.get(0)[0]; //计划发布时间 //time = list.get(0)[1]; temp = temp.split(":")[1]; temps = temp.split("\\|"); for(int i=0;i'"+time+"'GROUP BY REPORT_TYPE,COMP_ID) B " // + "ON A.REPORT_TYPE=B.REPORT_TYPE WHERE A.REPORT_NAME IN("+condition+") ORDER BY A.REPORT_TYPE"; //为了演示 先去掉时间过滤 String sql = "SELECT A.REPORT_NAME,A.DEPT_NAME,B.REPORT_TIME FROM BM_MAPFORREPORT A LEFT JOIN " + "(SELECT REPORT_TYPE, MAX(REPORT_TIME) REPORT_TIME FROM REPORT_RECORDS c WHERE " + "COMP_ID='"+deptId+"'" + " 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%'))" + " GROUP BY REPORT_TYPE,COMP_ID) B " + "ON A.REPORT_TYPE=B.REPORT_TYPE WHERE A.REPORT_NAME IN("+condition+") ORDER BY A.REPORT_TYPE"; List> list =persistence.getSearchResultToMap(780, sql); return JSONArray.fromObject(list).toString(); } /** * 查询报告信息 * @param deptId 单位id * @return */ public String getBaogaoInfo(String warningId,String deptId,String is_alert) throws PersistenceException { List> planList=getBaogao(warningId); //填报要求id String planId = ""; //报告类型 String reportType = ""; //填报要求中存放的填报部门id String compName =""; if(planList!=null&&planList.size()>0){ Map map = planList.get(0); planId = map.get("FD_OBJECTID"); String temp = map.get("REPORT_TYPE"); for(int i=0;i> list = persistence.getSearchResultToMap(321, sql); if(list!=null&&list.size()>0){ List> list1 = new ArrayList>(); for(Map map:list){ //单位名称 map.put("INPUT_UNIT_SHOW", getComp_name(map.get("INPUT_UNIT"))); list1.add(map); } String result = JSONArray.fromObject(list1).toString(); log.info(result); return result; } return ""; } //根据预警/响应编号查询报告填报要求 private List> getBaogao(String warningId) throws PersistenceException{ if(warningId==null||warningId.equals("")){ return null; } 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"; List> list = persistence.getSearchResultToMap(320, sql); return list; } //查询部门所属单位名称 private String getComp_name(String deptId) throws PersistenceException{ if(deptId==null||deptId.equals("")){ return ""; } String sql = "select corp_name from sys_department where dept_id='"+deptId+"'"; List> list = persistence.getSearchResultToMap(321, sql); if(list!=null&&list.size()>0){ return list.get(0).get("CORP_NAME"); }else{ return ""; } } /** * 查询本单位当前处于发布状态的预警和响应通知单 * @param params * @return * @throws PersistenceException */ @Override public String getInfoByUnit(String deptId) throws PersistenceException{ if(deptId==null||deptId.equals("")){ return ""; } String sql = "SELECT A.FD_OBJECTID,A.EARLY_WARNING_NAME,A.EARLY_WARNING_ID,A.RELEASE_UNIT," + "B.DEPT_NAME RELEASE_UNIT_SHOW,A.RELEASE_RELIEVE_DATE,A.IS_ALERT " + "FROM ECM_EM_PUBLISH_ALERT_NOTICE A LEFT JOIN SYS_DEPARTMENT B " + "ON A.RELEASE_UNIT=B.DEPT_ID " + "WHERE IS_SEND = '5' AND A.IS_DEL=0 AND RELEASE_UNIT='"+deptId+"' ORDER BY A.RELEASE_RELIEVE_DATE DESC"; List> list =persistence.getSearchResultToMap(365, sql); return JSONArray.fromObject(list).toString(); } /** * 查询值班信息按照日期 * * @param deptId 单位id * @param d 日期 * @return */ @Override public String getDutyInfoByDate(String deptId, String d) throws PersistenceException{ // TODO Auto-generated method stub if(deptId==null||deptId.equals("")){ return ""; } //如果没传日期,默认查询当天的 if(d==null||d.equals("")){ d=DateUtil.format(new Date()); } String sql = ""; /*String sql = "select dept_id from sys_department where parent_Id='"+deptId+"' or dept_id='"+deptId+"'"; List list=persistence.getSearchResult(365, sql); String depts = ""; if(list!=null&&list.size()>0){ for(String[] s:list){ depts += "'"+s[0]+"',"; } } */ if(!deptId.equals("")){ //depts = depts.substring(0,depts.length()-1); sql = "select d1.DUTY_NAME leader_name,d1.DUTY_NAME_TEL leader_tel," + "d1.DATE_TIME,d3.dept_id,substr(d1.DAY_TIME,0,10) DUTY_DATE, " + "d3.DEPT_NAME DEPT_NAME ,d3.CORP_NAME CORP_NAME " + " from ECM_EM_DUTY_ALERT_INFO d1 left join ECM_EM_DUTY d2" + " on d1.DUTY_ID =d2.fd_objectid" + " left join SYS_DEPARTMENT d3 " + " on d2.DEPT_NAMES=d3.dept_id " //+ " left join BM_MAPVALUECANST d4 " //+ " on d4.FD_TYPE='BM_DUTYWAYSTATE' AND d4.FD_CODE=d1.DUTY_WAY " + " where d1.DAY_TIME in ('"+d+"') and d3.CORP_ID in('"+deptId+"') and d2.is_del='0' and d2.RELEASE='1'" + " ORDER BY d1.DUTY_NAME"; log.info("sql====="+sql); List> list1 = persistence.getSearchResultToMap(336, sql); log.info(JSONArray.fromObject(list1).toString()); return JSONArray.fromObject(list1).toString(); }else{ return null; } } /** * 查询预案启动条件 * * @param planId 预案id * @param gradeType 1突发事件 2预警 3响应 4应对措施 * @return */ @Override public String getStartCondition(String planId, String gradeType) throws PersistenceException{ // TODO Auto-generated method stub String type = getPlanType(planId); String sql = "select FRIST_GRADE,SECOND_GRADE,THRID_GRADE,FOURTH_GRADE from EMC_EM_PLAN_GRADE_NEXUS " + "where FILLER1='"+planId+"' and GRADE_TYPE='" + type + "_" +gradeType+"'"; log.info("sql====="+sql); List> list = persistence.getSearchResultToMap(215, sql); log.info(JSONArray.fromObject(list).toString()); return JSONArray.fromObject(list).toString(); } /** * 查询预案类型 * * @param planId 预案id * @return */ public String getPlanType(String planId) throws PersistenceException{ String sql = "select PLAN_REFINE_CATEGORY from ECM_AM_YJYASERVER " + "where fd_objectid='"+planId+"'"; log.info("sql====="+sql); List list = persistence.getSearchResult(214, sql); log.info(JSONArray.fromObject(list).toString()); if(list!=null&&list.size()>0){ return list.get(0)[0]; }else{ return ""; } } /** * 预警/响应信息接收中,解除上次预警/响应通知单 * * @param objectid 通知单主键 * @param classid * @return */ @Override public void changeStatus(String objectid,String classid) throws PersistenceException{ // TODO Auto-generated method stub String sql = "update ECM_EM_GOV_ALERT_NOTICE set EARLY_WARNING_STATUS='34',IS_DEL='1' where fd_objectid='"+objectid+"'"; //状态 33:发布 34:解除 //classid 369:预警 370:响应 if("370".equals(classid)){ sql = "update ECM_EM_GOV_RESPONSE_NOTICE set RESPONSE_STATUS='34',IS_DEL='1' where fd_objectid='"+objectid+"'"; } persistence.executeUpdateSQL(369, sql); } /** * 新增突发事件类型报表配置数据 * 2017-03-10 谢仲铠新增 */ @Override public String getEventTypeRepConfigs(List> list, JDBCHelper jdbc,String event_type_id) throws PersistenceException { String sql = ""; String sql1 = ""; String sql2 = "";//一级响应 String sql3 = "";//二级响应 String sql4 = "";//三级响应 String sql5 = "";//四级响应 String sql6 = "";//红色预警 String sql7 = "";//橙色预警 String sql8 = "";//黄色预警 String sql9 = "";//蓝色预警 String sql10 = "";//用于查询报表是否已配置了时间 sql1 = "delete from ecm_em_emergency_type_config where event_type_id='"+event_type_id+"' and is_type='1'"; log.info("sql1====="+sql1); int result = persistence.executeUpdateSQL(790, sql1); //存放sql语句的list ArrayList sqlList = new ArrayList(); for(int i=0;i repList = persistence.getSearchResult(791, sql10); log.info(JSONArray.fromObject(repList).toString()); sqlList.add(sql); if(repList==null||repList.size()==0){ sqlList.add(sql2); sqlList.add(sql3); sqlList.add(sql4); sqlList.add(sql5); sqlList.add(sql6); sqlList.add(sql7); sqlList.add(sql8); sqlList.add(sql9); } } //批量插入 jdbc.executeUpdateSQL(sqlList); //直接返回true,service中直接捕获异常,未抛出异常都是true return "true"; } /** * 突发事件类型报表配置显示 * 2017-03-13谢仲铠新增 */ @Override public String getEventConfigsShow(String event_type_id,String corp_id) throws PersistenceException { String sql=""; if(corp_id.equals("C984DC9C294A486096C25FAA78C99AED")){ 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 " + "where is_del='0' and SERIAL_NUMBER <> '2' and EVENT_TYPE_ID='"+event_type_id+"' order by ROLE_NAME"; }else{ 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 " + "where is_del='0' and SERIAL_NUMBER <> '101' and EVENT_TYPE_ID='"+event_type_id+"' order by ROLE_NAME"; } log.info("sql====="+sql); List> list = persistence.getSearchResultToMap(790, sql); log.info(JSONArray.fromObject(list).toString()); return JSONArray.fromObject(list).toString(); } /** * 新增突发事件类型报表配置数据 * 2017-03-10 谢仲铠新增 */ @Override public String getEventTypeReportTimeConfigDao(List> list, JDBCHelper jdbc) throws PersistenceException { String sql = ""; String sql1 = ""; //存放sql语句的list ArrayList sqlList = new ArrayList(); for(int i=0;i> listMap = persistence.getSearchResultToMap(790, sql2); String fd_objectid=IdentityGenerator.getIdentityGenerator().gerenalIdentity(791); //String fd_objectid=list.get(i).get("fd_id"); String report_id = list.get(i).get("fd_id"); String war_rep_level = list.get(i).get("levelConfig"); String dept_id = listMap.get(0).get("ROLE_ID"); String dept_name = listMap.get(0).get("ROLE_NAME"); String report_time = list.get(i).get("timeConfig"); if(report_time.endsWith(",")){ report_time = report_time.substring(0, report_time.length()-1); report_time = report_time.replaceAll(",", ";"); } SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); Date date = new Date(); String time = sdf.format(date); /*sql1 = "update ecm_em_emergency_type_config set REPORT_NAME='"+report_name+"' where role_id='"+role_id+"' " + "and event_type_id='"+event_type_id+"' and dept_id='"+dept_id+"' and report_name='"+report_name+"'";*/ sql1 = "delete from ECM_EM_EVENT_REPORT where report_id='"+report_id+"'"; log.info("sql1====="+sql); sql = "insert into ECM_EM_EVENT_REPORT(FD_OBJECTID,REPORT_ID,WAR_REP_LEVEL,DEPT_ID,DEPT_NAME,REPORT_TIME,UPDATEDATE,IS_DEL) values('" +fd_objectid+"','"+report_id+"','"+war_rep_level+"','"+dept_id+"','"+dept_name+"','"+report_time+"','"+time+ "','0');"; log.info("sql====="+sql); int result = persistence.executeUpdateSQL(791, sql1); if(report_time!=""){ sqlList.add(sql); } } //批量插入 jdbc.executeUpdateSQL(sqlList); //直接返回true,service中直接捕获异常,未抛出异常都是true return "true"; } /** * 默认加载报表配置,勾选报表填报时间 * 2017-03-17谢仲铠新增 */ @Override public String getEventTypeTimeConfig(String event_type_id) throws PersistenceException { String sql = "select a.is_type,a.serial_number,b.* from ecm_em_emergency_type_config a,ecm_em_event_report b where " + "a.event_type_id='"+event_type_id+"' and a.fd_objectid=b.report_id and b.is_del='0'"; log.info("sql====="+sql); List> list = persistence.getSearchResultToMap(791, sql); log.info(JSONArray.fromObject(list).toString()); return JSONArray.fromObject(list).toString(); } /** * 查询突发事件任务要求 * @param eventTypeId 事件类型id * @author laieryong 2017-03-17 */ @Override public String getEmergencyByTaskDemands(String eventTypeId) throws PersistenceException { 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 " + "from ECM_EM_EMERGENCY_TYPE_CONFIG typeConfig ,ECM_EM_EVENT_REPORT report " + "WHERE typeConfig.FD_OBJECTID = report.REPORT_ID AND typeConfig.IS_DEL = '0' AND typeConfig.EVENT_TYPE_ID = '"+eventTypeId+"' " + " ORDER BY report.WAR_REP_LEVEL ASC,typeConfig.ROLE_NAME ASC"; log.info("sql====="+sql);// TODO classid List> list = persistence.getSearchResultToMap(790, sql); log.info(JSONArray.fromObject(list).toString()); return JSONArray.fromObject(list).toString(); } /** * 新增突发事件类型报告 * @param list * @param jdbc * @return * @author 谢仲铠 2017-03-20 * @throws PersistenceException */ @Override public String addEventReportNew(List> list,JDBCHelper jdbc) throws PersistenceException { String sql = ""; String sql1 = ""; String sql2 = "";//一级响应 String sql3 = "";//二级响应 String sql4 = "";//三级响应 String sql5 = "";//四级响应 String sql6 = "";//红色预警 String sql7 = "";//橙色预警 String sql8 = "";//黄色预警 String sql9 = "";//蓝色预警 String sql10 = "";//用于查询报告是否已配置了时间 //存放sql语句的list ArrayList sqlList = new ArrayList(); for(int i=0;i repList = persistence.getSearchResult(791, sql10); log.info(JSONArray.fromObject(repList).toString()); if(repList==null || repList.size()==0){ if(serial_number=="988"){ sqlList.add(sql6); sqlList.add(sql7); sqlList.add(sql8); sqlList.add(sql9); }else if(serial_number=="987"||serial_number=="989"){ sqlList.add(sql2); sqlList.add(sql3); sqlList.add(sql4); sqlList.add(sql5); } } } //批量插入 jdbc.executeUpdateSQL(sqlList); //直接返回true,service中直接捕获异常,未抛出异常都是true return "true"; } /** * 查询事件编号是否重复 * 2017-04-10 谢仲铠 */ public String selEventType(String PLAN_TYPE_ID){ String result=""; String sql = "select * from ECM_EM_EMERGENCY_TYPE where PLAN_TYPE_ID='"+PLAN_TYPE_ID+"'"; try { List> list = persistence.getSearchResultToMap(789, sql); if(list.size()==0){ result="success"; }else{ result="error"; } } catch (PersistenceException e) { e.printStackTrace(); } return result; } /** * 新增突发事件类型 * @param list * @param jdbc * @return * @author 谢仲铠 2017-04-10 * @throws PersistenceException */ @Override public String saveEventTypes(List> list, JDBCHelper jdbc) throws PersistenceException { String FD_OBJECTID = list.get(0).get("FD_OBJECTID"); String EVENT_NUMBER = list.get(0).get("EVENT_NUMBER"); String EVENT_TYPE_NAME = list.get(0).get("EVENT_TYPE_NAME"); String LEAD_DEPARTMENT = list.get(0).get("LEAD_DEPARTMENT"); String INPUT_PERSON = list.get(0).get("INPUT_PERSON"); String INPUT_UNIT = list.get(0).get("INPUT_UNIT"); String INPUT_DEPARTMENT = list.get(0).get("INPUT_DEPARTMENT"); String INPUT_PERSON_ID = list.get(0).get("INPUT_PERSON_ID"); String INPUT_UNIT_ID = list.get(0).get("INPUT_UNIT_ID"); String INPUT_DEPARTMENT_ID = list.get(0).get("INPUT_DEPARTMENT_ID"); String PLAN_TYPE_ID = list.get(0).get("PLAN_TYPE_ID"); String EVENT_MESSAGE = list.get(0).get("EVENT_MESSAGE"); SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); Date date = new Date(); String time = sdf.format(date); 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('" +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+"')"; ArrayList sqlList = new ArrayList(); sqlList.add(sql); //批量插入 jdbc.executeUpdateSQL(sqlList); //直接返回true,service中直接捕获异常,未抛出异常都是true return "success"; } @Override public String updateEventTypes(List> list, JDBCHelper jdbc) throws PersistenceException { String FD_OBJECTID = list.get(0).get("FD_OBJECTID"); String EVENT_NUMBER = list.get(0).get("EVENT_NUMBER"); String EVENT_TYPE_NAME = list.get(0).get("EVENT_TYPE_NAME"); String LEAD_DEPARTMENT = list.get(0).get("LEAD_DEPARTMENT"); String INPUT_PERSON = list.get(0).get("INPUT_PERSON"); String INPUT_UNIT = list.get(0).get("INPUT_UNIT"); String INPUT_DEPARTMENT = list.get(0).get("INPUT_DEPARTMENT"); String INPUT_PERSON_ID = list.get(0).get("INPUT_PERSON_ID"); String INPUT_UNIT_ID = list.get(0).get("INPUT_UNIT_ID"); String INPUT_DEPARTMENT_ID = list.get(0).get("INPUT_DEPARTMENT_ID"); String PLAN_TYPE_ID = list.get(0).get("PLAN_TYPE_ID"); String EVENT_MESSAGE = list.get(0).get("EVENT_MESSAGE"); String id = list.get(0).get("id"); SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); Date date = new Date(); String time = sdf.format(date); String sql = "update ECM_EM_EMERGENCY_TYPE set FD_OBJECTID='"+FD_OBJECTID+"',EVENT_NUMBER='"+EVENT_NUMBER+"',EVENT_TYPE_NAME='"+EVENT_TYPE_NAME+"'," + "LEAD_DEPARTMENT='"+LEAD_DEPARTMENT+"',INPUT_PERSON='"+INPUT_PERSON+"',INPUT_UNIT='"+INPUT_UNIT+"',INPUT_DEPARTMENT='"+INPUT_DEPARTMENT+"'," + "UPDATEDATE='"+time+"',INPUT_PERSON_ID='"+INPUT_PERSON_ID+"',INPUT_UNIT_ID='"+INPUT_UNIT_ID+"',INPUT_DEPARTMENT_ID='"+INPUT_DEPARTMENT_ID+"'," + "PLAN_TYPE_ID='"+PLAN_TYPE_ID+"',EVENT_MESSAGE='"+EVENT_MESSAGE+"' where FD_OBJECTID='"+id+"'"; ArrayList sqlList = new ArrayList(); sqlList.add(sql); //批量插入 jdbc.executeUpdateSQL(sqlList); //直接返回true,service中直接捕获异常,未抛出异常都是true return "success"; } }