使用:

/**
* 服务真实性标签
*
* @param realRepairs
* 真实维修单数
* @param totalRepairs
* 总单数
* @return
*/
public static AuthenticityType getAuthenticityTag(int realRepairs, int totalRepairs) {
double rate = ArithUtil.div(realRepairs, totalRepairs);
if (rate >= 0.9) {
return AuthenticityType.TOP90;
} else if (rate >= 0.6) {
return AuthenticityType.TOP60;
} else {
return AuthenticityType.UNDER60;
}
} POJO public class ServicerProfile { private Long servicerId;
private String servicerCode;
private String servicerName; public enum AuthenticityType { TOP90(31, "优秀"), TOP60(32, "良好"), UNDER60(33, "不及格"); private final int value;
private final String description; private static final Map<Integer, AuthenticityType> valuesMap = Maps.newHashMap();
private static final Map<String, AuthenticityType> namesMap = Maps.newHashMap();
static {
for (AuthenticityType type : AuthenticityType.values()) {
valuesMap.put(type.getValue(), type);
namesMap.put(type.name(), type);
}
} private AuthenticityType(int value, String description) {
this.value = value;
this.description = description;
} public static AuthenticityType parse(Integer value) {
if (value == null) {
return null;
} return valuesMap.get(value);
} public static AuthenticityType parse(String name) {
if (name == null) {
return null;
} return namesMap.get(name);
} public Integer getValue() {
return value;
} public String getDescription() {
return description;
}
} }

  

枚举的使用(限foton)的更多相关文章

  1. 关于数据源为授权车辆、企业车辆的判断(限foton)

    int mode = carInfoService.getCompanyCarMode(companyId); public int getCompanyCarMode(Long companyId) ...

  2. 对于类似经销商的实体中Place(CBM_PALCE_ID = NULL)的情况,如何获取省市信息(限foton)

    在库里像上述描述的数据很多,这种情况需要拿fence里的经纬度,反查省市 String[] strArr = data.getFence().getValue().split(";" ...

  3. ServletUtils取值(限foton)

    1.String query = ServletUtils.getStringValue(request, "query", null); 2.boolean reload = S ...

  4. 查询时间段内所有日期(限foton)

    String dataStr = "2019-04"; try { Date date = DateUtils.parseDate(dataStr); Date startTime ...

  5. 【BZOJ-3532】Lis 最小割 + 退流

    3532: [Sdoi2014]Lis Time Limit: 10 Sec  Memory Limit: 512 MBSubmit: 704  Solved: 264[Submit][Status] ...

  6. WCF Throttling 限流的三道闸口

    WCF Throttling 限流的三道闸口 一.WCF Throttling  流量限制简介 我们期望WCF服务端能够处理尽可能多的并发请求,但是资源是有限的,服务不可能同时处理无限多的并发请求,如 ...

  7. C#基础(二)拆箱与装箱,循环与选择结构,枚举

    一.装箱和拆箱 装箱是将值类型转换为引用类型 eg: Int a=5; Object  o=a; 拆箱是将引用类型转换为值类型 eg: Int a=5; Object  o=a; Int b=(int ...

  8. Python面向对象高级编程-__slots__、定制类,枚举

    当在类体内定义好各种属性后,外部是可以随便添加属性的,Python中类如何限制实例的属性? Python自带了很多定制类,诸如__slots__,__str__ __slots__ __slots__ ...

  9. 关于IEnumerator<T>泛型枚举器 和 IEnumerable<T>

    在开发中我们经常会用到 IEnumerable<T> xxx 或者 List<T> xxx 这种集合或者集合接口,实际上就是一个线性表嘛然后结合C#提供的语法糖 foreach ...

随机推荐

  1. php+html实现用户登录退出

    随着渗透学习,逐渐意识到了学会开发也是非常重要的,仅仅是看懂感觉还是差了一些,所以写一写php的开发,这套程序目前并未有较完整的功能,之后会不断进行完善 登录页面.html <!DOCTYPE ...

  2. 转载:python argparse用法总结

    https://www.jianshu.com/p/fef2d215b91d 1. argparse介绍 是python的一个命令行解析包,非常编写可读性非常好的程序 2. 基本用法 prog.py是 ...

  3. Alink漫谈(二十二) :源码分析之聚类评估

    Alink漫谈(二十二) :源码分析之聚类评估 目录 Alink漫谈(二十二) :源码分析之聚类评估 0x00 摘要 0x01 背景概念 1.1 什么是聚类 1.2 聚类分析的方法 1.3 聚类评估 ...

  4. Linux等待队列(Wait Queue)

    1. Linux等待队列概述 Linux内核的等待队列(Wait Queue)是重要的数据结构,与进程调度机制紧密相关联,可以用来同步对系统资源的访问.异步事件通知.跨进程通信等.在Linux中,等待 ...

  5. Java泛型中的类型参数和通配符类型

    类型参数 泛型有三种实现方式,分别是泛型接口.泛型类.泛型方法,下面通过泛型方法来介绍什么是类型参数. 泛型方法声明方式:访问修饰符 <T,K,S...> 返回类型 方法名(方法参数){方 ...

  6. c语言的变量,常量及作用域等

    1.const定义常量 在C语言中,const可以用来定义的一个常量,在变量名前加上const即可. int const a: 定义了一个a的整数常量,且a的值不能被修改.如果要修改a的值,有以下两种 ...

  7. 中心极限定理(为什么y服从高斯分布)

    因为每一条数据都服从IID原则: 根据中心极限定理,当数据增加的时候,样本均值的分布慢慢变成正态分布 不管分布式什么分布,累加起来都是高斯分布 As sum increases, sum of non ...

  8. Onethink 前台编辑器调用

    比较偷懒的调用方式 <textarea name="content"></textarea> {:hook('documentEditFormContent ...

  9. 在.NET中使用DiagnosticSource

    前言 DiagnosticSource是一个非常有意思的且非常有用的API,对于这些API它们允许不同的库发送命名事件,并且它们也允许应用程序订阅这些事件并处理它们,它使我们的消费者可以在运行时动态发 ...

  10. cocos creator屏幕适配的一些知识点

    一. cocos creator 提供的几种适配策略 EXACT_FIT: 整个应用程序在指定区域可见,无需尝试保留原始纵横比.可能会出现失真,应用程序会被拉伸或压缩.也就是说设计分辨率的长和宽不会等 ...