Browse Source

Merge branch 'zzy' into test

yangzian 3 years ago
parent
commit
c7495061b6
16 changed files with 330 additions and 11 deletions
  1. 16 0
      jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/DateUtils.java
  2. 1 0
      jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/config/shiro/ShiroConfig.java
  3. 47 0
      jeecg-boot-material-view/src/main/java/org/jeecg/ctop/material/controller/BossDataExhibitionController.java
  4. 31 0
      jeecg-boot-material-view/src/main/java/org/jeecg/ctop/material/mapper/BossDataExhibitionMapper.java
  5. 90 0
      jeecg-boot-material-view/src/main/java/org/jeecg/ctop/material/mapper/xml/BossDataExhibitionMapper.xml
  6. 21 0
      jeecg-boot-material-view/src/main/java/org/jeecg/ctop/material/service/IBossDataExhibitionService.java
  7. 62 0
      jeecg-boot-material-view/src/main/java/org/jeecg/ctop/material/service/impl/BossDataExhibitionServiceImpl.java
  8. 13 6
      jeecg-boot-material-view/src/main/resources/application-dev.yml
  9. 4 1
      jeecg-boot-module-system/src/main/java/cn/com/ctop/common/module/mapper/xml/ProjectMapper.xml
  10. 2 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/hosting/entity/KuaishouHostingTask.java
  11. 6 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/hosting/entity/KuaishouHostingTemplate.java
  12. 4 2
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/hosting/mapper/xml/KuaishouHostingTaskMapper.xml
  13. 13 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/hosting/service/impl/KuaishouHostingTaskServiceImpl.java
  14. 1 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/PerformanceAreaController.java
  15. 10 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/entity/ProjectMember.java
  16. 9 2
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/ProjectMemberServiceImpl.java

+ 16 - 0
jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/DateUtils.java

@@ -1798,4 +1798,20 @@ public class DateUtils extends PropertyEditorSupport {
             return false;
         }
     }
+
+    /**
+     * 日期转int
+     * 2022-01-18 ====>>>> 20220118
+     * @param date
+     * @return
+     */
+    public static Integer getDateInteger(String date) {
+        if (!date.isEmpty()) {
+            String replace = date.replace("-", "");
+            return Integer.valueOf(replace);
+        }
+        return null;
+    }
+
+
 }

+ 1 - 0
jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/config/shiro/ShiroConfig.java

