Browse Source

供应链数据

yumeng 2 years ago
parent
commit
0edd3f6280

+ 58 - 1
ruixuan-common/src/main/java/com/ruixuan/common/utils/DateUtils.java

@@ -277,7 +277,7 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
     /**
      * 时间戳转换为字符串
      *
-     * @param time
+     * @param
      * @return
      */
     public static String timestamptoStr(Long timestamp) {
@@ -286,4 +286,61 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
         return DateFormatUtils.format(date, YYYYMMDD);
     }
 
+    public static Long getStartLongTime(String orderStartDate) {
+        String date = orderStartDate + " 00:00:00";
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        Long orderCreateTimeStart = null;
+        try {
+            orderCreateTimeStart = sdf.parse(date).getTime();
+        } catch (ParseException e) {
+            e.printStackTrace();
+        }
+        return orderCreateTimeStart;
+    }
+
+    public static Long getEndLongTime(String orderEndDate) {
+        String date = orderEndDate + " 23:60:00";
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        Long orderCreateTimeEnd = null;
+        try {
+            orderCreateTimeEnd = sdf.parse(date).getTime();
+        } catch (ParseException e) {
+            e.printStackTrace();
+        }
+        return orderCreateTimeEnd;
+    }
+
+    public static Integer getNowHour() {
+        Calendar cal = Calendar.getInstance();
+        Date date = new Date();
+        cal.setTime(date);
+        return cal.get(Calendar.HOUR_OF_DAY);
+    }
+
+    public static String getAnotherDay(String format, String date, Integer num) {
+        SimpleDateFormat sdf = new SimpleDateFormat(format);
+        Date getDate = null;
+        try {
+            getDate = sdf.parse(date);
+        } catch (ParseException e) {
+            e.printStackTrace();
+        }
+        Calendar calendar = Calendar.getInstance();
+        calendar.setTime(getDate);
+        calendar.add(Calendar.DAY_OF_MONTH, num);
+        Date resultDate = calendar.getTime();
+        return sdf.format(resultDate);
+    }
+
+    public static Long getNowEndHourTemp(String dateStr, Integer hour) {
+        String date = dateStr + " " + hour + ":60:00";
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        Long orderCreateTimeEnd = null;
+        try {
+            orderCreateTimeEnd = sdf.parse(date).getTime();
+        } catch (ParseException e) {
+            e.printStackTrace();
+        }
+        return orderCreateTimeEnd;
+    }
 }

+ 1 - 1
ruixuan-framework/src/main/java/com/ruixuan/framework/config/SecurityConfig.java

@@ -121,7 +121,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter
                     .antMatchers("/system/user/getUserRoleByUserId").permitAll()
                     .antMatchers("/system/user/getUserByRoleName").permitAll()
                     .antMatchers("/system/industry/**").permitAll()
-
+                    .antMatchers("/isv/supply_chain/*").permitAll()
                 // 除上面外的所有请求全部需要鉴权认证
                 .anyRequest().authenticated()
                 .and()

+ 559 - 0
ruixuan-live/src/main/java/com/ruixuan/isc/controller/SupplyChainController.java

