后端:增加部分退款逻辑
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
# xxl-job
|
||||
xxl:
|
||||
job:
|
||||
admin:
|
||||
addresses: http://127.0.0.1:18079/
|
||||
executor:
|
||||
appname: pay-job-executor
|
||||
ip:
|
||||
port: 0
|
||||
logpath: /Users/yunai/logs/xxl-job/
|
||||
logretentiondays: 1
|
||||
accessToken:
|
||||
@@ -24,19 +24,6 @@ dubbo:
|
||||
scan:
|
||||
base-packages: cn.iocoder.mall.pay.biz.service
|
||||
|
||||
# xxl-job
|
||||
xxl:
|
||||
job:
|
||||
admin:
|
||||
addresses: http://127.0.0.1:18079/
|
||||
executor:
|
||||
appname: pay-job-executor
|
||||
ip:
|
||||
port: 0
|
||||
logpath: /Users/yunai/logs/xxl-job/
|
||||
logretentiondays: 1
|
||||
accessToken:
|
||||
|
||||
# rocketmq
|
||||
rocketmq:
|
||||
name-server: 127.0.0.1:9876
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<mapper namespace="cn.iocoder.mall.pay.biz.dao.PayAppMapper">
|
||||
|
||||
<sql id="FIELDS">
|
||||
id, name, notify_url, status, create_time
|
||||
id, name, notify_url, refund_notify_url, status, create_time
|
||||
</sql>
|
||||
|
||||
<!--<insert id="insert" parameterType="RoleDO" useGeneratedKeys="true" keyColumn="id" keyProperty="id">-->
|
||||
@@ -34,4 +34,4 @@
|
||||
WHERE id = #{id}
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
</mapper>
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
<?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_cod, 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>
|
||||
|
||||
</mapper>
|
||||
@@ -41,4 +41,11 @@
|
||||
LIMIT 1
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
<select id="selectById" parameterType="Integer" resultType="PayTransactionExtensionDO">
|
||||
SELECT
|
||||
<include refid="FIELDS"/>
|
||||
FROM transaction_extension
|
||||
WHERE id = #{id}
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
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, create_time
|
||||
notify_time, trade_no, refund_total, create_time
|
||||
</sql>
|
||||
|
||||
<insert id="insert" parameterType="PayTransactionDO" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
|
||||
@@ -54,6 +54,12 @@
|
||||
</if>
|
||||
</update>
|
||||
|
||||
<update id="updateForRefundTotal">
|
||||
UPDATE `transaction`
|
||||
SET refundTotal = refundTotal + ${refundTotalIncr}
|
||||
WHERE price >= refundTotal + ${refundTotalIncr}
|
||||
</update>
|
||||
|
||||
<select id="selectByAppIdAndOrderId" resultType="PayTransactionDO">
|
||||
SELECT
|
||||
<include refid="FIELDS"/>
|
||||
@@ -69,4 +75,4 @@
|
||||
WHERE id = #{id}
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
</mapper>
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
<!--create_time-->
|
||||
<!--</sql>-->
|
||||
|
||||
<insert id="insert" parameterType="PayTransactionNotifyLogDO" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
|
||||
<insert id="insert" parameterType="PayNotifyLogDO" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
|
||||
INSERT INTO transaction_notify_log (
|
||||
notify_id, request, response, status
|
||||
) VALUES (
|
||||
@@ -43,4 +43,4 @@
|
||||
<!--LIMIT 1-->
|
||||
<!--</select>-->
|
||||
|
||||
</mapper>
|
||||
</mapper>
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
create_time
|
||||
</sql>
|
||||
|
||||
<insert id="insert" parameterType="PayTransactionNotifyTaskDO" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
|
||||
<insert id="insert" parameterType="PayNotifyTaskDO" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
|
||||
INSERT INTO transaction_notify_task (
|
||||
transaction_id, transaction_extension_id, app_id, order_id,
|
||||
status, next_notify_time, notify_times, max_notify_times
|
||||
@@ -18,7 +18,7 @@
|
||||
)
|
||||
</insert>
|
||||
|
||||
<update id="update" parameterType="PayTransactionNotifyTaskDO">
|
||||
<update id="update" parameterType="PayNotifyTaskDO">
|
||||
UPDATE transaction_notify_task
|
||||
<set>
|
||||
<if test="status != null">
|
||||
@@ -37,13 +37,13 @@
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
<select id="selectByNotify" resultType="PayTransactionNotifyTaskDO">
|
||||
<select id="selectByNotify" resultType="PayNotifyTaskDO">
|
||||
SELECT
|
||||
<include refid="FIELDS"/>
|
||||
FROM transaction_notify_task
|
||||
WHERE status IN (1, 3, 4, 5)
|
||||
WHERE status IN (1, 4, 5)
|
||||
AND next_notify_time <![CDATA[ <= ]]> NOW()
|
||||
AND last_execute_time > next_notify_time
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
</mapper>
|
||||
|
||||
Reference in New Issue
Block a user