yumeng 1 rok temu
rodzic
commit
9aec6650dc

+ 331 - 0
ruixuan-live/src/main/java/com/ruixuan/jiaoyang/controller/JiaoYangReportController.java

@@ -8,12 +8,15 @@ import com.ruixuan.common.utils.DateUtils;
 import com.ruixuan.jiaoyang.service.IJiaoYangReportService;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiParam;
+import lombok.SneakyThrows;
 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.text.SimpleDateFormat;
+import java.util.Arrays;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -262,4 +265,332 @@ public class JiaoYangReportController extends BaseController {
         return getDataTable(list);
     }
 
+
+    @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.strDateToInt(orderStartDate); //当天开始时间
+                requestMap.put("start", start);
+            }
+            if (!Check.isNull(orderEndDate)) {
+                Long end = DateUtils.strDateToInt(orderEndDate); // 当天结束时间
+                requestMap.put("end", end);
+            }
+            JSONObject orderTotal = jiaoYangReportService.getOrderTotal(requestMap);
+            returnJson.put("orderTotal", orderTotal);
+            Integer hour = DateUtils.getNowHour() - 1; // 当前小时
+            if (hour >= 0) {
+                JSONObject ratioJson = new JSONObject();
+                Long nowDate = DateUtils.strDateToInt(orderStartDate);
+                Long yesDate = DateUtils.strDateToInt(DateUtils.getAnotherDay("yyyy-MM-dd", orderStartDate, -1)); // 昨日日期
+                Map<String, Object> ratioMap = new HashMap<>();
+                ratioMap.put("nowDate", nowDate);
+
+                ratioMap.put("yesDate", yesDate);
+                ratioMap.put("hour", hour);
+                Double ringRatio = jiaoYangReportService.getOrderTotalRatio(ratioMap); //环比
+                ratioJson.put("ringRatio", ringRatio);
+                yesDate = DateUtils.strDateToInt(DateUtils.getAnotherDay("yyyy-MM-dd", orderStartDate, -6)); // 昨日日期
+                ratioMap.put("yesDate", yesDate);
+                Double yearRatio = jiaoYangReportService.getOrderTotalRatio(ratioMap); //同比
+                ratioJson.put("yearRatio", yearRatio);
+                returnJson.put("ratio", ratioJson);
+            }
+        } else {
+            if (!Check.isNull(orderStartDate)) {
+                Long start = DateUtils.strDateToInt(orderStartDate); //昨日开始时间
+                requestMap.put("start", start);
+            }
+            if (!Check.isNull(orderEndDate)) {
+                Long end = DateUtils.strDateToInt(orderEndDate); // 前日开始时间
+                requestMap.put("end", end);
+            }
+            JSONObject orderTotal = jiaoYangReportService.getOrderTotal(requestMap);
+            returnJson.put("orderTotal", orderTotal);
+        }
+        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.strDateToInt(orderStartDate);
+            requestMap.put("start", start);
+        }
+        if (!Check.isNull(orderEndDate)) {
+            Long end = DateUtils.strDateToInt(orderEndDate);
+            requestMap.put("end", end);
+        }
+        JSONObject serviceAmountTotal = jiaoYangReportService.getServiceAmountTotal(requestMap);
+        returnJson.put("serviceAmountTotal", serviceAmountTotal);
+        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.strDateToInt(orderStartDate); //当天开始时间
+                requestMap.put("start", start);
+            }
+            if (!Check.isNull(orderEndDate)) {
+                Long end = DateUtils.strDateToInt(orderEndDate); // 当天结束时间
+                requestMap.put("end", end);
+            }
+            JSONObject amountTotal = jiaoYangReportService.getAmountTotal(requestMap);
+            returnJson.put("amountTotal", amountTotal);
+            Integer hour = DateUtils.getNowHour() - 1; // 当前小时
+            if (hour >= 0) {
+                JSONObject amountRatioJson = new JSONObject();
+                Long nowDate = DateUtils.strDateToInt(orderStartDate);
+                Long yesDate = DateUtils.strDateToInt(DateUtils.getAnotherDay("yyyy-MM-dd", orderStartDate, -1)); // 昨日日期
+                Map<String, Object> ratioMap = new HashMap<>();
+                ratioMap.put("nowDate", nowDate);
+
+                ratioMap.put("yesDate", yesDate);
+                ratioMap.put("hour", hour);
+                Double amountRingRatio = jiaoYangReportService.getAmountTotalRatio(ratioMap); //环比
+                amountRatioJson.put("amountRingRatio", amountRingRatio);
+                yesDate = DateUtils.strDateToInt(DateUtils.getAnotherDay("yyyy-MM-dd", orderStartDate, -6)); // 昨日日期
+                ratioMap.put("yesDate", yesDate);
+                Double amountYearRatio = jiaoYangReportService.getAmountTotalRatio(ratioMap); //同比
+                amountRatioJson.put("amountYearRatio", amountYearRatio);
+                returnJson.put("amountRatio", amountRatioJson);
+            }
+        } else {
+            if (!Check.isNull(orderStartDate)) {
+                Long start = DateUtils.strDateToInt(orderStartDate); //昨日开始时间
+                requestMap.put("start", start);
+            }
+            if (!Check.isNull(orderEndDate)) {
+                Long end = DateUtils.strDateToInt(orderEndDate); // 前日开始时间
+                requestMap.put("end", end);
+            }
+            JSONObject amountTotal = jiaoYangReportService.getAmountTotal(requestMap);
+            returnJson.put("amountTotal", amountTotal);
+        }
+        return returnJson;
+    }
+
+
+    @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("媒体,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.strDateToInt(orderStartDate); //当天开始时间
+                requestMap.put("start", start);
+            }
+            if (!Check.isNull(orderEndDate)) {
+                Long end = DateUtils.strDateToInt(orderEndDate); // 当天结束时间
+                requestMap.put("end", end);
+            }
+            Integer hour = DateUtils.getNowHour(); // 当前小时
+            Long nowDate = DateUtils.strDateToInt(orderStartDate); // 当天开始时间戳
+            Long yesDate = DateUtils.strDateToInt(DateUtils.getAnotherDay("yyyy-MM-dd", orderStartDate, -1)); // 昨日日期
+            requestMap.put("nowDate", nowDate);
+            requestMap.put("hour", hour);
+            requestMap.put("yesDate", yesDate);
+            startPage();
+            List<JSONObject> promoterRankRatioList = jiaoYangReportService.getPromoterRankRatioList(requestMap);
+            return getDataTable(promoterRankRatioList);
+
+        } else {
+
+            if (!Check.isNull(orderStartDate)) {
+                Long start = DateUtils.strDateToInt(orderStartDate);
+                requestMap.put("start", start);
+            }
+            if (!Check.isNull(orderEndDate)) {
+                Long end = DateUtils.strDateToInt(orderEndDate);
+                requestMap.put("end", end);
+            }
+            startPage();
+            List<JSONObject> orderRatioList = jiaoYangReportService.getPromoterRatioList(requestMap);
+            return getDataTable(orderRatioList);
+
+        }
+    }
+
+
+    /**
+     * 首页-商品排行
+     *
+     * @param dateType
+     * @param orderStartDate
+     * @param orderEndDate
+     * @return
+     */
+    @GetMapping("/indexOrderRank")
+    @ApiOperation(value = "首页-商品排行")
+    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) {
+
+        Map<String, Object> requestMap = new HashMap<>();
+        if (dateType == 0) {
+            Integer hour = DateUtils.getNowHour(); // 当前小时
+            Long nowDate = DateUtils.strDateToInt(orderStartDate); // 当天开始时间戳
+            Long yesDate = DateUtils.strDateToInt(DateUtils.getAnotherDay("yyyy-MM-dd", orderStartDate, -1)); // 昨日日期
+            requestMap.put("nowDate", nowDate);
+            requestMap.put("yesDate", yesDate);
+            requestMap.put("hour", hour);
+            startPage();
+            List<JSONObject> orderRankRatioList = jiaoYangReportService.getOrderRankRatioList(requestMap);
+            return getDataTable(orderRankRatioList);
+        } else {
+            if (!Check.isNull(orderStartDate)) {
+                Long start = DateUtils.strDateToInt(orderStartDate);
+                requestMap.put("start", start);
+            }
+            if (!Check.isNull(orderEndDate)) {
+                Long end = DateUtils.strDateToInt(orderEndDate);
+                requestMap.put("end", end);
+            }
+            startPage();
+            List<JSONObject> orderRankRatioList = jiaoYangReportService.getOrderRankList(requestMap);
+            return getDataTable(orderRankRatioList);
+        }
+    }
+
+    /**
+     * 首页-统计图
+     *
+     * @param orderStartDate
+     * @param orderEndDate
+     * @param type
+     * @return
+     */
+    @GetMapping("/indexStatistics")
+    @ApiOperation(value = "首页-统计图")
+    public List<JSONObject> indexStatistics(
+            @ApiParam("开始时间") @RequestParam(value = "orderStartDate", required = false) String orderStartDate,
+            @ApiParam("结束时间") @RequestParam(value = "orderEndDate", required = false) String orderEndDate,
+            @ApiParam("类型") @RequestParam(value = "type", required = false) String type) {
+        Map<String, Object> requestMap = new HashMap<>();
+        String nowDate = DateUtils.getNowDateStr();
+        Long start = null;
+        Long end = null;
+        if (nowDate.equals(orderStartDate) && nowDate.equals(orderEndDate)) {
+            String endStr = DateUtils.getAnotherDay("yyyy-MM-dd", nowDate, -1);
+            end = DateUtils.strDateToInt(endStr);
+            start = DateUtils.strDateToInt(DateUtils.getAnotherDay("yyyy-MM-dd", endStr, -6));
+        } else {
+            start = DateUtils.strDateToInt(orderStartDate);
+            end = DateUtils.strDateToInt(orderEndDate);
+        }
+        if (!Check.isNull(start)) {
+            requestMap.put("start", start);
+        }
+        if (!Check.isNull(end)) {
+            requestMap.put("end", end);
+        }
+        if (!Check.isNull(type)) {
+            requestMap.put("type", type);
+        }
+        List<JSONObject> list = jiaoYangReportService.indexStatistics(requestMap);
+        return list;
+    }
+
+    /**
+     * 首页-时段对比
+     *
+     * @param orderStartDate
+     * @param orderEndDate
+     * @return
+     */
+    @SneakyThrows
+    @GetMapping("/indexTimeIntervalRatio")
+    @ApiOperation(value = "首页-时段对比")
+    public JSONObject indexTimeIntervalRatio(
+            @ApiParam("开始时间") @RequestParam(value = "orderStartDate", required = false) String orderStartDate,
+            @ApiParam("结束时间") @RequestParam(value = "orderEndDate", required = false) String orderEndDate) {
+        Map<String, Object> requestMap = new HashMap<>();
+        String nowDate = DateUtils.getNowDateStr();
+        String thisCycleEnd = null; // 当前时段结束日期
+        String thisCycleStart = null; // 当前时段开始日期
+        String lastCycleEnd = null; // 上一时段结束日期
+        String lastCycleStart = null; // 上一时段开始日期
+        if (nowDate.equals(orderStartDate) && nowDate.equals(orderEndDate)) {
+            thisCycleEnd = DateUtils.getAnotherDay("yyyy-MM-dd", nowDate, -1);
+            thisCycleStart = DateUtils.getAnotherDay("yyyy-MM-dd", thisCycleEnd, -6);
+            lastCycleEnd = DateUtils.getAnotherDay("yyyy-MM-dd", thisCycleStart, -1);
+            lastCycleStart = DateUtils.getAnotherDay("yyyy-MM-dd", lastCycleEnd, -6);
+        } else {
+            SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
+            int differDay = DateUtils.differentDaysByMillisecond(simpleDateFormat.parse(orderStartDate), simpleDateFormat.parse(orderEndDate));
+            thisCycleEnd = orderEndDate;
+            thisCycleStart = orderStartDate;
+            lastCycleEnd = DateUtils.getAnotherDay("yyyy-MM-dd", orderStartDate, -1);
+            lastCycleStart = DateUtils.getAnotherDay("yyyy-MM-dd", lastCycleEnd, -differDay);
+        }
+        if (!Check.isNull(thisCycleStart)) {
+            Long thisCycleStartTemp = DateUtils.strDateToInt(thisCycleStart);
+            requestMap.put("thisCycleStartTemp", thisCycleStartTemp);
+        }
+        if (!Check.isNull(thisCycleEnd)) {
+            Long thisCycleEndTemp = DateUtils.strDateToInt(thisCycleEnd);
+            requestMap.put("thisCycleEndTemp", thisCycleEndTemp);
+        }
+        if (!Check.isNull(lastCycleStart)) {
+            Long lastCycleStartTemp = DateUtils.strDateToInt(lastCycleStart);
+            requestMap.put("lastCycleStartTemp", lastCycleStartTemp);
+        }
+        if (!Check.isNull(lastCycleEnd)) {
+            Long lastCycleEndTemp = DateUtils.strDateToInt(lastCycleEnd);
+            requestMap.put("lastCycleEndTemp", lastCycleEndTemp);
+        }
+        JSONObject timeIntervalRatioJson = jiaoYangReportService.getTimeIntervalRatio(requestMap);
+        return timeIntervalRatioJson;
+    }
+
+
 }

