收款账户
This commit is contained in:
parent
390cf406a2
commit
b84385e313
|
@ -10,14 +10,13 @@ import com.ruoyi.common.config.WxConfig;
|
|||
import com.ruoyi.common.core.domain.entity.SmUser;
|
||||
import com.ruoyi.common.core.domain.model.WxLoginBody;
|
||||
import com.ruoyi.common.enums.UserStatus;
|
||||
import com.ruoyi.common.enums.UserType;
|
||||
import com.ruoyi.common.utils.ServiceUtil;
|
||||
import com.ruoyi.common.utils.http.HttpUtils;
|
||||
import com.ruoyi.common.wx.AccessTokenUtil;
|
||||
import com.ruoyi.ss.account.domain.Account;
|
||||
import com.ruoyi.ss.store.service.IStoreService;
|
||||
import com.ruoyi.ss.user.service.ISmUserService;
|
||||
import com.ruoyi.ss.account.service.ISmAccountService;
|
||||
import com.ruoyi.ss.account.domain.SmAccountBO;
|
||||
import com.ruoyi.ss.account.service.AccountService;
|
||||
import com.ruoyi.ss.account.domain.enums.AccountType;
|
||||
import com.ruoyi.system.service.*;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
|
@ -80,7 +79,7 @@ public class SysLoginService
|
|||
private WxConfig wxConfig;
|
||||
|
||||
@Autowired
|
||||
private ISmAccountService accountService;
|
||||
private AccountService accountService;
|
||||
|
||||
@Autowired
|
||||
private IStoreService smDeviceGroupService;
|
||||
|
@ -319,7 +318,7 @@ public class SysLoginService
|
|||
smUserService.insertSmUser(newUser);
|
||||
|
||||
// 添加微信账户
|
||||
SmAccountBO accountData = new SmAccountBO();
|
||||
Account accountData = new Account();
|
||||
accountData.setUserId(newUser.getUserId());
|
||||
accountData.setAccountNo(newUser.getWxOpenId());
|
||||
accountData.setAccountType(AccountType.WECHAT.getType());
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package com.ruoyi.ss.account.domain;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
import com.ruoyi.common.annotation.Sensitive;
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
|
@ -15,7 +14,9 @@ import lombok.Data;
|
|||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Pattern;
|
||||
import javax.validation.constraints.Size;
|
||||
|
||||
/**
|
||||
* 用户账户对象 sm_account
|
||||
|
@ -24,45 +25,48 @@ import javax.validation.constraints.Pattern;
|
|||
* @date 2024-03-26
|
||||
*/
|
||||
@Data
|
||||
public class SmAccount extends BaseEntity
|
||||
public class Account extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 账户id */
|
||||
@NotNull(message = "账户ID不允许为空", groups = {ValidGroup.Update.class, ValidGroup.FrontUpdate.class})
|
||||
private Long accountId;
|
||||
|
||||
/** 用户id */
|
||||
@Excel(name = "用户id")
|
||||
@NotNull(message = "用户ID不允许为空", groups = {ValidGroup.Create.class})
|
||||
private Long userId;
|
||||
|
||||
/** 账户类型:1银行卡、2微信、3支付宝 */
|
||||
@Excel(name = "账户类型:1银行卡、2微信、3支付宝")
|
||||
@Excel(name = "账户类型:1银行卡、2微信、3支付宝、4线下收款码")
|
||||
@EnumValid(
|
||||
clazz = AccountType.class,
|
||||
message = "非法的账户类型",
|
||||
allowNull = false,
|
||||
method = "getType",
|
||||
groups = {ValidGroup.FrontCreate.class}
|
||||
method = "getType"
|
||||
)
|
||||
@NotBlank(message = "账户类型不允许为空", groups = {ValidGroup.FrontCreate.class, ValidGroup.Create.class})
|
||||
private String accountType;
|
||||
|
||||
/** 姓名 */
|
||||
@Excel(name = "姓名")
|
||||
@Size(max = 32, message = "姓名长度不能超过32个字符")
|
||||
private String name;
|
||||
|
||||
/** 身份证 */
|
||||
@Excel(name = "身份证")
|
||||
@Pattern(regexp = RegexpUtils.IDENTITY_CARD_REGEXP, message = "身份证格式错误", groups = {ValidGroup.FrontCreate.class})
|
||||
@JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
|
||||
@Pattern(regexp = RegexpUtils.IDENTITY_CARD_REGEXP, message = "身份证格式错误")
|
||||
@Sensitive(desensitizedType = DesensitizedType.ID_CARD)
|
||||
private String idCard;
|
||||
|
||||
/** 卡号(微信号/支付宝账号) */
|
||||
@Excel(name = "卡号/微信号/支付宝账号")
|
||||
@NotBlank(message = "卡号/微信号/支付宝账号不允许为空", groups = {ValidGroup.FrontCreate.class})
|
||||
@Excel(name = "账户")
|
||||
@NotBlank(message = "账户不允许为空", groups = {ValidGroup.FrontCreate.class, ValidGroup.Create.class})
|
||||
private String accountNo;
|
||||
|
||||
/** 手机号 */
|
||||
@Excel(name = "手机号")
|
||||
@Pattern(regexp = RegexpUtils.MOBILE_PHONE_REGEXP, message = "手机号格式错误")
|
||||
private String mobile;
|
||||
|
||||
@ApiModelProperty("卡面信息")
|
|
@ -8,8 +8,9 @@ import lombok.Data;
|
|||
* 2024/3/27
|
||||
*/
|
||||
@Data
|
||||
public class SmAccountVO extends SmAccount {
|
||||
public class AccountQuery extends Account {
|
||||
|
||||
@ApiModelProperty("用户名称")
|
||||
private String userName;
|
||||
|
||||
}
|
|
@ -8,9 +8,8 @@ import lombok.Data;
|
|||
* 2024/3/27
|
||||
*/
|
||||
@Data
|
||||
public class SmAccountQuery extends SmAccount {
|
||||
public class AccountVO extends Account {
|
||||
|
||||
@ApiModelProperty("用户名称")
|
||||
private String userName;
|
||||
|
||||
}
|
|
@ -1,16 +0,0 @@
|
|||
package com.ruoyi.ss.account.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author wjh
|
||||
* 2024/3/26
|
||||
*/
|
||||
@Data
|
||||
public class SmAccountBO extends SmAccount {
|
||||
|
||||
// @ApiModelProperty("手机验证码")
|
||||
// @NotNull(message = "验证码不允许为空", groups = {ValidGroup.FrontCreate.class})
|
||||
// private String mobileCode;
|
||||
|
||||
}
|
|
@ -1,8 +1,8 @@
|
|||
package com.ruoyi.ss.account.mapper;
|
||||
|
||||
import com.ruoyi.ss.account.domain.SmAccount;
|
||||
import com.ruoyi.ss.account.domain.SmAccountQuery;
|
||||
import com.ruoyi.ss.account.domain.SmAccountVO;
|
||||
import com.ruoyi.ss.account.domain.Account;
|
||||
import com.ruoyi.ss.account.domain.AccountQuery;
|
||||
import com.ruoyi.ss.account.domain.AccountVO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -13,7 +13,7 @@ import java.util.List;
|
|||
* @author ruoyi
|
||||
* @date 2024-03-26
|
||||
*/
|
||||
public interface SmAccountMapper
|
||||
public interface AccountMapper
|
||||
{
|
||||
/**
|
||||
* 查询用户账户
|
||||
|
@ -21,7 +21,7 @@ public interface SmAccountMapper
|
|||
* @param accountId 用户账户主键
|
||||
* @return 用户账户
|
||||
*/
|
||||
public SmAccountVO selectSmAccountByAccountId(Long accountId);
|
||||
public AccountVO selectSmAccountByAccountId(Long accountId);
|
||||
|
||||
/**
|
||||
* 查询用户账户列表
|
||||
|
@ -29,23 +29,23 @@ public interface SmAccountMapper
|
|||
* @param smAccount 用户账户
|
||||
* @return 用户账户集合
|
||||
*/
|
||||
public List<SmAccountVO> selectSmAccountList(SmAccountQuery smAccount);
|
||||
public List<AccountVO> selectSmAccountList(AccountQuery smAccount);
|
||||
|
||||
/**
|
||||
* 新增用户账户
|
||||
*
|
||||
* @param smAccount 用户账户
|
||||
* @param account 用户账户
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertSmAccount(SmAccount smAccount);
|
||||
public int insertSmAccount(Account account);
|
||||
|
||||
/**
|
||||
* 修改用户账户
|
||||
*
|
||||
* @param smAccount 用户账户
|
||||
* @param account 用户账户
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateSmAccount(SmAccount smAccount);
|
||||
public int updateSmAccount(Account account);
|
||||
|
||||
/**
|
||||
* 删除用户账户
|
||||
|
@ -68,7 +68,7 @@ public interface SmAccountMapper
|
|||
* @param accountNo 账号
|
||||
* @param accountType 类型
|
||||
*/
|
||||
SmAccountVO selectByAccountNo(@Param("accountNo") String accountNo, @Param("accountType") String accountType);
|
||||
AccountVO selectByAccountNo(@Param("accountNo") String accountNo, @Param("accountType") String accountType);
|
||||
|
||||
/**
|
||||
* 为用户设置默认的账户
|
|
@ -2,9 +2,9 @@
|
|||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.ruoyi.ss.account.mapper.SmAccountMapper">
|
||||
<mapper namespace="com.ruoyi.ss.account.mapper.AccountMapper">
|
||||
|
||||
<resultMap type="SmAccountVO" id="SmAccountResult" autoMapping="true">
|
||||
<resultMap type="AccountVO" id="SmAccountResult" autoMapping="true">
|
||||
<result property="cardInfo" column="card_info" typeHandler="com.ruoyi.system.mapper.typehandler.BankCardInfoTypeHandler" />
|
||||
</resultMap>
|
||||
|
||||
|
@ -26,7 +26,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
left join sm_user su on su.user_id = sa.user_id
|
||||
</sql>
|
||||
|
||||
<select id="selectSmAccountList" parameterType="SmAccountQuery" resultMap="SmAccountResult">
|
||||
<select id="selectSmAccountList" parameterType="AccountQuery" resultMap="SmAccountResult">
|
||||
<include refid="selectSmAccountVo"/>
|
||||
<where>
|
||||
<if test="userId != null "> and sa.user_id = #{userId}</if>
|
||||
|
@ -57,7 +57,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
limit 1
|
||||
</select>
|
||||
|
||||
<insert id="insertSmAccount" parameterType="SmAccount">
|
||||
<insert id="insertSmAccount" parameterType="Account">
|
||||
insert into sm_account
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="accountId != null">account_id,</if>
|
||||
|
@ -87,7 +87,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateSmAccount" parameterType="SmAccount">
|
||||
<update id="updateSmAccount" parameterType="Account">
|
||||
update sm_account
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="userId != null">user_id = #{userId},</if>
|
|
@ -1,9 +1,8 @@
|
|||
package com.ruoyi.ss.account.service;
|
||||
|
||||
import com.ruoyi.ss.account.domain.SmAccount;
|
||||
import com.ruoyi.ss.account.domain.SmAccountBO;
|
||||
import com.ruoyi.ss.account.domain.SmAccountQuery;
|
||||
import com.ruoyi.ss.account.domain.SmAccountVO;
|
||||
import com.ruoyi.ss.account.domain.Account;
|
||||
import com.ruoyi.ss.account.domain.AccountQuery;
|
||||
import com.ruoyi.ss.account.domain.AccountVO;
|
||||
import com.ruoyi.ss.account.domain.enums.AccountType;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -15,7 +14,7 @@ import java.util.Map;
|
|||
* @author ruoyi
|
||||
* @date 2024-03-26
|
||||
*/
|
||||
public interface ISmAccountService
|
||||
public interface AccountService
|
||||
{
|
||||
/**
|
||||
* 查询用户账户
|
||||
|
@ -23,7 +22,7 @@ public interface ISmAccountService
|
|||
* @param accountId 用户账户主键
|
||||
* @return 用户账户
|
||||
*/
|
||||
public SmAccountVO selectSmAccountByAccountId(Long accountId);
|
||||
public AccountVO selectSmAccountByAccountId(Long accountId);
|
||||
|
||||
/**
|
||||
* 查询用户账户列表
|
||||
|
@ -31,23 +30,23 @@ public interface ISmAccountService
|
|||
* @param smAccount 用户账户
|
||||
* @return 用户账户集合
|
||||
*/
|
||||
public List<SmAccountVO> selectSmAccountList(SmAccountQuery smAccount);
|
||||
public List<AccountVO> selectSmAccountList(AccountQuery smAccount);
|
||||
|
||||
/**
|
||||
* 新增用户账户
|
||||
*
|
||||
* @param smAccount 用户账户
|
||||
* @param account 用户账户
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertSmAccount(SmAccount smAccount);
|
||||
public int insertSmAccount(Account account);
|
||||
|
||||
/**
|
||||
* 修改用户账户
|
||||
*
|
||||
* @param smAccount 用户账户
|
||||
* @param account 用户账户
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateSmAccount(SmAccount smAccount);
|
||||
public int updateSmAccount(Account account);
|
||||
|
||||
/**
|
||||
* 批量删除用户账户
|
||||
|
@ -69,12 +68,12 @@ public interface ISmAccountService
|
|||
* 新增账户信息
|
||||
* @param data 账户信息
|
||||
*/
|
||||
boolean addAccount(SmAccountBO data);
|
||||
boolean addAccount(Account data);
|
||||
|
||||
/**
|
||||
* 查询列表并分组
|
||||
*/
|
||||
Map<String, List<SmAccountVO>> selectSmAccountGroup(SmAccountQuery dto);
|
||||
Map<String, List<AccountVO>> selectSmAccountGroup(AccountQuery dto);
|
||||
|
||||
/**
|
||||
* 判断这个账号是不是用户的
|
||||
|
@ -87,13 +86,13 @@ public interface ISmAccountService
|
|||
* 查询用户的微信账户
|
||||
* @param userId 用户id
|
||||
*/
|
||||
SmAccountVO selectUserWxAccount(Long userId);
|
||||
AccountVO selectUserWxAccount(Long userId);
|
||||
|
||||
/**
|
||||
* 查询用户的支付宝账户
|
||||
* @param userId 用户id
|
||||
*/
|
||||
SmAccountVO selectUseAliAccount(Long userId);
|
||||
AccountVO selectUseAliAccount(Long userId);
|
||||
|
||||
/**
|
||||
* 设置默认账户
|
|
@ -4,13 +4,12 @@ import com.ruoyi.common.utils.DateUtils;
|
|||
import com.ruoyi.common.utils.ServiceUtil;
|
||||
import com.ruoyi.common.valid.bank.BankCardInfo;
|
||||
import com.ruoyi.common.valid.bank.BankValidUtils;
|
||||
import com.ruoyi.ss.account.domain.SmAccount;
|
||||
import com.ruoyi.ss.account.domain.SmAccountBO;
|
||||
import com.ruoyi.ss.account.domain.SmAccountQuery;
|
||||
import com.ruoyi.ss.account.domain.SmAccountVO;
|
||||
import com.ruoyi.ss.account.domain.Account;
|
||||
import com.ruoyi.ss.account.domain.AccountQuery;
|
||||
import com.ruoyi.ss.account.domain.AccountVO;
|
||||
import com.ruoyi.ss.account.domain.enums.AccountType;
|
||||
import com.ruoyi.ss.account.mapper.SmAccountMapper;
|
||||
import com.ruoyi.ss.account.service.ISmAccountService;
|
||||
import com.ruoyi.ss.account.mapper.AccountMapper;
|
||||
import com.ruoyi.ss.account.service.AccountService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
@ -25,10 +24,9 @@ import java.util.stream.Collectors;
|
|||
* @date 2024-03-26
|
||||
*/
|
||||
@Service
|
||||
public class SmAccountServiceImpl implements ISmAccountService
|
||||
{
|
||||
public class AccountServiceImpl implements AccountService {
|
||||
@Autowired
|
||||
private SmAccountMapper smAccountMapper;
|
||||
private AccountMapper accountMapper;
|
||||
|
||||
/**
|
||||
* 查询用户账户
|
||||
|
@ -37,9 +35,8 @@ public class SmAccountServiceImpl implements ISmAccountService
|
|||
* @return 用户账户
|
||||
*/
|
||||
@Override
|
||||
public SmAccountVO selectSmAccountByAccountId(Long accountId)
|
||||
{
|
||||
SmAccountVO account = smAccountMapper.selectSmAccountByAccountId(accountId);
|
||||
public AccountVO selectSmAccountByAccountId(Long accountId) {
|
||||
AccountVO account = accountMapper.selectSmAccountByAccountId(accountId);
|
||||
account.desensitization();
|
||||
return account;
|
||||
}
|
||||
|
@ -51,34 +48,31 @@ public class SmAccountServiceImpl implements ISmAccountService
|
|||
* @return 用户账户
|
||||
*/
|
||||
@Override
|
||||
public List<SmAccountVO> selectSmAccountList(SmAccountQuery dto)
|
||||
{
|
||||
return smAccountMapper.selectSmAccountList(dto);
|
||||
public List<AccountVO> selectSmAccountList(AccountQuery dto) {
|
||||
return accountMapper.selectSmAccountList(dto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增用户账户
|
||||
*
|
||||
* @param smAccount 用户账户
|
||||
* @param account 用户账户
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertSmAccount(SmAccount smAccount)
|
||||
{
|
||||
smAccount.setCreateTime(DateUtils.getNowDate());
|
||||
return smAccountMapper.insertSmAccount(smAccount);
|
||||
public int insertSmAccount(Account account) {
|
||||
account.setCreateTime(DateUtils.getNowDate());
|
||||
return accountMapper.insertSmAccount(account);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改用户账户
|
||||
*
|
||||
* @param smAccount 用户账户
|
||||
* @param account 用户账户
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateSmAccount(SmAccount smAccount)
|
||||
{
|
||||
return smAccountMapper.updateSmAccount(smAccount);
|
||||
public int updateSmAccount(Account account) {
|
||||
return accountMapper.updateSmAccount(account);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -88,9 +82,8 @@ public class SmAccountServiceImpl implements ISmAccountService
|
|||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteSmAccountByAccountIds(Long[] accountIds)
|
||||
{
|
||||
return smAccountMapper.deleteSmAccountByAccountIds(accountIds);
|
||||
public int deleteSmAccountByAccountIds(Long[] accountIds) {
|
||||
return accountMapper.deleteSmAccountByAccountIds(accountIds);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -100,13 +93,12 @@ public class SmAccountServiceImpl implements ISmAccountService
|
|||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteSmAccountByAccountId(Long accountId)
|
||||
{
|
||||
return smAccountMapper.deleteSmAccountByAccountId(accountId);
|
||||
public int deleteSmAccountByAccountId(Long accountId) {
|
||||
return accountMapper.deleteSmAccountByAccountId(accountId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addAccount(SmAccountBO data) {
|
||||
public boolean addAccount(Account data) {
|
||||
// 查重
|
||||
ServiceUtil.assertion(isRepeat(data), "已绑定的账户不可重复绑定");
|
||||
|
||||
|
@ -121,25 +113,29 @@ public class SmAccountServiceImpl implements ISmAccountService
|
|||
}
|
||||
|
||||
@Override
|
||||
public Map<String, List<SmAccountVO>> selectSmAccountGroup(SmAccountQuery dto) {
|
||||
List<SmAccountVO> list = this.selectSmAccountList(dto);
|
||||
public Map<String, List<AccountVO>> selectSmAccountGroup(AccountQuery dto) {
|
||||
List<AccountVO> list = this.selectSmAccountList(dto);
|
||||
if (CollectionUtils.isEmpty(list)) {
|
||||
return Collections.emptyMap();
|
||||
}
|
||||
Map<String, List<SmAccountVO>> map = new HashMap<>();
|
||||
list.forEach(AccountVO::desensitization);
|
||||
Map<String, List<AccountVO>> map = new HashMap<>();
|
||||
map.put(AccountType.BANK_CARD.name(), list.stream()
|
||||
.filter(item -> Objects.equals(AccountType.BANK_CARD.getType(), item.getAccountType())).collect(Collectors.toList()));
|
||||
map.put(AccountType.WECHAT.name(), list.stream()
|
||||
.filter(item -> Objects.equals(AccountType.WECHAT.getType(), item.getAccountType())).collect(Collectors.toList()));
|
||||
map.put(AccountType.ALIPAY.name(), list.stream()
|
||||
.filter(item -> Objects.equals(AccountType.ALIPAY.getType(), item.getAccountType())).collect(Collectors.toList()));
|
||||
map.put(AccountType.OFFLINE_IMAGE.name(), list.stream()
|
||||
.filter(item -> Objects.equals(AccountType.OFFLINE_IMAGE.getType(), item.getAccountType())).collect(Collectors.toList()));
|
||||
return map;
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断用户是否有这个账号
|
||||
* @param userId 用户id
|
||||
* @param accountNo 账号
|
||||
*
|
||||
* @param userId 用户id
|
||||
* @param accountNo 账号
|
||||
* @param accountType 账号类型
|
||||
*/
|
||||
@Override
|
||||
|
@ -147,19 +143,19 @@ public class SmAccountServiceImpl implements ISmAccountService
|
|||
if (userId == null || accountNo == null) {
|
||||
return false;
|
||||
}
|
||||
SmAccountVO account = smAccountMapper.selectByAccountNo(accountNo, accountType.getType());
|
||||
AccountVO account = accountMapper.selectByAccountNo(accountNo, accountType.getType());
|
||||
return account != null && account.getUserId() != null && account.getUserId().equals(userId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SmAccountVO selectUserWxAccount(Long userId) {
|
||||
public AccountVO selectUserWxAccount(Long userId) {
|
||||
if (userId == null) {
|
||||
return null;
|
||||
}
|
||||
SmAccountQuery dto = new SmAccountQuery();
|
||||
AccountQuery dto = new AccountQuery();
|
||||
dto.setUserId(userId);
|
||||
dto.setAccountType(AccountType.WECHAT.getType());
|
||||
List<SmAccountVO> list = smAccountMapper.selectSmAccountList(dto);
|
||||
List<AccountVO> list = accountMapper.selectSmAccountList(dto);
|
||||
if (CollectionUtils.isEmpty(list)) {
|
||||
return null;
|
||||
}
|
||||
|
@ -167,14 +163,14 @@ public class SmAccountServiceImpl implements ISmAccountService
|
|||
}
|
||||
|
||||
@Override
|
||||
public SmAccountVO selectUseAliAccount(Long userId) {
|
||||
public AccountVO selectUseAliAccount(Long userId) {
|
||||
if (userId == null) {
|
||||
return null;
|
||||
}
|
||||
SmAccountQuery dto = new SmAccountQuery();
|
||||
AccountQuery dto = new AccountQuery();
|
||||
dto.setUserId(userId);
|
||||
dto.setAccountType(AccountType.ALIPAY.getType());
|
||||
List<SmAccountVO> list = smAccountMapper.selectSmAccountList(dto);
|
||||
List<AccountVO> list = accountMapper.selectSmAccountList(dto);
|
||||
if (CollectionUtils.isEmpty(list)) {
|
||||
return null;
|
||||
}
|
||||
|
@ -183,22 +179,23 @@ public class SmAccountServiceImpl implements ISmAccountService
|
|||
|
||||
@Override
|
||||
public boolean setDefault(Long userId, Long accountId) {
|
||||
SmAccountVO account = smAccountMapper.selectSmAccountByAccountId(accountId);
|
||||
AccountVO account = accountMapper.selectSmAccountByAccountId(accountId);
|
||||
ServiceUtil.assertion(account == null, "账户不存在");
|
||||
ServiceUtil.assertion(!Objects.equals(account.getUserId(), userId), "该账户不是本用户的账户");
|
||||
|
||||
int updateCount = smAccountMapper.setDefault(userId, accountId);
|
||||
int updateCount = accountMapper.setDefault(userId, accountId);
|
||||
ServiceUtil.assertion(updateCount == 0, "设置默认账户失败");
|
||||
return true;
|
||||
}
|
||||
|
||||
private boolean isRepeat(SmAccountBO data) {
|
||||
SmAccountQuery dto = new SmAccountQuery();
|
||||
private boolean isRepeat(Account data) {
|
||||
AccountQuery dto = new AccountQuery();
|
||||
dto.setAccountNo(data.getAccountNo());
|
||||
dto.setUserId(data.getUserId());
|
||||
List<SmAccountVO> repeats = smAccountMapper.selectSmAccountList(dto);
|
||||
dto.setAccountType(data.getAccountType());
|
||||
List<AccountVO> repeats = accountMapper.selectSmAccountList(dto);
|
||||
if (!CollectionUtils.isEmpty(repeats)) {
|
||||
for (SmAccountVO repeat : repeats) {
|
||||
for (AccountVO repeat : repeats) {
|
||||
if (!Objects.equals(repeat.getAccountId(), data.getAccountId())) {
|
||||
return true;
|
||||
}
|
|
@ -6,8 +6,8 @@ import com.ruoyi.common.core.redis.enums.RedisLockKey;
|
|||
import com.ruoyi.common.exception.ServiceException;
|
||||
import com.ruoyi.common.utils.*;
|
||||
import com.ruoyi.common.utils.collection.CollectionUtils;
|
||||
import com.ruoyi.ss.account.domain.SmAccountVO;
|
||||
import com.ruoyi.ss.account.service.ISmAccountService;
|
||||
import com.ruoyi.ss.account.domain.AccountVO;
|
||||
import com.ruoyi.ss.account.service.AccountService;
|
||||
import com.ruoyi.ss.channel.domain.SmChannel;
|
||||
import com.ruoyi.ss.channel.service.ISmChannelService;
|
||||
import com.ruoyi.ss.dashboard.BillCountVo;
|
||||
|
@ -100,7 +100,7 @@ public class TransactionBillServiceImpl implements TransactionBillService {
|
|||
private RedisLock redisLock;
|
||||
|
||||
@Autowired
|
||||
private ISmAccountService smAccountService;
|
||||
private AccountService smAccountService;
|
||||
|
||||
@Autowired
|
||||
private IStoreService storeService;
|
||||
|
@ -403,11 +403,11 @@ public class TransactionBillServiceImpl implements TransactionBillService {
|
|||
ServiceUtil.assertion(!smAccountService.validateUserHasAccount(userId, accountNo, payType.getAccountType()),
|
||||
"该提现账号未绑定,请重新选择");
|
||||
} else if (TransactionBillPayType.WECHAT.equals(payType)){
|
||||
SmAccountVO wxAccount = smAccountService.selectUserWxAccount(userId);
|
||||
AccountVO wxAccount = smAccountService.selectUserWxAccount(userId);
|
||||
ServiceUtil.assertion(wxAccount == null, "用户不存在微信账户");
|
||||
accountNo = wxAccount.getAccountNo();
|
||||
} else if (TransactionBillPayType.ALI.equals(payType)) {
|
||||
SmAccountVO wxAccount = smAccountService.selectUseAliAccount(userId);
|
||||
AccountVO wxAccount = smAccountService.selectUseAliAccount(userId);
|
||||
ServiceUtil.assertion(wxAccount == null, "用户不存在支付宝账户");
|
||||
accountNo = wxAccount.getAccountNo();
|
||||
}
|
||||
|
|
|
@ -3,10 +3,9 @@ package com.ruoyi.web.controller.app;
|
|||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.domain.ValidGroup;
|
||||
import com.ruoyi.ss.account.domain.SmAccountBO;
|
||||
import com.ruoyi.ss.account.domain.SmAccountQuery;
|
||||
import com.ruoyi.ss.account.service.ISmAccountService;
|
||||
import com.ruoyi.system.service.IVerificationCodeService;
|
||||
import com.ruoyi.ss.account.domain.Account;
|
||||
import com.ruoyi.ss.account.domain.AccountQuery;
|
||||
import com.ruoyi.ss.account.service.AccountService;
|
||||
import com.ruoyi.web.core.annotation.MchRequired;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
|
@ -23,19 +22,19 @@ import org.springframework.web.bind.annotation.*;
|
|||
public class AppAccountController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private ISmAccountService accountService;
|
||||
private AccountService accountService;
|
||||
|
||||
@MchRequired
|
||||
@ApiOperation("添加收款账户")
|
||||
@PostMapping
|
||||
public AjaxResult addAccount(@RequestBody @Validated({ValidGroup.FrontCreate.class})SmAccountBO data) {
|
||||
public AjaxResult addAccount(@RequestBody @Validated({ValidGroup.FrontCreate.class}) Account data) {
|
||||
data.setUserId(getUserId());
|
||||
return success(accountService.addAccount(data));
|
||||
}
|
||||
|
||||
@ApiOperation("查询本人收款账户列表")
|
||||
@GetMapping
|
||||
public AjaxResult list(@Validated({ValidGroup.Query.class}) SmAccountQuery dto) {
|
||||
public AjaxResult list(AccountQuery dto) {
|
||||
dto.setUserId(getUserId());
|
||||
return success(accountService.selectSmAccountGroup(dto));
|
||||
}
|
||||
|
|
|
@ -2,8 +2,11 @@ package com.ruoyi.web.controller.ss;
|
|||
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.ruoyi.common.core.domain.ValidGroup;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
|
@ -16,10 +19,10 @@ import com.ruoyi.common.annotation.Log;
|
|||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.ss.account.domain.SmAccount;
|
||||
import com.ruoyi.ss.account.domain.SmAccountVO;
|
||||
import com.ruoyi.ss.account.domain.SmAccountQuery;
|
||||
import com.ruoyi.ss.account.service.ISmAccountService;
|
||||
import com.ruoyi.ss.account.domain.Account;
|
||||
import com.ruoyi.ss.account.domain.AccountVO;
|
||||
import com.ruoyi.ss.account.domain.AccountQuery;
|
||||
import com.ruoyi.ss.account.service.AccountService;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
|
||||
|
@ -34,18 +37,18 @@ import com.ruoyi.common.core.page.TableDataInfo;
|
|||
public class AccountController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ISmAccountService smAccountService;
|
||||
private AccountService smAccountService;
|
||||
|
||||
/**
|
||||
* 查询用户账户列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('ss:account:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(SmAccountQuery query)
|
||||
public TableDataInfo list(AccountQuery query)
|
||||
{
|
||||
startPage();
|
||||
startOrderBy();
|
||||
List<SmAccountVO> list = smAccountService.selectSmAccountList(query);
|
||||
List<AccountVO> list = smAccountService.selectSmAccountList(query);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
|
@ -55,10 +58,10 @@ public class AccountController extends BaseController
|
|||
@PreAuthorize("@ss.hasPermi('ss:account:export')")
|
||||
@Log(title = "用户账户", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, SmAccountQuery query)
|
||||
public void export(HttpServletResponse response, AccountQuery query)
|
||||
{
|
||||
List<SmAccountVO> list = smAccountService.selectSmAccountList(query);
|
||||
ExcelUtil<SmAccountVO> util = new ExcelUtil<SmAccountVO>(SmAccountVO.class);
|
||||
List<AccountVO> list = smAccountService.selectSmAccountList(query);
|
||||
ExcelUtil<AccountVO> util = new ExcelUtil<AccountVO>(AccountVO.class);
|
||||
util.exportExcel(response, list, "用户账户数据");
|
||||
}
|
||||
|
||||
|
@ -78,9 +81,9 @@ public class AccountController extends BaseController
|
|||
@PreAuthorize("@ss.hasPermi('ss:account:add')")
|
||||
@Log(title = "用户账户", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody SmAccount smAccount)
|
||||
public AjaxResult add(@RequestBody @Validated(ValidGroup.Create.class) Account account)
|
||||
{
|
||||
return toAjax(smAccountService.insertSmAccount(smAccount));
|
||||
return toAjax(smAccountService.addAccount(account));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -89,9 +92,9 @@ public class AccountController extends BaseController
|
|||
@PreAuthorize("@ss.hasPermi('ss:account:edit')")
|
||||
@Log(title = "用户账户", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody SmAccount smAccount)
|
||||
public AjaxResult edit(@RequestBody @Validated(ValidGroup.Update.class) Account account)
|
||||
{
|
||||
return toAjax(smAccountService.updateSmAccount(smAccount));
|
||||
return toAjax(smAccountService.updateSmAccount(account));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue
Block a user