提交 2fe6ad94 authored 作者: 吴德鹏's avatar 吴德鹏

首页统计

上级 eae44a16
...@@ -319,6 +319,7 @@ public class TbCfOrderController extends AbstractController { ...@@ -319,6 +319,7 @@ public class TbCfOrderController extends AbstractController {
amount = amount.setScale(2, BigDecimal.ROUND_UP); amount = amount.setScale(2, BigDecimal.ROUND_UP);
return R.ok().put("amount", amount); return R.ok().put("amount", amount);
} }
@GetMapping("/getOrderSumAmount") @GetMapping("/getOrderSumAmount")
@ResponseBody @ResponseBody
public R getOrderSumAmount() { public R getOrderSumAmount() {
...@@ -326,6 +327,13 @@ public class TbCfOrderController extends AbstractController { ...@@ -326,6 +327,13 @@ public class TbCfOrderController extends AbstractController {
amount = amount.setScale(2, BigDecimal.ROUND_UP); amount = amount.setScale(2, BigDecimal.ROUND_UP);
return R.ok().put("amount", amount); return R.ok().put("amount", amount);
} }
@GetMapping("/getDayOrderNum")
@ResponseBody
public R getDayOrderNum() {
int dayOrderNum = tbCfOrderService.getDayOrderNum();
return R.ok().put("dayOrderNum", dayOrderNum);
}
//========================================================================================================== //==========================================================================================================
/** /**
......
...@@ -128,7 +128,7 @@ public class TbCfSearchController { ...@@ -128,7 +128,7 @@ public class TbCfSearchController {
*/ */
@RequestMapping("/getTopSearch") @RequestMapping("/getTopSearch")
@ResponseBody @ResponseBody
public R getTopSearch() { public R getTopSearch(@RequestParam Map<String, Object> params) {
TopSearch topSearch = tbCfSearchService.getTopSearch(); TopSearch topSearch = tbCfSearchService.getTopSearch();
......
...@@ -96,4 +96,6 @@ public interface TbCfOrderDao extends BaseDao<TbCfOrderEntity> { ...@@ -96,4 +96,6 @@ public interface TbCfOrderDao extends BaseDao<TbCfOrderEntity> {
BigDecimal getOrderSumAmount(); BigDecimal getOrderSumAmount();
int getDayOrderNum();
} }
...@@ -17,4 +17,6 @@ public interface TbCfSearchDao extends BaseDao<TbCfSearchEntity> { ...@@ -17,4 +17,6 @@ public interface TbCfSearchDao extends BaseDao<TbCfSearchEntity> {
List<SearchKeywords> getSearchKeywords(); List<SearchKeywords> getSearchKeywords();
TopSearch getTopSearch(); TopSearch getTopSearch();
int getTotal();
} }
...@@ -115,4 +115,6 @@ public interface TbCfOrderService { ...@@ -115,4 +115,6 @@ public interface TbCfOrderService {
BigDecimal getAverageSales(); BigDecimal getAverageSales();
BigDecimal getOrderSumAmount(); BigDecimal getOrderSumAmount();
int getDayOrderNum();
} }
...@@ -118,7 +118,7 @@ public class TbCfOrderServiceImpl implements TbCfOrderService { ...@@ -118,7 +118,7 @@ public class TbCfOrderServiceImpl implements TbCfOrderService {
Set<Integer> statusList = new HashSet<>(); Set<Integer> statusList = new HashSet<>();
if (orderItemList != null && orderItemList.size() > 0) { if (orderItemList != null && orderItemList.size() > 0) {
for (TbCfItemDetailEntity itemList : orderItemList) { for (TbCfItemDetailEntity itemList : orderItemList) {
if (itemList!=null){ if (itemList != null) {
TbCfItemOrderREntity tbCfItemOrder = tbCfItemOrderRDao.getOrderItemId(tbCfPlatformOrder.getOrderId(), itemList.getItemId()); TbCfItemOrderREntity tbCfItemOrder = tbCfItemOrderRDao.getOrderItemId(tbCfPlatformOrder.getOrderId(), itemList.getItemId());
Integer orderStatus = tbCfItemOrder.getOrderStatus(); Integer orderStatus = tbCfItemOrder.getOrderStatus();
statusList.add(orderStatus); statusList.add(orderStatus);
...@@ -196,4 +196,10 @@ public class TbCfOrderServiceImpl implements TbCfOrderService { ...@@ -196,4 +196,10 @@ public class TbCfOrderServiceImpl implements TbCfOrderService {
return tbCfOrderDao.getOrderSumAmount(); return tbCfOrderDao.getOrderSumAmount();
} }
@Override
public int getDayOrderNum() {
return tbCfOrderDao.getDayOrderNum();
}
} }
...@@ -8,7 +8,7 @@ package com.platform.vo; ...@@ -8,7 +8,7 @@ package com.platform.vo;
public class TopSearch { public class TopSearch {
private Long total; private Long total;
private Long average; private Double average;
public Long getTotal() { public Long getTotal() {
return total; return total;
...@@ -18,11 +18,11 @@ public class TopSearch { ...@@ -18,11 +18,11 @@ public class TopSearch {
this.total = total; this.total = total;
} }
public Long getAverage() { public Double getAverage() {
return average; return average;
} }
public void setAverage(Long average) { public void setAverage(Double average) {
this.average = average; this.average = average;
} }
} }
...@@ -243,7 +243,12 @@ ...@@ -243,7 +243,12 @@
left join tb_cf_item_detail d on d.item_id=i.item_id left join tb_cf_item_detail d on d.item_id=i.item_id
WHERE 1=1 and i.enable_flag=1 and o.enable_flag=1 WHERE 1=1 and i.enable_flag=1 and o.enable_flag=1
</select> </select>
<select id="getDayOrderNum" resultType="int">
SELECT
count(DISTINCT user_id)
FROM
tb_cf_order where DATE_FORMAT(order_time,'%Y-%m-%d')=CURDATE()
</select>
<insert id="save" parameterType="com.platform.entity.TbCfOrderEntity"> <insert id="save" parameterType="com.platform.entity.TbCfOrderEntity">
insert into tb_cf_order( insert into tb_cf_order(
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
<result property="userId" column="user_id"/> <result property="userId" column="user_id"/>
</resultMap> </resultMap>
<select id="queryObject" resultType="com.platform.entity.TbCfSearchEntity"> <select id="queryObject" resultType="com.platform.entity.TbCfSearchEntity">
select select
`id`, `id`,
`search_keywords`, `search_keywords`,
...@@ -17,55 +17,61 @@ ...@@ -17,55 +17,61 @@
from tb_cf_search from tb_cf_search
where id = #{id} where id = #{id}
</select> </select>
<select id="getSearchKeywords" resultType="com.platform.vo.SearchKeywords"> <select id="getSearchKeywords" resultType="com.platform.vo.SearchKeywords">
SELECT SELECT
search_keywords, search_keywords,
count( DISTINCT user_id ) count count( DISTINCT user_id ) count
FROM FROM
tb_cf_search tb_cf_search
GROUP BY GROUP BY
search_keywords search_keywords
ORDER BY ORDER BY
count DESC count DESC
</select> <if test="offset != null and limit != null">
<select id="queryList" resultType="com.platform.entity.TbCfSearchEntity"> limit #{offset}, #{limit}
select </if>
`id`, </select>
`search_keywords`, <select id="queryList" resultType="com.platform.entity.TbCfSearchEntity">
`user_id` select
from tb_cf_search `id`,
WHERE 1=1 `search_keywords`,
<if test="name != null and name.trim() != ''"> `user_id`
AND name LIKE concat('%',#{name},'%') from tb_cf_search
</if> WHERE 1=1
<if test="name != null and name.trim() != ''">
AND name LIKE concat('%',#{name},'%')
</if>
<choose> <choose>
<when test="sidx != null and sidx.trim() != ''"> <when test="sidx != null and sidx.trim() != ''">
order by ${sidx} ${order} order by ${sidx} ${order}
</when> </when>
<otherwise> <otherwise>
order by id desc order by id desc
</otherwise> </otherwise>
</choose> </choose>
<if test="offset != null and limit != null"> <if test="offset != null and limit != null">
limit #{offset}, #{limit} limit #{offset}, #{limit}
</if> </if>
</select> </select>
<select id="getTopSearch" resultType="com.platform.vo.TopSearch"> <select id="getTopSearch" resultType="com.platform.vo.TopSearch">
SELECT SELECT
count( DISTINCT user_id ) total, count( DISTINCT user_id ) total,
count( 1 ) / count( DISTINCT user_id ) average count( 1 ) / count( DISTINCT user_id ) average
FROM FROM
tb_cf_search tb_cf_search
</select> </select>
<select id="queryTotal" resultType="int"> <select id="getTotal" resultType="int">
select count(*) from tb_cf_search select count(DISTINCT search_keywords) from tb_cf_search
WHERE 1=1 </select>
<select id="queryTotal" resultType="int">
select count(*) from tb_cf_search
WHERE 1=1
<if test="name != null and name.trim() != ''"> <if test="name != null and name.trim() != ''">
AND name LIKE concat('%',#{name},'%') AND name LIKE concat('%',#{name},'%')
</if> </if>
</select> </select>
<insert id="save" parameterType="com.platform.entity.TbCfSearchEntity"> <insert id="save" parameterType="com.platform.entity.TbCfSearchEntity">
insert into tb_cf_search( insert into tb_cf_search(
`id`, `id`,
`search_keywords`, `search_keywords`,
...@@ -75,25 +81,25 @@ ...@@ -75,25 +81,25 @@
#{searchKeywords}, #{searchKeywords},
#{userId}) #{userId})
</insert> </insert>
<update id="update" parameterType="com.platform.entity.TbCfSearchEntity"> <update id="update" parameterType="com.platform.entity.TbCfSearchEntity">
update tb_cf_search update tb_cf_search
<set> <set>
<if test="searchKeywords != null">`search_keywords` = #{searchKeywords}, </if> <if test="searchKeywords != null">`search_keywords` = #{searchKeywords},</if>
<if test="userId != null">`user_id` = #{userId}</if> <if test="userId != null">`user_id` = #{userId}</if>
</set> </set>
where id = #{id} where id = #{id}
</update> </update>
<delete id="delete"> <delete id="delete">
delete from tb_cf_search where id = #{value} delete from tb_cf_search where id = #{value}
</delete> </delete>
<delete id="deleteBatch"> <delete id="deleteBatch">
delete from tb_cf_search where id in delete from tb_cf_search where id in
<foreach item="id" collection="array" open="(" separator="," close=")"> <foreach item="id" collection="array" open="(" separator="," close=")">
#{id} #{id}
</foreach> </foreach>
</delete> </delete>
</mapper> </mapper>
\ No newline at end of file
...@@ -2,13 +2,13 @@ ...@@ -2,13 +2,13 @@
#jdbc.username=root #jdbc.username=root
#jdbc.password=root #jdbc.password=root
jdbc.url=jdbc:mysql://47.106.242.175:3306/chinafrica?allowMultiQueries=true&useSSL=false&useUnicode=true&characterEncoding=UTF-8 #jdbc.url=jdbc:mysql://47.106.242.175:3306/chinafrica?allowMultiQueries=true&useSSL=false&useUnicode=true&characterEncoding=UTF-8
jdbc.username=root #jdbc.username=root
jdbc.password=diaoyun666 #jdbc.password=diaoyun666
#jdbc.url: jdbc:mysql://159.138.48.71:3306/chinafrica?useUnicode=true&characterEncoding=UTF-8&rewriteBatchedStatements=true&autoReconnect=true&failOverReadOnly=false&zeroDateTimeBehavior=convertToNull&useSSL=false jdbc.url: jdbc:mysql://159.138.48.71:3306/chinafrica?useUnicode=true&characterEncoding=UTF-8&rewriteBatchedStatements=true&autoReconnect=true&failOverReadOnly=false&zeroDateTimeBehavior=convertToNull&useSSL=false
#jdbc.username: root jdbc.username: root
#jdbc.password: Diaoyunnuli.8 jdbc.password: Diaoyunnuli.8
jdbc.initialSize=5 jdbc.initialSize=5
jdbc.maxActive=30 jdbc.maxActive=30
......
...@@ -2,13 +2,13 @@ ...@@ -2,13 +2,13 @@
#jdbc.username=root #jdbc.username=root
#jdbc.password=root #jdbc.password=root
jdbc.url=jdbc:mysql://47.106.242.175:3306/chinafrica?allowMultiQueries=true&useSSL=false&useUnicode=true&characterEncoding=UTF-8 #jdbc.url=jdbc:mysql://47.106.242.175:3306/chinafrica?allowMultiQueries=true&useSSL=false&useUnicode=true&characterEncoding=UTF-8
jdbc.username=root #jdbc.username=root
jdbc.password=diaoyun666 #jdbc.password=diaoyun666
#jdbc.url: jdbc:mysql://159.138.48.71:3306/chinafrica?useUnicode=true&characterEncoding=UTF-8&rewriteBatchedStatements=true&autoReconnect=true&failOverReadOnly=false&zeroDateTimeBehavior=convertToNull&useSSL=false jdbc.url: jdbc:mysql://159.138.48.71:3306/chinafrica?useUnicode=true&characterEncoding=UTF-8&rewriteBatchedStatements=true&autoReconnect=true&failOverReadOnly=false&zeroDateTimeBehavior=convertToNull&useSSL=false
#jdbc.username: root jdbc.username: root
#jdbc.password: Diaoyunnuli.8 jdbc.password: Diaoyunnuli.8
jdbc.initialSize=5 jdbc.initialSize=5
jdbc.maxActive=30 jdbc.maxActive=30
......
...@@ -584,7 +584,7 @@ ...@@ -584,7 +584,7 @@
<h4 class="m-card-title" ref='userSearchSum'>搜索用户数</h4> <h4 class="m-card-title" ref='userSearchSum'>搜索用户数</h4>
<p> <p>
<span> <span>
8846 {{total}}
</span> </span>
<span> <span>
17.1% 17.1%
...@@ -596,7 +596,7 @@ ...@@ -596,7 +596,7 @@
<h4 class="m-card-title" ref='userSearchPerCapita'>人均搜索次数</h4> <h4 class="m-card-title" ref='userSearchPerCapita'>人均搜索次数</h4>
<p> <p>
<span> <span>
8846 {{average}}
</span> </span>
<span> <span>
17.1% 17.1%
......
...@@ -2,6 +2,8 @@ let app = new Vue({ ...@@ -2,6 +2,8 @@ let app = new Vue({
el: '#app', el: '#app',
data() { data() {
return { return {
total: 0,
average: 0,
category2: null, category2: null,
category3: null, category3: null,
amount: 0, amount: 0,
...@@ -673,14 +675,20 @@ let app = new Vue({ ...@@ -673,14 +675,20 @@ let app = new Vue({
this.$refs.middleEachrtsTitle.innerText = element.title + '趋势'; this.$refs.middleEachrtsTitle.innerText = element.title + '趋势';
// this.initEchartsMiddleData[0].data.push(['2019-10-1'+Math.round(Math.random()*100), Math.round(Math.random()*1000)]) // this.initEchartsMiddleData[0].data.push(['2019-10-1'+Math.round(Math.random()*100), Math.round(Math.random()*1000)])
if (index === 0) { if (index === 0) {
this.initEchartsMiddleData[0].name = '注册量'
let url = '../tbcfuserinfo/getDailyRegistered'; let url = '../tbcfuserinfo/getDailyRegistered';
this.templateMethod(url); this.templateMethod(url);
} else if (index === 1) { } else if (index === 1) {
this.initEchartsMiddleData[0].name = '访问量'
this.initEchartsMiddleData[0].data = [] this.initEchartsMiddleData[0].data = []
} else if (index === 2) { } else if (index === 2) {
this.initEchartsMiddleData[0].name = '订单笔数'
console.log(123345455, this.initEchartsMiddleData[0].name)
let url = '../tbcforder/getOrderByDate'; let url = '../tbcforder/getOrderByDate';
this.templateMethod1(url); this.templateMethod1(url);
} else if (index === 3) { } else if (index === 3) {
this.initEchartsMiddleData[0].name = '成交量'
console.log(123345455, this.initEchartsMiddleData[0].name)
let url = '../tbcforder/getOrderPaidByDate'; let url = '../tbcforder/getOrderPaidByDate';
this.templateMethod1(url); this.templateMethod1(url);
} }
...@@ -693,9 +701,11 @@ let app = new Vue({ ...@@ -693,9 +701,11 @@ let app = new Vue({
if (element.title === '热门搜索') { if (element.title === '热门搜索') {
this.$refs.userSearchSum.innerText = '搜索用户数' this.$refs.userSearchSum.innerText = '搜索用户数'
this.$refs.userSearchPerCapita.innerText = '人均搜索次数' this.$refs.userSearchPerCapita.innerText = '人均搜索次数'
this.getTopSearch();
} else { } else {
this.$refs.userSearchSum.innerText = '下单用户数' this.$refs.userSearchSum.innerText = '下单用户数'
this.$refs.userSearchPerCapita.innerText = '人均流量次数' this.$refs.userSearchPerCapita.innerText = '人均流量次数'
this.getDayOrderNum();
} }
}, },
/* 中间模块日期 */ /* 中间模块日期 */
...@@ -749,6 +759,11 @@ let app = new Vue({ ...@@ -749,6 +759,11 @@ let app = new Vue({
}) })
}) })
}, },
getDayOrderNum() {
$.get('../tbcforder/getDayOrderNum', res => {
this.total = res.dayOrderNum;
})
},
getSearchKeywords() { getSearchKeywords() {
$.get('../tbcfsearch/getSearchKeywords', res => { $.get('../tbcfsearch/getSearchKeywords', res => {
let list = JSON.parse(res).list; let list = JSON.parse(res).list;
...@@ -767,6 +782,12 @@ let app = new Vue({ ...@@ -767,6 +782,12 @@ let app = new Vue({
this.amount = res.amount; this.amount = res.amount;
}) })
}, },
getTopSearch() {
$.get('../tbcfsearch/getTopSearch', res => {
this.total = JSON.parse(res).topSearch.total;
this.average = JSON.parse(res).topSearch.average;
})
},
getCategory() { getCategory() {
$.get('../tbcfgoodstype/queryAll', res => { $.get('../tbcfgoodstype/queryAll', res => {
this.categoryList = res.list; this.categoryList = res.list;
...@@ -789,6 +810,7 @@ let app = new Vue({ ...@@ -789,6 +810,7 @@ let app = new Vue({
this.getOrderPaidNum(); this.getOrderPaidNum();
this.getOrderRate(); this.getOrderRate();
this.getAverageSales(); this.getAverageSales();
this.getTopSearch();
$.get('../tbcfuserinfo/getDayRegistered', res => { $.get('../tbcfuserinfo/getDayRegistered', res => {
let objList = JSON.parse(res).list let objList = JSON.parse(res).list
this.newNum = objList[0].num; this.newNum = objList[0].num;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论