@@ -0,0 +1,559 @@
+package com.ruixuan.isc.controller;
+
+import com.alibaba.fastjson.JSONObject;
+import com.ruixuan.common.core.controller.BaseController;
+import com.ruixuan.common.core.page.TableDataInfo;
+import com.ruixuan.common.utils.Check;
+import com.ruixuan.common.utils.DateUtils;
+import com.ruixuan.isc.service.ISupplyChainService;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+@RestController
+@RequestMapping("/isv/supply_chain")
+public class SupplyChainController extends BaseController {
+
+    @Autowired
+    private ISupplyChainService supplyChainService;
+
+    /**
+     * 达人订单
+     *
+     * @param orderStartDate
+     * @param orderEndDate
+     * @param promoterNickName
+     * @param promoterId
+     * @return
+     */
+    @GetMapping("/orderList")
+    @ApiOperation(value = "达人订单")
+    public TableDataInfo orderList(@ApiParam("订单开始时间") @RequestParam(value = "orderStartDate", required = false) String orderStartDate,
+                                   @ApiParam("订单结束时间") @RequestParam(value = "orderEndDate", required = false) String orderEndDate,
+                                   @ApiParam("达人名称") @RequestParam(value = "promoterNickName", required = false) String promoterNickName,
+                                   @ApiParam("达人ID") @RequestParam(value = "promoterId", required = false) String promoterId) {
+
+        Map<String, Object> requestMap = new HashMap<>();
+        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);
+        }
+        if (!Check.isNull(promoterNickName)) {
+            requestMap.put("promoterNickName", promoterNickName);
+        }
+        if (!Check.isNull(promoterId)) {
+            requestMap.put("promoterId", promoterId);
+        }
+        TableDataInfo dataInfo = new TableDataInfo();
+        if (Check.isNullMap(requestMap)) {
+            dataInfo.setCode(-1);
+            dataInfo.setMsg("入参不能为空");
+            return dataInfo;
+        }
+        startPage();
+        List<JSONObject> list = supplyChainService.getOrderList(requestMap);
+        return getDataTable(list);
+    }
+
+    /**
+     * 达人带货详情
+     *
+     * @param promoterId
+     * @param orderStartDate
+     * @param orderEndDate
+     * @param itemTitle
+     * @param itemId
+     * @return
+     */
+    @GetMapping("/anchorOrderDetail")
+    @ApiOperation(value = "达人带货详情")
+    public TableDataInfo anchorOrderDetail(
+            @ApiParam("达人Id") @RequestParam(value = "promoterId", required = false) String promoterId,
+            @ApiParam("订单开始时间") @RequestParam(value = "orderStartDate", required = false) String orderStartDate,
+            @ApiParam("订单结束时间") @RequestParam(value = "orderEndDate", required = false) String orderEndDate,
+            @ApiParam("商品名称") @RequestParam(value = "itemTitle", required = false) String itemTitle,
+            @ApiParam("商品ID") @RequestParam(value = "itemId", required = false) String itemId) {
+        Map<String, Object> requestMap = new HashMap<>();
+        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);
+        }
+        if (!Check.isNull(promoterId)) {
+            requestMap.put("promoterId", promoterId);
+        }
+        if (!Check.isNull(itemId)) {
+            requestMap.put("itemId", itemId);
+        }
+        if (!Check.isNull(itemTitle)) {
+            requestMap.put("itemTitle", itemTitle);
+        }
+
+        TableDataInfo dataInfo = new TableDataInfo();
+        if (Check.isNullMap(requestMap)) {
+            dataInfo.setCode(-1);
+            dataInfo.setMsg("入参不能为空");
+            return dataInfo;
+        }
+        startPage();
+        List<JSONObject> list = supplyChainService.anchorOrderDetail(requestMap);
+        return getDataTable(list);
+    }
+
+
+    /**
+     * 订单统计
+     *
+     * @param promoterId
+     * @param orderStartDate
+     * @param orderEndDate
+     * @return
+     */
+    @GetMapping("/orderStatistics")
+    @ApiOperation(value = "订单统计")
+    public TableDataInfo orderStatistics(
+            @ApiParam("达人Id") @RequestParam(value = "promoterId", required = false) String promoterId,
+            @ApiParam("订单开始时间") @RequestParam(value = "orderStartDate", required = false) String orderStartDate,
+            @ApiParam("订单结束时间") @RequestParam(value = "orderEndDate", required = false) String orderEndDate) {
+        Map<String, Object> requestMap = new HashMap<>();
+        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);
+        }
+        if (!Check.isNull(promoterId)) {
+            requestMap.put("promoterId", promoterId);
+        }
+        TableDataInfo dataInfo = new TableDataInfo();
+        if (Check.isNullMap(requestMap)) {
+            dataInfo.setCode(-1);
+            dataInfo.setMsg("入参不能为空");
+            return dataInfo;
+        }
+        startPage();
+        List<JSONObject> list = supplyChainService.orderStatistics(requestMap);
+        return getDataTable(list);
+    }
+
+
+    /**
+     * 商品列表
+     *
+     * @param itemId
+     * @param itemTitle
+     * @param orderStartDate
+     * @param orderEndDate
+     * @return
+     */
+    @GetMapping("/itemList")
+    @ApiOperation(value = "商品列表")
+    public TableDataInfo itemList(
+            @ApiParam("商品Id") @RequestParam(value = "itemId", required = false) String itemId,
+            @ApiParam("商品名称") @RequestParam(value = "itemTitle", required = false) String itemTitle,
+            @ApiParam("开始时间") @RequestParam(value = "orderStartDate", required = false) String orderStartDate,
+            @ApiParam("结束时间") @RequestParam(value = "orderEndDate", required = false) String orderEndDate) {
+        Map<String, Object> requestMap = new HashMap<>();
+        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);
+        }
+        if (!Check.isNull(itemId)) {
+            requestMap.put("itemId", itemId);
+        }
+        if (!Check.isNull(itemTitle)) {
+            requestMap.put("itemTitle", itemTitle);
+        }
+        TableDataInfo dataInfo = new TableDataInfo();
+        if (Check.isNullMap(requestMap)) {
+            dataInfo.setCode(-1);
+            dataInfo.setMsg("入参不能为空");
+            return dataInfo;
+        }
+        startPage();
+        List<JSONObject> list = supplyChainService.itemList(requestMap);
+        return getDataTable(list);
+    }
+
+    /**
+     * 商品详情
+     *
+     * @param itemId
+     * @param orderStartDate
+     * @param orderEndDate
+     * @param promoterId
+     * @param promoterNickName
+     * @return
+     */
+    @GetMapping("/itemDetail")
+    @ApiOperation(value = "商品详情")
+    public TableDataInfo itemDetail(
+            @ApiParam("商品ID") @RequestParam(value = "itemId", required = false) String itemId,
+            @ApiParam("订单开始时间") @RequestParam(value = "orderStartDate", required = false) String orderStartDate,
+            @ApiParam("订单结束时间") @RequestParam(value = "orderEndDate", required = false) String orderEndDate,
+            @ApiParam("达人Id") @RequestParam(value = "itemId", required = false) String promoterId,
+            @ApiParam("商品名称") @RequestParam(value = "promoterNickName", required = false) String promoterNickName) {
+        Map<String, Object> requestMap = new HashMap<>();
+        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);
+        }
+        if (!Check.isNull(promoterId)) {
+            requestMap.put("promoterId", promoterId);
+        }
+        if (!Check.isNull(itemId)) {
+            requestMap.put("itemId", itemId);
+        }
+        if (!Check.isNull(promoterNickName)) {
+            requestMap.put("itemTitle", promoterNickName);
+        }
+
+        TableDataInfo dataInfo = new TableDataInfo();
+        if (Check.isNullMap(requestMap)) {
+            dataInfo.setCode(-1);
+            dataInfo.setMsg("入参不能为空");
+            return dataInfo;
+        }
+        startPage();
+        List<JSONObject> list = supplyChainService.itemDetail(requestMap);
+        return getDataTable(list);
+    }
+
+
+    /**
+     * 产品服务费
+     *
+     * @param itemId
+     * @param itemTitle
+     * @param orderStartDate
+     * @param orderEndDate
+     * @return
+     */
+    @GetMapping("/itemServiceCharge")
+    @ApiOperation(value = "产品服务费")
+    public TableDataInfo itemServiceCharge(
+            @ApiParam("商品Id") @RequestParam(value = "itemId", required = false) String itemId,
+            @ApiParam("商品名称") @RequestParam(value = "itemTitle", required = false) String itemTitle,
+            @ApiParam("开始时间") @RequestParam(value = "orderStartDate", required = false) String orderStartDate,
+            @ApiParam("结束时间") @RequestParam(value = "orderEndDate", required = false) String orderEndDate) {
+        Map<String, Object> requestMap = new HashMap<>();
+        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);
+        }
+        if (!Check.isNull(itemId)) {
+            requestMap.put("itemId", itemId);
+        }
+        if (!Check.isNull(itemTitle)) {
+            requestMap.put("itemTitle", itemTitle);
+        }
+        TableDataInfo dataInfo = new TableDataInfo();
+        if (Check.isNullMap(requestMap)) {
+            dataInfo.setCode(-1);
+            dataInfo.setMsg("入参不能为空");
+            return dataInfo;
+        }
+        startPage();
+        List<JSONObject> list = supplyChainService.itemServiceCharge(requestMap);
+        return getDataTable(list);
+    }
+
+    /**
+     * 首页-订单数据
+     *
+     * @param dateType
+     * @param orderStartDate
+     * @param orderEndDate
+     * @return
+     */
+
+    @GetMapping("/indexOrderInfo")
+    @ApiOperation(value = "首页-订单数据")
+    public JSONObject orderTotal(
+            @ApiParam("时间类型") @RequestParam(value = "dateType", required = false) Integer dateType,
+            @ApiParam("开始时间") @RequestParam(value = "orderStartDate", required = false) String orderStartDate,
+            @ApiParam("结束时间") @RequestParam(value = "orderEndDate", required = false) String orderEndDate) {
+        Map<String, Object> requestMap = new HashMap<>();
+        JSONObject returnJson = new JSONObject();
+        if (dateType == 0) {
+            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);
+            }
+            JSONObject orderTotal = supplyChainService.getOrderTotal(requestMap);
+            returnJson.put("orderTotal", orderTotal);
+            Integer hour = DateUtils.getNowHour() - 1; // 当前小时
+            if (hour >= 0) {
+                JSONObject ratioJson = new JSONObject();
+                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); // 昨日结束时间戳
+
+                Map<String, Object> ratioMap = new HashMap<>();
+                ratioMap.put("nowStartHourTemp", nowStartHourTemp);
+                ratioMap.put("nowEndHourTemp", nowEndHourTemp);
+                ratioMap.put("yesterdayStartHourTemp", yesterdayStartHourTemp);
+                ratioMap.put("yesterdayEndHourTemp", yesterdayEndHourTemp);
+                Double ringRatio = supplyChainService.getOrderTotalRatio(ratioMap); //环比
+                ratioJson.put("ringRatio", ringRatio);
+                String yearDay = DateUtils.getAnotherDay("yyyy-MM-dd", orderStartDate, -6); // 昨日日期
+                Long yearStartHourTemp = DateUtils.getStartLongTime(yearDay); //前7日开始时间戳
+                Long yearEndHourTemp = DateUtils.getNowEndHourTemp(yearDay, hour);//前7日结束时间戳
+                ratioMap.put("yesterdayStartHourTemp", yearStartHourTemp);
+                ratioMap.put("yesterdayEndHourTemp", yearEndHourTemp);
+                Double yearRatio = supplyChainService.getOrderTotalRatio(ratioMap); //同比
+                ratioJson.put("yearRatio", yearRatio);
+                returnJson.put("ratio", ratioJson);
+            }
+        } 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);
+            }
+            JSONObject orderTotal = supplyChainService.getOrderTotal(requestMap);
+            returnJson.put("orderTotal", orderTotal);
+        }
+        return returnJson;
+    }
+
+
+    /**
+     * 首页-金额数据
+     *
+     * @param dateType
+     * @param orderStartDate
+     * @param orderEndDate
+     * @return
+     */
+    @GetMapping("/indexAmountInfo")
+    @ApiOperation(value = "首页-金额数据")
+    public JSONObject indexAmountInfo(
+            @ApiParam("时间类型") @RequestParam(value = "dateType", required = false) Integer dateType,
+            @ApiParam("开始时间") @RequestParam(value = "orderStartDate", required = false) String orderStartDate,
+            @ApiParam("结束时间") @RequestParam(value = "orderEndDate", required = false) String orderEndDate) {
+        Map<String, Object> requestMap = new HashMap<>();
+        JSONObject returnJson = new JSONObject();
+        if (dateType == 0) {
+            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);
+            }
+            JSONObject amountTotal = supplyChainService.getAmountTotal(requestMap);
+            returnJson.put("amountTotal", amountTotal);
+            Integer hour = DateUtils.getNowHour() - 1; // 当前小时
+            if (hour >= 0) {
+                JSONObject amountRatioJson = new JSONObject();
+                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); // 昨日结束时间戳
+
+                Map<String, Object> ratioMap = new HashMap<>();
+                ratioMap.put("nowStartHourTemp", nowStartHourTemp);
+                ratioMap.put("nowEndHourTemp", nowEndHourTemp);
+                ratioMap.put("yesterdayStartHourTemp", yesterdayStartHourTemp);
+                ratioMap.put("yesterdayEndHourTemp", yesterdayEndHourTemp);
+                Double amountRingRatio = supplyChainService.getAmountTotalRatio(ratioMap); //环比
+                amountRatioJson.put("amountRingRatio", amountRingRatio);
+                String yearDay = DateUtils.getAnotherDay("yyyy-MM-dd", orderStartDate, -6); // 昨日日期
+                Long yearStartHourTemp = DateUtils.getStartLongTime(yearDay); //前7日开始时间戳
+                Long yearEndHourTemp = DateUtils.getNowEndHourTemp(yearDay, hour);//前7日结束时间戳
+                ratioMap.put("yesterdayStartHourTemp", yearStartHourTemp);
+                ratioMap.put("yesterdayEndHourTemp", yearEndHourTemp);
+                Double amountYearRatio = supplyChainService.getAmountTotalRatio(ratioMap); //同比
+                amountRatioJson.put("amountYearRatio", amountYearRatio);
+                returnJson.put("amountRatio", amountRatioJson);
+            }
+        } 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);
+            }
+            JSONObject amountTotal = supplyChainService.getAmountTotal(requestMap);
+            returnJson.put("amountTotal", amountTotal);
+        }
+        return returnJson;
+    }
+
+
+    /**
+     * 首页-服务费数据
+     *
+     * @param dateType
+     * @param orderStartDate
+     * @param orderEndDate
+     * @return
+     */
+    @GetMapping("/indexServiceAmountInfo")
+    @ApiOperation(value = "首页-服务费数据")
+    public JSONObject indexServiceAmountInfo(
+            @ApiParam("时间类型") @RequestParam(value = "dateType", required = false) Integer dateType,
+            @ApiParam("开始时间") @RequestParam(value = "orderStartDate", required = false) String orderStartDate,
+            @ApiParam("结束时间") @RequestParam(value = "orderEndDate", required = false) String orderEndDate) {
+        Map<String, Object> requestMap = new HashMap<>();
+        JSONObject returnJson = new JSONObject();
+
+        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);
+        }
+        JSONObject serviceAmountTotal = supplyChainService.getServiceAmountTotal(requestMap);
+        returnJson.put("serviceAmountTotal", serviceAmountTotal);
+        return returnJson;
+    }
+
+    /**
+     * 首页-商品排行
+     *
+     * @param dateType
+     * @param orderStartDate
+     * @param orderEndDate
+     * @return
+     */
+    @GetMapping("/indexOrderRank")
+    @ApiOperation(value = "首页-商品排行")
+    public TableDataInfo indexOrderRank(
+            @ApiParam("时间类型") @RequestParam(value = "dateType", required = false) Integer dateType,
+            @ApiParam("开始时间") @RequestParam(value = "orderStartDate", required = false) String orderStartDate,
+            @ApiParam("结束时间") @RequestParam(value = "orderEndDate", required = false) String orderEndDate) {
+
+        Map<String, Object> requestMap = new HashMap<>();
+        if (dateType == 0) {
+            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> orderRankRatioList = supplyChainService.getOrderRankRatioList(requestMap);
+            return getDataTable(orderRankRatioList);
+        } 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);
+        }
+
+    }
+
+
+    @GetMapping("/indexPromoterRank")
+    @ApiOperation(value = "首页-达人排行")
+    public TableDataInfo indexPromoterRank(
+            @ApiParam("时间类型") @RequestParam(value = "dateType", required = false) Integer dateType,
+            @ApiParam("开始时间") @RequestParam(value = "orderStartDate", required = false) String orderStartDate,
+            @ApiParam("结束时间") @RequestParam(value = "orderEndDate", required = false) String orderEndDate) {
+
+        Map<String, Object> requestMap = new HashMap<>();
+        if (dateType == 0) {
+            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);
+
+        } 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);
+        }
+
+    }
+
+}

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

