Browse Source

修改pom

yumeng 5 years ago
parent
commit
0246717ab8

+ 7 - 0
module-common/pom.xml

@@ -23,6 +23,13 @@
     </properties>
     </properties>
 
 
     <dependencies>
     <dependencies>
+
+        <dependency>
+            <groupId>thirtpart</groupId>
+            <artifactId>jave</artifactId>
+            <version>1.0</version>
+        </dependency>
+
         <dependency>
         <dependency>
             <groupId>junit</groupId>
             <groupId>junit</groupId>
             <artifactId>junit</artifactId>
             <artifactId>junit</artifactId>

+ 61 - 59
module-common/src/main/java/cn/com/ctop/common/module/service/impl/MaterialInfoServiceImpl.java

@@ -14,9 +14,8 @@ import com.alibaba.fastjson.JSONObject;
 import com.aliyuncs.mts.model.v20140618.QueryJobListResponse;
 import com.aliyuncs.mts.model.v20140618.QueryJobListResponse;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
- // import it.sauronsoftware.jave.Encoder;
+import it.sauronsoftware.jave.Encoder;
 import lombok.extern.slf4j.Slf4j;
 import lombok.extern.slf4j.Slf4j;
-import org.apache.shiro.SecurityUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
 
 
@@ -34,6 +33,8 @@ import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
 import java.util.concurrent.Executors;
 import java.util.regex.Pattern;
 import java.util.regex.Pattern;
 
 
