|
@@ -9,8 +9,14 @@ import com.project.zcustom.service.unit.ILargePlanService;
|
|
|
import com.project.zcustom.service.unit.ILargeProjectService;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
+import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
+import java.io.IOException;
|
|
|
+import java.nio.file.Files;
|
|
|
+import java.nio.file.Path;
|
|
|
+import java.nio.file.Paths;
|
|
|
import java.util.Date;
|
|
|
|
|
|
@RestController
|
|
@@ -24,6 +30,9 @@ public class PlatProjectCheckController extends BaseController {
|
|
|
|
|
|
private final ILargePlanService largePlanService;
|
|
|
|
|
|
+ @Value("${upload.directory}")
|
|
|
+ private String uploadDirectory;
|
|
|
+
|
|
|
/**
|
|
|
* 问题数量
|
|
|
*/
|
|
@@ -52,8 +61,8 @@ public class PlatProjectCheckController extends BaseController {
|
|
|
* 近一周问题列表
|
|
|
*/
|
|
|
@GetMapping("/getIssueListLastWeek/{appOrg}")
|
|
|
- public AjaxResult getIssueListLastWeek(@PathVariable String appOrg, @RequestParam(required = false) Date date) {
|
|
|
- return AjaxResult.success("查询成功", largeIssueService.getIssueListLastWeek(appOrg, date));
|
|
|
+ public AjaxResult getIssueListLastWeek(@PathVariable String appOrg, @RequestParam(required = false, name = "day") Date day) {
|
|
|
+ return AjaxResult.success("查询成功", largeIssueService.getIssueListLastWeek(appOrg, day));
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -76,7 +85,21 @@ public class PlatProjectCheckController extends BaseController {
|
|
|
* 新增问题
|
|
|
* */
|
|
|
@PostMapping("add")
|
|
|
- public AjaxResult add(@RequestBody LargeIssue entity) {
|
|
|
+ public AjaxResult add(@RequestBody LargeIssue entity, @RequestParam("file") MultipartFile multipartFile) {
|
|
|
+ if (!multipartFile.isEmpty()) {
|
|
|
+ try {
|
|
|
+ String originalFilename = multipartFile.getOriginalFilename();
|
|
|
+ Path path = Paths.get(uploadDirectory, originalFilename);
|
|
|
+
|
|
|
+ Files.createDirectories(path.getParent());
|
|
|
+ multipartFile.transferTo(path);
|
|
|
+ entity.setImagePath(path.toString());
|
|
|
+
|
|
|
+ } catch (IOException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ return AjaxResult.error("文件上传失败");
|
|
|
+ }
|
|
|
+ }
|
|
|
return toAjax(largeIssueService.save(entity));
|
|
|
}
|
|
|
|