|
|
@@ -1,24 +1,13 @@
|
|
|
package com.xintong.visualinspection.service.impl;
|
|
|
|
|
|
-import java.io.BufferedInputStream;
|
|
|
-import java.io.BufferedOutputStream;
|
|
|
-import java.io.File;
|
|
|
-import java.io.FileInputStream;
|
|
|
-import java.io.FileOutputStream;
|
|
|
-import java.io.InputStream;
|
|
|
-import java.io.OutputStream;
|
|
|
-import java.text.SimpleDateFormat;
|
|
|
import java.util.ArrayList;
|
|
|
+import java.util.Collection;
|
|
|
import java.util.Comparator;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
+import java.util.Map.Entry;
|
|
|
|
|
|
-import javax.servlet.http.HttpServletRequest;
|
|
|
-import javax.servlet.http.HttpServletResponse;
|
|
|
-
|
|
|
-import org.jxls.common.Context;
|
|
|
-import org.jxls.util.JxlsHelper;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
@@ -29,8 +18,10 @@ import com.xintong.visualinspection.bean.User;
|
|
|
import com.xintong.visualinspection.dao.cluster.DepartmentDao;
|
|
|
import com.xintong.visualinspection.dao.cluster.UserInfoDao;
|
|
|
import com.xintong.visualinspection.dao.master.StatisticsDao;
|
|
|
+import com.xintong.visualinspection.dao.master.UserDao;
|
|
|
import com.xintong.visualinspection.service.BaseService;
|
|
|
import com.xintong.visualinspection.service.StatisticsService;
|
|
|
+import com.xintong.visualinspection.util.CacheUtil;
|
|
|
|
|
|
/**
|
|
|
* 文件名:StatisticsServiceImpl
|
|
|
@@ -186,58 +177,5 @@ public class StatisticsServiceImpl extends BaseService implements StatisticsServ
|
|
|
return new ArrayList<>(mapStationInfos.values());
|
|
|
|
|
|
}
|
|
|
-
|
|
|
- @Override
|
|
|
- public void getEmployeeCheckedInfo(StatisticsBean obj, HttpServletRequest req, HttpServletResponse resp) {
|
|
|
- // 检索数据
|
|
|
- List<StatisticsBo> listStatistic = getEmployeeCheckedInfo(obj);
|
|
|
- // 处理数据
|
|
|
- // todo ...
|
|
|
-
|
|
|
-
|
|
|
- String path = "D:/file20170606.xls";
|
|
|
- try (InputStream is = this.getClass().getResourceAsStream("/employee_order.xls")) {
|
|
|
- try (OutputStream os = new FileOutputStream(path)) {
|
|
|
- Context context = new Context();
|
|
|
- context.putVar("list", listStatistic);
|
|
|
- JxlsHelper.getInstance().processTemplate(is, os, context);
|
|
|
- }
|
|
|
- Thread.sleep(1000);
|
|
|
- // path是指欲下载的文件的路径。
|
|
|
- File file = new File(path);
|
|
|
- // 取得文件名。
|
|
|
- String filename = file.getName();
|
|
|
- // 以流的形式下载文件。
|
|
|
- InputStream bis = new BufferedInputStream(new FileInputStream(file));
|
|
|
- byte[] buffer = new byte[bis.available()];
|
|
|
- bis.read(buffer);
|
|
|
- bis.close();
|
|
|
- // 清空response
|
|
|
- resp.reset();
|
|
|
- // 设置response的Header
|
|
|
- resp.addHeader("Content-Disposition",
|
|
|
- "attachment;filename=" + new String(filename.getBytes("gb2312"), "ISO8859-1"));
|
|
|
- resp.addHeader("Content-Length", "" + file.length());
|
|
|
- OutputStream toClient = new BufferedOutputStream(resp.getOutputStream());
|
|
|
- resp.setContentType("application/vnd.ms-excel;charset=gb2312");
|
|
|
- toClient.write(buffer);
|
|
|
- toClient.flush();
|
|
|
- toClient.close();
|
|
|
- }catch(Exception e){
|
|
|
- logger.error(e.toString());
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public void getFeeStationCheckedScore(StatisticsBean obj, HttpServletRequest req, HttpServletResponse resp) {
|
|
|
- // TODO Auto-generated method stub
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public void getFeeStationCheckItemScore(StatisticsBean obj, HttpServletRequest req, HttpServletResponse resp) {
|
|
|
- // TODO Auto-generated method stub
|
|
|
-
|
|
|
- }
|
|
|
|
|
|
}
|