From 89262f3ad49bf1429e24e1669f340af0b5a188b4 Mon Sep 17 00:00:00 2001 From: 81041 <81041@192.168.10.26> Date: 星期四, 18 十月 2018 15:52:33 +0800 Subject: [PATCH] 机房事件统计 --- gx_tieta/src/com/fgkj/dao/impl/Bts_station_eventImpl.java | 366 ++++++++++++++++++++++++++++++ gx_tieta/src/com/fgkj/dao/BaseDAO.java | 2 gx_tieta/src/com/fgkj/actions/Bts_station_eventAction.java | 41 +++ gx_tieta/src/com/fgkj/dto/Bts_station_event.java | 164 +++++++++++++ gx_tieta/src/com/fgkj/services/Bts_station_eventService.java | 47 +++ gx_tieta/src/com/fgkj/dao/AlarmDaoFactory.java | 59 ++-- gx_tieta/src/com/fgkj/dao/BaseDAOFactory.java | 2 7 files changed, 657 insertions(+), 24 deletions(-) diff --git a/gx_tieta/src/com/fgkj/actions/Bts_station_eventAction.java b/gx_tieta/src/com/fgkj/actions/Bts_station_eventAction.java new file mode 100644 index 0000000..b65ea75 --- /dev/null +++ b/gx_tieta/src/com/fgkj/actions/Bts_station_eventAction.java @@ -0,0 +1,41 @@ +package com.fgkj.actions; + +import java.util.List; + +import com.fgkj.dto.BattInf; +import com.fgkj.dto.Bts_station_event; +import com.fgkj.dto.ServiceModel; +import com.fgkj.services.Batt_devalarm_data_historyService; +import com.fgkj.services.Bts_station_eventService; + +public class Bts_station_eventAction extends ActionUtil{ + private Bts_station_eventService service = new Bts_station_eventService(); + private String json; + private String result; + + + //鏈烘埧浜嬩欢缁熻 + public String serchByCondition(){ + BattInf binf=getGson("yyyy-MM-dd HH:mm:ss").fromJson(json, BattInf.class); + ServiceModel model=service.serchByCondition(binf); + result=tojson(model); + return SUCCESS; + } + //鏈烘埧浜嬩欢缁熻 + public String serchByInfo(){ + Bts_station_event bevent=getGson("yyyy-MM-dd HH:mm:ss").fromJson(json, Bts_station_event.class); + ServiceModel model=service.serchByInfo(bevent); + result=tojson(model); + return SUCCESS; + } + + public String getResult() { + return result; + } + public void setJson(String json) { + this.json = json; + } + + + +} diff --git a/gx_tieta/src/com/fgkj/dao/AlarmDaoFactory.java b/gx_tieta/src/com/fgkj/dao/AlarmDaoFactory.java index f3df074..d3c744d 100644 --- a/gx_tieta/src/com/fgkj/dao/AlarmDaoFactory.java +++ b/gx_tieta/src/com/fgkj/dao/AlarmDaoFactory.java @@ -12,7 +12,7 @@ public static final int Alarm_res_Monomer =119007; //--鍗曚綋鍐呴樆 public static final int Alarm_res_Conn =119008; //--杩炴帴鏉¢樆鎶� - public final static int ALM_TYPE_DisChargeMonVol_ID = 119009; //--鏀剧數杩囩▼涓惤鍚庡崟浣撳憡璀� + public static final int ALM_TYPE_DisChargeMonVol_ID = 119009; //--鏀剧數杩囩▼涓惤鍚庡崟浣撳憡璀� public static final int Alarm_CapAlarm =119010; //--瀹归噺鍛婅鍛婅 public static final int Alarm_CapChange =119011; //--瀹归噺鏇存崲鍛婅 @@ -21,30 +21,41 @@ public static final int ALM_TYPE_BTS9100S_FADIAN_ComError_ID =119025; //鍩虹珯鍙戠數鍛婅 public static final int ALM_TYPE_BTS9100S_DIAOZHAN_ComError_ID =119026; //鍩虹珯鎺夌珯鍛婅 public static final int ALM_TYPE_BTS9100S_DOOROPEN_ComError_ID =119027; //鍩虹珯寮�闂ㄥ憡璀� - public final static int ALM_TYPE_BTS9100S_TEMPUP_ComError_ID = 119028; //鍩虹珯娓╁害涓婇檺鍛婅 - public final static int ALM_TYPE_BTS9100S_TEMPLOW_ComError_ID = 119029; //鍩虹珯娓╁害涓嬮檺鍛婅 - public final static int ALM_TYPE_BTS9100S_DAMPUP_ComError_ID = 119030; //鍩虹珯婀垮害涓婇檺鍛婅 - public final static int ALM_TYPE_BTS9100S_DAMPLOW_ComError_ID = 119031; //鍩虹珯婀垮害涓嬮檺鍛婅 + public static final int ALM_TYPE_BTS9100S_TEMPUP_ComError_ID = 119028; //鍩虹珯娓╁害涓婇檺鍛婅 + public static final int ALM_TYPE_BTS9100S_TEMPLOW_ComError_ID = 119029; //鍩虹珯娓╁害涓嬮檺鍛婅 + public static final int ALM_TYPE_BTS9100S_DAMPUP_ComError_ID = 119030; //鍩虹珯婀垮害涓婇檺鍛婅 + public static final int ALM_TYPE_BTS9100S_DAMPLOW_ComError_ID = 119031; //鍩虹珯婀垮害涓嬮檺鍛婅 - public final static int ALM_SIGNAL_ID_Null = 0; - public final static int ALM_SIGNAL_ID_OnlineVolHigh = 1; - public final static int ALM_SIGNAL_ID_OnlineVolLow = 2; - public final static int ALM_SIGNAL_ID_GroupVolHigh = 3; - public final static int ALM_SIGNAL_ID_GroupVolLow = 4; - public final static int ALM_SIGNAL_ID_ChargeCurrHigh = 5; - public final static int ALM_SIGNAL_ID_ChargeCurrLow = 6; - public final static int ALM_SIGNAL_ID_DisChargeCurrHigh = 7; - public final static int ALM_SIGNAL_ID_DisChargeCurrLow = 8; - public final static int ALM_SIGNAL_ID_MonVolHigh = 9; - public final static int ALM_SIGNAL_ID_MonVolLow = 10; - public final static int ALM_SIGNAL_ID_MonTmpHigh = 11; - public final static int ALM_SIGNAL_ID_MonTmpLow = 12; - public final static int ALM_SIGNAL_ID_MonResHigh = 13; - public final static int ALM_SIGNAL_ID_MonResLow = 14; - public final static int ALM_SIGNAL_ID_ConnResHigh = 15; - public final static int ALM_SIGNAL_ID_ConnResLow = 16; - public final static int ALM_SIGNAL_ID_DischargeMonVolHigh = 17; - public final static int ALM_SIGNAL_ID_DischargeMonVolLow = 18; + public static final int STATION_EVENT_TYPE_POFF=1; //鍩虹珯鍋滅數 + public static final int STATION_EVENT_TYPE_XUHANG=2; //鍩虹珯缁埅 + public static final int STATION_EVENT_TYPE_FADIAN=3; //鍩虹珯鍙戠數 + public static final int STATION_EVENT_TYPE_DOOROPEN=4; //鍩虹珯寮�闂� + public static final int STATION_EVENT_TYPE_DIAOZHAN=5; //鍩虹珯鎺夌珯 + public static final int STATION_EVENT_TYPE_TEMPUP=6; //鍩虹珯娓╁害涓婇檺 + public static final int STATION_EVENT_TYPE_TEMPLOW=7; //鍩虹珯娓╁害涓嬮檺 + public static final int STATION_EVENT_TYPE_DAMPUP=8; //鍩虹珯婀垮害涓婇檺 + public static final int STATION_EVENT_TYPE_DAMPLOW=9; //鍩虹珯婀垮害涓嬮檺 + + + public static final int ALM_SIGNAL_ID_Null = 0; + public static final int ALM_SIGNAL_ID_OnlineVolHigh = 1; + public static final int ALM_SIGNAL_ID_OnlineVolLow = 2; + public static final int ALM_SIGNAL_ID_GroupVolHigh = 3; + public static final int ALM_SIGNAL_ID_GroupVolLow = 4; + public static final int ALM_SIGNAL_ID_ChargeCurrHigh = 5; + public static final int ALM_SIGNAL_ID_ChargeCurrLow = 6; + public static final int ALM_SIGNAL_ID_DisChargeCurrHigh = 7; + public static final int ALM_SIGNAL_ID_DisChargeCurrLow = 8; + public static final int ALM_SIGNAL_ID_MonVolHigh = 9; + public static final int ALM_SIGNAL_ID_MonVolLow = 10; + public static final int ALM_SIGNAL_ID_MonTmpHigh = 11; + public static final int ALM_SIGNAL_ID_MonTmpLow = 12; + public static final int ALM_SIGNAL_ID_MonResHigh = 13; + public static final int ALM_SIGNAL_ID_MonResLow = 14; + public static final int ALM_SIGNAL_ID_ConnResHigh = 15; + public static final int ALM_SIGNAL_ID_ConnResLow = 16; + public static final int ALM_SIGNAL_ID_DischargeMonVolHigh = 17; + public static final int ALM_SIGNAL_ID_DischargeMonVolLow = 18; public static final int Alarm_IGNAL_ID_CapAlarmLow =19; public static final int Alarm_IGNAL_ID_CapAlarmHigh =20; public static final int Alarm_IGNAL_ID_CapChangeLow =21; diff --git a/gx_tieta/src/com/fgkj/dao/BaseDAO.java b/gx_tieta/src/com/fgkj/dao/BaseDAO.java index 9667b61..6fc6937 100644 --- a/gx_tieta/src/com/fgkj/dao/BaseDAO.java +++ b/gx_tieta/src/com/fgkj/dao/BaseDAO.java @@ -184,6 +184,8 @@ public static final int FBS9100S_DFU_STATE=90; + public static final int BTS_STATION_EVENT=91; + public boolean add(Object obj); // 娣诲姞 public boolean update(Object obj); // 鏇存柊 diff --git a/gx_tieta/src/com/fgkj/dao/BaseDAOFactory.java b/gx_tieta/src/com/fgkj/dao/BaseDAOFactory.java index 3686ab3..aec31e6 100644 --- a/gx_tieta/src/com/fgkj/dao/BaseDAOFactory.java +++ b/gx_tieta/src/com/fgkj/dao/BaseDAOFactory.java @@ -36,6 +36,7 @@ import com.fgkj.dao.impl.BatttestdataDAOImpl; import com.fgkj.dao.impl.Batttestdata_infDAOImpl; import com.fgkj.dao.impl.BatttestdatastopDAOImpl; +import com.fgkj.dao.impl.Bts_station_eventImpl; import com.fgkj.dao.impl.Chart_ColorImpl; import com.fgkj.dao.impl.Cmcc_Power_DataImpl; import com.fgkj.dao.impl.CustompageImpl; @@ -190,6 +191,7 @@ case 88:return new BattInf_RebuildImpl(); case 89:return new Bts_station_stateImpl(); case 90:return new Fbs9100s_dfu_stateImpl(); + case 91:return new Bts_station_eventImpl(); default :return null; } } diff --git a/gx_tieta/src/com/fgkj/dao/impl/Bts_station_eventImpl.java b/gx_tieta/src/com/fgkj/dao/impl/Bts_station_eventImpl.java new file mode 100644 index 0000000..852b89b --- /dev/null +++ b/gx_tieta/src/com/fgkj/dao/impl/Bts_station_eventImpl.java @@ -0,0 +1,366 @@ +package com.fgkj.dao.impl; + +import java.sql.ResultSet; +import java.sql.SQLException; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import com.fgkj.actions.ActionUtil; +import com.fgkj.dao.AlarmDaoFactory; +import com.fgkj.dao.BaseDAO; +import com.fgkj.dao.CallBack; +import com.fgkj.dao.DAOHelper; +import com.fgkj.db.DBUtil; +import com.fgkj.dto.BattInf; +import com.fgkj.dto.Batt_Maint_Dealarm; +import com.fgkj.dto.Batt_devalarm_data_history; +import com.fgkj.dto.Bts_station_event; +import com.fgkj.dto.Page; +import com.fgkj.dto.User_inf; + +public class Bts_station_eventImpl implements BaseDAO,CallBack{ + + public List getResults(ResultSet rs) { + // TODO Auto-generated method stub + return null; + } + + public boolean add(Object obj) { + // TODO Auto-generated method stub + return false; + } + + public boolean update(Object obj) { + // TODO Auto-generated method stub + return false; + } + + public boolean del(Object obj) { + // TODO Auto-generated method stub + return false; + } + + public List searchAll() { + // TODO Auto-generated method stub + return null; + } + //鏈烘埧浜嬩欢缁熻 + public List serchByCondition(Object obj) { + final BattInf binf=(BattInf) obj; + String sql="select station_id,dev_id,station_event_type,record_datetime,station_event_trig ,tb_battinf.StationName,tb_battinf.StationName1,tb_battinf.StationName2,tb_battinf.StationName3 " + + " from db_alarm.tb_bts_station_event,db_battinf.tb_battinf " + + " where tb_bts_station_event.dev_id=tb_battinf.FBSDeviceId " + + " and record_datetime>=? and record_datetime<=? " + + " and stationname1 like ? and stationname2 like ? and stationname3 like ? and stationid like ? " ; + /*//浜嬩欢绛涢�� + String eventSqlT=" and station_event_type!=? "; + String eventSqlF=" and station_event_type=? "; + if(binf.getNum()==0){ + sql+=eventSqlT; + }else{ + sql+=eventSqlF; + }*/ + //浜嬩欢鍞竴 + String onlySql=" and station_event_trig=1 "; + sql+=onlySql; + //鎺掑簭 + String orderSql=" order by station_id,record_datetime,station_event_type asc "; + sql+=orderSql; + System.err.println(sql); + List list=DAOHelper.executeQuery(sql, DBUtil.getConn(), new Object[]{binf.getBattInUseDate(),binf.getBattInUseDate1(),"%"+binf.getStationName1()+"%","%"+binf.getStationName2()+"%","%"+binf.getStationName3()+"%","%"+binf.getStationId()+"%"}, new CallBack() { + + public List getResults(ResultSet rs) { + List list=new ArrayList(); + int STATION_EVENT_TYPE_POFF=0; //鍩虹珯鍋滅數 + int STATION_EVENT_TYPE_XUHANG=0; //鍩虹珯缁埅 + int STATION_EVENT_TYPE_FADIAN=0; //鍩虹珯鍙戠數 + int STATION_EVENT_TYPE_DOOROPEN=0; //鍩虹珯寮�闂� + int STATION_EVENT_TYPE_DIAOZHAN=0; //鍩虹珯鎺夌珯 + int STATION_EVENT_TYPE_TEMPUP=0; //鍩虹珯娓╁害涓婇檺 + int STATION_EVENT_TYPE_TEMPLOW=0; //鍩虹珯娓╁害涓嬮檺 + int STATION_EVENT_TYPE_DAMPUP=0; //鍩虹珯婀垮害涓婇檺 + int STATION_EVENT_TYPE_DAMPLOW=0; //鍩虹珯婀垮害涓嬮檺 + int dev_id=0; + int alm_type=0; + // 鏃堕棿娈� + String perid_Time = ""; + //鏈烘埧鍚嶇О + String stationName=""; + try { + while(rs.next()){ + int dev_ids=rs.getInt("dev_id"); + int alm_types=rs.getInt("station_event_type"); + String stationNames=rs.getString("stationName"); + // 骞翠唤锛屽搴︼紝鏈堜唤 + Date dev_recordtime = rs.getTimestamp("record_datetime"); + // 鑾峰彇鍏蜂綋骞翠唤锛屾湀浠藉拰璇ユ湀鐨勬�诲ぉ鏁� + int year = dev_recordtime.getYear() + 1900; + int month = dev_recordtime.getMonth() + 1; + String perid_Times=""; + if(binf.getBattGroupNum()==1){//鏈堢粺璁� + perid_Times = ActionUtil.getFirstDayOfMonth(year, month - 1); + perid_Times += "~"; + perid_Times += ActionUtil.getLastDayOfMonth(year, month - 1); + }else if (binf.getBattGroupNum()==3) {// 鎸夊勾浠� + perid_Times = ActionUtil.getFirstDayOfMonth(year, 0); + perid_Times += "~"; + perid_Times += ActionUtil.getLastDayOfMonth(year, 11); + } + if(perid_Times.equals(perid_Time)){ + if(dev_ids==dev_id){ + if(alm_types==AlarmDaoFactory.STATION_EVENT_TYPE_POFF){ + STATION_EVENT_TYPE_POFF+=1; + }else if(alm_types==AlarmDaoFactory.STATION_EVENT_TYPE_XUHANG){ + STATION_EVENT_TYPE_XUHANG+=1; + }else if(alm_types==AlarmDaoFactory.STATION_EVENT_TYPE_FADIAN){ + STATION_EVENT_TYPE_FADIAN+=1; + }else if(alm_types==AlarmDaoFactory.STATION_EVENT_TYPE_DIAOZHAN){ + STATION_EVENT_TYPE_DIAOZHAN+=1; + }else if(alm_types==AlarmDaoFactory.STATION_EVENT_TYPE_DOOROPEN){ + STATION_EVENT_TYPE_DOOROPEN+=1; + }else if(alm_types==AlarmDaoFactory.STATION_EVENT_TYPE_TEMPUP){ + STATION_EVENT_TYPE_TEMPUP+=1; + }else if(alm_types==AlarmDaoFactory.STATION_EVENT_TYPE_TEMPLOW){ + STATION_EVENT_TYPE_TEMPLOW+=1; + }else if(alm_types==AlarmDaoFactory.STATION_EVENT_TYPE_DAMPUP){ + STATION_EVENT_TYPE_DAMPUP+=1; + }else if(alm_types==AlarmDaoFactory.STATION_EVENT_TYPE_DAMPLOW){ + STATION_EVENT_TYPE_DAMPLOW+=1; + } + + }else{ + Bts_station_event bevent=new Bts_station_event(); + bevent.setStationName(stationName); + bevent.setDev_id(dev_id); + bevent.setStation_event_type_xuhang(STATION_EVENT_TYPE_XUHANG); + bevent.setStation_event_type_poff(STATION_EVENT_TYPE_POFF); + bevent.setStation_event_type_fadian(STATION_EVENT_TYPE_FADIAN); + bevent.setStation_event_type_diaozhan(STATION_EVENT_TYPE_DIAOZHAN); + bevent.setStation_event_type_dooropen(STATION_EVENT_TYPE_DOOROPEN); + + bevent.setStation_event_type_tempup(STATION_EVENT_TYPE_TEMPUP); + bevent.setStation_event_type_templow(STATION_EVENT_TYPE_TEMPLOW); + bevent.setStation_event_type_dampup(STATION_EVENT_TYPE_DAMPUP); + bevent.setNote(String.valueOf(STATION_EVENT_TYPE_DAMPLOW)); + + bevent.setNote(perid_Time); + list.add(bevent); + stationName=stationNames; + dev_id=dev_ids; + + + STATION_EVENT_TYPE_POFF=0; + STATION_EVENT_TYPE_XUHANG=0; + STATION_EVENT_TYPE_FADIAN=0; + STATION_EVENT_TYPE_DIAOZHAN=0; + STATION_EVENT_TYPE_DOOROPEN=0; + STATION_EVENT_TYPE_TEMPUP =0; //鍩虹珯娓╁害涓婇檺鍛婅 + STATION_EVENT_TYPE_TEMPLOW = 0; //鍩虹珯娓╁害涓嬮檺鍛婅 + STATION_EVENT_TYPE_DAMPUP = 0; //鍩虹珯婀垮害涓婇檺鍛婅 + STATION_EVENT_TYPE_DAMPLOW = 0; //鍩虹珯婀垮害涓嬮檺鍛婅 + if(alm_types==AlarmDaoFactory.STATION_EVENT_TYPE_POFF){ + STATION_EVENT_TYPE_POFF+=1; + }else if(alm_types==AlarmDaoFactory.STATION_EVENT_TYPE_XUHANG){ + STATION_EVENT_TYPE_XUHANG+=1; + }else if(alm_types==AlarmDaoFactory.STATION_EVENT_TYPE_FADIAN){ + STATION_EVENT_TYPE_FADIAN+=1; + }else if(alm_types==AlarmDaoFactory.STATION_EVENT_TYPE_DIAOZHAN){ + STATION_EVENT_TYPE_DIAOZHAN+=1; + }else if(alm_types==AlarmDaoFactory.STATION_EVENT_TYPE_DOOROPEN){ + STATION_EVENT_TYPE_DOOROPEN+=1; + }else if(alm_types==AlarmDaoFactory.STATION_EVENT_TYPE_TEMPUP){ + STATION_EVENT_TYPE_TEMPUP+=1; + }else if(alm_types==AlarmDaoFactory.STATION_EVENT_TYPE_TEMPLOW){ + STATION_EVENT_TYPE_TEMPLOW+=1; + }else if(alm_types==AlarmDaoFactory.STATION_EVENT_TYPE_DAMPUP){ + STATION_EVENT_TYPE_DAMPUP+=1; + }else if(alm_types==AlarmDaoFactory.STATION_EVENT_TYPE_DAMPLOW){ + STATION_EVENT_TYPE_DAMPLOW+=1; + } + } + }else{ + if(perid_Time.equals("")){ + if(alm_types==AlarmDaoFactory.STATION_EVENT_TYPE_POFF){ + STATION_EVENT_TYPE_POFF+=1; + }else if(alm_types==AlarmDaoFactory.STATION_EVENT_TYPE_XUHANG){ + STATION_EVENT_TYPE_XUHANG+=1; + }else if(alm_types==AlarmDaoFactory.STATION_EVENT_TYPE_FADIAN){ + STATION_EVENT_TYPE_FADIAN+=1; + }else if(alm_types==AlarmDaoFactory.STATION_EVENT_TYPE_DIAOZHAN){ + STATION_EVENT_TYPE_DIAOZHAN+=1; + }else if(alm_types==AlarmDaoFactory.STATION_EVENT_TYPE_DOOROPEN){ + STATION_EVENT_TYPE_DOOROPEN+=1; + }else if(alm_types==AlarmDaoFactory.STATION_EVENT_TYPE_TEMPUP){ + STATION_EVENT_TYPE_TEMPUP+=1; + }else if(alm_types==AlarmDaoFactory.STATION_EVENT_TYPE_TEMPLOW){ + STATION_EVENT_TYPE_TEMPLOW+=1; + }else if(alm_types==AlarmDaoFactory.STATION_EVENT_TYPE_DAMPUP){ + STATION_EVENT_TYPE_DAMPUP+=1; + }else if(alm_types==AlarmDaoFactory.STATION_EVENT_TYPE_DAMPLOW){ + STATION_EVENT_TYPE_DAMPLOW+=1; + } + perid_Time=perid_Times; + dev_id=dev_ids; + stationName=stationNames; + continue; + } + Bts_station_event bevent=new Bts_station_event(); + bevent.setStationName(stationName); + bevent.setDev_id(dev_id); + bevent.setStation_event_type_xuhang(STATION_EVENT_TYPE_XUHANG); + bevent.setStation_event_type_poff(STATION_EVENT_TYPE_POFF); + bevent.setStation_event_type_fadian(STATION_EVENT_TYPE_FADIAN); + bevent.setStation_event_type_diaozhan(STATION_EVENT_TYPE_DIAOZHAN); + bevent.setStation_event_type_dooropen(STATION_EVENT_TYPE_DOOROPEN); + + bevent.setStation_event_type_tempup(STATION_EVENT_TYPE_TEMPUP); + bevent.setStation_event_type_templow(STATION_EVENT_TYPE_TEMPLOW); + bevent.setStation_event_type_dampup(STATION_EVENT_TYPE_DAMPUP); + bevent.setNote(String.valueOf(STATION_EVENT_TYPE_DAMPLOW)); + + bevent.setNote(perid_Time); + //System.out.println(2+" "+dalarm.getDev_ip()+" "+dalarm.getDev_id()+" "+dalarm.getNum()+" "+dalarm.getRecord_id()+" "+dalarm.getAlm_type()+" "+dalarm.getAlm_level()+" "+dalarm.getStationName()); + list.add(bevent); + STATION_EVENT_TYPE_POFF=0; + STATION_EVENT_TYPE_XUHANG=0; + STATION_EVENT_TYPE_FADIAN=0; + STATION_EVENT_TYPE_DIAOZHAN=0; + STATION_EVENT_TYPE_DOOROPEN=0; + STATION_EVENT_TYPE_TEMPUP =0; //鍩虹珯娓╁害涓婇檺鍛婅 + STATION_EVENT_TYPE_TEMPLOW = 0; //鍩虹珯娓╁害涓嬮檺鍛婅 + STATION_EVENT_TYPE_DAMPUP = 0; //鍩虹珯婀垮害涓婇檺鍛婅 + STATION_EVENT_TYPE_DAMPLOW = 0; //鍩虹珯婀垮害涓嬮檺鍛婅 + if(alm_types==AlarmDaoFactory.STATION_EVENT_TYPE_POFF){ + STATION_EVENT_TYPE_POFF+=1; + }else if(alm_types==AlarmDaoFactory.STATION_EVENT_TYPE_XUHANG){ + STATION_EVENT_TYPE_XUHANG+=1; + }else if(alm_types==AlarmDaoFactory.STATION_EVENT_TYPE_FADIAN){ + STATION_EVENT_TYPE_FADIAN+=1; + }else if(alm_types==AlarmDaoFactory.STATION_EVENT_TYPE_DIAOZHAN){ + STATION_EVENT_TYPE_DIAOZHAN+=1; + }else if(alm_types==AlarmDaoFactory.STATION_EVENT_TYPE_DOOROPEN){ + STATION_EVENT_TYPE_DOOROPEN+=1; + }else if(alm_types==AlarmDaoFactory.STATION_EVENT_TYPE_TEMPUP){ + STATION_EVENT_TYPE_TEMPUP+=1; + }else if(alm_types==AlarmDaoFactory.STATION_EVENT_TYPE_TEMPLOW){ + STATION_EVENT_TYPE_TEMPLOW+=1; + }else if(alm_types==AlarmDaoFactory.STATION_EVENT_TYPE_DAMPUP){ + STATION_EVENT_TYPE_DAMPUP+=1; + }else if(alm_types==AlarmDaoFactory.STATION_EVENT_TYPE_DAMPLOW){ + STATION_EVENT_TYPE_DAMPLOW+=1; + } + dev_id=dev_ids; + stationName=stationNames; + perid_Time=perid_Times; + + + } + if(rs.isLast()){ + Bts_station_event bevent=new Bts_station_event(); + bevent.setStationName(stationName); + bevent.setDev_id(dev_id); + bevent.setStation_event_type_xuhang(STATION_EVENT_TYPE_XUHANG); + bevent.setStation_event_type_poff(STATION_EVENT_TYPE_POFF); + bevent.setStation_event_type_fadian(STATION_EVENT_TYPE_FADIAN); + bevent.setStation_event_type_diaozhan(STATION_EVENT_TYPE_DIAOZHAN); + bevent.setStation_event_type_dooropen(STATION_EVENT_TYPE_DOOROPEN); + + bevent.setStation_event_type_tempup(STATION_EVENT_TYPE_TEMPUP); + bevent.setStation_event_type_templow(STATION_EVENT_TYPE_TEMPLOW); + bevent.setStation_event_type_dampup(STATION_EVENT_TYPE_DAMPUP); + bevent.setNote(String.valueOf(STATION_EVENT_TYPE_DAMPLOW)); + + bevent.setNote(perid_Time); + list.add(bevent); + } + } + } catch (SQLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + return list; + } + }); + return list; + } + //鏈烘埧浜嬩欢缁熻(璇︽儏) + public List serchByInfo(Object obj) { + Bts_station_event bevent=(Bts_station_event) obj; + String sql="select station_id,dev_id,station_event_type,record_datetime,station_event_trig ,tb_battinf.StationName,tb_battinf.StationName1,tb_battinf.StationName2,tb_battinf.StationName3 " + + " from tb_bts_station_event,db_battinf.tb_battinf " + + " where tb_bts_station_event.dev_id=tb_battinf.FBSDeviceId " + + " and dev_id=? " + + " and record_datetime>=? and record_datetime<=? " + + " order by station_id,station_event_type,record_datetime,station_event_trig asc "; + List list=DAOHelper.executeQuery(sql, DBUtil.getConn(), new Object[]{bevent.getDev_id(),bevent.getRecord_datetime(),bevent.getRecord_datetime_end()}, new CallBack() { + + public List getResults(ResultSet rs) { + List list=new ArrayList(); + try { + while(rs.next()){ + Bts_station_event b=new Bts_station_event(); + b.setStation_id(rs.getInt("station_id")); + b.setDev_id(rs.getInt("dev_id")); + b.setRecord_datetime(rs.getTimestamp("record_datetime")); + b.setStation_event_type(rs.getInt("station_event_type")); + b.setStation_event_trig(rs.getInt("station_event_trig")); + b.setStationName(rs.getString("stationName")); + list.add(b); + } + } catch (SQLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + return list; + } + }); + return list; + } + public static void main(String[] args) throws ParseException { + Bts_station_eventImpl bimpl=new Bts_station_eventImpl(); + Page p = new Page(); + p.setPageCurr(1); + p.setPageSize(10); + /*鏉′欢鎵�瀛樻斁鐨勪綅缃墠鍙帮細tb_batt_maint_inf + * 鍦ㄧ嚎鐢靛帇锛歶sr_id + * 缁勭鐢靛帇锛歠ault_type_id + * 鍏呯數鐢垫祦锛歠ault_level + * 鏀剧數鐢垫祦锛歳ecord_uid + * 鍗曚綋鐢靛帇锛歮aint_type_id + * 鍗曚綋娓╁害锛歮aint_done + * 鍗曚綋鍐呴樆锛歮aint_close + * 杩炴帴鏉¢樆鎶楋細master_id + * */ + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + Date date1 = sdf.parse("2000-01-01 00:00:00"); + Date date2 = sdf.parse("2020-01-01 00:00:00"); + + + BattInf binf = new BattInf(); + binf.setNum(0); + binf.setStationName(""); + binf.setStationName1(""); + binf.setStationName2(""); + binf.setStationName3(""); + binf.setStationId(""); + binf.setBattGroupNum(1); + binf.setBattInUseDate(ActionUtil.getSimpDate(date1)); + binf.setBattInUseDate1(ActionUtil.getSimpDate(date2)); + + User_inf uinf=new User_inf(); + uinf.setUId(1002); + Batt_Maint_Dealarm bmd = new Batt_Maint_Dealarm(); + bmd.setPage(p); + bmd.setBinf(binf); + bmd.setUinf(uinf); + List<Bts_station_event> list=bimpl.serchByCondition(binf); + System.out.println(list.size()); + for (Bts_station_event b : list) { + System.out.println(b.getNote()+" "+b.getDev_id()+" "+b.getStation_event_type_poff()+" "+b.getStation_event_type_xuhang()+" "+b.getStation_event_type_fadian()+" "+b.getStation_event_type_diaozhan()+" "+b.getStation_event_type_dooropen()+" "+b.getStation_event_type_tempup()+" "+b.getStation_event_type_templow()+" "+b.getStation_event_type_dampup()+" "+b.getStation_event_type_damplow()+" "+b.getStationName()); + } + } + +} diff --git a/gx_tieta/src/com/fgkj/dto/Bts_station_event.java b/gx_tieta/src/com/fgkj/dto/Bts_station_event.java new file mode 100644 index 0000000..419cbd8 --- /dev/null +++ b/gx_tieta/src/com/fgkj/dto/Bts_station_event.java @@ -0,0 +1,164 @@ +package com.fgkj.dto; + +import java.io.Serializable; +import java.util.Date; + +import com.fgkj.dao.BaseDAO; +import com.fgkj.dao.CallBack; + +public class Bts_station_event implements Serializable{ + private int num; + private int station_id; + private String stationName; + private int dev_id; + private Date record_datetime; + private int station_event_type; + private int station_event_trig; + private String note; + + public Date record_datetime_end; + public int station_event_type_poff; //鍩虹珯鍋滅數 + public int station_event_type_xuhang; //鍩虹珯缁埅 + public int station_event_type_fadian; //鍩虹珯鍙戠數 + public int station_event_type_dooropen; //鍩虹珯寮�闂� + public int station_event_type_diaozhan; //鍩虹珯鎺夌珯 + public int station_event_type_tempup; //鍩虹珯娓╁害涓婇檺 + public int station_event_type_templow; //鍩虹珯娓╁害涓嬮檺 + public int station_event_type_dampup; //鍩虹珯婀垮害涓婇檺 + public int station_event_type_damplow; //鍩虹珯婀垮害涓嬮檺 + + public int getNum() { + return num; + } + public void setNum(int num) { + this.num = num; + } + public int getStation_id() { + return station_id; + } + public void setStation_id(int station_id) { + this.station_id = station_id; + } + public int getDev_id() { + return dev_id; + } + public void setDev_id(int dev_id) { + this.dev_id = dev_id; + } + public Date getRecord_datetime() { + return record_datetime; + } + public void setRecord_datetime(Date record_datetime) { + this.record_datetime = record_datetime; + } + public int getStation_event_type() { + return station_event_type; + } + public void setStation_event_type(int station_event_type) { + this.station_event_type = station_event_type; + } + public int getStation_event_trig() { + return station_event_trig; + } + public void setStation_event_trig(int station_event_trig) { + this.station_event_trig = station_event_trig; + } + public String getNote() { + return note; + } + public void setNote(String note) { + this.note = note; + } + + public Date getRecord_datetime_end() { + return record_datetime_end; + } + public void setRecord_datetime_end(Date record_datetime_end) { + this.record_datetime_end = record_datetime_end; + } + public int getStation_event_type_poff() { + return station_event_type_poff; + } + public void setStation_event_type_poff(int station_event_type_poff) { + this.station_event_type_poff = station_event_type_poff; + } + public int getStation_event_type_xuhang() { + return station_event_type_xuhang; + } + public void setStation_event_type_xuhang(int station_event_type_xuhang) { + this.station_event_type_xuhang = station_event_type_xuhang; + } + public int getStation_event_type_fadian() { + return station_event_type_fadian; + } + public void setStation_event_type_fadian(int station_event_type_fadian) { + this.station_event_type_fadian = station_event_type_fadian; + } + public int getStation_event_type_dooropen() { + return station_event_type_dooropen; + } + public void setStation_event_type_dooropen(int station_event_type_dooropen) { + this.station_event_type_dooropen = station_event_type_dooropen; + } + public int getStation_event_type_diaozhan() { + return station_event_type_diaozhan; + } + public void setStation_event_type_diaozhan(int station_event_type_diaozhan) { + this.station_event_type_diaozhan = station_event_type_diaozhan; + } + public int getStation_event_type_tempup() { + return station_event_type_tempup; + } + public void setStation_event_type_tempup(int station_event_type_tempup) { + this.station_event_type_tempup = station_event_type_tempup; + } + public int getStation_event_type_templow() { + return station_event_type_templow; + } + public void setStation_event_type_templow(int station_event_type_templow) { + this.station_event_type_templow = station_event_type_templow; + } + public int getStation_event_type_dampup() { + return station_event_type_dampup; + } + public void setStation_event_type_dampup(int station_event_type_dampup) { + this.station_event_type_dampup = station_event_type_dampup; + } + public int getStation_event_type_damplow() { + return station_event_type_damplow; + } + public void setStation_event_type_damplow(int station_event_type_damplow) { + this.station_event_type_damplow = station_event_type_damplow; + } + public String getStationName() { + return stationName; + } + public void setStationName(String stationName) { + this.stationName = stationName; + } + @Override + public String toString() { + return "Bts_station_event [num=" + num + ", station_id=" + station_id + + ", stationName=" + stationName + ", dev_id=" + dev_id + + ", record_datetime=" + record_datetime + + ", station_event_type=" + station_event_type + + ", station_event_trig=" + station_event_trig + ", note=" + + note + ", record_datetime_end=" + record_datetime_end + + ", station_event_type_poff=" + station_event_type_poff + + ", station_event_type_xuhang=" + station_event_type_xuhang + + ", station_event_type_fadian=" + station_event_type_fadian + + ", station_event_type_dooropen=" + + station_event_type_dooropen + + ", station_event_type_diaozhan=" + + station_event_type_diaozhan + ", station_event_type_tempup=" + + station_event_type_tempup + ", station_event_type_templow=" + + station_event_type_templow + ", station_event_type_dampup=" + + station_event_type_dampup + ", station_event_type_damplow=" + + station_event_type_damplow + "]"; + } + + + + + +} diff --git a/gx_tieta/src/com/fgkj/services/Bts_station_eventService.java b/gx_tieta/src/com/fgkj/services/Bts_station_eventService.java new file mode 100644 index 0000000..55c5ed2 --- /dev/null +++ b/gx_tieta/src/com/fgkj/services/Bts_station_eventService.java @@ -0,0 +1,47 @@ +package com.fgkj.services; + +import java.util.List; + +import com.fgkj.dao.BaseDAO; +import com.fgkj.dao.BaseDAOFactory; +import com.fgkj.dao.impl.Batt_devalarm_data_historyImpl; +import com.fgkj.dto.ServiceModel; + +public class Bts_station_eventService { + private ServiceModel model; + private BaseDAO dao; + + public Bts_station_eventService() { + super(); + model=new ServiceModel(); + dao=BaseDAOFactory.getBaseDAO(BaseDAO.BTS_STATION_EVENT); + } + + //鏈烘埧浜嬩欢缁熻 + public ServiceModel serchByCondition(Object obj){ + List list=dao.serchByCondition(obj); + if(list!=null&&list.size()>0){ + model.setCode(1); + model.setData(list); + model.setMsg("鏌ヨ鎴愬姛!"); + }else{ + model.setCode(0); + model.setMsg("鏌ヨ澶辫触!"); + } + return model; + } + //鏈烘埧浜嬩欢缁熻(璇︽儏) + public ServiceModel serchByInfo(Object obj) { + List list=dao.serchByInfo(obj); + if(list!=null&&list.size()>0){ + model.setCode(1); + model.setData(list); + model.setMsg("鏌ヨ鎴愬姛!"); + }else{ + model.setCode(0); + model.setMsg("鏌ヨ澶辫触!"); + } + return model; + } + +} -- Gitblit v1.9.1