|
@@ -2,8 +2,14 @@ package io.renren.modules.dataSet.upload;
|
|
|
|
|
|
import com.alibaba.excel.EasyExcel;
|
|
import com.alibaba.excel.EasyExcel;
|
|
import com.alibaba.fastjson.JSON;
|
|
import com.alibaba.fastjson.JSON;
|
|
|
|
+import com.google.gson.Gson;
|
|
import io.renren.common.exception.RRException;
|
|
import io.renren.common.exception.RRException;
|
|
|
|
+import io.renren.common.utils.MinIoUtils;
|
|
import io.renren.common.utils.R;
|
|
import io.renren.common.utils.R;
|
|
|
|
+import io.renren.modules.dataSet.enumeration.DataSetType;
|
|
|
|
+import io.renren.modules.sys.entity.dataset.DataSet;
|
|
|
|
+import io.renren.modules.sys.service.CategoryService;
|
|
|
|
+import io.renren.modules.sys.service.DataSetService;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Controller;
|
|
import org.springframework.stereotype.Controller;
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.bind.annotation.*;
|
|
@@ -38,6 +44,13 @@ public class UpLoadController {
|
|
*/
|
|
*/
|
|
@Autowired
|
|
@Autowired
|
|
private UpLoadService upLoadService;
|
|
private UpLoadService upLoadService;
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ private DataSetService dataSetService;
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ private CategoryService categoryService;
|
|
|
|
+
|
|
@PostMapping("upload")
|
|
@PostMapping("upload")
|
|
@ResponseBody
|
|
@ResponseBody
|
|
public R uploadExcel(MultipartFile file) throws IOException {
|
|
public R uploadExcel(MultipartFile file) throws IOException {
|
|
@@ -50,20 +63,32 @@ public class UpLoadController {
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @RequestMapping("uploadFile")
|
|
|
|
+ public R uploadFile(@RequestPart("file") MultipartFile file, @RequestParam("dataSet") String dataSetJson) throws Exception {
|
|
|
|
+ MinIoUtils.uploadMultipartFile(file, DataSetType.FILE_DATASET.getBucketName(), file.getOriginalFilename());
|
|
|
|
+ DataSet dataSet = new Gson().fromJson(dataSetJson, DataSet.class);
|
|
|
|
+ dataSet.setCreateTime(new Date());
|
|
|
|
+ dataSet.setCategoryId(categoryService.getByName(DataSetType.FILE_DATASET.getClassificationName()));
|
|
|
|
+ dataSetService.save(dataSet);
|
|
|
|
+ return R.ok();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
@RequestMapping("uploadcsv")
|
|
@RequestMapping("uploadcsv")
|
|
public R uploadCSV(MultipartFile file) throws Exception {
|
|
public R uploadCSV(MultipartFile file) throws Exception {
|
|
System.out.println(file);
|
|
System.out.println(file);
|
|
Map map = upLoadService.uploadCSV(file);
|
|
Map map = upLoadService.uploadCSV(file);
|
|
// System.out.println(map);
|
|
// System.out.println(map);
|
|
- return R.ok().put("data",map);
|
|
|
|
|
|
+ return R.ok().put("data", map);
|
|
}
|
|
}
|
|
|
|
+
|
|
@RequestMapping("getstapre")
|
|
@RequestMapping("getstapre")
|
|
- public R getstaticprecontent(@RequestBody Map map){
|
|
|
|
|
|
+ public R getstaticprecontent(@RequestBody Map map) {
|
|
|
|
|
|
final List getstaticprecontent = upLoadService.getstaticprecontent(map);
|
|
final List getstaticprecontent = upLoadService.getstaticprecontent(map);
|
|
// System.out.println(datas);
|
|
// System.out.println(datas);
|
|
|
|
|
|
// subeqpdemoService.getPrecontent(subeqpments);
|
|
// subeqpdemoService.getPrecontent(subeqpments);
|
|
- return R.ok().put("data",getstaticprecontent);
|
|
|
|
|
|
+ return R.ok().put("data", getstaticprecontent);
|
|
}
|
|
}
|
|
}
|
|
}
|