Skip to content

Commit

Permalink
按照Alibaba Java Coding Guidelines插件扫描结果,修改代码规范
Browse files Browse the repository at this point in the history
  • Loading branch information
shuzheng committed Nov 8, 2017
1 parent ad725a4 commit 3e330ec
Show file tree
Hide file tree
Showing 140 changed files with 841 additions and 569 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
*/
public enum ApiResultConstant {

/**
* 成功
*/
SUCCESS(1, "success");

public int code;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@
*/
public interface ApiService {

/**
* hello
* @param name
* @return
*/
String hello(String name);

}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 启动完成 <<<<<");
}
}
Original file line number Diff line number Diff line change
@@ -1,50 +1,17 @@
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接口
* Created by shuzheng on 2017/2/19.
*/
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 + "!";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}
}
});
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -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);

/**
* 后台首页
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -67,7 +67,7 @@ public Object list(
}
List<CmsArticle> rows = cmsArticleService.selectByExampleForOffsetPage(cmsArticleExample, offset, limit);
long total = cmsArticleService.countByExample(cmsArticleExample);
Map<String, Object> result = new HashMap<>();
Map<String, Object> result = new HashMap<>(2);
result.put("rows", rows);
result.put("total", total);
return result;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -61,7 +61,7 @@ public Object list(
}
List<CmsCategory> rows = cmsCategoryService.selectByExampleForOffsetPage(cmsCategoryExample, offset, limit);
long total = cmsCategoryService.countByExample(cmsCategoryExample);
Map<String, Object> result = new HashMap<>();
Map<String, Object> result = new HashMap<>(2);
result.put("rows", rows);
result.put("total", total);
return result;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -57,7 +57,7 @@ public Object list(
}
List<CmsComment> rows = cmsCommentService.selectByExampleWithBLOBsForOffsetPage(cmsCommentExample, offset, limit);
long total = cmsCommentService.countByExample(cmsCommentExample);
Map<String, Object> result = new HashMap<>();
Map<String, Object> result = new HashMap<>(2);
result.put("rows", rows);
result.put("total", total);
return result;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -61,7 +61,7 @@ public Object list(
}
List<CmsMenu> rows = cmsMenuService.selectByExampleForOffsetPage(cmsMenuExample, offset, limit);
long total = cmsMenuService.countByExample(cmsMenuExample);
Map<String, Object> result = new HashMap<>();
Map<String, Object> result = new HashMap<>(2);
result.put("rows", rows);
result.put("total", total);
return result;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -61,7 +61,7 @@ public Object list(
}
List<CmsPage> rows = cmsPageService.selectByExampleForOffsetPage(cmsPageExample, offset, limit);
long total = cmsPageService.countByExample(cmsPageExample);
Map<String, Object> result = new HashMap<>();
Map<String, Object> result = new HashMap<>(2);
result.put("rows", rows);
result.put("total", total);
return result;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -62,7 +62,7 @@ public Object list(
}
List<CmsSetting> rows = cmsSettingService.selectByExampleForOffsetPage(cmsSettingExample, offset, limit);
long total = cmsSettingService.countByExample(cmsSettingExample);
Map<String, Object> result = new HashMap<>();
Map<String, Object> result = new HashMap<>(2);
result.put("rows", rows);
result.put("total", total);
return result;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -61,7 +61,7 @@ public Object list(
}
List<CmsTag> rows = cmsTagService.selectByExampleForOffsetPage(cmsTagExample, offset, limit);
long total = cmsTagService.countByExample(cmsTagExample);
Map<String, Object> result = new HashMap<>();
Map<String, Object> result = new HashMap<>(2);
result.put("rows", rows);
result.put("total", total);
return result;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -61,7 +61,7 @@ public Object list(
}
List<CmsTopic> rows = cmsTopicService.selectByExampleForOffsetPage(cmsTopicExample, offset, limit);
long total = cmsTopicService.countByExample(cmsTopicExample);
Map<String, Object> result = new HashMap<>();
Map<String, Object> result = new HashMap<>(2);
result.put("rows", rows);
result.put("total", total);
return result;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.zheng.cms.admin.Interceptor;
package com.zheng.cms.admin.interceptor;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand All @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<!-- 非拦截路径 -->
<mvc:exclude-mapping path="/manage/login"/>
<!-- 拦截器对象 -->
<bean id="manageInterceptor" class="com.zheng.cms.admin.Interceptor.ManageInterceptor"/>
<bean id="manageInterceptor" class="com.zheng.cms.admin.interceptor.ManageInterceptor"/>
</mvc:interceptor>
</mvc:interceptors>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Loading

0 comments on commit 3e330ec

Please sign in to comment.