Pārlūkot izejas kodu

素材消耗展示

zhaoxian 4 gadi atpakaļ
vecāks
revīzija
80d7b88d52

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

@@ -760,31 +760,4 @@ public class MaterialInfoController {
         return result;
     }
 
-    /**
-     * 统计素材总消耗数据
-     *
-     * @param
-     * @return org.jeecg.common.api.vo.Result<com.baomidou.mybatisplus.core.metadata.IPage < cn.com.ctop.common.module.entity.MaterialInfo>>
-     * @throws KuaishouReportDailyMaterial
-     * @author ZHAOXA
-     */
-    @PostMapping(value = "/getMaterialTotalCharge")
-    public Result<List<JSONObject>> getMaterialTotalCharge(@RequestBody List<String> list) {
-        Result<List<JSONObject>> result = new Result<>();
-        try {
-            if (Check.isNull(list)) {
-                result.setMessage("请输入素材消息");
-                result.setSuccess(false);
-                return result;
-            }
-            List<JSONObject> arr = kuaiShouReportDailyMaterialService.getMaterialTotalCharge(list);
-            result.success("查询成功!");
-            result.setResult(arr);
-        } catch (Exception e) {
-            log.error(e.getMessage(), e);
-            result.error500("查询失败");
-        }
-        return result;
-    }
-
 }

+ 3 - 0
module-common/src/main/java/cn/com/ctop/common/module/entity/MaterialInfo.java

@@ -152,6 +152,9 @@ public class MaterialInfo {
     private BigDecimal cost;
 
     @TableField(exist = false)
+    private BigDecimal bytedanceCost;
+
+    @TableField(exist = false)
     private String realname;
 
     @TableField(exist = false)

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

@@ -1,7 +1,9 @@
 package cn.com.ctop.common.module.mapper;
 
 import cn.com.ctop.common.module.entity.MaterialParameter;
+import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Param;
 
 /**
  * 素材归属标
@@ -12,4 +14,8 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
  */
 public interface MaterialParameterMapper extends BaseMapper<MaterialParameter> {
 
+    JSONObject getMaterialTotalCharge(@Param("signature") String signature);
+
+    JSONObject getByteDanceMaterialTotalCharge(@Param("signature") String signature);
+
 }

+ 15 - 0
module-common/src/main/java/cn/com/ctop/common/module/mapper/xml/MaterialParameterMapper.xml

@@ -2,4 +2,19 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="cn.com.ctop.common.module.mapper.MaterialParameterMapper">
 
+    <select id="getMaterialTotalCharge" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT
+        signature,
+        sum(charge) as charges
+        FROM ctop_kuaishou_report_daily_material
+        WHERE signature = #{signature}
+    </select>
+
+    <select id="getByteDanceMaterialTotalCharge" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT
+        signature,
+        sum(cost) as charges
+        FROM ctop_bytedance_video_report_daily
+        WHERE signature = #{signature}
+    </select>
 </mapper>

+ 64 - 22
module-common/src/main/java/cn/com/ctop/common/module/service/impl/MaterialInfoServiceImpl.java

@@ -1,14 +1,39 @@
 package cn.com.ctop.common.module.service.impl;
 
 import cn.com.ctop.common.module.constant.CosConstant;
-import cn.com.ctop.common.module.entity.*;
+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.MaterialTagInfo;
+import cn.com.ctop.common.module.entity.Project;
+import cn.com.ctop.common.module.entity.SupplierWatermark;
+import cn.com.ctop.common.module.entity.TagInfo;
+import cn.com.ctop.common.module.entity.TencentWatermarkTemplate;
+import cn.com.ctop.common.module.entity.VideoWatermarkTask;
 import cn.com.ctop.common.module.enums.MaterialSupplierEnum;
 import cn.com.ctop.common.module.mapper.MaterialAscriptionMapper;
 import cn.com.ctop.common.module.mapper.MaterialInfoMapper;
 import cn.com.ctop.common.module.mapper.MaterialParameterMapper;
 import cn.com.ctop.common.module.mapper.MaterialTagMapper;
-import cn.com.ctop.common.module.service.*;
-import cn.com.ctop.common.module.utils.*;
+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.IMaterialTagInfoService;
+import cn.com.ctop.common.module.service.IProjectService;
+import cn.com.ctop.common.module.service.ISupplierWatermarkService;
+import cn.com.ctop.common.module.service.ITagInfoService;
+import cn.com.ctop.common.module.service.ITencentWatermarkTemplateService;
+import cn.com.ctop.common.module.service.IVideoWatermarkTaskService;
+import cn.com.ctop.common.module.utils.AesEncryptUtil;
+import cn.com.ctop.common.module.utils.Check;
+import cn.com.ctop.common.module.utils.CloudVideoProcessUtil;
+import cn.com.ctop.common.module.utils.LoadFileUtil;
+import cn.com.ctop.common.module.utils.PropertiesUtils;
+import cn.com.ctop.common.module.utils.ResultMapUtils;
+import cn.com.ctop.common.module.utils.StatusCode;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -32,7 +57,11 @@ import java.math.BigDecimal;
 import java.math.RoundingMode;
 import java.net.URLDecoder;
 import java.nio.channels.FileChannel;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
 
@@ -589,13 +618,13 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
             }
             materialTagInfoService.deleteByCode(code);
             JSONArray modalityTagList = json.getJSONArray("modalityTagList");
