diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/account/business/AccWalletInfoBusiness.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/account/business/AccWalletInfoBusiness.java index e946425..a86f1e6 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/account/business/AccWalletInfoBusiness.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/account/business/AccWalletInfoBusiness.java @@ -142,10 +142,10 @@ public class AccWalletInfoBusiness { accTradeWalletDetail.setTradeType(operation.getTradeType()); accTradeWalletDetail.setAmount(operation.getAmount()); accTradeWalletDetail.setWalletType(operation.getWalletType()); - BigDecimal walletBalByWalletId = walletInfoList.stream().filter((item) -> { + BigDecimal walletBalByWalletType = walletInfoList.stream().filter((item) -> { return item.getWalletType().equals(operation.getWalletType()); }).map(AccWalletInfo::getWalletBal).filter(ObjectUtil::isNotNull).reduce(BigDecimal.ZERO, BigDecimal::add); - accTradeWalletDetail.setWalletBal(walletBalByWalletId); + accTradeWalletDetail.setWalletBal(walletBalByWalletType); accTradeWalletDetail.setTradeTime(DateUtils.getNowDate()); accTradeWalletDetail.setCreateBy(StringUtils.isBlank(operation.getOperationUser()) ? SecurityUtils.getUsername() : operation.getOperationUser()); @@ -156,8 +156,8 @@ public class AccWalletInfoBusiness { accountTrade.setTradeState(AccTradeStateEnum.TAKE_EFFECT.getKey()); accountTrade.setUpdateBy(StringUtils.isBlank(operation.getOperationUser()) ? SecurityUtils.getUsername() : operation.getOperationUser()); - accountTrade.setWalletBalTotal(walletBalByWalletId); - accountTrade.setAccountAllBal(walletBalByWalletId); + accountTrade.setWalletBalTotal(walletBalByWalletType); + accountTrade.setAccountAllBal(walletBalByWalletType); accountTrade.setMachineSn(operation.getDeviceSn()); this.accTradeService.updateAccTrade(accountTrade); }catch (Exception ex) { @@ -181,7 +181,7 @@ public class AccWalletInfoBusiness { } private void reduceAccWalletInfo(WalletBalanceOperation operation) { - AccWalletInfo walletInfo = selectAccWalletInfoByUserIdAndWalletId(operation.getUserId(), + AccWalletInfo walletInfo = selectAccWalletInfoByUserIdAndWalletType(operation.getUserId(), operation.getWalletType()); if(Objects.isNull(walletInfo) || walletInfo.getWalletBal().compareTo(BigDecimal.ZERO) < 0 @@ -233,7 +233,7 @@ public class AccWalletInfoBusiness { return accWalletInfoMapper.selectAccWalletInfoByUserId(userId); } - public AccWalletInfo selectAccWalletInfoByUserIdAndWalletId(Long userId, Integer walletType) { - return accWalletInfoMapper.selectAccWalletInfoByUserIdAndWalletId(userId, walletType); + public AccWalletInfo selectAccWalletInfoByUserIdAndWalletType(Long userId, Integer walletType) { + return accWalletInfoMapper.selectAccWalletInfoByUserIdAndWalletType(userId, walletType); } } diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/account/constants/AccWalletTypeEnum.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/account/constants/AccWalletTypeEnum.java index 00096ad..96675ad 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/account/constants/AccWalletTypeEnum.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/account/constants/AccWalletTypeEnum.java @@ -40,11 +40,11 @@ public enum AccWalletTypeEnum { return Arrays.asList(WALLET.getKey(), SUBSIDY.getKey()); } - public static String getAllWalletId() { - return StringUtils.join(getAllWalletIdList(), ","); + public static String getAllWalletType() { + return StringUtils.join(getAllWalletTypeList(), ","); } - public static List getAllWalletIdList() { + public static List getAllWalletTypeList() { return Arrays.stream(values()) .map(AccWalletTypeEnum::getKey) .collect(Collectors.toList()); diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/account/domain/AccInfoVo.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/account/domain/AccInfoVo.java index 17785f8..bc47b02 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/account/domain/AccInfoVo.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/account/domain/AccInfoVo.java @@ -12,17 +12,17 @@ public class AccInfoVo { /** 账户id 主键自增 */ @Excel(name = "账户id") @ApiModelProperty(value = "账户id") - private Long accId; + private Long accountId; /** 人员id */ @Excel(name = "人员id") @ApiModelProperty(value = "人员id") private Long userId; @ApiModelProperty("账户状态 1正常 2冻结 3销户 4过期") - private Integer accStatus; + private Integer accountStatus; @ApiModelProperty("账户可用总余额(不包括冻结金额)") - private BigDecimal accBalTotal; + private BigDecimal accountBalTotal; @ApiModelProperty("账户总余额(包含冻结金额)") - private BigDecimal accAllBal; + private BigDecimal accountAllBal; @ApiModelProperty("个人钱包(可用)余额/分") private BigDecimal walletBal; @ApiModelProperty("补贴钱包(可用)余额/分") diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/account/domain/WalletBalanceVO.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/account/domain/WalletBalanceVO.java index db3906b..dbb4b85 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/account/domain/WalletBalanceVO.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/account/domain/WalletBalanceVO.java @@ -18,26 +18,26 @@ public class WalletBalanceVO { @ApiModelProperty("补贴钱包冻结金额") private BigDecimal subFreezeBal; @ApiModelProperty("冻结金额") - private BigDecimal accFreezeBalTotal; + private BigDecimal accountFreezeBalTotal; @ApiModelProperty("账户总余额(包含冻结金额)") - private BigDecimal accAllBal; + private BigDecimal accountAllBal; @ApiModelProperty("账户可用余额总余额(不包括冻结金额)") - private BigDecimal accBalTotal; + private BigDecimal accountBalTotal; @ApiModelProperty("账户状态 1正常 2冻结 3销户 4过期") - private Integer accStatus; + private Integer accountStatus; public static WalletBalanceVO of(AccInfoVo accInfoVo) { WalletBalanceVO walletBalanceVO = new WalletBalanceVO(); //walletBalanceVO.setAccBalTotal(accInfoVo.getAccBalTotal()); - walletBalanceVO.setAccAllBal(accInfoVo.getAccAllBal()); + walletBalanceVO.setAccountAllBal(accInfoVo.getAccountAllBal()); walletBalanceVO.setWalletBal(accInfoVo.getWalletBal()); walletBalanceVO.setSubsidyBal(accInfoVo.getSubsidyBal()); //walletBalanceVO.setRedEnvelope(accInfoVo.getRedEnvelope()); //walletBalanceVO.setWalletFreezeBal(accInfoVo.getWalletFreezeBal()); //walletBalanceVO.setSubFreezeBal(accInfoVo.getSubFreezeBal()); //walletBalanceVO.setAccFreezeBalTotal(accInfoVo.getAccFreezeBalTotal()); - walletBalanceVO.setAccStatus(accInfoVo.getAccStatus()); + walletBalanceVO.setAccountStatus(accInfoVo.getAccountStatus()); return walletBalanceVO; } } diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/account/mapper/AccWalletInfoMapper.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/account/mapper/AccWalletInfoMapper.java index d5e306f..403f4ce 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/account/mapper/AccWalletInfoMapper.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/account/mapper/AccWalletInfoMapper.java @@ -22,7 +22,7 @@ public interface AccWalletInfoMapper { * @return 钱包详情信息 */ public List selectAccWalletInfoByUserId(Long userId); - public AccWalletInfo selectAccWalletInfoByUserIdAndWalletId(@Param("userId") Long userId, @Param("walletType") Integer walletType); + public AccWalletInfo selectAccWalletInfoByUserIdAndWalletType(@Param("userId") Long userId, @Param("walletType") Integer walletType); List selectAccWalletInfoByUserIds(@Param("userIds") List userIds); diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/account/service/IAccWalletInfoService.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/account/service/IAccWalletInfoService.java index c642d0e..2959d36 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/account/service/IAccWalletInfoService.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/account/service/IAccWalletInfoService.java @@ -22,7 +22,7 @@ public interface IAccWalletInfoService { * @return 钱包详情信息 */ public List selectAccWalletInfoByUserId(Long userId); - public AccWalletInfo selectAccWalletInfoByUserIdAndWalletId(Long userId, Integer walletId); + public AccWalletInfo selectAccWalletInfoByUserIdAndWalletType(Long userId, Integer walletType); /** * 查询钱包详情信息列表 @@ -60,7 +60,7 @@ public interface IAccWalletInfoService { Map> selectAccWalletInfoByUserIds(List userIds); - void updateMinBalance(List userIds, Integer walletId, BigDecimal minBalance); + void updateMinBalance(List userIds, Integer walletType, BigDecimal minBalance); void addAccWalletBalance(WalletUpdateDTO walletUpdateDTO); diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/account/service/impl/AccInfoServiceImpl.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/account/service/impl/AccInfoServiceImpl.java index 2c7243e..d69cb9d 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/account/service/impl/AccInfoServiceImpl.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/account/service/impl/AccInfoServiceImpl.java @@ -340,7 +340,7 @@ public class AccInfoServiceImpl implements IAccInfoService { throw new ServiceException("账户不存在"); } else { AccWalletInfo accWalletInfo = new AccWalletInfo(); - accWalletInfo.setAccountId(accInfoVO.getAccId()); + accWalletInfo.setAccountId(accInfoVO.getAccountId()); List walletInfoList = this.accWalletInfoService.selectAccWalletInfoList(accWalletInfo); this.setAccInfoVODetailList(accInfoVO, walletInfoList); log.info("获取账户(钱包)信息,出参={}", JSONUtil.toJsonStr(accInfoVO)); @@ -377,11 +377,11 @@ public class AccInfoServiceImpl implements IAccInfoService { protected void setAccInfoVODetailList(AccInfoVo accInfoVo, List walletInfoList) { if (ObjectUtil.isNotEmpty(walletInfoList)) { - accInfoVo.setWalletBal(walletInfoList.stream().filter(o -> o.getWalletId().intValue() == AccWalletTypeEnum.WALLET.getKey()) + accInfoVo.setWalletBal(walletInfoList.stream().filter(o -> o.getWalletType().intValue() == AccWalletTypeEnum.WALLET.getKey()) .map(AccWalletInfo::getWalletBal).reduce(BigDecimal.ZERO, BigDecimal::add)); - accInfoVo.setSubsidyBal(walletInfoList.stream().filter(o -> o.getWalletId().intValue() == AccWalletTypeEnum.SUBSIDY.getKey()) + accInfoVo.setSubsidyBal(walletInfoList.stream().filter(o -> o.getWalletType().intValue() == AccWalletTypeEnum.SUBSIDY.getKey()) .map(AccWalletInfo::getWalletBal).reduce(BigDecimal.ZERO, BigDecimal::add)); - accInfoVo.setAccAllBal(accInfoVo.getWalletBal().add(accInfoVo.getSubsidyBal())); + accInfoVo.setAccountAllBal(accInfoVo.getWalletBal().add(accInfoVo.getSubsidyBal())); } } @Transactional( diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/account/service/impl/AccSubServiceImpl.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/account/service/impl/AccSubServiceImpl.java index f567aef..bb8341c 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/account/service/impl/AccSubServiceImpl.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/account/service/impl/AccSubServiceImpl.java @@ -121,7 +121,7 @@ public class AccSubServiceImpl implements AccSubService { // } private void clearAllAccSubsidyHandler(AccInfoDetailsVO accInfoVO, AccSubsidyClearParam param) { - AccWalletInfo walletInfo = accWalletInfoService.selectAccWalletInfoByUserIdAndWalletId(accInfoVO.getUserId(), AccWalletTypeEnum.SUBSIDY.getKey()); + AccWalletInfo walletInfo = accWalletInfoService.selectAccWalletInfoByUserIdAndWalletType(accInfoVO.getUserId(), AccWalletTypeEnum.SUBSIDY.getKey()); if(Objects.isNull(walletInfo)) { throw new ServiceException("补贴钱包不存在"); } @@ -287,7 +287,7 @@ public class AccSubServiceImpl implements AccSubService { for (AccInfoDetailsVO accInfo : accInfoVOList) { try { checkAccount(accInfo); - AccWalletInfo walletInfo = accWalletInfoService.selectAccWalletInfoByUserIdAndWalletId(accInfo.getUserId(), AccWalletTypeEnum.SUBSIDY.getKey()); + AccWalletInfo walletInfo = accWalletInfoService.selectAccWalletInfoByUserIdAndWalletType(accInfo.getUserId(), AccWalletTypeEnum.SUBSIDY.getKey()); if(Objects.isNull(walletInfo)) { throw new ServiceException("补贴钱包不存在"); } diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/account/service/impl/AccWalletInfoServiceImpl.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/account/service/impl/AccWalletInfoServiceImpl.java index 90901e1..a29c00e 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/account/service/impl/AccWalletInfoServiceImpl.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/account/service/impl/AccWalletInfoServiceImpl.java @@ -56,8 +56,8 @@ public class AccWalletInfoServiceImpl implements IAccWalletInfoService { } @Override - public AccWalletInfo selectAccWalletInfoByUserIdAndWalletId(Long userId, Integer walletType) { - return accWalletInfoMapper.selectAccWalletInfoByUserIdAndWalletId(userId, walletType); + public AccWalletInfo selectAccWalletInfoByUserIdAndWalletType(Long userId, Integer walletType) { + return accWalletInfoMapper.selectAccWalletInfoByUserIdAndWalletType(userId, walletType); } /** diff --git a/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/account/AccWalletInfoMapper.xml b/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/account/AccWalletInfoMapper.xml index 5ad9aa3..bb78815 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/account/AccWalletInfoMapper.xml +++ b/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/account/AccWalletInfoMapper.xml @@ -47,7 +47,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" where user_id = #{userId} - where user_id = #{userId} and wallet_type = #{walletType}