|
@ -24,14 +24,15 @@ import org.apache.poi.poifs.filesystem.POIFSFileSystem;
|
|
|
import org.jsoup.Jsoup;
|
|
|
import org.jsoup.nodes.Document;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.core.io.ClassPathResource;
|
|
|
import org.springframework.core.io.Resource;
|
|
|
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
|
|
|
import org.springframework.core.io.support.ResourcePatternResolver;
|
|
|
import org.springframework.http.MediaType;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
import java.io.ByteArrayInputStream;
|
|
|
import java.io.File;
|
|
|
import java.io.IOException;
|
|
|
import java.io.OutputStream;
|
|
|
import java.io.*;
|
|
|
import java.net.URLEncoder;
|
|
|
import java.util.*;
|
|
|
|
|
@ -1248,7 +1249,26 @@ public class DoorOrderController extends BaseController {
|
|
|
String pathName = DoorOrderController.class.getResource("/").getPath().replaceFirst("/", "");
|
|
|
pathName = pathName.replace("target/classes/", "src/main/resources/conclusion.mht");
|
|
|
Document doc = Jsoup.parse(new File(pathName), "UTF-8");
|
|
|
String html = doorOrderService.handleData(doc,orderId);
|
|
|
|
|
|
String txt = "";
|
|
|
ResourcePatternResolver resolver = new PathMatchingResourcePatternResolver();
|
|
|
Resource[] resources = resolver.getResources("/conclusion.mht");
|
|
|
Resource resource = resources[0];
|
|
|
//获得文件流,因为在jar文件中,不能直接通过文件资源路径拿到文件,但是可以在jar包中拿到文件流
|
|
|
InputStream stream = resource.getInputStream();
|
|
|
StringBuilder buffer = new StringBuilder();
|
|
|
byte[] bytes = new byte[1024];
|
|
|
try {
|
|
|
for (int n; (n = stream.read(bytes)) != -1; ) {
|
|
|
buffer.append(new String(bytes, 0, n));
|
|
|
}
|
|
|
} catch (IOException e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
txt = buffer.toString();
|
|
|
|
|
|
Document aa = Jsoup.parse(txt,"UTF-8");
|
|
|
String html = doorOrderService.handleData(aa,orderId);
|
|
|
byte b[] = html.getBytes();
|
|
|
ByteArrayInputStream bais = new ByteArrayInputStream(b);
|
|
|
POIFSFileSystem poifs = new POIFSFileSystem();
|