Przeglądaj źródła

盯盘经理-运营组数据修改

yangzian 2 lat temu
rodzic
commit
8e3b980af2

+ 1 - 0
jeecg-boot-material-view/src/main/java/org/jeecg/ctop/material/mapper/MaterialStareMapper.java

@@ -27,6 +27,7 @@ public interface MaterialStareMapper {
 
     // 头条 同公司所有下级运营人员 有消耗的
     Set<String> getBytedanceAllOperators(@Param("companyId")String companyId,@Param("startDate")Long start, @Param("endDate")Long endDate,@Param("userIds")Set<String> userIds);
+    Set<String> getAllOperatorsByLearderId(@Param("learderId")String learderId);
     //快手-在投项目数量
     String getKuaiShouOperatorProjectNum(@Param("startDate") Long start, @Param("endDate") Long endDate, @Param("userIds") Set<String> userIds);
     //头条-在投项目数量

+ 14 - 22
jeecg-boot-material-view/src/main/java/org/jeecg/ctop/material/mapper/xml/MaterialStareMapper.xml

@@ -465,10 +465,8 @@
         (SELECT u.realname from `jeecg-boot`.sys_user u where u.id = d.user_id) as userName
         FROM
         application.kuaishou_account_report_daily_dw d
-        LEFT JOIN `jeecg-boot`.ctop_user_allocation u on d.account_id = u.account_id
         WHERE
         d.charge > 0
-        and u.account_status = 0
         <if test="startDate != null and startDate != '' ">
             and d.stat_date &gt;= #{startDate}
         </if>
@@ -503,10 +501,8 @@
         (SELECT u.realname from `jeecg-boot`.sys_user u where u.id = d.user_id) as userName
         FROM
         application.kuaishou_account_report_daily_dw d
-        LEFT JOIN `jeecg-boot`.ctop_user_allocation u on d.account_id = u.account_id
         WHERE
         d.charge > 0
-        and u.account_status = 0
         <if test="startDate != null and startDate != '' ">
             and d.stat_date &gt;= #{startDate}
         </if>
@@ -530,10 +526,8 @@
         (SELECT u.realname from `jeecg-boot`.sys_user u where u.id = d.user_id) as userName
         FROM
         application.bytedance_advertiser_report_hourly_dw d
-        LEFT JOIN `jeecg-boot`.ctop_user_allocation u on d.account_id = u.account_id
         WHERE
         d.cost > 0
-        and u.account_status = 0
         <if test="startDate != null and startDate != '' ">
             and d.stat_datetime &gt;= #{startDate}
         </if>
@@ -563,10 +557,8 @@
         (SELECT u.realname from `jeecg-boot`.sys_user u where u.id = d.user_id) as userName
         FROM
         application.bytedance_advertiser_report_daily_dw d
-        LEFT JOIN `jeecg-boot`.ctop_user_allocation u on d.account_id = u.account_id
         WHERE
         d.cost > 0
-        and u.account_status = 0
         <if test="startDate != null and startDate != '' ">
             and d.stat_datetime &gt;= #{startDate}
         </if>
@@ -595,10 +587,8 @@
         (SELECT u.realname from `jeecg-boot`.sys_user u where u.id = d.user_id) as userName
         FROM
         application.kuaishou_account_report_hourly_dw d
-        LEFT JOIN `jeecg-boot`.ctop_user_allocation u on d.account_id = u.account_id
         WHERE
         d.charge > 0
-        and u.account_status = 0
         <if test="startDate != null and startDate != '' ">
             and d.stat_date &gt;= #{startDate}
         </if>
@@ -625,10 +615,8 @@
         (SELECT u.realname from `jeecg-boot`.sys_user u where u.id = d.user_id) as userName
         FROM
         application.bytedance_advertiser_report_hourly_dw d
-        LEFT JOIN `jeecg-boot`.ctop_user_allocation u on d.account_id = u.account_id
         WHERE
         d.cost > 0
-        and u.account_status = 0
         <if test="startDate != null and startDate != '' ">
             and d.stat_datetime &gt;= #{startDate}
         </if>
@@ -677,10 +665,8 @@
         IFNULL(ROUND( SUM( d.charge ) / SUM( d.form_count ), 2 ),0) AS formCountPrice
         FROM
         application.kuaishou_account_report_daily_dw d
-        LEFT JOIN `jeecg-boot`.ctop_user_allocation u on d.account_id = u.account_id
         WHERE
         d.charge > 0
-        and u.account_status = 0
         <if test="startDate != null and startDate != '' ">
             and d.stat_date &gt;= #{startDate}
         </if>
@@ -712,10 +698,8 @@
         ( SELECT realname FROM `jeecg-boot`.sys_user u WHERE u.id = d.user_id ) AS userName
         FROM
         application.bytedance_advertiser_report_hourly_dw d
-        LEFT JOIN `jeecg-boot`.ctop_user_allocation u on d.account_id = u.account_id
         WHERE
         d.cost > 0
-        and u.account_status = 0
         <if test="startDate != null and startDate != '' ">
             and d.stat_datetime &gt;= #{startDate}
         </if>
@@ -742,10 +726,8 @@
         SUM( d.charge ) AS totalCost
         FROM
         application.kuaishou_account_report_hourly_dw d
-        LEFT JOIN `jeecg-boot`.ctop_user_allocation u ON d.account_id = u.account_id
         WHERE
         d.charge > 0
-        AND u.account_status = 0
         <if test="startDate != null and startDate != '' ">
             and d.stat_date &gt;= #{startDate}
         </if>
@@ -777,10 +759,8 @@
         SUM( d.cost ) AS totalCost
         FROM
         application.bytedance_advertiser_report_hourly_dw d
-        LEFT JOIN `jeecg-boot`.ctop_user_allocation u ON d.account_id = u.account_id
         WHERE
         d.cost > 0
-        AND u.account_status = 0
         <if test="startDate != null and startDate != '' ">
             and d.stat_datetime &gt;= #{startDate}
         </if>
@@ -846,10 +826,8 @@
         IFNULL(SUM(d.photo_click),0) as photoClick
         FROM
         application.kuaishou_account_report_daily_dw d
-        LEFT JOIN `jeecg-boot`.ctop_user_allocation u on d.account_id = u.account_id
         WHERE
         d.charge > 0
-        and u.account_status = 0
         <if test="startDate != null and startDate != '' ">
             and d.stat_date &gt;= #{startDate}
         </if>
@@ -1881,4 +1859,18 @@
 
     </select>
 
+
+    <!-- 所有下级运营人员 -->
+    <select id="getAllOperatorsByLearderId" resultType="java.lang.String">
+        SELECT
+            user_id
+        FROM
+            application.`app_user_manage`
+        WHERE
+            manage_id = #{learderId}
+          AND type = 1
+    </select>
+
+
+
 </mapper>

+ 14 - 5
jeecg-boot-material-view/src/main/java/org/jeecg/ctop/material/service/impl/MaterialStareServiceImpl.java

@@ -1515,7 +1515,11 @@ public class MaterialStareServiceImpl implements MaterialStareService {
            List<KuaiShouOperateGroupVo> operationList = ListPageUtil.page(operationManagerList, pageSize, pageNum);
             for (KuaiShouOperateGroupVo groupVo : operationList) {
                 //下级员工
-                Set<String> operatorUserIds = getAffiliateId(groupVo.getUserId());
+                //Set<String> operatorUserIds = getAffiliateId(groupVo.getUserId());
+                //运营经理下的下级员工
+                Set<String> operatorUserIds = materialStareMapper.getAllOperatorsByLearderId(groupVo.getUserId());
+
+
                 //有消耗的账户
                 if (mediaType.equals("1")){
                     operatorUserIds = materialStareMapper.getBytedanceAllOperators(null,DateUtils.getDateInteger(startTime).longValue(),DateUtils.getDateInteger(endTime).longValue(),operatorUserIds);
@@ -1530,7 +1534,7 @@ public class MaterialStareServiceImpl implements MaterialStareService {
                 }
 
                 //运营数量
-                int operationNum = Check.isNull(operatorUserIds) ? 0 : operatorUserIds.size();
+                int operationNum = Check.isNull(getAffiliateId(groupVo.getUserId())) ? 0 : getAffiliateId(groupVo.getUserId()).size();
                 groupVo.setOperationNum(operationNum);
 
                 //查询账户数据
@@ -1672,7 +1676,12 @@ public class MaterialStareServiceImpl implements MaterialStareService {
 
             for (KuaiShouOperateGroupVo groupVo : operationManagerList) {
                 //下级员工
-                Set<String> operatorUserIds = getAffiliateId(groupVo.getUserId());
+                //Set<String> operatorUserIds = getAffiliateId(groupVo.getUserId());
+
+                //运营经理下的下级员工
+                Set<String> operatorUserIds = materialStareMapper.getAllOperatorsByLearderId(groupVo.getUserId());
+
+
                 //有消耗的账户
                 if (mediaType.equals("1")){
                     operatorUserIds = materialStareMapper.getBytedanceAllOperators(null,DateUtils.getDateInteger(startTime).longValue(),DateUtils.getDateInteger(endTime).longValue(),operatorUserIds);
@@ -1686,7 +1695,7 @@ public class MaterialStareServiceImpl implements MaterialStareService {
                 }
 
                 //运营数量
-                int operationNum = Check.isNull(operatorUserIds) ? 0 : operatorUserIds.size();
+                int operationNum = Check.isNull(getAffiliateId(groupVo.getUserId())) ? 0 : getAffiliateId(groupVo.getUserId()).size();
                 groupVo.setOperationNum(operationNum);
 
                 //查询账户数据
@@ -1701,7 +1710,7 @@ public class MaterialStareServiceImpl implements MaterialStareService {
                         listOperate = materialStareMapper.getBytedanceOperateInfo(startDate,entDate,operatorUserIds);
                     }
                 }else {
-                    listOperate= materialStareMapper.getBytedanceOperateInfoHourly(startDate,entDate,operatorUserIds);
+                    listOperate= materialStareMapper.getKuaiShouOperateInfo(startDate,entDate,operatorUserIds);
                 }
 
                 //总花费