/**
 * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
 */
package com.jeeplus.modules.workpayment.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.google.common.collect.Lists;
import com.jeeplus.common.persistence.ActEntity;
import com.jeeplus.common.utils.Number2CN;
import com.jeeplus.common.utils.excel.annotation.ExcelField;
import com.jeeplus.modules.sys.entity.Office;
import com.jeeplus.modules.sys.entity.User;
import org.activiti.engine.history.HistoricProcessInstance;
import org.activiti.engine.repository.ProcessDefinition;
import org.activiti.engine.runtime.ProcessInstance;
import org.activiti.engine.task.Task;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * 付款申请Entity
 * @author fgy
 * @version 2018-01-16
 */
public class WorkPayment extends ActEntity<WorkPayment> {
	
	private static final long serialVersionUID = 1L;
	private Office company;			//公司
	private String companyId;		// 公司
	private String companyName;
	private Office office;          //部门
	private String officeId;		// 部门
	private String officeName;
	private User user;		//
	private String userName;	//
	private String reason;		// 付款事由
	private String amount;		// 付款总额
	private String amountCN;	//金额大写
	private String payType;		// 支付方式
	private Date payDate;		// 支付日期
	private String payObject;		// 支付对象
	private String payBank;		// 开户银行
	private String payBankAccount;		// 银行账户
	private String status;		// 审核状态
	private String processInstanceId;		// 审核实例id
	private String ids;		//审批人
	private String CCid;   //抄送人
	private String name;
	private String home;
	private List<String> adds = Lists.newArrayList();
	private String comment; //审核意见 目前只保存手机端审核

	// 流程任务
	private Task task;
	private Map<String, Object> variables;
	// 运行中的流程实例
	private ProcessInstance processInstance;
	// 历史的流程实例
	private HistoricProcessInstance historicProcessInstance;
	// 流程定义
	private ProcessDefinition processDefinition;


	public WorkPayment() {
		super();
	}

	public WorkPayment(String id){
		super(id);
	}

	@ExcelField(title="公司", align=2, sort=7)
	public String getCompanyId() {
		return companyId;
	}

	public void setCompanyId(String companyId) {
		this.companyId = companyId;
	}
	
	@ExcelField(title="部门", align=2, sort=8)
	public String getOfficeId() {
		return officeId;
	}

	public void setOfficeId(String officeId) {
		this.officeId = officeId;
	}
	
	@ExcelField(title="付款事由", align=2, sort=9)
	public String getReason() {
		return reason;
	}

	public void setReason(String reason) {
		this.reason = reason;
	}
	
	@ExcelField(title="付款总额", align=2, sort=10)
	public String getAmount() {
		return amount;
	}

	public void setAmount(String amount) {
		this.amount = amount;
	}
	
	@ExcelField(title="支付方式", dictType="pay_type", align=2, sort=11)
	public String getPayType() {
		return payType;
	}

	public void setPayType(String payType) {
		this.payType = payType;
	}
	
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	@ExcelField(title="支付日期", align=2, sort=12)
	public Date getPayDate() {
		return payDate;
	}

	public void setPayDate(Date payDate) {
		this.payDate = payDate;
	}
	
	@ExcelField(title="支付对象", align=2, sort=13)
	public String getPayObject() {
		return payObject;
	}

	public void setPayObject(String payObject) {
		this.payObject = payObject;
	}
	
	@ExcelField(title="开户银行", align=2, sort=14)
	public String getPayBank() {
		return payBank;
	}

	public void setPayBank(String payBank) {
		this.payBank = payBank;
	}
	
	@ExcelField(title="银行账户", align=2, sort=15)
	public String getPayBankAccount() {
		return payBankAccount;
	}

	public void setPayBankAccount(String payBankAccount) {
		this.payBankAccount = payBankAccount;
	}
	
	@ExcelField(title="审核状态", dictType="act_status", align=2, sort=16)
	public String getStatus() {
		return status;
	}

	public void setStatus(String status) {
		this.status = status;
	}
	
	@ExcelField(title="审核实例id", align=2, sort=17)
	public String getProcessInstanceId() {
		return processInstanceId;
	}

	public void setProcessInstanceId(String processInstanceId) {
		this.processInstanceId = processInstanceId;
	}

	public Office getCompany() {
		return company;
	}

	public void setCompany(Office company) {
		this.company = company;
	}

	public String getCompanyName() {
		return companyName;
	}

	public void setCompanyName(String companyName) {
		this.companyName = companyName;
	}

	public String getOfficeName() {
		return officeName;
	}

	public void setOfficeName(String officeName) {
		this.officeName = officeName;
	}

	public Office getOffice() {
		return office;
	}

	public void setOffice(Office office) {
		this.office = office;
	}

	public String getIds() {
		return ids;
	}

	public void setIds(String ids) {
		this.ids = ids;
	}

	public String getCCid() {
		return CCid;
	}

	public void setCCid(String CCid) {
		this.CCid = CCid;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public List<String> getAdds() {
		return adds;
	}

	public void setAdds(List<String> adds) {
		this.adds = adds;
	}

	public String getComment() {
		return comment;
	}

	public void setComment(String comment) {
		this.comment = comment;
	}

	public Task getTask() {
		return task;
	}

	public void setTask(Task task) {
		this.task = task;
	}

	public Map<String, Object> getVariables() {
		return variables;
	}

	public void setVariables(Map<String, Object> variables) {
		this.variables = variables;
	}

	public ProcessInstance getProcessInstance() {
		return processInstance;
	}

	public void setProcessInstance(ProcessInstance processInstance) {
		this.processInstance = processInstance;
	}

	public HistoricProcessInstance getHistoricProcessInstance() {
		return historicProcessInstance;
	}

	public void setHistoricProcessInstance(HistoricProcessInstance historicProcessInstance) {
		this.historicProcessInstance = historicProcessInstance;
	}

	public ProcessDefinition getProcessDefinition() {
		return processDefinition;
	}

	public void setProcessDefinition(ProcessDefinition processDefinition) {
		this.processDefinition = processDefinition;
	}

	public User getUser() {
		return user;
	}

	public void setUser(User user) {
		this.user = user;
	}

	public String getUserName() {
		return userName;
	}

	public void setUserName(String userName) {
		this.userName = userName;
	}

	public String getAmountCN() {
		String amountCN = "";
		if(org.apache.commons.lang3.StringUtils.isNotBlank(amount)){
			BigDecimal bd = new BigDecimal(amount);
			amountCN = Number2CN.number2CNMontrayUnit(bd);
		}
		return amountCN;
	}

	public void setAmountCN(String amountCN) {
		this.amountCN = amountCN;
	}

	public String getHome() {
		return home;
	}

	public void setHome(String home) {
		this.home = home;
	}
}