Browse Source

mq删除文件

tags/正式版本
王宁 2 years ago
parent
commit
16e622f38a

+ 0
- 8
sstudy/src/main/java/com/xhkjedu/sstudy/mapper/paper/PaperFileMapper.java View File

@@ -34,12 +34,4 @@ public interface PaperFileMapper extends TkMapper<TPaperFile> {
34 34
      */
35 35
     List<TPaperFile> listObjsByPaperid(@Param("paperid") Integer paperid);
36 36
 
37
-    /**
38
-     * 获取作业文件夹
39
-     * @Param [paperid]
40
-     * @Author ywx
41
-     * @Date 2021/10/26 15:29
42
-     * @return java.util.List<java.lang.String>
43
-     **/
44
-    List<String> listFolder(Integer paperid);
45 37
 }

+ 0
- 11
sstudy/src/main/java/com/xhkjedu/sstudy/service/paper/PaperFileService.java View File

@@ -50,15 +50,4 @@ public class PaperFileService {
50 50
     public List<TPaperFile> listObjsByPaperid(Integer paperid){
51 51
         return paperFileMapper.listObjsByPaperid(paperid);
52 52
     }
53
-
54
-    /**
55
-     * 获取作业文件夹
56
-     * @Param [paperid]
57
-     * @Author ywx
58
-     * @Date 2021/10/26 15:30
59
-     * @return java.util.List<java.lang.String>
60
-     **/
61
-    public List<String> listFolder(Integer paperid) {
62
-        return paperFileMapper.listFolder(paperid);
63
-    }
64 53
 }

+ 12
- 2
sstudy/src/main/java/com/xhkjedu/sstudy/service/paper/PaperService.java View File

@@ -267,9 +267,19 @@ public class PaperService {
267 267
      * @return void
268 268
      */
269 269
     public Integer delPaper(TPaper paper){
270
-        List<String> resourceUrls = paperFileService.listFolder(paper.getPaperid());//获取作业文件夹
271 270
         int result =  paperMapper.delPaper(paper.getPaperid());
272
-        messageSender.resourceDel(resourceUrls);//给文件服务器发送mq删除文件
271
+        List<TPaperFile> pfilelist = paperFileService.listObjsByPaperid(paper.getPaperid());//获取作业文件夹
272
+        if (N_Utils.isListNotEmpty(pfilelist)) {
273
+            List<String> resourceUrls = new ArrayList<>();
274
+            for (int i = 0; i < pfilelist.size(); i++) {
275
+                TPaperFile pf = pfilelist.get(i);
276
+                resourceUrls.add(pf.getFilepath());
277
+                if (i == 0) {
278
+                    resourceUrls.add(pf.getSourcepath());
279
+                }
280
+            }
281
+            messageSender.resourceDel(resourceUrls);//给文件服务器发送mq删除文件
282
+        }
273 283
         return result;
274 284
     }
275 285
 

+ 8
- 1
sstudy/src/main/java/com/xhkjedu/sstudy/service/resource/GuideService.java View File

@@ -240,8 +240,15 @@ public class GuideService {
240 240
                 resourceMapper.deleteByIdReal(resourceid);
241 241
                 Map resource = resources.get(i);
242 242
                 String resourceurl = resource.get("resourceurl").toString();
243
-                resourceurl = resourceurl.substring(0,resourceurl.lastIndexOf("/"));
244 243
                 resourceUrls.add(resourceurl);
244
+                if(N_Utils.isNotEmpty(resource.get("pdfurl"))){
245
+                    String pdfurl = resource.get("pdfurl").toString();
246
+                    resourceUrls.add(pdfurl);
247
+                }
248
+                if(N_Utils.isNotEmpty(resource.get("resourcecover"))){
249
+                    String resourcecover = resource.get("resourcecover").toString();
250
+                    resourceUrls.add(resourcecover);
251
+                }
245 252
             }
246 253
         }
247 254
 

+ 5
- 3
sstudy/src/main/resources/mapper/paper/PaperFileMapper.xml View File

@@ -12,8 +12,10 @@
12 12
         SELECT pfid,paperid,filepath,fileclass,fileorder,createtime
13 13
         FROM t_paper_file WHERE paperid=#{paperid} ORDER BY fileorder asc
14 14
     </select>
15
-    <!--获取作业文件夹-->
16
-    <select id="listFolder" resultType="java.lang.String">
17
-        SELECT SUBSTRING_INDEX(sourcepath,'/',5) FROM t_paper_file WHERE paperid=#{paperid} GROUP BY fileclass
15
+
16
+    <!-- 根据作业id获取作业附件 -->
17
+    <select id="listObjsByPaperid" resultType="com.xhkjedu.sstudy.model.paper.TPaperFile">
18
+        SELECT pfid,paperid,filepath,sourcepath,fileclass,fileorder,createtime
19
+        FROM t_paper_file WHERE paperid=#{paperid} ORDER BY fileorder asc
18 20
     </select>
19 21
 </mapper>

Loading…
Cancel
Save