+ 22 - 0
ruixuan-live/src/main/java/com/ruixuan/jiaoyang/mapper/JiaoYangReportMapper.java

@@ -18,4 +18,26 @@ public interface JiaoYangReportMapper {
     List<JSONObject> promoterStatistics(Map<String, Object> requestMap);
 
     List<JSONObject> getClipCooperation(@Param("date") Long date, @Param("promoterId") Long promoterId, @Param("promoterName") String promoterName);
+
+    JSONObject getOrderTotal(Map<String, Object> requestMap);
+
+    Double getOrderTotalRatio(Map<String, Object> ratioMap);
+
+    JSONObject getServiceAmountTotal(Map<String, Object> requestMap);
+
+    JSONObject getAmountTotal(Map<String, Object> requestMap);
+
+    Double getAmountTotalRatio(Map<String, Object> ratioMap);
+
+    List<JSONObject> getPromoterRankRatioList(Map<String, Object> requestMap);
+
+    List<JSONObject> getPromoterRatioList(Map<String, Object> requestMap);
+
+    List<JSONObject> getOrderRankRatioList(Map<String, Object> requestMap);
+
+    List<JSONObject> getOrderRankList(Map<String, Object> requestMap);
+
+    List<JSONObject> indexStatistics(Map<String, Object> requestMap);
+
+    JSONObject getTimeIntervalRatio(Map<String, Object> requestMap);
 }

