mirror of
https://github.com/201206030/novel-plus.git
synced 2025-07-03 16:06:38 +00:00
后台首页更 新,新增会员总数/作家总数/作品总数/交易总数统计,新增7日内会员新增/作家新增/作品新增/交易新增统计报表
This commit is contained in:
@ -0,0 +1,83 @@
|
||||
package com.java2nb.novel.controller;
|
||||
|
||||
import com.java2nb.common.utils.DateUtils;
|
||||
import com.java2nb.common.utils.PageBean;
|
||||
import com.java2nb.common.utils.Query;
|
||||
import com.java2nb.common.utils.R;
|
||||
import com.java2nb.novel.domain.AuthorCodeDO;
|
||||
import com.java2nb.novel.service.*;
|
||||
import com.java2nb.test.service.OrderService;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.SneakyThrows;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 统计
|
||||
*
|
||||
* @author xiongxy
|
||||
* @email 1179705413@qq.com
|
||||
* @date 2020-12-01 03:40:12
|
||||
*/
|
||||
|
||||
@Controller
|
||||
@RequestMapping("/novel/stat")
|
||||
public class StatController {
|
||||
@Autowired
|
||||
private UserService userService;
|
||||
|
||||
@Autowired
|
||||
private AuthorService authorService;
|
||||
|
||||
@Autowired
|
||||
private BookService bookService;
|
||||
|
||||
@Autowired
|
||||
private PayService orderPayService;
|
||||
|
||||
|
||||
@ResponseBody
|
||||
@GetMapping("/countSta")
|
||||
public R countUser() {
|
||||
Map map = new HashMap<>(0);
|
||||
int userCount = userService.count(map);
|
||||
int authorCount = authorService.count(map);
|
||||
int bookCount = bookService.count(map);
|
||||
int orderCount = orderPayService.count(map);
|
||||
return R.ok().put("userCount",userCount)
|
||||
.put("authorCount",authorCount)
|
||||
.put("bookCount",bookCount)
|
||||
.put("orderCount",orderCount);
|
||||
}
|
||||
|
||||
@ResponseBody
|
||||
@GetMapping("/tableSta")
|
||||
@SneakyThrows
|
||||
public R tableSta() {
|
||||
Date currentDate = new Date();
|
||||
List<String> dateList = DateUtils.getDateList(7,currentDate);
|
||||
Date minDate = new SimpleDateFormat("yyyy-MM-dd").parse(dateList.get(0));
|
||||
Map<Object,Object> userTableSta = userService.tableSta(minDate);
|
||||
Map<Object,Object> bookTableSta = bookService.tableSta(minDate);
|
||||
Map<Object,Object> authorTableSta = authorService.tableSta(minDate);
|
||||
Map<Object,Object> orderTableSta = orderPayService.tableSta(minDate);
|
||||
return R.ok().put("dateList",dateList)
|
||||
.put("userTableSta",userTableSta)
|
||||
.put("bookTableSta",bookTableSta)
|
||||
.put("authorTableSta",authorTableSta)
|
||||
.put("orderTableSta",orderTableSta)
|
||||
;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
Reference in New Issue
Block a user