随笔 - 607,  文章 - 173,  评论 - 2,  阅读 - 21万

 


1    后端调用示例

1.0    通用

调用方式为post,post写上 http://127.0.0.1:8080/test/testApi

headers :Content-Type = application/json

 

1.1    入参:空

{
"interfaceName":"com.ddwei.application.moduleA.service.impl.CallServerServiceImpl",
"methodName":"blank",
"paramsList":[]
}

 

1.2    入参:字符串

复制代码
{
"interfaceName":"com.ddwei.application.moduleA.service.impl.CallServerServiceImpl",
"methodName":"params",
"paramsList":[{
    "index":"1",
    "type":"java.lang.String",
    "data":"aaa"
    },
    {
        "index":"2",
        "type":"java.lang.Integer",
        "data":111
        }]
}
复制代码

 

1.3    入参:对象

复制代码
{
"interfaceName":"com.ddwei.application.moduleA.service.impl.CallServerServiceImpl",
"methodName":"methodA",
"paramsList":[{
    "index":"1",
    "type":"com.ddwei.api.bff.moduleA.dto.request.CallServerQuery",
    "data":{
        "inputPropertyA":"111",
       "inputPropertyB":"222"}
}]
}
复制代码

 

1.4    入参:PageParm

复制代码
{
"interfaceName":"com.ddwei.application.moduleA.service.impl.CallServerServiceImpl",
"methodName":"methodC",
"paramsList":[{
    "index":"1",
    "type":"com.ddwei.api.temp.jarBao.PageParm",
    "fanxingClass":"com.ddwei.api.bff.moduleA.dto.response.CallServerDto",
    "fanxingFieldName":"data",
    "data":{
        "data":{
            "user":{
                "userId":1222,
                "orgId":"11"
            },
            "outputPropertyA":"张飞"
        },
        "pageNo":1,
        "pageSize":100

        
    }
    
}]
}
复制代码

 

 

1.5    入参:包含对象

注意:对象命名为data

复制代码
{
"interfaceName":"com.ddwei.application.moduleA.service.impl.CallServerServiceImpl",
"methodName":"fanxing",
"paramsList":[{
    "index":"1",
    "type":"com.ddwei.api.bff.moduleA.dto.request.CallServerParentQuery",
    "fanxingClass":"com.ddwei.api.bff.moduleA.dto.request.CallServerQuery",
    "fanxingFieldName":"data",
    "data":{
        "data":{
            "user":{
                "userId":1222,
                "orgId":"11"
            },
            "inputPropertyA":"aaa"
        },
        "colum1":"1"    
        
    }
    
}]
}
复制代码

 

复制代码
@Getter
@Setter
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class CallServerParentQuery {
    private String colum1;
    private CallServerQuery data;
}

@Getter
@Setter
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class CallServerQuery implements Serializable {
    /**
     * 属性A
     */
    @NotNull(message = "属性A不能为空")
    private String inputPropertyA;
    /**
     * 属性B
     */
    private String inputPropertyB;
}

    void fanxing(CallServerParentQuery query) throws DBusinessException;
复制代码

 

1.6    File上传(暂定)

 

 

 

2    通用类

2.0    参考通用类:

https://www.cnblogs.com/1446358788-qq/articles/17561777.html


 

3    常见错误

3.1    JSON parse error: Unexpected character (' ' (code 12288 / 0x3000))

中文空格导致,json解析失败

 

3.2    Unsupported Media Type

posted on   菜鸟乙  阅读(36)  评论(0编辑  收藏  举报
编辑推荐:
· 开发者必知的日志记录最佳实践
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
阅读排行:
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· 没有Manus邀请码?试试免邀请码的MGX或者开源的OpenManus吧
< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

点击右上角即可分享
微信分享提示

目录导航