新增 批量退款临时接口

This commit is contained in:
Lemon
2023-08-10 15:19:45 +08:00
parent 043f525da4
commit cd8d934d8f
7 changed files with 181 additions and 65 deletions

View File

@@ -6,6 +6,7 @@ import lombok.Data;
import lombok.NoArgsConstructor;
import java.math.BigDecimal;
import java.util.List;
/**
* 申请退款dto
@@ -35,4 +36,9 @@ public class ApplyRefundDTO {
* 退款金额
*/
private BigDecimal refundAmount;
/**
* memberId 数组(批量退款)
*/
private List<String> memberIdList;
}

View File

@@ -3,6 +3,7 @@ package com.jsowell.pile.mapper;
import com.jsowell.pile.domain.MemberWalletLog;
import com.jsowell.pile.dto.UniAppQueryMemberBalanceDTO;
import com.jsowell.pile.vo.MemberBalanceVO;
import com.jsowell.pile.vo.uniapp.MemberWalletLogVO;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
@@ -38,4 +39,11 @@ public interface MemberWalletLogMapper {
* @return
*/
List<MemberWalletLogVO> getMemberWalletDetail(@Param("dto") UniAppQueryMemberBalanceDTO dto);
/**
* 批量查询用户可退款金额
* @param memberIds
* @return
*/
List<MemberBalanceVO> getMemberRefundAmount(List<String> memberIds);
}

View File

@@ -3,6 +3,7 @@ package com.jsowell.pile.service;
import com.jsowell.pile.domain.MemberBasicInfo;
import com.jsowell.pile.dto.PlatformTesterDTO;
import com.jsowell.pile.dto.UniAppQueryMemberBalanceDTO;
import com.jsowell.pile.vo.MemberBalanceVO;
import com.jsowell.pile.vo.uniapp.MemberVO;
import com.jsowell.pile.vo.uniapp.MemberWalletLogVO;
import com.jsowell.pile.vo.uniapp.PersonalPileInfoVO;
@@ -128,4 +129,12 @@ public interface IMemberBasicInfoService {
* @return
*/
List<MemberWalletLogVO> getMemberWalletDetail(UniAppQueryMemberBalanceDTO dto);
/**
* 批量查询用户可退款金额
* @param memberIds
* @return
*/
List<MemberBalanceVO> getMemberRefundAmount(List<String> memberIds);
}

View File

@@ -18,6 +18,7 @@ import com.jsowell.pile.mapper.MemberWalletInfoMapper;
import com.jsowell.pile.mapper.MemberWalletLogMapper;
import com.jsowell.pile.service.IMemberBasicInfoService;
import com.jsowell.pile.service.IPileBasicInfoService;
import com.jsowell.pile.vo.MemberBalanceVO;
import com.jsowell.pile.vo.uniapp.MemberVO;
import com.jsowell.pile.vo.uniapp.MemberWalletLogVO;
import com.jsowell.pile.vo.uniapp.PersonalPileInfoVO;
@@ -332,5 +333,15 @@ public class MemberBasicInfoServiceImpl implements IMemberBasicInfoService {
return memberWalletLogMapper.getMemberWalletDetail(dto);
}
/**
* 批量查询用户可退款金额
* @param memberIds
* @return
*/
@Override
public List<MemberBalanceVO> getMemberRefundAmount(List<String> memberIds) {
return memberWalletLogMapper.getMemberRefundAmount(memberIds);
}
}

View File

@@ -0,0 +1,16 @@
package com.jsowell.pile.vo;
import lombok.Data;
/**
* TODO
*
* @author Lemon
* @Date 2023/8/10 14:36
*/
@Data
public class MemberBalanceVO {
private String memberId;
private String principalAmount;
}

View File

