fix:转账bug修改

This commit is contained in:
dzc committed 2025-04-03 17:12:41 +08:00
1 parent 10230486af
commit c2c5cfc971
8 files changed
+19 -4

No files matched your search

@@ -3,6 +3,8 @@ package com.bsd.pjcloud.common.data.datascope;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSON;
import cn.hutool.json.JSONUtil;
import com.baomidou.mybatisplus.core.toolkit.PluginUtils;
import lombok.Setter;
import org.apache.ibatis.executor.Executor;
@@ -18,7 +18,9 @@
package com.bsd.pjcloud.common.data.datascope;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONUtil;
import com.bsd.pjcloud.admin.api.entity.SysDept;
import com.bsd.pjcloud.admin.api.entity.SysRole;
import com.bsd.pjcloud.admin.api.feign.RemoteDataScopeService;
@@ -11,6 +11,10 @@ public class HardAppCreateOrderScancode {
@NotNull(message = "商户id不能为空")
private Long merchantId;
@Schema(description = "钱包类型id")
@NotNull(message = "钱包类型id不能为空")
private Long walletTypeId;
@Schema(description = "用户输入的价格")
@NotNull(message = "自定义金额不能为空")
private Integer customPrice;
@@ -42,4 +42,7 @@ public class HardAppCreateOrderDto {
// 商户id
private Long merchantId;
// 饭卡id
private Long walletId;
}
@@ -154,7 +154,6 @@ public class HardOrderController {
.userId(user.getId())
.hardType(HardTypeEnum.MERCHANT_QR_CODE)
.orderType(HardOrderTypeEnum.BELOW)
.walletType(WalletTypeEnum.PAY)
.payType(HardPayTypeEnum.WALLET_QR_CODE_SCAN)
.build();
return R.ok(hardwareOrderService.appCreateOrderScancode(dto));
@@ -51,10 +51,12 @@ import com.bsd.pjcloud.wallet.api.dto.WalletBalanceTransactionDto;
import com.bsd.pjcloud.wallet.api.entity.WalletCodeUseEntity;
import com.bsd.pjcloud.wallet.api.entity.WalletManageEntity;
import com.bsd.pjcloud.wallet.api.entity.WalletTransactionEntity;
import com.bsd.pjcloud.wallet.api.entity.WalletTypeEntity;
import com.bsd.pjcloud.wallet.api.feign.*;
import com.bsd.pjcloud.wallet.api.utils.WalletDataUtil;
import com.bsd.pjcloud.wallet.api.vo.MchManageVo;
import com.bsd.pjcloud.wallet.api.vo.WalletSettingVo;
import com.bsd.pjcloud.wallet.service.WalletTypeService;
import jakarta.validation.Valid;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
@@ -364,7 +366,7 @@ public class HardOrderServiceImpl extends ServiceImpl<HardOrderMapper, HardOrder
UserInfo userDetail = userService.getByUserId(dto.getUserId()).getData();
if (ObjectUtil.isEmpty(userDetail)) throw new RuntimeException("用户不存在不存在");
// 钱包
WalletManageEntity wallet = remoteWalletService.getWallet(dto.getUserId(), dto.getWalletType()).getData();
WalletManageEntity wallet = remoteWalletService.getWalletByWalletTypeId(dto.getUserId(), dto.getWalletId()).getData();
if (ObjectUtil.isEmpty(wallet)) throw new RuntimeException("用户钱包不存在");
Integer balance = wallet.getBalance();
int totalPrice = dto.getCustomPrice();
@@ -9,6 +9,7 @@ import com.bsd.pjcloud.admin.api.entity.SysDept;
import com.bsd.pjcloud.admin.api.feign.RemoteDeptService;
import com.bsd.pjcloud.common.core.util.CollectionUtils;
import com.bsd.pjcloud.common.data.datascope.DataScope;
import com.bsd.pjcloud.common.data.datascope.DataScopeFuncEnum;
import com.bsd.pjcloud.common.security.service.PjcloudUser;
import com.bsd.pjcloud.common.security.util.SecurityUtils;
import com.bsd.pjcloud.hard.api.constant.order.HardOrderStatusEnum;
@@ -65,8 +66,9 @@ public class HardOrderTotalServiceImpl implements HardOrderTotalService {
*/
@Override
public List<HardOrderSbVo> listSb(HardOrderDto dto) {
DataScope dataScope = DataScope.of();
DataScope dataScope = DataScope.of().func(DataScopeFuncEnum.ALL);
dataScope.setScopeDeptName("merchant_dept_id");
PjcloudUser user = SecurityUtils.getUser();
CurrentUserHardTypeInfoDto hardTypeInfo = hardManagerService.getCurrentUserHardTypeInfo(user);
dto.setMchTypeCodes(hardTypeInfo.getHardTypeList());
@@ -78,7 +78,8 @@ public class WalletRuleTransactionServiceImpl extends ServiceImpl<WalletRuleTran
}
}
// 是否已经超过最大限制
if (userConfig.getTotalTransferBalance() > userConfig.getMaxTransferBalance()) {
long cuurentTotalTransferBalance = userConfig.getTotalTransferBalance() + body.getBalance();
if (cuurentTotalTransferBalance > userConfig.getMaxTransferBalance()) {
throw new RuntimeException("已经超过最大转账金额限制");
}
entity.setSourceWalletId(userConfig.getSourceWalletId());