package com.sa.ibiz.demo.mob.controller.demo.vo;

import java.sql.Timestamp;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonProperty.Access;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import lombok.Data;
import org.springframework.util.StringUtils;
import com.sa.ibiz.demo.demo.domain.HT;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import java.util.Map;
import java.util.Date;
import org.springframework.cglib.beans.BeanCopier;
import javax.validation.constraints.Size;
import java.util.UUID;
import org.springframework.cglib.beans.BeanCopier;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.sa.ibiz.demo.ibizutil.security.AuthenticationUser;
import java.math.BigInteger;
import com.alibaba.fastjson.JSONObject;

@Data
@JsonIgnoreProperties(ignoreUnknown = true)
public class HT_EditForm_MobForm{

    @JsonProperty(access=Access.WRITE_ONLY)
    private Map<String,String> srfparentdata;
    @JsonIgnore
    private Timestamp updatedate;
    @JsonProperty(access=Access.WRITE_ONLY)
    private String srforikey;
    @JsonIgnore
    private String htid;
    @JsonIgnore
    private String htname;
    @JsonIgnore
    private String srftempmode;
    @JsonProperty
    private String srfuf;
    @JsonProperty
    private String srfdeid;
    @JsonProperty(access=Access.WRITE_ONLY)
    private String srfsourcekey;
    @JsonIgnore
    private String xmname;
    @JsonIgnore
    private Double xmje;
    @JsonIgnore
    private String dfdw;
    @JsonIgnore
    private String lxdh;
    @JsonIgnore
    private String cgfs;
    @JsonIgnore
    private Double je;
    @JsonIgnore
    private String xmid;

    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss", locale = "zh" , timezone="GMT+8")
    @JsonProperty(value = "srfupdatedate")
    public Timestamp getSrfupdatedate(){
        return updatedate;
    }
    @JsonProperty(value = "srfupdatedate")
    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss", locale = "zh" , timezone="GMT+8")
    public void setSrfupdatedate(Timestamp updatedate){
        this.updatedate = updatedate;
    }

    @JsonProperty(value = "srforikey")
    public String getSrforikey(){
        return srforikey;
    }
    @JsonProperty(value = "srforikey")
    public void setSrforikey(String srforikey){
        this.srforikey = srforikey;
    }

    @Size(min = 0, max = 100, message = "[合同标识]长度必须在[100]以内!")
    @JsonProperty(value = "srfkey")
    public String getSrfkey(){
        return htid;
    }
    @JsonProperty(value = "srfkey")
    public void setSrfkey(String htid){
        this.htid = htid;
    }

    @Size(min = 0, max = 200, message = "[合同名称]长度必须在[200]以内!")
    @JsonProperty(value = "srfmajortext")
    public String getSrfmajortext(){
        return htname;
    }

    @JsonProperty(value = "srftempmode")
    public String getSrftempmode(){
        return srftempmode;
    }
    @JsonProperty(value = "srftempmode")
    public void setSrftempmode(String srftempmode){
        this.srftempmode = srftempmode;
    }

    @JsonProperty(value = "srfdeid")
    public String getSrfdeid(){
        return srfdeid;
    }
    @JsonProperty(value = "srfdeid")
    public void setSrfdeid(String srfdeid){
        this.srfdeid = srfdeid;
    }

    @Size(min = 0, max = 200, message = "[项目名称]长度必须在[200]以内!")
    @JsonProperty(value = "xmname")
    public String getXmname(){
        return xmname;
    }
    @JsonProperty(value = "xmname")
    public void setXmname(String xmname){
        this.xmname = xmname;
    }

    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss", locale = "zh" , timezone="GMT+8")
    @JsonProperty(value = "xmje")
    public Double getXmje(){
        return xmje;
    }
    @JsonProperty(value = "xmje")
    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss", locale = "zh" , timezone="GMT+8")
    public void setXmje(Double xmje){
        this.xmje = xmje;
    }