@@ -0,0 +1,43 @@
+package com.ruixuan.isc.mapper;
+
+import com.alibaba.fastjson.JSONObject;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+import java.util.Map;
+
+public interface SupplyChainMapper {
+    List<JSONObject> getOrderList(Map<String, Object> requestMap);
+
+    List<JSONObject> getTopOrders(Map<String, Object> requestMap);
+
+    List<JSONObject> anchorOrderDetail(Map<String, Object> requestMap);
+
+    List<JSONObject> orderStatistics(Map<String, Object> requestMap);
+
+    List<JSONObject> itemList(Map<String, Object> requestMap);
+
+    List<JSONObject> getTopAnchors(Map<String, Object> requestMap);
+
+    List<JSONObject> itemDetail(Map<String, Object> requestMap);
+
+    List<JSONObject> itemServiceCharge(Map<String, Object> requestMap);
+
+    JSONObject getOrderTotal(Map<String, Object> requestMap);
+
+    Double getOrderTotalRatio(Map<String, Object> ratioMap);
+
+    JSONObject getAmountTotal(Map<String, Object> requestMap);
+
+    Double getAmountTotalRatio(Map<String, Object> ratioMap);
+
+    JSONObject getServiceAmountTotal(Map<String, Object> ratioMap);
+
+    List<JSONObject> getOrderRankRatioList(Map<String, Object> requestMap);
+
+    List<JSONObject>  getOrderRankList(Map<String, Object> requestMap);
+
+    List<JSONObject> getPromoterRankRatioList(Map<String, Object> requestMap);
+
+    List<JSONObject> getPromoterRatioList(Map<String, Object> requestMap);
+}

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

