wcc пре 3 година
родитељ
комит
5678195745

+ 5 - 5
flink-ad-monitoring/src/main/java/flink/zanxiangnet/ad/monitoring/AdHourStreamJob.java

@@ -90,7 +90,7 @@ public class AdHourStreamJob {
         // 分钟流
         DataStream<AdDataOfMinuteODS> adMinuteODSStream = adODSStream.getSideOutput(adMinuteStreamTag);
         // 分钟流-写入原始表
-        new KeyedBatchStream<>("adMinuteODSStream", adMinuteODSStream.keyBy(AdDataOfMinuteODS::getStatDay), 1000L, 2 * 60 * 1000L)
+        new KeyedBatchStream<>("adMinuteODSStream", adMinuteODSStream.keyBy(AdDataOfMinuteODS::getStatDay), 6000L, 2 * 60 * 1000L)
                 .toBatch()
                 .addSink(new TunnelBatchStreamSink<>(AdDataOfMinuteODS.class))
                 .name("sink_ad_minute_ods");
@@ -106,7 +106,7 @@ public class AdHourStreamJob {
                 .trigger(new AdMinuteODSStreamTrigger())
                 .process(new AdMinuteDWDProcess())
                 .setParallelism(parallelismKafka);
-        new KeyedBatchStream<>("adMinuteDWDStream", adMinuteDWDStream.keyBy(AdStatOfMinuteDWD::getStatDay), 1000L, 60 * 1000L)
+        new KeyedBatchStream<>("adMinuteDWDStream", adMinuteDWDStream.keyBy(AdStatOfMinuteDWD::getStatDay), 3000L, 60 * 1000L)
                 .toBatch()
                 .addSink(new TunnelBatchStreamSink<>(AdStatOfMinuteDWD.class))
                 .name("sink_ad_minute_dwd");
@@ -116,7 +116,7 @@ public class AdHourStreamJob {
                 adMinuteDWDStream
                         .keyBy(AdStatOfMinuteDWD::getAdId)
                         .process(new CostMinuteProcess());
-        new BatchStream<>("adMinuteDMStream", clickhouseMinuteDmStream, 4000L, 60 * 1000L)
+        new BatchStream<>("adMinuteDMStream", clickhouseMinuteDmStream, 3000L, 60 * 1000L)
                 .toBatch()
                 .addSink(new AdMinuteDMToCkBatchSink())
                 .name("sink_ad_minute_dm_clickhouse");
@@ -124,7 +124,7 @@ public class AdHourStreamJob {
         // 小时流
         DataStream<AdDataOfHourODS> adHourODSStream = adODSStream.getSideOutput(adHourStreamTag);
         // 小时流-写入原始表
-        new KeyedBatchStream<>("adHourODSStream", adHourODSStream.keyBy(AdDataOfHourODS::getStatDay), 1000L, 3 * 60 * 1000L)
+        new KeyedBatchStream<>("adHourODSStream", adHourODSStream.keyBy(AdDataOfHourODS::getStatDay), 3000L, 3 * 60 * 1000L)
                 .toBatch()
                 .addSink(new TunnelBatchStreamSink<>(AdDataOfHourODS.class))
                 .name("sink_ad_hour_ods");
@@ -135,7 +135,7 @@ public class AdHourStreamJob {
                         .process(new AdHourDWDProcess());
 
         // 小时流-写入maxCompute
-        new KeyedBatchStream<>("adHourDWDStream", adHourDWDStream.keyBy(AdStatOfHourDWD::getStatDay), 1000L, 3 * 60 * 1000L)
+        new KeyedBatchStream<>("adHourDWDStream", adHourDWDStream.keyBy(AdStatOfHourDWD::getStatDay), 3000L, 3 * 60 * 1000L)
                 .toBatch()
                 .addSink(new TunnelBatchStreamSink<>(AdStatOfHourDWD.class))
                 .name("sink_ad_hour_dwd");

+ 270 - 329
flink-ad-monitoring/src/main/java/flink/zanxiangnet/ad/monitoring/pojo/entity/AdStatOfDayDWD.java

@@ -954,347 +954,288 @@ public class AdStatOfDayDWD implements Serializable {
     /**
      * 聚合
      *
-     * @param value1     之前聚合的值(可能为 null)
-     * @param value2     新值
+     * @param lastDayDWD 之前聚合的值(可能为 null)
+     * @param dayODS     新值
      * @param createTime 聚合时间
      * @return
      */
-    public static AdStatOfDayDWD reduce(AdStatOfDayDWD value1, AdDataOfDayODS value2, long createTime) {
+    public static AdStatOfDayDWD reduce(AdStatOfDayDWD lastDayDWD, AdDataOfDayODS dayODS, long createTime) {
         AdStatOfDayDWD result = new AdStatOfDayDWD();
-        BeanUtils.copyProperties(value2, result);
+        BeanUtils.copyProperties(dayODS, result);
         result.setCreateTime(new Date(createTime));
-        if (value1 == null) {
-            result.setCostDeviationRateTotal(value2.getCostDeviationRate());
-            result.setCostDeviationRateDay(value2.getCostDeviationRate());
-            result.setCostTotal(value2.getCost());
-            result.setCostDay(value2.getCost());
-            result.setCompensationAmountTotal(value2.getCompensationAmount());
-            result.setCompensationAmountDay(value2.getCompensationAmount());
-            result.setViewCountTotal(value2.getViewCount());
-            result.setViewCountDay(value2.getViewCount());
-            result.setThousandDisplayPriceAll(value2.getThousandDisplayPrice());
-            result.setThousandDisplayPriceDay(value2.getThousandDisplayPrice());
-            result.setViewUserCountTotal(value2.getViewUserCount());
-            result.setViewUserCountDay(value2.getViewUserCount());
-            result.setAvgViewPerUserAll(value2.getAvgViewPerUser());
-            result.setAvgViewPerUserDay(value2.getAvgViewPerUser());
-            result.setValidClickCountTotal(value2.getValidClickCount());
-            result.setValidClickCountDay(value2.getValidClickCount());
-            result.setClickUserCountTotal(value2.getClickUserCount());
-            result.setClickUserCountDay(value2.getClickUserCount());
-            result.setCtrAll(value2.getCtr());
-            result.setCtrDay(value2.getCtr());
-            result.setCpcAll(value2.getCpc());
-            result.setCpcDay(value2.getCpc());
-            result.setValuableClickCountTotal(value2.getValuableClickCount());
-            result.setValuableClickCountDay(value2.getValuableClickCount());
-            result.setValuableClickRateAll(value2.getValuableClickRate());
-            result.setValuableClickRateDay(value2.getValuableClickRate());
-            result.setValuableClickCostAll(value2.getValuableClickCost());
-            result.setValuableClickCostDay(value2.getValuableClickCost());
-            result.setConversionsCountTotal(value2.getConversionsCount());
-            result.setConversionsCountDay(value2.getConversionsCount());
-            result.setConversionsCostAll(value2.getConversionsCost());
-            result.setConversionsCostDay(value2.getConversionsCost());
-            result.setConversionsRateAll(value2.getConversionsRate());
-            result.setConversionsRateDay(value2.getConversionsRate());
-            result.setDeepConversionsCountTotal(value2.getDeepConversionsCount());
-            result.setDeepConversionsCountDay(value2.getDeepConversionsCount());
-            result.setDeepConversionsCostAll(value2.getDeepConversionsCost());
-            result.setDeepConversionsCostDay(value2.getDeepConversionsCost());
-            result.setDeepConversionsRateAll(value2.getDeepConversionsRate());
-            result.setDeepConversionsRateDay(value2.getDeepConversionsRate());
-            result.setKeyPageUvTotal(value2.getKeyPageUv());
-            result.setKeyPageUvDay(value2.getKeyPageUv());
-            result.setOrderCountTotal(value2.getOrderCount());
-            result.setOrderCountDay(value2.getOrderCount());
-            result.setFirstDayOrderCountTotal(value2.getFirstDayOrderCount());
-            result.setFirstDayOrderCountDay(value2.getFirstDayOrderCount());
-            result.setWebOrderCostAll(value2.getWebOrderCost());
-            result.setWebOrderCostDay(value2.getWebOrderCost());
-            result.setOrderRateAll(value2.getOrderRate());
-            result.setOrderRateDay(value2.getOrderRate());
-            result.setOrderAmountTotal(value2.getOrderAmount());
-            result.setOrderAmountDay(value2.getOrderAmount());
-            result.setFirstDayOrderAmountTotal(value2.getFirstDayOrderAmount());
-            result.setFirstDayOrderAmountDay(value2.getFirstDayOrderAmount());
-            result.setOrderUnitPriceAll(value2.getOrderUnitPrice());
-            result.setOrderUnitPriceDay(value2.getOrderUnitPrice());
-            result.setOrderRoiAll(value2.getOrderRoi());
-            result.setOrderRoiDay(value2.getOrderRoi());
-            result.setSignInCountTotal(value2.getSignInCount());
-            result.setSignInCountDay(value2.getSignInCount());
-            result.setAddWishlistCountTotal(value2.getAddWishlistCount());
-            result.setAddWishlistCountDay(value2.getAddWishlistCount());
-            result.setViewCommodityPageUvTotal(value2.getViewCommodityPageUv());
-            result.setViewCommodityPageUvDay(value2.getViewCommodityPageUv());
-            result.setPageReservationCountTotal(value2.getPageReservationCount());
-            result.setPageReservationCountDay(value2.getPageReservationCount());
-            result.setLeadsPurchaseUvTotal(value2.getLeadsPurchaseUv());
-            result.setLeadsPurchaseUvDay(value2.getLeadsPurchaseUv());
-            result.setLeadsPurchaseCostAll(value2.getLeadsPurchaseCost());
-            result.setLeadsPurchaseCostDay(value2.getLeadsPurchaseCost());
-            result.setLeadsPurchaseRateAll(value2.getLeadsPurchaseRate());
-            result.setLeadsPurchaseRateDay(value2.getLeadsPurchaseRate());
-            result.setScanFollowCountTotal(value2.getScanFollowCount());
-            result.setScanFollowCountDay(value2.getScanFollowCount());
-            result.setWechatAppRegisterUvTotal(value2.getWechatAppRegisterUv());
-            result.setWechatAppRegisterUvDay(value2.getWechatAppRegisterUv());
-            result.setWechatMinigameRegisterCostAll(value2.getWechatMinigameRegisterCost());
-            result.setWechatMinigameRegisterCostDay(value2.getWechatMinigameRegisterCost());
-            result.setWechatMinigameRegisterRateAll(value2.getWechatMinigameRegisterRate());
-            result.setWechatMinigameRegisterRateDay(value2.getWechatMinigameRegisterRate());
-            result.setWechatMinigameArpuAll(value2.getWechatMinigameArpu());
-            result.setWechatMinigameArpuDay(value2.getWechatMinigameArpu());
-            result.setWechatMinigameRetentionCountTotal(value2.getWechatMinigameRetentionCount());
-            result.setWechatMinigameRetentionCountDay(value2.getWechatMinigameRetentionCount());
-            result.setWechatMinigameCheckoutCountTotal(value2.getWechatMinigameCheckoutCount());
-            result.setWechatMinigameCheckoutCountDay(value2.getWechatMinigameCheckoutCount());
-            result.setWechatMinigameCheckoutAmountTotal(value2.getWechatMinigameCheckoutAmount());
-            result.setWechatMinigameCheckoutAmountDay(value2.getWechatMinigameCheckoutAmount());
-            result.setOfficialAccountFollowCountTotal(value2.getOfficialAccountFollowCount());
-            result.setOfficialAccountFollowCountDay(value2.getOfficialAccountFollowCount());
-            result.setOfficialAccountFollowCostAll(value2.getOfficialAccountFollowCost());
-            result.setOfficialAccountFollowCostDay(value2.getOfficialAccountFollowCost());
-            result.setOfficialAccountFollowRateAll(value2.getOfficialAccountFollowRate());
-            result.setOfficialAccountFollowRateDay(value2.getOfficialAccountFollowRate());
-            result.setOfficialAccountRegisterUserCountTotal(value2.getOfficialAccountRegisterUserCount());
-            result.setOfficialAccountRegisterUserCountDay(value2.getOfficialAccountRegisterUserCount());
-            result.setOfficialAccountRegisterRateAll(value2.getOfficialAccountRegisterRate());
-            result.setOfficialAccountRegisterRateDay(value2.getOfficialAccountRegisterRate());
-            result.setOfficialAccountRegisterCostAll(value2.getOfficialAccountRegisterCost());
-            result.setOfficialAccountRegisterCostDay(value2.getOfficialAccountRegisterCost());
-            result.setOfficialAccountRegisterAmountTotal(value2.getOfficialAccountRegisterAmount());
-            result.setOfficialAccountRegisterAmountDay(value2.getOfficialAccountRegisterAmount());
-            result.setOfficialAccountRegisterRoiAll(value2.getOfficialAccountRegisterRoi());
-            result.setOfficialAccountRegisterRoiDay(value2.getOfficialAccountRegisterRoi());
-            result.setOfficialAccountApplyCountTotal(value2.getOfficialAccountApplyCount());
-            result.setOfficialAccountApplyCountDay(value2.getOfficialAccountApplyCount());
-            result.setOfficialAccountApplyUserCountTotal(value2.getOfficialAccountApplyUserCount());
-            result.setOfficialAccountApplyUserCountDay(value2.getOfficialAccountApplyUserCount());
-            result.setOfficialAccountApplyRateAll(value2.getOfficialAccountApplyRate());
-            result.setOfficialAccountApplyRateDay(value2.getOfficialAccountApplyRate());
-            result.setOfficialAccountApplyCostAll(value2.getOfficialAccountApplyCost());
-            result.setOfficialAccountApplyCostDay(value2.getOfficialAccountApplyCost());
-            result.setOfficialAccountApplyAmountTotal(value2.getOfficialAccountApplyAmount());
-            result.setOfficialAccountApplyAmountDay(value2.getOfficialAccountApplyAmount());
-            result.setOfficialAccountApplyRoiAll(value2.getOfficialAccountApplyRoi());
-            result.setOfficialAccountApplyRoiDay(value2.getOfficialAccountApplyRoi());
-            result.setOfficialAccountOrderCountTotal(value2.getOfficialAccountOrderCount());
-            result.setOfficialAccountOrderCountDay(value2.getOfficialAccountOrderCount());
-            result.setOfficialAccountFirstDayOrderCountTotal(value2.getOfficialAccountFirstDayOrderCount());
-            result.setOfficialAccountFirstDayOrderCountDay(value2.getOfficialAccountFirstDayOrderCount());
-            result.setOfficialAccountOrderUserCountTotal(value2.getOfficialAccountOrderUserCount());
-            result.setOfficialAccountOrderUserCountDay(value2.getOfficialAccountOrderUserCount());
-            result.setOfficialAccountOrderRateAll(value2.getOfficialAccountOrderRate());
-            result.setOfficialAccountOrderRateDay(value2.getOfficialAccountOrderRate());
-            result.setOfficialAccountOrderCostAll(value2.getOfficialAccountOrderCost());
-            result.setOfficialAccountOrderCostDay(value2.getOfficialAccountOrderCost());
-            result.setOfficialAccountOrderAmountTotal(value2.getOfficialAccountOrderAmount());
-            result.setOfficialAccountOrderAmountDay(value2.getOfficialAccountOrderAmount());
-            result.setOfficialAccountFirstDayOrderAmountTotal(value2.getOfficialAccountFirstDayOrderAmount());
-            result.setOfficialAccountFirstDayOrderAmountDay(value2.getOfficialAccountFirstDayOrderAmount());
-            result.setOfficialAccountOrderRoiAll(value2.getOfficialAccountOrderRoi());
-            result.setOfficialAccountOrderRoiDay(value2.getOfficialAccountOrderRoi());
-            result.setOfficialAccountConsultCountTotal(value2.getOfficialAccountConsultCount());
-            result.setOfficialAccountConsultCountDay(value2.getOfficialAccountConsultCount());
-            result.setOfficialAccountReaderCountTotal(value2.getOfficialAccountReaderCount());
-            result.setOfficialAccountReaderCountDay(value2.getOfficialAccountReaderCount());
-            result.setOfficialAccountCreditApplyUserCountTotal(value2.getOfficialAccountCreditApplyUserCount());
-            result.setOfficialAccountCreditApplyUserCountDay(value2.getOfficialAccountCreditApplyUserCount());
-            result.setOfficialAccountCreditUserCountTotal(value2.getOfficialAccountCreditUserCount());
-            result.setOfficialAccountCreditUserCountDay(value2.getOfficialAccountCreditUserCount());
-            result.setForwardCountTotal(value2.getForwardCount());
-            result.setForwardCountDay(value2.getForwardCount());
-            result.setForwardUserCountTotal(value2.getForwardUserCount());
-            result.setForwardUserCountDay(value2.getForwardUserCount());
-            result.setNoInterestCountTotal(value2.getNoInterestCount());
-            result.setNoInterestCountDay(value2.getNoInterestCount());
+        if (lastDayDWD == null) {
+            result.setCostDeviationRateTotal(dayODS.getCostDeviationRate());
+            result.setCostDeviationRateDay(dayODS.getCostDeviationRate());
+            result.setCostTotal(dayODS.getCost());
+            result.setCostDay(dayODS.getCost());
+            result.setCompensationAmountTotal(dayODS.getCompensationAmount());
+            result.setCompensationAmountDay(dayODS.getCompensationAmount());
+            result.setViewCountTotal(dayODS.getViewCount());
+            result.setViewCountDay(dayODS.getViewCount());
+            result.setViewUserCountTotal(dayODS.getViewUserCount());
+            result.setViewUserCountDay(dayODS.getViewUserCount());
+            result.setValidClickCountTotal(dayODS.getValidClickCount());
+            result.setValidClickCountDay(dayODS.getValidClickCount());
+            result.setClickUserCountTotal(dayODS.getClickUserCount());
+            result.setClickUserCountDay(dayODS.getClickUserCount());
+            result.setValuableClickCountTotal(dayODS.getValuableClickCount());
+            result.setValuableClickCountDay(dayODS.getValuableClickCount());
+            result.setConversionsCountTotal(dayODS.getConversionsCount());
+            result.setConversionsCountDay(dayODS.getConversionsCount());
+            result.setDeepConversionsCountTotal(dayODS.getDeepConversionsCount());
+            result.setDeepConversionsCountDay(dayODS.getDeepConversionsCount());
+            result.setKeyPageUvTotal(dayODS.getKeyPageUv());
+            result.setKeyPageUvDay(dayODS.getKeyPageUv());
+            result.setOrderCountTotal(dayODS.getOrderCount());
+            result.setOrderCountDay(dayODS.getOrderCount());
+            result.setFirstDayOrderCountTotal(dayODS.getFirstDayOrderCount());
+            result.setFirstDayOrderCountDay(dayODS.getFirstDayOrderCount());
+            result.setOrderAmountTotal(dayODS.getOrderAmount());
+            result.setOrderAmountDay(dayODS.getOrderAmount());
+            result.setFirstDayOrderAmountTotal(dayODS.getFirstDayOrderAmount());
+            result.setFirstDayOrderAmountDay(dayODS.getFirstDayOrderAmount());
+            result.setSignInCountTotal(dayODS.getSignInCount());
+            result.setSignInCountDay(dayODS.getSignInCount());
+            result.setAddWishlistCountTotal(dayODS.getAddWishlistCount());
+            result.setAddWishlistCountDay(dayODS.getAddWishlistCount());
+            result.setViewCommodityPageUvTotal(dayODS.getViewCommodityPageUv());
+            result.setViewCommodityPageUvDay(dayODS.getViewCommodityPageUv());
+            result.setPageReservationCountTotal(dayODS.getPageReservationCount());
+            result.setPageReservationCountDay(dayODS.getPageReservationCount());
+            result.setLeadsPurchaseUvTotal(dayODS.getLeadsPurchaseUv());
+            result.setLeadsPurchaseUvDay(dayODS.getLeadsPurchaseUv());
+            result.setScanFollowCountTotal(dayODS.getScanFollowCount());
+            result.setScanFollowCountDay(dayODS.getScanFollowCount());
+            result.setWechatAppRegisterUvTotal(dayODS.getWechatAppRegisterUv());
+            result.setWechatAppRegisterUvDay(dayODS.getWechatAppRegisterUv());
+            result.setWechatMinigameRetentionCountTotal(dayODS.getWechatMinigameRetentionCount());
+            result.setWechatMinigameRetentionCountDay(dayODS.getWechatMinigameRetentionCount());
+            result.setWechatMinigameCheckoutCountTotal(dayODS.getWechatMinigameCheckoutCount());
+            result.setWechatMinigameCheckoutCountDay(dayODS.getWechatMinigameCheckoutCount());
+            result.setWechatMinigameCheckoutAmountTotal(dayODS.getWechatMinigameCheckoutAmount());
+            result.setWechatMinigameCheckoutAmountDay(dayODS.getWechatMinigameCheckoutAmount());
+            result.setOfficialAccountFollowCountTotal(dayODS.getOfficialAccountFollowCount());
+            result.setOfficialAccountFollowCountDay(dayODS.getOfficialAccountFollowCount());
+            result.setOfficialAccountRegisterUserCountTotal(dayODS.getOfficialAccountRegisterUserCount());
+            result.setOfficialAccountRegisterUserCountDay(dayODS.getOfficialAccountRegisterUserCount());
+            result.setOfficialAccountRegisterAmountTotal(dayODS.getOfficialAccountRegisterAmount());
+            result.setOfficialAccountRegisterAmountDay(dayODS.getOfficialAccountRegisterAmount());
+            result.setOfficialAccountApplyCountTotal(dayODS.getOfficialAccountApplyCount());
+            result.setOfficialAccountApplyCountDay(dayODS.getOfficialAccountApplyCount());
+            result.setOfficialAccountApplyUserCountTotal(dayODS.getOfficialAccountApplyUserCount());
+            result.setOfficialAccountApplyUserCountDay(dayODS.getOfficialAccountApplyUserCount());
+            result.setOfficialAccountApplyAmountTotal(dayODS.getOfficialAccountApplyAmount());
+            result.setOfficialAccountApplyAmountDay(dayODS.getOfficialAccountApplyAmount());
+            result.setOfficialAccountOrderCountTotal(dayODS.getOfficialAccountOrderCount());
+            result.setOfficialAccountOrderCountDay(dayODS.getOfficialAccountOrderCount());
+            result.setOfficialAccountFirstDayOrderCountTotal(dayODS.getOfficialAccountFirstDayOrderCount());
+            result.setOfficialAccountFirstDayOrderCountDay(dayODS.getOfficialAccountFirstDayOrderCount());
+            result.setOfficialAccountOrderUserCountTotal(dayODS.getOfficialAccountOrderUserCount());
+            result.setOfficialAccountOrderUserCountDay(dayODS.getOfficialAccountOrderUserCount());
+            result.setOfficialAccountOrderAmountTotal(dayODS.getOfficialAccountOrderAmount());
+            result.setOfficialAccountOrderAmountDay(dayODS.getOfficialAccountOrderAmount());
+            result.setOfficialAccountFirstDayOrderAmountTotal(dayODS.getOfficialAccountFirstDayOrderAmount());
+            result.setOfficialAccountFirstDayOrderAmountDay(dayODS.getOfficialAccountFirstDayOrderAmount());
+            result.setOfficialAccountConsultCountTotal(dayODS.getOfficialAccountConsultCount());
+            result.setOfficialAccountConsultCountDay(dayODS.getOfficialAccountConsultCount());
+            result.setOfficialAccountReaderCountTotal(dayODS.getOfficialAccountReaderCount());
+            result.setOfficialAccountReaderCountDay(dayODS.getOfficialAccountReaderCount());
+            result.setOfficialAccountCreditApplyUserCountTotal(dayODS.getOfficialAccountCreditApplyUserCount());
+            result.setOfficialAccountCreditApplyUserCountDay(dayODS.getOfficialAccountCreditApplyUserCount());
+            result.setOfficialAccountCreditUserCountTotal(dayODS.getOfficialAccountCreditUserCount());
+            result.setOfficialAccountCreditUserCountDay(dayODS.getOfficialAccountCreditUserCount());
+            result.setForwardCountTotal(dayODS.getForwardCount());
+            result.setForwardCountDay(dayODS.getForwardCount());
+            result.setForwardUserCountTotal(dayODS.getForwardUserCount());
+            result.setForwardUserCountDay(dayODS.getForwardUserCount());
+            result.setNoInterestCountTotal(dayODS.getNoInterestCount());
+            result.setNoInterestCountDay(dayODS.getNoInterestCount());
         } else {
-            result.setCostDeviationRateTotal(value1.getCostDeviationRateTotal().add(value2.getCostDeviationRate()));
-            result.setCostDeviationRateDay(value2.getCostDeviationRate());
-            result.setCostTotal(value1.getCostTotal() + value2.getCost());
-            result.setCostDay(value2.getCost());
-            result.setCompensationAmountTotal(value1.getCompensationAmountTotal() + value2.getCompensationAmount());
-            result.setCompensationAmountDay(value2.getCompensationAmount());
-            result.setViewCountTotal(value1.getViewCountTotal() + value2.getViewCount());
-            result.setViewCountDay(value2.getViewCount());
+            result.setCostDeviationRateTotal(lastDayDWD.getCostDeviationRateTotal().add(dayODS.getCostDeviationRate()));
+            result.setCostDeviationRateDay(dayODS.getCostDeviationRate());
+            result.setCostTotal(lastDayDWD.getCostTotal() + dayODS.getCost());
+            result.setCostDay(dayODS.getCost());
+            result.setCompensationAmountTotal(lastDayDWD.getCompensationAmountTotal() + dayODS.getCompensationAmount());
+            result.setCompensationAmountDay(dayODS.getCompensationAmount());
+            result.setViewCountTotal(lastDayDWD.getViewCountTotal() + dayODS.getViewCount());
+            result.setViewCountDay(dayODS.getViewCount());
 
             // 应该不准,因为跨天的用户无法去重
-            result.setViewUserCountTotal(value1.getViewUserCountTotal() + value2.getViewUserCount());
-            result.setThousandDisplayPriceDay(value2.getThousandDisplayPrice());
-            result.setViewUserCountDay(value2.getViewUserCount());
-            result.setAvgViewPerUserDay(value2.getAvgViewPerUser());
-            result.setValidClickCountTotal(value1.getValidClickCountTotal() + value2.getValidClickCount());
-            result.setValidClickCountDay(value2.getValidClickCount());
+            result.setViewUserCountTotal(lastDayDWD.getViewUserCountTotal() + dayODS.getViewUserCount());
+            result.setViewUserCountDay(dayODS.getViewUserCount());
+            result.setValidClickCountTotal(lastDayDWD.getValidClickCountTotal() + dayODS.getValidClickCount());
+            result.setValidClickCountDay(dayODS.getValidClickCount());
 
             // 应该不准,因为跨天的用户无法去重
-            result.setClickUserCountTotal(value1.getClickUserCountTotal() + value2.getClickUserCount());
-            result.setClickUserCountDay(value2.getClickUserCount());
-            result.setCtrDay(value2.getCtr());
-            result.setCpcDay(value2.getCpc());
-            result.setValuableClickCountTotal(value1.getValuableClickCountTotal() + value2.getValuableClickCount());
-            result.setValuableClickCountDay(value2.getValuableClickCount());
-            result.setValuableClickRateDay(value2.getValuableClickRate());
-            result.setValuableClickCostDay(value2.getValuableClickCost());
-            result.setConversionsCountTotal(value1.getConversionsCountTotal() + value2.getConversionsCount());
-            result.setConversionsCountDay(value2.getConversionsCount());
-            result.setConversionsCostDay(value2.getConversionsCost());
-            result.setConversionsRateDay(value2.getConversionsRate());
-            result.setDeepConversionsCountTotal(value1.getDeepConversionsCountTotal() + value2.getDeepConversionsCount());
-            result.setDeepConversionsCountDay(value2.getDeepConversionsCount());
-            result.setDeepConversionsCostDay(value2.getDeepConversionsCost());
-            result.setDeepConversionsRateDay(value2.getDeepConversionsRate());
-            result.setKeyPageUvTotal(value1.getKeyPageUvTotal() + value2.getKeyPageUv());
-            result.setKeyPageUvDay(value2.getKeyPageUv());
-            result.setOrderCountTotal(value1.getOrderCountTotal() + value2.getOrderCount());
-            result.setOrderCountDay(value2.getOrderCount());
-            result.setFirstDayOrderCountTotal(value1.getFirstDayOrderCountTotal() + value2.getFirstDayOrderCount());
-            result.setFirstDayOrderCountDay(value2.getFirstDayOrderCount());
-            result.setWebOrderCostDay(value2.getWebOrderCost());
-            result.setOrderRateDay(value2.getOrderRate());
-            result.setOrderAmountTotal(value1.getOrderAmountTotal() + value2.getOrderAmount());
-            result.setOrderAmountDay(value2.getOrderAmount());
-            result.setFirstDayOrderAmountTotal(value1.getFirstDayOrderAmountTotal() + value2.getFirstDayOrderAmount());
-            result.setFirstDayOrderAmountDay(value2.getFirstDayOrderAmount());
-            result.setOrderUnitPriceDay(value2.getOrderUnitPrice());
-            result.setOrderRoiDay(value2.getOrderRoi());
-            result.setSignInCountTotal(value1.getSignInCountTotal() + value2.getSignInCount());
-            result.setSignInCountDay(value2.getSignInCount());
-            result.setAddWishlistCountTotal(value1.getAddWishlistCountTotal() + value2.getAddWishlistCount());
-            result.setAddWishlistCountDay(value2.getAddWishlistCount());
-            result.setViewCommodityPageUvTotal(value1.getViewCommodityPageUvTotal() + value2.getViewCommodityPageUv());
-            result.setViewCommodityPageUvDay(value2.getViewCommodityPageUv());
-            result.setPageReservationCountTotal(value1.getPageReservationCountTotal() + value2.getPageReservationCount());
-            result.setPageReservationCountDay(value2.getPageReservationCount());
+            result.setClickUserCountTotal(lastDayDWD.getClickUserCountTotal() + dayODS.getClickUserCount());
+            result.setClickUserCountDay(dayODS.getClickUserCount());
+            result.setCtrDay(dayODS.getCtr());
+            result.setCpcDay(dayODS.getCpc());
+            result.setValuableClickCountTotal(lastDayDWD.getValuableClickCountTotal() + dayODS.getValuableClickCount());
+            result.setValuableClickCountDay(dayODS.getValuableClickCount());
+            result.setConversionsCountTotal(lastDayDWD.getConversionsCountTotal() + dayODS.getConversionsCount());
+            result.setConversionsCountDay(dayODS.getConversionsCount());
+            result.setDeepConversionsCountTotal(lastDayDWD.getDeepConversionsCountTotal() + dayODS.getDeepConversionsCount());
+            result.setDeepConversionsCountDay(dayODS.getDeepConversionsCount());
+            result.setKeyPageUvTotal(lastDayDWD.getKeyPageUvTotal() + dayODS.getKeyPageUv());
+            result.setKeyPageUvDay(dayODS.getKeyPageUv());
+            result.setOrderCountTotal(lastDayDWD.getOrderCountTotal() + dayODS.getOrderCount());
+            result.setOrderCountDay(dayODS.getOrderCount());
+            result.setFirstDayOrderCountTotal(lastDayDWD.getFirstDayOrderCountTotal() + dayODS.getFirstDayOrderCount());
+            result.setFirstDayOrderCountDay(dayODS.getFirstDayOrderCount());
+            result.setOrderAmountTotal(lastDayDWD.getOrderAmountTotal() + dayODS.getOrderAmount());
+            result.setOrderAmountDay(dayODS.getOrderAmount());
+            result.setFirstDayOrderAmountTotal(lastDayDWD.getFirstDayOrderAmountTotal() + dayODS.getFirstDayOrderAmount());
+            result.setFirstDayOrderAmountDay(dayODS.getFirstDayOrderAmount());
+            result.setSignInCountTotal(lastDayDWD.getSignInCountTotal() + dayODS.getSignInCount());
+            result.setSignInCountDay(dayODS.getSignInCount());
+            result.setAddWishlistCountTotal(lastDayDWD.getAddWishlistCountTotal() + dayODS.getAddWishlistCount());
+            result.setAddWishlistCountDay(dayODS.getAddWishlistCount());
+            result.setViewCommodityPageUvTotal(lastDayDWD.getViewCommodityPageUvTotal() + dayODS.getViewCommodityPageUv());
+            result.setViewCommodityPageUvDay(dayODS.getViewCommodityPageUv());
+            result.setPageReservationCountTotal(lastDayDWD.getPageReservationCountTotal() + dayODS.getPageReservationCount());
+            result.setPageReservationCountDay(dayODS.getPageReservationCount());
 
             // 应该不准,因为跨天的用户无法去重
-            result.setLeadsPurchaseUvTotal(value1.getLeadsPurchaseUvTotal() + value2.getLeadsPurchaseUv());
-            result.setLeadsPurchaseUvDay(value2.getLeadsPurchaseUv());
-            result.setLeadsPurchaseCostDay(value2.getLeadsPurchaseCost());
-            result.setLeadsPurchaseRateDay(value2.getLeadsPurchaseRate());
-            result.setScanFollowCountTotal(value1.getScanFollowCountTotal() + value2.getScanFollowCount());
-            result.setScanFollowCountDay(value2.getScanFollowCount());
-            result.setWechatAppRegisterUvTotal(value1.getWechatAppRegisterUvTotal() + value2.getWechatAppRegisterUv());
-            result.setWechatAppRegisterUvDay(value2.getWechatAppRegisterUv());
-            result.setWechatMinigameRegisterCostDay(value2.getWechatMinigameRegisterCost());
-            result.setWechatMinigameRegisterRateDay(value2.getWechatMinigameRegisterRate());
-            result.setWechatMinigameArpuDay(value2.getWechatMinigameArpu());
-            result.setWechatMinigameRetentionCountTotal(value1.getWechatMinigameRetentionCountTotal() + value2.getWechatMinigameRetentionCount());
-            result.setWechatMinigameRetentionCountDay(value2.getWechatMinigameRetentionCount());
-            result.setWechatMinigameCheckoutCountTotal(value1.getWechatMinigameCheckoutCountTotal() + value2.getWechatMinigameCheckoutCount());
-            result.setWechatMinigameCheckoutCountDay(value2.getWechatMinigameCheckoutCount());
-            result.setWechatMinigameCheckoutAmountTotal(value1.getWechatMinigameCheckoutAmountTotal() + value2.getWechatMinigameCheckoutAmount());
-            result.setWechatMinigameCheckoutAmountDay(value2.getWechatMinigameCheckoutAmount());
-            result.setOfficialAccountFollowCountTotal(value1.getOfficialAccountFollowCountTotal() + value2.getOfficialAccountFollowCount());
-            result.setOfficialAccountFollowCountDay(value2.getOfficialAccountFollowCount());
-            result.setOfficialAccountFollowCostDay(value2.getOfficialAccountFollowCost());
-            result.setOfficialAccountFollowRateDay(value2.getOfficialAccountFollowRate());
-            result.setOfficialAccountRegisterUserCountTotal(value1.getOfficialAccountRegisterUserCountTotal() + value2.getOfficialAccountRegisterUserCount());
-            result.setOfficialAccountRegisterUserCountDay(value2.getOfficialAccountRegisterUserCount());
-            result.setOfficialAccountRegisterRateDay(value2.getOfficialAccountRegisterRate());
-            result.setOfficialAccountRegisterCostDay(value2.getOfficialAccountRegisterCost());
-            result.setOfficialAccountRegisterAmountTotal(value1.getOfficialAccountRegisterAmountTotal() + value2.getOfficialAccountRegisterAmount());
-            result.setOfficialAccountRegisterAmountDay(value2.getOfficialAccountRegisterAmount());
-            result.setOfficialAccountRegisterRoiDay(value2.getOfficialAccountRegisterRoi());
-            result.setOfficialAccountApplyCountTotal(value1.getOfficialAccountApplyCountTotal() + value2.getOfficialAccountApplyCount());
-            result.setOfficialAccountApplyCountDay(value2.getOfficialAccountApplyCount());
-            result.setOfficialAccountApplyUserCountTotal(value1.getOfficialAccountApplyUserCountTotal() + value2.getOfficialAccountApplyUserCount());
-            result.setOfficialAccountApplyUserCountDay(value2.getOfficialAccountApplyUserCount());
-            result.setOfficialAccountApplyRateDay(value2.getOfficialAccountApplyRate());
-            result.setOfficialAccountApplyCostDay(value2.getOfficialAccountApplyCost());
-            result.setOfficialAccountApplyAmountTotal(value1.getOfficialAccountApplyAmountTotal() + value2.getOfficialAccountApplyAmount());
-            result.setOfficialAccountApplyAmountDay(value2.getOfficialAccountApplyAmount());
-            result.setOfficialAccountApplyRoiDay(value2.getOfficialAccountApplyRoi());
-            result.setOfficialAccountOrderCountTotal(value1.getOfficialAccountOrderCountTotal() + value2.getOfficialAccountOrderCount());
-            result.setOfficialAccountOrderCountDay(value2.getOfficialAccountOrderCount());
-            result.setOfficialAccountFirstDayOrderCountTotal(value1.getOfficialAccountFirstDayOrderCountTotal() + value2.getOfficialAccountFirstDayOrderCount());
-            result.setOfficialAccountFirstDayOrderCountDay(value2.getOfficialAccountFirstDayOrderCount());
-            result.setOfficialAccountOrderUserCountTotal(value1.getOfficialAccountOrderUserCountTotal() + value2.getOfficialAccountOrderUserCount());
-            result.setOfficialAccountOrderUserCountDay(value2.getOfficialAccountOrderUserCount());
-            result.setOfficialAccountOrderRateDay(value2.getOfficialAccountOrderRate());
-            result.setOfficialAccountOrderCostDay(value2.getOfficialAccountOrderCost());
-            result.setOfficialAccountOrderAmountTotal(value1.getOfficialAccountOrderAmountTotal() + value2.getOfficialAccountOrderAmount());
-            result.setOfficialAccountOrderAmountDay(value2.getOfficialAccountOrderAmount());
-            result.setOfficialAccountFirstDayOrderAmountTotal(value1.getOfficialAccountFirstDayOrderAmountTotal() + value2.getOfficialAccountFirstDayOrderAmount());
-            result.setOfficialAccountFirstDayOrderAmountDay(value2.getOfficialAccountFirstDayOrderAmount());
-            result.setOfficialAccountOrderRoiDay(value2.getOfficialAccountOrderRoi());
-            result.setOfficialAccountConsultCountTotal(value1.getOfficialAccountConsultCountTotal() + value2.getOfficialAccountConsultCount());
-            result.setOfficialAccountConsultCountDay(value2.getOfficialAccountConsultCount());
-            result.setOfficialAccountReaderCountTotal(value1.getOfficialAccountReaderCountTotal() + value2.getOfficialAccountReaderCount());
-            result.setOfficialAccountReaderCountDay(value2.getOfficialAccountReaderCount());
-            result.setOfficialAccountCreditApplyUserCountTotal(value1.getOfficialAccountCreditApplyUserCountTotal() + value2.getOfficialAccountCreditApplyUserCount());
-            result.setOfficialAccountCreditApplyUserCountDay(value2.getOfficialAccountCreditApplyUserCount());
-            result.setOfficialAccountCreditUserCountTotal(value1.getOfficialAccountCreditUserCountTotal() + value2.getOfficialAccountCreditUserCount());
-            result.setOfficialAccountCreditUserCountDay(value2.getOfficialAccountCreditUserCount());
-            result.setForwardCountTotal(value1.getForwardCountTotal() + value2.getForwardCount());
-            result.setForwardCountDay(value2.getForwardCount());
-            result.setForwardUserCountTotal(value1.getForwardUserCountTotal() + value2.getForwardUserCount());
-            result.setForwardUserCountDay(value2.getForwardUserCount());
-            result.setNoInterestCountTotal(value1.getNoInterestCountTotal() + value2.getNoInterestCount());
-            result.setNoInterestCountDay(value2.getNoInterestCount());
-
-            // 曝光次数 / 曝光人数(不准)
-            result.setAvgViewPerUserAll(result.getViewUserCountTotal() == 0 ? BigDecimal.ZERO : NumberUtil.divideForAd(result.getViewCountTotal(), result.getViewUserCountTotal()));
-            // 广告点击次数 / 广告曝光次数
-            result.setCtrAll(result.getViewCountTotal() == 0 ? BigDecimal.ZERO : NumberUtil.divideForAd(result.getValidClickCountTotal(), result.getViewCountTotal()));
-            // 广告花费/广告点击次数
-            result.setCpcAll(result.getValidClickCountTotal() == 0 ? 0 : NumberUtil.divideForMoney(result.getCostTotal(), result.getValidClickCountTotal()));
-            // 广告可转化点击次数/广告曝光次数
-            result.setValuableClickRateAll(result.getViewCountTotal() == 0 ? BigDecimal.ZERO : NumberUtil.divideForAd(result.getValuableClickCountTotal(), result.getViewCountTotal()));
-            // 广告花费/可转化点击次数
-            result.setValuableClickCostAll(result.getValuableClickCountTotal() == 0 ? 0 : NumberUtil.divideForMoney(result.getCostTotal(), result.getValuableClickCountTotal()));
-            // 广告花费/转化目标量
-            result.setConversionsCostAll(result.getConversionsCountTotal() == 0 ? 0 : NumberUtil.divideForMoney(result.getCostTotal(), result.getConversionsCountTotal()));
-            // 公众号:转化目标量/点击次数。
-            result.setConversionsRateAll(result.getValidClickCountTotal() == 0 ? BigDecimal.ZERO : NumberUtil.divideForAd(result.getConversionsCountTotal(), result.getValidClickCountTotal()));
-            // 深度转化目标量/可转化点击次数
-            result.setDeepConversionsRateAll(result.getValuableClickCountTotal() == 0 ? BigDecimal.ZERO : NumberUtil.divideForAd(result.getDeepConversionsCountTotal(), result.getValuableClickCountTotal()));
-            // 广告花费/深度转化目标量
-            result.setDeepConversionsCostAll(result.getDeepConversionsCountTotal() == 0 ? 0 : NumberUtil.divideForMoney(result.getCostTotal(), result.getDeepConversionsCountTotal()));
-            // 广告花费/下单量
-            result.setWebOrderCostAll(result.getOrderCountTotal() == 0 ? 0 : NumberUtil.divideForMoney(result.getCostTotal(), result.getOrderCountTotal()));
-            // 下单量/点击次数
-            result.setOrderRateAll(result.getValidClickCountTotal() == 0 ? BigDecimal.ZERO : NumberUtil.divideForAd(result.getOrderCountTotal(), result.getValidClickCountTotal()));
-            // 下单金额/下单量
-            result.setOrderUnitPriceAll(result.getOrderCountTotal() == 0 ? 0 : NumberUtil.divideForMoney(result.getOrderAmountTotal(), result.getOrderCountTotal()));
-            // 下单金额/广告花费
-            result.setOrderRoiAll(result.getCostTotal() == 0 ? BigDecimal.ZERO : NumberUtil.divideForAd(result.getOrderAmountTotal(), result.getCostTotal()));
-            // 广告消耗/首次付费人数
-            result.setLeadsPurchaseCostAll(result.getLeadsPurchaseUvTotal() == 0 ? 0 : NumberUtil.divideForMoney(result.getCostTotal(), result.getLeadsPurchaseUvTotal()));
-            // 首次付费人数/广告点击次数
-            result.setLeadsPurchaseRateAll(result.getValidClickCountTotal() == 0 ? BigDecimal.ZERO : NumberUtil.divideForAd(result.getLeadsPurchaseUvTotal(), result.getValidClickCountTotal()));
-            // 广告消耗 / 小游戏注册人数
-            result.setWechatMinigameRegisterCostAll(result.getWechatAppRegisterUvTotal() == 0 ? 0 : NumberUtil.divideForMoney(result.getCostTotal(), result.getWechatAppRegisterUvTotal()));
-            // 小游戏注册人数 / 广告点击次数
-            result.setWechatMinigameRegisterRateAll(result.getValidClickCountTotal() == 0 ? BigDecimal.ZERO : NumberUtil.divideForAd(result.getWechatAppRegisterUvTotal(), result.getValidClickCountTotal()));
-            // 总收益 / 总人数
-            result.setWechatMinigameArpuAll(result.getWechatAppRegisterUvTotal() == 0 ? BigDecimal.ZERO : NumberUtil.divideForAd(result.getOrderAmountTotal(), result.getWechatAppRegisterUvTotal()));
-            // 广告消耗 / 关注次数
-            result.setOfficialAccountFollowCostAll(result.getOfficialAccountFollowCountTotal() == 0 ? 0 : NumberUtil.divideForMoney(result.getCostTotal(), result.getOfficialAccountFollowCountTotal()));
-            // 关注次数 / 点击次数
-            result.setOfficialAccountFollowRateAll(result.getValidClickCountTotal() == 0 ? BigDecimal.ZERO : NumberUtil.divideForAd(result.getOfficialAccountFollowCountTotal(), result.getValidClickCountTotal()));
-            // 公众号内注册人数 / 公众号关注次数
-            result.setOfficialAccountRegisterRateAll(result.getOfficialAccountFollowCountTotal() == 0 ? BigDecimal.ZERO : NumberUtil.divideForAd(result.getOfficialAccountRegisterUserCountTotal(), result.getOfficialAccountFollowCountTotal()));
-            // 公众号内填单的独立用户数/公众号关注次数
-            result.setOfficialAccountApplyRateAll(result.getOfficialAccountFollowCountTotal() == 0 ? BigDecimal.ZERO : NumberUtil.divideForAd(result.getOfficialAccountApplyUserCountTotal(), result.getOfficialAccountFollowCountTotal()));
-            // 广告消耗 / 广告注册人数
-            result.setOfficialAccountRegisterCostAll(result.getOfficialAccountRegisterUserCountTotal() == 0 ? 0 : NumberUtil.divideForMoney(result.getCostTotal(), result.getOfficialAccountRegisterUserCountTotal()));
-            // 注册产生的订单金额累计/广告花费
-            result.setOfficialAccountRegisterRoiAll(result.getCostTotal() == 0 ? 0 : NumberUtil.divideForMoney(result.getOfficialAccountRegisterAmountTotal(), result.getCostTotal()));
-            // 广告花费/广告产生的填单行为数量
-            result.setOfficialAccountApplyCostAll(result.getOfficialAccountApplyUserCountTotal() == 0 ? 0 : NumberUtil.divideForMoney(result.getCostTotal(), result.getOfficialAccountApplyUserCountTotal()));
-            // 填单产生的订单金额累计/广告花费
-            result.setOfficialAccountApplyRoiAll(result.getCostTotal() == 0 ? 0 : NumberUtil.divideForMoney(result.getOfficialAccountApplyAmountTotal(), result.getCostTotal()));
-            // 公众号内下单独立用户数(UV)/公众号关注次数
-            result.setOfficialAccountOrderRateAll(result.getOfficialAccountFollowCountTotal() == 0 ? BigDecimal.ZERO : NumberUtil.divideForAd(result.getOfficialAccountOrderUserCountTotal(), result.getOfficialAccountFollowCountTotal()));
-            // 广告花费/广告产生的下单行为数量
-            result.setOfficialAccountOrderCostAll(result.getOfficialAccountOrderCountTotal() == 0 ? 0 : NumberUtil.divideForMoney(result.getCostTotal(), result.getOfficialAccountOrderCountTotal()));
-            // 下单产生的订单金额累计/广告花费
-            result.setOfficialAccountOrderRoiAll(result.getCostTotal() == 0 ? 0 : NumberUtil.divideForMoney(result.getOfficialAccountOrderAmountTotal(), result.getCostTotal()));
-            // 总消耗 / 总曝光
-            result.setThousandDisplayPriceAll(result.getViewCountTotal() == 0 ? 0 : NumberUtil.divideForAd(result.getCostTotal(), result.getViewCountTotal()).multiply(new BigDecimal(1000)).longValue());
-        }
+            result.setLeadsPurchaseUvTotal(lastDayDWD.getLeadsPurchaseUvTotal() + dayODS.getLeadsPurchaseUv());
+            result.setLeadsPurchaseUvDay(dayODS.getLeadsPurchaseUv());
+            result.setScanFollowCountTotal(lastDayDWD.getScanFollowCountTotal() + dayODS.getScanFollowCount());
+            result.setScanFollowCountDay(dayODS.getScanFollowCount());
+            result.setWechatAppRegisterUvTotal(lastDayDWD.getWechatAppRegisterUvTotal() + dayODS.getWechatAppRegisterUv());
+            result.setWechatAppRegisterUvDay(dayODS.getWechatAppRegisterUv());
+            result.setWechatMinigameRetentionCountTotal(lastDayDWD.getWechatMinigameRetentionCountTotal() + dayODS.getWechatMinigameRetentionCount());
+            result.setWechatMinigameRetentionCountDay(dayODS.getWechatMinigameRetentionCount());
+            result.setWechatMinigameCheckoutCountTotal(lastDayDWD.getWechatMinigameCheckoutCountTotal() + dayODS.getWechatMinigameCheckoutCount());
+            result.setWechatMinigameCheckoutCountDay(dayODS.getWechatMinigameCheckoutCount());
+            result.setWechatMinigameCheckoutAmountTotal(lastDayDWD.getWechatMinigameCheckoutAmountTotal() + dayODS.getWechatMinigameCheckoutAmount());
+            result.setWechatMinigameCheckoutAmountDay(dayODS.getWechatMinigameCheckoutAmount());
+            result.setOfficialAccountFollowCountTotal(lastDayDWD.getOfficialAccountFollowCountTotal() + dayODS.getOfficialAccountFollowCount());
+            result.setOfficialAccountFollowCountDay(dayODS.getOfficialAccountFollowCount());
+            result.setOfficialAccountRegisterUserCountTotal(lastDayDWD.getOfficialAccountRegisterUserCountTotal() + dayODS.getOfficialAccountRegisterUserCount());
+            result.setOfficialAccountRegisterUserCountDay(dayODS.getOfficialAccountRegisterUserCount());
+            result.setOfficialAccountRegisterAmountTotal(lastDayDWD.getOfficialAccountRegisterAmountTotal() + dayODS.getOfficialAccountRegisterAmount());
+            result.setOfficialAccountRegisterAmountDay(dayODS.getOfficialAccountRegisterAmount());
+            result.setOfficialAccountApplyCountTotal(lastDayDWD.getOfficialAccountApplyCountTotal() + dayODS.getOfficialAccountApplyCount());
+            result.setOfficialAccountApplyCountDay(dayODS.getOfficialAccountApplyCount());
+            result.setOfficialAccountApplyUserCountTotal(lastDayDWD.getOfficialAccountApplyUserCountTotal() + dayODS.getOfficialAccountApplyUserCount());
+            result.setOfficialAccountApplyUserCountDay(dayODS.getOfficialAccountApplyUserCount());
+            result.setOfficialAccountApplyAmountTotal(lastDayDWD.getOfficialAccountApplyAmountTotal() + dayODS.getOfficialAccountApplyAmount());
+            result.setOfficialAccountApplyAmountDay(dayODS.getOfficialAccountApplyAmount());
+            result.setOfficialAccountOrderCountTotal(lastDayDWD.getOfficialAccountOrderCountTotal() + dayODS.getOfficialAccountOrderCount());
+            result.setOfficialAccountOrderCountDay(dayODS.getOfficialAccountOrderCount());
+            result.setOfficialAccountFirstDayOrderCountTotal(lastDayDWD.getOfficialAccountFirstDayOrderCountTotal() + dayODS.getOfficialAccountFirstDayOrderCount());
+            result.setOfficialAccountFirstDayOrderCountDay(dayODS.getOfficialAccountFirstDayOrderCount());
+            result.setOfficialAccountOrderUserCountTotal(lastDayDWD.getOfficialAccountOrderUserCountTotal() + dayODS.getOfficialAccountOrderUserCount());
+            result.setOfficialAccountOrderUserCountDay(dayODS.getOfficialAccountOrderUserCount());
+            result.setOfficialAccountOrderAmountTotal(lastDayDWD.getOfficialAccountOrderAmountTotal() + dayODS.getOfficialAccountOrderAmount());
+            result.setOfficialAccountOrderAmountDay(dayODS.getOfficialAccountOrderAmount());
+            result.setOfficialAccountFirstDayOrderAmountTotal(lastDayDWD.getOfficialAccountFirstDayOrderAmountTotal() + dayODS.getOfficialAccountFirstDayOrderAmount());
+            result.setOfficialAccountFirstDayOrderAmountDay(dayODS.getOfficialAccountFirstDayOrderAmount());
+            result.setOfficialAccountConsultCountTotal(lastDayDWD.getOfficialAccountConsultCountTotal() + dayODS.getOfficialAccountConsultCount());
+            result.setOfficialAccountConsultCountDay(dayODS.getOfficialAccountConsultCount());
+            result.setOfficialAccountReaderCountTotal(lastDayDWD.getOfficialAccountReaderCountTotal() + dayODS.getOfficialAccountReaderCount());
+            result.setOfficialAccountReaderCountDay(dayODS.getOfficialAccountReaderCount());
+            result.setOfficialAccountCreditApplyUserCountTotal(lastDayDWD.getOfficialAccountCreditApplyUserCountTotal() + dayODS.getOfficialAccountCreditApplyUserCount());
+            result.setOfficialAccountCreditApplyUserCountDay(dayODS.getOfficialAccountCreditApplyUserCount());
+            result.setOfficialAccountCreditUserCountTotal(lastDayDWD.getOfficialAccountCreditUserCountTotal() + dayODS.getOfficialAccountCreditUserCount());
+            result.setOfficialAccountCreditUserCountDay(dayODS.getOfficialAccountCreditUserCount());
+            result.setForwardCountTotal(lastDayDWD.getForwardCountTotal() + dayODS.getForwardCount());
+            result.setForwardCountDay(dayODS.getForwardCount());
+            result.setForwardUserCountTotal(lastDayDWD.getForwardUserCountTotal() + dayODS.getForwardUserCount());
+            result.setForwardUserCountDay(dayODS.getForwardUserCount());
+            result.setNoInterestCountTotal(lastDayDWD.getNoInterestCountTotal() + dayODS.getNoInterestCount());
+            result.setNoInterestCountDay(dayODS.getNoInterestCount());
+        }
+        // 曝光次数 / 曝光人数
+        result.setAvgViewPerUserAll(NumberUtil.divideForAd(result.getViewCountTotal(), result.getViewUserCountTotal()));
+        result.setAvgViewPerUserDay(NumberUtil.divideForAd(result.getViewCountDay(), result.getViewUserCountDay()));
+        // 总消耗 / 总曝光
+        result.setThousandDisplayPriceAll(NumberUtil.divideForAd(result.getCostTotal(), result.getViewCountTotal()).multiply(new BigDecimal(1000)).longValue());
+        result.setThousandDisplayPriceDay(NumberUtil.divideForAd(result.getCostDay(), result.getViewCountDay()).multiply(new BigDecimal(1000)).longValue());
+        // 广告点击次数 / 广告曝光次数
+        result.setCtrAll(NumberUtil.divideForAd(result.getValidClickCountTotal(), result.getViewCountTotal()));
+        result.setCtrDay(NumberUtil.divideForAd(result.getValidClickCountDay(), result.getViewCountDay()));
+        // 广告花费/广告点击次数
+        result.setCpcAll(NumberUtil.divideForMoney(result.getCostTotal(), result.getValidClickCountTotal()));
+        result.setCpcDay(NumberUtil.divideForMoney(result.getCostDay(), result.getValidClickCountDay()));
+        // 广告可转化点击次数/广告曝光次数
+        result.setValuableClickRateAll(NumberUtil.divideForAd(result.getValuableClickCountTotal(), result.getViewCountTotal()));
+        result.setValuableClickRateDay(NumberUtil.divideForAd(result.getValuableClickCountDay(), result.getViewCountDay()));
+        // 广告花费/可转化点击次数
+        result.setValuableClickCostAll(NumberUtil.divideForMoney(result.getCostTotal(), result.getValuableClickCountTotal()));
+        result.setValuableClickCostDay(NumberUtil.divideForMoney(result.getCostDay(), result.getValuableClickCountDay()));
+        // 广告花费/转化目标量
+        result.setConversionsCostAll(NumberUtil.divideForMoney(result.getCostTotal(), result.getConversionsCountTotal()));
+        result.setConversionsCostDay(NumberUtil.divideForMoney(result.getCostDay(), result.getConversionsCountDay()));
+        // 公众号:转化目标量/点击次数。
+        result.setConversionsRateAll(NumberUtil.divideForAd(result.getConversionsCountTotal(), result.getValidClickCountTotal()));
+        result.setConversionsRateDay(NumberUtil.divideForAd(result.getConversionsCountDay(), result.getValidClickCountDay()));
+        // 广告花费/深度转化目标量
+        result.setDeepConversionsCostAll(NumberUtil.divideForMoney(result.getCostTotal(), result.getDeepConversionsCountTotal()));
+        result.setDeepConversionsCostDay(NumberUtil.divideForMoney(result.getCostDay(), result.getDeepConversionsCountDay()));
+        // 深度转化目标量/可转化点击次数
+        result.setDeepConversionsRateAll(NumberUtil.divideForAd(result.getDeepConversionsCountTotal(), result.getValuableClickCountTotal()));
+        result.setDeepConversionsRateDay(NumberUtil.divideForAd(result.getDeepConversionsCountDay(), result.getValuableClickCountDay()));
+        // 广告花费/下单量
+        result.setWebOrderCostAll(NumberUtil.divideForMoney(result.getCostTotal(), result.getOrderCountTotal()));
+        result.setWebOrderCostDay(NumberUtil.divideForMoney(result.getCostDay(), result.getOrderCountDay()));
+        // 下单量/点击次数
+        result.setOrderRateAll(NumberUtil.divideForAd(result.getOrderCountTotal(), result.getValidClickCountTotal()));
+        result.setOrderRateDay(NumberUtil.divideForAd(result.getOrderCountDay(), result.getValidClickCountDay()));
+        // 下单金额/下单量
+        result.setOrderUnitPriceAll(NumberUtil.divideForMoney(result.getOrderAmountTotal(), result.getOrderCountTotal()));
+        result.setOrderUnitPriceDay(NumberUtil.divideForMoney(result.getOrderAmountDay(), result.getOrderCountDay()));
+        // 下单金额/广告花费
+        result.setOrderRoiAll(NumberUtil.divideForAd(result.getOrderAmountTotal(), result.getCostTotal()));
+        result.setOrderRoiDay(NumberUtil.divideForAd(result.getOrderAmountDay(), result.getCostDay()));
+        // 广告消耗/首次付费人数
+        result.setLeadsPurchaseCostAll(NumberUtil.divideForMoney(result.getCostTotal(), result.getLeadsPurchaseUvTotal()));
+        result.setLeadsPurchaseCostDay(NumberUtil.divideForMoney(result.getCostDay(), result.getLeadsPurchaseUvDay()));
+        // 首次付费人数/广告点击次数
+        result.setLeadsPurchaseRateAll(NumberUtil.divideForAd(result.getLeadsPurchaseUvTotal(), result.getValidClickCountTotal()));
+        result.setLeadsPurchaseRateDay(NumberUtil.divideForAd(result.getLeadsPurchaseUvDay(), result.getValidClickCountDay()));
+        // 广告消耗 / 小游戏注册人数
+        result.setWechatMinigameRegisterCostAll(NumberUtil.divideForMoney(result.getCostTotal(), result.getWechatAppRegisterUvTotal()));
+        result.setWechatMinigameRegisterCostDay(NumberUtil.divideForMoney(result.getCostDay(), result.getWechatAppRegisterUvDay()));
+        // 小游戏注册人数 / 广告点击次数
+        result.setWechatMinigameRegisterRateAll(NumberUtil.divideForAd(result.getWechatAppRegisterUvTotal(), result.getValidClickCountTotal()));
+        result.setWechatMinigameRegisterRateDay(NumberUtil.divideForAd(result.getWechatAppRegisterUvDay(), result.getValidClickCountDay()));
+        // 总收益 / 总人数
+        result.setWechatMinigameArpuAll(NumberUtil.divideForAd(result.getOrderAmountTotal(), result.getWechatAppRegisterUvTotal()));
+        result.setWechatMinigameArpuDay(NumberUtil.divideForAd(result.getOrderAmountDay(), result.getWechatAppRegisterUvDay()));
+        // 广告消耗 / 关注次数
+        result.setOfficialAccountFollowCostAll(NumberUtil.divideForMoney(result.getCostTotal(), result.getOfficialAccountFollowCountTotal()));
+        result.setOfficialAccountFollowCostDay(NumberUtil.divideForMoney(result.getCostDay(), result.getOfficialAccountFollowCountDay()));
+        // 关注次数 / 点击次数
+        result.setOfficialAccountFollowRateAll(NumberUtil.divideForAd(result.getOfficialAccountFollowCountTotal(), result.getValidClickCountTotal()));
+        result.setOfficialAccountFollowRateDay(NumberUtil.divideForAd(result.getOfficialAccountFollowCountDay(), result.getValidClickCountDay()));
+        // 公众号内注册人数 / 公众号关注次数
+        result.setOfficialAccountRegisterRateAll(NumberUtil.divideForAd(result.getOfficialAccountRegisterUserCountTotal(), result.getOfficialAccountFollowCountTotal()));
+        result.setOfficialAccountRegisterRateDay(NumberUtil.divideForAd(result.getOfficialAccountRegisterUserCountDay(), result.getOfficialAccountFollowCountDay()));
+        // 广告消耗 / 广告注册人数
+        result.setOfficialAccountRegisterCostAll(NumberUtil.divideForMoney(result.getCostTotal(), result.getOfficialAccountRegisterUserCountTotal()));
+        result.setOfficialAccountRegisterCostDay(NumberUtil.divideForMoney(result.getCostDay(), result.getOfficialAccountRegisterUserCountDay()));
+        // 注册产生的订单金额累计/广告花费
+        result.setOfficialAccountRegisterRoiAll(NumberUtil.divideForMoney(result.getOfficialAccountRegisterAmountTotal(), result.getCostTotal()));
+        result.setOfficialAccountRegisterRoiDay(NumberUtil.divideForMoney(result.getOfficialAccountRegisterAmountDay(), result.getCostDay()));
+        // 公众号内填单的独立用户数/公众号关注次数
+        result.setOfficialAccountApplyRateAll(NumberUtil.divideForAd(result.getOfficialAccountApplyUserCountTotal(), result.getOfficialAccountFollowCountTotal()));
+        result.setOfficialAccountApplyRateDay(NumberUtil.divideForAd(result.getOfficialAccountApplyUserCountDay(), result.getOfficialAccountFollowCountDay()));
+        // 广告花费/广告产生的填单行为数量
+        result.setOfficialAccountApplyCostAll(NumberUtil.divideForMoney(result.getCostTotal(), result.getOfficialAccountApplyUserCountTotal()));
+        result.setOfficialAccountApplyCostDay(NumberUtil.divideForMoney(result.getCostDay(), result.getOfficialAccountApplyUserCountDay()));
+        // 填单产生的订单金额累计/广告花费
+        result.setOfficialAccountApplyRoiAll(NumberUtil.divideForMoney(result.getOfficialAccountApplyAmountTotal(), result.getCostTotal()));
+        result.setOfficialAccountApplyRoiDay(NumberUtil.divideForMoney(result.getOfficialAccountApplyAmountDay(), result.getCostDay()));
+        // 公众号内下单独立用户数(UV)/公众号关注次数
+        result.setOfficialAccountOrderRateAll(NumberUtil.divideForAd(result.getOfficialAccountOrderUserCountTotal(), result.getOfficialAccountFollowCountTotal()));
+        result.setOfficialAccountOrderRateDay(NumberUtil.divideForAd(result.getOfficialAccountOrderUserCountDay(), result.getOfficialAccountFollowCountDay()));
+        // 广告花费/广告产生的下单行为数量
+        result.setOfficialAccountOrderCostAll(NumberUtil.divideForMoney(result.getCostTotal(), result.getOfficialAccountOrderCountTotal()));
+        result.setOfficialAccountOrderCostDay(NumberUtil.divideForMoney(result.getCostDay(), result.getOfficialAccountOrderCountDay()));
+        // 下单产生的订单金额累计/广告花费
+        result.setOfficialAccountOrderRoiAll(NumberUtil.divideForMoney(result.getOfficialAccountOrderAmountTotal(), result.getCostTotal()));
+        result.setOfficialAccountOrderRoiDay(NumberUtil.divideForMoney(result.getOfficialAccountOrderAmountDay(), result.getCostDay()));
         return result;
     }
 

+ 1 - 0
flink-ad-monitoring/src/main/java/flink/zanxiangnet/ad/monitoring/process/AdMinuteDWDProcess.java

@@ -141,6 +141,7 @@ public class AdMinuteDWDProcess extends ProcessWindowFunction<AdDataOfMinuteODS,
                         // 聚合当天的全部数据
                         AdStatOfMinuteDWD lastHourAdStat = AdStatOfMinuteDWD.reduce(yesterdayDayDWD, lastHourMinuteODSList, lastHourMinuteODS, lastReduce, now);
                         collector.collect(lastHourAdStat);
+                        lastReduceState.put(lastHourStatTime.format(formatForLastReduceKey), lastHourAdStat);
                     }
                 }
                 // 造一条空数据