测试静态资源路径
continuous-integration/drone/push Build is passing Details

于相涌/robot_optimize
YXY 1 year ago
parent 9a045d3d12
commit 5c022df8a8

@ -7,6 +7,7 @@ import com.ruoyi.flyingbook.domain.edi.EdiResponseVo;
import com.ruoyi.flyingbook.domain.edi.SyncToTableRequest;
import com.ruoyi.flyingbook.edi.EdiOperateService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.io.FileUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;
@ -38,21 +39,35 @@ public class EdiController extends BaseController {
}
@RequestMapping("/createPdf")
public void exportPdfDemo(@RequestParam("param")String param) throws Exception{
public void exportPdfDemo(@RequestParam("param") String param) throws Exception {
System.out.println(System.getProperty("user.dir"));
ClassPathResource classPathResource = new ClassPathResource("photo/title.png");
InputStream inputStream = null;
try {
Class<? extends InputStream> aClass = classPathResource.getInputStream().getClass();
System.out.println(aClass.getName());
}catch (Exception e){
log.error("",e);
inputStream = classPathResource.getInputStream();
File inuModel = new File("/");
FileUtils.copyToFile(inputStream, inuModel);
System.out.println(inuModel.getName());
} catch (Exception e) {
log.error("", e);
}finally {
if (inputStream != null){
inputStream.close();
}
}
Resource resource = resourceLoader.getResource("classpath:photo/title.png");
InputStream inputStream2 = null;
try {
Class<? extends InputStream> aClass = resource.getInputStream().getClass();
System.out.println(aClass.getName());
}catch (Exception e){
log.error("",e);
inputStream2 = resource.getInputStream();
File inuModel = new File("/");
FileUtils.copyToFile(inputStream, inuModel);
System.out.println(inuModel.getName());
} catch (Exception e) {
log.error("", e);
}finally {
if (inputStream2 != null){
inputStream2.close();
}
}
// CourseFeedbackTemplateDto resultDTO = new CourseFeedbackTemplateDto();
// resultDTO.setProgram("program");

Loading…
Cancel
Save