• SpringBoot+Vue项目篮球竞赛预约平台


    文末获取源码

    开发语言: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

    token表

    字段名称

    类型

    长度

    字段说明

    主键

    默认值

    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

    推荐类型

    系统功能的具体实现 

    前台功能模块

    篮球竞赛预约平台,用户进入到平台首页,可以查看首页,竞赛项目,平台公告,个人中心,后台管理等内容进行操作,如图

     

    用户注册

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

    竞赛项目

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

    平台公告

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

    个人中心

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

    后台功能模块

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

    管理员功能 

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

    用户管理

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

    项目分类管理

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

    竞赛项目管理

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

    赛事预约管理

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

    系统管理

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

    用户功能 

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

    个人中心

    在个人中心页面通过填写用户账号,用户姓名,性别,年龄,头像,用户手机,身高,体重等内容进行个人信息修改操作;如图 

    赛事预约管理

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

    部分核心代码: 

    1. /**
    2. * 竞赛项目评论表
    3. * 后端接口
    4. * @author
    5. * @email
    6. * @date 2022-03-12 10:22:35
    7. */
    8. @RestController
    9. @RequestMapping("/discussjingsaixiangmu")
    10. public class DiscussjingsaixiangmuController {
    11. @Autowired
    12. private DiscussjingsaixiangmuService discussjingsaixiangmuService;
    13. /**
    14. * 后端列表
    15. */
    16. @RequestMapping("/page")
    17. public R page(@RequestParam Map<String, Object> params,DiscussjingsaixiangmuEntity discussjingsaixiangmu,
    18. HttpServletRequest request){
    19. EntityWrapper<DiscussjingsaixiangmuEntity> ew = new EntityWrapper<DiscussjingsaixiangmuEntity>();
    20. PageUtils page = discussjingsaixiangmuService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, discussjingsaixiangmu), params), params));
    21. return R.ok().put("data", page);
    22. }
    23. /**
    24. * 前端列表
    25. */
    26. @IgnoreAuth
    27. @RequestMapping("/list")
    28. public R list(@RequestParam Map<String, Object> params,DiscussjingsaixiangmuEntity discussjingsaixiangmu,
    29. HttpServletRequest request){
    30. EntityWrapper<DiscussjingsaixiangmuEntity> ew = new EntityWrapper<DiscussjingsaixiangmuEntity>();
    31. PageUtils page = discussjingsaixiangmuService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, discussjingsaixiangmu), params), params));
    32. return R.ok().put("data", page);
    33. }
    34. /**
    35. * 列表
    36. */
    37. @RequestMapping("/lists")
    38. public R list( DiscussjingsaixiangmuEntity discussjingsaixiangmu){
    39. EntityWrapper<DiscussjingsaixiangmuEntity> ew = new EntityWrapper<DiscussjingsaixiangmuEntity>();
    40. ew.allEq(MPUtil.allEQMapPre( discussjingsaixiangmu, "discussjingsaixiangmu"));
    41. return R.ok().put("data", discussjingsaixiangmuService.selectListView(ew));
    42. }
    43. /**
    44. * 查询
    45. */
    46. @RequestMapping("/query")
    47. public R query(DiscussjingsaixiangmuEntity discussjingsaixiangmu){
    48. EntityWrapper< DiscussjingsaixiangmuEntity> ew = new EntityWrapper< DiscussjingsaixiangmuEntity>();
    49. ew.allEq(MPUtil.allEQMapPre( discussjingsaixiangmu, "discussjingsaixiangmu"));
    50. DiscussjingsaixiangmuView discussjingsaixiangmuView = discussjingsaixiangmuService.selectView(ew);
    51. return R.ok("查询竞赛项目评论表成功").put("data", discussjingsaixiangmuView);
    52. }
    53. /**
    54. * 后端详情
    55. */
    56. @RequestMapping("/info/{id}")
    57. public R info(@PathVariable("id") Long id){
    58. DiscussjingsaixiangmuEntity discussjingsaixiangmu = discussjingsaixiangmuService.selectById(id);
    59. return R.ok().put("data", discussjingsaixiangmu);
    60. }
    61. /**
    62. * 前端详情
    63. */
    64. @IgnoreAuth
    65. @RequestMapping("/detail/{id}")
    66. public R detail(@PathVariable("id") Long id){
    67. DiscussjingsaixiangmuEntity discussjingsaixiangmu = discussjingsaixiangmuService.selectById(id);
    68. return R.ok().put("data", discussjingsaixiangmu);
    69. }
    70. /**
    71. * 后端保存
    72. */
    73. @RequestMapping("/save")
    74. public R save(@RequestBody DiscussjingsaixiangmuEntity discussjingsaixiangmu, HttpServletRequest request){
    75. discussjingsaixiangmu.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
    76. //ValidatorUtils.validateEntity(discussjingsaixiangmu);
    77. discussjingsaixiangmuService.insert(discussjingsaixiangmu);
    78. return R.ok();
    79. }
    80. /**
    81. * 前端保存
    82. */
    83. @RequestMapping("/add")
    84. public R add(@RequestBody DiscussjingsaixiangmuEntity discussjingsaixiangmu, HttpServletRequest request){
    85. discussjingsaixiangmu.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
    86. //ValidatorUtils.validateEntity(discussjingsaixiangmu);
    87. discussjingsaixiangmuService.insert(discussjingsaixiangmu);
    88. return R.ok();
    89. }
    90. /**
    91. * 修改
    92. */
    93. @RequestMapping("/update")
    94. public R update(@RequestBody DiscussjingsaixiangmuEntity discussjingsaixiangmu, HttpServletRequest request){
    95. //ValidatorUtils.validateEntity(discussjingsaixiangmu);
    96. discussjingsaixiangmuService.updateById(discussjingsaixiangmu);//全部更新
    97. return R.ok();
    98. }
    99. /**
    100. * 删除
    101. */
    102. @RequestMapping("/delete")
    103. public R delete(@RequestBody Long[] ids){
    104. discussjingsaixiangmuService.deleteBatchIds(Arrays.asList(ids));
    105. return R.ok();
    106. }
    107. /**
    108. * 提醒接口
    109. */
    110. @RequestMapping("/remind/{columnName}/{type}")
    111. public R remindCount(@PathVariable("columnName") String columnName, HttpServletRequest request,
    112. @PathVariable("type") String type,@RequestParam Map<String, Object> map) {
    113. map.put("column", columnName);
    114. map.put("type", type);
    115. if(type.equals("2")) {
    116. SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
    117. Calendar c = Calendar.getInstance();
    118. Date remindStartDate = null;
    119. Date remindEndDate = null;
    120. if(map.get("remindstart")!=null) {
    121. Integer remindStart = Integer.parseInt(map.get("remindstart").toString());
    122. c.setTime(new Date());
    123. c.add(Calendar.DAY_OF_MONTH,remindStart);
    124. remindStartDate = c.getTime();
    125. map.put("remindstart", sdf.format(remindStartDate));
    126. }
    127. if(map.get("remindend")!=null) {
    128. Integer remindEnd = Integer.parseInt(map.get("remindend").toString());
    129. c.setTime(new Date());
    130. c.add(Calendar.DAY_OF_MONTH,remindEnd);
    131. remindEndDate = c.getTime();
    132. map.put("remindend", sdf.format(remindEndDate));
    133. }
    134. }
    135. Wrapper<DiscussjingsaixiangmuEntity> wrapper = new EntityWrapper<DiscussjingsaixiangmuEntity>();
    136. if(map.get("remindstart")!=null) {
    137. wrapper.ge(columnName, map.get("remindstart"));
    138. }
    139. if(map.get("remindend")!=null) {
    140. wrapper.le(columnName, map.get("remindend"));
    141. }
    142. int count = discussjingsaixiangmuService.selectCount(wrapper);
    143. return R.ok().put("count", count);
    144. }
    145. }
    1. /**
    2. * 赛事预约
    3. * 后端接口
    4. * @author
    5. * @email
    6. * @date 2022-03-12 10:22:35
    7. */
    8. @RestController
    9. @RequestMapping("/saishiyuyue")
    10. public class SaishiyuyueController {
    11. @Autowired
    12. private SaishiyuyueService saishiyuyueService;
    13. /**
    14. * 后端列表
    15. */
    16. @RequestMapping("/page")
    17. public R page(@RequestParam Map<String, Object> params,SaishiyuyueEntity saishiyuyue,
    18. HttpServletRequest request){
    19. String tableName = request.getSession().getAttribute("tableName").toString();
    20. if(tableName.equals("yonghu")) {
    21. saishiyuyue.setYonghuzhanghao((String)request.getSession().getAttribute("username"));
    22. }
    23. EntityWrapper<SaishiyuyueEntity> ew = new EntityWrapper<SaishiyuyueEntity>();
    24. PageUtils page = saishiyuyueService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, saishiyuyue), params), params));
    25. return R.ok().put("data", page);
    26. }
    27. /**
    28. * 前端列表
    29. */
    30. @IgnoreAuth
    31. @RequestMapping("/list")
    32. public R list(@RequestParam Map<String, Object> params,SaishiyuyueEntity saishiyuyue,
    33. HttpServletRequest request){
    34. EntityWrapper<SaishiyuyueEntity> ew = new EntityWrapper<SaishiyuyueEntity>();
    35. PageUtils page = saishiyuyueService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, saishiyuyue), params), params));
    36. return R.ok().put("data", page);
    37. }
    38. /**
    39. * 列表
    40. */
    41. @RequestMapping("/lists")
    42. public R list( SaishiyuyueEntity saishiyuyue){
    43. EntityWrapper<SaishiyuyueEntity> ew = new EntityWrapper<SaishiyuyueEntity>();
    44. ew.allEq(MPUtil.allEQMapPre( saishiyuyue, "saishiyuyue"));
    45. return R.ok().put("data", saishiyuyueService.selectListView(ew));
    46. }
    47. /**
    48. * 查询
    49. */
    50. @RequestMapping("/query")
    51. public R query(SaishiyuyueEntity saishiyuyue){
    52. EntityWrapper< SaishiyuyueEntity> ew = new EntityWrapper< SaishiyuyueEntity>();
    53. ew.allEq(MPUtil.allEQMapPre( saishiyuyue, "saishiyuyue"));
    54. SaishiyuyueView saishiyuyueView = saishiyuyueService.selectView(ew);
    55. return R.ok("查询赛事预约成功").put("data", saishiyuyueView);
    56. }
    57. /**
    58. * 后端详情
    59. */
    60. @RequestMapping("/info/{id}")
    61. public R info(@PathVariable("id") Long id){
    62. SaishiyuyueEntity saishiyuyue = saishiyuyueService.selectById(id);
    63. return R.ok().put("data", saishiyuyue);
    64. }
    65. /**
    66. * 前端详情
    67. */
    68. @IgnoreAuth
    69. @RequestMapping("/detail/{id}")
    70. public R detail(@PathVariable("id") Long id){
    71. SaishiyuyueEntity saishiyuyue = saishiyuyueService.selectById(id);
    72. return R.ok().put("data", saishiyuyue);
    73. }
    74. /**
    75. * 后端保存
    76. */
    77. @RequestMapping("/save")
    78. public R save(@RequestBody SaishiyuyueEntity saishiyuyue, HttpServletRequest request){
    79. saishiyuyue.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
    80. //ValidatorUtils.validateEntity(saishiyuyue);
    81. saishiyuyueService.insert(saishiyuyue);
    82. return R.ok();
    83. }
    84. /**
    85. * 前端保存
    86. */
    87. @RequestMapping("/add")
    88. public R add(@RequestBody SaishiyuyueEntity saishiyuyue, HttpServletRequest request){
    89. saishiyuyue.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
    90. //ValidatorUtils.validateEntity(saishiyuyue);
    91. saishiyuyueService.insert(saishiyuyue);
    92. return R.ok();
    93. }
    94. /**
    95. * 修改
    96. */
    97. @RequestMapping("/update")
    98. public R update(@RequestBody SaishiyuyueEntity saishiyuyue, HttpServletRequest request){
    99. //ValidatorUtils.validateEntity(saishiyuyue);
    100. saishiyuyueService.updateById(saishiyuyue);//全部更新
    101. return R.ok();
    102. }
    103. /**
    104. * 删除
    105. */
    106. @RequestMapping("/delete")
    107. public R delete(@RequestBody Long[] ids){
    108. saishiyuyueService.deleteBatchIds(Arrays.asList(ids));
    109. return R.ok();
    110. }
    111. /**
    112. * 提醒接口
    113. */
    114. @RequestMapping("/remind/{columnName}/{type}")
    115. public R remindCount(@PathVariable("columnName") String columnName, HttpServletRequest request,
    116. @PathVariable("type") String type,@RequestParam Map<String, Object> map) {
    117. map.put("column", columnName);
    118. map.put("type", type);
    119. if(type.equals("2")) {
    120. SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
    121. Calendar c = Calendar.getInstance();
    122. Date remindStartDate = null;
    123. Date remindEndDate = null;
    124. if(map.get("remindstart")!=null) {
    125. Integer remindStart = Integer.parseInt(map.get("remindstart").toString());
    126. c.setTime(new Date());
    127. c.add(Calendar.DAY_OF_MONTH,remindStart);
    128. remindStartDate = c.getTime();
    129. map.put("remindstart", sdf.format(remindStartDate));
    130. }
    131. if(map.get("remindend")!=null) {
    132. Integer remindEnd = Integer.parseInt(map.get("remindend").toString());
    133. c.setTime(new Date());
    134. c.add(Calendar.DAY_OF_MONTH,remindEnd);
    135. remindEndDate = c.getTime();
    136. map.put("remindend", sdf.format(remindEndDate));
    137. }
    138. }
    139. Wrapper<SaishiyuyueEntity> wrapper = new EntityWrapper<SaishiyuyueEntity>();
    140. if(map.get("remindstart")!=null) {
    141. wrapper.ge(columnName, map.get("remindstart"));
    142. }
    143. if(map.get("remindend")!=null) {
    144. wrapper.le(columnName, map.get("remindend"));
    145. }
    146. String tableName = request.getSession().getAttribute("tableName").toString();
    147. if(tableName.equals("yonghu")) {
    148. wrapper.eq("yonghuzhanghao", (String)request.getSession().getAttribute("username"));
    149. }
    150. int count = saishiyuyueService.selectCount(wrapper);
    151. return R.ok().put("count", count);
    152. }
    153. }
    1. /**
    2. * 通用接口
    3. */
    4. @RestController
    5. public class CommonController{
    6. @Autowired
    7. private CommonService commonService;
    8. private static AipFace client = null;
    9. @Autowired
    10. private ConfigService configService;
    11. /**
    12. * 获取table表中的column列表(联动接口)
    13. * @param table
    14. * @param column
    15. * @return
    16. */
    17. @IgnoreAuth
    18. @RequestMapping("/option/{tableName}/{columnName}")
    19. public R getOption(@PathVariable("tableName") String tableName, @PathVariable("columnName") String columnName,String level,String parent) {
    20. Map<String, Object> params = new HashMap<String, Object>();
    21. params.put("table", tableName);
    22. params.put("column", columnName);
    23. if(StringUtils.isNotBlank(level)) {
    24. params.put("level", level);
    25. }
    26. if(StringUtils.isNotBlank(parent)) {
    27. params.put("parent", parent);
    28. }
    29. List<String> data = commonService.getOption(params);
    30. return R.ok().put("data", data);
    31. }
    32. /**
    33. * 根据table中的column获取单条记录
    34. * @param table
    35. * @param column
    36. * @return
    37. */
    38. @IgnoreAuth
    39. @RequestMapping("/follow/{tableName}/{columnName}")
    40. public R getFollowByOption(@PathVariable("tableName") String tableName, @PathVariable("columnName") String columnName, @RequestParam String columnValue) {
    41. Map<String, Object> params = new HashMap<String, Object>();
    42. params.put("table", tableName);
    43. params.put("column", columnName);
    44. params.put("columnValue", columnValue);
    45. Map<String, Object> result = commonService.getFollowByOption(params);
    46. return R.ok().put("data", result);
    47. }
    48. /**
    49. * 修改table表的sfsh状态
    50. * @param table
    51. * @param map
    52. * @return
    53. */
    54. @RequestMapping("/sh/{tableName}")
    55. public R sh(@PathVariable("tableName") String tableName, @RequestBody Map<String, Object> map) {
    56. map.put("table", tableName);
    57. commonService.sh(map);
    58. return R.ok();
    59. }
    60. /**
    61. * 获取需要提醒的记录数
    62. * @param tableName
    63. * @param columnName
    64. * @param type 1:数字 2:日期
    65. * @param map
    66. * @return
    67. */
    68. @IgnoreAuth
    69. @RequestMapping("/remind/{tableName}/{columnName}/{type}")
    70. public R remindCount(@PathVariable("tableName") String tableName, @PathVariable("columnName") String columnName,
    71. @PathVariable("type") String type,@RequestParam Map<String, Object> map) {
    72. map.put("table", tableName);
    73. map.put("column", columnName);
    74. map.put("type", type);
    75. if(type.equals("2")) {
    76. SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
    77. Calendar c = Calendar.getInstance();
    78. Date remindStartDate = null;
    79. Date remindEndDate = null;
    80. if(map.get("remindstart")!=null) {
    81. Integer remindStart = Integer.parseInt(map.get("remindstart").toString());
    82. c.setTime(new Date());
    83. c.add(Calendar.DAY_OF_MONTH,remindStart);
    84. remindStartDate = c.getTime();
    85. map.put("remindstart", sdf.format(remindStartDate));
    86. }
    87. if(map.get("remindend")!=null) {
    88. Integer remindEnd = Integer.parseInt(map.get("remindend").toString());
    89. c.setTime(new Date());
    90. c.add(Calendar.DAY_OF_MONTH,remindEnd);
    91. remindEndDate = c.getTime();
    92. map.put("remindend", sdf.format(remindEndDate));
    93. }
    94. }
    95. int count = commonService.remindCount(map);
    96. return R.ok().put("count", count);
    97. }
    98. /**
    99. * 单列求和
    100. */
    101. @IgnoreAuth
    102. @RequestMapping("/cal/{tableName}/{columnName}")
    103. public R cal(@PathVariable("tableName") String tableName, @PathVariable("columnName") String columnName) {
    104. Map<String, Object> params = new HashMap<String, Object>();
    105. params.put("table", tableName);
    106. params.put("column", columnName);
    107. Map<String, Object> result = commonService.selectCal(params);
    108. return R.ok().put("data", result);
    109. }
    110. /**
    111. * 分组统计
    112. */
    113. @IgnoreAuth
    114. @RequestMapping("/group/{tableName}/{columnName}")
    115. public R group(@PathVariable("tableName") String tableName, @PathVariable("columnName") String columnName) {
    116. Map<String, Object> params = new HashMap<String, Object>();
    117. params.put("table", tableName);
    118. params.put("column", columnName);
    119. List<Map<String, Object>> result = commonService.selectGroup(params);
    120. SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
    121. for(Map<String, Object> m : result) {
    122. for(String k : m.keySet()) {
    123. if(m.get(k) instanceof Date) {
    124. m.put(k, sdf.format((Date)m.get(k)));
    125. }
    126. }
    127. }
    128. return R.ok().put("data", result);
    129. }
    130. /**
    131. * (按值统计)
    132. */
    133. @IgnoreAuth
    134. @RequestMapping("/value/{tableName}/{xColumnName}/{yColumnName}")
    135. public R value(@PathVariable("tableName") String tableName, @PathVariable("yColumnName") String yColumnName, @PathVariable("xColumnName") String xColumnName) {
    136. Map<String, Object> params = new HashMap<String, Object>();
    137. params.put("table", tableName);
    138. params.put("xColumn", xColumnName);
    139. params.put("yColumn", yColumnName);
    140. List<Map<String, Object>> result = commonService.selectValue(params);
    141. SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
    142. for(Map<String, Object> m : result) {
    143. for(String k : m.keySet()) {
    144. if(m.get(k) instanceof Date) {
    145. m.put(k, sdf.format((Date)m.get(k)));
    146. }
    147. }
    148. }
    149. return R.ok().put("data", result);
    150. }
    151. /**
    152. * (按值统计)时间统计类型
    153. */
    154. @IgnoreAuth
    155. @RequestMapping("/value/{tableName}/{xColumnName}/{yColumnName}/{timeStatType}")
    156. public R valueDay(@PathVariable("tableName") String tableName, @PathVariable("yColumnName") String yColumnName, @PathVariable("xColumnName") String xColumnName, @PathVariable("timeStatType") String timeStatType) {
    157. Map<String, Object> params = new HashMap<String, Object>();
    158. params.put("table", tableName);
    159. params.put("xColumn", xColumnName);
    160. params.put("yColumn", yColumnName);
    161. params.put("timeStatType", timeStatType);
    162. List<Map<String, Object>> result = commonService.selectTimeStatValue(params);
    163. SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
    164. for(Map<String, Object> m : result) {
    165. for(String k : m.keySet()) {
    166. if(m.get(k) instanceof Date) {
    167. m.put(k, sdf.format((Date)m.get(k)));
    168. }
    169. }
    170. }
    171. return R.ok().put("data", result);
    172. }
    173. /**
    174. * 人脸比对
    175. *
    176. * @param face1 人脸1
    177. * @param face2 人脸2
    178. * @return
    179. */
    180. @RequestMapping("/matchFace")
    181. @IgnoreAuth
    182. public R matchFace(String face1, String face2,HttpServletRequest request) {
    183. if(client==null) {
    184. /*String AppID = configService.selectOne(new EntityWrapper<ConfigEntity>().eq("name", "AppID")).getValue();*/
    185. String APIKey = configService.selectOne(new EntityWrapper<ConfigEntity>().eq("name", "APIKey")).getValue();
    186. String SecretKey = configService.selectOne(new EntityWrapper<ConfigEntity>().eq("name", "SecretKey")).getValue();
    187. String token = BaiduUtil.getAuth(APIKey, SecretKey);
    188. if(token==null) {
    189. return R.error("请在配置管理中正确配置APIKey和SecretKey");
    190. }
    191. client = new AipFace(null, APIKey, SecretKey);
    192. client.setConnectionTimeoutInMillis(2000);
    193. client.setSocketTimeoutInMillis(60000);
    194. }
    195. JSONObject res = null;
    196. try {
    197. File path = new File(ResourceUtils.getURL("classpath:static").getPath());
    198. if(!path.exists()) {
    199. path = new File("");
    200. }
    201. File upload = new File(path.getAbsolutePath(),"/upload/");
    202. File file1 = new File(upload.getAbsolutePath()+"/"+face1);
    203. File file2 = new File(upload.getAbsolutePath()+"/"+face2);
    204. String img1 = Base64Util.encode(FileUtil.FileToByte(file1));
    205. String img2 = Base64Util.encode(FileUtil.FileToByte(file2));
    206. MatchRequest req1 = new MatchRequest(img1, "BASE64");
    207. MatchRequest req2 = new MatchRequest(img2, "BASE64");
    208. ArrayList<MatchRequest> requests = new ArrayList<MatchRequest>();
    209. requests.add(req1);
    210. requests.add(req2);
    211. res = client.match(requests);
    212. System.out.println(res.get("result"));
    213. } catch (FileNotFoundException e) {
    214. e.printStackTrace();
    215. return R.error("文件不存在");
    216. } catch (IOException e) {
    217. e.printStackTrace();
    218. }
    219. return R.ok().put("data", com.alibaba.fastjson.JSONObject.parse(res.get("result").toString()));
    220. }
    221. }

  • 相关阅读:
    电脑办公中的函数包含哪些
    【SLAM论文阅读笔记】Multi-modal Semantic SLAM for Complex Dynamic Environments
    基于定容积法标准容器容积标定中的电动针阀自动化解决方案
    小程序点击更多上拉显示选项
    不定积分(原函数)存在性定理、定积分存在性定理、变限积分存在性定理
    1 论文笔记:Efficient Trajectory Similarity Computation with ContrastiveLearning
    springBoot打包踩得坑
    VR文化旅游虚拟现实介绍|虚拟现实产品销售
    R语言计算累积异常收益率的统计显著性
    全志V853如何动态打开蓝牙kernel部分的log?
  • 原文地址:https://blog.csdn.net/m0_49113107/article/details/125618666