加剩余金额字段

This commit is contained in:
2023-08-10 15:13:19 +08:00
parent aa11800f59
commit df776b0466
5 changed files with 154 additions and 69 deletions

View File

@@ -1,16 +1,13 @@
package com.jsowell.pile.domain;
import lombok.*;
import java.math.BigDecimal;
import java.util.Date;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
/**
* 会员汇付支付记录表
*/
* 会员汇付支付记录表
*/
@Getter
@Setter
@Builder
@@ -20,62 +17,67 @@ public class MemberAdapayRecord {
private Integer id;
/**
* 会员id
*/
* 会员id
*/
private String memberId;
/**
* 场景类型order, balance
*/
* 场景类型order, balance
*/
private String scenarioType;
/**
* 汇付支付id
*/
* 汇付支付id
*/
private String paymentId;
/**
* 汇付支付单号
*/
* 汇付支付单号
*/
private String paymentOrderNo;
/**
* 支付金额
*/
* 支付金额
*/
private BigDecimal payAmt;
/**
* 退款金额
*/
* 退款金额
*/
private BigDecimal refundAmt;
/**
* 消费金额
*/
* 消费金额
*/
private BigDecimal spendAmt;
/**
* 创建人
*/
* 剩余金额
*/
private BigDecimal balanceAmt;
/**
* 创建人
*/
private String createBy;
/**
* 创建时间
*/
* 创建时间
*/
private Date createTime;
/**
* 更新人
*/
* 更新人
*/
private String updateBy;
/**
* 更新时间
*/
* 更新时间
*/
private Date updateTime;
/**
* 删除标识
*/
* 删除标识
*/
private String delFlag;
}

View File

