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.LoginAccount;
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 LoginAccount_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 loginaccountid;
    @JsonIgnore
    private String loginaccountname;
    @JsonIgnore
    private String srftempmode;
    @JsonProperty
    private String srfuf;
    @JsonProperty
    private String srfdeid;
    @JsonProperty(access=Access.WRITE_ONLY)
    private String srfsourcekey;
    @JsonIgnore
    private String username;
    @JsonIgnore
    private String pwd;
    @JsonIgnore
    private Integer isenable;
    @JsonIgnore
    private String appuitheme;
    @JsonIgnore
    private String language;
    @JsonIgnore
    private Timestamp lastlogintime;
    @JsonIgnore
    private String createman;
    @JsonIgnore
    private Timestamp createdate;
    @JsonIgnore
    private String updateman;
    @JsonIgnore
    private String userid;

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

    @Size(min = 0, max = 200, message = "[登录帐户]长度必须在[200]以内!")
    @JsonProperty(value = "srfmajortext")
    public String getSrfmajortext(){
        return loginaccountname;
    }

    @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 = "username")
    public String getUsername(){
        return username;
    }
    @JsonProperty(value = "username")
    public void setUsername(String username){
        this.username = username;
    }

    @NotBlank(message = "[登录帐户]不允许为空!")
    @Size(min = 0, max = 200, message = "[登录帐户]长度必须在[200]以内!")
    @JsonProperty(value = "loginaccountname")
    public String getLoginaccountname(){
        return loginaccountname;
    }
    @JsonProperty(value = "loginaccountname")
    public void setLoginaccountname(String loginaccountname){
        this.loginaccountname = loginaccountname;
    }

    @Size(min = 0, max = 100, message = "[登录密码]长度必须在[100]以内!")
    @JsonProperty(value = "pwd")
    public String getPwd(){
        return pwd;
    }
    @JsonProperty(value = "pwd")
    public void setPwd(String pwd){
        this.pwd = pwd;
    }

    @NotNull(message = "[是否启用]不允许为空!")
    @JsonProperty(value = "isenable")
    public Integer getIsenable(){
        return isenable;
    }
    @JsonProperty(value = "isenable")
    public void setIsenable(Integer isenable){
        this.isenable = isenable;
    }

    @Size(min = 0, max = 100, message = "[应用界面主题]长度必须在[100]以内!")
    @JsonProperty(value = "appuitheme")
    public String getAppuitheme(){
        return appuitheme;
    }
    @JsonProperty(value = "appuitheme")
    public void setAppuitheme(String appuitheme){
        this.appuitheme = appuitheme;
    }

    @Size(min = 0, max = 100, message = "[默认语言]长度必须在[100]以内!")
    @JsonProperty(value = "language")
    public String getLanguage(){
        return language;
    }
    @JsonProperty(value = "language")
    public void setLanguage(String language){
        this.language = language;
    }

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

    @Size(min = 0, max = 60, message = "[建立人]长度必须在[60]以内!")
    @JsonProperty(value = "createman")
    public String getCreateman(){
        return createman;
    }
    @JsonProperty(value = "createman")
    public void setCreateman(String createman){
        this.createman = createman;
    }

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

    @Size(min = 0, max = 60, message = "[更新人]长度必须在[60]以内!")
    @JsonProperty(value = "updateman")
    public String getUpdateman(){
        return updateman;
    }
    @JsonProperty(value = "updateman")
    public void setUpdateman(String updateman){
        this.updateman = updateman;
    }

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

    @Size(min = 0, max = 100, message = "[登录帐户标识]长度必须在[100]以内!")
    @JsonProperty(value = "loginaccountid")
    public String getLoginaccountid(){
        return loginaccountid;
    }
    @JsonProperty(value = "loginaccountid")
    public void setLoginaccountid(String loginaccountid){
        this.loginaccountid = loginaccountid;
    }

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

    public  void fromLoginAccount(LoginAccount sourceEntity)  {
        this.fromLoginAccount(sourceEntity,true);
    }

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

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

}
