wangwei 6 年之前
父节点
当前提交
23f9f0b435

+ 0 - 5
examcloud-core-examwork-base/src/main/java/cn/com/qmth/examcloud/core/examwork/base/util/BaseUtil.java

@@ -1,5 +0,0 @@
-package cn.com.qmth.examcloud.core.examwork.base.util;
-
-public class BaseUtil {
-
-}

+ 0 - 37
examcloud-core-examwork-base/src/main/java/cn/com/qmth/examcloud/core/examwork/base/util/ExportUtils.java

@@ -1,37 +0,0 @@
-package cn.com.qmth.examcloud.core.examwork.base.util;
-
-import java.net.URLEncoder;
-import java.util.Collection;
-
-import javax.servlet.ServletOutputStream;
-import javax.servlet.http.HttpServletResponse;
-
-import cn.com.qmth.examcloud.commons.base.util.excel.ExcelWriter;
-
-
-/*
- * excel导出工具
- */
-public class ExportUtils {
-
-    private static final String DEFALUT_CONTENT_TYPE = "application/vnd.ms-excel";
-
-    private static final String DEFALUT_EXT = ".xlsx";
-
-    public static void exportEXCEL(String fileName,Class<?> dataClass,
-                             Collection<?> dataset,HttpServletResponse response) {
-        try {
-        	
-            response.setHeader("Content-Disposition", "inline; filename="
-                    +URLEncoder.encode(fileName, "UTF-8") + DEFALUT_EXT);
-            response.setContentType(DEFALUT_CONTENT_TYPE);
-            ServletOutputStream outputStream = response.getOutputStream();
-            ExcelWriter excelExporter = new ExcelWriter(dataClass);
-            excelExporter.write("sheet1",dataset,outputStream);
-            outputStream.flush();
-            outputStream.close();
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
-    }
-}

+ 0 - 65
examcloud-core-examwork-base/src/main/java/cn/com/qmth/examcloud/core/examwork/base/util/ImportUtils.java

@@ -1,65 +0,0 @@
-package cn.com.qmth.examcloud.core.examwork.base.util;
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.OutputStream;
-
-import org.apache.commons.io.IOUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.web.multipart.MultipartFile;
-
-import cn.com.qmth.examcloud.commons.base.exception.ExamCloudRuntimeException;
-
-/**
- * Created by songyue on 17/7/14.
- */
-public final class ImportUtils {
-
-	protected static final Logger logger = LoggerFactory.getLogger(ImportUtils.class);
-
-	public static final String TEMP_FILE_IMP = "fileImport/";
-
-	public static final String TEMP_FILE_EXP = "fileExport/";
-
-	static {
-		init();
-	}
-
-	/**
-	 * 初始化文件夹
-	 */
-	public static void init() {
-		File temp_file_exp = new File(TEMP_FILE_EXP);
-		File temp_file_imp = new File(TEMP_FILE_IMP);
-		// 如果输出目标文件夹不存在,则创建
-		if (!temp_file_imp.exists()) {
-			temp_file_imp.mkdirs();
-		}
-		if (!temp_file_exp.exists()) {
-			temp_file_exp.mkdirs();
-		}
-	}
-
-	/**
-	 * 获取上传文件
-	 *
-	 * @param file
-	 * @return
-	 */
-	public static File getUploadFile(MultipartFile file) {
-		String fileName = file.getOriginalFilename();
-		File tempFile = new File(TEMP_FILE_IMP + fileName);
-		OutputStream os = null;
-		try {
-			os = new FileOutputStream(tempFile);
-			IOUtils.copyLarge(file.getInputStream(), os);
-		} catch (Exception e) {
-			throw new ExamCloudRuntimeException(e);
-		} finally {
-			IOUtils.closeQuietly(os);
-		}
-		return tempFile;
-	}
-
-}