项目介绍
本设计构建一个名为“传统文化网”的网站系统,致力于推广和传承中华优秀传统文化。该网站系统通过集成文化作品、文化视频、文化资讯、交流区等功能模块,为用户提供一个内容丰富、界面友好、操作便捷的线上平台。用户可以在此平台上阅读关于传统节日、历史人物、经典文学、民间艺术等最新的文化资讯,参加线上讲座和互动活动,或是在论坛区与他人分享心得体会。系统还为管理员和用户者提供一个展示与交流研究成果的环境。通过这个系统的建立,预期将有效提升公众对传统文化的认识和兴趣,同时促进文化知识的保存与传播。
此“传统文化网”网站系统主要包括了前端Vue框架,后端Spring Boot框架技术的开发,数据库的建立和后台管理员的管理,并且采用JAVA语言进行开发,使用MYSQL数据库存储相关的数据。从而实现了“传统文化网”管理的相关功能,包含用户管理、文化分类管理、文化作品管理、文化视频管理、交流区、系统管理、个人中心等功能,其操作简单,界面友好,运行比较稳定,于是适用于大部分用户。
开发环境
编程语言:Java
数据库 :Mysql
系统架构:B/S
前端技术:Vue
后端框架:SpringBoot
编译工具:idea或者eclipse,微信开发者工具,jdk1.8,maven
支持定做:java/php/python/android/小程序vue/爬虫/c#/asp.net
系统截图
核心代码
package com.controller;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Map;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Date;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import com.utils.ValidatorUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.annotation.IgnoreAuth;
import com.utils.UserBasedCollaborativeFiltering;
import com.entity.ChuantongwenhuaEntity;
import com.entity.view.ChuantongwenhuaView;
import com.service.ChuantongwenhuaService;
import com.service.TokenService;
import com.utils.PageUtils;
import com.utils.R;
import com.utils.MPUtil;
import com.utils.MapUtils;
import com.utils.CommonUtil;
import java.io.IOException;
import com.service.StoreupService;
import com.entity.StoreupEntity;
/**
* 传统文化
* 后端接口
* @author
* @email
* @date 2024-05-15 11:51:01
*/
@RestController
@RequestMapping("/chuantongwenhua")
public class ChuantongwenhuaController {
@Autowired
private ChuantongwenhuaService chuantongwenhuaService;
@Autowired
private StoreupService storeupService;
/**
* 后台列表
*/
@RequestMapping("/page")
public R page(@RequestParam Map<String, Object> params,ChuantongwenhuaEntity chuantongwenhua,
HttpServletRequest request){
EntityWrapper<ChuantongwenhuaEntity> ew = new EntityWrapper<ChuantongwenhuaEntity>();
PageUtils page = chuantongwenhuaService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, chuantongwenhua), params), params));
return R.ok().put("data", page);
}
/**
* 前台列表
*/
@IgnoreAuth
@RequestMapping("/list")
public R list(@RequestParam Map<String, Object> params,ChuantongwenhuaEntity chuantongwenhua,
HttpServletRequest request){
EntityWrapper<ChuantongwenhuaEntity> ew = new EntityWrapper<ChuantongwenhuaEntity>();
PageUtils page = chuantongwenhuaService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, chuantongwenhua), params), params));
return R.ok().put("data", page);
}
/**
* 列表
*/
@RequestMapping("/lists")
public R list( ChuantongwenhuaEntity chuantongwenhua){
EntityWrapper<ChuantongwenhuaEntity> ew = new EntityWrapper<ChuantongwenhuaEntity>();
ew.allEq(MPUtil.allEQMapPre( chuantongwenhua, "chuantongwenhua"));
return R.ok().put("data", chuantongwenhuaService.selectListView(ew));
}
/**
* 查询
*/
@RequestMapping("/query")
public R query(ChuantongwenhuaEntity chuantongwenhua){
EntityWrapper< ChuantongwenhuaEntity> ew = new EntityWrapper< ChuantongwenhuaEntity>();
ew.allEq(MPUtil.allEQMapPre( chuantongwenhua, "chuantongwenhua"));
ChuantongwenhuaView chuantongwenhuaView = chuantongwenhuaService.selectView(ew);
return R.ok("查询传统文化成功").put("data", chuantongwenhuaView);
}
/**
* 后台详情
*/
@RequestMapping("/info/{id}")
public R info(@PathVariable("id") Long id){
ChuantongwenhuaEntity chuantongwenhua = chuantongwenhuaService.selectById(id);
chuantongwenhua.setClicknum(chuantongwenhua.getClicknum()+1);
chuantongwenhuaService.updateById(chuantongwenhua);
chuantongwenhua = chuantongwenhuaService.selectView(new EntityWrapper<ChuantongwenhuaEntity>().eq("id", id));
return R.ok().put("data", chuantongwenhua);
}
/**
* 前台详情
*/
@IgnoreAuth
@RequestMapping("/detail/{id}")
public R detail(@PathVariable("id") Long id){
ChuantongwenhuaEntity chuantongwenhua = chuantongwenhuaService.selectById(id);
chuantongwenhua.setClicknum(chuantongwenhua.getClicknum()+1);
chuantongwenhuaService.updateById(chuantongwenhua);
chuantongwenhua = chuantongwenhuaService.selectView(new EntityWrapper<ChuantongwenhuaEntity>().eq("id", id));
return R.ok().put("data", chuantongwenhua);
}
/**
* 赞或踩
*/
@RequestMapping("/thumbsup/{id}")
public R vote(@PathVariable("id") String id,String type){
ChuantongwenhuaEntity chuantongwenhua = chuantongwenhuaService.selectById(id);
if(type.equals("1")) {
chuantongwenhua.setThumbsupnum(chuantongwenhua.getThumbsupnum()+1);
} else {
chuantongwenhua.setCrazilynum(chuantongwenhua.getCrazilynum()+1);
}
chuantongwenhuaService.updateById(chuantongwenhua);
return R.ok("投票成功");
}
/**
* 后台保存
*/
@RequestMapping("/save")
public R save(@RequestBody ChuantongwenhuaEntity chuantongwenhua, HttpServletRequest request){
//ValidatorUtils.validateEntity(chuantongwenhua);
chuantongwenhuaService.insert(chuantongwenhua);
return R.ok();
}
/**
* 前台保存
*/
@RequestMapping("/add")
public R add(@RequestBody ChuantongwenhuaEntity chuantongwenhua, HttpServletRequest request){
//ValidatorUtils.validateEntity(chuantongwenhua);
chuantongwenhuaService.insert(chuantongwenhua);
return R.ok();
}
/**
* 修改
*/
@RequestMapping("/update")
@Transactional
public R update(@RequestBody ChuantongwenhuaEntity chuantongwenhua, HttpServletRequest request){
//ValidatorUtils.validateEntity(chuantongwenhua);
chuantongwenhuaService.updateById(chuantongwenhua);//全部更新
return R.ok();
}
/**
* 删除
*/
@RequestMapping("/delete")
public R delete(@RequestBody Long[] ids){
chuantongwenhuaService.deleteBatchIds(Arrays.asList(ids));
return R.ok();
}
/**
* 前台智能排序
*/
@IgnoreAuth
@RequestMapping("/autoSort")
public R autoSort(@RequestParam Map<String, Object> params,ChuantongwenhuaEntity chuantongwenhua, HttpServletRequest request,String pre){
EntityWrapper<ChuantongwenhuaEntity> ew = new EntityWrapper<ChuantongwenhuaEntity>();
Map<String, Object> newMap = new HashMap<String, Object>();
Map<String, Object> param = new HashMap<String, Object>();
Iterator<Map.Entry<String, Object>> it = param.entrySet().iterator();
while (it.hasNext()) {
Map.Entry<String, Object> entry = it.next();
String key = entry.getKey();
String newKey = entry.getKey();
if (pre.endsWith(".")) {
newMap.put(pre + newKey, entry.getValue());
} else if (StringUtils.isEmpty(pre)) {
newMap.put(newKey, entry.getValue());
} else {
newMap.put(pre + "." + newKey, entry.getValue());
}
}
params.put("sort", "clicknum");
params.put("order", "desc");
PageUtils page = chuantongwenhuaService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, chuantongwenhua), params), params));
return R.ok().put("data", page);
}
/**
* 协同算法(基于用户收藏的协同算法)
*/
@RequestMapping("/autoSort2")
public R autoSort2(@RequestParam Map<String, Object> params,ChuantongwenhuaEntity chuantongwenhua, HttpServletRequest request){
String userId = request.getSession().getAttribute("userId").toString();
Integer limit = params.get("limit")==null?10:Integer.parseInt(params.get("limit").toString());
List<StoreupEntity> storeups = storeupService.selectList(new EntityWrapper<StoreupEntity>().eq("type", 1).eq("tablename", "chuantongwenhua"));
Map<String, Map<String, Double>> ratings = new HashMap<>();
if(storeups!=null && storeups.size()>0) {
for(StoreupEntity storeup : storeups) {
Map<String, Double> userRatings = null;
if(ratings.containsKey(storeup.getUserid().toString())) {
userRatings = ratings.get(storeup.getUserid().toString());
} else {
userRatings = new HashMap<>();
ratings.put(storeup.getUserid().toString(), userRatings);
}
if(userRatings.containsKey(storeup.getRefid().toString())) {
userRatings.put(storeup.getRefid().toString(), userRatings.get(storeup.getRefid().toString())+1.0);
} else {
userRatings.put(storeup.getRefid().toString(), 1.0);
}
}
}
// 创建协同过滤对象
UserBasedCollaborativeFiltering filter = new UserBasedCollaborativeFiltering(ratings);
// 为指定用户推荐物品
String targetUser = userId;
int numRecommendations = limit;
List<String> recommendations = filter.recommendItems(targetUser, numRecommendations);
// 输出推荐结果
System.out.println("Recommendations for " + targetUser + ":");
for (String item : recommendations) {
System.out.println(item);
}
EntityWrapper<ChuantongwenhuaEntity> ew = new EntityWrapper<ChuantongwenhuaEntity>();
ew.in("id", String.join(",", recommendations));
if(recommendations!=null && recommendations.size()>0) {
ew.last("order by FIELD(id, "+"'"+String.join("','", recommendations)+"'"+")");
}
PageUtils page = chuantongwenhuaService.queryPage(params, ew);
List<ChuantongwenhuaEntity> pageList = (List<ChuantongwenhuaEntity>)page.getList();
if(pageList.size()<limit) {
int toAddNum = limit-pageList.size();
ew = new EntityWrapper<ChuantongwenhuaEntity>();
ew.notIn("id", recommendations);
ew.orderBy("id", false);
ew.last("limit "+toAddNum);
pageList.addAll(chuantongwenhuaService.selectList(ew));
} else if(pageList.size()>limit) {
pageList = pageList.subList(0, limit);
}
page.setList(pageList);
return R.ok().put("data", page);
}
}
论文参考
目 录
1 概 述 5
1.1 研究背景与意义 5
1.2 国内外研究现状 5
1.3 本论文的主要论文结构 6
2 关键技术介绍 7
2.1 Java介绍 7
2.2 MySql数据库 7
2.3 SpringBoot框架 8
2.4 Tomcat简介 8
2.5 B/S架构 8
2.6 vue框架 9
3 系统分析 10
3.1系统功能需求分析 10
3.2 系统环境需求分析 10
3.3 系统可行性分析 10
3.3.1 技术可行性分析 11
3.3.2 经济可行性分析 11
3.3.3 运行可行性 11
3.4 系统用例分析 11
3.5系统流程分析 12
3.5.1程序流程图设计 12
4 系统的设计 15
4.1 系统总功能模块设计 15
4.2 系统数据库设计 15
4.2.1E-R模型结构设计 16
4.3数据表设计 16
4.4数据库表设计 16
5 系统的实现 25
5.1前台功能实现 25
5.2系统管理员模块实现 26
6系统测试 31
6.1系统测试 31
6.2 本章小结 32
结论 33
致谢 34
参考文献 35