dromara / fast-request

IntelliJ IDEA plugin Restful Fast Request
https://api-buddy.com/en
Other
452 stars 116 forks source link

[Bug]:多模块切换操作无响应 #323

Closed kuailecs54 closed 5 months ago

kuailecs54 commented 5 months ago

检查项

您使用的是以下哪个操作系统

IDEA 版本号

IntelliJ IDEA 2024.1.2 (Ultimate Edition) Build #IU-241.17011.79, built on May 22, 2024 Licensed to chen shifeng You have a perpetual fallback license for this version. Subscription is active until May 6, 2025. Runtime version: 21.0.2+13-b346.3 amd64 VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o. Linux 6.8.9-3-manjaro GC: G1 Young Generation, G1 Concurrent GC, G1 Old Generation Memory: 3072M Cores: 16 Registry: debugger.watches.in.variables=false debugger.new.tool.window.layout=true ide.experimental.ui=true terminal.new.ui=true editor.minimap.enabled=true Non-Bundled Plugins: commit-message-helper-idea-plugin (1.4.2) com.intellij.plugins.xwinkeymap (211.4961.30) main.kotlin.com.jimschubert.intellij.swaggercodegen (4.3.1-p0) com.jetbrains.edu (2024.4-2024.1-742) com.intellij.ideolog (222.3.2.0) com.github.siropkin.kursor (1.0.5) io.codearte.props2yaml (1.0.2) coderead.IdeaPlugins.maven (1.2) com.github.wangji92.arthas.plugin (2.45) com.intellij.guice (241.14494.158) GenerateSerialVersionUID (3.0.3) com.intellij.spring.websocket (241.14494.158) VisualVMLauncher (1.23.1-IJ2023.3) com.sunny.plugin.MockitoGenPlugin (1.5.4) com.haulmont.jpab (241.15989.21) GrepConsole (13.0.2-IJ2023.3) PlantUML integration (7.10.1-IJ2023.2) JRebelPlugin (2024.2.1) MavenRunHelper (4.28.0-IJ2022.2) izhangzhihao.rainbow.brackets (2024.2.3-241) io.github.kings1990.FastRequest (2024.1.5.1) SequenceDiagram (3.0.9) com.github.copilot (1.5.4.5571) org.sonarlint.idea (10.5.0.78339) mobi.hsz.idea.gitignore (4.5.3) cn.yiiguxing.plugin.translate (3.6.0) Kotlin: 241.17011.79-IJ Current Desktop: GNOME

插件版本号

2024.1.5.1

Bug 详情

在 多模块项目中 选择一个项目生成api参数和url以后,切换到其他项目,生成参数和rul无反应

微信图片_20240524181138

邮件点击生成 或者是 方法的左侧图片均无相应

Error log

java.lang.NullPointerException: Cannot invoke "com.intellij.psi.PsiClass.getQualifiedName()" because "" is null at io.github.kings1990.plugin.fastrequest.cofig.II1IlIIIl11lIlll.ll1IIIIIlII1ll1ll(L:724) at io.github.kings1990.plugin.fastrequest.cofig.II1IlIIIl11lIlll.ll1IIIIIlII1ll1ll(L:545) at io.github.kings1990.plugin.fastrequest.cofig.Ill1II1l11lII11l.ll1IIIIIlII1ll1ll(L:143) at io.github.kings1990.plugin.fastrequest.cofig.l1IllIl1l11I1lII111l.ll1IIIIIlII1ll1ll(L:114) at io.github.kings1990.plugin.fastrequest.cofig.ll1IIllllIl1lI1I.lllI1lIl1IIl1lIl1II(L:79) at com.intellij.openapi.application.impl.RwLockHolder.runReadAction(RwLockHolder.kt:271) at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:845) at io.github.kings1990.plugin.fastrequest.cofig.ll1IIllllIl1lI1I.ll1IIIIIlII1ll1ll(L:79) at com.intellij.util.SlowOperations.allowSlowOperations(SlowOperations.java:200) at io.github.kings1990.plugin.fastrequest.cofig.ll1IIllllIl1lI1I.ll1IIIIIlII1ll1ll(L:79) at io.github.kings1990.plugin.fastrequest.cofig.transient.ll1IIIIIlII1ll1ll(L:101) at io.github.kings1990.plugin.fastrequest.cofig.IIIl1I11Il11lIllIIIl.actionPerformed(L:74) at com.intellij.openapi.actionSystem.ex.ActionUtil.doPerformActionOrShowPopup(ActionUtil.kt:304) at com.intellij.openapi.keymap.impl.ActionProcessor.performAction(ActionProcessor.java:32) at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher$actionProcessor$1.performAction(IdeKeyEventDispatcher.kt:495) at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcherKt.doPerformActionInner$lambda$4$lambda$3(IdeKeyEventDispatcher.kt:844) at com.intellij.openapi.application.TransactionGuardImpl.performActivity(TransactionGuardImpl.java:106) at com.intellij.openapi.application.TransactionGuardImpl.performUserActivity(TransactionGuardImpl.java:95) at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcherKt.doPerformActionInner$lambda$4(IdeKeyEventDispatcher.kt:844) at com.intellij.openapi.actionSystem.impl.ActionManagerImpl.performWithActionCallbacks(ActionManagerImpl.kt:1161) at com.intellij.openapi.actionSystem.ex.ActionUtil.performDumbAwareWithCallbacks(ActionUtil.kt:321) at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcherKt.doPerformActionInner(IdeKeyEventDispatcher.kt:842) at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcherKt.access$doPerformActionInner(IdeKeyEventDispatcher.kt:1) at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.processAction$intellij_platform_ide_impl(IdeKeyEventDispatcher.kt:571) at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.processAction(IdeKeyEventDispatcher.kt:508) at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.processActionOrWaitSecondStroke(IdeKeyEventDispatcher.kt:447) at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.inInitState(IdeKeyEventDispatcher.kt:440) at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.dispatchKeyEvent(IdeKeyEventDispatcher.kt:302) at com.intellij.ide.IdeEventQueue.dispatchKeyEvent(IdeEventQueue.kt:623) at com.intellij.ide.IdeEventQueue._dispatchEvent$lambda$11(IdeEventQueue.kt:585) at com.intellij.openapi.application.impl.RwLockHolder.runWithEnabledImplicitRead(RwLockHolder.kt:138) at com.intellij.openapi.application.impl.RwLockHolder.runWithImplicitRead(RwLockHolder.kt:129) at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.kt:585) at com.intellij.ide.IdeEventQueue.access$_dispatchEvent(IdeEventQueue.kt:77) at com.intellij.ide.IdeEventQueue$dispatchEvent$processEventRunnable$1$1$1.compute(IdeEventQueue.kt:362) at com.intellij.ide.IdeEventQueue$dispatchEvent$processEventRunnable$1$1$1.compute(IdeEventQueue.kt:361) at com.intellij.openapi.progress.impl.CoreProgressManager.computePrioritized(CoreProgressManager.java:843) at com.intellij.ide.IdeEventQueue$dispatchEvent$processEventRunnable$1$1.invoke(IdeEventQueue.kt:361) at com.intellij.ide.IdeEventQueue$dispatchEvent$processEventRunnable$1$1.invoke(IdeEventQueue.kt:356) at com.intellij.ide.IdeEventQueueKt.performActivity$lambda$1(IdeEventQueue.kt:1022) at com.intellij.openapi.application.TransactionGuardImpl.performActivity(TransactionGuardImpl.java:114) at com.intellij.ide.IdeEventQueueKt.performActivity(IdeEventQueue.kt:1022) at com.intellij.ide.IdeEventQueue.dispatchEvent$lambda$7(IdeEventQueue.kt:356) at com.intellij.openapi.application.impl.RwLockHolder.runIntendedWriteActionOnCurrentThread(RwLockHolder.kt:209) at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:830) at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.kt:398) at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:207) at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:128) at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:117) at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:113) at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:105) at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:92)

