package cn.com.tenlion.systembase.pojo.dtos.bigdta;

import com.google.gson.Gson;
import ink.wgink.exceptions.ParamsException;
import org.apache.commons.lang3.StringUtils;

/**
 * 编号:C0016
 * 表名:school_key
 * 名称:学校重点人员
 */
public class SchoolKey {

    // 学校名称
    private String school_name;
    // 姓名
    private String full_name;
    // 曾用名
    private String name_used_before;
    // 性别
    private String gender;
    // 危害程度名称
    private String degree_of_harm_name;
    // 是否关注(是/否)
    private String is_follow;
    // 区域全名称(/隔开)
    private String location_all;
    // 区域编码
    private String location_code;
    // 区域旗县区名称
    private String location_area;
    // 经度
    private String longitude;
    // 纬度
    private String latitude;
    // 网格名称
    private String grid_name;
    // 网格编码
    private String grid_code;

    public String getschool_name() {
        return school_name;
    }
    
    public void setschool_name(String school_name) {
        this.school_name = school_name;
    }
    
    public String getfull_name() {
        return full_name;
    }
    
    public void setfull_name(String full_name) {
        this.full_name = full_name;
    }
    
    public String getname_used_before() {
        return name_used_before;
    }
    
    public void setname_used_before(String name_used_before) {
        this.name_used_before = name_used_before;
    }
    
    public String getgender() {
        return gender;
    }
    
    public void setgender(String gender) {
        this.gender = gender;
    }
    
    public String getdegree_of_harm_name() {
        return degree_of_harm_name;
    }
    
    public void setdegree_of_harm_name(String degree_of_harm_name) {
        this.degree_of_harm_name = degree_of_harm_name;
    }
    
    public String getis_follow() {
        return is_follow;
    }
    
    public void setis_follow(String is_follow) {
        this.is_follow = is_follow;
    }
    
    public String getlocation_all() {
        return location_all;
    }
    
    public void setlocation_all(String location_all) {
        this.location_all = location_all;
    }
    
    public String getlocation_code() {
        return location_code;
    }
    
    public void setlocation_code(String location_code) {
        this.location_code = location_code;
    }
    
    public String getlocation_area() {
        return location_area;
    }
    
    public void setlocation_area(String location_area) {
        this.location_area = location_area;
    }
    
    public String getlongitude() {
        return longitude;
    }
    
    public void setlongitude(String longitude) {
        this.longitude = longitude;
    }
    
    public String getlatitude() {
        return latitude;
    }
    
    public void setlatitude(String latitude) {
        this.latitude = latitude;
    }
    
    public String getgrid_name() {
        return grid_name;
    }
    
    public void setgrid_name(String grid_name) {
        this.grid_name = grid_name;
    }
    
    public String getgrid_code() {
        return grid_code;
    }
    
    public void setgrid_code(String grid_code) {
        this.grid_code = grid_code;
    }
    

    // 保存校验并转Json
    public String saveCheckToJson() {
        if(StringUtils.isEmpty(school_name)) {
            throw new ParamsException("学校名称名不能为空");
        }
        if(school_name != null && school_name.length() > 255 ) {
            throw new ParamsException("学校名称超出长度");
        }
        if(full_name != null && full_name.length() > 20 ) {
            throw new ParamsException("姓名超出长度");
        }
        if(name_used_before != null && name_used_before.length() > 20 ) {
            throw new ParamsException("曾用名超出长度");
        }
        if(gender != null && gender.length() > 10 ) {
            throw new ParamsException("性别超出长度");
        }
        if(StringUtils.isEmpty(degree_of_harm_name)) {
            throw new ParamsException("危害程度名称名不能为空");
        }
        if(degree_of_harm_name != null && degree_of_harm_name.length() > 50 ) {
            throw new ParamsException("危害程度名称超出长度");
        }
        if(StringUtils.isEmpty(is_follow)) {
            throw new ParamsException("是否关注(是/否)名不能为空");
        }
        if(is_follow != null && is_follow.length() > 10 ) {
            throw new ParamsException("是否关注(是/否)超出长度");
        }
        if(StringUtils.isEmpty(location_all)) {
            throw new ParamsException("区域全名称(/隔开)名不能为空");
        }
        if(location_all != null && location_all.length() > 255 ) {
            throw new ParamsException("区域全名称(/隔开)超出长度");
        }
        if(StringUtils.isEmpty(location_code)) {
            throw new ParamsException("区域编码名不能为空");
        }
        if(location_code != null && location_code.length() > 100 ) {
            throw new ParamsException("区域编码超出长度");
        }
        if(StringUtils.isEmpty(location_area)) {
            throw new ParamsException("区域旗县区名称名不能为空");
        }
        if(location_area != null && location_area.length() > 100 ) {
            throw new ParamsException("区域旗县区名称超出长度");
        }
        if(StringUtils.isEmpty(longitude)) {
            throw new ParamsException("经度名不能为空");
        }
        if(longitude != null && longitude.length() > 50 ) {
            throw new ParamsException("经度超出长度");
        }
        if(StringUtils.isEmpty(latitude)) {
            throw new ParamsException("纬度名不能为空");
        }
        if(latitude != null && latitude.length() > 50 ) {
            throw new ParamsException("纬度超出长度");
        }
        if(StringUtils.isEmpty(grid_name)) {
            throw new ParamsException("网格名称名不能为空");
        }
        if(grid_name != null && grid_name.length() > 100 ) {
            throw new ParamsException("网格名称超出长度");
        }
        if(StringUtils.isEmpty(grid_code)) {
            throw new ParamsException("网格编码名不能为空");
        }
        if(grid_code != null && grid_code.length() > 100 ) {
            throw new ParamsException("网格编码超出长度");
        }
        return new Gson().toJson(this);
    }

    // 修改转Json
    public String updateToJson() {
        return new Gson().toJson(this);
    }
    
}
