- 前端:支付单列表
- 前端:退款单列表
This commit is contained in:
@@ -1,11 +1,14 @@
|
||||
package cn.iocoder.mall.pay.biz.convert;
|
||||
|
||||
import cn.iocoder.mall.pay.api.bo.PayRefundBO;
|
||||
import cn.iocoder.mall.pay.api.dto.PayRefundSubmitDTO;
|
||||
import cn.iocoder.mall.pay.biz.dataobject.PayRefundDO;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.Mappings;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface PayRefundConvert {
|
||||
|
||||
@@ -14,4 +17,10 @@ public interface PayRefundConvert {
|
||||
@Mappings({})
|
||||
PayRefundDO convert(PayRefundSubmitDTO payRefundSubmitDTO);
|
||||
|
||||
@Mappings({})
|
||||
PayRefundBO convert(PayRefundDO refund);
|
||||
|
||||
@Mappings({})
|
||||
List<PayRefundBO> convertList(List<PayRefundDO> refunds);
|
||||
|
||||
}
|
||||
|
||||
@@ -9,6 +9,8 @@ import org.mapstruct.Mapper;
|
||||
import org.mapstruct.Mappings;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface PayTransactionConvert {
|
||||
|
||||
@@ -20,6 +22,9 @@ public interface PayTransactionConvert {
|
||||
@Mappings({})
|
||||
PayTransactionBO convert(PayTransactionDO payTransactionDO);
|
||||
|
||||
@Mappings({})
|
||||
List<PayTransactionBO> convertList(List<PayTransactionDO> list);
|
||||
|
||||
@Mappings({})
|
||||
PayTransactionExtensionDO convert(PayTransactionSubmitDTO payTransactionSubmitDTO);
|
||||
|
||||
|
||||
@@ -4,6 +4,9 @@ import cn.iocoder.mall.pay.biz.dataobject.PayRefundDO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Repository
|
||||
public interface PayRefundMapper {
|
||||
|
||||
@@ -16,4 +19,20 @@ public interface PayRefundMapper {
|
||||
|
||||
PayRefundDO selectByRefundCode(@Param("refundCode") String refundCode);
|
||||
|
||||
List<PayRefundDO> selectListByPage(@Param("createBeginTime") Date createBeginTime,
|
||||
@Param("createEndTime") Date createEndTime,
|
||||
@Param("finishBeginTime") Date finishBeginTime,
|
||||
@Param("finishEndTime") Date finishEndTime,
|
||||
@Param("status") Integer status,
|
||||
@Param("payChannel") Integer payChannel,
|
||||
@Param("offset") Integer offset,
|
||||
@Param("limit") Integer limit);
|
||||
|
||||
Integer selectCountByPage(@Param("createBeginTime") Date createBeginTime,
|
||||
@Param("createEndTime") Date createEndTime,
|
||||
@Param("finishBeginTime") Date finishBeginTime,
|
||||
@Param("finishEndTime") Date finishEndTime,
|
||||
@Param("status") Integer status,
|
||||
@Param("payChannel") Integer payChannel);
|
||||
|
||||
}
|
||||
|
||||
@@ -4,6 +4,10 @@ import cn.iocoder.mall.pay.biz.dataobject.PayTransactionDO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Repository
|
||||
public interface PayTransactionMapper {
|
||||
|
||||
@@ -20,4 +24,26 @@ public interface PayTransactionMapper {
|
||||
|
||||
PayTransactionDO selectById(@Param("id") Integer id);
|
||||
|
||||
List<PayTransactionDO> selectListByIds(@Param("ids") Collection<Integer> ids);
|
||||
|
||||
List<PayTransactionDO> selectListByPage(@Param("createBeginTime") Date createBeginTime,
|
||||
@Param("createEndTime") Date createEndTime,
|
||||
@Param("paymentBeginTime") Date paymentBeginTime,
|
||||
@Param("paymentEndTime") Date paymentEndTime,
|
||||
@Param("status") Integer status,
|
||||
@Param("hasRefund") Boolean hasRefund,
|
||||
@Param("payChannel") Integer payChannel,
|
||||
@Param("orderSubject") String orderSubject,
|
||||
@Param("offset") Integer offset,
|
||||
@Param("limit") Integer limit);
|
||||
|
||||
Integer selectCountByPage(@Param("createBeginTime") Date createBeginTime,
|
||||
@Param("createEndTime") Date createEndTime,
|
||||
@Param("paymentBeginTime") Date paymentBeginTime,
|
||||
@Param("paymentEndTime") Date paymentEndTime,
|
||||
@Param("status") Integer status,
|
||||
@Param("hasRefund") Boolean hasRefund,
|
||||
@Param("payChannel") Integer payChannel,
|
||||
@Param("orderSubject") String orderSubject);
|
||||
|
||||
}
|
||||
|
||||
@@ -5,10 +5,12 @@ import cn.iocoder.common.framework.util.MathUtil;
|
||||
import cn.iocoder.common.framework.util.ServiceExceptionUtil;
|
||||
import cn.iocoder.common.framework.vo.CommonResult;
|
||||
import cn.iocoder.mall.pay.api.PayRefundService;
|
||||
import cn.iocoder.mall.pay.api.bo.PayRefundPageBO;
|
||||
import cn.iocoder.mall.pay.api.bo.PayRefundSubmitBO;
|
||||
import cn.iocoder.mall.pay.api.constant.PayErrorCodeEnum;
|
||||
import cn.iocoder.mall.pay.api.constant.PayRefundStatus;
|
||||
import cn.iocoder.mall.pay.api.constant.PayTransactionStatusEnum;
|
||||
import cn.iocoder.mall.pay.api.dto.PayRefundPageDTO;
|
||||
import cn.iocoder.mall.pay.api.dto.PayRefundSubmitDTO;
|
||||
import cn.iocoder.mall.pay.biz.client.AbstractPaySDK;
|
||||
import cn.iocoder.mall.pay.biz.client.PaySDKFactory;
|
||||
@@ -30,7 +32,7 @@ import javax.annotation.Resource;
|
||||
import java.util.Date;
|
||||
|
||||
@Service
|
||||
@org.apache.dubbo.config.annotation.Service(validation = "true")
|
||||
@org.apache.dubbo.config.annotation.Service(validation = "true", version = "${dubbo.provider.PayRefundService.version}")
|
||||
public class PayRefundServiceImpl implements PayRefundService {
|
||||
|
||||
private Logger logger = LoggerFactory.getLogger(getClass());
|
||||
@@ -120,6 +122,7 @@ public class PayRefundServiceImpl implements PayRefundService {
|
||||
PayRefundDO updatePayRefundDO = new PayRefundDO()
|
||||
.setId(payRefund.getId())
|
||||
.setStatus(status)
|
||||
.setTradeNo(paySuccessResult.getData().getTradeNo())
|
||||
.setExtensionData(params);
|
||||
int updateCounts = payRefundMapper.update(updatePayRefundDO, PayRefundStatus.WAITING.getValue());
|
||||
if (updateCounts == 0) { // 校验状态,必须是待支付
|
||||
@@ -147,6 +150,24 @@ public class PayRefundServiceImpl implements PayRefundService {
|
||||
return CommonResult.success(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PayRefundPageBO getRefundPage(PayRefundPageDTO payRefundPageDTO) {
|
||||
PayRefundPageBO payRefundPageBO = new PayRefundPageBO();
|
||||
// 查询分页数据
|
||||
int offset = (payRefundPageDTO.getPageNo() - 1) * payRefundPageDTO.getPageSize();
|
||||
payRefundPageBO.setList(PayRefundConvert.INSTANCE.convertList(payRefundMapper.selectListByPage(
|
||||
payRefundPageDTO.getCreateBeginTime(), payRefundPageDTO.getCreateEndTime(),
|
||||
payRefundPageDTO.getFinishBeginTime(), payRefundPageDTO.getFinishEndTime(),
|
||||
payRefundPageDTO.getStatus(), payRefundPageDTO.getPayChannel(),
|
||||
offset, payRefundPageDTO.getPageSize())));
|
||||
// 查询分页总数
|
||||
payRefundPageBO.setTotal(payRefundMapper.selectCountByPage(
|
||||
payRefundPageDTO.getCreateBeginTime(), payRefundPageDTO.getCreateEndTime(),
|
||||
payRefundPageDTO.getFinishBeginTime(), payRefundPageDTO.getFinishEndTime(),
|
||||
payRefundPageDTO.getStatus(), payRefundPageDTO.getPayChannel()));
|
||||
return payRefundPageBO;
|
||||
}
|
||||
|
||||
private String generateTransactionCode() {
|
||||
// wx
|
||||
// 2014
|
||||
|
||||
@@ -6,18 +6,20 @@ import cn.iocoder.common.framework.util.ServiceExceptionUtil;
|
||||
import cn.iocoder.common.framework.vo.CommonResult;
|
||||
import cn.iocoder.mall.pay.api.PayTransactionService;
|
||||
import cn.iocoder.mall.pay.api.bo.PayTransactionBO;
|
||||
import cn.iocoder.mall.pay.api.bo.PayTransactionPageBO;
|
||||
import cn.iocoder.mall.pay.api.bo.PayTransactionSubmitBO;
|
||||
import cn.iocoder.mall.pay.api.constant.PayErrorCodeEnum;
|
||||
import cn.iocoder.mall.pay.api.constant.PayTransactionStatusEnum;
|
||||
import cn.iocoder.mall.pay.api.dto.PayTransactionCreateDTO;
|
||||
import cn.iocoder.mall.pay.api.dto.PayTransactionPageDTO;
|
||||
import cn.iocoder.mall.pay.api.dto.PayTransactionSubmitDTO;
|
||||
import cn.iocoder.mall.pay.biz.client.AbstractPaySDK;
|
||||
import cn.iocoder.mall.pay.biz.client.PaySDKFactory;
|
||||
import cn.iocoder.mall.pay.biz.client.TransactionSuccessBO;
|
||||
import cn.iocoder.mall.pay.biz.convert.PayTransactionConvert;
|
||||
import cn.iocoder.mall.pay.biz.dao.PayNotifyTaskMapper;
|
||||
import cn.iocoder.mall.pay.biz.dao.PayTransactionExtensionMapper;
|
||||
import cn.iocoder.mall.pay.biz.dao.PayTransactionMapper;
|
||||
import cn.iocoder.mall.pay.biz.dao.PayNotifyTaskMapper;
|
||||
import cn.iocoder.mall.pay.biz.dataobject.PayAppDO;
|
||||
import cn.iocoder.mall.pay.biz.dataobject.PayTransactionDO;
|
||||
import cn.iocoder.mall.pay.biz.dataobject.PayTransactionExtensionDO;
|
||||
@@ -27,10 +29,12 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
@org.apache.dubbo.config.annotation.Service(validation = "true")
|
||||
@org.apache.dubbo.config.annotation.Service(validation = "true", version = "${dubbo.provider.PayTransactionService.version}")
|
||||
public class PayTransactionServiceImpl implements PayTransactionService {
|
||||
|
||||
private Logger logger = LoggerFactory.getLogger(getClass());
|
||||
@@ -193,6 +197,31 @@ public class PayTransactionServiceImpl implements PayTransactionService {
|
||||
return CommonResult.success(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PayTransactionBO> getTransactionList(Collection<Integer> ids) {
|
||||
return PayTransactionConvert.INSTANCE.convertList(payTransactionMapper.selectListByIds(ids));
|
||||
}
|
||||
|
||||
@Override
|
||||
public PayTransactionPageBO getTransactionPage(PayTransactionPageDTO payTransactionPageDTO) {
|
||||
PayTransactionPageBO payTransactionPage = new PayTransactionPageBO();
|
||||
// 查询分页数据
|
||||
int offset = (payTransactionPageDTO.getPageNo() - 1) * payTransactionPageDTO.getPageSize();
|
||||
payTransactionPage.setList(PayTransactionConvert.INSTANCE.convertList(payTransactionMapper.selectListByPage(
|
||||
payTransactionPageDTO.getCreateBeginTime(), payTransactionPageDTO.getCreateEndTime(),
|
||||
payTransactionPageDTO.getPaymentBeginTime(), payTransactionPageDTO.getPaymentEndTime(),
|
||||
payTransactionPageDTO.getStatus(), payTransactionPageDTO.getHasRefund(),
|
||||
payTransactionPageDTO.getPayChannel(), payTransactionPageDTO.getOrderSubject(),
|
||||
offset, payTransactionPageDTO.getPageSize())));
|
||||
// 查询分页总数
|
||||
payTransactionPage.setTotal(payTransactionMapper.selectCountByPage(
|
||||
payTransactionPageDTO.getCreateBeginTime(), payTransactionPageDTO.getCreateEndTime(),
|
||||
payTransactionPageDTO.getPaymentBeginTime(), payTransactionPageDTO.getPaymentEndTime(),
|
||||
payTransactionPageDTO.getStatus(), payTransactionPageDTO.getHasRefund(),
|
||||
payTransactionPageDTO.getPayChannel(), payTransactionPageDTO.getOrderSubject()));
|
||||
return payTransactionPage;
|
||||
}
|
||||
|
||||
@Override // TODO 芋艿,后面去实现
|
||||
public CommonResult cancelTransaction() {
|
||||
return null;
|
||||
|
||||
@@ -23,6 +23,11 @@ dubbo:
|
||||
name: dubbo
|
||||
scan:
|
||||
base-packages: cn.iocoder.mall.pay.biz.service
|
||||
provider:
|
||||
PayTransactionService:
|
||||
version: 1.0.0
|
||||
PayRefundService:
|
||||
version: 1.0.0
|
||||
|
||||
# rocketmq
|
||||
rocketmq:
|
||||
|
||||
@@ -66,4 +66,57 @@
|
||||
WHERE id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="selectListByPage" resultType="PayRefundDO">
|
||||
SELECT
|
||||
<include refid="FIELDS"/>
|
||||
FROM refund
|
||||
<where>
|
||||
<if test="createBeginTime != null">
|
||||
AND create_time >= #{createBeginTime}
|
||||
</if>
|
||||
<if test="createEndTime != null">
|
||||
AND #{createEndTime} >= create_time
|
||||
</if>
|
||||
<if test="finishBeginTime != null">
|
||||
AND finish_time >= #{finishBeginTime}
|
||||
</if>
|
||||
<if test="finishEndTime != null">
|
||||
AND #{finishEndTime} >= finish_time
|
||||
</if>
|
||||
<if test="status != null">
|
||||
AND status = #{status}
|
||||
</if>
|
||||
<if test="payChannel != null">
|
||||
AND pay_channel = #{payChannel}
|
||||
</if>
|
||||
</where>
|
||||
LIMIT #{offset}, #{limit}
|
||||
</select>
|
||||
|
||||
<select id="selectCountByPage" resultType="Integer">
|
||||
SELECT
|
||||
COUNT(1)
|
||||
FROM refund
|
||||
<where>
|
||||
<if test="createBeginTime != null">
|
||||
AND create_time >= #{createBeginTime}
|
||||
</if>
|
||||
<if test="createEndTime != null">
|
||||
AND #{createEndTime} >= create_time
|
||||
</if>
|
||||
<if test="finishBeginTime != null">
|
||||
AND finish_time >= #{finishBeginTime}
|
||||
</if>
|
||||
<if test="finishEndTime != null">
|
||||
AND #{finishEndTime} >= finish_time
|
||||
</if>
|
||||
<if test="status != null">
|
||||
AND status = #{status}
|
||||
</if>
|
||||
<if test="payChannel != null">
|
||||
AND pay_channel = #{payChannel}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
@@ -75,4 +75,85 @@
|
||||
WHERE id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="selectListByIds" resultType="PayTransactionDO">
|
||||
SELECT
|
||||
<include refid="FIELDS" />
|
||||
FROM transaction
|
||||
WHERE id IN
|
||||
<foreach item="id" collection="ids" separator="," open="(" close=")" index="">
|
||||
#{id}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
<select id="selectListByPage" resultType="PayTransactionDO">
|
||||
SELECT
|
||||
<include refid="FIELDS"/>
|
||||
FROM transaction
|
||||
<where>
|
||||
<if test="createBeginTime != null">
|
||||
AND create_time >= #{createBeginTime}
|
||||
</if>
|
||||
<if test="createEndTime != null">
|
||||
AND #{createEndTime} >= create_time
|
||||
</if>
|
||||
<if test="paymentBeginTime != null">
|
||||
AND payment_time >= #{paymentBeginTime}
|
||||
</if>
|
||||
<if test="paymentEndTime != null">
|
||||
AND #{paymentEndTime} >= payment_time
|
||||
</if>
|
||||
<if test="status != null">
|
||||
AND status = #{status}
|
||||
</if>
|
||||
<if test="hasRefund == true">
|
||||
AND refund_total > 0
|
||||
</if>
|
||||
<if test="hasRefund == false">
|
||||
AND refund_total = 0
|
||||
</if>
|
||||
<if test="payChannel != null">
|
||||
AND pay_channel = #{payChannel}
|
||||
</if>
|
||||
<if test="orderSubject != null">
|
||||
order_subject LIKE "%"#{orderSubject}"%"
|
||||
</if>
|
||||
</where>
|
||||
LIMIT #{offset}, #{limit}
|
||||
</select>
|
||||
|
||||
<select id="selectCountByPage" resultType="Integer">
|
||||
SELECT
|
||||
COUNT(1)
|
||||
FROM transaction
|
||||
<where>
|
||||
<if test="createBeginTime != null">
|
||||
AND create_time >= #{createBeginTime}
|
||||
</if>
|
||||
<if test="createEndTime != null">
|
||||
AND #{createEndTime} >= create_time
|
||||
</if>
|
||||
<if test="paymentBeginTime != null">
|
||||
AND payment_time >= #{paymentBeginTime}
|
||||
</if>
|
||||
<if test="paymentEndTime != null">
|
||||
AND #{paymentEndTime} >= payment_time
|
||||
</if>
|
||||
<if test="status != null">
|
||||
AND status = #{status}
|
||||
</if>
|
||||
<if test="hasRefund == true">
|
||||
AND refund_total > 0
|
||||
</if>
|
||||
<if test="hasRefund == false">
|
||||
AND refund_total = 0
|
||||
</if>
|
||||
<if test="payChannel != null">
|
||||
AND pay_channel = #{payChannel}
|
||||
</if>
|
||||
<if test="orderSubject != null">
|
||||
order_subject LIKE "%"#{orderSubject}"%"
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
Reference in New Issue
Block a user