[fix]订单增加非租户过滤

This commit is contained in:
王庆祥 2025-10-03 15:05:15 +08:00
parent d0f77f301f
commit 1cb41a326c
5 changed files with 15 additions and 13 deletions

View File

@ -49,7 +49,7 @@ spring:
driverClassName: com.mysql.cj.jdbc.Driver
# jdbc 所有参数配置参考 https://lionli.blog.csdn.net/article/details/122018562
# rewriteBatchedStatements=true 批处理优化 大幅提升批量插入更新删除性能(对数据库有性能损耗 使用批量操作应考虑性能问题)
url: jdbc:mysql://82.156.121.2:13306/loopin?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true
url: jdbc:mysql://82.156.121.2:13306/soopin?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true
username: wzj
password: A085F27A43B0
# # 从库数据源

View File

@ -97,7 +97,7 @@ public class FansServiceImpl extends ServiceImpl<FansMapper, Fans> implements IF
Map<String, Object> params = new HashMap<>();
params.put("userID", follower.getId());
params.put("nickName", follower.getNickname() == null ? "" : follower.getNickname());
params.put("faceUrl", vlogger.getAvatar());
params.put("faceUrl", follower.getAvatar());
MQMessage message = MQMessage.builder()
.messageType(MQMessageType.IM.name())
.data(params)

View File

@ -17,6 +17,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.wzj.soopin.goods.domain.entity.Product;
import com.wzj.soopin.goods.domain.entity.Sku;
import com.wzj.soopin.goods.domain.entity.SkuSnapshot;
import com.wzj.soopin.goods.domain.vo.ProductVO;
import com.wzj.soopin.goods.mapper.ProductMapper;
import com.wzj.soopin.goods.mapper.SkuMapper;
import com.wzj.soopin.goods.mapper.SkuSnapshotMapper;
@ -235,8 +236,9 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
BigDecimal totalAmount = new BigDecimal(0);
List<Sku> skus = skuMapper.selectByIds(map.keySet());
Assert.isTrue(skus.size() == skuItemBOList.size(), () -> new ServiceException("下单商品不存在"));
LinkedHashMap<Long, Product> productMap = productMapper.selectByIds(skus.stream().map(Sku::getProductId).collect(Collectors.toList()))
.stream().collect(Collectors.toMap(Product::getId, it -> it, (v1, v2) -> v2, LinkedHashMap::new));
LinkedHashMap<Long, Product> productMap = TenantHelper.ignore(() -> productMapper.selectByIds(skus.stream().map(Sku::getProductId).collect(Collectors.toList()))
.stream().collect(Collectors.toMap(Product::getId, it -> it, (v1, v2) -> v2, LinkedHashMap::new)));
for (Sku sku : skus) {
Integer quantity = map.get(sku.getId());
Assert.isTrue(quantity < sku.getStock(), () -> new ServiceException("下单商品库存不足"));

View File

@ -69,10 +69,10 @@ public class WithdrawServiceImpl extends ServiceImpl<WithdrawMapper, Withdraw> i
public boolean audit(WithdrawBO bo) {
Withdraw withdraw = getById(bo.getId());
if (withdraw == null) {
throw new RuntimeException("提现申请不存在");
throw new ServiceException("提现申请不存在");
}
if (!Objects.equals(WithdrawAuditStatus.PENDING.getCode(), withdraw.getStatus())) {
throw new RuntimeException("提现申请已处理");
throw new ServiceException("提现申请已处理");
}
//发起提现
@ -139,10 +139,10 @@ public class WithdrawServiceImpl extends ServiceImpl<WithdrawMapper, Withdraw> i
Withdraw withdraw = getById(id);
if (withdraw == null) {
throw new RuntimeException("提现申请不存在");
throw new ServiceException("提现申请不存在");
}
if (!Objects.equals(WithdrawStatus.PENDING.getCode(), withdraw.getStatus())) {
throw new RuntimeException("提现申请已处理");
throw new ServiceException("提现申请已处理");
}
withdraw.setStatus(WithdrawStatus.SUCCESS.getCode());
updateById(withdraw);
@ -164,12 +164,12 @@ public class WithdrawServiceImpl extends ServiceImpl<WithdrawMapper, Withdraw> i
public InitiateBatchTransferResponseNew withdraw (Withdraw withdraw) {
MemberAccount memberAccount = memberAccountService.getMemberAccount(withdraw.getMemberId());
if (memberAccount == null) {
throw new RuntimeException("用户不存在");
throw new ServiceException("用户不存在");
}
//检查当前用于的账户余额是否充足
BigDecimal balance = memberAccount.getWallet();
if (balance==null||balance.compareTo(withdraw.getMoney()) < 0) {
throw new RuntimeException("用户余额不足");
throw new ServiceException("用户余额不足");
}
//检查提现次数是否超过限制
long count = this.count(new LambdaQueryWrapper<Withdraw>()
@ -179,7 +179,7 @@ public class WithdrawServiceImpl extends ServiceImpl<WithdrawMapper, Withdraw> i
);
if (count >= 3) {
throw new RuntimeException("提现次数超过限制");
throw new ServiceException("提现次数超过限制");
}
//生成费用
BigDecimal fee = withdraw.getMoney().multiply(new BigDecimal("0.00"));

View File

@ -220,7 +220,7 @@ http {
location ^~ /file/ {
proxy_pass http://43.143.227.203:9000/;
proxy_set_header X-Real-IP $remote_addr;
client_max_body_size 100M;
client_max_body_size 300M;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
# app分享
@ -232,7 +232,7 @@ http {
# app分享-接口代理
location /prod-api/ {
proxy_pass http://43.143.227.203:8880/;
client_max_body_size 100M;
client_max_body_size 300M;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}