Commit 022c27bb authored by ZWT's avatar ZWT

feat(吉林演示): 松原

1.修改系统首页大屏总览接口,增加区分组织机构逻辑,完成接口冒烟测试;
2.修改系统首页获取井场列表接口,增加区分组织机构逻辑,完成接口冒烟测试;
3.修改系统首页井场功能下钻后提示报错问题,修改用电功率数据获取逻辑,修复报错问题;
4.修改输电线路分页列表查询接口,增加查询条件,在查询父线路列表时只查询10千伏线路,修改线上接口文档同时完成接口冒烟测试;
5.修改系统首页井场实时监控接口,增加区分组织机构逻辑,完成接口冒烟测试;
6.修改系统首页用能分析接口,增加区分组织机构逻辑,完成接口冒烟测试;
7.修改系统首页井场用能分析(双坐标轴)接口,增加区分组织机构逻辑,完成接口冒烟测试;
8.修改系统首页累积用电接口,增加区分组织机构逻辑,完成接口冒烟测试;
9.修改系统首页光伏实时监控接口,增加区分组织机构逻辑,完成接口冒烟测试;
10.修改系统首页井场效果评价接口,增加区分组织机构逻辑,完成接口冒烟测试;
11.修改系统首页先导实验井间开制度接口,增加区分组织机构逻辑,完成接口冒烟测试;

BREAKING CHANGE: 无

Closes 无

