VisiualOpaAspect.java 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. package jnpf.aop;
  2. import jnpf.util.RedisUtil;
  3. import jnpf.util.ServletUtil;
  4. import lombok.extern.slf4j.Slf4j;
  5. import org.aspectj.lang.annotation.After;
  6. import org.aspectj.lang.annotation.Aspect;
  7. import org.aspectj.lang.annotation.Pointcut;
  8. import org.springframework.beans.factory.annotation.Autowired;
  9. import org.springframework.stereotype.Component;
  10. import java.util.HashSet;
  11. import java.util.Set;
  12. /**
  13. * 可视化开发缓存数据处理
  14. * @author JNPF开发平台组
  15. * @version V3.1.0
  16. * @copyright 引迈信息技术有限公司
  17. * @date 2021/3/15 17:12
  18. */
  19. @Slf4j
  20. //@Aspect
  21. //@Component
  22. public class VisiualOpaAspect {
  23. @Autowired
  24. private RedisUtil redisUtil;
  25. @Pointcut("(execution(* jnpf.onlinedev.controller.VisualdevModelDataController.*(..))) || execution(* jnpf.onlinedev.controller.VisualdevModelAppController.*(..)))" +
  26. "|| execution(* jnpf.generater.controller.VisualdevGenController.*(..)))")
  27. public void visiualOpa() {
  28. }
  29. @After("visiualOpa()")
  30. public void doAroundService(){
  31. String method=ServletUtil.getRequest().getMethod().toLowerCase();
  32. if("put".equals(method)||"delete".equals(method)||"post".equals(method)){
  33. Set<String> allKey=new HashSet<>(16);
  34. allKey.addAll(redisUtil.getAllVisiualKeys());
  35. for(String key:allKey){
  36. redisUtil.remove(key);
  37. }
  38. }
  39. }
  40. }