mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-06-14 04:09:50 +08:00
update
This commit is contained in:
@@ -22,7 +22,7 @@ public class MemberWalletInfo {
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
private Integer id;
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 会员id
|
||||
@@ -66,4 +66,4 @@ public class MemberWalletInfo {
|
||||
* 删除标识(0-正常;1-删除)
|
||||
*/
|
||||
private String delFlag;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -93,6 +93,14 @@ public interface MemberBasicInfoMapper {
|
||||
*/
|
||||
MemberBasicInfo selectInfoByMemberId(String memberId);
|
||||
|
||||
/**
|
||||
* 判断会员id是否已存在。
|
||||
*
|
||||
* @param memberId 会员id
|
||||
* @return 1-存在;null-不存在
|
||||
*/
|
||||
Integer existsByMemberId(@Param("memberId") String memberId);
|
||||
|
||||
/**
|
||||
* 更新会员余额
|
||||
* @param memberId 会员id
|
||||
|
||||
@@ -7,7 +7,7 @@ import org.apache.ibatis.annotations.Param;
|
||||
import java.util.List;
|
||||
|
||||
public interface MemberWalletInfoMapper {
|
||||
int deleteByPrimaryKey(Integer id);
|
||||
int deleteByPrimaryKey(Long id);
|
||||
|
||||
int insert(MemberWalletInfo record);
|
||||
|
||||
@@ -17,7 +17,7 @@ public interface MemberWalletInfoMapper {
|
||||
|
||||
int insertSelective(MemberWalletInfo record);
|
||||
|
||||
MemberWalletInfo selectByPrimaryKey(Integer id);
|
||||
MemberWalletInfo selectByPrimaryKey(Long id);
|
||||
|
||||
int updateByPrimaryKeySelective(MemberWalletInfo record);
|
||||
|
||||
|
||||
@@ -91,6 +91,14 @@ public interface MemberBasicInfoService {
|
||||
*/
|
||||
MemberBasicInfo selectInfoByMemberId(String memberId);
|
||||
|
||||
/**
|
||||
* 判断指定会员id是否已经存在。
|
||||
*
|
||||
* @param memberId 会员id
|
||||
* @return true-已存在;false-不存在
|
||||
*/
|
||||
boolean existsByMemberId(String memberId);
|
||||
|
||||
String generateWalletCode();
|
||||
|
||||
/**
|
||||
|
||||
@@ -6,13 +6,13 @@ import com.jsowell.pile.vo.base.MemberWalletVO;
|
||||
import java.util.List;
|
||||
|
||||
public interface MemberWalletInfoService {
|
||||
int deleteByPrimaryKey(Integer id);
|
||||
int deleteByPrimaryKey(Long id);
|
||||
|
||||
int insert(MemberWalletInfo record);
|
||||
|
||||
int insertSelective(MemberWalletInfo record);
|
||||
|
||||
MemberWalletInfo selectByPrimaryKey(Integer id);
|
||||
MemberWalletInfo selectByPrimaryKey(Long id);
|
||||
|
||||
MemberWalletInfo selectByMemberId(String memberId, String merchantId);
|
||||
|
||||
|
||||
@@ -180,6 +180,11 @@ public class MemberBasicInfoServiceImpl implements MemberBasicInfoService {
|
||||
return memberBasicInfoMapper.selectInfoByMemberId(memberId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean existsByMemberId(String memberId) {
|
||||
return memberBasicInfoMapper.existsByMemberId(memberId) != null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成钱包卡号WalletCode
|
||||
* @return
|
||||
@@ -267,8 +272,16 @@ public class MemberBasicInfoServiceImpl implements MemberBasicInfoService {
|
||||
createBy = SecurityUtils.getLoginUser().getUserId() + "";
|
||||
}
|
||||
|
||||
// 查询用户余额
|
||||
MemberWalletInfo walletInfo = memberWalletInfoService.selectByMemberId(memberId, targetMerchantId);
|
||||
log.info("修改用户余额-开始查询钱包, memberId:{}, targetMerchantId:{}, type:{}, subType:{}, updatePrincipalBalance:{}, updateGiftBalance:{}",
|
||||
memberId, targetMerchantId, type, dto.getSubType(), updatePrincipalBalance, updateGiftBalance);
|
||||
MemberWalletInfo walletInfo;
|
||||
try {
|
||||
walletInfo = memberWalletInfoService.selectByMemberId(memberId, targetMerchantId);
|
||||
} catch (Exception e) {
|
||||
log.error("修改用户余额-查询钱包异常, memberId:{}, targetMerchantId:{}, memberIdLength:{}, exceptionType:{}",
|
||||
memberId, targetMerchantId, memberId == null ? null : memberId.length(), e.getClass().getName(), e);
|
||||
throw e;
|
||||
}
|
||||
log.info("修改用户余额-根据会员id:{}, 目标运营商id:{}, 查询结果:{}", memberId, targetMerchantId, JSON.toJSONString(walletInfo));
|
||||
if (walletInfo == null) {
|
||||
log.info("修改用户余额-根据会员id:{}, 目标运营商id:{}, 查询会员信息为空, 新建会员钱包", memberId, targetMerchantId);
|
||||
@@ -282,6 +295,11 @@ public class MemberBasicInfoServiceImpl implements MemberBasicInfoService {
|
||||
.version(0)
|
||||
.build();
|
||||
memberWalletInfoService.insertSelective(walletInfo);
|
||||
log.info("修改用户余额-会员钱包创建完成, memberId:{}, targetMerchantId:{}, walletId:{}, walletCode:{}",
|
||||
memberId, targetMerchantId, walletInfo.getId(), walletInfo.getWalletCode());
|
||||
} else {
|
||||
log.info("修改用户余额-命中会员钱包, memberId:{}, targetMerchantId:{}, walletId:{}, walletCode:{}, version:{}",
|
||||
memberId, targetMerchantId, walletInfo.getId(), walletInfo.getWalletCode(), walletInfo.getVersion());
|
||||
}
|
||||
|
||||
// 钱包编号
|
||||
|
||||
@@ -25,7 +25,7 @@ public class MemberWalletInfoServiceImpl implements MemberWalletInfoService {
|
||||
private PileMerchantInfoService pileMerchantInfoService;
|
||||
|
||||
@Override
|
||||
public int deleteByPrimaryKey(Integer id) {
|
||||
public int deleteByPrimaryKey(Long id) {
|
||||
return memberWalletInfoMapper.deleteByPrimaryKey(id);
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ public class MemberWalletInfoServiceImpl implements MemberWalletInfoService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public MemberWalletInfo selectByPrimaryKey(Integer id) {
|
||||
public MemberWalletInfo selectByPrimaryKey(Long id) {
|
||||
return memberWalletInfoMapper.selectByPrimaryKey(id);
|
||||
}
|
||||
|
||||
|
||||
@@ -173,6 +173,14 @@
|
||||
and member_id = #{memberId,jdbcType=VARCHAR}
|
||||
</select>
|
||||
|
||||
<select id="existsByMemberId" resultType="java.lang.Integer">
|
||||
select 1
|
||||
from member_basic_info
|
||||
where del_flag = '0'
|
||||
and member_id = #{memberId,jdbcType=VARCHAR}
|
||||
limit 1
|
||||
</select>
|
||||
|
||||
<update id="updateMemberBalance">
|
||||
update member_wallet_info
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<resultMap id="BaseResultMap" type="com.jsowell.pile.domain.MemberWalletInfo">
|
||||
<!--@mbg.generated-->
|
||||
<!--@Table member_wallet_info-->
|
||||
<id column="id" jdbcType="INTEGER" property="id" />
|
||||
<id column="id" jdbcType="BIGINT" property="id" />
|
||||
<result column="member_id" jdbcType="VARCHAR" property="memberId" />
|
||||
<result column="merchant_id" jdbcType="VARCHAR" property="merchantId" />
|
||||
<result column="wallet_code" jdbcType="VARCHAR" property="walletCode" />
|
||||
@@ -22,17 +22,17 @@
|
||||
id, member_id, merchant_id, wallet_code, principal_balance, gift_balance, version,
|
||||
create_by, create_time, update_by, update_time, del_flag
|
||||
</sql>
|
||||
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
|
||||
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
|
||||
<!--@mbg.generated-->
|
||||
select
|
||||
<include refid="Base_Column_List" />
|
||||
from member_wallet_info
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
where id = #{id,jdbcType=BIGINT}
|
||||
</select>
|
||||
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
|
||||
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
|
||||
<!--@mbg.generated-->
|
||||
delete from member_wallet_info
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
where id = #{id,jdbcType=BIGINT}
|
||||
</delete>
|
||||
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.jsowell.pile.domain.MemberWalletInfo" useGeneratedKeys="true">
|
||||
<!--@mbg.generated-->
|
||||
@@ -157,7 +157,7 @@
|
||||
del_flag = #{delFlag,jdbcType=CHAR},
|
||||
</if>
|
||||
</set>
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
where id = #{id,jdbcType=BIGINT}
|
||||
</update>
|
||||
<update id="updateByPrimaryKey" parameterType="com.jsowell.pile.domain.MemberWalletInfo">
|
||||
<!--@mbg.generated-->
|
||||
@@ -173,7 +173,7 @@
|
||||
update_by = #{updateBy,jdbcType=VARCHAR},
|
||||
update_time = #{updateTime,jdbcType=TIMESTAMP},
|
||||
del_flag = #{delFlag,jdbcType=CHAR}
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
where id = #{id,jdbcType=BIGINT}
|
||||
</update>
|
||||
<update id="updateBatch" parameterType="java.util.List">
|
||||
<!--@mbg.generated-->
|
||||
@@ -181,63 +181,63 @@
|
||||
<trim prefix="set" suffixOverrides=",">
|
||||
<trim prefix="member_id = case" suffix="end,">
|
||||
<foreach collection="list" index="index" item="item">
|
||||
when id = #{item.id,jdbcType=INTEGER} then #{item.memberId,jdbcType=VARCHAR}
|
||||
when id = #{item.id,jdbcType=BIGINT} then #{item.memberId,jdbcType=VARCHAR}
|
||||
</foreach>
|
||||
</trim>
|
||||
<trim prefix="merchant_id = case" suffix="end,">
|
||||
<foreach collection="list" index="index" item="item">
|
||||
when id = #{item.id,jdbcType=INTEGER} then #{item.merchantId,jdbcType=VARCHAR}
|
||||
when id = #{item.id,jdbcType=BIGINT} then #{item.merchantId,jdbcType=VARCHAR}
|
||||
</foreach>
|
||||
</trim>
|
||||
<trim prefix="wallet_code = case" suffix="end,">
|
||||
<foreach collection="list" index="index" item="item">
|
||||
when id = #{item.id,jdbcType=INTEGER} then #{item.walletCode,jdbcType=VARCHAR}
|
||||
when id = #{item.id,jdbcType=BIGINT} then #{item.walletCode,jdbcType=VARCHAR}
|
||||
</foreach>
|
||||
</trim>
|
||||
<trim prefix="principal_balance = case" suffix="end,">
|
||||
<foreach collection="list" index="index" item="item">
|
||||
when id = #{item.id,jdbcType=INTEGER} then #{item.principalBalance,jdbcType=DECIMAL}
|
||||
when id = #{item.id,jdbcType=BIGINT} then #{item.principalBalance,jdbcType=DECIMAL}
|
||||
</foreach>
|
||||
</trim>
|
||||
<trim prefix="gift_balance = case" suffix="end,">
|
||||
<foreach collection="list" index="index" item="item">
|
||||
when id = #{item.id,jdbcType=INTEGER} then #{item.giftBalance,jdbcType=DECIMAL}
|
||||
when id = #{item.id,jdbcType=BIGINT} then #{item.giftBalance,jdbcType=DECIMAL}
|
||||
</foreach>
|
||||
</trim>
|
||||
<trim prefix="version = case" suffix="end,">
|
||||
<foreach collection="list" index="index" item="item">
|
||||
when id = #{item.id,jdbcType=INTEGER} then #{item.version,jdbcType=INTEGER}
|
||||
when id = #{item.id,jdbcType=BIGINT} then #{item.version,jdbcType=INTEGER}
|
||||
</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}
|
||||
when id = #{item.id,jdbcType=BIGINT} then #{item.createBy,jdbcType=VARCHAR}
|
||||
</foreach>
|
||||
</trim>
|
||||
<trim prefix="create_time = case" suffix="end,">
|
||||
<foreach collection="list" index="index" item="item">
|
||||
when id = #{item.id,jdbcType=INTEGER} then #{item.createTime,jdbcType=TIMESTAMP}
|
||||
when id = #{item.id,jdbcType=BIGINT} then #{item.createTime,jdbcType=TIMESTAMP}
|
||||
</foreach>
|
||||
</trim>
|
||||
<trim prefix="update_by = case" suffix="end,">
|
||||
<foreach collection="list" index="index" item="item">
|
||||
when id = #{item.id,jdbcType=INTEGER} then #{item.updateBy,jdbcType=VARCHAR}
|
||||
when id = #{item.id,jdbcType=BIGINT} then #{item.updateBy,jdbcType=VARCHAR}
|
||||
</foreach>
|
||||
</trim>
|
||||
<trim prefix="update_time = case" suffix="end,">
|
||||
<foreach collection="list" index="index" item="item">
|
||||
when id = #{item.id,jdbcType=INTEGER} then #{item.updateTime,jdbcType=TIMESTAMP}
|
||||
when id = #{item.id,jdbcType=BIGINT} then #{item.updateTime,jdbcType=TIMESTAMP}
|
||||
</foreach>
|
||||
</trim>
|
||||
<trim prefix="del_flag = case" suffix="end,">
|
||||
<foreach collection="list" index="index" item="item">
|
||||
when id = #{item.id,jdbcType=INTEGER} then #{item.delFlag,jdbcType=CHAR}
|
||||
when id = #{item.id,jdbcType=BIGINT} then #{item.delFlag,jdbcType=CHAR}
|
||||
</foreach>
|
||||
</trim>
|
||||
</trim>
|
||||
where id in
|
||||
<foreach close=")" collection="list" item="item" open="(" separator=", ">
|
||||
#{item.id,jdbcType=INTEGER}
|
||||
#{item.id,jdbcType=BIGINT}
|
||||
</foreach>
|
||||
</update>
|
||||
<update id="updateBatchSelective" parameterType="java.util.List">
|
||||
@@ -247,84 +247,84 @@
|
||||
<trim prefix="member_id = case" suffix="end,">
|
||||
<foreach collection="list" index="index" item="item">
|
||||
<if test="item.memberId != null">
|
||||
when id = #{item.id,jdbcType=INTEGER} then #{item.memberId,jdbcType=VARCHAR}
|
||||
when id = #{item.id,jdbcType=BIGINT} then #{item.memberId,jdbcType=VARCHAR}
|
||||
</if>
|
||||
</foreach>
|
||||
</trim>
|
||||
<trim prefix="merchant_id = case" suffix="end,">
|
||||
<foreach collection="list" index="index" item="item">
|
||||
<if test="item.merchantId != null">
|
||||
when id = #{item.id,jdbcType=INTEGER} then #{item.merchantId,jdbcType=VARCHAR}
|
||||
when id = #{item.id,jdbcType=BIGINT} then #{item.merchantId,jdbcType=VARCHAR}
|
||||
</if>
|
||||
</foreach>
|
||||
</trim>
|
||||
<trim prefix="wallet_code = case" suffix="end,">
|
||||
<foreach collection="list" index="index" item="item">
|
||||
<if test="item.walletCode != null">
|
||||
when id = #{item.id,jdbcType=INTEGER} then #{item.walletCode,jdbcType=VARCHAR}
|
||||
when id = #{item.id,jdbcType=BIGINT} then #{item.walletCode,jdbcType=VARCHAR}
|
||||
</if>
|
||||
</foreach>
|
||||
</trim>
|
||||
<trim prefix="principal_balance = case" suffix="end,">
|
||||
<foreach collection="list" index="index" item="item">
|
||||
<if test="item.principalBalance != null">
|
||||
when id = #{item.id,jdbcType=INTEGER} then #{item.principalBalance,jdbcType=DECIMAL}
|
||||
when id = #{item.id,jdbcType=BIGINT} then #{item.principalBalance,jdbcType=DECIMAL}
|
||||
</if>
|
||||
</foreach>
|
||||
</trim>
|
||||
<trim prefix="gift_balance = case" suffix="end,">
|
||||
<foreach collection="list" index="index" item="item">
|
||||
<if test="item.giftBalance != null">
|
||||
when id = #{item.id,jdbcType=INTEGER} then #{item.giftBalance,jdbcType=DECIMAL}
|
||||
when id = #{item.id,jdbcType=BIGINT} then #{item.giftBalance,jdbcType=DECIMAL}
|
||||
</if>
|
||||
</foreach>
|
||||
</trim>
|
||||
<trim prefix="version = case" suffix="end,">
|
||||
<foreach collection="list" index="index" item="item">
|
||||
<if test="item.version != null">
|
||||
when id = #{item.id,jdbcType=INTEGER} then #{item.version,jdbcType=INTEGER}
|
||||
when id = #{item.id,jdbcType=BIGINT} then #{item.version,jdbcType=INTEGER}
|
||||
</if>
|
||||
</foreach>
|
||||
</trim>
|
||||
<trim prefix="create_by = case" suffix="end,">
|
||||
<foreach collection="list" index="index" item="item">
|
||||
<if test="item.createBy != null">
|
||||
when id = #{item.id,jdbcType=INTEGER} then #{item.createBy,jdbcType=VARCHAR}
|
||||
when id = #{item.id,jdbcType=BIGINT} then #{item.createBy,jdbcType=VARCHAR}
|
||||
</if>
|
||||
</foreach>
|
||||
</trim>
|
||||
<trim prefix="create_time = case" suffix="end,">
|
||||
<foreach collection="list" index="index" item="item">
|
||||
<if test="item.createTime != null">
|
||||
when id = #{item.id,jdbcType=INTEGER} then #{item.createTime,jdbcType=TIMESTAMP}
|
||||
when id = #{item.id,jdbcType=BIGINT} then #{item.createTime,jdbcType=TIMESTAMP}
|
||||
</if>
|
||||
</foreach>
|
||||
</trim>
|
||||
<trim prefix="update_by = case" suffix="end,">
|
||||
<foreach collection="list" index="index" item="item">
|
||||
<if test="item.updateBy != null">
|
||||
when id = #{item.id,jdbcType=INTEGER} then #{item.updateBy,jdbcType=VARCHAR}
|
||||
when id = #{item.id,jdbcType=BIGINT} then #{item.updateBy,jdbcType=VARCHAR}
|
||||
</if>
|
||||
</foreach>
|
||||
</trim>
|
||||
<trim prefix="update_time = case" suffix="end,">
|
||||
<foreach collection="list" index="index" item="item">
|
||||
<if test="item.updateTime != null">
|
||||
when id = #{item.id,jdbcType=INTEGER} then #{item.updateTime,jdbcType=TIMESTAMP}
|
||||
when id = #{item.id,jdbcType=BIGINT} then #{item.updateTime,jdbcType=TIMESTAMP}
|
||||
</if>
|
||||
</foreach>
|
||||
</trim>
|
||||
<trim prefix="del_flag = case" suffix="end,">
|
||||
<foreach collection="list" index="index" item="item">
|
||||
<if test="item.delFlag != null">
|
||||
when id = #{item.id,jdbcType=INTEGER} then #{item.delFlag,jdbcType=CHAR}
|
||||
when id = #{item.id,jdbcType=BIGINT} then #{item.delFlag,jdbcType=CHAR}
|
||||
</if>
|
||||
</foreach>
|
||||
</trim>
|
||||
</trim>
|
||||
where id in
|
||||
<foreach close=")" collection="list" item="item" open="(" separator=", ">
|
||||
#{item.id,jdbcType=INTEGER}
|
||||
#{item.id,jdbcType=BIGINT}
|
||||
</foreach>
|
||||
</update>
|
||||
<insert id="batchInsert" keyColumn="id" keyProperty="id" parameterType="map" useGeneratedKeys="true">
|
||||
@@ -363,7 +363,7 @@
|
||||
values
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">
|
||||
#{id,jdbcType=INTEGER},
|
||||
#{id,jdbcType=BIGINT},
|
||||
</if>
|
||||
#{memberId,jdbcType=VARCHAR},
|
||||
#{merchantId,jdbcType=VARCHAR},
|
||||
@@ -380,7 +380,7 @@
|
||||
on duplicate key update
|
||||
<trim suffixOverrides=",">
|
||||
<if test="id != null">
|
||||
id = #{id,jdbcType=INTEGER},
|
||||
id = #{id,jdbcType=BIGINT},
|
||||
</if>
|
||||
member_id = #{memberId,jdbcType=VARCHAR},
|
||||
merchant_id = #{merchantId,jdbcType=VARCHAR},
|
||||
@@ -439,7 +439,7 @@
|
||||
values
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">
|
||||
#{id,jdbcType=INTEGER},
|
||||
#{id,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="memberId != null">
|
||||
#{memberId,jdbcType=VARCHAR},
|
||||
@@ -478,7 +478,7 @@
|
||||
on duplicate key update
|
||||
<trim suffixOverrides=",">
|
||||
<if test="id != null">
|
||||
id = #{id,jdbcType=INTEGER},
|
||||
id = #{id,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="memberId != null">
|
||||
member_id = #{memberId,jdbcType=VARCHAR},
|
||||
|
||||
Reference in New Issue
Block a user