| | |
| | | package com.whyc.service; |
| | | |
| | | 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; |
| | | import com.whyc.dto.result.RealDateDTO; |
| | | import com.whyc.dto.result.ReportBattResultDTO; |
| | | import com.whyc.mapper.CallBack; |
| | | import com.whyc.pojo.*; |
| | | import com.whyc.util.ActionUtil; |
| | |
| | | import javax.swing.*; |
| | | import java.sql.ResultSet; |
| | | import java.sql.SQLException; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.LinkedList; |
| | | import java.util.List; |
| | | import java.util.*; |
| | | |
| | | @Service |
| | | public class SubTablePageInfoService { |
| | |
| | | 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 monVol; |
| | | } |
| | | |
| | | //23-ElePriceMapper.xml;8行 |
| | | //64-ElePriceMapper.xml;18行 |
| | | public void deleteEleprice(String tableName){ |
| | | String sql=" delete from web_site."+tableName+" "; |
| | | sqlExecuteService.execute(sql); |
| | | } |
| | | // |
| | | //23-ElePriceMapper.xml;8行 |
| | | public void createEleprice(String tableName){ |
| | | String sql="CREATE TABLE IF NOT EXISTS web_site."+tableName+" ( " + |
| | | " `num` int(11) NOT NULL AUTO_INCREMENT, " + |
| | |
| | | " )"; |
| | | sqlExecuteService.execute(sql); |
| | | } |
| | | // |
| | | //75-ElePriceMapper.xml;25行 |
| | | public List<ElePrice> getList(String tableName){ |
| | | String sql="select * from web_site."+tableName+" order by tmp_starttime asc"; |
| | | List<ElePrice> list = sqlExecuteService.executeQuery_call(sql, new CallBack() { |
| | |
| | | return tableNum; |
| | | } |
| | | |
| | | //29-BattRealdataMapper.xml;42行 |
| | | public List<Integer> searchMaxNum2(BattRealdata realdata){ |
| | | String sql="(SELECT " + |
| | | " num " + |
| | | " FROM " + |
| | | " db_batt_history.`tb_batt_realdata_"+realdata.getTableName()+"` " + |
| | | " WHERE " + |
| | | " recrod_time BETWEEN '"+ThreadLocalUtil.format(realdata.getRecrodTime(),1)+"' " + |
| | | " AND '"+ThreadLocalUtil.format(realdata.getRecrodTime1(),1)+"' " + |
| | | " ORDER BY " + |
| | | " recrod_time asc limit 1) " + |
| | | " union all " + |
| | | " (SELECT " + |
| | | " num " + |
| | | " FROM " + |
| | | " db_batt_history.`tb_batt_realdata_"+realdata.getTableName()+"` " + |
| | | " WHERE " + |
| | | " recrod_time BETWEEN '"+ThreadLocalUtil.format(realdata.getRecrodTime(),1)+"' " + |
| | | " AND '"+ThreadLocalUtil.format(realdata.getRecrodTime1(),1)+"' " + |
| | | " ORDER BY " + |
| | | " recrod_time desc limit 1)"; |
| | | 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("num")); |
| | | } catch (SQLException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return temp; |
| | | } |
| | | }); |
| | | return list; |
| | | } |
| | | |
| | | //92-BattRealdataMapper.xml;29行 |
| | | public int searchMaxNum(BattRealdata realdata){ |
| | | String sql="select count(*) as maxNum " + |
| | | " from db_batt_history.tb_batt_realdata_"+realdata.getTableName()+" " + |
| | | " where recrod_time >= '"+ThreadLocalUtil.format(realdata.getRecrodTime(),1)+"' " + |
| | | " and recrod_time <= '"+ThreadLocalUtil.format(realdata.getRecrodTime1(),1)+"' " + |
| | | " and mon_num = "+realdata.getMonNum()+" "; |
| | | 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("maxNum")); |
| | | } catch (SQLException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return temp; |
| | | } |
| | | }); |
| | | int maxNum =0; |
| | | if(list!=null){ |
| | | maxNum= (int) list.get(0); |
| | | } |
| | | 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()+" " + |
| | | " where mon_num = "+realdata.getMonNum()+" "; |
| | | 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("minNum")); |
| | | } catch (SQLException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return temp; |
| | | } |
| | | }); |
| | | int minNum =0; |
| | | if(list!=null){ |
| | | minNum= (int) list.get(0); |
| | | } |
| | | return minNum; |
| | | } |
| | | |
| | | //BattRealdataMapper.xml;63行 |
| | | public List<RealDateDTO> serchByCondition2(BattRealdata realdata){ |
| | | String sql=" select recrod_time, " + |
| | | " group_vol, " + |
| | | " online_vol, " + |
| | | " group_curr, " + |
| | | " mon_vol, " + |
| | | " mon_tmp, " + |
| | | " mon_res, " + |
| | | " mon_num " + |
| | | " from (select a.*, (@i:= @i+1) as number " + |
| | | " from (select * " + |
| | | " from db_batt_history.tb_batt_realdata_"+realdata.getTableName()+" " + |
| | | " where recrod_time >= '"+ThreadLocalUtil.format(realdata.getRecrodTime(),1)+"' " + |
| | | " and recrod_time <= '"+ThreadLocalUtil.format(realdata.getRecrodTime1(),1)+"' " + |
| | | " and mon_num = "+realdata.getMonNum()+") a, " + |
| | | " (select @i:=0) b) c " + |
| | | " where c.number%"+realdata.getRoteN()+"=0"; |
| | | List<RealDateDTO> list = sqlExecuteService.executeQuery_call(sql, new CallBack() { |
| | | @Override |
| | | public List getResults(ResultSet rs) throws SQLException { |
| | | List<RealDateDTO> list=new ArrayList<>(); |
| | | while (rs.next()){ |
| | | RealDateDTO ph=new RealDateDTO(); |
| | | ph.setRecrodTime(rs.getTimestamp("recrod_time")); |
| | | ph.setGroupVol(rs.getFloat("group_vol")); |
| | | ph.setOnlineVol(rs.getFloat("online_vol")); |
| | | ph.setGroupCurr(rs.getFloat("group_curr")); |
| | | ph.setMonVol(rs.getFloat("mon_vol")); |
| | | ph.setMonTmp(rs.getFloat("mon_tmp")); |
| | | ph.setMonRes(rs.getFloat("mon_res")); |
| | | ph.setMonNum(rs.getInt("mon_num")); |
| | | list.add(ph); |
| | | } |
| | | return list; |
| | | } |
| | | }); |
| | | return list; |
| | | } |
| | | |
| | | //32-BattTestDataStopMapper.xml;26行 |
| | | public List<BattTestDataStop> getList(int battGroupId,int testRecordCount){ |
| | | String sql="SELECT DISTINCT battGroupId, test_curr, test_cap, mon_num, mon_vol " + |
| | | " FROM " + |
| | | " db_batt_testdata.tb_batttestdatastop_"+battGroupId+" " + |
| | | " WHERE " + |
| | | " test_record_count = "+testRecordCount+" " + |
| | | " AND data_available = 1"; |
| | | List<BattTestDataStop> list = sqlExecuteService.executeQuery_call(sql, new CallBack() { |
| | | @Override |
| | | public List getResults(ResultSet rs) throws SQLException { |
| | | List<BattTestDataStop> list=new ArrayList<>(); |
| | | while (rs.next()){ |
| | | BattTestDataStop ph=new BattTestDataStop(); |
| | | ph.setBattGroupId(rs.getInt("battGroupId")); |
| | | ph.setTestCurr(rs.getFloat("test_curr")); |
| | | ph.setTestCap(rs.getFloat("test_cap")); |
| | | ph.setMonVol(rs.getFloat("mon_vol")); |
| | | ph.setMonNum(rs.getInt("mon_num")); |
| | | list.add(ph); |
| | | } |
| | | return list; |
| | | } |
| | | }); |
| | | return list; |
| | | } |
| | | |
| | | //33-PwrdevAlarmHistoryMapper.xml;362行 |
| | | public List<PwrdevAlarmHistory> getListByStationId_pwr(Date startTime, Date endTime, String stationId,String tableName){ |
| | | String sql=" select h.*,b.StationName1,b.StationName2,b.StationName3,b.StationName5 from db_pwrdev_alarm."+tableName+" h,db_pwrdev_inf.tb_pwrdev_inf b " + |
| | | " where h.PowerDeviceId = b.PowerDeviceId " ; |
| | | if(stationId !=null&&!stationId.isEmpty()){ |
| | | sql+=" and b.stationId = '"+stationId+"' "; |
| | | } |
| | | sql+=" and h.alm_start_time >= '"+ThreadLocalUtil.format(startTime,1)+"' and h.alm_start_time <='"+ThreadLocalUtil.format(endTime,1)+"' "; |
| | | List<PwrdevAlarmHistory> list = sqlExecuteService.executeQuery_call(sql, new CallBack() { |
| | | @Override |
| | | public List getResults(ResultSet rs) throws SQLException { |
| | | List<PwrdevAlarmHistory> list=new ArrayList<>(); |
| | | while (rs.next()){ |
| | | PwrdevAlarmHistory ph=new PwrdevAlarmHistory(); |
| | | ph.setNum(rs.getLong("num")); |
| | | ph.setRecordId(rs.getLong("record_id")); |
| | | ph.setPowerDeviceId(rs.getLong("PowerDeviceId")); |
| | | ph.setAlmType(rs.getInt("alm_type")); |
| | | ph.setAlmLevel(rs.getInt("alm_level")); |
| | | ph.setAlmSource(rs.getInt("alm_source")); |
| | | ph.setAlmIndex(rs.getInt("alm_index")); |
| | | 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.setUsrId(rs.getInt("usr_Id")); |
| | | ph.setAlmTrigger(rs.getInt("alm_trigger")); |
| | | ph.setAlmSeverity(rs.getInt("alm_severity")); |
| | | 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; |
| | | } |
| | | |
| | | //35-Ld9testdataMapper.xml;12行 |
| | | public List<Ld9testdata> serchByCondition(int roteN, int testRecordCount, int battGroupId, int testMonNum){ |
| | | String sql="select num,BattGroupId,test_record_count,test_type,record_num,test_starttime,record_time,test_timelong,online_vol,group_vol" + |
| | | ",test_curr,test_cap,mon_cap,mon_rest_cap,mon_num,mon_vol,mon_tmp,test_monnum " + |
| | | " from db_ld9_testdata.tb_ld9testdata_"+battGroupId+" " + |
| | | " where test_record_count="+testRecordCount+" and (record_num%"+roteN+"=0 ) and test_monnum="+testMonNum+" "; |
| | | List<Ld9testdata> list = sqlExecuteService.executeQuery_call(sql, new CallBack() { |
| | | @Override |
| | | public List getResults(ResultSet rs) throws SQLException { |
| | | List<Ld9testdata> list=new ArrayList<>(); |
| | | while (rs.next()){ |
| | | Ld9testdata ph=new Ld9testdata(); |
| | | ph.setNum(rs.getLong("num")); |
| | | ph.setBattGroupId(rs.getInt("BattGroupId")); |
| | | ph.setTestRecordCount(rs.getInt("test_record_count")); |
| | | ph.setTestType(rs.getInt("test_type")); |
| | | ph.setRecordNum(rs.getInt("record_num")); |
| | | ph.setTestStarttime(rs.getTimestamp("test_starttime")); |
| | | ph.setRecordTime(rs.getTimestamp("record_time")); |
| | | ph.setTestTimelong(rs.getInt("test_timelong")); |
| | | ph.setOnlineVol(rs.getFloat("online_vol")); |
| | | ph.setGroupVol(rs.getFloat("group_vol")); |
| | | ph.setTestCurr(rs.getFloat("test_curr")); |
| | | ph.setTestCap(rs.getFloat("test_cap")); |
| | | ph.setMonNum(rs.getInt("mon_num")); |
| | | ph.setMonVol(rs.getFloat("mon_vol")); |
| | | ph.setTestMonnum(rs.getInt("test_monnum")); |
| | | ph.setMonCap(rs.getFloat("mon_cap")); |
| | | ph.setMonRestCap(rs.getFloat("mon_rest_cap")); |
| | | list.add(ph); |
| | | } |
| | | return list; |
| | | } |
| | | }); |
| | | return list; |
| | | } |
| | | |
| | | //59-Ld9testdataMapper.xml;6行 |
| | | public List<Ld9testdata> serchByInfo(Ld9testdata ld9testdata){ |
| | | String sql=" select test_monnum,max(record_num) as record_nums,BattGroupId,test_record_count " + |
| | | " from db_ld9_testdata.tb_ld9testdata_"+ld9testdata.getBattGroupId()+" " + |
| | | " where test_record_count="+ld9testdata.getTestRecordCount()+" " + |
| | | " GROUP BY test_monnum order by test_monnum asc"; |
| | | List<Ld9testdata> list = sqlExecuteService.executeQuery_call(sql, new CallBack() { |
| | | @Override |
| | | public List getResults(ResultSet rs) throws SQLException { |
| | | List<Ld9testdata> list=new ArrayList<>(); |
| | | while (rs.next()){ |
| | | Ld9testdata ph=new Ld9testdata(); |
| | | ph.setTestMonnum(rs.getInt("test_monnum")); |
| | | ph.setRecordNums(rs.getInt("record_nums")); |
| | | ph.setBattGroupId(rs.getInt("BattGroupId")); |
| | | ph.setTestRecordCount(rs.getInt("test_record_count")); |
| | | list.add(ph); |
| | | } |
| | | return list; |
| | | } |
| | | }); |
| | | return list; |
| | | } |
| | | //73-Ld9testdataMapper.xml;17行 |
| | | public List<Ld9testdata> getLD9AllGroupByTestRecordCount(Ld9testdataInf ld9inf){ |
| | | String sql="select * from db_ld9_testdata.tb_ld9testdata_"+ld9inf.getBattGroupId()+" " + |
| | | " where test_record_count="+ld9inf.getTestRecordCount()+" order by mon_num asc"; |
| | | List<Ld9testdata> list = sqlExecuteService.executeQuery_call(sql, new CallBack() { |
| | | @Override |
| | | public List getResults(ResultSet rs) throws SQLException { |
| | | List<Ld9testdata> list=new ArrayList<>(); |
| | | while (rs.next()){ |
| | | Ld9testdata ph=new Ld9testdata(); |
| | | ph.setNum(rs.getLong("num")); |
| | | ph.setBattGroupId(rs.getInt("BattGroupId")); |
| | | ph.setTestRecordCount(rs.getInt("test_record_count")); |
| | | ph.setTestType(rs.getInt("test_type")); |
| | | ph.setRecordNum(rs.getInt("record_num")); |
| | | ph.setTestStarttime(rs.getTimestamp("test_starttime")); |
| | | ph.setRecordTime(rs.getTimestamp("record_time")); |
| | | ph.setTestTimelong(rs.getInt("test_timelong")); |
| | | ph.setOnlineVol(rs.getFloat("online_vol")); |
| | | ph.setGroupVol(rs.getFloat("group_vol")); |
| | | ph.setTestCurr(rs.getFloat("test_curr")); |
| | | ph.setTestCap(rs.getFloat("test_cap")); |
| | | ph.setMonNum(rs.getInt("mon_num")); |
| | | ph.setMonVol(rs.getFloat("mon_vol")); |
| | | ph.setTestMonnum(rs.getInt("test_monnum")); |
| | | ph.setMonCap(rs.getFloat("mon_cap")); |
| | | ph.setMonRestCap(rs.getFloat("mon_rest_cap")); |
| | | list.add(ph); |
| | | } |
| | | return list; |
| | | } |
| | | }); |
| | | return list; |
| | | } |
| | | |
| | | //62-Ld9testdataMapper.xml;22行 |
| | | public Map getLD9AllGroupTimeLong(Ld9testdataInf ld9inf){ |
| | | String sql="select mon_num,max(test_timelong) as max_testTimelong " + |
| | | " from db_ld9_testdata.tb_ld9testdata_"+ld9inf.getBattGroupId()+" " + |
| | | " where test_record_count="+ld9inf.getTestRecordCount()+" group by mon_num"; |
| | | List<Ld9testdata> list = sqlExecuteService.executeQuery_call(sql, new CallBack() { |
| | | @Override |
| | | public List getResults(ResultSet rs) throws SQLException { |
| | | List<Ld9testdata> list=new ArrayList<>(); |
| | | while (rs.next()){ |
| | | Ld9testdata ph=new Ld9testdata(); |
| | | ph.setMonNum(rs.getInt("mon_num")); |
| | | ph.setTestTimelong(rs.getInt("max_testTimelong")); |
| | | list.add(ph); |
| | | } |
| | | return list; |
| | | } |
| | | }); |
| | | Map map=new HashMap(); |
| | | if(list!=null&&list.size()>0){ |
| | | for (Ld9testdata ld9:list) { |
| | | map.put(ld9.getMonNum(),ld9.getTestTimelong()); |
| | | } |
| | | } |
| | | return map; |
| | | } |
| | | |
| | | //37-BattTestDataStopMapper.xml;35行 |
| | | public Float calcAvgVol_stop(Integer battGroupId, Integer testRecordCount){ |
| | | String sql=" SELECT " + |
| | | " AVG(BINARY mon_vol) AS mon_avg " + |
| | | " FROM " + |
| | | " db_batt_testdata.tb_batttestdatastop_"+battGroupId+" " + |
| | | " WHERE " + |
| | | " test_record_count = "+testRecordCount+" " + |
| | | " AND data_available = 1 " + |
| | | " ORDER BY BattgroupId"; |
| | | 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.getFloat("mon_avg")); |
| | | } catch (SQLException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return temp; |
| | | } |
| | | }); |
| | | Float mon_avg =0f; |
| | | if(list!=null){ |
| | | mon_avg= (Float) list.get(0); |
| | | } |
| | | return mon_avg; |
| | | |
| | | } |
| | | |
| | | //65-BattTestDataStopMapper.xml;6行 |
| | | public BattTestDataStop findByMonNum(Integer battGroupId,Integer monNum){ |
| | | String sql="select stop.battgroupid,stop.test_curr,stop.test_cap,stop.mon_vol,stop.test_record_count,stop.mon_num,stop.group_vol,inf.max_monvol " + |
| | | " from db_batt_testdata.tb_batttestdatastop_"+battGroupId+" stop,db_batt_testdata.tb_batttestdata_inf inf " + |
| | | " where stop.battGroupId = inf.battGroupId and stop.test_starttime = inf.test_starttime and stop.mon_num ="+monNum+" " + |
| | | " and stop.data_available=1 and inf.test_type=3 " + |
| | | " order by stop.test_starttime desc limit 1"; |
| | | List<BattTestDataStop> list = sqlExecuteService.executeQuery_call(sql, new CallBack() { |
| | | @Override |
| | | public List getResults(ResultSet rs) throws SQLException { |
| | | List<BattTestDataStop> list=new ArrayList<>(); |
| | | while (rs.next()){ |
| | | BattTestDataStop ph=new BattTestDataStop(); |
| | | ph.setBattGroupId(rs.getInt("battGroupId")); |
| | | ph.setTestCurr(rs.getFloat("test_curr")); |
| | | ph.setTestCap(rs.getFloat("test_cap")); |
| | | ph.setMonVol(rs.getFloat("mon_vol")); |
| | | ph.setTestRecordCount(rs.getInt("test_record_count")); |
| | | ph.setMonNum(rs.getInt("mon_num")); |
| | | ph.setGroupVol(rs.getFloat("group_vol")); |
| | | ph.setMaxMonVol(rs.getFloat("max_monvol")); |
| | | list.add(ph); |
| | | } |
| | | return list; |
| | | } |
| | | }); |
| | | BattTestDataStop btsp=null; |
| | | if(list!=null&&list.size()>0){ |
| | | btsp=list.get(0); |
| | | } |
| | | return btsp; |
| | | } |
| | | |
| | | //77-BattTestDataStopMapper.xml;13行 |
| | | public Float getRealCap(BattTestDataStop stop){ |
| | | String sql=" select test_cap from db_batt_testdata.tb_batttestdata_"+stop.getBattGroupId()+" " + |
| | | " where test_record_count="+stop.getTestRecordCount()+" and mon_vol>"+stop.getMonVol()+" and mon_num="+stop.getMonNum()+" and data_available=1 " + |
| | | " order by record_time desc limit 1"; |
| | | List list = sqlExecuteService.executeQuery_call(sql, new CallBack() { |
| | | @Override |
| | | public List getResults(ResultSet rs) throws SQLException { |
| | | List list=new ArrayList<>(); |
| | | while (rs.next()){ |
| | | list.add(rs.getFloat("test_cap")); |
| | | } |
| | | return list; |
| | | } |
| | | }); |
| | | float test_cap=0f; |
| | | if(list!=null&&list.size()>0){ |
| | | test_cap= (float) list.get(0); |
| | | } |
| | | return test_cap; |
| | | } |
| | | |
| | | //89-BattTestDataStopMapper.xml;20行 |
| | | public List<BattTestDataStop> getTestDataStop(Integer battGroupId, Date testStarttime){ |
| | | String sql=" select num,BattGroupId,test_record_count,test_type,data_new,data_available,record_num,test_starttime,record_time,test_timelong,online_vol" + |
| | | ",group_vol,test_curr,test_cap,mon_num,mon_vol,mon_tmp " + |
| | | " from db_batt_testdata.tb_batttestdatastop_"+battGroupId+" " + |
| | | " where test_starttime='"+ThreadLocalUtil.format(testStarttime,1)+"' " + |
| | | " and data_available=1"; |
| | | List<BattTestDataStop> list = sqlExecuteService.executeQuery_call(sql, new CallBack() { |
| | | @Override |
| | | public List getResults(ResultSet rs) throws SQLException { |
| | | List<BattTestDataStop> list=new ArrayList<>(); |
| | | while (rs.next()){ |
| | | BattTestDataStop ph=new BattTestDataStop(); |
| | | ph.setBattGroupId(rs.getInt("battGroupId")); |
| | | ph.setTestRecordCount(rs.getInt("test_record_count")); |
| | | ph.setTestType(rs.getInt("test_type")); |
| | | ph.setDataNew(rs.getInt("data_new")); |
| | | ph.setDataAvailable(rs.getInt("data_available")); |
| | | ph.setRecordNum(rs.getInt("record_num")); |
| | | ph.setTestStarttime(rs.getTimestamp("test_starttime")); |
| | | ph.setRecordTime(rs.getTimestamp("record_time")); |
| | | ph.setTestTimelong(rs.getInt("test_timelong")); |
| | | ph.setOnlineVol(rs.getFloat("online_vol")); |
| | | ph.setGroupVol(rs.getFloat("group_vol")); |
| | | ph.setTestCurr(rs.getFloat("test_curr")); |
| | | ph.setTestCap(rs.getFloat("test_cap")); |
| | | ph.setMonNum(rs.getInt("mon_num")); |
| | | ph.setMonVol(rs.getFloat("mon_vol")); |
| | | ph.setMonTmp(rs.getFloat("mon_tmp")); |
| | | list.add(ph); |
| | | } |
| | | return list; |
| | | } |
| | | }); |
| | | return list; |
| | | } |
| | | |
| | | //38,67--BattMaintDealarmMapper.xml;226行 210 |
| | | public List<ReportBattResultDTO> searchByBattGroupId5(ReportBattDTO dto){ |
| | | String sql=" select distinct(db_battinf.tb_battinf.BattgroupId),moncount,moncapstd,monvolstd,monresstd,monserstd,FloatVolLevel,OfflineVolLevel " + |
| | | " ,db_batt_testdata.tb_battresdata_inf.battgroupid,db_batt_testdata.tb_battresdata_inf.test_record_count " + |
| | | " ,db_batt_testdata.tb_battresdata_"+dto.getBattGroupId()+".group_vol,db_batt_testdata.tb_battresdata_"+dto.getBattGroupId()+".test_curr" + |
| | | " ,db_batt_testdata.tb_battresdata_"+dto.getBattGroupId()+".test_starttime,mon_num,mon_vol,mon_tmp,mon_res,mon_ser,conn_res " + |
| | | " from " + |
| | | " db_battinf.tb_battinf,db_batt_testdata.tb_battresdata_inf,db_batt_testdata.tb_battresdata_"+dto.getBattGroupId()+" " + |
| | | " where " + |
| | | " db_battinf.tb_battinf.BattgroupId=db_batt_testdata.tb_battresdata_inf.BattGroupId " + |
| | | " and " + |
| | | " db_batt_testdata.tb_battresdata_inf.BattGroupId=db_batt_testdata.tb_battresdata_"+dto.getBattGroupId()+".battgroupid " + |
| | | " and " + |
| | | " db_batt_testdata.tb_battresdata_inf.test_record_count=db_batt_testdata.tb_battresdata_"+dto.getBattGroupId()+".test_record_count " + |
| | | " and db_battinf.tb_battinf.battgroupid="+dto.getBattGroupId()+" and " + |
| | | " db_batt_testdata.tb_battresdata_inf.data_available=1 and " + |
| | | " db_batt_testdata.tb_battresdata_inf.test_type="+dto.getTestType()+" " ; |
| | | if(dto.getMonNum()!=0){ |
| | | sql+=" and db_batt_testdata.tb_battresdata_"+dto.getBattGroupId()+".mon_num="+dto.getMonNum()+" "; |
| | | } |
| | | if(dto.getStationName1()!=null&&!dto.getStationName1().isEmpty()){ |
| | | sql+=" and stationname1='"+dto.getStationName1()+"' "; |
| | | } |
| | | if(dto.getStationName()!=null&&!dto.getStationName().isEmpty()){ |
| | | sql+=" and stationname='"+dto.getStationName()+"' "; |
| | | } |
| | | sql+=" order by db_batt_testdata.tb_battresdata_"+dto.getBattGroupId()+".test_record_count asc,db_batt_testdata.tb_battresdata_"+dto.getBattGroupId()+".mon_num asc "; |
| | | List<ReportBattResultDTO> list = sqlExecuteService.executeQuery_call(sql, new CallBack() { |
| | | @Override |
| | | public List getResults(ResultSet rs) throws SQLException { |
| | | List<ReportBattResultDTO> list=new ArrayList<>(); |
| | | while (rs.next()){ |
| | | ReportBattResultDTO ph=new ReportBattResultDTO(); |
| | | ph.setBattGroupId(rs.getInt("battGroupId")); |
| | | ph.setMonCount(rs.getInt("moncount")); |
| | | ph.setMonCapStd(rs.getFloat("moncapstd")); |
| | | ph.setMonVolStd(rs.getFloat("monvolstd")); |
| | | ph.setMonResStd(rs.getFloat("monresstd")); |
| | | ph.setMonSerStd(rs.getFloat("monserstd")); |
| | | ph.setFloatVolLevel(rs.getFloat("FloatVolLevel")); |
| | | ph.setOfflineVolLevel(rs.getFloat("OfflineVolLevel")); |
| | | ph.setTestRecordCount(rs.getInt("test_record_count")); |
| | | ph.setTestStartTime(rs.getTimestamp("test_starttime")); |
| | | ph.setGroupVol(rs.getFloat("group_vol")); |
| | | ph.setTestCurr(rs.getFloat("test_curr")); |
| | | ph.setMonNum(rs.getInt("mon_num")); |
| | | ph.setMonVol(rs.getFloat("mon_vol")); |
| | | ph.setMonTmp(rs.getFloat("mon_tmp")); |
| | | ph.setMonSer(rs.getFloat("mon_ser")); |
| | | ph.setMonRes(rs.getFloat("mon_res")); |
| | | ph.setConnRes(rs.getFloat("conn_res")); |
| | | list.add(ph); |
| | | } |
| | | return list; |
| | | } |
| | | }); |
| | | return list; |
| | | } |
| | | |
| | | //45-FBOTestDataMapper.xml;24行 |
| | | public List<FBOTestData> getList_fbo(int battGroupId, int testRecordCount){ |
| | | String sql=" select * from db_fbo_testdata.tb_fbotestdata_"+battGroupId+" where test_record_count = "+testRecordCount+" "; |
| | | List<FBOTestData> list = sqlExecuteService.executeQuery_call(sql, new CallBack() { |
| | | @Override |
| | | public List getResults(ResultSet rs) throws SQLException { |
| | | List<FBOTestData> list=new ArrayList<>(); |
| | | while (rs.next()){ |
| | | FBOTestData ph=new FBOTestData(); |
| | | ph.setNum(rs.getInt("num")); |
| | | ph.setBattGroupId(rs.getInt("BattGroupId")); |
| | | ph.setTestRecordCount(rs.getInt("test_record_count")); |
| | | ph.setTestStartTime(rs.getTimestamp("test_starttime")); |
| | | ph.setTestTimeLong(rs.getInt("test_timelong")); |
| | | ph.setRecordTime(rs.getTimestamp("record_time")); |
| | | ph.setRecordNum(rs.getInt("record_num")); |
| | | ph.setOnlineVol(rs.getFloat("online_vol")); |
| | | ph.setSumVol(rs.getFloat("sum_vol")); |
| | | ph.setTestCurr(rs.getFloat("test_curr")); |
| | | ph.setTestCap(rs.getFloat("test_cap")); |
| | | ph.setMonNum(rs.getInt("mon_num")); |
| | | ph.setMonVol(rs.getFloat("mon_vol")); |
| | | list.add(ph); |
| | | } |
| | | return list; |
| | | } |
| | | }); |
| | | return list; |
| | | } |
| | | |
| | | //76-FBOTestDataMapper.xml;27行 |
| | | public int getMonCuntBytestRecordCount(int battGroupId, int testRecordCount){ |
| | | String sql="select if(max(mon_num) is null,0,max(mon_num)) as monCount " + |
| | | "from db_fbo_testdata.tb_fbotestdata_"+battGroupId+" where test_record_count = "+testRecordCount+" limit 1"; |
| | | 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("monCount")); |
| | | } catch (SQLException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return temp; |
| | | } |
| | | }); |
| | | int monCount =0; |
| | | if(list!=null){ |
| | | monCount= (int) list.get(0); |
| | | } |
| | | return monCount; |
| | | } |
| | | |
| | | //46-BattMaintDealarmMapper.xml;199行 |
| | | public List<ReportBattResultDTO> searchByBattGroupId(ReportBattDTO dto){ |
| | | String sql="select distinct(db_battinf.tb_battinf.BattgroupId),moncount,moncapstd,monvolstd,monresstd,monserstd,FloatVolLevel,OfflineVolLevel" + |
| | | " ,db_batt_testdata.tb_batttestdata_inf.battgroupid,max_monvol,min_monvol,db_batt_testdata.tb_batttestdata_inf.test_record_count" + |
| | | " ,db_batt_testdata.tb_batttestdata_inf.test_type,db_batt_testdata.tb_batttestdata_inf.test_record_count" + |
| | | " ,db_batt_testdata.tb_batttestdatastop_"+dto.getBattGroupId()+".test_starttime,db_batt_testdata.tb_batttestdatastop_"+dto.getBattGroupId()+".record_time" + |
| | | " ,db_batt_testdata.tb_batttestdatastop_"+dto.getBattGroupId()+".test_timelong,db_batt_testdata.tb_batttestdatastop_"+dto.getBattGroupId()+".group_vol" + |
| | | " ,db_batt_testdata.tb_batttestdatastop_"+dto.getBattGroupId()+".test_curr,db_batt_testdata.tb_batttestdatastop_"+dto.getBattGroupId()+".test_cap" + |
| | | " ,db_batt_testdata.tb_batttestdatastop_"+dto.getBattGroupId()+".mon_num,db_batt_testdata.tb_batttestdatastop_"+dto.getBattGroupId()+".mon_vol" + |
| | | " from" + |
| | | " db_battinf.tb_battinf,db_batt_testdata.tb_batttestdata_inf,db_batt_testdata.tb_batttestdatastop_"+dto.getBattGroupId()+" " + |
| | | " where" + |
| | | " db_battinf.tb_battinf.BattgroupId=db_batt_testdata.tb_batttestdata_inf.BattGroupId " + |
| | | " and" + |
| | | " db_batt_testdata.tb_batttestdata_inf.BattGroupId=db_batt_testdata.tb_batttestdatastop_"+dto.getBattGroupId()+".battgroupid " + |
| | | " and" + |
| | | " db_batt_testdata.tb_batttestdata_inf.test_record_count=db_batt_testdata.tb_batttestdatastop_"+dto.getBattGroupId()+".test_record_count " + |
| | | " and" + |
| | | " db_batt_testdata.tb_batttestdata_inf.record_num=db_batt_testdata.tb_batttestdatastop_"+dto.getBattGroupId()+".record_num " + |
| | | " and db_battinf.tb_battinf.battgroupid="+dto.getBattGroupId()+" and " + |
| | | " db_batt_testdata.tb_batttestdata_inf.data_available=1" + |
| | | " and db_batt_testdata.tb_batttestdata_inf.test_type="+dto.getTestType()+" and " + |
| | | " db_batt_testdata.tb_batttestdata_inf.test_starttype=3 " ; |
| | | if(dto.getMonNum()!=0){ |
| | | sql+=" and db_batt_testdata.tb_batttestdatastop_"+dto.getBattGroupId()+".mon_num="+dto.getMonNum()+" "; |
| | | } |
| | | if(dto.getStationName1()!=null&&!dto.getStationName1().isEmpty()){ |
| | | sql+=" and stationname1='"+dto.getStationName1()+"' "; |
| | | } |
| | | if(dto.getStationName()!=null&&!dto.getStationName().isEmpty()){ |
| | | sql+=" and stationname='"+dto.getStationName()+"' "; |
| | | } |
| | | sql+=" order by db_batt_testdata.tb_batttestdatastop_"+dto.getBattGroupId()+".test_record_count asc,db_batt_testdata.tb_batttestdatastop_"+dto.getBattGroupId()+".mon_num asc "; |
| | | List<ReportBattResultDTO> list = sqlExecuteService.executeQuery_call(sql, new CallBack() { |
| | | @Override |
| | | public List getResults(ResultSet rs) throws SQLException { |
| | | List<ReportBattResultDTO> list=new ArrayList<>(); |
| | | while (rs.next()){ |
| | | ReportBattResultDTO ph=new ReportBattResultDTO(); |
| | | ph.setBattGroupId(rs.getInt("battGroupId")); |
| | | ph.setMonCount(rs.getInt("moncount")); |
| | | ph.setMonCapStd(rs.getFloat("moncapstd")); |
| | | ph.setMonVolStd(rs.getFloat("monvolstd")); |
| | | ph.setMonResStd(rs.getFloat("monresstd")); |
| | | ph.setMonSerStd(rs.getFloat("monserstd")); |
| | | ph.setFloatVolLevel(rs.getFloat("FloatVolLevel")); |
| | | ph.setOfflineVolLevel(rs.getFloat("OfflineVolLevel")); |
| | | ph.setMaxMonVol(rs.getFloat("max_monvol")); |
| | | ph.setMinMonVol(rs.getFloat("min_monvol")); |
| | | ph.setTestRecordCount(rs.getInt("test_record_count")); |
| | | ph.setTestStartTime(rs.getTimestamp("test_starttime")); |
| | | ph.setRecordTime(rs.getTimestamp("record_time")); |
| | | ph.setTestTimeLong(rs.getInt("test_timelong")); |
| | | ph.setGroupVol(rs.getFloat("group_vol")); |
| | | ph.setTestCurr(rs.getFloat("test_curr")); |
| | | ph.setTestCap(rs.getFloat("test_cap")); |
| | | ph.setMonNum(rs.getInt("mon_num")); |
| | | ph.setMonVol(rs.getFloat("mon_vol")); |
| | | list.add(ph); |
| | | } |
| | | return list; |
| | | } |
| | | }); |
| | | return list; |
| | | } |
| | | |
| | | //49-PowerAppSysMapper.xml;12行 |
| | | public int updateFlag(String columnName){ |
| | | String sql=" update db_pwrdev_inf.tb_pwrapp_sys set "+columnName+"=1 limit 1 "; |
| | | int flag=sqlExecuteService.executeUpdate(sql,null); |
| | | return flag; |
| | | } |
| | | |
| | | //52-BatttestdataInfMapper.xml;34行 |
| | | public int judge( int battGroupId){ |
| | | String sql="select count(table_name) as judgeNum from INFORMATION_SCHEMA.TABLES where table_name ='tb_batttestdatastop_"+battGroupId+"' and TABLE_SCHEMA='db_batt_testdata'"; |
| | | 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("judgeNum")); |
| | | } catch (SQLException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return temp; |
| | | } |
| | | }); |
| | | int judgeNum =0; |
| | | if(list!=null){ |
| | | judgeNum= (int) list.get(0); |
| | | } |
| | | return judgeNum; |
| | | } |
| | | |
| | | //55-DevalarmDataHistoryMapper.xml;215行 |
| | | public List<DevalarmDataHistory> getListByStationId_dev(Date startTime, Date endTime, String stationId,String tableName){ |
| | | String sql="select h.*,b.StationName,b.StationName1,b.StationName2,b.StationName3,b.StationName5 from db_alarm."+tableName+" h,db_battinf.tb_battinf b " + |
| | | " where h.dev_id = b.FBSDeviceId " ; |
| | | if(stationId!=null&&!stationId.isEmpty()){ |
| | | sql+=" and b.stationId ="+stationId+" "; |
| | | } |
| | | sql+=" and h.alm_start_time >= '"+ThreadLocalUtil.format(startTime,1)+"' and h.alm_start_time <= '"+ThreadLocalUtil.format(endTime,1)+"' "; |
| | | 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.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; |
| | | } |
| | | |
| | | //60-PwrdevAlarmParamMapper.xml;27行 |
| | | public int updateParam(PwrdevAlarmParam param){ |
| | | String sql=" update db_pwrdev_alarm.tb_pwrdev_alarm_param_"+param.getPowerDeviceId()+" set alarm_limitH ="+param.getAlarmLimith()+"," + |
| | | " alarm_limitL ="+param.getAlarmLimitl()+",alarm_level="+param.getAlarmLevel()+ |
| | | ",UserAlarm_EN="+param.getUseralarmEn()+" where alarm_id ="+param.getAlarmId()+" "; |
| | | int flag=sqlExecuteService.executeUpdate(sql,null); |
| | | return flag; |
| | | } |
| | | |
| | | //61-BattResDataMapper.xml;21行 |
| | | public List serchisStandard(int battGroupId){ |
| | | String sql=" select * from db_batt_testdata.tb_battresdata_"+battGroupId+" where isStandard=1 "; |
| | | List<BattResData> list = sqlExecuteService.executeQuery_call(sql, new CallBack() { |
| | | @Override |
| | | public List getResults(ResultSet rs) throws SQLException { |
| | | List<BattResData> list=new ArrayList<>(); |
| | | while (rs.next()){ |
| | | BattResData bh=new BattResData(); |
| | | bh.setNum(rs.getLong("num")); |
| | | bh.setBattGroupId(rs.getInt("BattGroupId")); |
| | | bh.setTestRecordCount(rs.getInt("test_record_count")); |
| | | bh.setTestType(rs.getInt("test_type")); |
| | | bh.setDataNew(rs.getInt("data_new")); |
| | | bh.setDataAvailable(rs.getInt("data_available")); |
| | | bh.setTestStartTime(rs.getTimestamp("test_starttime")); |
| | | bh.setGroupVol(rs.getFloat("group_vol")); |
| | | bh.setTestCurr(rs.getFloat("test_curr")); |
| | | bh.setMonNum(rs.getInt("mon_num")); |
| | | bh.setMonVol(rs.getFloat("mon_vol")); |
| | | bh.setMonTemp(rs.getFloat("mon_tmp")); |
| | | bh.setMonSer(rs.getFloat("mon_ser")); |
| | | bh.setMonRes(rs.getFloat("mon_res")); |
| | | bh.setConnRes(rs.getFloat("conn_res")); |
| | | list.add(bh); |
| | | } |
| | | return list; |
| | | } |
| | | }); |
| | | return list; |
| | | } |
| | | |
| | | //78-BattResDataMapper.xml;24行 |
| | | public List serchCurrent( int battGroupId){ |
| | | String sql=" select * from db_batt_testdata.tb_battresdata_"+battGroupId+" " + |
| | | " where test_starttime=( " + |
| | | " SELECT DISTINCT test_starttime from db_batt_testdata.tb_battresdata_inf where BattGroupId="+battGroupId+" order by test_starttime desc limit 1 " + |
| | | " )"; |
| | | List<BattResData> list = sqlExecuteService.executeQuery_call(sql, new CallBack() { |
| | | @Override |
| | | public List getResults(ResultSet rs) throws SQLException { |
| | | List<BattResData> list=new ArrayList<>(); |
| | | while (rs.next()){ |
| | | BattResData bh=new BattResData(); |
| | | bh.setNum(rs.getLong("num")); |
| | | bh.setBattGroupId(rs.getInt("BattGroupId")); |
| | | bh.setTestRecordCount(rs.getInt("test_record_count")); |
| | | bh.setTestType(rs.getInt("test_type")); |
| | | bh.setDataNew(rs.getInt("data_new")); |
| | | bh.setDataAvailable(rs.getInt("data_available")); |
| | | bh.setTestStartTime(rs.getTimestamp("test_starttime")); |
| | | bh.setGroupVol(rs.getFloat("group_vol")); |
| | | bh.setTestCurr(rs.getFloat("test_curr")); |
| | | bh.setMonNum(rs.getInt("mon_num")); |
| | | bh.setMonVol(rs.getFloat("mon_vol")); |
| | | bh.setMonTemp(rs.getFloat("mon_tmp")); |
| | | bh.setMonSer(rs.getFloat("mon_ser")); |
| | | bh.setMonRes(rs.getFloat("mon_res")); |
| | | bh.setConnRes(rs.getFloat("conn_res")); |
| | | list.add(bh); |
| | | } |
| | | return list; |
| | | } |
| | | }); |
| | | 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() { |
| | | @Override |
| | | public List getResults(ResultSet rs) throws SQLException { |
| | | List<BattResData> list=new ArrayList<>(); |
| | | while (rs.next()){ |
| | | BattResData bh=new BattResData(); |
| | | bh.setNum(rs.getLong("num")); |
| | | bh.setBattGroupId(rs.getInt("BattGroupId")); |
| | | bh.setTestRecordCount(rs.getInt("test_record_count")); |
| | | bh.setTestType(rs.getInt("test_type")); |
| | | bh.setDataNew(rs.getInt("data_new")); |
| | | bh.setDataAvailable(rs.getInt("data_available")); |
| | | bh.setTestStartTime(rs.getTimestamp("test_starttime")); |
| | | bh.setGroupVol(rs.getFloat("group_vol")); |
| | | bh.setTestCurr(rs.getFloat("test_curr")); |
| | | bh.setMonNum(rs.getInt("mon_num")); |
| | | bh.setMonVol(rs.getFloat("mon_vol")); |
| | | bh.setMonTemp(rs.getFloat("mon_tmp")); |
| | | bh.setMonSer(rs.getFloat("mon_ser")); |
| | | bh.setMonRes(rs.getFloat("mon_res")); |
| | | bh.setConnRes(rs.getFloat("conn_res")); |
| | | list.add(bh); |
| | | } |
| | | return list; |
| | | } |
| | | }); |
| | | 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); |
| | | } |
| | | |
| | | //93-CommonMapper.xml;160行 |
| | | public void truncate(String dbName, String tableName){ |
| | | String sql="TRUNCATE "+dbName+".`"+tableName+"`"; |
| | | 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); |
| | | } |
| | | } |