查询各平台交易记录
This commit is contained in:
@@ -2,20 +2,21 @@ package com.ai.da.controller;
|
||||
|
||||
|
||||
import com.ai.da.common.context.UserContext;
|
||||
import com.ai.da.common.response.PageBaseResponse;
|
||||
import com.ai.da.common.response.Response;
|
||||
import com.ai.da.mapper.primary.DesignMapper;
|
||||
import com.ai.da.mapper.primary.entity.Account;
|
||||
import com.ai.da.mapper.primary.entity.TrialOrder;
|
||||
import com.ai.da.model.dto.AccountAddDTO;
|
||||
import com.ai.da.model.dto.QueryPaymentInfoDTO;
|
||||
import com.ai.da.model.dto.UserDesignStatisticDTO;
|
||||
import com.ai.da.model.vo.PaymentInfoVO;
|
||||
import com.ai.da.model.vo.QuestionnaireFeedbackVO;
|
||||
import com.ai.da.model.vo.QuestionnaireVO;
|
||||
import com.ai.da.model.vo.QueryUserConditionsVO;
|
||||
import com.ai.da.service.AccountService;
|
||||
import com.ai.da.service.ConvenientInquiryService;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.itextpdf.text.pdf.PRIndirectReference;
|
||||
import io.netty.util.internal.StringUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
@@ -196,5 +197,9 @@ public class ConvenientInquiryController {
|
||||
return Response.success(convenientInquiryService.getAllUserIdList());
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation("获取所有交易信息")
|
||||
@PostMapping("/queryTransaction")
|
||||
public Response<PageBaseResponse<PaymentInfoVO>> queryTransactionRecords(@Valid @RequestBody QueryPaymentInfoDTO queryPaymentInfoDTO){
|
||||
return Response.success(convenientInquiryService.queryTransactionRecords(queryPaymentInfoDTO));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.ai.da.mapper.primary;
|
||||
|
||||
import com.ai.da.mapper.primary.entity.PaymentInfo;
|
||||
import com.ai.da.model.vo.OrderListVO;
|
||||
import com.ai.da.model.vo.PaymentInfoVO;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
import java.util.List;
|
||||
@@ -11,4 +12,13 @@ public interface PaymentInfoMapper extends BaseMapper<PaymentInfo> {
|
||||
List<OrderListVO> selectPageOrderList(Long accountId, String startTime, String endTime, int offset, int pageSize, Long id);
|
||||
|
||||
int queryOrderListTotalCount(Long accountId, String startTime, String endTime, Long id);
|
||||
|
||||
List<PaymentInfoVO> queryPaymentInfo(String paymentType,String payerTotal, String type, String status,
|
||||
String country, String city, String startTime, String endTime,
|
||||
int limit, int offset
|
||||
);
|
||||
|
||||
Long queryPaymentInfoCount(String paymentType,String payerTotal, String type, String status,
|
||||
String country, String city, String startTime, String endTime
|
||||
);
|
||||
}
|
||||
|
||||
@@ -15,13 +15,21 @@ public class PaymentInfo extends BaseEntity{
|
||||
|
||||
private String paymentType;//支付类型
|
||||
|
||||
/**
|
||||
* PayPal 订单状态:CREATED/SAVED/APPROVED/VOIDED/COMPLETED/PAYER_ACTION_REQUIRED
|
||||
* Stripe 订单状态: 原 session 状态:open/completed/expired ; 现 invoice 状态:draft/open/paid/uncollectible/void
|
||||
* Alipay-HK 订单状态:wait, paid, expired, liquidated
|
||||
* paid and liquidated means the refund request has been executed.
|
||||
* expired means the request has been rejected.
|
||||
* wait means the request is still under processing.
|
||||
*/
|
||||
private String tradeState;//交易状态
|
||||
|
||||
private Float payerTotal;//支付金额(元)
|
||||
|
||||
private String content;//通知参数
|
||||
|
||||
// 支付类型 new || renewal
|
||||
// 支付类型 new || renewal || credits
|
||||
private String type;
|
||||
|
||||
// 当前支付是否已邮件通知 0 || 1
|
||||
|
||||
27
src/main/java/com/ai/da/model/dto/QueryPaymentInfoDTO.java
Normal file
27
src/main/java/com/ai/da/model/dto/QueryPaymentInfoDTO.java
Normal file
@@ -0,0 +1,27 @@
|
||||
package com.ai.da.model.dto;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@NoArgsConstructor
|
||||
@Data
|
||||
@ApiModel("交易记录详情")
|
||||
public class QueryPaymentInfoDTO extends QueryPageByTimeDTO {
|
||||
@ApiModelProperty("选择的支付平台 PayPal || Stripe || Alipay-HK")
|
||||
private String platform;
|
||||
@ApiModelProperty("支付的金额 单位:HKD")
|
||||
private String payerTotal;
|
||||
@ApiModelProperty("商品种类 new || renewal || credits")
|
||||
private String type;
|
||||
@ApiModelProperty("交易状态 Success || Fail || Pending")
|
||||
private String status;
|
||||
@ApiModelProperty("付款人所在国家")
|
||||
private String country;
|
||||
@ApiModelProperty("付款人所在城市")
|
||||
private String city;
|
||||
|
||||
}
|
||||
32
src/main/java/com/ai/da/model/vo/PaymentInfoVO.java
Normal file
32
src/main/java/com/ai/da/model/vo/PaymentInfoVO.java
Normal file
@@ -0,0 +1,32 @@
|
||||
package com.ai.da.model.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@NoArgsConstructor
|
||||
@Data
|
||||
@ApiModel("交易记录详情")
|
||||
public class PaymentInfoVO {
|
||||
private Long id;
|
||||
@ApiModelProperty("选择的支付平台 PayPal || Stripe || Alipay-HK")
|
||||
private String platform;
|
||||
@ApiModelProperty("支付的金额 单位:HKD")
|
||||
private String payerTotal;
|
||||
@ApiModelProperty("商品种类 new || renewal || credits")
|
||||
private String type;
|
||||
@ApiModelProperty("交易状态 Success || Fail || Pending")
|
||||
private String status;
|
||||
@ApiModelProperty("付款人所在国家")
|
||||
private String country;
|
||||
@ApiModelProperty("付款人所在城市")
|
||||
private String city;
|
||||
@ApiModelProperty("使用Stripe具体的支付方式")
|
||||
private String paymentMethod;
|
||||
@ApiModelProperty("信用卡支付的卡号后四位")
|
||||
private String last4;
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
|
||||
private String createTime;
|
||||
}
|
||||
@@ -1,9 +1,12 @@
|
||||
package com.ai.da.service;
|
||||
|
||||
import com.ai.da.common.response.PageBaseResponse;
|
||||
import com.ai.da.mapper.primary.entity.Account;
|
||||
import com.ai.da.mapper.primary.entity.Questionnaire;
|
||||
import com.ai.da.mapper.primary.entity.TrialOrder;
|
||||
import com.ai.da.model.dto.AccountAddDTO;
|
||||
import com.ai.da.model.dto.QueryPaymentInfoDTO;
|
||||
import com.ai.da.model.vo.PaymentInfoVO;
|
||||
import com.ai.da.model.vo.QuestionnaireFeedbackVO;
|
||||
import com.ai.da.model.vo.QuestionnaireVO;
|
||||
import com.ai.da.model.vo.QueryUserConditionsVO;
|
||||
@@ -43,4 +46,6 @@ public interface ConvenientInquiryService extends IService<Questionnaire> {
|
||||
IPage<Account> getUserInfo(QueryUserConditionsVO queryUserConditionsVO);
|
||||
|
||||
List<Map<String, Object>> getAllUserIdList();
|
||||
|
||||
PageBaseResponse<PaymentInfoVO> queryTransactionRecords(QueryPaymentInfoDTO queryPaymentInfoDTO);
|
||||
}
|
||||
|
||||
@@ -17,11 +17,11 @@ public interface PaymentInfoService extends IService<PaymentInfo> {
|
||||
|
||||
void createPaymentInfo(String plainText);
|
||||
|
||||
void createPaymentInfoForAliPay(Map<String, String> params);
|
||||
void createPaymentInfoForAliPay(Map<String, String> params, String type);
|
||||
|
||||
void createPaymentInfoForPayPal(Order order);
|
||||
void createPaymentInfoForPayPal(Order order, String type);
|
||||
|
||||
void createPaymentInfoForAliPayHK(AlipayHKCallbackDTO alipayHKCallbackDTO);
|
||||
void createPaymentInfoForAliPayHK(AlipayHKCallbackDTO alipayHKCallbackDTO, String type);
|
||||
|
||||
PaymentInfo createOrUpdatePaymentInfoForStripe(Invoice invoice);
|
||||
|
||||
|
||||
@@ -1256,7 +1256,7 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
|
||||
private static final String QUERY_CUSTOMER_EMAIL = "SELECT username, email, country FROM pmr_wc_customer_lookup " +
|
||||
"WHERE customer_id = ? ";
|
||||
private static final String UPDATE_ORDER_STATUS = "UPDATE pmr_wc_order_stats " +
|
||||
"SET status = 'wc-complete' , date_completed = ? " +
|
||||
"SET status = 'wc-completed' , date_completed = ? " +
|
||||
"WHERE order_id = ?";
|
||||
|
||||
private static final DataSource dataSource;
|
||||
|
||||
@@ -211,7 +211,7 @@ public class AliPayServiceImpl implements AliPayService {
|
||||
//更新订单状态
|
||||
orderInfoService.updateStatusByOrderNo(orderNo, OrderStatusEnum.SUCCESS);
|
||||
//记录支付日志
|
||||
paymentInfoService.createPaymentInfoForAliPay(params);
|
||||
paymentInfoService.createPaymentInfoForAliPay(params,"credits");
|
||||
float quantity = Float.parseFloat(totalAmount) / Float.parseFloat(CreditsEventsEnum.PRICE.getValue());
|
||||
// 更新积分
|
||||
creditsService.buyCredits(orderByOrderNo.getAccountId(), quantity);
|
||||
@@ -315,7 +315,7 @@ public class AliPayServiceImpl implements AliPayService {
|
||||
//如果订单已支付,则更新商户端订单状态
|
||||
orderInfoService.updateStatusByOrderNo(orderNo, OrderStatusEnum.SUCCESS);
|
||||
//并记录支付日志
|
||||
paymentInfoService.createPaymentInfoForAliPay(alipayTradeQueryResponse);
|
||||
paymentInfoService.createPaymentInfoForAliPay(alipayTradeQueryResponse, "credits");
|
||||
float quantity = orderByOrderNo.getTotalFee() / Float.parseFloat(CreditsEventsEnum.PRICE.getValue());
|
||||
// 更新积分
|
||||
creditsService.buyCredits(orderByOrderNo.getAccountId(), quantity);
|
||||
|
||||
@@ -245,7 +245,7 @@ public class AlipayHKServiceImpl implements AlipayHKService {
|
||||
orderInfoService.updateStatusByOrderNo(orderNo, OrderStatusEnum.SUCCESS);
|
||||
log.info("Alipay-HK 订单:{} 状态更新成功",orderNo);
|
||||
//记录支付日志
|
||||
paymentInfoService.createPaymentInfoForAliPayHK(alipayHKCallbackDTO);
|
||||
paymentInfoService.createPaymentInfoForAliPayHK(alipayHKCallbackDTO, "credits");
|
||||
log.info("Alipay-HK 订单:{} 支付信息状态更新成功",orderNo);
|
||||
float quantity = Float.parseFloat(totalAmount) / Float.parseFloat(CreditsEventsEnum.PRICE.getValue());
|
||||
// 更新积分
|
||||
|
||||
@@ -4,19 +4,16 @@ import com.ai.da.common.config.exception.BusinessException;
|
||||
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.utils.CopyUtil;
|
||||
import com.ai.da.mapper.primary.AccountMapper;
|
||||
import com.ai.da.mapper.primary.QuestionnaireMapper;
|
||||
import com.ai.da.mapper.primary.ToProductImageResultMapper;
|
||||
import com.ai.da.mapper.primary.TrialOrderMapper;
|
||||
import com.ai.da.mapper.primary.*;
|
||||
import com.ai.da.mapper.primary.entity.Account;
|
||||
import com.ai.da.mapper.primary.entity.Questionnaire;
|
||||
import com.ai.da.mapper.primary.entity.TrialOrder;
|
||||
import com.ai.da.model.dto.AccountAddDTO;
|
||||
import com.ai.da.model.dto.QueryPaymentInfoDTO;
|
||||
import com.ai.da.model.enums.Language;
|
||||
import com.ai.da.model.vo.QuestionnaireFeedbackVO;
|
||||
import com.ai.da.model.vo.QuestionnaireVO;
|
||||
import com.ai.da.model.vo.QueryUserConditionsVO;
|
||||
import com.ai.da.model.vo.*;
|
||||
import com.ai.da.service.*;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
@@ -43,9 +40,22 @@ public class ConvenientInquiryServiceImpl extends ServiceImpl<QuestionnaireMappe
|
||||
|
||||
@Resource
|
||||
private AccountService accountService;
|
||||
|
||||
@Resource
|
||||
private AccountLoginLogService accountLoginLogService;
|
||||
@Resource
|
||||
private GenerateService generateService;
|
||||
@Resource
|
||||
private ToProductImageResultMapper toProductImageResultMapper;
|
||||
@Resource
|
||||
private DesignService designService;
|
||||
@Resource
|
||||
private DesignItemService designItemService;
|
||||
@Resource
|
||||
private ChatRobotService chatRobotService;
|
||||
@Resource
|
||||
private TrialOrderMapper trialOrderMapper;
|
||||
@Resource
|
||||
private PaymentInfoMapper paymentInfoMapper;
|
||||
|
||||
public IPage<TrialOrder> getTrial(QueryUserConditionsVO queryUserConditionsVO) {
|
||||
log.info("getTrial parameter : {},page:{}, size:{}", queryUserConditionsVO, queryUserConditionsVO.getPage(), queryUserConditionsVO.getSize());
|
||||
@@ -323,17 +333,6 @@ public class ConvenientInquiryServiceImpl extends ServiceImpl<QuestionnaireMappe
|
||||
return accountIds.size();
|
||||
}
|
||||
|
||||
@Resource
|
||||
private GenerateService generateService;
|
||||
@Resource
|
||||
private ToProductImageResultMapper toProductImageResultMapper;
|
||||
@Resource
|
||||
private DesignService designService;
|
||||
@Resource
|
||||
private DesignItemService designItemService;
|
||||
@Resource
|
||||
private ChatRobotService chatRobotService;
|
||||
|
||||
public Map<String, List<Object>> getActiveUserFunc(String startTime, String endTime, List<Long> ids) {
|
||||
|
||||
log.info("getActiveUserFunc ==> startTime:{}, endTime:{}, accountList:{}", startTime, endTime, ids);
|
||||
@@ -388,9 +387,6 @@ public class ConvenientInquiryServiceImpl extends ServiceImpl<QuestionnaireMappe
|
||||
return resp;
|
||||
}
|
||||
|
||||
@Resource
|
||||
private TrialOrderMapper trialOrderMapper;
|
||||
|
||||
// 试用用户到正式用户的转化率
|
||||
public Map<String, Object> conversionRate(String startTime, String endTime) {
|
||||
|
||||
@@ -457,7 +453,6 @@ public class ConvenientInquiryServiceImpl extends ServiceImpl<QuestionnaireMappe
|
||||
return resp;
|
||||
}
|
||||
|
||||
|
||||
// 新增用户
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean addUser(AccountAddDTO accountAddDTO) {
|
||||
@@ -618,5 +613,35 @@ public class ConvenientInquiryServiceImpl extends ServiceImpl<QuestionnaireMappe
|
||||
// return maps.stream().map(map -> (Long)map.get("id")).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询交易记录
|
||||
* 允许按日期,支付方式,支付金额,商品种类,交易状态,付款人的国家或城市查询,需要分页查询
|
||||
*/
|
||||
public PageBaseResponse<PaymentInfoVO> queryTransactionRecords(QueryPaymentInfoDTO queryPaymentInfoDTO) {
|
||||
Integer size = queryPaymentInfoDTO.getSize();
|
||||
int offset = (queryPaymentInfoDTO.getPage() - 1) * size;
|
||||
List<PaymentInfoVO> paymentInfoVOS = paymentInfoMapper.queryPaymentInfo(queryPaymentInfoDTO.getPlatform(), queryPaymentInfoDTO.getPayerTotal(),
|
||||
queryPaymentInfoDTO.getType(), queryPaymentInfoDTO.getStatus(),
|
||||
queryPaymentInfoDTO.getCountry(), queryPaymentInfoDTO.getCity(),
|
||||
queryPaymentInfoDTO.getStartTime(), queryPaymentInfoDTO.getEndTime(),
|
||||
size, offset);
|
||||
// 查询数据总量
|
||||
Long total = paymentInfoMapper.queryPaymentInfoCount(queryPaymentInfoDTO.getPlatform(), queryPaymentInfoDTO.getPayerTotal(),
|
||||
queryPaymentInfoDTO.getType(), queryPaymentInfoDTO.getStatus(),
|
||||
queryPaymentInfoDTO.getCountry(), queryPaymentInfoDTO.getCity(),
|
||||
queryPaymentInfoDTO.getStartTime(), queryPaymentInfoDTO.getEndTime());
|
||||
|
||||
// 总页数
|
||||
double totalPage = Math.ceil((double) total / size);
|
||||
// 组装返回参数
|
||||
PageBaseResponse<PaymentInfoVO> response = new PageBaseResponse<>();
|
||||
response.setContent(paymentInfoVOS);
|
||||
response.setPage(queryPaymentInfoDTO.getPage());
|
||||
response.setSize(size);
|
||||
response.setTotal(total);
|
||||
response.setPages((long) totalPage);
|
||||
return response;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -586,7 +586,7 @@ public class PayPalCheckoutServiceImpl implements PayPalCheckoutService {
|
||||
//更新订单状态
|
||||
orderInfoService.updateStatusByOrderNo(orderNo, OrderStatusEnum.SUCCESS);
|
||||
//记录支付日志
|
||||
paymentInfoService.createPaymentInfoForPayPal(capturedOrder);
|
||||
paymentInfoService.createPaymentInfoForPayPal(capturedOrder, "credits");
|
||||
float quantity = orderInfo.getTotalFee() / Float.parseFloat(CreditsEventsEnum.PRICE.getValue());
|
||||
// 更新积分
|
||||
creditsService.buyCredits(orderInfo.getAccountId(), quantity);
|
||||
@@ -629,7 +629,7 @@ public class PayPalCheckoutServiceImpl implements PayPalCheckoutService {
|
||||
//如果订单已支付,则更新商户端订单状态
|
||||
orderInfoService.updateStatusByOrderNo(orderNo, OrderStatusEnum.SUCCESS);
|
||||
//并记录支付日志
|
||||
paymentInfoService.createPaymentInfoForPayPal(result);
|
||||
paymentInfoService.createPaymentInfoForPayPal(result, "credits");
|
||||
float quantity = orderByOrderNo.getTotalFee() / Float.parseFloat(CreditsEventsEnum.PRICE.getValue());
|
||||
// 更新积分
|
||||
// creditsService.buyCredits(orderByOrderNo.getAccountId(),orderByOrderNo.getTotalFee() / Integer.parseInt(CreditsEventsEnum.PRICE.getValue()));
|
||||
|
||||
@@ -89,7 +89,7 @@ public class PaymentInfoServiceImpl extends ServiceImpl<PaymentInfoMapper, Payme
|
||||
* @param params
|
||||
*/
|
||||
@Override
|
||||
public void createPaymentInfoForAliPay(Map<String, String> params) {
|
||||
public void createPaymentInfoForAliPay(Map<String, String> params, String type) {
|
||||
|
||||
log.info("记录支付日志");
|
||||
|
||||
@@ -111,6 +111,7 @@ public class PaymentInfoServiceImpl extends ServiceImpl<PaymentInfoMapper, Payme
|
||||
paymentInfo.setTradeState(tradeStatus);
|
||||
// 原来的单位是分 Int 现改为元 Long
|
||||
paymentInfo.setPayerTotal(totalAmountInt / 100.0F);
|
||||
paymentInfo.setType(type);
|
||||
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(params, HashMap.class);
|
||||
@@ -126,7 +127,7 @@ public class PaymentInfoServiceImpl extends ServiceImpl<PaymentInfoMapper, Payme
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createPaymentInfoForPayPal(Order order) {
|
||||
public void createPaymentInfoForPayPal(Order order, String type) {
|
||||
|
||||
log.info("记录支付日志");
|
||||
|
||||
@@ -140,6 +141,7 @@ public class PaymentInfoServiceImpl extends ServiceImpl<PaymentInfoMapper, Payme
|
||||
paymentInfo.setTradeState(order.status());
|
||||
// 确认这里的数据单位是不是元
|
||||
paymentInfo.setPayerTotal(totalAmountFloat);
|
||||
paymentInfo.setType(type);
|
||||
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(order, Order.class);
|
||||
@@ -155,7 +157,7 @@ public class PaymentInfoServiceImpl extends ServiceImpl<PaymentInfoMapper, Payme
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createPaymentInfoForAliPayHK(AlipayHKCallbackDTO alipayHKCallbackDTO) {
|
||||
public void createPaymentInfoForAliPayHK(AlipayHKCallbackDTO alipayHKCallbackDTO, String type) {
|
||||
|
||||
log.info("记录支付日志");
|
||||
|
||||
@@ -176,6 +178,7 @@ public class PaymentInfoServiceImpl extends ServiceImpl<PaymentInfoMapper, Payme
|
||||
paymentInfo.setTransactionId(transactionId);
|
||||
paymentInfo.setTradeState(tradeStatus);
|
||||
paymentInfo.setPayerTotal(totalAmountFloat);
|
||||
paymentInfo.setType(type);
|
||||
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(alipayHKCallbackDTO);
|
||||
|
||||
@@ -44,5 +44,91 @@
|
||||
AND p.create_time BETWEEN #{startTime} AND #{endTime};
|
||||
</select>
|
||||
|
||||
<select id="queryPaymentInfo" resultType="com.ai.da.model.vo.PaymentInfoVO">
|
||||
SELECT
|
||||
id,
|
||||
payment_type platform,
|
||||
payer_total,
|
||||
type,
|
||||
payment_method,
|
||||
last4,
|
||||
country,
|
||||
city,
|
||||
create_time,
|
||||
CASE
|
||||
WHEN trade_state IN ('paid', 'COMPLETED', 'complete', 'liquidated') THEN 'Success'
|
||||
WHEN trade_state IN ('failed', 'expired', 'VOIDED', 'void', 'uncollectible') THEN 'Fail'
|
||||
ELSE 'Pending'
|
||||
END AS status
|
||||
FROM
|
||||
t_payment_info
|
||||
WHERE
|
||||
1 = 1
|
||||
<if test="paymentType != null and paymentType != ''">
|
||||
AND payment_type = #{paymentType}
|
||||
</if>
|
||||
<if test="payerTotal != null and payerTotal != ''">
|
||||
AND payer_total = #{payerTotal}
|
||||
</if>
|
||||
<if test="type != null and type != ''">
|
||||
AND type = #{type}
|
||||
</if>
|
||||
<if test="status != null and status != ''">
|
||||
AND
|
||||
CASE
|
||||
WHEN trade_state IN ('paid', 'COMPLETED', 'complete', 'liquidated') THEN 'Success'
|
||||
WHEN trade_state IN ('failed', 'expired', 'VOIDED', 'void', 'uncollectible') THEN 'Fail'
|
||||
ELSE 'Pending'
|
||||
END = #{status}
|
||||
</if>
|
||||
<if test="country != null and country != ''">
|
||||
AND country = #{country}
|
||||
</if>
|
||||
<if test="city != null and city != ''">
|
||||
AND city = #{city}
|
||||
</if>
|
||||
<if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
|
||||
AND create_time BETWEEN #{startTime} AND #{endTime}
|
||||
</if>
|
||||
ORDER BY
|
||||
id DESC
|
||||
LIMIT ${limit} OFFSET ${offset}
|
||||
</select>
|
||||
|
||||
<select id="queryPaymentInfoCount" resultType="java.lang.Long">
|
||||
SELECT
|
||||
COUNT(*)
|
||||
FROM
|
||||
t_payment_info
|
||||
WHERE
|
||||
1 = 1
|
||||
<if test="paymentType != null and paymentType != ''">
|
||||
AND payment_type = #{paymentType}
|
||||
</if>
|
||||
<if test="payerTotal != null and payerTotal != ''">
|
||||
AND payer_total = #{payerTotal}
|
||||
</if>
|
||||
<if test="type != null and type != ''">
|
||||
AND type = #{type}
|
||||
</if>
|
||||
<if test="status != null and status != ''">
|
||||
AND
|
||||
CASE
|
||||
WHEN trade_state IN ('paid', 'COMPLETED', 'complete', 'liquidated') THEN 'Success'
|
||||
WHEN trade_state IN ('failed', 'expired', 'VOIDED', 'void', 'uncollectible') THEN 'Fail'
|
||||
ELSE 'Pending'
|
||||
END = #{status}
|
||||
</if>
|
||||
<if test="country != null and country != ''">
|
||||
AND country = #{country}
|
||||
</if>
|
||||
<if test="city != null and city != ''">
|
||||
AND city = #{city}
|
||||
</if>
|
||||
<if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
|
||||
AND create_time BETWEEN #{startTime} AND #{endTime}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
|
||||
Reference in New Issue
Block a user