package com.xintong.visualinspection.bean;

import lombok.Data;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
 * 文件名：Job
 * 版本信息：日期：2017/4/18 Copyright 江苏省交通规划设计院 Corporation 2017 版权所有.
 */
@Data
public class FwqStatisticsBo implements Serializable {
    //编号
    private Integer id;

    // 部门id
    private Long dept_id;

    private String name;

    private int checked_num = 0;

    private int checked_m_num = 0;

    private int check_all_m_score = 0;

    private int check_all_score = 0;

    private List<String> checked_socre_name = new ArrayList<String>();

    private List<Integer> checked_score = new ArrayList<Integer>();

    private List<Integer> emp_item_score = new ArrayList<Integer>();

    private String check_score_avg;

    private String check_score;

    // 公司排名
    private Integer company_ranking;

    // 道管排名
    private Integer center_ranking;

    // 服务区排名
    private Integer service_area_ranking;

    private int score = 0;

    private Integer check_t_num = 0;

    private Integer check_t_score = 0;

    private Integer check_x_num = 0;

    private Integer check_x_score = 0;

    private Integer check_s_num = 0;

    private Integer check_s_score = 0;

    private Integer check_all_num = 0;

    private Integer period_id;

    // 比较大小 1 小 ， -1 大
    public int compareTo(FwqStatisticsBo o2) {
        double a = 1000.0, b = 1000.0;
        int a_c = this.getChecked_num() + this.getChecked_m_num();
        int b_c = o2.getChecked_num() + o2.getChecked_m_num();
        if (a_c != 0) {
            a = (this.getCheck_all_score() + this.getCheck_all_m_score()) / (a_c + 0.00);
        }
        if (b_c != 0) {
            b = (o2.getCheck_all_score() + o2.getCheck_all_m_score()) / (b_c + 0.00);
        }

        if (a > b) {
            return 1;
        } else if (a < b) {
            return -1;
        } else {
            if (a_c == 0 && b_c != 0) {
                return -1;
            } else if (b_c == 0 && a_c != 0) {
                return 1;
            } else {
                return 0;
            }
        }
    }

    public int compareTo2(FwqStatisticsBo o2) {
        double a = 1000.0, b = 1000.0;
        int a_c = this.getCheck_all_num();
        int b_c = o2.getCheck_all_num();
        if (a_c != 0) {
            a = (this.getCheck_all_score()) / (a_c + 0.00);
        }
        if (b_c != 0) {
            b = (o2.getCheck_all_score()) / (b_c + 0.00);
        }

        if (a > b) {
            return 1;
        } else if (a < b) {
            return -1;
        } else {
            if (a_c == 0 && b_c != 0) {
                return -1;
            } else if (b_c == 0 && a_c != 0) {
                return 1;
            } else {
                return 0;
            }
        }
    }

    public int compareTo3(FwqStatisticsBo o2) {
        double a = 1000.0, b = 1000.0;
        double a_c = this.getCheck_all_num();
        double b_c = o2.getCheck_all_num();
        if (a_c != 0) {
            a = Double.parseDouble(this.getCheck_score_avg());
        }
        if (b_c != 0) {
            b = Double.parseDouble(o2.getCheck_score_avg());
        }

        if (a > b) {
            return 1;
        } else if (a < b) {
            return -1;
        } else {
            if (a_c == 0 && b_c != 0) {
                return -1;
            } else if (b_c == 0 && a_c != 0) {
                return 1;
            } else {
                return 0;
            }
        }
    }

}
