update 修改方法入参

This commit is contained in:
Guoqs
2026-04-22 11:38:47 +08:00
parent d9c2e19ad1
commit c84d57bf09
2 changed files with 8 additions and 11 deletions

View File

@@ -6329,18 +6329,18 @@ public class OrderBasicInfoServiceImpl implements OrderBasicInfoService {
@Override
public int updateOrderReviewFlagTemp(LocalDateTime start, LocalDateTime end, String stationId) {
double ratio = 0.65;
if (StringUtils.isBlank(stationId)) {
stationId = "1003"; // 目前只有 大坡中学举视超充站 这一个站点使用
ratio = 0.1;
logger.info("校验或更新订单分账信息-使用默认站点id:{}", stationId);
}
List<OrderListVO> orderList = this.selectOrderListByDateTime(start, end, stationId);
if (CollectionUtils.isEmpty(orderList)) {
return 0;
}
List<String> orderCodeList = orderList.stream().map(OrderListVO::getOrderCode).collect(Collectors.toList());
UpdateOrderReviewDTO dto = new UpdateOrderReviewDTO();
// dto.setOrderCodeList(MerchantUtils.getRandomNinetyPercent(orderCodeList));
dto.setOrderCodeList(MerchantUtils.getRandomOrderCodes(orderList));
dto.setOrderCodeList(MerchantUtils.getRandomOrderCodes(orderList, ratio));
dto.setStationId(stationId);
return batchUpdateOrderReview(dto);
}

View File

@@ -75,21 +75,18 @@ public class MerchantUtils {
return new ArrayList<>(shuffled.subList(0, keepCount));
}
public static List<String> getRandomOrderCodes(List<OrderListVO> list) {
public static List<String> getRandomOrderCodes(List<OrderListVO> list, double ratio) {
if (list == null || list.isEmpty()) {
return new ArrayList<>();
}
// 检查订单信息中的昵称,剔除不是以会员开头的订单
// list = list.stream().filter(order -> order.getNickName().startsWith("会员")).collect(Collectors.toList());
int total = list.size();
int removeCount = (int) Math.ceil(total * 0.65);
int removeCount = (int) Math.ceil(total * ratio);
int keepCount = Math.max(1, total - removeCount);
List<OrderListVO> shuffled = new ArrayList<>(list);
Collections.shuffle(shuffled);
List<OrderListVO> orderListVOS = new ArrayList<>(shuffled.subList(0, keepCount));
// 提取orderCode
List<String> codeList = orderListVOS.stream().map(OrderListVO::getOrderCode).collect(Collectors.toList());
return codeList;
return shuffled.subList(0, keepCount).stream()
.map(OrderListVO::getOrderCode)
.collect(Collectors.toList());
}
}