| | |
| | | //升级插入
|
| | | public boolean add(Object obj) {
|
| | | Fbs9100s_dfu_state dfu=(Fbs9100s_dfu_state) obj;
|
| | | String sql=" REPLACE into db_ram_db.tb_fbs9100s_dfu_state (dev_id,dfu_file,dfu_wr_stat,dfu_data_blocknum,dfu_data_blocksum) values (?,?,?,?,?)";
|
| | | boolean bl=DAOHelper.executeUpdate(DBUtil.getConn(), sql, new Object[]{dfu.getDev_id(),dfu.getDfu_file(),dfu.getDfu_wr_stat(),dfu.getDfu_data_blocknum(),dfu.getDfu_data_blocksum()});
|
| | | String sql=" REPLACE into db_ram_db.tb_fbs9100s_dfu_state (dev_id,dfu_file,dfu_wr_stat,dfu_data_blocknum,dfu_file_len) values (?,?,?,?,?)";
|
| | | boolean bl=DAOHelper.executeUpdate(DBUtil.getConn(), sql, new Object[]{dfu.getDev_id(),dfu.getDfu_file(),dfu.getDfu_wr_stat(),dfu.getDfu_data_blocknum(),dfu.getDfu_file_len()});
|
| | | return bl;
|
| | | }
|
| | | //批量升级插入(所有属性传到stationName中,文件大小的值放在num中)
|
| | | public boolean addPro(Object obj) {
|
| | | BattInf binf=(BattInf) obj;
|
| | | String sql=" REPLACE into db_ram_db.tb_fbs9100s_dfu_state(dev_id,dfu_file,dfu_wr_stat,dfu_data_blocknum,dfu_data_blocksum) " +
|
| | | " SELECT DISTINCT fBSDeviceId,'avr_dfu.uc3',1,1,"+binf.getSize()+" FROM db_battinf.tb_battinf " +
|
| | | String sql=" REPLACE into db_ram_db.tb_fbs9100s_dfu_state(dev_id,dfu_wr_stat,dfu_data_blocknum) " +
|
| | | " SELECT DISTINCT fBSDeviceId,1,1 FROM db_battinf.tb_battinf " +
|
| | | " where fBSDeviceId not in(select DISTINCT dev_id from db_ram_db.tb_fbs9100s_dfu_state where dfu_en=true) ";
|
| | | //条件
|
| | | String sql0=" and stationid=? "; //具体机房
|
| | |
| | | //表格显示批量插入的机房信息
|
| | | public List serchInserStation(Object obj){
|
| | | BattInf binf=(BattInf) obj;
|
| | | String sql="SELECT DISTINCT fBSDeviceId,fBSDeviceName,stationId,stationname,stationname1,stationname2,stationname3,stationname5 from db_battinf.tb_battinf " +
|
| | | " where ";
|
| | | String sql="SELECT DISTINCT fBSDeviceId,fBSDeviceName,stationId,stationname,stationname1,stationname2,stationname3,stationname5 " +
|
| | | ",db_ram_db.tb_fbs9100_state.dev_id,db_ram_db.tb_fbs9100_state.dev_version" +
|
| | | " from db_battinf.tb_battinf,db_ram_db.tb_fbs9100_state " +
|
| | | " where db_battinf.tb_battinf.fBSDeviceId=db_ram_db.tb_fbs9100_state.dev_id " +
|
| | | " and db_battinf.tb_battinf.station_install=1 " +
|
| | | " and ";
|
| | | //条件
|
| | | String sql0=" stationid=? "; //具体机房
|
| | | String sql1=" stationname1=? ";//省
|
| | |
| | | binf.setStationName5(rs.getString("stationName5"));
|
| | | binf.setStationId(rs.getString("stationId"));
|
| | | binf.setFBSDeviceName(rs.getString("fBSDeviceName"));
|
| | | binf.setStationIp(rs.getString("dev_version"));
|
| | | list.add(binf);
|
| | | }
|
| | | } catch (SQLException e) {
|
| | |
| | | if(list!=null&&list.size()>0){
|
| | | for (int i = 0; i < list.size(); i++) {
|
| | | Fbs9100s_dfu_state dfu=list.get(i);
|
| | | String sql="update db_ram_db.tb_fbs9100s_dfu_state set dfu_en=true,dfu_wr_stat=1, dfu_data_blocknum=1 where dev_id="+dfu.getDev_id();
|
| | | String sql="update db_ram_db.tb_fbs9100s_dfu_state set dfu_en=true,dfu_wr_stat=1, dfu_data_blocknum=1,dfu_file='"+dfu.getDfu_file()+"' where dev_id="+dfu.getDev_id();
|
| | | sql_str.add(sql);
|
| | | {
|
| | | String msg="升级"+dfu.getDev_id()+"设备";
|
| | |
| | | }
|
| | | //查询出所有处于升级的设备
|
| | | public List searchAll() {
|
| | | String sql=" select distinct dev_id,db_battinf.tb_battinf.stationname,db_battinf.tb_battinf.stationId,db_battinf.tb_battinf.fBSDeviceName,sysVersion_new,softVersion_new,sysVersion_dev,softVersion_dev,dfu_file,dfu_en,dfu_wr_stat,dfu_data_blocknum,dfu_data_blocklen,dfu_data_blocksum " +
|
| | | " from db_ram_db.tb_fbs9100s_dfu_state,db_battinf.tb_battinf " +
|
| | | " where db_ram_db.tb_fbs9100s_dfu_state.dev_id=db_battinf.tb_battinf.fBSDeviceId and dfu_en=1";
|
| | | String sql=" select distinct db_ram_db.tb_fbs9100s_dfu_state.dev_id,db_battinf.tb_battinf.stationname,db_battinf.tb_battinf.stationId,db_battinf.tb_battinf.fBSDeviceName " +
|
| | | ",sysVersion_new,softVersion_new,sysVersion_dev,softVersion_dev,dfu_file,dfu_en,dfu_wr_stat,dfu_data_blocknum,dfu_data_blocklen,dfu_file_len " +
|
| | | ",db_ram_db.tb_fbs9100_state.dev_version" +
|
| | | " from db_ram_db.tb_fbs9100s_dfu_state,db_battinf.tb_battinf,db_ram_db.tb_fbs9100_state " +
|
| | | " where db_ram_db.tb_fbs9100s_dfu_state.dev_id=db_battinf.tb_battinf.fBSDeviceId " +
|
| | | " and db_ram_db.tb_fbs9100s_dfu_state.dev_id=db_ram_db.tb_fbs9100_state.dev_id " +
|
| | | " and dfu_en=1";
|
| | | List list=DAOHelper.executeQuery(sql, DBUtil.getConn(), null , new CallBack() {
|
| | |
|
| | | public List getResults(ResultSet rs) {
|
| | |
| | | dfu.setDfu_en(rs.getInt("dfu_en"));
|
| | | dfu.setDfu_wr_stat(rs.getInt("dfu_wr_stat"));
|
| | | dfu.setDfu_data_blocknum(rs.getInt("dfu_data_blocknum"));
|
| | | dfu.setDfu_data_blocksum(rs.getInt("dfu_data_blocksum"));
|
| | | dfu.setDfu_file_len(rs.getInt("dfu_file_len"));
|
| | | dfu.setDfu_data_blocklen(rs.getInt("dfu_data_blocklen"));
|
| | | dfu.setStationName(rs.getString("stationName"));
|
| | | dfu.setStationId(rs.getString("stationId"));
|
| | | dfu.setfBSDeviceName(rs.getString("fBSDeviceName"));
|
| | | dfu.setNote(rs.getString("dev_version"));
|
| | | list.add(dfu);
|
| | | }
|
| | | } catch (SQLException e) {
|
| | |
| | | dfu.setDfu_en(rs.getInt("dfu_en"));
|
| | | dfu.setDfu_wr_stat(rs.getInt("dfu_wr_stat"));
|
| | | dfu.setDfu_data_blocknum(rs.getInt("dfu_data_blocknum"));
|
| | | dfu.setDfu_data_blocksum(rs.getInt("dfu_data_blocksum"));
|
| | | dfu.setDfu_file_len(rs.getInt("dfu_file_len"));
|
| | | dfu.setDfu_data_blocklen(rs.getInt("dfu_data_blocklen"));
|
| | | list.add(dfu);
|
| | | }
|
| | |
| | | return listAll;
|
| | | }
|
| | |
|
| | | //升级界面点击添加的时候查询出设备对应的版本号
|
| | | public List serchByInfo(Object obj) {
|
| | | return null;
|
| | | }
|
| | | public static void main(String[] args) {
|
| | | Fbs9100s_dfu_stateImpl fimpl=new Fbs9100s_dfu_stateImpl();
|
| | | List list=new ArrayList();
|
| | | list.add(910000002);
|
| | | list.add(910000577);
|
| | | list.add(910000534);
|
| | | list.add(910000001);
|
| | | /*list.add(910000577);
|
| | | list.add(910000534);*/
|
| | | BattInf binf=new BattInf();
|
| | | binf.setNum(1);
|
| | | binf.setStationName("湖北省");
|
| | | binf.setStationName("广西省");
|
| | |
|
| | | /*List<Fbs9100s_dfu_state> listAll=fimpl.serchByCondition(list);
|
| | | for (Fbs9100s_dfu_state dfu : listAll) {
|
| | |
| | | System.out.println(binf.getStationName3()+" "+binf.getFBSDeviceId());
|
| | | }*/
|
| | |
|
| | | boolean bl=fimpl.addPro(binf);
|
| | | System.out.println(bl);
|
| | | /*boolean bl=fimpl.addPro(binf);
|
| | | System.out.println(bl);*/
|
| | | /*List<BattInf> listAll=fimpl.serchInserStation(binf);
|
| | | for (BattInf b : listAll) {
|
| | | System.out.println(b.getStationName3()+" "+b.getFBSDeviceId());
|
| | | }*/
|
| | | }
|
| | | System.out.println(listAll.size());*/
|
| | | /*List<Fbs9100s_dfu_state> listAll=fimpl.searchAll();
|
| | | for (Fbs9100s_dfu_state dfu : listAll) {
|
| | | System.out.println(dfu);
|
| | | }*/
|
| | | List<Fbs9100s_dfu_state> listAll=fimpl.searchAll();
|
| | | for (Fbs9100s_dfu_state dfu : listAll) {
|
| | | System.out.println(dfu);
|
| | | }
|
| | | System.out.println(listAll.size());
|
| | | }
|
| | | }
|