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

import com.fasterxml.jackson.annotation.JsonFormat;
import com.google.common.collect.Lists;
import com.jeeplus.common.persistence.ActEntity;
import com.jeeplus.common.utils.Collections3;
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.workclientinfo.entity.WorkClientAttachment;
import com.jeeplus.modules.workclientinfo.entity.WorkClientInfo;
import com.jeeplus.modules.workclientinfo.entity.WorkClientLinkman;
import com.jeeplus.modules.workproject.entity.WorkProject;
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 mengxy
 * @version 2017-05-27
 */
public class WorkBidProjectList extends ActEntity<WorkBidProjectList> {

	private static final long serialVersionUID = 1L;
	public static final String SERIAL_BIZCODE = "9";//编号模板类型
	private String projectScale;      //项目规模
	private String scaleType;         //规模类型   scale_type
	private String scaleUnit;     	//规模单位     scale_unit
	private String investMoney;         //投资额（万元）
	private BigDecimal min;
	private BigDecimal max;
	private String bidNumber;         //招标编号
	private Date   giveDate;            //投标保证金交付时间
	private Office office;              //项目协作部门
	private String businessType;         //业务类型     business_type
	private String serviceContent;         //服务内容
	private String isExt;		//  是否外部联系人(0 内 1外)
	private String extCompany;		// 外部客户
	private String projectNumber;		// 投标编号
	private String projectName;		// 投标名称
	private String projectType;		// 工程分类   contract_type
	private String typeExplain;		// 类型说明
	private String projectSource;		// 项目来源   bidProjectSource
	private String sourceExplain;		// 来源说明
	private WorkClientInfo bidCompany;		// 招标单位
	private Date registrationDate;		// 报名日期
	private Date bidDate;		// 投标日期
	private Date trialDate;		// 资审日期
	private String trialType;		// 资格审查        trial_type   系统字典
	private Double documentCost;		// 文件费用
	private String bidBond;		// 投标保证金
	private String bondStyle;		// 投标保证金形式   bond_style
	private Date refundDate;		// 投标保证金退还时间
	private String isBid;		// 是否联合体投标    is_bid     系统字典
	private String subcontractCompany;		// 对外协作单位
	private String projectSituation;		// 项目概况
	private String isSubcontract;		// 是否中标(0是1否)
	private String status;		//审核状态
	private String home;
	private String officeId;
	private String officeName;  //部门
	private String companyId;  //公司id
	private String processInstanceId; // 流程实例编号
	private Date beginContractDate;		// 开始 签订日期
	private Date endContractDate;		// 结束 签订日期
	private String sign;      //操作标志
	private List<WorkClientLinkman> workClientLinkmanList = Lists.newArrayList();		// 联系人
	private List<WorkClientLinkman> workClientLinkmanLists = Lists.newArrayList();     //招标代理机构
	private List<WorkClientAttachment> workAttachments = Lists.newArrayList();         //附件信息   投标附件
	private List<WorkClientAttachment> workAttachmentsprice = Lists.newArrayList();        //价格附件
	private List<WorkClientAttachment> workAttachmentsbid = Lists.newArrayList();        //招投标附件
	private List<WorkClientAttachment> workAttachmentsopenbid = Lists.newArrayList();        //开标信息附件
	// 流程任务
	private Task task;
	private Map<String, Object> variables;
	// 运行中的流程实例
	private ProcessInstance processInstance;
	// 历史的流程实例
	private HistoricProcessInstance historicProcessInstance;
	// 流程定义
	private ProcessDefinition processDefinition;


	//投标保证金交付时间-提前三天提醒-标志
	private String giveDateSign;         //1已提醒
	//投标日期30天后-保证金确认提醒-标志
	private String bidDateSign;          //1已提醒

	//导出属性
	private String bidCompanyName;
	private String coopName;
	private String remark;
	private String createByName;
	private Date   creaDates;
	private String incomeMoneyStr;
	/*-------------------------------------以下属性暂弃---------------------------------------------*/

