去除e.printStackTrace();使用slf4j实现

This commit is contained in:
lifenlong
2021-06-07 16:49:59 +08:00
57 changed files with 193 additions and 653 deletions

View File

@@ -8,6 +8,7 @@ import cn.lili.modules.page.service.ArticleCategoryService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@@ -20,6 +21,7 @@ import java.util.List;
* @author pikachu
* @date 2020-05-5 15:10:16
*/
@Slf4j
@RestController
@Api(tags = "管理端,文章分类管理接口")
@RequestMapping("/manager/article-category")
@@ -37,7 +39,7 @@ public class ArticleCategoryManagerController {
try {
return ResultUtil.data(this.articleCategoryService.allChildren());
} catch (Exception e) {
e.printStackTrace();
log.error("查询分类列表错误",e);
}
return null;
}

View File

@@ -7,6 +7,7 @@ import cn.lili.modules.search.service.CustomWordsService;
import cn.lili.modules.system.entity.dos.Setting;
import cn.lili.modules.system.service.SettingService;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
@@ -20,6 +21,7 @@ import java.nio.charset.StandardCharsets;
* @author paulG
* @since 2020/10/16
**/
@Slf4j
@RestController
@Api(tags = "管理端,自定义分词接口")
@RequestMapping("/manager/custom-words")
@@ -54,7 +56,7 @@ public class CustomWordsController {
try {
return new String(res.getBytes(), StandardCharsets.UTF_8);
} catch (Exception e) {
e.printStackTrace();
log.error("获取分词错误",e);
}
return "";
}

View File

@@ -148,7 +148,7 @@ public class AdminUserManagerController {
}
adminUserService.saveAdminUser(adminUser, roles);
} catch (Exception e) {
e.printStackTrace();
log.error("添加用户错误",e);
}
return ResultUtil.success();
}

View File

@@ -1,6 +1,5 @@
package cn.lili.controller.permission;
import cn.lili.common.enums.ResultCode;
import cn.lili.common.enums.ResultUtil;
import cn.lili.common.vo.ResultMessage;
import cn.lili.modules.permission.entity.dos.Menu;
@@ -10,6 +9,7 @@ import cn.lili.modules.permission.service.MenuService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@@ -22,6 +22,7 @@ import java.util.List;
* @author Chopper
* @date 2020/11/20 12:07
*/
@Slf4j
@RestController
@Api(tags = "管理端,菜单管理接口")
@RequestMapping("/manager/menu")
@@ -41,7 +42,7 @@ public class MenuManagerController {
try {
menuService.save(menu);
} catch (Exception e) {
e.printStackTrace();
log.error("添加菜单错误",e);
}
return ResultUtil.data(menu);
}

View File

@@ -1,6 +1,5 @@
package cn.lili.controller.setting;
import cn.lili.common.enums.ResultCode;
import cn.lili.common.enums.ResultUtil;
import cn.lili.common.vo.PageVO;
import cn.lili.common.vo.ResultMessage;
@@ -41,7 +40,7 @@ public class LogManagerController {
try {
return ResultUtil.data(systemLogService.queryLog(null, operatorName, key, searchVo, pageVo));
} catch (Exception e) {
e.printStackTrace();
log.error("日志获取错误",e);
}
return null;
}

View File

@@ -31,12 +31,7 @@ public class GoodsStatisticsManagerController {
@ApiOperation(value = "获取统计列表,排行前一百的数据")
@GetMapping
public ResultMessage<List<GoodsStatisticsDataVO>> getByPage(GoodsStatisticsQueryParam goodsStatisticsQueryParam) {
try {
return ResultUtil.data(goodsStatisticsDataService.getGoodsStatisticsData(goodsStatisticsQueryParam, 100));
} catch (Exception e) {
e.printStackTrace();
}
return null;
return ResultUtil.data(goodsStatisticsDataService.getGoodsStatisticsData(goodsStatisticsQueryParam, 100));
}
@ApiOperation(value = "获取行业统计列表")

View File

@@ -12,6 +12,7 @@ import cn.lili.modules.statistics.model.vo.StoreStatisticsDataVO;
import cn.lili.modules.statistics.service.IndexStatisticsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
@@ -25,6 +26,7 @@ import java.util.List;
* @author Bulbasaur
* @date: 2020/12/15 17:53
*/
@Slf4j
@Api(tags = "管理端,首页统计数据接口")
@RestController
@RequestMapping("/manager/statistics/index")
@@ -42,7 +44,7 @@ public class IndexStatisticsManagerController {
try {
return ResultUtil.data(indexStatisticsService.indexStatistics());
} catch (Exception e) {
e.printStackTrace();
log.error("获取首页查询数据错误",e);
}
return null;
}

View File

@@ -14,6 +14,7 @@ import cn.lili.modules.statistics.service.OrderStatisticsDataService;
import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
@@ -27,6 +28,7 @@ import java.util.List;
* @author Bulbasaur
* @date: 2020/12/9 19:04
*/
@Slf4j
@Api(tags = "管理端,订单统计接口")
@RestController
@RequestMapping("/manager/statistics/order")
@@ -44,7 +46,7 @@ public class OrderStatisticsManagerController {
try {
return ResultUtil.data(orderStatisticsDataService.overview(statisticsQueryParam));
} catch (Exception e) {
e.printStackTrace();
log.error("订单概览统计错误",e);
}
return null;
}
@@ -55,7 +57,7 @@ public class OrderStatisticsManagerController {
try {
return ResultUtil.data(orderStatisticsDataService.statisticsChart(statisticsQueryParam));
} catch (Exception e) {
e.printStackTrace();
log.error("订单图表统计",e);
}
return null;
}
@@ -67,7 +69,7 @@ public class OrderStatisticsManagerController {
try {
return ResultUtil.data(orderService.getStatistics(statisticsQueryParam, pageVO));
} catch (Exception e) {
e.printStackTrace();
log.error("订单统计",e);
}
return null;
}

View File

@@ -49,7 +49,6 @@ public class ManagerSecurityConfig extends WebSecurityConfigurerAdapter {
.authorizeRequests();
// 配置的url 不需要授权
for (String url : ignoredUrlsProperties.getUrls()) {
log.error(url);
registry.antMatchers(url).permitAll();
}
registry