淘先锋技术网

首页 1 2 3 4 5 6 7

属性 required = true  意思为 必填

 对象属性

/**
 * @descroptions: 再保临分请求
 * @author: c
 * @date: 2023/1/9 14:26
 * @version: 1.0
 */

public class UwReinsureReportReqDTO extends BaseInfoReqDTO implements Serializable {

    private static final long serialVersionUID = -5904748335587904723L;
    /**
     * 任务编号(系统自动生成,根据此任务号查询核保任务)
     */
    private String taskCode;
    /**
     * 是否上传再保意见函
     */
    private String isReinsuredLetters;
    /**
     * 再保意见回复
     */
    private String reinsuredResult;
    /**
     * 再保标记
     */
    private String isReinsured;


    public String getTaskCode() {
        return taskCode;
    }

    public void setTaskCode(String taskCode) {
        this.taskCode = taskCode;
    }

    public String getIsReinsuredLetters() {
        return isReinsuredLetters;
    }

    public void setIsReinsuredLetters(String isReinsuredLetters) {
        this.isReinsuredLetters = isReinsuredLetters;
    }

    public String getReinsuredResult() {
        return reinsuredResult;
    }

    public void setReinsuredResult(String reinsuredResult) {
        this.reinsuredResult = reinsuredResult;
    }

    public String getIsReinsured() {
        return isReinsured;
    }

    public void setIsReinsured(String isReinsured) {
        this.isReinsured = isReinsured;
    }
}

 BaseInfoReqDTO

/**
 * @Description: 入参/出参 请求/响应信息
 * @Author: c
 * @DateTime: 2022/8/13 10:46
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@Accessors(chain = true)
public class BaseInfoReqDTO implements Serializable {
    private static final long serialVersionUID = -7926823714754206509L;

    /**
     * 请求信息
     */
    @Valid
    private BaseInfo baseInfo;
}

BaseInfo 

/**
 * 入参/出参 请求/响应信息
 *
 * @Author: c
 * @DateTime: 2022/8/13 10:46
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@Accessors(chain = true)
public class BaseInfo implements Serializable {

    private static final long serialVersionUID = -1437869074166766067L;

    /**
     * 调用方法
     */
    @NotBlank(message = "调用方法不能为空!")
    private String funcFlag;
    /**
     * 交易号码
     */
    @NotBlank(message = "交易号码不能为空!")
    private String transNo;
    /**
     * 操作日期
     */
    @NotNull(message = "操作日期不能为空!")
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date transrDate;
    /**
     * 操作时间
     */
    @NotBlank(message = "操作时间不能为空!")
    private String transrTime;
    /**
     * 操作人
     */
    @NotBlank(message = "操作人不能为空!")
    private String operator;
    /**
     * 来自哪个系统
     */
    @NotBlank(message = "调用系统不能为空!")
    private String fromSys;
    /**
     * 调用哪个系统
     */
    private String toSys;

    private String sourceId;
}

postman测试

{

"baseInfo": {

"funcFlag": "ZT066",

"transNo": "201208021201010001",

"transrDate": "2012-08-17",

"transrTime": "13:43:40",

"operator": "C",

"fromSys": "1",

"toSys": "1",

"sourceId": "1"

},

"taskCode": "123456789",

"isReinsuredLetters": "N",

"reinsuredResult": "1",

"isReinsured": "Y"

}

@RequestPart和@RequestBody都是Spring MVC注解,用于处理HTTP请求参数,但是它们的使用有所不同。

@RequestBody主要用于处理POST请求的请求体中的参数,比如表单提交的JSON数据,它会将请求体中的参数转换为Java对象。

@RequestPart用于处理Multipart请求,通常用于文件上传。它可以将请求中的每个部分映射到Controller方法的参数中,支持文件上传和表单数据。