文末获取源码
开发语言:Java
开发工具:IDEA /Eclipse
数据库:MYSQL5.7/8.0
应用服务:Tomcat7/Tomcat8
是否Maven项目:是
后端框架:SpringBoot
前端框架:vue+element等
JDK版本:jdk1.8
项目架构:B/S架构
通过这个系统能够满足篮球竞赛预约平台的管理及用户的篮球竞赛预约功能。系统的主要功能包括:首页,个人中心,用户管理,项目分类管理,竞赛项目管理,赛事预约管理,系统管理等功能。
管理员可以根据系统给定的账号进行登录,登录后可以进入篮球竞赛预约平台对篮球竞赛预约所有模块进行管理。包括查看和修改自己的个人信息以及登录密码。
该系统为每一个用户都分配了一个用户账号,用户通过账号的登录可以在系统中查看篮球竞赛预约信息及对个人信息进行修改等功能。
根据篮球竞赛预约平台的功能需求,进行系统设计。
前台功能:用户进入系统可以实现首页,竞赛项目,平台公告,个人中心,后台管理等功能进行操作;
后台由管理员和用户,主要功能包括首页,个人中心,用户管理,项目分类管理,竞赛项目管理,赛事预约管理,系统管理等功能;
系统对这些功能进行整合,产生的功能结构图如下:

在每一个系统中数据库有着非常重要的作用,数据库的设计得好将会增加系统的效率以及系统各逻辑功能的实现。所以数据库的设计我们要从系统的实际需要出发,才能使其更为完美的符合系统功能的实现
根据E-R图,设计每张表的变量名,变量的类型及主键等如下
| 字段名称 | 类型 | 长度 | 字段说明 | 主键 | 默认值 |
| id | bigint |
| 主键 | 主键 |
|
| addtime | timestamp |
| 创建时间 |
| CURRENT_TIMESTAMP |
| yonghuzhanghao | varchar | 200 | 用户账号 |
|
|
| mima | varchar | 200 | 密码 |
|
|
| yonghuxingming | varchar | 200 | 用户姓名 |
|
|
| xingbie | varchar | 200 | 性别 |
|
|
| nianling | varchar | 200 | 年龄 |
|
|
| touxiang | varchar | 200 | 头像 |
|
|
| yonghushouji | varchar | 200 | 用户手机 |
|
|
| shengao | varchar | 200 | 身高 |
|
|
| tizhong | varchar | 200 | 体重 |
|
|
| 字段名称 | 类型 | 长度 | 字段说明 | 主键 | 默认值 |
| id | bigint |
| 主键 | 主键 |
|
| addtime | timestamp |
| 创建时间 |
| CURRENT_TIMESTAMP |
| xiangmufenlei | varchar | 200 | 项目分类 |
|
|
| 字段名称 | 类型 | 长度 | 字段说明 | 主键 | 默认值 |
| id | bigint |
| 主键 | 主键 |
|
| username | varchar | 100 | 用户名 |
|
|
| password | varchar | 100 | 密码 |
|
|
| role | varchar | 100 | 角色 |
| 管理员 |
| addtime | timestamp |
| 新增时间 |
| CURRENT_TIMESTAMP |
| 字段名称 | 类型 | 长度 | 字段说明 | 主键 | 默认值 |
| id | bigint |
| 主键 | 主键 |
|
| userid | bigint |
| 用户id |
|
|
| username | varchar | 100 | 用户名 |
|
|
| tablename | varchar | 100 | 表名 |
|
|
| role | varchar | 100 | 角色 |
|
|
| token | varchar | 200 | 密码 |
|
|
| addtime | timestamp |
| 新增时间 |
| CURRENT_TIMESTAMP |
| expiratedtime | timestamp |
| 过期时间 |
| CURRENT_TIMESTAMP |
| 字段名称 | 类型 | 长度 | 字段说明 | 主键 | 默认值 |
| id | bigint |
| 主键 | 主键 |
|
| addtime | timestamp |
| 创建时间 |
| CURRENT_TIMESTAMP |
| userid | bigint |
| 用户id |
|
|
| refid | bigint |
| 收藏id |
|
|
| tablename | varchar | 200 | 表名 |
|
|
| name | varchar | 200 | 收藏名称 |
|
|
| picture | varchar | 200 | 收藏图片 |
|
|
| type | varchar | 200 | 类型(1:收藏,21:赞,22:踩) |
| 1 |
| inteltype | varchar | 200 | 推荐类型 |
|
|
篮球竞赛预约平台,用户进入到平台首页,可以查看首页,竞赛项目,平台公告,个人中心,后台管理等内容进行操作,如图

