2428 changed files with 187334 additions and 0 deletions
-
67common/cache/pom.xml
-
26common/cache/src/main/java/com/thing/common/cache/config/CacheManagerProperties.java
-
49common/cache/src/main/java/com/thing/common/cache/config/LocalCacheConfig.java
-
97common/cache/src/main/java/com/thing/common/cache/config/RedisConfig.java
-
160common/cache/src/main/java/com/thing/common/cache/constants/CacheNameEnum.java
-
26common/cache/src/main/java/com/thing/common/cache/redis/LettuceConnectionValidConfig.java
-
26common/cache/src/main/java/com/thing/common/cache/redis/LettuceConnectionValidTask.java
-
65common/cache/src/main/java/com/thing/common/cache/redis/RedisKeys.java
-
123common/cache/src/main/java/com/thing/common/cache/redis/RedisUtils.java
-
38common/cache/src/main/java/com/thing/common/cache/redis/SysParamsRedis.java
-
39common/cache/src/main/java/com/thing/common/cache/redis/aspect/RedisAspect.java
-
17common/cache/src/main/java/com/thing/common/cache/service/AbstractCacheService.java
-
40common/cache/src/main/java/com/thing/common/cache/service/CacheInitializer.java
-
129common/core/pom.xml
-
75common/core/src/main/java/com/thing/common/core/annotation/CustomExcel.java
-
17common/core/src/main/java/com/thing/common/core/annotation/CustomExcelCollection.java
-
21common/core/src/main/java/com/thing/common/core/annotation/LogOperation.java
-
41common/core/src/main/java/com/thing/common/core/config/AsyncEventConfig.java
-
20common/core/src/main/java/com/thing/common/core/config/RestTemplateConfig.java
-
429common/core/src/main/java/com/thing/common/core/constants/Constant.java
-
39common/core/src/main/java/com/thing/common/core/container/GlobalContainer.java
-
73common/core/src/main/java/com/thing/common/core/convert/DateConverter.java
-
30common/core/src/main/java/com/thing/common/core/enumeration/ActionType.java
-
36common/core/src/main/java/com/thing/common/core/enumeration/AggType.java
-
26common/core/src/main/java/com/thing/common/core/enumeration/AlarmSettingType.java
-
26common/core/src/main/java/com/thing/common/core/enumeration/AlarmStatus.java
-
35common/core/src/main/java/com/thing/common/core/enumeration/AlarmType.java
-
61common/core/src/main/java/com/thing/common/core/enumeration/ApiFuncEnum.java
-
26common/core/src/main/java/com/thing/common/core/enumeration/ApiSeparateAttr.java
-
46common/core/src/main/java/com/thing/common/core/enumeration/ApiType.java
-
61common/core/src/main/java/com/thing/common/core/enumeration/ApiTypeEnum.java
-
22common/core/src/main/java/com/thing/common/core/enumeration/ApiTypes.java
-
99common/core/src/main/java/com/thing/common/core/enumeration/AttributeEnum.java
-
225common/core/src/main/java/com/thing/common/core/enumeration/AttributeTypeEnum.java
-
16common/core/src/main/java/com/thing/common/core/enumeration/CacheEventType.java
-
35common/core/src/main/java/com/thing/common/core/enumeration/CalculationStatusEnum.java
-
22common/core/src/main/java/com/thing/common/core/enumeration/CalculationSymbol.java
-
35common/core/src/main/java/com/thing/common/core/enumeration/CarbonLifecycleEnum.java
-
49common/core/src/main/java/com/thing/common/core/enumeration/CloudService.java
-
22common/core/src/main/java/com/thing/common/core/enumeration/ColumnRelationType.java
-
22common/core/src/main/java/com/thing/common/core/enumeration/CompanyType.java
-
68common/core/src/main/java/com/thing/common/core/enumeration/ConfigTypeEnum.java
-
22common/core/src/main/java/com/thing/common/core/enumeration/ContainsCondition.java
-
28common/core/src/main/java/com/thing/common/core/enumeration/DataBaseType.java
-
22common/core/src/main/java/com/thing/common/core/enumeration/DataTreatingMarkEnum.java
-
55common/core/src/main/java/com/thing/common/core/enumeration/DatasetAttrTimestampType.java
-
31common/core/src/main/java/com/thing/common/core/enumeration/DatasetInterValType.java
-
22common/core/src/main/java/com/thing/common/core/enumeration/DatasetSeparateAttr.java
-
24common/core/src/main/java/com/thing/common/core/enumeration/DatasetStatus.java
-
22common/core/src/main/java/com/thing/common/core/enumeration/DatasetThingRelationStatus.java
-
39common/core/src/main/java/com/thing/common/core/enumeration/DefaultType.java
-
27common/core/src/main/java/com/thing/common/core/enumeration/DeleteEnum.java
-
22common/core/src/main/java/com/thing/common/core/enumeration/DeviceSendCmdStatus.java
-
22common/core/src/main/java/com/thing/common/core/enumeration/DeviceTemplateMark.java
-
26common/core/src/main/java/com/thing/common/core/enumeration/DictRelationEnum.java
-
60common/core/src/main/java/com/thing/common/core/enumeration/DictTypeEnum.java
-
23common/core/src/main/java/com/thing/common/core/enumeration/EnergyVarietyEnum.java
-
41common/core/src/main/java/com/thing/common/core/enumeration/ExtendRelationType.java
-
31common/core/src/main/java/com/thing/common/core/enumeration/FormulaSymbols.java
-
29common/core/src/main/java/com/thing/common/core/enumeration/GateWayStatus.java
-
50common/core/src/main/java/com/thing/common/core/enumeration/Granularity.java
-
70common/core/src/main/java/com/thing/common/core/enumeration/GroupTypeEnum.java
-
22common/core/src/main/java/com/thing/common/core/enumeration/IntervalPushStatus.java
-
21common/core/src/main/java/com/thing/common/core/enumeration/IsDefaultEnum.java
-
28common/core/src/main/java/com/thing/common/core/enumeration/MenuTypeEnum.java
-
64common/core/src/main/java/com/thing/common/core/enumeration/MimeTypeEnum.java
-
353common/core/src/main/java/com/thing/common/core/enumeration/MinioFileContentTypeEnum.java
-
38common/core/src/main/java/com/thing/common/core/enumeration/MonitorPolymerizationType.java
-
30common/core/src/main/java/com/thing/common/core/enumeration/MonitorTimeType.java
-
34common/core/src/main/java/com/thing/common/core/enumeration/MsgType.java
-
26common/core/src/main/java/com/thing/common/core/enumeration/OrderStatus.java
-
25common/core/src/main/java/com/thing/common/core/enumeration/PeakValleyEnum.java
-
22common/core/src/main/java/com/thing/common/core/enumeration/PermissionStatus.java
-
31common/core/src/main/java/com/thing/common/core/enumeration/Protocol.java
-
25common/core/src/main/java/com/thing/common/core/enumeration/ProtocolPrefix.java
-
22common/core/src/main/java/com/thing/common/core/enumeration/PushReceiveStatus.java
-
22common/core/src/main/java/com/thing/common/core/enumeration/PushStatus.java
-
12common/core/src/main/java/com/thing/common/core/enumeration/QueryChannel.java
-
24common/core/src/main/java/com/thing/common/core/enumeration/QueueEventType.java
-
35common/core/src/main/java/com/thing/common/core/enumeration/QueueOriginType.java
-
23common/core/src/main/java/com/thing/common/core/enumeration/RegionLeafEnum.java
-
22common/core/src/main/java/com/thing/common/core/enumeration/RegionLevelEnum.java
-
22common/core/src/main/java/com/thing/common/core/enumeration/RepeatPushStatus.java
-
40common/core/src/main/java/com/thing/common/core/enumeration/ReportTypeEnum.java
-
26common/core/src/main/java/com/thing/common/core/enumeration/RoleType.java
-
12common/core/src/main/java/com/thing/common/core/enumeration/RsaKeyType.java
-
22common/core/src/main/java/com/thing/common/core/enumeration/ScheduleStatus.java
-
22common/core/src/main/java/com/thing/common/core/enumeration/ShowStatus.java
-
98common/core/src/main/java/com/thing/common/core/enumeration/SignEnum.java
-
15common/core/src/main/java/com/thing/common/core/enumeration/SignTypeEnum.java
-
29common/core/src/main/java/com/thing/common/core/enumeration/SmsService.java
-
12common/core/src/main/java/com/thing/common/core/enumeration/SocketEventType.java
-
17common/core/src/main/java/com/thing/common/core/enumeration/SourceStatus.java
-
20common/core/src/main/java/com/thing/common/core/enumeration/SubscribeStatusEnum.java
-
27common/core/src/main/java/com/thing/common/core/enumeration/SuperAdminEnum.java
-
22common/core/src/main/java/com/thing/common/core/enumeration/SuperTenantEnum.java
-
22common/core/src/main/java/com/thing/common/core/enumeration/SyncUpdateEnum.java
-
22common/core/src/main/java/com/thing/common/core/enumeration/SysTenantEnum.java
-
26common/core/src/main/java/com/thing/common/core/enumeration/TaskTime.java
-
34common/core/src/main/java/com/thing/common/core/enumeration/TaskTimeType.java
@ -0,0 +1,67 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" |
||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
||||
|
<modelVersion>4.0.0</modelVersion> |
||||
|
<parent> |
||||
|
<groupId>com.thing</groupId> |
||||
|
<artifactId>common</artifactId> |
||||
|
<version>5.1</version> |
||||
|
</parent> |
||||
|
|
||||
|
<groupId>com.thing.common</groupId> |
||||
|
<artifactId>cache</artifactId> |
||||
|
<packaging>jar</packaging> |
||||
|
<name>ThingBI Server Common Cache</name> |
||||
|
|
||||
|
<properties> |
||||
|
<main.dir>${basedir}/..</main.dir> |
||||
|
</properties> |
||||
|
|
||||
|
<dependencies> |
||||
|
<dependency> |
||||
|
<groupId>org.springframework.boot</groupId> |
||||
|
<artifactId>spring-boot-dependencies</artifactId> |
||||
|
<version>${spring-boot.version}</version> |
||||
|
<type>pom</type> |
||||
|
</dependency> |
||||
|
<dependency> |
||||
|
<groupId>org.springframework.boot</groupId> |
||||
|
<artifactId>spring-boot-starter-aop</artifactId> |
||||
|
</dependency> |
||||
|
|
||||
|
<dependency> |
||||
|
<groupId>com.github.ben-manes.caffeine</groupId> |
||||
|
<artifactId>caffeine</artifactId> |
||||
|
</dependency> |
||||
|
|
||||
|
<dependency> |
||||
|
<groupId>org.springframework.boot</groupId> |
||||
|
<artifactId>spring-boot-starter-data-redis</artifactId> |
||||
|
<exclusions> |
||||
|
<exclusion> |
||||
|
<groupId>org.yaml</groupId> |
||||
|
<artifactId>snakeyaml</artifactId> |
||||
|
</exclusion> |
||||
|
</exclusions> |
||||
|
</dependency> |
||||
|
|
||||
|
<dependency> |
||||
|
<groupId>org.springframework</groupId> |
||||
|
<artifactId>spring-context-support</artifactId> |
||||
|
</dependency> |
||||
|
<dependency> |
||||
|
<groupId>org.springframework.boot</groupId> |
||||
|
<artifactId>spring-boot-starter-aop</artifactId> |
||||
|
</dependency> |
||||
|
<dependency> |
||||
|
<groupId>com.alibaba</groupId> |
||||
|
<artifactId>fastjson</artifactId> |
||||
|
</dependency> |
||||
|
|
||||
|
<dependency> |
||||
|
<groupId>org.projectlombok</groupId> |
||||
|
<artifactId>lombok</artifactId> |
||||
|
</dependency> |
||||
|
</dependencies> |
||||
|
</project> |
||||
@ -0,0 +1,26 @@ |
|||||
|
package com.thing.common.cache.config; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
import org.springframework.boot.context.properties.ConfigurationProperties; |
||||
|
import org.springframework.stereotype.Component; |
||||
|
|
||||
|
import java.util.Map; |
||||
|
|
||||
|
/** |
||||
|
* @author siyang |
||||
|
* @date 2024-03-29 |
||||
|
* @description |
||||
|
*/ |
||||
|
@Data |
||||
|
@Component |
||||
|
@ConfigurationProperties(prefix = "cache-manager") |
||||
|
public class CacheManagerProperties { |
||||
|
private Map<String, CacheSpecs> specs; |
||||
|
|
||||
|
@Data |
||||
|
public static class CacheSpecs { |
||||
|
private Integer timeToLiveInMinutes; |
||||
|
private Integer maxSize; |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,49 @@ |
|||||
|
package com.thing.common.cache.config; |
||||
|
|
||||
|
import com.github.benmanes.caffeine.cache.Caffeine; |
||||
|
import com.thing.common.cache.config.CacheManagerProperties.CacheSpecs; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
import lombok.RequiredArgsConstructor; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
|
||||
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; |
||||
|
import org.springframework.cache.CacheManager; |
||||
|
import org.springframework.cache.annotation.EnableCaching; |
||||
|
import org.springframework.cache.caffeine.CaffeineCacheManager; |
||||
|
import org.springframework.context.annotation.Bean; |
||||
|
import org.springframework.context.annotation.Configuration; |
||||
|
|
||||
|
import java.util.Map; |
||||
|
import java.util.concurrent.TimeUnit; |
||||
|
|
||||
|
/** |
||||
|
* @author zhenghh. 2021-11-01 |
||||
|
*/ |
||||
|
@Data |
||||
|
@Slf4j |
||||
|
@EnableCaching |
||||
|
@Configuration |
||||
|
@RequiredArgsConstructor |
||||
|
@ConditionalOnProperty(name = "spring.cache.type", havingValue = "caffeine", matchIfMissing = true) |
||||
|
public class LocalCacheConfig { |
||||
|
private final CacheManagerProperties cacheManagerProperties; |
||||
|
|
||||
|
/** 初始化缓存管理器 */ |
||||
|
@Bean |
||||
|
public CacheManager cacheManager() { |
||||
|
log.info("【caffeine】===初始化本地缓存管理器"); |
||||
|
Map<String, CacheSpecs> specs = cacheManagerProperties.getSpecs(); |
||||
|
CaffeineCacheManager cacheManager = new CaffeineCacheManager(); |
||||
|
for (String name : specs.keySet()) { |
||||
|
Caffeine<Object, Object> cacheBuilder = |
||||
|
Caffeine.newBuilder() |
||||
|
.maximumSize(specs.get(name).getMaxSize()) |
||||
|
.expireAfterWrite( |
||||
|
specs.get(name).getTimeToLiveInMinutes(), TimeUnit.MINUTES) |
||||
|
.recordStats(); |
||||
|
cacheManager.registerCustomCache(name, cacheBuilder.build()); |
||||
|
} |
||||
|
return cacheManager; |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,97 @@ |
|||||
|
package com.thing.common.cache.config; |
||||
|
|
||||
|
import com.alibaba.fastjson.support.spring.GenericFastJsonRedisSerializer; |
||||
|
import com.thing.common.cache.config.CacheManagerProperties.CacheSpecs; |
||||
|
|
||||
|
import jakarta.annotation.Resource; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
import lombok.RequiredArgsConstructor; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
|
||||
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; |
||||
|
import org.springframework.cache.CacheManager; |
||||
|
import org.springframework.cache.annotation.EnableCaching; |
||||
|
import org.springframework.context.annotation.Bean; |
||||
|
import org.springframework.context.annotation.Configuration; |
||||
|
import org.springframework.data.redis.cache.RedisCacheConfiguration; |
||||
|
import org.springframework.data.redis.cache.RedisCacheManager; |
||||
|
import org.springframework.data.redis.connection.RedisConnectionFactory; |
||||
|
import org.springframework.data.redis.core.RedisTemplate; |
||||
|
import org.springframework.data.redis.serializer.*; |
||||
|
|
||||
|
import java.time.Duration; |
||||
|
import java.util.HashMap; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
/** |
||||
|
* Redis配置 |
||||
|
* |
||||
|
* @author Mark sunlightcs@gmail.com |
||||
|
*/ |
||||
|
@Data |
||||
|
@Slf4j |
||||
|
@EnableCaching |
||||
|
@Configuration |
||||
|
@RequiredArgsConstructor |
||||
|
@ConditionalOnProperty(name = "spring.cache.type", havingValue = "redis", matchIfMissing = true) |
||||
|
public class RedisConfig { |
||||
|
@Resource private RedisConnectionFactory factory; |
||||
|
@Resource private CacheManagerProperties cacheManagerProperties; |
||||
|
|
||||
|
/** |
||||
|
* 为了方便缓存(caffeine和redis)的切换,不建议显示使用redisTemplate |
||||
|
* 需要用缓存的地方统一使用SpringCache注解,譬如@Cacheable |
||||
|
*/ |
||||
|
@Bean |
||||
|
public RedisTemplate<String, Object> redisTemplate() { |
||||
|
RedisTemplate<String, Object> redisTemplate = new RedisTemplate<>(); |
||||
|
redisTemplate.setConnectionFactory(factory); |
||||
|
|
||||
|
// 设置序列化方式 |
||||
|
StringRedisSerializer keySerializer = new StringRedisSerializer(); |
||||
|
RedisSerializer<Object> valSerializer = new GenericFastJsonRedisSerializer(); |
||||
|
|
||||
|
redisTemplate.setKeySerializer(keySerializer); |
||||
|
redisTemplate.setValueSerializer(valSerializer); |
||||
|
|
||||
|
redisTemplate.setHashKeySerializer(keySerializer); |
||||
|
redisTemplate.setHashValueSerializer(valSerializer); |
||||
|
|
||||
|
redisTemplate.afterPropertiesSet(); |
||||
|
return redisTemplate; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 采用spring的cache注解时,会使用此处定义的cacheManager |
||||
|
* 如果在管理器中没有配置某个缓存,则会无限期存储,且不会使用json序列化 |
||||
|
*/ |
||||
|
@Bean |
||||
|
public CacheManager cacheManager() { |
||||
|
log.info("【redis】===初始化redis缓存管理器"); |
||||
|
Map<String, CacheSpecs> specs = cacheManagerProperties.getSpecs(); |
||||
|
RedisSerializer<Object> valSerializer = new GenericFastJsonRedisSerializer(); |
||||
|
|
||||
|
RedisCacheConfiguration defaultCacheConfig = |
||||
|
RedisCacheConfiguration.defaultCacheConfig() |
||||
|
.serializeKeysWith( |
||||
|
RedisSerializationContext.SerializationPair.fromSerializer( |
||||
|
new StringRedisSerializer())) |
||||
|
.serializeValuesWith( |
||||
|
RedisSerializationContext.SerializationPair.fromSerializer( |
||||
|
valSerializer)); |
||||
|
|
||||
|
// 创建各个缓存的配置,每个缓存可以有不同的过期时间 |
||||
|
Map<String, RedisCacheConfiguration> cacheConfigurations = new HashMap<>(); |
||||
|
specs.forEach( |
||||
|
(cacheName, spec) -> |
||||
|
cacheConfigurations.put( |
||||
|
cacheName, |
||||
|
defaultCacheConfig.entryTtl( |
||||
|
Duration.ofMinutes(spec.getTimeToLiveInMinutes())))); |
||||
|
|
||||
|
return RedisCacheManager.builder(factory) |
||||
|
.withInitialCacheConfigurations(cacheConfigurations) |
||||
|
.build(); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,160 @@ |
|||||
|
package com.thing.common.cache.constants; |
||||
|
|
||||
|
|
||||
|
import lombok.Getter; |
||||
|
|
||||
|
/** |
||||
|
* @author mark. 2021-11-01 |
||||
|
*/ |
||||
|
public class CacheNameEnum { |
||||
|
/** 物模型 */ |
||||
|
@Getter |
||||
|
public enum ModelField { |
||||
|
THING_MODEL_ID("id"), |
||||
|
THING_MODEL_CODE("code"), |
||||
|
THING_MODEL_TOKEN("token"), |
||||
|
THING_MODEL_GATEWAY("gateway"), |
||||
|
THING_MODEL_ORIGIN("origin"), |
||||
|
THING_MODEL_REAL_TYPE("realType"), |
||||
|
THING_MODEL_CREATE_DATE("create_date"), |
||||
|
THING_MODEL_STATUS("status"), |
||||
|
THING_MODEL_STATUS_TS("statusTs"); |
||||
|
private final String field; |
||||
|
ModelField(String field) { |
||||
|
this.field = field; |
||||
|
} |
||||
|
} |
||||
|
/** 物实体 */ |
||||
|
@Getter |
||||
|
public enum EntityField { |
||||
|
THING_ENTITY_ID("entityId"), |
||||
|
THING_ENTITY_CODE("entityCode"), |
||||
|
THING_ENTITY_NAME("entityName"), |
||||
|
THING_ENTITY_TENANT_CODE("tenantCode"), |
||||
|
THING_ENTITY_TYPE("entityType"), |
||||
|
THING_ENTITY_DEPT_IDS("deptIds"), |
||||
|
THING_ENTITY_STATUS("status"), |
||||
|
THING_ENTITY_DEPT_NAME("deptName"), |
||||
|
THING_ENTITY_REAL_TYPE("realType"), |
||||
|
THING_ENTITY_TAGS("tags"), |
||||
|
THING_ENTITY_CREATE_DATE("create_date"), |
||||
|
THING_ENTITY_ENABLE_STATUS("enableStatus"), |
||||
|
THING_ENTITY_TEMPLATE_MARK("templateMark"); |
||||
|
private final String field; |
||||
|
EntityField(String field) { |
||||
|
this.field = field; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
|
||||
|
@Getter |
||||
|
public enum DictField { |
||||
|
THING_DICT_ID("id"), |
||||
|
THING_DICT_ENTITY_NAME("entityName"), |
||||
|
THING_DICT_ENTITY_CODE("entityCode"), |
||||
|
THING_DICT_GROUP_NAME("groupName"), |
||||
|
THING_DICT_DATA_TYPE("dataType"), |
||||
|
THING_DICT_TEMPLATE_MARK("templateMark"), |
||||
|
THING_DICT_TENANT_CODE("tenantCode"), |
||||
|
THING_DICT_NAME("name"), |
||||
|
THING_DICT_CODE("code"), |
||||
|
THING_DICT_CREATE_DATE("create_date"), |
||||
|
THING_DICT_ENTITY_ID("entityId"), |
||||
|
THING_DICT_RELATION_SORT("sort"); |
||||
|
private final String field; |
||||
|
DictField(String field) { |
||||
|
this.field = field; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
@Getter |
||||
|
public enum RelationRootField { |
||||
|
THING_RELATION_ROOT_ID("id"), |
||||
|
THING_RELATION_ROOT_CHILDREN("children"), |
||||
|
THING_RELATION_ROOT_TENANT_CODE("tenantCode"), |
||||
|
THING_RELATION_ROOT_GROUP_NAME("groupName"), |
||||
|
THING_RELATION_ROOT_ENTITY_NAME("entityName"), |
||||
|
THING_RELATION_ROOT_ENTITY_TYPE("entityType"), |
||||
|
THING_RELATION_ROOT_NAME("name"), |
||||
|
THING_RELATION_ROOT_CREATE_DATE("create_date"), |
||||
|
THING_RELATION_ROOT_SORT("sort"); |
||||
|
|
||||
|
private final String field; |
||||
|
RelationRootField(String field) { |
||||
|
this.field = field; |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
|
||||
|
@Getter |
||||
|
public enum RelationDetailField { |
||||
|
THING_RELATION_DETAIL_ID("id"), |
||||
|
THING_RELATION_DETAIL_ROOT_ID("rootId"), |
||||
|
THING_RELATION_DETAIL_FROM_ID("fromId"), |
||||
|
THING_RELATION_DETAIL_FROM_NAME("fromName"), |
||||
|
THING_RELATION_DETAIL_FROM_CODE("fromCode"), |
||||
|
THING_RELATION_DETAIL_ROOT_THING_ID("rootThingId"), |
||||
|
THING_RELATION_DETAIL_CHILDREN("children"), |
||||
|
THING_RELATION_DETAIL_TO_ID("toId"), |
||||
|
THING_RELATION_DETAIL_TO_NAME("toName"), |
||||
|
THING_RELATION_DETAIL_TO_CODE("toCode"), |
||||
|
THING_RELATION_DETAIL_CREATE_DATE("createDate"), |
||||
|
THING_RELATION_DETAIL_SORT("sort") |
||||
|
; |
||||
|
private final String field; |
||||
|
RelationDetailField(String field) { |
||||
|
this.field = field; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
|
||||
|
/** 物计算项 */ |
||||
|
@Deprecated |
||||
|
public static final String CALCULATION_ATTRIBUTES = "calculationAttributes"; |
||||
|
/** 告警规则 */ |
||||
|
public static final String ALARM_RULE = "alarmRule"; |
||||
|
/** 告警物 */ |
||||
|
public static final String ALARM_RULE_ENTITY = "alarmRuleEntity"; |
||||
|
/** 告警动作 */ |
||||
|
public static final String ALARM_RULE_ACTION = "alarmRuleAction"; |
||||
|
/** 数据解析 */ |
||||
|
public static final String SCRIPT_INFO = "scriptInfo"; |
||||
|
|
||||
|
/** 承租人物编码 */ |
||||
|
public static final String AUTH_THING_CODES = "authThingCodes"; |
||||
|
|
||||
|
/** 物模型 */ |
||||
|
public static final String THING_MODEL = "thingModel"; |
||||
|
/** 物实体 */ |
||||
|
public static final String THING_ENTITY = "thingEntity"; |
||||
|
/** 物属性 */ |
||||
|
public final static String THING_DICT = "thingDict"; |
||||
|
/** 物指标 */ |
||||
|
public static final String THING_DICT_RELATION = "thingDictRelation"; |
||||
|
/** 物关系 */ |
||||
|
public static final String THING_ROOT_RELATION = "thingRootRelation"; |
||||
|
/** 物根关系 */ |
||||
|
public static final String THING_DETAIL_RELATION = "thingDetailRelation"; |
||||
|
|
||||
|
/** |
||||
|
* 新版本物计算配置 |
||||
|
*/ |
||||
|
public final static String THING_CALC_CONFIG = "thingCalcConfig"; |
||||
|
|
||||
|
/** |
||||
|
* 过滤规则 |
||||
|
*/ |
||||
|
public final static String FILTER_RULE = "filterRule"; |
||||
|
|
||||
|
/** |
||||
|
* 模拟数据配置 |
||||
|
*/ |
||||
|
public final static String MOCK_DATA_CONFIG = "mockDataConfig"; |
||||
|
|
||||
|
/** |
||||
|
* 模拟数据某配置下的最新一笔数据的时间 |
||||
|
*/ |
||||
|
public final static String MOCK_DATA_LATEST_TIME = "mockDataLatestTime"; |
||||
|
|
||||
|
|
||||
|
} |
||||
@ -0,0 +1,26 @@ |
|||||
|
package com.thing.common.cache.redis; |
||||
|
|
||||
|
import com.thing.common.cache.config.RedisConfig; |
||||
|
import lombok.RequiredArgsConstructor; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
|
||||
|
import org.springframework.beans.factory.InitializingBean; |
||||
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; |
||||
|
import org.springframework.data.redis.connection.RedisConnectionFactory; |
||||
|
import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory; |
||||
|
import org.springframework.stereotype.Component; |
||||
|
|
||||
|
@Slf4j |
||||
|
@Component |
||||
|
@RequiredArgsConstructor |
||||
|
@ConditionalOnBean(RedisConfig.class) |
||||
|
public class LettuceConnectionValidConfig implements InitializingBean { |
||||
|
private final RedisConnectionFactory redisConnectionFactory; |
||||
|
|
||||
|
@Override |
||||
|
public void afterPropertiesSet() { |
||||
|
if (redisConnectionFactory instanceof LettuceConnectionFactory c) { |
||||
|
c.setValidateConnection(true); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,26 @@ |
|||||
|
package com.thing.common.cache.redis; |
||||
|
|
||||
|
import com.thing.common.cache.config.RedisConfig; |
||||
|
import lombok.RequiredArgsConstructor; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
|
||||
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; |
||||
|
import org.springframework.data.redis.connection.RedisConnectionFactory; |
||||
|
import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory; |
||||
|
import org.springframework.scheduling.annotation.Scheduled; |
||||
|
import org.springframework.stereotype.Component; |
||||
|
|
||||
|
@Slf4j |
||||
|
@Component |
||||
|
@RequiredArgsConstructor |
||||
|
@ConditionalOnBean(RedisConfig.class) |
||||
|
public class LettuceConnectionValidTask { |
||||
|
private final RedisConnectionFactory redisConnectionFactory; |
||||
|
|
||||
|
@Scheduled(cron = "0/2 * * * * ?") |
||||
|
public void task() { |
||||
|
if (redisConnectionFactory instanceof LettuceConnectionFactory c) { |
||||
|
c.validateConnection(); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,65 @@ |
|||||
|
|
||||
|
|
||||
|
package com.thing.common.cache.redis; |
||||
|
|
||||
|
/** |
||||
|
* @author Mark sunlightcs@gmail.com |
||||
|
* @since 1.0.0 |
||||
|
*/ |
||||
|
public class RedisKeys { |
||||
|
/** |
||||
|
* 系统参数Key |
||||
|
*/ |
||||
|
public static String getSysParamsKey(){ |
||||
|
return "sys:params"; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 系统参数Key |
||||
|
*/ |
||||
|
public static String getSysParamsKey(String paramCode){ |
||||
|
return "sys:params:" + paramCode; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 验证码Key |
||||
|
*/ |
||||
|
public static String getCaptchaKey(String uuid){ |
||||
|
return "sys:captcha:" + uuid; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 登录用户Key |
||||
|
*/ |
||||
|
public static String getSecurityUserKey(Long id){ |
||||
|
return "sys:security:user:" + id; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 系统日志Key |
||||
|
*/ |
||||
|
public static String getSysLogKey(){ |
||||
|
return "sys:log"; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 系统资源Key |
||||
|
*/ |
||||
|
public static String getSysResourceKey(){ |
||||
|
return "sys:resource"; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 用户菜单导航Key |
||||
|
*/ |
||||
|
public static String getUserMenuNavKey(Long userId){ |
||||
|
return "sys:user:nav:" + userId; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 用户权限标识Key |
||||
|
*/ |
||||
|
public static String getUserPermissionsKey(Long userId){ |
||||
|
return "sys:user:permissions:" + userId; |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,123 @@ |
|||||
|
package com.thing.common.cache.redis; |
||||
|
|
||||
|
import com.thing.common.cache.config.RedisConfig; |
||||
|
import lombok.RequiredArgsConstructor; |
||||
|
|
||||
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; |
||||
|
import org.springframework.data.redis.core.HashOperations; |
||||
|
import org.springframework.data.redis.core.RedisTemplate; |
||||
|
import org.springframework.stereotype.Component; |
||||
|
|
||||
|
import java.util.Collection; |
||||
|
import java.util.Map; |
||||
|
import java.util.concurrent.TimeUnit; |
||||
|
|
||||
|
/** |
||||
|
* Redis工具类 |
||||
|
* |
||||
|
* @author Mark sunlightcs@gmail.com |
||||
|
*/ |
||||
|
@Component |
||||
|
@RequiredArgsConstructor |
||||
|
@SuppressWarnings("unused") |
||||
|
@ConditionalOnBean(RedisConfig.class) |
||||
|
public class RedisUtils { |
||||
|
private final RedisTemplate<String, Object> redisTemplate; |
||||
|
|
||||
|
/** 默认过期时长为24小时,单位:秒 */ |
||||
|
public final static long DEFAULT_EXPIRE = 60 * 60 * 24L; |
||||
|
/** 过期时长为1小时,单位:秒 */ |
||||
|
public final static long HOUR_ONE_EXPIRE = (long) 60 * 60; |
||||
|
/** 过期时长为6小时,单位:秒 */ |
||||
|
public final static long HOUR_SIX_EXPIRE = 60 * 60 * 6L; |
||||
|
/** 不设置过期时长 */ |
||||
|
public final static long NOT_EXPIRE = -1L; |
||||
|
|
||||
|
public void set(String key, Object value, long expire){ |
||||
|
redisTemplate.opsForValue().set(key, value); |
||||
|
if(expire != NOT_EXPIRE){ |
||||
|
expire(key, expire); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
public void set(String key, Object value){ |
||||
|
set(key, value, DEFAULT_EXPIRE); |
||||
|
} |
||||
|
|
||||
|
public Object get(String key, long expire) { |
||||
|
Object value = redisTemplate.opsForValue().get(key); |
||||
|
if(expire != NOT_EXPIRE){ |
||||
|
expire(key, expire); |
||||
|
} |
||||
|
return value; |
||||
|
} |
||||
|
|
||||
|
public Object get(String key) { |
||||
|
return get(key, NOT_EXPIRE); |
||||
|
} |
||||
|
|
||||
|
public void delete(String key) { |
||||
|
redisTemplate.delete(key); |
||||
|
} |
||||
|
|
||||
|
public void delete(Collection<String> keys) { |
||||
|
redisTemplate.delete(keys); |
||||
|
} |
||||
|
|
||||
|
public Object hGet(String key, String field) { |
||||
|
return redisTemplate.opsForHash().get(key, field); |
||||
|
} |
||||
|
|
||||
|
public Map<String, Object> hGetAll(String key){ |
||||
|
HashOperations<String, String, Object> hashOperations = redisTemplate.opsForHash(); |
||||
|
return hashOperations.entries(key); |
||||
|
} |
||||
|
|
||||
|
public void hMSet(String key, Map<String, Object> map){ |
||||
|
hMSet(key, map, DEFAULT_EXPIRE); |
||||
|
} |
||||
|
|
||||
|
public void hMSet(String key, Map<String, Object> map, long expire){ |
||||
|
redisTemplate.opsForHash().putAll(key, map); |
||||
|
|
||||
|
if(expire != NOT_EXPIRE){ |
||||
|
expire(key, expire); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
public void hSet(String key, String field, Object value) { |
||||
|
hSet(key, field, value, DEFAULT_EXPIRE); |
||||
|
} |
||||
|
|
||||
|
public void hSet(String key, String field, Object value, long expire) { |
||||
|
redisTemplate.opsForHash().put(key, field, value); |
||||
|
|
||||
|
if(expire != NOT_EXPIRE){ |
||||
|
expire(key, expire); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
public void expire(String key, long expire){ |
||||
|
redisTemplate.expire(key, expire, TimeUnit.SECONDS); |
||||
|
} |
||||
|
|
||||
|
public void hDel(String key, Object... fields){ |
||||
|
redisTemplate.opsForHash().delete(key, fields); |
||||
|
} |
||||
|
|
||||
|
public void leftPush(String key, Object value){ |
||||
|
leftPush(key, value, DEFAULT_EXPIRE); |
||||
|
} |
||||
|
|
||||
|
public void leftPush(String key, Object value, long expire){ |
||||
|
redisTemplate.opsForList().leftPush(key, value); |
||||
|
|
||||
|
if(expire != NOT_EXPIRE){ |
||||
|
expire(key, expire); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
public Object rightPop(String key){ |
||||
|
return redisTemplate.opsForList().rightPop(key); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,38 @@ |
|||||
|
package com.thing.common.cache.redis; |
||||
|
|
||||
|
import com.thing.common.cache.config.RedisConfig; |
||||
|
import lombok.RequiredArgsConstructor; |
||||
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; |
||||
|
import org.springframework.stereotype.Component; |
||||
|
|
||||
|
/** |
||||
|
* 参数管理 |
||||
|
* |
||||
|
* @author Mark sunlightcs@gmail.com |
||||
|
* @since 1.0.0 |
||||
|
*/ |
||||
|
@Component |
||||
|
@RequiredArgsConstructor |
||||
|
@ConditionalOnBean(RedisConfig.class) |
||||
|
public class SysParamsRedis { |
||||
|
private final RedisUtils redisUtils; |
||||
|
|
||||
|
public void delete(Object[] paramCodes) { |
||||
|
String key = RedisKeys.getSysParamsKey(); |
||||
|
redisUtils.hDel(key, paramCodes); |
||||
|
} |
||||
|
|
||||
|
public void set(String paramCode, String paramValue){ |
||||
|
if(paramValue == null){ |
||||
|
return ; |
||||
|
} |
||||
|
String key = RedisKeys.getSysParamsKey(); |
||||
|
redisUtils.hSet(key, paramCode, paramValue); |
||||
|
} |
||||
|
|
||||
|
public String get(String paramCode){ |
||||
|
String key = RedisKeys.getSysParamsKey(); |
||||
|
return (String)redisUtils.hGet(key, paramCode); |
||||
|
} |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,39 @@ |
|||||
|
package com.thing.common.cache.redis.aspect; |
||||
|
|
||||
|
import com.thing.common.cache.config.RedisConfig; |
||||
|
import org.aspectj.lang.ProceedingJoinPoint; |
||||
|
import org.aspectj.lang.annotation.Around; |
||||
|
import org.aspectj.lang.annotation.Aspect; |
||||
|
import org.slf4j.Logger; |
||||
|
import org.slf4j.LoggerFactory; |
||||
|
import org.springframework.beans.factory.annotation.Value; |
||||
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; |
||||
|
import org.springframework.stereotype.Component; |
||||
|
|
||||
|
/** |
||||
|
* Redis切面处理类 |
||||
|
* |
||||
|
* @author Mark sunlightcs@gmail.com |
||||
|
*/ |
||||
|
@Aspect |
||||
|
@Component |
||||
|
@ConditionalOnBean(RedisConfig.class) |
||||
|
public class RedisAspect { |
||||
|
private final Logger logger = LoggerFactory.getLogger(getClass()); |
||||
|
|
||||
|
@Value("${spring.cache.type}") |
||||
|
private String cacheType; |
||||
|
|
||||
|
@Around("execution(* com.thing.common.cache.redis.RedisUtils.*(..))") |
||||
|
public Object around(ProceedingJoinPoint point) throws Throwable { |
||||
|
Object result = null; |
||||
|
if("redis".equals(cacheType)){ |
||||
|
try{ |
||||
|
result = point.proceed(); |
||||
|
}catch (Exception e){ |
||||
|
logger.error("redis error", e); |
||||
|
} |
||||
|
} |
||||
|
return result; |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,17 @@ |
|||||
|
package com.thing.common.cache.service; |
||||
|
|
||||
|
/** |
||||
|
* @author SiYang |
||||
|
* @date 2024/01/19 14:07 |
||||
|
* @description 缓存服务,用来初始化缓存 |
||||
|
* 1. 业务类数据初始化采用该初始化器 |
||||
|
* 2. 技术架构类依赖的初始化采用 CommandLineRunner |
||||
|
*/ |
||||
|
public abstract class AbstractCacheService { |
||||
|
|
||||
|
/** 定义缓存名称 */ |
||||
|
public abstract String getCacheName(); |
||||
|
|
||||
|
/** 项目启动时初始化缓存 */ |
||||
|
public abstract void initCache(); |
||||
|
} |
||||
@ -0,0 +1,40 @@ |
|||||
|
package com.thing.common.cache.service; |
||||
|
|
||||
|
import lombok.RequiredArgsConstructor; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
import org.springframework.context.ApplicationListener; |
||||
|
import org.springframework.context.ConfigurableApplicationContext; |
||||
|
import org.springframework.context.event.ContextRefreshedEvent; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
import org.springframework.util.CollectionUtils; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* @author SiYang |
||||
|
* @date 2024/01/24 23:20 |
||||
|
* @description 缓存初始化器 |
||||
|
*/ |
||||
|
@Slf4j |
||||
|
@Service |
||||
|
@RequiredArgsConstructor |
||||
|
public class CacheInitializer implements ApplicationListener<ContextRefreshedEvent> { |
||||
|
private final List<AbstractCacheService> cacheInitializers; |
||||
|
|
||||
|
/** 容器初始化时缓存预热 */ |
||||
|
@Override |
||||
|
public void onApplicationEvent(ContextRefreshedEvent event) { |
||||
|
// 确保事件来源是容器本身,避免处理容器中的其他刷新事件 |
||||
|
if (event.getSource() instanceof ConfigurableApplicationContext) { |
||||
|
if (CollectionUtils.isEmpty(cacheInitializers)) { |
||||
|
return; |
||||
|
} |
||||
|
// 初始化缓存 |
||||
|
cacheInitializers.forEach( |
||||
|
e -> { |
||||
|
log.info("初始化缓存: {}", e.getCacheName()); |
||||
|
e.initCache(); |
||||
|
}); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,129 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" |
||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
||||
|
<modelVersion>4.0.0</modelVersion> |
||||
|
<parent> |
||||
|
<groupId>com.thing</groupId> |
||||
|
<artifactId>common</artifactId> |
||||
|
<version>5.1</version> |
||||
|
</parent> |
||||
|
|
||||
|
<groupId>com.thing.common</groupId> |
||||
|
<artifactId>core</artifactId> |
||||
|
<packaging>jar</packaging> |
||||
|
<name>ThingBI Server Common Core</name> |
||||
|
|
||||
|
<properties> |
||||
|
<main.dir>${basedir}/..</main.dir> |
||||
|
</properties> |
||||
|
<dependencies> |
||||
|
<dependency> |
||||
|
<groupId>org.springframework.boot</groupId> |
||||
|
<artifactId>spring-boot-starter-web</artifactId> |
||||
|
</dependency> |
||||
|
|
||||
|
<!--<dependency> |
||||
|
<groupId>org.springframework.boot</groupId> |
||||
|
<artifactId>spring-boot-starter-undertow</artifactId> |
||||
|
</dependency>--> |
||||
|
|
||||
|
<dependency> |
||||
|
<groupId>org.springframework.boot</groupId> |
||||
|
<artifactId>spring-boot-starter-validation</artifactId> |
||||
|
</dependency> |
||||
|
|
||||
|
<!-- hutool --> |
||||
|
<dependency> |
||||
|
<groupId>cn.hutool</groupId> |
||||
|
<artifactId>hutool-all</artifactId> |
||||
|
</dependency> |
||||
|
<dependency> |
||||
|
<groupId>com.fasterxml.jackson.core</groupId> |
||||
|
<artifactId>jackson-databind</artifactId> |
||||
|
</dependency> |
||||
|
<!-- JSON --> |
||||
|
<dependency> |
||||
|
<groupId>com.alibaba</groupId> |
||||
|
<artifactId>fastjson</artifactId> |
||||
|
</dependency> |
||||
|
|
||||
|
<!-- guava --> |
||||
|
<dependency> |
||||
|
<groupId>com.google.guava</groupId> |
||||
|
<artifactId>guava</artifactId> |
||||
|
</dependency> |
||||
|
|
||||
|
<!-- yml 解析工具 --> |
||||
|
<dependency> |
||||
|
<groupId>org.yaml</groupId> |
||||
|
<artifactId>snakeyaml</artifactId> |
||||
|
</dependency> |
||||
|
|
||||
|
<dependency> |
||||
|
<groupId>commons-io</groupId> |
||||
|
<artifactId>commons-io</artifactId> |
||||
|
</dependency> |
||||
|
|
||||
|
<!--常用工具类 --> |
||||
|
<dependency> |
||||
|
<groupId>org.apache.commons</groupId> |
||||
|
<artifactId>commons-lang3</artifactId> |
||||
|
</dependency> |
||||
|
|
||||
|
<dependency> |
||||
|
<groupId>com.github.jsonzou</groupId> |
||||
|
<artifactId>jmockdata</artifactId> |
||||
|
</dependency> |
||||
|
<!-- easy poi --> |
||||
|
<dependency> |
||||
|
<groupId>cn.afterturn</groupId> |
||||
|
<artifactId>easypoi-base</artifactId> |
||||
|
</dependency> |
||||
|
<dependency> |
||||
|
<groupId>cn.afterturn</groupId> |
||||
|
<artifactId>easypoi-web</artifactId> |
||||
|
</dependency> |
||||
|
<dependency> |
||||
|
<groupId>cn.afterturn</groupId> |
||||
|
<artifactId>easypoi-annotation</artifactId> |
||||
|
</dependency> |
||||
|
<dependency> |
||||
|
<groupId>jakarta.validation</groupId> |
||||
|
<artifactId>jakarta.validation-api</artifactId> |
||||
|
</dependency> |
||||
|
<dependency> |
||||
|
<groupId>jakarta.annotation</groupId> |
||||
|
<artifactId>jakarta.annotation-api</artifactId> |
||||
|
</dependency> |
||||
|
<dependency> |
||||
|
<groupId>jakarta.servlet</groupId> |
||||
|
<artifactId>jakarta.servlet-api</artifactId> |
||||
|
</dependency> |
||||
|
<dependency> |
||||
|
<groupId>javax.annotation</groupId> |
||||
|
<artifactId>javax.annotation-api</artifactId> |
||||
|
</dependency> |
||||
|
<dependency> |
||||
|
<groupId>org.projectlombok</groupId> |
||||
|
<artifactId>lombok</artifactId> |
||||
|
</dependency> |
||||
|
<dependency> |
||||
|
<groupId>joda-time</groupId> |
||||
|
<artifactId>joda-time</artifactId> |
||||
|
</dependency> |
||||
|
<dependency> |
||||
|
<groupId>com.thing.common</groupId> |
||||
|
<artifactId>data</artifactId> |
||||
|
</dependency> |
||||
|
<dependency> |
||||
|
<groupId>org.bouncycastle</groupId> |
||||
|
<artifactId>bcprov-jdk18on</artifactId> |
||||
|
</dependency> |
||||
|
<dependency> |
||||
|
<groupId>com.github.xiaoymin</groupId> |
||||
|
<artifactId>knife4j-openapi3-jakarta-spring-boot-starter</artifactId> |
||||
|
</dependency> |
||||
|
</dependencies> |
||||
|
|
||||
|
</project> |
||||
@ -0,0 +1,75 @@ |
|||||
|
package com.thing.common.core.annotation; |
||||
|
|
||||
|
import java.lang.annotation.ElementType; |
||||
|
import java.lang.annotation.Retention; |
||||
|
import java.lang.annotation.RetentionPolicy; |
||||
|
import java.lang.annotation.Target; |
||||
|
|
||||
|
/** |
||||
|
* Author: SiYang |
||||
|
* Date: 2023/09/26 10:19 |
||||
|
* Description: |
||||
|
* easyPoi并没有给出动态表头的注解方案, |
||||
|
* 想要使用动态表头,只能自己构建 ExcelExportEntity 这个对象,比较繁琐 |
||||
|
* 我们可以使用自定义注解的方式,使得构建该对象的过程自动化 |
||||
|
*/ |
||||
|
@Target(ElementType.FIELD) |
||||
|
@Retention(RetentionPolicy.RUNTIME) |
||||
|
public @interface CustomExcel { |
||||
|
|
||||
|
/** |
||||
|
* 表头唯一标识 |
||||
|
* 这里只是给出概念,通常使用 {@link #keyGenerator} 来定义 |
||||
|
*/ |
||||
|
String key() default ""; |
||||
|
|
||||
|
/** |
||||
|
* 指定列名,有些列名是固定的,不需要生成 |
||||
|
*/ |
||||
|
String name() default ""; |
||||
|
|
||||
|
/** |
||||
|
* 表头key生成器,不指定的话默认使用 {@link #columnNameGenerator} 的结果 |
||||
|
*/ |
||||
|
String keyGenerator() default ""; |
||||
|
|
||||
|
/** |
||||
|
* 指定生成策略,生成策略指的是数据类内部自定义的方法 |
||||
|
* 被CustomExcel注解的属性可以定义多种生成策略 |
||||
|
* 该方法用来指定生成策略 |
||||
|
*/ |
||||
|
String columnNameGenerator() default ""; |
||||
|
|
||||
|
/** |
||||
|
* 列的序号 |
||||
|
*/ |
||||
|
int orderNum() default 0; |
||||
|
|
||||
|
/** |
||||
|
* 列序号生成器,需要自定义生成方法,这里的值为方法名称 |
||||
|
* 注:顺序的体现只需要orderNum有大小关系,而不一定要连续 |
||||
|
*/ |
||||
|
String orderGenerator() default ""; |
||||
|
|
||||
|
/** |
||||
|
* 是否需要合并列 |
||||
|
* 该字段映射到easyPoi的ExcelExportEntity对象中似乎无效 |
||||
|
* easyPoi的合并功能还是一如既往地令人失望,所以合并还是得靠自己实现 |
||||
|
*/ |
||||
|
boolean needMerge() default false; |
||||
|
|
||||
|
/** |
||||
|
* 标题分组 |
||||
|
*/ |
||||
|
String groupName() default ""; |
||||
|
|
||||
|
/** |
||||
|
* 指定生成title的方法 |
||||
|
* 该方法如果返回的值相同,那么就表示这些列的标题需要合并 |
||||
|
*/ |
||||
|
String groupGenerator() default ""; |
||||
|
|
||||
|
int width() default 10; |
||||
|
|
||||
|
int height() default 10; |
||||
|
} |
||||
@ -0,0 +1,17 @@ |
|||||
|
package com.thing.common.core.annotation; |
||||
|
|
||||
|
import java.lang.annotation.ElementType; |
||||
|
import java.lang.annotation.Retention; |
||||
|
import java.lang.annotation.RetentionPolicy; |
||||
|
import java.lang.annotation.Target; |
||||
|
|
||||
|
/** |
||||
|
* Author: SiYang |
||||
|
* Date: 2023/09/26 14:49 |
||||
|
* Description: 处理内嵌list的注解 |
||||
|
*/ |
||||
|
@Target(ElementType.FIELD) |
||||
|
@Retention(RetentionPolicy.RUNTIME) |
||||
|
public @interface CustomExcelCollection { |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,21 @@ |
|||||
|
|
||||
|
|
||||
|
package com.thing.common.core.annotation; |
||||
|
|
||||
|
import java.lang.annotation.*; |
||||
|
|
||||
|
/** |
||||
|
* 操作日志注解 |
||||
|
* |
||||
|
* @author Mark sunlightcs@gmail.com |
||||
|
*/ |
||||
|
@Target(ElementType.METHOD) |
||||
|
@Retention(RetentionPolicy.RUNTIME) |
||||
|
@Documented |
||||
|
public @interface LogOperation { |
||||
|
|
||||
|
String value() default ""; |
||||
|
|
||||
|
String type() default ""; |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,41 @@ |
|||||
|
package com.thing.common.core.config; |
||||
|
|
||||
|
import org.springframework.beans.factory.BeanFactory; |
||||
|
import org.springframework.context.annotation.Bean; |
||||
|
import org.springframework.context.annotation.Configuration; |
||||
|
import org.springframework.context.event.SimpleApplicationEventMulticaster; |
||||
|
import org.springframework.core.task.TaskExecutor; |
||||
|
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; |
||||
|
|
||||
|
import java.util.concurrent.ThreadPoolExecutor; |
||||
|
|
||||
|
/** |
||||
|
* Author: SiYang |
||||
|
* Date: 2023/12/01 14:31 |
||||
|
* Description: 异步事件配置 |
||||
|
*/ |
||||
|
@Configuration |
||||
|
public class AsyncEventConfig { |
||||
|
|
||||
|
@Bean |
||||
|
public SimpleApplicationEventMulticaster applicationEventMulticaster(BeanFactory beanFactory) { |
||||
|
SimpleApplicationEventMulticaster applicationEventMulticaster = new SimpleApplicationEventMulticaster(beanFactory); |
||||
|
// 设置线程池, 不设置的话默认没有线程池,没有线程池就不会异步调度事件 |
||||
|
applicationEventMulticaster.setTaskExecutor(eventExecutor()); |
||||
|
return applicationEventMulticaster; |
||||
|
} |
||||
|
|
||||
|
@Bean |
||||
|
public TaskExecutor eventExecutor() { |
||||
|
ThreadPoolTaskExecutor threadPoolTaskExecutor = new ThreadPoolTaskExecutor(); |
||||
|
threadPoolTaskExecutor.setCorePoolSize(20); |
||||
|
threadPoolTaskExecutor.setMaxPoolSize(50); |
||||
|
threadPoolTaskExecutor.setQueueCapacity(30); |
||||
|
threadPoolTaskExecutor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy()); |
||||
|
threadPoolTaskExecutor.setThreadNamePrefix("eventExecutor-"); |
||||
|
threadPoolTaskExecutor.setWaitForTasksToCompleteOnShutdown(true); |
||||
|
threadPoolTaskExecutor.setAwaitTerminationSeconds(5); |
||||
|
threadPoolTaskExecutor.initialize(); |
||||
|
return threadPoolTaskExecutor; |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,20 @@ |
|||||
|
package com.thing.common.core.config; |
||||
|
|
||||
|
import org.springframework.context.annotation.Bean; |
||||
|
import org.springframework.context.annotation.Configuration; |
||||
|
import org.springframework.web.client.RestTemplate; |
||||
|
|
||||
|
/** |
||||
|
* @author zy |
||||
|
* @version 1.0 |
||||
|
* @date 2022/1/7 0007 14:43:22 |
||||
|
*/ |
||||
|
@Configuration |
||||
|
public class RestTemplateConfig { |
||||
|
|
||||
|
@Bean |
||||
|
RestTemplate restTemplate(){ |
||||
|
return new RestTemplate(); |
||||
|
} |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,429 @@ |
|||||
|
|
||||
|
|
||||
|
package com.thing.common.core.constants; |
||||
|
|
||||
|
import com.google.common.collect.ImmutableMap; |
||||
|
import com.thing.common.core.utils.DateTimeUtils; |
||||
|
|
||||
|
import java.util.HashMap; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
/** |
||||
|
* 常量 |
||||
|
* |
||||
|
* @author Mark sunlightcs@gmail.com |
||||
|
*/ |
||||
|
public interface Constant { |
||||
|
String API_BASE = "api_v1"; |
||||
|
/** |
||||
|
* 成功 |
||||
|
*/ |
||||
|
int SUCCESS = 1; |
||||
|
/** |
||||
|
* 失败 |
||||
|
*/ |
||||
|
int FAIL = 0; |
||||
|
/** |
||||
|
* OK |
||||
|
*/ |
||||
|
String OK = "OK"; |
||||
|
/** |
||||
|
* 用户标识 |
||||
|
*/ |
||||
|
String USER_KEY = "userId"; |
||||
|
|
||||
|
String AUTH = "auth"; |
||||
|
/** |
||||
|
* 数据集主键 |
||||
|
*/ |
||||
|
String DATASET_ID = "datasetId"; |
||||
|
|
||||
|
String API_ID = "apiId"; |
||||
|
/** |
||||
|
* 扩展计算主键 |
||||
|
*/ |
||||
|
String TRANSPORT_EXTEND_ID = "transportExtendId"; |
||||
|
/** |
||||
|
* 用户标识 |
||||
|
*/ |
||||
|
String DEVICE_KEY = "deviceId"; |
||||
|
/** |
||||
|
* 看板标识 |
||||
|
*/ |
||||
|
String DASHBOARD_KEY = "dashboardId"; |
||||
|
/** |
||||
|
* 菜单根节点标识 |
||||
|
*/ |
||||
|
Long MENU_ROOT = 0L; |
||||
|
/** |
||||
|
* 部门根节点标识 |
||||
|
*/ |
||||
|
Long DEPT_ROOT = 0L; |
||||
|
/** |
||||
|
* 数据字典根节点标识 |
||||
|
*/ |
||||
|
Long DICT_ROOT = 0L; |
||||
|
/** |
||||
|
* 部门根节点标识 |
||||
|
*/ |
||||
|
Integer DEPT_SORT_ROOT = 0; |
||||
|
/** |
||||
|
* 告警字典根节点标识 |
||||
|
*/ |
||||
|
Long ALARM_DICT_TOOT = 0L; |
||||
|
/** |
||||
|
* 升序 |
||||
|
*/ |
||||
|
String ASC = "asc"; |
||||
|
/** |
||||
|
* 降序 |
||||
|
*/ |
||||
|
String DESC = "desc"; |
||||
|
/** |
||||
|
* 创建时间字段名 |
||||
|
*/ |
||||
|
String CREATE_DATE = "create_date"; |
||||
|
|
||||
|
/** |
||||
|
* 创建时间字段名 |
||||
|
*/ |
||||
|
String ID = "id"; |
||||
|
|
||||
|
/** |
||||
|
* 数据权限过滤 |
||||
|
*/ |
||||
|
String SQL_FILTER = "sqlFilter"; |
||||
|
|
||||
|
/** |
||||
|
* 当前页码 |
||||
|
*/ |
||||
|
String PAGE = "page"; |
||||
|
/** |
||||
|
* 每页显示记录数 |
||||
|
*/ |
||||
|
String LIMIT = "limit"; |
||||
|
String BEGIN_TIME = "beginTime"; |
||||
|
String END_TIME = "endTime"; |
||||
|
/** |
||||
|
* 排序字段 |
||||
|
*/ |
||||
|
String ORDER_FIELD = "orderField"; |
||||
|
/** |
||||
|
* 排序方式 |
||||
|
*/ |
||||
|
String ORDER = "order"; |
||||
|
/** |
||||
|
* token header |
||||
|
*/ |
||||
|
String TOKEN_HEADER = "token"; |
||||
|
|
||||
|
/** |
||||
|
* 云存储配置KEY |
||||
|
*/ |
||||
|
String CLOUD_STORAGE_CONFIG_KEY = "CLOUD_STORAGE_CONFIG_KEY"; |
||||
|
/** |
||||
|
* 短信配置KEY |
||||
|
*/ |
||||
|
String SMS_CONFIG_KEY = "SMS_CONFIG_KEY"; |
||||
|
/** |
||||
|
* 邮件配置KEY |
||||
|
*/ |
||||
|
String MAIL_CONFIG_KEY = "MAIL_CONFIG_KEY"; |
||||
|
/** |
||||
|
* 微信配置KEY |
||||
|
*/ |
||||
|
String WECHAT_CONFIG_KEY = "WECHAT_CONFIG_KEY"; |
||||
|
/** |
||||
|
* 钉钉配置KEY |
||||
|
*/ |
||||
|
String DINGTALK_CONFIG_KEY = "DINGTALK_CONFIG_KEY"; |
||||
|
/** |
||||
|
* 企业微信配置KEY |
||||
|
*/ |
||||
|
String WECHAT_COM_CONFIG_KEY = "WECHAT_COM_CONFIG_KEY"; |
||||
|
/** |
||||
|
* 代码生成参数KEY |
||||
|
*/ |
||||
|
String DEV_TOOLS_PARAM_KEY = "DEV_TOOLS_PARAM_KEY"; |
||||
|
|
||||
|
/** |
||||
|
* 租户编码 |
||||
|
*/ |
||||
|
String TENANT_CODE = "tenantCode"; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 取SQL结果集的第一条 |
||||
|
*/ |
||||
|
String SQL_FIRST = "limit 1"; |
||||
|
|
||||
|
/** |
||||
|
* tb中默认的设备类型 |
||||
|
*/ |
||||
|
String DEFAULT_DEVICE_TYPE = "default"; |
||||
|
|
||||
|
/** |
||||
|
* 默认数据源 |
||||
|
*/ |
||||
|
String DEFAULT_SOURCE = "defaultSource"; |
||||
|
|
||||
|
/** |
||||
|
* 物编码 |
||||
|
*/ |
||||
|
String THING_CODE = "thingCode"; |
||||
|
|
||||
|
/** |
||||
|
* 物编码 |
||||
|
*/ |
||||
|
String ENTITY_ID = "entityId"; |
||||
|
|
||||
|
/** |
||||
|
* tb中additionalInfo字段的覆盖活动时间 |
||||
|
*/ |
||||
|
String TB_OVERWRITE_ACTIVITY_TIME = "overwriteActivityTime"; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* tb中additionalInfo字段的描述 |
||||
|
*/ |
||||
|
String TB_DESCRIPTION = "description"; |
||||
|
|
||||
|
/** |
||||
|
* tb中additionalInfo字段的描述 |
||||
|
*/ |
||||
|
String TB_GATEWAY = "gateway"; |
||||
|
|
||||
|
/** |
||||
|
* 公司id |
||||
|
*/ |
||||
|
String COMPANY_ID = "companyId"; |
||||
|
|
||||
|
String PROTOCOL_SEPARATOR = "://"; |
||||
|
|
||||
|
String COLON = ":"; |
||||
|
|
||||
|
/** |
||||
|
* 获取token |
||||
|
*/ |
||||
|
String API_GET_TOKEN = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential"; |
||||
|
/** |
||||
|
* 获取用户列表 |
||||
|
*/ |
||||
|
String API_GET_USERLIST = "https://api.weixin.qq.com/cgi-bin/user/get"; |
||||
|
/** |
||||
|
* 获取用户信息 |
||||
|
*/ |
||||
|
String API_GET_USERINFO = "https://api.weixin.qq.com/cgi-bin/user/info"; |
||||
|
/** |
||||
|
* 发送模板消息 |
||||
|
*/ |
||||
|
String API_SEND_MSG = "https://api.weixin.qq.com/cgi-bin/message/template/send"; |
||||
|
/** |
||||
|
* 获取分组用户 |
||||
|
*/ |
||||
|
String API_GET_GROUPLIST = "https://api.weixin.qq.com/cgi-bin/tags/get"; |
||||
|
/** |
||||
|
* 获取模板列表 |
||||
|
*/ |
||||
|
String API_GET_TEMPLATELIST = "https://api.weixin.qq.com/cgi-bin/template/get_all_private_template"; |
||||
|
|
||||
|
|
||||
|
String PUBLISHER_TYPE_SMS = "短信服务_platform:"; |
||||
|
String PUBLISHER_TYPE_WECHAT = "微信公众号服务"; |
||||
|
String PUBLISHER_TYPE_DINGTALK = "钉钉机器人服务"; |
||||
|
String PUBLISHER_TYPE_WECHATCOM = "企业微信机器人服务"; |
||||
|
String PUBLISHER_TYPE_ALARM = "告警触发推送服务"; |
||||
|
|
||||
|
/** |
||||
|
* 企业物的初始分配数量 |
||||
|
*/ |
||||
|
Long INITIAL_AUTH_NUM = 1L; |
||||
|
|
||||
|
/** |
||||
|
* 设备在线离线tb共享属性key |
||||
|
*/ |
||||
|
String THING_ONLINE_STATUS = "thing_online_status"; |
||||
|
|
||||
|
/** |
||||
|
* 计算结果时间 |
||||
|
*/ |
||||
|
String RESULT_TIME = "time"; |
||||
|
/** |
||||
|
* 计算结果值 |
||||
|
*/ |
||||
|
String RESULT_VALUE = "value"; |
||||
|
|
||||
|
/** |
||||
|
* 最新时间 |
||||
|
*/ |
||||
|
String LAST_TIME = "lastTime"; |
||||
|
/** |
||||
|
* 最新结果值 |
||||
|
*/ |
||||
|
String LAST_VALUE = "lastValue"; |
||||
|
|
||||
|
/** |
||||
|
* 公司的ID |
||||
|
*/ |
||||
|
String CONSUMER_PID = "consumerPid"; |
||||
|
//集中办公区 |
||||
|
String CENTRALIZED_OFFICE_AREA = "centralized_office_area"; |
||||
|
//独立办公区的党政机关 |
||||
|
String INDEPENDENT_OFFICE_AREA = "independent_office_area"; |
||||
|
//中小学公共机构 |
||||
|
String PRIMARY_SECONDARY_SCHOOLS = "primary_secondary_schools"; |
||||
|
//高等教育机构 |
||||
|
String HIGHER_EDUCATION = "higher_education"; |
||||
|
//医疗卫生机构 |
||||
|
String MEDICAL_HYGIENE = "medical_hygiene"; |
||||
|
//场馆类公共机构 |
||||
|
String VENUE_CATEGORY = "venue_category"; |
||||
|
|
||||
|
//三级医院 |
||||
|
String TERTIARY_HOSPITAL = "tertiary_hospital"; |
||||
|
//二级医院 |
||||
|
String SECONDARY_HOSPITAL = "secondary_Hospital"; |
||||
|
|
||||
|
//演出类-剧院、音乐厅等 |
||||
|
String PERFORMANCE_VENUES = "performance_venues"; |
||||
|
//非演出类-博物馆、纪念馆、文化馆、美术馆、科技馆等 |
||||
|
String NON_PERFORMANCE_VENUES_ONE = "non_performance_venues_one"; |
||||
|
//非演出类-图书馆、档案馆等 |
||||
|
String NON_PERFORMANCE_VENUES_TWO = "non_performance_venues_two"; |
||||
|
//承办赛事类-体育场等 |
||||
|
String UNDERTAKING_EVENTS = "undertaking_events"; |
||||
|
//非承办赛事类-体育中心、训练中心等 |
||||
|
String NON_UNDERTAKING_EVENTS = "non_undertaking_events"; |
||||
|
|
||||
|
//>90000 |
||||
|
String BUILD_A = "build_a"; |
||||
|
//45001~90000 |
||||
|
String BUILD_B = "build_b"; |
||||
|
//≤45000 |
||||
|
String BUILD_C = "build_c"; |
||||
|
//>25000 |
||||
|
String BUILD_D = "build_d"; |
||||
|
//11001~25000 |
||||
|
String BUILD_E = "build_e"; |
||||
|
//≤11000 |
||||
|
String BUILD_F = "build_f"; |
||||
|
//≥5000 |
||||
|
String BUILD_G = "build_g"; |
||||
|
//<5000 |
||||
|
String BUILD_H = "build_h"; |
||||
|
//---------/ |
||||
|
String BUILD_I = "build_i"; |
||||
|
//>6300 |
||||
|
String NUMBER_A = "number_a"; |
||||
|
//3000~6300 |
||||
|
String NUMBER_B = "number_b"; |
||||
|
//≤3000 |
||||
|
String NUMBER_C = "number_c"; |
||||
|
//>1700 |
||||
|
String NUMBER_D = "number_d"; |
||||
|
//600~1700 |
||||
|
String NUMBER_E = "number_e"; |
||||
|
//≤600 |
||||
|
String NUMBER_F = "number_f"; |
||||
|
//----/ |
||||
|
String NUMBER_G = "number_g"; |
||||
|
|
||||
|
//单位建筑面积能耗 |
||||
|
String ENERGY_PERBULID ="energy_perbulid"; |
||||
|
//人均建筑能耗 |
||||
|
String ENERGY_PERPERSON = "energy_perperson"; |
||||
|
//食堂人均能耗 |
||||
|
String ENERGY_PERCAFETERIA_PERSON ="energy_percafeteria_person"; |
||||
|
//数据中心电能使用率 |
||||
|
String ENERGY_UTILIZATION_EFFICIENCY = "energy_utilization_efficiency"; |
||||
|
|
||||
|
String ATTR_GROUP = "ATTR_GROUP"; |
||||
|
|
||||
|
Integer INDEX_0=0; |
||||
|
|
||||
|
Integer INDEX_1=1; |
||||
|
|
||||
|
Integer INDEX_2=2; |
||||
|
|
||||
|
Integer INDEX_3=3; |
||||
|
|
||||
|
|
||||
|
Integer COUNT_0=0; |
||||
|
Integer COUNT_1=1; |
||||
|
Integer COUNT_2=2; |
||||
|
|
||||
|
Integer LIST_LENGTH=2; |
||||
|
|
||||
|
Long DEFAULT_TAG_GROUP = 1567752318059458562L; |
||||
|
|
||||
|
Map<String, Long> EMUNTIMEMAP = ImmutableMap.<String, Long>builder() |
||||
|
.put("1", (long) (30*60*1000)) |
||||
|
.put("2", (long)(60*60*1000)) |
||||
|
.put("3", (long)(5*60*60*1000)) |
||||
|
.put("4", (long)(12*60*60*1000)) |
||||
|
.put("5", (long)(24*60*60*1000)) |
||||
|
.put("6", DateTimeUtils.firstDayOfWeekMilli()) |
||||
|
.put("7", (long)(7*24*60*60*1000)) |
||||
|
.put("8", (30L*24*60*60*1000)) |
||||
|
.put("9", (3*30L*24*60*60*1000)) |
||||
|
.put("10",(6*30L*24*60*60*1000)) |
||||
|
.put("11",(365L*24*60*60*1000)) |
||||
|
.build(); |
||||
|
|
||||
|
|
||||
|
|
||||
|
Map<String, String> EMUNSTRTIMEMAP = ImmutableMap.<String, String>builder() |
||||
|
.put("0","0,0,30") |
||||
|
.put("1","0,1,0") |
||||
|
.put("2","0,5,0") |
||||
|
.put("3","0,12,0") |
||||
|
.put("4","0,24,0") |
||||
|
.put("5","7,0,0") |
||||
|
.put("6","30,0,0") |
||||
|
.put("7","90,0,0") |
||||
|
.build(); |
||||
|
|
||||
|
Map<String, String> EMUNSTRINGTIMEMAP = ImmutableMap.<String, String>builder() |
||||
|
.put("30分钟","{\"day\":\"0\",\"hour\":\"0\",\"minute\":\"30\"}") |
||||
|
.put("1小时","{\"day\":\"0\",\"hour\":\"1\",\"minute\":\"0\"}") |
||||
|
.put("5小时","{\"day\":\"0\",\"hour\":\"5\",\"minute\":\"0\"}") |
||||
|
.put("12小时","{\"day\":\"0\",\"hour\":\"12\",\"minute\":\"0\"}") |
||||
|
.put("1天","{\"day\":\"1\",\"hour\":\"0\",\"minute\":\"0\"}") |
||||
|
.put("7天","{\"day\":\"7\",\"hour\":\"0\",\"minute\":\"0\"}") |
||||
|
.put("30天","{\"day\":\"30\",\"hour\":\"0\",\"minute\":\"0\"}") |
||||
|
.put("3月","{\"day\":\"90\",\"hour\":\"0\",\"minute\":\"0\"}") |
||||
|
.put("6月","{\"day\":\"180\",\"hour\":\"0\",\"minute\":\"0\"}") |
||||
|
.put("1年","{\"day\":\"365\",\"hour\":\"0\",\"minute\":\"0\"}") |
||||
|
.build(); |
||||
|
|
||||
|
|
||||
|
Map<String, String> STATUS_MAP = ImmutableMap.<String, String>builder() |
||||
|
.put("0","离网") |
||||
|
.put("1","空闲") |
||||
|
.put("3","占用(充电中)") |
||||
|
.put("2", "占用(未充电)") |
||||
|
.put("4", "占用(预约锁定)") |
||||
|
.put("255", "故障").build(); |
||||
|
|
||||
|
|
||||
|
Map<Integer, String> CARTYPES = ImmutableMap.<Integer, String>builder() |
||||
|
.put(1, "公共") |
||||
|
.put(50, "个人") |
||||
|
.put(100, "公交") |
||||
|
.put(101, "环卫") |
||||
|
.put(102, "物流") |
||||
|
.put(103, "出租车") |
||||
|
.put(255, "其他").build(); |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
Long ONE_FIVE_MINUTE = 300000L; |
||||
|
Long ONE_HOUR = 3600000L; |
||||
|
Long ONE_DAY = 86400000L; |
||||
|
Long FIVE_DAY = 2592000000L; |
||||
|
Long THREE_DAY = 2592000000L; |
||||
|
Long ONE_YEAR = 2592000000L; |
||||
|
|
||||
|
|
||||
|
} |
||||
@ -0,0 +1,39 @@ |
|||||
|
package com.thing.common.core.container; |
||||
|
|
||||
|
import cn.hutool.core.util.ObjectUtil; |
||||
|
|
||||
|
import java.util.concurrent.ConcurrentHashMap; |
||||
|
|
||||
|
public class GlobalContainer { |
||||
|
|
||||
|
private ConcurrentHashMap<String, Object> container = new ConcurrentHashMap<>(); |
||||
|
|
||||
|
private static GlobalContainer instance; |
||||
|
|
||||
|
private GlobalContainer(){} |
||||
|
|
||||
|
public static synchronized GlobalContainer getInstance() { |
||||
|
|
||||
|
if(ObjectUtil.isNull(instance)) { |
||||
|
instance = new GlobalContainer(); |
||||
|
} |
||||
|
return instance; |
||||
|
|
||||
|
} |
||||
|
|
||||
|
|
||||
|
public void put(String key, Object object){ |
||||
|
container.put(key, object); |
||||
|
} |
||||
|
|
||||
|
public Object get(String key){ |
||||
|
return container.get(key); |
||||
|
} |
||||
|
|
||||
|
public Object remove(String key){ return container.remove(key); } |
||||
|
|
||||
|
@Override |
||||
|
public String toString() { |
||||
|
return super.toString(); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,73 @@ |
|||||
|
|
||||
|
|
||||
|
package com.thing.common.core.convert; |
||||
|
|
||||
|
import org.slf4j.Logger; |
||||
|
import org.slf4j.LoggerFactory; |
||||
|
import org.springframework.core.convert.converter.Converter; |
||||
|
import org.springframework.stereotype.Component; |
||||
|
import org.springframework.util.StringUtils; |
||||
|
|
||||
|
import java.text.DateFormat; |
||||
|
import java.text.SimpleDateFormat; |
||||
|
import java.util.ArrayList; |
||||
|
import java.util.Date; |
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* 日期转换 |
||||
|
* |
||||
|
* @author Mark sunlightcs@gmail.com |
||||
|
*/ |
||||
|
@Component |
||||
|
public class DateConverter implements Converter<String, Date> { |
||||
|
private static final Logger logger = LoggerFactory.getLogger(DateConverter.class); |
||||
|
private static List<String> formatList = new ArrayList<>(5); |
||||
|
static { |
||||
|
formatList.add("yyyy-MM"); |
||||
|
formatList.add("yyyy-MM-dd"); |
||||
|
formatList.add("yyyy-MM-dd hh:mm"); |
||||
|
formatList.add("yyyy-MM-dd hh:mm:ss"); |
||||
|
formatList.add("yyyy-MM-dd'T'HH:mm:ss.SSSZ"); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public Date convert(String source) { |
||||
|
String value = source.trim(); |
||||
|
if (StringUtils.isEmpty(value)) { |
||||
|
return null; |
||||
|
} |
||||
|
|
||||
|
if(source.matches("^\\d{4}-\\d{1,2}$")){ |
||||
|
return parseDate(source, formatList.get(0)); |
||||
|
}else if(source.matches("^\\d{4}-\\d{1,2}-\\d{1,2}$")){ |
||||
|
return parseDate(source, formatList.get(1)); |
||||
|
}else if(source.matches("^\\d{4}-\\d{1,2}-\\d{1,2} {1}\\d{1,2}:\\d{1,2}$")){ |
||||
|
return parseDate(source, formatList.get(2)); |
||||
|
}else if(source.matches("^\\d{4}-\\d{1,2}-\\d{1,2} {1}\\d{1,2}:\\d{1,2}:\\d{1,2}$")){ |
||||
|
return parseDate(source, formatList.get(3)); |
||||
|
}else if(source.matches("^\\d{4}-\\d{1,2}-\\d{1,2}.*T.*\\d{1,2}:\\d{1,2}:\\d{1,2}.*..*$")){ |
||||
|
return parseDate(source, formatList.get(4)); |
||||
|
} else { |
||||
|
throw new IllegalArgumentException("Invalid boolean value '" + source + "'"); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 格式化日期 |
||||
|
* @param dateStr String 字符型日期 |
||||
|
* @param format String 格式 |
||||
|
* @return Date 日期 |
||||
|
*/ |
||||
|
public Date parseDate(String dateStr, String format) { |
||||
|
Date date = null; |
||||
|
try { |
||||
|
DateFormat dateFormat = new SimpleDateFormat(format); |
||||
|
date = dateFormat.parse(dateStr); |
||||
|
} catch (Exception e) { |
||||
|
logger.error("Formatted date with date: {} and format : {} ", dateStr, format); |
||||
|
} |
||||
|
return date; |
||||
|
} |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,30 @@ |
|||||
|
package com.thing.common.core.enumeration; |
||||
|
|
||||
|
import lombok.AllArgsConstructor; |
||||
|
import lombok.Getter; |
||||
|
|
||||
|
/** |
||||
|
* 动作类型 |
||||
|
*/ |
||||
|
@Getter |
||||
|
@AllArgsConstructor |
||||
|
public enum ActionType { |
||||
|
/** |
||||
|
* 消息 |
||||
|
*/ |
||||
|
MSG("0"), |
||||
|
/** |
||||
|
* 控制 |
||||
|
*/ |
||||
|
CONTROL("1"), |
||||
|
/** |
||||
|
* 日志新增 |
||||
|
*/ |
||||
|
LOG_SAVE("99"), |
||||
|
/** |
||||
|
* 日志修改 |
||||
|
*/ |
||||
|
LOG_UPDATE("100"); |
||||
|
|
||||
|
private final String value; |
||||
|
} |
||||
@ -0,0 +1,36 @@ |
|||||
|
package com.thing.common.core.enumeration; |
||||
|
|
||||
|
import org.apache.commons.lang3.StringUtils; |
||||
|
|
||||
|
import java.util.Arrays; |
||||
|
|
||||
|
public enum AggType { |
||||
|
AVG, SUM, MAX, MIN, COUNT; |
||||
|
|
||||
|
/** |
||||
|
* 得到方法名称 |
||||
|
* @param prefix 前缀 |
||||
|
* @param suffix 后缀 |
||||
|
* @return 方法名称 |
||||
|
*/ |
||||
|
public static String getMethodName(String prefix,String suffix ,AggType agg) { |
||||
|
if(Arrays.stream(AggType.values()).noneMatch(s -> StringUtils.equals(s.name(), agg.name()))){ |
||||
|
throw new IllegalArgumentException("Unsupported agg type: " + agg); |
||||
|
} |
||||
|
return prefix+agg+suffix; |
||||
|
} |
||||
|
|
||||
|
public static AggType match(String func){ |
||||
|
if(StringUtils.isBlank(func)){ |
||||
|
return AggType.MAX; |
||||
|
} |
||||
|
for (AggType value : AggType.values()) { |
||||
|
if(StringUtils.endsWithIgnoreCase(value.name(),func)){ |
||||
|
return value; |
||||
|
} |
||||
|
} |
||||
|
return AggType.MAX; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
} |
||||
@ -0,0 +1,26 @@ |
|||||
|
package com.thing.common.core.enumeration; |
||||
|
|
||||
|
import lombok.AllArgsConstructor; |
||||
|
import lombok.Getter; |
||||
|
|
||||
|
/** |
||||
|
* 告警选择 |
||||
|
*/ |
||||
|
@Getter |
||||
|
@AllArgsConstructor |
||||
|
public enum AlarmSettingType { |
||||
|
/** |
||||
|
* 严重程度 |
||||
|
*/ |
||||
|
LEVEL("alarm_level"), |
||||
|
/** |
||||
|
* 告警类型 |
||||
|
*/ |
||||
|
TYPE("alarm_type"), |
||||
|
/** |
||||
|
* 告警名称 |
||||
|
*/ |
||||
|
NAME("alarm_name"); |
||||
|
|
||||
|
private final String status; |
||||
|
} |
||||
@ -0,0 +1,26 @@ |
|||||
|
package com.thing.common.core.enumeration; |
||||
|
|
||||
|
import lombok.AllArgsConstructor; |
||||
|
import lombok.Getter; |
||||
|
|
||||
|
/** |
||||
|
* 告警状态 |
||||
|
*/ |
||||
|
@Getter |
||||
|
@AllArgsConstructor |
||||
|
public enum AlarmStatus { |
||||
|
/** |
||||
|
* 待处理 |
||||
|
*/ |
||||
|
PENDING("0"), |
||||
|
/** |
||||
|
* 处理中 |
||||
|
*/ |
||||
|
PROCESSING("1"), |
||||
|
/** |
||||
|
* 已处理 |
||||
|
*/ |
||||
|
PROCESSED("2"); |
||||
|
|
||||
|
private final String status; |
||||
|
} |
||||
@ -0,0 +1,35 @@ |
|||||
|
package com.thing.common.core.enumeration; |
||||
|
|
||||
|
import com.thing.common.core.exception.SysException; |
||||
|
|
||||
|
import java.util.Arrays; |
||||
|
import java.util.Objects; |
||||
|
|
||||
|
public enum AlarmType { |
||||
|
/** |
||||
|
* 峰平谷 |
||||
|
*/ |
||||
|
PEAK("1"), |
||||
|
/** |
||||
|
* 夜间 |
||||
|
*/ |
||||
|
NIGHT("2"); |
||||
|
|
||||
|
private String value; |
||||
|
|
||||
|
AlarmType(String value) { |
||||
|
this.value = value; |
||||
|
} |
||||
|
|
||||
|
public String getValue() { |
||||
|
return value; |
||||
|
} |
||||
|
|
||||
|
public static AlarmType match(String val) { |
||||
|
return Arrays.stream(AlarmType.values()) |
||||
|
.filter(item -> Objects.equals(item.getValue(), val)) |
||||
|
.findFirst() |
||||
|
.orElseThrow(() -> new SysException("type类型不正确:" + val)); |
||||
|
} |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,61 @@ |
|||||
|
package com.thing.common.core.enumeration; |
||||
|
|
||||
|
import lombok.AllArgsConstructor; |
||||
|
import lombok.Getter; |
||||
|
import org.apache.commons.lang3.StringUtils; |
||||
|
|
||||
|
import java.util.Arrays; |
||||
|
|
||||
|
/** |
||||
|
* API查询类型 |
||||
|
*/ |
||||
|
@Getter |
||||
|
@AllArgsConstructor |
||||
|
public enum ApiFuncEnum { |
||||
|
/** |
||||
|
* 求和 |
||||
|
*/ |
||||
|
SUM("sum", "求和"), |
||||
|
/** |
||||
|
* 平均 |
||||
|
*/ |
||||
|
AVG("avg", "平均数"), |
||||
|
/** |
||||
|
* 最大值 |
||||
|
*/ |
||||
|
MAX("max", "最大值"), |
||||
|
/** |
||||
|
* 最小值 |
||||
|
*/ |
||||
|
MIN("min", "最小值"), |
||||
|
|
||||
|
/** |
||||
|
* 统计 |
||||
|
*/ |
||||
|
COUNT("count", "统计"), |
||||
|
/** |
||||
|
* 空 |
||||
|
*/ |
||||
|
BLANK("blank", "空"); |
||||
|
|
||||
|
private final String value; |
||||
|
|
||||
|
private final String name; |
||||
|
|
||||
|
|
||||
|
public static String getName(String value) { |
||||
|
if (StringUtils.isBlank(value)) { |
||||
|
return value; |
||||
|
} |
||||
|
for (ApiFuncEnum apiFuncEnum : ApiFuncEnum.values()) { |
||||
|
if (StringUtils.equalsAnyIgnoreCase(apiFuncEnum.getValue(), value)) { |
||||
|
return apiFuncEnum.getName(); |
||||
|
} |
||||
|
} |
||||
|
return value; |
||||
|
} |
||||
|
|
||||
|
public static boolean noneMatch(String type) { |
||||
|
return Arrays.stream(ApiFuncEnum.values()).noneMatch(s -> StringUtils.equals(s.getValue(), type)); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,26 @@ |
|||||
|
package com.thing.common.core.enumeration; |
||||
|
|
||||
|
import lombok.AllArgsConstructor; |
||||
|
import lombok.Getter; |
||||
|
|
||||
|
/** |
||||
|
* 数据集设备分属性 |
||||
|
*/ |
||||
|
@Getter |
||||
|
@AllArgsConstructor |
||||
|
public enum ApiSeparateAttr { |
||||
|
/** |
||||
|
* 无属性 |
||||
|
*/ |
||||
|
NONE("none") , |
||||
|
/** |
||||
|
* 分属性 |
||||
|
*/ |
||||
|
SEPARATE("split"), |
||||
|
/** |
||||
|
* 不分属性 |
||||
|
*/ |
||||
|
NO_SEPARATE("all"); |
||||
|
|
||||
|
private final String value; |
||||
|
} |
||||
@ -0,0 +1,46 @@ |
|||||
|
package com.thing.common.core.enumeration; |
||||
|
|
||||
|
import lombok.AllArgsConstructor; |
||||
|
import lombok.Getter; |
||||
|
import org.apache.commons.lang3.StringUtils; |
||||
|
|
||||
|
import java.util.Arrays; |
||||
|
|
||||
|
/** |
||||
|
* API类型 |
||||
|
*/ |
||||
|
@Getter |
||||
|
@AllArgsConstructor |
||||
|
public enum ApiType { |
||||
|
/** |
||||
|
* 列表 |
||||
|
*/ |
||||
|
LIST("list"), |
||||
|
/** |
||||
|
* 分 |
||||
|
*/ |
||||
|
TYPE("type"), |
||||
|
/** |
||||
|
* 秒 |
||||
|
*/ |
||||
|
TAG("tag"), |
||||
|
/** |
||||
|
* 搜索 |
||||
|
*/ |
||||
|
SEARCH("search"), |
||||
|
/** |
||||
|
* 关系 |
||||
|
*/ |
||||
|
RELATION("relation"), |
||||
|
/** |
||||
|
* 组 |
||||
|
*/ |
||||
|
GROUP("group"); |
||||
|
|
||||
|
private final String value; |
||||
|
|
||||
|
public static boolean matchName(String name) { |
||||
|
return Arrays.stream(ApiType.values()) |
||||
|
.anyMatch(type -> StringUtils.equals(type.getValue(), StringUtils.trim(name))); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,61 @@ |
|||||
|
package com.thing.common.core.enumeration; |
||||
|
|
||||
|
import lombok.AllArgsConstructor; |
||||
|
import lombok.Getter; |
||||
|
import org.apache.commons.lang3.StringUtils; |
||||
|
|
||||
|
import java.util.Arrays; |
||||
|
|
||||
|
/** |
||||
|
* API查询类型 |
||||
|
*/ |
||||
|
@Getter |
||||
|
@AllArgsConstructor |
||||
|
public enum ApiTypeEnum { |
||||
|
/** |
||||
|
* 列表 |
||||
|
*/ |
||||
|
LIST("list", "列表"), |
||||
|
/** |
||||
|
* 类型 |
||||
|
*/ |
||||
|
TYPE("type", "类型"), |
||||
|
/** |
||||
|
* 标签 |
||||
|
*/ |
||||
|
TAG("tag", "标签"), |
||||
|
/** |
||||
|
* 搜索 |
||||
|
*/ |
||||
|
SEARCH("search", "搜索"), |
||||
|
|
||||
|
/** |
||||
|
* 关系 |
||||
|
*/ |
||||
|
RELATION("relation", "关系"), |
||||
|
|
||||
|
/** |
||||
|
* 组 |
||||
|
*/ |
||||
|
GROUP("group", "物组"); |
||||
|
|
||||
|
private final String value; |
||||
|
|
||||
|
private final String name; |
||||
|
|
||||
|
public static String getName(String value) { |
||||
|
if (StringUtils.isBlank(value)) { |
||||
|
return value; |
||||
|
} |
||||
|
for (ApiTypeEnum groupTypeEnum : ApiTypeEnum.values()) { |
||||
|
if (StringUtils.equalsAnyIgnoreCase(groupTypeEnum.getValue(), value)) { |
||||
|
return groupTypeEnum.getName(); |
||||
|
} |
||||
|
} |
||||
|
return value; |
||||
|
} |
||||
|
|
||||
|
public static boolean noneMatch(String type) { |
||||
|
return Arrays.stream(ApiTypeEnum.values()).noneMatch(s -> StringUtils.equals(s.getValue(), type)); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,22 @@ |
|||||
|
package com.thing.common.core.enumeration; |
||||
|
|
||||
|
import lombok.AllArgsConstructor; |
||||
|
import lombok.Getter; |
||||
|
|
||||
|
/** |
||||
|
* 数据集是否开启 |
||||
|
*/ |
||||
|
@Getter |
||||
|
@AllArgsConstructor |
||||
|
public enum ApiTypes { |
||||
|
/** |
||||
|
* 组态设计 |
||||
|
*/ |
||||
|
CONFIG("0"), |
||||
|
/** |
||||
|
* 超级API |
||||
|
*/ |
||||
|
API("1"); |
||||
|
|
||||
|
private final String type; |
||||
|
} |
||||
@ -0,0 +1,99 @@ |
|||||
|
package com.thing.common.core.enumeration; |
||||
|
|
||||
|
import java.util.Arrays; |
||||
|
import java.util.List; |
||||
|
import java.util.stream.Collectors; |
||||
|
|
||||
|
/** |
||||
|
* 首页物属性 |
||||
|
*/ |
||||
|
public enum AttributeEnum { |
||||
|
/** |
||||
|
* 气电比 |
||||
|
*/ |
||||
|
AC100, |
||||
|
/** |
||||
|
* 单位m³气体价格 |
||||
|
*/ |
||||
|
AC101, |
||||
|
/** |
||||
|
* 压力 |
||||
|
*/ |
||||
|
D6, |
||||
|
/** |
||||
|
* 露点温度 |
||||
|
*/ |
||||
|
D5, |
||||
|
/** |
||||
|
* 瞬时流量 |
||||
|
*/ |
||||
|
D1, |
||||
|
/** |
||||
|
* 累计流量、用气量 |
||||
|
*/ |
||||
|
D2, |
||||
|
/** |
||||
|
* 瞬时功率 |
||||
|
*/ |
||||
|
A16, |
||||
|
/** |
||||
|
* 日均流量 |
||||
|
*/ |
||||
|
AC106, |
||||
|
/** |
||||
|
* 日均功率 |
||||
|
*/ |
||||
|
AC108, |
||||
|
/** |
||||
|
* 累计电量、用电量 |
||||
|
*/ |
||||
|
A29, |
||||
|
/** |
||||
|
* 碳排量 |
||||
|
*/ |
||||
|
CO2, |
||||
|
/** |
||||
|
* C相电压 |
||||
|
*/ |
||||
|
A3, |
||||
|
/** |
||||
|
* A相电压 |
||||
|
*/ |
||||
|
A1, |
||||
|
/** |
||||
|
* B相电压 |
||||
|
*/ |
||||
|
A2, |
||||
|
/** |
||||
|
* C相电流 |
||||
|
*/ |
||||
|
A9, |
||||
|
/** |
||||
|
* A相电流 |
||||
|
*/ |
||||
|
A8, |
||||
|
/** |
||||
|
* B相电流 |
||||
|
*/ |
||||
|
A10, |
||||
|
/** |
||||
|
* 频率 |
||||
|
*/ |
||||
|
A25, |
||||
|
/** |
||||
|
* 密度 |
||||
|
*/ |
||||
|
AC120, |
||||
|
/** |
||||
|
* 手工录入温度 |
||||
|
*/ |
||||
|
AC121, |
||||
|
/** |
||||
|
* 手工录入节约用电量 |
||||
|
*/ |
||||
|
AC122; |
||||
|
|
||||
|
public static List<String> getAllEnums() { |
||||
|
return Arrays.stream(AttributeEnum.values()).map(AttributeEnum::name).collect(Collectors.toList()); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,225 @@ |
|||||
|
package com.thing.common.core.enumeration; |
||||
|
|
||||
|
import com.thing.common.core.utils.DateTimeUtils; |
||||
|
import org.apache.commons.lang3.StringUtils; |
||||
|
|
||||
|
import java.time.LocalDateTime; |
||||
|
import java.time.LocalTime; |
||||
|
import java.time.format.DateTimeFormatter; |
||||
|
import java.time.temporal.ChronoUnit; |
||||
|
import java.time.temporal.TemporalAdjusters; |
||||
|
import java.util.*; |
||||
|
import java.util.stream.Collectors; |
||||
|
import java.util.stream.Stream; |
||||
|
|
||||
|
public enum AttributeTypeEnum { |
||||
|
/** 刻 */ |
||||
|
am, |
||||
|
/** 小时 */ |
||||
|
hh, |
||||
|
/** 天 */ |
||||
|
dd, |
||||
|
/** 月 */ |
||||
|
mm, |
||||
|
/** 周 */ |
||||
|
week, |
||||
|
/** 年 */ |
||||
|
yy; |
||||
|
|
||||
|
public static AttributeTypeEnum match(String attributeType) { |
||||
|
return Arrays.stream(AttributeTypeEnum.values()) |
||||
|
.filter(item -> Objects.equals(item.name(), attributeType)) |
||||
|
.findFirst() |
||||
|
.orElse(null); |
||||
|
} |
||||
|
|
||||
|
public static String matchEndAdapter(String attribute,String attributeType) { |
||||
|
Optional<AttributeTypeEnum> optional = Arrays.stream(AttributeTypeEnum.values()) |
||||
|
.filter(item -> StringUtils.endsWithIgnoreCase(attribute, item.name())) |
||||
|
.findFirst(); |
||||
|
if(optional.isEmpty() || StringUtils.isBlank(attributeType)){ |
||||
|
return attribute; |
||||
|
} |
||||
|
return attribute.replaceAll(optional.get().name(), "")+attributeType; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 获取给定时间所在的被指定范围类型的时间区间 |
||||
|
* |
||||
|
* @param time 给定的时间 |
||||
|
* @return |
||||
|
* 举例1: |
||||
|
* 给定时间2023-09-11 12:00:00 以及时间范围类型 mm, |
||||
|
* 返回 2023-01-01 00:00:00 ~ 2023-12-01 00:00:00这段时间 |
||||
|
* 举例2: |
||||
|
* 给定时间2023-09-11 12:00:00 以及时间范围类型 dd, |
||||
|
* 返回 2023-09-01 00:00:00 ~ 2023-09-30 00:00:00这段时间 |
||||
|
*/ |
||||
|
public List<LocalDateTime> getTimeRange(LocalDateTime time) { |
||||
|
time = time.withHour(0).withMinute(0).withSecond(0).withNano(0); |
||||
|
switch (this) { |
||||
|
case am: |
||||
|
LocalDateTime beginTimeOfMin = LocalDateTime.of(time.toLocalDate(), LocalTime.MIN); |
||||
|
LocalDateTime endTimeOfMin = LocalDateTime.of(time.toLocalDate(), LocalTime.MAX); |
||||
|
return Stream.iterate(beginTimeOfMin, d -> d.plusMinutes(15)) |
||||
|
.limit((ChronoUnit.MINUTES.between(beginTimeOfMin, endTimeOfMin) + 1) / 15) |
||||
|
.collect(Collectors.toList()); |
||||
|
case hh: |
||||
|
LocalDateTime beginTimeOfHour = LocalDateTime.of(time.toLocalDate(), LocalTime.MIN); |
||||
|
LocalDateTime endTimeOfHour = LocalDateTime.of(time.toLocalDate(), LocalTime.MAX); |
||||
|
return Stream.iterate(beginTimeOfHour, d -> d.plusHours(1)) |
||||
|
.limit(ChronoUnit.HOURS.between(beginTimeOfHour, endTimeOfHour) + 1) |
||||
|
.collect(Collectors.toList()); |
||||
|
case dd: |
||||
|
LocalDateTime beginTimeOfMouth = time.with(TemporalAdjusters.firstDayOfMonth()); |
||||
|
LocalDateTime endTimeOfMouth = time.with(TemporalAdjusters.lastDayOfMonth()); |
||||
|
return Stream.iterate(beginTimeOfMouth, d -> d.plusDays(1)) |
||||
|
.limit(ChronoUnit.DAYS.between(beginTimeOfMouth, endTimeOfMouth) + 1) |
||||
|
.collect(Collectors.toList()); |
||||
|
case mm: |
||||
|
LocalDateTime beginTimeOfYear = time.with(TemporalAdjusters.firstDayOfYear()); |
||||
|
LocalDateTime endTimeOfYear = time.with(TemporalAdjusters.lastDayOfYear()); |
||||
|
return Stream.iterate(beginTimeOfYear, d -> d.plusMonths(1)) |
||||
|
.limit(ChronoUnit.MONTHS.between(beginTimeOfYear, endTimeOfYear) + 1) |
||||
|
.collect(Collectors.toList()); |
||||
|
case yy: |
||||
|
return Collections.singletonList(time.with(TemporalAdjusters.firstDayOfYear())); |
||||
|
default: |
||||
|
return Collections.emptyList(); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 获取给定时间所在的被指定范围类型的时间区间 |
||||
|
* |
||||
|
*/ |
||||
|
public static List<LocalDateTime> getTimeRange(LocalDateTime startTime,LocalDateTime endTime) { |
||||
|
startTime = startTime.withHour(0).withMinute(0).withSecond(0).withNano(0); |
||||
|
endTime = endTime.withHour(0).withMinute(0).withSecond(0).withNano(0); |
||||
|
return Stream.iterate(startTime, d -> d.plusDays(1)) |
||||
|
.limit(ChronoUnit.DAYS.between(startTime, endTime) + 1) |
||||
|
.collect(Collectors.toList()); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 获取上一个阶段的时间范围: |
||||
|
* 1. 若当前时间类型是am或者hh,则上一个阶段的时间就是昨天的am或hh |
||||
|
* 2. 若当前时间类型是dd,则上一个阶段的时间就是上个月的dd |
||||
|
* 3. 若当前时间类型是mm, 则上一个阶段的时间就是去年的mm |
||||
|
* |
||||
|
* @param time 当前时间 |
||||
|
* @return 上一个阶段的时间范围 |
||||
|
*/ |
||||
|
public List<LocalDateTime> getPreviousTimeRange(LocalDateTime time) { |
||||
|
switch (this) { |
||||
|
case am: |
||||
|
case hh: |
||||
|
return getTimeRange(time.minusDays(1)); |
||||
|
case dd: |
||||
|
return getTimeRange(time.minusMonths(1)); |
||||
|
case mm: |
||||
|
return getTimeRange(time.minusYears(1)); |
||||
|
default: |
||||
|
return Collections.emptyList(); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
public List<String> getTimeRangeWithPattern(LocalDateTime time, DateTimeFormatter pattern) { |
||||
|
return getTimeRange(time).stream().map(t -> t.format(pattern)).collect(Collectors.toList()); |
||||
|
} |
||||
|
|
||||
|
public List<String> getTimeRangeWithPattern(LocalDateTime time) { |
||||
|
return getTimeRangeWithPattern(time, DateTimeUtils.DATE_TIME_PATTERN); |
||||
|
} |
||||
|
|
||||
|
public List<Long> getTimestampList(LocalDateTime time) { |
||||
|
List<LocalDateTime> timeRange = getTimeRange(time); |
||||
|
return timeRange.stream().map(DateTimeUtils::parse).collect(Collectors.toList()); |
||||
|
} |
||||
|
|
||||
|
public List<Long> getPreviousTimestampList(LocalDateTime time) { |
||||
|
List<LocalDateTime> timeRange = getPreviousTimeRange(time); |
||||
|
return timeRange.stream().map(DateTimeUtils::parse).collect(Collectors.toList()); |
||||
|
} |
||||
|
|
||||
|
@SuppressWarnings("Duplicates") |
||||
|
public AttributeTypeEnum next() { |
||||
|
return switch (this) { |
||||
|
case am -> hh; |
||||
|
case hh -> dd; |
||||
|
case dd -> mm; |
||||
|
case mm -> yy; |
||||
|
default -> null; |
||||
|
}; |
||||
|
} |
||||
|
|
||||
|
@SuppressWarnings("Duplicates") |
||||
|
public AttributeTypeEnum previous() { |
||||
|
return switch (this) { |
||||
|
case yy -> mm; |
||||
|
case mm -> dd; |
||||
|
case dd -> hh; |
||||
|
case hh -> am; |
||||
|
default -> null; |
||||
|
}; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 获取下一级时间 |
||||
|
* 若当前是dd的2023-09-12 12:00:00 则下一级时间为mm的2023-09-01 00:00:00 |
||||
|
* 若当前是mm的2023-09-12 12:00:00 则下一级时间为yy的2023-01-01 00:00:00 |
||||
|
*/ |
||||
|
public LocalDateTime nextAttributeTypeTime(LocalDateTime time) { |
||||
|
time = time.withHour(0).withMinute(0).withSecond(0).withNano(0); |
||||
|
return switch (this) { |
||||
|
case dd -> time.with(TemporalAdjusters.firstDayOfMonth()); |
||||
|
case mm -> time.with(TemporalAdjusters.firstDayOfYear()); |
||||
|
default -> null; |
||||
|
}; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 获取当前时间的标准格式 |
||||
|
* 若当前是dd的2023-09-12 12:00:00 则标准格式为dd的2023-09-12 00:00:00 |
||||
|
* 若当前是mm的2023-09-12 12:00:00 则标准格式为dd的2023-09-01 00:00:00 |
||||
|
* 若当前是yy的2023-09-12 12:00:00 则标准格式为dd的2023-01-01 00:00:00 |
||||
|
*/ |
||||
|
public LocalDateTime convertStandardTime(LocalDateTime time) { |
||||
|
time = time.withHour(0).withMinute(0).withSecond(0).withNano(0); |
||||
|
return switch (this) { |
||||
|
case dd -> time; |
||||
|
case mm -> time.with(TemporalAdjusters.firstDayOfMonth()); |
||||
|
case yy -> time.with(TemporalAdjusters.firstDayOfYear()); |
||||
|
default -> null; |
||||
|
}; |
||||
|
} |
||||
|
|
||||
|
public String nextAttributeTypeTime(String timeStr) { |
||||
|
LocalDateTime time = DateTimeUtils.parseDateTime(timeStr); |
||||
|
return Objects.requireNonNull(nextAttributeTypeTime(time)) |
||||
|
.format(DateTimeUtils.DATE_TIME_PATTERN); |
||||
|
} |
||||
|
|
||||
|
public String convertStandardTime(String timeStr) { |
||||
|
LocalDateTime time = DateTimeUtils.parseDateTime(timeStr); |
||||
|
return Objects.requireNonNull(convertStandardTime(time)) |
||||
|
.format(DateTimeUtils.DATE_TIME_PATTERN); |
||||
|
} |
||||
|
|
||||
|
public boolean isCurrentType(String attributeType) { |
||||
|
return Objects.equals(this.name(), attributeType); |
||||
|
} |
||||
|
|
||||
|
public static String removeSuffix(String attrCode) { |
||||
|
if (attrCode.endsWith("am") |
||||
|
|| attrCode.endsWith("hh") |
||||
|
|| attrCode.endsWith("dd") |
||||
|
|| attrCode.endsWith("mm") |
||||
|
|| attrCode.endsWith("yy")) { |
||||
|
return attrCode.substring(0, attrCode.length() - 2); |
||||
|
} |
||||
|
return attrCode; |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,16 @@ |
|||||
|
package com.thing.common.core.enumeration; |
||||
|
|
||||
|
public enum CacheEventType { |
||||
|
/** |
||||
|
* 计算缓存 |
||||
|
*/ |
||||
|
CALCULATION_CACHE, |
||||
|
/** |
||||
|
* 告警缓存 |
||||
|
*/ |
||||
|
ALARM_CACHE, |
||||
|
/** |
||||
|
* 告警动作缓存 |
||||
|
*/ |
||||
|
ALARM_ACTION_CACHE |
||||
|
} |
||||
@ -0,0 +1,35 @@ |
|||||
|
package com.thing.common.core.enumeration; |
||||
|
|
||||
|
import lombok.AllArgsConstructor; |
||||
|
import lombok.Getter; |
||||
|
|
||||
|
/** |
||||
|
* 计算数据类型 |
||||
|
*/ |
||||
|
@Getter |
||||
|
@AllArgsConstructor |
||||
|
public enum CalculationStatusEnum { |
||||
|
/** |
||||
|
* 数据缺失 |
||||
|
*/ |
||||
|
MISS("0"), |
||||
|
/** |
||||
|
* 默认值 |
||||
|
*/ |
||||
|
DEFAULT("1"), |
||||
|
/** |
||||
|
* 计算失败 |
||||
|
*/ |
||||
|
ERROR("2"), |
||||
|
/** |
||||
|
* 计算成功 |
||||
|
*/ |
||||
|
SUCCESS("3"), |
||||
|
/** |
||||
|
* 推送tb失败 |
||||
|
*/ |
||||
|
FAIL("4"); |
||||
|
|
||||
|
private final String value; |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,22 @@ |
|||||
|
package com.thing.common.core.enumeration; |
||||
|
|
||||
|
import lombok.Getter; |
||||
|
|
||||
|
/** 计算符号 */ |
||||
|
public enum CalculationSymbol { |
||||
|
/** 大于 */ |
||||
|
greater(">"), |
||||
|
/** 小于 */ |
||||
|
less("<"), |
||||
|
/** 大于等于 */ |
||||
|
greaterEqual(">="), |
||||
|
/** 小于等于 */ |
||||
|
lessEqual("<="); |
||||
|
|
||||
|
@Getter |
||||
|
private final String name; |
||||
|
|
||||
|
CalculationSymbol(String name) { |
||||
|
this.name = name; |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,35 @@ |
|||||
|
package com.thing.common.core.enumeration; |
||||
|
|
||||
|
import lombok.AllArgsConstructor; |
||||
|
import lombok.Getter; |
||||
|
|
||||
|
import java.util.Arrays; |
||||
|
import java.util.Objects; |
||||
|
|
||||
|
/** |
||||
|
* @author siyang |
||||
|
* @date 2024/5/29 14:46 |
||||
|
* @description 默认碳足迹生命周期枚举 |
||||
|
*/ |
||||
|
@Getter |
||||
|
@AllArgsConstructor |
||||
|
public enum CarbonLifecycleEnum { |
||||
|
MATERIAL_PURCHASE_TRANSPORT("原材料获取", 1), |
||||
|
PRODUCT_MANUFACTURE("生产制造", 2), |
||||
|
PRODUCT_TRANSPORT("运输", 3), |
||||
|
PRODUCT_USAGE("产品使用", 4), |
||||
|
DISPOSE("废弃处理", 5); |
||||
|
|
||||
|
/** 描述 */ |
||||
|
private final String desc; |
||||
|
|
||||
|
/** 生命周期阶段 */ |
||||
|
private final Integer stage; |
||||
|
|
||||
|
public static CarbonLifecycleEnum match(Integer stage) { |
||||
|
return Arrays.stream(CarbonLifecycleEnum.values()) |
||||
|
.filter(item -> Objects.equals(item.getStage(), stage)) |
||||
|
.findFirst() |
||||
|
.orElse(null); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,49 @@ |
|||||
|
package com.thing.common.core.enumeration; |
||||
|
|
||||
|
import lombok.AllArgsConstructor; |
||||
|
import lombok.Getter; |
||||
|
|
||||
|
import java.util.Arrays; |
||||
|
import java.util.Objects; |
||||
|
import java.util.stream.Stream; |
||||
|
|
||||
|
/** |
||||
|
* 云服务商 |
||||
|
*/ |
||||
|
@Getter |
||||
|
@AllArgsConstructor |
||||
|
public enum CloudService { |
||||
|
/** |
||||
|
* 七牛云 |
||||
|
*/ |
||||
|
QINIU(1), |
||||
|
/** |
||||
|
* 阿里云 |
||||
|
*/ |
||||
|
ALIYUN(2), |
||||
|
/** |
||||
|
* 腾讯云 |
||||
|
*/ |
||||
|
QCLOUD(3), |
||||
|
/** |
||||
|
* FASTDFS |
||||
|
*/ |
||||
|
FASTDFS(4), |
||||
|
/** |
||||
|
* 本地 |
||||
|
*/ |
||||
|
LOCAL(5), |
||||
|
/** |
||||
|
* MinIO |
||||
|
*/ |
||||
|
MINIO(6); |
||||
|
|
||||
|
private final int value; |
||||
|
|
||||
|
public static CloudService match(int value) { |
||||
|
return Arrays.stream(CloudService.values()) |
||||
|
.filter(item -> Objects.equals(item.getValue(), value)) |
||||
|
.findFirst() |
||||
|
.orElse(null); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,22 @@ |
|||||
|
package com.thing.common.core.enumeration; |
||||
|
|
||||
|
import lombok.AllArgsConstructor; |
||||
|
import lombok.Getter; |
||||
|
|
||||
|
/** |
||||
|
* 字段关联类型 |
||||
|
*/ |
||||
|
@Getter |
||||
|
@AllArgsConstructor |
||||
|
public enum ColumnRelationType { |
||||
|
/** |
||||
|
* 映射 |
||||
|
*/ |
||||
|
MAPPING("0"), |
||||
|
/** |
||||
|
* 相等 |
||||
|
*/ |
||||
|
EQUAL("1"); |
||||
|
|
||||
|
private final String type; |
||||
|
} |
||||
@ -0,0 +1,22 @@ |
|||||
|
package com.thing.common.core.enumeration; |
||||
|
|
||||
|
import lombok.AllArgsConstructor; |
||||
|
import lombok.Getter; |
||||
|
|
||||
|
/** |
||||
|
* 企业类型 |
||||
|
*/ |
||||
|
@Getter |
||||
|
@AllArgsConstructor |
||||
|
public enum CompanyType { |
||||
|
/** |
||||
|
* 企业角色 |
||||
|
*/ |
||||
|
COMPANY("0"), |
||||
|
/** |
||||
|
* 用户角色 |
||||
|
*/ |
||||
|
TENANT("1"); |
||||
|
|
||||
|
private final String value; |
||||
|
} |
||||
@ -0,0 +1,68 @@ |
|||||
|
package com.thing.common.core.enumeration; |
||||
|
|
||||
|
import lombok.AllArgsConstructor; |
||||
|
import lombok.Getter; |
||||
|
|
||||
|
import java.util.Arrays; |
||||
|
import java.util.Objects; |
||||
|
|
||||
|
/** |
||||
|
* 数据处理类型 |
||||
|
*/ |
||||
|
@Getter |
||||
|
@AllArgsConstructor |
||||
|
public enum ConfigTypeEnum { |
||||
|
/** |
||||
|
* 监控 |
||||
|
*/ |
||||
|
MONITORING("1"), |
||||
|
/** |
||||
|
* 用量 |
||||
|
*/ |
||||
|
USAGE("2"), |
||||
|
|
||||
|
/** |
||||
|
* 数据报表 |
||||
|
*/ |
||||
|
DATA_REPORT("3"), |
||||
|
|
||||
|
/** |
||||
|
* 设备管理 |
||||
|
*/ |
||||
|
DEVICE_MANAGEMENT("4"), |
||||
|
|
||||
|
/** |
||||
|
* 用能统计报表 |
||||
|
*/ |
||||
|
ENERGY("5"), |
||||
|
|
||||
|
/** |
||||
|
* 碳排统计报表 |
||||
|
*/ |
||||
|
CARBON("6"), |
||||
|
|
||||
|
/** |
||||
|
* 碳排放监控 |
||||
|
*/ |
||||
|
CARBON_EMISSIONS("11"), |
||||
|
|
||||
|
/** |
||||
|
* 企业数据维护 |
||||
|
*/ |
||||
|
CORPORATE_DATA("12"), |
||||
|
|
||||
|
/** |
||||
|
* 碳排分析设置 |
||||
|
*/ |
||||
|
CARBON_ANALYSIS("13"); |
||||
|
|
||||
|
private final String value; |
||||
|
|
||||
|
public static ConfigTypeEnum match(String configType) { |
||||
|
return Arrays.stream(ConfigTypeEnum.values()) |
||||
|
.filter(item -> Objects.equals(item.getValue(), configType)) |
||||
|
.findFirst() |
||||
|
.orElse(null); |
||||
|
} |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,22 @@ |
|||||
|
package com.thing.common.core.enumeration; |
||||
|
|
||||
|
import lombok.AllArgsConstructor; |
||||
|
import lombok.Getter; |
||||
|
|
||||
|
/** |
||||
|
* 树检索是否包含本身节点的情况 |
||||
|
*/ |
||||
|
@Getter |
||||
|
@AllArgsConstructor |
||||
|
public enum ContainsCondition { |
||||
|
/** |
||||
|
* 包含 |
||||
|
*/ |
||||
|
CONTAIN("0"), |
||||
|
/** |
||||
|
* 不包含 |
||||
|
*/ |
||||
|
REMOVE("1"); |
||||
|
|
||||
|
private final String value; |
||||
|
} |
||||
@ -0,0 +1,28 @@ |
|||||
|
package com.thing.common.core.enumeration; |
||||
|
|
||||
|
import java.util.Objects; |
||||
|
|
||||
|
public enum DataBaseType { |
||||
|
|
||||
|
MYSQL,POSTGRES,CLICKHOUSE,TIDB; |
||||
|
|
||||
|
/** |
||||
|
* 匹配 :统计 函数 |
||||
|
* @param dataBaseType |
||||
|
* @param agg |
||||
|
* @return |
||||
|
*/ |
||||
|
public static String statisticalAggFun(DataBaseType dataBaseType, AggType agg) { |
||||
|
if(Objects.requireNonNull(agg) == AggType.COUNT){ |
||||
|
return agg+ "(val)"; |
||||
|
} |
||||
|
if (Objects.requireNonNull(dataBaseType) == DataBaseType.MYSQL || Objects.requireNonNull(dataBaseType) == DataBaseType.TIDB || Objects.requireNonNull(dataBaseType) == DataBaseType.POSTGRES) { |
||||
|
return "ROUND(" +agg+ "(CAST(val AS DECIMAL)), 2)"; |
||||
|
} |
||||
|
if (Objects.requireNonNull(dataBaseType) == DataBaseType.CLICKHOUSE) { |
||||
|
return "ROUND(" +agg+ "(CAST(val AS Float64)), 2)"; |
||||
|
} |
||||
|
throw new IllegalArgumentException("Unsupported database type: " + dataBaseType); |
||||
|
} |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,22 @@ |
|||||
|
package com.thing.common.core.enumeration; |
||||
|
|
||||
|
import lombok.AllArgsConstructor; |
||||
|
import lombok.Getter; |
||||
|
|
||||
|
/** |
||||
|
* 数据处理类型 |
||||
|
*/ |
||||
|
@Getter |
||||
|
@AllArgsConstructor |
||||
|
public enum DataTreatingMarkEnum { |
||||
|
/** |
||||
|
* 处理 |
||||
|
*/ |
||||
|
DISPOSE("1"), |
||||
|
/** |
||||
|
* 未处理 |
||||
|
*/ |
||||
|
UNTREATED("0"); |
||||
|
|
||||
|
private final String value; |
||||
|
} |
||||
@ -0,0 +1,55 @@ |
|||||
|
package com.thing.common.core.enumeration; |
||||
|
|
||||
|
import lombok.AllArgsConstructor; |
||||
|
import lombok.Getter; |
||||
|
|
||||
|
/** |
||||
|
* 数据集物关系上下级状态 |
||||
|
*/ |
||||
|
@Getter |
||||
|
@AllArgsConstructor |
||||
|
public enum DatasetAttrTimestampType { |
||||
|
/** |
||||
|
* 无值 |
||||
|
*/ |
||||
|
NONE("none") , |
||||
|
/** |
||||
|
* 最近一天 |
||||
|
*/ |
||||
|
LASTESTDAY("1"), |
||||
|
/** |
||||
|
* 最近一周 |
||||
|
*/ |
||||
|
LASTESTWEEK("2"), |
||||
|
/** |
||||
|
* 最近一月 |
||||
|
*/ |
||||
|
LASTESTMONTH("3"), |
||||
|
/** |
||||
|
* 最近一年 |
||||
|
*/ |
||||
|
LASTESTYEAR("4"), |
||||
|
/** |
||||
|
* 任意时间 |
||||
|
*/ |
||||
|
ANYTIME("5"), |
||||
|
|
||||
|
/** |
||||
|
* 最新值 |
||||
|
*/ |
||||
|
LASTEST("last"), |
||||
|
/** |
||||
|
* 最近一天 老项目在两个地方定义了”最近一天“这个枚举, 这里做个兼容吧 |
||||
|
*/ |
||||
|
NEAREST("nearest"), |
||||
|
/** |
||||
|
* 区间 |
||||
|
*/ |
||||
|
RANGE("range"), |
||||
|
/** |
||||
|
* 时间段 |
||||
|
*/ |
||||
|
INTERVAL("interval"); |
||||
|
|
||||
|
private final String type; |
||||
|
} |
||||
@ -0,0 +1,31 @@ |
|||||
|
package com.thing.common.core.enumeration; |
||||
|
|
||||
|
import lombok.AllArgsConstructor; |
||||
|
import lombok.Getter; |
||||
|
|
||||
|
/** |
||||
|
* 数据集状态 |
||||
|
*/ |
||||
|
@Getter |
||||
|
@AllArgsConstructor |
||||
|
public enum DatasetInterValType { |
||||
|
/** |
||||
|
* 最新值 |
||||
|
*/ |
||||
|
DAY("day"), |
||||
|
/** |
||||
|
* 最近一天 |
||||
|
*/ |
||||
|
WEEK("week"), |
||||
|
/** |
||||
|
* 最近一周 |
||||
|
*/ |
||||
|
MONTH("month"), |
||||
|
|
||||
|
/** |
||||
|
* 时间段 |
||||
|
*/ |
||||
|
YEAR("year"); |
||||
|
|
||||
|
private final String type; |
||||
|
} |
||||
@ -0,0 +1,22 @@ |
|||||
|
package com.thing.common.core.enumeration; |
||||
|
|
||||
|
import lombok.AllArgsConstructor; |
||||
|
import lombok.Getter; |
||||
|
|
||||
|
/** |
||||
|
* 数据集设备分属性 |
||||
|
*/ |
||||
|
@Getter |
||||
|
@AllArgsConstructor |
||||
|
public enum DatasetSeparateAttr { |
||||
|
/** |
||||
|
* 分属性 |
||||
|
*/ |
||||
|
SEPARATE("0"), |
||||
|
/** |
||||
|
* 不分属性 |
||||
|
*/ |
||||
|
NO_SEPARATE("1"); |
||||
|
|
||||
|
private final String value; |
||||
|
} |
||||
@ -0,0 +1,24 @@ |
|||||
|
package com.thing.common.core.enumeration; |
||||
|
|
||||
|
import lombok.AllArgsConstructor; |
||||
|
import lombok.Getter; |
||||
|
|
||||
|
/** |
||||
|
* 数据集是否开启 |
||||
|
*/ |
||||
|
@Getter |
||||
|
@AllArgsConstructor |
||||
|
public enum DatasetStatus { |
||||
|
/** |
||||
|
* 开启 |
||||
|
*/ |
||||
|
START("1"), |
||||
|
/** |
||||
|
* 关闭 |
||||
|
*/ |
||||
|
STOP("0"); |
||||
|
|
||||
|
private final String status; |
||||
|
} |
||||
|
|
||||
|
|
||||
@ -0,0 +1,22 @@ |
|||||
|
package com.thing.common.core.enumeration; |
||||
|
|
||||
|
import lombok.AllArgsConstructor; |
||||
|
import lombok.Getter; |
||||
|
|
||||
|
/** |
||||
|
* 数据集物关系上下级状态 |
||||
|
*/ |
||||
|
@Getter |
||||
|
@AllArgsConstructor |
||||
|
public enum DatasetThingRelationStatus { |
||||
|
/** |
||||
|
* 向上级 |
||||
|
*/ |
||||
|
PU, |
||||
|
|
||||
|
/** |
||||
|
* 向下级 |
||||
|
*/ |
||||
|
PD; |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,39 @@ |
|||||
|
package com.thing.common.core.enumeration; |
||||
|
|
||||
|
import lombok.AllArgsConstructor; |
||||
|
import lombok.Getter; |
||||
|
|
||||
|
@Getter |
||||
|
@AllArgsConstructor |
||||
|
public enum DefaultType { |
||||
|
/** |
||||
|
* 物类型 |
||||
|
*/ |
||||
|
THING("默认物类型"), |
||||
|
/** |
||||
|
* 组类型 |
||||
|
*/ |
||||
|
GROUP("默认组类型"), |
||||
|
/** |
||||
|
* 字典类型 |
||||
|
*/ |
||||
|
DICT("默认字典类型"), |
||||
|
|
||||
|
/** |
||||
|
* 关系类型 |
||||
|
*/ |
||||
|
RELATION("默认关系类型"), |
||||
|
|
||||
|
/** |
||||
|
* 设备类型 |
||||
|
*/ |
||||
|
EQUIPMENT("设备类型"), |
||||
|
|
||||
|
/** |
||||
|
* 备件类型 |
||||
|
*/ |
||||
|
EQUIPMENT_PART("备件类型"); |
||||
|
|
||||
|
|
||||
|
private final String value; |
||||
|
} |
||||
@ -0,0 +1,27 @@ |
|||||
|
package com.thing.common.core.enumeration; |
||||
|
|
||||
|
/** |
||||
|
* 删除标记枚举 |
||||
|
* |
||||
|
* @author Mark sunlightcs@gmail.com |
||||
|
*/ |
||||
|
public enum DeleteEnum { |
||||
|
/** |
||||
|
* 是(删除) |
||||
|
*/ |
||||
|
YES(1), |
||||
|
/** |
||||
|
* 否(未删除) |
||||
|
*/ |
||||
|
NO(0); |
||||
|
|
||||
|
private int value; |
||||
|
|
||||
|
DeleteEnum(int value) { |
||||
|
this.value = value; |
||||
|
} |
||||
|
|
||||
|
public int value() { |
||||
|
return this.value; |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,22 @@ |
|||||
|
package com.thing.common.core.enumeration; |
||||
|
|
||||
|
import lombok.AllArgsConstructor; |
||||
|
import lombok.Getter; |
||||
|
|
||||
|
/** |
||||
|
* 设备指令下发状态 |
||||
|
*/ |
||||
|
@Getter |
||||
|
@AllArgsConstructor |
||||
|
public enum DeviceSendCmdStatus { |
||||
|
/** |
||||
|
* 失败 |
||||
|
*/ |
||||
|
FAILURE("0"), |
||||
|
/** |
||||
|
* 成功 |
||||
|
*/ |
||||
|
SUCCESS("1"); |
||||
|
|
||||
|
private final String value; |
||||
|
} |
||||
@ -0,0 +1,22 @@ |
|||||
|
package com.thing.common.core.enumeration; |
||||
|
|
||||
|
import lombok.AllArgsConstructor; |
||||
|
import lombok.Getter; |
||||
|
|
||||
|
/** |
||||
|
* 设备是否是模板 |
||||
|
*/ |
||||
|
@Getter |
||||
|
@AllArgsConstructor |
||||
|
public enum DeviceTemplateMark { |
||||
|
/** |
||||
|
* 模板 |
||||
|
*/ |
||||
|
TEMPLATE("0"), |
||||
|
/** |
||||
|
* 设备 |
||||
|
*/ |
||||
|
DEVICE("1"); |
||||
|
|
||||
|
private final String value; |
||||
|
} |
||||
@ -0,0 +1,26 @@ |
|||||
|
package com.thing.common.core.enumeration; |
||||
|
|
||||
|
import lombok.AllArgsConstructor; |
||||
|
import lombok.Getter; |
||||
|
|
||||
|
/** |
||||
|
* 物关系类型 |
||||
|
*/ |
||||
|
@Getter |
||||
|
@AllArgsConstructor |
||||
|
public enum DictRelationEnum { |
||||
|
/** |
||||
|
* 物 |
||||
|
*/ |
||||
|
FROM_TYPE_THING("thing"), |
||||
|
/** |
||||
|
* 模板 |
||||
|
*/ |
||||
|
FROM_TYPE_TEMPLATE("template"), |
||||
|
/** |
||||
|
* 关系 |
||||
|
*/ |
||||
|
FROM_TYPE_RELATION("relation"); |
||||
|
|
||||
|
private final String value; |
||||
|
} |
||||
@ -0,0 +1,60 @@ |
|||||
|
package com.thing.common.core.enumeration; |
||||
|
|
||||
|
import lombok.AllArgsConstructor; |
||||
|
import lombok.Getter; |
||||
|
import org.apache.commons.lang3.StringUtils; |
||||
|
|
||||
|
import java.util.Arrays; |
||||
|
import java.util.Objects; |
||||
|
import java.util.Optional; |
||||
|
|
||||
|
/** |
||||
|
* 物关系类型 |
||||
|
*/ |
||||
|
@Getter |
||||
|
@AllArgsConstructor |
||||
|
public enum DictTypeEnum { |
||||
|
|
||||
|
/** |
||||
|
* 默认 |
||||
|
*/ |
||||
|
DEFAULTTYPE("默认","default",1), |
||||
|
/** |
||||
|
* 瞬时 |
||||
|
*/ |
||||
|
INSTANT("瞬时","instant",2), |
||||
|
/** |
||||
|
* 递增 |
||||
|
*/ |
||||
|
INCREASE("递增","increase",3), |
||||
|
/** |
||||
|
* 区间 |
||||
|
*/ |
||||
|
REGION("区间","region",4), |
||||
|
/** |
||||
|
* 控制 |
||||
|
*/ |
||||
|
CONTROL("控制","control",5) , |
||||
|
/** |
||||
|
* 告警 |
||||
|
*/ |
||||
|
ALARM("告警","alarm",6); |
||||
|
|
||||
|
|
||||
|
private final String name; |
||||
|
private final String type; |
||||
|
private final Integer sort; |
||||
|
|
||||
|
public static String match(String type) { |
||||
|
Optional<DictTypeEnum> first = Arrays.stream(DictTypeEnum.values()) |
||||
|
.filter(dictTypeEnum -> StringUtils.equals(type, dictTypeEnum.getType())) |
||||
|
.findFirst(); |
||||
|
if(first.isPresent()){ |
||||
|
return first.get().getName(); |
||||
|
} |
||||
|
return ""; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
} |
||||
@ -0,0 +1,23 @@ |
|||||
|
package com.thing.common.core.enumeration; |
||||
|
|
||||
|
import lombok.AllArgsConstructor; |
||||
|
import lombok.Getter; |
||||
|
|
||||
|
import java.util.Arrays; |
||||
|
import java.util.Objects; |
||||
|
|
||||
|
@Getter |
||||
|
@AllArgsConstructor |
||||
|
public enum EnergyVarietyEnum { |
||||
|
A("A", "电"), |
||||
|
C("C", "天然气"); |
||||
|
private final String prefix; |
||||
|
private final String name; |
||||
|
|
||||
|
public static EnergyVarietyEnum getByPrefix(String prefix) { |
||||
|
return Arrays.stream(EnergyVarietyEnum.values()) |
||||
|
.filter(item -> Objects.equals(item.prefix, prefix)) |
||||
|
.findFirst() |
||||
|
.orElse(null); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,41 @@ |
|||||
|
package com.thing.common.core.enumeration; |
||||
|
|
||||
|
import lombok.AllArgsConstructor; |
||||
|
import lombok.Getter; |
||||
|
import org.apache.commons.lang3.StringUtils; |
||||
|
|
||||
|
import java.util.Arrays; |
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* 类型 |
||||
|
*/ |
||||
|
@Getter |
||||
|
@AllArgsConstructor |
||||
|
public enum ExtendRelationType { |
||||
|
/** |
||||
|
* 读、写、读写 |
||||
|
*/ |
||||
|
READ("读"), |
||||
|
WRITE("写") |
||||
|
/*, |
||||
|
ALL("读写")*/; |
||||
|
|
||||
|
private final String name; |
||||
|
|
||||
|
public static List<String> getRead() { |
||||
|
return List.of(READ.name()/*, ALL.name()*/); |
||||
|
} |
||||
|
|
||||
|
public static List<String> getWrite() { |
||||
|
return List.of(WRITE.name()/*, ALL.name()*/); |
||||
|
} |
||||
|
|
||||
|
public static String getByName(String name) { |
||||
|
return Arrays.stream(ExtendRelationType.values()) |
||||
|
.filter(type -> StringUtils.equals(type.getName(), StringUtils.trim(name))) |
||||
|
.findFirst() |
||||
|
.orElseThrow(() -> new RuntimeException(name + "未匹配")) |
||||
|
.name(); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,31 @@ |
|||||
|
package com.thing.common.core.enumeration; |
||||
|
|
||||
|
import lombok.AllArgsConstructor; |
||||
|
import lombok.Getter; |
||||
|
|
||||
|
/** |
||||
|
* 数据集状态 |
||||
|
*/ |
||||
|
@Getter |
||||
|
@AllArgsConstructor |
||||
|
public enum FormulaSymbols { |
||||
|
/** |
||||
|
* 加号 |
||||
|
*/ |
||||
|
PLUS("+"), |
||||
|
/** |
||||
|
* 减号 |
||||
|
*/ |
||||
|
MINUS("-"), |
||||
|
/** |
||||
|
* 乘号 |
||||
|
*/ |
||||
|
MULTIPLE("*"), |
||||
|
|
||||
|
/** |
||||
|
* 除号 |
||||
|
*/ |
||||
|
DIVISION("/"); |
||||
|
|
||||
|
private final String symbols; |
||||
|
} |
||||
@ -0,0 +1,29 @@ |
|||||
|
package com.thing.common.core.enumeration; |
||||
|
|
||||
|
import lombok.AllArgsConstructor; |
||||
|
import lombok.Getter; |
||||
|
import org.apache.commons.lang3.StringUtils; |
||||
|
|
||||
|
import java.util.Arrays; |
||||
|
|
||||
|
/** |
||||
|
* 物是否为网关 |
||||
|
*/ |
||||
|
@Getter |
||||
|
@AllArgsConstructor |
||||
|
public enum GateWayStatus { |
||||
|
/** |
||||
|
* 网关 |
||||
|
*/ |
||||
|
GATE_WAY("1"), |
||||
|
/** |
||||
|
* 非网关--即设备 |
||||
|
*/ |
||||
|
NO_GATE_WAY("0"); |
||||
|
|
||||
|
private final String value; |
||||
|
|
||||
|
public static boolean noneMatch(String status){ |
||||
|
return Arrays.stream(GateWayStatus.values()).noneMatch(s-> StringUtils.equals(s.getValue(),status)); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,50 @@ |
|||||
|
package com.thing.common.core.enumeration; |
||||
|
|
||||
|
import com.google.common.collect.Lists; |
||||
|
import com.google.common.collect.Maps; |
||||
|
import lombok.AllArgsConstructor; |
||||
|
import lombok.Getter; |
||||
|
import org.apache.commons.lang3.StringUtils; |
||||
|
|
||||
|
import java.util.Arrays; |
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
/** |
||||
|
* tb api支持的时间粒度,请不要随便新增,若要新增其他方式请@author |
||||
|
*/ |
||||
|
@Getter |
||||
|
@AllArgsConstructor |
||||
|
public enum Granularity { |
||||
|
// 以小时计 |
||||
|
HOUR("hh"), |
||||
|
|
||||
|
// 以天计 |
||||
|
DAY("dd"), |
||||
|
|
||||
|
// 以月计 |
||||
|
MONTH("mm"); |
||||
|
|
||||
|
private final String suffix; |
||||
|
|
||||
|
public static List<Map<String, Object>> mapList() { |
||||
|
List<Map<String, Object>> list = Lists.newArrayList(); |
||||
|
for (Granularity granularity : Granularity.values()) { |
||||
|
Map<String, Object> map = Maps.newHashMap(); |
||||
|
map.put("code", granularity.getSuffix()); |
||||
|
map.put("granularity", granularity); |
||||
|
list.add(map); |
||||
|
} |
||||
|
return list; |
||||
|
} |
||||
|
|
||||
|
public static Granularity get(String suffix) { |
||||
|
if (StringUtils.isBlank(suffix)) { |
||||
|
return null; |
||||
|
} |
||||
|
return Arrays.stream(Granularity.values()) |
||||
|
.filter(item -> StringUtils.equals(item.suffix, suffix)) |
||||
|
.findFirst() |
||||
|
.orElse(null); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,70 @@ |
|||||
|
package com.thing.common.core.enumeration; |
||||
|
|
||||
|
import lombok.AllArgsConstructor; |
||||
|
import lombok.Getter; |
||||
|
import org.apache.commons.lang3.StringUtils; |
||||
|
|
||||
|
import java.util.Arrays; |
||||
|
|
||||
|
/** |
||||
|
* 组关系类型 |
||||
|
*/ |
||||
|
@Getter |
||||
|
@AllArgsConstructor |
||||
|
public enum GroupTypeEnum { |
||||
|
/** |
||||
|
* 物 |
||||
|
*/ |
||||
|
THING("thing", "物", "默认实体组", "物实体组"), |
||||
|
/** |
||||
|
* 属性 |
||||
|
*/ |
||||
|
ATTR("attr", "属性", "默认属性组", "物属性组"), |
||||
|
/** |
||||
|
* 标签 |
||||
|
*/ |
||||
|
TAG("tag", "标签", "默认标签组", "物标签组"), |
||||
|
/** |
||||
|
* 素材 |
||||
|
*/ |
||||
|
MATERIAL("material", "素材", "默认素材组", "素材组"), |
||||
|
|
||||
|
/** |
||||
|
* 部件 |
||||
|
*/ |
||||
|
SECTION("section", "部件", "默认部件组", "部件组"), |
||||
|
/** |
||||
|
* 关系 |
||||
|
*/ |
||||
|
THING_RELATION("relation", "物关系", "默认物关系组", "物关系组"), |
||||
|
/** |
||||
|
* 关系 TODO 这个已经不存在了 |
||||
|
*/ |
||||
|
THING_TYPE("type", "物类型", "默认物类型组", "物类型组"); |
||||
|
|
||||
|
|
||||
|
private final String value; |
||||
|
|
||||
|
private final String name; |
||||
|
|
||||
|
private final String group; |
||||
|
|
||||
|
private final String custom; |
||||
|
|
||||
|
public static String getDefaultGroupName(String value) { |
||||
|
if (StringUtils.isBlank(value)) { |
||||
|
return value; |
||||
|
} |
||||
|
for (GroupTypeEnum groupTypeEnum : GroupTypeEnum.values()) { |
||||
|
if (StringUtils.equalsAnyIgnoreCase(groupTypeEnum.getValue(), value)) { |
||||
|
return groupTypeEnum.getGroup(); |
||||
|
} |
||||
|
} |
||||
|
return value; |
||||
|
} |
||||
|
|
||||
|
public static boolean noneMatch(String type){ |
||||
|
return Arrays.stream(GroupTypeEnum.values()).noneMatch(s-> StringUtils.equals(s.getValue(),type)); |
||||
|
} |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,22 @@ |
|||||
|
package com.thing.common.core.enumeration; |
||||
|
|
||||
|
import lombok.AllArgsConstructor; |
||||
|
import lombok.Getter; |
||||
|
|
||||
|
/** |
||||
|
* 开启关闭间隔推送 |
||||
|
*/ |
||||
|
@Getter |
||||
|
@AllArgsConstructor |
||||
|
public enum IntervalPushStatus { |
||||
|
/** |
||||
|
* 开启 |
||||
|
*/ |
||||
|
ON("0"), |
||||
|
/** |
||||
|
* 关闭 |
||||
|
*/ |
||||
|
OFF("1"); |
||||
|
|
||||
|
private final String status; |
||||
|
} |
||||
@ -0,0 +1,21 @@ |
|||||
|
package com.thing.common.core.enumeration; |
||||
|
|
||||
|
import lombok.AllArgsConstructor; |
||||
|
import lombok.Getter; |
||||
|
|
||||
|
/** |
||||
|
* 字典存储类型 |
||||
|
*/ |
||||
|
@Getter |
||||
|
@AllArgsConstructor |
||||
|
public enum IsDefaultEnum { |
||||
|
/** |
||||
|
* 系统字典 |
||||
|
*/ |
||||
|
Y(0), |
||||
|
/** |
||||
|
* 自定义字典 |
||||
|
*/ |
||||
|
N(1); |
||||
|
private final Integer value; |
||||
|
} |
||||
@ -0,0 +1,28 @@ |
|||||
|
package com.thing.common.core.enumeration; |
||||
|
|
||||
|
/** |
||||
|
* 菜单类型枚举 |
||||
|
* |
||||
|
* @author Mark sunlightcs@gmail.com |
||||
|
* @since 1.0.0 |
||||
|
*/ |
||||
|
public enum MenuTypeEnum { |
||||
|
/** |
||||
|
* 菜单 |
||||
|
*/ |
||||
|
MENU(0), |
||||
|
/** |
||||
|
* 按钮 |
||||
|
*/ |
||||
|
BUTTON(1); |
||||
|
|
||||
|
private int value; |
||||
|
|
||||
|
MenuTypeEnum(int value) { |
||||
|
this.value = value; |
||||
|
} |
||||
|
|
||||
|
public int value() { |
||||
|
return this.value; |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,64 @@ |
|||||
|
package com.thing.common.core.enumeration; |
||||
|
|
||||
|
import cn.hutool.core.collection.CollectionUtil; |
||||
|
import org.apache.commons.io.FilenameUtils; |
||||
|
import org.apache.commons.lang3.StringUtils; |
||||
|
|
||||
|
import java.util.Arrays; |
||||
|
import java.util.List; |
||||
|
import java.util.stream.Collectors; |
||||
|
|
||||
|
/** |
||||
|
* MimeType找不全,还是用后缀吧... |
||||
|
* |
||||
|
* @author zhenghh. 2022-01-14 |
||||
|
**/ |
||||
|
public enum MimeTypeEnum { |
||||
|
|
||||
|
/** |
||||
|
* 图片格式 |
||||
|
*/ |
||||
|
jpg, jpeg, png, gif, bmp, ico, jfif, webp, tif, tiff, tga, svg, |
||||
|
|
||||
|
/** |
||||
|
* office |
||||
|
*/ |
||||
|
doc, docx, xls, xlsx, xlsm, ppt, pptx, csv, tsv, dotm, xlt, xltm, dot, dotx, xlam, xla, wps, dps, et, ett, wpt, odt, ods, ots, odp, otp, six, ott, fodt, fods, |
||||
|
/** |
||||
|
* 3d模型 |
||||
|
* 3ds, 3dm, 3mf |
||||
|
*/ |
||||
|
obj, stl, ply, gltf, glb, off, fbx, dae, wrl, ifc, brep, step, iges, fcstd, bim, |
||||
|
/** |
||||
|
* 文档 |
||||
|
*/ |
||||
|
pdf, ofd, rtf; |
||||
|
|
||||
|
/** |
||||
|
* 获取所有图片格式 |
||||
|
* |
||||
|
* @return list |
||||
|
*/ |
||||
|
public static List<String> getImageMimeType() { |
||||
|
return CollectionUtil.newArrayList(jpg.name(), jpeg.name(), png.name(), gif.name(), bmp.name(), ico.name(), |
||||
|
jfif.name(), webp.name(), tif.name(), tiff.name(), tga.name(), svg.name()); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 获取所有文件格式 |
||||
|
* |
||||
|
* @return list |
||||
|
*/ |
||||
|
public static List<String> getAllMimeType() { |
||||
|
List<String> list = CollectionUtil.newArrayList(Arrays.stream(MimeTypeEnum.values()).map(Enum::name).collect(Collectors.toList())); |
||||
|
list.add("3ds"); |
||||
|
list.add("3dm"); |
||||
|
list.add("3mf"); |
||||
|
return list; |
||||
|
} |
||||
|
|
||||
|
public static void main(String[] args) { |
||||
|
System.out.println(FilenameUtils.isExtension(StringUtils.lowerCase("D://1.3ds"), MimeTypeEnum.getAllMimeType())); |
||||
|
} |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,353 @@ |
|||||
|
package com.thing.common.core.enumeration; |
||||
|
|
||||
|
|
||||
|
import lombok.AllArgsConstructor; |
||||
|
import lombok.Getter; |
||||
|
|
||||
|
import java.util.Arrays; |
||||
|
import java.util.Map; |
||||
|
import java.util.stream.Collectors; |
||||
|
|
||||
|
@Getter |
||||
|
@AllArgsConstructor |
||||
|
public enum MinioFileContentTypeEnum { |
||||
|
/** |
||||
|
* contentType |
||||
|
*/ |
||||
|
TYPE1(".*", "application/octet-stream"), |
||||
|
TYPE2(".001", "application/x-001"), |
||||
|
TYPE3(".301", "application/x-301"), |
||||
|
TYPE4(".323", "text/h323"), |
||||
|
TYPE5(".906", "application/x-906"), |
||||
|
TYPE6(".907", "drawing/907"), |
||||
|
TYPE7(".a11", "application/x-a11"), |
||||
|
TYPE8(".acp", "audio/x-mei-aac"), |
||||
|
TYPE9(".ai", "application/postscript"), |
||||
|
TYPE10(".aif", "audio/aiff"), |
||||
|
TYPE11(".aifc", "audio/aiff"), |
||||
|
TYPE12(".aiff", "audio/aiff"), |
||||
|
TYPE13(".anv", "application/x-anv"), |
||||
|
TYPE14(".asa", "text/asa"), |
||||
|
TYPE15(".asf", "video/x-ms-asf"), |
||||
|
TYPE16(".asp", "text/asp"), |
||||
|
TYPE17(".asx", "video/x-ms-asf"), |
||||
|
TYPE18(".au", "audio/basic"), |
||||
|
TYPE19(".avi", "video/avi"), |
||||
|
TYPE20(".awf", "application/vnd.adobe.workflow"), |
||||
|
TYPE21(".biz", "text/xml"), |
||||
|
TYPE22(".bmp", "application/x-bmp"), |
||||
|
TYPE23(".bot", "application/x-bot"), |
||||
|
TYPE24(".c4t", "application/x-c4t"), |
||||
|
TYPE25(".c90", "application/x-c90"), |
||||
|
TYPE26(".cal", "application/x-cals"), |
||||
|
TYPE27(".cat", "application/s-pki.seccat"), |
||||
|
TYPE28(".cdf", "application/x-netcdf"), |
||||
|
TYPE29(".cdr", "application/x-cdr"), |
||||
|
TYPE30(".cel", "application/x-cel"), |
||||
|
TYPE31(".cer", "application/x-x509-ca-cert"), |
||||
|
TYPE32(".cg4", "application/x-g4"), |
||||
|
TYPE33(".cgm", "application/x-cgm"), |
||||
|
TYPE34(".cit", "application/x-cit"), |
||||
|
TYPE35(".class", "java/*"), |
||||
|
TYPE36(".cml", "text/xml"), |
||||
|
TYPE37(".cmp", "application/x-cmp"), |
||||
|
TYPE38(".cmx", "application/x-cmx"), |
||||
|
TYPE39(".cot", "application/x-cot"), |
||||
|
TYPE40(".crl", "application/pkix-crl"), |
||||
|
TYPE41(".crt", "application/x-x509-ca-cert"), |
||||
|
TYPE42(".csi", "application/x-csi"), |
||||
|
TYPE43(".css", "text/css"), |
||||
|
TYPE44(".cut", "application/x-cut"), |
||||
|
TYPE45(".dbf", "application/x-dbf"), |
||||
|
TYPE46(".dbm", "application/x-dbm"), |
||||
|
TYPE47(".dbx", "application/x-dbx"), |
||||
|
TYPE48(".dcd", "text/xml"), |
||||
|
TYPE49(".dcx", "application/x-dcx"), |
||||
|
TYPE50(".der", "application/x-x509-ca-cert"), |
||||
|
TYPE51(".dgn", "application/x-dgn"), |
||||
|
TYPE52(".dib", "application/x-dib"), |
||||
|
TYPE53(".dll", "application/x-msdownload"), |
||||
|
TYPE54(".doc", "application/msword"), |
||||
|
TYPE55(".dot", "application/msword"), |
||||
|
TYPE56(".drw", "application/x-drw"), |
||||
|
TYPE57(".dtd", "text/xml"), |
||||
|
TYPE58(".dwf", "Model/vnd.dwf"), |
||||
|
TYPE59(".dwg", "application/x-dwg"), |
||||
|
TYPE60(".dxb", "application/x-dxb"), |
||||
|
TYPE61(".dxf", "application/x-dxf"), |
||||
|
TYPE62(".edn", "application/vnd.adobe.edn"), |
||||
|
TYPE63(".emf", "application/x-emf"), |
||||
|
TYPE64(".eml", "message/rfc822"), |
||||
|
TYPE65(".ent", "text/xml"), |
||||
|
TYPE66(".epi", "application/x-epi"), |
||||
|
TYPE67(".eps", "application/x-ps"), |
||||
|
TYPE68(".etd", "application/x-ebx"), |
||||
|
TYPE69(".exe", "application/x-msdownload"), |
||||
|
TYPE70(".fax", "image/fax"), |
||||
|
TYPE71(".fdf", "application/vnd.fdf"), |
||||
|
TYPE72(".fif", "application/fractals"), |
||||
|
TYPE73(".fo", "text/xml"), |
||||
|
TYPE74(".frm", "application/x-frm"), |
||||
|
TYPE75(".g4", "application/x-g4"), |
||||
|
TYPE76(".gbr", "application/x-gbr"), |
||||
|
TYPE77(".gcd", "application/x-gcd"), |
||||
|
TYPE78(".gif", "image/gif"), |
||||
|
TYPE79(".gl2", "application/x-gl2"), |
||||
|
TYPE80(".gp4", "application/x-gp4"), |
||||
|
TYPE81(".hgl", "application/x-hgl"), |
||||
|
TYPE82(".hmr", "application/x-hmr"), |
||||
|
TYPE83(".hpg", "application/x-hpgl"), |
||||
|
TYPE84(".hpl", "application/x-hpl"), |
||||
|
TYPE85(".hqx", "application/mac-binhex40"), |
||||
|
TYPE86(".hrf", "application/x-hrf"), |
||||
|
TYPE87(".hta", "application/hta"), |
||||
|
TYPE88(".htc", "text/x-component"), |
||||
|
TYPE89(".htm", "text/html"), |
||||
|
TYPE90(".html", "text/html"), |
||||
|
TYPE91(".htt", "text/webviewhtml"), |
||||
|
TYPE92(".htx", "text/html"), |
||||
|
TYPE93(".icb", "application/x-icb"), |
||||
|
TYPE94(".ico", "image/x-icon"), |
||||
|
TYPE95(".iff", "application/x-iff"), |
||||
|
TYPE96(".ig4", "application/x-g4"), |
||||
|
TYPE97(".igs", "application/x-igs"), |
||||
|
TYPE98(".iii", "application/x-iphone"), |
||||
|
TYPE99(".img", "application/x-img"), |
||||
|
TYPE100(".ins", "application/x-internet-signup"), |
||||
|
TYPE101(".isp", "application/x-internet-signup"), |
||||
|
TYPE102(".IVF", "video/x-ivf"), |
||||
|
TYPE103(".java", "java/*"), |
||||
|
TYPE104(".jfif", "image/jpeg"), |
||||
|
TYPE105(".jpe", "image/jpeg"), |
||||
|
TYPE106(".jpeg", "image/jpeg"), |
||||
|
TYPE107(".jpg", "image/jpeg"), |
||||
|
TYPE108(".js", "application/x-javascript"), |
||||
|
TYPE109(".jsp", "text/html"), |
||||
|
TYPE110(".la1", "audio/x-liquid-file"), |
||||
|
TYPE111(".lar", "application/x-laplayer-reg"), |
||||
|
TYPE112(".latex", "application/x-latex"), |
||||
|
TYPE113(".lavs", "audio/x-liquid-secure"), |
||||
|
TYPE114(".lbm", "application/x-lbm"), |
||||
|
TYPE115(".lmsff", "audio/x-la-lms"), |
||||
|
TYPE116(".ls", "application/x-javascript"), |
||||
|
TYPE117(".ltr", "application/x-ltr"), |
||||
|
TYPE118(".m1v", "video/x-mpeg"), |
||||
|
TYPE119(".m2v", "video/x-mpeg"), |
||||
|
TYPE120(".m3u", "audio/mpegurl"), |
||||
|
TYPE121(".m4e", "video/mpeg4"), |
||||
|
TYPE122(".mac", "application/x-mac"), |
||||
|
TYPE123(".man", "application/x-troff-man"), |
||||
|
TYPE124(".math", "text/xml"), |
||||
|
TYPE125(".mdb", "application/x-mdb"), |
||||
|
TYPE126(".mfp", "application/x-shockwave-flash"), |
||||
|
TYPE127(".mht", "message/rfc822"), |
||||
|
TYPE128(".mhtml", "message/rfc822"), |
||||
|
TYPE129(".mi", "application/x-mi"), |
||||
|
TYPE130(".mid", "audio/mid"), |
||||
|
TYPE131(".midi", "audio/mid"), |
||||
|
TYPE132(".mil", "application/x-mil"), |
||||
|
TYPE133(".mml", "text/xml"), |
||||
|
TYPE134(".mnd", "audio/x-musicnet-download"), |
||||
|
TYPE135(".mns", "audio/x-musicnet-stream"), |
||||
|
TYPE136(".mocha", "application/x-javascript"), |
||||
|
TYPE137(".movie", "video/x-sgi-movie"), |
||||
|
TYPE138(".mp1", "audio/mp1"), |
||||
|
TYPE139(".mp2", "audio/mp2"), |
||||
|
TYPE140(".mp2v", "video/mpeg"), |
||||
|
TYPE141(".mp3", "audio/mp3"), |
||||
|
TYPE142(".mp4", "video/mp4"), |
||||
|
TYPE143(".mpa", "video/x-mpg"), |
||||
|
TYPE144(".mpd", "application/-project"), |
||||
|
TYPE145(".mpe", "video/x-mpeg"), |
||||
|
TYPE146(".mpeg", "video/mpg"), |
||||
|
TYPE147(".mpg", "video/mpg"), |
||||
|
TYPE148(".mpga", "audio/rn-mpeg"), |
||||
|
TYPE149(".mpp", "application/-project"), |
||||
|
TYPE150(".mps", "video/x-mpeg"), |
||||
|
TYPE151(".mpt", "application/-project"), |
||||
|
TYPE152(".mpv", "video/mpg"), |
||||
|
TYPE153(".mpv2", "video/mpeg"), |
||||
|
TYPE154(".mpw", "application/s-project"), |
||||
|
TYPE155(".mpx", "application/-project"), |
||||
|
TYPE156(".mtx", "text/xml"), |
||||
|
TYPE157(".mxp", "application/x-mmxp"), |
||||
|
TYPE158(".net", "image/pnetvue"), |
||||
|
TYPE159(".nrf", "application/x-nrf"), |
||||
|
TYPE160(".nws", "message/rfc822"), |
||||
|
TYPE161(".odc", "text/x-ms-odc"), |
||||
|
TYPE162(".out", "application/x-out"), |
||||
|
TYPE163(".p10", "application/pkcs10"), |
||||
|
TYPE164(".p12", "application/x-pkcs12"), |
||||
|
TYPE165(".p7b", "application/x-pkcs7-certificates"), |
||||
|
TYPE166(".p7c", "application/pkcs7-mime"), |
||||
|
TYPE167(".p7m", "application/pkcs7-mime"), |
||||
|
TYPE168(".p7r", "application/x-pkcs7-certreqresp"), |
||||
|
TYPE169(".p7s", "application/pkcs7-signature"), |
||||
|
TYPE170(".pc5", "application/x-pc5"), |
||||
|
TYPE171(".pci", "application/x-pci"), |
||||
|
TYPE172(".pcl", "application/x-pcl"), |
||||
|
TYPE173(".pcx", "application/x-pcx"), |
||||
|
TYPE174(".pdf", "application/pdf"), |
||||
|
TYPE175(".pdx", "application/vnd.adobe.pdx"), |
||||
|
TYPE176(".pfx", "application/x-pkcs12"), |
||||
|
TYPE177(".pgl", "application/x-pgl"), |
||||
|
TYPE178(".pic", "application/x-pic"), |
||||
|
TYPE179(".pko", "application-pki.pko"), |
||||
|
TYPE180(".pl", "application/x-perl"), |
||||
|
TYPE181(".plg", "text/html"), |
||||
|
TYPE182(".pls", "audio/scpls"), |
||||
|
TYPE183(".plt", "application/x-plt"), |
||||
|
TYPE184(".png", "image/png"), |
||||
|
TYPE185(".pot", "applications-powerpoint"), |
||||
|
TYPE186(".ppa", "application/vs-powerpoint"), |
||||
|
TYPE187(".ppm", "application/x-ppm"), |
||||
|
TYPE188(".pps", "application-powerpoint"), |
||||
|
TYPE189(".ppt", "applications-powerpoint"), |
||||
|
TYPE190(".pr", "application/x-pr"), |
||||
|
TYPE191(".prf", "application/pics-rules"), |
||||
|
TYPE192(".prn", "application/x-prn"), |
||||
|
TYPE193(".prt", "application/x-prt"), |
||||
|
TYPE194(".ps", "application/postscript"), |
||||
|
TYPE195(".ptn", "application/x-ptn"), |
||||
|
TYPE196(".pwz", "application/powerpoint"), |
||||
|
TYPE197(".r3t", "text/vnd.rn-realtext3d"), |
||||
|
TYPE198(".ra", "audio/vnd.rn-realaudio"), |
||||
|
TYPE199(".ram", "audio/x-pn-realaudio"), |
||||
|
TYPE200(".ras", "application/x-ras"), |
||||
|
TYPE201(".rat", "application/rat-file"), |
||||
|
TYPE202(".rdf", "text/xml"), |
||||
|
TYPE203(".rec", "application/vnd.rn-recording"), |
||||
|
TYPE204(".red", "application/x-red"), |
||||
|
TYPE205(".rgb", "application/x-rgb"), |
||||
|
TYPE206(".rjs", "application/vnd.rn-realsystem-rjs"), |
||||
|
TYPE207(".rjt", "application/vnd.rn-realsystem-rjt"), |
||||
|
TYPE208(".rlc", "application/x-rlc"), |
||||
|
TYPE209(".rle", "application/x-rle"), |
||||
|
TYPE210(".rm", "application/vnd.rn-realmedia"), |
||||
|
TYPE211(".rmf", "application/vnd.adobe.rmf"), |
||||
|
TYPE212(".rmi", "audio/mid"), |
||||
|
TYPE213(".rmj", "application/vnd.rn-realsystem-rmj"), |
||||
|
TYPE214(".rmm", "audio/x-pn-realaudio"), |
||||
|
TYPE215(".rmp", "application/vnd.rn-rn_music_package"), |
||||
|
TYPE216(".rms", "application/vnd.rn-realmedia-secure"), |
||||
|
TYPE217(".rmvb", "application/vnd.rn-realmedia-vbr"), |
||||
|
TYPE218(".rmx", "application/vnd.rn-realsystem-rmx"), |
||||
|
TYPE219(".rnx", "application/vnd.rn-realplayer"), |
||||
|
TYPE220(".rp", "image/vnd.rn-realpix"), |
||||
|
TYPE221(".rpm", "audio/x-pn-realaudio-plugin"), |
||||
|
TYPE222(".rsml", "application/vnd.rn-rsml"), |
||||
|
TYPE223(".rt", "text/vnd.rn-realtext"), |
||||
|
TYPE224(".rtf", "application/x-rtf"), |
||||
|
TYPE225(".rv", "video/vnd.rn-realvideo"), |
||||
|
TYPE226(".sam", "application/x-sam"), |
||||
|
TYPE227(".sat", "application/x-sat"), |
||||
|
TYPE228(".sdp", "application/sdp"), |
||||
|
TYPE229(".sdw", "application/x-sdw"), |
||||
|
TYPE230(".sit", "application/x-stuffit"), |
||||
|
TYPE231(".slb", "application/x-slb"), |
||||
|
TYPE232(".sld", "application/x-sld"), |
||||
|
TYPE233(".slk", "drawing/x-slk"), |
||||
|
TYPE234(".smi", "application/smil"), |
||||
|
TYPE235(".smil", "application/smil"), |
||||
|
TYPE236(".smk", "application/x-smk"), |
||||
|
TYPE237(".snd", "audio/basic"), |
||||
|
TYPE238(".sol", "text/plain"), |
||||
|
TYPE239(".sor", "text/plain"), |
||||
|
TYPE240(".spc", "application/x-pkcs7-certificates"), |
||||
|
TYPE241(".spl", "application/futuresplash"), |
||||
|
TYPE242(".spp", "text/xml"), |
||||
|
TYPE243(".ssm", "application/streamingmedia"), |
||||
|
TYPE244(".sst", "application-pki.certstore"), |
||||
|
TYPE245(".stl", "application/-pki.stl"), |
||||
|
TYPE246(".stm", "text/html"), |
||||
|
TYPE247(".sty", "application/x-sty"), |
||||
|
TYPE248(".svg", "image/svg+xml"), |
||||
|
TYPE249(".swf", "application/x-shockwave-flash"), |
||||
|
TYPE250(".tdf", "application/x-tdf"), |
||||
|
TYPE251(".tg4", "application/x-tg4"), |
||||
|
TYPE252(".tga", "application/x-tga"), |
||||
|
TYPE253(".tif", "image/tiff"), |
||||
|
TYPE254(".tiff", "image/tiff"), |
||||
|
TYPE255(".tld", "text/xml"), |
||||
|
TYPE256(".top", "drawing/x-top"), |
||||
|
TYPE257(".torrent", "application/x-bittorrent"), |
||||
|
TYPE258(".tsd", "text/xml"), |
||||
|
TYPE259(".txt", "text/plain"), |
||||
|
TYPE260(".uin", "application/x-icq"), |
||||
|
TYPE261(".uls", "text/iuls"), |
||||
|
TYPE262(".vcf", "text/x-vcard"), |
||||
|
TYPE263(".vda", "application/x-vda"), |
||||
|
TYPE264(".vdx", "application/vnd.visio"), |
||||
|
TYPE265(".vml", "text/xml"), |
||||
|
TYPE266(".vpg", "application/x-vpeg005"), |
||||
|
TYPE267(".vsd", "application/x-vsd"), |
||||
|
TYPE268(".vss", "application/vnd.visio"), |
||||
|
TYPE269(".vst", "application/x-vst"), |
||||
|
TYPE270(".vsw", "application/vnd.visio"), |
||||
|
TYPE271(".vsx", "application/vnd.visio"), |
||||
|
TYPE272(".vtx", "application/vnd.visio"), |
||||
|
TYPE273(".vxml", "text/xml"), |
||||
|
TYPE274(".wav", "audio/wav"), |
||||
|
TYPE275(".wax", "audio/x-ms-wax"), |
||||
|
TYPE276(".wb1", "application/x-wb1"), |
||||
|
TYPE277(".wb2", "application/x-wb2"), |
||||
|
TYPE278(".wb3", "application/x-wb3"), |
||||
|
TYPE279(".wbmp", "image/vnd.wap.wbmp"), |
||||
|
TYPE280(".wiz", "application/msword"), |
||||
|
TYPE281(".wk3", "application/x-wk3"), |
||||
|
TYPE282(".wk4", "application/x-wk4"), |
||||
|
TYPE283(".wkq", "application/x-wkq"), |
||||
|
TYPE284(".wks", "application/x-wks"), |
||||
|
TYPE285(".wm", "video/x-ms-wm"), |
||||
|
TYPE286(".wma", "audio/x-ms-wma"), |
||||
|
TYPE287(".wmd", "application/x-ms-wmd"), |
||||
|
TYPE288(".wmf", "application/x-wmf"), |
||||
|
TYPE289(".wml", "text/vnd.wap.wml"), |
||||
|
TYPE290(".wmv", "video/x-ms-wmv"), |
||||
|
TYPE291(".wmx", "video/x-ms-wmx"), |
||||
|
TYPE292(".wmz", "application/x-ms-wmz"), |
||||
|
TYPE293(".wp6", "application/x-wp6"), |
||||
|
TYPE294(".wpd", "application/x-wpd"), |
||||
|
TYPE295(".wpg", "application/x-wpg"), |
||||
|
TYPE296(".wpl", "application/-wpl"), |
||||
|
TYPE297(".wq1", "application/x-wq1"), |
||||
|
TYPE298(".wr1", "application/x-wr1"), |
||||
|
TYPE299(".wri", "application/x-wri"), |
||||
|
TYPE300(".wrk", "application/x-wrk"), |
||||
|
TYPE301(".ws", "application/x-ws"), |
||||
|
TYPE302(".ws2", "application/x-ws"), |
||||
|
TYPE303(".wsc", "text/scriptlet"), |
||||
|
TYPE304(".wsdl", "text/xml"), |
||||
|
TYPE305(".wvx", "video/x-ms-wvx"), |
||||
|
TYPE306(".xdp", "application/vnd.adobe.xdp"), |
||||
|
TYPE307(".xdr", "text/xml"), |
||||
|
TYPE308(".xfd", "application/vnd.adobe.xfd"), |
||||
|
TYPE309(".xfdf", "application/vnd.adobe.xfdf"), |
||||
|
TYPE310(".xhtml", "text/html"), |
||||
|
TYPE311(".xls", "application/x-xls"), |
||||
|
TYPE312(".xlw", "application/x-xlw"), |
||||
|
TYPE313(".xml", "text/xml"), |
||||
|
TYPE314(".xpl", "audio/scpls"), |
||||
|
TYPE315(".xq", "text/xml"), |
||||
|
TYPE316(".xql", "text/xml"), |
||||
|
TYPE317(".xquery", "text/xml"), |
||||
|
TYPE318(".xsd", "text/xml"), |
||||
|
TYPE319(".xsl", "text/xml"), |
||||
|
TYPE320(".xslt", "text/xml"), |
||||
|
TYPE321(".xwd", "application/x-xwd"), |
||||
|
TYPE322(".x_b", "application/x-x_b"), |
||||
|
TYPE323(".x_t", "application/x-x_t"); |
||||
|
|
||||
|
|
||||
|
private final String suffix; |
||||
|
private final String contentType; |
||||
|
|
||||
|
/** |
||||
|
* 获取所有文件格式 |
||||
|
* |
||||
|
* @return list |
||||
|
*/ |
||||
|
public static Map<String, Object> getKeyCodeMap() { |
||||
|
return Arrays.stream(MinioFileContentTypeEnum.values()).collect(Collectors.toMap(MinioFileContentTypeEnum::getSuffix, MinioFileContentTypeEnum::getContentType)); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,38 @@ |
|||||
|
package com.thing.common.core.enumeration; |
||||
|
|
||||
|
import lombok.AllArgsConstructor; |
||||
|
import lombok.Getter; |
||||
|
|
||||
|
/** |
||||
|
* 聚合函数类型 |
||||
|
*/ |
||||
|
@Getter |
||||
|
@AllArgsConstructor |
||||
|
public enum MonitorPolymerizationType { |
||||
|
/** |
||||
|
* 最大 |
||||
|
*/ |
||||
|
MAX("max"), |
||||
|
/** |
||||
|
* 最小 |
||||
|
*/ |
||||
|
MIN("min"), |
||||
|
/** |
||||
|
* 平均 |
||||
|
*/ |
||||
|
AVG("avg"), |
||||
|
/** |
||||
|
* 求和 |
||||
|
*/ |
||||
|
SUM("sum"), |
||||
|
/** |
||||
|
* 计数 |
||||
|
*/ |
||||
|
COUNT("count"), |
||||
|
/** |
||||
|
* 空 |
||||
|
*/ |
||||
|
BLANK("blank"); |
||||
|
|
||||
|
private final String name; |
||||
|
} |
||||
@ -0,0 +1,30 @@ |
|||||
|
package com.thing.common.core.enumeration; |
||||
|
|
||||
|
import lombok.AllArgsConstructor; |
||||
|
import lombok.Getter; |
||||
|
|
||||
|
/** |
||||
|
* 监控分析时间类型 |
||||
|
*/ |
||||
|
@Getter |
||||
|
@AllArgsConstructor |
||||
|
public enum MonitorTimeType { |
||||
|
/** |
||||
|
* 最新 |
||||
|
*/ |
||||
|
LASTEST("lastest"), |
||||
|
/** |
||||
|
* 最近 |
||||
|
*/ |
||||
|
NEAREST("nearest"), |
||||
|
/** |
||||
|
* 区间 |
||||
|
*/ |
||||
|
INTERVAL("interval"), |
||||
|
/** |
||||
|
* 时间段 |
||||
|
*/ |
||||
|
RANGE("range"); |
||||
|
|
||||
|
private final String name; |
||||
|
} |
||||
@ -0,0 +1,34 @@ |
|||||
|
package com.thing.common.core.enumeration; |
||||
|
|
||||
|
import lombok.AllArgsConstructor; |
||||
|
import lombok.Getter; |
||||
|
|
||||
|
/** |
||||
|
* 消息状态 |
||||
|
*/ |
||||
|
@Getter |
||||
|
@AllArgsConstructor |
||||
|
public enum MsgType { |
||||
|
/** |
||||
|
* 短信 |
||||
|
*/ |
||||
|
Sms("0"), |
||||
|
/** |
||||
|
* 邮箱 |
||||
|
*/ |
||||
|
Mail("1"), |
||||
|
/** |
||||
|
* 微信公众号 |
||||
|
*/ |
||||
|
WeChat("2"), |
||||
|
/** |
||||
|
* 钉钉 |
||||
|
*/ |
||||
|
DingTalk("3"), |
||||
|
/** |
||||
|
* 企业微信 |
||||
|
*/ |
||||
|
WeChatCom("4"); |
||||
|
|
||||
|
private final String value; |
||||
|
} |
||||
@ -0,0 +1,26 @@ |
|||||
|
package com.thing.common.core.enumeration; |
||||
|
|
||||
|
import lombok.AllArgsConstructor; |
||||
|
import lombok.Getter; |
||||
|
|
||||
|
/** |
||||
|
* 订单状态 |
||||
|
*/ |
||||
|
@Getter |
||||
|
@AllArgsConstructor |
||||
|
public enum OrderStatus { |
||||
|
/** |
||||
|
* 已取消 |
||||
|
*/ |
||||
|
CANCEL(-1), |
||||
|
/** |
||||
|
* 等待付款 |
||||
|
*/ |
||||
|
WAITING(0), |
||||
|
/** |
||||
|
* 已完成 |
||||
|
*/ |
||||
|
FINISH(1); |
||||
|
|
||||
|
private final int value; |
||||
|
} |
||||
@ -0,0 +1,25 @@ |
|||||
|
package com.thing.common.core.enumeration; |
||||
|
|
||||
|
import lombok.AllArgsConstructor; |
||||
|
import lombok.Getter; |
||||
|
|
||||
|
import java.util.Arrays; |
||||
|
|
||||
|
@Getter |
||||
|
@AllArgsConstructor |
||||
|
public enum PeakValleyEnum { |
||||
|
RUSH("rush", "尖"), |
||||
|
PEAK("peak", "峰"), |
||||
|
VALLEY("valley", "谷"), |
||||
|
NORMAL("normal", "平"); |
||||
|
|
||||
|
private final String code; |
||||
|
private final String name; |
||||
|
|
||||
|
public static PeakValleyEnum match(String keyword) { |
||||
|
return Arrays.stream(PeakValleyEnum.values()) |
||||
|
.filter(item -> keyword.contains(item.code)) |
||||
|
.findFirst() |
||||
|
.orElse(null); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,22 @@ |
|||||
|
package com.thing.common.core.enumeration; |
||||
|
|
||||
|
import lombok.AllArgsConstructor; |
||||
|
import lombok.Getter; |
||||
|
|
||||
|
/** |
||||
|
* 字段是否需要关联权限 |
||||
|
*/ |
||||
|
@Getter |
||||
|
@AllArgsConstructor |
||||
|
public enum PermissionStatus { |
||||
|
/** |
||||
|
* 附带权限字段 |
||||
|
*/ |
||||
|
PERMISSION("0"), |
||||
|
/** |
||||
|
* 不附带权限字段 |
||||
|
*/ |
||||
|
NO_PERMISSION("1"); |
||||
|
|
||||
|
private final String status; |
||||
|
} |
||||
@ -0,0 +1,31 @@ |
|||||
|
package com.thing.common.core.enumeration; |
||||
|
|
||||
|
import lombok.AllArgsConstructor; |
||||
|
import lombok.Getter; |
||||
|
|
||||
|
/** |
||||
|
* 协议 |
||||
|
*/ |
||||
|
@Getter |
||||
|
@AllArgsConstructor |
||||
|
public enum Protocol { |
||||
|
/** |
||||
|
* http |
||||
|
*/ |
||||
|
HTTP("http"), |
||||
|
/** |
||||
|
* https |
||||
|
*/ |
||||
|
HTTPS("https"), |
||||
|
/** |
||||
|
* ws |
||||
|
*/ |
||||
|
WS("ws"), |
||||
|
/** |
||||
|
* tcp |
||||
|
*/ |
||||
|
TCP("tcp"); |
||||
|
|
||||
|
private final String value; |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,25 @@ |
|||||
|
package com.thing.common.core.enumeration; |
||||
|
|
||||
|
import lombok.AllArgsConstructor; |
||||
|
import lombok.Getter; |
||||
|
|
||||
|
/** |
||||
|
* tb api支持的时间粒度,请不要随便新增,若要新增其他方式请@author chenyang |
||||
|
*/ |
||||
|
@Getter |
||||
|
@AllArgsConstructor |
||||
|
public enum ProtocolPrefix { |
||||
|
// http协议 |
||||
|
HTTP("http://"), |
||||
|
|
||||
|
// https协议 |
||||
|
HTTPS("https://"), |
||||
|
|
||||
|
// ws协议 |
||||
|
WS("ws://"), |
||||
|
|
||||
|
// tcp协议 |
||||
|
TCP("tcp://"); |
||||
|
|
||||
|
private final String prefix; |
||||
|
} |
||||
@ -0,0 +1,22 @@ |
|||||
|
package com.thing.common.core.enumeration; |
||||
|
|
||||
|
import lombok.AllArgsConstructor; |
||||
|
import lombok.Getter; |
||||
|
|
||||
|
/** |
||||
|
* 推送接收的状态 |
||||
|
*/ |
||||
|
@Getter |
||||
|
@AllArgsConstructor |
||||
|
public enum PushReceiveStatus { |
||||
|
/** |
||||
|
* 已接收确认 |
||||
|
*/ |
||||
|
RECEIVE("0"), |
||||
|
/** |
||||
|
* 未接收确认 |
||||
|
*/ |
||||
|
NO_RECEIVE("1"); |
||||
|
|
||||
|
private final String status; |
||||
|
} |
||||
@ -0,0 +1,22 @@ |
|||||
|
package com.thing.common.core.enumeration; |
||||
|
|
||||
|
import lombok.AllArgsConstructor; |
||||
|
import lombok.Getter; |
||||
|
|
||||
|
/** |
||||
|
* 推送状态 |
||||
|
*/ |
||||
|
@Getter |
||||
|
@AllArgsConstructor |
||||
|
public enum PushStatus { |
||||
|
/** |
||||
|
* 成功 |
||||
|
*/ |
||||
|
SUCCESS("0"), |
||||
|
/** |
||||
|
* 失败 |
||||
|
*/ |
||||
|
FAIL("1"); |
||||
|
|
||||
|
private final String status; |
||||
|
} |
||||
@ -0,0 +1,12 @@ |
|||||
|
package com.thing.common.core.enumeration; |
||||
|
|
||||
|
public enum QueryChannel { |
||||
|
/** |
||||
|
* 从TB中查 |
||||
|
*/ |
||||
|
QUERY_FROM_TB, |
||||
|
/** |
||||
|
* 从DB中查 |
||||
|
*/ |
||||
|
QUERY_FROM_DB; |
||||
|
} |
||||
@ -0,0 +1,24 @@ |
|||||
|
package com.thing.common.core.enumeration; |
||||
|
|
||||
|
public enum QueueEventType { |
||||
|
/** |
||||
|
* 缓存 |
||||
|
*/ |
||||
|
CACHE, |
||||
|
/** |
||||
|
* 告警 |
||||
|
*/ |
||||
|
ALARM, |
||||
|
/** |
||||
|
* 计算 |
||||
|
*/ |
||||
|
CALCULATION, |
||||
|
/** |
||||
|
* 看板 |
||||
|
*/ |
||||
|
SOCKET, |
||||
|
/** |
||||
|
* 设备 |
||||
|
*/ |
||||
|
DEVICE |
||||
|
} |
||||
@ -0,0 +1,35 @@ |
|||||
|
package com.thing.common.core.enumeration; |
||||
|
|
||||
|
/** |
||||
|
* 数据来源 |
||||
|
*/ |
||||
|
public enum QueueOriginType { |
||||
|
/** |
||||
|
* mqtt broker |
||||
|
*/ |
||||
|
MQTT_BROKER, |
||||
|
/** |
||||
|
* mqtt client |
||||
|
*/ |
||||
|
MQTT_CLIENT, |
||||
|
/** |
||||
|
* api |
||||
|
*/ |
||||
|
API, |
||||
|
/** |
||||
|
* socket订阅tb |
||||
|
*/ |
||||
|
TB, |
||||
|
/** |
||||
|
* modbus tcp |
||||
|
*/ |
||||
|
MODBUS_TCP, |
||||
|
/** |
||||
|
* 自动数据同步 系统或socket关闭重启后同步 |
||||
|
*/ |
||||
|
AUTO_DATA_SYNC, |
||||
|
/** |
||||
|
* 手动数据同步 保存缓存设置或缓存查询点击同步按钮 |
||||
|
*/ |
||||
|
MANUAL_DATA_SYNC |
||||
|
} |
||||
@ -0,0 +1,23 @@ |
|||||
|
|
||||
|
|
||||
|
package com.thing.common.core.enumeration; |
||||
|
|
||||
|
import lombok.AllArgsConstructor; |
||||
|
|
||||
|
/** |
||||
|
* 叶子节点枚举 |
||||
|
* |
||||
|
* @author Mark sunlightcs@gmail.com |
||||
|
*/ |
||||
|
@AllArgsConstructor |
||||
|
|
||||
|
public enum RegionLeafEnum { |
||||
|
YES(1), |
||||
|
NO(0); |
||||
|
|
||||
|
private final int value; |
||||
|
|
||||
|
public int value() { |
||||
|
return this.value; |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,22 @@ |
|||||
|
|
||||
|
|
||||
|
package com.thing.common.core.enumeration; |
||||
|
|
||||
|
import lombok.AllArgsConstructor; |
||||
|
|
||||
|
/** |
||||
|
* 行政区域 级别枚举 |
||||
|
* |
||||
|
* @author Mark sunlightcs@gmail.com |
||||
|
*/ |
||||
|
@AllArgsConstructor |
||||
|
public enum RegionLevelEnum { |
||||
|
ONE(1), |
||||
|
TWO(2), |
||||
|
THREE(3); |
||||
|
|
||||
|
private final int value; |
||||
|
public int value() { |
||||
|
return this.value; |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,22 @@ |
|||||
|
package com.thing.common.core.enumeration; |
||||
|
|
||||
|
import lombok.AllArgsConstructor; |
||||
|
import lombok.Getter; |
||||
|
|
||||
|
/** |
||||
|
* 开启关闭重复推送 |
||||
|
*/ |
||||
|
@Getter |
||||
|
@AllArgsConstructor |
||||
|
public enum RepeatPushStatus { |
||||
|
/** |
||||
|
* 开启 |
||||
|
*/ |
||||
|
ON("0"), |
||||
|
/** |
||||
|
* 关闭 |
||||
|
*/ |
||||
|
OFF("1"); |
||||
|
|
||||
|
private final String status; |
||||
|
} |
||||
@ -0,0 +1,40 @@ |
|||||
|
package com.thing.common.core.enumeration; |
||||
|
|
||||
|
import lombok.AllArgsConstructor; |
||||
|
import lombok.Getter; |
||||
|
import org.apache.commons.lang3.StringUtils; |
||||
|
|
||||
|
import java.util.Arrays; |
||||
|
|
||||
|
/** |
||||
|
* 导出文件类型 |
||||
|
*/ |
||||
|
@Getter |
||||
|
@AllArgsConstructor |
||||
|
public enum ReportTypeEnum { |
||||
|
/** |
||||
|
* 监控实时分析列表 |
||||
|
*/ |
||||
|
MONITORING("1", "监控实时分析列表"), |
||||
|
/** |
||||
|
* 用量分析列表 |
||||
|
*/ |
||||
|
DOSAGE("2", "用量分析列表"), |
||||
|
/** |
||||
|
* 数据报表 |
||||
|
*/ |
||||
|
DATAREPORT("3", "数据报表"); |
||||
|
|
||||
|
private final String code; |
||||
|
|
||||
|
private final String desc; |
||||
|
|
||||
|
|
||||
|
public static ReportTypeEnum getReportType(String code) { |
||||
|
return Arrays.stream(ReportTypeEnum.values()) |
||||
|
.filter(item -> StringUtils.equals(code, item.getCode())) |
||||
|
.findFirst() |
||||
|
.orElseThrow(() -> new RuntimeException("未找到对应数据")); |
||||
|
} |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,26 @@ |
|||||
|
package com.thing.common.core.enumeration; |
||||
|
|
||||
|
import lombok.AllArgsConstructor; |
||||
|
import lombok.Getter; |
||||
|
|
||||
|
/** |
||||
|
* 角色类型 |
||||
|
*/ |
||||
|
@Getter |
||||
|
@AllArgsConstructor |
||||
|
public enum RoleType { |
||||
|
/** |
||||
|
* 企业角色 |
||||
|
*/ |
||||
|
COMPANY("0"), |
||||
|
/** |
||||
|
* 用户角色 |
||||
|
*/ |
||||
|
USER("1"), |
||||
|
/** |
||||
|
* 默认角色 |
||||
|
*/ |
||||
|
DEFAULT("2"); |
||||
|
|
||||
|
private final String value; |
||||
|
} |
||||
@ -0,0 +1,12 @@ |
|||||
|
package com.thing.common.core.enumeration; |
||||
|
|
||||
|
import lombok.AllArgsConstructor; |
||||
|
import lombok.Getter; |
||||
|
|
||||
|
@Getter |
||||
|
@AllArgsConstructor |
||||
|
public enum RsaKeyType { |
||||
|
PUBLIC("public"), |
||||
|
PRIVATE("private"); |
||||
|
private final String value; |
||||
|
} |
||||
@ -0,0 +1,22 @@ |
|||||
|
package com.thing.common.core.enumeration; |
||||
|
|
||||
|
import lombok.AllArgsConstructor; |
||||
|
import lombok.Getter; |
||||
|
|
||||
|
/** |
||||
|
* 定时任务状态 |
||||
|
*/ |
||||
|
@Getter |
||||
|
@AllArgsConstructor |
||||
|
public enum ScheduleStatus { |
||||
|
/** |
||||
|
* 暂停 |
||||
|
*/ |
||||
|
PAUSE(0), |
||||
|
/** |
||||
|
* 正常 |
||||
|
*/ |
||||
|
NORMAL(1); |
||||
|
|
||||
|
private final int value; |
||||
|
} |
||||
@ -0,0 +1,22 @@ |
|||||
|
package com.thing.common.core.enumeration; |
||||
|
|
||||
|
import lombok.AllArgsConstructor; |
||||
|
import lombok.Getter; |
||||
|
|
||||
|
/** |
||||
|
* 数据源是否展示初值终值 |
||||
|
*/ |
||||
|
@Getter |
||||
|
@AllArgsConstructor |
||||
|
public enum ShowStatus { |
||||
|
/** |
||||
|
* 展示 |
||||
|
*/ |
||||
|
TRUE("0"), |
||||
|
/** |
||||
|
* 不展示 |
||||
|
*/ |
||||
|
FALSE("1"); |
||||
|
|
||||
|
private final String showStatus; |
||||
|
} |
||||
@ -0,0 +1,98 @@ |
|||||
|
package com.thing.common.core.enumeration; |
||||
|
|
||||
|
import lombok.AllArgsConstructor; |
||||
|
import lombok.Getter; |
||||
|
|
||||
|
import java.math.BigDecimal; |
||||
|
import java.util.*; |
||||
|
import java.util.stream.Collectors; |
||||
|
|
||||
|
@Getter |
||||
|
@AllArgsConstructor |
||||
|
public enum SignEnum { |
||||
|
GT(">", "大于", "<=", SignTypeEnum.RELATION), |
||||
|
GE(">=", "大于等于", "<", SignTypeEnum.RELATION), |
||||
|
LT("<", "小于", ">=", SignTypeEnum.RELATION), |
||||
|
LE("<=", "小于等于", ">", SignTypeEnum.RELATION), |
||||
|
EQ("=", "等于", "=", SignTypeEnum.RELATION), |
||||
|
DEQ("==", "等于", "==", SignTypeEnum.RELATION), |
||||
|
AND("&", "与", "|", SignTypeEnum.LOGIC), |
||||
|
DAND("&&", "短路与", "||", SignTypeEnum.LOGIC), |
||||
|
OR("|", "或", "&", SignTypeEnum.LOGIC), |
||||
|
DOR("||", "短路或", "&&", SignTypeEnum.LOGIC), |
||||
|
PLUS("+", "加", "-", SignTypeEnum.OPERATOR), |
||||
|
MINUS("-", "减", "+", SignTypeEnum.OPERATOR), |
||||
|
MULTIPLY("*", "乘", "/", SignTypeEnum.OPERATOR), |
||||
|
DIVIDE("/", "除", "*", SignTypeEnum.OPERATOR), |
||||
|
LB("(", "左侧小括号", ")", SignTypeEnum.BRACKETS), |
||||
|
RB(")", "右侧小括号", "(", SignTypeEnum.BRACKETS); |
||||
|
|
||||
|
private final String val; |
||||
|
private final String name; |
||||
|
private final String inverseSign; |
||||
|
private final SignTypeEnum type; |
||||
|
|
||||
|
public static SignEnum match(String val) { |
||||
|
return Arrays.stream(SignEnum.values()) |
||||
|
.filter(item -> Objects.equals(item.getVal(), val)) |
||||
|
.findFirst() |
||||
|
.orElse(null); |
||||
|
} |
||||
|
|
||||
|
public static List<SignEnum> noBracketsSigns() { |
||||
|
return Arrays.stream(SignEnum.values()) |
||||
|
.filter(SignEnum::isNotBrackets) |
||||
|
.collect(Collectors.toList()); |
||||
|
} |
||||
|
|
||||
|
public boolean isNotBrackets() { |
||||
|
return type != SignTypeEnum.BRACKETS; |
||||
|
} |
||||
|
|
||||
|
/** 获取逆向符号 */ |
||||
|
public SignEnum getInverseSign() { |
||||
|
return match(inverseSign); |
||||
|
} |
||||
|
|
||||
|
public List<SignEnum> getSubSigns() { |
||||
|
return switch (this) { |
||||
|
case GE -> Arrays.asList(GE, GT, EQ); |
||||
|
case LE -> Arrays.asList(LE, LT, EQ); |
||||
|
default -> List.of(this); |
||||
|
}; |
||||
|
} |
||||
|
|
||||
|
public List<String> getSubSignStr() { |
||||
|
List<SignEnum> subSigns = getSubSigns(); |
||||
|
return subSigns.stream().map(SignEnum::getVal).collect(Collectors.toList()); |
||||
|
} |
||||
|
|
||||
|
public boolean compare(String v1, String v2) { |
||||
|
Double t1 = Double.parseDouble(v1); |
||||
|
Double t2 = Double.parseDouble(v2); |
||||
|
return compare(t1, t2); |
||||
|
} |
||||
|
|
||||
|
public boolean compare(Double v1, Double v2) { |
||||
|
BigDecimal t1 = BigDecimal.valueOf(v1); |
||||
|
BigDecimal t2 = BigDecimal.valueOf(v2); |
||||
|
return compare(t1, t2); |
||||
|
} |
||||
|
|
||||
|
public boolean compare(BigDecimal v1, BigDecimal v2) { |
||||
|
int res = v1.compareTo(v2); |
||||
|
return switch (this) { |
||||
|
case GT -> res > 0; |
||||
|
case GE -> res >= 0; |
||||
|
case LT -> res < 0; |
||||
|
case LE -> res <= 0; |
||||
|
case EQ, DEQ -> res == 0; |
||||
|
default -> false; |
||||
|
}; |
||||
|
} |
||||
|
|
||||
|
public static SignEnum combineSign(SignEnum signA, SignEnum signB) { |
||||
|
String combineSign = signA.getVal() + signB.getVal(); |
||||
|
return match(combineSign); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,15 @@ |
|||||
|
package com.thing.common.core.enumeration; |
||||
|
|
||||
|
import lombok.AllArgsConstructor; |
||||
|
import lombok.Getter; |
||||
|
|
||||
|
@Getter |
||||
|
@AllArgsConstructor |
||||
|
public enum SignTypeEnum { |
||||
|
RELATION("关系运算符"), |
||||
|
LOGIC("逻辑连结符"), |
||||
|
OPERATOR("数值计算操作符"), |
||||
|
BRACKETS("括号"); |
||||
|
|
||||
|
private final String name; |
||||
|
} |
||||
@ -0,0 +1,29 @@ |
|||||
|
package com.thing.common.core.enumeration; |
||||
|
|
||||
|
/** |
||||
|
* 短信服务商 |
||||
|
*/ |
||||
|
public enum SmsService { |
||||
|
/** |
||||
|
* 阿里云 |
||||
|
*/ |
||||
|
ALIYUN(1), |
||||
|
/** |
||||
|
* 腾讯云 |
||||
|
*/ |
||||
|
QCLOUD(2), |
||||
|
/** |
||||
|
* 七牛 |
||||
|
*/ |
||||
|
QINIU(3); |
||||
|
|
||||
|
private int value; |
||||
|
|
||||
|
SmsService(int value) { |
||||
|
this.value = value; |
||||
|
} |
||||
|
|
||||
|
public int getValue() { |
||||
|
return value; |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,12 @@ |
|||||
|
package com.thing.common.core.enumeration; |
||||
|
|
||||
|
public enum SocketEventType { |
||||
|
/** |
||||
|
* 客户端操作事件 |
||||
|
*/ |
||||
|
CLIENT, |
||||
|
/** |
||||
|
* 设备操作事件 |
||||
|
*/ |
||||
|
DEVICE |
||||
|
} |
||||
@ -0,0 +1,17 @@ |
|||||
|
package com.thing.common.core.enumeration; |
||||
|
|
||||
|
import lombok.AllArgsConstructor; |
||||
|
import lombok.Getter; |
||||
|
|
||||
|
/** |
||||
|
* 数据源状态 |
||||
|
*/ |
||||
|
@Getter |
||||
|
@AllArgsConstructor |
||||
|
public enum SourceStatus { |
||||
|
ENABLE(1), |
||||
|
|
||||
|
DISABLE(0); |
||||
|
|
||||
|
private final Integer status; |
||||
|
} |
||||
@ -0,0 +1,20 @@ |
|||||
|
package com.thing.common.core.enumeration; |
||||
|
|
||||
|
import lombok.AllArgsConstructor; |
||||
|
import lombok.Getter; |
||||
|
|
||||
|
/** |
||||
|
* 订阅状态 |
||||
|
*/ |
||||
|
@Getter |
||||
|
@AllArgsConstructor |
||||
|
public enum SubscribeStatusEnum { |
||||
|
/** |
||||
|
* 订阅 |
||||
|
*/ |
||||
|
SUBSCRIBE, |
||||
|
/** |
||||
|
* 取消订阅 |
||||
|
*/ |
||||
|
UNSUBSCRIBE |
||||
|
} |
||||
@ -0,0 +1,27 @@ |
|||||
|
|
||||
|
|
||||
|
package com.thing.common.core.enumeration; |
||||
|
|
||||
|
import lombok.AllArgsConstructor; |
||||
|
|
||||
|
/** |
||||
|
* 超级管理员枚举 |
||||
|
* |
||||
|
* @author Mark sunlightcs@gmail.com |
||||
|
* @since 1.0.0 |
||||
|
*/ |
||||
|
@AllArgsConstructor |
||||
|
public enum SuperAdminEnum { |
||||
|
YES(1), |
||||
|
NO(0); |
||||
|
|
||||
|
private final int value; |
||||
|
|
||||
|
public int value() { |
||||
|
return this.value; |
||||
|
} |
||||
|
|
||||
|
public static boolean isSuperAdmin(int code){ |
||||
|
return code == YES.value; |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,22 @@ |
|||||
|
|
||||
|
|
||||
|
package com.thing.common.core.enumeration; |
||||
|
|
||||
|
import lombok.AllArgsConstructor; |
||||
|
|
||||
|
/** |
||||
|
* 租户管理员枚举 |
||||
|
* |
||||
|
* @author Mark sunlightcs@gmail.com |
||||
|
*/ |
||||
|
@AllArgsConstructor |
||||
|
public enum SuperTenantEnum { |
||||
|
YES(1), |
||||
|
NO(0); |
||||
|
|
||||
|
private final int value; |
||||
|
|
||||
|
public int value() { |
||||
|
return this.value; |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,22 @@ |
|||||
|
package com.thing.common.core.enumeration; |
||||
|
|
||||
|
import lombok.AllArgsConstructor; |
||||
|
import lombok.Getter; |
||||
|
|
||||
|
/** |
||||
|
* 模板属性与物属性的关系类型 |
||||
|
*/ |
||||
|
@Getter |
||||
|
@AllArgsConstructor |
||||
|
public enum SyncUpdateEnum { |
||||
|
/** |
||||
|
* 同步 |
||||
|
*/ |
||||
|
SYNC("sync"), |
||||
|
/** |
||||
|
* 更新 |
||||
|
*/ |
||||
|
UPDATE("update"); |
||||
|
|
||||
|
private final String value; |
||||
|
} |
||||
@ -0,0 +1,22 @@ |
|||||
|
|
||||
|
|
||||
|
package com.thing.common.core.enumeration; |
||||
|
|
||||
|
import lombok.AllArgsConstructor; |
||||
|
|
||||
|
/** |
||||
|
* 系统租户枚举 |
||||
|
* |
||||
|
* @author Mark sunlightcs@gmail.com |
||||
|
*/ |
||||
|
@AllArgsConstructor |
||||
|
public enum SysTenantEnum { |
||||
|
YES(1), |
||||
|
NO(0); |
||||
|
|
||||
|
private final int value; |
||||
|
|
||||
|
public int value() { |
||||
|
return this.value; |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,26 @@ |
|||||
|
package com.thing.common.core.enumeration; |
||||
|
|
||||
|
import lombok.AllArgsConstructor; |
||||
|
import lombok.Getter; |
||||
|
|
||||
|
/** |
||||
|
* 定时类型 |
||||
|
*/ |
||||
|
@Getter |
||||
|
@AllArgsConstructor |
||||
|
public enum TaskTime { |
||||
|
/** |
||||
|
* 时 |
||||
|
*/ |
||||
|
hh("时"), |
||||
|
/** |
||||
|
* 分 |
||||
|
*/ |
||||
|
mm("分"), |
||||
|
/** |
||||
|
* 秒 |
||||
|
*/ |
||||
|
ss("秒"); |
||||
|
|
||||
|
private final String name; |
||||
|
} |
||||
@ -0,0 +1,34 @@ |
|||||
|
package com.thing.common.core.enumeration; |
||||
|
|
||||
|
import lombok.AllArgsConstructor; |
||||
|
import lombok.Getter; |
||||
|
|
||||
|
/** |
||||
|
* 定时类型 |
||||
|
*/ |
||||
|
@Getter |
||||
|
@AllArgsConstructor |
||||
|
public enum TaskTimeType { |
||||
|
/** |
||||
|
* 定时 |
||||
|
*/ |
||||
|
TIME("定时"), |
||||
|
/** |
||||
|
* 每日 |
||||
|
*/ |
||||
|
DAY("每日"), |
||||
|
/** |
||||
|
* 每周 |
||||
|
*/ |
||||
|
WEEK("每周"), |
||||
|
/** |
||||
|
* 轮询 |
||||
|
*/ |
||||
|
POLLING("轮询"), |
||||
|
/** |
||||
|
* CRON |
||||
|
*/ |
||||
|
CRON("CRON"); |
||||
|
|
||||
|
private final String name; |
||||
|
} |
||||
Some files were not shown because too many files changed in this diff
Write
Preview
Loading…
Cancel
Save
Reference in new issue