diff --git a/pom.xml b/pom.xml
index e9f3ec5b54535f420e49f862781f47925f5db214..78aa7d7b1a30afbe7e804eceb51408f9c64504e4 100644
--- a/pom.xml
+++ b/pom.xml
@@ -40,7 +40,7 @@
2.8.5
1.2.72
4.1.1
- 1.18.4
+ 1.18.20
/work/renren
@@ -75,6 +75,8 @@
aliyun-sdk-oss
3.10.2
+
+
@@ -93,6 +95,9 @@
+
+
+
javax.xml.bind
jaxb-api
@@ -306,6 +311,7 @@
org.springframework.boot
spring-boot-maven-plugin
+ 2.2.6.RELEASE
true
@@ -314,6 +320,7 @@
org.apache.maven.plugins
maven-surefire-plugin
+ 2.12.4
true
diff --git a/src/main/java/io/renren/common/utils/OssUtils.java b/src/main/java/io/renren/common/utils/OssUtils.java
new file mode 100644
index 0000000000000000000000000000000000000000..8cec693e0222e88ac1863bed8b407d5068030c9c
--- /dev/null
+++ b/src/main/java/io/renren/common/utils/OssUtils.java
@@ -0,0 +1,31 @@
+package io.renren.common.utils;
+
+import com.aliyun.oss.OSS;
+import com.aliyun.oss.OSSClientBuilder;
+
+public class OssUtils {
+ private final static String endpoint = "http://oss-cn-beijing.aliyuncs.com";
+ private final static String accessKeyId = "LTAI5tDF24ysrBBSaHfk7uNi";
+ private final static String accessKeySecret = "H3YolcFdB1Tiy0LTrMa7fXJ3CVZW10";
+ private final static String path = "ckedu2.oss-cn-beijing.aliyuncs.com";
+
+ public static OSS getOssClient() {
+ return new OSSClientBuilder().build(endpoint, accessKeyId, accessKeySecret);
+ }
+
+ public static String getEndpoint() {
+ return endpoint;
+ }
+
+ public static String getAccessKeyId() {
+ return accessKeyId;
+ }
+
+ public static String getAccessKeySecret() {
+ return accessKeySecret;
+ }
+
+ public static String getPath() {
+ return path;
+ }
+}
diff --git a/src/main/java/io/renren/components/TokenManager.java b/src/main/java/io/renren/components/TokenManager.java
new file mode 100644
index 0000000000000000000000000000000000000000..50bbb27381cabe35ca2a482cd6b411b769d4ad1f
--- /dev/null
+++ b/src/main/java/io/renren/components/TokenManager.java
@@ -0,0 +1,34 @@
+package io.renren.components;
+
+import io.jsonwebtoken.*;
+import org.springframework.stereotype.Component;
+
+import java.util.Date;
+
+@Component
+public class TokenManager {
+ //token有效时长
+ private static long tokenEcpiration = 24 * 60 * 60 * 1000;
+ //编码秘钥
+ private static String tokenSignKey = "ckedu_student_";
+
+ //1 使用jwt根据用户名生成token
+ public String createToken(String username) {
+ String token = Jwts.builder().setSubject(username)
+ .setExpiration(new Date(System.currentTimeMillis() + tokenEcpiration))
+ .signWith(SignatureAlgorithm.HS512, tokenSignKey).compressWith(CompressionCodecs.GZIP).compact();
+ return token;
+ }
+
+ //2 根据token字符串得到用户信息
+ public String getUserInfoFromToken(String token) {
+ token = token.substring(1, token.length() - 1);
+ Claims claims;
+ try {
+ claims = Jwts.parser().setSigningKey(tokenSignKey).parseClaimsJws(token).getBody();
+ } catch (ExpiredJwtException e) {
+ claims = e.getClaims();
+ }
+ return claims.getSubject();
+ }
+}
diff --git a/src/main/java/io/renren/modules/generator/controller/ActivemodelController.java b/src/main/java/io/renren/modules/generator/controller/ActivemodelController.java
index d1237bb7b578a74388db477e88540d9357f8d250..d303a0e51fa022dd586f12b22da3c2fddd115198 100644
--- a/src/main/java/io/renren/modules/generator/controller/ActivemodelController.java
+++ b/src/main/java/io/renren/modules/generator/controller/ActivemodelController.java
@@ -1,10 +1,11 @@
package io.renren.modules.generator.controller;
+import java.io.IOException;
import java.util.*;
-import io.renren.modules.generator.entity.ActionmodelEntity;
-import io.renren.modules.generator.entity.QuestionEntity;
-import io.renren.modules.generator.service.ActionmodelService;
+import io.renren.modules.generator.entity.*;
+import io.renren.modules.generator.service.*;
+import org.apache.commons.lang.StringUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.connection.convert.MapToPropertiesConverter;
@@ -14,11 +15,11 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
-import io.renren.modules.generator.entity.ActivemodelEntity;
-import io.renren.modules.generator.service.ActivemodelService;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.R;
+import org.springframework.web.multipart.MultipartFile;
+import javax.servlet.http.HttpServletRequest;
/**
@@ -33,81 +34,536 @@ import io.renren.common.utils.R;
public class ActivemodelController {
@Autowired
private ActivemodelService activemodelService;
+
@Autowired
private ActionmodelService actionmodelService;
+ @Autowired
+ private ClassesService classesService;
+
+ @Autowired
+ private StudentService studentService;
+
+ @Autowired
+ private QuestionService questionService;
+
+ @Autowired
+ private AnswerService answerService;
+
+ @Autowired
+ private FeetbackService feetbackService;
+
+ @Autowired
+ private PictureService pictureService;
+
//2021 11/20 接口类型: "读" 测试人:ZhangShiYu
//根据单元的id获取该单元所有的活动
@RequestMapping("/getAllActive")
- public R getAllActive(@RequestParam Map params){
+ public R getAllActive(@RequestParam Map params) {
Object unit_id = params.get("unit_id");
- if (unit_id==null)
+ if (unit_id == null)
return R.error("传递字段缺少");
List allActiveModel = activemodelService.getAllActiveModel(unit_id.toString());
- if (allActiveModel==null)
+ if (allActiveModel == null)
return R.error("没有这个单元");
- return R.ok().put("active_list",allActiveModel);
+ return R.ok().put("active_list", allActiveModel);
}
//2021 11/21 接口类型: "读" 测试人:ZhangShiYu
//根据活动的id获取该活动下的所有的板块以及板块的题目
@RequestMapping("/getAll")
- public R getAllActionAndQuestion(@RequestParam Map params){
+ public R getAllActionAndQuestion(@RequestParam Map params) {
//获取活动id
Object a_id = params.get("a_id");
- if (a_id==null)
+ if (a_id == null)
return R.error("传递字段缺少");
//根据活动id查询该活动下的所有的板块实体
List allActionByAId = actionmodelService.getAllActionByAId(a_id.toString());
//创建一个Map数组
- ArrayList