TASK:查询交易记录 添加显示总金额和付款者邮箱

This commit is contained in:
2025-06-23 10:53:30 +08:00
parent 301a62a563
commit d6c5d0e95d
5 changed files with 69 additions and 2 deletions

View File

@@ -0,0 +1,15 @@
package com.ai.da.common.response;
import io.swagger.annotations.ApiModel;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.math.BigDecimal;
@Data
@NoArgsConstructor
@ApiModel("交易记录分页响应结果")
public class TransactionPageResponse<T> extends PageBaseResponse<T> {
private BigDecimal totalAmount;
}

View File

@@ -6,6 +6,7 @@ import com.ai.da.model.vo.PaymentInfoVO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import java.math.BigDecimal;
import java.util.List;
import java.util.Map;
@@ -24,6 +25,10 @@ public interface PaymentInfoMapper extends BaseMapper<PaymentInfo> {
String country, String city, String startTime, String endTime, String payer
);
BigDecimal queryTotalPaymentAmount(String paymentType,String payerTotal, String type, String status,
String country, String city, String startTime, String endTime, String payer
);
List<Map<String, String>> getCities();
List<Map<String, String>> getCountries();

View File

@@ -13,6 +13,8 @@ public class PaymentInfoVO {
private Long id;
@ApiModelProperty("付款用户名")
private String payer;
@ApiModelProperty("付款者邮箱")
private String email;
@ApiModelProperty("选择的支付平台 PayPal || Stripe || Alipay-HK")
private String platform;
@ApiModelProperty("支付的金额 单位:HKD")

View File

@@ -5,6 +5,7 @@ import com.ai.da.common.constant.CommonConstant;
import com.ai.da.common.context.UserContext;
import com.ai.da.common.enums.CreditsEventsEnum;
import com.ai.da.common.response.PageBaseResponse;
import com.ai.da.common.response.TransactionPageResponse;
import com.ai.da.common.utils.CopyUtil;
import com.ai.da.common.utils.DateUtil;
import com.ai.da.mapper.primary.*;
@@ -610,16 +611,21 @@ public class ConvenientInquiryServiceImpl extends ServiceImpl<QuestionnaireMappe
queryPaymentInfoDTO.getType(), queryPaymentInfoDTO.getStatus(),
queryPaymentInfoDTO.getCountry(), queryPaymentInfoDTO.getCity(),
queryPaymentInfoDTO.getStartTime(), queryPaymentInfoDTO.getEndTime(), queryPaymentInfoDTO.getPayer());
// 查询符合查询条件的总金额
BigDecimal payerTotal = paymentInfoMapper.queryTotalPaymentAmount(queryPaymentInfoDTO.getPlatform(), queryPaymentInfoDTO.getPayerTotal(),
queryPaymentInfoDTO.getType(), queryPaymentInfoDTO.getStatus(),
queryPaymentInfoDTO.getCountry(), queryPaymentInfoDTO.getCity(),
queryPaymentInfoDTO.getStartTime(), queryPaymentInfoDTO.getEndTime(), queryPaymentInfoDTO.getPayer());
// 总页数
double totalPage = Math.ceil((double) total / size);
// 组装返回参数
PageBaseResponse<PaymentInfoVO> response = new PageBaseResponse<>();
TransactionPageResponse<PaymentInfoVO> response = new TransactionPageResponse<>();
response.setContent(paymentInfoVOS);
response.setPage(queryPaymentInfoDTO.getPage());
response.setSize(size);
response.setTotal(total);
response.setPages((long) totalPage);
response.setTotalAmount(Objects.isNull(payerTotal) ? BigDecimal.ZERO : payerTotal);
return response;
}