	private String contacts;		// 联系人
	private Date purchaseDate;		// 购买日期
	private Double bindCost;		// 装订费用
	private Double otherCost;		// 其他费用
	private Double offer;		// 报价
	private String implementingDept;		// 实施部门
	private String projectMaster;		// 负责人
	private String parentIds;
	private String name;
	private String ids;
	private String idNames;
	private String projectMember;
	private WorkProject workProject; //总项目
	private String queryCon; //总项目

	private String psort;//行业大分类
	private String ssort; //行业小分类

	public String getGiveDateSign() {
		return giveDateSign;
	}

	public void setGiveDateSign(String giveDateSign) {
		this.giveDateSign = giveDateSign;
	}

	public String getBidDateSign() {
		return bidDateSign;
	}

	public void setBidDateSign(String bidDateSign) {
		this.bidDateSign = bidDateSign;
	}

	public String getPsort() {
		return psort;
	}

	public void setPsort(String psort) {
		this.psort = psort;
	}

	public String getSsort() {
		return ssort;
	}

	public void setSsort(String ssort) {
		this.ssort = ssort;
	}

	public WorkProject getWorkProject() {
		return workProject;
	}

	public void setWorkProject(WorkProject workProject) {
		this.workProject = workProject;
	}

	public String getProjectMember() {
		return projectMember;
	}

	public void setProjectMember(String projectMember) {
		this.projectMember = projectMember;
	}

	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 List<WorkClientLinkman> getWorkClientLinkmanLists() {
		return workClientLinkmanLists;
	}

	public void setWorkClientLinkmanLists(List<WorkClientLinkman> workClientLinkmanLists) {
		this.workClientLinkmanLists = workClientLinkmanLists;
	}

	public String getOfficeName() {
		return officeName;
	}

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

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

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

	public List<WorkClientAttachment> getWorkAttachmentsprice() {
		return workAttachmentsprice;
	}

	public void setWorkAttachmentsprice(List<WorkClientAttachment> workAttachmentsprice) {
		this.workAttachmentsprice = workAttachmentsprice;
	}

	public BigDecimal getMin() {
		return min;
	}

	public void setMin(BigDecimal min) {
		this.min = min;
	}

	public BigDecimal getMax() {
		return max;
	}

	public void setMax(BigDecimal max) {
		this.max = max;
	}

	public Date getBeginContractDate() {
		return beginContractDate;
	}

	public void setBeginContractDate(Date beginContractDate) {
		this.beginContractDate = beginContractDate;
	}

	public Date getEndContractDate() {
		return endContractDate;
	}

	public void setEndContractDate(Date endContractDate) {
		this.endContractDate = endContractDate;
	}

	public String getSign() {
		return sign;
	}

	public void setSign(String sign) {
		this.sign = sign;
	}

	public List<WorkClientAttachment> getWorkAttachmentsbid() {
		return workAttachmentsbid;
	}

	public void setWorkAttachmentsbid(List<WorkClientAttachment> workAttachmentsbid) {
		this.workAttachmentsbid = workAttachmentsbid;
	}

	public List<WorkClientAttachment> getWorkAttachmentsopenbid() {
		return workAttachmentsopenbid;
	}

