Prechádzať zdrojové kódy

Merge branch 'test' into V2.0.1

zhaoxian 3 rokov pred
rodič
commit
780d371ba3

+ 33 - 2
jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/DateUtils.java

@@ -1916,6 +1916,29 @@ public class DateUtils extends PropertyEditorSupport {
 
 
     /**
+     * 获取 时 list
+     *
+     * @param
+     * @return
+     */
+    public static List<String> getHoursListDifference(List<String> betweenDaysList) {
+        List<String> dateList = new ArrayList<String>(){{
+            add("00");add("01");add("02");add("03");add("04");add("05");
+            add("06");add("07");add("08");add("09");add("10");add("11");
+            add("12");add("13");add("14");add("15");add("16");add("17");
+            add("18");add("19");add("20");add("21");add("22");add("23");
+        }};
+        List<String> resultList = new ArrayList<String>();
+        betweenDaysList.forEach(day ->{
+            dateList.forEach(hour ->{
+                resultList.add((day + hour).replace("-",""));
+            });
+        });
+        return resultList;
+    }
+
+
+    /**
      * 时间 去重 排序
      *
      * @param list
@@ -2022,8 +2045,16 @@ public class DateUtils extends PropertyEditorSupport {
         //BigDecimal unitRatio = BigDecimal.valueOf((groupNum - yesNum) / yesNum).multiply(new BigDecimal(100));
         //System.out.println(unitRatio);
 
-        System.out.println(getFirstDayByMonth());
-        ;
+        //System.out.println(getFirstDayByMonth());
+
+        //System.out.println(getSubtractTime(new Date(),6));;
+
+        List<String> list = new ArrayList<String>();
+        list.add("2022-09-01");
+        list.add("2022-09-04");
+
+
+        System.out.println(getHoursListDifference(list));;
 
     }
 

+ 10 - 1
jeecg-boot-material-view/src/main/java/org/jeecg/ctop/material/controller/KuaiShouOperationRecordController.java

@@ -88,13 +88,22 @@ public class KuaiShouOperationRecordController {
 
 
 
+    /**
+     *
+     * @description: 快手操作记录
+     *
+     * @param advertiserId
+     * @param unitId
+     * @param startTime
+     * @param endTime
+     * @return: org.jeecg.common.api.vo.Result<com.alibaba.fastjson.JSONObject>
+     */
     @GetMapping("/getKuaishouOperationRecordByUnit")
     public Result<JSONObject> getKuaishouOperationRecordByUnit(@RequestParam(name="advertiserId") long advertiserId,
                                                                     @RequestParam(name="unitId") long unitId,
                                                                      @RequestParam(name="startTime") String startTime,
                                                                      @RequestParam(name="endTime") String endTime) throws Exception{
 
-
         return kuaishouOperationRecordService.getKuaishouOperationRecordByUnit(advertiserId,unitId,startTime,endTime);
     }
 

+ 25 - 2
jeecg-boot-material-view/src/main/java/org/jeecg/ctop/material/entity/KuaishouUnitReportHourlyPojo.java

@@ -69,15 +69,16 @@ public class KuaishouUnitReportHourlyPojo {
     /** 素材曝光数 */
     @Excel(name = "素材曝光数", width = 15)
     @ApiModelProperty(value = "素材曝光数")
-    private Long aclick;
+    private Long aClick;
     /** 行为数 */
     @Excel(name = "行为数", width = 15)
     @ApiModelProperty(value = "行为数")
-    private Long bclick;
+    private Long bClick;
     /** 封面点击率 */
     @Excel(name = "封面点击率", width = 15)
     @ApiModelProperty(value = "封面点击率")
     private java.math.BigDecimal photoClickRatio;
+    private java.math.BigDecimal clickRate;
     /** 3s播放率 */
     @Excel(name = "3s播放率", width = 15)
     @ApiModelProperty(value = "3s播放率")
@@ -86,18 +87,22 @@ public class KuaishouUnitReportHourlyPojo {
     @Excel(name = "行为率", width = 15)
     @ApiModelProperty(value = "行为率")
     private java.math.BigDecimal actionRatio;
+    private java.math.BigDecimal bClickRate;
     /** 平均千次曝光花费(元) */
     @Excel(name = "平均千次曝光花费(元)", width = 15)
     @ApiModelProperty(value = "平均千次曝光花费(元)")
     private java.math.BigDecimal impression1kCost;
+    private java.math.BigDecimal cpm;
     /** 平均点击单价(元) */
     @Excel(name = "平均点击单价(元)", width = 15)
     @ApiModelProperty(value = "平均点击单价(元)")
     private java.math.BigDecimal photoClickCost;
+    private java.math.BigDecimal cpc;
     /** 平均行为单价(元) */
     @Excel(name = "平均行为单价(元)", width = 15)
     @ApiModelProperty(value = "平均行为单价(元)")
     private java.math.BigDecimal actionCost;
+    private java.math.BigDecimal cpb;
     /** 分享数 */
     @Excel(name = "分享数", width = 15)
     @ApiModelProperty(value = "分享数")
@@ -138,26 +143,32 @@ public class KuaishouUnitReportHourlyPojo {
     @Excel(name = "应用下载数据-安卓下载开始数", width = 15)
     @ApiModelProperty(value = "应用下载数据-安卓下载开始数")
     private Long downloadStarted;
+    private Long downloadStart;
     /** 应用下载数据-安卓下载完成数 */
     @Excel(name = "应用下载数据-安卓下载完成数", width = 15)
     @ApiModelProperty(value = "应用下载数据-安卓下载完成数")
     private Long downloadCompleted;
+    private Long downloadFinish;
     /** 应用下载数据-激活数 */
     @Excel(name = "应用下载数据-激活数", width = 15)
     @ApiModelProperty(value = "应用下载数据-激活数")
     private Long activation;
+    private Long active;
     /** 应用下载数据-首日付费次数 */
     @Excel(name = "应用下载数据-首日付费次数", width = 15)
     @ApiModelProperty(value = "应用下载数据-首日付费次数")
     private Long eventPayFirstDay;
+    private Long firstDayPay;
     /** 应用下载数据-首日付费金额 */
     @Excel(name = "应用下载数据-首日付费金额", width = 15)
     @ApiModelProperty(value = "应用下载数据-首日付费金额")
     private java.math.BigDecimal eventPayPurchaseAmountFirstDay;
+    private java.math.BigDecimal firstDayPayAmount;
     /** 应用下载数据-首日ROI */
     @Excel(name = "应用下载数据-首日ROI", width = 15)
     @ApiModelProperty(value = "应用下载数据-首日ROI")
     private java.math.BigDecimal eventPayFirstDayRoi;
+    private java.math.BigDecimal firstDayPayROI;
     /** 应用下载数据-付费次数 */
     @Excel(name = "应用下载数据-付费次数", width = 15)
     @ApiModelProperty(value = "应用下载数据-付费次数")
@@ -170,18 +181,22 @@ public class KuaishouUnitReportHourlyPojo {
     @Excel(name = "应用下载数据-ROI", width = 15)
     @ApiModelProperty(value = "应用下载数据-ROI")
     private java.math.BigDecimal eventPayRoi;
+    private java.math.BigDecimal ROI;
     /** 应用下载数据-注册数 */
     @Excel(name = "应用下载数据-注册数", width = 15)
     @ApiModelProperty(value = "应用下载数据-注册数")
     private Long eventRegister;
+    private Long register;
     /** 应用下载数据-注册成本 */
     @Excel(name = "应用下载数据-注册成本", width = 15)
     @ApiModelProperty(value = "应用下载数据-注册成本")
     private java.math.BigDecimal eventRegisterCost;
+    private java.math.BigDecimal activeRegisterCost;
     /** 应用下载数据-注册率 */
     @Excel(name = "应用下载数据-注册率", width = 15)
     @ApiModelProperty(value = "应用下载数据-注册率")
     private java.math.BigDecimal eventRegisterRatio;
+    private java.math.BigDecimal activeRegisterRate;
     /** 应用下载数据-完件数 */
     @Excel(name = "应用下载数据-完件数", width = 15)
     @ApiModelProperty(value = "应用下载数据-完件数")
@@ -218,14 +233,17 @@ public class KuaishouUnitReportHourlyPojo {
     @Excel(name = "应用下载数据-次留数(仅支持分日查询)", width = 15)
     @ApiModelProperty(value = "应用下载数据-次留数(仅支持分日查询)")
     private Long eventNextDayStay;
+    private Long nextDayOpen;
     /** 应用下载数据-次留成本(仅支持分日查询) */
     @Excel(name = "应用下载数据-次留成本(仅支持分日查询)", width = 15)
     @ApiModelProperty(value = "应用下载数据-次留成本(仅支持分日查询)")
     private java.math.BigDecimal eventNextDayStayCost;
+    private java.math.BigDecimal nextDayOpenCost;
     /** 应用下载数据-次留率(仅支持分日查询) */
     @Excel(name = "应用下载数据-次留率(仅支持分日查询)", width = 15)
     @ApiModelProperty(value = "应用下载数据-次留率(仅支持分日查询)")
     private java.math.BigDecimal eventNextDayStayRatio;
+    private java.math.BigDecimal nextDayOpenRate;
     /** 落地页数据-表单提交数 */
     @Excel(name = "落地页数据-表单提交数", width = 15)
     @ApiModelProperty(value = "落地页数据-表单提交数")
@@ -234,10 +252,12 @@ public class KuaishouUnitReportHourlyPojo {
     @Excel(name = "落地页数据-表单提交单价", width = 15)
     @ApiModelProperty(value = "落地页数据-表单提交单价")
     private java.math.BigDecimal formCost;
+    private java.math.BigDecimal formCountCost;
     /** 落地页数据-表单提交点击率 */
     @Excel(name = "落地页数据-表单提交点击率", width = 15)
     @ApiModelProperty(value = "落地页数据-表单提交点击率")
     private java.math.BigDecimal formActionRatio;
+    private java.math.BigDecimal formCountRate;
     /** 落地页数据-落地页完件数 */
     @Excel(name = "落地页数据-落地页完件数", width = 15)
     @ApiModelProperty(value = "落地页数据-落地页完件数")
@@ -258,6 +278,7 @@ public class KuaishouUnitReportHourlyPojo {
     @Excel(name = "落地页数据-落地页授信率", width = 15)
     @ApiModelProperty(value = "落地页数据-落地页授信率")
     private java.math.BigDecimal eventCreditGrantLandingPageRatio;
+    private java.math.BigDecimal eventCreditGrantLandingPageRate;
     /** 落地页数据-有效线索数 */
     @Excel(name = "落地页数据-有效线索数", width = 15)
     @ApiModelProperty(value = "落地页数据-有效线索数")
@@ -362,10 +383,12 @@ public class KuaishouUnitReportHourlyPojo {
     @Excel(name = "按钮点击成本", width = 15)
     @ApiModelProperty(value = "按钮点击成本")
     private java.math.BigDecimal eventButtonClickCost;
+    private java.math.BigDecimal submitCost;
     /** 按钮点击率 */
     @Excel(name = "按钮点击率", width = 15)
     @ApiModelProperty(value = "按钮点击率")
     private java.math.BigDecimal eventButtonClickRatio;
+    private java.math.BigDecimal submitRate;
     /** 订单支付率 */
     @Excel(name = "订单支付率", width = 15)
     @ApiModelProperty(value = "订单支付率")

+ 11 - 1
jeecg-boot-material-view/src/main/java/org/jeecg/ctop/material/mapper/KuaishouOperationRecordMapper.java

@@ -48,7 +48,17 @@ public interface KuaishouOperationRecordMapper {
      * @param endTime
      * @return
      */
-    List<JSONObject> getKuaishouOperationRecordByAdvertiserId(@Param("advertiserId") long advertiserId,@Param("objectId") long objectId,@Param("operationType") int operationType,  @Param("startTime") String startTime, @Param("endTime") String endTime);
+    List<JSONObject> getKuaishouOperationRecordByAdvertiserId(@Param("advertiserId") long advertiserId,@Param("objectId") long objectId,@Param("operationType") int operationType,  @Param("operationTime") String operationTime);
+
+    /**
+     * 查看快手 组数据信息
+     * @param accountId
+     * @param unitId
+     * @param statDate
+     * @param statHour
+     * @return
+     */
+    JSONObject getKuaishouOperationUnitReport(@Param("accountId") long accountId,@Param("unitId") long unitId, @Param("statDate") String statDate, @Param("statHour") String statHour);
 
 
 }

+ 94 - 5
jeecg-boot-material-view/src/main/java/org/jeecg/ctop/material/mapper/xml/KuaishouOperationRecordMapper.xml

@@ -6,7 +6,36 @@
 <!-- 查询快手组 时报 消耗前10 -->
     <select id="getKuaishouUnitReportHourly" resultType="org.jeecg.ctop.material.entity.KuaishouUnitReportHourlyPojo">
         SELECT
-            *,
+            unit_id AS unitId,
+            unit_name as unitName,
+            aclick as aclick,
+            bclick as bclick,
+            charge as cost,
+            `show` as photoShow,
+            photo_click_ratio as clickRate,
+            action_ratio as bClickRate,
+            impression_1k_cost as cpm,
+            photo_click_cost as cpc,
+            action_cost as cpb,
+            download_started as downloadStart,
+            download_completed as downloadFinish,
+            activation as active,
+            event_pay_first_day as firstDayPay,
+            event_pay_purchase_amount_first_day as firstDayPayAmount,
+            event_pay_first_day_roi as firstDayPayROI,
+            event_pay_roi as ROI,
+            event_register as register,
+            event_register_cost as activeRegisterCost,
+            event_register_ratio as activeRegisterRate,
+            event_next_day_stay as nextDayOpen,
+            event_next_day_stay_cost as nextDayOpenCost,
+            event_next_day_stay_ratio as nextDayOpenRate,
+            event_credit_grant_landing_page_ratio as eventCreditGrantLandingPageRate,
+            play_3s_ratio as play3sRate,
+            form_cost as formCountCost,
+            form_action_ratio as formCountRate,
+            event_button_click_cost as submitCost,
+            event_button_click_ratio as submitRate,
             charge as cost,
             `show` as photoShow,
             CONCAT(ROUND(download_started / bclick * 100,2) ,'%') as downloadStartRate,
@@ -31,8 +60,37 @@
     <!-- 查询快手组 日报 消耗前10  -->
     <select id="getKuaishouUnitReportDaily" resultType="org.jeecg.ctop.material.entity.KuaishouUnitReportHourlyPojo">
         SELECT
-            *,
-               charge as cost,
+            unit_id AS unitId,
+            unit_name as unitName,
+            aclick as aclick,
+            bclick as bclick,
+            charge as cost,
+            `show` as photoShow,
+            photo_click_ratio as clickRate,
+            action_ratio as bClickRate,
+            impression_1k_cost as cpm,
+            photo_click_cost as cpc,
+            action_cost as cpb,
+            download_started as downloadStart,
+            download_completed as downloadFinish,
+            activation as active,
+            event_pay_first_day as firstDayPay,
+            event_pay_purchase_amount_first_day as firstDayPayAmount,
+            event_pay_first_day_roi as firstDayPayROI,
+            event_pay_roi as ROI,
+            event_register as register,
+            event_register_cost as activeRegisterCost,
+            event_register_ratio as activeRegisterRate,
+            event_next_day_stay as nextDayOpen,
+            event_next_day_stay_cost as nextDayOpenCost,
+            event_next_day_stay_ratio as nextDayOpenRate,
+            event_credit_grant_landing_page_ratio as eventCreditGrantLandingPageRate,
+            play_3s_ratio as play3sRate,
+            form_cost as formCountCost,
+            form_action_ratio as formCountRate,
+            event_button_click_cost as submitCost,
+            event_button_click_ratio as submitRate,
+            charge as cost,
             `show` as photoShow,
             CONCAT(ROUND(download_started / bclick * 100,2) ,'%') as downloadStartRate,
             ROUND(download_started / bclick * 100,2) as downloadStartCost,
@@ -52,6 +110,38 @@
     </select>
 
 
+    <!-- 查看快手 组数据信息  -->
+    <select id="getKuaishouOperationUnitReport" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT
+        unit_id AS unitId,
+        stat_date AS statDate,
+        HOUR AS statHour,
+        charge,
+        activation,
+        ROUND( charge / activation * 100, 2 ) AS activeCost,
+        event_register AS eventRegister,
+        event_register_cost AS eventRegisterCost,
+        event_next_day_stay AS eventNextDayStay,
+        event_next_day_stay_cost AS eventNextDayStay,
+        event_pay_first_day AS eventPayIfrstDay,
+        ROUND( charge / event_pay_first_day * 100, 2 ) AS eventPayIfrstDayCost,
+        form_count AS formCount
+        FROM
+        application.kuaishou_unit_report_hourly_dw
+        WHERE
+        stat_date= #{statDate}
+        AND hour = #{statHour}
+        AND account_id = #{accountId}
+        AND unit_id = #{unitId}
+        ORDER BY
+        stat_date,HOUR
+
+
+    </select>
+
+
+
+
     <!-- 查看账户操作记录 -->
     <select id="getKuaishouOperationRecordByAdvertiserId" resultType="com.alibaba.fastjson.JSONObject">
         SELECT
@@ -70,8 +160,7 @@
             advertiser_id = #{advertiserId}
             AND operation_type = #{operationType}
             AND object_id = #{objectId}
-            AND operation_time &gt;= #{startTime}
-            AND operation_time &lt;= #{endTime}
+          AND date_format(operation_time, '%Y%m%d%H') = #{operationTime}
 
 
     </select>

+ 1 - 1
jeecg-boot-material-view/src/main/java/org/jeecg/ctop/material/service/KuaishouOperationRecordService.java

@@ -21,7 +21,7 @@ public interface KuaishouOperationRecordService {
     Result getKuaishouUnitChargeTopTenByAccountId(String userId,long advertiserId,String startTime,String endTime) throws NoSuchFieldException;
 
 
-    Result getKuaishouOperationRecordByUnit(long advertiserId,long unitId,String startTime,String endTime);
+    Result getKuaishouOperationRecordByUnit(long advertiserId,long unitId,String startTime,String endTime)throws Exception;
 
 
 }

+ 31 - 4
jeecg-boot-material-view/src/main/java/org/jeecg/ctop/material/service/impl/KuaishouOperationRecordServiceImpl.java

@@ -129,11 +129,38 @@ public class KuaishouOperationRecordServiceImpl implements KuaishouOperationReco
      * @author: zianY
      */
     @Override
-    public Result getKuaishouOperationRecordByUnit(long advertiserId,long unitId,String startTime,String endTime){
-
-        List<JSONObject> list =  kuaishouOperationRecordMapper.getKuaishouOperationRecordByAdvertiserId(advertiserId,unitId,2,startTime+" 00:00:00",endTime+" 23:59:59");
+    public Result getKuaishouOperationRecordByUnit(long advertiserId,long unitId,String startTime,String endTime) throws Exception{
+        List<JSONObject> resultList = new ArrayList<>();
+        // 获取两个日期之间 所有的 时间 年-月-日
+        List<String> betweenDaysList = DateUtils.getAllDatesOfTwoTimes(startTime,endTime);
+        // 所有时间集
+        List<String> allHoursList = DateUtils.getHoursListDifference(betweenDaysList);
+        for (String time : allHoursList) {
+            JSONObject jsonObject = new JSONObject();
+            //2022090101 -年月日 时
+            String date = time.substring(0,time.length()-2);
+            String hour = time.substring(time.length()-2);
+            //查询时报数据
+            JSONObject unit =  kuaishouOperationRecordMapper.getKuaishouOperationUnitReport(advertiserId,unitId,date,hour);
+            if (Check.isNull(unit)){
+                jsonObject.put("charge",0);
+                jsonObject.put("statDate",date);
+                jsonObject.put("statHour",hour);
+                jsonObject.put("time",time);
+                resultList.add(jsonObject);
+                continue;
+            }
 
-        return Result.successMsg("查询成功",list);
+            long uId = Long.valueOf(unit.getString("unitId"));
+            //查询操作记录
+            List<JSONObject> list =  kuaishouOperationRecordMapper.getKuaishouOperationRecordByAdvertiserId(advertiserId,uId,2,time);
+            if (!Check.isNull(list)){ list.forEach(json -> {json.put("content_log",json.getJSONArray("content_log"));});}
+            jsonObject = unit;
+            jsonObject.put("time",time);
+            jsonObject.put("operationList",list);
+            resultList.add(jsonObject);
+        }
+        return Result.successMsg("查询成功",resultList);
     }