Compare commits

..

No commits in common. 'master' and 'GYZ_branch' have entirely different histories.

@ -1,26 +1,2 @@
# 班级通软件系统
本项目是Springboot+web端+小程序端的一个帮助班级管理, 方便班委操作的软件系统。
### 说明代码审计工具不能正确识别小程序的代码量我们实际编写的代码量应该是后端3200行左右+小程序端2000行左右不包含开源框架代码
## 相关文件介绍
-doc文件夹存放的是软件设计和开发过程中的系统相关文档
-model 存放软件设计过程中的UML模型
-src存放软件源代码包括后端和web端源代码classhelper小程序端源码minigram和mysql数据库配置文件script.sql
-other存放汇报PPT和自评报告
## 软件配置环境
后端要求JDK1.8
mysql要求版本5.7以上
小程序端使用微信开发者平台即可
# project

@ -0,0 +1,290 @@
# 软件需求模型
**(用例描述交互和性能缺失)**
## 一、用例图
![image-20220927130526005](..\model\image-20220927130526005.png)
## 二、用例分析及时序图
性能要求要求系统能满足100个人同时使用页面反应时间不能超过6秒
### 1.用例描述:账户登录
业务目标:管理员或用户登录
执行者:用户
前置条件:微信开放平台返回凭证信息
后置条件:记录并绑定用户登录凭证
基本动作序列:
\1. 用户打开登录界面
\2. 申请微信登录授权
\3. 微信开放平台验证信息
\4. 系统显示登录界面
5后台数据保存数据
拓展交互动作序列:
a1.用户或管理员登录web端
a2.系统显示登录页面
a3.用户或管理员扫描二维码进行登录
a4.微信端进行确认
![登录.drawio](model/登录.drawio.png)
### 2.用例描述:用户绑定
业务目标:用户微信绑定个人信息
执行者:用户
前置条件:用户已注册
后置条件:保存用户信息
基本动作序列:
\1. 用户填写学号和姓名
\2. 系统验证信息
\3. 保存用户信息
拓展交互动作序列:
a1.用户学号有重复现象,系统显示输入错误
a2.用户选择重新输入,系统显示绑定界面
a3.系统将所输入的信息存入数据库
![用户绑定.drawio](model/用户绑定.drawio.png)
### 3.用例描述:发布任务
业务目标:管理员发布常规任务
执行者:管理员
前置条件:管理员登录
后置条件:任务发送完毕,系统有记录和显示
基本动作序列:
\1. 老师请求发布任务
\2. 系统显示发布任务界面
\3. 系统请求管理员输入预发布任务
\4. 系统显示发布的任务
拓展交互动作序列:
a1.任务提交时间已过期
a2.管理员选择重新发布任务
a3.系统显示任务成功发布
![发布任务.drawio](model/发布任务.drawio.png)
### 4.用例描述:消息管理
业务目标:管理员查看用户任务完成情况,用户查询管理员发布的任务
执行者:管理员用户
前置条件:用户和管理员已登录
后置条件:系统成功显示任务信息
基本动作序列:
\1. 管理员和用户查看任务信息
\2. 系统显示所查询任务
\3. 管理员和用户查询某项任务明细
\4. 系统显示该信息进度和明细
拓展交互动作序列:
A. 执行者是用户
a1.用户查看管理员发布的任务、通知
a2.系统显示该学生查询内容
B. 执行者是管理员
b1.管理员查询用户上传任务情况
b2.系统显示用户上传任务情况
b3.管理员请求删除已过时信息
b4.系统显示已删除过时信息
![消息管理.drawio](model/消息管理.drawio.png)
### 5.用例描述:任务提交
业务目标:用户和管理员发布提交任务
执行者:用户 管理员
前置条件:用于已完成任务
后置条件:用户提交后,系统数据库存储文件
基本动作序列:
\1. 学生登录系统
\2. 学生完成任务
\3. 学生点击上传按钮
\4. 系统显示上传结果菜单
\5. 成功上传文件
拓展交互动作序列:
a1.学生未按时提交实验结果
a2.系统提示已过期
![任务提交.drawio](model/任务提交.drawio.png)
### 6.用例描述:成员管理
业务目标:管理员增加删除新管理员和用户
执行者:管理员
前置条件:管理员登录认证
后置条件:系统记录管理员信息
基本动作序列:
管理员输入 ID ,密码,登陆系统。
1.管理员登录系统
2.系统显示管理员控制界面。
3.管理员点击控制界面的“添加管理员”按钮。
4.系统弹出添加管理员界面。
5.管理员输入新管理员 ID 。
6.管理员点击添加新管理员界面上的“确认添加”按钮,添加管理员界面关闭,新管理员添加成功。
拓展交互动作序列:
A.添加的管理员 ID 已经存在。
B.系统显示输入错误
C.管理员重新输入
D.系统保存管理员信息
![成员管理.drawio](model/成员管理.drawio.png)
### 7.用例描述:接龙
业务目标:管理员发布接龙,用户点击接龙按钮即可完成接龙
执行者:管理员用户
前置条件:用户和管理员已登录
后置条件:系统保存接龙信息
基本动作序列:
1.管理员登录系统
2.管理员发布接龙
3.用户登录系统
4.用户点击接龙按钮
5.系统根据用户绑定ID填入接龙表格完成接龙
拓展交互动作序列:
1A. 管理员点击导出
1B. 系统将接龙以excel表格导出
![接龙.drawio](model/接龙.drawio.png)
### 8.用例描述:后台管理
业务目标:管理员管理员查看用户进度,和导出任务文件
执行者:管理员
前置条件:管理员已登录认证
后置条件:系统保存和导出任务文件
基本动作序列:
1.管理员登录系统
2.管理员点击查看进度按钮
3.系统显示任务进度和明细
4.管理员点击导出文件
5.系统将文件导出
拓展交互动作序列:
a1.管理员点击查看进度
a2.系统显示完成任务进度
a3.管理员在未完成任务人员界面点击提醒
a4.系统通过弹窗对未完成任务人员进行提醒
![后台管理.drawio](model/后台管理.drawio.png)
## 三、分析类图
![分析类图2](model/分析类图2.png)

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 88 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 79 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 89 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 69 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 70 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 113 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 76 KiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

