Ver Fonte

Merge remote-tracking branch 'origin/V1.1.8' into V1.1.8

zhaoxian há 4 anos atrás
pai
commit
a89affa7e1

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

@@ -6,10 +6,8 @@ import cn.com.ctop.common.module.entity.*;
 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.toutiao.modules.material.entity.BytedanceVideoSlogenInfo;
 import cn.com.ctop.toutiao.modules.material.service.IBytedanceVideoSlogenInfoService;
-import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -150,7 +148,7 @@ public class MaterialInfoController {
     public Result<Object> watermarkVideo(@RequestParam(name = "id") String id, @RequestParam(name = "watermarkTemplateId") Long watermarkTemplateId) {
         Result<Object> result = new Result<>();
         LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
-        Thread thread = new Thread(()-> materialInfoService.watermarkVideo(id, watermarkTemplateId, sysUser.getId()));
+        Thread thread = new Thread(() -> materialInfoService.watermarkVideo(id, watermarkTemplateId, sysUser.getId()));
         thread.start();
         result.setCode(200);
         result.setSuccess(true);
@@ -288,6 +286,7 @@ public class MaterialInfoController {
     @GetMapping(value = "/listV2")
     public Map<String, Object> queryPageList(String type, Integer status, Long productId, String materialName, String code,
                                              String startDate, String endDate, String tagCode,
+                                             Long projectId, String clipId, String shotId, String planId,
                                              @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
                                              @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
         LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
@@ -303,7 +302,7 @@ public class MaterialInfoController {
                 productIds = new ArrayList<>();
                 productIds.add(productId);
             }
-            return materialInfoService.getListByParams(tagCode, type, status, productIds, materialName, code, startDate, endDate, null, pageNo, pageSize);
+            return materialInfoService.getListByParams(tagCode, type, status, productIds, materialName, code, startDate, endDate, null, projectId, clipId, shotId, planId, pageNo, pageSize);
         } else if ("designTeamLeader".equals(roleCode) || "planeLeader".equals(roleCode) || "plane".equals(roleCode) || "plan".equals(roleCode) || "shot".equals(roleCode)) {
             //查询自己所在项目下的数据
             if (null == productId || productId == 0) {
@@ -313,14 +312,14 @@ public class MaterialInfoController {
                 productIds = new ArrayList<>();
                 productIds.add(productId);
             }
-            return materialInfoService.getListByParams(tagCode, type, status, productIds, materialName, code, startDate, endDate, null, pageNo, pageSize);
+            return materialInfoService.getListByParams(tagCode, type, status, productIds, materialName, code, startDate, endDate, null, projectId, clipId, shotId, planId, pageNo, pageSize);
         } else {
             //查询自己上传的视频
             if (null != productId && productId != 0) {
                 productIds = new ArrayList<>();
                 productIds.add(productId);
             }
-            return materialInfoService.getListByParams(tagCode, type, status, productIds, materialName, code, startDate, endDate, userId, pageNo, pageSize);
+            return materialInfoService.getListByParams(tagCode, type, status, productIds, materialName, code, startDate, endDate, userId, projectId, clipId, shotId, planId, pageNo, pageSize);
         }
     }
 
@@ -445,6 +444,7 @@ public class MaterialInfoController {
 
     /**
      * 头条素材信息编辑
+     *
      * @param materialInfo
      * @return
      */
@@ -507,11 +507,11 @@ public class MaterialInfoController {
             }
         }
         //添加视频文案信息
-        if(!Check.isNull(materialInfo.getSlogans())){
+        if (!Check.isNull(materialInfo.getSlogans())) {
             JSONArray slogans = materialInfo.getSlogans();
-            if(null!=slogans&&!slogans.isEmpty()){
+            if (null != slogans && !slogans.isEmpty()) {
                 LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
-                slogenInfoService.insertSlogans(materialInfoEntity.getCode(),slogans,user.getId());
+                slogenInfoService.insertSlogans(materialInfoEntity.getCode(), slogans, user.getId());
             }
         }
         boolean ok = materialInfoService.updateById(materialInfo);
@@ -532,6 +532,7 @@ public class MaterialInfoController {
 
     /**
      * 头条素材信息编辑 -- 批量通过审核
+     *
      * @param materialInfo
      * @return
      */
@@ -543,9 +544,11 @@ public class MaterialInfoController {
         for (String id : ids) {
             materialInfo.setId(id);
             Result<MaterialInfo> materialInfoResult = bytedanceEdit(materialInfo);
-            if(materialInfoResult.getCode().equals(CommonConstant.SC_OK_200)){ successNum++;}
+            if (materialInfoResult.getCode().equals(CommonConstant.SC_OK_200)) {
+                successNum++;
+            }
         }
-        return result.success("批量修改成功"+successNum+"个");
+        return result.success("批量修改成功" + successNum + "个");
 
     }
 
@@ -615,9 +618,9 @@ public class MaterialInfoController {
             result.error500("未找到对应实体");
         } else {
             //查询素材下关联的头条文案信息
-            List<BytedanceVideoSlogenInfo>slogenInfos = slogenInfoService.listByParams(materialInfo.getCode(),1);
+            List<BytedanceVideoSlogenInfo> slogenInfos = slogenInfoService.listByParams(materialInfo.getCode(), 1);
             JSONArray slogenArray = new JSONArray();
-            if(null!=slogenInfos&&!slogenInfos.isEmpty()){
+            if (null != slogenInfos && !slogenInfos.isEmpty()) {
                 slogenArray.addAll(slogenInfos);
             }
             materialInfo.setSlogans(slogenArray);

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

@@ -151,6 +151,7 @@ public class ProjectMemberController {
 
     /**
      * 获取项目以及账户信息
+     *
      * @param requestJson
      * @return
      */
@@ -245,10 +246,11 @@ public class ProjectMemberController {
             return result;
         }
         String projectName = projectMember.getProjectName();
+        Long productId = projectMember.getProductId();
         projectMember.setUserId(null);
         projectMember.setProjectName(null);
+        projectMember.setProductId(null);
         QueryWrapper<ProjectMember> queryWrapper = QueryGenerator.initQueryWrapper(projectMember, req.getParameterMap());
-
         String roleCode = sysRoleService.getRoleCodeByUserId(userId);
         if (!"admin".equals(roleCode) && !roleCode.contains("sale") && !"meidaManager".equals(roleCode)) {
             queryWrapper.eq("user_id", userId);
@@ -256,6 +258,15 @@ public class ProjectMemberController {
         if (!Check.isNull(projectName)) {
             queryWrapper.like("project_name", projectName);
         }
+        if (!Check.isNull(productId)) {
+            List<Long> projectIds = projectService.getProjectIdsByProductId(productId);
+            if (Check.isNull(projectIds)) {
+                result.setSuccess(false);
+                result.setMessage("该产品下暂无关联项目");
+                return result;
+            }
+            queryWrapper.in("project_id", projectIds);
+        }
         queryWrapper.groupBy("project_id");
         queryWrapper.orderByDesc("create_time");
         Page<ProjectMember> page = new Page<>(pageNo, pageSize);
@@ -269,8 +280,6 @@ public class ProjectMemberController {
     }
 
 
-
-
     /**
      * 分页列表查询
      *

Diff do ficheiro suprimidas por serem muito extensas
+ 2 - 4
module-common/src/main/java/cn/com/ctop/common/module/mapper/MaterialInfoMapper.java


+ 2 - 0
module-common/src/main/java/cn/com/ctop/common/module/mapper/ProjectMapper.java

@@ -27,4 +27,6 @@ public interface ProjectMapper extends BaseMapper<Project> {
     List<JSONObject> getProjectListByIds(@Param("ids") JSONArray projectIdArray);
 
     List<JSONObject> getListByMap(@Param("ids") Map<Long, Long> projectIdMap);
+
+    List<Long> getProjectIdsByProductId(@Param("productId") Long productId);
 }

+ 16 - 1
module-common/src/main/java/cn/com/ctop/common/module/mapper/xml/MaterialInfoMapper.xml

@@ -52,7 +52,6 @@
     </select>
 
 
-
     <select id="getEffiSignature" resultType="string">
         select
         efficient_video_signature
@@ -96,10 +95,26 @@
         <if test="tagCode!=null">
             left join ctop_material_tag_info tagInfo on tagInfo.code = matInfo.code
         </if>
+        <if test="ascription != null and ascription != ''">
+            left join ctop_material_ascription ascription on matInfo.code = ascription.material_id
+        </if>
         where 1=1
         <if test="tagCode!=null">
             and tagInfo.tag_code like concat(#{tagCode},'%')
         </if>
+        <if test="clipId !=null and clipId != ''">
+            and ascription.clip_id = #{clipId}
+        </if>
+        <if test="shotId !=null and shotId != ''">
+            and ascription.shot_id = #{shotId}
+        </if>
+        <if test="planId !=null and planId != ''">
+            and ascription.plan_id = #{planId}
+        </if>
+        <if test="projectId !=null and projectId != ''">
+            and matInfo.project_id = #{projectId}
+        </if>
+
         <if test="status!=null">
             and matInfo.status = #{status}
         </if>

+ 28 - 27
module-common/src/main/java/cn/com/ctop/common/module/mapper/xml/ProductMapper.xml

@@ -19,36 +19,37 @@
 
     <select id="getUserProductList" resultType="cn.com.ctop.common.module.entity.Product">
         select
-            cp.id,
-            cp.product_name as 'productName',
-            ca.name as 'advertiserName'
+        cp.id,
+        cp.product_name as 'productName',
+        ca.name as 'advertiserName'
         from
-            ctop_product cp
-                left join ctop_advertiser ca on
-                cp.advertiser_id = ca.id
+        ctop_product cp
+        left join ctop_advertiser ca on
+        cp.advertiser_id = ca.id
         where
-                cp.id in (
-                select
-                    DISTINCT(product_id)
-                from
-                    ctop_project
-                where
-                    product_id is not NULL
-                  and id in (
-                    select
-                        DISTINCT(project_id)
-                    from
-                        ctop_project_member
-                    <if test="userId !=null and userId!=''">
-                    where
-                            user_id =
-                            #{userId}
-                    </if>
-                      ) )
+        cp.id in (
+        select
+        DISTINCT(product_id)
+        from
+        ctop_project
+        where
+        product_id is not NULL
+        and id in (
+        select
+        DISTINCT(project_id)
+        from
+        ctop_project_member
+        <if test="userId !=null and userId!=''">
+            where
+            user_id =
+            #{userId}
+        </if>
+        ) )
 
-                <if test="productName != null and productName != ''">
-                    and cp.product_name like concat('%',#{productName},'%')
-                </if>
+        <if test="productName != null and productName != ''">
+            and cp.product_name like concat('%',#{productName},'%')
+        </if>
+        order by cp.create_time desc
     </select>
 
 </mapper>

+ 6 - 0
module-common/src/main/java/cn/com/ctop/common/module/mapper/xml/ProjectMapper.xml

@@ -54,5 +54,11 @@
         </foreach>
 
     </select>
+    <select id="getProjectIdsByProductId" resultType="java.lang.Long">
+        SELECT
+        id
+        from ctop_project
+        where product_id = #{productId}
+    </select>
 
 </mapper>

+ 1 - 1
module-common/src/main/java/cn/com/ctop/common/module/service/IMaterialInfoService.java

@@ -78,7 +78,7 @@ public interface IMaterialInfoService extends IService<MaterialInfo> {
 
     List<MaterialInfo> getListByDate(String startDate, String endDate);
 
-    Map<String, Object> getListByParams(String tagCode, String type, Integer status, List<Long> projectIds, String materialName, String code, String startDate, String endDate, String userId, Integer pageNo, Integer pageSize);
+    Map<String, Object> getListByParams(String tagCode, String type, Integer status, List<Long> projectIds, String materialName, String code, String startDate, String endDate, String userId, Long projectId, String clipId, String shotId, String planId, Integer pageNo, Integer pageSize);
 
     JSONArray getIdListByProject(Long projectId);
 }

+ 2 - 0
module-common/src/main/java/cn/com/ctop/common/module/service/IProjectService.java

@@ -27,4 +27,6 @@ public interface IProjectService extends IService<Project> {
 
 
     Map<Long, String> getProjectMap(Map<Long, Long> projectIdMap);
+
+    List<Long> getProjectIdsByProductId(Long productId);
 }

+ 4 - 0
module-common/src/main/java/cn/com/ctop/common/module/service/impl/FileInfoServiceImpl.java

@@ -19,6 +19,8 @@ import org.apache.commons.codec.digest.DigestUtils;
 import org.apache.http.HttpEntity;
 import org.apache.http.client.methods.CloseableHttpResponse;
 import org.apache.http.client.methods.HttpPost;
+import org.apache.http.entity.ContentType;
+import org.apache.http.entity.mime.HttpMultipartMode;
 import org.apache.http.entity.mime.MultipartEntityBuilder;
 import org.apache.http.entity.mime.content.FileBody;
 import org.apache.http.impl.client.CloseableHttpClient;
@@ -33,6 +35,7 @@ import java.io.*;
 import java.net.HttpURLConnection;
 import java.net.URI;
 import java.net.URL;
+import java.nio.charset.Charset;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -269,6 +272,7 @@ public class FileInfoServiceImpl extends ServiceImpl<FileInfoMapper, FileInfo> i
             // 其他参数
             entityBuilder.addTextBody("advertiser_id", String.valueOf(token.getAccountId()));
             entityBuilder.addTextBody("video_signature", DigestUtils.md5Hex(new FileInputStream(new File(videoPath))));
+            entityBuilder.addTextBody("filename",file.getFilename(), ContentType.create("text/plain", Charset.forName("UTF-8")));
             HttpEntity entity = entityBuilder.build();
             client = HttpClientBuilder.create().build();
             httpPost.setURI(URI.create(url));

+ 13 - 10
module-common/src/main/java/cn/com/ctop/common/module/service/impl/MaterialInfoServiceImpl.java

@@ -773,10 +773,16 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
     }
 
     @Override
-    public Map<String, Object> getListByParams(String tagCode, String type, Integer status, List<Long> productId, String materialName, String code, String startDate, String endDate, String userId, Integer pageNo, Integer pageSize) {
+    public Map<String, Object> getListByParams(String tagCode, String type, Integer status, List<Long> productId, String materialName, String code, String startDate, String endDate, String userId, Long projectId, String clipId, String shotId, String planId, Integer pageNo, Integer pageSize) {
         Map<String, Object> result = new HashMap<>();
         PageHelper.startPage(pageNo, pageSize);
-        List<MaterialInfo> dailyList = materialInfoMapper.getListByParams(tagCode, type, status, productId, materialName, code, startDate, endDate, userId);
+
+        String ascription = null;
+        if (!Check.isNull(clipId) || !Check.isNull(shotId) || !Check.isNull(planId)) {
+            ascription = "true";
+        }
+
+        List<MaterialInfo> dailyList = materialInfoMapper.getListByParams(tagCode, type, status, productId, materialName, code, startDate, endDate, userId, projectId, ascription, clipId, shotId, planId);
         List<MaterialInfo> setList = new ArrayList<>();
         PageInfo<MaterialInfo> pageInfo = new PageInfo<>(dailyList);
         if (null != dailyList && !dailyList.isEmpty()) {
@@ -810,14 +816,11 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
                 } else {
                     materialInfo.setBytedanceCost(new BigDecimal(0));
                 }
-
-                //TODO 待删除
-//                Project project = projectService.getById(info.getProjectId());
-//                if (!Check.isNull(project)) {
-//                    materialInfo.setMediaId(project.getMediaId());
-//                    materialInfo.setProjectName(project.getProjectName());
-//                }
-
+                Project project = projectService.getById(info.getProjectId());
+                if (!Check.isNull(project)) {
+                    materialInfo.setMediaId(project.getMediaId());
+                    materialInfo.setProjectName(project.getProjectName());
+                }
                 QueryWrapper<MaterialImageInfo> imageInfoQueryWrapper = new QueryWrapper<>();
                 imageInfoQueryWrapper.eq("video_id", info.getCode());
                 imageInfoQueryWrapper.eq("status", 0);

+ 5 - 0
module-common/src/main/java/cn/com/ctop/common/module/service/impl/ProjectServiceImpl.java

@@ -65,4 +65,9 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
         }
         return projectMap;
     }
+
+    @Override
+    public List<Long> getProjectIdsByProductId(Long productId) {
+        return projectMapper.getProjectIdsByProductId(productId);
+    }
 }

+ 3 - 0
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/service/impl/BytedanceVideoSlogenInfoServiceImpl.java

@@ -1,6 +1,7 @@
 package cn.com.ctop.toutiao.modules.material.service.impl;
 
 import cn.com.ctop.common.module.utils.Check;
+import cn.com.ctop.common.module.utils.StringUtils;
 import cn.com.ctop.toutiao.modules.material.entity.BytedanceVideoSlogenInfo;
 import cn.com.ctop.toutiao.modules.material.mapper.BytedanceVideoSlogenInfoMapper;
 import cn.com.ctop.toutiao.modules.material.service.IBytedanceVideoSlogenInfoService;
@@ -28,6 +29,8 @@ public class BytedanceVideoSlogenInfoServiceImpl extends ServiceImpl<BytedanceVi
         for(int i=0;i<slogans.size();i++){
             JSONObject sloganObject = slogans.getJSONObject(i);
             String title = sloganObject.getString("title");
+            title = title.replaceAll("\\{\\{","{");
+            title = title.replaceAll("\\}\\}","}");
             String creativeWordIds = Check.isNull(sloganObject.getJSONArray("creative_word_ids")) ? "" : sloganObject.getJSONArray("creative_word_ids").toJSONString();
             BytedanceVideoSlogenInfo slogenInfo = new BytedanceVideoSlogenInfo(videoCode,title,userId,creativeWordIds);
             this.save(slogenInfo);