getSupportedMediaTypes() {
+ return Collections.singletonList(MediaType.APPLICATION_JSON_UTF8);
+ }
+ });
+
+
+ }
+}
diff --git a/src/main/java/com/sczx/store/constant/SystemConstants.java b/src/main/java/com/sczx/store/constant/SystemConstants.java
new file mode 100644
index 0000000..3dd08d1
--- /dev/null
+++ b/src/main/java/com/sczx/store/constant/SystemConstants.java
@@ -0,0 +1,23 @@
+package com.sczx.store.constant;
+
+
+/**
+ * 应用模块名称
+ *
+ * 代码描述
+ *
+ * Copyright: Copyright (C) 2022 CD Finance Management Co., Ltd. All rights reserved.
+ *
+ * Company: 中和农信项目管理有限公司
+ *
+ * @author zhonghui
+ * @since 2022/4/1 3:33 PM
+ */
+public interface SystemConstants {
+
+ /***
+ * feign客户端所在包路径
+ */
+ String FEIGN_CLIENT_BASE_PACKAGE = "com.sczx.app.thirdpart.facade";
+
+}
diff --git a/src/main/java/com/sczx/store/util/ComputerInfo.java b/src/main/java/com/sczx/store/util/ComputerInfo.java
new file mode 100644
index 0000000..93ea9a1
--- /dev/null
+++ b/src/main/java/com/sczx/store/util/ComputerInfo.java
@@ -0,0 +1,159 @@
+package com.sczx.store.util;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.net.InetAddress;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+/*
+ * <取网卡物理地址--
+ * 1.在Windows,Linux系统下均可用;
+ * 2.通过ipconifg,ifconfig获得计算机信息;
+ * 3.再用模式匹配方式查找MAC地址,与操作系统的语言无关>
+ *
+ * //* Description: <取计算机名--从环境变量中取>
+ * abstract 限制继承/创建实例
+ */
+public abstract class ComputerInfo {
+ private static String macAddressStr = null;
+ private static String computerName = System.getenv().get("COMPUTERNAME");
+
+ private static final String[] windowsCommand = { "ipconfig", "/all" };
+ private static final String[] linuxCommand = { "/sbin/ifconfig", "-a" };
+ private static final String[] macCommand = { "ifconfig", "-a" };
+ private static final Pattern macPattern = Pattern.compile(".*((:?[0-9a-f]{2}[-:]){5}[0-9a-f]{2}).*",
+ Pattern.CASE_INSENSITIVE);
+
+ /**
+ * 获取多个网卡地址
+ *
+ * @return
+ * @throws IOException
+ */
+ private final static List getMacAddressList() throws IOException {
+ final ArrayList macAddressList = new ArrayList();
+ final String os = System.getProperty("os.name");
+ final String command[];
+
+ if (os.startsWith("Windows")) {
+ command = windowsCommand;
+ } else if (os.startsWith("Linux")) {
+ command = linuxCommand;
+ } else if (os.startsWith("Mac")){
+ command = macCommand;
+ }
+ else {
+ throw new IOException("Unknow operating system:" + os);
+ }
+ // 执行命令
+ final Process process = Runtime.getRuntime().exec(command);
+
+ BufferedReader bufReader = new BufferedReader(new InputStreamReader(process.getInputStream()));
+ for (String line = null; (line = bufReader.readLine()) != null;) {
+ Matcher matcher = macPattern.matcher(line);
+ if (matcher.matches()) {
+ macAddressList.add(matcher.group(1));
+ // macAddressList.add(matcher.group(1).replaceAll("[-:]",
+ // ""));//去掉MAC中的“-”
+ }
+ }
+
+ process.destroy();
+ bufReader.close();
+ return macAddressList;
+ }
+
+ /**
+ * 获取一个网卡地址(多个网卡时从中获取一个)
+ *
+ * @return
+ */
+ public static String getMacAddress() {
+ if (macAddressStr == null || macAddressStr.equals("")) {
+ StringBuffer sb = new StringBuffer(); // 存放多个网卡地址用,目前只取一个非0000000000E0隧道的值
+ try {
+ List macList = getMacAddressList();
+ for (Iterator iter = macList.iterator(); iter.hasNext();) {
+ String amac = iter.next();
+ if (!"0000000000E0".equals(amac)) {
+ sb.append(amac);
+ break;
+ }
+ }
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+
+ macAddressStr = sb.toString();
+
+ }
+
+ return macAddressStr;
+ }
+
+ /**
+ * 获取电脑名
+ *
+ * @return
+ */
+ public static String getComputerName() {
+ if (computerName == null || computerName.equals("")) {
+ computerName = System.getenv().get("COMPUTERNAME");
+ }
+ return computerName;
+ }
+
+ /**
+ * 获取客户端IP地址
+ *
+ * @return
+ */
+ public static String getIpAddrAndName() throws IOException {
+ return InetAddress.getLocalHost().toString();
+ }
+
+ /**
+ * 获取客户端IP地址
+ *
+ * @return
+ */
+ public static String getIpAddr() throws IOException {
+ return InetAddress.getLocalHost().getHostAddress().toString();
+ }
+
+ /**
+ * 获取电脑唯一标识
+ *
+ * @return
+ */
+ public static String getComputerID() {
+ String id = getMacAddress();
+ if (id == null || id.equals("")) {
+ try {
+ id = getIpAddrAndName();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+ return computerName;
+ }
+
+ /**
+ * 限制创建实例
+ */
+ private ComputerInfo() {
+
+ }
+
+ public static void main(String[] args) throws IOException {
+ System.out.println(ComputerInfo.getMacAddress());
+ System.out.println(ComputerInfo.getComputerName());
+ System.out.println(ComputerInfo.getIpAddr());
+ System.out.println(ComputerInfo.getIpAddrAndName());
+ }
+}
diff --git a/src/main/java/com/sczx/store/util/JwtUtil.java b/src/main/java/com/sczx/store/util/JwtUtil.java
new file mode 100644
index 0000000..fc784cd
--- /dev/null
+++ b/src/main/java/com/sczx/store/util/JwtUtil.java
@@ -0,0 +1,63 @@
+package com.sczx.store.util;
+
+import io.jsonwebtoken.JwtException;
+import io.jsonwebtoken.Jwts;
+import io.jsonwebtoken.SignatureAlgorithm;
+import io.jsonwebtoken.security.Keys;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
+
+import javax.crypto.SecretKey;
+import java.util.Date;
+
+/**
+ * @Author: 张黎
+ * @Date: 2025/07/06/14:00
+ * @Description:
+ */
+@Slf4j
+@Component
+public class JwtUtil {
+
+ @Value("${auth.token-expiration}")
+ private long expiration;
+ private final SecretKey key;
+
+ public JwtUtil(@Value("${auth.secret-key}") String secretKey) {
+ this.key = Keys.hmacShaKeyFor(secretKey.getBytes());
+
+// this.key = Keys.secretKeyFor(SignatureAlgorithm.HS512);
+ log.info("JWT 密钥:{}", secretKey);
+ }
+
+ public String generateToken(String username, String role) {
+ return Jwts.builder()
+ .setSubject(username)
+ .claim("role", role)
+ .setExpiration(new Date(System.currentTimeMillis() + expiration))
+ .signWith(key, SignatureAlgorithm.HS512)
+ .compact();
+ }
+
+ public String extractUsername(String token) {
+ return Jwts.parserBuilder()
+ .setSigningKey(key)
+ .build()
+ .parseClaimsJws(token)
+ .getBody()
+ .getSubject();
+ }
+
+ public boolean validateToken(String token) {
+ try {
+ Jwts.parserBuilder()
+ .setSigningKey(key)
+ .build()
+ .parseClaimsJws(token);
+ return true;
+ } catch (JwtException ex) {
+ return false;
+ }
+ }
+}
diff --git a/src/main/java/com/sczx/store/util/RedisUtil.java b/src/main/java/com/sczx/store/util/RedisUtil.java
new file mode 100644
index 0000000..75477e1
--- /dev/null
+++ b/src/main/java/com/sczx/store/util/RedisUtil.java
@@ -0,0 +1,33 @@
+package com.sczx.store.util;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.redis.core.StringRedisTemplate;
+import org.springframework.stereotype.Component;
+
+import java.util.concurrent.TimeUnit;
+
+/**
+ * @Author: 张黎
+ * @Date: 2025/07/06/14:21
+ * @Description:
+ */
+@Component
+public class RedisUtil {
+
+
+ @Autowired
+ private StringRedisTemplate redisTemplate;
+
+ public void set(String key, String value, long timeout, TimeUnit unit) {
+ redisTemplate.opsForValue().set(key, value, timeout, unit);
+ }
+
+ public String get(String key) {
+ return redisTemplate.opsForValue().get(key);
+ }
+
+ public void delete(String key) {
+ redisTemplate.delete(key);
+ }
+
+}
diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml
new file mode 100644
index 0000000..d109fa1
--- /dev/null
+++ b/src/main/resources/application.yml
@@ -0,0 +1,86 @@
+
+server:
+ port: 8081
+
+spring:
+ application:
+ name: sczx_store # 微服务名称
+ http:
+ encoding:
+ charset: UTF-8
+ enabled: true
+ force: true
+ mvc:
+ async:
+ request-timeout: -1
+ cloud:
+ nacos:
+ discovery:
+ server-addr: 115.190.8.52:8848 # Nacos 地址
+ group: DEFAULT_GROUP
+ metadata:
+ version: 1.0.0
+ env: dev
+ lifecycle:
+ timeout-per-shutdown-phase: 30s # 设置优雅停机时间
+ datasource:
+ url: jdbc:mysql://115.190.8.52:3306/sczx?useSSL=false&serverTimezone=UTC&allowPublicKeyRetrieval=true
+ username: sczx_user
+ password: Sczx123@
+ driver-class-name: com.mysql.cj.jdbc.Driver
+ hikari:
+ maximum-pool-size: 10
+ auto-commit: true
+ redis:
+ host: 115.190.8.52
+ port: 6379
+ lettuce:
+ pool:
+ max-active: 8
+ max-wait: 2000ms
+ max-idle: 4
+ min-idle: 1
+ max-life-time: 300000ms
+
+management:
+ endpoints:
+ web:
+ exposure:
+ include: "*" # 暴露所有监控端点
+ endpoint:
+ health:
+ show-details: always
+
+feign:
+ client:
+ config:
+ default:
+ connectTimeout: 5000
+ readTimeout: 5000
+ hystrix:
+ enabled: true # 启用 Feign 的 Hystrix 支持
+
+hystrix:
+ command:
+ default:
+ execution:
+ isolation:
+ thread:
+ timeoutInMilliseconds: 10000 # 默认熔断超时时间
+
+springdoc:
+ swagger-ui:
+ url: /v3/api-docs
+ path: /doc.html
+ packages-to-scan: com.sczx.user.controller # 替换为你的 controller 包路径
+
+mybatis-plus:
+ mapper-locations: classpath*:mapper/**/*.xml
+ type-aliases-package: com.sczx.user.entity # 实体类包路径
+ configuration:
+ mapUnderscoreToCamelCase: true
+ log-impl: org.apache.ibatis.logging.stdout.StdOutImpl # 控制台打印 SQL(调试用)
+
+auth:
+ secret-key: his-is-a-very-long-and-secure-secret-key-for-jwt-signing-please-dont-use-short-keys
+ token-expiration: 86400000 # 24小时
diff --git a/src/main/resources/logback.xml b/src/main/resources/logback.xml
new file mode 100644
index 0000000..e594345
--- /dev/null
+++ b/src/main/resources/logback.xml
@@ -0,0 +1,53 @@
+
+
+
+
+
+
+
+
+ ${PATTERN}
+
+
+
+
+
+ ${LOG_FILE_PATH}/${hostname}/info.%d{yyyy-MM-dd}.log
+ 31
+
+
+
+ ${PATTERN}
+
+
+
+ WARN
+ DENY
+ NEUTRAL
+
+
+ ERROR
+ DENY
+ NEUTRAL
+
+
+
+
+
+ WARN
+
+ ${LOG_FILE_PATH}/${hostname}/warn.log
+ true
+
+ ${PATTERN}
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/target/classes/application.yml b/target/classes/application.yml
new file mode 100644
index 0000000..d109fa1
--- /dev/null
+++ b/target/classes/application.yml
@@ -0,0 +1,86 @@
+
+server:
+ port: 8081
+
+spring:
+ application:
+ name: sczx_store # 微服务名称
+ http:
+ encoding:
+ charset: UTF-8
+ enabled: true
+ force: true
+ mvc:
+ async:
+ request-timeout: -1
+ cloud:
+ nacos:
+ discovery:
+ server-addr: 115.190.8.52:8848 # Nacos 地址
+ group: DEFAULT_GROUP
+ metadata:
+ version: 1.0.0
+ env: dev
+ lifecycle:
+ timeout-per-shutdown-phase: 30s # 设置优雅停机时间
+ datasource:
+ url: jdbc:mysql://115.190.8.52:3306/sczx?useSSL=false&serverTimezone=UTC&allowPublicKeyRetrieval=true
+ username: sczx_user
+ password: Sczx123@
+ driver-class-name: com.mysql.cj.jdbc.Driver
+ hikari:
+ maximum-pool-size: 10
+ auto-commit: true
+ redis:
+ host: 115.190.8.52
+ port: 6379
+ lettuce:
+ pool:
+ max-active: 8
+ max-wait: 2000ms
+ max-idle: 4
+ min-idle: 1
+ max-life-time: 300000ms
+
+management:
+ endpoints:
+ web:
+ exposure:
+ include: "*" # 暴露所有监控端点
+ endpoint:
+ health:
+ show-details: always
+
+feign:
+ client:
+ config:
+ default:
+ connectTimeout: 5000
+ readTimeout: 5000
+ hystrix:
+ enabled: true # 启用 Feign 的 Hystrix 支持
+
+hystrix:
+ command:
+ default:
+ execution:
+ isolation:
+ thread:
+ timeoutInMilliseconds: 10000 # 默认熔断超时时间
+
+springdoc:
+ swagger-ui:
+ url: /v3/api-docs
+ path: /doc.html
+ packages-to-scan: com.sczx.user.controller # 替换为你的 controller 包路径
+
+mybatis-plus:
+ mapper-locations: classpath*:mapper/**/*.xml
+ type-aliases-package: com.sczx.user.entity # 实体类包路径
+ configuration:
+ mapUnderscoreToCamelCase: true
+ log-impl: org.apache.ibatis.logging.stdout.StdOutImpl # 控制台打印 SQL(调试用)
+
+auth:
+ secret-key: his-is-a-very-long-and-secure-secret-key-for-jwt-signing-please-dont-use-short-keys
+ token-expiration: 86400000 # 24小时
diff --git a/target/classes/logback.xml b/target/classes/logback.xml
new file mode 100644
index 0000000..e594345
--- /dev/null
+++ b/target/classes/logback.xml
@@ -0,0 +1,53 @@
+
+
+
+
+
+
+
+
+ ${PATTERN}
+
+
+
+
+
+ ${LOG_FILE_PATH}/${hostname}/info.%d{yyyy-MM-dd}.log
+ 31
+
+
+
+ ${PATTERN}
+
+
+
+ WARN
+ DENY
+ NEUTRAL
+
+
+ ERROR
+ DENY
+ NEUTRAL
+
+
+
+
+
+ WARN
+
+ ${LOG_FILE_PATH}/${hostname}/warn.log
+ true
+
+ ${PATTERN}
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/target/dependency-maven-plugin-markers/org.webjars-swagger-ui-jar-4.15.5-189193280 b/target/dependency-maven-plugin-markers/org.webjars-swagger-ui-jar-4.15.5-189193280
new file mode 100644
index 0000000..e69de29
diff --git a/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst b/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst
new file mode 100644
index 0000000..e69de29
diff --git a/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst b/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst
new file mode 100644
index 0000000..02d8311
--- /dev/null
+++ b/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst
@@ -0,0 +1,8 @@
+D:\workspace\sczx\sczx_store\src\main\java\com\sczx\store\util\JwtUtil.java
+D:\workspace\sczx\sczx_store\src\main\java\com\sczx\store\config\WebConfig.java
+D:\workspace\sczx\sczx_store\src\main\java\com\sczx\store\constant\SystemConstants.java
+D:\workspace\sczx\sczx_store\src\main\java\com\sczx\store\util\ComputerInfo.java
+D:\workspace\sczx\sczx_store\src\main\java\com\sczx\store\config\MyBatisPlusConfig.java
+D:\workspace\sczx\sczx_store\src\main\java\com\sczx\store\config\SpringDocConfig.java
+D:\workspace\sczx\sczx_store\src\main\java\com\sczx\store\util\RedisUtil.java
+D:\workspace\sczx\sczx_store\src\main\java\com\sczx\store\Application.java