Files
senmesh-zc/src/main/java/com/newyetai/sdk/chuanglan/dto/ChuangLanResponseDTO.java
ran.shang 7e38b8d971 init
2025-06-11 09:42:13 +08:00

82 lines
1.8 KiB
Java
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package com.newyetai.sdk.chuanglan.dto;
import com.newyetai.common.AlitaResult;
import com.newyetai.sdk.fangxinqian.constant.FxqConstants;
import com.newyetai.sdk.fangxinqian.constant.FxqErrorCodeEnum;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.util.StringUtils;
import java.io.Serializable;
/**
* 创蓝返回
*
* @param <T>
* @author fzp on 2021年6月15日14:55:38
*/
@Data
@NoArgsConstructor
public class ChuangLanResponseDTO<T> implements Serializable {
/**
*
**/
private static final long serialVersionUID = -4576000729533850612L;
/**
* 错误码
**/
private String code;
/**
* 序列号(每次调用接口返回的唯一值,seqNo 如有接口问题,请提供此值)
**/
private String seqNo;
/**
* 错误信息 1
**/
private String message;
/**
* 错误信息 2
*/
private String msg;
/**
* 响应结果
*/
private StatusDataDTO data;
public static ChuangLanResponseDTO buildCommonError() {
ChuangLanResponseDTO clResponseDTO = new ChuangLanResponseDTO();
clResponseDTO.setCode("999");
return clResponseDTO;
}
/**
* 返回结果处理
*
* @return
*/
public AlitaResult<T> handleResult() {
if (FxqConstants.SUC_CODE.equals(this.getCode())) {
return AlitaResult.success(handleData());
} else {
return AlitaResult.error(FxqErrorCodeEnum.INVOKE_RETURN_ERROR.getCode(),
StringUtils.isEmpty(this.getMsg()) ?
StringUtils.isEmpty(this.getMessage()) ? FxqErrorCodeEnum.INVOKE_RETURN_ERROR.getMsg() : this.getMessage()
: this.getMsg());
}
}
/**
* 子类DTO实现 转换为AlitaResult时
* 通过 handleData()决定转换为AlitaResult的data返回什么
*
* @return
*/
protected T handleData() {
return null;
}
}