package com.whyc.service;
|
|
import com.whyc.dto.StandardFeatureCurve;
|
import com.whyc.mapper.CallBack;
|
import com.whyc.pojo.DevalarmDataHistory;
|
import com.whyc.pojo.PwrdevAlarmHistory;
|
import com.whyc.pojo.PwrdevDataHistory;
|
import com.whyc.pojo.UserLog;
|
import com.whyc.util.ActionUtil;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.stereotype.Service;
|
|
import javax.swing.*;
|
import java.sql.ResultSet;
|
import java.sql.SQLException;
|
import java.util.ArrayList;
|
import java.util.LinkedList;
|
import java.util.List;
|
|
@Service
|
public class SubTablePageInfoService {
|
@Autowired
|
private MybatisSqlExecuteService sqlExecuteService;
|
//2-SubTablePageInfoUtils.java;201行
|
public List<PwrdevAlarmHistory> getList2(PwrdevAlarmHistory data){
|
String sql="select alarm.*,inf.StationName,inf.StationName1,inf.StationName2,inf.StationName3,inf.StationName5 " +
|
" from db_pwrdev_alarm."+data.getRecordYear()+" alarm,db_pwrdev_inf.tb_pwrdev_inf inf " +
|
" where alarm.PowerDeviceId = inf.PowerDeviceId ";
|
if(data.getStationName1()!=null){
|
sql+=" and stationName1 like '%"+data.getStationName1()+"%'";
|
}
|
if(data.getStationName2()!=null){
|
sql+=" and stationName2 like '%"+data.getStationName2()+"%'";
|
}
|
if(data.getStationName5()!=null){
|
sql+=" and stationName5 like '%"+data.getStationName5()+"%'";
|
}
|
if(data.getStationName3()!=null){
|
sql+=" and stationName3 like '%"+data.getStationName3()+"%'";
|
}
|
if(data.getAlmStartTime()!=null){
|
sql+=" and alarm.alm_start_time >="+data.getAlmStartTime()+" ";
|
}
|
if(data.getAlmStartTime1()!=null){
|
sql+=" and alarm.alm_start_time <="+data.getAlmStartTime1()+" ";
|
}
|
if(data.getAlmSource()==0){
|
sql+=" and alm_source!=100 ";
|
}
|
if(data.getAlmSource()!=0){
|
sql+=" and alm_source="+data.getAlmSource()+" ";
|
}
|
if(data.getAlmTypes()!=null&&data.getAlmTypes().size()>0){
|
sql+=" and alm_type in ( ";
|
for (Integer item:data.getAlmTypes()) {
|
sql+=item+",";
|
}
|
sql+=")";
|
}
|
sql+=" and StationId in ( select distinct inf.StationId from " +
|
" (select StationId from db_battinf.tb_battinf union select 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="+data.getUsrId()+" ) order by alarm.alm_start_time desc limit "+data.getLimitStart()+","+data.getLimitEnd()+" ";
|
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.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;
|
}
|
|
//3-SubTablePageInfoUtils.java;72行
|
public List<PwrdevAlarmHistory> getListForTX(PwrdevAlarmHistory data){
|
String sql="select alarm.*,inf.StationName,inf.StationName1,inf.StationName2,inf.StationName3,inf.StationName5 " +
|
" from db_pwrdev_alarm."+data.getRecordYear()+" alarm,db_pwrdev_inf.tb_pwrdev_inf inf " +
|
" where alarm.PowerDeviceId = inf.PowerDeviceId ";
|
if(data.getStationName1()!=null){
|
sql+=" and stationName1 like '%"+data.getStationName1()+"%'";
|
}
|
if(data.getStationName2()!=null){
|
sql+=" and stationName2 like '%"+data.getStationName2()+"%'";
|
}
|
if(data.getStationName5()!=null){
|
sql+=" and stationName5 like '%"+data.getStationName5()+"%'";
|
}
|
if(data.getStationName3()!=null){
|
sql+=" and stationName3 like '%"+data.getStationName3()+"%'";
|
}
|
if(data.getAlmStartTime()!=null){
|
sql+=" and alarm.alm_start_time >="+data.getAlmStartTime()+" ";
|
}
|
if(data.getAlmStartTime1()!=null){
|
sql+=" and alarm.alm_start_time <="+data.getAlmStartTime1()+" ";
|
}
|
if(data.getAlmSource()==0){
|
sql+=" and alm_source!=100 ";
|
}
|
if(data.getAlmSource()!=0){
|
sql+=" and alm_source="+data.getAlmSource()+" ";
|
}
|
if(data.getAlmTypes()!=null&&data.getAlmTypes().size()>0){
|
sql+=" and alm_type in ( ";
|
for (Integer item:data.getAlmTypes()) {
|
sql+=item+",";
|
}
|
sql+=")";
|
}
|
if(data.getAlmLevels()!=null&&data.getAlmLevels().size()>0){
|
sql+=" and alm_level in ( ";
|
for (Integer item:data.getAlmTypes()) {
|
sql+=item+",";
|
}
|
sql+=")";
|
}
|
sql+=" and StationId in ( select distinct inf.StationId from " +
|
" (select StationId from db_battinf.tb_battinf union select 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="+data.getUsrId()+" ) order by alarm.alm_start_time desc limit "+data.getLimitStart()+","+data.getLimitEnd()+" ";
|
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.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;
|
}
|
|
//4-SubTablePageInfoUtils.java;445行
|
public int getCount(UserLog userLog){
|
String sql=" select count(*) num from db_user."+userLog.getRecordYear()+" l,db_user.tb_user_inf u" +
|
" where l.uId = u.uId" +
|
" and uOprateDay between "+userLog.getOperationTime()+" and "+userLog.getOperationTime2()+" ";
|
if(userLog.getUId()!=null){
|
sql+=" and l.uId ="+userLog.getUId()+" ";
|
}
|
//条件查询-非全部
|
if(userLog.getEventType()!=null){
|
if(userLog.getEventType()==1){
|
if(userLog.getOperationType()==1||userLog.getOperationType()==2
|
||userLog.getOperationType()==20||userLog.getOperationType()==21){
|
if(userLog.getOperationType()==1){
|
sql+=" and uoprateType in ("+userLog.getOperationType()+",35) ";
|
}else{
|
sql+=" and uoprateType ="+userLog.getOperationType()+" ";
|
}
|
}
|
if(userLog.getOperationType()==31||userLog.getOperationType()==32
|
||userLog.getOperationType()==33||userLog.getOperationType()==34){
|
sql+=" and uoprateType ="+userLog.getOperationType()+" ";
|
if(userLog.getOperationType()==31){
|
sql+=" or uOprateMsg regexp '登录PC系统失败' ";
|
}else if(userLog.getOperationType()==32){
|
sql+=" or uOprateMsg regexp '配置参数修改|导航配置' ";
|
}else if(userLog.getOperationType()==33){
|
sql+=" r uOprateMsg regexp '密码' and uOprateMsg not regexp '更新密码复杂度规则' ";
|
}else{
|
sql+=" or uOprateMsg regexp 'LoginAction!login|imeout' ";
|
}
|
}
|
if(userLog.getOperationType()==3||userLog.getOperationType()==4||userLog.getOperationType()==5){
|
sql+=" and uoprateType= #{operationType} " +
|
" and uOprateMsg regexp " +
|
" '添加新用户|的用户信息|权限组|审计数据记录容量 " +
|
" |执行了User模块|执行了PermitGroup' ";
|
}
|
}
|
if(userLog.getEventType()==2){
|
sql+=" and uoprateType= #{operationType} " +
|
" and uOprateMsg regexp '单体|电池组|组端|设备|Batt|Dev|FBO|Fbs|Ld9|Li9130|Lithium|Station3D' " +
|
" and uOprateMsg not regexp '电源|Pwrdev' ";
|
}
|
if(userLog.getEventType()==3){
|
sql+=" and uoprateType= #{operationType} " +
|
" and uOprateMsg regexp 'PowerInf|Pwr' ";
|
}
|
if(userLog.getEventType()==4){
|
sql+=" and uoprateType= #{operationType} " +
|
" and uOprateMsg not regexp '添加新用户|的用户信息|权限组|审计数据记录容量|配置参数修改|导航配置|密码|单体|电池组|组端|设备|电源| " +
|
" |执行了User模块|执行了PermitGroup| " +
|
" |Batt|Dev|FBO|Fbs|Ld9|Li9130|Lithium|Station3D| " +
|
" |PowerInf|Pwr' ";
|
}
|
}
|
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;
|
}
|
});
|
int num =0;
|
if(list!=null){
|
num= (int) list.get(0);
|
}
|
return num;
|
}
|
|
//5-PwrdevDataHistoryService.java;81行
|
public List<PwrdevDataHistory> getData(String tableName){
|
String sql=" select * from db_pwrdev_data_history."+tableName+" ";
|
List<PwrdevDataHistory> list = sqlExecuteService.executeQuery_call(sql, new CallBack() {
|
@Override
|
public List getResults(ResultSet rs) throws SQLException {
|
List<PwrdevDataHistory> list=new ArrayList<>();
|
while (rs.next()){
|
PwrdevDataHistory ph=new PwrdevDataHistory();
|
ph.setNum(rs.getInt("num"));
|
ph.setPowerDeviceId(rs.getInt("PowerDeviceId"));
|
ph.setRecordTime(rs.getTimestamp("record_time"));
|
ph.setAcAcIn1VolA(rs.getFloat("AC_acIn1_volA"));
|
ph.setAcAcIn1VolB(rs.getFloat("AC_acIn1_volB"));
|
ph.setAcAcIn1VolC(rs.getFloat("AC_acIn1_volC"));
|
ph.setAcAcIn1CurrA(rs.getFloat("AC_acIn1_currA"));
|
ph.setAcAcIn1CurrB(rs.getFloat("AC_acIn1_currB"));
|
ph.setAcAcIn1CurrC(rs.getFloat("AC_acIn1_currC"));
|
ph.setAcAcIn2VolA(rs.getFloat("AC_acIn2_volA"));
|
ph.setAcAcIn2VolB(rs.getFloat("AC_acIn2_volB"));
|
ph.setAcAcIn2VolC(rs.getFloat("AC_acIn2_volC"));
|
ph.setAcAcIn2CurrA(rs.getFloat("AC_acIn2_currA"));
|
ph.setAcAcIn2CurrB(rs.getFloat("AC_acIn2_currB"));
|
ph.setAcAcIn2CurrC(rs.getFloat("AC_acIn2_currC"));
|
ph.setAcTemprature(rs.getFloat("AC_temprature"));
|
ph.setAcAcVolHLimit(rs.getFloat("AC_acVolH_Limit"));
|
ph.setAcAcVolLLimit(rs.getFloat("AC_acVolL_Limit"));
|
ph.setAcdcAcIn1VolA(rs.getFloat("ACDC_acIn1_volA"));
|
ph.setAcdcAcIn1VolB(rs.getFloat("ACDC_acIn1_volB"));
|
ph.setAcdcAcIn1VolC(rs.getFloat("ACDC_acIn1_volC"));
|
ph.setAcdcAcIn2VolA(rs.getFloat("ACDC_acIn2_volA"));
|
ph.setAcdcAcIn2VolB(rs.getFloat("ACDC_acIn2_volB"));
|
ph.setAcdcAcIn2VolC(rs.getFloat("ACDC_acIn2_volC"));
|
ph.setAcdcAcOutVolA(rs.getFloat("ACDC_acOut_volA"));
|
ph.setAcdcAcOutVolB(rs.getFloat("ACDC_acOut_volB"));
|
ph.setAcdcAcOutVolC(rs.getFloat("ACDC_acOut_volC"));
|
ph.setAcdcAcOutCurrA(rs.getFloat("ACDC_acOut_currA"));
|
ph.setAcdcAcOutCurrB(rs.getFloat("ACDC_acOut_currB"));
|
ph.setAcdcAcOutCurrC(rs.getFloat("ACDC_acOut_currC"));
|
ph.setAcdcDcOutVol(rs.getFloat("ACDC_dcOut_vol"));
|
ph.setAcdcLoaderCurr(rs.getFloat("ACDC_loader_curr"));
|
ph.setAcdcBattgroup1Vol(rs.getFloat("ACDC_battgroup1_vol"));
|
ph.setAcdcBattgroup1Curr(rs.getFloat("ACDC_battgroup1_curr"));
|
ph.setAcdcBattgroup2Vol(rs.getFloat("ACDC_battgroup2_vol"));
|
ph.setAcdcBattgroup2Curr(rs.getFloat("ACDC_battgroup2_curr"));
|
ph.setAcdcAcdcmTemp(rs.getFloat("ACDC_acdcm_temp"));
|
ph.setAcdcM1OutCurr(rs.getFloat("ACDC_m1_outCurr"));
|
ph.setAcdcM2OutCurr(rs.getFloat("ACDC_m2_outCurr"));
|
ph.setAcdcM3OutCurr(rs.getFloat("ACDC_m3_outCurr"));
|
ph.setAcdcM4OutCurr(rs.getFloat("ACDC_m4_outCurr"));
|
ph.setAcdcM5OutCurr(rs.getFloat("ACDC_m5_outCurr"));
|
ph.setAcdcM6OutCurr(rs.getFloat("ACDC_m6_outCurr"));
|
ph.setAcdcM7OutCurr(rs.getFloat("ACDC_m7_outCurr"));
|
ph.setAcdcM8OutCurr(rs.getFloat("ACDC_m8_outCurr"));
|
ph.setAcdcM9OutCurr(rs.getFloat("ACDC_m9_outCurr"));
|
ph.setAcdcM10OutCurr(rs.getFloat("ACDC_m10_outCurr"));
|
ph.setAcdcM11OutCurr(rs.getFloat("ACDC_m11_outCurr"));
|
ph.setAcdcM12OutCurr(rs.getFloat("ACDC_m12_outCurr"));
|
ph.setAcdcM13OutCurr(rs.getFloat("ACDC_m13_outCurr"));
|
ph.setAcdcM14OutCurr(rs.getFloat("ACDC_m14_outCurr"));
|
ph.setAcdcM15OutCurr(rs.getFloat("ACDC_m15_outCurr"));
|
ph.setAcdcM16OutCurr(rs.getFloat("ACDC_m16_outCurr"));
|
ph.setAcdcChargLimitCurr(rs.getFloat("ACDC_chargLimitCurr"));
|
ph.setAcdcJunChargeVol(rs.getFloat("ACDC_junChargeVol"));
|
ph.setAcdcFloatChargeVol(rs.getFloat("ACDC_floatChargeVol"));
|
ph.setAcdcAcVolHLimit(rs.getFloat("ACDC_acVolH_Limit"));
|
ph.setAcdcAcVolLLimit(rs.getFloat("ACDC_acVolL_Limit"));
|
ph.setAcdcDcOutVolHLimit(rs.getFloat("ACDC_dcOutVolH_Limit"));
|
ph.setAcdcDcOutVolLLimit(rs.getFloat("ACDC_dcOutVolL_Limit"));
|
ph.setDcDcIn1Vol(rs.getFloat("DC_dcIn1_vol"));
|
ph.setDcDcIn2Vol(rs.getFloat("DC_dcIn2_vol"));
|
ph.setDcDcOut1Vol(rs.getFloat("DC_dcOut1_vol"));
|
ph.setDcDcOut1Curr(rs.getFloat("DC_dcOut1_curr"));
|
ph.setDcDcOut2Vol(rs.getFloat("DC_dcOut2_vol"));
|
ph.setDcDcOut2Curr(rs.getFloat("DC_dcOut2_curr"));
|
ph.setDcTemprature(rs.getFloat("DC_temprature"));
|
ph.setDcDcVolHLimit(rs.getFloat("DC_dcVolH_Limit"));
|
ph.setDcDcVolLLimit(rs.getFloat("DC_dcVolL_Limit"));
|
list.add(ph);
|
}
|
return list;
|
}
|
});
|
return list;
|
}
|
|
}
|