package com.goafanti.order.bo;

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

import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.time.DateFormatUtils;

import com.goafanti.common.constant.AFTConstants;
import com.goafanti.common.model.TOrderNew;
import com.goafanti.order.enums.NewOrderDunType;
import com.goafanti.order.enums.OrderDunSubject;

public class TOrderNewBo extends TOrderNew{
	private String id;
	private String signDate;
	private String userName;
	private String salesmanName;
	private String financeName;
	private String consultantName;
	private String dunSubject;
	private String startDate;
	private String financeMobile;
	private String salesmanMobile;
	private Integer backStatus;
	private String initiateName;
	private String reason;
	private String backDate;
	private String backId;
	private String uid;
	private String email;
	private String depName;
	//应收款
	private BigDecimal accountsReceivable;
	private BigDecimal uncollectedAmount;
	private Integer locationProvince;
	private Integer locationCity;
	private Integer locationArea;
	private String postalAddress;
	private BigDecimal invoiceAmount;
	private String NowFinance;
	private String  NowFinanceMobile;
	private String oldSalesmanName;
	private String oldSalesmanMobile;
	private Integer projectType;
	private Integer dunType;
	private Integer dunStatus;
	private BigDecimal appropriationRatio;
	private BigDecimal setUpAmount;
	
	private List<?> dunList;
	private List<?> taskList;
	/**
	 * 是否变更 0否 1是
	 */
	private Integer ischange;
	
	public String getDunSubject() {
		if(getDunType()!=null&&getProjectType()!=null)return NewOrderDunType.getValueByCode(Integer.valueOf(""+getProjectType()+getDunType()));
		if(dunSubject!=null)return OrderDunSubject.getValueByCode(Integer.valueOf(dunSubject));
		return dunSubject;
	}
	public Integer getLocationProvince() {
		return locationProvince;
	}

	public void setLocationProvince(Integer locationProvince) {
		this.locationProvince = locationProvince;
	}

	public Integer getLocationCity() {
		return locationCity;
	}

	public void setLocationCity(Integer locationCity) {
		this.locationCity = locationCity;
	}

	public Integer getLocationArea() {
		return locationArea;
	}

	public void setLocationArea(Integer locationArea) {
		this.locationArea = locationArea;
	}

	public String getPostalAddress() {
		return postalAddress;
	}

	public void setPostalAddress(String postalAddress) {
		this.postalAddress = postalAddress;
	}

	public String getSignDate() {
		if (StringUtils.isBlank(signDate)&&super.getSignTime()!=null) {
			return DateFormatUtils.format(super.getSignTime(), AFTConstants.YYYYMMDD);
		}
		return signDate;
	}

	public void setSignDate(String signDate) {
		this.signDate = signDate;
	}

	public String getUserName() {
		return userName;
	}

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

	public String getSalesmanName() {
		return salesmanName;
	}

	public void setSalesmanName(String salesmanName) {
		this.salesmanName = salesmanName;
	}

	public String getFinanceName() {
		return financeName;
	}

	public void setFinanceName(String financeName) {
		this.financeName = financeName;
	}

	public String getCreateDate() {
		if (super.getCreateTime() == null) {
			return null;
		} else {
			return DateFormatUtils.format(super.getCreateTime(), AFTConstants.YYYYMMDDHHMMSS);
		}
	}
	
	public String getUpdateDate() {
		if (super.getUpdateTime() == null) {
			return null;
		} else {
			return DateFormatUtils.format(super.getUpdateTime(), AFTConstants.YYYYMMDDHHMMSS);
		}
	}

	public String getStartDate() {
		return startDate;
	}

	public void setStartDate(String startDate) {
		this.startDate = startDate;
	}

	/*public String getDunSubject() {
		return dunSubject;
	}*/

	public void setDunSubject(String dunSubject) {
		this.dunSubject = dunSubject;
	}

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getFinanceMobile() {
		return financeMobile;
	}

	public void setFinanceMobile(String financeMobile) {
		this.financeMobile = financeMobile;
	}

	public String getSalesmanMobile() {
		return salesmanMobile;
	}

