diff --git a/pom.xml b/pom.xml
index 6391d0c..54b97a8 100644
--- a/pom.xml
+++ b/pom.xml
@@ -5,8 +5,8 @@
org.springframework.boot
spring-boot-starter-parent
- 3.1.1
-
+ 3.3.0
+
sast.evento
SAST-Evento
@@ -14,55 +14,52 @@
SAST-Evento-Backend
SAST-Evento-Backend
- 17
+ 21
+
- org.springframework.boot
- spring-boot-starter-web
+ fun.feellmoose
+ sast-link-SDK
+ 0.1.2
+
- org.springframework.boot
- spring-boot-starter-aop
+ com.auth0
+ java-jwt
+ 3.4.0
+
- org.springframework.boot
- spring-boot-starter-cache
+ com.baomidou
+ mybatis-plus-boot-starter
+ 3.5.3.1
-
-
+
- fun.feellmoose
- sast-link-SDK
- 0.1.2
+ org.mybatis
+ mybatis-spring
+ 3.0.3
-
-
+
- org.springframework.boot
- spring-boot-starter-quartz
+ com.qcloud
+ cos_api
+ 5.6.213
org.springframework.boot
- spring-boot-starter-test
- test
+ spring-boot-starter-web
-
org.springframework.boot
- spring-boot-starter-data-redis
-
-
- com.baomidou
- mybatis-plus-boot-starter
- 3.5.3.1
+ spring-boot-starter-cache
- mysql
- mysql-connector-java
- 8.0.33
+ org.springframework.boot
+ spring-boot-starter-data-redis
@@ -70,39 +67,20 @@
lombok
true
-
-
- com.auth0
- java-jwt
- 3.4.0
+ com.mysql
+ mysql-connector-j
+ runtime
-
-
- com.qcloud
- cos_api
- 5.6.155
+ org.springframework.boot
+ spring-boot-starter-test
+ test
-
-
-
- alimaven
- https://maven.aliyun.com/repository/public
-
-
-
-
-
- alimaven
- https://maven.aliyun.com/repository/public
-
-
-
diff --git a/src/main/java/sast/evento/annotation/DefaultActionState.java b/src/main/java/sast/evento/annotation/DefaultActionState.java
index d3b9d6a..fe3319e 100644
--- a/src/main/java/sast/evento/annotation/DefaultActionState.java
+++ b/src/main/java/sast/evento/annotation/DefaultActionState.java
@@ -7,10 +7,13 @@
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
+/**
+ * Require Authorization.
+ * Default action state of an event.
+ */
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
public @interface DefaultActionState {
- /* 添加注释后,默认为管理员操作 */
ActionState value() default ActionState.ADMIN;
String group() default "default";
}
diff --git a/src/main/java/sast/evento/annotation/EventId.java b/src/main/java/sast/evento/annotation/EventId.java
index 2a38b90..0bdef9d 100644
--- a/src/main/java/sast/evento/annotation/EventId.java
+++ b/src/main/java/sast/evento/annotation/EventId.java
@@ -4,6 +4,10 @@
import java.lang.annotation.*;
+/**
+ * Require Authorization.
+ * Description which param is needed for event check.
+ */
@Target({ElementType.PARAMETER})
@Retention(RetentionPolicy.RUNTIME)
@Documented
diff --git a/src/main/java/sast/evento/annotation/OperateLog.java b/src/main/java/sast/evento/annotation/Operation.java
similarity index 86%
rename from src/main/java/sast/evento/annotation/OperateLog.java
rename to src/main/java/sast/evento/annotation/Operation.java
index 27eb991..5c98844 100644
--- a/src/main/java/sast/evento/annotation/OperateLog.java
+++ b/src/main/java/sast/evento/annotation/Operation.java
@@ -8,12 +8,11 @@
import java.lang.annotation.Target;
/**
- * @author: NicoAsuka
- * @date: 4/29/23
+ * Describe operation of API.
*/
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
-public @interface OperateLog {
+public @interface Operation {
@AliasFor(attribute = "description")
String value() default "";
diff --git a/src/main/java/sast/evento/aop/OperateLogAspect.java b/src/main/java/sast/evento/aop/OperateLogAspect.java
deleted file mode 100644
index 203b02e..0000000
--- a/src/main/java/sast/evento/aop/OperateLogAspect.java
+++ /dev/null
@@ -1,97 +0,0 @@
-package sast.evento.aop;
-
-import jakarta.annotation.Resource;
-import lombok.extern.slf4j.Slf4j;
-import org.aspectj.lang.JoinPoint;
-import org.aspectj.lang.ProceedingJoinPoint;
-import org.aspectj.lang.Signature;
-import org.aspectj.lang.annotation.AfterThrowing;
-import org.aspectj.lang.annotation.Around;
-import org.aspectj.lang.annotation.Aspect;
-import org.aspectj.lang.annotation.Pointcut;
-import org.aspectj.lang.reflect.MethodSignature;
-import org.springframework.stereotype.Component;
-import org.springframework.util.StringUtils;
-import sast.evento.annotation.OperateLog;
-import sast.evento.interceptor.LogInterceptor;
-
-import java.lang.reflect.Field;
-import java.util.*;
-
-/**
- * @author: NicoAsuka
- * @date: 4/29/23
- */
-@Aspect
-@Component
-@Slf4j
-public class OperateLogAspect {
- private final static Set EXCLUDE_SET;
-
- static {
- EXCLUDE_SET = new HashSet<>();
- EXCLUDE_SET.add("password");
- }
-
- @Pointcut("@annotation(sast.evento.annotation.OperateLog)")
- 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))
- );
- return proceedingPoint.proceed();
- }
-
-
- @AfterThrowing(pointcut = "operateLog()&&@annotation(anno)", throwing = "exception")
- public void throwHandler(JoinPoint joinPoint, OperateLog anno, Throwable exception) {
- Signature sg = joinPoint.getSignature();
- Field[] declaredFields1 = sg.getDeclaringType().getDeclaredFields();
- // 获取当前抛出异常类使用@Resource注入的bean
- List classList = Arrays.stream(declaredFields1)
- .filter(field -> field.getAnnotation(Resource.class) != null)
- .map(Field::getType)
- .map(Class::getSimpleName).toList();
- HashSet classSet = new HashSet<>(classList);
-
- MethodSignature signature = (MethodSignature) joinPoint.getSignature();
- // 获取当前抛出异常的方法名称和类
- String eleMethodName = signature.getMethod().getName();
- String typeName = signature.getDeclaringTypeName();
-
- // 获取抛出异常的stackTrace
- StackTraceElement[] stackTrace = exception.getStackTrace();
- // 拿到需要的stackTrace,只拿以下两种 stackTrace
- // 注入的bean和controller方法
- List 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;
- }
- ).toList();
- // 格式处理
- ArrayList 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))
- );
- }
-}
diff --git a/src/main/java/sast/evento/common/Constants.java b/src/main/java/sast/evento/common/Constants.java
new file mode 100644
index 0000000..c4dbf9d
--- /dev/null
+++ b/src/main/java/sast/evento/common/Constants.java
@@ -0,0 +1,8 @@
+package sast.evento.common;
+
+/**
+ * Constants
+ */
+public interface Constants {
+
+}
diff --git a/src/main/java/sast/evento/common/constant/Constant.java b/src/main/java/sast/evento/common/constant/Constant.java
deleted file mode 100644
index 9e30007..0000000
--- a/src/main/java/sast/evento/common/constant/Constant.java
+++ /dev/null
@@ -1,14 +0,0 @@
-package sast.evento.common.constant;
-
-/**
- * @projectName: sast-evento-backend
- * @author: feelMoose
- * @date: 2023/7/31 21:53
- */
-// todo 待删除
-public class Constant {
- public static final String wxStableTokenURL = "https://api.weixin.qq.com/cgi-bin/stable_token";
- public static final String wxSubscribeURL = "https://api.weixin.qq.com/cgi-bin/message/subscribe/send?access_token={access_token}";
-
-
-}
diff --git a/src/main/java/sast/evento/common/enums/ErrorEnum.java b/src/main/java/sast/evento/common/enums/ErrorEnum.java
index 80f4f8c..c71ccc5 100644
--- a/src/main/java/sast/evento/common/enums/ErrorEnum.java
+++ b/src/main/java/sast/evento/common/enums/ErrorEnum.java
@@ -4,9 +4,7 @@
import lombok.Getter;
/**
- * @projectName: sast-evento-backend
- * @author: feelMoose
- * @date: 2023/7/12 22:04
+ * Error enum hold errMsg to FrontEnd
*/
@Getter
@AllArgsConstructor
diff --git a/src/main/java/sast/evento/common/enums/EventState.java b/src/main/java/sast/evento/common/enums/EventState.java
index da7119a..8fad601 100644
--- a/src/main/java/sast/evento/common/enums/EventState.java
+++ b/src/main/java/sast/evento/common/enums/EventState.java
@@ -1,6 +1,8 @@
package sast.evento.common.enums;
+import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonValue;
+import sast.evento.annotation.EventId;
import sast.evento.exception.LocalRunTimeException;
import java.util.Arrays;
@@ -11,6 +13,8 @@ public enum EventState {
IN_PROGRESS(3, "进行中"),
CANCELED(4, "已取消"),
ENDED(5, "已结束");
+
+ @EnumValue
private final Integer state;
private final String description;
diff --git a/src/main/java/sast/evento/common/enums/Platform.java b/src/main/java/sast/evento/common/enums/Platform.java
deleted file mode 100644
index 121e5d0..0000000
--- a/src/main/java/sast/evento/common/enums/Platform.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package sast.evento.common.enums;
-
-public enum Platform {
- WeChat,
- SastLink,
-
-}
diff --git a/src/main/java/sast/evento/common/typehandler/EventStateTypeHandler.java b/src/main/java/sast/evento/common/typehandler/EventStateTypeHandler.java
deleted file mode 100644
index 8d66239..0000000
--- a/src/main/java/sast/evento/common/typehandler/EventStateTypeHandler.java
+++ /dev/null
@@ -1,37 +0,0 @@
-package sast.evento.common.typehandler;
-
-import org.apache.ibatis.type.BaseTypeHandler;
-import org.apache.ibatis.type.JdbcType;
-import sast.evento.common.enums.EventState;
-
-import java.sql.CallableStatement;
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-
-/**
- * @projectName: sast-evento-backend
- * @author: feelMoose
- * @date: 2023/7/24 20:53
- */
-public class EventStateTypeHandler extends BaseTypeHandler {
- @Override
- public void setNonNullParameter(PreparedStatement preparedStatement, int i, EventState eventState, JdbcType jdbcType) throws SQLException {
- preparedStatement.setInt(i, eventState.getState());
- }
-
- @Override
- public EventState getNullableResult(ResultSet resultSet, String s) throws SQLException {
- return EventState.getEventState(resultSet.getInt(s));
- }
-
- @Override
- public EventState getNullableResult(ResultSet resultSet, int i) throws SQLException {
- return EventState.getEventState(resultSet.getInt(i));
- }
-
- @Override
- public EventState getNullableResult(CallableStatement callableStatement, int i) throws SQLException {
- return EventState.getEventState(callableStatement.getInt(i));
- }
-}
diff --git a/src/main/java/sast/evento/common/typehandler/FeedbackScoreTypeHandler.java b/src/main/java/sast/evento/common/typehandler/FeedbackScoreTypeHandler.java
index b3b5358..e02f6d2 100644
--- a/src/main/java/sast/evento/common/typehandler/FeedbackScoreTypeHandler.java
+++ b/src/main/java/sast/evento/common/typehandler/FeedbackScoreTypeHandler.java
@@ -9,10 +9,12 @@
import java.sql.SQLException;
/**
- * @author Aiden
- * @date 2023/12/31 14:50
+ * Type convertor for mybatis-plus
*/
public class FeedbackScoreTypeHandler extends BaseTypeHandler {
+
+ //TODO logic should not be here
+
@Override
public void setNonNullParameter(PreparedStatement preparedStatement, int i, Double aDouble, JdbcType jdbcType) throws SQLException {
preparedStatement.setDouble(i, aDouble * 10);
diff --git a/src/main/java/sast/evento/common/typehandler/OrganizationTypeHandler.java b/src/main/java/sast/evento/common/typehandler/OrganizationTypeHandler.java
index ec72730..c74ec9c 100644
--- a/src/main/java/sast/evento/common/typehandler/OrganizationTypeHandler.java
+++ b/src/main/java/sast/evento/common/typehandler/OrganizationTypeHandler.java
@@ -9,6 +9,10 @@
import java.sql.ResultSet;
import java.sql.SQLException;
+
+/**
+ * Type convertor for mybatis-plus
+ */
public class OrganizationTypeHandler extends BaseTypeHandler {
@Override
diff --git a/src/main/java/sast/evento/config/ActionRegister.java b/src/main/java/sast/evento/config/ActionRegister.java
index 8f40d25..2b36c51 100644
--- a/src/main/java/sast/evento/config/ActionRegister.java
+++ b/src/main/java/sast/evento/config/ActionRegister.java
@@ -13,7 +13,7 @@
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import sast.evento.annotation.DefaultActionState;
-import sast.evento.annotation.OperateLog;
+import sast.evento.annotation.Operation;
import sast.evento.common.enums.ErrorEnum;
import sast.evento.exception.LocalRunTimeException;
import sast.evento.model.Action;
@@ -50,7 +50,7 @@ public void run(String... args) {
for (Class c : set) {
Method[] declaredMethods = c.getDeclaredMethods();
for (Method m : declaredMethods) {
- OperateLog ano = AnnotatedElementUtils.findMergedAnnotation(m, OperateLog.class);
+ Operation ano = AnnotatedElementUtils.findMergedAnnotation(m, Operation.class);
RequestMapping r = AnnotatedElementUtils.findMergedAnnotation(m, RequestMapping.class);
DefaultActionState d = AnnotatedElementUtils.findMergedAnnotation(m, DefaultActionState.class);
if (r == null) {
diff --git a/src/main/java/sast/evento/config/InterceptorConfig.java b/src/main/java/sast/evento/config/InterceptorConfig.java
index 76c108b..e5a4a7b 100644
--- a/src/main/java/sast/evento/config/InterceptorConfig.java
+++ b/src/main/java/sast/evento/config/InterceptorConfig.java
@@ -5,7 +5,6 @@
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import sast.evento.interceptor.HttpInterceptor;
-import sast.evento.interceptor.LogInterceptor;
/**
* @author: NicoAsuka
@@ -13,8 +12,7 @@
*/
@Configuration
public class InterceptorConfig implements WebMvcConfigurer {
- @Resource
- private LogInterceptor logInterceptor;
+
@Resource
private HttpInterceptor httpInterceptor;
@@ -22,8 +20,6 @@ public class InterceptorConfig implements WebMvcConfigurer {
public void addInterceptors(InterceptorRegistry registry) {
registry.addInterceptor(httpInterceptor)
.addPathPatterns("/**");
- registry.addInterceptor(logInterceptor)
- .addPathPatterns("/**");
}
diff --git a/src/main/java/sast/evento/config/QuartzConfig.java b/src/main/java/sast/evento/config/QuartzConfig.java
deleted file mode 100644
index 72f9900..0000000
--- a/src/main/java/sast/evento/config/QuartzConfig.java
+++ /dev/null
@@ -1,60 +0,0 @@
-package sast.evento.config;
-
-import com.zaxxer.hikari.HikariDataSource;
-import org.quartz.impl.StdSchedulerFactory;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
-import org.springframework.boot.autoconfigure.jdbc.DataSourceProperties;
-import org.springframework.boot.autoconfigure.quartz.JobStoreType;
-import org.springframework.boot.autoconfigure.quartz.QuartzProperties;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.jdbc.datasource.DataSourceTransactionManager;
-import org.springframework.scheduling.quartz.SchedulerFactoryBean;
-
-import java.util.Properties;
-
-@Configuration
-public class QuartzConfig {
-
- @Value("${spring.quartz.datasource.url}")
- private String url;
- @Value("${spring.quartz.datasource.username}")
- private String username;
- @Value("${spring.quartz.datasource.password}")
- private String password;
- @Value("${spring.quartz.datasource.driver-class-name}")
- private String driverClassName;
- @Value("${spring.quartz.datasource.name}")
- private String name;
-
- @Bean(name = "schedulerFactoryBean")
- public SchedulerFactoryBean schedulerFactoryBean() {
- SchedulerFactoryBean schedulerFactoryBean = new SchedulerFactoryBean();
- schedulerFactoryBean.setDataSource(quartzDataSource());
- schedulerFactoryBean.setTransactionManager(quartzDataSourceTransactionManager());
- schedulerFactoryBean.setAutoStartup(true);
- schedulerFactoryBean.setSchedulerName("quartzScheduler");
- schedulerFactoryBean.setSchedulerFactoryClass(StdSchedulerFactory.class);
- schedulerFactoryBean.setOverwriteExistingJobs(true);
- schedulerFactoryBean.setExposeSchedulerInRepository(true);
- return schedulerFactoryBean;
- }
-
- private HikariDataSource quartzDataSource() {
- DataSourceProperties dataSourceProperties = new DataSourceProperties();
- dataSourceProperties.setUrl(url);
- dataSourceProperties.setUsername(username);
- dataSourceProperties.setPassword(password);
- dataSourceProperties.setDriverClassName(driverClassName);
- dataSourceProperties.setName(name);
- return dataSourceProperties.initializeDataSourceBuilder()
- .type(HikariDataSource.class)
- .build();
- }
-
- private DataSourceTransactionManager quartzDataSourceTransactionManager() {
- return new DataSourceTransactionManager(quartzDataSource());
- }
-
-}
diff --git a/src/main/java/sast/evento/controller/AdminController.java b/src/main/java/sast/evento/controller/AdminController.java
index 6fc4329..8fcfb85 100644
--- a/src/main/java/sast/evento/controller/AdminController.java
+++ b/src/main/java/sast/evento/controller/AdminController.java
@@ -3,7 +3,7 @@
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.*;
import sast.evento.annotation.DefaultActionState;
-import sast.evento.annotation.OperateLog;
+import sast.evento.annotation.Operation;
import sast.evento.common.enums.ActionState;
import sast.evento.common.enums.ErrorEnum;
import sast.evento.entitiy.Department;
@@ -19,62 +19,66 @@
@RestController
@RequestMapping("/admin")
-public class AdminController {
+class AdminController {
@Resource
- private EventTypeService eventTypeService;
+ EventTypeService eventTypeService;
@Resource
- private LocationService locationService;
+ LocationService locationService;
@Resource
- private DepartmentService departmentService;
+ DepartmentService departmentService;
/**
* 添加活动地点
+ *
* @param location 活动地点
* @return 活动地点id
*/
- @OperateLog("添加活动地点")
- @DefaultActionState(value = ActionState.ADMIN,group = "location")
+ @Operation("添加活动地点")
+ @DefaultActionState(value = ActionState.ADMIN, group = "location")
@PostMapping("/location")
- public String addLocation(@RequestBody Location location) {
+ String addLocation(@RequestBody Location location) {
if (location.getId() != null) throw new LocalRunTimeException(ErrorEnum.PARAM_ERROR, "id should be null.");
return locationService.addLocation(location).toString();
}
/**
* 删除活动地点
+ *
* @param locationId 活动地点id
* @return 是否成功
*/
- @OperateLog("删除活动地点")
- @DefaultActionState(value = ActionState.ADMIN,group = "location")
+ @Operation("删除活动地点")
+ @DefaultActionState(value = ActionState.ADMIN, group = "location")
@DeleteMapping("/location")
- public String deleteLocation(@RequestParam Integer locationId) {
+ String deleteLocation(@RequestParam Integer locationId) {
return locationService.deleteLocation(locationId).toString();
}
/**
* 获取活动地点
+ *
* @return 活动地点列表
*/
- @OperateLog("获取活动地点")
- @DefaultActionState(value = ActionState.ADMIN,group = "location")
+ @Operation("获取活动地点")
+ @DefaultActionState(value = ActionState.ADMIN, group = "location")
@GetMapping("/locations")
- public List getLocations() {
+ List getLocations() {
/* 以树状结构返回 */
return locationService.getLocations();
}
/**
* 修改活动地点
+ *
* @param locationId 活动地点id
- * @param location 活动地点
+ * @param location 活动地点
* @return 是否成功
*/
- @OperateLog("修改活动地点")
+ @Operation("修改活动地点")
@DefaultActionState(ActionState.INVISIBLE)
@PutMapping("/location")
- public String updateLocation(@RequestParam Integer locationId,
- @RequestBody Location location) {
+ String updateLocation(@RequestParam Integer locationId,
+ @RequestBody Location location) {
if (!location.getId().equals(locationId)) throw new LocalRunTimeException(ErrorEnum.PARAM_ERROR, "invalid id");
/* 比较复杂,谨慎修改 */
return locationService.updateLocation(location).toString();
@@ -88,92 +92,96 @@ public String updateLocation(@RequestParam Integer locationId,
* @param locationName 活动名称
* @return ok
*/
- @OperateLog("修改活动地点名称")
- @DefaultActionState(value = ActionState.ADMIN,group = "location")
+ @Operation("修改活动地点名称")
+ @DefaultActionState(value = ActionState.ADMIN, group = "location")
@PatchMapping("/location")
- public String updateLocationName(@RequestParam Integer id,
- @RequestParam String locationName) {
+ String updateLocationName(@RequestParam Integer id,
+ @RequestParam String locationName) {
locationService.updateLocationName(id, locationName);
return "ok";
}
/**
* 添加活动类型
+ *
* @param type 活动类型
* @return 活动类型id
*/
- @OperateLog("添加活动类型")
- @DefaultActionState(value = ActionState.ADMIN,group = "type")
+ @Operation("添加活动类型")
+ @DefaultActionState(value = ActionState.ADMIN, group = "type")
@PostMapping("/type")
- public String addType(@RequestBody EventType type) {
+ String addType(@RequestBody EventType type) {
if (type.getId() != null) throw new LocalRunTimeException(ErrorEnum.PARAM_ERROR, "id should be null");
return eventTypeService.addEventType(type).toString();
}
/**
* 删除活动类型
+ *
* @param typeId 活动类型id
* @return 是否成功
*/
- @OperateLog("删除活动类型")
- @DefaultActionState(value = ActionState.ADMIN,group = "type")
+ @Operation("删除活动类型")
+ @DefaultActionState(value = ActionState.ADMIN, group = "type")
@DeleteMapping("/type")
- public String deleteType(@RequestParam Integer typeId) {
+ String deleteType(@RequestParam Integer typeId) {
return eventTypeService.deleteEventType(typeId).toString();
}
/**
* 获取活动类型
+ *
* @return 活动类型列表
*/
- @OperateLog("获取活动类型")
- @DefaultActionState(value = ActionState.ADMIN,group = "type")
+ @Operation("获取活动类型")
+ @DefaultActionState(value = ActionState.ADMIN, group = "type")
@GetMapping("/types")
- public List getTypes() {
+ List getTypes() {
return eventTypeService.getAllEventType();
}
/**
* 修改活动类型
+ *
* @param type 活动类型
* @return 是否成功
*/
- @OperateLog("修改活动类型")
- @DefaultActionState(value = ActionState.ADMIN,group = "type")
+ @Operation("修改活动类型")
+ @DefaultActionState(value = ActionState.ADMIN, group = "type")
@PutMapping("/type")
- public String updateType(@RequestBody EventType type) {
+ String updateType(@RequestBody EventType type) {
if (type == null || type.getId() == null) throw new LocalRunTimeException(ErrorEnum.PARAM_ERROR);
return eventTypeService.editEventType(type).toString();
}
- @OperateLog("添加组织部门")
- @DefaultActionState(value = ActionState.ADMIN,group = "department")
+ @Operation("添加组织部门")
+ @DefaultActionState(value = ActionState.ADMIN, group = "department")
@PostMapping("/department")
- public Integer addDepartment(@RequestParam String departmentName){
+ Integer addDepartment(@RequestParam String departmentName) {
return departmentService.addDepartment(departmentName);
}
- @OperateLog("删除部门")
- @DefaultActionState(value = ActionState.ADMIN,group = "department")
+ @Operation("删除部门")
+ @DefaultActionState(value = ActionState.ADMIN, group = "department")
@DeleteMapping("/department")
- public String deleteDepartment(@RequestParam Integer departmentId){
+ String deleteDepartment(@RequestParam Integer departmentId) {
departmentService.deleteDepartment(departmentId);
return "ok";
}
- @OperateLog("获取全部组织部门")
- @DefaultActionState(value = ActionState.ADMIN,group = "department")
+ @Operation("获取全部组织部门")
+ @DefaultActionState(value = ActionState.ADMIN, group = "department")
@GetMapping("/departments")
- public List getDepartments(){
+ List getDepartments() {
return departmentService.getDepartments();
}
- @OperateLog("修改组织部门名称")
- @DefaultActionState(value = ActionState.ADMIN,group = "department")
+ @Operation("修改组织部门名称")
+ @DefaultActionState(value = ActionState.ADMIN, group = "department")
@PutMapping("/department")
- public void putDepartment(@RequestParam Integer departmentId,
- @RequestParam String departmentName){
- departmentService.putDepartment(departmentId,departmentName);
+ void putDepartment(@RequestParam Integer departmentId,
+ @RequestParam String departmentName) {
+ departmentService.putDepartment(departmentId, departmentName);
}
diff --git a/src/main/java/sast/evento/controller/CheckInController.java b/src/main/java/sast/evento/controller/CheckInController.java
index 67eb21b..a784f6c 100644
--- a/src/main/java/sast/evento/controller/CheckInController.java
+++ b/src/main/java/sast/evento/controller/CheckInController.java
@@ -5,10 +5,9 @@
import org.springframework.web.bind.annotation.*;
import sast.evento.annotation.DefaultActionState;
import sast.evento.annotation.EventId;
-import sast.evento.annotation.OperateLog;
+import sast.evento.annotation.Operation;
import sast.evento.common.enums.ActionState;
import sast.evento.common.enums.ErrorEnum;
-import sast.evento.entitiy.User;
import sast.evento.exception.LocalRunTimeException;
import sast.evento.interceptor.HttpInterceptor;
import sast.evento.model.UserModel;
@@ -28,7 +27,7 @@ public class CheckInController {
@Resource
private CodeService codeService;
/* 由后端生成部分信息置于二维码,userId需要前端填充 */
- @OperateLog("签到")
+ @Operation("签到")
@DefaultActionState(ActionState.LOGIN)/* 这里为public,eventId注解没什么用 */
@GetMapping("/checkIn")
@ResponseBody
@@ -42,7 +41,7 @@ public String CheckIn(@RequestParam String code) {
return participateService.participate(user.getId(),eventId,true);
}
- @OperateLog("生成活动签到二维码的验证码")
+ @Operation("生成活动签到二维码的验证码")
@DefaultActionState(ActionState.ADMIN)/* 这里为admin,eventId注解没什么用 */
@GetMapping("/authcode")
@ResponseBody
diff --git a/src/main/java/sast/evento/controller/EventController.java b/src/main/java/sast/evento/controller/EventController.java
index 3e1be90..d269d56 100644
--- a/src/main/java/sast/evento/controller/EventController.java
+++ b/src/main/java/sast/evento/controller/EventController.java
@@ -4,7 +4,7 @@
import org.springframework.web.bind.annotation.*;
import sast.evento.annotation.DefaultActionState;
import sast.evento.annotation.EventId;
-import sast.evento.annotation.OperateLog;
+import sast.evento.annotation.Operation;
import sast.evento.common.enums.ActionState;
import sast.evento.common.enums.ErrorEnum;
import sast.evento.entitiy.Department;
@@ -29,7 +29,7 @@ public class EventController {
@Resource
private DepartmentService departmentService;
- @OperateLog("查看正在进行活动列表")
+ @Operation("查看正在进行活动列表")
@DefaultActionState(ActionState.PUBLIC)
@GetMapping("/conducting")
public List getConducting() {
@@ -37,14 +37,14 @@ public List getConducting() {
}
- @OperateLog("查看最新活动列表")
+ @Operation("查看最新活动列表")
@DefaultActionState(ActionState.PUBLIC)
@GetMapping("/newest")
public List getNewest() {
return eventService.getNewest();
}
- @OperateLog("查看用户历史活动列表")
+ @Operation("查看用户历史活动列表")
@DefaultActionState(ActionState.LOGIN)
@GetMapping("/history")
public List getHistory() {
@@ -58,7 +58,7 @@ public List getHistory() {
* @param eventId 活动id
* @return 是否成功
*/
- @OperateLog("删除活动")
+ @Operation("删除活动")
@DefaultActionState(value = ActionState.MANAGER, group = "event")
@DeleteMapping("/info")
public String deleteEvent(@RequestParam @EventId Integer eventId) {
@@ -66,7 +66,7 @@ public String deleteEvent(@RequestParam @EventId Integer eventId) {
}
- @OperateLog("获取活动详情")
+ @Operation("获取活动详情")
@DefaultActionState(ActionState.PUBLIC)/* 这里为public,eventId注解没什么用 */
@GetMapping("/info")
public EventModel getEvent(@RequestParam @EventId Integer eventId) {
@@ -80,7 +80,7 @@ public EventModel getEvent(@RequestParam @EventId Integer eventId) {
* @param event 活动信息
* @return 是否成功
*/
- @OperateLog("取消活动")
+ @Operation("取消活动")
@DefaultActionState(value = ActionState.MANAGER, group = "event")
@PatchMapping("/info")
public String cancelEvent(@RequestParam @EventId Integer eventId,
@@ -95,7 +95,7 @@ public String cancelEvent(@RequestParam @EventId Integer eventId,
* @param eventModel 活动信息
* @return 活动id
*/
- @OperateLog("发起活动")
+ @Operation("发起活动")
@DefaultActionState(value = ActionState.ADMIN, group = "event")
@PostMapping("/info")
public String addEvent(@RequestBody EventModel eventModel) {
@@ -111,7 +111,7 @@ public String addEvent(@RequestBody EventModel eventModel) {
* @param eventModel 活动信息
* @return 是否成功
*/
- @OperateLog("修改活动")
+ @Operation("修改活动")
@DefaultActionState(value = ActionState.MANAGER, group = "event")
@PutMapping("/info")
public String putEvent(@RequestParam @EventId Integer eventId,
@@ -120,7 +120,7 @@ public String putEvent(@RequestParam @EventId Integer eventId,
return eventService.updateEvent(eventModel).toString();
}
- @OperateLog("获取活动列表")
+ @Operation("获取活动列表")
@DefaultActionState(ActionState.PUBLIC)
@GetMapping("/list")
public PageModel getEvents(@RequestParam(value = "page", required = false, defaultValue = "1") Integer page,
@@ -128,7 +128,7 @@ public PageModel getEvents(@RequestParam(value = "page", required =
return eventService.getEvents(page, size);
}
- @OperateLog("筛选获取课表")
+ @Operation("筛选获取课表")
@DefaultActionState(ActionState.PUBLIC)
@PostMapping("/list")
public List postForEvents(@RequestParam(required = false) List typeId,
@@ -137,7 +137,7 @@ public List postForEvents(@RequestParam(required = false) List getDepartmentsWithFilter() {
diff --git a/src/main/java/sast/evento/controller/FeedbackController.java b/src/main/java/sast/evento/controller/FeedbackController.java
index 9028873..270fc95 100644
--- a/src/main/java/sast/evento/controller/FeedbackController.java
+++ b/src/main/java/sast/evento/controller/FeedbackController.java
@@ -4,7 +4,7 @@
import org.springframework.web.bind.annotation.*;
import sast.evento.annotation.DefaultActionState;
import sast.evento.annotation.EventId;
-import sast.evento.annotation.OperateLog;
+import sast.evento.annotation.Operation;
import sast.evento.common.enums.ActionState;
import sast.evento.interceptor.HttpInterceptor;
import sast.evento.model.*;
@@ -23,7 +23,7 @@ public class FeedbackController {
* @return FeedbacksDTO
* @author Aiden
*/
- @OperateLog("获取某活动反馈详情")
+ @Operation("获取某活动反馈详情")
@DefaultActionState(value = ActionState.ADMIN, group = "feedback")
@GetMapping("/event")
public FeedbacksDTO getFeedback(@RequestParam @EventId Integer eventId) {
@@ -36,7 +36,7 @@ public FeedbacksDTO getFeedback(@RequestParam @EventId Integer eventId) {
* @return List