@@ -0,0 +1,53 @@
+package com.ruixuan.isc.service;
+
+import com.alibaba.fastjson.JSONObject;
+
+import java.util.List;
+import java.util.Map;
+
+public interface ISupplyChainService {
+    // 获取订单数据
+    List<JSONObject> getOrderList(Map<String, Object> requestMap);
+
+    //达人带货详情
+    List<JSONObject> anchorOrderDetail(Map<String, Object> requestMap);
+
+    //订单统计
+    List<JSONObject> orderStatistics(Map<String, Object> requestMap);
+
+    //商品列表
+    List<JSONObject> itemList(Map<String, Object> requestMap);
+
+    //商品详情
+    List<JSONObject> itemDetail(Map<String, Object> requestMap);
+
+    //商品服务费
+    List<JSONObject> itemServiceCharge(Map<String, Object> requestMap);
+
+    //首页-订单数量查询
+    JSONObject getOrderTotal(Map<String, Object> requestMap);
+
+    // 首页-订单数量环比
+    Double getOrderTotalRatio(Map<String, Object> ratioMap);
+
+    // 首页-金额数据
+    JSONObject getAmountTotal(Map<String, Object> requestMap);
+
+    // 首页-金额数据环比
+    Double getAmountTotalRatio(Map<String, Object> ratioMap);
+
+    //首页-服务费数据
+    JSONObject getServiceAmountTotal(Map<String, Object> requestMap);
+
+    //首页-订单排行(环比)
+    List<JSONObject> getOrderRankRatioList(Map<String, Object> requestMap);
+
+    //首页-订单排行(无环比)
+    List<JSONObject> getOrderRankList(Map<String, Object> requestMap);
+
+    //首页-达人排行(环比)
+    List<JSONObject> getPromoterRankRatioList(Map<String, Object> requestMap);
+
+    //首页-达人排行(无环比)
+    List<JSONObject> getPromoterRatioList(Map<String, Object> requestMap);
+}

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

