package com.example.controller;
import cn.hutool.json.JSONObject;
import com.example.common.Result;
import com.example.entity.*;
import com.example.service.*;
import com.example.vo.*;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.*;
import java.util.stream.Collectors;
@RestController
@RequestMapping("/echarts")
public class EchartsController {
@Resource
private AdminInfoService adminInfoService;
@Resource
private UserInfoService userInfoService;
@Resource
private ClassifyInfoService classifyInfoService;
@Resource
private SubClassifyInfoService subClassifyInfoService;
@Resource
private CollectInfoService collectInfoService;
@Resource
private PraiseInfoService praiseInfoService;
@Resource
private NewsInfoService newsInfoService;
@Resource
private MessageInfoService messageInfoService;
@GetMapping("/get/{modelName}")
Result<List<EchartsData>> getEchartsData(@PathVariable String modelName) {
List<EchartsData> list = new ArrayList<>();
switch (modelName) {
case "adminInfo":
List<AdminInfoVo> adminInfoList = adminInfoService.findAll();
List<AdminInfo> adminInfoMaleList = adminInfoList.stream().filter(x -> "男".equals(x.getSex())).collect(Collectors.toList());
Map<String, Integer> adminInfoMap = new HashMap<>(2);
adminInfoMap.put("男", adminInfoMaleList.size());
adminInfoMap.put("女", adminInfoList.size() - adminInfoMaleList.size());
getPieData("管理员", list, adminInfoMap);
getBarData("管理员", list, adminInfoMap);
break;
case "userInfo":
List<UserInfoVo> userInfoList = userInfoService.findAll();
List<UserInfo> userInfoMaleList = userInfoList.stream().filter(x -> "男".equals(x.getSex())).collect(Collectors.toList());
Map<String, Integer> userInfoMap = new HashMap<>(2);
userInfoMap.put("男", userInfoMaleList.size());
userInfoMap.put("女", userInfoList.size() - userInfoMaleList.size());
getPieData("用户", list, userInfoMap);
getBarData("用户", list, userInfoMap);
break;
case "classifyInfo":
List<ClassifyInfoVo> classifyInfoList = classifyInfoService.findAll();
Map<String, Integer> classifyInfoMap = new HashMap<>(2);
for (ClassifyInfo classifyInfo : classifyInfoList) {
Integer value = classifyInfoMap.get(classifyInfo.getName());
if (value != null && value != 0) {
classifyInfoMap.put(classifyInfo.getName(), value + 1);
} else {
classifyInfoMap.put(classifyInfo.getName(), 1);
}
}
getPieData("菜谱大类", list, classifyInfoMap);
getBarData("菜谱大类", list, classifyInfoMap);
break;
case "subClassifyInfo":
List<SubClassifyInfoVo> subClassifyInfoList = subClassifyInfoService.findAll();
Map<String, Integer> subClassifyInfoMap = new HashMap<>(2);
for (SubClassifyInfo subClassifyInfo : subClassifyInfoList) {
Integer value = subClassifyInfoMap.get(subClassifyInfo.getName());
if (value != null && value != 0) {
subClassifyInfoMap.put(subClassifyInfo.getName(), value + 1);
} else {
subClassifyInfoMap.put(subClassifyInfo.getName(), 1);
}
}
getPieData("菜谱小类", list, subClassifyInfoMap);
getBarData("菜谱小类", list, subClassifyInfoMap);
break;
case "collectInfo":
List<CollectInfoVo> collectInfoList = collectInfoService.findAll();
Map<String, Integer> collectInfoMap = new HashMap<>(2);
for (CollectInfo collectInfo : collectInfoList) {
Integer value = collectInfoMap.get(collectInfo.getName());
if (value != null && value != 0) {
collectInfoMap.put(collectInfo.getName(), value + 1);
} else {
collectInfoMap.put(collectInfo.getName(), 1);
}
}
getPieData("收藏", list, collectInfoMap);
getBarData("收藏", list, collectInfoMap);
break;
case "praiseInfo":
List<PraiseInfoVo> praiseInfoList = praiseInfoService.findAll();
Map<String, Integer> praiseInfoMap = new HashMap<>(2);
for (PraiseInfo praiseInfo : praiseInfoList) {
Integer value = praiseInfoMap.get(praiseInfo.getName());
if (value != null && value != 0) {
praiseInfoMap.put(praiseInfo.getName(), value + 1);
} else {
praiseInfoMap.put(praiseInfo.getName(), 1);
}
}
getPieData("笔记点赞", list, praiseInfoMap);
getBarData("笔记点赞", list, praiseInfoMap);
break;
case "newsInfo":
List<NewsInfoVo> newsInfoList = newsInfoService.findAll();
Map<String, Integer> newsInfoMap = new HashMap<>(2);
for (NewsInfo newsInfo : newsInfoList) {
Integer value = newsInfoMap.get(newsInfo.getName());
if (value != null && value != 0) {
newsInfoMap.put(newsInfo.getName(), value + 1);
} else {
newsInfoMap.put(newsInfo.getName(), 1);
}
}
getPieData("饮食资讯", list, newsInfoMap);
getBarData("饮食资讯", list, newsInfoMap);
break;
case "messageInfo":
List<MessageInfoVo> messageInfoList = messageInfoService.findAll();
Map<String, Integer> messageInfoMap = new HashMap<>(2);
for (MessageInfo messageInfo : messageInfoList) {
Integer value = messageInfoMap.get(messageInfo.getName());
if (value != null && value != 0) {
messageInfoMap.put(messageInfo.getName(), value + 1);
} else {
messageInfoMap.put(messageInfo.getName(), 1);
}
}
getPieData("趣味答题", list, messageInfoMap);
getBarData("趣味答题", list, messageInfoMap);
break;
default:
break;
}
return Result.success(list);
}
@GetMapping("/options")
Result<List<Map<String, String>>> getOptions() {
List<Map<String, String>> options = new ArrayList<>();
Map<String, String> optionMap1 = new HashMap<>();
optionMap1.put("value", "adminInfo");
optionMap1.put("label", "管理员信息");
options.add(optionMap1);
Map<String, String> optionMap2 = new HashMap<>();
optionMap2.put("value", "userInfo");
optionMap2.put("label", "用户信息");
options.add(optionMap2);
Map<String, String> optionMap3 = new HashMap<>();
optionMap3.put("value", "classifyInfo");
optionMap3.put("label", "菜谱大类信息");
options.add(optionMap3);
Map<String, String> optionMap4 = new HashMap<>();
optionMap4.put("value", "subClassifyInfo");
optionMap4.put("label", "菜谱小类信息");
options.add(optionMap4);
Map<String, String> optionMap5 = new HashMap<>();
optionMap5.put("value", "collectInfo");
optionMap5.put("label", "收藏信息");
options.add(optionMap5);
Map<String, String> optionMap6 = new HashMap<>();
optionMap6.put("value", "praiseInfo");
optionMap6.put("label", "笔记点赞信息");
options.add(optionMap6);
Map<String, String> optionMap7 = new HashMap<>();
optionMap7.put("value", "newsInfo");
optionMap7.put("label", "饮食资讯信息");
options.add(optionMap7);
Map<String, String> optionMap8 = new HashMap<>();
optionMap8.put("value", "messageInfo");
optionMap8.put("label", "趣味答题信息");
options.add(optionMap8);
return Result.success(options);
}
private void getPieData(String name, List<EchartsData> pieList, Map<String, Integer> dataMap) {
EchartsData pieData = new EchartsData();
EchartsData.Series series = new EchartsData.Series();
Map<String, String> titleMap = new HashMap<>(2);
titleMap.put("text", name + "信息");
pieData.setTitle(titleMap);
series.setName(name + "比例");
series.setType("pie");
series.setRadius("55%");
List<Object> objects = new ArrayList<>();
List<Object> legendList = new ArrayList<>();
for (String key : dataMap.keySet()) {
Integer value = dataMap.get
没有合适的资源?快使用搜索试试~ 我知道了~
基于SpringBoot和HTML/CSS/JavaScript的美食分享自我管理系统设计源码
共421个文件
class:86个
java:83个
html:64个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 175 浏览量
2024-12-18
00:11:48
上传
评论
收藏 60.7MB ZIP 举报
温馨提示
本项目是一款基于SpringBoot框架,融合HTML、CSS和JavaScript技术的美食分享自我管理系统设计源码。该系统包含共计420个文件,其中Java类文件86个,HTML文件64个,JavaScript和CSS文件各36个,以及相应的图片和字体资源文件。系统旨在提供一个便捷的美食分享平台,满足用户发布、浏览和交流美食信息的需求。
资源推荐
资源详情
资源评论
收起资源包目录
基于SpringBoot和HTML/CSS/JavaScript的美食分享自我管理系统设计源码 (421个子文件)
EchartsController.class 13KB
AccountController.class 12KB
AdminInfoController.class 8KB
UserInfoController.class 8KB
NxSystemFileController.class 8KB
SubClassifyInfoController.class 8KB
AdvertiserInfoController.class 8KB
MessageInfoController.class 7KB
ClassifyInfoController.class 7KB
NewsInfoController.class 7KB
FoodsMenuInfoController.class 6KB
MenuController.class 6KB
FoodsMenuInfoService.class 5KB
FoodsMaterialInfoController.class 5KB
CollectInfoService.class 4KB
AdminInfoService.class 4KB
UserInfoService.class 4KB
NotesInfoCommentController.class 4KB
NotesInfoService.class 4KB
PraiseInfoService.class 4KB
AdminInfo.class 4KB
ClassifyInfoService.class 4KB
NotesInfoCommentService.class 4KB
CollectInfoController.class 4KB
PraiseInfoController.class 4KB
NotesInfoController.class 3KB
AdvertiserInfoService.class 3KB
UserInfo.class 3KB
SubClassifyInfoService.class 3KB
MessageInfoService.class 3KB
FoodsMenuInfo.class 3KB
NewsInfoService.class 3KB
NxSystemFileInfoService.class 3KB
Account.class 3KB
FoodsMaterialInfoService.class 3KB
FoodsMaterialInfo.class 2KB
NotesInfo.class 2KB
Result.class 2KB
CollectInfo.class 2KB
PraiseInfo.class 2KB
EchartsData.class 2KB
ResultCode.class 2KB
MyInterceptor.class 2KB
NotesInfoComment.class 2KB
GlobalExceptionHandler.class 2KB
SubClassifyInfo.class 2KB
EchartsData$Data.class 2KB
WebMvcConfig.class 2KB
AdvertiserInfo.class 2KB
MessageInfo.class 1KB
EchartsData$Series.class 1KB
AuthorityInfo.class 1KB
MyInterceptorConfig.class 1KB
NxSystemFileInfo.class 1KB
ClassifyInfo.class 1KB
NewsInfo.class 1KB
AuthorityInfo$Model.class 1KB
CustomException.class 1KB
FoodsMenuInfoVo.class 1KB
FoodsMenuInfoDao.class 1KB
CollectInfoDao.class 1KB
PraiseInfoDao.class 918B
AdminInfoDao.class 880B
UserInfoDao.class 875B
ClassifyInfoVo.class 844B
SubClassifyInfoDao.class 822B
NotesInfoCommentDao.class 819B
Application.class 793B
NxSystemFileInfoDao.class 773B
NotesInfoDao.class 749B
FoodsMaterialInfoDao.class 718B
MessageInfoDao.class 677B
NewsInfoDao.class 665B
AdvertiserInfoDao.class 649B
ClassifyInfoDao.class 641B
NotesInfoCommentVo.class 629B
SubClassifyInfoVo.class 628B
CollectInfoVo.class 603B
PraiseInfoVo.class 599B
NotesInfoVo.class 592B
FoodsMaterialInfoVo.class 332B
AdvertiserInfoVo.class 320B
MessageInfoVo.class 308B
AdminInfoVo.class 300B
UserInfoVo.class 296B
NewsInfoVo.class 296B
index.css 227KB
index.css 227KB
index.css 227KB
index.css 227KB
bootstrap.min.css 119KB
bootstrap.min.css 119KB
bootstrap.min.css 119KB
bootstrap.min.css 119KB
font-awesome.css 26KB
font-awesome.css 26KB
quill.snow.css 24KB
quill.snow.css 24KB
swiper.min.css 13KB
swiper.min.css 13KB
共 421 条
- 1
- 2
- 3
- 4
- 5
资源评论
lsx202406
- 粉丝: 2764
- 资源: 5645
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功