[skip ci]
parent 57ceba22
package pps.core.common.cache;
import xstartup.base.XContext;
import xstartup.cache.XCacheLife;
import xstartup.cache.XCacheObject;
import xstartup.cache.XSingleCache;
import xstartup.core.base.annotation.XCacheKeyPrefix;
import java.util.function.Supplier;
@XCacheKeyPrefix("CONFIG_CACHE")
public class ConfigCache implements XCacheObject, XCacheLife {
/*
* 配置名称
* */
private String configName;
/*
* 配置值
* */
private String configValue;
/**
* 获取缓存的token
*/
public static ConfigCache get(XContext context, String configName, boolean deleteOriginal, Supplier<String> valueProvider) {
ConfigCacheRefreshTool tool = ConfigCacheRefreshTool.get(ConfigCacheRefreshTool.class);
tool.setValueProvider(valueProvider);
ConfigCache cache = tool.find(context, configName, ConfigCache.class);
if (deleteOriginal) {
try {
tool.delete(context, cache);
} catch (Exception e) {
context.getLogger().error("delete cache exception.", e);
}
cache = tool.find(context, configName, ConfigCache.class);
}
return cache;
}
public String getConfigName() {
return configName;
}
public void setConfigName(String configName) {
this.configName = configName;
}
public String getConfigValue() {
return configValue;
}
public void setConfigValue(String configValue) {
this.configValue = configValue;
}
@Override
public Integer getDuration() {
//30秒
return 30;
}
@Override
public String getCacheKey() {
return configName;
}
static class ConfigCacheRefreshTool extends XSingleCache<ConfigCache> {
private Supplier<String> valueProvider;
public Supplier<String> getValueProvider() {
return valueProvider;
}
public void setValueProvider(Supplier<String> valueProvider) {
this.valueProvider = valueProvider;
}
@Override
protected ConfigCache restore(XContext context, String cacheKey) {
//生成缓存对象
if (valueProvider != null) {
ConfigCache cache = new ConfigCache();
cache.configName = cacheKey;
cache.configValue = valueProvider.get();
return cache;
}
return null;
}
}
}
package pps.core.common.enums; package pps.core.common.enums;
public interface DictEnum { public interface DictEnum {
public static <T> T findByValue(Integer v, DictEnum[] values) {
if (v == null) {
return null;
}
for (DictEnum e : values) {
if (e.getValue().equals(v)) {
return (T) e;
}
}
return null;
}
public static <T> T findByDesc(String desc, DictEnum[] values) {
for (DictEnum e : values) {
if (e.getDesc().equals(desc)) {
return (T) e;
}
}
return null;
}
// static <T> T findByValue(Integer v, DictEnum[] items){
// for(DictEnum e : items){
// if( e.getValue() == v){
// return (T)e;
// }
// }
// return null;
// }
Integer getValue(); Integer getValue();
......
package pps.core.common.enums;
import com.baomidou.mybatisplus.annotation.EnumValue;
/**
* 作业计划影响状态字典
*/
public enum TaskPlanTaskAffectDic implements DictEnum {
Affect_Upload(11, "", null),
Affect_Upload_False(0, "否", Affect_Upload),
Affect_Upload_True(1, "是", Affect_Upload),
Affect_Ability(12, "", null),
Affect_Ability_False(0, "否", Affect_Ability),
Affect_Ability_True(1, "是(影响联络站转供能力)", Affect_Ability),
Affect_Ability_True2(2, "是(含截断、限压、限流、干线截断阀旁通流程30min以上)", Affect_Ability),
Affect_Venting(13, "", null),
Affect_Venting_False(0, "否", Affect_Venting),
Affect_Venting_True(1, "管道放空", Affect_Venting),
Affect_Venting_True2(2, "全站放空", Affect_Venting),
Affect_Venting_True3(3, "站内局部放空", Affect_Venting),
Affect_SupplyGas(14, "", null),
Affect_SupplyGas_False(0, "否", Affect_SupplyGas),
Affect_SupplyGas_True(1, "影响重要不可中断用户供气(用户暂不同意)", Affect_SupplyGas),
Affect_SupplyGas_True3(2, "影响重要不可中断用户供气(用户已同意)", Affect_SupplyGas),
Affect_SupplyGas_True2(3, "影响可中断用户供气", Affect_SupplyGas),
Affect_Run(15, "", null),
Affect_Run_False(0, "否", Affect_Run),
Affect_Run_True(1, "影响在用机组", Affect_Run),
Affect_Run_True2(2, "影响备用机组", Affect_Run),
Affect_Communication(16, "", null),
Affect_Communication_False(0, "否", Affect_Communication),
Affect_Communication_True(1, "是", Affect_Communication),
Affect_Alarm(17, "", null),
Affect_Alarm_False(0, "否", Affect_Alarm),
Affect_Alarm_True(1, "是", Affect_Alarm),
Affect_Other(99, "未知", null),
;
@EnumValue
private Integer value;
private String desc;
private TaskPlanTaskAffectDic parent;
TaskPlanTaskAffectDic(Integer value, String desc, TaskPlanTaskAffectDic parent) {
this.desc = desc;
this.value = value;
this.parent = parent;
}
public static TaskPlanTaskAffectDic findByValue(Integer value) {
for (TaskPlanTaskAffectDic item : values()) {
if (item.getValue().equals(value)) {
return item;
}
}
return Affect_Other;
}
public static TaskPlanTaskAffectDic findBySubValue(Integer parentValue, Integer value) {
TaskPlanTaskAffectDic parentDic = Affect_Other;
for (TaskPlanTaskAffectDic item : values()) {
if (item.getValue().equals(parentValue)) {
parentDic = item;
}
}
for (TaskPlanTaskAffectDic item : values()) {
if (item.getParent() != null && item.getParent().equals(parentDic) && item.getValue().equals(value)) {
return item;
}
}
return Affect_Other;
}
public static TaskPlanTaskAffectDic findBySubDesc(Integer parentValue, String desc) {
TaskPlanTaskAffectDic parentDic = Affect_Other;
for (TaskPlanTaskAffectDic item : values()) {
if (item.getValue().equals(parentValue)) {
parentDic = item;
}
}
for (TaskPlanTaskAffectDic item : values()) {
if (item.getParent() != null && item.getParent().equals(parentDic) && item.getDesc().equals(desc)) {
return item;
}
}
return Affect_Other;
}
@Override
public Integer getValue() {
return value;
}
@Override
public String getDesc() {
return desc;
}
public TaskPlanTaskAffectDic getParent() {
return parent;
}
}
package pps.core.common.excel.config; package pps.core.common.excel.config;
import cn.hutool.core.util.ArrayUtil;
import cn.hutool.core.util.ObjectUtil;
import lombok.Data; import lombok.Data;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
...@@ -28,23 +30,21 @@ public class ExcelSelectedResolve { ...@@ -28,23 +30,21 @@ public class ExcelSelectedResolve {
private int lastRow; private int lastRow;
public String[] resolveSelectedSource(ExcelSelected excelSelected) { public String[] resolveSelectedSource(ExcelSelected excelSelected) {
if (excelSelected == null) { if (ObjectUtil.isNull(excelSelected)) {
return null; return null;
} }
// 获取固定下拉框的内容 // 获取固定下拉框的内容
String[] source = excelSelected.source(); String[] source = excelSelected.source();
if (source.length > 0) { if (ArrayUtil.isNotEmpty(source)) {
return source; return source;
} }
// 获取动态下拉框的内容 // 获取动态下拉框的内容
Class<? extends ExcelDynamicSelect>[] classes = excelSelected.sourceClass(); Class<? extends ExcelDynamicSelect>[] classes = excelSelected.sourceClass();
if (classes.length > 0) { if (classes.length > 0) {
try { try {
ExcelDynamicSelect excelDynamicSelect = classes[0].newInstance(); ExcelDynamicSelect excelDynamicSelect = classes[0].newInstance();
String[] dynamicSelectSource = excelDynamicSelect.getSource(); String[] dynamicSelectSource = excelDynamicSelect.getSource();
if (dynamicSelectSource != null && dynamicSelectSource.length > 0) { if (ArrayUtil.isNotEmpty(dynamicSelectSource)) {
return dynamicSelectSource; return dynamicSelectSource;
} }
} catch (InstantiationException | IllegalAccessException e) { } catch (InstantiationException | IllegalAccessException e) {
......
...@@ -78,7 +78,6 @@ public class SelectedSheetWriteHandler implements SheetWriteHandler { ...@@ -78,7 +78,6 @@ public class SelectedSheetWriteHandler implements SheetWriteHandler {
// 阻止输入非下拉选项的值 // 阻止输入非下拉选项的值
validation.setErrorStyle(DataValidation.ErrorStyle.STOP); validation.setErrorStyle(DataValidation.ErrorStyle.STOP);
validation.setShowErrorBox(true); validation.setShowErrorBox(true);
// validation.setSuppressDropDownArrow(true);
validation.createErrorBox("提示", "请输入下拉选项中的内容"); validation.createErrorBox("提示", "请输入下拉选项中的内容");
sheet.addValidationData(validation); sheet.addValidationData(validation);
}); });
......
...@@ -3,6 +3,7 @@ package pps.core.common.excel.util; ...@@ -3,6 +3,7 @@ package pps.core.common.excel.util;
import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.convert.Convert; import cn.hutool.core.convert.Convert;
import cn.hutool.core.text.CharSequenceUtil; import cn.hutool.core.text.CharSequenceUtil;
import cn.hutool.core.util.ArrayUtil;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import com.alibaba.excel.EasyExcel; import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.ExcelReader; import com.alibaba.excel.ExcelReader;
...@@ -251,7 +252,7 @@ public class EasyExcelUtil { ...@@ -251,7 +252,7 @@ public class EasyExcelUtil {
private static <T> ExcelListener<T> readExcelListener(MultipartFile file, Class<T> clazz, ExcelListener<T> excelListener) throws IOException { private static <T> ExcelListener<T> readExcelListener(MultipartFile file, Class<T> clazz, ExcelListener<T> excelListener) throws IOException {
ExcelReader excelReader = getReader(file.getInputStream(), file.getOriginalFilename(), clazz, excelListener); ExcelReader excelReader = getReader(file.getInputStream(), file.getOriginalFilename(), clazz, excelListener);
if (excelReader == null) { if (ObjectUtil.isNull(excelReader)) {
return excelListener; return excelListener;
} }
List<ReadSheet> readSheetList = excelReader.excelExecutor().sheetList(); List<ReadSheet> readSheetList = excelReader.excelExecutor().sheetList();
...@@ -264,10 +265,10 @@ public class EasyExcelUtil { ...@@ -264,10 +265,10 @@ public class EasyExcelUtil {
private static <T> ExcelReader getReader(InputStream inputStream, String filename, Class<T> clazz, ExcelListener<T> excelListener) { private static <T> ExcelReader getReader(InputStream inputStream, String filename, Class<T> clazz, ExcelListener<T> excelListener) {
try { try {
if (filename == null || !filename.toLowerCase().endsWith(".xlsx")) { if (CharSequenceUtil.isBlank(filename) || !CharSequenceUtil.endWithAnyIgnoreCase(filename.toLowerCase(), ".xlsx")) {
return null; return null;
} }
ExcelReader excelReader = clazz == null ? EasyExcel.read(inputStream, excelListener).build() : ExcelReader excelReader = ObjectUtil.isNull(clazz) ? EasyExcel.read(inputStream, excelListener).build() :
EasyExcel.read(inputStream, clazz, excelListener).build(); EasyExcel.read(inputStream, clazz, excelListener).build();
inputStream.close(); inputStream.close();
return excelReader; return excelReader;
...@@ -286,7 +287,6 @@ public class EasyExcelUtil { ...@@ -286,7 +287,6 @@ public class EasyExcelUtil {
*/ */
private static <T> Map<Integer, ExcelSelectedResolve> resolveSelectedAnnotation(Class<T> head) { private static <T> Map<Integer, ExcelSelectedResolve> resolveSelectedAnnotation(Class<T> head) {
Map<Integer, ExcelSelectedResolve> selectedMap = new HashMap<>(64); Map<Integer, ExcelSelectedResolve> selectedMap = new HashMap<>(64);
// getDeclaredFields(): 返回全部声明的属性;getFields(): 返回public类型的属性 // getDeclaredFields(): 返回全部声明的属性;getFields(): 返回public类型的属性
Field[] fields = head.getDeclaredFields(); Field[] fields = head.getDeclaredFields();
for (int i = 0; i < fields.length; i++) { for (int i = 0; i < fields.length; i++) {
...@@ -294,14 +294,14 @@ public class EasyExcelUtil { ...@@ -294,14 +294,14 @@ public class EasyExcelUtil {
// 解析注解信息 // 解析注解信息
ExcelSelected selected = field.getAnnotation(ExcelSelected.class); ExcelSelected selected = field.getAnnotation(ExcelSelected.class);
ExcelProperty property = field.getAnnotation(ExcelProperty.class); ExcelProperty property = field.getAnnotation(ExcelProperty.class);
if (selected != null) { if (ObjectUtil.isNotNull(selected)) {
ExcelSelectedResolve excelSelectedResolve = new ExcelSelectedResolve(); ExcelSelectedResolve excelSelectedResolve = new ExcelSelectedResolve();
String[] source = excelSelectedResolve.resolveSelectedSource(selected); String[] source = excelSelectedResolve.resolveSelectedSource(selected);
if (source != null && source.length > 0) { if (ArrayUtil.isNotEmpty(source)) {
excelSelectedResolve.setSource(source); excelSelectedResolve.setSource(source);
excelSelectedResolve.setFirstRow(selected.firstRow()); excelSelectedResolve.setFirstRow(selected.firstRow());
excelSelectedResolve.setLastRow(selected.lastRow()); excelSelectedResolve.setLastRow(selected.lastRow());
if (property != null && property.index() >= 0) { if (ObjectUtil.isNotNull(property) && property.index() >= 0) {
selectedMap.put(property.index(), excelSelectedResolve); selectedMap.put(property.index(), excelSelectedResolve);
} else { } else {
selectedMap.put(i, excelSelectedResolve); selectedMap.put(i, excelSelectedResolve);
...@@ -318,7 +318,6 @@ public class EasyExcelUtil { ...@@ -318,7 +318,6 @@ public class EasyExcelUtil {
* @return * @return
*/ */
private static HorizontalCellStyleStrategy setHorizontalCellStyleStrategy() { private static HorizontalCellStyleStrategy setHorizontalCellStyleStrategy() {
/*******自定义列标题和内容的样式******/
// 头的策略 // 头的策略
WriteCellStyle headWriteCellStyle = new WriteCellStyle(); WriteCellStyle headWriteCellStyle = new WriteCellStyle();
// 背景设置 // 背景设置
...@@ -333,7 +332,6 @@ public class EasyExcelUtil { ...@@ -333,7 +332,6 @@ public class EasyExcelUtil {
// 字体大小 // 字体大小
contentWriteFont.setFontHeightInPoints((short) 10); contentWriteFont.setFontHeightInPoints((short) 10);
contentWriteCellStyle.setWriteFont(contentWriteFont); contentWriteCellStyle.setWriteFont(contentWriteFont);
//设置 自动换行 //设置 自动换行
contentWriteCellStyle.setWrapped(true); contentWriteCellStyle.setWrapped(true);
//设置 垂直居中 //设置 垂直居中
......
package pps.core.common.excel.util; package pps.core.common.excel.util;
import cn.hutool.core.collection.CollUtil;
import jakarta.validation.ConstraintViolation; import jakarta.validation.ConstraintViolation;
import jakarta.validation.Validation; import jakarta.validation.Validation;
import jakarta.validation.Validator; import jakarta.validation.Validator;
...@@ -45,7 +46,7 @@ public class ValidationUtil { ...@@ -45,7 +46,7 @@ public class ValidationUtil {
for (ConstraintViolation<T> constraintViolation : validateRstSet) { for (ConstraintViolation<T> constraintViolation : validateRstSet) {
errMsg.add(constraintViolation.getMessage()); errMsg.add(constraintViolation.getMessage());
} }
if (errMsg.size() > 0) { if (CollUtil.isNotEmpty(errMsg)) {
stringBuilder.append("第").append(rowNum).append("行,").append(errMsg).append(';'); stringBuilder.append("第").append(rowNum).append("行,").append(errMsg).append(';');
} }
} }
......
package pps.core.common.pattern;
import java.util.Objects;
public class Builder<T> {
private final Class<T> clazz;
private Init<T> init;
private FieldsValidator<T> fieldsValidator;
public Builder(Class<T> clazz) {
this.clazz = clazz;
}
public Builder(Class<T> clazz, Init<T> init) {
this.clazz = clazz;
this.init = init;
}
public Builder(Class<T> clazz, Init<T> init, FieldsValidator<T> fieldsValidator) {
this.clazz = clazz;
this.init = init;
this.fieldsValidator = fieldsValidator;
}
public static <T> Builder<T> create(Class<T> clazz) {
return new Builder<>(clazz);
}
public static <T> Builder<T> create(Class<T> clazz, Init<T> init) {
return new Builder<>(clazz, init);
}
public static <T> Builder<T> create(Class<T> clazz, Init<T> init, FieldsValidator<T> fieldsValidator) {
return new Builder<>(clazz, init, fieldsValidator);
}
public Builder<T> addValid(FieldsValidator<T> valid) {
this.fieldsValidator = valid;
return this;
}
public T build(FillField<T> fillField) {
T instance = null;
try {
instance = this.clazz.newInstance();
if (Objects.nonNull(init)) {
init.initialize(instance);
}
} catch (InstantiationException | IllegalAccessException e) {
throw new RuntimeException(e.getMessage());
}
fillField.fill(instance);
if (Objects.isNull(fieldsValidator)) {
return instance;
}
boolean validRet = this.fieldsValidator.valid(instance);
if (validRet) {
return instance;
}
throw new RuntimeException(String.format("instance fields valid error, Class is %s", instance.getClass().getName()));
}
@FunctionalInterface
public static interface FieldsValidator<T> {
boolean valid(T instance);
}
@FunctionalInterface
public static interface FillField<T> {
void fill(T instance);
}
@FunctionalInterface
public static interface Init<T> {
void initialize(T instanse);
}
}
\ No newline at end of file
package pps.core.common.provider.impl; package pps.core.common.provider.impl;
import cn.hutool.core.util.ObjectUtil;
import xstartup.annotation.XImplement; import xstartup.annotation.XImplement;
import xstartup.base.XContext; import xstartup.base.XContext;
import xstartup.base.util.XJsonUtils; import xstartup.base.util.XJsonUtils;
...@@ -27,7 +28,7 @@ public class PpsSessionStorageProviderImpl implements XSessionStorageProvider { ...@@ -27,7 +28,7 @@ public class PpsSessionStorageProviderImpl implements XSessionStorageProvider {
public <T> XSingleResult<T> loadSession(XContext context, Long userId, Class<T> tClass) { public <T> XSingleResult<T> loadSession(XContext context, Long userId, Class<T> tClass) {
SessionCache cache = SessionCache.find(context, userId); SessionCache cache = SessionCache.find(context, userId);
if (cache == null) { if (ObjectUtil.isNull(cache)) {
return XSingleResult.error(context, XError.NotAuth); return XSingleResult.error(context, XError.NotAuth);
} else { } else {
T sessionData = XJsonUtils.toObject(cache.getContent(), tClass); T sessionData = XJsonUtils.toObject(cache.getContent(), tClass);
......
package pps.core.common.utils;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.regex.Pattern;
/**
* Description:
* date: 2020/11/18 16:47
*
* @author zhujiangwei
*/
public class BigDecimalUtil {
public static BigDecimal parseBigDecimal(Object obj, int num) {
if (obj == null) return BigDecimal.ZERO.setScale(num, RoundingMode.HALF_UP);
BigDecimal org;
if (obj instanceof BigDecimal) {
org = (BigDecimal) obj;
} else {
String pattern = "([1-9]\\d*\\.?\\d*)|(0\\.\\d*[1-9])";
if (!Pattern.matches(pattern, String.valueOf(obj))) { //非数字字符串
org = BigDecimal.ZERO;
} else {
org = parseObj2BigDecimal(obj);
}
}
return org.setScale(num, RoundingMode.HALF_UP);
}
public static BigDecimal parseObj2BigDecimal(Object obj) {
if (obj == null) return BigDecimal.ZERO;
String str = String.valueOf(obj).trim();
if (str.isEmpty()) return BigDecimal.ZERO;
BigDecimal result;
try {
result = new BigDecimal(str);
} catch (Exception e) {
result = BigDecimal.ZERO;
}
return result;
}
}
...@@ -31,51 +31,38 @@ public class CounterBuilder { ...@@ -31,51 +31,38 @@ public class CounterBuilder {
} }
public CounterBuilder addCounter(String counterName, long v, CounterBuildItemInfoType infoType) { public CounterBuilder addCounter(String counterName, long v, CounterBuildItemInfoType infoType) {
if (counterName == null || counterName.isEmpty()) { if (CharSequenceUtil.isBlank(counterName)) {
return this; return this;
} }
if (CharSequenceUtil.isNotBlank(this.groupName)) { if (CharSequenceUtil.isNotBlank(this.groupName)) {
counterName = String.format("%s-%s", this.groupName, counterName); counterName = String.format("%s-%s", this.groupName, counterName);
} }
if (this.counterMap.containsKey(counterName)) {
this.counterMap.get(counterName).getAndAdd(v);
return this;
}
if (this.counterMap.containsKey(counterName)) { if (this.counterMap.containsKey(counterName)) {
this.counterMap.get(counterName).getAndAdd(v); this.counterMap.get(counterName).getAndAdd(v);
return this; return this;
} }
this.counterMap.put(counterName, new AtomicLong(v)); this.counterMap.put(counterName, new AtomicLong(v));
this.fileInfoTypeMap.put(counterName, infoType); this.fileInfoTypeMap.put(counterName, infoType);
return this; return this;
} }
public CounterBuilder setFieldValue(String fieldName, String fieldValue) { public void setFieldValue(String fieldName, String fieldValue) {
return setFieldValue(fieldName, fieldValue, detectInfoTypeByCounterName(fieldName)); setFieldValue(fieldName, fieldValue, detectInfoTypeByCounterName(fieldName));
} }
public CounterBuilder setFieldValue(String fieldName, String fieldValue, CounterBuildItemInfoType infoType) { public void setFieldValue(String fieldName, String fieldValue, CounterBuildItemInfoType infoType) {
if (fieldName == null || fieldName.isEmpty()) { if (CharSequenceUtil.isBlank(fieldName)) {
return this; return;
} }
if (CharSequenceUtil.isNotBlank(this.groupName)) { if (CharSequenceUtil.isNotBlank(this.groupName)) {
fieldName = String.format("%s-%s", this.groupName, fieldName); fieldName = String.format("%s-%s", this.groupName, fieldName);
} }
this.fieldValueMap.put(fieldName, fieldValue); this.fieldValueMap.put(fieldName, fieldValue);
this.fileInfoTypeMap.put(fieldName, infoType); this.fileInfoTypeMap.put(fieldName, infoType);
return this;
} }
private CounterBuildItemInfoType detectInfoTypeByCounterName(String counterName) { private CounterBuildItemInfoType detectInfoTypeByCounterName(String counterName) {
if (counterName.contains("Error") if (CharSequenceUtil.containsAny(counterName, "Error", "error", "ERROR", "Exception")) {
|| counterName.contains("error")
|| counterName.contains("ERROR")
|| counterName.contains("Exception")) {
return CounterBuildItemInfoType.ERROR; return CounterBuildItemInfoType.ERROR;
} }
return CounterBuildItemInfoType.NORNAL; return CounterBuildItemInfoType.NORNAL;
...@@ -84,9 +71,7 @@ public class CounterBuilder { ...@@ -84,9 +71,7 @@ public class CounterBuilder {
@Override @Override
public String toString() { public String toString() {
ArrayList<String> lines = new ArrayList<>(this.fieldValueMap.size() + this.counterMap.size()); ArrayList<String> lines = new ArrayList<>(this.fieldValueMap.size() + this.counterMap.size());
StringBuilder stringBuilder = new StringBuilder(); StringBuilder stringBuilder = new StringBuilder();
ImmutableList<Map.Entry<String, String>> fieldsList = ImmutableList.copyOf(this.fieldValueMap.entrySet()); ImmutableList<Map.Entry<String, String>> fieldsList = ImmutableList.copyOf(this.fieldValueMap.entrySet());
fieldsList.forEach(item -> { fieldsList.forEach(item -> {
lines.add(String.format("%s : %s", item.getKey(), item.getValue())); lines.add(String.format("%s : %s", item.getKey(), item.getValue()));
...@@ -96,12 +81,8 @@ public class CounterBuilder { ...@@ -96,12 +81,8 @@ public class CounterBuilder {
lines.add(String.format("%s : %d", item.getKey(), item.getValue().get())); lines.add(String.format("%s : %d", item.getKey(), item.getValue().get()));
}); });
for (String line : lines) { for (String line : lines) {
stringBuilder stringBuilder.append(line).append(System.getProperty("line.separator"));
.append(line)
.append(System.getProperty("line.separator"))
;
} }
return stringBuilder.toString(); return stringBuilder.toString();
} }
...@@ -109,5 +90,4 @@ public class CounterBuilder { ...@@ -109,5 +90,4 @@ public class CounterBuilder {
NORNAL, NORNAL,
ERROR; ERROR;
} }
}
} \ No newline at end of file
package pps.core.common.utils; package pps.core.common.utils;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.text.CharSequenceUtil;
import cn.hutool.core.util.ObjectUtil;
import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.*; import org.apache.poi.ss.usermodel.*;
import org.apache.poi.xssf.streaming.SXSSFWorkbook; import org.apache.poi.xssf.streaming.SXSSFWorkbook;
...@@ -34,7 +37,6 @@ public class ExcelUtils { ...@@ -34,7 +37,6 @@ public class ExcelUtils {
// 生成xlsx的Excel // 生成xlsx的Excel
Workbook workbook = new SXSSFWorkbook(); Workbook workbook = new SXSSFWorkbook();
CellStyle cs = workbook.createCellStyle(); CellStyle cs = workbook.createCellStyle();
cs.setWrapText(true);
cs.setWrapText(true); //内容自动换行 cs.setWrapText(true); //内容自动换行
cs.setAlignment(HorizontalAlignment.CENTER); //水平居中 cs.setAlignment(HorizontalAlignment.CENTER); //水平居中
cs.setVerticalAlignment(VerticalAlignment.CENTER);//垂直居中 cs.setVerticalAlignment(VerticalAlignment.CENTER);//垂直居中
...@@ -44,7 +46,7 @@ public class ExcelUtils { ...@@ -44,7 +46,7 @@ public class ExcelUtils {
int rowNum = 1; int rowNum = 1;
for (Iterator<Map<String, Object>> it = dataList.iterator(); it.hasNext(); ) { for (Iterator<Map<String, Object>> it = dataList.iterator(); it.hasNext(); ) {
Map<String, Object> data = it.next(); Map<String, Object> data = it.next();
if (data == null) { if (CollUtil.isEmpty(data)) {
continue; continue;
} }
//输出行数据 //输出行数据
...@@ -129,7 +131,6 @@ public class ExcelUtils { ...@@ -129,7 +131,6 @@ public class ExcelUtils {
} }
} }
/** /**
* 根据文件后缀名类型获取对应的工作簿对象 * 根据文件后缀名类型获取对应的工作簿对象
* *
...@@ -140,9 +141,9 @@ public class ExcelUtils { ...@@ -140,9 +141,9 @@ public class ExcelUtils {
*/ */
public static Workbook getWorkbook(InputStream inputStream, String fileType) throws IOException { public static Workbook getWorkbook(InputStream inputStream, String fileType) throws IOException {
Workbook workbook = null; Workbook workbook = null;
if (fileType.equalsIgnoreCase(XLS)) { if (CharSequenceUtil.equalsIgnoreCase(fileType, XLS)) {
workbook = new HSSFWorkbook(inputStream); workbook = new HSSFWorkbook(inputStream);
} else if (fileType.equalsIgnoreCase(XLSX)) { } else if (CharSequenceUtil.equalsIgnoreCase(fileType, XLSX)) {
workbook = new XSSFWorkbook(inputStream); workbook = new XSSFWorkbook(inputStream);
} }
return workbook; return workbook;
...@@ -156,20 +157,14 @@ public class ExcelUtils { ...@@ -156,20 +157,14 @@ public class ExcelUtils {
* @return 读取结果列表,读取失败时返回null * @return 读取结果列表,读取失败时返回null
*/ */
public static List<Map<String, Object>> readExcel(InputStream inputStream, String fileName, List<String> headerList, Integer sheetIndex) { public static List<Map<String, Object>> readExcel(InputStream inputStream, String fileName, List<String> headerList, Integer sheetIndex) {
Workbook workbook;
Workbook workbook = null;
try { try {
// 获取Excel后缀名 // 获取Excel后缀名
String fileType = fileName.substring(fileName.lastIndexOf(".") + 1, fileName.length()); String fileType = fileName.substring(fileName.lastIndexOf(".") + 1);
// 获取Excel工作簿 // 获取Excel工作簿
workbook = getWorkbook(inputStream, fileType); workbook = getWorkbook(inputStream, fileType);
// 读取excel中的数据 // 读取excel中的数据
List<Map<String, Object>> resultDataList = parseExcel(workbook, headerList, sheetIndex); return parseExcel(workbook, headerList, sheetIndex);
return resultDataList;
} catch (Exception e) { } catch (Exception e) {
logger.warning("解析Excel失败,文件名:" + fileName + " 错误信息:" + e.getMessage()); logger.warning("解析Excel失败,文件名:" + fileName + " 错误信息:" + e.getMessage());
return null; return null;
...@@ -180,7 +175,6 @@ public class ExcelUtils { ...@@ -180,7 +175,6 @@ public class ExcelUtils {
} }
} catch (Exception e) { } catch (Exception e) {
logger.warning("关闭数据流出错!错误信息:" + e.getMessage()); logger.warning("关闭数据流出错!错误信息:" + e.getMessage());
return null;
} }
} }
} }
...@@ -197,42 +191,36 @@ public class ExcelUtils { ...@@ -197,42 +191,36 @@ public class ExcelUtils {
List<Map<String, Object>> resultDataList = new ArrayList<>(); List<Map<String, Object>> resultDataList = new ArrayList<>();
// 解析sheet // 解析sheet
for (int sheetNum = 0; sheetNum < workbook.getNumberOfSheets(); sheetNum++) { for (int sheetNum = 0; sheetNum < workbook.getNumberOfSheets(); sheetNum++) {
if (sheetIndex != null && sheetNum != sheetIndex) { if (ObjectUtil.isNotNull(sheetIndex) && !sheetIndex.equals(sheetNum)) {
continue; continue;
} }
Sheet sheet = workbook.getSheetAt(sheetNum); Sheet sheet = workbook.getSheetAt(sheetNum);
// 校验sheet是否合法 // 校验sheet是否合法
if (sheet == null) { if (ObjectUtil.isNull(sheet)) {
continue; continue;
} }
// 获取第一行数据 // 获取第一行数据
int firstRowNum = sheet.getFirstRowNum(); int firstRowNum = sheet.getFirstRowNum();
Row firstRow = sheet.getRow(firstRowNum); Row firstRow = sheet.getRow(firstRowNum);
if (null == firstRow) { if (ObjectUtil.isNull(firstRow)) {
logger.warning("解析Excel失败,在第一行没有读取到任何数据!"); logger.warning("解析Excel失败,在第一行没有读取到任何数据!");
} }
// 解析每一行的数据,构造数据对象 // 解析每一行的数据,构造数据对象
int rowStart = firstRowNum + 1; int rowStart = firstRowNum + 1;
int rowEnd = sheet.getPhysicalNumberOfRows(); int rowEnd = sheet.getPhysicalNumberOfRows();
for (int rowNum = rowStart; rowNum < rowEnd; rowNum++) { for (int rowNum = rowStart; rowNum < rowEnd; rowNum++) {
Row row = sheet.getRow(rowNum); Row row = sheet.getRow(rowNum);
if (ObjectUtil.isNull(row)) {
if (null == row) {
continue; continue;
} }
Map<String, Object> resultData = convertRowToData(row, headerList); Map<String, Object> resultData = convertRowToData(row, headerList);
if (null == resultData) { if (CollUtil.isEmpty(resultData)) {
logger.warning("第 " + row.getRowNum() + "行数据不合法,已忽略!"); logger.warning("第 " + row.getRowNum() + "行数据不合法,已忽略!");
continue; continue;
} }
resultDataList.add(resultData); resultDataList.add(resultData);
} }
} }
return resultDataList; return resultDataList;
} }
...@@ -243,7 +231,7 @@ public class ExcelUtils { ...@@ -243,7 +231,7 @@ public class ExcelUtils {
* @return * @return
*/ */
private static String convertCellValueToString(Cell cell) { private static String convertCellValueToString(Cell cell) {
if (cell == null) { if (ObjectUtil.isNull(cell)) {
return null; return null;
} }
String returnValue = null; String returnValue = null;
...@@ -290,7 +278,6 @@ public class ExcelUtils { ...@@ -290,7 +278,6 @@ public class ExcelUtils {
*/ */
private static Map<String, Object> convertRowToData(Row row, List<String> headerList) { private static Map<String, Object> convertRowToData(Row row, List<String> headerList) {
Map<String, Object> resultData = new HashMap<>(); Map<String, Object> resultData = new HashMap<>();
Cell cell; Cell cell;
int cellNum = 0; int cellNum = 0;
for (int i = 0; i < headerList.size(); i++) { for (int i = 0; i < headerList.size(); i++) {
......
package pps.core.common.utils; package pps.core.common.utils;
import cn.hutool.core.collection.CollUtil;
import org.jxls.common.Context; import org.jxls.common.Context;
import org.jxls.expression.JexlExpressionEvaluator; import org.jxls.expression.JexlExpressionEvaluator;
import org.jxls.transform.Transformer; import org.jxls.transform.Transformer;
...@@ -44,7 +45,7 @@ public class ExportExcelUtils { ...@@ -44,7 +45,7 @@ public class ExportExcelUtils {
*/ */
public static byte[] genSingleExcelFileData(InputStream inputStream, Map<String, Object> params) { public static byte[] genSingleExcelFileData(InputStream inputStream, Map<String, Object> params) {
Context context = new Context(); Context context = new Context();
if (params != null) { if (CollUtil.isNotEmpty(params)) {
for (String key : params.keySet()) { for (String key : params.keySet()) {
context.putVar(key, params.get(key)); context.putVar(key, params.get(key));
} }
......
package pps.core.common.utils; package pps.core.common.utils;
import cn.hutool.core.util.ObjectUtil;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Date; import java.util.Date;
...@@ -16,7 +18,7 @@ public class JxlsUtils { ...@@ -16,7 +18,7 @@ public class JxlsUtils {
} }
public String dateFormat(Date date, String pattern) { public String dateFormat(Date date, String pattern) {
if (date == null) { if (ObjectUtil.isNull(date)) {
return ""; return "";
} }
try { try {
......
...@@ -23,14 +23,10 @@ public class ManifestComponentInfoHelper { ...@@ -23,14 +23,10 @@ public class ManifestComponentInfoHelper {
while (resources.hasMoreElements()) { while (resources.hasMoreElements()) {
try { try {
InputStream stream = resources.nextElement().openStream(); InputStream stream = resources.nextElement().openStream();
final HashMap<String, String> manifestProperties = new HashMap<>(10); final HashMap<String, String> manifestProperties = new HashMap<>(10);
final Manifest manifest = new Manifest(stream); final Manifest manifest = new Manifest(stream);
Attributes attributes = manifest.getMainAttributes(); Attributes attributes = manifest.getMainAttributes();
attributes.entrySet().stream().forEach(entry -> { attributes.forEach((key, value) -> manifestProperties.put(key.toString(), value.toString()));
manifestProperties.put(entry.getKey().toString(), entry.getValue().toString());
});
if (manifestProperties.containsKey(COMPONENT_GROUP_NAME) if (manifestProperties.containsKey(COMPONENT_GROUP_NAME)
&& manifestProperties.containsKey(COMPONENT_ARTIFACTID)) { && manifestProperties.containsKey(COMPONENT_ARTIFACTID)) {
ManifestComponentInfo manifestComponentInfo = new ManifestComponentInfo(); ManifestComponentInfo manifestComponentInfo = new ManifestComponentInfo();
...@@ -42,7 +38,6 @@ public class ManifestComponentInfoHelper { ...@@ -42,7 +38,6 @@ public class ManifestComponentInfoHelper {
String k = String.format("%s:%s", manifestComponentInfo.getGroupName(), manifestComponentInfo.getArtifactid()); String k = String.format("%s:%s", manifestComponentInfo.getGroupName(), manifestComponentInfo.getArtifactid());
manifestComponentInfoHashMap.put(k, manifestComponentInfo); manifestComponentInfoHashMap.put(k, manifestComponentInfo);
} }
stream.close(); stream.close();
} catch (IOException E) { } catch (IOException E) {
// handle // handle
......
...@@ -30,7 +30,7 @@ public class PatternUtil { ...@@ -30,7 +30,7 @@ public class PatternUtil {
} }
//先判断手机号 //先判断手机号
String s = rePhone(str); String s = rePhone(str);
if (!s.contains("****")) { if (!CharSequenceUtil.contains(s, "****")) {
//在判断身份证号 //在判断身份证号
s = reNo(str); s = reNo(str);
} }
...@@ -72,7 +72,7 @@ public class PatternUtil { ...@@ -72,7 +72,7 @@ public class PatternUtil {
return str; return str;
} }
String name = str; String name = str;
if (str.contains("@") && str.length() > 9) { if (CharSequenceUtil.contains(str, '@') && str.length() > 9) {
StringBuilder stringBuilder = new StringBuilder(str); StringBuilder stringBuilder = new StringBuilder(str);
name = stringBuilder.replace(3, 7, "****").toString(); name = stringBuilder.replace(3, 7, "****").toString();
} }
......
...@@ -23,8 +23,7 @@ public class RSAUtil { ...@@ -23,8 +23,7 @@ public class RSAUtil {
byte[] keyBytes = base642Byte(pubStr); byte[] keyBytes = base642Byte(pubStr);
X509EncodedKeySpec keySpec = new X509EncodedKeySpec(keyBytes); X509EncodedKeySpec keySpec = new X509EncodedKeySpec(keyBytes);
KeyFactory keyFactory = KeyFactory.getInstance("RSA"); KeyFactory keyFactory = KeyFactory.getInstance("RSA");
PublicKey publicKey = keyFactory.generatePublic(keySpec); return keyFactory.generatePublic(keySpec);
return publicKey;
} }
//将Base64编码后的私钥转换成PrivateKey对象 //将Base64编码后的私钥转换成PrivateKey对象
...@@ -32,8 +31,7 @@ public class RSAUtil { ...@@ -32,8 +31,7 @@ public class RSAUtil {
byte[] keyBytes = base642Byte(priStr); byte[] keyBytes = base642Byte(priStr);
PKCS8EncodedKeySpec keySpec = new PKCS8EncodedKeySpec(keyBytes); PKCS8EncodedKeySpec keySpec = new PKCS8EncodedKeySpec(keyBytes);
KeyFactory keyFactory = KeyFactory.getInstance("RSA"); KeyFactory keyFactory = KeyFactory.getInstance("RSA");
PrivateKey privateKey = keyFactory.generatePrivate(keySpec); return keyFactory.generatePrivate(keySpec);
return privateKey;
} }
//Base64编码转字节数组 //Base64编码转字节数组
...@@ -59,7 +57,6 @@ public class RSAUtil { ...@@ -59,7 +57,6 @@ public class RSAUtil {
int inputLen = encryptedData.length; int inputLen = encryptedData.length;
ByteArrayOutputStream out = new ByteArrayOutputStream(); ByteArrayOutputStream out = new ByteArrayOutputStream();
int offSet = 0; int offSet = 0;
for (int i = 0; inputLen - offSet > 0; offSet = i * 256) { for (int i = 0; inputLen - offSet > 0; offSet = i * 256) {
byte[] cache; byte[] cache;
if (inputLen - offSet > 256) { if (inputLen - offSet > 256) {
...@@ -67,11 +64,9 @@ public class RSAUtil { ...@@ -67,11 +64,9 @@ public class RSAUtil {
} else { } else {
cache = cipher.doFinal(encryptedData, offSet, inputLen - offSet); cache = cipher.doFinal(encryptedData, offSet, inputLen - offSet);
} }
out.write(cache, 0, cache.length); out.write(cache, 0, cache.length);
++i; ++i;
} }
decryptedData = out.toByteArray(); decryptedData = out.toByteArray();
out.close(); out.close();
} catch (Exception e) { } catch (Exception e) {
...@@ -102,7 +97,7 @@ public class RSAUtil { ...@@ -102,7 +97,7 @@ public class RSAUtil {
// 标识 // 标识
int offSet = 0; int offSet = 0;
byte[] resultBytes = {}; byte[] resultBytes = {};
byte[] cache = {}; byte[] cache;
while (inputLength - offSet > 0) { while (inputLength - offSet > 0) {
if (inputLength - offSet > MAX_ENCRYPT_BLOCK) { if (inputLength - offSet > MAX_ENCRYPT_BLOCK) {
cache = cipher.doFinal(inputArray, offSet, MAX_ENCRYPT_BLOCK); cache = cipher.doFinal(inputArray, offSet, MAX_ENCRYPT_BLOCK);
...@@ -117,8 +112,6 @@ public class RSAUtil { ...@@ -117,8 +112,6 @@ public class RSAUtil {
Base64.Encoder encoder = Base64.getEncoder(); Base64.Encoder encoder = Base64.getEncoder();
result = encoder.encodeToString(resultBytes); result = encoder.encodeToString(resultBytes);
} catch (Exception e) { } catch (Exception e) {
System.out.println(e);
System.out.println("rsaEncrypt error:" + e.getMessage());
} }
return result; return result;
} }
......
...@@ -24,7 +24,6 @@ public class TreeUtils { ...@@ -24,7 +24,6 @@ public class TreeUtils {
treeList.add(findChildren(treeNodes, treeNode)); treeList.add(findChildren(treeNodes, treeNode));
} }
} }
return treeList; return treeList;
} }
......
...@@ -34,16 +34,13 @@ public class VerificationCode { ...@@ -34,16 +34,13 @@ public class VerificationCode {
// 将图像填充为白色 // 将图像填充为白色
gd.setColor(Color.WHITE); gd.setColor(Color.WHITE);
gd.fillRect(0, 0, width, height); gd.fillRect(0, 0, width, height);
// 创建字体,字体的大小应该根据图片的高度来定。 // 创建字体,字体的大小应该根据图片的高度来定。
Font font = new Font("Fixedsys", Font.BOLD, fontHeight); Font font = new Font("Fixedsys", Font.BOLD, fontHeight);
// 设置字体。 // 设置字体。
gd.setFont(font); gd.setFont(font);
// randomCode用于保存随机产生的验证码,以便用户登录后进行验证。 // randomCode用于保存随机产生的验证码,以便用户登录后进行验证。
StringBuffer randomCode = new StringBuffer(); StringBuffer randomCode = new StringBuffer();
int red = 0, green = 0, blue = 0; int red, green, blue;
// 随机产生codeCount数字的验证码。 // 随机产生codeCount数字的验证码。
for (int i = 0; i < codeCount; i++) { for (int i = 0; i < codeCount; i++) {
// 得到随机产生的验证码数字。 // 得到随机产生的验证码数字。
...@@ -52,15 +49,13 @@ public class VerificationCode { ...@@ -52,15 +49,13 @@ public class VerificationCode {
red = random.nextInt(255); red = random.nextInt(255);
green = random.nextInt(255); green = random.nextInt(255);
blue = random.nextInt(255); blue = random.nextInt(255);
// 用随机产生的颜色将验证码绘制到图像中。 // 用随机产生的颜色将验证码绘制到图像中。
gd.setColor(new Color(red, green, blue)); gd.setColor(new Color(red, green, blue));
gd.drawString(code, (i + 1) * xx, codeY); gd.drawString(code, (i + 1) * xx, codeY);
// 将产生的四个随机数组合在一起。 // 将产生的四个随机数组合在一起。
randomCode.append(code); randomCode.append(code);
} }
Map<String, Object> map = new HashMap<String, Object>(); Map<String, Object> map = new HashMap<>();
//存放验证码 //存放验证码
map.put("code", randomCode); map.put("code", randomCode);
//存放生成的验证码BufferedImage对象 //存放生成的验证码BufferedImage对象
......
package xstartup.base; package xstartup.base;
import cn.hutool.core.util.ObjectUtil;
import xstartup.base.exception.XServiceException; import xstartup.base.exception.XServiceException;
import xstartup.base.util.XUuidUtils; import xstartup.base.util.XUuidUtils;
...@@ -15,26 +16,23 @@ public class XSelfServiceContext extends XContext { ...@@ -15,26 +16,23 @@ public class XSelfServiceContext extends XContext {
} }
public static XSelfServiceContext build(String logTag) { public static XSelfServiceContext build(String logTag) {
XSelfServiceContext context = new XSelfServiceContext(logTag); return new XSelfServiceContext(logTag);
return context;
} }
public static XSelfServiceContext build(Class<?> targetClass) { public static XSelfServiceContext build(Class<?> targetClass) {
XSelfServiceContext context = new XSelfServiceContext(targetClass.getName()); return new XSelfServiceContext(targetClass.getName());
return context;
} }
public XApp getApp() { public XApp getApp() {
if (this.app == null) { if (ObjectUtil.isNull(this.app)) {
XAppInfo appInfo = XStartup.getApplication(); XAppInfo appInfo = XStartup.getApplication();
this.app = new XApp(appInfo.getSystemId(), appInfo.getTenantId(), appInfo.getId()); this.app = new XApp(appInfo.getSystemId(), appInfo.getTenantId(), appInfo.getId());
} }
return this.app; return this.app;
} }
public XUser getUser() { public XUser getUser() {
if (this.user == null) { if (ObjectUtil.isNull(this.user)) {
this.user = XUser.createAnonymousUser("local", 1L, 1L, 1L, "xservice", "xservice"); this.user = XUser.createAnonymousUser("local", 1L, 1L, 1L, "xservice", "xservice");
} }
......
...@@ -33,23 +33,6 @@ public enum OuLevelConstant implements DictEnum { ...@@ -33,23 +33,6 @@ public enum OuLevelConstant implements DictEnum {
this.code = code; this.code = code;
} }
public static OuLevelConstant findByValue(Integer v) {
for (OuLevelConstant e : values()) {
if (e.getValue().equals(v)) {
return e;
}
}
return null;
}
public static OuLevelConstant findByDesc(String desc) {
for (OuLevelConstant e : values()) {
if (e.getDesc().equals(desc)) {
return e;
}
}
return null;
}
@Override @Override
public Integer getValue() { public Integer getValue() {
......
package pps.core.base.enums; package pps.core.base.enums;
import cn.hutool.core.text.CharSequenceUtil;
import com.baomidou.mybatisplus.annotation.EnumValue; import com.baomidou.mybatisplus.annotation.EnumValue;
import pps.core.common.enums.DictEnum; import pps.core.common.enums.DictEnum;
...@@ -15,8 +16,8 @@ public enum WindDirection implements DictEnum { ...@@ -15,8 +16,8 @@ public enum WindDirection implements DictEnum {
NO(360, "无持续风向"); NO(360, "无持续风向");
@EnumValue @EnumValue
private Integer value = 0; private Integer value;
private String desc = ""; private String desc;
WindDirection(Integer value, String desc) { WindDirection(Integer value, String desc) {
this.value = value; this.value = value;
...@@ -25,7 +26,7 @@ public enum WindDirection implements DictEnum { ...@@ -25,7 +26,7 @@ public enum WindDirection implements DictEnum {
public static WindDirection findByValue(String v) { public static WindDirection findByValue(String v) {
for (WindDirection e : values()) { for (WindDirection e : values()) {
if (e.getDesc().equals(v)) { if (CharSequenceUtil.equals(e.getDesc(), v)) {
return e; return e;
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment