亚健康合同
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();
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user