@@ -243,6 +243,7 @@ public class ShiroConfig {
         filterChainDefinitionMap.put("/task/kuaishouHostingTask/**", "anon");
         filterChainDefinitionMap.put("/audienceReport/**", "anon");
         filterChainDefinitionMap.put("/stare/**", "anon");
+        filterChainDefinitionMap.put("/boss/**", "anon");
         // 添加自己的过滤器并且取名为jwt
         Map<String, Filter> filterMap = new HashMap<>(1);
         filterMap.put("jwt", new JwtFilter());

+ 47 - 0
jeecg-boot-material-view/src/main/java/org/jeecg/ctop/material/controller/BossDataExhibitionController.java

@@ -0,0 +1,47 @@
+package org.jeecg.ctop.material.controller;
+
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.ctop.material.service.IBossDataExhibitionService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * Administrator
+ * 2022/1/17
+ **/
+@Slf4j
+@Api(tags="boss数据看板")
+@RestController
+@RequestMapping("/boss/bossDataExhibitionController")
+public class BossDataExhibitionController {
+
+    @Autowired
+    private IBossDataExhibitionService bossDataExhibitionServiceImpl;
+
+
+
+
+
+    @ApiOperation(value="素材产出占比", notes="素材产出占比")
+    @GetMapping(value = "/getMeterialProduceRate")
+    public Result getMeterialProduceRate(
+            @RequestParam(name="mediaType",defaultValue = "2") String mediaType,
+            @RequestParam(name="startTime") String startTime,
+            @RequestParam(name="endTime") String endTime) {
+        return bossDataExhibitionServiceImpl.getMeterialProduceRate(mediaType,startTime,endTime);
+    }
+
+
+
+
+
+
+
+}

+ 31 - 0
jeecg-boot-material-view/src/main/java/org/jeecg/ctop/material/mapper/BossDataExhibitionMapper.java

@@ -0,0 +1,31 @@
+package org.jeecg.ctop.material.mapper;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.math.BigDecimal;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+@Mapper
+public interface BossDataExhibitionMapper {
+
+    /**
+     * 素材产出占比 快手
+     * @param startTime
+     * @param endTime
+     * @return
+     */
+    List<Map<String,Object>> getMeterialProduceRateKuaiShou(@Param("startTime") Integer startTime,@Param("endTime") Integer endTime);
+
+    /**
+     * 素材产出占比 头条
+     * @param startTime
+     * @param endTime
+     * @return
+     */
+    List<Map<String,Object>> getMeterialProduceRateBytedance(@Param("startTime") Integer startTime,@Param("endTime") Integer endTime);
+}

+ 90 - 0
jeecg-boot-material-view/src/main/java/org/jeecg/ctop/material/mapper/xml/BossDataExhibitionMapper.xml

@@ -0,0 +1,90 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="org.jeecg.ctop.material.mapper.BossDataExhibitionMapper">
+
+    <!--  素材产出占比 快手 -->
+    <select id="getMeterialProduceRateKuaiShou" resultType="java.util.LinkedHashMap">
+        SELECT t.* ,
+        CONCAT(ROUND(t.meterialNum / t.total,2) ,'%')as rate
+        from (
+        SELECT
+        COUNT( material_id ) meterialNum ,
+        CASE company_name
+        WHEN '北京汇创思拓数字科技有限公司' then '华北'
+        WHEN '广州汇创思拓数字科技有限公司' then '华南'
+        WHEN '上海汇创思拓数字科技有限公司' then '华东'
+        WHEN '杭州妙构思数字科技有限公司' then '杭州'
+        WHEN '北京骄阳数字科技有限公司' then '骄阳'
+        else '其他'
+        end area,
+        company_name as companyName,
+        (SELECT COUNT(material_id) as num
+        FROM app_kuaishou_material_info
+            <where>
+                <if test="startTime !=null and startTime != ''">
+                    AND media_time &gt;= #{startTime}
+                </if>
+                <if test="endTime !=null and endTime != ''">
+                    AND media_time &lt;= #{endTime}
+                </if>
+            </where>
+            ) as total
+        FROM
+        app_kuaishou_material_info
+        <where>
+            <if test="startTime !=null and startTime != ''">
+                AND media_time &gt;= #{startTime}
+            </if>
+            <if test="endTime !=null and endTime != ''">
+                AND media_time &lt;= #{endTime}
+            </if>
+        </where>
+        GROUP BY
+        company_id
+        ) t
+    </select>
+
+
+    <!--  素材产出占比 头条 -->
+    <select id="getMeterialProduceRateBytedance" resultType="java.util.LinkedHashMap">
+        SELECT t.* ,
+        CONCAT(ROUND(t.meterialNum / t.total * 100,2) ,'%')as rate
+        from (
+        SELECT
+        COUNT( material_id ) meterialNum,
+        CASE company_name
+        WHEN '北京汇创思拓数字科技有限公司' then '华北'
+        WHEN '广州汇创思拓数字科技有限公司' then '华南'
+        WHEN '上海汇创思拓数字科技有限公司' then '华东'
+        WHEN '北京次元像素' then '石家庄'
+        WHEN '杭州妙构思数字科技有限公司' then '杭州'
+        else '其他'
+        end area,
+        company_name as companyName,
+        (SELECT COUNT(material_id) as num
+            FROM app_bytedance_material_info
+            <where>
+                <if test="startTime !=null and startTime != ''">
+                    AND media_time &gt;= #{startTime}
+                </if>
+                <if test="endTime !=null and endTime != ''">
+                    AND media_time &lt;= #{endTime}
+                </if>
+            </where>
+            ) as total
+        FROM
+        app_bytedance_material_info
+        <where>
+            <if test="startTime !=null and startTime != ''">
+                AND media_time &gt;= #{startTime}
+            </if>
+            <if test="endTime !=null and endTime != ''">
+                AND media_time &lt;= #{endTime}
+            </if>
+        </where>
+        GROUP BY
+        company_id) t
+
+    </select>
+
+</mapper>

+ 21 - 0
jeecg-boot-material-view/src/main/java/org/jeecg/ctop/material/service/IBossDataExhibitionService.java

@@ -0,0 +1,21 @@
+package org.jeecg.ctop.material.service;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.github.pagehelper.PageInfo;
+import org.jeecg.common.api.vo.Result;
+import org.springframework.web.bind.annotation.RequestParam;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.sql.ResultSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+public interface IBossDataExhibitionService {
+
+
+    Result getMeterialProduceRate(String mediaType,String startTime, String endTime);
+
+}

+ 62 - 0
jeecg-boot-material-view/src/main/java/org/jeecg/ctop/material/service/impl/BossDataExhibitionServiceImpl.java

@@ -0,0 +1,62 @@
+package org.jeecg.ctop.material.service.impl;
+
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.util.DateUtils;
+import org.jeecg.ctop.material.constants.*;
+import org.jeecg.ctop.material.mapper.BossDataExhibitionMapper;
+import org.jeecg.ctop.material.service.IBossDataExhibitionService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.math.BigDecimal;
+import java.math.RoundingMode;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.*;
+import java.util.stream.Collectors;
+
+@Slf4j
+@Service
+public class BossDataExhibitionServiceImpl implements IBossDataExhibitionService {
+
+    @Autowired
+    private BossDataExhibitionMapper bossDataExhibitionMapper;
+
+
+    /**
+     *
+     * @description: 素材产出占比
+     *
+     * @param mediaType 1-头条 2-快手
+     * @param startTime
+     * @param endTime
+     * @return: org.jeecg.common.api.vo.Result
+     * @author: zianY
+     * @time: 2022/1/17
+     */
+    @Override
+    public Result getMeterialProduceRate(String mediaType, String startTime, String endTime) {
+        Integer stat_tim = DateUtils.getDateInteger(startTime);
+        Integer end_tim = DateUtils.getDateInteger(endTime);
+        List<Map<String,Object>> resultList = Arrays.asList();
+        // 1-头条 2-快手
+        if (StringUtils.equals("1",mediaType)){
+            resultList = bossDataExhibitionMapper.getMeterialProduceRateBytedance(stat_tim,end_tim);
+        }else if (StringUtils.equals("2",mediaType)){
+            resultList = bossDataExhibitionMapper.getMeterialProduceRateKuaiShou(stat_tim,end_tim);
+        }
+        return Result.successMsg("1".equals(mediaType) ? "【头条】" : "【快手】"+"===素材产出占比查询成功。",resultList);
+    }
+}

+ 13 - 6
jeecg-boot-material-view/src/main/resources/application-dev.yml

@@ -106,15 +106,15 @@ spring:
         connectionProperties: druid.stat.mergeSql\=true;druid.stat.slowSqlMillis\=5000
       datasource:
         master:
-          url: jdbc:mysql://111.206.86.186:3390/application?characterEncoding=UTF-8&useUnicode=true&allowMultiQueries=true&serverTimezone=GMT%2B8
-          username: hcst
-          password: hcst@2021
+#          url: jdbc:mysql://111.206.86.186:3390/application?characterEncoding=UTF-8&useUnicode=true&allowMultiQueries=true&serverTimezone=GMT%2B8
+#          username: hcst
+#          password: hcst@2021
           driver-class-name: com.mysql.jdbc.Driver
           # 多数据源配置
           #multi-datasource1:
-          #url: jdbc:mysql://localhost:3306/jeecg-boot2?useUnicode=true&characterEncoding=utf8&autoReconnect=true&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai
-          #username: root
-          #password: root
+          url: jdbc:mysql://192.168.0.184:3390/jeecg-boot?useUnicode=true&characterEncoding=utf8&autoReconnect=true&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai
+          username: hcst
+          password: hcst@2021
           #driver-class-name: com.mysql.cj.jdbc.Driver
   #redis 配置
   redis:
@@ -147,6 +147,13 @@ mybatis-plus:
     call-setters-on-nulls: true
 #jeecg专用配置
 jeecg :
+  oss:
+    secretKey:
+    accessKey:
+  path:
+    webapp:
+    upload:
+
   elasticsearch:
     cluster-name: jeecg-ES
     cluster-nodes: 127.0.0.1:9200

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

@@ -38,7 +38,10 @@
         responsible_id as 'responsibleId',
         design_responsible_id as 'designResponsibleId',
         media_id as 'mediaId',
-        max_bid as 'maxBid'
+        max_bid as 'maxBid',
+        bid_type as 'bidType',
+        ocpx_action_type as 'ocpxActionType',
+        deep_conversion_type as 'deepConversionType'
         from ctop_project
         where id in
         <foreach collection="ids" item="item" separator=","

+ 2 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/hosting/entity/KuaishouHostingTask.java

@@ -355,6 +355,7 @@ public class KuaishouHostingTask {
     @Excel(name = "备注", width = 15)
     @ApiModelProperty(value = "备注")
     private String remarks;
+    private String SceneIds;
     /**
      * 创建时间
      */
@@ -371,4 +372,5 @@ public class KuaishouHostingTask {
     @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
     @ApiModelProperty(value = "修改时间")
     private Date updateTime;
+
 }

+ 6 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/hosting/entity/KuaishouHostingTemplate.java

@@ -347,6 +347,12 @@ public class KuaishouHostingTemplate {
     @Excel(name = "每个智能托管匹配视频数量", width = 15)
     @ApiModelProperty(value = "每个智能托管匹配视频数量")
     private Integer videoCount;
+
+    /**
+     * 投放场景
+     */
+    private String sceneIds;
+
     /**
      * 创建时间
      */

+ 4 - 2
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/hosting/mapper/xml/KuaishouHostingTaskMapper.xml

@@ -58,7 +58,8 @@
         creative_name_rule,
         photo_infos,
         task_status,
-        remarks
+        remarks,
+        scene_ids
         )
         values
         <foreach collection="addList" item="add" separator=",">
@@ -117,7 +118,8 @@
             #{add.creativeNameRule},
             #{add.photoInfos},
             #{add.taskStatus},
-            #{add.remarks}
+            #{add.remarks},
+            #{add.sceneIds}
             )
         </foreach>
 

+ 13 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/hosting/service/impl/KuaishouHostingTaskServiceImpl.java

@@ -87,6 +87,10 @@ public class KuaishouHostingTaskServiceImpl extends ServiceImpl<KuaishouHostingT
             task.setPhotoInfos(videoInfo.toString());
             task.setName(getName(template.getName(), task.getAccountId()));
             task.setHostingScene(template.getHostingScene());
+            String sceneIds = template.getSceneIds();
+            if (!Check.isNull(sceneIds)) {
+                task.setSceneIds(sceneIds);
+            }
             task.setCampaignType(template.getCampaignType());
             if (!Check.isNull(template.getAppId())) {
                 task.setAppId(template.getAppId());
@@ -167,6 +171,7 @@ public class KuaishouHostingTaskServiceImpl extends ServiceImpl<KuaishouHostingT
         }
     }
 
