|
|
@ -1,10 +1,31 @@
|
|
|
|
package ${domain}.action;
|
|
|
|
package ${domain}.action;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import ${domain}.config.ActionConfig;
|
|
|
|
|
|
|
|
import ${domain}.frame.auth.LocalData;
|
|
|
|
|
|
|
|
import ${domain}.frame.auth.Token;
|
|
|
|
|
|
|
|
import ${domain}.frame.base.BaseRequest;
|
|
|
|
|
|
|
|
import ${domain}.frame.base.BaseResponse;
|
|
|
|
|
|
|
|
import ${domain}.frame.base.ErrorType;
|
|
|
|
|
|
|
|
import ${domain}.frame.base.Screen;
|
|
|
|
|
|
|
|
import ${domain}.frame.sse.Sser;
|
|
|
|
|
|
|
|
import ${domain}.frame.utils.AESUtil;
|
|
|
|
|
|
|
|
import ${domain}.frame.utils.LogUtil;
|
|
|
|
|
|
|
|
import ${domain}.frame.utils.MD5Util;
|
|
|
|
|
|
|
|
import ${domain}.frame.utils.MapperUtil;
|
|
|
|
|
|
|
|
import ${domain}.frame.utils.RequestUtil;
|
|
|
|
|
|
|
|
import ${domain}.frame.utils.StringUtil;
|
|
|
|
|
|
|
|
import ${domain}.module.wsys.ent.Visitor;
|
|
|
|
|
|
|
|
import ${domain}.module.wsys.mgr.LogerrManager;
|
|
|
|
|
|
|
|
import ${domain}.module.wsys.mgr.TokensManager;
|
|
|
|
|
|
|
|
import ${domain}.module.wsys.mgr.VisitorManager;
|
|
|
|
|
|
|
|
import ${domain}.module.wsys.req.TokensBuildRequest;
|
|
|
|
|
|
|
|
import ${domain}.module.wsys.req.VisitorFindRequest;
|
|
|
|
|
|
|
|
import ${domain}.module.wsys.rsp.TokensBuildResponse;
|
|
|
|
|
|
|
|
import ${domain}.module.wsys.rsp.VisitorFindResponse;
|
|
|
|
import com.fasterxml.jackson.core.TreeNode;
|
|
|
|
import com.fasterxml.jackson.core.TreeNode;
|
|
|
|
import org.springframework.beans.BeansException;
|
|
|
|
import org.springframework.beans.BeansException;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
|
import org.springframework.http.MediaType;
|
|
|
|
|
|
|
|
import org.springframework.stereotype.Controller;
|
|
|
|
import org.springframework.stereotype.Controller;
|
|
|
|
import org.springframework.ui.Model;
|
|
|
|
import org.springframework.ui.Model;
|
|
|
|
import org.springframework.web.bind.annotation.PathVariable;
|
|
|
|
import org.springframework.web.bind.annotation.PathVariable;
|
|
|
@ -20,45 +41,17 @@ import org.springframework.web.servlet.LocaleResolver;
|
|
|
|
import org.springframework.web.servlet.View;
|
|
|
|
import org.springframework.web.servlet.View;
|
|
|
|
import org.springframework.web.servlet.mvc.method.annotation.SseEmitter;
|
|
|
|
import org.springframework.web.servlet.mvc.method.annotation.SseEmitter;
|
|
|
|
import org.springframework.web.servlet.view.freemarker.FreeMarkerViewResolver;
|
|
|
|
import org.springframework.web.servlet.view.freemarker.FreeMarkerViewResolver;
|
|
|
|
import ${domain}.config.ActionConfig;
|
|
|
|
|
|
|
|
import ${domain}.frame.auth.LocalData;
|
|
|
|
|
|
|
|
import ${domain}.frame.auth.Token;
|
|
|
|
|
|
|
|
import ${domain}.frame.base.BaseRequest;
|
|
|
|
|
|
|
|
import ${domain}.frame.base.BaseResponse;
|
|
|
|
|
|
|
|
import ${domain}.frame.base.ErrorType;
|
|
|
|
|
|
|
|
import ${domain}.frame.base.Screen;
|
|
|
|
|
|
|
|
import ${domain}.frame.sse.Sser;
|
|
|
|
|
|
|
|
import ${domain}.frame.utils.AESUtil;
|
|
|
|
|
|
|
|
import ${domain}.frame.utils.LogUtil;
|
|
|
|
|
|
|
|
import ${domain}.frame.utils.MD5Util;
|
|
|
|
|
|
|
|
import ${domain}.frame.utils.MapperUtil;
|
|
|
|
|
|
|
|
import ${domain}.frame.utils.StringUtil;
|
|
|
|
|
|
|
|
import ${domain}.module.wsys.mgr.LogerrManager;
|
|
|
|
|
|
|
|
<#if project.frameValue() = 1>
|
|
|
|
|
|
|
|
import ${domain}.module.wsys.ent.Visitor;
|
|
|
|
|
|
|
|
import ${domain}.module.wsys.mgr.VisitorManager;
|
|
|
|
|
|
|
|
import ${domain}.module.wsys.req.VisitorFindRequest;
|
|
|
|
|
|
|
|
import ${domain}.module.wsys.req.TokensBuildRequest;
|
|
|
|
|
|
|
|
import ${domain}.module.wsys.rsp.VisitorFindResponse;
|
|
|
|
|
|
|
|
import ${domain}.module.wsys.mgr.TokensManager;
|
|
|
|
|
|
|
|
import ${domain}.module.wsys.req.TokensBuildRequest;
|
|
|
|
|
|
|
|
import ${domain}.module.wsys.rsp.TokensBuildResponse;
|
|
|
|
|
|
|
|
</#if>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
import java.io.File;
|
|
|
|
import java.io.File;
|
|
|
|
import java.io.IOException;
|
|
|
|
|
|
|
|
import java.lang.reflect.InvocationTargetException;
|
|
|
|
import java.lang.reflect.InvocationTargetException;
|
|
|
|
import java.lang.reflect.Method;
|
|
|
|
import java.lang.reflect.Method;
|
|
|
|
import java.lang.reflect.Parameter;
|
|
|
|
import java.lang.reflect.Parameter;
|
|
|
|
import java.util.Locale;
|
|
|
|
import java.util.Locale;
|
|
|
|
import java.util.regex.Matcher;
|
|
|
|
|
|
|
|
import java.util.regex.Pattern;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 全局请求Controller,如果无特殊请求,则不需再增加其他Controller
|
|
|
|
* 全局请求Controller,如果无特殊请求,则不需再增加其他Controller
|
|
|
|
* 全局htm后缀入口{@link GlobalController#action(Model, HttpServletRequest, HttpServletResponse)}
|
|
|
|
* 全局htm后缀入口{@link GlobalController#page(Model, HttpServletRequest, HttpServletResponse)}
|
|
|
|
* 全局ajax入口{@link GlobalController#ajax(String, String, String, HttpServletRequest, HttpServletResponse, String, MultipartFile)}
|
|
|
|
* 全局ajax入口{@link GlobalController#ajax(String, String, String, HttpServletRequest, HttpServletResponse, String, MultipartFile)}
|
|
|
|
* 全局消息订阅{@link GlobalController#sse(String)}
|
|
|
|
* 全局消息订阅{@link GlobalController#sse(String)}
|
|
|
|
* <p>
|
|
|
|
* <p>
|
|
|
@ -101,25 +94,17 @@ public class GlobalController {
|
|
|
|
* @param request
|
|
|
|
* @param request
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@RequestMapping({"/**/*.htm"})
|
|
|
|
@RequestMapping({"/**/*.htm"})
|
|
|
|
public String action(Model model, HttpServletRequest request, HttpServletResponse response) {
|
|
|
|
public String page(Model model, HttpServletRequest request, HttpServletResponse response) {
|
|
|
|
String servletPath = request.getServletPath();// /**/*.htm
|
|
|
|
String servletPath = request.getServletPath();// /**/*.htm
|
|
|
|
String layout = "/layout/default";
|
|
|
|
String layout = "/layout/default";
|
|
|
|
String action = LocalData.getAction();// **/*
|
|
|
|
String page = RequestUtil.getPage();
|
|
|
|
|
|
|
|
|
|
|
|
Pattern compile = Pattern.compile("^/(.+)\\.htm");
|
|
|
|
|
|
|
|
Matcher matcher = compile.matcher(servletPath);
|
|
|
|
|
|
|
|
if (matcher.find()) {
|
|
|
|
|
|
|
|
action = matcher.group(1);
|
|
|
|
|
|
|
|
LocalData.setAction(action);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
LocaleResolver localeResolver = (LocaleResolver) request.getAttribute(DispatcherServlet.LOCALE_RESOLVER_ATTRIBUTE);
|
|
|
|
LocaleResolver localeResolver = (LocaleResolver) request.getAttribute(DispatcherServlet.LOCALE_RESOLVER_ATTRIBUTE);
|
|
|
|
Locale locale = localeResolver.resolveLocale(request);
|
|
|
|
Locale locale = localeResolver.resolveLocale(request);
|
|
|
|
|
|
|
|
|
|
|
|
{//查询screen
|
|
|
|
{//查询screen
|
|
|
|
String[] split = action.split("/");
|
|
|
|
layout = "screen/" + page;
|
|
|
|
layout = "screen" + File.separator + String.join(File.separator, split);
|
|
|
|
|
|
|
|
View view = viewResolver.resolveViewName(layout, locale);
|
|
|
|
View view = viewResolver.resolveViewName(layout, locale);
|
|
|
|
if (view == null) {
|
|
|
|
if (view == null) {
|
|
|
|
response.sendError(HttpServletResponse.SC_NOT_FOUND, "");
|
|
|
|
response.sendError(HttpServletResponse.SC_NOT_FOUND, "");
|
|
|
@ -128,7 +113,7 @@ public class GlobalController {
|
|
|
|
|
|
|
|
|
|
|
|
// 尝试执行Screen执行器(服务器渲染),并返回视图模板
|
|
|
|
// 尝试执行Screen执行器(服务器渲染),并返回视图模板
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
String beanClassName = (ActionConfig.SCREEN_PREFIX + action).toLowerCase();
|
|
|
|
String beanClassName = (ActionConfig.SCREEN_PREFIX + page).toLowerCase();
|
|
|
|
Screen screenExec = LocalData.getApplicationContext().getBean(beanClassName, Screen.class);
|
|
|
|
Screen screenExec = LocalData.getApplicationContext().getBean(beanClassName, Screen.class);
|
|
|
|
screenExec.exec(model, request, response);
|
|
|
|
screenExec.exec(model, request, response);
|
|
|
|
|
|
|
|
|
|
|
@ -142,7 +127,7 @@ public class GlobalController {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
{//查找layout
|
|
|
|
{//查找layout
|
|
|
|
String[] split = action.split("/");
|
|
|
|
String[] split = page.split("/");
|
|
|
|
|
|
|
|
|
|
|
|
int lt = split.length;
|
|
|
|
int lt = split.length;
|
|
|
|
while (lt > 0) {
|
|
|
|
while (lt > 0) {
|
|
|
|