|
@@ -0,0 +1,66 @@
|
|
1
|
+package com.njyunzhi.pet_identity.controller;
|
|
2
|
+
|
|
3
|
+import com.njyunzhi.pet_identity.common.BaseController;
|
|
4
|
+import com.njyunzhi.pet_identity.common.Constants;
|
|
5
|
+import com.njyunzhi.pet_identity.common.DateUtils;
|
|
6
|
+import com.njyunzhi.pet_identity.common.ResponseBean;
|
|
7
|
+import com.njyunzhi.pet_identity.service.ITaApplicationService;
|
|
8
|
+import com.njyunzhi.pet_identity.service.ITaPetIdentityService;
|
|
9
|
+import com.njyunzhi.pet_identity.vo.StatisValue;
|
|
10
|
+import io.swagger.annotations.Api;
|
|
11
|
+import io.swagger.annotations.ApiOperation;
|
|
12
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
13
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
14
|
+import org.springframework.web.bind.annotation.RequestMethod;
|
|
15
|
+import org.springframework.web.bind.annotation.RestController;
|
|
16
|
+
|
|
17
|
+import java.time.LocalDateTime;
|
|
18
|
+import java.util.ArrayList;
|
|
19
|
+import java.util.List;
|
|
20
|
+
|
|
21
|
+@Api(tags = "查询统计")
|
|
22
|
+@RestController
|
|
23
|
+@RequestMapping("/admin/statis")
|
|
24
|
+public class StatisController extends BaseController {
|
|
25
|
+
|
|
26
|
+ @Autowired
|
|
27
|
+ ITaPetIdentityService iTaPetIdentityService;
|
|
28
|
+
|
|
29
|
+ @Autowired
|
|
30
|
+ ITaApplicationService iTaApplicationService;
|
|
31
|
+
|
|
32
|
+ /**
|
|
33
|
+ * 工作台通用统计
|
|
34
|
+ * @return
|
|
35
|
+ */
|
|
36
|
+ @RequestMapping(value="/common",method= RequestMethod.GET)
|
|
37
|
+ @ApiOperation(value="工作台通用统计", notes = "工作台通用统计", httpMethod = "GET", response = ResponseBean.class)
|
|
38
|
+ public ResponseBean getStatisCommon() throws Exception {
|
|
39
|
+ String today = DateUtils.today();
|
|
40
|
+ LocalDateTime todayStart = DateUtils.getDayStart(today);
|
|
41
|
+ LocalDateTime todayEnd = DateUtils.getDayEnd(today);
|
|
42
|
+
|
|
43
|
+ // 把 today 的日期换成 01 就是月初
|
|
44
|
+ String[] parts = today.split("-");
|
|
45
|
+ parts[2] = "01";
|
|
46
|
+ String monthFirstDay = String.join("-", parts);
|
|
47
|
+ LocalDateTime monthStart = DateUtils.getDayStart(monthFirstDay);
|
|
48
|
+
|
|
49
|
+ int personTotal = iTaPersonService.countRegiste();
|
|
50
|
+ int cartTotal = iTaPetIdentityService.countNotDelete();
|
|
51
|
+ int notAuditNum = iTaApplicationService.countBy("status", Constants.WORKFLOW_STATUS_PROCESSING, true);
|
|
52
|
+ int rejectNum = iTaApplicationService.countBy("verify_status", Constants.AUDIT_STATUS_REJECT, true);
|
|
53
|
+ int todayApplyNum = iTaApplicationService.countBetween(todayStart, todayEnd);
|
|
54
|
+ int monthApplyNum = iTaApplicationService.countBetween(monthStart, todayEnd);
|
|
55
|
+
|
|
56
|
+ List<StatisValue> result = new ArrayList<>();
|
|
57
|
+ result.add(new StatisValue().setName("personTotal").setValue(String.valueOf(personTotal)));
|
|
58
|
+ result.add(new StatisValue().setName("cartTotal").setValue(String.valueOf(cartTotal)));
|
|
59
|
+ result.add(new StatisValue().setName("notAuditNum").setValue(String.valueOf(notAuditNum)));
|
|
60
|
+ result.add(new StatisValue().setName("rejectNum").setValue(String.valueOf(rejectNum)));
|
|
61
|
+ result.add(new StatisValue().setName("todayApplyNum").setValue(String.valueOf(todayApplyNum)));
|
|
62
|
+ result.add(new StatisValue().setName("monthApplyNum").setValue(String.valueOf(monthApplyNum)));
|
|
63
|
+
|
|
64
|
+ return ResponseBean.success(result);
|
|
65
|
+ }
|
|
66
|
+}
|