| | |
| | | package com.se.system.controller; |
| | | |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.se.common.core.utils.ServletUtils; |
| | | import com.se.common.core.utils.StringUtils; |
| | | import com.se.common.core.utils.ip.IpUtils; |
| | | import com.se.common.core.web.controller.BaseController; |
| | | import com.se.common.core.web.domain.AjaxResult; |
| | | import com.se.common.core.web.page.TableDataInfo; |
| | | import com.se.common.log.annotation.Log; |
| | | import com.se.common.log.enums.BusinessType; |
| | | import com.se.common.security.utils.SecurityUtils; |
| | | import com.se.system.api.domain.SysLogininfor; |
| | | import com.se.system.api.domain.SysOperLog; |
| | | import com.se.system.api.model.LoginUser; |
| | | import com.se.system.service.IndexService; |
| | | import com.se.system.service.inte.ISysLogininforService; |
| | | import com.se.system.service.inte.ISysOperLogService; |
| | | import org.springframework.http.HttpMethod; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | |
| | | import javax.annotation.Resource; |
| | | import java.util.Date; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | @RestController |
| | |
| | | @SuppressWarnings("ALL") |
| | | public class IndexController extends BaseController { |
| | | @Resource |
| | | IndexService indexService; |
| | | |
| | | @Resource |
| | | ISysOperLogService operLogService; |
| | | |
| | | @GetMapping("/monitor") |
| | | public Map<String, Object> monitor() { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | @Resource |
| | | ISysLogininforService logininforService; |
| | | |
| | | return map; |
| | | } |
| | | |
| | | @GetMapping("/userList") |
| | | public Map<String, Object> userList() { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | |
| | | return map; |
| | | } |
| | | |
| | | @GetMapping("/uvCount") |
| | | public Map<String, Object> uvCount() { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | |
| | | return map; |
| | | } |
| | | |
| | | // â PVç»è®¡ï¼PVï¼Page Viewï¼ï¼é¡µé¢æµè§éæç¹å»éï¼å³ç½ç«ææé¡µé¢è¢«è®¿é®çæ»æ¬¡æ°ã |
| | | // æ¯æå¼æå·æ°ä¸ä¸ªé¡µé¢ï¼PVå°±ä¼å¢å 䏿¬¡ï¼å¤æ¬¡æå¼æå·æ°åä¸é¡µé¢åæµè§é累计ã |
| | | // PVåæ äºç½ç«ç¨æ·è®¿é®çç½é¡µæ°éï¼æ¯è¡¡éç½ç«æµéçéè¦ææ ä¹ä¸ |
| | | @Log(title = "PVç»è®¡", businessType = BusinessType.OTHER) |
| | | @GetMapping("/pvCount") |
| | | public Map<String, Object> pvCount() { |
| | | Map<String, Object> map = new HashMap<>(); |
| | |
| | | return map; |
| | | } |
| | | |
| | | //@Log(title = "è§è²ç®¡ç", businessType = BusinessType.INSERT) |
| | | // â¡è®¿é®æ°éï¼UVï¼Unique Visitorï¼ï¼ç¬ç«è®¿å®¢æ°ï¼æè®¿é®ç½ç«çç¬ç«ç¨æ·æ°ãä¸å¤©å
åä¸è®¿å®¢å¤æ¬¡è®¿é®åªè®¡ç®ä¸æ¬¡ã |
| | | // å¯ä»¥çè§£æè®¿é®æç½ç«ççµèçæ°éãç½ç«å¤ææ¥è®¿çµèç身份æ¯éè¿æ¥è®¿çµèçcookieså®ç°çã |
| | | // å¦ææ´æ¢äºIPåä½ä¸æ¸
é¤cookiesï¼å访é®ç¸åç½ç«ï¼è¯¥ç½ç«çç»è®¡ä¸UVæ°æ¯ä¸åçã |
| | | @Log(title = "UVç»è®¡", businessType = BusinessType.OTHER) |
| | | @GetMapping("/uvCount") |
| | | public Map<String, Object> uvCount() { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | |
| | | return map; |
| | | } |
| | | |
| | | // â¢æ°å¢ç¨æ·ç»è®¡ï¼ä¸æ®µæ¶é´å
æ°æ³¨åçç¨æ·æ°éãç®åå®ä¸ºä¸å¨å
çæ°å¢ç¨æ·æ°éã |
| | | @Log(title = "æ°å¢ç¨æ·ç»è®¡", businessType = BusinessType.OTHER) |
| | | @GetMapping("/newUserCount") |
| | | public Map<String, Object> newUserCount(Integer day) { |
| | | if (null == day || day < 1) day = 7; |
| | | if (day > 365) day = 365; |
| | | |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("newUserCount", indexService.newUserCount(day)); |
| | | |
| | | return map; |
| | | } |
| | | |
| | | // â£ç¨æ·ç»å½ä¿¡æ¯ï¼ä»¥ä¸å®å½¢å¼å±ç¤ºæ°ç»å½æéåºç»å½çç¨æ·è´¦æ·åæ¶é´ã |
| | | @Log(title = "ç¨æ·ç»å½ä¿¡æ¯", businessType = BusinessType.OTHER) |
| | | @GetMapping("/lastLogin") |
| | | public TableDataInfo lastLogin(SysLogininfor logininfor) { |
| | | startPage(); |
| | | List<SysLogininfor> list = logininforService.selectLogininforList(logininfor); |
| | | |
| | | return getDataTable(list); |
| | | } |
| | | |
| | | // â¤ç¨æ·ç»è®¡æè¡ï¼æ´»è·ç¨æ·ï¼ï¼ä»¥ä¸å®æ¶é´æ®µå
çç»å½æ¶é´æç»å½æ¬¡æ°æåï¼å±ç¤ºåäºåçç¨æ·ä¿¡æ¯ |
| | | @Log(title = "ç¨æ·ç»è®¡æè¡", businessType = BusinessType.OTHER) |
| | | @GetMapping("/userCountList") |
| | | public Map<String, Object> userCountList() { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | |
| | | return map; |
| | | } |
| | | |
| | | // â¥å¸¸ç¨ç³»ç»å±ç¤º/åç³»ç»è®¿é®ä¿¡æ¯ï¼åºäºç¨æ·è®¿é®æ¬¡æ°æåï¼å±ç¤ºåäºä¸ªç³»ç»çæå |
| | | // å¹¶å±ç¤ºå个系ç»ä¸å¤©å
ãä¸å¤©å
ãä¸å¨å
çè®¿é®æ¬¡æ°ããå¯èèæå
¶ä»ææ è¿è¡æåå±ç¤ºã |
| | | @Log(title = "ç¨æ·ç»è®¡æè¡", businessType = BusinessType.OTHER) |
| | | @GetMapping("/sysVisitList") |
| | | public Map<String, Object> sysVisitList() { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | |
| | | return map; |
| | | } |
| | | |
| | | @Log(title = "è¿ç»´çæ§", businessType = BusinessType.OTHER) |
| | | @GetMapping("/monitor") |
| | | public Map<String, Object> monitor() { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("cpu", "50%"); |
| | | map.put("mem", "65%"); |
| | | map.put("ratio", "40%"); |
| | | |
| | | return map; |
| | | } |
| | | |
| | | @GetMapping("/addAccessLog") |
| | | public AjaxResult addAccessLog(String title, int status) { |
| | | long start = System.currentTimeMillis(); |
| | |
| | | return toAjax(rows); |
| | | } |
| | | } |
| | | |
| | | |