审批任务失败:Feign 接口请求参数错误导致异常
根据报错信息,可以看出是因为参数错误导致的审批任务失败。具体错误信息为java.lang.IllegalArgumentException: Result Maps collection does not contain value for com.redxun.form.core.entity.For...。
根据代码和报错信息分析,可能的原因是在getByComponentId方法中,使用了formMobileServiceImpl.getComponentById(id)方法获取组件,但是返回的FormMobile对象没有正确的映射到com.redxun.form.core.entity.FormMobile类中。
解决这个问题的方法是检查com.redxun.form.core.entity.FormMobile类的映射定义是否正确,确保返回的数据可以正确映射到该类中。
另外,还需要检查传递给getByComponentId方法的参数是否正确,确保传递的参数是一个包含'id'键值对的Map对象。
如果确认映射定义和参数都正确,但问题仍然存在,可能需要进一步检查代码逻辑和数据源的配置,以确定问题的具体原因。
相关代码:
Feign 接口:
@PostMapping("/form/core/formMobile/getByComponentId")
String getByComponentId(@RequestBody Map map);
接口实现:
@MethodDefine(title = "返回组件", path = "/getByComponentId", method = HttpMethodConstants.POST,
params = {@ParamDefine(title = "id", varName = "id")})
@PostMapping("getByComponentId")
public String getByComponentId(@RequestBody Map map){
String id = map.get("id").toString();
String component=null;
FormMobile formMobile = formMobileServiceImpl.getComponentById(id);
System.out.println("123456789" + formMobile);
component = formMobile.getComponent();
return component;
}
原文地址: https://www.cveoy.top/t/topic/obBu 著作权归作者所有。请勿转载和采集!