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 javax.servlet.http.HttpServletRequest;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
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.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;
private static AipFace client = null;
@Autowired
private ConfigService configService;
/**
* 获取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<String, Object> params = new HashMap<String, Object>();
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<String> 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<String, Object> params = new HashMap<String, Object>();
params.put("table", tableName);
params.put("column", columnName);
params.put("columnValue", columnValue);
Map<String, Object> 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<String, Object> 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<String, Object> 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<String, Object> params = new HashMap<String, Object>();
params.put("table", tableName);
params.put("column", columnName);
Map<String, Object> 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<String, Object> params = new HashMap<String, Object>();
params.put("table", tableName);
params.put("column", columnName);
List<Map<String, Object>> result = commonService.selectGroup(params);
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
for(Map<String, Object> 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);
}
/**
* (按值统计)
*/
@IgnoreAuth
@RequestMapping("/value/{tableName}/{xColumnName}/{yColumnName}")
public R value(@PathVariable("tableName") String tableName, @PathVariable("yColumnName") String yColumnName, @PathVariable("xColumnName") String xColumnName) {
Map<String, Object> params = new HashMap<String, Object>();
params.put("table", tableName);
params.put("xColumn", xColumnName);
params.put("yColumn", yColumnName);
List<Map<String, Object>> result = commonService.selectValue(params);
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
for(Map<String, Object> 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);
}
/**
* (按值统计)时间统计类型
*/
@IgnoreAuth
@RequestMapping("/value/{tableName}/{xColumnName}/{yColumnName}/{timeStatType}")
public R valueDay(@PathVariable("tableName") String tableName, @PathVariable("yColumnName") String yColumnName, @PathVariable("xColumnName") String xColumnName, @PathVariable("timeStatType") String timeStatType) {
Map<String, Object> params = new HashMap<String, Object>();
params.put("table", tableName);
params.put("xColumn", xColumnName);
params.put("yColumn", yColumnName);
params.put("timeStatType", timeStatType);
List<Map<String, Object>> result = commonService.selectTimeStatValue(params);
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
for(Map<String, Object> 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);
}
/**
* 人脸比对
*
* @param face1 人脸1
* @param face2 人脸2
* @return
*/
@RequestMapping("/matchFace")
@IgnoreAuth
public R matchFace(String face1, String face2,HttpServletRequest request) {
if(client==null) {
/*String AppID = configService.selectOne(new EntityWrapper<ConfigEntity>().eq("name", "AppID")).getValue();*/
String APIKey = configService.selectOne(new EntityWrapper<ConfigEntity>().eq("name", "APIKey")).getValue();
String SecretKey = configService.selectOne(new EntityWrapper<ConfigEntity>().eq("name", "SecretKey")).getValue();
String token = BaiduUtil.getAuth(APIKey, SecretKey);
if(token==null) {
return R.error("请在配置管理中正确配置APIKey和SecretKey");
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
功能说明: 本系统中涉及的各级权限分别是: (1)学生登录权限,可以实现首页、个人中心、实验室信息管理、实验课程管理、预约记录管理、实验成绩管理等功能。 (2)教师登录权限,可以实现首页、个人中心、实验室信息管理、实验课程管理、预约记录管理、实验成绩管理等功能。 (3)管理员权限,管理员有系统的所有权限,包括首页、个人中心、教师管理、学生管理、教师课表管理、实验室信息管理、实验课程管理、预约记录管理、实验成绩管理、设备信息管理、借用记录管理、归还记录管理、设备事务管理等功能。 环境说明: 开发语言:Java 框架:ssm,mybatis JDK版本:JDK1.8 数据库:mysql 5.7及以上 数据库工具:Navicat11及以上 开发软件:eclipse/idea Maven包:Maven3.3及以上 服务器:tomcat7及以上
资源推荐
资源详情
资源评论
收起资源包目录
【java毕业设计】实验室课程管理系统源码(ssm+mysql+说明文档+LW).zip (502个子文件)
update-password.vue.bak 3KB
IndexMain.vue.bak 2KB
IndexAsideStatic.vue.bak 2KB
BreadCrumbs.vue.bak 2KB
IndexHeader.vue.bak 2KB
3-build.bat 15B
2-run.bat 14B
1-install.bat 12B
.classpath 1KB
org.eclipse.wst.common.component 689B
org.eclipse.wst.jsdt.ui.superType.container 49B
app.66cf2275.css 267KB
bootstrap.css 143KB
bootstrap.min.css 118KB
chunk-vendors.a72b0961.css 37KB
canvas-bg-1.css 391B
canvas-bg-2.css 83B
canvas-bg-3.css 61B
glyphicons-halflings-regular.eot 20KB
.gitignore 10B
index.html 933B
index.html 562B
favicon.ico 4KB
favicon.ico 4KB
CommonController.java 9KB
XueshengController.java 9KB
JiaoshiController.java 9KB
ShiyankechengController.java 8KB
YuyuejiluController.java 8KB
ShiyanchengjiController.java 7KB
JiaoshikebiaoController.java 7KB
ShiyanshixinxiController.java 7KB
JieyongjiluController.java 7KB
ShebeixinxiController.java 7KB
ShebeishiwuController.java 7KB
GuihaijiluController.java 7KB
ShiyankechengEntity.java 5KB
UserController.java 5KB
MPUtil.java 5KB
YuyuejiluEntity.java 5KB
ShiyanchengjiEntity.java 5KB
ShebeixinxiEntity.java 4KB
ShiyankechengModel.java 4KB
ShiyanshixinxiEntity.java 4KB
ShiyankechengVO.java 4KB
JiaoshikebiaoEntity.java 4KB
ShebeishiwuEntity.java 4KB
YuyuejiluModel.java 4KB
JiaoshiEntity.java 4KB
BaiduUtil.java 4KB
YuyuejiluVO.java 4KB
ShiyanchengjiModel.java 4KB
ShiyanchengjiVO.java 3KB
JieyongjiluEntity.java 3KB
GuihaijiluEntity.java 3KB
ShebeixinxiModel.java 3KB
FileController.java 3KB
ConfigController.java 3KB
XueshengEntity.java 3KB
ShebeixinxiVO.java 3KB
AuthorizationInterceptor.java 3KB
ShiyanshixinxiModel.java 3KB
JiaoshikebiaoModel.java 3KB
ShebeishiwuModel.java 3KB
ShiyanshixinxiVO.java 3KB
Query.java 3KB
JiaoshikebiaoVO.java 3KB
ShebeishiwuVO.java 3KB
TokenServiceImpl.java 2KB
JiaoshiModel.java 2KB
JiaoshiVO.java 2KB
CommonUtil.java 2KB
TokenEntity.java 2KB
JieyongjiluModel.java 2KB
GuihaijiluModel.java 2KB
ShiyanshixinxiServiceImpl.java 2KB
JiaoshikebiaoServiceImpl.java 2KB
ShiyanchengjiServiceImpl.java 2KB
ShiyankechengServiceImpl.java 2KB
XueshengModel.java 2KB
JieyongjiluVO.java 2KB
PageUtils.java 2KB
JieyongjiluServiceImpl.java 2KB
ShebeishiwuServiceImpl.java 2KB
ShebeixinxiServiceImpl.java 2KB
GuihaijiluVO.java 2KB
GuihaijiluServiceImpl.java 2KB
YuyuejiluServiceImpl.java 2KB
XueshengVO.java 2KB
XueshengServiceImpl.java 2KB
JiaoshiServiceImpl.java 2KB
CommonServiceImpl.java 1KB
UserServiceImpl.java 1KB
UserEntity.java 1KB
SpringContextUtils.java 1KB
ValidatorUtils.java 1KB
ShiyanshixinxiService.java 1KB
ShiyanshixinxiDao.java 1KB
SQLFilter.java 1KB
ShiyankechengService.java 1KB
共 502 条
- 1
- 2
- 3
- 4
- 5
- 6
资源评论
风月歌
- 粉丝: 1644
- 资源: 3433
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功