2021-02-20 10:07:25 +08:00
|
|
|
package io.dataease.controller;
|
|
|
|
|
2021-08-11 14:58:29 +08:00
|
|
|
import io.dataease.commons.license.DefaultLicenseService;
|
|
|
|
import io.dataease.commons.license.F2CLicenseResponse;
|
2021-11-11 16:56:54 +08:00
|
|
|
import io.dataease.commons.utils.ServletUtils;
|
|
|
|
import io.dataease.service.panel.PanelLinkService;
|
2021-02-20 10:07:25 +08:00
|
|
|
import org.springframework.stereotype.Controller;
|
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
2021-11-11 16:56:54 +08:00
|
|
|
import org.springframework.web.bind.annotation.PathVariable;
|
2021-02-20 10:07:25 +08:00
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
2021-08-11 14:58:29 +08:00
|
|
|
import javax.annotation.Resource;
|
2021-11-11 16:56:54 +08:00
|
|
|
import javax.servlet.http.Cookie;
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
2021-08-11 14:58:29 +08:00
|
|
|
|
2021-02-20 10:07:25 +08:00
|
|
|
@Controller
|
|
|
|
@RequestMapping
|
|
|
|
public class IndexController {
|
|
|
|
|
2021-08-11 14:58:29 +08:00
|
|
|
@Resource
|
|
|
|
private DefaultLicenseService defaultLicenseService;
|
|
|
|
|
2021-11-11 16:56:54 +08:00
|
|
|
@Resource
|
|
|
|
private PanelLinkService panelLinkService;
|
|
|
|
|
2021-02-20 10:07:25 +08:00
|
|
|
@GetMapping(value = "/")
|
|
|
|
public String index() {
|
|
|
|
return "index.html";
|
|
|
|
}
|
|
|
|
|
|
|
|
@GetMapping(value = "/login")
|
|
|
|
public String login() {
|
2021-03-25 18:58:05 +08:00
|
|
|
return "index.html";
|
|
|
|
}
|
|
|
|
|
|
|
|
@GetMapping("/link")
|
|
|
|
public String link() {
|
|
|
|
return "link.html";
|
2021-02-20 10:07:25 +08:00
|
|
|
}
|
2021-03-25 18:58:05 +08:00
|
|
|
|
|
|
|
@GetMapping("/test")
|
|
|
|
public String test() {
|
|
|
|
return "test.html";
|
|
|
|
}
|
|
|
|
|
2021-08-11 14:58:29 +08:00
|
|
|
@GetMapping("/deApi")
|
|
|
|
public String deApi() {
|
|
|
|
F2CLicenseResponse f2CLicenseResponse = defaultLicenseService.validateLicense();
|
|
|
|
switch (f2CLicenseResponse.getStatus()) {
|
|
|
|
case valid:
|
|
|
|
return "doc.html";
|
|
|
|
default:
|
2021-11-11 16:56:54 +08:00
|
|
|
return "nolic.html";
|
2021-08-11 14:58:29 +08:00
|
|
|
}
|
2021-11-11 16:56:54 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
@GetMapping("/xggznb/{index}")
|
|
|
|
public String xggznb(@PathVariable(value = "index", required = true) Long index) {
|
|
|
|
String url = panelLinkService.getUrlByIndex(index);
|
|
|
|
HttpServletResponse response = ServletUtils.response();
|
|
|
|
String param = url.substring(url.indexOf("?") + 1);
|
|
|
|
Cookie cookie = new Cookie("link", param);
|
|
|
|
response.addCookie(cookie);
|
|
|
|
return url;
|
2021-08-11 14:58:29 +08:00
|
|
|
}
|
|
|
|
|
2021-03-25 18:58:05 +08:00
|
|
|
|
2021-02-20 10:07:25 +08:00
|
|
|
}
|