From f360d164d924eddb4ca5ee914ed5879f972cb47b Mon Sep 17 00:00:00 2001
From: 李林 <z1292839451@163.com>
Date: 星期六, 06 四月 2024 17:48:13 +0800
Subject: [PATCH] 检验任务的缺漏代码
---
inspect-server/src/main/java/com/yuanchu/mom/service/impl/InsReportServiceImpl.java | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 50 insertions(+), 0 deletions(-)
diff --git a/inspect-server/src/main/java/com/yuanchu/mom/service/impl/InsReportServiceImpl.java b/inspect-server/src/main/java/com/yuanchu/mom/service/impl/InsReportServiceImpl.java
index d114de5..c211dfd 100644
--- a/inspect-server/src/main/java/com/yuanchu/mom/service/impl/InsReportServiceImpl.java
+++ b/inspect-server/src/main/java/com/yuanchu/mom/service/impl/InsReportServiceImpl.java
@@ -1,10 +1,30 @@
package com.yuanchu.mom.service.impl;
+import com.alibaba.fastjson.JSON;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.spire.doc.Document;
+import com.spire.doc.FileFormat;
+import com.yuanchu.mom.common.GetLook;
+import com.yuanchu.mom.common.PrintChina;
+import com.yuanchu.mom.dto.InsOrderPlanDTO;
+import com.yuanchu.mom.dto.ReportPageDto;
+import com.yuanchu.mom.dto.SampleOrderDto;
+import com.yuanchu.mom.exception.ErrorException;
import com.yuanchu.mom.pojo.InsReport;
import com.yuanchu.mom.service.InsReportService;
import com.yuanchu.mom.mapper.InsReportMapper;
+import com.yuanchu.mom.utils.QueryWrappers;
+import lombok.AllArgsConstructor;
+import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
/**
* @author Administrator
@@ -15,6 +35,36 @@
public class InsReportServiceImpl extends ServiceImpl<InsReportMapper, InsReport>
implements InsReportService{
+ @Resource
+ private GetLook getLook;
+
+ @Resource
+ private InsReportMapper insReportMapper;
+
+ @Value("${wordUrl}")
+ private String wordUrl;
+
+ @Override
+ public Map<String, Object> pageInsReport(Page page, ReportPageDto reportPageDto) {
+ Map<String, Object> map = new HashMap<>();
+ map.put("head", PrintChina.printChina(ReportPageDto.class));
+ Map<String, Integer> map1 = getLook.selectPowerByMethodAndUserId("pageInsReport");
+ if (map1.get("look") == 1) reportPageDto.setCreateUser(map1.get("userId"));
+ map.put("body", insReportMapper.pageInsReport(page, QueryWrappers.queryWrappers(reportPageDto)));
+ return map;
+ }
+
+ @Override
+ public String wordToHtml(String path) {
+ try(ByteArrayOutputStream outputStream = new ByteArrayOutputStream()) {
+ Document document = new Document();
+ document.loadFromFile(path.replace("/word", wordUrl));
+ document.saveToFile(outputStream, FileFormat.Html);
+ return outputStream.toString();
+ } catch (Exception e) {
+ throw new ErrorException("杞崲澶辫触");
+ }
+ }
}
--
Gitblit v1.9.3