/**
 * Project Name:nxfd2
 * File Name:BenchmarkUtil.java
 * Package Name:com.hcks.cmfds.action.benchmark
 * Date:2016-6-3下午01:27:58
 * Copyright (c) 2016, chenzhou1025@126.com All Rights Reserved.
 */

package com.gyee.frame.util;

import com.gyee.frame.model.custom.BenchMarkVo;
import com.gyee.frame.model.custom.Tablepar;

import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;


/**
 * ClassName:BenchmarkUtil <br/>
 * Function: TODO ADD FUNCTION. <br/>
 * Reason: TODO ADD REASON. <br/>
 *
 * @author 石林
 * @version
 * @see
 */
public class BenchmarkUtil {

    private final Integer FRACTION = 10;

    public List<BenchMarkVo> getBenchMarkOrder(List<BenchMarkVo> vos) {
        double temp = 0.0;
        int num = 1;
        // 排序发电量
        Collections.sort(vos, new Comparator<BenchMarkVo>() {
            public int compare(BenchMarkVo arg0, BenchMarkVo arg1) {

                return Double.valueOf(arg1.getScadafdl()).compareTo(arg0.getScadafdl()); //升序

            }
        });

        for (int i = 0; i < vos.size(); i++) {
            BenchMarkVo bm = vos.get(i);
            if (i == 0) {
                temp = bm.getScadafdl();
                bm.setScadafdlnum(num);

            } else {
                if (temp == bm.getScadafdl()) {
                    bm.setScadafdlnum(num);
                } else {
                    temp = bm.getScadafdl();
                    num++;
                    bm.setScadafdlnum(num);
                }
            }
        }
        num = 1;
        // 排序欠发损失
        Collections.sort(vos, new Comparator<BenchMarkVo>() {


            public int compare(BenchMarkVo arg0, BenchMarkVo arg1) {

                return Double.valueOf(arg0.getQfss()).compareTo(arg1.getQfss()); //升序
            }
        });

        for (int i = 0; i < vos.size(); i++) {
            BenchMarkVo bm = vos.get(i);
            if (i == 0) {
                temp = bm.getQfss();
                bm.setQfssnum(num);

            } else {
                if (temp == bm.getQfss()) {
                    bm.setQfssnum(num);
                } else {
                    temp = bm.getQfss();
                    num++;
                    bm.setQfssnum(num);
                }
            }
            // bm.setQfssnum(i + 1);
        }
        num = 1;
        // 排序故障损失
        Collections.sort(vos, new Comparator<BenchMarkVo>() {
            public int compare(BenchMarkVo arg0, BenchMarkVo arg1) {

                return Double.valueOf(arg0.getGzss()).compareTo(arg1.getGzss()); //升序
//                int result = 0;
//                if (arg0.getGzss() > arg1.getGzss())
//                    result = 1;
//                else
//                    result = 0;
//                return result;
            }
        });

        for (int i = 0; i < vos.size(); i++) {
            BenchMarkVo bm = vos.get(i);
            if (i == 0) {
                temp = bm.getGzss();
                bm.setGzssnum(num);

            } else {
                if (temp == bm.getGzss()) {
                    bm.setGzssnum(num);
                } else {
                    temp = bm.getGzss();
                    num++;
                    bm.setGzssnum(num);
                }
            }
            // bm.setGzssnum(i + 1);
        }
        num = 1;
        // 排序检修损失
        Collections.sort(vos, new Comparator<BenchMarkVo>() {
            public int compare(BenchMarkVo arg0, BenchMarkVo arg1) {

                return Double.valueOf(arg0.getWhss()).compareTo(arg1.getWhss()); //升序
//                int result = 0;
//                if (arg0.getWhss() > arg1.getWhss())
//                    result = 1;
//                else
//                    result = 0;
//                return result;
            }
        });
        for (int i = 0; i < vos.size(); i++) {
            BenchMarkVo bm = vos.get(i);
            if (i == 0) {
                temp = bm.getWhss();
                bm.setWhssnum(num);

            } else {
                if (temp == bm.getWhss()) {
                    bm.setWhssnum(num);
                } else {
                    temp = bm.getWhss();
                    num++;
                    bm.setWhssnum(num);
                }
            }
            // bm.setWhssnum(i + 1);
        }
        num = 1;
        // 排序限电损失
        Collections.sort(vos, new Comparator<BenchMarkVo>() {
            public int compare(BenchMarkVo arg0, BenchMarkVo arg1) {

                return Double.valueOf(arg0.getXdss()).compareTo(arg1.getXdss()); //升序
//                int result = 0;
//                if (arg0.getXdss() > arg1.getXdss())
//                    result = 1;
//                else
//                    result = 0;
//                return result;
            }
        });
        for (int i = 0; i < vos.size(); i++) {
            BenchMarkVo bm = vos.get(i);
            if (i == 0) {
                temp = bm.getXdss();
                bm.setXdssnum(num);

            } else {
                if (temp == bm.getXdss()) {
                    bm.setXdssnum(num);
                } else {
                    temp = bm.getXdss();
                    num++;
                    bm.setXdssnum(num);
                }
            }
            // bm.setXdssnum(i + 1);
        }
        num = 1;
        // 排序受累损失
        Collections.sort(vos, new Comparator<BenchMarkVo>() {
            public int compare(BenchMarkVo arg0, BenchMarkVo arg1) {

                return Double.valueOf(arg0.getSlss()).compareTo(arg1.getSlss()); //升序
//                int result = 0;
//                if (arg0.getSlss() > arg1.getSlss())
//                    result = 1;
//                else
//                    result = 0;
//                return result;
            }
        });
        for (int i = 0; i < vos.size(); i++) {
            BenchMarkVo bm = vos.get(i);
            if (i == 0) {
                temp = bm.getSlss();
                bm.setSlssnum(num);

            } else {
                if (temp == bm.getSlss()) {
                    bm.setSlssnum(num);
                } else {
                    temp = bm.getSlss();
                    num++;
                    bm.setSlssnum(num);
                }
            }
            // bm.setSlssnum(i + 1);
        }
        num = 1;
        // 排序性能损失率
        Collections.sort(vos, new Comparator<BenchMarkVo>() {
            public int compare(BenchMarkVo arg0, BenchMarkVo arg1) {
                return Double.valueOf(arg0.getXnssl()).compareTo(arg1.getXnssl()); //升序
//                int result = 0;
//                if (arg0.getXnssl() > arg1.getXnssl())
//                    result = 1;
//                else
//                    result = 0;
//                return result;
            }
        });
        for (int i = 0; i < vos.size(); i++) {
            BenchMarkVo bm = vos.get(i);
            if (i == 0) {
                temp = bm.getXnssl();
                bm.setXnsslnum(num);

            } else {
                if (temp == bm.getXnssl()) {
                    bm.setXnsslnum(num);
                } else {
                    temp = bm.getXnssl();
                    num++;
                    bm.setXnsslnum(num);
                }
            }
            // bm.setXnsslnum(i + 1);
        }
        num = 1;
        // 排序弃风率
        Collections.sort(vos, new Comparator<BenchMarkVo>() {
            public int compare(BenchMarkVo arg0, BenchMarkVo arg1) {
                return Double.valueOf(arg0.getQfl()).compareTo(arg1.getQfl()); //升序
//                int result = 0;
//                if (arg0.getQfl() > arg1.getQfl())
//                    result = 1;
//                else
//                    result = 0;
//                return result;
            }
        });

        for (int i = 0; i < vos.size(); i++) {
            BenchMarkVo bm = vos.get(i);
            if (i == 0) {
                temp = bm.getQfl();
                bm.setQflnum(num);

            } else {
                if (temp == bm.getQfl()) {
                    bm.setQflnum(num);
                } else {
                    temp = bm.getQfl();
                    num++;
                    bm.setQflnum(num);
                }
            }
            // bm.setQflnum(i + 1);
        }
        num = 1;
        // 排序故障损失率
        Collections.sort(vos, new Comparator<BenchMarkVo>() {
            public int compare(BenchMarkVo arg0, BenchMarkVo arg1) {

                return Double.valueOf(arg0.getGzssl()).compareTo(arg1.getGzssl()); //升序
//                int result = 0;
//                if (arg0.getGzssl() > arg1.getGzssl())
//                    result = 1;
//                else
//                    result = 0;
//                return result;
            }
        });

        for (int i = 0; i < vos.size(); i++) {
            BenchMarkVo bm = vos.get(i);
            if (i == 0) {
                temp = bm.getGzssl();
                bm.setGzsslnum(num);

            } else {
                if (temp == bm.getGzssl()) {
                    bm.setGzsslnum(num);
                } else {
                    temp = bm.getGzssl();
                    num++;
                    bm.setGzsslnum(num);
                }
            }
            // bm.setGzsslnum(i + 1);
        }
        num = 1;
        // 排序检修损失率
        Collections.sort(vos, new Comparator<BenchMarkVo>() {
            public int compare(BenchMarkVo arg0, BenchMarkVo arg1) {

                return Double.valueOf(arg0.getJxssl()).compareTo(arg1.getJxssl()); //升序
//                int result = 0;
//                if (arg0.getJxssl() > arg1.getJxssl())
//                    result = 1;
//                else
//                    result = 0;
//                return result;
            }
        });

        for (int i = 0; i < vos.size(); i++) {
            BenchMarkVo bm = vos.get(i);
            if (i == 0) {
                temp = bm.getJxssl();
                bm.setJxsslnum(num);

            } else {
                if (temp == bm.getJxssl()) {
                    bm.setJxsslnum(num);
                } else {
                    temp = bm.getJxssl();
                    num++;
                    bm.setJxsslnum(num);
                }
            }
            // bm.setJxsslnum(i + 1);
        }
        num = 1;
        // 排序受累损失率
        Collections.sort(vos, new Comparator<BenchMarkVo>() {
            public int compare(BenchMarkVo arg0, BenchMarkVo arg1) {

                return Double.valueOf(arg0.getSlssl()).compareTo(arg1.getSlssl()); //升序
//                int result = 0;
//                if (arg0.getSlssl() > arg1.getSlssl())
//                    result = 1;
//                else
//                    result = 0;
//                return result;
            }
        });

        for (int i = 0; i < vos.size(); i++) {
            BenchMarkVo bm = vos.get(i);
            if (i == 0) {
                temp = bm.getSlssl();
                bm.setSlsslnum(num);

            } else {
                if (temp == bm.getSlssl()) {
                    bm.setSlsslnum(num);
                } else {
                    temp = bm.getSlssl();
                    num++;
                    bm.setSlsslnum(num);
                }
            }
            // bm.setSlsslnum(i + 1);
        }
        num = 1;
        // 排序风能利用率
        Collections.sort(vos, new Comparator<BenchMarkVo>() {
            public int compare(BenchMarkVo arg0, BenchMarkVo arg1) {

                return Double.valueOf(arg1.getFnlyl()).compareTo(arg0.getFnlyl()); //降序
//                int result = 0;
//                if (arg0.getFnlyl() < arg1.getFnlyl())
//                    result = 1;
//                else
//                    result = 0;
//                return result;
            }
        });

        for (int i = 0; i < vos.size(); i++) {
            BenchMarkVo bm = vos.get(i);
            if (i == 0) {
                temp = bm.getFnlyl();
                bm.setFnlylnum(num);

            } else {
                if (temp == bm.getFnlyl()) {
                    bm.setFnlylnum(num);
                } else {
                    temp = bm.getFnlyl();
                    num++;
                    bm.setFnlylnum(num);
                }
            }
            // bm.setFnlylnum(i + 1);
        }
        num = 1;
        // 排序复位及时率
        Collections.sort(vos, new Comparator<BenchMarkVo>() {
            public int compare(BenchMarkVo arg0, BenchMarkVo arg1) {

                return Double.valueOf(arg1.getFwjsl()).compareTo(arg0.getFwjsl()); //降序
//                int result = 0;
//                if (arg0.getFwjsl() < arg1.getFwjsl())
//                    result = 1;
//                else
//                    result = 0;
//                return result;
            }
        });

        for (int i = 0; i < vos.size(); i++) {
            BenchMarkVo bm = vos.get(i);
            if (i == 0) {
                temp = bm.getFwjsl();
                bm.setFwjslnum(num);

            } else {
                if (temp == bm.getFwjsl()) {
                    bm.setFwjslnum(num);
                } else {
                    temp = bm.getFwjsl();
                    num++;
                    bm.setFwjslnum(num);
                }
            }
            // bm.setFwjslnum(i + 1);
        }
        num = 1;
        // 排序状态转换及时率
        Collections.sort(vos, new Comparator<BenchMarkVo>() {
            public int compare(BenchMarkVo arg0, BenchMarkVo arg1) {

                return Double.valueOf(arg1.getZtzhjsl()).compareTo(arg0.getZtzhjsl()); //降序
//                int result = 0;
//                if (arg0.getZtzhjsl() < arg1.getZtzhjsl())
//                    result = 1;
//                else
//                    result = 0;
//                return result;
            }
        });

        for (int i = 0; i < vos.size(); i++) {
            BenchMarkVo bm = vos.get(i);
            if (i == 0) {
                temp = bm.getZtzhjsl();
                bm.setZtzhjslnum(num);

            } else {
                if (temp == bm.getZtzhjsl()) {
                    bm.setZtzhjslnum(num);
                } else {
                    temp = bm.getZtzhjsl();
                    num++;
                    bm.setZtzhjslnum(num);
                }
            }
            // bm.setZtzhjslnum(i + 1);
        }
        num = 1;
        // 排序状消缺及时率
        Collections.sort(vos, new Comparator<BenchMarkVo>() {
            public int compare(BenchMarkVo arg0, BenchMarkVo arg1) {

                return Double.valueOf(arg1.getXqjsl()).compareTo(arg0.getXqjsl()); //降序
//                int result = 0;
//                if (arg0.getXqjsl() < arg1.getXqjsl())
//                    result = 1;
//                else
//                    result = 0;
//                return result;
            }
        });

        for (int i = 0; i < vos.size(); i++) {
            BenchMarkVo bm = vos.get(i);
            if (i == 0) {
                temp = bm.getXqjsl();
                bm.setXqjslnum(num);

            } else {
                if (temp == bm.getXqjsl()) {
                    bm.setXqjslnum(num);
                } else {
                    temp = bm.getXqjsl();
                    num++;
                    bm.setXqjslnum(num);
                }
            }
            // bm.setXqjslnum(i + 1);
        }

        for (int i = 0; i < vos.size(); i++) {
            BenchMarkVo bm = vos.get(i);
            bm.setTotal(bm.getFnlylnum() + bm.getJxsslnum() + bm.getQflnum() + bm.getGzsslnum() + bm.getSlsslnum() + bm.getXqjslnum() + bm.getFwjslnum() + bm.getZtzhjslnum());
        }

        // 排序综合排名
        Collections.sort(vos, new Comparator<BenchMarkVo>() {
            public int compare(BenchMarkVo arg0, BenchMarkVo arg1) {

                return Integer.valueOf(arg0.getTotal()).compareTo(arg1.getTotal()); //升序
//                int result = 0;
//                if (arg0.getTotal() > arg1.getTotal())
//                    result = 1;
//                else
//                    result = 0;
//                return result;
            }
        });
        for (int i = 0; i < vos.size(); i++) {
            BenchMarkVo bm = vos.get(i);
            bm.setOrdernum(i + 1);
            BigDecimal b1 = new BigDecimal(FRACTION);
            BigDecimal b2 = new BigDecimal(vos.size());

            setTargetFraction(bm, b1, b2, vos);
        }

        return vos;
    }

