| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.yuanchu.mom.annotation.ValueAuth; |
| | | import com.yuanchu.mom.annotation.ValueClassify; |
| | | import com.yuanchu.mom.dto.InsReportDto; |
| | | import com.yuanchu.mom.dto.ReportPageDto; |
| | | import com.yuanchu.mom.exception.ErrorException; |
| | | import com.yuanchu.mom.service.InsReportService; |
| | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.File; |
| | | import java.io.IOException; |
| | | import java.io.PrintWriter; |
| | | import java.time.LocalDateTime; |
| | | import java.time.format.DateTimeFormatter; |
| | |
| | | |
| | | @RestController |
| | | @RequestMapping("/insReport") |
| | | //@AllArgsConstructor |
| | | @Api("检验报告") |
| | | @Api(tags = "检验报告") |
| | | public class InsReportController { |
| | | |
| | | @Resource |
| | |
| | | @Value("${wordUrl}") |
| | | private String wordUrl; |
| | | |
| | | @ValueAuth |
| | | @ValueClassify("报告编制") |
| | | @ApiOperation(value = "查询检验报告数据") |
| | | @PostMapping("/pageInsReport") |
| | | public Result pageInsReport(@RequestBody Map<String, Object> data) throws Exception { |
| | |
| | | return Result.success(insReportService.pageInsReport(page, reportPageDto)); |
| | | } |
| | | |
| | | @ValueClassify("报告编制") |
| | | @ApiOperation(value = "报告上传") |
| | | @PostMapping("/inReport") |
| | | @ValueAuth |
| | | public Result inReport(MultipartFile file, Integer id) { |
| | | String urlString; |
| | | String pathName; |
| | |
| | | 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)); |
| | | return Result.success(insReportService.inReport("/word/" + pathName, id)); |
| | | } catch (Exception e) { |
| | | throw new ErrorException("文件上传失败"); |
| | | } |
| | | } |
| | | |
| | | @ValueClassify("报告编制") |
| | | @ApiOperation(value = "报告还原") |
| | | @PostMapping("/upReportUrl") |
| | | public Result upReportUrl(Integer id) { |
| | | return Result.success(insReportService.upReportUrl(id)); |
| | | } |
| | | @ValueClassify("报告编制") |
| | | |
| | | /*@ValueClassify("报告编制") |
| | | @ApiOperation(value = "报告在线编制") |
| | | @GetMapping("/upReportFile") |
| | | public Result upReportFile() { |
| | | return Result.success(); |
| | | } |
| | | }*/ |
| | | |
| | | @ValueClassify("报告编制") |
| | | @ApiOperation(value = "提交") |
| | | @PostMapping("/writeReport") |
| | | public Result writeReport(Integer id) { |
| | | return Result.success(insReportService.writeReport(id)); |
| | | } |
| | | |
| | | @ValueClassify("报告编制") |
| | | @ApiOperation(value = "审核") |
| | | @PostMapping("/examineReport") |
| | | public Result examineReport(Integer id, Integer isExamine, String examineTell) { |
| | | return Result.success(insReportService.examineReport(id, isExamine, examineTell)); |
| | | } |
| | | |
| | | @ValueClassify("报告编制") |
| | | @ApiOperation(value = "批准") |
| | | @PostMapping("/ratifyReport") |
| | | public Result ratifyReport(Integer id, Integer isRatify, String ratifyTell) { |
| | | return Result.success(insReportService.ratifyReport(id, isRatify, ratifyTell)); |
| | | public Result ratifyReport(Integer id, Integer isRatify, String ratifyTell,String sealUrl) { |
| | | return Result.success(insReportService.ratifyReport(id, isRatify, ratifyTell,sealUrl)); |
| | | } |
| | | |
| | | @RequestMapping("/onlyOffice/save") |
| | | @ValueAuth |
| | | public void saveFile(@RequestParam String fileName, HttpServletRequest request, HttpServletResponse response) { |
| | | PrintWriter writer = null; |
| | | try { |
| | |
| | | String body = scanner.hasNext() ? scanner.next() : ""; |
| | | JSONObject jsonObject = JSONObject.parseObject(body); |
| | | |
| | | System.out.println(jsonObject); |
| | | if (jsonObject.containsKey("url")) { |
| | | String jsonArray = jsonObject.get("lastsave").toString(); // 更新时间 |
| | | String fileUrl = jsonObject.get("url").toString(); // 更新文件url |
| | |
| | | writer.write("{\"error\":0}"); |
| | | } |
| | | } |
| | | |
| | | @ValueAuth |
| | | @ApiOperation(value = "报告批量下载") |
| | | @GetMapping("/downAll") |
| | | public Result downAll(String ids) { |
| | | return Result.success(insReportService.downAll(ids)); |
| | | } |
| | | |
| | | @ValueAuth |
| | | @ApiOperation(value = "报告批量上传") |
| | | @PostMapping("/upAll") |
| | | public Result upAll(MultipartFile file) throws IOException { |
| | | return Result.success(insReportService.upAll(file)); |
| | | } |
| | | |
| | | @ValueAuth |
| | | @ApiOperation(value = "查出该订单下每个样品下每个站点的检验次数") |
| | | @GetMapping("/getInsOrderStateCount") |
| | | public Result getInsOrderStateCount(Integer id,Integer sampleId){ |
| | | return Result.success(insReportService.getInsOrderStateCount(id,sampleId)); |
| | | } |
| | | |
| | | //取消2.26 |
| | | @ValueClassify("报告编制") |
| | | @ApiOperation(value = "判断是否生成总报告") |
| | | @PostMapping("/isReport") |
| | | public Result isReport(@RequestBody InsReportDto insReportDto) { |
| | | return Result.success(insReportService.isReport(insReportDto)); |
| | | } |
| | | } |