| | |
| | | import com.whyc.dto.InterfaceParam; |
| | | import com.whyc.dto.ReportBattDTO; |
| | | import com.whyc.dto.StandardFeatureCurve; |
| | | import com.whyc.dto.UpsAlarmDTO; |
| | | import com.whyc.dto.paramter.AlarmPar; |
| | | import com.whyc.dto.paramter.DevAlarmPar; |
| | | import com.whyc.dto.result.AlarmRes; |
| | |
| | | private MybatisSqlExecuteService sqlExecuteService; |
| | | //2,7,33,55,72,78,109-SubTablePageInfoUtils.java;201行,435行 |
| | | public List<PwrdevAlarmHistory> getList2(PwrdevAlarmHistory data){ |
| | | String sql="select alarm.*,inf.StationName,inf.StationName1,inf.StationName2,inf.StationName3,inf.StationName5 " + |
| | | String sql="select alarm.*,inf.StationName,inf.StationName1,inf.StationName2,inf.StationName3,inf.StationName5,inf.PowerDeviceName " + |
| | | " from db_pwrdev_alarm."+data.getRecordYear()+" alarm,db_pwrdev_inf.tb_pwrdev_inf inf " + |
| | | " where alarm.PowerDeviceId = inf.PowerDeviceId "; |
| | | if(data.getStationName1()!=null){ |
| | |
| | | ph.setNum(rs.getLong("num")); |
| | | ph.setRecordId(rs.getLong("record_id")); |
| | | ph.setPowerDeviceId(rs.getLong("PowerDeviceId")); |
| | | ph.setPowerDeviceName(rs.getString("PowerDeviceName")); |
| | | ph.setAlmType(rs.getInt("alm_type")); |
| | | ph.setAlmLevel(rs.getInt("alm_level")); |
| | | ph.setAlmSource(rs.getInt("alm_source")); |
| | |
| | | |
| | | //3,53,54,77,102,127,136-SubTablePageInfoUtils.java;72行 211行,445行 |
| | | public List<PwrdevAlarmHistory> getListForTX(PwrdevAlarmHistory data){ |
| | | String sql="select alarm.*,inf.StationName,inf.StationName1,inf.StationName2,inf.StationName3,inf.StationName5 " + |
| | | String sql="select alarm.*,inf.StationName,inf.StationName1,inf.StationName2,inf.StationName3,inf.StationName5,inf.PowerDeviceName " + |
| | | " from db_pwrdev_alarm."+data.getRecordYear()+" alarm,db_pwrdev_inf.tb_pwrdev_inf inf " + |
| | | " where alarm.PowerDeviceId = inf.PowerDeviceId "; |
| | | if(data.getStationName1()!=null){ |
| | |
| | | ph.setNum(rs.getLong("num")); |
| | | ph.setRecordId(rs.getLong("record_id")); |
| | | ph.setPowerDeviceId(rs.getLong("PowerDeviceId")); |
| | | ph.setPowerDeviceName(rs.getString("PowerDeviceName")); |
| | | ph.setAlmType(rs.getInt("alm_type")); |
| | | ph.setAlmLevel(rs.getInt("alm_level")); |
| | | ph.setAlmSource(rs.getInt("alm_source")); |
| | |
| | | } |
| | | return num; |
| | | } |
| | | //13,14,17,36,94-SubTablePageInfoUtils.java;88行 |
| | | public int getCount_stationId(DevAlarmPar param){ |
| | | String sql="SELECT count(distinct history.num) as number FROM db_alarm."+param.getRecordYear()+" history,db_battinf.tb_battinf " + |
| | | " where history.dev_id=db_battinf.tb_battinf.FbsDeviceId "; |
| | | /*if(param.getStationName1()!=null){ |
| | | if(param.getStationName1().equals("")){ |
| | | sql+=" and stationName1!='"+param.getStationName1()+"' "; |
| | | }else{ |
| | | sql+=" and stationName1='"+param.getStationName1()+"' "; |
| | | } |
| | | } |
| | | if(param.getStationName()!=null){ |
| | | if(param.getStationName().equals("")){ |
| | | sql+=" and stationName!='"+param.getStationName()+"' "; |
| | | }else{ |
| | | sql+=" and stationName='"+param.getStationName()+"' "; |
| | | } |
| | | }*/ |
| | | if(param.getStationId()!=null){ |
| | | if(param.getStationId().equals("")){ |
| | | sql+=" and stationId!='"+param.getStationId()+"' "; |
| | | }else{ |
| | | sql+=" and stationId='"+param.getStationId()+"' "; |
| | | } |
| | | } |
| | | sql+=" and alm_start_time >='"+ThreadLocalUtil.format(param.getAlmStartTime(),1)+"' and alm_start_time <='"+ThreadLocalUtil.format(param.getAlmStartTime1(),1)+"' "; |
| | | sql+=" and history.dev_id in(select distinct db_battinf.tb_battinf.FbsDeviceId " + |
| | | " 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="+param.getUId()+")"; |
| | | List list = sqlExecuteService.executeQuery_call(sql, new CallBack() { |
| | | @Override |
| | | public List getResults(ResultSet rs) throws SQLException { |
| | | LinkedList<Object> temp = new LinkedList<>(); |
| | | try { |
| | | while (rs.next()) |
| | | temp.add(rs.getInt("number")); |
| | | } catch (SQLException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return temp; |
| | | } |
| | | }); |
| | | int num =0; |
| | | if(list!=null){ |
| | | num= (int) list.get(0); |
| | | } |
| | | return num; |
| | | } |
| | | |
| | | //15,41-PwrdevTimeOutAlarmService.java;28行 47行 |
| | | public List getList(int uId,String alarmParamTableName){ |
| | |
| | | }); |
| | | return list; |
| | | } |
| | | |
| | | public List getList2_stationId(DevAlarmPar param){ |
| | | String sql=" SELECT history.num,dev_id,dev_ip,alm_type,alm_level,alm_start_time,alm_end_time,alm_is_confirmed,alm_confirmed_time,alm_cleared_type,alm_severity, " + |
| | | " db_battinf.tb_battinf.stationName,stationName1,stationName2,stationName3,stationName5,db_battinf.tb_battinf.stationName4 as dev_name " + |
| | | " FROM db_alarm."+param.getRecordYear()+" history,db_battinf.tb_battinf " + |
| | | " where history.dev_id=db_battinf.tb_battinf.FbsDeviceId "; |
| | | /*if(param.getStationName1()!=null){ |
| | | if(param.getStationName1().equals("")){ |
| | | sql+=" and stationName1!='"+param.getStationName1()+"' "; |
| | | }else{ |
| | | sql+=" and stationName1='"+param.getStationName1()+"' "; |
| | | } |
| | | } |
| | | if(param.getStationName()!=null){ |
| | | if(param.getStationName().equals("")){ |
| | | sql+=" and stationName!='"+param.getStationName()+"' "; |
| | | }else{ |
| | | sql+=" and stationName='"+param.getStationName()+"' "; |
| | | } |
| | | }*/ |
| | | if(param.getStationId()!=null){ |
| | | if(param.getStationId().equals("")){ |
| | | sql+=" and stationId!='"+param.getStationId()+"' "; |
| | | }else{ |
| | | sql+=" and stationId='"+param.getStationId()+"' "; |
| | | } |
| | | } |
| | | sql+=" and alm_start_time >='"+ThreadLocalUtil.format(param.getAlmStartTime(),1)+"' and alm_start_time <='"+ThreadLocalUtil.format(param.getAlmStartTime1(),1)+"' "; |
| | | sql+=" and history.dev_id in(select distinct db_battinf.tb_battinf.FbsDeviceId " + |
| | | " 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="+param.getUId()+") " + |
| | | " ORDER BY alm_start_time desc ,dev_name asc limit "+param.getLimitStart()+","+param.getLimitEnd()+" "; |
| | | List list = sqlExecuteService.executeQuery_call(sql, new CallBack() { |
| | | @Override |
| | | public List getResults(ResultSet rs) throws SQLException { |
| | | List<DevalarmDataHistory> list=new ArrayList<>(); |
| | | while (rs.next()){ |
| | | DevalarmDataHistory ph=new DevalarmDataHistory(); |
| | | ph.setNum(rs.getLong("num")); |
| | | ph.setDevId(rs.getInt("dev_id")); |
| | | ph.setDevIp(rs.getString("dev_ip")); |
| | | ph.setAlmType(rs.getInt("alm_type")); |
| | | ph.setAlmLevel(rs.getInt("alm_level")); |
| | | ph.setAlmStartTime(rs.getTimestamp("alm_start_time")); |
| | | ph.setAlmEndTime(rs.getTimestamp("alm_end_time")); |
| | | ph.setAlmIsConfirmed(rs.getInt("alm_is_confirmed")); |
| | | ph.setAlmConfirmedTime(rs.getTimestamp("alm_confirmed_time")); |
| | | ph.setAlmClearedType(rs.getInt("alm_cleared_type")); |
| | | ph.setDevName(rs.getString("dev_name")); |
| | | ph.setStationName(rs.getString("stationName")); |
| | | ph.setStationName1(rs.getString("stationName1")); |
| | | ph.setStationName2(rs.getString("stationName2")); |
| | | ph.setStationName3(rs.getString("stationName3")); |
| | | ph.setStationName5(rs.getString("stationName5")); |
| | | list.add(ph); |
| | | } |
| | | return list; |
| | | } |
| | | }); |
| | | return list; |
| | | } |
| | | //16,19,30,61,105,111,123-SubTablePageInfoUtils.java;188行 422行 |
| | | public List getList2(DevAlarmPar param){ |
| | | String sql=" SELECT history.num,dev_id,dev_ip,alm_type,alm_level,alm_start_time,alm_end_time,alm_is_confirmed,alm_confirmed_time,alm_cleared_type,alm_severity, " + |
| | | " db_battinf.tb_battinf.stationName,stationName1,stationName2,stationName3,stationName5,db_battinf.tb_battinf.FbsDeviceName as dev_name " + |
| | | " db_battinf.tb_battinf.stationName,stationName1,stationName2,stationName3,stationName5,db_battinf.tb_battinf.stationName4 as dev_name " + |
| | | " FROM db_alarm."+param.getRecordYear()+" history,db_battinf.tb_battinf " + |
| | | " where history.dev_id=db_battinf.tb_battinf.FbsDeviceId "; |
| | | if(param.getStationName1()!=null){ |
| | |
| | | } |
| | | sqlExecuteService.execute(sql); |
| | | } |
| | | // |
| | | //100-StandardFeatureCurveMapper.xml;12行 |
| | | public void createTable(String titleNameUnion){ |
| | | String sql="CREATE TABLE `web_site`.`tb_standard_feature_curve_"+titleNameUnion+"` ( " + |
| | | " `id` INT NOT NULL AUTO_INCREMENT, " + |
| | |
| | | return list; |
| | | } |
| | | |
| | | // |
| | | //97-Ld9testdatastopMapper.xml;11行 |
| | | public List<Ld9testdatastop> serchByCondition(int testRecordCount, int battGroupId){ |
| | | String sql=" select num,BattGroupId,test_record_count,test_type,test_starttime,record_time,test_timelong,group_vol,test_curr,test_cap,mon_cap,mon_rest_cap,mon_num,mon_vol,test_monnum,max_monvol,min_monvol,test_stopreason " + |
| | | " from db_ld9_testdata.tb_ld9testdatastop_"+battGroupId+" " + |
| | |
| | | } |
| | | return maxNum; |
| | | } |
| | | // |
| | | //105-BattRealdataMapper.xml;36行 |
| | | public int searchMinNum(BattRealdata realdata){ |
| | | String sql="select min(num) as minNum " + |
| | | " from db_batt_history.tb_batt_realdata_"+realdata.getTableName()+" " + |
| | |
| | | }); |
| | | return list; |
| | | } |
| | | // |
| | | //96-BattResDataMapper.xml;18行 |
| | | public List<BattResData> getResInfoByBattGroupId( int battGroupId){ |
| | | String sql="select * from db_batt_testdata.tb_battresdata_"+battGroupId+" order by test_starttime desc"; |
| | | List<BattResData> list = sqlExecuteService.executeQuery_call(sql, new CallBack() { |
| | |
| | | return list; |
| | | } |
| | | |
| | | // |
| | | //108-BattResDataMapper.xml;4行 |
| | | public void deleteByTestRecordCount(Integer battGroupId, Integer testRecordCount){ |
| | | String sql="delete from db_batt_testdata.tb_battresdata_"+battGroupId+" where test_record_count = "+testRecordCount+""; |
| | | sqlExecuteService.execute(sql); |
| | |
| | | sqlExecuteService.execute(sql); |
| | | } |
| | | |
| | | //107-PwrdevHistorydataGwMapper.xml;5行 |
| | | public int judgeTable_pwr(String table){ |
| | | String sql=" select count(*) as tableNum " + |
| | | " from INFORMATION_SCHEMA.TABLES " + |
| | | " where TABLE_SCHEMA = 'db_pwrdev_data_history_gw' " + |
| | | " and TABLE_NAME = 'tb_pwrdev_historydata_gw_"+table+"';"; |
| | | List list = sqlExecuteService.executeQuery_call(sql, new CallBack() { |
| | | @Override |
| | | public List getResults(ResultSet rs) throws SQLException { |
| | | LinkedList<Object> temp = new LinkedList<>(); |
| | | try { |
| | | while (rs.next()) |
| | | temp.add(rs.getInt("tableNum")); |
| | | } catch (SQLException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return temp; |
| | | } |
| | | }); |
| | | int tableNum =0; |
| | | if(list!=null){ |
| | | tableNum= (int) list.get(0); |
| | | } |
| | | return tableNum; |
| | | } |
| | | //查询ups历史告警数量 |
| | | public int getCountForUps(UpsAlarmDTO param) { |
| | | String sql="select count(distinct alarm.num) as number from db_upspwrdev_alarm."+param.getRecordYear()+" alarm,db_pwrdev_inf.tb_pwrdev_inf inf " + |
| | | " where alarm.power_device_id = inf.PowerDeviceId "; |
| | | if(param.getStationName1()!=null){ |
| | | sql+=" and stationName1 like '%"+param.getStationName1()+"%'"; |
| | | } |
| | | if(param.getStationName2()!=null){ |
| | | sql+=" and stationName2 like '%"+param.getStationName2()+"%'"; |
| | | } |
| | | if(param.getStationName5()!=null){ |
| | | sql+=" and stationName5 like '%"+param.getStationName5()+"%'"; |
| | | } |
| | | if(param.getStationName3()!=null){ |
| | | sql+=" and stationName3 like '%"+param.getStationName3()+"%'"; |
| | | } |
| | | /*if(param.getPwrdevId()!=0){ |
| | | sql+=" and alarm.power_device_id="+param.getPwrdevId(); |
| | | }*/ |
| | | if(param.getAlmStartTime()!=null){ |
| | | sql+=" and alarm.alm_start_time >='"+ThreadLocalUtil.format(param.getAlmStartTime(),1)+"' "; |
| | | } |
| | | if(param.getAlmEndTime()!=null){ |
| | | sql+=" and alarm.alm_start_time <='"+ThreadLocalUtil.format(param.getAlmEndTime(),1)+"' "; |
| | | } |
| | | if(param.getAlmTypes()!=null&¶m.getAlmTypes().size()>0){ |
| | | sql+=" and alm_type in ( "; |
| | | for (int i=0;i<param.getAlmTypes().size();i++) { |
| | | sql+=param.getAlmTypes().get(i); |
| | | if(i!=(param.getAlmTypes().size()-1)){ |
| | | sql+=","; |
| | | } |
| | | } |
| | | sql+=")"; |
| | | } |
| | | sql+=" and alarm.power_device_id in ( select distinct inf.PowerDeviceId from" + |
| | | " (select PowerDeviceId,StationId from db_pwrdev_inf.tb_pwrdev_inf ) inf," + |
| | | " 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.StationId=inf.StationId" + |
| | | " 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="+param.getUsrId()+" )"; |
| | | List list = sqlExecuteService.executeQuery_call(sql, new CallBack() { |
| | | @Override |
| | | public List getResults(ResultSet rs) throws SQLException { |
| | | LinkedList<Object> temp = new LinkedList<>(); |
| | | try { |
| | | while (rs.next()) |
| | | temp.add(rs.getInt("number")); |
| | | } catch (SQLException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return temp; |
| | | } |
| | | }); |
| | | int num =0; |
| | | if(list!=null){ |
| | | num= (int) list.get(0); |
| | | } |
| | | return num; |
| | | } |
| | | //查询ups历史告警 |
| | | public List getList2(UpsAlarmDTO param){ |
| | | String sql=" SELECT history.num,record_id,power_device_id,alm_type,alm_level,alm_start_time,alm_end_time,alm_value,alm_is_confirmed,alm_confirmed_time,alm_cleared_type, " + |
| | | " inf.stationName,stationName1,stationName2,stationName3,stationName5,inf.PowerDeviceName as dev_name " + |
| | | " FROM db_upspwrdev_alarm."+param.getRecordYear()+" history,db_pwrdev_inf.tb_pwrdev_inf inf " + |
| | | " where history.power_device_id = inf.PowerDeviceId "; |
| | | if(param.getStationName1()!=null){ |
| | | sql+=" and stationName1 like '%"+param.getStationName1()+"%'"; |
| | | } |
| | | if(param.getStationName2()!=null){ |
| | | sql+=" and stationName2 like '%"+param.getStationName2()+"%'"; |
| | | } |
| | | if(param.getStationName5()!=null){ |
| | | sql+=" and stationName5 like '%"+param.getStationName5()+"%'"; |
| | | } |
| | | if(param.getStationName3()!=null){ |
| | | sql+=" and stationName3 like '%"+param.getStationName3()+"%'"; |
| | | } |
| | | if(param.getAlmTypes()!=null&¶m.getAlmTypes().size()>0){ |
| | | sql+=" and alm_type in ( "; |
| | | for (int i=0;i<param.getAlmTypes().size();i++) { |
| | | sql+=param.getAlmTypes().get(i); |
| | | if(i!=(param.getAlmTypes().size()-1)){ |
| | | sql+=","; |
| | | } |
| | | } |
| | | sql+=")"; |
| | | } |
| | | sql+=" and alm_start_time >='"+ThreadLocalUtil.format(param.getAlmStartTime(),1)+"' and alm_start_time <='"+ThreadLocalUtil.format(param.getAlmEndTime(),1)+"' "; |
| | | sql+=" and history.power_device_id in ( select distinct inf.PowerDeviceId from" + |
| | | " (select PowerDeviceId,StationId from db_pwrdev_inf.tb_pwrdev_inf ) inf," + |
| | | " 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.StationId=inf.StationId" + |
| | | " 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="+param.getUsrId()+" ) " + |
| | | " ORDER BY alm_start_time desc ,dev_name asc limit "+param.getLimitStart()+","+param.getLimitEnd()+" "; |
| | | List list = sqlExecuteService.executeQuery_call(sql, new CallBack() { |
| | | @Override |
| | | public List getResults(ResultSet rs) throws SQLException { |
| | | List<UpspwrdevAlarmHistory> list=new ArrayList<>(); |
| | | while (rs.next()){ |
| | | UpspwrdevAlarmHistory ph=new UpspwrdevAlarmHistory(); |
| | | ph.setNum(rs.getLong("num")); |
| | | ph.setRecordId(rs.getLong("record_id")); |
| | | ph.setPowerDeviceId(rs.getLong("power_device_id")); |
| | | ph.setAlmType(rs.getInt("alm_type")); |
| | | ph.setAlmLevel(rs.getInt("alm_level")); |
| | | ph.setAlmStartTime(rs.getTimestamp("alm_start_time")); |
| | | ph.setAlmEndTime(rs.getTimestamp("alm_end_time")); |
| | | ph.setAlmValue(rs.getFloat("alm_value")); |
| | | ph.setAlmIsConfirmed(rs.getInt("alm_is_confirmed")); |
| | | ph.setAlmConfirmedTime(rs.getTimestamp("alm_confirmed_time")); |
| | | ph.setAlmClearedType(rs.getInt("alm_cleared_type")); |
| | | ph.setDevName(rs.getString("dev_name")); |
| | | ph.setStationName(rs.getString("stationName")); |
| | | ph.setStationName1(rs.getString("stationName1")); |
| | | ph.setStationName2(rs.getString("stationName2")); |
| | | ph.setStationName3(rs.getString("stationName3")); |
| | | ph.setStationName5(rs.getString("stationName5")); |
| | | list.add(ph); |
| | | } |
| | | return list; |
| | | } |
| | | }); |
| | | return list; |
| | | } |
| | | //ups历史告警确认 |
| | | public int setHisAlmIsConfirmed(int num, String year) { |
| | | String sql=" update db_upspwrdev_alarm.tb_upspwrdev_alarm_history_"+year+" set alm_is_confirmed =1," + |
| | | " where num = "+num+" "; |
| | | int flag=sqlExecuteService.executeUpdate(sql,null); |
| | | return flag; |
| | | } |
| | | //ups历史告警取消 |
| | | public int cancleHisAlmIsConfirmed(int num, String year) { |
| | | String sql=" update db_upspwrdev_alarm.tb_upspwrdev_alarm_history_"+year+" set alm_is_confirmed =0," + |
| | | " where num = "+num+" "; |
| | | int flag=sqlExecuteService.executeUpdate(sql,null); |
| | | return flag; |
| | | } |
| | | //ups历史告警删除 |
| | | public void delHisAlm(int num, String year) { |
| | | String sql="delete from db_upspwrdev_alarm.tb_upspwrdev_alarm_history_"+year+" where num = "+num+""; |
| | | sqlExecuteService.execute(sql); |
| | | } |
| | | } |