perf:下单优化
This commit is contained in:
@@ -12,6 +12,7 @@ import com.xiang.app.modules.jntyzx.manage.IOrderCreateInfoManage;
|
||||
import com.xiang.app.modules.jntyzx.service.IJntyzxHttpService;
|
||||
import com.xiang.app.modules.jntyzx.service.IJtOrderService;
|
||||
import com.xiang.xmc.service.cache.service.IRedisService;
|
||||
import com.xiang.xservice.basic.exception.BusinessException;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
@@ -74,10 +75,12 @@ public class OrderInfoServiceImpl implements IJtOrderService {
|
||||
} else {
|
||||
dingTalkFactory.sendMsg("用户" + userTokenInfoDO.getName() + "预订场地号:" + venueInfoDOS.get(0).getPlaceName() + "结果返回:" + JSON.toJSONString(orderResp));
|
||||
if (orderResp.getMessage().contains("锁卡")) {
|
||||
return true;
|
||||
log.info("有锁卡风险,不在请求,用户:{}", userTokenInfoDO.getName());
|
||||
throw new BusinessException("即将锁卡,不再请求");
|
||||
}
|
||||
if (orderResp.getMessage().contains("限制")) {
|
||||
return true;
|
||||
log.info("改会员卡被限制,不在请求,用户:{}", userTokenInfoDO.getName());
|
||||
throw new BusinessException("会员卡被限制,不在请求");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -72,6 +72,8 @@ public class UserTokenInfoServiceImpl implements IUserTokenInfoService {
|
||||
return true;
|
||||
}
|
||||
userTokenInfoDOS.parallelStream().forEach(this::healthDeclaration);
|
||||
// 信息更新
|
||||
userTokenInfoDOS = userTokenInfoManage.list();
|
||||
userTokenInfoDOS.parallelStream().forEach(this::queryMemberCardInfo);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -48,16 +48,23 @@ public class JtVenueSubscribeTask {
|
||||
log.info("暂无可下单场地,time:{}", System.currentTimeMillis());
|
||||
return;
|
||||
}
|
||||
venueInfoMap.keySet().parallelStream().forEach(placeName -> {
|
||||
|
||||
users.parallelStream().forEach(user -> {
|
||||
try {
|
||||
for (String placeName : venueInfoMap.keySet()) {
|
||||
List<VenueInfoDO> venueInfoDOList = venueInfoMap.get(placeName);
|
||||
users.forEach(user -> {
|
||||
for (int i = 0; i < 10; i++) {
|
||||
boolean order = jtOrderService.createOrder(venueInfoDOList, user);
|
||||
if (order) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// 关键点:异常只影响当前 user
|
||||
log.error("createOrder 异常,user={}", user.getId(), e);
|
||||
return; // 结束这个 user,不影响其他 user
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user