@ -1,107 +0,0 @@
package com.example.demo.common;
/**
* @Description:
*
*
*
* 200
* 500msg
* 501beanmap
* 502token
* 555
*/
public class GlobalResult {
// 响应业务状态
private Integer status;
// 响应消息
private String msg;
// 响应中的数据
private Object data;
private String ok; // 不使用
public static GlobalResult build(Integer status, String msg, Object data) {
return new GlobalResult(status, msg, data);
}
public static GlobalResult ok(Object data) {
return new GlobalResult(data);
}
public static GlobalResult ok() {
return new GlobalResult(null);
}
public static GlobalResult errorMsg(String msg) {
return new GlobalResult(500, msg, null);
}
public static GlobalResult errorMap(Object data) {
return new GlobalResult(501, "error", data);
}
public static GlobalResult errorTokenMsg(String msg) {
return new GlobalResult(502, msg, null);
}
public static GlobalResult errorException(String msg) {
return new GlobalResult(555, msg, null);
}
public GlobalResult() {
}
public GlobalResult(Integer status, String msg, Object data) {
this.status = status;
this.msg = msg;
this.data = data;
}
public GlobalResult(Object data) {
this.status = 200;
this.msg = "OK";
this.data = data;
}
public Boolean isOK() {
return this.status == 200;
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
public Object getData() {
return data;
}
public void setData(Object data) {
this.data = data;
}
public String getOk() {
return ok;
}
public void setOk(String ok) {
this.ok = ok;
}
}

@ -1,135 +0,0 @@
package com.example.demo.common;
import org.apache.http.NameValuePair;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.client.utils.URIBuilder;
import org.apache.http.entity.ContentType;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.util.EntityUtils;
import java.io.IOException;
import java.net.URI;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
public class HttpClientUtil {
public static String doGet(String url, Map<String, String> param) {
// 创建Httpclient对象
CloseableHttpClient httpclient = HttpClients.createDefault();
String resultString = "";
CloseableHttpResponse response = null;
try {
// 创建uri
URIBuilder builder = new URIBuilder(url);
if (param != null) {
for (String key : param.keySet()) {
builder.addParameter(key, param.get(key));
}
}
URI uri = builder.build();
// 创建http GET请求
HttpGet httpGet = new HttpGet(uri);
// 执行请求
response = httpclient.execute(httpGet);
// 判断返回状态是否为200
if (response.getStatusLine().getStatusCode() == 200) {
resultString = EntityUtils.toString(response.getEntity(), "UTF-8");
}
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
if (response != null) {
response.close();
}
httpclient.close();
} catch (IOException e) {
e.printStackTrace();
}
}
return resultString;
}
public static String doGet(String url) {
return doGet(url, null);
}
public static String doPost(String url, Map<String, String> param) {
// 创建Httpclient对象
CloseableHttpClient httpClient = HttpClients.createDefault();
CloseableHttpResponse response = null;
String resultString = "";
try {
// 创建Http Post请求
HttpPost httpPost = new HttpPost(url);
// 创建参数列表
if (param != null) {
List<NameValuePair> paramList = new ArrayList<>();
for (String key : param.keySet()) {
paramList.add(new BasicNameValuePair(key, param.get(key)));
}
// 模拟表单
UrlEncodedFormEntity entity = new UrlEncodedFormEntity(paramList);
httpPost.setEntity(entity);
}
// 执行http请求
response = httpClient.execute(httpPost);
resultString = EntityUtils.toString(response.getEntity(), "utf-8");
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
response.close();
} catch (IOException e) {
e.printStackTrace();
}
}
return resultString;
}
public static String doPost(String url) {
return doPost(url, null);
}
public static String doPostJson(String url, String json) {
// 创建Httpclient对象
CloseableHttpClient httpClient = HttpClients.createDefault();
CloseableHttpResponse response = null;
String resultString = "";
try {
// 创建Http Post请求
HttpPost httpPost = new HttpPost(url);
// 创建请求内容
StringEntity entity = new StringEntity(json, ContentType.APPLICATION_JSON);
httpPost.setEntity(entity);
// 执行http请求
response = httpClient.execute(httpPost);
resultString = EntityUtils.toString(response.getEntity(), "utf-8");
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
response.close();
} catch (IOException e) {
e.printStackTrace();
}
}
return resultString;
}
}

