...
This commit is contained in:
@@ -28,6 +28,7 @@ import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import sun.misc.BASE64Encoder;
|
||||
@@ -169,10 +170,13 @@ public class ExportModelController extends BaseController {
|
||||
} else {
|
||||
rtfPath = "file/reportModel.docx";
|
||||
}
|
||||
|
||||
ClassPathResource rtfPathResource=null;
|
||||
ClassPathResource picPathResource=null;
|
||||
try {
|
||||
rtfPath = getClass().getClassLoader().getResource(rtfPath).getPath();
|
||||
picPath = getClass().getClassLoader().getResource(picPath).getPath();
|
||||
rtfPathResource = new ClassPathResource(rtfPath);
|
||||
picPathResource = new ClassPathResource(picPath);
|
||||
// rtfPath = getClass().getClassLoader().getResource(rtfPath).getPath();
|
||||
// picPath = getClass().getClassLoader().getResource(picPath).getPath();
|
||||
rtfPath = rtfPath.replaceAll("%20", " ");
|
||||
picPath = picPath.replaceAll("%20", " ");
|
||||
} catch (Exception e1) {
|
||||
@@ -189,10 +193,15 @@ public class ExportModelController extends BaseController {
|
||||
if (!tmpfile.exists()) {
|
||||
return "pathfail"+rtfPath;
|
||||
}
|
||||
// File tmpfile = new File(rtfPath);
|
||||
// if (!tmpfile.exists()) {
|
||||
// return "pathfail";
|
||||
// }
|
||||
|
||||
InputStream ins = null;
|
||||
try {
|
||||
ins = new FileInputStream(rtfPath);
|
||||
// ins = new FileInputStream(rtfPath);
|
||||
ins = rtfPathResource.getInputStream();
|
||||
if (null != ins) {
|
||||
flagPath = true;
|
||||
}
|
||||
@@ -225,7 +234,8 @@ public class ExportModelController extends BaseController {
|
||||
InputStream inStream = null;
|
||||
byte[] data = null;
|
||||
try {
|
||||
inStream = new FileInputStream(new File(picPath));
|
||||
// inStream = new FileInputStream(new File(picPath));
|
||||
inStream = picPathResource.getInputStream();
|
||||
data = new byte[inStream.available()];
|
||||
inStream.read(data);
|
||||
} catch (FileNotFoundException e) {
|
||||
|
||||
Reference in New Issue
Block a user