Bläddra i källkod

Merge branch 'master' into test

yumeng 5 år sedan
förälder
incheckning
e622a89b42

+ 0 - 10
jeecg-boot-module-system/src/main/java/org/jeecg/JeecgApplication.java

@@ -47,14 +47,4 @@ public class JeecgApplication {
         return new RestTemplate();
     }
 
-    @Bean
-    public MultipartConfigElement multipartConfigElement() {
-        MultipartConfigFactory factory = new MultipartConfigFactory();
-        //  单个数据大小
-        factory.setMaxFileSize("10240KB"); // KB,MB
-        /// 总上传数据大小
-        factory.setMaxRequestSize("102400KB");
-        return factory.createMultipartConfig();
-    }
-
 }

+ 0 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/config/ShiroConfig.java

@@ -93,7 +93,6 @@ public class ShiroConfig {
         filterChainDefinitionMap.put("/kuaishou/report", "anon");
 		filterChainDefinitionMap.put("/ctop/bindAccount/**", "anon");
 		filterChainDefinitionMap.put("/**/*.mp4", "anon");
-        filterChainDefinitionMap.put("/bytedance", "anon");
 
 
 		//性能监控

+ 2 - 3
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/CallbackController.java

@@ -2,7 +2,6 @@ package org.jeecg.modules.ctop.controller;
 
 import cn.com.ctop.common.module.entity.CtopOauthToken;
 import cn.com.ctop.common.module.entity.UserAllocation;
-import cn.com.ctop.common.module.mapper.CtopOauthTokenMapper;
 import cn.com.ctop.common.module.mapper.UserAllocationMapper;
 import cn.com.ctop.common.module.service.IBindAccountAuthService;
 import cn.com.ctop.common.module.service.ICtopOauthTokenService;
@@ -84,7 +83,7 @@ public class CallbackController {
                     userAllocationQueryWrapper.orderByDesc("create_time");
                     userAllocationQueryWrapper.last("limit 1");
                     UserAllocation checkUserAllocation = allocationMapper.selectOne(userAllocationQueryWrapper);
-                    if (Check.isNull(checkUserAllocation)) {
+                    if (!Check.isNull(checkUserAllocation)) {
                         return "授权失败,该账号已被:" + checkUserAllocation.getAuthName() + "绑定!";
                     }
                     String advertiserId = json.getString("advertiserId");
@@ -219,7 +218,7 @@ public class CallbackController {
             userAllocationQueryWrapper.orderByDesc("create_time");
             userAllocationQueryWrapper.last("limit 1");
             UserAllocation checkUserAllocation = allocationMapper.selectOne(userAllocationQueryWrapper);
-            if (Check.isNull(checkUserAllocation)) {
+            if (!Check.isNull(checkUserAllocation)) {
                 returnMap.put("code", -1);
                 returnMap.put("desc", "授权失败,账号已被:" + checkUserAllocation.getUserName() + "绑定");
             }

+ 1 - 22
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/MaterialInfoController.java

@@ -3,7 +3,7 @@ package org.jeecg.modules.ctop.controller;
 
 import cn.com.ctop.common.module.entity.MaterialInfo;
 import cn.com.ctop.common.module.service.IMaterialInfoService;
-import cn.com.ctop.common.module.utils.*;
+import cn.com.ctop.common.module.utils.Check;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -35,7 +35,6 @@ import java.io.UnsupportedEncodingException;
 import java.net.URLDecoder;
 import java.text.ParseException;
 import java.util.Arrays;
-import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
@@ -61,26 +60,6 @@ public class MaterialInfoController {
     }
 
 
-    @RequestMapping(value = "/getMd5", consumes = "multipart/form-data;charset=utf-8")
-    public String getMd5(@RequestParam("multipartFile") MultipartFile multipartFile, HttpServletRequest request) throws IOException {
-
-        Map<String, Object> returnMap = new HashMap<>();
-        try {
-            String savaPath = PropertiesUtils.getValue("kuaishou_config", "video_sava_path");
-            FileUploadTool fileUploadTool = new FileUploadTool();
-            FileEntity entity;
-            entity = fileUploadTool.createFile(multipartFile, request, savaPath);
-
-            String path = entity.getPath();
-            String md5 = LoadFileUtil.getMD5(path);
-            return md5;
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
-        return null;
-    }
-
-
     @GetMapping(value = "/getDetail")
     public JSONObject getDetail(String materialId) {
 

+ 8 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/ProjectController.java

@@ -1,6 +1,7 @@
 package org.jeecg.modules.ctop.controller;
 
 
+import cn.com.ctop.bytedance.mapper.MaterialReportMapper;
 import cn.com.ctop.common.module.utils.Check;
 import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -67,6 +68,9 @@ public class ProjectController {
     @Autowired
     private ProjectMapper projectMapper;
 
+    @Autowired
+    private MaterialReportMapper materialReportMapper;
+
 
     /**
      * 我管理的
@@ -166,6 +170,10 @@ public class ProjectController {
             member.setProjectName(project.getProjectName());
             member.setUserId(project.getResponsibleId());
             member.setUserName(project.getResponsibleName());
+            String roleCode = materialReportMapper.getRoleCodeByUserId(project.getUserId());
+            if (!Check.isNull(roleCode)) {
+                member.setRoleCode(roleCode);
+            }
             projectMemberService.save(member);
             result.success("添加成功!");
         } catch (Exception e) {

+ 3 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/entity/ProjectMember.java

@@ -57,6 +57,8 @@ public class ProjectMember {
     @ApiModelProperty(value = "成员名称")
     private String userName;
 
+    private String roleCode;
+
 
     @TableField(exist = false)
     private String responsibleName;
@@ -70,7 +72,7 @@ public class ProjectMember {
     @TableField(exist = false)
     private String mediaId;
 
-    private String roleCode;
+
 
     /**
      * 创建时间

+ 11 - 11
module-common/pom.xml

@@ -76,16 +76,16 @@
 
     </dependencies>
     <build>
-<!--
-        <plugins>
-            <plugin>
-                <groupId>org.springframework.boot</groupId>
-                <artifactId>spring-boot-maven-plugin</artifactId>
-                <configuration>
-                    <includeSystemScope>true</includeSystemScope>
-                </configuration>
-            </plugin>
-        </plugins>-->
+        <!--
+                <plugins>
+                    <plugin>
+                        <groupId>org.springframework.boot</groupId>
+                        <artifactId>spring-boot-maven-plugin</artifactId>
+                        <configuration>
+                            <includeSystemScope>true</includeSystemScope>
+                        </configuration>
+                    </plugin>
+                </plugins>-->
 
 
         <resources>
@@ -104,7 +104,6 @@
             </resource>
 
 
-
             <!-- 解决MyBatis配置文件引入问题 -->
             <resource>
                 <directory>src/main/java</directory>
@@ -119,5 +118,6 @@
                 <directory>src/main/resources</directory>
             </resource>
         </resources>
+
     </build>
 </project>

+ 54 - 51
module-common/src/main/java/cn/com/ctop/common/module/service/impl/MaterialInfoServiceImpl.java

@@ -43,7 +43,7 @@ import java.util.regex.Pattern;
 @Slf4j
 @Service
 public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, MaterialInfo> implements IMaterialInfoService {
-    static ExecutorService executorService = Executors.newFixedThreadPool(5);
+    private static ExecutorService uploadExecutorService = Executors.newFixedThreadPool(5);
 
     @Override
     public MaterialInfo getMaterialInfoByCode(String code) {
@@ -145,7 +145,7 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
                     }
                 }
             }
-            getFile(info);
+            //  getFile(info);
             ResultMapUtils.setResultMap(resultMap, StatusCode.COMMON_SUCCESS.getCode());
         } catch (Exception e) {
             ResultMapUtils.setResultMap(resultMap, StatusCode.MATERIAL_UPLOAD_FAIL.getCode());
@@ -190,8 +190,13 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
         queryWrapper.orderByDesc("create_time");
         queryWrapper.last("limit 1");
         MaterialParameter materialParameter = materialParameterMapper.selectOne(queryWrapper);
+
         if (!Check.isNull(materialParameter)) {
             json.put("parameter", materialParameter);
+        } else {
+            MaterialParameter materialParameter1 = new MaterialParameter();
+            materialParameter1.setMaterialId(materialId);
+            json.put("parameter", materialParameter1);
         }
         JSONObject ascriptionJson = materialAscriptionMapper.selectByMaterialId(materialId);
         if (!Check.isNull(ascriptionJson)) {
@@ -247,59 +252,57 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
     private MaterialParameterMapper materialParameterMapper;
 
     public void getFile(MaterialInfo materialInfo) {
-        executorService.submit(new Runnable() {
+       /* uploadExecutorService.submit(new Runnable() {
             @Override
-            public void run() {
-                try {
-                    this.loadFile(materialInfo);
-                } catch (IOException e) {
-                    e.printStackTrace();
-                }
-            }
+            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);
 
-            private void loadFile(MaterialInfo materialInfo) throws IOException {
-                if (!Check.isNull(materialInfo)) {
-                    String url = materialInfo.getUrl();
-                    long l = System.currentTimeMillis();
-                    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();
-                    }
                 }
-
-
+                System.err.println(2222222);
+               /* } catch (Exception e) {
+                    e.printStackTrace();
+                } *//*finally {
+                    file.delete();
+                }*/
             }
-        });
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+       /*     }
+        });*/
     }
 
 

+ 0 - 2
module-kuaishou/src/main/resources/log4j.properties

@@ -1,2 +0,0 @@
-log4j.logger.org.apache.http=debug
-log4j.logger.httpclient.wire=debug

+ 0 - 19
module-kuaishou/src/main/resources/logback.xml

@@ -1,19 +0,0 @@
-<configuration debug="true">
-    <logger name="org.apache" level="DEBUG"/>
-    <logger name="org.apache.http.wire" level="DEBUG"/>
-    <logger name="org.apache.http.headers" level="DEBUG"/>
-
-    <property name="CONSOLE_LOG_PATTERN"
-              value="%date{yyyy-MM-dd HH:mm:ss}  %highlight(%-5level) %magenta(%-4relative) --- [%yellow(%15.15thread)] %cyan(%-40.40logger{39}) : %msg%n"/>
-
-
-    <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
-        <encoder>
-            <pattern>${CONSOLE_LOG_PATTERN}</pattern>
-        </encoder>
-    </appender>
-
-    <root level="ERROR">
-        <appender-ref ref="STDOUT"/>
-    </root>
-</configuration>