diff --git a/common/src/main/java/com/storeroom/exception/JsonException.java b/common/src/main/java/com/storeroom/exception/JsonException.java deleted file mode 100644 index 6bbf67b..0000000 --- a/common/src/main/java/com/storeroom/exception/JsonException.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.storeroom.exception; - - -import com.storeroom.exception.constant.ResponseStatus; -import lombok.Getter; - - -/** - * Json 异常 - */ -@Getter -public class JsonException extends BaseException { - - public JsonException(ResponseStatus responseStatus) { - super(responseStatus); - } - - public JsonException(Integer code,String message) { - super(code, message); - } - - -} diff --git a/common/src/main/java/com/storeroom/exception/PageException.java b/common/src/main/java/com/storeroom/exception/PageException.java deleted file mode 100644 index a5b544f..0000000 --- a/common/src/main/java/com/storeroom/exception/PageException.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.storeroom.exception; - -import com.storeroom.exception.constant.ResponseStatus; -import lombok.Getter; - -/** - * 页面异常类 - */ -@Getter -public class PageException extends BaseException { - - public PageException(ResponseStatus responseStatus) { - super(responseStatus); - } - - public PageException(Integer code, String message) { - super(code, message); - } -} diff --git a/common/src/main/java/com/storeroom/utils/SecurityUtils.java b/common/src/main/java/com/storeroom/utils/SecurityUtils.java index 6d000ea..7a6c599 100644 --- a/common/src/main/java/com/storeroom/utils/SecurityUtils.java +++ b/common/src/main/java/com/storeroom/utils/SecurityUtils.java @@ -4,7 +4,7 @@ package com.storeroom.utils; import cn.hutool.json.JSONArray; import cn.hutool.json.JSONObject; import cn.hutool.json.JSONUtil; -import com.storeroom.exception.JsonException; +import com.storeroom.exception.BaseException; import com.storeroom.exception.constant.ResponseStatus; import com.storeroom.utils.enums.DataScopeEnum; import lombok.extern.slf4j.Slf4j; @@ -36,13 +36,13 @@ public class SecurityUtils { public static String getCurrentUsername() { final Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); if (authentication == null) { - throw new JsonException(ResponseStatus.TOKEN_UNAUTHORIZED.getCode(), ResponseStatus.TOKEN_UNAUTHORIZED.getMessage()); + throw new BaseException(ResponseStatus.TOKEN_UNAUTHORIZED.getMessage()); } if (authentication.getPrincipal() instanceof UserDetails) { UserDetails userDetails = (UserDetails) authentication.getPrincipal(); return userDetails.getUsername(); } - throw new JsonException(ResponseStatus.TOKEN_IS_NULL.getCode(), ResponseStatus.TOKEN_IS_NULL.getMessage()); + throw new BaseException(ResponseStatus.TOKEN_IS_NULL.getMessage()); } /** diff --git a/common/target/classes/com/storeroom/exception/BaseException.class b/common/target/classes/com/storeroom/exception/BaseException.class index 04eb730..49deb62 100644 Binary files a/common/target/classes/com/storeroom/exception/BaseException.class and b/common/target/classes/com/storeroom/exception/BaseException.class differ diff --git a/common/target/classes/com/storeroom/exception/JsonException.class b/common/target/classes/com/storeroom/exception/JsonException.class deleted file mode 100644 index eabd84d..0000000 Binary files a/common/target/classes/com/storeroom/exception/JsonException.class and /dev/null differ diff --git a/common/target/classes/com/storeroom/exception/PageException.class b/common/target/classes/com/storeroom/exception/PageException.class deleted file mode 100644 index 23cd545..0000000 Binary files a/common/target/classes/com/storeroom/exception/PageException.class and /dev/null differ diff --git a/common/target/classes/com/storeroom/exception/constant/Status.class b/common/target/classes/com/storeroom/exception/constant/Status.class deleted file mode 100644 index 31f7b8d..0000000 Binary files a/common/target/classes/com/storeroom/exception/constant/Status.class and /dev/null differ diff --git a/common/target/classes/com/storeroom/exception/controller/TestController.class b/common/target/classes/com/storeroom/exception/controller/TestController.class deleted file mode 100644 index f17c69c..0000000 Binary files a/common/target/classes/com/storeroom/exception/controller/TestController.class and /dev/null differ diff --git a/common/target/classes/com/storeroom/exception/handler/ApiResponse.class b/common/target/classes/com/storeroom/exception/handler/ApiResponse.class deleted file mode 100644 index 2b5e668..0000000 Binary files a/common/target/classes/com/storeroom/exception/handler/ApiResponse.class and /dev/null differ diff --git a/common/target/classes/com/storeroom/exception/handler/GlobalExceptionHandler.class b/common/target/classes/com/storeroom/exception/handler/GlobalExceptionHandler.class index 1de7ebe..74cc95f 100644 Binary files a/common/target/classes/com/storeroom/exception/handler/GlobalExceptionHandler.class and b/common/target/classes/com/storeroom/exception/handler/GlobalExceptionHandler.class differ diff --git a/pom.xml b/pom.xml index 7fef809..96fe5b7 100644 --- a/pom.xml +++ b/pom.xml @@ -10,6 +10,7 @@ 1.0 common + system 智能库房综合管理系统 diff --git a/system/pom.xml b/system/pom.xml new file mode 100644 index 0000000..5977132 --- /dev/null +++ b/system/pom.xml @@ -0,0 +1,76 @@ + + + + yxk_StoreroomSystem + com.storeroom + 1.0 + + 4.0.0 + + system + 系统设置 + + + 0.11.2 + + 5.6.0 + + + + com.storeroom + common + 1.0 + + + + + org.springframework.boot + spring-boot-starter-websocket + + + + + io.jsonwebtoken + jjwt-api + ${jjwt.version} + + + io.jsonwebtoken + jjwt-impl + ${jjwt.version} + + + io.jsonwebtoken + jjwt-jackson + ${jjwt.version} + + + + + ch.ethz.ganymed + ganymed-ssh2 + build210 + + + com.jcraft + jsch + 0.1.55 + + + + + com.github.oshi + oshi-core + 5.3.6 + + + + + org.quartz-scheduler + quartz + + + + \ No newline at end of file diff --git a/system/src/main/java/AppRun.java b/system/src/main/java/AppRun.java new file mode 100644 index 0000000..482b4e0 --- /dev/null +++ b/system/src/main/java/AppRun.java @@ -0,0 +1,33 @@ +import com.storeroom.annotaion.rest.AnonymousGetMapping; +import com.storeroom.utils.SpringContextHolder; +import io.swagger.annotations.Api; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.annotation.Bean; +import org.springframework.data.jpa.repository.config.EnableJpaAuditing; +import org.springframework.scheduling.annotation.EnableAsync; +import org.springframework.transaction.annotation.EnableTransactionManagement; +import org.springframework.web.bind.annotation.RestController; + +@EnableAsync +@RestController +@Api(hidden = true) +@SpringBootApplication +@EnableTransactionManagement +@EnableJpaAuditing(auditorAwareRef = "audiorAware") +public class AppRun { + + public static void main(String[] args){ + SpringApplication.run(AppRun.class,args); + } + + @Bean + public SpringContextHolder springContextHolder(){ + return new SpringContextHolder(); + } + + @AnonymousGetMapping("/") + public String index(){ + return "Api Service Started Successfully"; + } +} diff --git a/system/src/main/resources/application-dev.yml b/system/src/main/resources/application-dev.yml new file mode 100644 index 0000000..55ac3f8 --- /dev/null +++ b/system/src/main/resources/application-dev.yml @@ -0,0 +1,47 @@ +spring: + datasource: + druid: + db-type: com.alibaba.druid.pool.DruidDataSource + driver-class-name: net.sf.log4jdbc.sql.jdbcapi.DriverSpy + url: jdbc:log4jdbc:mysql://${DB_HOST:192.168.99.207}:${DB_PORT:3306}/${DB_NAME:yxk_storeroom}?serverTimezone=Asia/Shanghai&characterEncoding=utf-8&useSSL=false + username: ${DB_USER:root} + password: ${DB_PWD:ftzn83560792} + # 初始连接数 + initial-size: 5 + # 最小连接数 + min-idle: 10 + # 最大连接数 + max-active: 20 + # 获取连接超时时间 + max-wait: 5000 + # 连接有效性检测时间 + time-between-eviction-runs-millis: 60000 + # 连接在池中最小生存的时间 + min-evictable-idle-time-millis: 300000 + # 连接在池中最大生存的时间 + max-evictable-idle-time-millis: 900000 + test-while-idle: true + test-on-borrow: false + test-on-return: false + useGlobalDataSourceStat: true + # 检测连接是否有效 + validation-query: select 1 + # 配置监控统计 + webStatFilter: + enabled: true + stat-view-servlet: + enabled: true + url-pattern: /druid/* + reset-enable: false + login-username: admin + login-password: 123456 + filter: + stat: + enabled: true + # 记录慢SQL + log-slow-sql: true + slow-sql-millis: 1000 + merge-sql: true + wall: + config: + multi-statement-allow: true diff --git a/system/src/main/resources/application-prod.yml b/system/src/main/resources/application-prod.yml new file mode 100644 index 0000000..e69de29 diff --git a/system/src/main/resources/application.yml b/system/src/main/resources/application.yml new file mode 100644 index 0000000..13ce4eb --- /dev/null +++ b/system/src/main/resources/application.yml @@ -0,0 +1,51 @@ +server: + port: 7070 + + +spring: + freemarker: + check-template-location: false + profiles: + active: dev + jackson: + time-zone: GMT+8 + data: + redis: + repositories: + enabled: false + main: + allow-bean-definition-overriding: true + + #配置 Jpa + jpa: + properties: + hibernate: + ddl-auto: none + open-in-view: true + + redis: + #数据库索引 + database: ${REDIS_DB:0} + host: ${REDIS_HOST:192.168.99.207} + port: ${REDIS_PORT:6379} + password: ${REDIS_PWD:ftzn83560792} + #连接超时时间 + timeout: 5000 + +task: + pool: + # 核心线程池大小 + core-pool-size: 10 + # 最大线程数 + max-pool-size: 30 + # 活跃时间 + keep-alive-seconds: 60 + # 队列容量 + queue-capacity: 50 + +code: + expriration: 300 + + #密码加密传输 此处为私钥 +rsa: + private_key: MIICWwIBAAKBgQDyhGeZ23kNfDysndtEMHQgX+3YcKPNny2YFtlfvYTpHmVClbaiZK+g2VetX/mhkiSQtyp5OwSy+dm6WVX7QOvUO7iPNs2Hl+33d6rzzMhROs46rCTBpukgdaT0N6SC8NWkBF9ogoDzhEGNKIV0AGHRPWmL75ghflUPD2VflmAnywIDAQABAoGAPL47MMdPD7ihfd7gD7lPLNi6Oy8jaBpJkkGO2rMeekFZvY7AOvabIt+tXUifvv9a10B5i/njWGzKQymjJpaBOp+JswuBKEq8ZFqeyQJWsrj1zJC+HaCImP1frvgdtWIu1tldVE44X7jIQSFAd26JJsPslMntj/iE7VBkzQRYhjkCQQD/3+zu4OJP5XdSq4Y+HzIJ7u2JS8u/SxRQYQh1E6/yydgyWE96cze4jZQQTvxBRsOrXvBlVJdT+QmcV0YnlyMtAkEA8qLOBevOgH5qq1nLRMYU6zb0k5OiAaiI+Oq1mZn0kjcisyFZopAs2FH07DVlh+tzbGdzt4Q3PjLSEqhVFU4x1wJARljoKRzG27R4w8/IjpfBCB4aTF78W1Fm+lpTGu0YuKVpvR2ubDn1HdY+2OT+UWwFK75kVVeWa03SqJsN/KB+2QJAKD9XO2Y1F91gZlH7xMmyuJ2iDkTD79B8AAY232bJSeO5bstOagfOWIenv/LPh69Hsyip6jwVScz2ScAAdQtGewJACeSyLWjPnQ4ZgWrJyz6dyPgGKprDzQ00UMlvH3F2KJ9Ll99yfBah++GQXPfzjhD2ouWAQ+GaiS/RdSNDX1RoFg==