From ac0c5875bb29f1684cf5641acfaa600f7e3aa8fd Mon Sep 17 00:00:00 2001 From: huanghongfa <18228131219@163.com> Date: 星期二, 22 十二月 2020 18:10:34 +0800 Subject: [PATCH] 修改全局异常 --- springcloud_k8s_panzhihuazhihuishequ/applets/src/main/java/com/panzhihua/applets/api/UserApi.java | 1 springcloud_k8s_panzhihuazhihuishequ/.idea/workspace.xml | 74 ++++++++++++------------------------ springcloud_k8s_panzhihuazhihuishequ/applets/src/main/java/com/panzhihua/applets/exception/GlobalExceptionCapture.java | 20 +++++----- springcloud_k8s_panzhihuazhihuishequ/service_user/src/main/resources/bootstrap.yml | 4 +- 4 files changed, 38 insertions(+), 61 deletions(-) diff --git a/springcloud_k8s_panzhihuazhihuishequ/.idea/workspace.xml b/springcloud_k8s_panzhihuazhihuishequ/.idea/workspace.xml index b8ea8fe..4d42973 100644 --- a/springcloud_k8s_panzhihuazhihuishequ/.idea/workspace.xml +++ b/springcloud_k8s_panzhihuazhihuishequ/.idea/workspace.xml @@ -23,33 +23,9 @@ </component> <component name="ChangeListManager"> <list default="true" id="8ba27629-3e5d-4f42-993e-d0c055bc9371" name="Default Changelist" comment=""> - <change afterPath="$PROJECT_DIR$/service_partybuilding/src/main/java/com/panzhihua/service_dangjian/config/MyMetaObjectHandler.java" afterDir="false" /> - <change afterPath="$PROJECT_DIR$/service_user/src/main/java/com/panzhihua/service_user/config/MyMetaObjectHandler.java" afterDir="false" /> - <change afterPath="$PROJECT_DIR$/service_user/src/main/java/com/panzhihua/service_user/config/MybatisPlusConfig.java" afterDir="false" /> <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" /> - <change beforePath="$PROJECT_DIR$/applets/src/main/java/com/panzhihua/applets/api/CommunityApi.java" beforeDir="false" afterPath="$PROJECT_DIR$/applets/src/main/java/com/panzhihua/applets/api/CommunityApi.java" afterDir="false" /> - <change beforePath="$PROJECT_DIR$/applets/src/main/java/com/panzhihua/applets/api/IndexApi.java" beforeDir="false" afterPath="$PROJECT_DIR$/applets/src/main/java/com/panzhihua/applets/api/IndexApi.java" afterDir="false" /> - <change beforePath="$PROJECT_DIR$/applets/src/main/java/com/panzhihua/applets/api/LoginApi.java" beforeDir="false" afterPath="$PROJECT_DIR$/applets/src/main/java/com/panzhihua/applets/api/LoginApi.java" afterDir="false" /> <change beforePath="$PROJECT_DIR$/applets/src/main/java/com/panzhihua/applets/api/UserApi.java" beforeDir="false" afterPath="$PROJECT_DIR$/applets/src/main/java/com/panzhihua/applets/api/UserApi.java" afterDir="false" /> <change beforePath="$PROJECT_DIR$/applets/src/main/java/com/panzhihua/applets/exception/GlobalExceptionCapture.java" beforeDir="false" afterPath="$PROJECT_DIR$/applets/src/main/java/com/panzhihua/applets/exception/GlobalExceptionCapture.java" afterDir="false" /> - <change beforePath="$PROJECT_DIR$/applets/src/main/resources/bootstrap.yml" beforeDir="false" afterPath="$PROJECT_DIR$/applets/src/main/resources/bootstrap.yml" afterDir="false" /> - <change beforePath="$PROJECT_DIR$/applets_backstage/src/main/resources/bootstrap.yml" beforeDir="false" afterPath="$PROJECT_DIR$/applets_backstage/src/main/resources/bootstrap.yml" afterDir="false" /> - <change beforePath="$PROJECT_DIR$/common/src/main/java/com/panzhihua/common/model/vos/community/ComActEasyPhotoVO.java" beforeDir="false" afterPath="$PROJECT_DIR$/common/src/main/java/com/panzhihua/common/model/vos/community/ComActEasyPhotoVO.java" afterDir="false" /> - <change beforePath="$PROJECT_DIR$/common/src/main/java/com/panzhihua/common/model/vos/community/ComActMicroWishVO.java" beforeDir="false" afterPath="$PROJECT_DIR$/common/src/main/java/com/panzhihua/common/model/vos/community/ComActMicroWishVO.java" afterDir="false" /> - <change beforePath="$PROJECT_DIR$/common/src/main/java/com/panzhihua/common/model/vos/community/ComMngStructHouseVO.java" beforeDir="false" afterPath="$PROJECT_DIR$/common/src/main/java/com/panzhihua/common/model/vos/community/ComMngStructHouseVO.java" afterDir="false" /> - <change beforePath="$PROJECT_DIR$/common/src/main/java/com/panzhihua/common/model/vos/community/ComMngVolunteerMngVO.java" beforeDir="false" afterPath="$PROJECT_DIR$/common/src/main/java/com/panzhihua/common/model/vos/community/ComMngVolunteerMngVO.java" afterDir="false" /> - <change beforePath="$PROJECT_DIR$/common/src/main/java/com/panzhihua/common/model/vos/user/ComMngFamilyInfoVO.java" beforeDir="false" afterPath="$PROJECT_DIR$/common/src/main/java/com/panzhihua/common/model/vos/user/ComMngFamilyInfoVO.java" afterDir="false" /> - <change beforePath="$PROJECT_DIR$/common/src/main/java/com/panzhihua/common/service/community/CommunityService.java" beforeDir="false" afterPath="$PROJECT_DIR$/common/src/main/java/com/panzhihua/common/service/community/CommunityService.java" afterDir="false" /> - <change beforePath="$PROJECT_DIR$/common/target/classes/com/panzhihua/common/model/vos/community/ComActEasyPhotoVO.class" beforeDir="false" afterPath="$PROJECT_DIR$/common/target/classes/com/panzhihua/common/model/vos/community/ComActEasyPhotoVO.class" afterDir="false" /> - <change beforePath="$PROJECT_DIR$/common/target/classes/com/panzhihua/common/model/vos/community/ComActMicroWishVO.class" beforeDir="false" afterPath="$PROJECT_DIR$/common/target/classes/com/panzhihua/common/model/vos/community/ComActMicroWishVO.class" afterDir="false" /> - <change beforePath="$PROJECT_DIR$/common/target/classes/com/panzhihua/common/model/vos/community/ComMngStructHouseVO.class" beforeDir="false" afterPath="$PROJECT_DIR$/common/target/classes/com/panzhihua/common/model/vos/community/ComMngStructHouseVO.class" afterDir="false" /> - <change beforePath="$PROJECT_DIR$/common/target/classes/com/panzhihua/common/model/vos/community/ComMngVolunteerMngVO.class" beforeDir="false" afterPath="$PROJECT_DIR$/common/target/classes/com/panzhihua/common/model/vos/community/ComMngVolunteerMngVO.class" afterDir="false" /> - <change beforePath="$PROJECT_DIR$/common/target/classes/com/panzhihua/common/model/vos/user/ComMngFamilyInfoVO.class" beforeDir="false" afterPath="$PROJECT_DIR$/common/target/classes/com/panzhihua/common/model/vos/user/ComMngFamilyInfoVO.class" afterDir="false" /> - <change beforePath="$PROJECT_DIR$/common/target/classes/com/panzhihua/common/service/community/CommunityService.class" beforeDir="false" afterPath="$PROJECT_DIR$/common/target/classes/com/panzhihua/common/service/community/CommunityService.class" afterDir="false" /> - <change beforePath="$PROJECT_DIR$/service_community/src/main/java/com/panzhihua/service_community/api/CommunityApi.java" beforeDir="false" afterPath="$PROJECT_DIR$/service_community/src/main/java/com/panzhihua/service_community/api/CommunityApi.java" afterDir="false" /> - <change beforePath="$PROJECT_DIR$/service_community/src/main/resources/bootstrap.yml" beforeDir="false" afterPath="$PROJECT_DIR$/service_community/src/main/resources/bootstrap.yml" afterDir="false" /> - <change beforePath="$PROJECT_DIR$/service_user/src/main/java/com/panzhihua/service_user/api/UserApi.java" beforeDir="false" afterPath="$PROJECT_DIR$/service_user/src/main/java/com/panzhihua/service_user/api/UserApi.java" afterDir="false" /> - <change beforePath="$PROJECT_DIR$/service_user/src/main/java/com/panzhihua/service_user/service/impl/UserServiceImpl.java" beforeDir="false" afterPath="$PROJECT_DIR$/service_user/src/main/java/com/panzhihua/service_user/service/impl/UserServiceImpl.java" afterDir="false" /> <change beforePath="$PROJECT_DIR$/service_user/src/main/resources/bootstrap.yml" beforeDir="false" afterPath="$PROJECT_DIR$/service_user/src/main/resources/bootstrap.yml" afterDir="false" /> </list> <option name="SHOW_DIALOG" value="false" /> @@ -400,7 +376,7 @@ <workItem from="1608371107059" duration="646000" /> <workItem from="1608371917868" duration="79000" /> <workItem from="1608379508016" duration="46000" /> - <workItem from="1608531425658" duration="38249000" /> + <workItem from="1608531425658" duration="41448000" /> </task> <servers /> </component> @@ -452,54 +428,54 @@ <screen x="0" y="0" width="1536" height="824" /> </state> <state x="549" y="167" key="FileChooserDialogImpl/0.0.1536.824@0.0.1536.824" timestamp="1606197830966" /> - <state width="1031" height="342" key="GridCell.Tab.0.bottom" timestamp="1608628027944"> + <state width="1031" height="342" key="GridCell.Tab.0.bottom" timestamp="1608631728646"> <screen x="0" y="0" width="1536" height="824" /> </state> - <state width="1031" height="342" key="GridCell.Tab.0.bottom/0.0.1536.824@0.0.1536.824" timestamp="1608628027944" /> - <state width="1031" height="342" key="GridCell.Tab.0.center" timestamp="1608628027944"> + <state width="1031" height="342" key="GridCell.Tab.0.bottom/0.0.1536.824@0.0.1536.824" timestamp="1608631728646" /> + <state width="1031" height="342" key="GridCell.Tab.0.center" timestamp="1608631728646"> <screen x="0" y="0" width="1536" height="824" /> </state> - <state width="1031" height="342" key="GridCell.Tab.0.center/0.0.1536.824@0.0.1536.824" timestamp="1608628027944" /> - <state width="1031" height="342" key="GridCell.Tab.0.left" timestamp="1608628027944"> + <state width="1031" height="342" key="GridCell.Tab.0.center/0.0.1536.824@0.0.1536.824" timestamp="1608631728646" /> + <state width="1031" height="342" key="GridCell.Tab.0.left" timestamp="1608631728646"> <screen x="0" y="0" width="1536" height="824" /> </state> - <state width="1031" height="342" key="GridCell.Tab.0.left/0.0.1536.824@0.0.1536.824" timestamp="1608628027944" /> - <state width="1031" height="342" key="GridCell.Tab.0.right" timestamp="1608628027944"> + <state width="1031" height="342" key="GridCell.Tab.0.left/0.0.1536.824@0.0.1536.824" timestamp="1608631728646" /> + <state width="1031" height="342" key="GridCell.Tab.0.right" timestamp="1608631728646"> <screen x="0" y="0" width="1536" height="824" /> </state> - <state width="1031" height="342" key="GridCell.Tab.0.right/0.0.1536.824@0.0.1536.824" timestamp="1608628027944" /> - <state width="1031" height="342" key="GridCell.Tab.1.bottom" timestamp="1608628027944"> + <state width="1031" height="342" key="GridCell.Tab.0.right/0.0.1536.824@0.0.1536.824" timestamp="1608631728646" /> + <state width="1031" height="342" key="GridCell.Tab.1.bottom" timestamp="1608631728646"> <screen x="0" y="0" width="1536" height="824" /> </state> - <state width="1031" height="342" key="GridCell.Tab.1.bottom/0.0.1536.824@0.0.1536.824" timestamp="1608628027944" /> - <state width="1031" height="342" key="GridCell.Tab.1.center" timestamp="1608628027944"> + <state width="1031" height="342" key="GridCell.Tab.1.bottom/0.0.1536.824@0.0.1536.824" timestamp="1608631728646" /> + <state width="1031" height="342" key="GridCell.Tab.1.center" timestamp="1608631728646"> <screen x="0" y="0" width="1536" height="824" /> </state> - <state width="1031" height="342" key="GridCell.Tab.1.center/0.0.1536.824@0.0.1536.824" timestamp="1608628027944" /> - <state width="1031" height="342" key="GridCell.Tab.1.left" timestamp="1608628027944"> + <state width="1031" height="342" key="GridCell.Tab.1.center/0.0.1536.824@0.0.1536.824" timestamp="1608631728646" /> + <state width="1031" height="342" key="GridCell.Tab.1.left" timestamp="1608631728646"> <screen x="0" y="0" width="1536" height="824" /> </state> - <state width="1031" height="342" key="GridCell.Tab.1.left/0.0.1536.824@0.0.1536.824" timestamp="1608628027944" /> - <state width="1031" height="342" key="GridCell.Tab.1.right" timestamp="1608628027944"> + <state width="1031" height="342" key="GridCell.Tab.1.left/0.0.1536.824@0.0.1536.824" timestamp="1608631728646" /> + <state width="1031" height="342" key="GridCell.Tab.1.right" timestamp="1608631728646"> <screen x="0" y="0" width="1536" height="824" /> </state> - <state width="1031" height="342" key="GridCell.Tab.1.right/0.0.1536.824@0.0.1536.824" timestamp="1608628027944" /> - <state width="1031" height="342" key="GridCell.Tab.2.bottom" timestamp="1608628027944"> + <state width="1031" height="342" key="GridCell.Tab.1.right/0.0.1536.824@0.0.1536.824" timestamp="1608631728646" /> + <state width="1031" height="342" key="GridCell.Tab.2.bottom" timestamp="1608631728647"> <screen x="0" y="0" width="1536" height="824" /> </state> - <state width="1031" height="342" key="GridCell.Tab.2.bottom/0.0.1536.824@0.0.1536.824" timestamp="1608628027944" /> - <state width="1031" height="342" key="GridCell.Tab.2.center" timestamp="1608628027944"> + <state width="1031" height="342" key="GridCell.Tab.2.bottom/0.0.1536.824@0.0.1536.824" timestamp="1608631728647" /> + <state width="1031" height="342" key="GridCell.Tab.2.center" timestamp="1608631728646"> <screen x="0" y="0" width="1536" height="824" /> </state> - <state width="1031" height="342" key="GridCell.Tab.2.center/0.0.1536.824@0.0.1536.824" timestamp="1608628027944" /> - <state width="1031" height="342" key="GridCell.Tab.2.left" timestamp="1608628027944"> + <state width="1031" height="342" key="GridCell.Tab.2.center/0.0.1536.824@0.0.1536.824" timestamp="1608631728646" /> + <state width="1031" height="342" key="GridCell.Tab.2.left" timestamp="1608631728646"> <screen x="0" y="0" width="1536" height="824" /> </state> - <state width="1031" height="342" key="GridCell.Tab.2.left/0.0.1536.824@0.0.1536.824" timestamp="1608628027944" /> - <state width="1031" height="342" key="GridCell.Tab.2.right" timestamp="1608628027944"> + <state width="1031" height="342" key="GridCell.Tab.2.left/0.0.1536.824@0.0.1536.824" timestamp="1608631728646" /> + <state width="1031" height="342" key="GridCell.Tab.2.right" timestamp="1608631728646"> <screen x="0" y="0" width="1536" height="824" /> </state> - <state width="1031" height="342" key="GridCell.Tab.2.right/0.0.1536.824@0.0.1536.824" timestamp="1608628027944" /> + <state width="1031" height="342" key="GridCell.Tab.2.right/0.0.1536.824@0.0.1536.824" timestamp="1608631728646" /> <state x="299" y="67" key="Maven.ArtifactSearchDialog" timestamp="1606714311663"> <screen x="0" y="0" width="1536" height="824" /> </state> diff --git a/springcloud_k8s_panzhihuazhihuishequ/applets/src/main/java/com/panzhihua/applets/api/UserApi.java b/springcloud_k8s_panzhihuazhihuishequ/applets/src/main/java/com/panzhihua/applets/api/UserApi.java index 1cad8cd..0c7f171 100644 --- a/springcloud_k8s_panzhihuazhihuishequ/applets/src/main/java/com/panzhihua/applets/api/UserApi.java +++ b/springcloud_k8s_panzhihuazhihuishequ/applets/src/main/java/com/panzhihua/applets/api/UserApi.java @@ -132,6 +132,7 @@ if (null==id||0==id) { return R.fail("成员主键不能为空"); } + comMngFamilyInfoVO.setUserId(this.getUserId()); return userService.putFamily(comMngFamilyInfoVO); } } diff --git a/springcloud_k8s_panzhihuazhihuishequ/applets/src/main/java/com/panzhihua/applets/exception/GlobalExceptionCapture.java b/springcloud_k8s_panzhihuazhihuishequ/applets/src/main/java/com/panzhihua/applets/exception/GlobalExceptionCapture.java index 831882d..3ce44d6 100644 --- a/springcloud_k8s_panzhihuazhihuishequ/applets/src/main/java/com/panzhihua/applets/exception/GlobalExceptionCapture.java +++ b/springcloud_k8s_panzhihuazhihuishequ/applets/src/main/java/com/panzhihua/applets/exception/GlobalExceptionCapture.java @@ -54,16 +54,16 @@ return R.fail(ex.getCode(),ex.getMsg()); } - /** - * 全局异常捕捉处理 - * @param ex 所有运行时异常 - * @return R 500 - */ - @ExceptionHandler(value = Exception.class) - public R errorHandler(Exception ex) { - log.error("捕捉到全局异常【{}】",ex.getMessage()); - return R.fail(); - } +// /** +// * 全局异常捕捉处理 +// * @param ex 所有运行时异常 +// * @return R 500 +// */ +// @ExceptionHandler(value = Exception.class) +// public R errorHandler(Exception ex) { +// log.error("捕捉到全局异常【{}】",ex.getMessage()); +// return R.fail(ex.getMessage()); +// } /** * 校验异常 diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_user/src/main/resources/bootstrap.yml b/springcloud_k8s_panzhihuazhihuishequ/service_user/src/main/resources/bootstrap.yml index 194cd85..0316bb5 100644 --- a/springcloud_k8s_panzhihuazhihuishequ/service_user/src/main/resources/bootstrap.yml +++ b/springcloud_k8s_panzhihuazhihuishequ/service_user/src/main/resources/bootstrap.yml @@ -6,9 +6,9 @@ discovery: enabled: true service-id: config # 注册中心的服务名 - profile: test # 指定配置文件的环境 + profile: dev # 指定配置文件的环境 profiles: - active: test + active: dev eureka: client: -- Gitblit v1.7.1