/*
代码功能解释:
1. `CommonController` 类是一个处理通用接口的控制器,主要负责处理一些通用的逻辑操作,如位置查询、人脸比对、数据获取、统计等。
2. `location` 方法:通过经纬度获取对应的城市信息,利用百度地图API进行坐标到地址的转换。
3. `matchFace` 方法:进行人脸比对,通过百度AI人脸识别API比对两张人脸图片,并返回比对结果。
4. `getOption` 方法:根据表名和列名获取选项数据,用于实现前端页面的联动接口。
5. `getFollowByOption` 方法:根据表名和列名以及列值,获取对应的记录。
6. `sh` 方法:修改表中某字段的状态,通常用于开关状态的操作。
7. `remindCount` 方法:根据传入的参数,统计并返回需要提醒的记录数。
8. `group1` 方法:通过图表方式展示数据,具体展示方式根据请求参数决定。
9. `cal` 方法:对指定列进行求和操作。
10. `group` 方法:对指定列进行分组统计。
11. `value` 方法:按照指定的列进行值统计。
12. `newSelectGroupSum` 方法:查询字典表的分组求和,包括按日期、按字符串和按类型分组。
13. `newSelectGroupCount` 方法:查询字典表的分组统计总条数,包括按日期、按字符串和按类型分组。
14. `newSelectDateGroupSum` 方法:查询当前表或字典表的日期分组求和,包括按年、按月和按日分组。
15. `newSelectDateGroupCount` 方法:查询当前表或字典表的日期分组统计总条数,包括按年、按月和按日分组。
16. `barSum` 方法:通过柱状图展示数据,包括当前表和级联表的柱状图求和。
17. `barCount` 方法:通过柱状图展示数据,包括当前表和级联表的柱状图统计。
18. `IgnoreAuth` 注解:表示该接口不需要进行权限验证,可以直接访问。
*/
package com.controller;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.*;
import javax.servlet.http.HttpServletRequest;
import com.alibaba.fastjson.JSON;
import com.utils.StringUtil;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
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{
private static final Logger logger = LoggerFactory.getLogger(CommonController.class);
@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<ConfigEntity>().eq("name", "baidu_ditu_ak")).getValue();
if(BAIDU_DITU_AK==null) {
return R.error("请在配置管理中正确配置baidu_ditu_ak");
}
}
Map<String, String> 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, 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");
}
client = new AipFace(null, APIKey, SecretKey);
client.setConnectionTimeoutInMillis(2000);
client.setSocketTimeoutInMillis(60000);
}
JSONObject res = null;
try {
File file1 = new File(request.getSession().getServletContext().getRealPath("/upload")+"/"+face1);
File file2 = new File(request.getSession().getServletContext().getRealPath("/upload")+"/"+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<MatchRequest> requests = new ArrayList<MatchRequest>();
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列表(联动接口)
* @return
*/
@RequestMapping("/option/{tableName}/{columnName}")
@IgnoreAuth
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获取单条记录
* @return
*/
@RequestMapping("/follow/{tableName}/{columnName}")
@IgnoreAuth
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 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
*/
@RequestMapping("/remind/{tableName}/{columnName}/{type}")
@IgnoreAuth
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")) {
Simpl
没有合适的资源?快使用搜索试试~ 我知道了~
(源码)基于Java和JSP的选课管理系统.zip

共983个文件
js:241个
png:162个
gif:141个

1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 124 浏览量
2025-06-05
06:04:47
上传
评论
收藏 25.77MB ZIP 举报
温馨提示
# 基于Java和JSP的选课管理系统 ## 项目简介 本项目是一个基于JSP技术的选课管理系统,旨在满足学校或教育机构中用户选课、管理课程等需求,具有实用性和可操作性。系统使用Java语言开发,结合MySQL数据库管控数据资源信息。 ## 项目的主要特性和功能 1. 用户管理实现用户注册、登录、信息修改功能,系统包含管理员、教师及学生三种角色,各角色有不同权限 。 2. 课程管理可进行课程添加、编辑、删除等操作。 3. 选课管理支持学生选课、退课以及查看课程表。 4. 成绩管理能够实现成绩录入、查询、统计。 5. 系统配置可在config.properties文件配置数据库连接信息。 6. 图片上传支持图片上传,图片存放于指定路径,文件名不能含中文。 ## 安装使用步骤 1. 安装环境安装Java开发环境和MySQL数据库。 2. 解压放置源码解压已下载的源码文件,并将其放置在Web服务器的根目录下。
资源推荐
资源详情
资源评论



























收起资源包目录





































































































共 983 条
- 1
- 2
- 3
- 4
- 5
- 6
- 10
资源评论


t0_54manong
- 粉丝: 2126
上传资源 快速赚钱
我的内容管理 展开
我的资源 快来上传第一个资源
我的收益
登录查看自己的收益我的积分 登录查看自己的积分
我的C币 登录后查看C币余额
我的收藏
我的下载
下载帮助


最新资源
- excel电子表格模板批量自动化-任一部门季度销售数据深度分析工具.zip
- excel电子表格模板批量自动化-20.西安装修公司模拟参考报价 2016年.zip
- excel电子表格模板批量自动化-任一员工季度销售数据深度分析工具.zip
- excel电子表格模板批量自动化-年度销售报表3.zip
- excel电子表格模板批量自动化-【双11】双11活动表格集合(大客户部)-.zip
- excel电子表格模板批量自动化-【双11】双11活动表格集合(全店)-.zip
- excel电子表格模板批量自动化- 采购订单管理系统.zip
- excel电子表格模板批量自动化-超市统计表.zip
- excel电子表格模板批量自动化-案例-xx商管公司制度最终版.zip
- excel电子表格模板批量自动化-19.杭州装修公司模拟参考报价 2016年.zip
- excel电子表格模板批量自动化-5班组工作联系单.zip
- excel电子表格模板批量自动化-年度销售业绩分析表1.zip
- excel电子表格模板批量自动化-季度各产品销售数据查询工具.zip
- excel电子表格模板批量自动化-房产中介二手房销售管理系统.zip
- excel电子表格模板批量自动化-动态销量看板(模板).zip
- excel电子表格模板批量自动化-2015家装报价单明细表.zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈



安全验证
文档复制为VIP权益,开通VIP直接复制
