Przeglądaj źródła

1.修复资源查询bug
2.资源分享增加一个获取中间页接口,并进行放行

honorfire 6 miesięcy temu
rodzic
commit
70283b5b6f

+ 1 - 0
snowy-modules/snowy-web-app/src/main/java/vip/xiaonuo/web/core/config/GlobalConfigure.java

@@ -182,6 +182,7 @@ public class GlobalConfigure implements WebMvcConfigurer {
             "/resourceFile/batchDownloadFile",
             "/resourceFile/batchDownloadFile",
 
 
             "/webSocket/**",
             "/webSocket/**",
+            "/disk/courseauditrecord/getShareInfoPage",
 
 
             /* 资源中心 */
             /* 资源中心 */
             "/disk/resourcecentre/page",
             "/disk/resourcecentre/page",

+ 32 - 0
snowy-modules/snowy-web-app/src/main/resources/templates/share-page.html

@@ -0,0 +1,32 @@
+<!DOCTYPE html>
+<html lang="zh" xmlns:th="http://www.thymeleaf.org">
+<head>
+    <meta charset="UTF-8">
+    <title>资源分享</title>
+    <style>
+        body { font-family: sans-serif; text-align: center; padding-top: 50px; }
+        .button-group { margin-top: 30px; }
+        .btn {
+            display: inline-block;
+            padding: 15px 30px;
+            margin: 0 15px;
+            border: none;
+            border-radius: 8px;
+            font-size: 16px;
+            cursor: pointer;
+            text-decoration: none; /* 去掉超链接下划线 */
+        }
+        .teacher-btn { background-color: #3498db; color: white; }
+        .student-btn { background-color: #2ecc71; color: white; }
+    </style>
+</head>
+<body>
+<h1>资源分享</h1>
+<p>请选择您的身份进入查看:</p>
+
+<div class="button-group">
+    <a th:href="${tealink}" class="btn teacher-btn">我是老师</a>
+    <a th:href="${stuLink}" class="btn student-btn">我是学生</a>
+</div>
+</body>
+</html>

+ 35 - 3
snowy-plugin/snowy-plugin-disk/snowy-plugin-disk-func/src/main/java/vip/xiaonuo/disk/controller/ResourceRecordController.java

@@ -22,11 +22,14 @@ import com.github.xiaoymin.knife4j.annotations.ApiSupport;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiOperation;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.ui.Model;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RestController;
 import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.servlet.ModelAndView;
 import vip.xiaonuo.auth.core.util.StpLoginUserUtil;
 import vip.xiaonuo.auth.core.util.StpLoginUserUtil;
 import vip.xiaonuo.common.annotation.CommonLog;
 import vip.xiaonuo.common.annotation.CommonLog;
 import vip.xiaonuo.common.pojo.CommonResult;
 import vip.xiaonuo.common.pojo.CommonResult;
@@ -87,6 +90,12 @@ public class ResourceRecordController {
     @Resource
     @Resource
     private PinyinUtils pinyinUtils;
     private PinyinUtils pinyinUtils;
 
 
+    @Value("${resource.sharelink.stu}")
+    private String stuResourceShareLink;
+
+    @Value("${resource.sharelink.tea}")
+    private String teaResourceShareLink;
+
 
 
     /**
     /**
      * 资源管理-课程下拉列表
      * 资源管理-课程下拉列表
@@ -158,6 +167,8 @@ public class ResourceRecordController {
     @GetMapping("/disk/resourcecentre/page")
     @GetMapping("/disk/resourcecentre/page")
     public CommonResult<Page<Map<String,Object>>> resourcecentrePage(CourseAuditRecordPageParam courseAuditRecordPageParam, HttpServletRequest req) {
     public CommonResult<Page<Map<String,Object>>> resourcecentrePage(CourseAuditRecordPageParam courseAuditRecordPageParam, HttpServletRequest req) {
         Map param =new HashMap();
         Map param =new HashMap();
+        param.put("startTime", req.getParameter("startTime"));
+        param.put("endTime", req.getParameter("endTime"));
         //资源中心排序标识,0最新,1热门,默认为0
         //资源中心排序标识,0最新,1热门,默认为0
         String sortflag="0";
         String sortflag="0";
         if(StringUtils.isNotEmpty(req.getParameter("sortflag")))sortflag=req.getParameter("sortflag");
         if(StringUtils.isNotEmpty(req.getParameter("sortflag")))sortflag=req.getParameter("sortflag");
@@ -401,9 +412,10 @@ public class ResourceRecordController {
     public CommonResult<Map<String,Object>> getShareLink(@Valid CourseAuditRecordIdParam courseAuditRecordIdParam, HttpServletRequest req) {
     public CommonResult<Map<String,Object>> getShareLink(@Valid CourseAuditRecordIdParam courseAuditRecordIdParam, HttpServletRequest req) {
         Map result=new HashMap();
         Map result=new HashMap();
         String id=req.getParameter("id");
         String id=req.getParameter("id");
-        CourseAuditRecord courseAuditRecord=courseAuditRecordService.queryEntity(id);
-        String userfileId=courseAuditRecord.getUserfileId();
-        String shareLink="/api/webapp/resourceFile/downloadfile?userFileId="+userfileId+"&admin=true";
+//        CourseAuditRecord courseAuditRecord=courseAuditRecordService.queryEntity(id);
+//        String userfileId=courseAuditRecord.getUserfileId();
+//        String shareLink="/api/webapp/resourceFile/downloadfile?userFileId="+userfileId+"&admin=true";
+        String shareLink="/api/webapp/disk/courseauditrecord/getShareInfoPage?id="+id;
         result.put("shareLink", shareLink);
         result.put("shareLink", shareLink);
         return CommonResult.data(result);
         return CommonResult.data(result);
     }
     }
@@ -588,4 +600,24 @@ public class ResourceRecordController {
         return CommonResult.data(result);
         return CommonResult.data(result);
     }
     }
 
 
+    /**
+     * 资源管理-获取分享链接页面
+     *
+     */
+    @ApiOperationSupport(order = 5)
+    @ApiOperation("资源管理-获取分享链接页面")
+    @GetMapping("/disk/courseauditrecord/getShareInfoPage")
+    public ModelAndView getShareInfoPage(HttpServletRequest req) { // 返回ModelAndView
+        String id = req.getParameter("id");
+        String stuShareLink = stuResourceShareLink + "?id=" + id;
+        String teaShareLink = teaResourceShareLink + "?id=" + id;
+
+        ModelAndView mav = new ModelAndView();
+        mav.setViewName("share-page"); // 设置视图名称
+        mav.addObject("stuLink", stuShareLink); // 添加数据
+        mav.addObject("tealink", teaShareLink);
+
+        return mav; // 返回ModelAndView对象
+    }
+
 }
 }

+ 6 - 0
snowy-plugin/snowy-plugin-disk/snowy-plugin-disk-func/src/main/java/vip/xiaonuo/disk/mapper/mapping/CourseAuditRecordMapper.xml

@@ -106,6 +106,12 @@
         LEFT JOIN DEV_FILE t6 ON t1.COVER_IMAGE=t6.ID AND t6.DELETE_FLAG ='NOT_DELETE'
         LEFT JOIN DEV_FILE t6 ON t1.COVER_IMAGE=t6.ID AND t6.DELETE_FLAG ='NOT_DELETE'
         LEFT JOIN SYS_USER t7 ON t1.CREATE_USER =t7.ID AND t7.DELETE_FLAG ='NOT_DELETE'
         LEFT JOIN SYS_USER t7 ON t1.CREATE_USER =t7.ID AND t7.DELETE_FLAG ='NOT_DELETE'
         WHERE t1.DELETE_FLAG ='NOT_DELETE'
         WHERE t1.DELETE_FLAG ='NOT_DELETE'
+        <if test="param.startTime!=null and param.startTime != ''">
+            and t1.CREATE_TIME &gt;=#{param.startTime}
+        </if>
+        <if test="param.endTime!=null and param.endTime != ''">
+            and t1.CREATE_TIME &lt;=#{param.endTime}
+        </if>
         <if test="param.verifyStatus!=null and param.verifyStatus != ''">
         <if test="param.verifyStatus!=null and param.verifyStatus != ''">
             and t1.VERIFY_STATUS=#{param.verifyStatus}
             and t1.VERIFY_STATUS=#{param.verifyStatus}
         </if>
         </if>

+ 2 - 0
snowy-server/snowy-gateway-app/src/main/java/vip/xiaonuo/gateway/config/GatewayConfigure.java

@@ -148,6 +148,8 @@ public class GatewayConfigure {
 
 
             "/api/webapp/test/auto",
             "/api/webapp/test/auto",
 
 
+            "/api/webapp/disk/courseauditrecord/getShareInfoPage",
+
             /* 资源中心 */
             /* 资源中心 */
             "/api/webapp/disk/resourcecentre/page",
             "/api/webapp/disk/resourcecentre/page",
             "/api/webapp/disk/resourcecentre/detail",
             "/api/webapp/disk/resourcecentre/detail",