package com.fgkj.actions; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.util.Date; import javax.servlet.http.HttpSession; import org.apache.struts2.ServletActionContext; import com.fgkj.dto.DLG_Progress; import com.fgkj.dto.ServiceModel; import com.fgkj.dto.User; import com.fgkj.dto.User_inf; import com.fgkj.services.FboDataUploadService; import com.fgkj.services.ResDataUploadService; import com.google.gson.Gson; public class ResDataUploadAction extends ActionUtil{ private String tableRowData; private int battgroupid; private File[] file; // 提交过来的file的名字 private String[] fileFileName; private String result; public String uploadResfile(){ User_inf user=(User_inf)ActionUtil.getUser(); if(user!=null){ HttpSession session = ActionUtil.getSession(); Gson gson = new Gson(); createFile(); String[][] tableRowDatas = gson .fromJson(tableRowData, String[][].class); //System.out.println(file.length + "---" + tableRowDatas.length); //uinf.setUId(1001); ResDataUploadService rdus=new ResDataUploadService(user, battgroupid, tableRowDatas, file, session); rdus.start(); } return SUCCESS; } // 停止上传 public String stopResUpload() { HttpSession session = ActionUtil.getSession(); DLG_Progress progress = (DLG_Progress) session.getAttribute("Resprogress"); if (progress != null) { progress.setJudge(false); ServiceModel model=new ServiceModel(); model.setCode(1); model.setData(model); result = ActionUtil.tojson(progress); } return SUCCESS; } // 查询进度 public String selectResprogress() { HttpSession session = ActionUtil.getSession(); DLG_Progress progress = (DLG_Progress) session.getAttribute("Resprogress"); // for(int i=0;i