hcst_sunzhen преди 5 години
родител
ревизия
b7a093e071

+ 8 - 6
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/mapper/xml/ByteDanceVideoReportDailyMapper.xml

@@ -199,6 +199,8 @@
         when sum(a.show_material) != 0
         then sum(a.valid_play)/sum(a.show_material)
         else 0 end as validPlayRate, -- 视频数据-有效播放率  有效播放数/展示数
+
+        case
         when sum(a.valid_play) != 0
         then sum(a.average_play_time_per_play*a.valid_play)/sum(a.valid_play)
         else 0 end as averagePlayTimePerPlay,         -- 视频数据-平均单次播放时长
@@ -483,20 +485,20 @@
             <when test="role == 'admin' or role == 'designTeamLeader'">
                 and 1=1
             </when>
-            <otherwise>
+            <otherwise>F
                 and a.id = 0
             </otherwise>
         </choose>
 
         <if test="signature != null and signature != '' ">
-            and e.code = #{signature}
+            and a.signature = #{signature}
         </if>
 
+        group by a.signature
         <if test="cost != null">
-            and cost &gt;= #{cost}
+            having sum(a.cost) &gt;= #{cost}
         </if>
-        group by signature
-        order by cost
+        order by sum(a.cost)
     </select>
 
     <select id="getRoleCodeByUserId" resultType="string">
@@ -720,7 +722,7 @@
         </choose>
 
         <if test="signature != null and signature != '' ">
-            and e.code = #{signature}
+            and a.signature = #{signature}
         </if>
         <if test="cost != null">
             and cost &gt;= #{cost}

+ 8 - 8
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/service/impl/ByteDanceVideoReportDailyServiceImpl.java

@@ -45,15 +45,15 @@ public class ByteDanceVideoReportDailyServiceImpl extends ServiceImpl<ByteDanceV
         byteDanceVideoReportDailyMapper.delete(wrapper);
 
         List<ByteDanceVideoReportDaily> mList = byteDanceVideoReportDailyMapper.videoInfoList(startDate, endDate, companyId);
-        //for (ByteDanceVideoReportDaily m:mList){
-        //    byteDanceVideoReportDailyMapper.insert(m);
-        //}
-        //
+        for (ByteDanceVideoReportDaily m:mList){
+            byteDanceVideoReportDailyMapper.insert(m);
+        }
+
         //QueryWrapper<ByteDanceVideoReportDaily> queryWrapper = new QueryWrapper<>();
-        //
-        //List<ByteDanceVideoReportDaily> mList2 = byteDanceVideoReportDailyMapper.selectList(queryWrapper);
 
-        for(ByteDanceVideoReportDaily m:mList){
+        List<ByteDanceVideoReportDaily> mList2 = byteDanceVideoReportDailyMapper.selectList(wrapper);
+
+        for(ByteDanceVideoReportDaily m:mList2){
             String statDate  = DateUtils.formatDate(DateUtils.addDay(m.getStatDatetime(),-1));
             BigDecimal cost = byteDanceVideoReportDailyMapper.getVideoReportDailyByDateAndSignature(statDate,statDate,m.getSignature(),companyId);
 
@@ -63,7 +63,7 @@ public class ByteDanceVideoReportDailyServiceImpl extends ServiceImpl<ByteDanceV
             }
 
             m.setHuanbi(huanbi);
-            byteDanceVideoReportDailyMapper.insert(m);
+            byteDanceVideoReportDailyMapper.updateById(m);
         }
     }