Commit 474c7e9524ed5c95f1fd61b8a55250afcca6f10a
Exists in
master
and in
1 other branch
Merge remote-tracking branch 'origin/master'
Showing 3 changed files
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/RestController.java
View file @
474c7e9
| ... | ... | @@ -2,11 +2,14 @@ |
| 2 | 2 | |
| 3 | 3 | import java.util.List; |
| 4 | 4 | |
| 5 | +import com.lyms.platform.common.constants.ErrorCodeConstants; | |
| 5 | 6 | import com.lyms.platform.common.core.resolve.MessageResolver; |
| 6 | 7 | import com.lyms.platform.common.result.BaseResponse; |
| 8 | +import com.lyms.platform.common.utils.ExceptionUtils; | |
| 7 | 9 | import org.apache.commons.collections.CollectionUtils; |
| 8 | 10 | import org.springframework.beans.factory.annotation.Autowired; |
| 9 | 11 | import org.springframework.http.HttpStatus; |
| 12 | +import org.springframework.http.converter.HttpMessageNotReadableException; | |
| 10 | 13 | import org.springframework.validation.BindException; |
| 11 | 14 | import org.springframework.validation.BindingResult; |
| 12 | 15 | import org.springframework.web.bind.MethodArgumentNotValidException; |
| ... | ... | @@ -28,6 +31,18 @@ |
| 28 | 31 | public BaseResponse validationError(MethodArgumentNotValidException e) { |
| 29 | 32 | return createValidationResponse(e.getBindingResult()); |
| 30 | 33 | } |
| 34 | + | |
| 35 | + @ExceptionHandler(HttpMessageNotReadableException.class) | |
| 36 | + @ResponseBody | |
| 37 | + @ResponseStatus(HttpStatus.BAD_REQUEST) | |
| 38 | + public BaseResponse handException(HttpMessageNotReadableException e){ | |
| 39 | + ExceptionUtils.catchException(e,e.getMessage()); | |
| 40 | + BaseResponse error = new BaseResponse(); | |
| 41 | + error.setErrorcode(ErrorCodeConstants.PARAMETER_ERROR); | |
| 42 | + error.setErrormsg("参数错误"); | |
| 43 | + return error; | |
| 44 | + } | |
| 45 | + | |
| 31 | 46 | |
| 32 | 47 | @ExceptionHandler(BindException.class) |
| 33 | 48 | @ResponseStatus(HttpStatus.OK) |
platform-operate-api/src/main/resources/spring/applicationContext_biz_patient.xml
View file @
474c7e9
| ... | ... | @@ -39,13 +39,29 @@ |
| 39 | 39 | </bean> |
| 40 | 40 | <!--自动代理dao层 --> |
| 41 | 41 | <bean |
| 42 | - class="org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator"> | |
| 42 | + class="org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator" id="autoProxyCreator"> | |
| 43 | 43 | <property name="beanNames" value="*Dao" /> |
| 44 | 44 | <property name="interceptorNames"> |
| 45 | 45 | <list> |
| 46 | 46 | <value>dalInterceptor</value> |
| 47 | 47 | </list> |
| 48 | 48 | </property> |
| 49 | + </bean> | |
| 50 | + | |
| 51 | + <bean | |
| 52 | + class="org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator" id="nameAutoProxyCreator"> | |
| 53 | + <property name="beanNames" value="*Mapper" /> | |
| 54 | + <property name="interceptorNames"> | |
| 55 | + <list> | |
| 56 | + <value>mysqlDalInterceptor</value> | |
| 57 | + </list> | |
| 58 | + </property> | |
| 59 | + </bean> | |
| 60 | + | |
| 61 | + <!-- dal层方法性能统计--> | |
| 62 | + <bean id="mysqlDalInterceptor" | |
| 63 | + class="com.lyms.platform.common.perf.DalMethodInterceptor"> | |
| 64 | + <property name="threshold" value="30" /> | |
| 49 | 65 | </bean> |
| 50 | 66 | <!-- dal层方法性能统计--> |
| 51 | 67 | <bean id="dalInterceptor" |
platform-operate-api/src/main/webapp/WEB-INF/web.xml
View file @
474c7e9
| ... | ... | @@ -87,6 +87,18 @@ |
| 87 | 87 | <url-pattern>/</url-pattern> |
| 88 | 88 | </servlet-mapping> |
| 89 | 89 | <filter> |
| 90 | + <filter-name>perfFilter</filter-name> | |
| 91 | + <filter-class>com.lyms.platform.common.perf.SimpleHttpPerfFilter</filter-class> | |
| 92 | + <init-param> | |
| 93 | + <param-name>fixName</param-name> | |
| 94 | + <param-value>.jsp,.vm,.js,.css</param-value> | |
| 95 | + </init-param> | |
| 96 | + </filter> | |
| 97 | + <filter-mapping> | |
| 98 | + <filter-name>perfFilter</filter-name> | |
| 99 | + <url-pattern>/*</url-pattern> | |
| 100 | + </filter-mapping> | |
| 101 | + <filter> | |
| 90 | 102 | <filter-name>HttpMethodFilter</filter-name> |
| 91 | 103 | <filter-class>org.springframework.web.filter.HttpPutFormContentFilter</filter-class> |
| 92 | 104 | </filter> |