From 3e330ece74a0d9620c5d5f665cc5150de858c5b4 Mon Sep 17 00:00:00 2001 From: shuzheng <469741414@qq.com> Date: Wed, 8 Nov 2017 22:01:11 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8C=89=E7=85=A7Alibaba=20Java=20Coding=20Gui?= =?UTF-8?q?delines=E6=8F=92=E4=BB=B6=E6=89=AB=E6=8F=8F=E7=BB=93=E6=9E=9C?= =?UTF-8?q?=EF=BC=8C=E4=BF=AE=E6=94=B9=E4=BB=A3=E7=A0=81=E8=A7=84=E8=8C=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/constant/ApiResultConstant.java | 3 + .../com/zheng/api/rpc/api/ApiService.java | 5 + .../com/zheng/api/rpc/api/ApiServiceMock.java | 4 +- .../rpc/ZhengApiRpcServiceApplication.java | 13 +- .../api/rpc/service/impl/ApiServiceImpl.java | 35 +-- .../api/server/controller/TestController.java | 2 +- .../jms/DefaultMessageQueueListener.java | 38 ++-- .../admin/controller/ManageController.java | 2 +- .../manage/CmsArticleController.java | 4 +- .../manage/CmsCategoryController.java | 4 +- .../manage/CmsCommentController.java | 4 +- .../controller/manage/CmsMenuController.java | 4 +- .../controller/manage/CmsPageController.java | 4 +- .../manage/CmsSettingController.java | 4 +- .../controller/manage/CmsTagController.java | 4 +- .../controller/manage/CmsTopicController.java | 4 +- .../ManageInterceptor.java | 4 +- .../jms/DefaultMessageQueueListener.java | 10 +- .../src/main/resources/springMVC-servlet.xml | 2 +- .../common/constant/CmsResultConstant.java | 18 ++ .../job/jms/DefaultMessageQueueListener.java | 6 +- .../zheng/cms/rpc/api/CmsArticleService.java | 30 ++- .../cms/rpc/api/CmsArticleServiceMock.java | 10 +- .../rpc/ZhengCmsRpcServiceApplication.java | 6 +- .../impl/CmsArticleCategoryServiceImpl.java | 6 +- .../service/impl/CmsArticleServiceImpl.java | 2 +- .../impl/CmsArticleTagServiceImpl.java | 2 +- .../service/impl/CmsCategoryServiceImpl.java | 2 +- .../impl/CmsCategoryTagServiceImpl.java | 2 +- .../service/impl/CmsCommentServiceImpl.java | 2 +- .../rpc/service/impl/CmsMenuServiceImpl.java | 2 +- .../rpc/service/impl/CmsPageServiceImpl.java | 2 +- .../service/impl/CmsSettingServiceImpl.java | 2 +- .../service/impl/CmsSystemServiceImpl.java | 2 +- .../rpc/service/impl/CmsTagServiceImpl.java | 2 +- .../rpc/service/impl/CmsTopicServiceImpl.java | 2 +- .../cms/web/controller/BlogController.java | 2 +- .../cms/web/controller/IndexController.java | 2 +- .../cms/web/controller/NewsController.java | 2 +- .../cms/web/controller/PageController.java | 2 +- .../cms/web/controller/QaController.java | 2 +- .../cms/web/controller/SearchController.java | 2 +- .../cms/web/controller/TopicController.java | 2 +- .../web/interceptor/CmsWebInterceptor.java | 4 +- .../web/jms/DefaultMessageQueueListener.java | 6 +- .../com/zheng/cms/web/rocketmq/Consumer.java | 53 ++--- .../com/zheng/cms/web/rocketmq/Producer.java | 41 ++-- .../zheng/cms/web/schedule/LongSchedule.java | 5 +- .../zheng/cms/web/schedule/MapSchedule.java | 9 +- .../com/zheng/common/aspect/RpcLogAspect.java | 8 +- .../com/zheng/common/base/BaseController.java | 7 +- .../com/zheng/common/base/BaseInterface.java | 4 +- .../com/zheng/common/base/BaseResult.java | 12 +- .../com/zheng/common/base/BaseService.java | 205 ++++++++++++++---- .../zheng/common/db/DynamicDataSource.java | 78 +++---- .../listener/ApplicationContextListener.java | 12 +- .../zheng/common/plugin/CommentGenerator.java | 2 +- .../EncryptPropertyPlaceholderConfigurer.java | 2 +- .../common/plugin/SerializablePlugin.java | 5 + .../java/com/zheng/common/util/AESUtil.java | 42 ++-- .../com/zheng/common/util/CaptchaUtil.java | 14 +- .../com/zheng/common/util/CookieUtil.java | 4 +- .../java/com/zheng/common/util/JdbcUtil.java | 28 ++- .../java/com/zheng/common/util/JmsUtil.java | 3 + .../java/com/zheng/common/util/MD5Util.java | 6 +- .../common/util/MybatisGeneratorUtil.java | 68 +++--- .../java/com/zheng/common/util/Paginator.java | 35 ++- .../zheng/common/util/PropertiesFileUtil.java | 8 +- .../java/com/zheng/common/util/RedisUtil.java | 35 +-- .../com/zheng/common/util/RequestUtil.java | 2 +- .../com/zheng/common/util/ZhengAdminUtil.java | 12 +- .../zheng/common/util/key/SystemClock.java | 80 +++---- .../src/main/resources/template/Controller.vm | 2 +- .../main/resources/template/ServiceImpl.vm | 2 +- .../demo/web/controller/IndexController.java | 6 +- .../demo/web/interceptor/DemoInterceptor.java | 4 +- .../common/constant/OssResultConstant.java | 7 + .../java/com/zheng/oss/web/QiniuDemo.java | 10 +- .../web/controller/AliyunOssController.java | 2 +- .../oss/web/controller/DemoController.java | 8 +- .../oss/web/service/AliyunOssService.java | 4 +- .../common/constant/PayResultConstant.java | 7 + .../rpc/ZhengPayRpcServiceApplication.java | 6 +- .../impl/PayInOrderDetailServiceImpl.java | 2 +- .../service/impl/PayInOrderServiceImpl.java | 2 +- .../rpc/service/impl/PayMchServiceImpl.java | 2 +- .../impl/PayOutOrderDetailServiceImpl.java | 2 +- .../service/impl/PayOutOrderServiceImpl.java | 2 +- .../rpc/service/impl/PayPayServiceImpl.java | 2 +- .../rpc/service/impl/PayTypeServiceImpl.java | 2 +- .../service/impl/PayVendorServiceImpl.java | 2 +- .../rpc/service/impl/PayVestServiceImpl.java | 2 +- .../constant/UcenterResultConstant.java | 7 + .../rpc/api/UcenterApiServiceMock.java | 2 +- .../ZhengUcenterRpcServiceApplication.java | 6 +- .../service/impl/UcenterApiServiceImpl.java | 2 +- .../service/impl/UcenterOauthServiceImpl.java | 2 +- .../impl/UcenterUserDetailsServiceImpl.java | 2 +- .../impl/UcenterUserLogServiceImpl.java | 2 +- .../impl/UcenterUserOauthServiceImpl.java | 2 +- .../service/impl/UcenterUserServiceImpl.java | 2 +- .../web/controller/SignController.java | 4 +- .../interceptor/UcenterWebInterceptor.java | 4 +- .../upms/client/interceptor/LogAspect.java | 10 +- .../filter/UpmsAuthenticationFilter.java | 26 +-- .../shiro/listener/UpmsSessionListener.java | 8 +- .../upms/client/shiro/realm/UpmsRealm.java | 4 +- .../client/shiro/session/UpmsSession.java | 16 +- .../client/shiro/session/UpmsSessionDao.java | 12 +- .../client/util/RequestParameterUtil.java | 4 +- .../common/constant/UpmsResultConstant.java | 29 +++ .../upms/rpc/api/UpmsApiServiceMock.java | 22 +- .../rpc/api/UpmsPermissionServiceMock.java | 6 +- .../api/UpmsRolePermissionServiceMock.java | 4 +- .../api/UpmsUserOrganizationServiceMock.java | 4 +- .../api/UpmsUserPermissionServiceMock.java | 4 +- .../upms/rpc/api/UpmsUserRoleServiceMock.java | 4 +- .../rpc/ZhengUpmsRpcServiceApplication.java | 6 +- .../rpc/service/impl/UpmsApiServiceImpl.java | 6 +- .../rpc/service/impl/UpmsLogServiceImpl.java | 2 +- .../impl/UpmsOrganizationServiceImpl.java | 2 +- .../impl/UpmsPermissionServiceImpl.java | 34 ++- .../impl/UpmsRolePermissionServiceImpl.java | 2 +- .../rpc/service/impl/UpmsRoleServiceImpl.java | 2 +- .../service/impl/UpmsSystemServiceImpl.java | 2 +- .../impl/UpmsUserOrganizationServiceImpl.java | 2 +- .../impl/UpmsUserPermissionServiceImpl.java | 2 +- .../service/impl/UpmsUserRoleServiceImpl.java | 2 +- .../rpc/service/impl/UpmsUserServiceImpl.java | 2 +- .../com/zheng/upms/server/Initialize.java | 4 +- .../server/controller/ManageController.java | 2 +- .../upms/server/controller/SSOController.java | 4 +- .../controller/manage/UpmsLogController.java | 2 +- .../manage/UpmsOrganizationController.java | 2 +- .../manage/UpmsPermissionController.java | 2 +- .../controller/manage/UpmsRoleController.java | 2 +- .../manage/UpmsSessionController.java | 2 +- .../manage/UpmsSystemController.java | 2 +- .../controller/manage/UpmsUserController.java | 4 +- .../server/interceptor/UpmsInterceptor.java | 4 +- 140 files changed, 841 insertions(+), 569 deletions(-) rename zheng-cms/zheng-cms-admin/src/main/java/com/zheng/cms/admin/{Interceptor => interceptor}/ManageInterceptor.java (87%) diff --git a/zheng-api/zheng-api-common/src/main/java/com/zheng/api/common/constant/ApiResultConstant.java b/zheng-api/zheng-api-common/src/main/java/com/zheng/api/common/constant/ApiResultConstant.java index 39a227c8d..706288711 100644 --- a/zheng-api/zheng-api-common/src/main/java/com/zheng/api/common/constant/ApiResultConstant.java +++ b/zheng-api/zheng-api-common/src/main/java/com/zheng/api/common/constant/ApiResultConstant.java @@ -6,6 +6,9 @@ */ public enum ApiResultConstant { + /** + * 成功 + */ SUCCESS(1, "success"); public int code; diff --git a/zheng-api/zheng-api-rpc-api/src/main/java/com/zheng/api/rpc/api/ApiService.java b/zheng-api/zheng-api-rpc-api/src/main/java/com/zheng/api/rpc/api/ApiService.java index 34ecec73a..ca5d88916 100644 --- a/zheng-api/zheng-api-rpc-api/src/main/java/com/zheng/api/rpc/api/ApiService.java +++ b/zheng-api/zheng-api-rpc-api/src/main/java/com/zheng/api/rpc/api/ApiService.java @@ -6,6 +6,11 @@ */ public interface ApiService { + /** + * hello + * @param name + * @return + */ String hello(String name); } diff --git a/zheng-api/zheng-api-rpc-api/src/main/java/com/zheng/api/rpc/api/ApiServiceMock.java b/zheng-api/zheng-api-rpc-api/src/main/java/com/zheng/api/rpc/api/ApiServiceMock.java index 1be40bede..d2b9be91c 100644 --- a/zheng-api/zheng-api-rpc-api/src/main/java/com/zheng/api/rpc/api/ApiServiceMock.java +++ b/zheng-api/zheng-api-rpc-api/src/main/java/com/zheng/api/rpc/api/ApiServiceMock.java @@ -9,11 +9,11 @@ */ public class ApiServiceMock implements ApiService { - private static Logger _log = LoggerFactory.getLogger(ApiServiceMock.class); + private static final Logger LOGGER = LoggerFactory.getLogger(ApiServiceMock.class); @Override public String hello(String name) { - _log.info("ApiServiceMock => hello"); + LOGGER.info("ApiServiceMock => hello"); return null; } diff --git a/zheng-api/zheng-api-rpc-service/src/main/java/com/zheng/api/rpc/ZhengApiRpcServiceApplication.java b/zheng-api/zheng-api-rpc-service/src/main/java/com/zheng/api/rpc/ZhengApiRpcServiceApplication.java index cdee56684..3004f14f6 100644 --- a/zheng-api/zheng-api-rpc-service/src/main/java/com/zheng/api/rpc/ZhengApiRpcServiceApplication.java +++ b/zheng-api/zheng-api-rpc-service/src/main/java/com/zheng/api/rpc/ZhengApiRpcServiceApplication.java @@ -10,12 +10,11 @@ */ public class ZhengApiRpcServiceApplication { - private static Logger _log = LoggerFactory.getLogger(ZhengApiRpcServiceApplication.class); - - public static void main(String[] args) { - _log.info(">>>>> zheng-api-rpc-service 正在启动 <<<<<"); - new ClassPathXmlApplicationContext("classpath:META-INF/spring/*.xml"); - _log.info(">>>>> zheng-api-rpc-service 启动完成 <<<<<"); - } + private static final Logger LOGGER = LoggerFactory.getLogger(ZhengApiRpcServiceApplication.class); + public static void main(String[] args) { + LOGGER.info(">>>>> zheng-api-rpc-service 正在启动 <<<<<"); + new ClassPathXmlApplicationContext("classpath:META-INF/spring/*.xml"); + LOGGER.info(">>>>> zheng-api-rpc-service 启动完成 <<<<<"); + } } diff --git a/zheng-api/zheng-api-rpc-service/src/main/java/com/zheng/api/rpc/service/impl/ApiServiceImpl.java b/zheng-api/zheng-api-rpc-service/src/main/java/com/zheng/api/rpc/service/impl/ApiServiceImpl.java index c09f9e133..99b195a44 100644 --- a/zheng-api/zheng-api-rpc-service/src/main/java/com/zheng/api/rpc/service/impl/ApiServiceImpl.java +++ b/zheng-api/zheng-api-rpc-service/src/main/java/com/zheng/api/rpc/service/impl/ApiServiceImpl.java @@ -1,11 +1,8 @@ package com.zheng.api.rpc.service.impl; import com.zheng.api.rpc.api.ApiService; -import com.zheng.cms.rpc.api.*; -import com.zheng.upms.rpc.api.*; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; /** * 实现ApiService接口 @@ -13,38 +10,8 @@ */ public class ApiServiceImpl implements ApiService { - private static Logger _log = LoggerFactory.getLogger(ApiServiceImpl.class); + private static final Logger LOGGER = LoggerFactory.getLogger(ApiServiceImpl.class); -// @Autowired -// private UpmsSystemService upmsSystemService; -// -// @Autowired -// private UpmsOrganizationService upmsOrganizationService; -// -// @Autowired -// private UpmsUserService upmsUserService; -// -// @Autowired -// private UpmsRoleService upmsRoleService; -// -// @Autowired -// private UpmsPermissionService upmsPermissionService; -// -// @Autowired -// private UpmsApiService upmsApiService; -// -// @Autowired -// private CmsArticleService cmsArticleService; -// -// @Autowired -// private CmsCategoryService cmsCategoryService; -// -// @Autowired -// private CmsCommentService cmsCommentService; -// -// @Autowired -// private CmsTagService cmsTagService; -// @Override public String hello(String name) { return "hello," + name + "!"; diff --git a/zheng-api/zheng-api-server/src/main/java/com/zheng/api/server/controller/TestController.java b/zheng-api/zheng-api-server/src/main/java/com/zheng/api/server/controller/TestController.java index 1ac2abd65..f0bd2d749 100644 --- a/zheng-api/zheng-api-server/src/main/java/com/zheng/api/server/controller/TestController.java +++ b/zheng-api/zheng-api-server/src/main/java/com/zheng/api/server/controller/TestController.java @@ -21,7 +21,7 @@ @Api(value = "test", description = "test") public class TestController extends BaseController { - private static Logger _log = LoggerFactory.getLogger(TestController.class); + private static final Logger LOGGER = LoggerFactory.getLogger(TestController.class); @Autowired private ApiService apiService; diff --git a/zheng-api/zheng-api-server/src/main/java/com/zheng/api/server/jms/DefaultMessageQueueListener.java b/zheng-api/zheng-api-server/src/main/java/com/zheng/api/server/jms/DefaultMessageQueueListener.java index c5e22580e..5df78798e 100644 --- a/zheng-api/zheng-api-server/src/main/java/com/zheng/api/server/jms/DefaultMessageQueueListener.java +++ b/zheng-api/zheng-api-server/src/main/java/com/zheng/api/server/jms/DefaultMessageQueueListener.java @@ -15,25 +15,27 @@ */ public class DefaultMessageQueueListener implements MessageListener { - private static Logger _log = LoggerFactory.getLogger(DefaultMessageQueueListener.class); + private static final Logger LOGGER = LoggerFactory.getLogger(DefaultMessageQueueListener.class); - @Autowired - ThreadPoolTaskExecutor threadPoolTaskExecutor; + @Autowired + ThreadPoolTaskExecutor threadPoolTaskExecutor; - public void onMessage(final Message message) { - // 使用线程池多线程处理 - threadPoolTaskExecutor.execute(new Runnable() { - public void run() { - if (message instanceof TextMessage) { - TextMessage textMessage = (TextMessage) message; - try { - _log.info("消费:{}", textMessage.getText()); - } catch (Exception e){ - e.printStackTrace(); - } - } - } - }); - } + @Override + public void onMessage(final Message message) { + // 使用线程池多线程处理 + threadPoolTaskExecutor.execute(new Runnable() { + @Override + public void run() { + if (message instanceof TextMessage) { + TextMessage textMessage = (TextMessage) message; + try { + LOGGER.info("消费:{}", textMessage.getText()); + } catch (Exception e) { + e.printStackTrace(); + } + } + } + }); + } } diff --git a/zheng-cms/zheng-cms-admin/src/main/java/com/zheng/cms/admin/controller/ManageController.java b/zheng-cms/zheng-cms-admin/src/main/java/com/zheng/cms/admin/controller/ManageController.java index e274090e7..899428928 100644 --- a/zheng-cms/zheng-cms-admin/src/main/java/com/zheng/cms/admin/controller/ManageController.java +++ b/zheng-cms/zheng-cms-admin/src/main/java/com/zheng/cms/admin/controller/ManageController.java @@ -18,7 +18,7 @@ @Api(value = "后台控制器", description = "后台管理") public class ManageController extends BaseController { - private static Logger _log = LoggerFactory.getLogger(ManageController.class); + private static final Logger LOGGER = LoggerFactory.getLogger(ManageController.class); /** * 后台首页 diff --git a/zheng-cms/zheng-cms-admin/src/main/java/com/zheng/cms/admin/controller/manage/CmsArticleController.java b/zheng-cms/zheng-cms-admin/src/main/java/com/zheng/cms/admin/controller/manage/CmsArticleController.java index a25196984..c8b3707b3 100644 --- a/zheng-cms/zheng-cms-admin/src/main/java/com/zheng/cms/admin/controller/manage/CmsArticleController.java +++ b/zheng-cms/zheng-cms-admin/src/main/java/com/zheng/cms/admin/controller/manage/CmsArticleController.java @@ -37,7 +37,7 @@ @RequestMapping("/manage/article") public class CmsArticleController extends BaseController { - private static Logger _log = LoggerFactory.getLogger(CmsArticleController.class); + private static final Logger LOGGER = LoggerFactory.getLogger(CmsArticleController.class); @Autowired private CmsArticleService cmsArticleService; @@ -67,7 +67,7 @@ public Object list( } List rows = cmsArticleService.selectByExampleForOffsetPage(cmsArticleExample, offset, limit); long total = cmsArticleService.countByExample(cmsArticleExample); - Map result = new HashMap<>(); + Map result = new HashMap<>(2); result.put("rows", rows); result.put("total", total); return result; diff --git a/zheng-cms/zheng-cms-admin/src/main/java/com/zheng/cms/admin/controller/manage/CmsCategoryController.java b/zheng-cms/zheng-cms-admin/src/main/java/com/zheng/cms/admin/controller/manage/CmsCategoryController.java index 4976ee486..216db4670 100644 --- a/zheng-cms/zheng-cms-admin/src/main/java/com/zheng/cms/admin/controller/manage/CmsCategoryController.java +++ b/zheng-cms/zheng-cms-admin/src/main/java/com/zheng/cms/admin/controller/manage/CmsCategoryController.java @@ -34,7 +34,7 @@ @RequestMapping("/manage/category") public class CmsCategoryController extends BaseController { - private static Logger _log = LoggerFactory.getLogger(CmsCategoryController.class); + private static final Logger LOGGER = LoggerFactory.getLogger(CmsCategoryController.class); @Autowired private CmsCategoryService cmsCategoryService; @@ -61,7 +61,7 @@ public Object list( } List rows = cmsCategoryService.selectByExampleForOffsetPage(cmsCategoryExample, offset, limit); long total = cmsCategoryService.countByExample(cmsCategoryExample); - Map result = new HashMap<>(); + Map result = new HashMap<>(2); result.put("rows", rows); result.put("total", total); return result; diff --git a/zheng-cms/zheng-cms-admin/src/main/java/com/zheng/cms/admin/controller/manage/CmsCommentController.java b/zheng-cms/zheng-cms-admin/src/main/java/com/zheng/cms/admin/controller/manage/CmsCommentController.java index 0933ffe0a..86d150e1e 100644 --- a/zheng-cms/zheng-cms-admin/src/main/java/com/zheng/cms/admin/controller/manage/CmsCommentController.java +++ b/zheng-cms/zheng-cms-admin/src/main/java/com/zheng/cms/admin/controller/manage/CmsCommentController.java @@ -30,7 +30,7 @@ @RequestMapping("/manage/comment") public class CmsCommentController extends BaseController { - private static Logger _log = LoggerFactory.getLogger(CmsCommentController.class); + private static final Logger LOGGER = LoggerFactory.getLogger(CmsCommentController.class); @Autowired private CmsCommentService cmsCommentService; @@ -57,7 +57,7 @@ public Object list( } List rows = cmsCommentService.selectByExampleWithBLOBsForOffsetPage(cmsCommentExample, offset, limit); long total = cmsCommentService.countByExample(cmsCommentExample); - Map result = new HashMap<>(); + Map result = new HashMap<>(2); result.put("rows", rows); result.put("total", total); return result; diff --git a/zheng-cms/zheng-cms-admin/src/main/java/com/zheng/cms/admin/controller/manage/CmsMenuController.java b/zheng-cms/zheng-cms-admin/src/main/java/com/zheng/cms/admin/controller/manage/CmsMenuController.java index f9a2af69b..a4243e378 100644 --- a/zheng-cms/zheng-cms-admin/src/main/java/com/zheng/cms/admin/controller/manage/CmsMenuController.java +++ b/zheng-cms/zheng-cms-admin/src/main/java/com/zheng/cms/admin/controller/manage/CmsMenuController.java @@ -34,7 +34,7 @@ @RequestMapping("/manage/menu") public class CmsMenuController extends BaseController { - private static Logger _log = LoggerFactory.getLogger(CmsMenuController.class); + private static final Logger LOGGER = LoggerFactory.getLogger(CmsMenuController.class); @Autowired private CmsMenuService cmsMenuService; @@ -61,7 +61,7 @@ public Object list( } List rows = cmsMenuService.selectByExampleForOffsetPage(cmsMenuExample, offset, limit); long total = cmsMenuService.countByExample(cmsMenuExample); - Map result = new HashMap<>(); + Map result = new HashMap<>(2); result.put("rows", rows); result.put("total", total); return result; diff --git a/zheng-cms/zheng-cms-admin/src/main/java/com/zheng/cms/admin/controller/manage/CmsPageController.java b/zheng-cms/zheng-cms-admin/src/main/java/com/zheng/cms/admin/controller/manage/CmsPageController.java index 0775d7438..69dc4343f 100644 --- a/zheng-cms/zheng-cms-admin/src/main/java/com/zheng/cms/admin/controller/manage/CmsPageController.java +++ b/zheng-cms/zheng-cms-admin/src/main/java/com/zheng/cms/admin/controller/manage/CmsPageController.java @@ -34,7 +34,7 @@ @RequestMapping("/manage/page") public class CmsPageController extends BaseController { - private static Logger _log = LoggerFactory.getLogger(CmsPageController.class); + private static final Logger LOGGER = LoggerFactory.getLogger(CmsPageController.class); @Autowired private CmsPageService cmsPageService; @@ -61,7 +61,7 @@ public Object list( } List rows = cmsPageService.selectByExampleForOffsetPage(cmsPageExample, offset, limit); long total = cmsPageService.countByExample(cmsPageExample); - Map result = new HashMap<>(); + Map result = new HashMap<>(2); result.put("rows", rows); result.put("total", total); return result; diff --git a/zheng-cms/zheng-cms-admin/src/main/java/com/zheng/cms/admin/controller/manage/CmsSettingController.java b/zheng-cms/zheng-cms-admin/src/main/java/com/zheng/cms/admin/controller/manage/CmsSettingController.java index d4dd86bfd..147b3887e 100644 --- a/zheng-cms/zheng-cms-admin/src/main/java/com/zheng/cms/admin/controller/manage/CmsSettingController.java +++ b/zheng-cms/zheng-cms-admin/src/main/java/com/zheng/cms/admin/controller/manage/CmsSettingController.java @@ -35,7 +35,7 @@ @RequestMapping("/manage/setting") public class CmsSettingController extends BaseController { - private static Logger _log = LoggerFactory.getLogger(CmsSettingController.class); + private static final Logger LOGGER = LoggerFactory.getLogger(CmsSettingController.class); @Autowired private CmsSettingService cmsSettingService; @@ -62,7 +62,7 @@ public Object list( } List rows = cmsSettingService.selectByExampleForOffsetPage(cmsSettingExample, offset, limit); long total = cmsSettingService.countByExample(cmsSettingExample); - Map result = new HashMap<>(); + Map result = new HashMap<>(2); result.put("rows", rows); result.put("total", total); return result; diff --git a/zheng-cms/zheng-cms-admin/src/main/java/com/zheng/cms/admin/controller/manage/CmsTagController.java b/zheng-cms/zheng-cms-admin/src/main/java/com/zheng/cms/admin/controller/manage/CmsTagController.java index 54ebf6dd5..a48208df6 100644 --- a/zheng-cms/zheng-cms-admin/src/main/java/com/zheng/cms/admin/controller/manage/CmsTagController.java +++ b/zheng-cms/zheng-cms-admin/src/main/java/com/zheng/cms/admin/controller/manage/CmsTagController.java @@ -34,7 +34,7 @@ @RequestMapping("/manage/tag") public class CmsTagController extends BaseController { - private static Logger _log = LoggerFactory.getLogger(CmsTagController.class); + private static final Logger LOGGER = LoggerFactory.getLogger(CmsTagController.class); @Autowired private CmsTagService cmsTagService; @@ -61,7 +61,7 @@ public Object list( } List rows = cmsTagService.selectByExampleForOffsetPage(cmsTagExample, offset, limit); long total = cmsTagService.countByExample(cmsTagExample); - Map result = new HashMap<>(); + Map result = new HashMap<>(2); result.put("rows", rows); result.put("total", total); return result; diff --git a/zheng-cms/zheng-cms-admin/src/main/java/com/zheng/cms/admin/controller/manage/CmsTopicController.java b/zheng-cms/zheng-cms-admin/src/main/java/com/zheng/cms/admin/controller/manage/CmsTopicController.java index 391ff6239..283d22bbe 100644 --- a/zheng-cms/zheng-cms-admin/src/main/java/com/zheng/cms/admin/controller/manage/CmsTopicController.java +++ b/zheng-cms/zheng-cms-admin/src/main/java/com/zheng/cms/admin/controller/manage/CmsTopicController.java @@ -34,7 +34,7 @@ @RequestMapping("/manage/topic") public class CmsTopicController extends BaseController { - private static Logger _log = LoggerFactory.getLogger(CmsTopicController.class); + private static final Logger LOGGER = LoggerFactory.getLogger(CmsTopicController.class); @Autowired private CmsTopicService cmsTopicService; @@ -61,7 +61,7 @@ public Object list( } List rows = cmsTopicService.selectByExampleForOffsetPage(cmsTopicExample, offset, limit); long total = cmsTopicService.countByExample(cmsTopicExample); - Map result = new HashMap<>(); + Map result = new HashMap<>(2); result.put("rows", rows); result.put("total", total); return result; diff --git a/zheng-cms/zheng-cms-admin/src/main/java/com/zheng/cms/admin/Interceptor/ManageInterceptor.java b/zheng-cms/zheng-cms-admin/src/main/java/com/zheng/cms/admin/interceptor/ManageInterceptor.java similarity index 87% rename from zheng-cms/zheng-cms-admin/src/main/java/com/zheng/cms/admin/Interceptor/ManageInterceptor.java rename to zheng-cms/zheng-cms-admin/src/main/java/com/zheng/cms/admin/interceptor/ManageInterceptor.java index 4c959bb79..107730e1b 100644 --- a/zheng-cms/zheng-cms-admin/src/main/java/com/zheng/cms/admin/Interceptor/ManageInterceptor.java +++ b/zheng-cms/zheng-cms-admin/src/main/java/com/zheng/cms/admin/interceptor/ManageInterceptor.java @@ -1,4 +1,4 @@ -package com.zheng.cms.admin.Interceptor; +package com.zheng.cms.admin.interceptor; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -14,7 +14,7 @@ */ public class ManageInterceptor extends HandlerInterceptorAdapter { - private static Logger _log = LoggerFactory.getLogger(ManageInterceptor.class); + private static final Logger LOGGER = LoggerFactory.getLogger(ManageInterceptor.class); @Override public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { diff --git a/zheng-cms/zheng-cms-admin/src/main/java/com/zheng/cms/admin/jms/DefaultMessageQueueListener.java b/zheng-cms/zheng-cms-admin/src/main/java/com/zheng/cms/admin/jms/DefaultMessageQueueListener.java index eaa9b2fc8..190f0b906 100644 --- a/zheng-cms/zheng-cms-admin/src/main/java/com/zheng/cms/admin/jms/DefaultMessageQueueListener.java +++ b/zheng-cms/zheng-cms-admin/src/main/java/com/zheng/cms/admin/jms/DefaultMessageQueueListener.java @@ -15,19 +15,21 @@ */ public class DefaultMessageQueueListener implements MessageListener { - private static Logger _log = LoggerFactory.getLogger(DefaultMessageQueueListener.class); + private static final Logger LOGGER = LoggerFactory.getLogger(DefaultMessageQueueListener.class); @Autowired ThreadPoolTaskExecutor threadPoolTaskExecutor; - public void onMessage(final Message message) { + @Override + public void onMessage(final Message message) { // 使用线程池多线程处理 threadPoolTaskExecutor.execute(new Runnable() { - public void run() { + @Override + public void run() { if (message instanceof TextMessage) { TextMessage textMessage = (TextMessage) message; try { - _log.info("消费消息:{}", textMessage.getText()); + LOGGER.info("消费消息:{}", textMessage.getText()); } catch (Exception e){ e.printStackTrace(); } diff --git a/zheng-cms/zheng-cms-admin/src/main/resources/springMVC-servlet.xml b/zheng-cms/zheng-cms-admin/src/main/resources/springMVC-servlet.xml index c5d480128..30ff80558 100644 --- a/zheng-cms/zheng-cms-admin/src/main/resources/springMVC-servlet.xml +++ b/zheng-cms/zheng-cms-admin/src/main/resources/springMVC-servlet.xml @@ -19,7 +19,7 @@ - + diff --git a/zheng-cms/zheng-cms-common/src/main/java/com/zheng/cms/common/constant/CmsResultConstant.java b/zheng-cms/zheng-cms-common/src/main/java/com/zheng/cms/common/constant/CmsResultConstant.java index 225db15ef..270335136 100644 --- a/zheng-cms/zheng-cms-common/src/main/java/com/zheng/cms/common/constant/CmsResultConstant.java +++ b/zheng-cms/zheng-cms-common/src/main/java/com/zheng/cms/common/constant/CmsResultConstant.java @@ -6,11 +6,29 @@ */ public enum CmsResultConstant { + /** + * 失败 + */ FAILED(0, "failed"), + + /** + * 成功 + */ SUCCESS(1, "success"), + /** + * 文件类型不支持 + */ FILE_TYPE_ERROR(20001, "File type not supported!"), + + /** + * 无效长度 + */ INVALID_LENGTH(20002, "Invalid length"), + + /** + * 无效参数 + */ INVALID_PARAMETER(20003, "Invalid parameter"); public int code; diff --git a/zheng-cms/zheng-cms-job/src/main/java/com/zheng/cms/job/jms/DefaultMessageQueueListener.java b/zheng-cms/zheng-cms-job/src/main/java/com/zheng/cms/job/jms/DefaultMessageQueueListener.java index 58b7b1218..aeff2824b 100644 --- a/zheng-cms/zheng-cms-job/src/main/java/com/zheng/cms/job/jms/DefaultMessageQueueListener.java +++ b/zheng-cms/zheng-cms-job/src/main/java/com/zheng/cms/job/jms/DefaultMessageQueueListener.java @@ -15,19 +15,21 @@ */ public class DefaultMessageQueueListener implements MessageListener { - private static Logger _log = LoggerFactory.getLogger(DefaultMessageQueueListener.class); + private static final Logger LOGGER = LoggerFactory.getLogger(DefaultMessageQueueListener.class); @Autowired ThreadPoolTaskExecutor threadPoolTaskExecutor; + @Override public void onMessage(final Message message) { // 使用线程池多线程处理 threadPoolTaskExecutor.execute(new Runnable() { + @Override public void run() { TextMessage textMessage = (TextMessage) message; try { String text = textMessage.getText(); - _log.info("消费:{}", text); + LOGGER.info("消费:{}", text); } catch (Exception e) { e.printStackTrace(); } diff --git a/zheng-cms/zheng-cms-rpc-api/src/main/java/com/zheng/cms/rpc/api/CmsArticleService.java b/zheng-cms/zheng-cms-rpc-api/src/main/java/com/zheng/cms/rpc/api/CmsArticleService.java index 64e09bd5d..8b71227fa 100644 --- a/zheng-cms/zheng-cms-rpc-api/src/main/java/com/zheng/cms/rpc/api/CmsArticleService.java +++ b/zheng-cms/zheng-cms-rpc-api/src/main/java/com/zheng/cms/rpc/api/CmsArticleService.java @@ -1,8 +1,8 @@ package com.zheng.cms.rpc.api; -import com.zheng.common.base.BaseService; import com.zheng.cms.dao.model.CmsArticle; import com.zheng.cms.dao.model.CmsArticleExample; +import com.zheng.common.base.BaseService; import java.util.List; @@ -12,16 +12,36 @@ */ public interface CmsArticleService extends BaseService { - // 根据类目获取文章列表 + /** + * 根据类目获取文章列表 + * @param categoryId + * @param offset + * @param limit + * @return + */ List selectCmsArticlesByCategoryId(Integer categoryId, Integer offset, Integer limit); - // 根据类目获取文章数量 + /** + * 根据类目获取文章数量 + * @param categoryId + * @return + */ long countByCategoryId(Integer categoryId); - // 根据标签获取文章列表 + /** + * 根据标签获取文章列表 + * @param tagId + * @param offset + * @param limit + * @return + */ List selectCmsArticlesByTagId(Integer tagId, Integer offset, Integer limit); - // 根据标签获取文章数量 + /** + * 根据标签获取文章数量 + * @param tagId + * @return + */ long countByTagId(Integer tagId); } \ No newline at end of file diff --git a/zheng-cms/zheng-cms-rpc-api/src/main/java/com/zheng/cms/rpc/api/CmsArticleServiceMock.java b/zheng-cms/zheng-cms-rpc-api/src/main/java/com/zheng/cms/rpc/api/CmsArticleServiceMock.java index b0d3b7e9c..1b4cbce08 100644 --- a/zheng-cms/zheng-cms-rpc-api/src/main/java/com/zheng/cms/rpc/api/CmsArticleServiceMock.java +++ b/zheng-cms/zheng-cms-rpc-api/src/main/java/com/zheng/cms/rpc/api/CmsArticleServiceMock.java @@ -15,29 +15,29 @@ */ public class CmsArticleServiceMock extends BaseServiceMock implements CmsArticleService { - private static Logger _log = LoggerFactory.getLogger(CmsArticleServiceMock.class); + private static final Logger LOGGER = LoggerFactory.getLogger(CmsArticleServiceMock.class); @Override public List selectCmsArticlesByCategoryId(Integer categoryId, Integer offset, Integer limit) { - _log.info("CmsArticleServiceMock => getCmsArticlesByCategoryId"); + LOGGER.info("CmsArticleServiceMock => getCmsArticlesByCategoryId"); return null; } @Override public long countByCategoryId(Integer categoryId) { - _log.info("CmsArticleServiceMock => countByCategoryId"); + LOGGER.info("CmsArticleServiceMock => countByCategoryId"); return 0; } @Override public List selectCmsArticlesByTagId(Integer tagId, Integer offset, Integer limit) { - _log.info("CmsArticleServiceMock => getCmsArticlesByCategoryId"); + LOGGER.info("CmsArticleServiceMock => getCmsArticlesByCategoryId"); return null; } @Override public long countByTagId(Integer tagId) { - _log.info("CmsArticleServiceMock => countByTagId"); + LOGGER.info("CmsArticleServiceMock => countByTagId"); return 0; } diff --git a/zheng-cms/zheng-cms-rpc-service/src/main/java/com/zheng/cms/rpc/ZhengCmsRpcServiceApplication.java b/zheng-cms/zheng-cms-rpc-service/src/main/java/com/zheng/cms/rpc/ZhengCmsRpcServiceApplication.java index 8d3aa6387..6ecceb13b 100644 --- a/zheng-cms/zheng-cms-rpc-service/src/main/java/com/zheng/cms/rpc/ZhengCmsRpcServiceApplication.java +++ b/zheng-cms/zheng-cms-rpc-service/src/main/java/com/zheng/cms/rpc/ZhengCmsRpcServiceApplication.java @@ -10,12 +10,12 @@ */ public class ZhengCmsRpcServiceApplication { - private static Logger _log = LoggerFactory.getLogger(ZhengCmsRpcServiceApplication.class); + private static final Logger LOGGER = LoggerFactory.getLogger(ZhengCmsRpcServiceApplication.class); public static void main(String[] args) { - _log.info(">>>>> zheng-cms-rpc-service 正在启动 <<<<<"); + LOGGER.info(">>>>> zheng-cms-rpc-service 正在启动 <<<<<"); new ClassPathXmlApplicationContext("classpath:META-INF/spring/*.xml"); - _log.info(">>>>> zheng-cms-rpc-service 启动完成 <<<<<"); + LOGGER.info(">>>>> zheng-cms-rpc-service 启动完成 <<<<<"); } } diff --git a/zheng-cms/zheng-cms-rpc-service/src/main/java/com/zheng/cms/rpc/service/impl/CmsArticleCategoryServiceImpl.java b/zheng-cms/zheng-cms-rpc-service/src/main/java/com/zheng/cms/rpc/service/impl/CmsArticleCategoryServiceImpl.java index 4a61ca6b6..42268ee68 100644 --- a/zheng-cms/zheng-cms-rpc-service/src/main/java/com/zheng/cms/rpc/service/impl/CmsArticleCategoryServiceImpl.java +++ b/zheng-cms/zheng-cms-rpc-service/src/main/java/com/zheng/cms/rpc/service/impl/CmsArticleCategoryServiceImpl.java @@ -1,11 +1,11 @@ package com.zheng.cms.rpc.service.impl; -import com.zheng.common.annotation.BaseService; -import com.zheng.common.base.BaseServiceImpl; import com.zheng.cms.dao.mapper.CmsArticleCategoryMapper; import com.zheng.cms.dao.model.CmsArticleCategory; import com.zheng.cms.dao.model.CmsArticleCategoryExample; import com.zheng.cms.rpc.api.CmsArticleCategoryService; +import com.zheng.common.annotation.BaseService; +import com.zheng.common.base.BaseServiceImpl; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -21,7 +21,7 @@ @BaseService public class CmsArticleCategoryServiceImpl extends BaseServiceImpl implements CmsArticleCategoryService { - private static Logger _log = LoggerFactory.getLogger(CmsArticleCategoryServiceImpl.class); + private static final Logger LOGGER = LoggerFactory.getLogger(CmsArticleCategoryServiceImpl.class); @Autowired CmsArticleCategoryMapper cmsArticleCategoryMapper; diff --git a/zheng-cms/zheng-cms-rpc-service/src/main/java/com/zheng/cms/rpc/service/impl/CmsArticleServiceImpl.java b/zheng-cms/zheng-cms-rpc-service/src/main/java/com/zheng/cms/rpc/service/impl/CmsArticleServiceImpl.java index b4954876b..2c52b9bdb 100644 --- a/zheng-cms/zheng-cms-rpc-service/src/main/java/com/zheng/cms/rpc/service/impl/CmsArticleServiceImpl.java +++ b/zheng-cms/zheng-cms-rpc-service/src/main/java/com/zheng/cms/rpc/service/impl/CmsArticleServiceImpl.java @@ -24,7 +24,7 @@ @BaseService public class CmsArticleServiceImpl extends BaseServiceImpl implements CmsArticleService { - private static Logger _log = LoggerFactory.getLogger(CmsArticleServiceImpl.class); + private static final Logger LOGGER = LoggerFactory.getLogger(CmsArticleServiceImpl.class); @Autowired CmsArticleMapper cmsArticleMapper; diff --git a/zheng-cms/zheng-cms-rpc-service/src/main/java/com/zheng/cms/rpc/service/impl/CmsArticleTagServiceImpl.java b/zheng-cms/zheng-cms-rpc-service/src/main/java/com/zheng/cms/rpc/service/impl/CmsArticleTagServiceImpl.java index bbeb4c792..378807a32 100644 --- a/zheng-cms/zheng-cms-rpc-service/src/main/java/com/zheng/cms/rpc/service/impl/CmsArticleTagServiceImpl.java +++ b/zheng-cms/zheng-cms-rpc-service/src/main/java/com/zheng/cms/rpc/service/impl/CmsArticleTagServiceImpl.java @@ -21,7 +21,7 @@ @BaseService public class CmsArticleTagServiceImpl extends BaseServiceImpl implements CmsArticleTagService { - private static Logger _log = LoggerFactory.getLogger(CmsArticleTagServiceImpl.class); + private static final Logger LOGGER = LoggerFactory.getLogger(CmsArticleTagServiceImpl.class); @Autowired CmsArticleTagMapper cmsArticleTagMapper; diff --git a/zheng-cms/zheng-cms-rpc-service/src/main/java/com/zheng/cms/rpc/service/impl/CmsCategoryServiceImpl.java b/zheng-cms/zheng-cms-rpc-service/src/main/java/com/zheng/cms/rpc/service/impl/CmsCategoryServiceImpl.java index d39ba68f3..d08fc3299 100644 --- a/zheng-cms/zheng-cms-rpc-service/src/main/java/com/zheng/cms/rpc/service/impl/CmsCategoryServiceImpl.java +++ b/zheng-cms/zheng-cms-rpc-service/src/main/java/com/zheng/cms/rpc/service/impl/CmsCategoryServiceImpl.java @@ -21,7 +21,7 @@ @BaseService public class CmsCategoryServiceImpl extends BaseServiceImpl implements CmsCategoryService { - private static Logger _log = LoggerFactory.getLogger(CmsCategoryServiceImpl.class); + private static final Logger LOGGER = LoggerFactory.getLogger(CmsCategoryServiceImpl.class); @Autowired CmsCategoryMapper cmsCategoryMapper; diff --git a/zheng-cms/zheng-cms-rpc-service/src/main/java/com/zheng/cms/rpc/service/impl/CmsCategoryTagServiceImpl.java b/zheng-cms/zheng-cms-rpc-service/src/main/java/com/zheng/cms/rpc/service/impl/CmsCategoryTagServiceImpl.java index 78a1cbc01..c7c332bb4 100644 --- a/zheng-cms/zheng-cms-rpc-service/src/main/java/com/zheng/cms/rpc/service/impl/CmsCategoryTagServiceImpl.java +++ b/zheng-cms/zheng-cms-rpc-service/src/main/java/com/zheng/cms/rpc/service/impl/CmsCategoryTagServiceImpl.java @@ -21,7 +21,7 @@ @BaseService public class CmsCategoryTagServiceImpl extends BaseServiceImpl implements CmsCategoryTagService { - private static Logger _log = LoggerFactory.getLogger(CmsCategoryTagServiceImpl.class); + private static final Logger LOGGER = LoggerFactory.getLogger(CmsCategoryTagServiceImpl.class); @Autowired CmsCategoryTagMapper cmsCategoryTagMapper; diff --git a/zheng-cms/zheng-cms-rpc-service/src/main/java/com/zheng/cms/rpc/service/impl/CmsCommentServiceImpl.java b/zheng-cms/zheng-cms-rpc-service/src/main/java/com/zheng/cms/rpc/service/impl/CmsCommentServiceImpl.java index 90086cf88..f753761a3 100644 --- a/zheng-cms/zheng-cms-rpc-service/src/main/java/com/zheng/cms/rpc/service/impl/CmsCommentServiceImpl.java +++ b/zheng-cms/zheng-cms-rpc-service/src/main/java/com/zheng/cms/rpc/service/impl/CmsCommentServiceImpl.java @@ -21,7 +21,7 @@ @BaseService public class CmsCommentServiceImpl extends BaseServiceImpl implements CmsCommentService { - private static Logger _log = LoggerFactory.getLogger(CmsCommentServiceImpl.class); + private static final Logger LOGGER = LoggerFactory.getLogger(CmsCommentServiceImpl.class); @Autowired CmsCommentMapper cmsCommentMapper; diff --git a/zheng-cms/zheng-cms-rpc-service/src/main/java/com/zheng/cms/rpc/service/impl/CmsMenuServiceImpl.java b/zheng-cms/zheng-cms-rpc-service/src/main/java/com/zheng/cms/rpc/service/impl/CmsMenuServiceImpl.java index b7acce541..b7a6517ef 100644 --- a/zheng-cms/zheng-cms-rpc-service/src/main/java/com/zheng/cms/rpc/service/impl/CmsMenuServiceImpl.java +++ b/zheng-cms/zheng-cms-rpc-service/src/main/java/com/zheng/cms/rpc/service/impl/CmsMenuServiceImpl.java @@ -21,7 +21,7 @@ @BaseService public class CmsMenuServiceImpl extends BaseServiceImpl implements CmsMenuService { - private static Logger _log = LoggerFactory.getLogger(CmsMenuServiceImpl.class); + private static final Logger LOGGER = LoggerFactory.getLogger(CmsMenuServiceImpl.class); @Autowired CmsMenuMapper cmsMenuMapper; diff --git a/zheng-cms/zheng-cms-rpc-service/src/main/java/com/zheng/cms/rpc/service/impl/CmsPageServiceImpl.java b/zheng-cms/zheng-cms-rpc-service/src/main/java/com/zheng/cms/rpc/service/impl/CmsPageServiceImpl.java index f8e4e33e3..801d1b0c1 100644 --- a/zheng-cms/zheng-cms-rpc-service/src/main/java/com/zheng/cms/rpc/service/impl/CmsPageServiceImpl.java +++ b/zheng-cms/zheng-cms-rpc-service/src/main/java/com/zheng/cms/rpc/service/impl/CmsPageServiceImpl.java @@ -21,7 +21,7 @@ @BaseService public class CmsPageServiceImpl extends BaseServiceImpl implements CmsPageService { - private static Logger _log = LoggerFactory.getLogger(CmsPageServiceImpl.class); + private static final Logger LOGGER = LoggerFactory.getLogger(CmsPageServiceImpl.class); @Autowired CmsPageMapper cmsPageMapper; diff --git a/zheng-cms/zheng-cms-rpc-service/src/main/java/com/zheng/cms/rpc/service/impl/CmsSettingServiceImpl.java b/zheng-cms/zheng-cms-rpc-service/src/main/java/com/zheng/cms/rpc/service/impl/CmsSettingServiceImpl.java index 087b3e5d5..74aac61db 100644 --- a/zheng-cms/zheng-cms-rpc-service/src/main/java/com/zheng/cms/rpc/service/impl/CmsSettingServiceImpl.java +++ b/zheng-cms/zheng-cms-rpc-service/src/main/java/com/zheng/cms/rpc/service/impl/CmsSettingServiceImpl.java @@ -21,7 +21,7 @@ @BaseService public class CmsSettingServiceImpl extends BaseServiceImpl implements CmsSettingService { - private static Logger _log = LoggerFactory.getLogger(CmsSettingServiceImpl.class); + private static final Logger LOGGER = LoggerFactory.getLogger(CmsSettingServiceImpl.class); @Autowired CmsSettingMapper cmsSettingMapper; diff --git a/zheng-cms/zheng-cms-rpc-service/src/main/java/com/zheng/cms/rpc/service/impl/CmsSystemServiceImpl.java b/zheng-cms/zheng-cms-rpc-service/src/main/java/com/zheng/cms/rpc/service/impl/CmsSystemServiceImpl.java index 97fa7980a..b60c8ca4c 100644 --- a/zheng-cms/zheng-cms-rpc-service/src/main/java/com/zheng/cms/rpc/service/impl/CmsSystemServiceImpl.java +++ b/zheng-cms/zheng-cms-rpc-service/src/main/java/com/zheng/cms/rpc/service/impl/CmsSystemServiceImpl.java @@ -21,7 +21,7 @@ @BaseService public class CmsSystemServiceImpl extends BaseServiceImpl implements CmsSystemService { - private static Logger _log = LoggerFactory.getLogger(CmsSystemServiceImpl.class); + private static final Logger LOGGER = LoggerFactory.getLogger(CmsSystemServiceImpl.class); @Autowired CmsSystemMapper cmsSystemMapper; diff --git a/zheng-cms/zheng-cms-rpc-service/src/main/java/com/zheng/cms/rpc/service/impl/CmsTagServiceImpl.java b/zheng-cms/zheng-cms-rpc-service/src/main/java/com/zheng/cms/rpc/service/impl/CmsTagServiceImpl.java index 5f154cbb6..f504383a0 100644 --- a/zheng-cms/zheng-cms-rpc-service/src/main/java/com/zheng/cms/rpc/service/impl/CmsTagServiceImpl.java +++ b/zheng-cms/zheng-cms-rpc-service/src/main/java/com/zheng/cms/rpc/service/impl/CmsTagServiceImpl.java @@ -21,7 +21,7 @@ @BaseService public class CmsTagServiceImpl extends BaseServiceImpl implements CmsTagService { - private static Logger _log = LoggerFactory.getLogger(CmsTagServiceImpl.class); + private static final Logger LOGGER = LoggerFactory.getLogger(CmsTagServiceImpl.class); @Autowired CmsTagMapper cmsTagMapper; diff --git a/zheng-cms/zheng-cms-rpc-service/src/main/java/com/zheng/cms/rpc/service/impl/CmsTopicServiceImpl.java b/zheng-cms/zheng-cms-rpc-service/src/main/java/com/zheng/cms/rpc/service/impl/CmsTopicServiceImpl.java index 1655f603a..e5833dda9 100644 --- a/zheng-cms/zheng-cms-rpc-service/src/main/java/com/zheng/cms/rpc/service/impl/CmsTopicServiceImpl.java +++ b/zheng-cms/zheng-cms-rpc-service/src/main/java/com/zheng/cms/rpc/service/impl/CmsTopicServiceImpl.java @@ -21,7 +21,7 @@ @BaseService public class CmsTopicServiceImpl extends BaseServiceImpl implements CmsTopicService { - private static Logger _log = LoggerFactory.getLogger(CmsTopicServiceImpl.class); + private static final Logger LOGGER = LoggerFactory.getLogger(CmsTopicServiceImpl.class); @Autowired CmsTopicMapper cmsTopicMapper; diff --git a/zheng-cms/zheng-cms-web/src/main/java/com/zheng/cms/web/controller/BlogController.java b/zheng-cms/zheng-cms-web/src/main/java/com/zheng/cms/web/controller/BlogController.java index 22659e577..0a4b7c793 100644 --- a/zheng-cms/zheng-cms-web/src/main/java/com/zheng/cms/web/controller/BlogController.java +++ b/zheng-cms/zheng-cms-web/src/main/java/com/zheng/cms/web/controller/BlogController.java @@ -27,7 +27,7 @@ @RequestMapping(value = "/blog") public class BlogController extends BaseController { - private static Logger _log = LoggerFactory.getLogger(BlogController.class); + private static final Logger LOGGER = LoggerFactory.getLogger(BlogController.class); private static String CODE = "blog"; private static Integer USERID = 1; diff --git a/zheng-cms/zheng-cms-web/src/main/java/com/zheng/cms/web/controller/IndexController.java b/zheng-cms/zheng-cms-web/src/main/java/com/zheng/cms/web/controller/IndexController.java index efeee0de7..3227dce05 100644 --- a/zheng-cms/zheng-cms-web/src/main/java/com/zheng/cms/web/controller/IndexController.java +++ b/zheng-cms/zheng-cms-web/src/main/java/com/zheng/cms/web/controller/IndexController.java @@ -20,7 +20,7 @@ @Controller public class IndexController extends BaseController { - private static Logger _log = LoggerFactory.getLogger(IndexController.class); + private static final Logger LOGGER = LoggerFactory.getLogger(IndexController.class); @Autowired private CmsMenuService cmsMenuService; diff --git a/zheng-cms/zheng-cms-web/src/main/java/com/zheng/cms/web/controller/NewsController.java b/zheng-cms/zheng-cms-web/src/main/java/com/zheng/cms/web/controller/NewsController.java index c6e53b071..33c5f664c 100644 --- a/zheng-cms/zheng-cms-web/src/main/java/com/zheng/cms/web/controller/NewsController.java +++ b/zheng-cms/zheng-cms-web/src/main/java/com/zheng/cms/web/controller/NewsController.java @@ -27,7 +27,7 @@ @RequestMapping(value = "/news") public class NewsController extends BaseController { - private static Logger _log = LoggerFactory.getLogger(NewsController.class); + private static final Logger LOGGER = LoggerFactory.getLogger(NewsController.class); private static String CODE = "news"; private static Integer USERID = 1; diff --git a/zheng-cms/zheng-cms-web/src/main/java/com/zheng/cms/web/controller/PageController.java b/zheng-cms/zheng-cms-web/src/main/java/com/zheng/cms/web/controller/PageController.java index 6d7a29641..216515d10 100644 --- a/zheng-cms/zheng-cms-web/src/main/java/com/zheng/cms/web/controller/PageController.java +++ b/zheng-cms/zheng-cms-web/src/main/java/com/zheng/cms/web/controller/PageController.java @@ -21,7 +21,7 @@ @RequestMapping(value = "/page") public class PageController extends BaseController { - private static Logger _log = LoggerFactory.getLogger(PageController.class); + private static final Logger LOGGER = LoggerFactory.getLogger(PageController.class); @Autowired private CmsPageService cmsPageService; diff --git a/zheng-cms/zheng-cms-web/src/main/java/com/zheng/cms/web/controller/QaController.java b/zheng-cms/zheng-cms-web/src/main/java/com/zheng/cms/web/controller/QaController.java index c7d2e9a4f..5d1e7ace3 100644 --- a/zheng-cms/zheng-cms-web/src/main/java/com/zheng/cms/web/controller/QaController.java +++ b/zheng-cms/zheng-cms-web/src/main/java/com/zheng/cms/web/controller/QaController.java @@ -27,7 +27,7 @@ @RequestMapping(value = "/qa") public class QaController extends BaseController { - private static Logger _log = LoggerFactory.getLogger(QaController.class); + private static final Logger LOGGER = LoggerFactory.getLogger(QaController.class); private static String CODE = "qa"; private static Integer USERID = 1; diff --git a/zheng-cms/zheng-cms-web/src/main/java/com/zheng/cms/web/controller/SearchController.java b/zheng-cms/zheng-cms-web/src/main/java/com/zheng/cms/web/controller/SearchController.java index 7a266e9df..cea405156 100644 --- a/zheng-cms/zheng-cms-web/src/main/java/com/zheng/cms/web/controller/SearchController.java +++ b/zheng-cms/zheng-cms-web/src/main/java/com/zheng/cms/web/controller/SearchController.java @@ -30,7 +30,7 @@ @RequestMapping(value = "/search") public class SearchController extends BaseController { - private static Logger _log = LoggerFactory.getLogger(SearchController.class); + private static final Logger LOGGER = LoggerFactory.getLogger(SearchController.class); @Autowired private CmsArticleService cmsArticleService; diff --git a/zheng-cms/zheng-cms-web/src/main/java/com/zheng/cms/web/controller/TopicController.java b/zheng-cms/zheng-cms-web/src/main/java/com/zheng/cms/web/controller/TopicController.java index 45f041e89..c3fee15d3 100644 --- a/zheng-cms/zheng-cms-web/src/main/java/com/zheng/cms/web/controller/TopicController.java +++ b/zheng-cms/zheng-cms-web/src/main/java/com/zheng/cms/web/controller/TopicController.java @@ -26,7 +26,7 @@ @RequestMapping(value = "/topic") public class TopicController extends BaseController { - private static Logger _log = LoggerFactory.getLogger(TopicController.class); + private static final Logger LOGGER = LoggerFactory.getLogger(TopicController.class); @Autowired private CmsTopicService cmsTopicService; diff --git a/zheng-cms/zheng-cms-web/src/main/java/com/zheng/cms/web/interceptor/CmsWebInterceptor.java b/zheng-cms/zheng-cms-web/src/main/java/com/zheng/cms/web/interceptor/CmsWebInterceptor.java index 7173d4a5f..4d450c9c7 100644 --- a/zheng-cms/zheng-cms-web/src/main/java/com/zheng/cms/web/interceptor/CmsWebInterceptor.java +++ b/zheng-cms/zheng-cms-web/src/main/java/com/zheng/cms/web/interceptor/CmsWebInterceptor.java @@ -20,7 +20,7 @@ */ public class CmsWebInterceptor extends HandlerInterceptorAdapter { - private static Logger _log = LoggerFactory.getLogger(CmsWebInterceptor.class); + private static final Logger LOGGER = LoggerFactory.getLogger(CmsWebInterceptor.class); @Autowired private CmsMenuService cmsMenuService; @@ -28,7 +28,7 @@ public class CmsWebInterceptor extends HandlerInterceptorAdapter { @Override public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { // 过滤ajax - if (null != request.getHeader("X-Requested-With") && request.getHeader("X-Requested-With").equalsIgnoreCase("XMLHttpRequest")) { + if (null != request.getHeader("X-Requested-With") && "XMLHttpRequest".equalsIgnoreCase(request.getHeader("X-Requested-With"))) { return true; } // zheng-ui静态资源配置信息 diff --git a/zheng-cms/zheng-cms-web/src/main/java/com/zheng/cms/web/jms/DefaultMessageQueueListener.java b/zheng-cms/zheng-cms-web/src/main/java/com/zheng/cms/web/jms/DefaultMessageQueueListener.java index 3cf241b70..4a63fb9f0 100644 --- a/zheng-cms/zheng-cms-web/src/main/java/com/zheng/cms/web/jms/DefaultMessageQueueListener.java +++ b/zheng-cms/zheng-cms-web/src/main/java/com/zheng/cms/web/jms/DefaultMessageQueueListener.java @@ -15,19 +15,21 @@ */ public class DefaultMessageQueueListener implements MessageListener { - private static Logger _log = LoggerFactory.getLogger(DefaultMessageQueueListener.class); + private static final Logger LOGGER = LoggerFactory.getLogger(DefaultMessageQueueListener.class); @Autowired ThreadPoolTaskExecutor threadPoolTaskExecutor; + @Override public void onMessage(final Message message) { // 使用线程池多线程处理 threadPoolTaskExecutor.execute(new Runnable() { + @Override public void run() { TextMessage textMessage = (TextMessage) message; try { String text = textMessage.getText(); - _log.info("消费:{}", text); + LOGGER.info("消费:{}", text); } catch (Exception e) { e.printStackTrace(); } diff --git a/zheng-cms/zheng-cms-web/src/main/java/com/zheng/cms/web/rocketmq/Consumer.java b/zheng-cms/zheng-cms-web/src/main/java/com/zheng/cms/web/rocketmq/Consumer.java index fc423ce54..1ad85ce80 100644 --- a/zheng-cms/zheng-cms-web/src/main/java/com/zheng/cms/web/rocketmq/Consumer.java +++ b/zheng-cms/zheng-cms-web/src/main/java/com/zheng/cms/web/rocketmq/Consumer.java @@ -15,31 +15,32 @@ */ public class Consumer { - public static void main(String[] args){ - DefaultMQPushConsumer consumer = - new DefaultMQPushConsumer("PushConsumer"); - consumer.setNamesrvAddr("127.0.0.1:9876"); - try { - //订阅PushTopic下Tag为push的消息 - consumer.subscribe("PushTopic", "push"); - //程序第一次启动从消息队列头取数据 - consumer.setConsumeFromWhere( - ConsumeFromWhere.CONSUME_FROM_FIRST_OFFSET); - consumer.registerMessageListener( - new MessageListenerConcurrently() { - public ConsumeConcurrentlyStatus consumeMessage( - List list, - ConsumeConcurrentlyContext Context) { - Message msg = list.get(0); - System.out.println(msg.toString()); - return ConsumeConcurrentlyStatus.CONSUME_SUCCESS; - } - } - ); - consumer.start(); - } catch (Exception e) { - e.printStackTrace(); - } - } + public static void main(String[] args) { + DefaultMQPushConsumer consumer = + new DefaultMQPushConsumer("PushConsumer"); + consumer.setNamesrvAddr("127.0.0.1:9876"); + try { + //订阅PushTopic下Tag为push的消息 + consumer.subscribe("PushTopic", "push"); + //程序第一次启动从消息队列头取数据 + consumer.setConsumeFromWhere( + ConsumeFromWhere.CONSUME_FROM_FIRST_OFFSET); + consumer.registerMessageListener( + new MessageListenerConcurrently() { + @Override + public ConsumeConcurrentlyStatus consumeMessage( + List list, + ConsumeConcurrentlyContext context) { + Message msg = list.get(0); + System.out.println(msg.toString()); + return ConsumeConcurrentlyStatus.CONSUME_SUCCESS; + } + } + ); + consumer.start(); + } catch (Exception e) { + e.printStackTrace(); + } + } } diff --git a/zheng-cms/zheng-cms-web/src/main/java/com/zheng/cms/web/rocketmq/Producer.java b/zheng-cms/zheng-cms-web/src/main/java/com/zheng/cms/web/rocketmq/Producer.java index 85d38742a..46fd6199f 100644 --- a/zheng-cms/zheng-cms-web/src/main/java/com/zheng/cms/web/rocketmq/Producer.java +++ b/zheng-cms/zheng-cms-web/src/main/java/com/zheng/cms/web/rocketmq/Producer.java @@ -9,24 +9,27 @@ */ public class Producer { - public static void main(String[] args) { - DefaultMQProducer producer = new DefaultMQProducer("Producer"); - producer.setNamesrvAddr("127.0.0.1:9876"); - try { - producer.start(); - long time = System.currentTimeMillis(); - System.out.println("开始:" + time); - for (int i = 1; i <= 100000; i ++) { - Message msg = new Message("PushTopic", "push", i + "", "Just for test.".getBytes()); - SendResult result = producer.send(msg); - //System.out.println("id:" + result.getMsgId() + " result:" + result.getSendStatus()); - } - System.out.println("结束,消耗:" + (System.currentTimeMillis() - time)); - } catch (Exception e) { - e.printStackTrace(); - } finally { - producer.shutdown(); - } - } + public static void main(String[] args) { + DefaultMQProducer producer = new DefaultMQProducer("Producer"); + producer.setNamesrvAddr("127.0.0.1:9876"); + try { + producer.start(); + long time = System.currentTimeMillis(); + System.out.println("开始:" + time); + + int a = 100000; + + for (int i = 1; i <= a; i++) { + Message msg = new Message("PushTopic", "push", i + "", "Just for test.".getBytes()); + SendResult result = producer.send(msg); + System.out.println("id:" + result.getMsgId() + " result:" + result.getSendStatus()); + } + System.out.println("结束,消耗:" + (System.currentTimeMillis() - time)); + } catch (Exception e) { + e.printStackTrace(); + } finally { + producer.shutdown(); + } + } } diff --git a/zheng-cms/zheng-cms-web/src/main/java/com/zheng/cms/web/schedule/LongSchedule.java b/zheng-cms/zheng-cms-web/src/main/java/com/zheng/cms/web/schedule/LongSchedule.java index 2558716a0..2fbf3829e 100644 --- a/zheng-cms/zheng-cms-web/src/main/java/com/zheng/cms/web/schedule/LongSchedule.java +++ b/zheng-cms/zheng-cms-web/src/main/java/com/zheng/cms/web/schedule/LongSchedule.java @@ -15,7 +15,7 @@ */ public class LongSchedule implements IScheduleTaskDealSingle { - private static Logger _log = LoggerFactory.getLogger(LongSchedule.class); + private static final Logger LOGGER = LoggerFactory.getLogger(LongSchedule.class); /** * 执行单个任务 @@ -25,7 +25,7 @@ public class LongSchedule implements IScheduleTaskDealSingle { */ @Override public boolean execute(Long item, String ownSign) throws Exception { - _log.info("执行任务:{}", item); + LOGGER.info("执行任务:{}", item); return true; } @@ -53,6 +53,7 @@ public List selectTasks(String taskParameter, String ownSign, int taskItem @Override public Comparator getComparator() { return new Comparator() { + @Override public int compare(Long o1, Long o2) { return o1.compareTo(o2); } diff --git a/zheng-cms/zheng-cms-web/src/main/java/com/zheng/cms/web/schedule/MapSchedule.java b/zheng-cms/zheng-cms-web/src/main/java/com/zheng/cms/web/schedule/MapSchedule.java index b7e8e429a..e7d6005c6 100644 --- a/zheng-cms/zheng-cms-web/src/main/java/com/zheng/cms/web/schedule/MapSchedule.java +++ b/zheng-cms/zheng-cms-web/src/main/java/com/zheng/cms/web/schedule/MapSchedule.java @@ -13,7 +13,7 @@ */ public class MapSchedule implements IScheduleTaskDealSingle { - private static Logger _log = LoggerFactory.getLogger(MapSchedule.class); + private static final Logger LOGGER = LoggerFactory.getLogger(MapSchedule.class); /** * 执行单个任务 @@ -23,7 +23,7 @@ public class MapSchedule implements IScheduleTaskDealSingle { */ @Override public boolean execute(Map item, String ownSign) throws Exception { - _log.info("执行任务:{}", item); + LOGGER.info("执行任务:{}", item); return true; } @@ -40,7 +40,7 @@ public boolean execute(Map item, String ownSign) throws Exception { @Override public List selectTasks(String taskParameter, String ownSign, int taskItemNum, List taskItemList, int eachFetchDataNum) throws Exception { List allDrawList = new ArrayList<>(); - Map map = new HashMap(); + Map map = new HashMap(1); map.put("ID", System.currentTimeMillis()); allDrawList.add(map); return allDrawList; @@ -53,11 +53,14 @@ public List selectTasks(String taskParameter, String ownSign, int taskItemN @Override public Comparator getComparator() { return new Comparator() { + @Override public int compare(Map o1, Map o2) { Long l1 = (Long) o1.get("ID"); Long l2 = (Long) o2.get("ID"); return l1.compareTo(l2); } + + @Override public boolean equals(Object obj) { return this == obj; } diff --git a/zheng-common/src/main/java/com/zheng/common/aspect/RpcLogAspect.java b/zheng-common/src/main/java/com/zheng/common/aspect/RpcLogAspect.java index fba0d2bd8..037c7f969 100644 --- a/zheng-common/src/main/java/com/zheng/common/aspect/RpcLogAspect.java +++ b/zheng-common/src/main/java/com/zheng/common/aspect/RpcLogAspect.java @@ -15,7 +15,7 @@ */ public class RpcLogAspect { - private static Logger _log = LoggerFactory.getLogger(RpcLogAspect.class); + private static final Logger LOGGER = LoggerFactory.getLogger(RpcLogAspect.class); // 开始时间 private long startTime = 0L; @@ -24,13 +24,13 @@ public class RpcLogAspect { @Before("execution(* *..rpc..*.*(..))") public void doBeforeInServiceLayer(JoinPoint joinPoint) { - _log.debug("doBeforeInServiceLayer"); + LOGGER.debug("doBeforeInServiceLayer"); startTime = System.currentTimeMillis(); } @After("execution(* *..rpc..*.*(..))") public void doAfterInServiceLayer(JoinPoint joinPoint) { - _log.debug("doAfterInServiceLayer"); + LOGGER.debug("doAfterInServiceLayer"); } @Around("execution(* *..rpc..*.*(..))") @@ -42,7 +42,7 @@ public Object doAround(ProceedingJoinPoint pjp) throws Throwable { String ip = RpcContext.getContext().getRemoteHost(); // 服务url String rpcUrl = RpcContext.getContext().getUrl().getParameter("application"); - _log.info("consumerSide={}, ip={}, url={}", consumerSide, ip, rpcUrl); + LOGGER.info("consumerSide={}, ip={}, url={}", consumerSide, ip, rpcUrl); return result; } diff --git a/zheng-common/src/main/java/com/zheng/common/base/BaseController.java b/zheng-common/src/main/java/com/zheng/common/base/BaseController.java index 95d13bc0a..650340b60 100644 --- a/zheng-common/src/main/java/com/zheng/common/base/BaseController.java +++ b/zheng-common/src/main/java/com/zheng/common/base/BaseController.java @@ -9,7 +9,6 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import java.io.File; /** * 控制器基类 @@ -17,7 +16,7 @@ */ public abstract class BaseController { - private final static Logger _log = LoggerFactory.getLogger(BaseController.class); + private final static Logger LOGGER = LoggerFactory.getLogger(BaseController.class); /** * 统一异常处理 @@ -27,9 +26,9 @@ public abstract class BaseController { */ @ExceptionHandler public String exceptionHandler(HttpServletRequest request, HttpServletResponse response, Exception exception) { - _log.error("统一异常处理:", exception); + LOGGER.error("统一异常处理:", exception); request.setAttribute("ex", exception); - if (null != request.getHeader("X-Requested-With") && request.getHeader("X-Requested-With").equalsIgnoreCase("XMLHttpRequest")) { + if (null != request.getHeader("X-Requested-With") && "XMLHttpRequest".equalsIgnoreCase(request.getHeader("X-Requested-With"))) { request.setAttribute("requestHeader", "ajax"); } // shiro没有权限异常 diff --git a/zheng-common/src/main/java/com/zheng/common/base/BaseInterface.java b/zheng-common/src/main/java/com/zheng/common/base/BaseInterface.java index 27013eea4..53a27e01e 100644 --- a/zheng-common/src/main/java/com/zheng/common/base/BaseInterface.java +++ b/zheng-common/src/main/java/com/zheng/common/base/BaseInterface.java @@ -6,7 +6,9 @@ */ public interface BaseInterface { - // 系统初始化 + /** + * 系统初始化 + */ void init(); } diff --git a/zheng-common/src/main/java/com/zheng/common/base/BaseResult.java b/zheng-common/src/main/java/com/zheng/common/base/BaseResult.java index 3c6d3db6a..6b7b7cbef 100644 --- a/zheng-common/src/main/java/com/zheng/common/base/BaseResult.java +++ b/zheng-common/src/main/java/com/zheng/common/base/BaseResult.java @@ -6,13 +6,19 @@ */ public class BaseResult { - // 状态码:1成功,其他为失败 + /** + * 状态码:1成功,其他为失败 + */ public int code; - // 成功为success,其他为失败原因 + /** + * 成功为success,其他为失败原因 + */ public String message; - // 数据结果集 + /** + * 数据结果集 + */ public Object data; public BaseResult(int code, String message, Object data) { diff --git a/zheng-common/src/main/java/com/zheng/common/base/BaseService.java b/zheng-common/src/main/java/com/zheng/common/base/BaseService.java index 79f081333..6d0ee0820 100644 --- a/zheng-common/src/main/java/com/zheng/common/base/BaseService.java +++ b/zheng-common/src/main/java/com/zheng/common/base/BaseService.java @@ -10,48 +10,167 @@ */ public interface BaseService { - int countByExample(Example example); - - int deleteByExample(Example example); - - int deleteByPrimaryKey(Integer id); - - int insert(Record record); - - int insertSelective(Record record); - - List selectByExampleWithBLOBs(Example example); - - List selectByExample(Example example); - - List selectByExampleWithBLOBsForStartPage(Example example, Integer pageNum, Integer pageSize); - - List selectByExampleForStartPage(Example example, Integer pageNum, Integer pageSize); - - List selectByExampleWithBLOBsForOffsetPage(Example example, Integer offset, Integer limit); - - List selectByExampleForOffsetPage(Example example, Integer offset, Integer limit); - - Record selectFirstByExample(Example example); - - Record selectFirstByExampleWithBLOBs(Example example); - - Record selectByPrimaryKey(Integer id); - - int updateByExampleSelective(@Param("record") Record record, @Param("example") Example example); - - int updateByExampleWithBLOBs(@Param("record") Record record, @Param("example") Example example); - - int updateByExample(@Param("record") Record record, @Param("example") Example example); - - int updateByPrimaryKeySelective(Record record); - - int updateByPrimaryKeyWithBLOBs(Record record); - - int updateByPrimaryKey(Record record); - - int deleteByPrimaryKeys(String ids); - - void initMapper(); + /** + * 根据条件查询记录数量 + * @param example + * @return + */ + int countByExample(Example example); + + /** + * 根据条件删除记录 + * @param example + * @return + */ + int deleteByExample(Example example); + + /** + * 根据主键删除记录 + * @param id + * @return + */ + int deleteByPrimaryKey(Integer id); + + /** + * 插入记录 + * @param record + * @return + */ + int insert(Record record); + + /** + * 插入记录有效字段 + * @param record + * @return + */ + int insertSelective(Record record); + + /** + * 根据条件查询记录,附带BLOB字段 + * @param example + * @return + */ + List selectByExampleWithBLOBs(Example example); + + /** + * 根据条件查询记录 + * @param example + * @return + */ + List selectByExample(Example example); + + /** + * 根据条件查询记录并按页码分页,附带BLOB字段 + * @param example 条件 + * @param pageNum 页数 + * @param pageSize 每页记录数 + * @return + */ + List selectByExampleWithBLOBsForStartPage(Example example, Integer pageNum, Integer pageSize); + + /** + * 根据条件查询记录并按页码分页 + * @param example 条件 + * @param pageNum 页数 + * @param pageSize 每页记录数 + * @return + */ + List selectByExampleForStartPage(Example example, Integer pageNum, Integer pageSize); + + /** + * 根据条件查询记录并按最后记录数分页,附带BLOB字段 + * @param example 条件 + * @param offset 跳过数量 + * @param limit 查询数量 + * @return + */ + List selectByExampleWithBLOBsForOffsetPage(Example example, Integer offset, Integer limit); + + /** + * 根据条件查询记录并按最后记录数分页 + * @param example 条件 + * @param offset 跳过数量 + * @param limit 查询数量 + * @return + */ + List selectByExampleForOffsetPage(Example example, Integer offset, Integer limit); + + /** + * 根据条件查询第一条记录 + * @param example + * @return + */ + Record selectFirstByExample(Example example); + + /** + * 根据条件查询第一条记录,附带BLOB字段 + * @param example + * @return + */ + Record selectFirstByExampleWithBLOBs(Example example); + + /** + * 根据主键查询记录 + * @param id + * @return + */ + Record selectByPrimaryKey(Integer id); + + /** + * 根据条件更新有效字段 + * @param record + * @param example + * @return + */ + int updateByExampleSelective(@Param("record") Record record, @Param("example") Example example); + + /** + * 根据条件更新记录有效字段,附带BLOB字段 + * @param record + * @param example + * @return + */ + int updateByExampleWithBLOBs(@Param("record") Record record, @Param("example") Example example); + + /** + * 根据条件更新记录 + * @param record + * @param example + * @return + */ + int updateByExample(@Param("record") Record record, @Param("example") Example example); + + /** + * 根据主键更新记录有效字段 + * @param record + * @return + */ + int updateByPrimaryKeySelective(Record record); + + /** + * 根据主键更新记录,附带BLOB字段 + * @param record + * @return + */ + int updateByPrimaryKeyWithBLOBs(Record record); + + /** + * 根据主键更新记录 + * @param record + * @return + */ + int updateByPrimaryKey(Record record); + + /** + * 根据主键批量删除记录 + * @param ids + * @return + */ + int deleteByPrimaryKeys(String ids); + + /** + * 初始化mapper + */ + void initMapper(); } \ No newline at end of file diff --git a/zheng-common/src/main/java/com/zheng/common/db/DynamicDataSource.java b/zheng-common/src/main/java/com/zheng/common/db/DynamicDataSource.java index 923f12a9d..f184a2e11 100644 --- a/zheng-common/src/main/java/com/zheng/common/db/DynamicDataSource.java +++ b/zheng-common/src/main/java/com/zheng/common/db/DynamicDataSource.java @@ -10,43 +10,45 @@ */ public class DynamicDataSource extends AbstractRoutingDataSource { - private final static Logger _log = LoggerFactory.getLogger(DynamicDataSource.class); - - private static final ThreadLocal contextHolder = new ThreadLocal<>(); - - @Override - protected Object determineCurrentLookupKey() { - String dataSource = getDataSource(); - _log.info("当前操作使用的数据源:{}", dataSource); - return dataSource; - } - - /** - * 设置数据源 - * @param dataSource - */ - public static void setDataSource(String dataSource) { - contextHolder.set(dataSource); - } - - /** - * 获取数据源 - * @return - */ - public static String getDataSource() { - String dataSource = contextHolder.get(); - // 如果没有指定数据源,使用默认数据源 - if (null == dataSource) { - DynamicDataSource.setDataSource(DataSourceEnum.MASTER.getDefault()); - } - return contextHolder.get(); - } - - /** - * 清除数据源 - */ - public static void clearDataSource() { - contextHolder.remove(); - } + private final static Logger LOGGER = LoggerFactory.getLogger(DynamicDataSource.class); + + private static final ThreadLocal CONTEXT_HOLDER = new ThreadLocal<>(); + + @Override + protected Object determineCurrentLookupKey() { + String dataSource = getDataSource(); + LOGGER.info("当前操作使用的数据源:{}", dataSource); + return dataSource; + } + + /** + * 设置数据源 + * + * @param dataSource + */ + public static void setDataSource(String dataSource) { + CONTEXT_HOLDER.set(dataSource); + } + + /** + * 获取数据源 + * + * @return + */ + public static String getDataSource() { + String dataSource = CONTEXT_HOLDER.get(); + // 如果没有指定数据源,使用默认数据源 + if (null == dataSource) { + DynamicDataSource.setDataSource(DataSourceEnum.MASTER.getDefault()); + } + return CONTEXT_HOLDER.get(); + } + + /** + * 清除数据源 + */ + public static void clearDataSource() { + CONTEXT_HOLDER.remove(); + } } diff --git a/zheng-common/src/main/java/com/zheng/common/listener/ApplicationContextListener.java b/zheng-common/src/main/java/com/zheng/common/listener/ApplicationContextListener.java index c932b7497..7fcfacf54 100644 --- a/zheng-common/src/main/java/com/zheng/common/listener/ApplicationContextListener.java +++ b/zheng-common/src/main/java/com/zheng/common/listener/ApplicationContextListener.java @@ -16,22 +16,22 @@ */ public class ApplicationContextListener implements ApplicationListener { - private static Logger _log = LoggerFactory.getLogger(ApplicationContextListener.class); + private static final Logger LOGGER = LoggerFactory.getLogger(ApplicationContextListener.class); @Override public void onApplicationEvent(ContextRefreshedEvent contextRefreshedEvent) { // root application context if(null == contextRefreshedEvent.getApplicationContext().getParent()) { - _log.debug(">>>>> spring初始化完毕 <<<<<"); + LOGGER.debug(">>>>> spring初始化完毕 <<<<<"); // spring初始化完毕后,通过反射调用所有使用BaseService注解的initMapper方法 Map baseServices = contextRefreshedEvent.getApplicationContext().getBeansWithAnnotation(BaseService.class); for(Object service : baseServices.values()) { - _log.debug(">>>>> {}.initMapper()", service.getClass().getName()); + LOGGER.debug(">>>>> {}.initMapper()", service.getClass().getName()); try { Method initMapper = service.getClass().getMethod("initMapper"); initMapper.invoke(service); } catch (Exception e) { - _log.error("初始化BaseService的initMapper方法异常", e); + LOGGER.error("初始化BaseService的initMapper方法异常", e); e.printStackTrace(); } } @@ -39,12 +39,12 @@ public void onApplicationEvent(ContextRefreshedEvent contextRefreshedEvent) { // 系统入口初始化 Map baseInterfaceBeans = contextRefreshedEvent.getApplicationContext().getBeansOfType(BaseInterface.class); for(Object service : baseInterfaceBeans.values()) { - _log.debug(">>>>> {}.init()", service.getClass().getName()); + LOGGER.debug(">>>>> {}.init()", service.getClass().getName()); try { Method init = service.getClass().getMethod("init"); init.invoke(service); } catch (Exception e) { - _log.error("初始化BaseInterface的init方法异常", e); + LOGGER.error("初始化BaseInterface的init方法异常", e); e.printStackTrace(); } } diff --git a/zheng-common/src/main/java/com/zheng/common/plugin/CommentGenerator.java b/zheng-common/src/main/java/com/zheng/common/plugin/CommentGenerator.java index fd3767f30..9c7dd25df 100644 --- a/zheng-common/src/main/java/com/zheng/common/plugin/CommentGenerator.java +++ b/zheng-common/src/main/java/com/zheng/common/plugin/CommentGenerator.java @@ -14,7 +14,7 @@ public class CommentGenerator extends DefaultCommentGenerator { @Override public void addFieldComment(Field field, IntrospectedTable introspectedTable, IntrospectedColumn introspectedColumn) { super.addFieldComment(field, introspectedTable, introspectedColumn); - if (introspectedColumn.getRemarks() != null && !introspectedColumn.getRemarks().equals("")) { + if (introspectedColumn.getRemarks() != null && !"".equals(introspectedColumn.getRemarks())) { field.addJavaDocLine("/**"); field.addJavaDocLine(" * " + introspectedColumn.getRemarks()); addJavadocTag(field, false); diff --git a/zheng-common/src/main/java/com/zheng/common/plugin/EncryptPropertyPlaceholderConfigurer.java b/zheng-common/src/main/java/com/zheng/common/plugin/EncryptPropertyPlaceholderConfigurer.java index 148d41506..fac30905f 100644 --- a/zheng-common/src/main/java/com/zheng/common/plugin/EncryptPropertyPlaceholderConfigurer.java +++ b/zheng-common/src/main/java/com/zheng/common/plugin/EncryptPropertyPlaceholderConfigurer.java @@ -23,7 +23,7 @@ public class EncryptPropertyPlaceholderConfigurer extends PropertyPlaceholderCon protected String convertProperty(String propertyName, String propertyValue) { for (String p : propertyNames) { if (p.equalsIgnoreCase(propertyName)) { - return AESUtil.AESDecode(propertyValue); + return AESUtil.aesDecode(propertyValue); } } return super.convertProperty(propertyName, propertyValue); diff --git a/zheng-common/src/main/java/com/zheng/common/plugin/SerializablePlugin.java b/zheng-common/src/main/java/com/zheng/common/plugin/SerializablePlugin.java index 4b8b7c4da..425b261bd 100644 --- a/zheng-common/src/main/java/com/zheng/common/plugin/SerializablePlugin.java +++ b/zheng-common/src/main/java/com/zheng/common/plugin/SerializablePlugin.java @@ -20,26 +20,31 @@ public class SerializablePlugin extends PluginAdapter { public SerializablePlugin() { } + @Override public boolean validate(List warnings) { return true; } + @Override public void setProperties(Properties properties) { super.setProperties(properties); this.addGWTInterface = Boolean.valueOf(properties.getProperty("addGWTInterface")).booleanValue(); this.suppressJavaInterface = Boolean.valueOf(properties.getProperty("suppressJavaInterface")).booleanValue(); } + @Override public boolean modelBaseRecordClassGenerated(TopLevelClass topLevelClass, IntrospectedTable introspectedTable) { this.makeSerializable(topLevelClass, introspectedTable); return true; } + @Override public boolean modelPrimaryKeyClassGenerated(TopLevelClass topLevelClass, IntrospectedTable introspectedTable) { this.makeSerializable(topLevelClass, introspectedTable); return true; } + @Override public boolean modelRecordWithBLOBsClassGenerated(TopLevelClass topLevelClass, IntrospectedTable introspectedTable) { this.makeSerializable(topLevelClass, introspectedTable); return true; diff --git a/zheng-common/src/main/java/com/zheng/common/util/AESUtil.java b/zheng-common/src/main/java/com/zheng/common/util/AESUtil.java index 80a18c715..ba961e8dd 100644 --- a/zheng-common/src/main/java/com/zheng/common/util/AESUtil.java +++ b/zheng-common/src/main/java/com/zheng/common/util/AESUtil.java @@ -17,7 +17,7 @@ */ public class AESUtil { - private static final String encodeRules = "zheng"; + private static final String ENCODE_RULES = "zheng"; /** * 加密 @@ -28,19 +28,19 @@ public class AESUtil { * 5.内容加密 * 6.返回字符串 */ - public static String AESEncode(String content) { + public static String aesEncode(String content) { try { //1.构造密钥生成器,指定为AES算法,不区分大小写 - KeyGenerator keygen = KeyGenerator.getInstance("AES"); + KeyGenerator keyGenerator = KeyGenerator.getInstance("AES"); //2.根据ecnodeRules规则初始化密钥生成器 //生成一个128位的随机源,根据传入的字节数组 SecureRandom random = SecureRandom.getInstance("SHA1PRNG"); - random.setSeed(encodeRules.getBytes()); - keygen.init(128, random); + random.setSeed(ENCODE_RULES.getBytes()); + keyGenerator.init(128, random); //3.产生原始对称密钥 - SecretKey original_key = keygen.generateKey(); + SecretKey originalKey = keyGenerator.generateKey(); //4.获得原始对称密钥的字节数组 - byte[] raw = original_key.getEncoded(); + byte[] raw = originalKey.getEncoded(); //5.根据字节数组生成AES密钥 SecretKey key = new SecretKeySpec(raw, "AES"); //6.根据指定算法AES自成密码器 @@ -48,16 +48,16 @@ public static String AESEncode(String content) { //7.初始化密码器,第一个参数为加密(Encrypt_mode)或者解密解密(Decrypt_mode)操作,第二个参数为使用的KEY cipher.init(Cipher.ENCRYPT_MODE, key); //8.获取加密内容的字节数组(这里要设置为utf-8)不然内容中如果有中文和英文混合中文就会解密为乱码 - byte[] byte_encode = content.getBytes("utf-8"); + byte[] byteEncode = content.getBytes("utf-8"); //9.根据密码器的初始化方式--加密:将数据加密 - byte[] byte_AES = cipher.doFinal(byte_encode); + byte[] byteAES = cipher.doFinal(byteEncode); //10.将加密后的数据转换为字符串 //这里用Base64Encoder中会找不到包 //解决办法: //在项目的Build path中先移除JRE System Library,再添加库JRE System Library,重新编译后就一切正常了。 - String AES_encode = new String(new BASE64Encoder().encode(byte_AES)); + String aesEncode = new String(new BASE64Encoder().encode(byteAES)); //11.将字符串返回 - return AES_encode; + return aesEncode; } catch (NoSuchAlgorithmException e) { e.printStackTrace(); } catch (NoSuchPaddingException e) { @@ -82,19 +82,19 @@ public static String AESEncode(String content) { * 2.将加密后的字符串反纺成byte[]数组 * 3.将加密内容解密 */ - public static String AESDecode(String content) { + public static String aesDecode(String content) { try { //1.构造密钥生成器,指定为AES算法,不区分大小写 KeyGenerator keygen = KeyGenerator.getInstance("AES"); //2.根据ecnodeRules规则初始化密钥生成器 //生成一个128位的随机源,根据传入的字节数组 SecureRandom random = SecureRandom.getInstance("SHA1PRNG"); - random.setSeed(encodeRules.getBytes()); + random.setSeed(ENCODE_RULES.getBytes()); keygen.init(128, random); //3.产生原始对称密钥 - SecretKey original_key = keygen.generateKey(); + SecretKey originalKey = keygen.generateKey(); //4.获得原始对称密钥的字节数组 - byte[] raw = original_key.getEncoded(); + byte[] raw = originalKey.getEncoded(); //5.根据字节数组生成AES密钥 SecretKey key = new SecretKeySpec(raw, "AES"); //6.根据指定算法AES自成密码器 @@ -102,13 +102,13 @@ public static String AESDecode(String content) { //7.初始化密码器,第一个参数为加密(Encrypt_mode)或者解密(Decrypt_mode)操作,第二个参数为使用的KEY cipher.init(Cipher.DECRYPT_MODE, key); //8.将加密并编码后的内容解码成字节数组 - byte[] byte_content = new BASE64Decoder().decodeBuffer(content); + byte[] byteContent = new BASE64Decoder().decodeBuffer(content); /* * 解密 */ - byte[] byte_decode = cipher.doFinal(byte_content); - String AES_decode = new String(byte_decode, "utf-8"); - return AES_decode; + byte[] byteDecode = cipher.doFinal(byteContent); + String aesDecode = new String(byteDecode, "utf-8"); + return aesDecode; } catch (NoSuchAlgorithmException e) { e.printStackTrace(); } catch (NoSuchPaddingException e) { @@ -134,9 +134,9 @@ public static void main(String[] args) { System.out.println("key | AESEncode | AESDecode"); for (String key : keys) { System.out.print(key + " | "); - String encryptString = AESEncode(key); + String encryptString = aesEncode(key); System.out.print(encryptString + " | "); - String decryptString = AESDecode(encryptString); + String decryptString = aesDecode(encryptString); System.out.println(decryptString); } } diff --git a/zheng-common/src/main/java/com/zheng/common/util/CaptchaUtil.java b/zheng-common/src/main/java/com/zheng/common/util/CaptchaUtil.java index 71fc396fe..ae9bf719e 100644 --- a/zheng-common/src/main/java/com/zheng/common/util/CaptchaUtil.java +++ b/zheng-common/src/main/java/com/zheng/common/util/CaptchaUtil.java @@ -53,8 +53,10 @@ public CaptchaUtil(int width, int height, int codeCount, int lineCount) { // 生成图片 private void creatImage() { - int fontWidth = width / codeCount;// 字体的宽度 - int fontHeight = height - 5;// 字体的高度 + // 字体的宽度 + int fontWidth = width / codeCount; + // 字体的高度 + int fontHeight = height - 5; int codeY = height - 8; // 图像buffer @@ -118,10 +120,12 @@ private String randomStr(int n) { // 得到随机颜色 private Color getRandColor(int fc, int bc) {// 给定范围获得随机颜色 - if (fc > 255) + if (fc > 255) { fc = 255; - if (bc > 255) + } + if (bc > 255) { bc = 255; + } int r = fc + random.nextInt(bc - fc); int g = fc + random.nextInt(bc - fc); int b = fc + random.nextInt(bc - fc); @@ -133,7 +137,7 @@ private Color getRandColor(int fc, int bc) {// 给定范围获得随机颜色 */ private Font getFont(int size) { Random random = new Random(); - Font font[] = new Font[5]; + Font[] font = new Font[5]; font[0] = new Font("Ravie", Font.PLAIN, size); font[1] = new Font("Antique Olive Compact", Font.PLAIN, size); font[2] = new Font("Fixedsys", Font.PLAIN, size); diff --git a/zheng-common/src/main/java/com/zheng/common/util/CookieUtil.java b/zheng-common/src/main/java/com/zheng/common/util/CookieUtil.java index a6ca9779d..714cca5a3 100644 --- a/zheng-common/src/main/java/com/zheng/common/util/CookieUtil.java +++ b/zheng-common/src/main/java/com/zheng/common/util/CookieUtil.java @@ -20,7 +20,9 @@ public class CookieUtil { public static void setCookie(HttpServletResponse response, String name, String value, String path, int maxAge) { Cookie cookie = new Cookie(name, value); cookie.setPath(path); - if (maxAge > 0) cookie.setMaxAge(maxAge); + if (maxAge > 0) { + cookie.setMaxAge(maxAge); + } response.addCookie(cookie); } public static void setCookie(HttpServletResponse response, String name, String value, int maxAge) { diff --git a/zheng-common/src/main/java/com/zheng/common/util/JdbcUtil.java b/zheng-common/src/main/java/com/zheng/common/util/JdbcUtil.java index 4448f0daf..68f2032b3 100644 --- a/zheng-common/src/main/java/com/zheng/common/util/JdbcUtil.java +++ b/zheng-common/src/main/java/com/zheng/common/util/JdbcUtil.java @@ -58,16 +58,16 @@ public List selectByParams(String sql, List params) throws SQLException { } rs = pstmt.executeQuery(); ResultSetMetaData metaData = rs.getMetaData(); - int cols_len = metaData.getColumnCount(); + int colsLen = metaData.getColumnCount(); while (rs.next()) { - Map map = new HashMap(); - for (int i = 0; i < cols_len; i ++) { - String cols_name = metaData.getColumnName(i + 1); - Object cols_value = rs.getObject(cols_name); - if (null == cols_value) { - cols_value = ""; + Map map = new HashMap(colsLen); + for (int i = 0; i < colsLen; i ++) { + String columnName = metaData.getColumnName(i + 1); + Object columnValue = rs.getObject(columnName); + if (null == columnValue) { + columnValue = ""; } - map.put(cols_name, cols_value); + map.put(columnName, columnValue); } list.add(map); } @@ -77,9 +77,15 @@ public List selectByParams(String sql, List params) throws SQLException { // 释放连接 public void release() { try { - if (null != rs) rs.close(); - if (null != pstmt) pstmt.close(); - if (null != conn) conn.close(); + if (null != rs) { + rs.close(); + } + if (null != pstmt) { + pstmt.close(); + } + if (null != conn) { + conn.close(); + } } catch (SQLException e) { e.printStackTrace(); } diff --git a/zheng-common/src/main/java/com/zheng/common/util/JmsUtil.java b/zheng-common/src/main/java/com/zheng/common/util/JmsUtil.java index 2a57fb36e..f3daa93f3 100644 --- a/zheng-common/src/main/java/com/zheng/common/util/JmsUtil.java +++ b/zheng-common/src/main/java/com/zheng/common/util/JmsUtil.java @@ -20,6 +20,7 @@ public class JmsUtil { */ public static void sendMessage(JmsTemplate jmsTemplate, Destination destination, final String textMessage) { jmsTemplate.send(destination, new MessageCreator() { + @Override public Message createMessage(Session session) throws JMSException { return session.createTextMessage(textMessage); } @@ -34,6 +35,7 @@ public Message createMessage(Session session) throws JMSException { */ public static void sendMessage(JmsTemplate jmsTemplate, Destination destination, final Serializable objectMessage) { jmsTemplate.send(destination, new MessageCreator() { + @Override public Message createMessage(Session session) throws JMSException { return session.createObjectMessage(objectMessage); } @@ -49,6 +51,7 @@ public Message createMessage(Session session) throws JMSException { */ public static void sendMessageDelay(JmsTemplate jmsTemplate, Destination destination, final Serializable objectMessage, final long delay) { jmsTemplate.send(destination, new MessageCreator() { + @Override public Message createMessage(Session session) throws JMSException { ObjectMessage om = session.createObjectMessage(objectMessage); om.setLongProperty(ScheduledMessage.AMQ_SCHEDULED_DELAY, delay); diff --git a/zheng-common/src/main/java/com/zheng/common/util/MD5Util.java b/zheng-common/src/main/java/com/zheng/common/util/MD5Util.java index 23725b965..97e7a6cd9 100644 --- a/zheng-common/src/main/java/com/zheng/common/util/MD5Util.java +++ b/zheng-common/src/main/java/com/zheng/common/util/MD5Util.java @@ -8,9 +8,9 @@ */ public class MD5Util { - public final static String MD5(String content) { + public final static String md5(String content) { //用于加密的字符 - char md5String[] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', + char[] md5String = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'}; try { //使用平台的默认字符集将此 String 编码为 byte序列,并将结果存储到一个新的 byte数组中 @@ -27,7 +27,7 @@ public final static String MD5(String content) { // 把密文转换成十六进制的字符串形式 int j = md.length; - char str[] = new char[j * 2]; + char[] str = new char[j * 2]; int k = 0; for (int i = 0; i < j; i++) { // i = 0 byte byte0 = md[i]; //95 diff --git a/zheng-common/src/main/java/com/zheng/common/util/MybatisGeneratorUtil.java b/zheng-common/src/main/java/com/zheng/common/util/MybatisGeneratorUtil.java index a3d720e4b..d3b4e5614 100644 --- a/zheng-common/src/main/java/com/zheng/common/util/MybatisGeneratorUtil.java +++ b/zheng-common/src/main/java/com/zheng/common/util/MybatisGeneratorUtil.java @@ -30,25 +30,25 @@ public class MybatisGeneratorUtil { /** * 根据模板生成generatorConfig.xml文件 - * @param jdbc_driver 驱动路径 - * @param jdbc_url 链接 - * @param jdbc_username 帐号 - * @param jdbc_password 密码 + * @param jdbcDriver 驱动路径 + * @param jdbcUrl 链接 + * @param jdbcUsername 帐号 + * @param jdbcPassword 密码 * @param module 项目模块 * @param database 数据库 - * @param table_prefix 表前缀 - * @param package_name 包名 + * @param tablePrefix 表前缀 + * @param packageName 包名 */ public static void generator( - String jdbc_driver, - String jdbc_url, - String jdbc_username, - String jdbc_password, + String jdbcDriver, + String jdbcUrl, + String jdbcUsername, + String jdbcPassword, String module, String database, - String table_prefix, - String package_name, - Map last_insert_id_tables) throws Exception{ + String tablePrefix, + String packageName, + Map lastInsertIdTables) throws Exception{ String os = System.getProperty("os.name"); if (os.toLowerCase().startsWith("win")) { @@ -65,9 +65,9 @@ public static void generator( String targetProject = module + "/" + module + "-dao"; String basePath = MybatisGeneratorUtil.class.getResource("/").getPath().replace("/target/classes/", "").replace(targetProject, "").replaceFirst("/", ""); - String generatorConfig_xml = MybatisGeneratorUtil.class.getResource("/").getPath().replace("/target/classes/", "") + "/src/main/resources/generatorConfig.xml"; + String generatorConfigXml = MybatisGeneratorUtil.class.getResource("/").getPath().replace("/target/classes/", "") + "/src/main/resources/generatorConfig.xml"; targetProject = basePath + targetProject; - String sql = "SELECT table_name FROM INFORMATION_SCHEMA.TABLES WHERE table_schema = '" + database + "' AND table_name LIKE '" + table_prefix + "_%';"; + String sql = "SELECT table_name FROM INFORMATION_SCHEMA.TABLES WHERE table_schema = '" + database + "' AND table_name LIKE '" + tablePrefix + "_%';"; System.out.println("========== 开始生成generatorConfig.xml文件 =========="); List> tables = new ArrayList<>(); @@ -76,31 +76,31 @@ public static void generator( Map table; // 查询定制前缀项目的所有表 - JdbcUtil jdbcUtil = new JdbcUtil(jdbc_driver, jdbc_url, jdbc_username, AESUtil.AESDecode(jdbc_password)); + JdbcUtil jdbcUtil = new JdbcUtil(jdbcDriver, jdbcUrl, jdbcUsername, AESUtil.aesDecode(jdbcPassword)); List result = jdbcUtil.selectByParams(sql, null); for (Map map : result) { System.out.println(map.get("TABLE_NAME")); - table = new HashMap<>(); + table = new HashMap<>(2); table.put("table_name", map.get("TABLE_NAME")); table.put("model_name", lineToHump(ObjectUtils.toString(map.get("TABLE_NAME")))); tables.add(table); } jdbcUtil.release(); - String targetProject_sqlMap = basePath + module + "/" + module + "-rpc-service"; + String targetProjectSqlMap = basePath + module + "/" + module + "-rpc-service"; context.put("tables", tables); - context.put("generator_javaModelGenerator_targetPackage", package_name + ".dao.model"); - context.put("generator_sqlMapGenerator_targetPackage", package_name + ".dao.mapper"); - context.put("generator_javaClientGenerator_targetPackage", package_name + ".dao.mapper"); + context.put("generator_javaModelGenerator_targetPackage", packageName + ".dao.model"); + context.put("generator_sqlMapGenerator_targetPackage", packageName + ".dao.mapper"); + context.put("generator_javaClientGenerator_targetPackage", packageName + ".dao.mapper"); context.put("targetProject", targetProject); - context.put("targetProject_sqlMap", targetProject_sqlMap); - context.put("generator_jdbc_password", AESUtil.AESDecode(jdbc_password)); - context.put("last_insert_id_tables", last_insert_id_tables); - VelocityUtil.generate(generatorConfig_vm, generatorConfig_xml, context); + context.put("targetProject_sqlMap", targetProjectSqlMap); + context.put("generator_jdbc_password", AESUtil.aesDecode(jdbcPassword)); + context.put("last_insert_id_tables", lastInsertIdTables); + VelocityUtil.generate(generatorConfig_vm, generatorConfigXml, context); // 删除旧代码 - deleteDir(new File(targetProject + "/src/main/java/" + package_name.replaceAll("\\.", "/") + "/dao/model")); - deleteDir(new File(targetProject + "/src/main/java/" + package_name.replaceAll("\\.", "/") + "/dao/mapper")); - deleteDir(new File(targetProject_sqlMap + "/src/main/java/" + package_name.replaceAll("\\.", "/") + "/dao/mapper")); + deleteDir(new File(targetProject + "/src/main/java/" + packageName.replaceAll("\\.", "/") + "/dao/model")); + deleteDir(new File(targetProject + "/src/main/java/" + packageName.replaceAll("\\.", "/") + "/dao/mapper")); + deleteDir(new File(targetProjectSqlMap + "/src/main/java/" + packageName.replaceAll("\\.", "/") + "/dao/mapper")); } catch (Exception e) { e.printStackTrace(); } @@ -108,7 +108,7 @@ public static void generator( System.out.println("========== 开始运行MybatisGenerator =========="); List warnings = new ArrayList<>(); - File configFile = new File(generatorConfig_xml); + File configFile = new File(generatorConfigXml); ConfigurationParser cp = new ConfigurationParser(warnings); Configuration config = cp.parseConfiguration(configFile); DefaultShellCallback callback = new DefaultShellCallback(true); @@ -121,8 +121,8 @@ public static void generator( System.out.println("========== 开始生成Service =========="); String ctime = new SimpleDateFormat("yyyy/M/d").format(new Date()); - String servicePath = basePath + module + "/" + module + "-rpc-api" + "/src/main/java/" + package_name.replaceAll("\\.", "/") + "/rpc/api"; - String serviceImplPath = basePath + module + "/" + module + "-rpc-service" + "/src/main/java/" + package_name.replaceAll("\\.", "/") + "/rpc/service/impl"; + String servicePath = basePath + module + "/" + module + "-rpc-api" + "/src/main/java/" + packageName.replaceAll("\\.", "/") + "/rpc/api"; + String serviceImplPath = basePath + module + "/" + module + "-rpc-service" + "/src/main/java/" + packageName.replaceAll("\\.", "/") + "/rpc/service/impl"; for (int i = 0; i < tables.size(); i++) { String model = StringUtil.lineToHump(ObjectUtils.toString(tables.get(i).get("table_name"))); String service = servicePath + "/" + model + "Service.java"; @@ -132,7 +132,7 @@ public static void generator( File serviceFile = new File(service); if (!serviceFile.exists()) { VelocityContext context = new VelocityContext(); - context.put("package_name", package_name); + context.put("package_name", packageName); context.put("model", model); context.put("ctime", ctime); VelocityUtil.generate(service_vm, service, context); @@ -142,7 +142,7 @@ public static void generator( File serviceMockFile = new File(serviceMock); if (!serviceMockFile.exists()) { VelocityContext context = new VelocityContext(); - context.put("package_name", package_name); + context.put("package_name", packageName); context.put("model", model); context.put("ctime", ctime); VelocityUtil.generate(serviceMock_vm, serviceMock, context); @@ -152,7 +152,7 @@ public static void generator( File serviceImplFile = new File(serviceImpl); if (!serviceImplFile.exists()) { VelocityContext context = new VelocityContext(); - context.put("package_name", package_name); + context.put("package_name", packageName); context.put("model", model); context.put("mapper", StringUtil.toLowerCaseFirstOne(model)); context.put("ctime", ctime); diff --git a/zheng-common/src/main/java/com/zheng/common/util/Paginator.java b/zheng-common/src/main/java/com/zheng/common/util/Paginator.java index df753676c..cdd1fd7d8 100644 --- a/zheng-common/src/main/java/com/zheng/common/util/Paginator.java +++ b/zheng-common/src/main/java/com/zheng/common/util/Paginator.java @@ -10,14 +10,22 @@ */ public class Paginator { - private long total = 0l; // 总记录数 - private int page = 1; // 当前页数 - private long totalPage = 1; // 总页数 - private int rows = 10; // 每页记录数 - private int step = 5; // 最多显示分页页码数 - private String param = "page"; // 分页参数名称,用于支持一个页面多个分页功能 - private String url = ""; // 项目路径 - private String query = ""; // 当前页所有参数 + // 总记录数 + private long total = 0L; + // 当前页数 + private int page = 1; + // 总页数 + private long totalPage = 1; + // 每页记录数 + private int rows = 10; + // 最多显示分页页码数 + private int step = 5; + // 分页参数名称,用于支持一个页面多个分页功能 + private String param = "page"; + // 项目路径 + private String url = ""; + // 当前页所有参数 + private String query = ""; public Paginator() { @@ -129,15 +137,18 @@ public String getHtml() { String params = ""; String[] querys = query.split("&"); for (int i = 0; i < querys.length; i++) { - if (querys[i].startsWith(param)) + if (querys[i].startsWith(param)) { continue; - if (params.equals("")) + } + if ("".equals(params)) { params = querys[i]; - else + } else { params += "&" + querys[i]; + } } - if (!params.equals("")) + if (!"".equals(params)) { url += "?" + params; + } } // 结果html String pages = ""; diff --git a/zheng-common/src/main/java/com/zheng/common/util/PropertiesFileUtil.java b/zheng-common/src/main/java/com/zheng/common/util/PropertiesFileUtil.java index 94f205c55..d58d389c5 100644 --- a/zheng-common/src/main/java/com/zheng/common/util/PropertiesFileUtil.java +++ b/zheng-common/src/main/java/com/zheng/common/util/PropertiesFileUtil.java @@ -40,7 +40,7 @@ public static synchronized PropertiesFileUtil getInstance(String name) { configMap.put(name, conf); } // 判断是否打开的资源文件是否超时1分钟 - if ((new Date().getTime() - conf.getLoadTime().getTime()) > TIME_OUT) { + if ((System.currentTimeMillis() - conf.getLoadTime().getTime()) > TIME_OUT) { conf = new PropertiesFileUtil(name); configMap.put(name, conf); } @@ -52,7 +52,7 @@ public String get(String key) { try { String value = resourceBundle.getString(key); return value; - }catch (MissingResourceException e) { + } catch (MissingResourceException e) { return ""; } } @@ -62,7 +62,7 @@ public Integer getInt(String key) { try { String value = resourceBundle.getString(key); return Integer.parseInt(value); - }catch (MissingResourceException e) { + } catch (MissingResourceException e) { return null; } } @@ -75,7 +75,7 @@ public boolean getBool(String key) { return true; } return false; - }catch (MissingResourceException e) { + } catch (MissingResourceException e) { return false; } } diff --git a/zheng-common/src/main/java/com/zheng/common/util/RedisUtil.java b/zheng-common/src/main/java/com/zheng/common/util/RedisUtil.java index f80ce26b5..ba913317b 100644 --- a/zheng-common/src/main/java/com/zheng/common/util/RedisUtil.java +++ b/zheng-common/src/main/java/com/zheng/common/util/RedisUtil.java @@ -18,7 +18,7 @@ public class RedisUtil { protected static ReentrantLock lockPool = new ReentrantLock(); protected static ReentrantLock lockJedis = new ReentrantLock(); - private static Logger _log = LoggerFactory.getLogger(RedisUtil.class); + private static final Logger LOGGER = LoggerFactory.getLogger(RedisUtil.class); // Redis服务器IP private static String IP = PropertiesFileUtil.getInstance("redis").get("master.redis.ip"); @@ -27,7 +27,7 @@ public class RedisUtil { private static int PORT = PropertiesFileUtil.getInstance("redis").getInt("master.redis.port"); // 访问密码 - private static String PASSWORD = AESUtil.AESDecode(PropertiesFileUtil.getInstance("redis").get("master.redis.password")); + private static String PASSWORD = AESUtil.aesDecode(PropertiesFileUtil.getInstance("redis").get("master.redis.password")); // 可用连接实例的最大数目,默认值为8; // 如果赋值为-1,则表示不限制;如果pool已经分配了maxActive个jedis实例,则此时pool的状态为exhausted(耗尽)。 private static int MAX_ACTIVE = PropertiesFileUtil.getInstance("redis").getInt("master.redis.max_active"); @@ -49,9 +49,12 @@ public class RedisUtil { /** * redis过期时间,以秒为单位 */ - public final static int EXRP_HOUR = 60 * 60; //一小时 - public final static int EXRP_DAY = 60 * 60 * 24; //一天 - public final static int EXRP_MONTH = 60 * 60 * 24 * 30; //一个月 + // 一小时 + public final static int EXRP_HOUR = 60 * 60; + // 一天 + public final static int EXRP_DAY = 60 * 60 * 24; + // 一个月 + public final static int EXRP_MONTH = 60 * 60 * 24 * 30; /** * 初始化Redis连接池 @@ -65,7 +68,7 @@ private static void initialPool() { config.setTestOnBorrow(TEST_ON_BORROW); jedisPool = new JedisPool(config, IP, PORT, TIMEOUT); } catch (Exception e) { - _log.error("First create JedisPool error : " + e); + LOGGER.error("First create JedisPool error : " + e); } } @@ -96,7 +99,7 @@ public synchronized static Jedis getJedis() { } } } catch (Exception e) { - _log.error("Get jedis error : " + e); + LOGGER.error("Get jedis error : " + e); } return jedis; } @@ -113,7 +116,7 @@ public synchronized static void set(String key, String value) { jedis.set(key, value); jedis.close(); } catch (Exception e) { - _log.error("Set key error : " + e); + LOGGER.error("Set key error : " + e); } } @@ -128,7 +131,7 @@ public synchronized static void set(byte[] key, byte[] value) { jedis.set(key, value); jedis.close(); } catch (Exception e) { - _log.error("Set key error : " + e); + LOGGER.error("Set key error : " + e); } } @@ -145,7 +148,7 @@ public synchronized static void set(String key, String value, int seconds) { jedis.setex(key, seconds, value); jedis.close(); } catch (Exception e) { - _log.error("Set keyex error : " + e); + LOGGER.error("Set keyex error : " + e); } } @@ -162,7 +165,7 @@ public synchronized static void set(byte[] key, byte[] value, int seconds) { jedis.expire(key, seconds); jedis.close(); } catch (Exception e) { - _log.error("Set key error : " + e); + LOGGER.error("Set key error : " + e); } } @@ -206,7 +209,7 @@ public synchronized static void remove(String key) { jedis.del(key); jedis.close(); } catch (Exception e) { - _log.error("Remove keyex error : " + e); + LOGGER.error("Remove keyex error : " + e); } } @@ -220,7 +223,7 @@ public synchronized static void remove(byte[] key) { jedis.del(key); jedis.close(); } catch (Exception e) { - _log.error("Remove keyex error : " + e); + LOGGER.error("Remove keyex error : " + e); } } @@ -235,7 +238,7 @@ public synchronized static void lpush(String key, String... strings) { jedis.lpush(key, strings); jedis.close(); } catch (Exception e) { - _log.error("lpush error : " + e); + LOGGER.error("lpush error : " + e); } } @@ -251,7 +254,7 @@ public synchronized static void lrem(String key, long count, String value) { jedis.lrem(key, count, value); jedis.close(); } catch (Exception e) { - _log.error("lpush error : " + e); + LOGGER.error("lpush error : " + e); } } @@ -268,7 +271,7 @@ public synchronized static void sadd(String key, String value, int seconds) { jedis.expire(key, seconds); jedis.close(); } catch (Exception e) { - _log.error("sadd error : " + e); + LOGGER.error("sadd error : " + e); } } diff --git a/zheng-common/src/main/java/com/zheng/common/util/RequestUtil.java b/zheng-common/src/main/java/com/zheng/common/util/RequestUtil.java index 0723426db..6b085f4ec 100644 --- a/zheng-common/src/main/java/com/zheng/common/util/RequestUtil.java +++ b/zheng-common/src/main/java/com/zheng/common/util/RequestUtil.java @@ -25,7 +25,7 @@ public String removeParam(HttpServletRequest request, String paramName) { if (key.equals(paramName)) { continue; } - if (queryString.equals("")) { + if ("".equals(queryString)) { queryString = key + "=" + request.getParameter(key); } else { queryString += "&" + key + "=" + request.getParameter(key); diff --git a/zheng-common/src/main/java/com/zheng/common/util/ZhengAdminUtil.java b/zheng-common/src/main/java/com/zheng/common/util/ZhengAdminUtil.java index de0881302..55b607100 100644 --- a/zheng-common/src/main/java/com/zheng/common/util/ZhengAdminUtil.java +++ b/zheng-common/src/main/java/com/zheng/common/util/ZhengAdminUtil.java @@ -13,7 +13,7 @@ */ public class ZhengAdminUtil implements InitializingBean, ServletContextAware { - private static Logger _log = LoggerFactory.getLogger(ZhengAdminUtil.class); + private static final Logger LOGGER = LoggerFactory.getLogger(ZhengAdminUtil.class); @Override public void afterPropertiesSet() throws Exception { @@ -22,15 +22,15 @@ public void afterPropertiesSet() throws Exception { @Override public void setServletContext(ServletContext servletContext) { - _log.info("===== 开始解压zheng-admin ====="); + LOGGER.info("===== 开始解压zheng-admin ====="); String version = PropertiesFileUtil.getInstance("zheng-admin-client").get("zheng.admin.version"); - _log.info("zheng-admin.jar 版本: {}", version); + LOGGER.info("zheng-admin.jar 版本: {}", version); String jarPath = servletContext.getRealPath("/WEB-INF/lib/zheng-admin-" + version + ".jar"); - _log.info("zheng-admin.jar 包路径: {}", jarPath); + LOGGER.info("zheng-admin.jar 包路径: {}", jarPath); String resources = servletContext.getRealPath("/") + "/resources/zheng-admin"; - _log.info("zheng-admin.jar 解压到: {}", resources); + LOGGER.info("zheng-admin.jar 解压到: {}", resources); JarUtil.decompress(jarPath, resources); - _log.info("===== 解压zheng-admin完成 ====="); + LOGGER.info("===== 解压zheng-admin完成 ====="); } } diff --git a/zheng-common/src/main/java/com/zheng/common/util/key/SystemClock.java b/zheng-common/src/main/java/com/zheng/common/util/key/SystemClock.java index 71e2d9e53..c68904902 100644 --- a/zheng-common/src/main/java/com/zheng/common/util/key/SystemClock.java +++ b/zheng-common/src/main/java/com/zheng/common/util/key/SystemClock.java @@ -1,10 +1,7 @@ package com.zheng.common.util.key; import java.sql.Timestamp; -import java.util.concurrent.Executors; -import java.util.concurrent.ScheduledExecutorService; -import java.util.concurrent.ThreadFactory; -import java.util.concurrent.TimeUnit; +import java.util.concurrent.*; import java.util.concurrent.atomic.AtomicLong; /** @@ -20,47 +17,50 @@ * @author lry */ public class SystemClock { - private final long period; - private final AtomicLong now; + private final long period; + private final AtomicLong now; + ExecutorService executor = Executors.newSingleThreadExecutor(); - private SystemClock(long period) { - this.period = period; - this.now = new AtomicLong(System.currentTimeMillis()); - scheduleClockUpdating(); - } + private SystemClock(long period) { + this.period = period; + this.now = new AtomicLong(System.currentTimeMillis()); + scheduleClockUpdating(); + } - private static class InstanceHolder { - public static final SystemClock INSTANCE = new SystemClock(1); - } + private static class InstanceHolder { + public static final SystemClock INSTANCE = new SystemClock(1); + } - private static SystemClock instance() { - return InstanceHolder.INSTANCE; - } + private static SystemClock instance() { + return InstanceHolder.INSTANCE; + } - private void scheduleClockUpdating() { - ScheduledExecutorService scheduler = Executors.newSingleThreadScheduledExecutor(new ThreadFactory() { - public Thread newThread(Runnable runnable) { - Thread thread = new Thread(runnable, "System Clock"); - thread.setDaemon(true); - return thread; - } - }); - scheduler.scheduleAtFixedRate(new Runnable() { - public void run() { - now.set(System.currentTimeMillis()); - } - }, period, period, TimeUnit.MILLISECONDS); - } + private void scheduleClockUpdating() { + ScheduledExecutorService scheduler = Executors.newSingleThreadScheduledExecutor(new ThreadFactory() { + @Override + public Thread newThread(Runnable runnable) { + Thread thread = new Thread(runnable, "System Clock"); + thread.setDaemon(true); + return thread; + } + }); + scheduler.scheduleAtFixedRate(new Runnable() { + @Override + public void run() { + now.set(System.currentTimeMillis()); + } + }, period, period, TimeUnit.MILLISECONDS); + } - private long currentTimeMillis() { - return now.get(); - } + private long currentTimeMillis() { + return now.get(); + } - public static long now() { - return instance().currentTimeMillis(); - } + public static long now() { + return instance().currentTimeMillis(); + } - public static String nowDate() { - return new Timestamp(instance().currentTimeMillis()).toString(); - } + public static String nowDate() { + return new Timestamp(instance().currentTimeMillis()).toString(); + } } diff --git a/zheng-common/src/main/resources/template/Controller.vm b/zheng-common/src/main/resources/template/Controller.vm index 8cdf72857..99752a563 100644 --- a/zheng-common/src/main/resources/template/Controller.vm +++ b/zheng-common/src/main/resources/template/Controller.vm @@ -18,7 +18,7 @@ import org.springframework.web.bind.annotation.RequestMethod; @Api(value = "${modelname}控制器", description = "${modelname}管理") public class ${model}Controller extends BaseController { - private static Logger _log = LoggerFactory.getLogger(${model}Controller.class); + private static final Logger LOGGER = LoggerFactory.getLogger(${model}Controller.class); diff --git a/zheng-common/src/main/resources/template/ServiceImpl.vm b/zheng-common/src/main/resources/template/ServiceImpl.vm index 2ffa2502a..5175f345a 100644 --- a/zheng-common/src/main/resources/template/ServiceImpl.vm +++ b/zheng-common/src/main/resources/template/ServiceImpl.vm @@ -21,7 +21,7 @@ import org.springframework.transaction.annotation.Transactional; @BaseService public class ${model}ServiceImpl extends BaseServiceImpl<${model}Mapper, ${model}, ${model}Example> implements ${model}Service { - private static Logger _log = LoggerFactory.getLogger(${model}ServiceImpl.class); + private static final Logger LOGGER = LoggerFactory.getLogger(${model}ServiceImpl.class); @Autowired ${model}Mapper ${mapper}Mapper; diff --git a/zheng-demo/zheng-demo-web/src/main/java/com/zheng/demo/web/controller/IndexController.java b/zheng-demo/zheng-demo-web/src/main/java/com/zheng/demo/web/controller/IndexController.java index cf8dffe7f..db71b3b1d 100644 --- a/zheng-demo/zheng-demo-web/src/main/java/com/zheng/demo/web/controller/IndexController.java +++ b/zheng-demo/zheng-demo-web/src/main/java/com/zheng/demo/web/controller/IndexController.java @@ -21,7 +21,7 @@ @Controller public class IndexController extends BaseController { - private static Logger _log = LoggerFactory.getLogger(IndexController.class); + private static final Logger LOGGER = LoggerFactory.getLogger(IndexController.class); @Autowired private DemoService demoService; @@ -45,12 +45,12 @@ public String thymeleaf(Model model) { model.addAttribute("host", demoService.sayHello("http://www.zhangshuzheng.cn/")); List users = new ArrayList<>(); User user = new User(); - user.setId(1l); + user.setId(1L); user.setAge(11); user.setName("zhangsan"); users.add(user); user = new User(); - user.setId(2l); + user.setId(2L); user.setAge(22); user.setName("lisi"); users.add(user); diff --git a/zheng-demo/zheng-demo-web/src/main/java/com/zheng/demo/web/interceptor/DemoInterceptor.java b/zheng-demo/zheng-demo-web/src/main/java/com/zheng/demo/web/interceptor/DemoInterceptor.java index b9aaa5f71..d7728cf25 100644 --- a/zheng-demo/zheng-demo-web/src/main/java/com/zheng/demo/web/interceptor/DemoInterceptor.java +++ b/zheng-demo/zheng-demo-web/src/main/java/com/zheng/demo/web/interceptor/DemoInterceptor.java @@ -15,12 +15,12 @@ */ public class DemoInterceptor extends HandlerInterceptorAdapter { - private static Logger _log = LoggerFactory.getLogger(DemoInterceptor.class); + private static final Logger LOGGER = LoggerFactory.getLogger(DemoInterceptor.class); @Override public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { // 过滤ajax - if (null != request.getHeader("X-Requested-With") && request.getHeader("X-Requested-With").equalsIgnoreCase("XMLHttpRequest")) { + if (null != request.getHeader("X-Requested-With") && "XMLHttpRequest".equalsIgnoreCase(request.getHeader("X-Requested-With"))) { return true; } String appName = PropertiesFileUtil.getInstance().get("app.name"); diff --git a/zheng-oss/zheng-oss-sdk/src/main/java/com/zheng/oss/common/constant/OssResultConstant.java b/zheng-oss/zheng-oss-sdk/src/main/java/com/zheng/oss/common/constant/OssResultConstant.java index 75729e864..d8f381e7e 100644 --- a/zheng-oss/zheng-oss-sdk/src/main/java/com/zheng/oss/common/constant/OssResultConstant.java +++ b/zheng-oss/zheng-oss-sdk/src/main/java/com/zheng/oss/common/constant/OssResultConstant.java @@ -6,7 +6,14 @@ */ public enum OssResultConstant { + /** + * 失败 + */ FAILED(0, "failed"), + + /** + * 成功 + */ SUCCESS(1, "success"); public int code; diff --git a/zheng-oss/zheng-oss-web/src/main/java/com/zheng/oss/web/QiniuDemo.java b/zheng-oss/zheng-oss-web/src/main/java/com/zheng/oss/web/QiniuDemo.java index 96d2474ec..b8967248a 100644 --- a/zheng-oss/zheng-oss-web/src/main/java/com/zheng/oss/web/QiniuDemo.java +++ b/zheng-oss/zheng-oss-web/src/main/java/com/zheng/oss/web/QiniuDemo.java @@ -12,17 +12,17 @@ */ public class QiniuDemo { //设置好账号的ACCESS_KEY和SECRET_KEY - String ACCESS_KEY = ""; - String SECRET_KEY = ""; + String accessKey = ""; + String secretKey = ""; //要上传的空间 String bucketname = "zheng"; //上传到七牛后保存的文件名 String key = "my-java.png"; //上传文件的路径 - String FilePath = "C:\\Users\\admin\\Pictures\\zsz\\20161108161228.png"; + String filePath = "C:\\Users\\admin\\Pictures\\zsz\\20161108161228.png"; //密钥配置 - Auth auth = Auth.create(ACCESS_KEY, SECRET_KEY); + Auth auth = Auth.create(accessKey, secretKey); //创建上传对象 UploadManager uploadManager = new UploadManager(); @@ -34,7 +34,7 @@ public String getUpToken(){ public void upload() throws IOException { try { //调用put方法上传 - Response res = uploadManager.put(FilePath, key, getUpToken()); + Response res = uploadManager.put(filePath, key, getUpToken()); //打印返回的信息 System.out.println(res.bodyString()); } catch (QiniuException e) { diff --git a/zheng-oss/zheng-oss-web/src/main/java/com/zheng/oss/web/controller/AliyunOssController.java b/zheng-oss/zheng-oss-web/src/main/java/com/zheng/oss/web/controller/AliyunOssController.java index 59ab58f17..f4ab520d8 100644 --- a/zheng-oss/zheng-oss-web/src/main/java/com/zheng/oss/web/controller/AliyunOssController.java +++ b/zheng-oss/zheng-oss-web/src/main/java/com/zheng/oss/web/controller/AliyunOssController.java @@ -22,7 +22,7 @@ @RequestMapping("/aliyun/oss") public class AliyunOssController { - private static Logger _log = LoggerFactory.getLogger(AliyunOssController.class); + private static final Logger LOGGER = LoggerFactory.getLogger(AliyunOssController.class); @Autowired private AliyunOssService aliyunOssService; diff --git a/zheng-oss/zheng-oss-web/src/main/java/com/zheng/oss/web/controller/DemoController.java b/zheng-oss/zheng-oss-web/src/main/java/com/zheng/oss/web/controller/DemoController.java index 910807f2b..5821c4a5d 100644 --- a/zheng-oss/zheng-oss-web/src/main/java/com/zheng/oss/web/controller/DemoController.java +++ b/zheng-oss/zheng-oss-web/src/main/java/com/zheng/oss/web/controller/DemoController.java @@ -26,7 +26,7 @@ @RequestMapping("/demo") public class DemoController extends BaseController { - private static Logger _log = LoggerFactory.getLogger(DemoController.class); + private static final Logger LOGGER = LoggerFactory.getLogger(DemoController.class); @Autowired private AliyunOssService aliyunOssService; @@ -56,7 +56,9 @@ public String download1() throws IOException { BufferedReader reader = new BufferedReader(new InputStreamReader(content)); while (true) { String line = reader.readLine(); - if (line == null) break; + if (line == null) { + break; + } result.append("\n" + line); } content.close(); @@ -72,7 +74,7 @@ public String download2() throws IOException { @GetMapping("/aliyun/upload") public String upload(Model model) { JSONObject policy = aliyunOssService.policy(); - _log.info("policy={}", policy); + LOGGER.info("policy={}", policy); model.addAttribute("policy", policy); return thymeleaf("/aliyun/upload"); } diff --git a/zheng-oss/zheng-oss-web/src/main/java/com/zheng/oss/web/service/AliyunOssService.java b/zheng-oss/zheng-oss-web/src/main/java/com/zheng/oss/web/service/AliyunOssService.java index 75f487ce5..1ebfeb794 100644 --- a/zheng-oss/zheng-oss-web/src/main/java/com/zheng/oss/web/service/AliyunOssService.java +++ b/zheng-oss/zheng-oss-web/src/main/java/com/zheng/oss/web/service/AliyunOssService.java @@ -21,7 +21,7 @@ @Service public class AliyunOssService { - private static Logger _log = LoggerFactory.getLogger(AliyunOssService.class); + private static final Logger LOGGER = LoggerFactory.getLogger(AliyunOssService.class); @Autowired private OSSClient aliyunOssClient; @@ -64,7 +64,7 @@ public JSONObject policy() { result.put("callback", callbackData); result.put("action", action); } catch (Exception e) { - _log.error("签名生成失败", e); + LOGGER.error("签名生成失败", e); } return result; } diff --git a/zheng-pay/zheng-pay-common/src/main/java/com/zheng/pay/common/constant/PayResultConstant.java b/zheng-pay/zheng-pay-common/src/main/java/com/zheng/pay/common/constant/PayResultConstant.java index ee5be8a3d..47ccca2da 100644 --- a/zheng-pay/zheng-pay-common/src/main/java/com/zheng/pay/common/constant/PayResultConstant.java +++ b/zheng-pay/zheng-pay-common/src/main/java/com/zheng/pay/common/constant/PayResultConstant.java @@ -6,7 +6,14 @@ */ public enum PayResultConstant { + /** + * 失败 + */ FAILED(0, "failed"), + + /** + * 成功 + */ SUCCESS(1, "success"); public int code; diff --git a/zheng-pay/zheng-pay-rpc-service/src/main/java/com/zheng/pay/rpc/ZhengPayRpcServiceApplication.java b/zheng-pay/zheng-pay-rpc-service/src/main/java/com/zheng/pay/rpc/ZhengPayRpcServiceApplication.java index c54fa3b09..db4776b9b 100644 --- a/zheng-pay/zheng-pay-rpc-service/src/main/java/com/zheng/pay/rpc/ZhengPayRpcServiceApplication.java +++ b/zheng-pay/zheng-pay-rpc-service/src/main/java/com/zheng/pay/rpc/ZhengPayRpcServiceApplication.java @@ -10,12 +10,12 @@ */ public class ZhengPayRpcServiceApplication { - private static Logger _log = LoggerFactory.getLogger(ZhengPayRpcServiceApplication.class); + private static final Logger LOGGER = LoggerFactory.getLogger(ZhengPayRpcServiceApplication.class); public static void main(String[] args) { - _log.info(">>>>> zheng-pay-rpc-service 正在启动 <<<<<"); + LOGGER.info(">>>>> zheng-pay-rpc-service 正在启动 <<<<<"); new ClassPathXmlApplicationContext("classpath:META-INF/spring/*.xml"); - _log.info(">>>>> zheng-pay-rpc-service 启动完成 <<<<<"); + LOGGER.info(">>>>> zheng-pay-rpc-service 启动完成 <<<<<"); } } diff --git a/zheng-pay/zheng-pay-rpc-service/src/main/java/com/zheng/pay/rpc/service/impl/PayInOrderDetailServiceImpl.java b/zheng-pay/zheng-pay-rpc-service/src/main/java/com/zheng/pay/rpc/service/impl/PayInOrderDetailServiceImpl.java index d936a9124..300ac3fa1 100644 --- a/zheng-pay/zheng-pay-rpc-service/src/main/java/com/zheng/pay/rpc/service/impl/PayInOrderDetailServiceImpl.java +++ b/zheng-pay/zheng-pay-rpc-service/src/main/java/com/zheng/pay/rpc/service/impl/PayInOrderDetailServiceImpl.java @@ -21,7 +21,7 @@ @BaseService public class PayInOrderDetailServiceImpl extends BaseServiceImpl implements PayInOrderDetailService { - private static Logger _log = LoggerFactory.getLogger(PayInOrderDetailServiceImpl.class); + private static final Logger LOGGER = LoggerFactory.getLogger(PayInOrderDetailServiceImpl.class); @Autowired PayInOrderDetailMapper payInOrderDetailMapper; diff --git a/zheng-pay/zheng-pay-rpc-service/src/main/java/com/zheng/pay/rpc/service/impl/PayInOrderServiceImpl.java b/zheng-pay/zheng-pay-rpc-service/src/main/java/com/zheng/pay/rpc/service/impl/PayInOrderServiceImpl.java index 2dc248f20..c1be85a79 100644 --- a/zheng-pay/zheng-pay-rpc-service/src/main/java/com/zheng/pay/rpc/service/impl/PayInOrderServiceImpl.java +++ b/zheng-pay/zheng-pay-rpc-service/src/main/java/com/zheng/pay/rpc/service/impl/PayInOrderServiceImpl.java @@ -21,7 +21,7 @@ @BaseService public class PayInOrderServiceImpl extends BaseServiceImpl implements PayInOrderService { - private static Logger _log = LoggerFactory.getLogger(PayInOrderServiceImpl.class); + private static final Logger log = LoggerFactory.getLogger(PayInOrderServiceImpl.class); @Autowired PayInOrderMapper payInOrderMapper; diff --git a/zheng-pay/zheng-pay-rpc-service/src/main/java/com/zheng/pay/rpc/service/impl/PayMchServiceImpl.java b/zheng-pay/zheng-pay-rpc-service/src/main/java/com/zheng/pay/rpc/service/impl/PayMchServiceImpl.java index b258be40b..157e2ff22 100644 --- a/zheng-pay/zheng-pay-rpc-service/src/main/java/com/zheng/pay/rpc/service/impl/PayMchServiceImpl.java +++ b/zheng-pay/zheng-pay-rpc-service/src/main/java/com/zheng/pay/rpc/service/impl/PayMchServiceImpl.java @@ -21,7 +21,7 @@ @BaseService public class PayMchServiceImpl extends BaseServiceImpl implements PayMchService { - private static Logger _log = LoggerFactory.getLogger(PayMchServiceImpl.class); + private static final Logger log = LoggerFactory.getLogger(PayMchServiceImpl.class); @Autowired PayMchMapper payMchMapper; diff --git a/zheng-pay/zheng-pay-rpc-service/src/main/java/com/zheng/pay/rpc/service/impl/PayOutOrderDetailServiceImpl.java b/zheng-pay/zheng-pay-rpc-service/src/main/java/com/zheng/pay/rpc/service/impl/PayOutOrderDetailServiceImpl.java index 5592e6446..037154d0c 100644 --- a/zheng-pay/zheng-pay-rpc-service/src/main/java/com/zheng/pay/rpc/service/impl/PayOutOrderDetailServiceImpl.java +++ b/zheng-pay/zheng-pay-rpc-service/src/main/java/com/zheng/pay/rpc/service/impl/PayOutOrderDetailServiceImpl.java @@ -21,7 +21,7 @@ @BaseService public class PayOutOrderDetailServiceImpl extends BaseServiceImpl implements PayOutOrderDetailService { - private static Logger _log = LoggerFactory.getLogger(PayOutOrderDetailServiceImpl.class); + private static final Logger log = LoggerFactory.getLogger(PayOutOrderDetailServiceImpl.class); @Autowired PayOutOrderDetailMapper payOutOrderDetailMapper; diff --git a/zheng-pay/zheng-pay-rpc-service/src/main/java/com/zheng/pay/rpc/service/impl/PayOutOrderServiceImpl.java b/zheng-pay/zheng-pay-rpc-service/src/main/java/com/zheng/pay/rpc/service/impl/PayOutOrderServiceImpl.java index f63e4edb7..753963e37 100644 --- a/zheng-pay/zheng-pay-rpc-service/src/main/java/com/zheng/pay/rpc/service/impl/PayOutOrderServiceImpl.java +++ b/zheng-pay/zheng-pay-rpc-service/src/main/java/com/zheng/pay/rpc/service/impl/PayOutOrderServiceImpl.java @@ -21,7 +21,7 @@ @BaseService public class PayOutOrderServiceImpl extends BaseServiceImpl implements PayOutOrderService { - private static Logger _log = LoggerFactory.getLogger(PayOutOrderServiceImpl.class); + private static final Logger log = LoggerFactory.getLogger(PayOutOrderServiceImpl.class); @Autowired PayOutOrderMapper payOutOrderMapper; diff --git a/zheng-pay/zheng-pay-rpc-service/src/main/java/com/zheng/pay/rpc/service/impl/PayPayServiceImpl.java b/zheng-pay/zheng-pay-rpc-service/src/main/java/com/zheng/pay/rpc/service/impl/PayPayServiceImpl.java index fd26d470d..cb7af7fe8 100644 --- a/zheng-pay/zheng-pay-rpc-service/src/main/java/com/zheng/pay/rpc/service/impl/PayPayServiceImpl.java +++ b/zheng-pay/zheng-pay-rpc-service/src/main/java/com/zheng/pay/rpc/service/impl/PayPayServiceImpl.java @@ -21,7 +21,7 @@ @BaseService public class PayPayServiceImpl extends BaseServiceImpl implements PayPayService { - private static Logger _log = LoggerFactory.getLogger(PayPayServiceImpl.class); + private static final Logger log = LoggerFactory.getLogger(PayPayServiceImpl.class); @Autowired PayPayMapper payPayMapper; diff --git a/zheng-pay/zheng-pay-rpc-service/src/main/java/com/zheng/pay/rpc/service/impl/PayTypeServiceImpl.java b/zheng-pay/zheng-pay-rpc-service/src/main/java/com/zheng/pay/rpc/service/impl/PayTypeServiceImpl.java index 372a87d23..2ca2a4527 100644 --- a/zheng-pay/zheng-pay-rpc-service/src/main/java/com/zheng/pay/rpc/service/impl/PayTypeServiceImpl.java +++ b/zheng-pay/zheng-pay-rpc-service/src/main/java/com/zheng/pay/rpc/service/impl/PayTypeServiceImpl.java @@ -21,7 +21,7 @@ @BaseService public class PayTypeServiceImpl extends BaseServiceImpl implements PayTypeService { - private static Logger _log = LoggerFactory.getLogger(PayTypeServiceImpl.class); + private static final Logger log = LoggerFactory.getLogger(PayTypeServiceImpl.class); @Autowired PayTypeMapper payTypeMapper; diff --git a/zheng-pay/zheng-pay-rpc-service/src/main/java/com/zheng/pay/rpc/service/impl/PayVendorServiceImpl.java b/zheng-pay/zheng-pay-rpc-service/src/main/java/com/zheng/pay/rpc/service/impl/PayVendorServiceImpl.java index 3d8220514..f8019d0c2 100644 --- a/zheng-pay/zheng-pay-rpc-service/src/main/java/com/zheng/pay/rpc/service/impl/PayVendorServiceImpl.java +++ b/zheng-pay/zheng-pay-rpc-service/src/main/java/com/zheng/pay/rpc/service/impl/PayVendorServiceImpl.java @@ -21,7 +21,7 @@ @BaseService public class PayVendorServiceImpl extends BaseServiceImpl implements PayVendorService { - private static Logger _log = LoggerFactory.getLogger(PayVendorServiceImpl.class); + private static final Logger log = LoggerFactory.getLogger(PayVendorServiceImpl.class); @Autowired PayVendorMapper payVendorMapper; diff --git a/zheng-pay/zheng-pay-rpc-service/src/main/java/com/zheng/pay/rpc/service/impl/PayVestServiceImpl.java b/zheng-pay/zheng-pay-rpc-service/src/main/java/com/zheng/pay/rpc/service/impl/PayVestServiceImpl.java index 7452a7264..e557f577b 100644 --- a/zheng-pay/zheng-pay-rpc-service/src/main/java/com/zheng/pay/rpc/service/impl/PayVestServiceImpl.java +++ b/zheng-pay/zheng-pay-rpc-service/src/main/java/com/zheng/pay/rpc/service/impl/PayVestServiceImpl.java @@ -21,7 +21,7 @@ @BaseService public class PayVestServiceImpl extends BaseServiceImpl implements PayVestService { - private static Logger _log = LoggerFactory.getLogger(PayVestServiceImpl.class); + private static final Logger log = LoggerFactory.getLogger(PayVestServiceImpl.class); @Autowired PayVestMapper payVestMapper; diff --git a/zheng-ucenter/zheng-ucenter-common/src/main/java/com/zheng/ucenter/common/constant/UcenterResultConstant.java b/zheng-ucenter/zheng-ucenter-common/src/main/java/com/zheng/ucenter/common/constant/UcenterResultConstant.java index 3bb6e6f51..97f631622 100644 --- a/zheng-ucenter/zheng-ucenter-common/src/main/java/com/zheng/ucenter/common/constant/UcenterResultConstant.java +++ b/zheng-ucenter/zheng-ucenter-common/src/main/java/com/zheng/ucenter/common/constant/UcenterResultConstant.java @@ -6,7 +6,14 @@ */ public enum UcenterResultConstant { + /** + * 失败 + */ FAILED(0, "failed"), + + /** + * 成功 + */ SUCCESS(1, "success"); public int code; diff --git a/zheng-ucenter/zheng-ucenter-rpc-api/src/main/java/com/zheng/ucenter/rpc/api/UcenterApiServiceMock.java b/zheng-ucenter/zheng-ucenter-rpc-api/src/main/java/com/zheng/ucenter/rpc/api/UcenterApiServiceMock.java index 78760c6cf..db7032f60 100644 --- a/zheng-ucenter/zheng-ucenter-rpc-api/src/main/java/com/zheng/ucenter/rpc/api/UcenterApiServiceMock.java +++ b/zheng-ucenter/zheng-ucenter-rpc-api/src/main/java/com/zheng/ucenter/rpc/api/UcenterApiServiceMock.java @@ -9,6 +9,6 @@ */ public class UcenterApiServiceMock implements UcenterApiService { - private static Logger _log = LoggerFactory.getLogger(UcenterApiServiceMock.class); + private static final Logger LOGGER = LoggerFactory.getLogger(UcenterApiServiceMock.class); } diff --git a/zheng-ucenter/zheng-ucenter-rpc-service/src/main/java/com/zheng/ucenter/rpc/ZhengUcenterRpcServiceApplication.java b/zheng-ucenter/zheng-ucenter-rpc-service/src/main/java/com/zheng/ucenter/rpc/ZhengUcenterRpcServiceApplication.java index 5a99daf4f..33bc12495 100644 --- a/zheng-ucenter/zheng-ucenter-rpc-service/src/main/java/com/zheng/ucenter/rpc/ZhengUcenterRpcServiceApplication.java +++ b/zheng-ucenter/zheng-ucenter-rpc-service/src/main/java/com/zheng/ucenter/rpc/ZhengUcenterRpcServiceApplication.java @@ -10,12 +10,12 @@ */ public class ZhengUcenterRpcServiceApplication { - private static Logger _log = LoggerFactory.getLogger(ZhengUcenterRpcServiceApplication.class); + private static final Logger LOGGER = LoggerFactory.getLogger(ZhengUcenterRpcServiceApplication.class); public static void main(String[] args) { - _log.info(">>>>> zheng-ucenter-rpc-service 正在启动 <<<<<"); + LOGGER.info(">>>>> zheng-ucenter-rpc-service 正在启动 <<<<<"); new ClassPathXmlApplicationContext("classpath:META-INF/spring/*.xml"); - _log.info(">>>>> zheng-ucenter-rpc-service 启动完成 <<<<<"); + LOGGER.info(">>>>> zheng-ucenter-rpc-service 启动完成 <<<<<"); } } diff --git a/zheng-ucenter/zheng-ucenter-rpc-service/src/main/java/com/zheng/ucenter/rpc/service/impl/UcenterApiServiceImpl.java b/zheng-ucenter/zheng-ucenter-rpc-service/src/main/java/com/zheng/ucenter/rpc/service/impl/UcenterApiServiceImpl.java index 06b0b869c..fb0e0f485 100644 --- a/zheng-ucenter/zheng-ucenter-rpc-service/src/main/java/com/zheng/ucenter/rpc/service/impl/UcenterApiServiceImpl.java +++ b/zheng-ucenter/zheng-ucenter-rpc-service/src/main/java/com/zheng/ucenter/rpc/service/impl/UcenterApiServiceImpl.java @@ -14,6 +14,6 @@ @Transactional public class UcenterApiServiceImpl implements UcenterApiService { - private static Logger _log = LoggerFactory.getLogger(UcenterApiServiceImpl.class); + private static final Logger LOGGER = LoggerFactory.getLogger(UcenterApiServiceImpl.class); } \ No newline at end of file diff --git a/zheng-ucenter/zheng-ucenter-rpc-service/src/main/java/com/zheng/ucenter/rpc/service/impl/UcenterOauthServiceImpl.java b/zheng-ucenter/zheng-ucenter-rpc-service/src/main/java/com/zheng/ucenter/rpc/service/impl/UcenterOauthServiceImpl.java index fa33d3190..c3465741e 100644 --- a/zheng-ucenter/zheng-ucenter-rpc-service/src/main/java/com/zheng/ucenter/rpc/service/impl/UcenterOauthServiceImpl.java +++ b/zheng-ucenter/zheng-ucenter-rpc-service/src/main/java/com/zheng/ucenter/rpc/service/impl/UcenterOauthServiceImpl.java @@ -21,7 +21,7 @@ @BaseService public class UcenterOauthServiceImpl extends BaseServiceImpl implements UcenterOauthService { - private static Logger _log = LoggerFactory.getLogger(UcenterOauthServiceImpl.class); + private static final Logger LOGGER = LoggerFactory.getLogger(UcenterOauthServiceImpl.class); @Autowired UcenterOauthMapper ucenterOauthMapper; diff --git a/zheng-ucenter/zheng-ucenter-rpc-service/src/main/java/com/zheng/ucenter/rpc/service/impl/UcenterUserDetailsServiceImpl.java b/zheng-ucenter/zheng-ucenter-rpc-service/src/main/java/com/zheng/ucenter/rpc/service/impl/UcenterUserDetailsServiceImpl.java index 5caddc491..c199c0673 100644 --- a/zheng-ucenter/zheng-ucenter-rpc-service/src/main/java/com/zheng/ucenter/rpc/service/impl/UcenterUserDetailsServiceImpl.java +++ b/zheng-ucenter/zheng-ucenter-rpc-service/src/main/java/com/zheng/ucenter/rpc/service/impl/UcenterUserDetailsServiceImpl.java @@ -21,7 +21,7 @@ @BaseService public class UcenterUserDetailsServiceImpl extends BaseServiceImpl implements UcenterUserDetailsService { - private static Logger _log = LoggerFactory.getLogger(UcenterUserDetailsServiceImpl.class); + private static final Logger LOGGER = LoggerFactory.getLogger(UcenterUserDetailsServiceImpl.class); @Autowired UcenterUserDetailsMapper ucenterUserDetailsMapper; diff --git a/zheng-ucenter/zheng-ucenter-rpc-service/src/main/java/com/zheng/ucenter/rpc/service/impl/UcenterUserLogServiceImpl.java b/zheng-ucenter/zheng-ucenter-rpc-service/src/main/java/com/zheng/ucenter/rpc/service/impl/UcenterUserLogServiceImpl.java index eba1f8ac8..966bc9357 100644 --- a/zheng-ucenter/zheng-ucenter-rpc-service/src/main/java/com/zheng/ucenter/rpc/service/impl/UcenterUserLogServiceImpl.java +++ b/zheng-ucenter/zheng-ucenter-rpc-service/src/main/java/com/zheng/ucenter/rpc/service/impl/UcenterUserLogServiceImpl.java @@ -21,7 +21,7 @@ @BaseService public class UcenterUserLogServiceImpl extends BaseServiceImpl implements UcenterUserLogService { - private static Logger _log = LoggerFactory.getLogger(UcenterUserLogServiceImpl.class); + private static final Logger LOGGER = LoggerFactory.getLogger(UcenterUserLogServiceImpl.class); @Autowired UcenterUserLogMapper ucenterUserLogMapper; diff --git a/zheng-ucenter/zheng-ucenter-rpc-service/src/main/java/com/zheng/ucenter/rpc/service/impl/UcenterUserOauthServiceImpl.java b/zheng-ucenter/zheng-ucenter-rpc-service/src/main/java/com/zheng/ucenter/rpc/service/impl/UcenterUserOauthServiceImpl.java index c334ff803..416b18230 100644 --- a/zheng-ucenter/zheng-ucenter-rpc-service/src/main/java/com/zheng/ucenter/rpc/service/impl/UcenterUserOauthServiceImpl.java +++ b/zheng-ucenter/zheng-ucenter-rpc-service/src/main/java/com/zheng/ucenter/rpc/service/impl/UcenterUserOauthServiceImpl.java @@ -21,7 +21,7 @@ @BaseService public class UcenterUserOauthServiceImpl extends BaseServiceImpl implements UcenterUserOauthService { - private static Logger _log = LoggerFactory.getLogger(UcenterUserOauthServiceImpl.class); + private static final Logger LOGGER = LoggerFactory.getLogger(UcenterUserOauthServiceImpl.class); @Autowired UcenterUserOauthMapper ucenterUserOauthMapper; diff --git a/zheng-ucenter/zheng-ucenter-rpc-service/src/main/java/com/zheng/ucenter/rpc/service/impl/UcenterUserServiceImpl.java b/zheng-ucenter/zheng-ucenter-rpc-service/src/main/java/com/zheng/ucenter/rpc/service/impl/UcenterUserServiceImpl.java index 2151a1af4..3f44ab932 100644 --- a/zheng-ucenter/zheng-ucenter-rpc-service/src/main/java/com/zheng/ucenter/rpc/service/impl/UcenterUserServiceImpl.java +++ b/zheng-ucenter/zheng-ucenter-rpc-service/src/main/java/com/zheng/ucenter/rpc/service/impl/UcenterUserServiceImpl.java @@ -21,7 +21,7 @@ @BaseService public class UcenterUserServiceImpl extends BaseServiceImpl implements UcenterUserService { - private static Logger _log = LoggerFactory.getLogger(UcenterUserServiceImpl.class); + private static final Logger LOGGER = LoggerFactory.getLogger(UcenterUserServiceImpl.class); @Autowired UcenterUserMapper ucenterUserMapper; diff --git a/zheng-ucenter/zheng-ucenter-web/src/main/java/com/zheng/ucenter/web/controller/SignController.java b/zheng-ucenter/zheng-ucenter-web/src/main/java/com/zheng/ucenter/web/controller/SignController.java index 3d58242a1..a6716ee02 100644 --- a/zheng-ucenter/zheng-ucenter-web/src/main/java/com/zheng/ucenter/web/controller/SignController.java +++ b/zheng-ucenter/zheng-ucenter-web/src/main/java/com/zheng/ucenter/web/controller/SignController.java @@ -20,7 +20,7 @@ @Controller public class SignController extends BaseController { - private static Logger _log = LoggerFactory.getLogger(SignController.class); + private static final Logger LOGGER = LoggerFactory.getLogger(SignController.class); @RequestMapping(value = "/signup", method = RequestMethod.GET) public String signup(Model model) { @@ -56,7 +56,7 @@ public String index(Model model) { } @RequestMapping(value = "/password_reset", method = RequestMethod.GET) - public String password_reset(Model model) { + public String passwordReset(Model model) { return thymeleaf("/password"); } diff --git a/zheng-ucenter/zheng-ucenter-web/src/main/java/com/zheng/ucenter/web/interceptor/UcenterWebInterceptor.java b/zheng-ucenter/zheng-ucenter-web/src/main/java/com/zheng/ucenter/web/interceptor/UcenterWebInterceptor.java index 6f378a110..553cdcec0 100644 --- a/zheng-ucenter/zheng-ucenter-web/src/main/java/com/zheng/ucenter/web/interceptor/UcenterWebInterceptor.java +++ b/zheng-ucenter/zheng-ucenter-web/src/main/java/com/zheng/ucenter/web/interceptor/UcenterWebInterceptor.java @@ -15,7 +15,7 @@ */ public class UcenterWebInterceptor extends HandlerInterceptorAdapter { - private static Logger _log = LoggerFactory.getLogger(UcenterWebInterceptor.class); + private static final Logger LOGGER = LoggerFactory.getLogger(UcenterWebInterceptor.class); // @Autowired // private CmsMenuService cmsMenuService; @@ -23,7 +23,7 @@ public class UcenterWebInterceptor extends HandlerInterceptorAdapter { @Override public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { // 过滤ajax - if (null != request.getHeader("X-Requested-With") && request.getHeader("X-Requested-With").equalsIgnoreCase("XMLHttpRequest")) { + if (null != request.getHeader("X-Requested-With") && "XMLHttpRequest".equalsIgnoreCase(request.getHeader("X-Requested-With"))) { return true; } // zheng-ui静态资源配置信息 diff --git a/zheng-upms/zheng-upms-client/src/main/java/com/zheng/upms/client/interceptor/LogAspect.java b/zheng-upms/zheng-upms-client/src/main/java/com/zheng/upms/client/interceptor/LogAspect.java index bd9b2a142..73480ae78 100644 --- a/zheng-upms/zheng-upms-client/src/main/java/com/zheng/upms/client/interceptor/LogAspect.java +++ b/zheng-upms/zheng-upms-client/src/main/java/com/zheng/upms/client/interceptor/LogAspect.java @@ -32,7 +32,7 @@ @Aspect public class LogAspect { - private static Logger _log = LoggerFactory.getLogger(LogAspect.class); + private static final Logger LOGGER = LoggerFactory.getLogger(LogAspect.class); // 开始时间 private long startTime = 0L; @@ -44,13 +44,13 @@ public class LogAspect { @Before("execution(* *..controller..*.*(..))") public void doBeforeInServiceLayer(JoinPoint joinPoint) { - _log.debug("doBeforeInServiceLayer"); + LOGGER.debug("doBeforeInServiceLayer"); startTime = System.currentTimeMillis(); } @After("execution(* *..controller..*.*(..))") public void doAfterInServiceLayer(JoinPoint joinPoint) { - _log.debug("doAfterInServiceLayer"); + LOGGER.debug("doAfterInServiceLayer"); } @Around("execution(* *..controller..*.*(..))") @@ -78,12 +78,12 @@ public Object doAround(ProceedingJoinPoint pjp) throws Throwable { } } endTime = System.currentTimeMillis(); - _log.debug("doAround>>>result={},耗时:{}", result, endTime - startTime); + LOGGER.debug("doAround>>>result={},耗时:{}", result, endTime - startTime); upmsLog.setBasePath(RequestUtil.getBasePath(request)); upmsLog.setIp(RequestUtil.getIpAddr(request)); upmsLog.setMethod(request.getMethod()); - if (request.getMethod().equalsIgnoreCase("GET")) { + if ("GET".equalsIgnoreCase(request.getMethod())) { upmsLog.setParameter(request.getQueryString()); } else { upmsLog.setParameter(ObjectUtils.toString(request.getParameterMap())); diff --git a/zheng-upms/zheng-upms-client/src/main/java/com/zheng/upms/client/shiro/filter/UpmsAuthenticationFilter.java b/zheng-upms/zheng-upms-client/src/main/java/com/zheng/upms/client/shiro/filter/UpmsAuthenticationFilter.java index 85d90e8c6..8f0b5417c 100644 --- a/zheng-upms/zheng-upms-client/src/main/java/com/zheng/upms/client/shiro/filter/UpmsAuthenticationFilter.java +++ b/zheng-upms/zheng-upms-client/src/main/java/com/zheng/upms/client/shiro/filter/UpmsAuthenticationFilter.java @@ -42,7 +42,7 @@ */ public class UpmsAuthenticationFilter extends AuthenticationFilter { - private final static Logger _log = LoggerFactory.getLogger(UpmsAuthenticationFilter.class); + private static final Logger LOGGER = LoggerFactory.getLogger(UpmsAuthenticationFilter.class); // 局部会话key private final static String ZHENG_UPMS_CLIENT_SESSION_ID = "zheng-upms-client-session-id"; @@ -70,14 +70,14 @@ protected boolean isAccessAllowed(ServletRequest request, ServletResponse respon @Override protected boolean onAccessDenied(ServletRequest request, ServletResponse response) throws Exception { - StringBuffer sso_server_url = new StringBuffer(PropertiesFileUtil.getInstance("zheng-upms-client").get("zheng.upms.sso.server.url")); + StringBuffer ssoServerUrl = new StringBuffer(PropertiesFileUtil.getInstance("zheng-upms-client").get("zheng.upms.sso.server.url")); // server需要登录 String upmsType = PropertiesFileUtil.getInstance("zheng-upms-client").get("zheng.upms.type"); if ("server".equals(upmsType)) { - WebUtils.toHttp(response).sendRedirect(sso_server_url.append("/sso/login").toString()); + WebUtils.toHttp(response).sendRedirect(ssoServerUrl.append("/sso/login").toString()); return false; } - sso_server_url.append("/sso/index").append("?").append("appid").append("=").append(PropertiesFileUtil.getInstance("zheng-upms-client").get("zheng.upms.appID")); + ssoServerUrl.append("/sso/index").append("?").append("appid").append("=").append(PropertiesFileUtil.getInstance("zheng-upms-client").get("zheng.upms.appID")); // 回跳地址 HttpServletRequest httpServletRequest = WebUtils.toHttp(request); StringBuffer backurl = httpServletRequest.getRequestURL(); @@ -85,8 +85,8 @@ protected boolean onAccessDenied(ServletRequest request, ServletResponse respons if (StringUtils.isNotBlank(queryString)) { backurl.append("?").append(queryString); } - sso_server_url.append("&").append("backurl").append("=").append(URLEncoder.encode(backurl.toString(), "utf-8")); - WebUtils.toHttp(response).sendRedirect(sso_server_url.toString()); + ssoServerUrl.append("&").append("backurl").append("=").append(URLEncoder.encode(backurl.toString(), "utf-8")); + WebUtils.toHttp(response).sendRedirect(ssoServerUrl.toString()); return false; } @@ -114,7 +114,7 @@ private boolean validateClient(ServletRequest request, ServletResponse response) try { httpServletResponse.sendRedirect(backUrl.toString()); } catch (IOException e) { - _log.error("局部会话已登录,移除code参数跳转出错:", e); + LOGGER.error("局部会话已登录,移除code参数跳转出错:", e); } } else { return true; @@ -126,9 +126,9 @@ private boolean validateClient(ServletRequest request, ServletResponse response) if (StringUtils.isNotBlank(code)) { // HttpPost去校验code try { - StringBuffer sso_server_url = new StringBuffer(PropertiesFileUtil.getInstance("zheng-upms-client").get("zheng.upms.sso.server.url")); + StringBuffer ssoServerUrl = new StringBuffer(PropertiesFileUtil.getInstance("zheng-upms-client").get("zheng.upms.sso.server.url")); HttpClient httpclient = new DefaultHttpClient(); - HttpPost httpPost = new HttpPost(sso_server_url.toString() + "/sso/code"); + HttpPost httpPost = new HttpPost(ssoServerUrl.toString() + "/sso/code"); List nameValuePairs = new ArrayList<>(); nameValuePairs.add(new BasicNameValuePair("code", code)); @@ -143,7 +143,7 @@ private boolean validateClient(ServletRequest request, ServletResponse response) RedisUtil.set(ZHENG_UPMS_CLIENT_SESSION_ID + "_" + sessionId, code, timeOut); // 保存code对应的局部会话sessionId,方便退出操作 RedisUtil.sadd(ZHENG_UPMS_CLIENT_SESSION_IDS + "_" + code, sessionId, timeOut); - _log.debug("当前code={},对应的注册系统个数:{}个", code, RedisUtil.getJedis().scard(ZHENG_UPMS_CLIENT_SESSION_IDS + "_" + code)); + LOGGER.debug("当前code={},对应的注册系统个数:{}个", code, RedisUtil.getJedis().scard(ZHENG_UPMS_CLIENT_SESSION_IDS + "_" + code)); // 移除url中的token参数 String backUrl = RequestParameterUtil.getParameterWithOutCode(WebUtils.toHttp(request)); // 返回请求资源 @@ -155,14 +155,14 @@ private boolean validateClient(ServletRequest request, ServletResponse response) httpServletResponse.sendRedirect(backUrl.toString()); return true; } catch (IOException e) { - _log.error("已拿到code,移除code参数跳转出错:", e); + LOGGER.error("已拿到code,移除code参数跳转出错:", e); } } else { - _log.warn(result.getString("data")); + LOGGER.warn(result.getString("data")); } } } catch (IOException e) { - _log.error("验证token失败:", e); + LOGGER.error("验证token失败:", e); } } return false; diff --git a/zheng-upms/zheng-upms-client/src/main/java/com/zheng/upms/client/shiro/listener/UpmsSessionListener.java b/zheng-upms/zheng-upms-client/src/main/java/com/zheng/upms/client/shiro/listener/UpmsSessionListener.java index f1969b95e..f8c844057 100644 --- a/zheng-upms/zheng-upms-client/src/main/java/com/zheng/upms/client/shiro/listener/UpmsSessionListener.java +++ b/zheng-upms/zheng-upms-client/src/main/java/com/zheng/upms/client/shiro/listener/UpmsSessionListener.java @@ -10,21 +10,21 @@ */ public class UpmsSessionListener implements SessionListener { - private static Logger _log = LoggerFactory.getLogger(UpmsSessionListener.class); + private static final Logger LOGGER = LoggerFactory.getLogger(UpmsSessionListener.class); @Override public void onStart(Session session) { - _log.debug("会话创建:" + session.getId()); + LOGGER.debug("会话创建:" + session.getId()); } @Override public void onStop(Session session) { - _log.debug("会话停止:" + session.getId()); + LOGGER.debug("会话停止:" + session.getId()); } @Override public void onExpiration(Session session) { - _log.debug("会话过期:" + session.getId()); + LOGGER.debug("会话过期:" + session.getId()); } } diff --git a/zheng-upms/zheng-upms-client/src/main/java/com/zheng/upms/client/shiro/realm/UpmsRealm.java b/zheng-upms/zheng-upms-client/src/main/java/com/zheng/upms/client/shiro/realm/UpmsRealm.java index 7c2bd1622..225f37b20 100644 --- a/zheng-upms/zheng-upms-client/src/main/java/com/zheng/upms/client/shiro/realm/UpmsRealm.java +++ b/zheng-upms/zheng-upms-client/src/main/java/com/zheng/upms/client/shiro/realm/UpmsRealm.java @@ -26,7 +26,7 @@ */ public class UpmsRealm extends AuthorizingRealm { - private static Logger _log = LoggerFactory.getLogger(UpmsRealm.class); + private static final Logger LOGGER = LoggerFactory.getLogger(UpmsRealm.class); @Autowired private UpmsApiService upmsApiService; @@ -87,7 +87,7 @@ protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken authent if (null == upmsUser) { throw new UnknownAccountException(); } - if (!upmsUser.getPassword().equals(MD5Util.MD5(password + upmsUser.getSalt()))) { + if (!upmsUser.getPassword().equals(MD5Util.md5(password + upmsUser.getSalt()))) { throw new IncorrectCredentialsException(); } if (upmsUser.getLocked() == 1) { diff --git a/zheng-upms/zheng-upms-client/src/main/java/com/zheng/upms/client/shiro/session/UpmsSession.java b/zheng-upms/zheng-upms-client/src/main/java/com/zheng/upms/client/shiro/session/UpmsSession.java index 80afa9c38..aae73f104 100644 --- a/zheng-upms/zheng-upms-client/src/main/java/com/zheng/upms/client/shiro/session/UpmsSession.java +++ b/zheng-upms/zheng-upms-client/src/main/java/com/zheng/upms/client/shiro/session/UpmsSession.java @@ -9,7 +9,21 @@ public class UpmsSession extends SimpleSession { public static enum OnlineStatus { - on_line("在线"), off_line("离线"), force_logout("强制退出"); + /** + * 在线 + */ + on_line("在线"), + + /** + * 离线 + */ + off_line("离线"), + + /** + * 强制退出 + */ + force_logout("强制退出"); + private final String info; private OnlineStatus(String info) { diff --git a/zheng-upms/zheng-upms-client/src/main/java/com/zheng/upms/client/shiro/session/UpmsSessionDao.java b/zheng-upms/zheng-upms-client/src/main/java/com/zheng/upms/client/shiro/session/UpmsSessionDao.java index 55a3c7e70..8334f2b2e 100644 --- a/zheng-upms/zheng-upms-client/src/main/java/com/zheng/upms/client/shiro/session/UpmsSessionDao.java +++ b/zheng-upms/zheng-upms-client/src/main/java/com/zheng/upms/client/shiro/session/UpmsSessionDao.java @@ -20,7 +20,7 @@ */ public class UpmsSessionDao extends CachingSessionDAO { - private static Logger _log = LoggerFactory.getLogger(UpmsSessionDao.class); + private static final Logger LOGGER = LoggerFactory.getLogger(UpmsSessionDao.class); // 会话key private final static String ZHENG_UPMS_SHIRO_SESSION_ID = "zheng-upms-shiro-session-id"; // 全局会话key @@ -39,14 +39,14 @@ protected Serializable doCreate(Session session) { Serializable sessionId = generateSessionId(session); assignSessionId(session, sessionId); RedisUtil.set(ZHENG_UPMS_SHIRO_SESSION_ID + "_" + sessionId, SerializableUtil.serialize(session), (int) session.getTimeout() / 1000); - _log.debug("doCreate >>>>> sessionId={}", sessionId); + LOGGER.debug("doCreate >>>>> sessionId={}", sessionId); return sessionId; } @Override protected Session doReadSession(Serializable sessionId) { String session = RedisUtil.get(ZHENG_UPMS_SHIRO_SESSION_ID + "_" + sessionId); - _log.debug("doReadSession >>>>> sessionId={}", sessionId); + LOGGER.debug("doReadSession >>>>> sessionId={}", sessionId); return SerializableUtil.deserialize(session); } @@ -65,7 +65,7 @@ protected void doUpdate(Session session) { } RedisUtil.set(ZHENG_UPMS_SHIRO_SESSION_ID + "_" + session.getId(), SerializableUtil.serialize(session), (int) session.getTimeout() / 1000); // 更新ZHENG_UPMS_SERVER_SESSION_ID、ZHENG_UPMS_SERVER_CODE过期时间 TODO - _log.debug("doUpdate >>>>> sessionId={}", session.getId()); + LOGGER.debug("doUpdate >>>>> sessionId={}", session.getId()); } @Override @@ -94,14 +94,14 @@ protected void doDelete(Session session) { jedis.del(ZHENG_UPMS_CLIENT_SESSION_ID + "_" + clientSessionId); jedis.srem(ZHENG_UPMS_CLIENT_SESSION_IDS + "_" + code, clientSessionId); } - _log.debug("当前code={},对应的注册系统个数:{}个", code, jedis.scard(ZHENG_UPMS_CLIENT_SESSION_IDS + "_" + code)); + LOGGER.debug("当前code={},对应的注册系统个数:{}个", code, jedis.scard(ZHENG_UPMS_CLIENT_SESSION_IDS + "_" + code)); jedis.close(); // 维护会话id列表,提供会话分页管理 RedisUtil.lrem(ZHENG_UPMS_SERVER_SESSION_IDS, 1, sessionId); } // 删除session RedisUtil.remove(ZHENG_UPMS_SHIRO_SESSION_ID + "_" + sessionId); - _log.debug("doUpdate >>>>> sessionId={}", sessionId); + LOGGER.debug("doUpdate >>>>> sessionId={}", sessionId); } /** diff --git a/zheng-upms/zheng-upms-client/src/main/java/com/zheng/upms/client/util/RequestParameterUtil.java b/zheng-upms/zheng-upms-client/src/main/java/com/zheng/upms/client/util/RequestParameterUtil.java index c27914e3d..2da61207b 100644 --- a/zheng-upms/zheng-upms-client/src/main/java/com/zheng/upms/client/util/RequestParameterUtil.java +++ b/zheng-upms/zheng-upms-client/src/main/java/com/zheng/upms/client/util/RequestParameterUtil.java @@ -21,8 +21,8 @@ public static String getParameterWithOutCode(HttpServletRequest request) { String params = ""; Map parameterMap = request.getParameterMap(); for (Map.Entry entry : parameterMap.entrySet()) { - if (!entry.getKey().equals("upms_code") && !entry.getKey().equals("upms_username")) { - if (params.equals("")) { + if (!"upms_code".equals(entry.getKey()) && !"upms_username".equals(entry.getKey())) { + if ("".equals(params)) { params = entry.getKey() + "=" + entry.getValue()[0]; } else { params += "&" + entry.getKey() + "=" + entry.getValue()[0]; diff --git a/zheng-upms/zheng-upms-common/src/main/java/com/zheng/upms/common/constant/UpmsResultConstant.java b/zheng-upms/zheng-upms-common/src/main/java/com/zheng/upms/common/constant/UpmsResultConstant.java index bd08f9fdb..95e241149 100644 --- a/zheng-upms/zheng-upms-common/src/main/java/com/zheng/upms/common/constant/UpmsResultConstant.java +++ b/zheng-upms/zheng-upms-common/src/main/java/com/zheng/upms/common/constant/UpmsResultConstant.java @@ -6,15 +6,44 @@ */ public enum UpmsResultConstant { + /** + * 失败 + */ FAILED(0, "failed"), + + /** + * 成功 + */ SUCCESS(1, "success"), + /** + * 无效长度 + */ INVALID_LENGTH(10001, "Invalid length"), + /** + * 用户名不能为空 + */ EMPTY_USERNAME(10101, "Username cannot be empty"), + + /** + * 密码不能为空 + */ EMPTY_PASSWORD(10102, "Password cannot be empty"), + + /** + * 帐号不存在 + */ INVALID_USERNAME(10103, "Account does not exist"), + + /** + * 密码错误 + */ INVALID_PASSWORD(10104, "Password error"), + + /** + * 无效帐号 + */ INVALID_ACCOUNT(10105, "Invalid account"); public int code; diff --git a/zheng-upms/zheng-upms-rpc-api/src/main/java/com/zheng/upms/rpc/api/UpmsApiServiceMock.java b/zheng-upms/zheng-upms-rpc-api/src/main/java/com/zheng/upms/rpc/api/UpmsApiServiceMock.java index 820ae91cd..0c4f7a6b4 100644 --- a/zheng-upms/zheng-upms-rpc-api/src/main/java/com/zheng/upms/rpc/api/UpmsApiServiceMock.java +++ b/zheng-upms/zheng-upms-rpc-api/src/main/java/com/zheng/upms/rpc/api/UpmsApiServiceMock.java @@ -12,65 +12,65 @@ */ public class UpmsApiServiceMock implements UpmsApiService { - private static Logger _log = LoggerFactory.getLogger(UpmsApiServiceMock.class); + private static final Logger LOGGER = LoggerFactory.getLogger(UpmsApiServiceMock.class); @Override public List selectUpmsPermissionByUpmsUserId(Integer upmsUserId) { - _log.info("UpmsApiServiceMock => selectUpmsPermissionByUpmsUserId"); + LOGGER.info("UpmsApiServiceMock => selectUpmsPermissionByUpmsUserId"); return null; } @Override public List selectUpmsPermissionByUpmsUserIdByCache(Integer upmsUserId) { - _log.info("UpmsApiServiceMock => selectUpmsPermissionByUpmsUserIdByCache"); + LOGGER.info("UpmsApiServiceMock => selectUpmsPermissionByUpmsUserIdByCache"); return null; } @Override public List selectUpmsRoleByUpmsUserId(Integer upmsUserId) { - _log.info("UpmsApiServiceMock => selectUpmsRoleByUpmsUserId"); + LOGGER.info("UpmsApiServiceMock => selectUpmsRoleByUpmsUserId"); return null; } @Override public List selectUpmsRoleByUpmsUserIdByCache(Integer upmsUserId) { - _log.info("UpmsApiServiceMock => selectUpmsRoleByUpmsUserIdByCache"); + LOGGER.info("UpmsApiServiceMock => selectUpmsRoleByUpmsUserIdByCache"); return null; } @Override public List selectUpmsRolePermisstionByUpmsRoleId(Integer upmsRoleId) { - _log.info("UpmsApiServiceMock => selectUpmsRolePermisstionByUpmsRoleId"); + LOGGER.info("UpmsApiServiceMock => selectUpmsRolePermisstionByUpmsRoleId"); return null; } @Override public List selectUpmsUserPermissionByUpmsUserId(Integer upmsUserId) { - _log.info("UpmsApiServiceMock => selectUpmsUserPermissionByUpmsUserId"); + LOGGER.info("UpmsApiServiceMock => selectUpmsUserPermissionByUpmsUserId"); return null; } @Override public List selectUpmsSystemByExample(UpmsSystemExample upmsSystemExample) { - _log.info("UpmsApiServiceMock => selectUpmsSystemByExample"); + LOGGER.info("UpmsApiServiceMock => selectUpmsSystemByExample"); return null; } @Override public List selectUpmsOrganizationByExample(UpmsOrganizationExample upmsOrganizationExample) { - _log.info("UpmsApiServiceMock => selectUpmsOrganizationByExample"); + LOGGER.info("UpmsApiServiceMock => selectUpmsOrganizationByExample"); return null; } @Override public UpmsUser selectUpmsUserByUsername(String username) { - _log.info("UpmsApiServiceMock => selectUpmsUserByUsername"); + LOGGER.info("UpmsApiServiceMock => selectUpmsUserByUsername"); return null; } @Override public int insertUpmsLogSelective(UpmsLog record) { - _log.info("UpmsApiServiceMock => insertSelective"); + LOGGER.info("UpmsApiServiceMock => insertSelective"); return 0; } diff --git a/zheng-upms/zheng-upms-rpc-api/src/main/java/com/zheng/upms/rpc/api/UpmsPermissionServiceMock.java b/zheng-upms/zheng-upms-rpc-api/src/main/java/com/zheng/upms/rpc/api/UpmsPermissionServiceMock.java index fe888caf5..74fc4d234 100644 --- a/zheng-upms/zheng-upms-rpc-api/src/main/java/com/zheng/upms/rpc/api/UpmsPermissionServiceMock.java +++ b/zheng-upms/zheng-upms-rpc-api/src/main/java/com/zheng/upms/rpc/api/UpmsPermissionServiceMock.java @@ -14,17 +14,17 @@ */ public class UpmsPermissionServiceMock extends BaseServiceMock implements UpmsPermissionService { - private static Logger _log = LoggerFactory.getLogger(UpmsPermissionServiceMock.class); + private static final Logger LOGGER = LoggerFactory.getLogger(UpmsPermissionServiceMock.class); @Override public JSONArray getTreeByRoleId(Integer roleId) { - _log.info("UpmsPermissionServiceMock => getTreeByRoleId"); + LOGGER.info("UpmsPermissionServiceMock => getTreeByRoleId"); return null; } @Override public JSONArray getTreeByUserId(Integer usereId, Byte type) { - _log.info("UpmsPermissionServiceMock => getTreeByUserId"); + LOGGER.info("UpmsPermissionServiceMock => getTreeByUserId"); return null; } diff --git a/zheng-upms/zheng-upms-rpc-api/src/main/java/com/zheng/upms/rpc/api/UpmsRolePermissionServiceMock.java b/zheng-upms/zheng-upms-rpc-api/src/main/java/com/zheng/upms/rpc/api/UpmsRolePermissionServiceMock.java index 1892ab882..b0378bab0 100644 --- a/zheng-upms/zheng-upms-rpc-api/src/main/java/com/zheng/upms/rpc/api/UpmsRolePermissionServiceMock.java +++ b/zheng-upms/zheng-upms-rpc-api/src/main/java/com/zheng/upms/rpc/api/UpmsRolePermissionServiceMock.java @@ -14,11 +14,11 @@ */ public class UpmsRolePermissionServiceMock extends BaseServiceMock implements UpmsRolePermissionService { - private static Logger _log = LoggerFactory.getLogger(UpmsRolePermissionServiceMock.class); + private static final Logger LOGGER = LoggerFactory.getLogger(UpmsRolePermissionServiceMock.class); @Override public int rolePermission(JSONArray datas, int id) { - _log.info("UpmsRolePermissionServiceMock => rolePermission"); + LOGGER.info("UpmsRolePermissionServiceMock => rolePermission"); return 0; } diff --git a/zheng-upms/zheng-upms-rpc-api/src/main/java/com/zheng/upms/rpc/api/UpmsUserOrganizationServiceMock.java b/zheng-upms/zheng-upms-rpc-api/src/main/java/com/zheng/upms/rpc/api/UpmsUserOrganizationServiceMock.java index 57ce6585c..7a2b68b0d 100644 --- a/zheng-upms/zheng-upms-rpc-api/src/main/java/com/zheng/upms/rpc/api/UpmsUserOrganizationServiceMock.java +++ b/zheng-upms/zheng-upms-rpc-api/src/main/java/com/zheng/upms/rpc/api/UpmsUserOrganizationServiceMock.java @@ -13,11 +13,11 @@ */ public class UpmsUserOrganizationServiceMock extends BaseServiceMock implements UpmsUserOrganizationService { - private static Logger _log = LoggerFactory.getLogger(UpmsUserOrganizationServiceMock.class); + private static final Logger LOGGER = LoggerFactory.getLogger(UpmsUserOrganizationServiceMock.class); @Override public int organization(String[] organizationIds, int id) { - _log.info("UpmsUserOrganizationServiceMock => organization"); + LOGGER.info("UpmsUserOrganizationServiceMock => organization"); return 0; } diff --git a/zheng-upms/zheng-upms-rpc-api/src/main/java/com/zheng/upms/rpc/api/UpmsUserPermissionServiceMock.java b/zheng-upms/zheng-upms-rpc-api/src/main/java/com/zheng/upms/rpc/api/UpmsUserPermissionServiceMock.java index 0e0a66ec4..f6a644b47 100644 --- a/zheng-upms/zheng-upms-rpc-api/src/main/java/com/zheng/upms/rpc/api/UpmsUserPermissionServiceMock.java +++ b/zheng-upms/zheng-upms-rpc-api/src/main/java/com/zheng/upms/rpc/api/UpmsUserPermissionServiceMock.java @@ -14,11 +14,11 @@ */ public class UpmsUserPermissionServiceMock extends BaseServiceMock implements UpmsUserPermissionService { - private static Logger _log = LoggerFactory.getLogger(UpmsUserPermissionServiceMock.class); + private static final Logger LOGGER = LoggerFactory.getLogger(UpmsUserPermissionServiceMock.class); @Override public int permission(JSONArray datas, int id) { - _log.info("UpmsUserPermissionServiceMock => permission"); + LOGGER.info("UpmsUserPermissionServiceMock => permission"); return 0; } diff --git a/zheng-upms/zheng-upms-rpc-api/src/main/java/com/zheng/upms/rpc/api/UpmsUserRoleServiceMock.java b/zheng-upms/zheng-upms-rpc-api/src/main/java/com/zheng/upms/rpc/api/UpmsUserRoleServiceMock.java index 303b62947..b155e1b97 100644 --- a/zheng-upms/zheng-upms-rpc-api/src/main/java/com/zheng/upms/rpc/api/UpmsUserRoleServiceMock.java +++ b/zheng-upms/zheng-upms-rpc-api/src/main/java/com/zheng/upms/rpc/api/UpmsUserRoleServiceMock.java @@ -13,11 +13,11 @@ */ public class UpmsUserRoleServiceMock extends BaseServiceMock implements UpmsUserRoleService { - private static Logger _log = LoggerFactory.getLogger(UpmsUserRoleServiceMock.class); + private static final Logger LOGGER = LoggerFactory.getLogger(UpmsUserRoleServiceMock.class); @Override public int role(String[] roleIds, int id) { - _log.info("UpmsUserRoleServiceMock => role"); + LOGGER.info("UpmsUserRoleServiceMock => role"); return 0; } diff --git a/zheng-upms/zheng-upms-rpc-service/src/main/java/com/zheng/upms/rpc/ZhengUpmsRpcServiceApplication.java b/zheng-upms/zheng-upms-rpc-service/src/main/java/com/zheng/upms/rpc/ZhengUpmsRpcServiceApplication.java index 8da4bf65f..ce4c46ce0 100644 --- a/zheng-upms/zheng-upms-rpc-service/src/main/java/com/zheng/upms/rpc/ZhengUpmsRpcServiceApplication.java +++ b/zheng-upms/zheng-upms-rpc-service/src/main/java/com/zheng/upms/rpc/ZhengUpmsRpcServiceApplication.java @@ -10,12 +10,12 @@ */ public class ZhengUpmsRpcServiceApplication { - private static Logger _log = LoggerFactory.getLogger(ZhengUpmsRpcServiceApplication.class); + private static final Logger LOGGER = LoggerFactory.getLogger(ZhengUpmsRpcServiceApplication.class); public static void main(String[] args) { - _log.info(">>>>> zheng-upms-rpc-service 正在启动 <<<<<"); + LOGGER.info(">>>>> zheng-upms-rpc-service 正在启动 <<<<<"); new ClassPathXmlApplicationContext("classpath:META-INF/spring/*.xml"); - _log.info(">>>>> zheng-upms-rpc-service 启动完成 <<<<<"); + LOGGER.info(">>>>> zheng-upms-rpc-service 启动完成 <<<<<"); } } diff --git a/zheng-upms/zheng-upms-rpc-service/src/main/java/com/zheng/upms/rpc/service/impl/UpmsApiServiceImpl.java b/zheng-upms/zheng-upms-rpc-service/src/main/java/com/zheng/upms/rpc/service/impl/UpmsApiServiceImpl.java index 9648ff07e..30e3c4fad 100644 --- a/zheng-upms/zheng-upms-rpc-service/src/main/java/com/zheng/upms/rpc/service/impl/UpmsApiServiceImpl.java +++ b/zheng-upms/zheng-upms-rpc-service/src/main/java/com/zheng/upms/rpc/service/impl/UpmsApiServiceImpl.java @@ -21,7 +21,7 @@ @Transactional public class UpmsApiServiceImpl implements UpmsApiService { - private static Logger _log = LoggerFactory.getLogger(UpmsApiServiceImpl.class); + private static final Logger LOGGER = LoggerFactory.getLogger(UpmsApiServiceImpl.class); @Autowired UpmsUserMapper upmsUserMapper; @@ -54,7 +54,7 @@ public List selectUpmsPermissionByUpmsUserId(Integer upmsUserId) // 用户不存在或锁定状态 UpmsUser upmsUser = upmsUserMapper.selectByPrimaryKey(upmsUserId); if (null == upmsUser || 1 == upmsUser.getLocked()) { - _log.info("selectUpmsPermissionByUpmsUserId : upmsUserId={}", upmsUserId); + LOGGER.info("selectUpmsPermissionByUpmsUserId : upmsUserId={}", upmsUserId); return null; } List upmsPermissions = upmsApiMapper.selectUpmsPermissionByUpmsUserId(upmsUserId); @@ -82,7 +82,7 @@ public List selectUpmsRoleByUpmsUserId(Integer upmsUserId) { // 用户不存在或锁定状态 UpmsUser upmsUser = upmsUserMapper.selectByPrimaryKey(upmsUserId); if (null == upmsUser || 1 == upmsUser.getLocked()) { - _log.info("selectUpmsRoleByUpmsUserId : upmsUserId={}", upmsUserId); + LOGGER.info("selectUpmsRoleByUpmsUserId : upmsUserId={}", upmsUserId); return null; } List upmsRoles = upmsApiMapper.selectUpmsRoleByUpmsUserId(upmsUserId); diff --git a/zheng-upms/zheng-upms-rpc-service/src/main/java/com/zheng/upms/rpc/service/impl/UpmsLogServiceImpl.java b/zheng-upms/zheng-upms-rpc-service/src/main/java/com/zheng/upms/rpc/service/impl/UpmsLogServiceImpl.java index 5f6db8109..244d26bf0 100644 --- a/zheng-upms/zheng-upms-rpc-service/src/main/java/com/zheng/upms/rpc/service/impl/UpmsLogServiceImpl.java +++ b/zheng-upms/zheng-upms-rpc-service/src/main/java/com/zheng/upms/rpc/service/impl/UpmsLogServiceImpl.java @@ -21,7 +21,7 @@ @BaseService public class UpmsLogServiceImpl extends BaseServiceImpl implements UpmsLogService { - private static Logger _log = LoggerFactory.getLogger(UpmsLogServiceImpl.class); + private static final Logger LOGGER = LoggerFactory.getLogger(UpmsLogServiceImpl.class); @Autowired UpmsLogMapper upmsLogMapper; diff --git a/zheng-upms/zheng-upms-rpc-service/src/main/java/com/zheng/upms/rpc/service/impl/UpmsOrganizationServiceImpl.java b/zheng-upms/zheng-upms-rpc-service/src/main/java/com/zheng/upms/rpc/service/impl/UpmsOrganizationServiceImpl.java index 0c331ba0b..5da12dbe2 100644 --- a/zheng-upms/zheng-upms-rpc-service/src/main/java/com/zheng/upms/rpc/service/impl/UpmsOrganizationServiceImpl.java +++ b/zheng-upms/zheng-upms-rpc-service/src/main/java/com/zheng/upms/rpc/service/impl/UpmsOrganizationServiceImpl.java @@ -21,7 +21,7 @@ @BaseService public class UpmsOrganizationServiceImpl extends BaseServiceImpl implements UpmsOrganizationService { - private static Logger _log = LoggerFactory.getLogger(UpmsOrganizationServiceImpl.class); + private static final Logger LOGGER = LoggerFactory.getLogger(UpmsOrganizationServiceImpl.class); @Autowired UpmsOrganizationMapper upmsOrganizationMapper; diff --git a/zheng-upms/zheng-upms-rpc-service/src/main/java/com/zheng/upms/rpc/service/impl/UpmsPermissionServiceImpl.java b/zheng-upms/zheng-upms-rpc-service/src/main/java/com/zheng/upms/rpc/service/impl/UpmsPermissionServiceImpl.java index 4e6b3ab2e..a5a6aef68 100644 --- a/zheng-upms/zheng-upms-rpc-service/src/main/java/com/zheng/upms/rpc/service/impl/UpmsPermissionServiceImpl.java +++ b/zheng-upms/zheng-upms-rpc-service/src/main/java/com/zheng/upms/rpc/service/impl/UpmsPermissionServiceImpl.java @@ -27,7 +27,7 @@ @BaseService public class UpmsPermissionServiceImpl extends BaseServiceImpl implements UpmsPermissionService { - private static Logger _log = LoggerFactory.getLogger(UpmsPermissionServiceImpl.class); + private static final Logger LOGGER = LoggerFactory.getLogger(UpmsPermissionServiceImpl.class); @Autowired UpmsSystemMapper upmsSystemMapper; @@ -70,11 +70,15 @@ public JSONArray getTreeByRoleId(Integer roleId) { .andSystemIdEqualTo(((JSONObject) system).getIntValue("id")); upmsPermissionExample.setOrderByClause("orders asc"); List upmsPermissions = upmsPermissionMapper.selectByExample(upmsPermissionExample); - if (upmsPermissions.size() == 0) continue; + if (upmsPermissions.size() == 0) { + continue; + } // 目录 JSONArray folders = new JSONArray(); for (UpmsPermission upmsPermission: upmsPermissions) { - if (upmsPermission.getPid().intValue() != 0 || upmsPermission.getType() != 1) continue; + if (upmsPermission.getPid().intValue() != 0 || upmsPermission.getType() != 1) { + continue; + } JSONObject node = new JSONObject(); node.put("id", upmsPermission.getPermissionId()); node.put("name", upmsPermission.getName()); @@ -89,7 +93,9 @@ public JSONArray getTreeByRoleId(Integer roleId) { JSONArray menus = new JSONArray(); for (Object folder : folders) { for (UpmsPermission upmsPermission2: upmsPermissions) { - if (upmsPermission2.getPid().intValue() != ((JSONObject) folder).getIntValue("id") || upmsPermission2.getType() != 2) continue; + if (upmsPermission2.getPid().intValue() != ((JSONObject) folder).getIntValue("id") || upmsPermission2.getType() != 2) { + continue; + } JSONObject node2 = new JSONObject(); node2.put("id", upmsPermission2.getPermissionId()); node2.put("name", upmsPermission2.getName()); @@ -104,7 +110,9 @@ public JSONArray getTreeByRoleId(Integer roleId) { JSONArray buttons = new JSONArray(); for (Object menu : menus) { for (UpmsPermission upmsPermission3: upmsPermissions) { - if (upmsPermission3.getPid().intValue() != ((JSONObject) menu).getIntValue("id") || upmsPermission3.getType() != 3) continue; + if (upmsPermission3.getPid().intValue() != ((JSONObject) menu).getIntValue("id") || upmsPermission3.getType() != 3) { + continue; + } JSONObject node3 = new JSONObject(); node3.put("id", upmsPermission3.getPermissionId()); node3.put("name", upmsPermission3.getName()); @@ -169,11 +177,15 @@ public JSONArray getTreeByUserId(Integer usereId, Byte type) { .andSystemIdEqualTo(((JSONObject) system).getIntValue("id")); upmsPermissionExample.setOrderByClause("orders asc"); List upmsPermissions = upmsPermissionMapper.selectByExample(upmsPermissionExample); - if (upmsPermissions.size() == 0) continue; + if (upmsPermissions.size() == 0) { + continue; + } // 目录 JSONArray folders = new JSONArray(); for (UpmsPermission upmsPermission: upmsPermissions) { - if (upmsPermission.getPid().intValue() != 0 || upmsPermission.getType() != 1) continue; + if (upmsPermission.getPid().intValue() != 0 || upmsPermission.getType() != 1) { + continue; + } JSONObject node = new JSONObject(); node.put("id", upmsPermission.getPermissionId()); node.put("name", upmsPermission.getName()); @@ -188,7 +200,9 @@ public JSONArray getTreeByUserId(Integer usereId, Byte type) { JSONArray menus = new JSONArray(); for (Object folder : folders) { for (UpmsPermission upmsPermission2: upmsPermissions) { - if (upmsPermission2.getPid().intValue() != ((JSONObject) folder).getIntValue("id") || upmsPermission2.getType() != 2) continue; + if (upmsPermission2.getPid().intValue() != ((JSONObject) folder).getIntValue("id") || upmsPermission2.getType() != 2) { + continue; + } JSONObject node2 = new JSONObject(); node2.put("id", upmsPermission2.getPermissionId()); node2.put("name", upmsPermission2.getName()); @@ -203,7 +217,9 @@ public JSONArray getTreeByUserId(Integer usereId, Byte type) { JSONArray buttons = new JSONArray(); for (Object menu : menus) { for (UpmsPermission upmsPermission3: upmsPermissions) { - if (upmsPermission3.getPid().intValue() != ((JSONObject) menu).getIntValue("id") || upmsPermission3.getType() != 3) continue; + if (upmsPermission3.getPid().intValue() != ((JSONObject) menu).getIntValue("id") || upmsPermission3.getType() != 3) { + continue; + } JSONObject node3 = new JSONObject(); node3.put("id", upmsPermission3.getPermissionId()); node3.put("name", upmsPermission3.getName()); diff --git a/zheng-upms/zheng-upms-rpc-service/src/main/java/com/zheng/upms/rpc/service/impl/UpmsRolePermissionServiceImpl.java b/zheng-upms/zheng-upms-rpc-service/src/main/java/com/zheng/upms/rpc/service/impl/UpmsRolePermissionServiceImpl.java index 3fec7e673..6a294ee39 100644 --- a/zheng-upms/zheng-upms-rpc-service/src/main/java/com/zheng/upms/rpc/service/impl/UpmsRolePermissionServiceImpl.java +++ b/zheng-upms/zheng-upms-rpc-service/src/main/java/com/zheng/upms/rpc/service/impl/UpmsRolePermissionServiceImpl.java @@ -26,7 +26,7 @@ @BaseService public class UpmsRolePermissionServiceImpl extends BaseServiceImpl implements UpmsRolePermissionService { - private static Logger _log = LoggerFactory.getLogger(UpmsRolePermissionServiceImpl.class); + private static final Logger LOGGER = LoggerFactory.getLogger(UpmsRolePermissionServiceImpl.class); @Autowired UpmsRolePermissionMapper upmsRolePermissionMapper; diff --git a/zheng-upms/zheng-upms-rpc-service/src/main/java/com/zheng/upms/rpc/service/impl/UpmsRoleServiceImpl.java b/zheng-upms/zheng-upms-rpc-service/src/main/java/com/zheng/upms/rpc/service/impl/UpmsRoleServiceImpl.java index c5cf7faed..de7f21922 100644 --- a/zheng-upms/zheng-upms-rpc-service/src/main/java/com/zheng/upms/rpc/service/impl/UpmsRoleServiceImpl.java +++ b/zheng-upms/zheng-upms-rpc-service/src/main/java/com/zheng/upms/rpc/service/impl/UpmsRoleServiceImpl.java @@ -21,7 +21,7 @@ @BaseService public class UpmsRoleServiceImpl extends BaseServiceImpl implements UpmsRoleService { - private static Logger _log = LoggerFactory.getLogger(UpmsRoleServiceImpl.class); + private static final Logger LOGGER = LoggerFactory.getLogger(UpmsRoleServiceImpl.class); @Autowired UpmsRoleMapper upmsRoleMapper; diff --git a/zheng-upms/zheng-upms-rpc-service/src/main/java/com/zheng/upms/rpc/service/impl/UpmsSystemServiceImpl.java b/zheng-upms/zheng-upms-rpc-service/src/main/java/com/zheng/upms/rpc/service/impl/UpmsSystemServiceImpl.java index 8398a0f22..66d353b2e 100644 --- a/zheng-upms/zheng-upms-rpc-service/src/main/java/com/zheng/upms/rpc/service/impl/UpmsSystemServiceImpl.java +++ b/zheng-upms/zheng-upms-rpc-service/src/main/java/com/zheng/upms/rpc/service/impl/UpmsSystemServiceImpl.java @@ -23,7 +23,7 @@ @BaseService public class UpmsSystemServiceImpl extends BaseServiceImpl implements UpmsSystemService { - private static Logger _log = LoggerFactory.getLogger(UpmsSystemServiceImpl.class); + private static final Logger LOGGER = LoggerFactory.getLogger(UpmsSystemServiceImpl.class); @Autowired UpmsSystemMapper upmsSystemMapper; diff --git a/zheng-upms/zheng-upms-rpc-service/src/main/java/com/zheng/upms/rpc/service/impl/UpmsUserOrganizationServiceImpl.java b/zheng-upms/zheng-upms-rpc-service/src/main/java/com/zheng/upms/rpc/service/impl/UpmsUserOrganizationServiceImpl.java index d9979b6d1..9d7ae6ef8 100644 --- a/zheng-upms/zheng-upms-rpc-service/src/main/java/com/zheng/upms/rpc/service/impl/UpmsUserOrganizationServiceImpl.java +++ b/zheng-upms/zheng-upms-rpc-service/src/main/java/com/zheng/upms/rpc/service/impl/UpmsUserOrganizationServiceImpl.java @@ -23,7 +23,7 @@ @BaseService public class UpmsUserOrganizationServiceImpl extends BaseServiceImpl implements UpmsUserOrganizationService { - private static Logger _log = LoggerFactory.getLogger(UpmsUserOrganizationServiceImpl.class); + private static final Logger LOGGER = LoggerFactory.getLogger(UpmsUserOrganizationServiceImpl.class); @Autowired UpmsUserOrganizationMapper upmsUserOrganizationMapper; diff --git a/zheng-upms/zheng-upms-rpc-service/src/main/java/com/zheng/upms/rpc/service/impl/UpmsUserPermissionServiceImpl.java b/zheng-upms/zheng-upms-rpc-service/src/main/java/com/zheng/upms/rpc/service/impl/UpmsUserPermissionServiceImpl.java index b7f9efcba..85d9e370e 100644 --- a/zheng-upms/zheng-upms-rpc-service/src/main/java/com/zheng/upms/rpc/service/impl/UpmsUserPermissionServiceImpl.java +++ b/zheng-upms/zheng-upms-rpc-service/src/main/java/com/zheng/upms/rpc/service/impl/UpmsUserPermissionServiceImpl.java @@ -23,7 +23,7 @@ @BaseService public class UpmsUserPermissionServiceImpl extends BaseServiceImpl implements UpmsUserPermissionService { - private static Logger _log = LoggerFactory.getLogger(UpmsUserPermissionServiceImpl.class); + private static final Logger LOGGER = LoggerFactory.getLogger(UpmsUserPermissionServiceImpl.class); @Autowired UpmsUserPermissionMapper upmsUserPermissionMapper; diff --git a/zheng-upms/zheng-upms-rpc-service/src/main/java/com/zheng/upms/rpc/service/impl/UpmsUserRoleServiceImpl.java b/zheng-upms/zheng-upms-rpc-service/src/main/java/com/zheng/upms/rpc/service/impl/UpmsUserRoleServiceImpl.java index 5641d6ee3..9d043460c 100644 --- a/zheng-upms/zheng-upms-rpc-service/src/main/java/com/zheng/upms/rpc/service/impl/UpmsUserRoleServiceImpl.java +++ b/zheng-upms/zheng-upms-rpc-service/src/main/java/com/zheng/upms/rpc/service/impl/UpmsUserRoleServiceImpl.java @@ -23,7 +23,7 @@ @BaseService public class UpmsUserRoleServiceImpl extends BaseServiceImpl implements UpmsUserRoleService { - private static Logger _log = LoggerFactory.getLogger(UpmsUserRoleServiceImpl.class); + private static final Logger LOGGER = LoggerFactory.getLogger(UpmsUserRoleServiceImpl.class); @Autowired UpmsUserRoleMapper upmsUserRoleMapper; diff --git a/zheng-upms/zheng-upms-rpc-service/src/main/java/com/zheng/upms/rpc/service/impl/UpmsUserServiceImpl.java b/zheng-upms/zheng-upms-rpc-service/src/main/java/com/zheng/upms/rpc/service/impl/UpmsUserServiceImpl.java index 850229962..00663dd70 100644 --- a/zheng-upms/zheng-upms-rpc-service/src/main/java/com/zheng/upms/rpc/service/impl/UpmsUserServiceImpl.java +++ b/zheng-upms/zheng-upms-rpc-service/src/main/java/com/zheng/upms/rpc/service/impl/UpmsUserServiceImpl.java @@ -21,7 +21,7 @@ @BaseService public class UpmsUserServiceImpl extends BaseServiceImpl implements UpmsUserService { - private static Logger _log = LoggerFactory.getLogger(UpmsUserServiceImpl.class); + private static final Logger LOGGER = LoggerFactory.getLogger(UpmsUserServiceImpl.class); @Autowired UpmsUserMapper upmsUserMapper; diff --git a/zheng-upms/zheng-upms-server/src/main/java/com/zheng/upms/server/Initialize.java b/zheng-upms/zheng-upms-server/src/main/java/com/zheng/upms/server/Initialize.java index 43d20c959..ee54b8be7 100644 --- a/zheng-upms/zheng-upms-server/src/main/java/com/zheng/upms/server/Initialize.java +++ b/zheng-upms/zheng-upms-server/src/main/java/com/zheng/upms/server/Initialize.java @@ -10,11 +10,11 @@ */ public class Initialize implements BaseInterface { - private static Logger _log = LoggerFactory.getLogger(Initialize.class); + private static final Logger LOGGER = LoggerFactory.getLogger(Initialize.class); @Override public void init() { - _log.info(">>>>> 系统初始化"); + LOGGER.info(">>>>> 系统初始化"); } } diff --git a/zheng-upms/zheng-upms-server/src/main/java/com/zheng/upms/server/controller/ManageController.java b/zheng-upms/zheng-upms-server/src/main/java/com/zheng/upms/server/controller/ManageController.java index be56483e6..b4d5fe040 100644 --- a/zheng-upms/zheng-upms-server/src/main/java/com/zheng/upms/server/controller/ManageController.java +++ b/zheng-upms/zheng-upms-server/src/main/java/com/zheng/upms/server/controller/ManageController.java @@ -27,7 +27,7 @@ @Api(value = "后台管理", description = "后台管理") public class ManageController extends BaseController { - private static Logger _log = LoggerFactory.getLogger(ManageController.class); + private static final Logger LOGGER = LoggerFactory.getLogger(ManageController.class); @Autowired private UpmsSystemService upmsSystemService; diff --git a/zheng-upms/zheng-upms-server/src/main/java/com/zheng/upms/server/controller/SSOController.java b/zheng-upms/zheng-upms-server/src/main/java/com/zheng/upms/server/controller/SSOController.java index 1b32c2cf8..589cca3f3 100644 --- a/zheng-upms/zheng-upms-server/src/main/java/com/zheng/upms/server/controller/SSOController.java +++ b/zheng-upms/zheng-upms-server/src/main/java/com/zheng/upms/server/controller/SSOController.java @@ -45,7 +45,7 @@ @Api(value = "单点登录管理", description = "单点登录管理") public class SSOController extends BaseController { - private final static Logger _log = LoggerFactory.getLogger(SSOController.class); + private static final Logger LOGGER = LoggerFactory.getLogger(SSOController.class); // 全局会话key private final static String ZHENG_UPMS_SERVER_SESSION_ID = "zheng-upms-server-session-id"; // 全局会话key列表 @@ -103,7 +103,7 @@ public String login(HttpServletRequest request) { backurl += "?upms_code=" + code + "&upms_username=" + username; } } - _log.debug("认证中心帐号通过,带code回跳:{}", backurl); + LOGGER.debug("认证中心帐号通过,带code回跳:{}", backurl); return "redirect:" + backurl; } return "/sso/login.jsp"; diff --git a/zheng-upms/zheng-upms-server/src/main/java/com/zheng/upms/server/controller/manage/UpmsLogController.java b/zheng-upms/zheng-upms-server/src/main/java/com/zheng/upms/server/controller/manage/UpmsLogController.java index 77a55996f..8432fca01 100644 --- a/zheng-upms/zheng-upms-server/src/main/java/com/zheng/upms/server/controller/manage/UpmsLogController.java +++ b/zheng-upms/zheng-upms-server/src/main/java/com/zheng/upms/server/controller/manage/UpmsLogController.java @@ -30,7 +30,7 @@ @RequestMapping("/manage/log") public class UpmsLogController extends BaseController { - private static Logger _log = LoggerFactory.getLogger(UpmsLogController.class); + private static final Logger LOGGER = LoggerFactory.getLogger(UpmsLogController.class); @Autowired private UpmsLogService upmsLogService; diff --git a/zheng-upms/zheng-upms-server/src/main/java/com/zheng/upms/server/controller/manage/UpmsOrganizationController.java b/zheng-upms/zheng-upms-server/src/main/java/com/zheng/upms/server/controller/manage/UpmsOrganizationController.java index ef4117f1a..ed297ac26 100644 --- a/zheng-upms/zheng-upms-server/src/main/java/com/zheng/upms/server/controller/manage/UpmsOrganizationController.java +++ b/zheng-upms/zheng-upms-server/src/main/java/com/zheng/upms/server/controller/manage/UpmsOrganizationController.java @@ -34,7 +34,7 @@ @RequestMapping("/manage/organization") public class UpmsOrganizationController extends BaseController { - private static Logger _log = LoggerFactory.getLogger(UpmsOrganizationController.class); + private static final Logger LOGGER = LoggerFactory.getLogger(UpmsOrganizationController.class); @Autowired private UpmsOrganizationService upmsOrganizationService; diff --git a/zheng-upms/zheng-upms-server/src/main/java/com/zheng/upms/server/controller/manage/UpmsPermissionController.java b/zheng-upms/zheng-upms-server/src/main/java/com/zheng/upms/server/controller/manage/UpmsPermissionController.java index 74e6ab03f..5bcd79957 100644 --- a/zheng-upms/zheng-upms-server/src/main/java/com/zheng/upms/server/controller/manage/UpmsPermissionController.java +++ b/zheng-upms/zheng-upms-server/src/main/java/com/zheng/upms/server/controller/manage/UpmsPermissionController.java @@ -40,7 +40,7 @@ @RequestMapping("/manage/permission") public class UpmsPermissionController extends BaseController { - private static Logger _log = LoggerFactory.getLogger(UpmsPermissionController.class); + private static final Logger LOGGER = LoggerFactory.getLogger(UpmsPermissionController.class); @Autowired private UpmsPermissionService upmsPermissionService; diff --git a/zheng-upms/zheng-upms-server/src/main/java/com/zheng/upms/server/controller/manage/UpmsRoleController.java b/zheng-upms/zheng-upms-server/src/main/java/com/zheng/upms/server/controller/manage/UpmsRoleController.java index 81028ff16..f6c6a0e40 100644 --- a/zheng-upms/zheng-upms-server/src/main/java/com/zheng/upms/server/controller/manage/UpmsRoleController.java +++ b/zheng-upms/zheng-upms-server/src/main/java/com/zheng/upms/server/controller/manage/UpmsRoleController.java @@ -41,7 +41,7 @@ @RequestMapping("/manage/role") public class UpmsRoleController extends BaseController { - private static Logger _log = LoggerFactory.getLogger(UpmsRoleController.class); + private static final Logger LOGGER = LoggerFactory.getLogger(UpmsRoleController.class); @Autowired private UpmsRoleService upmsRoleService; diff --git a/zheng-upms/zheng-upms-server/src/main/java/com/zheng/upms/server/controller/manage/UpmsSessionController.java b/zheng-upms/zheng-upms-server/src/main/java/com/zheng/upms/server/controller/manage/UpmsSessionController.java index 4294234c4..f9891bc7c 100644 --- a/zheng-upms/zheng-upms-server/src/main/java/com/zheng/upms/server/controller/manage/UpmsSessionController.java +++ b/zheng-upms/zheng-upms-server/src/main/java/com/zheng/upms/server/controller/manage/UpmsSessionController.java @@ -22,7 +22,7 @@ @RequestMapping("/manage/session") public class UpmsSessionController extends BaseController { - private static Logger _log = LoggerFactory.getLogger(UpmsSessionController.class); + private static final Logger LOGGER = LoggerFactory.getLogger(UpmsSessionController.class); @Autowired private UpmsSessionDao sessionDAO; diff --git a/zheng-upms/zheng-upms-server/src/main/java/com/zheng/upms/server/controller/manage/UpmsSystemController.java b/zheng-upms/zheng-upms-server/src/main/java/com/zheng/upms/server/controller/manage/UpmsSystemController.java index b3ec241ef..cae8bfc0f 100644 --- a/zheng-upms/zheng-upms-server/src/main/java/com/zheng/upms/server/controller/manage/UpmsSystemController.java +++ b/zheng-upms/zheng-upms-server/src/main/java/com/zheng/upms/server/controller/manage/UpmsSystemController.java @@ -34,7 +34,7 @@ @RequestMapping("/manage/system") public class UpmsSystemController extends BaseController { - private static Logger _log = LoggerFactory.getLogger(UpmsSystemController.class); + private static final Logger LOGGER = LoggerFactory.getLogger(UpmsSystemController.class); @Autowired private UpmsSystemService upmsSystemService; diff --git a/zheng-upms/zheng-upms-server/src/main/java/com/zheng/upms/server/controller/manage/UpmsUserController.java b/zheng-upms/zheng-upms-server/src/main/java/com/zheng/upms/server/controller/manage/UpmsUserController.java index 87377ba78..d905aa451 100644 --- a/zheng-upms/zheng-upms-server/src/main/java/com/zheng/upms/server/controller/manage/UpmsUserController.java +++ b/zheng-upms/zheng-upms-server/src/main/java/com/zheng/upms/server/controller/manage/UpmsUserController.java @@ -38,7 +38,7 @@ @RequestMapping("/manage/user") public class UpmsUserController extends BaseController { - private static Logger _log = LoggerFactory.getLogger(UpmsUserController.class); + private static final Logger LOGGER = LoggerFactory.getLogger(UpmsUserController.class); @Autowired private UpmsUserService upmsUserService; @@ -194,7 +194,7 @@ public Object create(UpmsUser upmsUser) { if (null == upmsUser) { return new UpmsResult(UpmsResultConstant.FAILED, "帐号名已存在!"); } - _log.info("新增用户,主键:userId={}", upmsUser.getUserId()); + LOGGER.info("新增用户,主键:userId={}", upmsUser.getUserId()); return new UpmsResult(UpmsResultConstant.SUCCESS, 1); } diff --git a/zheng-upms/zheng-upms-server/src/main/java/com/zheng/upms/server/interceptor/UpmsInterceptor.java b/zheng-upms/zheng-upms-server/src/main/java/com/zheng/upms/server/interceptor/UpmsInterceptor.java index 0720fce31..21081ddfb 100644 --- a/zheng-upms/zheng-upms-server/src/main/java/com/zheng/upms/server/interceptor/UpmsInterceptor.java +++ b/zheng-upms/zheng-upms-server/src/main/java/com/zheng/upms/server/interceptor/UpmsInterceptor.java @@ -21,7 +21,7 @@ */ public class UpmsInterceptor extends HandlerInterceptorAdapter { - private static Logger _log = LoggerFactory.getLogger(UpmsInterceptor.class); + private static final Logger LOGGER = LoggerFactory.getLogger(UpmsInterceptor.class); private static final String ZHENG_OSS_ALIYUN_OSS_POLICY = PropertiesFileUtil.getInstance("zheng-oss-client").get("zheng.oss.aliyun.oss.policy"); @Autowired @@ -31,7 +31,7 @@ public class UpmsInterceptor extends HandlerInterceptorAdapter { public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { request.setAttribute("ZHENG_OSS_ALIYUN_OSS_POLICY", ZHENG_OSS_ALIYUN_OSS_POLICY); // 过滤ajax - if (null != request.getHeader("X-Requested-With") && request.getHeader("X-Requested-With").equalsIgnoreCase("XMLHttpRequest")) { + if (null != request.getHeader("X-Requested-With") && "XMLHttpRequest".equalsIgnoreCase(request.getHeader("X-Requested-With"))) { return true; } // 登录信息