From b84385e313bb351c3d32a93e1b99d615826d155b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A2=A8=E5=A4=A7=E5=8F=94?= <494979559@qq.com> Date: Sun, 28 Jul 2024 10:41:03 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B6=E6=AC=BE=E8=B4=A6=E6=88=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../web/service/SysLoginService.java | 9 +- .../domain/{SmAccount.java => Account.java} | 24 +++-- .../{SmAccountVO.java => AccountQuery.java} | 3 +- .../{SmAccountQuery.java => AccountVO.java} | 3 +- .../ruoyi/ss/account/domain/SmAccountBO.java | 16 ---- ...mAccountMapper.java => AccountMapper.java} | 22 ++--- ...{SmAccountMapper.xml => AccountMapper.xml} | 10 +- ...ccountService.java => AccountService.java} | 29 +++--- ...rviceImpl.java => AccountServiceImpl.java} | 95 +++++++++---------- .../impl/TransactionBillServiceImpl.java | 10 +- .../controller/app/AppAccountController.java | 13 ++- .../web/controller/ss/AccountController.java | 31 +++--- 12 files changed, 125 insertions(+), 140 deletions(-) rename smart-switch-service/src/main/java/com/ruoyi/ss/account/domain/{SmAccount.java => Account.java} (70%) rename smart-switch-service/src/main/java/com/ruoyi/ss/account/domain/{SmAccountVO.java => AccountQuery.java} (82%) rename smart-switch-service/src/main/java/com/ruoyi/ss/account/domain/{SmAccountQuery.java => AccountVO.java} (81%) delete mode 100644 smart-switch-service/src/main/java/com/ruoyi/ss/account/domain/SmAccountBO.java rename smart-switch-service/src/main/java/com/ruoyi/ss/account/mapper/{SmAccountMapper.java => AccountMapper.java} (67%) rename smart-switch-service/src/main/java/com/ruoyi/ss/account/mapper/{SmAccountMapper.xml => AccountMapper.xml} (93%) rename smart-switch-service/src/main/java/com/ruoyi/ss/account/service/{ISmAccountService.java => AccountService.java} (68%) rename smart-switch-service/src/main/java/com/ruoyi/ss/account/service/impl/{SmAccountServiceImpl.java => AccountServiceImpl.java} (62%) diff --git a/smart-switch-ruoyi/smart-switch-framework/src/main/java/com/ruoyi/framework/web/service/SysLoginService.java b/smart-switch-ruoyi/smart-switch-framework/src/main/java/com/ruoyi/framework/web/service/SysLoginService.java index 9ed5a1c5..37cc1fe0 100644 --- a/smart-switch-ruoyi/smart-switch-framework/src/main/java/com/ruoyi/framework/web/service/SysLoginService.java +++ b/smart-switch-ruoyi/smart-switch-framework/src/main/java/com/ruoyi/framework/web/service/SysLoginService.java @@ -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()); diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/account/domain/SmAccount.java b/smart-switch-service/src/main/java/com/ruoyi/ss/account/domain/Account.java similarity index 70% rename from smart-switch-service/src/main/java/com/ruoyi/ss/account/domain/SmAccount.java rename to smart-switch-service/src/main/java/com/ruoyi/ss/account/domain/Account.java index 5896a239..1e3b3909 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/account/domain/SmAccount.java +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/account/domain/Account.java @@ -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("卡面信息") diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/account/domain/SmAccountVO.java b/smart-switch-service/src/main/java/com/ruoyi/ss/account/domain/AccountQuery.java similarity index 82% rename from smart-switch-service/src/main/java/com/ruoyi/ss/account/domain/SmAccountVO.java rename to smart-switch-service/src/main/java/com/ruoyi/ss/account/domain/AccountQuery.java index 7af31f2b..81ee8e59 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/account/domain/SmAccountVO.java +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/account/domain/AccountQuery.java @@ -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; + } diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/account/domain/SmAccountQuery.java b/smart-switch-service/src/main/java/com/ruoyi/ss/account/domain/AccountVO.java similarity index 81% rename from smart-switch-service/src/main/java/com/ruoyi/ss/account/domain/SmAccountQuery.java rename to smart-switch-service/src/main/java/com/ruoyi/ss/account/domain/AccountVO.java index 47f9baab..4ed90751 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/account/domain/SmAccountQuery.java +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/account/domain/AccountVO.java @@ -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; - } diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/account/domain/SmAccountBO.java b/smart-switch-service/src/main/java/com/ruoyi/ss/account/domain/SmAccountBO.java deleted file mode 100644 index 82258645..00000000 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/account/domain/SmAccountBO.java +++ /dev/null @@ -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; - -} diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/account/mapper/SmAccountMapper.java b/smart-switch-service/src/main/java/com/ruoyi/ss/account/mapper/AccountMapper.java similarity index 67% rename from smart-switch-service/src/main/java/com/ruoyi/ss/account/mapper/SmAccountMapper.java rename to smart-switch-service/src/main/java/com/ruoyi/ss/account/mapper/AccountMapper.java index 7d306c7d..bed30f2a 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/account/mapper/SmAccountMapper.java +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/account/mapper/AccountMapper.java @@ -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 selectSmAccountList(SmAccountQuery smAccount); + public List 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); /** * 为用户设置默认的账户 diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/account/mapper/SmAccountMapper.xml b/smart-switch-service/src/main/java/com/ruoyi/ss/account/mapper/AccountMapper.xml similarity index 93% rename from smart-switch-service/src/main/java/com/ruoyi/ss/account/mapper/SmAccountMapper.xml rename to smart-switch-service/src/main/java/com/ruoyi/ss/account/mapper/AccountMapper.xml index 22c6ac3c..5c26ec64 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/account/mapper/SmAccountMapper.xml +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/account/mapper/AccountMapper.xml @@ -2,9 +2,9 @@ - + - + @@ -26,7 +26,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" left join sm_user su on su.user_id = sa.user_id - and sa.user_id = #{userId} @@ -57,7 +57,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" limit 1 - + insert into sm_account account_id, @@ -87,7 +87,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - + update sm_account user_id = #{userId}, diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/account/service/ISmAccountService.java b/smart-switch-service/src/main/java/com/ruoyi/ss/account/service/AccountService.java similarity index 68% rename from smart-switch-service/src/main/java/com/ruoyi/ss/account/service/ISmAccountService.java rename to smart-switch-service/src/main/java/com/ruoyi/ss/account/service/AccountService.java index b855653d..208304b1 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/account/service/ISmAccountService.java +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/account/service/AccountService.java @@ -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 selectSmAccountList(SmAccountQuery smAccount); + public List 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> selectSmAccountGroup(SmAccountQuery dto); + Map> 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); /** * 设置默认账户 diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/account/service/impl/SmAccountServiceImpl.java b/smart-switch-service/src/main/java/com/ruoyi/ss/account/service/impl/AccountServiceImpl.java similarity index 62% rename from smart-switch-service/src/main/java/com/ruoyi/ss/account/service/impl/SmAccountServiceImpl.java rename to smart-switch-service/src/main/java/com/ruoyi/ss/account/service/impl/AccountServiceImpl.java index c2c3a64d..61af4749 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/account/service/impl/SmAccountServiceImpl.java +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/account/service/impl/AccountServiceImpl.java @@ -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 selectSmAccountList(SmAccountQuery dto) - { - return smAccountMapper.selectSmAccountList(dto); + public List 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> selectSmAccountGroup(SmAccountQuery dto) { - List list = this.selectSmAccountList(dto); + public Map> selectSmAccountGroup(AccountQuery dto) { + List list = this.selectSmAccountList(dto); if (CollectionUtils.isEmpty(list)) { return Collections.emptyMap(); } - Map> map = new HashMap<>(); + list.forEach(AccountVO::desensitization); + Map> 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 list = smAccountMapper.selectSmAccountList(dto); + List 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 list = smAccountMapper.selectSmAccountList(dto); + List 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 repeats = smAccountMapper.selectSmAccountList(dto); + dto.setAccountType(data.getAccountType()); + List 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; } diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/service/impl/TransactionBillServiceImpl.java b/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/service/impl/TransactionBillServiceImpl.java index 575d4016..887442d4 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/service/impl/TransactionBillServiceImpl.java +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/transactionBill/service/impl/TransactionBillServiceImpl.java @@ -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(); } diff --git a/smart-switch-web/src/main/java/com/ruoyi/web/controller/app/AppAccountController.java b/smart-switch-web/src/main/java/com/ruoyi/web/controller/app/AppAccountController.java index 64a7abf3..287a9651 100644 --- a/smart-switch-web/src/main/java/com/ruoyi/web/controller/app/AppAccountController.java +++ b/smart-switch-web/src/main/java/com/ruoyi/web/controller/app/AppAccountController.java @@ -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)); } diff --git a/smart-switch-web/src/main/java/com/ruoyi/web/controller/ss/AccountController.java b/smart-switch-web/src/main/java/com/ruoyi/web/controller/ss/AccountController.java index a7ff27c7..b7396720 100644 --- a/smart-switch-web/src/main/java/com/ruoyi/web/controller/ss/AccountController.java +++ b/smart-switch-web/src/main/java/com/ruoyi/web/controller/ss/AccountController.java @@ -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 list = smAccountService.selectSmAccountList(query); + List 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 list = smAccountService.selectSmAccountList(query); - ExcelUtil util = new ExcelUtil(SmAccountVO.class); + List list = smAccountService.selectSmAccountList(query); + ExcelUtil util = new ExcelUtil(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)); } /**