whyclxw
2021-05-24 d6fd9d6ff45f9e941ae57b9389bb069336b2a96a
DyEnvir_system/src/com/partinsystem/udpall/impl/Partin_elemonitorImpl.java
@@ -4,6 +4,7 @@
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
import javax.swing.plaf.synth.SynthScrollPaneUI;
@@ -318,7 +319,37 @@
                  List row=new ArrayList();
                   row.add(ActionUtil.chageDateToString(rs.getTimestamp("record_time"), ActionUtil.time_yyyyMMddHHmmss).trim());
                   for (int i = 0; i < state.length; i++) {
                      String stateString=state[i];
                      if(stateString.contains("switching_value")) {
                         if(stateString.equals("switching_value_one")) {
                            int switching_value_one=rs.getInt("switching_value_one");
                             for (int j= 0; j < 32; j++) {
                                int a=getBinaryByInt(j, switching_value_one);
                              row.add(a);
                           }
                         }
                         if(stateString.equals("switching_value_two")) {
                            int switching_value_two=rs.getInt("switching_value_two");
                            for (int j= 0; j < 24; j++) {
                              row.add(getBinaryByInt(j, switching_value_two));
                           }
                         }
                         if(stateString.equals("switching_value_three")) {
                            int switching_value_three=rs.getInt("switching_value_three");
                            for (int j= 0; j < 20; j++) {
                              row.add(getBinaryByInt(j, switching_value_three));
                           }
                         }
                         if(stateString.equals("switching_value_four")) {
                            int switching_value_four=rs.getInt("switching_value_four");
                            for (int j= 0; j < 15; j++) {
                              row.add(getBinaryByInt(j, switching_value_four));
                           }
                         }
                      }else{
                     row.add(rs.getFloat(state[i]));
                     }
                  }
                  list.add(row);
               }
@@ -380,6 +411,11 @@
      //System.out.println(dateString);
      return dateString;
   }
   //整数转换为2进制后取每一位上面的值
   private static int getBinaryByInt(int position,int number){
      int Binary=number>>position&1;
      return Binary;
   }
   public static void main(String[] args) {
      Partin_elemonitorImpl pimpl=new Partin_elemonitorImpl();
      /*List<Partin_elemonitor> list=pimpl.searchAll();
@@ -391,7 +427,8 @@
      for (Partin_elemonitor p : list) {
         System.out.println(p);
      }*/
      changeDateFrom("tb_partin_elemonitor_2021_05_20");
      //changeDateFrom("tb_partin_elemonitor_2021_05_20");
      System.out.println(getBinaryByInt(8,256));
   }
}