Browse Source

Merge remote-tracking branch 'origin/master'

yumeng 10 tháng trước cách đây
mục cha
commit
22d3c01267
16 tập tin đã thay đổi với 283 bổ sung271 xóa
  1. 8 3
      jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/policy/controller/CwjsPolicyInfoController.java
  2. 3 3
      jeecg-boot-material-view/src/main/java/org/jeecg/ctop/material/mapper/BytedanceAccountReportDailyDwMapper.java
  3. 1 3
      jeecg-boot-material-view/src/main/java/org/jeecg/ctop/material/mapper/KuaishouAccountReportDailyDwMapper.java
  4. 14 1
      jeecg-boot-material-view/src/main/java/org/jeecg/ctop/material/mapper/xml/BytedanceAccountReportDailyDwMapper.xml
  5. 12 1
      jeecg-boot-material-view/src/main/java/org/jeecg/ctop/material/mapper/xml/KuaishouAccountReportDailyDwMapper.xml
  6. 4 2
      jeecg-boot-material-view/src/main/java/org/jeecg/ctop/material/mapper/xml/MaterialStareMapper.xml
  7. 6 1
      jeecg-boot-material-view/src/main/java/org/jeecg/ctop/material/service/impl/BytedanceAccountReportDailyDwServiceImpl.java
  8. 6 1
      jeecg-boot-material-view/src/main/java/org/jeecg/ctop/material/service/impl/KuaishouAccountReportDailyDwServiceImpl.java
  9. 21 19
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/report/controller/KsNewGroupReportCtrl.java
  10. 17 13
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/report/controller/KsNewPlanReportCtrl.java
  11. 9 9
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/NewMonitorMapper.java
  12. 136 172
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/NewMonitorMapper.xml
  13. 8 8
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/report/service/NewMonitorService.java
  14. 15 16
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/report/service/impl/NewMonitorServiceImpl.java
  15. 6 7
      jeecg-boot-module-system/src/main/java/cn/com/ctop/toutiao/modules/material/service/impl/ByteDanceVideoInfoServiceImpl.java
  16. 17 12
      jeecg-boot-module-system/src/main/java/cn/com/ctop/toutiao/modules/report/controller/BytedanceNewPlanReportCtrl.java

+ 8 - 3
jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/policy/controller/CwjsPolicyInfoController.java

@@ -305,9 +305,14 @@ public class CwjsPolicyInfoController {
 
 
             //丁兆明 : b161b7d9793942f980dbfe8c931cd1b0,审核通过直接到老板或者结束
             //丁兆明 : b161b7d9793942f980dbfe8c931cd1b0,审核通过直接到老板或者结束
             if (approvalUser.equals(userId) && "b161b7d9793942f980dbfe8c931cd1b0".equals(userId)) {
             if (approvalUser.equals(userId) && "b161b7d9793942f980dbfe8c931cd1b0".equals(userId)) {
-                //查询 是否符合条件
-                List<JSONObject> autoConveryList = cwjsPolicyInfoMapper.selAutoConveryInfo(cwjsPolicyInfo.getAccountingPeriod(), cwjsPolicyInfo.getMediaType(),
-                        cwjsPolicyInfo.getAdvancePay(), cwjsPolicyInfo.getRebateType(), cwjsPolicyInfo.getRebateRate());
+
+                List<JSONObject> autoConveryList = null;
+                //老客+有账期,不过老板审核
+                if (!(cwjsPolicyInfo.getCustomerFlag() == 1 && !Check.isNull(cwjsPolicyInfo.getAccountingPeriod()))) {
+                    //查询 是否符合条件
+                    autoConveryList = cwjsPolicyInfoMapper.selAutoConveryInfo(cwjsPolicyInfo.getAccountingPeriod(), cwjsPolicyInfo.getMediaType(),
+                            cwjsPolicyInfo.getAdvancePay(), cwjsPolicyInfo.getRebateType(), cwjsPolicyInfo.getRebateRate());
+                }
                 if (!Check.isNull(autoConveryList)) {
                 if (!Check.isNull(autoConveryList)) {
                     //符合条件,自动转老板
                     //符合条件,自动转老板
                     cwjsPolicyInfoService.automaticConveyBossExamine(cwjsPolicyInfo);
                     cwjsPolicyInfoService.automaticConveyBossExamine(cwjsPolicyInfo);

+ 3 - 3
jeecg-boot-material-view/src/main/java/org/jeecg/ctop/material/mapper/BytedanceAccountReportDailyDwMapper.java

@@ -25,7 +25,7 @@ public interface BytedanceAccountReportDailyDwMapper {
 
 
     Long getProjectMoreDaysReportTotal(@Param("projectId") Long projectId, @Param("startTime") Integer startTime, @Param("endTime") Integer endTime, @Param("hour") Integer hour);
     Long getProjectMoreDaysReportTotal(@Param("projectId") Long projectId, @Param("startTime") Integer startTime, @Param("endTime") Integer endTime, @Param("hour") Integer hour);
 
 
-    List<JSONObject> getProjectMoreDaysReport(@Param("projectId") Long projectId, @Param("startTime") Integer startTime, @Param("endTime") Integer endTime, @Param("hour") Integer hour, @Param("sortCode") String sortCode, @Param("order") String order);
+    List<JSONObject> getProjectMoreDaysReport(@Param("projectId") Long projectId, @Param("startTime") Integer startTime, @Param("endTime") Integer endTime, @Param("lastStart") Integer lastStart, @Param("lastEnd") Integer lastEnd, @Param("sortCode") String sortCode, @Param("order") String order);
 
 
     List<JSONObject> getProjectNoByDays(@Param("startTime") Integer startTimeInt, @Param("endTime") Integer endTimeInt);
     List<JSONObject> getProjectNoByDays(@Param("startTime") Integer startTimeInt, @Param("endTime") Integer endTimeInt);
 
 
@@ -38,9 +38,9 @@ public interface BytedanceAccountReportDailyDwMapper {
 
 
     /*--------------------------------------------*/
     /*--------------------------------------------*/
 
 
-    List<JSONObject> getToutiaoOperateInfoHourly(@Param("hour") Integer hour, @Param("startDate") Long startDate, @Param("endDate") Long endDate, @Param("lastTimeEnd") Long lastTimeEnd, @Param("lastTimeStart") Long lastTimeStart, @Param("list") List<String>  operatorUserIds);
+    List<JSONObject> getToutiaoOperateInfoHourly(@Param("hour") Integer hour, @Param("startDate") Long startDate, @Param("endDate") Long endDate, @Param("lastTimeEnd") Long lastTimeEnd, @Param("lastTimeStart") Long lastTimeStart, @Param("list") List<String> operatorUserIds);
 
 
-    List<JSONObject> getToutiaoOperateInfo( @Param("startDate") Long startDate, @Param("endDate") Long endDate, @Param("lastTimeEnd") Long lastTimeEnd, @Param("lastTimeStart") Long lastTimeStart, @Param("list") List<String>  operatorUserIds);
+    List<JSONObject> getToutiaoOperateInfo(@Param("startDate") Long startDate, @Param("endDate") Long endDate, @Param("lastTimeEnd") Long lastTimeEnd, @Param("lastTimeStart") Long lastTimeStart, @Param("list") List<String> operatorUserIds);
 
 
     JSONObject getToutiaoOperateGroupInfoHourly(@Param("hour") Integer hour, @Param("startDate") Long startDate, @Param("endDate") Long endDate, @Param("lastTimeEnd") Long lastTimeEnd, @Param("lastTimeStart") Long lastTimeStart, @Param("list") Set<String> operatorUserIds);
     JSONObject getToutiaoOperateGroupInfoHourly(@Param("hour") Integer hour, @Param("startDate") Long startDate, @Param("endDate") Long endDate, @Param("lastTimeEnd") Long lastTimeEnd, @Param("lastTimeStart") Long lastTimeStart, @Param("list") Set<String> operatorUserIds);
 
 

+ 1 - 3
jeecg-boot-material-view/src/main/java/org/jeecg/ctop/material/mapper/KuaishouAccountReportDailyDwMapper.java

@@ -2,8 +2,6 @@ package org.jeecg.ctop.material.mapper;
 
 
 import com.alibaba.fastjson.JSONObject;
 import com.alibaba.fastjson.JSONObject;
 import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Param;
-import org.jeecg.ctop.material.entity.vo.KuaiShouOperateGroupVo;
-import org.jeecg.ctop.material.entity.vo.KuaiShouOperateVo;
 
 
 import java.util.List;
 import java.util.List;
 import java.util.Map;
 import java.util.Map;
@@ -25,7 +23,7 @@ public interface KuaishouAccountReportDailyDwMapper {
 
 
     Long getProjectMoreDaysReportTotal(@Param("projectId") Long projectId, @Param("startTime") Integer startTime, @Param("endTime") Integer endTime, @Param("hour") Integer hour);
     Long getProjectMoreDaysReportTotal(@Param("projectId") Long projectId, @Param("startTime") Integer startTime, @Param("endTime") Integer endTime, @Param("hour") Integer hour);
 
 
-    List<JSONObject> getProjectMoreDaysReport(@Param("projectId") Long projectId, @Param("startTime") Integer startTime, @Param("endTime") Integer endTime, @Param("hour") Integer hour, @Param("sortCode") String sortCode, @Param("order") String order);
+    List<JSONObject> getProjectMoreDaysReport(@Param("projectId") Long projectId, @Param("startTime") Integer startTime, @Param("endTime") Integer endTime, @Param("lastStart") Integer lastStart, @Param("lastEnd") Integer lastEnd, @Param("sortCode") String sortCode, @Param("order") String order);
 
 
     List<JSONObject> getProjectNoByDays(@Param("startTime") Integer startTimeInt, @Param("endTime") Integer endTimeInt);
     List<JSONObject> getProjectNoByDays(@Param("startTime") Integer startTimeInt, @Param("endTime") Integer endTimeInt);
 
 

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

@@ -216,7 +216,7 @@
         SUM( `show` ) AS 'aclick',
         SUM( `show` ) AS 'aclick',
         SUM( click ) AS 'bclick',
         SUM( click ) AS 'bclick',
         IFNULL(t6.num, 0 ) AS 'num',
         IFNULL(t6.num, 0 ) AS 'num',
-        '-' as 'rio',
+        IFNULL(concat(round((sum(cost) - t7.costs) / t7.costs * 100, 2), '%'), '-') as 'rio',
         IFNULL(t8.unitNum,0) as 'unitNum',
         IFNULL(t8.unitNum,0) as 'unitNum',
         IFNULL(t8.projectNum,0) as 'projectNum',
         IFNULL(t8.projectNum,0) as 'projectNum',
         '-' AS 'ssAd',
         '-' AS 'ssAd',
@@ -246,6 +246,19 @@
         </if>
         </if>
         ) t6 ON t1.project_id = t6.project_id
         ) t6 ON t1.project_id = t6.project_id
         LEFT JOIN (
         LEFT JOIN (
+        SELECT project_id, SUM(cost) as 'costs'
+        FROM application.bytedance_advertiser_report_hourly_dw
+        WHERE stat_datetime >= #{lastStart}
+        AND stat_datetime &lt;= #{lastEnd}
+        AND company_id in ('5e46b5dea3d740eeb8ff1a2895015a4b' , 'd57fecdcf7a94d009736d9c850731582')
+        <if test="projectId != null and projectId != ''">
+            AND project_id = #{projectId}
+        </if>
+        <if test="projectId == null">
+            GROUP BY project_id
+        </if>
+        ) t7 ON t1.project_id = t7.project_id
+        LEFT JOIN (
         SELECT
         SELECT
                project_id,
                project_id,
                IFNULL(SUM(new_ad_num),0)+IFNULL(SUM(promotion_num),0) as 'unitNum',
                IFNULL(SUM(new_ad_num),0)+IFNULL(SUM(promotion_num),0) as 'unitNum',

+ 12 - 1
jeecg-boot-material-view/src/main/java/org/jeecg/ctop/material/mapper/xml/KuaishouAccountReportDailyDwMapper.xml

@@ -230,7 +230,7 @@
         SUM(aclick) as 'aclick',
         SUM(aclick) as 'aclick',
         SUM(bclick) as 'bclick',
         SUM(bclick) as 'bclick',
         IFNULL(t6.num,0) as 'num',
         IFNULL(t6.num,0) as 'num',
-        '-' as 'rio',
+        IFNULL(concat(round((sum(charge) - t7.charges) / t7.charges * 100, 2), '%'), '-') as 'rio',
         IFNULL(t9.accountNum,0) as 'accountNum',
         IFNULL(t9.accountNum,0) as 'accountNum',
         IFNULL(t9.operaterNum,0) as 'operaterNum',
         IFNULL(t9.operaterNum,0) as 'operaterNum',
         IFNULL(t11.new_unit_num,0) as 'unitNum',
         IFNULL(t11.new_unit_num,0) as 'unitNum',
@@ -253,6 +253,17 @@
             GROUP BY project_id
             GROUP BY project_id
         </if>
         </if>
         ) t6 ON t1.project_id = t6.project_id
         ) t6 ON t1.project_id = t6.project_id
+        LEFT JOIN (
+        SELECT project_id, SUM(charge) as 'charges'
+        FROM application.kuaishou_account_report_daily_dw
+        WHERE stat_date >= #{lastStart}
+        AND stat_date &lt;= #{lastEnd}
+        <if test="projectId != null and projectId != ''">
+            AND project_id = #{projectId}
+        </if>
+        GROUP BY project_id
+        HAVING SUM(charge) > 0
+        ) t7 ON t1.project_id = t7.project_id
         LEFT JOIN(
         LEFT JOIN(
         SELECT project_id,count(account_id)as 'accountNum',count(DISTINCT user_id)as 'operaterNum' FROM (
         SELECT project_id,count(account_id)as 'accountNum',count(DISTINCT user_id)as 'operaterNum' FROM (
         SELECT project_id,account_id,user_id FROM application.kuaishou_account_report_daily_dw
         SELECT project_id,account_id,user_id FROM application.kuaishou_account_report_daily_dw

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

@@ -5,6 +5,7 @@
     <!-- 快手 时报  -->
     <!-- 快手 时报  -->
     <select id="getKuaiShouCostHourlyByUserIdList" resultType="Map">
     <select id="getKuaiShouCostHourlyByUserIdList" resultType="Map">
         SELECT
         SELECT
+        t.`hour` as 'orders',
         CONCAT(t.`hour`,':00') `hour`,
         CONCAT(t.`hour`,':00') `hour`,
         ROUND( SUM( charge ), 3 ) AS totalCost
         ROUND( SUM( charge ), 3 ) AS totalCost
         FROM
         FROM
@@ -20,12 +21,13 @@
             </foreach>
             </foreach>
         </if>
         </if>
         GROUP BY t.`hour`
         GROUP BY t.`hour`
-        ORDER BY t.`hour`
+        ORDER BY orders
     </select>
     </select>
 
 
     <!-- 头条 时报  -->
     <!-- 头条 时报  -->
     <select id="getBytedanceCostHourlyByUserIdList" resultType="Map">
     <select id="getBytedanceCostHourlyByUserIdList" resultType="Map">
         SELECT
         SELECT
+        `hour` as 'orders',
         CONCAT( `hour`, ':00' ) `hour`,
         CONCAT( `hour`, ':00' ) `hour`,
         ROUND( SUM( cost ), 3 ) AS totalCost
         ROUND( SUM( cost ), 3 ) AS totalCost
         FROM
         FROM
@@ -41,7 +43,7 @@
             </foreach>
             </foreach>
         </if>
         </if>
         GROUP BY `hour`
         GROUP BY `hour`
-        ORDER BY `hour`
+        ORDER BY orders
     </select>
     </select>
 
 
 
 

+ 6 - 1
jeecg-boot-material-view/src/main/java/org/jeecg/ctop/material/service/impl/BytedanceAccountReportDailyDwServiceImpl.java

@@ -117,7 +117,12 @@ public class BytedanceAccountReportDailyDwServiceImpl implements IBytedanceAccou
         } else {
         } else {
 //            total = bytedanceAccountReportDailyDwMapper.getProjectMoreDaysReportTotal(projectId, startTimeInt, endTimeInt, nowHour);
 //            total = bytedanceAccountReportDailyDwMapper.getProjectMoreDaysReportTotal(projectId, startTimeInt, endTimeInt, nowHour);
 //            PageHelper.startPage(pageNo, pageSize, false);
 //            PageHelper.startPage(pageNo, pageSize, false);
-            data = bytedanceAccountReportDailyDwMapper.getProjectMoreDaysReport(projectId, startTimeInt, endTimeInt, nowHour, sortCode, order);
+
+            int days = DateUtils.dateDiff(startTime, endTime)+1;
+            //上阶段时间
+            Integer lastStart = DateUtils.getDateInteger(DateUtils.getLastDay(startTime, days));
+            Integer lastEnd = DateUtils.getDateInteger(DateUtils.getLastDay(endTime, days));
+            data = bytedanceAccountReportDailyDwMapper.getProjectMoreDaysReport(projectId, startTimeInt, endTimeInt, lastStart,lastEnd, sortCode, order);
         }
         }
         PageInfo<JSONObject> page = new PageInfo<>();
         PageInfo<JSONObject> page = new PageInfo<>();
         page.setList(data);
         page.setList(data);

+ 6 - 1
jeecg-boot-material-view/src/main/java/org/jeecg/ctop/material/service/impl/KuaishouAccountReportDailyDwServiceImpl.java

@@ -117,7 +117,12 @@ public class KuaishouAccountReportDailyDwServiceImpl implements IKuaishouAccount
         } else {
         } else {
 //            total = kuaishouAccountReportDailyDwMapper.getProjectMoreDaysReportTotal(projectId, startTimeInt, endTimeInt, nowHour);
 //            total = kuaishouAccountReportDailyDwMapper.getProjectMoreDaysReportTotal(projectId, startTimeInt, endTimeInt, nowHour);
 //            PageHelper.startPage(pageNo, pageSize, false);
 //            PageHelper.startPage(pageNo, pageSize, false);
-            data = kuaishouAccountReportDailyDwMapper.getProjectMoreDaysReport(projectId, startTimeInt, endTimeInt, nowHour, sortCode, order);
+
+            int days = DateUtils.dateDiff(startTime, endTime) + 1;
+            //上阶段时间
+            Integer lastStart = DateUtils.getDateInteger(DateUtils.getLastDay(startTime, days));
+            Integer lastEnd = DateUtils.getDateInteger(DateUtils.getLastDay(endTime, days));
+            data = kuaishouAccountReportDailyDwMapper.getProjectMoreDaysReport(projectId, startTimeInt, endTimeInt, lastStart, lastEnd, sortCode, order);
         }
         }
         PageInfo<JSONObject> page = new PageInfo<>();
         PageInfo<JSONObject> page = new PageInfo<>();
         page.setList(data);
         page.setList(data);

+ 21 - 19
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/report/controller/KsNewGroupReportCtrl.java

@@ -12,6 +12,7 @@ import lombok.extern.slf4j.Slf4j;
 import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Param;
 import org.apache.poi.xssf.usermodel.XSSFWorkbook;
 import org.apache.poi.xssf.usermodel.XSSFWorkbook;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.util.DateUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.bind.annotation.*;
 
 
@@ -54,8 +55,8 @@ public class KsNewGroupReportCtrl {
         Map<String, Object> result = new HashMap<>();
         Map<String, Object> result = new HashMap<>();
         JSONArray accountIds = requestBody.getJSONArray("accountIds");
         JSONArray accountIds = requestBody.getJSONArray("accountIds");
         String userId = requestBody.getString("userId");
         String userId = requestBody.getString("userId");
-        //TODO 没有维护快手事业部负责人角色,增加判断
-        if ("4afe739502ae4258a18c36a000d7ff20".equals(userId) || "228c45f913924639bf20c79ce5dadb16".equals(userId)) {
+        //f6a6843879c949618e4a859140c8a127 李超  丁总 b161b7d9793942f980dbfe8c931cd1b0
+        if ("f6a6843879c949618e4a859140c8a127".equals(userId) || "b161b7d9793942f980dbfe8c931cd1b0".equals(userId)) {
             accountIds = newPlanReportService.getAccountIdsByMedia();
             accountIds = newPlanReportService.getAccountIdsByMedia();
         } else {
         } else {
             if (!userId.isEmpty()) {
             if (!userId.isEmpty()) {
@@ -65,20 +66,20 @@ public class KsNewGroupReportCtrl {
                 return resultBody;
                 return resultBody;
             }
             }
         }
         }
-
         String startDate = requestBody.getString("startDate");
         String startDate = requestBody.getString("startDate");
         String endDate = requestBody.getString("endDate");
         String endDate = requestBody.getString("endDate");
-        startDate=startDate+" 00:00:00";
-        endDate=endDate+" 59:59:59";
+
+        Integer startDateInteger = DateUtils.getDateInteger(startDate);
+        Integer endDateInteger = DateUtils.getDateInteger(endDate);
+
         String target = requestBody.getString("target");
         String target = requestBody.getString("target");
-        String order = requestBody.getString("order");
         try {
         try {
             /*JSONObject sumData = newGroupReportService.getSumNewGroupBy(accountIds, startDate, endDate);
             /*JSONObject sumData = newGroupReportService.getSumNewGroupBy(accountIds, startDate, endDate);
             List<JSONObject> chartData = newGroupReportService.getKsNewGroupGroupByStatDate(accountIds, startDate, endDate);
             List<JSONObject> chartData = newGroupReportService.getKsNewGroupGroupByStatDate(accountIds, startDate, endDate);
             List<JSONObject> listData = newGroupReportService.getKsNewGroupGroupByAccount(accountIds, startDate, endDate, target, order);*/
             List<JSONObject> listData = newGroupReportService.getKsNewGroupGroupByAccount(accountIds, startDate, endDate, target, order);*/
             List<JSONObject> chartData = newMonitorService.getKuaiShouGroupMessageGroup(accountIds, startDate, endDate);
             List<JSONObject> chartData = newMonitorService.getKuaiShouGroupMessageGroup(accountIds, startDate, endDate);
-            JSONObject sumData = newMonitorService.getKuaiShouGroupSum(accountIds, startDate, endDate);
-            List<JSONObject> listData = newMonitorService.getKuaiShouGroupMessage(accountIds, startDate, endDate, target);
+            JSONObject sumData = newMonitorService.getKuaiShouGroupSum(accountIds, startDateInteger, endDateInteger);
+            List<JSONObject> listData = newMonitorService.getKuaiShouGroupMessage(accountIds, startDateInteger, endDateInteger);
             result.put("sumData", sumData);
             result.put("sumData", sumData);
             result.put("chartData", chartData);
             result.put("chartData", chartData);
             result.put("listData", listData);
             result.put("listData", listData);
@@ -121,8 +122,8 @@ public class KsNewGroupReportCtrl {
 
 
         JSONArray accountIds = requestBody.getJSONArray("accountIds");
         JSONArray accountIds = requestBody.getJSONArray("accountIds");
         String userId = requestBody.getString("userId");
         String userId = requestBody.getString("userId");
-        //TODO 没有维护快手事业部负责人角色,增加判断
-        if ("6b4c821adc414dc8b7718ab63ccbfcaf".equals(userId)) {
+        //f6a6843879c949618e4a859140c8a127 李超  丁总 b161b7d9793942f980dbfe8c931cd1b0
+        if ("f6a6843879c949618e4a859140c8a127".equals(userId) || "b161b7d9793942f980dbfe8c931cd1b0".equals(userId)) {
             accountIds = newPlanReportService.getAccountIdsByMedia();
             accountIds = newPlanReportService.getAccountIdsByMedia();
         } else {
         } else {
             if (!userId.isEmpty()) {
             if (!userId.isEmpty()) {
@@ -135,10 +136,11 @@ public class KsNewGroupReportCtrl {
         String startDate = requestBody.getString("startDate");
         String startDate = requestBody.getString("startDate");
         String endDate = requestBody.getString("endDate");
         String endDate = requestBody.getString("endDate");
         String target = requestBody.getString("target");
         String target = requestBody.getString("target");
-        startDate=startDate+" 00:00:00";
-        endDate=endDate+" 59:59:59";
-        String order = requestBody.getString("order");
-        List<JSONObject> listData = newMonitorService.getKuaiShouGroupMessage(accountIds, startDate, endDate, target);
+
+        Integer startDateInteger = DateUtils.getDateInteger(startDate);
+        Integer endDateInteger = DateUtils.getDateInteger(endDate);
+
+        List<JSONObject> listData = newMonitorService.getKuaiShouGroupMessage(accountIds, startDateInteger, endDateInteger);
 
 
         List<List<Object>> excelList = new ArrayList<>();
         List<List<Object>> excelList = new ArrayList<>();
         listData.forEach(data -> {
         listData.forEach(data -> {
@@ -152,7 +154,7 @@ public class KsNewGroupReportCtrl {
             excelList.add(temp);
             excelList.add(temp);
         });
         });
         try {
         try {
-            String[] headers = {"账户名称","账户ID","账户所属人","新上推广组","有效推广组","最近上新时间"};
+            String[] headers = {"账户名称", "账户ID", "账户所属人", "新上推广组", "有效推广组", "最近上新时间"};
             OutputStream os = response.getOutputStream();
             OutputStream os = response.getOutputStream();
             ExportExcelUtils eeu = new ExportExcelUtils();
             ExportExcelUtils eeu = new ExportExcelUtils();
             XSSFWorkbook workbook = new XSSFWorkbook();
             XSSFWorkbook workbook = new XSSFWorkbook();
@@ -170,15 +172,15 @@ public class KsNewGroupReportCtrl {
      * 查询所有的快手运营
      * 查询所有的快手运营
      */
      */
     @GetMapping("/report/AllOperator")
     @GetMapping("/report/AllOperator")
-    public Result<List<JSONObject>> getAllOperator(@Param("userId")String userId,@Param("userName")String userName) {
+    public Result<List<JSONObject>> getAllOperator(@Param("userId") String userId, @Param("userName") String userName) {
         Result<List<JSONObject>> result = new Result<>();
         Result<List<JSONObject>> result = new Result<>();
-        List<JSONObject> listData=new ArrayList<>();
+        List<JSONObject> listData = new ArrayList<>();
         try {
         try {
             String roleCode = sysRoleService.getRoleCodeByUserId(userId);
             String roleCode = sysRoleService.getRoleCodeByUserId(userId);
             if (roleCode != null && roleCode.equals("admin") || roleCode.equals("saleDirector")) {
             if (roleCode != null && roleCode.equals("admin") || roleCode.equals("saleDirector")) {
                 listData = newPlanReportService.getAllOperator();
                 listData = newPlanReportService.getAllOperator();
-            }else {
-                listData=newMonitorService.getOperator(userId,userName);
+            } else {
+                listData = newMonitorService.getOperator(userId, userName);
             }
             }
 
 
             result.setResult(listData);
             result.setResult(listData);

+ 17 - 13
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/report/controller/KsNewPlanReportCtrl.java

@@ -9,6 +9,7 @@ import com.alibaba.fastjson.JSONObject;
 import lombok.extern.slf4j.Slf4j;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.poi.xssf.usermodel.XSSFWorkbook;
 import org.apache.poi.xssf.usermodel.XSSFWorkbook;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.util.DateUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestBody;
@@ -47,8 +48,8 @@ public class KsNewPlanReportCtrl {
         Map<String, Object> result = new HashMap<>();
         Map<String, Object> result = new HashMap<>();
         JSONArray accountIds = requestBody.getJSONArray("accountIds");
         JSONArray accountIds = requestBody.getJSONArray("accountIds");
         String userId = requestBody.getString("userId");
         String userId = requestBody.getString("userId");
-        //TODO 没有维护快手事业部负责人角色,增加判断
-        if ("6b4c821adc414dc8b7718ab63ccbfcaf".equals(userId)) {
+        //f6a6843879c949618e4a859140c8a127 李超  丁总 b161b7d9793942f980dbfe8c931cd1b0
+        if ("f6a6843879c949618e4a859140c8a127".equals(userId) || "b161b7d9793942f980dbfe8c931cd1b0".equals(userId)) {
             accountIds = newPlanReportService.getAccountIdsByMedia();
             accountIds = newPlanReportService.getAccountIdsByMedia();
         } else {
         } else {
             if (!userId.isEmpty()) {
             if (!userId.isEmpty()) {
@@ -60,17 +61,18 @@ public class KsNewPlanReportCtrl {
         }
         }
         String startDate = requestBody.getString("startDate");
         String startDate = requestBody.getString("startDate");
         String endDate = requestBody.getString("endDate");
         String endDate = requestBody.getString("endDate");
-        startDate=startDate+" 00:00:00";
-        endDate=endDate+" 59:59:59";
+
+        Integer startDateInteger = DateUtils.getDateInteger(startDate);
+        Integer endDateInteger = DateUtils.getDateInteger(endDate);
+
         String target = requestBody.getString("target");
         String target = requestBody.getString("target");
-        String order = requestBody.getString("order");
         try {
         try {
             /*JSONObject sumData = newPlanReportService.getSumNewPlanBy(accountIds, startDate, endDate);
             /*JSONObject sumData = newPlanReportService.getSumNewPlanBy(accountIds, startDate, endDate);
             List<JSONObject> chartData = newPlanReportService.getKsNewPlanGroupByStatDate(accountIds, startDate, endDate);
             List<JSONObject> chartData = newPlanReportService.getKsNewPlanGroupByStatDate(accountIds, startDate, endDate);
             List<JSONObject> listData = newPlanReportService.getKsNewPlanGroupByAccount(accountIds, startDate, endDate, target, order);*/
             List<JSONObject> listData = newPlanReportService.getKsNewPlanGroupByAccount(accountIds, startDate, endDate, target, order);*/
-           List<JSONObject> listData = newMonitorService.getPlanMessage(accountIds, startDate, endDate, target, "1");
-            List<JSONObject> chartData = newMonitorService.getPlanMessageGroup(accountIds, startDate, endDate, "1");
-            JSONObject sumData = newMonitorService.getPlanSum(accountIds, startDate, endDate, "1");
+            List<JSONObject> listData = newMonitorService.getPlanMessage(accountIds, startDateInteger, endDateInteger);
+            List<JSONObject> chartData = newMonitorService.getPlanMessageGroup(accountIds, startDate, endDate);
+            JSONObject sumData = newMonitorService.getPlanSum(accountIds, startDateInteger, endDateInteger);
             result.put("sumData", sumData);
             result.put("sumData", sumData);
             result.put("chartData", chartData);
             result.put("chartData", chartData);
             result.put("listData", listData);
             result.put("listData", listData);
@@ -116,8 +118,8 @@ public class KsNewPlanReportCtrl {
 
 
         JSONArray accountIds = requestBody.getJSONArray("accountIds");
         JSONArray accountIds = requestBody.getJSONArray("accountIds");
         String userId = requestBody.getString("userId");
         String userId = requestBody.getString("userId");
-        //TODO 没有维护快手事业部负责人角色,增加判断
-        if ("6b4c821adc414dc8b7718ab63ccbfcaf".equals(userId)) {
+        //f6a6843879c949618e4a859140c8a127 李超  丁总 b161b7d9793942f980dbfe8c931cd1b0
+        if ("f6a6843879c949618e4a859140c8a127".equals(userId) || "b161b7d9793942f980dbfe8c931cd1b0".equals(userId)) {
             accountIds = newPlanReportService.getAccountIdsByMedia();
             accountIds = newPlanReportService.getAccountIdsByMedia();
         } else {
         } else {
             if (!userId.isEmpty()) {
             if (!userId.isEmpty()) {
@@ -129,11 +131,13 @@ public class KsNewPlanReportCtrl {
         }
         }
         String startDate = requestBody.getString("startDate");
         String startDate = requestBody.getString("startDate");
         String endDate = requestBody.getString("endDate");
         String endDate = requestBody.getString("endDate");
-        startDate=startDate+" 00:00:00";
-        endDate=endDate+" 59:59:59";
+        Integer startDateInteger = DateUtils.getDateInteger(startDate);
+        Integer endDateInteger = DateUtils.getDateInteger(endDate);
+        startDate = startDate + " 00:00:00";
+        endDate = endDate + " 59:59:59";
         String target = requestBody.getString("target");
         String target = requestBody.getString("target");
         String order = requestBody.getString("order");
         String order = requestBody.getString("order");
-        List<JSONObject> listData = newMonitorService.getPlanMessage(accountIds, startDate, endDate, target, "1");
+        List<JSONObject> listData = newMonitorService.getPlanMessage(accountIds, startDateInteger, endDateInteger);
 
 
         List<List<Object>> excelList = new ArrayList<>();
         List<List<Object>> excelList = new ArrayList<>();
         listData.forEach(data -> {
         listData.forEach(data -> {

+ 9 - 9
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/NewMonitorMapper.java

@@ -45,24 +45,24 @@ public interface NewMonitorMapper {
 
 
     void updateMonitorPlanByCampaignId(@Param("campaignId") String campaignId, @Param("effective") String effective);
     void updateMonitorPlanByCampaignId(@Param("campaignId") String campaignId, @Param("effective") String effective);
 
 
-    List<JSONObject> getKuaiShouGroupMessage(@Param("array") JSONArray array, @Param("startDate") String startDate, @Param("endDate") String endDate);
+    List<JSONObject> getKuaiShouGroupMessage(@Param("array") JSONArray array, @Param("startDate") Integer startDate, @Param("endDate") Integer endDate);
 
 
-    JSONObject getKuaiShouGroupSum(@Param("array") JSONArray array, @Param("startDate") String startDate, @Param("endDate") String endDate);
+    JSONObject getKuaiShouGroupSum(@Param("array") JSONArray array, @Param("startDate") Integer startDate, @Param("endDate") Integer endDate);
 
 
-    List<JSONObject> getKuaiShouGroupMessageGroup(@Param("array") JSONArray array, @Param("startDate") String startDate, @Param("endDate") String endDate, @Param("group") String group);
+    List<JSONObject> getKuaiShouGroupMessageGroup(@Param("array") JSONArray array, @Param("startDate") Integer startDate, @Param("endDate") Integer endDate, @Param("group") String group);
 
 
-    List<JSONObject> getPlanMessage(@Param("array") JSONArray array, @Param("startDate") String startDate, @Param("endDate") String endDate, @Param("project") String project);
+    List<JSONObject> getPlanMessage(@Param("array") JSONArray array, @Param("startDate") Integer startDate, @Param("endDate") Integer endDate);
 
 
-    JSONObject getPlanSum(@Param("array") JSONArray array, @Param("startDate") String startDate, @Param("endDate") String endDate, @Param("project") String project);
+    JSONObject getPlanSum(@Param("array") JSONArray array, @Param("startDate") Integer startDate, @Param("endDate") Integer endDate);
 
 
-    List<JSONObject> getPlanMessageGroup(@Param("array") JSONArray array, @Param("startDate") String startDate, @Param("endDate") String endDate, @Param("group") String group, @Param("project") String project);
+    List<JSONObject> getPlanMessageGroup(@Param("array") JSONArray array, @Param("startDate") Integer startDate, @Param("endDate") Integer endDate, @Param("group") String group);
 
 
     List<NewMonitorInfo> getOperator(@Param("userId") String userId);
     List<NewMonitorInfo> getOperator(@Param("userId") String userId);
 
 
-    JSONObject getPlanSumBytedance(@Param("userId") String userId, @Param("array") JSONArray array, @Param("startDate") String startDate, @Param("endDate") String endDate, @Param("project") String project);
+    JSONObject getPlanSumBytedance(@Param("array") JSONArray array, @Param("startDate") Integer startDate, @Param("endDate") Integer endDate);
 
 
-    List<JSONObject> getPlanMessageGroupBytedance(@Param("userId") String userId,@Param("array") JSONArray array, @Param("startDate") String startDate, @Param("endDate") String endDate, @Param("group") String group, @Param("project") String project);
+    List<JSONObject> getPlanMessageGroupBytedance(@Param("array") JSONArray array, @Param("startDate") Integer startDate, @Param("endDate") Integer endDate, @Param("group") String group);
 
 
-    List<JSONObject> getPlanMessageBytedance(@Param("userId") String userId, @Param("array") JSONArray array, @Param("startDate") String startDate, @Param("endDate") String endDate, @Param("project") String project);
+    List<JSONObject> getPlanMessageBytedance(@Param("array") JSONArray array, @Param("startDate") Integer startDate, @Param("endDate") Integer endDate);
 
 
 }
 }

+ 136 - 172
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/NewMonitorMapper.xml

@@ -171,231 +171,195 @@
     </update>
     </update>
 
 
     <select id="getKuaiShouGroupMessage" resultType="com.alibaba.fastjson.JSONObject">
     <select id="getKuaiShouGroupMessage" resultType="com.alibaba.fastjson.JSONObject">
-        select account_id as 'accountId',account_name as 'authName',MAX(create_time) as
-        'maxCreateTime',COUNT(IF(effective ='1', TRUE, NULL)) as 'valid',count(effective) as 'new',operating_name as
-        'userName','' as 'projectName'
-        from ctop_new_monitor_group where ( create_time between #{startDate} and #{endDate})
-        and account_id in
-        <foreach item="item" collection="array" separator="," open="(" close=")" index="">
-            #{item}
-        </foreach>
+        SELECT
+        account_id AS 'accountId',
+        account_name AS 'authName',
+        MAX(stat_date) AS 'maxCreateTime',
+        '0' AS 'valid',
+        IFNULL(SUM(new_unit_num),0) AS 'new',
+        user_name AS 'userName'
+        FROM
+        application.app_kuaishou_account_base_info_d
+        WHERE stat_date >= #{startDate}
+        AND stat_date &lt;= #{endDate}
+        <if test="array != null and array.size() > 0">
+            and account_id in
+            <foreach item="item" collection="array" separator="," open="(" close=")" index="">
+                #{item}
+            </foreach>
+        </if>
         GROUP BY account_id
         GROUP BY account_id
-        order by account_id desc
+        order by `new` desc
     </select>
     </select>
 
 
 
 
     <select id="getPlanMessage" resultType="com.alibaba.fastjson.JSONObject">
     <select id="getPlanMessage" resultType="com.alibaba.fastjson.JSONObject">
-        select account_id as 'accountId',account_name as 'authName',MAX(create_time) as
-        'maxCreateTime',COUNT(IF(effective ='1', TRUE, NULL)) as 'valid',count(effective) as 'new',operating_name as
-        'userName','' as 'projectName'
-        from ctop_new_monitor_campaign where ( create_time between #{startDate} and #{endDate}) and
-        project_type=#{project}
-        and account_id in
-        <foreach item="item" collection="array" separator="," open="(" close=")" index="">
-            #{item}
-        </foreach>
+        SELECT
+        account_id AS 'accountId',
+        account_name AS 'authName',
+        MAX(stat_date) AS 'maxCreateTime',
+        '0' AS 'valid',
+        IFNULL(SUM(new_campaign_num),0) AS 'new',
+        user_name AS 'userName'
+        FROM
+        application.app_kuaishou_account_base_info_d
+        WHERE stat_date >= #{startDate}
+        AND stat_date &lt;= #{endDate}
+        <if test="array != null and array.size() > 0">
+            and account_id in
+            <foreach item="item" collection="array" separator="," open="(" close=")" index="">
+                #{item}
+            </foreach>
+        </if>
         GROUP BY account_id
         GROUP BY account_id
-        order by account_id desc
+        order by `new` desc
     </select>
     </select>
 
 
     <select id="getKuaiShouGroupSum" resultType="com.alibaba.fastjson.JSONObject">
     <select id="getKuaiShouGroupSum" resultType="com.alibaba.fastjson.JSONObject">
-        SELECT COUNT(IF(t.effective ='1', TRUE, NULL)) as 'valid',COUNT(t.effective) as 'new' from
-        ctop_new_monitor_group t
-        where create_time between #{startDate} and #{endDate}
-        and t.account_id in
-        <foreach item="item" collection="array" separator="," open="(" close=")" index="">
-            #{item}
-        </foreach>
+        SELECT
+        IFNULL(SUM(new_unit_num),0) AS 'new',
+        '-' AS 'valid'
+        FROM
+        application.app_kuaishou_account_base_info_d
+        where stat_date >= #{startDate}
+        AND stat_date &lt;= #{endDate}
+        <if test="array != null and array.size() > 0">
+            and account_id in
+            <foreach item="item" collection="array" separator="," open="(" close=")" index="">
+                #{item}
+            </foreach>
+        </if>
     </select>
     </select>
 
 
     <select id="getPlanSum" resultType="com.alibaba.fastjson.JSONObject">
     <select id="getPlanSum" resultType="com.alibaba.fastjson.JSONObject">
-        SELECT COUNT(IF(t.effective ='1', TRUE, NULL)) as 'valid',COUNT(t.effective) as 'new' from
-        ctop_new_monitor_campaign t
-        where (create_time between #{startDate} and #{endDate}) and project_type=#{project}
-        and t.account_id in
-        <foreach item="item" collection="array" separator="," open="(" close=")" index="">
-            #{item}
-        </foreach>
+        SELECT IFNULL(SUM(new_campaign_num),0) AS 'new',
+        '0' AS 'valid'
+        FROM
+        application.app_kuaishou_account_base_info_d
+        where stat_date >= #{startDate}
+        AND stat_date &lt;= #{endDate}
+        <if test="array != null and array.size() > 0">
+            and account_id in
+            <foreach item="item" collection="array" separator="," open="(" close=")" index="">
+                #{item}
+            </foreach>
+        </if>
     </select>
     </select>
 
 
     <select id="getKuaiShouGroupMessageGroup" resultType="com.alibaba.fastjson.JSONObject">
     <select id="getKuaiShouGroupMessageGroup" resultType="com.alibaba.fastjson.JSONObject">
         SELECT
         SELECT
         <choose>
         <choose>
             <when test='group=="1"'>
             <when test='group=="1"'>
-                DATE_FORMAT(t.create_time,'%Y-%m') as 'statDate',
-            </when>
-            <otherwise>
-                DATE_FORMAT(t.create_time,'%Y-%m-%d') as 'statDate',
-            </otherwise>
-        </choose>
-        COUNT(t.effective) as 'new',COUNT(IF(t.effective ='1', TRUE, NULL)) as 'valid' from ctop_new_monitor_group t
-        where (create_time between #{startDate} and #{endDate}) and t.account_id in
-        <foreach item="item" collection="array" separator="," open="(" close=")" index="">
-            #{item}
-        </foreach>
-        <choose>
-            <when test='group=="1"'>
-                GROUP BY DATE_FORMAT(t.create_time,'%Y-%m')
+                DATE_FORMAT(stat_date, '%Y-%m' ) AS 'statDate',
             </when>
             </when>
             <otherwise>
             <otherwise>
-                GROUP BY DATE_FORMAT(t.create_time,'%Y-%m-%d')
+                DATE_FORMAT(stat_date, '%Y-%m-%d' ) AS 'statDate',
             </otherwise>
             </otherwise>
         </choose>
         </choose>
-        order by t.create_time asc
+        IFNULL(SUM(new_unit_num),0) AS 'new',
+        '0' AS 'valid'
+        FROM application.app_kuaishou_account_base_info_d
+        where stat_date >= #{startDate}
+        AND stat_date &lt;= #{endDate}
+        <if test="array != null and array.size() > 0">
+            and account_id in
+            <foreach item="item" collection="array" separator="," open="(" close=")" index="">
+                #{item}
+            </foreach>
+        </if>
+        GROUP BY
+        statDate
+        order by statDate asc
     </select>
     </select>
 
 
     <select id="getPlanMessageGroup" resultType="com.alibaba.fastjson.JSONObject">
     <select id="getPlanMessageGroup" resultType="com.alibaba.fastjson.JSONObject">
         SELECT
         SELECT
         <choose>
         <choose>
             <when test='group=="1"'>
             <when test='group=="1"'>
-                DATE_FORMAT(t.create_time,'%Y-%m') as 'statDate',
-            </when>
-            <otherwise>
-                DATE_FORMAT(t.create_time,'%Y-%m-%d') as 'statDate',
-            </otherwise>
-        </choose>
-        COUNT(t.effective) as 'new',COUNT(IF(t.effective ='1', TRUE, NULL)) as 'valid' from ctop_new_monitor_campaign t
-        where project_type=#{project} and (create_time between #{startDate} and #{endDate}) and t.account_id in
-        <foreach item="item" collection="array" separator="," open="(" close=")" index="">
-            #{item}
-        </foreach>
-        <choose>
-            <when test='group=="1"'>
-                GROUP BY DATE_FORMAT(t.create_time,'%Y-%m')
+                DATE_FORMAT(stat_date, '%Y-%m') AS 'statDate',
             </when>
             </when>
             <otherwise>
             <otherwise>
-                GROUP BY DATE_FORMAT(t.create_time,'%Y-%m-%d')
+                DATE_FORMAT(stat_date, '%Y-%m-%d') AS 'statDate',
             </otherwise>
             </otherwise>
         </choose>
         </choose>
-        order by t.create_time asc
+        IFNULL(SUM(new_campaign_num),0) AS 'new',
+        '0' AS 'valid'
+        FROM application.app_kuaishou_account_base_info_d
+        where stat_date >= #{startDate}
+        AND stat_date &lt;= #{endDate}
+        <if test="array != null and array.size() > 0">
+            and account_id in
+            <foreach item="item" collection="array" separator="," open="(" close=")" index="">
+                #{item}
+            </foreach>
+        </if>
+        GROUP BY
+        statDate
+        order by statDate asc
     </select>
     </select>
 
 
     <select id="getPlanSumBytedance" resultType="com.alibaba.fastjson.JSONObject">
     <select id="getPlanSumBytedance" resultType="com.alibaba.fastjson.JSONObject">
-        SELECT COUNT(IF(t.effective ='1', TRUE, NULL)) as 'valid',COUNT(t.effective)+
-        (
-        SELECT
-        IFNULL(SUM(promotion_num),0)
-        FROM application.app_bytedance_account_base_info_d
-        WHERE stat_date >= DATE_FORMAT(#{startDate},'%Y%m%d')
-        AND stat_date &lt;=DATE_FORMAT(#{endDate},'%Y%m%d')
-        AND user_id = #{userId}
-        ) as 'new'
-        from ctop_new_monitor_campaign t
-        where (create_time between #{startDate} and #{endDate}) and project_type=#{project}
-        and t.account_id in
-        <foreach item="item" collection="array" separator="," open="(" close=")" index="">
-            #{item}
-        </foreach>
+        SELECT IFNULL(SUM(promotion_num),0) AS 'new',
+        '0' AS 'valid'
+        FROM
+        application.app_bytedance_account_base_info_d
+        where stat_date >= #{startDate}
+        AND stat_date &lt;= #{endDate}
+        <if test="array != null and array.size() > 0">
+            and account_id in
+            <foreach item="item" collection="array" separator="," open="(" close=")" index="">
+                #{item}
+            </foreach>
+        </if>
     </select>
     </select>
 
 
 
 
     <select id="getPlanMessageGroupBytedance" resultType="com.alibaba.fastjson.JSONObject">
     <select id="getPlanMessageGroupBytedance" resultType="com.alibaba.fastjson.JSONObject">
-        SELECT t1.statDate,
-        t1.promotionNum +IFNULL(t2.new,0) as 'new',
-        IFNULL(t2.valid,0) as 'valid'
-        FROM
-        (
         SELECT
         SELECT
         <choose>
         <choose>
             <when test='group=="1"'>
             <when test='group=="1"'>
-                DATE_FORMAT(stat_date,'%Y-%m') as 'statDate',
+                DATE_FORMAT(stat_date, '%Y-%m') AS 'statDate',
             </when>
             </when>
             <otherwise>
             <otherwise>
-                DATE_FORMAT(stat_date,'%Y-%m-%d') as 'statDate',
+                DATE_FORMAT(stat_date, '%Y-%m-%d') AS 'statDate',
             </otherwise>
             </otherwise>
         </choose>
         </choose>
-        IFNULL(SUM(promotion_num),0) as 'promotionNum'
+        IFNULL(SUM(promotion_num),0) AS 'new',
+        '0' AS 'valid'
         FROM application.app_bytedance_account_base_info_d
         FROM application.app_bytedance_account_base_info_d
-        WHERE stat_date >= DATE_FORMAT(#{startDate},'%Y%m%d')
-        AND stat_date &lt;=DATE_FORMAT(#{endDate},'%Y%m%d')
-        AND user_id = #{userId}
-        <choose>
-            <when test='group=="1"'>
-                GROUP BY DATE_FORMAT(stat_date,'%Y-%m')
-            </when>
-            <otherwise>
-                GROUP BY stat_date
-            </otherwise>
-        </choose>
-        ) t1
-        LEFT JOIN (
-        SELECT
-        <choose>
-            <when test='group=="1"'>
-                DATE_FORMAT(t.create_time,'%Y-%m') as 'statDate',
-            </when>
-            <otherwise>
-                DATE_FORMAT(t.create_time,'%Y-%m-%d') as 'statDate',
-            </otherwise>
-        </choose>
-        COUNT(t.effective) as 'new',COUNT(IF(t.effective ='1', TRUE, NULL)) as 'valid' from ctop_new_monitor_campaign t
-        where project_type=#{project} and (create_time between #{startDate} and #{endDate}) and t.account_id in
-        <foreach item="item" collection="array" separator="," open="(" close=")" index="">
-            #{item}
-        </foreach>
-        <choose>
-            <when test='group=="1"'>
-                GROUP BY DATE_FORMAT(t.create_time,'%Y-%m')
-            </when>
-            <otherwise>
-                GROUP BY DATE_FORMAT(t.create_time,'%Y-%m-%d')
-            </otherwise>
-        </choose>
-        ) t2 ON t1.statDate = t2.statDate
-        WHERE t1.promotionNum +IFNULL(t2.new,0) >0
-        ORDER BY `statDate`
+        where stat_date >= #{startDate}
+        AND stat_date &lt;= #{endDate}
+        <if test="array != null and array.size() > 0">
+            and account_id in
+            <foreach item="item" collection="array" separator="," open="(" close=")" index="">
+                #{item}
+            </foreach>
+        </if>
+        GROUP BY
+        statDate
+        order by statDate asc
     </select>
     </select>
 
 
 
 
     <select id="getPlanMessageBytedance" resultType="com.alibaba.fastjson.JSONObject">
     <select id="getPlanMessageBytedance" resultType="com.alibaba.fastjson.JSONObject">
-        SELECT * FROM (
-        SELECT
-        IFNULL(t2.account_id,t1.account_id) as 'accountId',
-        IFNULL(t2.authName,t1.account_name) as 'authName',
-        IFNULL(t2.maxCreateTime,statDate) as 'maxCreateTime',
-        t1.promotionNum+IFNULL(t2.new,0) as 'new',
-        IFNULL(t2.userName,t1.user_name) as 'userName',
-        IFNULL(t2.valid ,0) as 'valid'
-        FROM
-        (
-        SELECT
-        account_id,
-        account_name,
-        user_name,
-        DATE_FORMAT(stat_date,'%Y-%m-%d') as 'statDate',
-        IFNULL(SUM(promotion_num),0) as 'promotionNum'
-        FROM application.app_bytedance_account_base_info_d
-        WHERE stat_date >= DATE_FORMAT(#{startDate},'%Y%m%d')
-        AND stat_date &lt;=DATE_FORMAT(#{endDate},'%Y%m%d')
-        AND user_id = #{userId}
-        GROUP BY account_id
-        ) t1
-        LEFT JOIN (
         SELECT
         SELECT
-        account_id,
+        account_id AS 'accountId',
         account_name AS 'authName',
         account_name AS 'authName',
-        MAX( create_time ) AS 'maxCreateTime',
-        COUNT(
-        IF
-        ( effective = '1', TRUE, NULL )) AS 'valid',
-        count( effective ) AS 'new',
-        operating_name AS 'userName',
-        '' AS 'projectName'
+        MAX(stat_date) AS 'maxCreateTime',
+        '0' AS 'valid',
+        IFNULL(SUM(promotion_num),0) AS 'new',
+        user_name AS 'userName'
         FROM
         FROM
-        ctop_new_monitor_campaign
-        WHERE
-        (create_time between #{startDate} and #{endDate})
-        and project_type=#{project}
-        AND account_id IN
-        <foreach item="item" collection="array" separator="," open="(" close=")" index="">
-            #{item}
-        </foreach>
-        GROUP BY
-        account_id
-        ) t2 ON t1.account_id = t2.account_id
-        ) t
-        WHERE new >0
-        ORDER BY maxCreateTime desc
+        application.app_bytedance_account_base_info_d
+        WHERE stat_date >= #{startDate}
+        AND stat_date &lt;= #{endDate}
+        <if test="array != null and array.size() > 0">
+            and account_id in
+            <foreach item="item" collection="array" separator="," open="(" close=")" index="">
+                #{item}
+            </foreach>
+        </if>
+        GROUP BY account_id
+        order by `new` desc
     </select>
     </select>
-
 </mapper>
 </mapper>

+ 8 - 8
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/report/service/NewMonitorService.java

@@ -11,23 +11,23 @@ public interface NewMonitorService {
 
 
     public Result synchronousTouTiaoMonitor(String type, Long accId);
     public Result synchronousTouTiaoMonitor(String type, Long accId);
 
 
-    List<JSONObject> getKuaiShouGroupMessage(JSONArray array, String startDate, String endDate, String target);
+    List<JSONObject> getKuaiShouGroupMessage(JSONArray array, Integer startDate, Integer endDate );
 
 
-    JSONObject getKuaiShouGroupSum(JSONArray array, String startDate, String endDate);
+    JSONObject getKuaiShouGroupSum(JSONArray array, Integer startDate, Integer endDate);
 
 
     List<JSONObject> getKuaiShouGroupMessageGroup(JSONArray array, String startDate, String endDate);
     List<JSONObject> getKuaiShouGroupMessageGroup(JSONArray array, String startDate, String endDate);
 
 
-    List<JSONObject> getPlanMessage(JSONArray array, String startDate, String endDate, String target, String project);
+    List<JSONObject> getPlanMessage(JSONArray array, Integer startDate, Integer endDate);
 
 
-    JSONObject getPlanSum(JSONArray array, String startDate, String endDate, String project);
+    JSONObject getPlanSum(JSONArray array, Integer startDate, Integer endDate);
 
 
-    List<JSONObject> getPlanMessageGroup(JSONArray array, String startDate, String endDate, String project);
+    List<JSONObject> getPlanMessageGroup(JSONArray array, String startDate, String endDate);
 
 
     List<JSONObject> getOperator(String userId, String userName);
     List<JSONObject> getOperator(String userId, String userName);
 
 
-    JSONObject getPlanSumBytedance(String userId, JSONArray accountIds, String startDate, String endDate, String s);
+    JSONObject getPlanSumBytedance(JSONArray accountIds, Integer startDate, Integer endDate);
 
 
-    List<JSONObject> getPlanMessageGroupBytedance(String userId, JSONArray accountIds, String startDate, String endDate, String s);
+    List<JSONObject> getPlanMessageGroupBytedance(JSONArray accountIds, String startDate, String endDate);
 
 
-    List<JSONObject> getPlanMessageBytedance(String userId, JSONArray accountIds, String startDate, String endDate, String target, String s);
+    List<JSONObject> getPlanMessageBytedance(JSONArray accountIds, Integer startDate, Integer endDate);
 }
 }

+ 15 - 16
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/report/service/impl/NewMonitorServiceImpl.java

@@ -210,7 +210,7 @@ public class NewMonitorServiceImpl implements NewMonitorService {
      * @return
      * @return
      */
      */
     @Override
     @Override
-    public List<JSONObject> getKuaiShouGroupMessage(JSONArray array, String startDate, String endDate, String target) {
+    public List<JSONObject> getKuaiShouGroupMessage(JSONArray array, Integer startDate, Integer endDate) {
         return newMonitorMapper.getKuaiShouGroupMessage(array, startDate, endDate);
         return newMonitorMapper.getKuaiShouGroupMessage(array, startDate, endDate);
     }
     }
 
 
@@ -221,7 +221,7 @@ public class NewMonitorServiceImpl implements NewMonitorService {
      * @return
      * @return
      */
      */
     @Override
     @Override
-    public JSONObject getKuaiShouGroupSum(JSONArray array, String startDate, String endDate) {
+    public JSONObject getKuaiShouGroupSum(JSONArray array, Integer startDate, Integer endDate) {
         return newMonitorMapper.getKuaiShouGroupSum(array, startDate, endDate);
         return newMonitorMapper.getKuaiShouGroupSum(array, startDate, endDate);
     }
     }
 
 
@@ -239,7 +239,7 @@ public class NewMonitorServiceImpl implements NewMonitorService {
             if (DateUtils.isMoreSixMonth(startDate, endDate)) {
             if (DateUtils.isMoreSixMonth(startDate, endDate)) {
                 group = "1";
                 group = "1";
             }
             }
-            kuaiShouGroupMessageGroup = newMonitorMapper.getKuaiShouGroupMessageGroup(array, startDate, endDate, group);
+            kuaiShouGroupMessageGroup = newMonitorMapper.getKuaiShouGroupMessageGroup(array, DateUtils.getDateInteger(startDate), DateUtils.getDateInteger(endDate), group);
         } catch (Exception e) {
         } catch (Exception e) {
             log.info("查询数据错误:{}", e.toString());
             log.info("查询数据错误:{}", e.toString());
         }
         }
@@ -248,8 +248,8 @@ public class NewMonitorServiceImpl implements NewMonitorService {
     }
     }
 
 
     @Override
     @Override
-    public List<JSONObject> getPlanMessage(JSONArray array, String startDate, String endDate, String target, String project) {
-        return newMonitorMapper.getPlanMessage(array, startDate, endDate, project);
+    public List<JSONObject> getPlanMessage(JSONArray array, Integer startDate, Integer endDate) {
+        return newMonitorMapper.getPlanMessage(array, startDate, endDate);
     }
     }
 
 
     /**
     /**
@@ -259,23 +259,22 @@ public class NewMonitorServiceImpl implements NewMonitorService {
      * @return
      * @return
      */
      */
     @Override
     @Override
-    public JSONObject getPlanSum(JSONArray array, String startDate, String endDate, String project) {
-        return newMonitorMapper.getPlanSum(array, startDate, endDate, project);
+    public JSONObject getPlanSum(JSONArray array, Integer startDate, Integer endDate) {
+        return newMonitorMapper.getPlanSum(array, startDate, endDate);
     }
     }
 
 
     @Override
     @Override
-    public List<JSONObject> getPlanMessageGroup(JSONArray array, String startDate, String endDate, String project) {
+    public List<JSONObject> getPlanMessageGroup(JSONArray array, String startDate, String endDate) {
         String group = "0";
         String group = "0";
         List<JSONObject> planGroupMessageGroup = new ArrayList<>();
         List<JSONObject> planGroupMessageGroup = new ArrayList<>();
         try {
         try {
             if (DateUtils.isMoreSixMonth(startDate, endDate)) {
             if (DateUtils.isMoreSixMonth(startDate, endDate)) {
                 group = "1";
                 group = "1";
             }
             }
-            planGroupMessageGroup = newMonitorMapper.getPlanMessageGroup(array, startDate, endDate, group, project);
+            planGroupMessageGroup = newMonitorMapper.getPlanMessageGroup(array, DateUtils.getDateInteger(startDate), DateUtils.getDateInteger(endDate),group);
         } catch (Exception e) {
         } catch (Exception e) {
             log.info("查询数据错误:{}", e.toString());
             log.info("查询数据错误:{}", e.toString());
         }
         }
-
         return planGroupMessageGroup;
         return planGroupMessageGroup;
     }
     }
 
 
@@ -298,19 +297,19 @@ public class NewMonitorServiceImpl implements NewMonitorService {
     }
     }
 
 
     @Override
     @Override
-    public JSONObject getPlanSumBytedance(String userId, JSONArray accountIds, String startDate, String endDate, String project) {
-        return newMonitorMapper.getPlanSumBytedance(userId,accountIds, startDate, endDate, project);
+    public JSONObject getPlanSumBytedance(JSONArray accountIds, Integer startDate, Integer endDate) {
+        return newMonitorMapper.getPlanSumBytedance(accountIds, startDate, endDate);
     }
     }
 
 
     @Override
     @Override
-    public List<JSONObject> getPlanMessageGroupBytedance(String userId, JSONArray array, String startDate, String endDate, String project) {
+    public List<JSONObject> getPlanMessageGroupBytedance(JSONArray array, String startDate, String endDate) {
         String group = "0";
         String group = "0";
         List<JSONObject> planGroupMessageGroup = new ArrayList<>();
         List<JSONObject> planGroupMessageGroup = new ArrayList<>();
         try {
         try {
             if (DateUtils.isMoreSixMonth(startDate, endDate)) {
             if (DateUtils.isMoreSixMonth(startDate, endDate)) {
                 group = "1";
                 group = "1";
             }
             }
-            planGroupMessageGroup = newMonitorMapper.getPlanMessageGroupBytedance(userId,array, startDate, endDate, group, project);
+            planGroupMessageGroup = newMonitorMapper.getPlanMessageGroupBytedance(array, DateUtils.getDateInteger(startDate), DateUtils.getDateInteger(endDate),group);
         } catch (Exception e) {
         } catch (Exception e) {
             log.info("查询数据错误:{}", e.toString());
             log.info("查询数据错误:{}", e.toString());
         }
         }
@@ -318,8 +317,8 @@ public class NewMonitorServiceImpl implements NewMonitorService {
     }
     }
 
 
     @Override
     @Override
-    public List<JSONObject> getPlanMessageBytedance(String userId, JSONArray array, String startDate, String endDate, String target, String project) {
-        return newMonitorMapper.getPlanMessageBytedance(userId,array, startDate, endDate, project);
+    public List<JSONObject> getPlanMessageBytedance(JSONArray array, Integer startDate, Integer endDate) {
+        return newMonitorMapper.getPlanMessageBytedance(array, startDate, endDate);
     }
     }
 
 
     List<JSONObject> getAllNode(List<NewMonitorInfo> operator) {
     List<JSONObject> getAllNode(List<NewMonitorInfo> operator) {

+ 6 - 7
jeecg-boot-module-system/src/main/java/cn/com/ctop/toutiao/modules/material/service/impl/ByteDanceVideoInfoServiceImpl.java

@@ -97,18 +97,17 @@ public class ByteDanceVideoInfoServiceImpl extends ServiceImpl<ByteDanceVideoInf
     //违规信息入库
     //违规信息入库
     private void storageIllegalInfo(JSONArray array, Long promotionId) {
     private void storageIllegalInfo(JSONArray array, Long promotionId) {
         try {
         try {
-            JSONObject project = null;
             List<JSONObject> list = new ArrayList<>();
             List<JSONObject> list = new ArrayList<>();
             for (int i = 0; i < array.size(); i++) {
             for (int i = 0; i < array.size(); i++) {
                 JSONObject data = array.getJSONObject(i);
                 JSONObject data = array.getJSONObject(i);
                 Long advertiserId = data.getLong("advertiser_id");
                 Long advertiserId = data.getLong("advertiser_id");
-                if (Check.isNull(project)) {
-                    //获取项目消息
-                    project = userAllocationService.getAccountInfoByAccountId(advertiserId);
+                //获取项目消息
+                JSONObject project = userAllocationService.getAccountInfoByAccountId(advertiserId);
+                if (!Check.isNull(project)) {
+                    data.put("projectId", project.getLong("projectId"));
+                    data.put("projectName", project.getString("projectName"));
+                    data.put("userId", project.getString("user_id"));
                 }
                 }
-                data.put("projectId", project.getLong("projectId"));
-                data.put("projectName", project.getString("projectName"));
-                data.put("userId", project.getString("user_id"));
                 //计划ID
                 //计划ID
                 Long promotion_id = data.getLong("promotion_id");
                 Long promotion_id = data.getLong("promotion_id");
                 //违规素材列表,包含广告下投前+投中拒审的素材信息
                 //违规素材列表,包含广告下投前+投中拒审的素材信息

+ 17 - 12
jeecg-boot-module-system/src/main/java/cn/com/ctop/toutiao/modules/report/controller/BytedanceNewPlanReportCtrl.java

@@ -9,6 +9,7 @@ import com.alibaba.fastjson.JSONObject;
 import lombok.extern.slf4j.Slf4j;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.poi.xssf.usermodel.XSSFWorkbook;
 import org.apache.poi.xssf.usermodel.XSSFWorkbook;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.util.DateUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestBody;
@@ -46,9 +47,9 @@ public class BytedanceNewPlanReportCtrl {
         Result<Map<String, Object>> resultBody = new Result<>();
         Result<Map<String, Object>> resultBody = new Result<>();
         Map<String, Object> result = new HashMap<>();
         Map<String, Object> result = new HashMap<>();
         JSONArray accountIds = requestBody.getJSONArray("accountIds");
         JSONArray accountIds = requestBody.getJSONArray("accountIds");
-        //TODO 没有维护头条事业部负责人角色,增加判断
+        // 陈思宇 4afe739502ae4258a18c36a000d7ff20
         String userId = requestBody.getString("userId");
         String userId = requestBody.getString("userId");
-        if ("0c2113fb63b94941be024efce2d83369".equals(userId)) {
+        if ("4afe739502ae4258a18c36a000d7ff20".equals(userId)) {
             accountIds = newPlanReportService.getAccountIdsByMedia();
             accountIds = newPlanReportService.getAccountIdsByMedia();
         } else {
         } else {
             if (!userId.isEmpty()) {
             if (!userId.isEmpty()) {
@@ -60,8 +61,10 @@ public class BytedanceNewPlanReportCtrl {
         }
         }
         String startDate = requestBody.getString("startDate");
         String startDate = requestBody.getString("startDate");
         String endDate = requestBody.getString("endDate");
         String endDate = requestBody.getString("endDate");
-        startDate=startDate+" 00:00:00";
-        endDate=endDate+" 23:59:59";
+
+        Integer startDateInteger = DateUtils.getDateInteger(startDate);
+        Integer endDateInteger = DateUtils.getDateInteger(endDate);
+
         String target = requestBody.getString("target");
         String target = requestBody.getString("target");
         String order = requestBody.getString("order");
         String order = requestBody.getString("order");
         try {
         try {
@@ -69,9 +72,9 @@ public class BytedanceNewPlanReportCtrl {
             List<JSONObject> chartData = newPlanReportService.getBytedanceNewPlanGroupByStatDate(accountIds, startDate, endDate);
             List<JSONObject> chartData = newPlanReportService.getBytedanceNewPlanGroupByStatDate(accountIds, startDate, endDate);
             List<JSONObject> listData = newPlanReportService.getBytedanceNewPlanGroupByAccount(accountIds, startDate, endDate, target, order);
             List<JSONObject> listData = newPlanReportService.getBytedanceNewPlanGroupByAccount(accountIds, startDate, endDate, target, order);
 */
 */
-            JSONObject sumData = newMonitorService.getPlanSumBytedance(userId,accountIds, startDate, endDate, "0");
-            List<JSONObject> chartData = newMonitorService.getPlanMessageGroupBytedance(userId,accountIds, startDate, endDate, "0");
-            List<JSONObject> listData = newMonitorService.getPlanMessageBytedance(userId,accountIds, startDate, endDate, target, "0");
+            JSONObject sumData = newMonitorService.getPlanSumBytedance(accountIds, startDateInteger, endDateInteger);
+            List<JSONObject> chartData = newMonitorService.getPlanMessageGroupBytedance(accountIds, startDate, endDate);
+            List<JSONObject> listData = newMonitorService.getPlanMessageBytedance(accountIds, startDateInteger, endDateInteger);
             result.put("sumData", sumData);
             result.put("sumData", sumData);
             result.put("chartData", chartData);
             result.put("chartData", chartData);
             result.put("listData", listData);
             result.put("listData", listData);
@@ -91,8 +94,8 @@ public class BytedanceNewPlanReportCtrl {
 
 
         JSONArray accountIds = requestBody.getJSONArray("accountIds");
         JSONArray accountIds = requestBody.getJSONArray("accountIds");
         String userId = requestBody.getString("userId");
         String userId = requestBody.getString("userId");
-        //TODO 没有维护快手事业部负责人角色,增加判断
-        if ("6b4c821adc414dc8b7718ab63ccbfcaf".equals(userId)) {
+        // 陈思宇 4afe739502ae4258a18c36a000d7ff20
+        if ("4afe739502ae4258a18c36a000d7ff20".equals(userId)) {
             accountIds = newPlanReportService.getAccountIdsByMedia();
             accountIds = newPlanReportService.getAccountIdsByMedia();
         } else {
         } else {
             if (!userId.isEmpty()) {
             if (!userId.isEmpty()) {
@@ -104,11 +107,13 @@ public class BytedanceNewPlanReportCtrl {
         }
         }
         String startDate = requestBody.getString("startDate");
         String startDate = requestBody.getString("startDate");
         String endDate = requestBody.getString("endDate");
         String endDate = requestBody.getString("endDate");
-        startDate=startDate+" 00:00:00";
-        endDate=endDate+" 59:59:59";
+
+        Integer startDateInteger = DateUtils.getDateInteger(startDate);
+        Integer endDateInteger = DateUtils.getDateInteger(endDate);
+
         String target = requestBody.getString("target");
         String target = requestBody.getString("target");
         String order = requestBody.getString("order");
         String order = requestBody.getString("order");
-        List<JSONObject> listData = newMonitorService.getPlanMessageBytedance(userId,accountIds, startDate, endDate, target, "0");
+        List<JSONObject> listData = newMonitorService.getPlanMessageBytedance(accountIds, startDateInteger, endDateInteger);
 
 
         List<List<Object>> excelList = new ArrayList<>();
         List<List<Object>> excelList = new ArrayList<>();
         listData.forEach(data -> {
         listData.forEach(data -> {