Sfoglia il codice sorgente

Merge branch 'test'

zhaoxian 2 anni fa
parent
commit
6e51fcabea
13 ha cambiato i file con 377 aggiunte e 87 eliminazioni
  1. 2 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/common/module/mapper/MaterialAscriptionMapper.java
  2. 2 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/common/module/mapper/MaterialTagInfoMapper.java
  3. 31 27
      jeecg-boot-module-system/src/main/java/cn/com/ctop/common/module/mapper/xml/MaterialAscriptionMapper.xml
  4. 1 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/common/module/mapper/xml/MaterialInfoMapper.xml
  5. 6 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/common/module/mapper/xml/MaterialTagInfoMapper.xml
  6. 2 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/common/module/service/IMaterialInfoService.java
  7. 2 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/common/module/service/IMaterialTagInfoService.java
  8. 16 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/common/module/service/impl/MaterialInfoServiceImpl.java
  9. 34 27
      jeecg-boot-module-system/src/main/java/cn/com/ctop/common/module/service/impl/MaterialTagInfoServiceImpl.java
  10. 200 5
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/MaterialInfoController.java
  11. 30 7
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/duxiaoman/controller/DuxiaomanMaterialInfoController.java
  12. 1 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/duxiaoman/service/IDuxiaomanMaterialInfoService.java
  13. 50 21
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/duxiaoman/service/impl/DuxiaomanMaterialInfoServiceImpl.java

+ 2 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/common/module/mapper/MaterialAscriptionMapper.java

@@ -15,4 +15,6 @@ import org.apache.ibatis.annotations.Param;
 public interface MaterialAscriptionMapper extends BaseMapper<MaterialAscription> {
 
     JSONObject selectByMaterialId(@Param("materialId") String materialId);
+
+    void updateBySignature(@Param("signature")String signature,@Param("md5") String md5);
 }

+ 2 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/common/module/mapper/MaterialTagInfoMapper.java

@@ -15,4 +15,6 @@ import java.util.List;
 public interface MaterialTagInfoMapper extends BaseMapper<MaterialTagInfo> {
 
     List<String> getByCode(@Param("signature") String signature);
+
+    void updateBySignature(@Param("signature")String signature,@Param("md5") String md5);
 }

+ 31 - 27
jeecg-boot-module-system/src/main/java/cn/com/ctop/common/module/mapper/xml/MaterialAscriptionMapper.xml

@@ -3,43 +3,47 @@
 <mapper namespace="cn.com.ctop.common.module.mapper.MaterialAscriptionMapper">
 
     <select id="selectByMaterialId" resultType="com.alibaba.fastjson.JSONObject">
-    select
-      (case
-        when clip_id != ""
+        select (case
+                    when clip_id != ""
         then (select realname from sys_user where id = clip_id)
-        else ""
-        end
-        ) clipName, /*剪辑人姓名*/
+                    else ""
+            end
+                   )    clipName, /*剪辑人姓名*/
 
-        clip_id clipId,
-        (case
-        when shot_id != ""
+               clip_id  clipId,
+               (case
+                    when shot_id != ""
         then (select realname from sys_user where id = shot_id)
-        else ""
-        end
-        ) shotName, /*拍摄人姓名*/
-        shot_id shotId,
+                    else ""
+                   end
+                   )    shotName, /*拍摄人姓名*/
+               shot_id  shotId,
 
-         (case
-        when plan_id != ""
+               (case
+                    when plan_id != ""
         then (select realname from sys_user where id = plan_id)
-        else ""
-        end
-        ) planName, /*策划人姓名*/
-        plan_id planId,
+                    else ""
+                   end
+                   )    planName, /*策划人姓名*/
+               plan_id  planId,
 
-         (case
-        when plane_id != ""
+               (case
+                    when plane_id != ""
         then (select realname from sys_user where id = plane_id)
-        else ""
-        end
-        ) planeName, /*平面姓名*/
-        plane_id planeId
+                    else ""
+                   end
+                   )    planeName, /*平面姓名*/
+               plane_id planeId
         from ctop_material_ascription
         where material_id = #{materialId}
-        order by create_time desc
-        limit 1
+        order by create_time desc limit 1
 
     </select>
 
+    <update id="updateBySignature">
+        UPDATE ctop_material_ascription
+        set code =#{md5}
+        WHERE code = #{signature}
+    </update>
+
 </mapper>

+ 1 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/common/module/mapper/xml/MaterialInfoMapper.xml

