From 56f0b6c18c306282307139c8c916aab5e5d2fbc2 Mon Sep 17 00:00:00 2001 From: jianjun Date: Wed, 24 Nov 2021 14:31:28 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E8=B0=83=E6=95=B4=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/ScreenExtractServiceImpl.java | 228 +++++++++--------- 1 file changed, 120 insertions(+), 108 deletions(-) diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenExtractServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenExtractServiceImpl.java index 3b03d3768d..74af482075 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenExtractServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenExtractServiceImpl.java @@ -177,143 +177,155 @@ public class ScreenExtractServiceImpl implements ScreenExtractService { threadPool.submit(() -> { //党员基本情况screen_cpc_base_data try { - partyBaseInfoService.statsPartyMemberBaseInfoToScreen(customerId, dateId); - } catch (Exception e) { - log.error("党员基本情况抽取到大屏失败,customerId为:" + customerId + "dateId为:" + dateId, e); - } - //先锋模范screen_pioneer_data - if (isLast) { try { - pioneerDataExtractService.extractGridPioneerData(customerId, dateId); + partyBaseInfoService.statsPartyMemberBaseInfoToScreen(customerId, dateId); } catch (Exception e) { - log.error("先锋模范【网格】抽取到大屏失败,customerId为:" + customerId + "dateId为:" + dateId, e); + log.error("党员基本情况抽取到大屏失败,customerId为:" + customerId + "dateId为:" + dateId, e); } - try { - pioneerDataExtractService.extractCommunityPioneerData(customerId, dateId); - } catch (Exception e) { - log.error("先锋模范【社区】抽取到大屏失败,customerId为:" + customerId + "dateId为:" + dateId, e); - } - try { - pioneerDataExtractService.extractExceptCommunityPioneerData(customerId, dateId); - } catch (Exception e) { - log.error("先锋模范【extractExceptCommunityPioneerData】抽取到大屏失败,customerId为:" + customerId + "dateId为:" + dateId, e); + //先锋模范screen_pioneer_data + if (isLast) { + try { + pioneerDataExtractService.extractGridPioneerData(customerId, dateId); + } catch (Exception e) { + log.error("先锋模范【网格】抽取到大屏失败,customerId为:" + customerId + "dateId为:" + dateId, e); + } + try { + pioneerDataExtractService.extractCommunityPioneerData(customerId, dateId); + } catch (Exception e) { + log.error("先锋模范【社区】抽取到大屏失败,customerId为:" + customerId + "dateId为:" + dateId, e); + } + try { + pioneerDataExtractService.extractExceptCommunityPioneerData(customerId, dateId); + } catch (Exception e) { + log.error("先锋模范【extractExceptCommunityPioneerData】抽取到大屏失败,customerId为:" + customerId + "dateId为:" + dateId, e); + } } + } finally { + latch.countDown(); + log.info("extractDaily 1 thread run end ========= dateId:{},customerId:{}", dateId, customerId); } - latch.countDown(); - log.info("extractDaily 1 thread run end ========= dateId:{},customerId:{}", dateId, customerId); }); threadPool.submit(() -> { //公众参与排行(注册人数、参与人数、话题数、议题数、项目数)screen_public_party_total_data try { - publicPartiTotalDataExtractService.extractPublicPartiTotalData(customerId, dateId); - } catch (Exception e) { - log.error("公众参与排行抽取到大屏失败,customerId为:" + customerId + "dateId为:" + dateId, e); - } - if (isLast) { - //基层治理- 难点赌点 screen_difficulty_data | screen_difficulty_img_data try { - ScreenCentralZoneDataFormDTO param2 = new ScreenCentralZoneDataFormDTO(); - param2.setCustomerId(customerId); - param2.setDateId(null); - log.info("【难点赌点数据上报开始------】 当前客户Id{}", param2.getCustomerId()); - //screenGrassrootsGovernDataAbsorptionService.difficultyDataHub(param); - - screenGrassrootsGovernDataAbsorptionService.difficultyDataExtract(param2); - log.info("【难点赌点数据上报结束------】 当前客户Id{}", param2.getCustomerId()); + publicPartiTotalDataExtractService.extractPublicPartiTotalData(customerId, dateId); } catch (Exception e) { - log.error("基层治理-难点赌点抽取到大屏失败,customerId为:" + customerId + "dateId为:" + dateId, e); + log.error("公众参与排行抽取到大屏失败,customerId为:" + customerId + "dateId为:" + dateId, e); + } + if (isLast) { + //基层治理- 难点赌点 screen_difficulty_data | screen_difficulty_img_data + try { + ScreenCentralZoneDataFormDTO param2 = new ScreenCentralZoneDataFormDTO(); + param2.setCustomerId(customerId); + param2.setDateId(null); + log.info("【难点赌点数据上报开始------】 当前客户Id{}", param2.getCustomerId()); + //screenGrassrootsGovernDataAbsorptionService.difficultyDataHub(param); + + screenGrassrootsGovernDataAbsorptionService.difficultyDataExtract(param2); + log.info("【难点赌点数据上报结束------】 当前客户Id{}", param2.getCustomerId()); + } catch (Exception e) { + log.error("基层治理-难点赌点抽取到大屏失败,customerId为:" + customerId + "dateId为:" + dateId, e); + } } + } finally { + latch.countDown(); + log.info("extractDaily 2 thread run end ========= dateId:{},customerId:{}", dateId, customerId); } - latch.countDown(); - log.info("extractDaily 2 thread run end ========= dateId:{},customerId:{}", dateId, customerId); }); threadPool.submit(() -> { - ScreenCentralZoneDataFormDTO param = new ScreenCentralZoneDataFormDTO(); - param.setCustomerId(customerId); - param.setDateId(dateId); - //中央区 screen_user_total_data try { - screenCentralZoneDataAbsorptionService.centralZoneDataHub(param); - } catch (Exception e) { - log.error("中央区抽取到大屏失败,customerId为:" + customerId + "dateId为:" + dateId, e); - } + ScreenCentralZoneDataFormDTO param = new ScreenCentralZoneDataFormDTO(); + param.setCustomerId(customerId); + param.setDateId(dateId); + //中央区 screen_user_total_data + try { + screenCentralZoneDataAbsorptionService.centralZoneDataHub(param); + } catch (Exception e) { + log.error("中央区抽取到大屏失败,customerId为:" + customerId + "dateId为:" + dateId, e); + } - try { - // 项目(事件)分析按网格_按天统计 - screenProjectGridDailyService.extractionProjectGridDaily(customerId, dateId); - } catch (Exception e) { - log.error("项目(事件)分析按网格_按天统计失败,customerId为:" + customerId + "dateId为:" + dateId, e); - } - try { - // 项目(事件)分析按组织_按天统计 - screenProjectOrgDailyService.extractionProjectOrgDaily(customerId, dateId); - } catch (Exception e) { - log.error("项目(事件)分析按组织_按天统计失败,customerId为:" + customerId + "dateId为:" + dateId, e); - } + try { + // 项目(事件)分析按网格_按天统计 + screenProjectGridDailyService.extractionProjectGridDaily(customerId, dateId); + } catch (Exception e) { + log.error("项目(事件)分析按网格_按天统计失败,customerId为:" + customerId + "dateId为:" + dateId, e); + } + try { + // 项目(事件)分析按组织_按天统计 + screenProjectOrgDailyService.extractionProjectOrgDaily(customerId, dateId); + } catch (Exception e) { + log.error("项目(事件)分析按组织_按天统计失败,customerId为:" + customerId + "dateId为:" + dateId, e); + } - //按天统计:网格内各个分类下的项目总数 - try { - screenProjectCategoryGridAndOrgDailyService.extractCategoryProjectGridData(customerId, dateId); - } catch (Exception e) { - log.error("按天统计:网格内各个分类下的项目总数,customerId为:" + customerId + "dateId为:" + dateId, e); - } + //按天统计:网格内各个分类下的项目总数 + try { + screenProjectCategoryGridAndOrgDailyService.extractCategoryProjectGridData(customerId, dateId); + } catch (Exception e) { + log.error("按天统计:网格内各个分类下的项目总数,customerId为:" + customerId + "dateId为:" + dateId, e); + } - // 按天统计:组织内各个分类下的项目总数 - try { - screenProjectCategoryGridAndOrgDailyService.extractCategoryProjectOrgData(customerId, dateId); - } catch (Exception e) { - log.error("按天统计:组织内各个分类下的项目总数,customerId为:" + customerId + "dateId为:" + dateId, e); + // 按天统计:组织内各个分类下的项目总数 + try { + screenProjectCategoryGridAndOrgDailyService.extractCategoryProjectOrgData(customerId, dateId); + } catch (Exception e) { + log.error("按天统计:组织内各个分类下的项目总数,customerId为:" + customerId + "dateId为:" + dateId, e); + } + } finally { + latch.countDown(); + log.info("extractDaily 3 thread run end ========= dateId:{},customerId:{}", dateId, customerId); } - latch.countDown(); - log.info("extractDaily 3 thread run end ========= dateId:{},customerId:{}", dateId, customerId); }); threadPool.submit(() -> { //治理能力排行screen_govern_rank_data try { - governRankDataExtractService.extractGridDataDaily(customerId, dateId); - } catch (Exception e) { - log.error("治理能力排行【网格】抽取到大屏失败,customerId为:" + customerId + "dateId为:" + dateId, e); - } - try { - governRankDataExtractService.extractCommunityDataDaily(customerId, dateId); - } catch (Exception e) { - log.error("治理能力排行【社区】抽取到大屏失败,customerId为:" + customerId + "dateId为:" + dateId, e); - } - try { - governRankDataExtractService.extractStreetDataDaily(customerId, dateId); - } catch (Exception e) { - log.error("治理能力排行【街道】抽取到大屏失败,customerId为:" + customerId + "dateId为:" + dateId, e); - } - try { - governRankDataExtractService.extractDistrictDataDaily(customerId, dateId); - } catch (Exception e) { - log.error("治理能力排行【全区】抽取到大屏失败,customerId为:" + customerId + "dateId为:" + dateId, e); - } + try { + governRankDataExtractService.extractGridDataDaily(customerId, dateId); + } catch (Exception e) { + log.error("治理能力排行【网格】抽取到大屏失败,customerId为:" + customerId + "dateId为:" + dateId, e); + } + try { + governRankDataExtractService.extractCommunityDataDaily(customerId, dateId); + } catch (Exception e) { + log.error("治理能力排行【社区】抽取到大屏失败,customerId为:" + customerId + "dateId为:" + dateId, e); + } + try { + governRankDataExtractService.extractStreetDataDaily(customerId, dateId); + } catch (Exception e) { + log.error("治理能力排行【街道】抽取到大屏失败,customerId为:" + customerId + "dateId为:" + dateId, e); + } + try { + governRankDataExtractService.extractDistrictDataDaily(customerId, dateId); + } catch (Exception e) { + log.error("治理能力排行【全区】抽取到大屏失败,customerId为:" + customerId + "dateId为:" + dateId, e); + } - try { - ExtractFactGridGovernDailyFromDTO extractFactGridGovernDailyFromDTO = new ExtractFactGridGovernDailyFromDTO(); - extractFactGridGovernDailyFromDTO.setCustomerId(customerId); - extractFactGridGovernDailyFromDTO.setDateId(dateId); - factGridGovernDailyService.extractFactGridGovernDaily(extractFactGridGovernDailyFromDTO); - } catch (Exception e) { - log.error("治理指数-网格fact_grid_govern_daily抽取失败,customerId为:" + customerId + "dateId为:" + dateId, e); - } + try { + ExtractFactGridGovernDailyFromDTO extractFactGridGovernDailyFromDTO = new ExtractFactGridGovernDailyFromDTO(); + extractFactGridGovernDailyFromDTO.setCustomerId(customerId); + extractFactGridGovernDailyFromDTO.setDateId(dateId); + factGridGovernDailyService.extractFactGridGovernDaily(extractFactGridGovernDailyFromDTO); + } catch (Exception e) { + log.error("治理指数-网格fact_grid_govern_daily抽取失败,customerId为:" + customerId + "dateId为:" + dateId, e); + } - try { - factAgencyGovernDailyService.extractFactAgencyGovernDaily(customerId, dateId); - } catch (Exception e) { - log.error("治理指数-组织fact_agency_govern_daily抽取失败,customerId为:" + customerId + "dateId为:" + dateId, e); - } + try { + factAgencyGovernDailyService.extractFactAgencyGovernDaily(customerId, dateId); + } catch (Exception e) { + log.error("治理指数-组织fact_agency_govern_daily抽取失败,customerId为:" + customerId + "dateId为:" + dateId, e); + } - try { - factGridMemberStatisticsDailyService.extractGridMemberStatisticsDaily(customerId, dateId); - } catch (Exception e) { - log.error("网格员数据统计fact_grid_member_statistics_daily抽取失败,customerId为:" + customerId + "dateId为:" + dateId, e); + try { + factGridMemberStatisticsDailyService.extractGridMemberStatisticsDaily(customerId, dateId); + } catch (Exception e) { + log.error("网格员数据统计fact_grid_member_statistics_daily抽取失败,customerId为:" + customerId + "dateId为:" + dateId, e); + } + extractPartData(customerId, dateId); + } finally { + latch.countDown(); + log.info("extractDaily 4 thread run end ========= dateId:{},customerId:{}", dateId, customerId); } - extractPartData(customerId, dateId); - latch.countDown(); - log.info("extractDaily 4 thread run end ========= dateId:{},customerId:{}", dateId, customerId); }); try { latch.await(); From fa3b69e9aa5ccd5ce86b81cd1075368388f71230 Mon Sep 17 00:00:00 2001 From: jianjun Date: Wed, 24 Nov 2021 14:35:34 +0800 Subject: [PATCH 2/4] cuowu --- .../main/java/com/epmet/service/impl/BaseReportServiceImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/BaseReportServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/BaseReportServiceImpl.java index c6d884c32e..1f8fdf806c 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/BaseReportServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/BaseReportServiceImpl.java @@ -60,7 +60,7 @@ public class BaseReportServiceImpl implements BaseReportService { } if (!CollectionUtils.isEmpty(formDTO.getDataList())) { ListUtils.partition(formDTO.getDataList(),NumConstant.ONE_HUNDRED) - .forEach(part->baseReportDao.insertBatchAgencyRegUser(part); + .forEach(part->baseReportDao.insertBatchAgencyRegUser(part)); } } From bfcfd8298ed757cee2c2ccf7549a01ee061033c3 Mon Sep 17 00:00:00 2001 From: jianjun Date: Wed, 24 Nov 2021 14:46:07 +0800 Subject: [PATCH 3/4] cuowu --- .../screen/impl/ScreenProjectDataServiceImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectDataServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectDataServiceImpl.java index fcdcf05349..e2597eae16 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectDataServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectDataServiceImpl.java @@ -352,7 +352,7 @@ public class ScreenProjectDataServiceImpl extends BaseServiceImpl Date: Thu, 25 Nov 2021 17:09:50 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=96=B0=E7=9A=84?= =?UTF-8?q?=E5=BC=82=E5=B8=B8=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tools/aspect/BaseRequestLogAspect.java | 35 ++++++- .../tools/exception/EpmetErrorCode.java | 8 +- .../tools/exception/EpmetException.java | 96 +++++++++++++++++++ .../commons/tools/exception/RenException.java | 10 +- .../commons/tools/validator/AssertUtils.java | 11 ++- 5 files changed, 148 insertions(+), 12 deletions(-) create mode 100644 epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetException.java diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/BaseRequestLogAspect.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/BaseRequestLogAspect.java index 38a70d6582..1a26a3318f 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/BaseRequestLogAspect.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/BaseRequestLogAspect.java @@ -67,7 +67,15 @@ public abstract class BaseRequestLogAspect { log.info(">>>>>>>>请求信息>>>>>>>>:事务流水号:{},url:{} ,method:{},请求参数:{}", transactionSerial, requestURI, method, objectsToString(args)); result = point.proceed(); resultInfoLog(transactionSerial, getExecPeriod(startTime), result); - } catch (RenException e) { + } catch (EpmetException e) { + result = handleRenException(e); + if (e.getCode() > 8000) { + resultWarnLog(transactionSerial, getExecPeriod(startTime), result, e.getInternalMsg(), ExceptionUtils.getErrorStackTrace(e)); + } else { + resultErrorLog(transactionSerial, getExecPeriod(startTime), result, e.getInternalMsg(), ExceptionUtils.getErrorStackTrace(e)); + } + return result; + } catch (RenException e) { result = handleRenException(e); if (e.getCode() > 8000) { resultWarnLog(transactionSerial, getExecPeriod(startTime), result, e.getInternalMsg(), ExceptionUtils.getErrorStackTrace(e)); @@ -213,6 +221,31 @@ public abstract class BaseRequestLogAspect { return result; } + /** + * 处理EpmetException + * @param e + * @return + */ + private Result handleRenException(EpmetException e) { + if (e.getCode() > 8000) { + Result result; + if (StringUtils.isNotBlank(e.getMsg())) { + // 抛出异常的时候填写了自定义显示信息,把显示信息返回 + result = new Result().error(e.getCode(), e.getMsg()); + } else { + // 没有填写显示信息,则根据code找固定的显示信息 + result = new Result().error(e.getCode()); + } + result.setInternalMsg(e.getInternalMsg()); + return result; + } + // 转化成服务器开小差... + Result result=new Result().error(); + result.setInternalMsg(e.getInternalMsg()); + //result.setMsg(e.getMsg()); + return result; + } + /** * 将请求对象转换为String * @param args diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java index f078bd4bb6..84da084985 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java @@ -212,9 +212,15 @@ public enum EpmetErrorCode { SAME_RULE_NAME(8916,"该积分事件已存在,请重新调整保存"), UP_LIMIT_POINT(8917,"积分上限需为单位积分倍数,请重新调整保存"), - BADGE_CHECK(8918,""); + BADGE_CHECK(8918,""), + //通用错误码 start + //通用的 错误消息自己定义返回 + OPERATION_FAILED(9999,"网络开小差..."), + //通用错误码 end + ; + private int code; private String msg; diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetException.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetException.java new file mode 100644 index 0000000000..6ce29315ba --- /dev/null +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetException.java @@ -0,0 +1,96 @@ +/** + * Copyright (c) 2018 人人开源 All rights reserved. + *

+ * https://www.renren.io + *

+ * 版权所有,侵权必究! + */ + +package com.epmet.commons.tools.exception; + + +import com.epmet.commons.tools.constant.StrConstant; +import com.epmet.commons.tools.utils.MessageUtils; +import org.apache.commons.lang3.StringUtils; + +/** + * Epmet产品 自定义异常 + * + * @author Mark sunlightcs@gmail.com + * @since 1.0.0 + */ +public class EpmetException extends RuntimeException { + + private static final long serialVersionUID = 1L; + /** + * desc:错误码 + */ + protected int code; + /** + * 显示给客户的消息 + */ + protected String msg; + /** + * 内部消息,用于服务之间传递错误信息,排错用 + */ + protected String internalMsg; + + /** + * desc:指定错误码异常 外部异常内容为错误码对应的异常 + * @param code + */ + public EpmetException(int code) { + this(code, StrConstant.EPMETY_STR); + } + + /** + * desc:指定内部错误消息的异常 外部异常内容为错误码对应的异常 + * @param code + * @param internalMsg + */ + public EpmetException(int code, String internalMsg) { + super(internalMsg); + this.code = code; + if (StringUtils.isBlank(internalMsg)) { + this.internalMsg = EpmetErrorCode.getMsg(code); + if (StringUtils.isBlank(this.internalMsg)) { + this.internalMsg = MessageUtils.getMessage(code, internalMsg); + } + } else { + this.internalMsg = internalMsg; + } + } + + /** + * desc:指定错误码 内外部错误消息异常 + * @param code + * @param internalMsg + * @param externalMsg + */ + public EpmetException(int code, String internalMsg, String externalMsg) { + this(code, internalMsg); + this.msg = externalMsg; + } + + /** + * desc:指定内部消息异常 外部错误码及消息为8000,服务器开小差 + * @param internalMsg + */ + public EpmetException(String internalMsg) { + super(internalMsg); + this.code = EpmetErrorCode.SERVER_ERROR.getCode(); + this.internalMsg = internalMsg; + } + + public int getCode() { + return code; + } + + public String getMsg() { + return msg; + } + + public String getInternalMsg() { + return internalMsg; + } +} diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/RenException.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/RenException.java index 73ae4bf6b5..ee1d4da142 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/RenException.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/RenException.java @@ -35,11 +35,12 @@ public class RenException extends RuntimeException { * 内部消息,用于服务之间传递错误信息,排错用 */ private String internalMsg; - + @Deprecated //已废弃 被EpmetException替代 public RenException(int code) { this(code, ""); } + @Deprecated //已废弃 被EpmetException替代 public RenException(int code, String internalMsg) { super(internalMsg); this.code = code; @@ -53,11 +54,13 @@ public class RenException extends RuntimeException { } } + @Deprecated //已废弃 被EpmetException替代 public RenException(int code, String internalMsg, String msg, MessageMode mode) { this(code, internalMsg); this.msg = msg; } + @Deprecated //已废弃 被EpmetException替代 public RenException(String internalMsg) { super(internalMsg); // this.code = ErrorCode.INTERNAL_SERVER_ERROR; @@ -65,15 +68,12 @@ public class RenException extends RuntimeException { this.internalMsg = internalMsg; } + @Deprecated //已废弃 被EpmetException替代 public RenException(String internalMsg, String msg) { this(internalMsg); this.msg = msg; } - - - - public RenException(int code, String... params) { this.code = code; this.internalMsg = EpmetErrorCode.getMsg(code); diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/validator/AssertUtils.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/validator/AssertUtils.java index 2f5dcd311a..d060fc5e6a 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/validator/AssertUtils.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/validator/AssertUtils.java @@ -11,6 +11,7 @@ package com.epmet.commons.tools.validator; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.map.MapUtil; import cn.hutool.core.util.ArrayUtil; +import com.epmet.commons.tools.exception.EpmetException; import com.epmet.commons.tools.exception.ErrorCode; import com.epmet.commons.tools.exception.RenException; import org.apache.commons.lang3.StringUtils; @@ -32,7 +33,7 @@ public class AssertUtils { public static void isBlank(String str, Integer code, String... params) { if(code == null){ - throw new RenException(ErrorCode.NOT_NULL, "code"); + throw new EpmetException(ErrorCode.NOT_NULL, "code"); } if (StringUtils.isBlank(str)) { @@ -46,7 +47,7 @@ public class AssertUtils { public static void isNull(Object object, Integer code, String... params) { if(code == null){ - throw new RenException(ErrorCode.NOT_NULL, "code"); + throw new EpmetException(ErrorCode.NOT_NULL, "code"); } if (object == null) { @@ -60,7 +61,7 @@ public class AssertUtils { public static void isArrayEmpty(Object[] array, Integer code, String... params) { if(code == null){ - throw new RenException(ErrorCode.NOT_NULL, "code"); + throw new EpmetException(ErrorCode.NOT_NULL, "code"); } if(ArrayUtil.isEmpty(array)){ @@ -74,7 +75,7 @@ public class AssertUtils { public static void isListEmpty(List list, Integer code, String... params) { if(code == null){ - throw new RenException(ErrorCode.NOT_NULL, "code"); + throw new EpmetException(ErrorCode.NOT_NULL, "code"); } if(CollUtil.isEmpty(list)){ @@ -88,7 +89,7 @@ public class AssertUtils { public static void isMapEmpty(Map map, Integer code, String... params) { if(code == null){ - throw new RenException(ErrorCode.NOT_NULL, "code"); + throw new EpmetException(ErrorCode.NOT_NULL, "code"); } if(MapUtil.isEmpty(map)){