12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106 |
- package com.cockpit.dao;
- import java.sql.SQLException;
- import java.util.ArrayList;
- import java.util.Date;
- import java.util.HashMap;
- import java.util.Iterator;
- import java.util.List;
- import java.util.Map;
- import org.slf4j.LoggerFactory;
- import com.cockpit.util.CockpitUtil;
- import com.cockpit.vo.Posi;
- import com.cockpit.vo.Progream;
- import com.cockpit.vo.SaveType;
- import com.cockpit.vo.Yjzyincident;
- /**
- * 应急资源图层
- * @author zhumingyue
- *
- */
- public class EmergencyResourceDao extends ConnDaoImpl{
- CockpitToolDao ctDao = new CockpitToolDao() ;
- private CockpitUtil cutil = new CockpitUtil();
- private static final org.slf4j.Logger log = LoggerFactory.getLogger(EmergencyResourceDao.class);
-
-
- /**
- * 应急资源装备分布(发电车/发电机)
- * @param sql
- * @param dept_id
- * @param type
- * @return
- */
- public String getEquiScatter(String sql, String dept_id, String type, String icon){
- StringBuffer sb = new StringBuffer();
- sb.append("[");
-
- rs = executeQuerySetPs(sql, dept_id, dept_id);
- try {
- while(rs.next()){
- sb.append("{\"posX\":\"" + rs.getString("LON") + "\",\"posY\":\"" + rs.getString("LAT") +
- "\",\"title\":\"" + type + "名称:" + rs.getString("EQUI_NAME") +
- "\\n" + type + "类型:" + rs.getString("MODEL_TYPE") +
- "\\n" + type + "状态:" + rs.getString("USTAT") + "\\n地址:" + rs.getString("STORE_PLACE") +
- "\\n\\n负责人:" + rs.getString("DUTY_MEN") + "\\n负责人电话:" + rs.getString("PHONE") +
- "\",\"extraData\":{\"FD_OBJECTID\":\"" + rs.getString("FD_ID") +
- "\",\"name\":\"" + icon + "\"}},") ;
- }
- sb.deleteCharAt(sb.length() - 1) ;
- if(sb.length()==0){ return null ; }
- sb.append("]") ;
- log.info("装备分布坐标查询结果:" + sb.toString());
- return sb.toString() ;
-
- } catch (SQLException e) {
- log.error("装备分布坐标查询错误"+e.getMessage());
- } finally { closeAll(); }
-
- return null;
- }
-
-
- /**
- * 应急资源队伍分布
- * @param sql
- * @param dept_id
- * @return
- */
- public String getTeamScatter(String sql, String dept_id){
- StringBuffer sb = new StringBuffer();
- sb.append("[");
-
- rs = executeQuerySetPs(sql, dept_id, dept_id);
- try {
- while(rs.next()){
- sb.append("{\"posX\":\"" + rs.getString("LONGITUDE") + "\",\"posY\":\"" + rs.getString("LATITUDE") +
- "\",\"title\":\"队伍名称:" + rs.getString("TEAM_NAME") + "\\n队伍类型:" + rs.getString("TTYPE") +
- "\\n队伍人数:" + rs.getString("NUM") +
- "\\n队伍状态:" + rs.getString("TSTAT") + "\\n地址:" + rs.getString("TEAM_AEAR") +
- "\\n\\n负责人:" + rs.getString("TEAM_LEADER") + "\\n负责人电话:" + rs.getString("TEAM_PHONE") +
- "\",\"extraData\":{\"FD_OBJECTID\":\"" + rs.getString("FD_ID") +
- "\",\"name\":\"team_prev\",\"DEPT_ID\":\"" + rs.getString("DEPT_ID") +
- "\",\"DEPT_NAME\":\"" + rs.getString("DEPT_NAME") + "\"}},") ;
- }
- sb.deleteCharAt(sb.length() - 1) ;
- if(sb.length()==0){ return null ; }
- sb.append("]") ;
- // log.info("队伍分布坐标查询结果:" + sb.toString());
- return sb.toString() ;
-
- } catch (SQLException e) {
- log.error("队伍分布坐标查询错误"+e.getMessage());
- } finally { closeAll(); }
-
- return null;
- }
-
-
- /**
- * 获得仓库图标信息
- * @param sql
- * @return
- */
- public String getMareHouse(String sql){
- log.info("==========应急仓库图标查询SQL:" + sql) ;
- StringBuffer sb = new StringBuffer() ;
- sb.append("[") ;
- try{
- rs = executeQuery(sql) ;
- while(rs.next()){
- /*sb.append("{\"posX\":" + tempXY(rs.getString("LON")) + ",\"posY\":" + tempXY(rs.getString("LAT")) +
- ",\"title\":\"名称:" + rs.getString("NAME") +
- "\",\"extraData\":{\"FD_OBJECTID\":\"" + rs.getString("CODE") +
- "\",\"name\":\"erso_house\"}},") ;*/
-
- sb.append("{\"posX\":" + tempXY(rs.getString("LON")) + ",\"posY\":" + tempXY(rs.getString("LAT")) +
- ",\"title\":\"名称:" + rs.getString("NAME") +
- "\\n所属单位:" + (rs.getString("DEPT_NAME")==null ? "":rs.getString("DEPT_NAME")) +
- "\\n仓库归属:" + rs.getString("HB") +
- "\\n仓库类别:" + rs.getString("HT") +
- "\\n仓库级别:" + (rs.getString("HL")==null ? "":rs.getString("HL")) +
- "\\n存储物资类别:" + getStorageMaterialType(rs.getString("GT")) +
- "\\n详细地址:" + rs.getString("ADDR") +
- "\\n责任人:" + (rs.getString("MAN")==null ? "":rs.getString("MAN")) +
- "\",\"extraData\":{\"FD_OBJECTID\":\"" + rs.getString("CODE") +
- "\",\"name\":\"" + rs.getString("ICON") + "\"}},") ;
-
- }
-
- sb.deleteCharAt(sb.length() - 1) ;
- if(sb.length()==0){ return null ; }
- sb.append("]") ;
- log.info("应急仓库图标:" + sb.toString()) ;
- return sb.toString() ;
-
- }catch(Exception e){e.printStackTrace();}
- finally{
- closeAll() ;
- }
- return null ;
- }
-
- /**
- * 转换坐标度数
- * @param pos
- * @return
- */
- public double tempXY(String pos){
- // 22°44′52.15"″
- // 23°9′25.42"″
- // System.out.println(pos);
- double res = 0;
-
- try{
- pos = pos.substring(0,pos.length()-1);
- String du = pos.split("°")[0];
- pos = pos.split("°")[1];
- String feng = pos.split("′")[0];
- pos = pos.split("′")[1];
- String miao = pos.split("\"")[0];
-
- res += Double.parseDouble(du);
- res += Double.parseDouble(feng)/60.0;
- res += Double.parseDouble(miao)/3600.0;
- }catch(NumberFormatException e){
- res = 0;
- }catch(StringIndexOutOfBoundsException e){
- res = 0;
- }
-
- return res;
- };
-
- /**
- * 切割仓库物资类型
- * @param gtStr
- * @return
- */
- public String getStorageMaterialType(String gtStr){
- StringBuffer gtRes = new StringBuffer() ;
- String[] gtArr = gtStr.split("|");//物资类别
-
- for(String key : gtArr){
- if(key.equals("1"))
- gtRes.append("主网变电类/");
- if(key.equals("2"))
- gtRes.append("配网变电类/");
- if(key.equals("3"))
- gtRes.append("主网线路类/");
- if(key.equals("4"))
- gtRes.append("配网线路类/");
- if(key.equals("5"))
- gtRes.append("表计与计量类/");
- if(key.equals("6"))
- gtRes.append("其他/");
- }
-
- if(gtRes.length()>0){
- gtRes.deleteCharAt(gtRes.length()-1);
- return gtRes.toString();
- }
-
- return "";
-
- };
-
- public String getMareHouseById(String sql, String fd_id){
- StringBuffer sb = new StringBuffer();
- rs = executeQuerySetPs(sql, fd_id);
- try{
- if(rs.next()){
- /*
- WAREHOUSE_CODE
- WAREHOUSE_NAME
- WAREHOUSE_BELONGING
- BELONGING_DEPARTMENT
- WAREHOUSE_TYPE
- WAREHOUSE_LEVEL
- AREA_COVERED
- ARCHITEC_AREA
- LATITUDE
- LONGITUDE
- DETAILED_ADDRESS
- STORAGE_MATERIAL_TYPE
- STORAGE_MATERIAL_TYPE_SHOW
- WAREHOUSE_DESC
- SUPERIOR_WAREHOUSE
- WAREHOUSE_PRINCIPAL
- WAREHOUSE_SYS_CODE
- OBJECT_ID
- UP_DATE
- WAREHOUSE_BELONGING_SHOW
- WAREHOUSE_TYPE_SHOW
- WAREHOUSE_LEVEL_SHOW*/
-
- sb.append("{\"WAREHOUSE_CODE\":\"" + rs.getString("WAREHOUSE_CODE") + "\"," +
- "\"WAREHOUSE_NAME\":\"" + rs.getString("WAREHOUSE_NAME") + "\"," +
- "\"WAREHOUSE_BELONGING\":\"" + rs.getString("WAREHOUSE_BELONGING") + "\"," +
- "\"BELONGING_DEPARTMENT\":\"" + rs.getString("BELONGING_DEPARTMENT") + "\"," +
- "\"WAREHOUSE_TYPE\":\"" + rs.getString("WAREHOUSE_TYPE") + "\"," +
- "\"WAREHOUSE_LEVEL\":\"" + rs.getString("WAREHOUSE_LEVEL") + "\"," +
- "\"AREA_COVERED\":\"" + rs.getString("AREA_COVERED") + "\"," +
- "\"ARCHITEC_AREA\":\"" + rs.getString("ARCHITEC_AREA") + "\"," +
- "\"LATITUDE\":\"" + rs.getString("LATITUDE").replaceAll("\"", "") + "\"," +
- "\"LONGITUDE\":\"" + rs.getString("LONGITUDE").replaceAll("\"", "") + "\"," +
- "\"DETAILED_ADDRESS\":\"" + rs.getString("DETAILED_ADDRESS") + "\"," +
- "\"STORAGE_MATERIAL_TYPE\":\"" + rs.getString("STORAGE_MATERIAL_TYPE") + "\"," +
- "\"STORAGE_MATERIAL_TYPE_SHOW\":\"" + getStorageMaterialType(rs.getString("STORAGE_MATERIAL_TYPE")) +
- "\",\"WAREHOUSE_DESC\":\"" + rs.getString("WAREHOUSE_DESC") + "\"," +
- "\"SUPERIOR_WAREHOUSE\":\"" + rs.getString("SUPERIOR_WAREHOUSE") + "\"," +
- "\"WAREHOUSE_PRINCIPAL\":\"" + rs.getString("WAREHOUSE_PRINCIPAL") + "\"," +
- "\"WAREHOUSE_SYS_CODE\":\"" + rs.getString("WAREHOUSE_SYS_CODE") + "\"," +
- "\"OBJECT_ID\":\"" + rs.getString("OBJECT_ID") + "\"," +
- "\"UP_DATE\":\"" + rs.getString("UP_DATE") + "\"," +
- "\"WAREHOUSE_BELONGING_SHOW\":\"" + rs.getString("WAREHOUSE_BELONGING_SHOW") + "\"," +
- "\"WAREHOUSE_TYPE_SHOW\":\"" + rs.getString("WAREHOUSE_TYPE_SHOW") + "\"," +
- "\"WAREHOUSE_LEVEL_SHOW\":\"" + rs.getString("WAREHOUSE_LEVEL_SHOW") + "\"}" );
- log.info("GIS仓库基本信息查询结果(getMareHouseById)==" + sb.toString());
- return sb.toString();
- }
-
- }catch(SQLException e){ log.error("GIS仓库通过ID获得详细信息错误:" + sql); }
- finally{ closeAll(); }
- return null;
- }
-
- /**
- * 本地可调用资源
- * @param sql
- * @return
- */
- public Map<String,String> queryNativeGene(String sql){
- Map<String, String> nativeRes = new HashMap<String, String>() ;
- try{
- rs = executeQuery(sql) ;
- while(rs.next()){
- nativeRes.put(rs.getString("comp_id"), rs.getString("sum")) ;
- }
-
- return nativeRes ;
-
- }
- catch(Exception e){e.printStackTrace();}
- finally{ closeAll(); }
-
- return null ;
- }
-
- /**
- * 查询用户自定义图形信息,按类型分别查询(图形类)
- * @param sql
- * @param inicId
- * @param type
- * @return
- */
- public String queryDrawByUser(String sql, String inicId, String type, String userId){
- StringBuffer sb = new StringBuffer() ;
- StringBuffer other = new StringBuffer() ;
-
- sb.append("[{\"points\":[") ;
- try{
-
- rs = executeQuerySetPs(sql,inicId,type,userId) ;
- if(rs.next()){
- sb.append("{\"x\":" + rs.getString("LONGITUDE") + ",\"y\":" + rs.getString("LATITUDE") + "}") ;
- if(rs.getString("RADIUS")==null){
- other.append("\"radius\":\"" + rs.getString("RADIUS") + "\",\"describeinfo\":\"" +
- rs.getString("DESCRIBEINFO") + "\",\"teamid\":\"" + rs.getString("TEAMID") +
- "\",\"drawId\":\"" + rs.getString("fd_id") + "\"},") ;
- }else{
- other.append("\"radius\":" + rs.getString("RADIUS") + ",\"describeinfo\":\"" +
- rs.getString("DESCRIBEINFO") + "\",\"teamid\":\"" + rs.getString("TEAMID") +
- "\",\"drawId\":\"" + rs.getString("fd_id") + "\"},") ;
- }
-
- }
- while(rs.next()){
- if(rs.getInt("NUM")==1){
- sb.append("]," + other + "{\"points\":[") ;
- sb.append("{\"x\":" + rs.getString("LONGITUDE") + ",\"y\":" + rs.getString("LATITUDE") + "}") ;
- other.delete(0, other.length()) ;
- other.append("\"radius\":\"" + rs.getString("RADIUS") + "\",\"describeinfo\":\"" +
- rs.getString("DESCRIBEINFO") + "\",\"teamid\":\"" + rs.getString("TEAMID") +
- "\",\"drawId\":\"" + rs.getString("fd_id") + "\"},") ;
- }else{
- sb.append(",{\"x\":" + rs.getString("LONGITUDE") + ",\"y\":" + rs.getString("LATITUDE") + "}") ;
- }
- }
- sb.append("]," + other) ;
- sb.deleteCharAt(sb.length()-1) ;
- sb.append("]") ;
- System.out.println("用户自定义图形查询(形状类): " + sb.toString());
- return sb.toString() ;
- }
- catch(Exception e){ e.printStackTrace(); }
- finally{ closeAll(); }
-
- return "" ;
- }
-
-
- /**
- * 查询用户自定义图形信息,按类型分别查询(图标类)
- * @param sql
- * @param inicId
- * @param type
- * @return
- */
- public String queryDrawByUserMarker(String sql, String inicId, String type, String userId){
- StringBuffer sb = new StringBuffer() ;
- sb.append("[") ;
- try{
-
- rs = executeQuerySetPs(sql, inicId, type, userId) ;
- while(rs.next()){
- sb.append("{\"posX\":" + rs.getString("LONGITUDE") + ",\"posY\":" + rs.getString("LATITUDE") +
- ",\"title\":\"" + rs.getString("DESCRIBEINFO") +"\",\"extraData\":{\"FD_ID\":\"" +
- rs.getString("TEAMID") + "\",\"inciId\":\"" + rs.getString("fd_id") +
- "\",\"name\":\"" + rs.getString("name") + "\"}},") ;
- }
- sb.deleteCharAt(sb.length()-1) ;
- if(sb.length()==0){ return null ; }
- sb.append("]") ;
- System.out.println("用户自定义图形查询(图标类): " + sb.toString());
- return sb.toString() ;
- }
- catch(Exception e){ e.printStackTrace(); }
- finally{ closeAll(); }
-
- return null ;
- }
-
-
- //存储用户自定义图形信息
- public String createDrawByUser(String inicId,String info){
- String sql = "insert into ECM_CM_DRAWINFOBYUSER values(?, ?, ?, ?, ?)" ;
- return this.executeAdd(sql, inicId,info,'0',new Date()) ;
- }
-
- //导入用户自定义图层信息
- public String importDrawByUser(String sql){
- try{
- rs = executeQuery(sql) ;
- if(rs.next())
- return rs.getString("drawinfo") ;
-
- } catch(Exception e){ e.printStackTrace(); }
- finally{ closeAll(); }
- return null ;
- }
-
- /**
- * 根据传入的List进行批量保存应急资源参数信息表,对应ECM_CM_SAVETYPE
- * @param list
- * @return
- * @throws Exception
- */
- public String createDrawType(List<SaveType> list)throws Exception{
- String sql = "insert into ECM_CM_SAVETYPE values(?, ?, ?, ?, ?, ?)" ;
- String fd_ids = this.executeAddBatch(sql, list) ;
- closeAll() ;
- return fd_ids ;
- }
-
- /**
- * 根据传入的List进行批量保存应急资源自定义图形坐标信息表,对应ECM_CM_SAVETYPE
- * @param list
- * @return
- * @throws Exception
- */
- public String createProgream(List<Progream> list)throws Exception{
- String sql = "insert into ECM_CM_PROGREAMSAVE values(?, ?, ?, ?, ?, ?, ?, ?,?,?)" ;
- String fd_ids = this.executeAddBatch(sql, list) ;
- closeAll() ;
- return fd_ids ;
- }
-
-
- /**
- * 根据传入的List进行批量逻辑删除用户自定义图形参数表
- * @param list
- * @return
- */
- public Boolean delUserDefinedToType(List<String> list) {
- String sql = "update ECM_CM_SAVETYPE set is_del = '1' where fd_objectid = ? " ;
- Boolean flg = this.executeDelBatchToOneFiled(sql, list) ;
- closeAll() ;
-
- return flg ;
- }
-
- /**
- * 根据传入的List进行批量逻辑删除用户自定义图形坐标表
- * @param list
- * @return
- */
- public Boolean delUserDefinedToProgreamsave(List<String> list) {
- String sql = "update ECM_CM_PROGREAMSAVE set is_del = '1' where figureid = ? " ;
- Boolean flg = this.executeDelBatchToOneFiled(sql, list) ;
- closeAll() ;
-
- return flg ;
- }
-
- /**
- * 查询是否有结果
- * @param sql
- * @return Boolean true: 有 false:无
- */
- public Boolean isProvInteDept(String sql){
- return this.resultIsNull(sql) ;
- }
-
- /**
- * 查询部门的直属子部门
- * @param sql
- * @return
- */
- public List<String> subDeptIDs(String sql){
- List<String> deptList = new ArrayList<String>() ;
- try{
- rs = this.executeQuery(sql) ;
- while(rs.next()){
- deptList.add(rs.getString("DEPT_ID")) ;
- }
- return deptList ;
- }catch(Exception e){ e.printStackTrace(); }
- finally{ closeAll(); }
- return null ;
- }
-
-
- //添加事件信息
- public String addIncident(String sql,String data){
-
- try{
-
- String fd_id = this.executeAdd(sql, data) ;
- return fd_id.equals(null) ? null : fd_id ;
-
- }catch(Exception e){ log.error("GIS添加事件错误"+e.getMessage()); }
-
- finally{ closeAll(); }
- return null ;
- }
-
- //根据事件查询出该事件的自定义图形有哪些
- public Map<String,String> getDrawsSql(String sql){
- Map<String,String> draws = new HashMap<String,String>() ;
- try{
- rs = this.executeQuery(sql) ;
- while(rs.next()){
-
- draws.put(rs.getString("fd_objectid"), rs.getString("drowtype")) ;
- }
- return draws ;
- }catch(Exception e){ log.error("GIS查询图形错误"+e.getMessage()); }
- finally{ closeAll(); }
- return null ;
- }
-
- //根据图形名称查询出该图形
- public StringBuffer getDrawXY(String sql){
- StringBuffer sb = new StringBuffer() ;
- sb.append("{\"points\":[") ;
- try{
- rs = this.executeQuery(sql) ;
- while(rs.next()){
- sb.append("{\"x\":" + rs.getString("longitude") + ",\"y\":" + rs.getString("latitude") + "},") ;
- }
- sb.deleteCharAt(sb.length()-1) ;
- if(sb.length()<15){ return null ; }
- sb.append("]}") ;
- return sb ;
- }catch(Exception e){ log.error("GIS查询图形错误"+e.getMessage()); }
- finally{ closeAll(); }
- return null ;
- }
-
- //根据图形的FIGUREID(每个图形的ID)得到图形坐标
- public Map<String,String> getDrawPoints(String sql){
- Map<String,String> draws = new HashMap<String,String>() ;
- StringBuffer sb = new StringBuffer() ;
- String fid = "" ;
- try{
- rs = this.executeQuery(sql) ;
-
- if(rs.next()){
- fid = rs.getString("FIGUREID") ;
- sb.append("{\"points\":[") ;
- sb.append("{\"x\":" + rs.getString("longitude") + ",\"y\":" + rs.getString("latitude") + "},") ;
- }
- while(rs.next()){
- if(fid.equals(rs.getString("FIGUREID"))){
- sb.append("{\"x\":" + rs.getString("longitude") + ",\"y\":" + rs.getString("latitude") + "},") ;
- } else {
-
- sb.deleteCharAt(sb.length()-1) ;
- sb.append("]}") ;
- draws.put(fid, sb.toString()) ;
- sb.delete(0, sb.length()) ;
-
- fid = rs.getString("FIGUREID") ;
- sb.append("{\"points\":[") ;
- sb.append("{\"x\":" + rs.getString("longitude") + ",\"y\":" + rs.getString("latitude") + "},") ;
- }
- }
- sb.deleteCharAt(sb.length()-1) ;
- sb.append("]}") ;
- draws.put(fid, sb.toString()) ;
-
- return draws ;
- }catch(Exception e){ log.error("GIS查询自定义图形错误"+e.getMessage()); }
- finally{ closeAll(); }
-
- return null ;
- }
-
-
- //根据传入的List进行批量保存事件表
- public String createDraw(List<Yjzyincident> list)throws Exception{
- String sql = "insert into ECM_CM_YJZYINCIDENT values(?, ?, ?, ?)" ;
- String fd_ids = this.executeAddBatch(sql, list) ;
- closeAll() ;
- return fd_ids ;
- }
-
-
- //查询事件名称是否存在
- public String existIncidentName(String condition){
- String sql = "select count(*) as num from ECM_CM_YJZYINCIDENT where INCIDENTNAME = '" + condition + "'" ;
- try{
-
- rs = this.executeQuery(sql) ;
- rs.next() ;
- return rs.getInt("num") > 0 ? "1" : "0" ;
-
- }catch(Exception e){ log.error("GIS查询事件错误"+e.getMessage()); }
-
- finally{ closeAll(); }
-
- return "1" ;
-
- }
-
- //根据城市查询坐标
- public Map<String, String> queryXYM(String sql){
- Map<String, String> xy = new HashMap<String, String>() ;
-
- try{
-
- rs = this.executeQuery(sql) ;
-
- while(rs.next()){
- xy.put(rs.getString("DEPT_ID"), "\"x\":" + rs.getString("POS_X") + ",\"y\":" + rs.getString("POS_Y")) ;
- }
-
- return xy ;
-
- }catch(Exception e){ log.error("GIS查询城市坐标错误"+e.getMessage()); }
-
- finally{ closeAll(); }
-
- return null ;
- }
-
- //根据城市查询坐标返回字符串
- public String queryXY(String sql){
- StringBuffer sb = new StringBuffer() ;
- sb.append("[") ;
- try{
-
- rs = this.executeQuery(sql) ;
-
- while(rs.next()){
- sb.append("{\"x\":" + rs.getString("pos_x") + ",\"y\":" + rs.getString("pos_y") + "},") ;
- }
-
- sb.deleteCharAt(sb.length() - 1) ;
- if(sb.length()==0){ return null ; }
- sb.append("]") ;
- return sb.toString() ;
-
- }catch(Exception e){ log.error("GIS查询城市坐标错误"+e.getMessage()); }
-
- finally{ closeAll(); }
-
- return null ;
- }
-
- /**
- * 根据事件ID或队伍ID查询出应急队伍最新的位置,用于展示图标
- * @param sql
- * @return
- */
- public String queryYjTameMarker(String sql){
- log.info("根据事件ID或队伍ID查询出应急队伍最新的位置,用于展示图标SQL:"+sql);
- StringBuffer sb = new StringBuffer() ;
- rs = this.executeQuery(sql) ;
- sb.append("[") ;
- try{
- while(rs.next()){
- sb.append("{\"posX\":" + rs.getString("longitude") + ",\"posY\":" + rs.getString("latitude") +
- ",\"title\":\"" + rs.getString("incidentname") + "事件应急队:" +
- rs.getString("team_name") + "\",\"extraData\":{\"teamid\":\"" +
- rs.getString("team_id") + "\",\"inciid\":\"" + rs.getString("inicid") +
- "\",\"name\":\"team_prev\"}},") ;
- }
-
- sb.deleteCharAt(sb.length()-1) ;
- if(sb.length()==0){ return null ; }
- sb.append("]") ;
- // System.out.println("应急队伍定位result: " + sb.toString());
- return sb.toString() ;
-
- } catch (Exception e){ log.error("GIS查询队伍定位错误"+e.getMessage()); }
- finally { closeAll(); }
-
- return null ;
- }
-
- /**
- * 根据事件ID或队伍ID查询出应急队伍最新的位置,用于展示图标
- * @param sql
- * @return
- */
- public String queryTameMarker(String sql){
- log.info("根据事件ID或队伍ID查询出应急队伍最新的位置,用于展示图标SQL:"+sql);
- StringBuffer sb = new StringBuffer() ;
- rs = this.executeQuery(sql) ;
- sb.append("[") ;
- try{
- while(rs.next()){
- sb.append("{\"posX\":" + rs.getString("LON") + ",\"posY\":" + rs.getString("LAT") +
- ",\"title\":\"队伍名称:" + rs.getString("NAME") + "\\n调拨名称:" +
- rs.getString("TNAME") + "\\n队伍人数:" +
- rs.getString("MENNUM") + "人\\n专业:" + (String)cutil.getResoultByDefault(rs.getString("MAJOR"), "暂无") +
- "\\n起始地点:" + rs.getString("STATRPLACE") + "\\n终点:" + rs.getString("DEST") +
- "\",\"extraData\":{\"teamid\":\"" +
- rs.getString("FD_ID") + "\",\"inciid\":\"" + rs.getString("INICID") +
- "\",\"name\":\"team_prev\"}},") ;
- }
-
- sb.deleteCharAt(sb.length()-1) ;
- if(sb.length()==0){ return null ; }
- sb.append("]") ;
- log.info("GIS查询队伍定位结果:" + sb.toString());
- // System.out.println("应急队伍定位result: " + sb.toString());
- return sb.toString() ;
-
- } catch (Exception e){ log.error("GIS查询队伍定位错误:" + sql); }
- finally { closeAll(); }
-
- return null ;
- }
-
- //根据队伍查询坐标描述用
- public String queryTameXY(String sql){
- StringBuffer sb = new StringBuffer() ;
- StringBuffer tempX = new StringBuffer() ;
- StringBuffer tempY = new StringBuffer() ;
- sb.append("[") ;
- rs = this.executeQuery(sql) ;
- try{
- if(rs.next()){
- sb.append("{\"x\":" + rs.getString("longitude") + ",\"y\":" + rs.getString("latitude") +
- ",\"afterX\":" + rs.getString("longitude") + ",\"afterY\":" +
- rs.getString("latitude") + "},") ;
- tempX.append(rs.getString("longitude")) ;
- tempY.append(rs.getString("latitude")) ;
- }
- while(rs.next()){
- sb.append("{\"x\":" + rs.getString("longitude") + ",\"y\":" + rs.getString("latitude") +
- ",\"afterX\":" + tempX + ",\"afterY\":" + tempY + "},") ;
- tempX.delete(0, tempX.length()) ;
- tempY.delete(0, tempY.length()) ;
- tempX.append(rs.getString("longitude")) ;
- tempY.append(rs.getString("latitude")) ;
- }
-
- sb.deleteCharAt(sb.length()-1) ;
- if(sb.length()==0){ return null ; }
- sb.append("]") ;
- // System.out.println("根据队伍查询坐标: " + sb.toString()) ;
- return sb.toString() ;
- }
- catch(Exception e) { log.error("GIS查询队伍坐标错误"+e.getMessage()); }
- finally { closeAll(); }
- return null ;
- }
-
- //根据队伍查询坐标描述用
- public String queryTameLine(String sql){
- StringBuffer sb = new StringBuffer() ;
- StringBuffer tempX = new StringBuffer() ;
- StringBuffer tempY = new StringBuffer() ;
- String key = "" ;
- sb.append("[") ;
- rs = this.executeQuery(sql) ;
- try{
- if(rs.next()){
- sb.append("{\"teamId\":\"" + rs.getString("team_id") + "\",\"teamName\":\"" + rs.getString("team_name") +
- "\",\"inciName\":\"" + rs.getString("incidentname") + "\",\"points\":[{\"x\":" +
- rs.getString("longitude") + ",\"y\":" + rs.getString("latitude") + ",\"afterX\":" +
- rs.getString("longitude") + ",\"afterY\":" + rs.getString("latitude") +
- ",\"uploadTime\":\"" + rs.getString("team_time") + "\"},") ;
-
- tempX.append(rs.getString("longitude")) ;
- tempY.append(rs.getString("latitude")) ;
-
- key = rs.getString("team_id") ;
- }
- while(rs.next()){
- if(key.equals(rs.getString("team_id"))){
- if(!ctDao.equalsXY(tempX.toString(), rs.getString("longitude"),tempY.toString(), rs.getString("latitude"))){
- sb.append("{\"x\":" + rs.getString("longitude") + ",\"y\":" + rs.getString("latitude") +
- ",\"afterX\":" + tempX + ",\"afterY\":" + tempY +
- ",\"uploadTime\":\"" + rs.getString("team_time") + "\"},") ;
- tempX.delete(0, tempX.length()) ;
- tempY.delete(0, tempY.length()) ;
- tempX.append(rs.getString("longitude")) ;
- tempY.append(rs.getString("latitude")) ;
- }
-
-
- } else {
- sb.deleteCharAt(sb.length()-1) ;
- sb.append("]},{\"teamId\":\"" + rs.getString("team_id") + "\",\"teamName\":\"" + rs.getString("team_name") +
- "\",\"inciName\":\"" + rs.getString("incidentname") + "\",\"points\":[{\"x\":" + rs.getString("longitude") +
- ",\"y\":" + rs.getString("latitude") + ",\"afterX\":" + rs.getString("longitude") +
- ",\"afterY\":" + rs.getString("latitude") + ",\"uploadTime\":" + rs.getString("team_time") + "\"},") ;
- key = rs.getString("teamid") ;
- tempX.delete(0, tempX.length()) ;
- tempY.delete(0, tempY.length()) ;
- tempX.append(rs.getString("longitude")) ;
- tempY.append(rs.getString("latitude")) ;
- }
-
- }
- sb.deleteCharAt(sb.length()-1) ;
- if(sb.length()==0){ return null ; }
- sb.append("]}]") ;
- // System.out.println("轨迹描绘:" + sb.toString()) ;
- return sb.toString() ;
- }
- catch(Exception e) { log.error("GIS查询队伍轨迹错误"+e.getMessage()); }
- finally { closeAll(); }
- return null ;
-
-
-
-
-
- // StringBuffer sb = new StringBuffer() ;
- // StringBuffer tempX = new StringBuffer() ;
- // StringBuffer tempY = new StringBuffer() ;
- //
- // sb.append("[") ;
- // rs = this.executeQuery(sql) ;
- // try{
- // if(rs.next()){
- // sb.append("{\"x\":" + rs.getString("longitude") + ",\"y\":" + rs.getString("latitude") +
- // ",\"afterX\":" + rs.getString("longitude") + ",\"afterY\":" +
- // rs.getString("latitude") + "},") ;
- // tempX.append(rs.getString("longitude")) ;
- // tempY.append(rs.getString("latitude")) ;
- //
- // }
- // while(rs.next()){
- // sb.append("{\"x\":" + rs.getString("longitude") + ",\"y\":" + rs.getString("latitude") +
- // ",\"afterX\":" + tempX + ",\"afterY\":" + tempY + "},") ;
- // tempX.delete(0, tempX.length()) ;
- // tempY.delete(0, tempY.length()) ;
- // tempX.append(rs.getString("longitude")) ;
- // tempY.append(rs.getString("latitude")) ;
- // }
- //
- // sb.deleteCharAt(sb.length()-1) ;
- // sb.append("]") ;
- // System.out.println(sb.toString()) ;
- // return sb.toString() ;
- // }
- // catch(Exception e) { e.printStackTrace(); }
- // finally { closeAll(); }
- // return null ;
- }
- //根据队伍查询坐标描述用
- public String queryTameLineById(String sql){
- StringBuffer sb = new StringBuffer() ;
- StringBuffer tempX = new StringBuffer() ;
- StringBuffer tempY = new StringBuffer() ;
- String key = "" ;
- sb.append("[") ;
- rs = this.executeQuery(sql) ;
- try{
- if(rs.next()){
- sb.append("{\"teamId\":\"" + rs.getString("FD_ID") + "\",\"teamName\":\"" + rs.getString("NAME") +
- "\",\"inciName\":\"" + rs.getString("TNAME") + "\",\"points\":[{\"x\":" +
- rs.getString("LON") + ",\"y\":" + rs.getString("LAT") + ",\"afterX\":" +
- rs.getString("LON") + ",\"afterY\":" + rs.getString("LAT") +
- ",\"uploadTime\":\"" + rs.getDate("LOCATION_TIME") + " " +
- rs.getTime("LOCATION_TIME") + "\"},") ;
-
- tempX.append(rs.getString("LON")) ;
- tempY.append(rs.getString("LAT")) ;
-
- key = rs.getString("FD_ID") ;
- }
- while(rs.next()){
- if(key.equals(rs.getString("FD_ID"))){
- if(!ctDao.equalsXY(tempX.toString(), rs.getString("LON"),tempY.toString(), rs.getString("LAT"))){
- sb.append("{\"x\":" + rs.getString("LON") + ",\"y\":" + rs.getString("LAT") +
- ",\"afterX\":" + tempX + ",\"afterY\":" + tempY +
- ",\"uploadTime\":\"" + rs.getDate("LOCATION_TIME") + " " +
- rs.getTime("LOCATION_TIME") + "\"},") ;
- tempX.delete(0, tempX.length()) ;
- tempY.delete(0, tempY.length()) ;
- tempX.append(rs.getString("LON")) ;
- tempY.append(rs.getString("LAT")) ;
- }
-
-
- } else {
- sb.deleteCharAt(sb.length()-1) ;
- sb.append("]},{\"teamId\":\"" + rs.getString("FD_ID") + "\",\"teamName\":\"" + rs.getString("NAME") +
- "\",\"inciName\":\"" + rs.getString("TNAME") + "\",\"points\":[{\"x\":" + rs.getString("LON") +
- ",\"y\":" + rs.getString("LAT") + ",\"afterX\":" + rs.getString("LON") +
- ",\"afterY\":" + rs.getString("LAT") + ",\"uploadTime\":\"" + rs.getDate("LOCATION_TIME") +
- " " + rs.getTime("LOCATION_TIME") + "\"},") ;
- key = rs.getString("FD_ID") ;
- tempX.delete(0, tempX.length()) ;
- tempY.delete(0, tempY.length()) ;
- tempX.append(rs.getString("LON")) ;
- tempY.append(rs.getString("LAT")) ;
- }
-
- }
- sb.deleteCharAt(sb.length()-1) ;
- if(sb.length()==0){ return null ; }
- sb.append("]}]") ;
- System.out.println(sb.toString());
- return sb.toString() ;
- }
- catch(Exception e) { log.error("GIS查询队伍轨迹错误"+e.getMessage()); }
- finally { closeAll(); }
- return null ;
-
- }
-
- public Map<String, Posi> getStartTimeByTeam(String sql){
- Map<String, Posi> map = new HashMap<String, Posi>();
- rs = this.executeQuery(sql) ;
- try{
- while(rs.next()){
- Posi posi = new Posi();
- posi.setStartDate(rs.getTimestamp("LOCATION_TIME"));
- map.put(rs.getString("FD_ID"), posi);
- }
- return map;
- } catch(Exception e) { log.error("GIS队伍轨迹开始时间查询错误:"+sql); }
- finally { closeAll(); }
- return null ;
- }
-
- public Map<String, Posi> getEndTimeByTeam(String sql){
- Map<String, Posi> map = new HashMap<String, Posi>();
- rs = this.executeQuery(sql) ;
- try{
- while(rs.next()){
- Posi posi = new Posi();
- posi.setEndDate(rs.getTimestamp("LOCATION_TIME"));
- map.put(rs.getString("FD_ID"), posi);
- }
- return map;
- } catch(Exception e) { log.error("GIS队伍轨迹结束时间查询错误:"+sql); }
- finally { closeAll(); }
- return null ;
- }
-
- public List<Posi> getTimeByTeam(Map<String, Posi> smap, Map<String, Posi> emap){
- List<Posi> list = new ArrayList<Posi>();
- Iterator iter = smap.entrySet().iterator();
- while(iter.hasNext()){
- Map.Entry<String, Posi> entry = (Map.Entry<String, Posi>)iter.next();
- String id = entry.getKey();
- Posi posi = entry.getValue();
- posi.setFD_ID(id);
- if(emap.get(id).getEndDate()==null){
- posi.setEndDate(new Date());
- }else{
- posi.setEndDate(emap.get(id).getEndDate());
- }
- list.add(posi);
- }
- return list;
- }
-
- /**
- * 获得资源调拨图标信息
- * @param sql
- * @return
- */
- public String searchErDistByTeam(String sql,String dept_id){
- // System.out.println(sql+"----------------------------------------------------"+dept_id);
- StringBuffer sb = new StringBuffer() ;
- sb.append("[") ;
-
- try{
- rs = executeQuerySetPs(sql, dept_id, dept_id) ;
- String fd_id = "";
- if(rs.next()){
- fd_id = rs.getString("FD_ID");
- sb.append("{\"posX\":\"" + rs.getString("LONGITUDE") + "\",\"posY\":\"" + rs.getString("LATITUDE") +
- "\",\"title\":\"" + rs.getString("NAME") + "\\n共" + rs.getString("CFID") +
- "支队伍,总计" + rs.getString("NUM") +
- "人\",\"extraData\":{\"FD_OBJECTID\":\"" + rs.getString("FD_ID") +
- "\",\"name\":\"team_prev\",\"DEPT_ID\":\"" + rs.getString("DEPT_ID") +
- "\",\"DEPT_NAME\":\"" + rs.getString("NAME") + "\"}},") ;
- }
-
- while(rs.next()){
- if(fd_id.equals(rs.getString("FD_ID"))){
- fd_id = rs.getString("FD_ID");
- continue;
- }
- fd_id = rs.getString("FD_ID");
- sb.append("{\"posX\":\"" + rs.getString("LONGITUDE") + "\",\"posY\":\"" + rs.getString("LATITUDE") +
- "\",\"title\":\"" + rs.getString("NAME") + "\\n共" + rs.getString("CFID") +
- "支队伍,总计" + rs.getString("NUM") +
- "人\",\"extraData\":{\"FD_OBJECTID\":\"" + rs.getString("FD_ID") +
- "\",\"name\":\"team_prev\",\"DEPT_ID\":\"" + rs.getString("DEPT_ID") +
- "\",\"DEPT_NAME\":\"" + rs.getString("NAME") + "\"}},") ;
- }
-
- sb.deleteCharAt(sb.length() - 1) ;
- if(sb.length()==0){ return null ; }
- sb.append("]") ;
- return sb.toString() ;
-
- }catch(Exception e){log.error("GIS查询应急队伍总计错误"+e.getMessage());}
- finally{
- closeAll() ;
- }
- return null ;
- }
-
- /**
- * 获得资源调拨图标信息
- * @param sql
- * @return
- */
- public String searchErDistByEquip(String sql, String deptId){
-
- StringBuffer sb = new StringBuffer() ;
- sb.append("[") ;
-
- try{
- rs = executeQuerySetPs(sql, deptId,deptId) ;
- while(rs.next()){
- sb.append("{") ;
- sb.append("\"posX\":\"" + (rs.getDouble("LONGITUDE")-0.5) + "\",\"posY\":\"" + rs.getDouble("LATITUDE") +
- "\",\"title\":\"单位:" + rs.getString("NAME") + "\\n发电车总计:" + rs.getString("CN") +
- "台\\t发电机总计:" + rs.getString("JN") +
- "台\",\"extraData\":{\"FD_OBJECTID\":\"" + rs.getString("FD_ID") +
- "\",\"name\":\"erso_equip\",\"DEPT_ID\":\"" + rs.getString("DEPT_ID") +
- "\",\"DEPT_NAME\":\"" + rs.getString("NAME") + "\"}},") ;
- }
-
- sb.deleteCharAt(sb.length() - 1) ;
- if(sb.length()==0){ return null ; }
- sb.append("]") ;
- return sb.toString() ;
-
- }catch(Exception e){e.printStackTrace();}
- finally{
- closeAll() ;
- }
- return null ;
- }
-
- /**
- * 获得资源发电车网省级图标信息
- * @param sql
- * @return
- */
- public String searchErByCar(String sql, String deptId, String type){
-
- StringBuffer sb = new StringBuffer() ;
- sb.append("[") ;
-
- try{
- rs = executeQuerySetPs(sql, deptId,deptId) ;
- while(rs.next()){
- sb.append("{") ;
- sb.append("\"posX\":\"" + rs.getDouble("LONGITUDE") + "\",\"posY\":\"" + rs.getDouble("LATITUDE") +
- "\",\"title\":\"单位:" + rs.getString("NAME") + "\\n" + type + "总计:" + rs.getString("NUM") +
- "台\",\"extraData\":{\"FD_OBJECTID\":\"" + rs.getString("DEPT_ID") +
- "\",\"name\":\"erso_equip\",\"DEPT_ID\":\"" + rs.getString("DEPT_ID") +
- "\",\"DEPT_NAME\":\"" + rs.getString("NAME") + "\"}},") ;
- }
-
- sb.deleteCharAt(sb.length() - 1) ;
- if(sb.length()==0){ return null ; }
- sb.append("]") ;
- return sb.toString() ;
-
- }catch(Exception e){e.printStackTrace();}
- finally{
- closeAll() ;
- }
- return null ;
- }
-
- /**
- * 获得应急资源临时安置点图标信息
- * @param sql
- * @return
- */
- public String searchErPlace(String sql){
- log.info("应急资源临时安置点图标信息SQL:"+sql);
- StringBuffer sb = new StringBuffer() ;
- sb.append("[") ;
-
- try{
- rs = executeQuery(sql) ;
- while(rs.next()){
-
- sb.append("{") ;
- sb.append("\"posX\":\"" + rs.getString("LONGITUDE") + "\",\"posY\":\"" + rs.getString("LATITUDE") +
- "\",\"title\":\"名称:" + rs.getString("SETTLEMENTS_NAME") + "\\n地点:" + rs.getString("PLACE") +
- "\\n值守人员:" + rs.getString("CONTACT_PERSON") + "\\n联系人电话:" + rs.getString("TELEPHONE") +
- "\",\"extraData\":{\"FD_OBJECTID\":\"" + rs.getString("FD_ID") +
- "\",\"name\":\"" + rs.getString("ICONNAME") + "\"}},") ;
- }
-
- sb.deleteCharAt(sb.length() - 1) ;
- if(sb.length()==0){ return null ; }
- sb.append("]") ;
- log.info("应急资源临时安置点图标信息返回结果:"+sb.toString());
- return sb.toString() ;
-
- }catch(Exception e){log.error("GIS查询临时安置点错误"+e.getMessage());}
- finally{
- closeAll() ;
- }
- return null ;
- }
-
- }
|