|
@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
5
|
5
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
6
|
6
|
import com.yunzhi.demo.common.BaseController;
|
7
|
7
|
import com.yunzhi.demo.common.Constants;
|
|
8
|
+import com.yunzhi.demo.common.DateUtils;
|
8
|
9
|
import com.yunzhi.demo.common.ResponseBean;
|
9
|
10
|
import com.yunzhi.demo.entity.TaPerson;
|
10
|
11
|
import com.yunzhi.demo.entity.TaStudent;
|
|
@@ -16,14 +17,14 @@ import io.swagger.annotations.ApiParam;
|
16
|
17
|
import org.slf4j.Logger;
|
17
|
18
|
import org.slf4j.LoggerFactory;
|
18
|
19
|
import org.springframework.beans.factory.annotation.Autowired;
|
19
|
|
-import org.springframework.web.bind.annotation.PathVariable;
|
20
|
|
-import org.springframework.web.bind.annotation.RequestBody;
|
21
|
|
-import org.springframework.web.bind.annotation.RequestMapping;
|
22
|
|
-import org.springframework.web.bind.annotation.RequestMethod;
|
23
|
|
-import org.springframework.web.bind.annotation.RequestParam;
|
|
20
|
+import org.springframework.web.bind.annotation.*;
|
24
|
21
|
import com.yunzhi.demo.service.ITaTestLogService;
|
25
|
22
|
import com.yunzhi.demo.entity.TaTestLog;
|
26
|
|
-import org.springframework.web.bind.annotation.RestController;
|
|
23
|
+import org.springframework.web.multipart.MultipartFile;
|
|
24
|
+
|
|
25
|
+import java.io.File;
|
|
26
|
+import java.time.LocalDateTime;
|
|
27
|
+import java.util.zip.ZipFile;
|
27
|
28
|
|
28
|
29
|
/**
|
29
|
30
|
* <p>
|
|
@@ -108,6 +109,20 @@ public class TaTestLogController extends BaseController {
|
108
|
109
|
}
|
109
|
110
|
}
|
110
|
111
|
|
|
112
|
+
|
|
113
|
+ public ResponseBean uploadZip(@RequestPart("schoolId") String schoolId,
|
|
114
|
+ @RequestPart("file") MultipartFile multipartFile) throws Exception {
|
|
115
|
+ LocalDateTime now = LocalDateTime.now();
|
|
116
|
+ String prefix = String.format("test-%s-%s", schoolId, DateUtils.toString(now, "yyyy-MM-dd"));
|
|
117
|
+ File file = File.createTempFile(prefix, "zip");
|
|
118
|
+ file.deleteOnExit();
|
|
119
|
+
|
|
120
|
+ multipartFile.transferTo(file);
|
|
121
|
+ ZipFile zf = new ZipFile(file);
|
|
122
|
+
|
|
123
|
+ return ResponseBean.success(null);
|
|
124
|
+ }
|
|
125
|
+
|
111
|
126
|
/**
|
112
|
127
|
* 根据id删除对象
|
113
|
128
|
* @param id 实体ID
|