    private void setTargetFraction(BenchMarkVo bm, BigDecimal b1, BigDecimal b2, List<BenchMarkVo> vos) {
        double frae = b1.divide(b2, 4, RoundingMode.HALF_UP).doubleValue();
        /***************************************************************************/
        if (bm.getFwjsl() <= 100 && bm.getFwjsl() >= 90) {
            bm.setFwjslfraction(10);
        } else if (bm.getFwjsl() < 90 && bm.getFwjsl() >= 60) {
            bm.setFwjslfraction(7);
        } else {
            // 复位及时率打分
            double temp = frae * (vos.size() - bm.getFwjslnum());
            bm.setFwjslfraction(StringUtils.roundToInt(temp));
        }
        /***************************************************************************/
        if (bm.getZtzhjsl() <= 100 && bm.getZtzhjsl() >= 90) {
            bm.setZtzhjslfraction(10);
        } else if (bm.getZtzhjsl() < 90 && bm.getZtzhjsl() >= 60) {
            bm.setZtzhjslfraction(7);
        } else {
            // 状态转换及时率打分
            double temp = frae * (vos.size() - bm.getZtzhjslnum());
            bm.setZtzhjslfraction(StringUtils.roundToInt(temp));
        }
        /***************************************************************************/
        if (bm.getXqjsl() <= 100 && bm.getXqjsl() >= 90) {
            bm.setXqjslfraction(10);
        } else if (bm.getXqjsl() < 90 && bm.getXqjsl() >= 60) {
            bm.setXqjslfraction(7);
        } else {
            // 消缺及时率打分
            double temp = frae * (vos.size() - bm.getXqjslnum());
            bm.setXqjslfraction(StringUtils.roundToInt(temp));
        }
        /***************************************************************************/
        if (bm.getFnlyl() <= 100 && bm.getFnlyl() >= 90) {
            bm.setFnlylfraction(10);
        } else if (bm.getFnlyl() < 90 && bm.getFnlyl() >= 60) {
            bm.setFnlylfraction(7);
        } else {
            // 风能利用率
            double temp = frae * (vos.size() - bm.getFnlylnum());
            bm.setFnlylfraction(StringUtils.roundToInt(temp));
        }
        /***************************************************************************/
        if (bm.getGzssl() <= 10 && bm.getGzssl() >= 0) {
            bm.setGzsslfraction(10);
        } else if (bm.getGzssl() > 10 && bm.getGzssl() <= 60) {
            bm.setGzsslfraction(5);
        } else {
            // 故障损失率
            double temp = frae * (vos.size() - bm.getGzsslnum());
            bm.setGzsslfraction(StringUtils.roundToInt(temp));
        }
        /***************************************************************************/
        if (bm.getJxssl() <= 10 && bm.getJxssl() >= 0) {
            bm.setJxsslfraction(10);
        } else if (bm.getJxssl() > 10 && bm.getJxssl() <= 60) {
            bm.setJxsslfraction(5);
        } else {
            // 检修损失率
            double temp = frae * (vos.size() - bm.getJxsslnum());
            bm.setJxsslfraction(StringUtils.roundToInt(temp));
        }
        /***************************************************************************/
        if (bm.getQfl() <= 10 && bm.getQfl() >= 0) {
            bm.setQflfraction(10);
        } else if (bm.getQfl() > 10 && bm.getQfl() <= 60) {
            bm.setQflfraction(5);
        } else {
            // 弃风率
            double temp = frae * (vos.size() - bm.getQflnum());
            bm.setQflfraction(StringUtils.roundToInt(temp));
        }
        /***************************************************************************/
        if (bm.getXnssl() <= 10 && bm.getXnssl() >= 0) {
            bm.setXnsslfraction(10);
        } else if (bm.getXnssl() > 10 && bm.getXnssl() <= 60) {
            bm.setXnsslfraction(5);
        } else {
            // 性能损失率
            double temp = frae * (vos.size() - bm.getXnsslnum());
            bm.setXnsslfraction(StringUtils.roundToInt(temp));
        }
        /***************************************************************************/
        if (bm.getSlssl() <= 10 && bm.getSlssl() >= 0) {
            bm.setSlsslfraction(10);
        } else if (bm.getSlssl() > 10 && bm.getSlssl() <= 60) {
            bm.setSlsslfraction(5);
        } else {
            // 受累损失率
            double temp = frae * (vos.size() - bm.getSlsslnum());
            bm.setSlsslfraction(StringUtils.roundToInt(temp));
        }
        /***************************************************************************/
    }


