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

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

/**
 * 编号:C0018
 * 表名:cg_important_event
 * 名称:重大事件
 */
public class CgImportantEvent {

    // 事件名称
    private String event_name;
    // 事件发生日期
    private String event_date;
    // 发生地点
    private String event_site;
    // 事件分级
    private String event_level;
    // 事件类型
    private String event_type;
    // 区域全名称(/隔开)
    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 getevent_name() {
        return event_name;
    }
    
    public void setevent_name(String event_name) {
        this.event_name = event_name;
    }
    
    public String getevent_date() {
        return event_date;
    }
    
    public void setevent_date(String event_date) {
        this.event_date = event_date;
    }
    
    public String getevent_site() {
        return event_site;
    }
    
    public void setevent_site(String event_site) {
        this.event_site = event_site;
    }
    
    public String getevent_level() {
        return event_level;
    }
    
    public void setevent_level(String event_level) {
        this.event_level = event_level;
    }
    
    public String getevent_type() {
        return event_type;
    }
    
    public void setevent_type(String event_type) {
        this.event_type = event_type;
    }
    
    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(event_name)) {
            throw new ParamsException("事件名称名不能为空");
        }
        if(event_name != null && event_name.length() > 255 ) {
            throw new ParamsException("事件名称超出长度");
        }
        if(StringUtils.isEmpty(event_date)) {
            throw new ParamsException("事件发生日期名不能为空");
        }
        if(event_date != null && event_date.length() > 20 ) {
            throw new ParamsException("事件发生日期超出长度");
        }
        if(StringUtils.isEmpty(event_site)) {
            throw new ParamsException("发生地点名不能为空");
        }
        if(event_site != null && event_site.length() > 255 ) {
            throw new ParamsException("发生地点超出长度");
        }
        if(StringUtils.isEmpty(event_level)) {
            throw new ParamsException("事件分级名不能为空");
        }
        if(event_level != null && event_level.length() > 50 ) {
            throw new ParamsException("事件分级超出长度");
        }
        if(StringUtils.isEmpty(event_type)) {
            throw new ParamsException("事件类型名不能为空");
        }
        if(event_type != null && event_type.length() > 50 ) {
            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);
    }
    
}
