Adapay_payment 支付表

This commit is contained in:
Hawking 2023-05-31 18:50:46 +08:00
parent 05265ac17e
commit 210ade5f47
3 changed files with 61 additions and 49 deletions

View File

@ -41,9 +41,6 @@ public class PaymentDTO {
@JSONField(name = "query_url")
private String queryUrl;
@JSONField(name = "reason")
private String reason;
/**
* 当前交易状态
* pending 交易处理中
@ -95,6 +92,12 @@ public class PaymentDTO {
@JSONField(name = "refunded_amt")
private String refundedAmt;
/**
* 现金支付金额
*/
@JSONField(name = "cash_pay_amt")
private String cashPayAmt;
/**
* 创建时间(Adapay)
*/
@ -107,13 +110,19 @@ public class PaymentDTO {
@JSONField(name = "end_time")
private String endTime;
// --------- 以上为Adapay原生字段 ---------
// --------- 以下为扩展字段 ---------
private Long deptId;
private String payStatus;
private String availableAmt;
/**
* 用户支付完成时间(我方生成)
* 用户支付完成时间
*/
private LocalDateTime payTime;
/**
* 更新时间(我方生成/更新)
*/
private LocalDateTime updateTime;
private LocalDateTime createTime;
}

View File

@ -7,8 +7,8 @@ import com.ghy.common.adapay.AdapayProperties;
import com.ghy.common.adapay.model.*;
import com.ghy.common.enums.RefundType;
import com.huifu.adapay.core.exception.BaseAdaPayException;
import com.huifu.adapay.model.*;
import com.huifu.adapay.model.PaymentConfirm;
import com.huifu.adapay.model.*;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
@ -473,7 +473,8 @@ public class AdapayService {
paymentParams.put("expend", expend);
log.debug("paymentParams: {}", paymentParams.toJSONString());
JSONObject response = (JSONObject) Payment.create(paymentParams, deptId.toString());
executor.execute(() -> payCallbackService.onResponse(response));
response.put("deptId", deptId);
payCallbackService.onResponse(response);
return response;
}

View File

@ -2,64 +2,66 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ghy.payment.mapper.PaymentMapper">
<resultMap id="PaymentResult" type="com.ghy.common.adapay.model.PaymentDTO">
<result property="id" column="id"/>
<resultMap id="columns_map" type="com.ghy.common.adapay.model.PaymentDTO">
<id property="id" column="id"/>
<result property="orderNo" column="order_no"/>
<result property="prodMode" column="prod_mode"/>
<result property="appId" column="app_id"/>
<result property="payChannel" column="pay_channel"/>
<result property="payAmt" column="pay_amt"/>
<result property="partyOrderId" column="party_order_id"/>
<result property="queryUrl" column="query_url"/>
<result property="payMode" column="pay_mode"/>
<result property="status" column="status"/>
<result property="createdTime" column="created_time"/>
<result property="appId" column="app_id"/>
<result property="openId" column="open_id"/>
<result property="payChannel" column="pay_channel"/>
<result property="queryUrl" column="query_url"/>
<result property="partyOrderId" column="party_order_id"/>
<result property="payAmt" column="pay_amt"/>
<result property="discountAmt" column="discount_amt"/>
<result property="feeAmt" column="fee_amt"/>
<result property="cashPayAmt" column="cash_pay_amt"/>
<result property="confirmedAmt" column="confirmed_amt"/>
<result property="reservedAmt" column="reserved_amt"/>
<result property="refundedAmt" column="refunded_amt"/>
<result property="availableAmt" column="available_amt"/>
<result property="deptId" column="dept_id"/>
<result property="payStatus" column="pay_status"/>
<result property="payTime" column="pay_time"/>
<result property="createTime" column="create_time"/>
<result property="updateTime" column="update_time"/>
</resultMap>
<sql id="selectPayment">
SELECT id, order_no, prod_mode, app_id, pay_channel, pay_amt, party_order_id, query_url,
currency, status, pay_time, created_time, update_time
FROM adapay_pay_log
<sql id="select_columns">
SELECT id, dept_id, pay_status, status, pay_amt, discount_amt, fee_amt, cash_pay_amt, confirmed_amt,
reserved_amt, refunded_amt, available_amt, order_no, prod_mode, app_id, open_id, pay_channel,
query_url, pay_time, create_time, update_time
FROM adapay_payment
</sql>
<insert id="insertPayment" parameterType="com.ghy.common.adapay.model.PaymentDTO">
INSERT INTO adapay_pay_log(
<if test="id != null and id != ''">`id`,</if>
<if test="orderNo != null and orderNo != ''">`order_no`,</if>
<if test="prodMode != null and prodMode != ''">`prod_mode`,</if>
<if test="appId != null and appId != ''">`app_id`,</if>
<if test="payChannel != null and payChannel != ''">`pay_channel`,</if>
<if test="payAmt != null and payAmt != ''">`pay_amt`,</if>
<if test="partyOrderId != null and partyOrderId != ''">`party_order_id`,</if>
<if test="queryUrl != null and queryUrl != ''">`query_url`,</if>
<if test="status != null and status != ''">`status`,</if>
created_time
)VALUES(
<if test="id != null and id != ''">#{id},</if>
<if test="orderNo != null and orderNo != ''">#{orderNo},</if>
<if test="prodMode != null and prodMode != ''">#{prodMode},</if>
<if test="appId != null and appId != ''">#{appId},</if>
<if test="payChannel != null and payChannel != ''">#{payChannel},</if>
<if test="payAmt != null and payAmt != ''">#{payAmt},</if>
<if test="partyOrderId != null and partyOrderId != ''">#{partyOrderId},</if>
<if test="queryUrl != null and queryUrl != ''">#{queryUrl},</if>
<if test="status != null and status != ''">#{status},</if>
SYSDATE()
)
INSERT INTO adapay_payment(id, dept_id, status, pay_amt, discount_amt, fee_amt, cash_pay_amt,
order_no, query_url, prod_mode, app_id, open_id, pay_channel)
VALUES (#{id}, #{deptId}, #{status}, #{payAmt}, #{discountAmt}, #{feeAmt}, #{cashPayAmt},
#{orderNo}, #{queryUrl}, #{prodMode}, #{appId}, #{openId}, #{payChannel})
</insert>
<update id="updatePayment" parameterType="com.ghy.common.adapay.model.PaymentDTO">
UPDATE adapay_pay_log
UPDATE adapay_payment
<set>
<if test="status != null and status != ''">status = #{status},</if>
<if test="payTime != null">pay_time = #{payTime},</if>
update_time = SYSDATE()
<if test="status != null and status != ''">status = #{status},</if>
<if test="payStatus != null and payStatus != ''">pay_status = #{payStatus},</if>
<if test="openId != null and openId != ''">open_id = #{openId},</if>
<if test="feeAmt != null and feeAmt != ''">fee_amt = #{feeAmt},</if>
<if test="discountAmt != null and discountAmt != ''">discount_amt = #{discountAmt},</if>
<if test="confirmedAmt != null and confirmedAmt != ''">confirmed_amt = #{confirmedAmt},</if>
<if test="reservedAmt != null and reservedAmt != ''">reserved_amt = #{reservedAmt},</if>
<if test="refundedAmt != null and refundedAmt != ''">refunded_amt = #{refundedAmt},</if>
<if test="availableAmt != null and availableAmt != ''">available_amt = #{availableAmt},</if>
</set>
WHERE id = #{id}
</update>
<select id="selectById" resultMap="PaymentResult">
<include refid="selectPayment"/> WHERE id = #{id}
<select id="selectById" resultMap="columns_map">
<include refid="select_columns"/> WHERE id = #{id}
</select>
</mapper>