Ver código fonte

1.7.5认证通版本下载视频功能优化

JiangChongBo 2 anos atrás
pai
commit
25b1d3e85f

+ 22 - 5
src/main/java/com/caimei/service/auth/impl/AuthServiceImpl.java

@@ -67,6 +67,8 @@ import java.nio.charset.StandardCharsets;
 import java.text.SimpleDateFormat;
 import java.util.*;
 import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
 import java.util.stream.Collectors;
 import java.util.stream.Stream;
 
@@ -1494,12 +1496,20 @@ public class AuthServiceImpl implements AuthService {
                     String fileName = "";
                 String ossurl = challengeRoundVo.getOssUrl();
                 ossurl.indexOf(".");
+                String title=challengeRoundVo.getTitle();
+                Pattern pattern = Pattern.compile("[\\s\\\\/:\\*\\?\\\"<>\\|]");
+                Matcher matcher = pattern.matcher(title);
+                title= matcher.replaceAll("");
+                if(title.length()>50){
+                    title= title.substring(0,50);
+                }
                 if ("dev".equals(active)) {
-                        fileName = zipPath + "\\"+challengeRoundVo.getTitle() + ossurl.substring(ossurl.lastIndexOf("."));
+                        fileName = zipPath + "\\"+title + ossurl.substring(ossurl.lastIndexOf("."));
                     } else {
-                        fileName = zipPath + "/"+challengeRoundVo.getTitle() + ossurl.substring(ossurl.lastIndexOf("."));
+                        fileName = zipPath + "/"+title + ossurl.substring(ossurl.lastIndexOf("."));
                     }
-                    OSSUtils.downFileByFilePath("authFile/", challengeRoundVo.getOssName(), fileName);
+
+                OSSUtils.downFileByFilePath("authFile/", challengeRoundVo.getOssName(), fileName);
 //                else {
 //                    //文件夹在uuid文件夹下创建自己包名的文件夹
 //                    String param = fileTreeVo.getId() + "," + authUserId;
@@ -1560,10 +1570,17 @@ public class AuthServiceImpl implements AuthService {
                 //普通文件直接下载到临时文件夹uuid下
                 String fileName = "";
                 String ossurl = challengeRoundVo.getOssUrl();
+                String title=challengeRoundVo.getTitle();
+                Pattern pattern = Pattern.compile("[\\s\\\\/:\\*\\?\\\"<>\\|]");
+                Matcher matcher = pattern.matcher(title);
+                title= matcher.replaceAll("");
+                if(title.length()>50){
+                    title= title.substring(0,50);
+                }
                 if ("dev".equals(active)) {
-                    fileName = zipPath + "\\"+challengeRoundVo.getTitle() +ossurl.substring(ossurl.lastIndexOf("."));
+                    fileName = zipPath + "\\"+title +ossurl.substring(ossurl.lastIndexOf("."));
                 } else {
-                    fileName = zipPath + "/"+challengeRoundVo.getTitle() + ossurl.substring(ossurl.lastIndexOf("."));
+                    fileName = zipPath + "/"+title + ossurl.substring(ossurl.lastIndexOf("."));
                 }
                 OSSUtils.downFileByFilePath("authFile/", challengeRoundVo.getOssName(), fileName);
 //                else {

+ 0 - 3
src/main/resources/mapper/AuthMapper.xml

@@ -665,9 +665,6 @@
             and (cr.userName like concat('%', #{clubUserName})
             or  cba.authParty=#{clubUserName})
         </if>
-        <if test="status != null">
-            and cr.status = #{status}
-        </if>
     </select>
     <select id="getPublishedVideo" resultType="com.caimei.model.vo.ChallengeRoundVo">
         select cr.id,cr.userName,cr.itemId,cr.title,cr.ossName,cr.ossUrl,cr.cover,cr.releaseTime,cr.status,cr.shareId,cr.authId,cba.authParty,cr.dyCommand