This commit is contained in:
linfso 2024-12-27 13:26:52 +08:00
parent 72502c7f08
commit 076d6ac1f2
4 changed files with 24 additions and 16 deletions

View File

@ -993,9 +993,9 @@ public class EmisCommonController extends EmisBaseController
*/ */
@Log(title = "导出进仓单", businessType = BusinessType.EXPORT) @Log(title = "导出进仓单", businessType = BusinessType.EXPORT)
@RequestMapping("/exportWarehouseInTpl") @RequestMapping("/exportWarehouseInTpl")
public void exportWarehouseInTpl(HttpServletResponse response,String orderSn) { public void exportWarehouseInTpl(HttpServletResponse response,String orderSn,String fileType) {
try{ try{
emisWaybillService.genWarehouseInTplFile(response,orderSn); emisWaybillService.genWarehouseInTplFile(response,orderSn,fileType);
} }
catch(EmisBizError ex){ catch(EmisBizError ex){
ex.printStackTrace(); ex.printStackTrace();
@ -1066,7 +1066,6 @@ public class EmisCommonController extends EmisBaseController
String salesmen=item.getSalesmen(); String salesmen=item.getSalesmen();
String billMonth=item.getBillMonth(); String billMonth=item.getBillMonth();
String msg="截止"+DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD,new Date())+"有未回款,尽快联系客户收款,账期:"+billMonth+",待收:"+item.getNoRecdPayMoney()+"元,超期:"+item.getExpiredNoRecdPayMoney()+"元!"; String msg="截止"+DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD,new Date())+"有未回款,尽快联系客户收款,账期:"+billMonth+",待收:"+item.getNoRecdPayMoney()+"元,超期:"+item.getExpiredNoRecdPayMoney()+"元!";
AjaxResult rst=NoticeUtils.outSendNoticeToInner(msg,msg,"/ruyERj/BillPaybackSumList",salesmen,3); AjaxResult rst=NoticeUtils.outSendNoticeToInner(msg,msg,"/ruyERj/BillPaybackSumList",salesmen,3);
log.error(msg); log.error(msg);
} }

View File

@ -344,10 +344,10 @@ public class EmisWaybillController extends EmisBaseController
*/ */
@Log(title = "导出进仓单", businessType = BusinessType.EXPORT) @Log(title = "导出进仓单", businessType = BusinessType.EXPORT)
@RequestMapping("/exportWarehouseInTpl") @RequestMapping("/exportWarehouseInTpl")
public void exportWarehouseInTpl(HttpServletResponse response,String orderSn) { public void exportWarehouseInTpl(HttpServletResponse response,String orderSn,String fileType) {
try{ try{
emisWaybillService.genWarehouseInTplFile(response,orderSn); emisWaybillService.genWarehouseInTplFile(response,orderSn,fileType);
} }
catch(EmisBizError ex){ catch(EmisBizError ex){
ex.printStackTrace(); ex.printStackTrace();

View File

@ -215,7 +215,7 @@ public interface IEmisWaybillService extends IDataAuditService
public List<EmisWaybill> selectPrintWaybillList(EmisWaybill emisWaybill); public List<EmisWaybill> selectPrintWaybillList(EmisWaybill emisWaybill);
public void genWarehouseInTplFileByOms(HttpServletResponse response, String orderSn) throws EmisBizError ; public void genWarehouseInTplFileByOms(HttpServletResponse response, String orderSn) throws EmisBizError ;
public void genWarehouseInTplFile(HttpServletResponse response, String orderSn) throws EmisBizError ; public void genWarehouseInTplFile(HttpServletResponse response, String orderSn,String fileType) throws EmisBizError ;
public void genWaybillOrigAttach(String billCode); public void genWaybillOrigAttach(String billCode);

View File

@ -3770,7 +3770,7 @@ public class EmisWaybillServiceImpl extends EmisBaseService implements IEmisWayb
@Override @Override
public void genWarehouseInTplFile(HttpServletResponse response, String orderSn) throws EmisBizError { public void genWarehouseInTplFile(HttpServletResponse response, String orderSn,String fileType) throws EmisBizError {
if(StringUtils.isEmpty(orderSn)){ if(StringUtils.isEmpty(orderSn)){
throw new EmisBizError(EmisBizErrorType.NOT_EXISTS,"订单号为空"); throw new EmisBizError(EmisBizErrorType.NOT_EXISTS,"订单号为空");
@ -3902,17 +3902,25 @@ public class EmisWaybillServiceImpl extends EmisBaseService implements IEmisWayb
// 生成模版 // 生成模版
XWPFTemplate template = XWPFTemplate.compile(fis, config).render(fillMap); XWPFTemplate template = XWPFTemplate.compile(fis, config).render(fillMap);
// response.setContentType("application/octet-stream"); // docx
if("docx".equals(fileType)){
response.setContentType("application/octet-stream;charset=UTF-8");
response.setHeader("Content-Disposition", "attachment;fileName=" + fileName + ".docx");
response.addHeader("Access-Control-Expose-Headers", "Content-disposition");
template.write(outputStream);
}
// pdf
else {
response.setContentType("application/pdf"); response.setContentType("application/pdf");
response.setHeader("Content-Disposition", "attachment;fileName=" + fileName + ".pdf"); response.setHeader("Content-Disposition", "attachment;fileName=" + fileName + ".pdf");
ByteArrayOutputStream bos = new ByteArrayOutputStream(); ByteArrayOutputStream bos = new ByteArrayOutputStream();
// 写入流 // 写入流
template.write(bos); template.write(bos);
ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray()); ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray());
DocUtils.wordToPdf(bis, outputStream); DocUtils.wordToPdf(bis, outputStream);
}
response.flushBuffer(); response.flushBuffer();
IOUtils.closeQuietly(fis); IOUtils.closeQuietly(fis);
@ -3928,6 +3936,7 @@ public class EmisWaybillServiceImpl extends EmisBaseService implements IEmisWayb
public static void main(String[] args) { public static void main(String[] args) {
double volumeWeight=0.8 * (1000000 / Double.valueOf(4000)); double volumeWeight=0.8 * (1000000 / Double.valueOf(4000));