@@ -1,72 +1,89 @@
<?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="com.jsowell.pile.mapper.MemberWalletLogMapper">
<resultMap id="BaseResultMap" type="com.jsowell.pile.domain.MemberWalletLog">
<!--@mbg.generated-->
<!--@Table member_wallet_log-->
<id column="id" jdbcType="INTEGER" property="id" />
<result column="member_id" jdbcType="VARCHAR" property="memberId" />
<result column="type" jdbcType="VARCHAR" property="type" />
<result column="sub_type" jdbcType="VARCHAR" property="subType" />
<result column="amount" jdbcType="DECIMAL" property="amount" />
<result column="category" jdbcType="CHAR" property="category" />
<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, `type`, sub_type, amount, category, create_by, create_time
</sql>
<resultMap id="BaseResultMap" type="com.jsowell.pile.domain.MemberWalletLog">
<!--@mbg.generated-->
<!--@Table member_wallet_log-->
<id column="id" jdbcType="INTEGER" property="id"/>
<result column="member_id" jdbcType="VARCHAR" property="memberId"/>
<result column="type" jdbcType="VARCHAR" property="type"/>
<result column="sub_type" jdbcType="VARCHAR" property="subType"/>
<result column="amount" jdbcType="DECIMAL" property="amount"/>
<result column="category" jdbcType="CHAR" property="category"/>
<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,
`type`,
sub_type,
amount,
category,
create_by,
create_time
</sql>
<insert id="batchInsert">
insert into member_wallet_log (member_id, `type`,
sub_type, amount, category, related_order_code, create_by)
values
<foreach collection="list" item="item" separator=",">
(
#{item.memberId,jdbcType=VARCHAR}, #{item.type,jdbcType=VARCHAR}, #{item.subType,jdbcType=VARCHAR},
#{item.amount,jdbcType=DECIMAL}, #{item.category,jdbcType=CHAR}, #{item.relatedOrderCode,jdbcType=VARCHAR},
#{item.createBy,jdbcType=VARCHAR}
)
</foreach>
</insert>
<insert id="batchInsert">
insert into member_wallet_log (member_id, `type`,
sub_type, amount, category, related_order_code, create_by)
values
<foreach collection="list" item="item" separator=",">
(#{item.memberId,jdbcType=VARCHAR}, #{item.type,jdbcType=VARCHAR}, #{item.subType,jdbcType=VARCHAR},
#{item.amount,jdbcType=DECIMAL}, #{item.category,jdbcType=CHAR}, #{item.relatedOrderCode,jdbcType=VARCHAR},
#{item.createBy,jdbcType=VARCHAR})
</foreach>
</insert>
<select id="getMemberBalanceChanges" resultType="com.jsowell.pile.vo.uniapp.MemberWalletLogVO">
SELECT
t1.member_id as memberId,
t1.type,
t1.sub_type as subType,
t1.amount,
t1.category,
t1.create_time as transactionTime
from member_wallet_log t1
where
t1.member_id = #{memberId,jdbcType=VARCHAR}
<if test="type != null and type != ''">
and t1.type = #{type,jdbcType=VARCHAR}
</if>
order by t1.create_time DESC
</select>
<select id="getMemberBalanceChanges" resultType="com.jsowell.pile.vo.uniapp.MemberWalletLogVO">
SELECT t1.member_id as memberId,
t1.type,
t1.sub_type as subType,
t1.amount,
t1.category,
t1.create_time as transactionTime
from member_wallet_log t1
where t1.member_id = #{memberId,jdbcType=VARCHAR}
<if test="type != null and type != ''">
and t1.type = #{type,jdbcType=VARCHAR}
</if>
order by t1.create_time DESC
</select>
<select id="getMemberWalletDetail" resultType="com.jsowell.pile.vo.uniapp.MemberWalletLogVO">
SELECT
t1.member_id as memberId,
t1.type,
t1.sub_type as subType,
t1.amount,
t1.category,
t1.related_order_code as relatedOrderCode,
t2.pay_amount as payAmount,
t2.order_amount as orderAmount,
t2.refund_amount as refundAmount,
t1.create_time as transactionTime
from member_wallet_log t1
left join order_basic_info t2
on t1.related_order_code = t2.order_code
where t1.member_id = #{dto.memberId,jdbcType=VARCHAR}
and t1.create_time <![CDATA[ >= ]]> #{dto.tradeDate,jdbcType=VARCHAR}
and t1.create_time <![CDATA[ < ]]> #{dto.endDate,jdbcType=VARCHAR}
and t1.sub_type != '12'
order by t1.create_time desc
</select>
<select id="getMemberWalletDetail" resultType="com.jsowell.pile.vo.uniapp.MemberWalletLogVO">
SELECT t1.member_id as memberId,
t1.type,
t1.sub_type as subType,
t1.amount,
t1.category,
t1.related_order_code as relatedOrderCode,
t2.pay_amount as payAmount,
t2.order_amount as orderAmount,
t2.refund_amount as refundAmount,
t1.create_time as transactionTime
from member_wallet_log t1
left join order_basic_info t2
on t1.related_order_code = t2.order_code
where t1.member_id = #{dto.memberId,jdbcType=VARCHAR}
and t1.create_time <![CDATA[ >= ]]> #{dto.tradeDate,jdbcType=VARCHAR}
and t1.create_time <![CDATA[ < ]]> #{dto.endDate,jdbcType=VARCHAR}
and t1.sub_type != '12'
order by t1.create_time desc
</select>
<select id="getMemberRefundAmount" resultType="com.jsowell.pile.vo.MemberBalanceVO">
select
member_id as memberId,
principal_balance as principalAmount
from
member_wallet_info
where
<if test="list != null and list.size() != 0">
member_id in
<foreach collection="list" item="memberId" open="(" separator="," close=")">
#{memberId,jdbcType=VARCHAR}
</foreach>
</if>
</select>
</mapper>