diff --git a/.idea/.gitignore b/.idea/.gitignore
new file mode 100644
index 0000000..acd22a3
--- /dev/null
+++ b/.idea/.gitignore
@@ -0,0 +1,8 @@
+# 默认忽略的文件
+/shelf/
+/workspace.xml
+# 数据源本地存储已忽略文件
+/../../../../../../:\Users\33424\Desktop\jianshenfanggl没有注释\.idea/dataSources/
+/dataSources.local.xml
+# 基于编辑器的 HTTP 客户端请求
+/httpRequests/
diff --git a/.idea/.name b/.idea/.name
new file mode 100644
index 0000000..656cf71
--- /dev/null
+++ b/.idea/.name
@@ -0,0 +1 @@
+jianshenfanggl
\ No newline at end of file
diff --git a/.idea/compiler.xml b/.idea/compiler.xml
new file mode 100644
index 0000000..54f6a93
--- /dev/null
+++ b/.idea/compiler.xml
@@ -0,0 +1,18 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/encodings.xml b/.idea/encodings.xml
new file mode 100644
index 0000000..63e9001
--- /dev/null
+++ b/.idea/encodings.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/jarRepositories.xml b/.idea/jarRepositories.xml
new file mode 100644
index 0000000..712ab9d
--- /dev/null
+++ b/.idea/jarRepositories.xml
@@ -0,0 +1,20 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
new file mode 100644
index 0000000..b784bbc
--- /dev/null
+++ b/.idea/misc.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
new file mode 100644
index 0000000..74ce3a4
--- /dev/null
+++ b/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 0000000..a933e05
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/gym b/gym
new file mode 160000
index 0000000..efe5258
--- /dev/null
+++ b/gym
@@ -0,0 +1 @@
+Subproject commit efe5258eda99ba1aac5fb7fffdc2414d5412705d
diff --git a/jianshenfanggl.iml b/jianshenfanggl.iml
new file mode 100644
index 0000000..1daccae
--- /dev/null
+++ b/jianshenfanggl.iml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
new file mode 100644
index 0000000..c2152f6
--- /dev/null
+++ b/pom.xml
@@ -0,0 +1,187 @@
+
+
+ 4.0.0
+
+ org.springframework.boot
+ spring-boot-starter-parent
+ 2.2.2.RELEASE
+
+
+ com.jlwl
+
+ jianshenfanggl
+ 0.0.1-SNAPSHOT
+ jianshenfanggl
+ 健身房管理系统
+
+
+ 1.8
+ 1.2.8
+ 3.1.1
+
+
+
+
+ org.springframework.boot
+ spring-boot-starter-web
+
+
+ org.mybatis.spring.boot
+ mybatis-spring-boot-starter
+ 2.1.1
+
+
+ org.springframework.boot
+ spring-boot-starter-jdbc
+
+
+
+
+ org.springframework.boot
+ spring-boot-starter-thymeleaf
+
+
+
+
+ org.springframework.boot
+ spring-boot-devtools
+ runtime
+ true
+
+
+
+ mysql
+ mysql-connector-java
+
+
+ org.apache.shiro
+ shiro-spring
+ 1.3.2
+
+
+
+ com.baomidou
+ mybatis-plus
+ 2.3
+
+
+ com.baomidou
+ mybatisplus-spring-boot-starter
+ 1.0.5
+
+
+ com.google.protobuf
+ protobuf-java
+ 3.10.0
+
+
+
+ org.apache.commons
+ commons-lang3
+ 3.0
+
+
+
+ javax.validation
+ validation-api
+ 2.0.1.Final
+
+
+
+ commons-io
+ commons-io
+ 2.5
+
+
+
+
+ cn.hutool
+ hutool-all
+ 4.0.12
+
+
+
+
+ com.alibaba
+ fastjson
+ ${fastjson.version}
+
+
+
+
+
+ com.baidu.aip
+ java-sdk
+ 4.4.1
+
+
+
+
+ commons-io
+ commons-io
+ 2.2
+
+
+ org.apache.poi
+ poi-examples
+ 3.9
+
+
+ org.apache.poi
+ poi-excelant
+ 3.9
+
+
+ org.apache.poi
+ poi-ooxml
+ 3.9
+
+
+ org.apache.poi
+ poi-ooxml-schemas
+ 3.9
+
+
+ org.apache.poi
+ poi-scratchpad
+ 3.9
+
+
+ com.alipay.sdk
+ alipay-sdk-java
+ 4.10.170.ALL
+
+
+
+ org.springframework.boot
+ spring-boot-starter-test
+ test
+
+
+ org.junit.vintage
+ junit-vintage-engine
+
+
+
+
+
+
+
+
+
+
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+
+
+
+
+
diff --git a/src/main/java/com/ServletContextListener/DictionaryServletContextListener.java b/src/main/java/com/ServletContextListener/DictionaryServletContextListener.java
new file mode 100644
index 0000000..a74d177
--- /dev/null
+++ b/src/main/java/com/ServletContextListener/DictionaryServletContextListener.java
@@ -0,0 +1,61 @@
+package com.ServletContextListener;
+
+import com.baomidou.mybatisplus.mapper.EntityWrapper;
+import com.entity.DictionaryEntity;
+import com.service.DictionaryService;
+import com.thread.MyThreadMethod;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.context.ApplicationContext;
+import org.springframework.web.context.support.WebApplicationContextUtils;
+
+import javax.servlet.ServletContextListener;
+import javax.servlet.ServletContextEvent;
+import javax.servlet.annotation.WebListener;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 字典初始化监视器 用的是服务器监听,每次项目启动,都会调用这个类
+ */
+@WebListener
+public class DictionaryServletContextListener implements ServletContextListener {
+
+ private static final Logger logger = LoggerFactory.getLogger(DictionaryServletContextListener.class);
+ private MyThreadMethod myThreadMethod;
+ @Override
+ public void contextDestroyed(ServletContextEvent sce) {
+ logger.info("----------服务器停止----------");
+ }
+
+ @Override
+ public void contextInitialized(ServletContextEvent sce) {
+ ApplicationContext appContext = WebApplicationContextUtils.getWebApplicationContext(sce.getServletContext());
+
+ logger.info("----------字典表初始化开始----------");
+ DictionaryService dictionaryService = (DictionaryService)appContext.getBean("dictionaryService");
+ List dictionaryEntities = dictionaryService.selectList(new EntityWrapper());
+ Map> map = new HashMap<>();
+ for(DictionaryEntity d :dictionaryEntities){
+ Map m = map.get(d.getDicCode());
+ if(m ==null || m.isEmpty()){
+ m = new HashMap<>();
+ }
+ m.put(d.getCodeIndex(),d.getIndexName());
+ map.put(d.getDicCode(),m);
+ }
+ sce.getServletContext().setAttribute("dictionaryMap", map);
+ logger.info("----------字典表初始化完成----------");
+
+
+
+ logger.info("----------线程执行开始----------");
+ if (myThreadMethod == null) {
+ myThreadMethod = new MyThreadMethod();
+ myThreadMethod.start(); // servlet 上下文初始化时启动线程myThreadMethod
+ }
+ logger.info("----------线程执行结束----------");
+ }
+
+}
diff --git a/src/main/java/com/annotation/APPLoginUser.java b/src/main/java/com/annotation/APPLoginUser.java
new file mode 100644
index 0000000..21d41b9
--- /dev/null
+++ b/src/main/java/com/annotation/APPLoginUser.java
@@ -0,0 +1,15 @@
+package com.annotation;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * 登录用户信息
+ */
+@Target(ElementType.PARAMETER)
+@Retention(RetentionPolicy.RUNTIME)
+public @interface APPLoginUser {
+
+}
diff --git a/src/main/java/com/annotation/ColumnInfo.java b/src/main/java/com/annotation/ColumnInfo.java
new file mode 100644
index 0000000..d041578
--- /dev/null
+++ b/src/main/java/com/annotation/ColumnInfo.java
@@ -0,0 +1,13 @@
+package com.annotation;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Target(ElementType.FIELD)
+@Retention(RetentionPolicy.RUNTIME)
+public @interface ColumnInfo {
+ String comment();
+ String type();
+}
diff --git a/src/main/java/com/annotation/IgnoreAuth.java b/src/main/java/com/annotation/IgnoreAuth.java
new file mode 100644
index 0000000..7c3cc55
--- /dev/null
+++ b/src/main/java/com/annotation/IgnoreAuth.java
@@ -0,0 +1,13 @@
+package com.annotation;
+
+import java.lang.annotation.*;
+
+/**
+ * 忽略Token验证
+ */
+@Target(ElementType.METHOD)
+@Retention(RetentionPolicy.RUNTIME)
+@Documented
+public @interface IgnoreAuth {
+
+}
diff --git a/src/main/java/com/annotation/LoginUser.java b/src/main/java/com/annotation/LoginUser.java
new file mode 100644
index 0000000..3d808d3
--- /dev/null
+++ b/src/main/java/com/annotation/LoginUser.java
@@ -0,0 +1,15 @@
+package com.annotation;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * 登录用户信息
+ */
+@Target(ElementType.PARAMETER)
+@Retention(RetentionPolicy.RUNTIME)
+public @interface LoginUser {
+
+}
diff --git a/src/main/java/com/config/InterceptorConfig.java b/src/main/java/com/config/InterceptorConfig.java
new file mode 100644
index 0000000..586ccc5
--- /dev/null
+++ b/src/main/java/com/config/InterceptorConfig.java
@@ -0,0 +1,39 @@
+package com.config;
+
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
+import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
+import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;
+
+import com.interceptor.AuthorizationInterceptor;
+
+@Configuration
+public class InterceptorConfig extends WebMvcConfigurationSupport{
+
+ @Bean
+ public AuthorizationInterceptor getAuthorizationInterceptor() {
+ return new AuthorizationInterceptor();
+ }
+
+ @Override
+ public void addInterceptors(InterceptorRegistry registry) {
+ registry.addInterceptor(getAuthorizationInterceptor()).addPathPatterns("/**").excludePathPatterns("/static/**");
+ super.addInterceptors(registry);
+ }
+
+ /**
+ * springboot 2.0配置WebMvcConfigurationSupport之后,会导致默认配置被覆盖,要访问静态资源需要重写addResourceHandlers方法
+ */
+ @Override
+ public void addResourceHandlers(ResourceHandlerRegistry registry) {
+ registry.addResourceHandler("/**")
+ .addResourceLocations("classpath:/resources/")
+ .addResourceLocations("classpath:/static/")
+ .addResourceLocations("classpath:/admin/")
+ .addResourceLocations("classpath:/img/")
+ .addResourceLocations("classpath:/front/")
+ .addResourceLocations("classpath:/public/");
+ super.addResourceHandlers(registry);
+ }
+}
diff --git a/src/main/java/com/config/MyMetaObjectHandler.java b/src/main/java/com/config/MyMetaObjectHandler.java
new file mode 100644
index 0000000..2f9e793
--- /dev/null
+++ b/src/main/java/com/config/MyMetaObjectHandler.java
@@ -0,0 +1,28 @@
+package com.config;
+
+import java.util.Date;
+
+import org.apache.ibatis.reflection.MetaObject;
+
+import com.baomidou.mybatisplus.mapper.MetaObjectHandler;
+
+/**
+ * 自定义填充处理器
+ */
+public class MyMetaObjectHandler extends MetaObjectHandler {
+
+ @Override
+ public void insertFill(MetaObject metaObject) {
+ this.setFieldValByName("ctime", new Date(), metaObject);
+ }
+
+ @Override
+ public boolean openUpdateFill() {
+ return false;
+ }
+
+ @Override
+ public void updateFill(MetaObject metaObject) {
+ // 关闭更新填充、这里不执行
+ }
+}
diff --git a/src/main/java/com/config/MybatisPlusConfig.java b/src/main/java/com/config/MybatisPlusConfig.java
new file mode 100644
index 0000000..ec2e84b
--- /dev/null
+++ b/src/main/java/com/config/MybatisPlusConfig.java
@@ -0,0 +1,24 @@
+
+package com.config;
+
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+import com.baomidou.mybatisplus.mapper.MetaObjectHandler;
+import com.baomidou.mybatisplus.plugins.PaginationInterceptor;
+
+/**
+ * mybatis-plus配置
+ */
+@Configuration
+public class MybatisPlusConfig {
+
+ /**
+ * 分页插件
+ */
+ @Bean
+ public PaginationInterceptor paginationInterceptor() {
+ return new PaginationInterceptor();
+ }
+
+}
diff --git a/src/main/java/com/controller/CommonController.java b/src/main/java/com/controller/CommonController.java
new file mode 100644
index 0000000..1b4c98f
--- /dev/null
+++ b/src/main/java/com/controller/CommonController.java
@@ -0,0 +1,685 @@
+package com.controller;
+
+import java.io.*;
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.SQLException;
+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.beans.factory.annotation.Value;
+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;
+
+
+ /**
+ * Java代码实现MySQL数据库导出
+ *
+ * @param mysqlUrl MySQL安装路径
+ * @param hostIP MySQL数据库所在服务器地址IP
+ * @param userName 进入数据库所需要的用户名
+ * @param hostPort 数据库端口
+ * @param password 进入数据库所需要的密码
+ * @param savePath 数据库文件保存路径
+ * @param fileName 数据库导出文件文件名
+ * @param databaseName 要导出的数据库名
+ * @return 返回true表示导出成功,否则返回false。
+ */
+ @IgnoreAuth
+ @RequestMapping("/beifen")
+ public R beifen(String mysqlUrl, String hostIP, String userName, String hostPort, String password, String savePath, String fileName, String databaseName) {
+ File saveFile = new File(savePath);
+ if (!saveFile.exists()) {// 如果目录不存在
+ saveFile.mkdirs();// 创建文件夹
+ }
+ if (!savePath.endsWith(File.separator)) {
+ savePath = savePath + File.separator;
+ }
+ PrintWriter printWriter = null;
+ BufferedReader bufferedReader = null;
+ try {
+ Runtime runtime = Runtime.getRuntime();
+ String cmd = mysqlUrl + "mysqldump -h" + hostIP + " -u" + userName + " -P" + hostPort + " -p" + password + " " + databaseName;
+ runtime.exec(cmd);
+ Process process = runtime.exec(cmd);
+ InputStreamReader inputStreamReader = new InputStreamReader(process.getInputStream(), "utf8");
+ bufferedReader = new BufferedReader(inputStreamReader);
+ printWriter = new PrintWriter(new OutputStreamWriter(new FileOutputStream(savePath + fileName), "utf8"));
+ String line;
+ while ((line = bufferedReader.readLine()) != null) {
+ printWriter.println(line);
+ }
+ printWriter.flush();
+ } catch (Exception e) {
+ e.printStackTrace();
+ return R.error("备份数据出错");
+ } finally {
+ try {
+ if (bufferedReader != null) {
+ bufferedReader.close();
+ }
+ if (printWriter != null) {
+ printWriter.close();
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ return R.ok();
+ }
+
+ /**
+ * Java实现MySQL数据库导入
+ *
+ * @param mysqlUrl MySQL安装路径
+ * @param hostIP MySQL数据库所在服务器地址IP
+ * @param userName 进入数据库所需要的用户名
+ * @param hostPort 数据库端口
+ * @param password 进入数据库所需要的密码
+ * @param savePath 数据库文件保存路径
+ * @param fileName 数据库导出文件文件名
+ * @param databaseName 要导出的数据库名
+ */
+ @IgnoreAuth
+ @RequestMapping("/huanyuan")
+ public R huanyuan(String mysqlUrl, String hostIP, String userName, String hostPort, String password, String savePath, String fileName, String databaseName) {
+ try {
+ Runtime rt = Runtime.getRuntime();
+ Process child1 = rt.exec(mysqlUrl+"mysql.exe -h" + hostIP + " -u" + userName + " -P" + hostPort + " -p" + password + " " + databaseName);
+ OutputStream out = child1.getOutputStream();//控制台的输入信息作为输出流
+ String inStr;
+ StringBuffer sb = new StringBuffer("");
+ String outStr;
+ BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(savePath+"/"+fileName), "utf-8"));
+ while ((inStr = br.readLine()) != null) {
+ sb.append(inStr + "\r\n");
+ }
+ outStr = sb.toString();
+ OutputStreamWriter writer = new OutputStreamWriter(out, "utf8");
+ writer.write(outStr);
+// 注:这里如果用缓冲方式写入文件的话,会导致中文乱码,用flush()方法则可以避免
+ writer.flush();
+ out.close();
+ br.close();
+ writer.close();
+ } catch (Exception e) {
+ e.printStackTrace();
+ return R.error("数据导入出错");
+ }
+ return R.ok();
+ }
+
+
+ /**
+ * 饼状图求和
+ * @return
+ */
+ @RequestMapping("/pieSum")
+ public R pieSum(@RequestParam Map params) {
+ logger.debug("饼状图求和:,,Controller:{},,params:{}",this.getClass().getName(),params);
+ List