diff --git a/platform-report-api/pom.xml b/platform-report-api/pom.xml
index 9f5e98b..31cd7b2 100644
--- a/platform-report-api/pom.xml
+++ b/platform-report-api/pom.xml
@@ -11,24 +11,87 @@
platform-report-api
-
+
com.lyms.core
platform-common
${project.version}
-
+
+
+ com.lyms.core
+ platform-biz-patient-service
+ ${project.version}
+
+
+
+ dev
+
+
+
+ true
+
+
+
+ ../platform-resource/resources/config-dev.properties
+
+
+
+
+ test
+
+
+ ../platform-resource/resources/config-test.properties
+
+
+
+
+ prod
+
+
+ ../platform-resource/resources/config-product.properties
+
+
+
+
+
+
+ ../platform-resource/resources
+
+
+ **/*
+
+
+ true
+
+
+ src/main/resources
+
+ **/*
+
+
+
+
+
+
+ src/main/resources
+
+ database.properties
+
+ true
+
+
org.apache.maven.plugins
@@ -41,36 +104,4 @@
platform-report-api
-
\ No newline at end of file
diff --git a/platform-report-api/src/main/java/com/lyms/platform/report/web/controller/TestController.java b/platform-report-api/src/main/java/com/lyms/platform/report/web/controller/TestController.java
new file mode 100644
index 0000000..9cf62b3
--- /dev/null
+++ b/platform-report-api/src/main/java/com/lyms/platform/report/web/controller/TestController.java
@@ -0,0 +1,13 @@
+package com.lyms.platform.report.web.controller;
+
+import org.springframework.stereotype.Controller;
+
+/**
+ *
+ *
+ *
+ * Created by Administrator on 2016/4/20 0020.
+ */
+@Controller
+public class TestController {
+}
diff --git a/platform-report-api/src/main/java/com/lyms/platform/report/web/inteceptor/TokenValidateInteceptor.java b/platform-report-api/src/main/java/com/lyms/platform/report/web/inteceptor/TokenValidateInteceptor.java
new file mode 100644
index 0000000..548210b
--- /dev/null
+++ b/platform-report-api/src/main/java/com/lyms/platform/report/web/inteceptor/TokenValidateInteceptor.java
@@ -0,0 +1,94 @@
+
+package com.lyms.platform.report.web.inteceptor;
+
+
+import com.lyms.platform.common.annotation.TokenRequired;
+import com.lyms.platform.common.base.BaseController;
+import com.lyms.platform.common.base.ContextHolder;
+import com.lyms.platform.common.base.LoginContext;
+import com.lyms.platform.common.exception.ParameterException;
+import com.lyms.platform.common.exception.TokenException;
+import com.lyms.platform.common.utils.LogUtil;
+import com.lyms.platform.common.utils.LoginUtil;
+import com.lyms.platform.permission.model.Users;
+import com.lyms.platform.permission.service.UsersService;
+import org.apache.commons.lang.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.method.HandlerMethod;
+import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.lang.annotation.Annotation;
+
+/**
+ * 验证token拦截器
+ *
+ *
+ * -
+ * 1、springmvc中配置TokenValidateInteceptor的拦截
+ * 2、在需要拦截的方法上面配置TokenRequired注解
+ *
+ *
+ *
+ */
+
+public class TokenValidateInteceptor extends HandlerInterceptorAdapter {
+
+ @Autowired
+ private UsersService usersService;
+
+ public static boolean isSiteController(Object handler) {
+ return handler instanceof HandlerMethod && (((HandlerMethod) handler).getBean() instanceof BaseController);
+ }
+
+ @Override
+ public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
+
+ if (!isSiteController(handler))
+ return true;
+ TokenRequired clientRequired = findAnnotation((HandlerMethod) handler, TokenRequired.class);
+ if (null == clientRequired)
+ return true;
+
+ validateToken(request, response);
+
+ return true;
+ }
+
+ private T findAnnotation(HandlerMethod handler, Class annotationType) {
+ T annotation = handler.getBeanType().getAnnotation(annotationType);
+ if (annotation != null)
+ return annotation;
+ return handler.getMethodAnnotation(annotationType);
+ }
+
+ public boolean validateToken(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) {
+ String token = httpServletRequest.getHeader("Authorization");
+ if (StringUtils.isEmpty(token)) {
+ throw new ParameterException();
+ }
+ LoginContext loginContext = LoginUtil.checkLoginState(token);
+ if(!loginContext.isLogin()) {
+ throw new TokenException();
+ }
+ Users users = usersService.getUsersByLoginCenterId(loginContext.getId());
+ if(null == users) {
+ throw new TokenException();
+ }
+ loginContext.setId(users.getId());
+ loginContext.setToken(token);
+ httpServletRequest.setAttribute("loginContext", loginContext);
+
+ LogUtil.tokenInfo(" userId:" + users.getId() + ", ,url:" + httpServletRequest.getRequestURI() + ",method:" + httpServletRequest.getMethod());
+
+ return loginContext.isLogin();
+ }
+
+ @Override
+ public void afterCompletion(
+ HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex)
+ throws Exception {
+ ContextHolder.clean();
+ }
+}
diff --git a/platform-report-api/src/main/resources/spring/applicationContext-mvc.xml b/platform-report-api/src/main/resources/spring/applicationContext-mvc.xml
new file mode 100644
index 0000000..ffb94ff
--- /dev/null
+++ b/platform-report-api/src/main/resources/spring/applicationContext-mvc.xml
@@ -0,0 +1,42 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/platform-report-api/src/main/resources/spring/applicationContext.xml b/platform-report-api/src/main/resources/spring/applicationContext.xml
index 1dc27d6..c997463 100644
--- a/platform-report-api/src/main/resources/spring/applicationContext.xml
+++ b/platform-report-api/src/main/resources/spring/applicationContext.xml
@@ -13,5 +13,5 @@
-
+
\ No newline at end of file
diff --git a/platform-report-api/src/main/resources/spring/spring-mongodb.xml b/platform-report-api/src/main/resources/spring/spring-mongodb.xml
new file mode 100644
index 0000000..32cd518
--- /dev/null
+++ b/platform-report-api/src/main/resources/spring/spring-mongodb.xml
@@ -0,0 +1,54 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/platform-report-api/src/main/webapp/WEB-INF/cxf-servlet.xml b/platform-report-api/src/main/webapp/WEB-INF/cxf-servlet.xml
deleted file mode 100644
index cc10158..0000000
--- a/platform-report-api/src/main/webapp/WEB-INF/cxf-servlet.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-
-
-
-
-
-
-
-
-
-
diff --git a/platform-report-api/src/main/webapp/WEB-INF/web.xml b/platform-report-api/src/main/webapp/WEB-INF/web.xml
index 2c6f850..8ebaefa 100644
--- a/platform-report-api/src/main/webapp/WEB-INF/web.xml
+++ b/platform-report-api/src/main/webapp/WEB-INF/web.xml
@@ -1,56 +1,77 @@
-
+
+
+ contextConfigLocation
+
+ classpath*:/spring/applicationContext.xml
+
+
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
--->
-
- cxf
+
+ 60
+
+
+ log4jConfigLocation
+ classpath:log4j_config.xml
+
- contextConfigLocation
-
- classpath*:/applicationContext.xml
-
-
+ webAppRootKey
+ webapp.report-api
+
+
+ log4jRefreshInterval
+ 60000
+
- Apache CXF Endpoint
- cxf
- cxf
- org.apache.cxf.transport.servlet.CXFServlet
+ dispatcher
+ org.springframework.web.servlet.DispatcherServlet
+
+ contextConfigLocation
+ classpath*:/spring/applicationContext-mvc.xml
+
1
- cxf
- /services/*
+ dispatcher
+ /
-
- 60
-
-
- log4jConfigLocation
- classpath:log4j_config.xml
-
-
- log4jRefreshInterval
- 60000
-
-
- org.springframework.web.context.ContextLoaderListener
-
-
- org.springframework.web.util.Log4jConfigListener
-
-
+
+ HttpMethodFilter
+ org.springframework.web.filter.HttpPutFormContentFilter
+
+
+ HttpMethodFilter
+ /*
+
+
+ encodingFilter
+ org.springframework.web.filter.CharacterEncodingFilter
+
+ encoding
+ UTF-8
+
+
+
+
+ encodingFilter
+ /*
+
+
+ org.springframework.web.context.ContextLoaderListener
+
+
+ org.springframework.web.util.Log4jConfigListener
+
+
\ No newline at end of file