81041
2018-10-22 30df21c8751c3d0d1639727a0e9352882dca4c1b
基站实时状态和基站统计添加用户管理
5个文件已修改
88 ■■■■ 已修改文件
gx_tieta/src/com/fgkj/actions/Bts_station_eventAction.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
gx_tieta/src/com/fgkj/actions/ram/Bts_station_stateAction.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
gx_tieta/src/com/fgkj/dao/impl/Bts_station_eventImpl.java 29 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
gx_tieta/src/com/fgkj/dao/impl/ram/Bts_station_stateImpl.java 37 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
gx_tieta/src/com/fgkj/services/ram/Bts_station_stateService.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
gx_tieta/src/com/fgkj/actions/Bts_station_eventAction.java
@@ -5,6 +5,7 @@
import com.fgkj.dto.BattInf;
import com.fgkj.dto.Bts_station_event;
import com.fgkj.dto.ServiceModel;
import com.fgkj.dto.User_inf;
import com.fgkj.services.Batt_devalarm_data_historyService;
import com.fgkj.services.Bts_station_eventService;
@@ -17,6 +18,8 @@
    //机房事件统计
    public String serchByCondition(){
        BattInf binf=getGson("yyyy-MM-dd HH:mm:ss").fromJson(json, BattInf.class);
        User_inf uinf=(User_inf) getUser();
        binf.setNum(uinf.getUId());
        ServiceModel model=service.serchByCondition(binf);
        result=tojson(model);
        return SUCCESS;
@@ -24,6 +27,8 @@
    //机房事件统计
    public String serchByInfo(){
        Bts_station_event bevent=getGson("yyyy-MM-dd HH:mm:ss").fromJson(json, Bts_station_event.class);
        User_inf uinf=(User_inf) getUser();
        bevent.setNum(uinf.getUId());
        ServiceModel model=service.serchByInfo(bevent);
        result=tojson(model);
        return SUCCESS;
gx_tieta/src/com/fgkj/actions/ram/Bts_station_stateAction.java
@@ -3,6 +3,7 @@
import com.fgkj.actions.ActionUtil;
import com.fgkj.dto.BattInf;
import com.fgkj.dto.ServiceModel;
import com.fgkj.dto.User_inf;
import com.fgkj.services.ram.Bts_station_stateService;
public class Bts_station_stateAction extends ActionUtil{
@@ -12,10 +13,19 @@
    //查询机房实时状态
    public String serchByCondition(){
        BattInf binf=getGson("yyyy-MM-dd HH:mm:ss").fromJson(json, BattInf.class);
        User_inf uinf=(User_inf) getUser();
        binf.setNum(uinf.getUId());
        ServiceModel model=service.serchByCondition(binf);
        result=tojson(model);
        return SUCCESS;
    }
  //查询当前机房停电数
    public String serchByState(){
        User_inf uinf=(User_inf) getUser();
        ServiceModel model=service.serchByState(uinf);
        result=tojson(model);
        return SUCCESS;
    }
    
    
    
gx_tieta/src/com/fgkj/dao/impl/Bts_station_eventImpl.java
@@ -57,6 +57,13 @@
        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 tb_bts_station_event.station_id in (" +
               "  select distinct db_battinf.tb_battinf.stationid  " +
               "  from db_battinf.tb_battinf " +
               "  left outer join db_user.tb_user_battgroup_baojigroup_battgroup on db_user.tb_user_battgroup_baojigroup_battgroup.stationid=db_battinf.tb_battinf.stationid " +
               "  left outer join db_user.tb_user_battgroup_baojigroup_usr on db_user.tb_user_battgroup_baojigroup_usr.baoji_group_id=db_user.tb_user_battgroup_baojigroup_battgroup.baoji_group_id " +
               "  left outer join db_user.tb_user_inf on tb_user_inf.uid=db_user.tb_user_battgroup_baojigroup_usr.uid " +
               "  where db_user.tb_user_inf.uid=?  ) " +
                " and  record_datetime>=?  and  record_datetime<=?  " +
                " and stationname1 like ? and stationname2 like  ? and stationname3 like ? and stationid like ? " ;
        /*//事件筛选
@@ -74,7 +81,7 @@
        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() {
        List list=DAOHelper.executeQuery(sql, DBUtil.getConn(), new Object[]{binf.getNum(),binf.getBattInUseDate(),binf.getBattInUseDate1(),"%"+binf.getStationName1()+"%","%"+binf.getStationName2()+"%","%"+binf.getStationName3()+"%","%"+binf.getStationId()+"%"}, new CallBack() {
            
            public List getResults(ResultSet rs) {
                List list=new ArrayList();
@@ -300,6 +307,13 @@
        String sql="select  distinct 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 tb_bts_station_event.station_id in (" +
                "  select distinct db_battinf.tb_battinf.stationid  " +
                "  from db_battinf.tb_battinf " +
                "  left outer join db_user.tb_user_battgroup_baojigroup_battgroup on db_user.tb_user_battgroup_baojigroup_battgroup.stationid=db_battinf.tb_battinf.stationid " +
                "  left outer join db_user.tb_user_battgroup_baojigroup_usr on db_user.tb_user_battgroup_baojigroup_usr.baoji_group_id=db_user.tb_user_battgroup_baojigroup_battgroup.baoji_group_id " +
                "  left outer join db_user.tb_user_inf on tb_user_inf.uid=db_user.tb_user_battgroup_baojigroup_usr.uid " +
                "  where db_user.tb_user_inf.uid=?  ) " +
                " and dev_id=?  " +
                " and  record_datetime>=?  and  record_datetime<=? ";
        //基站状态
@@ -318,7 +332,7 @@
        //sql+=limitSql;
        //,(p.getPageCurr()-1)*p.getPageSize(),p.getPageSize()
        //executeQueryLimit
        List<Bts_station_event> list=DAOHelper.executeQuery(sql, DBUtil.getConn(), new Object[]{bevent.getDev_id(),bevent.getRecord_datetime(),bevent.getRecord_datetime_end(),bevent.getStation_event_type()}, new CallBack() {
        List<Bts_station_event> list=DAOHelper.executeQuery(sql, DBUtil.getConn(), new Object[]{bevent.getNum(),bevent.getDev_id(),bevent.getRecord_datetime(),bevent.getRecord_datetime_end(),bevent.getStation_event_type()}, new CallBack() {
            
            public List getResults(ResultSet rs) {
                List list=new ArrayList();
@@ -371,7 +385,7 @@
        
        
        BattInf binf = new BattInf();
        binf.setNum(0);
        binf.setNum(1002);
        binf.setStationName("");
        binf.setStationName1("");
        binf.setStationName2("");
@@ -387,12 +401,13 @@
        bmd.setPage(p);
        bmd.setBinf(binf);
        bmd.setUinf(uinf);
       /* List<Bts_station_event> list=bimpl.serchByCondition(binf);
        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());
        }*/
        }
        Bts_station_event b=new Bts_station_event();
        b.setNum(1002);
        b.setDev_id(910000001);
        b.setRecord_datetime(ActionUtil.getSimpDate(date1));
        b.setRecord_datetime_end(ActionUtil.getSimpDate(date2));
@@ -401,8 +416,8 @@
        page.setPageCurr(1);
        page.setPageSize(10);
        b.setPage(page);
        List list=bimpl.serchByInfo(b);
        System.out.println(list.size());
        /*List list=bimpl.serchByInfo(b);
        System.out.println(list.size());*/
    }
}
gx_tieta/src/com/fgkj/dao/impl/ram/Bts_station_stateImpl.java
@@ -10,9 +10,11 @@
import com.fgkj.dao.CallBack;
import com.fgkj.dao.DAOHelper;
import com.fgkj.dao.LimitNumberFactory;
import com.fgkj.dao.UinfDaoFactory;
import com.fgkj.db.DBUtil;
import com.fgkj.dto.BattInf;
import com.fgkj.dto.Page;
import com.fgkj.dto.User_inf;
import com.fgkj.dto.ram.Bts_station_state;
public class Bts_station_stateImpl implements BaseDAO,CallBack{
@@ -52,10 +54,16 @@
                   " ,tb_battinf.stationname,tb_battinf.stationname1,tb_battinf.stationname2,tb_battinf.stationname3 " +
                   " from db_ram_db.tb_bts_station_state,db_battinf.tb_battinf  " +
                   " where  tb_bts_station_state.dev_id=db_battinf.tb_battinf.FBSDeviceId  " +
                   " and tb_bts_station_state.station_id=db_battinf.tb_battinf.StationId  " +
                   "  and tb_bts_station_state.station_id in (" +
                   "  select distinct db_battinf.tb_battinf.stationid  " +
                   "  from db_battinf.tb_battinf " +
                   "  left outer join db_user.tb_user_battgroup_baojigroup_battgroup on db_user.tb_user_battgroup_baojigroup_battgroup.stationid=db_battinf.tb_battinf.stationid " +
                   "  left outer join db_user.tb_user_battgroup_baojigroup_usr on db_user.tb_user_battgroup_baojigroup_usr.baoji_group_id=db_user.tb_user_battgroup_baojigroup_battgroup.baoji_group_id " +
                   "  left outer join db_user.tb_user_inf on tb_user_inf.uid=db_user.tb_user_battgroup_baojigroup_usr.uid " +
                   "  where db_user.tb_user_inf.uid=?  ) " +
                   " and tb_battinf.stationname1 like ? and tb_battinf.stationname2 like ? and tb_battinf.stationname3 like ? " +
                   " and stationid like ?  limit ? ,? ";
        List<Bts_station_state> list=DAOHelper.executeQueryLimit(sql, conn, new Object[]{"%"+binf.getStationName1()+"%","%"+binf.getStationName2()+"%","%"+binf.getStationName3()+"%","%"+binf.getStationId()+"%",(p.getPageCurr()-1)*p.getPageSize(),p.getPageSize()},new CallBack() {
        List<Bts_station_state> list=DAOHelper.executeQueryLimit(sql, conn, new Object[]{binf.getNum(),"%"+binf.getStationName1()+"%","%"+binf.getStationName2()+"%","%"+binf.getStationName3()+"%","%"+binf.getStationId()+"%",(p.getPageCurr()-1)*p.getPageSize(),p.getPageSize()},new CallBack() {
            
            public List getResults(ResultSet rs) {
                List list=new ArrayList();
@@ -112,9 +120,17 @@
        return list;
    }
    //查询当前机房停电数
    public int serchByState() {
        String sql=" select count(*) as nums from db_ram_db.tb_bts_station_state where station_stat&2>1  ";
        List list=DAOHelper.executeQuery(sql, DBUtil.getConn(), null, new CallBack() {
    public int serchByState(Object obj) {
        User_inf uinf=(User_inf) obj;
        String sql=" select count(*) as nums from db_ram_db.tb_bts_station_state where station_stat&2>1  " +
                   "  and tb_bts_station_state.station_id in (" +
                   "  select distinct db_battinf.tb_battinf.stationid  " +
                   "  from db_battinf.tb_battinf " +
                   "  left outer join db_user.tb_user_battgroup_baojigroup_battgroup on db_user.tb_user_battgroup_baojigroup_battgroup.stationid=db_battinf.tb_battinf.stationid " +
                   "  left outer join db_user.tb_user_battgroup_baojigroup_usr on db_user.tb_user_battgroup_baojigroup_usr.baoji_group_id=db_user.tb_user_battgroup_baojigroup_battgroup.baoji_group_id " +
                   "  left outer join db_user.tb_user_inf on tb_user_inf.uid=db_user.tb_user_battgroup_baojigroup_usr.uid " +
                   "  where db_user.tb_user_inf.uid=?  ) " ;
        List list=DAOHelper.executeQuery(sql, DBUtil.getConn(), new Object[]{uinf.getUId()}, new CallBack() {
            
            public List getResults(ResultSet rs) {
                List list=new ArrayList();
@@ -142,21 +158,24 @@
    public static void main(String[] args) {
        Bts_station_stateImpl bimpl=new Bts_station_stateImpl();
        BattInf binf=new BattInf();
        binf.setNum(1002);
        binf.setStationName1("");
        binf.setStationName2("");
        binf.setStationName3("");
        binf.setStationId("");
        User_inf uinf=new User_inf();
        uinf.setUId(1002);
        Page p=new Page();
        p.setPageCurr(1);
        p.setPageSize(1);
        binf.setPage(p);
        /*List<Bts_station_state> list=bimpl.serchByCondition(binf);
        List<Bts_station_state> list=bimpl.serchByCondition(binf);
        for (Bts_station_state bs : list) {
            //System.out.println(bs.getStation_stat_diaozhan()+"  "+bs.getStation_stat_dooropen()+"  "+bs.getStation_stat_fadian()+"   "+bs.getStation_stat_xuhang()+"  "+bs.getStation_stat_poff());
            System.out.println(bs);
        }*/
        int nums=bimpl.serchByState();
        System.out.println(nums);
        }
        /*int nums=bimpl.serchByState(uinf);
        System.out.println(nums);*/
    }
    
gx_tieta/src/com/fgkj/services/ram/Bts_station_stateService.java
@@ -4,6 +4,7 @@
import com.fgkj.dao.BaseDAO;
import com.fgkj.dao.BaseDAOFactory;
import com.fgkj.dao.impl.ram.Bts_station_stateImpl;
import com.fgkj.dto.ServiceModel;
public class Bts_station_stateService {
@@ -28,5 +29,11 @@
        }
        return model;    
    }
    //查询当前机房停电数
    public ServiceModel serchByState(Object obj) {
        int nums=((Bts_station_stateImpl)dao).serchByState(obj);
        model.setNewsum(nums);
        return model;
    }
}