UnitUtils.java 4.9 KB
package com.skua.modules.equipment.util;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class UnitUtils {
    public static String getRepairStatus(String status) {
        StringBuilder index = new StringBuilder();
        switch (status) {
            case "finish":
                index.append("已验收");
                break;
            case "sbbxxg":
                index.append("设备报修修改");
                break;
            case "sbwx":
                index.append("设备维修");
                break;
            case "sbwxys":
                index.append("设备维修验收");
                break;
            case "wwwx":
                index.append("委外维修");
                break;
            case "wxdd":
                index.append("维修等待");
                break;
            default:
                index.append("设备接修");
                break;
        }
        return index.toString();
    }

    public static String getCycleUnitName(String cycle) {
        StringBuilder index = new StringBuilder();
        switch (cycle) {
            case "2":
                index.append("周");
                break;
            case "3":
                index.append("月");
                break;
            case "4":
                index.append("年");
                break;
            default:
                index.append("天");
                break;
        }
        return index.toString();
    }

    public static String getMaintainTaskStatusName(String status) {
        StringBuilder index = new StringBuilder();
        switch (status) {
            case "1":
                index.append("未开始");
                break;
            case "2":
                index.append("任务中");
                break;
            case "3":
                index.append("已完成");
                break;
            default:
                index.append("已验收");
                break;
        }
        return index.toString();
    }

    public static String getInspectionTaskStatusName(String status) {
        StringBuilder index = new StringBuilder();
        switch (status) {
            case "0":
                index.append("未开始");
                break;
            case "1":
                index.append("进行中");
                break;
            case "2":
                index.append("已完成");
                break;
        }
        return index.toString();
    }

    public static String getRepairTaskStatusName(String status) {
        StringBuilder index = new StringBuilder();
        switch (status) {
            case "sbjx":
                index.append("设备接修");
                break;
            case "sbbxxg":
                index.append("设备报修修改");
                break;
            case "wxdd":
                index.append("维修等待");
                break;
            case "sbwx":
                index.append("设备维修");
                break;
            case "wwwx":
                index.append("委外维修");
                break;
            case "sbwxys":
                index.append("设备维修验收");
                break;
            case "finish":
                index.append("维修完成");
                break;
        }
        return index.toString();
    }

    public static String getEquipmentStatusName(String status) {
        StringBuilder index = new StringBuilder();
        switch (status) {
            case "1":
                index.append("运行");
                break;
            case "2":
                index.append("备用");
                break;
            case "3":
                index.append("在修");
                break;
            case "4":
                index.append("待修");
                break;
            default:
                index.append("停运");
                break;
        }
        return index.toString();
    }

    public static String getInspectionStatus(String status) {
        StringBuilder index = new StringBuilder();
        switch (status) {
            case "1":
                index.append("超期");
                break;
            default:
                index.append("正常");
                break;
        }
        return index.toString();
    }

    public static String getInspectionResult(String status) {
        StringBuilder index = new StringBuilder();
        switch (status) {
            case "1":
                index.append("不合格");
                break;
            default:
                index.append("合格");
                break;
        }
        return index.toString();
    }

    public static boolean isContainChinese(String str) {
        Pattern p = Pattern.compile("[\u4E00-\u9FA5|\\!|\\,|\\。|\\(|\\)|\\《|\\》|\\“|\\”|\\?|\\:|\\;|\\【|\\】]");
        Matcher m = p.matcher(str);
        if (m.find()) {
            return true;
        }
        return false;
    }
}