package org.apereo.cas.web.landtool.controller; import org.apereo.cas.web.landtool.single.service.SingleLoginService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import com.alibaba.fastjson.JSONObject; @RestController @RequestMapping("/onlineuser") public class UserOnlineCountController { @RequestMapping("/getOnlineUser") public String getOnlineUser(){ JSONObject jsonObject=new JSONObject(); jsonObject.put("data", SingleLoginService.set); jsonObject.put("total", SingleLoginService.set.size()); return jsonObject.toJSONString(); } }