|
@@ -0,0 +1,80 @@
|
|
|
+package com.zkqy.web.controller.homepagestatistics;
|
|
|
+
|
|
|
+
|
|
|
+import com.zkqy.common.core.domain.AjaxResult;
|
|
|
+import com.zkqy.common.utils.SecurityUtils;
|
|
|
+import com.zkqy.system.domain.SysLogininfor;
|
|
|
+import com.zkqy.system.service.ISysOperLogService;
|
|
|
+import com.zkqy.system.service.impl.SysLogininforServiceImpl;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.web.bind.annotation.GetMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
+
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.HashMap;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+import java.util.stream.Collectors;
|
|
|
+
|
|
|
+@RestController
|
|
|
+@RequestMapping("/statistics/info")
|
|
|
+public class StatisticsController {
|
|
|
+
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ISysOperLogService operLogService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private SysLogininforServiceImpl logininforService;
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 操作日志信息统计
|
|
|
+ * Operation information statistics
|
|
|
+ */
|
|
|
+ @GetMapping("/getOperationInformationStatistics")
|
|
|
+ public AjaxResult getOperationInformationStatistics(){
|
|
|
+ Long tenantId = SecurityUtils.getLoginUser().getTenantId();
|
|
|
+ List<Map> list = operLogService.selectOperationInformationStatistics(tenantId);
|
|
|
+ return AjaxResult.success(list);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 操作日志信息统计
|
|
|
+ * Operation information statistics
|
|
|
+ */
|
|
|
+ @GetMapping("/getLoginInformationStatistics")
|
|
|
+ public AjaxResult getLoginInformationStatistics(){
|
|
|
+ SysLogininfor sysLogininfor=new SysLogininfor();
|
|
|
+ sysLogininfor.setTenantId( SecurityUtils.getLoginUser().getTenantId());
|
|
|
+ sysLogininfor.setWhichApplication("1");
|
|
|
+ List<Map> loginInformationStatistics = logininforService.getLoginInformationStatistics(sysLogininfor);
|
|
|
+
|
|
|
+ SysLogininfor sysLogininfor2=new SysLogininfor();
|
|
|
+ sysLogininfor2.setTenantId( SecurityUtils.getLoginUser().getTenantId());
|
|
|
+ sysLogininfor2.setWhichApplication("2");
|
|
|
+ List<Map> loginInformationStatistics1 = logininforService.getLoginInformationStatistics(sysLogininfor2);
|
|
|
+ List<Map> list = new ArrayList<>();
|
|
|
+ HashMap hashMap1=new HashMap();
|
|
|
+ hashMap1.put("name","客户端");
|
|
|
+ hashMap1.put("type","line");
|
|
|
+ hashMap1.put("smooth","true");
|
|
|
+ hashMap1.put("data",loginInformationStatistics.stream().map((item->item.get("daily_login_count"))).collect(Collectors.toList()));
|
|
|
+ hashMap1.put("date",loginInformationStatistics.stream().map((item->item.get("login_date"))).collect(Collectors.toList()));
|
|
|
+ list.add(hashMap1);
|
|
|
+ HashMap hashMap2=new HashMap();
|
|
|
+ hashMap2.put("name","工具端");
|
|
|
+ hashMap2.put("type","line");
|
|
|
+ hashMap2.put("smooth","true");
|
|
|
+ hashMap2.put("data",loginInformationStatistics1.stream().map((item->item.get("daily_login_count"))).collect(Collectors.toList()));
|
|
|
+ hashMap2.put("date",loginInformationStatistics.stream().map((item->item.get("login_date"))).collect(Collectors.toList()));
|
|
|
+ list.add(hashMap2);
|
|
|
+ return AjaxResult.success(list);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+}
|