package com.sa.ibiz.demo.demoapp.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.UserRoleData;
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 UserRoleData_EditForm_Main{

    @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 userroledataid;
    @JsonIgnore
    private String userroledataname;
    @JsonIgnore
    private String srftempmode;
    @JsonProperty
    private String srfuf;
    @JsonProperty
    private String srfdeid;
    @JsonProperty(access=Access.WRITE_ONLY)
    private String srfsourcekey;
    @JsonIgnore
    private String dename;
    @JsonIgnore
    private Integer isalldata;
    @JsonIgnore
    private Integer orgdr;
    @JsonIgnore
    private String dstorgname;
    @JsonIgnore
    private Integer secdr;
    @JsonIgnore
    private String dstorgsectorname;
    @JsonIgnore
    private Integer bcdr;
    @JsonIgnore
    private String dstsecbc;
    @JsonIgnore
    private Integer userdr;
    @JsonIgnore
    private String memo;
    @JsonIgnore
    private String deid;
    @JsonIgnore
    private String dstorgsectorid;
    @JsonIgnore
    private String dstorgid;

    @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 userroledataid;
    }
    @JsonProperty(value = "srfkey")
    public void setSrfkey(String userroledataid){
        this.userroledataid = userroledataid;
    }

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

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

    @NotBlank(message = "[数据对象]不允许为空!")
    @Size(min = 0, max = 200, message = "[数据对象]长度必须在[200]以内!")
    @JsonProperty(value = "dename")
    public String getDename(){
        return dename;
    }
    @JsonProperty(value = "dename")
    public void setDename(String dename){
        this.dename = dename;
    }

    @NotBlank(message = "[能力名称]不允许为空!")
    @Size(min = 0, max = 200, message = "[能力名称]长度必须在[200]以内!")
    @JsonProperty(value = "userroledataname")
    public String getUserroledataname(){
        return userroledataname;
    }
    @JsonProperty(value = "userroledataname")
    public void setUserroledataname(String userroledataname){
        this.userroledataname = userroledataname;
    }

    @NotNull(message = "[全部数据]不允许为空!")
    @JsonProperty(value = "isalldata")
    public Integer getIsalldata(){
        return isalldata;
    }
    @JsonProperty(value = "isalldata")
    public void setIsalldata(Integer isalldata){
        this.isalldata = isalldata;
    }

    @JsonProperty(value = "orgdr")
    public Integer getOrgdr(){
        return orgdr;
    }
    @JsonProperty(value = "orgdr")
    public void setOrgdr(Integer orgdr){
        this.orgdr = orgdr;
    }

    @Size(min = 0, max = 200, message = "[指定当前机构]长度必须在[200]以内!")
    @JsonProperty(value = "dstorgname")
    public String getDstorgname(){
        return dstorgname;
    }
    @JsonProperty(value = "dstorgname")
    public void setDstorgname(String dstorgname){
        this.dstorgname = dstorgname;
    }

    @JsonProperty(value = "secdr")
    public Integer getSecdr(){
        return secdr;
    }
    @JsonProperty(value = "secdr")
    public void setSecdr(Integer secdr){
        this.secdr = secdr;
    }

    @Size(min = 0, max = 200, message = "[指定当前部门]长度必须在[200]以内!")
    @JsonProperty(value = "dstorgsectorname")
    public String getDstorgsectorname(){
        return dstorgsectorname;
    }
    @JsonProperty(value = "dstorgsectorname")
    public void setDstorgsectorname(String dstorgsectorname){
        this.dstorgsectorname = dstorgsectorname;
    }

    @JsonProperty(value = "bcdr")
    public Integer getBcdr(){
        return bcdr;
    }
    @JsonProperty(value = "bcdr")
    public void setBcdr(Integer bcdr){
        this.bcdr = bcdr;
    }

    @Size(min = 0, max = 100, message = "[指定部门业务类型]长度必须在[100]以内!")
    @JsonProperty(value = "dstsecbc")
    public String getDstsecbc(){
        return dstsecbc;
    }
    @JsonProperty(value = "dstsecbc")
    public void setDstsecbc(String dstsecbc){
        this.dstsecbc = dstsecbc;
    }

    @JsonProperty(value = "userdr")
    public Integer getUserdr(){
        return userdr;
    }
    @JsonProperty(value = "userdr")
    public void setUserdr(Integer userdr){
        this.userdr = userdr;
    }

    @Size(min = 0, max = 2000, message = "[备注]长度必须在[2000]以内!")
    @JsonProperty(value = "memo")
    public String getMemo(){
        return memo;
    }
    @JsonProperty(value = "memo")
    public void setMemo(String memo){
        this.memo = memo;
    }

    @Size(min = 0, max = 200, message = "[数据实体]长度必须在[200]以内!")
    @JsonProperty(value = "deid")
    public String getDeid(){
        //输出获取外键值方法-用于通过parentdata关系填充外键值id
        if(StringUtils.isEmpty(deid) && this.getSrfparentdata() != null)
        {
            if(this.getSrfparentdata().containsKey("srfparentmode")&& this.getSrfparentdata().get("srfparentmode").equals("DER1N_USERROLEDATA_DATAENTITY_DEID"))
                this.deid=this.getSrfparentdata().get("srfparentkey");
        }
        return deid;
    }
    @JsonProperty(value = "deid")
    public void setDeid(String deid){
        this.deid = deid;
    }

    @Size(min = 0, max = 100, message = "[数据对象能力标识]长度必须在[100]以内!")
    @JsonProperty(value = "userroledataid")
    public String getUserroledataid(){
        return userroledataid;
    }
    @JsonProperty(value = "userroledataid")
    public void setUserroledataid(String userroledataid){
        this.userroledataid = userroledataid;
    }

    @Size(min = 0, max = 100, message = "[指定当前部门]长度必须在[100]以内!")
    @JsonProperty(value = "dstorgsectorid")
    public String getDstorgsectorid(){
        //输出获取外键值方法-用于通过parentdata关系填充外键值id
        if(StringUtils.isEmpty(dstorgsectorid) && this.getSrfparentdata() != null)
        {
            if(this.getSrfparentdata().containsKey("srfparentmode")&& this.getSrfparentdata().get("srfparentmode").equals("DER1N_USERROLEDATA_ORGSECTOR_DSTORGSECTORID"))
                this.dstorgsectorid=this.getSrfparentdata().get("srfparentkey");
        }
        return dstorgsectorid;
    }
    @JsonProperty(value = "dstorgsectorid")
    public void setDstorgsectorid(String dstorgsectorid){
        this.dstorgsectorid = dstorgsectorid;
    }

    @Size(min = 0, max = 100, message = "[指定当前机构]长度必须在[100]以内!")
    @JsonProperty(value = "dstorgid")
    public String getDstorgid(){
        //输出获取外键值方法-用于通过parentdata关系填充外键值id
        if(StringUtils.isEmpty(dstorgid) && this.getSrfparentdata() != null)
        {
            if(this.getSrfparentdata().containsKey("srfparentmode")&& this.getSrfparentdata().get("srfparentmode").equals("DER1N_USERROLEDATA_ORG_DSTORGID"))
                this.dstorgid=this.getSrfparentdata().get("srfparentkey");
        }
        return dstorgid;
    }
    @JsonProperty(value = "dstorgid")
    public void setDstorgid(String dstorgid){
        this.dstorgid = dstorgid;
    }

    public  void fromUserRoleData(UserRoleData sourceEntity)  {
        this.fromUserRoleData(sourceEntity,true);
    }

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

    /**
	 * vo转换为do
	 * @param
	 * @return
	 */
    public  UserRoleData toUserRoleData()  {
        UserRoleData targetEntity =new UserRoleData();
        BeanCopier copier=BeanCopier.create(UserRoleData_EditForm_Main.class, UserRoleData.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;
    }

}
