package com.hxzk.controller; import com.hxzk.deo.TbPersonAndDepartment; import com.hxzk.pojo.TbPerson; import com.hxzk.pojo.tb_realpositoin; import com.hxzk.service.PersonService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.RestController; import javax.servlet.http.HttpServletRequest; import java.text.SimpleDateFormat; import java.util.*; @RestController @RequestMapping("/") public class SanWeiController { @Autowired PersonService personService; private Map persons = new HashMap(); @RequestMapping(value = {"/getRealPositionsan2.do"}, method = {RequestMethod.POST, RequestMethod.GET}) @ResponseBody public List getRealPositionsan2(HttpServletRequest request) { List realLocationList = personService.findSanWeiOnline(); return realLocationList; } @RequestMapping(value = {"/getRealPositionsan3.do"}, method = {RequestMethod.POST, RequestMethod.GET}) @ResponseBody public List getRealPositionsan3(HttpServletRequest request) { List realLocationList = personService.findSanWeiOffOnline(); return realLocationList; } public String gettime(){ Date now = new Date(); // 创建日期格式化对象,设置格式为 "yyyy-MM-dd HH:mm" SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm"); // 格式化日期对象,输出字符串结果 String formattedDate = sdf.format(now); return formattedDate; } }