基于SpringBoot+Vue的校园博客系统设计与实现

博主介绍:  

大家好,我是一名在Java圈混迹十余年的程序员,精通Java编程语言,同时也熟练掌握微信小程序、Python和Android等技术,能够为大家提供全方位的技术支持和交流。
我擅长在JavaWeb、SSH、SSM、SpringBoot等框架下进行项目开发,具有丰富的项目经验和开发技能。我的代码风格规范、优美、易读性强,同时也注重性能优化、代码重构等方面的实践和经验总结。
我有丰富的成品Java毕设项目经验,能够为学生提供各类个性化的开题框架和实际运作方案。同时我也提供相关的学习资料、程序开发、技术解答、代码讲解、文档报告等专业服务。

文末获取源码联系

 精彩专栏推荐订阅 不然下次找不到哟

Java项目精品实战案例(300套)

校园博客系统源码下载地址:

https://download.csdn.net/download/weixin_54828627/87720039

一、效果演示

基于springboot+vue的校园博客系统演示视频

二、前言介绍

随着现在网络的快速发展,网上管理系统也逐渐快速发展起来,网上管理模式很快融入到了许多网站的之中,随之就产生了“校园博客系统”,这样就让校园博客系统更加方便简单。

对于本校园博客系统的设计来说,系统开发主要是采用java语言技术,在整个系统的设计中应用MySQL数据库来完成数据存储,具体根据校园博客系统的现状来进行开发的,具体根据现实的需求来实现校园博客系统网络化的管理,各类信息有序地进行存储,进入校园博客系统页面之后,方可开始操作主控界面,主要功能包括管理员:首页、个人中心博主管理、文章分类管理文章信息管理举报投诉管理系统管理,博主;首页、个人中心、文章信息管理举报投诉管理、我的收藏管理,前台首页;首页、文章信息、系统公告、个人中心、后台管理、在线客服等功能。

三、主要技术

技术名 作用
SpringBoot 后端框架
Vue 前端框架
MySQL 数据库

四、系统设计(部分)

4.1、主要功能模块设计         

主要实现功能包括管理员:首页、个人中心、博主管理、文章分类管理、文章信息管理、举报投诉管理、系统管理,博主;首页、个人中心、文章信息管理、举报投诉管理、我的收藏管理 

4.1.1、管理员模块

基于SpringBoot+Vue的校园博客系统设计与实现_第1张图片

4.1.2、 博主模块

基于SpringBoot+Vue的校园博客系统设计与实现_第2张图片

4.2、系统业务流程设计 

基于SpringBoot+Vue的校园博客系统设计与实现_第3张图片

五、功能截图

5.1、管理员登录

管理员登录,通过填写用户名、密码、角色等信息,输入完成后选择登录即可进入校园博客系统,如图5-1所示。

 图5-1管理员登录界面图

5.2、管理员功能实现             

5.2.1 博主管理

基于SpringBoot+Vue的校园博客系统设计与实现_第4张图片

图5-2博主管理界面图

5.2.2 文章分类管理

基于SpringBoot+Vue的校园博客系统设计与实现_第5张图片

图5-3文章分类管理界面图

5.2.3、轮播图管理

基于SpringBoot+Vue的校园博客系统设计与实现_第6张图片

图5-4轮播图管理界面图

5.2.4、系统公告

基于SpringBoot+Vue的校园博客系统设计与实现_第7张图片

图5-5系统公告界面图

5.2.5、文章信息管理

基于SpringBoot+Vue的校园博客系统设计与实现_第8张图片

图5-6文章信息管理界面图

5.2.6举报投诉管理

基于SpringBoot+Vue的校园博客系统设计与实现_第9张图片

图5-7举报投诉管理界面图

5.3、博主功能实现

校园博客系统,在系统可以查看首页、个人中心、文章信息管理、举报投诉管理、我的收藏管理等内容,如图5-8所示。

基于SpringBoot+Vue的校园博客系统设计与实现_第10张图片

5-8博主功能界面图

5.3.1举报投诉管理

基于SpringBoot+Vue的校园博客系统设计与实现_第11张图片

图5-9举报投诉管理界面图

5.3.2、我的收藏管理

基于SpringBoot+Vue的校园博客系统设计与实现_第12张图片

