update
This commit is contained in:
@@ -16,16 +16,22 @@ import org.jeecg.common.aspect.annotation.AutoLog;
|
|||||||
import org.jeecg.common.system.base.controller.JeecgController;
|
import org.jeecg.common.system.base.controller.JeecgController;
|
||||||
import org.jeecg.common.system.query.QueryGenerator;
|
import org.jeecg.common.system.query.QueryGenerator;
|
||||||
import org.jeecg.common.system.util.JwtUtil;
|
import org.jeecg.common.system.util.JwtUtil;
|
||||||
|
import org.jeecg.common.util.CommonUtils;
|
||||||
|
import org.jeecg.common.util.oConvertUtils;
|
||||||
import org.jeecg.modules.database.constant.ExperimentStatus;
|
import org.jeecg.modules.database.constant.ExperimentStatus;
|
||||||
import org.jeecg.modules.database.entity.*;
|
import org.jeecg.modules.database.entity.*;
|
||||||
import org.jeecg.modules.database.service.*;
|
import org.jeecg.modules.database.service.*;
|
||||||
import org.jeecg.modules.system.entity.SysUser;
|
import org.jeecg.modules.system.entity.SysUser;
|
||||||
import org.jeecg.modules.system.service.ISysUserService;
|
import org.jeecg.modules.system.service.ISysUserService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
import org.springframework.web.multipart.MultipartHttpServletRequest;
|
||||||
import org.springframework.web.servlet.ModelAndView;
|
import org.springframework.web.servlet.ModelAndView;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Description: 试验管理
|
* @Description: 试验管理
|
||||||
@@ -38,6 +44,9 @@ import java.util.*;
|
|||||||
@RequestMapping("/database/experiment")
|
@RequestMapping("/database/experiment")
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class ExperimentController extends JeecgController<Experiment, IExperimentService> {
|
public class ExperimentController extends JeecgController<Experiment, IExperimentService> {
|
||||||
|
|
||||||
|
@Value(value = "${jeecg.uploadType}")
|
||||||
|
private String uploadType;
|
||||||
@Autowired
|
@Autowired
|
||||||
private IExperimentService experimentService;
|
private IExperimentService experimentService;
|
||||||
@Autowired
|
@Autowired
|
||||||
@@ -63,6 +72,8 @@ public class ExperimentController extends JeecgController<Experiment, IExperimen
|
|||||||
private IExperimentDeviationEquipmentService experimentDeviationEquipmentService;
|
private IExperimentDeviationEquipmentService experimentDeviationEquipmentService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private IExperimentIrradiationBoardService experimentIrradiationBoardService;
|
private IExperimentIrradiationBoardService experimentIrradiationBoardService;
|
||||||
|
@Autowired
|
||||||
|
private IExperimentFileService experimentFileService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分页列表查询
|
* 分页列表查询
|
||||||
@@ -121,7 +132,6 @@ public class ExperimentController extends JeecgController<Experiment, IExperimen
|
|||||||
return Result.OK("添加成功!");
|
return Result.OK("添加成功!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 编辑
|
* 编辑
|
||||||
*
|
*
|
||||||
@@ -258,4 +268,37 @@ public class ExperimentController extends JeecgController<Experiment, IExperimen
|
|||||||
return super.importExcel(request, response, Experiment.class);
|
return super.importExcel(request, response, Experiment.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "试验管理-上传试验文件")
|
||||||
|
@PostMapping(value = "/upload")
|
||||||
|
public Result<?> upload(HttpServletRequest request, HttpServletResponse response) throws Exception {
|
||||||
|
Result<ExperimentFile> result = new Result<>();
|
||||||
|
String fileType = request.getParameter("fileType");
|
||||||
|
if (StringUtils.isBlank(fileType)) {
|
||||||
|
fileType = "其他";
|
||||||
|
}
|
||||||
|
|
||||||
|
MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
|
||||||
|
// 获取上传文件对象
|
||||||
|
MultipartFile file = multipartRequest.getFile("file");
|
||||||
|
|
||||||
|
//update-begin-author:taoyan date:20200814 for:文件上传改造
|
||||||
|
String savePath = CommonUtils.upload(file, "experiment_file", uploadType);
|
||||||
|
|
||||||
|
ExperimentFile ossFile = new ExperimentFile();
|
||||||
|
ossFile.setFileName(file.getOriginalFilename());
|
||||||
|
ossFile.setFileUrl(savePath);
|
||||||
|
ossFile.setFileType(fileType);
|
||||||
|
experimentFileService.save(ossFile);
|
||||||
|
result.setResult(ossFile);
|
||||||
|
|
||||||
|
if (oConvertUtils.isNotEmpty(savePath)) {
|
||||||
|
result.setMessage(savePath);
|
||||||
|
result.setSuccess(true);
|
||||||
|
} else {
|
||||||
|
result.setMessage("上传失败!");
|
||||||
|
result.setSuccess(false);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user