|
@@ -0,0 +1,76 @@
|
|
|
+package com.free.controller;
|
|
|
+
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
+
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
+import com.free.config.ResponseFormat;
|
|
|
+import com.free.service.QuestionService;
|
|
|
+import com.free.service.TransferApplyService;
|
|
|
+import com.free.service.UserService;
|
|
|
+import com.free.utils.JwtUtil;
|
|
|
+
|
|
|
+import io.swagger.annotations.Api;
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
+
|
|
|
+import java.util.Map;
|
|
|
+
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.web.bind.annotation.GetMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestParam;
|
|
|
+
|
|
|
+@RestController
|
|
|
+@RequestMapping("/index")
|
|
|
+@Api(tags = "首页统计")
|
|
|
+public class IndexController {
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private TransferApplyService transferApplyService;
|
|
|
+ @Autowired
|
|
|
+ private QuestionService questionService;
|
|
|
+ @Autowired
|
|
|
+ private UserService userService;
|
|
|
+
|
|
|
+ // 1.转人工申请待处理数量(不区分用户)
|
|
|
+ @ApiOperation("查询当前转人工申请待处理数量")
|
|
|
+ @GetMapping("/needAgreeNum")
|
|
|
+ public Object getNeedAgreeNum() {
|
|
|
+ QueryWrapper qw = new QueryWrapper<>();
|
|
|
+ qw.eq("is_agree", TransferApplyController.TransferApplyNotAgree);
|
|
|
+ Long num = transferApplyService.count(qw);
|
|
|
+ return ResponseFormat.success(num);
|
|
|
+ }
|
|
|
+
|
|
|
+ // 2.转人工申请未结束数量(区分用户,管理员查所有)
|
|
|
+ @ApiOperation("查询当前转人工申请待关闭数量")
|
|
|
+ @GetMapping("/needCloseNum")
|
|
|
+ public Object getNeedCloseNum() {
|
|
|
+ QueryWrapper qw = new QueryWrapper<>();
|
|
|
+ qw.eq("is_agree", TransferApplyController.TransferApplyAgree);
|
|
|
+ qw.eq("is_close", TransferApplyController.TransferApplyNotClose);
|
|
|
+ Map userInfo = JwtUtil.getDetails(null);
|
|
|
+ String type = (String) userInfo.get("type");
|
|
|
+ if (!LoginController.adminLoginType.equals(type)) {
|
|
|
+ String customer_id = (String) userInfo.get("id");
|
|
|
+ qw.eq("customer_id", customer_id);
|
|
|
+ }
|
|
|
+ Long num = transferApplyService.count(qw);
|
|
|
+ return ResponseFormat.success(num);
|
|
|
+ }
|
|
|
+
|
|
|
+ // 3.题库数量
|
|
|
+ @ApiOperation("查询当前题库数量")
|
|
|
+ @GetMapping("/questionNum")
|
|
|
+ public Object getQuestionNum() {
|
|
|
+ Long num = questionService.count();
|
|
|
+ return ResponseFormat.success(num);
|
|
|
+ }
|
|
|
+
|
|
|
+ // 4.用户数量
|
|
|
+ @ApiOperation("查询当前用户总数")
|
|
|
+ @GetMapping("/questionNum")
|
|
|
+ public Object getUserNum() {
|
|
|
+ Long num = userService.count();
|
|
|
+ return ResponseFormat.success(num);
|
|
|
+ }
|
|
|
+}
|