Merge branch 'master' of gitee.com:darlk/ShengTangManage
This commit is contained in:
@ -6,6 +6,8 @@ import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 合同对象 sys_contract
|
||||
@ -22,6 +24,16 @@ public class SysContract extends BaseEntity {
|
||||
@Excel(name = "合同编号")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 调理项目ID
|
||||
*/
|
||||
private Long projectId;
|
||||
|
||||
/**
|
||||
* 调理项目名称
|
||||
*/
|
||||
private String projectName;
|
||||
|
||||
/**
|
||||
* 客户姓名
|
||||
*/
|
||||
@ -197,6 +209,22 @@ public class SysContract extends BaseEntity {
|
||||
this.serveTimeStr = serveTimeStr;
|
||||
}
|
||||
|
||||
public Long getProjectId() {
|
||||
return projectId;
|
||||
}
|
||||
|
||||
public void setProjectId(Long projectId) {
|
||||
this.projectId = projectId;
|
||||
}
|
||||
|
||||
public String getProjectName() {
|
||||
return projectName;
|
||||
}
|
||||
|
||||
public void setProjectName(String projectName) {
|
||||
this.projectName = projectName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
|
||||
|
@ -3,6 +3,7 @@ package com.stdiet.custom.service.impl;
|
||||
import com.itextpdf.text.Document;
|
||||
import com.itextpdf.text.DocumentException;
|
||||
import com.itextpdf.text.pdf.*;
|
||||
import com.stdiet.common.constant.ContractContants;
|
||||
import com.stdiet.common.utils.DateUtils;
|
||||
import com.stdiet.common.utils.StringUtils;
|
||||
import com.stdiet.custom.domain.SysContract;
|
||||
@ -16,6 +17,8 @@ import java.io.ByteArrayOutputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@ -123,21 +126,39 @@ public class SysContractServiceImpl implements ISysContractService {
|
||||
AcroFields form = stamper.getAcroFields();
|
||||
|
||||
form.addSubstitutionFont(BaseFont.createFont("STSong-Light", "UniGB-UCS2-H", BaseFont.NOT_EMBEDDED));
|
||||
form.setField("name", sysContract.getSignName(), true);
|
||||
form.setField("serveTime", sysContract.getServeTimeStr(), true);
|
||||
// form.setField("tutor", sysContract.getTutor(), true);
|
||||
form.setField("moneyUpper", sysContract.getAmountUpper(), true);
|
||||
form.setField("money", sysContract.getAmount().intValue() + "", true);
|
||||
form.setField("phone", sysContract.getPhone(), true);
|
||||
form.setField("promise", sysContract.getServePromise(), true);
|
||||
form.setField("date", DateUtils.getDate(), true);
|
||||
// form.setField("date", sysContract.getSignDate());
|
||||
form.setField("cusId", sysContract.getCusId(), true);
|
||||
if (StringUtils.isNotEmpty(sysContract.getRemark())) {
|
||||
form.setField("remark", "(备注:" + sysContract.getRemark() + ")", true);
|
||||
if(sysContract.getProjectId().intValue() == 0){
|
||||
form.setField("name", sysContract.getSignName(), true);
|
||||
form.setField("serveTime", sysContract.getServeTimeStr(), true);
|
||||
//form.setField("tutor", sysContract.getTutor(), true);
|
||||
form.setField("moneyUpper", sysContract.getAmountUpper(), true);
|
||||
form.setField("money", sysContract.getAmount().intValue() + "", true);
|
||||
form.setField("phone", sysContract.getPhone(), true);
|
||||
form.setField("promise", sysContract.getServePromise(), true);
|
||||
form.setField("date", DateUtils.getDate(), true);
|
||||
//form.setField("date", sysContract.getSignDate());
|
||||
form.setField("cusId", sysContract.getCusId(), true);
|
||||
if (StringUtils.isNotEmpty(sysContract.getRemark())) {
|
||||
form.setField("remark", "(备注:" + sysContract.getRemark() + ")", true);
|
||||
}
|
||||
}else{
|
||||
form.setField("companyName", ContractContants.companyName, true);
|
||||
form.setField("companyLegalPerson", ContractContants.companyLegalPerson, true);
|
||||
form.setField("name", sysContract.getSignName(), true);
|
||||
form.setField("cusId", sysContract.getCusId(), true);
|
||||
form.setField("phone", sysContract.getPhone(), true);
|
||||
DateTimeFormatter fmt = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
||||
form.setField("expireTime", LocalDate.now().plusMonths(sysContract.getServeTime()/30).format(fmt), true);
|
||||
form.setField("amount", sysContract.getAmount().intValue()+"", true);
|
||||
form.setField("amountCapital", sysContract.getAmountUpper(), true);
|
||||
form.setField("serveTime", sysContract.getServeTime()/30+"", true);
|
||||
form.setField("bankName", ContractContants.bankName, true);
|
||||
form.setField("bankAccount", ContractContants.bankAccount, true);
|
||||
form.setField("hourDay", ContractContants.hourDay, true);
|
||||
form.setField("dayWeek", ContractContants.dayWeek, true);
|
||||
form.setField("replyIntervalTime", ContractContants.replyIntervalTime, true);
|
||||
form.setField("tutor", sysContract.getTutor(), true);
|
||||
form.setField("signTime", DateUtils.getDate(), true);
|
||||
}
|
||||
|
||||
|
||||
stamper.setFormFlattening(true);// 如果为false那么生成的PDF文件还能编辑,一定要设为true
|
||||
stamper.close();
|
||||
|
||||
|
@ -6,6 +6,7 @@
|
||||
|
||||
<resultMap type="SysContract" id="SysContractResult">
|
||||
<result property="id" column="id"/>
|
||||
<result property="projectId" column="project_id"></result>
|
||||
<result property="status" column="status"/>
|
||||
<result property="name" column="name"/>
|
||||
<result property="signName" column="sign_name"/>
|
||||
@ -21,33 +22,39 @@
|
||||
<result property="updateBy" column="update_by"/>
|
||||
<result property="updateTime" column="update_time"/>
|
||||
<result property="remark" column="remark"/>
|
||||
<!-- 非持久化字段 -->
|
||||
<result property="projectName" column="project_name"></result>
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectSysContractVo">
|
||||
select id, status, name, sign_name, phone, cus_id, serve_time, tutor, serve_promise, amount, path, create_by, create_time, update_by, update_time, remark from sys_contract
|
||||
select sc.id, sc.project_id, sc.status, sc.name, sc.sign_name, sc.phone, sc.cus_id, sc.serve_time, sc.tutor, sc.serve_promise, sc.amount,
|
||||
sc.path, sc.create_by, sc.create_time, sc.update_by, sc.update_time, sc.remark,cp.dict_label as project_name
|
||||
from sys_contract as sc
|
||||
LEFT JOIN (SELECT dict_label, dict_value FROM sys_dict_data WHERE dict_type = 'conditioning_project') as cp ON cp.dict_value = sc.project_id
|
||||
</sql>
|
||||
|
||||
<select id="selectSysContractList" parameterType="SysContract" resultMap="SysContractResult">
|
||||
<include refid="selectSysContractVo"/>
|
||||
<where>
|
||||
<if test="id != null ">and id = #{id}</if>
|
||||
<if test="status != null ">and status = #{status}</if>
|
||||
<if test="tutor != null and tutor != '' ">and tutor = #{tutor}</if>
|
||||
<if test="name != null and name != ''">and name like concat('%', #{name}, '%')</if>
|
||||
<if test="phone != null and phone != ''">and phone = #{phone}</if>
|
||||
<if test="id != null ">and sc.id = #{id}</if>
|
||||
<if test="status != null ">and sc.status = #{status}</if>
|
||||
<if test="tutor != null and tutor != '' ">and sc.tutor = #{tutor}</if>
|
||||
<if test="name != null and name != ''">and sc.name like concat('%', #{name}, '%')</if>
|
||||
<if test="phone != null and phone != ''">and sc.phone = #{phone}</if>
|
||||
</where>
|
||||
order by create_time desc
|
||||
</select>
|
||||
|
||||
<select id="selectSysContractById" parameterType="Long" resultMap="SysContractResult">
|
||||
<include refid="selectSysContractVo"/>
|
||||
where id = #{id}
|
||||
where sc.id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertSysContract" parameterType="SysContract" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into sys_contract
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">id,</if>
|
||||
<if test="projectId != null">project_id,</if>
|
||||
<if test="status != null">status,</if>
|
||||
<if test="name != null and name != ''">name,</if>
|
||||
<if test="signName != null and signName != ''">sign_name,</if>
|
||||
@ -66,6 +73,7 @@
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">#{id},</if>
|
||||
<if test="projectId != null">#{projectId},</if>
|
||||
<if test="status != null">#{status},</if>
|
||||
<if test="name != null and name != ''">#{name},</if>
|
||||
<if test="signName != null and signName != ''">#{signName},</if>
|
||||
@ -87,6 +95,7 @@
|
||||
<update id="updateSysContract" parameterType="SysContract">
|
||||
update sys_contract
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="projectId != null">project_id = #{projectId},</if>
|
||||
<if test="status != null">status = #{status},</if>
|
||||
<if test="name != null and name != ''">name = #{name},</if>
|
||||
<if test="signName != null and signName != ''">sign_name = #{signName},</if>
|
||||
|
Reference in New Issue
Block a user