This commit is contained in:
ran.shang
2025-06-11 09:42:13 +08:00
commit 7e38b8d971
1935 changed files with 132836 additions and 0 deletions

View File

@@ -0,0 +1,81 @@
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;
}
}