图5-10我的收藏管理界面图

5.4、前台首页功能实现

5.4.1、校园博客系统

基于SpringBoot+Vue的校园博客系统设计与实现_第13张图片

图5-11系统功能界面图

5.4.2、博主注册

图5-12博主注册界面图

5.4.3、博主登录

基于SpringBoot+Vue的校园博客系统设计与实现_第14张图片

图5-13博主登录界面图

5.4.4、个人中心

基于SpringBoot+Vue的校园博客系统设计与实现_第15张图片

图5-14个人中心界面图

5.4.5、文章信息

基于SpringBoot+Vue的校园博客系统设计与实现_第16张图片

图5-15文章信息界面图

六、库表设计(部分)

-- MySQL dump 10.13  Distrib 5.7.31, for Linux (x86_64)
--
-- Host: localhost    Database: springboot60zv5
-- ------------------------------------------------------
-- Server version	5.7.31

/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;

--
-- Table structure for table `bozhu`
--

DROP TABLE IF EXISTS `bozhu`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `bozhu` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
  `addtime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `bozhuzhanghao` varchar(200) NOT NULL COMMENT '博主账号',
  `mima` varchar(200) NOT NULL COMMENT '密码',
  `bozhuxingming` varchar(200) NOT NULL COMMENT '博主姓名',
  `touxiang` varchar(200) DEFAULT NULL COMMENT '头像',
  `xingbie` varchar(200) DEFAULT NULL COMMENT '性别',
  `nianling` int(11) DEFAULT NULL COMMENT '年龄',
  `shouji` varchar(200) DEFAULT NULL COMMENT '手机',
  `youxiang` varchar(200) DEFAULT NULL COMMENT '邮箱',
  PRIMARY KEY (`id`),
  UNIQUE KEY `bozhuzhanghao` (`bozhuzhanghao`)
) ENGINE=InnoDB AUTO_INCREMENT=1615810580607 DEFAULT CHARSET=utf8 COMMENT='博主';
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `bozhu`
--

LOCK TABLES `bozhu` WRITE;
/*!40000 ALTER TABLE `bozhu` DISABLE KEYS */;
INSERT INTO `bozhu` VALUES (11,'2021-03-15 11:55:17','博主1','123456','博主姓名1','http://localhost:8080/springboot60zv5/upload/bozhu_touxiang1.jpg','男',1,'13823888881','[email protected]'),(12,'2021-03-15 11:55:17','博主2','123456','博主姓名2','http://localhost:8080/springboot60zv5/upload/bozhu_touxiang2.jpg','男',2,'13823888882','[email protected]'),(13,'2021-03-15 11:55:17','博主3','123456','博主姓名3','http://localhost:8080/springboot60zv5/upload/bozhu_touxiang3.jpg','男',3,'13823888883','[email protected]'),(14,'2021-03-15 11:55:17','博主4','123456','博主姓名4','http://localhost:8080/springboot60zv5/upload/bozhu_touxiang4.jpg','男',4,'13823888884','[email protected]'),(15,'2021-03-15 11:55:17','博主5','123456','博主姓名5','http://localhost:8080/springboot60zv5/upload/bozhu_touxiang5.jpg','男',5,'13823888885','[email protected]'),(16,'2021-03-15 11:55:17','博主6','123456','博主姓名6','http://localhost:8080/springboot60zv5/upload/bozhu_touxiang6.jpg','男',6,'13823888886','[email protected]'),(1615810391925,'2021-03-15 12:13:11','1','1','陈一','http://localhost:8080/springboot60zv5/upload/1615810405246.jpg','女',22,'12345678978','[email protected]'),(1615810580606,'2021-03-15 12:16:20','2','2','王明','http://localhost:8080/springboot60zv5/upload/1615810595054.jpg','男',25,'12345645612','[email protected]');
/*!40000 ALTER TABLE `bozhu` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `chat`
--

DROP TABLE IF EXISTS `chat`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `chat` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
  `addtime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `userid` bigint(20) NOT NULL COMMENT '用户id',
  `adminid` bigint(20) DEFAULT NULL COMMENT '管理员id',
  `ask` longtext COMMENT '提问',
  `reply` longtext COMMENT '回复',
  `isreply` int(11) DEFAULT NULL COMMENT '是否回复',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1615810724029 DEFAULT CHARSET=utf8 COMMENT='在线客服';
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `chat`
--

