update 修改余额增加备注

This commit is contained in:
2023-11-28 10:47:42 +08:00
parent b2be89c0f7
commit 45d71a5506
4 changed files with 55 additions and 13 deletions

View File

@@ -1,12 +1,9 @@
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;
/**
* 会员钱包流水表
@@ -67,6 +64,11 @@ public class MemberWalletLog {
*/
private BigDecimal afterAmount;
/**
* 备注
*/
private String remark;
/**
* 创建人
*/

View File

@@ -5,11 +5,9 @@ import com.jsowell.pile.dto.UniAppQueryMemberBalanceDTO;
import com.jsowell.pile.vo.uniapp.MemberBalanceVO;
import com.jsowell.pile.vo.uniapp.MemberWalletLogVO;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository
public interface MemberWalletLogMapper {
/**
* delete by primary key

View File

@@ -272,6 +272,11 @@ public class MemberBasicInfoServiceImpl implements IMemberBasicInfoService {
log.info("修改用户余额-变更后本金余额不能为负数");
throw new BusinessException("", "变更后本金余额不能为负数");
}
String remark = "日期:" + DateUtils.getDateTime() +
", 操作人员Id:" + createBy +
", 变更用户本金金额:" + updatePrincipalBalance +
", 原金额:" + oldPrincipalBalance +
", 变更后金额:" + newPrincipalBalance;
// 记流水
logList.add(MemberWalletLog.builder()
.memberId(dto.getMemberId())
@@ -283,6 +288,7 @@ public class MemberBasicInfoServiceImpl implements IMemberBasicInfoService {
.relatedOrderCode(dto.getRelatedOrderCode())
.beforeAmount(oldPrincipalBalance)
.afterAmount(newPrincipalBalance)
.remark(remark)
.createBy(createBy)
.createTime(DateUtils.getNowDate())
.build());
@@ -303,6 +309,11 @@ public class MemberBasicInfoServiceImpl implements IMemberBasicInfoService {
log.info("修改用户余额-变更后赠送余额不能为负数");
throw new BusinessException("", "变更后赠送余额不能为负数");
}
String remark = "日期:" + DateUtils.getDateTime() +
", 操作人员Id:" + createBy +
", 变更用户赠送金额:" + updateGiftBalance +
", 原金额:" + oldGiftBalance +
", 变更后金额:" + newGiftBalance;
// 记流水
logList.add(MemberWalletLog.builder()
.memberId(dto.getMemberId())
@@ -314,6 +325,7 @@ public class MemberBasicInfoServiceImpl implements IMemberBasicInfoService {
.relatedOrderCode(dto.getRelatedOrderCode())
.beforeAmount(oldGiftBalance)
.afterAmount(newGiftBalance)
.remark(remark)
.createBy(createBy)
.createTime(DateUtils.getNowDate())
.build());

View File

@@ -14,13 +14,14 @@
<result column="related_order_code" jdbcType="VARCHAR" property="relatedOrderCode" />
<result column="before_amount" jdbcType="DECIMAL" property="beforeAmount" />
<result column="after_amount" jdbcType="DECIMAL" property="afterAmount" />
<result column="remark" jdbcType="VARCHAR" property="remark" />
<result column="create_by" jdbcType="VARCHAR" property="createBy" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
</resultMap>
<sql id="Base_Column_List">
<!--@mbg.generated-->
id, member_id, wallet_code, `type`, sub_type, amount, category, related_order_code,
before_amount, after_amount, create_by, create_time
before_amount, after_amount, remark, create_by, create_time
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
<!--@mbg.generated-->
@@ -39,11 +40,13 @@
insert into member_wallet_log (member_id, wallet_code, `type`,
sub_type, amount, category,
related_order_code, before_amount, after_amount,
create_by, create_time)
remark, create_by, create_time
)
values (#{memberId,jdbcType=VARCHAR}, #{walletCode,jdbcType=VARCHAR}, #{type,jdbcType=VARCHAR},
#{subType,jdbcType=VARCHAR}, #{amount,jdbcType=DECIMAL}, #{category,jdbcType=CHAR},
#{relatedOrderCode,jdbcType=VARCHAR}, #{beforeAmount,jdbcType=DECIMAL}, #{afterAmount,jdbcType=DECIMAL},
#{createBy,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP})
#{remark,jdbcType=VARCHAR}, #{createBy,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}
)
</insert>
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.jsowell.pile.domain.MemberWalletLog" useGeneratedKeys="true">
<!--@mbg.generated-->
@@ -76,6 +79,9 @@
<if test="afterAmount != null">
after_amount,
</if>
<if test="remark != null">
remark,
</if>
<if test="createBy != null">
create_by,
</if>
@@ -111,6 +117,9 @@
<if test="afterAmount != null">
#{afterAmount,jdbcType=DECIMAL},
</if>
<if test="remark != null">
#{remark,jdbcType=VARCHAR},
</if>
<if test="createBy != null">
#{createBy,jdbcType=VARCHAR},
</if>
@@ -150,6 +159,9 @@
<if test="afterAmount != null">
after_amount = #{afterAmount,jdbcType=DECIMAL},
</if>
<if test="remark != null">
remark = #{remark,jdbcType=VARCHAR},
</if>
<if test="createBy != null">
create_by = #{createBy,jdbcType=VARCHAR},
</if>
@@ -171,6 +183,7 @@
related_order_code = #{relatedOrderCode,jdbcType=VARCHAR},
before_amount = #{beforeAmount,jdbcType=DECIMAL},
after_amount = #{afterAmount,jdbcType=DECIMAL},
remark = #{remark,jdbcType=VARCHAR},
create_by = #{createBy,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=TIMESTAMP}
where id = #{id,jdbcType=INTEGER}
@@ -224,6 +237,11 @@
when id = #{item.id,jdbcType=INTEGER} then #{item.afterAmount,jdbcType=DECIMAL}
</foreach>
</trim>
<trim prefix="remark = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=INTEGER} then #{item.remark,jdbcType=VARCHAR}
</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}
@@ -244,14 +262,14 @@
<!--@mbg.generated-->
insert into member_wallet_log
(member_id, wallet_code, `type`, sub_type, amount, category, related_order_code,
before_amount, after_amount, create_by, create_time)
before_amount, after_amount, remark, create_by, create_time)
values
<foreach collection="list" item="item" separator=",">
(#{item.memberId,jdbcType=VARCHAR}, #{item.walletCode,jdbcType=VARCHAR}, #{item.type,jdbcType=VARCHAR},
#{item.subType,jdbcType=VARCHAR}, #{item.amount,jdbcType=DECIMAL}, #{item.category,jdbcType=CHAR},
#{item.relatedOrderCode,jdbcType=VARCHAR}, #{item.beforeAmount,jdbcType=DECIMAL},
#{item.afterAmount,jdbcType=DECIMAL}, #{item.createBy,jdbcType=VARCHAR}, #{item.createTime,jdbcType=TIMESTAMP}
)
#{item.afterAmount,jdbcType=DECIMAL}, #{item.remark,jdbcType=VARCHAR}, #{item.createBy,jdbcType=VARCHAR},
#{item.createTime,jdbcType=TIMESTAMP})
</foreach>
</insert>
<insert id="insertOrUpdate" keyColumn="id" keyProperty="id" parameterType="com.jsowell.pile.domain.MemberWalletLog" useGeneratedKeys="true">
@@ -270,6 +288,7 @@
related_order_code,
before_amount,
after_amount,
remark,
create_by,
create_time,
</trim>
@@ -287,6 +306,7 @@
#{relatedOrderCode,jdbcType=VARCHAR},
#{beforeAmount,jdbcType=DECIMAL},
#{afterAmount,jdbcType=DECIMAL},
#{remark,jdbcType=VARCHAR},
#{createBy,jdbcType=VARCHAR},
#{createTime,jdbcType=TIMESTAMP},
</trim>
@@ -304,6 +324,7 @@
related_order_code = #{relatedOrderCode,jdbcType=VARCHAR},
before_amount = #{beforeAmount,jdbcType=DECIMAL},
after_amount = #{afterAmount,jdbcType=DECIMAL},
remark = #{remark,jdbcType=VARCHAR},
create_by = #{createBy,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=TIMESTAMP},
</trim>
@@ -342,6 +363,9 @@
<if test="afterAmount != null">
after_amount,
</if>
<if test="remark != null">
remark,
</if>
<if test="createBy != null">
create_by,
</if>
@@ -381,6 +405,9 @@
<if test="afterAmount != null">
#{afterAmount,jdbcType=DECIMAL},
</if>
<if test="remark != null">
#{remark,jdbcType=VARCHAR},
</if>
<if test="createBy != null">
#{createBy,jdbcType=VARCHAR},
</if>
@@ -420,6 +447,9 @@
<if test="afterAmount != null">
after_amount = #{afterAmount,jdbcType=DECIMAL},
</if>
<if test="remark != null">
remark = #{remark,jdbcType=VARCHAR},
</if>
<if test="createBy != null">
create_by = #{createBy,jdbcType=VARCHAR},
</if>