feat:超市使用消费钱包

This commit is contained in:
dzc committed 2025-05-30 11:30:09 +08:00
1 parent fe79a9069e
commit 54df322b0f
2 files changed
+9 -7

No files matched your search

@@ -36,10 +36,7 @@ public class HardApiServiceImpl implements HardApiService {
UserInfo user = userService.getInnerByUserId(userId).getData();
if (ObjectUtil.isEmpty(user)) return null;
// 查询钱包
// WalletTypeEnum walletType = ObjectUtil.equals(HardTypeEnum.CANTEEN, type) ? WalletTypeEnum.EAT : WalletTypeEnum.PAY;
// 默认都使用饭卡钱包
WalletTypeEnum walletType = WalletTypeEnum.EAT;
WalletTypeEnum walletType = ObjectUtil.equals(HardTypeEnum.CANTEEN, type) ? WalletTypeEnum.EAT : WalletTypeEnum.PAY;
WalletManageEntity wallet = remoteWalletService.getWallet(userId, walletType).getData();
if (ObjectUtil.isEmpty(wallet)) return null;
SysUser sysUser = user.getSysUser();
@@ -203,7 +203,7 @@ public class HardOrderServiceImpl extends ServiceImpl<HardOrderMapper, HardOrder
// 查询用户
UserInfo userDetail = null;
SysUser sysUser = null;
if (isPay) {
if (isPay || isVerify) {
userDetail = userService.getInnerByUserId(dto.getUserId()).getData();
if (ObjectUtil.isEmpty(userDetail)) throw new RuntimeException("用户不存在不存在");
sysUser = userDetail.getSysUser();
@@ -214,8 +214,13 @@ public class HardOrderServiceImpl extends ServiceImpl<HardOrderMapper, HardOrder
WalletManageEntity wallet = null;
if (isPay) {
if (ObjectUtil.isEmpty(mch.getDefaultWalletTypeId())) {
R<WalletManageEntity> walletResult = remoteWalletService.getWallet(dto.getUserId(), WalletTypeEnum.EAT);
wallet = Optional.of(walletResult).map(R::getData).orElseThrow(() -> new RuntimeException("用户钱包不存在"));
if (dto.getSysType().equals(HardTypeEnum.CANTEEN)) {
R<WalletManageEntity> walletResult = remoteWalletService.getWallet(dto.getUserId(), WalletTypeEnum.EAT);
wallet = Optional.of(walletResult).map(R::getData).orElseThrow(() -> new RuntimeException("用户钱包不存在"));
} else {
R<WalletManageEntity> walletResult = remoteWalletService.getWallet(dto.getUserId(), WalletTypeEnum.PAY);
wallet = Optional.of(walletResult).map(R::getData).orElseThrow(() -> new RuntimeException("用户钱包不存在"));
}
} else {
R<WalletManageEntity> walletResult = remoteWalletService.getWalletByWalletTypeId(dto.getUserId(), mch.getDefaultWalletTypeId());
wallet = Optional.of(walletResult).map(R::getData).orElseThrow(() -> new RuntimeException("用户钱包不存在"));