parent
63b4c27c8f
commit
04f53da686
@ -1,45 +0,0 @@
|
|||||||
package cn.iocoder.mall.pay.api.constant;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 支付退款状态枚举
|
|
||||||
*/
|
|
||||||
public enum PayRefundStatus {
|
|
||||||
|
|
||||||
WAITING(1, "处理中"),
|
|
||||||
SUCCESS(2, "成功"),
|
|
||||||
FAILURE(3, "失败"), // 例如说,支付单超时
|
|
||||||
;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 状态
|
|
||||||
*/
|
|
||||||
private Integer value;
|
|
||||||
/**
|
|
||||||
* 名字
|
|
||||||
*/
|
|
||||||
private String name;
|
|
||||||
|
|
||||||
PayRefundStatus(Integer value, String name) {
|
|
||||||
this.value = value;
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getValue() {
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public PayRefundStatus setValue(Integer value) {
|
|
||||||
this.value = value;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public PayRefundStatus setName(String name) {
|
|
||||||
this.name = name;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,38 +0,0 @@
|
|||||||
package cn.iocoder.mall.pay.biz.dao;
|
|
||||||
|
|
||||||
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 {
|
|
||||||
|
|
||||||
void insert(PayRefundDO entity);
|
|
||||||
|
|
||||||
int update(@Param("entity") PayRefundDO entity,
|
|
||||||
@Param("whereStatus") Integer whereStatus);
|
|
||||||
|
|
||||||
PayRefundDO selectById(@Param("id") Integer id);
|
|
||||||
|
|
||||||
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);
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,38 +0,0 @@
|
|||||||
package cn.iocoder.mall.pay.biz.dao;
|
|
||||||
|
|
||||||
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 {
|
|
||||||
|
|
||||||
int updateForRefundTotal(@Param("id") Integer id,
|
|
||||||
@Param("refundTotalIncr") Integer refundTotalIncr);
|
|
||||||
|
|
||||||
|
|
||||||
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);
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,122 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
||||||
<mapper namespace="cn.iocoder.mall.pay.biz.dao.PayRefundMapper">
|
|
||||||
|
|
||||||
<sql id="FIELDS">
|
|
||||||
id, transaction_id, refund_code, app_id, create_ip, order_id,
|
|
||||||
order_description, price, status,
|
|
||||||
finish_time, notify_url, extension_data, refund_channel, refund_time, notify_time,
|
|
||||||
trade_no, create_time
|
|
||||||
</sql>
|
|
||||||
|
|
||||||
<insert id="insert" parameterType="PayRefundDO" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
|
|
||||||
INSERT INTO refund (
|
|
||||||
transaction_id, refund_code, app_id, create_ip, order_id,
|
|
||||||
order_description, price, status,
|
|
||||||
finish_time, notify_url, extension_data, refund_channel, refund_time, notify_time,
|
|
||||||
trade_no, create_time
|
|
||||||
) VALUES (
|
|
||||||
#{transactionId}, #{refundCode}, #{appId}, #{createIp}, #{orderId},
|
|
||||||
#{orderDescription}, #{price}, #{status},
|
|
||||||
#{finishTime}, #{notifyUrl}, #{extensionData}, #{refundChannel}, #{refundTime}, #{notifyTime},
|
|
||||||
#{tradeNo}, #{createTime}
|
|
||||||
)
|
|
||||||
</insert>
|
|
||||||
|
|
||||||
<update id="update">
|
|
||||||
UPDATE refund
|
|
||||||
<set>
|
|
||||||
<if test="entity.status != null">
|
|
||||||
, status = #{entity.status}
|
|
||||||
</if>
|
|
||||||
<if test="entity.finishTime != null">
|
|
||||||
, finish_time = #{entity.finishTime}
|
|
||||||
</if>
|
|
||||||
<if test="entity.extensionData != null">
|
|
||||||
, extension_data = #{entity.extensionData}
|
|
||||||
</if>
|
|
||||||
<if test="entity.refundTime != null">
|
|
||||||
, refund_time = #{entity.refundTime}
|
|
||||||
</if>
|
|
||||||
<if test="entity.notifyTime != null">
|
|
||||||
, notify_time = #{entity.notifyTime}
|
|
||||||
</if>
|
|
||||||
<if test="entity.tradeNo != null">
|
|
||||||
, trade_no = #{entity.tradeNo}
|
|
||||||
</if>
|
|
||||||
</set>
|
|
||||||
WHERE id = #{entity.id}
|
|
||||||
<if test="whereStatus != null">
|
|
||||||
AND status = #{whereStatus}
|
|
||||||
</if>
|
|
||||||
</update>
|
|
||||||
|
|
||||||
<select id="selectByRefundCode" parameterType="String" resultType="PayRefundDO">
|
|
||||||
SELECT
|
|
||||||
<include refid="FIELDS"/>
|
|
||||||
FROM refund
|
|
||||||
WHERE refund_code = #{refundCode}
|
|
||||||
LIMIT 1
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<select id="selectById" parameterType="Integer" resultType="PayRefundDO">
|
|
||||||
SELECT
|
|
||||||
<include refid="FIELDS"/>
|
|
||||||
FROM refund
|
|
||||||
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>
|
|
||||||
@ -1,25 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
||||||
<mapper namespace="cn.iocoder.mall.pay.biz.dao.PayTransactionExtensionMapper">
|
|
||||||
|
|
||||||
<sql id="FIELDS">
|
|
||||||
id, transaction_id, pay_channel, transaction_code, extension_data,
|
|
||||||
create_ip, status, create_time
|
|
||||||
</sql>
|
|
||||||
|
|
||||||
<select id="selectByTransactionCode" parameterType="String" resultType="PayTransactionExtensionDO">
|
|
||||||
SELECT
|
|
||||||
<include refid="FIELDS"/>
|
|
||||||
FROM transaction_extension
|
|
||||||
WHERE transaction_code = #{transactionCode}
|
|
||||||
LIMIT 1
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<select id="selectById" parameterType="Integer" resultType="PayTransactionExtensionDO">
|
|
||||||
SELECT
|
|
||||||
<include refid="FIELDS"/>
|
|
||||||
FROM transaction_extension
|
|
||||||
WHERE id = #{id}
|
|
||||||
</select>
|
|
||||||
|
|
||||||
</mapper>
|
|
||||||
@ -1,128 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
||||||
<mapper namespace="cn.iocoder.mall.pay.biz.dao.PayTransactionMapper">
|
|
||||||
|
|
||||||
<sql id="FIELDS">
|
|
||||||
id, app_id, create_ip, order_id, order_subject,
|
|
||||||
order_description, order_memo, price, status, expire_time,
|
|
||||||
finish_time, notify_url, extension_id, pay_channel, payment_time,
|
|
||||||
notify_time, trade_no, refund_total, create_time
|
|
||||||
</sql>
|
|
||||||
|
|
||||||
<update id="update">
|
|
||||||
UPDATE transaction
|
|
||||||
<set>
|
|
||||||
<if test="entity.status != null">
|
|
||||||
, status = #{entity.status}
|
|
||||||
</if>
|
|
||||||
<if test="entity.extensionId != null">
|
|
||||||
, extension_id = #{entity.extensionId}
|
|
||||||
</if>
|
|
||||||
<if test="entity.payChannel != null">
|
|
||||||
, pay_channel = #{entity.payChannel}
|
|
||||||
</if>
|
|
||||||
<if test="entity.paymentTime != null">
|
|
||||||
, payment_time = #{entity.paymentTime}
|
|
||||||
</if>
|
|
||||||
<if test="entity.finishTime != null">
|
|
||||||
, finish_time = #{entity.finishTime}
|
|
||||||
</if>
|
|
||||||
<if test="entity.notifyTime != null">
|
|
||||||
, notify_time = #{entity.notifyTime}
|
|
||||||
</if>
|
|
||||||
<if test="entity.tradeNo != null">
|
|
||||||
, trade_no = #{entity.tradeNo}
|
|
||||||
</if>
|
|
||||||
</set>
|
|
||||||
WHERE id = #{entity.id}
|
|
||||||
<if test="whereStatus != null">
|
|
||||||
AND status = #{whereStatus}
|
|
||||||
</if>
|
|
||||||
</update>
|
|
||||||
|
|
||||||
<update id="updateForRefundTotal">
|
|
||||||
UPDATE `transaction`
|
|
||||||
SET refund_total = refund_total + ${refundTotalIncr}
|
|
||||||
WHERE price >= refund_total + ${refundTotalIncr}
|
|
||||||
</update>
|
|
||||||
|
|
||||||
<select id="selectByAppIdAndOrderId" resultType="PayTransactionDO">
|
|
||||||
SELECT
|
|
||||||
<include refid="FIELDS"/>
|
|
||||||
FROM transaction
|
|
||||||
WHERE app_id = #{appId}
|
|
||||||
AND order_id = #{orderId}
|
|
||||||
</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>
|
|
||||||
@ -0,0 +1,30 @@
|
|||||||
|
package cn.iocoder.mall.payservice.enums.refund;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 支付退款状态枚举
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
public enum PayRefundStatus {
|
||||||
|
|
||||||
|
WAITING(1, "处理中"),
|
||||||
|
SUCCESS(2, "成功"),
|
||||||
|
FAILURE(3, "失败"), // 例如说,支付单超时
|
||||||
|
;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 状态
|
||||||
|
*/
|
||||||
|
private final Integer value;
|
||||||
|
/**
|
||||||
|
* 名字
|
||||||
|
*/
|
||||||
|
private final String name;
|
||||||
|
|
||||||
|
PayRefundStatus(Integer value, String name) {
|
||||||
|
this.value = value;
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1 @@
|
|||||||
|
package cn.iocoder.mall.payservice.common;
|
||||||
@ -0,0 +1,57 @@
|
|||||||
|
package cn.iocoder.mall.payservice.dal.mysql.mapper.refund;
|
||||||
|
|
||||||
|
import cn.iocoder.mall.payservice.dal.mysql.dataobject.refund.PayRefundDO;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
@Repository
|
||||||
|
public interface PayRefundMapper extends BaseMapper<PayRefundDO> {
|
||||||
|
|
||||||
|
default int update(PayRefundDO entity, Integer whereStatus) {
|
||||||
|
return update(entity, new QueryWrapper<PayRefundDO>()
|
||||||
|
.eq("id", entity.getId()).eq("status", whereStatus));
|
||||||
|
}
|
||||||
|
|
||||||
|
default PayRefundDO selectByRefundCode(String refundCode) {
|
||||||
|
return selectOne(new QueryWrapper<PayRefundDO>()
|
||||||
|
.eq("refund_code", refundCode));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// <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>
|
||||||
|
|
||||||
|
// 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);
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
Reference in new issue