Browse Source

处理删除顺序

wn0920
王宁 2 years ago
parent
commit
74e8de8c4a

+ 1
- 1
sapi/src/main/java/com/xhkjedu/sapi/mapper/appversion/AppRecordMapper.java View File

@@ -43,7 +43,7 @@ public interface AppRecordMapper extends TkMapper<TAppRecord> {
43 43
     TAppRecord findById(@Param("versionid") Integer versionid);
44 44
 
45 45
     /**
46
-     * 获取APP文件
46
+     * 获取APP文件
47 47
      * @Param [versionid]
48 48
      * @Author ywx
49 49
      * @Date 2021/10/26 15:58

+ 1
- 1
sapi/src/main/java/com/xhkjedu/sapi/mapper/itemtool/ReadMapper.java View File

@@ -87,7 +87,7 @@ public interface ReadMapper extends TkMapper<TRead> {
87 87
      * @Date 2021/10/26 16:25
88 88
      * @return java.util.List<java.lang.String>
89 89
      **/
90
-    List<TRead> listReadPath(Integer readid);
90
+    TRead getReadPath(Integer readid);
91 91
 
92 92
     //////////////////////////////////////////////学生WEB端//////////////////////////////////////////////
93 93
     /**

+ 1
- 1
sapi/src/main/java/com/xhkjedu/sapi/mapper/research/ResearchMapper.java View File

@@ -69,5 +69,5 @@ public interface ResearchMapper extends TkMapper<TResearch> {
69 69
      * @Date 2021/10/26 15:41
70 70
      * @return java.util.List<java.lang.String>
71 71
      **/
72
-    List<TResearch> listResarchpath(Integer researchid);
72
+    TResearch getResarchpath(Integer researchid);
73 73
 }

+ 1
- 1
sapi/src/main/java/com/xhkjedu/sapi/service/appversion/AppRecordService.java View File

