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

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

import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * 用印申请Entity
 * @author 丁旭
 * @version 2017-04-26
 */
public class WorkSealForm extends ActEntity<WorkSealForm> {
	
	private static final long serialVersionUID = 1L;
    private String processInstanceId; // 流程实例编号
	private String documentName;		// 用印文件名称
	private String documentCount;		// 文件个数
	private String applicationDate;		// 申请时间
	private String sealType;		// 印章分类
	private User user;		// 经办人
	private Office office;		// 用印部门
	private String companyId;		// 申请公司
    private String officeId;
	private String status;		// 用印申请状态值
    private String ids;
    private Date createDateStart;
    private Date createDateEnd;
    private String reason;
    private String files; //
    private String idNames;
    private String ida;
    private String idNamea;
    private String idb;
    private String idNameb;
    private String idc;
    private String idNamec;
    private String idd;
    private String idNamed;
    private String ide;
    private String idNamee;
    private String CCId;
    private String name;
    private String officeName;
    private String time;
    private List<String> adds = Lists.newArrayList();
    private List<Workattachment> workAttachments = new ArrayList<Workattachment>();
    private String home;

    public String getOfficeName() {
        return officeName;
    }

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

    public String getName() {
        return name;
    }

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

    public String getTime() {
        return time;
    }

    public void setTime(String time) {
        this.time = time;
    }

    public String getFiles() {
        return files;
    }

    public void setFiles(String files) {
        this.files = files;
    }

	public WorkSealForm() {
		super();
	}

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

    public String getReason() {
        return reason;
    }

    public void setReason(String reason) {
        this.reason = reason;
    }

    @ExcelField(title="用印文件名称", align=2, sort=6)
	public String getDocumentName() {
		return documentName;
	}

	public void setDocumentName(String documentName) {
		this.documentName = documentName;
	}
	
	@ExcelField(title="文件个数", align=2, sort=7)
	public String getDocumentCount() {
		return documentCount;
	}

	public void setDocumentCount(String documentCount) {
		this.documentCount = documentCount;
	}
	
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	@ExcelField(title="申请时间", align=2, sort=8)
	public String getApplicationDate() {
		return applicationDate;
	}

	public void setApplicationDate(String applicationDate) {
		this.applicationDate = applicationDate;
	}
	
	@ExcelField(title="印章分类", mainDictType="seal_type", align=2, sort=9)
	public String getSealType() {
		return sealType;
	}

	public void setSealType(String sealType) {
		this.sealType = sealType;
	}
	
	@ExcelField(title="经办人", fieldType=User.class, value="user.name", align=2, sort=10)
	public User getUser() {
		return user;
	}

	public void setUser(User user) {
		this.user = user;
	}
	
	@ExcelField(title="用印部门", fieldType=Office.class, value="office.name", align=2, sort=11)
	public Office getOffice() {
		return office;
	}

	public void setOffice(Office office) {
		this.office = office;
	}
	
	@ExcelField(title="申请公司", align=2, sort=12)
	public String getCompanyId() {
		return companyId;
	}

	public void setCompanyId(String companyId) {
		this.companyId = companyId;
	}
	
	@ExcelField(title="用印申请状态值", dictType="seal_status", align=2, sort=13)
	public String getStatus() {
		return status;
	}

	public void setStatus(String status) {
		this.status = status;
	}

    private String comment; //审核意见 目前只保存手机端审核
    private String leaveDetails;

    public static long getSerialVersionUID() {
        return serialVersionUID;
    }

    public String getLeaveDetails() {
        return leaveDetails;
    }

    public void setLeaveDetails(String leaveDetails) {
        this.leaveDetails = leaveDetails;
    }

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


    public String getProcessInstanceId() {
        return processInstanceId;
    }

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

    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 String getIds() {
        List<String> idList = Lists.newArrayList();
        if (StringUtils.isNotBlank(ids)) {
            String ss = ids.trim().replace("　", ",").replace(" ", ",").replace("，", ",").replace("'", "");
            for (String s : ss.split(",")) {
                // if(s.matches("\\d*")) {
                idList.add("'" + s + "'");
                // }
            }
        }
        return StringUtils.join(idList, ",");
    }

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

    public Date getCreateDateStart() {
        return createDateStart;
    }

    public void setCreateDateStart(Date createDateStart) {
        this.createDateStart = createDateStart;
    }

    public Date getCreateDateEnd() {
        return createDateEnd;
    }

    public void setCreateDateEnd(Date createDateEnd) {
        this.createDateEnd = createDateEnd;
    }
    public String getIdNames() {
        List<String> idList = Lists.newArrayList();
        if (StringUtils.isNotBlank(idNames)) {
            String ss = idNames.trim().replace("　", ",").replace(" ", ",").replace("，", ",").replace("'", "");
            for (String s : ss.split(",")) {
                // if(s.matches("\\d*")) {
                idList.add("'" + s + "'");
                // }
            }
        }
        return StringUtils.join(idList, ",");
    }

    public void setIdNames(String idNames) {
        this.idNames = idNames;
    }

    @ExcelField(title="申请人", align=2, sort=12)
    public String getIda() {
        return ida;
    }

    public void setIda(String ida) {
        this.ida = ida;
    }

    public String getIdNamea() {
        return idNamea;
    }

    public void setIdNamea(String idNamea) {
        this.idNamea = idNamea;
    }

    public String getIdb() {
        return idb;
    }

    public void setIdb(String idb) {
        this.idb = idb;
    }

    public String getIdNameb() {
        return idNameb;
    }

    public void setIdNameb(String idNameb) {
        this.idNameb = idNameb;
    }

    public String getIdc() {
        return idc;
    }

    public void setIdc(String idc) {
        this.idc = idc;
    }

    public String getIdNamec() {
        return idNamec;
    }

    public void setIdNamec(String idNamec) {
        this.idNamec = idNamec;
    }

    public String getIdd() {
        return idd;
    }

    public void setIdd(String idd) {
        this.idd = idd;
    }

    public String getIdNamed() {
        return idNamed;
    }

    public void setIdNamed(String idNamed) {
        this.idNamed = idNamed;
    }

    public String getIde() {
        return ide;
    }

    public void setIde(String ide) {
        this.ide = ide;
    }

    public String getIdNamee() {
        return idNamee;
    }

    public void setIdNamee(String idNamee) {
        this.idNamee = idNamee;
    }

    public String getCCId() {
        return CCId;
    }

    public void setCCId(String CCId) {
        this.CCId = CCId;
    }

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

    public String getComment() {
        return comment;
    }

    public String getOfficeId() {
        return officeId;
    }

    public void setOfficeId(String officeId) {
        this.officeId = officeId;
    }

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

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

    public List<Workattachment> getWorkAttachments() {
        return workAttachments;
    }

    public void setWorkAttachments(List<Workattachment> workAttachments) {
        this.workAttachments = workAttachments;
    }

    public String getHome() {
        return home;
    }

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