|  | @@ -69,6 +69,8 @@ public class SysMusicCompareRecordServiceImpl extends BaseServiceImpl<Long, SysM
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      @Autowired
 | 
	
		
			
				|  |  |      private UserMusicCompareCampDayDataDao userMusicCompareCampDayDataDao;
 | 
	
		
			
				|  |  | +    @Autowired
 | 
	
		
			
				|  |  | +    private TempLittleArtistTrainingCampUserRelationService tempLittleArtistTrainingCampUserRelationService;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      @Autowired
 | 
	
		
			
				|  |  |      private UserMusicService userMusicService;
 | 
	
	
		
			
				|  | @@ -79,11 +81,14 @@ public class SysMusicCompareRecordServiceImpl extends BaseServiceImpl<Long, SysM
 | 
	
		
			
				|  |  |  	}
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  	@Override
 | 
	
		
			
				|  |  | +	@Transactional(rollbackFor = Exception.class)
 | 
	
		
			
				|  |  |  	public long insert(SysMusicCompareRecord bean) {
 | 
	
		
			
				|  |  |  		long insert = super.insert(bean);
 | 
	
		
			
				|  |  |  		if(Objects.nonNull(bean.getUserId())){
 | 
	
		
			
				|  |  |  			studentDao.addStudentCloudStudySequenceDays(bean.getUserId());
 | 
	
		
			
				|  |  |  			sysMusicCompareWeekDataService.updateUserWeekTrainData(bean.getUserId(), LocalDate.now().with(DateUtil.weekFields.dayOfWeek(), DayOfWeek.MONDAY.getValue()));
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +			updateCampData(bean);
 | 
	
		
			
				|  |  |  		}
 | 
	
		
			
				|  |  |  		return insert;
 | 
	
		
			
				|  |  |  	}
 | 
	
	
		
			
				|  | @@ -151,7 +156,7 @@ public class SysMusicCompareRecordServiceImpl extends BaseServiceImpl<Long, SysM
 | 
	
		
			
				|  |  |  		
 | 
	
		
			
				|  |  |  		sysMusicCompareRecordDao.update(sysMusicCompareRecord);
 | 
	
		
			
				|  |  |  		studentDao.addStudentCloudStudySequenceDays(userId);
 | 
	
		
			
				|  |  | -        updateCampData(sysMusicCompareRecord,campId);
 | 
	
		
			
				|  |  | +        updateCampData(sysMusicCompareRecord);
 | 
	
		
			
				|  |  |  		sysMusicCompareWeekDataService
 | 
	
		
			
				|  |  |  				.updateUserWeekTrainData(userId, LocalDate.now().with(DateUtil.weekFields.dayOfWeek(), DayOfWeek.MONDAY.getValue()));
 | 
	
		
			
				|  |  |  	}
 | 
	
	
		
			
				|  | @@ -532,22 +537,6 @@ public class SysMusicCompareRecordServiceImpl extends BaseServiceImpl<Long, SysM
 | 
	
		
			
				|  |  |  		return pageInfo;
 | 
	
		
			
				|  |  |  	}
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -    /**
 | 
	
		
			
				|  |  | -     * 小小训练营 保存用户评测记录
 | 
	
		
			
				|  |  | -     *
 | 
	
		
			
				|  |  | -     * @param record 评测记录
 | 
	
		
			
				|  |  | -     * @param campId 训练营id
 | 
	
		
			
				|  |  | -     */
 | 
	
		
			
				|  |  | -    @Override
 | 
	
		
			
				|  |  | -    @Transactional
 | 
	
		
			
				|  |  | -    public boolean insert(SysMusicCompareRecord record, Integer campId) {
 | 
	
		
			
				|  |  | -        this.insert(record);
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -        updateCampData(record, campId);
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -        return true;
 | 
	
		
			
				|  |  | -    }
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  |      @Override
 | 
	
		
			
				|  |  |      public Map<Long, SysMusicCompareRecord> getMapByIds(List<Long> musicPracticeRecordIds) {
 | 
	
		
			
				|  |  |          if (CollectionUtils.isEmpty(musicPracticeRecordIds)) {
 | 
	
	
		
			
				|  | @@ -560,21 +549,26 @@ public class SysMusicCompareRecordServiceImpl extends BaseServiceImpl<Long, SysM
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -    private void updateCampData(SysMusicCompareRecord record, Integer campId) {
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -        if (campId == null) {
 | 
	
		
			
				|  |  | -            return;
 | 
	
		
			
				|  |  | -        }
 | 
	
		
			
				|  |  | -        // 保存训练营评测记录
 | 
	
		
			
				|  |  | -        int i = userMusicCompareCampDayDataDao.updateCampDayData(record.getUserId(), campId, record.getPlayTime());
 | 
	
		
			
				|  |  | -        if (i == 0) {
 | 
	
		
			
				|  |  | -            UserMusicCompareCampDayData campDayData = new UserMusicCompareCampDayData();
 | 
	
		
			
				|  |  | -            campDayData.setCampId(campId);
 | 
	
		
			
				|  |  | -            campDayData.setUserId(record.getUserId());
 | 
	
		
			
				|  |  | -            campDayData.setDay(new Date());
 | 
	
		
			
				|  |  | -            campDayData.setTrainNum(1);
 | 
	
		
			
				|  |  | -            campDayData.setTrainTime(record.getPlayTime());
 | 
	
		
			
				|  |  | -            userMusicCompareCampDayDataDao.insert(campDayData);
 | 
	
		
			
				|  |  | -        }
 | 
	
		
			
				|  |  | +    private void updateCampData(SysMusicCompareRecord record) {
 | 
	
		
			
				|  |  | +		//获取所有进行中的训练营
 | 
	
		
			
				|  |  | +		List<TempLittleArtistTrainingCampUserRelation> userRelations = tempLittleArtistTrainingCampUserRelationService.getDao()
 | 
	
		
			
				|  |  | +				.queryByUserId(record.getUserId(),"ING");
 | 
	
		
			
				|  |  | +		if (CollectionUtils.isEmpty(userRelations)) {
 | 
	
		
			
				|  |  | +			return;
 | 
	
		
			
				|  |  | +		}
 | 
	
		
			
				|  |  | +		Date date = new Date();
 | 
	
		
			
				|  |  | +		for (TempLittleArtistTrainingCampUserRelation userRelation : userRelations) {
 | 
	
		
			
				|  |  | +			// 保存训练营评测记录
 | 
	
		
			
				|  |  | +			int i = userMusicCompareCampDayDataDao.updateCampDayData(record.getUserId(), userRelation.getActivityId(), record.getPlayTime());
 | 
	
		
			
				|  |  | +			if (i == 0) {
 | 
	
		
			
				|  |  | +				UserMusicCompareCampDayData campDayData = new UserMusicCompareCampDayData();
 | 
	
		
			
				|  |  | +				campDayData.setCampId(userRelation.getActivityId());
 | 
	
		
			
				|  |  | +				campDayData.setUserId(record.getUserId());
 | 
	
		
			
				|  |  | +				campDayData.setDay(date);
 | 
	
		
			
				|  |  | +				campDayData.setTrainNum(1);
 | 
	
		
			
				|  |  | +				campDayData.setTrainTime(record.getPlayTime());
 | 
	
		
			
				|  |  | +				userMusicCompareCampDayDataDao.insert(campDayData);
 | 
	
		
			
				|  |  | +			}
 | 
	
		
			
				|  |  | +		}
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  }
 |