初次提交
This commit is contained in:
152
common-tools/pom.xml
Normal file
152
common-tools/pom.xml
Normal file
@ -0,0 +1,152 @@
|
||||
<?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">
|
||||
<parent>
|
||||
<artifactId>ho-cloud</artifactId>
|
||||
<groupId>com.hoenergy</groupId>
|
||||
<version>1.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>common-tools</artifactId>
|
||||
<properties>
|
||||
<maven.compiler.source>8</maven.compiler.source>
|
||||
<maven.compiler.target>8</maven.compiler.target>
|
||||
<java.version>1.8</java.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<!--Lombok-->
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
</dependency>
|
||||
<!-- skywalking 整合 logback -->
|
||||
<!--<dependency>
|
||||
<groupId>org.apache.skywalking</groupId>
|
||||
<artifactId>apm-toolkit-logback-1.x</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.skywalking</groupId>
|
||||
<artifactId>apm-toolkit-trace</artifactId>
|
||||
</dependency>-->
|
||||
<!--加入servlet依赖(servlet的jar)-->
|
||||
<dependency>
|
||||
<groupId>javax.servlet</groupId>
|
||||
<artifactId>javax.servlet-api</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<!--可以让springboot 识别bootstrap.yml-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-context</artifactId>
|
||||
</dependency>
|
||||
<!--添加fastjson-->
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>fastjson</artifactId>
|
||||
</dependency>
|
||||
<!--jackson-->
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-core</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-databind</artifactId>
|
||||
</dependency>
|
||||
<!--hutool-->
|
||||
<dependency>
|
||||
<groupId>cn.hutool</groupId>
|
||||
<artifactId>hutool-all</artifactId>
|
||||
</dependency>
|
||||
<!--Redis-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-data-redis</artifactId>
|
||||
</dependency>
|
||||
<!--commons-pool2 Lettuce连接池会用到-->
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-pool2</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.session</groupId>
|
||||
<artifactId>spring-session-data-redis</artifactId>
|
||||
</dependency>
|
||||
<!-- 分页插件 -->
|
||||
<dependency>
|
||||
<groupId>com.github.pagehelper</groupId>
|
||||
<artifactId>pagehelper-spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-aop</artifactId>
|
||||
</dependency>
|
||||
<!--swagger-->
|
||||
<dependency>
|
||||
<groupId>io.springfox</groupId>
|
||||
<artifactId>springfox-swagger2</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.springfox</groupId>
|
||||
<artifactId>springfox-swagger-ui</artifactId>
|
||||
</dependency>
|
||||
<!--校验validator-->
|
||||
<dependency>
|
||||
<groupId>org.hibernate.validator</groupId>
|
||||
<artifactId>hibernate-validator</artifactId>
|
||||
</dependency>
|
||||
<!-- aes加密工具 -->
|
||||
<dependency>
|
||||
<groupId>commons-codec</groupId>
|
||||
<artifactId>commons-codec</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-lang</groupId>
|
||||
<artifactId>commons-lang</artifactId>
|
||||
<version>2.6</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<!--引入easyExcel-->
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>easyexcel</artifactId>
|
||||
<version>3.2.1</version>
|
||||
</dependency>
|
||||
<!--阿里云短信服务(java异步)-->
|
||||
<dependency>
|
||||
<groupId>com.aliyun</groupId>
|
||||
<artifactId>alibabacloud-dysmsapi20170525</artifactId>
|
||||
<version>2.0.24</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.minio</groupId>
|
||||
<artifactId>minio</artifactId>
|
||||
<!--<version>7.1.0</version>-->
|
||||
<version>8.4.4</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>com.squareup.okhttp3</groupId>
|
||||
<artifactId>okhttp</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.googlecode.aviator</groupId>
|
||||
<artifactId>aviator</artifactId>
|
||||
<version>5.3.3</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.googlecode.aviator</groupId>
|
||||
<artifactId>aviator</artifactId>
|
||||
<version>5.3.3</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-web</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
|
||||
</project>
|
||||
@ -0,0 +1,14 @@
|
||||
package com.ho.common.tools.annotation;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
/**
|
||||
* 大屏的专用token
|
||||
* 一般用于大屏这种不过期的
|
||||
*/
|
||||
@Target(ElementType.METHOD)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Documented
|
||||
public @interface CommonLargeScreenToken {
|
||||
|
||||
}
|
||||
@ -0,0 +1,13 @@
|
||||
package com.ho.common.tools.annotation;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
/**
|
||||
* 按钮权限校验自定义注解
|
||||
*/
|
||||
@Target(ElementType.METHOD)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Documented
|
||||
public @interface HzPermission {
|
||||
String[] value();
|
||||
}
|
||||
@ -0,0 +1,14 @@
|
||||
package com.ho.common.tools.annotation;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
/**
|
||||
* 大屏的专用token
|
||||
* 一般用于大屏这种不过期的
|
||||
*/
|
||||
@Target(ElementType.METHOD)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Documented
|
||||
public @interface LargeScreenToken {
|
||||
|
||||
}
|
||||
@ -0,0 +1,23 @@
|
||||
package com.ho.common.tools.annotation;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
/**
|
||||
* @ClassName: LogAnnotation
|
||||
* 自定义注解
|
||||
* @Author: fancl
|
||||
* @CreateDate: 2022/10/7 14:22
|
||||
* @UpdateUser:
|
||||
* @UpdateDate: 2019/10/7 14:22
|
||||
* @Version: 0.0.1
|
||||
*/
|
||||
@Target(ElementType.METHOD)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Documented
|
||||
public @interface LogAnnotation {
|
||||
/** 模块 */
|
||||
String title() default "";
|
||||
|
||||
/** 功能 */
|
||||
String action() default "";
|
||||
}
|
||||
@ -0,0 +1,13 @@
|
||||
package com.ho.common.tools.annotation;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
/**
|
||||
* 忽略token校验
|
||||
*/
|
||||
@Target(ElementType.METHOD)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Documented
|
||||
public @interface TokenIgnore {
|
||||
|
||||
}
|
||||
@ -0,0 +1,25 @@
|
||||
package com.ho.common.tools.config;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.boot.CommandLineRunner;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* 容器启动完成
|
||||
*/
|
||||
@Component
|
||||
public class ContainerStarted implements CommandLineRunner {
|
||||
//环境信息
|
||||
@Value("${spring.profiles.active}")
|
||||
private String env;
|
||||
|
||||
private Logger logger = LoggerFactory.getLogger(getClass());
|
||||
|
||||
@Override
|
||||
public void run(String... args) {
|
||||
logger.info(">>>>>>>>>>>>>>>容器启动完成<<<<<<<<<<<<<");
|
||||
logger.info(">>>>>>>>>>>>>>>当前环境: " + env);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,21 @@
|
||||
package com.ho.common.tools.config;
|
||||
|
||||
import cn.hutool.core.lang.Snowflake;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* @author fancl
|
||||
* @desc: Snowflake
|
||||
* @date 2022/8/18
|
||||
*/
|
||||
@Configuration
|
||||
public class IdConfig {
|
||||
|
||||
|
||||
//id生成器
|
||||
@Bean
|
||||
Snowflake snowflake(){
|
||||
return new Snowflake();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,53 @@
|
||||
package com.ho.common.tools.config;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import org.springframework.data.redis.serializer.RedisSerializer;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
/**
|
||||
* @ClassName: MyStringRedisSerializer
|
||||
* TODO:类文件简单描述
|
||||
* @Author: 小霍
|
||||
* @CreateDate: 2019/9/6 13:43
|
||||
* @UpdateUser: 小霍
|
||||
* @UpdateDate: 2019/9/6 13:43
|
||||
* @Version: 0.0.1
|
||||
*/
|
||||
public class MyStringRedisSerializer implements RedisSerializer<Object> {
|
||||
private final Charset charset;
|
||||
|
||||
public MyStringRedisSerializer() {
|
||||
this(StandardCharsets.UTF_8);
|
||||
}
|
||||
|
||||
public MyStringRedisSerializer(Charset charset) {
|
||||
Assert.notNull(charset, "Charset must not be null!");
|
||||
this.charset = charset;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String deserialize(byte[] bytes) {
|
||||
return (bytes == null ? null : new String(bytes, charset));
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] serialize(Object object) {
|
||||
if (object == null) {
|
||||
return new byte[0];
|
||||
}
|
||||
if(object instanceof String){
|
||||
return object.toString().getBytes(charset);
|
||||
}else {
|
||||
String string = JSON.toJSONString(object);
|
||||
return string.getBytes(charset);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,72 @@
|
||||
package com.ho.common.tools.config;
|
||||
|
||||
import com.alibaba.fastjson.support.spring.GenericFastJsonRedisSerializer;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.data.redis.connection.RedisConnectionFactory;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.data.redis.serializer.StringRedisSerializer;
|
||||
import org.springframework.session.data.redis.config.ConfigureRedisAction;
|
||||
|
||||
/**
|
||||
* @description redis配置
|
||||
*/
|
||||
@Configuration
|
||||
public class RedisConfig {
|
||||
// Lettuce 配置方式
|
||||
/*@Bean
|
||||
public RedisTemplate<String, Object> redisTemplate(RedisConnectionFactory factory) {
|
||||
RedisTemplate<String, Object> template = new RedisTemplate<>();
|
||||
template.setConnectionFactory(factory);
|
||||
|
||||
Jackson2JsonRedisSerializer jackson2JsonRedisSerializer = new Jackson2JsonRedisSerializer(Object.class);
|
||||
ObjectMapper om = new ObjectMapper();
|
||||
om.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY);
|
||||
//om.enableDefaultTyping(ObjectMapper.DefaultTyping.NON_FINAL);
|
||||
om.activateDefaultTyping(LaissezFaireSubTypeValidator.instance,
|
||||
ObjectMapper.DefaultTyping.NON_FINAL, JsonTypeInfo.As.PROPERTY);
|
||||
//om.disable(DeserializationFeature.FAIL_ON_INVALID_SUBTYPE);
|
||||
jackson2JsonRedisSerializer.setObjectMapper(om);
|
||||
|
||||
StringRedisSerializer stringRedisSerializer = new StringRedisSerializer();
|
||||
// key采用String的序列化方式
|
||||
template.setKeySerializer(stringRedisSerializer);
|
||||
// hash的key也采用String的序列化方式
|
||||
template.setHashKeySerializer(stringRedisSerializer);
|
||||
// value序列化方式采用jackson
|
||||
template.setValueSerializer(jackson2JsonRedisSerializer);
|
||||
// hash的value序列化方式采用jackson
|
||||
template.setHashValueSerializer(jackson2JsonRedisSerializer);
|
||||
template.afterPropertiesSet();
|
||||
|
||||
return template;
|
||||
}*/
|
||||
|
||||
@Bean
|
||||
public RedisTemplate<String, Object> redisTemplate(RedisConnectionFactory redisConnectionFactory) {
|
||||
RedisTemplate redisTemplate = new RedisTemplate<>();
|
||||
redisTemplate.setConnectionFactory(redisConnectionFactory);
|
||||
// String的序列化
|
||||
StringRedisSerializer stringRedisSerializer = new StringRedisSerializer();
|
||||
// json序列化配置
|
||||
GenericFastJsonRedisSerializer genericFastJsonRedisSerializer = new GenericFastJsonRedisSerializer();
|
||||
//key采用String的序列化方式
|
||||
redisTemplate.setKeySerializer(stringRedisSerializer);
|
||||
//hash的key也采用String 的序列化方式
|
||||
redisTemplate.setHashKeySerializer(stringRedisSerializer);
|
||||
//value的序列化方式采用jackson的方式
|
||||
redisTemplate.setValueSerializer(genericFastJsonRedisSerializer);
|
||||
//hash的value序列化方式采用jackson
|
||||
redisTemplate.setHashValueSerializer(genericFastJsonRedisSerializer);
|
||||
redisTemplate.afterPropertiesSet();
|
||||
return redisTemplate;
|
||||
}
|
||||
|
||||
//禁止自动配置redis
|
||||
@Bean
|
||||
public ConfigureRedisAction configureRedisAction() {
|
||||
return ConfigureRedisAction.NO_OP;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,997 @@
|
||||
package com.ho.common.tools.constant;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* @author fancl
|
||||
* @desc: 公共常量
|
||||
* @date 2022/8/18
|
||||
*/
|
||||
public interface CommonConstant {
|
||||
|
||||
//优先级
|
||||
String first = "first";
|
||||
//
|
||||
String value = "value";
|
||||
|
||||
//配置
|
||||
String CONFIG = "config";
|
||||
//MES文件
|
||||
String MES_FILE = "mesFile";
|
||||
//minin固定的桶
|
||||
String BUCKET = "filestore";
|
||||
//url
|
||||
String url = "/mqtt_async";
|
||||
|
||||
Integer NEGATIV_ONE = -1;
|
||||
|
||||
Integer ZERO = 0;
|
||||
Integer ONE = 1;
|
||||
Integer TWO = 2;
|
||||
Integer THREE = 3;
|
||||
Integer FOUR = 4;
|
||||
Integer FIVE = 5;
|
||||
Integer SIX = 6;
|
||||
Integer SEVEN = 7;
|
||||
Integer EIGHT = 8;
|
||||
Integer NINE = 9;
|
||||
Integer TEN = 10;
|
||||
Integer ELEVEN = 11;
|
||||
Integer TWELVE = 12;
|
||||
Integer THIRTEEN = 13;
|
||||
Integer FOURTEEN = 14;
|
||||
Integer FIFTEEN = 15;
|
||||
Integer SIXTEEN = 16;
|
||||
Integer EIGHTEEN = 18;
|
||||
Integer SIXTY = 60;
|
||||
Integer TWENTY_THREE = 23;
|
||||
Integer TWENTY_FOUR = 24;
|
||||
Integer TWENTYFIVE = 25;
|
||||
Integer THIRTY = 30;
|
||||
Integer FIFTY = 50;
|
||||
Integer FIVE_HUNDRED = 500;
|
||||
Integer TWO_HUNDRED = 200;
|
||||
Integer FIVE_HUNDRED_AND_ONE = 501;
|
||||
Integer THREE_THOUSAND_AND_FOUR_HUNDRED = 3400;
|
||||
Integer THREETHOUSAND = 3401;
|
||||
Integer NINE_HUNDRED_AND_NINETY_NINE = 999;
|
||||
|
||||
Integer HUNDRED = 100;
|
||||
String UTF_8 = "UTF-8";
|
||||
|
||||
Float F_TWO = 2.0f;
|
||||
|
||||
//顶层父ID
|
||||
Integer TOP_PARENT_ID = 0;
|
||||
|
||||
//删除标志位
|
||||
Integer DELETED_FLAG = 0;
|
||||
Integer DELETED = 1;
|
||||
|
||||
//遥信遥测标识
|
||||
String YX = "YX";
|
||||
String YC = "YC";
|
||||
|
||||
//状态标志位
|
||||
Integer STATUS_FLAG = 1;
|
||||
Integer STATUS = 0;
|
||||
|
||||
//菜单
|
||||
Integer MENU_FLAG = 2;
|
||||
//按钮
|
||||
Integer BUTTON_FLAG = 3;
|
||||
|
||||
String ROWS = "rows";// 运维页面数据类型
|
||||
String USAGEINFO = "usage_info";// 运维页面数据类型
|
||||
String DATA = "data"; //
|
||||
String LIST = "list"; //多条数据的都有这个
|
||||
|
||||
//header中 token的标识
|
||||
String ACCESS_TOKEN = "authorization";
|
||||
|
||||
//工单表示
|
||||
String WORK_ORDER = "workOrder";
|
||||
|
||||
//时间格式
|
||||
|
||||
String DATE = "yyyy-MM-dd HH:mm:ss";
|
||||
|
||||
//时间格式统一改为了 yyyy-MM-dd HH:mm:ss.SSS 2023-01-10 fan update
|
||||
//String MQTT_DATE = "yyyy-MM-dd/HH:mm:ss.SSS";
|
||||
String MQTT_DATE = "yyyy-MM-dd HH:mm:ss.SSS";
|
||||
|
||||
String DATE_YMD = "yyyy-MM-dd";
|
||||
|
||||
String DATE_YM = "yyyy-MM";
|
||||
|
||||
String DATE_Y = "yyyy";
|
||||
|
||||
String DATE_YMD_HMSS = "yyyy-MM-dd HH:mm:ss.SSS";
|
||||
|
||||
String DATE_YMD_HMS = "yyyyMMdd HH:mm:ss";
|
||||
|
||||
String DATEYMDHSS = "yyyyMMddHHmmssSSS";
|
||||
|
||||
String DATEYMDHS = "yyyyMMddHHmmss";
|
||||
|
||||
String DATE_PATH = "/yyyy/MM/dd";
|
||||
|
||||
String DATEYMD = "yyyyMMdd";
|
||||
|
||||
String DATA_DATE_YMD = "%Y-%m-%d";
|
||||
|
||||
String DATA_DATE_YM = "%Y-%m";
|
||||
|
||||
String DATA_DATE_Y = "%Y";
|
||||
|
||||
String DATE_Hms = "HH:mm:ss";
|
||||
|
||||
String DATE_Hm = "HH:mm";
|
||||
|
||||
String DATE_YMD_Hm = "yyyy-MM-dd HH:mm";
|
||||
|
||||
String DATE_YMD_H = "yyyy-MM-dd HH";
|
||||
|
||||
String ZERO_SECOND = ":00";
|
||||
String ZERO_SECOND_MINUTE_HOUR = " 00:00:00";
|
||||
|
||||
String FIFTY_NINE_SECOND = ":59";
|
||||
String FIFTY_NINE_SECOND_MINUTE_HOUR = "23:59:59";
|
||||
|
||||
String START_SUFFIX_TIMESTAMP = " 00:00:00";
|
||||
String END_SUFFIX_TIMESTAMP = " 23:59:59";
|
||||
|
||||
String START_TIMESTAMP = "-01";
|
||||
String MINUTES_SECONDS_BEGIN = ":00:00";
|
||||
String BEGIN_MINUTES_DAY = "00:00";
|
||||
String END_MINUTES_DAY = "24:00";
|
||||
String END_DAY = "23:59";
|
||||
String MINUTES_SECONDS_END = ":59:59";
|
||||
|
||||
String MILLI_SECONDS_END = ".999";
|
||||
String MILLI_SECONDS_START = ".000";
|
||||
//超时时间
|
||||
long timeoutMilliSeconds = 3000L;
|
||||
//5分钟毫秒数
|
||||
Long FIVE_MINUTE_MS = 300000L;
|
||||
|
||||
String JOIN = "_";
|
||||
|
||||
String BRACE = "{}";
|
||||
|
||||
//温湿度常量
|
||||
String TRANSMITTER = "rs-ws";
|
||||
|
||||
/**
|
||||
* 组织机构编码key
|
||||
*/
|
||||
String DEPT_KEY = "dept";
|
||||
/**
|
||||
* 角色编码key
|
||||
*/
|
||||
String ROLE_KEY = "role";
|
||||
|
||||
//超级管理员
|
||||
String SUPER_ROLE = "超级管理员";
|
||||
|
||||
//超级管理员,这个角色比较特殊,系统会进行特殊处理
|
||||
String SUPER_ROLE_CODE = "SUPER_ROLE";
|
||||
|
||||
//系统管理 (菜单名称)
|
||||
String SYS_MENU_NAME = "system";
|
||||
Integer SYS_MENU_Id = 28;
|
||||
|
||||
//菜单管理,字段name为 menu
|
||||
String PERMISSION_MENU_NAME = "menu";
|
||||
//菜单管理的id 用固定值
|
||||
Integer PERMISSION_MENU_ID = 10;
|
||||
String PICTURE_TYPE = "png,jpg";
|
||||
|
||||
//启用
|
||||
String IS_ENABLE = "启用";
|
||||
//禁用
|
||||
String NOT_IS_ENABlE = "禁用";
|
||||
|
||||
//特殊用户
|
||||
String SPECIAL_USER = "specialUser";
|
||||
|
||||
//运维人员
|
||||
String OPERATIONS_PERSON = "operationsPerson";
|
||||
|
||||
//公司调试人员
|
||||
String DEBUGGING_PERSONNEL = "debuggingPersonnel";
|
||||
|
||||
//演示用戶
|
||||
String DEMO_USER = "demoUser";
|
||||
|
||||
//上送数据
|
||||
String PUSH_DATA = "pushData";
|
||||
|
||||
//转发数据
|
||||
String FORWARD_DATA = "forwardData";
|
||||
|
||||
//方法
|
||||
String METHOD = "method";
|
||||
|
||||
//环境信息
|
||||
interface Env {
|
||||
//本地环境
|
||||
String DEV = "dev";
|
||||
//开发环境
|
||||
String EXP = "exp";
|
||||
//演示环境
|
||||
String TEST = "test";
|
||||
|
||||
}
|
||||
|
||||
//时间类型
|
||||
interface TimeType {
|
||||
//分钟
|
||||
String MINUTE = "minute";
|
||||
//小时
|
||||
String HOUR = "hour";
|
||||
//天
|
||||
String DAY = "day";
|
||||
//月
|
||||
String MONTH = "month";
|
||||
//年
|
||||
String YEAR = "year";
|
||||
|
||||
}
|
||||
|
||||
interface YC_VAULE_TYPE {
|
||||
|
||||
//充电
|
||||
Integer CHARGE = 1;
|
||||
//放电
|
||||
Integer DISCHARGE = 2;
|
||||
|
||||
}
|
||||
|
||||
//设备类型
|
||||
interface DEVICE {
|
||||
//未知
|
||||
Integer UNKNOWN_STATUS = 0;
|
||||
//正在连接
|
||||
Integer ON_CONNECTION_STATUS = 1;
|
||||
//连接超时
|
||||
Integer CONNECTION_TIMED_OUT_STATUS = 2;
|
||||
//连接保持
|
||||
Integer CONNECTION_HOLD_STATUS = 3;
|
||||
//开始升级
|
||||
Integer START_UPGRADE_STATUS = 4;
|
||||
//正在升级
|
||||
Integer UPGRADING_STATUS = 5;
|
||||
//升级完成
|
||||
Integer UPGRADE_COMPLETED = 6;
|
||||
}
|
||||
|
||||
|
||||
//菜单展示类型
|
||||
interface MenuShowType {
|
||||
//通用菜单
|
||||
String ALL = "all";
|
||||
//仅PC端展示
|
||||
String PC = "pc";
|
||||
//仅APP展示
|
||||
String APP = "app";
|
||||
//仅组态展示
|
||||
String CONFIG = "config";
|
||||
}
|
||||
|
||||
//能流图类型
|
||||
interface EnergyFlow {
|
||||
Integer electric = 1; //电
|
||||
Integer water = 2; //水
|
||||
Integer gas = 3;//燃气
|
||||
String emptyString = "";
|
||||
}
|
||||
|
||||
//告警类型
|
||||
interface EventType {
|
||||
Integer alarm = 1; //告警
|
||||
Integer soe = 2; //soe
|
||||
Integer manualOperation = 3; //人工操作
|
||||
Integer troubleshooting = 4; //故障处理
|
||||
Integer networkAnalysisWarning = 5; //网络分析预警
|
||||
}
|
||||
|
||||
//告警等级
|
||||
interface EventLevel {
|
||||
Integer accident = 1; //一级(事故)
|
||||
Integer abnormal = 2; //二级(故障)
|
||||
Integer overLimit = 3;//三级(告警)
|
||||
Integer statusChange = 4;//四级(提示)
|
||||
|
||||
Integer notice = 5;//五级(告知)
|
||||
}
|
||||
|
||||
//告警等级
|
||||
interface AlarmStatus {
|
||||
// 在线 1
|
||||
Integer onLine = 1;
|
||||
// 故障停机 2
|
||||
Integer faultShutdown = 2;
|
||||
// 离线 3
|
||||
Integer offline = 3;
|
||||
// 失联 4
|
||||
Integer Loss = 4;
|
||||
}
|
||||
|
||||
//告警转工单状态
|
||||
interface EventConversionStatus {
|
||||
Integer doNotConversion = 0;//不能转化
|
||||
Integer NotConversion = 1;//未转
|
||||
Integer Conversion = 2; //已转
|
||||
}
|
||||
|
||||
//告警信号
|
||||
interface EventSignal {
|
||||
//遥信
|
||||
Integer SIGNAL = 1;
|
||||
//遥测
|
||||
Integer TELEMETER = 2;
|
||||
}
|
||||
|
||||
//内置角色的前缀
|
||||
String SYS_INNER_ROLE_PREFIX = "INNER_";
|
||||
//内置的角色名,用于特殊业务处理
|
||||
//工单创建
|
||||
String ROLE_WORK_ORDER_CREATE = "INNER_WORK_ORDER_CREATE";
|
||||
//工单班长,用于分配工单
|
||||
String ROLE_WORK_ORDER_LEADER = "INNER_WORK_ORDER_LEADER";
|
||||
//工单维修
|
||||
String ROLE_WORK_ORDER_DO = "INNER_WORK_ORDER_DO";
|
||||
//其他的用户
|
||||
String ROLE_WORK_ORDER_OTHER = "INNER_WORK_ORDER_OTHER";
|
||||
|
||||
//电站类型
|
||||
Integer STATION_TYPE = 1;//电站类型设备
|
||||
|
||||
|
||||
//表示光伏界面统计下拉选择框 :
|
||||
String DAY = "day"; //天
|
||||
String HOUR = "hour"; //天
|
||||
String MONTH = "month";//yue
|
||||
String YEAR = "year"; //年
|
||||
String WEEK = "week"; //周
|
||||
String RANGE_TIME = "rangeTime";//范围时间
|
||||
|
||||
//更新时间
|
||||
String UPDATE_TIME = "updateTime";
|
||||
|
||||
//用户相关
|
||||
interface USER {
|
||||
//锁定状态
|
||||
Integer STATUS_LOCKING = 0;
|
||||
//正常状态
|
||||
Integer STATUS_NORMAL = 1;
|
||||
}
|
||||
|
||||
//pv_enegy_value表中的type属性值
|
||||
interface PV_ENERGY {
|
||||
//发电量
|
||||
Integer DAY_GENERATION = 1;
|
||||
//收益
|
||||
Integer DAY_REVENUE = 2;
|
||||
Integer MONTH_GENERATION = 3;
|
||||
Integer MONTH_REVENUE = 4;
|
||||
Integer YEAR_GENERATION = 5;
|
||||
Integer YEAR_REVENUE = 6;
|
||||
//桩日收益
|
||||
Integer PILE_DAY_INCOME = 7;
|
||||
//桩日充电量
|
||||
Integer PILE_DAY_CHARGE = 8;
|
||||
//桩尖日充电量
|
||||
Integer PILE_TIP_CHARGE = 9;
|
||||
//桩峰日充电量
|
||||
Integer PILE_PEAK_CHARGE = 10;
|
||||
//桩平日充电量
|
||||
Integer PILE_LEVEL_CHARGE = 11;
|
||||
//桩谷日充电量
|
||||
Integer PILE_VALLEY_CHARGE = 12;
|
||||
}
|
||||
|
||||
//电价的尖峰平谷类型
|
||||
interface ELEC_PRICES {
|
||||
String J = "J";
|
||||
String F = "F";
|
||||
String P = "P";
|
||||
String G = "G";
|
||||
}
|
||||
|
||||
//充电状态
|
||||
interface CHARGE_STATUS {
|
||||
Integer charging = 3;
|
||||
}
|
||||
|
||||
//碳足迹的冻结值
|
||||
//elec_meter_value表中的type属性值
|
||||
interface CARBON_FOOTPRINT {
|
||||
//储能空调(集装箱空调)1
|
||||
String ENERGY_EQUIPMENT_1 = "energy_equipment_1";
|
||||
Integer ENERGY_EQUIPMENT_1_TYPE = 1;
|
||||
//办公空调: 2,
|
||||
String ENERGY_EQUIPMENT_2 = "energy_equipment_2";
|
||||
Integer ENERGY_EQUIPMENT_2_TYPE = 2;
|
||||
//办公插座: 3
|
||||
String ENERGY_EQUIPMENT_3 = "energy_equipment_3";
|
||||
Integer ENERGY_EQUIPMENT_3_TYPE = 3;
|
||||
//办公照明: 4
|
||||
String ENERGY_EQUIPMENT_4 = "energy_equipment_4";
|
||||
Integer ENERGY_EQUIPMENT_4_TYPE = 4;
|
||||
//其它用电: 5
|
||||
String ENERGY_EQUIPMENT_5 = "energy_equipment_5";
|
||||
Integer ENERGY_EQUIPMENT_5_TYPE = 5;
|
||||
//办公用水: 6
|
||||
String ENERGY_EQUIPMENT_6 = "energy_equipment_6";
|
||||
Integer ENERGY_EQUIPMENT_6_TYPE = 6;
|
||||
//桩日充电量 : 7
|
||||
String ENERGY_EQUIPMENT_7 = "energy_equipment_7";
|
||||
Integer ENERGY_EQUIPMENT_7_TYPE = 7;
|
||||
}
|
||||
|
||||
//运行评价中的权重
|
||||
interface weight {
|
||||
Double CHARGING_AND_DISCHARGING = 0.2;
|
||||
Double COMPREHENSIVE_EFFICIENCY = 0.15;
|
||||
Double STATION_LECTRICITY_CONSUMPTION = 0.05;
|
||||
Double ENERGY_STORAGE_LOSS_RATE = 0.1;
|
||||
Double UNPLANNED_OUTAGE_FACTOR = 0.05;
|
||||
Double PLANT_AVAILABILITY_FACTOR = 0.05;
|
||||
Double DISPATCH_RESPONSE_SUCCESS_RATE = 0.15;
|
||||
Double STATION_UTILIZATION_POWER = 0.1;
|
||||
}
|
||||
|
||||
//碳足迹
|
||||
interface REDUCE_EMISSIONS {
|
||||
String STORAGE = "storage";//储能相关type
|
||||
String STORAGE_1 = "storage_1";//储能原材料重量
|
||||
String STORAGE_2 = "storage_2";//储能碳排放因子
|
||||
String STORAGE_3 = "storage_3";//储能运输公里数
|
||||
String STORAGE_4 = "storage_4";//储能运输碳排放因子;
|
||||
String STORAGE_5 = "storage_5";//储能运行碳排放因子;
|
||||
|
||||
String PV = "pv";//光伏
|
||||
String PV_1 = "pv_1";//光伏原材料重量
|
||||
String PV_2 = "pv_2";//光伏硬性碳排放因子
|
||||
String PV_3 = "pv_3";//光伏运输公里数
|
||||
String PV_4 = "pv_4";//光伏运输碳排放因子
|
||||
String PV_5 = "pv_5";//光伏运行耗能碳排放因子
|
||||
String PV_6 = "pv_6";//光伏碳收益碳排放因子
|
||||
|
||||
String CHARGEPILE = "chargepile";//充电桩
|
||||
String CHARGEPILE_1 = "chargepile_1";//充电桩原材料重量
|
||||
String CHARGEPILE_2 = "chargepile_2";//充电桩隐形碳排放因子
|
||||
String CHARGEPILE_3 = "chargepile_3";//充电桩运输公里数(公里)
|
||||
String CHARGEPILE_4 = "chargepile_4";//充电桩运输碳排放因子
|
||||
String CHARGEPILE_5 = "chargepile_5";//充电桩系统运行耗能碳排放因子
|
||||
String CHARGEPILE_6 = "chargepile_6";//充电桩碳收益碳排放因子
|
||||
|
||||
}
|
||||
|
||||
//能耗类型
|
||||
interface PARK_VALUE {
|
||||
Integer ELECTRIC_TYPE = 1;
|
||||
Integer WATER_TYPE = 2;
|
||||
Integer GAS_TYPE = 3;
|
||||
Integer TOTAL_TYPE = 4;
|
||||
}
|
||||
|
||||
//mqtt中的dataType枚举
|
||||
interface MQTT_DATATYPE {
|
||||
|
||||
//写参数
|
||||
Integer WRITE_REQUEST = 1;
|
||||
//读参数
|
||||
Integer READ_REQUEST = 2;
|
||||
//读所有参数
|
||||
Integer READ_ALL_REQUEST = 3;
|
||||
//平台响应(云端响应)
|
||||
Integer CLOUD_RESPONSE = 4;
|
||||
//平台下发报告
|
||||
Integer PUSH_REPORT = 5;
|
||||
//平台下发命令
|
||||
Integer PUSH_COMMAND = 7;
|
||||
//断开命令
|
||||
Integer DISCONNECT = 8;
|
||||
|
||||
//写参数响应
|
||||
Integer WRITE_RESPONSE = 101;
|
||||
//读参数响应
|
||||
Integer READ_RESPONSE = 102;
|
||||
|
||||
//定时上送
|
||||
Integer PUSH_TIMING = 104;
|
||||
//突发上送
|
||||
Integer BURST = 105;
|
||||
//Event突发上送 , 用于设备按产品模型中定义的格式将事件数据上报给平台
|
||||
Integer EVENT_PUSH = 106;
|
||||
//边端的心跳检测
|
||||
Integer HEARTBEAT_DETECTION = 108;
|
||||
//文件服务
|
||||
Integer FILE_SERVICE = 200;
|
||||
//云端向边端读入文件
|
||||
Integer FILE_SERVICE_READ = 201;
|
||||
//云端向边端写入文件
|
||||
Integer FILE_SERVICE_WRITE = 202;
|
||||
//云端向边端删除文件
|
||||
Integer FILE_SERVICE_DELETE = 203;
|
||||
//云端向边端读取文件列表属性
|
||||
Integer FILE_SERVICE_ATTRIBUTE = 206;
|
||||
//云端向边端删除文件夹
|
||||
Integer FILE_SERVICE_DELETE_DIRECTORY = 208;
|
||||
//云端向边修改文件权限
|
||||
Integer FILE_SERVICE_MODIFY_PERMISSION = 209;
|
||||
}
|
||||
|
||||
//mqtt中的description枚举
|
||||
interface MQTT_DESCRIPTION {
|
||||
//正确
|
||||
String OK = "OK";
|
||||
//认证失败
|
||||
String AUTHENTICATION_FAILED = "AuthenticationFailed";
|
||||
//数据结构被破坏
|
||||
String STRUCTURE_CORRUPTED = "Structure Corrupted";
|
||||
//压缩包被破坏
|
||||
String COMPRESSED_PACKAGE_CORRUPTED = "Compressed Package Corrupted";
|
||||
//包含不对应的结构
|
||||
String UNDEFINED_STRUCTURES = "Undefined Structures";
|
||||
//目标不存在
|
||||
String TARGET_AVIRRABLE = "Target Avirrable";
|
||||
|
||||
//读取全部的cmdId后缀
|
||||
String ALL = "all";
|
||||
|
||||
}
|
||||
|
||||
//mqtt中的isZip枚举
|
||||
interface MQTT_ISZIP {
|
||||
//压缩
|
||||
Integer IS = 1;
|
||||
|
||||
//未压缩
|
||||
Integer NOT_IS = 0;
|
||||
}
|
||||
|
||||
//图片类型
|
||||
interface PICTURE {
|
||||
//电站
|
||||
Integer STATION = 1;
|
||||
//设备
|
||||
Integer DEVICE = 2;
|
||||
//工单
|
||||
Integer WORK_ORDER = 1;
|
||||
|
||||
//文件升级包
|
||||
Integer FILE_JAR = 4;
|
||||
|
||||
//logo
|
||||
Integer LOGO = 5;
|
||||
//文件
|
||||
Integer FIlE = 6;
|
||||
//缩略图
|
||||
Integer THUMBNAIL = 7;
|
||||
//pack充放电文件
|
||||
Integer PACK_FILE = 8;
|
||||
//整柜文件
|
||||
Integer CUPBOARD_FILE = 9;
|
||||
}
|
||||
|
||||
interface InverterQueryType {
|
||||
//电流
|
||||
Integer ELEC = 1;
|
||||
//电压
|
||||
Integer VOL = 2;
|
||||
//功率
|
||||
Integer POWER = 3;
|
||||
}
|
||||
|
||||
//设备模型类型枚举
|
||||
interface ModelDeviceType {
|
||||
//设备
|
||||
String DEVICE = "device";
|
||||
//模型
|
||||
String MODEL = "model";
|
||||
}
|
||||
|
||||
//通合驾驶舱数据
|
||||
interface TongHeCockpit {
|
||||
//光伏装机量
|
||||
BigDecimal PvCapacity = new BigDecimal(116000);
|
||||
//光伏累计发电量(基础值)
|
||||
BigDecimal PvPowerGeneration = new BigDecimal(1710000);
|
||||
//储能装机量
|
||||
BigDecimal EnergyCapacity = new BigDecimal(24000);
|
||||
//储能累计发电量
|
||||
BigDecimal EnergyPowerGeneration = new BigDecimal(12500000);
|
||||
//储能每日累计发电量
|
||||
BigDecimal DailyEnergyPowerGeneration = new BigDecimal(21000);
|
||||
//充电桩装机量
|
||||
BigDecimal ChargePileCapacity = new BigDecimal(5220);
|
||||
//充电桩累计充电量
|
||||
BigDecimal ChargePilePowerGeneration = new BigDecimal(346000);
|
||||
//充电桩每日添加的充电量
|
||||
BigDecimal DailyChargePilePowerGeneration = new BigDecimal(24000);
|
||||
|
||||
}
|
||||
|
||||
interface ChineseProvinces {
|
||||
|
||||
//五个自治区
|
||||
//广西
|
||||
String guangxi = "广西壮族自治区";
|
||||
//宁夏
|
||||
String ningxia = "宁夏回族自治区";
|
||||
//新疆
|
||||
String xinjiang = "新疆维吾尔族自治区";
|
||||
//西藏
|
||||
String xizang = "西藏自治区";
|
||||
//内蒙古
|
||||
String neimenggu = "内蒙古自治区";
|
||||
|
||||
//两个特别行政区
|
||||
//香港
|
||||
String xianggang = "香港特别行政区";
|
||||
//澳门
|
||||
String aomen = "澳门特别行政区";
|
||||
|
||||
//四个直辖市
|
||||
//北京
|
||||
String beijing = "北京市";
|
||||
//天津
|
||||
String tianjin = "天津市";
|
||||
//上海
|
||||
String shanghai = "上海市";
|
||||
//重庆
|
||||
String chongqing = "重庆市";
|
||||
|
||||
String PROVINCE = "省";
|
||||
|
||||
String CITY = "市";
|
||||
|
||||
}
|
||||
|
||||
//根目录
|
||||
String ROOT_PATH = "/";
|
||||
|
||||
//工单计划类型
|
||||
interface WorkOrderPlanSubType {
|
||||
//电站
|
||||
Integer STATION = 1;
|
||||
//设备
|
||||
Integer DEVICE = 2;
|
||||
//人员
|
||||
Integer PERSON = 3;
|
||||
//告警
|
||||
Integer EVENT = 4;
|
||||
}
|
||||
|
||||
//下发成功与否
|
||||
interface IssuedFlag {
|
||||
|
||||
String MSG = ",请稍后再试";
|
||||
|
||||
String SUCCESS = "下发成功";
|
||||
|
||||
String FAIL = "下发失败";
|
||||
|
||||
String UPDATE_FAIL = "边端向设备下发消息后没有得到设备的回应";
|
||||
|
||||
String TIMEOUT_FAIL = "下发超时" + MSG;
|
||||
|
||||
String ORDER_PROCESS = "命令下发中";
|
||||
|
||||
String FILE_SUCCESS = "文件下发成功";
|
||||
|
||||
String FILE_FAIL = "文件下发失败";
|
||||
|
||||
String FILE_PROCESS = "文件下发中";
|
||||
|
||||
String ATTRIBUTE_PROCESS = "文件属性读取中";
|
||||
|
||||
String ATTRIBUTE_SUCCESS = "文件属性读取完成";
|
||||
|
||||
String ATTRIBUTE_TIMEOUT = "文件属性读取超时" + MSG;
|
||||
|
||||
String DELETE_FILE_PROCESS = "删除文件命令下发中";
|
||||
|
||||
String DELETE_FILE_SUCCESS = "删除文件成功";
|
||||
|
||||
String DELETE_FILE_TIMEOUT = "删除文件超时" + MSG;
|
||||
|
||||
String READ_FILE_PROCESS = "文件下载准备中";
|
||||
|
||||
String READ_FILE_SUCCESS = "文件下载准备成功";
|
||||
|
||||
String READ_FILE_FAIL = "文件下载准备失败";
|
||||
|
||||
String READ_FILE_TIMEOUT = "文件下载准备超时" + MSG;
|
||||
|
||||
String FILE_BATCH_FAIL = "文件批量下发存在失败情况";
|
||||
|
||||
String DELETE_DIRECTORY_PROCESS = "删除文件夹命令下发中";
|
||||
|
||||
String DELETE_DIRECTORY_SUCCESS = "删除文件夹成功";
|
||||
|
||||
String DELETE_DIRECTORY_TIMEOUT = "删除文件夹超时" + MSG;
|
||||
|
||||
String MODIFY_ATTRIBUTE_PROCESS = "修改文件属性命令下发中";
|
||||
|
||||
String MODIFY_ATTRIBUTE_SUCCESS = "修改文件属性完成";
|
||||
|
||||
String MODIFY_ATTRIBUTE_TIMEOUT = "修改文件属性超时" + MSG;
|
||||
|
||||
String MODIFY_DIRECTORY_PROCESS = "修改文件夹属性命令下发中";
|
||||
|
||||
String MODIFY_DIRECTORY_SUCCESS = "修改文件夹属性成功";
|
||||
|
||||
String MODIFY_DIRECTORY_TIMEOUT = "修改文件夹属性超时" + MSG;
|
||||
}
|
||||
|
||||
interface Heartbeat {
|
||||
|
||||
String MSG = "设备接入通道";
|
||||
|
||||
String SUCCESS = "恢复";
|
||||
|
||||
String FAIL = "断开";
|
||||
|
||||
String SN_FAIL = "设备接入点离线";
|
||||
|
||||
String STATION_FAIL = "离线";
|
||||
|
||||
String TRAFFIC_WARNING = "流量使用已达到90%";
|
||||
}
|
||||
|
||||
//文件类型
|
||||
interface FileType {
|
||||
//目录
|
||||
String DIRECTORY = "directory";
|
||||
|
||||
}
|
||||
|
||||
//特殊电站id
|
||||
interface SPECIALSTATION {
|
||||
//清陶电站ID
|
||||
Integer QTSTATION = 719;
|
||||
|
||||
}
|
||||
|
||||
String CHECK_MODIFY_VALUE = "命令下发修改值不在范围内";
|
||||
|
||||
String DEVICE_NO_SN = "设备没有配置SN";
|
||||
String NOT_SN = "没有配置站内接入点";
|
||||
String INTERVAL = "间隔";
|
||||
String STATION = "电站";
|
||||
|
||||
//摄像头的默认值
|
||||
interface CAMERA_DEFAULT {
|
||||
Integer GROUP_IS_DEFAULT = 1;
|
||||
Integer GROUP_IS_NOT_DEFAULT = 0;
|
||||
Integer STATION_IS_DEFAULT = 1;
|
||||
Integer STATION_IS_NOT_DEFAULT = 0;
|
||||
}
|
||||
|
||||
//电价模板自增id类型
|
||||
String IdTypePriceTemplate = "priceTemplate";
|
||||
|
||||
String ACCESSPOINT = "接入点";
|
||||
//通信故障
|
||||
String COMMUNICATION_STATUS = "communicationStatus";
|
||||
|
||||
//mqtt交互消息级别
|
||||
interface Level {
|
||||
Integer ONE = 1;
|
||||
Integer TWO = 2;
|
||||
Integer THREE = 3;
|
||||
Integer FOUR = 4;
|
||||
}
|
||||
|
||||
interface Info {
|
||||
String QUANTILE = "[恢复]";
|
||||
String CLOSED_POSITION = "[动作]";
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新方式
|
||||
*/
|
||||
interface UpdateMethod {
|
||||
String ADD = "add";
|
||||
String DELETE = "delete";
|
||||
}
|
||||
|
||||
/**
|
||||
* 外接电表
|
||||
*/
|
||||
interface OutsideEle {
|
||||
|
||||
String SUCCESS = "外接电表通道恢复";
|
||||
|
||||
String FAIL = "外接电表通道离线";
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送短信消息
|
||||
*/
|
||||
interface SMS {
|
||||
|
||||
//用户名
|
||||
String NAME = "name";
|
||||
//电站名称
|
||||
String SITE_NAME = "siteName";
|
||||
//告警信息
|
||||
String CONTENT = "content";
|
||||
|
||||
//手机号
|
||||
String NUM = "num";
|
||||
}
|
||||
|
||||
/**
|
||||
* 有人云 token/apikey
|
||||
*/
|
||||
//getPeopleCloudToken
|
||||
interface PeopleCloudToken {
|
||||
//卡号
|
||||
String MSISDN = "msisdn";
|
||||
//运营商名称
|
||||
String OPERATOR_NAME = "operator_name";
|
||||
String USE_FLOW = "use_flow";
|
||||
String TOTAL_FLOW = "total_flow";
|
||||
|
||||
String SURPLUS_FLOW = "surplus_flow";
|
||||
String APPKEY = "4e8680fee228a442c8c3371cf7a7e71a";
|
||||
String TOKEN = "0f757dc394740fa21f75f6269b2031fb";
|
||||
}
|
||||
|
||||
/**
|
||||
* 万物互联 token/apikey
|
||||
*/
|
||||
interface InternetEveryToken {
|
||||
String MSISDN = "msisdn";
|
||||
String CARRIER = "carrier";
|
||||
String DATA_BALANCE = "data_balance";
|
||||
String DATA_TRAFFIC_AMOUNT = "data_traffic_amount";
|
||||
String APIKEY = "c7115e04f25d18eaeaddf82b435c103abe5b1eb7";
|
||||
String APISECRET = "4RpsG0H6uM";
|
||||
String BASEPATH = "https://ec.upiot.net/api/v2/";
|
||||
}
|
||||
|
||||
/**
|
||||
* 运维页面内存信息
|
||||
*/
|
||||
String URL = "/data/backup/serverinfo.sh";
|
||||
|
||||
interface MemoryInfo {
|
||||
//cpu占用率
|
||||
String CPUUSE = "cpuUse";
|
||||
|
||||
//磁盘的总量空间
|
||||
String ROOTSIZE = "rootSize";
|
||||
|
||||
//磁盘可用空间
|
||||
String FREEDISK = "freeDisk";
|
||||
|
||||
//磁盘使用情况
|
||||
String DISKUSAGE = "diskUsage";
|
||||
|
||||
//内存总空间
|
||||
String TOTALMEMORY = "totalMemory";
|
||||
|
||||
//内存已使用大小
|
||||
String USEDMEMORY = "usedMemory";
|
||||
|
||||
//内存剩余空间
|
||||
String FREEMEMORY = "freeMemory";
|
||||
|
||||
//内存已使用率
|
||||
String MEMORYUSAGE = "memoryUsage";
|
||||
}
|
||||
|
||||
String alarmNum = "alarmNum";
|
||||
String alarmUnresolvedNum = "alarmUnresolvedNum";
|
||||
String pcsConversion = "pcsConversion";
|
||||
String srcId = "srcId";
|
||||
String sn = "sn";
|
||||
String pcsDeviceType = "pcsDeviceType";
|
||||
String pcsSrcId = "pcsSrcId";
|
||||
String deviceType = "deviceType";
|
||||
String PACK = "pack";
|
||||
//特殊分割符合
|
||||
String SPECIAL_SPLIT = "_;_";
|
||||
//sn码集合
|
||||
String SN_LIST = "snList";
|
||||
//加
|
||||
int ADD = 1;
|
||||
//减
|
||||
int SUBTRACT = 2;
|
||||
//乘
|
||||
int MULTIPLY = 3;
|
||||
//除
|
||||
int DIVIDE = 4;
|
||||
//取平均
|
||||
int AVG = 5;
|
||||
|
||||
String SEGMENT = "segment";
|
||||
|
||||
interface RateType {
|
||||
String TIP = "尖峰时段"; //尖
|
||||
String PEAK = "高峰时段";//峰
|
||||
String FLAT = "平时段";//平
|
||||
String VALLEY = "低谷时段";//谷
|
||||
|
||||
String DEEP_VALLEY = "深谷时段";//深谷
|
||||
}
|
||||
|
||||
interface RateTypeSimple {
|
||||
String TIP = "尖峰"; //尖
|
||||
String PEAK = "高峰";//峰
|
||||
String FLAT = "平时";//平
|
||||
String VALLEY = "低谷";//谷
|
||||
|
||||
String DEEP_VALLEY = "深谷";//深谷
|
||||
}
|
||||
|
||||
//移动卡状态存储
|
||||
interface MobileCardStatus {
|
||||
String NOTACTIVE = "待激活"; //待激活
|
||||
String Active = "已激活";//已激活
|
||||
String HALT = "停机";//电信卡停机
|
||||
}
|
||||
|
||||
//移动卡状态存储
|
||||
interface TelecomType {
|
||||
//单卡/流量池
|
||||
String SINGLE = "单卡"; //单卡
|
||||
String POOL = "流量池";//流量池
|
||||
}
|
||||
|
||||
String DATA_ERROR = "数据异常";
|
||||
String BMU_NUM = "电池组号";
|
||||
String BOX_NUM = "电芯位置";
|
||||
String POSITIVE = "正向";
|
||||
String NEGATIVE = "反向";
|
||||
String ELE_TIP = "电量(尖)";
|
||||
String ELE_PEAK = "电量(峰)";
|
||||
String ELE_FLAT = "电量(平)";
|
||||
String ELE_VALLEY = "电量(谷)";
|
||||
|
||||
String ELE_DEEP_VALLEY = "电量(深谷)";
|
||||
String KWH = "(kWh)";
|
||||
|
||||
String STRATEGY_MODEL = "策略模版";
|
||||
|
||||
interface Demand{
|
||||
//上月最大需量
|
||||
String LAST_MONTH_MAX_DEMAND = "lastMonthMaxDemand";
|
||||
//上月最大功率
|
||||
String LAST_MONTH_MAX_POWER = "lastMonthMaxPower";
|
||||
//上月最小功率
|
||||
String LAST_MONTH_MIN_POWER = "lastMonthMinPower";
|
||||
//当月最大需量
|
||||
String THE_MONTH_MAX_DEMAND = "theMonthMaxDemand";
|
||||
//当月最大功率
|
||||
String THE_MONTH_MAX_POWER = "theMonthMaxPower";
|
||||
//当月最小功率
|
||||
String THE_MONTH_MIN_POWER = "theMonthMinPower";
|
||||
}
|
||||
|
||||
//字母常量
|
||||
interface ALPHABET{
|
||||
String a = "a";
|
||||
String b = "b";
|
||||
String c = "c";
|
||||
String d = "d";
|
||||
String e = "e";
|
||||
String f = "f";
|
||||
String g = "g";
|
||||
}
|
||||
|
||||
String TRUE = "true";
|
||||
|
||||
//柴发数据
|
||||
String CF_FROZEN = "cfFrozen";
|
||||
//将数据库统配符合“_”变成普通字符
|
||||
String JOIN_STATION_ID = "\\_";
|
||||
}
|
||||
@ -0,0 +1,49 @@
|
||||
package com.ho.common.tools.constant;
|
||||
|
||||
/**
|
||||
* @author fancl
|
||||
* @desc: 上下文常量
|
||||
* @date 2022/8/31
|
||||
*/
|
||||
public interface ContextConstant {
|
||||
|
||||
//用户系统
|
||||
String SYS = "sys/";
|
||||
//服务context根路径
|
||||
String ROOT_CONTEXT = "/api/";
|
||||
//业务系统
|
||||
String BUSINESS = "business/";
|
||||
//td
|
||||
String TD_CONTEXT = "/td/";
|
||||
|
||||
String CALL_CONTEXT = "/call/";
|
||||
|
||||
//数字孪生上下文
|
||||
String DIGI_CONTEXT = "digi/";
|
||||
|
||||
//文件 多媒体子系统
|
||||
String MEDIA_CONTEXT = "media/";
|
||||
|
||||
//工作流 工单模块
|
||||
String FLOW_CONTEXT = "flow/";
|
||||
|
||||
//虚拟电厂
|
||||
String VPP_CONTEXT = "vpp/";
|
||||
|
||||
//微服务名称 用户中心
|
||||
String USER_CENTER = "user-center";
|
||||
//td-service
|
||||
String TD_SERVICE = "td-service";
|
||||
|
||||
//business-service
|
||||
String BUSINESS_SERVICE = "business-service";
|
||||
//文件多媒体中心
|
||||
String FILE_CENTER = "file-center";
|
||||
//flow-service
|
||||
String FLOW_SERVICE = "flow-service";
|
||||
//数字孪生
|
||||
String DIGITWINS_CENTER = "digitwins-center";
|
||||
//工作流中心
|
||||
String FLOW_CENTER = "flowable-center";
|
||||
|
||||
}
|
||||
@ -0,0 +1,149 @@
|
||||
package com.ho.common.tools.constant;
|
||||
|
||||
/**
|
||||
* @author fancl
|
||||
* @desc: 定义常量
|
||||
* @date 2022/8/18
|
||||
*/
|
||||
public interface DefineConstant {
|
||||
|
||||
String STATION_STATUS = "电站状态";
|
||||
|
||||
String SHUT_DOWN = "停机";
|
||||
|
||||
String RUN = "运行";
|
||||
|
||||
String TOTAL_ACTIVE_POWER = "总有功功率";
|
||||
|
||||
String VALLEY = "谷";
|
||||
|
||||
String FLAT = "平";
|
||||
|
||||
String PEAK = "峰";
|
||||
|
||||
String DEEP_VALLEY = "深谷";
|
||||
|
||||
String SHARP = "尖";
|
||||
|
||||
String SUMMARY = "汇总";
|
||||
|
||||
String SUMMARY_DATA_STATION = "电站汇总数据";
|
||||
|
||||
interface PeakShaving {
|
||||
String ADD_TEMPLATE_SUCCESS = "新增计划曲线模板成功";
|
||||
String TEMPLATE_CHECK_SIZE = "至少有一个时段和一个计划用电,请确认后重试!";
|
||||
String TEMPLATE_DATA_NOT_EXIST = "模板数据不能为空,请确认后重试!";
|
||||
String ADD_TEMPLATE_FAIL = "新增计划曲线模板出错";
|
||||
String TEMPLATE_NO_NOT_NULL = "模板编号不能为空";
|
||||
String TEMPLATE_NO_NOT_REPEAT = "模板编号不可重复,请确认后重试!";
|
||||
String TEMPLATE_NAME_NOT_NULL = "模板名称不能为空";
|
||||
String TEMPLATE_NAME_NOT_REPEAT = "模板名称不可重复,请确认后重试!";
|
||||
String TEMPLATE_NO_TOO_LONG = "模板编号不允许超过10位,请确认后重试!";
|
||||
String TEMPLATE_NAME_TOO_LONG = "模板名称不允许超过10位,请确认后重试!";
|
||||
String TEMPLATE_P_ERROR = "额定功率数据异常,请确认后重试!";
|
||||
String TEMPLATE_SOC_UPPER_ERROR = "SOC上限数据异常,请确认后重试!";
|
||||
String TEMPLATE_SOC_LOWER_ERROR = "SOC下限数据异常,请确认后重试!";
|
||||
String TEMPLATE_CAPACITY_ERROR = "额定容量数据异常,请确认后重试!";
|
||||
String EDIT_TEMPLATE_FAIL = "编辑计划曲线模板出错";
|
||||
String EDIT_TEMPLATE_SUCCESS = "编辑计划曲线模板成功";
|
||||
String DELETE_SUCCESS = "删除成功";
|
||||
String TAR_FILE_ISSUE_ERROR = "压缩json文件发生异常";
|
||||
String FILE_ISSUE_ERROR = "下发JSON文件发生异常";
|
||||
}
|
||||
|
||||
interface PlanningCurveIssue {
|
||||
String SEND_SUCCESS = "下发成功";
|
||||
String SEND_FAIL = "下发失败";
|
||||
String PLAN_CURVE = "计划曲线";
|
||||
}
|
||||
|
||||
/**
|
||||
* 部分引用PeakShaving中定义常量
|
||||
*/
|
||||
interface PlanningCurve {
|
||||
String SUCCESS = "操作成功";
|
||||
String DELETE_FAIL = "删除失败";
|
||||
String FILE_FORMAT_ONLY = "文件格式不正确";
|
||||
String FILE_UPLOAD_SUCCESS = "文件上传成功";
|
||||
String FILE_UPLOAD_ERROR_EMPTY_SHEET = "上传失败sheet为空";
|
||||
String OPERATION_FAILED = "操作失败";
|
||||
String FILE_ISSUE_FAIL = "下发JSON文件失败";
|
||||
String FILE_ISSUE_SUCCESS = "下发JSON文件成功";
|
||||
}
|
||||
|
||||
interface StationHome{
|
||||
String OUTPUT_POWER = "有功功率";
|
||||
String PV_OUTPUT_POWER = "PV输出功率";
|
||||
String PV_INVERTER = "光伏逆变器";
|
||||
String TOTAL_PV_POWER = "总光伏功率";
|
||||
String ANTI_BACKFLOW_METER = "防逆流表";
|
||||
String TOTAL_ACTIVE_POWER = "总有功功率";
|
||||
String BUILDING = "(在建)";
|
||||
String PROPOSED = "(拟建)";
|
||||
}
|
||||
|
||||
interface PlanningPolicy{
|
||||
String DATA_NOT_EMPTY = "数据不能为空!";
|
||||
String POLICY_NAME_NOT_REPEAT = "策略名称不可相同,请确认后重试!";
|
||||
String CUSTOM_POLICY_NAME_NOT_REPEAT = "自定义策略名称不可相同,请确认后重试!";
|
||||
String SAVE_SUCCESS = "保存成功!";
|
||||
String SAVE_FAIL = "保存失败!";
|
||||
String SAVE_ERROR = "保存出错!";
|
||||
String MODIFY_SUCCESS = "修改成功!";
|
||||
String MODIFY_FAIL = "修改失败!";
|
||||
String MODIFY_ERROR = "修改出错!";
|
||||
String DELETE_SUCCESS = "删除成功!";
|
||||
String DELETE_FAIL = "删除失败!";
|
||||
String DELETE_ERROR = "删除出错!";
|
||||
String FILE_FORMAT_ONLY = "文件格式不正确";
|
||||
}
|
||||
|
||||
interface PointDemo{
|
||||
String TIME = "时间";
|
||||
}
|
||||
|
||||
interface DeviceTypeCol{
|
||||
String IMPORT_VALUE_DEVICETYPECOL_CHECK1 = "导入模板是否可写,第";
|
||||
String IMPORT_VALUE_DEVICETYPECOL_CHECK2 = "行填值错误,只能是0或1";
|
||||
String IMPORT_VALUE_MAXVALUE_CHECK1 = "导入模板最大值最小值,第";
|
||||
String IMPORT_VALUE_MAXVALUE_CHECK2 = "行填值错误,不能为空";
|
||||
String IMPORT_VALUE_SENSTYPE_CHECK1 = "导入模板最大值最小值,第";
|
||||
String IMPORT_VALUE_SENSTYPE_CHECK2 = "行填值错误,遥控最大值只能填写1,最小值只能填0";
|
||||
String IMPORT_VALUE_DEVICETYPE_CHECK1 = "导入模板第";
|
||||
String IMPORT_VALUE_DEVICETYPE_CHECK2 = "行填值错误,已存类型为";
|
||||
String IMPORT_VALUE_DEVICETYPE_CHECK3 = "且字段key为";
|
||||
String IMPORT_VALUE_DEVICETYPE_CHECK4 = "的值";
|
||||
|
||||
}
|
||||
|
||||
interface CommonFile{
|
||||
String CHOOSE_FILE = "请选择上传文件";
|
||||
String FILE_UPLOAD_ERROR = "上传文件发生异常";
|
||||
}
|
||||
|
||||
interface FlowOutApi{
|
||||
String ALARM_RESTORE = "恢复";
|
||||
String UPPER_LIMIT = " 越上限";
|
||||
String LOWER_LIMIT = " 越下限";
|
||||
}
|
||||
|
||||
interface Event{
|
||||
String STATION_NAME = "电站名称";
|
||||
String DEVICE_TYPE = " 设备类型";
|
||||
String DEVICE_NAME = " 所属设备";
|
||||
String STATUS = "事件状态";
|
||||
String EVENT_LEVEL = " 事件";
|
||||
String TIME_STAMP = " 告警时间";
|
||||
String DESCRIPTION = "事件描述";
|
||||
String CONFIRM_MAN = " 确认人";
|
||||
String CONFIRM_TIME = " 确认时间";
|
||||
String REMARK = " 备注";
|
||||
String CONFIRMED = " 已确认";
|
||||
String UNCONFIRMED = " 未确认";
|
||||
String ACCIDENT = " 事故";
|
||||
String FAULT = " 故障";
|
||||
String ALARM = " 告警";
|
||||
String PROMPT = " 提示";
|
||||
String INFORM = " 告知";
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,30 @@
|
||||
package com.ho.common.tools.constant;
|
||||
|
||||
/**
|
||||
* @author fancl
|
||||
* @desc: 环境常量
|
||||
* @date 2023/1/11
|
||||
*/
|
||||
public interface EnvConstant {
|
||||
|
||||
//本地环境
|
||||
String DEV = "dev";
|
||||
|
||||
//开发环境
|
||||
String EXP = "exp";
|
||||
|
||||
//演示环境
|
||||
String TEST = "test";
|
||||
|
||||
//通合环境
|
||||
String TONG_HE = "tonghe";
|
||||
|
||||
//生产环境
|
||||
String PRODUCT = "product";
|
||||
|
||||
//OPEN环境 自有云平台
|
||||
String OPEN = "open";
|
||||
|
||||
//晶科线上环境
|
||||
String JINGKEPROD = "jingkeprod";
|
||||
}
|
||||
@ -0,0 +1,70 @@
|
||||
package com.ho.common.tools.constant;
|
||||
|
||||
/**
|
||||
* 针对excel中表头定义常量
|
||||
*/
|
||||
public interface ExcelCommonConstant {
|
||||
|
||||
/*******************数据监视-导出******************/
|
||||
String DEVICE_TYPE="deviceType";
|
||||
String DEVICE_NAME="deviceName";
|
||||
String COL="col";
|
||||
String COL_NAME="colName";
|
||||
String VALUE="value";
|
||||
String UNIT="unit";
|
||||
String MAX_VALUE="maxValue";
|
||||
String MIN_VALUE="minValue";
|
||||
String UPDATE_TIME="updateTime";
|
||||
|
||||
String TEMPLATE_NO = "templateNo";
|
||||
String BEGIN_TIME = "beginTime";
|
||||
String END_TIME = "endTime";
|
||||
String TYPE = "type";
|
||||
String PRICE = "price";
|
||||
String TEMPLATE_NAME = "templateName";
|
||||
String IS_ENABLE = "isEnable";
|
||||
String STATION_ID = "stationId";
|
||||
String GROUP_ID = "groupId";
|
||||
String VALIDITY_START_TIME = "validityStartTime";
|
||||
String VALIDITY_END_TIME = "validityEndTime";
|
||||
String DISCOUNT = "discount";
|
||||
|
||||
String REPAIR_USER_NAME = "repairUserName";
|
||||
String REPAIR_CONTENT = "repairContent";
|
||||
String REPAIR_POSITION = "repairPosition";
|
||||
String REPAIR_TIME = "repairTime";
|
||||
String REMARK = "remark";
|
||||
|
||||
String TITLE = "title";
|
||||
String CONTENT = "content";
|
||||
String CREATE_USER_NAME = "createUserName";
|
||||
String CREATE_TIME = "createTime";
|
||||
|
||||
String ADD_NAME = "addName";
|
||||
String NAME = "name";
|
||||
String CAPACITY = "capacity";
|
||||
String ALARM_STATUS_TO_STR = "alarmStatusToStr";
|
||||
String ALARM_NUM = "alarmNum";
|
||||
String ALARM_UNRESOLVED_NUM = "alarmUnresolvedNum";
|
||||
String PCS_CONVERSION = "pcsConversion";
|
||||
String TIME = "time";
|
||||
String DAILY_CHARGE = "dailyCharge";
|
||||
String DAILY_DISCHARGE = "dailyDischarge";
|
||||
String TOTAL_CHARGE_E = "totalChargeE";
|
||||
String TOTAL_DISCHARGE_E = "totalDischargeE";
|
||||
String MIN_TEMPERATURE = "minTemperature";
|
||||
String MAX_TEMPERATURE = "maxTemperature";
|
||||
String PCS_MAX_TEMPERATURE = "pcsMaxTemperature";
|
||||
String EMS_CPUUSE_PROPORTION = "emsCpuuseProportion";
|
||||
String EMS_MEMUSE_PROPORTION = "emsMemuseProportion";
|
||||
String EMS_HARDUSE_PROPORTION = "emsHarduseProportion";
|
||||
|
||||
String TAB_NAME = "tabName";
|
||||
String TAG_NAME = "tagName";
|
||||
String TAG_NAME_EN = "tagNameEn";
|
||||
String TAG_TYPE = "tagType";
|
||||
String SRC_ID = "srcId";
|
||||
String FRAME = "frame";
|
||||
String DEF_VAL = "defVal";
|
||||
|
||||
}
|
||||
@ -0,0 +1,13 @@
|
||||
package com.ho.common.tools.constant;
|
||||
|
||||
/**
|
||||
* @author fancl
|
||||
* @desc: 组织机构常量
|
||||
* @date 2022/9/6
|
||||
*/
|
||||
public interface OrgConstant {
|
||||
//集团
|
||||
String GROUP_ID = "groupId";
|
||||
String DEPT_ID = "deptId";
|
||||
String STATION_ID = "stationId";
|
||||
}
|
||||
@ -0,0 +1,282 @@
|
||||
package com.ho.common.tools.constant;
|
||||
|
||||
/**
|
||||
* @author gyan
|
||||
* @desc: 权限常量
|
||||
* @DateTime: 2023/6/1 17:13
|
||||
*/
|
||||
public interface PermissionConstant {
|
||||
//远程控制
|
||||
String REMOTECONTROL_FILE_UPLOAD = "remoteControl:file:upload";
|
||||
//远程控制 ->文件服务 上传按钮
|
||||
String REMOTECONTROL_FILE_QUERY = "remoteControl:file:query";
|
||||
//远程控制 ->文件服务 查询按钮
|
||||
String REMOTECONTROL_FILE_RESETTING = "remoteControl:file:resetting";
|
||||
//远程控制 ->文件服务 重置按钮
|
||||
String REMOTECONTROL_FILE_REFRESH = "remoteControl:file:refresh";
|
||||
//远程控制 ->文件服务 刷新按钮
|
||||
|
||||
String REMOTECONTROL_COMMAND_BATCHDISTRIBUTION = "remoteControl:command:batchDistribution";
|
||||
//远程控制 ->命令下发 批量下发按钮
|
||||
String REMOTECONTROL_COMMAND_EXPORT = "remoteControl:command:export";
|
||||
//远程控制 ->命令下发 导出按钮 remoteControl:command:export
|
||||
String REMOTECONTROL_COMMAND_QUERY = "remoteControl:command:query";
|
||||
//远程控制 ->命令下发 查询按钮 remoteControl:command:query
|
||||
String REMOTECONTROL_COMMAND_SINGLEDISTRIBUTION = "remoteControl:command:singleDistribution";
|
||||
//远程控制 ->命令下发 单个下发按钮 remoteControl:command:singleDistribution
|
||||
String REMOTECONTROL_COMMAND_SINGLEREFRESH = "remoteControl:command:singleRefresh";
|
||||
//远程控制 ->命令下发 单个刷新按钮 remoteControl:command:singleRefresh
|
||||
|
||||
//策略管理
|
||||
|
||||
//策略管理 ->电价曲线设置 新增按钮 strategy:eleCurve:add
|
||||
String STRATEGY_ELECURVE_ADD = "strategy:eleCurve:add";
|
||||
|
||||
//策略管理 ->电价曲线设置 批量删除按钮 strategy:eleCurve:delete
|
||||
String strategy_eleCurve_delete = "strategy:eleCurve:delete";
|
||||
|
||||
//策略管理 ->电价曲线设置 导入 strategy:eleCurve:import
|
||||
String STRATEGY_ELECURVE_IMPORT = "strategy:eleCurve:import";
|
||||
|
||||
//策略管理 ->电价曲线设置 导出 strategy:eleCurve:export
|
||||
String STRATEGY_ELECURVE_EXPORT = "strategy:eleCurve:export";
|
||||
|
||||
//策略管理 ->电价曲线设置 导出模板按钮 strategy:eleCurve:exporttemplate
|
||||
String STRATEGY_ELECURVE_EXPORTTEMPLATE = "strategy:eleCurve:exporttemplate";
|
||||
|
||||
//策略管理 ->电价曲线设置 查询按钮 strategy:eleCurve:query
|
||||
String STRATEGY_ELECURVE_QUERY = "strategy:eleCurve:query";
|
||||
|
||||
//策略管理 ->电价曲线设置 重置按钮 strategy:eleCurve:resetting
|
||||
String STRATEGY_ELECURVE_RESETTING = "strategy:eleCurve:resetting";
|
||||
|
||||
//策略管理 ->电价曲线设置 编辑按钮 strategy:eleCurve:edit
|
||||
String STRATEGY_ELECURVE_EDIT = "strategy:eleCurve:edit";
|
||||
|
||||
//策略管理 ->电价曲线设置 单个删除按钮 strategy:eleCurve:singleDelete
|
||||
String STRATEGY_ELECURVE_SINGLEDELETE = "strategy:eleCurve:singleDelete";
|
||||
|
||||
//策略管理 ->计划曲线模板 新增按钮 strategy:planCurve:add
|
||||
String STRATEGY_PLANCURVE_ADD = "strategy:planCurve:add";
|
||||
|
||||
//策略管理 ->计划曲线模板 批量删除按钮 strategy:planCurve:delete
|
||||
String STRATEGY_PLANCURVE_DELETE = "strategy:planCurve:delete";
|
||||
|
||||
//策略管理 ->计划曲线模板 查询按钮 strategy:planCurve:query
|
||||
String STRATEGY_PLANCURVE_QUERY = "strategy:planCurve:query";
|
||||
|
||||
//策略管理 ->计划曲线模板 重置按钮 strategy:planCurve:resetting
|
||||
String STRATEGY_PLANCURVE_RESETTING = "strategy:planCurve:resetting";
|
||||
|
||||
//策略管理 ->计划曲线模板 编辑按钮 strategy:planCurve:edit
|
||||
String STRATEGY_PLANCURVE_EDIT = "strategy:planCurve:edit";
|
||||
|
||||
//策略管理 ->计划曲线模板 单个删除按钮 strategy:planCurve:singleDelete
|
||||
String STRATEGY_PLANCURVE_SINGLEDELETE = "strategy:planCurve:singleDelete";
|
||||
|
||||
//策略管理 ->计划曲线下发 命令下发按钮 strategy:planCurveDis:commandIssuance
|
||||
String STRATEGY_PLANCURVEDIS_COMMANDISSUANCE = "strategy:planCurveDis:commandIssuance";
|
||||
//策略管理 ->计划曲线下发 控制下发按钮 strategy:planCurveDis:commandIssuanceData
|
||||
String STRATEGY_PLANCURVEDIS_COMMANDISSUANCEDATA = "strategy:planCurveDis:commandIssuanceData";
|
||||
|
||||
//数据监视
|
||||
//数据监视 ->数据展示 导出按钮 data:show:export
|
||||
String DATA_SHOW_EXPORT = "data:show:export";
|
||||
|
||||
//数据监视 ->数据展示 查询按钮 data:show:query
|
||||
String DATA_SHOW_QUERY = "data:show:query";
|
||||
|
||||
//数据监视 ->数据展示 重置按钮 data:show:resetting
|
||||
String DATA_SHOW_RESETTING = "data:show:resetting";
|
||||
|
||||
//数据监视 ->数据展示 查看历史数据 data:show:queryhisData
|
||||
String DATA_SHOW_QUERYHISDATA = "data:show:queryhisData";
|
||||
|
||||
//数据监视 ->历史曲线 导出按钮 data:hisCurve:export
|
||||
String DATA_HISCURVE_EXPORT = "data:hisCurve:export";
|
||||
|
||||
//数据监视 ->历史曲线 查询按钮 data:hisCurve:query
|
||||
String DATA_HISCURVE_QUERY = "data:hisCurve:query";
|
||||
|
||||
//数据监视 ->历史曲线 重置按钮 data:hisCurve:resetting
|
||||
String DATA_HISCURVE_RESETTING = "data:hisCurve:resetting";
|
||||
|
||||
|
||||
//系统管理
|
||||
//系统管理 ->设备类型管理 新增按钮 sys:devicetype:add
|
||||
String SYS_DEVICETYPE_ADD = "sys:devicetype:add";
|
||||
|
||||
//系统管理 ->设备类型管理 删除按钮 sys:devicetype:delete
|
||||
String SYS_DEVICETYPE_DELETE = "sys:devicetype:delete";
|
||||
|
||||
//系统管理 ->设备类型管理 查询按钮 sys:devicetype:query
|
||||
String SYS_DEVICETYPE_QUERY = "sys:devicetype:query";
|
||||
|
||||
//系统管理 ->设备类型管理 重置按钮 sys:devicetype:resetting
|
||||
String SYS_DEVICETYPE_RESETTING = "sys:devicetype:resetting";
|
||||
|
||||
//系统管理 ->EMS设备 新增按钮 sys:emsDevice:add
|
||||
String SYS_EMSDEVICE_ADD = "sys:emsDevice:add";
|
||||
|
||||
//系统管理 ->EMS设备 删除按钮 sys:emsDevice:delete
|
||||
String SYS_EMSDEVICE_DELETE = "sys:emsDevice:delete";
|
||||
|
||||
//系统管理 ->EMS设备 保存按钮 sys:emsDevice:save
|
||||
String SYS_EMSDEVICE_SAVE = "sys:emsDevice:save";
|
||||
|
||||
//系统管理 ->EMS设备 上传按钮 sys:emsDevice:upload
|
||||
String SYS_EMSDEVICE_UPLOAD = "sys:emsDevice:upload";
|
||||
|
||||
//系统管理 ->EMS设备 导出模板按钮 sys:emsDevice:exporttemplate
|
||||
String SYS_EMSDEVICE_EXPORTTEMPLATE = "sys:emsDevice:exporttemplate";
|
||||
|
||||
//系统管理 ->EMS设备 关联模型字段按钮 sys:emsDevice:associated
|
||||
String SYS_EMSDEVICE_ASSOCIATED = "sys:emsDevice:associated";
|
||||
|
||||
//系统管理 ->EMS模型 新增按钮 sys:emsModel:add
|
||||
String SYS_EMSMODEL_ADD = "sys:emsModel:add";
|
||||
|
||||
//系统管理 ->EMS模型 删除按钮 sys:emsModel:delete
|
||||
String SYS_EMSMODEL_DELETE = "sys:emsModel:delete";
|
||||
|
||||
//系统管理 ->EMS模型 保存按钮 sys:emsModel:save
|
||||
String SYS_EMSMODEL_SAVE = "sys:emsModel:save";
|
||||
|
||||
//系统管理 ->模型-设备关联管理 删除按钮 sys:modelDevice:delete
|
||||
String SYS_MODELDEVICE_DELETE = "sys:modelDevice:delete";
|
||||
|
||||
//系统管理 ->设备管理 查询按钮 sys:device:query
|
||||
String SYS_DEVICE_QUERY = "sys:device:query";
|
||||
|
||||
//系统管理 ->设备管理 重置按钮 sys:device:resetting
|
||||
String SYS_DEVICE_RESETTING = "sys:device:resetting";
|
||||
|
||||
//系统管理 ->设备管理 编辑设备类型按钮 sys:device:edit
|
||||
String SYS_DEVICE_EDIT = "sys:device:edit";
|
||||
|
||||
//系统管理 ->设备管理 详情按钮 sys:device:details
|
||||
String SYS_DEVICE_DETAILS = "sys:device:details";
|
||||
|
||||
//告警管理 ->实时告警 查询按钮 event:realtimeAlarm:query
|
||||
String EVENT_REALTIMEALARM_QUERY = "event:realtimeAlarm:query";
|
||||
|
||||
//告警管理 ->实时告警 重置按钮 event:realtimeAlarm:resetting
|
||||
String EVENT_REALTIMEALARM_RESETTING = "event:realtimeAlarm:resetting";
|
||||
|
||||
//告警管理 ->实时告警 告警清除按钮 event:realtimeAlarm:alarmClearing
|
||||
String EVENT_REALTIMEALARM_ALARMCLEARING = "event:realtimeAlarm:alarmClearing";
|
||||
|
||||
//告警管理 ->历史告警 查询按钮 event:hisAlarm:query
|
||||
String EVENT_HISALARM_QUERY = "event:hisAlarm:query";
|
||||
|
||||
//告警管理 ->历史告警 重置按钮 event:hisAlarm:resetting
|
||||
String EVENT_HISALARM_RESETTING = "event:hisAlarm:resetting";
|
||||
|
||||
//告警手动转工单
|
||||
String EVENT_MANUAL_TRANSFER_WORK_ORDER = "event:manual:transfer:work:order";
|
||||
|
||||
|
||||
//系统管理 ->用户管理 查询按钮 sys:dept:user:list
|
||||
String SYS_DEPT_USER_LIST = "sys:dept:user:list";
|
||||
|
||||
//系统管理 ->用户管理 重置按钮 sys:user:resetting
|
||||
String SYS_USER_RESETTING = "sys:user:resetting";
|
||||
|
||||
//系统管理 ->用户管理 新增按钮 sys:user:add
|
||||
String SYS_USER_ADD = "sys:user:add";
|
||||
|
||||
//系统管理 ->用户管理 编辑按钮 sys:user:update
|
||||
String SYS_USER_UPDATE = "sys:user:update";
|
||||
|
||||
//系统管理 ->用户管理 重置密码按钮 sys:user:resetpwd
|
||||
String SYS_USER_RESETPWD = "sys:user:resetpwd";
|
||||
|
||||
//系统管理 ->用户管理 删除按钮 sys:user:deleted
|
||||
String SYS_USER_DELETED = "sys:user:deleted";
|
||||
|
||||
//系统管理 ->日志管理 查询按钮 sys:log:list
|
||||
String SYS_LOG_LIST = "sys:log:list";
|
||||
|
||||
//系统管理 ->日志管理 重置按钮 sys:log:resetting
|
||||
String SYS_LOG_RESETTING = "sys:log:resetting";
|
||||
|
||||
//系统管理 ->日志管理 查看按钮 sys:log:view
|
||||
String SYS_LOG_VIEW = "sys:log:view";
|
||||
|
||||
//系统管理 ->日志管理 删除按钮 sys:log:deleted
|
||||
String SYS_LOG_DELETED = "sys:log:deleted";
|
||||
|
||||
//系统管理 ->站点管理 查询按钮 sys:stationManage:query
|
||||
String SYS_STATIONMANAGE_QUERY = "sys:stationManage:query";
|
||||
|
||||
//系统管理 ->站点管理 重置按钮 sys:stationManage:resetting
|
||||
String SYS_STATIONMANAGE_RESETTING = "sys:stationManage:resetting";
|
||||
|
||||
//系统管理 ->站点管理 删除按钮 sys:stationManage:delete
|
||||
String SYS_STATIONMANAGE_DELETE = "sys:stationManage:delete";
|
||||
|
||||
//系统管理 ->站点管理 编辑按钮 sys:stationManage:edit
|
||||
String SYS_STATIONMANAGE_EDIT = "sys:stationManage:edit";
|
||||
|
||||
//系统管理 ->站点管理 单个删除按钮 sys:stationManage:singleDelete
|
||||
String SYS_STATIONMANAGE_SINGLEDELETE = "sys:stationManage:singleDelete";
|
||||
|
||||
//系统管理 ->站点管理 新增按钮 sys:stationManage:add
|
||||
String SYS_STATIONMANAGE_ADD = "sys:stationManage:add";
|
||||
|
||||
//告警管理
|
||||
//告警管理 ->告警配置 遥信保存按钮 event:configure:yxSave
|
||||
String EVENT_CONFIGURE_YXSAVE = "event:configure:yxSave";
|
||||
|
||||
//告警管理 ->告警配置 遥信批量删除按钮 event:configure:yxBatchDelete
|
||||
String EVENT_CONFIGURE_YXBATCHDELETE = "event:configure:yxBatchDelete";
|
||||
|
||||
//告警管理 ->告警配置 遥测查询按钮 event:configure:ycQuery
|
||||
String EVENT_CONFIGURE_YCQUERY = "event:configure:ycQuery";
|
||||
|
||||
//告警管理 ->告警配置 遥测重置按钮 event:configure:ycResetting
|
||||
String EVENT_CONFIGURE_YCRESETTING = "event:configure:ycResetting";
|
||||
|
||||
//告警管理 ->告警配置 遥测保存按钮 event:configure:ycSave
|
||||
String EVENT_CONFIGURE_YCSAVE = "event:configure:ycSave";
|
||||
|
||||
//告警管理 ->告警配置 遥信编辑按钮 event:configure:yxedit
|
||||
String EVENT_CONFIGURE_YXEDIT = "event:configure:yxedit";
|
||||
|
||||
//电价管理 ->电价 添加按钮 business:industrialprice:add
|
||||
String BUSINESS_INDUSTRIALPRICE_ADD = "business:industrialprice:add";
|
||||
|
||||
//电价管理 ->电价 删除按钮 business:industrialprice:del
|
||||
String BUSINESS_INDUSTRIALPRICE_DEL = "business:industrialprice:del";
|
||||
|
||||
//电价管理 ->电价 编辑按钮 business:industrialprice:edit
|
||||
String BUSINESS_INDUSTRIALPRICE_EDIT = "business:industrialprice:edit";
|
||||
|
||||
//电价管理 ->电价 数据采集按钮 business:industrialprice:collect
|
||||
String BUSINESS_INDUSTRIALPRICE_COLLECT = "business:industrialprice:collect";
|
||||
|
||||
String BUSINESS_PEAK_DELETE = "business:peak:delete";
|
||||
|
||||
//曲线配置
|
||||
String CURVE_BATCH_CONFIGURATION = "business:dynamicConfig:addCurveList";
|
||||
|
||||
//点位配置
|
||||
String ADDPOINTLIST = "business:dynamicConfig:addPointList";
|
||||
|
||||
//同步动态配置
|
||||
String SYNCDYNAMICCONFIG = "business:dynamicConfig:syncDynamicConfig";
|
||||
|
||||
//删除动态标题
|
||||
String DELDYNAMICCONFIGTITLE = "business:dynamicConfig:delDynamicConfigTitle";
|
||||
|
||||
//收益分析-收益报表-一键计算
|
||||
String ONEKEYCOMPUTATION = "business:earningsCalculate:oneKeyComputation";
|
||||
|
||||
//保存品质
|
||||
String SAVEQUALITY = "business:substitutionValue:addPoint";
|
||||
|
||||
//更改历史值
|
||||
String MODIFY_HISTORY_DATA = "business:point:modifyHistoryData";
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,375 @@
|
||||
package com.ho.common.tools.constant;
|
||||
|
||||
/**
|
||||
* @author fancl
|
||||
* @desc: RedisKey常量
|
||||
* @date 2022/8/23
|
||||
*/
|
||||
public interface RedisKeyConstant {
|
||||
//电站
|
||||
String STATION = "station:";
|
||||
//电站
|
||||
String DEVICE = "device:";
|
||||
//收益
|
||||
String EARNINGS = "earnings:";
|
||||
//收益备份
|
||||
String EARNINGS_BACK = "earningsBack:";
|
||||
//BMS
|
||||
String BMS = "bms:";
|
||||
//储能变流器
|
||||
String PCS = "pcs:";
|
||||
//电表
|
||||
String ELE_METER = "ele_meter:";
|
||||
//一体机柜
|
||||
String DEVICE001 = "device001:";
|
||||
|
||||
//通用电表
|
||||
String COMMON_ELEMETER = "commonElemeter:";
|
||||
//气象仪
|
||||
String WEATHER_STATION = "weatherStation:";
|
||||
//每5分钟的时间间隔对象key
|
||||
String FIVE_MINUTE_INTERVAL = "minute_interval:fiveMinute";
|
||||
|
||||
//每2分钟的时间间隔对象key
|
||||
String ONE_MINUTE_INTERVAL = "minute_interval:oneMinute";
|
||||
//每30分钟的时间间隔对象key
|
||||
String THIRTY_MINUTE_INTERVAL = "minute_interval:thirty";
|
||||
//每60分钟的时间间隔对象key
|
||||
String SIXTY_MINUTE_INTERVAL = "minute_interval:sixtyMinute";
|
||||
|
||||
//每一天为时间间隔对象key
|
||||
String ONE_DAY_INTERVAL = "day_interval:oneDay";
|
||||
//每个月生成一个key
|
||||
String MONTH_INTERVAL = "day_interval:month";
|
||||
|
||||
//工单的分布式锁
|
||||
String LOCK_KEY_WORK_ORDER = "lockKeyWorkOrder";
|
||||
//电价模板的分布式锁
|
||||
String LOCK_KEY_PRICE_TEMPLATE = "lockKeyPriceTemplate";
|
||||
//菜单的分布式锁
|
||||
String LOCK_KEY_PERMISSION = "lockKeyPermission";
|
||||
|
||||
//设备分布式锁
|
||||
String LOCK_KEY_DEVICE = "lockKeyDevice";
|
||||
|
||||
//告警配置 批量
|
||||
String LOCK_KEY_ALARM_CONFIG = "lockKeyAlarmConfig";
|
||||
|
||||
//模型配置批量
|
||||
String LOCK_KEY_MODEL_CONFIG = "lockKeyModelConfig";
|
||||
|
||||
//设备字段批量
|
||||
String LOCK_KEY_EQUIPMENT_FIELD = "lockKeyEquipmentField";
|
||||
|
||||
//模型设备关联
|
||||
String LOCK_KEY_MODEL_EQUIPMENT_ASSOCIATION = "modelEquipmentAssociation";
|
||||
|
||||
//运行评价的总得分前缀
|
||||
String OPERATION_EVALUATION = "totalScore:";
|
||||
|
||||
//天气的缓存前缀
|
||||
String WEATHER_TEMPERATURE = "weather:";
|
||||
//根据IP缓存天气缓存
|
||||
String WEATHER_IP = "weatherIp:";
|
||||
|
||||
//文件的缓存前缀
|
||||
String FILE_STATIONID_FILEPATH = "file:";
|
||||
|
||||
//判断文件通道是否被占用
|
||||
String FILE_USING = "file_using";
|
||||
|
||||
//文件交互状态
|
||||
String FILE_STATUS = "file_status";
|
||||
|
||||
//文件下发所有状态
|
||||
String FILE_SEND_ALL = "file_send_all";
|
||||
|
||||
//文件下发状态
|
||||
String FILE_SEND_STATUS = "file_send_status";
|
||||
|
||||
//文件下发消息
|
||||
String FILE_SEND_MSG = "file_send_msg";
|
||||
|
||||
//文件下发进度
|
||||
String FILE_PROCESS = "file_process";
|
||||
|
||||
//文件下发备份进度
|
||||
String FILE_BACK_PROCESS = "file_back_process";
|
||||
//文件下发备份进度时间
|
||||
String FILE_BACK_TIME = "file_back_time";
|
||||
|
||||
//文件消息
|
||||
String FILE_MSG = "file_msg";
|
||||
|
||||
//文件名称
|
||||
String FILE_NAME = "file_name";
|
||||
//文件原始路径
|
||||
String FILE_SRC_PATH = "file_src_path";
|
||||
|
||||
//文件下载所有状态
|
||||
String DOWNLOAD_FILE_ALL = "download_file_all";
|
||||
|
||||
//云端读文件属性
|
||||
String CLOUD_READ_ATTRIBUTE = "cloud_read_attribute";
|
||||
|
||||
//云端删除边端文件
|
||||
String CLOUD_DELETE_DEVICE_FILE = "cloud_delete_device_file";
|
||||
|
||||
//云端修改边端文件属性
|
||||
String CLOUD_MODIFY_DEVICE_FILE = "cloud_modify_device_file";
|
||||
|
||||
//云端修改边端文件属性
|
||||
String CLOUD_MODIFY_DEVICE_PERMISSION = "cloud_modify_device_permission";
|
||||
|
||||
String IS_END = "is_end";
|
||||
|
||||
//边端回应值
|
||||
String DEVICE_RESPONSE = "device_response";
|
||||
|
||||
//命令下发通道是否被占用
|
||||
String ORDER_USING = "order_using";
|
||||
|
||||
//读文件属性路径
|
||||
String FILE_PATH = "file_path";
|
||||
|
||||
//读文件属性SN
|
||||
String FILE_ATTRIBUTE_SN = "file_attribute_sn";
|
||||
|
||||
//读文件属性SN
|
||||
String FILE_TYPE = "file_type";
|
||||
|
||||
//消息
|
||||
String MSG = "msg";
|
||||
|
||||
//文件批量下发下发所有状态
|
||||
String FILE_BATCH_SEND_ALL = "file_batch_send_all";
|
||||
|
||||
//云端读文件
|
||||
String CLOUD_READ = "cloud:read";
|
||||
//边端读文件
|
||||
String EDGE_READ = "edge:read";
|
||||
|
||||
//云端写文件
|
||||
String CLOUD_WRITE = "cloud:write";
|
||||
|
||||
//禾望逆变器
|
||||
String INVERTER = "inverter:";
|
||||
|
||||
|
||||
//心跳
|
||||
String HEARTBEAT = "heartbeat:";
|
||||
|
||||
|
||||
//收益统计
|
||||
String REVENUE_STATISTICS = "revenue_statistics:";
|
||||
|
||||
/****************计划曲线相关*******************/
|
||||
interface PlanPower{
|
||||
String CURVE = "curve:";
|
||||
String DISPATCH = "dispatch:";
|
||||
}
|
||||
|
||||
/****************文件属性相关*******************/
|
||||
//文件名称
|
||||
String NAME = "name";
|
||||
//所有者
|
||||
String USER = "user";
|
||||
//文件类型
|
||||
String FILETYPE = "fileType";
|
||||
//修改时间
|
||||
String TIME = "time";
|
||||
//文件大小
|
||||
String SIZE = "size";
|
||||
//权限
|
||||
String PERMISSION = "permission";
|
||||
//原始文件大小
|
||||
String ORIGINALSIZE = "originalSize";
|
||||
|
||||
interface Channel{
|
||||
|
||||
//API方式
|
||||
String API = "api";
|
||||
}
|
||||
|
||||
//用户权限相关
|
||||
interface User {
|
||||
|
||||
//用户信息键值对 1
|
||||
String TOKEN = "token:";
|
||||
//用户信息键值对 2
|
||||
String USER_NAME = "userName:";
|
||||
|
||||
//大屏token
|
||||
String TOKEN_LARGE_SCREEN = "tokenLargeScreen:";
|
||||
//用户信息键值对 2
|
||||
String USER_NAME_LARGE_SCREEN = "userNameLargeScreen:";
|
||||
//通用大屏token
|
||||
String TOKEN_COMMON_LARGE_SCREEN = "tokenCommonLargeScreen:";
|
||||
|
||||
//用户信息键值对 3 手机号 暂时没用到
|
||||
String PHONE = "phone:";
|
||||
// token
|
||||
String ACCESS_TOKEN = "authorization";
|
||||
// 用户权鉴缓存 key
|
||||
// String IDENTIFY_CACHE_KEY="shiro-cache:com.ho.user.CustomRealm.authorizationCache:";
|
||||
String IDENTIFY_CACHE_KEY = "shiro-cache:com.ho.user.config.shiro.CustomRealm.authorizationCache:";
|
||||
//登陆渠道 pc
|
||||
String LOGIN_CHANNEL_PC = "pc";
|
||||
//登陆渠道 app
|
||||
String LOGIN_CHANNEL_APP = "app";
|
||||
//登陆方式 account 账号
|
||||
String LOGIN_TYPE_ACCOUNT = "account";
|
||||
//登陆方式 phone 手机号
|
||||
String LOGIN_TYPE_PHONE = "phone";
|
||||
}
|
||||
|
||||
//设备相关
|
||||
interface Device {
|
||||
|
||||
//实时充电桩数据
|
||||
String REAL_TIME_CHARGING_PILE = "realTimeChargingPileList:";
|
||||
//实时充电枪数据
|
||||
String REAL_TIME_CHARGING_GUN = "realTimeChargingGunList:";
|
||||
|
||||
//充电桩主面板数据缓存
|
||||
String PILE_MAIN_PANEL = "pileMainPanel:";
|
||||
|
||||
}
|
||||
|
||||
//MQTT相关
|
||||
interface MQTT {
|
||||
//登录缓存
|
||||
String LOGIN = "login:";
|
||||
//登录黑名单
|
||||
String BLACK = "black:";
|
||||
}
|
||||
|
||||
//光伏电站相关
|
||||
interface PV {
|
||||
//光伏电站当日收益
|
||||
String STATION_PV_TODAY_PROFIT = "stationPvTodayProfit:";
|
||||
//累计充电量 ,对应平台模型逆变器累计充电量
|
||||
String CUMULATIVE_POWER_GENERATION = "cumulativePowerGeneration";
|
||||
//发电量和收益曲线
|
||||
String POWER_GENERATION_CURVE = "pvStation:powerGenerationCurve:";
|
||||
|
||||
}
|
||||
|
||||
//驾驶舱相关
|
||||
interface COCKPIT {
|
||||
//累计光伏发电量
|
||||
String PV_POWER_GENERATION = "cockpit:pvPowerGeneration:";
|
||||
//储能累计放电量
|
||||
String ENERGY_POWER_GENERATION = "cockpit:energyPowerGeneration:";
|
||||
//充电桩累计放电量
|
||||
String CHARGE_PILE_POWER_GENERATION = "cockpit:chargePilePowerGeneration:";
|
||||
//集团数据
|
||||
String GROUP_DATA = "cockpitHome:groupData:";
|
||||
//累计总和
|
||||
String CUMULATIVE = "cockpitHome:cumulative:";
|
||||
//电站地图
|
||||
String STATION_MAP = "cockpitHome:stationMap:";
|
||||
//给电站用的大屏数据
|
||||
String FOR_STATION_COCKPIT = "cockpitHome:forStationCockpit:";
|
||||
|
||||
}
|
||||
|
||||
|
||||
interface PCS_DEVICE {
|
||||
|
||||
//停机状态(shutdownStatus)
|
||||
String SHUTDOWN_STATUS = "shutdownStatus";
|
||||
//待机状态(readinessStatus)
|
||||
String READINESS_STATUS = "readinessStatus";
|
||||
//运行状态(runningStatus)
|
||||
String RUNNING_STATUS = "runningStatus";
|
||||
//总故障状态 totalFaultStatus
|
||||
String TOTAL_FAULT_STATUS = "totalFaultStatus";
|
||||
//远程就地状态 remoteLocalStatus
|
||||
String REMOTE_LOCAL_STATUS = "remoteLocalStatus";
|
||||
//电网频率 grid
|
||||
String GRID = "grid";
|
||||
|
||||
}
|
||||
|
||||
interface BMS_DEVICE {
|
||||
//可充电电量 rechargeCapacity
|
||||
String RECHARGE_CAPACITY = "rechargeCapacity";
|
||||
|
||||
//可放电电量 dischargeCapacity
|
||||
String DISCHARGE_CAPACITY = "dischargeCapacity";
|
||||
|
||||
//日充
|
||||
String DAY_CHARGE = "dailyCharge";
|
||||
//日放
|
||||
String DAY_DISCHARGE = "dailyDischarge";
|
||||
//月充
|
||||
String MONTH_CHARGE = "monthCharge";
|
||||
//月放
|
||||
String MONTH_DISCHARGE = "monthDischarge";
|
||||
//年充
|
||||
String YEAR_CHARGE = "yearCharge";
|
||||
//年放
|
||||
String YEAR_DISCHARGE = "yearDischarge";
|
||||
|
||||
//总充
|
||||
String TOTAL_CHARGE = "totalCharge";
|
||||
//总放
|
||||
String TOTAL_DISCHARGE = "totalDischarge";
|
||||
}
|
||||
|
||||
//移动卡流量监控
|
||||
interface MOBILE_CARD{
|
||||
//锁的名字
|
||||
String LOCK_NAME= "mobileTraffic";
|
||||
//redis中的交易序号的键值
|
||||
String TRANS_ID = "traffic:transId";
|
||||
//移动运营商
|
||||
String OPERATOR_MOBILE = "mobile";
|
||||
}
|
||||
|
||||
//电站id
|
||||
String STATION_ID = "stationId";
|
||||
|
||||
interface CUSTOM{
|
||||
//建科院标志
|
||||
String CUSTOM_PLAN = "customPlan";
|
||||
//soc上限
|
||||
String SOC_UPPER = "socUpper";
|
||||
//soc下限
|
||||
String SOC_LOWER = "socLower";
|
||||
}
|
||||
|
||||
//告警缓存
|
||||
interface ALARM{
|
||||
//集团级告警
|
||||
String GROUP_ALARM_CONFIG = "groupAlarmConfig:";
|
||||
//电站级告警
|
||||
String COMPANY_ALARM_CONFIG = "companyAlarmConfig:";
|
||||
}
|
||||
//点表缓存key
|
||||
String DEVICE_TYPE_COL = "deviceTypeCol:";
|
||||
|
||||
//五遥表缓存
|
||||
interface COL{
|
||||
//遥测缓存
|
||||
String DEVICE_YC_COL = "deviceYCCol:";
|
||||
//遥信缓存
|
||||
String DEVICE_YX_COL = "deviceYXCol:";
|
||||
//遥控缓存
|
||||
String DEVICE_YK_COL = "deviceYKCol:";
|
||||
}
|
||||
//转发数据
|
||||
String FORWARD_DATA = "forwardData:";
|
||||
//设备类型表
|
||||
String DEVICE_TYPE_CONFIG = "deviceTypeConfig:";
|
||||
//接收数据-设备
|
||||
String DEVICE_PUSH = "devicePush:";
|
||||
//天气key
|
||||
String WEATHER_PROVINCE_CITY = "weatherProvinceCity:";
|
||||
//聚合告警
|
||||
String POLYMERIZATION = "polymerization:";
|
||||
|
||||
//点数据集合 pointListData
|
||||
String POINT_LIST_DATA = "pointListData:";
|
||||
}
|
||||
@ -0,0 +1,12 @@
|
||||
package com.ho.common.tools.constant;
|
||||
|
||||
/**
|
||||
* @author xwz
|
||||
* @desc: 公共常量-符号
|
||||
* @date 2022/8/18
|
||||
*/
|
||||
public interface SymbolConstant {
|
||||
|
||||
//逗号
|
||||
String COMMA = ",";
|
||||
}
|
||||
@ -0,0 +1,14 @@
|
||||
package com.ho.common.tools.constant;
|
||||
|
||||
/**
|
||||
* 表相关常量
|
||||
*/
|
||||
public interface TableConstant {
|
||||
|
||||
//点表
|
||||
String DEVICE_TYPE_COL = "device_type_col";
|
||||
//点表key
|
||||
String COL = "col";
|
||||
//值
|
||||
String VAL = "val";
|
||||
}
|
||||
135
common-tools/src/main/java/com/ho/common/tools/enc/EncTools.java
Normal file
135
common-tools/src/main/java/com/ho/common/tools/enc/EncTools.java
Normal file
@ -0,0 +1,135 @@
|
||||
package com.ho.common.tools.enc;
|
||||
|
||||
import sun.misc.BASE64Decoder;
|
||||
import sun.misc.BASE64Encoder;
|
||||
|
||||
import javax.crypto.Cipher;
|
||||
import java.security.*;
|
||||
import java.security.interfaces.RSAPrivateKey;
|
||||
import java.security.interfaces.RSAPublicKey;
|
||||
import java.security.spec.PKCS8EncodedKeySpec;
|
||||
import java.security.spec.X509EncodedKeySpec;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author fancl
|
||||
* @desc: 加解密工具
|
||||
* @date 2023/5/21
|
||||
*/
|
||||
public class EncTools {
|
||||
|
||||
/**
|
||||
* 密钥长度 于原文长度对应 以及越长速度越慢
|
||||
*/
|
||||
private final static int KEY_SIZE = 1024;
|
||||
/**
|
||||
* 用于封装随机产生的公钥与私钥
|
||||
*/
|
||||
private static Map<Integer, String> keyMap = new HashMap<Integer, String>();
|
||||
|
||||
/**
|
||||
* 随机生成密钥对
|
||||
* @throws Exception
|
||||
*/
|
||||
public static void genKeyPair() throws Exception {
|
||||
|
||||
|
||||
// KeyPairGenerator类用于生成公钥和私钥对,基于RSA算法生成对象
|
||||
KeyPairGenerator keyPairGen = KeyPairGenerator.getInstance("RSA");
|
||||
// 初始化密钥对生成器
|
||||
keyPairGen.initialize(KEY_SIZE, new SecureRandom());
|
||||
// 生成一个密钥对,保存在keyPair中
|
||||
KeyPair keyPair = keyPairGen.generateKeyPair();
|
||||
// 得到私钥
|
||||
RSAPrivateKey privateKey = (RSAPrivateKey) keyPair.getPrivate();
|
||||
// 得到公钥
|
||||
RSAPublicKey publicKey = (RSAPublicKey) keyPair.getPublic();
|
||||
String publicKeyString = encryptBASE64(publicKey.getEncoded());
|
||||
// 得到私钥字符串
|
||||
String privateKeyString = encryptBASE64(privateKey.getEncoded());
|
||||
// 将公钥和私钥保存到Map
|
||||
//0表示公钥
|
||||
keyMap.put(0, publicKeyString);
|
||||
//1表示私钥
|
||||
keyMap.put(1, privateKeyString);
|
||||
}
|
||||
|
||||
/**
|
||||
* RSA公钥加密
|
||||
*
|
||||
* @param str 加密字符串
|
||||
* @param publicKey 公钥
|
||||
* @return 密文
|
||||
* @throws Exception 加密过程中的异常信息
|
||||
*/
|
||||
public static String encrypt(String str,String publicKey) throws Exception {
|
||||
//base64编码的公钥
|
||||
byte[] decoded = decryptBASE64(publicKey);
|
||||
//Security.addProvider(new org.bouncycastle.jce.provider.BouncyCastleProvider());
|
||||
RSAPublicKey pubKey = (RSAPublicKey) KeyFactory.getInstance("RSA").generatePublic(new X509EncodedKeySpec(decoded));
|
||||
//RSA加密
|
||||
Cipher cipher = Cipher.getInstance("RSA");
|
||||
cipher.init(Cipher.ENCRYPT_MODE, pubKey);
|
||||
String outStr = encryptBASE64(cipher.doFinal(str.getBytes("UTF-8")));
|
||||
return outStr;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* RSA私钥解密
|
||||
*
|
||||
* @param str 加密字符串
|
||||
* @param privateKey 私钥
|
||||
* @return 明文
|
||||
* @throws Exception 解密过程中的异常信息
|
||||
*/
|
||||
public static String decrypt(String str, String privateKey) throws Exception {
|
||||
//64位解码加密后的字符串
|
||||
byte[] inputByte = decryptBASE64(str);
|
||||
//base64编码的私钥
|
||||
byte[] decoded = decryptBASE64(privateKey);
|
||||
//Security.addProvider(new org.bouncycastle.jce.provider.BouncyCastleProvider());
|
||||
RSAPrivateKey priKey = (RSAPrivateKey) KeyFactory.getInstance("RSA").generatePrivate(new PKCS8EncodedKeySpec(decoded));
|
||||
//RSA解密
|
||||
Cipher cipher = Cipher.getInstance("RSA");
|
||||
cipher.init(Cipher.DECRYPT_MODE, priKey);
|
||||
String outStr = new String(cipher.doFinal(inputByte));
|
||||
return outStr;
|
||||
}
|
||||
|
||||
//编码返回字符串
|
||||
public static String encryptBASE64(byte[] key) throws Exception {
|
||||
return (new BASE64Encoder()).encodeBuffer(key);
|
||||
}
|
||||
|
||||
//解码返回byte
|
||||
public static byte[] decryptBASE64(String key) throws Exception {
|
||||
return (new BASE64Decoder()).decodeBuffer(key);
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
//解密数据
|
||||
try {
|
||||
//生成公钥和私钥
|
||||
genKeyPair();
|
||||
String publicKey = keyMap.get(0);
|
||||
System.out.println("公钥:" + publicKey);
|
||||
String privateKey = keyMap.get(1);
|
||||
System.out.println("私钥:" + privateKey);
|
||||
|
||||
String orgData = "储能系统平台";
|
||||
System.out.println("原数据:" + orgData);
|
||||
String encryptStr =encrypt(orgData,publicKey);
|
||||
System.out.println("加密结果:" + encryptStr);
|
||||
|
||||
String decryptStr = decrypt(encryptStr,privateKey);
|
||||
System.out.println("解密结果:" + decryptStr);
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,18 @@
|
||||
package com.ho.common.tools.entity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author fancl
|
||||
* @desc: 批量删除实体
|
||||
* @date 2023/2/24
|
||||
*/
|
||||
@Data
|
||||
public class BatchDelete {
|
||||
|
||||
@NotEmpty(message = "ids不能为空数组")
|
||||
List<Integer> ids;
|
||||
}
|
||||
@ -0,0 +1,25 @@
|
||||
package com.ho.common.tools.entity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author xueweizhi
|
||||
* @desc: 一体机柜缓存中的数据实体
|
||||
* @date 2023/3/27
|
||||
*/
|
||||
@Data
|
||||
public class DeviceRedis {
|
||||
|
||||
/**
|
||||
* 值
|
||||
*/
|
||||
BigDecimal value;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
Date updateTime;
|
||||
}
|
||||
@ -0,0 +1,29 @@
|
||||
package com.ho.common.tools.entity;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author gyan
|
||||
* @DateTime: 2023/6/20 14:21
|
||||
*/
|
||||
@Data
|
||||
public class HisPointCurveReqVo {
|
||||
|
||||
@ApiModelProperty(value = "电站id")
|
||||
Integer stationId;
|
||||
|
||||
@ApiModelProperty(value = "设备id")
|
||||
Integer srcId;
|
||||
|
||||
@ApiModelProperty(value = "设备类型")
|
||||
String deviceType;
|
||||
|
||||
@ApiModelProperty(value = "col")
|
||||
String col;
|
||||
|
||||
@ApiModelProperty(value = "中文字段")
|
||||
String colName;
|
||||
}
|
||||
@ -0,0 +1,33 @@
|
||||
package com.ho.common.tools.entity;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author xwz
|
||||
* @desc: 地址实体
|
||||
* @date 2023/6/8
|
||||
*/
|
||||
@Data
|
||||
public class MyAddress {
|
||||
//省份
|
||||
private String province;
|
||||
//广告代码
|
||||
private String adcode;
|
||||
//国家
|
||||
private String nation;
|
||||
//城市
|
||||
private String city;
|
||||
//地区
|
||||
private String district;
|
||||
//地址
|
||||
private String name;
|
||||
//城市编码
|
||||
private String cityCode;
|
||||
//经纬度
|
||||
private JSONObject location;
|
||||
//国家代码
|
||||
private String nationCode;
|
||||
//电话号码开头
|
||||
private String phoneAreaCode;
|
||||
}
|
||||
@ -0,0 +1,32 @@
|
||||
package com.ho.common.tools.entity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author fancl
|
||||
* @desc: 用单的部门人员对象
|
||||
* @date 2023/2/6
|
||||
*/
|
||||
@Data
|
||||
public class OrderDept {
|
||||
|
||||
|
||||
String id;
|
||||
|
||||
Integer pid;
|
||||
|
||||
Integer deptId;
|
||||
|
||||
String name;
|
||||
|
||||
//"dept" "person"
|
||||
String type;
|
||||
|
||||
String userId;
|
||||
//子集
|
||||
List<OrderDept> children;
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,121 @@
|
||||
package com.ho.common.tools.entity;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import com.ho.common.tools.constant.CommonConstant;
|
||||
import com.ho.common.tools.entity.file.OrderFile;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import org.hibernate.validator.constraints.Length;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class OrderForm {
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@ApiModelProperty(value = "id",hidden = true)
|
||||
private Integer id;
|
||||
|
||||
|
||||
@ApiModelProperty(value = "集团id",hidden = true)
|
||||
private Integer groupId;
|
||||
|
||||
|
||||
@ApiModelProperty(value = "工单号",hidden = true)
|
||||
private String orderNum;
|
||||
/**
|
||||
* 电站id
|
||||
*/
|
||||
@ApiModelProperty(value = "电站id")
|
||||
private Integer stationId;
|
||||
|
||||
@ApiModelProperty(value = "发起人id",hidden = true)
|
||||
private String userId;
|
||||
|
||||
@ApiModelProperty(value = "发起人名字")
|
||||
private String startUserName;
|
||||
|
||||
//告警id
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
@ApiModelProperty(value = "告警id")
|
||||
private Long eventId;
|
||||
|
||||
|
||||
/**
|
||||
* 设备id
|
||||
*/
|
||||
@ApiModelProperty(value = "设备id")
|
||||
private Integer deviceId;
|
||||
|
||||
|
||||
/**
|
||||
* 标题
|
||||
*/
|
||||
@ApiModelProperty(value = "标题")
|
||||
@Length(max = 50,message = "标题不能超过50个字符")
|
||||
private String title;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@ApiModelProperty(value = "备注")
|
||||
@Length(max = 200,message = "备注不能超过200个字符")
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@ApiModelProperty(value = "建议")
|
||||
@Length(max = 200,message = "建议不能超过200个字符")
|
||||
private String suggestion;
|
||||
|
||||
/**
|
||||
* 计划处理时间
|
||||
*/
|
||||
@DateTimeFormat(pattern = CommonConstant.DATE)
|
||||
@JsonFormat(pattern = CommonConstant.DATE)
|
||||
@ApiModelProperty(value = "计划处理时间")
|
||||
private Date plannedTime;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@ApiModelProperty(value = "创建时间",hidden = true)
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 优先级 ,可以从字典定义取值
|
||||
*/
|
||||
@ApiModelProperty(value = "优先级")
|
||||
private Integer priority;
|
||||
|
||||
/**
|
||||
* 工单类型
|
||||
*/
|
||||
@ApiModelProperty(value = "工单类型 1:故障检修单 2:电站巡检单 3:电站清洗单")
|
||||
private Integer orderType;
|
||||
|
||||
@ApiModelProperty(value = "流程id")
|
||||
private String processInstanceId;
|
||||
|
||||
@ApiModelProperty(value = "流程key")
|
||||
private String processInstanceKey;
|
||||
/**
|
||||
* 表单状态
|
||||
*/
|
||||
@ApiModelProperty(value = "0:未发起 1:已发起 ")
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
* 文件集合
|
||||
*/
|
||||
@ApiModelProperty(value = "文件集合")
|
||||
private List<OrderFile> orderFiles = new ArrayList<>();
|
||||
}
|
||||
@ -0,0 +1,48 @@
|
||||
package com.ho.common.tools.entity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName: PageVO
|
||||
* 分页VO
|
||||
* @Author: fancl
|
||||
* @CreateDate: 2019/9/19 13:25
|
||||
* @UpdateUser: fancl
|
||||
* @UpdateDate: 2019/9/19 13:25
|
||||
* @Version: 0.0.1
|
||||
*/
|
||||
@Data
|
||||
public class PageVO<T> {
|
||||
/**
|
||||
* serial_number
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 总记录数
|
||||
*/
|
||||
private Long totalRows;
|
||||
/**
|
||||
* 总页数
|
||||
*/
|
||||
private Integer totalPages;
|
||||
/**
|
||||
* 当前第几页
|
||||
*/
|
||||
private Integer pageNum;
|
||||
/**
|
||||
* 每页记录数
|
||||
*/
|
||||
private Integer pageSize;
|
||||
/**
|
||||
* 当前页记录数
|
||||
*/
|
||||
private Integer curPageSize;
|
||||
/**
|
||||
* 数据列表
|
||||
*/
|
||||
private List<T> list;
|
||||
|
||||
}
|
||||
@ -0,0 +1,42 @@
|
||||
package com.ho.common.tools.entity;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author fancl
|
||||
* @desc: 包含设备id和点表字段的请求体
|
||||
* @date 2023/3/24
|
||||
*/
|
||||
@Data
|
||||
public class PointCurveSrcCol {
|
||||
|
||||
@ApiModelProperty(value = "设备id")
|
||||
Integer srcId;
|
||||
|
||||
@ApiModelProperty(value = "设备类型")
|
||||
String deviceType;
|
||||
|
||||
@ApiModelProperty(value = "点表字段列表")
|
||||
List<String> cols;
|
||||
|
||||
@ApiModelProperty(value = "设备名称",hidden = true)
|
||||
String deviceName;
|
||||
|
||||
@ApiModelProperty(value = "字段列表与系数直接的映射")
|
||||
Map<String, BigDecimal> map;
|
||||
|
||||
/************2024-06-07为组态动态表加******************/
|
||||
@ApiModelProperty(value = "td表名",hidden = true)
|
||||
String tableName;
|
||||
|
||||
@ApiModelProperty(value = "字段列",hidden = true)
|
||||
String col;
|
||||
|
||||
@ApiModelProperty(value = "曲线图例",hidden = true)
|
||||
String legend;
|
||||
}
|
||||
@ -0,0 +1,18 @@
|
||||
package com.ho.common.tools.entity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @Description TODO
|
||||
* Author yule
|
||||
* Date 2022/9/15 18:15
|
||||
*/
|
||||
@Data
|
||||
public class PriceTemp {
|
||||
Date start;
|
||||
Date end;
|
||||
BigDecimal value;
|
||||
}
|
||||
@ -0,0 +1,33 @@
|
||||
package com.ho.common.tools.entity;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class ProcessOrder {
|
||||
|
||||
/**
|
||||
* 工单管理id
|
||||
*/
|
||||
@ApiModelProperty(value = "工单管理id")
|
||||
Integer processManagementId;
|
||||
|
||||
@ApiModelProperty(value = "工单表单对象")
|
||||
@Valid
|
||||
OrderForm orderForm;
|
||||
|
||||
@ApiModelProperty(value = "当前登录人id", hidden = true)
|
||||
String userId;
|
||||
|
||||
@ApiModelProperty(value = "租户id", hidden = true)
|
||||
String tenantId;
|
||||
|
||||
@ApiModelProperty(value = "流程key")
|
||||
private String key;
|
||||
|
||||
@ApiModelProperty(value = "用户列表id")
|
||||
List<String> userList;
|
||||
}
|
||||
@ -0,0 +1,50 @@
|
||||
package com.ho.common.tools.entity;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author fancl
|
||||
* @desc:
|
||||
* @date 2022/8/24
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
public class SimpleUser implements Serializable {
|
||||
|
||||
String userId;
|
||||
|
||||
Integer groupId;
|
||||
|
||||
Integer deptId;
|
||||
|
||||
//用户的token
|
||||
String token;
|
||||
|
||||
//对称密钥
|
||||
String aesKey;
|
||||
//iv
|
||||
String iv;
|
||||
|
||||
//平台超管 true 是 false不是
|
||||
Boolean platSuper;
|
||||
|
||||
List<Integer> depts;
|
||||
//电站id列表
|
||||
List<Integer> stationIds;
|
||||
|
||||
//岗位列表
|
||||
List<String> positions;
|
||||
|
||||
//用户等级
|
||||
Integer userLevel;
|
||||
|
||||
//工作流租户id
|
||||
String tenantId;
|
||||
}
|
||||
@ -0,0 +1,94 @@
|
||||
package com.ho.common.tools.entity;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
public class SysPermission implements Serializable {
|
||||
|
||||
@ApiModelProperty(value = "id")
|
||||
private Integer id;
|
||||
|
||||
@ApiModelProperty(value = "菜单权限编码")
|
||||
private String code;
|
||||
|
||||
@ApiModelProperty(value = "菜单权限名称")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(value = "菜单权限标识,shiro 适配restful")
|
||||
private String perms;
|
||||
|
||||
@ApiModelProperty(value = "访问地址URL")
|
||||
private String url;
|
||||
|
||||
@ApiModelProperty(value = "APP访问地址URL")
|
||||
private String urlApp;
|
||||
|
||||
@ApiModelProperty(value = "icon图标")
|
||||
private String icon;
|
||||
|
||||
@ApiModelProperty(value = "icon图标(app使用)")
|
||||
private String iconApp;
|
||||
|
||||
@ApiModelProperty(value = "请求方式 和url 配合使用 (我们用 路径匹配的方式做权限管理的时候用到)")
|
||||
private String method;
|
||||
|
||||
@ApiModelProperty(value = "父级id")
|
||||
private Integer pid;
|
||||
|
||||
@ApiModelProperty(value = "父级名称")
|
||||
private String pidName;
|
||||
|
||||
@ApiModelProperty(value = "排序码")
|
||||
private Integer orderNum;
|
||||
|
||||
@ApiModelProperty(value = "菜单权限类型(1:目录;2:菜单;3:按钮)")
|
||||
private Integer type;
|
||||
|
||||
@ApiModelProperty(value = "菜单展示类型:all(通用类型) pc(仅PC端展示) app(仅APP展示)")
|
||||
private String show;
|
||||
|
||||
@ApiModelProperty(value = "颜色,只有APP会用到")
|
||||
private String color;
|
||||
|
||||
@ApiModelProperty(value = "启用状态:1:启用;2:未启用")
|
||||
private Integer status;
|
||||
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
private Date createTime;
|
||||
|
||||
@ApiModelProperty(value = "更新时间")
|
||||
private Date updateTime;
|
||||
|
||||
@ApiModelProperty(value = "是否删除")
|
||||
private Integer deleted;
|
||||
|
||||
@ApiModelProperty(value = "子菜单或子按钮集合")
|
||||
private List<?> children = new ArrayList<>();
|
||||
|
||||
@ApiModelProperty(value = "菜单与电站关系 (1:公共;2:专用)")
|
||||
private Integer scope;
|
||||
|
||||
@ApiModelProperty(value = "是否组态页面 (1:是;0:否)")
|
||||
private Integer isConfig;
|
||||
|
||||
@ApiModelProperty(value = "组态地址")
|
||||
private String component;
|
||||
|
||||
@ApiModelProperty(value = "路由名称")
|
||||
private String menuName;
|
||||
|
||||
@ApiModelProperty(value = "菜单所关联的电站")
|
||||
private List<Integer> stationList;
|
||||
|
||||
private String nameEn;
|
||||
}
|
||||
@ -0,0 +1,40 @@
|
||||
package com.ho.common.tools.entity;
|
||||
|
||||
/**
|
||||
* Role实体
|
||||
*/
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
public class SysRole implements Serializable {
|
||||
private Integer id;
|
||||
|
||||
private String name;
|
||||
|
||||
private String code;
|
||||
|
||||
private String description;
|
||||
|
||||
private Integer status;
|
||||
|
||||
private Date createTime;
|
||||
|
||||
private Date updateTime;
|
||||
|
||||
private Integer deleted;
|
||||
|
||||
//private List<PermissionRespNode> permissionRespNodes;
|
||||
|
||||
private List<Integer> permissions;
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,77 @@
|
||||
package com.ho.common.tools.entity;
|
||||
|
||||
import com.ho.common.tools.vo.req.PositionVo;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author fancl
|
||||
* @desc: 包含用户角色列表 菜单列表 权限列表
|
||||
* @date 2022/8/15
|
||||
*/
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
public class UserDetailRespVO {
|
||||
|
||||
@ApiModelProperty(value = "用户id")
|
||||
private String userId;
|
||||
|
||||
private Integer groupId;
|
||||
|
||||
@ApiModelProperty(value = "用户名")
|
||||
private String username;
|
||||
|
||||
@ApiModelProperty(value = "手机号")
|
||||
private String phone;
|
||||
|
||||
@ApiModelProperty(value = "登陆渠道:pc / app ,对应登陆是送的type")
|
||||
private String loginChannel;
|
||||
|
||||
@ApiModelProperty(value = "登陆类型:account:账号方式 phone:手机方式 ,后台判断")
|
||||
private String loginType;
|
||||
|
||||
@ApiModelProperty(value = "accessToken,对应前端后续上送的 authorization")
|
||||
private String accessToken;
|
||||
|
||||
@ApiModelProperty(value = "组织机构id")
|
||||
private Integer deptId;
|
||||
|
||||
@ApiModelProperty(value = "组织机构名称")
|
||||
private String deptName;
|
||||
|
||||
@ApiModelProperty(value = "角色列表")
|
||||
//private List<SysRole> roles ;
|
||||
private List<String> roles;
|
||||
|
||||
@ApiModelProperty(value = "角色Id列表")
|
||||
private List<Integer> roleIds;
|
||||
|
||||
@ApiModelProperty(value = "岗位列表")
|
||||
private List<String> positions;
|
||||
|
||||
@ApiModelProperty(value = "岗位中文列表")
|
||||
private List<PositionVo> positionList;
|
||||
|
||||
//角色名称
|
||||
@ApiModelProperty(value = "角色名称列表")
|
||||
List<String> roleNames;
|
||||
|
||||
@ApiModelProperty(value = "权限列表")
|
||||
private List<String> powerList;
|
||||
|
||||
|
||||
@ApiModelProperty(value = "菜单列表")
|
||||
private List<SysPermission> menuList;
|
||||
|
||||
@ApiModelProperty(value = "用户等级")
|
||||
private Integer userLevel;
|
||||
|
||||
@ApiModelProperty(value = "组态(组态:config,空值为非组态)")
|
||||
private String configType;
|
||||
}
|
||||
@ -0,0 +1,38 @@
|
||||
package com.ho.common.tools.entity;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* @author gyan
|
||||
* @desc: 天气返回对象
|
||||
* @DateTime: 2022/11/14 17:02
|
||||
*/
|
||||
@Data
|
||||
public class WeatherRespVo {
|
||||
|
||||
@ApiModelProperty(value = "城市")
|
||||
String cityzh;
|
||||
|
||||
@ApiModelProperty(value = "最大温度")
|
||||
BigDecimal maxTemperature;
|
||||
|
||||
@ApiModelProperty(value = "最小温度")
|
||||
BigDecimal minTemperature;
|
||||
|
||||
@ApiModelProperty(value = "天气现象")
|
||||
String skyCon;
|
||||
|
||||
@ApiModelProperty(value = "风向风速")
|
||||
String speedAndDirection;
|
||||
|
||||
//最后更新时间
|
||||
Long updateTime;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,46 @@
|
||||
package com.ho.common.tools.entity;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
*
|
||||
* @TableName work_order_picture
|
||||
*/
|
||||
@Data
|
||||
public class WorkOrderPicture implements Serializable {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private Integer id;
|
||||
|
||||
/**
|
||||
* 与work_order相连id
|
||||
*/
|
||||
private Long workOrderId;
|
||||
|
||||
/**
|
||||
* 文件名
|
||||
*/
|
||||
private String fileName;
|
||||
|
||||
/**
|
||||
* 路径地址
|
||||
*/
|
||||
private String url;
|
||||
|
||||
/**
|
||||
* 1.工单
|
||||
*/
|
||||
private Integer type;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@JsonIgnore
|
||||
private Date createTime;
|
||||
|
||||
}
|
||||
@ -0,0 +1,24 @@
|
||||
package com.ho.common.tools.entity.file;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @Author yule
|
||||
* @Date 2023/8/29 15:25
|
||||
* @desc ${}
|
||||
*/
|
||||
@Data
|
||||
public class OrderFile {
|
||||
//路径
|
||||
String url;
|
||||
//文件名
|
||||
String fileName;
|
||||
|
||||
@ApiModelProperty(value = "工单表单id",hidden = true)
|
||||
private Integer orderFormId;
|
||||
|
||||
@ApiModelProperty(value = "顺序",hidden = true)
|
||||
private Integer sort;
|
||||
|
||||
}
|
||||
@ -0,0 +1,123 @@
|
||||
package com.ho.common.tools.exception;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description 空调故障字段对比
|
||||
* Author yule
|
||||
* Date 2023/5/10 10:14
|
||||
*/
|
||||
public enum AirConditionCode implements ResponseCodeInterface{
|
||||
|
||||
AirConditionFault01(130,"airconditionFault01"),
|
||||
AirConditionFault02_1(129,"airconditionFault02"),
|
||||
AirConditionFault03_2(116,"airconditionFault03"),
|
||||
AirConditionFault03_3(114,"airconditionFault03"),
|
||||
AirConditionFault03_1(127,"airconditionFault03"),
|
||||
AirConditionFault03_4(113,"airconditionFault03"),
|
||||
AirConditionFault03_5(112,"airconditionFault03"),
|
||||
AirConditionFault04(101,"airconditionFault04"),
|
||||
AirConditionFault05(99,"airconditionFault05"),
|
||||
AirConditionFault06(98,"airconditionFault06"),
|
||||
AirConditionFault07(97,"airconditionFault07"),
|
||||
AirConditionFault09(80,"airconditionFault09"),
|
||||
AirConditionFault10(73,"airconditionFault10"),
|
||||
AirConditionFault08(81,"airconditionFault08"),
|
||||
AirConditionFault11(66,"airconditionFault11"),
|
||||
AirConditionFault12(65,"airconditionFault12"),
|
||||
AirConditionFault13(64,"airconditionFault13"),
|
||||
AirConditionFault14(57,"airconditionFault14"),
|
||||
AirConditionFault15(51,"airconditionFault15"),
|
||||
AirConditionFault16(50,"airconditionFault16"),
|
||||
AirConditionFault17(49,"airconditionFault17"),
|
||||
AirConditionFault18(48,"airconditionFault18"),
|
||||
AirConditionFault19(40,"airconditionFault19"),
|
||||
AirConditionFault20(36,"airconditionFault20"),
|
||||
AirConditionFault21(26,"airconditionFault21"),
|
||||
AirConditionFault22(24,"airconditionFault22"),
|
||||
AirConditionFault23(23,"airconditionFault23"),
|
||||
AirConditionFault24(22,"airconditionFault24"),
|
||||
AirConditionFault25(20,"airconditionFault25"),
|
||||
AirConditionFault26(19,"airconditionFault26"),
|
||||
AirConditionFault27(18,"airconditionFault27"),
|
||||
AirConditionFault28(17,"airconditionFault28"),
|
||||
AirConditionFault29(16,"airconditionFault29"),
|
||||
AirConditionFault30(15,"airconditionFault30"),
|
||||
AirConditionFault31(14,"airconditionFault31"),
|
||||
AirConditionFault32(13,"airconditionFault32"),
|
||||
AirConditionFault33(12,"airconditionFault33"),
|
||||
AirConditionFault34(5,"airconditionFault34"),
|
||||
AirConditionFault35(4,"airconditionFault35"),
|
||||
AirConditionFault36(2,"airconditionFault36");
|
||||
|
||||
|
||||
/**
|
||||
* 错误码
|
||||
*/
|
||||
private final int code;
|
||||
/**
|
||||
* 错误消息
|
||||
*/
|
||||
private final String msg;
|
||||
|
||||
AirConditionCode(int code, String msg) {
|
||||
this.code = code;
|
||||
this.msg = msg;
|
||||
}
|
||||
|
||||
public static List<AirConditionCode> setList(){
|
||||
List<AirConditionCode> list = new ArrayList<>();
|
||||
list.add(AirConditionFault01);
|
||||
list.add(AirConditionFault02_1);
|
||||
list.add(AirConditionFault03_1);
|
||||
list.add(AirConditionFault03_2);
|
||||
list.add(AirConditionFault03_3);
|
||||
list.add(AirConditionFault03_4);
|
||||
list.add(AirConditionFault03_5);
|
||||
list.add(AirConditionFault04);
|
||||
list.add(AirConditionFault05);
|
||||
list.add(AirConditionFault06);
|
||||
list.add(AirConditionFault07);
|
||||
list.add(AirConditionFault08);
|
||||
list.add(AirConditionFault09);
|
||||
list.add(AirConditionFault10);
|
||||
list.add(AirConditionFault11);
|
||||
list.add(AirConditionFault12);
|
||||
list.add(AirConditionFault13);
|
||||
list.add(AirConditionFault14);
|
||||
list.add(AirConditionFault15);
|
||||
list.add(AirConditionFault16);
|
||||
list.add(AirConditionFault17);
|
||||
list.add(AirConditionFault18);
|
||||
list.add(AirConditionFault19);
|
||||
list.add(AirConditionFault20);
|
||||
list.add(AirConditionFault21);
|
||||
list.add(AirConditionFault22);
|
||||
list.add(AirConditionFault23);
|
||||
list.add(AirConditionFault24);
|
||||
list.add(AirConditionFault25);
|
||||
list.add(AirConditionFault26);
|
||||
list.add(AirConditionFault27);
|
||||
list.add(AirConditionFault28);
|
||||
list.add(AirConditionFault29);
|
||||
list.add(AirConditionFault30);
|
||||
list.add(AirConditionFault31);
|
||||
list.add(AirConditionFault32);
|
||||
list.add(AirConditionFault33);
|
||||
list.add(AirConditionFault34);
|
||||
list.add(AirConditionFault35);
|
||||
list.add(AirConditionFault36);
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMsg() {
|
||||
return msg;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,496 @@
|
||||
package com.ho.common.tools.exception;
|
||||
|
||||
|
||||
public enum BaseResponseCode implements ResponseCodeInterface {
|
||||
/**
|
||||
* 这个要和前段约定好
|
||||
* 引导用户去登录界面的
|
||||
* code=401001 引导用户重新登录
|
||||
* code=401008 无权限访问
|
||||
*/
|
||||
SUCCESS(200, "操作成功"),
|
||||
SYSTEM_BUSY(500001, "系统繁忙,请稍候再试"),
|
||||
OPERATION_ERRO(500002, "系统异常"),
|
||||
PERMISSION_DENIED(500003, "权限不足,请联系管理员"),
|
||||
FEIGN_CALL_FAIL(500005, "微服务调用错误"),
|
||||
SUPER_ROLE_CANNOT_MODIFY(500006, "超级管理员信息不能变更"),
|
||||
INNER_ROLE_CANNOT_MODIFY(500007, "系统内置角色不能被操作"),
|
||||
DELETE_ERROR(500008, "删除失败"),
|
||||
CREATE_BUCKET_ERROR(500009, "创建minio桶失败"),
|
||||
FILE_UPLOAD_ERROR(500010, "上传文件失败"),
|
||||
FILE_DOWNLOAD_ERROR(500011, "下载文件失败"),
|
||||
DELETE_ERROR_NO_DATA(500012, "请选择需要删除的数据"),
|
||||
PARAM_EXCEED_LENGTH(500013, "参数超过限定长度"),
|
||||
|
||||
PARSING_FAILED(500014, "解析失败,请核对区域和图片的对应关系"),
|
||||
|
||||
BAIDU_PIC_NOTIFY_TIME_OUT(500015, "调用百度表格文字识别超时"),
|
||||
|
||||
BAIDU_PIC_NOTIFY_USE_UP(500016, "百度表格文字识别秘钥错误或上传格式错误或调用次数已用尽,联系管理员解决"),
|
||||
|
||||
TOKEN_PARSE_ERROR(401001, "登录凭证已过期,或在其他设备登陆,当前登陆已失效"),
|
||||
TOKEN_ERROR(401001, "登录凭证已过期,或在其他设备登陆,当前登陆已失效"),
|
||||
ACCOUNT_ERROR(401001, "该账号异常,请联系运营人员"),
|
||||
ACCOUNT_LOCK_ERROR(401001, "该用户已被锁定,请联系运营人员"),
|
||||
TOKEN_PAST_DUE(401001, "登录凭证已过期,或在其他设备登陆,当前登陆已失效"),
|
||||
LOSE_EFFICACY(401002, "当前登录账号已过期,请联系运营人员"),
|
||||
DATA_ERROR(401003, "传入数据异常"),
|
||||
NOT_ACCOUNT(401004, "该用户不存在,请先注册"),
|
||||
USER_LOCK(401005, "该用户已被锁定,请联系运营人员"),
|
||||
PASSWORD_ERROR(401006, "用户名或密码错误"),
|
||||
METHODARGUMENTNOTVALIDEXCEPTION(401007, "方法参数校验异常"),
|
||||
UNAUTHORIZED_ERROR(401008, "权鉴校验不通过"),
|
||||
ROLE_PERMISSION_RELATION(401009, "该菜单权限存在子集关联,不允许删除"),
|
||||
OLD_PASSWORD_ERROR(401010, "旧密码不正确"),
|
||||
NOT_PERMISSION_DELETED_DEPT(401011, "该组织机构下还关联着用户,不允许删除"),
|
||||
OPERATION_MENU_PERMISSION_CATALOG_ERROR(401012, "操作后的菜单类型是目录,所属菜单必须为默认顶级菜单或者目录"),
|
||||
OPERATION_MENU_PERMISSION_MENU_ERROR(401013, "操作后的菜单类型是菜单,所属菜单必须为目录类型"),
|
||||
OPERATION_MENU_PERMISSION_BTN_ERROR(401013, "操作后的菜单类型是按钮,所属菜单必须为菜单类型"),
|
||||
OPERATION_MENU_PERMISSION_UPDATE(401014, "操作的菜单权限存在子集关联不允许变更"),
|
||||
OPERATION_MENU_PERMISSION_URL_NOT_NULL(401015, "菜单权限的url不能为空"),
|
||||
OPERATION_MENU_PERMISSION_URL_PERMS_NULL(401016, "菜单权限的标识符不能为空"),
|
||||
OPERATION_MENU_PERMISSION_URL_METHOD_NULL(401017, "菜单权限的请求方式不能为空"),
|
||||
PARENT_DEPT_IS_DISABLE(401018, "父级部门是禁用状态,该部门无法启用"),
|
||||
PARENT_PERMISSION_IS_DISABLE(401019, "父级菜单是禁用状态,该部门无法启用"),
|
||||
SUB_DICT_ALREADY_EXISTS(401018, "已经存在相同类型和键的字典数据"),
|
||||
DICT_ALREADY_EXISTS(401018, "已经存在相同type和value的字典数据"),
|
||||
DICT_DELETED_EXISTS(401019, "该字典数据不存在"),
|
||||
|
||||
|
||||
USER_NAME_ALREADY_EXISTS(401020, "相同的用户名已存在"),
|
||||
SUPER_CANOT_DELETE(401021, "超级管理员不能被删除"),
|
||||
ROLE_NAME_CANNOT_BE_SUPER(401022, "角色名不能是 超级管理员"),
|
||||
ROLE_NAME_ALREADY_EXITS(401023, "该角色名已存在,请填其他名称"),
|
||||
SUPER_ROLE_NAME_CANOT_RENAME(401024, "超级管理员 名称不能修改"),
|
||||
|
||||
|
||||
PERMISSION_ALREADY_EXISTS(401025, "已经存在相同的perms"),
|
||||
|
||||
ROLE_ALREADY_USED(401026, "该角色已经被使用"),
|
||||
|
||||
DATA_NOT_EXISTS(401027, "对应数据不存在,请检查参数"),
|
||||
|
||||
PARENT_MENU_NOT_ADD_ENABLED(401028, "父级菜单状态未启用,不能添加子类菜单"),
|
||||
|
||||
PARENT_MENU_NOT_UPDATE_ENABLED(401028, "父级菜单状态未启用,不能修改子类菜单"),
|
||||
|
||||
PARENT_MENU_DELENTION_STATUS(401029, "父类菜单为删除状态,不能添加子节点"),
|
||||
ROLE_INFO_NOT_FOUND(401030, "对应角色信息不存在"),
|
||||
SYS_MENU_NAME_NOT_RIGHT(401031, "顶级菜单的名称不能为 'system(系统管理) 或menu(菜单管理)' "),
|
||||
SYS_MENU_NAME_CANNOT_MODIFY(401032, "'系统管理' 这个菜单不能进行变更或删除"),
|
||||
USER_NAME_PHONE_CANNOT_BE_SAME(401033, "账号和手机号不能相同"),
|
||||
MENU_SHOW_TYPE_NOT_RIGHT(401034, "菜单展示类型不正确"),
|
||||
PHONE_IS_USED_BY_OTHER_PERSON(401035, "该手机号已经被他人使用,请核对手机号"),
|
||||
PARENT_DEPT_CANNOT_SELF(401036, "所属部门不能是自身"),
|
||||
MENU_TYPE_NOT_BUTTON_PLEASE_ADD_ORDER_NUM(401037, "类型是菜单,请添加排序码"),
|
||||
PARAM_CHECK_FAIL(401038, "参数校验失败,缺少必填参数"),
|
||||
|
||||
MENU_NAME_ALREADY_EXISTS_PLEASE_RETYPE(401039, "菜单名称已存在,请重新输入"),
|
||||
SYS_MENU_NOT_DELETE_MENU(401040, "menu(菜单管理)这个菜单不能进行变更或删除 "),
|
||||
MENU_CANNOT_NOT_STATE_DELETE(401041, "菜单为启用状态,不能被删除"),
|
||||
DEPT_CANNOT_NOT_STATE_DELETE(401042, "部门为启用状态,不能被删除"),
|
||||
POSITION_CANNOT_NOT_STATE_DELETE(401043, "岗位为启用状态,不能被删除"),
|
||||
USER_CANNOT_NOT_STATE_DELETE(401044, "用户为启用状态,不能被删除"),
|
||||
INCORRECT_MOBILE_NUMBER_FORMAT(401045, "输入手机号格式有误"),
|
||||
PARENT_MENU_TYPE_BUTTON_NOT_ADD(401046, "菜单名称已存在,请重新输入"),
|
||||
|
||||
DICT_EXISTENCE_EXISTENCE_KEY_VALUE(401047, "已经存在相同key字典数据"),
|
||||
|
||||
PARENT_NODE_TYPE_NOT_BUTTON(401048, "父级节点类型不能为按钮"),
|
||||
USER_DOES_NOT_VALID_ROLE(401049, "该用户无有效角色"),
|
||||
PRIMARY_MENU_CANNOT_MODIFIED_TYPE_BUTTON(401050, "一级菜单不能修改为按钮类型"),
|
||||
MENU_SUB_LEVEL_ASSOCIATED_DATA_CANNOT_MODIFIED(401051, "菜单子级存在关联数据,不能修改"),
|
||||
|
||||
TO_BELONGING_DEPT_DISABLE(401052, "所属部门被禁用,请联系管理员"),
|
||||
|
||||
SYS_MENU_NAME_STATUS_CANNOT(401053, "'系统管理' 这个菜单不能被禁用"),
|
||||
//大屏相关
|
||||
INVALID_BIG_SCREEN_TOKEN(401054, "无效的大屏token"),
|
||||
|
||||
MENU_NAME_STATUS_CANNOT(401055, "'菜单管理' 不能被禁用"),
|
||||
//同级存在相同名称
|
||||
PEER_EXISTENCE_SAME_NAME(401056, "同级存在相同名称"),
|
||||
|
||||
NOT_PERMISSION_STATUS_DEPT(401057, "该组织机构下还关联着用户,不允许更改状态"),
|
||||
|
||||
ROLE_ENABLED_NOT_DELETED(401058, "角色为启用状态,不能删除"),
|
||||
|
||||
SORT_CODE_BEEN_USED_PLEASE_CORRECT_SORT(401059, "排序码已使用,请输入正确的排序码"),
|
||||
TOP_LEVEL_DEPARTMENTS_CANNOT_CHANGE_DEPARTMENTS(401060, "顶级部门不能更改所属部门"),
|
||||
UPDATE_BELONGS_DEPT_NOT_SAME_GROUP(401061, "所属部门不为同一集团,不可以修改"),
|
||||
|
||||
LOSE_LICENCE(401062, "请检查Licence是否过期"),
|
||||
|
||||
REGION_NAME_ALREADY_EXISTS(401063, "相同的电价区域已存在"),
|
||||
|
||||
//业务系统错误
|
||||
STATION_ALREADY_EXISTS(600001, "已经存在相同的数据"),
|
||||
|
||||
TOPOLOGY_ALREADY_EXISTS(600002, "已经存在相同的拓扑关系"),
|
||||
//非平台管理员无法创建顶级部门
|
||||
NON_PLATFORM_ADMINISTRATOR(600003, "非平台管理员无法创建顶级部门"),
|
||||
|
||||
NOT_LAST_DEPARTMENT(600004, "不是最末级部门,无法删除"),
|
||||
|
||||
STATION_CANNOT_NOTDELE(600005, "已有关联电站,无法删除"),
|
||||
|
||||
PLAT_USER_CANNOT_MONITOR(600006, "平台用户管理员不能直接查看监控页面,请使用集团用户登陆"),
|
||||
|
||||
PLAT_USER_CANNOT_OPERATE(600006, "平台用户不能操作该业务,请使用集团用户登陆"),
|
||||
PLAT_USER_DEPLOYMENT_ERROR(600007, "新建部门部署工作流失败,请重试"),
|
||||
GROUP_ID_IS_NULL(600008, "集团id不能为空"),
|
||||
//电站的错误
|
||||
STATION_NO_FOUND(600005, "该用户无关联电站"),
|
||||
STATION_NO_DELETED(600006, "电站关联了拓扑数据或工单数据,不能删除"),
|
||||
STATION_PLEASE_SELECT(600007, "请选择需要删除的电站"),
|
||||
STATION_SN_NOT_MORE_THAN_SIXTEEN(600008, "输入的sn编码不能超过16个字符"),
|
||||
STATION_SN_DUPLICATE_INPUT(600008, "输入的sn编码不能重复"),
|
||||
STATION_SN_ALREADY_EXISTS(600009, "输入的sn编码已存在"),
|
||||
STATION_ICCID_EXISTS(600010, "输入的卡号已存在"),
|
||||
INPUT_CARD_BOUND_STATION(600011, "输入的卡号已绑定电站"),
|
||||
PLEASE_SELECT_CORRESPOND_PACKAGE(600012, "请选择对应套餐"),
|
||||
SELECT_CORRSTATION_NO_DELETED(600013, "所选物联卡已绑定电站,无法删除"),
|
||||
PACKAGE_NO_GROUPID(600014, "移动套餐新增未输入所属群组Id"),
|
||||
CARD_PACKAGE_ASSOCIATED_POWER_STATION(600015, "该套餐下的卡存在与电站关联关系"),
|
||||
EXCEL_ICCID_EXISTS(600016, "请核对数据,存在重复录入"),
|
||||
PLEASE_CONFIRM_CORRECT(600017, "请确认卡号是否存在未填写或者excel中第一行数据与官网下载数据有异"),
|
||||
|
||||
//时序数据库中的数据
|
||||
STATION_YC_NOT_EXISTS(600007, "对应电站数据不存在"),
|
||||
WAREHOUSE_NOT_EXISTS(600008, "对应舱数据不存在"),
|
||||
BATTERY_STACK_NOT_EXISTS(600009, "对应电池堆数据不存在"),
|
||||
BATTERY_CLUSTER_NOT_EXISTS(600010, "对应电池簇数据不存在"),
|
||||
BATTERY_PAGE_NOT_EXISTS(600011, "对应电池包数据不存在"),
|
||||
BATTERY_CELL_NOT_EXISTS(600012, "对应电池芯数据不存在"),
|
||||
|
||||
//拓扑数据错误 ,没查到对应拓扑数据
|
||||
TOPOLOGY_STACK_NOT_EXISTS(600013, "对应的 电池堆 拓扑数据不存在"),
|
||||
TOPOLOGY_CLUSTER_NOT_EXISTS(600014, "对应的 电池簇 拓扑数据不存在"),
|
||||
TOPOLOGY_PACK_NOT_EXISTS(600015, "对应的 电池包 拓扑数据不存在"),
|
||||
TOPOLOGY_CELL_NOT_EXISTS(600016, "对应的 电池芯 拓扑数据不存在"),
|
||||
TOPOLOGY_STATION_NOT_EXISTS(600017, "对应的 电站 拓扑数据不存在"),
|
||||
TOPOLOGY_WAREHOUSE_NOT_EXISTS(600018, "对应的 电池舱 拓扑数据不存在"),
|
||||
TOPOLOGY_ELEC_QUALITY_NOT_EXISTS(600200, "对应的 电能质量拓扑数据不存在"),
|
||||
|
||||
//设备
|
||||
CORRESPONDING_DEVICE_DOES_NOT_EXIST(600019, " 对应设备不存在"),
|
||||
STATION_DEVICE_NOT_EXIST(600020, " 对应电站下设备不存在"),
|
||||
CHOOSE_DEVICE(600021, "请选择设备类型"),
|
||||
DEVICE_TYPE_NOT_CONFIG(600022, "该设备设备类型尚未配置"),
|
||||
PLEASE_ENTER_NUMBER_OF_VIRTUAL_DEVICES(600023, "请输入正确的虚拟设备个数"),
|
||||
DATA_THE_SAME_DEVICE_ID(600024, "数据存在相同的设备Id"),
|
||||
PLEASE_ENTER_CORRECT_STARTING_DEVICE_ID(600025, "请输入正确的起始设备Id"),
|
||||
|
||||
|
||||
//工单相关 错误码 600100--600199
|
||||
WORK_ORDER_STATUS_MUST_BE_NOT_ALLOCATED(600100, "工单状态不是 待分配 ,无法进行分配"),
|
||||
WORK_ORDER_STATUS_NOT_ASSIGNED_CANNOT_CONFIRMED(600101, "工单状态不是 已分配 ,无法进行确认"),
|
||||
WORK_ORDER_STATUS_NOT_ASSIGNED_CANNOT_RETURNED(600102, "工单状态不是 已分配 ,无法进行退回"),
|
||||
WORK_ORDER_STATUS_NOT_PROCESS_CANNOT_CLOSED(600103, "工单状态不是 处理中,无法进行关闭动作"),
|
||||
WORK_ORDER_CANNOT_MODIFIED(600104, "工单订单号 不能进行修改"),
|
||||
WORK_ORDER_TYPE_NOT_MANUAL_CANNOT_BE_MODIFIED(600105, "工单类型不为人工派单,不能进行修改"),
|
||||
WORK_ORDER_ID_TYPE_NOT_RIGHT(600106, "工单自增id的获取正确"),
|
||||
EXISTENCE_NOT_PENDING_ASSIGNMENT_CANNOT_DELETED(600107, "工单状态不是待分配状态,无法进行删除"),
|
||||
WORK_ORDER_NOT_CONVERSION(600108, "选中的告警数据中包含不能被转化工单的数据"),
|
||||
WORK_ORDER_ID_REQUIRED(600108, "工单号必填"),
|
||||
WORK_ORDER_TO_ID_REQUIRED(600109, "维修人员必须指定"),
|
||||
WORK_ORDER_PHONE_REQUIRED(600110, "维修人员手机号必填"),
|
||||
WORK_ORDER_NOT_ADD(600111, "用户没有新增权限"),
|
||||
WORK_ORDER_STATUS_MUST_BE_NOT_EDIT(600112, "工单状态不是 待分配 ,无法进行编辑"),
|
||||
IS_NOT_ROLE_WORK_ORDER_LEADER(600113, "当前用户没有分配工单的权限"),
|
||||
WORK_ORDER_ADD_ERROR(600114, "新增工单业务数据失败"),
|
||||
WORK_ORDER_UPDATE_ERROR(600115, "修改工单业务数据失败"),
|
||||
WORK_ORDER_DELETE_ERROR(600116, "删除工单业务数据失败"),
|
||||
WORK_ORDER_INPUT_ID(600117, "请选择工单业务"),
|
||||
NO_QUALIFIED_PERSONNEL_IN_ALL_DEPARTMENTS(600118, "所属部门下没有符合要求的人员"),
|
||||
DEPARTMENT_NOT_EXIST(600119, "部门不存在"),
|
||||
NO_RELEVANT_POSITIONS(600120, "没有相关岗位"),
|
||||
PERSONNEL_NOT_ASSOCIATED_WITH_POSITION(600121, "岗位未关联人员"),
|
||||
WORK_ORDER_PLAN_ADD_ERROR(600122, "新增工单计划数据失败"),
|
||||
WORK_ORDER_PLAN_SUB_ADD_ERROR(600122, "新增工单计划子表数据失败"),
|
||||
WORK_ORDER_PLAN_DELETED_ERROR(600122, "删除工单计划数据失败"),
|
||||
WORK_ORDER_PLAN_UPDATE_ERROR(600122, "修改工单计划数据失败"),
|
||||
PROCESS_INSTANCE_NOT_DEPLOYMENT(600123, "发起工单"),
|
||||
PROCESS_INSTANCE_ADD_ERROR(600124, "发起工单失败"),
|
||||
APPROVAL_ERROR(600124, "流转工单失败"),
|
||||
|
||||
//以下是工作流以后的工单提示
|
||||
WORK_ORDER_NOT_EXISTS(600122, "对应的工单不存在"),
|
||||
|
||||
//工作流的错误码
|
||||
//工作流的错误码
|
||||
TASK_NOT_EXISTS(600130, "对应Task任务不存在"),
|
||||
TASK_IS_NOT_YOURS(600131, "不是本人任务,无法去办理"),
|
||||
TASK_IS_NOT_FIRST(600132, "对应Task任务不是创建任务"),
|
||||
TASK_CHOICE_CANDIDATE_USER(600133, "请选择候选人"),
|
||||
TASK_ALREADY_CLAIM_BY_OTHER(600134, "工单已被接收,暂不能处理."),
|
||||
PROCESS_MANAGEMENT_ID_NOT_EMPTY(600135, "请指定工单流程"),
|
||||
PROCESS_TEMPLATE_IS_EMPTY(600136, "该流程模板的流程图为空"),
|
||||
|
||||
//充电桩相关 错误码 600200--600299
|
||||
//充电桩
|
||||
DEVICE_TYPE_NOT_CHARGING_CHARGING_PILE(600200, "设备类型不是充电桩"),
|
||||
DEVICE_FEE_NOT_SET(600201, "充电桩设备的价格还未设置"),
|
||||
|
||||
|
||||
//电能质量 碳足迹相关 错误码600200--600299
|
||||
ELEC_QUALITY_NOT_EXISTS(600200, "电能质量数据不存在"),
|
||||
YEAR_MONTH_CAN_NOT_EMPTY_TOGETHER(600201, "年份和月份不能同时为空"),
|
||||
|
||||
|
||||
//文件相关 错误码600300--600399
|
||||
FILE_IS_EMPTY(600300, "文件为空"),
|
||||
|
||||
FILE_IS_TO_BIG(600301, "文件大小不能超过500MB"),
|
||||
|
||||
FILE_IS_EXCEED_5M(600302, "文件大小不能超过5MB"),
|
||||
|
||||
FILE_NOT_EXISTS(600303, "文件不存在"),
|
||||
|
||||
FILE_NOT_DELETE(600304, "删除文件失败"),
|
||||
|
||||
FILE_IS_USING(600305, "文件传输正在使用"),
|
||||
|
||||
FILE_IS_TO_MORE(600306, "上传文件大小不能超过2MB"),
|
||||
|
||||
FILE_FORMAT_ONLY(600307, "上传文件格式不正确"),
|
||||
|
||||
FILE_NOT_MORE_THAN_THREE(600308, "上传文件总数不能超过三个"),
|
||||
FILE_NOT_MORE_THAN_NINE(600309, "上传文件总数不能超过9个"),
|
||||
|
||||
//告警中心相关
|
||||
EVENT_IDS_NOT_EMPTY(600400, "请先选择告警数据!"),
|
||||
ONLY_ONE_STATION(600401, "只能在同一个电站下选择!"),
|
||||
CONVERSION_ERROR(600402, "转化工单失败!"),
|
||||
|
||||
|
||||
//岗位管理相关 错误码600500--600599
|
||||
POSITION_ALREADY_EXISTS(600500, "岗位已经存在"),
|
||||
POSITION_NOT_EXISTS(600501, "岗位不存在"),
|
||||
POSITION_ASSOCIATED_USER_CANNOT_DISABLE(600502, "岗位关联用户,不能禁用"),
|
||||
|
||||
|
||||
//mqtt通信相关 错误码600600--600699
|
||||
MQTT_TOKEN_GENERATE_FALL(600600, "生成token失败"),
|
||||
|
||||
|
||||
//智慧能源相关 错误码600700--600799
|
||||
SMART_ENERGY_CONTEMPORANEOUS_NOT_DATE(600600, "请输入时间"),
|
||||
|
||||
|
||||
//组态图配置相关 错误码600800--600899
|
||||
NOT_DELETE_EXIST_DATA_RELATION(600800, "无法删除,数据在配置表中存在数据关系"),
|
||||
|
||||
//逆变器错误码600900--600999
|
||||
INVERTER_EQUIPMENT_UNDER_SELECTED_POWER_STATION(600900, "所选电站下没有逆变器设备"),
|
||||
|
||||
|
||||
//驾驶舱错误码601000--601099
|
||||
COCKPIT_NOT_SEE(601000, "管理员不能看驾驶舱"),
|
||||
|
||||
|
||||
//告警配置602000--602099
|
||||
TELEMETRY_VALUE_NOT_LIMIT(602000, "请输入上限或下限数值"),
|
||||
TELEMETRY_NOT_IS_NULL(602001, "告警等级不能为空"),
|
||||
EXISTS_DUPLICATE_DATA(602002, "存在重复数据"),
|
||||
CONFIGURATION_ELEMENT_DOES_NOT_EXIST(602003, "配置元素不存在"),
|
||||
CONFIGURATION_ELEMENT_IS_NULL(602004, "存在空值,请检查"),
|
||||
EXISTS_UPPER_LESS_LOWER(602005, "存在上限小于下限"),
|
||||
EXCEEDING_VALUE_RANGE(602006, "超过取值范围(-1000000000~1000000000)"),
|
||||
|
||||
//设备配置603000--603099
|
||||
THE_SAME_DATA_EXISTS_DATABASE_PLEASE_CHECK(603000, "数据库中存在相同的字段col,请检查"),
|
||||
MODIFIED_DATA_REFERENCED_CANNOT_CHANGED(603001, "所修改的数据被引用,不能更改"),
|
||||
DEVICE_NOT_EXIST(603002, "设备不存在"),
|
||||
REFERENCES_EXIST_DELETED_DATA(603003, "所删除的数据中存在被引用"),
|
||||
SAME_DATA_ASSOCIATION_EXISTS(603004, "存在相同的数据关联关系"),
|
||||
SCOPE_IS_STATION_ID_CANNOT_NULL(603005, "范围是电站时, 电站id不能为空"),
|
||||
PLEASE_CHECK_DEVICE_TYPE(603006, "请选择同步的设备类型"),
|
||||
PLEASE_CHECK_MODEL_TYPE(603007, "请选择同步的模型类型"),
|
||||
TELEMETRY_POINT_CONFIGURED_REMOTE_SIGNAL(603008, "该遥测点已经配置为遥信点"),
|
||||
PLEASE_CHECK_SRC_STATION(603009, "请选择同步的数据源电站"),
|
||||
PLEASE_CHECK_MODEL_STATION(603010, "请选择要被同步的目标电站"),
|
||||
//没有重复元素
|
||||
|
||||
//资产管理604000-605099
|
||||
PLEASE_CHECK_THE_EXCEL_FORMAT(604000, "请核对excel格式"),
|
||||
SJEKK_EXCEL_DATA(604001, "请核对excel表中的数据"),
|
||||
EXCEL_DATA_TABLE_EMPTY(604002, "excel表中数据为空"),
|
||||
PLATFORM_ADMIN_CANNOT_DIRECTLY_USE(604003, "平台管理员不能直接使用,请使用平台用户登陆"),
|
||||
PROJECT_NAME_CANNOT_EMPTY(604004, "项目名称不能为空"),
|
||||
PLEASE_CONFIRM_WHETHER_IMPORTED_TEMPLATE_CORRECT(604005, "检测到您excel中第一行数据与模板有异,请确认导入模板是否正确"),
|
||||
EXCEL_TABLE_EXCEEDS_MAXIMUM_MONTH_PLEASE_VERIFY(604006, "导入的excel表中的月份有误,请核实"),
|
||||
PROJECT_DATA_THAT_MONTH_PLEASE_VERIFY_MONTH(604007, "项目存在该月份的数据,请核实月份"),
|
||||
PLEASE_DELETE_MONTH_FORMAT_PROMPTED_TEMPLATE(604008, "请删除模板中所提示的月份格式"),
|
||||
PLEASE_ENTER_MONTH(604009, "请输入月份"),
|
||||
ERROR_FORMAT_SETTLEMENT_MONTH_ENTERED(604010, "输入的结算月份格式有误, 必须为 yyyy-MM"),
|
||||
|
||||
|
||||
//下发相关错误码
|
||||
COMMAND_IS_EMPTY(61001, "没有查询到进度"),
|
||||
|
||||
//收益错误码603000--603099
|
||||
INCOME_CONFIRMATION_AT_THE_END_OF_THE_MONTH(603000, "实时数据还在上送,只能确认上一个月的收益"),
|
||||
INCOME_ADD_AT_THE_END_OF_THE_MONTH(603001, "当前月份时只展示实时数据,不可手动添加或导入"),
|
||||
POWER_BILLS_NOT_RELEVANT_DATA_MONTH(603002, "电费结算单在所选择的月份中无相关数据"),
|
||||
|
||||
//指令相关 错误码700001--700100
|
||||
ORDER_IS_USING(700001, "命令下发传输正在使用"),
|
||||
|
||||
//摄像头相关 错误码603100 -- 603199
|
||||
ADD_CAMERA_ERROR(603100, "添加摄像头数据失败"),
|
||||
DELETED_CAMERA_ERROR(603102, "删除摄像头数据失败"),
|
||||
UPDATE_CAMERA_ERROR(603103, "修改摄像头数据失败"),
|
||||
PLEASE_SPECIFY_A_STATION_DEFAULT_CAMERA(603104, "请指定电站默认摄像头"),
|
||||
CAMERA_NO_EXIST(603105, "指定摄像头不存在"),
|
||||
PLEASE_CHOOSE_CAMERA(603101, "请选择摄像头"),
|
||||
|
||||
//APP站首页 错误码603200 -- 603299
|
||||
EQUIPMENT_UNDER_POWER_STATION(603200, "该电站下设备"),
|
||||
|
||||
//点表 错误码603300 -- 603399
|
||||
INDEX_QUERIED_NO_DATA_TIME(603300, "您查询的指标暂无数据"),
|
||||
//计划曲线 错误码60400 -- 60499
|
||||
TIME_FORMAT_INCORRECT(60400, "输入的电价数据中开始时间必须为00:00,结束时间为24:00"),
|
||||
NON_REPETITIVE_TEMPLATE_NAME(60401, "模板名称不能重复"),
|
||||
|
||||
ELEC_TEMPLATE_DOES_NOT_EXIST(60402, "电价模板不存在"),
|
||||
PLEASE_SELECT_ELECTRICITY_PRICE_TEMPLATE_DATA(60403, "请选择电价模板数据"),
|
||||
PLEASE_SELECT_STATION(60404, "请选择电站"),
|
||||
PRICE_TEMPLATE_ID_TYPE_NOT_RIGHT(600405, "电价模板自增id的获取正确"),
|
||||
EXCEL_DATA_IMPORT_ERROR(604006, "导出数据失败"),
|
||||
STATION_DATA_NULL_IMPORT_ERROR(604007, "电站为空,导出异常"),
|
||||
TYPE_TOO_LONG(60407, "用电类型不能超过10个字符"),
|
||||
|
||||
MOVEMENT_ERROR(604008, "转工单失败"),
|
||||
|
||||
NON_DATA(60000, "参数不能为空"),
|
||||
CURVE_DATA_ERROR(60000, "一条普通曲线只能绑定一个点"),
|
||||
POINT_NOT_NULL(60000, "绑点不能为空"),
|
||||
COMMON_POINT_DATA_ERROR(60000, "普通点/一点多义/拆电芯只能绑定一个点"),
|
||||
POINT_DATA_ERROR(60000, "拆电芯值不能为空"),
|
||||
POINT_DATA_ERROR_MORE(60000, "一点多义值不能为空"),
|
||||
PRICE_TOO_LONG(60409, "电价不能超过6位数"),
|
||||
|
||||
TEMPALTE_NAME_NON(60410, "模板名称不能为空"),
|
||||
PRICE_IS_NULL(60411, "电价不能为空"),
|
||||
|
||||
//自动化设备模块 605001 - 605099
|
||||
AUTO_DEVICE_NOT_FOUND(605001, "对应一体柜不存在"),
|
||||
EMS_SN_SHOULD_BE_UPDATE(605002, "EMS SN不能修改"),
|
||||
RUNNING_TASK_EXIST(605003, "存在进行中的任务,不允许做相关操作"),
|
||||
HAVING_TASK_(605003, "存在进行中的任务"),
|
||||
DEVICE_TASK_HAVE_HOT_STARTED(605004, "设备还未开启过任务"),
|
||||
TASK_HOT_EXIST(605005, "对应任务不存在"),
|
||||
SAME_TYPE_RECORD_EXIST(605006, "设备类型字段(type)已经存在"),
|
||||
CURRENT_TASK_STATUS_NOT_RUNNING(605006, "当前任务状态非运行中"),
|
||||
CHECK_PLAN_CONFIG_ERROR(605007, "测试方案配置有误"),
|
||||
CHECK_PLAN_CONFIG_LACK_STEP_DETAIL(605008, "测试方案配置有误,步骤缺少对应的详情"),
|
||||
STEP_CONFIG_LACK_OF_COL_TYPE(60000,"该方案中这个页面元素缺少 属性类型 配置"),
|
||||
TASK_HAS_USED_THE_PLAN(60000,"该方案已被任务使用,无法变更,请复制一个新方案"),
|
||||
|
||||
HAS_OVER_LAP(605009, "时间范围存在重复,请确认后重试!"),
|
||||
|
||||
ADD_FAIL(605010, "新增失败"),
|
||||
|
||||
MODIFY_FAIL(605011, "编辑失败"),
|
||||
|
||||
DELETE_FAIL(605012, "删除失败"),
|
||||
|
||||
AUTO_POINT_CONFIG_FAIL(60000, "自动化测试曲线指标配置错误"),
|
||||
|
||||
AUTO_DETAILS_CONFIG_FAIL(605014, "方案明细配置错误"),
|
||||
|
||||
MUST_BE_GROUP(605015, "当前为第一层级,必须选择 页面元素"),
|
||||
MUST_BE_NOT_GROUP(605016, "当前不为第一层级,不能选择为组"),
|
||||
|
||||
MUST_BE_COMMAND(605017, "CHECK的父级只能是COMMADN"),
|
||||
|
||||
PLAN_IS_BEGIN(605018, "方案正在执行,不可修改步骤信息"),
|
||||
|
||||
PLAN_COPY_FAIL(605019, "方案复制失败"),
|
||||
|
||||
PLAN_POWER_INSERT_ERROR(605020, "功率调度保存失败"),
|
||||
PLAN_ACTIVE_POWER_INSERT_ERROR(605021, "时令计划保存失败"),
|
||||
|
||||
//ota升级
|
||||
NOT_CHECK_STATION_DEVICE(605022, "未选择升级的站点及设备"),
|
||||
|
||||
STATION_OFFLINE(605023, "所选电站存在离线"),
|
||||
|
||||
ELEC_TEMPLATE_TIME_CLASH(605024, "费率模板时间与该电站其他模板时间出现冲突,请确认后重试!"),
|
||||
|
||||
ELEC_TEMPLATE_LIST_NON(605025, "电价费率数据不可为空,请正确填写后重试!"),
|
||||
|
||||
CONTROL_ALREADY_EXISTS(605022, "名称已经存在"),
|
||||
|
||||
DONT_REPEAT_SUBMISSION(605023, "计算任务已经开始,请勿重复提交!"),
|
||||
STATION_SN_IS_NOT_EXISTS(605024, "电站sn码不存在,不能下发!"),
|
||||
DATA_IS_EXISTS(605025, "数据为空,无法导出!"),
|
||||
|
||||
SEND_DATA_IS_EXISTS(605025, "可发送数据为空,无法下发,请确认后重试!"),
|
||||
|
||||
DATA_IS_ERROR(605026, "数据或文件格式有误,请确认后重试!"),
|
||||
|
||||
CANNOT_BE_DELETED(605027, "请先禁用计划曲线模板再删除!"),
|
||||
|
||||
DATA_NOT_SAVE(605028, "数据未保存,不能下发,请确认后重试!"),
|
||||
|
||||
PUBLIC_CANNOT_BE_DELETED(605028, "通用模板不可删除!"),
|
||||
|
||||
RADIO_MSG(605028, "单选框最多添加3个值,如需更多选择建议使用下拉框!"),
|
||||
|
||||
FILE_TYPE_ERROR(605029, "文件类型错误,导入数据仅支持xls,xlsx!"),
|
||||
|
||||
TAB_NAME_EXISTS(605030, "页签名称重复,请确认后重试!"),
|
||||
|
||||
TEM_NOT_EXISTS(605031, "模板不能为空!"),
|
||||
|
||||
PLAN_IS_USE(605032, "方案正在使用,无法删除,请确认后重试!"),
|
||||
|
||||
CANNOT_BE_DISPLAY(605033, "模板正在策略方案中使用,不能禁用!"),
|
||||
FILE_ISSUE_FAIL(605034, "下发JSON文件失败!"),
|
||||
|
||||
CHANGEOVER_IS_NON(605035, "还没有设置投退投退,请先选择投退压板!"),
|
||||
|
||||
PLAN_NAME_IS_EXISTS(605036, "方案名称已存在,请确认后重试!"),
|
||||
|
||||
TOTAL_NUMBER_ABNORMAL(605033, "总个数异常"),
|
||||
|
||||
ISPRIVATE_NOT(605037, "私有公有类型为空"),
|
||||
|
||||
STATIONNOT_EQUIPPED_QUALITY(605037, "该电站未配置品质点"),
|
||||
EXISTS_DUPLICATE_DATA_DELETE(605037, "存在重复数据,请删除相关类型配置数据!"),
|
||||
BIT_CONVERSION_NOT_REPLACEMENT(605040, "输入值转换后第12位bit值不为取代值标志值"),
|
||||
DATA_NOT_MORE_TWENTYFIVE(605041, "保存数据不能超过25条"),
|
||||
|
||||
INSPECTION_TEMPLATE_DELETED(605042, "对应的巡检模板已删除,巡检失败!"),
|
||||
/************************抽取新的********************************/
|
||||
EXCEL_DATA_NOT_EXIST(500, "不存在昨日负荷数据"),
|
||||
EXISTS_DUPLICATE_ALARM(500,"该作用范围内的字段已经配置过,重复字符为:"),
|
||||
;
|
||||
|
||||
/**
|
||||
* 错误码
|
||||
*/
|
||||
private final int code;
|
||||
/**
|
||||
* 错误消息
|
||||
*/
|
||||
private final String msg;
|
||||
|
||||
BaseResponseCode(int code, String msg) {
|
||||
this.code = code;
|
||||
this.msg = msg;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMsg() {
|
||||
return msg;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,35 @@
|
||||
package com.ho.common.tools.exception;
|
||||
|
||||
|
||||
public class BusinessException extends RuntimeException{
|
||||
/**
|
||||
* 异常编号
|
||||
*/
|
||||
private final int messageCode;
|
||||
|
||||
/**
|
||||
* 对messageCode 异常信息进行补充说明
|
||||
*/
|
||||
private final String detailMessage;
|
||||
|
||||
public BusinessException(int messageCode, String message) {
|
||||
super(message);
|
||||
this.messageCode = messageCode;
|
||||
this.detailMessage = message;
|
||||
}
|
||||
/**
|
||||
* 构造函数
|
||||
* @param code 异常码
|
||||
*/
|
||||
public BusinessException(ResponseCodeInterface code) {
|
||||
this(code.getCode(), code.getMsg());
|
||||
}
|
||||
|
||||
public int getMessageCode() {
|
||||
return messageCode;
|
||||
}
|
||||
|
||||
public String getDetailMessage() {
|
||||
return detailMessage;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,158 @@
|
||||
package com.ho.common.tools.exception;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class DataResult<T>{
|
||||
|
||||
/**
|
||||
* 请求响应code,200为成功 其他为失败
|
||||
*/
|
||||
private int code;
|
||||
|
||||
/**
|
||||
* 响应异常码详细信息
|
||||
*/
|
||||
private String msg;
|
||||
|
||||
/**
|
||||
* 响应内容 , code 200 时为 返回 数据
|
||||
*/
|
||||
private T data;
|
||||
|
||||
public DataResult(int code, T data) {
|
||||
this.code = code;
|
||||
this.data = data;
|
||||
this.msg=null;
|
||||
}
|
||||
|
||||
public DataResult(int code, String msg, T data) {
|
||||
this.code = code;
|
||||
this.msg = msg;
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public DataResult(int code, String msg) {
|
||||
this.code = code;
|
||||
this.msg = msg;
|
||||
this.data=null;
|
||||
}
|
||||
|
||||
|
||||
public DataResult() {
|
||||
this.code=BaseResponseCode.SUCCESS.getCode();
|
||||
this.msg=BaseResponseCode.SUCCESS.getMsg();
|
||||
this.data=null;
|
||||
}
|
||||
|
||||
public DataResult(T data) {
|
||||
this.data = data;
|
||||
this.code=BaseResponseCode.SUCCESS.getCode();
|
||||
this.msg=BaseResponseCode.SUCCESS.getMsg();
|
||||
}
|
||||
|
||||
public DataResult(ResponseCodeInterface responseCodeInterface) {
|
||||
this.data = null;
|
||||
this.code = responseCodeInterface.getCode();
|
||||
this.msg = responseCodeInterface.getMsg();
|
||||
}
|
||||
|
||||
public DataResult(ResponseCodeInterface responseCodeInterface, T data) {
|
||||
this.data = data;
|
||||
this.code = responseCodeInterface.getCode();
|
||||
this.msg = responseCodeInterface.getMsg();
|
||||
}
|
||||
//是否成功
|
||||
public boolean isSuccess(){
|
||||
return this.code == 200;
|
||||
}
|
||||
/**
|
||||
* 操作成功 data为null
|
||||
* @Author:
|
||||
* @CreateDate: 2019/9/4 23:08
|
||||
* @UpdateUser:
|
||||
* @UpdateDate: 2019/9/4 23:08
|
||||
* @Version: 0.0.1
|
||||
* @param
|
||||
* @return DataResult<T>
|
||||
* @throws
|
||||
*/
|
||||
public static <T>DataResult success(){
|
||||
return new <T>DataResult();
|
||||
}
|
||||
/**
|
||||
* 操作成功 data 不为null
|
||||
* @Author:
|
||||
* @CreateDate: 2019/9/4 23:09
|
||||
* @UpdateUser:
|
||||
* @UpdateDate: 2019/9/4 23:09
|
||||
* @Version: 0.0.1
|
||||
* @param data
|
||||
* @return DataResult<T>
|
||||
* @throws
|
||||
*/
|
||||
public static <T>DataResult success(T data){
|
||||
return new <T>DataResult(data);
|
||||
}
|
||||
/**
|
||||
* 自定义 返回操作 data 可控
|
||||
* @Author:
|
||||
* @CreateDate: 2019/9/4 23:15
|
||||
* @UpdateUser:
|
||||
* @UpdateDate: 2019/9/4 23:15
|
||||
* @Version: 0.0.1
|
||||
* @param code
|
||||
* @param msg
|
||||
* @param data
|
||||
* @return DataResult
|
||||
* @throws
|
||||
*/
|
||||
public static <T>DataResult getResult(int code,String msg,T data){
|
||||
return new <T>DataResult(code,msg,data);
|
||||
}
|
||||
/**
|
||||
* 自定义返回 data为null
|
||||
* @Author:
|
||||
* @CreateDate: 2019/9/4 23:15
|
||||
* @UpdateUser:
|
||||
* @UpdateDate: 2019/9/4 23:15
|
||||
* @Version: 0.0.1
|
||||
* @param code
|
||||
* @param msg
|
||||
* @return DataResult
|
||||
* @throws
|
||||
*/
|
||||
public static <T>DataResult getResult(int code,String msg){
|
||||
return new <T>DataResult(code,msg);
|
||||
}
|
||||
/**
|
||||
* 自定义返回 入参一般是异常code枚举 data为空
|
||||
* @Author:
|
||||
* @CreateDate: 2019/9/4 23:16
|
||||
* @UpdateUser:
|
||||
* @UpdateDate: 2019/9/4 23:16
|
||||
* @Version: 0.0.1
|
||||
* @param responseCode
|
||||
* @return DataResult
|
||||
* @throws
|
||||
*/
|
||||
public static <T>DataResult getResult(BaseResponseCode responseCode){
|
||||
return new <T>DataResult(responseCode);
|
||||
}
|
||||
/**
|
||||
* 自定义返回 入参一般是异常code枚举 data 可控
|
||||
* @Author:
|
||||
* @CreateDate: 2019/9/4 23:16
|
||||
* @UpdateUser:
|
||||
* @UpdateDate: 2019/9/4 23:16
|
||||
* @Version: 0.0.1
|
||||
* @param responseCode
|
||||
* @param data
|
||||
* @return DataResult
|
||||
* @throws
|
||||
*/
|
||||
public static <T>DataResult getResult(BaseResponseCode responseCode,T data){
|
||||
|
||||
return new <T>DataResult(responseCode,data);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,290 @@
|
||||
package com.ho.common.tools.exception;
|
||||
|
||||
/**
|
||||
* @Description 禾望逆变器枚举
|
||||
* Author yule
|
||||
* Date 2023/1/6 11:27
|
||||
*/
|
||||
public enum InverterHwCode implements InverterHwCodeInterface {
|
||||
|
||||
//通讯状态
|
||||
communicationStatus("通讯状态出现故障","通讯状态恢复正常"),
|
||||
//逆变器运行状态
|
||||
inverterStatusB0("待机状态恢复","待机状态"),
|
||||
inverterStatusB1("待机自检恢复","待机自检"),
|
||||
inverterStatusB2("启动并网恢复","启动并网"),
|
||||
inverterStatusB3("并网运行恢复","并网运行"),
|
||||
inverterStatusB4("告警运行恢复","告警运行"),
|
||||
inverterStatusB5("限电运行恢复","限电运行"),
|
||||
inverterStatusB6("调度运行恢复","调度运行"),
|
||||
inverterStatusB7("故障停机恢复","故障停机"),
|
||||
inverterStatusB8("指令停机恢复","指令停机"),
|
||||
inverterStatusB9("保留","保留"),
|
||||
inverterStatusB10("保留","保留"),
|
||||
inverterStatusB11("保留","保留"),
|
||||
inverterStatusB12("保留","保留"),
|
||||
inverterStatusB13("保留","保留"),
|
||||
inverterStatusB14("保留","保留"),
|
||||
inverterStatusB15("保留","保留"),
|
||||
|
||||
//逆变器故障字1
|
||||
inverterFault1B0("RAM自检失败恢复","RAM自检失败"),
|
||||
inverterFault1B1("EEPROM参数回默认值恢复","EEPROM参数回默认值"),
|
||||
inverterFault1B2("EEPROM读写失败恢复","EEPROM读写失败"),
|
||||
inverterFault1B3("FPGA版本不匹配恢复","FPGA版本不匹配"),
|
||||
inverterFault1B4("保留","保留"),
|
||||
inverterFault1B5("内部通信故障恢复","内部通信故障"),
|
||||
inverterFault1B6("保留","保留"),
|
||||
inverterFault1B7("保留","保留"),
|
||||
inverterFault1B8("保留","保留"),
|
||||
inverterFault1B9("保留","保留"),
|
||||
inverterFault1B10("保留","保留"),
|
||||
inverterFault1B11("保留","保留"),
|
||||
inverterFault1B12("保留","保留"),
|
||||
inverterFault1B13("保留","保留"),
|
||||
inverterFault1B14("保留","保留"),
|
||||
inverterFault1B15("保留","保留"),
|
||||
|
||||
|
||||
//逆变器故障字2
|
||||
inverterFault2B0("A相硬件过流恢复","A相硬件过流"),
|
||||
inverterFault2B1("B相硬件过流恢复","B相硬件过流"),
|
||||
inverterFault2B2("C相硬件过流恢复","C相硬件过流"),
|
||||
inverterFault2B3("A相逐波限流超时恢复","A相逐波限流超时"),
|
||||
inverterFault2B4("B相逐波限流超时恢复","B相逐波限流超时"),
|
||||
inverterFault2B5("C相逐波限流超时恢复","C相逐波限流超时"),
|
||||
inverterFault2B6("母线硬件过压恢复","母线硬件过压"),
|
||||
inverterFault2B7("母线中点过压恢复","母线中点过压"),
|
||||
inverterFault2B8("保留","保留"),
|
||||
inverterFault2B9("保留","保留"),
|
||||
inverterFault2B10("保留","保留"),
|
||||
inverterFault2B11("保留","保留"),
|
||||
inverterFault2B12("保留","保留"),
|
||||
inverterFault2B13("保留","保留"),
|
||||
inverterFault2B14("保留","保留"),
|
||||
inverterFault2B15("保留","保留"),
|
||||
|
||||
//逆变器故障字3
|
||||
inverterFault3B0("电网AB线电压过压恢复","电网AB线电压过压"),
|
||||
inverterFault3B1("电网BC线电压过压恢复","电网BC线电压过压"),
|
||||
inverterFault3B2("电网CA线电压过压恢复","电网CA线电压过压"),
|
||||
inverterFault3B3("电网AB线电压欠压恢复","电网AB线电压欠压"),
|
||||
inverterFault3B4("电网BC线电压欠压恢复","电网BC线电压欠压"),
|
||||
inverterFault3B5("电网CA线电压欠压恢复","电网CA线电压欠压"),
|
||||
inverterFault3B6("保留","保留"),
|
||||
inverterFault3B7("保留","保留"),
|
||||
inverterFault3B8("电网过频恢复","电网过频"),
|
||||
inverterFault3B9("电网欠频恢复","电网欠频"),
|
||||
inverterFault3B10("保留","保留"),
|
||||
inverterFault3B11("孤岛效应保护恢复","孤岛效应保护"),
|
||||
inverterFault3B12("输出对地电压异常恢复","输出对地电压异常"),
|
||||
inverterFault3B13("保留","保留"),
|
||||
inverterFault3B14("低电压穿越保护恢复","低电压穿越保护"),
|
||||
inverterFault3B15("保留","保留"),
|
||||
|
||||
//逆变器故障字4
|
||||
inverterFault4B0("模块A相软件过流恢复","模块A相软件过流"),
|
||||
inverterFault4B1("模块B相软件过流恢复","模块B相软件过流"),
|
||||
inverterFault4B2("模块C相软件过流恢复","模块B相软件过流"),
|
||||
inverterFault4B3("模块电流不平衡恢复","模块电流不平衡"),
|
||||
inverterFault4B4("滤波电容欠压恢复"," 滤波电容欠压"),
|
||||
inverterFault4B5("模块温度过温恢复","模块温度过温"),
|
||||
inverterFault4B6("机内温度过温恢复","机内温度过温"),
|
||||
inverterFault4B7("直流分量超限恢复","直流分量超限"),
|
||||
inverterFault4B8("AD采样零漂过大恢复","AD采样零漂过大"),
|
||||
inverterFault4B9("残余电流持续超限恢复","残余电流持续超限"),
|
||||
inverterFault4B10("残余电流自检错误恢复","残余电流自检错误"),
|
||||
inverterFault4B11("保留","保留"),
|
||||
inverterFault4B12("保留","保留"),
|
||||
inverterFault4B13("逆变转换效率低恢复","逆变转换效率低"),
|
||||
inverterFault4B14("残余电流突变超限恢复","残余电流突变超限"),
|
||||
inverterFault4B15("保留","保留"),
|
||||
|
||||
//逆变器故障字5
|
||||
inverterFault5B0("逆变同期超时恢复","逆变同期超时"),
|
||||
inverterFault5B1("母线运行短路恢复","母线运行短路"),
|
||||
inverterFault5B2("保留","保留"),
|
||||
inverterFault5B3("保留","保留"),
|
||||
inverterFault5B4("保留","保留"),
|
||||
inverterFault5B5("母线运行过压恢复","母线运行过压"),
|
||||
inverterFault5B6("母线运行欠压恢复","母线运行欠压"),
|
||||
inverterFault5B7("母线电压不平衡恢复","母线电压不平衡"),
|
||||
inverterFault5B8("保留","保留"),
|
||||
inverterFault5B9("保留","保留"),
|
||||
inverterFault5B10("保留","保留"),
|
||||
inverterFault5B11("保留","保留"),
|
||||
inverterFault5B12("保留","保留"),
|
||||
inverterFault5B13("保留","保留"),
|
||||
inverterFault5B14("保留","保留"),
|
||||
inverterFault5B15("保留","保留"),
|
||||
|
||||
//逆变器故障字6
|
||||
inverterFault6B0("并网继电器开路恢复","并网继电器开路"),
|
||||
inverterFault6B1("并网继电器短路恢复","并网继电器短路"),
|
||||
inverterFault6B2("保留","保留"),
|
||||
inverterFault6B3("保留","保留"),
|
||||
inverterFault6B4("保留","保留"),
|
||||
inverterFault6B5("保留","保留"),
|
||||
inverterFault6B6("保留","保留"),
|
||||
inverterFault6B7("保留","保留"),
|
||||
inverterFault6B8("保留","保留"),
|
||||
inverterFault6B9("保留","保留"),
|
||||
inverterFault6B10("保留","保留"),
|
||||
inverterFault6B11("保留","保留"),
|
||||
inverterFault6B12("保留","保留"),
|
||||
inverterFault6B13("保留","保留"),
|
||||
inverterFault6B14("保留","保留"),
|
||||
inverterFault6B15("保留","保留"),
|
||||
|
||||
|
||||
//逆变器故障字7
|
||||
inverterFault7B0("辅助电源故障恢复","辅助电源故障"),
|
||||
inverterFault7B1("保留","保留"),
|
||||
inverterFault7B2("母线硬件过压恢复","母线硬件过压"),
|
||||
inverterFault7B3("硬件过流恢复","硬件过流"),
|
||||
inverterFault7B4("单元1硬件过流恢复","单元1硬件过流"),
|
||||
inverterFault7B5("单元2硬件过流恢复","单元2硬件过流"),
|
||||
inverterFault7B6("单元3硬件过流恢复","单元3硬件过流"),
|
||||
inverterFault7B7("单元4硬件过流恢复","单元4硬件过流"),
|
||||
inverterFault7B8("保留","保留"),
|
||||
inverterFault7B9("保留","保留"),
|
||||
inverterFault7B10("保留","保留"),
|
||||
inverterFault7B11("保留","保留"),
|
||||
inverterFault7B12("保留","保留"),
|
||||
inverterFault7B13("保留","保留"),
|
||||
inverterFault7B14("保留","保留"),
|
||||
inverterFault7B15("保留","保留"),
|
||||
|
||||
//逆变器故障字8
|
||||
inverterFault8B0("AD零漂过大恢复","AD零漂过大"),
|
||||
inverterFault8B1("RAM自检失败恢复","RAM自检失败"),
|
||||
inverterFault8B2("EEPROM参数回默认值恢复","EEPROM参数回默认值"),
|
||||
inverterFault8B3("EEPROM读写失败恢复","EEPROM读写失败"),
|
||||
inverterFault8B4("保留","保留"),
|
||||
inverterFault8B5("保留","保留"),
|
||||
inverterFault8B6("保留","保留"),
|
||||
inverterFault8B7("母线软件过压恢复","母线软件过压"),
|
||||
inverterFault8B8("单元1软件过流恢复","单元1软件过流"),
|
||||
inverterFault8B9("单元2软件过流恢复","单元2软件过流"),
|
||||
inverterFault8B10("单元3软件过流恢复","单元3软件过流"),
|
||||
inverterFault8B11("单元4软件过流恢复","单元4软件过流"),
|
||||
inverterFault8B12("输入极性接反恢复","输入极性接反"),
|
||||
inverterFault8B13("正极对地绝缘故障恢复","正极对地绝缘故障"),
|
||||
inverterFault8B14("负极对地绝缘故障恢复","负极对地绝缘故障"),
|
||||
inverterFault8B15("升压侧电路短路恢复","升压侧电路短路"),
|
||||
|
||||
//逆变器告警字3
|
||||
inverterAlarm3B0("保留","保留"),
|
||||
inverterAlarm3B1("保留","保留"),
|
||||
inverterAlarm3B2("保留","保留"),
|
||||
inverterAlarm3B3("保留","保留"),
|
||||
inverterAlarm3B4("保留","保留"),
|
||||
inverterAlarm3B5("保留","保留"),
|
||||
inverterAlarm3B6("电网异常恢复","电网异常"),
|
||||
inverterAlarm3B7("电网电压不平衡超限恢复","电网电压不平衡超限"),
|
||||
inverterAlarm3B8("保留","保留"),
|
||||
inverterAlarm3B9("保留","保留"),
|
||||
inverterAlarm3B10("电网相序反恢复","电网相序反"),
|
||||
inverterAlarm3B11("保留","保留"),
|
||||
inverterAlarm3B12("保留","保留"),
|
||||
inverterAlarm3B13("电网电压异常恢复","电网电压异常"),
|
||||
inverterAlarm3B14("保留","保留"),
|
||||
inverterAlarm3B15("保留","保留"),
|
||||
|
||||
//逆变器告警字4
|
||||
inverterAlarm4B0("保留","保留"),
|
||||
inverterAlarm4B1("保留","保留"),
|
||||
inverterAlarm4B2("保留","保留"),
|
||||
inverterAlarm4B3("保留","保留"),
|
||||
inverterAlarm4B4("保留","保留"),
|
||||
inverterAlarm4B5("保留","保留"),
|
||||
inverterAlarm4B6("保留","保留"),
|
||||
inverterAlarm4B7("保留","保留"),
|
||||
inverterAlarm4B8("保留","保留"),
|
||||
inverterAlarm4B9("保留","保留"),
|
||||
inverterAlarm4B10("保留","保留"),
|
||||
inverterAlarm4B11("保留","保留"),
|
||||
inverterAlarm4B12("逆变转换效率高恢复","逆变转换效率高"),
|
||||
inverterAlarm4B13("保留","保留"),
|
||||
inverterAlarm4B14("保留","保留"),
|
||||
inverterAlarm4B15("保留","保留"),
|
||||
|
||||
//逆变器告警字5
|
||||
inverterAlarm5B0("保留","保留"),
|
||||
inverterAlarm5B1("保留","保留"),
|
||||
inverterAlarm5B2("直流电压检测异常恢复","直流电压检测异常"),
|
||||
inverterAlarm5B3("保留","保留"),
|
||||
inverterAlarm5B4("保留","保留"),
|
||||
inverterAlarm5B5("保留","保留"),
|
||||
inverterAlarm5B6("保留","保留"),
|
||||
inverterAlarm5B7("保留","保留"),
|
||||
inverterAlarm5B8("DC输入电压高恢复","DC输入电压高"),
|
||||
inverterAlarm5B9("保留","保留"),
|
||||
inverterAlarm5B10("保留","保留"),
|
||||
inverterAlarm5B11("保留","保留"),
|
||||
inverterAlarm5B12("保留","保留"),
|
||||
inverterAlarm5B13("保留","保留"),
|
||||
inverterAlarm5B14("保留","保留"),
|
||||
inverterAlarm5B15("保留","保留"),
|
||||
|
||||
//逆变器告警字6
|
||||
inverterAlarm6B0("保留","保留"),
|
||||
inverterAlarm6B1("保留","保留"),
|
||||
inverterAlarm6B2("保留","保留"),
|
||||
inverterAlarm6B3("保留","保留"),
|
||||
inverterAlarm6B4("交流侧SPD异常恢复","交流侧SPD异常"),
|
||||
inverterAlarm6B5("内部风扇异常恢复","内部风扇异常"),
|
||||
inverterAlarm6B6("外部风扇异常恢复","外部风扇异常"),
|
||||
inverterAlarm6B7("保留","保留"),
|
||||
inverterAlarm6B8("保留","保留"),
|
||||
inverterAlarm6B9("保留","保留"),
|
||||
inverterAlarm6B10("保留","保留"),
|
||||
inverterAlarm6B11("保留","保留"),
|
||||
inverterAlarm6B12("保留","保留"),
|
||||
inverterAlarm6B13("保留","保留"),
|
||||
inverterAlarm6B14("保留","保留"),
|
||||
inverterAlarm6B15("保留","保留"),
|
||||
|
||||
//逆变器告警字7
|
||||
inverterAlarm7B0("直流侧SPD异常恢复","直流侧SPD异常"),
|
||||
inverterAlarm7B1("保留","保留"),
|
||||
inverterAlarm7B2("保留","保留"),
|
||||
inverterAlarm7B3("保留","保留"),
|
||||
inverterAlarm7B4("保留","保留"),
|
||||
inverterAlarm7B5("保留","保留"),
|
||||
inverterAlarm7B6("升压侧电路开路恢复","升压侧电路开路"),
|
||||
inverterAlarm7B7("保留","保留"),
|
||||
inverterAlarm7B8("组串异常告警恢复","组串异常告警"),
|
||||
inverterAlarm7B9("保留","保留"),
|
||||
inverterAlarm7B10("保留","保留"),
|
||||
inverterAlarm7B11("保留","保留"),
|
||||
inverterAlarm7B12("保留","保留"),
|
||||
inverterAlarm7B13("保留","保留"),
|
||||
inverterAlarm7B14("保留","保留"),
|
||||
inverterAlarm7B15("保留","保留"),
|
||||
;
|
||||
/**
|
||||
* 错误码
|
||||
*/
|
||||
private final String desc0;
|
||||
/**
|
||||
* 错误消息
|
||||
*/
|
||||
private final String desc1;
|
||||
|
||||
InverterHwCode(String desc0, String desc1) {
|
||||
this.desc0 = desc0;
|
||||
this.desc1 = desc1;
|
||||
} ;
|
||||
|
||||
|
||||
@Override
|
||||
public String getDesc0() {
|
||||
return this.desc0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDesc1() {
|
||||
return this.desc1;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,13 @@
|
||||
package com.ho.common.tools.exception;
|
||||
|
||||
/**
|
||||
* @Description 禾望逆变器枚举接口数据
|
||||
* Author yule
|
||||
* Date 2023/1/6 11:28
|
||||
*/
|
||||
public interface InverterHwCodeInterface {
|
||||
|
||||
String getDesc0();
|
||||
|
||||
String getDesc1();
|
||||
}
|
||||
@ -0,0 +1,9 @@
|
||||
package com.ho.common.tools.exception;
|
||||
|
||||
|
||||
public interface ResponseCodeInterface {
|
||||
|
||||
int getCode();
|
||||
|
||||
String getMsg();
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,113 @@
|
||||
package com.ho.common.tools.util;
|
||||
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.crypto.SecureUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.codec.binary.Base64;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import javax.crypto.Cipher;
|
||||
import javax.crypto.spec.IvParameterSpec;
|
||||
import javax.crypto.spec.SecretKeySpec;
|
||||
|
||||
/**
|
||||
* @author fancl
|
||||
* @desc: AES工具类
|
||||
* @date 2022/11/15
|
||||
*/
|
||||
@Slf4j
|
||||
public class AESEncryptUtil {
|
||||
|
||||
/**
|
||||
* 编码
|
||||
*/
|
||||
private static final String ENCODING = "UTF-8";
|
||||
/**
|
||||
* 算法
|
||||
*/
|
||||
private static final String ALGORITHM = "AES";
|
||||
/**
|
||||
* AES:加密方式 CBC:工作模式 PKCS5Padding:填充模式
|
||||
*/
|
||||
private static final String CBC_PKCS5_PADDING = "AES/CBC/PKCS5Padding";
|
||||
/**
|
||||
* 加密方法
|
||||
*
|
||||
* @param data 要加密的数据
|
||||
* @param aesKey 加密key
|
||||
* @param iv 偏移量
|
||||
* @return 加密的结果
|
||||
* @throws Exception
|
||||
*/
|
||||
public static String encrypt(String data, String aesKey, String iv) {
|
||||
if(data==null|| StringUtils.isEmpty(data)){
|
||||
return data;
|
||||
}
|
||||
/*
|
||||
* 新建一个密码编译器的实例,由三部分构成,用"/"分隔,分别代表如下
|
||||
* 1. 加密的类型(如AES,DES,RC2等)
|
||||
* 2. 模式(AES中包含ECB,CBC,CFB,CTR,CTS等)
|
||||
* 3. 补码方式(包含nopadding/PKCS5Padding等等)
|
||||
* 依据这三个参数可以创建很多种加密方式
|
||||
*/
|
||||
try {
|
||||
Cipher cipher = Cipher.getInstance(CBC_PKCS5_PADDING);
|
||||
//偏移量
|
||||
IvParameterSpec ivParameterSpec = new IvParameterSpec(iv.getBytes(ENCODING));
|
||||
//加密秘钥
|
||||
SecretKeySpec keySpec = new SecretKeySpec(aesKey.getBytes(ENCODING), ALGORITHM);
|
||||
//初始化密码编译器
|
||||
cipher.init(Cipher.ENCRYPT_MODE, keySpec, ivParameterSpec);
|
||||
//生成加密后的密文
|
||||
byte[] bytes = cipher.doFinal(data.getBytes(ENCODING));
|
||||
//将密文Base64转码返回
|
||||
return Base64.encodeBase64String(bytes);
|
||||
}catch (Exception e){
|
||||
log.error("参数加密失败 ,{}",e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 解密方法
|
||||
*
|
||||
* @param data 要解密的数据
|
||||
* @param aesKey 解密key
|
||||
* @param iv 偏移量
|
||||
* @return 解密的结果
|
||||
* @throws Exception
|
||||
*/
|
||||
public static String decrypt(String data, String aesKey, String iv) {
|
||||
if(data==null|| StringUtils.isEmpty(data)){
|
||||
return data;
|
||||
}
|
||||
try {
|
||||
Cipher cipher = Cipher.getInstance(CBC_PKCS5_PADDING);
|
||||
//偏移量
|
||||
IvParameterSpec ivParameterSpec = new IvParameterSpec(iv.getBytes(ENCODING));
|
||||
//加密秘钥
|
||||
SecretKeySpec keySpec = new SecretKeySpec(aesKey.getBytes(ENCODING), ALGORITHM);
|
||||
//初始化密码编译器
|
||||
cipher.init(Cipher.DECRYPT_MODE, keySpec, ivParameterSpec);
|
||||
byte[] bytes = cipher.doFinal(Base64.decodeBase64(data));
|
||||
return new String(bytes,ENCODING);
|
||||
}catch (Exception e){
|
||||
log.error("参数解密失败 ,{}",e);
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 生成默认的 key 和 iv,key = iv iv 的长度必须是16位
|
||||
**/
|
||||
public static String generateKeyAndIv() {
|
||||
String uid = SecureUtil.md5(String.valueOf(System.currentTimeMillis()));
|
||||
// 盐加密
|
||||
String salt = IdUtil.randomUUID();
|
||||
uid = SecureUtil.md5(uid + salt);
|
||||
return uid.substring(16);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,63 @@
|
||||
package com.ho.common.tools.util;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.ho.common.tools.entity.MyAddress;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
|
||||
@Slf4j
|
||||
public class AddressUntils {
|
||||
|
||||
static String secretKey = "NANBZ-3DNCZ-AFLXD-TZNIK-NI2L7-HOFDO";
|
||||
|
||||
/**
|
||||
* @param lat 纬度
|
||||
* @param lng 经度
|
||||
* @return
|
||||
*/
|
||||
public static MyAddress getAddress(String lat, String lng){
|
||||
MyAddress myAddress = null;
|
||||
try {
|
||||
JSONObject result = getLocationInfo(lat, lng).getJSONObject("result");
|
||||
JSONObject jsonObject = JSONObject.parseObject(result.toString());
|
||||
Object ad_info = jsonObject.get("ad_info");
|
||||
myAddress = JSONObject.parseObject(ad_info.toString(), MyAddress.class);
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
log.error("getAddress error:{}",e.getMessage());
|
||||
}
|
||||
return myAddress;
|
||||
}
|
||||
|
||||
public static JSONObject getLocationInfo(String lat, String lng) throws IOException {
|
||||
String urlString = "https://apis.map.qq.com/ws/geocoder/v1/?location=" + lat + "," + lng + "&key=" + secretKey;
|
||||
System.out.println("请求经纬度url:" + urlString);
|
||||
URL url = new URL(urlString);
|
||||
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
|
||||
conn.setDoInput(true);
|
||||
conn.setRequestMethod("GET");
|
||||
BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream(), "utf-8"));
|
||||
String line;
|
||||
String res = "";
|
||||
while ((line = in.readLine()) != null) {
|
||||
res += line + "\n";
|
||||
}
|
||||
in.close();
|
||||
JSONObject jsonObject = JSONObject.parseObject(res);
|
||||
return jsonObject;
|
||||
}
|
||||
|
||||
|
||||
public static void main(String[] args){
|
||||
MyAddress address = getAddress("31.331650", "120.673480");
|
||||
System.out.println(address);
|
||||
// address = getAddress("38.845614", "105.733502");
|
||||
// System.out.println(address);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,130 @@
|
||||
package com.ho.common.tools.util;
|
||||
|
||||
import com.aliyun.auth.credentials.Credential;
|
||||
import com.aliyun.auth.credentials.provider.StaticCredentialProvider;
|
||||
import com.aliyun.sdk.service.dysmsapi20170525.AsyncClient;
|
||||
import com.aliyun.sdk.service.dysmsapi20170525.models.SendBatchSmsRequest;
|
||||
import com.aliyun.sdk.service.dysmsapi20170525.models.SendBatchSmsResponse;
|
||||
import com.aliyun.sdk.service.dysmsapi20170525.models.SendSmsRequest;
|
||||
import com.aliyun.sdk.service.dysmsapi20170525.models.SendSmsResponse;
|
||||
import com.google.gson.Gson;
|
||||
import darabonba.core.client.ClientOverrideConfiguration;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
/**
|
||||
* 阿里发送短信工具类
|
||||
*/
|
||||
@Slf4j
|
||||
public class AliSendSmsUtils {
|
||||
|
||||
private static final String accessKeyId = "LTAI5tCQyHiB3ww1dKhVhedx";
|
||||
|
||||
private static final String accessKeySecret = "tvovJTgBVhn93rWcWTcoFekLrqHSCN";
|
||||
|
||||
/**
|
||||
* 发送短信
|
||||
* @param param JSON对象(),key分别为 name(用户名) siteName(电站名称) content (告警信息)
|
||||
* @param phoneNumbers
|
||||
* @throws Exception
|
||||
*/
|
||||
public static void sendMessage(String param,String phoneNumbers) throws Exception{
|
||||
sendMessage("弘正储能","SMS_463325018",param,phoneNumbers);
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送短信
|
||||
* @param param JSON对象(),key分别为 name(用户名),4G卡号: num siteName(电站名称) content (告警信息)
|
||||
* @param phoneNumbers
|
||||
* @throws Exception
|
||||
*/
|
||||
public static void sendFlowMessage(String param,String phoneNumbers) throws Exception{
|
||||
sendMessage("弘正储能","SMS_463625526",param,phoneNumbers);
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送短信
|
||||
* @param signName 签名
|
||||
* @param templateCode 模板
|
||||
* @param param 参数
|
||||
* @param phoneNumbers 被发送的电话号码
|
||||
* @throws Exception
|
||||
*/
|
||||
public static void sendMessage(String signName,String templateCode,String param,String phoneNumbers) throws Exception{
|
||||
StaticCredentialProvider provider = StaticCredentialProvider.create(Credential.builder()
|
||||
.accessKeyId(accessKeyId)
|
||||
.accessKeySecret(accessKeySecret)
|
||||
.build());
|
||||
|
||||
AsyncClient client = AsyncClient.builder()
|
||||
.credentialsProvider(provider)
|
||||
.overrideConfiguration(
|
||||
ClientOverrideConfiguration.create()
|
||||
.setEndpointOverride("dysmsapi.aliyuncs.com")
|
||||
)
|
||||
.build();
|
||||
|
||||
SendSmsRequest sendSmsRequest = SendSmsRequest.builder()
|
||||
.signName(signName)
|
||||
.templateCode(templateCode)
|
||||
.phoneNumbers(phoneNumbers)
|
||||
.build();
|
||||
if(param != null){
|
||||
sendSmsRequest = SendSmsRequest.builder()
|
||||
.signName(signName)
|
||||
.templateCode(templateCode)
|
||||
.templateParam(param)
|
||||
.phoneNumbers(phoneNumbers)
|
||||
.build();
|
||||
}
|
||||
CompletableFuture<SendSmsResponse> response = client.sendSms(sendSmsRequest);
|
||||
SendSmsResponse resp = response.get();
|
||||
System.out.println(new Gson().toJson(resp));
|
||||
client.close();
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量发送短信
|
||||
* @param signName 签名
|
||||
* @param templateCode 模板
|
||||
* @param param 参数
|
||||
* @param phoneNumbers 被发送的电话号码
|
||||
* @throws Exception
|
||||
*/
|
||||
public static void sendBatchMessage(String signName,String templateCode,String param,String phoneNumbers) throws Exception{
|
||||
StaticCredentialProvider provider = StaticCredentialProvider.create(Credential.builder()
|
||||
.accessKeyId(accessKeyId)
|
||||
.accessKeySecret(accessKeySecret)
|
||||
.build());
|
||||
|
||||
AsyncClient client = AsyncClient.builder()
|
||||
.credentialsProvider(provider)
|
||||
.overrideConfiguration(
|
||||
ClientOverrideConfiguration.create()
|
||||
.setEndpointOverride("dysmsapi.aliyuncs.com")
|
||||
)
|
||||
.build();
|
||||
|
||||
SendBatchSmsRequest sendBatchSmsRequest = SendBatchSmsRequest.builder()
|
||||
.signNameJson(signName)
|
||||
.templateCode(templateCode)
|
||||
.phoneNumberJson(phoneNumbers)
|
||||
.build();
|
||||
|
||||
CompletableFuture<SendBatchSmsResponse> response = client.sendBatchSms(sendBatchSmsRequest);
|
||||
SendBatchSmsResponse resp = response.get();
|
||||
System.out.println(new Gson().toJson(resp));
|
||||
client.close();
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
// JSONObject param = new JSONObject();
|
||||
// param.put(CommonConstant.SMS.SITE_NAME,"test");
|
||||
// param.put(CommonConstant.SMS.CONTENT,CommonConstant.Heartbeat.STATION_FAIL);
|
||||
// param.put(CommonConstant.SMS.NAME,"json");
|
||||
// sendMessage(param.toJSONString(),"");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,27 @@
|
||||
package com.ho.common.tools.util;
|
||||
|
||||
import com.googlecode.aviator.AviatorEvaluator;
|
||||
import com.googlecode.aviator.Expression;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 通过Aviator工具解析公式
|
||||
*/
|
||||
@Slf4j
|
||||
public class AviatorUtils {
|
||||
|
||||
/**
|
||||
* 解析公式
|
||||
* @param context 参数集
|
||||
* @param expression 公式表达式
|
||||
* @return
|
||||
*/
|
||||
public static Object analysisFormula(Map<String, Object> context,String expression){
|
||||
Expression compiledExp = AviatorEvaluator.compile(expression);
|
||||
//通过注入的上下文执行
|
||||
Object result = compiledExp.execute(context);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,181 @@
|
||||
package com.ho.common.tools.util;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* @Description BigDecimal工具类
|
||||
* Author yule
|
||||
* Date 2022/10/31 14:31
|
||||
*/
|
||||
@Component
|
||||
public class BigDecimalUtil {
|
||||
|
||||
|
||||
/**
|
||||
* 将传入对象中的BigDecimal类型的属性保留两位小数
|
||||
*
|
||||
* @param object
|
||||
* @return
|
||||
*/
|
||||
public Object keepTwoDecimalPlaces(Object object) {
|
||||
for (Field f : object.getClass().getDeclaredFields()) {
|
||||
f.setAccessible(true);
|
||||
if (f.getType().equals(BigDecimal.class)) {
|
||||
try {
|
||||
if (f.get(object) != null) {
|
||||
BigDecimal bigDecimal = new BigDecimal(Objects.toString(f.get(object))).setScale(2, BigDecimal.ROUND_HALF_UP);
|
||||
f.set(object, bigDecimal);
|
||||
}
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
if (f.getType().equals(Double.class)) {
|
||||
try {
|
||||
if (f.get(object) != null) {
|
||||
BigDecimal bigDecimal = new BigDecimal(Objects.toString(f.get(object))).setScale(2, BigDecimal.ROUND_HALF_UP);
|
||||
double doubleValue = bigDecimal.doubleValue();
|
||||
f.set(object, doubleValue);
|
||||
}
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
return object;
|
||||
}
|
||||
|
||||
/**
|
||||
* 将传入对象中的BigDecimal类型的属性保留num位小数
|
||||
*
|
||||
* @param object
|
||||
* @param num
|
||||
* @return
|
||||
*/
|
||||
public Object keepDecimalPlaces(Object object,Integer num) {
|
||||
for (Field f : object.getClass().getDeclaredFields()) {
|
||||
f.setAccessible(true);
|
||||
if (f.getType().equals(BigDecimal.class)) {
|
||||
try {
|
||||
if (f.get(object) != null) {
|
||||
BigDecimal bigDecimal = new BigDecimal(Objects.toString(f.get(object))).setScale(num, BigDecimal.ROUND_HALF_UP);
|
||||
f.set(object, bigDecimal);
|
||||
}
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
return object;
|
||||
}
|
||||
|
||||
public Object ifIsNUll(Object object) {
|
||||
for (Field f : object.getClass().getDeclaredFields()) {
|
||||
f.setAccessible(true);
|
||||
if (f.getType().equals(BigDecimal.class)) {
|
||||
|
||||
try {
|
||||
if (f.get(object) == null) {
|
||||
BigDecimal bigDecimal = BigDecimal.ZERO;
|
||||
f.set(object, bigDecimal);
|
||||
}
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
else if (f.getType().equals(Integer.class)) {
|
||||
try {
|
||||
if (f.get(object) == null) {
|
||||
Integer integer = 0;
|
||||
f.set(object, integer);
|
||||
}
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
else if (f.getType().equals(Long.class)) {
|
||||
try {
|
||||
if (f.get(object) == null) {
|
||||
Long num = 0L;
|
||||
f.set(object, num);
|
||||
}
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
else if (f.getType().equals(Double.class)) {
|
||||
try {
|
||||
if (f.get(object) == null) {
|
||||
Double num = 0.00;
|
||||
f.set(object, num);
|
||||
}
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
else if (f.getType().equals(Float.class)) {
|
||||
try {
|
||||
if (f.get(object) == null) {
|
||||
Float num = 0f;
|
||||
f.set(object, num);
|
||||
}
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return object;
|
||||
}
|
||||
|
||||
|
||||
public Boolean ifStringLength(Object object) {
|
||||
Boolean isString = false;
|
||||
for (Field f : object.getClass().getDeclaredFields()) {
|
||||
f.setAccessible(true);
|
||||
if (f.getType().equals(String.class)) {
|
||||
|
||||
try {
|
||||
if(((String)f.get(object)) != null){
|
||||
if (((String)f.get(object)).length() > 50) {
|
||||
isString = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
return isString;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据unitType放大,2:放大1000倍;3: 放大1000000倍;
|
||||
* @param data
|
||||
* @param unitType
|
||||
* @return
|
||||
*/
|
||||
public BigDecimal unitConversion(BigDecimal data, Integer unitType) {
|
||||
BigDecimal result = null;
|
||||
switch (unitType) {
|
||||
case 2:
|
||||
result = data.multiply(new BigDecimal(1000));
|
||||
break;
|
||||
case 3:
|
||||
result = data.multiply(new BigDecimal(1000)).multiply(new BigDecimal(1000));
|
||||
break;
|
||||
default:
|
||||
result = data;
|
||||
break;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,35 @@
|
||||
package com.ho.common.tools.util;
|
||||
|
||||
import java.math.BigInteger;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.security.MessageDigest;
|
||||
|
||||
public class CheckCodeUtils {
|
||||
|
||||
/**
|
||||
* 获取校验码
|
||||
* @param str
|
||||
* @return
|
||||
*/
|
||||
public static String getCheckCode(String str){
|
||||
String checkCode = null;
|
||||
try {
|
||||
MessageDigest md = MessageDigest.getInstance("MD5");
|
||||
md.update(str.getBytes());
|
||||
String s = new BigInteger(1, md.digest()).toString(16);
|
||||
byte[] hash = md.digest(s.getBytes(StandardCharsets.UTF_8));
|
||||
// 使用Base64编码,并在每个部分添加横杠
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (byte b : hash) {
|
||||
sb.append(String.format("%02x", b));
|
||||
if (sb.length() % 5== 0) {
|
||||
sb.append("-");
|
||||
}
|
||||
}
|
||||
checkCode = sb.toString();
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
return checkCode;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,50 @@
|
||||
package com.ho.common.tools.util;
|
||||
|
||||
/**
|
||||
* 编码工具类
|
||||
*/
|
||||
public class CodeUtil {
|
||||
//部门编号前缀
|
||||
public static final String DEPT_PREFIX = "DEP";
|
||||
//自动生成的角色编号前缀
|
||||
public static final String AUTO_ROLE_PREFIX = "AUTO_ROLE";
|
||||
//工单前缀
|
||||
public static final String WORK_ORDER_PREFIX = "GD" ;
|
||||
//电价前缀
|
||||
public static final String PRICE_TEMPLATE_PREFIX = "PT" ;
|
||||
|
||||
/**
|
||||
* 右补位,左对齐
|
||||
*
|
||||
* @param len 目标字符串长度
|
||||
* @param alexin 补位字符
|
||||
* @return 目标字符串
|
||||
* 以alexin 做为补位
|
||||
* @pparam oriStr 原字符串
|
||||
*/
|
||||
public static String padRight(String oriStr, int len, String alexin) {
|
||||
String str = "";
|
||||
int strlen = oriStr.length();
|
||||
if (strlen < len) {
|
||||
for (int i = 0; i < len - strlen; i++) {
|
||||
str = str + alexin;
|
||||
}
|
||||
}
|
||||
str = str + oriStr;
|
||||
return str;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取机构编码 DEP0001
|
||||
* @param prefix 前缀
|
||||
* @param oriStr 初始值
|
||||
* @param len 位数
|
||||
* @param alexin 不足 以什么补充
|
||||
* @return java.lang.String
|
||||
* @throws
|
||||
*/
|
||||
public static String getCode(String prefix, String oriStr, int len, String alexin) {
|
||||
return prefix + padRight(oriStr, len, alexin);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,88 @@
|
||||
package com.ho.common.tools.util;
|
||||
|
||||
import com.ho.common.tools.exception.BaseResponseCode;
|
||||
import com.ho.common.tools.exception.BusinessException;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.io.RandomAccessFile;
|
||||
|
||||
/**
|
||||
* @Description 字节数据处理工具类
|
||||
* Author yule
|
||||
* Date 2022/11/9 16:27
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
public class CommonBytesUtil {
|
||||
|
||||
|
||||
//获取文件大小
|
||||
public long getFileSize(String path) {
|
||||
if (!new File(path).exists()){
|
||||
throw new BusinessException(BaseResponseCode.FILE_NOT_EXISTS) ;
|
||||
}
|
||||
try {
|
||||
RandomAccessFile raf = new RandomAccessFile(path, "r");
|
||||
long length = raf.length();
|
||||
raf.close();
|
||||
return length;
|
||||
} catch (FileNotFoundException e) {
|
||||
return 0;
|
||||
}catch (IOException e){
|
||||
log.error(e.getMessage());
|
||||
}
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
//按位置分块读取文件内容
|
||||
public byte[] readBlock(String path, int pointer) throws Exception {
|
||||
File file = new File(path);
|
||||
if (!file.exists()){
|
||||
throw new BusinessException(BaseResponseCode.FILE_NOT_EXISTS) ;
|
||||
}
|
||||
RandomAccessFile raf = new RandomAccessFile(path, "r");
|
||||
long length = raf.length();
|
||||
System.out.println("文件大小:" + length);
|
||||
//设置指针的位置,每次有偏移
|
||||
raf.seek(pointer);
|
||||
//每次读取10485760字节(10M),这个应该改为参数配置
|
||||
byte[] bytes = new byte[(int) length];
|
||||
int readSize = raf.read(bytes);
|
||||
//如果没有读到102400个字节,需要做数组拷贝
|
||||
//读取时判断是否还有剩余字节
|
||||
if (readSize < length) {
|
||||
byte[] copy = new byte[readSize];
|
||||
System.arraycopy(bytes, 0, copy, 0, readSize);
|
||||
raf.close();
|
||||
return copy;
|
||||
}
|
||||
raf.close();
|
||||
return bytes;
|
||||
}
|
||||
|
||||
/**
|
||||
* 将byte转为16进制
|
||||
*
|
||||
* @param bytes
|
||||
* @return
|
||||
*/
|
||||
public String byte2Hex(byte[] bytes) {
|
||||
StringBuffer stringBuffer = new StringBuffer();
|
||||
String temp = null;
|
||||
for (int i = 0; i < bytes.length; i++) {
|
||||
temp = Integer.toHexString(bytes[i] & 0xFF);
|
||||
if (temp.length() == 1) {
|
||||
//1得到一位的进行补0操作
|
||||
stringBuffer.append("0");
|
||||
}
|
||||
stringBuffer.append(temp);
|
||||
}
|
||||
return stringBuffer.toString();
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,84 @@
|
||||
package com.ho.common.tools.util;
|
||||
|
||||
import cn.hutool.core.date.DateField;
|
||||
import com.ho.common.tools.constant.CommonConstant;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 自定义时间工具类
|
||||
*/
|
||||
public class CustomTimeUtils {
|
||||
|
||||
|
||||
/**
|
||||
* 计算开始时间与结束时间差值,按照分钟分割
|
||||
* @param beginTime
|
||||
* @param endTime
|
||||
* @return
|
||||
*/
|
||||
public static int getTimeDifferenceByMinute(String beginTime, String endTime){
|
||||
return getTimeDifference( beginTime, endTime, CommonConstant.SIXTY);
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算开始时间与结束时间差值,按照秒钟分割
|
||||
* @param beginTime
|
||||
* @param endTime
|
||||
* @return
|
||||
*/
|
||||
public static int getTimeDifferenceBySecond(String beginTime, String endTime){
|
||||
return getTimeDifference( beginTime, endTime, CommonConstant.ONE);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取采集粒度
|
||||
* @param beginTime
|
||||
* @param endTime
|
||||
* @param unit
|
||||
* @return
|
||||
*/
|
||||
public static int getSamlRate(String beginTime, String endTime,final DateField unit ){
|
||||
int samlRate = 1,timeDifference=0;
|
||||
if(unit==DateField.SECOND){
|
||||
timeDifference = getTimeDifference( beginTime, endTime, CommonConstant.ONE);
|
||||
}else if(unit == DateField.MINUTE){
|
||||
timeDifference = getTimeDifference( beginTime, endTime, CommonConstant.SIXTY);
|
||||
}
|
||||
if (timeDifference <= 1441) {
|
||||
samlRate = 1;
|
||||
} else {
|
||||
double divisor = 1441;
|
||||
double flag = Math.ceil(timeDifference / divisor); //向上取整计算
|
||||
samlRate = (int) flag;
|
||||
}
|
||||
return samlRate;
|
||||
}
|
||||
|
||||
private static int getTimeDifference(String beginTime, String endTime,Integer num) {
|
||||
//一、时间减法可以用Calendar对象加法中,把第二个参数换成负数可以时间,这边就不列举了;使用第二种方式做时间减法
|
||||
//1、指定两个Date对象,业务中可以以参数的形式传递,不用new当前时间。
|
||||
int diffMinute = 0;
|
||||
try {
|
||||
DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
Date begin = dateFormat.parse(beginTime);
|
||||
Date end = dateFormat.parse(endTime);
|
||||
//2、时间戳相减
|
||||
long endDateTime = end.getTime();
|
||||
long beginDateTime = begin.getTime();
|
||||
BigDecimal result = new BigDecimal(endDateTime).subtract(new BigDecimal(beginDateTime));//毫秒
|
||||
//换算成分钟
|
||||
BigDecimal minute = result.divide(new BigDecimal(1000));//60秒等于1分钟
|
||||
BigDecimal divide = minute.divide(new BigDecimal(num), 1, BigDecimal.ROUND_UP);
|
||||
diffMinute = divide.intValue();
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
return diffMinute;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,88 @@
|
||||
package com.ho.common.tools.util;
|
||||
|
||||
import com.ho.common.tools.constant.CommonConstant;
|
||||
import com.alibaba.excel.util.DateUtils;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author fancl
|
||||
* @desc:
|
||||
* @date 2023/5/5
|
||||
*/
|
||||
public class DateNewUtil {
|
||||
|
||||
public static void main(String[] args) {
|
||||
String begin = "2023-03-04";
|
||||
String end = "2023-05-04";
|
||||
List<String> betweenDates = DateNewUtil.getBetweenDates(begin, end, true);
|
||||
System.out.println();
|
||||
}
|
||||
|
||||
|
||||
public static List<String> getBetweenDates(String startTime, String endTime, boolean isIncludeStartTime){
|
||||
List<String> result = new ArrayList<>();
|
||||
try {
|
||||
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
|
||||
Date d1 = new SimpleDateFormat("yyyy-MM-dd").parse(startTime);//定义起始日期
|
||||
Date d2 = new SimpleDateFormat("yyyy-MM-dd").parse(endTime);//定义结束日期 可以去当前月也可以手动写日期。
|
||||
Calendar dd = Calendar.getInstance();//定义日期实例
|
||||
dd.setTime(d1);//设置日期起始时间
|
||||
if(isIncludeStartTime) {
|
||||
result.add(format.format(d1));
|
||||
}
|
||||
while (dd.getTime().before(d2)) {//判断是否到结束日期
|
||||
dd.add(Calendar.DATE, 1);//进行当前日期加1
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||
String str = sdf.format(dd.getTime());
|
||||
result.add(str);
|
||||
System.out.println(str);
|
||||
}
|
||||
}catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取最靠近当前时间特定间隔的时间点
|
||||
* @param date 时间
|
||||
* @param interval 间隔
|
||||
* @param flow 方向 0代表向下,1代表向上
|
||||
* @return
|
||||
*/
|
||||
public static Date roundToNearestQuarter(Date date,Integer interval,Integer flow) {
|
||||
Calendar time = Calendar.getInstance();
|
||||
time.setTime(date);
|
||||
int minutes = time.get(Calendar.MINUTE);
|
||||
int newMinutes = (minutes / interval) * interval;
|
||||
Float middle = interval/CommonConstant.F_TWO;
|
||||
if(flow != null){
|
||||
if(CommonConstant.ZERO.equals(flow)){
|
||||
time.set(Calendar.MINUTE, newMinutes);
|
||||
}else if(CommonConstant.ONE.equals(flow)){
|
||||
newMinutes += interval;
|
||||
time.set(Calendar.MINUTE, newMinutes);
|
||||
}
|
||||
}else{
|
||||
if (minutes - newMinutes < middle) {
|
||||
// 如果距离小于一半,向下舍入
|
||||
time.set(Calendar.MINUTE, newMinutes);
|
||||
} else {
|
||||
// 如果距离大于或等于一半,向上舍入
|
||||
newMinutes += interval;
|
||||
time.set(Calendar.MINUTE, newMinutes);
|
||||
}
|
||||
}
|
||||
// 将秒数设置为0
|
||||
time.set(Calendar.SECOND, 0);
|
||||
return time.getTime();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,116 @@
|
||||
package com.ho.common.tools.util;
|
||||
|
||||
import com.alibaba.excel.EasyExcel;
|
||||
import com.alibaba.excel.ExcelWriter;
|
||||
import com.alibaba.excel.support.ExcelTypeEnum;
|
||||
import com.alibaba.excel.write.builder.ExcelWriterSheetBuilder;
|
||||
import com.alibaba.excel.write.metadata.WriteSheet;
|
||||
import com.alibaba.excel.write.metadata.style.WriteCellStyle;
|
||||
import com.alibaba.excel.write.style.HorizontalCellStyleStrategy;
|
||||
import org.apache.poi.ss.usermodel.FillPatternType;
|
||||
import org.apache.poi.ss.usermodel.HorizontalAlignment;
|
||||
import org.apache.poi.ss.usermodel.IndexedColors;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Description : excel工具类
|
||||
* @Author : xueweizhi
|
||||
* @Date : 2023/3/18 13:52
|
||||
*/
|
||||
public class EasyExcelUtil {
|
||||
|
||||
public static void writeExcel(HttpServletResponse response, List<? extends Object> data, String fileName, String sheetName, Class clazz) throws Exception {
|
||||
//表头样式
|
||||
WriteCellStyle headWriteCellStyle = new WriteCellStyle();
|
||||
//设置表头居中对齐
|
||||
headWriteCellStyle.setHorizontalAlignment(HorizontalAlignment.CENTER);
|
||||
//设置表头背景色
|
||||
headWriteCellStyle.setFillForegroundColor(IndexedColors.WHITE.getIndex());
|
||||
headWriteCellStyle.setFillPatternType(FillPatternType.SOLID_FOREGROUND);
|
||||
//内容样式
|
||||
WriteCellStyle contentWriteCellStyle = new WriteCellStyle();
|
||||
//设置内容靠左对齐
|
||||
contentWriteCellStyle.setHorizontalAlignment(HorizontalAlignment.LEFT);
|
||||
//设置内容自动换行
|
||||
contentWriteCellStyle.setWrapped(true);
|
||||
HorizontalCellStyleStrategy horizontalCellStyleStrategy = new HorizontalCellStyleStrategy(headWriteCellStyle, contentWriteCellStyle);
|
||||
EasyExcel.write(getOutputStream(fileName, response), clazz).excelType(ExcelTypeEnum.XLSX).sheet(sheetName).registerWriteHandler(horizontalCellStyleStrategy).doWrite(data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 自定义标题
|
||||
* @param response
|
||||
* @param data
|
||||
* @param fileName
|
||||
* @param sheetName
|
||||
* @param clazz
|
||||
* @param headMap
|
||||
* @throws Exception
|
||||
*/
|
||||
public static void writeExcel(HttpServletResponse response, List<? extends Object> data, String fileName, String sheetName, Class clazz,Map<String,String> headMap) throws Exception {
|
||||
//表头样式
|
||||
WriteCellStyle headWriteCellStyle = new WriteCellStyle();
|
||||
//设置表头居中对齐
|
||||
headWriteCellStyle.setHorizontalAlignment(HorizontalAlignment.CENTER);
|
||||
//设置表头背景色
|
||||
headWriteCellStyle.setFillForegroundColor(IndexedColors.WHITE.getIndex());
|
||||
headWriteCellStyle.setFillPatternType(FillPatternType.SOLID_FOREGROUND);
|
||||
//设置字体颜色
|
||||
// WriteFont font = new WriteFont();
|
||||
// font.setColor(IndexedColors.RED.getIndex());
|
||||
// headWriteCellStyle.setWriteFont(font);
|
||||
//内容样式
|
||||
WriteCellStyle contentWriteCellStyle = new WriteCellStyle();
|
||||
//设置内容靠左对齐
|
||||
contentWriteCellStyle.setHorizontalAlignment(HorizontalAlignment.LEFT);
|
||||
//设置内容自动换行
|
||||
contentWriteCellStyle.setWrapped(true);
|
||||
HorizontalCellStyleStrategy horizontalCellStyleStrategy = new HorizontalCellStyleStrategy(headWriteCellStyle, contentWriteCellStyle);
|
||||
EasyExcel.write(getOutputStream(fileName, response), clazz).excelType(ExcelTypeEnum.XLSX).sheet(sheetName).registerWriteHandler(horizontalCellStyleStrategy).registerWriteHandler(new TitleCellWriteHandler(headMap)).doWrite(data);
|
||||
}
|
||||
|
||||
private static OutputStream getOutputStream(String fileName, HttpServletResponse response) throws Exception {
|
||||
fileName = URLEncoder.encode(fileName, "UTF-8");
|
||||
response.setContentType("application/vnd.ms-excel");
|
||||
response.setCharacterEncoding("utf8");
|
||||
response.setHeader("Content-Disposition", "attachment;filename=" + fileName + ".xlsx");
|
||||
return response.getOutputStream();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 合并导出
|
||||
* @param templatePath 模板地址
|
||||
* @param dataMap 数据
|
||||
* @param fileName 文件名
|
||||
* @param exportFieldGroupCountList 合并行长度集合
|
||||
* @param mergeColumn 合并列标记
|
||||
*/
|
||||
public static void mergeExport(String templatePath, Map<String, Object> dataMap, String fileName, HttpServletResponse response,
|
||||
List<Integer> exportFieldGroupCountList, List<Integer> mergeColumn){
|
||||
response.setContentType("application/octet-stream; charset=utf-8");
|
||||
response.setHeader("Content-Disposition", String.format("attachment;filename=%s",fileName));
|
||||
InputStream in = EasyExcelUtil.class.getClassLoader().getResourceAsStream(templatePath);
|
||||
try(ExcelWriter excelWriter = EasyExcel.write(response.getOutputStream()).withTemplate(in).build()){
|
||||
ExcelWriterSheetBuilder builder = new ExcelWriterSheetBuilder();
|
||||
// 设置合并的列
|
||||
for(Integer col:mergeColumn){
|
||||
builder.registerWriteHandler(new ExcelFillCellMergeStrategy(exportFieldGroupCountList,col));
|
||||
}
|
||||
WriteSheet writeSheet = builder.build();
|
||||
excelWriter.fill(dataMap.get("list"),writeSheet);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,64 @@
|
||||
package com.ho.common.tools.util;
|
||||
|
||||
import com.alibaba.excel.metadata.Head;
|
||||
import com.alibaba.excel.write.merge.AbstractMergeStrategy;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.poi.ss.usermodel.Cell;
|
||||
import org.apache.poi.ss.usermodel.Sheet;
|
||||
import org.apache.poi.ss.util.CellRangeAddress;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Slf4j
|
||||
public class ExcelFillCellMergeStrategy extends AbstractMergeStrategy {
|
||||
|
||||
/**
|
||||
* 分组,每几行合并一次
|
||||
*/
|
||||
private List<Integer> exportFieldGroupCountList;
|
||||
|
||||
/**
|
||||
* 目标合并列index
|
||||
*/
|
||||
private Integer targetColumnIndex;
|
||||
|
||||
// 需要开始合并单元格的首行index
|
||||
private Integer rowIndex;
|
||||
|
||||
public ExcelFillCellMergeStrategy(){
|
||||
|
||||
}
|
||||
|
||||
// exportDataList为待合并目标列的值
|
||||
public ExcelFillCellMergeStrategy(List<Integer> exportFieldGroupCountList, Integer targetColumnIndex) {
|
||||
this.exportFieldGroupCountList = exportFieldGroupCountList;
|
||||
this.targetColumnIndex = targetColumnIndex;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void merge(Sheet sheet, Cell cell, Head head, Integer integer) {
|
||||
if (null == rowIndex) {
|
||||
rowIndex = cell.getRowIndex();
|
||||
}
|
||||
// 只有合并的行与标记行相对应时才进行合并
|
||||
if (cell.getRowIndex() == rowIndex && cell.getColumnIndex() == targetColumnIndex) {
|
||||
mergeGroupColumn(sheet);
|
||||
}
|
||||
}
|
||||
|
||||
private void mergeGroupColumn(Sheet sheet) {
|
||||
int rowCount = rowIndex;
|
||||
for(Integer count:exportFieldGroupCountList){
|
||||
// 1行调用合并方法会报错
|
||||
if(count == 1){
|
||||
rowCount += 1;
|
||||
continue;
|
||||
}
|
||||
// 合并单元格
|
||||
CellRangeAddress cellAddresses = new CellRangeAddress(rowCount,rowCount+count-1,targetColumnIndex,targetColumnIndex);
|
||||
sheet.addMergedRegion(cellAddresses);
|
||||
rowCount += count;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,18 @@
|
||||
package com.ho.common.tools.util;
|
||||
|
||||
/**
|
||||
* @author fancl
|
||||
* @desc:
|
||||
* @date 2022/11/9
|
||||
*/
|
||||
public class FastUtils {
|
||||
|
||||
//验证是否为 手机号(手机)
|
||||
public static boolean checkPhoneNumber(String strNumber){
|
||||
if(strNumber.matches("^[1][3,4,5,7,8,9][0-9]{9}$")){
|
||||
return true;
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,37 @@
|
||||
package com.ho.common.tools.util;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Description :文件、命令相关请求,边端返回response对应的中文含义
|
||||
* @Author : HXJ
|
||||
* @Date : 2023/3/24 14:59
|
||||
*/
|
||||
public class FileResponseUtil {
|
||||
|
||||
/**
|
||||
* 根据Mqtt会议的response,获取对应的意思
|
||||
*
|
||||
* @param resp
|
||||
* @return
|
||||
*/
|
||||
public static String getFileResponse(Integer resp) {
|
||||
if (resp == null) {
|
||||
return "";
|
||||
}
|
||||
Map<Integer, String> respMap = new HashMap<>();
|
||||
respMap.put(1, "边端太忙没空");
|
||||
respMap.put(2, "边端拒绝,您没有权限操作");
|
||||
respMap.put(3, "边端文件不存在");
|
||||
respMap.put(4, "边端路径不存在");
|
||||
respMap.put(5, "边端存储空间不够");
|
||||
respMap.put(6, "其他");
|
||||
respMap.put(7, "文件夹非空");
|
||||
String msg = respMap.get(resp);
|
||||
if (msg == null) {
|
||||
msg = "";
|
||||
}
|
||||
return msg;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,56 @@
|
||||
package com.ho.common.tools.util;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
/**
|
||||
* IP地址
|
||||
*
|
||||
*/
|
||||
public class IPUtils {
|
||||
|
||||
private static Logger logger = LoggerFactory.getLogger(IPUtils.class);
|
||||
|
||||
/**
|
||||
* 获取IP地址
|
||||
*
|
||||
* 使用Nginx等反向代理软件, 则不能通过request.getRemoteAddr()获取IP地址
|
||||
* 如果使用了多级反向代理的话,X-Forwarded-For的值并不止一个,而是一串IP地址,X-Forwarded-For中第一个非unknown的有效IP字符串,则为真实IP地址
|
||||
*/
|
||||
public static String getIpAddr(HttpServletRequest request) {
|
||||
String ip = null;
|
||||
try {
|
||||
ip = request.getHeader("x-forwarded-for");
|
||||
if (StringUtils.isEmpty(ip) || "unknown".equalsIgnoreCase(ip)) {
|
||||
ip = request.getHeader("Proxy-Client-IP");
|
||||
}
|
||||
if (StringUtils.isEmpty(ip) || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
|
||||
ip = request.getHeader("WL-Proxy-Client-IP");
|
||||
}
|
||||
if (StringUtils.isEmpty(ip) || "unknown".equalsIgnoreCase(ip)) {
|
||||
ip = request.getHeader("HTTP_CLIENT_IP");
|
||||
}
|
||||
if (StringUtils.isEmpty(ip) || "unknown".equalsIgnoreCase(ip)) {
|
||||
ip = request.getHeader("HTTP_X_FORWARDED_FOR");
|
||||
}
|
||||
if (StringUtils.isEmpty(ip) || "unknown".equalsIgnoreCase(ip)) {
|
||||
ip = request.getRemoteAddr();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("IPUtils ERROR ", e);
|
||||
}
|
||||
|
||||
// 使用代理,则获取第一个IP地址
|
||||
if (StringUtils.isEmpty(ip) && ip.length() > 15) {
|
||||
if (ip.indexOf(",") > 0) {
|
||||
ip = ip.substring(0, ip.indexOf(","));
|
||||
}
|
||||
}
|
||||
|
||||
return ip;
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,110 @@
|
||||
package com.ho.common.tools.util;
|
||||
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import com.ho.common.tools.exception.BaseResponseCode;
|
||||
import com.ho.common.tools.exception.BusinessException;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang.RandomStringUtils;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.crypto.Mac;
|
||||
import javax.crypto.spec.SecretKeySpec;
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* @Description mqtt token工具类
|
||||
* Author yule
|
||||
* Date 2022/12/7 11:14
|
||||
*/
|
||||
@Component
|
||||
@Slf4j
|
||||
public class MqttUtil {
|
||||
|
||||
// @Value("${secret.loginSecret}")
|
||||
// String loginSecret;
|
||||
|
||||
public String getToken(){
|
||||
|
||||
String token = null;
|
||||
//对当前时间进行加密
|
||||
long time = System.currentTimeMillis() / 300000;
|
||||
|
||||
String loginSecret = "6131231@#42a765#";
|
||||
try {
|
||||
Mac sha256_HMAC = Mac.getInstance("HmacSHA256");
|
||||
SecretKeySpec secretKey = new SecretKeySpec(loginSecret.getBytes("utf-8"), "HmacSHA256");
|
||||
sha256_HMAC.init(secretKey);
|
||||
byte[] bytes = sha256_HMAC.doFinal(String.valueOf(time).getBytes("utf-8"));
|
||||
String hexStr = Convert.toHex(bytes);
|
||||
//截取到加密后的前20个字符
|
||||
token = "v1:" + hexStr.substring(0, 20);
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}finally {
|
||||
if (token == null) {
|
||||
throw new BusinessException(BaseResponseCode.MQTT_TOKEN_GENERATE_FALL);
|
||||
}
|
||||
}
|
||||
return token;
|
||||
}
|
||||
|
||||
public String getToken(long time){
|
||||
|
||||
String token = null;
|
||||
//对当前时间进行加密
|
||||
String loginSecret = "6131231@#42a765#";
|
||||
try {
|
||||
Mac sha256_HMAC = Mac.getInstance("HmacSHA256");
|
||||
SecretKeySpec secretKey = new SecretKeySpec(loginSecret.getBytes("utf-8"), "HmacSHA256");
|
||||
sha256_HMAC.init(secretKey);
|
||||
byte[] bytes = sha256_HMAC.doFinal(String.valueOf(time).getBytes("utf-8"));
|
||||
String hexStr = Convert.toHex(bytes);
|
||||
//截取到加密后的前20个字符
|
||||
token = "v1:" + hexStr.substring(0, 20);
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}finally {
|
||||
if (token == null) {
|
||||
throw new BusinessException(BaseResponseCode.MQTT_TOKEN_GENERATE_FALL);
|
||||
}
|
||||
}
|
||||
return token;
|
||||
}
|
||||
|
||||
/**
|
||||
* 随机生成cmdId(mqtt的命令编码)
|
||||
*/
|
||||
public String getCmdId(){
|
||||
ArrayList<Character> letterList = new ArrayList<>();
|
||||
for (int i = 'a'; i <='z' ; i++) {
|
||||
letterList.add((char)i);
|
||||
}for (int i = 'A'; i <='Z' ; i++) {
|
||||
letterList.add((char)i);
|
||||
}
|
||||
char[] letter = new char[52];
|
||||
for (int i = 0; i < letterList.size(); i++) {
|
||||
letter[i] = letterList.get(i);
|
||||
}
|
||||
|
||||
ArrayList<Character> numList = new ArrayList<>();
|
||||
for (int i = '0'; i <= '9'; i++) {
|
||||
numList.add((char)i);
|
||||
}
|
||||
char[] num = new char[10];
|
||||
for (int i = 0; i < numList.size(); i++) {
|
||||
num[i] = numList.get(i);
|
||||
}
|
||||
String letterString = RandomStringUtils.random(5,letter);
|
||||
String numString = RandomStringUtils.random(5,num);
|
||||
return letterString+numString;
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
MqttUtil mqttUtil = new MqttUtil();
|
||||
String token = mqttUtil.getToken();
|
||||
log.info(token);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,44 @@
|
||||
package com.ho.common.tools.util;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @描述 分页结果
|
||||
* @创建人 fancl
|
||||
* @创建时间 2021/2/6
|
||||
* @修改人
|
||||
*/
|
||||
@Setter
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class PageResult<T> {
|
||||
|
||||
/**
|
||||
* 当前页码
|
||||
*/
|
||||
private int pageNum;
|
||||
/**
|
||||
* 每页数量
|
||||
*/
|
||||
private int pageSize;
|
||||
/**
|
||||
* 记录总数
|
||||
*/
|
||||
//private long totalSize;
|
||||
private long totalRows;
|
||||
/**
|
||||
* 页码总数
|
||||
*/
|
||||
private int totalPages;
|
||||
/**
|
||||
* 数据模型
|
||||
*/
|
||||
//private List<T> content;
|
||||
private List<T> list;
|
||||
}
|
||||
@ -0,0 +1,113 @@
|
||||
package com.ho.common.tools.util;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @描述 分页工具类
|
||||
* @创建人 fancl
|
||||
* @创建时间 2021/2/6
|
||||
* @修改人
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
public class PageUtils {
|
||||
|
||||
|
||||
/**
|
||||
* 循环截取某页列表进行分页
|
||||
*
|
||||
* @param dataList 分页数据
|
||||
* @param pageSize 页面大小
|
||||
* @param currentPage 当前页面
|
||||
*/
|
||||
public static List page(List dataList, int pageSize, int currentPage) {
|
||||
List currentPageList = new ArrayList<>();
|
||||
if (dataList != null && dataList.size() > 0) {
|
||||
int currIdx = (currentPage > 1 ? (currentPage - 1) * pageSize : 0);
|
||||
for (int i = 0; i < pageSize && i < dataList.size() - currIdx; i++) {
|
||||
Object data = dataList.get(currIdx + i);
|
||||
currentPageList.add(data);
|
||||
}
|
||||
}
|
||||
return currentPageList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 将分页信息封装到统一的接口
|
||||
*
|
||||
* @param pageInfo
|
||||
* @return
|
||||
*/
|
||||
public static PageResult getPageResult(PageInfo<?> pageInfo) {
|
||||
PageResult pageResult = new PageResult();
|
||||
pageResult.setPageNum(pageInfo.getPageNum());
|
||||
pageResult.setPageSize(pageInfo.getPageSize());
|
||||
pageResult.setTotalRows(pageInfo.getTotal());
|
||||
pageResult.setTotalPages(pageInfo.getPages());
|
||||
pageResult.setList(pageInfo.getList());
|
||||
return pageResult;
|
||||
}
|
||||
|
||||
//使用Java计算分页对象
|
||||
public static PageResult getPageResultByJava(List origList, Integer pageNum, Integer pageSize) {
|
||||
//空对象处理
|
||||
if (CollectionUtil.isEmpty(origList)) {
|
||||
return new PageResult(pageNum, pageSize, 0, 0, origList);
|
||||
}
|
||||
//计算总大小totalSize ,总页数totalPages
|
||||
int totalSize = origList.size();
|
||||
int totalPages = (totalSize + pageSize - 1) / pageSize;
|
||||
//根据pageNum, pageSize对list进行截取
|
||||
List list = dealList(origList, pageNum, pageSize);
|
||||
return new PageResult(pageNum, pageSize, totalSize, totalPages, list);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 对list进行截取
|
||||
*
|
||||
* @param list 传入的全量list
|
||||
* @param pageNum 页码
|
||||
* @param pageSize 每页多少条数据
|
||||
* @return
|
||||
*/
|
||||
public static List dealList(List list, Integer pageNum,
|
||||
Integer pageSize) {
|
||||
if (list == null) {
|
||||
return null;
|
||||
}
|
||||
if (list.size() == 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Integer count = list.size(); // 记录总数
|
||||
Integer pageCount = 0; // 页数
|
||||
if (count % pageSize == 0) {
|
||||
pageCount = count / pageSize;
|
||||
} else {
|
||||
pageCount = count / pageSize + 1;
|
||||
}
|
||||
|
||||
int fromIndex = 0; // 开始索引
|
||||
int toIndex = 0; // 结束索引
|
||||
|
||||
if (!pageNum.equals(pageCount)) {
|
||||
fromIndex = (pageNum - 1) * pageSize;
|
||||
toIndex = fromIndex + pageSize;
|
||||
} else {
|
||||
fromIndex = (pageNum - 1) * pageSize;
|
||||
toIndex = count;
|
||||
}
|
||||
|
||||
List pageList = list.subList(fromIndex, toIndex);
|
||||
|
||||
return pageList;
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,34 @@
|
||||
package com.ho.common.tools.util;
|
||||
|
||||
|
||||
import com.github.pagehelper.Page;
|
||||
import com.ho.common.tools.entity.PageVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName: PageUtils
|
||||
* 分页工具类
|
||||
* @Author:
|
||||
* @CreateDate: 2019/9/19 13:26
|
||||
* @UpdateUser:
|
||||
* @UpdateDate: 2019/9/19 13:26
|
||||
* @Version: 0.0.1
|
||||
*/
|
||||
public class PageUtilsOld {
|
||||
private PageUtilsOld() {}
|
||||
|
||||
public static <T> PageVO<T> getPageVO(List<T> list) {
|
||||
PageVO<T> result = new PageVO<>();
|
||||
if (list instanceof Page) {
|
||||
Page<T> page = (Page<T>) list;
|
||||
result.setTotalRows(page.getTotal());
|
||||
result.setTotalPages(page.getPages());
|
||||
result.setPageNum(page.getPageNum());
|
||||
result.setPageSize(page.getPageSize());
|
||||
result.setCurPageSize(page.size());
|
||||
result.setList(page.getResult());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,127 @@
|
||||
package com.ho.common.tools.util;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.Objects;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
/**
|
||||
* @author fancl
|
||||
* @desc: 代码行数统计
|
||||
* @date 2022/11/25
|
||||
*/
|
||||
@Slf4j
|
||||
public class ProjectCodeCountUtil {
|
||||
public static <T> Consumer<T> cof(UncheckedConsumer<T> mapper) {
|
||||
Objects.requireNonNull(mapper);
|
||||
return t -> {
|
||||
try {
|
||||
mapper.accept(t);
|
||||
} catch (Exception ex) {
|
||||
throw new RuntimeException(ex);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public static <T> Consumer<T> ncof(UncheckedConsumer<T> mapper) {
|
||||
Objects.requireNonNull(mapper);
|
||||
return t -> {
|
||||
try {
|
||||
mapper.accept(t);
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public static <T, R> Function<T, R> of(UncheckedFunction<T, R> mapper) {
|
||||
Objects.requireNonNull(mapper);
|
||||
return t -> {
|
||||
try {
|
||||
return mapper.apply(t);
|
||||
} catch (Exception ex) {
|
||||
throw new RuntimeException(ex);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public static <T, R> Function<T, R> eof(UncheckedFunction<T, R> mapper, Exception cex) {
|
||||
Objects.requireNonNull(mapper);
|
||||
return t -> {
|
||||
try {
|
||||
return mapper.apply(t);
|
||||
} catch (Exception ex) {
|
||||
if (cex != null && cex.getClass() == ex.getClass()) {
|
||||
throw new RuntimeException(cex);
|
||||
} else {
|
||||
throw new RuntimeException(ex);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public static <T, R> Function<T, R> of(UncheckedFunction<T, R> mapper, R defaultR) {
|
||||
Objects.requireNonNull(mapper);
|
||||
return t -> {
|
||||
try {
|
||||
return mapper.apply(t);
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace(System.err);
|
||||
return defaultR;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@FunctionalInterface
|
||||
public static interface UncheckedFunction<T, R> {
|
||||
R apply(T t) throws Exception;
|
||||
}
|
||||
|
||||
@FunctionalInterface
|
||||
public static interface UncheckedConsumer<T> {
|
||||
void accept(T t) throws Exception;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看项目文件夹下的代码行数
|
||||
*
|
||||
* @param args
|
||||
* @throws Exception
|
||||
*/
|
||||
public static void main(String[] args) throws Exception {
|
||||
|
||||
String path = "E:\\project\\hocloud";
|
||||
File f = new File(path);
|
||||
File[] files = f.listFiles();
|
||||
if (files == null || files.length < 1) {
|
||||
return;
|
||||
}
|
||||
int allCount = 0;
|
||||
for (File fi : files) {
|
||||
String[] split = fi.toString().split("/");
|
||||
if (fi.isDirectory() && !split[split.length - 1].startsWith(".")) {
|
||||
long count = Files.walk(Paths.get(fi.toString())) // 递归获得项目目录下的所有文件
|
||||
.filter(file -> !Files.isDirectory(file)) // 筛选出文件
|
||||
.filter(file -> file.toString().endsWith(".java")) // 筛选出 java 文件
|
||||
.flatMap(ProjectCodeCountUtil.of(file -> Files.lines(file), Stream.empty())) // 将会抛出受检异常的 Lambda 包装为 抛出非受检异常的 Lambda
|
||||
.filter(line -> !line.trim().isEmpty()) // 过滤掉空行
|
||||
.filter(line -> !line.trim().startsWith("//")) //过滤掉 //之类的注释
|
||||
.filter(line -> !(line.trim().startsWith("/*") && line.trim().endsWith("*/"))) //过滤掉/* */之类的注释
|
||||
.filter(line -> !(line.trim().startsWith("/*") && !line.trim().endsWith("*/"))) //过滤掉以 /* 开头的注释(去除空格后的开头)
|
||||
.filter(line -> !(!line.trim().startsWith("/*") && line.trim().endsWith("*/"))) //过滤掉已 */ 结尾的注释
|
||||
.filter(line -> !line.trim().startsWith("*")) //过滤掉 javadoc 中的文字注释
|
||||
.filter(line -> !line.trim().startsWith("@Override")) //过滤掉方法上含 @Override 的
|
||||
.count();
|
||||
System.out.println(split[split.length - 1] + " : " + count);
|
||||
allCount += count;
|
||||
}
|
||||
}
|
||||
log.info("总的代码行数:" + allCount);
|
||||
}
|
||||
|
||||
}
|
||||
154
common-tools/src/main/java/com/ho/common/tools/util/RSAUtil.java
Normal file
154
common-tools/src/main/java/com/ho/common/tools/util/RSAUtil.java
Normal file
@ -0,0 +1,154 @@
|
||||
package com.ho.common.tools.util;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.codec.binary.Base64;
|
||||
|
||||
import javax.crypto.Cipher;
|
||||
import java.security.*;
|
||||
import java.security.spec.PKCS8EncodedKeySpec;
|
||||
import java.security.spec.X509EncodedKeySpec;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author fancl
|
||||
* @desc:
|
||||
* @date 2022/11/14
|
||||
*/
|
||||
@Slf4j
|
||||
public class RSAUtil {
|
||||
|
||||
private static String KEY_RSA_TYPE = "RSA";
|
||||
private static String KEY_RSA_TYPE_ALL = "RSA/ECB/PKCS1Padding";
|
||||
private static int KEY_SIZE = 1024;//JDK方式RSA加密最大只有1024位
|
||||
private static int ENCODE_PART_SIZE = KEY_SIZE/8;
|
||||
public static final String PUBLIC_KEY_NAME = "public";
|
||||
public static final String PRIVATE_KEY_NAME = "private";
|
||||
|
||||
/**
|
||||
* 创建公钥秘钥
|
||||
* @return
|
||||
*/
|
||||
public static Map<String,String> createRSAKeys(){
|
||||
Map<String,String> keyPairMap = new HashMap<>();//里面存放公私秘钥的Base64位加密
|
||||
try {
|
||||
KeyPairGenerator keyPairGenerator = KeyPairGenerator.getInstance(KEY_RSA_TYPE);
|
||||
keyPairGenerator.initialize(KEY_SIZE,new SecureRandom());
|
||||
KeyPair keyPair = keyPairGenerator.generateKeyPair();
|
||||
|
||||
//获取公钥秘钥
|
||||
String publicKeyValue = Base64.encodeBase64String(keyPair.getPublic().getEncoded());
|
||||
String privateKeyValue = Base64.encodeBase64String(keyPair.getPrivate().getEncoded());
|
||||
|
||||
//存入公钥秘钥,以便以后获取
|
||||
keyPairMap.put(PUBLIC_KEY_NAME,publicKeyValue);
|
||||
keyPairMap.put(PRIVATE_KEY_NAME,privateKeyValue);
|
||||
} catch (NoSuchAlgorithmException e) {
|
||||
log.error("当前JDK版本没找到RSA加密算法!");
|
||||
e.printStackTrace();
|
||||
}
|
||||
return keyPairMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* 公钥加密
|
||||
* 描述:
|
||||
* 1字节 = 8位;
|
||||
* 最大加密长度如 1024位私钥时,最大加密长度为 128-11 = 117字节,不管多长数据,加密出来都是 128 字节长度。
|
||||
* @param sourceStr
|
||||
* @param publicKeyBase64Str
|
||||
* @return
|
||||
*/
|
||||
public static String encode(String sourceStr,String publicKeyBase64Str){
|
||||
byte [] publicBytes = Base64.decodeBase64(publicKeyBase64Str);
|
||||
//公钥加密
|
||||
X509EncodedKeySpec x509EncodedKeySpec = new X509EncodedKeySpec(publicBytes);
|
||||
List<byte[]> alreadyEncodeListData = new LinkedList<>();
|
||||
|
||||
int maxEncodeSize = ENCODE_PART_SIZE - 11;
|
||||
String encodeBase64Result = null;
|
||||
try {
|
||||
KeyFactory keyFactory = KeyFactory.getInstance(KEY_RSA_TYPE);
|
||||
PublicKey publicKey = keyFactory.generatePublic(x509EncodedKeySpec);
|
||||
Cipher cipher = Cipher.getInstance(KEY_RSA_TYPE_ALL);
|
||||
cipher.init(Cipher.ENCRYPT_MODE,publicKey);
|
||||
byte[] sourceBytes = sourceStr.getBytes("utf-8");
|
||||
int sourceLen = sourceBytes.length;
|
||||
for(int i=0;i<sourceLen;i+=maxEncodeSize){
|
||||
int curPosition = sourceLen - i;
|
||||
int tempLen = curPosition;
|
||||
if(curPosition > maxEncodeSize){
|
||||
tempLen = maxEncodeSize;
|
||||
}
|
||||
byte[] tempBytes = new byte[tempLen];//待加密分段数据
|
||||
System.arraycopy(sourceBytes,i,tempBytes,0,tempLen);
|
||||
byte[] tempAlreadyEncodeData = cipher.doFinal(tempBytes);
|
||||
alreadyEncodeListData.add(tempAlreadyEncodeData);
|
||||
}
|
||||
int partLen = alreadyEncodeListData.size();//加密次数
|
||||
|
||||
int allEncodeLen = partLen * ENCODE_PART_SIZE;
|
||||
byte[] encodeData = new byte[allEncodeLen];//存放所有RSA分段加密数据
|
||||
for (int i = 0; i < partLen; i++) {
|
||||
byte[] tempByteList = alreadyEncodeListData.get(i);
|
||||
System.arraycopy(tempByteList,0,encodeData,i*ENCODE_PART_SIZE,ENCODE_PART_SIZE);
|
||||
}
|
||||
encodeBase64Result = Base64.encodeBase64String(encodeData);
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage());
|
||||
}
|
||||
return encodeBase64Result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 私钥解密
|
||||
* @param sourceBase64RSA
|
||||
* @param privateKeyBase64Str
|
||||
*/
|
||||
public static String decode(String sourceBase64RSA,String privateKeyBase64Str){
|
||||
byte[] privateBytes = Base64.decodeBase64(privateKeyBase64Str);
|
||||
byte[] encodeSource = Base64.decodeBase64(sourceBase64RSA);
|
||||
int encodePartLen = encodeSource.length/ENCODE_PART_SIZE;
|
||||
List<byte[]> decodeListData = new LinkedList<>();//所有解密数据
|
||||
String decodeStrResult = null;
|
||||
//私钥解密
|
||||
PKCS8EncodedKeySpec pkcs8EncodedKeySpec = new PKCS8EncodedKeySpec(privateBytes);
|
||||
try {
|
||||
KeyFactory keyFactory = KeyFactory.getInstance(KEY_RSA_TYPE);
|
||||
PrivateKey privateKey = keyFactory.generatePrivate(pkcs8EncodedKeySpec);
|
||||
Cipher cipher = Cipher.getInstance(KEY_RSA_TYPE_ALL);
|
||||
cipher.init(Cipher.DECRYPT_MODE,privateKey);
|
||||
int allDecodeByteLen = 0;//初始化所有被解密数据长度
|
||||
for (int i = 0; i < encodePartLen; i++) {
|
||||
byte[] tempEncodedData = new byte[ENCODE_PART_SIZE];
|
||||
System.arraycopy(encodeSource,i*ENCODE_PART_SIZE,tempEncodedData,0,ENCODE_PART_SIZE);
|
||||
byte[] decodePartData = cipher.doFinal(tempEncodedData);
|
||||
decodeListData.add(decodePartData);
|
||||
allDecodeByteLen += decodePartData.length;
|
||||
}
|
||||
byte [] decodeResultBytes = new byte[allDecodeByteLen];
|
||||
for (int i = 0,curPosition = 0; i < encodePartLen; i++) {
|
||||
byte[] tempSorceBytes = decodeListData.get(i);
|
||||
int tempSourceBytesLen = tempSorceBytes.length;
|
||||
System.arraycopy(tempSorceBytes,0,decodeResultBytes,curPosition,tempSourceBytesLen);
|
||||
curPosition += tempSourceBytesLen;
|
||||
}
|
||||
decodeStrResult = new String(decodeResultBytes,"UTF-8");
|
||||
}catch (Exception e){
|
||||
log.error(e.getMessage());
|
||||
}
|
||||
return decodeStrResult;
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
Map<String, String> rsaKeys = createRSAKeys();
|
||||
String publicKey = rsaKeys.get(RSAUtil.PUBLIC_KEY_NAME);
|
||||
System.out.println("publicKey:"+ publicKey);
|
||||
String privateKey = rsaKeys.get(RSAUtil.PRIVATE_KEY_NAME);
|
||||
System.out.println("privateKey:"+ privateKey);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -0,0 +1,125 @@
|
||||
package com.ho.common.tools.util;
|
||||
|
||||
import javax.crypto.Cipher;
|
||||
import java.io.DataInputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.security.*;
|
||||
import java.security.interfaces.RSAPrivateKey;
|
||||
import java.security.interfaces.RSAPublicKey;
|
||||
import java.security.spec.PKCS8EncodedKeySpec;
|
||||
import java.security.spec.X509EncodedKeySpec;
|
||||
import java.util.Base64;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author fancl
|
||||
* @desc:
|
||||
* @date 2022/11/14
|
||||
*/
|
||||
|
||||
public class RSAUtil_Old {
|
||||
|
||||
private final static String PUBLIC_KEY_PATH = "d:/publicKeyFile";
|
||||
private final static String PRIVATE_KEY_PATH = "d:/privateKeyFile";
|
||||
|
||||
/**
|
||||
*生成私钥 公钥
|
||||
*/
|
||||
private static void generation(){
|
||||
KeyPairGenerator keyPairGenerator;
|
||||
try {
|
||||
keyPairGenerator = KeyPairGenerator.getInstance("RSA");
|
||||
SecureRandom secureRandom = new SecureRandom(new Date().toString().getBytes());
|
||||
keyPairGenerator.initialize(1024, secureRandom);
|
||||
KeyPair keyPair = keyPairGenerator.genKeyPair();
|
||||
byte[] publicKeyBytes = keyPair.getPublic().getEncoded();
|
||||
File pubFile = new File(PUBLIC_KEY_PATH);
|
||||
if(!pubFile.exists()){
|
||||
pubFile.createNewFile();
|
||||
}
|
||||
FileOutputStream fos = new FileOutputStream(pubFile);
|
||||
fos.write(publicKeyBytes);
|
||||
fos.close();
|
||||
byte[] privateKeyBytes = keyPair.getPrivate().getEncoded();
|
||||
File priFile = new File(PRIVATE_KEY_PATH);
|
||||
if(!priFile.exists()){
|
||||
priFile.createNewFile();
|
||||
}
|
||||
fos = new FileOutputStream(priFile);
|
||||
fos.write(privateKeyBytes);
|
||||
fos.close();
|
||||
} catch (Exception e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取公钥
|
||||
* @param filename
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public static PublicKey getPublicKey(String filename) throws Exception {
|
||||
File f = new File(filename);
|
||||
FileInputStream fis = new FileInputStream(f);
|
||||
DataInputStream dis = new DataInputStream(fis);
|
||||
byte[] keyBytes = new byte[(int)f.length()];
|
||||
dis.readFully(keyBytes);
|
||||
dis.close();
|
||||
X509EncodedKeySpec spec = new X509EncodedKeySpec(keyBytes);
|
||||
KeyFactory kf = KeyFactory.getInstance("RSA");
|
||||
return kf.generatePublic(spec);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 获取私钥
|
||||
* @param filename
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public static PrivateKey getPrivateKey(String filename)throws Exception {
|
||||
File f = new File(filename);
|
||||
FileInputStream fis = new FileInputStream(f);
|
||||
DataInputStream dis = new DataInputStream(fis);
|
||||
byte[] keyBytes = new byte[(int)f.length()];
|
||||
dis.readFully(keyBytes);
|
||||
dis.close();
|
||||
PKCS8EncodedKeySpec spec =new PKCS8EncodedKeySpec(keyBytes);
|
||||
KeyFactory kf = KeyFactory.getInstance("RSA");
|
||||
return kf.generatePrivate(spec);
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
generation();
|
||||
|
||||
String input = "!!!hello world!!!";
|
||||
RSAPublicKey pubKey;
|
||||
RSAPrivateKey privKey;
|
||||
byte[] cipherText;
|
||||
Cipher cipher;
|
||||
try {
|
||||
cipher = Cipher.getInstance("RSA");
|
||||
pubKey = (RSAPublicKey) getPublicKey(PUBLIC_KEY_PATH);
|
||||
privKey = (RSAPrivateKey) getPrivateKey(PRIVATE_KEY_PATH);
|
||||
|
||||
cipher.init(Cipher.ENCRYPT_MODE, pubKey);
|
||||
cipherText = cipher.doFinal(input.getBytes());
|
||||
//加密后的东西
|
||||
System.out.println("cipher: " + new String(cipherText));
|
||||
//开始解密
|
||||
cipher.init(Cipher.DECRYPT_MODE, privKey);
|
||||
byte[] plainText = cipher.doFinal(cipherText);
|
||||
System.out.println("publickey: " + Base64.getEncoder().encode(cipherText));
|
||||
System.out.println("plain : " + new String(plainText));
|
||||
} catch (Exception e1) {
|
||||
// TODO Auto-generated catch block
|
||||
e1.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,46 @@
|
||||
package com.ho.common.tools.util;
|
||||
|
||||
import com.ho.common.tools.constant.CommonConstant;
|
||||
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
|
||||
/**
|
||||
* @Description 随机数获取工具类
|
||||
* @Author xwz
|
||||
* @Date 2024/11/29
|
||||
*/
|
||||
public class RandomUtil {
|
||||
|
||||
/**
|
||||
* 获取30-60之间的一个整行随机数
|
||||
* @return
|
||||
*/
|
||||
public static int getRandomInt() {
|
||||
int min = CommonConstant.THIRTY;
|
||||
int max = CommonConstant.SIXTY;
|
||||
int randomNumber = ThreadLocalRandom.current().nextInt(max - min + 1) + min;
|
||||
return randomNumber;
|
||||
}
|
||||
|
||||
public static int getRandomIntHuge() {
|
||||
int min = CommonConstant.TWO_HUNDRED;
|
||||
int max = CommonConstant.FIVE_HUNDRED;
|
||||
int randomNumber = ThreadLocalRandom.current().nextInt(max - min + 1) + min;
|
||||
return randomNumber;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取2-3之间的一个整行随机数
|
||||
* @return
|
||||
*/
|
||||
public static int getRandomIntMinute() {
|
||||
int min = CommonConstant.TWO;
|
||||
int max = CommonConstant.THREE;
|
||||
int randomNumber = ThreadLocalRandom.current().nextInt(max - min + 1) + min;
|
||||
return randomNumber;
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
System.out.println(getRandomIntMinute());
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,620 @@
|
||||
package com.ho.common.tools.util;
|
||||
|
||||
import com.ho.common.tools.constant.RedisKeyConstant;
|
||||
import com.ho.common.tools.entity.SimpleUser;
|
||||
import com.ho.common.tools.entity.UserDetailRespVO;
|
||||
import com.ho.common.tools.exception.BaseResponseCode;
|
||||
import com.ho.common.tools.exception.BusinessException;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* redis 工具类
|
||||
*/
|
||||
@Component
|
||||
public class RedisCommon {
|
||||
|
||||
@Autowired
|
||||
private RedisTemplate<String, Object> redisTemplate;
|
||||
|
||||
|
||||
/**
|
||||
* 指定缓存失效时间
|
||||
*
|
||||
* @param key 键
|
||||
* @param time 时间(秒)
|
||||
* @return
|
||||
*/
|
||||
public boolean expire(String key, long time) {
|
||||
try {
|
||||
if (time > 0) {
|
||||
redisTemplate.expire(key, time, TimeUnit.SECONDS);
|
||||
}
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据key 获取过期时间
|
||||
*
|
||||
* @param key 键 不能为null
|
||||
* @return 时间(秒) 返回-1代表为永久有效;返回-2代表key也不存在
|
||||
*/
|
||||
public long getExpire(String key) {
|
||||
return redisTemplate.getExpire(key, TimeUnit.SECONDS);
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断key是否存在
|
||||
*
|
||||
* @param key 键
|
||||
* @return true 存在 false不存在
|
||||
*/
|
||||
public boolean hasKey(String key) {
|
||||
try {
|
||||
return redisTemplate.hasKey(key);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除缓存
|
||||
*
|
||||
* @param key 可以传一个值 或多个
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public void del(String... key) {
|
||||
if (key != null && key.length > 0) {
|
||||
if (key.length == 1) {
|
||||
redisTemplate.delete(key[0]);
|
||||
} else {
|
||||
redisTemplate.delete(CollectionUtils.arrayToList(key));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ============================String=============================
|
||||
|
||||
/**
|
||||
* 普通缓存获取
|
||||
*
|
||||
* @param key 键
|
||||
* @return 值
|
||||
*/
|
||||
public Object get(String key) {
|
||||
return key == null ? null : redisTemplate.opsForValue().get(key);
|
||||
}
|
||||
|
||||
//String类型的数据 ,延长有效期,默认2小时
|
||||
public void extendKeyTime(String key, Long time) {
|
||||
if (time == null || time <= 0) {
|
||||
time = 2L;
|
||||
}
|
||||
//重新设置过期时间,相当于延长
|
||||
if (redisTemplate.hasKey(key)) {
|
||||
redisTemplate.expire(key, time, TimeUnit.HOURS);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 普通缓存放入
|
||||
*
|
||||
* @param key 键
|
||||
* @param value 值
|
||||
* @return true成功 false失败
|
||||
*/
|
||||
public boolean set(String key, Object value) {
|
||||
try {
|
||||
redisTemplate.opsForValue().set(key, value);
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 普通缓存放入并设置时间
|
||||
*
|
||||
* @param key 键
|
||||
* @param value 值
|
||||
* @param time 时间(秒) time要大于0 如果time小于等于0 将设置无限期
|
||||
* @return true成功 false 失败
|
||||
*/
|
||||
public boolean set(String key, Object value, long time) {
|
||||
try {
|
||||
if (time > 0) {
|
||||
redisTemplate.opsForValue().set(key, value, time, TimeUnit.SECONDS);
|
||||
} else {
|
||||
set(key, value);
|
||||
}
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
//延长用户缓存信息对
|
||||
public void extendUserCachePair(String token, Long time) {
|
||||
//默认2小时
|
||||
if (time == null || time <= 0) {
|
||||
time = 7200L;
|
||||
}
|
||||
String userTokenKey = RedisKeyConstant.User.TOKEN + token;
|
||||
UserDetailRespVO userDetail = (UserDetailRespVO) get(userTokenKey);
|
||||
//取得userName那个键值对
|
||||
String userNameKey = RedisKeyConstant.User.USER_NAME + userDetail.getLoginChannel() + ":" + userDetail.getUsername();
|
||||
//延长时间
|
||||
extendKeyTime(userNameKey, null);
|
||||
extendKeyTime(userTokenKey, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param token
|
||||
*/
|
||||
public SimpleUser findSimpleUserByToken(String token) {
|
||||
String userTokenKey = RedisKeyConstant.User.TOKEN + token;
|
||||
UserDetailRespVO userDetail = (UserDetailRespVO) get(userTokenKey);
|
||||
//没找到报错
|
||||
if (userDetail == null) {
|
||||
throw new BusinessException(BaseResponseCode.TOKEN_PARSE_ERROR);
|
||||
}
|
||||
String userName = userDetail.getUsername();
|
||||
SimpleUser simpleUser = (SimpleUser) get(RedisKeyConstant.User.USER_NAME +userDetail.getLoginChannel() + ":"+ userName);
|
||||
return simpleUser;
|
||||
}
|
||||
|
||||
/**
|
||||
* 递增
|
||||
*
|
||||
* @param key 键
|
||||
* @param delta 要增加几(大于0)
|
||||
* @return
|
||||
*/
|
||||
public long incr(String key, long delta) {
|
||||
if (delta < 0) {
|
||||
throw new RuntimeException("递增因子必须大于0");
|
||||
}
|
||||
return redisTemplate.opsForValue().increment(key, delta);
|
||||
}
|
||||
|
||||
/**
|
||||
* 递减
|
||||
*
|
||||
* @param key 键
|
||||
* @param delta 要减少几(小于0)
|
||||
* @return
|
||||
*/
|
||||
public long decr(String key, long delta) {
|
||||
if (delta < 0) {
|
||||
throw new RuntimeException("递减因子必须大于0");
|
||||
}
|
||||
return redisTemplate.opsForValue().increment(key, -delta);
|
||||
}
|
||||
|
||||
// ================================Map=================================
|
||||
|
||||
/**
|
||||
* HashGet
|
||||
*
|
||||
* @param key 键 不能为null
|
||||
* @param item 项 不能为null
|
||||
* @return 值
|
||||
*/
|
||||
public Object hget(String key, String item) {
|
||||
return redisTemplate.opsForHash().get(key, item);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取hashKey对应的所有键值
|
||||
*
|
||||
* @param key 键
|
||||
* @return 对应的多个键值
|
||||
*/
|
||||
public Map<Object, Object> hmget(String key) {
|
||||
return redisTemplate.opsForHash().entries(key);
|
||||
}
|
||||
|
||||
/**
|
||||
* HashSet
|
||||
*
|
||||
* @param key 键
|
||||
* @param map 对应多个键值
|
||||
* @return true 成功 false 失败
|
||||
*/
|
||||
public boolean hmset(String key, Map<String, Object> map) {
|
||||
try {
|
||||
redisTemplate.opsForHash().putAll(key, map);
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* HashSet 并设置时间
|
||||
*
|
||||
* @param key 键
|
||||
* @param map 对应多个键值
|
||||
* @param time 时间(秒)
|
||||
* @return true成功 false失败
|
||||
*/
|
||||
public boolean hmset(String key, Map<String, Object> map, long time) {
|
||||
try {
|
||||
redisTemplate.opsForHash().putAll(key, map);
|
||||
if (time > 0) {
|
||||
expire(key, time);
|
||||
}
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 向一张hash表中放入数据,如果不存在将创建
|
||||
*
|
||||
* @param key 键
|
||||
* @param item 项
|
||||
* @param value 值
|
||||
* @return true 成功 false失败
|
||||
*/
|
||||
public boolean hset(String key, String item, Object value) {
|
||||
try {
|
||||
redisTemplate.opsForHash().put(key, item, value);
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 向一张hash表中放入数据,如果不存在将创建
|
||||
*
|
||||
* @param key 键
|
||||
* @param item 项
|
||||
* @param value 值
|
||||
* @param time 时间(秒) 注意:如果已存在的hash表有时间,这里将会替换原有的时间
|
||||
* @return true 成功 false失败
|
||||
*/
|
||||
public boolean hset(String key, String item, Object value, long time) {
|
||||
try {
|
||||
redisTemplate.opsForHash().put(key, item, value);
|
||||
if (time > 0) {
|
||||
expire(key, time);
|
||||
}
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除hash表中的值
|
||||
*
|
||||
* @param key 键 不能为null
|
||||
* @param item 项 可以使多个 不能为null
|
||||
*/
|
||||
public void hdel(String key, Object... item) {
|
||||
redisTemplate.opsForHash().delete(key, item);
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断hash表中是否有该项的值
|
||||
*
|
||||
* @param key 键 不能为null
|
||||
* @param item 项 不能为null
|
||||
* @return true 存在 false不存在
|
||||
*/
|
||||
public boolean hHasKey(String key, String item) {
|
||||
return redisTemplate.opsForHash().hasKey(key, item);
|
||||
}
|
||||
|
||||
/**
|
||||
* hash递增 如果不存在,就会创建一个 并把新增后的值返回
|
||||
*
|
||||
* @param key 键
|
||||
* @param item 项
|
||||
* @param by 要增加几(大于0)
|
||||
* @return
|
||||
*/
|
||||
public double hincr(String key, String item, double by) {
|
||||
return redisTemplate.opsForHash().increment(key, item, by);
|
||||
}
|
||||
|
||||
/**
|
||||
* hash递减
|
||||
*
|
||||
* @param key 键
|
||||
* @param item 项
|
||||
* @param by 要减少记(小于0)
|
||||
* @return
|
||||
*/
|
||||
public double hdecr(String key, String item, double by) {
|
||||
return redisTemplate.opsForHash().increment(key, item, -by);
|
||||
}
|
||||
|
||||
// ============================set=============================
|
||||
|
||||
/**
|
||||
* 根据key获取Set中的所有值
|
||||
*
|
||||
* @param key 键
|
||||
* @return
|
||||
*/
|
||||
public Set<Object> sGet(String key) {
|
||||
try {
|
||||
return redisTemplate.opsForSet().members(key);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据value从一个set中查询,是否存在
|
||||
*
|
||||
* @param key 键
|
||||
* @param value 值
|
||||
* @return true 存在 false不存在
|
||||
*/
|
||||
public boolean sHasKey(String key, Object value) {
|
||||
try {
|
||||
return redisTemplate.opsForSet().isMember(key, value);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 将数据放入set缓存
|
||||
*
|
||||
* @param key 键
|
||||
* @param values 值 可以是多个
|
||||
* @return 成功个数
|
||||
*/
|
||||
public long sSet(String key, Object... values) {
|
||||
try {
|
||||
return redisTemplate.opsForSet().add(key, values);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 将set数据放入缓存
|
||||
*
|
||||
* @param key 键
|
||||
* @param time 时间(秒)
|
||||
* @param values 值 可以是多个
|
||||
* @return 成功个数
|
||||
*/
|
||||
public long sSetAndTime(String key, long time, Object... values) {
|
||||
try {
|
||||
Long count = redisTemplate.opsForSet().add(key, values);
|
||||
if (time > 0) {
|
||||
expire(key, time);
|
||||
}
|
||||
return count;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取set缓存的长度
|
||||
*
|
||||
* @param key 键
|
||||
* @return
|
||||
*/
|
||||
public long sGetSetSize(String key) {
|
||||
try {
|
||||
return redisTemplate.opsForSet().size(key);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 移除值为value的
|
||||
*
|
||||
* @param key 键
|
||||
* @param values 值 可以是多个
|
||||
* @return 移除的个数
|
||||
*/
|
||||
public long setRemove(String key, Object... values) {
|
||||
try {
|
||||
Long count = redisTemplate.opsForSet().remove(key, values);
|
||||
return count;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
// ===============================list=================================
|
||||
|
||||
/**
|
||||
* 获取list缓存的内容
|
||||
*
|
||||
* @param key 键
|
||||
* @param start 开始
|
||||
* @param end 结束 0 到 -1代表所有值
|
||||
* @return
|
||||
*/
|
||||
public List<Object> lGet(String key, long start, long end) {
|
||||
try {
|
||||
return redisTemplate.opsForList().range(key, start, end);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取list缓存的长度
|
||||
*
|
||||
* @param key 键
|
||||
* @return
|
||||
*/
|
||||
public long lGetListSize(String key) {
|
||||
try {
|
||||
return redisTemplate.opsForList().size(key);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过索引 获取list中的值
|
||||
*
|
||||
* @param key 键
|
||||
* @param index 索引 index>=0时, 0 表头,1 第二个元素,依次类推;index<0时,-1,表尾,-2倒数第二个元素,依次类推
|
||||
* @return
|
||||
*/
|
||||
public Object lGetIndex(String key, long index) {
|
||||
try {
|
||||
return redisTemplate.opsForList().index(key, index);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 将list放入缓存
|
||||
*
|
||||
* @param key 键
|
||||
* @param value 值
|
||||
* @return
|
||||
*/
|
||||
public boolean lSet(String key, Object value) {
|
||||
try {
|
||||
redisTemplate.opsForList().rightPush(key, value);
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 将list放入缓存
|
||||
*
|
||||
* @param key 键
|
||||
* @param value 值
|
||||
* @param time 时间(秒)
|
||||
* @return
|
||||
*/
|
||||
public boolean lSet(String key, Object value, long time) {
|
||||
try {
|
||||
redisTemplate.opsForList().rightPush(key, value);
|
||||
if (time > 0) {
|
||||
expire(key, time);
|
||||
}
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 将list放入缓存
|
||||
*
|
||||
* @param key 键
|
||||
* @param value 值
|
||||
* @return
|
||||
*/
|
||||
public boolean lSet(String key, List<Object> value) {
|
||||
try {
|
||||
redisTemplate.opsForList().rightPushAll(key, value);
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 将list放入缓存
|
||||
*
|
||||
* @param key 键
|
||||
* @param value 值
|
||||
* @param time 时间(秒)
|
||||
* @return
|
||||
*/
|
||||
public boolean lSet(String key, List<Object> value, long time) {
|
||||
try {
|
||||
redisTemplate.opsForList().rightPushAll(key, value);
|
||||
if (time > 0) {
|
||||
expire(key, time);
|
||||
}
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据索引修改list中的某条数据
|
||||
*
|
||||
* @param key 键
|
||||
* @param index 索引
|
||||
* @param value 值
|
||||
* @return
|
||||
*/
|
||||
public boolean lUpdateIndex(String key, long index, Object value) {
|
||||
try {
|
||||
redisTemplate.opsForList().set(key, index, value);
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 移除N个值为value
|
||||
*
|
||||
* @param key 键
|
||||
* @param count 移除多少个
|
||||
* @param value 值
|
||||
* @return 移除的个数
|
||||
*/
|
||||
public long lRemove(String key, long count, Object value) {
|
||||
try {
|
||||
Long remove = redisTemplate.opsForList().remove(key, count, value);
|
||||
return remove;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,113 @@
|
||||
package com.ho.common.tools.util;
|
||||
|
||||
import com.alibaba.excel.write.handler.SheetWriteHandler;
|
||||
import com.alibaba.excel.write.metadata.holder.WriteSheetHolder;
|
||||
import com.alibaba.excel.write.metadata.holder.WriteWorkbookHolder;
|
||||
import org.apache.poi.hssf.usermodel.HSSFDataValidation;
|
||||
import org.apache.poi.ss.usermodel.*;
|
||||
import org.apache.poi.ss.util.CellRangeAddressList;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class SelectSheetWriteHandler implements SheetWriteHandler {
|
||||
private Map<Integer, List<String>> selectMap;
|
||||
|
||||
private int index;
|
||||
|
||||
private char[] alphabet = new char[]{'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L',
|
||||
'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'};
|
||||
|
||||
public SelectSheetWriteHandler(Map<Integer, List<String>> selectMap) {
|
||||
this.selectMap = selectMap;
|
||||
this.index = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void beforeSheetCreate(WriteWorkbookHolder writeWorkbookHolder, WriteSheetHolder writeSheetHolder) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterSheetCreate(WriteWorkbookHolder writeWorkbookHolder, WriteSheetHolder writeSheetHolder) {
|
||||
if (selectMap == null || selectMap.size() == 0) {
|
||||
return;
|
||||
}
|
||||
// 需要设置下拉框的sheet页
|
||||
Sheet curSheet = writeSheetHolder.getSheet();
|
||||
DataValidationHelper helper = curSheet.getDataValidationHelper();
|
||||
String dictSheetName = "字典sheet";
|
||||
|
||||
Workbook workbook = writeWorkbookHolder.getWorkbook();
|
||||
|
||||
// 数据字典的sheet页
|
||||
Sheet dictSheet = workbook.createSheet(dictSheetName);
|
||||
// 从第二个工作簿开始隐藏,为了用户的友好性,将字典sheet隐藏掉
|
||||
this.index++;
|
||||
// 设置隐藏
|
||||
workbook.setSheetHidden(this.index, true);
|
||||
for (Map.Entry<Integer, List<String>> entry : selectMap.entrySet()) {
|
||||
// 设置下拉单元格的首行、末行、首列、末列
|
||||
CellRangeAddressList rangeAddressList = new CellRangeAddressList(1, 65533, entry.getKey(), entry.getKey());
|
||||
int rowLen = entry.getValue().size();
|
||||
// 设置字典sheet页的值 每一列一个字典项
|
||||
for (int i = 0; i < rowLen; i++) {
|
||||
Row row = dictSheet.getRow(i);
|
||||
if (row == null) {
|
||||
row = dictSheet.createRow(i);
|
||||
}
|
||||
row.createCell(entry.getKey()).setCellValue(entry.getValue().get(i));
|
||||
}
|
||||
String excelColumn = getExcelColumn(entry.getKey());
|
||||
// 下拉框数据来源 eg:字典sheet!$B1:$B2
|
||||
String refers = dictSheetName + "!$" + excelColumn + "$1:$" + excelColumn + "$" + rowLen;
|
||||
// 创建可被其他单元格引用的名称
|
||||
Name name = workbook.createName();
|
||||
// 设置名称的名字
|
||||
name.setNameName("dict" + entry.getKey());
|
||||
// 设置公式
|
||||
name.setRefersToFormula(refers);
|
||||
// 设置引用约束
|
||||
DataValidationConstraint constraint = helper.createFormulaListConstraint("dict" + entry.getKey());
|
||||
// 设置约束
|
||||
DataValidation validation = helper.createValidation(constraint, rangeAddressList);
|
||||
if (validation instanceof HSSFDataValidation) {
|
||||
validation.setSuppressDropDownArrow(false);
|
||||
} else {
|
||||
validation.setSuppressDropDownArrow(true);
|
||||
validation.setShowErrorBox(true);
|
||||
}
|
||||
// 阻止输入非下拉框的值
|
||||
validation.setErrorStyle(DataValidation.ErrorStyle.STOP);
|
||||
validation.createErrorBox("提示", "此值与单元格定义格式不一致!");
|
||||
// 添加下拉框约束
|
||||
writeSheetHolder.getSheet().addValidationData(validation);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 将数字列转化成为字母列
|
||||
*
|
||||
* @param num
|
||||
* @return
|
||||
*/
|
||||
private String getExcelColumn(int num) {
|
||||
String column = "";
|
||||
int len = alphabet.length - 1;
|
||||
int first = num / len;
|
||||
int second = num % len;
|
||||
if (num <= len) {
|
||||
column = alphabet[num] + "";
|
||||
} else {
|
||||
column = alphabet[first - 1] + "";
|
||||
if (second == 0) {
|
||||
column = column + alphabet[len] + "";
|
||||
} else {
|
||||
column = column + alphabet[second - 1] + "";
|
||||
}
|
||||
}
|
||||
return column;
|
||||
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,39 @@
|
||||
package com.ho.common.tools.util;
|
||||
|
||||
import com.alibaba.excel.metadata.Head;
|
||||
import com.alibaba.excel.write.handler.CellWriteHandler;
|
||||
import com.alibaba.excel.write.metadata.holder.WriteSheetHolder;
|
||||
import com.alibaba.excel.write.metadata.holder.WriteTableHolder;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.poi.ss.usermodel.Row;
|
||||
import org.springframework.util.PropertyPlaceholderHelper;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
|
||||
/**
|
||||
* 动态替换表头
|
||||
*/
|
||||
public class TitleCellWriteHandler implements CellWriteHandler {
|
||||
|
||||
private final Map<String, String> titleMap;
|
||||
private final PropertyPlaceholderHelper propertyplaceholderHelper = new PropertyPlaceholderHelper("${","}");
|
||||
|
||||
public TitleCellWriteHandler(Map<String, String> titleMap){
|
||||
this.titleMap = titleMap;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void beforeCellCreate(WriteSheetHolder writesheetHolder, WriteTableHolder writeTableHolder,Row row, Head head, Integer integer, Integer integer1, Boolean aBoolean){
|
||||
if(head != null){
|
||||
List<String> titleNameList =head.getHeadNameList();
|
||||
if(CollectionUtils.isNotEmpty(titleNameList)){titleMap.forEach((k,v)-> {
|
||||
Properties properties = new Properties();
|
||||
properties.setProperty(k, v);
|
||||
titleNameList.replaceAll(value -> propertyplaceholderHelper.replacePlaceholders(value, properties));
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,31 @@
|
||||
package com.ho.common.tools.util;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.ho.common.tools.constant.CommonConstant;
|
||||
import com.ho.common.tools.constant.RedisKeyConstant;
|
||||
import com.ho.common.tools.service.RedisService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@Component
|
||||
@Slf4j
|
||||
public class UpdateHeartbeatUtils {
|
||||
|
||||
@Autowired
|
||||
RedisService redisService;
|
||||
|
||||
/**
|
||||
* 更新心跳
|
||||
* @param sn
|
||||
*/
|
||||
public void updateHeartbeat(String sn){
|
||||
Date updateTime = new Date();
|
||||
//检测到有心跳
|
||||
JSONObject heartbeat = new JSONObject();
|
||||
heartbeat.put(CommonConstant.UPDATE_TIME, updateTime);
|
||||
redisService.hmset(RedisKeyConstant.HEARTBEAT + sn, heartbeat);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,40 @@
|
||||
package com.ho.common.tools.util;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
/**
|
||||
* @Description 更新对象属性值
|
||||
* Author yule
|
||||
* Date 2023/1/6 10:00
|
||||
*/
|
||||
@Component
|
||||
public class UpdateObjectUtil {
|
||||
|
||||
/**
|
||||
* 把新对象的属性更新到老对象中(两个对象都属于同一个类)
|
||||
* @param oldObject
|
||||
* @param newObject
|
||||
* @return
|
||||
*/
|
||||
public Object updateObjectAttribute(Object oldObject,Object newObject) {
|
||||
//获取该对象的属性字段
|
||||
Field[] fields = newObject.getClass().getDeclaredFields();
|
||||
//循环判断属性字段是否为空
|
||||
for (Field field : fields) {
|
||||
field.setAccessible(true);
|
||||
try {
|
||||
Object o = field.get(newObject);
|
||||
if (o != null) {
|
||||
//将不为空的属性赋值到老对象中
|
||||
field.set(oldObject, o);
|
||||
}
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
return oldObject;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,87 @@
|
||||
package com.ho.common.tools.util;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.ho.common.tools.entity.MyAddress;
|
||||
import com.ho.common.tools.entity.WeatherRespVo;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.math.BigDecimal;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
|
||||
/**
|
||||
* 天气工具类--高德地图
|
||||
*/
|
||||
@Slf4j
|
||||
public class WeatherUntils {
|
||||
|
||||
static String secretKey = "d9b7b41dc870889b566118003fe426f7";
|
||||
|
||||
/**
|
||||
* 获取天气
|
||||
* @param cityCode
|
||||
* @param extensions 可选值:base/all base:返回实况天气 all:返回预报天气
|
||||
* @return
|
||||
* @throws IOException
|
||||
*/
|
||||
public static JSONObject getWeatherInfo(String cityCode,String extensions) throws IOException {
|
||||
String urlString = "https://restapi.amap.com/v3/weather/weatherInfo?city="+cityCode+"&key="+secretKey+"&extensions="+extensions;
|
||||
System.out.println("请求经纬度url:" + urlString);
|
||||
URL url = new URL(urlString);
|
||||
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
|
||||
conn.setDoInput(true);
|
||||
conn.setRequestMethod("GET");
|
||||
BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream(), "utf-8"));
|
||||
String line;
|
||||
String res = "";
|
||||
while ((line = in.readLine()) != null) {
|
||||
res += line + "\n";
|
||||
}
|
||||
in.close();
|
||||
JSONObject jsonObject = JSONObject.parseObject(res);
|
||||
return jsonObject;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据adCode获取预测天气
|
||||
* @param adCode
|
||||
* @return
|
||||
*/
|
||||
public static WeatherRespVo getWeatherRespVo(String adCode){
|
||||
WeatherRespVo weatherRespVo = null;
|
||||
try {
|
||||
JSONObject result = getWeatherInfo(adCode,"all");
|
||||
JSONArray forecasts = (JSONArray)result.get("forecasts");
|
||||
if(null != forecasts && forecasts.size()>0){
|
||||
JSONObject forecast = (JSONObject)forecasts.get(0);
|
||||
JSONArray casts = (JSONArray)forecast.get("casts");
|
||||
String city = String.valueOf(forecast.get("city"));
|
||||
if (null != casts && casts.size()>0){
|
||||
JSONObject cast = (JSONObject)casts.get(0);
|
||||
weatherRespVo = new WeatherRespVo();
|
||||
weatherRespVo.setCityzh(city);
|
||||
weatherRespVo.setMaxTemperature(new BigDecimal(String.valueOf(cast.get("daytemp"))));
|
||||
weatherRespVo.setMinTemperature(new BigDecimal(String.valueOf(cast.get("nighttemp"))));
|
||||
weatherRespVo.setSkyCon(String.valueOf(cast.get("dayweather")));
|
||||
weatherRespVo.setSpeedAndDirection(String.valueOf(cast.get("daywind"))+String.valueOf(cast.get("daypower"))+"级");
|
||||
weatherRespVo.setUpdateTime(System.currentTimeMillis());
|
||||
}
|
||||
}
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
log.error("getAddress error:{}",e.getMessage());
|
||||
}
|
||||
return weatherRespVo;
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws IOException {
|
||||
WeatherRespVo weatherRespVo = getWeatherRespVo("320106");
|
||||
System.out.println(weatherRespVo);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
101
common-tools/src/main/java/com/ho/common/tools/util/ZipUtil.java
Normal file
101
common-tools/src/main/java/com/ho/common/tools/util/ZipUtil.java
Normal file
@ -0,0 +1,101 @@
|
||||
package com.ho.common.tools.util;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.zip.GZIPInputStream;
|
||||
import java.util.zip.GZIPOutputStream;
|
||||
|
||||
/**
|
||||
* @Description TODO
|
||||
* Author yule
|
||||
* Date 2022/11/17 14:55
|
||||
*/
|
||||
@Component
|
||||
public class ZipUtil {
|
||||
|
||||
//private static String encode = "utf-8";//"ISO-8859-1"
|
||||
|
||||
private String encode = "utf-8";//"ISO-8859-1"
|
||||
|
||||
public String getEncode() {
|
||||
return encode;
|
||||
}
|
||||
|
||||
/**
|
||||
* 字符串的压缩
|
||||
*
|
||||
* @param str
|
||||
* 待压缩的字符串
|
||||
* @return 返回压缩后的字符串
|
||||
* @throws IOException
|
||||
*/
|
||||
public static byte[] compress(String str,String charset) throws IOException {
|
||||
if (null == str || str.length() <= 0) {
|
||||
return null;
|
||||
}
|
||||
// 创建一个新的 byte 数组输出流
|
||||
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
||||
// 使用默认缓冲区大小创建新的输出流
|
||||
GZIPOutputStream gzip = new GZIPOutputStream(out);
|
||||
// 将 b.length 个字节写入此输出流
|
||||
gzip.write(str.getBytes(charset));
|
||||
gzip.close();
|
||||
// 使用指定的 charsetName,通过解码字节将缓冲区内容转换为字符串
|
||||
return out.toByteArray();
|
||||
}
|
||||
|
||||
/**
|
||||
* 字符串的解压
|
||||
*
|
||||
* @param bytes
|
||||
* 对字符串解压
|
||||
* @return 返回解压缩后的字符串
|
||||
* @throws IOException
|
||||
*/
|
||||
public byte[] unCompress(byte[] bytes) throws IOException {
|
||||
if (null == bytes || bytes.length <= 0) {
|
||||
return null;
|
||||
}
|
||||
// 创建一个新的 byte 数组输出流
|
||||
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
||||
// 创建一个 ByteArrayInputStream,使用 buf 作为其缓冲区数组
|
||||
ByteArrayInputStream in = new ByteArrayInputStream(bytes);
|
||||
// 使用默认缓冲区大小创建新的输入流
|
||||
GZIPInputStream gzip = new GZIPInputStream(in);
|
||||
//ZipInputStream gzip = new ZipInputStream(in);
|
||||
byte[] buffer = new byte[102400];
|
||||
int n = 0;
|
||||
while ((n = gzip.read(buffer)) >= 0) {// 将未压缩数据读入字节数组
|
||||
// 将指定 byte 数组中从偏移量 off 开始的 len 个字节写入此 byte数组输出流
|
||||
out.write(buffer, 0, n);
|
||||
}
|
||||
// 使用指定的 charsetName,通过解码字节将缓冲区内容转换为字符串
|
||||
return out.toByteArray();
|
||||
}
|
||||
|
||||
public static String uncompressToString(byte[] b) {
|
||||
if (b == null || b.length == 0) {
|
||||
return null;
|
||||
}
|
||||
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
||||
ByteArrayInputStream in = new ByteArrayInputStream(b);
|
||||
try {
|
||||
GZIPInputStream gunzip = new GZIPInputStream(in);
|
||||
byte[] buffer = new byte[256];
|
||||
int n;
|
||||
while ((n = gunzip.read(buffer)) >= 0) {
|
||||
out.write(buffer, 0, n);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
|
||||
e.printStackTrace();
|
||||
}
|
||||
return out.toString();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,56 @@
|
||||
package com.ho.common.tools.vo.req;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author gyan
|
||||
* @desc: 流量监控移动卡调用
|
||||
* @DateTime: 2024/1/17 9:03
|
||||
*/
|
||||
@Data
|
||||
public class CardInfoReqVo {
|
||||
|
||||
private Integer id;
|
||||
/**
|
||||
* 卡号
|
||||
*/
|
||||
@ApiModelProperty(value = "卡号")
|
||||
private String card;
|
||||
|
||||
/**
|
||||
* 套餐Id
|
||||
*/
|
||||
@ApiModelProperty(value = "套餐Id")
|
||||
private Integer flowMonitorId;
|
||||
|
||||
/**
|
||||
* 电站id
|
||||
*/
|
||||
@ApiModelProperty(value = "电站id")
|
||||
private Integer stationId;
|
||||
|
||||
/**
|
||||
* 运营商(1:中国移动2:中国联通3:中国电信)
|
||||
*/
|
||||
@ApiModelProperty(value = "运营商(1:中国移动2:中国联通3:中国电信)")
|
||||
private Integer packageType;
|
||||
|
||||
/**
|
||||
* 卡 状态 0激活,1未激活
|
||||
*/
|
||||
@ApiModelProperty(value = "卡 状态 0激活,1未激活")
|
||||
private Integer cardStatus;
|
||||
|
||||
/**
|
||||
* 开户日期
|
||||
*/
|
||||
@ApiModelProperty(value = "开户日期")
|
||||
private String openDate;
|
||||
|
||||
/**
|
||||
* 激活日期
|
||||
*/
|
||||
@ApiModelProperty(value = "激活日期")
|
||||
private String activationDate;
|
||||
}
|
||||
@ -0,0 +1,31 @@
|
||||
package com.ho.common.tools.vo.req;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author fancl
|
||||
* @desc: 分页查询实体
|
||||
* @date 2022/8/19
|
||||
*/
|
||||
@Setter
|
||||
@Getter
|
||||
@ToString
|
||||
public class PageReqVO implements Serializable {
|
||||
|
||||
@ApiModelProperty(value = "第几页")
|
||||
private Integer pageNum=1;
|
||||
|
||||
@ApiModelProperty(value = "分页数量")
|
||||
private Integer pageSize=10;
|
||||
|
||||
@ApiModelProperty(value = "排序")
|
||||
private String order;
|
||||
|
||||
@ApiModelProperty(value = "正序、倒序")
|
||||
private String dir;
|
||||
}
|
||||
@ -0,0 +1,20 @@
|
||||
package com.ho.common.tools.vo.req;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* @author gyan
|
||||
* @desc: 数据展示返回值
|
||||
* @DateTime: 2023/4/19 14:45
|
||||
*/
|
||||
@Data
|
||||
public class PointData {
|
||||
|
||||
@ApiModelProperty(value = "时间")
|
||||
String date;
|
||||
@ApiModelProperty(value = "col字段对应的数值")
|
||||
Double digital;
|
||||
}
|
||||
@ -0,0 +1,28 @@
|
||||
package com.ho.common.tools.vo.req;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author gyan
|
||||
* @desc: 岗位
|
||||
* @DateTime: 2023/4/10 10:24
|
||||
*/
|
||||
@Data
|
||||
public class PositionVo {
|
||||
@ApiModelProperty(value = "岗位编号")
|
||||
private Integer id;
|
||||
|
||||
/**
|
||||
* 岗位编码
|
||||
*/
|
||||
@ApiModelProperty(value = "岗位编码")
|
||||
private String postCode;
|
||||
|
||||
/**
|
||||
* 岗位名称
|
||||
*/
|
||||
@ApiModelProperty(value = "岗位名称")
|
||||
private String name;
|
||||
|
||||
}
|
||||
@ -0,0 +1,26 @@
|
||||
package com.ho.common.tools.vo.req;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
|
||||
* @Description 统计图的返回数据
|
||||
* Author yule
|
||||
* @DateTime: 2023/4/17 20:21
|
||||
*/
|
||||
@Data
|
||||
public class StationHomeRespVo {
|
||||
|
||||
@ApiModelProperty(value = "横坐标 时间")
|
||||
String date;
|
||||
@ApiModelProperty(value = "纵坐标 数值")
|
||||
BigDecimal digital;
|
||||
|
||||
@ApiModelProperty(value = "值")
|
||||
String dailyUsage;
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,24 @@
|
||||
package com.ho.common.tools.vo.req;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
|
||||
/**
|
||||
* @author gyan
|
||||
* @desc: 统计图返回值(double)
|
||||
* @DateTime: 2023/5/19 10:00
|
||||
*/
|
||||
@Data
|
||||
public class StatisticsCurve{
|
||||
|
||||
@ApiModelProperty(value = "横坐标 时间")
|
||||
String date;
|
||||
@ApiModelProperty(value = "纵坐标 数值")
|
||||
Double digital;
|
||||
|
||||
@Override
|
||||
public StatisticsCurve clone() throws CloneNotSupportedException {
|
||||
return (StatisticsCurve)super.clone();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,25 @@
|
||||
package com.ho.common.tools.vo.req;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author fancl
|
||||
* @desc: 天气查询接口
|
||||
* @date 2023/1/13
|
||||
*/
|
||||
@Data
|
||||
public class WeatherReq implements Serializable {
|
||||
|
||||
String ip;
|
||||
|
||||
Integer stationId;
|
||||
//电站地址
|
||||
String addr;
|
||||
|
||||
//经度 调用外部api时是字符串
|
||||
String longitude;
|
||||
//维度
|
||||
String latitude;
|
||||
}
|
||||
Reference in New Issue
Block a user