+// import it.sauronsoftware.jave.Encoder;
+
 /**
 /**
  * 素材信息
  * 素材信息
  *
  *
@@ -49,12 +50,13 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
     private IVideoWatermarkTemplateService videoWatermarkTemplateService;
     private IVideoWatermarkTemplateService videoWatermarkTemplateService;
     @Autowired
     @Autowired
     private IVideoWatermarkTaskService videoWatermarkTaskService;
     private IVideoWatermarkTaskService videoWatermarkTaskService;
+
     @Override
     @Override
-    public void watermarkVideo(String materialId,Integer videoWatermarkTemplateId,String userId){
+    public void watermarkVideo(String materialId, Integer videoWatermarkTemplateId, String userId) {
         VideoWatermarkTemplate videoWatermarkTemplate = videoWatermarkTemplateService.getById(videoWatermarkTemplateId);
         VideoWatermarkTemplate videoWatermarkTemplate = videoWatermarkTemplateService.getById(videoWatermarkTemplateId);
         MaterialInfo materialInfo = this.getById(materialId);
         MaterialInfo materialInfo = this.getById(materialId);
         MpsUtils mpsUtils = new MpsUtils();
         MpsUtils mpsUtils = new MpsUtils();
-        String jobId = mpsUtils.videoWaterMark(materialInfo.getUrl(),videoWatermarkTemplate.getTemplatePath(),videoWatermarkTemplate.getTemplateId(),videoWatermarkTemplate.getHeight());
+        String jobId = mpsUtils.videoWaterMark(materialInfo.getUrl(), videoWatermarkTemplate.getTemplatePath(), videoWatermarkTemplate.getTemplateId(), videoWatermarkTemplate.getHeight());
         QueryJobListResponse.Job job = mpsUtils.getJobStatus(jobId);
         QueryJobListResponse.Job job = mpsUtils.getJobStatus(jobId);
         VideoWatermarkTask videoWatermarkTask = new VideoWatermarkTask();
         VideoWatermarkTask videoWatermarkTask = new VideoWatermarkTask();
         videoWatermarkTask.setJobId(jobId);
         videoWatermarkTask.setJobId(jobId);
@@ -64,6 +66,7 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
         materialInfo.setWatermarkCode(jobId);
         materialInfo.setWatermarkCode(jobId);
         this.updateById(materialInfo);
         this.updateById(materialInfo);
     }
     }
+
     @Override
     @Override
     public MaterialInfo getMaterialInfoByCode(String code) {
     public MaterialInfo getMaterialInfoByCode(String code) {
         QueryWrapper<MaterialInfo> queryWrapper = new QueryWrapper<>();
         QueryWrapper<MaterialInfo> queryWrapper = new QueryWrapper<>();
@@ -165,7 +168,7 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
                     }
                     }
                 }
                 }
             }
             }
-            //  getFile(info);
+            getFile(info);
             ResultMapUtils.setResultMap(resultMap, StatusCode.COMMON_SUCCESS.getCode());
             ResultMapUtils.setResultMap(resultMap, StatusCode.COMMON_SUCCESS.getCode());
         } catch (Exception e) {
         } catch (Exception e) {
             ResultMapUtils.setResultMap(resultMap, StatusCode.MATERIAL_UPLOAD_FAIL.getCode());
             ResultMapUtils.setResultMap(resultMap, StatusCode.MATERIAL_UPLOAD_FAIL.getCode());
@@ -269,63 +272,62 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
     @Autowired
     @Autowired
     private MaterialParameterMapper materialParameterMapper;
     private MaterialParameterMapper materialParameterMapper;
 
 
-   /* public void getFile(MaterialInfo materialInfo) {
-       *//* uploadExecutorService.submit(new Runnable() {
+    public void getFile(MaterialInfo materialInfo) {
+        uploadExecutorService.submit(new Runnable() {
             @Override
             @Override
-            public void run() {*//*
-        try {
-            System.err.println("开始获取素材基本信息");
-            System.err.println(materialInfo);
-            if (!Check.isNull(materialInfo)) {
-                String url = materialInfo.getUrl();
-                long l = System.currentTimeMillis();
-                //PropertiesUtils.getValue("kuaishou_config", "video_sava_path")
-                String localUrl = LoadFileUtil.downLoadFromUrl(url, PropertiesUtils.getValue("kuaishou_config", "video_sava_path"));
-                File file = new File(localUrl);
-                it.sauronsoftware.jave.Encoder encoder = new Encoder();
-                *//*try {*//*
-                it.sauronsoftware.jave.MultimediaInfo m = encoder.getInfo(file);
-                long duration = m.getDuration();
-                long secondDuration = duration / 1000;
-                MaterialParameter materialParameter = new MaterialParameter();
-                materialParameter.setMaterialId(materialInfo.getId());
-                // 视频秒数
-                materialParameter.setSecond(secondDuration);
-                // 视频格式
-                materialParameter.setFormat(m.getFormat());
-                // 视频宽
-                materialParameter.setWidth(String.valueOf(m.getVideo().getSize().getWidth()));
-                // 视频高
-                materialParameter.setHeight(String.valueOf(m.getVideo().getSize().getHeight()));
-
-                FileInputStream fis = new FileInputStream(file);
-                FileChannel fc = fis.getChannel();
-                BigDecimal fileSize = new BigDecimal(fc.size());
-                String size = fileSize.divide(new BigDecimal(1048576), 2, RoundingMode.HALF_UP) + "MB";
-                materialParameter.setSize(size);
-
-                Map<String, Object> deleteMap = new HashMap<>();
-                deleteMap.put("material_id", materialInfo.getId());
-                materialParameterMapper.deleteByMap(deleteMap);
-
-                int insert = materialParameterMapper.insert(materialParameter);
-                if (insert > 0) {
-                    log.info("素材基本信息入库完成,用时:{} s", (System.currentTimeMillis() - l) / 1000);
-
-                }
-                System.err.println(2222222);
-               *//* } catch (Exception e) {
+            public void run() {
+                try {
+                    System.err.println("开始获取素材基本信息");
+                    System.err.println(materialInfo);
+                    if (!Check.isNull(materialInfo)) {
+                        String url = materialInfo.getUrl();
+                        long l = System.currentTimeMillis();
+                        //PropertiesUtils.getValue("kuaishou_config", "video_sava_path")
+                        String localUrl = LoadFileUtil.downLoadFromUrl(url, PropertiesUtils.getValue("kuaishou_config", "video_sava_path"));
+                        File file = new File(localUrl);
+                        it.sauronsoftware.jave.Encoder encoder = new Encoder();
+                        try {
+                            it.sauronsoftware.jave.MultimediaInfo m = encoder.getInfo(file);
+                            long duration = m.getDuration();
+                            long secondDuration = duration / 1000;
+                            MaterialParameter materialParameter = new MaterialParameter();
+                            materialParameter.setMaterialId(materialInfo.getId());
+                            // 视频秒数
+                            materialParameter.setSecond(secondDuration);
+                            // 视频格式
+                            materialParameter.setFormat(m.getFormat());
+                            // 视频宽
+                            materialParameter.setWidth(String.valueOf(m.getVideo().getSize().getWidth()));
+                            // 视频高
+                            materialParameter.setHeight(String.valueOf(m.getVideo().getSize().getHeight()));
+
+                            FileInputStream fis = new FileInputStream(file);
+                            FileChannel fc = fis.getChannel();
+                            BigDecimal fileSize = new BigDecimal(fc.size());
+                            String size = fileSize.divide(new BigDecimal(1048576), 2, RoundingMode.HALF_UP) + "MB";
+                            materialParameter.setSize(size);
+
+                            Map<String, Object> deleteMap = new HashMap<>();
+                            deleteMap.put("material_id", materialInfo.getId());
+                            materialParameterMapper.deleteByMap(deleteMap);
+
+                            int insert = materialParameterMapper.insert(materialParameter);
+                            if (insert > 0) {
+                                log.info("素材基本信息入库完成,用时:{} s", (System.currentTimeMillis() - l) / 1000);
+
+                            }
+                        } catch (Exception e) {
+                            e.printStackTrace();
+                        } finally {
+                            file.delete();
+                        }
+                    }
+                } catch (Exception e) {
                     e.printStackTrace();
                     e.printStackTrace();
-                } *//**//*finally {
-                    file.delete();
-                }*//*
+                }
             }
             }
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
-       *//*     }
-        });*//*
-    }*/
+        });
+    }
 
 
 
 
 }
 }

+ 17 - 0
pom.xml

@@ -68,8 +68,25 @@
             <url>https://packages.atlassian.com/maven-3rdparty/</url>
             <url>https://packages.atlassian.com/maven-3rdparty/</url>
         </repository>
         </repository>
 
 
+        <repository>
+            <id>ctop</id>
+            <url>http://39.106.184.70:8081/repository/3rd_part</url>
+        </repository>
+
     </repositories>
     </repositories>
 
 
+
+    <pluginRepositories>
+        <pluginRepository>
+            <snapshots>
+                <enabled>true</enabled>
+            </snapshots>
+            <id>ctop</id>
+            <url>http://39.106.184.70:8081/repository/3rd_part</url>
+        </pluginRepository>
+    </pluginRepositories>
+
+
     <properties>
     <properties>
         <jeecgboot.common.version>2.0.2</jeecgboot.common.version>
         <jeecgboot.common.version>2.0.2</jeecgboot.common.version>
         <java.version>1.8</java.version>
         <java.version>1.8</java.version>