提交 469defd3 authored 作者: 吴德鹏's avatar 吴德鹏

完成首页注册量、订单量、支付笔数统计

上级 c2594372
......@@ -13,6 +13,7 @@ import com.platform.utils.R;
import com.platform.vo.OrderBasicVo;
import com.platform.vo.PlatformOrderVo;
import com.platform.vo.DeliveryOrderVo;
import com.platform.vo.StatisticalVo;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
......@@ -288,7 +289,21 @@ public class TbCfOrderController extends AbstractController {
return R.ok().put("result", res);
}
@GetMapping("/getOrderByDate")
@ResponseBody
public R getOrderByDate(@RequestParam(value = "start", required = false) String start,
@RequestParam(value = "end", required = false) String end) {
List<StatisticalVo> orderList = tbCfOrderListService.getOrderByDate(start, end);
return R.ok().put("list", orderList);
}
@GetMapping("/getOrderPaidByDate")
@ResponseBody
public R getOrderPaidByDate(@RequestParam(value = "start", required = false) String start,
@RequestParam(value = "end", required = false) String end) {
List<StatisticalVo> orderList = tbCfOrderListService.getOrderPaidByDate(start, end);
return R.ok().put("list", orderList);
}
//==========================================================================================================
/**
......
......@@ -2,6 +2,8 @@ package com.platform.dao;
import com.platform.entity.TbCfItemDetailEntity;
import com.platform.entity.TbCfOrderEntity;
import com.platform.vo.StatisticalVo;
import org.apache.ibatis.annotations.Param;
import java.math.BigDecimal;
import java.util.List;
......@@ -83,4 +85,8 @@ public interface TbCfOrderDao extends BaseDao<TbCfOrderEntity> {
//根据订单付款状态查询订单数量
int queryPayCount(String payStatus);
List<StatisticalVo> getOrderByDate(@Param("start") String start, @Param("end") String end);
List<StatisticalVo> getOrderPaidByDate(@Param("start") String start, @Param("end") String end);
}
......@@ -4,6 +4,8 @@ import com.platform.entity.TbCfOrderEntity;
import com.platform.entity.TbCfOrderListEntity;
import com.platform.vo.DeliveryOrderVo;
import com.platform.vo.OrderBasicVo;
import com.platform.vo.StatisticalVo;
import org.apache.ibatis.annotations.Param;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
......@@ -20,12 +22,14 @@ public interface TbCfOrderListService {
/**
* 订单列表(运营)
*
* @return
*/
List<TbCfOrderListEntity> queryOrderList(Map<String, Object> map);
/**
* 分页统计条数
*
* @return
*/
......@@ -49,4 +53,8 @@ public interface TbCfOrderListService {
List<TbCfOrderEntity> queryPayOrderList(@RequestParam("payStatus") String payStatus);
int queryPayCount(String payStatus);
List<StatisticalVo> getOrderByDate(String start, String end);
List<StatisticalVo> getOrderPaidByDate(String start, String end);
}
......@@ -7,6 +7,7 @@ import com.platform.entity.TbCfOrderListEntity;
import com.platform.service.TbCfOrderListService;
import com.platform.vo.DeliveryOrderVo;
import com.platform.vo.OrderBasicVo;
import com.platform.vo.StatisticalVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -102,4 +103,16 @@ public class TbCfOrderListServiceImpl implements TbCfOrderListService {
return tbCfOrderDao.queryPayCount(payStatus);
}
@Override
public List<StatisticalVo> getOrderByDate(String start, String end) {
return tbCfOrderDao.getOrderByDate(start, end);
}
@Override
public List<StatisticalVo> getOrderPaidByDate(String start, String end) {
return tbCfOrderDao.getOrderPaidByDate(start, end);
}
}
......@@ -71,6 +71,42 @@
left join tb_cf_item_order_r i on i.order_id=o.order_id
WHERE 1=1 and i.enable_flag=1 and i.order_item_id = #{orderId}
</select>
<select id="getOrderByDate" resultType="com.platform.vo.StatisticalVo">
SELECT
DATE_FORMAT( order_time, '%Y-%m-%d' ) date,
count( 1 ) num
FROM
tb_cf_order
WHERE
1=1
<if test="start != null and start.trim() != ''">
AND date_format( order_time, '%Y-%m-%d' ) >= #{start}
</if>
<if test="end != null and end.trim() != ''">
AND date_format( order_time, '%Y-%m-%d' ) &lt;= #{end}
</if>
GROUP BY
date
</select>
<select id="getOrderPaidByDate" resultType="com.platform.vo.StatisticalVo">
SELECT
DATE_FORMAT( order_time, '%Y-%m-%d' ) date,
count( 1 ) num
FROM
tb_cf_order
WHERE
1=1
<if test="start != null and start.trim() != ''">
AND date_format( order_time, '%Y-%m-%d' ) >= #{start}
</if>
<if test="end != null and end.trim() != ''">
AND date_format( order_time, '%Y-%m-%d' ) &lt;= #{end}
</if>
AND pay_status=20
GROUP BY
date
</select>
<select id="queryOrderDetail" resultType="com.platform.entity.TbCfOrderEntity">
select
i.order_item_id,
......
......@@ -253,26 +253,105 @@ let app = new Vue({
this.initEchartsMiddleData[0].data = []
let objList = JSON.parse(res).list
objList.map(res => {
console.log('date', res.date)
this.initEchartsMiddleData[0].data.push([res.date, res.num])
})
this.initEchartsMiddle();
})
},
templateMethod1(url) {
$.get(url, res => {
this.initEchartsMiddleData[0].data = []
res.list.map(res => {
console.log('date', res.date)
this.initEchartsMiddleData[0].data.push([res.date, res.num])
})
this.initEchartsMiddle();
})
},
getDayRegistered() {
let endDate = this.getEndDate();
console.log(endDate)
if (this.middleOption[0].isActive) {
let url = '../tbcfuserinfo/getDayRegistered'
this.templateMethod(url);
} else if (this.middleOption[1].isActive) {
} else if (this.middleOption[2].isActive) {
let url = '../tbcforder/getOrderByDate?start=' + endDate;
this.templateMethod1(url);
} else if (this.middleOption[3].isActive) {
let url = '../tbcforder/getOrderPaidByDate?start=' + endDate;
this.templateMethod1(url);
}
},
getWeekRegistered() {
const now = new Date();
let start = new Date();
let end = new Date();
let n = now.getDay();
start.setDate(now.getDate() - n + 1);
end.setDate(now.getDate() - n + 7);
start = start.getFullYear() + "-" + '0' + (start.getMonth() + 1) + "-" + start.getDate();
end = end.getFullYear() + "-" + '0' + (end.getMonth() + 1) + "-" + end.getDate();
console.log('start', start)
console.log('end', end)
if (this.middleOption[0].isActive) {
let url = '../tbcfuserinfo/getWeekRegistered'
this.templateMethod(url);
} else if (this.middleOption[1].isActive) {
} else if (this.middleOption[2].isActive) {
let url = '../tbcforder/getOrderByDate?start=' + start + '&end' + end;
this.templateMethod1(url);
} else if (this.middleOption[3].isActive) {
let url = '../tbcforder/getOrderPaidByDate?start=' + start + '&end' + end;
this.templateMethod1(url);
}
},
getMonthRegistered() {
let end = this.getEndDate()
let start = end.substr(0, end.lastIndexOf("-")) + '-01'
console.log('start', start)
console.log('end', end)
if (this.middleOption[0].isActive) {
let url = '../tbcfuserinfo/getMonthRegistered'
this.templateMethod(url);
} else if (this.middleOption[1].isActive) {
} else if (this.middleOption[2].isActive) {
let url = '../tbcforder/getOrderByDate?start=' + start + '&end' + end;
this.templateMethod1(url);
} else if (this.middleOption[3].isActive) {
let url = '../tbcforder/getOrderPaidByDate?start=' + start + '&end' + end;
this.templateMethod1(url);
}
},
getYearRegistered() {
let end = this.getEndDate();
let start = end.substr(0, end.indexOf('-')) + '-01-01';
console.log('start', start)
console.log('end', end)
if (this.middleOption[0].isActive) {
let url = '../tbcfuserinfo/getYearRegistered'
this.templateMethod(url);
} else if (this.middleOption[1].isActive) {
} else if (this.middleOption[2].isActive) {
let url = '../tbcforder/getOrderByDate?start=' + start + '&end' + end;
this.templateMethod1(url);
} else if (this.middleOption[3].isActive) {
let url = '../tbcforder/getOrderPaidByDate?start=' + start + '&end' + end;
this.templateMethod1(url);
}
},
getEndDate() {
let date = new Date();
let year = date.getFullYear();
let month = date.getMonth() + 1;
let day = date.getDate();
let end = year + "-" + '0' + month + "-" + day
return end;
},
/* 访问量 */
initEchartsPV() {
......@@ -539,14 +618,19 @@ let app = new Vue({
this.middleOption[index].isActive = true;
this.$refs.middleEachrtsTitle.innerText = element.title + '趋势';
// this.initEchartsMiddleData[0].data.push(['2019-10-1'+Math.round(Math.random()*100), Math.round(Math.random()*1000)])
$.get('../tbcfuserinfo/getDailyRegistered', res => {
this.initEchartsMiddleData.data = []
let objList = JSON.parse(res).list
objList.map(res => {
this.initEchartsMiddleData[0].data.push([res.date, res.num])
})
this.initEchartsMiddle();
})
console.log(index)
if (index === 0) {
let url = '../tbcfuserinfo/getDailyRegistered';
this.templateMethod(url);
} else if (index === 1) {
this.initEchartsMiddleData[0].data = []
} else if (index === 2) {
let url = '../tbcforder/getOrderByDate';
this.templateMethod1(url);
} else if (index === 3) {
let url = '../tbcforder/getOrderPaidByDate';
this.templateMethod1(url);
}
},
changeBottomSelect(element, index) {
this.bottomOption.forEach(item => {
......@@ -563,9 +647,32 @@ let app = new Vue({
},
/* 中间模块日期 */
changeDate(e) {
//注册量
if (this.middleOption[0].isActive) {
let url = '../tbcfuserinfo/getRegisteredByDate?start=' + e[0] + '&end=' + e[1];
this.templateMethod(url);
} else if (this.middleOption[1].isActive) {
//访问量
} else if (this.middleOption[2].isActive) {
//订单量
let url = '../tbcforder/getOrderByDate?start=' + e[0] + '&end=' + e[1];
$.get(url, res => {
this.initEchartsMiddleData[0].data = []
res.list.map(res => {
this.initEchartsMiddleData[0].data.push([res.date, res.num])
})
this.initEchartsMiddle();
})
} else if (this.middleOption[3].isActive) {
//成交量
let url = '../tbcforder/getOrderPaidByDate?start=' + e[0] + '&end=' + e[1];
$.get(url, res => {
this.initEchartsMiddleData[0].data = []
res.list.map(res => {
this.initEchartsMiddleData[0].data.push([res.date, res.num])
})
this.initEchartsMiddle();
})
}
}
},
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论