添加报错信息
This commit is contained in:
parent
ee29eb47f2
commit
207e80b40c
@ -7,6 +7,7 @@ import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.custom.domain.SysContract;
|
||||
import com.ruoyi.custom.page.PdfProcessInfo;
|
||||
import com.ruoyi.custom.service.ISysContractService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
@ -116,14 +117,14 @@ public class SysContractController extends BaseController {
|
||||
sysContract.setStatus(1);
|
||||
String path = "/file/" + sysContract.getId() + ".pdf";
|
||||
sysContract.setPath(path);
|
||||
boolean result = sysContractService.signContract(sysContract);
|
||||
if (result) {
|
||||
PdfProcessInfo result = sysContractService.signContract(sysContract);
|
||||
if (result.getCode() == 1) {
|
||||
sysContractService.updateSysContract(sysContract);
|
||||
AjaxResult ajax = AjaxResult.success();
|
||||
ajax.put("url", path);
|
||||
return ajax;
|
||||
} else {
|
||||
return AjaxResult.error("操作失败");
|
||||
return AjaxResult.error(result.getMsg());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,24 @@
|
||||
package com.ruoyi.custom.page;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class PdfProcessInfo implements Serializable {
|
||||
private int code;
|
||||
private String msg;
|
||||
|
||||
public int getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(int code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public String getMsg() {
|
||||
return msg;
|
||||
}
|
||||
|
||||
public void setMsg(String msg) {
|
||||
this.msg = msg;
|
||||
}
|
||||
}
|
@ -1,19 +1,20 @@
|
||||
package com.ruoyi.custom.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.ruoyi.custom.domain.SysContract;
|
||||
import com.ruoyi.custom.page.PdfProcessInfo;
|
||||
|
||||
/**
|
||||
* 合同Service接口
|
||||
*
|
||||
*
|
||||
* @author wonder
|
||||
* @date 2020-10-23
|
||||
*/
|
||||
public interface ISysContractService
|
||||
{
|
||||
public interface ISysContractService {
|
||||
/**
|
||||
* 查询合同
|
||||
*
|
||||
*
|
||||
* @param id 合同ID
|
||||
* @return 合同
|
||||
*/
|
||||
@ -21,7 +22,7 @@ public interface ISysContractService
|
||||
|
||||
/**
|
||||
* 查询合同列表
|
||||
*
|
||||
*
|
||||
* @param sysContract 合同
|
||||
* @return 合同集合
|
||||
*/
|
||||
@ -29,7 +30,7 @@ public interface ISysContractService
|
||||
|
||||
/**
|
||||
* 新增合同
|
||||
*
|
||||
*
|
||||
* @param sysContract 合同
|
||||
* @return 结果
|
||||
*/
|
||||
@ -37,7 +38,7 @@ public interface ISysContractService
|
||||
|
||||
/**
|
||||
* 修改合同
|
||||
*
|
||||
*
|
||||
* @param sysContract 合同
|
||||
* @return 结果
|
||||
*/
|
||||
@ -45,7 +46,7 @@ public interface ISysContractService
|
||||
|
||||
/**
|
||||
* 批量删除合同
|
||||
*
|
||||
*
|
||||
* @param ids 需要删除的合同ID
|
||||
* @return 结果
|
||||
*/
|
||||
@ -53,11 +54,11 @@ public interface ISysContractService
|
||||
|
||||
/**
|
||||
* 删除合同信息
|
||||
*
|
||||
*
|
||||
* @param id 合同ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteSysContractById(Long id);
|
||||
|
||||
public boolean signContract(SysContract sysContract);
|
||||
public PdfProcessInfo signContract(SysContract sysContract);
|
||||
}
|
||||
|
@ -6,6 +6,7 @@ import com.itextpdf.text.pdf.*;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import com.ruoyi.custom.domain.SysContract;
|
||||
import com.ruoyi.custom.mapper.SysContractMapper;
|
||||
import com.ruoyi.custom.page.PdfProcessInfo;
|
||||
import com.ruoyi.custom.service.ISysContractService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
@ -99,7 +100,7 @@ public class SysContractServiceImpl implements ISysContractService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean signContract(SysContract sysContract) {
|
||||
public PdfProcessInfo signContract(SysContract sysContract) {
|
||||
// String templatePath = "/Users/wonder/Documents/Workspaces/java/RuoYi-Vue/running/pdf/contract.pdf";
|
||||
// String filePath = "/Users/wonder/Documents/Workspaces/java/RuoYi-Vue/running" + sysContract.getPath();
|
||||
String templatePath = "/home/workspace/RuoYi-Vue/running/pdf/contract.pdf";
|
||||
@ -110,6 +111,8 @@ public class SysContractServiceImpl implements ISysContractService {
|
||||
ByteArrayOutputStream bos;
|
||||
PdfStamper stamper;
|
||||
|
||||
PdfProcessInfo info = new PdfProcessInfo();
|
||||
|
||||
try {
|
||||
out = new FileOutputStream(filePath);// 输出流到新的pdf,没有b2.pdf时会创建
|
||||
reader = new PdfReader(templatePath);// 读取pdf模板
|
||||
@ -143,14 +146,22 @@ public class SysContractServiceImpl implements ISysContractService {
|
||||
}
|
||||
doc.close();
|
||||
|
||||
return true;
|
||||
info.setCode(1);
|
||||
info.setMsg("success");
|
||||
|
||||
} catch (FileNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
info.setCode(0);
|
||||
info.setMsg(e.getMessage());
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
info.setCode(0);
|
||||
info.setMsg(e.getMessage());
|
||||
} catch (DocumentException e) {
|
||||
e.printStackTrace();
|
||||
info.setCode(0);
|
||||
info.setMsg(e.getMessage());
|
||||
}
|
||||
return false;
|
||||
return info;
|
||||
}
|
||||
}
|
||||
|
@ -51,7 +51,7 @@
|
||||
|
||||
<p>第二条 合作内容及费用
|
||||
<div class="line-rule">11、经甲乙双方协商确定,乙方向甲方购买<b>{{form.serveTimeStr}}</b>“胜唐体控瘦身指导服务”(以下简称服务)。</div>
|
||||
<div class="line-rule">12、乙方向甲方购买<b>{{form.serveTimeStr}}</b>,经甲乙双方协商确定,乙方向甲方支付疗程费用共为人民币:<b>{{form.amount}}</b>元,大写:<b>{{form.amountUppercase}}</b>)。
|
||||
<div class="line-rule">12、乙方向甲方购买<b>{{form.serveTimeStr}}</b>,经甲乙双方协商确定,乙方向甲方支付疗程费用共为人民币:<b>{{form.amount}}</b>元,大写:<b>{{form.amountUpper}}</b>)。
|
||||
</div>
|
||||
</p>
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user