大家好!我是职场程序猿,感谢您阅读本文,欢迎一键三连哦。
💞当前专栏:微信小程序毕业设计
精彩专栏推荐👇🏻👇🏻👇🏻
开发运行环境
①前端:微信小程序开发工具
② 后端:Java
- 框架:springboot
- JDK版本:JDK1.8
- 服务器:tomcat7
- 数据库:mysql 5.7
- 数据库工具:Navicat12
- 开发软件:eclipse/myeclipse/idea
- Maven包:Maven3.3.9
- 浏览器:谷歌浏览器
源码下载地址:
https://download.csdn.net/download/m0_46388260/89223533
论文目录
【如需全文请按文末获取联系】
目录
一、项目简介
对网络安全进行了一定的考察和分析后,决定设计一个信息化的网络安全科普系统,采用Java语言技术进行开发,Mysql数据库进行数据存储,结合微信小程序技术和SpringBoot框架,通过采用这些技术在功能方面更加的完善,界面方面也更加的美观,符合现代人的审美。经过技术的发展目前的网络安全科普里一般也采用了计算机类的科普宣传网,但是都是综合性的平台,信息种类杂乱,所以经过一番考研调查后,决定设计单纯的网络安全科普系统,这样不单单是方便了管理员,对于用户来说了解网络安全信息也更加的方便,直接通过系统就可以进行查阅科普知识、案例分析,然后在线评价、交流、答题。
二、系统设计
2.1软件功能模块设计
根据第三章的功能分析设计出本系统的功能为科普知识管理、用户管理、反馈交流管理、答题管理等。本系统的权限分为用户和管理员两种。界面分为管理员界面和用户界面。本系统的功能结构图如下图4.1所示:
2.2数据库设计
本系统的主要数据为管理员、用户、科普知识信息、分类信息、留言信息等。管理员ER图如下图4.2所示:
科普知识数据由管理员管理,用户可以浏览,科普知识数据ER图如下图4.4所示:
系统关系ER图如下图4.7所示:
三、系统项目部分截图
3.1注册登陆功能
首页界面的实现
首页操作界面是门户,一个好的首页界面才可以吸引住用户。本操作界面里含有导航栏、系统名称、信息搜索窗口、案例分析展示模块和科普知识信息展示模块等。首页操作界面功能的实现界面如下图5.3所示:
用户注册功能的实现界面
游客可以注册,注册成为用户后才可以答题。用户注册功能的实现界面如下图5.4所示:
科普知识信息功能的实现界面
在科普知识信息界面里可以学习详细的科普知识。科普知识浏览功能的实现界面如下图5.5所示:
我的功能实现
在我的界面里用户可以管理收藏信息、答题信息、帖子信息等。我的功能实现界面如下图5.11所示:
3.2系统后台管理员功能实现
个人中心功能的实现界面
管理员可以对密码、资料进行修改。个人中心功能的实现界面如下图5.12所示:
科普知识管理功能的实现界面
本功能包括对科普知识的添加、删除、修改、查询。添加科普知识时填写科普知识名称、简介等就可以完成,查询科普知识时填写查询条件即可以查询出来相对应的科普知识信息。添加科普知识信息功能的实现界面如下图5.13所示:
在线答题功能的实现
管理员可以设置答题信息,实现界面如下图5.16所示:
四、部分核心代码
package com.controller;
import java.text.SimpleDateFormat;
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.entity.KepuzhishiEntity;
import com.entity.view.KepuzhishiView;
import com.service.KepuzhishiService;
import com.service.TokenService;
import com.utils.PageUtils;
import com.utils.R;
import com.utils.MD5Util;
import com.utils.MPUtil;
import com.utils.CommonUtil;
import java.io.IOException;
import com.service.StoreupService;
import com.entity.StoreupEntity;
/**
* 科普知识
* 后端接口
* @author
* @email
* @date 2022-04-25 15:16:17
*/
@RestController
@RequestMapping("/kepuzhishi")
public class KepuzhishiController {
@Autowired
private KepuzhishiService kepuzhishiService;
@Autowired
private StoreupService storeupService;
/**
* 后端列表
*/
@RequestMapping("/page")
public R page(@RequestParam Map<String, Object> params,KepuzhishiEntity kepuzhishi,
HttpServletRequest request){
EntityWrapper<KepuzhishiEntity> ew = new EntityWrapper<KepuzhishiEntity>();
PageUtils page = kepuzhishiService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, kepuzhishi), params), params));
return R.ok().put("data", page);
}
/**
* 前端列表
*/
@IgnoreAuth
@RequestMapping("/list")
public R list(@RequestParam Map<String, Object> params,KepuzhishiEntity kepuzhishi,
HttpServletRequest request){
EntityWrapper<KepuzhishiEntity> ew = new EntityWrapper<KepuzhishiEntity>();
PageUtils page = kepuzhishiService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, kepuzhishi), params), params));
return R.ok().put("data", page);
}
/**
* 列表
*/
@RequestMapping("/lists")
public R list( KepuzhishiEntity kepuzhishi){
EntityWrapper<KepuzhishiEntity> ew = new EntityWrapper<KepuzhishiEntity>();
ew.allEq(MPUtil.allEQMapPre( kepuzhishi, "kepuzhishi"));
return R.ok().put("data", kepuzhishiService.selectListView(ew));
}
/**
* 查询
*/
@RequestMapping("/query")
public R query(KepuzhishiEntity kepuzhishi){
EntityWrapper< KepuzhishiEntity> ew = new EntityWrapper< KepuzhishiEntity>();
ew.allEq(MPUtil.allEQMapPre( kepuzhishi, "kepuzhishi"));
KepuzhishiView kepuzhishiView = kepuzhishiService.selectView(ew);
return R.ok("查询科普知识成功").put("data", kepuzhishiView);
}
/**
* 后端详情
*/
@RequestMapping("/info/{id}")
public R info(@PathVariable("id") Long id){
KepuzhishiEntity kepuzhishi = kepuzhishiService.selectById(id);
kepuzhishi.setClicknum(kepuzhishi.getClicknum()+1);
kepuzhishi.setClicktime(new Date());
kepuzhishiService.updateById(kepuzhishi);
return R.ok().put("data", kepuzhishi);
}
/**
* 前端详情
*/
@IgnoreAuth
@RequestMapping("/detail/{id}")
public R detail(@PathVariable("id") Long id){
KepuzhishiEntity kepuzhishi = kepuzhishiService.selectById(id);
kepuzhishi.setClicknum(kepuzhishi.getClicknum()+1);
kepuzhishi.setClicktime(new Date());
kepuzhishiService.updateById(kepuzhishi);
return R.ok().put("data", kepuzhishi);
}
/**
* 赞或踩
*/
@RequestMapping("/thumbsup/{id}")
public R vote(@PathVariable("id") String id,String type){
KepuzhishiEntity kepuzhishi = kepuzhishiService.selectById(id);
if(type.equals("1")) {
kepuzhishi.setThumbsupnum(kepuzhishi.getThumbsupnum()+1);
} else {
kepuzhishi.setCrazilynum(kepuzhishi.getCrazilynum()+1);
}
kepuzhishiService.updateById(kepuzhishi);
return R.ok("投票成功");
}
/**
* 后端保存
*/
@RequestMapping("/save")
public R save(@RequestBody KepuzhishiEntity kepuzhishi, HttpServletRequest request){
kepuzhishi.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
//ValidatorUtils.validateEntity(kepuzhishi);
kepuzhishiService.insert(kepuzhishi);
return R.ok();
}
/**
* 前端保存
*/
@RequestMapping("/add")
public R add(@RequestBody KepuzhishiEntity kepuzhishi, HttpServletRequest request){
kepuzhishi.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
//ValidatorUtils.validateEntity(kepuzhishi);
kepuzhishiService.insert(kepuzhishi);
return R.ok();
}
/**
* 修改
*/
@RequestMapping("/update")
@Transactional
public R update(@RequestBody KepuzhishiEntity kepuzhishi, HttpServletRequest request){
//ValidatorUtils.validateEntity(kepuzhishi);
kepuzhishiService.updateById(kepuzhishi);//全部更新
return R.ok();
}
/**
* 删除
*/
@RequestMapping("/delete")
public R delete(@RequestBody Long[] ids){
kepuzhishiService.deleteBatchIds(Arrays.asList(ids));
return R.ok();
}
/**
* 提醒接口
*/
@RequestMapping("/remind/{columnName}/{type}")
public R remindCount(@PathVariable("columnName") String columnName, HttpServletRequest request,
@PathVariable("type") String type,@RequestParam Map<String, Object> map) {
map.put("column", columnName);
map.put("type", type);
if(type.equals("2")) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Calendar c = Calendar.getInstance();
Date remindStartDate = null;
Date remindEndDate = null;
if(map.get("remindstart")!=null) {
Integer remindStart = Integer.parseInt(map.get("remindstart").toString());
c.setTime(new Date());
c.add(Calendar.DAY_OF_MONTH,remindStart);
remindStartDate = c.getTime();
map.put("remindstart", sdf.format(remindStartDate));
}
if(map.get("remindend")!=null) {
Integer remindEnd = Integer.parseInt(map.get("remindend").toString());
c.setTime(new Date());
c.add(Calendar.DAY_OF_MONTH,remindEnd);
remindEndDate = c.getTime();
map.put("remindend", sdf.format(remindEndDate));
}
}
Wrapper<KepuzhishiEntity> wrapper = new EntityWrapper<KepuzhishiEntity>();
if(map.get("remindstart")!=null) {
wrapper.ge(columnName, map.get("remindstart"));
}
if(map.get("remindend")!=null) {
wrapper.le(columnName, map.get("remindend"));
}
int count = kepuzhishiService.selectCount(wrapper);
return R.ok().put("count", count);
}
/**
* 前端智能排序
*/
@IgnoreAuth
@RequestMapping("/autoSort")
public R autoSort(@RequestParam Map<String, Object> params,KepuzhishiEntity kepuzhishi, HttpServletRequest request,String pre){
EntityWrapper<KepuzhishiEntity> ew = new EntityWrapper<KepuzhishiEntity>();
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 = kepuzhishiService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, kepuzhishi), params), params));
return R.ok().put("data", page);
}
/**
* 协同算法(按收藏推荐)
*/
@RequestMapping("/autoSort2")
public R autoSort2(@RequestParam Map<String, Object> params,KepuzhishiEntity kepuzhishi, HttpServletRequest request){
String userId = request.getSession().getAttribute("userId").toString();
String inteltypeColumn = "zhishifenlei";
List<StoreupEntity> storeups = storeupService.selectList(new EntityWrapper<StoreupEntity>().eq("type", 1).eq("userid", userId).eq("tablename", "kepuzhishi").orderBy("addtime", false));
List<String> inteltypes = new ArrayList<String>();
Integer limit = params.get("limit")==null?10:Integer.parseInt(params.get("limit").toString());
List<KepuzhishiEntity> kepuzhishiList = new ArrayList<KepuzhishiEntity>();
//去重
if(storeups!=null && storeups.size()>0) {
for(StoreupEntity s : storeups) {
kepuzhishiList.addAll(kepuzhishiService.selectList(new EntityWrapper<KepuzhishiEntity>().eq(inteltypeColumn, s.getInteltype())));
}
}
EntityWrapper<KepuzhishiEntity> ew = new EntityWrapper<KepuzhishiEntity>();
params.put("sort", "id");
params.put("order", "desc");
PageUtils page = kepuzhishiService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, kepuzhishi), params), params));
List<KepuzhishiEntity> pageList = (List<KepuzhishiEntity>)page.getList();
if(kepuzhishiList.size()<limit) {
int toAddNum = (limit-kepuzhishiList.size())<=pageList.size()?(limit-kepuzhishiList.size()):pageList.size();
for(KepuzhishiEntity o1 : pageList) {
boolean addFlag = true;
for(KepuzhishiEntity o2 : kepuzhishiList) {
if(o1.getId().intValue()==o2.getId().intValue()) {
addFlag = false;
break;
}
}
if(addFlag) {
kepuzhishiList.add(o1);
if(--toAddNum==0) break;
}
}
} else if(kepuzhishiList.size()>limit) {
kepuzhishiList = kepuzhishiList.subList(0, limit);
}
page.setList(kepuzhishiList);
return R.ok().put("data", page);
}
}
获取源码或论文
如需对应的论文或源码,以及其他定制需求,也可以下方微信联系我。