一、个人简介
💖💖作者:计算机编程果茶熊 💙💙个人简介:曾长期从事计算机专业培训教学,担任过编程老师,同时本人也热爱上课教学,擅长Java、微信小程序、Python、Golang、安卓Android等多个IT方向。会做一些项目定制化开发、代码讲解、答辩教学、文档编写、也懂一些降重方面的技巧。平常喜欢分享一些自己开发中遇到的问题的解决办法,也喜欢交流技术,大家有技术代码这一块的问题可以问我! 💛💛想说的话:感谢大家的关注与支持! 💜💜 网站实战项目 安卓/小程序实战项目 大数据实战项目 计算机毕业设计选题 💕💕文末获取源码联系计算机编程果茶熊
二、系统介绍
开发语言:Java+Python 数据库:MySQL 系统架构:B/S 后端框架:SpringBoot(Spring+SpringMVC+Mybatis)+Django 前端:Vue+HTML+CSS+JavaScript+jQuery
《智能健身跟踪系统》是一个基于SpringBoot+Vue架构的综合性健康管理平台,致力于为用户提供科学化、个性化的健身与饮食管理服务。系统采用前后端分离的设计模式,后端使用Spring Boot框架整合Spring、SpringMVC、Mybatis等技术栈,前端基于Vue.js配合ElementUI组件库构建用户界面,数据存储采用MySQL关系型数据库。系统核心功能涵盖用户个人信息管理、食物营养数据库、健身知识库、个性化饮食记录与建议、多样化健身计划制定、运动轨迹追踪、社交互动论坛等模块。通过智能算法分析用户的运动数据和饮食习惯,系统能够为用户推荐适合的健身方案和营养搭配,帮助用户建立科学的健康生活方式。平台还集成了社交功能,用户可以在论坛中分享健身心得、交流经验,形成良好的健身社区氛围,从而提升用户的健身积极性和持续性。
三、视频解说
四、部分功能展示
五、部分代码展示
import org.apache.spark.sql.SparkSession;
import org.apache.spark.sql.Dataset;
import org.apache.spark.sql.Row;
import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.List;
import java.util.Map;
import java.util.HashMap;
@Service
public class FitnessDataAnalysisService {
@Autowired
private UserMapper userMapper;
@Autowired
private ExerciseRecordMapper exerciseRecordMapper;
@Autowired
private DietRecordMapper dietRecordMapper;
private SparkSession spark = SparkSession.builder().appName("FitnessAnalysis").master("local[*]").getOrCreate();
public Map<String, Object> generatePersonalizedFitnessPlan(Long userId) {
User user = userMapper.selectById(userId);
List<ExerciseRecord> exerciseHistory = exerciseRecordMapper.selectByUserId(userId);
Dataset<Row> exerciseData = spark.read().json("exercise_data.json");
exerciseData.createOrReplaceTempView("exercises");
String sql = "SELECT exercise_type, AVG(calories_burned) as avg_calories, AVG(duration) as avg_duration FROM exercises WHERE user_id = " + userId + " GROUP BY exercise_type";
Dataset<Row> avgStats = spark.sql(sql);
Map<String, Object> planDetails = new HashMap<>();
double bmi = calculateBMI(user.getHeight(), user.getWeight());
String fitnessLevel = determineFitnessLevel(exerciseHistory);
List<String> recommendedExercises = generateExerciseRecommendations(bmi, fitnessLevel, user.getFitnessGoal());
int weeklyTrainingDays = calculateOptimalTrainingDays(fitnessLevel);
Map<String, Integer> exerciseDistribution = distributeExerciseTypes(recommendedExercises, weeklyTrainingDays);
planDetails.put("userId", userId);
planDetails.put("bmi", bmi);
planDetails.put("fitnessLevel", fitnessLevel);
planDetails.put("weeklyTrainingDays", weeklyTrainingDays);
planDetails.put("recommendedExercises", recommendedExercises);
planDetails.put("exerciseDistribution", exerciseDistribution);
planDetails.put("estimatedCaloriesBurn", calculateEstimatedCalories(exerciseDistribution, user.getWeight()));
saveFitnessPlan(userId, planDetails);
return planDetails;
}
public Map<String, Object> analyzeDietaryNutrition(Long userId, String dateRange) {
List<DietRecord> dietRecords = dietRecordMapper.selectByUserIdAndDateRange(userId, dateRange);
Dataset<Row> nutritionData = spark.read().json("nutrition_data.json");
nutritionData.createOrReplaceTempView("nutrition");
String nutritionSql = "SELECT food_name, calories_per_100g, protein, carbs, fat, fiber FROM nutrition";
Dataset<Row> nutritionInfo = spark.sql(nutritionSql);
Map<String, Object> nutritionAnalysis = new HashMap<>();
double totalCalories = 0;
double totalProtein = 0;
double totalCarbs = 0;
double totalFat = 0;
double totalFiber = 0;
for (DietRecord record : dietRecords) {
FoodNutrition nutrition = getNutritionInfo(record.getFoodId());
double portionMultiplier = record.getPortionSize() / 100.0;
totalCalories += nutrition.getCalories() * portionMultiplier;
totalProtein += nutrition.getProtein() * portionMultiplier;
totalCarbs += nutrition.getCarbs() * portionMultiplier;
totalFat += nutrition.getFat() * portionMultiplier;
totalFiber += nutrition.getFiber() * portionMultiplier;
}
User user = userMapper.selectById(userId);
double targetCalories = calculateDailyCalorieNeeds(user);
double targetProtein = user.getWeight() * 1.6;
double targetCarbs = targetCalories * 0.5 / 4;
double targetFat = targetCalories * 0.25 / 9;
nutritionAnalysis.put("totalCalories", totalCalories);
nutritionAnalysis.put("totalProtein", totalProtein);
nutritionAnalysis.put("totalCarbs", totalCarbs);
nutritionAnalysis.put("totalFat", totalFat);
nutritionAnalysis.put("totalFiber", totalFiber);
nutritionAnalysis.put("calorieBalance", totalCalories - targetCalories);
nutritionAnalysis.put("proteinBalance", totalProtein - targetProtein);
nutritionAnalysis.put("carbsBalance", totalCarbs - targetCarbs);
nutritionAnalysis.put("fatBalance", totalFat - targetFat);
nutritionAnalysis.put("nutritionScore", calculateNutritionScore(nutritionAnalysis));
List<String> suggestions = generateDietarySuggestions(nutritionAnalysis, user.getFitnessGoal());
nutritionAnalysis.put("suggestions", suggestions);
saveDietaryAnalysis(userId, nutritionAnalysis);
return nutritionAnalysis;
}
public Map<String, Object> trackExerciseProgress(Long userId, String exerciseType, int duration, double caloriesBurned) {
ExerciseRecord newRecord = new ExerciseRecord();
newRecord.setUserId(userId);
newRecord.setExerciseType(exerciseType);
newRecord.setDuration(duration);
newRecord.setCaloriesBurned(caloriesBurned);
newRecord.setExerciseDate(new Date());
exerciseRecordMapper.insert(newRecord);
Dataset<Row> progressData = spark.read().json("progress_data.json");
progressData.createOrReplaceTempView("progress");
String progressSql = "SELECT exercise_date, SUM(calories_burned) as daily_calories, SUM(duration) as daily_duration FROM progress WHERE user_id = " + userId + " AND exercise_date >= date_sub(current_date(), 30) GROUP BY exercise_date ORDER BY exercise_date";
Dataset<Row> monthlyProgress = spark.sql(progressSql);
List<ExerciseRecord> recentRecords = exerciseRecordMapper.selectRecentByUserId(userId, 30);
Map<String, Object> progressAnalysis = new HashMap<>();
double avgDailyCalories = recentRecords.stream().mapToDouble(ExerciseRecord::getCaloriesBurned).average().orElse(0);
double avgDailyDuration = recentRecords.stream().mapToInt(ExerciseRecord::getDuration).average().orElse(0);
int totalWorkouts = recentRecords.size();
Map<String, Integer> exerciseFrequency = new HashMap<>();
for (ExerciseRecord record : recentRecords) {
exerciseFrequency.put(record.getExerciseType(), exerciseFrequency.getOrDefault(record.getExerciseType(), 0) + 1);
}
String mostFrequentExercise = exerciseFrequency.entrySet().stream().max(Map.Entry.comparingByValue()).map(Map.Entry::getKey).orElse("无");
double progressScore = calculateProgressScore(avgDailyCalories, avgDailyDuration, totalWorkouts);
FitnessPlan currentPlan = fitnessPlanMapper.selectByUserId(userId);
double planCompletionRate = calculatePlanCompletion(recentRecords, currentPlan);
progressAnalysis.put("newRecordId", newRecord.getId());
progressAnalysis.put("avgDailyCalories", avgDailyCalories);
progressAnalysis.put("avgDailyDuration", avgDailyDuration);
progressAnalysis.put("totalWorkouts", totalWorkouts);
progressAnalysis.put("mostFrequentExercise", mostFrequentExercise);
progressAnalysis.put("progressScore", progressScore);
progressAnalysis.put("planCompletionRate", planCompletionRate);
progressAnalysis.put("fitnessLevel", updateFitnessLevel(userId, progressScore));
List<String> achievements = checkAchievements(userId, progressAnalysis);
progressAnalysis.put("newAchievements", achievements);
updateUserStats(userId, progressAnalysis);
return progressAnalysis;
}
}
六、部分文档展示
七、END
💕💕文末获取源码联系计算机编程果茶熊