| | |
| | | package com.whyc.service; |
| | | |
| | | import com.whyc.dto.DalmDto; |
| | | import com.whyc.dto.DevA200AlarmDto; |
| | | import com.whyc.mapper.CallBack; |
| | | import com.whyc.pojo.db_alarm.DevAlarmDataYear; |
| | | import com.whyc.pojo.db_batt_testdata.BattTestDataId; |
| | | import com.whyc.pojo.db_alarm.DevLithiumAlarmDataYear; |
| | | import com.whyc.pojo.db_lithium_testdata.BattLithiumTestData; |
| | | import com.whyc.util.ThreadLocalUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | @Autowired |
| | | private MybatisSqlExecuteService sqlExecuteService; |
| | | //获取设备某次记录详细的单体放电过程 |
| | | public List<BattTestDataId> getTdataById(Integer devId, Integer testRecordCount) { |
| | | public List<BattLithiumTestData> getTdataById(Integer devId, Integer testRecordCount) { |
| | | String sql="select * from db_batt_testdata.tb_batttestdata_" +devId |
| | | +" where need_test=1 and test_record_count="+testRecordCount+" "; |
| | | sql+=" ORDER BY record_num asc "; |
| | | List list = sqlExecuteService.executeQuery_call(sql, new CallBack() { |
| | | @Override |
| | | public List getResults(ResultSet rs) throws SQLException { |
| | | List<BattTestDataId> list=new ArrayList<>(); |
| | | List<BattLithiumTestData> list=new ArrayList<>(); |
| | | while (rs.next()){ |
| | | BattTestDataId tdata=new BattTestDataId(); |
| | | BattLithiumTestData tdata=new BattLithiumTestData(); |
| | | tdata.setNum(rs.getInt("num")); |
| | | tdata.setDevId(rs.getInt("dev_id")); |
| | | tdata.setBattIdx(rs.getInt("batt_idx")); |
| | |
| | | } |
| | | |
| | | //获取设备某次记录详细的单体放电过程 |
| | | public List<BattTestDataId> getTdataByIdWithListA200(Integer devId, Integer testRecordCount) { |
| | | String sql="select * from db_batt_testdata.tb_batttestdata_" +devId |
| | | public List<BattLithiumTestData> getTdataByIdWithListA200(Integer devId, Integer testRecordCount) { |
| | | String sql="select * from db_lithium_testdata.tb_batttestdata_" +devId |
| | | +" where need_test=1 and test_record_count="+testRecordCount+" "; |
| | | sql+=" ORDER BY record_num asc "; |
| | | List list = sqlExecuteService.executeQuery_call(sql, new CallBack() { |
| | |
| | | List list=new ArrayList<>(); |
| | | List<Float> monVols=null; |
| | | List<Integer> monNums=null; |
| | | BattTestDataId tdata=null; |
| | | BattLithiumTestData tdata=null; |
| | | int num=0; |
| | | try { |
| | | while (rs.next()){ |
| | |
| | | tdata.setMonNums(monNums); |
| | | list.add(tdata); |
| | | } |
| | | tdata=new BattTestDataId(); |
| | | tdata=new BattLithiumTestData(); |
| | | monVols=new ArrayList<>(); |
| | | monNums=new ArrayList<>(); |
| | | tdata.setDevId(rs.getInt("dev_id")); |
| | |
| | | return list; |
| | | } |
| | | //查询DevAlm历史告警数量 |
| | | public int getCountForDevAlm(DalmDto dto) { |
| | | public int getCountForDevAlm(DevA200AlarmDto dto) { |
| | | String sql="select count(distinct num) as number from db_alarm." +dto.getTableName() |
| | | +" where 1=1 "; |
| | | |
| | |
| | | return num; |
| | | } |
| | | //查询devalm历史告警 |
| | | public List getListDevAlm(DalmDto dto){ |
| | | public List getListDevAlm(DevA200AlarmDto dto){ |
| | | String sql="select * from db_alarm." +dto.getTableName() |
| | | +" where 1=1 "; |
| | | |
| | |
| | | List list = sqlExecuteService.executeQuery_call(sql, new CallBack() { |
| | | @Override |
| | | public List getResults(ResultSet rs) throws SQLException { |
| | | List<DevAlarmDataYear> list=new ArrayList<>(); |
| | | List<DevLithiumAlarmDataYear> list=new ArrayList<>(); |
| | | while (rs.next()){ |
| | | DevAlarmDataYear dataYear=new DevAlarmDataYear(); |
| | | DevLithiumAlarmDataYear dataYear=new DevLithiumAlarmDataYear(); |
| | | dataYear.setNum(rs.getInt("num")); |
| | | dataYear.setDevId(rs.getInt("dev_id")); |
| | | dataYear.setAlmId(rs.getInt("alm_id")); |
| | |
| | | } |
| | | |
| | | |
| | | public List<BattTestDataId> getTdataByIdWithListActm(Integer devId, Integer testRecordCount) { |
| | | public List<BattLithiumTestData> getTdataByIdWithListActm(Integer devId, Integer testRecordCount) { |
| | | String sql="select * from db_batt_testdata.tb_batttestdata_" +devId |
| | | +" where need_test=1 and test_record_count="+testRecordCount+" "; |
| | | sql+=" ORDER BY record_num asc "; |
| | |
| | | List<Float> monCaps=null; |
| | | List<Float> monWhs=null; |
| | | List<Integer> monNums=null; |
| | | BattTestDataId tdata=null; |
| | | BattLithiumTestData tdata=null; |
| | | int num=0; |
| | | try { |
| | | while (rs.next()){ |
| | |
| | | tdata.setMonWhs(monWhs); |
| | | list.add(tdata); |
| | | } |
| | | tdata=new BattTestDataId(); |
| | | tdata=new BattLithiumTestData(); |
| | | monVols=new ArrayList<>(); |
| | | monNums=new ArrayList<>(); |
| | | monCurrs=new ArrayList<>(); |