Bläddra i källkod

素材列表调整

yumeng 5 år sedan
förälder
incheckning
879e43e13e

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

@@ -193,22 +193,24 @@ public class MaterialInfoController {
 
         List<MaterialInfo> materialInfoList = pageList.getRecords();
 
-        if (materialInfoList.size() != 0){
-            for (MaterialInfo material:materialInfoList){
+        if (materialInfoList.size() != 0) {
+            for (MaterialInfo material : materialInfoList) {
                 //判断是否已经同步到快手平台
                 Integer kuaishouMaterialUpCount = materialInfoService.getKuaishouUpVideoCount(material.getCode());
-                if (kuaishouMaterialUpCount>0){
+                if (kuaishouMaterialUpCount > 0) {
                     material.setKuaishouVideoIsUp(1);
-                }else{
+                } else {
                     material.setKuaishouVideoIsUp(0);
                 }
                 //判断是否已经同步到抖音平台
                 Integer toutiaoMaterialUpCount = materialInfoService.getToutiaoUpVideoCount(material.getCode());
-                if(toutiaoMaterialUpCount >0){
+                if (toutiaoMaterialUpCount > 0) {
                     material.setToutiaoVideoIsUp(1);
-                }else{
+                } else {
                     material.setToutiaoVideoIsUp(0);
                 }
+                JSONObject generalizationJson = materialInfoService.getGeneralizationInfo(material.getCode());
+                material.setGeneralization(generalizationJson);
             }
         }
 

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

@@ -1,5 +1,6 @@
 package cn.com.ctop.common.module.entity;
 
+import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
@@ -129,4 +130,7 @@ public class MaterialInfo {
     @TableField(exist = false)
     private Integer toutiaoVideoIsUp;  //判断是否已经同步到头条平台0否_1是
 
+    @TableField(exist = false)
+    private JSONObject generalization;  //概括数据
+
 }

+ 5 - 2
module-common/src/main/java/cn/com/ctop/common/module/mapper/MaterialInfoMapper.java

@@ -1,6 +1,7 @@
 package cn.com.ctop.common.module.mapper;
 
 import cn.com.ctop.common.module.entity.MaterialInfo;
+import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import org.apache.ibatis.annotations.Param;
 
@@ -21,7 +22,9 @@ public interface MaterialInfoMapper extends BaseMapper<MaterialInfo> {
 
     String getRoleCodeByUserId(@Param("userId") String userId);
 
-    Integer getKuaishouUpVideoCount(@Param("code")String code);
+    Integer getKuaishouUpVideoCount(@Param("code") String code);
 
-    Integer getToutiaoUpVideoCount(@Param("code")String code);
+    Integer getToutiaoUpVideoCount(@Param("code") String code);
+
+    JSONObject getGeneralizationInfo(@Param("code") String code);
 }

+ 25 - 6
module-common/src/main/java/cn/com/ctop/common/module/mapper/xml/MaterialInfoMapper.xml

@@ -50,12 +50,31 @@
     </select>
 
     <select id="getToutiaoUpVideoCount" resultType="java.lang.Integer">
-        select
-        count(1)
-        from
-        ctop_bytedance_video_info v
-        where
-        v.signature = #{code}
+     SELECT
+	 SUM(t.cost) cost,
+	 SUM(t.photoShow) photoShow,
+	 SUM(t.photoClick) photoClick
+      FROM
+	 (
+		SELECT
+		cost cost,
+        show_num photoShow,
+        click photoClick
+		FROM
+		ctop_bytedance_clean_material_report
+		WHERE
+		id = #{code}
+		UNION ALL
+		SELECT
+		charge cost,
+        photo_show photoShow,
+        photo_click photoClick
+		FROM
+		ctop_kuaishou_clean_material_report
+		WHERE
+		id = #{code}
+	  )t
     </select>
 
+
 </mapper>

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

@@ -38,4 +38,6 @@ public interface IMaterialInfoService extends IService<MaterialInfo> {
     Integer getKuaishouUpVideoCount(@Param("code")String code);
 
     Integer getToutiaoUpVideoCount(@Param("code")String code);
+
+    JSONObject getGeneralizationInfo(String code);
 }

+ 11 - 0
module-common/src/main/java/cn/com/ctop/common/module/service/impl/MaterialInfoServiceImpl.java

@@ -422,4 +422,15 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
     public Integer getToutiaoUpVideoCount(String code) {
         return materialInfoMapper.getToutiaoUpVideoCount(code);
     }
+
+
+    /**
+     * 获取素材概括信息
+     * @param code
+     * @return
+     */
+    @Override
+    public JSONObject getGeneralizationInfo(String code) {
+        return materialInfoMapper.getGeneralizationInfo(code);
+    }
 }