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

Loading…
Cancel
Save