| | |
| | | |
| | | import com.fgkj.dto.BattInf; |
| | | import com.fgkj.dto.ServiceModel; |
| | | import com.fgkj.dto.User_inf; |
| | | import com.fgkj.services.Batt_rtstateService; |
| | | |
| | | public class Batt_rtstateAction extends ActionUtil{ |
| | |
| | | //查看实时充放电信息 |
| | | public String serchByInfo() { |
| | | BattInf binf=getGson("yyyy-MM-dd HH:mm:ss").fromJson(json, BattInf.class); |
| | | User_inf uinf=(User_inf) getUser(); |
| | | binf.setInstall_user(uinf.getUId().toString()); |
| | | ServiceModel model=service.serchByInfo(binf); |
| | | result=tojson(model); |
| | | return SUCCESS; |
| | | } |
| | | //实时查询充放电统计 |
| | | public String serchDisOrChargrNew() { |
| | | BattInf binf=getGson("yyyy-MM-dd HH:mm:ss").fromJson(json, BattInf.class); |
| | | ServiceModel model=service.serchDisOrChargrNew(binf); |
| | | User_inf uinf=(User_inf) getUser(); |
| | | ServiceModel model=service.serchDisOrChargrNew(uinf); |
| | | result=tojson(model); |
| | | return SUCCESS; |
| | | } |
| | |
| | | import com.fgkj.dto.BattInf; |
| | | import com.fgkj.dto.Page; |
| | | import com.fgkj.dto.ServiceModel; |
| | | import com.fgkj.dto.User_inf; |
| | | import com.fgkj.services.Battalarm_dataService; |
| | | |
| | | public class Battalarm_dataAction extends ActionUtil{ |
| | |
| | | } |
| | | //查询实时告警(分页) |
| | | public String serchByInfo() { |
| | | BattInf binf=getGson("yyyy-MM-dd HH:mm:ss").fromJson(json, BattInf.class);Page page=getGson("yyyy-MM-dd HH:mm:ss").fromJson(json, Page.class); |
| | | ServiceModel model=service.serchByInfo(binf); |
| | | Page page=getGson("yyyy-MM-dd HH:mm:ss").fromJson(json, Page.class); |
| | | User_inf uinf=(User_inf) getUser(); |
| | | page.setPageAll(uinf.getUId()); |
| | | ServiceModel model=service.serchByInfo(page); |
| | | result=tojson(model); |
| | | return SUCCESS; |
| | | } |
| | |
| | | } |
| | | //查询实时告警的总数 |
| | | public String searchAlarmNum() { |
| | | BattInf binf=getGson("yyyy-MM-dd HH:mm:ss").fromJson(json, BattInf.class); |
| | | ServiceModel model=service.searchAlarmNum(binf); |
| | | User_inf uinf=(User_inf) getUser(); |
| | | ServiceModel model=service.searchAlarmNum(uinf); |
| | | result=tojson(model); |
| | | return SUCCESS; |
| | | } |
| | |
| | | import com.fgkj.dto.BattInf; |
| | | import com.fgkj.dto.Page; |
| | | import com.fgkj.dto.ServiceModel; |
| | | import com.fgkj.dto.User_inf; |
| | | import com.fgkj.services.Battalarm_data_historyService; |
| | | |
| | | public class Battalarm_data_historyAction extends ActionUtil{ |
| | |
| | | } |
| | | //查询所有的历史告警(分页) |
| | | public String serchByInfo() { |
| | | BattInf binf=getGson("yyyy-MM-dd HH:mm:ss").fromJson(json, BattInf.class); |
| | | ServiceModel model=service.serchByInfo(binf); |
| | | Page page=getGson("yyyy-MM-dd HH:mm:ss").fromJson(json, Page.class); |
| | | User_inf uinf=(User_inf) getUser(); |
| | | page.setPageAll(uinf.getUId()); |
| | | ServiceModel model=service.serchByInfo(page); |
| | | result=tojson(model); |
| | | return SUCCESS; |
| | | } |
| | |
| | | import com.fgkj.db.DBUtil; |
| | | import com.fgkj.dto.BattInf; |
| | | import com.fgkj.dto.Batt_rtstate; |
| | | import com.fgkj.dto.User_inf; |
| | | |
| | | public class Batt_rtstateImpl implements BaseDAO,CallBack{ |
| | | |
| | |
| | | } |
| | | //测试数据——实时查询充放电统计 |
| | | public List serchDisOrChargrNew(Object obj){ |
| | | BattInf binf=(BattInf) obj; |
| | | User_inf uinf=(User_inf) obj; |
| | | String sql=" select sum(if(batt_test_type=2,1,0)) as charge,sum(if(batt_test_type=3,1,0)) as discharge " |
| | | + " from db_ram_db.tb_batt_rtstate,db_battinf.tb_battinf " |
| | | + " where db_ram_db.tb_batt_rtstate.battGroupId=db_battinf.tb_battinf.battGroupId " |
| | | + " and batt_test_type IN(2,3) " |
| | | + " and db_battinf.tb_battinf.FBSDeviceId=? " |
| | | + " GROUP BY batt_test_type "; |
| | | List list=DAOHelper.executeQuery(sql, DBUtil.getConn(),new Object[]{binf.getFBSDeviceId()}, new CallBack() { |
| | | + " and batt_test_type IN(2,3) "; |
| | | //用于用户管理的电池组的筛选 |
| | | String userSql=" and db_ram_db.tb_batt_rtstate.BattGroupId in(select distinct db_battinf.tb_battinf.battgroupid " + |
| | | " from db_battinf.tb_battinf,db_user.tb_user_battgroup_baojigroup_battgroup,db_user.tb_user_battgroup_baojigroup_usr,db_user.tb_user_inf " + |
| | | " where db_user.tb_user_battgroup_baojigroup_battgroup.BattGroupId=db_battinf.tb_battinf.BattGroupId " + |
| | | " and db_user.tb_user_battgroup_baojigroup_usr.baoji_group_id=db_user.tb_user_battgroup_baojigroup_battgroup.baoji_group_id " + |
| | | " and db_user.tb_user_inf.uid=db_user.tb_user_battgroup_baojigroup_usr.uid " + |
| | | " and db_user.tb_user_inf.uid=? )"; |
| | | sql+=userSql; |
| | | //分页和排序 |
| | | String endSql=" GROUP BY batt_test_type "; |
| | | sql+=endSql; |
| | | List list=DAOHelper.executeQuery(sql, DBUtil.getConn(),new Object[]{uinf.getUId()}, new CallBack() { |
| | | |
| | | public List getResults(ResultSet rs) { |
| | | List list=new ArrayList(); |
| | |
| | | + " ,batt_state,batt_test_type,batt_test_starttime,batt_test_recordtime,batt_test_tlong,batt_test_cap,batt_real_cap,batt_rest_cap" |
| | | + " ,FBSDeviceId,BattGroupName " |
| | | + " from db_ram_db.tb_batt_rtstate,db_battinf.tb_battinf " |
| | | + " where db_ram_db.tb_batt_rtstate.battGroupId=db_battinf.tb_battinf.battGroupId " |
| | | + " and db_battinf.tb_battinf.FBSDeviceId=? "; |
| | | + " where db_ram_db.tb_batt_rtstate.battGroupId=db_battinf.tb_battinf.battGroupId "; |
| | | //判断是充电还是放电 |
| | | String chargeSqlT=" and batt_state!=? "; |
| | | String chargeSqlF=" and batt_state=? "; |
| | |
| | | }else{ |
| | | sql+=chargeSqlF; |
| | | } |
| | | //用于用户管理的电池组的筛选 |
| | | String userSql=" and db_ram_db.tb_batt_rtstate.BattGroupId in(select distinct db_battinf.tb_battinf.battgroupid " + |
| | | " from db_battinf.tb_battinf,db_user.tb_user_battgroup_baojigroup_battgroup,db_user.tb_user_battgroup_baojigroup_usr,db_user.tb_user_inf " + |
| | | " where db_user.tb_user_battgroup_baojigroup_battgroup.BattGroupId=db_battinf.tb_battinf.BattGroupId " + |
| | | " and db_user.tb_user_battgroup_baojigroup_usr.baoji_group_id=db_user.tb_user_battgroup_baojigroup_battgroup.baoji_group_id " + |
| | | " and db_user.tb_user_inf.uid=db_user.tb_user_battgroup_baojigroup_usr.uid " + |
| | | " and db_user.tb_user_inf.uid=? )"; |
| | | sql+=userSql; |
| | | //分页和排序 |
| | | String endsql=" order by batt_test_starttime desc"; |
| | | sql+=endsql; |
| | | //System.out.println(sql); |
| | | List list=DAOHelper.executeQuery(sql, DBUtil.getConn(), new Object[]{binf.getFBSDeviceId(),binf.getNum()}, new CallBack() { |
| | | List list=DAOHelper.executeQuery(sql, DBUtil.getConn(), new Object[]{binf.getNum(),binf.getInstall_user()}, new CallBack() { |
| | | |
| | | @Override |
| | | public List getResults(ResultSet rs) { |
| | |
| | | Batt_rtstateImpl bimpl=new Batt_rtstateImpl(); |
| | | BattInf binf=new BattInf(); |
| | | binf.setNum(100); |
| | | List<Integer> list=bimpl.serchDisOrChargrNew(binf); |
| | | binf.setInstall_user("1002"); |
| | | User_inf uinf=new User_inf(); |
| | | uinf.setUId(1002); |
| | | /*List<Batt_rtstate> list=bimpl.serchByInfo(binf); |
| | | for (Batt_rtstate b : list) { |
| | | System.out.println(b); |
| | | }*/ |
| | | List<Integer> list=bimpl.serchDisOrChargrNew(uinf); |
| | | for (Integer num : list) { |
| | | System.out.println(num); |
| | | } |
| | |
| | | import com.fgkj.dto.BattInf; |
| | | import com.fgkj.dto.Battalarm_data; |
| | | import com.fgkj.dto.Page; |
| | | import com.fgkj.dto.User_inf; |
| | | |
| | | public class Battalarm_dataImpl implements BaseDAO,CallBack{ |
| | | |
| | |
| | | //查询实时告警(分页) |
| | | @Override |
| | | public List serchByInfo(Object obj) { |
| | | BattInf binf=(BattInf) obj; |
| | | Page page=binf.getPage(); |
| | | Page page=(Page) obj; |
| | | String sql=" select distinct db_alarm.tb_battalarm_data.battgroupid,alm_start_time,alm_id,db_alarm.tb_battalarm_data.monnum,alm_signal_id,alm_level " |
| | | + " ,FBSDeviceId,BattGroupName " |
| | | + " from db_alarm.tb_battalarm_data,db_battinf.tb_battinf " |
| | | + " where db_alarm.tb_battalarm_data.battGroupId=db_battinf.tb_battinf.battGroupId " |
| | | + " and db_battinf.tb_battinf.FBSDeviceId=? " |
| | | + " order by db_alarm.tb_battalarm_data.battgroupid asc,alm_start_time desc " |
| | | + " where db_alarm.tb_battalarm_data.battGroupId=db_battinf.tb_battinf.battGroupId "; |
| | | |
| | | //用于用户管理的电池组的筛选 |
| | | String userSql=" and db_alarm.tb_battalarm_data.BattGroupId in(select distinct db_battinf.tb_battinf.battgroupid " + |
| | | " from db_battinf.tb_battinf,db_user.tb_user_battgroup_baojigroup_battgroup,db_user.tb_user_battgroup_baojigroup_usr,db_user.tb_user_inf " + |
| | | " where db_user.tb_user_battgroup_baojigroup_battgroup.BattGroupId=db_battinf.tb_battinf.BattGroupId " + |
| | | " and db_user.tb_user_battgroup_baojigroup_usr.baoji_group_id=db_user.tb_user_battgroup_baojigroup_battgroup.baoji_group_id " + |
| | | " and db_user.tb_user_inf.uid=db_user.tb_user_battgroup_baojigroup_usr.uid " + |
| | | " and db_user.tb_user_inf.uid=? )"; |
| | | sql+=userSql; |
| | | //排序和分页 |
| | | String endSql=" order by db_alarm.tb_battalarm_data.battgroupid asc,alm_start_time desc " |
| | | + " limit ?,? "; |
| | | List list=DAOHelper.executeQuery(sql, DBUtil.getConn(), new Object[]{binf.getFBSDeviceId(),(page.getPageCurr()-1)*page.getPageSize(),page.getPageSize()}, new CallBack() { |
| | | sql+=endSql; |
| | | List list=DAOHelper.executeQuery(sql, DBUtil.getConn(), new Object[]{page.getPageAll(),(page.getPageCurr()-1)*page.getPageSize(),page.getPageSize()}, new CallBack() { |
| | | |
| | | @Override |
| | | public List getResults(ResultSet rs) { |
| | |
| | | } |
| | | //查询实时告警的总数 |
| | | public List searchAlarmNum(Object obj){ |
| | | BattInf binf=(BattInf) obj; |
| | | User_inf uinf=(User_inf) obj;; |
| | | String sql=" select count(db_alarm.tb_battalarm_data.num) as number " |
| | | + " from db_alarm.tb_battalarm_data,db_battinf.tb_battinf " |
| | | + " where db_alarm.tb_battalarm_data.battGroupId=db_battinf.tb_battinf.battGroupId " |
| | | + " and db_battinf.tb_battinf.FBSDeviceId=? "; |
| | | List list=DAOHelper.executeQuery(sql, DBUtil.getConn(), new Object[]{binf.getFBSDeviceId()}, new CallBack() { |
| | | + " where db_alarm.tb_battalarm_data.battGroupId=db_battinf.tb_battinf.battGroupId "; |
| | | //用于用户管理的电池组的筛选 |
| | | String userSql=" and db_alarm.tb_battalarm_data.BattGroupId in(select distinct db_battinf.tb_battinf.battgroupid " + |
| | | " from db_battinf.tb_battinf,db_user.tb_user_battgroup_baojigroup_battgroup,db_user.tb_user_battgroup_baojigroup_usr,db_user.tb_user_inf " + |
| | | " where db_user.tb_user_battgroup_baojigroup_battgroup.BattGroupId=db_battinf.tb_battinf.BattGroupId " + |
| | | " and db_user.tb_user_battgroup_baojigroup_usr.baoji_group_id=db_user.tb_user_battgroup_baojigroup_battgroup.baoji_group_id " + |
| | | " and db_user.tb_user_inf.uid=db_user.tb_user_battgroup_baojigroup_usr.uid " + |
| | | " and db_user.tb_user_inf.uid=? )"; |
| | | sql+=userSql; |
| | | List list=DAOHelper.executeQuery(sql, DBUtil.getConn(), new Object[]{uinf.getUId()}, new CallBack() { |
| | | |
| | | @Override |
| | | public List getResults(ResultSet rs) { |
| | |
| | | Battalarm_dataImpl bimpl=new Battalarm_dataImpl(); |
| | | /*List<Battalarm_data> list=bimpl.searchAll();*/ |
| | | Page p=new Page(); |
| | | p.setPageAll(1002); |
| | | p.setPageCurr(1); |
| | | p.setPageSize(6); |
| | | List<Battalarm_data> list=bimpl.serchByInfo(p); |
| | | /*List<Battalarm_data> list=bimpl.serchByInfo(p); |
| | | for (Battalarm_data b : list) { |
| | | System.out.println(b); |
| | | } |
| | | System.out.println(list.size()); |
| | | /*List<Integer> list=bimpl.searchAlarmNum(); |
| | | System.out.println(list.size());*/ |
| | | User_inf uinf=new User_inf(); |
| | | uinf.setUId(1002); |
| | | List<Integer> list=bimpl.searchAlarmNum(uinf); |
| | | for (Integer number : list) { |
| | | System.out.println(number); |
| | | }*/ |
| | | } |
| | | } |
| | | } |
| | |
| | | } |
| | | //查询所有的历史告警(分页) |
| | | public List serchByInfo(Object obj) { |
| | | BattInf binf=(BattInf) obj; |
| | | Page page=binf.getPage(); |
| | | Page page=(Page) obj; |
| | | String sql="select distinct(db_alarm.tb_battalarm_data_history.BattGroupId),db_alarm.tb_battalarm_data_history.num,alm_signal_id,db_alarm.tb_battalarm_data_history.monnum,alm_value,alm_level,alm_is_confirmed,alm_confirmed_time,alm_start_time,alm_end_time " |
| | | + " ,FBSDeviceId,BattGroupName " |
| | | + " from db_alarm.tb_battalarm_data_history,db_battinf.tb_battinf" |
| | | + " where db_alarm.tb_battalarm_data_history.battGroupId=db_battinf.tb_battinf.battGroupId " |
| | | + " and db_battinf.tb_battinf.FBSDeviceId=? " |
| | | + " order by db_alarm.tb_battalarm_data_history.BattGroupId asc,alm_start_time desc " |
| | | + " where db_alarm.tb_battalarm_data_history.battGroupId=db_battinf.tb_battinf.battGroupId "; |
| | | //用于用户管理的电池组的筛选 |
| | | String userSql=" and db_alarm.tb_battalarm_data_history.BattGroupId in(select distinct db_battinf.tb_battinf.battgroupid " + |
| | | " from db_battinf.tb_battinf,db_user.tb_user_battgroup_baojigroup_battgroup,db_user.tb_user_battgroup_baojigroup_usr,db_user.tb_user_inf " + |
| | | " where db_user.tb_user_battgroup_baojigroup_battgroup.BattGroupId=db_battinf.tb_battinf.BattGroupId " + |
| | | " and db_user.tb_user_battgroup_baojigroup_usr.baoji_group_id=db_user.tb_user_battgroup_baojigroup_battgroup.baoji_group_id " + |
| | | " and db_user.tb_user_inf.uid=db_user.tb_user_battgroup_baojigroup_usr.uid " + |
| | | " and db_user.tb_user_inf.uid=? )"; |
| | | sql+=userSql; |
| | | //分页和排序 |
| | | String endSql=" order by db_alarm.tb_battalarm_data_history.BattGroupId asc,alm_start_time desc " |
| | | + " limit ?,? "; |
| | | List list=DAOHelper.executeQuery(sql, DBUtil.getConn(), new Object[]{binf.getFBSDeviceId(),(page.getPageCurr()-1)*page.getPageSize(),page.getPageSize()}, new CallBack() { |
| | | sql+=endSql; |
| | | List list=DAOHelper.executeQuery(sql, DBUtil.getConn(), new Object[]{page.getPageAll(),(page.getPageCurr()-1)*page.getPageSize(),page.getPageSize()}, new CallBack() { |
| | | |
| | | @Override |
| | | public List getResults(ResultSet rs) { |
| | |
| | | Battalarm_data_historyImpl bimpl=new Battalarm_data_historyImpl(); |
| | | //List<Battalarm_data_history> list=bimpl.searchAll(); |
| | | Page p=new Page(); |
| | | p.setPageAll(1003); |
| | | p.setPageCurr(1); |
| | | p.setPageSize(6); |
| | | List<Battalarm_data_history> list=bimpl.serchByInfo(p); |