在用户注册页面中输入用户账号,密码,确认密码,用户姓名,年龄,用户手机,身高,体重等内容进行用户注册操作;如图

在竞赛项目页面中可以查看赛事名称,赛事编号,项目分类,比赛模式,赛事要求,比赛时间,比赛地点,比赛详情、封面等内容;并进行赛事预约,评论,收藏操作;如图

在平台公告页面中可以查看标题,图片、内容等内容,如图

在个人中心页面中输入用户账号,密码,用户姓名,性别,年龄,上传图片,用户手机,身高,体重等内容进行更新信息,并可以根据需要对我的收藏进行详细的操作管理,如图

后台用户登录,通过填写注册时输入的用户名、密码、选择角色等信息进行登录操作,如图

管理员登录进入篮球竞赛预约平台可以查看首页,个人中心,用户管理,项目分类管理,竞赛项目管理,赛事预约管理,系统管理等功能进行详细操作,如图

在用户管理页面中可以查看索引,用户账号,用户姓名,性别,年龄,头像,用户手机,身高,体重等内容,并进行详情,修改和删除等操作;如图

项目分类管理
在项目分类管理页面中可以查看索引,项目分类等内容,并进行修改和删除等操作;如图

在竞赛项目管理页面中可以查看索引,赛事编号,赛事名称,项目分类,比赛模式,比赛要求,比赛时间,封面,比赛地点等内容,并进行详情,修改和删除等操作;如图

在赛事预约管理页面中可以查看索引,赛事编号,赛事名称,项目分类,比赛模式,比赛地点,比赛时间,用户账号,用户姓名,性别,年龄,身高,体重,用户手机,预约时间,备注,审核回复,审核状态,审核等内容,并进行详情,查看评论,修改和删除等操作;如图

在平台公告页面中可以查看索引,标题,图片等内容,并进行详情,修改和删除等操作;还可对轮播图管理进行详细操作;如图

用户登录进入篮球竞赛预约平台可以查看首页,个人中心,赛事预约管理等功能进行详细操作,如图
个人中心在个人中心页面通过填写用户账号,用户姓名,性别,年龄,头像,用户手机,身高,体重等内容进行个人信息修改操作;如图

在赛事预约管理页面中可以查看索引,赛事编号,赛事名称,项目分类,比赛模式,比赛地点,比赛时间,用户账号,用户姓名,性别,年龄,身高,体重,用户手机,预约时间,备注,审核回复,审核状态等内容,并进行详情,删除等操作;如图

