lxw
2021-03-13 30e0a6876452d5ca043d54dfbc72e17e2365f39f
Dev_FastAcquisition/src/com/fgkj/Impl/Dev_VolImpl.java
@@ -19,6 +19,7 @@
import com.fgkj.db.CallBack;
import com.fgkj.pojo.Dev_Vol;
import com.fgkj.service.Dev_VolService;
import com.sun.org.apache.bcel.internal.generic.DCMPG;
public class Dev_VolImpl implements BaseDAO,CallBack{
@@ -45,40 +46,15 @@
      // TODO Auto-generated method stub
      return false;
   }
    //读取全图
   @Override
   public List searchAll() {
      String filePath=getfilePath(1);
      List list=new ArrayList();
        try {
            File csv=new File(filePath);
            csv.setReadable(true);//设置可读
             csv.setWritable(true);//设置可写
             LineNumberReader br = new LineNumberReader(new FileReader(csv));
             String line = "";
             String everyLine = "";
             try {
                 while ((line = br.readLine()) != null) // 读取到的内容给line变量
                 {   if(br.getLineNumber() >= 1500&&br.getLineNumber() <= 101500) {
                     everyLine = line;
                      list.add(changeStrToDev_Vol(everyLine,1));
                     }
                 }
                 System.out.println("csv表格中所有行数:" + list.size());
             } catch (IOException e) {
                 e.printStackTrace();
             }
        } catch (Exception e) {
            System.out.println(e);
        }
      return list;
      return null;
   }
   //读取全图
   @Override
   public List serchByCondition(Object obj) {
      Dev_Vol dv=(com.fgkj.pojo.Dev_Vol) obj;
      String filePath=getfilePath(1);
      Dev_Vol dv=(Dev_Vol) obj;
      String filePath=getfilePath(dv.getFileName());
      List list=new ArrayList();
        try {
         
@@ -95,7 +71,7 @@
                      list.add(changeStrToDev_Vol(everyLine,1));
                     }
                 }
                 System.out.println("csv表格中所有行数:" + list.size());
                 //System.out.println("csv表格中所有行数:" + list.size());
             } catch (IOException e) {
                 e.printStackTrace();
             }
@@ -111,8 +87,9 @@
      return null;
   }
   //读取缩略图
   public List searchAbbreviation(){
      String filePath=getfilePath(0);
   public List searchAbbreviation(Object obj){
      Dev_Vol dc=(Dev_Vol) obj;
      String filePath=getfilePath(dc.getFileName());
      List list=new ArrayList();
        try {
         /*
@@ -141,7 +118,7 @@
                  everyLine = line;
                   list.add(changeStrToDev_Vol(everyLine,0));
                 }
                 System.out.println("csv表格中所有行数:" + list.size());
                 //System.out.println("csv表格中所有行数:" + list.size());
             } catch (IOException e) {
                 e.printStackTrace();
             }
@@ -166,7 +143,7 @@
      return dv;
   }
   //读取文件路径
   public static String getfilePath(int flag) {
   public static String getfilePath(String fileName) {
      //String path=this.getClass().getResource("/").getPath();
      String loadpath =ActionUtil.getSession().getServletContext().getRealPath("/");
        //String filePath = "D:/apache-tomcat-7.0.105/webapps/Dev_FastAcquisition/WEB-INF/电压2020_03_04_10_00_dgls.csv";
@@ -174,11 +151,12 @@
      String str=loadpath.substring(0, loadpath.lastIndexOf("Dev_FastAcquisition"));
      //System.out.println(str);
      String filePath=null;
      if(flag==0) {
          filePath=str+File.separator+"csv"+File.separator+"电压2020_03_04_10_00_dgls.csv";
      }else {
          filePath=str+File.separator+"csv"+File.separator+"电压2020_03_04_10_00.csv";
      }
//      if(flag==0) {
//          filePath=str+File.separator+"csv"+File.separator+"电压2020_03_04_10_00_dgls.csv";
//      }else {
//          filePath=str+File.separator+"csv"+File.separator+"电压2020_03_04_10_00.csv";
//      }
      filePath=str+File.separator+"csv"+File.separator+fileName;
      return filePath;
   }
}