    @Size(min = 0, max = 200, message = "[合同名称]长度必须在[200]以内!")
    @JsonProperty(value = "htname")
    public String getHtname(){
        return htname;
    }
    @JsonProperty(value = "htname")
    public void setHtname(String htname){
        this.htname = htname;
    }

    @Size(min = 0, max = 100, message = "[对方单位]长度必须在[100]以内!")
    @JsonProperty(value = "dfdw")
    public String getDfdw(){
        return dfdw;
    }
    @JsonProperty(value = "dfdw")
    public void setDfdw(String dfdw){
        this.dfdw = dfdw;
    }

    @Size(min = 0, max = 100, message = "[联系电话]长度必须在[100]以内!")
    @JsonProperty(value = "lxdh")
    public String getLxdh(){
        return lxdh;
    }
    @JsonProperty(value = "lxdh")
    public void setLxdh(String lxdh){
        this.lxdh = lxdh;
    }

    @Size(min = 0, max = 100, message = "[采购方式]长度必须在[100]以内!")
    @JsonProperty(value = "cgfs")
    public String getCgfs(){
        return cgfs;
    }
    @JsonProperty(value = "cgfs")
    public void setCgfs(String cgfs){
        this.cgfs = cgfs;
    }

    @JsonProperty(value = "je")
    public Double getJe(){
        return je;
    }
    @JsonProperty(value = "je")
    public void setJe(Double je){
        this.je = je;
    }

    @Size(min = 0, max = 100, message = "[项目标识]长度必须在[100]以内!")
    @JsonProperty(value = "xmid")
    public String getXmid(){
        //输出获取外键值方法-用于通过parentdata关系填充外键值id
        if(StringUtils.isEmpty(xmid) && this.getSrfparentdata() != null)
        {
            if(this.getSrfparentdata().containsKey("srfparentmode")&& this.getSrfparentdata().get("srfparentmode").equals("DER1N_HT_XM_XMID"))
                this.xmid=this.getSrfparentdata().get("srfparentkey");
        }
        return xmid;
    }
    @JsonProperty(value = "xmid")
    public void setXmid(String xmid){
        this.xmid = xmid;
    }

    @Size(min = 0, max = 100, message = "[合同标识]长度必须在[100]以内!")
    @JsonProperty(value = "htid")
    public String getHtid(){
        return htid;
    }
    @JsonProperty(value = "htid")
    public void setHtid(String htid){
        this.htid = htid;
    }

    public  void fromHT(HT sourceEntity)  {
        this.fromHT(sourceEntity,true);
    }

     /**
	 * do转换为vo
	 * @param sourceEntity do数据对象
	 * @return
	 */
    public  void fromHT(HT sourceEntity,boolean reset)  {
      BeanCopier copier=BeanCopier.create(HT.class, HT_EditForm_MobForm.class, false);
      copier.copy(sourceEntity,this,  null);
      this.toString();
	}

    /**
	 * vo转换为do
	 * @param
	 * @return
	 */
    public  HT toHT()  {
        HT targetEntity =new HT();
        BeanCopier copier=BeanCopier.create(HT_EditForm_MobForm.class, HT.class, false);
        copier.copy(this, targetEntity, null);
        return targetEntity;
	}

     /**
	 * 新建
	 * @param
	 * @return
	 */
    private boolean isCreate()
    {
    	if((StringUtils.isEmpty(this.srfuf))||this.srfuf.equals("0"))
	    	return true;
    	else
    	    return false;
    }
     /**
	 * 更新
	 * @param
	 * @return
	 */
    private boolean isUpdate()
    {
    	if((!StringUtils.isEmpty(this.srfuf))&&this.srfuf.equals("1"))
	    	return true;
    	else
    	    return false;
    }

    /**
     * 表单项更新过滤器 [getXminfo]
     * 只输出表单项更新的明细项
     * @return
     */
    public JSONObject getxminfoFormItemUpdateFilter(){
        JSONObject formItemDetailObj=new JSONObject();
		formItemDetailObj.put("xmje",this.getXmje());
        return formItemDetailObj;
    }
}