- /**
- * 竞赛项目评论表
- * 后端接口
- * @author
- * @email
- * @date 2022-03-12 10:22:35
- */
- @RestController
- @RequestMapping("/discussjingsaixiangmu")
- public class DiscussjingsaixiangmuController {
- @Autowired
- private DiscussjingsaixiangmuService discussjingsaixiangmuService;
-
-
-
-
-
- /**
- * 后端列表
- */
- @RequestMapping("/page")
- public R page(@RequestParam Map<String, Object> params,DiscussjingsaixiangmuEntity discussjingsaixiangmu,
- HttpServletRequest request){
- EntityWrapper<DiscussjingsaixiangmuEntity> ew = new EntityWrapper<DiscussjingsaixiangmuEntity>();
- PageUtils page = discussjingsaixiangmuService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, discussjingsaixiangmu), params), params));
-
- return R.ok().put("data", page);
- }
-
- /**
- * 前端列表
- */
- @IgnoreAuth
- @RequestMapping("/list")
- public R list(@RequestParam Map<String, Object> params,DiscussjingsaixiangmuEntity discussjingsaixiangmu,
- HttpServletRequest request){
- EntityWrapper<DiscussjingsaixiangmuEntity> ew = new EntityWrapper<DiscussjingsaixiangmuEntity>();
- PageUtils page = discussjingsaixiangmuService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, discussjingsaixiangmu), params), params));
- return R.ok().put("data", page);
- }
-
- /**
- * 列表
- */
- @RequestMapping("/lists")
- public R list( DiscussjingsaixiangmuEntity discussjingsaixiangmu){
- EntityWrapper<DiscussjingsaixiangmuEntity> ew = new EntityWrapper<DiscussjingsaixiangmuEntity>();
- ew.allEq(MPUtil.allEQMapPre( discussjingsaixiangmu, "discussjingsaixiangmu"));
- return R.ok().put("data", discussjingsaixiangmuService.selectListView(ew));
- }
-
- /**
- * 查询
- */
- @RequestMapping("/query")
- public R query(DiscussjingsaixiangmuEntity discussjingsaixiangmu){
- EntityWrapper< DiscussjingsaixiangmuEntity> ew = new EntityWrapper< DiscussjingsaixiangmuEntity>();
- ew.allEq(MPUtil.allEQMapPre( discussjingsaixiangmu, "discussjingsaixiangmu"));
- DiscussjingsaixiangmuView discussjingsaixiangmuView = discussjingsaixiangmuService.selectView(ew);
- return R.ok("查询竞赛项目评论表成功").put("data", discussjingsaixiangmuView);
- }
-
- /**
- * 后端详情
- */
- @RequestMapping("/info/{id}")
- public R info(@PathVariable("id") Long id){
- DiscussjingsaixiangmuEntity discussjingsaixiangmu = discussjingsaixiangmuService.selectById(id);
- return R.ok().put("data", discussjingsaixiangmu);
- }
-
- /**
- * 前端详情
- */
- @IgnoreAuth
- @RequestMapping("/detail/{id}")
- public R detail(@PathVariable("id") Long id){
- DiscussjingsaixiangmuEntity discussjingsaixiangmu = discussjingsaixiangmuService.selectById(id);
- return R.ok().put("data", discussjingsaixiangmu);
- }
-
-
-
-
- /**
- * 后端保存
- */
- @RequestMapping("/save")
- public R save(@RequestBody DiscussjingsaixiangmuEntity discussjingsaixiangmu, HttpServletRequest request){
- discussjingsaixiangmu.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
- //ValidatorUtils.validateEntity(discussjingsaixiangmu);
- discussjingsaixiangmuService.insert(discussjingsaixiangmu);
- return R.ok();
- }
-
- /**
- * 前端保存
- */
- @RequestMapping("/add")
- public R add(@RequestBody DiscussjingsaixiangmuEntity discussjingsaixiangmu, HttpServletRequest request){
- discussjingsaixiangmu.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
- //ValidatorUtils.validateEntity(discussjingsaixiangmu);
- discussjingsaixiangmuService.insert(discussjingsaixiangmu);
- return R.ok();
- }
-
- /**
- * 修改
- */
- @RequestMapping("/update")
- public R update(@RequestBody DiscussjingsaixiangmuEntity discussjingsaixiangmu, HttpServletRequest request){
- //ValidatorUtils.validateEntity(discussjingsaixiangmu);
- discussjingsaixiangmuService.updateById(discussjingsaixiangmu);//全部更新
- return R.ok();
- }
-
-
- /**
- * 删除
- */
- @RequestMapping("/delete")
- public R delete(@RequestBody Long[] ids){
- discussjingsaixiangmuService.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<DiscussjingsaixiangmuEntity> wrapper = new EntityWrapper<DiscussjingsaixiangmuEntity>();
- if(map.get("remindstart")!=null) {
- wrapper.ge(columnName, map.get("remindstart"));
- }
- if(map.get("remindend")!=null) {
- wrapper.le(columnName, map.get("remindend"));
- }
-
-
- int count = discussjingsaixiangmuService.selectCount(wrapper);
- return R.ok().put("count", count);
- }
-
-
-
-
-
-
-
-
- }
- /**
- * 赛事预约
- * 后端接口
- * @author
- * @email
- * @date 2022-03-12 10:22:35
- */
- @RestController
- @RequestMapping("/saishiyuyue")
- public class SaishiyuyueController {
- @Autowired
- private SaishiyuyueService saishiyuyueService;
-
-
-
-
-
- /**
- * 后端列表
- */
- @RequestMapping("/page")
- public R page(@RequestParam Map<String, Object> params,SaishiyuyueEntity saishiyuyue,
- HttpServletRequest request){
- String tableName = request.getSession().getAttribute("tableName").toString();
- if(tableName.equals("yonghu")) {
- saishiyuyue.setYonghuzhanghao((String)request.getSession().getAttribute("username"));
- }
- EntityWrapper<SaishiyuyueEntity> ew = new EntityWrapper<SaishiyuyueEntity>();
- PageUtils page = saishiyuyueService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, saishiyuyue), params), params));
-
- return R.ok().put("data", page);
- }
-
- /**
- * 前端列表
- */
- @IgnoreAuth
- @RequestMapping("/list")
- public R list(@RequestParam Map<String, Object> params,SaishiyuyueEntity saishiyuyue,
- HttpServletRequest request){
- EntityWrapper<SaishiyuyueEntity> ew = new EntityWrapper<SaishiyuyueEntity>();
- PageUtils page = saishiyuyueService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, saishiyuyue), params), params));
- return R.ok().put("data", page);
- }
-
- /**
- * 列表
- */
- @RequestMapping("/lists")
- public R list( SaishiyuyueEntity saishiyuyue){
- EntityWrapper<SaishiyuyueEntity> ew = new EntityWrapper<SaishiyuyueEntity>();
- ew.allEq(MPUtil.allEQMapPre( saishiyuyue, "saishiyuyue"));
- return R.ok().put("data", saishiyuyueService.selectListView(ew));
- }
-
- /**
- * 查询
- */
- @RequestMapping("/query")
- public R query(SaishiyuyueEntity saishiyuyue){
- EntityWrapper< SaishiyuyueEntity> ew = new EntityWrapper< SaishiyuyueEntity>();
- ew.allEq(MPUtil.allEQMapPre( saishiyuyue, "saishiyuyue"));
- SaishiyuyueView saishiyuyueView = saishiyuyueService.selectView(ew);
- return R.ok("查询赛事预约成功").put("data", saishiyuyueView);
- }
-
- /**
- * 后端详情
- */
- @RequestMapping("/info/{id}")
- public R info(@PathVariable("id") Long id){
- SaishiyuyueEntity saishiyuyue = saishiyuyueService.selectById(id);
- return R.ok().put("data", saishiyuyue);
- }
-
- /**
- * 前端详情
- */
- @IgnoreAuth
- @RequestMapping("/detail/{id}")
- public R detail(@PathVariable("id") Long id){
- SaishiyuyueEntity saishiyuyue = saishiyuyueService.selectById(id);
- return R.ok().put("data", saishiyuyue);
- }
-
-
-
-
- /**
- * 后端保存
- */
- @RequestMapping("/save")
- public R save(@RequestBody SaishiyuyueEntity saishiyuyue, HttpServletRequest request){
- saishiyuyue.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
- //ValidatorUtils.validateEntity(saishiyuyue);
- saishiyuyueService.insert(saishiyuyue);
- return R.ok();
- }
-
- /**
- * 前端保存
- */
- @RequestMapping("/add")
- public R add(@RequestBody SaishiyuyueEntity saishiyuyue, HttpServletRequest request){
- saishiyuyue.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
- //ValidatorUtils.validateEntity(saishiyuyue);
- saishiyuyueService.insert(saishiyuyue);
- return R.ok();
- }
-
- /**
- * 修改
- */
- @RequestMapping("/update")
- public R update(@RequestBody SaishiyuyueEntity saishiyuyue, HttpServletRequest request){
- //ValidatorUtils.validateEntity(saishiyuyue);
- saishiyuyueService.updateById(saishiyuyue);//全部更新
- return R.ok();
- }
-
-
- /**
- * 删除
- */
- @RequestMapping("/delete")
- public R delete(@RequestBody Long[] ids){
- saishiyuyueService.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<SaishiyuyueEntity> wrapper = new EntityWrapper<SaishiyuyueEntity>();
- if(map.get("remindstart")!=null) {
- wrapper.ge(columnName, map.get("remindstart"));
- }
- if(map.get("remindend")!=null) {
- wrapper.le(columnName, map.get("remindend"));
- }
-
- String tableName = request.getSession().getAttribute("tableName").toString();
- if(tableName.equals("yonghu")) {
- wrapper.eq("yonghuzhanghao", (String)request.getSession().getAttribute("username"));
- }
-
- int count = saishiyuyueService.selectCount(wrapper);
- return R.ok().put("count", count);
- }
-
-
-
-
-
-
-
-
- }
- /**
- * 通用接口
- */
- @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");
- }
- client = new AipFace(null, APIKey, SecretKey);
- client.setConnectionTimeoutInMillis(2000);
- client.setSocketTimeoutInMillis(60000);
- }
- JSONObject res = null;
- try {
- File path = new File(ResourceUtils.getURL("classpath:static").getPath());
- if(!path.exists()) {
- path = new File("");
- }
- File upload = new File(path.getAbsolutePath(),"/upload/");
- File file1 = new File(upload.getAbsolutePath()+"/"+face1);
- File file2 = new File(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<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()));
- }
- }