This commit is contained in:
wangyu 2021-01-14 15:02:10 +08:00
parent ca5fffd70a
commit 0a79d57337
2 changed files with 7 additions and 2 deletions

View File

@ -10,6 +10,7 @@ import lombok.AccessLevel;
import lombok.Data;
import lombok.Setter;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.ClassUtils;
import org.apache.commons.lang3.StringUtils;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.Signature;
@ -68,11 +69,12 @@ public class LogContext {
MethodSignature methodSignature = (MethodSignature) signature;
Operation operation = AnnotationUtils.findAnnotation(methodSignature.getMethod(), Operation.class);
if (null != operation) {
Class<?> targetClass = joinPoint.getTarget().getClass();
LogContext context = new LogContext();
context.startTime = System.currentTimeMillis();
context.module = determineModule(operation, joinPoint.getTarget().getClass());
context.module = determineModule(operation, targetClass);
context.business = operation.value();
context.signature = joinPoint.getSignature().getName();
context.signature = ClassUtils.getCanonicalName(targetClass) + "." + methodSignature.getName();
context.args = joinPoint.getArgs();
context.valid = true;
log.info("监测到支持的切点:{}, {}", context.module, operation.value());

View File

@ -1,5 +1,6 @@
package com.flyfish.framework.controller;
import com.flyfish.framework.annotations.Operation;
import com.flyfish.framework.bean.Result;
import com.flyfish.framework.configuration.annotations.CurrentUser;
import com.flyfish.framework.domain.UserPasswordDto;
@ -34,6 +35,7 @@ public class UserController extends BaseController<User, UserQo> {
* @return 结果
*/
@PutMapping("{id}/passwords")
@Operation("重置密码")
public Result<Void> resetPassword(@PathVariable String id, @RequestBody User body, @CurrentUser User user) {
Assert.hasText(body.getPassword(), "重置密码必需携带密码!");
Assert.isTrue(Optional.ofNullable(user.getRoles()).map(roles -> roles.stream().anyMatch(Role::getAdmin))
@ -56,6 +58,7 @@ public class UserController extends BaseController<User, UserQo> {
* @return 结果
*/
@PutMapping("/passwords")
@Operation("修改密码")
public Result<Void> changePassword(@RequestBody UserPasswordDto passwordDto, @CurrentUser User user) {
// 检查原密码
Assert.isTrue(passwordEncoder.matches(passwordDto.getOldPassword(), user.getPassword()), "原密码不正确!");