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

@@ -71,7 +71,6 @@ public class LoginInterceptor implements HandlerInterceptor {
}
String userEmail = JwtUtils.getUserName(token);
String getUserId = JwtUtils.getUserId(token);
System.out.println("本地线程用户ID"+getUserId + "用户邮箱"+userEmail);
//1.把userEmail存入ThreadLocal 本地线程变量中
SecurityUtils.setUserEmail(userEmail);
SecurityUtils.setUserId(Long.valueOf(getUserId));

View File

@@ -60,4 +60,13 @@ public class ShopDto {
@ApiModelProperty(value = "店铺手续费比例 范围0.01-0.1",example = "0.01")
private BigDecimal feeRate;
@ApiModelProperty(value = "专用网络手续费率")
private BigDecimal networkFee;
@ApiModelProperty(value = "专用网络是否开启 false 否 true 是")
private Boolean isOpen;
}

View File

@@ -89,4 +89,13 @@ public class LeaseShop implements Serializable {
*/
private Integer saleNumber;
/**
* 专用网络手续费率
*/
private BigDecimal networkFee;
/**
* 专用网络是否开启 0 否 1 是
*/
private Boolean isOpen;
}

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,10 +290,13 @@ public class LeaseShopServiceImpl extends ServiceImpl<LeaseShopMapper, LeaseShop
}
//校验是否存在订单
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()

View File

@@ -1095,11 +1095,32 @@ public class OrderAndPayTask {
public void withdrawTimeout(){
List<LeasePayWithdrawMessage> leasePayWithdrawMessages = leasePayWithdrawMessageMapper.selectList(new LambdaQueryWrapper<LeasePayWithdrawMessage>()
.eq(LeasePayWithdrawMessage::getStatus, 2)
.eq(LeasePayWithdrawMessage::getShopId, 0)
.le(LeasePayWithdrawMessage::getCreateTime, LocalDateTime.now().minusMinutes(10)));
if (!leasePayWithdrawMessages.isEmpty()){
for (LeasePayWithdrawMessage leasePayWithdrawMessage : leasePayWithdrawMessages) {
leasePayWithdrawMessage.setStatus(0);
leasePayWithdrawMessageMapper.updateById(leasePayWithdrawMessage);
for (LeasePayWithdrawMessage withdrawMessage : leasePayWithdrawMessages) {
// 查询对应的钱包记录
LeaseUserWalletData userWalletData = leaseUserWalletDataMapper.selectOne(new LambdaQueryWrapper<LeaseUserWalletData>()
.eq(LeaseUserWalletData::getFromAddress, withdrawMessage.getFromAddress())
.eq(LeaseUserWalletData::getFromChain, withdrawMessage.getFromChain())
.eq(LeaseUserWalletData::getFromSymbol, withdrawMessage.getFromSymbol())
.eq(LeaseUserWalletData::getAuthId, withdrawMessage.getAuthId()));
if (userWalletData != null) {
// 使用 blockedBalance 作为乐观锁,释放冻结余额
int updateWallet = leaseUserWalletDataMapper.update(null,
new LambdaUpdateWrapper<LeaseUserWalletData>()
.set(LeaseUserWalletData::getBlockedBalance, userWalletData.getBlockedBalance().subtract(withdrawMessage.getAmount()))
.eq(LeaseUserWalletData::getId, userWalletData.getId())
.eq(LeaseUserWalletData::getBlockedBalance, userWalletData.getBlockedBalance()));
if (updateWallet > 0) {
// 更新提现记录状态为失败
withdrawMessage.setStatus(0);
leasePayWithdrawMessageMapper.updateById(withdrawMessage);
}
}
}
}
}

View File

@@ -62,4 +62,8 @@ public class ShopVo extends BaseVo{
@ApiModelProperty(value = "谷歌验证码")
@JsonProperty("gCode")
private Long gCode;
@ApiModelProperty(value = "专用网络是否开启 false 关闭 true 开启",example = "1")
private Boolean isOpen;
}