|
|
@ -46,8 +46,12 @@ public class CsmCashReportRest { |
|
|
|
CsmCashLogService csmCashLogService; |
|
|
|
|
|
|
|
private static final String TEMPLATE_FILE_NAME="C:\\Users\\www19\\Desktop\\每日回款审核报告模版.docx"; |
|
|
|
@Value("${image.upload.path:static/upload/}") |
|
|
|
private String uploadPath; |
|
|
|
@Value("${image.url.prefix:http://127.0.0.1:8080/upload/}") |
|
|
|
private String urlPrefix; |
|
|
|
@Value("${image.xlsxtmpl:static/upload/}") |
|
|
|
private String xlsxtmplPath; |
|
|
|
|
|
|
|
|
|
|
|
@PostMapping("/save") |
|
|
@ -66,8 +70,12 @@ public class CsmCashReportRest { |
|
|
|
return csmCashReportService.getCsmReportByComSid(query); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 生成word |
|
|
|
* @throws Exception |
|
|
|
*/ |
|
|
|
@GetMapping(value = "/download") |
|
|
|
public void test() throws Exception{ |
|
|
|
public void download() throws Exception{ |
|
|
|
//获取模板文档
|
|
|
|
//InputStream ins = this.getClass().getResourceAsStream("C:\\Users\\www19\\Desktop\\每日回款审核报告.docx");
|
|
|
|
//填充数据
|
|
|
@ -81,16 +89,35 @@ public class CsmCashReportRest { |
|
|
|
params.put("yesterday",yesterdayList); |
|
|
|
XWPFDocument word = WordExportUtil.exportWord07(TEMPLATE_FILE_NAME,params); |
|
|
|
String newFileName = "每日回款审核报告" + dataDate + ".docx"; |
|
|
|
String url ="C:\\Users\\www19\\Desktop\\"+newFileName; |
|
|
|
//String url = urlPrefix + newFileName;
|
|
|
|
|
|
|
|
//log.setFileFullPath(url);
|
|
|
|
// csmCashLogService.update(log,new QueryWrapper<CsmCashLog>().eq("dataDate",dataDate));
|
|
|
|
FileOutputStream out = new FileOutputStream(new File(url)); |
|
|
|
// String url ="C:\\Users\\www19\\Desktop\\"+newFileName;
|
|
|
|
String url = urlPrefix + newFileName; |
|
|
|
if(null==log){ |
|
|
|
CsmCashLog log1=new CsmCashLog(); |
|
|
|
log1.setSid(UUID.randomUUID().toString()); |
|
|
|
log1.setFileFullPath(url); |
|
|
|
log1.setFileUrl(uploadPath + newFileName); |
|
|
|
csmCashLogService.insert(log1); |
|
|
|
}else{ |
|
|
|
log.setFileFullPath(url); |
|
|
|
log.setFileFullPath(url); |
|
|
|
log.setFileUrl(uploadPath + newFileName); |
|
|
|
csmCashLogService.update(log,new QueryWrapper<CsmCashLog>().eq("dataDate",dataDate)); |
|
|
|
} |
|
|
|
FileOutputStream out = new FileOutputStream(new File(uploadPath +"/"+newFileName)); |
|
|
|
word.write(out); |
|
|
|
out.close(); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* 获取下载地址 |
|
|
|
* @param date |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
@GetMapping(value = "/getDownloadUrl/{date}") |
|
|
|
public ResultBean getDownloadUrl(@PathVariable String date){ |
|
|
|
ResultBean rb =new ResultBean(); |
|
|
|
String url=csmCashLogService.getOne(new QueryWrapper<CsmCashLog>().eq("dataDate",date)).getFileFullPath(); |
|
|
|
return rb.success().setData(url); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|