LOCK TABLES `chat` WRITE;
/*!40000 ALTER TABLE `chat` DISABLE KEYS */;
INSERT INTO `chat` VALUES (51,'2021-03-15 11:55:17',1,1,'提问1','回复1',1),(52,'2021-03-15 11:55:17',2,2,'提问2','回复2',2),(53,'2021-03-15 11:55:17',3,3,'提问3','回复3',3),(54,'2021-03-15 11:55:17',4,4,'提问4','回复4',4),(55,'2021-03-15 11:55:17',5,5,'提问5','回复5',5),(56,'2021-03-15 11:55:17',6,6,'提问6','回复6',6),(1615810114904,'2021-03-15 12:08:34',1615809946983,NULL,'可以与管理员进行实时聊天沟通',NULL,0),(1615810158625,'2021-03-15 12:09:18',1615809946983,1,NULL,'1',NULL),(1615810685689,'2021-03-15 12:18:05',1615810580606,NULL,'可以与管理员进行实时沟通',NULL,0),(1615810724028,'2021-03-15 12:18:44',1615810580606,1,NULL,'1',NULL);
/*!40000 ALTER TABLE `chat` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `config`
--

DROP TABLE IF EXISTS `config`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `config` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
  `name` varchar(100) NOT NULL COMMENT '配置参数名称',
  `value` varchar(100) DEFAULT NULL COMMENT '配置参数值',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8 COMMENT='配置文件';
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `config`
--

LOCK TABLES `config` WRITE;
/*!40000 ALTER TABLE `config` DISABLE KEYS */;
INSERT INTO `config` VALUES (1,'picture1','http://localhost:8080/springboot60zv5/upload/1615809593916.jpg'),(2,'picture2','http://localhost:8080/springboot60zv5/upload/1615810325069.jpg'),(3,'picture3','http://localhost:8080/springboot60zv5/upload/picture3.jpg'),(6,'homepage',NULL);
/*!40000 ALTER TABLE `config` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `discusswenzhangxinxi`
--

DROP TABLE IF EXISTS `discusswenzhangxinxi`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `discusswenzhangxinxi` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
  `addtime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `refid` bigint(20) NOT NULL COMMENT '关联表id',
  `userid` bigint(20) NOT NULL COMMENT '用户id',
  `nickname` varchar(200) DEFAULT NULL COMMENT '用户名',
  `content` longtext NOT NULL COMMENT '评论内容',
  `reply` longtext COMMENT '回复内容',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1615810665573 DEFAULT CHARSET=utf8 COMMENT='文章信息评论表';
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `discusswenzhangxinxi`
--

LOCK TABLES `discusswenzhangxinxi` WRITE;
/*!40000 ALTER TABLE `discusswenzhangxinxi` DISABLE KEYS */;
INSERT INTO `discusswenzhangxinxi` VALUES (81,'2021-03-15 11:55:17',1,1,'用户名1','评论内容1','回复内容1'),(82,'2021-03-15 11:55:17',2,2,'用户名2','评论内容2','回复内容2'),(83,'2021-03-15 11:55:17',3,3,'用户名3','评论内容3','回复内容3'),(84,'2021-03-15 11:55:17',4,4,'用户名4','评论内容4','回复内容4'),(85,'2021-03-15 11:55:17',5,5,'用户名5','评论内容5','回复内容5'),(86,'2021-03-15 11:55:17',6,6,'用户名6','评论内容6','回复内容6'),(1615810093599,'2021-03-15 12:08:12',1615809871262,1615809946983,'2','感情真挚,很不错的文章','多谢捧场'),(1615810665572,'2021-03-15 12:17:45',1615810493025,1615810580606,'2','写得不错,情感真挚流露','多谢捧场');
/*!40000 ALTER TABLE `discusswenzhangxinxi` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `jubaotousu`
--

DROP TABLE IF EXISTS `jubaotousu`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `jubaotousu` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
  `addtime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `biaoti` varchar(200) NOT NULL COMMENT '标题',
  `leixing` varchar(200) NOT NULL COMMENT '类型',
  `tupian` varchar(200) DEFAULT NULL COMMENT '图片',
  `jubaoneirong` longtext NOT NULL COMMENT '举报内容',
  `jubaoshijian` date DEFAULT NULL COMMENT '举报时间',
  `bozhuzhanghao` varchar(200) DEFAULT NULL COMMENT '博主账号',
  `shouji` varchar(200) DEFAULT NULL COMMENT '手机',
  `sfsh` varchar(200) DEFAULT '否' COMMENT '是否审核',
  `shhf` longtext COMMENT '审核回复',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1615810544100 DEFAULT CHARSET=utf8 COMMENT='举报投诉';
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `jubaotousu`
--

LOCK TABLES `jubaotousu` WRITE;
/*!40000 ALTER TABLE `jubaotousu` DISABLE KEYS */;
INSERT INTO `jubaotousu` VALUES (41,'2021-03-15 11:55:17','标题1','类型1','http://localhost:8080/springboot60zv5/upload/jubaotousu_tupian1.jpg','举报内容1','2021-03-15','博主账号1','手机1','是',''),(42,'2021-03-15 11:55:17','标题2','类型2','http://localhost:8080/springboot60zv5/upload/1615809561966.jpg','举报内容2','2021-03-15','博主账号2','手机2','是',''),(43,'2021-03-15 11:55:17','标题3','类型3','http://localhost:8080/springboot60zv5/upload/jubaotousu_tupian3.jpg','举报内容3','2021-03-15','博主账号3','手机3','是',''),(44,'2021-03-15 11:55:17','标题4','类型4','http://localhost:8080/springboot60zv5/upload/jubaotousu_tupian4.jpg','举报内容4','2021-03-15','博主账号4','手机4','是',''),(45,'2021-03-15 11:55:17','标题5','类型5','http://localhost:8080/springboot60zv5/upload/jubaotousu_tupian5.jpg','举报内容5','2021-03-15','博主账号5','手机5','是',''),(46,'2021-03-15 11:55:17','标题6','类型6','http://localhost:8080/springboot60zv5/upload/1615809576579.jpg','举报内容6','2021-03-15','博主账号6','手机6','是',''),(1615810544099,'2021-03-15 12:15:43','举报违规内容','不良言论','http://localhost:8080/springboot60zv5/upload/1615810518881.jpg','博主账号为UFGRD的博主发布不良言论的博客文章','2021-03-15','1','12345678978','是','ok');
/*!40000 ALTER TABLE `jubaotousu` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `news`
--

DROP TABLE IF EXISTS `news`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `news` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
  `addtime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `title` varchar(200) NOT NULL COMMENT '标题',
  `introduction` longtext COMMENT '简介',
  `picture` varchar(200) NOT NULL COMMENT '图片',
  `content` longtext NOT NULL COMMENT '内容',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1615810366418 DEFAULT CHARSET=utf8 COMMENT='系统公告';
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `news`
--

LOCK TABLES `news` WRITE;
/*!40000 ALTER TABLE `news` DISABLE KEYS */;
INSERT INTO `news` VALUES (71,'2021-03-15 11:55:17','标题1','简介1','http://localhost:8080/springboot60zv5/upload/news_picture1.jpg','内容1'),(72,'2021-03-15 11:55:17','标题2','简介2','http://localhost:8080/springboot60zv5/upload/news_picture2.jpg','内容2'),(73,'2021-03-15 11:55:17','标题3','简介3','http://localhost:8080/springboot60zv5/upload/1615809620404.jpg','

内容3

'),(74,'2021-03-15 11:55:17','标题4','简介4','http://localhost:8080/springboot60zv5/upload/1615809629841.jpg','

内容4

'),(75,'2021-03-15 11:55:17','标题5','简介5','http://localhost:8080/springboot60zv5/upload/news_picture5.jpg','内容5'),(76,'2021-03-15 11:55:17','标题6','简介6','http://localhost:8080/springboot60zv5/upload/1615809640209.jpg','

内容6

'),(1615810366417,'2021-03-15 12:12:45','关于校园博客规范使用通知','规范使用博客','http://localhost:8080/springboot60zv5/upload/1615810344631.jpg','

不得发布不良言论的博客文章

'); /*!40000 ALTER TABLE `news` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `storeup` -- DROP TABLE IF EXISTS `storeup`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `storeup` ( `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键', `addtime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', `userid` bigint(20) NOT NULL COMMENT '用户id', `refid` bigint(20) DEFAULT NULL COMMENT '收藏id', `tablename` varchar(200) DEFAULT NULL COMMENT '表名', `name` varchar(200) NOT NULL COMMENT '收藏名称', `picture` varchar(200) NOT NULL COMMENT '收藏图片', PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=1615810646850 DEFAULT CHARSET=utf8 COMMENT='收藏表'; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `storeup` -- LOCK TABLES `storeup` WRITE; /*!40000 ALTER TABLE `storeup` DISABLE KEYS */; INSERT INTO `storeup` VALUES (1615810646849,'2021-03-15 12:17:26',1615810580606,1615810493025,'wenzhangxinxi','关于一个电影的日记','http://localhost:8080/springboot60zv5/upload/1615810470786.jpg'); /*!40000 ALTER TABLE `storeup` ENABLE KEYS */; UNLOCK TABLES;

七、代码参考

package com.controller;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.apache.commons.lang3.StringUtils;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.ResourceUtils;
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.annotation.IgnoreAuth;
import com.baidu.aip.face.AipFace;
import com.baidu.aip.face.MatchRequest;
import com.baidu.aip.util.Base64Util;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.entity.ConfigEntity;
import com.service.CommonService;
import com.service.ConfigService;
import com.utils.BaiduUtil;
import com.utils.FileUtil;
import com.utils.R;

/**
 * 通用接口
 */
@RestController
public class CommonController{
	@Autowired
	private CommonService commonService;
	
	@Autowired
	private ConfigService configService;
	
	private static AipFace client = null;
	
	private static String BAIDU_DITU_AK = null;
	
	@RequestMapping("/location")
	public R location(String lng,String lat) {
		if(BAIDU_DITU_AK==null) {
			BAIDU_DITU_AK = configService.selectOne(new EntityWrapper().eq("name", "baidu_ditu_ak")).getValue();
			if(BAIDU_DITU_AK==null) {
				return R.error("请在配置管理中正确配置baidu_ditu_ak");
			}
		}
		Map map = BaiduUtil.getCityByLonLat(BAIDU_DITU_AK, lng, lat);
		return R.ok().put("data", map);
	}
	
	/**
	 * 人脸比对
	 * 
	 * @param face1 人脸1
	 * @param face2 人脸2
	 * @return
	 */
	@RequestMapping("/matchFace")
	public R matchFace(String face1, String face2) {
		if(client==null) {
			/*String AppID = configService.selectOne(new EntityWrapper().eq("name", "AppID")).getValue();*/
			String APIKey = configService.selectOne(new EntityWrapper().eq("name", "APIKey")).getValue();
			String SecretKey = configService.selectOne(new EntityWrapper().eq("name", "SecretKey")).getValue();
			String token = BaiduUtil.getAuth(APIKey, SecretKey);
			if(token==null) {
				return R.error("请在配置管理中正确配置APIKey和SecretKey");
			}
			client = new AipFace(null, APIKey, SecretKey);
			client.setConnectionTimeoutInMillis(2000);
			client.setSocketTimeoutInMillis(60000);
		}
		JSONObject res = null;
		try {
			File file1 = new File(ResourceUtils.getFile("classpath:static/upload").getAbsolutePath()+"/"+face1);
			File file2 = new File(ResourceUtils.getFile("classpath:static/upload").getAbsolutePath()+"/"+face2);
			String img1 = Base64Util.encode(FileUtil.FileToByte(file1));
			String img2 = Base64Util.encode(FileUtil.FileToByte(file2));
			MatchRequest req1 = new MatchRequest(img1, "BASE64");
			MatchRequest req2 = new MatchRequest(img2, "BASE64");
			ArrayList requests = new ArrayList();
			requests.add(req1);
			requests.add(req2);
			res = client.match(requests);
			System.out.println(res.get("result"));
		} catch (FileNotFoundException e) {
			e.printStackTrace();
			return R.error("文件不存在");
		} catch (IOException e) {
			e.printStackTrace();
		} 
		return R.ok().put("data", com.alibaba.fastjson.JSONObject.parse(res.get("result").toString()));
	}
    
	/**
	 * 获取table表中的column列表(联动接口)
	 * @param table
	 * @param column
	 * @return
	 */
	@IgnoreAuth
	@RequestMapping("/option/{tableName}/{columnName}")
	public R getOption(@PathVariable("tableName") String tableName, @PathVariable("columnName") String columnName,String level,String parent) {
		Map params = new HashMap();
		params.put("table", tableName);
		params.put("column", columnName);
		if(StringUtils.isNotBlank(level)) {
			params.put("level", level);
		}
		if(StringUtils.isNotBlank(parent)) {
			params.put("parent", parent);
		}
		List data = commonService.getOption(params);
		return R.ok().put("data", data);
	}
	
	/**
	 * 根据table中的column获取单条记录
	 * @param table
	 * @param column
	 * @return
	 */
	@IgnoreAuth
	@RequestMapping("/follow/{tableName}/{columnName}")
	public R getFollowByOption(@PathVariable("tableName") String tableName, @PathVariable("columnName") String columnName, @RequestParam String columnValue) {
		Map params = new HashMap();
		params.put("table", tableName);
		params.put("column", columnName);
		params.put("columnValue", columnValue);
		Map result = commonService.getFollowByOption(params);
		return R.ok().put("data", result);
	}
	
	/**
	 * 修改table表的sfsh状态
	 * @param table
	 * @param map
	 * @return
	 */
	@RequestMapping("/sh/{tableName}")
	public R sh(@PathVariable("tableName") String tableName, @RequestBody Map map) {
		map.put("table", tableName);
		commonService.sh(map);
		return R.ok();
	}
	
	/**
	 * 获取需要提醒的记录数
	 * @param tableName
	 * @param columnName
	 * @param type 1:数字 2:日期
	 * @param map
	 * @return
	 */
	@IgnoreAuth
	@RequestMapping("/remind/{tableName}/{columnName}/{type}")
	public R remindCount(@PathVariable("tableName") String tableName, @PathVariable("columnName") String columnName, 
						 @PathVariable("type") String type,@RequestParam Map map) {
		map.put("table", tableName);
		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));
			}
		}
		
		int count = commonService.remindCount(map);
		return R.ok().put("count", count);
	}
	
	/**
	 * 单列求和
	 */
	@IgnoreAuth
	@RequestMapping("/cal/{tableName}/{columnName}")
	public R cal(@PathVariable("tableName") String tableName, @PathVariable("columnName") String columnName) {
		Map params = new HashMap();
		params.put("table", tableName);
		params.put("column", columnName);
		Map result = commonService.selectCal(params);
		return R.ok().put("data", result);
	}
	
	/**
	 * 分组统计
	 */
	@IgnoreAuth
	@RequestMapping("/group/{tableName}/{columnName}")
	public R group(@PathVariable("tableName") String tableName, @PathVariable("columnName") String columnName) {
		Map params = new HashMap();
		params.put("table", tableName);
		params.put("column", columnName);
		List> result = commonService.selectGroup(params);
		return R.ok().put("data", result);
	}
	
	/**
	 * (按值统计)
	 */
	@IgnoreAuth
	@RequestMapping("/value/{tableName}/{xColumnName}/{yColumnName}")
	public R value(@PathVariable("tableName") String tableName, @PathVariable("yColumnName") String yColumnName, @PathVariable("xColumnName") String xColumnName) {
		Map params = new HashMap();
		params.put("table", tableName);
		params.put("xColumn", xColumnName);
		params.put("yColumn", yColumnName);
		List> result = commonService.selectValue(params);
		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
		for(Map m : result) {
			for(String k : m.keySet()) {
				if(m.get(k) instanceof Date) {
					m.put(k, sdf.format((Date)m.get(k)));
				}
			}
		}
		return R.ok().put("data", result);
	}
	
}

八、技术交流

大家点赞、收藏、关注、评论啦 、查看文章结尾获取联系方式

精彩专栏推荐订阅下方专栏

Java项目精品实战案例(300套)

​​​​

你可能感兴趣的:(java精品项目,spring,boot,vue.js,java,大学生项目实战,mysql数据库,校园博客系统,博客管理系统)