+ 22 - 0
ruixuan-live/src/main/java/com/ruixuan/jiaoyang/service/IJiaoYangReportService.java

@@ -17,4 +17,26 @@ public interface IJiaoYangReportService {
     List<JSONObject> promoterStatistics(Map<String, Object> requestMap);
 
     List<JSONObject> getClipCooperation(Long date, Long promoterId, String promoterName);
+
+    JSONObject getOrderTotal(Map<String, Object> requestMap);
+
+    Double getOrderTotalRatio(Map<String, Object> ratioMap);
+
+    JSONObject getServiceAmountTotal(Map<String, Object> requestMap);
+
+    JSONObject getAmountTotal(Map<String, Object> requestMap);
+
+    Double getAmountTotalRatio(Map<String, Object> ratioMap);
+
+    List<JSONObject> getPromoterRankRatioList(Map<String, Object> requestMap);
+
+    List<JSONObject> getPromoterRatioList(Map<String, Object> requestMap);
+
+    List<JSONObject> getOrderRankRatioList(Map<String, Object> requestMap);
+
+    List<JSONObject> getOrderRankList(Map<String, Object> requestMap);
+
+    List<JSONObject> indexStatistics(Map<String, Object> requestMap);
+
+    JSONObject getTimeIntervalRatio(Map<String, Object> requestMap);
 }