kings1990 commented 5 months ago

实体类解析错误导致,需要提供跟这个方法涉及到的入参和出参的所有实体类

kuailecs54 commented 5 months ago

发现问题,在api controller 中 使用 了自定义注解参数,接口无响应

注解定义类如下


import org.springframework.security.core.annotation.AuthenticationPrincipal;

import java.lang.annotation.*;

@Target({ElementType.PARAMETER, ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Documented
@AuthenticationPrincipal
public @interface CurrentUser {

}

使用方式如下

    @Operation(summary = "订单修改地址")
    @PostMapping("/orderAddressUpdate")
    @RepeatSubmit(interval = 500)
    public void orderAddressUpdate(@Validated @RequestBody MallOrderAddressRequest request,
                                   @CurrentUser UserAccount account) {
        mallOrderService.orderAddressUpdate(request, account);
    }

userAccount 定义如下


import com.google.common.collect.Lists;
import lombok.Data;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;

import java.io.Serial;
import java.io.Serializable;
import java.util.Collection;
import java.util.HashSet;
import java.util.Set;

@Data
public class UserAccount implements UserDetails, Serializable {

    private Long id;
    @Serial
    private static final long serialVersionUID = 1L;

    private String username; //用户名

    private String nickname; //姓名

    private String mobile;

    private String openid; //微信openid

    private AccountType accountType;

    private String password;

    private boolean locked = false;

    private boolean active = true;

    private Collection<? extends GrantedAuthority> authorities = Lists.newArrayList();

    private Set<Role> roles = new HashSet<>();

    @Override
    public String getPassword() {
        return this.password;
    }

    @Override
    public String getUsername() {
        return this.username;
    }

    @Override
    public boolean isAccountNonExpired() {
        return true;
    }

    @Override
    public boolean isAccountNonLocked() {
        return !this.locked;
    }

    @Override
    public boolean isCredentialsNonExpired() {
        return true;
    }

    @Override
    public boolean isEnabled() {
        return this.isActive();
    }
}
kuailecs54 commented 5 months ago

修改成这样就可以出

    @Operation(summary = "订单修改地址")
    @PostMapping("/orderAddressUpdate")
    @RepeatSubmit(interval = 500)
    public void orderAddressUpdate(@Validated @RequestBody MallOrderAddressRequest reques) {
        mallOrderService.orderAddressUpdate(request, null);
    }
kuailecs54 commented 5 months ago

可 在设置中忽略 解析 Useraccount 可以正常使用,

参考设置 https://api-buddy.cn/guide/faq.html#s-%E8%A7%A3%E6%9E%90%E5%A6%82%E4%BD%95%E5%BF%BD%E7%95%A5%E6%9F%90%E4%B8%AA%E5%AD%97%E6%AE%B5