@ -1,73 +0,0 @@
package com.example.demo.common;
import java.io.*;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLEncoder;
import java.util.Map;
public class HttpGetUtil {
public static String httpRequestToString(String url,
Map params, String type) {
String result = null;
try {
InputStream is = httpRequestToStream(url, params, type);
BufferedReader in = new BufferedReader(new InputStreamReader(is,
"UTF-8"));
StringBuffer buffer = new StringBuffer();
String line = "";
while ((line = in.readLine()) != null) {
buffer.append(line);
}
result = buffer.toString();
} catch (Exception e) {
return null;
}
System.out.println(result);
return result;
}
private static InputStream httpRequestToStream(String url,
Map params, String type) {
InputStream is = null;
try {
String parameters = "";
boolean hasParams = false;
for (Object key : params.keySet()) {
String value = URLEncoder.encode((String) params.get(key), "UTF-8");
parameters += key + "=" + value + "&";
hasParams = true;
}
if (hasParams) {
parameters = parameters.substring(0, parameters.length()-1);
}
url += "?"+ parameters;
System.out.println(url);
URL u = new URL(url);
HttpURLConnection conn = (HttpURLConnection) u.openConnection();
conn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
conn.setRequestProperty("Accept-Charset", "UTF-8");
conn.setRequestProperty("contentType", "utf-8");
conn.setConnectTimeout(50000);
conn.setReadTimeout(50000);
conn.setDoInput(true);
//设置请求方式默认为GET
conn.setRequestMethod(type);
is = conn.getInputStream();
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return is;
}
}

@ -1,4 +0,0 @@
package com.example.demo.common;
public class UploadFileTool {
}

@ -1,69 +0,0 @@
package com.example.demo.common;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import org.apache.shiro.codec.Base64;
import org.bouncycastle.jce.provider.BouncyCastleProvider;
import javax.crypto.Cipher;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.SecretKeySpec;
import java.security.AlgorithmParameters;
import java.security.Security;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
public class WechatUtil {
public static JSONObject getSessionKeyOrOpenId(String code) {
String requestUrl = "https://api.weixin.qq.com/sns/jscode2session";
Map<String, String> requestUrlParam = new HashMap<>();
// https://mp.weixin.qq.com/wxopen/devprofile?action=get_profile&token=164113089&lang=zh_CN
//小程序appId
requestUrlParam.put("wx08c675f6ba5b2cdc", "wx08c675f6ba5b2cdc");
//小程序secret
requestUrlParam.put("0c28388c09ff373d391fe66d085dd39d", "0c28388c09ff373d391fe66d085dd39d");
//小程序端返回的code
requestUrlParam.put("js_code", code);
//默认参数
requestUrlParam.put("grant_type", "authorization_code");
//发送post请求读取调用微信接口获取openid用户唯一标识
JSONObject jsonObject = JSON.parseObject(HttpClientUtil.doPost(requestUrl, requestUrlParam));
return jsonObject;
}
public static JSONObject getUserInfo(String encryptedData, String sessionKey, String iv) {
// 被加密的数据
byte[] dataByte = Base64.decode(encryptedData);
// 加密秘钥
byte[] keyByte = Base64.decode(sessionKey);
// 偏移量
byte[] ivByte = Base64.decode(iv);
try {
// 如果密钥不足16位那么就补足. 这个if 中的内容很重要
int base = 16;
if (keyByte.length % base != 0) {
int groups = keyByte.length / base + (keyByte.length % base != 0 ? 1 : 0);
byte[] temp = new byte[groups * base];
Arrays.fill(temp, (byte) 0);
System.arraycopy(keyByte, 0, temp, 0, keyByte.length);
keyByte = temp;
}
// 初始化
Security.addProvider(new BouncyCastleProvider());
Cipher cipher = Cipher.getInstance("AES/CBC/PKCS7Padding", "BC");
SecretKeySpec spec = new SecretKeySpec(keyByte, "AES");
AlgorithmParameters parameters = AlgorithmParameters.getInstance("AES");
parameters.init(new IvParameterSpec(ivByte));
cipher.init(Cipher.DECRYPT_MODE, spec, parameters);// 初始化
byte[] resultByte = cipher.doFinal(dataByte);
if (null != resultByte && resultByte.length > 0) {
String result = new String(resultByte, "UTF-8");
return JSON.parseObject(result);
}
} catch (Exception e) {
}
return null;
}
}

@ -1,143 +0,0 @@
package com.example.demo.common;
import java.io.*;
import java.util.ArrayList;
import java.util.List;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
public class ZipUtils {
private static final int BUFFER_SIZE = 2 * 1024;
/**
* ZIP 1
*
* @param srcDir
* @param out
* @param KeepDirStructure ,true:;
* false:(,)
* @throws RuntimeException
*/
public static void toZip(String srcDir, OutputStream out, boolean KeepDirStructure)
throws RuntimeException {
long start = System.currentTimeMillis();
ZipOutputStream zos = null;
try {
zos = new ZipOutputStream(out);
File sourceFile = new File(srcDir);
compress(sourceFile, zos, sourceFile.getName(), KeepDirStructure);
long end = System.currentTimeMillis();
System.out.println("压缩完成,耗时:" + (end - start) + " ms");
} catch (Exception e) {
throw new RuntimeException("zip error from ZipUtils", e);
} finally {
if (zos != null) {
try {
zos.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
/**
* ZIP 2
*
* @param srcFiles
* @param out
* @throws RuntimeException
*/
public static void toZip(List<File> srcFiles, OutputStream out) throws RuntimeException {
long start = System.currentTimeMillis();
ZipOutputStream zos = null;
try {
zos = new ZipOutputStream(out);
for (File srcFile : srcFiles) {
byte[] buf = new byte[BUFFER_SIZE];
zos.putNextEntry(new ZipEntry(srcFile.getName()));
int len;
FileInputStream in = new FileInputStream(srcFile);
while ((len = in.read(buf)) != -1) {
zos.write(buf, 0, len);
}
zos.closeEntry();
in.close();
}
long end = System.currentTimeMillis();
System.out.println("压缩完成,耗时:" + (end - start) + " ms");
} catch (Exception e) {
throw new RuntimeException("zip error from ZipUtils", e);
} finally {
if (zos != null) {
try {
zos.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
/**
*
*
* @param sourceFile
* @param zos zip
* @param name
* @param KeepDirStructure ,true:;
* false:(,)
* @throws Exception
*/
private static void compress(File sourceFile, ZipOutputStream zos, String name,
boolean KeepDirStructure) throws Exception {
byte[] buf = new byte[BUFFER_SIZE];
if (sourceFile.isFile()) {
// 向zip输出流中添加一个zip实体构造器中name为zip实体的文件的名字
zos.putNextEntry(new ZipEntry(name));
// copy文件到zip输出流中
int len;
FileInputStream in = new FileInputStream(sourceFile);
while ((len = in.read(buf)) != -1) {
zos.write(buf, 0, len);
}
// Complete the entry
zos.closeEntry();
in.close();
} else {
File[] listFiles = sourceFile.listFiles();
if (listFiles == null || listFiles.length == 0) {
// 需要保留原来的文件结构时,需要对空文件夹进行处理
if (KeepDirStructure) {
// 空文件夹的处理
zos.putNextEntry(new ZipEntry(name + "/"));
// 没有文件不需要文件的copy
zos.closeEntry();
}
} else {
for (File file : listFiles) {
// 判断是否需要保留原来的文件结构
if (KeepDirStructure) {
// 注意file.getName()前面需要带上父文件夹的名字加一斜杠,
// 不然最后压缩包中就不能保留原来的文件结构,即:所有文件都跑到压缩包根目录下了
compress(file, zos, name + "/" + file.getName(), KeepDirStructure);
} else {
compress(file, zos, file.getName(), KeepDirStructure);
}
}
}
}
}
public static void main(String[] args) throws Exception {
/** 测试压缩方法1 */
FileOutputStream fos1 = new FileOutputStream(new File("./test.zip"));
ZipUtils.toZip("C:\\Users\\1\\OneDrive - sliverki\\学习", fos1, true);
}
}

@ -1,47 +0,0 @@
package com.example.demo.common.util;
public class FormatResponseUtil {
/**
*
*/
public static ResponseResult formatResponse() {
ResponseResult result = null;
return formatResponse(result);
}
private static ResponseResult formatResponse(ResponseResult result) {
if (result == null) {
result = new ResponseResult(true, "请求成功", null);
}
return result;
}
/**
* ,
*/
public static ResponseResult formatResponse(Object object) {
return new ResponseResult(true, "请求成功", object);
}
/**
*
*/
public static ResponseResult formatResponse(String msg, Object object) {
return new ResponseResult(true, msg, object);
}
/**
*
*/
public static ResponseResult error(Exception e) {
return new ResponseResult(false, e.getMessage());
}
/**
*
*/
public static ResponseResult error(String exception) {
return new ResponseResult(false, exception);
}
}

@ -1,34 +0,0 @@
package com.example.demo.common.util;
import lombok.Data;
@Data
public class ResponseResult {
/**
*
*/
private boolean success;
/**
*
*/
private String msg;
/**
*
*/
private Object data;
public ResponseResult(boolean success, String msg, Object data) {
this.success = success;
this.msg = msg;
this.data = data;
}
public ResponseResult(boolean code, String msg) {
this.success = success;
this.msg = msg;
}
public ResponseResult(boolean success) {
this.success = success;
}
}

@ -1,21 +0,0 @@
package com.example.demo.config;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@Configuration
public class MyMvcConfig implements WebMvcConfigurer {
@Override
public void addViewControllers(ViewControllerRegistry registry) {
registry.addViewController("/").setViewName("index");
registry.addViewController("/index.html").setViewName("index");
}
@Override
public void addInterceptors(InterceptorRegistry registry) {
registry.addInterceptor(new LoginHandleInterceptor()).addPathPatterns("/resource").excludePathPatterns("/index.html","dashboard","/","/login","/css/**","/js/**","/img/**");
}
}

@ -1,31 +0,0 @@
package com.example.demo.config;
import io.swagger.v3.oas.models.ExternalDocumentation;
import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.info.Info;
import io.swagger.v3.oas.models.info.License;
import org.springdoc.core.GroupedOpenApi;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* SpringDoc API
* Created by kirito on 2022/10/2.
*/
@Configuration
public class SpringDocConfig {
/**
*
* @return
*/
@Bean
public GroupedOpenApi publicApi() {
return GroupedOpenApi.builder()
.group("") //分组
.pathsToMatch("") //匹配url路径
.build();
}
}

@ -1,33 +0,0 @@
package com.example.demo.config.config;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
import com.example.demo.domain.Task;
import org.apache.ibatis.reflection.MetaObject;
import org.springframework.stereotype.Component;
import java.time.LocalDateTime;
@Component
public class BaseEntityMetaObjectHandler implements MetaObjectHandler {
@Override
public void insertFill(MetaObject metaObject) {
// 创建时间自动填充
if (metaObject.hasSetter(Task.CREATE_TIME) && ObjectUtil.isNull(getFieldValByName(Task.CREATE_TIME, metaObject))) {
this.strictInsertFill(metaObject, Task.CREATE_TIME, LocalDateTime.class, LocalDateTime.now());
}
}
@Override
public void updateFill(MetaObject metaObject) {
//修改时间自动填充
if (metaObject.hasSetter(Task.MODIFIED_TIME) && ObjectUtil.isNull(getFieldValByName(Task.MODIFIED_TIME, metaObject))) {
this.strictUpdateFill(metaObject, Task.MODIFIED_TIME, LocalDateTime.class, LocalDateTime.now());
}
}
}

@ -1,27 +0,0 @@
package com.example.demo.config.config;
import com.baomidou.mybatisplus.annotation.DbType;
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* MybatisPlus
*
* @author huang
* @since 2022-03-18
*/
@Configuration
public class MybatisPlusConfig {
/**
*
*/
@Bean
public MybatisPlusInterceptor mybatisPlusInterceptor() {
MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL));
return interceptor;
}
}

@ -1,42 +0,0 @@
package com.example.demo.controller;
import com.example.demo.common.util.FormatResponseUtil;
import com.example.demo.common.util.ResponseResult;
import com.example.demo.domain.Dragon;
import com.example.demo.service.impl.DragonServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@RestController
@RequestMapping("/dragon")
public class DragonController {
@Autowired
DragonServiceImpl dragonService;
@GetMapping("/dragonList")
public ResponseResult queryAll() {
return FormatResponseUtil.formatResponse(dragonService.queryAll());
}
@PostMapping("/addDragon")
public ResponseResult addDragon(@RequestBody Dragon dragon) {
//System.out.println("1111111111");
return FormatResponseUtil.formatResponse(dragonService.save(dragon));
}
@DeleteMapping("/delete")//这里执行的是物理删除
public ResponseResult delTDragonById(Integer id) {
return FormatResponseUtil.formatResponse(dragonService.delDragonById(id));
}
@GetMapping("/one")
public ResponseResult queryById(int id) {
return FormatResponseUtil.formatResponse(dragonService.queryDragonById(id));
}
@PostMapping("/dragonInfo")
public ResponseResult updateArea(@RequestBody Dragon dragon) {
return FormatResponseUtil.formatResponse(dragonService.updateById(dragon));
}
}

@ -1,134 +0,0 @@
package com.example.demo.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.example.demo.domain.Dragonson;
import com.example.demo.domain.Taskson;
import com.example.demo.domain.User;
import com.example.demo.mapper.DragonsonMapper;
import com.example.demo.mapper.TasksonMapper;
import com.example.demo.mapper.UserMapper;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.apache.http.impl.bootstrap.HttpServer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpRequest;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import javax.servlet.http.HttpServletRequest;
import java.io.*;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Date;
import java.util.List;
@Tag(name = "任务上传", description = " ")
@RestController
public class TaskuploadController {
@Autowired
private TasksonMapper tasksonMapper;
@Autowired
private UserMapper userMapper;
@Autowired
private DragonsonMapper dragonsonMapper;
@RequestMapping(value = "/taskupload", method = RequestMethod.POST)
@Operation(summary = "任务上传接口")
public String taskupload(HttpServletRequest request,
@RequestParam(name = "skey", required = true) String skey,
@RequestParam(name = "Task_id", required = true) Integer Taskid) {
//skey 查表
System.out.println(skey);
QueryWrapper<User> queryWrapper = new QueryWrapper<>();
queryWrapper.like("skey", skey);
User user = this.userMapper.selectOne(queryWrapper);
System.out.println(user);
QueryWrapper<Taskson> queryWrapper1 = new QueryWrapper<>();
queryWrapper1.like("studentnumber", user.getStudentNumber());
queryWrapper1.like("Task_id", Taskid); //任务表(需修改)
Taskson taskson = this.tasksonMapper.selectOne(queryWrapper1);
if (taskson == null) {
taskson = new Taskson();
taskson.setTaskid(Taskid);//任务id需修改
taskson.setStudentnumber(user.getStudentNumber());
this.tasksonMapper.insert(taskson);
}
//文件接收
taskson = this.tasksonMapper.selectOne(queryWrapper1);
List<MultipartFile> files = ((MultipartHttpServletRequest) request).getFiles("file");
String type = files.get(0).getOriginalFilename().split("\\.")[1];
MultipartFile file = null;
FileOutputStream stream = null;
Path fapath = Paths.get("E:\\git\\project\\src\\demo\\target" + "\\" + taskson.getTaskid());
try {
Files.createDirectories(fapath);
} catch (IOException e) {
e.printStackTrace();
}
String path = "E:\\git\\project\\src\\demo\\target" + "\\" + taskson.getTaskid() + "\\" + taskson.getStudentnumber() + "." + type;
try {
stream = new FileOutputStream(path);
} catch (FileNotFoundException e) {
e.printStackTrace();
}
for (int i = 0; i < files.size(); ++i) {
file = files.get(i);
if (!file.isEmpty()) {
try {
byte[] bytes = file.getBytes();
stream.write(bytes);
stream.close();
} catch (Exception e) {
stream = null;
return "You failed to upload " + i + " => "
+ e.getMessage();
}
} else {
return "You failed to upload " + i
+ " because the file was empty.";
}
}
System.out.println("upload success");
taskson.setFilepath(path);
taskson.setFinishtime(new Date());
this.tasksonMapper.updateById(taskson);
return "upload successful";
}
@RequestMapping(value = "/uploadDragon",method = RequestMethod.POST)
public String uploaddragon(HttpServletRequest request,
@RequestParam(name = "skey", required = true) String skey,
@RequestParam(name = "dragonid", required = true) Integer dragonid,
@RequestParam(name = "text", required = true) String text) {
QueryWrapper<User> queryWrapper = new QueryWrapper<>();
queryWrapper.like("skey", skey);
User user = this.userMapper.selectOne(queryWrapper);
QueryWrapper<Dragonson> queryWrapper1 = new QueryWrapper<>();
queryWrapper1.like("studentnumber", user.getStudentNumber());
queryWrapper1.like("dragon_id", dragonid);
Dragonson dragonson = this.dragonsonMapper.selectOne(queryWrapper1);
if (dragonson == null) {
dragonson = new Dragonson();
dragonson.setDragonid(dragonid);
dragonson.setStudentnumber(user.getStudentNumber());
this.dragonsonMapper.insert(dragonson);
}
System.out.println(text);
dragonson = this.dragonsonMapper.selectOne(queryWrapper1);
dragonson.setFinishtime(new Date());
dragonson.setText(text);
this.dragonsonMapper.updateById(dragonson);
return "success";
}
}

@ -1,161 +0,0 @@
package com.example.demo.controller;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.example.demo.common.HttpGetUtil;
import com.example.demo.domain.Rcode;
import com.example.demo.domain.User;
import com.example.demo.mapper.RcodeMapper;
import com.example.demo.mapper.TasksonMapper;
import com.example.demo.mapper.UserMapper;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.UnsupportedEncodingException;
import java.util.*;
@Tag(name = "真·用户接口", description = "用户登录,")
@RestController
public class UserController {
@Autowired
private UserMapper userMapper;
/**
*
*
* @param request
* @param response
* @param code
* @return
* @throws UnsupportedEncodingException
* @auth:kirito
*/
@GetMapping("atlogin")
@Operation(summary = "真·微信登录接口")
public Map getOpenId(HttpServletRequest request,
HttpServletResponse response,
@RequestParam(value = "code", required = false) String code) throws UnsupportedEncodingException {
response.setContentType("text/html");
request.setCharacterEncoding("UTF-8");
response.setCharacterEncoding("UTF-8");
Map params = new HashMap();
params.put("appid", "wx954296403ec15396");
params.put("secret", "3317b29d14270cebb8f4e3521506f285");
params.put("js_code", code);
params.put("grant_type", "authorization_code");
System.out.println(params);
String result = HttpGetUtil.httpRequestToString(
"https://api.weixin.qq.com/sns/jscode2session", params, "GET");
JSONObject jsonObject = JSONObject.parseObject(result);
String openid = jsonObject.get("openid").toString();
System.out.println("得到的openid为:" + openid);
String sessionKey = jsonObject.get("session_key").toString();
User user = this.userMapper.selectById(openid);
// uuid生成唯一key用于维护微信小程序用户与服务端的会话
String skey = UUID.randomUUID().toString();
if (user == null) {
// 用户信息入库
user = new User();
user.setOpenId(openid);
user.setSkey(skey);
user.setCreateTime(new Date());
user.setLastVisitTime(new Date());
user.setSessionKey(sessionKey);
this.userMapper.insert(user);
} else {
// 已存在,更新用户登录时间
user.setLastVisitTime(new Date());
// 重新设置会话skey
user.setSkey(skey);
this.userMapper.updateById(user);
}
User user2 = this.userMapper.selectById(openid);
Map<String, Object> skeymap = new HashMap<String, Object>();
skeymap.put("skey", skey);
skeymap.put("power", user2.getPower());
return skeymap;
}
/**
*
*
* @param studentnumber
* @param name
* @param skey
* @authkirito
* @date2022/10/20
*/
@Autowired
TasksonMapper tasksonMapper;
@RequestMapping("/atbind")
@Operation(summary = "用户绑定接口")
public void atbind(@RequestParam(value = "studentnumber", required = true) String studentnumber,
@RequestParam(value = "name", required = true) String name,
@RequestParam(value = "skey", required = true) String skey) {
QueryWrapper<User> queryWrapper = new QueryWrapper<>();
queryWrapper.like("skey", skey);
User user = this.userMapper.selectOne(queryWrapper);
user.setStudentNumber(studentnumber);
user.setName(name);
this.userMapper.updateById(user);
System.out.println(user);
}
@Autowired
RcodeMapper rcodeMapper;
/**
*
* s
*
* @param skey
* @return code
* @auth:kirito
* @date:2022/11/12
*/
@RequestMapping("/getrcode")
@Operation(summary = "获取验证码")
public String getrcode(@RequestParam(value = "skey", required = true) String skey) {
Rcode rcode = this.rcodeMapper.selectById(skey);
System.out.println(rcode);
String code = "";
if (rcode == null) {
rcode = new Rcode();
rcode.setSkey(skey);
code = rcode.createCode();
this.rcodeMapper.insert(rcode);
} else {
code = rcode.createCode();
rcode.setCode(code);
this.rcodeMapper.updateById(rcode);
}
return code;
}
/**
* 使
*
*
* @auth:kirito
*/
@RequestMapping("/webblogin")
@Operation(summary = "登录")
public void weblogin(@RequestParam(value = "code") String code) {
QueryWrapper<Rcode> queryWrapper = new QueryWrapper<>();
queryWrapper.like("code", code);
Rcode authrcode = this.rcodeMapper.selectOne(queryWrapper);
String skey = authrcode.getSkey();
System.out.println(skey);
}
}

@ -1,125 +0,0 @@
package com.example.demo.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.example.demo.common.ZipUtils;
import com.example.demo.domain.Dragonson;
import com.example.demo.domain.User;
import com.example.demo.mapper.DragonsonMapper;
import com.example.demo.mapper.UserMapper;
import org.apache.poi.hssf.usermodel.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.*;
import java.net.URLEncoder;
import java.util.List;
@Controller
public class Webneed {
@Autowired
DragonsonMapper dragonsonMapper;
@GetMapping("/exceldownload/{id}")
public void download(HttpServletResponse response, @PathVariable("id") String dragonid) throws IOException {
HSSFWorkbook workbook = new HSSFWorkbook();
HSSFSheet sheet = workbook.createSheet("接龙情况");
QueryWrapper<Dragonson> queryWrapper = new QueryWrapper<>();
queryWrapper.like("dragon_id", dragonid);
List<Dragonson> list = this.dragonsonMapper.selectList(queryWrapper);
String filename = dragonid + ".xls";
int rowNum = 1;
//表头
String[] headers = {"num", "dragonid", "studentnumber", "finishtime", "text"};
HSSFRow row = sheet.createRow(0);
for (int i = 0; i < headers.length; i++) {
HSSFCell cell = row.createCell(i);
HSSFRichTextString text = new HSSFRichTextString(headers[i]);
cell.setCellValue(text);
}
//在表中存放查询到的数据放入对应的列
for (Dragonson dragonson : list) {
HSSFRow row1 = sheet.createRow(rowNum);
row1.createCell(0).setCellValue(dragonson.getId());
row1.createCell(1).setCellValue(dragonson.getDragonid());
row1.createCell(2).setCellValue(dragonson.getStudentnumber());
row1.createCell(3).setCellValue(dragonson.getFinishtime());
row1.createCell(4).setCellValue(dragonson.getText());
rowNum++;
}
response.setContentType("application/octet-stream");
response.setHeader("Content-disposition", "attachment;filename=" + filename);
response.flushBuffer();
workbook.write(response.getOutputStream());
}
@RequestMapping("/daochu")
public String daochu() {
return "daochu";
}
@RequestMapping("/filedownload/{id}")
public String downloadfile(@PathVariable("id") String taskid,
HttpServletResponse response) throws UnsupportedEncodingException, FileNotFoundException {
FileOutputStream fos1 = new FileOutputStream(new File( taskid+".zip"));
ZipUtils.toZip("E:\\git\\project\\src\\demo\\target\\"+taskid, fos1, true);
File scFileDir = new File("./");
String fileName = taskid + ".zip";
File fileDir = new File(scFileDir, fileName);
System.out.println(fileDir.getName());
if (fileDir.exists()) {
// 配置文件下载
response.setHeader("content-type", "application/octet-stream");
response.setContentType("application/octet-stream");
// 下载文件能正常显示中文
response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(fileName, "UTF-8"));
// 实现文件下载
byte[] buffer = new byte[1024];
FileInputStream fis = null;
BufferedInputStream bis = null;
try {
fis = new FileInputStream(fileDir);
bis = new BufferedInputStream(fis);
OutputStream os = response.getOutputStream();
int i = bis.read(buffer);
while (i != -1) {
os.write(buffer, 0, i);
i = bis.read(buffer);
}
System.out.println("Download successfully!");
} catch (Exception e) {
System.out.println("Download failed!");
} finally {
if (bis != null) {
try {
bis.close();
} catch (IOException e) {
e.printStackTrace();
}
}
if (fis != null) {
try {
fis.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
return null;
}
}

@ -1,47 +0,0 @@
package com.example.demo.controller;
import com.example.demo.domain.Task;
import com.example.demo.service.impl.TaskServiceImpl;
import com.example.demo.common.util.FormatResponseUtil;
import com.example.demo.common.util.ResponseResult;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@RestController
@Tag(name = "WXL")
@RequestMapping("/task")
public class taskController {
@Autowired
public TaskServiceImpl taskService;
@Operation(summary = "获取任务信息")
@GetMapping("/taskList")
public ResponseResult queryAll() {
return FormatResponseUtil.formatResponse(taskService.queryAll());
}
@PostMapping("/addTask")
public ResponseResult addTask(@RequestBody Task task) {
return FormatResponseUtil.formatResponse(taskService.save(task));
}
@DeleteMapping("/delete")//这里执行的是物理删除
public ResponseResult delTaskById(Integer id){
return FormatResponseUtil.formatResponse(taskService.delTaskById(id));
}
@GetMapping("/one")
public ResponseResult queryById(int id){
return FormatResponseUtil.formatResponse(taskService.queryTaskById(id));
}
@PostMapping("/taskInfo")
public ResponseResult updateArea(@RequestBody Task task){
return FormatResponseUtil.formatResponse(taskService.updateById(task));
}
}

@ -1,107 +0,0 @@
package com.example.demo.domain;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import java.time.LocalDateTime;
public class Dragon {
private static final long serialVersionUID = 1L;
public static final String CREATE_TIME = "createTime";
public static final String MODIFIED_TIME = "lastEditTime";
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
private String name;
/*
*
* */
private String property;
/**
*
*/
@TableField(fill = FieldFill.INSERT)
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime createTime;
private String deadtime;
private Integer status;
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
public String getDeadtime() {
return deadtime;
}
public void setDeadtime(String deadtime) {
this.deadtime = deadtime;
}
/**
*
*/
@TableField(fill = FieldFill.UPDATE)
private LocalDateTime lastTime;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getProperty() {
return property;
}
public void setProperty(String property) {
this.property = property;
}
public LocalDateTime getCreateTime() {
return createTime;
}
public void setCreateTime(LocalDateTime createTime) {
this.createTime = createTime;
}
public LocalDateTime getLastEditTime() {
return lastTime;
}
public void setLastEditTime(LocalDateTime lastEditTime) {
this.lastTime = lastEditTime;
}
@Override
public String toString() {
return "Dragon{" +
"id=" + id +
", name=" + name +
", priority=" + property +
", createTime=" + createTime +
", lastEditTime=" + lastTime +
"}";
}
}

@ -1,62 +0,0 @@
package com.example.demo.domain;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.segments.MergeSegments;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
@Data
@TableName("dragonson")
public class Dragonson extends Wrapper<Dragonson> {
/**
* id
*/
@TableId("id")
private int id;
/**
* dragon_id
*/
@TableField("dragon_id")
private int dragonid;
/**
* studentnumber
*/
@TableField("studentnumber")
private String studentnumber;
/**
* finishtime
*/
@TableField("finishtime")
@DateTimeFormat(pattern = "yyyy-MM-dd")
private Date finishtime;
/**
* text
*/
@TableField("text")
private String text;
@Override
public Dragonson getEntity() {
return null;
}
@Override
public MergeSegments getExpression() {
return null;
}
@Override
public void clear() {
}
@Override
public String getSqlSegment() {
return null;
}
}

@ -1,70 +0,0 @@
package com.example.demo.domain;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.util.Random;
@Data
@TableName("rcode")
public class Rcode {
@TableField("code")
private String code;
@TableId
private String skey;
public Rcode() {
}
public Rcode(String code, String skey) {
this.code = code;
this.skey = skey;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getSkey() {
return skey;
}
public void setSkey(String skey) {
this.skey = skey;
}
public String createCode() {
//定义字符串记录
String code = "";
Random r = new Random();
//for 循环5次依次生成随机字符
for (int i = 0; i < 5; i++) {
int type = r.nextInt(3);//0 1 2
switch (type) {
case 0:
//大写字符A 65-Z 65+25
char ch = (char) (r.nextInt(26) + 65);
code += ch;
break;
case 1:
//小写字符a 97-z 97+25
char ch1 = (char) (r.nextInt(26) + 97);
code += ch1;
break;
case 2:
//数字字符
code += r.nextInt(10);//0-9
break;
}
}
this.code = code;
return code;
}
}

@ -1,118 +0,0 @@
package com.example.demo.domain;
import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import java.time.LocalDateTime;
@TableName("task")
public class Task {
private static final long serialVersionUID = 1L;
public static final String CREATE_TIME = "createTime";
public static final String MODIFIED_TIME = "lastTime";
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
private String name;
/*
*
* */
private String property;
//任务关联学号
private String stuid;
//任务截止时间
private String deadtime;
//任务状态默认0未完成
private Integer status;
/**
*
*/
@TableField(fill = FieldFill.INSERT)
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime createTime;
/**
*
*/
@TableField(fill = FieldFill.UPDATE)
private LocalDateTime lastTime;
public String getDeadtime() {
return deadtime;
}
public void setDeadtime(String deadtime) {
this.deadtime = deadtime;
}
public String getStuid() {
return stuid;
}
public void setStuid(String stuid) {
this.stuid = stuid;
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getProperty() {
return property;
}
public void setProperty(String property) {
this.property = property;
}
public LocalDateTime getCreateTime() {
return createTime;
}
public void setCreateTime(LocalDateTime createTime) {
this.createTime = createTime;
}
public LocalDateTime getLastTime() {
return lastTime;
}
public void setLastTime(LocalDateTime lastEditTime) {
this.lastTime = lastEditTime;
}
@Override
public String toString() {
return "Task{" +
"id=" + id +
", name=" + name +
", priority=" + property +
", createTime=" + createTime +
", lastEditTime=" + lastTime +
"}";
}
}

@ -1,87 +0,0 @@
package com.example.demo.domain;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.segments.MergeSegments;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
@Data
@TableName("taskson")
public class Taskson extends Wrapper<Taskson> {
/**
* id
*/
@TableField("id")
private int id;
/**
* Task_id
*/
@TableField("Task_id")
private int Taskid;
/**
* studentnumber
*/
@TableField("studentnumber")
private String studentnumber;
/**
* finishtime
*/
@TableField("finishtime")
@DateTimeFormat(pattern = "yyyy-MM-dd")
private Date finishtime;
/**
* filepath
*/
@TableField("filepath")
private String filepath;
/**
*
*
* @return T
*/
@Override
public Taskson getEntity() {
return null;
}
/**
* MergeSegments
*/
@Override
public MergeSegments getExpression() {
return null;
}
/**
* SQL XML
* <p>使</p>
* <p>`sql` + ${ew.customSqlSegment}</p>
* <p>1. ()</p>
* <p>2.wrapper (wrapper)</p>
* <p>3. ${ew.customSqlSegment} (where,!)</p>
* <p>4.ewwrapper,</p>
*/
@Override
public String getCustomSqlSegment() {
return null;
}
@Override
public void clear() {
}
/**
* SQL
*/
@Override
public String getSqlSegment() {
return null;
}
}

@ -1,118 +0,0 @@
package com.example.demo.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.segments.MergeSegments;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
/**
*
*/
@Data
@TableName("user")
public class User extends Wrapper<User> {
private static final long serialVersionUID = 1L;
/**
* open_id
*/
@TableId(value = "open_id", type = IdType.INPUT)
private String openId;
/**
* skey
*/
private String skey;
/**
*
*/
@TableField("create_time")
@DateTimeFormat(pattern = "yyyy-MM-dd")
private Date createTime;
/**
*
*/
@TableField("last_visit_time")
@DateTimeFormat(pattern = "yyyy-MM-dd")
private Date lastVisitTime;
/**
* session_key
*/
@TableField("session_key")
private String sessionKey;
/**
*
*/
@TableField("city")
private String city;
/**
*
*/
@TableField("province")
private String province;
/**
*
*/
@TableField("country")
private String country;
/**
*
*/
@TableField("avatar_url")
private String avatarUrl;
/**
*
*/
@TableField("gender")
private Integer gender;
/**
*
*/
@TableField("nick_name")
private String nickName;
/**
*
*/
@TableField("name")
private String name;
/**
*
*/
@TableField("Student_Number")
private String StudentNumber;
/**
*
*/
@TableField("power")
private int power;
@Override
public User getEntity() {
return null;
}
@Override
public MergeSegments getExpression() {
return null;
}
@Override
public String getCustomSqlSegment() {
return null;
}
@Override
public void clear() {
}
@Override
public String getSqlSegment() {
return null;
}
}

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save