合同
This commit is contained in:
@ -95,13 +95,14 @@ public class SysContractController extends BaseController {
|
|||||||
public AjaxResult getfile(@PathVariable long id) {
|
public AjaxResult getfile(@PathVariable long id) {
|
||||||
AjaxResult ajax = AjaxResult.success();
|
AjaxResult ajax = AjaxResult.success();
|
||||||
SysContract contract = sysContractService.selectSysContractById(id);
|
SysContract contract = sysContractService.selectSysContractById(id);
|
||||||
if (contract.getPath() != null) {
|
if (contract.getPath() != null && !contract.getPath().equals("")) {
|
||||||
ajax.put("url", contract.getPath());
|
ajax.put("url", contract.getPath());
|
||||||
} else {
|
} else {
|
||||||
Map<String, String> data = new HashMap<>();
|
Map<String, String> data = new HashMap<>();
|
||||||
|
data.put("id", contract.getId().toString());
|
||||||
data.put("name", contract.getName());
|
data.put("name", contract.getName());
|
||||||
data.put("amount", contract.getAmount().toString());
|
data.put("amount", contract.getAmount().toString());
|
||||||
data.put("serveTime", contract.getServeTime().toString());
|
data.put("serveTime", contract.getServeTime() + "");
|
||||||
ajax.put("data", data);
|
ajax.put("data", data);
|
||||||
}
|
}
|
||||||
return ajax;
|
return ajax;
|
||||||
@ -115,8 +116,9 @@ public class SysContractController extends BaseController {
|
|||||||
sysContract.setStatus(1);
|
sysContract.setStatus(1);
|
||||||
String path = "/file/" + sysContract.getId() + ".pdf";
|
String path = "/file/" + sysContract.getId() + ".pdf";
|
||||||
sysContract.setPath(path);
|
sysContract.setPath(path);
|
||||||
int count = sysContractService.updateSysContract(sysContract);
|
boolean result = sysContractService.signContract(sysContract);
|
||||||
if (count > 0) {
|
if (result) {
|
||||||
|
sysContractService.updateSysContract(sysContract);
|
||||||
AjaxResult ajax = AjaxResult.success();
|
AjaxResult ajax = AjaxResult.success();
|
||||||
ajax.put("url", path);
|
ajax.put("url", path);
|
||||||
return ajax;
|
return ajax;
|
||||||
|
@ -43,7 +43,9 @@ public class SysContract extends BaseEntity {
|
|||||||
* 服务时间
|
* 服务时间
|
||||||
*/
|
*/
|
||||||
@Excel(name = "服务时间")
|
@Excel(name = "服务时间")
|
||||||
private Integer serveTime;
|
private int serveTime;
|
||||||
|
|
||||||
|
private String serveTimeStr;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 金额
|
* 金额
|
||||||
@ -59,6 +61,11 @@ public class SysContract extends BaseEntity {
|
|||||||
@Excel(name = "文件路径")
|
@Excel(name = "文件路径")
|
||||||
private String path;
|
private String path;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 签约日期
|
||||||
|
*/
|
||||||
|
private String signDate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 合同状态
|
* 合同状态
|
||||||
* 0-未签订;1-已签订
|
* 0-未签订;1-已签订
|
||||||
@ -89,11 +96,11 @@ public class SysContract extends BaseEntity {
|
|||||||
this.phone = phone;
|
this.phone = phone;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer getServeTime() {
|
public int getServeTime() {
|
||||||
return serveTime;
|
return serveTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setServeTime(Integer serveTime) {
|
public void setServeTime(int serveTime) {
|
||||||
this.serveTime = serveTime;
|
this.serveTime = serveTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -137,6 +144,23 @@ public class SysContract extends BaseEntity {
|
|||||||
this.cusId = cusId;
|
this.cusId = cusId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getSignDate() {
|
||||||
|
return signDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSignDate(String signDate) {
|
||||||
|
this.signDate = signDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public String getServeTimeStr() {
|
||||||
|
return serveTimeStr;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setServeTimeStr(String serveTimeStr) {
|
||||||
|
this.serveTimeStr = serveTimeStr;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
|
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
|
||||||
@ -147,6 +171,8 @@ public class SysContract extends BaseEntity {
|
|||||||
.append("phone", getPhone())
|
.append("phone", getPhone())
|
||||||
.append("serveTime", getServeTime())
|
.append("serveTime", getServeTime())
|
||||||
.append("amount", getAmount())
|
.append("amount", getAmount())
|
||||||
|
.append("amountUpper", getAmountUpper())
|
||||||
|
.append("signDate", getSignDate())
|
||||||
.append("path", getPath())
|
.append("path", getPath())
|
||||||
.append("createBy", getCreateBy())
|
.append("createBy", getCreateBy())
|
||||||
.append("createTime", getCreateTime())
|
.append("createTime", getCreateTime())
|
||||||
|
@ -59,5 +59,5 @@ public interface ISysContractService
|
|||||||
*/
|
*/
|
||||||
public int deleteSysContractById(Long id);
|
public int deleteSysContractById(Long id);
|
||||||
|
|
||||||
public int signContract(SysContract sysContract);
|
public boolean signContract(SysContract sysContract);
|
||||||
}
|
}
|
||||||
|
@ -98,9 +98,12 @@ public class SysContractServiceImpl implements ISysContractService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int signContract(SysContract sysContract) {
|
public boolean signContract(SysContract sysContract) {
|
||||||
String templatePath = "/Users/wonder/Documents/Workspaces/java/RuoYi-Vue/running/pdf/contract.pdf";
|
// 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() + ".pdf";
|
// String filePath = "/Users/wonder/Documents/Workspaces/java/RuoYi-Vue/running" + sysContract.getPath();
|
||||||
|
String templatePath = "/home/workspace/RuoYi-Vue/running/pdf/contract.pdf";
|
||||||
|
String filePath = "/home/www/web/long.busyinn.com/file" + sysContract.getPath();
|
||||||
|
|
||||||
PdfReader reader;
|
PdfReader reader;
|
||||||
FileOutputStream out;
|
FileOutputStream out;
|
||||||
ByteArrayOutputStream bos;
|
ByteArrayOutputStream bos;
|
||||||
@ -116,11 +119,11 @@ public class SysContractServiceImpl implements ISysContractService {
|
|||||||
form.addSubstitutionFont(BaseFont.createFont("STSong-Light", "UniGB-UCS2-H", BaseFont.NOT_EMBEDDED));
|
form.addSubstitutionFont(BaseFont.createFont("STSong-Light", "UniGB-UCS2-H", BaseFont.NOT_EMBEDDED));
|
||||||
|
|
||||||
form.setField("name", sysContract.getName(), true);
|
form.setField("name", sysContract.getName(), true);
|
||||||
form.setField("time", sysContract.getServeTime().toString(), true);
|
form.setField("time", sysContract.getServeTimeStr(), true);
|
||||||
form.setField("moneyUpper", sysContract.getAmountUpper(), true);
|
form.setField("moneyUpper", sysContract.getAmountUpper(), true);
|
||||||
form.setField("money", sysContract.getAmount().intValue() + "", true);
|
form.setField("money", sysContract.getAmount().intValue() + "", true);
|
||||||
form.setField("phone", sysContract.getPhone(), true);
|
form.setField("phone", sysContract.getPhone(), true);
|
||||||
form.setField("date", sysContract.getCreateTime().toString(), true);
|
form.setField("date", DateUtils.getDate(), true);
|
||||||
form.setField("cusId", sysContract.getCusId(), true);
|
form.setField("cusId", sysContract.getCusId(), true);
|
||||||
|
|
||||||
|
|
||||||
@ -138,6 +141,8 @@ public class SysContractServiceImpl implements ISysContractService {
|
|||||||
copy.addPage(importPage);
|
copy.addPage(importPage);
|
||||||
}
|
}
|
||||||
doc.close();
|
doc.close();
|
||||||
|
|
||||||
|
return true;
|
||||||
} catch (FileNotFoundException e) {
|
} catch (FileNotFoundException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
@ -145,6 +150,6 @@ public class SysContractServiceImpl implements ISysContractService {
|
|||||||
} catch (DocumentException e) {
|
} catch (DocumentException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
return 0;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -60,7 +60,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<if test="id != null">#{id},</if>
|
<if test="id != null">#{id},</if>
|
||||||
<if test="status != null">#{status},</if>
|
<if test="status != null">#{status},</if>
|
||||||
<if test="name != null and name != ''">#{name},</if>
|
<if test="name != null and name != ''">#{name},</if>
|
||||||
<if test="cusId != null and cusId != ''">#{cus_id},</if>
|
<if test="cusId != null and cusId != ''">#{cusId},</if>
|
||||||
<if test="phone != null">#{phone},</if>
|
<if test="phone != null">#{phone},</if>
|
||||||
<if test="serveTime != null">#{serveTime},</if>
|
<if test="serveTime != null">#{serveTime},</if>
|
||||||
<if test="amount != null">#{amount},</if>
|
<if test="amount != null">#{amount},</if>
|
||||||
@ -76,9 +76,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<update id="updateSysContract" parameterType="SysContract">
|
<update id="updateSysContract" parameterType="SysContract">
|
||||||
update sys_contract
|
update sys_contract
|
||||||
<trim prefix="SET" suffixOverrides=",">
|
<trim prefix="SET" suffixOverrides=",">
|
||||||
<if test="status != null">name = #{status},</if>
|
<if test="status != null">status = #{status},</if>
|
||||||
<if test="name != null and name != ''">name = #{name},</if>
|
<if test="name != null and name != ''">name = #{name},</if>
|
||||||
<if test="cusId != null and cusId != ''">name = #{cus_id},</if>
|
<if test="cusId != null and cusId != ''">cus_id = #{cusId},</if>
|
||||||
<if test="phone != null">phone = #{phone},</if>
|
<if test="phone != null">phone = #{phone},</if>
|
||||||
<if test="serveTime != null">serve_time = #{serveTime},</if>
|
<if test="serveTime != null">serve_time = #{serveTime},</if>
|
||||||
<if test="amount != null">amount = #{amount},</if>
|
<if test="amount != null">amount = #{amount},</if>
|
||||||
|
@ -61,8 +61,8 @@ export function getFile(id) {
|
|||||||
|
|
||||||
export function signContract(data) {
|
export function signContract(data) {
|
||||||
return request({
|
return request({
|
||||||
url: '/custom/contract/',
|
url: '/custom/contract/sign',
|
||||||
method: 'put',
|
method: 'post',
|
||||||
data: data
|
data: data
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -9,10 +9,10 @@
|
|||||||
<span>¥{{form.amount}}</span>
|
<span>¥{{form.amount}}</span>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="服务时长" style="margin: 0">
|
<el-form-item label="服务时长" style="margin: 0">
|
||||||
<span>{{form.serveTime}}</span>
|
<span>{{form.serveTimeStr}}</span>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="姓名" prop="userName">
|
<el-form-item label="姓名" prop="cusName">
|
||||||
<el-input v-model="form.userName" placeholder="请输入客户姓名"/>
|
<el-input v-model="form.cusName" placeholder="请输入客户姓名"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="证件号" prop="cusId">
|
<el-form-item label="证件号" prop="cusId">
|
||||||
<el-input v-model="form.cusId" placeholder="请输入证件号"/>
|
<el-input v-model="form.cusId" placeholder="请输入证件号"/>
|
||||||
@ -50,8 +50,8 @@
|
|||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>第二条 合作内容及费用
|
<p>第二条 合作内容及费用
|
||||||
<div class="line-rule">11、经甲乙双方协商确定,乙方向甲方购买<b>{{form.serveTime}}</b>“胜唐体控瘦身指导服务”(以下简称服务)。</div>
|
<div class="line-rule">11、经甲乙双方协商确定,乙方向甲方购买<b>{{form.serveTimeStr}}</b>“胜唐体控瘦身指导服务”(以下简称服务)。</div>
|
||||||
<div class="line-rule">12、乙方向甲方购买<b>{{form.serveTime}}</b>,经甲乙双方协商确定,乙方向甲方支付疗程费用共为人民币:<b>{{form.amount}}</b>元,大写:<b>{{form.amountUppercase}}</b>)。
|
<div class="line-rule">12、乙方向甲方购买<b>{{form.serveTimeStr}}</b>,经甲乙双方协商确定,乙方向甲方支付疗程费用共为人民币:<b>{{form.amount}}</b>元,大写:<b>{{form.amountUppercase}}</b>)。
|
||||||
</div>
|
</div>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
@ -82,17 +82,17 @@
|
|||||||
<script>
|
<script>
|
||||||
|
|
||||||
import {getFile, signContract} from "@/api/custom/contract";
|
import {getFile, signContract} from "@/api/custom/contract";
|
||||||
import {digitUppercase} from "../../../utils/ruoyi";
|
import {digitUppercase, parseTime} from "../../../utils/ruoyi";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'sign',
|
name: 'sign',
|
||||||
data() {
|
data() {
|
||||||
|
|
||||||
const checkUserName = (rule, value, callback) => {
|
const checkCusName = (rule, value, callback) => {
|
||||||
if (!value) {
|
if (!value) {
|
||||||
return callback(new Error('姓名不能为空'))
|
return callback(new Error('姓名不能为空'))
|
||||||
}
|
}
|
||||||
if(value !== this.form.name){
|
if (value !== this.form.name) {
|
||||||
return callback(new Error('输入姓名不匹配,请联系客服核对'))
|
return callback(new Error('输入姓名不匹配,请联系客服核对'))
|
||||||
}
|
}
|
||||||
callback();
|
callback();
|
||||||
@ -159,8 +159,8 @@
|
|||||||
{label: '12个月', value: 360},
|
{label: '12个月', value: 360},
|
||||||
],
|
],
|
||||||
rules: {
|
rules: {
|
||||||
userName: [
|
cusName: [
|
||||||
{required: true, trigger: "blur", validator: checkUserName}
|
{required: true, trigger: "blur", validator: checkCusName}
|
||||||
],
|
],
|
||||||
phone: [
|
phone: [
|
||||||
{required: true, trigger: "blur", validator: checkPhone}
|
{required: true, trigger: "blur", validator: checkPhone}
|
||||||
@ -188,8 +188,8 @@
|
|||||||
} else if (result.data) {
|
} else if (result.data) {
|
||||||
this.form = result.data;
|
this.form = result.data;
|
||||||
this.form.amount = parseInt(result.data.amount);
|
this.form.amount = parseInt(result.data.amount);
|
||||||
this.form.amountUppercase = digitUppercase(this.form.amount);
|
this.form.amountUpper = digitUppercase(this.form.amount);
|
||||||
this.form.serveTime = this.serveTimeIdOption.find(obj => obj.value === parseInt(result.data.serveTime)).label
|
this.form.serveTimeStr = this.serveTimeIdOption.find(obj => obj.value === parseInt(result.data.serveTime)).label
|
||||||
this.show = true;
|
this.show = true;
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -197,9 +197,12 @@
|
|||||||
submitForm() {
|
submitForm() {
|
||||||
this.$refs["form"].validate(valid => {
|
this.$refs["form"].validate(valid => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
|
this.form.signDate = parseTime(new Date(), '{y}-{m}-{d}');
|
||||||
|
console.log(this.form)
|
||||||
signContract(this.form).then(result => {
|
signContract(this.form).then(result => {
|
||||||
if (result.code === 200) {
|
if (result.code === 200) {
|
||||||
// this.$router.push(result.url);
|
this.$router.push(result.url);
|
||||||
|
// console.log(result);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user