@@ -156,6 +156,7 @@
     <select id="getListByParams" resultType="cn.com.ctop.common.module.entity.MaterialInfo">
         select
         matInfo.code,
+        matInfo.material_name,
         matInfo.project_id,
         matInfo.id,
         t.slogansCount,

+ 6 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/common/module/mapper/xml/MaterialTagInfoMapper.xml

@@ -7,4 +7,10 @@
         where code = #{signature}
     </select>
 
+    <update id="updateBySignature">
+        UPDATE ctop_material_tag_info
+        set code =#{md5}
+        WHERE code = #{signature}
+    </update>
+
 </mapper>

+ 2 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/common/module/service/IMaterialInfoService.java

@@ -90,4 +90,6 @@ public interface IMaterialInfoService extends IService<MaterialInfo> {
     List<MaterialInfo> getListByProduct(Long productId);
 
     void materialSync(Long projectId, JSONArray toProjectIds);
+
+    List<MaterialInfo> getExcelListByParams(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 syncKuaishou, Integer syncBytedance, Integer materialInnovate);
 }

+ 2 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/common/module/service/IMaterialTagInfoService.java

@@ -22,4 +22,6 @@ public interface IMaterialTagInfoService extends IService<MaterialTagInfo> {
     void deleteByCode(String code);
 
     List<String> getByCode(String signature);
+
+    void updateBySignature(String signature, String md5);
 }

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

@@ -1027,6 +1027,22 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
         return result;
     }
 