+ 55 - 0
ruixuan-live/src/main/java/com/ruixuan/jiaoyang/service/impl/JiaoYangReportServiceImpl.java

@@ -43,4 +43,59 @@ public class JiaoYangReportServiceImpl implements IJiaoYangReportService {
     public List<JSONObject> getClipCooperation(Long date, Long promoterId, String promoterName) {
         return jiaoYangReportMapper.getClipCooperation(date, promoterId, promoterName);
     }
+
+    @Override
+    public JSONObject getOrderTotal(Map<String, Object> requestMap) {
+        return jiaoYangReportMapper.getOrderTotal(requestMap);
+    }
+
+    @Override
+    public Double getOrderTotalRatio(Map<String, Object> ratioMap) {
+        return jiaoYangReportMapper.getOrderTotalRatio(ratioMap);
+    }
+
+    @Override
+    public JSONObject getServiceAmountTotal(Map<String, Object> requestMap) {
+        return jiaoYangReportMapper.getServiceAmountTotal(requestMap);
+    }
+
+    @Override
+    public JSONObject getAmountTotal(Map<String, Object> requestMap) {
+        return jiaoYangReportMapper.getAmountTotal(requestMap);
+    }
+
+    @Override
+    public Double getAmountTotalRatio(Map<String, Object> ratioMap) {
+        return jiaoYangReportMapper.getAmountTotalRatio(ratioMap);
+    }
+
+    @Override
+    public List<JSONObject> getPromoterRankRatioList(Map<String, Object> requestMap) {
+        return jiaoYangReportMapper.getPromoterRankRatioList(requestMap);
+    }
+
+    @Override
+    public List<JSONObject> getPromoterRatioList(Map<String, Object> requestMap) {
+        return jiaoYangReportMapper.getPromoterRatioList(requestMap);
+    }
+
+    @Override
+    public List<JSONObject> getOrderRankRatioList(Map<String, Object> requestMap) {
+        return jiaoYangReportMapper.getOrderRankRatioList(requestMap);
+    }
+
+    @Override
+    public List<JSONObject> getOrderRankList(Map<String, Object> requestMap) {
+        return jiaoYangReportMapper.getOrderRankList(requestMap);
+    }
+
+    @Override
+    public List<JSONObject> indexStatistics(Map<String, Object> requestMap) {
+        return jiaoYangReportMapper.indexStatistics(requestMap);
+    }
+
+    @Override
+    public JSONObject getTimeIntervalRatio(Map<String, Object> requestMap) {
+        return jiaoYangReportMapper.getTimeIntervalRatio(requestMap);
+    }
 }

