解决许可证的问题。
This commit is contained in:
parent
16f2cdd576
commit
e7cf898cbe
|
|
@ -15,39 +15,36 @@
|
|||
<maven.compiler.source>17</maven.compiler.source>
|
||||
<maven.compiler.target>17</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<lombok.version>1.18.36</lombok.version>
|
||||
<hutool.version>5.8.22</hutool.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>${lombok.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>cn.hutool</groupId>
|
||||
<artifactId>hutool-all</artifactId>
|
||||
<version>5.8.22</version>
|
||||
<version>${hutool.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.electromagnetic.data</groupId>
|
||||
<artifactId>electromagnetic-common</artifactId>
|
||||
<version>1.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.xml.bind</groupId>
|
||||
<artifactId>jaxb-api</artifactId>
|
||||
<version>2.3.1</version>
|
||||
</dependency>
|
||||
<!-- 可选:添加 JAXB 实现库(如 jaxb-impl) -->
|
||||
<dependency>
|
||||
<groupId>com.sun.xml.bind</groupId>
|
||||
<artifactId>jaxb-impl</artifactId>
|
||||
<version>2.3.3</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
|
|
|||
|
|
@ -16,6 +16,11 @@
|
|||
<maven.compiler.target>17</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<mapstruct.version>1.4.1.Final</mapstruct.version>
|
||||
<mybatis-plus.version>3.5.7</mybatis-plus.version>
|
||||
<mariaddb-client.version>3.5.1</mariaddb-client.version>
|
||||
<pagehelper.version>5.3.1</pagehelper.version>
|
||||
<druid.version>1.2.6</druid.version>
|
||||
<aspectjweaver.version>1.9.7</aspectjweaver.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
|
|
@ -30,44 +35,40 @@
|
|||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>org.springframework.boot</groupId>-->
|
||||
<!-- <artifactId>spring-boot-starter-test</artifactId>-->
|
||||
<!-- </dependency>-->
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-webflux</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.ai</groupId>
|
||||
<artifactId>spring-ai-starter-model-ollama</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.ai</groupId>
|
||||
<artifactId>spring-ai-starter-vector-store-mariadb</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>mybatis-plus-spring-boot3-starter</artifactId>
|
||||
<version>3.5.7</version>
|
||||
<version>${mybatis-plus.version}</version>
|
||||
</dependency>
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>mysql</groupId>-->
|
||||
<!-- <artifactId>mysql-connector-java</artifactId>-->
|
||||
<!-- <version>8.0.31</version>-->
|
||||
<!-- </dependency>-->
|
||||
|
||||
<dependency>
|
||||
<groupId>org.mariadb.jdbc</groupId>
|
||||
<artifactId>mariadb-java-client</artifactId>
|
||||
<version>3.5.1</version>
|
||||
<version>${mariaddb-client.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.electromagnetic.data</groupId>
|
||||
<artifactId>electromagnetic-common</artifactId>
|
||||
<version>1.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.github.pagehelper</groupId>
|
||||
<artifactId>pagehelper</artifactId>
|
||||
|
|
@ -77,13 +78,14 @@
|
|||
<artifactId>jsqlparser</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
<version>5.3.1</version>
|
||||
<version>${pagehelper.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!--引入druid数据源-->
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>druid-spring-boot-starter</artifactId>
|
||||
<version>1.2.6</version>
|
||||
<version>${druid.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
|
|
@ -91,15 +93,17 @@
|
|||
<artifactId>mapstruct-processor</artifactId>
|
||||
<version>${mapstruct.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.mapstruct</groupId>
|
||||
<artifactId>mapstruct</artifactId>
|
||||
<version>${mapstruct.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.aspectj</groupId>
|
||||
<artifactId>aspectjweaver</artifactId>
|
||||
<version>1.9.7</version>
|
||||
<version>${aspectjweaver.version}</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
package com.electromagnetic.industry.software.common.pojo;
|
||||
package com.electromagnetic.industry.software.manage.pojo.other;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import lombok.Builder;
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
package com.electromagnetic.industry.software.manage.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.electromagnetic.industry.software.common.pojo.TreeNode;
|
||||
import com.electromagnetic.industry.software.manage.pojo.other.TreeNode;
|
||||
import com.electromagnetic.industry.software.manage.pojo.models.EdTagLibrary;
|
||||
import com.electromagnetic.industry.software.manage.pojo.resp.FileTagInfo;
|
||||
import com.electromagnetic.industry.software.manage.pojo.resp.TagListVO;
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ import com.electromagnetic.industry.software.common.enums.EffectFlagEnum;
|
|||
import com.electromagnetic.industry.software.common.enums.PublishEnum;
|
||||
import com.electromagnetic.industry.software.common.enums.TagTypeEnum;
|
||||
import com.electromagnetic.industry.software.common.exception.BizException;
|
||||
import com.electromagnetic.industry.software.common.pojo.TreeNode;
|
||||
import com.electromagnetic.industry.software.manage.pojo.other.TreeNode;
|
||||
import com.electromagnetic.industry.software.common.util.UserThreadLocal;
|
||||
import com.electromagnetic.industry.software.manage.mapper.EdTagLibraryMapper;
|
||||
import com.electromagnetic.industry.software.manage.pojo.models.EdTagLibrary;
|
||||
|
|
|
|||
|
|
@ -35,12 +35,14 @@ import com.electromagnetic.industry.software.manage.service.EdFileFavoriteServic
|
|||
import com.electromagnetic.industry.software.manage.service.UserRoleService;
|
||||
import com.electromagnetic.industry.software.manage.service.UserService;
|
||||
import io.jsonwebtoken.Jwts;
|
||||
import io.jsonwebtoken.SignatureAlgorithm;
|
||||
import io.jsonwebtoken.security.Keys;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.crypto.SecretKey;
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
|
@ -119,11 +121,13 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
|
|||
claims.put(UserConstants.LOGIN_USER_NAME, loginInfo.getUsername());
|
||||
claims.put(UserConstants.LOGIN_WORK_NUMBER, loginInfo.getWorkNumber());
|
||||
claims.put(UserConstants.LOGIN_ADMIN_TYPE, loginInfo.getAdminType());
|
||||
byte[] keyBytes = elePropertyConfig.getLoginEncPasswd().getBytes(Charset.defaultCharset());
|
||||
SecretKey key = Keys.hmacShaKeyFor(keyBytes);
|
||||
return Jwts.builder()
|
||||
.addClaims(claims)
|
||||
.setId(UUID.randomUUID().toString())
|
||||
.setIssuedAt(DateTime.now())
|
||||
.signWith(SignatureAlgorithm.HS512, elePropertyConfig.getLoginEncPasswd())
|
||||
.claims(claims) // 自定义 claims
|
||||
.id(UUID.randomUUID().toString()) // JWT ID
|
||||
.issuedAt(new Date()) // 签发时间,使用 java.util.Date
|
||||
.signWith(key) // 签名
|
||||
.compact();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -15,109 +15,128 @@
|
|||
<maven.compiler.source>17</maven.compiler.source>
|
||||
<maven.compiler.target>17</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<jwt.version>0.9.0</jwt.version>
|
||||
<jwt.version>0.13.0</jwt.version>
|
||||
<lombok.version>1.18.36</lombok.version>
|
||||
<hutool.version>5.8.22</hutool.version>
|
||||
<logback.version>1.5.16</logback.version>
|
||||
<rapidocr.version>0.0.7</rapidocr.version>
|
||||
<rapidocr-onnx.version>1.2.2</rapidocr-onnx.version>
|
||||
<documents4j.version>1.0.3</documents4j.version>
|
||||
<bcprov.version>1.78</bcprov.version>
|
||||
<fr.opensagres.xdocreport.version>2.0.1</fr.opensagres.xdocreport.version>
|
||||
<poi-ooxml.version>4.1.2</poi-ooxml.version>
|
||||
<poi-scratchpad.version>4.1.2</poi-scratchpad.version>
|
||||
<poi-ooxml-schemas.version>4.1.0</poi-ooxml-schemas.version>
|
||||
<commons-compress.version>1.26.0</commons-compress.version>
|
||||
<pdfbox.version>3.0.3</pdfbox.version>
|
||||
<jaxb-impl.version>2.3.3</jaxb-impl.version>
|
||||
<jbig2-imageio.version>3.0.2</jbig2-imageio.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>1.18.36</version>
|
||||
<version>${lombok.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.jsonwebtoken</groupId>
|
||||
<artifactId>jjwt</artifactId>
|
||||
<version>${jwt.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.bouncycastle</groupId>
|
||||
<artifactId>bcprov-jdk18on</artifactId>
|
||||
<version>1.78</version>
|
||||
<version>${bcprov.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>cn.hutool</groupId>
|
||||
<artifactId>hutool-all</artifactId>
|
||||
<version>5.8.22</version>
|
||||
<version>${hutool.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>ch.qos.logback</groupId>
|
||||
<artifactId>logback-classic</artifactId>
|
||||
<version>1.5.16</version>
|
||||
<version>${logback.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>ch.qos.logback</groupId>
|
||||
<artifactId>logback-core</artifactId>
|
||||
<version>1.5.16</version>
|
||||
<version>${logback.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>fr.opensagres.xdocreport</groupId>
|
||||
<artifactId>fr.opensagres.poi.xwpf.converter.pdf-gae</artifactId>
|
||||
<version>2.0.1</version>
|
||||
<version>${fr.opensagres.xdocreport.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.documents4j</groupId>
|
||||
<artifactId>documents4j-local</artifactId>
|
||||
<version>1.0.3</version>
|
||||
<version>${documents4j.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.documents4j</groupId>
|
||||
<artifactId>documents4j-transformer-msoffice-word</artifactId>
|
||||
<version>1.0.3</version>
|
||||
<version>${documents4j.version}</version>
|
||||
</dependency>
|
||||
<!--处理word文档需要的额外的jar包-->
|
||||
<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi-ooxml</artifactId>
|
||||
<version>4.1.2</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-compress</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
<version>${poi-ooxml.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-compress</artifactId>
|
||||
<version>1.26.0</version>
|
||||
<version>${commons-compress.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!--处理word文档需要的额外的jar包-->
|
||||
<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi-ooxml-schemas</artifactId>
|
||||
<version>4.1.0</version>
|
||||
<version>${poi-ooxml-schemas.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- POI-word文件处理需要 -->
|
||||
<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi-scratchpad</artifactId>
|
||||
<version>4.1.2</version>
|
||||
<version>${poi-scratchpad.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.pdfbox</groupId>
|
||||
<artifactId>pdfbox</artifactId>
|
||||
<version>3.0.3</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.xml.bind</groupId>
|
||||
<artifactId>jaxb-api</artifactId>
|
||||
<version>2.3.1</version>
|
||||
<version>${pdfbox.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.sun.xml.bind</groupId>
|
||||
<artifactId>jaxb-impl</artifactId>
|
||||
<version>2.3.3</version>
|
||||
<version>${jaxb-impl.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.github.mymonstercat</groupId>
|
||||
<artifactId>rapidocr</artifactId>
|
||||
<version>0.0.7</version>
|
||||
<version>${rapidocr.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 一般只需要引入一个,CPU端建议使用onnx,移动端建议使用ncnn -->
|
||||
|
|
@ -125,17 +144,19 @@
|
|||
<dependency>
|
||||
<groupId>io.github.mymonstercat</groupId>
|
||||
<artifactId>rapidocr-onnx-platform</artifactId>
|
||||
<version>0.0.7</version>
|
||||
<version>${rapidocr.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.github.mymonstercat</groupId>
|
||||
<artifactId>rapidocr-onnx-linux-x86_64</artifactId>
|
||||
<version>1.2.2</version>
|
||||
<version>${rapidocr-onnx.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.pdfbox</groupId>
|
||||
<artifactId>jbig2-imageio</artifactId>
|
||||
<version>3.0.2</version>
|
||||
<version>${jbig2-imageio.version}</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
|
|
|||
|
|
@ -1,8 +1,10 @@
|
|||
package com.electromagnetic.industry.software.common.util;
|
||||
|
||||
|
||||
import cn.hutool.crypto.SecureUtil;
|
||||
import cn.hutool.crypto.symmetric.AES;
|
||||
import javax.crypto.Cipher;
|
||||
import javax.crypto.spec.SecretKeySpec;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Base64;
|
||||
|
||||
/**
|
||||
* <p>Description: [AES对称加密和解密]</p>
|
||||
|
|
@ -22,11 +24,15 @@ public class AESUtils {
|
|||
*/
|
||||
public static String decrypt(String enc, String key) {
|
||||
try {
|
||||
// 使用Hutool创建AES解密器(ECB模式,PKCS7Padding)
|
||||
AES aes = SecureUtil.aes(key.getBytes());
|
||||
// 执行解密(Hutool会自动处理Base64解码)
|
||||
byte[] decrypted = aes.decrypt(enc);
|
||||
return new String(decrypted);
|
||||
// 1. 还原密钥
|
||||
SecretKeySpec keySpec = new SecretKeySpec(key.getBytes(StandardCharsets.UTF_8), "AES");
|
||||
// 2. 创建 Cipher
|
||||
Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding");
|
||||
// 3. 初始化解密
|
||||
cipher.init(Cipher.DECRYPT_MODE, keySpec);
|
||||
// 4. 解密
|
||||
byte[] plainBytes = cipher.doFinal(Base64.getDecoder().decode(enc));
|
||||
return new String(plainBytes, StandardCharsets.UTF_8);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,9 @@ package com.electromagnetic.industry.software.common.util;
|
|||
|
||||
import io.jsonwebtoken.Claims;
|
||||
import io.jsonwebtoken.Jwts;
|
||||
import io.jsonwebtoken.security.Keys;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
public class TokenUtil {
|
||||
|
||||
|
|
@ -12,10 +15,11 @@ public class TokenUtil {
|
|||
* @return
|
||||
*/
|
||||
public static Claims getLoginInfo(String token, String loginEncode) {
|
||||
return Jwts.parser()
|
||||
.setSigningKey(loginEncode)
|
||||
.parseClaimsJws(token)
|
||||
.getBody();
|
||||
return Jwts.parser() // 返回 JwtParserBuilder
|
||||
.verifyWith(Keys.hmacShaKeyFor(loginEncode.getBytes(StandardCharsets.UTF_8)))
|
||||
.build()
|
||||
.parseSignedClaims(token) // 对应原来的 parseClaimsJws
|
||||
.getPayload(); // 对应原来的 getBody()
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue