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

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

/**
 * 编号:C0017
 * 表名:stu_tea_safe
 * 名称:学校安全事件
 */
public class StuTeaSafe {

    // 学校名称
    private String school_name;
    // 案(事)件编号
    private String case_code;
    // 案(事)件名称
    private String case_name;
    // 发生日期
    private String happen_time;
    // 发生地点
    private String happen_address;
    // 发生经度
    private String happen_lng;
    // 发生纬度
    private String happen_lat;
    // 案(事)件性质名称
    private String case_nature_name;
    // 案件情况
    private String case_situation;
    // 是否破案(是/否)
    private String is_solve;
    // 作案人数
    private Integer crime_count;
    // 在逃人数
    private Integer at_large_count;
    // 抓捕人数
    private Integer arrest_count;
    // 案件侦破情况
    private String case_solve;
    // 区域全名称(/隔开)
    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 getcase_code() {
        return case_code;
    }
    
    public void setcase_code(String case_code) {
        this.case_code = case_code;
    }
    
    public String getcase_name() {
        return case_name;
    }
    
    public void setcase_name(String case_name) {
        this.case_name = case_name;
    }
    
    public String gethappen_time() {
        return happen_time;
    }
    
    public void sethappen_time(String happen_time) {
        this.happen_time = happen_time;
    }
    
    public String gethappen_address() {
        return happen_address;
    }
    
    public void sethappen_address(String happen_address) {
        this.happen_address = happen_address;
    }
    
    public String gethappen_lng() {
        return happen_lng;
    }
    
    public void sethappen_lng(String happen_lng) {
        this.happen_lng = happen_lng;
    }
    
    public String gethappen_lat() {
        return happen_lat;
    }
    
    public void sethappen_lat(String happen_lat) {
        this.happen_lat = happen_lat;
    }
    
    public String getcase_nature_name() {
        return case_nature_name;
    }
    
    public void setcase_nature_name(String case_nature_name) {
        this.case_nature_name = case_nature_name;
    }
    
    public String getcase_situation() {
        return case_situation;
    }
    
    public void setcase_situation(String case_situation) {
        this.case_situation = case_situation;
    }
    
    public String getis_solve() {
        return is_solve;
    }
    
    public void setis_solve(String is_solve) {
        this.is_solve = is_solve;
    }
    
    public Integer getcrime_count() {
        return crime_count;
    }

    public void setcrime_count(Integer crime_count) {
        this.crime_count = crime_count;
    }
    
    public Integer getat_large_count() {
        return at_large_count;
    }

    public void setat_large_count(Integer at_large_count) {
        this.at_large_count = at_large_count;
    }
    
    public Integer getarrest_count() {
        return arrest_count;
    }

    public void setarrest_count(Integer arrest_count) {
        this.arrest_count = arrest_count;
    }
    
    public String getcase_solve() {
        return case_solve;
    }
    
    public void setcase_solve(String case_solve) {
        this.case_solve = case_solve;
    }
    
    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(StringUtils.isEmpty(case_code)) {
            throw new ParamsException("案(事)件编号名不能为空");
        }
        if(case_code != null && case_code.length() > 255 ) {
            throw new ParamsException("案(事)件编号超出长度");
        }
        if(StringUtils.isEmpty(case_name)) {
            throw new ParamsException("案(事)件名称名不能为空");
        }
        if(case_name != null && case_name.length() > 255 ) {
            throw new ParamsException("案(事)件名称超出长度");
        }
        if(StringUtils.isEmpty(happen_time)) {
            throw new ParamsException("发生日期名不能为空");
        }
        if(happen_time != null && happen_time.length() > 20 ) {
            throw new ParamsException("发生日期超出长度");
        }
        if(StringUtils.isEmpty(happen_address)) {
            throw new ParamsException("发生地点名不能为空");
        }
        if(happen_address != null && happen_address.length() > 255 ) {
            throw new ParamsException("发生地点超出长度");
        }
        if(StringUtils.isEmpty(happen_lng)) {
            throw new ParamsException("发生经度名不能为空");
        }
        if(happen_lng != null && happen_lng.length() > 50 ) {
            throw new ParamsException("发生经度超出长度");
        }
        if(StringUtils.isEmpty(happen_lat)) {
            throw new ParamsException("发生纬度名不能为空");
        }
        if(happen_lat != null && happen_lat.length() > 50 ) {
            throw new ParamsException("发生纬度超出长度");
        }
        if(StringUtils.isEmpty(case_nature_name)) {
            throw new ParamsException("案(事)件性质名称名不能为空");
        }
        if(case_nature_name != null && case_nature_name.length() > 50 ) {
            throw new ParamsException("案(事)件性质名称超出长度");
        }
        if(StringUtils.isEmpty(case_situation)) {
            throw new ParamsException("案件情况名不能为空");
        }
        if(case_situation != null && case_situation.length() > 500 ) {
            throw new ParamsException("案件情况超出长度");
        }
        if(StringUtils.isEmpty(is_solve)) {
            throw new ParamsException("是否破案(是/否)名不能为空");
        }
        if(is_solve != null && is_solve.length() > 10 ) {
            throw new ParamsException("是否破案(是/否)超出长度");
        }
        if(crime_count == null) {
            throw new ParamsException("作案人数不能为空");
        }
        if(crime_count != null && (""+crime_count).length() > 11 ) {
            throw new ParamsException("作案人数超出长度");
        }
        if(at_large_count == null) {
            throw new ParamsException("在逃人数不能为空");
        }
        if(at_large_count != null && (""+at_large_count).length() > 11 ) {
            throw new ParamsException("在逃人数超出长度");
        }
        if(arrest_count == null) {
            throw new ParamsException("抓捕人数不能为空");
        }
        if(arrest_count != null && (""+arrest_count).length() > 11 ) {
            throw new ParamsException("抓捕人数超出长度");
        }
        if(StringUtils.isEmpty(case_solve)) {
            throw new ParamsException("案件侦破情况名不能为空");
        }
        if(case_solve != null && case_solve.length() > 255 ) {
            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);
    }
    
}
