枚举的使用(限foton)
使用:
/**
* 服务真实性标签
*
* @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)的更多相关文章
- 关于数据源为授权车辆、企业车辆的判断(限foton)
int mode = carInfoService.getCompanyCarMode(companyId); public int getCompanyCarMode(Long companyId) ...
- 对于类似经销商的实体中Place(CBM_PALCE_ID = NULL)的情况,如何获取省市信息(限foton)
在库里像上述描述的数据很多,这种情况需要拿fence里的经纬度,反查省市 String[] strArr = data.getFence().getValue().split(";" ...
- ServletUtils取值(限foton)
1.String query = ServletUtils.getStringValue(request, "query", null); 2.boolean reload = S ...
- 查询时间段内所有日期(限foton)
String dataStr = "2019-04"; try { Date date = DateUtils.parseDate(dataStr); Date startTime ...
- 【BZOJ-3532】Lis 最小割 + 退流
3532: [Sdoi2014]Lis Time Limit: 10 Sec Memory Limit: 512 MBSubmit: 704 Solved: 264[Submit][Status] ...
- WCF Throttling 限流的三道闸口
WCF Throttling 限流的三道闸口 一.WCF Throttling 流量限制简介 我们期望WCF服务端能够处理尽可能多的并发请求,但是资源是有限的,服务不可能同时处理无限多的并发请求,如 ...
- C#基础(二)拆箱与装箱,循环与选择结构,枚举
一.装箱和拆箱 装箱是将值类型转换为引用类型 eg: Int a=5; Object o=a; 拆箱是将引用类型转换为值类型 eg: Int a=5; Object o=a; Int b=(int ...
- Python面向对象高级编程-__slots__、定制类,枚举
当在类体内定义好各种属性后,外部是可以随便添加属性的,Python中类如何限制实例的属性? Python自带了很多定制类,诸如__slots__,__str__ __slots__ __slots__ ...
- 关于IEnumerator<T>泛型枚举器 和 IEnumerable<T>
在开发中我们经常会用到 IEnumerable<T> xxx 或者 List<T> xxx 这种集合或者集合接口,实际上就是一个线性表嘛然后结合C#提供的语法糖 foreach ...
随机推荐
- vulnhub靶机之Quaoar
Quaoar 靶机非常简单. 扫描端口主机. wordpress建站. 扫到两个用户,分别是wpuser以及admin. 爆破出了后台: 传了一个一句话木马,连上蚁剑又传了个反弹shell. 反弹sh ...
- python中不需要函数重载的原因
函数重载主要是为了解决两个问题: 1.可变参数类型 2.可变参数个数 并且函数重载一个基本的设计原则是,仅仅当两个函数除了参数类型和参数个数不同以外,其功能是完全相同的,此时才使用函数重载,如果两个函 ...
- nginx特性
nginx特点: 更快,高扩展性,高可靠性,低能耗性,单机支持10w以上的并发连接,热部署,自由的BSD, Apache.Lighttpd.Tomcat.Jetty.IIS,它们都是Web服务器 SN ...
- Windows下设置Mongodb用户名密码
MongoDB认证: 在默认的情况下,Mongodb是监听在127.0.0.1 IP上的,端口号默认为27017,任何客户端都可以连接,不需要认证 默认情况下,Mongodb也是没有管理账户的,除非你 ...
- 使用Commons FileUpload 1.3.3和Servlet 3.0上传文件
简介 Commons FileUpload可以轻松地为web应用程序添加强大,高性能的文件上传功能.Servlet3.0之前的web应用程序需要使用Commons FileUpload组件上传文件,但 ...
- Python练习题 038:Project Euler 010:两百万以内所有素数之和
本题来自 Project Euler 第10题:https://projecteuler.net/problem=10 # Project Euler: Problem 10: Summation o ...
- 批处理文件的@echo off
转载:https://blog.csdn.net/zl1zl2zl3/article/details/79218448 @echo off 关闭回显 @echo on 打开回显 ...
- git pull设置为无需密码
https方式每次都要输入密码,按照如下设置即可输入一次就不用再手输入密码的困扰而且又享受https带来的极速 设置记住密码(默认15分钟): git config --global credenti ...
- 如何把base64格式的图片上传到到阿里云oss c#版
今天碰到需要把canvas上的的图片转存到阿里云oss,于是百度了半天,一个能打的答案都没有.怒了,自己搞起. 代码超级简单,需要先引入nuget 中啊里云的oss api 1 byte[] arr ...
- 快速解读linq语法
在说LINQ之前必须先说说几个重要的C#语言特性 一:与LINQ有关的语言特性 1.隐式类型 (1)源起 在隐式类型出现之前, 我们在声明一个变量的时候, 总是要为一个变量指定他的类型 甚至在fore ...