枚举的使用(限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 ...
随机推荐
- 空间向量变换,以及OpenGL的glm库简单应用
测试项目请查看GitHub库 GLBIproject2/GLBIProject2_2
- Android开发中导入第三方库所遇问题记录
1.重复循环依赖的问题 (1)需求 如下图所示: 在Android 项目中,采用模块化开发,一个是主跑application--Mudule A,另外一个是library--Library B 1)M ...
- win10病毒和威胁防护无法重新启动解决方法
1.检查电脑中是否安装了任何的第三方反病毒软件 (例如 360.腾讯电脑管家等)?如果有的话,麻烦您将其卸载,卸载完毕后重启设备,再看一下病毒和威胁防护能否正常启动:2.按 "Windows ...
- 手把手教你在 TKE 集群中实现简单的蓝绿发布和灰度发布
概述 如何在腾讯云 Kubernetes 集群实现蓝绿发布和灰度发布?通常要向集群额外部署其它开源工具来实现,比如 Nginx Ingress,Traefik 等,或者让业务上 Service Mes ...
- JUC并发编程--AQS
转自: https://www.jianshu.com/p/d8eeb31bee5c 前言 在java.util.concurrent.locks包中有很多Lock的实现类,常用的有Reentrant ...
- linux监控工具audit
audit是什么? audit是记录linux审计信息的内核模块. 他记录系统中的各种动作和事件,比如系统调用,文件修改,执行的程序,系统登入登出和记录所有系统中所有的事件.audit还可以将审计记录 ...
- mysql-16-variables
#变量 /* 系统变量: 全局变量 会话变量 自定义变量: 用户变量 局部变量 */ # 一.系统变量 #由系统提供,属于服务器层面 #1.查看所有的系统变量 show global variable ...
- linux 漏洞列表
#CVE #Description #Kernels CVE-2017-1000367 [Sudo](Sudo 1.8.6p7 - 1.8.20) CVE-2017-7494 [Samba Remot ...
- matlab中figure创建图窗窗口
来源:https://ww2.mathworks.cn/help/matlab/ref/figure.html?searchHighlight=figure&s_tid=doc_srchtit ...
- Selenium截屏 图片未加载的问题解决--【懒加载】
需求: 截屏后转PDF. 问题: selenium截屏后,图片未加载 如下图: 原因: 网站使用了懒加载技术:只有在浏览器中纵向滚动条滚动到指定的位置时,页面的元素才会被动态加载. 什么是图片懒加载? ...