	public void setWorkAttachmentsopenbid(List<WorkClientAttachment> workAttachmentsopenbid) {
		this.workAttachmentsopenbid = workAttachmentsopenbid;
	}

	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 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;
	}

	public String getName() {
		return name;
	}

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

	public String getCompanyId() {
		return companyId;
	}

	public void setCompanyId(String companyId) {
		this.companyId = companyId;
	}
	@ExcelField(title="项目规模", align=2, sort=8)
	public String getProjectScale() {
		return projectScale;
	}

	public void setProjectScale(String projectScale) {
		this.projectScale = projectScale;
	}

	@ExcelField(title="规模类型", mainDictType="scale_type", align=2, sort=9)
	public String getScaleType() {
		return scaleType;
	}

	public void setScaleType(String scaleType) {
		this.scaleType = scaleType;
	}

	@ExcelField(title="规模单位", mainDictType="scale_unit", align=2, sort=10)
	public String getScaleUnit() {
		return scaleUnit;
	}

	public void setScaleUnit(String scaleUnit) {
		this.scaleUnit = scaleUnit;
	}

	@ExcelField(title="投资额（万元）", align=2, sort=11)
	public String getInvestMoney() {
		return investMoney;
	}

	public void setInvestMoney(String investMoney) {
		this.investMoney = investMoney;
	}

	public String getBidNumber() {
		return bidNumber;
	}

	public void setBidNumber(String bidNumber) {
		this.bidNumber = bidNumber;
	}

	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	@ExcelField(title="投标保证金交付日期", align=2, sort=23)
	public Date getGiveDate() {
		return giveDate;
	}

	public void setGiveDate(Date giveDate) {
		this.giveDate = giveDate;
	}

	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	@ExcelField(title="创建日期", align=2, sort=34)
	public Date getCreaDates() {
		return creaDates;
	}

	public void setCreaDates(Date creaDates) {
		this.creaDates = creaDates;
	}

	public Office getOffice() {
		return office;
	}

	public void setOffice(Office office) {
		this.office = office;
	}
	@ExcelField(title="业务类型", mainDictType="business_type", align=2, sort=30)
	public String getBusinessType() {
		return businessType;
	}

	public void setBusinessType(String businessType) {
		this.businessType = businessType;
	}
	@ExcelField(title="服务内容", align=2, sort=31)
	public String getServiceContent() {
		return serviceContent;
	}

	public void setServiceContent(String serviceContent) {
		this.serviceContent = serviceContent;
	}

	public String getHome() {
		return home;
	}

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

	public String getProcessInstanceId() {
		return processInstanceId;
	}

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


	private List<Office> deptList = Lists.newArrayList();	//负责人列表

	private List<User> masterList = Lists.newArrayList();	//负责人列表

	public String getParentIds() {
		return parentIds;
	}

	public void setParentIds(String parentIds) {
		this.parentIds = parentIds;
	}

	private List<User> memberList = Lists.newArrayList();	//用户列表

	public WorkBidProjectList() {
		super();
	}

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

	@ExcelField(title="投标编号", align=2, sort=1)
	public String getProjectNumber() {
		return projectNumber;
	}

	public void setProjectNumber(String projectNumber) {
		this.projectNumber = projectNumber;
	}
	
	@ExcelField(title="投标名称", align=2, sort=2)
	public String getProjectName() {
		return projectName;
	}

	public void setProjectName(String projectName) {
		this.projectName = projectName;
	}
	/*dictType*/
	@ExcelField(title="工程分类", mainDictType="contract_type", align=2, sort=3)
	public String getProjectType() {
		return projectType;
	}

	public void setProjectType(String projectType) {
		this.projectType = projectType;
	}
	
	@ExcelField(title="类型说明", align=2, sort=4)
	public String getTypeExplain() {
		return typeExplain;
	}

	public void setTypeExplain(String typeExplain) {
		this.typeExplain = typeExplain;
	}
	
	@ExcelField(title="项目来源", mainDictType="bidProjectSource", align=2, sort=5)
	public String getProjectSource() {
		return projectSource;
	}

	public void setProjectSource(String projectSource) {
		this.projectSource = projectSource;
	}
	
	@ExcelField(title="来源说明", align=2, sort=6)
	public String getSourceExplain() {
		return sourceExplain;
	}

	public void setSourceExplain(String sourceExplain) {
		this.sourceExplain = sourceExplain;
	}
	
	public String getIsExt() {
		return isExt;
	}

	public void setIsExt(String isExt) {
		this.isExt = isExt;
	}
	public WorkClientInfo getBidCompany() {
		return bidCompany;
	}

	public void setBidCompany(WorkClientInfo bidCompany) {
		this.bidCompany = bidCompany;
	}
	@ExcelField(title="内部招标单位", align=2, sort=12)
	public String getBidCompanyName() {
		return bidCompanyName;
	}

	public void setBidCompanyName(String bidCompanyName) {
		this.bidCompanyName = bidCompanyName;
	}
	@ExcelField(title="项目协作部门", align=2, sort=26)
	public String getCoopName() {
		return coopName;
	}

	public void setCoopName(String coopName) {
		this.coopName = coopName;
	}
	@ExcelField(title="备注", align=2, sort=32)
	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}
	@ExcelField(title="创建人", align=2, sort=33)
	public String getCreateByName() {
		return createByName;
	}

	public void setCreateByName(String createByName) {
		this.createByName = createByName;
	}
	@ExcelField(title="外部招标单位", align=2, sort=12)
	public String getExtCompany() {
		return extCompany;
	}

	public void setExtCompany(String extCompany) {
		this.extCompany = extCompany;
	}

	public String getContacts() {
		return Collections3.extractToString(workClientLinkmanList, "id", ",") ;
	}

	public void setContacts(String contacts) {
		this.contacts = contacts;
	}
	
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	@ExcelField(title="报名日期", align=2, sort=14)
	public Date getRegistrationDate() {
		return registrationDate;
	}

	public void setRegistrationDate(Date registrationDate) {
		this.registrationDate = registrationDate;
	}
	
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	@ExcelField(title="投标日期", align=2, sort=15)
	public Date getBidDate() {
		return bidDate;
	}

	public void setBidDate(Date bidDate) {
		this.bidDate = bidDate;
	}
	
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	@ExcelField(title="资审日期", align=2, sort=16)
	public Date getTrialDate() {
		return trialDate;
	}

	public void setTrialDate(Date trialDate) {
		this.trialDate = trialDate;
	}

	@ExcelField(title="资格审查", dictType="trial_type", align=2, sort=17)
	public String getTrialType() {
		return trialType;
	}

	public void setTrialType(String trialType) {
		this.trialType = trialType;
	}

	public Double getDocumentCost() {
		return documentCost;
	}

	public void setDocumentCost(Double documentCost) {
		this.documentCost = documentCost;
	}

	@ExcelField(title="文件费用（元）", align=2, sort=18)
	public String getIncomeMoneyStr() {
		if(this.documentCost!=null){
			return String.valueOf(this.documentCost);
		}else{
			return "";
		}
	}
	public void setIncomeMoneyStr(String incomeMoneyStr) {
		this.incomeMoneyStr = incomeMoneyStr;
	}

	public Date getPurchaseDate() {
		return purchaseDate;
	}

	public void setPurchaseDate(Date purchaseDate) {
		this.purchaseDate = purchaseDate;
	}
	
	public Double getBindCost() {
		return bindCost;
	}

	public void setBindCost(Double bindCost) {
		this.bindCost = bindCost;
	}
	
	public Double getOtherCost() {
		return otherCost;
	}

	public void setOtherCost(Double otherCost) {
		this.otherCost = otherCost;
	}
	
	@ExcelField(title="投标保证金（元）", align=2, sort=19)
	public String getBidBond() {
		return bidBond;
	}

	public void setBidBond(String bidBond) {
		this.bidBond = bidBond;
	}

	@ExcelField(title="投标保证金形式", mainDictType="bond_style", align=2, sort=20)
	public String getBondStyle() {
		return bondStyle;
	}

	public void setBondStyle(String bondStyle) {
		this.bondStyle = bondStyle;
	}
	
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	@ExcelField(title="投标保证金退还时间", align=2, sort=24)
	public Date getRefundDate() {
		return refundDate;
	}

	public void setRefundDate(Date refundDate) {
		this.refundDate = refundDate;
	}
	
	public Double getOffer() {
		return offer;
	}

	public void setOffer(Double offer) {
		this.offer = offer;
	}
	@ExcelField(title="是否联合体投标", dictType="is_bid", align=2, sort=27)
	public String getIsBid() {
		return isBid;
	}

	public void setIsBid(String isBid) {
		this.isBid = isBid;
	}

	public String getImplementingDept() {
		return implementingDept;
	}

	public void setImplementingDept(String implementingDept) {
		this.implementingDept = implementingDept;
	}
	
	public String getProjectMaster() {
		return projectMaster;
	}

	public void setProjectMaster(String projectMaster) {
		this.projectMaster = projectMaster;
	}
	
	public String getIsSubcontract() {
		return isSubcontract;
	}

	public void setIsSubcontract(String isSubcontract) {
		this.isSubcontract = isSubcontract;
	}
	@ExcelField(title="对外协作单位", align=2, sort=29)
	public String getSubcontractCompany() {
		return subcontractCompany;
	}

	public void setSubcontractCompany(String subcontractCompany) {
		this.subcontractCompany = subcontractCompany;
	}
	
	@ExcelField(title="项目概况", align=2, sort=31)
	public String getProjectSituation() {
		return projectSituation;
	}

	public void setProjectSituation(String projectSituation) {
		this.projectSituation = projectSituation;
	}

	@ExcelField(title="投标状态", dictType="audit_state", align=2, sort=3)
	public String getStatus() {
		return status;
	}

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

	public List<WorkClientLinkman> getWorkClientLinkmanList() {
		return workClientLinkmanList;
	}

	public void setWorkClientLinkmanList(List<WorkClientLinkman> workClientLinkmanList) {
		this.workClientLinkmanList = workClientLinkmanList;
	}
	
	public String getProjectMemberIds() {
		return Collections3.extractToString(memberList, "id", ",") ;
	}

	public void setProjectMemberIds(String projectMember) {
		this.memberList = Lists.newArrayList();
		for (String id : StringUtils.split(projectMember, ",")){
			this.memberList.add(new User(id));
		}
	}

	/**
	 * 用户Name
	 * @return
	 */
	public String getProjectMemberNames() {
		return Collections3.extractToString(memberList, "name", ",") ;
	}
	
	/**
	 * 设置用户Name
	 * @return
	 */
	public void setProjectMemberNames(String projectMember) {
		// 什么也不做
	}

	public List<User> getMasterList() {
		return masterList;
	}

	public void setMasterList(List<User> masterList) {
		this.masterList = masterList;
	}
	
	
	public String getProjectMasterIds() {
		return Collections3.extractToString(masterList, "id", ",") ;
	}

	public void setProjectMasterIds(String projectMaster) {
		this.masterList = Lists.newArrayList();
		for (String id : StringUtils.split(projectMaster, ",")){
			this.masterList.add(new User(id));
		}
	}
	
	/**
	 * 用户Name
	 * @return
	 */
	public String getProjectMasterNames() {
		return Collections3.extractToString(masterList, "name", ",") ;
	}
	
	/**
	 * 设置用户Name
	 * @return
	 */
	public void setProjectMasterNames(String projectMaster) {
		// 什么也不做
	}

	public String getImplementingDeptIds() {
		return Collections3.extractToString(deptList, "id", ",") ;
	}

	public void setImplementingDeptIds(String dept) {
		this.deptList = Lists.newArrayList();
		for (String id : StringUtils.split(dept, ",")){
			this.deptList.add(new Office(id));
		}
	}
	
	/**
	 * 用户Name
	 * @return
	 */
	public String getImplementingDeptNames() {
		return Collections3.extractToString(deptList, "name", ",") ;
	}
	
	/**
	 * 设置用户Name
	 * @return
	 */
	public void setImplementingDeptNames(String dept) {
		// 什么也不做
	}
	
	public List<Office> getDeptList() {
		return deptList;
	}

	public void setDeptList(List<Office> deptList) {
		this.deptList = deptList;
	}

	public List<User> getMemberList() {
		return memberList;
	}

	public void setMemberList(List<User> memberList) {
		this.memberList = memberList;
	}

	public String getQueryCon() {
		return queryCon;
	}

	public void setQueryCon(String queryCon) {
		this.queryCon = queryCon;
	}

	public String getOfficeId() {
		return officeId;
	}

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