@@ -0,0 +1,116 @@
+package com.ruixuan.isc.service.impl;
+
+import com.alibaba.fastjson.JSONObject;
+import com.ruixuan.common.utils.Check;
+import com.ruixuan.isc.mapper.SupplyChainMapper;
+import com.ruixuan.isc.service.ISupplyChainService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+import java.util.Map;
+
+@Service
+public class SupplyChainServiceImpl implements ISupplyChainService {
+    @Autowired
+    private SupplyChainMapper supplyChainMapper;
+
+    // 获取订单数据 
+    @Override
+    public List<JSONObject> getOrderList(Map<String, Object> requestMap) {
+        List<JSONObject> list = supplyChainMapper.getOrderList(requestMap);
+        if (!Check.isNull(list)) {
+            for (int i = 0; i < list.size(); i++) {
+                JSONObject jsonObject = list.get(i);
+                Long promoterId = jsonObject.getLong("promoterId");
+                requestMap.put("promoterId", promoterId);
+                List<JSONObject> topOrders = supplyChainMapper.getTopOrders(requestMap);
+                jsonObject.put("topOrders", topOrders);
+            }
+        }
+        return list;
+    }
+
+    //达人带货详情
+    @Override
+    public List<JSONObject> anchorOrderDetail(Map<String, Object> requestMap) {
+        return supplyChainMapper.anchorOrderDetail(requestMap);
+    }
+
+    //订单统计
+    @Override
+    public List<JSONObject> orderStatistics(Map<String, Object> requestMap) {
+        return supplyChainMapper.orderStatistics(requestMap);
+    }
+
+    //商品列表
+    @Override
+    public List<JSONObject> itemList(Map<String, Object> requestMap) {
+        List<JSONObject>  list =   supplyChainMapper.itemList(requestMap);
+        if(!Check.isNull(list)){
+            for (int i = 0; i < list.size(); i++) {
+                JSONObject jsonObject = list.get(i);
+                Long itemId = jsonObject.getLong("promoterId");
+                requestMap.put("itemId", itemId);
+                List<JSONObject> topAnchors = supplyChainMapper.getTopAnchors(requestMap);
+                jsonObject.put("topAnchors", topAnchors);
+            }
+        }
+        return list;
+    }
+
+    @Override
+    public List<JSONObject> itemDetail(Map<String, Object> requestMap) {
+        return supplyChainMapper.itemDetail(requestMap);
+    }
+
+    @Override
+    public List<JSONObject> itemServiceCharge(Map<String, Object> requestMap) {
+        return supplyChainMapper.itemServiceCharge(requestMap);
+    }
+
+    @Override
+    public JSONObject getOrderTotal(Map<String, Object> requestMap) {
+        return supplyChainMapper.getOrderTotal(requestMap);
+    }
+
+    @Override
+    public Double getOrderTotalRatio(Map<String, Object> ratioMap) {
+        return supplyChainMapper.getOrderTotalRatio(ratioMap);
+    }
+
+    @Override
+    public JSONObject getAmountTotal(Map<String, Object> requestMap) {
+        return supplyChainMapper.getAmountTotal(requestMap);
+    }
+
+    @Override
+    public Double getAmountTotalRatio(Map<String, Object> ratioMap) {
+        return supplyChainMapper.getAmountTotalRatio(ratioMap);
+    }
+
+    @Override
+    public JSONObject getServiceAmountTotal(Map<String, Object> requestMap) {
+        return supplyChainMapper.getServiceAmountTotal(requestMap);
+    }
+
+    @Override
+    public List<JSONObject> getOrderRankRatioList(Map<String, Object> requestMap) {
+        return supplyChainMapper.getOrderRankRatioList(requestMap);
+    }
+
+    @Override
+    public List<JSONObject>  getOrderRankList(Map<String, Object> requestMap) {
+        return supplyChainMapper.getOrderRankList(requestMap);
+    }
+
+    @Override
+    public List<JSONObject> getPromoterRankRatioList(Map<String, Object> requestMap) {
+        return supplyChainMapper.getPromoterRankRatioList(requestMap);
+    }
+
+    @Override
+    public List<JSONObject> getPromoterRatioList(Map<String, Object> requestMap) {
+        return supplyChainMapper.getPromoterRatioList(requestMap);
+    }
+}

