Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
Akiyama-Mio-a committed Dec 11, 2023
2 parents 55b620b + 45b3af6 commit 3428e3d
Show file tree
Hide file tree
Showing 143 changed files with 4,735 additions and 1,640 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: ci

on: [push, pull_request]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'
cache: 'maven'
- name: Maven build
run: ./mvnw -Dmaven.test.skip=true clean package
- uses: actions/upload-artifact@v3
with:
name: app
path: |
target/*.jar
deploy:
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v3
with:
name: app
- name: Rename jar
run: mv -v *.jar app.jar
- name: Deploy
uses: easingthemes/ssh-deploy@main
with:
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
REMOTE_HOST: ${{ secrets.REMOTE_HOST }}
REMOTE_USER: evento
SOURCE: app.jar
TARGET: /
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ target/
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**/target/
!**/src/test/**/target/
!src/main/resources/application.yaml

### STS ###
.apt_generated
Expand Down Expand Up @@ -33,3 +34,6 @@ build/

### VS Code ###
.vscode/

# GitHub
!.github/**/*
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
![sast evento](https://github.com/feellmoose/img/blob/main/output.png?raw=true)
![sast evento](https://sast-evento-1309205610.cos.ap-shanghai.myqcloud.com/output_1691069571550)

SAST Evento is an Event Management and Viewing System helps ministers and lecturers to carry out daily events more smoothly.
Binary file added lib/SastLink-Java-SDK-0.0.1.jar
Binary file not shown.
Empty file modified mvnw
100644 → 100755
Empty file.
220 changes: 109 additions & 111 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,126 +1,124 @@
<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.1.1</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>sast.evento</groupId>
<artifactId>SAST-Evento</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>SAST-Evento-Backend</name>
<description>SAST-Evento-Backend</description>
<properties>
<java.version>17</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-aop</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-cache</artifactId>
</dependency>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.1.1</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>sast.evento</groupId>
<artifactId>SAST-Evento</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>SAST-Evento-Backend</name>
<description>SAST-Evento-Backend</description>
<properties>
<java.version>17</java.version>
</properties>
<dependencies>
<dependency>
<groupId>link.sast</groupId>
<artifactId>SastLink-Java-SDK</artifactId>
<type>jar</type>
<version>0.0.1</version>
<scope>system</scope>
<systemPath>${pom.basedir}/lib/SastLink-Java-SDK-0.0.1.jar</systemPath>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-aop</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-cache</artifactId>
</dependency>

<!-- quartz -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-quartz</artifactId>
</dependency>
<!-- quartz -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-quartz</artifactId>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
<version>3.5.3.1</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.33</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
<version>3.5.3.1</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.33</version>
</dependency>

<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>

<!-- jwt -->
<dependency>
<groupId>com.auth0</groupId>
<artifactId>java-jwt</artifactId>
<version>3.4.0</version>
</dependency>
<!-- jwt -->
<dependency>
<groupId>com.auth0</groupId>
<artifactId>java-jwt</artifactId>
<version>3.4.0</version>
</dependency>

<!-- zxing -->
<dependency>
<groupId>com.google.zxing</groupId>
<artifactId>core</artifactId>
<version>3.3.3</version>
</dependency>
<dependency>
<groupId>com.google.zxing</groupId>
<artifactId>javase</artifactId>
<version>3.3.3</version>
</dependency>

<!-- cos_sdk-->
<dependency>
<groupId>com.qcloud</groupId>
<artifactId>cos_api</artifactId>
<version>5.6.155</version>
</dependency>
<!-- cos_sdk-->
<dependency>
<groupId>com.qcloud</groupId>
<artifactId>cos_api</artifactId>
<version>5.6.155</version>
</dependency>


</dependencies>
</dependencies>

<repositories>
<repository>
<id>alimaven</id>
<url>https://maven.aliyun.com/repository/public</url>
</repository>
</repositories>
<repositories>
<repository>
<id>alimaven</id>
<url>https://maven.aliyun.com/repository/public</url>
</repository>
</repositories>

<pluginRepositories>
<pluginRepository>
<id>alimaven</id>
<url>https://maven.aliyun.com/repository/public</url>
</pluginRepository>
</pluginRepositories>
<pluginRepositories>
<pluginRepository>
<id>alimaven</id>
<url>https://maven.aliyun.com/repository/public</url>
</pluginRepository>
</pluginRepositories>

<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<excludes>
<exclude>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</build>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<excludes>
<exclude>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</exclude>
</excludes>
<includeSystemScope>true</includeSystemScope>
</configuration>
</plugin>
</plugins>
</build>

</project>
6 changes: 3 additions & 3 deletions src/main/java/sast/evento/SastEventoBackendApplication.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
@SpringBootApplication
@MapperScan("sast.evento.mapper")
public class SastEventoBackendApplication {
public static void main(String[] args) {
SpringApplication.run(SastEventoBackendApplication.class, args);
}
public static void main(String[] args) {
SpringApplication.run(SastEventoBackendApplication.class, args);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@
public @interface DefaultActionState {
/* 添加注释后,默认为管理员操作 */
ActionState value() default ActionState.ADMIN;
String group() default "default";
}
1 change: 1 addition & 0 deletions src/main/java/sast/evento/annotation/OperateLog.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
public @interface OperateLog {
@AliasFor(attribute = "description")
String value() default "";

@AliasFor(attribute = "value")
String description() default "";
}
58 changes: 29 additions & 29 deletions src/main/java/sast/evento/aop/OperateLogAspect.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@ public void operateLog() {
}

@Around("operateLog() && @annotation(anno)")
public Object aroundMethod(ProceedingJoinPoint proceedingPoint,OperateLog anno) throws Throwable {
Optional.ofNullable(LogInterceptor.logHolder.get()).ifPresent(
traceLog -> log.info(traceLog
.setDescription(anno.value())
.setFinishTime(System.currentTimeMillis())
.toLogFormat(true))
);
public Object aroundMethod(ProceedingJoinPoint proceedingPoint, OperateLog anno) throws Throwable {
Optional.ofNullable(LogInterceptor.logHolder.get()).ifPresent(
traceLog -> log.info(traceLog
.setDescription(anno.value())
.setFinishTime(System.currentTimeMillis())
.toLogFormat(true))
);
return proceedingPoint.proceed();
}

Expand All @@ -70,28 +70,28 @@ public void throwHandler(JoinPoint joinPoint, OperateLog anno, Throwable excepti
// 拿到需要的stackTrace,只拿以下两种 stackTrace
// 注入的bean和controller方法
List<StackTraceElement> stackTraceList = Arrays.stream(stackTrace).filter(ele -> {
if (eleMethodName.equals(ele.getMethodName()) && typeName.equals(ele.getClassName()))
return true;
if (ele.getFileName() != null)
return classSet.stream().anyMatch(ele.getFileName()::contains);
return false;
}
if (eleMethodName.equals(ele.getMethodName()) && typeName.equals(ele.getClassName()))
return true;
if (ele.getFileName() != null)
return classSet.stream().anyMatch(ele.getFileName()::contains);
return false;
}
).toList();
// 格式处理
ArrayList<String> errMsg = new ArrayList<>();
for (StackTraceElement ele : stackTraceList) {
String fileName = ele.getFileName();
String methodName = ele.getMethodName();
int lineNumber = ele.getLineNumber();
String errTrace = fileName + " | " + methodName + " | line:" + lineNumber + " | " + exception.getLocalizedMessage();
errMsg.add(errTrace);
}
Optional.ofNullable(LogInterceptor.logHolder.get()).ifPresent(
traceLog -> log.error(traceLog
.setDescription(anno.value())
.setFinishTime(System.currentTimeMillis())
.setStackTrace(StringUtils.collectionToCommaDelimitedString(errMsg))
.toLogFormat(false))
);
// 格式处理
ArrayList<String> errMsg = new ArrayList<>();
for (StackTraceElement ele : stackTraceList) {
String fileName = ele.getFileName();
String methodName = ele.getMethodName();
int lineNumber = ele.getLineNumber();
String errTrace = fileName + " | " + methodName + " | line:" + lineNumber + " | " + exception.getLocalizedMessage();
errMsg.add(errTrace);
}
Optional.ofNullable(LogInterceptor.logHolder.get()).ifPresent(
traceLog -> log.error(traceLog
.setDescription(anno.value())
.setFinishTime(System.currentTimeMillis())
.setStackTrace(StringUtils.collectionToCommaDelimitedString(errMsg))
.toLogFormat(false))
);
}
}
Loading

0 comments on commit 3428e3d

Please sign in to comment.