    public List<BenchMarkVo> getBenchMarkOrder(List<BenchMarkVo> vos, Tablepar tablepar) {

        switch (tablepar.getOrderByColumn()) {
            case "scadafdl":

                if (tablepar.getIsAsc().equals("asc")) {

                    // 排序发电量
                    Collections.sort(vos, new Comparator<BenchMarkVo>() {
                        public int compare(BenchMarkVo arg0, BenchMarkVo arg1) {

                            return Double.valueOf(arg0.getScadafdl()).compareTo(arg1.getScadafdl());

                        }
                    });

                } else {
                    // 排序发电量
                    Collections.sort(vos, new Comparator<BenchMarkVo>() {
                        public int compare(BenchMarkVo arg0, BenchMarkVo arg1) {

                            return Double.valueOf(arg1.getScadafdl()).compareTo(arg0.getScadafdl());

                        }
                    });

                }
                break; //可选
/**********************************************************************************************/
            case "fnlyl":

                if (tablepar.getIsAsc().equals("asc")) {
                    // 风能利用率
                    Collections.sort(vos, new Comparator<BenchMarkVo>() {
                        public int compare(BenchMarkVo arg0, BenchMarkVo arg1) {

                            return Double.valueOf(arg0.getFnlyl()).compareTo(arg1.getFnlyl());

                        }
                    });


                } else {
                    // 风能利用率
                    Collections.sort(vos, new Comparator<BenchMarkVo>() {
                        public int compare(BenchMarkVo arg0, BenchMarkVo arg1) {

                            return Double.valueOf(arg1.getFnlyl()).compareTo(arg0.getFnlyl());

                        }
                    });

                }
                break; //可选
/**********************************************************************************************/
            case "fwjsl":

                if (tablepar.getIsAsc().equals("asc")) {
                    // 复位及时率
                    Collections.sort(vos, new Comparator<BenchMarkVo>() {
                        public int compare(BenchMarkVo arg0, BenchMarkVo arg1) {

                            return Double.valueOf(arg0.getFwjsl()).compareTo(arg1.getFwjsl());

                        }
                    });


                } else {
                    // 复位及时率
                    Collections.sort(vos, new Comparator<BenchMarkVo>() {
                        public int compare(BenchMarkVo arg0, BenchMarkVo arg1) {

                            return Double.valueOf(arg1.getFwjsl()).compareTo(arg0.getFwjsl());

                        }
                    });

                }
                break; //可选
/**********************************************************************************************/
            case "ztzhjsl":

                if (tablepar.getIsAsc().equals("asc")) {
                    // 状态转换及时率
                    Collections.sort(vos, new Comparator<BenchMarkVo>() {
                        public int compare(BenchMarkVo arg0, BenchMarkVo arg1) {

                            return Double.valueOf(arg0.getZtzhjsl()).compareTo(arg1.getZtzhjsl());

                        }
                    });


                } else {
                    // 状态转换及时率
                    Collections.sort(vos, new Comparator<BenchMarkVo>() {
                        public int compare(BenchMarkVo arg0, BenchMarkVo arg1) {

                            return Double.valueOf(arg1.getZtzhjsl()).compareTo(arg0.getZtzhjsl());

                        }
                    });

                }
                break; //可选
            /**********************************************************************************************/
            case "xqjsl":

                if (tablepar.getIsAsc().equals("asc")) {
                    // 消缺及时率
                    Collections.sort(vos, new Comparator<BenchMarkVo>() {
                        public int compare(BenchMarkVo arg0, BenchMarkVo arg1) {

                            return Double.valueOf(arg0.getXqjsl()).compareTo(arg1.getXqjsl());

                        }
                    });


                } else {
                    // 消缺及时率
                    Collections.sort(vos, new Comparator<BenchMarkVo>() {
                        public int compare(BenchMarkVo arg0, BenchMarkVo arg1) {

                            return Double.valueOf(arg1.getXqjsl()).compareTo(arg0.getXqjsl());
                        }
                    });

                }
                break; //可选
/**********************************************************************************************/
            case "gzssl":

                if (tablepar.getIsAsc().equals("asc")) {
                    // 故障损失率
                    Collections.sort(vos, new Comparator<BenchMarkVo>() {
                        public int compare(BenchMarkVo arg0, BenchMarkVo arg1) {

                            return Double.valueOf(arg1.getGzssl()).compareTo(arg0.getGzssl());

                        }
                    });


                } else {
                    // 故障损失率
                    Collections.sort(vos, new Comparator<BenchMarkVo>() {
                        public int compare(BenchMarkVo arg0, BenchMarkVo arg1) {

                            return Double.valueOf(arg0.getGzssl()).compareTo(arg1.getGzssl());
                        }
                    });

                }
                break; //可选
            /**********************************************************************************************/
            case "gzss":

                if (tablepar.getIsAsc().equals("asc")) {
                    // 故障损失
                    Collections.sort(vos, new Comparator<BenchMarkVo>() {
                        public int compare(BenchMarkVo arg0, BenchMarkVo arg1) {

                            return Double.valueOf(arg1.getGzss()).compareTo(arg0.getGzss());

                        }
                    });


                } else {
                    // 故障损失
                    Collections.sort(vos, new Comparator<BenchMarkVo>() {
                        public int compare(BenchMarkVo arg0, BenchMarkVo arg1) {

                            return Double.valueOf(arg0.getGzss()).compareTo(arg1.getGzss());
                        }
                    });

                }
                break; //可选
            /**********************************************************************************************/
            case "jxssl":

                if (tablepar.getIsAsc().equals("asc")) {
                    // 检修损失率
                    Collections.sort(vos, new Comparator<BenchMarkVo>() {
                        public int compare(BenchMarkVo arg0, BenchMarkVo arg1) {

                            return Double.valueOf(arg1.getJxssl()).compareTo(arg0.getJxssl());

                        }
                    });


                } else {
                    // 检修损失率
                    Collections.sort(vos, new Comparator<BenchMarkVo>() {
                        public int compare(BenchMarkVo arg0, BenchMarkVo arg1) {

                            return Double.valueOf(arg0.getJxssl()).compareTo(arg1.getJxssl());
                        }
                    });

                }
                break; //可选
            /**********************************************************************************************/
            case "whss":

                if (tablepar.getIsAsc().equals("asc")) {
                    // 检修损失
                    Collections.sort(vos, new Comparator<BenchMarkVo>() {
                        public int compare(BenchMarkVo arg0, BenchMarkVo arg1) {

                            return Double.valueOf(arg1.getWhss()).compareTo(arg0.getWhss());

                        }
                    });


                } else {
                    // 检修损失
                    Collections.sort(vos, new Comparator<BenchMarkVo>() {
                        public int compare(BenchMarkVo arg0, BenchMarkVo arg1) {

                            return Double.valueOf(arg0.getWhss()).compareTo(arg1.getWhss());
                        }
                    });

                }
                break; //可选
            /**********************************************************************************************/
            case "xdss":

                if (tablepar.getIsAsc().equals("asc")) {
                    // 限电损失
                    Collections.sort(vos, new Comparator<BenchMarkVo>() {
                        public int compare(BenchMarkVo arg0, BenchMarkVo arg1) {

                            return Double.valueOf(arg1.getXdss()).compareTo(arg0.getXdss());

                        }
                    });


                } else {
                    // 限电损失
                    Collections.sort(vos, new Comparator<BenchMarkVo>() {
                        public int compare(BenchMarkVo arg0, BenchMarkVo arg1) {

                            return Double.valueOf(arg0.getXdss()).compareTo(arg1.getXdss());
                        }
                    });

                }
                break; //可选
            case "qfl":

                if (tablepar.getIsAsc().equals("asc")) {
                    // 限电损失
                    Collections.sort(vos, new Comparator<BenchMarkVo>() {
                        public int compare(BenchMarkVo arg0, BenchMarkVo arg1) {

                            return Double.valueOf(arg1.getQfl()).compareTo(arg0.getQfl());

                        }
                    });


                } else {
                    // 限电损失
                    Collections.sort(vos, new Comparator<BenchMarkVo>() {
                        public int compare(BenchMarkVo arg0, BenchMarkVo arg1) {

                            return Double.valueOf(arg0.getQfl()).compareTo(arg1.getQfl());
                        }
                    });

                }
                break; //可选
            case "qfss":

                if (tablepar.getIsAsc().equals("asc")) {
                    // 欠发损失
                    Collections.sort(vos, new Comparator<BenchMarkVo>() {
                        public int compare(BenchMarkVo arg0, BenchMarkVo arg1) {

                            return Double.valueOf(arg1.getQfss()).compareTo(arg0.getQfss());

                        }
                    });


                } else {
                    // 欠发损失
                    Collections.sort(vos, new Comparator<BenchMarkVo>() {
                        public int compare(BenchMarkVo arg0, BenchMarkVo arg1) {

                            return Double.valueOf(arg0.getQfss()).compareTo(arg1.getQfss());
                        }
                    });

                }
                break; //可选
            case "xnssl":

                if (tablepar.getIsAsc().equals("asc")) {
                    // 性能损失率
                    Collections.sort(vos, new Comparator<BenchMarkVo>() {
                        public int compare(BenchMarkVo arg0, BenchMarkVo arg1) {

                            return Double.valueOf(arg1.getXnssl()).compareTo(arg0.getXnssl());

                        }
                    });


                } else {
                    // 性能损失率
                    Collections.sort(vos, new Comparator<BenchMarkVo>() {
                        public int compare(BenchMarkVo arg0, BenchMarkVo arg1) {

                            return Double.valueOf(arg0.getXnssl()).compareTo(arg1.getXnssl());
                        }
                    });

                }
                break; //可选
            case "slssl":

                if (tablepar.getIsAsc().equals("asc")) {
                    // 受累损失率
                    Collections.sort(vos, new Comparator<BenchMarkVo>() {
                        public int compare(BenchMarkVo arg0, BenchMarkVo arg1) {

                            return Double.valueOf(arg1.getSlssl()).compareTo(arg0.getSlssl());

                        }
                    });


                } else {
                    // 受累损失率
                    Collections.sort(vos, new Comparator<BenchMarkVo>() {
                        public int compare(BenchMarkVo arg0, BenchMarkVo arg1) {

                            return Double.valueOf(arg0.getSlssl()).compareTo(arg1.getSlssl());
                        }
                    });

                }
                break; //可选
            case "slss":

                if (tablepar.getIsAsc().equals("asc")) {
                    // 受累损失
                    Collections.sort(vos, new Comparator<BenchMarkVo>() {
                        public int compare(BenchMarkVo arg0, BenchMarkVo arg1) {

                            return Double.valueOf(arg1.getSlss()).compareTo(arg0.getSlss());

                        }
                    });


                } else {
                    // 受累损失
                    Collections.sort(vos, new Comparator<BenchMarkVo>() {
                        public int compare(BenchMarkVo arg0, BenchMarkVo arg1) {

                            return Double.valueOf(arg0.getSlss()).compareTo(arg1.getSlss());
                        }
                    });

                }
                break; //可选
            case "total":

                if (tablepar.getIsAsc().equals("asc")) {
                    // 综合排名
                    Collections.sort(vos, new Comparator<BenchMarkVo>() {
                        public int compare(BenchMarkVo arg0, BenchMarkVo arg1) {

                            return Integer.valueOf(arg0.getTotal()).compareTo(arg1.getTotal());

                        }
                    });


                } else {
                    // 综合排名
                    Collections.sort(vos, new Comparator<BenchMarkVo>() {
                        public int compare(BenchMarkVo arg0, BenchMarkVo arg1) {

                            return Integer.valueOf(arg1.getTotal()).compareTo(arg0.getTotal());
                        }
                    });

                }
                break; //可选
            //你可以有任意数量的case语句
            default: //可选
                //语句
        }
        return vos;
    }

}