+
     @Override
     public void createHosting(Long id) {
         try {
@@ -192,6 +197,14 @@ public class KuaishouHostingTaskServiceImpl extends ServiceImpl<KuaishouHostingT
             requestJson.put("advertiser_id", task.getAccountId());
             requestJson.put("name", task.getName());
             requestJson.put("hosting_scene", task.getHostingScene());
+
+            String sceneIds = task.getSceneIds();
+            if (!Check.isNull(sceneIds)) {
+                JSONArray scene_ids = JSONArray.parseArray(sceneIds);
+                if (!Check.isNull(scene_ids)) {
+                    requestJson.put("scene_ids", scene_ids);
+                }
+            }
             requestJson.put("campaign_type", task.getCampaignType());
             if (!Check.isNull(task.getAppId())) {
                 requestJson.put("app_id", task.getAppId());

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

@@ -16,3 +16,4 @@ public class PerformanceAreaController {
         return result;
     }
 }
+

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

@@ -69,6 +69,16 @@ public class ProjectMember implements Serializable {
 
 
     @TableField(exist = false)
+    private String bidType;  // 优化目标
+
+    @TableField(exist = false)
+    private String ocpxActionType; // 转化目标
+
+    @TableField(exist = false)
+    private String deepConversionType; // 深度转化目标
+
+
+    @TableField(exist = false)
     private String responsibleName;
 
 

+ 9 - 2
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/ProjectMemberServiceImpl.java

@@ -3,7 +3,10 @@ package org.jeecg.modules.ctop.service.impl;
 import cn.com.ctop.common.module.entity.Project;
 import cn.com.ctop.common.module.entity.UserAllocation;
 import cn.com.ctop.common.module.mapper.UserAllocationMapper;
-import cn.com.ctop.common.module.service.*;
+import cn.com.ctop.common.module.service.IProductService;
+import cn.com.ctop.common.module.service.IProjectService;
+import cn.com.ctop.common.module.service.ISysRoleExtService;
+import cn.com.ctop.common.module.service.ISysUserService;
 import cn.com.ctop.common.module.utils.Check;
 import cn.com.ctop.common.module.utils.CtopAdConstant;
 import com.alibaba.fastjson.JSONArray;
@@ -96,7 +99,7 @@ public class ProjectMemberServiceImpl extends ServiceImpl<ProjectMemberMapper, P
 
     //视频报表
     @Override
-    public List<ProjectMember> getProjects(List<Integer> mediaIds,String userId) {
+    public List<ProjectMember> getProjects(List<Integer> mediaIds, String userId) {
 //        LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
 //        String userId = sysUser.getId();
         String roleCode = memberMapper.getRoleCodeByUserId(userId);
@@ -153,6 +156,7 @@ public class ProjectMemberServiceImpl extends ServiceImpl<ProjectMemberMapper, P
 
         return projectMemberList;
     }
+
     @Override
     public List<Map<String, Object>> getProjectAccountByUserId(String userId, String mediaType) {
         List<Map<String, Object>> result = new ArrayList<>();
@@ -410,6 +414,9 @@ public class ProjectMemberServiceImpl extends ServiceImpl<ProjectMemberMapper, P
             }
             member.setMediaId(projectJson.getString("mediaId"));
             member.setMaxBid(projectJson.getLong("maxBid"));
+            member.setBidType(projectJson.getString("bidType"));
+            member.setOcpxActionType(projectJson.getString("ocpxActionType"));
+            member.setDeepConversionType(projectJson.getString("deepConversionType"));
             String advertiserId = projectJson.getString("advertiserId");
             member.setAdvertiserId(advertiserId);
             if (!Check.isNullMap(advertiserMap)) {