@@ -1,12 +1,14 @@
package com.jsowell.pile.mapper;
import com.jsowell.pile.domain.MemberAdapayRecord;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface MemberAdapayRecordMapper {
/**
* insert record to table selective
*
* @param record the record
* @return insert count
*/
@@ -14,6 +16,7 @@ public interface MemberAdapayRecordMapper {
/**
* select by primary key
*
* @param id primary key
* @return object by primary key
*/
@@ -21,6 +24,7 @@ public interface MemberAdapayRecordMapper {
/**
* update record selective
*
* @param record the updated record
* @return update count
*/

View File

@@ -632,6 +632,7 @@ public class OrderBasicInfoServiceImpl implements IOrderBasicInfoService {
public void settleOrder(TransactionRecordsData data, OrderBasicInfo orderBasicInfo) {
logger.info("结算订单start data:{}, orderBasicInfo:{}", data.toString(), orderBasicInfo.toString());
String orderCode = orderBasicInfo.getOrderCode();
String memberId = orderBasicInfo.getMemberId();
// 判断订单状态
if (StringUtils.equals(orderBasicInfo.getOrderStatus(), OrderStatusEnum.ORDER_COMPLETE.getValue())) {
@@ -1111,6 +1112,29 @@ public class OrderBasicInfoServiceImpl implements IOrderBasicInfoService {
return result;
}
/**
* 余额支付订单,使用余额支付转账
* @param orderBasicInfo
* @param adapayMemberAccount
* @return
*/
public OrderSettleResult doBalancePaymentV2(OrderBasicInfo orderBasicInfo, AdapayMemberAccount adapayMemberAccount) throws BaseAdaPayException {
// 计算应该支付金额,和手续费
SplitSettleAmountVO splitSettleAmountVO = splitSettleAmount(orderBasicInfo.getSettleAmount());
BigDecimal feeAmount = splitSettleAmountVO.getFeeAmount();
BigDecimal tradeAmount = splitSettleAmountVO.getTradeAmount();
logger.info("余额支付订单使用余额支付转账, orderCode:{}, inMemberId:{}, transAmt:{}", orderBasicInfo.getOrderCode(), orderBasicInfo, tradeAmount);
// 查询会员的余额充值记录
// 分账
// 更新余额充值记录
return null;
}
/**
* 延迟交易订单 交易确认
* @param orderBasicInfo 订单

View File

@@ -12,6 +12,7 @@
<result column="pay_amt" jdbcType="DECIMAL" property="payAmt" />
<result column="refund_amt" jdbcType="DECIMAL" property="refundAmt" />
<result column="spend_amt" jdbcType="DECIMAL" property="spendAmt" />
<result column="balance_amt" jdbcType="DECIMAL" property="balanceAmt" />
<result column="create_by" jdbcType="VARCHAR" property="createBy" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_by" jdbcType="VARCHAR" property="updateBy" />
@@ -21,7 +22,7 @@
<sql id="Base_Column_List">
<!--@mbg.generated-->
id, member_id, scenario_type, payment_id, payment_order_no, pay_amt, refund_amt,
spend_amt, create_by, create_time, update_by, update_time, del_flag
spend_amt, balance_amt, create_by, create_time, update_by, update_time, del_flag
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
<!--@mbg.generated-->
@@ -30,13 +31,10 @@
from member_adapay_record
where id = #{id,jdbcType=INTEGER}
</select>
<insert id="insertSelective" parameterType="com.jsowell.pile.domain.MemberAdapayRecord">
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.jsowell.pile.domain.MemberAdapayRecord" useGeneratedKeys="true">
<!--@mbg.generated-->
insert into member_adapay_record
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="memberId != null">
member_id,
</if>
@@ -58,6 +56,9 @@
<if test="spendAmt != null">
spend_amt,
</if>
<if test="balanceAmt != null">
balance_amt,
</if>
<if test="createBy != null">
create_by,
</if>
@@ -75,9 +76,6 @@
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=INTEGER},
</if>
<if test="memberId != null">
#{memberId,jdbcType=VARCHAR},
</if>
@@ -99,6 +97,9 @@
<if test="spendAmt != null">
#{spendAmt,jdbcType=DECIMAL},
</if>
<if test="balanceAmt != null">
#{balanceAmt,jdbcType=DECIMAL},
</if>
<if test="createBy != null">
#{createBy,jdbcType=VARCHAR},
</if>
@@ -141,6 +142,9 @@
<if test="spendAmt != null">
spend_amt = #{spendAmt,jdbcType=DECIMAL},
</if>
<if test="balanceAmt != null">
balance_amt = #{balanceAmt,jdbcType=DECIMAL},
</if>
<if test="createBy != null">
create_by = #{createBy,jdbcType=VARCHAR},
</if>
@@ -198,6 +202,11 @@
when id = #{item.id,jdbcType=INTEGER} then #{item.spendAmt,jdbcType=DECIMAL}
</foreach>
</trim>
<trim prefix="balance_amt = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=INTEGER} then #{item.balanceAmt,jdbcType=DECIMAL}
</foreach>
</trim>
<trim prefix="create_by = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=INTEGER} then #{item.createBy,jdbcType=VARCHAR}
@@ -229,47 +238,81 @@
#{item.id,jdbcType=INTEGER}
</foreach>
</update>
<insert id="batchInsert" parameterType="map">
<insert id="batchInsert" keyColumn="id" keyProperty="id" parameterType="map" useGeneratedKeys="true">
<!--@mbg.generated-->
insert into member_adapay_record
(id, member_id, scenario_type, payment_id, payment_order_no, pay_amt, refund_amt,
spend_amt, create_by, create_time, update_by, update_time, del_flag)
(member_id, scenario_type, payment_id, payment_order_no, pay_amt, refund_amt, spend_amt,
balance_amt, create_by, create_time, update_by, update_time, del_flag)
values
<foreach collection="list" item="item" separator=",">
(#{item.id,jdbcType=INTEGER}, #{item.memberId,jdbcType=VARCHAR}, #{item.scenarioType,jdbcType=VARCHAR},
#{item.paymentId,jdbcType=VARCHAR}, #{item.paymentOrderNo,jdbcType=VARCHAR}, #{item.payAmt,jdbcType=DECIMAL},
#{item.refundAmt,jdbcType=DECIMAL}, #{item.spendAmt,jdbcType=DECIMAL}, #{item.createBy,jdbcType=VARCHAR},
(#{item.memberId,jdbcType=VARCHAR}, #{item.scenarioType,jdbcType=VARCHAR}, #{item.paymentId,jdbcType=VARCHAR},
#{item.paymentOrderNo,jdbcType=VARCHAR}, #{item.payAmt,jdbcType=DECIMAL}, #{item.refundAmt,jdbcType=DECIMAL},
#{item.spendAmt,jdbcType=DECIMAL}, #{item.balanceAmt,jdbcType=DECIMAL}, #{item.createBy,jdbcType=VARCHAR},
#{item.createTime,jdbcType=TIMESTAMP}, #{item.updateBy,jdbcType=VARCHAR}, #{item.updateTime,jdbcType=TIMESTAMP},
#{item.delFlag,jdbcType=VARCHAR})
</foreach>
</insert>
<insert id="insertOrUpdate" parameterType="com.jsowell.pile.domain.MemberAdapayRecord">
<insert id="insertOrUpdate" keyColumn="id" keyProperty="id" parameterType="com.jsowell.pile.domain.MemberAdapayRecord" useGeneratedKeys="true">
<!--@mbg.generated-->
insert into member_adapay_record
(id, member_id, scenario_type, payment_id, payment_order_no, pay_amt, refund_amt,
spend_amt, create_by, create_time, update_by, update_time, del_flag)
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
member_id,
scenario_type,
payment_id,
payment_order_no,
pay_amt,
refund_amt,
spend_amt,
balance_amt,
create_by,
create_time,
update_by,
update_time,
del_flag,
</trim>
values
(#{id,jdbcType=INTEGER}, #{memberId,jdbcType=VARCHAR}, #{scenarioType,jdbcType=VARCHAR},
#{paymentId,jdbcType=VARCHAR}, #{paymentOrderNo,jdbcType=VARCHAR}, #{payAmt,jdbcType=DECIMAL},
#{refundAmt,jdbcType=DECIMAL}, #{spendAmt,jdbcType=DECIMAL}, #{createBy,jdbcType=VARCHAR},
#{createTime,jdbcType=TIMESTAMP}, #{updateBy,jdbcType=VARCHAR}, #{updateTime,jdbcType=TIMESTAMP},
#{delFlag,jdbcType=VARCHAR})
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=INTEGER},
</if>
#{memberId,jdbcType=VARCHAR},
#{scenarioType,jdbcType=VARCHAR},
#{paymentId,jdbcType=VARCHAR},
#{paymentOrderNo,jdbcType=VARCHAR},
#{payAmt,jdbcType=DECIMAL},
#{refundAmt,jdbcType=DECIMAL},
#{spendAmt,jdbcType=DECIMAL},
#{balanceAmt,jdbcType=DECIMAL},
#{createBy,jdbcType=VARCHAR},
#{createTime,jdbcType=TIMESTAMP},
#{updateBy,jdbcType=VARCHAR},
#{updateTime,jdbcType=TIMESTAMP},
#{delFlag,jdbcType=VARCHAR},
</trim>
on duplicate key update
id = #{id,jdbcType=INTEGER},
member_id = #{memberId,jdbcType=VARCHAR},
scenario_type = #{scenarioType,jdbcType=VARCHAR},
payment_id = #{paymentId,jdbcType=VARCHAR},
payment_order_no = #{paymentOrderNo,jdbcType=VARCHAR},
pay_amt = #{payAmt,jdbcType=DECIMAL},
refund_amt = #{refundAmt,jdbcType=DECIMAL},
spend_amt = #{spendAmt,jdbcType=DECIMAL},
create_by = #{createBy,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_by = #{updateBy,jdbcType=VARCHAR},
update_time = #{updateTime,jdbcType=TIMESTAMP},
del_flag = #{delFlag,jdbcType=VARCHAR}
<trim suffixOverrides=",">
<if test="id != null">
id = #{id,jdbcType=INTEGER},
</if>
member_id = #{memberId,jdbcType=VARCHAR},
scenario_type = #{scenarioType,jdbcType=VARCHAR},
payment_id = #{paymentId,jdbcType=VARCHAR},
payment_order_no = #{paymentOrderNo,jdbcType=VARCHAR},
pay_amt = #{payAmt,jdbcType=DECIMAL},
refund_amt = #{refundAmt,jdbcType=DECIMAL},
spend_amt = #{spendAmt,jdbcType=DECIMAL},
balance_amt = #{balanceAmt,jdbcType=DECIMAL},
create_by = #{createBy,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_by = #{updateBy,jdbcType=VARCHAR},
update_time = #{updateTime,jdbcType=TIMESTAMP},
del_flag = #{delFlag,jdbcType=VARCHAR},
</trim>
</insert>
<insert id="insertOrUpdateSelective" parameterType="com.jsowell.pile.domain.MemberAdapayRecord">
<insert id="insertOrUpdateSelective" keyColumn="id" keyProperty="id" parameterType="com.jsowell.pile.domain.MemberAdapayRecord" useGeneratedKeys="true">
<!--@mbg.generated-->
insert into member_adapay_record
<trim prefix="(" suffix=")" suffixOverrides=",">
@@ -297,6 +340,9 @@
<if test="spendAmt != null">
spend_amt,
</if>
<if test="balanceAmt != null">
balance_amt,
</if>
<if test="createBy != null">
create_by,
</if>
@@ -339,6 +385,9 @@
<if test="spendAmt != null">
#{spendAmt,jdbcType=DECIMAL},
</if>
<if test="balanceAmt != null">
#{balanceAmt,jdbcType=DECIMAL},
</if>
<if test="createBy != null">
#{createBy,jdbcType=VARCHAR},
</if>
@@ -381,6 +430,9 @@
<if test="spendAmt != null">
spend_amt = #{spendAmt,jdbcType=DECIMAL},
</if>
<if test="balanceAmt != null">
balance_amt = #{balanceAmt,jdbcType=DECIMAL},
</if>
<if test="createBy != null">
create_by = #{createBy,jdbcType=VARCHAR},
</if>