update 店铺新增网络费用和是否开启相关字段

This commit is contained in:
yyb
2026-01-29 16:21:15 +08:00
parent f73ceb9e23
commit faf75ec870
7 changed files with 67 additions and 9 deletions

View File

@@ -100,12 +100,18 @@ public class LeaseShopServiceImpl extends ServiceImpl<LeaseShopMapper, LeaseShop
.description(shopVo.getDescription())
.state(shopVo.getState())
.feeRate(shopVo.getFeeRate())
.isOpen(shopVo.getIsOpen())
.authId(SecurityUtils.getUserId())
.build();
if(leaseShop1 != null){
return Result.fail("当前已存在店铺,请勿重复添加");
}
if (shopVo.getIsOpen() != null && shopVo.getIsOpen()){
leaseShop.setFeeRate(leaseShop.getFeeRate().add(BigDecimal.valueOf(0.02)));
}
boolean save = save(leaseShop);
return save ? Result.success("新增店铺成功") : Result.fail("新增店铺失败");
@@ -137,11 +143,15 @@ public class LeaseShopServiceImpl extends ServiceImpl<LeaseShopMapper, LeaseShop
.state(shopVo.getState())
.feeRate(shopVo.getFeeRate())
.authId(SecurityUtils.getUserId())
.isOpen(shopVo.getIsOpen())
.build();
LeaseShop byId = getById(shopVo.getId());
if (byId.getDel()){
return Result.fail("修改失败,店铺已被删除");
}
if (shopVo.getIsOpen() != null && shopVo.getIsOpen()){
leaseShop.setFeeRate(leaseShop.getFeeRate().add(BigDecimal.valueOf(0.02)));
}
boolean save = updateById(leaseShop);
if (save) {
return Result.success("修改店铺成功");
@@ -185,9 +195,11 @@ public class LeaseShopServiceImpl extends ServiceImpl<LeaseShopMapper, LeaseShop
.id(leaseShop.getId())
.name(leaseShop.getName())
.image(leaseShop.getImage())
.feeRate(leaseShop.getFeeRate().setScale(4, RoundingMode.HALF_UP))
.feeRate(leaseShop.getFeeRate().subtract(leaseShop.getNetworkFee()).setScale(4, RoundingMode.HALF_UP))
.description(leaseShop.getDescription())
.state(leaseShop.getState())
.isOpen(leaseShop.getIsOpen())
.networkFee(leaseShop.getNetworkFee())
.del(leaseShop.getDel())
.build();
@@ -278,11 +290,14 @@ public class LeaseShopServiceImpl extends ServiceImpl<LeaseShopMapper, LeaseShop
}
//校验是否存在订单
long runningOrderCount = leaseOrderItemMapper.checkShopExistRunningOrderNumbers(leaseShopConfigs);
if (runningOrderCount > 0) {
throw new MachineException("注销失败,店铺钱包存在未完成的订单");
if (!leaseShopConfigs.isEmpty()){
long runningOrderCount = leaseOrderItemMapper.checkShopExistRunningOrderNumbers(leaseShopConfigs);
if (runningOrderCount > 0) {
throw new MachineException("注销失败,店铺钱包存在未完成的订单");
}
}
leaseMachineMapper.update(LeaseMachine.builder().del(true).build(), new LambdaUpdateWrapper<LeaseMachine>()
.eq(LeaseMachine::getShopId, shopId));

View File

@@ -1288,7 +1288,8 @@ public class LeaseUserServiceImpl extends ServiceImpl<LeaseUserMapper, LeaseUser
}
//修改钱包冻结余额 乐观锁
int i = leaseUserWalletDataMapper.update(build, new LambdaUpdateWrapper<LeaseUserWalletData>()
.eq(LeaseUserWalletData::getBlockedBalance, userWalletDataDto.getBlockedBalance()));
.eq(LeaseUserWalletData::getBlockedBalance, userWalletDataDto.getBlockedBalance())
.eq(LeaseUserWalletData::getId,build.getId()));
if (insert > 0 && i > 0){
//发送mq消息到队列
RabbitmqPayWithdrawMessage message = RabbitmqPayWithdrawMessage.builder()