	public void setSalesmanMobile(String salesmanMobile) {
		this.salesmanMobile = salesmanMobile;
	}

	public Integer getBackStatus() {
		return backStatus;
	}

	public void setBackStatus(Integer backStatus) {
		this.backStatus = backStatus;
	}

	public String getInitiateName() {
		return initiateName;
	}

	public void setInitiateName(String initiateName) {
		this.initiateName = initiateName;
	}

	public String getReason() {
		return reason;
	}

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

	public String getBackDate() {
		return backDate;
	}

	public void setBackDate(String backDate) {
		this.backDate = backDate;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}
	public String getUid() {
		return uid;
	}

	public void setUid(String uid) {
		this.uid = uid;
	}

	public String getConsultantName() {
		return consultantName;
	}

	public void setConsultantName(String consultantName) {
		this.consultantName = consultantName;
	}

	public String getBackId() {
		return backId;
	}

	public void setBackId(String backId) {
		this.backId = backId;
	}

	public String getDepName() {
		return depName;
	}

	public void setDepName(String depName) {
		this.depName = depName;
	}

	public BigDecimal getAccountsReceivable() {
		if(getDunSubject()!=null&&getDunSubject().equals("33")&&accountsReceivable==null&&appropriationRatio !=null &&setUpAmount!=null) {
			return setUpAmount.multiply(accountsReceivable);
		}
		return accountsReceivable;
	}

	public void setAccountsReceivable(BigDecimal accountsReceivable) {
		this.accountsReceivable = accountsReceivable;
	}

	public BigDecimal getUncollectedAmount() {
		return uncollectedAmount;
	}

	public void setUncollectedAmount(BigDecimal uncollectedAmount) {
		this.uncollectedAmount = uncollectedAmount;
	}

	public String getNowFinance() {
		return NowFinance;
	}

	public void setNowFinance(String nowFinance) {
		NowFinance = nowFinance;
	}

	public String getNowFinanceMobile() {
		return NowFinanceMobile;
	}

	public void setNowFinanceMobile(String nowFinanceMobile) {
		NowFinanceMobile = nowFinanceMobile;
	}

	public String getOldSalesmanName() {
		return oldSalesmanName;
	}

	public void setOldSalesmanName(String oldSalesmanName) {
		this.oldSalesmanName = oldSalesmanName;
	}

	public String getOldSalesmanMobile() {
		return oldSalesmanMobile;
	}

	public void setOldSalesmanMobile(String oldSalesmanMobile) {
		this.oldSalesmanMobile = oldSalesmanMobile;
	}
	public Integer getProjectType() {
		return projectType;
	}
	public void setProjectType(Integer projectType) {
		this.projectType = projectType;
	}
	public Integer getDunType() {
		return dunType;
	}
	public void setDunType(Integer dunType) {
		this.dunType = dunType;
	}
	public Integer getDunStatus() {
		return dunStatus;
	}
	public void setDunStatus(Integer dunStatus) {
		this.dunStatus = dunStatus;
	}
	public BigDecimal getInvoiceAmount() {
		if (invoiceAmount==null) {
			return new BigDecimal(0);
		}
		return invoiceAmount;
	}
	public void setInvoiceAmount(BigDecimal invoiceAmount) {
		this.invoiceAmount = invoiceAmount;
	}
	public BigDecimal getAppropriationRatio() {
		return appropriationRatio;
	}
	public void setAppropriationRatio(BigDecimal appropriationRatio) {
		this.appropriationRatio = appropriationRatio;
	}
	public BigDecimal getSetUpAmount() {
		return setUpAmount;
	}
	public void setSetUpAmount(BigDecimal setUpAmount) {
		this.setUpAmount = setUpAmount;
	}
	public Integer getIschange() {
		return ischange;
	}
	public void setIschange(Integer ischange) {
		this.ischange = ischange;
	}
	public List<?> getDunList() {
		return dunList;
	}
	public void setDunList(List<?> dunList) {
		this.dunList = dunList;
	}
	public List<?> getTaskList() {
		return taskList;
	}
	public void setTaskList(List<?> taskList) {
		this.taskList = taskList;
	}
	
}
