|  | @@ -186,7 +186,6 @@ public class PartitionCrashServiceImpl implements PartitionCrashService {
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |                  // 创建一个分区编号
 | 
	
		
			
				|  |  |                  String todayNo = crashTodayNo(k.getUserId());
 | 
	
		
			
				|  |  | -                String yesterdayNo = crashYesterdayNo(k.getUserId());
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |                  PartitionSonSaveReqVO.PartitionSonSaveReqVOBuilder sonBuilder = PartitionSonSaveReqVO.builder();
 | 
	
		
			
				|  |  |                  PartitionBrothersSaveReqVO.PartitionBrothersSaveReqVOBuilder brotherBuilder = PartitionBrothersSaveReqVO.builder();
 | 
	
	
		
			
				|  | @@ -235,7 +234,7 @@ public class PartitionCrashServiceImpl implements PartitionCrashService {
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |                  // 判断,昨天是否有存余的分支
 | 
	
		
			
				|  |  | -                PartitionCrashDO yesterdayCrash = partitionCrashMapper.selectOne(new LambdaQueryWrapperX<PartitionCrashDO>().eqIfPresent(PartitionCrashDO::getPartNo, yesterdayNo));
 | 
	
		
			
				|  |  | +                PartitionCrashDO yesterdayCrash = crashYesterdayNo(k.getUserId(),1);
 | 
	
		
			
				|  |  |                  // 如果不为空, 则判断增加到哪个分支中
 | 
	
		
			
				|  |  |                  if (yesterdayCrash != null) {
 | 
	
		
			
				|  |  |                      if (yesterdayCrash.getSonPrice() >= yesterdayCrash.getBrotherPrice()) {
 | 
	
	
		
			
				|  | @@ -302,7 +301,7 @@ public class PartitionCrashServiceImpl implements PartitionCrashService {
 | 
	
		
			
				|  |  |                              integralDO.getFreezeQuota(), JsonUtils.toJsonString(orderPercentageDO), ptReplenish, -amount, highQuota - amount);
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |                      //记录每日用户有合赢将的记录,后面用来结算的
 | 
	
		
			
				|  |  | -                    dailyAwardRecordsService.addDailyAwardRecords(integralDO.getUserId(),amount, logId);
 | 
	
		
			
				|  |  | +                    dailyAwardRecordsService.addDailyAwardRecords(integralDO.getUserId(),integralDO.getUserId(),amount, logId);
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |                  //直推人的上级的本次添加积分
 | 
	
	
		
			
				|  | @@ -332,7 +331,7 @@ public class PartitionCrashServiceImpl implements PartitionCrashService {
 | 
	
		
			
				|  |  |                              parentIntegralDo.getFreezeQuota(), JsonUtils.toJsonString(orderPercentageDO), parentPtReplenish, -parentAmount, parentHighQuota - parentAmount);
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |                      //记录每日用户有合赢将的记录,后面用来结算的
 | 
	
		
			
				|  |  | -                    dailyAwardRecordsService.addDailyAwardRecords(parentIntegralDo.getUserId(),parentAmount,logId);
 | 
	
		
			
				|  |  | +                    dailyAwardRecordsService.addDailyAwardRecords(parentIntegralDo.getUserId(),integralDO.getUserId(),parentAmount,logId);
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |                  if (!ptReplenish.equals(0L)) {
 | 
	
	
		
			
				|  | @@ -543,12 +542,20 @@ public class PartitionCrashServiceImpl implements PartitionCrashService {
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      // 获取昨天的编号
 | 
	
		
			
				|  |  | -    public String crashYesterdayNo(Long userId) {
 | 
	
		
			
				|  |  | +    public PartitionCrashDO crashYesterdayNo(Long userId,Integer yesterday) {
 | 
	
		
			
				|  |  |          LocalDateTime todayStart = LocalDateTime.of(LocalDate.now(), LocalTime.MIDNIGHT); // 今天的开始时间,即午夜12点
 | 
	
		
			
				|  |  | -        LocalDateTime localDateTime = todayStart.minusDays(1);
 | 
	
		
			
				|  |  | -        String yesterdayString = localDateTime.toString();
 | 
	
		
			
				|  |  | +        LocalDateTime localDateTime = todayStart.minusDays(yesterday);
 | 
	
		
			
				|  |  | +        String yesterdayString = "CRASH:" + userId + ":" + localDateTime.toString();
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        PartitionCrashDO partitionCrashDO = partitionCrashMapper.selectOne(new LambdaQueryWrapperX<PartitionCrashDO>().eqIfPresent(PartitionCrashDO::getPartNo, yesterdayString));
 | 
	
		
			
				|  |  | +        List<PartitionCrashDO> partitionCrashDOS = partitionCrashMapper.selectList((new LambdaQueryWrapperX<PartitionCrashDO>().eq(PartitionCrashDO::getUserId, userId)));
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        //判断这个用户不是第一次碰撞并且没有查询到昨天的碰撞记录,有可能是昨天或者更早定时任务没有启动导致的,所以再往前查几天
 | 
	
		
			
				|  |  | +        if(!partitionCrashDOS.isEmpty() && partitionCrashDO == null){
 | 
	
		
			
				|  |  | +            return crashYesterdayNo(userId,++yesterday);
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  |  //        return "CRASH:" + userId + ":" + "2024-06-20T00:00";
 | 
	
		
			
				|  |  | -        return "CRASH:" + userId + ":" + yesterdayString;
 | 
	
		
			
				|  |  | +        return partitionCrashDO;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 |