后台课件操作日志c

This commit is contained in:
none 2023-07-29 15:12:16 +08:00
parent ae0b3ab9e0
commit c65013f266
2 changed files with 12 additions and 6 deletions

View File

@ -22,7 +22,6 @@ import jakarta.servlet.http.HttpServletRequest;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.aspectj.lang.JoinPoint; import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.*; import org.aspectj.lang.annotation.*;
import org.aspectj.lang.reflect.MethodSignature; import org.aspectj.lang.reflect.MethodSignature;
@ -38,7 +37,6 @@ import xyz.playedu.api.util.RequestUtil;
import xyz.playedu.api.util.StringUtil; import xyz.playedu.api.util.StringUtil;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.util.Arrays;
import java.util.Date; import java.util.Date;
import java.util.Map; import java.util.Map;
@ -155,19 +153,19 @@ public class AdminLogAspect {
public JSONObject excludeProperties(String jsonData) { public JSONObject excludeProperties(String jsonData) {
JSONObject jsonObjectResult = new JSONObject(); JSONObject jsonObjectResult = new JSONObject();
// 把传入String类型转换成JSONObject对象 // 把传入String类型转换成JSONObject对象
if(JSONUtil.isTypeJSON(jsonData)){ if (JSONUtil.isTypeJSON(jsonData)) {
JSONObject jsonObject = JSONUtil.parseObj(jsonData); JSONObject jsonObject = JSONUtil.parseObj(jsonData);
for (Map.Entry<String, Object> entry : jsonObject.entrySet()) { for (Map.Entry<String, Object> entry : jsonObject.entrySet()) {
String key = entry.getKey(); String key = entry.getKey();
Object value = entry.getValue(); Object value = entry.getValue();
if(StringUtil.isNotNull(value)){ if (StringUtil.isNotNull(value)) {
// 如果value依旧是json类型的话继续递归解析 // 如果value依旧是json类型的话继续递归解析
if (JSONUtil.isTypeJSON(value.toString())) { if (JSONUtil.isTypeJSON(value.toString())) {
jsonObjectResult.put(key, excludeProperties(entry.getValue().toString())); jsonObjectResult.put(key, excludeProperties(entry.getValue().toString()));
} else { } else {
// 如果value是单纯的数据,执行脱敏操作 // 如果value是单纯的数据,执行脱敏操作
for (String i : Arrays.asList(EXCLUDE_PROPERTIES)) { for (String i : EXCLUDE_PROPERTIES) {
if(key.equals(i)){ if (key.equals(i)) {
jsonObjectResult.put(key, "******"); jsonObjectResult.put(key, "******");
} }
} }

View File

@ -22,8 +22,10 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import xyz.playedu.api.annotation.Log;
import xyz.playedu.api.constant.BPermissionConstant; import xyz.playedu.api.constant.BPermissionConstant;
import xyz.playedu.api.constant.BackendConstant; import xyz.playedu.api.constant.BackendConstant;
import xyz.playedu.api.constant.BusinessType;
import xyz.playedu.api.domain.CourseAttachment; import xyz.playedu.api.domain.CourseAttachment;
import xyz.playedu.api.exception.NotFoundException; import xyz.playedu.api.exception.NotFoundException;
import xyz.playedu.api.middleware.BackendPermissionMiddleware; import xyz.playedu.api.middleware.BackendPermissionMiddleware;
@ -44,6 +46,7 @@ public class CourseAttachmentController {
@BackendPermissionMiddleware(slug = BPermissionConstant.COURSE) @BackendPermissionMiddleware(slug = BPermissionConstant.COURSE)
@PostMapping("/create") @PostMapping("/create")
@Log(title = "线上课-附件-新建", businessType = BusinessType.INSERT)
public JsonResponse store( public JsonResponse store(
@PathVariable(name = "courseId") Integer courseId, @PathVariable(name = "courseId") Integer courseId,
@RequestBody @Validated CourseAttachmentRequest req) @RequestBody @Validated CourseAttachmentRequest req)
@ -71,6 +74,7 @@ public class CourseAttachmentController {
@BackendPermissionMiddleware(slug = BPermissionConstant.COURSE) @BackendPermissionMiddleware(slug = BPermissionConstant.COURSE)
@PostMapping("/create-batch") @PostMapping("/create-batch")
@Transactional @Transactional
@Log(title = "线上课-附件-批量新建", businessType = BusinessType.INSERT)
public JsonResponse storeMulti( public JsonResponse storeMulti(
@PathVariable(name = "courseId") Integer courseId, @PathVariable(name = "courseId") Integer courseId,
@RequestBody @Validated CourseAttachmentMultiRequest req) { @RequestBody @Validated CourseAttachmentMultiRequest req) {
@ -107,6 +111,7 @@ public class CourseAttachmentController {
@BackendPermissionMiddleware(slug = BPermissionConstant.COURSE) @BackendPermissionMiddleware(slug = BPermissionConstant.COURSE)
@GetMapping("/{id}") @GetMapping("/{id}")
@Log(title = "线上课-附件-编辑", businessType = BusinessType.GET)
public JsonResponse edit( public JsonResponse edit(
@PathVariable(name = "courseId") Integer courseId, @PathVariable(name = "courseId") Integer courseId,
@PathVariable(name = "id") Integer id) @PathVariable(name = "id") Integer id)
@ -117,6 +122,7 @@ public class CourseAttachmentController {
@BackendPermissionMiddleware(slug = BPermissionConstant.COURSE) @BackendPermissionMiddleware(slug = BPermissionConstant.COURSE)
@PutMapping("/{id}") @PutMapping("/{id}")
@Log(title = "线上课-附件-编辑", businessType = BusinessType.UPDATE)
public JsonResponse update( public JsonResponse update(
@PathVariable(name = "courseId") Integer courseId, @PathVariable(name = "courseId") Integer courseId,
@PathVariable(name = "id") Integer id, @PathVariable(name = "id") Integer id,
@ -129,6 +135,7 @@ public class CourseAttachmentController {
@BackendPermissionMiddleware(slug = BPermissionConstant.COURSE) @BackendPermissionMiddleware(slug = BPermissionConstant.COURSE)
@DeleteMapping("/{id}") @DeleteMapping("/{id}")
@Log(title = "线上课-附件-删除", businessType = BusinessType.DELETE)
public JsonResponse destroy( public JsonResponse destroy(
@PathVariable(name = "courseId") Integer courseId, @PathVariable(name = "courseId") Integer courseId,
@PathVariable(name = "id") Integer id) @PathVariable(name = "id") Integer id)
@ -139,6 +146,7 @@ public class CourseAttachmentController {
} }
@PutMapping("/update/sort") @PutMapping("/update/sort")
@Log(title = "线上课-附件-排序调整", businessType = BusinessType.UPDATE)
public JsonResponse updateSort( public JsonResponse updateSort(
@PathVariable(name = "courseId") Integer courseId, @PathVariable(name = "courseId") Integer courseId,
@RequestBody @Validated CourseAttachmentSortRequest req) { @RequestBody @Validated CourseAttachmentSortRequest req) {