+    @Override
+    public List<MaterialInfo> getExcelListByParams(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 syncKuaishou, Integer syncBytedance, Integer materialInnovate) {
+        String ascription = null;
+        //剪辑 || 拍摄 || 策划 || 设计
+        if (!Check.isNull(clipId) || !Check.isNull(shotId) || !Check.isNull(planId) || !Check.isNull(leaderName)) {
+            ascription = "true";
+        }
+        if (!Check.isNull(startDate)) {
+            startDate = startDate + " 00:00:01";
+        }
+        if (!Check.isNull(endDate)) {
+            endDate = endDate + " 23:59:59";
+        }
+        return materialInfoMapper.getListByParams(tagCode, type, status, materialName, code, startDate, endDate, userId, projectIds, ascription, clipId, shotId, planId, leaderName, offlineFlag, syncKuaishou, syncBytedance, materialInnovate);
+    }
+
 
     @Override
     public JSONArray getIdListByProject(Long projectId) {

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

@@ -24,9 +24,10 @@ import java.util.Map;
 
 /**
  * 素材标签信息
+ *
  * @author jeecg-boot
- * @date   2020-08-27
  * @version V1.0
+ * @date 2020-08-27
  */
 @Service
 public class MaterialTagInfoServiceImpl extends ServiceImpl<MaterialTagInfoMapper, MaterialTagInfo> implements IMaterialTagInfoService {
@@ -36,63 +37,64 @@ public class MaterialTagInfoServiceImpl extends ServiceImpl<MaterialTagInfoMappe
     private ITagInfoService tagInfoService;
     @Resource
     private MaterialTagInfoMapper materialTagInfoMapper;
+
     @Override
     public Map<String, Object> mark(JSONObject data, LoginUser user) {
-        Map<String,Object>result = new HashMap<>();
+        Map<String, Object> result = new HashMap<>();
         String code = data.getString("code");
-        if(null==code||"".equals(code.trim())){
+        if (null == code || "".equals(code.trim())) {
             ResultMapUtils.setResultMap(result, StatusCode.COMMON_PARAM_ERROR);
             return result;
         }
         MaterialInfo materialInfo = materialInfoService.getMaterialInfoByCode(code);
-        if(null == materialInfo){
+        if (null == materialInfo) {
             ResultMapUtils.setResultMap(result, StatusCode.COMMON_PARAM_ERROR);
             return result;
         }
         JSONArray tagList = data.getJSONArray("tagList");
-        if(null == tagList){
+        if (null == tagList) {
             ResultMapUtils.setResultMap(result, StatusCode.COMMON_PARAM_ERROR);
             return result;
         }
         //删除之前的标签信息
         this.deleteByCode(code);
-        for(int i=0;i<tagList.size();i++){
+        for (int i = 0; i < tagList.size(); i++) {
             Long tagId = tagList.getLong(i);
             TagInfo tagInfo = tagInfoService.getById(tagId);
-            MaterialTagInfo setTag= new MaterialTagInfo(code,tagInfo,user.getId());
+            MaterialTagInfo setTag = new MaterialTagInfo(code, tagInfo, user.getId());
             this.save(setTag);
         }
-        ResultMapUtils.setResultMap(result,StatusCode.COMMON_SUCCESS);
+        ResultMapUtils.setResultMap(result, StatusCode.COMMON_SUCCESS);
         return result;
     }
 
     @Override
     public Map<String, Object> getTagDetail(MaterialTagInfo materialTagInfo) {
-        Map<String,Object>result = new HashMap<>();
+        Map<String, Object> result = new HashMap<>();
         String code = materialTagInfo.getCode();
-        if(null == code||"".equals(code.trim())){
-            ResultMapUtils.setResultMap(result,StatusCode.COMMON_PARAM_ERROR);
+        if (null == code || "".equals(code.trim())) {
+            ResultMapUtils.setResultMap(result, StatusCode.COMMON_PARAM_ERROR);
             return result;
         }
-        List<MaterialTagInfo> modalityList = this.getByParams(code,1L);
-        result.put("modalityTagList",modalityList);
-        List<MaterialTagInfo> modList = this.getByParams(code,2L);
-        result.put("modTagList",modList);
-        List<MaterialTagInfo> contentList = this.getByParams(code,3L);
-        result.put("contentTagList",contentList);
-        List<MaterialTagInfo> senceList = this.getByParams(code,4L);
-        result.put("senceTagList",senceList);
-        ResultMapUtils.setResultMap(result,StatusCode.COMMON_SUCCESS);
+        List<MaterialTagInfo> modalityList = this.getByParams(code, 1L);
+        result.put("modalityTagList", modalityList);
+        List<MaterialTagInfo> modList = this.getByParams(code, 2L);
+        result.put("modTagList", modList);
+        List<MaterialTagInfo> contentList = this.getByParams(code, 3L);
+        result.put("contentTagList", contentList);
+        List<MaterialTagInfo> senceList = this.getByParams(code, 4L);
+        result.put("senceTagList", senceList);
+        ResultMapUtils.setResultMap(result, StatusCode.COMMON_SUCCESS);
         return result;
     }
 
-    public List<MaterialTagInfo> getByParams(String code,Long categotyId){
-        QueryWrapper<MaterialTagInfo>queryWrapper = new QueryWrapper<>();
-        if(null!=code&&!"".equals(code.trim())){
-            queryWrapper.eq("code",code);
+    public List<MaterialTagInfo> getByParams(String code, Long categotyId) {
+        QueryWrapper<MaterialTagInfo> queryWrapper = new QueryWrapper<>();
+        if (null != code && !"".equals(code.trim())) {
+            queryWrapper.eq("code", code);
         }
-        if(null!=categotyId&&categotyId!=0){
-            queryWrapper.eq("category_id",categotyId);
+        if (null != categotyId && categotyId != 0) {
+            queryWrapper.eq("category_id", categotyId);
         }
         return this.list(queryWrapper);
     }
@@ -100,7 +102,7 @@ public class MaterialTagInfoServiceImpl extends ServiceImpl<MaterialTagInfoMappe
     @Override
     public void deleteByCode(String code) {
         QueryWrapper<MaterialTagInfo> wrapper = new QueryWrapper<>();
-        wrapper.eq("code",code);
+        wrapper.eq("code", code);
         materialTagInfoMapper.delete(wrapper);
     }
 
@@ -108,4 +110,9 @@ public class MaterialTagInfoServiceImpl extends ServiceImpl<MaterialTagInfoMappe
     public List<String> getByCode(String signature) {
         return materialTagInfoMapper.getByCode(signature);
     }
+
+    @Override
+    public void updateBySignature(String signature, String md5) {
+        materialTagInfoMapper.updateBySignature(signature, md5);
+    }
 }

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

@@ -1,10 +1,40 @@
 package org.jeecg.modules.ctop.controller;
 
 import cn.com.ctop.common.module.constant.CtopRoleCodeConstant;
-import cn.com.ctop.common.module.entity.*;
+import cn.com.ctop.common.module.entity.ByteDanceCleanMaterialReport;
+import cn.com.ctop.common.module.entity.MaterialAscription;
+import cn.com.ctop.common.module.entity.MaterialCutFrame;
+import cn.com.ctop.common.module.entity.MaterialImageInfo;
+import cn.com.ctop.common.module.entity.MaterialInfo;
+import cn.com.ctop.common.module.entity.MaterialParameter;
+import cn.com.ctop.common.module.entity.MaterialTag;
+import cn.com.ctop.common.module.entity.Product;
+import cn.com.ctop.common.module.entity.Project;
+import cn.com.ctop.common.module.entity.UserCompany;
 import cn.com.ctop.common.module.enums.MaterialSupplierEnum;
-import cn.com.ctop.common.module.service.*;
-import cn.com.ctop.common.module.utils.*;
+import cn.com.ctop.common.module.service.IByteDanceCleanMaterialReportService;
+import cn.com.ctop.common.module.service.IMaterialAscriptionService;
+import cn.com.ctop.common.module.service.IMaterialCutFrameService;
+import cn.com.ctop.common.module.service.IMaterialImageInfoService;
+import cn.com.ctop.common.module.service.IMaterialInfoService;
+import cn.com.ctop.common.module.service.IMaterialParameterService;
+import cn.com.ctop.common.module.service.IMaterialTagService;
+import cn.com.ctop.common.module.service.IMessageTemplate;
+import cn.com.ctop.common.module.service.IProductService;
+import cn.com.ctop.common.module.service.IProjectService;
+import cn.com.ctop.common.module.service.ISendMessageService;
+import cn.com.ctop.common.module.service.ISysUserService;
+import cn.com.ctop.common.module.service.IUserCompanyService;
+import cn.com.ctop.common.module.service.IVideoWatermarkTaskService;
+import cn.com.ctop.common.module.utils.Check;
+import cn.com.ctop.common.module.utils.CloudVideoProcessUtil;
+import cn.com.ctop.common.module.utils.ExportExcelUtils;
+import cn.com.ctop.common.module.utils.HttpUtils;
+import cn.com.ctop.common.module.utils.JsonUtil;
+import cn.com.ctop.common.module.utils.KuaishouInterfaceConstant;
+import cn.com.ctop.common.module.utils.ResultMapUtils;
+import cn.com.ctop.common.module.utils.StatusCode;
+import cn.com.ctop.common.module.utils.StringUtils;
 import cn.com.ctop.toutiao.modules.material.entity.ByteDanceCreativeWordPackage;
 import cn.com.ctop.toutiao.modules.material.entity.BytedanceVideoSlogenInfo;
 import cn.com.ctop.toutiao.modules.material.service.IByteDanceCreativeWordPackageService;
@@ -17,6 +47,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
 import org.apache.shiro.SecurityUtils;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.system.query.QueryGenerator;
@@ -25,13 +56,28 @@ import org.jeecg.common.util.DateUtils;
 import org.jeecg.modules.ctop.service.IProjectMemberService;
 import org.jeecg.modules.system.service.ISysRoleService;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.*;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
 
 import javax.annotation.Resource;
 import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.io.OutputStream;
 import java.net.URLDecoder;
 import java.text.ParseException;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
@@ -497,6 +543,155 @@ public class MaterialInfoController {
         }
     }
 
+
+    /**
+     * 导出数据
+     *
+     * @param response
+     */
+    @GetMapping("/v2Excel")
+    public void getExcelReport(HttpServletResponse response, String userId, String type, Integer status, Long productId, String materialName, String code,
+                               String startDate, String endDate, String tagCode,
+                               Long projectId, String clipId, String shotId, String planId, String leaderName,
+                               Integer syncKuaishou, Integer syncBytedance, Integer materialInnovate,
+                               @RequestParam(name = "offlineFlag", required = false) Integer offlineFlag) {
+        Map<String, Object> map = new HashMap<>();
+        List<MaterialInfo> list = new ArrayList<>();
+        List<Long> projectIds = new ArrayList<>();
+        if (Check.isNull(userId)) {
+            LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+            userId = user.getId();
+        }
+        String roleCode = roleService.getRoleCodeByUserId(userId);
+        if (null == tagCode || "".equals(tagCode.trim())) {
+            tagCode = null;
+        }
+        //管理员、销售查询所有素材
+        if (CtopRoleCodeConstant.COMMON_ROLE_CODE_ADMIN.equals(roleCode) || roleCode.contains("sale")) {
+            if (!Check.isNull(projectId)) {
+                projectIds.add(projectId);
+            } else if (!Check.isNull(productId)) {
+                List<Long> projectIdsByProductId = projectService.getProjectIdsByProductId(productId);
+                projectIds.addAll(projectIdsByProductId);
+            }
+            list = materialInfoService.getExcelListByParams(tagCode, type, status, materialName, projectIds, code, startDate, endDate, null, clipId, shotId, planId, leaderName, offlineFlag, syncKuaishou, syncBytedance, materialInnovate);
+            //运营经理、运营、运营助理
+        } else if ("operator".equals(roleCode) || "kuaishouOperationManager".equals(roleCode) || "operationAssistant".equals(roleCode) || "touTiaoOperationManager".equals(roleCode) || "businessOperation".equals(roleCode)) {
+            if (!Check.isNull(projectId)) {
+                projectIds.add(projectId);
+            } else if (!Check.isNull(productId)) {
+                List<Long> partakeProjectIds = projectMemberService.getProjectIdsByProductId(productId, userId, null, null);
+                List<Long> productProjectIds = projectService.getProjectIdsByProductIdAndNotIn(productId, partakeProjectIds);
+                projectIds.addAll(partakeProjectIds);
+                projectIds.addAll(productProjectIds);
+            } else {
+                List<Long> partakeProjectIds = projectMemberService.getProjectIdsByProductId(null, userId, null, null);
+//                List<Long> productProjectIds = projectService.getProjectIdsByProductIdAndNotIn(null, partakeProjectIds);
+                projectIds.addAll(partakeProjectIds);
+//                projectIds.addAll(productProjectIds);
+            }
+            if (!Check.isNull(projectIds) && !projectIds.isEmpty()) {
+                list = materialInfoService.getExcelListByParams(tagCode, type, status, materialName, projectIds, code, startDate, endDate, null, clipId, shotId, planId, leaderName, offlineFlag, syncKuaishou, syncBytedance, materialInnovate);
+            }
+
+        } else if ("designTeamLeader".equals(roleCode) || "planeLeader".equals(roleCode) || "plane".equals(roleCode) || "plan".equals(roleCode) || "shot".equals(roleCode) || "clip".equals(roleCode)) {
+            //查询自己所在项目下的数据
+            if (!Check.isNull(projectId)) {
+                projectIds.add(projectId);
+            } else if (!Check.isNull(productId)) {
+                projectIds = projectMemberService.getProjectIdsByProductId(productId, userId, null, null);
+            } else {
+                projectIds = projectMemberService.getProjectIdsByProductId(null, userId, null, null);
+            }
+            if (!Check.isNull(projectIds) && !projectIds.isEmpty()) {
+                list = materialInfoService.getExcelListByParams(tagCode, type, status, materialName, projectIds, code, startDate, endDate, null, clipId, shotId, planId, leaderName, offlineFlag, syncKuaishou, syncBytedance, materialInnovate);
+            }
+        } else if ("CompanyManager".equals(roleCode)) {
+            UserCompany userCompany = userCompanyService.getByUserId(userId);
+            if (!Check.isNull(userCompany)) {
+                if (!Check.isNull(projectId)) {
+                    projectIds.add(projectId);
+                } else if (!Check.isNull(productId)) {
+                    List<Long> partakeProjectIds = projectMemberService.getProjectIdsByProductId(productId, null, userCompany.getCompanyId(), null);
+                    projectIds.addAll(partakeProjectIds);
+                } else {
+                    projectIds = roleService.getCompanyProjectIds(roleCode, userId);
+                }
+                if (!Check.isNull(projectIds) && !projectIds.isEmpty()) {
+                    list = materialInfoService.getExcelListByParams(tagCode, type, status, materialName, projectIds, code, startDate, endDate, null, clipId, shotId, planId, leaderName, offlineFlag, syncKuaishou, syncBytedance, materialInnovate);
+                }
+            }
+        } else if ("bytedanceDirector".equals(roleCode)) {
+            UserCompany userCompany = userCompanyService.getByUserId(userId);
+            if (!Check.isNull(userCompany)) {
+                if (!Check.isNull(projectId)) {
+                    projectIds.add(projectId);
+                } else if (!Check.isNull(productId)) {
+                    List<Long> partakeProjectIds = projectMemberService.getProjectIdsByProductId(productId, null, userCompany.getCompanyId(), "1");
+                    projectIds.addAll(partakeProjectIds);
+                } else {
+                    projectIds = roleService.getCompanyProjectIds(roleCode, userId);
+                }
+                if (!Check.isNull(projectIds) && !projectIds.isEmpty()) {
+                    list = materialInfoService.getExcelListByParams(tagCode, type, status, materialName, projectIds, code, startDate, endDate, null, clipId, shotId, planId, leaderName, offlineFlag, syncKuaishou, syncBytedance, materialInnovate);
+                }
+            }
+        } else if ("kuaishouDirector".equals(roleCode)) {
+            UserCompany userCompany = userCompanyService.getByUserId(userId);
+            if (!Check.isNull(userCompany)) {
+                if (!Check.isNull(projectId)) {
+                    projectIds.add(projectId);
+                } else if (!Check.isNull(productId)) {
+                    List<Long> partakeProjectIds = projectMemberService.getProjectIdsByProductId(productId, userId, userCompany.getCompanyId(), "2");
+                    List<Long> productProjectIds = projectService.getProjectIdsByProductIdAndNotIn(productId, partakeProjectIds);
+                    projectIds.addAll(partakeProjectIds);
+                    projectIds.addAll(productProjectIds);
+                } else {
+                    projectIds = roleService.getCompanyProjectIds(roleCode, userId);
+                }
+                if (!Check.isNull(projectIds) && !projectIds.isEmpty()) {
+                    list = materialInfoService.getExcelListByParams(tagCode, type, status, materialName, projectIds, code, startDate, endDate, null, clipId, shotId, planId, leaderName, offlineFlag, syncKuaishou, syncBytedance, materialInnovate);
+                }
+            }
+        } else {
+            //查询自己上传的视频
+            if (!Check.isNull(projectId)) {
+                projectIds.add(projectId);
+            } else if (!Check.isNull(productId)) {
+                projectIds = projectMemberService.getProjectIdsByProductId(productId, userId, null, null);
+            }
+            if (!Check.isNull(projectIds) && !projectIds.isEmpty()) {
+                list = materialInfoService.getExcelListByParams(tagCode, type, status, materialName, projectIds, code, startDate, endDate, userId, clipId, shotId, planId, leaderName, offlineFlag, syncKuaishou, syncBytedance, materialInnovate);
+            }
+        }
+
+        if (!Check.isNull(list)) {
+            try {
+                List<List<Object>> excelList = new ArrayList<>();
+                if (!list.isEmpty()) {
+                    for (MaterialInfo info : list) {
+                        List<Object> temp = new ArrayList<>();
+                        temp.add(info.getMaterialName());
+                        temp.add(info.getCode());
+                        excelList.add(temp);
+                    }
+                }
+                OutputStream os = response.getOutputStream();
+                ExportExcelUtils eeu = new ExportExcelUtils();
+                XSSFWorkbook workbook = new XSSFWorkbook();
+                String[] titles = {"素材名称", "唯一标识"};
+                eeu.exportExcelForAttendance(workbook, 0, "素材信息", titles, excelList);
+                HttpUtils.setResponseHeader(response, "clockIn.xlsx");
+                workbook.write(os);
+                os.flush();
+                os.close();
+            } catch (IOException e) {
+                log.error(e.getMessage());
+            }
+        }
+    }
+
+
     @ApiOperation(value = "素材信息-分页列表查询", notes = "素材信息-分页列表查询")
     @GetMapping(value = "/supplierList")
     public Result<IPage<MaterialInfo>> supplierList(MaterialInfo materialInfo,

+ 30 - 7
jeecg-boot-module-system/src/main/java/org/jeecg/modules/duxiaoman/controller/DuxiaomanMaterialInfoController.java

@@ -1,10 +1,13 @@
 package org.jeecg.modules.duxiaoman.controller;
 
 import cn.com.ctop.common.module.entity.Project;
+import cn.com.ctop.common.module.mapper.MaterialAscriptionMapper;
+import cn.com.ctop.common.module.service.IMaterialTagInfoService;
 import cn.com.ctop.common.module.service.IMessageTemplate;
 import cn.com.ctop.common.module.service.IProjectService;
 import cn.com.ctop.common.module.service.ISendMessageService;
 import cn.com.ctop.common.module.utils.Check;
+import cn.com.ctop.common.module.utils.CloudVideoProcessUtil;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -27,8 +30,11 @@ import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 
+import javax.annotation.Resource;
 import javax.servlet.http.HttpServletRequest;
+import java.net.URLDecoder;
 import java.util.Arrays;
+import java.util.Date;
 import java.util.List;
 
 /**
@@ -55,6 +61,12 @@ public class DuxiaomanMaterialInfoController {
     @Autowired
     private ISendMessageService sendMessageService;
 
+    @Resource
+    private MaterialAscriptionMapper materialAscriptionMapper;
+
+    @Autowired
+    private IMaterialTagInfoService materialTagInfoService;
+
     /**
      * 分页列表查询
      *
@@ -168,8 +180,25 @@ public class DuxiaomanMaterialInfoController {
         } else {
             if (!Check.isNull(duxiaomanMaterialInfo.getUrl()) && !duxiaomanMaterialInfo.getUrl().contains("https")) {
                 duxiaomanMaterialInfo.setUrl("https:" + duxiaomanMaterialInfo.getUrl());
-                duxiaomanMaterialInfo.setSignature(MD5Util.md5ByUrl(duxiaomanMaterialInfo.getUrl()));
+                String md5 = MD5Util.md5ByUrl(duxiaomanMaterialInfo.getUrl());
+                duxiaomanMaterialInfo.setSignature(md5);
+                materialAscriptionMapper.updateBySignature(duxiaomanMaterialInfoEntity.getSignature(), md5);
+                materialTagInfoService.updateBySignature(duxiaomanMaterialInfoEntity.getSignature(), md5);
+                String videoUrl = URLDecoder.decode(duxiaomanMaterialInfo.getUrl()).replace("https://media-1301855440.cos.ap-chongqing.myqcloud.com/", "");
+                String loadImage = "cutFrame/" + md5 + "/zero.jpg";
+                try {
+                    String coverUrl = CloudVideoProcessUtil.videoCutPictureHandle(videoUrl, loadImage);
+                    duxiaomanMaterialInfo.setCoverUrl(coverUrl);
+                } catch (Exception e) {
+                    e.printStackTrace();
+                }
+                if (duxiaomanMaterialInfo.getStatus() == 0) {
+                    duxiaomanMaterialInfo.setRefuseReason("");
+                    duxiaomanMaterialInfo.setAuditImagesId("");
+                }
+                duxiaomanMaterialInfo.setCreateTime(new Date());
             }
+
             boolean ok = duxiaomanMaterialInfoService.updateById(duxiaomanMaterialInfo);
             if (ok) {
                 result.success("修改成功!");
@@ -195,12 +224,6 @@ public class DuxiaomanMaterialInfoController {
         try {
             JSONArray array = datas.getJSONArray("array");
             List<DuxiaomanMaterialInfo> list = JSONArray.parseObject(array.toJSONString(), List.class);
-            for (DuxiaomanMaterialInfo info : list) {
-                if (!Check.isNull(info.getUrl()) && !info.getUrl().contains("https")) {
-                    info.setUrl("https:" + info.getUrl());
-                    info.setSignature(MD5Util.md5ByUrl(info.getUrl()));
-                }
-            }
             boolean ok = duxiaomanMaterialInfoService.updateBatchById(list);
             if (ok) {
                 result.success("修改成功!");

+ 1 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/duxiaoman/service/IDuxiaomanMaterialInfoService.java

@@ -37,4 +37,5 @@ public interface IDuxiaomanMaterialInfoService extends IService<DuxiaomanMateria
     Result<Object> getPersonnelInfo(DuxiaomanMaterialInfo duxiaomanMaterialInfo);
 
     Result<Object> materialBos(String id);
+
 }

+ 50 - 21
jeecg-boot-module-system/src/main/java/org/jeecg/modules/duxiaoman/service/impl/DuxiaomanMaterialInfoServiceImpl.java

@@ -234,24 +234,48 @@ public class DuxiaomanMaterialInfoServiceImpl extends ServiceImpl<DuxiaomanMater
             params.put("authorize", "1");
             params.put("description", materialInfo.getMaterialName());
             StringBuffer md5Str = new StringBuffer();
-            md5Str.append("app_id=").append(duAppId)
-                    .append("&authorize=1")
-                    .append("&channel_id=").append("3715834215185534246")
-                    .append("&datetime=").append(datetime)
-                    .append("&description=").append(materialInfo.getMaterialName())
-                    .append("&file_ids=").append(materialInfo.getFileId())
-                    .append("&type=").append(type).append(duToken);
-            String sign = DigestUtils.md5Hex(md5Str.toString());
-            params.put("sign", sign);
-            String resultStr = HttpUtils.httpPostRequest(duUrl + KuaishouDuXiaoManAPIConstant.MATERIAL_REPORT, params, null);
-            JSONObject resultJson = JSONObject.parseObject(resultStr);
-            log.info("----------素材报备:{}", resultJson);
-            if ((!Check.isNull(resultJson) && resultJson.getInteger("retCode") == 0)
-                    || (!Check.isNull(resultJson) && resultJson.getInteger("retCode") == 1 && resultJson.getString("retMsg").contains("已送审"))) {
-                //2:审批中
-                materialInfo.setStatus(2);
-                materialInfo.setAuditTaskId(resultJson.getString("result"));
-                baseMapper.updateById(materialInfo);
+            if (Check.isNull(materialInfo.getAuditTaskId())) {
+                md5Str.append("app_id=").append(duAppId)
+                        .append("&authorize=1")
+                        .append("&channel_id=").append("3715834215185534246")
+                        .append("&datetime=").append(datetime)
+                        .append("&description=").append(materialInfo.getMaterialName())
+                        .append("&file_ids=").append(materialInfo.getFileId())
+                        .append("&type=").append(type).append(duToken);
+                String sign = DigestUtils.md5Hex(md5Str.toString());
+                params.put("sign", sign);
+                String resultStr = HttpUtils.httpPostRequest(duUrl + KuaishouDuXiaoManAPIConstant.MATERIAL_REPORT, params, null);
+                JSONObject resultJson = JSONObject.parseObject(resultStr);
+                log.info("----------素材报备:{}", resultJson);
+                if ((!Check.isNull(resultJson) && resultJson.getInteger("retCode") == 0)
+                        || (!Check.isNull(resultJson) && resultJson.getInteger("retCode") == 1 && resultJson.getString("retMsg").contains("已送审"))) {
+                    //2:审批中
+                    materialInfo.setStatus(2);
+                    materialInfo.setAuditTaskId(resultJson.getString("result"));
+                    baseMapper.updateById(materialInfo);
+                }
+            } else {
+                md5Str.append("app_id=").append(duAppId)
+                        .append("&authorize=1")
+                        .append("&channel_id=").append("3715834215185534246")
+                        .append("&datetime=").append(datetime)
+                        .append("&description=").append(materialInfo.getMaterialName())
+                        .append("&file_ids=").append(materialInfo.getFileId())
+                        .append("&id=").append(materialInfo.getAuditTaskId())
+                        .append("&type=").append(type).append(duToken);
+                String sign = DigestUtils.md5Hex(md5Str.toString());
+                params.put("sign", sign);
+                params.put("id", materialInfo.getAuditTaskId());
+                String resultStr = HttpUtils.httpPostRequest(duUrl + KuaishouDuXiaoManAPIConstant.MATERIAL_UPDATE, params, null);
+                JSONObject resultJson = JSONObject.parseObject(resultStr);
+                log.info("----------更新任务:{}", resultJson);
+                if ((!Check.isNull(resultJson) && resultJson.getInteger("retCode") == 0)
+                        || (!Check.isNull(resultJson) && resultJson.getInteger("retCode") == 1 && resultJson.getString("retMsg").contains("已送审"))) {
+                    //2:审批中
+                    materialInfo.setStatus(2);
+//                    materialInfo.setAuditTaskId(resultJson.getString("result"));
+                    baseMapper.updateById(materialInfo);
+                }
             }
         } catch (Exception e) {
             e.printStackTrace();
@@ -284,7 +308,14 @@ public class DuxiaomanMaterialInfoServiceImpl extends ServiceImpl<DuxiaomanMater
                 JSONObject result = resultJson.getJSONObject("result");
                 Integer auditStatus = result.getInteger("audit_status");
                 auditStatus = auditStatus == 1 ? 101 : auditStatus;
-
+                QueryWrapper<DuxiaomanMaterialInfo> queryWrapper = new QueryWrapper<>();
+                queryWrapper.eq("audit_task_id", materialInfo.getAuditTaskId());
+                queryWrapper.orderByDesc("create_time");
+                queryWrapper.last("limit 1");
+                DuxiaomanMaterialInfo info = baseMapper.selectOne(queryWrapper);
+                if (!Check.isNull(info) && auditStatus == info.getStatus()) {
+                    return;
+                }
                 materialInfo.setStatus(auditStatus);
                 materialInfo.setConfirmTime(result.getString("audit_time"));
                 materialInfo.setRefuseReason(result.getString("audit_reason"));
@@ -449,8 +480,6 @@ public class DuxiaomanMaterialInfoServiceImpl extends ServiceImpl<DuxiaomanMater
         }
         return Result.ok("success");
     }
-
-
     /**
      * 添加标签
      */