20230922-ljl-fixBug
parent
bd0116a550
commit
1a33bfe998
@ -0,0 +1,68 @@
|
||||
package com.ms.api.dto.common;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Data
|
||||
public class ResultDTO {
|
||||
public final static String SUCCESS = "success";
|
||||
public final static String FAIL = "fail";
|
||||
|
||||
private String result;
|
||||
private String reason;
|
||||
private String code;
|
||||
private String message;
|
||||
private Map<String, Object> data = new HashMap<>();
|
||||
|
||||
public boolean isSuccess() {
|
||||
return "success".equals(result);
|
||||
}
|
||||
|
||||
public static ResultDTO success() {
|
||||
ResultDTO result = new ResultDTO();
|
||||
result.setResult(SUCCESS);
|
||||
result.setReason("成功");
|
||||
result.setCode(SUCCESS);
|
||||
result.setMessage("成功");
|
||||
return result;
|
||||
}
|
||||
|
||||
public static ResultDTO success(Map<String, Object> data) {
|
||||
ResultDTO result = new ResultDTO();
|
||||
result.setResult(SUCCESS);
|
||||
result.setReason("成功");
|
||||
result.setCode(SUCCESS);
|
||||
result.setMessage("成功");
|
||||
result.setData(data);
|
||||
return result;
|
||||
}
|
||||
|
||||
public static ResultDTO fail() {
|
||||
ResultDTO result = new ResultDTO();
|
||||
result.setResult(FAIL);
|
||||
result.setReason("失败");
|
||||
result.setCode(FAIL);
|
||||
result.setMessage("失败");
|
||||
return result;
|
||||
}
|
||||
|
||||
public static ResultDTO fail(String message) {
|
||||
ResultDTO result = new ResultDTO();
|
||||
result.setResult(FAIL);
|
||||
result.setReason(message);
|
||||
result.setCode(FAIL);
|
||||
result.setMessage(message);
|
||||
return result;
|
||||
}
|
||||
|
||||
public static ResultDTO fail(String code, String message) {
|
||||
ResultDTO result = new ResultDTO();
|
||||
result.setResult(FAIL);
|
||||
result.setReason(message);
|
||||
result.setCode(code);
|
||||
result.setMessage(message);
|
||||
return result;
|
||||
}
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
package com.ms.api.dto.dsapi.response;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Data
|
||||
public class GetOrderPayProtocolPayResponseDTO extends CommonResponseDTO {
|
||||
|
||||
private Map<String, Object> data;
|
||||
|
||||
public List<PaymentAgreement> getPaymentAgreements() {
|
||||
List<PaymentAgreement> result = new ArrayList<>();
|
||||
if(data.get("paymentAgreements") instanceof List<?>) {
|
||||
for (Object o : (List<?>) data.get("paymentAgreements")) {
|
||||
result.add((PaymentAgreement) o);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Data
|
||||
public static class PaymentAgreement implements Serializable {
|
||||
private String payChannel;
|
||||
private String signedStatus;
|
||||
private String bindingStatus;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue