Browse Source

首页,添加抖音维度数据

zhaoxian 2 years ago
parent
commit
fa36d1e9b6

+ 9 - 6
ruixuan-live/src/main/java/com/ruixuan/isc/controller/KuaishouItemCollectSamplesController.java

@@ -103,10 +103,10 @@ public class KuaishouItemCollectSamplesController extends BaseController {
                         requestMap.put("itemCreateId", userId);
                     }
                 } else {
-                    if (roleId.equals("courtshipManager")  || roleId.equals("bdManager") ) { // 经理层级查看部门下所有数据
+                    if (roleId.equals("courtshipManager") || roleId.equals("bdManager")) { // 经理层级查看部门下所有数据
                         Long deptId = sysDeptService.getDeptIdByUserId(userId);
                         List<Long> userIds = sysDeptService.getDeptUserListByDeptId(deptId);
-                        if (roleId.equals("bdManager") ) {
+                        if (roleId.equals("bdManager")) {
                             requestMap.put("collectSampleIds", userIds);
                         } else {
                             requestMap.put("itemCreateIds", userIds);
@@ -673,13 +673,15 @@ public class KuaishouItemCollectSamplesController extends BaseController {
     public JSONObject getOrderData(@ApiParam("创建人ID") @RequestParam(value = "userId", required = true) Long userId,
                                    @ApiParam("开始日期") @RequestParam(value = "statDate", required = false) String startDate,
                                    @ApiParam("结束日期") @RequestParam(value = "endDate", required = false) String endDate,
-                                   @ApiParam("类型,1-渠道;2-招商") @RequestParam(value = "type", required = true) String type) {
+                                   @ApiParam("类型,1-渠道;2-招商") @RequestParam(value = "type", required = true) String type,
+                                   @ApiParam("媒体,1-抖音;2-快手") @RequestParam(value = "mediaId", required = false) String mediaId
+    ) {
         JSONObject returnJson = new JSONObject();
         try {
             if (Check.isNull(userId)) {
                 throw new Exception("请传入人员ID");
             }
-            return kuaishouItemCollectSamplesService.getOrderData(userId, startDate, endDate, type);
+            return kuaishouItemCollectSamplesService.getOrderData(userId, startDate, endDate, type, mediaId);
         } catch (Exception e) {
             e.printStackTrace();
             returnJson.put("code", 500);
@@ -694,13 +696,14 @@ public class KuaishouItemCollectSamplesController extends BaseController {
     public JSONObject getDataAnalysis(@ApiParam("创建人ID") @RequestParam(value = "userId", required = true) Long userId,
                                       @ApiParam("开始日期") @RequestParam(value = "statDate", required = false) String startDate,
                                       @ApiParam("结束日期") @RequestParam(value = "endDate", required = false) String endDate,
-                                      @ApiParam("类型,1-渠道;2-招商") @RequestParam(value = "type", required = true) String type) {
+                                      @ApiParam("类型,1-渠道;2-招商") @RequestParam(value = "type", required = true) String type,
+                                      @ApiParam("媒体,1-抖音;2-快手") @RequestParam(value = "mediaId", required = false) String mediaId) {
         JSONObject returnJson = new JSONObject();
         try {
             if (Check.isNull(userId)) {
                 throw new Exception("请传入人员ID");
             }
-            return kuaishouItemCollectSamplesService.getDataAnalysis(userId, startDate, endDate, type);
+            return kuaishouItemCollectSamplesService.getDataAnalysis(userId, startDate, endDate, type, mediaId);
         } catch (Exception e) {
             e.printStackTrace();
             returnJson.put("code", 500);

+ 124 - 54
ruixuan-live/src/main/java/com/ruixuan/isc/controller/SupplyChainController.java

@@ -532,100 +532,174 @@ public class SupplyChainController extends BaseController {
     public TableDataInfo indexOrderRank(
             @ApiParam("时间类型") @RequestParam(value = "dateType", required = true) Integer dateType,
             @ApiParam("开始时间") @RequestParam(value = "orderStartDate", required = true) String orderStartDate,
-            @ApiParam("结束时间") @RequestParam(value = "orderEndDate", required = true) String orderEndDate) {
+            @ApiParam("结束时间") @RequestParam(value = "orderEndDate", required = true) String orderEndDate,
+            @ApiParam("媒体,1-抖音;2-快手") @RequestParam(value = "mediaId", required = false) String mediaId) {
 
         Map<String, Object> requestMap = new HashMap<>();
         if (dateType == 0) {
-            if (!Check.isNull(orderStartDate)) {
-                Long start = DateUtils.getStartLongTime(orderStartDate); //当天开始时间
-                requestMap.put("start", start);
+            if ("1".equals(mediaId)) {
+                return indexOrderRankBytedance(dateType, orderStartDate, orderEndDate);
+            } else {
+                Integer hour = DateUtils.getNowHour(); // 当前小时
+                Long nowStartHourTemp = DateUtils.getStartLongTime(orderStartDate); // 当天开始时间戳
+                Long nowEndHourTemp = DateUtils.getNowEndHourTemp(orderStartDate, hour); // 当前结束时间戳
+                String yesterday = DateUtils.getAnotherDay("yyyy-MM-dd", orderStartDate, -1); // 昨日日期
+                Long yesterdayStartHourTemp = DateUtils.getStartLongTime(yesterday); //昨日开始时间戳
+                Long yesterdayEndHourTemp = DateUtils.getNowEndHourTemp(yesterday, hour); // 昨日结束时间戳
+                requestMap.put("nowStartHourTemp", nowStartHourTemp);
+                requestMap.put("nowEndHourTemp", nowEndHourTemp);
+                requestMap.put("yesterdayStartHourTemp", yesterdayStartHourTemp);
+                requestMap.put("yesterdayEndHourTemp", yesterdayEndHourTemp);
+                startPage();
+                List<JSONObject> orderRankRatioList = supplyChainService.getOrderRankRatioList(requestMap);
+                return getDataTable(orderRankRatioList);
             }
-            if (!Check.isNull(orderEndDate)) {
-                Long end = DateUtils.getEndLongTime(orderEndDate); // 当天结束时间
-                requestMap.put("end", end);
+        } else {
+            if ("1".equals(mediaId)) {
+                return indexOrderRankBytedance(dateType, orderStartDate, orderEndDate);
+            } else {
+                if (!Check.isNull(orderStartDate)) {
+                    Long start = DateUtils.getStartLongTime(orderStartDate);
+                    requestMap.put("start", start);
+                }
+                if (!Check.isNull(orderEndDate)) {
+                    Long end = DateUtils.getEndLongTime(orderEndDate);
+                    requestMap.put("end", end);
+                }
+                startPage();
+                List<JSONObject> orderRankRatioList = supplyChainService.getOrderRankList(requestMap);
+                return getDataTable(orderRankRatioList);
             }
-            Integer hour = DateUtils.getNowHour(); // 当前小时
-            Long nowStartHourTemp = DateUtils.getStartLongTime(orderStartDate); // 当天开始时间戳
-            Long nowEndHourTemp = DateUtils.getNowEndHourTemp(orderStartDate, hour); // 当前结束时间戳
+        }
+    }
+
+    private TableDataInfo indexOrderRankBytedance(Integer dateType, String orderStartDate, String orderEndDate) {
+        Map<String, Object> requestMap = new HashMap<>();
+        if (dateType == 0) {
+            Long nowStartHourTemp = DateUtils.strDateToInt(orderStartDate);
             String yesterday = DateUtils.getAnotherDay("yyyy-MM-dd", orderStartDate, -1); // 昨日日期
-            Long yesterdayStartHourTemp = DateUtils.getStartLongTime(yesterday); //昨日开始时间戳
-            Long yesterdayEndHourTemp = DateUtils.getNowEndHourTemp(yesterday, hour); // 昨日结束时间戳
+            Long yesterdayStartHourTemp = DateUtils.strDateToInt(yesterday); //昨日时间
             requestMap.put("nowStartHourTemp", nowStartHourTemp);
-            requestMap.put("nowEndHourTemp", nowEndHourTemp);
+            requestMap.put("nowEndHourTemp", nowStartHourTemp);
             requestMap.put("yesterdayStartHourTemp", yesterdayStartHourTemp);
-            requestMap.put("yesterdayEndHourTemp", yesterdayEndHourTemp);
+            requestMap.put("yesterdayEndHourTemp", yesterdayStartHourTemp);
             startPage();
-            List<JSONObject> orderRankRatioList = supplyChainService.getOrderRankRatioList(requestMap);
+            List<JSONObject> orderRankRatioList = supplyChainService.getOrderRankRatioListBytedance(requestMap);
             return getDataTable(orderRankRatioList);
         } else {
             if (!Check.isNull(orderStartDate)) {
-                Long start = DateUtils.getStartLongTime(orderStartDate);
+                Long start = DateUtils.strDateToInt(orderStartDate);
                 requestMap.put("start", start);
             }
             if (!Check.isNull(orderEndDate)) {
-                Long end = DateUtils.getEndLongTime(orderEndDate);
+                Long end = DateUtils.strDateToInt(orderEndDate);
                 requestMap.put("end", end);
             }
             startPage();
-            List<JSONObject> orderRankRatioList = supplyChainService.getOrderRankList(requestMap);
+            List<JSONObject> orderRankRatioList = supplyChainService.getOrderRankListBytedance(requestMap);
             return getDataTable(orderRankRatioList);
         }
-
     }
 
-
     @GetMapping("/indexPromoterRank")
     @ApiOperation(value = "首页-达人排行")
     public TableDataInfo indexPromoterRank(
             @ApiParam("时间类型") @RequestParam(value = "dateType", required = true) Integer dateType,
             @ApiParam("开始时间") @RequestParam(value = "orderStartDate", required = true) String orderStartDate,
             @ApiParam("结束时间") @RequestParam(value = "orderEndDate", required = true) String orderEndDate,
-            @ApiParam("userId") @RequestParam(value = "userId", required = false) Long userId) {
+            @ApiParam("userId") @RequestParam(value = "userId", required = false) Long userId,
+            @ApiParam("媒体,1-抖音;2-快手") @RequestParam(value = "mediaId", required = false) String mediaId
+    ) {
 
         Map<String, Object> requestMap = new HashMap<>();
         if (dateType == 0) {
-            if (Check.isNotNull(userId)) {
-                requestMap.put("promoterIds", promoterService.selectPromoterIdList(Arrays.asList(userId)));
+            if ("1".equals(mediaId)) {
+                return indexPromoterRankBytedance(dateType, orderStartDate, orderEndDate,userId);
+            } else {
+                if (Check.isNotNull(userId)) {
+                    List<String> promoterIds = promoterService.selectPromoterIdList(Arrays.asList(userId), mediaId);
+                    if (Check.isNull(promoterIds)) {
+                        return getDataTable(null);
+                    }
+                    requestMap.put("promoterIds", promoterIds);
+                }
+                if (!Check.isNull(orderStartDate)) {
+                    Long start = DateUtils.getStartLongTime(orderStartDate); //当天开始时间
+                    requestMap.put("start", start);
+                }
+                if (!Check.isNull(orderEndDate)) {
+                    Long end = DateUtils.getEndLongTime(orderEndDate); // 当天结束时间
+                    requestMap.put("end", end);
+                }
+                Integer hour = DateUtils.getNowHour(); // 当前小时
+                Long nowStartHourTemp = DateUtils.getStartLongTime(orderStartDate); // 当天开始时间戳
+                Long nowEndHourTemp = DateUtils.getNowEndHourTemp(orderStartDate, hour); // 当前结束时间戳
+                String yesterday = DateUtils.getAnotherDay("yyyy-MM-dd", orderStartDate, -1); // 昨日日期
+                Long yesterdayStartHourTemp = DateUtils.getStartLongTime(yesterday); //昨日开始时间戳
+                Long yesterdayEndHourTemp = DateUtils.getNowEndHourTemp(yesterday, hour); // 昨日结束时间戳
+                requestMap.put("nowStartHourTemp", nowStartHourTemp);
+                requestMap.put("nowEndHourTemp", nowEndHourTemp);
+                requestMap.put("yesterdayStartHourTemp", yesterdayStartHourTemp);
+                requestMap.put("yesterdayEndHourTemp", yesterdayEndHourTemp);
+                startPage();
+                List<JSONObject> promoterRankRatioList = supplyChainService.getPromoterRankRatioList(requestMap);
+                return getDataTable(promoterRankRatioList);
             }
-            if (!Check.isNull(orderStartDate)) {
-                Long start = DateUtils.getStartLongTime(orderStartDate); //当天开始时间
-                requestMap.put("start", start);
+        } else {
+            if ("1".equals(mediaId)) {
+                return indexPromoterRankBytedance(dateType, orderStartDate, orderEndDate,userId);
+            } else {
+                if (!Check.isNull(orderStartDate)) {
+                    Long start = DateUtils.getStartLongTime(orderStartDate);
+                    requestMap.put("start", start);
+                }
+                if (!Check.isNull(orderEndDate)) {
+                    Long end = DateUtils.getEndLongTime(orderEndDate);
+                    requestMap.put("end", end);
+                }
+                startPage();
+                List<JSONObject> orderRatioList = supplyChainService.getPromoterRatioList(requestMap);
+                return getDataTable(orderRatioList);
             }
-            if (!Check.isNull(orderEndDate)) {
-                Long end = DateUtils.getEndLongTime(orderEndDate); // 当天结束时间
-                requestMap.put("end", end);
+        }
+    }
+
+    public TableDataInfo indexPromoterRankBytedance(Integer dateType, String orderStartDate, String orderEndDate, Long userId) {
+        Map<String, Object> requestMap = new HashMap<>();
+        if (dateType == 0) {
+            if (Check.isNotNull(userId)) {
+                List<String> promoterIds = promoterService.selectPromoterIdList(Arrays.asList(userId), "1");
+                if (Check.isNull(promoterIds)) {
+                    return getDataTable(null);
+                }
+                requestMap.put("promoterIds", promoterIds);
             }
-            Integer hour = DateUtils.getNowHour(); // 当前小时
-            Long nowStartHourTemp = DateUtils.getStartLongTime(orderStartDate); // 当天开始时间戳
-            Long nowEndHourTemp = DateUtils.getNowEndHourTemp(orderStartDate, hour); // 当前结束时间戳
+            Long nowStartHourTemp = DateUtils.strDateToInt(orderStartDate); // 当天开始时间戳
             String yesterday = DateUtils.getAnotherDay("yyyy-MM-dd", orderStartDate, -1); // 昨日日期
-            Long yesterdayStartHourTemp = DateUtils.getStartLongTime(yesterday); //昨日开始时间戳
-            Long yesterdayEndHourTemp = DateUtils.getNowEndHourTemp(yesterday, hour); // 昨日结束时间戳
+            Long yesterdayStartHourTemp = DateUtils.strDateToInt(yesterday); //昨日开始时间戳
             requestMap.put("nowStartHourTemp", nowStartHourTemp);
-            requestMap.put("nowEndHourTemp", nowEndHourTemp);
+            requestMap.put("nowEndHourTemp", nowStartHourTemp);
             requestMap.put("yesterdayStartHourTemp", yesterdayStartHourTemp);
-            requestMap.put("yesterdayEndHourTemp", yesterdayEndHourTemp);
+            requestMap.put("yesterdayEndHourTemp", yesterdayStartHourTemp);
             startPage();
-            List<JSONObject> promoterRankRatioList = supplyChainService.getPromoterRankRatioList(requestMap);
+            List<JSONObject> promoterRankRatioList = supplyChainService.getPromoterRankRatioListBytedance(requestMap);
             return getDataTable(promoterRankRatioList);
 
         } else {
             if (!Check.isNull(orderStartDate)) {
-                Long start = DateUtils.getStartLongTime(orderStartDate);
+                Long start = DateUtils.strDateToInt(orderStartDate); //当天开始时间
                 requestMap.put("start", start);
             }
             if (!Check.isNull(orderEndDate)) {
-                Long end = DateUtils.getEndLongTime(orderEndDate);
+                Long end = DateUtils.strDateToInt(orderEndDate); // 当天结束时间
                 requestMap.put("end", end);
             }
             startPage();
-            List<JSONObject> orderRatioList = supplyChainService.getPromoterRatioList(requestMap);
+            List<JSONObject> orderRatioList = supplyChainService.getPromoterRatioListBytedance(requestMap);
             return getDataTable(orderRatioList);
         }
-
     }
 
-
     @RequestMapping(value = "/exportPromoterTotal")
     @ResponseBody
     public void exportPromoterTotal(HttpServletRequest request, HttpServletResponse response, @RequestBody JSONObject requestJson) throws Exception {
@@ -820,7 +894,7 @@ public class SupplyChainController extends BaseController {
         return getDataTable(list);
     }
 
-  @GetMapping("/getSupplyChainCourtshipUserList")
+    @GetMapping("/getSupplyChainCourtshipUserList")
     @ApiOperation(value = "获取供应链成员列表")
     public TableDataInfo getSupplyChainCourtshipUserList() {
         List<JSONObject> list = supplyChainService.getSupplyChainCourtshipUserList();
@@ -987,9 +1061,9 @@ public class SupplyChainController extends BaseController {
         }
         List<JSONObject> list = new ArrayList<>();
         startPage();
-        if(!Check.isNull(orderStartDate) && !Check.isNull(orderEndDate)){
+        if (!Check.isNull(orderStartDate) && !Check.isNull(orderEndDate)) {
             list = supplyChainService.adminReportList(requestMap);
-        } else if( !Check.isNull(bindStartDate) && !Check.isNull(bindEndDate) ){
+        } else if (!Check.isNull(bindStartDate) && !Check.isNull(bindEndDate)) {
             list = supplyChainService.adminReportListByBind(requestMap);
         }
 
@@ -1027,9 +1101,9 @@ public class SupplyChainController extends BaseController {
             requestMap.put("userId", requestJson.getString("userId"));
         }
         List<JSONObject> list = new ArrayList<>();
-        if(!Check.isNull(requestJson.getString("orderStartDate")) && !Check.isNull(requestJson.getString("orderEndDate"))){
+        if (!Check.isNull(requestJson.getString("orderStartDate")) && !Check.isNull(requestJson.getString("orderEndDate"))) {
             list = supplyChainService.exportAdminReportList(requestMap);
-        }else if(!Check.isNull(requestJson.getString("bindStartDate")) && !Check.isNull(requestJson.getString("bindEndDate"))){
+        } else if (!Check.isNull(requestJson.getString("bindStartDate")) && !Check.isNull(requestJson.getString("bindEndDate"))) {
             list = supplyChainService.exportAdminReportListByBind(requestMap);
         }
 
@@ -1537,9 +1611,6 @@ public class SupplyChainController extends BaseController {
     }
 
 
-
-
-
     @GetMapping("/bdReportListV2")
     @ApiOperation(value = "供应链管理员统计列表")
     public TableDataInfo bdReportListV2(
@@ -1611,7 +1682,7 @@ public class SupplyChainController extends BaseController {
                 exportList.add(export);
             }
         }
-        String[] headers = {"渠道ID", "渠道姓名", "(总)达人数", "(总)领样达人数", "(总)领样率", "(总)未领样数", "发样数", "发样达人数", "发样商品数", "订单数",  "有效订单数",  "有效订单率", "订单金额",  "预估服务费", "结算服务费"};
+        String[] headers = {"渠道ID", "渠道姓名", "(总)达人数", "(总)领样达人数", "(总)领样率", "(总)未领样数", "发样数", "发样达人数", "发样商品数", "订单数", "有效订单数", "有效订单率", "订单金额", "预估服务费", "结算服务费"};
         OutputStream os = response.getOutputStream();
         ExportExcelUtils eeu = new ExportExcelUtils();
         XSSFWorkbook workbook = new XSSFWorkbook();
@@ -1625,7 +1696,6 @@ public class SupplyChainController extends BaseController {
     }
 
 
-
     @GetMapping("/bdTotalV2")
     @ApiOperation(value = "供应链管理员统计列表")
     public TableDataInfo bdTotalV2(
@@ -1706,8 +1776,8 @@ public class SupplyChainController extends BaseController {
         if (!Check.isNull(requestJson.getLong("collectSampleId"))) {
             requestMap.put("collectSampleId", requestJson.getLong("collectSampleId"));
         }
-        requestMap.put("fieId","orderNum");
-        requestMap.put("sort","desc");
+        requestMap.put("fieId", "orderNum");
+        requestMap.put("sort", "desc");
         List<JSONObject> list = supplyChainService.bdDetailListV2(requestMap);
         List<List<Object>> exportList = new ArrayList<>();
         if (!Check.isNull(list)) {

+ 3 - 2
ruixuan-live/src/main/java/com/ruixuan/isc/mapper/KuaishouItemCollectSamplesMapper.java

@@ -103,11 +103,12 @@ public interface KuaishouItemCollectSamplesMapper {
 
     Integer getSampleCountByUserId(@Param("userList") List<Long> userList, @Param("userType") Integer userType, @Param("status") Integer status);
 
-    JSONObject queryTheNumberOfCompletedJobs(@Param("promoterIds") List<String> promoterIds, @Param("startDate") String startDate, @Param("endDate") String endDate);
+    JSONObject queryTheNumberOfCompletedJobs(@Param("promoterIds") List<String> promoterIds, @Param("startDate") String startDate,
+                                             @Param("endDate") String endDate, @Param("mediaId") String mediaId);
 
     List<JSONObject> selectPromoterInfo(@Param("map") Map<String, String> map);
 
-    List<Long> getItemIdsByCreateId(@Param("userList") List<Long> userList);
+    List<Long> getItemIdsByCreateId(@Param("userList") List<Long> userList,@Param("mediaId") String mediaId);
 
     List<JSONObject> queryProductList(Map<String, Object> map);
 

+ 2 - 2
ruixuan-live/src/main/java/com/ruixuan/isc/mapper/KuaishouPromoterMapper.java

@@ -64,9 +64,9 @@ public interface KuaishouPromoterMapper {
 
     void insertKuaishouPromoterRecord(JSONObject record);
 
-    List<String> selectPromoterIdList(@Param("userList") List<Long> userList);
+    List<String> selectPromoterIdList(@Param("userList") List<Long> userList, @Param("mediaId") String mediaId);
 
-    JSONObject getgetMonthPromoterTotal(@Param("userList") List<Long> userList, @Param("start") String start, @Param("end") String end);
+    JSONObject getgetMonthPromoterTotal(@Param("userList") List<Long> userList, @Param("start") String start, @Param("end") String end, @Param("mediaId") String mediaId);
 
     void updateKuaishouPromoterByPromoterId(KuaishouPromoter promoters);
 

+ 23 - 0
ruixuan-live/src/main/java/com/ruixuan/isc/mapper/SupplyChainMapper.java

@@ -75,14 +75,22 @@ public interface SupplyChainMapper {
 
     JSONObject selectOrderInfo(@Param("promoterIds") List<String> promoterIds, @Param("startDate") String startDate, @Param("endDate") String endDate);
 
+    JSONObject selectOrderInfoBytedance(@Param("promoterIds") List<String> promoterIds, @Param("startDate") Long startDate, @Param("endDate") Long endDate);
+
     JSONObject selectOrderRate(@Param("promoterIds") List<String> promoterIds, @Param("itemIds") List<Long> itemIds, @Param("statDate") Long statDate, @Param("endDate") Long endDate);
 
+    JSONObject selectOrderRateBytedance(@Param("promoterIds") List<String> promoterIds, @Param("itemIds") List<Long> itemIds, @Param("statDate") Long statDate, @Param("endDate") Long endDate);
+
     List<JSONObject> getMonthOrderAmount(Map<String, Object> map);
 
+    List<JSONObject> getMonthOrderAmountBytedance(Map<String, Object> map);
+
     JSONObject getMonthOrderAmountTotal(Map<String, Object> map);
 
     JSONObject selectOrderInfoByItemIds(@Param("itemIds") List<Long> itemIds, @Param("startDate") String startDate, @Param("endDate") String endDate);
 
+    JSONObject selectOrderInfoByItemIdsBytedance(@Param("itemIds") List<Long> itemIds, @Param("startDate") Long startDate, @Param("endDate") Long endDate);
+
     List<JSONObject> getMonthOrderAmountByItems(Map<String, Object> map);
 
     JSONObject getMonthOrderAmountTotalByItems(Map<String, Object> map);
@@ -114,4 +122,19 @@ public interface SupplyChainMapper {
     List<JSONObject> bdTotalV2(Map<String, Object> requestMap);
 
     List<JSONObject> bdDetailListV2(Map<String, Object> requestMap);
+
+    JSONObject getMonthOrderAmountTotalBytedance(Map<String, Object> map);
+
+    List<JSONObject> getMonthOrderAmountByItemsBytedance(Map<String, Object> map);
+
+    JSONObject getMonthOrderAmountTotalByItemsBytedance(Map<String, Object> map);
+
+    List<JSONObject> getOrderRankRatioListBytedance(Map<String, Object> requestMap);
+
+    List<JSONObject> getOrderRankListBytedance(Map<String, Object> requestMap);
+
+    List<JSONObject> getPromoterRankRatioListBytedance(Map<String, Object> requestMap);
+
+    List<JSONObject> getPromoterRatioListBytedance(Map<String, Object> requestMap);
+
 }

+ 3 - 3
ruixuan-live/src/main/java/com/ruixuan/isc/service/IKuaishouItemCollectSamplesService.java

@@ -90,15 +90,15 @@ public interface IKuaishouItemCollectSamplesService {
 
     JSONObject getCollectSampleInfo(Long itemId);
 
-    JSONObject getCopyInfo(String  promoterId);
+    JSONObject getCopyInfo(String promoterId);
 
     Long getItemIdById(Long id);
 
     JSONObject getPersonalInfo(Long userId, String type);
 
-    JSONObject getOrderData(Long userId, String startDate, String endDate, String type);
+    JSONObject getOrderData(Long userId, String startDate, String endDate, String type, String mediaId);
 
-    JSONObject getDataAnalysis(Long userId, String startDate, String endDate, String type);
+    JSONObject getDataAnalysis(Long userId, String startDate, String endDate, String type, String mediaId);
 
     List<JSONObject> queryProductList(Map<String, Object> map);
 

+ 2 - 2
ruixuan-live/src/main/java/com/ruixuan/isc/service/IKuaishouPromoterService.java

@@ -58,9 +58,9 @@ public interface IKuaishouPromoterService {
 
     KuaishouPromoter getOnlyPromoterInfo(String promoterId);
 
-    List<String> selectPromoterIdList(List<Long> userList);
+    List<String> selectPromoterIdList(List<Long> userList, String mediaId);
 
-    JSONObject getgetMonthPromoterTotal(List<Long> userList, String start, String end);
+    JSONObject getgetMonthPromoterTotal(List<Long> userList, String start, String end, String mediaId);
 
     List<JSONObject> selectKuaishouPromoterList2(Long userId, String promoterId, String promoterNickName, String status, String parameter, String orderBy);
 

+ 22 - 0
ruixuan-live/src/main/java/com/ruixuan/isc/service/ISupplyChainService.java

@@ -100,6 +100,8 @@ public interface ISupplyChainService {
 
     JSONObject selectOrderRate(List<String> promoterIds, List<Long> itemIds, Long statDate, Long endDate);
 
+    JSONObject selectOrderRateBytedance(List<String> promoterIds, List<Long> itemIds, Long startHourTemp, Long endHourTemp);
+
     List<JSONObject> getMonthOrderAmount(Map<String, Object> map);
 
     JSONObject getMonthOrderAmountTotal(Map<String, Object> map);
@@ -136,4 +138,24 @@ public interface ISupplyChainService {
     List<JSONObject> bdTotalV2(Map<String, Object> requestMap);
 
     List<JSONObject> bdDetailListV2(Map<String, Object> requestMap);
+
+    JSONObject selectOrderInfoByItemIdsBytedance(List<Long> itemIds, Long startDate, Long endDate);
+
+    List<JSONObject> getMonthOrderAmountBytedance(Map<String, Object> map);
+
+    JSONObject getMonthOrderAmountTotalBytedance(Map<String, Object> map);
+
+    List<JSONObject> getMonthOrderAmountByItemsBytedance(Map<String, Object> map);
+
+    JSONObject getMonthOrderAmountTotalByItemsBytedance(Map<String, Object> map);
+
+    List<JSONObject> getOrderRankRatioListBytedance(Map<String, Object> requestMap);
+
+    List<JSONObject> getOrderRankListBytedance(Map<String, Object> requestMap);
+
+    List<JSONObject> getPromoterRankRatioListBytedance(Map<String, Object> requestMap);
+
+    List<JSONObject> getPromoterRatioListBytedance(Map<String, Object> requestMap);
+
+    JSONObject selectOrderInfoBytedance(List<String> promoterIds, Long startDate, Long endDate);
 }

+ 102 - 50
ruixuan-live/src/main/java/com/ruixuan/isc/service/impl/KuaishouItemCollectSamplesServiceImpl.java

@@ -418,7 +418,7 @@ public class KuaishouItemCollectSamplesServiceImpl implements IKuaishouItemColle
     }
 
     @Override
-    public JSONObject getOrderData(Long userId, String startDate, String endDate, String type) {
+    public JSONObject getOrderData(Long userId, String startDate, String endDate, String type, String mediaId) {
         String roleKey = userService.getRoleKeyByUserId(userId);
         List<Long> userList = null;
         if ("courtshipManager".equals(roleKey) || "bdManager".equals(roleKey)) {
@@ -435,24 +435,34 @@ public class KuaishouItemCollectSamplesServiceImpl implements IKuaishouItemColle
         returnJson.put("code", 0);
         returnJson.put("message", "调用成功");
         if ("1".equals(type)) {
-            returnJson.put("data", getOrderDataByChannel(userList, startDate, endDate));
+            returnJson.put("data", getOrderDataByChannel(userList, startDate, endDate, mediaId));
         } else {
-            returnJson.put("data", getOrderDataByAttractInvestment(userList, startDate, endDate));
+            returnJson.put("data", getOrderDataByAttractInvestment(userList, startDate, endDate, mediaId));
         }
         return returnJson;
     }
 
     //渠道数据
-    private JSONObject getOrderDataByChannel(List<Long> userList, String startDate, String endDate) {
+    private JSONObject getOrderDataByChannel(List<Long> userList, String startDate, String endDate, String mediaId) {
         JSONObject data = new JSONObject();
         List<String> promoterIds = null;
         if (Check.isNotNull(userList)) {
-            promoterIds = promoterService.selectPromoterIdList(userList);
+            promoterIds = promoterService.selectPromoterIdList(userList, mediaId);
+        }
+        if (Check.isNull(promoterIds)) {
+            return data;
+        }
+        JSONObject sample = kuaishouItemCollectSamplesMapper.queryTheNumberOfCompletedJobs(promoterIds, startDate, endDate, mediaId);
+
+        data.put("completeCount", sample.getInteger("completeCount"));//完成作业数
+        data.put("completeRate", sample.getString("completeRate"));//合格作业率
+        JSONObject order = new JSONObject();
+
+        if ("1".equals(mediaId)) {
+            order = supplyChainService.selectOrderInfoBytedance(promoterIds, DateUtils.strDateToInt(startDate), DateUtils.strDateToInt(endDate));
+        } else {
+            order = supplyChainService.selectOrderInfo(promoterIds, startDate, endDate);
         }
-        JSONObject Sample = kuaishouItemCollectSamplesMapper.queryTheNumberOfCompletedJobs(promoterIds, startDate, endDate);
-        data.put("completeCount", Sample.getInteger("completeCount"));//完成作业数
-        data.put("completeRate", Sample.getString("completeRate"));//合格作业率
-        JSONObject order = supplyChainService.selectOrderInfo(promoterIds, startDate, endDate);
         data.put("allNumber", order.getInteger("allNumber"));//订单总数
         data.put("promoterCount", order.getInteger("promoterCount"));//达人总数
         data.put("validOrderNUm", order.getInteger("validOrderNUm"));//有效订单数
@@ -472,13 +482,13 @@ public class KuaishouItemCollectSamplesServiceImpl implements IKuaishouItemColle
         String todayOfLastWeek = DateUtils.getSubtractTime(date, 7);
 
         //当天数据
-        JSONObject toData = getOrderRate(today, today, hour, promoterIds, null);
+        JSONObject toData = getOrderRate(today, today, hour, promoterIds, null, mediaId);
 
         //昨日数据
-        JSONObject yesData = getOrderRate(yesterday, yesterday, hour, promoterIds, null);
+        JSONObject yesData = getOrderRate(yesterday, yesterday, hour, promoterIds, null, mediaId);
 
         //上周当日数据
-        JSONObject weeklyDayData = getOrderRate(todayOfLastWeek, todayOfLastWeek, hour, promoterIds, null);
+        JSONObject weeklyDayData = getOrderRate(todayOfLastWeek, todayOfLastWeek, hour, promoterIds, null, mediaId);
 
         //日环比 (今天-昨天)/昨天*100%
         data.put("dateOrderRate", getOrderRateValue(toData, yesData));
@@ -494,30 +504,30 @@ public class KuaishouItemCollectSamplesServiceImpl implements IKuaishouItemColle
             //当前近七天的开始日期
             String start = DateUtils.getSubtractTime(date, 6);
             //当前近七天的数据
-            inDayData = getOrderRate(start, today, hour, promoterIds, null);
+            inDayData = getOrderRate(start, today, hour, promoterIds, null, mediaId);
             //上个近七天的开始日期
             String lastStart = DateUtils.getSubtractTime(date, 13);
             //上个近七天的数据
-            lastDayData = getOrderRate(lastStart, todayOfLastWeek, hour, promoterIds, null);
+            lastDayData = getOrderRate(lastStart, todayOfLastWeek, hour, promoterIds, null, mediaId);
         } else if (startDate.equals(endDate) && !startDate.equals(today)) {
             // startDate 环比 startDate的前一天
-            inDayData = getOrderRate(startDate, startDate, 23, promoterIds, null);
+            inDayData = getOrderRate(startDate, startDate, 23, promoterIds, null, mediaId);
             // startDate -1
             String lastDay = DateUtils.getSubtractTime(DateUtils.parseDate(startDate), 1);
-            lastDayData = getOrderRate(lastDay, lastDay, 23, promoterIds, null);
+            lastDayData = getOrderRate(lastDay, lastDay, 23, promoterIds, null, mediaId);
         } else if (!startDate.equals(endDate) && !endDate.equals(today)) {
             // startDate 环比 startDate的前一天
-            inDayData = getOrderRate(startDate, endDate, 23, promoterIds, null);
+            inDayData = getOrderRate(startDate, endDate, 23, promoterIds, null, mediaId);
             int days = DateUtils.differentDaysByMillisecond(DateUtils.parseDate(startDate), DateUtils.parseDate(endDate)) + 1;
             String lastStart = DateUtils.getSubtractTime(DateUtils.parseDate(startDate), days);
             String lastEnd = DateUtils.getSubtractTime(DateUtils.parseDate(endDate), days);
-            lastDayData = getOrderRate(lastStart, lastEnd, 23, promoterIds, null);
+            lastDayData = getOrderRate(lastStart, lastEnd, 23, promoterIds, null, mediaId);
         } else {
-            inDayData = getOrderRate(startDate, endDate, hour, promoterIds, null);
+            inDayData = getOrderRate(startDate, endDate, hour, promoterIds, null, mediaId);
             int days = DateUtils.differentDaysByMillisecond(DateUtils.parseDate(startDate), DateUtils.parseDate(endDate)) + 1;
             String lastStart = DateUtils.getSubtractTime(DateUtils.parseDate(startDate), days);
             String lastEnd = DateUtils.getSubtractTime(DateUtils.parseDate(endDate), days);
-            lastDayData = getOrderRate(lastStart, lastEnd, hour, promoterIds, null);
+            lastDayData = getOrderRate(lastStart, lastEnd, hour, promoterIds, null, mediaId);
         }
         //数据对比
         data.put("dataOrderRate", getOrderRateValue(inDayData, lastDayData));
@@ -525,10 +535,17 @@ public class KuaishouItemCollectSamplesServiceImpl implements IKuaishouItemColle
         return data;
     }
 
-    private JSONObject getOrderRate(String startDate, String endDate, int hour, List<String> promoterIds, List<Long> itemIds) {
-        Long startHourTemp = DateUtils.getStartLongTime(startDate); // startDate开始时间戳
-        Long endHourTemp = DateUtils.getNowEndHourTemp(endDate, hour); // endDate结束时间戳
-        return supplyChainService.selectOrderRate(promoterIds, itemIds, startHourTemp, endHourTemp);
+    private JSONObject getOrderRate(String startDate, String endDate, int hour, List<String> promoterIds, List<Long> itemIds, String mediaId) {
+        if ("1".equals(mediaId)) {
+            Long startHourTemp = DateUtils.strDateToInt(startDate);
+            Long endHourTemp = DateUtils.strDateToInt(endDate);
+            return supplyChainService.selectOrderRateBytedance(promoterIds, itemIds, startHourTemp, endHourTemp);
+        } else if ("2".equals(mediaId)) {
+            Long startHourTemp = DateUtils.getStartLongTime(startDate); // startDate开始时间戳
+            Long endHourTemp = DateUtils.getNowEndHourTemp(endDate, hour); // endDate结束时间戳
+            return supplyChainService.selectOrderRate(promoterIds, itemIds, startHourTemp, endHourTemp);
+        }
+        return null;
     }
 
     private BigDecimal getOrderRateValue(JSONObject toData, JSONObject yesData) {
@@ -550,12 +567,19 @@ public class KuaishouItemCollectSamplesServiceImpl implements IKuaishouItemColle
     }
 
     //招商数据
-    private JSONObject getOrderDataByAttractInvestment(List<Long> userList, String startDate, String endDate) {
+    private JSONObject getOrderDataByAttractInvestment(List<Long> userList, String startDate, String endDate, String mediaId) {
         JSONObject data = new JSONObject();
         //查询登录人(创建人)的所有商品
-        List<Long> itemIds = kuaishouItemCollectSamplesMapper.getItemIdsByCreateId(userList);
+        List<Long> itemIds = kuaishouItemCollectSamplesMapper.getItemIdsByCreateId(userList, mediaId);
         if (Check.isNotNull(itemIds)) {
-            JSONObject order = supplyChainService.selectOrderInfoByItemIds(itemIds, startDate, endDate);
+            JSONObject order = null;
+            if ("1".equals(mediaId)) {
+                Long startHourTemp = DateUtils.strDateToInt(startDate);
+                Long endHourTemp = DateUtils.strDateToInt(endDate);
+                order = supplyChainService.selectOrderInfoByItemIdsBytedance(itemIds, startHourTemp, endHourTemp);
+            } else {
+                order = supplyChainService.selectOrderInfoByItemIds(itemIds, startDate, endDate);
+            }
             data.put("sendCount", order.getInteger("sendCount"));//发货数
             data.put("sendRate", order.getString("sendRate"));//订单发货率
             data.put("allNumber", order.getInteger("allNumber"));//订单总数
@@ -577,13 +601,13 @@ public class KuaishouItemCollectSamplesServiceImpl implements IKuaishouItemColle
             String todayOfLastWeek = DateUtils.getSubtractTime(date, 7);
 
             //当天数据
-            JSONObject toData = getOrderRate(today, today, hour, null, itemIds);
+            JSONObject toData = getOrderRate(today, today, hour, null, itemIds, mediaId);
 
             //昨日数据
-            JSONObject yesData = getOrderRate(yesterday, yesterday, hour, null, itemIds);
+            JSONObject yesData = getOrderRate(yesterday, yesterday, hour, null, itemIds, mediaId);
 
             //上周当日数据
-            JSONObject weeklyDayData = getOrderRate(todayOfLastWeek, todayOfLastWeek, hour, null, itemIds);
+            JSONObject weeklyDayData = getOrderRate(todayOfLastWeek, todayOfLastWeek, hour, null, itemIds, mediaId);
 
             //日环比 (今天-昨天)/昨天*100%
             data.put("dateOrderRate", getOrderRateValue(toData, yesData));
@@ -598,30 +622,30 @@ public class KuaishouItemCollectSamplesServiceImpl implements IKuaishouItemColle
             if (startDate.equals(endDate) && startDate.equals(today)) {
                 String start = DateUtils.getSubtractTime(date, 6); //当前近七天的开始日期
                 //当前近七天的数据
-                inDayData = getOrderRate(start, today, hour, null, itemIds);
+                inDayData = getOrderRate(start, today, hour, null, itemIds, mediaId);
 
                 String lastStart = DateUtils.getSubtractTime(date, 13); //上个近七天的开始日期
                 //上个近七天的数据
-                lastDayData = getOrderRate(lastStart, todayOfLastWeek, hour, null, itemIds);
+                lastDayData = getOrderRate(lastStart, todayOfLastWeek, hour, null, itemIds, mediaId);
             } else if (startDate.equals(endDate) && !startDate.equals(today)) {
                 // startDate 环比 startDate的前一天
-                inDayData = getOrderRate(startDate, startDate, 23, null, itemIds);
+                inDayData = getOrderRate(startDate, startDate, 23, null, itemIds, mediaId);
                 // startDate -1
                 String lastDay = DateUtils.getSubtractTime(DateUtils.parseDate(startDate), 1);
-                lastDayData = getOrderRate(lastDay, lastDay, 23, null, itemIds);
+                lastDayData = getOrderRate(lastDay, lastDay, 23, null, itemIds, mediaId);
             } else if (!startDate.equals(endDate) && !endDate.equals(today)) {
                 // startDate 环比 startDate的前一天
-                inDayData = getOrderRate(startDate, endDate, 23, null, itemIds);
+                inDayData = getOrderRate(startDate, endDate, 23, null, itemIds, mediaId);
                 int days = DateUtils.differentDaysByMillisecond(DateUtils.parseDate(startDate), DateUtils.parseDate(endDate)) + 1;
                 String lastStart = DateUtils.getSubtractTime(DateUtils.parseDate(startDate), days);
                 String lastEnd = DateUtils.getSubtractTime(DateUtils.parseDate(endDate), days);
-                lastDayData = getOrderRate(lastStart, lastEnd, 23, null, itemIds);
+                lastDayData = getOrderRate(lastStart, lastEnd, 23, null, itemIds, mediaId);
             } else {
-                inDayData = getOrderRate(startDate, endDate, hour, null, itemIds);
+                inDayData = getOrderRate(startDate, endDate, hour, null, itemIds, mediaId);
                 int days = DateUtils.differentDaysByMillisecond(DateUtils.parseDate(startDate), DateUtils.parseDate(endDate)) + 1;
                 String lastStart = DateUtils.getSubtractTime(DateUtils.parseDate(startDate), days);
                 String lastEnd = DateUtils.getSubtractTime(DateUtils.parseDate(endDate), days);
-                lastDayData = getOrderRate(lastStart, lastEnd, hour, null, itemIds);
+                lastDayData = getOrderRate(lastStart, lastEnd, hour, null, itemIds, mediaId);
             }
             //数据对比
             data.put("dataOrderRate", getOrderRateValue(inDayData, lastDayData));
@@ -631,7 +655,7 @@ public class KuaishouItemCollectSamplesServiceImpl implements IKuaishouItemColle
     }
 
     @Override
-    public JSONObject getDataAnalysis(Long userId, String startDate, String endDate, String type) {
+    public JSONObject getDataAnalysis(Long userId, String startDate, String endDate, String type, String mediaId) {
         String roleKey = userService.getRoleKeyByUserId(userId);
         List<Long> userList = null;
         if ("courtshipManager".equals(roleKey) || "bdManager".equals(roleKey)) {
@@ -648,9 +672,9 @@ public class KuaishouItemCollectSamplesServiceImpl implements IKuaishouItemColle
         returnJson.put("code", 0);
         returnJson.put("message", "调用成功");
         if ("1".equals(type)) {
-            returnJson.put("data", getDataAnalysisByChannel(userList, startDate, endDate));
+            returnJson.put("data", getDataAnalysisByChannel(userList, startDate, endDate, mediaId));
         } else {
-            returnJson.put("data", getDataAnalysisByAttractInvestment(userList, startDate, endDate));
+            returnJson.put("data", getDataAnalysisByAttractInvestment(userList, startDate, endDate, mediaId));
         }
         return returnJson;
     }
@@ -690,11 +714,14 @@ public class KuaishouItemCollectSamplesServiceImpl implements IKuaishouItemColle
     }
 
     // 渠道—数据分析
-    private JSONObject getDataAnalysisByChannel(List<Long> userList, String startDate, String endDate) {
+    private JSONObject getDataAnalysisByChannel(List<Long> userList, String startDate, String endDate, String mediaId) {
         JSONObject data = new JSONObject();
         List<String> promoterIds = null;
         if (Check.isNotNull(userList)) {
-            promoterIds = promoterService.selectPromoterIdList(userList);
+            promoterIds = promoterService.selectPromoterIdList(userList, mediaId);
+        }
+        if (Check.isNull(promoterIds)) {
+            return data;
         }
         if (Check.isNull(startDate) && Check.isNull(endDate)) {
             //当前月份第一天
@@ -709,7 +736,13 @@ public class KuaishouItemCollectSamplesServiceImpl implements IKuaishouItemColle
         map.put("promoterIds", promoterIds);
         map.put("startLong", DateUtils.getStartLongTime(startDate));
         map.put("endLong", DateUtils.getEndLongTime(endDate));
-        List<JSONObject> list = supplyChainService.getMonthOrderAmount(map);
+        List<JSONObject> list = null;
+        if ("1".equals(mediaId)) {
+            list = supplyChainService.getMonthOrderAmountBytedance(map);
+        } else {
+            list = supplyChainService.getMonthOrderAmount(map);
+        }
+
         List<String> allDates = DateUtils.getAllDatesOfTwoTimes(startDate, endDate);
         if (Check.isNull(list) || list.size() != allDates.size()) {
             String orderAmountStr = JSONObject.toJSONString(list);
@@ -735,14 +768,20 @@ public class KuaishouItemCollectSamplesServiceImpl implements IKuaishouItemColle
         });
         data.put("list", list);
         map.put("toStartLong", DateUtils.getStartLongTime(endDate));
-        JSONObject amount = supplyChainService.getMonthOrderAmountTotal(map);
+        JSONObject amount = null;
+        if ("1".equals(mediaId)) {
+            amount = supplyChainService.getMonthOrderAmountTotalBytedance(map);
+        } else {
+            amount = supplyChainService.getMonthOrderAmountTotal(map);
+        }
+
         if (Check.isNotNull(amount)) {
             data.put("orderAmount", amount.getInteger("orderAmount"));
             data.put("regimentalPromotionAmount", amount.getInteger("regimentalPromotionAmount"));
             data.put("orderAmountRate", amount.getString("orderAmountRate"));
             data.put("regimentalPromotionAmountRate", amount.getString("regimentalPromotionAmountRate"));
         }
-        JSONObject promoter = promoterService.getgetMonthPromoterTotal(userList, startDate, endDate);
+        JSONObject promoter = promoterService.getgetMonthPromoterTotal(userList, startDate, endDate, mediaId);
         if (Check.isNotNull(promoter)) {
             data.put("promoterCount", promoter.getString("count"));
             data.put("promoterRate", promoter.getString("rate"));
@@ -751,10 +790,10 @@ public class KuaishouItemCollectSamplesServiceImpl implements IKuaishouItemColle
     }
 
     // 招商—数据分析
-    private JSONObject getDataAnalysisByAttractInvestment(List<Long> userList, String startDate, String endDate) {
+    private JSONObject getDataAnalysisByAttractInvestment(List<Long> userList, String startDate, String endDate, String mediaId) {
         JSONObject data = new JSONObject();
         //查询登录人(创建人)的所有商品
-        List<Long> itemIds = kuaishouItemCollectSamplesMapper.getItemIdsByCreateId(userList);
+        List<Long> itemIds = kuaishouItemCollectSamplesMapper.getItemIdsByCreateId(userList, mediaId);
         if (Check.isNotNull(itemIds)) {
             if (Check.isNull(startDate) && Check.isNull(endDate)) {
                 //当前月份第一天
@@ -766,10 +805,18 @@ public class KuaishouItemCollectSamplesServiceImpl implements IKuaishouItemColle
             map.put("start", startDate);
             map.put("end", endDate);
             map.put("itemIds", itemIds);
+            map.put("IntStart", DateUtils.strDateToInt(startDate));
+            map.put("IntEnd", DateUtils.strDateToInt(endDate));
             map.put("startLong", DateUtils.getStartLongTime(startDate));
             map.put("toStartLong", DateUtils.getStartLongTime(endDate));
             map.put("endLong", DateUtils.getEndLongTime(endDate));
-            List<JSONObject> list = supplyChainService.getMonthOrderAmountByItems(map);
+            List<JSONObject> list = null;
+            if ("1".equals(mediaId)) {
+                list = supplyChainService.getMonthOrderAmountByItemsBytedance(map);
+            } else {
+                list = supplyChainService.getMonthOrderAmountByItems(map);
+                ;
+            }
             List<String> allDates = DateUtils.getAllDatesOfTwoTimes(startDate, endDate);
             if (Check.isNull(list) || list.size() != allDates.size()) {
                 String orderAmountStr = JSONObject.toJSONString(list);
@@ -793,7 +840,12 @@ public class KuaishouItemCollectSamplesServiceImpl implements IKuaishouItemColle
                 }
             });
             data.put("list", list);
-            JSONObject amount = supplyChainService.getMonthOrderAmountTotalByItems(map);
+            JSONObject amount = null;
+            if ("1".equals(mediaId)) {
+                amount = supplyChainService.getMonthOrderAmountTotalByItemsBytedance(map);
+            } else {
+                amount = supplyChainService.getMonthOrderAmountTotalByItems(map);
+            }
             if (Check.isNotNull(amount)) {
                 data.put("orderAmount", amount.getInteger("orderAmount"));
                 data.put("regimentalPromotionAmount", amount.getInteger("regimentalPromotionAmount"));

+ 4 - 4
ruixuan-live/src/main/java/com/ruixuan/isc/service/impl/KuaishouPromoterServiceImpl.java

@@ -500,13 +500,13 @@ public class KuaishouPromoterServiceImpl implements IKuaishouPromoterService {
     }
 
     @Override
-    public List<String> selectPromoterIdList(List<Long> userList) {
-        return kuaishouPromoterMapper.selectPromoterIdList(userList);
+    public List<String> selectPromoterIdList(List<Long> userList,String mediaId) {
+        return kuaishouPromoterMapper.selectPromoterIdList(userList,mediaId);
     }
 
     @Override
-    public JSONObject getgetMonthPromoterTotal(List<Long> userList, String start, String end) {
-        return kuaishouPromoterMapper.getgetMonthPromoterTotal(userList, start, end);
+    public JSONObject getgetMonthPromoterTotal(List<Long> userList, String start, String end,String mediaId) {
+        return kuaishouPromoterMapper.getgetMonthPromoterTotal(userList, start, end,mediaId);
     }
 
     /**

+ 56 - 0
ruixuan-live/src/main/java/com/ruixuan/isc/service/impl/SupplyChainServiceImpl.java

@@ -216,11 +216,61 @@ public class SupplyChainServiceImpl implements ISupplyChainService {
     }
 
     @Override
+    public JSONObject selectOrderRateBytedance(List<String> promoterIds, List<Long> itemIds, Long statDate, Long endDate) {
+        return supplyChainMapper.selectOrderRateBytedance(promoterIds, itemIds, statDate, endDate);
+    }
+
+    @Override
     public List<JSONObject> getMonthOrderAmount(Map<String, Object> map) {
         return supplyChainMapper.getMonthOrderAmount(map);
     }
 
     @Override
+    public List<JSONObject> getMonthOrderAmountBytedance(Map<String, Object> map) {
+        return supplyChainMapper.getMonthOrderAmountBytedance(map);
+    }
+
+    @Override
+    public JSONObject getMonthOrderAmountTotalBytedance(Map<String, Object> map) {
+        return supplyChainMapper.getMonthOrderAmountTotalBytedance(map);
+    }
+
+    @Override
+    public List<JSONObject> getMonthOrderAmountByItemsBytedance(Map<String, Object> map) {
+        return supplyChainMapper.getMonthOrderAmountByItemsBytedance(map);
+    }
+
+    @Override
+    public JSONObject getMonthOrderAmountTotalByItemsBytedance(Map<String, Object> map) {
+        return supplyChainMapper.getMonthOrderAmountTotalByItemsBytedance(map);
+    }
+
+    @Override
+    public List<JSONObject> getOrderRankRatioListBytedance(Map<String, Object> requestMap) {
+        return supplyChainMapper.getOrderRankRatioListBytedance(requestMap);
+    }
+
+    @Override
+    public List<JSONObject> getOrderRankListBytedance(Map<String, Object> requestMap) {
+        return supplyChainMapper.getOrderRankListBytedance(requestMap);
+    }
+
+    @Override
+    public List<JSONObject> getPromoterRankRatioListBytedance(Map<String, Object> requestMap) {
+        return supplyChainMapper.getPromoterRankRatioListBytedance(requestMap);
+    }
+
+    @Override
+    public List<JSONObject> getPromoterRatioListBytedance(Map<String, Object> requestMap) {
+        return supplyChainMapper.getPromoterRatioListBytedance(requestMap);
+    }
+
+    @Override
+    public JSONObject selectOrderInfoBytedance(List<String> promoterIds, Long startDate, Long endDate) {
+        return supplyChainMapper.selectOrderInfoBytedance(promoterIds, startDate, endDate);
+    }
+
+    @Override
     public JSONObject getMonthOrderAmountTotal(Map<String, Object> map) {
         return supplyChainMapper.getMonthOrderAmountTotal(map);
     }
@@ -304,4 +354,10 @@ public class SupplyChainServiceImpl implements ISupplyChainService {
     public List<JSONObject> bdDetailListV2(Map<String, Object> requestMap) {
         return supplyChainMapper.bdDetailListV2(requestMap);
     }
+
+    @Override
+    public JSONObject selectOrderInfoByItemIdsBytedance(List<Long> itemIds, Long startDate, Long endDate) {
+        return supplyChainMapper.selectOrderInfoByItemIdsBytedance(itemIds, startDate, endDate);
+    }
+
 }

+ 5 - 0
ruixuan-live/src/main/resources/mapper/isc/KuaishouItemCollectSamplesMapper.xml

@@ -603,6 +603,7 @@
         WHERE DATE_FORMAT(create_time, '%Y-%m-%d') >= #{startDate}
         AND DATE_FORMAT(create_time, '%Y-%m-%d') &lt;= #{endDate}
         AND collect_sample_status = 7
+        AND media_id =#{mediaId}
         <if test="promoterIds != null and promoterIds.size() > 0 ">
             AND promoter_id in
             <foreach collection="promoterIds" item="item" separator=","
@@ -616,6 +617,7 @@
         FROM kuaishou_item_collect_samples
         WHERE DATE_FORMAT(create_time, '%Y-%m-%d') >= #{startDate}
         AND DATE_FORMAT(create_time, '%Y-%m-%d') &lt;= #{endDate}
+        AND media_id =#{mediaId}
         <if test="promoterIds != null and promoterIds.size() > 0 ">
             AND promoter_id in
             <foreach collection="promoterIds" item="item" separator=","
@@ -647,6 +649,9 @@
                     #{item}
                 </foreach>
             </if>
+            <if test="mediaId != null and mediaId !='' ">
+                AND media_id =#{mediaId}
+            </if>
         </where>
     </select>
 

+ 5 - 0
ruixuan-live/src/main/resources/mapper/isc/KuaishouPromoterMapper.xml

@@ -230,6 +230,9 @@
                     #{item}
                 </foreach>
             </if>
+            <if test="mediaId != null ">
+                AND media_id =#{mediaId}
+            </if>
         </where>
     </select>
 
@@ -252,6 +255,7 @@
         FROM kuaishou_promoter
         WHERE DATE_FORMAT(create_time, '%Y-%m-%d') >= #{start}
         AND DATE_FORMAT(create_time, '%Y-%m-%d') &lt;= #{end}
+        AND media_id = #{mediaId}
         <if test="userList != null and userList.size() > 0 ">
             AND user_id in
             <foreach collection="userList" item="item" separator=","
@@ -264,6 +268,7 @@
         (SELECT count(promoter_id) as 'count'
         FROM kuaishou_promoter
         WHERE DATE_FORMAT(create_time, '%Y-%m-%d') = #{end}
+        AND media_id = #{mediaId}
         <if test="userList != null and userList.size() > 0 ">
             AND user_id in
             <foreach collection="userList" item="item" separator=","

+ 337 - 6
ruixuan-live/src/main/resources/mapper/isc/SupplyChainMapper.xml

@@ -229,7 +229,8 @@
         <if test="promoterNickName != null and promoterNickName != ''">
             and promoter_nick_name like concat(concat('%',#{promoterNickName}),'%')
         </if>
-        group by promoter_id) t left join (select promoter_id,group_concat(user_name) as 'userName' from kuaishou_promoter group by promoter_id)  tt
+        group by promoter_id) t left join (select promoter_id,group_concat(user_name) as 'userName' from
+        kuaishou_promoter group by promoter_id) tt
         on t.promoterId = tt.promoter_id
         order by t.orderNum desc
     </select>
@@ -408,6 +409,45 @@
         ) t2 on t1.itemId = t2.itemId
         order by t1.orderNum desc
     </select>
+
+    <select id="getOrderRankRatioListBytedance" resultType="com.alibaba.fastjson.JSONObject">
+        select
+        t1.*,
+        round((t1.orderNum - t2.orderNum) / t2.orderNum,4) as 'radio'
+        from (
+        select
+        product_id as 'itemId',
+        product_name as 'itemTitle',
+        product_img as 'imageUrl',
+        count(order_id) as 'orderNum',
+        sum(case when flow_point != 'REFUND' then 1 else 0 end) as 'validOrderNUm',
+        round(sum(case when flow_point != 'REFUND' then 1 else 0 end) / count(order_id),4) as 'validRadio'
+        from bytedance_order_list
+        where 1= 1
+        <if test="nowStartHourTemp != null and nowStartHourTemp != ''">
+            and pay_success_time &gt;= #{nowStartHourTemp}
+        </if>
+        <if test="nowEndHourTemp != null and nowEndHourTemp != ''">
+            and pay_success_time &lt;= #{nowEndHourTemp}
+        </if>
+        group by product_id
+        ) t1
+        left join (select
+        product_id as 'itemId',
+        count(order_id) as 'orderNum'
+        from bytedance_order_list
+        where 1=1
+        <if test="yesterdayStartHourTemp != null and yesterdayStartHourTemp != ''">
+            and pay_success_time &gt;= #{yesterdayStartHourTemp}
+        </if>
+        <if test="yesterdayEndHourTemp != null and yesterdayEndHourTemp != ''">
+            and pay_success_time &lt;= #{yesterdayEndHourTemp}
+        </if>
+        group by product_id
+        ) t2 on t1.itemId = t2.itemId
+        order by t1.orderNum desc
+    </select>
+
     <select id="getOrderRankList" resultType="com.alibaba.fastjson.JSONObject">
         select * from (
         select
@@ -432,6 +472,28 @@
         group by item_id) t
         order by t.orderNum desc
     </select>
+
+    <select id="getOrderRankListBytedance" resultType="com.alibaba.fastjson.JSONObject">
+        select * from (
+        select
+        product_id as 'itemId',
+        product_name as 'itemTitle',
+        product_img as 'imageUrl',
+        count(order_id) as 'orderNum',
+        sum(case when flow_point != 'REFUND' then 1 else 0 end) as 'validOrderNUm',
+        round(sum(case when flow_point != 'REFUND' then 1 else 0 end) / count(order_id),4) as 'validRadio'
+        from bytedance_order_list
+        where 1= 1
+        <if test="start != null and start != ''">
+            and pay_success_time &gt;= #{start}
+        </if>
+        <if test="end != null and end != ''">
+            and pay_success_time &lt;= #{end}
+        </if>
+        group by product_id) t
+        order by t.orderNum desc
+    </select>
+
     <select id="getPromoterRankRatioList" resultType="com.alibaba.fastjson.JSONObject">
         select
         t1.*,
@@ -482,6 +544,59 @@
         ) t2 on t1.promoterId = t2.promoterId
         order by t1.orderNum desc
     </select>
+
+    <select id="getPromoterRankRatioListBytedance" resultType="com.alibaba.fastjson.JSONObject">
+        select
+        t1.*,
+        round((t1.orderNum - t2.orderNum) / t2.orderNum,4) as 'radio'
+        from (
+        select
+        author_short_id as 'promoterId',
+        author_account as 'promoterNickName',
+        count(order_id) as 'orderNum',
+        sum(case when flow_point != 'REFUND'  then 1 else 0 end) as 'validOrderNUm',
+        round(sum(case when flow_point != 'REFUND'  then 1 else 0 end) / count(order_id),4) as 'validRadio'
+        from bytedance_order_list
+        where 1= 1
+        <if test='promoterIds != null and promoterIds.size() > 0'>
+            AND author_short_id IN
+            <foreach collection="promoterIds" item="item" separator=","
+                     open="(" close=")">
+                #{item}
+            </foreach>
+        </if>
+        <if test="nowStartHourTemp != null and nowStartHourTemp != ''">
+            and pay_success_time &gt;= #{nowStartHourTemp}
+        </if>
+        <if test="nowEndHourTemp != null and nowEndHourTemp != ''">
+            and pay_success_time &lt;= #{nowEndHourTemp}
+        </if>
+        group by author_short_id
+        ) t1
+        left join (
+        select
+        author_short_id as 'promoterId',
+        count(order_id) as 'orderNum'
+        from bytedance_order_list
+        where 1=1
+        <if test='promoterIds != null and promoterIds.size() > 0'>
+            AND author_short_id IN
+            <foreach collection="promoterIds" item="item" separator=","
+                     open="(" close=")">
+                #{item}
+            </foreach>
+        </if>
+        <if test="yesterdayStartHourTemp != null and yesterdayStartHourTemp != ''">
+            and pay_success_time &gt;= #{yesterdayStartHourTemp}
+        </if>
+        <if test="yesterdayEndHourTemp != null and yesterdayEndHourTemp != ''">
+            and pay_success_time &lt;= #{yesterdayEndHourTemp}
+        </if>
+        group by author_short_id
+        ) t2 on t1.promoterId = t2.promoterId
+        order by t1.orderNum desc
+    </select>
+
     <select id="getPromoterRatioList" resultType="com.alibaba.fastjson.JSONObject">
         select * from (
         select
@@ -502,6 +617,26 @@
         order by t.orderNum desc
     </select>
 
+    <select id="getPromoterRatioListBytedance" resultType="com.alibaba.fastjson.JSONObject">
+        select * from (
+        select
+        author_short_id as 'promoterId',
+        author_account as 'promoterNickName',
+        count(order_id) as 'orderNum',
+        sum(case when flow_point != 'REFUND' then 1 else 0 end) as 'validOrderNUm',
+        round(sum(case when flow_point != 'REFUND' then 1 else 0 end) / count(order_id),4) as 'validRadio'
+        from bytedance_order_list
+        where 1= 1
+        <if test="start != null and start != ''">
+            and pay_success_time &gt;= #{start}
+        </if>
+        <if test="end != null and end != ''">
+            and pay_success_time &lt;= #{end}
+        </if>
+        group by author_short_id) t
+        order by t.orderNum desc
+    </select>
+
     <select id="exportPromoterTotal" resultType="com.alibaba.fastjson.JSONObject">
         select *
         from (
@@ -1075,7 +1210,8 @@
     </select>
     <select id="getCookie" resultType="java.lang.String">
         select cookie
-        from ruixuan.kuaishou_supply_chain_cookie where id = #{regId} limit 1
+        from ruixuan.kuaishou_supply_chain_cookie
+        where id = #{regId} limit 1
     </select>
 
     <select id="selectOrderInfo" resultType="com.alibaba.fastjson.JSONObject">
@@ -1099,6 +1235,26 @@
         </if>
     </select>
 
+    <select id="selectOrderInfoBytedance" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT
+        COUNT(DISTINCT author_short_id) as 'promoterCount',
+        COUNT(order_id) as 'allNumber',
+        IFNULL(SUM(CASE WHEN flow_point != 'REFUND' THEN 1 ELSE 0 END), 0) AS 'validOrderNUm',
+        IFNULL(SUM(CASE WHEN flow_point != 'REFUND' THEN total_pay_amount ELSE 0 END), 0) AS 'orderAmount',
+        IFNULL(SUM(CASE WHEN flow_point != 'REFUND' THEN colonel_estimated_commission ELSE 0 END),0) AS
+        'regimentalPromotionAmount'
+        FROM bytedance_order_list
+        WHERE pay_success_time >= #{startDate}
+        AND pay_success_time &lt;= #{endDate}
+        <if test='promoterIds != null and promoterIds.size() > 0'>
+            AND author_short_id in
+            <foreach collection="promoterIds" item="item" separator=","
+                     open="(" close=")">
+                #{item}
+            </foreach>
+        </if>
+    </select>
+
     <select id="selectOrderInfoByItemIds" resultType="com.alibaba.fastjson.JSONObject">
         SELECT t.*,
         CONCAT(IFNULL(ROUND(sendCount / allNumber * 100, 2),0), '%') as 'sendRate'
@@ -1125,6 +1281,26 @@
         ) t
     </select>
 
+    <select id="selectOrderInfoByItemIdsBytedance" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT
+        COUNT(DISTINCT author_short_id) as 'promoterCount',
+        COUNT(order_id) as 'allNumber',
+        IFNULL(SUM(CASE WHEN flow_point != 'REFUND' THEN 1 ELSE 0 END), 0) AS 'validOrderNUm',
+        IFNULL(SUM(CASE WHEN flow_point != 'REFUND' THEN total_pay_amount ELSE 0 END)/100, 0) AS 'orderAmount',
+        IFNULL(SUM(CASE WHEN flow_point != 'REFUND' THEN colonel_estimated_commission ELSE 0 END)/100,0) AS
+        'regimentalPromotionAmount'
+        FROM bytedance_order_list
+        WHERE pay_success_time >= #{startDate}
+        AND pay_success_time &lt;= #{endDate}
+        <if test='itemIds != null and itemIds.size() > 0'>
+            AND product_id in
+            <foreach collection="itemIds" item="item" separator=","
+                     open="(" close=")">
+                #{item}
+            </foreach>
+        </if>
+    </select>
+
     <select id="selectOrderRate" resultType="com.alibaba.fastjson.JSONObject">
         SELECT
         count(oid) as 'allNumber',
@@ -1153,6 +1329,34 @@
         </if>
     </select>
 
+    <select id="selectOrderRateBytedance" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT
+        count(order_id) as 'allNumber',
+        IFNULL(sum(
+        CASE
+        WHEN flow_point != 'REFUND' THEN total_pay_amount
+        ELSE 0
+        END
+        )/100,0) AS 'orderAmount'
+        FROM bytedance_order_list
+        WHERE pay_success_time >= #{statDate}
+        AND pay_success_time &lt;= #{endDate}
+        <if test='promoterIds != null and promoterIds.size() > 0'>
+            AND author_short_id in
+            <foreach collection="promoterIds" item="item" separator=","
+                     open="(" close=")">
+                #{item}
+            </foreach>
+        </if>
+        <if test='itemIds != null and itemIds.size() > 0'>
+            AND product_id in
+            <foreach collection="itemIds" item="item" separator=","
+                     open="(" close=")">
+                #{item}
+            </foreach>
+        </if>
+    </select>
+
 
     <select id="getMonthOrderAmount" resultType="com.alibaba.fastjson.JSONObject">
         SELECT
@@ -1175,6 +1379,27 @@
         GROUP BY FROM_UNIXTIME(order_create_time / 1000, '%Y-%m-%d')
     </select>
 
+    <select id="getMonthOrderAmountBytedance" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT
+        DATE_FORMAT(pay_success_time, '%Y-%m-%d') as 'date',
+        count(1) AS 'orderCount',
+        IFNULL(SUM(CASE WHEN flow_point != 'REFUND' THEN 1 ELSE 0 END), 0) AS 'validOrderCount',
+        IFNULL(SUM(CASE WHEN flow_point != 'REFUND' THEN total_pay_amount ELSE 0 END),0) AS 'orderAmount',
+        IFNULL(SUM(CASE WHEN flow_point != 'REFUND' THEN colonel_estimated_commission ELSE 0 END),0) AS
+        'regimentalPromotionAmount',
+        COUNT(DISTINCT author_short_id) as 'promoterCount'
+        FROM bytedance_order_list
+        WHERE pay_success_time >= #{startLong}
+        AND pay_success_time &lt;= #{endLong}
+        <if test='promoterIds != null and promoterIds.size() > 0'>
+            AND author_short_id in
+            <foreach collection="promoterIds" item="item" separator="," open="(" close=")">
+                #{item}
+            </foreach>
+        </if>
+        GROUP BY pay_success_time
+    </select>
+
     <select id="getMonthOrderAmountByItems" resultType="com.alibaba.fastjson.JSONObject">
         SELECT
         FROM_UNIXTIME(order_create_time / 1000, '%Y-%m-%d') as 'date',
@@ -1196,6 +1421,27 @@
         GROUP BY FROM_UNIXTIME(order_create_time / 1000, '%Y-%m-%d')
     </select>
 
+    <select id="getMonthOrderAmountByItemsBytedance" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT
+        DATE_FORMAT(pay_success_time, '%Y-%m-%d') as 'date',
+        count(1) AS 'orderCount',
+        IFNULL(SUM(CASE WHEN flow_point != 'REFUND' THEN 1 ELSE 0 END), 0) AS 'validOrderCount',
+        IFNULL(SUM(CASE WHEN flow_point != 'REFUND' THEN total_pay_amount ELSE 0 END),0) AS 'orderAmount',
+        IFNULL(SUM(CASE WHEN flow_point != 'REFUND' THEN colonel_estimated_commission ELSE 0 END),0) AS
+        'regimentalPromotionAmount'
+        FROM bytedance_order_list
+        WHERE pay_success_time >= #{startLong}
+        AND pay_success_time &lt;= #{endLong}
+        <if test='itemIds != null and itemIds.size() > 0'>
+            AND product_id in
+            <foreach collection="itemIds" item="item" separator=","
+                     open="(" close=")">
+                #{item}
+            </foreach>
+        </if>
+        GROUP BY pay_success_time
+    </select>
+
     <select id="getMonthOrderAmountTotal" resultType="com.alibaba.fastjson.JSONObject">
         SELECT
         t1.orderAmount,
@@ -1235,6 +1481,45 @@
         AND order_create_time &lt;= #{endLong})t2 ON 1=1
     </select>
 
+    <select id="getMonthOrderAmountTotalBytedance" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT
+        t1.orderAmount,
+        t1.regimentalPromotionAmount,
+        CONCAT(IFNULL(ROUND(t2.orderAmount/t1.orderAmount*100,2),0),'%') as 'orderAmountRate',
+        CONCAT(IFNULL(ROUND(t2.regimentalPromotionAmount/t1.regimentalPromotionAmount*100,2),0),'%') as
+        'regimentalPromotionAmountRate'
+        FROM
+        (
+        SELECT
+        IFNULL(SUM(total_pay_amount),0) AS 'orderAmount',
+        IFNULL(SUM(colonel_estimated_commission),0) AS 'regimentalPromotionAmount'
+        FROM bytedance_order_list t1
+        WHERE flow_point != 'REFUND'
+        <if test='promoterIds != null and promoterIds.size() > 0'>
+            AND author_short_id in
+            <foreach collection="promoterIds" item="item" separator="," open="(" close=")">
+                #{item}
+            </foreach>
+        </if>
+        AND pay_success_time >= #{startLong}
+        AND pay_success_time &lt;= #{endLong}) t1
+        LEFT JOIN
+        (
+        SELECT
+        IFNULL(SUM(total_pay_amount),0) AS 'orderAmount',
+        IFNULL(SUM(colonel_estimated_commission),0) AS 'regimentalPromotionAmount'
+        FROM bytedance_order_list t1
+        WHERE flow_point != 'REFUND'
+        <if test='promoterIds != null and promoterIds.size() > 0'>
+            AND author_short_id in
+            <foreach collection="promoterIds" item="item" separator="," open="(" close=")">
+                #{item}
+            </foreach>
+        </if>
+        AND pay_success_time >= #{toStartLong}
+        AND pay_success_time &lt;= #{endLong})t2 ON 1=1
+    </select>
+
     <select id="getMonthOrderAmountTotalByItems" resultType="com.alibaba.fastjson.JSONObject">
         SELECT
         t1.orderAmount,
@@ -1282,6 +1567,53 @@
         )t2 ON 1=1
     </select>
 
+    <select id="getMonthOrderAmountTotalByItemsBytedance" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT
+        t1.orderAmount,
+        t1.regimentalPromotionAmount,
+        t1.orderCount,
+        CONCAT(IFNULL(ROUND(t2.orderAmount/t1.orderAmount*100,2),0),'%') as 'orderAmountRate',
+        CONCAT(IFNULL(ROUND(t2.orderCount/t1.orderCount*100,2),0),'%') as 'orderCountRate',
+        CONCAT(IFNULL(ROUND(t2.regimentalPromotionAmount/t1.regimentalPromotionAmount*100,2),0),'%') as
+        'regimentalPromotionAmountRate'
+        FROM
+        (
+        SELECT
+        IFNULL(SUM(total_pay_amount),0) AS 'orderAmount',
+        IFNULL(SUM(colonel_estimated_commission),0) AS 'regimentalPromotionAmount',
+        COUNT(order_id) as 'orderCount'
+        FROM bytedance_order_list t1
+        WHERE flow_point != 'REFUND'
+        <if test='itemIds != null and itemIds.size() > 0'>
+            AND product_id in
+            <foreach collection="itemIds" item="item" separator=","
+                     open="(" close=")">
+                #{item}
+            </foreach>
+        </if>
+        AND pay_success_time >= #{IntStart}
+        AND pay_success_time &lt;= #{IntEnd}
+        )t1
+        LEFT JOIN
+        (
+        SELECT
+        IFNULL(SUM(total_pay_amount),0) AS 'orderAmount',
+        IFNULL(SUM(colonel_estimated_commission),0) AS 'regimentalPromotionAmount',
+        COUNT(order_id) as 'orderCount'
+        FROM bytedance_order_list t1
+        WHERE flow_point != 'REFUND'
+        <if test='itemIds != null and itemIds.size() > 0'>
+            AND product_id in
+            <foreach collection="itemIds" item="item" separator=","
+                     open="(" close=")">
+                #{item}
+            </foreach>
+        </if>
+        AND pay_success_time >= #{IntStart}
+        AND pay_success_time &lt;= #{IntEnd}
+        )t2 ON 1=1
+    </select>
+
 
     <select id="bdReportList" resultType="com.alibaba.fastjson.JSONObject">
         select
@@ -1516,10 +1848,9 @@
         GROUP BY promoter_id
     </select>
     <select id="getUserName" resultType="java.lang.String" parameterType="java.lang.Long">
-        select
-        group_concat(user_name)  as 'userName'
+        select group_concat(user_name) as 'userName'
         from kuaishou_promoter
-        where   promoter_id  = #{promoterId}
+        where promoter_id = #{promoterId}
 
     </select>
     <select id="exportBdReportList" resultType="com.alibaba.fastjson.JSONObject">
@@ -1654,7 +1985,7 @@
         order by t.orderNum desc
     </select>
     <select id="getSupplyChainCourtshipUserList" resultType="com.alibaba.fastjson.JSONObject">
-         select t3.user_id as 'userId', t3.nick_name as 'nickMame', t1.role_name as 'roleName', t3.status
+        select t3.user_id as 'userId', t3.nick_name as 'nickMame', t1.role_name as 'roleName', t3.status
         from sys_role t1
                  left join sys_user_role t2 on t1.role_id = t2.role_id
                  left join sys_user t3 on t2.user_id = t3.user_id