@@ -33,8 +33,8 @@ public class AppRecordService {
33 33
 
34 34
     //删除
35 35
     public Integer deleteById(Integer versionid) {
36
-        Integer result = appRecordMapper.deleteByPrimaryKey(versionid);
37 36
         List<String> resourceUrls = appRecordMapper.listApppath(versionid);//获取APP文件夹
37
+        Integer result = appRecordMapper.deleteByPrimaryKey(versionid);
38 38
         if(N_Utils.isListNotEmpty(resourceUrls)){
39 39
             messageSender.resourceDel(resourceUrls);//给文件服务器发送mq删除文件
40 40
         }

+ 1
- 1
sapi/src/main/java/com/xhkjedu/sapi/service/appversion/AppStuappService.java View File

@@ -34,8 +34,8 @@ public class AppStuappService {
34 34
 
35 35
     //删除
36 36
     public Integer deleteById(Integer versionid) {
37
-        Integer result = appStuappMapper.deleteByPrimaryKey(versionid);
38 37
         List<String> resourceUrls = appStuappMapper.listApppath(versionid);//获取APP文件
38
+        Integer result = appStuappMapper.deleteByPrimaryKey(versionid);
39 39
         if(N_Utils.isListNotEmpty(resourceUrls)){
40 40
             messageSender.resourceDel(resourceUrls);//给文件服务器发送mq删除文件
41 41
         }

+ 1
- 1
sapi/src/main/java/com/xhkjedu/sapi/service/appversion/AppStuliveService.java View File

@@ -33,8 +33,8 @@ public class AppStuliveService {
33 33
 
34 34
     //删除
35 35
     public Integer deleteById(Integer versionid) {
36
-        Integer result = appStuliveMapper.deleteByPrimaryKey(versionid);
37 36
         List<String> resourceUrls = appStuliveMapper.listApppath(versionid);//获取APP文件
37
+        Integer result = appStuliveMapper.deleteByPrimaryKey(versionid);
38 38
         if(N_Utils.isListNotEmpty(resourceUrls)){
39 39
             messageSender.resourceDel(resourceUrls);//给文件服务器发送mq删除文件
40 40
         }

+ 1
- 1
sapi/src/main/java/com/xhkjedu/sapi/service/appversion/AppTeacherappService.java View File

@@ -33,8 +33,8 @@ public class AppTeacherappService {
33 33
 
34 34
     //删除
35 35
     public Integer deleteById(Integer versionid) {
36
-        Integer result = appTeacherappMapper.deleteByPrimaryKey(versionid);
37 36
         List<String> resourceUrls = appTeacherappMapper.listApppath(versionid);//获取APP文件夹
37
+        Integer result = appTeacherappMapper.deleteByPrimaryKey(versionid);
38 38
         if(N_Utils.isListNotEmpty(resourceUrls)){
39 39
             messageSender.resourceDel(resourceUrls);//给文件服务器发送mq删除文件
40 40
         }

+ 1
- 1
sapi/src/main/java/com/xhkjedu/sapi/service/appversion/AppTeacherclientService.java View File

@@ -33,8 +33,8 @@ public class AppTeacherclientService {
33 33
 
34 34
     //删除
35 35
     public Integer deleteById(Integer versionid) {
36
-        Integer result = appTeacherclientMapper.deleteByPrimaryKey(versionid);
37 36
         List<String> resourceUrls = appTeacherclientMapper.listApppath(versionid);//获取APP文件夹
37
+        Integer result = appTeacherclientMapper.deleteByPrimaryKey(versionid);
38 38
         if(N_Utils.isListNotEmpty(resourceUrls)){
39 39
             messageSender.resourceDel(resourceUrls);//给文件服务器发送mq删除文件
40 40
         }

+ 1
- 1
sapi/src/main/java/com/xhkjedu/sapi/service/appversion/AppTeacherliveService.java View File

@@ -33,8 +33,8 @@ public class AppTeacherliveService {
33 33
 
34 34
     //删除
35 35
     public Integer deleteById(Integer versionid) {
36
-        Integer result = appTeacherliveMapper.deleteByPrimaryKey(versionid);
37 36
         List<String> resourceUrls = appTeacherliveMapper.listApppath(versionid);//获取APP文件夹
37
+        Integer result = appTeacherliveMapper.deleteByPrimaryKey(versionid);
38 38
         if(N_Utils.isListNotEmpty(resourceUrls)){
39 39
             messageSender.resourceDel(resourceUrls);//给文件服务器发送mq删除文件
40 40
         }

+ 2
- 2
sapi/src/main/java/com/xhkjedu/sapi/service/appversion/AppthirdService.java View File

@@ -46,9 +46,9 @@ public class AppthirdService {
46 46
     //删除
47 47
     @Transactional(rollbackFor = Exception.class)
48 48
     public Integer deleteById(Integer appid) {
49
+        List<String> resourceUrls = appthirdHistoryMapper.listApppath(appid);//获取APP文件
49 50
         Integer result = appthirdMapper.deleteByPrimaryKey(appid);
50 51
         handleThirdManager(appid, 2);//处理应用白名单
51
-        List<String> resourceUrls = appthirdHistoryMapper.listApppath(appid);//获取APP文件夹
52 52
         if(N_Utils.isListNotEmpty(resourceUrls)){
53 53
             messageSender.resourceDel(resourceUrls);//给文件服务器发送mq删除文件
54 54
         }
@@ -150,8 +150,8 @@ public class AppthirdService {
150 150
      * @return void
151 151
      **/
152 152
     public void deleteByApphId(Integer apphid) {
153
-        appthirdHistoryMapper.deleteByPrimaryKey(apphid);
154 153
         List<String> resourceUrls = appthirdHistoryMapper.listApppath2(apphid);//获取APP文件
154
+        appthirdHistoryMapper.deleteByPrimaryKey(apphid);
155 155
         if(N_Utils.isListNotEmpty(resourceUrls)){
156 156
             messageSender.resourceDel(resourceUrls);//给文件服务器发送mq删除文件
157 157
         }

+ 10
- 14
sapi/src/main/java/com/xhkjedu/sapi/service/itemtool/ReadService.java View File

@@ -99,21 +99,17 @@ public class ReadService {
99 99
      * @return java.lang.Integer
100 100
      */
101 101
     public Integer del(Integer readid){
102
+        TRead read = readMapper.getReadPath(readid);//获取电子书文件
102 103
         Integer result = readMapper.deleteByPrimaryKey(readid);
103
-        List<TRead> readlist = readMapper.listReadPath(readid);//获取电子书文件
104
-        if(N_Utils.isListNotEmpty(readlist)){
105
-            List<String> resourceUrls = new ArrayList<>();
106
-            for(TRead r : readlist){
107
-                if(N_Utils.isNotEmpty(r.getReadthumb())){
108
-                    resourceUrls.add(r.getReadthumb());
109
-                }
110
-                if(N_Utils.isNotEmpty(r.getReadpath())){
111
-                    resourceUrls.add(r.getReadpath());
112
-                }
113
-            }
114
-            if(N_Utils.isNotEmpty(resourceUrls)){
115
-                messageSender.resourceDel(resourceUrls);//给文件服务器发送mq删除文件
116
-            }
104
+        List<String> resourceUrls = new ArrayList<>();
105
+        if(read != null && N_Utils.isNotEmpty(read.getReadthumb())){
106
+            resourceUrls.add(read.getReadthumb());
107
+        }
108
+        if(read != null && N_Utils.isNotEmpty(read.getReadpath())){
109
+            resourceUrls.add(read.getReadpath());
110
+        }
111
+        if(N_Utils.isNotEmpty(resourceUrls)){
112
+            messageSender.resourceDel(resourceUrls);//给文件服务器发送mq删除文件
117 113
         }
118 114
         return result;
119 115
     }

+ 11
- 15
sapi/src/main/java/com/xhkjedu/sapi/service/research/ResearchService.java View File

@@ -144,22 +144,18 @@ public class ResearchService {
144 144
      * @date 2020/6/11
145 145
      */
146 146
     public Integer del(Integer researchid) {
147
+        TResearch research = researchMapper.getResarchpath(researchid);//获取教研文件
147 148
         Integer result = researchMapper.deleteByPrimaryKey(researchid);
148
-        List<TResearch> relist = researchMapper.listResarchpath(researchid);//获取教研文件
149
-        if(N_Utils.isListNotEmpty(relist)){
150
-            List<String> resourceUrls = new ArrayList<>();
151
-            for(TResearch r : relist){
152
-                if(N_Utils.isNotEmpty(r.getResearchcover())){
153
-                    resourceUrls.add(r.getResearchcover());
154
-                }
155
-                if(N_Utils.isNotEmpty(r.getResearchpath())){
156
-                    resourceUrls.add(r.getResearchpath());
157
-                }
158
-            }
159
-
160
-            if(N_Utils.isListNotEmpty(resourceUrls)){
161
-                messageSender.resourceDel(resourceUrls);//给文件服务器发送mq删除文件
162
-            }
149
+        List<String> resourceUrls = new ArrayList<>();
150
+        if(research != null && N_Utils.isNotEmpty(research.getResearchcover())){
151
+            resourceUrls.add(research.getResearchcover());
152
+        }
153
+        if(research != null &&N_Utils.isNotEmpty(research.getResearchpath())){
154
+            resourceUrls.add(research.getResearchpath());
155
+        }
156
+
157
+        if(N_Utils.isListNotEmpty(resourceUrls)){
158
+            messageSender.resourceDel(resourceUrls);//给文件服务器发送mq删除文件
163 159
         }
164 160
         return result;
165 161
     }

+ 1
- 1
sapi/src/main/resources/mapper/itemtool/ReadMapper.xml View File

@@ -92,7 +92,7 @@
92 92
         update t_read set readstate=#{readstate} where readstate=#{readstate2}
93 93
     </update>
94 94
     <!--获取电子书文件夹-->
95
-    <select id="listReadPath" resultType="com.xhkjedu.sapi.model.itemtool.TRead">
95
+    <select id="getReadPath" resultType="com.xhkjedu.sapi.model.itemtool.TRead">
96 96
         SELECT readthumb,readpath FROM t_read WHERE readid=#{readid}
97 97
     </select>
98 98
 

+ 1
- 1
sapi/src/main/resources/mapper/research/ResearchMapper.xml View File

@@ -44,7 +44,7 @@
44 44
         UPDATE t_research SET researchpath=#{research.researchpath},mp4code=#{research.mp4code} WHERE researchid=#{research.researchid}
45 45
     </update>
46 46
     <!--获取教研文件-->
47
-    <select id="listResarchpath" resultType="com.xhkjedu.sapi.model.research.TResearch">
47
+    <select id="getResarchpath" resultType="com.xhkjedu.sapi.model.research.TResearch">
48 48
         SELECT researchcover,researchpath FROM t_research WHERE researchid=#{researchid}
49 49
     </select>
50 50
 </mapper>

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

@@ -269,8 +269,8 @@ public class PaperService {
269 269
      * @date 2020/6/9
270 270
      */
271 271
     public Integer delPaper(TPaper paper) {
272
-        Integer result = paperMapper.delPaper(paper.getPaperid());
273 272
         List<TPaperFile> pfilelist = paperFileService.listObjsByPaperid(paper.getPaperid());//获取作业文件夹
273
+        Integer result = paperMapper.delPaper(paper.getPaperid());
274 274
         if (N_Utils.isListNotEmpty(pfilelist)) {
275 275
             List<String> resourceUrls = new ArrayList<>();
276 276
             for (int i = 0; i < pfilelist.size(); i++) {
@@ -282,7 +282,6 @@ public class PaperService {
282 282
             }
283 283
             messageSender.resourceDel(resourceUrls);//给文件服务器发送mq删除文件
284 284
         }
285
-
286 285
         return result;
287 286
     }
288 287
 

Loading…
Cancel
Save