|
@@ -1,5 +1,6 @@
|
|
package com.jpsoft.smart.modules.base.controller;
|
|
package com.jpsoft.smart.modules.base.controller;
|
|
|
|
|
|
|
|
+import cn.hutool.core.date.DateTime;
|
|
import com.github.pagehelper.Page;
|
|
import com.github.pagehelper.Page;
|
|
import com.jpsoft.smart.config.OSSConfig;
|
|
import com.jpsoft.smart.config.OSSConfig;
|
|
import com.jpsoft.smart.modules.base.dto.EmployeeInfoDTO;
|
|
import com.jpsoft.smart.modules.base.dto.EmployeeInfoDTO;
|
|
@@ -353,6 +354,11 @@ public class EmployeeInfoController {
|
|
|
|
|
|
List<EmployeeInfo> employeeInfos = employeeInfoService.findByArray(ids.split(","));
|
|
List<EmployeeInfo> employeeInfos = employeeInfoService.findByArray(ids.split(","));
|
|
|
|
|
|
|
|
+ String tmpdir = System.getProperty("java.io.tmpdir");
|
|
|
|
+ String tmpFilePath = tmpdir + File.separator + DateTime.now().toString("yyyyMMhddHHmmssSSS") + ".csv";
|
|
|
|
+
|
|
|
|
+ File tmpFile = new File(tmpFilePath);
|
|
|
|
+
|
|
if(employeeInfos.size()>0) {
|
|
if(employeeInfos.size()>0) {
|
|
for (EmployeeInfo employeeInfo : employeeInfos) {
|
|
for (EmployeeInfo employeeInfo : employeeInfos) {
|
|
csvBuilder.append(employeeInfo.getId() + ",");
|
|
csvBuilder.append(employeeInfo.getId() + ",");
|
|
@@ -363,8 +369,13 @@ public class EmployeeInfoController {
|
|
csvBuilder.append(localPath + "\\照片\\" + employeeInfo.getId() + photoExt + "\r\n");
|
|
csvBuilder.append(localPath + "\\照片\\" + employeeInfo.getId() + photoExt + "\r\n");
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ FileOutputStream fileOutput = new FileOutputStream(tmpFile);
|
|
|
|
+ byte[] data = csvBuilder.toString().getBytes("UTF-8");
|
|
|
|
+ fileOutput.write(data,0,data.length);
|
|
|
|
+ fileOutput.close();
|
|
|
|
+
|
|
Map<String, Object> fileMap = new HashMap<>();
|
|
Map<String, Object> fileMap = new HashMap<>();
|
|
- fileMap.put("fileData", csvBuilder.toString().getBytes("UTF-8"));
|
|
|
|
|
|
+ fileMap.put("localPath", tmpFilePath);
|
|
fileMap.put("fileName", "人员名单.csv");
|
|
fileMap.put("fileName", "人员名单.csv");
|
|
|
|
|
|
fileList.add(fileMap);
|
|
fileList.add(fileMap);
|
|
@@ -390,6 +401,10 @@ public class EmployeeInfoController {
|
|
|
|
|
|
OSSUtil.batchDownload(fileList,output);
|
|
OSSUtil.batchDownload(fileList,output);
|
|
|
|
|
|
|
|
+ if(tmpFile.exists()){
|
|
|
|
+ tmpFile.delete();
|
|
|
|
+ }
|
|
|
|
+
|
|
output.flush();
|
|
output.flush();
|
|
output.close();
|
|
output.close();
|
|
}
|
|
}
|