|
@@ -2,6 +2,7 @@ package com.jiayue.biz.service.impl;
|
|
|
|
|
|
import cn.hutool.core.io.FileUtil;
|
|
|
import cn.hutool.db.handler.StringHandler;
|
|
|
+import cn.hutool.http.HttpResponse;
|
|
|
import cn.hutool.poi.excel.ExcelReader;
|
|
|
import cn.hutool.poi.excel.ExcelUtil;
|
|
|
import com.jiayue.biz.domain.ProjectMenusOne;
|
|
@@ -19,7 +20,11 @@ import org.springframework.data.mongodb.core.query.Query;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
+import javax.servlet.ServletOutputStream;
|
|
|
+import javax.servlet.http.HttpServletResponse;
|
|
|
import java.io.*;
|
|
|
+import java.net.URLEncoder;
|
|
|
+import java.nio.charset.StandardCharsets;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
import java.util.UUID;
|
|
@@ -44,14 +49,28 @@ public class ProjectProgressServiceImpl implements ProjectProgressService {
|
|
|
return mongoTemplate.find(new Query(), ProjectProgress.class, "project_progress");
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ //下载模板
|
|
|
+ public void downloadProjectProgress(HttpServletResponse response, String id) {
|
|
|
+ File projectProgressDirFileNew = new File(projectProgressDir + id + File.separator + projectProgressBackNew);
|
|
|
+ File[] files = projectProgressDirFileNew.listFiles();
|
|
|
+ if (files.length > 0) {
|
|
|
+ com.jiayue.biz.util.FileUtil.downloadFile(files[0], response);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
/**
|
|
|
* 保存附件
|
|
|
+ *
|
|
|
* @param multipartFile 文件
|
|
|
- * @param name 文件夹名
|
|
|
+ * @param id 文件夹名
|
|
|
*/
|
|
|
@SneakyThrows
|
|
|
- public void saveAttachment(MultipartFile multipartFile, String name){
|
|
|
- File projectProgressDirFileNew = new File(projectProgressDir + name + File.separator + projectProgressAttachment);
|
|
|
+ public void saveAttachment(MultipartFile multipartFile, String id) {
|
|
|
+ File projectProgressDirFileNew = new File(projectProgressDir + id + File.separator + projectProgressAttachment);
|
|
|
if (!projectProgressDirFileNew.exists()) {
|
|
|
projectProgressDirFileNew.mkdirs();
|
|
|
}
|
|
@@ -61,16 +80,16 @@ public class ProjectProgressServiceImpl implements ProjectProgressService {
|
|
|
|
|
|
|
|
|
//项目进展解析
|
|
|
- public void projectProgressParse(MultipartFile multipartFile, String id, String name) {
|
|
|
+ public void projectProgressParse(MultipartFile multipartFile, String id) {
|
|
|
String fileName = multipartFile.getOriginalFilename();
|
|
|
File filed = new File(fileName);
|
|
|
try {
|
|
|
ExcelReader reader = ExcelUtil.getReader(filed);
|
|
|
List<List<Object>> read = reader.read();
|
|
|
//解析文件入库
|
|
|
- saveProjectProgress(read,id);
|
|
|
+ saveProjectProgress(read, id);
|
|
|
|
|
|
- File projectProgressDirFileNew = new File(projectProgressDir + name + File.separator + projectProgressBackNew);
|
|
|
+ File projectProgressDirFileNew = new File(projectProgressDir + id + File.separator + projectProgressBackNew);
|
|
|
if (!projectProgressDirFileNew.exists()) {
|
|
|
projectProgressDirFileNew.mkdirs();
|
|
|
}
|
|
@@ -93,9 +112,8 @@ public class ProjectProgressServiceImpl implements ProjectProgressService {
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
//项目进展解析文件入库
|
|
|
- public void saveProjectProgress(List<List<Object>> read,String id){
|
|
|
+ public void saveProjectProgress(List<List<Object>> read, String id) {
|
|
|
ArrayList<ProjectMenusOne> projectMenusOneList = new ArrayList<>();
|
|
|
|
|
|
String s1 = "";
|
|
@@ -155,7 +173,6 @@ public class ProjectProgressServiceImpl implements ProjectProgressService {
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
//设置二级
|
|
|
public ProjectMenusTow hTow(List<Object> objects) {
|
|
|
ProjectMenusTow projectMenusTow = new ProjectMenusTow();
|