Преглед изворни кода

Merge remote-tracking branch 'origin/master'

songyh пре 4 година
родитељ
комит
ec94f35c03

+ 34 - 23
jeecg-boot-module-system/src/main/java/cn/com/ctop/common/module/service/impl/MaterialInfoServiceImpl.java

@@ -18,7 +18,6 @@ import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
 import com.tencentcloudapi.mps.v20190612.models.DescribeTaskDetailResponse;
 import it.sauronsoftware.jave.Encoder;
-import it.sauronsoftware.jave.EncoderException;
 import it.sauronsoftware.jave.MultimediaInfo;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.shiro.SecurityUtils;
@@ -31,7 +30,10 @@ import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
-import java.io.*;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
 import java.math.BigDecimal;
 import java.math.RoundingMode;
 import java.net.URLDecoder;
@@ -436,8 +438,10 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
                     Long templateId = MaterialSupplierEnum.getTemplateIdBySize(Integer.valueOf(width), Integer.valueOf(height));
                     if (!Check.isNull(templateId)) {
                         Thread thread = new Thread() {
-                                @Override
-                                public void run() { watermarkVideoBySupplierCode(materialInfo.getCode(), materialInfo.getUrl(), templateId); }
+                            @Override
+                            public void run() {
+                                watermarkVideoBySupplierCode(materialInfo.getCode(), materialInfo.getUrl(), templateId);
+                            }
                         };
                         thread.start();
                     }
@@ -510,7 +514,13 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
             info.setProductId(productId);
             info.setWatermarkCode(json.getString("watermarkCode"));
             info.setStatus(0);
-            info.setMaterialName(StringUtils.getFileNameNoEx(json.getString("materialName")));
+            String fileName = AesEncryptUtil.getUrlDecoderString(url.substring(url.lastIndexOf("/") + 1));
+            String fileNameNoEx = StringUtils.getFileNameNoEx(fileName);
+            if (fileNameNoEx.contains("-")) {
+                fileNameNoEx = fileNameNoEx.substring(0, fileNameNoEx.lastIndexOf("-"));
+            }
+
+            info.setMaterialName(fileNameNoEx);
             info.setWatermarkMaterialName(json.getString("watermarkMaterialName"));
             info.setMaterialDescribe(json.getString("materialDescribe"));
             info.setCreateTime(new Date());
@@ -568,17 +578,17 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
                 //TODO 需要添加获取设计负责人代码
                 SysUser clip = userService.getById(clipId);
                 String roleCode = userService.getRoleCodeByUserId(clipId);
-                log.info("剪辑人员名称:"+clip.getRealname()+";ID:"+clipId);
+                log.info("剪辑人员名称:" + clip.getRealname() + ";ID:" + clipId);
                 String leaderName = "";
                 String leaderId = "";
-                if("designTeamLeader".equals(roleCode)){
+                if ("designTeamLeader".equals(roleCode)) {
                     leaderId = clipId;
                     leaderName = clip.getRealname();
-                }else{
+                } else {
                     leaderId = clip.getLeaderId();
                     leaderName = clip.getLeaderName();
                 }
-                log.info("负责人名称:"+leaderName+";ID:"+leaderId);
+                log.info("负责人名称:" + leaderName + ";ID:" + leaderId);
                 materialAscription.setLeaderName(leaderName);
                 materialAscription.setLeaderId(leaderId);
                 int result = materialAscriptionMapper.insert(materialAscription);
@@ -605,21 +615,21 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
 
     @Override
     public JSONArray checkArrayCode(JSONArray array) {
-        if(null == array||array.isEmpty()){
+        if (null == array || array.isEmpty()) {
             return new JSONArray();
         }
-        Map<String,String> codeMap = new HashMap<>();
+        Map<String, String> codeMap = new HashMap<>();
         JSONArray resultArray = new JSONArray();
-        for(int i=0;i<array.size();i++){
+        for (int i = 0; i < array.size(); i++) {
             JSONObject data = array.getJSONObject(i);
-            String url = "https:"+data.getString("url");
-            data.put("url",url);
+            String url = "https:" + data.getString("url");
+            data.put("url", url);
             String code = MD5Util.md5ByUrl(url);
-            if(codeMap.containsKey(code)){
+            if (codeMap.containsKey(code)) {
                 continue;
             }
-            codeMap.put(code,code);
-            data.put("code",code);
+            codeMap.put(code, code);
+            data.put("code", code);
             resultArray.add(data);
         }
         return resultArray;
@@ -716,17 +726,17 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
                 //TODO 需要添加获取设计负责人代码
                 SysUser clip = userService.getById(clipId);
                 String roleCode = userService.getRoleCodeByUserId(clipId);
-                log.info("剪辑人员名称:"+clip.getRealname()+";ID:"+clipId);
+                log.info("剪辑人员名称:" + clip.getRealname() + ";ID:" + clipId);
                 String leaderName = "";
                 String leaderId = "";
-                if("designTeamLeader".equals(roleCode)){
+                if ("designTeamLeader".equals(roleCode)) {
                     leaderId = clipId;
                     leaderName = clip.getRealname();
-                }else{
+                } else {
                     leaderId = clip.getLeaderId();
                     leaderName = clip.getLeaderName();
                 }
-                log.info("负责人名称:"+leaderName+";ID:"+leaderId);
+                log.info("负责人名称:" + leaderName + ";ID:" + leaderId);
                 materialAscription.setLeaderName(leaderName);
                 materialAscription.setLeaderId(leaderId);
                 int result = materialAscriptionMapper.insert(materialAscription);
@@ -751,6 +761,7 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
         }
         return resultMap;
     }
+
     @Autowired
     private ISysUserService userService;
 
@@ -923,7 +934,7 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
 
 
     @Override
-    public Map<String, Object> getListByParams(String tagCode, String type, Integer status, String materialName, List<Long> projectIds, String code, String startDate, String endDate, String userId, String clipId, String shotId, String planId, String leaderName,Integer offlineFlag, Integer pageNo, Integer pageSize) {
+    public Map<String, Object> getListByParams(String tagCode, String type, Integer status, String materialName, List<Long> projectIds, String code, String startDate, String endDate, String userId, String clipId, String shotId, String planId, String leaderName, Integer offlineFlag, Integer pageNo, Integer pageSize) {
         Map<String, Object> result = new HashMap<>();
         PageHelper.startPage(pageNo, pageSize);
 
@@ -941,7 +952,7 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
             endDate = endDate + " 23:59:59";
         }
 
-        List<MaterialInfo> dailyList = materialInfoMapper.getListByParams(tagCode, type, status, materialName, code, startDate, endDate, userId, projectIds, ascription, clipId, shotId, planId,leaderName, offlineFlag);
+        List<MaterialInfo> dailyList = materialInfoMapper.getListByParams(tagCode, type, status, materialName, code, startDate, endDate, userId, projectIds, ascription, clipId, shotId, planId, leaderName, offlineFlag);
         List<MaterialInfo> setList = new ArrayList<>();
         PageInfo<MaterialInfo> pageInfo = new PageInfo<>(dailyList);
         if (!dailyList.isEmpty()) {