+ 282 - 1
ruixuan-live/src/main/resources/mapper/jiaoyang/JiaoYangReportMapper.xml

@@ -197,7 +197,7 @@
         then '待确认'
         else '-'
         end
-        )  as 'status',
+        ) as 'status',
         termination_reason as 'terminationReason',
         concat(commission_rate_view,'%') as 'commissionRateView',
         shop_score as 'shopScore',
@@ -220,6 +220,287 @@
             and t1.clipName like concat(concat('%',#{promoterName}),'%')
         </if>
     </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',
+        sum(case when order_status = 80 then 1 else 0 end) as 'invalidOrderNUm'
+        from jy_order_list
+        where 1= 1
+        <if test="start != null and start != ''">
+            and stat_date &gt;= #{start}
+        </if>
+        <if test="end != null and end != ''">
+            and stat_date &lt;= #{end}
+        </if>
+
+
+    </select>
+    <select id="getOrderTotalRatio" resultType="java.lang.Double">
+        select
+        round((t1.oid -t2.oid) / t2.oid , 4) as 'orderTotalRatio'
+        from (select count(oid) as 'oid'
+        from jy_order_list
+        where 1= 1
+        <if test="nowDate != null and nowDate != ''">
+            and stat_date = #{nowDate}
+        </if>
+        <if test="hour != null and hour != ''">
+            and stat_hour &lt;= #{hour}
+        </if>
+        ) t1
+        join (select count(oid) as 'oid'
+        from jy_order_list
+        where 1=1
+        <if test="yesDate != null and yesDate != ''">
+            and stat_date = #{yesDate}
+        </if>
+        <if test="hour != null and hour != ''">
+            and stat_hour &lt;= #{hour}
+        </if>
+        ) t2
+    </select>
+    <select id="getServiceAmountTotal" resultType="com.alibaba.fastjson.JSONObject">
+        select
+        count(distinct clip_user_id) as 'promoterNum',
+        sum(case when send_status = 1 and order_status != 80 then 1 else 0 end) as 'deliveryNum',
+        sum(case when send_status = 0 and order_status != 80 then 1 else 0 end) as 'notDeliveryNum',
+        round(sum(case when send_status = 1 then 1 else 0 end) / sum(case when order_status != 80 then 1 else 0 end),4)
+        as 'deliveryRadio'
+        from jy_order_list
+        where 1= 1
+        <if test="start != null and start != ''">
+            and stat_date &gt;= #{start}
+        </if>
+        <if test="end != null and end != ''">
+            and stat_date &lt;= #{end}
+        </if>
+    </select>
+    <select id="getAmountTotal" resultType="com.alibaba.fastjson.JSONObject">
+        select
+        sum(order_amount) as 'orderAmount',
+        sum(base_amount) as 'baseAmount',
+        sum(case when order_status != 80 then regimental_promotion_amount else 0 end) as 'regimentalPromotionAmount',
+        sum(case when order_status != 80 then total_regimental_settle_amount else 0 end) as
+        'totalRegimentalSettleAmount'
+        from jy_order_list
+        where 1= 1
+        <if test="start != null and start != ''">
+            and stat_date &gt;= #{start}
+        </if>
+        <if test="end != null and end != ''">
+            and stat_date &lt;= #{end}
+        </if>
+
+    </select>
+    <select id="getAmountTotalRatio" resultType="java.lang.Double">
+        select
+        round((t1.payAmount -t2.payAmount) / t2.payAmount , 4) as 'amountTotalRatio'
+        from (select sum(pay_amount) as 'payAmount'
+        from jy_order_list
+        where 1= 1
+        <if test="nowDate != null and nowDate != ''">
+            and stat_date = #{nowDate}
+        </if>
+        <if test="hour != null and hour != ''">
+            and stat_hour &lt;= #{hour}
+        </if>
+        ) t1
+        join (select sum(pay_amount) as 'payAmount'
+        from jy_order_list
+        where 1=1
+        <if test="yesDate != null and yesDate != ''">
+            and stat_date = #{yesDate}
+        </if>
+        <if test="hour != null and jhour != ''">
+            and stat_hour &lt;= #{hour}
+        </if>
+        ) t2
+    </select>
+    <select id="getPromoterRankRatioList" resultType="com.alibaba.fastjson.JSONObject">
+        select
+        t1.*,
+        round((t1.orderNum - t2.orderNum) / t2.orderNum,4) as 'radio'
+        from (
+        select
+        clip_user_id as 'promoterId',
+        clip_nick_name as 'promoterNickName',
+        count(oid) as 'orderNum',
+        sum(case when order_status != 80 then 1 else 0 end) as 'validOrderNUm',
+        round(sum(case when order_status != 80 then 1 else 0 end) / count(oid),4) as 'validRadio'
+        from jy_order_list
+        where 1= 1
+        <if test="nowDate != null and nowDate != ''">
+            and stat_date = #{nowDate}
+        </if>
+        <if test="hour != null and hour != ''">
+            and stat_hour &lt;= #{hour}
+        </if>
+        group by clip_user_id
+        ) t1
+        left join (select
+        clip_user_id as 'promoterId',
+        count(oid) as 'orderNum'
+        from jy_order_list
+        where 1=1
+        <if test="yesDate != null and yesDate != ''">
+            and stat_date = #{yesDate}
+        </if>
+        <if test="hour != null and hour != ''">
+            and stat_hour &lt;= #{hour}
+        </if>
+        group by clip_user_id
+        ) t2 on t1.promoterId = t2.promoterId
+        order by t1.orderNum desc
+    </select>
+    <select id="getPromoterRatioList" resultType="com.alibaba.fastjson.JSONObject">
+        select * from (
+        select
+        clip_user_id as 'promoterId',
+        clip_nick_name as 'promoterNickName',
+        count(oid) as 'orderNum',
+        sum(case when order_status != 80 then 1 else 0 end) as 'validOrderNUm',
+        round(sum(case when order_status != 80 then 1 else 0 end) / count(oid),4) as 'validRadio'
+        from jy_order_list
+        where 1= 1
+        <if test="start != null and start != ''">
+            and stat_date &gt;= #{start}
+        </if>
+        <if test="end != null and end != ''">
+            and stat_date &lt;= #{end}
+        </if>
+        group by clip_user_id) t
+        order by t.orderNum desc
+    </select>
+    <select id="getOrderRankRatioList" resultType="com.alibaba.fastjson.JSONObject">
+        select
+        t1.*,
+        round((t1.orderNum - t2.orderNum) / t2.orderNum,4) as 'radio'
+        from (select
+        item_id as 'itemId',
+        item_title as 'itemTitle',
+        image_url as 'imageUrl',
+        count(oid) as 'orderNum',
+        sum(case when order_status != 80 then 1 else 0 end) as 'validOrderNUm',
+        round(sum(case when order_status != 80 then 1 else 0 end) / count(oid),4) as 'validRadio',
+        sum(case when send_status = 1 then 1 else 0 end) as 'deliveryNum',
+        sum(case when send_status = 0 and order_status != 80 then 1 else 0 end) as 'notDeliveryNum',
+        round(sum(case when send_status = 1 then 1 else 0 end) / sum(case when order_status != 80 then 1 else 0 end),4)
+        as 'deliveryRadio'
+        from jy_order_list
+        where 1= 1
+        <if test="nowDate != null and nowDate != ''">
+            and stat_date = #{nowDate}
+        </if>
+        <if test="hour != null and hour != ''">
+            and stat_hour &lt;= #{hour}
+        </if>
+        group by item_id
+        ) t1
+        left join (select
+        item_id as 'itemId',
+        count(oid) as 'orderNum'
+        from jy_order_list
+        where 1=1
+        <if test="yesDate != null and yesDate != ''">
+            and stat_date = #{yesDate}
+        </if>
+        <if test="hour != null and hour != ''">
+            and stat_hour &lt;= #{hour}
+        </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',
+        sum(case when order_status != 80 then 1 else 0 end) as 'validOrderNUm',
+        round(sum(case when order_status != 80 then 1 else 0 end) / count(oid),4) as 'validRadio',
+        sum(case when send_status = 1 and order_status != 80 then 1 else 0 end) as 'deliveryNum',
+        sum(case when send_status = 0 and order_status != 80 then 1 else 0 end) as 'notDeliveryNum',
+        round(sum(case when send_status = 1 and order_status != 80 then 1 else 0 end) / sum(case when order_status != 80
+        then 1 else 0 end),4) as 'deliveryRadio'
+        from jy_order_list
+        where 1= 1
+        <if test="start != null and start != ''">
+            and stat_date &gt;= #{start}
+        </if>
+        <if test="end != null and end != ''">
+            and stat_date &lt;= #{end}
+        </if>
+        group by item_id) t
+        order by t.orderNum desc
+    </select>
+    <select id="indexStatistics" resultType="com.alibaba.fastjson.JSONObject">
+        select date_format(t.stat_date,'%Y-%m-%d') as 'date',
+        <if test="type == 'orderNum' ">
+            count(t.oid) as 'orderNum'
+        </if>
+        <if test="type == 'validOrderNum' ">
+            sum(case when t.order_status = 80 then 1 else 0 end) as 'validOrderNum'
+        </if>
+        <if test="type == 'orderAmount' ">
+            sum(t.order_amount) as 'orderAmount'
+        </if>
+        <if test="type == 'baseAmount' ">
+            sum(t.base_amount) as 'baseAmount'
+        </if>
+        <if test="type == 'deliveryNum' ">
+            sum(case when t.send_status = 1 and t.order_status != 80 then 1 else 0 end) as 'deliveryNum'
+        </if>
+        from (select
+        oid,
+        order_status,
+        order_amount,
+        base_amount,
+        send_status,
+        stat_date
+        from jy_order_list
+        where 1 = 1
+        <if test="start != null and start != ''">
+            and stat_date &gt;= #{start}
+        </if>
+        <if test="end != null and end != ''">
+            and stat_date &lt;= #{end}
+        </if>
+        ) t
+        group by t.stat_date
+        order by t.stat_date asc
+    </select>
+    <select id="getTimeIntervalRatio" resultType="com.alibaba.fastjson.JSONObject">
+        select
+        round((t1.oid -t2.oid) / t2.oid , 4) as 'orderTotalRatio',
+        round((t1.orderAmount -t2.orderAmount) / t2.orderAmount , 4) as 'orderAmountRatio'
+        from (
+        select count(oid) as 'oid',
+        sum(order_amount) as 'orderAmount'
+        from jy_order_list
+        where 1= 1
+        <if test="thisCycleStartTemp != null and thisCycleStartTemp != ''">
+            and stat_date &gt;= #{thisCycleStartTemp}
+        </if>
+        <if test="thisCycleEndTemp != null and thisCycleEndTemp != ''">
+            and stat_date &lt;= #{thisCycleEndTemp}
+        </if>
+        ) t1
+        join (
+        select count(oid) as 'oid',
+        sum(order_amount) as 'orderAmount'
+        from jy_order_list
+        where 1=1
+        <if test="lastCycleStartTemp != null and lastCycleStartTemp != ''">
+            and stat_date &gt;= #{lastCycleStartTemp}
+        </if>
+        <if test="lastCycleStartTemp != null and lastCycleStartTemp != ''">
+            and stat_date &lt;= #{lastCycleEndTemp}
+        </if>
+        ) t2
+    </select>
 
 
 </mapper>