-            insertTagList(code,userId,modalityTagList);
+            insertTagList(code, userId, modalityTagList);
             JSONArray contentTagList = json.getJSONArray("contentTagList");
-            insertTagList(code,userId,contentTagList);
+            insertTagList(code, userId, contentTagList);
             JSONArray senceTagList = json.getJSONArray("senceTagList");
-            insertTagList(code,userId,senceTagList);
+            insertTagList(code, userId, senceTagList);
             JSONArray modTagList = json.getJSONArray("modTagList");
-            insertTagList(code,userId,modTagList);
+            insertTagList(code, userId, modTagList);
             getFile(info, project.getMediaId());
             ResultMapUtils.setResultMap(resultMap, StatusCode.COMMON_SUCCESS.getCode());
         } catch (Exception e) {
@@ -605,17 +634,18 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
         return resultMap;
     }
 
-    private void insertTagList(String code,String userId,JSONArray tagList){
-        if(null!=tagList&&!tagList.isEmpty()){
-            for(int m=0;m<tagList.size();m++){
+    private void insertTagList(String code, String userId, JSONArray tagList) {
+        if (null != tagList && !tagList.isEmpty()) {
+            for (int m = 0; m < tagList.size(); m++) {
                 Long tagId = tagList.getLong(m);
                 TagInfo tagInfo = tagInfoService.getById(tagId);
-                MaterialTagInfo setTag= new MaterialTagInfo(code,tagInfo,userId);
+                MaterialTagInfo setTag = new MaterialTagInfo(code, tagInfo, userId);
                 setTag.setCategoryId(tagInfo.getTagCategoryId());
                 materialTagInfoService.save(setTag);
             }
         }
     }
+
     @Autowired
     private ITagInfoService tagInfoService;
     @Autowired
@@ -676,14 +706,14 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
     }
 
     @Override
-    public 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> result = new HashMap<>();
-        PageHelper.startPage(pageNo,pageSize);
-        List<MaterialInfo> dailyList = materialInfoMapper.getListByParams(tagCode,type,status,projectIds,materialName,code,startDate,endDate, userId);
+    public 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> result = new HashMap<>();
+        PageHelper.startPage(pageNo, pageSize);
+        List<MaterialInfo> dailyList = materialInfoMapper.getListByParams(tagCode, type, status, projectIds, materialName, code, startDate, endDate, userId);
         List<MaterialInfo> setList = new ArrayList<>();
         PageInfo<MaterialInfo> pageInfo = new PageInfo<>(dailyList);
-        if(null!=dailyList&&!dailyList.isEmpty()){
-            for(MaterialInfo info:dailyList){
+        if (null != dailyList && !dailyList.isEmpty()) {
+            for (MaterialInfo info : dailyList) {
                 MaterialInfo materialInfo = materialInfoMapper.selectById(info.getId());
                 //判断是否已经同步到快手平台
                 Integer kuaishouMaterialUpCount = this.getKuaishouUpVideoCount(info.getCode());
@@ -699,8 +729,20 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
                 } else {
                     materialInfo.setToutiaoVideoIsUp(0);
                 }
-
-                //TODO 消耗统计
+                //统计快手总消耗数据
+                JSONObject kuaishous = materialParameterMapper.getMaterialTotalCharge(info.getCode());
+                if (!Check.isNull(kuaishous)) {
+                    materialInfo.setCost(kuaishous.getBigDecimal("charges"));
+                } else {
+                    materialInfo.setCost(new BigDecimal(0));
+                }
+                //统计抖音总消耗数据
+                JSONObject bytedances = materialParameterMapper.getByteDanceMaterialTotalCharge(info.getCode());
+                if (!Check.isNull(bytedances)) {
+                    materialInfo.setBytedanceCost(bytedances.getBigDecimal("charges"));
+                } else {
+                    materialInfo.setBytedanceCost(new BigDecimal(0));
+                }
 
                 Project project = projectService.getById(info.getProjectId());
                 if (!Check.isNull(project)) {
@@ -722,8 +764,8 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
             }
         }
         pageInfo.setList(setList);
-        result.put("data",pageInfo);
-        ResultMapUtils.setResultMap(result,StatusCode.COMMON_SUCCESS);
+        result.put("data", pageInfo);
+        ResultMapUtils.setResultMap(result, StatusCode.COMMON_SUCCESS);
         return result;
     }
 }

+ 0 - 4
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/KuaiShouReportDailyMaterialMapper.java

@@ -3,7 +3,6 @@ package cn.com.ctop.kuaishou.modules.batch.mapper;
 import cn.com.ctop.kuaishou.modules.report.entity.KuaiShouReportDailyMaterial;
 import cn.com.ctop.kuaishou.modules.report.entity.KuaiShouReportDailyMaterialVo;
 import cn.com.ctop.kuaishou.modules.report.entity.VideoGetvo;
-import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import org.apache.ibatis.annotations.Param;
 
@@ -25,7 +24,4 @@ public interface KuaiShouReportDailyMaterialMapper extends BaseMapper<KuaiShouRe
 
     List<KuaiShouReportDailyMaterialVo> getPhotoListByDate(@Param("statDate") String statDate);
 
-    List<JSONObject> getMaterialTotalCharge(@Param("list") List<String> list);
-
-    List<JSONObject> getByteDanceMaterialTotalCharge(List<String> list);
 }

+ 0 - 25
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/xml/KuaiShouReportDailyMaterialMapper.xml

@@ -143,29 +143,4 @@
       limit 1
     </select>
 
-    <select id="getMaterialTotalCharge" resultType="com.alibaba.fastjson.JSONObject">
-        SELECT
-        signature,
-        sum(charge) as kuaishouCharges
-        FROM ctop_kuaishou_report_daily_material
-        WHERE signature IN
-        <foreach item="item" index="index" collection="list" open="(" separator="," close=")">
-            #{item}
-        </foreach>
-        GROUP BY signature
-    </select>
-
-    <select id="getByteDanceMaterialTotalCharge" resultType="com.alibaba.fastjson.JSONObject">
-        SELECT
-        signature,
-        sum(cost) as bytedanceCharges
-        FROM ctop_bytedance_video_report_daily
-        WHERE signature IN
-        <foreach item="item" index="index" collection="list" open="(" separator="," close=")">
-            #{item}
-        </foreach>
-        GROUP BY signature
-    </select>
-
-
 </mapper>

+ 0 - 10
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/IKuaiShouReportDailyMaterialService.java

@@ -14,14 +14,4 @@ import java.util.List;
  */
 public interface IKuaiShouReportDailyMaterialService extends IService<KuaiShouReportDailyMaterial> {
 
-    /**
-     * 统计素材总消耗数据
-     *
-     * @param
-     * @return javax.json.JsonArray
-     * @throws
-     * @author ZHAOXA
-     */
-
-    List<JSONObject> getMaterialTotalCharge(List<String> list);
 }

+ 0 - 28
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaiShouReportDailyMaterialServiceImpl.java

@@ -1,16 +1,11 @@
 package cn.com.ctop.kuaishou.modules.batch.service.impl;
 
-import cn.com.ctop.common.module.utils.Check;
 import cn.com.ctop.kuaishou.modules.batch.mapper.KuaiShouReportDailyMaterialMapper;
 import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouReportDailyMaterialService;
 import cn.com.ctop.kuaishou.modules.report.entity.KuaiShouReportDailyMaterial;
-import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
-import java.util.List;
-
 /**
  * 素材
  *
@@ -21,27 +16,4 @@ import java.util.List;
 @Service
 public class KuaiShouReportDailyMaterialServiceImpl extends ServiceImpl<KuaiShouReportDailyMaterialMapper, KuaiShouReportDailyMaterial> implements IKuaiShouReportDailyMaterialService {
 
-    @Autowired
-    private KuaiShouReportDailyMaterialMapper kuaiShouReportDailyMaterialMapper;
-
-    @Override
-    public List<JSONObject> getMaterialTotalCharge(List<String> list) {
-        //统计快手总消耗数据
-        List<JSONObject> kuaishous = kuaiShouReportDailyMaterialMapper.getMaterialTotalCharge(list);
-        //统计抖音总消耗数据
-        List<JSONObject> bytedances = kuaiShouReportDailyMaterialMapper.getByteDanceMaterialTotalCharge(list);
-        if (!Check.isNull(kuaishous) && !Check.isNull(bytedances)) {
-            kuaishous.forEach(kuaishou -> {
-                bytedances.forEach(bytedance -> {
-                    if (kuaishou.getString("signature").equals(bytedance.getString("signature"))) {
-                        kuaishou.put("douyinCharges", bytedance.getBigDecimal("bytedanceCharges"));
-                    }
-                });
-            });
-        }
-        if (Check.isNull(kuaishous)) {
-            return bytedances;
-        }
-        return kuaishous;
-    }
 }

+ 1 - 1
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/impl/KuaishouZombieCreativeServiceImpl.java

@@ -95,7 +95,7 @@ public class KuaishouZombieCreativeServiceImpl extends ServiceImpl<KuaishouZombi
         if (!Check.isNull(zombieCreatives)) {
             List<KuaishouZombieCreative> zombiePlans = new ArrayList<>();
             List<JSONObject> zombieList = new ArrayList<>();
-            //通过账户和创意ID,筛选出确认的僵尸计划
+            //通过账户和创意ID,筛选出确认的僵尸计划账户
             zombieCreatives.forEach(zombie -> {
                 list.forEach(obj -> {
                     if (zombie.getAccountId() - obj.getInteger("accountId") == 0 && zombie.getCreativeId() - obj.getInteger("creativeId") == 0) {