From 8577a11e5093871b2b5d6988431e7e22e76d43e6 Mon Sep 17 00:00:00 2001 From: value <z1292839451@163.com> Date: 星期一, 29 四月 2024 01:46:09 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- inspect-server/src/main/java/com/yuanchu/mom/controller/InsReportController.java | 73 ++++++++++++++++++++++++++++++------ 1 files changed, 60 insertions(+), 13 deletions(-) diff --git a/inspect-server/src/main/java/com/yuanchu/mom/controller/InsReportController.java b/inspect-server/src/main/java/com/yuanchu/mom/controller/InsReportController.java index 7532034..06e17de 100644 --- a/inspect-server/src/main/java/com/yuanchu/mom/controller/InsReportController.java +++ b/inspect-server/src/main/java/com/yuanchu/mom/controller/InsReportController.java @@ -1,29 +1,33 @@ package com.yuanchu.mom.controller; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import com.yuanchu.mom.annotation.ValueAuth; import com.yuanchu.mom.dto.ReportPageDto; -import com.yuanchu.mom.dto.SampleOrderDto; +import com.yuanchu.mom.exception.ErrorException; import com.yuanchu.mom.service.InsReportService; import com.yuanchu.mom.utils.JackSonUtil; import com.yuanchu.mom.vo.Result; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; -import lombok.AllArgsConstructor; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; +import javax.annotation.Resource; +import java.io.File; +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; import java.util.Map; -@AllArgsConstructor @RestController @RequestMapping("/insReport") @Api("妫�楠屾姤鍛�") public class InsReportController { + @Resource private InsReportService insReportService; + + @Value("${wordUrl}") + private String wordUrl; @ApiOperation(value = "鏌ヨ妫�楠屾姤鍛婃暟鎹�") @PostMapping("/pageInsReport") @@ -33,11 +37,54 @@ return Result.success(insReportService.pageInsReport(page, reportPageDto)); } - @ApiOperation(value = "Word杞琀TML") - @PostMapping("/wordToHtml") - @ValueAuth - public Result wordToHtml(String path) { - return Result.success("杞崲鎴愬姛", insReportService.wordToHtml(path)); + @ApiOperation(value = "鎶ュ憡涓婁紶") + @PostMapping("/inReport") + public Result inReport(MultipartFile file, Integer id) { + String urlString; + String pathName; + try { + String path = wordUrl; + File realpath = new File(path); + if (!realpath.exists()) { + realpath.mkdirs(); + } + pathName = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyMMddHHmmss")) + "_" + file.getOriginalFilename(); + urlString = realpath + "/" + pathName; + file.transferTo(new File(urlString)); + return Result.success(insReportService.inReport("/word/"+pathName, id)); + } catch (Exception e) { + throw new ErrorException("鏂囦欢涓婁紶澶辫触"); + } + } + + @ApiOperation(value = "鎶ュ憡杩樺師") + @PostMapping("/upReportUrl") + public Result upReportUrl(Integer id) { + return Result.success(insReportService.upReportUrl(id)); + } + + @ApiOperation(value = "鎶ュ憡鍦ㄧ嚎缂栧埗") + @GetMapping("/upReportFile") + public Result upReportFile() { + return Result.success(); + } + + @ApiOperation(value = "鎻愪氦") + @PostMapping("/writeReport") + public Result writeReport(Integer id) { + return Result.success(insReportService.writeReport(id)); + } + + @ApiOperation(value = "瀹℃牳") + @PostMapping("/examineReport") + public Result examineReport(Integer id, Integer isExamine, String examineTell) { + return Result.success(insReportService.examineReport(id, isExamine, examineTell)); + } + + @ApiOperation(value = "鎵瑰噯") + @PostMapping("/ratifyReport") + public Result ratifyReport(Integer id, Integer isRatify, String ratifyTell) { + return Result.success(insReportService.ratifyReport(id, isRatify, ratifyTell)); } } -- Gitblit v1.9.3