+ 392 - 0
ruixuan-live/src/main/resources/mapper/isc/SupplyChainMapper.xml

@@ -0,0 +1,392 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.ruixuan.isc.mapper.SupplyChainMapper">
+
+
+    <select id="getOrderList" resultType="com.alibaba.fastjson.JSONObject">
+        select *
+        from (select promoter_id as 'promoterId',
+        promoter_nick_name as 'promoterNickName',
+        count(oid) as 'orderNum',
+        sum(case when order_status != 80 then 1 else 0 end) as 'validOrderNUm'
+        from kuaishou_supply_chain
+        where 1= 1
+        <if test="start != null and start != ''">
+            and order_create_time &gt;= #{start}
+        </if>
+        <if test="end != null and end != ''">
+            and order_create_time &lt;= #{end}
+        </if>
+        <if test="promoterId != null and promoterId != ''">
+            and promoter_id = #{promoterId}
+        </if>
+        <if test="promoterNickName != null and promoterNickName != ''">
+            and promoter_nick_name like concat(concat('%',#{promoterNickName}),'%')
+        </if>
+        group by promoter_id) t
+        order by t.orderNum desc
+    </select>
+    <select id="getTopOrders" resultType="com.alibaba.fastjson.JSONObject">
+        select *
+        from
+        (select item_id as 'itemId',
+        item_title as 'itemTitle',
+        count(oid) as 'orderNum'
+        from kuaishou_supply_chain
+        where promoter_id = #{promoterId}
+        <if test="start != null and start != ''">
+            and order_create_time &gt;= #{start}
+        </if>
+        <if test="end != null and end != ''">
+            and order_create_time &lt;= #{end}
+        </if>
+        group by item_id) t
+        order by t.orderNum desc limit 3
+    </select>
+    <select id="anchorOrderDetail" resultType="com.alibaba.fastjson.JSONObject">
+        select *
+        from (select
+        item_title as 'itemTitle',
+        item_id as 'itemId',
+        count(oid) as 'orderNum',
+        sum(case when order_status != 80 then 1 else 0 end) as 'validOrderNUm',
+        sum(case when order_status != 80 then pay_amount else 0 end) as 'payAmount',
+        regimental_promotion_rate as 'regimentalPromotionRate'
+        from kuaishou_supply_chain
+        where 1= 1
+        <if test="promoterId != null and promoterId != ''">
+            and promoter_id = #{promoterId}
+        </if>
+
+        <if test="start != null and start != ''">
+            and order_create_time &gt;= #{start}
+        </if>
+        <if test="end != null and end != ''">
+            and order_create_time &lt;= #{end}
+        </if>
+        <if test="itemId != null and itemId != ''">
+            and item_id = #{itemId}
+        </if>
+        <if test="itemTitle != null and itemTitle != ''">
+            and item_title like concat(concat('%',#{itemTitle}),'%')
+        </if>
+        group by item_id) t
+        order by t.orderNum desc
+    </select>
+    <select id="orderStatistics" resultType="com.alibaba.fastjson.JSONObject">
+        select FROM_UNIXTIME(t.order_create_time / 1000, '%y-%m-%d') as 'date',
+        count(t.oid) as 'orderNum'
+        from (select oid,
+        order_create_time
+        from kuaishou_supply_chain
+        where 1 = 1
+        <if test="promoterId != null and promoterId != ''">
+            and promoter_id = #{promoterId}
+        </if>
+        <if test="start != null and start != ''">
+            and order_create_time &gt;= #{start}
+        </if>
+        <if test="end != null and end != ''">
+            and order_create_time &lt;= #{end}
+        </if>
+        ) t
+        group by FROM_UNIXTIME(t.order_create_time / 1000, '%y-%m-%d')
+        order by FROM_UNIXTIME(t.order_create_time / 1000, '%y-%m-%d') desc
+    </select>
+    <select id="itemList" resultType="com.alibaba.fastjson.JSONObject">
+        select *
+        from (
+        select
+        item_id as 'itemId',
+        item_title as 'itemTitle',
+        count(oid) as 'orderNum',
+        sum(case when order_status != 80 then 1 else 0 end) as 'validOrderNUm'
+        from kuaishou_supply_chain
+        where 1= 1
+        <if test="start != null and start != ''">
+            and order_create_time &gt;= #{start}
+        </if>
+        <if test="end != null and end != ''">
+            and order_create_time &lt;= #{end}
+        </if>
+        <if test="itemId != null and itemId != ''">
+            and item_id = #{itemId}
+        </if>
+        <if test="itemTitle != null and itemTitle != ''">
+            and item_title like concat(concat('%',#{itemTitle}),'%')
+        </if>
+        group by item_id) t
+        order by t.orderNum desc
+    </select>
+    <select id="getTopAnchors" resultType="com.alibaba.fastjson.JSONObject">
+        select
+        *
+        from
+        (select promoter_id as 'promoterId',
+        promoter_nick_name as 'promoterNickName',
+        count(oid) as 'orderNum'
+        from kuaishou_supply_chain
+        where item_id = #{itemId}
+        <if test="start != null and start != ''">
+            and order_create_time &gt;= #{start}
+        </if>
+        <if test="end != null and end != ''">
+            and order_create_time &lt;= #{end}
+        </if>
+        group by promoter_id) t
+        order by t.orderNum desc limit 3
+    </select>
+    <select id="itemDetail" resultType="com.alibaba.fastjson.JSONObject">
+        select *
+        from (
+        select
+        promoter_nick_name as 'promoterNickName',
+        promoter_id as 'promoterId',
+        count(oid) as 'orderNum',
+        sum(case when order_status != 80 then 1 else 0 end) as 'validOrderNUm',
+        sum(case when order_status != 80 then pay_amount else 0 end) as 'payAmount',
+        regimental_promotion_rate as 'regimentalPromotionRate'
+        from kuaishou_supply_chain
+        where 1= 1
+        <if test="itemId != null and itemId != ''">
+            and item_id = #{itemId}
+        </if>
+        <if test="start != null and start != ''">
+            and order_create_time &gt;= #{start}
+        </if>
+        <if test="end != null and end != ''">
+            and order_create_time &lt;= #{end}
+        </if>
+        <if test="promoterId != null and promoterId != ''">
+            and promoter_id = #{promoterId}
+        </if>
+        <if test="promoterNickName != null and promoterNickName != ''">
+            and promoter_nick_name like concat(concat('%',#{promoterNickName}),'%')
+        </if>
+        group by promoter_id) t
+        order by t.orderNum desc
+    </select>
+    <select id="itemServiceCharge" resultType="com.alibaba.fastjson.JSONObject">
+        select *
+        from (
+        select
+        item_id as 'itemId',
+        item_title as 'itemTitle',
+        count(oid) as 'orderNum',
+        sum(case when order_status != 80 then 1 else 0 end) as 'validOrderNUm',
+        sum(case when order_status = 80 then 1 else 0 end) as 'invalidOrderNUm',
+        regimental_promotion_rate as 'regimentalPromotionRate',
+        sum(case when order_status != 80 pay_amount then 1 else 0 end) as 'payAmount',
+        sum(case when order_status != 80 then regimental_promotion_amount else 0 end) as 'regimentalPromotionAmount',
+        from kuaishou_supply_chain
+        where 1= 1
+        <if test="start != null and start != ''">
+            and order_create_time &gt;= #{start}
+        </if>
+        <if test="end != null and end != ''">
+            and order_create_time &lt;= #{end}
+        </if>
+        <if test="itemId != null and itemId != ''">
+            and item_id = #{itemId}
+        </if>
+        <if test="itemTitle != null and itemTitle != ''">
+            and item_title like concat(concat('%',#{itemTitle}),'%')
+        </if>
+        group by item_id) t
+        order by t.orderNum desc
+    </select>
+    <select id="getOrderTotal" resultType="com.alibaba.fastjson.JSONObject">
+        select
+        count(oid) as 'orderNum',
+        sum(case when order_status != 80 then 1 else 0 end) as 'validOrderNUm'
+        from kuaishou_supply_chain
+        where 1= 1
+        <if test="start != null and start != ''">
+            and order_create_time &gt;= #{start}
+        </if>
+        <if test="end != null and end != ''">
+            and order_create_time &lt;= #{end}
+        </if>
+
+    </select>
+    <select id="getOrderTotalRatio" resultType="java.lang.Double">
+        select
+        round((t1.oid -t2.oid) / t2.oid , 2) as 'orderTotalRatio'
+        from (select count(oid) as 'oid'
+        from kuaishou_supply_chain
+        where 1= 1
+        <if test="nowStartHourTemp != null and nowStartHourTemp != ''">
+            and order_create_time &gt;= #{nowStartHourTemp}
+        </if>
+        <if test="nowEndHourTemp != null and nowEndHourTemp != ''">
+            and order_create_time &lt;= #{nowEndHourTemp}
+        </if>
+        ) t1
+        join (select count(oid) as 'oid'
+        from kuaishou_supply_chain
+        where 1=1
+        <if test="yesterdayStartHourTemp != null and yesterdayStartHourTemp != ''">
+            and order_create_time &gt;= #{yesterdayStartHourTemp}
+        </if>
+        <if test="yesterdayEndHourTemp != null and yesterdayEndHourTemp != ''">
+            and order_create_time &lt;= #{yesterdayEndHourTemp}
+        </if>
+        ) t2
+
+    </select>
+    <select id="getAmountTotal" resultType="com.alibaba.fastjson.JSONObject">
+        select
+        base_amount as 'baseAmount',
+        pay_amount as 'payAmount'
+        from kuaishou_supply_chain
+        where 1= 1
+        <if test="start != null and start != ''">
+            and order_create_time &gt;= #{start}
+        </if>
+        <if test="end != null and end != ''">
+            and order_create_time &lt;= #{end}
+        </if>
+
+    </select>
+    <select id="getAmountTotalRatio" resultType="java.lang.Double">
+        select
+        round((t1.payAmount -t2.payAmount) / t2.payAmount , 2) as 'amountTotalRatio'
+        from (select sum(pay_amount) as 'payAmount'
+        from kuaishou_supply_chain
+        where 1= 1
+        <if test="nowStartHourTemp != null and nowStartHourTemp != ''">
+            and order_create_time &gt;= #{nowStartHourTemp}
+        </if>
+        <if test="nowEndHourTemp != null and nowEndHourTemp != ''">
+            and order_create_time &lt;= #{nowEndHourTemp}
+        </if>
+        ) t1
+        join (select sum(pay_amount) as 'payAmount'
+        from kuaishou_supply_chain
+        where 1=1
+        <if test="yesterdayStartHourTemp != null and yesterdayStartHourTemp != ''">
+            and order_create_time &gt;= #{yesterdayStartHourTemp}
+        </if>
+        <if test="yesterdayEndHourTemp != null and yesterdayEndHourTemp != ''">
+            and order_create_time &lt;= #{yesterdayEndHourTemp}
+        </if>
+        ) t2
+    </select>
+    <select id="getServiceAmountTotal" resultType="com.alibaba.fastjson.JSONObject">
+        select
+        sum(regimental_promotion_amount) as 'regimentalPromotionAmount',
+        count(distinct promoter_id) as 'promoterNum'
+        from kuaishou_supply_chain
+        where 1= 1
+        <if test="start != null and start != ''">
+            and order_create_time &gt;= #{start}
+        </if>
+        <if test="end != null and end != ''">
+            and order_create_time &lt;= #{end}
+        </if>
+    </select>
+    <select id="getOrderRankRatioList" resultType="com.alibaba.fastjson.JSONObject">
+        select
+        t1.*,
+        round((t1.orderNum - t2.orderNum) / t2.orderNum,2) as 'radio'
+        from (select
+        item_id as 'itemId',
+        item_title as 'itemTitle',
+        image_url as 'imageUrl',
+        count(oid) as 'orderNum'
+        from kuaishou_supply_chain
+        where 1= 1
+        <if test="nowStartHourTemp != null and nowStartHourTemp != ''">
+            and order_create_time &gt;= #{nowStartHourTemp}
+        </if>
+        <if test="nowEndHourTemp != null and nowEndHourTemp != ''">
+            and order_create_time &lt;= #{nowEndHourTemp}
+        </if>
+        group by item_id
+        ) t1
+        left join (select
+        item_id as 'itemId',
+        count(oid) as 'orderNum'
+        from kuaishou_supply_chain
+        where 1=1
+        <if test="yesterdayStartHourTemp != null and yesterdayStartHourTemp != ''">
+            and order_create_time &gt;= #{yesterdayStartHourTemp}
+        </if>
+        <if test="yesterdayEndHourTemp != null and yesterdayEndHourTemp != ''">
+            and order_create_time &lt;= #{yesterdayEndHourTemp}
+        </if>
+        group by item_id
+        ) t2 on t1.itemId = t2.itemId
+        order by t1.orderNum desc
+    </select>
+    <select id="getOrderRankList" resultType="com.alibaba.fastjson.JSONObject">
+        select * from (
+        select
+        item_id as 'itemId',
+        item_title as 'itemTitle',
+        image_url as 'imageUrl',
+        count(oid) as 'orderNum'
+        from kuaishou_supply_chain
+        where 1= 1
+        <if test="start != null and start != ''">
+            and order_create_time &gt;= #{start}
+        </if>
+        <if test="end != null and end != ''">
+            and order_create_time &lt;= #{end}
+        </if>
+        group by item_id) t
+        order by t.orderNum desc
+    </select>
+    <select id="getPromoterRankRatioList" resultType="com.alibaba.fastjson.JSONObject">
+        select
+        t1.*,
+        round((t1.orderNum - t2.orderNum) / t2.orderNum,2) as 'radio'
+        from (select
+        promoter_id as 'promoterId',
+        promoter_nick_name as 'promoterNickName',
+        count(oid) as 'orderNum'
+        from kuaishou_supply_chain
+        where 1= 1
+        <if test="nowStartHourTemp != null and nowStartHourTemp != ''">
+            and order_create_time &gt;= #{nowStartHourTemp}
+        </if>
+        <if test="nowEndHourTemp != null and nowEndHourTemp != ''">
+            and order_create_time &lt;= #{nowEndHourTemp}
+        </if>
+        group by promoter_id
+        ) t1
+        left join (select
+        promoter_id as 'promoterId',
+        count(oid) as 'orderNum'
+        from kuaishou_supply_chain
+        where 1=1
+        <if test="yesterdayStartHourTemp != null and yesterdayStartHourTemp != ''">
+            and order_create_time &gt;= #{yesterdayStartHourTemp}
+        </if>
+        <if test="yesterdayEndHourTemp != null and yesterdayEndHourTemp != ''">
+            and order_create_time &lt;= #{yesterdayEndHourTemp}
+        </if>
+        group by promoter_id
+        ) t2 on t1.promoterId = t2.promoterId
+        order by t1.orderNum desc
+    </select>
+    <select id="getPromoterRatioList" resultType="com.alibaba.fastjson.JSONObject">
+        select * from (
+        select
+        promoter_id as 'promoterId',
+        promoter_nick_name as 'promoterNickName',
+        count(oid) as 'orderNum'
+        from kuaishou_supply_chain
+        where 1= 1
+        <if test="start != null and start != ''">
+            and order_create_time &gt;= #{start}
+        </if>
+        <if test="end != null and end != ''">
+            and order_create_time &lt;= #{end}
+        </if>
+        group by promoter_id) t
+        order by t.orderNum desc
+    </select>
+</mapper>