From ab4ec0807837b25e39fe8bb727f53666a400d7ce Mon Sep 17 00:00:00 2001 From: gaoqr <13665037151@163.com> Date: Thu, 20 Nov 2025 11:12:21 +0800 Subject: [PATCH] =?UTF-8?q?1=E3=80=81=E7=BB=9F=E4=B8=80=E6=8A=9B=E5=87=BAS?= =?UTF-8?q?erviceException=E5=B8=A6=E5=8D=A0=E4=BD=8D=E7=AC=A6=E7=9A=84?= =?UTF-8?q?=E5=A1=AB=E5=85=85=E6=96=B9=E5=BC=8F=EF=BC=8C=E4=B8=8D=E5=86=8D?= =?UTF-8?q?=E4=BD=BF=E7=94=A8ServiceExceptionUtils=EF=BC=9B2=E3=80=81?= =?UTF-8?q?=E6=96=B0=E5=A2=9ESystem=E6=9C=8D=E5=8A=A1ErrorCode=E7=9A=84?= =?UTF-8?q?=E5=9B=BD=E9=99=85=E5=8C=96=EF=BC=9B3=E3=80=81Webcad=E5=BC=82?= =?UTF-8?q?=E6=AD=A5=E5=AF=BC=E5=85=A5=E7=A7=BB=E9=99=A4=E5=88=86=E5=B8=83?= =?UTF-8?q?=E5=BC=8F=E9=94=81=EF=BC=8C=E5=AF=BC=E5=85=A5=E8=A7=A3=E6=9E=90?= =?UTF-8?q?=E4=BA=8B=E5=8A=A1=E5=AE=8C=E5=96=84=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/exception/ServiceException.java | 8 +- .../enums/GlobalErrorCodeConstants.java | 2 +- .../common/util/Assert/AssertUtils.java | 30 +- .../common/util/i18n/core/util/I18nUtils.java | 2 +- .../core/service/imp/IPQueryServiceImpl.java | 7 +- .../ChenfengOrganAutoConfiguration.java | 5 +- .../core/security/OrganSecurityWebFilter.java | 10 +- .../impl/alipay/AbstractAlipayClientTest.java | 3 +- .../impl/alipay/AlipayQrPayClientTest.java | 3 +- .../core/aop/PreAuthenticatedAspect.java | 4 +- .../handler/AuthenticationEntryPointImpl.java | 6 +- .../config/ChenfengWebAutoConfiguration.java | 2 +- .../core/handler/GlobalExceptionHandler.java | 2 +- .../admin/config/ConfigController.java | 5 +- .../service/codegen/CodegenServiceImpl.java | 33 +- .../service/config/ConfigServiceImpl.java | 11 +- .../db/DataSourceConfigServiceImpl.java | 8 +- .../service/file/FileConfigServiceImpl.java | 7 +- .../infra/service/file/FileServiceImpl.java | 9 +- .../logger/ApiErrorLogServiceImpl.java | 6 +- .../admin/order/OrderController.java | 5 +- .../BodyNoGenerateRuleServiceImpl.java | 4 +- .../OrderNoGenerateRuleServiceImpl.java | 4 +- .../PlateNoGenerateRuleServiceImpl.java | 4 +- ...ProcessGroupNoGenerateRuleServiceImpl.java | 3 +- .../service/goods/GoodsServiceImpl.java | 11 +- .../service/manage/pack/PackServiceImpl.java | 12 +- .../manage/parts/PartsServiceImpl.java | 17 +- .../manage/plate/PlateManageServiceImpl.java | 13 +- .../RemainPlateManageServiceImpl.java | 20 +- .../service/module/ModuleServiceImpl.java | 6 +- .../optimizeplan/OptimizePlanServiceImpl.java | 25 +- .../service/order/OrderServiceImpl.java | 43 +- .../factory/OrderImportHandlerFactory.java | 3 +- .../xml/DefaultXmlOrderImportHandler.java | 13 +- .../orderParts/OrderPartsServiceImpl.java | 10 +- .../service/plan/PlanServiceImpl.java | 32 +- .../service/plate/PlateServiceImpl.java | 27 +- .../process/OrderProcessServiceImpl.java | 14 +- .../processStep/ProcessStepServiceImpl.java | 7 +- .../service/rawgoods/RawGoodsServiceImpl.java | 6 +- .../remainplate/RemainPlateServiceImpl.java | 4 +- .../module/executor/util/ExcelWriterUtil.java | 3 +- .../executor/util/file/FileHelperUtil.java | 13 +- .../admin/api/webcad/ApiDataAchieve.java | 34 +- .../admin/api/webcad/ApiTypeRealize.java | 22 +- .../DefaultOrderImportExcelListener.java | 47 +- .../DefaultOrderImportXmlParserHandler.java | 56 +-- .../admin/files/xml/XMLUtil.java | 4 +- .../BodyNoGenerateRuleServiceImpl.java | 4 +- .../OrderNoGenerateRuleServiceImpl.java | 4 +- .../PlateNoGenerateRuleServiceImpl.java | 4 +- .../orderImport/OrderImportTaskService.java | 16 - .../OrderImportTaskServiceImpl.java | 22 - .../WebCadOrderImportServiceImpl.java | 53 +-- .../DefaultExcelOrderImportConsumer.java | 7 +- .../DefaultXmlOrderImportConsumer.java | 9 +- .../OrderImportDeadLetterConsumer.java | 4 +- .../consumer/WebCadOrderImportConsumer.java | 126 ++---- .../DefaultExcelOrderImportFactory.java | 10 +- .../factory/DefaultXmlOrderImportFactory.java | 6 +- .../WebCadOrderImportAsyncFactory.java | 14 +- .../factory/WebCadOrderImportFactory.java | 14 +- .../dataset/ReportDatasetServiceImpl.java | 8 +- .../ReportDatasourceServiceImpl.java | 14 +- .../template/ReportTemplateServiceImpl.java | 26 +- .../system/enums/ErrorCodeConstants.java | 414 +++++++++--------- .../api/application/ApplicationApiImpl.java | 6 +- .../api/datasource/DataSourceApiImpl.java | 5 +- .../module/system/api/organ/OrganApiImpl.java | 4 +- .../api/process/ProcessGroupApiImpl.java | 4 +- .../system/api/setting/SettingApiImpl.java | 4 +- .../api/systemconfig/SystemConfigApiImpl.java | 14 +- .../admin/organ/OrganController.java | 8 +- .../admin/permission/RoleController.java | 3 +- .../controller/admin/user/UserController.java | 4 +- .../admin/user/UserProfileController.java | 4 +- .../dal/mysql/user/AdminUserMapper.java | 4 +- .../application/ApplicationServiceImpl.java | 18 +- .../service/auth/AdminAuthServiceImpl.java | 24 +- .../CustomPlateNoSeqServiceImpl.java | 4 +- .../datasource/DataSourceServiceImpl.java | 4 +- .../system/service/dept/DeptServiceImpl.java | 35 +- .../service/dict/DictDataServiceImpl.java | 18 +- .../service/dict/DictTypeServiceImpl.java | 14 +- .../errorcode/ErrorCodeServiceImpl.java | 9 +- .../AdvertisementServiceImpl.java | 20 +- .../funds/invoice/InvoiceServiceImpl.java | 7 +- .../ProductPromotionServiceImpl.java | 6 +- .../products/ProductsDetailServiceImpl.java | 13 +- .../funds/products/ProductsServiceImpl.java | 8 +- .../funds/purchase/PurchaseServiceImpl.java | 3 +- .../LabelTemplateServiceImpl.java | 16 +- .../service/lable/LabelServiceImpl.java | 8 +- .../service/machine/MachineServiceImpl.java | 34 +- .../machine/MachineTemplateServiceImpl.java | 26 +- .../service/mail/MailAccountServiceImpl.java | 8 +- .../service/mail/MailSendServiceImpl.java | 10 +- .../service/mail/MailTemplateServiceImpl.java | 8 +- .../service/notice/NoticeServiceImpl.java | 11 +- .../service/notify/NotifySendServiceImpl.java | 6 +- .../notify/NotifyTemplateServiceImpl.java | 10 +- .../oauth2/OAuth2ClientServiceImpl.java | 20 +- .../service/oauth2/OAuth2CodeServiceImpl.java | 6 +- .../oauth2/OAuth2GrantServiceImpl.java | 9 +- .../service/organ/OrganServiceImpl.java | 24 +- .../organ/TenantPackageServiceImpl.java | 16 +- .../service/parser/ParserServiceImpl.java | 4 +- .../parser/ParserTemplateServiceImpl.java | 4 +- .../service/pay/PayOrderServiceImpl.java | 20 +- .../service/pay/PayProductProcessorNew.java | 3 +- .../service/permission/MenuServiceImpl.java | 20 +- .../permission/PermissionServiceImpl.java | 3 +- .../service/permission/RoleServiceImpl.java | 15 +- .../process/ProcessGroupServiceImpl.java | 25 +- .../service/process/ProcessServiceImpl.java | 20 +- .../process/ProcessUserServiceImpl.java | 8 +- .../SensitiveWordServiceImpl.java | 8 +- .../service/setting/SettingServiceImpl.java | 6 +- .../service/sms/SmsCodeServiceImpl.java | 25 +- .../service/sms/SmsSendServiceImpl.java | 8 +- .../service/sms/SmsTemplateServiceImpl.java | 18 +- .../social/SocialClientServiceImpl.java | 10 +- .../service/social/SocialUserServiceImpl.java | 4 +- .../impl/CustomPlateNoServiceHandler.java | 23 +- .../impl/DataProcessServiceHandler.java | 9 +- .../impl/IntellectBranchingService.java | 7 +- .../impl/ProcessSchemeServiceHandler.java | 10 +- .../impl/ProcessScreeningServiceHandler.java | 8 +- .../service/impl/SealedgeServiceHandler.java | 17 +- .../tokenconfig/TokenConfigServiceImpl.java | 24 +- .../service/user/AdminUserServiceImpl.java | 50 +-- .../src/main/resources/application.yaml | 2 +- .../src/main/resources/message.properties | 3 +- .../src/main/resources/message_cht.properties | 3 +- .../src/main/resources/message_en.properties | 3 +- .../resources/message_errorcode.properties | 1 + .../message_errorcode_cht.properties | 1 + .../resources/message_errorcode_en.properties | 1 + 139 files changed, 1005 insertions(+), 1193 deletions(-) create mode 100644 cf-module-system/cf-module-system-biz/src/main/resources/message_errorcode.properties create mode 100644 cf-module-system/cf-module-system-biz/src/main/resources/message_errorcode_cht.properties create mode 100644 cf-module-system/cf-module-system-biz/src/main/resources/message_errorcode_en.properties diff --git a/cf-framework/cf-common/src/main/java/com/cf/imes/framework/common/exception/ServiceException.java b/cf-framework/cf-common/src/main/java/com/cf/imes/framework/common/exception/ServiceException.java index af9ebf33b..2907e6e3d 100644 --- a/cf-framework/cf-common/src/main/java/com/cf/imes/framework/common/exception/ServiceException.java +++ b/cf-framework/cf-common/src/main/java/com/cf/imes/framework/common/exception/ServiceException.java @@ -22,15 +22,21 @@ public final class ServiceException extends RuntimeException { */ private String message; + /** + * 占位参数 + */ + private transient Object[] args; + /** * 空构造方法,避免反序列化问题 */ public ServiceException() { } - public ServiceException(ErrorCode errorCode) { + public ServiceException(ErrorCode errorCode, Object... args) { this.code = errorCode.getCode(); this.message = errorCode.getMsg(); + this.args = args; } public ServiceException(Integer code, String message) { diff --git a/cf-framework/cf-common/src/main/java/com/cf/imes/framework/common/exception/enums/GlobalErrorCodeConstants.java b/cf-framework/cf-common/src/main/java/com/cf/imes/framework/common/exception/enums/GlobalErrorCodeConstants.java index 1510b4488..bc3882c6b 100644 --- a/cf-framework/cf-common/src/main/java/com/cf/imes/framework/common/exception/enums/GlobalErrorCodeConstants.java +++ b/cf-framework/cf-common/src/main/java/com/cf/imes/framework/common/exception/enums/GlobalErrorCodeConstants.java @@ -22,7 +22,7 @@ public class GlobalErrorCodeConstants { public static final ErrorCode REQUEST_ORGAN_ID_NOT_EXIST = new ErrorCode(400, "global.error.request.organId.notExist"); public static final ErrorCode NO_PERMISSION_TO_VISIT_ORG = new ErrorCode(400, "global.error.no.permission.to.visit.org"); public static final ErrorCode REQUEST_PARAM_TYPE_ERROR = new ErrorCode(400, "global.error.request.param.type.error"); - public static final ErrorCode UNAUTHORIZED = new ErrorCode(401, "账号未登录"); + public static final ErrorCode UNAUTHORIZED = new ErrorCode(401, "global.not.login"); public static final ErrorCode FORBIDDEN = new ErrorCode(403, "global.error.no.permission"); public static final ErrorCode REQUEST_PARAM_MISSING = new ErrorCode(403, "global.error.request.param.missing"); public static final ErrorCode NOT_FOUND = new ErrorCode(404, "global.error.request.not.found"); diff --git a/cf-framework/cf-common/src/main/java/com/cf/imes/framework/common/util/Assert/AssertUtils.java b/cf-framework/cf-common/src/main/java/com/cf/imes/framework/common/util/Assert/AssertUtils.java index 7980e5727..baf71a9cd 100644 --- a/cf-framework/cf-common/src/main/java/com/cf/imes/framework/common/util/Assert/AssertUtils.java +++ b/cf-framework/cf-common/src/main/java/com/cf/imes/framework/common/util/Assert/AssertUtils.java @@ -3,13 +3,13 @@ package com.cf.imes.framework.common.util.Assert; import cn.hutool.core.util.ObjectUtil; import com.cf.imes.framework.common.exception.ErrorCode; -import com.cf.imes.framework.common.exception.util.ServiceExceptionUtil; +import com.cf.imes.framework.common.exception.ServiceException; import org.apache.commons.lang3.StringUtils; import org.springframework.util.ObjectUtils; import java.util.List; -import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception; + @@ -31,81 +31,81 @@ public class AssertUtils { * */ public static void notEmpty(List array, ErrorCode errorCode) { if (ObjectUtils.isEmpty(array)) { - throw exception(errorCode); + throw new ServiceException(errorCode); } } public static void empty(List array, ErrorCode errorCode) { if (!ObjectUtils.isEmpty(array)) { - throw exception(errorCode); + throw new ServiceException(errorCode); } } public static void empty(List array, ErrorCode errorCode, Object... params) { if (!ObjectUtils.isEmpty(array)) { - throw ServiceExceptionUtil.exception(errorCode, params); + throw new ServiceException(errorCode, params); } } public static void empty(Object object, ErrorCode errorCode) { if (object != null) { - throw exception(errorCode); + throw new ServiceException(errorCode); } } public static void empty(Object object, ErrorCode errorCode, Object... params) { if (object != null) { - throw ServiceExceptionUtil.exception(errorCode, params); + throw new ServiceException(errorCode, params); } } public static void notEmpty(Object object, ErrorCode errorCode) { if (object == null) { - throw exception(errorCode); + throw new ServiceException(errorCode); } } public static void notEmpty(List array ,Object object, ErrorCode errorCode) { if (object == null || ObjectUtils.isEmpty(array)) { - throw exception(errorCode); + throw new ServiceException(errorCode); } } public static void notEmpty(List array, ErrorCode errorCode,Object object) { if (ObjectUtils.isEmpty(array)) { - throw exception(errorCode,object); + throw new ServiceException(errorCode,object); } } public static void notEmpty(String str, ErrorCode errorCode) { if (StringUtils.isEmpty(str)) { - throw exception(errorCode); + throw new ServiceException(errorCode); } } public static void notEquals(Object obj1, Object obj2, ErrorCode errorCode) { if (ObjectUtil.notEqual(obj1, obj2)) { - throw exception(errorCode); + throw new ServiceException(errorCode); } } public static void equals(Object obj1, Object obj2, ErrorCode errorCode) { if (ObjectUtil.equal(obj1, obj2)) { - throw exception(errorCode); + throw new ServiceException(errorCode); } } public static void isFalse(boolean expression, ErrorCode errorCode) { if (!expression) { - throw exception(errorCode); + throw new ServiceException(errorCode); } } public static void isTrue(boolean expression, ErrorCode errorCode) { if (expression) { - throw exception(errorCode); + throw new ServiceException(errorCode); } } } diff --git a/cf-framework/cf-common/src/main/java/com/cf/imes/framework/common/util/i18n/core/util/I18nUtils.java b/cf-framework/cf-common/src/main/java/com/cf/imes/framework/common/util/i18n/core/util/I18nUtils.java index cebdf833a..394f5fdc0 100644 --- a/cf-framework/cf-common/src/main/java/com/cf/imes/framework/common/util/i18n/core/util/I18nUtils.java +++ b/cf-framework/cf-common/src/main/java/com/cf/imes/framework/common/util/i18n/core/util/I18nUtils.java @@ -27,6 +27,6 @@ public class I18nUtils { * @return */ public String getMessage(String code, Object... args) { - return messageSource.getMessage(code, args, LocaleContextHolder.getLocale()); + return messageSource.getMessage(code, args, code, LocaleContextHolder.getLocale()); } } diff --git a/cf-framework/cf-spring-boot-starter-biz-ip/src/main/java/com/cf/imes/framework/ip/core/service/imp/IPQueryServiceImpl.java b/cf-framework/cf-spring-boot-starter-biz-ip/src/main/java/com/cf/imes/framework/ip/core/service/imp/IPQueryServiceImpl.java index b5c027ec7..6ce3a5bb1 100644 --- a/cf-framework/cf-spring-boot-starter-biz-ip/src/main/java/com/cf/imes/framework/ip/core/service/imp/IPQueryServiceImpl.java +++ b/cf-framework/cf-spring-boot-starter-biz-ip/src/main/java/com/cf/imes/framework/ip/core/service/imp/IPQueryServiceImpl.java @@ -8,7 +8,6 @@ import cn.hutool.http.HttpStatus; import com.alibaba.fastjson.JSON; import com.cf.imes.framework.common.exception.ErrorCode; import com.cf.imes.framework.common.exception.ServiceException; -import com.cf.imes.framework.common.exception.util.ServiceExceptionUtil; import com.cf.imes.framework.ip.core.enums.ErrorCodeConstants; import com.cf.imes.framework.ip.core.property.IPQueryProperties; import com.cf.imes.framework.ip.core.service.IPQueryService; @@ -46,11 +45,11 @@ public class IPQueryServiceImpl implements IPQueryService { String appCode = ipQueryProperties.getAppCode(); if (CharSequenceUtil.isEmpty(apiUrl)) { log.error("[IPQueryService][querySource]request apiUrl为空"); - throw ServiceExceptionUtil.exception(queryError); + throw new ServiceException(queryError); } if (CharSequenceUtil.isEmpty(appCode)) { log.error("[IPQueryService][querySource]request appCode为空"); - throw ServiceExceptionUtil.exception(queryError); + throw new ServiceException(queryError); } log.info("[IPQueryService][querySource]request url:{}", apiUrl); log.info("[IPQueryService][querySource]request param, appCode: {}, ip: {}", appCode, ip); @@ -63,7 +62,7 @@ public class IPQueryServiceImpl implements IPQueryService { data.setIp(ip); return data; } else { - ServiceException serviceException = ServiceExceptionUtil.exception(queryError); + ServiceException serviceException = new ServiceException(queryError); log.error(serviceException.getMessage() + ",状态【{}】,异常:{}", ipQueryRespDTO.getRet(), respBody); return null; } diff --git a/cf-framework/cf-spring-boot-starter-biz-organ/src/main/java/com/cf/imes/framework/organ/config/ChenfengOrganAutoConfiguration.java b/cf-framework/cf-spring-boot-starter-biz-organ/src/main/java/com/cf/imes/framework/organ/config/ChenfengOrganAutoConfiguration.java index b4f179726..e8f0f2804 100644 --- a/cf-framework/cf-spring-boot-starter-biz-organ/src/main/java/com/cf/imes/framework/organ/config/ChenfengOrganAutoConfiguration.java +++ b/cf-framework/cf-spring-boot-starter-biz-organ/src/main/java/com/cf/imes/framework/organ/config/ChenfengOrganAutoConfiguration.java @@ -83,11 +83,10 @@ public class ChenfengOrganAutoConfiguration { public FilterRegistrationBean organSecurityWebFilter(OrganProperties tenantProperties, WebProperties webProperties, GlobalExceptionHandler globalExceptionHandler, - OrganFrameworkService organFrameworkService, - I18nUtils i18nUtils) { + OrganFrameworkService organFrameworkService) { FilterRegistrationBean registrationBean = new FilterRegistrationBean<>(); registrationBean.setFilter(new OrganSecurityWebFilter(tenantProperties, webProperties, - globalExceptionHandler, organFrameworkService, i18nUtils)); + globalExceptionHandler, organFrameworkService)); registrationBean.setOrder(WebFilterOrderEnum.TENANT_SECURITY_FILTER); return registrationBean; } diff --git a/cf-framework/cf-spring-boot-starter-biz-organ/src/main/java/com/cf/imes/framework/organ/core/security/OrganSecurityWebFilter.java b/cf-framework/cf-spring-boot-starter-biz-organ/src/main/java/com/cf/imes/framework/organ/core/security/OrganSecurityWebFilter.java index c9d058160..333e66ce5 100644 --- a/cf-framework/cf-spring-boot-starter-biz-organ/src/main/java/com/cf/imes/framework/organ/core/security/OrganSecurityWebFilter.java +++ b/cf-framework/cf-spring-boot-starter-biz-organ/src/main/java/com/cf/imes/framework/organ/core/security/OrganSecurityWebFilter.java @@ -6,8 +6,8 @@ import com.cf.imes.framework.common.enums.UserTypeEnum; import com.cf.imes.framework.common.exception.ServiceException; import com.cf.imes.framework.common.exception.enums.GlobalErrorCodeConstants; import com.cf.imes.framework.common.pojo.CommonResult; -import com.cf.imes.framework.common.util.servlet.ServletUtils; import com.cf.imes.framework.common.util.i18n.core.util.I18nUtils; +import com.cf.imes.framework.common.util.servlet.ServletUtils; import com.cf.imes.framework.security.core.LoginUser; import com.cf.imes.framework.security.core.util.SecurityFrameworkUtils; import com.cf.imes.framework.organ.config.OrganProperties; @@ -18,6 +18,7 @@ import com.cf.imes.framework.web.core.filter.ApiRequestFilter; import com.cf.imes.framework.web.core.handler.GlobalExceptionHandler; import com.cf.imes.framework.web.core.util.WebFrameworkUtils; import com.cf.imes.module.system.enums.ErrorCodeConstants; +import jakarta.annotation.Resource; import lombok.extern.slf4j.Slf4j; import org.springframework.util.AntPathMatcher; @@ -52,19 +53,18 @@ public class OrganSecurityWebFilter extends ApiRequestFilter { private final GlobalExceptionHandler globalExceptionHandler; private final OrganFrameworkService organFrameworkService; - private final I18nUtils i18nUtils; + @Resource + private I18nUtils i18nUtils; public OrganSecurityWebFilter(OrganProperties organProperties, WebProperties webProperties, GlobalExceptionHandler globalExceptionHandler, - OrganFrameworkService organFrameworkService, - I18nUtils i18nUtils) { + OrganFrameworkService organFrameworkService) { super(webProperties); this.organProperties = organProperties; this.pathMatcher = new AntPathMatcher(); this.globalExceptionHandler = globalExceptionHandler; this.organFrameworkService = organFrameworkService; - this.i18nUtils = i18nUtils; } @Override diff --git a/cf-framework/cf-spring-boot-starter-biz-pay/src/test/java/com/cf/imes/framework/pay/core/client/impl/alipay/AbstractAlipayClientTest.java b/cf-framework/cf-spring-boot-starter-biz-pay/src/test/java/com/cf/imes/framework/pay/core/client/impl/alipay/AbstractAlipayClientTest.java index 38ae561ce..60a87f6c5 100644 --- a/cf-framework/cf-spring-boot-starter-biz-pay/src/test/java/com/cf/imes/framework/pay/core/client/impl/alipay/AbstractAlipayClientTest.java +++ b/cf-framework/cf-spring-boot-starter-biz-pay/src/test/java/com/cf/imes/framework/pay/core/client/impl/alipay/AbstractAlipayClientTest.java @@ -4,7 +4,6 @@ import cn.hutool.core.date.LocalDateTimeUtil; import cn.hutool.core.util.RandomUtil; import com.cf.imes.framework.common.exception.ServiceException; import com.cf.imes.framework.common.exception.enums.GlobalErrorCodeConstants; -import com.cf.imes.framework.common.exception.util.ServiceExceptionUtil; import com.cf.imes.framework.pay.core.client.dto.order.PayOrderUnifiedReqDTO; import com.cf.imes.framework.pay.core.client.dto.refund.PayRefundRespDTO; import com.cf.imes.framework.pay.core.client.dto.refund.PayRefundUnifiedReqDTO; @@ -171,7 +170,7 @@ public abstract class AbstractAlipayClientTest extends BaseMockitoUnitTest { public void testUnifiedRefund_throwServiceException() throws AlipayApiException { // mock 方法 when(defaultAlipayClient.execute(argThat((ArgumentMatcher) request -> true))) - .thenThrow(ServiceExceptionUtil.exception(GlobalErrorCodeConstants.INTERNAL_SERVER_ERROR)); + .thenThrow(new ServiceException(GlobalErrorCodeConstants.INTERNAL_SERVER_ERROR)); // 准备请求参数 String notifyUrl = randomURL(); PayRefundUnifiedReqDTO refundReqDTO = randomPojo(PayRefundUnifiedReqDTO.class, o -> o.setNotifyUrl(notifyUrl)); diff --git a/cf-framework/cf-spring-boot-starter-biz-pay/src/test/java/com/cf/imes/framework/pay/core/client/impl/alipay/AlipayQrPayClientTest.java b/cf-framework/cf-spring-boot-starter-biz-pay/src/test/java/com/cf/imes/framework/pay/core/client/impl/alipay/AlipayQrPayClientTest.java index 8168a008a..ce128b32c 100644 --- a/cf-framework/cf-spring-boot-starter-biz-pay/src/test/java/com/cf/imes/framework/pay/core/client/impl/alipay/AlipayQrPayClientTest.java +++ b/cf-framework/cf-spring-boot-starter-biz-pay/src/test/java/com/cf/imes/framework/pay/core/client/impl/alipay/AlipayQrPayClientTest.java @@ -2,7 +2,6 @@ package com.cf.imes.framework.pay.core.client.impl.alipay; import com.cf.imes.framework.common.exception.ServiceException; import com.cf.imes.framework.common.exception.enums.GlobalErrorCodeConstants; -import com.cf.imes.framework.common.exception.util.ServiceExceptionUtil; import com.cf.imes.framework.pay.core.client.dto.order.PayOrderRespDTO; import com.cf.imes.framework.pay.core.client.dto.order.PayOrderUnifiedReqDTO; import com.cf.imes.framework.common.exception.PayException; @@ -135,7 +134,7 @@ public class AlipayQrPayClientTest extends AbstractAlipayClientTest { when(defaultAlipayClient.execute(argThat((ArgumentMatcher) request -> { assertEquals(notifyUrl, request.getNotifyUrl()); return true; - }))).thenThrow(ServiceExceptionUtil.exception(GlobalErrorCodeConstants.INTERNAL_SERVER_ERROR)); + }))).thenThrow(new ServiceException(GlobalErrorCodeConstants.INTERNAL_SERVER_ERROR)); // 准备请求参数 PayOrderUnifiedReqDTO reqDTO = buildOrderUnifiedReqDTO(notifyUrl, outTradeNo, price); diff --git a/cf-framework/cf-spring-boot-starter-security/src/main/java/com/cf/imes/framework/security/core/aop/PreAuthenticatedAspect.java b/cf-framework/cf-spring-boot-starter-security/src/main/java/com/cf/imes/framework/security/core/aop/PreAuthenticatedAspect.java index 0ac12b777..124b8b1ba 100644 --- a/cf-framework/cf-spring-boot-starter-security/src/main/java/com/cf/imes/framework/security/core/aop/PreAuthenticatedAspect.java +++ b/cf-framework/cf-spring-boot-starter-security/src/main/java/com/cf/imes/framework/security/core/aop/PreAuthenticatedAspect.java @@ -1,5 +1,6 @@ package com.cf.imes.framework.security.core.aop; +import com.cf.imes.framework.common.exception.ServiceException; import com.cf.imes.framework.security.core.annotations.PreAuthenticated; import com.cf.imes.framework.security.core.util.SecurityFrameworkUtils; import lombok.extern.slf4j.Slf4j; @@ -8,7 +9,6 @@ import org.aspectj.lang.annotation.Around; import org.aspectj.lang.annotation.Aspect; import static com.cf.imes.framework.common.exception.enums.GlobalErrorCodeConstants.UNAUTHORIZED; -import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception; @Aspect @Slf4j @@ -17,7 +17,7 @@ public class PreAuthenticatedAspect { @Around("@annotation(preAuthenticated)") public Object around(ProceedingJoinPoint joinPoint, PreAuthenticated preAuthenticated) throws Throwable { if (SecurityFrameworkUtils.getLoginUser() == null) { - throw exception(UNAUTHORIZED); + throw new ServiceException(UNAUTHORIZED); } return joinPoint.proceed(); } diff --git a/cf-framework/cf-spring-boot-starter-security/src/main/java/com/cf/imes/framework/security/core/handler/AuthenticationEntryPointImpl.java b/cf-framework/cf-spring-boot-starter-security/src/main/java/com/cf/imes/framework/security/core/handler/AuthenticationEntryPointImpl.java index 6f607d217..2fdf80986 100644 --- a/cf-framework/cf-spring-boot-starter-security/src/main/java/com/cf/imes/framework/security/core/handler/AuthenticationEntryPointImpl.java +++ b/cf-framework/cf-spring-boot-starter-security/src/main/java/com/cf/imes/framework/security/core/handler/AuthenticationEntryPointImpl.java @@ -2,7 +2,9 @@ package com.cf.imes.framework.security.core.handler; import com.cf.imes.framework.common.exception.enums.GlobalErrorCodeConstants; import com.cf.imes.framework.common.pojo.CommonResult; +import com.cf.imes.framework.common.util.i18n.core.util.I18nUtils; import com.cf.imes.framework.common.util.servlet.ServletUtils; +import jakarta.annotation.Resource; import lombok.extern.slf4j.Slf4j; import org.springframework.security.core.AuthenticationException; import org.springframework.security.web.AuthenticationEntryPoint; @@ -25,11 +27,13 @@ import static com.cf.imes.framework.common.exception.enums.GlobalErrorCodeConsta @SuppressWarnings("JavadocReference") // 忽略文档引用报错 public class AuthenticationEntryPointImpl implements AuthenticationEntryPoint { + @Resource + private I18nUtils i18nUtils; @Override public void commence(HttpServletRequest request, HttpServletResponse response, AuthenticationException e) { log.debug("[commence][访问 URL({}) 时,没有登录]", request.getRequestURI(), e); // 返回 401 - ServletUtils.writeJSON(response, CommonResult.error(UNAUTHORIZED)); + ServletUtils.writeJSON(response, CommonResult.error(UNAUTHORIZED.getCode(), i18nUtils.getMessage(UNAUTHORIZED.getMsg()))); } } diff --git a/cf-framework/cf-spring-boot-starter-web/src/main/java/com/cf/imes/framework/web/config/ChenfengWebAutoConfiguration.java b/cf-framework/cf-spring-boot-starter-web/src/main/java/com/cf/imes/framework/web/config/ChenfengWebAutoConfiguration.java index 82bc4d74d..5f3c1507c 100644 --- a/cf-framework/cf-spring-boot-starter-web/src/main/java/com/cf/imes/framework/web/config/ChenfengWebAutoConfiguration.java +++ b/cf-framework/cf-spring-boot-starter-web/src/main/java/com/cf/imes/framework/web/config/ChenfengWebAutoConfiguration.java @@ -66,7 +66,7 @@ public class ChenfengWebAutoConfiguration implements WebMvcConfigurer { } @Bean - public GlobalExceptionHandler globalExceptionHandler(ApiErrorLogApi apiErrorLogApi, I18nUtils i18nUtils) { + public GlobalExceptionHandler globalExceptionHandler(ApiErrorLogApi apiErrorLogApi) { return new GlobalExceptionHandler(applicationName, apiErrorLogApi); } diff --git a/cf-framework/cf-spring-boot-starter-web/src/main/java/com/cf/imes/framework/web/core/handler/GlobalExceptionHandler.java b/cf-framework/cf-spring-boot-starter-web/src/main/java/com/cf/imes/framework/web/core/handler/GlobalExceptionHandler.java index 588dc1a7a..9d0ac3a36 100644 --- a/cf-framework/cf-spring-boot-starter-web/src/main/java/com/cf/imes/framework/web/core/handler/GlobalExceptionHandler.java +++ b/cf-framework/cf-spring-boot-starter-web/src/main/java/com/cf/imes/framework/web/core/handler/GlobalExceptionHandler.java @@ -235,7 +235,7 @@ public class GlobalExceptionHandler { } else { log.error(String.format("==========[serviceExceptionHandler]==========,%s:%s", ex.getCode(), ex.getMessage())); } - return CommonResult.error(ex.getCode(), ex.getMessage()); + return CommonResult.error(ex.getCode(), ex.getMessage(), ex.getArgs()); } /** diff --git a/cf-module-infra/cf-module-infra-biz/src/main/java/com/cf/imes/module/infra/controller/admin/config/ConfigController.java b/cf-module-infra/cf-module-infra-biz/src/main/java/com/cf/imes/module/infra/controller/admin/config/ConfigController.java index c624e7fd6..73e39f461 100644 --- a/cf-module-infra/cf-module-infra-biz/src/main/java/com/cf/imes/module/infra/controller/admin/config/ConfigController.java +++ b/cf-module-infra/cf-module-infra-biz/src/main/java/com/cf/imes/module/infra/controller/admin/config/ConfigController.java @@ -1,5 +1,6 @@ package com.cf.imes.module.infra.controller.admin.config; +import com.cf.imes.framework.common.exception.ServiceException; import com.cf.imes.framework.common.pojo.CommonResult; import com.cf.imes.framework.common.pojo.PageParam; import com.cf.imes.framework.common.pojo.PageResult; @@ -25,7 +26,7 @@ import jakarta.validation.Valid; import java.io.IOException; import java.util.List; -import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception; + import static com.cf.imes.framework.common.pojo.CommonResult.success; import static com.cf.imes.framework.operatelog.core.enums.OperateTypeEnum.EXPORT; @@ -79,7 +80,7 @@ public class ConfigController { return success(null); } if (!config.getVisible()) { - throw exception(ErrorCodeConstants.CONFIG_GET_VALUE_ERROR_IF_VISIBLE); + throw new ServiceException(ErrorCodeConstants.CONFIG_GET_VALUE_ERROR_IF_VISIBLE); } return success(config.getValue()); } diff --git a/cf-module-infra/cf-module-infra-biz/src/main/java/com/cf/imes/module/infra/service/codegen/CodegenServiceImpl.java b/cf-module-infra/cf-module-infra-biz/src/main/java/com/cf/imes/module/infra/service/codegen/CodegenServiceImpl.java index 3810e0677..53e60e532 100644 --- a/cf-module-infra/cf-module-infra-biz/src/main/java/com/cf/imes/module/infra/service/codegen/CodegenServiceImpl.java +++ b/cf-module-infra/cf-module-infra-biz/src/main/java/com/cf/imes/module/infra/service/codegen/CodegenServiceImpl.java @@ -2,6 +2,7 @@ package com.cf.imes.module.infra.service.codegen; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.text.CharSequenceUtil; +import com.cf.imes.framework.common.exception.ServiceException; import com.cf.imes.framework.common.pojo.PageResult; import com.cf.imes.framework.common.util.object.BeanUtils; import com.cf.imes.module.infra.controller.admin.codegen.vo.CodegenCreateListReqVO; @@ -30,7 +31,7 @@ import java.util.*; import java.util.function.BiPredicate; import java.util.stream.Collectors; -import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception; + import static com.cf.imes.framework.common.util.collection.CollectionUtils.convertMap; import static com.cf.imes.framework.common.util.collection.CollectionUtils.convertSet; import static com.cf.imes.module.infra.enums.ErrorCodeConstants.*; @@ -84,7 +85,7 @@ public class CodegenServiceImpl implements CodegenService { // 校验是否已经存在 if (codegenTableMapper.selectByTableNameAndDataSourceConfigId(tableInfo.getName(), dataSourceConfigId) != null) { - throw exception(CODEGEN_TABLE_EXISTS); + throw new ServiceException(CODEGEN_TABLE_EXISTS); } // 构建 CodegenTableDO 对象,插入到 DB 中 @@ -108,17 +109,17 @@ public class CodegenServiceImpl implements CodegenService { @VisibleForTesting void validateTableInfo(TableInfo tableInfo) { if (tableInfo == null) { - throw exception(CODEGEN_IMPORT_TABLE_NULL); + throw new ServiceException(CODEGEN_IMPORT_TABLE_NULL); } if (CharSequenceUtil.isEmpty(tableInfo.getComment())) { - throw exception(CODEGEN_TABLE_INFO_TABLE_COMMENT_IS_NULL); + throw new ServiceException(CODEGEN_TABLE_INFO_TABLE_COMMENT_IS_NULL); } if (CollUtil.isEmpty(tableInfo.getFields())) { - throw exception(CODEGEN_IMPORT_COLUMNS_NULL); + throw new ServiceException(CODEGEN_IMPORT_COLUMNS_NULL); } tableInfo.getFields().forEach(field -> { if (CharSequenceUtil.isEmpty(field.getComment())) { - throw exception(CODEGEN_TABLE_INFO_COLUMN_COMMENT_IS_NULL, field.getName()); + throw new ServiceException(CODEGEN_TABLE_INFO_COLUMN_COMMENT_IS_NULL, field.getName()); } }); } @@ -128,16 +129,16 @@ public class CodegenServiceImpl implements CodegenService { public void updateCodegen(CodegenUpdateReqVO updateReqVO) { // 校验是否已经存在 if (codegenTableMapper.selectById(updateReqVO.getTable().getId()) == null) { - throw exception(CODEGEN_TABLE_NOT_EXISTS); + throw new ServiceException(CODEGEN_TABLE_NOT_EXISTS); } // 校验主表字段存在 if (Objects.equals(updateReqVO.getTable().getTemplateType(), CodegenTemplateTypeEnum.SUB.getType())) { if (codegenTableMapper.selectById(updateReqVO.getTable().getMasterTableId()) == null) { - throw exception(CODEGEN_MASTER_TABLE_NOT_EXISTS, updateReqVO.getTable().getMasterTableId()); + throw new ServiceException(CODEGEN_MASTER_TABLE_NOT_EXISTS, updateReqVO.getTable().getMasterTableId()); } if (CollUtil.findOne(updateReqVO.getColumns(), // 关联主表的字段不存在 column -> column.getId().equals(updateReqVO.getTable().getSubJoinColumnId())) == null) { - throw exception(CODEGEN_SUB_COLUMN_NOT_EXISTS, updateReqVO.getTable().getSubJoinColumnId()); + throw new ServiceException(CODEGEN_SUB_COLUMN_NOT_EXISTS, updateReqVO.getTable().getSubJoinColumnId()); } } @@ -155,7 +156,7 @@ public class CodegenServiceImpl implements CodegenService { // 校验是否已经存在 CodegenTableDO table = codegenTableMapper.selectById(tableId); if (table == null) { - throw exception(CODEGEN_TABLE_NOT_EXISTS); + throw new ServiceException(CODEGEN_TABLE_NOT_EXISTS); } // 从数据库中,获得数据库表结构 TableInfo tableInfo = databaseTableService.getTable(table.getDataSourceConfigId(), table.getTableName()); @@ -192,7 +193,7 @@ public class CodegenServiceImpl implements CodegenService { // 移除已经存在的字段 tableFields.removeIf(column -> codegenColumnNames.contains(column.getColumnName()) && (!modifyFieldNames.contains(column.getColumnName()))); if (CollUtil.isEmpty(tableFields) && CollUtil.isEmpty(deleteColumnIds)) { - throw exception(CODEGEN_SYNC_NONE_CHANGE); + throw new ServiceException(CODEGEN_SYNC_NONE_CHANGE); } // 4.1 插入新增的字段 @@ -209,7 +210,7 @@ public class CodegenServiceImpl implements CodegenService { public void deleteCodegen(Long tableId) { // 校验是否已经存在 if (codegenTableMapper.selectById(tableId) == null) { - throw exception(CODEGEN_TABLE_NOT_EXISTS); + throw new ServiceException(CODEGEN_TABLE_NOT_EXISTS); } // 删除 table 表定义 @@ -243,11 +244,11 @@ public class CodegenServiceImpl implements CodegenService { // 校验是否已经存在 CodegenTableDO table = codegenTableMapper.selectById(tableId); if (table == null) { - throw exception(CODEGEN_TABLE_NOT_EXISTS); + throw new ServiceException(CODEGEN_TABLE_NOT_EXISTS); } List columns = codegenColumnMapper.selectListByTableId(tableId); if (CollUtil.isEmpty(columns)) { - throw exception(CODEGEN_COLUMN_NOT_EXISTS); + throw new ServiceException(CODEGEN_COLUMN_NOT_EXISTS); } // 如果是主子表,则加载对应的子表信息 @@ -258,14 +259,14 @@ public class CodegenServiceImpl implements CodegenService { subTables = codegenTableMapper.selectListByTemplateTypeAndMasterTableId( CodegenTemplateTypeEnum.SUB.getType(), tableId); if (CollUtil.isEmpty(subTables)) { - throw exception(CODEGEN_MASTER_GENERATION_FAIL_NO_SUB_TABLE); + throw new ServiceException(CODEGEN_MASTER_GENERATION_FAIL_NO_SUB_TABLE); } // 校验子表的关联字段存在 subColumnsList = new ArrayList<>(); for (CodegenTableDO subTable : subTables) { List subColumns = codegenColumnMapper.selectListByTableId(subTable.getId()); if (CollUtil.findOne(subColumns, column -> column.getId().equals(subTable.getSubJoinColumnId())) == null) { - throw exception(CODEGEN_SUB_COLUMN_NOT_EXISTS, subTable.getId()); + throw new ServiceException(CODEGEN_SUB_COLUMN_NOT_EXISTS, subTable.getId()); } subColumnsList.add(subColumns); } diff --git a/cf-module-infra/cf-module-infra-biz/src/main/java/com/cf/imes/module/infra/service/config/ConfigServiceImpl.java b/cf-module-infra/cf-module-infra-biz/src/main/java/com/cf/imes/module/infra/service/config/ConfigServiceImpl.java index 69f793eb2..f259dbee9 100644 --- a/cf-module-infra/cf-module-infra-biz/src/main/java/com/cf/imes/module/infra/service/config/ConfigServiceImpl.java +++ b/cf-module-infra/cf-module-infra-biz/src/main/java/com/cf/imes/module/infra/service/config/ConfigServiceImpl.java @@ -1,5 +1,6 @@ package com.cf.imes.module.infra.service.config; +import com.cf.imes.framework.common.exception.ServiceException; import com.cf.imes.framework.common.pojo.PageResult; import com.cf.imes.module.infra.controller.admin.config.vo.ConfigPageReqVO; import com.cf.imes.module.infra.controller.admin.config.vo.ConfigSaveReqVO; @@ -14,7 +15,7 @@ import org.springframework.validation.annotation.Validated; import jakarta.annotation.Resource; -import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception; + import static com.cf.imes.module.infra.enums.ErrorCodeConstants.*; /** @@ -58,7 +59,7 @@ public class ConfigServiceImpl implements ConfigService { ConfigDO config = validateConfigExists(id); // 内置配置,不允许删除 if (ConfigTypeEnum.SYSTEM.getType().equals(config.getType())) { - throw exception(CONFIG_CAN_NOT_DELETE_SYSTEM_TYPE); + throw new ServiceException(CONFIG_CAN_NOT_DELETE_SYSTEM_TYPE); } // 删除 configMapper.deleteById(id); @@ -86,7 +87,7 @@ public class ConfigServiceImpl implements ConfigService { } ConfigDO config = configMapper.selectById(id); if (config == null) { - throw exception(CONFIG_NOT_EXISTS); + throw new ServiceException(CONFIG_NOT_EXISTS); } return config; } @@ -99,10 +100,10 @@ public class ConfigServiceImpl implements ConfigService { } // 如果 id 为空,说明不用比较是否为相同 id 的参数配置 if (id == null) { - throw exception(CONFIG_KEY_DUPLICATE); + throw new ServiceException(CONFIG_KEY_DUPLICATE); } if (!config.getId().equals(id)) { - throw exception(CONFIG_KEY_DUPLICATE); + throw new ServiceException(CONFIG_KEY_DUPLICATE); } } diff --git a/cf-module-infra/cf-module-infra-biz/src/main/java/com/cf/imes/module/infra/service/db/DataSourceConfigServiceImpl.java b/cf-module-infra/cf-module-infra-biz/src/main/java/com/cf/imes/module/infra/service/db/DataSourceConfigServiceImpl.java index 5ff50aa18..21a142b17 100644 --- a/cf-module-infra/cf-module-infra-biz/src/main/java/com/cf/imes/module/infra/service/db/DataSourceConfigServiceImpl.java +++ b/cf-module-infra/cf-module-infra-biz/src/main/java/com/cf/imes/module/infra/service/db/DataSourceConfigServiceImpl.java @@ -1,6 +1,6 @@ package com.cf.imes.module.infra.service.db; -import com.cf.imes.framework.common.exception.util.ServiceExceptionUtil; +import com.cf.imes.framework.common.exception.ServiceException; import com.cf.imes.framework.common.util.object.BeanUtils; import com.cf.imes.framework.mybatis.core.util.JdbcUtils; import com.cf.imes.module.infra.controller.admin.db.vo.DataSourceConfigSaveReqVO; @@ -16,7 +16,7 @@ import jakarta.annotation.Resource; import java.util.List; import java.util.Objects; -import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception; + /** * 数据源配置 Service 实现类 @@ -65,7 +65,7 @@ public class DataSourceConfigServiceImpl implements DataSourceConfigService { private void validateDataSourceConfigExists(Long id) { if (dataSourceConfigMapper.selectById(id) == null) { - throw ServiceExceptionUtil.exception(ErrorCodeConstants.DATA_SOURCE_CONFIG_NOT_EXISTS); + throw new ServiceException(ErrorCodeConstants.DATA_SOURCE_CONFIG_NOT_EXISTS); } } @@ -90,7 +90,7 @@ public class DataSourceConfigServiceImpl implements DataSourceConfigService { private void validateConnectionOK(DataSourceConfigDO config) { boolean success = JdbcUtils.isConnectionOK(config.getUrl(), config.getUsername(), config.getPassword()); if (!success) { - throw ServiceExceptionUtil.exception(ErrorCodeConstants.DATA_SOURCE_CONFIG_NOT_OK); + throw new ServiceException(ErrorCodeConstants.DATA_SOURCE_CONFIG_NOT_OK); } } diff --git a/cf-module-infra/cf-module-infra-biz/src/main/java/com/cf/imes/module/infra/service/file/FileConfigServiceImpl.java b/cf-module-infra/cf-module-infra-biz/src/main/java/com/cf/imes/module/infra/service/file/FileConfigServiceImpl.java index c7045bef3..2e130989c 100644 --- a/cf-module-infra/cf-module-infra-biz/src/main/java/com/cf/imes/module/infra/service/file/FileConfigServiceImpl.java +++ b/cf-module-infra/cf-module-infra-biz/src/main/java/com/cf/imes/module/infra/service/file/FileConfigServiceImpl.java @@ -2,6 +2,7 @@ package com.cf.imes.module.infra.service.file; import cn.hutool.core.io.resource.ResourceUtil; import cn.hutool.core.util.IdUtil; +import com.cf.imes.framework.common.exception.ServiceException; import com.cf.imes.framework.common.pojo.PageResult; import com.cf.imes.framework.common.util.json.JsonUtils; import com.cf.imes.framework.common.util.validation.ValidationUtils; @@ -28,7 +29,7 @@ import java.time.Duration; import java.util.Map; import java.util.Objects; -import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception; + import static com.cf.imes.framework.common.util.cache.CacheUtils.buildAsyncReloadingCache; import static com.cf.imes.module.infra.enums.ErrorCodeConstants.FILE_CONFIG_DELETE_FAIL_MASTER; import static com.cf.imes.module.infra.enums.ErrorCodeConstants.FILE_CONFIG_NOT_EXISTS; @@ -125,7 +126,7 @@ public class FileConfigServiceImpl implements FileConfigService { // 校验存在 FileConfigDO config = validateFileConfigExists(id); if (Boolean.TRUE.equals(config.getMaster())) { - throw exception(FILE_CONFIG_DELETE_FAIL_MASTER); + throw new ServiceException(FILE_CONFIG_DELETE_FAIL_MASTER); } // 删除 fileConfigMapper.deleteById(id); @@ -152,7 +153,7 @@ public class FileConfigServiceImpl implements FileConfigService { private FileConfigDO validateFileConfigExists(Long id) { FileConfigDO config = fileConfigMapper.selectById(id); if (config == null) { - throw exception(FILE_CONFIG_NOT_EXISTS); + throw new ServiceException(FILE_CONFIG_NOT_EXISTS); } return config; } diff --git a/cf-module-infra/cf-module-infra-biz/src/main/java/com/cf/imes/module/infra/service/file/FileServiceImpl.java b/cf-module-infra/cf-module-infra-biz/src/main/java/com/cf/imes/module/infra/service/file/FileServiceImpl.java index 2cf23365b..05f3a4068 100644 --- a/cf-module-infra/cf-module-infra-biz/src/main/java/com/cf/imes/module/infra/service/file/FileServiceImpl.java +++ b/cf-module-infra/cf-module-infra-biz/src/main/java/com/cf/imes/module/infra/service/file/FileServiceImpl.java @@ -2,6 +2,7 @@ package com.cf.imes.module.infra.service.file; import cn.hutool.core.lang.Assert; import cn.hutool.core.text.CharSequenceUtil; +import com.cf.imes.framework.common.exception.ServiceException; import com.cf.imes.framework.common.pojo.PageResult; import com.cf.imes.framework.common.util.Assert.AssertUtils; import com.cf.imes.framework.common.util.io.FileUtils; @@ -18,7 +19,7 @@ import jakarta.annotation.Resource; import java.util.Objects; -import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception; + import static com.cf.imes.module.infra.enums.ErrorCodeConstants.FILE_NOT_EXISTS; import static com.cf.imes.module.infra.enums.ErrorCodeConstants.FILE_REMOVE_FAIL; @@ -120,7 +121,7 @@ public class FileServiceImpl implements FileService { private FileDO validateFileExists(Long id) { FileDO fileDO = fileMapper.selectById(id); if (fileDO == null) { - throw exception(FILE_NOT_EXISTS); + throw new ServiceException(FILE_NOT_EXISTS); } return fileDO; } @@ -149,7 +150,7 @@ public class FileServiceImpl implements FileService { // 校验存在 FileDO fileDO = fileMapper.selectOne(new LambdaQueryWrapperX().eq(FileDO::getPath, path)); if(Objects.isNull(fileDO)) { - throw exception(FILE_NOT_EXISTS); + throw new ServiceException(FILE_NOT_EXISTS); } // 从文件存储器中删除 FileClient client = fileConfigService.getFileClient(fileDO.getConfigId()); @@ -157,7 +158,7 @@ public class FileServiceImpl implements FileService { try { client.delete(path); } catch (Exception e) { - throw exception(FILE_REMOVE_FAIL); + throw new ServiceException(FILE_REMOVE_FAIL); } // 删除记录 diff --git a/cf-module-infra/cf-module-infra-biz/src/main/java/com/cf/imes/module/infra/service/logger/ApiErrorLogServiceImpl.java b/cf-module-infra/cf-module-infra-biz/src/main/java/com/cf/imes/module/infra/service/logger/ApiErrorLogServiceImpl.java index 38b007ba5..7f38784eb 100644 --- a/cf-module-infra/cf-module-infra-biz/src/main/java/com/cf/imes/module/infra/service/logger/ApiErrorLogServiceImpl.java +++ b/cf-module-infra/cf-module-infra-biz/src/main/java/com/cf/imes/module/infra/service/logger/ApiErrorLogServiceImpl.java @@ -1,6 +1,7 @@ package com.cf.imes.module.infra.service.logger; import cn.hutool.core.text.CharSequenceUtil; +import com.cf.imes.framework.common.exception.ServiceException; import com.cf.imes.framework.common.pojo.PageResult; import com.cf.imes.framework.common.util.object.BeanUtils; import com.cf.imes.framework.organ.core.context.OrganContextHolder; @@ -17,7 +18,6 @@ import org.springframework.validation.annotation.Validated; import jakarta.annotation.Resource; import java.time.LocalDateTime; -import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception; import static com.cf.imes.module.infra.dal.dataobject.logger.ApiErrorLogDO.REQUEST_PARAMS_MAX_LENGTH; import static com.cf.imes.module.infra.enums.ErrorCodeConstants.API_ERROR_LOG_NOT_FOUND; import static com.cf.imes.module.infra.enums.ErrorCodeConstants.API_ERROR_LOG_PROCESSED; @@ -57,10 +57,10 @@ public class ApiErrorLogServiceImpl implements ApiErrorLogService { public void updateApiErrorLogProcess(Long id, Integer processStatus, Long processUserId) { ApiErrorLogDO errorLog = apiErrorLogMapper.selectById(id); if (errorLog == null) { - throw exception(API_ERROR_LOG_NOT_FOUND); + throw new ServiceException(API_ERROR_LOG_NOT_FOUND); } if (!ApiErrorLogProcessStatusEnum.INIT.getStatus().equals(errorLog.getProcessStatus())) { - throw exception(API_ERROR_LOG_PROCESSED); + throw new ServiceException(API_ERROR_LOG_PROCESSED); } // 标记处理 apiErrorLogMapper.updateById(ApiErrorLogDO.builder().id(id).processStatus(processStatus) diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/order/OrderController.java b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/order/OrderController.java index 7e5292696..32a58bc1c 100644 --- a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/order/OrderController.java +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/order/OrderController.java @@ -54,7 +54,6 @@ import java.util.*; import java.util.concurrent.CompletionException; import java.util.concurrent.ExecutionException; -import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception; import static com.cf.imes.framework.common.pojo.CommonResult.error; import static com.cf.imes.framework.common.pojo.CommonResult.success; import static com.cf.imes.framework.operatelog.core.enums.OperateTypeEnum.EXPORT; @@ -175,7 +174,7 @@ public class OrderController { public CommonResult deleteOrder(@RequestParam("orderId") Long orderId) { Integer index = orderService.updateOrderDel(orderId, OrderDeletedEnum.DELETED.getStatus()); if (index == 0) { - throw exception(ORDER_DELETED_ERR); + throw new ServiceException(ORDER_DELETED_ERR); } return success(true); } @@ -188,7 +187,7 @@ public class OrderController { Long orderId = jsonObject.getLong("orderId"); Integer index = orderService.updateOrderDel(orderId, OrderDeletedEnum.NOT_DELETED.getStatus()); if (index == 0) { - throw exception(ORDER_RESTORE_ERR); + throw new ServiceException(ORDER_RESTORE_ERR); } return success(true); } diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/customplatenorule/BodyNoGenerateRuleServiceImpl.java b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/customplatenorule/BodyNoGenerateRuleServiceImpl.java index 13d5fb5ba..bab521e9a 100644 --- a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/customplatenorule/BodyNoGenerateRuleServiceImpl.java +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/customplatenorule/BodyNoGenerateRuleServiceImpl.java @@ -5,7 +5,7 @@ import cn.hutool.core.util.ObjectUtil; import com.alibaba.fastjson.JSON; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; -import com.cf.imes.framework.common.exception.util.ServiceExceptionUtil; +import com.cf.imes.framework.common.exception.ServiceException; import com.cf.imes.framework.common.util.json.JsonUtils; import com.cf.imes.framework.organ.core.context.OrganContextHolder; import com.cf.imes.module.executor.api.customplateno.dto.CustomPlateNoRuleDTO; @@ -80,7 +80,7 @@ public class BodyNoGenerateRuleServiceImpl implements CustomPlateNoGenerateRuleS } else if (ObjectUtil.equal(ResetModeEnum.ROOM, resetModeEnum)) { generateConfig = generateNoByRoomResetMode(plateNoRule, generateConfig, plateDO); } else { - throw ServiceExceptionUtil.exception(CUSTOM_PLATENO_GENERATE_BODY_RULE_NOT_SUPPORT_RESETMODE, plateNoRule.getResetMode()); + throw new ServiceException(CUSTOM_PLATENO_GENERATE_BODY_RULE_NOT_SUPPORT_RESETMODE, plateNoRule.getResetMode()); } return generateConfig; } diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/customplatenorule/OrderNoGenerateRuleServiceImpl.java b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/customplatenorule/OrderNoGenerateRuleServiceImpl.java index 9a7426998..db3d07861 100644 --- a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/customplatenorule/OrderNoGenerateRuleServiceImpl.java +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/customplatenorule/OrderNoGenerateRuleServiceImpl.java @@ -4,7 +4,7 @@ import cn.hutool.core.util.ObjectUtil; import com.alibaba.fastjson.JSON; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; -import com.cf.imes.framework.common.exception.util.ServiceExceptionUtil; +import com.cf.imes.framework.common.exception.ServiceException; import com.cf.imes.framework.common.util.json.JsonUtils; import com.cf.imes.framework.organ.core.context.OrganContextHolder; import com.cf.imes.module.executor.api.customplateno.dto.CustomPlateNoRuleDTO; @@ -131,7 +131,7 @@ public class OrderNoGenerateRuleServiceImpl implements CustomPlateNoGenerateRule } else if (ObjectUtil.equal(ResetModeEnum.DAY, resetModeEnum)) { orderNoSeq = resetByDay(orderNoSeq, orgCustomPlateNoSeqRespDTO, plateNoRule); } else { - throw ServiceExceptionUtil.exception(CUSTOM_PLATENO_GENERATE_ORDERNO_RULE_NOT_SUPPORT_RESETMODE, plateNoRule.getResetMode()); + throw new ServiceException(CUSTOM_PLATENO_GENERATE_ORDERNO_RULE_NOT_SUPPORT_RESETMODE, plateNoRule.getResetMode()); } return orderNoSeq; } diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/customplatenorule/PlateNoGenerateRuleServiceImpl.java b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/customplatenorule/PlateNoGenerateRuleServiceImpl.java index 83a226efb..a5900aecf 100644 --- a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/customplatenorule/PlateNoGenerateRuleServiceImpl.java +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/customplatenorule/PlateNoGenerateRuleServiceImpl.java @@ -5,7 +5,7 @@ import cn.hutool.core.util.ObjectUtil; import com.alibaba.fastjson.JSON; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; -import com.cf.imes.framework.common.exception.util.ServiceExceptionUtil; +import com.cf.imes.framework.common.exception.ServiceException; import com.cf.imes.framework.common.util.json.JsonUtils; import com.cf.imes.framework.organ.core.context.OrganContextHolder; import com.cf.imes.module.executor.api.customplateno.dto.CustomPlateNoRuleDTO; @@ -82,7 +82,7 @@ public class PlateNoGenerateRuleServiceImpl implements CustomPlateNoGenerateRule } else if (ObjectUtil.equal(ResetModeEnum.YEAR, resetModeEnum) || ObjectUtil.equal(ResetModeEnum.MONTH, resetModeEnum) || ObjectUtil.equal(ResetModeEnum.DAY, resetModeEnum)) { return generateNoByDateResetMode(resetModeEnum, plateNoRule, generateConfig, plateDO); } else { - throw ServiceExceptionUtil.exception(CUSTOM_PLATENO_GENERATE_PLATE_RULE_NOT_SUPPORT_RESETMODE, plateNoRule.getResetMode()); + throw new ServiceException(CUSTOM_PLATENO_GENERATE_PLATE_RULE_NOT_SUPPORT_RESETMODE, plateNoRule.getResetMode()); } } diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/customplatenorule/ProcessGroupNoGenerateRuleServiceImpl.java b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/customplatenorule/ProcessGroupNoGenerateRuleServiceImpl.java index b118ac92f..519a99965 100644 --- a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/customplatenorule/ProcessGroupNoGenerateRuleServiceImpl.java +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/customplatenorule/ProcessGroupNoGenerateRuleServiceImpl.java @@ -2,7 +2,6 @@ // //import cn.hutool.core.collection.CollUtil; //import cn.hutool.core.util.ObjectUtil; -//import com.cf.imes.framework.common.exception.util.ServiceExceptionUtil; //import com.cf.imes.module.executor.dal.dataobject.plate.PlateDO; //import com.cf.imes.module.executor.service.customplateno.vo.CustomPlateNoGenerateConfigVO; //import com.cf.imes.module.executor.service.customplateno.vo.CustomPlateNoRuleDTO; @@ -47,7 +46,7 @@ // } else if (ObjectUtil.equal(ResetModeEnum.ROOM, resetModeEnum)) { // generateConfig = generateNoByRoomResetMode(plateNoRule, generateConfig, plateDOList); // } else { -// throw ServiceExceptionUtil.exception(CUSTOM_PLATENO_GENERATE_PROCESSGROUP_RULE_NOT_SUPPORT_RESETMODE, plateNoRule.getResetMode()); +// throw new ServiceException(CUSTOM_PLATENO_GENERATE_PROCESSGROUP_RULE_NOT_SUPPORT_RESETMODE, plateNoRule.getResetMode()); // } // return generateConfig; // } diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/goods/GoodsServiceImpl.java b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/goods/GoodsServiceImpl.java index 0c2041908..c5a299e80 100644 --- a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/goods/GoodsServiceImpl.java +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/goods/GoodsServiceImpl.java @@ -1,5 +1,6 @@ package com.cf.imes.module.executor.service.goods; +import com.cf.imes.framework.common.exception.ServiceException; import com.cf.imes.module.executor.dal.dataobject.managePlate.ManagePlateDO; import com.cf.imes.module.executor.dal.dataobject.order.OrderDO; import com.cf.imes.module.executor.dal.mysql.managePlate.ManagePlateMapper; @@ -21,7 +22,7 @@ import com.cf.imes.framework.common.util.object.BeanUtils; import com.cf.imes.module.executor.dal.mysql.goods.GoodsMapper; -import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception; + import static com.cf.imes.module.executor.enums.ErrorCodeConstants.*; /** @@ -54,16 +55,16 @@ public class GoodsServiceImpl implements GoodsService { List longs = new ArrayList<>(); // 校验生产单是否存在 if (orderMapper.selectOne(OrderDO::getId, createReqVOS.get(0).getOrderId()) == null) { - throw exception(GOODS_NOT_EXISTS); + throw new ServiceException(GOODS_NOT_EXISTS); } createReqVOS.forEach(createReqVO -> { // 校验商品是否存在 if (plateMapper.selectOne(ManagePlateDO::getId, createReqVO.getGoodsId()) == null) { - throw exception(PLATE_NOT_EXISTS); + throw new ServiceException(PLATE_NOT_EXISTS); } // 校验 if (rawGoodsService.getRawGoods(createReqVO.getRawGoodsId()) == null) { - throw exception(RAW_GOODS_NOT_USED_IN_ORDER); + throw new ServiceException(RAW_GOODS_NOT_USED_IN_ORDER); } }); // 一次性插入数据库 @@ -93,7 +94,7 @@ public class GoodsServiceImpl implements GoodsService { private void validateGoodsExists(Long id) { if (goodsMapper.selectById(id) == null) { - throw exception(GOODS_NOT_EXISTS); + throw new ServiceException(GOODS_NOT_EXISTS); } } diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/manage/pack/PackServiceImpl.java b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/manage/pack/PackServiceImpl.java index cbb17b95d..40ded83ba 100644 --- a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/manage/pack/PackServiceImpl.java +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/manage/pack/PackServiceImpl.java @@ -5,6 +5,7 @@ import cn.hutool.core.collection.CollUtil; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.PageDTO; import com.cf.imes.framework.common.enums.*; +import com.cf.imes.framework.common.exception.ServiceException; import com.cf.imes.framework.common.pojo.PageResult; import com.cf.imes.framework.common.util.Assert.AssertUtils; import com.cf.imes.framework.common.util.json.JsonUtils; @@ -49,7 +50,6 @@ import java.util.Date; import java.util.List; import java.util.Objects; -import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception; import static com.cf.imes.framework.common.util.string.SearchUtil.insertSeparator; import static com.cf.imes.framework.security.core.util.SecurityFrameworkUtils.getUserOrganId; import static com.cf.imes.module.executor.enums.ErrorCodeConstants.NO_PRODUCTION_ORDER_INFORMATION_AVAILABLE; @@ -325,7 +325,7 @@ public class PackServiceImpl implements PackService { if(reqVO.getAddPartsIdList().isEmpty() && reqVO.getAddPlateIdList().isEmpty() && reqVO.getDeletePartsIdList().isEmpty()){ - throw exception(PART_PACK_DATA_ERROR); + throw new ServiceException(PART_PACK_DATA_ERROR); } @@ -447,7 +447,7 @@ public class PackServiceImpl implements PackService { if(packageVO.getAddPlateIdList().isEmpty() && packageVO.getAddPartsIdList().isEmpty() && packageVO.getDeletePlateIdList().isEmpty()){ - throw exception(PART_PACK_DATA_ERROR); + throw new ServiceException(PART_PACK_DATA_ERROR); } @@ -676,7 +676,7 @@ public class PackServiceImpl implements PackService { OrderPackageDO orderPackageDO = orderPackageMapper.selectByPackNo(reqVO.getPackNo(), getUserOrganId()); if (orderPackageDO.getType() != OrderPackageTypeEnum.OTHER_ACCESSORIES.getType().longValue()) { - throw exception(THE_CURRENT_PACKAGE_TYPE_IS_INCORRECT); + throw new ServiceException(THE_CURRENT_PACKAGE_TYPE_IS_INCORRECT); } @@ -749,7 +749,7 @@ public class PackServiceImpl implements PackService { if (setting == null) { - throw exception(CURRENTLY_NO_CONFIGURATION_AVAILABLE, UserSettingTypeEnum.PREPACKAGED.getName()); + throw new ServiceException(CURRENTLY_NO_CONFIGURATION_AVAILABLE, UserSettingTypeEnum.PREPACKAGED.getName()); } JsonNode settingParse = JsonUtils.parseTree(JsonUtils.unzipString(setting)); @@ -929,7 +929,7 @@ public class PackServiceImpl implements PackService { ordersMapper.selectOrderIdsFalse(order.getCreateTime().toString(), getUserOrganId(), order.getId()); if (packRespVOList.isEmpty()) { - throw exception(NO_PRODUCTION_ORDER_INFORMATION_AVAILABLE, Boolean.TRUE.equals(isUp) ? "第" : "最后"); + throw new ServiceException(NO_PRODUCTION_ORDER_INFORMATION_AVAILABLE, Boolean.TRUE.equals(isUp) ? "第" : "最后"); } packRespVOS.setRecords(packRespVOList); diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/manage/parts/PartsServiceImpl.java b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/manage/parts/PartsServiceImpl.java index edf7d5c34..813aa37c4 100644 --- a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/manage/parts/PartsServiceImpl.java +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/manage/parts/PartsServiceImpl.java @@ -13,9 +13,7 @@ import com.cf.imes.module.executor.controller.admin.manage.parts.vo.PartsCadPage import com.cf.imes.module.executor.controller.admin.manage.parts.vo.PartsImportExcelVO; import com.cf.imes.module.executor.controller.admin.manage.parts.vo.PartsPageReqVO; import com.cf.imes.module.executor.controller.admin.manage.parts.vo.PartsSaveReqVO; -import com.cf.imes.module.executor.controller.admin.manage.plate.vo.plate.PlateImportExcelVO; import com.cf.imes.module.executor.dal.dataobject.orderParts.PartsDO; -import com.cf.imes.module.executor.dal.dataobject.plate.PlateGoodDO; import com.cf.imes.module.executor.dal.mysql.orderParts.PartsBatchMapper; import com.cf.imes.module.executor.dal.mysql.orderParts.PartsMapper; import com.cf.imes.module.executor.enums.manage.parts.CategoryEnum; @@ -44,7 +42,6 @@ import java.util.function.Consumer; import java.util.stream.Collectors; -import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception; import static com.cf.imes.framework.security.core.util.SecurityFrameworkUtils.getLoginUser; import static com.cf.imes.module.executor.enums.ErrorCodeConstants.*; import static com.cf.imes.module.executor.framework.executor.config.ExecutorThreadPoolConfiguration.EXECUTOR_IMPOT_THREAD_POOL_TASK_EXECUTOR; @@ -97,7 +94,7 @@ public class PartsServiceImpl implements PartsService { partsDO.setOrganId(organId).setIsComposite(createReqVO.getIsComposite() != null && createReqVO.getIsComposite()); // 判断是否存在--- goodsId if (validateExistsByGoodsId(partsDO.getGoodsId(), organId)) { - throw exception(PARTS_GOOD_ID_EXISTS); + throw new ServiceException(PARTS_GOOD_ID_EXISTS); } partsMapper.insert(partsDO); @@ -117,12 +114,12 @@ public class PartsServiceImpl implements PartsService { boolean index = validateExistsById(updateReqVO.getId(), organId); if (!index) { - throw exception(PARTS_NOT_EXISTS); + throw new ServiceException(PARTS_NOT_EXISTS); } // 校验goodsId是否存在 if (!validateExistsExceptGoodsId(updateReqVO.getId(), updateReqVO.getGoodsId(), organId)) { - throw exception(PARTS_GOOD_ID_EXISTS); + throw new ServiceException(PARTS_GOOD_ID_EXISTS); } // 更新 updateReqVO.setOrganId(organId).setIsComposite(updateReqVO.getIsComposite() != null && updateReqVO.getIsComposite()); @@ -157,7 +154,7 @@ public class PartsServiceImpl implements PartsService { public void delete(Long id, Long organId) { // 校验存在 if (!validateExistsById(id, getOrganId(BASE_PARTS_DELETE_PERMISSION, getLoginUser().getId(), organId))) { - throw exception(PARTS_NOT_EXISTS); + throw new ServiceException(PARTS_NOT_EXISTS); } // 删除 @@ -429,7 +426,7 @@ public class PartsServiceImpl implements PartsService { private void validateOrganExists(Long organId) { CommonResult index = organApi.validOrgan(organId); if (!index.isSuccess()) { - throw exception(ErrorCodeConstants.ORGAN_NOT_EXISTS); + throw new ServiceException(ErrorCodeConstants.ORGAN_NOT_EXISTS); } } @@ -454,11 +451,11 @@ public class PartsServiceImpl implements PartsService { private void validateFieldExists(PartsSaveReqVO partsSaveReqVO) { if (!CategoryEnum.OTHER.getValue().equals(partsSaveReqVO.getCategory())) { // 不为其他 if (partsSaveReqVO.getUnit() == null || partsSaveReqVO.getUnit().isEmpty()) { - throw exception(PARTS_UNIT_NOT_NULL); + throw new ServiceException(PARTS_UNIT_NOT_NULL); } if (CategoryEnum.EDGING.getValue().equals(partsSaveReqVO.getCategory())) { // 为封边 if (partsSaveReqVO.getColor() == null || partsSaveReqVO.getWidth() == null || partsSaveReqVO.getThickness() == null) { - throw exception(PARTS_EDGE_NOT_NULL); + throw new ServiceException(PARTS_EDGE_NOT_NULL); } } } diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/manage/plate/PlateManageServiceImpl.java b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/manage/plate/PlateManageServiceImpl.java index a8a65d65d..451e35a47 100644 --- a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/manage/plate/PlateManageServiceImpl.java +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/manage/plate/PlateManageServiceImpl.java @@ -41,7 +41,6 @@ import java.util.concurrent.atomic.AtomicBoolean; import java.util.function.Consumer; import java.util.stream.Collectors; -import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception; import static com.cf.imes.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId; import static com.cf.imes.module.executor.enums.ErrorCodeConstants.PLATE_ATTR_GROUP_EXISTS; import static com.cf.imes.module.executor.enums.ErrorCodeConstants.PLATE_EXISTS; @@ -110,14 +109,14 @@ public class PlateManageServiceImpl implements PlateManageService { // 校验存在 Long organId = getOrganId(BASE_PLATE_UPDATE_PERMISSION, getLoginUserId(), updateReqVO.getOrganId()); if (updateReqVO.getId() == null) { - throw exception(PLATE_ID_NULL_ERROR); + throw new ServiceException(PLATE_ID_NULL_ERROR); } validatePlateExists(updateReqVO.getId(), organId); PlateGoodDO updateObj = BeanUtils.toBean(updateReqVO, PlateGoodDO.class); // 校验板材goods_id是否相同 if (plateGoodMapper.isByGoodIDAndId(updateReqVO.getGoodsId(), organId, Long.valueOf(updateReqVO.getId()))) { - throw exception(PLATE_GOODS_ID_NOT_SAME); + throw new ServiceException(PLATE_GOODS_ID_NOT_SAME); } // 校验板材名称、材质、颜色、厚度、品牌在组织内唯一 @@ -140,7 +139,7 @@ public class PlateManageServiceImpl implements PlateManageService { .eqIfPresent(PlateGoodDO::getBrand, plate.getBrand()) .neIfPresent(PlateGoodDO::getId, plate.getId())); if (count > 0) { - throw exception(PLATE_ATTR_GROUP_EXISTS); + throw new ServiceException(PLATE_ATTR_GROUP_EXISTS); } } @@ -157,7 +156,7 @@ public class PlateManageServiceImpl implements PlateManageService { private void validatePlateExists(Long id, Long organId) { if (plateGoodMapper.selectOneById(id, organId) == null) { - throw exception(REMAIN_PLATE_NOT_EXISTS); + throw new ServiceException(REMAIN_PLATE_NOT_EXISTS); } } @@ -407,14 +406,14 @@ public class PlateManageServiceImpl implements PlateManageService { private void validateOrganExists(Long organId) { CommonResult index = organApi.validOrgan(organId); if (!index.isSuccess()) { - throw exception(ErrorCodeConstants.ORGAN_NOT_EXISTS); + throw new ServiceException(ErrorCodeConstants.ORGAN_NOT_EXISTS); } } // 当前组织中板材是否存在 private void validateGoodExists(String goodsId, Long organId) { if (plateGoodMapper.selectByGoodID(goodsId, organId, false) != null) { - throw exception(PLATE_EXISTS); + throw new ServiceException(PLATE_EXISTS); } } diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/manage/remainplaten/RemainPlateManageServiceImpl.java b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/manage/remainplaten/RemainPlateManageServiceImpl.java index f48e35a63..36b4504ae 100644 --- a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/manage/remainplaten/RemainPlateManageServiceImpl.java +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/manage/remainplaten/RemainPlateManageServiceImpl.java @@ -1,6 +1,7 @@ package com.cf.imes.module.executor.service.manage.remainplaten; import com.cf.imes.framework.common.enums.DeletedCodeEnum; +import com.cf.imes.framework.common.exception.ServiceException; import com.cf.imes.framework.common.pojo.PageResult; import com.cf.imes.framework.common.util.object.BeanUtils; import com.cf.imes.framework.organ.core.context.OrganContextHolder; @@ -20,7 +21,6 @@ import java.util.Collection; import java.util.List; import java.util.Set; -import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception; import static com.cf.imes.module.executor.enums.ErrorCodeConstants.REMAIN_PLATE_NOT_EXISTS; import static com.cf.imes.module.system.enums.ErrorCodeConstants.REMAIN_PLATE_COUNT_MAX; import static com.cf.imes.module.system.enums.ErrorCodeConstants.REMAIN_PLATE_ID_NOT_EXISTS; @@ -46,7 +46,7 @@ public class RemainPlateManageServiceImpl implements RemainPlateManageService { List remainPlates = new ArrayList<>(); // 限制新增数量不能超过999 if (createReqVO.getCount() > MAX_NUM) { - throw exception(REMAIN_PLATE_COUNT_MAX); + throw new ServiceException(REMAIN_PLATE_COUNT_MAX); } // 插入 if (createReqVO.getCount() >= 1) { @@ -101,14 +101,14 @@ public class RemainPlateManageServiceImpl implements RemainPlateManageService { @Transactional(rollbackFor = Exception.class) public void revertRemainPlateStatus(Set ids, Integer status) { if (ids == null) { - throw exception(REMAIN_PLATE_ID_NOT_EXISTS); + throw new ServiceException(REMAIN_PLATE_ID_NOT_EXISTS); } // 判断余料的状态是否存在使用中 validateRemainPlateStatus(ids, RemainPlateStatusEnum.UNUSED.getStatus()); // 判断使用类型是否为核销 for (Long id : ids) { if (!validateRemainPlateUseType(id).equals(RemainPlateUseTypeEnum.TYPE_ONE.getStatus())) { - throw exception(REMAIN_PLATE_USR_TYPE); + throw new ServiceException(REMAIN_PLATE_USR_TYPE); } } remainPlateMapper.updateRemainPlateStatus(ids, status, null, OrganContextHolder.getOrganId(), 0L); @@ -120,7 +120,7 @@ public class RemainPlateManageServiceImpl implements RemainPlateManageService { validateRemainPlateExists(updateReqVO.getId()); // 是否使用 if (validateRemainPlateStatus(updateReqVO.getId()) == RemainPlateStatusEnum.USED.getStatus()) { - throw exception(REMAIN_PLATE_STATUS_USED); + throw new ServiceException(REMAIN_PLATE_STATUS_USED); } // 判断是否为开料添加 RemainPlateDO updateObj = validateRemainPlateIsCutting(updateReqVO.getId()); @@ -136,7 +136,7 @@ public class RemainPlateManageServiceImpl implements RemainPlateManageService { @Transactional(rollbackFor = Exception.class) public void deleteRemainPlate(Set ids) { if (ids == null) { - throw exception(REMAIN_PLATE_ID_NOT_EXISTS); + throw new ServiceException(REMAIN_PLATE_ID_NOT_EXISTS); } // 余料存在判断 validateRemainPlateExists(ids); @@ -151,21 +151,21 @@ public class RemainPlateManageServiceImpl implements RemainPlateManageService { for (Long id : ids) { if (validateRemainPlateStatus(id) == status) { if (status == RemainPlateStatusEnum.USED.getStatus()) - throw exception(REMAIN_PLATE_STATUS_USED); + throw new ServiceException(REMAIN_PLATE_STATUS_USED); if (status == RemainPlateStatusEnum.UNUSED.getStatus()) - throw exception(REMAIN_PLATE_STATUS_NO_USED); + throw new ServiceException(REMAIN_PLATE_STATUS_NO_USED); } } } private void validateRemainPlateExists(Long id) { if (remainPlateMapper.selectById(id) == null) { - throw exception(REMAIN_PLATE_NOT_EXISTS); + throw new ServiceException(REMAIN_PLATE_NOT_EXISTS); } } private void validateRemainPlateExists(Set id) { if (remainPlateMapper.selectBatchIds(id).isEmpty()) { - throw exception(REMAIN_PLATE_NOT_EXISTS); + throw new ServiceException(REMAIN_PLATE_NOT_EXISTS); } } private RemainPlateDO validateRemainPlateIsCutting(Long id) { diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/module/ModuleServiceImpl.java b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/module/ModuleServiceImpl.java index 2e7b5c7d3..8359fbeff 100644 --- a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/module/ModuleServiceImpl.java +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/module/ModuleServiceImpl.java @@ -1,20 +1,18 @@ package com.cf.imes.module.executor.service.module; +import com.cf.imes.framework.common.exception.ServiceException; import org.springframework.stereotype.Service; import jakarta.annotation.Resource; import org.springframework.validation.annotation.Validated; -import org.springframework.transaction.annotation.Transactional; import java.util.*; import com.cf.imes.module.executor.controller.admin.module.vo.*; import com.cf.imes.module.executor.dal.dataobject.module.ModuleDO; import com.cf.imes.framework.common.pojo.PageResult; -import com.cf.imes.framework.common.pojo.PageParam; import com.cf.imes.framework.common.util.object.BeanUtils; import com.cf.imes.module.executor.dal.mysql.module.ModuleMapper; -import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception; import static com.cf.imes.module.executor.enums.ErrorCodeConstants.*; /** @@ -57,7 +55,7 @@ public class ModuleServiceImpl implements ModuleService { private void validateModuleExists(Long id) { if (moduleMapper.selectById(id) == null) { - throw exception(MODULE_NOT_EXISTS); + throw new ServiceException(MODULE_NOT_EXISTS); } } diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/optimizeplan/OptimizePlanServiceImpl.java b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/optimizeplan/OptimizePlanServiceImpl.java index d1bfa9789..46d6ae924 100644 --- a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/optimizeplan/OptimizePlanServiceImpl.java +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/optimizeplan/OptimizePlanServiceImpl.java @@ -30,7 +30,6 @@ import com.cf.imes.framework.common.enums.OrderStatusEnum; import com.cf.imes.framework.common.enums.PlanStatusEnum; import com.cf.imes.framework.common.enums.PlanTypeEnum; import com.cf.imes.framework.common.exception.ServiceException; -import com.cf.imes.framework.common.exception.util.ServiceExceptionUtil; import com.cf.imes.framework.common.pojo.PageResult; import com.cf.imes.framework.common.util.Assert.AssertUtils; import com.cf.imes.framework.common.util.object.BeanUtils; @@ -89,12 +88,10 @@ import java.util.stream.Collectors; import static com.cf.imes.framework.common.exception.enums.GlobalErrorCodeConstants.DATA_DATA_ERROR; import static com.cf.imes.framework.common.exception.enums.GlobalErrorCodeConstants.ES_DATA_ERROR; -import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception; import static com.cf.imes.framework.common.util.json.JsonUtils.*; import static com.cf.imes.framework.security.core.util.SecurityFrameworkUtils.getUserOrganId; import static com.cf.imes.module.executor.enums.ErrorCodeConstants.*; import static com.cf.imes.module.executor.enums.EsIndexEnum.*; -import static com.cf.imes.module.system.enums.ErrorCodeConstants.*; /** * @author there @@ -180,7 +177,7 @@ public class OptimizePlanServiceImpl implements OptimizePlanService { public Boolean addRemain(AddRemainReqVO vo) { PlanDO planDO = planMapper.selectById(vo.getPlanId()); if (Objects.isNull(planDO)) { - throw exception(PLAN_NOT_EXISTS); + throw new ServiceException(PLAN_NOT_EXISTS); } RemainPlateDO remainPlateDO = RemainPlateDO.builder() .width(vo.getWidth()) @@ -246,7 +243,7 @@ public class OptimizePlanServiceImpl implements OptimizePlanService { }catch (Exception e){ log.error(e.getMessage()); - throw exception(PLAN_PLATE_OPTIMIZE_DATA_ERROR); + throw new ServiceException(PLAN_PLATE_OPTIMIZE_DATA_ERROR); } AssertUtils.notEmpty(remainBoardInfos,ORDER_PLAN_OPTIMIZE_ERROR); @@ -279,7 +276,7 @@ public class OptimizePlanServiceImpl implements OptimizePlanService { @Override public OrderSource getOrderSource(Long orderId, Long planId, Long machineId) { if (!Objects.isNull(orderId) && !Objects.isNull(planId)) { - throw exception(ORDER_PLAN_ID_IS_ONE); + throw new ServiceException(ORDER_PLAN_ID_IS_ONE); } OrderSource orderSource; if (ObjectUtil.isNotNull(orderId)) { @@ -292,7 +289,7 @@ public class OptimizePlanServiceImpl implements OptimizePlanService { return orderSource; } - throw exception(ErrorCodeConstants.SOURCE_NOT_EXITS_ERROR); + throw new ServiceException(ErrorCodeConstants.SOURCE_NOT_EXITS_ERROR); } @@ -483,7 +480,7 @@ public class OptimizePlanServiceImpl implements OptimizePlanService { AssertUtils.notEmpty(planDO,ORDER_PLAN_DATE_ERROR); if(planDO.getStatus().equals(PlanStatusEnum.OPENED.getStatus())){ - throw exception(THIS_PLAN_OPTIMIZE_DATA_ERROR); + throw new ServiceException(THIS_PLAN_OPTIMIZE_DATA_ERROR); } @@ -583,7 +580,7 @@ public class OptimizePlanServiceImpl implements OptimizePlanService { if(!planDO.getProcessId().equals(processId)){ if(planDO.getStatus().equals(PlanStatusEnum.OPENING.getStatus()) || planDO.getStatus().equals(PlanStatusEnum.OPENED.getStatus())){ - throw exception(THIS_PLAN_PLATE_IS_CUT); + throw new ServiceException(THIS_PLAN_PLATE_IS_CUT); } // 保存排单对应的加工方案组的配置信息 @@ -786,7 +783,7 @@ public class OptimizePlanServiceImpl implements OptimizePlanService { .eq(PlateDO::getPlanId, 0) .eq(PlateDO::getDeleted, false)); if (planCreatePlateThreshold < unplanPlateNum) { - throw ServiceExceptionUtil.exception(ORDER_PLAN_CREATE_PLATE_NUM_REACH_THRESHOLD_ERROR, planCreatePlateThreshold); + throw new ServiceException(ORDER_PLAN_CREATE_PLATE_NUM_REACH_THRESHOLD_ERROR, planCreatePlateThreshold); } List plateDetailRespVOS = plateMapper.selectNoPlanPlate(orderIds, orderGoodsIds, getUserOrganId()); @@ -1288,7 +1285,7 @@ public class OptimizePlanServiceImpl implements OptimizePlanService { Boolean isOptimized = optimizeBoardModelDO.getIsOptimized(); if(Boolean.FALSE.equals(isOptimized)){ - throw exception(ORDER_PLAN_NO_OPTIMIZE_UPDATE_ERROR); + throw new ServiceException(ORDER_PLAN_NO_OPTIMIZE_UPDATE_ERROR); } @@ -1312,7 +1309,7 @@ public class OptimizePlanServiceImpl implements OptimizePlanService { if (Boolean.FALSE.equals(isArray)) { - throw exception(ORDER_PLAN_OPTIMIZE_ERROR); + throw new ServiceException(ORDER_PLAN_OPTIMIZE_ERROR); } @@ -1701,7 +1698,7 @@ public class OptimizePlanServiceImpl implements OptimizePlanService { private void validatePlanStatus(PlanDO planDO,List isLocks){ if(planDO.getStatus().equals(PlanStatusEnum.OPENING.getStatus()) || planDO.getStatus().equals(PlanStatusEnum.OPENED.getStatus())){ - throw exception(THIS_PLAN_PLATE_IS_CUT); + throw new ServiceException(THIS_PLAN_PLATE_IS_CUT); } LoginUser loginUser = SecurityFrameworkUtils.getLoginUser(); @@ -1710,7 +1707,7 @@ public class OptimizePlanServiceImpl implements OptimizePlanService { Boolean data = permissionApi.hasAnyPermissions(loginUser.getId(), "placeorder:list").getCheckedData(); if(Boolean.TRUE.equals(planDO.getIsScheduled()) && isLocks.contains(true) && Boolean.FALSE.equals(data)){ - throw exception(THIS_PLAN_PROCESS_SCHEME_IS_LOCK); + throw new ServiceException(THIS_PLAN_PROCESS_SCHEME_IS_LOCK); } } diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/order/OrderServiceImpl.java b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/order/OrderServiceImpl.java index 6e690a5e0..a29370e5e 100644 --- a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/order/OrderServiceImpl.java +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/order/OrderServiceImpl.java @@ -12,7 +12,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.PageDTO; import com.cf.imes.framework.common.enums.DeletedCodeEnum; import com.cf.imes.framework.common.enums.OrderPackageStatusEnum; import com.cf.imes.framework.common.enums.OrderPackageTypeEnum; -import com.cf.imes.framework.common.exception.util.ServiceExceptionUtil; +import com.cf.imes.framework.common.exception.ServiceException; import com.cf.imes.framework.common.pojo.PageParam; import com.cf.imes.framework.common.pojo.PageResult; import com.cf.imes.framework.common.util.Assert.AssertUtils; @@ -96,7 +96,6 @@ import java.util.regex.Pattern; import java.util.stream.Collectors; import java.util.stream.Stream; -import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception; import static com.cf.imes.framework.security.core.util.SecurityFrameworkUtils.getUserOrganId; import static com.cf.imes.module.executor.enums.ErrorCodeConstants.*; import static com.cf.imes.module.executor.enums.EsIndexEnum.*; @@ -266,7 +265,7 @@ public class OrderServiceImpl implements OrderService { // 判断是否存在排单 if (planDO == null) { - throw exception(PLAN_NOT_EXISTS); + throw new ServiceException(PLAN_NOT_EXISTS); } List orderIds = JSON.parseArray(planDO.getOrderNos()).toJavaList(Long.class); @@ -463,7 +462,7 @@ public class OrderServiceImpl implements OrderService { if (order != null) { //判断是否已经导入 // if (!validateOrderNoExists(order.getApiOrderId(), OrganContextHolder.getOrganId())) { -// throw exception(ORDER_EXISTS); +// throw new ServiceException(ORDER_EXISTS); // } validateCustomOrderNoExists(order.getCustomOrderNo()); @@ -613,7 +612,7 @@ public class OrderServiceImpl implements OrderService { outputStream.write(buffer); outputStream.flush(); } catch (IOException ex) { - throw exception(FILE_NOT_EXISTS); + throw new ServiceException(FILE_NOT_EXISTS); } } @@ -623,7 +622,7 @@ public class OrderServiceImpl implements OrderService { // 查询生产单 OrderDO orderDO = orderMapper.selectOrderOne(orderId, OrganContextHolder.getOrganId()); if (orderDO == null) { - throw exception(ORDER_NOT_EXISTS); + throw new ServiceException(ORDER_NOT_EXISTS); } return getDataByOrderIdAndType(orderDO, type, OrderDeletedEnum.NOT_DELETED.getStatus()); // return getDataByOrderIdAndTypeDetail(orderDO, type, OrderDeletedEnum.NOT_DELETED.getStatus()); @@ -691,11 +690,11 @@ public class OrderServiceImpl implements OrderService { // 校验存在 OrderDO orderDO = orderMapper.selectOrderOne(orderId, getUserOrganId(), index); if (orderDO == null) - throw exception(ORDER_NOT_EXISTS); + throw new ServiceException(ORDER_NOT_EXISTS); // 状态排除 if (!Objects.equals(orderDO.getStatus(), OrderStatusEnum.EMPTY.getStatus()) && !Objects.equals(orderDO.getStatus(), OrderStatusEnum.NEW_ORDER.getStatus())) - throw exception(ORDER_NOT_CANCEL); + throw new ServiceException(ORDER_NOT_CANCEL); return orderMapper.updateOrderDeleted(orderId, deleted, getUserOrganId()); } @@ -727,7 +726,7 @@ public class OrderServiceImpl implements OrderService { private void validateOrderExists(Long id, Long organId, Integer deleted) { OrderDO orderDO = orderMapper.selectOrderOne(id, organId, deleted); if (orderDO == null) { - throw exception(ORDER_NOT_EXISTS); + throw new ServiceException(ORDER_NOT_EXISTS); } } @@ -744,7 +743,7 @@ public class OrderServiceImpl implements OrderService { // 判断手机号是否匹配正则表达式 if (!matcher.matches()) { - throw exception(PHONE_NOT_LAWFUL); + throw new ServiceException(PHONE_NOT_LAWFUL); } } @@ -757,7 +756,7 @@ public class OrderServiceImpl implements OrderService { .eq(OrderDO::getCustomOrderNo, customOrderNo) .eq(OrderDO::getDeleted, false) .eq(OrderDO::getOrganId, OrganContextHolder.getOrganId())) > 0) { - throw exception(CUSTOM_ORDER_EXISTS); + throw new ServiceException(CUSTOM_ORDER_EXISTS); } } } @@ -771,7 +770,7 @@ public class OrderServiceImpl implements OrderService { .eq(OrderDO::getCustomOrderNo, customOrderNo) .eq(OrderDO::getDeleted, false) .eq(OrderDO::getOrganId, OrganContextHolder.getOrganId())) > 0) { - throw exception(CUSTOM_ORDER_EXISTS); + throw new ServiceException(CUSTOM_ORDER_EXISTS); } } } @@ -794,7 +793,7 @@ public class OrderServiceImpl implements OrderService { .eqIfPresent(OrderBodyDO::getId, bodyId)); if (bodyCount == 0) { - throw exception(ORDER_BODY_NOT_EXISTS); + throw new ServiceException(ORDER_BODY_NOT_EXISTS); } bodyIds.add(bodyId); @@ -849,7 +848,7 @@ public class OrderServiceImpl implements OrderService { // } else if (plateGoodDOS != null && !plateGoodDOS.isEmpty()) { // 存在板材 // goodsDO.setGoodsId(plateGoodDOS.get(0).getGoodsId()); // } else { // 不存在板材 -//// throw exception(ORDER_MATCH_NOT); +//// throw new ServiceException(ORDER_MATCH_NOT); // long plateNo = idWorker.nextId(); // long obtainingTime = idWorker.obtainingTime(); // @@ -893,7 +892,7 @@ public class OrderServiceImpl implements OrderService { if (plateGoodDOs != null && !plateGoodDOs.isEmpty()) {//存在板材 goodsDO.setGoodsId(plateGoodDOs.get(0).getGoodsId()); } else { // 不存在板材 - throw exception(PLATE_ATTRIBUTE_NOT_EXIST, goodsDO.getGoodsId() == null ? "" : goodsDO.getGoodsId(), goodsDO.getGoodsName(), goodsDO.getMaterial(), goodsDO.getColor(), goodsDO.getThickness()); + throw new ServiceException(PLATE_ATTRIBUTE_NOT_EXIST, goodsDO.getGoodsId() == null ? "" : goodsDO.getGoodsId(), goodsDO.getGoodsName(), goodsDO.getMaterial(), goodsDO.getColor(), goodsDO.getThickness()); } @@ -1111,7 +1110,7 @@ public class OrderServiceImpl implements OrderService { map.put(plateCountKey, plateMapper.countPlateByOrderId(orderDO.getId(), OrganContextHolder.getOrganId(), deleted)); break; default: - throw exception(FILE_TYPE_ERR); + throw new ServiceException(FILE_TYPE_ERR); } return map; } @@ -1153,7 +1152,7 @@ public class OrderServiceImpl implements OrderService { map.put(plateCountKey, plateMapper.countPlateByOrderId(orderDO.getId(), OrganContextHolder.getOrganId(), deleted)); break; default: - throw exception(FILE_TYPE_ERR); + throw new ServiceException(FILE_TYPE_ERR); } return map; } @@ -1241,11 +1240,11 @@ public class OrderServiceImpl implements OrderService { // 校验存在 OrderDO orderDO = orderMapper.selectOrderOne(orderId, organId); if (orderDO == null) - throw exception(ORDER_NOT_EXISTS); + throw new ServiceException(ORDER_NOT_EXISTS); if (ObjectUtils.isEmpty(roomIds) && ObjectUtils.isEmpty(bodyId)) { - throw exception(ORDER_ERROR); + throw new ServiceException(ORDER_ERROR); } // 判断小板是否已开料,已开料不允许删除 @@ -1444,7 +1443,7 @@ public class OrderServiceImpl implements OrderService { // 如果是补板校验生产单存在 Long orderId = importAsyncReqVO.getOrderId(); if (ObjectUtil.isNotNull(orderId)) { - Optional.ofNullable(getOrder(orderId)).orElseThrow(() -> ServiceExceptionUtil.exception(ORDER_IMPORT_ORDER_NOT_EXISTS, orderId)); + Optional.ofNullable(getOrder(orderId)).orElseThrow(() -> new ServiceException(ORDER_IMPORT_ORDER_NOT_EXISTS, orderId)); } // 准备前置数据,准备完成发送消息消费解析临时表 orderImportHandler.prepareAndConvert(importAsyncReqVO, file); @@ -1458,11 +1457,11 @@ public class OrderServiceImpl implements OrderService { if (Objects.isNull(orderId) && Objects.isNull(planId)) { - throw exception(ORDER_PLAN_ID_NOT_NULL); + throw new ServiceException(ORDER_PLAN_ID_NOT_NULL); } if (!Objects.isNull(orderId) && !Objects.isNull(planId)) { - throw exception(ORDER_PLAN_ID_IS_ONE); + throw new ServiceException(ORDER_PLAN_ID_IS_ONE); } Long organId = getUserOrganId(); diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/orderImport/factory/OrderImportHandlerFactory.java b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/orderImport/factory/OrderImportHandlerFactory.java index 27b747725..54362f025 100644 --- a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/orderImport/factory/OrderImportHandlerFactory.java +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/orderImport/factory/OrderImportHandlerFactory.java @@ -1,7 +1,6 @@ package com.cf.imes.module.executor.service.orderImport.factory; import com.cf.imes.framework.common.exception.ServiceException; -import com.cf.imes.framework.common.exception.util.ServiceExceptionUtil; import com.cf.imes.module.executor.enums.ErrorCodeConstants; import com.cf.imes.module.executor.enums.OrderImportTypeEnum; import com.cf.imes.module.executor.service.orderImport.OrderImportHandler; @@ -45,7 +44,7 @@ public class OrderImportHandlerFactory { if (StringUtils.isEmpty(factoryName)) { factoryName = "default"; } - ServiceException typeNotSupportException = ServiceExceptionUtil.exception(ErrorCodeConstants.ORDER_IMPORT_TYPE_NOT_SUPPORT, type); + ServiceException typeNotSupportException = new ServiceException(ErrorCodeConstants.ORDER_IMPORT_TYPE_NOT_SUPPORT, type); switch (importTypeEnum) { case EXCEL: return Optional.ofNullable(getExcelHandler(factoryName)).orElseThrow(() -> typeNotSupportException); diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/orderImport/handler/xml/DefaultXmlOrderImportHandler.java b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/orderImport/handler/xml/DefaultXmlOrderImportHandler.java index 89f9bf484..477d657f8 100644 --- a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/orderImport/handler/xml/DefaultXmlOrderImportHandler.java +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/orderImport/handler/xml/DefaultXmlOrderImportHandler.java @@ -3,9 +3,6 @@ package com.cf.imes.module.executor.service.orderImport.handler.xml; import com.cf.imes.framework.common.exception.ServiceException; import com.cf.imes.framework.mq.rabbitmq.constant.RabbitMqConstants; import com.cf.imes.framework.mybatis.core.generator.SnowFlakeGenerator; -import com.cf.imes.framework.redis.config.ChenfengCacheProperties; -import com.cf.imes.framework.redis.constants.RedisKeyConstants; -import com.cf.imes.framework.redis.util.RedisLockUtil; import com.cf.imes.module.executor.controller.admin.order.vo.order.OrderImportAsyncReqVO; import com.cf.imes.module.executor.dal.dataobject.orderImport.OrderImportTaskDO; import com.cf.imes.module.executor.dal.mysql.orderImport.OrderImportTaskMapper; @@ -21,15 +18,14 @@ import org.springframework.amqp.core.Message; import org.springframework.amqp.core.MessageBuilder; import org.springframework.amqp.rabbit.core.RabbitTemplate; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.support.TransactionSynchronization; import org.springframework.transaction.support.TransactionSynchronizationManager; import org.springframework.web.multipart.MultipartFile; import jakarta.annotation.Resource; -import static com.cf.imes.framework.security.core.util.SecurityFrameworkUtils.getUserOrganId; import static com.cf.imes.module.executor.enums.ErrorCodeConstants.ORDER_IMPORT_FILE_ANALYZE_ERROR; -import static com.cf.imes.module.executor.enums.ErrorCodeConstants.ORDER_IMPORT_ORGAN_LOCK_ERROR; /** * @author Gqr @@ -53,12 +49,6 @@ public class DefaultXmlOrderImportHandler implements AbstractXmlOrderImportHandl @Resource private RabbitTemplate rabbitTemplate; - @Resource - private RedisLockUtil redisLockUtil; - - @Resource - private ChenfengCacheProperties chenfengCacheProperties; - @Resource private PlateGoodMapper plateGoodMapper; @@ -68,6 +58,7 @@ public class DefaultXmlOrderImportHandler implements AbstractXmlOrderImportHandl } @Override + @Transactional(rollbackFor = Exception.class) public void prepareAndConvert(OrderImportAsyncReqVO importAsyncReqVO, MultipartFile file) { // 创建任务 Long taskId = createImportTask(file.getOriginalFilename()); diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/orderParts/OrderPartsServiceImpl.java b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/orderParts/OrderPartsServiceImpl.java index 91bbfe211..4bc88fa12 100644 --- a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/orderParts/OrderPartsServiceImpl.java +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/orderParts/OrderPartsServiceImpl.java @@ -4,14 +4,10 @@ import cn.hutool.core.collection.CollUtil; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.PageDTO; import com.cf.imes.framework.common.exception.ServiceException; -import com.cf.imes.framework.common.exception.util.ServiceExceptionUtil; -import com.cf.imes.framework.datapermission.core.util.DataPermissionUtils; import com.cf.imes.framework.security.core.util.SecurityFrameworkUtils; -import com.cf.imes.module.executor.controller.admin.plate.vo.PlateRespVO; import com.cf.imes.module.executor.controller.admin.plate.vo.PlateTermsPageReqVO; import com.cf.imes.module.executor.enums.OrderDeletedEnum; import com.cf.imes.module.system.enums.ErrorCodeConstants; -import org.apache.poi.ss.formula.functions.T; import org.springframework.stereotype.Service; import jakarta.annotation.Resource; @@ -24,12 +20,10 @@ import java.util.*; import com.cf.imes.module.executor.controller.admin.orderParts.vo.*; import com.cf.imes.module.executor.dal.dataobject.orderParts.OrderPartsDO; import com.cf.imes.framework.common.pojo.PageResult; -import com.cf.imes.framework.common.pojo.PageParam; import com.cf.imes.framework.common.util.object.BeanUtils; import com.cf.imes.module.executor.dal.mysql.orderParts.OrderPartsMapper; -import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception; import static com.cf.imes.framework.security.core.util.SecurityFrameworkUtils.getUserOrganId; import static com.cf.imes.module.executor.enums.ErrorCodeConstants.*; @@ -73,7 +67,7 @@ public class OrderPartsServiceImpl implements OrderPartsService { private void validateOrderPartsExists(Long id) { if (orderPartsMapper.selectById(id) == null) { - throw exception(ORDER_PARTS_NOT_EXISTS); + throw new ServiceException(ORDER_PARTS_NOT_EXISTS); } } @@ -91,7 +85,7 @@ public class OrderPartsServiceImpl implements OrderPartsService { @Transactional(rollbackFor = Exception.class) // 添加事务,异常则回滚所有导入 public OrderPartsImportRespVO importOrderPartsList(List importOrderParts, Long orderId) { if (CollUtil.isEmpty(importOrderParts)) { - throw ServiceExceptionUtil.exception(ErrorCodeConstants.ORDER_PARTS_IMPORT_LIST_IS_EMPTY); + throw new ServiceException(ErrorCodeConstants.ORDER_PARTS_IMPORT_LIST_IS_EMPTY); } OrderPartsImportRespVO respVO = OrderPartsImportRespVO.builder().createOrderParts(new ArrayList()) .updateOrderParts(new ArrayList<>()).failureOrderParts(new LinkedHashMap<>()).build(); diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/plan/PlanServiceImpl.java b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/plan/PlanServiceImpl.java index 3f13a16f1..851847d06 100644 --- a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/plan/PlanServiceImpl.java +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/plan/PlanServiceImpl.java @@ -14,7 +14,6 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.PageDTO; import com.cf.imes.framework.common.enums.*; import com.cf.imes.framework.common.exception.ServiceException; -import com.cf.imes.framework.common.exception.util.ServiceExceptionUtil; import com.cf.imes.framework.common.pojo.PageResult; import com.cf.imes.framework.common.util.Assert.AssertUtils; import com.cf.imes.framework.common.util.object.BeanUtils; @@ -71,7 +70,6 @@ import java.util.stream.Collectors; import static com.cf.imes.framework.common.exception.enums.GlobalErrorCodeConstants.DATA_DATA_ERROR; import static com.cf.imes.framework.common.exception.enums.GlobalErrorCodeConstants.ES_DATA_ERROR; -import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception; import static com.cf.imes.framework.common.util.json.JsonUtils.parseArray; import static com.cf.imes.framework.common.util.json.JsonUtils.toJsonString; import static com.cf.imes.framework.common.util.string.SearchUtil.insertSeparator; @@ -199,7 +197,7 @@ public class PlanServiceImpl implements PlanService { }catch (Exception e){ log.error(e.getMessage()); - throw exception(SYSTEM_PROCESS_SCHEME_CONFIG_FIELD_ERROR); + throw new ServiceException(SYSTEM_PROCESS_SCHEME_CONFIG_FIELD_ERROR); } planDOS.forEach(f-> processSchemeModelDOS.forEach(p->{ @@ -226,7 +224,7 @@ public class PlanServiceImpl implements PlanService { if(updateReqVO.getProcessId() != null){ if(planDO.getStatus().equals(PlanStatusEnum.OPENING.getStatus()) || planDO.getStatus().equals(PlanStatusEnum.OPENED.getStatus())){ - throw exception(THIS_PLAN_PLATE_IS_CUT); + throw new ServiceException(THIS_PLAN_PLATE_IS_CUT); } planDO.setProcessId(updateReqVO.getProcessId()); @@ -281,7 +279,7 @@ public class PlanServiceImpl implements PlanService { // 获取排单下的订单号集合 planDOS.forEach(f->{ if ( f.getStatus().equals(PlanStatusEnum.OPENING.getStatus()) || f.getStatus().equals(PlanStatusEnum.OPENED.getStatus()) ) { - throw exception(PLAN_NOT_ALLOW_DELETE,f.getId()); + throw new ServiceException(PLAN_NOT_ALLOW_DELETE,f.getId()); } }); @@ -365,7 +363,7 @@ public class PlanServiceImpl implements PlanService { .set(GoodsDO::getPlannedPlateNum, goodsPlateNumAndAreaPlanInfo.getNum()) .set(GoodsDO::getVersion, version + 1)); if (update == 0) { - throw ServiceExceptionUtil.exception(ErrorCodeConstants.GOODS_PLATE_UPDATE_CONCURRENCY_ERROR, orderGoodsId); + throw new ServiceException(ErrorCodeConstants.GOODS_PLATE_UPDATE_CONCURRENCY_ERROR, orderGoodsId); } } } @@ -684,7 +682,7 @@ public class PlanServiceImpl implements PlanService { if(planDOS.size() != planIds.size()){ planDOS.forEach(f->{ if(!planIds.contains(f.getId())){ - throw exception(PLAN_NOT_DATA_EXISTS,f.getId()); + throw new ServiceException(PLAN_NOT_DATA_EXISTS,f.getId()); } }); } @@ -760,7 +758,7 @@ public class PlanServiceImpl implements PlanService { PlanDO planDO = planMapper.selectById(planId); if(planDO == null){ - throw exception(PLAN_NOT_DATA_EXISTS,planId); + throw new ServiceException(PLAN_NOT_DATA_EXISTS,planId); } sorts.add(planDO.getSort()); @@ -960,7 +958,7 @@ public class PlanServiceImpl implements PlanService { } catch (Exception e) { log.error(e.getMessage()); - throw exception(PLAN_PLATE_OPTIMIZE_DATA_ERROR); + throw new ServiceException(PLAN_PLATE_OPTIMIZE_DATA_ERROR); } } @@ -1016,7 +1014,7 @@ public class PlanServiceImpl implements PlanService { for (Long planId : planIds) { PlanDO planDO = planMapper.selectById(planId); if(ObjectUtils.isEmpty(planDO)){ - throw exception(PLAN_NOT_DATA_EXISTS,planId); + throw new ServiceException(PLAN_NOT_DATA_EXISTS,planId); } planDOS.add(planDO); } @@ -1144,16 +1142,16 @@ public class PlanServiceImpl implements PlanService { List processIds = new ArrayList<>(); planDOS.forEach(f->{ if (f.getStatus().equals(PlanStatusEnum.OPENED.getStatus())) { - throw exception(PLAN_PLATE_IS_ALL_CUT,f.getId()); + throw new ServiceException(PLAN_PLATE_IS_ALL_CUT,f.getId()); } - processIds.add(Optional.ofNullable(f.getProcessId()).orElseThrow(() -> exception(PLAN_PROCESS_CONFIG_IS_NULL,f.getId()))); + processIds.add(Optional.ofNullable(f.getProcessId()).orElseThrow(() -> new ServiceException(PLAN_PROCESS_CONFIG_IS_NULL,f.getId()))); }); Integer processSize = systemConfigApi.getProcessSizeByIds(processIds).getCheckedData(); for (PlanDO planDO : planDOS) { if (planDO.getStatus().equals(PlanStatusEnum.OPENED.getStatus())) { - throw exception(PLAN_PLATE_IS_ALL_CUT,planDO.getId()); + throw new ServiceException(PLAN_PLATE_IS_ALL_CUT,planDO.getId()); } } @@ -1393,7 +1391,7 @@ public class PlanServiceImpl implements PlanService { .set(GoodsDO::getPlannedPlateNum, goodsPlateNumAndAreaPlanInfo.getNum()) .set(GoodsDO::getVersion, version + 1)); if (update == 0) { - throw ServiceExceptionUtil.exception(ErrorCodeConstants.GOODS_PLATE_UPDATE_CONCURRENCY_ERROR, orderGoodsId); + throw new ServiceException(ErrorCodeConstants.GOODS_PLATE_UPDATE_CONCURRENCY_ERROR, orderGoodsId); } } } @@ -1447,7 +1445,7 @@ public class PlanServiceImpl implements PlanService { .set(GoodsDO::getPlannedPlateNum, goodsPlateNumAndAreaPlanInfo.getNum()) .set(GoodsDO::getVersion, version + 1)); if (update == 0) { - throw ServiceExceptionUtil.exception(ErrorCodeConstants.GOODS_PLATE_UPDATE_CONCURRENCY_ERROR, orderGoodsId); + throw new ServiceException(ErrorCodeConstants.GOODS_PLATE_UPDATE_CONCURRENCY_ERROR, orderGoodsId); } } } @@ -1974,7 +1972,7 @@ public class PlanServiceImpl implements PlanService { .set(GoodsDO::getPlannedPlateNum, goodsPlateNumAndAreaPlanInfo.getNum()) .set(GoodsDO::getVersion, version + 1)); if (update == 0) { - throw ServiceExceptionUtil.exception(ErrorCodeConstants.CREATE_PLAN_GOODS_UPDATE_CONCURRENCY_ERROR, orderGoodsId); + throw new ServiceException(ErrorCodeConstants.CREATE_PLAN_GOODS_UPDATE_CONCURRENCY_ERROR, orderGoodsId); } } } @@ -2012,7 +2010,7 @@ public class PlanServiceImpl implements PlanService { } int update = orderMapper.update(updateWrapper); if (update == 0) { - throw ServiceExceptionUtil.exception(ErrorCodeConstants.CREATE_PLAN_ORDER_UPDATE_CONCURRENCY_ERROR, orderId); + throw new ServiceException(ErrorCodeConstants.CREATE_PLAN_ORDER_UPDATE_CONCURRENCY_ERROR, orderId); } } } diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/plate/PlateServiceImpl.java b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/plate/PlateServiceImpl.java index 4f8a3c707..4b15ac007 100644 --- a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/plate/PlateServiceImpl.java +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/plate/PlateServiceImpl.java @@ -14,7 +14,6 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.PageDTO; import com.cf.imes.framework.common.enums.*; import com.cf.imes.framework.common.exception.ServiceException; -import com.cf.imes.framework.common.exception.util.ServiceExceptionUtil; import com.cf.imes.framework.common.pojo.PageResult; import com.cf.imes.framework.common.util.Assert.AssertUtils; import com.cf.imes.framework.common.util.object.BeanUtils; @@ -44,7 +43,6 @@ import com.cf.imes.module.executor.dal.mysql.plate.PlateMapper; import com.cf.imes.module.executor.enums.OrderItemType; import com.cf.imes.module.executor.enums.OrderStatusEnum; import com.cf.imes.module.executor.service.order.OrderInputProcessor; -import com.cf.imes.module.system.enums.ErrorCodeConstants; import lombok.SneakyThrows; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; @@ -59,11 +57,10 @@ import java.util.*; import java.util.stream.Collectors; import static com.cf.imes.framework.common.exception.enums.GlobalErrorCodeConstants.INTERNAL_SERVER_ERROR; -import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception; import static com.cf.imes.framework.security.core.util.SecurityFrameworkUtils.getUserOrganId; import static com.cf.imes.module.executor.enums.ErrorCodeConstants.*; import static com.cf.imes.module.executor.enums.EsIndexEnum.ORDER_PLATE_MODEL; -import static com.cf.imes.module.system.enums.ErrorCodeConstants.*; + /** * 生产单板件 Service 实现类 * @@ -155,12 +152,12 @@ public class PlateServiceImpl implements PlateService { for (PlateDO plateDO : plateDOS) { if(!plateDO.getType().equals(OrderPlateTypeEnum.SELFINCREASINGBOARD.getType())){ - throw exception(PLATE_IS_SOURCE,plateDO.getPlateNo()); + throw new ServiceException(PLATE_IS_SOURCE,plateDO.getPlateNo()); } if(!plateDO.getIsCutted().equals(OrderPlateCutStatusEnum.NOCUTTING.getStatus())){ - throw exception(THIS_PLATE_IS_OPTIMIZE,plateDO.getPlateNo()); + throw new ServiceException(THIS_PLATE_IS_OPTIMIZE,plateDO.getPlateNo()); } } @@ -229,7 +226,7 @@ public class PlateServiceImpl implements PlateService { .set(GoodsDO::getPlannedPlateNum, goodsPlateNumAndAreaPlanInfo.getNum()) .set(GoodsDO::getVersion, version + 1)); if (update == 0) { - throw ServiceExceptionUtil.exception(com.cf.imes.module.executor.enums.ErrorCodeConstants.GOODS_PLATE_UPDATE_CONCURRENCY_ERROR, orderGoodsId); + throw new ServiceException(com.cf.imes.module.executor.enums.ErrorCodeConstants.GOODS_PLATE_UPDATE_CONCURRENCY_ERROR, orderGoodsId); } } } @@ -267,7 +264,7 @@ public class PlateServiceImpl implements PlateService { } int update = orderMapper.update(updateWrapper); if (update == 0) { - throw ServiceExceptionUtil.exception(com.cf.imes.module.executor.enums.ErrorCodeConstants.ORDER_PLATE_UPDATE_CONCURRENCY_ERROR, orderId); + throw new ServiceException(com.cf.imes.module.executor.enums.ErrorCodeConstants.ORDER_PLATE_UPDATE_CONCURRENCY_ERROR, orderId); } } } @@ -299,7 +296,7 @@ public class PlateServiceImpl implements PlateService { private void validatePlateExists(Long id) { if (plateMapper.selectById(id) == null) { - throw exception(REMAIN_PLATE_NOT_EXISTS); + throw new ServiceException(REMAIN_PLATE_NOT_EXISTS); } } @@ -436,7 +433,7 @@ public class PlateServiceImpl implements PlateService { @Transactional(rollbackFor = Exception.class) // 添加事务,异常则回滚所有导入 public PlateImportRespVO importPlatesList(List importPlates, Long orderId) { if (CollUtil.isEmpty(importPlates)) { - throw ServiceExceptionUtil.exception(RAW_GOODS_IMPORT_LIST_IS_EMPTY); + throw new ServiceException(RAW_GOODS_IMPORT_LIST_IS_EMPTY); } PlateImportRespVO respVO = PlateImportRespVO.builder().createPlates(new ArrayList()) .updatePlates(new ArrayList<>()).failurePlates(new LinkedHashMap<>()).build(); @@ -532,7 +529,7 @@ public class PlateServiceImpl implements PlateService { List orderPlateModelDOS = new ArrayList<>(); - Long planId = Optional.ofNullable(reqVO.get(0).getPlanId()).orElseThrow(()-> exception(ORDER_PLAN_PLATE_ERROR)); + Long planId = Optional.ofNullable(reqVO.get(0).getPlanId()).orElseThrow(()-> new ServiceException(ORDER_PLAN_PLATE_ERROR)); PlanDO planDO = planMapper.selectById(planId); AssertUtils.notEmpty(planDO,ORDER_PLAN_DATE_ERROR); @@ -694,7 +691,7 @@ public class PlateServiceImpl implements PlateService { .set(OrderDO::getVersion, version + 1); int update = orderMapper.update(updateWrapper); if (update == 0) { - throw ServiceExceptionUtil.exception(com.cf.imes.module.executor.enums.ErrorCodeConstants.ORDER_PLATE_UPDATE_CONCURRENCY_ERROR, orderId); + throw new ServiceException(com.cf.imes.module.executor.enums.ErrorCodeConstants.ORDER_PLATE_UPDATE_CONCURRENCY_ERROR, orderId); } } } @@ -721,7 +718,7 @@ public class PlateServiceImpl implements PlateService { .set(GoodsDO::getPlateNum, goodsPlateNumAndAreaPlanInfo.getNum() + goodsDO.getPlateNum()) .set(GoodsDO::getVersion, version + 1)); if (update == 0) { - throw ServiceExceptionUtil.exception(com.cf.imes.module.executor.enums.ErrorCodeConstants.GOODS_PLATE_UPDATE_CONCURRENCY_ERROR, orderGoodsId); + throw new ServiceException(com.cf.imes.module.executor.enums.ErrorCodeConstants.GOODS_PLATE_UPDATE_CONCURRENCY_ERROR, orderGoodsId); } } } @@ -781,7 +778,7 @@ public class PlateServiceImpl implements PlateService { if(Boolean.TRUE.equals(pageReqVO.getIsMixed())){ - throw exception(PLAN_IS_MIXED_ERROR); + throw new ServiceException(PLAN_IS_MIXED_ERROR); } // 相同材质和厚度 @@ -822,7 +819,7 @@ public class PlateServiceImpl implements PlateService { if(Boolean.TRUE.equals(pageReqVO.getIsMixed())){ if(!planDO.getStatus().equals(PlanStatusEnum.NOCUTTING.getStatus())){ - throw exception(PLAN_PLATE_IS_CUTTING); + throw new ServiceException(PLAN_PLATE_IS_CUTTING); } // 相同材质和厚度 混单 diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/process/OrderProcessServiceImpl.java b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/process/OrderProcessServiceImpl.java index 1c510c1a6..008eb2e82 100644 --- a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/process/OrderProcessServiceImpl.java +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/process/OrderProcessServiceImpl.java @@ -2,8 +2,8 @@ package com.cf.imes.module.executor.service.process; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.incrementer.IdentifierGenerator; +import com.cf.imes.framework.common.exception.ServiceException; import com.cf.imes.framework.organ.core.context.OrganContextHolder; -import com.cf.imes.framework.security.core.util.SecurityFrameworkUtils; import com.cf.imes.module.executor.dal.dataobject.goods.GoodsDO; import com.cf.imes.module.executor.dal.dataobject.order.OrderDO; import com.cf.imes.module.executor.dal.dataobject.orderBody.OrderBodyDO; @@ -42,10 +42,8 @@ import java.util.List; import java.util.Objects; import java.util.concurrent.atomic.AtomicInteger; -import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception; import static com.cf.imes.framework.security.core.util.SecurityFrameworkUtils.getUserOrganId; import static com.cf.imes.module.executor.enums.ErrorCodeConstants.*; -import static com.cf.imes.module.executor.enums.ProcessTypeEnum.TYPE_EIGHT; import static com.cf.imes.module.executor.enums.ProcessTypeEnum.TYPE_SEVEN; /** @@ -93,11 +91,11 @@ public class OrderProcessServiceImpl implements OrderProcessService { OrderDO order = orderMapper.selectOrderOne(orderId, organId, status); // 当生产不为删除时,校验生产单存在 if (order == null) { - throw exception(ORDER_NOT_EXISTS); + throw new ServiceException(ORDER_NOT_EXISTS); }else { // 校验生产单状态 if (order.getStatus() != OrderStatusEnum.NEW_ORDER.getStatus()) { - throw exception(ORDER_STATUS_CONFLICT); + throw new ServiceException(ORDER_STATUS_CONFLICT); } } } @@ -105,14 +103,14 @@ public class OrderProcessServiceImpl implements OrderProcessService { // 校验工序组存在 private void checkProcessGroup(Long id) { if (!processGroupApi.getProcessGroup(id)) { - throw exception(PROCESS_GROUP_NOT_EXISTS); + throw new ServiceException(PROCESS_GROUP_NOT_EXISTS); } } // 校验是否已经存在该生产单对应的工序组 private void checkOrderProcessExists(Long orderId, Long organId) { if (orderProcessMapper.getOrderProcess(orderId, organId)) { - throw exception(ORDER_PROCESS_EXISTS); + throw new ServiceException(ORDER_PROCESS_EXISTS); } } @@ -292,7 +290,7 @@ public class OrderProcessServiceImpl implements OrderProcessService { private void validateOrderProcessExists(Long id) { if (orderProcessMapper.selectById(id) == null) { - throw exception(ORDER_PROCESS_NOT_EXISTS); + throw new ServiceException(ORDER_PROCESS_NOT_EXISTS); } } diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/processStep/ProcessStepServiceImpl.java b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/processStep/ProcessStepServiceImpl.java index a16237d2a..072b1498f 100644 --- a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/processStep/ProcessStepServiceImpl.java +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/processStep/ProcessStepServiceImpl.java @@ -9,14 +9,9 @@ import java.util.*; import com.cf.imes.module.executor.controller.admin.processStep.vo.*; import com.cf.imes.module.executor.dal.dataobject.processStep.ProcessStepDO; import com.cf.imes.framework.common.pojo.PageResult; -import com.cf.imes.framework.common.pojo.PageParam; import com.cf.imes.framework.common.util.object.BeanUtils; import com.cf.imes.module.executor.dal.mysql.processStep.ProcessStepMapper; - -import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception; -import static com.cf.imes.module.executor.enums.ErrorCodeConstants.*; - /** * 生产单工序步骤 Service 实现类 * @@ -60,7 +55,7 @@ public class ProcessStepServiceImpl implements ProcessStepService { private void validateProcessStepExists(Long id) { if (processStepMapper.selectById(id) == null) { -// throw exception(PROCESS_STEP_NOT_EXISTS); +// throw new ServiceException(PROCESS_STEP_NOT_EXISTS); } } diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/rawgoods/RawGoodsServiceImpl.java b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/rawgoods/RawGoodsServiceImpl.java index 147eb7b7d..4bd8001ff 100644 --- a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/rawgoods/RawGoodsServiceImpl.java +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/rawgoods/RawGoodsServiceImpl.java @@ -2,7 +2,6 @@ package com.cf.imes.module.executor.service.rawgoods; import cn.hutool.core.collection.CollUtil; import com.cf.imes.framework.common.exception.ServiceException; -import com.cf.imes.framework.common.exception.util.ServiceExceptionUtil; import com.cf.imes.module.executor.controller.admin.rawgoods.vo.RawGoodsImportRespVO; import com.cf.imes.module.executor.controller.admin.rawgoods.vo.RawGoodsPageReqVO; import com.cf.imes.module.executor.controller.admin.rawgoods.vo.RawGoodsSaveReqVO; @@ -19,7 +18,6 @@ import com.cf.imes.framework.common.util.object.BeanUtils; import com.cf.imes.module.executor.dal.mysql.rawgoods.RawGoodsMapper; -import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception; import static com.cf.imes.framework.security.core.util.SecurityFrameworkUtils.getUserOrganId; import static com.cf.imes.module.executor.enums.ErrorCodeConstants.RAW_GOODS_IMPORT_LIST_IS_EMPTY; import static com.cf.imes.module.executor.enums.ErrorCodeConstants.RAW_GOODS_NOT_EXISTS; @@ -64,7 +62,7 @@ public class RawGoodsServiceImpl implements RawGoodsService { private void validateRawGoodsExists(Long id) { if (rawGoodsMapper.selectById(id) == null) { - throw exception(RAW_GOODS_NOT_EXISTS); + throw new ServiceException(RAW_GOODS_NOT_EXISTS); } } @@ -82,7 +80,7 @@ public class RawGoodsServiceImpl implements RawGoodsService { @Transactional(rollbackFor = Exception.class) // 添加事务,异常则回滚所有导入 public RawGoodsImportRespVO importRawGoodsList(List importRawGoods, Long orderId) { if (CollUtil.isEmpty(importRawGoods)) { - throw ServiceExceptionUtil.exception(RAW_GOODS_IMPORT_LIST_IS_EMPTY); + throw new ServiceException(RAW_GOODS_IMPORT_LIST_IS_EMPTY); } RawGoodsImportRespVO respVO = RawGoodsImportRespVO.builder().createRawGoods(new ArrayList<>()) .updateRawGoods(new ArrayList<>()).failureRawGoods(new LinkedHashMap<>()).build(); diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/remainplate/RemainPlateServiceImpl.java b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/remainplate/RemainPlateServiceImpl.java index 263252e43..3330c29aa 100644 --- a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/remainplate/RemainPlateServiceImpl.java +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/remainplate/RemainPlateServiceImpl.java @@ -1,5 +1,6 @@ package com.cf.imes.module.executor.service.remainplate; +import com.cf.imes.framework.common.exception.ServiceException; import com.cf.imes.module.executor.dal.dataobject.remainplaten.RemainPlateDO; import com.cf.imes.module.executor.dal.mysql.remainplaten.RemainPlateMapper; import org.springframework.stereotype.Service; @@ -12,7 +13,6 @@ import com.cf.imes.framework.common.pojo.PageResult; import com.cf.imes.framework.common.util.object.BeanUtils; -import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception; import static com.cf.imes.module.executor.enums.ErrorCodeConstants.*; /** @@ -55,7 +55,7 @@ public class RemainPlateServiceImpl implements RemainPlateService { private void validateRemainPlateExists(Long id) { if (remainPlateMapper.selectById(id) == null) { - throw exception(REMAIN_PLATE_NOT_EXISTS); + throw new ServiceException(REMAIN_PLATE_NOT_EXISTS); } } diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/util/ExcelWriterUtil.java b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/util/ExcelWriterUtil.java index d6fc67db4..5da7efe76 100644 --- a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/util/ExcelWriterUtil.java +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/util/ExcelWriterUtil.java @@ -8,7 +8,6 @@ import com.cf.imes.module.executor.util.fileConversion.admin.files.excel.OrderPl import lombok.extern.slf4j.Slf4j; import org.apache.commons.io.IOUtils; import org.springframework.util.ResourceUtils; -import org.springframework.web.multipart.MultipartFile; import jakarta.servlet.ServletOutputStream; import jakarta.servlet.http.HttpServletResponse; @@ -17,7 +16,7 @@ import java.io.InputStream; import java.util.List; import java.util.Map; -import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception; + /** * excel 文件写入 diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/util/file/FileHelperUtil.java b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/util/file/FileHelperUtil.java index 4d7bd1fb1..6f60b1ccd 100644 --- a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/util/file/FileHelperUtil.java +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/util/file/FileHelperUtil.java @@ -1,5 +1,6 @@ package com.cf.imes.module.executor.util.file; +import com.cf.imes.framework.common.exception.ServiceException; import org.springframework.web.multipart.MultipartFile; import jakarta.servlet.http.HttpServletResponse; @@ -10,7 +11,7 @@ import java.io.IOException; import java.io.OutputStream; import java.net.URLEncoder; -import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception; + import static com.cf.imes.module.infra.enums.ErrorCodeConstants.FILE_NOT_EXISTS; import static com.cf.imes.module.executor.enums.ErrorCodeConstants.*; @@ -41,7 +42,7 @@ public class FileHelperUtil { outputStream.write(buffer); outputStream.flush(); } catch (IOException ex) { - throw exception(FILE_NOT_EXISTS); + throw new ServiceException(FILE_NOT_EXISTS); } } @@ -49,16 +50,16 @@ public class FileHelperUtil { public static boolean checkFile(MultipartFile file, Long fileSize) { if (file.isEmpty()) { - throw exception(FILE_NULL); + throw new ServiceException(FILE_NULL); } if (!(file.getOriginalFilename().endsWith(".xlsx") || file.getOriginalFilename().endsWith(".xls"))) { - throw exception(FILE_FORMAT_ERROR); + throw new ServiceException(FILE_FORMAT_ERROR); } if (file.getSize() > fileSize) { - throw exception(FILE_EXCEED_SIZE); + throw new ServiceException(FILE_EXCEED_SIZE); } if (file.getSize() == 0) { - throw exception(FILE_CONTENT_NULL); + throw new ServiceException(FILE_CONTENT_NULL); } return true; diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/util/fileConversion/admin/api/webcad/ApiDataAchieve.java b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/util/fileConversion/admin/api/webcad/ApiDataAchieve.java index f6f5ab016..133c20295 100644 --- a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/util/fileConversion/admin/api/webcad/ApiDataAchieve.java +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/util/fileConversion/admin/api/webcad/ApiDataAchieve.java @@ -2,6 +2,7 @@ package com.cf.imes.module.executor.util.fileConversion.admin.api.webcad; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; +import com.cf.imes.framework.common.exception.ServiceException; import com.cf.imes.module.system.api.application.ApplicationApi; import lombok.extern.slf4j.Slf4j; import org.springframework.scheduling.annotation.Async; @@ -14,7 +15,6 @@ import java.time.format.DateTimeFormatter; import java.time.temporal.ChronoUnit; import java.util.concurrent.Future; -import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception; import static com.cf.imes.module.executor.enums.ErrorCodeConstants.*; import static com.cf.imes.module.executor.enums.ErrorCodeConstants.ORDER_NOT_FOUND; @@ -55,8 +55,8 @@ public class ApiDataAchieve { JSONObject json = apiDataProduction.getApiTokenMessage(appId, appSecret); if (!json.getString(ERR_MSG_KEY).equals("success")) { log.error(APP_TOKEN_ERROR.getMsg()); - throw exception(API_MES_ERR, "身份认证-" + json.getString(ERR_MSG_KEY)); -// throw exception(APP_TOKEN_ERROR); + throw new ServiceException(API_MES_ERR, "身份认证-" + json.getString(ERR_MSG_KEY)); +// throw new ServiceException(APP_TOKEN_ERROR); } return new AsyncResult<>(json); } @@ -79,8 +79,8 @@ public class ApiDataAchieve { JSONObject parts = apiDataProduction.getApiOrderPartsMessage(token, jsonParts); if (!parts.getString(ERR_CODE_KEY).equals("0")) { log.error("N" + orderNo + "配件数据获取错误:" + parts.getString(ERR_MSG_KEY)); - throw exception(API_MES_ERR, "配件信息获取-" + parts.getString(ERR_MSG_KEY)); -// throw exception(PARTS_DATA_ERROR); + throw new ServiceException(API_MES_ERR, "配件信息获取-" + parts.getString(ERR_MSG_KEY)); +// throw new ServiceException(PARTS_DATA_ERROR); } if (parts.getJSONObject(VALUE_KEY).getJSONArray("List") == null || parts.getJSONObject(VALUE_KEY).getJSONArray("List").isEmpty()) { return null; @@ -99,8 +99,8 @@ public class ApiDataAchieve { JSONObject body = apiDataProduction.getApiOrderBodyMessage(token, jsonBody); if (!body.getString(ERR_CODE_KEY).equals("0")) { log.error("N" + orderNo + "柜体数据获取错误:" + body.getString(ERR_MSG_KEY)); - throw exception(API_MES_ERR, "柜体信息获取-" + body.getString(ERR_MSG_KEY)); -// throw exception(BODY_DATA_ERROR); + throw new ServiceException(API_MES_ERR, "柜体信息获取-" + body.getString(ERR_MSG_KEY)); +// throw new ServiceException(BODY_DATA_ERROR); } JSONObject dataBody = new JSONObject(); for (int i = 1; i <= body.getJSONObject(VALUE_KEY).getInteger(ALL_PAGE_COUNT_KEY); i++) { @@ -123,8 +123,8 @@ public class ApiDataAchieve { JSONObject goods = apiDataProduction.getApiOrderGoodsMessage(token, jsonGoods); if (!goods.getString(ERR_CODE_KEY).equals("0")) { log.error("N" + orderNo + "商品信息转换失败:" + goods.getString(ERR_MSG_KEY)); - throw exception(API_MES_ERR, "商品信息获取-" + goods.getString(ERR_MSG_KEY)); -// throw exception(GOODS_DATA_ERROR); + throw new ServiceException(API_MES_ERR, "商品信息获取-" + goods.getString(ERR_MSG_KEY)); +// throw new ServiceException(GOODS_DATA_ERROR); } JSONObject dataGoods = new JSONObject(); for (int i = 1; i <= goods.getJSONObject(VALUE_KEY).getInteger(ALL_PAGE_COUNT_KEY); i++) { @@ -143,8 +143,8 @@ public class ApiDataAchieve { JSONObject plates = apiDataProduction.getApiBlocksDataMessage(token, jsonPlates); if (!plates.getString(ERR_CODE_KEY).equals("0")) { log.error("N" + orderNo + "板材明细信息获取错误" + plates.getString(ERR_MSG_KEY)); - throw exception(API_MES_ERR, "板材明细信息获取-" + plates.getString(ERR_MSG_KEY)); -// throw exception(PLATE_DATA_ERROR); + throw new ServiceException(API_MES_ERR, "板材明细信息获取-" + plates.getString(ERR_MSG_KEY)); +// throw new ServiceException(PLATE_DATA_ERROR); } if (plates.getJSONObject(VALUE_KEY).getJSONArray("List") == null || plates.getJSONObject(VALUE_KEY).getJSONArray("List").isEmpty()) { return null; @@ -172,7 +172,7 @@ public class ApiDataAchieve { JSONObject blocks = apiDataProduction.getApiBlocksMessage(token, jsonBlocks); if (!blocks.getString(ERR_CODE_KEY).equals("0")) { log.error("N" + orderNo + "板材数据获取错误" + blocks.getString(ERR_MSG_KEY)); - throw exception(API_MES_ERR, "板材数据信息获取-" + blocks.getString(ERR_MSG_KEY)); + throw new ServiceException(API_MES_ERR, "板材数据信息获取-" + blocks.getString(ERR_MSG_KEY)); } JSONObject block = new JSONObject(); for (int i = 1; i <= blocks.getJSONObject(VALUE_KEY).getInteger(ALL_PAGE_COUNT_KEY); i++) { @@ -193,7 +193,7 @@ public class ApiDataAchieve { JSONObject good = apiDataProduction.getApiGoods(token, jsonGoods); if (!good.getString(ERR_CODE_KEY).equals("0")) { log.error(id + "配件数据获取错误" + good.getString(ERR_MSG_KEY)); - throw exception(API_MES_ERR, "配件数据信息获取-" + good.getString(ERR_MSG_KEY)); + throw new ServiceException(API_MES_ERR, "配件数据信息获取-" + good.getString(ERR_MSG_KEY)); } return new AsyncResult<>(good); @@ -213,7 +213,7 @@ public class ApiDataAchieve { if (!order.getString(ProduceApiConstants.CODE).equals("0") || order.getJSONArray(ProduceApiConstants.DATA) == null || order.getJSONArray(ProduceApiConstants.DATA).isEmpty()) { - throw exception(ORDER_NOT_FOUND); + throw new ServiceException(ORDER_NOT_FOUND); } return order; @@ -230,13 +230,13 @@ public class ApiDataAchieve { LocalDate endTime = LocalDate.parse(createDateMax, formatter); long daysBetweenSimple = ChronoUnit.DAYS.between(startTime, endTime); if (daysBetweenSimple > 30) { - throw exception(ORDER_DATE_ERR); + throw new ServiceException(ORDER_DATE_ERR); } jsonOrders.put("create_date_min", createDateMin + " 00:00:00"); jsonOrders.put("create_date_max", createDateMax + " 23:59:59"); } catch (Exception e) { - throw exception(ORDER_TIME_ERR); + throw new ServiceException(ORDER_TIME_ERR); } } // 订单列表 @@ -260,7 +260,7 @@ public class ApiDataAchieve { JSONObject orders = apiDataProduction.getApiOrderList(token, jsonOrders); if (!orders.getString(ERR_CODE_KEY).equals("0")) { - throw exception(ORDER_READ_ERR); + throw new ServiceException(ORDER_READ_ERR); } JSONObject order = new JSONObject(); int countPage = divideWithPlusOne(orders.getInteger("count"), PARTS_PAGE_MAX); diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/util/fileConversion/admin/api/webcad/ApiTypeRealize.java b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/util/fileConversion/admin/api/webcad/ApiTypeRealize.java index 48112b3b1..ea4b49bba 100644 --- a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/util/fileConversion/admin/api/webcad/ApiTypeRealize.java +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/util/fileConversion/admin/api/webcad/ApiTypeRealize.java @@ -3,6 +3,7 @@ package com.cf.imes.module.executor.util.fileConversion.admin.api.webcad;//packa import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.incrementer.IdentifierGenerator; +import com.cf.imes.framework.common.exception.ServiceException; import com.cf.imes.framework.id.core.util.SnowflakeIdWorker3rd; import com.cf.imes.module.executor.controller.admin.orderParts.vo.OrderPartsRemark; import com.cf.imes.module.executor.controller.admin.plan.dto.Point; @@ -30,7 +31,6 @@ import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ExecutionException; import java.util.stream.Collectors; -import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception; import static com.cf.imes.module.executor.enums.ErrorCodeConstants.*; import static com.cf.imes.module.executor.enums.ErrorCodeConstants.ORDER_DETAIL_DATE_ERR; @@ -117,8 +117,8 @@ public class ApiTypeRealize { // 判断生产数据是否可以为空 if (!platesData.getMapPlatesInfos().isEmpty() && plateDetailData.getMapPlateDetails().isEmpty() ) { - throw exception(ORDER_DETAIL_DATE_ERR); -// throw exception(API_MES_ERR, "生产数据信息获取-小板缺少生产数据,导致无法正常导单"); + throw new ServiceException(ORDER_DETAIL_DATE_ERR); +// throw new ServiceException(API_MES_ERR, "生产数据信息获取-小板缺少生产数据,导致无法正常导单"); } // 小板数据补充,order_goods_id添加造型相关数据判断获取,以及配件中添加goods_id @@ -219,15 +219,15 @@ public class ApiTypeRealize { // 第一步判断是否存在需要进行数据添加的小板 if (mapPlatesInfos == null || mapPlatesInfos.isEmpty()) { log.error("小板信息:{}" , PLATE_DATA_ERROR); -// throw exception(PLATE_DATA_ERROR); +// throw new ServiceException(PLATE_DATA_ERROR); } if (mapPlateDetails == null || mapPlateDetails.isEmpty()) { log.error("小板信息:{}" , PLATE_PRODUCE_DATA_ERROR); -// throw exception(PLATE_PRODUCE_DATA_ERROR); +// throw new ServiceException(PLATE_PRODUCE_DATA_ERROR); } if (mapGoodsDO == null || mapGoodsDO.isEmpty()) { log.error("板材信息:{}" , GOODS_DATA_ERROR); -// throw exception(GOODS_DATA_ERROR); +// throw new ServiceException(GOODS_DATA_ERROR); } mapPlatesInfos.forEach((k, v) -> { // 判断是否有造型数据可以进行整合 @@ -250,7 +250,7 @@ public class ApiTypeRealize { // 获取小板对应的造型信息 PlateDetail plateDetail = mapPlateDetails.get(k); if (plateDetail == null) { - throw exception(ORDER_DETAIL_DATE_ERR); + throw new ServiceException(ORDER_DETAIL_DATE_ERR); } plateDetail.setPlateId(v.getId()) .setExtraRemark(mapPlateDetailsRemarks.get(k).getExtraRemark()) @@ -439,7 +439,7 @@ public class ApiTypeRealize { // if (bodyLists == null || bodyLists.isEmpty()) { // log.error("{}房间柜体信息获取失败",orderNo); -// throw exception(ORDER_BODY_NOT_EXISTS); +// throw new ServiceException(ORDER_BODY_NOT_EXISTS); // // } @@ -947,12 +947,12 @@ public class ApiTypeRealize { if (platesJSONObject == null || platesJSONObject.isEmpty()) { log.error("获取板件明细数据失败"); - throw exception(PLATE_PLAN_DATA_ERROR); + throw new ServiceException(PLATE_PLAN_DATA_ERROR); } if (blocksJSONObject == null || blocksJSONObject.isEmpty()) { log.error("获取板材数据失败"); - throw exception(PLATE_GOOD_DATA_NULL); + throw new ServiceException(PLATE_GOOD_DATA_NULL); } // 板材数据 @@ -1516,7 +1516,7 @@ public class ApiTypeRealize { if (map == null || map.isEmpty()) { log.error("明细信息:{}" , CHANGE_DETAILS_ITEM_ERROR); -// throw exception(CHANGE_DETAILS_ITEM_ERROR); +// throw new ServiceException(CHANGE_DETAILS_ITEM_ERROR); } // 处理第一个 Map diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/util/fileConversion/admin/files/excel/DefaultOrderImportExcelListener.java b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/util/fileConversion/admin/files/excel/DefaultOrderImportExcelListener.java index 7931c813a..ad772197f 100644 --- a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/util/fileConversion/admin/files/excel/DefaultOrderImportExcelListener.java +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/util/fileConversion/admin/files/excel/DefaultOrderImportExcelListener.java @@ -10,7 +10,6 @@ import com.alibaba.excel.read.metadata.holder.ReadRowHolder; import com.alibaba.excel.util.ListUtils; import com.alibaba.fastjson.JSON; import com.cf.imes.framework.common.exception.ServiceException; -import com.cf.imes.framework.common.exception.util.ServiceExceptionUtil; import com.cf.imes.framework.common.util.json.JsonUtils; import com.cf.imes.framework.mybatis.core.generator.SnowFlakeGenerator; import com.cf.imes.framework.organ.core.context.OrganContextHolder; @@ -290,7 +289,7 @@ public final class DefaultOrderImportExcelListener extends AnalysisEventListener */ private void validCustomOrderNo(String key, String val) { if (StringUtils.isNotEmpty(val) && !orderService.customOrderNoIsExists(val)) { - throw ServiceExceptionUtil.exception(ORDER_IMPORT_ORDER_CUSTOMERNO_EXISTS, key, val); + throw new ServiceException(ORDER_IMPORT_ORDER_CUSTOMERNO_EXISTS, key, val); } } @@ -302,7 +301,7 @@ public final class DefaultOrderImportExcelListener extends AnalysisEventListener */ private void validOrderInfoEmpty(String key, String val) { if (StringUtils.isEmpty(val)) { - throw ServiceExceptionUtil.exception(ORDER_IMPORT_ORDER_FIELD_EMPTY, key); + throw new ServiceException(ORDER_IMPORT_ORDER_FIELD_EMPTY, key); } } @@ -315,7 +314,7 @@ public final class DefaultOrderImportExcelListener extends AnalysisEventListener */ private void validOrderInfoLength(String key, String val, int length) { if (StringUtils.isNotEmpty(val) && length < val.length()) { - throw ServiceExceptionUtil.exception(ORDER_IMPORT_ORDER_FIELD_LENGTH_ERROR, key, length); + throw new ServiceException(ORDER_IMPORT_ORDER_FIELD_LENGTH_ERROR, key, length); } } @@ -327,7 +326,7 @@ public final class DefaultOrderImportExcelListener extends AnalysisEventListener */ private void validOrderInfoPhone(String key, String val) { if (StringUtils.isNotEmpty(val) && Boolean.FALSE.equals(ToolUtil.validatePhoneNumber(val))) { - throw ServiceExceptionUtil.exception(ORDER_IMPORT_ORDER_FIELD_MOBILE_FORMAT_ERROR, key); + throw new ServiceException(ORDER_IMPORT_ORDER_FIELD_MOBILE_FORMAT_ERROR, key); } } @@ -341,7 +340,7 @@ public final class DefaultOrderImportExcelListener extends AnalysisEventListener try { return LocalDateTimeUtil.parseDate(val, DateTimeFormatter.ofPattern("yyyy-MM-dd")); } catch (Exception e) { - throw ServiceExceptionUtil.exception(ORDER_IMPORT_ORDER_FIELD_DATE_FORMAT_ERROR, key); + throw new ServiceException(ORDER_IMPORT_ORDER_FIELD_DATE_FORMAT_ERROR, key); } } @@ -646,7 +645,7 @@ public final class DefaultOrderImportExcelListener extends AnalysisEventListener } if (ObjectUtil.isNull(plateGoodDO)) { - throw ServiceExceptionUtil.exception(ORDER_IMPORT_PLATEGOODS_NOT_EXIST_VALID_ERROR, rowIndex + 1); + throw new ServiceException(ORDER_IMPORT_PLATEGOODS_NOT_EXIST_VALID_ERROR, rowIndex + 1); } } @@ -662,11 +661,11 @@ public final class DefaultOrderImportExcelListener extends AnalysisEventListener // 判断非空,字典值判断 public void isNotEmptyAndDict(String value, String dictType, String errValue) { if (StringUtils.isEmpty(value)) { - throw ServiceExceptionUtil.exception(ORDER_IMPORT_DETAIL_VALID_ERROR, getRowIndexNotification() + errValue + NOT_EMPTY); + throw new ServiceException(ORDER_IMPORT_DETAIL_VALID_ERROR, getRowIndexNotification() + errValue + NOT_EMPTY); } else { DictDataRespDTO dictDataRespDTO = dictDataApi.parseDictData(dictType, value).getData(); if (dictDataRespDTO == null) { - throw ServiceExceptionUtil.exception(ORDER_IMPORT_DETAIL_VALID_ERROR, getRowIndexNotification() + errValue + ACCORD_ENUM); + throw new ServiceException(ORDER_IMPORT_DETAIL_VALID_ERROR, getRowIndexNotification() + errValue + ACCORD_ENUM); } } } @@ -674,12 +673,12 @@ public final class DefaultOrderImportExcelListener extends AnalysisEventListener // 非空判断,错误填入 private void isEmpty(String value, String errValue, int length) { if (StringUtils.isEmpty(value)) { - throw ServiceExceptionUtil.exception(ORDER_IMPORT_DETAIL_VALID_ERROR, getRowIndexNotification() + errValue + NOT_EMPTY); + throw new ServiceException(ORDER_IMPORT_DETAIL_VALID_ERROR, getRowIndexNotification() + errValue + NOT_EMPTY); } else { // 字符串长度检查 int size = value.length(); if (size > length) { - throw ServiceExceptionUtil.exception(ORDER_IMPORT_DETAIL_VALID_ERROR, getRowIndexNotification() + errValue + NUMBER_LENGTH_ERR); + throw new ServiceException(ORDER_IMPORT_DETAIL_VALID_ERROR, getRowIndexNotification() + errValue + NUMBER_LENGTH_ERR); } } } @@ -688,7 +687,7 @@ public final class DefaultOrderImportExcelListener extends AnalysisEventListener // 判断非零,错误返回;不为空时,判断是否符合枚举类 private void isNotEmptyAndBack(String value, Class> enumClass, String errValue, int length) { if (StringUtils.isEmpty(value)) { - throw ServiceExceptionUtil.exception(ORDER_IMPORT_DETAIL_VALID_ERROR, getRowIndexNotification() + errValue + NOT_EMPTY); + throw new ServiceException(ORDER_IMPORT_DETAIL_VALID_ERROR, getRowIndexNotification() + errValue + NOT_EMPTY); } else { isEmptyAndSize(value, length, errValue); try { @@ -705,10 +704,10 @@ public final class DefaultOrderImportExcelListener extends AnalysisEventListener } } if (!isValid) { - throw ServiceExceptionUtil.exception(ORDER_IMPORT_DETAIL_VALID_ERROR, getRowIndexNotification() + errValue + ACCORD_ENUM); + throw new ServiceException(ORDER_IMPORT_DETAIL_VALID_ERROR, getRowIndexNotification() + errValue + ACCORD_ENUM); } } catch (IllegalArgumentException e) { - throw ServiceExceptionUtil.exception(ORDER_IMPORT_DETAIL_VALID_ERROR, getRowIndexNotification() + errValue + ACCORD_ENUM); + throw new ServiceException(ORDER_IMPORT_DETAIL_VALID_ERROR, getRowIndexNotification() + errValue + ACCORD_ENUM); } catch (NoSuchFieldException | IllegalAccessException e) { throw new RuntimeException(e); } @@ -729,13 +728,13 @@ public final class DefaultOrderImportExcelListener extends AnalysisEventListener if (Boolean.TRUE.equals(ToolUtil.convertToType(value, targetType))) { if (Boolean.TRUE.equals(ToolUtil.checkNumber(value))) { if (!ToolUtil.checkPrecision(value, length, decimalLength)) { - throw ServiceExceptionUtil.exception(ORDER_IMPORT_DETAIL_VALID_ERROR, getRowIndexNotification() + errValue + NUMBER_LENGTH_ERR); + throw new ServiceException(ORDER_IMPORT_DETAIL_VALID_ERROR, getRowIndexNotification() + errValue + NUMBER_LENGTH_ERR); } } else { - throw ServiceExceptionUtil.exception(ORDER_IMPORT_DETAIL_VALID_ERROR, getRowIndexNotification() + errValue + POSITIVE_ERR); + throw new ServiceException(ORDER_IMPORT_DETAIL_VALID_ERROR, getRowIndexNotification() + errValue + POSITIVE_ERR); } } else { - throw ServiceExceptionUtil.exception(ORDER_IMPORT_DETAIL_VALID_ERROR, getRowIndexNotification() + errValue + NUMBER_TYPE_ERR); + throw new ServiceException(ORDER_IMPORT_DETAIL_VALID_ERROR, getRowIndexNotification() + errValue + NUMBER_TYPE_ERR); } } } @@ -754,13 +753,13 @@ public final class DefaultOrderImportExcelListener extends AnalysisEventListener if (Boolean.TRUE.equals(ToolUtil.convertToType(value, targetType))) { if (Boolean.TRUE.equals(checkPositiveNumber(value))) { if (!ToolUtil.checkPrecision(value, length, decimalLength)) { - throw ServiceExceptionUtil.exception(ORDER_IMPORT_DETAIL_VALID_ERROR, getRowIndexNotification() + errValue + NUMBER_LENGTH_ERR); + throw new ServiceException(ORDER_IMPORT_DETAIL_VALID_ERROR, getRowIndexNotification() + errValue + NUMBER_LENGTH_ERR); } } else { - throw ServiceExceptionUtil.exception(ORDER_IMPORT_DETAIL_VALID_ERROR, getRowIndexNotification() + errValue + "必须大于0"); + throw new ServiceException(ORDER_IMPORT_DETAIL_VALID_ERROR, getRowIndexNotification() + errValue + "必须大于0"); } } else { - throw ServiceExceptionUtil.exception(ORDER_IMPORT_DETAIL_VALID_ERROR, getRowIndexNotification() + errValue + NUMBER_TYPE_ERR); + throw new ServiceException(ORDER_IMPORT_DETAIL_VALID_ERROR, getRowIndexNotification() + errValue + NUMBER_TYPE_ERR); } } } @@ -768,7 +767,7 @@ public final class DefaultOrderImportExcelListener extends AnalysisEventListener // 判断非零,错误返回 private void isNotEmptyAndBack(String value, String errValue) { if (StringUtils.isEmpty(value)) { - throw ServiceExceptionUtil.exception(ORDER_IMPORT_DETAIL_VALID_ERROR, getRowIndexNotification() + errValue + NOT_EMPTY); + throw new ServiceException(ORDER_IMPORT_DETAIL_VALID_ERROR, getRowIndexNotification() + errValue + NOT_EMPTY); } } @@ -777,7 +776,7 @@ public final class DefaultOrderImportExcelListener extends AnalysisEventListener if (StringUtils.isNotEmpty(value)) { int size = value.length(); if (size > length) { - throw ServiceExceptionUtil.exception(ORDER_IMPORT_DETAIL_VALID_ERROR, getRowIndexNotification() + errValue + NUMBER_LENGTH_ERR); + throw new ServiceException(ORDER_IMPORT_DETAIL_VALID_ERROR, getRowIndexNotification() + errValue + NUMBER_LENGTH_ERR); } } } @@ -786,10 +785,10 @@ public final class DefaultOrderImportExcelListener extends AnalysisEventListener public void isEmptyAndPositiveNumber(String value, Class targetType, String errValue) { if (StringUtils.isNotEmpty(value)) { if (Boolean.FALSE.equals(ToolUtil.convertToType(value, targetType))) { - throw ServiceExceptionUtil.exception(ORDER_IMPORT_DETAIL_VALID_ERROR, getRowIndexNotification() + errValue + NUMBER_TYPE_ERR); + throw new ServiceException(ORDER_IMPORT_DETAIL_VALID_ERROR, getRowIndexNotification() + errValue + NUMBER_TYPE_ERR); } else { if (Boolean.FALSE.equals(checkPositiveNumber(value))) { - throw ServiceExceptionUtil.exception(ORDER_IMPORT_DETAIL_VALID_ERROR, getRowIndexNotification() + errValue + "数量必须大于0"); + throw new ServiceException(ORDER_IMPORT_DETAIL_VALID_ERROR, getRowIndexNotification() + errValue + "数量必须大于0"); } } } diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/util/fileConversion/admin/files/xml/DefaultOrderImportXmlParserHandler.java b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/util/fileConversion/admin/files/xml/DefaultOrderImportXmlParserHandler.java index 7bc130bea..d406f2772 100644 --- a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/util/fileConversion/admin/files/xml/DefaultOrderImportXmlParserHandler.java +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/util/fileConversion/admin/files/xml/DefaultOrderImportXmlParserHandler.java @@ -7,7 +7,7 @@ import cn.hutool.core.util.NumberUtil; import cn.hutool.core.util.ObjectUtil; import com.alibaba.excel.util.ListUtils; import com.alibaba.fastjson.JSON; -import com.cf.imes.framework.common.exception.util.ServiceExceptionUtil; +import com.cf.imes.framework.common.exception.ServiceException; import com.cf.imes.framework.common.util.json.JsonUtils; import com.cf.imes.framework.dict.core.util.DictFrameworkUtils; import com.cf.imes.framework.mybatis.core.generator.SnowFlakeGenerator; @@ -442,7 +442,7 @@ public class DefaultOrderImportXmlParserHandler { // 从标签属性生成order对象 OrderXmlVO orderXmlVO = getJavaBeanFromXmlAttr(OrderXmlVO.class, attributes); if (ObjectUtil.isNull(orderXmlVO)) { - throw ServiceExceptionUtil.exception(ORDER_IMPORT_DETAIL_VALID_ERROR, "生产单内容为空"); + throw new ServiceException(ORDER_IMPORT_DETAIL_VALID_ERROR, "生产单内容为空"); } // 校验属性 validOrderInfo(orderXmlVO); @@ -705,7 +705,7 @@ public class DefaultOrderImportXmlParserHandler { if (ObjectUtil.isNotNull(plateGoodDO)) { plate.setItemCode(plateGoodDO.getGoodsId()); } else { - throw ServiceExceptionUtil.exception(ORDER_IMPORT_PLATEGOODS_NOT_EXIST_VALID_ERROR, location.getLineNumber()); + throw new ServiceException(ORDER_IMPORT_PLATEGOODS_NOT_EXIST_VALID_ERROR, location.getLineNumber()); } } @@ -1067,7 +1067,7 @@ public class DefaultOrderImportXmlParserHandler { // 校验point数量 if (inGroove) { if (CollUtil.isEmpty(points)) { - throw ServiceExceptionUtil.exception(ORDER_IMPORT_DETAIL_VALID_ERROR, "原始造型(外)轮廓点阵列表不能为空"); + throw new ServiceException(ORDER_IMPORT_DETAIL_VALID_ERROR, "原始造型(外)轮廓点阵列表不能为空"); } grooveOutlineXmlVO.setPointXmlVOList(ListUtil.toList(points)); } else { @@ -1343,7 +1343,7 @@ public class DefaultOrderImportXmlParserHandler { private void endPoints() { // 校验point数量 if (ObjectUtil.isNotNull(pointXmlVOS) && CollUtil.isEmpty(points)) { - throw ServiceExceptionUtil.exception(ORDER_IMPORT_DETAIL_VALID_ERROR, inIslet ? "孤岛点阵列表不可为空" : "槽点坐标列表不可为空"); + throw new ServiceException(ORDER_IMPORT_DETAIL_VALID_ERROR, inIslet ? "孤岛点阵列表不可为空" : "槽点坐标列表不可为空"); } if (inGroove) { groovePointXmlVOS.setPointXmlVOList(ListUtil.toList(points)); @@ -1597,7 +1597,7 @@ public class DefaultOrderImportXmlParserHandler { } if (StringUtils.isEmpty(pointXmlVO.getItemCode())) { if (StringUtils.isEmpty(pointXmlVO.getEdgingColor()) || StringUtils.isEmpty(pointXmlVO.getEdgingMaterial())) { - throw ServiceExceptionUtil.exception(ORDER_IMPORT_DETAIL_VALID_ERROR, "当封边条没有物料编码时,封边条颜色、材质不可为空"); + throw new ServiceException(ORDER_IMPORT_DETAIL_VALID_ERROR, "当封边条没有物料编码时,封边条颜色、材质不可为空"); } } isEmptyAddAndPositiveNumber(pointXmlVO::getEdgingThickness, pointXmlVO::setEdgingThickness, "0", Double.class, "edgingThickness"); @@ -1718,7 +1718,7 @@ public class DefaultOrderImportXmlParserHandler { // 检查roomCode if (!bodyEmpty) { - throw ServiceExceptionUtil.exception(ORDER_IMPORT_BODYCODE_NOT_EXIST_VALID_ERROR, se, boxCode); + throw new ServiceException(ORDER_IMPORT_BODYCODE_NOT_EXIST_VALID_ERROR, se, boxCode); } String roomName = NOT_ASSIGNED; @@ -1729,7 +1729,7 @@ public class DefaultOrderImportXmlParserHandler { } else { // 检查roomCode if (!roomEmpty) { - throw ServiceExceptionUtil.exception(ORDER_IMPORT_ROOMCODE_NOT_EXIST_VALID_ERROR, se, roomCode); + throw new ServiceException(ORDER_IMPORT_ROOMCODE_NOT_EXIST_VALID_ERROR, se, roomCode); } } @@ -1768,7 +1768,7 @@ public class DefaultOrderImportXmlParserHandler { // } if (StringUtils.isNotEmpty(groupCodes) && !groupCodeSet.contains(groupCodes)) { - throw ServiceExceptionUtil.exception(ORDER_IMPORT_GROUPCODE_NOT_EXIST_VALID_ERROR, se, groupCodes); + throw new ServiceException(ORDER_IMPORT_GROUPCODE_NOT_EXIST_VALID_ERROR, se, groupCodes); } } @@ -1793,7 +1793,7 @@ public class DefaultOrderImportXmlParserHandler { */ private void validCustomOrderNo(String key, String val) { if (StringUtils.isNotEmpty(val) && !orderService.customOrderNoIsExists(val)) { - throw ServiceExceptionUtil.exception(ORDER_IMPORT_ORDER_CUSTOMERNO_EXISTS, key, val); + throw new ServiceException(ORDER_IMPORT_ORDER_CUSTOMERNO_EXISTS, key, val); } } @@ -1805,7 +1805,7 @@ public class DefaultOrderImportXmlParserHandler { */ private void validOrderInfoEmpty(String key, String val) { if (StringUtils.isEmpty(val)) { - throw ServiceExceptionUtil.exception(ORDER_IMPORT_ORDER_FIELD_EMPTY, key); + throw new ServiceException(ORDER_IMPORT_ORDER_FIELD_EMPTY, key); } } @@ -1818,7 +1818,7 @@ public class DefaultOrderImportXmlParserHandler { */ private void validOrderInfoLength(String key, String val, int length) { if (StringUtils.isNotEmpty(val) && length < val.length()) { - throw ServiceExceptionUtil.exception(ORDER_IMPORT_ORDER_FIELD_LENGTH_ERROR, key, length); + throw new ServiceException(ORDER_IMPORT_ORDER_FIELD_LENGTH_ERROR, key, length); } } @@ -1830,7 +1830,7 @@ public class DefaultOrderImportXmlParserHandler { */ private void validOrderInfoPhone(String key, String val) { if (StringUtils.isNotEmpty(val) && Boolean.FALSE.equals(ToolUtil.validatePhoneNumber(val))) { - throw ServiceExceptionUtil.exception(ORDER_IMPORT_ORDER_FIELD_MOBILE_FORMAT_ERROR, key); + throw new ServiceException(ORDER_IMPORT_ORDER_FIELD_MOBILE_FORMAT_ERROR, key); } } @@ -1844,7 +1844,7 @@ public class DefaultOrderImportXmlParserHandler { try { return LocalDateTimeUtil.parseDate(val, DateTimeFormatter.ofPattern("yyyy-MM-dd")); } catch (Exception e) { - throw ServiceExceptionUtil.exception(ORDER_IMPORT_ORDER_FIELD_DATE_FORMAT_ERROR, key); + throw new ServiceException(ORDER_IMPORT_ORDER_FIELD_DATE_FORMAT_ERROR, key); } } @@ -1872,10 +1872,10 @@ public class DefaultOrderImportXmlParserHandler { private void positiveNumber(String value, String name, Class targetType) { if (ToolUtil.convertToType(value, targetType)) { if (!ToolUtil.checkNumber(value)) { - throw ServiceExceptionUtil.exception(ORDER_IMPORT_DETAIL_VALID_ERROR, String.format(se.toString() + POSITIVE_ERR, name)); + throw new ServiceException(ORDER_IMPORT_DETAIL_VALID_ERROR, String.format(se.toString() + POSITIVE_ERR, name)); } } else { - throw ServiceExceptionUtil.exception(ORDER_IMPORT_DETAIL_VALID_ERROR, String.format(se.toString() + POSITIVE_ERR, name)); + throw new ServiceException(ORDER_IMPORT_DETAIL_VALID_ERROR, String.format(se.toString() + POSITIVE_ERR, name)); } } @@ -1924,13 +1924,13 @@ public class DefaultOrderImportXmlParserHandler { if (ToolUtil.convertToType(value, targetType)) { if (ToolUtil.checkNumber(value)) { if (!ToolUtil.checkPrecision(value, length, decimalLength)) { - throw ServiceExceptionUtil.exception(ORDER_IMPORT_DETAIL_VALID_ERROR, String.format(se.toString() + LONG_ERR, name)); + throw new ServiceException(ORDER_IMPORT_DETAIL_VALID_ERROR, String.format(se.toString() + LONG_ERR, name)); } } else { - throw ServiceExceptionUtil.exception(ORDER_IMPORT_DETAIL_VALID_ERROR, String.format(se.toString() + POSITIVE_ERR, name)); + throw new ServiceException(ORDER_IMPORT_DETAIL_VALID_ERROR, String.format(se.toString() + POSITIVE_ERR, name)); } } else { - throw ServiceExceptionUtil.exception(ORDER_IMPORT_DETAIL_VALID_ERROR, String.format(se.toString() + TYPE_ERR, name)); + throw new ServiceException(ORDER_IMPORT_DETAIL_VALID_ERROR, String.format(se.toString() + TYPE_ERR, name)); } } @@ -1967,7 +1967,7 @@ public class DefaultOrderImportXmlParserHandler { setter.accept(defaultValue); } else { if (!ToolUtil.convertToType(value.trim(), targetType)) { - throw ServiceExceptionUtil.exception(ORDER_IMPORT_DETAIL_VALID_ERROR, String.format(se.toString() + TYPE_ERR, name)); + throw new ServiceException(ORDER_IMPORT_DETAIL_VALID_ERROR, String.format(se.toString() + TYPE_ERR, name)); } } } @@ -1981,7 +1981,7 @@ public class DefaultOrderImportXmlParserHandler { private void isEmptyAndBack(Supplier getter, String name) { String value = getter.get(); if (StringUtils.isEmpty(value)) { - throw ServiceExceptionUtil.exception(ORDER_IMPORT_DETAIL_VALID_ERROR, String.format(se.toString() + IS_NULL, name)); + throw new ServiceException(ORDER_IMPORT_DETAIL_VALID_ERROR, String.format(se.toString() + IS_NULL, name)); } } @@ -2001,7 +2001,7 @@ public class DefaultOrderImportXmlParserHandler { } else { String dictData = DictFrameworkUtils.parseDictDataValue(dictTypeConstants, value.trim()); if (StringUtils.isEmpty(dictData)) { - throw ServiceExceptionUtil.exception(ORDER_IMPORT_DETAIL_VALID_ERROR, String.format(se.toString() + INVALID, name)); + throw new ServiceException(ORDER_IMPORT_DETAIL_VALID_ERROR, String.format(se.toString() + INVALID, name)); } } } @@ -2017,7 +2017,7 @@ public class DefaultOrderImportXmlParserHandler { private void isEmptyAndPositiveNumber(Supplier getter, String name, Consumer setter, Class targetType, Integer length, Integer decimalLength) { String value = getter.get(); if (StringUtils.isEmpty(value)) { - throw ServiceExceptionUtil.exception(ORDER_IMPORT_DETAIL_VALID_ERROR, String.format(se.toString() + IS_NULL, name)); + throw new ServiceException(ORDER_IMPORT_DETAIL_VALID_ERROR, String.format(se.toString() + IS_NULL, name)); } else { positiveNumberSize(value, setter, targetType, name, length, decimalLength); } @@ -2048,7 +2048,7 @@ public class DefaultOrderImportXmlParserHandler { private void isEmptyBackAndPositiveNumber(Supplier getter, String name, Class targetType) { String value = getter.get(); if (StringUtils.isEmpty(value)) { - throw ServiceExceptionUtil.exception(ORDER_IMPORT_DETAIL_VALID_ERROR, String.format(se.toString() + IS_NULL, name)); + throw new ServiceException(ORDER_IMPORT_DETAIL_VALID_ERROR, String.format(se.toString() + IS_NULL, name)); } else { positiveNumber(value, name, targetType); } @@ -2064,10 +2064,10 @@ public class DefaultOrderImportXmlParserHandler { private void isEmptyBackAndNumber(Supplier getter, Class targetType, String name) { String value = getter.get(); if (StringUtils.isEmpty(value)) { - throw ServiceExceptionUtil.exception(ORDER_IMPORT_DETAIL_VALID_ERROR, String.format(se.toString() + IS_NULL, name)); + throw new ServiceException(ORDER_IMPORT_DETAIL_VALID_ERROR, String.format(se.toString() + IS_NULL, name)); } else { if (!ToolUtil.convertToType(value.trim(), targetType)) { - throw ServiceExceptionUtil.exception(ORDER_IMPORT_DETAIL_VALID_ERROR, String.format(se.toString() + TYPE_ERR, name)); + throw new ServiceException(ORDER_IMPORT_DETAIL_VALID_ERROR, String.format(se.toString() + TYPE_ERR, name)); } } } @@ -2082,11 +2082,11 @@ public class DefaultOrderImportXmlParserHandler { private void isEmptyBackAndInvalid(Supplier getter, String dictTypeConstants, String name) { String value = getter.get(); if (com.alibaba.nacos.common.utils.StringUtils.isEmpty(value)) { - throw ServiceExceptionUtil.exception(ORDER_IMPORT_DETAIL_VALID_ERROR, String.format(se.toString() + IS_NULL, name)); + throw new ServiceException(ORDER_IMPORT_DETAIL_VALID_ERROR, String.format(se.toString() + IS_NULL, name)); } else { String dictData = DictFrameworkUtils.parseDictDataValue(dictTypeConstants, value.trim()); if (StringUtils.isEmpty(dictData)) { - throw ServiceExceptionUtil.exception(ORDER_IMPORT_DETAIL_VALID_ERROR, String.format(se.toString() + INVALID, name)); + throw new ServiceException(ORDER_IMPORT_DETAIL_VALID_ERROR, String.format(se.toString() + INVALID, name)); } } } diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/util/fileConversion/admin/files/xml/XMLUtil.java b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/util/fileConversion/admin/files/xml/XMLUtil.java index 85c2c9e3d..87e19147a 100644 --- a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/util/fileConversion/admin/files/xml/XMLUtil.java +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/util/fileConversion/admin/files/xml/XMLUtil.java @@ -2,7 +2,7 @@ package com.cf.imes.module.executor.util.fileConversion.admin.files.xml; import com.alibaba.nacos.common.utils.StringUtils; import com.alibaba.nacos.shaded.com.google.common.base.Function; -import com.cf.imes.framework.common.exception.util.ServiceExceptionUtil; +import com.cf.imes.framework.common.exception.ServiceException; import com.cf.imes.framework.organ.core.context.OrganContextHolder; import com.cf.imes.module.executor.dal.dataobject.order.OrderDO; import com.cf.imes.module.executor.dal.dataobject.plate.PlateGoodDO; @@ -108,7 +108,7 @@ public class XMLUtil { writer.write(xmlStr); writer.flush(); } catch (IOException e) { - throw ServiceExceptionUtil.exception(FILE_OUTPUT_ERROR, name); + throw new ServiceException(FILE_OUTPUT_ERROR, name); } } diff --git a/cf-module-prod-plan/cf-module-prod-plan-biz/src/main/java/com/cf/imes/module/plan/service/customplatenorule/BodyNoGenerateRuleServiceImpl.java b/cf-module-prod-plan/cf-module-prod-plan-biz/src/main/java/com/cf/imes/module/plan/service/customplatenorule/BodyNoGenerateRuleServiceImpl.java index 7eed37b8f..19aeee26e 100644 --- a/cf-module-prod-plan/cf-module-prod-plan-biz/src/main/java/com/cf/imes/module/plan/service/customplatenorule/BodyNoGenerateRuleServiceImpl.java +++ b/cf-module-prod-plan/cf-module-prod-plan-biz/src/main/java/com/cf/imes/module/plan/service/customplatenorule/BodyNoGenerateRuleServiceImpl.java @@ -5,7 +5,7 @@ import cn.hutool.core.util.ObjectUtil; import com.alibaba.fastjson.JSON; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; -import com.cf.imes.framework.common.exception.util.ServiceExceptionUtil; +import com.cf.imes.framework.common.exception.ServiceException; import com.cf.imes.framework.common.util.json.JsonUtils; import com.cf.imes.framework.organ.core.context.OrganContextHolder; import com.cf.imes.module.executor.api.customplateno.dto.CustomPlateNoRuleDTO; @@ -80,7 +80,7 @@ public class BodyNoGenerateRuleServiceImpl implements CustomPlateNoGenerateRuleS } else if (ObjectUtil.equal(ResetModeEnum.ROOM, resetModeEnum)) { generateConfig = generateNoByRoomResetMode(plateNoRule, generateConfig, plateDO); } else { - throw ServiceExceptionUtil.exception(CUSTOM_PLATENO_GENERATE_BODY_RULE_NOT_SUPPORT_RESETMODE, plateNoRule.getResetMode()); + throw new ServiceException(CUSTOM_PLATENO_GENERATE_BODY_RULE_NOT_SUPPORT_RESETMODE, plateNoRule.getResetMode()); } return generateConfig; } diff --git a/cf-module-prod-plan/cf-module-prod-plan-biz/src/main/java/com/cf/imes/module/plan/service/customplatenorule/OrderNoGenerateRuleServiceImpl.java b/cf-module-prod-plan/cf-module-prod-plan-biz/src/main/java/com/cf/imes/module/plan/service/customplatenorule/OrderNoGenerateRuleServiceImpl.java index 720f1bd5e..4364558d2 100644 --- a/cf-module-prod-plan/cf-module-prod-plan-biz/src/main/java/com/cf/imes/module/plan/service/customplatenorule/OrderNoGenerateRuleServiceImpl.java +++ b/cf-module-prod-plan/cf-module-prod-plan-biz/src/main/java/com/cf/imes/module/plan/service/customplatenorule/OrderNoGenerateRuleServiceImpl.java @@ -4,7 +4,7 @@ import cn.hutool.core.util.ObjectUtil; import com.alibaba.fastjson.JSON; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; -import com.cf.imes.framework.common.exception.util.ServiceExceptionUtil; +import com.cf.imes.framework.common.exception.ServiceException; import com.cf.imes.framework.common.util.json.JsonUtils; import com.cf.imes.framework.organ.core.context.OrganContextHolder; import com.cf.imes.module.executor.api.customplateno.dto.CustomPlateNoRuleDTO; @@ -131,7 +131,7 @@ public class OrderNoGenerateRuleServiceImpl implements CustomPlateNoGenerateRule } else if (ObjectUtil.equal(ResetModeEnum.DAY, resetModeEnum)) { orderNoSeq = resetByDay(orderNoSeq, orgCustomPlateNoSeqRespDTO, plateNoRule); } else { - throw ServiceExceptionUtil.exception(CUSTOM_PLATENO_GENERATE_ORDERNO_RULE_NOT_SUPPORT_RESETMODE, plateNoRule.getResetMode()); + throw new ServiceException(CUSTOM_PLATENO_GENERATE_ORDERNO_RULE_NOT_SUPPORT_RESETMODE, plateNoRule.getResetMode()); } return orderNoSeq; } diff --git a/cf-module-prod-plan/cf-module-prod-plan-biz/src/main/java/com/cf/imes/module/plan/service/customplatenorule/PlateNoGenerateRuleServiceImpl.java b/cf-module-prod-plan/cf-module-prod-plan-biz/src/main/java/com/cf/imes/module/plan/service/customplatenorule/PlateNoGenerateRuleServiceImpl.java index 1f22b3d00..45621ff5a 100644 --- a/cf-module-prod-plan/cf-module-prod-plan-biz/src/main/java/com/cf/imes/module/plan/service/customplatenorule/PlateNoGenerateRuleServiceImpl.java +++ b/cf-module-prod-plan/cf-module-prod-plan-biz/src/main/java/com/cf/imes/module/plan/service/customplatenorule/PlateNoGenerateRuleServiceImpl.java @@ -5,7 +5,7 @@ import cn.hutool.core.util.ObjectUtil; import com.alibaba.fastjson.JSON; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; -import com.cf.imes.framework.common.exception.util.ServiceExceptionUtil; +import com.cf.imes.framework.common.exception.ServiceException; import com.cf.imes.framework.common.util.json.JsonUtils; import com.cf.imes.framework.organ.core.context.OrganContextHolder; import com.cf.imes.module.executor.api.customplateno.dto.CustomPlateNoRuleDTO; @@ -82,7 +82,7 @@ public class PlateNoGenerateRuleServiceImpl implements CustomPlateNoGenerateRule } else if (ObjectUtil.equal(ResetModeEnum.YEAR, resetModeEnum) || ObjectUtil.equal(ResetModeEnum.MONTH, resetModeEnum) || ObjectUtil.equal(ResetModeEnum.DAY, resetModeEnum)) { return generateNoByDateResetMode(resetModeEnum, plateNoRule, generateConfig, plateDO); } else { - throw ServiceExceptionUtil.exception(CUSTOM_PLATENO_GENERATE_PLATE_RULE_NOT_SUPPORT_RESETMODE, plateNoRule.getResetMode()); + throw new ServiceException(CUSTOM_PLATENO_GENERATE_PLATE_RULE_NOT_SUPPORT_RESETMODE, plateNoRule.getResetMode()); } } diff --git a/cf-module-prod-plan/cf-module-prod-plan-biz/src/main/java/com/cf/imes/module/plan/service/orderImport/OrderImportTaskService.java b/cf-module-prod-plan/cf-module-prod-plan-biz/src/main/java/com/cf/imes/module/plan/service/orderImport/OrderImportTaskService.java index 54f3e653d..67ac79bf4 100644 --- a/cf-module-prod-plan/cf-module-prod-plan-biz/src/main/java/com/cf/imes/module/plan/service/orderImport/OrderImportTaskService.java +++ b/cf-module-prod-plan/cf-module-prod-plan-biz/src/main/java/com/cf/imes/module/plan/service/orderImport/OrderImportTaskService.java @@ -7,22 +7,6 @@ import com.cf.imes.module.plan.dal.dataobject.orderImport.OrderImportTaskDO; * @since 2025/5/13 16:41 */ public interface OrderImportTaskService { - /** - * 更新业务异常状态 - * - * @param taskId - * @param organId - * @param serviceExceptionMessage - */ - void updateServiceExceptionTaskStatus(Long taskId, Long organId, String serviceExceptionMessage); - - /** - * 更新异常状态 - * - * @param taskId - * @param organId - */ - void updateExceptionTaskStatus(Long taskId, Long organId); /** * 确认导入任务,更新任务状态 diff --git a/cf-module-prod-plan/cf-module-prod-plan-biz/src/main/java/com/cf/imes/module/plan/service/orderImport/OrderImportTaskServiceImpl.java b/cf-module-prod-plan/cf-module-prod-plan-biz/src/main/java/com/cf/imes/module/plan/service/orderImport/OrderImportTaskServiceImpl.java index e703d9981..fdbd1346e 100644 --- a/cf-module-prod-plan/cf-module-prod-plan-biz/src/main/java/com/cf/imes/module/plan/service/orderImport/OrderImportTaskServiceImpl.java +++ b/cf-module-prod-plan/cf-module-prod-plan-biz/src/main/java/com/cf/imes/module/plan/service/orderImport/OrderImportTaskServiceImpl.java @@ -13,8 +13,6 @@ import org.springframework.transaction.annotation.Transactional; import jakarta.annotation.Resource; -import static com.cf.imes.module.plan.enums.ErrorCodeConstants.ORDER_IMPORT_FAIL; - /** * @author Gqr * @since 2025/5/13 16:41 @@ -25,26 +23,6 @@ public class OrderImportTaskServiceImpl implements OrderImportTaskService { @Resource private OrderImportTaskMapper orderImportTaskMapper; - @Override - @Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Exception.class) - public void updateServiceExceptionTaskStatus(Long taskId, Long organId, String serviceExceptionMessage) { - orderImportTaskMapper.update(new LambdaUpdateWrapper().eq(OrderImportTaskDO::getId, taskId) - .set(OrderImportTaskDO::getStatus, OrderImportTaskStatusEnum.CONSUME_SUCCESS.getStatus()) - .set(OrderImportTaskDO::getImportStatus, OrderImportStatusEnum.IMPORT_FAIL.getStatus()) - .set(OrderImportTaskDO::getOrganId, organId) - .set(OrderImportTaskDO::getResult, serviceExceptionMessage)); - } - - @Override - @Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Exception.class) - public void updateExceptionTaskStatus(Long taskId, Long organId) { - orderImportTaskMapper.update(new LambdaUpdateWrapper().eq(OrderImportTaskDO::getId, taskId) - .set(OrderImportTaskDO::getStatus, OrderImportTaskStatusEnum.CONSUME_SUCCESS.getStatus()) - .set(OrderImportTaskDO::getImportStatus, OrderImportStatusEnum.IMPORT_FAIL.getStatus()) - .set(OrderImportTaskDO::getOrganId, organId) - .set(OrderImportTaskDO::getResult, ORDER_IMPORT_FAIL.getMsg())); - } - @Override @Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Exception.class) public OrderImportTaskDO confirmOrderImport(Long taskId) { diff --git a/cf-module-prod-plan/cf-module-prod-plan-biz/src/main/java/com/cf/imes/module/plan/service/orderImport/WebCadOrderImportServiceImpl.java b/cf-module-prod-plan/cf-module-prod-plan-biz/src/main/java/com/cf/imes/module/plan/service/orderImport/WebCadOrderImportServiceImpl.java index d784a3f76..27f9982b6 100644 --- a/cf-module-prod-plan/cf-module-prod-plan-biz/src/main/java/com/cf/imes/module/plan/service/orderImport/WebCadOrderImportServiceImpl.java +++ b/cf-module-prod-plan/cf-module-prod-plan-biz/src/main/java/com/cf/imes/module/plan/service/orderImport/WebCadOrderImportServiceImpl.java @@ -8,7 +8,6 @@ import com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.cf.imes.framework.common.exception.ErrorCode; import com.cf.imes.framework.common.exception.ServiceException; -import com.cf.imes.framework.common.exception.util.ServiceExceptionUtil; import com.cf.imes.framework.id.core.util.SnowflakeIdWorker3rd; import com.cf.imes.framework.mq.rabbitmq.constant.RabbitMqConstants; import com.cf.imes.framework.mybatis.core.generator.SnowFlakeGenerator; @@ -47,10 +46,8 @@ import org.springframework.amqp.core.Message; import org.springframework.amqp.core.MessageBuilder; import org.springframework.amqp.rabbit.core.RabbitTemplate; import org.springframework.jdbc.core.JdbcTemplate; -import org.springframework.jdbc.datasource.DataSourceTransactionManager; import org.springframework.stereotype.Service; -import org.springframework.transaction.TransactionDefinition; -import org.springframework.transaction.TransactionStatus; +import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.support.TransactionSynchronization; import org.springframework.transaction.support.TransactionSynchronizationManager; import org.springframework.web.multipart.MultipartFile; @@ -61,7 +58,6 @@ import java.io.File; import java.io.IOException; import java.util.zip.GZIPInputStream; -import static com.cf.imes.framework.security.core.util.SecurityFrameworkUtils.getUserOrganId; import static com.cf.imes.module.executor.enums.ErrorCodeConstants.ORDER_IMPORT_ORGAN_LOCK_ERROR; import static com.cf.imes.module.plan.enums.ErrorCodeConstants.WEBCAD_ORDER_IMPORT_FAILED; import static com.cf.imes.module.plan.enums.ErrorCodeConstants.WEBCAD_ORDER_IMPORT_ORGANID_EMPTY_ERROR; @@ -110,9 +106,6 @@ public class WebCadOrderImportServiceImpl implements WebCadOrderImportService { @Resource private RawGoodsMapper rawGoodsMapper; - @Resource - private DataSourceTransactionManager transactionManager; - @Resource private SystemConfigApi systemConfigApi; @@ -131,6 +124,7 @@ public class WebCadOrderImportServiceImpl implements WebCadOrderImportService { private WebCadImportProperties webCadImportProperties; @Override + @Transactional(rollbackFor = Exception.class) public boolean webCadOrderImport(MultipartFile file) { Long organId = OrganContextHolder.getOrganId(); @@ -138,13 +132,9 @@ public class WebCadOrderImportServiceImpl implements WebCadOrderImportService { throw new ServiceException(WEBCAD_ORDER_IMPORT_ORGANID_EMPTY_ERROR); } - TransactionStatus transactionStatus = transactionManager.getTransaction(TransactionDefinition.withDefaults()); // 是否同步处理 boolean sync = true; - // 异步发送是否成功,没有成功需要把锁解开 - boolean initAsyncSuccess = false; - Long taskId = null; OrderDO orderDO = null; JsonFactory factory = new JsonFactory(); @@ -193,14 +183,9 @@ public class WebCadOrderImportServiceImpl implements WebCadOrderImportService { // 缓存请求,创建导入任务 taskId = initiateTask(node, organId, orderDO.getId(), fileName); - // 上锁 - addAsyncLock(taskId); - // 发送异步消息 sendMessage(taskId); - initAsyncSuccess = true; - // 跳过当前 blockData 解析步骤 parser.skipChildren(); // 忽略 blockData } @@ -208,18 +193,12 @@ public class WebCadOrderImportServiceImpl implements WebCadOrderImportService { parser.skipChildren(); // 忽略其他字段 } } - // 事务提交 - transactionManager.commit(transactionStatus); } catch (ServiceException se) { - // 事务回滚 - transactionManager.rollback(transactionStatus); // 移除临时文件 removeCacheFileWhenException(sync, taskId); throw se; } catch (Exception e) { - // 事务回滚 - transactionManager.rollback(transactionStatus); // 移除临时文件 removeCacheFileWhenException(sync, taskId); @@ -227,7 +206,8 @@ public class WebCadOrderImportServiceImpl implements WebCadOrderImportService { log.error(webcadOrderImportFailed.getMsg(), e); throw new ServiceException(webcadOrderImportFailed); } finally { - unlock(sync, initAsyncSuccess, organId, taskId); + // 同步解锁 + unlock(sync, organId); } return sync; } @@ -244,7 +224,7 @@ public class WebCadOrderImportServiceImpl implements WebCadOrderImportService { .eq(OrderDO::getOrganId, organId) .eq(OrderDO::getDeleted, false)); if (ObjectUtil.isNull(orderDOFromOrderNo)) { - throw ServiceExceptionUtil.exception(WEBCAD_ORDER_NOT_EXISTS_ERROR, orderNo); + throw new ServiceException(WEBCAD_ORDER_NOT_EXISTS_ERROR, orderNo); } else { Integer status = orderDOFromOrderNo.getStatus(); // 更新生产单来源为webcad @@ -332,32 +312,13 @@ public class WebCadOrderImportServiceImpl implements WebCadOrderImportService { } } - /** - * 加异步导入锁 - * - * @param taskId - */ - private void addAsyncLock(Long taskId) { - String importLockKey = String.format(RedisKeyConstants.ORDER_IMPORT_LOCK_KEY, getUserOrganId()); - // 检查机构导入锁 - boolean lockResult = redisLockUtil.acquireLock(importLockKey, String.valueOf(taskId), chenfengCacheProperties.getLockTimeout()); - if (!lockResult) { - throw new ServiceException(ORDER_IMPORT_ORGAN_LOCK_ERROR); - } - } - /** * 解锁 */ - private void unlock(boolean sync, boolean initAsyncSuccess, Long organId, Long taskId) { - if(sync) { + private void unlock(boolean sync, Long organId) { + if (sync) { // 解同步锁 redisLockUtil.releaseLock(String.format(RedisKeyConstants.ORDER_IMPORT_LOCK_KEY, organId), REDIS_UNIQUEKEY); - } else { - // 异步发送消息失败了,解开异步锁 - if (!initAsyncSuccess && ObjectUtil.isNotNull(taskId)) { - redisLockUtil.releaseLock(String.format(RedisKeyConstants.ORDER_IMPORT_LOCK_KEY, organId), String.valueOf(taskId)); - } } } diff --git a/cf-module-prod-plan/cf-module-prod-plan-biz/src/main/java/com/cf/imes/module/plan/service/orderImport/consumer/DefaultExcelOrderImportConsumer.java b/cf-module-prod-plan/cf-module-prod-plan-biz/src/main/java/com/cf/imes/module/plan/service/orderImport/consumer/DefaultExcelOrderImportConsumer.java index 9bd88c2f7..7477a5852 100644 --- a/cf-module-prod-plan/cf-module-prod-plan-biz/src/main/java/com/cf/imes/module/plan/service/orderImport/consumer/DefaultExcelOrderImportConsumer.java +++ b/cf-module-prod-plan/cf-module-prod-plan-biz/src/main/java/com/cf/imes/module/plan/service/orderImport/consumer/DefaultExcelOrderImportConsumer.java @@ -53,7 +53,6 @@ import java.time.LocalDate; import java.util.Objects; import java.util.Optional; -import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception; import static com.cf.imes.module.executor.enums.ErrorCodeConstants.ORDER_IMPORT_ORDER_NOT_EXISTS; import static com.cf.imes.module.executor.enums.ErrorCodeConstants.ORDER_IMPORT_ORGAN_LOCK_ERROR; import static com.cf.imes.module.plan.enums.ErrorCodeConstants.ORDER_IMPORT_FAIL; @@ -144,14 +143,14 @@ public class DefaultExcelOrderImportConsumer { organId = OrganContextHolder.getOrganId(); if (ObjectUtil.isNull(organId)) { - throw exception(ORDER_IMPORT_ORGANID_NOT_EXISTS); + throw new ServiceException(ORDER_IMPORT_ORGANID_NOT_EXISTS); } // 检查机构导入锁 String importLockKey = String.format(RedisKeyConstants.ORDER_IMPORT_LOCK_KEY, organId); lockResult = redisLockUtil.acquireLock(importLockKey, String.valueOf(taskId), chenfengCacheProperties.getLockTimeout()); if (!lockResult) { - throw exception(ORDER_IMPORT_ORGAN_LOCK_ERROR); + throw new ServiceException(ORDER_IMPORT_ORGAN_LOCK_ERROR); } // 确认任务,更新状态为消费成功,没有找到任务中断后续消费 @@ -225,7 +224,7 @@ public class DefaultExcelOrderImportConsumer { Long existOrderId = orderImportTempDataDO.getOrderId(); // 校验生产单id OrderDO orderDO = orderMapper.selectById(existOrderId); - Optional.ofNullable(orderDO).orElseThrow(() -> exception(ORDER_IMPORT_ORDER_NOT_EXISTS, existOrderId)); + Optional.ofNullable(orderDO).orElseThrow(() -> new ServiceException(ORDER_IMPORT_ORDER_NOT_EXISTS, existOrderId)); // 更新补板生产单属性 updateOrder(orderDO); return orderDO; diff --git a/cf-module-prod-plan/cf-module-prod-plan-biz/src/main/java/com/cf/imes/module/plan/service/orderImport/consumer/DefaultXmlOrderImportConsumer.java b/cf-module-prod-plan/cf-module-prod-plan-biz/src/main/java/com/cf/imes/module/plan/service/orderImport/consumer/DefaultXmlOrderImportConsumer.java index 3045d50c8..f8cd01514 100644 --- a/cf-module-prod-plan/cf-module-prod-plan-biz/src/main/java/com/cf/imes/module/plan/service/orderImport/consumer/DefaultXmlOrderImportConsumer.java +++ b/cf-module-prod-plan/cf-module-prod-plan-biz/src/main/java/com/cf/imes/module/plan/service/orderImport/consumer/DefaultXmlOrderImportConsumer.java @@ -7,7 +7,6 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.cf.imes.framework.common.enums.OrderPackageStatusEnum; import com.cf.imes.framework.common.exception.ServiceException; -import com.cf.imes.framework.common.exception.util.ServiceExceptionUtil; import com.cf.imes.framework.common.util.json.JsonUtils; import com.cf.imes.framework.id.core.util.SnowflakeIdWorker3rd; import com.cf.imes.framework.mq.rabbitmq.constant.RabbitMqConstants; @@ -53,7 +52,7 @@ import java.time.LocalDate; import java.util.Objects; import java.util.Optional; -import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception; + import static com.cf.imes.module.executor.enums.ErrorCodeConstants.ORDER_IMPORT_ORDER_NOT_EXISTS; import static com.cf.imes.module.executor.enums.ErrorCodeConstants.ORDER_IMPORT_ORGAN_LOCK_ERROR; import static com.cf.imes.module.plan.enums.ErrorCodeConstants.ORDER_IMPORT_FAIL; @@ -141,14 +140,14 @@ public class DefaultXmlOrderImportConsumer { organId = OrganContextHolder.getOrganId(); if (ObjectUtil.isNull(organId)) { - throw ServiceExceptionUtil.exception(ORDER_IMPORT_ORGANID_NOT_EXISTS); + throw new ServiceException(ORDER_IMPORT_ORGANID_NOT_EXISTS); } // 检查机构导入锁 String importLockKey = String.format(RedisKeyConstants.ORDER_IMPORT_LOCK_KEY, organId); lockResult = redisLockUtil.acquireLock(importLockKey, String.valueOf(taskId), chenfengCacheProperties.getLockTimeout()); if (!lockResult) { - throw exception(ORDER_IMPORT_ORGAN_LOCK_ERROR); + throw new ServiceException(ORDER_IMPORT_ORGAN_LOCK_ERROR); } // 确认任务,更新状态为消费成功,没有找到任务中断后续消费 @@ -222,7 +221,7 @@ public class DefaultXmlOrderImportConsumer { Long existOrderId = orderImportTempDataDO.getOrderId(); // 校验生产单id OrderDO orderDO = orderMapper.selectById(existOrderId); - Optional.ofNullable(orderDO).orElseThrow(() -> ServiceExceptionUtil.exception(ORDER_IMPORT_ORDER_NOT_EXISTS, existOrderId)); + Optional.ofNullable(orderDO).orElseThrow(() -> new ServiceException(ORDER_IMPORT_ORDER_NOT_EXISTS, existOrderId)); // 更新补板生产单属性 updateOrder(orderDO); return orderDO; diff --git a/cf-module-prod-plan/cf-module-prod-plan-biz/src/main/java/com/cf/imes/module/plan/service/orderImport/consumer/OrderImportDeadLetterConsumer.java b/cf-module-prod-plan/cf-module-prod-plan-biz/src/main/java/com/cf/imes/module/plan/service/orderImport/consumer/OrderImportDeadLetterConsumer.java index 416c6fc2d..cf88fb783 100644 --- a/cf-module-prod-plan/cf-module-prod-plan-biz/src/main/java/com/cf/imes/module/plan/service/orderImport/consumer/OrderImportDeadLetterConsumer.java +++ b/cf-module-prod-plan/cf-module-prod-plan-biz/src/main/java/com/cf/imes/module/plan/service/orderImport/consumer/OrderImportDeadLetterConsumer.java @@ -3,7 +3,7 @@ package com.cf.imes.module.plan.service.orderImport.consumer; import cn.hutool.core.util.ObjectUtil; import com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; -import com.cf.imes.framework.common.exception.util.ServiceExceptionUtil; +import com.cf.imes.framework.common.exception.ServiceException; import com.cf.imes.framework.organ.core.context.OrganContextHolder; import com.cf.imes.framework.redis.constants.RedisKeyConstants; import com.cf.imes.framework.redis.util.RedisLockUtil; @@ -57,7 +57,7 @@ public class OrderImportDeadLetterConsumer { channel.basicAck(deliveryTag, false); if (StringUtils.isEmpty(peek)) { - throw ServiceExceptionUtil.exception(WEBCAD_ORDER_IMPORT_PEEK_NOT_EXIST_ERROR); + throw new ServiceException(WEBCAD_ORDER_IMPORT_PEEK_NOT_EXIST_ERROR); } else { DynamicDataSourceContextHolder.push(peek); } diff --git a/cf-module-prod-plan/cf-module-prod-plan-biz/src/main/java/com/cf/imes/module/plan/service/orderImport/consumer/WebCadOrderImportConsumer.java b/cf-module-prod-plan/cf-module-prod-plan-biz/src/main/java/com/cf/imes/module/plan/service/orderImport/consumer/WebCadOrderImportConsumer.java index dce6797b3..239fff10e 100644 --- a/cf-module-prod-plan/cf-module-prod-plan-biz/src/main/java/com/cf/imes/module/plan/service/orderImport/consumer/WebCadOrderImportConsumer.java +++ b/cf-module-prod-plan/cf-module-prod-plan-biz/src/main/java/com/cf/imes/module/plan/service/orderImport/consumer/WebCadOrderImportConsumer.java @@ -2,13 +2,12 @@ package com.cf.imes.module.plan.service.orderImport.consumer; import cn.hutool.core.util.ObjectUtil; import com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.cf.imes.framework.common.exception.ServiceException; -import com.cf.imes.framework.common.exception.util.ServiceExceptionUtil; import com.cf.imes.framework.id.core.util.SnowflakeIdWorker3rd; import com.cf.imes.framework.mybatis.core.generator.SnowFlakeGenerator; import com.cf.imes.framework.organ.core.context.OrganContextHolder; +import com.cf.imes.framework.redis.config.ChenfengCacheProperties; import com.cf.imes.framework.redis.constants.RedisKeyConstants; import com.cf.imes.framework.redis.util.RedisLockUtil; import com.cf.imes.module.executor.enums.OrderImportStatusEnum; @@ -33,15 +32,14 @@ import org.springframework.amqp.rabbit.annotation.RabbitListener; import org.springframework.amqp.support.AmqpHeaders; import org.springframework.beans.factory.annotation.Value; import org.springframework.jdbc.core.JdbcTemplate; -import org.springframework.jdbc.datasource.DataSourceTransactionManager; import org.springframework.messaging.handler.annotation.Header; import org.springframework.stereotype.Component; -import org.springframework.transaction.TransactionDefinition; -import org.springframework.transaction.TransactionStatus; import org.thymeleaf.util.StringUtils; import jakarta.annotation.Resource; + +import static com.cf.imes.module.executor.enums.ErrorCodeConstants.ORDER_IMPORT_ORGAN_LOCK_ERROR; import static com.cf.imes.module.plan.enums.ErrorCodeConstants.ORDER_IMPORT_FAIL; import static com.cf.imes.module.plan.enums.ErrorCodeConstants.ORDER_IMPORT_ORGANID_NOT_EXISTS; import static com.cf.imes.module.plan.enums.ErrorCodeConstants.WEBCAD_ORDER_IMPORT_PEEK_NOT_EXIST_ERROR; @@ -107,7 +105,7 @@ public class WebCadOrderImportConsumer { private WebCadImportProperties webCadImportProperties; @Resource - private DataSourceTransactionManager transactionManager; + private ChenfengCacheProperties chenfengCacheProperties; @RabbitListener(queues = "#{@orderImportWebCadQueueName}") public void orderImport(String message, @@ -118,27 +116,36 @@ public class WebCadOrderImportConsumer { Long organId = null; Long taskId = Long.parseLong(message); - boolean nackSent = false; - TransactionStatus transactionStatus = null; + boolean lockResult = true; + OrderImportTaskDO orderImportTaskDO = null; try { + // 手动确认消息接收 + channel.basicAck(deliveryTag, false); + organId = OrganContextHolder.getOrganId(); if (ObjectUtil.isNull(organId)) { - throw ServiceExceptionUtil.exception(ORDER_IMPORT_ORGANID_NOT_EXISTS); + throw new ServiceException(ORDER_IMPORT_ORGANID_NOT_EXISTS); } if (StringUtils.isEmpty(peek)) { - throw ServiceExceptionUtil.exception(WEBCAD_ORDER_IMPORT_PEEK_NOT_EXIST_ERROR); + throw new ServiceException(WEBCAD_ORDER_IMPORT_PEEK_NOT_EXIST_ERROR); } else { DynamicDataSourceContextHolder.push(peek); } - // 获取事务 - transactionStatus = transactionManager.getTransaction(TransactionDefinition.withDefaults()); + // 检查机构导入锁 + String importLockKey = String.format(RedisKeyConstants.ORDER_IMPORT_LOCK_KEY, organId); + lockResult = redisLockUtil.acquireLock(importLockKey, String.valueOf(taskId), chenfengCacheProperties.getLockTimeout()); + if (!lockResult) { + throw new ServiceException(ORDER_IMPORT_ORGAN_LOCK_ERROR); + } + // 确认任务,更新状态为消费成功,没有找到任务中断后续消费 - OrderImportTaskDO orderImportTaskDO = confirmOrderImport(taskId, organId); + orderImportTaskDO = orderImportTaskService.confirmOrderImport(taskId); if (ObjectUtil.isNull(orderImportTaskDO)) { return; } + log.info("====================【webcad异步拆单处理临时数据开始】===================="); WebCadOrderImportAsyncFactory webCadOrderImportAsyncFactory = new WebCadOrderImportAsyncFactory(organId, orderMapper, snowFlakeGenerator, orderBodyMapper, plateMapper, orderGroupMapper, idWorker, @@ -146,89 +153,42 @@ public class WebCadOrderImportConsumer { webCadOrderImportAsyncFactory.analyzeTempData(taskId, webCadImportProperties.getTempFilePath()); log.info("====================【webcad异步拆单处理临时数据结束】===================="); - // 提交事务 - transactionManager.commit(transactionStatus); - } catch (ServiceException se) { - String seMessage = se.getMessage(); - log.error(seMessage); - // 回滚事务 - if (transactionStatus != null) { - transactionManager.rollback(transactionStatus); - } - - // 更新任务状态 - orderImportTaskService.updateServiceExceptionTaskStatus(taskId, organId, seMessage); - - nackSent = true; - // 确认消息进入死信队列 - channel.basicNack(deliveryTag, false, false); } catch (Exception e) { log.error(ORDER_IMPORT_FAIL.getMsg(), e); - // 回滚事务 - if (transactionStatus != null) { - transactionManager.rollback(transactionStatus); - } - - // 更新任务状态 - orderImportTaskService.updateExceptionTaskStatus(taskId, organId); - - nackSent = true; - // 确认消息进入死信队列 - channel.basicNack(deliveryTag, false, false); + updateImportTaskFail(orderImportTaskDO, e); + throw e; } finally { - // 手动确认消息接收 - if (!nackSent) { - channel.basicAck(deliveryTag, false); + if (lockResult) { + // 导入锁解锁 + redisLockUtil.releaseLock(String.format(RedisKeyConstants.ORDER_IMPORT_LOCK_KEY, organId), message); } - // 导入锁解锁 - redisLockUtil.releaseLock(String.format(RedisKeyConstants.ORDER_IMPORT_LOCK_KEY, organId), message); } } /** - * 确认导入任务,更新任务状态 + * 更新导入任务为失败 * - * @param taskId + * @param orderImportTaskDO + * @param ex */ - private OrderImportTaskDO confirmOrderImport(Long taskId, Long organId) { - boolean taskExist = false; - OrderImportTaskDO orderImportTaskDO = null; - // 线程每1s查询一次,查三次没有就提示任务不存在 - for (int i = 0; i < 3; i++) { - orderImportTaskDO = orderImportTaskMapper.selectOne(new LambdaQueryWrapper() - .eq(OrderImportTaskDO::getId, taskId) - .eq(OrderImportTaskDO::getOrganId, organId)); - if (ObjectUtil.isNotNull(orderImportTaskDO)) { - taskExist = true; - break; - } else { - try { - Thread.sleep(1000); - } catch (InterruptedException e) { - log.error("====================【线程中断异常】===================="); - } - } + public void updateImportTaskFail(OrderImportTaskDO orderImportTaskDO, Exception ex) { + if (orderImportTaskDO == null) { + return; } - if (taskExist) { - // 更新状态为消费成功 - orderImportTaskMapper.update(new LambdaUpdateWrapper() - .eq(OrderImportTaskDO::getId, taskId) - .eq(OrderImportTaskDO::getOrganId, organId) - .set(OrderImportTaskDO::getStatus, OrderImportTaskStatusEnum.CONSUME_SUCCESS.getStatus())); + String msg; + if (ex instanceof ServiceException) { + msg = ex.getMessage(); } else { - String taskNotExistNotify = String.format("%s不存在的导入任务,消费中止", taskId); - // 更新状态为消费成功,导入失败 - orderImportTaskMapper.update( - new LambdaUpdateWrapper() - .eq(OrderImportTaskDO::getId, taskId) - .eq(OrderImportTaskDO::getOrganId, organId) - .set(OrderImportTaskDO::getStatus, OrderImportTaskStatusEnum.CONSUME_SUCCESS.getStatus()) - .set(OrderImportTaskDO::getImportStatus, OrderImportStatusEnum.IMPORT_FAIL.getStatus()) - .set(OrderImportTaskDO::getResult, taskNotExistNotify) - ); - log.error(String.format("====================【%s】====================", taskNotExistNotify)); + msg = ORDER_IMPORT_FAIL.getMsg(); } - return orderImportTaskDO; + orderImportTaskMapper.update( + new LambdaUpdateWrapper() + .eq(OrderImportTaskDO::getId, orderImportTaskDO.getId()) + .set(OrderImportTaskDO::getStatus, OrderImportTaskStatusEnum.CREATE_RECEIVE.getStatus()) + .set(OrderImportTaskDO::getImportStatus, OrderImportStatusEnum.IMPORT_FAIL.getStatus()) + .set(OrderImportTaskDO::getResult, msg) + .set(OrderImportTaskDO::getRetryCount, orderImportTaskDO.getRetryCount() + 1) + ); } } diff --git a/cf-module-prod-plan/cf-module-prod-plan-biz/src/main/java/com/cf/imes/module/plan/service/orderImport/factory/DefaultExcelOrderImportFactory.java b/cf-module-prod-plan/cf-module-prod-plan-biz/src/main/java/com/cf/imes/module/plan/service/orderImport/factory/DefaultExcelOrderImportFactory.java index e5a165025..3f02ef436 100644 --- a/cf-module-prod-plan/cf-module-prod-plan-biz/src/main/java/com/cf/imes/module/plan/service/orderImport/factory/DefaultExcelOrderImportFactory.java +++ b/cf-module-prod-plan/cf-module-prod-plan-biz/src/main/java/com/cf/imes/module/plan/service/orderImport/factory/DefaultExcelOrderImportFactory.java @@ -12,7 +12,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.cf.imes.framework.common.enums.OrderPlateTypeEnum; -import com.cf.imes.framework.common.exception.util.ServiceExceptionUtil; +import com.cf.imes.framework.common.exception.ServiceException; import com.cf.imes.framework.common.util.json.JsonUtils; import com.cf.imes.framework.id.core.util.SnowflakeIdWorker3rd; import com.cf.imes.framework.mybatis.core.generator.SnowFlakeGenerator; @@ -816,7 +816,7 @@ public class DefaultExcelOrderImportFactory { // 查询大板id用于小板轮廓goodsId GoodsDO goodsDO = goodsMapper.selectById(goodsId); if (ObjectUtil.isNull(goodsDO)) { - throw ServiceExceptionUtil.exception(ORDER_IMPORT_PLATE_GOODS_NOT_EXISTS, orderId, goodsId); + throw new ServiceException(ORDER_IMPORT_PLATE_GOODS_NOT_EXISTS, orderId, goodsId); } orderModelDO.setGoodsId(goodsDO.getGoodsId()); orderModelDO.setPlateGoodsId(goodsId); @@ -955,7 +955,7 @@ public class DefaultExcelOrderImportFactory { // // 查询大板id用于小板轮廓goodsId // GoodsDO goodsDO = goodsMapper.selectById(goodsId); // if (ObjectUtil.isNull(goodsDO)) { -// throw ServiceExceptionUtil.exception(ORDER_IMPORT_PLATE_GOODS_NOT_EXISTS, orderId, goodsId); +// throw new ServiceException(ORDER_IMPORT_PLATE_GOODS_NOT_EXISTS, orderId, goodsId); // } // orderModelDO.setGoodsId(goodsDO.getGoodsId()); // orderModelDO.setPlateGoodsId(goodsId); @@ -1332,7 +1332,7 @@ public class DefaultExcelOrderImportFactory { // 存在大板 goodsDO.setGoodsId(plateGoodDO.getGoodsId()); } else { - throw ServiceExceptionUtil.exception(ORDER_IMPORT_PLATE_GOODS_NOMATCH_ERROR, goodsId, goodsName, material, color, thickness, brand); + throw new ServiceException(ORDER_IMPORT_PLATE_GOODS_NOMATCH_ERROR, goodsId, goodsName, material, color, thickness, brand); } } @@ -1400,7 +1400,7 @@ public class DefaultExcelOrderImportFactory { .set(OrderDO::getArea, currentPlateArea) .set(OrderDO::getVersion, version + 1)); if (updated == 0) { - throw ServiceExceptionUtil.exception(ErrorCodeConstants.WEBCAD_ORDER_IMPORT_ORDER_UPDATE_CONCURRENCY_ERROR, orderId); + throw new ServiceException(ErrorCodeConstants.WEBCAD_ORDER_IMPORT_ORDER_UPDATE_CONCURRENCY_ERROR, orderId); } } diff --git a/cf-module-prod-plan/cf-module-prod-plan-biz/src/main/java/com/cf/imes/module/plan/service/orderImport/factory/DefaultXmlOrderImportFactory.java b/cf-module-prod-plan/cf-module-prod-plan-biz/src/main/java/com/cf/imes/module/plan/service/orderImport/factory/DefaultXmlOrderImportFactory.java index f5a8c0aea..e1950d572 100644 --- a/cf-module-prod-plan/cf-module-prod-plan-biz/src/main/java/com/cf/imes/module/plan/service/orderImport/factory/DefaultXmlOrderImportFactory.java +++ b/cf-module-prod-plan/cf-module-prod-plan-biz/src/main/java/com/cf/imes/module/plan/service/orderImport/factory/DefaultXmlOrderImportFactory.java @@ -12,7 +12,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import com.cf.imes.framework.common.exception.util.ServiceExceptionUtil; +import com.cf.imes.framework.common.exception.ServiceException; import com.cf.imes.framework.common.util.json.JsonUtils; import com.cf.imes.framework.dict.core.util.DictFrameworkUtils; import com.cf.imes.framework.id.core.util.SnowflakeIdWorker3rd; @@ -660,7 +660,7 @@ public class DefaultXmlOrderImportFactory { // 查询大板id用于小板轮廓goodsId GoodsDO goodsDO = goodsMapper.selectById(goodsId); - Optional.ofNullable(goodsDO).orElseThrow(() -> ServiceExceptionUtil.exception(ORDER_IMPORT_PLATE_GOODS_NOT_EXISTS, orderId, goodsId)); + Optional.ofNullable(goodsDO).orElseThrow(() -> new ServiceException(ORDER_IMPORT_PLATE_GOODS_NOT_EXISTS, orderId, goodsId)); orderModelDO.setGoodsId(goodsDO.getGoodsId()); orderModelDO.setPlateGoodsId(goodsId); orderModelDO.setOrganId(organId); @@ -1956,7 +1956,7 @@ public class DefaultXmlOrderImportFactory { .set(OrderDO::getArea, currentPlateArea) .set(OrderDO::getVersion, version + 1)); if (updated == 0) { - throw ServiceExceptionUtil.exception(ErrorCodeConstants.WEBCAD_ORDER_IMPORT_ORDER_UPDATE_CONCURRENCY_ERROR, orderId); + throw new ServiceException(ErrorCodeConstants.WEBCAD_ORDER_IMPORT_ORDER_UPDATE_CONCURRENCY_ERROR, orderId); } } diff --git a/cf-module-prod-plan/cf-module-prod-plan-biz/src/main/java/com/cf/imes/module/plan/service/orderImport/factory/WebCadOrderImportAsyncFactory.java b/cf-module-prod-plan/cf-module-prod-plan-biz/src/main/java/com/cf/imes/module/plan/service/orderImport/factory/WebCadOrderImportAsyncFactory.java index 68ed056b4..ebe7cff48 100644 --- a/cf-module-prod-plan/cf-module-prod-plan-biz/src/main/java/com/cf/imes/module/plan/service/orderImport/factory/WebCadOrderImportAsyncFactory.java +++ b/cf-module-prod-plan/cf-module-prod-plan-biz/src/main/java/com/cf/imes/module/plan/service/orderImport/factory/WebCadOrderImportAsyncFactory.java @@ -15,7 +15,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.cf.imes.framework.common.exception.ErrorCode; -import com.cf.imes.framework.common.exception.util.ServiceExceptionUtil; +import com.cf.imes.framework.common.exception.ServiceException; import com.cf.imes.framework.common.pojo.CommonResult; import com.cf.imes.framework.id.core.util.SnowflakeIdWorker3rd; import com.cf.imes.framework.mybatis.core.generator.SnowFlakeGenerator; @@ -347,10 +347,10 @@ public class WebCadOrderImportAsyncFactory { } catch (Exception e) { ErrorCode webcadOrderImportOrgSealedgeAnalyzeError = WEBCAD_ORDER_IMPORT_ORG_SEALEDGE_ANALYZE_ERROR; log.error(webcadOrderImportOrgSealedgeAnalyzeError.getMsg(), e); - throw ServiceExceptionUtil.exception(webcadOrderImportOrgSealedgeAnalyzeError); + throw new ServiceException(webcadOrderImportOrgSealedgeAnalyzeError); } } else { - throw ServiceExceptionUtil.exception(WEBCAD_ORDER_IMPORT_GET_ORG_SEALEDGE_ERROR); + throw new ServiceException(WEBCAD_ORDER_IMPORT_GET_ORG_SEALEDGE_ERROR); } } @@ -366,7 +366,7 @@ public class WebCadOrderImportAsyncFactory { .eq(OrderDO::getOrganId, organId) .eq(OrderDO::getDeleted, false)); if (ObjectUtil.isNull(orderDOFromOrderNo)) { - throw ServiceExceptionUtil.exception(WEBCAD_ORDER_NOT_EXISTS_ERROR, orderNo); + throw new ServiceException(WEBCAD_ORDER_NOT_EXISTS_ERROR, orderNo); } else { Integer status = orderDOFromOrderNo.getStatus(); // 更新生产单来源为webcad @@ -389,7 +389,7 @@ public class WebCadOrderImportAsyncFactory { ); // cadImportPlateNumThreshold片阻止继续拆单 if (existPlateCount >= cadImportPlateNumThreshold) { - throw ServiceExceptionUtil.exception(WEBCAD_ORDER_IMPORT_ORDER_PLATENUM_CHECK_ERROR, orderId, cadImportPlateNumThreshold); + throw new ServiceException(WEBCAD_ORDER_IMPORT_ORDER_PLATENUM_CHECK_ERROR, orderId, cadImportPlateNumThreshold); } else { currentPlateNum = existPlateCount.intValue(); // 统计当前板件总面积 @@ -2150,7 +2150,7 @@ public class WebCadOrderImportAsyncFactory { .set(OrderDO::getArea, currentPlateArea) .set(OrderDO::getVersion, version + 1)); if (updated == 0) { - throw ServiceExceptionUtil.exception(ErrorCodeConstants.WEBCAD_ORDER_IMPORT_ORDER_UPDATE_CONCURRENCY_ERROR, orderId); + throw new ServiceException(ErrorCodeConstants.WEBCAD_ORDER_IMPORT_ORDER_UPDATE_CONCURRENCY_ERROR, orderId); } } @@ -2182,7 +2182,7 @@ public class WebCadOrderImportAsyncFactory { .set(GoodsDO::getPlateNum, updateDo.getPlateNum()) .set(GoodsDO::getVersion, updateDo.getVersion() + 1)); if (updated == 0) { - throw ServiceExceptionUtil.exception(ErrorCodeConstants.WEBCAD_ORDER_IMPORT_GOODS_UPDATE_CONCURRENCY_ERROR, updateDo.getId()); + throw new ServiceException(ErrorCodeConstants.WEBCAD_ORDER_IMPORT_GOODS_UPDATE_CONCURRENCY_ERROR, updateDo.getId()); } } } diff --git a/cf-module-prod-plan/cf-module-prod-plan-biz/src/main/java/com/cf/imes/module/plan/service/orderImport/factory/WebCadOrderImportFactory.java b/cf-module-prod-plan/cf-module-prod-plan-biz/src/main/java/com/cf/imes/module/plan/service/orderImport/factory/WebCadOrderImportFactory.java index 12bf29cb4..80569620f 100644 --- a/cf-module-prod-plan/cf-module-prod-plan-biz/src/main/java/com/cf/imes/module/plan/service/orderImport/factory/WebCadOrderImportFactory.java +++ b/cf-module-prod-plan/cf-module-prod-plan-biz/src/main/java/com/cf/imes/module/plan/service/orderImport/factory/WebCadOrderImportFactory.java @@ -13,7 +13,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.cf.imes.framework.common.exception.ErrorCode; -import com.cf.imes.framework.common.exception.util.ServiceExceptionUtil; +import com.cf.imes.framework.common.exception.ServiceException; import com.cf.imes.framework.common.pojo.CommonResult; import com.cf.imes.framework.id.core.util.SnowflakeIdWorker3rd; import com.cf.imes.framework.mybatis.core.generator.SnowFlakeGenerator; @@ -267,7 +267,7 @@ public class WebCadOrderImportFactory { customPlateNoGenerateService.updateCustomPlateNoGenerateConfig(plateNoGenerateConfigVO, orderDO); if (plateNumReachThreshold) { - log.warn(ServiceExceptionUtil.exception(WEBCAD_ORDER_IMPORT_ORDER_PLATENUM_REACH_THRESHOLD_ERROR, orderId, cadImportPlateNumThreshold).getMessage()); + log.warn(new ServiceException(WEBCAD_ORDER_IMPORT_ORDER_PLATENUM_REACH_THRESHOLD_ERROR, orderId, cadImportPlateNumThreshold).getMessage()); } } catch (Exception e) { @@ -313,10 +313,10 @@ public class WebCadOrderImportFactory { } catch (Exception e) { ErrorCode webcadOrderImportOrgSealedgeAnalyzeError = WEBCAD_ORDER_IMPORT_ORG_SEALEDGE_ANALYZE_ERROR; log.error(webcadOrderImportOrgSealedgeAnalyzeError.getMsg(), e); - throw ServiceExceptionUtil.exception(webcadOrderImportOrgSealedgeAnalyzeError); + throw new ServiceException(webcadOrderImportOrgSealedgeAnalyzeError); } } else { - throw ServiceExceptionUtil.exception(WEBCAD_ORDER_IMPORT_GET_ORG_SEALEDGE_ERROR); + throw new ServiceException(WEBCAD_ORDER_IMPORT_GET_ORG_SEALEDGE_ERROR); } } @@ -334,7 +334,7 @@ public class WebCadOrderImportFactory { ); // cadImportPlateNumThreshold万片阻止继续拆单 if (existPlateCount >= cadImportPlateNumThreshold) { - throw ServiceExceptionUtil.exception(WEBCAD_ORDER_IMPORT_ORDER_PLATENUM_CHECK_ERROR, orderId, cadImportPlateNumThreshold); + throw new ServiceException(WEBCAD_ORDER_IMPORT_ORDER_PLATENUM_CHECK_ERROR, orderId, cadImportPlateNumThreshold); } else { currentPlateNum = existPlateCount.intValue(); // 统计当前板件总面积 @@ -2015,7 +2015,7 @@ public class WebCadOrderImportFactory { .set(OrderDO::getArea, currentPlateArea) .set(OrderDO::getVersion, version + 1)); if (updated == 0) { - throw ServiceExceptionUtil.exception(ErrorCodeConstants.WEBCAD_ORDER_IMPORT_ORDER_UPDATE_CONCURRENCY_ERROR, orderId); + throw new ServiceException(ErrorCodeConstants.WEBCAD_ORDER_IMPORT_ORDER_UPDATE_CONCURRENCY_ERROR, orderId); } } @@ -2047,7 +2047,7 @@ public class WebCadOrderImportFactory { .set(GoodsDO::getPlateNum, updateDo.getPlateNum()) .set(GoodsDO::getVersion, updateDo.getVersion() + 1)); if (updated == 0) { - throw ServiceExceptionUtil.exception(ErrorCodeConstants.WEBCAD_ORDER_IMPORT_GOODS_UPDATE_CONCURRENCY_ERROR, updateDo.getId()); + throw new ServiceException(ErrorCodeConstants.WEBCAD_ORDER_IMPORT_GOODS_UPDATE_CONCURRENCY_ERROR, updateDo.getId()); } } } diff --git a/cf-module-report/cf-module-report-biz/src/main/java/com/cf/imes/module/report/service/dataset/ReportDatasetServiceImpl.java b/cf-module-report/cf-module-report-biz/src/main/java/com/cf/imes/module/report/service/dataset/ReportDatasetServiceImpl.java index 7dcee2870..6acfed079 100644 --- a/cf-module-report/cf-module-report-biz/src/main/java/com/cf/imes/module/report/service/dataset/ReportDatasetServiceImpl.java +++ b/cf-module-report/cf-module-report-biz/src/main/java/com/cf/imes/module/report/service/dataset/ReportDatasetServiceImpl.java @@ -1,6 +1,7 @@ package com.cf.imes.module.report.service.dataset; import cn.hutool.core.util.ObjectUtil; +import com.cf.imes.framework.common.exception.ServiceException; import com.cf.imes.framework.common.util.object.BeanUtils; import com.cf.imes.framework.mybatis.core.generator.SnowFlakeGenerator; import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX; @@ -18,7 +19,6 @@ import org.springframework.validation.annotation.Validated; import jakarta.annotation.Resource; import java.util.List; -import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception; import static com.cf.imes.module.report.enums.ErrorCodeConstants.DATASET_NOT_EXISTS; import static com.cf.imes.module.report.enums.ErrorCodeConstants.DATASOURCE_BUILDIN_OPERATION_PERMISSION_ERROR; import static com.cf.imes.module.report.enums.ErrorCodeConstants.DATASOURCE_NOT_EXISTS; @@ -82,7 +82,7 @@ public class ReportDatasetServiceImpl implements ReportDatasetService { private ReportDatasetDO validateDatasetExists(Long id) { ReportDatasetDO reportDatasetDO = datasetMapper.selectById(id); if (ObjectUtil.isNull(reportDatasetDO)) { - throw exception(DATASET_NOT_EXISTS); + throw new ServiceException(DATASET_NOT_EXISTS); } else { return reportDatasetDO; } @@ -103,11 +103,11 @@ public class ReportDatasetServiceImpl implements ReportDatasetService { reportDatasourceDO = reportDatasourceMapper.selectNormalDatasourceById(datasourceId, SecurityFrameworkUtils.getUserOrganId()); } if (ObjectUtil.isNull(reportDatasourceDO)) { - throw exception(DATASOURCE_NOT_EXISTS); + throw new ServiceException(DATASOURCE_NOT_EXISTS); } // 非超管不能操作内置模板 if (ReportTemplateTypeEnum.SYSTEM.equals(reportDatasourceDO.getBuildinType()) && Boolean.FALSE.equals(superAdmin)) { - throw exception(DATASOURCE_BUILDIN_OPERATION_PERMISSION_ERROR); + throw new ServiceException(DATASOURCE_BUILDIN_OPERATION_PERMISSION_ERROR); } return reportDatasourceDO; } diff --git a/cf-module-report/cf-module-report-biz/src/main/java/com/cf/imes/module/report/service/datasource/ReportDatasourceServiceImpl.java b/cf-module-report/cf-module-report-biz/src/main/java/com/cf/imes/module/report/service/datasource/ReportDatasourceServiceImpl.java index 1a001eaa0..97328ec0f 100644 --- a/cf-module-report/cf-module-report-biz/src/main/java/com/cf/imes/module/report/service/datasource/ReportDatasourceServiceImpl.java +++ b/cf-module-report/cf-module-report-biz/src/main/java/com/cf/imes/module/report/service/datasource/ReportDatasourceServiceImpl.java @@ -15,7 +15,6 @@ import com.bstek.ureport.definition.dataset.Parameter; import com.bstek.ureport.definition.dataset.SqlDatasetDefinition; import com.bstek.ureport.utils.ProcedureUtils; import com.cf.imes.framework.common.exception.ServiceException; -import com.cf.imes.framework.common.exception.util.ServiceExceptionUtil; import com.cf.imes.framework.common.util.object.BeanUtils; import com.cf.imes.framework.mybatis.core.generator.SnowFlakeGenerator; import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX; @@ -54,7 +53,6 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception; import static com.cf.imes.module.report.enums.ErrorCodeConstants.DATASET_GET_FIELDS_ERROR; import static com.cf.imes.module.report.enums.ErrorCodeConstants.DATASET_SQL_INJECTION_RISK; import static com.cf.imes.module.report.enums.ErrorCodeConstants.DATASET_SQL_REQUIRED; @@ -214,10 +212,10 @@ public class ReportDatasourceServiceImpl implements ReportDatasourceService { } } catch (BeansException e) { log.error("[ReportDatasourceService][loadBeanMethods]获取bean失败", e); - throw ServiceExceptionUtil.exception(DATASOURCE_SPRINGBEAN_GET_FAIL, beanId); + throw new ServiceException(DATASOURCE_SPRINGBEAN_GET_FAIL, beanId); } catch (Exception e) { log.error("[ReportDatasourceService][loadBeanMethods]方法列表获取异常", e); - throw ServiceExceptionUtil.exception(DATASOURCE_SPRINGBEAN_METHODS_GET_FAIL); + throw new ServiceException(DATASOURCE_SPRINGBEAN_METHODS_GET_FAIL); } return result; } @@ -230,7 +228,7 @@ public class ReportDatasourceServiceImpl implements ReportDatasourceService { DataSourceInfo info = previewParams.getInfo(); try { if (StringUtils.isEmpty(sql)) { - throw exception(DATASET_SQL_REQUIRED); + throw new ServiceException(DATASET_SQL_REQUIRED); } // 获取数据库连接 conn = MultipleJdbcTemplate.buildConnection(info); @@ -238,7 +236,7 @@ public class ReportDatasourceServiceImpl implements ReportDatasourceService { for (Parameter parameter : parameters) { // mybatis-plus util检查参数 if (SqlInjectionUtils.check(parameter.getDefaultValue())) { - throw exception(DATASET_SQL_INJECTION_RISK); + throw new ServiceException(DATASET_SQL_INJECTION_RISK); } } // 准备sql执行参数 @@ -317,7 +315,7 @@ public class ReportDatasourceServiceImpl implements ReportDatasourceService { private ReportDatasourceDO validateDatasourceExists(Long id) { ReportDatasourceDO reportDatasourceDO = datasourceMapper.selectNormalDatasourceById(id, SecurityFrameworkUtils.getUserOrganId()); if (reportDatasourceDO == null) { - throw exception(DATASOURCE_NOT_EXISTS); + throw new ServiceException(DATASOURCE_NOT_EXISTS); } else { return reportDatasourceDO; } @@ -331,7 +329,7 @@ public class ReportDatasourceServiceImpl implements ReportDatasourceService { private void validateSystemDatasource(Integer buildinType) { // 非超管不能操作内置模板 if (ReportTemplateTypeEnum.SYSTEM.getType().equals(buildinType) && Boolean.FALSE.equals(SecurityFrameworkUtils.isSuperAdmin())) { - throw exception(DATASOURCE_BUILDIN_OPERATION_PERMISSION_ERROR); + throw new ServiceException(DATASOURCE_BUILDIN_OPERATION_PERMISSION_ERROR); } } } diff --git a/cf-module-report/cf-module-report-biz/src/main/java/com/cf/imes/module/report/service/template/ReportTemplateServiceImpl.java b/cf-module-report/cf-module-report-biz/src/main/java/com/cf/imes/module/report/service/template/ReportTemplateServiceImpl.java index ae7f373a6..56e99709c 100644 --- a/cf-module-report/cf-module-report-biz/src/main/java/com/cf/imes/module/report/service/template/ReportTemplateServiceImpl.java +++ b/cf-module-report/cf-module-report-biz/src/main/java/com/cf/imes/module/report/service/template/ReportTemplateServiceImpl.java @@ -41,7 +41,6 @@ import com.bstek.ureport.parser.ReportParser; import com.bstek.ureport.utils.ToolUtils; import com.cf.imes.framework.common.exception.ServiceException; import com.cf.imes.framework.common.exception.enums.GlobalErrorCodeConstants; -import com.cf.imes.framework.common.exception.util.ServiceExceptionUtil; import com.cf.imes.framework.common.util.object.BeanUtils; import com.cf.imes.framework.mybatis.core.generator.SnowFlakeGenerator; import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX; @@ -87,7 +86,6 @@ import java.util.Optional; import java.util.Set; import java.util.stream.Collectors; -import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception; import static com.cf.imes.module.report.enums.ErrorCodeConstants.TEMPLATE_BUILDIN_OPERATION_PERMISSION_ERROR; import static com.cf.imes.module.report.enums.ErrorCodeConstants.TEMPLATE_IMPORT_CONTENT_EMPTY_ERROR; import static com.cf.imes.module.report.enums.ErrorCodeConstants.TEMPLATE_NAME_UNIQE_ERROR; @@ -258,7 +256,7 @@ public class ReportTemplateServiceImpl implements ReportTemplateService { boolean isSuperAdmin = SecurityFrameworkUtils.isSuperAdmin(); // 非超管不能操作内置模板 if (ReportTemplateTypeEnum.SYSTEM.equals(templateDO.getType()) && !isSuperAdmin) { - throw exception(TEMPLATE_BUILDIN_OPERATION_PERMISSION_ERROR); + throw new ServiceException(TEMPLATE_BUILDIN_OPERATION_PERMISSION_ERROR); } } @@ -280,7 +278,7 @@ public class ReportTemplateServiceImpl implements ReportTemplateService { reportTemplateDO = templateMapper.selectNormalTemplateById(id, loginUser.getOrganId()); } if (ObjectUtil.isNull(reportTemplateDO)) { - throw exception(TEMPLATE_NOT_EXISTS); + throw new ServiceException(TEMPLATE_NOT_EXISTS); } else { return reportTemplateDO; } @@ -304,7 +302,7 @@ public class ReportTemplateServiceImpl implements ReportTemplateService { wrapper.eq(ReportTemplateDO::getType, ReportTemplateTypeEnum.SYSTEM); } if (templateMapper.exists(wrapper)) { - throw exception(TEMPLATE_NAME_UNIQE_ERROR, name); + throw new ServiceException(TEMPLATE_NAME_UNIQE_ERROR, name); } } @@ -418,7 +416,7 @@ public class ReportTemplateServiceImpl implements ReportTemplateService { for (Map.Entry entry : queryMap.entrySet()) { String key = entry.getKey(); if (ObjectUtils.isEmpty(entry.getValue()) && ObjectUtil.notEqual(key, DATASETIDS_FIELD_NAME) && ObjectUtil.notEqual(key, DATASOURCEIDS_FIELD_NAME)) { - throw ServiceExceptionUtil.exception(TEMPLATE_PREIVEW_QUERYPARAM_EMPTY, key); + throw new ServiceException(TEMPLATE_PREIVEW_QUERYPARAM_EMPTY, key); } } } @@ -517,12 +515,12 @@ public class ReportTemplateServiceImpl implements ReportTemplateService { // 查询模板 ReportTemplateDO reportTemplateDO = validateTemplateExists(reqVO.getTemplateId()); if (ObjectUtil.isNull(reportTemplateDO)) { - throw exception(TEMPLATE_NOT_EXISTS); + throw new ServiceException(TEMPLATE_NOT_EXISTS); } // 检查模板内容 String content = reportTemplateDO.getContent(); if (StringUtils.isEmpty(content)) { - throw exception(TEMPLATE_PREVIEW_TEMPLATE_CONTENT_EMPTY_ERROR); + throw new ServiceException(TEMPLATE_PREVIEW_TEMPLATE_CONTENT_EMPTY_ERROR); } // 自定义请求vo转ureport对象 PreviewParameters params = BeanUtils.toBean(reqVO, PreviewParameters.class); @@ -574,7 +572,7 @@ public class ReportTemplateServiceImpl implements ReportTemplateService { if (inputComponent instanceof TextInputComponent) { Object bindValue = parameters.get(bindParameter); if (parameters.containsKey(bindParameter) && ObjectUtil.isNotNull(bindValue) && StringUtils.isEmpty(String.valueOf(bindValue))) { - throw ServiceExceptionUtil.exception(TEMPLATE_PREIVEW_QUERYPARAM_EMPTY, bindParameter); + throw new ServiceException(TEMPLATE_PREIVEW_QUERYPARAM_EMPTY, bindParameter); } } } @@ -625,12 +623,12 @@ public class ReportTemplateServiceImpl implements ReportTemplateService { // 查询模板 ReportTemplateDO reportTemplateDO = validateTemplateExists(reqVO.getTemplateId()); if (ObjectUtil.isNull(reportTemplateDO)) { - throw exception(TEMPLATE_NOT_EXISTS); + throw new ServiceException(TEMPLATE_NOT_EXISTS); } // 检查模板内容 String content = reportTemplateDO.getContent(); if (StringUtils.isEmpty(content)) { - throw exception(TEMPLATE_PREVIEW_TEMPLATE_CONTENT_EMPTY_ERROR); + throw new ServiceException(TEMPLATE_PREVIEW_TEMPLATE_CONTENT_EMPTY_ERROR); } // 自定义请求vo转ureport对象 PreviewParameters params = BeanUtils.toBean(reqVO, PreviewParameters.class); @@ -711,12 +709,12 @@ public class ReportTemplateServiceImpl implements ReportTemplateService { // 查询模板 ReportTemplateDO reportTemplateDO = validateTemplateExists(reqVO.getTemplateId()); if (ObjectUtil.isNull(reportTemplateDO)) { - throw exception(TEMPLATE_NOT_EXISTS); + throw new ServiceException(TEMPLATE_NOT_EXISTS); } // 检查模板内容 String content = reportTemplateDO.getContent(); if (StringUtils.isEmpty(content)) { - throw exception(TEMPLATE_PREVIEW_TEMPLATE_CONTENT_EMPTY_ERROR); + throw new ServiceException(TEMPLATE_PREVIEW_TEMPLATE_CONTENT_EMPTY_ERROR); } // 自定义请求vo转ureport对象 PreviewParameters params = BeanUtils.toBean(reqVO, PreviewParameters.class); @@ -758,7 +756,7 @@ public class ReportTemplateServiceImpl implements ReportTemplateService { public void exportTemplate(Long templateId, HttpServletResponse response) { ReportTemplateDO reportTemplateDO = validateTemplateExists(templateId); if (ObjectUtil.isNull(reportTemplateDO)) { - throw exception(TEMPLATE_NOT_EXISTS); + throw new ServiceException(TEMPLATE_NOT_EXISTS); } PrintWriter writer = null; try { diff --git a/cf-module-system/cf-module-system-api/src/main/java/com/cf/imes/module/system/enums/ErrorCodeConstants.java b/cf-module-system/cf-module-system-api/src/main/java/com/cf/imes/module/system/enums/ErrorCodeConstants.java index d474af2a8..a92f546f7 100644 --- a/cf-module-system/cf-module-system-api/src/main/java/com/cf/imes/module/system/enums/ErrorCodeConstants.java +++ b/cf-module-system/cf-module-system-api/src/main/java/com/cf/imes/module/system/enums/ErrorCodeConstants.java @@ -10,118 +10,118 @@ import com.cf.imes.framework.common.exception.ErrorCode; public class ErrorCodeConstants { // ========== AUTH 模块 1-002-000-000 ========== - public static final ErrorCode AUTH_LOGIN_BAD_CREDENTIALS = new ErrorCode(1_002_000_000, "登录失败,账号密码不正确"); - public static final ErrorCode AUTH_LOGIN_USER_DISABLED = new ErrorCode(1_002_000_001, "登录失败,账号被禁用"); - public static final ErrorCode AUTH_LOGIN_CAPTCHA_CODE_ERROR = new ErrorCode(1_002_000_004, "验证码不正确,原因:{}"); - public static final ErrorCode AUTH_THIRD_LOGIN_NOT_BIND = new ErrorCode(1_002_000_005, "未绑定账号,需要进行绑定"); - public static final ErrorCode AUTH_MOBILE_NOT_EXISTS = new ErrorCode(1_002_000_006, "手机号不存在"); - public static final ErrorCode AUTH_MOBILE_NO_CHANGE = new ErrorCode(1_002_000_007, "手机号未发生改变,无需修改"); - public static final ErrorCode AUTH_MANAGEENDPOINT_LOGIN_PERMISSION_ERROR = new ErrorCode(1_002_000_008, "登录失败,管理端账号不存在"); + public static final ErrorCode AUTH_LOGIN_BAD_CREDENTIALS = new ErrorCode(1_002_000_000, "auth.login.bad_credentials"); + public static final ErrorCode AUTH_LOGIN_USER_DISABLED = new ErrorCode(1_002_000_001, "auth.login.user_disabled"); + public static final ErrorCode AUTH_LOGIN_CAPTCHA_CODE_ERROR = new ErrorCode(1_002_000_004, "auth.login.captcha_code_error"); + public static final ErrorCode AUTH_THIRD_LOGIN_NOT_BIND = new ErrorCode(1_002_000_005, "auth.login.third_not_bind"); + public static final ErrorCode AUTH_MOBILE_NOT_EXISTS = new ErrorCode(1_002_000_006, "auth.mobile.not_exists"); + public static final ErrorCode AUTH_MOBILE_NO_CHANGE = new ErrorCode(1_002_000_007, "auth.mobile.no_change"); + public static final ErrorCode AUTH_MANAGEENDPOINT_LOGIN_PERMISSION_ERROR = new ErrorCode(1_002_000_008, "auth.manage_endpoint.login_permission_error"); // ========== 菜单模块 1-002-001-000 ========== - public static final ErrorCode MENU_NAME_DUPLICATE = new ErrorCode(1_002_001_000, "已经存在该名字的菜单"); - public static final ErrorCode MENU_PARENT_NOT_EXISTS = new ErrorCode(1_002_001_001, "父菜单不存在"); - public static final ErrorCode MENU_PARENT_ERROR = new ErrorCode(1_002_001_002, "不能设置自己为父菜单"); - public static final ErrorCode MENU_NOT_EXISTS = new ErrorCode(1_002_001_003, "菜单不存在"); - public static final ErrorCode MENU_EXISTS_CHILDREN = new ErrorCode(1_002_001_004, "存在子菜单,无法删除"); - public static final ErrorCode MENU_PARENT_NOT_DIR_OR_MENU = new ErrorCode(1_002_001_005, "父菜单的类型必须是目录或者菜单"); - public static final ErrorCode MANAGEMENT_MENU_OPERATION_PERMISSION_ERROR = new ErrorCode(1_002_001_006, "管理端菜单操作权限不足"); - public static final ErrorCode MENU_TRANS_ERROR = new ErrorCode(1_002_001_007, "菜单翻译异常,error_code :{}"); + public static final ErrorCode MENU_NAME_DUPLICATE = new ErrorCode(1_002_001_000, "menu.name.duplicate"); + public static final ErrorCode MENU_PARENT_NOT_EXISTS = new ErrorCode(1_002_001_001, "menu.parent.not_exists"); + public static final ErrorCode MENU_PARENT_ERROR = new ErrorCode(1_002_001_002, "menu.parent.error"); + public static final ErrorCode MENU_NOT_EXISTS = new ErrorCode(1_002_001_003, "menu.not_exists"); + public static final ErrorCode MENU_EXISTS_CHILDREN = new ErrorCode(1_002_001_004, "menu.exists_children"); + public static final ErrorCode MENU_PARENT_NOT_DIR_OR_MENU = new ErrorCode(1_002_001_005, "menu.parent.not_dir_or_menu"); + public static final ErrorCode MANAGEMENT_MENU_OPERATION_PERMISSION_ERROR = new ErrorCode(1_002_001_006, "menu.operation_permission_error"); + public static final ErrorCode MENU_TRANS_ERROR = new ErrorCode(1_002_001_007, "menu.trans_error"); // ========== 角色模块 1-002-002-000 ========== - public static final ErrorCode ROLE_NOT_EXISTS = new ErrorCode(1_002_002_000, "角色不存在"); - public static final ErrorCode ROLE_NAME_DUPLICATE = new ErrorCode(1_002_002_001, "已经存在名为【{}】的角色"); - public static final ErrorCode ROLE_CODE_DUPLICATE = new ErrorCode(1_002_002_002, "已经存在编码为【{}】的角色"); - public static final ErrorCode ROLE_CAN_NOT_UPDATE_SYSTEM_TYPE_ROLE = new ErrorCode(1_002_002_003, "不能操作类型为系统内置的角色"); - public static final ErrorCode ROLE_IS_DISABLE = new ErrorCode(1_002_002_004, "名字为【{}】的角色已被禁用"); - public static final ErrorCode ROLE_ADMIN_CODE_ERROR = new ErrorCode(1_002_002_005, "编码【{}】不能使用"); - public static final ErrorCode ROLE_ME_ERROR = new ErrorCode(1_002_002_006, "不可为自身分配角色"); - public static final ErrorCode ROLE_NOT_SUPERADMIN_NO_ORGAN_ID_OPER_ERROR = new ErrorCode(1_002_002_007, "非超管分配权限"); - public static final ErrorCode BUILDIN_ROLE_MODIFY_PERMISSION_ERROR = new ErrorCode(1_002_002_008, "修改内置角色下菜单权限的权限不足"); - public static final ErrorCode SELF_ROLE_MODIFY_PERMISSION_ERROR = new ErrorCode(1_002_002_009, "无法修改自身的角色菜单权限"); - public static final ErrorCode SELF_ROLE_MODIFY_ERROR = new ErrorCode(1_002_002_010, "无法修改自身的角色"); + public static final ErrorCode ROLE_NOT_EXISTS = new ErrorCode(1_002_002_000, "role.not_exists"); + public static final ErrorCode ROLE_NAME_DUPLICATE = new ErrorCode(1_002_002_001, "role.name.duplicate"); + public static final ErrorCode ROLE_CODE_DUPLICATE = new ErrorCode(1_002_002_002, "role.code.duplicate"); + public static final ErrorCode ROLE_CAN_NOT_UPDATE_SYSTEM_TYPE_ROLE = new ErrorCode(1_002_002_003, "role.can_not_update_system_type"); + public static final ErrorCode ROLE_IS_DISABLE = new ErrorCode(1_002_002_004, "role.is_disable"); + public static final ErrorCode ROLE_ADMIN_CODE_ERROR = new ErrorCode(1_002_002_005, "role.admin_code_error"); + public static final ErrorCode ROLE_ME_ERROR = new ErrorCode(1_002_002_006, "role.me_error"); + public static final ErrorCode ROLE_NOT_SUPERADMIN_NO_ORGAN_ID_OPER_ERROR = new ErrorCode(1_002_002_007, "role.not_superadmin_no_organ_id_oper_error"); + public static final ErrorCode BUILDIN_ROLE_MODIFY_PERMISSION_ERROR = new ErrorCode(1_002_002_008, "role.buildin.modify_permission_error"); + public static final ErrorCode SELF_ROLE_MODIFY_PERMISSION_ERROR = new ErrorCode(1_002_002_009, "role.self.modify_permission_error"); + public static final ErrorCode SELF_ROLE_MODIFY_ERROR = new ErrorCode(1_002_002_010, "role.self.modify_error"); // ========== 用户模块 1-002-003-000 ========== - public static final ErrorCode USER_USERNAME_EXISTS = new ErrorCode(1_002_003_000, "手机号已经存在"); - public static final ErrorCode USER_MOBILE_EXISTS = new ErrorCode(1_002_003_001, "手机号已经存在"); - public static final ErrorCode USER_EMAIL_EXISTS = new ErrorCode(1_002_003_002, "邮箱已经存在"); - public static final ErrorCode USER_NOT_EXISTS = new ErrorCode(1_002_003_003, "用户不存在"); - public static final ErrorCode USER_IMPORT_LIST_IS_EMPTY = new ErrorCode(1_002_003_004, "导入用户数据不能为空!"); - public static final ErrorCode USER_PASSWORD_FAILED = new ErrorCode(1_002_003_005, "用户密码校验失败"); - public static final ErrorCode USER_IS_DISABLE = new ErrorCode(1_002_003_006, "名字为【{}】的用户已被禁用"); - public static final ErrorCode USER_COUNT_MAX = new ErrorCode(1_002_003_008, "超过组织用户配额({}),创建用户失败!"); - public static final ErrorCode USER_ME_ERROR = new ErrorCode(1_002_003_009, "不允许操作用户自身"); - public static final ErrorCode THE_PASSWORD_LENGTH_MUST_BE_AT_LEAST_8_CHARACTERS = new ErrorCode(1_002_003_010, "密码长度不少于8位,且包含大小写字母、数字和特殊字符"); - public static final ErrorCode USERNAME_MULTIPLE_ERROR = new ErrorCode(1_002_003_011,"存在【{}】重复用户,请联系系统管理员"); - public static final ErrorCode USER_OPERATE_SELF_STATUS_ERROR = new ErrorCode(1_002_003_012, "不允许操作用户自身状态"); - public static final ErrorCode USER_MOBILE_UPDATE_NOT_ALLOW_ERROR = new ErrorCode(1_002_003_013, "该用户已通过手机号认证,如需修改手机号请前往个人中心"); + public static final ErrorCode USER_USERNAME_EXISTS = new ErrorCode(1_002_003_000, "user.username.exists"); + public static final ErrorCode USER_MOBILE_EXISTS = new ErrorCode(1_002_003_001, "user.mobile.exists"); + public static final ErrorCode USER_EMAIL_EXISTS = new ErrorCode(1_002_003_002, "user.email.exists"); + public static final ErrorCode USER_NOT_EXISTS = new ErrorCode(1_002_003_003, "user.not_exists"); + public static final ErrorCode USER_IMPORT_LIST_IS_EMPTY = new ErrorCode(1_002_003_004, "user.import.empty"); + public static final ErrorCode USER_PASSWORD_FAILED = new ErrorCode(1_002_003_005, "user.password.failed"); + public static final ErrorCode USER_IS_DISABLE = new ErrorCode(1_002_003_006, "user.is_disable"); + public static final ErrorCode USER_COUNT_MAX = new ErrorCode(1_002_003_008, "user.count.max"); + public static final ErrorCode USER_ME_ERROR = new ErrorCode(1_002_003_009, "user.me.error"); + public static final ErrorCode THE_PASSWORD_LENGTH_MUST_BE_AT_LEAST_8_CHARACTERS = new ErrorCode(1_002_003_010, "user.password.length_at_least_8"); + public static final ErrorCode USERNAME_MULTIPLE_ERROR = new ErrorCode(1_002_003_011, "user.username.multiple_error"); + public static final ErrorCode USER_OPERATE_SELF_STATUS_ERROR = new ErrorCode(1_002_003_012, "user.operate_self_status_error"); + public static final ErrorCode USER_MOBILE_UPDATE_NOT_ALLOW_ERROR = new ErrorCode(1_002_003_013, "user.mobile_update_not_allow"); // ========== 部门模块 1-002-004-000 ========== - public static final ErrorCode DEPT_NAME_DUPLICATE = new ErrorCode(1_002_004_000, "已经存在该名字的部门"); - public static final ErrorCode DEPT_PARENT_NOT_EXITS = new ErrorCode(1_002_004_001,"父级部门不存在"); - public static final ErrorCode DEPT_NOT_FOUND = new ErrorCode(1_002_004_002, "当前部门不存在"); - public static final ErrorCode DEPT_EXITS_CHILDREN = new ErrorCode(1_002_004_003, "存在子部门,无法删除"); - public static final ErrorCode DEPT_PARENT_ERROR = new ErrorCode(1_002_004_004, "不能设置自己为父部门"); - public static final ErrorCode DEPT_EXISTS_USER = new ErrorCode(1_002_004_005, "部门中存在员工,无法删除"); - public static final ErrorCode DEPT_PARENT_IS_CHILD = new ErrorCode(1_002_004_007, "不能设置自己的子部门为父部门"); - public static final ErrorCode DEPT_USER_OPER_NOT_ALLOW = new ErrorCode(1_002_004_008, "不允许操作用户自身部门"); - public static final ErrorCode PARENT_DEPT_USER_OPER_NOT_ALLOW = new ErrorCode(1_002_004_009, "不允许操作用户自身部门及其上级部门"); - public static final ErrorCode DEPT_DISABLE = new ErrorCode(1_002_004_010, "部门({})已被禁用"); - public static final ErrorCode DEPT_NOT_ALLOWED_LOGIN = new ErrorCode(1_002_004_011, "部门({})已被禁用,无法登录"); - public static final ErrorCode PARENT_DEPT_DISABLE = new ErrorCode(1_002_004_012, "上级部门({})已被禁用,请开启后操作或选择其他上级部门"); + public static final ErrorCode DEPT_NAME_DUPLICATE = new ErrorCode(1_002_004_000, "dept.name.duplicate"); + public static final ErrorCode DEPT_PARENT_NOT_EXITS = new ErrorCode(1_002_004_001, "dept.parent.not_exists"); + public static final ErrorCode DEPT_NOT_FOUND = new ErrorCode(1_002_004_002, "dept.not_found"); + public static final ErrorCode DEPT_EXITS_CHILDREN = new ErrorCode(1_002_004_003, "dept.exists_children"); + public static final ErrorCode DEPT_PARENT_ERROR = new ErrorCode(1_002_004_004, "dept.parent.error"); + public static final ErrorCode DEPT_EXISTS_USER = new ErrorCode(1_002_004_005, "dept.exists_user"); + public static final ErrorCode DEPT_PARENT_IS_CHILD = new ErrorCode(1_002_004_007, "dept.parent_is_child"); + public static final ErrorCode DEPT_USER_OPER_NOT_ALLOW = new ErrorCode(1_002_004_008, "dept.user_oper_not_allow"); + public static final ErrorCode PARENT_DEPT_USER_OPER_NOT_ALLOW = new ErrorCode(1_002_004_009, "dept.parent_user_oper_not_allow"); + public static final ErrorCode DEPT_DISABLE = new ErrorCode(1_002_004_010, "dept.disable"); + public static final ErrorCode DEPT_NOT_ALLOWED_LOGIN = new ErrorCode(1_002_004_011, "dept.not_allowed_login"); + public static final ErrorCode PARENT_DEPT_DISABLE = new ErrorCode(1_002_004_012, "dept.parent_disable"); // ========== 字典类型 1-002-006-000 ========== - public static final ErrorCode DICT_TYPE_NOT_EXISTS = new ErrorCode(1_002_006_001, "当前字典类型不存在"); - public static final ErrorCode DICT_TYPE_NOT_ENABLE = new ErrorCode(1_002_006_002, "字典类型处于关闭状态,不允许新增或编辑"); - public static final ErrorCode DICT_TYPE_NAME_DUPLICATE = new ErrorCode(1_002_006_003, "已经存在该名字的字典类型"); - public static final ErrorCode DICT_TYPE_TYPE_DUPLICATE = new ErrorCode(1_002_006_004, "已经存在该类型的字典类型"); - public static final ErrorCode DICT_TYPE_HAS_CHILDREN = new ErrorCode(1_002_006_005, "无法删除,该字典类型还有字典数据"); + public static final ErrorCode DICT_TYPE_NOT_EXISTS = new ErrorCode(1_002_006_001, "dict_type.not_exists"); + public static final ErrorCode DICT_TYPE_NOT_ENABLE = new ErrorCode(1_002_006_002, "dict_type.not_enable"); + public static final ErrorCode DICT_TYPE_NAME_DUPLICATE = new ErrorCode(1_002_006_003, "dict_type.name.duplicate"); + public static final ErrorCode DICT_TYPE_TYPE_DUPLICATE = new ErrorCode(1_002_006_004, "dict_type.type.duplicate"); + public static final ErrorCode DICT_TYPE_HAS_CHILDREN = new ErrorCode(1_002_006_005, "dict_type.has_children"); // ========== 字典数据 1-002-007-000 ========== - public static final ErrorCode DICT_DATA_NOT_EXISTS = new ErrorCode(1_002_007_001, "当前字典数据不存在"); - public static final ErrorCode DICT_DATA_NOT_ENABLE = new ErrorCode(1_002_007_002, "字典数据({})不处于开启状态,不允许选择"); - public static final ErrorCode DICT_DATA_VALUE_DUPLICATE = new ErrorCode(1_002_007_003, "已经存在该值的字典数据"); - public static final ErrorCode DICT_DATA_TRANS_ERROR = new ErrorCode(1_002_007_004, "字典数据标签翻译异常,error_code :{}"); + public static final ErrorCode DICT_DATA_NOT_EXISTS = new ErrorCode(1_002_007_001, "dict_data.not_exists"); + public static final ErrorCode DICT_DATA_NOT_ENABLE = new ErrorCode(1_002_007_002, "dict_data.not_enable"); + public static final ErrorCode DICT_DATA_VALUE_DUPLICATE = new ErrorCode(1_002_007_003, "dict_data.value.duplicate"); + public static final ErrorCode DICT_DATA_TRANS_ERROR = new ErrorCode(1_002_007_004, "dict_data.trans_error"); // ========== 通知公告 1-002-008-000 ========== - public static final ErrorCode NOTICE_NOT_FOUND = new ErrorCode(1_002_008_001, "当前通知公告不存在"); - public static final ErrorCode NOTICE_NAME_UNIQE_ERROR = new ErrorCode(1_002_008_002, "公告标题已存在,请编辑后重试"); - public static final ErrorCode NOTICE_BUILDIN_MODIFY_PERMISSION_ERROR = new ErrorCode(1_002_008_003, "内置通知公告编辑权限不足"); + public static final ErrorCode NOTICE_NOT_FOUND = new ErrorCode(1_002_008_001, "notice.not_found"); + public static final ErrorCode NOTICE_NAME_UNIQE_ERROR = new ErrorCode(1_002_008_002, "notice.name_unique_error"); + public static final ErrorCode NOTICE_BUILDIN_MODIFY_PERMISSION_ERROR = new ErrorCode(1_002_008_003, "notice.buildin.modify_permission_error"); // ========== 短信渠道 1-002-011-000 ========== - public static final ErrorCode SMS_CHANNEL_NOT_EXISTS = new ErrorCode(1_002_011_000, "短信渠道不存在"); + public static final ErrorCode SMS_CHANNEL_NOT_EXISTS = new ErrorCode(1_002_011_000, "sms.channel.not_exists"); // ========== 短信模板 1-002-012-000 ========== - public static final ErrorCode SMS_TEMPLATE_NOT_EXISTS = new ErrorCode(1_002_012_000, "短信模板不存在"); - public static final ErrorCode SMS_TEMPLATE_CODE_DUPLICATE = new ErrorCode(1_002_012_001, "已经存在编码为【{}】的短信模板"); - public static final ErrorCode SMS_TEMPLATE_API_ERROR = new ErrorCode(1_002_012_002, "短信 API 模板调用失败,原因是:{}"); - public static final ErrorCode SMS_TEMPLATE_API_AUDIT_CHECKING = new ErrorCode(1_002_012_003, "短信 API 模版无法使用,原因:审批中"); - public static final ErrorCode SMS_TEMPLATE_API_AUDIT_FAIL = new ErrorCode(1_002_012_004, "短信 API 模版无法使用,原因:审批不通过,{}"); - public static final ErrorCode SMS_TEMPLATE_API_NOT_FOUND = new ErrorCode(1_002_012_005, "短信 API 模版无法使用,原因:模版不存在"); + public static final ErrorCode SMS_TEMPLATE_NOT_EXISTS = new ErrorCode(1_002_012_000, "sms.template.not_exists"); + public static final ErrorCode SMS_TEMPLATE_CODE_DUPLICATE = new ErrorCode(1_002_012_001, "sms.template.code.duplicate"); + public static final ErrorCode SMS_TEMPLATE_API_ERROR = new ErrorCode(1_002_012_002, "sms.template.api_error"); + public static final ErrorCode SMS_TEMPLATE_API_AUDIT_CHECKING = new ErrorCode(1_002_012_003, "sms.template.api.audit_checking"); + public static final ErrorCode SMS_TEMPLATE_API_AUDIT_FAIL = new ErrorCode(1_002_012_004, "sms.template.api.audit_fail"); + public static final ErrorCode SMS_TEMPLATE_API_NOT_FOUND = new ErrorCode(1_002_012_005, "sms.template.api.not_found"); // ========== 短信发送 1-002-013-000 ========== - public static final ErrorCode SMS_SEND_MOBILE_NOT_EXISTS = new ErrorCode(1_002_013_000, "手机号不存在"); - public static final ErrorCode SMS_SEND_MOBILE_TEMPLATE_PARAM_MISS = new ErrorCode(1_002_013_001, "短信模板参数({})缺失"); - public static final ErrorCode SMS_SEND_TEMPLATE_NOT_EXISTS = new ErrorCode(1_002_013_002, "短信模板不存在"); + public static final ErrorCode SMS_SEND_MOBILE_NOT_EXISTS = new ErrorCode(1_002_013_000, "sms.send.mobile.not_exists"); + public static final ErrorCode SMS_SEND_MOBILE_TEMPLATE_PARAM_MISS = new ErrorCode(1_002_013_001, "sms.send.mobile.template_param_miss"); + public static final ErrorCode SMS_SEND_TEMPLATE_NOT_EXISTS = new ErrorCode(1_002_013_002, "sms.send.template.not_exists"); // ========== 短信验证码 1-002-014-000 ========== - public static final ErrorCode SMS_CODE_NOT_FOUND = new ErrorCode(1_002_014_000, "验证码不存在,请点击获取"); - public static final ErrorCode SMS_CODE_NOT_CORRECT = new ErrorCode(1_002_014_001, "验证码不正确"); - public static final ErrorCode SMS_CODE_SEND_TOO_FAST = new ErrorCode(1_002_014_002, "短信发送过于频率"); - public static final ErrorCode SMS_CODE_IS_VALID = new ErrorCode(1_002_014_003, "验证码在有效期内,5分钟内请勿重复发送!"); + public static final ErrorCode SMS_CODE_NOT_FOUND = new ErrorCode(1_002_014_000, "sms.code.not_found"); + public static final ErrorCode SMS_CODE_NOT_CORRECT = new ErrorCode(1_002_014_001, "sms.code.not_correct"); + public static final ErrorCode SMS_CODE_SEND_TOO_FAST = new ErrorCode(1_002_014_002, "sms.code.send_too_fast"); + public static final ErrorCode SMS_CODE_IS_VALID = new ErrorCode(1_002_014_003, "sms.code.is_valid"); // ========== 组织信息 1-002-015-000 ========== - public static final ErrorCode ORGAN_NOT_EXISTS = new ErrorCode(1_002_015_000, "组织不存在"); - public static final ErrorCode ORGAN_DISABLE = new ErrorCode(1_002_015_001, "【{}】组织已被禁用"); - public static final ErrorCode ORGAN_EXPIRE = new ErrorCode(1_002_015_002, "【{}】组织已过期"); - public static final ErrorCode ORGAN_CAN_NOT_UPDATE_SYSTEM = new ErrorCode(1_002_015_003, "系统组织不能进行修改、删除等操作!"); - public static final ErrorCode ORGAN_NAME_DUPLICATE = new ErrorCode(1_002_015_004, "名字为【{}】的组织已存在"); - public static final ErrorCode ORGAN_WEBSITE_DUPLICATE = new ErrorCode(1_002_015_005, "域名为【{}】的组织已存在"); - public static final ErrorCode ORGAN_DATA_CODE_NOT_EXISTS = new ErrorCode(1_002_015_006, "组织未配置数据源标识"); - public static final ErrorCode ORGAN_ALREADY_EXISTS = new ErrorCode(1_002_015_007, "该新增组织已授权机台数量无需重复新增!"); - public static final ErrorCode ORGAN_USER_OPER_NOT_ALLOW = new ErrorCode(1_002_015_008, "不允许操作用户自身组织"); - public static final ErrorCode ORGAN_CONTACTMOBILE_DUPLICATE = new ErrorCode(1_002_015_009, "手机号为【{}】的组织已存在"); - public static final ErrorCode ORGAN_EXPIRETIME_PRODUCTID_LACK = new ErrorCode(1_002_015_010, "请选择要购买的产品"); + public static final ErrorCode ORGAN_NOT_EXISTS = new ErrorCode(1_002_015_000, "organ.not_exists"); + public static final ErrorCode ORGAN_DISABLE = new ErrorCode(1_002_015_001, "organ.disable"); + public static final ErrorCode ORGAN_EXPIRE = new ErrorCode(1_002_015_002, "organ.expire"); + public static final ErrorCode ORGAN_CAN_NOT_UPDATE_SYSTEM = new ErrorCode(1_002_015_003, "organ.can_not_update_system"); + public static final ErrorCode ORGAN_NAME_DUPLICATE = new ErrorCode(1_002_015_004, "organ.name.duplicate"); + public static final ErrorCode ORGAN_WEBSITE_DUPLICATE = new ErrorCode(1_002_015_005, "organ.website.duplicate"); + public static final ErrorCode ORGAN_DATA_CODE_NOT_EXISTS = new ErrorCode(1_002_015_006, "organ.data_code.not_exists"); + public static final ErrorCode ORGAN_ALREADY_EXISTS = new ErrorCode(1_002_015_007, "organ.already_exists"); + public static final ErrorCode ORGAN_USER_OPER_NOT_ALLOW = new ErrorCode(1_002_015_008, "organ.user_oper.not_allow"); + public static final ErrorCode ORGAN_CONTACTMOBILE_DUPLICATE = new ErrorCode(1_002_015_009, "organ.contact_mobile.duplicate"); + public static final ErrorCode ORGAN_EXPIRETIME_PRODUCTID_LACK = new ErrorCode(1_002_015_010, "organ.expiretime.product_id_lack"); // ========== 组织套餐 1-002-016-000 ========== public static final ErrorCode TENANT_PACKAGE_NOT_EXISTS = new ErrorCode(1_002_016_000, "组织套餐不存在"); @@ -178,13 +178,13 @@ public class ErrorCodeConstants { public static final ErrorCode MAIL_SEND_MAIL_NOT_EXISTS = new ErrorCode(1_002_025_001, "邮箱不存在"); // ========== 站内信模版 1-002-026-000 ========== - public static final ErrorCode NOTIFY_TEMPLATE_NOT_EXISTS = new ErrorCode(1_002_026_000, "站内信模版不存在"); - public static final ErrorCode NOTIFY_TEMPLATE_CODE_DUPLICATE = new ErrorCode(1_002_026_001, "已经存在编码为【{}】的站内信模板"); + public static final ErrorCode NOTIFY_TEMPLATE_NOT_EXISTS = new ErrorCode(1_002_026_000, "notify.template.not.exists"); + public static final ErrorCode NOTIFY_TEMPLATE_CODE_DUPLICATE = new ErrorCode(1_002_026_001, "notify.template.code.duplicate"); // ========== 站内信模版 1-002-027-000 ========== // ========== 站内信发送 1-002-028-000 ========== - public static final ErrorCode NOTIFY_SEND_TEMPLATE_PARAM_MISS = new ErrorCode(1_002_028_000, "站内信模板参数({})缺失"); + public static final ErrorCode NOTIFY_SEND_TEMPLATE_PARAM_MISS = new ErrorCode(1_002_028_000, "notify.send.template.param.miss"); //=========== 工序信息 1-002-027-000 ============ @@ -194,35 +194,35 @@ public class ErrorCodeConstants { public static final ErrorCode PROCESS_NAME_EXISTS = new ErrorCode(1_002_027_003, "工序名称已存在"); // ========== 机台 1-002-029-000 ========== - public static final ErrorCode MACHINE_NOT_EXISTS = new ErrorCode(1_002_029_000, "机台不存在"); - public static final ErrorCode MACHINE_TEMPLATE_NOT_EXISTS = new ErrorCode(1_002_029_001, "机台模板不存在"); - public static final ErrorCode DEFAULT_TEMPLATE_COUNT = new ErrorCode(1_002_029_002, "默认模板数量异常"); - public static final ErrorCode THE_CURRENT_MACHINE_IS_ALREADY_IN_USE = new ErrorCode(1_002_029_006, "当前机台已使用,禁止删除"); - public static final ErrorCode MACHINE_ERROR = new ErrorCode(1_002_029_007, "当前机台错误,请重新选择机台"); - public static final ErrorCode THE_CURRENT_BRAND_OF_THE_MACHINE_EXISTS = new ErrorCode(1_002_029_008, "当前机台配置的模板中,该品牌已存在,请重新输入品牌名称"); - public static final ErrorCode THE_MODEL_OF_THE_MACHINE_DOES_NOT_EXIST = new ErrorCode(1_002_029_009, "该型号的机台模板不存在,请进行配置"); - public static final ErrorCode THE_CURRENT_BRAND = new ErrorCode(1_002_029_010, "品牌ID错误,或品牌不存在"); - public static final ErrorCode MACHINE_NUM_ERROR = new ErrorCode(1_002_029_011, "当前组织该类型的机台创建已达到最大值,无法继续创建"); - public static final ErrorCode MACHINE_NAME_ERROR = new ErrorCode(1_002_029_012, "当前机台名称已存在,请重新输入机台名称"); - public static final ErrorCode MACHINETEMPLATE_NAME_ERROR = new ErrorCode(1_002_029_013, "当前机台模板的名称已存在,请重新输入机台模板名称"); - public static final ErrorCode LABELINGMACHINE_RELATED_DATA_ERROR = new ErrorCode(1_002_029_014, "当前机台关联的贴标机数据有误,请在高级配置中重新配置贴标机或选择其他模板"); - public static final ErrorCode DRILLMACHINE_RELATED_DATA_ERROR = new ErrorCode(1_002_029_015, "当前机台关联的钻孔机数据有误,请在钻孔模块中重新配置钻孔机或选择其他模板"); - public static final ErrorCode MACHINE_DATA_ERROR = new ErrorCode(1_002_029_016, "当前组织还未进行机台授权,请联系组织管理员在基础管理里对当前组织进行机台授权,或联系客服进行授权"); - public static final ErrorCode MACHINE_NUM_DATA_ERROR = new ErrorCode(1_002_029_017, "组织授权的机台数量不能超过127台"); - public static final ErrorCode MACHINE_USED_ALREADY = new ErrorCode(1_002_029_018, "当前机台在加工方案组中已使用,无法删除"); + public static final ErrorCode MACHINE_NOT_EXISTS = new ErrorCode(1_002_029_000, "machine.not.exists"); + public static final ErrorCode MACHINE_TEMPLATE_NOT_EXISTS = new ErrorCode(1_002_029_001, "machine.template.not.exists"); + public static final ErrorCode DEFAULT_TEMPLATE_COUNT = new ErrorCode(1_002_029_002, "default.template.count"); + public static final ErrorCode THE_CURRENT_MACHINE_IS_ALREADY_IN_USE = new ErrorCode(1_002_029_006, "the.current.machine.is.already.in.use"); + public static final ErrorCode MACHINE_ERROR = new ErrorCode(1_002_029_007, "machine.error"); + public static final ErrorCode THE_CURRENT_BRAND_OF_THE_MACHINE_EXISTS = new ErrorCode(1_002_029_008, "the.current.brand.of.the.machine.exists"); + public static final ErrorCode THE_MODEL_OF_THE_MACHINE_DOES_NOT_EXIST = new ErrorCode(1_002_029_009, "the.model.of.the.machine.does.not.exist"); + public static final ErrorCode THE_CURRENT_BRAND = new ErrorCode(1_002_029_010, "the.current.brand"); + public static final ErrorCode MACHINE_NUM_ERROR = new ErrorCode(1_002_029_011, "machine.num.error"); + public static final ErrorCode MACHINE_NAME_ERROR = new ErrorCode(1_002_029_012, "machine.name.error"); + public static final ErrorCode MACHINETEMPLATE_NAME_ERROR = new ErrorCode(1_002_029_013, "machinetemplate.name.error"); + public static final ErrorCode LABELINGMACHINE_RELATED_DATA_ERROR = new ErrorCode(1_002_029_014, "labelingmachine.related.data.error"); + public static final ErrorCode DRILLMACHINE_RELATED_DATA_ERROR = new ErrorCode(1_002_029_015, "drillmachine.related.data.error"); + public static final ErrorCode MACHINE_DATA_ERROR = new ErrorCode(1_002_029_016, "machine.data.error"); + public static final ErrorCode MACHINE_NUM_DATA_ERROR = new ErrorCode(1_002_029_017, "machine.num.data.error"); + public static final ErrorCode MACHINE_USED_ALREADY = new ErrorCode(1_002_029_018, "machine.used.already"); // ========== 标签模板 1-002-300-000 ========== - public static final ErrorCode LABEL_TEMPLATE_NOT_EXISTS = new ErrorCode(1_002_300_000, "标签模板不存在"); - public static final ErrorCode LABEL_NOT_EXISTS = new ErrorCode(1_002_300_001, "标签不存在"); - public static final ErrorCode DEFAULT_LABEL_NOT_EXISTS = new ErrorCode(1_002_300_002, "该类型标签默认模板不存在"); - public static final ErrorCode MACHINE_USE_LABEL = new ErrorCode(1_002_300_003, "当前标签已有机台使用,无法删除"); - public static final ErrorCode DEFAULT_NOT_DELETED = new ErrorCode(1_002_300_004, "默认标签模板无法删除"); - public static final ErrorCode LABEL_IS_USE_ERROR = new ErrorCode(1_002_300_006, "当前标签打包设置中已有用户使用,无法删除"); + public static final ErrorCode LABEL_TEMPLATE_NOT_EXISTS = new ErrorCode(1_002_300_000, "label.template.not.exists"); + public static final ErrorCode LABEL_NOT_EXISTS = new ErrorCode(1_002_300_001, "label.not.exists"); + public static final ErrorCode DEFAULT_LABEL_NOT_EXISTS = new ErrorCode(1_002_300_002, "default.label.not.exists"); + public static final ErrorCode MACHINE_USE_LABEL = new ErrorCode(1_002_300_003, "machine.use.label"); + public static final ErrorCode DEFAULT_NOT_DELETED = new ErrorCode(1_002_300_004, "default.not.deleted"); + public static final ErrorCode LABEL_IS_USE_ERROR = new ErrorCode(1_002_300_006, "label.is.use.error"); // ========== 系统数据源 1_002_301_000 ========== - public static final ErrorCode DATA_SOURCE_NOT_EXISTS = new ErrorCode(1_002_301_000, "系统数据源不存在"); + public static final ErrorCode DATA_SOURCE_NOT_EXISTS = new ErrorCode(1_002_301_000, "data.source.not.exists"); //=========== 工序组信息 1-002-032-000 ============ public static final ErrorCode PROCESS_GROUP_NOT_EXISTS = new ErrorCode(1_002_032_001, "工序组不存在"); @@ -237,131 +237,131 @@ public class ErrorCodeConstants { public static final ErrorCode PROCESS_USER_EXISTS = new ErrorCode(1_002_034_002, "工序用户存在"); // ========== 配件信息 1-002-035-000 ========== - public static final ErrorCode ORDER_PARTS_IMPORT_LIST_IS_EMPTY = new ErrorCode(1_002_035_002, "生产配件导入数据不可以为空"); + public static final ErrorCode ORDER_PARTS_IMPORT_LIST_IS_EMPTY = new ErrorCode(1_002_035_002, "order.parts.import.list.is.empty"); //=========== 应用信息 1-002-037-000 ============ public static final ErrorCode ERR = new ErrorCode(1_002_038_001, "未知错误"); public static final ErrorCode DATA_ERR = new ErrorCode(1_002_038_002, "数据错误,需要清除数据重新导入"); - public static final ErrorCode REMAIN_PLATE_STATUS_USED = new ErrorCode(1_002_038_003, "余料板正在使用中,禁止修改"); - public static final ErrorCode REMAIN_PLATE_STATUS_NO_USED = new ErrorCode(1_002_038_004, "余料板未使用"); - public static final ErrorCode REMAIN_PLATE_USR_TYPE = new ErrorCode(1_002_038_005, "余料板使用类型为不可核销类型"); - public static final ErrorCode REMAIN_PLATE_ID_NOT_EXISTS = new ErrorCode(1_002_038_006, "未选中余料板,请选择余料板"); + public static final ErrorCode REMAIN_PLATE_STATUS_USED = new ErrorCode(1_002_038_003, "remain.plate.status.used"); + public static final ErrorCode REMAIN_PLATE_STATUS_NO_USED = new ErrorCode(1_002_038_004, "remain.plate.status.no.used"); + public static final ErrorCode REMAIN_PLATE_USR_TYPE = new ErrorCode(1_002_038_005, "remain.plate.usr.type"); + public static final ErrorCode REMAIN_PLATE_ID_NOT_EXISTS = new ErrorCode(1_002_038_006, "remain.plate.id.not.exists"); public static final ErrorCode APPLICATION_NOT_EXISTS = new ErrorCode(1_002_038_007, "应用信息不存在"); public static final ErrorCode APPLICATION_LOGIN_USER_DISABLED = new ErrorCode(1_002_038_008, "应用登陆失败"); - public static final ErrorCode REMAIN_PLATE_COUNT_MAX = new ErrorCode(1_002_038_009, "每次新增余料板数量,最大为999"); + public static final ErrorCode REMAIN_PLATE_COUNT_MAX = new ErrorCode(1_002_038_009, "remain.plate.count.max"); //=========== 用户的系统配置 1-002-039-000 ============ - public static final ErrorCode CURRENTLY_NO_CONFIGURATION_AVAILABLE = new ErrorCode(1_002_039_001, "当前没有{}配置信息,请前往设置配置"); + public static final ErrorCode CURRENTLY_NO_CONFIGURATION_AVAILABLE = new ErrorCode(1_002_039_001, "currently.no.configuration.available"); //=========== 系统配置 1-002-040-000 ============ - public static final ErrorCode SYSTEM_CONFIG_NOT_EXISTS = new ErrorCode(1_002_040_001, "系统配置不存在"); - public static final ErrorCode SYSTEM_CONFIG_TYPE_NOT_SUPPORT = new ErrorCode(1_002_040_002, "不支持的系统配置类型"); - public static final ErrorCode SYSTEM_CONFIG_CUSTOM_PLATE_NO_RULE_SAVE_CHECK_ERROR = new ErrorCode(1_002_040_003, "自定义板编号配置:自定义板编号保存格式错误,请检查配置规则"); - public static final ErrorCode SYSTEM_CONFIG_CUSTOM_PLATE_NO_RULE_RESET_NOT_SUPPORT = new ErrorCode(1_002_040_004, "自定义板编号配置:该规则不支持手动复位/清零"); - public static final ErrorCode SYSTEM_CONFIG_CUSTOM_PLATE_NO_RULE_FIND = new ErrorCode(1_002_040_005, "自定义板编号配置:找不到对应的规则项进行手动复位/清零"); - public static final ErrorCode SYSTEM_CONFIG_CUSTOM_PLATE_NO_ORDER_RESET_UPDATE_ERROR = new ErrorCode(1_002_040_006, "自定义板编号配置:手动复位/清零生产单下序号失败,请联系客服"); - public static final ErrorCode CUSTOM_PLATE_NO_RULE_CHECK_RULECODE_EMPTY_ERROR = new ErrorCode(1_002_040_007, "规则编码不能为空"); - public static final ErrorCode CUSTOM_PLATE_NO_RULE_CHECK_RULECODE_NOT_MATCH_ERROR = new ErrorCode(1_002_040_008, "规则编码【{}】不合法,请检查配置规则"); - public static final ErrorCode CUSTOM_PLATE_NO_RULE_CHECK_DATE_TYPE_FORMAT_ERROR = new ErrorCode(1_002_040_009, "时间格式【{}】不合法,请检查配置规则"); - public static final ErrorCode CUSTOM_PLATE_NO_RULE_CHECK_CUSTOM_VALUE_EMPTY_ERROR = new ErrorCode(1_002_040_010, "自定义字符值不能为空,请检查配置规则"); - public static final ErrorCode CUSTOM_PLATE_NO_RULE_CHECK_RESETMODE_ERROR = new ErrorCode(1_002_040_011, "规则【{}】复位/清零模式不合法,请检查配置规则"); - public static final ErrorCode CUSTOM_PLATE_NO_RULE_CHECK_INT_TYPE_NO_EMPTY = new ErrorCode(1_002_040_012, "【{}】下的【{}】不能为空,请检查配置规则"); - public static final ErrorCode CUSTOM_PLATE_NO_RULE_CHECK_INT_TYPE_ERROR = new ErrorCode(1_002_040_013, "【{}】下的数值类型参数{}:【{}】转换异常,请检查配置规则"); - public static final ErrorCode CUSTOM_PLATE_NO_RULE_CHECK_BOL_TYPE_ERROR = new ErrorCode(1_002_040_014, "【{}】下的布尔类型参数{}:【{}】转换异常,请检查配置规则"); - public static final ErrorCode SYSTEM_PROCESS_SCHEME_DATA_ERROR = new ErrorCode(1_002_040_015, "加工方案组的:{} 为空,无法保存,请进行配置"); - public static final ErrorCode SYSTEM_PROCESS_SCHEME_CONFIG_DATA_ERROR = new ErrorCode(1_002_040_016, "加工方案组的:{} 为空,请检查配置信息"); - public static final ErrorCode SYSTEM_PROCESS_SCHEME_CONFIG_FIELD_ERROR = new ErrorCode(1_002_040_017, "当前方案组的配置异常,请重新配置"); - public static final ErrorCode SYSTEM_PROCESS_SCHEME_CONFIG_IS_PLAN = new ErrorCode(1_002_040_018, "当前方案组已在排单中使用,无法删除"); - public static final ErrorCode SYSTEM_PROCESS_SCHEME_CONFIG_MACHINE_LABEL = new ErrorCode(1_002_040_019, "当前方案组对应的解析器的机台的标签数据为空,请检查机台的标签配置信息"); - public static final ErrorCode THIS_CONFIG_DATA_ERROR = new ErrorCode(1_002_040_020, "当前系统配置的数据有误,请重新尝试排序"); - public static final ErrorCode PROCESS_CONFIG_USED_ALREADY = new ErrorCode(1_002_040_021, "当前加工分线配置在加工方案组中已使用,无法删除"); - public static final ErrorCode OPTIMIZATION_CONFIG_USED_ALREADY = new ErrorCode(1_002_040_022, "当前数据处理配置在加工方案组中已使用,无法删除"); - public static final ErrorCode SEALEDGE_CONFIG_NOT_EXISTS = new ErrorCode(1_002_040_023, "第 {} 条配置中,有字段值为空,请添加数据"); - public static final ErrorCode SEALEDGE_CONFIG_MAX_VALUE_DATA_ERROR = new ErrorCode(1_002_040_025, "第 {} 条配置中,{} 要大于等于 {},请修改数据"); - public static final ErrorCode SEALEDGE_CONFIG_DATA_ERROR = new ErrorCode(1_002_040_026, "当前封边条配置有误,请重新检查后新增"); - public static final ErrorCode THIS_CONFIG_NAME_IS_EXISTS = new ErrorCode(1_002_040_027, "当前配置的名称已存在,请重新命名"); - public static final ErrorCode DECIMAL_PLACES_MAX_TWO = new ErrorCode(1_002_040_028, "第 {} 条配置中,小数位数最大为 3 位,请进行修改"); - public static final ErrorCode SEALEDGE_CONFIG_MIN_VALUE_GREATER_THAN_ZERO = new ErrorCode(1_002_040_029, "第 {} 条配置中,宽最小值:{} 要大于0,请修改数据"); - public static final ErrorCode SEALEDGE_CONFIG_MAX_VALUE_GREATER_THAN_ZERO = new ErrorCode(1_002_040_030, "第 {} 条配置中,宽最大值:{} 要大于0,请修改数据"); - public static final ErrorCode SEALEDGE_CONFIG_VALUE_DATA_ERROR = new ErrorCode(1_002_040_031, "第 {} 条配置中,宽最大值 要大于 宽最小值,请修改数据"); + public static final ErrorCode SYSTEM_CONFIG_NOT_EXISTS = new ErrorCode(1_002_040_001, "system.config.not_exists"); + public static final ErrorCode SYSTEM_CONFIG_TYPE_NOT_SUPPORT = new ErrorCode(1_002_040_002, "system.config.type_not_support"); + public static final ErrorCode SYSTEM_CONFIG_CUSTOM_PLATE_NO_RULE_SAVE_CHECK_ERROR = new ErrorCode(1_002_040_003, "system.config.custom_plate_no.rule_save_format_error"); + public static final ErrorCode SYSTEM_CONFIG_CUSTOM_PLATE_NO_RULE_RESET_NOT_SUPPORT = new ErrorCode(1_002_040_004, "system.config.custom_plate_no.rule_reset_not_support"); + public static final ErrorCode SYSTEM_CONFIG_CUSTOM_PLATE_NO_RULE_FIND = new ErrorCode(1_002_040_005, "system.config.custom_plate_no.rule_item_not_found"); + public static final ErrorCode SYSTEM_CONFIG_CUSTOM_PLATE_NO_ORDER_RESET_UPDATE_ERROR = new ErrorCode(1_002_040_006, "system.config.custom_plate_no.rule_order_reset_failed"); + public static final ErrorCode CUSTOM_PLATE_NO_RULE_CHECK_RULECODE_EMPTY_ERROR = new ErrorCode(1_002_040_007, "custom.plate_no.rule.code_empty"); + public static final ErrorCode CUSTOM_PLATE_NO_RULE_CHECK_RULECODE_NOT_MATCH_ERROR = new ErrorCode(1_002_040_008, "custom.plate_no.rule.code_not_match"); + public static final ErrorCode CUSTOM_PLATE_NO_RULE_CHECK_DATE_TYPE_FORMAT_ERROR = new ErrorCode(1_002_040_009, "custom.plate_no.rule.date_format_error"); + public static final ErrorCode CUSTOM_PLATE_NO_RULE_CHECK_CUSTOM_VALUE_EMPTY_ERROR = new ErrorCode(1_002_040_010, "custom.plate_no.rule.custom_value_empty"); + public static final ErrorCode CUSTOM_PLATE_NO_RULE_CHECK_RESETMODE_ERROR = new ErrorCode(1_002_040_011, "custom.plate_no.rule.reset_mode_error"); + public static final ErrorCode CUSTOM_PLATE_NO_RULE_CHECK_INT_TYPE_NO_EMPTY = new ErrorCode(1_002_040_012, "custom.plate_no.rule.int_type_empty"); + public static final ErrorCode CUSTOM_PLATE_NO_RULE_CHECK_INT_TYPE_ERROR = new ErrorCode(1_002_040_013, "custom.plate_no.rule.int_type_convert_error"); + public static final ErrorCode CUSTOM_PLATE_NO_RULE_CHECK_BOL_TYPE_ERROR = new ErrorCode(1_002_040_014, "custom.plate_no.rule.bool_type_convert_error"); + public static final ErrorCode SYSTEM_PROCESS_SCHEME_DATA_ERROR = new ErrorCode(1_002_040_015, "process.scheme.data_empty"); + public static final ErrorCode SYSTEM_PROCESS_SCHEME_CONFIG_DATA_ERROR = new ErrorCode(1_002_040_016, "process.scheme.config.data_empty"); + public static final ErrorCode SYSTEM_PROCESS_SCHEME_CONFIG_FIELD_ERROR = new ErrorCode(1_002_040_017, "process.scheme.config.field_error"); + public static final ErrorCode SYSTEM_PROCESS_SCHEME_CONFIG_IS_PLAN = new ErrorCode(1_002_040_018, "process.scheme.config.in_use"); + public static final ErrorCode SYSTEM_PROCESS_SCHEME_CONFIG_MACHINE_LABEL = new ErrorCode(1_002_040_019, "process.scheme.config.machine_label_empty"); + public static final ErrorCode THIS_CONFIG_DATA_ERROR = new ErrorCode(1_002_040_020, "config.data_error"); + public static final ErrorCode PROCESS_CONFIG_USED_ALREADY = new ErrorCode(1_002_040_021, "process.config.used_already"); + public static final ErrorCode OPTIMIZATION_CONFIG_USED_ALREADY = new ErrorCode(1_002_040_022, "optimization.config.used_already"); + public static final ErrorCode SEALEDGE_CONFIG_NOT_EXISTS = new ErrorCode(1_002_040_023, "sealedge.config.item_empty"); + public static final ErrorCode SEALEDGE_CONFIG_MAX_VALUE_DATA_ERROR = new ErrorCode(1_002_040_025, "sealedge.config.max_value_error"); + public static final ErrorCode SEALEDGE_CONFIG_DATA_ERROR = new ErrorCode(1_002_040_026, "sealedge.config.data_error"); + public static final ErrorCode THIS_CONFIG_NAME_IS_EXISTS = new ErrorCode(1_002_040_027, "sealedge.config.name_exists"); + public static final ErrorCode DECIMAL_PLACES_MAX_TWO = new ErrorCode(1_002_040_028, "sealedge.config.decimal_places_max_three"); + public static final ErrorCode SEALEDGE_CONFIG_MIN_VALUE_GREATER_THAN_ZERO = new ErrorCode(1_002_040_029, "sealedge.config.min_value_gt_zero"); + public static final ErrorCode SEALEDGE_CONFIG_MAX_VALUE_GREATER_THAN_ZERO = new ErrorCode(1_002_040_030, "sealedge.config.max_value_gt_zero"); + public static final ErrorCode SEALEDGE_CONFIG_VALUE_DATA_ERROR = new ErrorCode(1_002_040_031, "sealedge.config.value_range_error"); //=========== token管理 1-002-042-000 ============ - public static final ErrorCode TOKEN_APP_TYPE_EXIST = new ErrorCode(1_002_042_001, "当前应用以存在token配置,无法继续新增"); - public static final ErrorCode TOKEN_CONFIG_NOT_EXISTS = new ErrorCode(1_002_042_002, "当前应用的token配置不存在"); - public static final ErrorCode TOKEN_TIME_IS_EXPIRES = new ErrorCode(1_002_042_003, "当前token已过期,请重新配置或延长时间"); - public static final ErrorCode TOKEN_APP_TYPE_NO_UPDATE = new ErrorCode(1_002_042_004, "应用名称不允许更改"); - public static final ErrorCode TOKEN_DATA_IS_NULL = new ErrorCode(1_002_042_005, "当前token的配置为空,无需删除"); - public static final ErrorCode TOKEN_EXPIRES_TIME_IS_NULL = new ErrorCode(1_002_042_006, "当前未选择有效时间,请选择再进行新增"); - public static final ErrorCode TOKEN_EXPIRES_TIME_DATA_ERROR = new ErrorCode(1_002_042_007, "当前选择的有效时间已过期,请增加有效时间"); - public static final ErrorCode INSERT_TOKEN_DATA_ERROR = new ErrorCode(1_002_042_008, "token新增失败,请重新尝试"); + public static final ErrorCode TOKEN_APP_TYPE_EXIST = new ErrorCode(1_002_042_001, "token.app_type.exist"); + public static final ErrorCode TOKEN_CONFIG_NOT_EXISTS = new ErrorCode(1_002_042_002, "token.config.not_exists"); + public static final ErrorCode TOKEN_TIME_IS_EXPIRES = new ErrorCode(1_002_042_003, "token.time.is_expires"); + public static final ErrorCode TOKEN_APP_TYPE_NO_UPDATE = new ErrorCode(1_002_042_004, "token.app_type.no_update"); + public static final ErrorCode TOKEN_DATA_IS_NULL = new ErrorCode(1_002_042_005, "token.data.is_null"); + public static final ErrorCode TOKEN_EXPIRES_TIME_IS_NULL = new ErrorCode(1_002_042_006, "token.expires_time.is_null"); + public static final ErrorCode TOKEN_EXPIRES_TIME_DATA_ERROR = new ErrorCode(1_002_042_007, "token.expires_time.data_error"); + public static final ErrorCode INSERT_TOKEN_DATA_ERROR = new ErrorCode(1_002_042_008, "token.insert.data_error"); //=========== 资金管理 1-002-043-000 ============ - public static final ErrorCode INVOICE_NO_EXIST = new ErrorCode(1_002_043_002, "当前发票记录有误,请重新查看"); - public static final ErrorCode INVOICING_REJECT_REASON = new ErrorCode(1_002_043_003, "请填写拒绝开票原因"); - public static final ErrorCode PURCHASE_RECORD_NO_EXIST = new ErrorCode(1_002_043_004, "当前发票对应的购买记录有误,请退回组织后重新申请开票"); - public static final ErrorCode THIS_INVOICE_IS_FAIL = new ErrorCode(1_002_043_005, "当前发票已开票,无法再次进行开票"); - public static final ErrorCode PRODUCTS_IS_EXIST = new ErrorCode(1_002_043_006, "产品【{}】已存在,请修改产品名称后再次操作"); - public static final ErrorCode PRODUCTS_NO_DELETE = new ErrorCode(1_002_043_007, "当前产品已上架,无法删除,请下架后再删除"); - public static final ErrorCode PRODUCTS_NO_UPDATE = new ErrorCode(1_002_043_008, "当前产品已上架,无法进行修改"); - public static final ErrorCode PRODUCTS_DETAIL_NO_UPDATE = new ErrorCode(1_002_043_009, "定价规则对应的产品已上架,无法进行修改"); - public static final ErrorCode ADVERTISEMENT_TIME_ERROR = new ErrorCode(1_002_043_010, "投放时间错误,结束时间应大于开始时间"); - public static final ErrorCode ADVERTISEMENT_NAME_IS_EXIST = new ErrorCode(1_002_043_011, "当前广告名称已存在,请重新命名"); - public static final ErrorCode ADVERTISEMENT_NO_DELETE = new ErrorCode(1_002_043_012, "当前广告已经发布,无法删除,请结束发布后再删除"); - public static final ErrorCode PRODUCT_PROMOTION_ACTIVE_NAME_IS_EXIST = new ErrorCode(1_002_043_013, "当前优惠活动名称已存在,请修改"); - public static final ErrorCode PRODUCT_PROMOTION_PURCHASEDURATION_IS_EXIST = new ErrorCode(1_002_043_014, "当前所选产品下{}{}购买时长的优惠活动已存在,请修改"); - public static final ErrorCode INVOICE_TITLE_NOT_EXISTS_ERROR = new ErrorCode(1_002_043_017, "发票抬头不存在,请先创建发票抬头"); - public static final ErrorCode ORG_INVOICE_PURCHASE_RECORD_UPDATE_NUM_NOT_MATCH_ERROR = new ErrorCode(1_002_043_018, "当前勾选的购买记录中部分可能已开票,请查询后重新勾选提交开票"); - public static final ErrorCode ORG_INVOICE_AGREE_FILE_NULL_ERROR = new ErrorCode(1_002_043_019, "确认开票发票附件不能为空,请上传后再提交"); - public static final ErrorCode INVOICE_TITLE_ORG_EXISTS_ERROR = new ErrorCode(1_002_043_020, "组织下已存在发票抬头,请刷新后编辑抬头内容"); - public static final ErrorCode INVOICE_TITLE_TAXPAYERID_EXISTS_ERROR = new ErrorCode(1_002_043_021, "统一社会信用代码已存在,请检查"); - public static final ErrorCode PRODUCTS_NOT_NOLIST = new ErrorCode(1_002_043_022, "当前产品未上架"); - public static final ErrorCode ORG_PRODUCT_PURCHASE_LOCK_ERROR = new ErrorCode(1_002_043_023, "组织下存在购买中的产品操作,请稍后再试"); - public static final ErrorCode INVOICE_TITLE_ENTERPRISE_TAXNUMBER_EMPTY_ERROR = new ErrorCode(1_002_043_024, "企业统一信用代码不能为空"); - public static final ErrorCode INVOICE_AMOUNT_ZERO_ERROR = new ErrorCode(1_002_043_025, "可开票金额为,请检查购买记录"); - public static final ErrorCode INVOICE_APPLY_UNINVOICEABLE_EXIST = new ErrorCode(1_002_043_026, "当前提交记录中存在不可开票记录,请刷新列表后重新选择提交"); + public static final ErrorCode INVOICE_NO_EXIST = new ErrorCode(1_002_043_002, "invoice.no_exist"); + public static final ErrorCode INVOICING_REJECT_REASON = new ErrorCode(1_002_043_003, "invoicing.reject_reason"); + public static final ErrorCode PURCHASE_RECORD_NO_EXIST = new ErrorCode(1_002_043_004, "purchase_record.no_exist"); + public static final ErrorCode THIS_INVOICE_IS_FAIL = new ErrorCode(1_002_043_005, "invoice.is_fail"); + public static final ErrorCode PRODUCTS_IS_EXIST = new ErrorCode(1_002_043_006, "products.is_exist"); + public static final ErrorCode PRODUCTS_NO_DELETE = new ErrorCode(1_002_043_007, "products.no_delete"); + public static final ErrorCode PRODUCTS_NO_UPDATE = new ErrorCode(1_002_043_008, "products.no_update"); + public static final ErrorCode PRODUCTS_DETAIL_NO_UPDATE = new ErrorCode(1_002_043_009, "products.detail.no_update"); + public static final ErrorCode ADVERTISEMENT_TIME_ERROR = new ErrorCode(1_002_043_010, "advertisement.time_error"); + public static final ErrorCode ADVERTISEMENT_NAME_IS_EXIST = new ErrorCode(1_002_043_011, "advertisement.name.is_exist"); + public static final ErrorCode ADVERTISEMENT_NO_DELETE = new ErrorCode(1_002_043_012, "advertisement.no_delete"); + public static final ErrorCode PRODUCT_PROMOTION_ACTIVE_NAME_IS_EXIST = new ErrorCode(1_002_043_013, "product_promotion.active.name.is_exist"); + public static final ErrorCode PRODUCT_PROMOTION_PURCHASEDURATION_IS_EXIST = new ErrorCode(1_002_043_014, "product_promotion.purchaseduration.is_exist"); + public static final ErrorCode INVOICE_TITLE_NOT_EXISTS_ERROR = new ErrorCode(1_002_043_017, "invoice_title.not_exists"); + public static final ErrorCode ORG_INVOICE_PURCHASE_RECORD_UPDATE_NUM_NOT_MATCH_ERROR = new ErrorCode(1_002_043_018, "org_invoice.purchase_record.update_num.not_match"); + public static final ErrorCode ORG_INVOICE_AGREE_FILE_NULL_ERROR = new ErrorCode(1_002_043_019, "org_invoice.agree_file.null"); + public static final ErrorCode INVOICE_TITLE_ORG_EXISTS_ERROR = new ErrorCode(1_002_043_020, "invoice_title.org.exists"); + public static final ErrorCode INVOICE_TITLE_TAXPAYERID_EXISTS_ERROR = new ErrorCode(1_002_043_021, "invoice_title.taxpayerid.exists"); + public static final ErrorCode PRODUCTS_NOT_NOLIST = new ErrorCode(1_002_043_022, "products.not_nolist"); + public static final ErrorCode ORG_PRODUCT_PURCHASE_LOCK_ERROR = new ErrorCode(1_002_043_023, "org_product.purchase.lock"); + public static final ErrorCode INVOICE_TITLE_ENTERPRISE_TAXNUMBER_EMPTY_ERROR = new ErrorCode(1_002_043_024, "invoice_title.enterprise.taxnumber.empty"); + public static final ErrorCode INVOICE_AMOUNT_ZERO_ERROR = new ErrorCode(1_002_043_025, "invoice.amount.zero"); + public static final ErrorCode INVOICE_APPLY_UNINVOICEABLE_EXIST = new ErrorCode(1_002_043_026, "invoice.apply.uninvoiceable.exist"); //=========== 支付相关 1-002-048-000 ============ - public static final ErrorCode PAY_CHANNEL_NOT_SUPPORT = new ErrorCode(1_002_048_000, "暂不支持的支付渠道,请使用其他支付渠道"); - public static final ErrorCode PAY_ORDER_NOT_EXIST = new ErrorCode(1_002_048_001, "支付订单不存在,支付编号:{},请重新发起支付"); - public static final ErrorCode PAY_ORDER_CHANNEL_QUERY_NOT_EXIST = new ErrorCode(1_002_048_002, "如果您已确认扫码支付,请稍后刷新页面,支付平台可能存在延迟到账"); - public static final ErrorCode PAY_ORDER_NOTIFY_DATA_PARSE_ERROR = new ErrorCode(1_002_048_003, "解析支付回调数据异常"); - public static final ErrorCode PAY_ORDER_STATUS_IS_NOT_WAITING = new ErrorCode(1_002_048_004, "支付订单不处于待支付"); - public static final ErrorCode PAY_ORDER_SUBMIT_CHANNEL_ERROR = new ErrorCode(1_002_048_005, "发起渠道支付异常,请联系客服"); - public static final ErrorCode PAY_NOTIFY_PASSBACK_TRADETYPE_NOT_SUPPORT_ERROR = new ErrorCode(1_002_048_006, "不支持的支付回调tradeType:【{}】,请检查支付渠道"); + public static final ErrorCode PAY_CHANNEL_NOT_SUPPORT = new ErrorCode(1_002_048_000, "pay.channel_not_support"); + public static final ErrorCode PAY_ORDER_NOT_EXIST = new ErrorCode(1_002_048_001, "pay.order_not_exist"); + public static final ErrorCode PAY_ORDER_CHANNEL_QUERY_NOT_EXIST = new ErrorCode(1_002_048_002, "pay.order_channel_query_not_exist"); + public static final ErrorCode PAY_ORDER_NOTIFY_DATA_PARSE_ERROR = new ErrorCode(1_002_048_003, "pay.order_notify_data_parse_error"); + public static final ErrorCode PAY_ORDER_STATUS_IS_NOT_WAITING = new ErrorCode(1_002_048_004, "pay.order_status_is_not_waiting"); + public static final ErrorCode PAY_ORDER_SUBMIT_CHANNEL_ERROR = new ErrorCode(1_002_048_005, "pay.order_submit_channel_error"); + public static final ErrorCode PAY_NOTIFY_PASSBACK_TRADETYPE_NOT_SUPPORT_ERROR = new ErrorCode(1_002_048_006, "pay.notify_passback_tradetype_not_support_error"); //=========== 产品相关 1-002-045-000 ============ - public static final ErrorCode PRODUCTS_NO_EXIST = new ErrorCode(1_002_045_001, "当前产品不存在"); - public static final ErrorCode PRODUCTS_DETAIL_NO_EXIST = new ErrorCode(1_002_045_002, "当前产品的规则不存在"); - public static final ErrorCode PRODUCTS_DETAIL_DURATION_EXIST = new ErrorCode(1_002_045_003, "当前产品下已存在产品时长:{}/{}的定价规则,请修改后重新操作"); - public static final ErrorCode PRODUCT_PROMOTION_NO_EXIST = new ErrorCode(1_002_045_004, "当前优惠活动不存在"); - public static final ErrorCode PRODUCTS_DETAIL_DURATION_UNIT_NOT_SUPPORT = new ErrorCode(1_002_045_005, "不支持的时长单位,请检查该定价规则的时长单位"); - public static final ErrorCode ORG_PRODUCT_PURCHASE_WAIT_PAY_ERROR = new ErrorCode(1_002_045_006, "组织下存在当前产品的待支付记录,请确认或取消支付后再次发起软件购买"); - public static final ErrorCode PRODUCT_PRICE_NULL_ERROR = new ErrorCode(1_002_045_007, "产品建议价格为空,请联系客服"); - public static final ErrorCode ORG_PRODUCT_PURCHASE_NOT_EXIST_ERROR = new ErrorCode(1_002_045_008, "组织订购记录不存在,请检查数据"); - public static final ErrorCode ORG_PRODUCT_PURCHASE_EXIST_ERROR = new ErrorCode(1_002_045_009, "组织[{}]订购记录已存在,请勿重复定义订购机构"); + public static final ErrorCode PRODUCTS_NO_EXIST = new ErrorCode(1_002_045_001, "product.no_exist"); + public static final ErrorCode PRODUCTS_DETAIL_NO_EXIST = new ErrorCode(1_002_045_002, "product.detail_no_exist"); + public static final ErrorCode PRODUCTS_DETAIL_DURATION_EXIST = new ErrorCode(1_002_045_003, "product.detail_duration_exist"); + public static final ErrorCode PRODUCT_PROMOTION_NO_EXIST = new ErrorCode(1_002_045_004, "product.promotion_no_exist"); + public static final ErrorCode PRODUCTS_DETAIL_DURATION_UNIT_NOT_SUPPORT = new ErrorCode(1_002_045_005, "product.detail_duration_unit_not_support"); + public static final ErrorCode ORG_PRODUCT_PURCHASE_WAIT_PAY_ERROR = new ErrorCode(1_002_045_006, "org.product_purchase_wait_pay_error"); + public static final ErrorCode PRODUCT_PRICE_NULL_ERROR = new ErrorCode(1_002_045_007, "product.price_null_error"); + public static final ErrorCode ORG_PRODUCT_PURCHASE_NOT_EXIST_ERROR = new ErrorCode(1_002_045_008, "org.product_purchase_not_exist_error"); + public static final ErrorCode ORG_PRODUCT_PURCHASE_EXIST_ERROR = new ErrorCode(1_002_045_009, "org.product_purchase_exist_error"); //=========== 广告相关 1-002-046-000 ============ - public static final ErrorCode ADVERTISEMENT_NO_EXIST = new ErrorCode(1_002_046_001, "广告不存在"); - public static final ErrorCode ADVERTISEMENT_STATUS_ENDTIME_EXPIRED = new ErrorCode(1_002_046_002, "当前广告投放结束时间已超期,请重新发布选择投放时间或重新编辑投放时间"); - public static final ErrorCode ADVERTISEMENT_IMAGE_EMPTY_ERROR = new ErrorCode(1_002_046_003, "广告图片文件为空,请重新上传"); - public static final ErrorCode ADVERTISEMENT_IMAGE_UPLOAD_FAIL = new ErrorCode(1_002_046_004, "广告图片上传失败,请稍后再试"); - public static final ErrorCode ADVERTISEMENT_UPDATE_STATUS_ERROR = new ErrorCode(1_002_046_005, "当前广告已经发布,若要编辑请先结束发布"); + public static final ErrorCode ADVERTISEMENT_NO_EXIST = new ErrorCode(1_002_046_001, "advertisement.no_exist"); + public static final ErrorCode ADVERTISEMENT_STATUS_ENDTIME_EXPIRED = new ErrorCode(1_002_046_002, "advertisement.status_endtime_expired"); + public static final ErrorCode ADVERTISEMENT_IMAGE_EMPTY_ERROR = new ErrorCode(1_002_046_003, "advertisement.image_empty_error"); + public static final ErrorCode ADVERTISEMENT_IMAGE_UPLOAD_FAIL = new ErrorCode(1_002_046_004, "advertisement.image_upload_fail"); + public static final ErrorCode ADVERTISEMENT_UPDATE_STATUS_ERROR = new ErrorCode(1_002_046_005, "advertisement.update_status_error"); //=========== 解析器管理 1-002-044-000 ============ - public static final ErrorCode PARSER_NO_EXIST = new ErrorCode(1_002_044_001, "当前解析器不存在,请重新选择"); - public static final ErrorCode PARSER_TEMPLATE_NO_EXIST = new ErrorCode(1_002_044_002, "当前解析器模板不存在,请重新选择"); + public static final ErrorCode PARSER_NO_EXIST = new ErrorCode(1_002_044_001, "parser.no_exist"); + public static final ErrorCode PARSER_TEMPLATE_NO_EXIST = new ErrorCode(1_002_044_002, "parser.template_no_exist"); //=========== 产品延期管理 1-002-049-000 ============ - public static final ErrorCode PRODUCT_PURCHASE_NO_EXIST = new ErrorCode(1_002_049_001, "当前购买记录不存在,请检查"); - public static final ErrorCode PRODUCT_PURCHASE_ENDTIME_BEFORE_DELAYTIME_ERROR = new ErrorCode(1_002_049_002, "当前产品订购有效期{}未超过当前日期,请调整订购时长"); + public static final ErrorCode PRODUCT_PURCHASE_NO_EXIST = new ErrorCode(1_002_049_001, "product_purchase.no_exist"); + public static final ErrorCode PRODUCT_PURCHASE_ENDTIME_BEFORE_DELAYTIME_ERROR = new ErrorCode(1_002_049_002, "product_purchase.endtime_before_delaytime_error"); } diff --git a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/api/application/ApplicationApiImpl.java b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/api/application/ApplicationApiImpl.java index 4c9dc597f..d16646336 100644 --- a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/api/application/ApplicationApiImpl.java +++ b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/api/application/ApplicationApiImpl.java @@ -2,6 +2,7 @@ package com.cf.imes.module.system.api.application; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; +import com.cf.imes.framework.common.exception.ServiceException; import com.cf.imes.module.system.dal.dataobject.application.ApplicationDO; import com.cf.imes.module.system.service.application.ApplicationService; import org.springframework.validation.annotation.Validated; @@ -9,9 +10,6 @@ import org.springframework.web.bind.annotation.RestController; import jakarta.annotation.Resource; -import java.util.Map; - -import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception; import static com.cf.imes.module.system.enums.ErrorCodeConstants.APPLICATION_NOT_EXISTS; @RestController // 提供 RESTful API 接口,给 Feign 调用 @@ -26,7 +24,7 @@ public class ApplicationApiImpl implements ApplicationApi{ // 获取数值 ApplicationDO applicationDO = applicationService.getApplicationByOrganId(organId); if (applicationDO == null){ - throw exception(APPLICATION_NOT_EXISTS); + throw new ServiceException(APPLICATION_NOT_EXISTS); } // 数据转json JSONObject jsonObject = (JSONObject) JSON.toJSON(applicationDO); diff --git a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/api/datasource/DataSourceApiImpl.java b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/api/datasource/DataSourceApiImpl.java index 7f34e140b..02c790087 100644 --- a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/api/datasource/DataSourceApiImpl.java +++ b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/api/datasource/DataSourceApiImpl.java @@ -1,6 +1,7 @@ package com.cf.imes.module.system.api.datasource; import com.cf.imes.framework.common.exception.ErrorCode; +import com.cf.imes.framework.common.exception.ServiceException; import com.cf.imes.framework.common.pojo.CommonResult; import com.cf.imes.module.system.api.dataSource.DataSourceApi; import com.cf.imes.module.system.dal.dataobject.datasource.DataSourceDO; @@ -10,7 +11,7 @@ import org.springframework.web.bind.annotation.RestController; import jakarta.annotation.Resource; import java.util.Objects; -import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception; + @RestController public class DataSourceApiImpl implements DataSourceApi { @@ -22,7 +23,7 @@ public class DataSourceApiImpl implements DataSourceApi { public CommonResult getSqlById(Long id) { DataSourceDO dataSourceDO = dataSourceMapper.selectById(id); if(Objects.isNull(dataSourceDO)) { - throw exception(new ErrorCode(2133,"数据源不存在")); + throw new ServiceException(new ErrorCode(2133,"数据源不存在")); } return null; } diff --git a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/api/organ/OrganApiImpl.java b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/api/organ/OrganApiImpl.java index 8832008a0..c3d7710e8 100644 --- a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/api/organ/OrganApiImpl.java +++ b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/api/organ/OrganApiImpl.java @@ -2,6 +2,7 @@ package com.cf.imes.module.system.api.organ; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.util.ObjectUtil; +import com.cf.imes.framework.common.exception.ServiceException; import com.cf.imes.framework.common.pojo.CommonResult; import com.cf.imes.framework.common.util.object.BeanUtils; import com.cf.imes.module.system.api.organ.dto.OrganizationDTO; @@ -18,7 +19,6 @@ import java.time.LocalDate; import java.util.*; import static com.cf.imes.framework.common.exception.enums.GlobalErrorCodeConstants.ORG_PRODUCT_EXPIRED; -import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception; import static com.cf.imes.framework.common.pojo.CommonResult.success; @RestController // 提供 RESTful API 接口,给 Feign 调用 @@ -75,7 +75,7 @@ public class OrganApiImpl implements OrganApi { } // 产品过期且没有有效的延期记录时,提示产品已过期 if (!productMatch && !delayMatch) { - throw exception(ORG_PRODUCT_EXPIRED); + throw new ServiceException(ORG_PRODUCT_EXPIRED); } return success(true); } diff --git a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/api/process/ProcessGroupApiImpl.java b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/api/process/ProcessGroupApiImpl.java index 327845485..ecb137f9e 100644 --- a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/api/process/ProcessGroupApiImpl.java +++ b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/api/process/ProcessGroupApiImpl.java @@ -1,5 +1,6 @@ package com.cf.imes.module.system.api.process; +import com.cf.imes.framework.common.exception.ServiceException; import com.cf.imes.framework.common.util.object.BeanUtils; import com.cf.imes.module.system.api.process.dto.ProcessListReqDTO; import com.cf.imes.module.system.api.process.dto.ProcessRespDTO; @@ -15,7 +16,6 @@ import jakarta.annotation.Resource; import java.util.ArrayList; import java.util.List; -import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception; import static com.cf.imes.module.system.enums.ErrorCodeConstants.PROCESS_GROUP_NOT_EXISTS; @RestController // 提供 RESTful API 接口,给 Feign 调用 @@ -41,7 +41,7 @@ public class ProcessGroupApiImpl implements ProcessGroupApi { ProcessGroupDO processGroupDO = processGroupMapper.selectById(groupId); if (processGroupDO == null) - throw exception(PROCESS_GROUP_NOT_EXISTS); + throw new ServiceException(PROCESS_GROUP_NOT_EXISTS); String[] items = processGroupDO.getItems().split(","); List lists = new ArrayList<>(); ProcessListReqDTO processListReqDTO = BeanUtils.toBean(processGroupDO, ProcessListReqDTO.class).setLists(lists); diff --git a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/api/setting/SettingApiImpl.java b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/api/setting/SettingApiImpl.java index 931ddb166..191e52098 100644 --- a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/api/setting/SettingApiImpl.java +++ b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/api/setting/SettingApiImpl.java @@ -2,6 +2,7 @@ package com.cf.imes.module.system.api.setting; import com.cf.imes.framework.common.enums.UserSettingTypeEnum; +import com.cf.imes.framework.common.exception.ServiceException; import com.cf.imes.framework.common.util.object.BeanUtils; import com.cf.imes.framework.security.core.LoginUser; import com.cf.imes.module.system.api.setting.dto.PackageConfigDTO; @@ -12,7 +13,6 @@ import org.springframework.web.bind.annotation.RestController; import jakarta.annotation.Resource; -import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception; import static com.cf.imes.framework.security.core.util.SecurityFrameworkUtils.getLoginUser; import static com.cf.imes.module.system.enums.ErrorCodeConstants.CURRENTLY_NO_CONFIGURATION_AVAILABLE; @@ -33,7 +33,7 @@ public class SettingApiImpl implements SettingApi{ PackageConfigDO packageConfigDO = packageConfigMapper.selectSetting(type, loginUser.getId(), loginUser.getOrganId()); if(packageConfigDO == null){ - throw exception(CURRENTLY_NO_CONFIGURATION_AVAILABLE,type == 1 ? UserSettingTypeEnum.PREPACKAGED.getName(): UserSettingTypeEnum.PACKAGED.getName()); + throw new ServiceException(CURRENTLY_NO_CONFIGURATION_AVAILABLE,type == 1 ? UserSettingTypeEnum.PREPACKAGED.getName(): UserSettingTypeEnum.PACKAGED.getName()); } return BeanUtils.toBean(packageConfigDO,PackageConfigDTO.class); diff --git a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/api/systemconfig/SystemConfigApiImpl.java b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/api/systemconfig/SystemConfigApiImpl.java index cf0ca91c9..e5150de69 100644 --- a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/api/systemconfig/SystemConfigApiImpl.java +++ b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/api/systemconfig/SystemConfigApiImpl.java @@ -2,6 +2,7 @@ package com.cf.imes.module.system.api.systemconfig; import cn.hutool.core.collection.CollUtil; import com.cf.imes.framework.common.enums.CommonStatusEnum; +import com.cf.imes.framework.common.exception.ServiceException; import com.cf.imes.framework.common.pojo.CommonResult; import com.cf.imes.framework.common.util.Assert.AssertUtils; import com.cf.imes.framework.common.util.object.BeanUtils; @@ -31,7 +32,6 @@ import java.util.ArrayList; import java.util.List; import java.util.concurrent.atomic.AtomicReference; -import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception; import static com.cf.imes.framework.common.pojo.CommonResult.success; import static com.cf.imes.framework.common.util.json.JsonUtils.parseArray; import static com.cf.imes.framework.common.util.json.JsonUtils.unzipString; @@ -112,7 +112,7 @@ public class SystemConfigApiImpl implements SystemConfigApi { .select(SystemConfigSchemeDO::getId,SystemConfigDO::getSetting)); if(CollUtil.isEmpty(systemConfigSchemeDOS)){ - throw exception(PLAN_PROCESS_CONFIG_ALL_IS_NULL); + throw new ServiceException(PLAN_PROCESS_CONFIG_ALL_IS_NULL); } AtomicReference processSize = new AtomicReference<>(0); @@ -126,13 +126,13 @@ public class SystemConfigApiImpl implements SystemConfigApi { }catch (Exception e){ log.error(e.getMessage()); - throw exception(SYSTEM_PROCESS_SCHEME_CONFIG_FIELD_ERROR); + throw new ServiceException(SYSTEM_PROCESS_SCHEME_CONFIG_FIELD_ERROR); } }); if(processSize.get() == 0){ - throw exception(PLAN_PROCESS_CONFIG_ALL_IS_NULL); + throw new ServiceException(PLAN_PROCESS_CONFIG_ALL_IS_NULL); } return success(processSize.get()); @@ -166,7 +166,7 @@ public class SystemConfigApiImpl implements SystemConfigApi { }catch (Exception e){ log.error(e.getMessage()); - throw exception(SYSTEM_PROCESS_SCHEME_CONFIG_FIELD_ERROR); + throw new ServiceException(SYSTEM_PROCESS_SCHEME_CONFIG_FIELD_ERROR); } List schemeDTOS = BeanUtils.toBean(processSchemeConfigs, ProcessSchemeDTO.class); @@ -201,7 +201,7 @@ public class SystemConfigApiImpl implements SystemConfigApi { } catch (Exception e) { log.error(e.getMessage()); - throw exception(SYSTEM_PROCESS_SCHEME_CONFIG_FIELD_ERROR); + throw new ServiceException(SYSTEM_PROCESS_SCHEME_CONFIG_FIELD_ERROR); } return success(BeanUtils.toBean(processSchemeConfigs,ProcessSchemeDTO.class)); @@ -214,7 +214,7 @@ public class SystemConfigApiImpl implements SystemConfigApi { private void checkValueIsNotEmpty(List value,String error) { if(ObjectUtils.isEmpty(value)){ - throw exception(SYSTEM_PROCESS_SCHEME_CONFIG_DATA_ERROR,error); + throw new ServiceException(SYSTEM_PROCESS_SCHEME_CONFIG_DATA_ERROR,error); } } diff --git a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/controller/admin/organ/OrganController.java b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/controller/admin/organ/OrganController.java index 1882f8916..9860ea817 100644 --- a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/controller/admin/organ/OrganController.java +++ b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/controller/admin/organ/OrganController.java @@ -4,6 +4,7 @@ import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.date.LocalDateTimeUtil; import cn.hutool.core.util.ObjectUtil; +import com.cf.imes.framework.common.exception.ServiceException; import com.cf.imes.framework.common.pojo.CommonResult; import com.cf.imes.framework.common.pojo.PageParam; import com.cf.imes.framework.common.pojo.PageResult; @@ -42,7 +43,6 @@ import java.util.*; import java.util.stream.Collectors; import static cn.hutool.core.date.DatePattern.NORM_DATE_FORMATTER; -import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception; import static com.cf.imes.framework.common.pojo.CommonResult.success; import static com.cf.imes.framework.operatelog.core.enums.OperateTypeEnum.EXPORT; import static com.cf.imes.module.system.enums.ErrorCodeConstants.ORGAN_EXPIRETIME_PRODUCTID_LACK; @@ -119,7 +119,7 @@ public class OrganController { public CommonResult getOrgan(@RequestParam("id") Long id) { OrganizationDO organ = organService.getOrgan(id); if (ObjectUtil.isNull(organ)) { - throw exception(ORGAN_NOT_EXISTS); + throw new ServiceException(ORGAN_NOT_EXISTS); } OrganRespVO bean = BeanUtils.toBean(organ, OrganRespVO.class); @@ -151,14 +151,14 @@ public class OrganController { String expireTime = ""; OrganizationDO organ = organService.getOrgan(id); if (ObjectUtil.isNull(organ)) { - throw exception(ORGAN_NOT_EXISTS); + throw new ServiceException(ORGAN_NOT_EXISTS); } OrganRespVO bean = BeanUtils.toBean(organ, OrganRespVO.class); // 是否管理端,管理端要选了产品后展示有效时间 boolean manageEndPoint = SecurityFrameworkUtils.isManageEndPoint(); if (manageEndPoint) { if (ObjectUtil.isNull(productId)) { - throw exception(ORGAN_EXPIRETIME_PRODUCTID_LACK); + throw new ServiceException(ORGAN_EXPIRETIME_PRODUCTID_LACK); } } else { // 生产端从token中获取产品 diff --git a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/controller/admin/permission/RoleController.java b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/controller/admin/permission/RoleController.java index fb03a14bc..bc92784ba 100644 --- a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/controller/admin/permission/RoleController.java +++ b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/controller/admin/permission/RoleController.java @@ -34,7 +34,6 @@ import java.util.Comparator; import java.util.List; import java.util.Objects; -import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception; import static com.cf.imes.framework.common.pojo.CommonResult.success; import static com.cf.imes.framework.operatelog.core.enums.OperateTypeEnum.EXPORT; import static com.cf.imes.module.system.enums.ErrorCodeConstants.ROLE_NOT_EXISTS; @@ -98,7 +97,7 @@ public class RoleController { public CommonResult getRole(@RequestParam("id") Long id) { RoleDO role = roleService.getRole(id); if (ObjectUtil.isNull(role)) { - throw exception(ROLE_NOT_EXISTS); + throw new ServiceException(ROLE_NOT_EXISTS); } return success(BeanUtils.toBean(role, RoleRespVO.class)); } diff --git a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/controller/admin/user/UserController.java b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/controller/admin/user/UserController.java index 43432c3bd..c13705362 100644 --- a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/controller/admin/user/UserController.java +++ b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/controller/admin/user/UserController.java @@ -3,6 +3,7 @@ package com.cf.imes.module.system.controller.admin.user; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.util.ObjectUtil; import com.cf.imes.framework.common.enums.CommonStatusEnum; +import com.cf.imes.framework.common.exception.ServiceException; import com.cf.imes.framework.common.pojo.CommonResult; import com.cf.imes.framework.common.pojo.PageParam; import com.cf.imes.framework.common.pojo.PageResult; @@ -43,7 +44,6 @@ import java.util.Map; import java.util.Set; import java.util.stream.Collectors; -import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception; import static com.cf.imes.framework.common.pojo.CommonResult.success; import static com.cf.imes.framework.common.util.collection.CollectionUtils.convertList; import static com.cf.imes.framework.operatelog.core.enums.OperateTypeEnum.EXPORT; @@ -167,7 +167,7 @@ public class UserController { public CommonResult getUser(@RequestParam("id") Long id) { AdminUserDO user = userService.getUser(id); if (ObjectUtil.isNull(user)) { - throw exception(USER_NOT_EXISTS); + throw new ServiceException(USER_NOT_EXISTS); } // 拼接数据 DeptDO dept = deptService.getDept(user.getDeptId()); diff --git a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/controller/admin/user/UserProfileController.java b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/controller/admin/user/UserProfileController.java index e96fbe8f8..8c7a01185 100644 --- a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/controller/admin/user/UserProfileController.java +++ b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/controller/admin/user/UserProfileController.java @@ -1,6 +1,7 @@ package com.cf.imes.module.system.controller.admin.user; import com.cf.imes.framework.common.enums.UserTypeEnum; +import com.cf.imes.framework.common.exception.ServiceException; import com.cf.imes.framework.common.pojo.CommonResult; import com.cf.imes.module.system.controller.admin.user.vo.profile.UserMobileUpdateReqVO; import com.cf.imes.module.system.controller.admin.user.vo.profile.UserProfileRespVO; @@ -27,7 +28,6 @@ import jakarta.annotation.Resource; import jakarta.validation.Valid; import java.util.List; -import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception; import static com.cf.imes.framework.common.pojo.CommonResult.success; import static com.cf.imes.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId; import static com.cf.imes.module.infra.enums.ErrorCodeConstants.FILE_IS_EMPTY; @@ -83,7 +83,7 @@ public class UserProfileController { @Operation(summary = "上传用户个人头像") public CommonResult updateUserAvatar(@RequestParam("avatarFile") MultipartFile file) throws Exception { if (file.isEmpty()) { - throw exception(FILE_IS_EMPTY); + throw new ServiceException(FILE_IS_EMPTY); } String avatar = userService.updateUserAvatar(getLoginUserId(), file.getInputStream()); return success(avatar); diff --git a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/dal/mysql/user/AdminUserMapper.java b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/dal/mysql/user/AdminUserMapper.java index a2c1acc71..784320005 100644 --- a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/dal/mysql/user/AdminUserMapper.java +++ b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/dal/mysql/user/AdminUserMapper.java @@ -3,7 +3,7 @@ package com.cf.imes.module.system.dal.mysql.user; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.text.CharSequenceUtil; import com.cf.imes.framework.common.enums.CommonStatusEnum; -import com.cf.imes.framework.common.exception.util.ServiceExceptionUtil; +import com.cf.imes.framework.common.exception.ServiceException; import com.cf.imes.framework.common.pojo.PageResult; import com.cf.imes.framework.mybatis.core.mapper.BaseMapperX; import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX; @@ -53,7 +53,7 @@ public interface AdminUserMapper extends BaseMapperX { .eq(AdminUserDO::getUsername, userName)); if (CollUtil.isNotEmpty(adminUserDOS)) { if (adminUserDOS.size() > 1) { - throw ServiceExceptionUtil.exception(USERNAME_MULTIPLE_ERROR, userName); + throw new ServiceException(USERNAME_MULTIPLE_ERROR, userName); } adminUserDO = adminUserDOS.get(0); } diff --git a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/application/ApplicationServiceImpl.java b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/application/ApplicationServiceImpl.java index 3d8ed7332..c0884340f 100644 --- a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/application/ApplicationServiceImpl.java +++ b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/application/ApplicationServiceImpl.java @@ -1,13 +1,8 @@ package com.cf.imes.module.system.service.application; -import com.cf.imes.framework.common.exception.ServerException; -import com.cf.imes.framework.common.exception.util.ServiceExceptionUtil; +import com.cf.imes.framework.common.exception.ServiceException; import com.cf.imes.framework.common.pojo.PageResult; -import com.cf.imes.framework.common.util.monitor.TracerUtils; import com.cf.imes.framework.common.util.object.BeanUtils; -import com.cf.imes.framework.common.util.servlet.ServletUtils; -import com.cf.imes.framework.organ.core.context.OrganContextHolder; -import com.cf.imes.module.system.api.logger.dto.LoginLogCreateReqDTO; import com.cf.imes.module.system.controller.admin.application.vo.application.ApplicationPageReqVO; import com.cf.imes.module.system.controller.admin.application.vo.application.ApplicationRespVO; import com.cf.imes.module.system.controller.admin.application.vo.application.ApplicationSaveReqVO; @@ -16,11 +11,9 @@ import com.cf.imes.module.system.controller.admin.auth.vo.AuthLoginRespVO; import com.cf.imes.module.system.convert.auth.AuthConvert; import com.cf.imes.module.system.dal.dataobject.application.ApplicationDO; import com.cf.imes.module.system.dal.dataobject.oauth2.OAuth2AccessTokenDO; -import com.cf.imes.module.system.dal.dataobject.organ.OrganizationDO; import com.cf.imes.module.system.dal.mysql.application.ApplicationMapper; import com.cf.imes.module.system.enums.ErrorCodeConstants; import com.cf.imes.module.system.enums.logger.LoginLogTypeEnum; -import com.cf.imes.module.system.enums.logger.LoginResultEnum; import com.cf.imes.module.system.enums.oauth2.OAuth2ClientConstants; import com.cf.imes.module.system.service.oauth2.OAuth2TokenService; import com.cf.imes.module.system.util.rsa.AsymmetricAlgorithmUtil; @@ -29,10 +22,9 @@ import org.springframework.validation.annotation.Validated; import jakarta.annotation.Resource; import java.util.LinkedList; -import java.util.List; import java.util.Objects; -import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception; + import static com.cf.imes.module.system.enums.ErrorCodeConstants.APPLICATION_NOT_EXISTS; /** @@ -84,7 +76,7 @@ public class ApplicationServiceImpl implements ApplicationService{ private void validateApplicationExists(Long id) { if (applicationMapper.selectById(id) == null) { - throw exception(APPLICATION_NOT_EXISTS); + throw new ServiceException(APPLICATION_NOT_EXISTS); } } @@ -102,12 +94,12 @@ public class ApplicationServiceImpl implements ApplicationService{ public ApplicationLoginRespVO loginApplication(ApplicationRespVO reqVO) { ApplicationDO app = applicationMapper.selectByAppId(reqVO.getAppId()); if (Objects.isNull(app)) { - throw ServiceExceptionUtil.exception(ErrorCodeConstants.APPLICATION_NOT_EXISTS); + throw new ServiceException(ErrorCodeConstants.APPLICATION_NOT_EXISTS); } // 公钥加密,私钥解密 String appId = AsymmetricAlgorithmUtil.encryptByPublic(reqVO.getAppKey(), app.getAppSecret()); if (!appId.equals(app.getAppId())) { - throw ServiceExceptionUtil.exception(ErrorCodeConstants.APPLICATION_LOGIN_USER_DISABLED); + throw new ServiceException(ErrorCodeConstants.APPLICATION_LOGIN_USER_DISABLED); } // 创建 Token 令牌,记录登录日志 return BeanUtils.toBean(createTokenAfterLoginSuccess(app.getId(), app.getAppId(), LoginLogTypeEnum.LOGIN_USERNAME), ApplicationLoginRespVO.class).setAppId(app.getId()); diff --git a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/auth/AdminAuthServiceImpl.java b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/auth/AdminAuthServiceImpl.java index 5d2214d0d..c7b9a6f50 100644 --- a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/auth/AdminAuthServiceImpl.java +++ b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/auth/AdminAuthServiceImpl.java @@ -6,7 +6,6 @@ import com.anji.captcha.service.CaptchaService; import com.cf.imes.framework.common.enums.CommonStatusEnum; import com.cf.imes.framework.common.enums.UserTypeEnum; import com.cf.imes.framework.common.exception.ServiceException; -import com.cf.imes.framework.common.exception.util.ServiceExceptionUtil; import com.cf.imes.framework.common.util.monitor.TracerUtils; import com.cf.imes.framework.common.util.servlet.ServletUtils; import com.cf.imes.framework.common.util.validation.ValidationUtils; @@ -57,7 +56,6 @@ import org.springframework.transaction.support.TransactionTemplate; import java.util.Objects; -import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception; import static com.cf.imes.framework.common.util.servlet.ServletUtils.getClientIP; import static com.cf.imes.module.system.enums.ErrorCodeConstants.ORGAN_DATA_CODE_NOT_EXISTS; @@ -132,7 +130,7 @@ public class AdminAuthServiceImpl implements AdminAuthService { // 校验用户是否存在 if (user == null) { createLoginLog(null, username, null, null, logTypeEnum, LoginResultEnum.BAD_CREDENTIALS); - throw ServiceExceptionUtil.exception(ErrorCodeConstants.AUTH_LOGIN_BAD_CREDENTIALS); + throw new ServiceException(ErrorCodeConstants.AUTH_LOGIN_BAD_CREDENTIALS); } Long organId = user.getOrganId(); // 校验机构有效性 @@ -143,12 +141,12 @@ public class AdminAuthServiceImpl implements AdminAuthService { // 校验密码 if (!userService.isPasswordMatch(password, user.getPassword())) { createLoginLog(user.getId(), username, null, organId, logTypeEnum, LoginResultEnum.BAD_CREDENTIALS); - throw ServiceExceptionUtil.exception(ErrorCodeConstants.AUTH_LOGIN_BAD_CREDENTIALS); + throw new ServiceException(ErrorCodeConstants.AUTH_LOGIN_BAD_CREDENTIALS); } // 校验是否禁用 if (CommonStatusEnum.isDisable(user.getStatus())) { createLoginLog(user.getId(), username, null, organId, logTypeEnum, LoginResultEnum.USER_DISABLED); - throw ServiceExceptionUtil.exception(ErrorCodeConstants.AUTH_LOGIN_USER_DISABLED); + throw new ServiceException(ErrorCodeConstants.AUTH_LOGIN_USER_DISABLED); } return user; } @@ -183,7 +181,7 @@ public class AdminAuthServiceImpl implements AdminAuthService { String dataSourceCode = organ.getDataSourceCode(); // 校验机构数据源 if (StringUtils.isBlank(dataSourceCode)) { - throw exception(ORGAN_DATA_CODE_NOT_EXISTS); + throw new ServiceException(ORGAN_DATA_CODE_NOT_EXISTS); } if (CommonStatusEnum.ENABLE.getStatus().equals(organ.getGrayStatus())) { // 机构启用灰度、版本赋值到user @@ -230,7 +228,7 @@ public class AdminAuthServiceImpl implements AdminAuthService { public void sendSmsCode(AuthSmsSendReqVO reqVO) { // 登录场景,验证是否存在 if (userService.getUserByMobile(reqVO.getMobile()) == null) { - throw ServiceExceptionUtil.exception(ErrorCodeConstants.AUTH_MOBILE_NOT_EXISTS); + throw new ServiceException(ErrorCodeConstants.AUTH_MOBILE_NOT_EXISTS); } // 发送验证码 smsCodeApi.sendSmsCode(AuthConvert.INSTANCE.convert(reqVO).setCreateIp(getClientIP())); @@ -244,13 +242,13 @@ public class AdminAuthServiceImpl implements AdminAuthService { // 获得用户信息 AdminUserDO user = userService.getUserByMobile(reqVO.getMobile()); if (user == null) { - throw ServiceExceptionUtil.exception(ErrorCodeConstants.USER_NOT_EXISTS); + throw new ServiceException(ErrorCodeConstants.USER_NOT_EXISTS); } Long organId = user.getOrganId(); OrganizationDO organ = organService.getOrgan(organId); String dataSourceCode = organ.getDataSourceCode(); if(StringUtils.isBlank(dataSourceCode)) { - throw exception(ORGAN_DATA_CODE_NOT_EXISTS); + throw new ServiceException(ORGAN_DATA_CODE_NOT_EXISTS); } // 创建 Token 令牌,记录登录日志 @@ -297,20 +295,20 @@ public class AdminAuthServiceImpl implements AdminAuthService { SocialUserRespDTO socialUser = socialUserService.getSocialUserByCode(UserTypeEnum.ADMIN.getValue(), reqVO.getType(), reqVO.getCode(), reqVO.getState()); if (socialUser == null || socialUser.getUserId() == null) { - throw ServiceExceptionUtil.exception(ErrorCodeConstants.AUTH_THIRD_LOGIN_NOT_BIND); + throw new ServiceException(ErrorCodeConstants.AUTH_THIRD_LOGIN_NOT_BIND); } // 获得用户 AdminUserDO user = userService.getUser(socialUser.getUserId()); if (user == null) { - throw ServiceExceptionUtil.exception(ErrorCodeConstants.USER_NOT_EXISTS); + throw new ServiceException(ErrorCodeConstants.USER_NOT_EXISTS); } Long organId = user.getOrganId(); OrganizationDO organ = organService.getOrgan(organId); String dataSourceCode = organ.getDataSourceCode(); if(StringUtils.isBlank(dataSourceCode)) { - throw exception(ORGAN_DATA_CODE_NOT_EXISTS); + throw new ServiceException(ORGAN_DATA_CODE_NOT_EXISTS); } // 创建 Token 令牌,记录登录日志 @@ -332,7 +330,7 @@ public class AdminAuthServiceImpl implements AdminAuthService { if (!response.isSuccess()) { // 创建登录失败日志(验证码不正确) createLoginLog(null, reqVO.getUsername(), null, null, LoginLogTypeEnum.LOGIN_USERNAME, LoginResultEnum.CAPTCHA_CODE_ERROR); - throw ServiceExceptionUtil.exception(ErrorCodeConstants.AUTH_LOGIN_CAPTCHA_CODE_ERROR, response.getRepMsg()); + throw new ServiceException(ErrorCodeConstants.AUTH_LOGIN_CAPTCHA_CODE_ERROR, response.getRepMsg()); } } diff --git a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/customplateno/CustomPlateNoSeqServiceImpl.java b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/customplateno/CustomPlateNoSeqServiceImpl.java index 60b8ee843..b04c5e76d 100644 --- a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/customplateno/CustomPlateNoSeqServiceImpl.java +++ b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/customplateno/CustomPlateNoSeqServiceImpl.java @@ -22,7 +22,7 @@ import jakarta.annotation.Resource; import java.util.List; import java.util.Optional; -import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception; + import static com.cf.imes.module.system.enums.ErrorCodeConstants.SYSTEM_CONFIG_CUSTOM_PLATE_NO_RULE_FIND; import static com.cf.imes.module.system.enums.ErrorCodeConstants.SYSTEM_CONFIG_NOT_EXISTS; @@ -87,7 +87,7 @@ public class CustomPlateNoSeqServiceImpl implements CustomPlateNoSeqService { .eq(SystemConfigDO::getType, SystemConfigTypeEnum.CUSTOM_PLATE_NO.getType()) .eq(SystemConfigDO::getOrganId, OrganContextHolder.getOrganId())); if (ObjectUtil.isNull(systemConfigDO)) { - throw exception(SYSTEM_CONFIG_NOT_EXISTS); + throw new ServiceException(SYSTEM_CONFIG_NOT_EXISTS); } return systemConfigDO; } diff --git a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/datasource/DataSourceServiceImpl.java b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/datasource/DataSourceServiceImpl.java index c34007d04..ef4d66bc7 100644 --- a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/datasource/DataSourceServiceImpl.java +++ b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/datasource/DataSourceServiceImpl.java @@ -28,7 +28,7 @@ import java.util.*; import java.util.stream.Collectors; import static com.cf.imes.framework.common.exception.enums.GlobalErrorCodeConstants.*; -import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception; + import static com.cf.imes.framework.common.util.object.BeanUtils.toBean; import static com.cf.imes.module.system.enums.ErrorCodeConstants.DATA_SOURCE_NOT_EXISTS; @@ -294,7 +294,7 @@ public class DataSourceServiceImpl implements DataSourceService { private void validateDataSourceExists(Long id) { if (dataSourceMapper.selectById(id) == null) { - throw exception(DATA_SOURCE_NOT_EXISTS); + throw new ServiceException(DATA_SOURCE_NOT_EXISTS); } } diff --git a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/dept/DeptServiceImpl.java b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/dept/DeptServiceImpl.java index 6157f2724..a166fe718 100644 --- a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/dept/DeptServiceImpl.java +++ b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/dept/DeptServiceImpl.java @@ -5,7 +5,7 @@ import cn.hutool.core.util.ObjectUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; import com.cf.imes.framework.common.enums.CommonStatusEnum; -import com.cf.imes.framework.common.exception.util.ServiceExceptionUtil; +import com.cf.imes.framework.common.exception.ServiceException; import com.cf.imes.framework.common.util.object.BeanUtils; import com.cf.imes.framework.organ.core.context.OrganContextHolder; import com.cf.imes.framework.security.core.LoginUser; @@ -30,7 +30,6 @@ import jakarta.annotation.Resource; import java.util.*; import java.util.stream.Collectors; -import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception; import static com.cf.imes.framework.common.util.collection.CollectionUtils.convertSet; import static com.cf.imes.module.system.enums.ErrorCodeConstants.DEPT_USER_OPER_NOT_ALLOW; import static com.cf.imes.module.system.enums.ErrorCodeConstants.PARENT_DEPT_USER_OPER_NOT_ALLOW; @@ -101,13 +100,13 @@ public class DeptServiceImpl implements DeptService { validateDeptExists(id); // 校验是否有子部门 if (deptMapper.selectCountByParentId(id) > 0) { - throw ServiceExceptionUtil.exception(ErrorCodeConstants.DEPT_EXITS_CHILDREN); + throw new ServiceException(ErrorCodeConstants.DEPT_EXITS_CHILDREN); } // 校验部门内用户操作 checkCurrentWhenOperate(id); // 校验部门内是否存在用户,存在用户则禁止删除 if (!userService.getUserListByDeptIds(Collections.singletonList(id)).isEmpty()) { - throw ServiceExceptionUtil.exception(ErrorCodeConstants.DEPT_EXISTS_USER); + throw new ServiceException(ErrorCodeConstants.DEPT_EXISTS_USER); } // 删除部门 deptMapper.deleteById(id); @@ -123,12 +122,12 @@ public class DeptServiceImpl implements DeptService { private void checkCurrentWhenOperate(Long deptId) { Long currentDeptId = SecurityFrameworkUtils.getUserDeptId(); if (ObjectUtil.equal(deptId, currentDeptId)) { - throw exception(DEPT_USER_OPER_NOT_ALLOW); + throw new ServiceException(DEPT_USER_OPER_NOT_ALLOW); } // 递归查询所有下级,如果当前用户在范围内不允许操作 List childDeptList = getChildDeptList(deptId); childDeptList.stream().filter(d -> d.getId().equals(currentDeptId)).findAny().ifPresent(deptDO -> { - throw exception(PARENT_DEPT_USER_OPER_NOT_ALLOW); + throw new ServiceException(PARENT_DEPT_USER_OPER_NOT_ALLOW); }); } @@ -139,7 +138,7 @@ public class DeptServiceImpl implements DeptService { } DeptDO dept = deptMapper.selectById(id); if (dept == null) { - throw ServiceExceptionUtil.exception(ErrorCodeConstants.DEPT_NOT_FOUND); + throw new ServiceException(ErrorCodeConstants.DEPT_NOT_FOUND); } } @@ -150,12 +149,12 @@ public class DeptServiceImpl implements DeptService { } // 1. 不能设置自己为父部门 if (Objects.equals(id, parentId)) { - throw ServiceExceptionUtil.exception(ErrorCodeConstants.DEPT_PARENT_ERROR); + throw new ServiceException(ErrorCodeConstants.DEPT_PARENT_ERROR); } // 2. 父部门不存在 DeptDO parentDept = deptMapper.selectById(parentId); if (parentDept == null) { - throw ServiceExceptionUtil.exception(ErrorCodeConstants.DEPT_PARENT_NOT_EXITS); + throw new ServiceException(ErrorCodeConstants.DEPT_PARENT_NOT_EXITS); } // 2.1 父部门状态校验 checkParentStatus(parentDept.getStatus(), parentDept.getName()); @@ -164,7 +163,7 @@ public class DeptServiceImpl implements DeptService { // 3.1 校验环路 parentId = parentDept.getParentId(); if (Objects.equals(id, parentId)) { - throw ServiceExceptionUtil.exception(ErrorCodeConstants.DEPT_PARENT_IS_CHILD); + throw new ServiceException(ErrorCodeConstants.DEPT_PARENT_IS_CHILD); } // 3.2 继续递归下一级父部门 if (parentId == null || DeptDO.PARENT_ID_ROOT.equals(parentId)) { @@ -187,7 +186,7 @@ public class DeptServiceImpl implements DeptService { */ private void checkParentStatus(Integer status, String parentName) { if (!CommonStatusEnum.ENABLE.getStatus().equals(status)) { - throw ServiceExceptionUtil.exception(ErrorCodeConstants.PARENT_DEPT_DISABLE, parentName); + throw new ServiceException(ErrorCodeConstants.PARENT_DEPT_DISABLE, parentName); } } @@ -199,10 +198,10 @@ public class DeptServiceImpl implements DeptService { } // 如果 id 为空,说明不用比较是否为相同 id 的部门 if (id == null) { - throw ServiceExceptionUtil.exception(ErrorCodeConstants.DEPT_NAME_DUPLICATE); + throw new ServiceException(ErrorCodeConstants.DEPT_NAME_DUPLICATE); } if (ObjectUtil.notEqual(dept.getId(), id)) { - throw ServiceExceptionUtil.exception(ErrorCodeConstants.DEPT_NAME_DUPLICATE); + throw new ServiceException(ErrorCodeConstants.DEPT_NAME_DUPLICATE); } } @@ -266,10 +265,10 @@ public class DeptServiceImpl implements DeptService { public void validDept(Long deptId) { DeptDO deptDO = deptMapper.selectById(deptId); if (deptDO == null) { - throw ServiceExceptionUtil.exception(ErrorCodeConstants.DEPT_NOT_FOUND); + throw new ServiceException(ErrorCodeConstants.DEPT_NOT_FOUND); } if (!CommonStatusEnum.ENABLE.getStatus().equals(deptDO.getStatus())) { - throw ServiceExceptionUtil.exception(ErrorCodeConstants.DEPT_DISABLE, deptDO.getName()); + throw new ServiceException(ErrorCodeConstants.DEPT_DISABLE, deptDO.getName()); } // 递归校验上级部门 validParentDept(deptDO); @@ -287,7 +286,7 @@ public class DeptServiceImpl implements DeptService { return; } if (!CommonStatusEnum.ENABLE.getStatus().equals(deptDO.getStatus())) { - throw ServiceExceptionUtil.exception(ErrorCodeConstants.DEPT_NOT_ALLOWED_LOGIN, deptDO.getName()); + throw new ServiceException(ErrorCodeConstants.DEPT_NOT_ALLOWED_LOGIN, deptDO.getName()); } // 递归校验上级部门 validParentDept(deptDO); @@ -308,9 +307,9 @@ public class DeptServiceImpl implements DeptService { return; } if (parentDept == null) { - throw ServiceExceptionUtil.exception(ErrorCodeConstants.DEPT_PARENT_NOT_EXITS); + throw new ServiceException(ErrorCodeConstants.DEPT_PARENT_NOT_EXITS); } else if (!CommonStatusEnum.ENABLE.getStatus().equals(parentDept.getStatus())) { - throw ServiceExceptionUtil.exception(ErrorCodeConstants.DEPT_DISABLE, parentDept.getName()); + throw new ServiceException(ErrorCodeConstants.DEPT_DISABLE, parentDept.getName()); } else { validParentDept(parentDept); } diff --git a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/dict/DictDataServiceImpl.java b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/dict/DictDataServiceImpl.java index ab127bdcd..b79788e27 100644 --- a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/dict/DictDataServiceImpl.java +++ b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/dict/DictDataServiceImpl.java @@ -8,7 +8,7 @@ import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.cf.imes.framework.common.enums.CommonStatusEnum; -import com.cf.imes.framework.common.exception.util.ServiceExceptionUtil; +import com.cf.imes.framework.common.exception.ServiceException; import com.cf.imes.framework.common.pojo.PageResult; import com.cf.imes.framework.common.util.collection.CollectionUtils; import com.cf.imes.framework.common.util.object.BeanUtils; @@ -151,10 +151,10 @@ public class DictDataServiceImpl implements DictDataService { } // 如果 id 为空,说明不用比较是否为相同 id 的字典数据 if (id == null) { - throw ServiceExceptionUtil.exception(ErrorCodeConstants.DICT_DATA_VALUE_DUPLICATE); + throw new ServiceException(ErrorCodeConstants.DICT_DATA_VALUE_DUPLICATE); } if (!dictData.getId().equals(id)) { - throw ServiceExceptionUtil.exception(ErrorCodeConstants.DICT_DATA_VALUE_DUPLICATE); + throw new ServiceException(ErrorCodeConstants.DICT_DATA_VALUE_DUPLICATE); } } @@ -165,7 +165,7 @@ public class DictDataServiceImpl implements DictDataService { } DictDataDO dictData = dictDataMapper.selectById(id); if (dictData == null) { - throw ServiceExceptionUtil.exception(ErrorCodeConstants.DICT_DATA_NOT_EXISTS); + throw new ServiceException(ErrorCodeConstants.DICT_DATA_NOT_EXISTS); } } @@ -173,10 +173,10 @@ public class DictDataServiceImpl implements DictDataService { public void validateDictTypeExists(String type) { DictTypeDO dictType = dictTypeService.getDictType(type); if (dictType == null) { - throw ServiceExceptionUtil.exception(ErrorCodeConstants.DICT_TYPE_NOT_EXISTS); + throw new ServiceException(ErrorCodeConstants.DICT_TYPE_NOT_EXISTS); } if (!CommonStatusEnum.ENABLE.getStatus().equals(dictType.getStatus())) { - throw ServiceExceptionUtil.exception(ErrorCodeConstants.DICT_TYPE_NOT_ENABLE); + throw new ServiceException(ErrorCodeConstants.DICT_TYPE_NOT_ENABLE); } } @@ -191,10 +191,10 @@ public class DictDataServiceImpl implements DictDataService { values.forEach(value -> { DictDataDO dictData = dictDataMap.get(value); if (dictData == null) { - throw ServiceExceptionUtil.exception(ErrorCodeConstants.DICT_DATA_NOT_EXISTS); + throw new ServiceException(ErrorCodeConstants.DICT_DATA_NOT_EXISTS); } if (!CommonStatusEnum.ENABLE.getStatus().equals(dictData.getStatus())) { - throw ServiceExceptionUtil.exception(ErrorCodeConstants.DICT_DATA_NOT_ENABLE, dictData.getLabel()); + throw new ServiceException(ErrorCodeConstants.DICT_DATA_NOT_ENABLE, dictData.getLabel()); } }); } @@ -246,7 +246,7 @@ public class DictDataServiceImpl implements DictDataService { JSONObject obj = JSON.parseObject(transResult); String errorCode = obj.getString("error_code"); if (StringUtils.isNotEmpty(errorCode)) { - throw ServiceExceptionUtil.exception(DICT_DATA_TRANS_ERROR, errorCode); + throw new ServiceException(DICT_DATA_TRANS_ERROR, errorCode); } JSONArray arr = obj.getJSONArray("trans_result"); diff --git a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/dict/DictTypeServiceImpl.java b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/dict/DictTypeServiceImpl.java index d4f9b6e24..0c669ba4a 100644 --- a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/dict/DictTypeServiceImpl.java +++ b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/dict/DictTypeServiceImpl.java @@ -4,7 +4,7 @@ import cn.hutool.core.text.CharSequenceUtil; import cn.hutool.core.util.ObjectUtil; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.cf.imes.framework.common.enums.DeletedCodeEnum; -import com.cf.imes.framework.common.exception.util.ServiceExceptionUtil; +import com.cf.imes.framework.common.exception.ServiceException; import com.cf.imes.framework.common.pojo.PageResult; import com.cf.imes.framework.common.util.date.LocalDateTimeUtils; import com.cf.imes.framework.common.util.object.BeanUtils; @@ -97,7 +97,7 @@ public class DictTypeServiceImpl implements DictTypeService { DictTypeDO dictType = validateDictTypeExists(id); // 校验是否有字典数据 if (dictDataService.getDictDataCountByDictType(dictType.getType()) > 0) { - throw ServiceExceptionUtil.exception(ErrorCodeConstants.DICT_TYPE_HAS_CHILDREN); + throw new ServiceException(ErrorCodeConstants.DICT_TYPE_HAS_CHILDREN); } // 删除字典类型 dictTypeMapper.updateToDelete(id, LocalDateTime.now()); @@ -116,10 +116,10 @@ public class DictTypeServiceImpl implements DictTypeService { } // 如果 id 为空,说明不用比较是否为相同 id 的字典类型 if (id == null) { - throw ServiceExceptionUtil.exception(ErrorCodeConstants.DICT_TYPE_NAME_DUPLICATE); + throw new ServiceException(ErrorCodeConstants.DICT_TYPE_NAME_DUPLICATE); } if (!dictType.getId().equals(id)) { - throw ServiceExceptionUtil.exception(ErrorCodeConstants.DICT_TYPE_NAME_DUPLICATE); + throw new ServiceException(ErrorCodeConstants.DICT_TYPE_NAME_DUPLICATE); } } @@ -134,10 +134,10 @@ public class DictTypeServiceImpl implements DictTypeService { } // 如果 id 为空,说明不用比较是否为相同 id 的字典类型 if (id == null) { - throw ServiceExceptionUtil.exception(ErrorCodeConstants.DICT_TYPE_TYPE_DUPLICATE); + throw new ServiceException(ErrorCodeConstants.DICT_TYPE_TYPE_DUPLICATE); } if (!dictType.getId().equals(id)) { - throw ServiceExceptionUtil.exception(ErrorCodeConstants.DICT_TYPE_TYPE_DUPLICATE); + throw new ServiceException(ErrorCodeConstants.DICT_TYPE_TYPE_DUPLICATE); } } @@ -148,7 +148,7 @@ public class DictTypeServiceImpl implements DictTypeService { } DictTypeDO dictType = dictTypeMapper.selectById(id); if (dictType == null) { - throw ServiceExceptionUtil.exception(ErrorCodeConstants.DICT_TYPE_NOT_EXISTS); + throw new ServiceException(ErrorCodeConstants.DICT_TYPE_NOT_EXISTS); } return dictType; } diff --git a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/errorcode/ErrorCodeServiceImpl.java b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/errorcode/ErrorCodeServiceImpl.java index 356adf9a8..561193c16 100644 --- a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/errorcode/ErrorCodeServiceImpl.java +++ b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/errorcode/ErrorCodeServiceImpl.java @@ -1,6 +1,7 @@ package com.cf.imes.module.system.service.errorcode; import cn.hutool.core.collection.CollUtil; +import com.cf.imes.framework.common.exception.ServiceException; import com.cf.imes.framework.common.pojo.PageResult; import com.cf.imes.framework.common.util.object.BeanUtils; import com.cf.imes.module.system.api.errorcode.dto.ErrorCodeAutoGenerateReqDTO; @@ -21,7 +22,7 @@ import java.time.LocalDateTime; import java.util.List; import java.util.Map; -import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception; + import static com.cf.imes.framework.common.util.collection.CollectionUtils.convertMap; import static com.cf.imes.framework.common.util.collection.CollectionUtils.convertSet; import static com.cf.imes.module.system.enums.ErrorCodeConstants.ERROR_CODE_DUPLICATE; @@ -90,17 +91,17 @@ public class ErrorCodeServiceImpl implements ErrorCodeService { } // 如果 id 为空,说明不用比较是否为相同 id 的错误码 if (id == null) { - throw exception(ERROR_CODE_DUPLICATE); + throw new ServiceException(ERROR_CODE_DUPLICATE); } if (!errorCodeDO.getId().equals(id)) { - throw exception(ERROR_CODE_DUPLICATE); + throw new ServiceException(ERROR_CODE_DUPLICATE); } } @VisibleForTesting void validateErrorCodeExists(Long id) { if (errorCodeMapper.selectById(id) == null) { - throw exception(ERROR_CODE_NOT_EXISTS); + throw new ServiceException(ERROR_CODE_NOT_EXISTS); } } diff --git a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/funds/advertisement/AdvertisementServiceImpl.java b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/funds/advertisement/AdvertisementServiceImpl.java index 08758b000..2c0e04d66 100644 --- a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/funds/advertisement/AdvertisementServiceImpl.java +++ b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/funds/advertisement/AdvertisementServiceImpl.java @@ -3,6 +3,7 @@ package com.cf.imes.module.system.service.funds.advertisement; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.util.ObjectUtil; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.cf.imes.framework.common.exception.ServiceException; import com.cf.imes.framework.common.pojo.PageResult; import com.cf.imes.framework.common.util.Assert.AssertUtils; import com.cf.imes.framework.common.util.object.BeanUtils; @@ -24,7 +25,6 @@ import java.io.IOException; import java.time.LocalDate; import java.util.*; -import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception; import static com.cf.imes.module.system.enums.ErrorCodeConstants.*; /** @@ -49,7 +49,7 @@ public class AdvertisementServiceImpl implements AdvertisementService{ if (createReqVO.getStartTime().isAfter(createReqVO.getEndTime())) { - throw exception(ADVERTISEMENT_TIME_ERROR); + throw new ServiceException(ADVERTISEMENT_TIME_ERROR); } AdvertisementDO aDo = advertisementMapper.selectAdByAdName(createReqVO.getAdName(), null); @@ -74,7 +74,7 @@ public class AdvertisementServiceImpl implements AdvertisementService{ @Override public void update(AdvertisementSaveReqVO reqVO) { if (reqVO.getStartTime().isAfter(reqVO.getEndTime())) { - throw exception(ADVERTISEMENT_TIME_ERROR); + throw new ServiceException(ADVERTISEMENT_TIME_ERROR); } Long id = reqVO.getId(); @@ -83,7 +83,7 @@ public class AdvertisementServiceImpl implements AdvertisementService{ // 发布中的广告不允许编辑 if (advertisementDO.getStatus().equals(AdvertisementStatusEnum.PUBLISHED.getStatus())) { - throw exception(ADVERTISEMENT_UPDATE_STATUS_ERROR); + throw new ServiceException(ADVERTISEMENT_UPDATE_STATUS_ERROR); } // 广告名重复校验 @@ -111,7 +111,7 @@ public class AdvertisementServiceImpl implements AdvertisementService{ AdvertisementDO advertisementDO = validateAdvertisementExists(id); if (advertisementDO.getStatus().equals(AdvertisementStatusEnum.PUBLISHED.getStatus())) { - throw exception(ADVERTISEMENT_NO_DELETE); + throw new ServiceException(ADVERTISEMENT_NO_DELETE); } // 删除广告 advertisementMapper.deleteById(id); @@ -161,7 +161,7 @@ public class AdvertisementServiceImpl implements AdvertisementService{ // 广告的结束时间 LocalDate endTime = advertisementDO.getEndTime(); if (LocalDate.now().isAfter(endTime)) { - throw exception(ADVERTISEMENT_STATUS_ENDTIME_EXPIRED); + throw new ServiceException(ADVERTISEMENT_STATUS_ENDTIME_EXPIRED); } advertisementMapper.update(new LambdaUpdateWrapper() @@ -186,7 +186,7 @@ public class AdvertisementServiceImpl implements AdvertisementService{ validateAdvertisementExists(id); if (reqVO.getStartTime().isAfter(reqVO.getEndTime())) { - throw exception(ADVERTISEMENT_TIME_ERROR); + throw new ServiceException(ADVERTISEMENT_TIME_ERROR); } advertisementMapper.update(new LambdaUpdateWrapper() @@ -221,7 +221,7 @@ public class AdvertisementServiceImpl implements AdvertisementService{ .eq(AdvertisementDO::getDeleted, false) .eq(AdvertisementDO::getId, id)); if (advertisementDO == null) { - throw exception(ADVERTISEMENT_NO_EXIST); + throw new ServiceException(ADVERTISEMENT_NO_EXIST); } return advertisementDO; } @@ -230,12 +230,12 @@ public class AdvertisementServiceImpl implements AdvertisementService{ public String uploadAdImage(MultipartFile adImageFile) { try { if (adImageFile.isEmpty()) { - throw exception(ADVERTISEMENT_IMAGE_EMPTY_ERROR); + throw new ServiceException(ADVERTISEMENT_IMAGE_EMPTY_ERROR); } return fileApi.createFile(adImageFile.getBytes()); } catch (IOException e) { log.error("上传广告图片失败", e); - throw exception(ADVERTISEMENT_IMAGE_UPLOAD_FAIL); + throw new ServiceException(ADVERTISEMENT_IMAGE_UPLOAD_FAIL); } } } diff --git a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/funds/invoice/InvoiceServiceImpl.java b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/funds/invoice/InvoiceServiceImpl.java index 70c6abc40..bf5f3df22 100644 --- a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/funds/invoice/InvoiceServiceImpl.java +++ b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/funds/invoice/InvoiceServiceImpl.java @@ -58,7 +58,6 @@ import java.util.Locale; import java.util.Optional; import static cn.hutool.core.date.DatePattern.PURE_DATETIME_PATTERN; -import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception; import static com.cf.imes.framework.common.util.json.JsonUtils.parseObject; import static com.cf.imes.framework.common.util.json.JsonUtils.toJsonString; import static com.cf.imes.framework.common.util.json.JsonUtils.unzipString; @@ -343,7 +342,7 @@ public class InvoiceServiceImpl implements InvoiceService { if (invoiceRecordsDO.getStatus().equals(InvoiceStatusEnum.INVOICINGFAILED.getCode()) || invoiceRecordsDO.getStatus().equals(InvoiceStatusEnum.INVOICINGSUCCESSFUL.getCode())) { - throw exception(THIS_INVOICE_IS_FAIL); + throw new ServiceException(THIS_INVOICE_IS_FAIL); } // 校验发票记录下的购买记录是否存在 @@ -425,7 +424,7 @@ public class InvoiceServiceImpl implements InvoiceService { private InvoiceRecordsDO validateInvoiceExists(Long invoiceId) { InvoiceRecordsDO invoiceRecordsDO = invoiceRecordsMapper.selectById(invoiceId); if (ObjectUtil.isNull(invoiceRecordsDO)) { - throw exception(INVOICE_NO_EXIST); + throw new ServiceException(INVOICE_NO_EXIST); } return invoiceRecordsDO; } @@ -439,7 +438,7 @@ public class InvoiceServiceImpl implements InvoiceService { private List validatePurchaseRecordExists(List purchaseId) { List purchaseRecordDOS = purchaseRecordMapper.selectBatchIds(purchaseId); if (CollUtil.isEmpty(purchaseRecordDOS)) { - throw exception(PURCHASE_RECORD_NO_EXIST); + throw new ServiceException(PURCHASE_RECORD_NO_EXIST); } return purchaseRecordDOS; } diff --git a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/funds/productpromotion/ProductPromotionServiceImpl.java b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/funds/productpromotion/ProductPromotionServiceImpl.java index f8923f812..933a4e78c 100644 --- a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/funds/productpromotion/ProductPromotionServiceImpl.java +++ b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/funds/productpromotion/ProductPromotionServiceImpl.java @@ -1,6 +1,7 @@ package com.cf.imes.module.system.service.funds.productpromotion; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.cf.imes.framework.common.exception.ServiceException; import com.cf.imes.framework.common.pojo.PageResult; import com.cf.imes.framework.common.util.Assert.AssertUtils; import com.cf.imes.framework.common.util.date.LocalDateTimeUtils; @@ -21,7 +22,6 @@ import jakarta.annotation.Resource; import java.time.LocalDateTime; import java.util.List; -import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception; import static com.cf.imes.module.system.enums.ErrorCodeConstants.PRODUCT_PROMOTION_ACTIVE_NAME_IS_EXIST; import static com.cf.imes.module.system.enums.ErrorCodeConstants.PRODUCT_PROMOTION_NO_EXIST; import static com.cf.imes.module.system.enums.ErrorCodeConstants.PRODUCT_PROMOTION_PURCHASEDURATION_IS_EXIST; @@ -138,13 +138,13 @@ public class ProductPromotionServiceImpl implements ProductPromotionService { // 校验是否存在 private ProductPromotionDO validateRechargeActiveExists(Long id) { if (id == null) { - throw exception(PRODUCT_PROMOTION_NO_EXIST); + throw new ServiceException(PRODUCT_PROMOTION_NO_EXIST); } ProductPromotionDO giftMoneyDetailsDO = productPromotionMapper.selectOne(new LambdaQueryWrapperX() .eq(ProductPromotionDO::getId, id) .eq(ProductPromotionDO::getDeleted, false)); if (giftMoneyDetailsDO == null) { - throw exception(PRODUCT_PROMOTION_NO_EXIST); + throw new ServiceException(PRODUCT_PROMOTION_NO_EXIST); } return giftMoneyDetailsDO; diff --git a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/funds/products/ProductsDetailServiceImpl.java b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/funds/products/ProductsDetailServiceImpl.java index 7db1357af..a55768eb0 100644 --- a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/funds/products/ProductsDetailServiceImpl.java +++ b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/funds/products/ProductsDetailServiceImpl.java @@ -3,7 +3,7 @@ package com.cf.imes.module.system.service.funds.products; import cn.hutool.core.util.ObjectUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; -import com.cf.imes.framework.common.exception.util.ServiceExceptionUtil; +import com.cf.imes.framework.common.exception.ServiceException; import com.cf.imes.framework.common.pojo.PageResult; import com.cf.imes.framework.common.util.Assert.AssertUtils; import com.cf.imes.framework.common.util.object.BeanUtils; @@ -23,7 +23,6 @@ import jakarta.annotation.Resource; import java.math.BigDecimal; -import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception; import static com.cf.imes.module.system.enums.ErrorCodeConstants.*; /** @@ -99,7 +98,7 @@ public class ProductsDetailServiceImpl implements ProductsDetailService { @Override public ProductsDetailDO validateProductDetailsExists(Long id) { if (id == null) { - throw exception(PRODUCTS_DETAIL_NO_EXIST); + throw new ServiceException(PRODUCTS_DETAIL_NO_EXIST); } ProductsDetailDO productsDetailDO = productDetailsMapper.selectOne(new LambdaQueryWrapperX() @@ -107,7 +106,7 @@ public class ProductsDetailServiceImpl implements ProductsDetailService { .eq(ProductsDetailDO::getDeleted, false)); if (productsDetailDO == null) { - throw exception(PRODUCTS_DETAIL_NO_EXIST); + throw new ServiceException(PRODUCTS_DETAIL_NO_EXIST); } return productsDetailDO; @@ -128,7 +127,7 @@ public class ProductsDetailServiceImpl implements ProductsDetailService { AssertUtils.notEmpty(productsDO, PRODUCTS_NO_EXIST); if (!productsDO.getStatus().equals(ProductStatusEnum.PRODUCT_UPDATES.getStatus())) { - throw exception(PRODUCTS_NOT_NOLIST); + throw new ServiceException(PRODUCTS_NOT_NOLIST); } return productsDO; @@ -148,7 +147,7 @@ public class ProductsDetailServiceImpl implements ProductsDetailService { AssertUtils.notEmpty(productsDO, PRODUCTS_NO_EXIST); if (productsDO.getStatus().equals(ProductStatusEnum.PRODUCT_UPDATES.getStatus())) { - throw exception(PRODUCTS_DETAIL_NO_UPDATE); + throw new ServiceException(PRODUCTS_DETAIL_NO_UPDATE); } return productsDO; @@ -167,7 +166,7 @@ public class ProductsDetailServiceImpl implements ProductsDetailService { // 时长去重 count = productDetailsMapper.selectCountByDuration(createReqVO.getProductId(), createReqVO.getId(), duration, durationUnit); if (count > 0) { - throw ServiceExceptionUtil.exception(PRODUCTS_DETAIL_DURATION_EXIST, duration, ProductDurationUnitEnum.getDesc(durationUnit)); + throw new ServiceException(PRODUCTS_DETAIL_DURATION_EXIST, duration, ProductDurationUnitEnum.getDesc(durationUnit)); } } diff --git a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/funds/products/ProductsServiceImpl.java b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/funds/products/ProductsServiceImpl.java index 6e10f3e13..a5bc285f8 100644 --- a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/funds/products/ProductsServiceImpl.java +++ b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/funds/products/ProductsServiceImpl.java @@ -1,6 +1,7 @@ package com.cf.imes.module.system.service.funds.products; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.cf.imes.framework.common.exception.ServiceException; import com.cf.imes.framework.common.pojo.PageResult; import com.cf.imes.framework.common.util.Assert.AssertUtils; import com.cf.imes.framework.common.util.object.BeanUtils; @@ -18,7 +19,6 @@ import jakarta.annotation.Resource; import java.util.List; -import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception; import static com.cf.imes.module.system.enums.ErrorCodeConstants.*; /** @@ -63,7 +63,7 @@ public class ProductsServiceImpl implements ProductsService { // 当前状态是上架状态 && 目标状态不是下架 的操作提示已上架 if (ProductStatusEnum.PRODUCT_UPDATES.getStatus().equals(status) && !ProductStatusEnum.isProductDelis(updateReqVOStatus)) { - throw exception(PRODUCTS_NO_UPDATE); + throw new ServiceException(PRODUCTS_NO_UPDATE); } ProductsDO productsDO = BeanUtils.toBean(updateReqVO, ProductsDO.class); productsMapper.updateById(productsDO); @@ -82,7 +82,7 @@ public class ProductsServiceImpl implements ProductsService { ProductsDO productsDO = validateProductPlateExists(id); if(productsDO.getStatus().equals(ProductStatusEnum.PRODUCT_UPDATES.getStatus())){ - throw exception(PRODUCTS_NO_DELETE); + throw new ServiceException(PRODUCTS_NO_DELETE); } productsMapper.update(new LambdaUpdateWrapper() @@ -115,7 +115,7 @@ public class ProductsServiceImpl implements ProductsService { .eq(ProductsDO::getDeleted, false)); if (productsDO == null) { - throw exception(PRODUCTS_NO_EXIST); + throw new ServiceException(PRODUCTS_NO_EXIST); } return productsDO; } diff --git a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/funds/purchase/PurchaseServiceImpl.java b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/funds/purchase/PurchaseServiceImpl.java index 9d9b95984..068229748 100644 --- a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/funds/purchase/PurchaseServiceImpl.java +++ b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/funds/purchase/PurchaseServiceImpl.java @@ -8,7 +8,6 @@ import cn.hutool.core.util.ObjectUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.cf.imes.framework.common.exception.ServiceException; -import com.cf.imes.framework.common.exception.util.ServiceExceptionUtil; import com.cf.imes.framework.common.pojo.PageParam; import com.cf.imes.framework.common.pojo.PageResult; import com.cf.imes.framework.common.util.date.LocalDateTimeUtils; @@ -249,7 +248,7 @@ public class PurchaseServiceImpl implements PurchaseService { .findFirst(); if (duplicateOpt.isPresent()) { - throw ServiceExceptionUtil.exception(ORG_PRODUCT_PURCHASE_EXIST_ERROR, currProductMap.get(duplicateOpt.get().getProductId())); + throw new ServiceException(ORG_PRODUCT_PURCHASE_EXIST_ERROR, currProductMap.get(duplicateOpt.get().getProductId())); } // 5、删选出当前记录和入参列表中purchaseId不重复的,作为删除的部分 diff --git a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/labeltemplate/LabelTemplateServiceImpl.java b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/labeltemplate/LabelTemplateServiceImpl.java index f19e32cb8..fee0a63f5 100644 --- a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/labeltemplate/LabelTemplateServiceImpl.java +++ b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/labeltemplate/LabelTemplateServiceImpl.java @@ -1,6 +1,7 @@ package com.cf.imes.module.system.service.labeltemplate; import cn.hutool.core.collection.CollUtil; +import com.cf.imes.framework.common.exception.ServiceException; import com.cf.imes.framework.common.util.json.JsonUtils; import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX; import lombok.extern.slf4j.Slf4j; @@ -14,7 +15,6 @@ import com.cf.imes.module.system.dal.dataobject.labeltemplate.LabelTemplateDO; import com.cf.imes.framework.common.util.object.BeanUtils; import com.cf.imes.module.system.dal.mysql.labeltemplate.LabelTemplateMapper; import jakarta.annotation.Resource; -import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception; import static com.cf.imes.module.system.enums.ErrorCodeConstants.*; /** @@ -58,18 +58,18 @@ public class LabelTemplateServiceImpl implements LabelTemplateService { // 校验存在 LabelTemplateDO labelTemplateDO = labelTemplateMapper.selectById(id); if (labelTemplateDO == null) { - throw exception(LABEL_TEMPLATE_NOT_EXISTS); + throw new ServiceException(LABEL_TEMPLATE_NOT_EXISTS); } Boolean isDefault = labelTemplateDO.getIsDefault(); if(isDefault) { - throw exception(DEFAULT_NOT_DELETED); + throw new ServiceException(DEFAULT_NOT_DELETED); } labelTemplateMapper.deleteById(id); } private void validateLabelTemplateExists(Long id) { if (labelTemplateMapper.selectById(id) == null) { - throw exception(LABEL_TEMPLATE_NOT_EXISTS); + throw new ServiceException(LABEL_TEMPLATE_NOT_EXISTS); } } @@ -90,14 +90,14 @@ public class LabelTemplateServiceImpl implements LabelTemplateService { ); if(CollUtil.isNotEmpty(labelTemplateDOS)) { if (labelTemplateDOS.size() > 1) { - throw exception(DEFAULT_TEMPLATE_COUNT); + throw new ServiceException(DEFAULT_TEMPLATE_COUNT); } LabelTemplateDO labelTemplateDO = labelTemplateDOS.get(0); labelTemplateDO.setTemplate(JsonUtils.unzipString(labelTemplateDO.getTemplate())); LabelTemplateRespVO labelTemplateRespVO = BeanUtils.toBean(labelTemplateDO, LabelTemplateRespVO.class); return labelTemplateRespVO; } - throw exception(DEFAULT_LABEL_NOT_EXISTS); + throw new ServiceException(DEFAULT_LABEL_NOT_EXISTS); } @Override @@ -105,14 +105,14 @@ public class LabelTemplateServiceImpl implements LabelTemplateService { public Boolean setDefaultTemplate(Long id) { LabelTemplateDO labelTemplateDO = labelTemplateMapper.selectById(id); if(Objects.isNull(labelTemplateDO)) { - throw exception(LABEL_TEMPLATE_NOT_EXISTS); + throw new ServiceException(LABEL_TEMPLATE_NOT_EXISTS); } List labelTemplateDOS = labelTemplateMapper.selectList(new LambdaQueryWrapperX() .eq(LabelTemplateDO::getIsDefault, Boolean.TRUE) .eq(LabelTemplateDO::getType, labelTemplateDO.getType()) ); // if(CollectionUtil.isEmpty(labelTemplateDOS) || labelTemplateDOS.size()>1) { -// throw exception(DEFAULT_TEMPLATE_COUNT); +// throw new ServiceException(DEFAULT_TEMPLATE_COUNT); // } if(!labelTemplateDOS.isEmpty()){ LabelTemplateDO templateDO = new LabelTemplateDO(); diff --git a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/lable/LabelServiceImpl.java b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/lable/LabelServiceImpl.java index b4566495f..83c4ef80b 100644 --- a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/lable/LabelServiceImpl.java +++ b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/lable/LabelServiceImpl.java @@ -2,6 +2,7 @@ package com.cf.imes.module.system.service.lable; import cn.hutool.core.collection.CollUtil; import com.cf.imes.framework.common.enums.UserSettingTypeEnum; +import com.cf.imes.framework.common.exception.ServiceException; import com.cf.imes.framework.common.pojo.PageResult; import com.cf.imes.framework.common.util.json.JsonUtils; import com.cf.imes.framework.common.util.object.BeanUtils; @@ -27,7 +28,6 @@ import java.util.List; import java.util.Map; import java.util.stream.Collectors; -import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception; import static com.cf.imes.framework.common.util.json.JsonUtils.parseTree; import static com.cf.imes.framework.common.util.json.JsonUtils.unzipString; import static com.cf.imes.framework.security.core.util.SecurityFrameworkUtils.getUserOrganId; @@ -90,7 +90,7 @@ public class LabelServiceImpl implements LabelService { .eq(MachineDO::getLabelId, id) ); if(CollUtil.isNotEmpty(machineDOS)) { - throw exception(MACHINE_USE_LABEL); + throw new ServiceException(MACHINE_USE_LABEL); } List labelId = new ArrayList<>(); @@ -110,7 +110,7 @@ public class LabelServiceImpl implements LabelService { }); if (CollUtil.isNotEmpty(labelId) && labelId.contains(id)) { - throw exception(LABEL_IS_USE_ERROR); + throw new ServiceException(LABEL_IS_USE_ERROR); } } @@ -122,7 +122,7 @@ public class LabelServiceImpl implements LabelService { private LabelDO validateLabelExists(Long id) { LabelDO labelDO = labelMapper.selectById(id); if (labelDO == null) { - throw exception(LABEL_NOT_EXISTS); + throw new ServiceException(LABEL_NOT_EXISTS); } return labelDO; } diff --git a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/machine/MachineServiceImpl.java b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/machine/MachineServiceImpl.java index 3e269dd27..0261fe51f 100644 --- a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/machine/MachineServiceImpl.java +++ b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/machine/MachineServiceImpl.java @@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSON; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.PageDTO; import com.cf.imes.framework.common.enums.MachineTypeEnum; +import com.cf.imes.framework.common.exception.ServiceException; import com.cf.imes.framework.common.pojo.PageResult; import com.cf.imes.framework.common.util.json.JsonUtils; import com.cf.imes.framework.common.util.object.BeanUtils; @@ -44,7 +45,6 @@ import java.util.List; import java.util.Map; import java.util.stream.Collectors; -import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception; import static com.cf.imes.framework.common.util.json.JsonUtils.*; import static com.cf.imes.framework.security.core.util.SecurityFrameworkUtils.getUserOrganId; import static com.cf.imes.module.system.enums.ErrorCodeConstants.*; @@ -95,13 +95,13 @@ public class MachineServiceImpl implements MachineService { MachineLimitDO machineLimitDO = machineLimitMapper.selectById(loginUser.getOrganId()); if(machineLimitDO == null){ - throw exception(MACHINE_DATA_ERROR); + throw new ServiceException(MACHINE_DATA_ERROR); } // 校验机台名称是否重复 MachineDO machine = machineMapper.selectMachineName(createReqVO.getName(), createReqVO.getMachineType(), getUserOrganId()); if (machine != null) { - throw exception(MACHINE_NAME_ERROR); + throw new ServiceException(MACHINE_NAME_ERROR); } validateMachineNum(createReqVO.getMachineType(), loginUser.getOrganId()); @@ -132,7 +132,7 @@ public class MachineServiceImpl implements MachineService { machineTemplateDO = machineTemplateMapper.selectMachine(createReqVO.getBrandId(), createReqVO.getMachineId()); if (machineTemplateDO == null) { - throw exception(THE_MODEL_OF_THE_MACHINE_DOES_NOT_EXIST); + throw new ServiceException(THE_MODEL_OF_THE_MACHINE_DOES_NOT_EXIST); } // 创建新的机器对象 @@ -349,11 +349,11 @@ public class MachineServiceImpl implements MachineService { // 校验存在 MachineDO machineDO = machineMapper.selectById(id); if (machineDO == null) { - throw exception(MACHINE_NOT_EXISTS); + throw new ServiceException(MACHINE_NOT_EXISTS); } // 校验当前机台是否使用 if (Boolean.TRUE.equals(orderPlanApi.getOrderPlan(id).getData())) { - throw exception(THE_CURRENT_MACHINE_IS_ALREADY_IN_USE); + throw new ServiceException(THE_CURRENT_MACHINE_IS_ALREADY_IN_USE); } List systemConfigSchemeDOS = systemConfigSchemeMapper.selectOrganConfig(machineDO.getOrganId()); @@ -374,7 +374,7 @@ public class MachineServiceImpl implements MachineService { } if(machineIds.contains(id)){ - throw exception(MACHINE_USED_ALREADY); + throw new ServiceException(MACHINE_USED_ALREADY); } machineMapper.deleteById(id); @@ -384,7 +384,7 @@ public class MachineServiceImpl implements MachineService { public void batchDeleteCutting(List ids) { List machineDOS = machineMapper.selectBatchIds(ids); if (CollUtil.isEmpty(machineDOS)) { - throw exception(MACHINE_NOT_EXISTS); + throw new ServiceException(MACHINE_NOT_EXISTS); } machineMapper.deleteBatchIds(ids); } @@ -394,7 +394,7 @@ public class MachineServiceImpl implements MachineService { MachineDO machineDO = machineMapper.selectById(id); if (machineDO == null) { - throw exception(MACHINE_ERROR); + throw new ServiceException(MACHINE_ERROR); } // 对机台的配置进行解压 machineDO.setSetting(JsonUtils.unzipString(machineDO.getSetting())); @@ -440,20 +440,20 @@ public class MachineServiceImpl implements MachineService { OrganizationDO tenant = organMapper.selectById(vo.getOrganId()); if (tenant == null) { - throw exception(ORGAN_NOT_EXISTS); + throw new ServiceException(ORGAN_NOT_EXISTS); } MachineLimitDO machineLimit = machineLimitMapper.selectById(vo.getOrganId()); if (machineLimit != null) { - throw exception(ORGAN_ALREADY_EXISTS); + throw new ServiceException(ORGAN_ALREADY_EXISTS); } Integer[] limits = {vo.getCutLimit(), vo.getDrillLimit(), vo.getLabelLimit(), vo.getSawLimit(), vo.getSealedgeLimit()}; for (Integer limit : limits) { if (limit > 127) { - throw exception(MACHINE_NUM_DATA_ERROR); + throw new ServiceException(MACHINE_NUM_DATA_ERROR); } } @@ -478,7 +478,7 @@ public class MachineServiceImpl implements MachineService { OrganizationDO tenant = organMapper.selectById(vo.getOrganId()); if (tenant == null) { - throw exception(ORGAN_NOT_EXISTS); + throw new ServiceException(ORGAN_NOT_EXISTS); } @@ -486,7 +486,7 @@ public class MachineServiceImpl implements MachineService { for (Integer limit : limits) { if (limit > 127) { - throw exception(MACHINE_NUM_DATA_ERROR); + throw new ServiceException(MACHINE_NUM_DATA_ERROR); } } @@ -587,12 +587,12 @@ public class MachineServiceImpl implements MachineService { private void validateExists(Long id, String name, Integer machineType, Long machineId) { MachineDO machineDO = machineMapper.selectById(id); if (machineDO == null) { - throw exception(MACHINE_NOT_EXISTS); + throw new ServiceException(MACHINE_NOT_EXISTS); } MachineDO machine = machineMapper.selectMachine(name, machineType, machineId, getUserOrganId()); if (machine != null) { - throw exception(MACHINE_NAME_ERROR); + throw new ServiceException(MACHINE_NAME_ERROR); } } @@ -613,7 +613,7 @@ public class MachineServiceImpl implements MachineService { }; if (machineNum >= authMachineNum) { - throw exception(MACHINE_NUM_ERROR); + throw new ServiceException(MACHINE_NUM_ERROR); } } diff --git a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/machine/MachineTemplateServiceImpl.java b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/machine/MachineTemplateServiceImpl.java index c927b1520..ba626558c 100644 --- a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/machine/MachineTemplateServiceImpl.java +++ b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/machine/MachineTemplateServiceImpl.java @@ -5,6 +5,7 @@ import co.elastic.clients.elasticsearch.ElasticsearchClient; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.cf.imes.framework.common.enums.CommonStatusEnum; import com.cf.imes.framework.common.enums.MachineTypeEnum; +import com.cf.imes.framework.common.exception.ServiceException; import com.cf.imes.framework.common.pojo.PageResult; import com.cf.imes.framework.common.util.json.JsonUtils; import com.cf.imes.framework.common.util.object.BeanUtils; @@ -34,7 +35,6 @@ import java.util.Map; import java.util.Objects; import java.util.stream.Collectors; -import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception; import static com.cf.imes.framework.common.util.json.JsonUtils.unzipString; import static com.cf.imes.module.system.enums.ErrorCodeConstants.*; @@ -74,7 +74,7 @@ public class MachineTemplateServiceImpl implements MachineTemplateService { // todo 测试时的判断,测试完毕后删除 if (reqVO.getNowBrandId() == null) { - throw exception(THE_CURRENT_BRAND); + throw new ServiceException(THE_CURRENT_BRAND); } validateMachineTemplate(reqVO.getName(), reqVO.getMachineType()); @@ -113,7 +113,7 @@ public class MachineTemplateServiceImpl implements MachineTemplateService { MachineBrandDO machineBrandDO = machineBrandMapper.selectById(reqVO.getNowBrandId()); if (machineBrandDO == null) { - throw exception(THE_CURRENT_BRAND); + throw new ServiceException(THE_CURRENT_BRAND); } // 校验机台模板是否存在和名称是否重复 @@ -133,7 +133,7 @@ public class MachineTemplateServiceImpl implements MachineTemplateService { public CuttingTemplateRespVO getCuttingTemplateById(String id) { MachineTemplateDO templateDO = machineTemplateMapper.selectById(id); if (Objects.isNull(templateDO)) { - throw exception(MACHINE_TEMPLATE_NOT_EXISTS); + throw new ServiceException(MACHINE_TEMPLATE_NOT_EXISTS); } templateDO.setSetting(unzipString(templateDO.getSetting())); return MachineTemplateConvert.convert1(templateDO); @@ -154,7 +154,7 @@ public class MachineTemplateServiceImpl implements MachineTemplateService { List machineTemplateDOS = machineTemplateMapper.selectByBrand(brandId); if (!machineTemplateDOS.isEmpty()) { -// throw exception(MACHINE_TEMPLATE_NOT_EXISTS); +// throw new ServiceException(MACHINE_TEMPLATE_NOT_EXISTS); List ids = machineTemplateDOS.stream().map(MachineTemplateDO::getId).toList(); @@ -252,7 +252,7 @@ public class MachineTemplateServiceImpl implements MachineTemplateService { MachineBrandDO machineBrandDO = machineBrandMapper.selectBrand(reqVO.getBrand(), reqVO.getMachineType()); if (machineBrandDO != null) { - throw exception(THE_CURRENT_BRAND_OF_THE_MACHINE_EXISTS); + throw new ServiceException(THE_CURRENT_BRAND_OF_THE_MACHINE_EXISTS); } MachineBrandDO machineBrand = MachineBrandDO.builder() @@ -288,7 +288,7 @@ public class MachineTemplateServiceImpl implements MachineTemplateService { private MachineBrandDO validateBrandExistes(Long id) { MachineBrandDO machineBrandDO = machineBrandMapper.selectById(id); if (ObjectUtil.isNull(machineBrandDO)) { - throw exception(THE_CURRENT_BRAND); + throw new ServiceException(THE_CURRENT_BRAND); } return machineBrandDO; } @@ -381,7 +381,7 @@ public class MachineTemplateServiceImpl implements MachineTemplateService { public Boolean deleteCuttingTemplate(Long id) { MachineTemplateDO templateDO = machineTemplateMapper.selectById(id); if (Objects.isNull(templateDO)) { - throw exception(MACHINE_TEMPLATE_NOT_EXISTS); + throw new ServiceException(MACHINE_TEMPLATE_NOT_EXISTS); } machineTemplateMapper.deleteById(id); @@ -458,7 +458,7 @@ public class MachineTemplateServiceImpl implements MachineTemplateService { } catch (Exception e) { - throw exception(LABELINGMACHINE_RELATED_DATA_ERROR); + throw new ServiceException(LABELINGMACHINE_RELATED_DATA_ERROR); } } @@ -509,7 +509,7 @@ public class MachineTemplateServiceImpl implements MachineTemplateService { } catch (Exception e) { - throw exception(DRILLMACHINE_RELATED_DATA_ERROR); + throw new ServiceException(DRILLMACHINE_RELATED_DATA_ERROR); } } @@ -523,13 +523,13 @@ public class MachineTemplateServiceImpl implements MachineTemplateService { MachineTemplateDO machineTemplateDO = machineTemplateMapper.selectById(machineId); if (machineTemplateDO == null) { - throw exception(MACHINE_TEMPLATE_NOT_EXISTS); + throw new ServiceException(MACHINE_TEMPLATE_NOT_EXISTS); } MachineTemplateDO machineTemplate = machineTemplateMapper.selectMachineTemplate(name, machineType, machineId); if (machineTemplate != null) { - throw exception(MACHINETEMPLATE_NAME_ERROR); + throw new ServiceException(MACHINETEMPLATE_NAME_ERROR); } } @@ -541,7 +541,7 @@ public class MachineTemplateServiceImpl implements MachineTemplateService { if (machineTemplateDO != null) { - throw exception(MACHINETEMPLATE_NAME_ERROR); + throw new ServiceException(MACHINETEMPLATE_NAME_ERROR); } } diff --git a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/mail/MailAccountServiceImpl.java b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/mail/MailAccountServiceImpl.java index 51d52cd2d..5d4ab191c 100644 --- a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/mail/MailAccountServiceImpl.java +++ b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/mail/MailAccountServiceImpl.java @@ -1,6 +1,6 @@ package com.cf.imes.module.system.service.mail; -import com.cf.imes.framework.common.exception.util.ServiceExceptionUtil; +import com.cf.imes.framework.common.exception.ServiceException; import com.cf.imes.framework.common.pojo.PageResult; import com.cf.imes.framework.common.util.object.BeanUtils; import com.cf.imes.module.system.controller.admin.mail.vo.account.MailAccountPageReqVO; @@ -18,8 +18,6 @@ import org.springframework.validation.annotation.Validated; import jakarta.annotation.Resource; import java.util.List; -import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception; - /** * 邮箱账号 Service 实现类 * @@ -62,7 +60,7 @@ public class MailAccountServiceImpl implements MailAccountService { validateMailAccountExists(id); // 校验是否存在关联模版 if (mailTemplateService.getMailTemplateCountByAccountId(id) > 0) { - throw ServiceExceptionUtil.exception(ErrorCodeConstants.MAIL_ACCOUNT_RELATE_TEMPLATE_EXISTS); + throw new ServiceException(ErrorCodeConstants.MAIL_ACCOUNT_RELATE_TEMPLATE_EXISTS); } // 删除 @@ -71,7 +69,7 @@ public class MailAccountServiceImpl implements MailAccountService { private void validateMailAccountExists(Long id) { if (mailAccountMapper.selectById(id) == null) { - throw ServiceExceptionUtil.exception(ErrorCodeConstants.MAIL_ACCOUNT_NOT_EXISTS); + throw new ServiceException(ErrorCodeConstants.MAIL_ACCOUNT_NOT_EXISTS); } } diff --git a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/mail/MailSendServiceImpl.java b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/mail/MailSendServiceImpl.java index ecb11e1d6..d58496e19 100644 --- a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/mail/MailSendServiceImpl.java +++ b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/mail/MailSendServiceImpl.java @@ -5,6 +5,7 @@ import cn.hutool.extra.mail.MailAccount; import cn.hutool.extra.mail.MailUtil; import com.cf.imes.framework.common.enums.CommonStatusEnum; import com.cf.imes.framework.common.enums.UserTypeEnum; +import com.cf.imes.framework.common.exception.ServiceException; import com.cf.imes.module.system.convert.mail.MailAccountConvert; import com.cf.imes.module.system.dal.dataobject.mail.MailAccountDO; import com.cf.imes.module.system.dal.dataobject.mail.MailTemplateDO; @@ -13,7 +14,6 @@ import com.cf.imes.module.system.mq.message.mail.MailSendMessage; import com.cf.imes.module.system.mq.producer.mail.MailProducer; import com.cf.imes.module.system.service.member.MemberService; import com.cf.imes.module.system.service.user.AdminUserService; -import com.cf.imes.framework.common.exception.util.ServiceExceptionUtil; import com.cf.imes.module.system.enums.ErrorCodeConstants; import com.google.common.annotations.VisibleForTesting; import lombok.extern.slf4j.Slf4j; @@ -123,7 +123,7 @@ public class MailSendServiceImpl implements MailSendService { MailTemplateDO template = mailTemplateService.getMailTemplateByCodeFromCache(templateCode); // 邮件模板不存在 if (template == null) { - throw ServiceExceptionUtil.exception(ErrorCodeConstants.MAIL_TEMPLATE_NOT_EXISTS); + throw new ServiceException(ErrorCodeConstants.MAIL_TEMPLATE_NOT_EXISTS); } return template; } @@ -134,7 +134,7 @@ public class MailSendServiceImpl implements MailSendService { MailAccountDO account = mailAccountService.getMailAccountFromCache(accountId); // 邮箱账号不存在 if (account == null) { - throw ServiceExceptionUtil.exception(ErrorCodeConstants.MAIL_ACCOUNT_NOT_EXISTS); + throw new ServiceException(ErrorCodeConstants.MAIL_ACCOUNT_NOT_EXISTS); } return account; } @@ -142,7 +142,7 @@ public class MailSendServiceImpl implements MailSendService { @VisibleForTesting String validateMail(String mail) { if (CharSequenceUtil.isEmpty(mail)) { - throw ServiceExceptionUtil.exception(ErrorCodeConstants.MAIL_SEND_MAIL_NOT_EXISTS); + throw new ServiceException(ErrorCodeConstants.MAIL_SEND_MAIL_NOT_EXISTS); } return mail; } @@ -158,7 +158,7 @@ public class MailSendServiceImpl implements MailSendService { template.getParams().forEach(key -> { Object value = templateParams.get(key); if (value == null) { - throw ServiceExceptionUtil.exception(ErrorCodeConstants.MAIL_SEND_TEMPLATE_PARAM_MISS, key); + throw new ServiceException(ErrorCodeConstants.MAIL_SEND_TEMPLATE_PARAM_MISS, key); } }); } diff --git a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/mail/MailTemplateServiceImpl.java b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/mail/MailTemplateServiceImpl.java index ca3a9e8bd..9fa3d7eb6 100644 --- a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/mail/MailTemplateServiceImpl.java +++ b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/mail/MailTemplateServiceImpl.java @@ -3,7 +3,7 @@ package com.cf.imes.module.system.service.mail; import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ReUtil; import cn.hutool.core.util.StrUtil; -import com.cf.imes.framework.common.exception.util.ServiceExceptionUtil; +import com.cf.imes.framework.common.exception.ServiceException; import com.cf.imes.framework.common.pojo.PageResult; import com.cf.imes.framework.common.util.object.BeanUtils; import com.cf.imes.module.system.controller.admin.mail.vo.template.MailTemplatePageReqVO; @@ -25,8 +25,6 @@ import java.util.List; import java.util.Map; import java.util.regex.Pattern; -import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception; - /** * 邮箱模版 Service 实现类 * @@ -82,7 +80,7 @@ public class MailTemplateServiceImpl implements MailTemplateService { // 存在 template 记录的情况下 if (id == null // 新增时,说明重复 || ObjectUtil.notEqual(id, template.getId())) { // 更新时,如果 id 不一致,说明重复 - throw ServiceExceptionUtil.exception(ErrorCodeConstants.MAIL_TEMPLATE_CODE_EXISTS); + throw new ServiceException(ErrorCodeConstants.MAIL_TEMPLATE_CODE_EXISTS); } } @@ -99,7 +97,7 @@ public class MailTemplateServiceImpl implements MailTemplateService { private void validateMailTemplateExists(Long id) { if (mailTemplateMapper.selectById(id) == null) { - throw ServiceExceptionUtil.exception(ErrorCodeConstants.MAIL_TEMPLATE_NOT_EXISTS); + throw new ServiceException(ErrorCodeConstants.MAIL_TEMPLATE_NOT_EXISTS); } } diff --git a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/notice/NoticeServiceImpl.java b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/notice/NoticeServiceImpl.java index a6860b9e6..eae9286dc 100644 --- a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/notice/NoticeServiceImpl.java +++ b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/notice/NoticeServiceImpl.java @@ -3,7 +3,7 @@ package com.cf.imes.module.system.service.notice; import cn.hutool.core.util.ObjectUtil; import cn.hutool.extra.spring.SpringUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.cf.imes.framework.common.exception.util.ServiceExceptionUtil; +import com.cf.imes.framework.common.exception.ServiceException; import com.cf.imes.framework.common.pojo.PageResult; import com.cf.imes.framework.common.util.object.BeanUtils; import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX; @@ -20,7 +20,6 @@ import org.springframework.stereotype.Service; import jakarta.annotation.Resource; -import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception; import static com.cf.imes.module.system.enums.ErrorCodeConstants.NOTICE_NAME_UNIQE_ERROR; /** @@ -96,18 +95,18 @@ public class NoticeServiceImpl implements NoticeService { } NoticeDO notice = noticeMapper.selectById(id); if (notice == null) { - throw ServiceExceptionUtil.exception(ErrorCodeConstants.NOTICE_NOT_FOUND); + throw new ServiceException(ErrorCodeConstants.NOTICE_NOT_FOUND); } boolean superAdmin = SecurityFrameworkUtils.isSuperAdmin(); // 公告和操作人非统一组织,只有超管可以编辑和删除 if (NoticeSourceEnum.CUSTOM.equals(notice.getSource()) && !notice.getOrganId().equals(OrganContextHolder.getOrganId()) && !superAdmin) { - throw ServiceExceptionUtil.exception(ErrorCodeConstants.NOTICE_NOT_FOUND); + throw new ServiceException(ErrorCodeConstants.NOTICE_NOT_FOUND); } // 只有超管可以操作内置公告 if (NoticeSourceEnum.SYSTEM.equals(notice.getSource()) && !superAdmin) { - throw ServiceExceptionUtil.exception(ErrorCodeConstants.NOTICE_BUILDIN_MODIFY_PERMISSION_ERROR); + throw new ServiceException(ErrorCodeConstants.NOTICE_BUILDIN_MODIFY_PERMISSION_ERROR); } } @@ -131,7 +130,7 @@ public class NoticeServiceImpl implements NoticeService { wrapper.eq(NoticeDO::getOrganId, OrganContextHolder.getOrganId()); } if (noticeMapper.exists(wrapper)) { - throw exception(NOTICE_NAME_UNIQE_ERROR); + throw new ServiceException(NOTICE_NAME_UNIQE_ERROR); } } diff --git a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/notify/NotifySendServiceImpl.java b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/notify/NotifySendServiceImpl.java index 6f719313c..00cb082c7 100644 --- a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/notify/NotifySendServiceImpl.java +++ b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/notify/NotifySendServiceImpl.java @@ -2,8 +2,8 @@ package com.cf.imes.module.system.service.notify; import com.cf.imes.framework.common.enums.CommonStatusEnum; import com.cf.imes.framework.common.enums.UserTypeEnum; +import com.cf.imes.framework.common.exception.ServiceException; import com.cf.imes.module.system.dal.dataobject.notify.NotifyTemplateDO; -import com.cf.imes.framework.common.exception.util.ServiceExceptionUtil; import com.cf.imes.module.system.enums.ErrorCodeConstants; import com.google.common.annotations.VisibleForTesting; import lombok.extern.slf4j.Slf4j; @@ -77,7 +77,7 @@ public class NotifySendServiceImpl implements NotifySendService { NotifyTemplateDO template = notifyTemplateService.getNotifyTemplateByCodeFromCache(templateCode); // 站内信模板不存在 if (template == null) { - throw ServiceExceptionUtil.exception(ErrorCodeConstants.NOTICE_NOT_FOUND); + throw new ServiceException(ErrorCodeConstants.NOTICE_NOT_FOUND); } return template; } @@ -93,7 +93,7 @@ public class NotifySendServiceImpl implements NotifySendService { template.getParams().forEach(key -> { Object value = templateParams.get(key); if (value == null) { - throw ServiceExceptionUtil.exception(ErrorCodeConstants.NOTIFY_SEND_TEMPLATE_PARAM_MISS, key); + throw new ServiceException(ErrorCodeConstants.NOTIFY_SEND_TEMPLATE_PARAM_MISS, key); } }); } diff --git a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/notify/NotifyTemplateServiceImpl.java b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/notify/NotifyTemplateServiceImpl.java index 4106bbdd8..f427aac12 100644 --- a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/notify/NotifyTemplateServiceImpl.java +++ b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/notify/NotifyTemplateServiceImpl.java @@ -2,7 +2,7 @@ package com.cf.imes.module.system.service.notify; import cn.hutool.core.util.ReUtil; import cn.hutool.core.util.StrUtil; -import com.cf.imes.framework.common.exception.util.ServiceExceptionUtil; +import com.cf.imes.framework.common.exception.ServiceException; import com.cf.imes.framework.common.pojo.PageResult; import com.cf.imes.framework.common.util.object.BeanUtils; import com.cf.imes.module.system.controller.admin.notify.vo.template.NotifyTemplatePageReqVO; @@ -23,8 +23,6 @@ import java.util.List; import java.util.Map; import java.util.regex.Pattern; -import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception; - /** * 站内信模版 Service 实现类 * @@ -87,7 +85,7 @@ public class NotifyTemplateServiceImpl implements NotifyTemplateService { private void validateNotifyTemplateExists(Long id) { if (notifyTemplateMapper.selectById(id) == null) { - throw ServiceExceptionUtil.exception(ErrorCodeConstants.NOTIFY_TEMPLATE_NOT_EXISTS); + throw new ServiceException(ErrorCodeConstants.NOTIFY_TEMPLATE_NOT_EXISTS); } } @@ -116,10 +114,10 @@ public class NotifyTemplateServiceImpl implements NotifyTemplateService { } // 如果 id 为空,说明不用比较是否为相同 id 的字典类型 if (id == null) { - throw ServiceExceptionUtil.exception(ErrorCodeConstants.NOTIFY_TEMPLATE_CODE_DUPLICATE, code); + throw new ServiceException(ErrorCodeConstants.NOTIFY_TEMPLATE_CODE_DUPLICATE, code); } if (!template.getId().equals(id)) { - throw ServiceExceptionUtil.exception(ErrorCodeConstants.NOTIFY_TEMPLATE_CODE_DUPLICATE, code); + throw new ServiceException(ErrorCodeConstants.NOTIFY_TEMPLATE_CODE_DUPLICATE, code); } } diff --git a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/oauth2/OAuth2ClientServiceImpl.java b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/oauth2/OAuth2ClientServiceImpl.java index 03cde7826..263f283f1 100644 --- a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/oauth2/OAuth2ClientServiceImpl.java +++ b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/oauth2/OAuth2ClientServiceImpl.java @@ -5,6 +5,7 @@ import cn.hutool.core.text.CharSequenceUtil; import cn.hutool.core.util.ObjectUtil; import cn.hutool.extra.spring.SpringUtil; import com.cf.imes.framework.common.enums.CommonStatusEnum; +import com.cf.imes.framework.common.exception.ServiceException; import com.cf.imes.framework.common.pojo.PageResult; import com.cf.imes.framework.common.util.object.BeanUtils; import com.cf.imes.framework.common.util.string.StrUtils; @@ -23,7 +24,6 @@ import org.springframework.validation.annotation.Validated; import jakarta.annotation.Resource; import java.util.Collection; -import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception; import static com.cf.imes.module.system.enums.ErrorCodeConstants.*; /** @@ -74,7 +74,7 @@ public class OAuth2ClientServiceImpl implements OAuth2ClientService { private void validateOAuth2ClientExists(Long id) { if (oauth2ClientMapper.selectById(id) == null) { - throw exception(OAUTH2_CLIENT_NOT_EXISTS); + throw new ServiceException(OAUTH2_CLIENT_NOT_EXISTS); } } @@ -86,10 +86,10 @@ public class OAuth2ClientServiceImpl implements OAuth2ClientService { } // 如果 id 为空,说明不用比较是否为相同 id 的客户端 if (id == null) { - throw exception(OAUTH2_CLIENT_EXISTS); + throw new ServiceException(OAUTH2_CLIENT_EXISTS); } if (!client.getId().equals(id)) { - throw exception(OAUTH2_CLIENT_EXISTS); + throw new ServiceException(OAUTH2_CLIENT_EXISTS); } } @@ -116,27 +116,27 @@ public class OAuth2ClientServiceImpl implements OAuth2ClientService { // 校验客户端存在、且开启 OAuth2ClientDO client = getSelf().getOAuth2ClientFromCache(clientId); if (client == null) { - throw exception(OAUTH2_CLIENT_NOT_EXISTS); + throw new ServiceException(OAUTH2_CLIENT_NOT_EXISTS); } if (CommonStatusEnum.isDisable(client.getStatus())) { - throw exception(OAUTH2_CLIENT_DISABLE); + throw new ServiceException(OAUTH2_CLIENT_DISABLE); } // 校验客户端密钥 if (CharSequenceUtil.isNotEmpty(clientSecret) && ObjectUtil.notEqual(client.getSecret(), clientSecret)) { - throw exception(OAUTH2_CLIENT_CLIENT_SECRET_ERROR); + throw new ServiceException(OAUTH2_CLIENT_CLIENT_SECRET_ERROR); } // 校验授权方式 if (CharSequenceUtil.isNotEmpty(authorizedGrantType) && !CollUtil.contains(client.getAuthorizedGrantTypes(), authorizedGrantType)) { - throw exception(OAUTH2_CLIENT_AUTHORIZED_GRANT_TYPE_NOT_EXISTS); + throw new ServiceException(OAUTH2_CLIENT_AUTHORIZED_GRANT_TYPE_NOT_EXISTS); } // 校验授权范围 if (CollUtil.isNotEmpty(scopes) && !CollUtil.containsAll(client.getScopes(), scopes)) { - throw exception(OAUTH2_CLIENT_SCOPE_OVER); + throw new ServiceException(OAUTH2_CLIENT_SCOPE_OVER); } // 校验回调地址 if (CharSequenceUtil.isNotEmpty(redirectUri) && !StrUtils.startWithAny(redirectUri, client.getRedirectUris())) { - throw exception(OAUTH2_CLIENT_REDIRECT_URI_NOT_MATCH, redirectUri); + throw new ServiceException(OAUTH2_CLIENT_REDIRECT_URI_NOT_MATCH, redirectUri); } return client; } diff --git a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/oauth2/OAuth2CodeServiceImpl.java b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/oauth2/OAuth2CodeServiceImpl.java index 096d491f7..5892ca8f0 100644 --- a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/oauth2/OAuth2CodeServiceImpl.java +++ b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/oauth2/OAuth2CodeServiceImpl.java @@ -1,6 +1,7 @@ package com.cf.imes.module.system.service.oauth2; import cn.hutool.core.util.IdUtil; +import com.cf.imes.framework.common.exception.ServiceException; import com.cf.imes.framework.common.util.date.DateUtils; import com.cf.imes.module.system.dal.dataobject.oauth2.OAuth2CodeDO; import com.cf.imes.module.system.dal.mysql.oauth2.OAuth2CodeMapper; @@ -11,7 +12,6 @@ import jakarta.annotation.Resource; import java.time.LocalDateTime; import java.util.List; -import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception; import static com.cf.imes.module.system.enums.ErrorCodeConstants.OAUTH2_CODE_EXPIRE; import static com.cf.imes.module.system.enums.ErrorCodeConstants.OAUTH2_CODE_NOT_EXISTS; @@ -48,10 +48,10 @@ public class OAuth2CodeServiceImpl implements OAuth2CodeService { public OAuth2CodeDO consumeAuthorizationCode(String code) { OAuth2CodeDO codeDO = oauth2CodeMapper.selectByCode(code); if (codeDO == null) { - throw exception(OAUTH2_CODE_NOT_EXISTS); + throw new ServiceException(OAUTH2_CODE_NOT_EXISTS); } if (DateUtils.isExpired(codeDO.getExpiresTime())) { - throw exception(OAUTH2_CODE_EXPIRE); + throw new ServiceException(OAUTH2_CODE_EXPIRE); } oauth2CodeMapper.deleteById(codeDO.getId()); return codeDO; diff --git a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/oauth2/OAuth2GrantServiceImpl.java b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/oauth2/OAuth2GrantServiceImpl.java index 8ae72e677..b394c4bc4 100644 --- a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/oauth2/OAuth2GrantServiceImpl.java +++ b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/oauth2/OAuth2GrantServiceImpl.java @@ -4,6 +4,7 @@ import cn.hutool.core.lang.Assert; import cn.hutool.core.text.CharSequenceUtil; import cn.hutool.core.util.ObjectUtil; import com.cf.imes.framework.common.enums.UserTypeEnum; +import com.cf.imes.framework.common.exception.ServiceException; import com.cf.imes.module.system.controller.admin.auth.vo.AuthLoginReqVO; import com.cf.imes.module.system.dal.dataobject.oauth2.OAuth2AccessTokenDO; import com.cf.imes.module.system.dal.dataobject.oauth2.OAuth2CodeDO; @@ -16,8 +17,6 @@ import org.springframework.stereotype.Service; import jakarta.annotation.Resource; import java.util.List; -import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception; - /** * OAuth2 授予 Service 实现类 * @@ -62,16 +61,16 @@ public class OAuth2GrantServiceImpl implements OAuth2GrantService { Assert.notNull(codeDO, "授权码不能为空"); // 防御性编程 // 校验 clientId 是否匹配 if (!CharSequenceUtil.equals(clientId, codeDO.getClientId())) { - throw exception(ErrorCodeConstants.OAUTH2_GRANT_CLIENT_ID_MISMATCH); + throw new ServiceException(ErrorCodeConstants.OAUTH2_GRANT_CLIENT_ID_MISMATCH); } // 校验 redirectUri 是否匹配 if (!CharSequenceUtil.equals(redirectUri, codeDO.getRedirectUri())) { - throw exception(ErrorCodeConstants.OAUTH2_GRANT_REDIRECT_URI_MISMATCH); + throw new ServiceException(ErrorCodeConstants.OAUTH2_GRANT_REDIRECT_URI_MISMATCH); } // 校验 state 是否匹配 state = CharSequenceUtil.nullToDefault(state, ""); // 数据库 state 为 null 时,会设置为 "" 空串 if (!CharSequenceUtil.equals(state, codeDO.getState())) { - throw exception(ErrorCodeConstants.OAUTH2_GRANT_STATE_MISMATCH); + throw new ServiceException(ErrorCodeConstants.OAUTH2_GRANT_STATE_MISMATCH); } /* Long organId = OrganContextHolder.getOrganId(); diff --git a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/organ/OrganServiceImpl.java b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/organ/OrganServiceImpl.java index baa40a5d9..4d56825f1 100644 --- a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/organ/OrganServiceImpl.java +++ b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/organ/OrganServiceImpl.java @@ -8,6 +8,7 @@ import cn.hutool.core.util.ObjectUtil; import com.baomidou.dynamic.datasource.annotation.DSTransactional; import com.baomidou.mybatisplus.core.metadata.IPage; import com.cf.imes.framework.common.enums.CommonStatusEnum; +import com.cf.imes.framework.common.exception.ServiceException; import com.cf.imes.framework.common.pojo.PageParam; import com.cf.imes.framework.common.pojo.PageResult; import com.cf.imes.framework.common.util.collection.CollectionUtils; @@ -78,7 +79,6 @@ import java.util.stream.Collectors; import static com.cf.imes.framework.common.constants.StatisticsConstants.DATELIST_FIELD_NAME; import static com.cf.imes.framework.common.constants.StatisticsConstants.SERIES_FIELD_NAME; -import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception; import static com.cf.imes.framework.common.util.json.JsonUtils.parseArray; import static com.cf.imes.framework.common.util.time.StatisticsChangeUtils.generateDateRangeAxis; import static com.cf.imes.framework.common.util.time.StatisticsChangeUtils.getDateList; @@ -171,13 +171,13 @@ public class OrganServiceImpl implements OrganService { public OrganizationDO validOrgan(Long id) { OrganizationDO organizationDO = getOrgan(id); if (organizationDO == null) { - throw exception(ORGAN_NOT_EXISTS); + throw new ServiceException(ORGAN_NOT_EXISTS); } if (organizationDO.getStatus().equals(CommonStatusEnum.DISABLE.getStatus())) { - throw exception(ORGAN_DISABLE, organizationDO.getName()); + throw new ServiceException(ORGAN_DISABLE, organizationDO.getName()); } if (DateUtils.isExpired(organizationDO.getExpireTime())) { - throw exception(ORGAN_EXPIRE, organizationDO.getName()); + throw new ServiceException(ORGAN_EXPIRE, organizationDO.getName()); } return organizationDO; } @@ -312,10 +312,10 @@ public class OrganServiceImpl implements OrganService { } // 如果 id 为空,说明不用比较是否为相同名字的组织 if (id == null) { - throw exception(ORGAN_NAME_DUPLICATE, name); + throw new ServiceException(ORGAN_NAME_DUPLICATE, name); } if (!tenant.getId().equals(id)) { - throw exception(ORGAN_NAME_DUPLICATE, name); + throw new ServiceException(ORGAN_NAME_DUPLICATE, name); } } @@ -329,10 +329,10 @@ public class OrganServiceImpl implements OrganService { } // 如果 id 为空,说明不用比较是否为相同名字的组织 if (id == null) { - throw exception(ORGAN_WEBSITE_DUPLICATE, website); + throw new ServiceException(ORGAN_WEBSITE_DUPLICATE, website); } if (!tenant.getId().equals(id)) { - throw exception(ORGAN_WEBSITE_DUPLICATE, website); + throw new ServiceException(ORGAN_WEBSITE_DUPLICATE, website); } } @@ -343,7 +343,7 @@ public class OrganServiceImpl implements OrganService { if(CollUtil.isNotEmpty(organizationDOS)){ - throw exception(ORGAN_CONTACTMOBILE_DUPLICATE,contactMobile); + throw new ServiceException(ORGAN_CONTACTMOBILE_DUPLICATE,contactMobile); } } @@ -422,18 +422,18 @@ public class OrganServiceImpl implements OrganService { */ private void checkCurrentWhenOperate(Long organId) { if (ObjectUtil.equal(organId, SecurityFrameworkUtils.getUserOrganId())) { - throw exception(ORGAN_USER_OPER_NOT_ALLOW); + throw new ServiceException(ORGAN_USER_OPER_NOT_ALLOW); } } private OrganizationDO validateUpdateTenant(Long id) { OrganizationDO tenant = organMapper.selectById(id); if (tenant == null) { - throw exception(ORGAN_NOT_EXISTS); + throw new ServiceException(ORGAN_NOT_EXISTS); } // 内置组织,不允许删除 /*if (isSystemTenant(tenant)) { - throw exception(ORGAN_CAN_NOT_UPDATE_SYSTEM); + throw new ServiceException(ORGAN_CAN_NOT_UPDATE_SYSTEM); }*/ return tenant; } diff --git a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/organ/TenantPackageServiceImpl.java b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/organ/TenantPackageServiceImpl.java index c3a9fda8c..3ae3360e1 100644 --- a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/organ/TenantPackageServiceImpl.java +++ b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/organ/TenantPackageServiceImpl.java @@ -4,6 +4,7 @@ import cn.hutool.core.collection.CollUtil; import cn.hutool.core.util.ObjectUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.cf.imes.framework.common.enums.CommonStatusEnum; +import com.cf.imes.framework.common.exception.ServiceException; import com.cf.imes.framework.common.pojo.PageResult; import com.cf.imes.framework.common.util.collection.CollectionUtils; import com.cf.imes.framework.common.util.object.BeanUtils; @@ -28,7 +29,6 @@ import java.util.List; import java.util.Objects; import java.util.Set; -import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception; import static com.cf.imes.module.system.enums.ErrorCodeConstants.*; /** @@ -71,7 +71,7 @@ public class TenantPackageServiceImpl implements TenantPackageService { TenantPackageDO tenantPackage = validateTenantPackageExists(updateReqVO.getId()); if (Boolean.FALSE.equals(SecurityFrameworkUtils.isSuperAdmin()) && (Objects.equals(tenantPackage.getId(), SYSTEM_ORGAN_PACKAGE_ID) || Objects.equals(tenantPackage.getId(), SYSTEM_SUPER_PACKAGE_ID))) { - throw exception(TENANT_PACKAGE_DEPT_EXIT); + throw new ServiceException(TENANT_PACKAGE_DEPT_EXIT); } // 更新 @@ -90,7 +90,7 @@ public class TenantPackageServiceImpl implements TenantPackageService { // 校验存在 validateTenantPackageExists(id); if(Objects.equals(id, SYSTEM_ORGAN_PACKAGE_ID) || Objects.equals(id, SYSTEM_SUPER_PACKAGE_ID)) { - throw exception(TENANT_PACKAGE_DELETED_EXIT); + throw new ServiceException(TENANT_PACKAGE_DELETED_EXIT); } // 校验正在使用 @@ -102,7 +102,7 @@ public class TenantPackageServiceImpl implements TenantPackageService { private TenantPackageDO validateTenantPackageExists(Long id) { TenantPackageDO tenantPackage = tenantPackageMapper.selectById(id); if (tenantPackage == null) { - throw exception(TENANT_PACKAGE_NOT_EXISTS); + throw new ServiceException(TENANT_PACKAGE_NOT_EXISTS); } return tenantPackage; } @@ -118,13 +118,13 @@ public class TenantPackageServiceImpl implements TenantPackageService { wrapper.ne(TenantPackageDO::getId, packageId); } if (tenantPackageMapper.exists(wrapper)) { - throw exception(TENANT_PACKAGE_NAME_UNIQE_ERROR); + throw new ServiceException(TENANT_PACKAGE_NAME_UNIQE_ERROR); } } private void validateOrganUsed(Long id) { if (organService.getOrganCountByPackageId(id) > 0) { - throw exception(TENANT_PACKAGE_USED); + throw new ServiceException(TENANT_PACKAGE_USED); } } @@ -142,10 +142,10 @@ public class TenantPackageServiceImpl implements TenantPackageService { public TenantPackageDO validTenantPackage(Long id) { TenantPackageDO tenantPackage = tenantPackageMapper.selectById(id); if (tenantPackage == null) { - throw exception(TENANT_PACKAGE_NOT_EXISTS); + throw new ServiceException(TENANT_PACKAGE_NOT_EXISTS); } if (tenantPackage.getStatus().equals(CommonStatusEnum.DISABLE.getStatus())) { - throw exception(TENANT_PACKAGE_DISABLE, tenantPackage.getName()); + throw new ServiceException(TENANT_PACKAGE_DISABLE, tenantPackage.getName()); } return tenantPackage; } diff --git a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/parser/ParserServiceImpl.java b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/parser/ParserServiceImpl.java index 78c9256b4..62666487d 100644 --- a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/parser/ParserServiceImpl.java +++ b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/parser/ParserServiceImpl.java @@ -2,6 +2,7 @@ package com.cf.imes.module.system.service.parser; import cn.hutool.core.collection.CollUtil; +import com.cf.imes.framework.common.exception.ServiceException; import com.cf.imes.framework.common.util.object.BeanUtils; import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX; import com.cf.imes.module.system.controller.admin.parser.vo.ParserReqVO; @@ -19,7 +20,6 @@ import java.util.List; import java.util.Map; import java.util.stream.Collectors; -import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception; import static com.cf.imes.framework.security.core.util.SecurityFrameworkUtils.getUserOrganId; import static com.cf.imes.module.system.enums.ErrorCodeConstants.PARSER_NO_EXIST; @@ -124,7 +124,7 @@ public class ParserServiceImpl implements ParserService{ ParserDO parserDO = parserMapper.selectById(id); if (parserDO == null) { - throw exception(PARSER_NO_EXIST); + throw new ServiceException(PARSER_NO_EXIST); } return parserDO; diff --git a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/parser/ParserTemplateServiceImpl.java b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/parser/ParserTemplateServiceImpl.java index 343a56c40..1cfb193c2 100644 --- a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/parser/ParserTemplateServiceImpl.java +++ b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/parser/ParserTemplateServiceImpl.java @@ -3,6 +3,7 @@ package com.cf.imes.module.system.service.parser; import cn.hutool.core.collection.CollUtil; import com.alibaba.fastjson.JSON; +import com.cf.imes.framework.common.exception.ServiceException; import com.cf.imes.framework.common.util.object.BeanUtils; import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX; import com.cf.imes.module.system.controller.admin.parser.vo.ParserTemplateReqVO; @@ -22,7 +23,6 @@ import jakarta.annotation.Resource; import java.util.*; import java.util.stream.Collectors; -import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception; import static com.cf.imes.module.system.enums.ErrorCodeConstants.PARSER_TEMPLATE_NO_EXIST; @@ -201,7 +201,7 @@ public class ParserTemplateServiceImpl implements ParserTemplateService{ ParserTemplateDO parserTemplateDO = parserTemplateMapper.selectById(id); if (parserTemplateDO == null) { - throw exception(PARSER_TEMPLATE_NO_EXIST); + throw new ServiceException(PARSER_TEMPLATE_NO_EXIST); } return parserTemplateDO; diff --git a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/pay/PayOrderServiceImpl.java b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/pay/PayOrderServiceImpl.java index c29c986fb..41155b0ba 100644 --- a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/pay/PayOrderServiceImpl.java +++ b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/pay/PayOrderServiceImpl.java @@ -9,7 +9,6 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; import com.cf.imes.framework.common.exception.ServiceException; -import com.cf.imes.framework.common.exception.util.ServiceExceptionUtil; import com.cf.imes.framework.common.util.json.JsonUtils; import com.cf.imes.framework.common.util.validation.ValidationUtils; import com.cf.imes.framework.id.core.util.SnowflakeSerialNoWorker3rd; @@ -62,7 +61,6 @@ import java.util.Map; import java.util.regex.Matcher; import java.util.regex.Pattern; -import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception; import static com.cf.imes.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY; import static com.cf.imes.module.system.enums.ErrorCodeConstants.ORG_PRODUCT_PURCHASE_LOCK_ERROR; import static com.cf.imes.module.system.enums.ErrorCodeConstants.ORG_PRODUCT_PURCHASE_WAIT_PAY_ERROR; @@ -343,7 +341,7 @@ public class PayOrderServiceImpl implements PayOrderService { .eq(PayOrderDO::getDeleted, false) ); if (ObjectUtils.isNull(payOrderDO)) { - throw exception(PAY_ORDER_NOT_EXIST, outTradeNo); + throw new ServiceException(PAY_ORDER_NOT_EXIST, outTradeNo); } // 订单已被更新成功,直接支付成功了 if (PayOrderStatusEnum.SUCCESS.equals(payOrderDO.getStatus())) { @@ -414,7 +412,7 @@ public class PayOrderServiceImpl implements PayOrderService { .eq(PayOrderDO::getId, outTradeNo)); Long organId = order.getOrganId(); if (ObjectUtil.isNull(order)) { - throw exception(PAY_ORDER_NOT_EXIST, outTradeNo); + throw new ServiceException(PAY_ORDER_NOT_EXIST, outTradeNo); } // 如果已经是成功,直接返回,不用重复更新 if (PayOrderStatusEnum.isSuccess(order.getStatus().getStatus())) { @@ -422,7 +420,7 @@ public class PayOrderServiceImpl implements PayOrderService { return; } if (!PayOrderStatusEnum.WAITING.equals(order.getStatus())) { // 校验状态,必须是待支付 - throw exception(PAY_ORDER_STATUS_IS_NOT_WAITING); + throw new ServiceException(PAY_ORDER_STATUS_IS_NOT_WAITING); } // 2. 更新 PayOrderDO @@ -436,7 +434,7 @@ public class PayOrderServiceImpl implements PayOrderService { .set(PayOrderDO::getChannelNotifyData, JsonUtils.zipString(JSON.toJSONString(notify)))); if (updateCounts == 0) { // 校验状态,必须是待支付 - throw exception(PAY_ORDER_STATUS_IS_NOT_WAITING); + throw new ServiceException(PAY_ORDER_STATUS_IS_NOT_WAITING); } log.debug("[notifyOrderSuccess][order({}) 更新为已支付]", order.getId()); @@ -446,7 +444,7 @@ public class PayOrderServiceImpl implements PayOrderService { notifyProductPayOrderSuccess(order); break; default: - throw ServiceExceptionUtil.exception(PAY_NOTIFY_PASSBACK_TRADETYPE_NOT_SUPPORT_ERROR, order.getTradeType()); + throw new ServiceException(PAY_NOTIFY_PASSBACK_TRADETYPE_NOT_SUPPORT_ERROR, order.getTradeType()); } } @@ -506,7 +504,7 @@ public class PayOrderServiceImpl implements PayOrderService { .eq(PayOrderDO::getId, outTradeNo)); Long organId = order.getOrganId(); if (ObjectUtil.isNull(order)) { - throw exception(PAY_ORDER_NOT_EXIST, outTradeNo); + throw new ServiceException(PAY_ORDER_NOT_EXIST, outTradeNo); } Integer orderStatus = order.getStatus().getStatus(); @@ -520,7 +518,7 @@ public class PayOrderServiceImpl implements PayOrderService { return; } if (ObjectUtil.notEqual(orderStatus, PayOrderStatusEnum.WAITING.getStatus())) { // 校验状态,必须是待支付 - throw exception(PAY_ORDER_STATUS_IS_NOT_WAITING); + throw new ServiceException(PAY_ORDER_STATUS_IS_NOT_WAITING); } // 2. 更新 PayOrderDO @@ -535,7 +533,7 @@ public class PayOrderServiceImpl implements PayOrderService { .set(PayOrderDO::getChannelNotifyData, JsonUtils.zipString(JSON.toJSONString(notify)))); if (updateCounts == 0) { // 校验状态,必须是待支付 - throw exception(PAY_ORDER_STATUS_IS_NOT_WAITING); + throw new ServiceException(PAY_ORDER_STATUS_IS_NOT_WAITING); } log.debug("[notifyOrderClosed][order({}) 更新为支付关闭]", order.getId()); @@ -545,7 +543,7 @@ public class PayOrderServiceImpl implements PayOrderService { notifyProductPayOrderFail(order); break; default: - throw ServiceExceptionUtil.exception(PAY_NOTIFY_PASSBACK_TRADETYPE_NOT_SUPPORT_ERROR, order.getTradeType()); + throw new ServiceException(PAY_NOTIFY_PASSBACK_TRADETYPE_NOT_SUPPORT_ERROR, order.getTradeType()); } } diff --git a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/pay/PayProductProcessorNew.java b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/pay/PayProductProcessorNew.java index 6eef14d10..4d232d5f7 100644 --- a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/pay/PayProductProcessorNew.java +++ b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/pay/PayProductProcessorNew.java @@ -6,7 +6,6 @@ import cn.hutool.core.date.LocalDateTimeUtil; import cn.hutool.core.util.IdUtil; import cn.hutool.core.util.ObjectUtil; import com.cf.imes.framework.common.exception.ServiceException; -import com.cf.imes.framework.common.exception.util.ServiceExceptionUtil; import com.cf.imes.framework.pay.config.ChenfengPayConfig; import com.cf.imes.module.system.controller.admin.funds.delay.vo.PreviouProductDelayRespVO; import com.cf.imes.module.system.controller.admin.funds.delay.vo.ProductDelayRespVO; @@ -288,7 +287,7 @@ public class PayProductProcessorNew { } if (endTime.isBefore(today)) { - throw ServiceExceptionUtil.exception(PRODUCT_PURCHASE_ENDTIME_BEFORE_DELAYTIME_ERROR, LocalDateTimeUtil.format(endTime, DatePattern.NORM_DATE_PATTERN)); + throw new ServiceException(PRODUCT_PURCHASE_ENDTIME_BEFORE_DELAYTIME_ERROR, LocalDateTimeUtil.format(endTime, DatePattern.NORM_DATE_PATTERN)); } return endTime; diff --git a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/permission/MenuServiceImpl.java b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/permission/MenuServiceImpl.java index b243df12c..e368ec0e3 100644 --- a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/permission/MenuServiceImpl.java +++ b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/permission/MenuServiceImpl.java @@ -8,7 +8,6 @@ import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.cf.imes.framework.common.exception.ServiceException; -import com.cf.imes.framework.common.exception.util.ServiceExceptionUtil; import com.cf.imes.framework.common.util.object.BeanUtils; import com.cf.imes.framework.organ.core.aop.OrganIgnore; import com.cf.imes.framework.security.core.util.SecurityFrameworkUtils; @@ -52,7 +51,6 @@ import java.util.concurrent.CompletableFuture; import java.util.stream.Collectors; import java.util.stream.IntStream; -import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception; import static com.cf.imes.framework.common.util.collection.CollectionUtils.convertList; import static com.cf.imes.module.system.enums.ErrorCodeConstants.*; @@ -116,7 +114,7 @@ public class MenuServiceImpl implements MenuService { // 校验更新的菜单是否存在 MenuDO menuDO = menuMapper.selectById(updateReqVO.getId()); if (menuDO == null) { - throw exception(MENU_NOT_EXISTS); + throw new ServiceException(MENU_NOT_EXISTS); } // 校验父菜单存在 validateParentMenu(updateReqVO.getParentId(), updateReqVO.getId()); @@ -145,12 +143,12 @@ public class MenuServiceImpl implements MenuService { public void deleteMenu(Long id) { // 校验是否还有子菜单 if (menuMapper.selectCountByParentId(id) > 0) { - throw exception(MENU_EXISTS_CHILDREN); + throw new ServiceException(MENU_EXISTS_CHILDREN); } // 校验删除的菜单是否存在 MenuDO menuDO = menuMapper.selectById(id); if (menuDO == null) { - throw exception(MENU_NOT_EXISTS); + throw new ServiceException(MENU_NOT_EXISTS); } // 校验管理端菜单增删改必须是晨丰组织下用户 validateManageSourceTypeOperatePermission(menuDO.getSourceType()); @@ -294,17 +292,17 @@ public class MenuServiceImpl implements MenuService { } // 不能设置自己为父菜单 if (parentId.equals(childId)) { - throw exception(MENU_PARENT_ERROR); + throw new ServiceException(MENU_PARENT_ERROR); } MenuDO menu = menuMapper.selectById(parentId); // 父菜单不存在 if (menu == null) { - throw exception(MENU_PARENT_NOT_EXISTS); + throw new ServiceException(MENU_PARENT_NOT_EXISTS); } // 父菜单必须是目录或者菜单类型 if (!MenuTypeEnum.DIR.getType().equals(menu.getType()) && !MenuTypeEnum.MENU.getType().equals(menu.getType())) { - throw exception(MENU_PARENT_NOT_DIR_OR_MENU); + throw new ServiceException(MENU_PARENT_NOT_DIR_OR_MENU); } } @@ -325,10 +323,10 @@ public class MenuServiceImpl implements MenuService { } // 如果 id 为空,说明不用比较是否为相同 id 的菜单 if (id == null) { - throw exception(MENU_NAME_DUPLICATE); + throw new ServiceException(MENU_NAME_DUPLICATE); } if (!menu.getId().equals(id)) { - throw exception(MENU_NAME_DUPLICATE); + throw new ServiceException(MENU_NAME_DUPLICATE); } } @@ -398,7 +396,7 @@ public class MenuServiceImpl implements MenuService { JSONObject obj = JSON.parseObject(transResult); String errorCode = obj.getString("error_code"); if (StringUtils.isNotEmpty(errorCode)) { - throw ServiceExceptionUtil.exception(MENU_TRANS_ERROR, errorCode); + throw new ServiceException(MENU_TRANS_ERROR, errorCode); } JSONArray arr = obj.getJSONArray("trans_result"); diff --git a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/permission/PermissionServiceImpl.java b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/permission/PermissionServiceImpl.java index c8de591ae..05e588fe9 100644 --- a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/permission/PermissionServiceImpl.java +++ b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/permission/PermissionServiceImpl.java @@ -56,7 +56,6 @@ import java.util.function.Function; import java.util.function.Supplier; import java.util.stream.Collectors; -import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception; import static com.cf.imes.framework.common.util.collection.CollectionUtils.convertSet; import static com.cf.imes.framework.common.util.json.JsonUtils.toJsonString; import static com.cf.imes.framework.security.core.util.SecurityFrameworkUtils.getLoginUser; @@ -552,7 +551,7 @@ public class PermissionServiceImpl implements PermissionService { @CacheEvict(value = RedisKeyConstants.USER_ROLE_ID_LIST, allEntries = true) public void assignUserRole(Long userId, Set roleIds, Long organId) { if(Objects.equals(userId, SecurityFrameworkUtils.getLoginUserId())) { - throw exception(ROLE_ME_ERROR); + throw new ServiceException(ROLE_ME_ERROR); } // 获得用户拥有角色编号 Set dbRoleIds = convertSet(userRoleMapper.selectListByUserId(userId), diff --git a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/permission/RoleServiceImpl.java b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/permission/RoleServiceImpl.java index 48ed76287..a5255c249 100644 --- a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/permission/RoleServiceImpl.java +++ b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/permission/RoleServiceImpl.java @@ -37,7 +37,6 @@ import org.springframework.util.StringUtils; import jakarta.annotation.Resource; import java.util.*; -import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception; import static com.cf.imes.framework.common.util.collection.CollectionUtils.convertMap; import static com.cf.imes.module.system.enums.ErrorCodeConstants.*; @@ -194,12 +193,12 @@ public class RoleServiceImpl implements RoleService { void validateRoleDuplicate(String name, String code, Long id, Long organId) { // 0. 超级管理员,不允许创建 if (RoleCodeEnum.isSuperAdmin(code)) { - throw exception(ROLE_ADMIN_CODE_ERROR, code); + throw new ServiceException(ROLE_ADMIN_CODE_ERROR, code); } // 1. 该 name 名字被其它角色所使用 RoleDO role = roleMapper.selectByName(name, organId); if (role != null && !role.getId().equals(id)) { - throw exception(ROLE_NAME_DUPLICATE, name); + throw new ServiceException(ROLE_NAME_DUPLICATE, name); } // 2. 是否存在相同编码的角色 if (!StringUtils.hasText(code)) { @@ -208,7 +207,7 @@ public class RoleServiceImpl implements RoleService { // 该 code 编码被其它角色所使用 role = roleMapper.selectByCode(code, organId); if (role != null && !role.getId().equals(id)) { - throw exception(ROLE_CODE_DUPLICATE, code); + throw new ServiceException(ROLE_CODE_DUPLICATE, code); } } @@ -224,11 +223,11 @@ public class RoleServiceImpl implements RoleService { RoleDO roleDO = roleService.getRole(id); //RoleDO roleDO = roleMapper.selectOne(RoleDO::getId, id); if (roleDO == null) { - throw exception(ROLE_NOT_EXISTS); + throw new ServiceException(ROLE_NOT_EXISTS); } // 内置角色,不允许删除 if (RoleTypeEnum.SYSTEM.getType().equals(roleDO.getType())) { - throw exception(ROLE_CAN_NOT_UPDATE_SYSTEM_TYPE_ROLE); + throw new ServiceException(ROLE_CAN_NOT_UPDATE_SYSTEM_TYPE_ROLE); } } @@ -336,10 +335,10 @@ public class RoleServiceImpl implements RoleService { ids.forEach(id -> { RoleDO role = roleMap.get(id); if (role == null) { - throw exception(ROLE_NOT_EXISTS); + throw new ServiceException(ROLE_NOT_EXISTS); } if (!CommonStatusEnum.ENABLE.getStatus().equals(role.getStatus())) { - throw exception(ROLE_IS_DISABLE, role.getName()); + throw new ServiceException(ROLE_IS_DISABLE, role.getName()); } }); } diff --git a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/process/ProcessGroupServiceImpl.java b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/process/ProcessGroupServiceImpl.java index 9d2c2bf42..010e757e3 100644 --- a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/process/ProcessGroupServiceImpl.java +++ b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/process/ProcessGroupServiceImpl.java @@ -1,20 +1,18 @@ package com.cf.imes.module.system.service.process; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.cf.imes.framework.common.exception.ServiceException; import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX; import com.cf.imes.framework.organ.core.context.OrganContextHolder; import com.cf.imes.module.executor.api.orderProcess.OrderProcessApi; -import com.cf.imes.module.system.controller.admin.organ.vo.organ.OrganSimpleRespVO; import com.cf.imes.module.system.controller.admin.process.vo.group.ProcessGroupPageReqVO; import com.cf.imes.module.system.controller.admin.process.vo.group.ProcessGroupRespVO; import com.cf.imes.module.system.controller.admin.process.vo.group.ProcessGroupSaveReqVO; import com.cf.imes.module.system.controller.admin.process.vo.group.ProcessListSaveReqVO; import com.cf.imes.module.system.controller.admin.process.vo.process.ProcessRespVO; -import com.cf.imes.module.system.dal.dataobject.organ.OrganizationDO; import com.cf.imes.module.system.dal.dataobject.process.ProcessDO; import com.cf.imes.module.system.dal.mysql.process.ProcessMapper; import com.cf.imes.module.system.enums.process.ProcessTypeEnum; -import org.jetbrains.annotations.NotNull; import org.springframework.stereotype.Service; import jakarta.annotation.Resource; @@ -30,11 +28,8 @@ import com.cf.imes.module.system.dal.mysql.process.ProcessGroupMapper; import java.util.ArrayList; import java.util.Arrays; import java.util.List; -import java.util.Optional; import java.util.stream.Collectors; -import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception; - import static com.cf.imes.module.system.enums.ErrorCodeConstants.*; /** @@ -66,7 +61,7 @@ public class ProcessGroupServiceImpl implements ProcessGroupService { int isCutting = 0; int isPacking = 0; if (createReqVO.getItems() == null) { - throw exception(PROCESS_ITEM_NOT_EXISTS); + throw new ServiceException(PROCESS_ITEM_NOT_EXISTS); } List list = cuttingItems(createReqVO.getItems()); if (!list.isEmpty()) { @@ -82,10 +77,10 @@ public class ProcessGroupServiceImpl implements ProcessGroupService { } if (isCutting > 1){ - throw exception(PROCESS_GROUP_CUTTING_ERROR); + throw new ServiceException(PROCESS_GROUP_CUTTING_ERROR); } if (isPacking > 1){ - throw exception(PROCESS_GROUP_PACKING_ERROR); + throw new ServiceException(PROCESS_GROUP_PACKING_ERROR); } processGroupMapper.insert(processGroup); if (createReqVO.getIsDefault()) { @@ -102,7 +97,7 @@ public class ProcessGroupServiceImpl implements ProcessGroupService { .eq(ProcessGroupDO::getName, name) .eq(ProcessGroupDO::getDeleted, false) .eq(ProcessGroupDO::getOrganId, OrganContextHolder.getOrganId())) > 0) { - throw exception(PROCESS_GROUP_NAME_EXISTS); + throw new ServiceException(PROCESS_GROUP_NAME_EXISTS); } } } @@ -116,7 +111,7 @@ public class ProcessGroupServiceImpl implements ProcessGroupService { .eq(ProcessGroupDO::getName, name) .eq(ProcessGroupDO::getDeleted, false) .eq(ProcessGroupDO::getOrganId, OrganContextHolder.getOrganId())) > 0) { - throw exception(PROCESS_GROUP_NAME_EXISTS); + throw new ServiceException(PROCESS_GROUP_NAME_EXISTS); } } } @@ -150,12 +145,12 @@ public class ProcessGroupServiceImpl implements ProcessGroupService { // 判断是否在生产中使用这个加工组 private void checkProcessGroupUsed(Long id) { if (orderProcessApi.getOrderProcessByProcessGroupId(id).getData()){ - throw exception(PROCESS_GROUP_USED); + throw new ServiceException(PROCESS_GROUP_USED); } } private void validateProcessGroupExists(Long id) { if (processGroupMapper.selectById(id) == null) { - throw exception(PROCESS_GROUP_NOT_EXISTS); + throw new ServiceException(PROCESS_GROUP_NOT_EXISTS); } } @@ -240,13 +235,13 @@ public class ProcessGroupServiceImpl implements ProcessGroupService { missingItemsBuilder.append(itemId); } } catch (Exception e) { - throw exception(PROCESS_ID_IS_NULL); + throw new ServiceException(PROCESS_ID_IS_NULL); } }); // 判断是否存在不存在的项,并一次性抛出异常 if (missingItemsBuilder.length() > 0) { - throw exception(PROCESS_NOT_EXISTS, "Items with IDs " + missingItemsBuilder.toString() + " do not exist."); + throw new ServiceException(PROCESS_NOT_EXISTS, "Items with IDs " + missingItemsBuilder.toString() + " do not exist."); } // 移除itemsBuilder最后的逗号 diff --git a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/process/ProcessServiceImpl.java b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/process/ProcessServiceImpl.java index 9bbb093df..45b631e27 100644 --- a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/process/ProcessServiceImpl.java +++ b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/process/ProcessServiceImpl.java @@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.PageDTO; import com.cf.imes.framework.common.enums.ProcessProcessingTypeEnum; +import com.cf.imes.framework.common.exception.ServiceException; import com.cf.imes.framework.organ.core.context.OrganContextHolder; import com.cf.imes.module.system.controller.admin.process.vo.process.*; import com.cf.imes.module.system.controller.admin.process.vo.processUser.ProcessAndUserRespVO; @@ -30,10 +31,7 @@ import java.util.List; import java.util.Objects; import java.util.stream.Collectors; -import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception; - import static com.cf.imes.framework.security.core.util.SecurityFrameworkUtils.getUserOrganId; -import static com.cf.imes.module.executor.enums.ErrorCodeConstants.CUSTOM_ORDER_EXISTS; import static com.cf.imes.module.system.enums.ErrorCodeConstants.*; @@ -76,14 +74,14 @@ public class ProcessServiceImpl implements ProcessService { ProcessAndUserSaveReqVO processAndUserSaveReqVO = new ProcessAndUserSaveReqVO(); try{ if (adminUserService.getUser(Long.parseLong(user)) == null){ - throw exception(USER_NOT_EXISTS); + throw new ServiceException(USER_NOT_EXISTS); } processAndUserSaveReqVO.setProcessId(processID); processAndUserSaveReqVO.setUserId(Long.parseLong(user)); processUserService.createProcessUser(processAndUserSaveReqVO); }catch (Exception e){ - throw exception(ERR); + throw new ServiceException(ERR); } } @@ -99,7 +97,7 @@ public class ProcessServiceImpl implements ProcessService { .eq(ProcessDO::getName, name) .eq(ProcessDO::getDeleted, false) .eq(ProcessDO::getOrganId, OrganContextHolder.getOrganId())) > 0) { - throw exception(PROCESS_NAME_EXISTS); + throw new ServiceException(PROCESS_NAME_EXISTS); } } } @@ -113,7 +111,7 @@ public class ProcessServiceImpl implements ProcessService { .eq(ProcessDO::getName, name) .eq(ProcessDO::getDeleted, false) .eq(ProcessDO::getOrganId, OrganContextHolder.getOrganId())) > 0) { - throw exception(PROCESS_NAME_EXISTS); + throw new ServiceException(PROCESS_NAME_EXISTS); } } } @@ -125,7 +123,7 @@ public class ProcessServiceImpl implements ProcessService { validateProcessExists(updateReqVO.getId()); if (!updateReqVO.getIsEnabled()) {//调为禁用 if (isProcessUsed(String.valueOf(updateReqVO.getId()))){ - throw exception(PROCESS_IS_ENABLED); + throw new ServiceException(PROCESS_IS_ENABLED); } } @@ -150,7 +148,7 @@ public class ProcessServiceImpl implements ProcessService { } } catch (NumberFormatException e) { - throw exception(ERR); + throw new ServiceException(ERR); } } } @@ -171,7 +169,7 @@ public class ProcessServiceImpl implements ProcessService { // 校验存在 validateProcessExists(id); if (isProcessUsed(String.valueOf(id))){ - throw exception(PROCESS_IS_ENABLED); + throw new ServiceException(PROCESS_IS_ENABLED); } // 删除 processMapper.deleteById(id); @@ -180,7 +178,7 @@ public class ProcessServiceImpl implements ProcessService { private void validateProcessExists(Long id) { if (processMapper.selectById(id) == null) { - throw exception(PROCESS_NOT_EXISTS); + throw new ServiceException(PROCESS_NOT_EXISTS); } } diff --git a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/process/ProcessUserServiceImpl.java b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/process/ProcessUserServiceImpl.java index a07d74fa4..4141132a3 100644 --- a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/process/ProcessUserServiceImpl.java +++ b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/process/ProcessUserServiceImpl.java @@ -1,5 +1,6 @@ package com.cf.imes.module.system.service.process; +import com.cf.imes.framework.common.exception.ServiceException; import com.cf.imes.module.system.controller.admin.process.vo.processUser.ProcessAndUserSaveReqVO; import org.springframework.stereotype.Service; import jakarta.annotation.Resource; @@ -12,7 +13,6 @@ import com.cf.imes.module.system.dal.mysql.process.ProcessUserMapper; import java.util.List; -import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception; import static com.cf.imes.module.system.enums.ErrorCodeConstants.PROCESS_USER_EXISTS; import static com.cf.imes.module.system.enums.ErrorCodeConstants.PROCESS_USER_NOT_EXISTS; @@ -32,7 +32,7 @@ public class ProcessUserServiceImpl implements ProcessUserService { public Long createProcessUser(ProcessAndUserSaveReqVO createReqVO) { // 判断是否有 if (processUserMapper.selectById(createReqVO.getProcessId(), createReqVO.getUserId()).size() != 0) { - throw exception(PROCESS_USER_EXISTS); + throw new ServiceException(PROCESS_USER_EXISTS); } // 插入 ProcessUserDO processUser = BeanUtils.toBean(createReqVO, ProcessUserDO.class); @@ -45,7 +45,7 @@ public class ProcessUserServiceImpl implements ProcessUserService { public void updateProcessUser(ProcessAndUserSaveReqVO updateReqVO) { // 校验存在 if (processUserMapper.selectById(updateReqVO.getProcessId(), updateReqVO.getUserId()).size() != 0) { - throw exception(PROCESS_USER_EXISTS); + throw new ServiceException(PROCESS_USER_EXISTS); } // 更新 ProcessUserDO updateObj = BeanUtils.toBean(updateReqVO, ProcessUserDO.class); @@ -62,7 +62,7 @@ public class ProcessUserServiceImpl implements ProcessUserService { private void validateProcessUserExists(Long id) { if (processUserMapper.selectByProcessId(id).size() == 0) { - throw exception(PROCESS_USER_NOT_EXISTS); + throw new ServiceException(PROCESS_USER_NOT_EXISTS); } } diff --git a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/sensitiveword/SensitiveWordServiceImpl.java b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/sensitiveword/SensitiveWordServiceImpl.java index 821b2e0cd..75d00c387 100644 --- a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/sensitiveword/SensitiveWordServiceImpl.java +++ b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/sensitiveword/SensitiveWordServiceImpl.java @@ -2,6 +2,7 @@ package com.cf.imes.module.system.service.sensitiveword; import cn.hutool.core.collection.CollUtil; import com.cf.imes.framework.common.enums.CommonStatusEnum; +import com.cf.imes.framework.common.exception.ServiceException; import com.cf.imes.framework.common.pojo.PageResult; import com.cf.imes.framework.common.util.collection.CollectionUtils; import com.cf.imes.framework.common.util.object.BeanUtils; @@ -25,7 +26,6 @@ import java.time.LocalDateTime; import java.util.*; import java.util.concurrent.TimeUnit; -import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception; import static com.cf.imes.framework.common.util.collection.CollectionUtils.filterList; import static com.cf.imes.framework.common.util.collection.CollectionUtils.getMaxValue; import static com.cf.imes.module.system.enums.ErrorCodeConstants.SENSITIVE_WORD_EXISTS; @@ -184,16 +184,16 @@ public class SensitiveWordServiceImpl implements SensitiveWordService { } // 如果 id 为空,说明不用比较是否为相同 id 的敏感词 if (id == null) { - throw exception(SENSITIVE_WORD_EXISTS); + throw new ServiceException(SENSITIVE_WORD_EXISTS); } if (!word.getId().equals(id)) { - throw exception(SENSITIVE_WORD_EXISTS); + throw new ServiceException(SENSITIVE_WORD_EXISTS); } } private void validateSensitiveWordExists(Long id) { if (sensitiveWordMapper.selectById(id) == null) { - throw exception(SENSITIVE_WORD_NOT_EXISTS); + throw new ServiceException(SENSITIVE_WORD_NOT_EXISTS); } } diff --git a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/setting/SettingServiceImpl.java b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/setting/SettingServiceImpl.java index 15d99dd52..271e73e07 100644 --- a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/setting/SettingServiceImpl.java +++ b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/setting/SettingServiceImpl.java @@ -2,6 +2,7 @@ package com.cf.imes.module.system.service.setting; import com.cf.imes.framework.common.enums.UserSettingTypeEnum; +import com.cf.imes.framework.common.exception.ServiceException; import com.cf.imes.framework.common.util.json.JsonUtils; import com.cf.imes.framework.security.core.LoginUser; import com.cf.imes.module.system.controller.admin.setting.vo.PackageConfigReqVO; @@ -12,7 +13,6 @@ import org.springframework.validation.annotation.Validated; import jakarta.annotation.Resource; -import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception; import static com.cf.imes.framework.common.util.json.JsonUtils.unzipString; import static com.cf.imes.framework.security.core.util.SecurityFrameworkUtils.getLoginUser; import static com.cf.imes.module.system.enums.ErrorCodeConstants.CURRENTLY_NO_CONFIGURATION_AVAILABLE; @@ -56,7 +56,7 @@ public class SettingServiceImpl implements SettingService{ // 更新 PackageConfigDO packageConfigDO = packageConfigMapper.selectSetting(reqVO.getType(), loginUser.getId(), loginUser.getOrganId()); if (packageConfigDO == null) { - throw exception(CURRENTLY_NO_CONFIGURATION_AVAILABLE,reqVO.getType() == 1 ? UserSettingTypeEnum.PREPACKAGED.getName(): UserSettingTypeEnum.PACKAGED.getName()); + throw new ServiceException(CURRENTLY_NO_CONFIGURATION_AVAILABLE,reqVO.getType() == 1 ? UserSettingTypeEnum.PREPACKAGED.getName(): UserSettingTypeEnum.PACKAGED.getName()); } if(reqVO.getSetting() != null) { packageConfigDO.setSetting(JsonUtils.zipString(reqVO.getSetting().toJSONString())); @@ -77,7 +77,7 @@ public class SettingServiceImpl implements SettingService{ PackageConfigDO packageConfigDO = packageConfigMapper.selectSetting(type, loginUser.getId(), loginUser.getOrganId()); if (packageConfigDO == null) { -// throw exception(CURRENTLY_NO_CONFIGURATION_AVAILABLE,type == 1 ? UserSettingTypeEnum.PREPACKAGED.getName(): UserSettingTypeEnum.PACKAGED.getName()); +// throw new ServiceException(CURRENTLY_NO_CONFIGURATION_AVAILABLE,type == 1 ? UserSettingTypeEnum.PREPACKAGED.getName(): UserSettingTypeEnum.PACKAGED.getName()); return null; } diff --git a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/sms/SmsCodeServiceImpl.java b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/sms/SmsCodeServiceImpl.java index 3e33037c8..090b14c2f 100644 --- a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/sms/SmsCodeServiceImpl.java +++ b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/sms/SmsCodeServiceImpl.java @@ -14,7 +14,6 @@ import com.cf.imes.module.system.dal.dataobject.user.AdminUserDO; import com.cf.imes.module.system.dal.redis.RedisKeyConstants; import com.cf.imes.module.system.enums.sms.SmsSceneEnum; import com.cf.imes.module.system.framework.sms.config.SmsCodeProperties; -import com.cf.imes.framework.common.exception.util.ServiceExceptionUtil; import com.cf.imes.module.system.enums.ErrorCodeConstants; import com.cf.imes.module.system.service.user.AdminUserService; import org.springframework.data.redis.core.RedisTemplate; @@ -59,7 +58,7 @@ public class SmsCodeServiceImpl implements SmsCodeService { } // 非修改手机号的场景时校验手机号是否存在 if (ObjectUtil.isNull(user) && ObjectUtil.notEqual(SmsSceneEnum.USER_UPDATE_MOBILE.getScene(), reqDTO.getScene())) { - throw ServiceExceptionUtil.exception(ErrorCodeConstants.AUTH_MOBILE_NOT_EXISTS); + throw new ServiceException(ErrorCodeConstants.AUTH_MOBILE_NOT_EXISTS); } SmsSceneEnum sceneEnum = SmsSceneEnum.getCodeByScene(reqDTO.getScene()); Assert.notNull(sceneEnum, "验证码场景({}) 查找不到配置", reqDTO.getScene()); @@ -85,10 +84,10 @@ public class SmsCodeServiceImpl implements SmsCodeService { if (ObjectUtil.isNotNull(user)) { if (ObjectUtil.equal(user.getId(), loginUser.getId())) { // 手机号没有改变无需验证码 - throw ServiceExceptionUtil.exception(ErrorCodeConstants.AUTH_MOBILE_NO_CHANGE); + throw new ServiceException(ErrorCodeConstants.AUTH_MOBILE_NO_CHANGE); } else { // 修改手机号的场景校验手机是否已存在 - throw ServiceExceptionUtil.exception(ErrorCodeConstants.USER_MOBILE_EXISTS); + throw new ServiceException(ErrorCodeConstants.USER_MOBILE_EXISTS); } } } @@ -112,16 +111,16 @@ public class SmsCodeServiceImpl implements SmsCodeService { // 限制手机号请求次数:10分钟5次 boolean mobileCountRateLimit = slidingWindowRateLimit(redisMobileCountKey, sendWindowSizeMin.toMinutesPart(), sendMaxSendTimesPerWindow); if (!mobileCountRateLimit) { - throw ServiceExceptionUtil.exception(ErrorCodeConstants.SMS_CODE_SEND_TOO_FAST); + throw new ServiceException(ErrorCodeConstants.SMS_CODE_SEND_TOO_FAST); } // 限制ip请求次数 boolean ipCountRateLimit = slidingWindowRateLimit(redisIpCountKey, sendWindowSizeMin.toMinutesPart(), sendMaxSendTimesPerWindow); if (!ipCountRateLimit) { - throw ServiceExceptionUtil.exception(ErrorCodeConstants.SMS_CODE_SEND_TOO_FAST); + throw new ServiceException(ErrorCodeConstants.SMS_CODE_SEND_TOO_FAST); } } else { // 验证码存在提示请勿重复发送 - throw ServiceExceptionUtil.exception(ErrorCodeConstants.SMS_CODE_IS_VALID); + throw new ServiceException(ErrorCodeConstants.SMS_CODE_IS_VALID); } // 生成6位随机验证码 @@ -166,7 +165,7 @@ public class SmsCodeServiceImpl implements SmsCodeService { // 非修改手机号的场景时校验手机号是否存在 AdminUserDO user = userService.getUserUniqueByUserName(reqDTO.getMobile()); if (ObjectUtil.isNull(user) && ObjectUtil.notEqual(SmsSceneEnum.USER_UPDATE_MOBILE.getScene(), reqDTO.getScene())) { - throw ServiceExceptionUtil.exception(ErrorCodeConstants.AUTH_MOBILE_NOT_EXISTS); + throw new ServiceException(ErrorCodeConstants.AUTH_MOBILE_NOT_EXISTS); } String smsCodeKey = String.format(RedisKeyConstants.SMS_CAPTCHA_VERIFICATION, reqDTO.getMobile()); Object keyObj = redisTemplate.opsForValue().get(smsCodeKey); @@ -174,14 +173,14 @@ public class SmsCodeServiceImpl implements SmsCodeService { // 校验码存在 if (ObjectUtil.notEqual(String.valueOf(keyObj), reqDTO.getCode())) { // 验证码不正确 - throw ServiceExceptionUtil.exception(ErrorCodeConstants.SMS_CODE_NOT_CORRECT); + throw new ServiceException(ErrorCodeConstants.SMS_CODE_NOT_CORRECT); } else { // 消耗验证码 redisTemplate.delete(smsCodeKey); } } else { // 提示验证码不存在 - throw ServiceExceptionUtil.exception(ErrorCodeConstants.SMS_CODE_NOT_FOUND); + throw new ServiceException(ErrorCodeConstants.SMS_CODE_NOT_FOUND); } } @@ -191,7 +190,7 @@ public class SmsCodeServiceImpl implements SmsCodeService { // 非修改手机号的场景时校验手机号是否存在 AdminUserDO user = userService.getUserUniqueByUserName(mobile); if (ObjectUtil.isNull(user)) { - throw ServiceExceptionUtil.exception(ErrorCodeConstants.AUTH_MOBILE_NOT_EXISTS); + throw new ServiceException(ErrorCodeConstants.AUTH_MOBILE_NOT_EXISTS); } String smsCodeKey = String.format(RedisKeyConstants.SMS_CAPTCHA_VERIFICATION, mobile); Object keyObj = redisTemplate.opsForValue().get(smsCodeKey); @@ -199,11 +198,11 @@ public class SmsCodeServiceImpl implements SmsCodeService { // 校验码存在 if (ObjectUtil.notEqual(String.valueOf(keyObj), reqVO.getSmsCaptchaVerification())) { // 验证码不正确 - throw ServiceExceptionUtil.exception(ErrorCodeConstants.SMS_CODE_NOT_CORRECT); + throw new ServiceException(ErrorCodeConstants.SMS_CODE_NOT_CORRECT); } } else { // 提示验证码不存在 - throw ServiceExceptionUtil.exception(ErrorCodeConstants.SMS_CODE_NOT_FOUND); + throw new ServiceException(ErrorCodeConstants.SMS_CODE_NOT_FOUND); } } diff --git a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/sms/SmsSendServiceImpl.java b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/sms/SmsSendServiceImpl.java index 4d390d46a..1f940d47c 100644 --- a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/sms/SmsSendServiceImpl.java +++ b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/sms/SmsSendServiceImpl.java @@ -5,7 +5,7 @@ import cn.hutool.core.exceptions.ExceptionUtil; import cn.hutool.core.lang.Assert; import cn.hutool.core.lang.Pair; import com.cf.imes.framework.common.enums.CommonStatusEnum; -import com.cf.imes.framework.common.exception.util.ServiceExceptionUtil; +import com.cf.imes.framework.common.exception.ServiceException; import com.cf.imes.module.system.dal.redis.RedisKeyConstants; import com.cf.imes.module.system.framework.sms.config.SmsCodeProperties; import com.cf.imes.module.system.framework.sms.core.client.SmsClient; @@ -78,7 +78,7 @@ public class SmsSendServiceImpl implements SmsSendService { SmsTemplateDO template = smsTemplateService.getSmsTemplateByCodeFromCache(templateCode); // 短信模板不存在 if (template == null) { - throw ServiceExceptionUtil.exception(ErrorCodeConstants.SMS_SEND_TEMPLATE_NOT_EXISTS); + throw new ServiceException(ErrorCodeConstants.SMS_SEND_TEMPLATE_NOT_EXISTS); } return template; } @@ -97,7 +97,7 @@ public class SmsSendServiceImpl implements SmsSendService { return template.getParams().stream().map(key -> { Object value = templateParams.get(key); if (value == null) { - throw ServiceExceptionUtil.exception(ErrorCodeConstants.SMS_SEND_MOBILE_TEMPLATE_PARAM_MISS, key); + throw new ServiceException(ErrorCodeConstants.SMS_SEND_MOBILE_TEMPLATE_PARAM_MISS, key); } return new Pair<>(key, value); }).collect(Collectors.toList()); @@ -106,7 +106,7 @@ public class SmsSendServiceImpl implements SmsSendService { @VisibleForTesting public String validateMobile(String mobile) { if (StringUtils.isEmpty(mobile)) { - throw ServiceExceptionUtil.exception(ErrorCodeConstants.SMS_SEND_MOBILE_NOT_EXISTS); + throw new ServiceException(ErrorCodeConstants.SMS_SEND_MOBILE_NOT_EXISTS); } return mobile; } diff --git a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/sms/SmsTemplateServiceImpl.java b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/sms/SmsTemplateServiceImpl.java index 1f5610349..2e5bba7cb 100644 --- a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/sms/SmsTemplateServiceImpl.java +++ b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/sms/SmsTemplateServiceImpl.java @@ -5,7 +5,7 @@ import cn.hutool.core.lang.Assert; import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ReUtil; import cn.hutool.core.util.StrUtil; -import com.cf.imes.framework.common.exception.util.ServiceExceptionUtil; +import com.cf.imes.framework.common.exception.ServiceException; import com.cf.imes.framework.common.pojo.PageResult; import com.cf.imes.framework.common.util.object.BeanUtils; import com.cf.imes.module.system.framework.sms.core.client.SmsClient; @@ -94,7 +94,7 @@ public class SmsTemplateServiceImpl implements SmsTemplateService { private void validateSmsTemplateExists(Long id) { if (smsTemplateMapper.selectById(id) == null) { - throw ServiceExceptionUtil.exception(ErrorCodeConstants.SMS_TEMPLATE_NOT_EXISTS); + throw new ServiceException(ErrorCodeConstants.SMS_TEMPLATE_NOT_EXISTS); } } @@ -128,10 +128,10 @@ public class SmsTemplateServiceImpl implements SmsTemplateService { } // 如果 id 为空,说明不用比较是否为相同 id 的字典类型 if (id == null) { - throw ServiceExceptionUtil.exception(ErrorCodeConstants.SMS_TEMPLATE_CODE_DUPLICATE, code); + throw new ServiceException(ErrorCodeConstants.SMS_TEMPLATE_CODE_DUPLICATE, code); } if (!template.getId().equals(id)) { - throw ServiceExceptionUtil.exception(ErrorCodeConstants.SMS_TEMPLATE_CODE_DUPLICATE, code); + throw new ServiceException(ErrorCodeConstants.SMS_TEMPLATE_CODE_DUPLICATE, code); } } @@ -145,23 +145,23 @@ public class SmsTemplateServiceImpl implements SmsTemplateService { // 获得短信模板 SmsClient smsClient = smsChannelService.getSmsClient(); if (ObjectUtil.isNull(smsClient)) { - throw ServiceExceptionUtil.exception(ErrorCodeConstants.SMS_CHANNEL_NOT_EXISTS); + throw new ServiceException(ErrorCodeConstants.SMS_CHANNEL_NOT_EXISTS); } SmsTemplateRespDTO template; try { template = smsClient.getSmsTemplate(apiTemplateId); } catch (Throwable ex) { - throw ServiceExceptionUtil.exception(ErrorCodeConstants.SMS_TEMPLATE_API_ERROR, ExceptionUtil.getRootCauseMessage(ex)); + throw new ServiceException(ErrorCodeConstants.SMS_TEMPLATE_API_ERROR, ExceptionUtil.getRootCauseMessage(ex)); } // 校验短信模版 if (template == null) { - throw ServiceExceptionUtil.exception(ErrorCodeConstants.SMS_TEMPLATE_API_NOT_FOUND); + throw new ServiceException(ErrorCodeConstants.SMS_TEMPLATE_API_NOT_FOUND); } if (Objects.equals(template.getAuditStatus(), SmsTemplateAuditStatusEnum.CHECKING.getStatus())) { - throw ServiceExceptionUtil.exception(ErrorCodeConstants.SMS_TEMPLATE_API_AUDIT_CHECKING); + throw new ServiceException(ErrorCodeConstants.SMS_TEMPLATE_API_AUDIT_CHECKING); } if (Objects.equals(template.getAuditStatus(), SmsTemplateAuditStatusEnum.FAIL.getStatus())) { - throw ServiceExceptionUtil.exception(ErrorCodeConstants.SMS_TEMPLATE_API_AUDIT_FAIL, template.getAuditReason()); + throw new ServiceException(ErrorCodeConstants.SMS_TEMPLATE_API_AUDIT_FAIL, template.getAuditReason()); } Assert.equals(template.getAuditStatus(), SmsTemplateAuditStatusEnum.SUCCESS.getStatus(), String.format("短信模板(%s) 审核状态(%d) 不正确", apiTemplateId, template.getAuditStatus())); diff --git a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/social/SocialClientServiceImpl.java b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/social/SocialClientServiceImpl.java index c3cec05f1..5db1097d6 100644 --- a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/social/SocialClientServiceImpl.java +++ b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/social/SocialClientServiceImpl.java @@ -9,6 +9,7 @@ import cn.hutool.core.lang.Assert; import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ReflectUtil; import com.cf.imes.framework.common.enums.CommonStatusEnum; +import com.cf.imes.framework.common.exception.ServiceException; import com.cf.imes.framework.common.pojo.PageResult; import com.cf.imes.framework.common.util.cache.CacheUtils; import com.cf.imes.framework.common.util.http.HttpUtils; @@ -45,7 +46,6 @@ import jakarta.annotation.Resource; import java.time.Duration; import java.util.Objects; -import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception; import static com.cf.imes.framework.common.util.json.JsonUtils.toJsonString; import static com.cf.imes.module.system.enums.ErrorCodeConstants.*; @@ -130,7 +130,7 @@ public class SocialClientServiceImpl implements SocialClientService { log.info("[getAuthUser][请求社交平台 type({}) request({}) response({})]", socialType, toJsonString(authCallback), toJsonString(authResponse)); if (!authResponse.ok()) { - throw exception(SOCIAL_USER_AUTH_FAILURE, authResponse.getMsg()); + throw new ServiceException(SOCIAL_USER_AUTH_FAILURE, authResponse.getMsg()); } return (AuthUser) authResponse.getData(); } @@ -223,7 +223,7 @@ public class SocialClientServiceImpl implements SocialClientService { return service.getUserService().getPhoneNoInfo(phoneCode); } catch (WxErrorException e) { log.error("[getPhoneNoInfo][userType({}) phoneCode({}) 获得手机号失败]", userType, phoneCode, e); - throw exception(SOCIAL_CLIENT_WEIXIN_MINI_APP_PHONE_CODE_ERROR); + throw new ServiceException(SOCIAL_CLIENT_WEIXIN_MINI_APP_PHONE_CODE_ERROR); } } @@ -301,7 +301,7 @@ public class SocialClientServiceImpl implements SocialClientService { private void validateSocialClientExists(Long id) { if (socialClientMapper.selectById(id) == null) { - throw exception(SOCIAL_CLIENT_NOT_EXISTS); + throw new ServiceException(SOCIAL_CLIENT_NOT_EXISTS); } } @@ -322,7 +322,7 @@ public class SocialClientServiceImpl implements SocialClientService { } if (id == null // 新增时,说明重复 || ObjectUtil.notEqual(id, client.getId())) { // 更新时,如果 id 不一致,说明重复 - throw exception(SOCIAL_CLIENT_UNIQUE); + throw new ServiceException(SOCIAL_CLIENT_UNIQUE); } } diff --git a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/social/SocialUserServiceImpl.java b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/social/SocialUserServiceImpl.java index 24f1b26f0..5175bcfa7 100644 --- a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/social/SocialUserServiceImpl.java +++ b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/social/SocialUserServiceImpl.java @@ -23,7 +23,7 @@ import jakarta.validation.constraints.NotNull; import java.util.Collections; import java.util.List; -import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception; + import static com.cf.imes.framework.common.util.collection.CollectionUtils.convertSet; import static com.cf.imes.framework.common.util.json.JsonUtils.toJsonString; import static com.cf.imes.module.system.enums.ErrorCodeConstants.SOCIAL_USER_NOT_FOUND; @@ -88,7 +88,7 @@ public class SocialUserServiceImpl implements SocialUserService { // 获得 openid 对应的 SocialUserDO 社交用户 SocialUserDO socialUser = socialUserMapper.selectByTypeAndOpenid(socialType, openid); if (socialUser == null) { - throw exception(SOCIAL_USER_NOT_FOUND); + throw new ServiceException(SOCIAL_USER_NOT_FOUND); } // 获得对应的社交绑定关系 diff --git a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/systemconfig/factory/service/impl/CustomPlateNoServiceHandler.java b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/systemconfig/factory/service/impl/CustomPlateNoServiceHandler.java index 73a13e131..82e7556e3 100644 --- a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/systemconfig/factory/service/impl/CustomPlateNoServiceHandler.java +++ b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/systemconfig/factory/service/impl/CustomPlateNoServiceHandler.java @@ -9,7 +9,6 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.cf.imes.framework.common.enums.CommonStatusEnum; import com.cf.imes.framework.common.exception.ErrorCode; import com.cf.imes.framework.common.exception.ServiceException; -import com.cf.imes.framework.common.exception.util.ServiceExceptionUtil; import com.cf.imes.framework.common.util.object.BeanUtils; import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX; import com.cf.imes.framework.organ.core.context.OrganContextHolder; @@ -39,7 +38,7 @@ import java.util.List; import java.util.Map; import java.util.Optional; -import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception; + import static com.cf.imes.module.system.enums.ErrorCodeConstants.*; /** @@ -128,7 +127,7 @@ public class CustomPlateNoServiceHandler extends AbstractSystemConfigServiceHand } CustomPlateNoRuleCodeEnum custBoardRuleCodeEnum = CustomPlateNoRuleCodeEnum.match(ruleCode); if (ObjectUtil.isNull(custBoardRuleCodeEnum)) { - throw ServiceExceptionUtil.exception(CUSTOM_PLATE_NO_RULE_CHECK_RULECODE_NOT_MATCH_ERROR, ruleCode); + throw new ServiceException(CUSTOM_PLATE_NO_RULE_CHECK_RULECODE_NOT_MATCH_ERROR, ruleCode); } return custBoardRuleCodeEnum; } @@ -143,7 +142,7 @@ public class CustomPlateNoServiceHandler extends AbstractSystemConfigServiceHand if (ObjectUtil.equal(CustomPlateNoRuleCodeEnum.DATE, custBoardRuleCodeEnum) && StringUtils.isNotEmpty(format)) { Optional dateFormatDictDataOptional = dateTypeFormatDictList.stream().filter(d -> format.equals(d.getValue())).findAny(); if (dateFormatDictDataOptional.isEmpty()) { - throw ServiceExceptionUtil.exception(CUSTOM_PLATE_NO_RULE_CHECK_DATE_TYPE_FORMAT_ERROR, format); + throw new ServiceException(CUSTOM_PLATE_NO_RULE_CHECK_DATE_TYPE_FORMAT_ERROR, format); } } } @@ -157,7 +156,7 @@ public class CustomPlateNoServiceHandler extends AbstractSystemConfigServiceHand private void checkCustom(CustomPlateNoRuleCodeEnum custBoardRuleCodeEnum, JSONObject jsonObject) { if (ObjectUtil.equal(CustomPlateNoRuleCodeEnum.CUSTOM, custBoardRuleCodeEnum)) { if (ObjectUtil.isEmpty(jsonObject.get("strValue"))) { - throw ServiceExceptionUtil.exception(CUSTOM_PLATE_NO_RULE_CHECK_CUSTOM_VALUE_EMPTY_ERROR, jsonObject.get("ruleCode")); + throw new ServiceException(CUSTOM_PLATE_NO_RULE_CHECK_CUSTOM_VALUE_EMPTY_ERROR, jsonObject.get("ruleCode")); } } } @@ -198,10 +197,10 @@ public class CustomPlateNoServiceHandler extends AbstractSystemConfigServiceHand */ private void checkInt(Object intObj, String fieldName, String ruleName) { if (ObjectUtil.isEmpty(intObj)) { - throw ServiceExceptionUtil.exception(CUSTOM_PLATE_NO_RULE_CHECK_INT_TYPE_NO_EMPTY, ruleName, fieldName); + throw new ServiceException(CUSTOM_PLATE_NO_RULE_CHECK_INT_TYPE_NO_EMPTY, ruleName, fieldName); } if (!NumberUtil.isInteger(intObj.toString())) { - throw ServiceExceptionUtil.exception(CUSTOM_PLATE_NO_RULE_CHECK_INT_TYPE_ERROR, ruleName, fieldName, intObj); + throw new ServiceException(CUSTOM_PLATE_NO_RULE_CHECK_INT_TYPE_ERROR, ruleName, fieldName, intObj); } } @@ -213,10 +212,10 @@ public class CustomPlateNoServiceHandler extends AbstractSystemConfigServiceHand */ private void checkBol(Object bolObj, String fieldName, String ruleName) { if (ObjectUtil.isEmpty(bolObj)) { - throw ServiceExceptionUtil.exception(CUSTOM_PLATE_NO_RULE_CHECK_INT_TYPE_NO_EMPTY, ruleName, fieldName); + throw new ServiceException(CUSTOM_PLATE_NO_RULE_CHECK_INT_TYPE_NO_EMPTY, ruleName, fieldName); } if (!(bolObj instanceof Boolean)) { - throw ServiceExceptionUtil.exception(CUSTOM_PLATE_NO_RULE_CHECK_BOL_TYPE_ERROR, ruleName, fieldName, bolObj); + throw new ServiceException(CUSTOM_PLATE_NO_RULE_CHECK_BOL_TYPE_ERROR, ruleName, fieldName, bolObj); } } @@ -240,7 +239,7 @@ public class CustomPlateNoServiceHandler extends AbstractSystemConfigServiceHand checkSuccess = ObjectUtil.equal(resetMode, ResetModeEnum.ORDER.getMode()) || ObjectUtil.equal(resetMode, ResetModeEnum.ROOM.getMode()); } if (!checkSuccess) { - throw ServiceExceptionUtil.exception(CUSTOM_PLATE_NO_RULE_CHECK_RESETMODE_ERROR, ruleCode, resetMode); + throw new ServiceException(CUSTOM_PLATE_NO_RULE_CHECK_RESETMODE_ERROR, ruleCode, resetMode); } } @@ -311,7 +310,7 @@ public class CustomPlateNoServiceHandler extends AbstractSystemConfigServiceHand .eq(SystemConfigDO::getId, id) .eq(SystemConfigDO::getOrganId, OrganContextHolder.getOrganId())); if (ObjectUtil.isNull(systemConfigDO)) { - throw exception(SYSTEM_CONFIG_NOT_EXISTS); + throw new ServiceException(SYSTEM_CONFIG_NOT_EXISTS); } if (CommonStatusEnum.ENABLE.getStatus().equals(status)) { @@ -358,7 +357,7 @@ public class CustomPlateNoServiceHandler extends AbstractSystemConfigServiceHand .eq(SystemConfigDO::getId, id) .eq(SystemConfigDO::getOrganId, OrganContextHolder.getOrganId())); if (ObjectUtil.isNull(systemConfigDO)) { - throw exception(SYSTEM_CONFIG_NOT_EXISTS); + throw new ServiceException(SYSTEM_CONFIG_NOT_EXISTS); } return systemConfigDO; diff --git a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/systemconfig/factory/service/impl/DataProcessServiceHandler.java b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/systemconfig/factory/service/impl/DataProcessServiceHandler.java index 34282492d..3d5f96aa9 100644 --- a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/systemconfig/factory/service/impl/DataProcessServiceHandler.java +++ b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/systemconfig/factory/service/impl/DataProcessServiceHandler.java @@ -4,6 +4,7 @@ package com.cf.imes.module.system.service.systemconfig.factory.service.impl; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.util.ObjectUtil; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.cf.imes.framework.common.exception.ServiceException; import com.cf.imes.framework.common.util.Assert.AssertUtils; import com.cf.imes.framework.common.util.object.BeanUtils; import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX; @@ -23,7 +24,7 @@ import java.time.LocalDateTime; import java.util.ArrayList; import java.util.List; -import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception; + import static com.cf.imes.framework.common.util.json.JsonUtils.parseArray; import static com.cf.imes.framework.security.core.util.SecurityFrameworkUtils.getUserOrganId; import static com.cf.imes.module.system.enums.ErrorCodeConstants.*; @@ -103,7 +104,7 @@ public class DataProcessServiceHandler extends AbstractSystemConfigServiceHandle .eq(SystemConfigDataDO::getOrganId, OrganContextHolder.getOrganId())); if (ObjectUtil.isNull(systemConfigDataDO)) { - throw exception(SYSTEM_CONFIG_NOT_EXISTS); + throw new ServiceException(SYSTEM_CONFIG_NOT_EXISTS); } // 更新状态 @@ -186,7 +187,7 @@ public class DataProcessServiceHandler extends AbstractSystemConfigServiceHandle .eq(SystemConfigDataDO::getOrganId, OrganContextHolder.getOrganId())); if (ObjectUtil.isNull(systemConfigDataDO)) { - throw exception(SYSTEM_CONFIG_NOT_EXISTS); + throw new ServiceException(SYSTEM_CONFIG_NOT_EXISTS); } return systemConfigDataDO; @@ -214,7 +215,7 @@ public class DataProcessServiceHandler extends AbstractSystemConfigServiceHandle } if(optimizationConfigIds.contains(id)){ - throw exception(OPTIMIZATION_CONFIG_USED_ALREADY); + throw new ServiceException(OPTIMIZATION_CONFIG_USED_ALREADY); } diff --git a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/systemconfig/factory/service/impl/IntellectBranchingService.java b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/systemconfig/factory/service/impl/IntellectBranchingService.java index 07d41f72e..36d22efa0 100644 --- a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/systemconfig/factory/service/impl/IntellectBranchingService.java +++ b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/systemconfig/factory/service/impl/IntellectBranchingService.java @@ -4,6 +4,7 @@ package com.cf.imes.module.system.service.systemconfig.factory.service.impl; import cn.hutool.core.util.ObjectUtil; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.cf.imes.framework.common.enums.CommonStatusEnum; +import com.cf.imes.framework.common.exception.ServiceException; import com.cf.imes.framework.common.util.Assert.AssertUtils; import com.cf.imes.framework.common.util.object.BeanUtils; import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX; @@ -20,7 +21,7 @@ import java.time.LocalDateTime; import java.util.ArrayList; import java.util.List; -import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception; + import static com.cf.imes.framework.security.core.util.SecurityFrameworkUtils.getUserOrganId; import static com.cf.imes.module.system.enums.ErrorCodeConstants.SYSTEM_CONFIG_NOT_EXISTS; import static com.cf.imes.module.system.enums.ErrorCodeConstants.THIS_CONFIG_NAME_IS_EXISTS; @@ -101,7 +102,7 @@ public class IntellectBranchingService extends AbstractSystemConfigServiceHandle .eq(SystemConfigFilterDO::getId, id) .eq(SystemConfigFilterDO::getOrganId, OrganContextHolder.getOrganId())); if (ObjectUtil.isNull(systemConfigFilterDO)) { - throw exception(SYSTEM_CONFIG_NOT_EXISTS); + throw new ServiceException(SYSTEM_CONFIG_NOT_EXISTS); } // 更新状态 @@ -190,7 +191,7 @@ public class IntellectBranchingService extends AbstractSystemConfigServiceHandle .eq(SystemConfigFilterDO::getOrganId, OrganContextHolder.getOrganId())); if (ObjectUtil.isNull(systemConfigFilterDO)) { - throw exception(SYSTEM_CONFIG_NOT_EXISTS); + throw new ServiceException(SYSTEM_CONFIG_NOT_EXISTS); } return systemConfigFilterDO; diff --git a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/systemconfig/factory/service/impl/ProcessSchemeServiceHandler.java b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/systemconfig/factory/service/impl/ProcessSchemeServiceHandler.java index e3212f70b..2f681da58 100644 --- a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/systemconfig/factory/service/impl/ProcessSchemeServiceHandler.java +++ b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/systemconfig/factory/service/impl/ProcessSchemeServiceHandler.java @@ -5,6 +5,7 @@ import cn.hutool.core.text.CharSequenceUtil; import cn.hutool.core.util.ObjectUtil; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.cf.imes.framework.common.enums.CommonStatusEnum; +import com.cf.imes.framework.common.exception.ServiceException; import com.cf.imes.framework.common.util.Assert.AssertUtils; import com.cf.imes.framework.common.util.object.BeanUtils; import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX; @@ -25,7 +26,6 @@ import java.util.List; import java.util.Optional; import java.util.concurrent.atomic.AtomicLong; -import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception; import static com.cf.imes.framework.common.util.json.JsonUtils.parseArray; import static com.cf.imes.framework.common.util.json.JsonUtils.toJsonString; import static com.cf.imes.framework.security.core.util.SecurityFrameworkUtils.getUserOrganId; @@ -137,7 +137,7 @@ public class ProcessSchemeServiceHandler extends AbstractSystemConfigServiceHand Boolean data = orderPlanApi.getOrderProcessScheme(reqVO.getId()).getCheckedData(); if(Boolean.TRUE.equals(data)){ - throw exception(SYSTEM_PROCESS_SCHEME_CONFIG_IS_PLAN); + throw new ServiceException(SYSTEM_PROCESS_SCHEME_CONFIG_IS_PLAN); } systemConfigSchemeMapper.deleteConfig(reqVO.getId(),getUserOrganId()); @@ -156,7 +156,7 @@ public class ProcessSchemeServiceHandler extends AbstractSystemConfigServiceHand .eq(SystemConfigSchemeDO::getOrganId, OrganContextHolder.getOrganId())); if (ObjectUtil.isNull(systemConfigSchemeDO)) { - throw exception(SYSTEM_CONFIG_NOT_EXISTS); + throw new ServiceException(SYSTEM_CONFIG_NOT_EXISTS); } // 更新状态 @@ -236,7 +236,7 @@ public class ProcessSchemeServiceHandler extends AbstractSystemConfigServiceHand private void checkValueIsNotNull(String value,String error) { if(CharSequenceUtil.isBlank(value)){ - throw exception(SYSTEM_PROCESS_SCHEME_DATA_ERROR,error); + throw new ServiceException(SYSTEM_PROCESS_SCHEME_DATA_ERROR,error); } } @@ -256,7 +256,7 @@ public class ProcessSchemeServiceHandler extends AbstractSystemConfigServiceHand .eq(SystemConfigSchemeDO::getOrganId, OrganContextHolder.getOrganId())); if (ObjectUtil.isNull(systemConfigSchemeDO)) { - throw exception(SYSTEM_CONFIG_NOT_EXISTS); + throw new ServiceException(SYSTEM_CONFIG_NOT_EXISTS); } return systemConfigSchemeDO; diff --git a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/systemconfig/factory/service/impl/ProcessScreeningServiceHandler.java b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/systemconfig/factory/service/impl/ProcessScreeningServiceHandler.java index 664090652..ce6414c76 100644 --- a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/systemconfig/factory/service/impl/ProcessScreeningServiceHandler.java +++ b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/systemconfig/factory/service/impl/ProcessScreeningServiceHandler.java @@ -4,6 +4,7 @@ package com.cf.imes.module.system.service.systemconfig.factory.service.impl; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.util.ObjectUtil; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.cf.imes.framework.common.exception.ServiceException; import com.cf.imes.framework.common.util.Assert.AssertUtils; import com.cf.imes.framework.common.util.object.BeanUtils; import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX; @@ -23,7 +24,6 @@ import java.time.LocalDateTime; import java.util.ArrayList; import java.util.List; -import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception; import static com.cf.imes.framework.common.util.json.JsonUtils.parseArray; import static com.cf.imes.framework.security.core.util.SecurityFrameworkUtils.getUserOrganId; import static com.cf.imes.module.system.enums.ErrorCodeConstants.*; @@ -103,7 +103,7 @@ public class ProcessScreeningServiceHandler extends AbstractSystemConfigServiceH .eq(SystemConfigProcessDO::getId, id) .eq(SystemConfigProcessDO::getOrganId, OrganContextHolder.getOrganId())); if (ObjectUtil.isNull(systemConfigProcessDO)) { - throw exception(SYSTEM_CONFIG_NOT_EXISTS); + throw new ServiceException(SYSTEM_CONFIG_NOT_EXISTS); } // 更新状态 @@ -185,7 +185,7 @@ public class ProcessScreeningServiceHandler extends AbstractSystemConfigServiceH .eq(SystemConfigProcessDO::getOrganId, OrganContextHolder.getOrganId())); if (ObjectUtil.isNull(systemConfigProcessDO)) { - throw exception(SYSTEM_CONFIG_NOT_EXISTS); + throw new ServiceException(SYSTEM_CONFIG_NOT_EXISTS); } return systemConfigProcessDO; @@ -212,7 +212,7 @@ public class ProcessScreeningServiceHandler extends AbstractSystemConfigServiceH } if(processLineConfigIds.contains(id)){ - throw exception(PROCESS_CONFIG_USED_ALREADY); + throw new ServiceException(PROCESS_CONFIG_USED_ALREADY); } diff --git a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/systemconfig/factory/service/impl/SealedgeServiceHandler.java b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/systemconfig/factory/service/impl/SealedgeServiceHandler.java index d5f674223..8aec52e59 100644 --- a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/systemconfig/factory/service/impl/SealedgeServiceHandler.java +++ b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/systemconfig/factory/service/impl/SealedgeServiceHandler.java @@ -24,7 +24,6 @@ import java.math.BigDecimal; import java.time.LocalDateTime; import java.util.List; -import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception; import static com.cf.imes.module.system.enums.ErrorCodeConstants.*; @@ -71,7 +70,7 @@ public class SealedgeServiceHandler extends AbstractSystemConfigServiceHandler { String widthValue = jsonObject.getString("widthValue"); if(StringUtils.isEmpty(widthMin) || StringUtils.isEmpty(widthMax) || StringUtils.isEmpty(widthValue) ){ - throw exception(SEALEDGE_CONFIG_NOT_EXISTS,(i+1)); + throw new ServiceException(SEALEDGE_CONFIG_NOT_EXISTS,(i+1)); } BigDecimal widthMin2 = BigDecimal.valueOf(Double.parseDouble(widthMin)); @@ -82,24 +81,24 @@ public class SealedgeServiceHandler extends AbstractSystemConfigServiceHandler { if(widthMin2.scale() > 3 || widthMax2.scale() > 3 || widthValue2.scale() > 3 ){ - throw exception(DECIMAL_PLACES_MAX_TWO,(i+1)); + throw new ServiceException(DECIMAL_PLACES_MAX_TWO,(i+1)); } if( widthMin2.compareTo(BigDecimal.ZERO) != 1 ){ - throw exception(SEALEDGE_CONFIG_MIN_VALUE_GREATER_THAN_ZERO,(i+1),widthMin2.stripTrailingZeros().toPlainString()); + throw new ServiceException(SEALEDGE_CONFIG_MIN_VALUE_GREATER_THAN_ZERO,(i+1),widthMin2.stripTrailingZeros().toPlainString()); } if( widthMax2.compareTo(BigDecimal.ZERO) != 1 ){ - throw exception(SEALEDGE_CONFIG_MAX_VALUE_GREATER_THAN_ZERO,(i+1),widthMax2.stripTrailingZeros().toPlainString()); + throw new ServiceException(SEALEDGE_CONFIG_MAX_VALUE_GREATER_THAN_ZERO,(i+1),widthMax2.stripTrailingZeros().toPlainString()); } if( widthMax2.compareTo(widthMin2) == -1 ){ - throw exception(SEALEDGE_CONFIG_VALUE_DATA_ERROR,(i+1)); + throw new ServiceException(SEALEDGE_CONFIG_VALUE_DATA_ERROR,(i+1)); } if( widthValue2.compareTo(widthMax2) == -1 ){ - throw exception(SEALEDGE_CONFIG_MAX_VALUE_DATA_ERROR,(i+1),widthValue2.stripTrailingZeros().toPlainString(),widthMax2.stripTrailingZeros().toPlainString()); + throw new ServiceException(SEALEDGE_CONFIG_MAX_VALUE_DATA_ERROR,(i+1),widthValue2.stripTrailingZeros().toPlainString(),widthMax2.stripTrailingZeros().toPlainString()); } } @@ -159,7 +158,7 @@ public class SealedgeServiceHandler extends AbstractSystemConfigServiceHandler { .eq(SystemConfigSealedgeDO::getOrganId, OrganContextHolder.getOrganId())); if (ObjectUtil.isNull(systemConfigDO)) { - throw exception(SYSTEM_CONFIG_NOT_EXISTS); + throw new ServiceException(SYSTEM_CONFIG_NOT_EXISTS); } return systemConfigDO; @@ -210,7 +209,7 @@ public class SealedgeServiceHandler extends AbstractSystemConfigServiceHandler { .eq(SystemConfigSealedgeDO::getOrganId, OrganContextHolder.getOrganId())); if (ObjectUtil.isNull(systemConfigSealedgeDO)) { - throw exception(SYSTEM_CONFIG_NOT_EXISTS); + throw new ServiceException(SYSTEM_CONFIG_NOT_EXISTS); } return systemConfigSealedgeDO; diff --git a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/tokenconfig/TokenConfigServiceImpl.java b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/tokenconfig/TokenConfigServiceImpl.java index 55f5213d4..c006c0abf 100644 --- a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/tokenconfig/TokenConfigServiceImpl.java +++ b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/tokenconfig/TokenConfigServiceImpl.java @@ -4,6 +4,7 @@ package com.cf.imes.module.system.service.tokenconfig; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.util.ObjectUtil; import com.cf.imes.framework.common.enums.CommonStatusEnum; +import com.cf.imes.framework.common.exception.ServiceException; import com.cf.imes.framework.common.pojo.PageResult; import com.cf.imes.framework.common.util.Assert.AssertUtils; import com.cf.imes.framework.common.util.date.DateUtils; @@ -36,7 +37,6 @@ import java.time.LocalDateTime; import java.time.LocalTime; import java.util.*; -import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception; import static com.cf.imes.framework.security.core.util.SecurityFrameworkUtils.getUserOrganId; import static com.cf.imes.module.system.enums.ErrorCodeConstants.*; @@ -120,7 +120,7 @@ public class TokenConfigServiceImpl implements TokenConfigService{ List appTypes = tokenConfigMapper.selectAppTypeByOrganId(organId); if(appTypes.contains(reqVO.getAppType())){ - throw exception(TOKEN_APP_TYPE_EXIST); + throw new ServiceException(TOKEN_APP_TYPE_EXIST); } String token = generateBaseToken(organId, organizationDO.getContactMobile(), reqVO.getAppType(), jwtConfig.getSecret()); @@ -157,7 +157,7 @@ public class TokenConfigServiceImpl implements TokenConfigService{ TokenConfigDO tokenConfigDO = validateTokenConfigExists(reqVO.getId()); if(!tokenConfigDO.getAppType().equals(reqVO.getAppType())){ - throw exception(TOKEN_APP_TYPE_NO_UPDATE); + throw new ServiceException(TOKEN_APP_TYPE_NO_UPDATE); } LocalDateTime adjustedTime = null; @@ -172,7 +172,7 @@ public class TokenConfigServiceImpl implements TokenConfigService{ if(adjustedTime != null){ if(DateUtils.isExpired(adjustedTime)){ - throw exception(TOKEN_EXPIRES_TIME_DATA_ERROR); + throw new ServiceException(TOKEN_EXPIRES_TIME_DATA_ERROR); } tokenConfigDO.setExpiresTime(adjustedTime); @@ -195,7 +195,7 @@ public class TokenConfigServiceImpl implements TokenConfigService{ TokenConfigDO tokenConfigDO = tokenConfigMapper.selectById(id); if(ObjectUtil.isNull(tokenConfigDO)){ - throw exception(TOKEN_DATA_IS_NULL); + throw new ServiceException(TOKEN_DATA_IS_NULL); } tokenConfigMapper.deleteTokenConfig(id); @@ -211,11 +211,11 @@ public class TokenConfigServiceImpl implements TokenConfigService{ TokenConfigDO tokenConfigDO = tokenConfigMapper.selectByToken(token.substring(5)); if(tokenConfigDO == null){ - throw exception(TOKEN_CONFIG_NOT_EXISTS); + throw new ServiceException(TOKEN_CONFIG_NOT_EXISTS); } if (DateUtils.isExpired(tokenConfigDO.getExpiresTime())) { - throw exception(TOKEN_TIME_IS_EXPIRES); + throw new ServiceException(TOKEN_TIME_IS_EXPIRES); } Long organId = tokenConfigDO.getOrganId(); @@ -223,15 +223,15 @@ public class TokenConfigServiceImpl implements TokenConfigService{ OrganizationDO organizationDO = organMapper.selectById(organId); if (organizationDO == null) { - throw exception(ORGAN_NOT_EXISTS); + throw new ServiceException(ORGAN_NOT_EXISTS); } if (organizationDO.getStatus().equals(CommonStatusEnum.DISABLE.getStatus())) { - throw exception(ORGAN_DISABLE, organizationDO.getName()); + throw new ServiceException(ORGAN_DISABLE, organizationDO.getName()); } if (DateUtils.isExpired(organizationDO.getExpireTime())) { - throw exception(ORGAN_EXPIRE, organizationDO.getName()); + throw new ServiceException(ORGAN_EXPIRE, organizationDO.getName()); } return organId; @@ -275,7 +275,7 @@ public class TokenConfigServiceImpl implements TokenConfigService{ TokenConfigDO tokenConfigDO = tokenConfigMapper.selectById(id); if (ObjectUtil.isNull(tokenConfigDO)) { - throw exception(TOKEN_CONFIG_NOT_EXISTS); + throw new ServiceException(TOKEN_CONFIG_NOT_EXISTS); } return tokenConfigDO; @@ -333,7 +333,7 @@ public class TokenConfigServiceImpl implements TokenConfigService{ log.error("token二次处理失败"+e.getMessage()); - throw exception(INSERT_TOKEN_DATA_ERROR); + throw new ServiceException(INSERT_TOKEN_DATA_ERROR); } diff --git a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/user/AdminUserServiceImpl.java b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/user/AdminUserServiceImpl.java index 9d5a9791d..4b0c5c8c8 100644 --- a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/user/AdminUserServiceImpl.java +++ b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/user/AdminUserServiceImpl.java @@ -10,7 +10,6 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.cf.imes.framework.common.enums.CommonStatusEnum; import com.cf.imes.framework.common.enums.UserTypeEnum; import com.cf.imes.framework.common.exception.ServiceException; -import com.cf.imes.framework.common.exception.util.ServiceExceptionUtil; import com.cf.imes.framework.common.pojo.PageResult; import com.cf.imes.framework.common.util.collection.CollectionUtils; import com.cf.imes.framework.common.util.json.JsonUtils; @@ -71,7 +70,6 @@ import java.util.*; import java.util.regex.Pattern; import java.util.stream.Collectors; -import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception; import static com.cf.imes.framework.common.util.collection.CollectionUtils.convertSet; import static com.cf.imes.framework.common.util.time.StatisticsChangeUtils.generateDateRangeAxis; import static com.cf.imes.framework.common.util.time.StatisticsChangeUtils.getDateList; @@ -142,7 +140,7 @@ public class AdminUserServiceImpl implements AdminUserService { organService.handleOrganInfo(organ -> { long count = userMapper.selectCount(new LambdaQueryWrapperX().eq(AdminUserDO::getOrganId, organId)); if (count >= organ.getAccountCount()) { - throw ServiceExceptionUtil.exception(ErrorCodeConstants.USER_COUNT_MAX, organ.getAccountCount()); + throw new ServiceException(ErrorCodeConstants.USER_COUNT_MAX, organ.getAccountCount()); } }, organId); @@ -191,7 +189,7 @@ public class AdminUserServiceImpl implements AdminUserService { // 当手机号(账号)发生改变时,只允许密码为空的通过(还没有使用验证码来设置过密码) if (ObjectUtil.isNotNull(adminUserDO) && !StringUtils.equals(adminUserDO.getUsername(), mobile)) { if(StringUtils.isNotEmpty(adminUserDO.getPassword())) { - throw ServiceExceptionUtil.exception(USER_MOBILE_UPDATE_NOT_ALLOW_ERROR); + throw new ServiceException(USER_MOBILE_UPDATE_NOT_ALLOW_ERROR); } else { updateObj.setUsername(mobile); } @@ -472,10 +470,10 @@ public class AdminUserServiceImpl implements AdminUserService { ids.forEach(id -> { AdminUserDO user = userMap.get(id); if (user == null) { - throw ServiceExceptionUtil.exception(ErrorCodeConstants.USER_NOT_EXISTS); + throw new ServiceException(ErrorCodeConstants.USER_NOT_EXISTS); } if (!CommonStatusEnum.ENABLE.getStatus().equals(user.getStatus())) { - throw ServiceExceptionUtil.exception(ErrorCodeConstants.USER_IS_DISABLE, user.getNickname()); + throw new ServiceException(ErrorCodeConstants.USER_IS_DISABLE, user.getNickname()); } }); } @@ -522,27 +520,27 @@ public class AdminUserServiceImpl implements AdminUserService { // 检查密码长度 if (!Pattern.matches(LENGTH_PATTERN, password)) { - throw ServiceExceptionUtil.exception(ErrorCodeConstants.THE_PASSWORD_LENGTH_MUST_BE_AT_LEAST_8_CHARACTERS); + throw new ServiceException(ErrorCodeConstants.THE_PASSWORD_LENGTH_MUST_BE_AT_LEAST_8_CHARACTERS); } // 检查是否包含大写字母 if (!Pattern.matches(UPPER_LETTER_PATTERN, password)) { - throw ServiceExceptionUtil.exception(ErrorCodeConstants.THE_PASSWORD_LENGTH_MUST_BE_AT_LEAST_8_CHARACTERS); + throw new ServiceException(ErrorCodeConstants.THE_PASSWORD_LENGTH_MUST_BE_AT_LEAST_8_CHARACTERS); } // 检查是否包含小写字母 if (!Pattern.matches(LOWER_LETTER_PATTERN, password)) { - throw ServiceExceptionUtil.exception(ErrorCodeConstants.THE_PASSWORD_LENGTH_MUST_BE_AT_LEAST_8_CHARACTERS); + throw new ServiceException(ErrorCodeConstants.THE_PASSWORD_LENGTH_MUST_BE_AT_LEAST_8_CHARACTERS); } // 检查是否包含数字 if (!Pattern.matches(DIGIT_PATTERN, password)) { - throw ServiceExceptionUtil.exception(ErrorCodeConstants.THE_PASSWORD_LENGTH_MUST_BE_AT_LEAST_8_CHARACTERS); + throw new ServiceException(ErrorCodeConstants.THE_PASSWORD_LENGTH_MUST_BE_AT_LEAST_8_CHARACTERS); } // 检查是否包含特殊字符 if (!Pattern.matches(SPECIAL_CHARACTER_PATTERN, password)) { - throw ServiceExceptionUtil.exception(ErrorCodeConstants.THE_PASSWORD_LENGTH_MUST_BE_AT_LEAST_8_CHARACTERS); + throw new ServiceException(ErrorCodeConstants.THE_PASSWORD_LENGTH_MUST_BE_AT_LEAST_8_CHARACTERS); } // 检查是否只包含字母、数字和特殊字符 if (!Pattern.matches(VALID_CHAR_PATTERN, password)) { - throw ServiceExceptionUtil.exception(ErrorCodeConstants.THE_PASSWORD_LENGTH_MUST_BE_AT_LEAST_8_CHARACTERS); + throw new ServiceException(ErrorCodeConstants.THE_PASSWORD_LENGTH_MUST_BE_AT_LEAST_8_CHARACTERS); } } @@ -554,7 +552,7 @@ public class AdminUserServiceImpl implements AdminUserService { } AdminUserDO user = userMapper.selectById(id); if (user == null) { - throw ServiceExceptionUtil.exception(ErrorCodeConstants.USER_NOT_EXISTS); + throw new ServiceException(ErrorCodeConstants.USER_NOT_EXISTS); } return user; } @@ -563,7 +561,7 @@ public class AdminUserServiceImpl implements AdminUserService { private AdminUserDO validateUserNameExists(String userName) { AdminUserDO user = userMapper.selectByUsernameUnique(userName); if (user == null) { - throw ServiceExceptionUtil.exception(ErrorCodeConstants.USER_NOT_EXISTS); + throw new ServiceException(ErrorCodeConstants.USER_NOT_EXISTS); } return user; } @@ -580,10 +578,10 @@ public class AdminUserServiceImpl implements AdminUserService { } // 如果 id 为空,说明不用比较是否为相同 id 的用户 if (id == null) { - throw ServiceExceptionUtil.exception(ErrorCodeConstants.USER_USERNAME_EXISTS); + throw new ServiceException(ErrorCodeConstants.USER_USERNAME_EXISTS); } if (!user.getId().equals(id)) { - throw ServiceExceptionUtil.exception(ErrorCodeConstants.USER_USERNAME_EXISTS); + throw new ServiceException(ErrorCodeConstants.USER_USERNAME_EXISTS); } } @@ -598,10 +596,10 @@ public class AdminUserServiceImpl implements AdminUserService { } // 如果 id 为空,说明不用比较是否为相同 id 的用户 if (id == null) { - throw ServiceExceptionUtil.exception(ErrorCodeConstants.USER_EMAIL_EXISTS); + throw new ServiceException(ErrorCodeConstants.USER_EMAIL_EXISTS); } if (!user.getId().equals(id)) { - throw ServiceExceptionUtil.exception(ErrorCodeConstants.USER_EMAIL_EXISTS); + throw new ServiceException(ErrorCodeConstants.USER_EMAIL_EXISTS); } } @@ -614,10 +612,10 @@ public class AdminUserServiceImpl implements AdminUserService { } // 如果 id 为空,说明不用比较是否为相同 id 的用户 if (id == null) { - throw ServiceExceptionUtil.exception(ErrorCodeConstants.USER_MOBILE_EXISTS); + throw new ServiceException(ErrorCodeConstants.USER_MOBILE_EXISTS); } if (!user.getId().equals(id)) { - throw ServiceExceptionUtil.exception(ErrorCodeConstants.USER_MOBILE_EXISTS); + throw new ServiceException(ErrorCodeConstants.USER_MOBILE_EXISTS); } return user; } @@ -632,10 +630,10 @@ public class AdminUserServiceImpl implements AdminUserService { void validateOldPassword(Long id, String oldPassword) { AdminUserDO user = userMapper.selectById(id); if (user == null) { - throw ServiceExceptionUtil.exception(ErrorCodeConstants.USER_NOT_EXISTS); + throw new ServiceException(ErrorCodeConstants.USER_NOT_EXISTS); } if (!isPasswordMatch(oldPassword, user.getPassword())) { - throw ServiceExceptionUtil.exception(ErrorCodeConstants.USER_PASSWORD_FAILED); + throw new ServiceException(ErrorCodeConstants.USER_PASSWORD_FAILED); } } @@ -643,7 +641,7 @@ public class AdminUserServiceImpl implements AdminUserService { @Transactional(rollbackFor = Exception.class) // 添加事务,异常则回滚所有导入 public UserImportRespVO importUserList(List importUsers, boolean isUpdateSupport, Long organId) { if (CollUtil.isEmpty(importUsers)) { - throw ServiceExceptionUtil.exception(ErrorCodeConstants.USER_IMPORT_LIST_IS_EMPTY); + throw new ServiceException(ErrorCodeConstants.USER_IMPORT_LIST_IS_EMPTY); } UserImportRespVO respVO = UserImportRespVO.builder().createUsernames(new ArrayList<>()) .updateUsernames(new ArrayList<>()).failureUsernames(new LinkedHashMap<>()).build(); @@ -721,7 +719,7 @@ public class AdminUserServiceImpl implements AdminUserService { AdminUserDO adminUserDO = validateMobileUnique(id, mobile); // 手机号没有改变无需请求 if (ObjectUtil.isNotNull(adminUserDO) && ObjectUtil.equal(id, adminUserDO.getId())) { - throw ServiceExceptionUtil.exception(ErrorCodeConstants.AUTH_MOBILE_NO_CHANGE); + throw new ServiceException(ErrorCodeConstants.AUTH_MOBILE_NO_CHANGE); } // 新手机号入库 -> setUsername @@ -751,13 +749,13 @@ public class AdminUserServiceImpl implements AdminUserService { */ private void checkCurrentWhenOperate(Long userId) { if (ObjectUtil.equal(userId, SecurityFrameworkUtils.getLoginUserId())) { - throw exception(USER_ME_ERROR); + throw new ServiceException(USER_ME_ERROR); } } private void checkCurrentWhenOperateStatus(Long userId, Integer status) { if (ObjectUtil.equal(userId, SecurityFrameworkUtils.getLoginUserId()) && Objects.equals(CommonStatusEnum.DISABLE.getStatus(), status)) { - throw exception(USER_OPERATE_SELF_STATUS_ERROR); + throw new ServiceException(USER_OPERATE_SELF_STATUS_ERROR); } } diff --git a/cf-module-system/cf-module-system-biz/src/main/resources/application.yaml b/cf-module-system/cf-module-system-biz/src/main/resources/application.yaml index 594ce0b56..ca966647c 100644 --- a/cf-module-system/cf-module-system-biz/src/main/resources/application.yaml +++ b/cf-module-system/cf-module-system-biz/src/main/resources/application.yaml @@ -98,7 +98,7 @@ spring: repositories: enabled: false # 项目未使用到 Spring Data Redis 的 Repository,所以直接禁用,保证启动速度 messages: - basename: message + basename: message,message_errorcode trans: config: appId: 20251110002494620 diff --git a/cf-module-system/cf-module-system-biz/src/main/resources/message.properties b/cf-module-system/cf-module-system-biz/src/main/resources/message.properties index c9177cb35..5ac9126db 100644 --- a/cf-module-system/cf-module-system-biz/src/main/resources/message.properties +++ b/cf-module-system/cf-module-system-biz/src/main/resources/message.properties @@ -99,4 +99,5 @@ global.error.no.permission=没有该操作权限 global.error.no.permission.to.visit.org=您无权访问该组织的数据 global.error.request.organId.notExist=请求的组织标识未传递,请进行排查 global.org.product.not.exist=账号登录异常,套餐信息不存在,请重新登陆 -global.org.product.expired=组织产品套餐已过期,请续费后继续使用 \ No newline at end of file +global.org.product.expired=组织产品套餐已过期,请续费后继续使用 +global.not.login=账号未登录 \ No newline at end of file diff --git a/cf-module-system/cf-module-system-biz/src/main/resources/message_cht.properties b/cf-module-system/cf-module-system-biz/src/main/resources/message_cht.properties index a3847a108..f1644a9c2 100644 --- a/cf-module-system/cf-module-system-biz/src/main/resources/message_cht.properties +++ b/cf-module-system/cf-module-system-biz/src/main/resources/message_cht.properties @@ -99,4 +99,5 @@ global.error.no.permission=您沒有該操作的權限 global.error.no.permission.to.visit.org=您無權訪問該組織的數據 global.error.request.organId.notExist=請求的組織標識未傳遞,請進行排查 global.org.product.not.exist=帳號登入異常,套餐資訊不存在,請重新登入 -global.org.product.expired=組織產品套餐已過期,請續費後繼續使用 \ No newline at end of file +global.org.product.expired=組織產品套餐已過期,請續費後繼續使用 +global.not.login=賬號未登錄 \ No newline at end of file diff --git a/cf-module-system/cf-module-system-biz/src/main/resources/message_en.properties b/cf-module-system/cf-module-system-biz/src/main/resources/message_en.properties index 19736b57d..d3f2aa9db 100644 --- a/cf-module-system/cf-module-system-biz/src/main/resources/message_en.properties +++ b/cf-module-system/cf-module-system-biz/src/main/resources/message_en.properties @@ -99,4 +99,5 @@ global.error.no.permission=You do not have permission to perform this action global.error.no.permission.to.visit.org=You do not have permission to access this organization’s data global.error.request.organId.notExist=The requested organization ID was not provided, please check global.org.product.not.exist=Account login exception: product package does not exist, please log in again -global.org.product.expired=The organization's product package has expired, please renew before continuing to use the service \ No newline at end of file +global.org.product.expired=The organization's product package has expired, please renew before continuing to use the service +global.not.login=The account is not logged in \ No newline at end of file diff --git a/cf-module-system/cf-module-system-biz/src/main/resources/message_errorcode.properties b/cf-module-system/cf-module-system-biz/src/main/resources/message_errorcode.properties new file mode 100644 index 000000000..84a416dd0 --- /dev/null +++ b/cf-module-system/cf-module-system-biz/src/main/resources/message_errorcode.properties @@ -0,0 +1 @@ +auth.login.bad_credentials=登录失败,账号密码不正确 auth.login.user_disabled=登录失败,账号被禁用 auth.login.captcha_code_error=验证码不正确,原因:{0} auth.login.third_not_bind=未绑定账号,需要进行绑定 auth.mobile.not_exists=手机号不存在 auth.mobile.no_change=手机号未发生改变,无需修改 auth.manage_endpoint.login_permission_error=登录失败,管理端账号不存在 menu.name.duplicate=已经存在该名字的菜单 menu.parent.not_exists=父菜单不存在 menu.parent.error=不能设置自己为父菜单 menu.not_exists=菜单不存在 menu.exists_children=存在子菜单,无法删除 menu.parent.not_dir_or_menu=父菜单的类型必须是目录或者菜单 menu.operation_permission_error=管理端菜单操作权限不足 menu.trans_error=菜单翻译异常,error_code :{0} role.not_exists=角色不存在 role.name.duplicate=已经存在名为[{0}]的角色 role.code.duplicate=已经存在编码为[{0}]的角色 role.can_not_update_system_type=不能操作类型为系统内置的角色 role.is_disable=名字为[{0}]的角色已被禁用 role.admin_code_error=编码[{0}]不能使用 role.me_error=不可为自身分配角色 role.not_superadmin_no_organ_id_oper_error=非超管分配权限 role.buildin.modify_permission_error=修改内置角色下菜单权限的权限不足 role.self.modify_permission_error=无法修改自身的角色菜单权限 role.self.modify_error=无法修改自身的角色 user.username.exists=手机号已经存在 user.mobile.exists=手机号已经存在 user.email.exists=邮箱已经存在 user.not_exists=用户不存在 user.import.empty=导入用户数据不能为空! user.password.failed=用户密码校验失败 user.is_disable=名字为[{0}]的用户已被禁用 user.count.max=超过组织用户配额({0}),创建用户失败! user.me.error=不允许操作用户自身 user.password.length_at_least_8=密码长度不少于8位,且包含大小写字母、数字和特殊字符 user.username.multiple_error=存在[{0}]重复用户,请联系系统管理员 user.operate_self_status_error=不允许操作用户自身状态 user.mobile_update_not_allow=该用户已通过手机号认证,如需修改手机号请前往个人中心 dept.name.duplicate=已经存在该名字的部门 dept.parent.not_exists=父级部门不存在 dept.not_found=当前部门不存在 dept.exists_children=存在子部门,无法删除 dept.parent.error=不能设置自己为父部门 dept.exists_user=部门中存在员工,无法删除 dept.parent_is_child=不能设置自己的子部门为父部门 dept.user_oper_not_allow=不允许操作用户自身部门 dept.parent_user_oper_not_allow=不允许操作用户自身部门及其上级部门 dept.disable=部门({0})已被禁用 dept.not_allowed_login=部门({0})已被禁用,无法登录 dept.parent_disable=上级部门({0})已被禁用,请开启后操作或选择其他上级部门 dict_type.not_exists=当前字典类型不存在 dict_type.not_enable=字典类型处于关闭状态,不允许新增或编辑 dict_type.name.duplicate=已经存在该名字的字典类型 dict_type.type.duplicate=已经存在该类型的字典类型 dict_type.has_children=无法删除,该字典类型还有字典数据 dict_data.not_exists=当前字典数据不存在 dict_data.not_enable=字典数据({0})不处于开启状态,不允许选择 dict_data.value.duplicate=已经存在该值的字典数据 dict_data.trans_error=字典数据标签翻译异常,error_code :{0} notice.not_found=当前通知公告不存在 notice.name_unique_error=公告标题已存在,请编辑后重试 notice.buildin.modify_permission_error=内置通知公告编辑权限不足 sms.channel.not_exists=短信渠道不存在 sms.template.not_exists=短信模板不存在 sms.template.code.duplicate=已经存在编码为[{0}]的短信模板 sms.template.api_error=短信 API 模板调用失败,原因是:{0} sms.template.api.audit_checking=短信 API 模版无法使用,原因:审批中 sms.template.api.audit_fail=短信 API 模版无法使用,原因:审批不通过,{0} sms.template.api.not_found=短信 API 模版无法使用,原因:模版不存在 sms.send.mobile.not_exists=手机号不存在 sms.send.mobile.template_param_miss=短信模板参数({0})缺失 sms.send.template.not_exists=短信模板不存在 sms.code.not_found=验证码不存在,请点击获取 sms.code.not_correct=验证码不正确 sms.code.send_too_fast=短信发送过于频率 sms.code.is_valid=验证码在有效期内,5分钟内请勿重复发送! organ.not_exists=组织不存在 organ.disable=[{0}]组织已被禁用 organ.expire=[{0}]组织已过期 organ.can_not_update_system=系统组织不能进行修改、删除等操作! organ.name.duplicate=名字为[{0}]的组织已存在 organ.website.duplicate=域名为[{0}]的组织已存在 organ.data_code.not_exists=组织未配置数据源标识 organ.already_exists=该新增组织已授权机台数量无需重复新增! organ.user_oper.not_allow=不允许操作用户自身组织 organ.contact_mobile.duplicate=手机号为[{0}]的组织已存在 organ.expiretime.product_id_lack=请选择要购买的产品 notify.template.not.exists=站内信模版不存在 notify.template.code.duplicate=已经存在编码为[{}]的站内信模板 notify.send.template.param.miss=站内信模板参数({})缺失 machine.not.exists=机台不存在 machine.template.not.exists=机台模板不存在 default.template.count=默认模板数量异常 the.current.machine.is.already.in.use=当前机台已使用,禁止删除 machine.error=当前机台错误,请重新选择机台 the.current.brand.of.the.machine.exists=当前机台配置的模板中,该品牌已存在,请重新输入品牌名称 the.model.of.the.machine.does.not.exist=该型号的机台模板不存在,请进行配置 the.current.brand=品牌ID错误,或品牌不存在 machine.num.error=当前组织该类型的机台创建已达到最大值,无法继续创建 machine.name.error=当前机台名称已存在,请重新输入机台名称 machinetemplate.name.error=当前机台模板的名称已存在,请重新输入机台模板名称 labelingmachine.related.data.error=当前机台关联的贴标机数据有误,请在高级配置中重新配置贴标机或选择其他模板 drillmachine.related.data.error=当前机台关联的钻孔机数据有误,请在钻孔模块中重新配置钻孔机或选择其他模板 machine.data.error=当前组织还未进行机台授权,请联系组织管理员在基础管理里对当前组织进行机台授权,或联系客服进行授权 machine.num.data.error=组织授权的机台数量不能超过127台 machine.used.already=当前机台在加工方案组中已使用,无法删除 label.template.not.exists=标签模板不存在 label.not.exists=标签不存在 default.label.not.exists=该类型标签默认模板不存在 machine.use.label=当前标签已有机台使用,无法删除 default.not.deleted=默认标签模板无法删除 label.is.use.error=当前标签打包设置中已有用户使用,无法删除 data.source.not.exists=系统数据源不存在 order.parts.import.list.is.empty=生产配件导入数据不可以为空 remain.plate.status.used=余料板正在使用中,禁止修改 remain.plate.status.no.used=余料板未使用 remain.plate.usr.type=余料板使用类型为不可核销类型 remain.plate.id.not.exists=未选中余料板,请选择余料板 remain.plate.count.max=每次新增余料板数量,最大为999 currently.no.configuration.available=当前没有{0}配置信息,请前往设置配置 system.config.not_exists=系统配置不存在 system.config.type_not_support=不支持的系统配置类型 system.config.custom_plate_no.rule_save_format_error=自定义板编号配置:自定义板编号保存格式错误,请检查配置规则 system.config.custom_plate_no.rule_reset_not_support=自定义板编号配置:该规则不支持手动复位/清零 system.config.custom_plate_no.rule_item_not_found=自定义板编号配置:找不到对应的规则项进行手动复位/清零 system.config.custom_plate_no.rule_order_reset_failed=自定义板编号配置:手动复位/清零生产单下序号失败,请联系客服 custom.plate_no.rule.code_empty=规则编码不能为空 custom.plate_no.rule.code_not_match=规则编码[{0}]不合法,请检查配置规则 custom.plate_no.rule.date_format_error=时间格式[{0}]不合法,请检查配置规则 custom.plate_no.rule.custom_value_empty=自定义字符值不能为空,请检查配置规则 custom.plate_no.rule.reset_mode_error=规则[{0}]复位/清零模式不合法,请检查配置规则 custom.plate_no.rule.int_type_empty={0} 下的 {1} 不能为空,请检查配置规则 custom.plate_no.rule.int_type_convert_error={0} 下的数值类型参数 {1}:{2} 转换异常,请检查配置规则 custom.plate_no.rule.bool_type_convert_error={0} 下的布尔类型参数 {1}:{2} 转换异常,请检查配置规则 process.scheme.data_empty=加工方案组的:{0} 为空,无法保存,请进行配置 process.scheme.config.data_empty=加工方案组的:{0} 为空,请检查配置信息 process.scheme.config.field_error=当前方案组的配置异常,请重新配置 process.scheme.config.in_use=当前方案组已在排单中使用,无法删除 process.scheme.config.machine_label_empty=当前方案组对应的解析器的机台的标签数据为空,请检查机台的标签配置信息 config.data_error=当前系统配置的数据有误,请重新尝试排序 process.config.used_already=当前加工分线配置在加工方案组中已使用,无法删除 optimization.config.used_already=当前数据处理配置在加工方案组中已使用,无法删除 sealedge.config.item_empty=第 {0} 条配置中,有字段值为空,请添加数据 sealedge.config.max_value_error=第 {0} 条配置中,{1} 要大于等于 {2},请修改数据 sealedge.config.data_error=当前封边条配置有误,请重新检查后新增 sealedge.config.name_exists=当前配置的名称已存在,请重新命名 sealedge.config.decimal_places_max_three=第 {0} 条配置中,小数位数最大为 3 位,请进行修改 sealedge.config.min_value_gt_zero=第 {0} 条配置中,宽最小值:{1} 要大于 0,请修改数据 sealedge.config.max_value_gt_zero=第 {0} 条配置中,宽最大值:{1} 要大于 0,请修改数据 sealedge.config.value_range_error=第 {0} 条配置中,宽最大值 要大于 宽最小值,请修改数据 token.app_type.exist=当前应用以存在token配置,无法继续新增 token.config.not_exists=当前应用的token配置不存在 token.time.is_expires=当前token已过期,请重新配置或延长时间 token.app_type.no_update=应用名称不允许更改 token.data.is_null=当前token的配置为空,无需删除 token.expires_time.is_null=当前未选择有效时间,请选择再进行新增 token.expires_time.data_error=当前选择的有效时间已过期,请增加有效时间 token.insert.data_error=token新增失败,请重新尝试 invoice.no_exist=当前发票记录有误,请重新查看 invoicing.reject_reason=请填写拒绝开票原因 purchase_record.no_exist=当前发票对应的购买记录有误,请退回组织后重新申请开票 invoice.is_fail=当前发票已开票,无法再次进行开票 products.is_exist=产品[{0}]已存在,请修改产品名称后再次操作 products.no_delete=当前产品已上架,无法删除,请下架后再删除 products.no_update=当前产品已上架,无法进行修改 products.detail.no_update=定价规则对应的产品已上架,无法进行修改 advertisement.time_error=投放时间错误,结束时间应大于开始时间 advertisement.name.is_exist=当前广告名称已存在,请重新命名 advertisement.no_delete=当前广告已经发布,无法删除,请结束发布后再删除 product_promotion.active.name.is_exist=当前优惠活动名称已存在,请修改 product_promotion.purchaseduration.is_exist=当前所选产品下{0}{1}购买时长的优惠活动已存在,请修改 invoice_title.not_exists=发票抬头不存在,请先创建发票抬头 org_invoice.purchase_record.update_num.not_match=当前勾选的购买记录中部分可能已开票,请查询后重新勾选提交开票 org_invoice.agree_file.null=确认开票发票附件不能为空,请上传后再提交 invoice_title.org.exists=组织下已存在发票抬头,请刷新后编辑抬头内容 invoice_title.taxpayerid.exists=统一社会信用代码已存在,请检查 products.not_nolist=当前产品未上架 org_product.purchase.lock=组织下存在购买中的产品操作,请稍后再试 invoice_title.enterprise.taxnumber.empty=企业统一信用代码不能为空 invoice.amount.zero=可开票金额为0,请检查购买记录 invoice.apply.uninvoiceable.exist=当前提交记录中存在不可开票记录,请刷新列表后重新选择提交 pay.channel_not_support=暂不支持的支付渠道,请使用其他支付渠道 pay.order_not_exist=支付订单不存在,支付编号[{0}],请重新发起支付 pay.order_channel_query_not_exist=如果您已确认扫码支付,请稍后刷新页面,支付平台可能存在延迟到账 pay.order_notify_data_parse_error=解析支付回调数据异常 pay.order_status_is_not_waiting=支付订单不处于待支付 pay.order_submit_channel_error=发起渠道支付异常,请联系客服 pay.notify_passback_tradetype_not_support_error=不支持的支付回调tradeType:[{0}],请检查支付渠道 product.no_exist=当前产品不存在 product.detail_no_exist=当前产品的规则不存在 product.detail_duration_exist=当前产品下已存在产品时长[{0}/{1}]的定价规则,请修改后重新操作 product.promotion_no_exist=当前优惠活动不存在 product.detail_duration_unit_not_support=不支持的时长单位,请检查该定价规则的时长单位 org.product_purchase_wait_pay_error=组织下存在当前产品的待支付记录,请确认或取消支付后再次发起软件购买 product.price_null_error=产品建议价格为空,请联系客服 org.product_purchase_not_exist_error=组织订购记录不存在,请检查数据 org.product_purchase_exist_error=组织[{0}]订购记录已存在,请勿重复定义订购机构 advertisement.no_exist=广告不存在 advertisement.status_endtime_expired=当前广告投放结束时间已超期,请重新发布选择投放时间或重新编辑投放时间 advertisement.image_empty_error=广告图片文件为空,请重新上传 advertisement.image_upload_fail=广告图片上传失败,请稍后再试 advertisement.update_status_error=当前广告已经发布,若要编辑请先结束发布 parser.no_exist=当前解析器不存在,请重新选择 parser.template_no_exist=当前解析器模板不存在,请重新选择 product_purchase.no_exist=当前购买记录不存在,请检查 product_purchase.endtime_before_delaytime_error=当前产品订购有效期{0}未超过当前日期,请调整订购时长 \ No newline at end of file diff --git a/cf-module-system/cf-module-system-biz/src/main/resources/message_errorcode_cht.properties b/cf-module-system/cf-module-system-biz/src/main/resources/message_errorcode_cht.properties new file mode 100644 index 000000000..72cbe711f --- /dev/null +++ b/cf-module-system/cf-module-system-biz/src/main/resources/message_errorcode_cht.properties @@ -0,0 +1 @@ +auth.login.bad_credentials=登入失敗,帳號或密碼不正確 auth.login.user_disabled=登入失敗,帳號已被停用 auth.login.captcha_code_error=驗證碼不正確,原因:{0} auth.login.third_not_bind=尚未綁定帳號,需要進行綁定 auth.mobile.not_exists=手機號碼不存在 auth.mobile.no_change=手機號碼未發生變更,無需修改 auth.manage_endpoint.login_permission_error=登入失敗,管理端帳號不存在 menu.name.duplicate=已存在相同名稱的選單 menu.parent.not_exists=父選單不存在 menu.parent.error=不能將自身設定為父選單 menu.not_exists=選單不存在 menu.exists_children=存在子選單,無法刪除 menu.parent.not_dir_or_menu=父選單的類型必須是目錄或選單 menu.operation_permission_error=管理端選單操作權限不足 menu.trans_error=選單翻譯異常,error_code:{0} role.not_exists=角色不存在 role.name.duplicate=已存在名稱為[{0}]的角色 role.code.duplicate=已存在編碼為[{0}]的角色 role.can_not_update_system_type=不能操作系統內建的角色 role.is_disable=名稱為[{0}]的角色已被停用 role.admin_code_error=編碼[{0}]不能使用 role.me_error=不可為自身分配角色 role.not_superadmin_no_organ_id_oper_error=非超級管理員不可分配權限 role.buildin.modify_permission_error=修改內建角色下選單權限的權限不足 role.self.modify_permission_error=無法修改自身角色的選單權限 role.self.modify_error=無法修改自身的角色 user.username.exists=手機號已經存在 user.mobile.exists=手機號已經存在 user.email.exists=郵箱已經存在 user.not_exists=用戶不存在 user.import.empty=導入用戶數據不能為空! user.password.failed=用戶密碼校驗失敗 user.is_disable=名字為[{0}]的用戶已被禁用 user.count.max=超過組織用戶配額({0}),創建用戶失敗! user.me.error=不允許操作用戶自身 user.password.length_at_least_8=密碼長度不少於8位,且包含大小寫字母、數字和特殊字符 user.username.multiple_error=存在[{0}]重複用戶,請聯繫系統管理員 user.operate_self_status_error=不允許操作用戶自身狀態 user.mobile_update_not_allow=該用戶已通過手機號認證,如需修改手機號請前往個人中心 dept.name.duplicate=已經存在該名字的部門 dept.parent.not_exists=父級部門不存在 dept.not_found=當前部門不存在 dept.exists_children=存在子部門,無法刪除 dept.parent.error=不能設置自己為父部門 dept.exists_user=部門中存在員工,無法刪除 dept.parent_is_child=不能設置自己的子部門為父部門 dept.user_oper_not_allow=不允許操作用戶自身部門 dept.parent_user_oper_not_allow=不允許操作用戶自身部門及其上級部門 dept.disable=部門({0})已被禁用 dept.not_allowed_login=部門({0})已被禁用,無法登入 dept.parent_disable=上級部門({0})已被禁用,請開啟後操作或選擇其他上級部門 dict_type.not_exists=當前字典類型不存在 dict_type.not_enable=字典類型處於關閉狀態,不允許新增或編輯 dict_type.name.duplicate=已經存在該名字的字典類型 dict_type.type.duplicate=已經存在該類型的字典類型 dict_type.has_children=無法刪除,該字典類型還有字典數據 dict_data.not_exists=當前字典數據不存在 dict_data.not_enable=字典數據({0})不處於開啟狀態,不允許選擇 dict_data.value.duplicate=已經存在該值的字典數據 dict_data.trans_error=字典數據標籤翻譯異常,error_code :{0} notice.not_found=當前通知公告不存在 notice.name_unique_error=公告標題已存在,請編輯後重試 notice.buildin.modify_permission_error=內置通知公告編輯權限不足 sms.channel.not_exists=短信渠道不存在 sms.template.not_exists=短信模板不存在 sms.template.code.duplicate=已經存在編碼為[{0}]的短信模板 sms.template.api_error=短信 API 模板調用失敗,原因是:{0} sms.template.api.audit_checking=短信 API 模版無法使用,原因:審批中 sms.template.api.audit_fail=短信 API 模版無法使用,原因:審批不通過,{0} sms.template.api.not_found=短信 API 模版無法使用,原因:模版不存在 sms.send.mobile.not_exists=手機號碼不存在 sms.send.mobile.template_param_miss=短信模板參數({0})缺失 sms.send.template.not_exists=短信模板不存在 sms.code.not_found=驗證碼不存在,請點擊獲取 sms.code.not_correct=驗證碼不正確 sms.code.send_too_fast=短信發送過於頻繁 sms.code.is_valid=驗證碼在有效期內,5 分鐘內請勿重複發送! organ.not_exists=組織不存在 organ.disable=[{0}]組織已被禁用 organ.expire=[{0}]組織已過期 organ.can_not_update_system=系統組織不能進行修改、刪除等操作! organ.name.duplicate=名字為[{0}]的組織已存在 organ.website.duplicate=域名為[{0}]的組織已存在 organ.data_code.not_exists=組織未配置資料源標識 organ.already_exists=該新增組織已授權機台數量無需重複新增! organ.user_oper.not_allow=不允許操作用戶自身組織 organ.contact_mobile.duplicate=手機號為[{0}]的組織已存在 organ.expiretime.product_id_lack=請選擇要購買的產品 notify.template.not.exists=站內信模版不存在 notify.template.code.duplicate=已經存在編碼為[{}]的站內信模板 notify.send.template.param.miss=站內信模板參數({})缺失 machine.not.exists=機台不存在 machine.template.not.exists=機台模板不存在 default.template.count=預設模板數量異常 the.current.machine.is.already.in.use=當前機台已使用,禁止刪除 machine.error=當前機台錯誤,請重新選擇機台 the.current.brand.of.the.machine.exists=當前機台配置的模板中,該品牌已存在,請重新輸入品牌名稱 the.model.of.the.machine.does.not.exist=該型號的機台模板不存在,請進行配置 the.current.brand=品牌ID錯誤,或品牌不存在 machine.num.error=當前組織該類型的機台創建已達到最大值,無法繼續創建 machine.name.error=當前機台名稱已存在,請重新輸入機台名稱 machinetemplate.name.error=當前機台模板的名稱已存在,請重新輸入機台模板名稱 labelingmachine.related.data.error=當前機台關聯的貼標機數據有誤,請在高級配置中重新配置貼標機或選擇其他模板 drillmachine.related.data.error=當前機台關聯的鑽孔機數據有誤,請在鑽孔模塊中重新配置鑽孔機或選擇其他模板 machine.data.error=當前組織尚未進行機台授權,請聯繫組織管理員或客服進行授權 machine.num.data.error=組織授權的機台數量不能超過127台 machine.used.already=當前機台在加工方案組中已使用,無法刪除 label.template.not.exists=標籤模板不存在 label.not.exists=標籤不存在 default.label.not.exists=該類型標籤的預設模板不存在 machine.use.label=當前標籤已有機台使用,無法刪除 default.not.deleted=預設標籤模板無法刪除 label.is.use.error=當前標籤在打包設定中已有使用者使用,無法刪除 data.source.not.exists=系統資料來源不存在 order.parts.import.list.is.empty=生產配件匯入資料不可為空 remain.plate.status.used=餘料板正在使用中,禁止修改 remain.plate.status.no.used=餘料板未使用 remain.plate.usr.type=餘料板使用類型為不可核銷類型 remain.plate.id.not.exists=未選中餘料板,請選擇餘料板 remain.plate.count.max=每次新增餘料板數量最大為 999 currently.no.configuration.available=當前沒有{0}配置信息,請前往設定配置 system.config.not_exists=系統配置不存在 system.config.type_not_support=不支援的系統配置類型 system.config.custom_plate_no.rule_save_format_error=自訂板編號配置:自訂板編號保存格式錯誤,請檢查配置規則 system.config.custom_plate_no.rule_reset_not_support=自訂板編號配置:該規則不支援手動復位/清零 system.config.custom_plate_no.rule_item_not_found=自訂板編號配置:找不到對應的規則項進行手動復位/清零 system.config.custom_plate_no.rule_order_reset_failed=自訂板編號配置:手動復位/清零生產單下序號失敗,請聯繫客服 custom.plate_no.rule.code_empty=規則編碼不能為空 custom.plate_no.rule.code_not_match=規則編碼[{0}]不合法,請檢查配置規則 custom.plate_no.rule.date_format_error=時間格式[{0}]不合法,請檢查配置規則 custom.plate_no.rule.custom_value_empty=自訂字元值不能為空,請檢查配置規則 custom.plate_no.rule.reset_mode_error=規則[{0}]復位/清零模式不合法,請檢查配置規則 custom.plate_no.rule.int_type_empty={0} 下的 {1} 不能為空,請檢查配置規則 custom.plate_no.rule.int_type_convert_error={0} 下的數值類型參數 {1}:{2} 轉換異常,請檢查配置規則 custom.plate_no.rule.bool_type_convert_error={0} 下的布林類型參數 {1}:{2} 轉換異常,請檢查配置規則 process.scheme.data_empty=加工方案組的:{0} 為空,無法保存,請進行配置 process.scheme.config.data_empty=加工方案組的:{0} 為空,請檢查配置信息 process.scheme.config.field_error=當前方案組的配置異常,請重新配置 process.scheme.config.in_use=當前方案組已在排單中使用,無法刪除 process.scheme.config.machine_label_empty=當前方案組對應解析器的機台標籤數據為空,請檢查機台標籤配置信息 config.data_error=當前系統配置的數據有誤,請重新嘗試排序 process.config.used_already=當前加工分線配置已在加工方案組中使用,無法刪除 optimization.config.used_already=當前數據處理配置已在加工方案組中使用,無法刪除 sealedge.config.item_empty=第 {0} 條配置中,有欄位值為空,請新增數據 sealedge.config.max_value_error=第 {0} 條配置中,{1} 要大於等於 {2},請修改數據 sealedge.config.data_error=當前封邊條配置有誤,請重新檢查後新增 sealedge.config.name_exists=當前配置的名稱已存在,請重新命名 sealedge.config.decimal_places_max_three=第 {0} 條配置中,小數位數最多為 3 位,請修改 sealedge.config.min_value_gt_zero=第 {0} 條配置中,寬最小值:{1} 要大於 0,請修改 sealedge.config.max_value_gt_zero=第 {0} 條配置中,寬最大值:{1} 要大於 0,請修改 sealedge.config.value_range_error=第 {0} 條配置中,寬最大值 要大於 寬最小值,請修改 token.app_type.exist=當前應用已存在token配置,無法繼續新增 token.config.not_exists=當前應用的token配置不存在 token.time.is_expires=當前token已過期,請重新配置或延長時間 token.app_type.no_update=應用名稱不允許更改 token.data.is_null=當前token的配置為空,無需刪除 token.expires_time.is_null=當前未選擇有效時間,請選擇後再新增 token.expires_time.data_error=當前選擇的有效時間已過期,請增加有效時間 token.insert.data_error=token新增失敗,請重新嘗試 invoice.no_exist=當前發票記錄有誤,請重新查看 invoicing.reject_reason=請填寫拒絕開票原因 purchase_record.no_exist=當前發票對應的購買記錄有誤,請退回組織後重新申請開票 invoice.is_fail=當前發票已開票,無法再次進行開票 products.is_exist=產品[{0}]已存在,請修改產品名稱後再次操作 products.no_delete=當前產品已上架,無法刪除,請下架後再刪除 products.no_update=當前產品已上架,無法進行修改 products.detail.no_update=定價規則對應的產品已上架,無法進行修改 advertisement.time_error=投放時間錯誤,結束時間應大於開始時間 advertisement.name.is_exist=當前廣告名稱已存在,請重新命名 advertisement.no_delete=當前廣告已經發布,無法刪除,請結束發布後再刪除 product_promotion.active.name.is_exist=當前優惠活動名稱已存在,請修改 product_promotion.purchaseduration.is_exist=當前所選產品下{0}{1}購買時長的優惠活動已存在,請修改 invoice_title.not_exists=發票抬頭不存在,請先創建發票抬頭 org_invoice.purchase_record.update_num.not_match=當前勾選的購買記錄中部分可能已開票,請查詢後重新勾選提交開票 org_invoice.agree_file.null=確認開票發票附件不能為空,請上傳後再提交 invoice_title.org.exists=組織下已存在發票抬頭,請刷新後編輯抬頭內容 invoice_title.taxpayerid.exists=統一社會信用代碼已存在,請檢查 products.not_nolist=當前產品未上架 org_product.purchase.lock=組織下存在購買中的產品操作,請稍後再試 invoice_title.enterprise.taxnumber.empty=企業統一信用代碼不能為空 invoice.amount.zero=可開票金額為0,請檢查購買記錄 invoice.apply.uninvoiceable.exist=當前提交記錄中存在不可開票記錄,請刷新列表後重新選擇提交 pay.channel_not_support=暫不支援的支付渠道,請使用其他支付渠道 pay.order_not_exist=支付訂單不存在,支付編號[{0}],請重新發起支付 pay.order_channel_query_not_exist=若您已確認掃碼支付,請稍後重新整理頁面,支付平台可能存在延遲入帳 pay.order_notify_data_parse_error=解析支付回調資料異常 pay.order_status_is_not_waiting=支付訂單不處於待支付狀態 pay.order_submit_channel_error=發起渠道支付異常,請聯繫客服 pay.notify_passback_tradetype_not_support_error=不支援的支付回調tradeType:[{0}],請檢查支付渠道 product.no_exist=當前產品不存在 product.detail_no_exist=當前產品的規則不存在 product.detail_duration_exist=當前產品下已存在產品時長[{0}/{1}]的定價規則,請修改後重新操作 product.promotion_no_exist=當前優惠活動不存在 product.detail_duration_unit_not_support=不支援的時長單位,請檢查該定價規則的時長單位 org.product_purchase_wait_pay_error=組織下存在當前產品的待支付紀錄,請確認或取消支付後再次發起軟體購買 product.price_null_error=產品建議價格為空,請聯繫客服 org.product_purchase_not_exist_error=組織訂購紀錄不存在,請檢查資料 org.product_purchase_exist_error=組織[{0}]訂購紀錄已存在,請勿重複定義訂購機構 advertisement.no_exist=廣告不存在 advertisement.status_endtime_expired=當前廣告投放結束時間已逾期,請重新發布選擇投放時間或重新編輯投放時間 advertisement.image_empty_error=廣告圖片檔案為空,請重新上傳 advertisement.image_upload_fail=廣告圖片上傳失敗,請稍後再試 advertisement.update_status_error=當前廣告已經發布,若要編輯請先結束發布 parser.no_exist=當前解析器不存在,請重新選擇 parser.template_no_exist=當前解析器模板不存在,請重新選擇 product_purchase.no_exist=當前購買記錄不存在,請檢查 product_purchase.endtime_before_delaytime_error=當前產品訂購有效期{0}未超過當前日期,請調整訂購時長 \ No newline at end of file diff --git a/cf-module-system/cf-module-system-biz/src/main/resources/message_errorcode_en.properties b/cf-module-system/cf-module-system-biz/src/main/resources/message_errorcode_en.properties new file mode 100644 index 000000000..72096b4f6 --- /dev/null +++ b/cf-module-system/cf-module-system-biz/src/main/resources/message_errorcode_en.properties @@ -0,0 +1 @@ +auth.login.bad_credentials=Login failed, incorrect account or password auth.login.user_disabled=Login failed, the account has been disabled auth.login.captcha_code_error=Incorrect verification code, reason: {0} auth.login.third_not_bind=No account is bound, binding is required auth.mobile.not_exists=Mobile number does not exist auth.mobile.no_change=Mobile number has not changed, no update needed auth.manage_endpoint.login_permission_error=Login failed, management account does not exist menu.name.duplicate=A menu with the same name already exists menu.parent.not_exists=Parent menu does not exist menu.parent.error=Cannot set the menu itself as its parent menu.not_exists=Menu does not exist menu.exists_children=Cannot delete because child menus exist menu.parent.not_dir_or_menu=The parent menu type must be directory or menu menu.operation_permission_error=Insufficient permissions for management menu operations menu.trans_error=Menu translation error, error_code: {0} role.not_exists=Role does not exist role.name.duplicate=A role named [{0}] already exists role.code.duplicate=A role with code [{0}] already exists role.can_not_update_system_type=Cannot operate on system-built-in roles role.is_disable=The role named [{0}] has been disabled role.admin_code_error=Code [{0}] cannot be used role.me_error=Cannot assign a role to yourself role.not_superadmin_no_organ_id_oper_error=Non-super admin is not allowed to assign permissions role.buildin.modify_permission_error=Insufficient permissions to modify built-in role menu permissions role.self.modify_permission_error=Cannot modify your own role menu permissions role.self.modify_error=Cannot modify your own role user.username.exists=The mobile number already exists user.mobile.exists=The mobile number already exists user.email.exists=The email address already exists user.not_exists=User does not exist user.import.empty=Imported user data cannot be empty! user.password.failed=User password verification failed user.is_disable=The user named [{0}] has been disabled user.count.max=Exceeded the organization user quota ({0}), failed to create user! user.me.error=Operation on the user itself is not allowed user.password.length_at_least_8=Password must be at least 8 characters long and contain uppercase letters, lowercase letters, numbers, and special characters user.username.multiple_error=Duplicate users named [{0}] exist, please contact the system administrator user.operate_self_status_error=Operation on the user's own status is not allowed user.mobile_update_not_allow=This user has been verified by mobile number. To change the mobile number, please go to the personal center dept.name.duplicate=The department name already exists dept.parent.not_exists=The parent department does not exist dept.not_found=The department does not exist dept.exists_children=There are sub-departments, deletion is not allowed dept.parent.error=Cannot set the department itself as its parent dept.exists_user=There are employees in the department, deletion is not allowed dept.parent_is_child=Cannot set a sub-department as the parent dept.user_oper_not_allow=Operation on the user's own department is not allowed dept.parent_user_oper_not_allow=Operation on the user's own department and its parent departments is not allowed dept.disable=The department ({0}) has been disabled dept.not_allowed_login=The department ({0}) has been disabled, login is not allowed dept.parent_disable=The parent department ({0}) has been disabled, please enable it first or choose another parent department dict_type.not_exists=The dictionary type does not exist dict_type.not_enable=The dictionary type is disabled, adding or editing is not allowed dict_type.name.duplicate=The dictionary type name already exists dict_type.type.duplicate=The dictionary type already exists dict_type.has_children=Cannot delete, the dictionary type still has dictionary data dict_data.not_exists=The dictionary data does not exist dict_data.not_enable=The dictionary data ({0}) is not enabled and cannot be selected dict_data.value.duplicate=The dictionary data value already exists dict_data.trans_error=Dictionary data label translation error, error_code :{0} notice.not_found=The notification announcement does not exist notice.name_unique_error=The announcement title already exists, please edit and try again notice.buildin.modify_permission_error=Insufficient permissions to modify built-in announcement sms.channel.not_exists=The SMS channel does not exist sms.template.not_exists=SMS template does not exist sms.template.code.duplicate=An SMS template with code [{0}] already exists sms.template.api_error=SMS API template call failed, reason: {0} sms.template.api.audit_checking=SMS API template cannot be used, reason: under review sms.template.api.audit_fail=SMS API template cannot be used, reason: review failed, {0} sms.template.api.not_found=SMS API template cannot be used, reason: template not found sms.send.mobile.not_exists=Mobile number does not exist sms.send.mobile.template_param_miss=SMS template parameter ({0}) is missing sms.send.template.not_exists=SMS template does not exist sms.code.not_found=Verification code does not exist, please click to obtain sms.code.not_correct=Incorrect verification code sms.code.send_too_fast=SMS sending is too frequent sms.code.is_valid=The verification code is still valid, please do not resend within 5 minutes organ.not_exists=Organization does not exist organ.disable=Organization [{0}] has been disabled organ.expire=Organization [{0}] has expired organ.can_not_update_system=System organization cannot be modified or deleted organ.name.duplicate=Organization with name [{0}] already exists organ.website.duplicate=Organization with domain [{0}] already exists organ.data_code.not_exists=Organization has not configured a data source identifier organ.already_exists=The newly added organization has already been authorized device quota, cannot add again organ.user_oper.not_allow=Not allowed to operate on the user's own organization organ.contact_mobile.duplicate=Organization with mobile number [{0}] already exists organ.expiretime.product_id_lack=Please select the product to purchase notify.template.not.exists=Notification template does not exist notify.template.code.duplicate=A notification template with code [{}] already exists notify.send.template.param.miss=Notification template parameter ({}) is missing machine.not.exists=Machine does not exist machine.template.not.exists=Machine template does not exist default.template.count=Default template count error the.current.machine.is.already.in.use=The current machine is in use and cannot be deleted machine.error=The current machine is incorrect, please select a machine again the.current.brand.of.the.machine.exists=The brand already exists in the templates configured for the current machine, please enter a different brand name the.model.of.the.machine.does.not.exist=The template for this machine model does not exist, please configure it the.current.brand=Brand ID error, or brand does not exist machine.num.error=The number of machines of this type in the organization has reached the maximum limit and cannot be created machine.name.error=The machine name already exists, please enter another machine name machinetemplate.name.error=The machine template name already exists, please enter another machine template name labelingmachine.related.data.error=The labeling machine data associated with the current machine is incorrect, please reconfigure it or select another template drillmachine.related.data.error=The drilling machine data associated with the current machine is incorrect, please reconfigure it or select another template machine.data.error=The organization has not authorized machines yet, please contact the organization administrator or customer service for authorization machine.num.data.error=The authorized number of machines cannot exceed 127 machine.used.already=The current machine is used in a processing solution group and cannot be deleted label.template.not.exists=Label template does not exist label.not.exists=Label does not exist default.label.not.exists=The default label template for this type does not exist machine.use.label=The current label is used by machines and cannot be deleted default.not.deleted=The default label template cannot be deleted label.is.use.error=The label is used in packaging settings by users and cannot be deleted data.source.not.exists=System data source does not exist order.parts.import.list.is.empty=The imported production part list cannot be empty remain.plate.status.used=The remaining plate is in use and cannot be modified remain.plate.status.no.used=The remaining plate is not in use remain.plate.usr.type=The remaining plate usage type is non-verifiable remain.plate.id.not.exists=No remaining plate selected, please select a remaining plate remain.plate.count.max=The maximum number of remaining plates that can be added at one time is 999 currently.no.configuration.available=There is no configuration information for {0}, please go to settings to configure system.config.not_exists=System configuration does not exist system.config.type_not_support=Unsupported system configuration type system.config.custom_plate_no.rule_save_format_error=Custom plate number configuration: invalid save format, please check the rule system.config.custom_plate_no.rule_reset_not_support=Custom plate number configuration: this rule does not support manual reset/clear system.config.custom_plate_no.rule_item_not_found=Custom plate number configuration: rule item not found for manual reset/clear system.config.custom_plate_no.rule_order_reset_failed=Custom plate number configuration: failed to reset/clear order sequence, please contact support custom.plate_no.rule.code_empty=Rule code cannot be empty custom.plate_no.rule.code_not_match=Rule code [{0}] is invalid, please check the configuration rule custom.plate_no.rule.date_format_error=Date format [{0}] is invalid, please check the configuration rule custom.plate_no.rule.custom_value_empty=Custom character value cannot be empty, please check the configuration rule custom.plate_no.rule.reset_mode_error=Reset/Clear mode for rule [{0}] is invalid, please check the configuration rule custom.plate_no.rule.int_type_empty=The field \"{1}\" under \"{0}\" cannot be empty, please check the configuration rule custom.plate_no.rule.int_type_convert_error=Value conversion error for numeric parameter {1}:{2} under \"{0}\", please check the configuration rule custom.plate_no.rule.bool_type_convert_error=Value conversion error for boolean parameter {1}:{2} under \"{0}\", please check the configuration rule process.scheme.data_empty=Field \"{0}\" in the process scheme group is empty and cannot be saved, please configure it process.scheme.config.data_empty=Field \"{0}\" in the process scheme group is empty, please check the configuration process.scheme.config.field_error=The current scheme group configuration is invalid, please reconfigure process.scheme.config.in_use=The current scheme group is in use in scheduling and cannot be deleted process.scheme.config.machine_label_empty=Machine label data for the scheme group's parser is empty, please check the machine label configuration config.data_error=Current system configuration data is incorrect, please try sorting again process.config.used_already=The current line configuration is already used in a process scheme group and cannot be deleted optimization.config.used_already=The current optimization configuration is already used in a process scheme group and cannot be deleted sealedge.config.item_empty=There are empty fields in configuration #{0}, please fill in the data sealedge.config.max_value_error=In configuration #{0}, the value of {1} must be greater than or equal to {2}, please modify sealedge.config.data_error=The current edge band configuration is incorrect, please re-check before adding sealedge.config.name_exists=Configuration name already exists, please rename sealedge.config.decimal_places_max_three=In configuration #{0}, decimal places must not exceed 3, please modify sealedge.config.min_value_gt_zero=In configuration #{0}, minimum width {1} must be greater than 0, please modify sealedge.config.max_value_gt_zero=In configuration #{0}, maximum width {1} must be greater than 0, please modify sealedge.config.value_range_error=In configuration #{0}, maximum width must be greater than minimum width, please modify token.app_type.exist=The current application already has a token configuration and cannot add a new one token.config.not_exists=The token configuration for the current application does not exist token.time.is_expires=The current token has expired. Please reconfigure or extend the validity period token.app_type.no_update=The application name cannot be modified token.data.is_null=The token configuration is empty and does not need to be deleted token.expires_time.is_null=No valid time was selected. Please select one before adding token.expires_time.data_error=The selected validity time has expired. Please extend the validity time token.insert.data_error=Failed to add token. Please try again invoice.no_exist=The invoice record is incorrect. Please check again. invoicing.reject_reason=Please provide the reason for rejecting the invoice. purchase_record.no_exist=The purchase record corresponding to the invoice is invalid. Please return it to the organization and reapply. invoice.is_fail=The invoice has already been issued and cannot be issued again. products.is_exist=Product [{0}] already exists. Please modify the product name and try again. products.no_delete=The product is currently listed and cannot be deleted. Please delist it first. products.no_update=The product is currently listed and cannot be modified. products.detail.no_update=The product corresponding to the pricing rule is listed and cannot be modified. advertisement.time_error=Invalid delivery time. The end time must be later than the start time. advertisement.name.is_exist=The advertisement name already exists. Please rename it. advertisement.no_delete=The advertisement has been published and cannot be deleted. End publication first. product_promotion.active.name.is_exist=The promotion name already exists. Please modify it. product_promotion.purchaseduration.is_exist=A promotion with purchase duration {0}{1} already exists under the selected product. Please modify. invoice_title.not_exists=The invoice title does not exist. Please create it first. org_invoice.purchase_record.update_num.not_match=Some selected purchase records may have already been invoiced. Please reselect and submit. org_invoice.agree_file.null=The invoice confirmation file cannot be empty. Please upload it. invoice_title.org.exists=The organization already has an invoice title. Please refresh and edit it. invoice_title.taxpayerid.exists=The taxpayer identification number already exists. Please check. products.not_nolist=The product is not listed. org_product.purchase.lock=There are ongoing product purchase operations under the organization. Please try again later. invoice_title.enterprise.taxnumber.empty=The enterprise tax number cannot be empty. invoice.amount.zero=The invoiceable amount is 0. Please check the purchase record. invoice.apply.uninvoiceable.exist=There are records that cannot be invoiced. Please refresh and select again. pay.channel_not_support=Unsupported payment channel, please use another one pay.order_not_exist=Payment order does not exist, order number [{0}], please initiate payment again pay.order_channel_query_not_exist=If you have confirmed the QR code payment, please refresh the page later. The payment platform may experience delays pay.order_notify_data_parse_error=Failed to parse payment notification data pay.order_status_is_not_waiting=The payment order is not in a waiting state pay.order_submit_channel_error=Failed to initiate channel payment, please contact customer service pay.notify_passback_tradetype_not_support_error=Unsupported payment callback tradeType:[{0}], please check the payment channel product.no_exist=The product does not exist product.detail_no_exist=The product's pricing rule does not exist product.detail_duration_exist=A pricing rule for product duration [{0}/{1}] already exists, please modify and try again product.promotion_no_exist=The promotion does not exist product.detail_duration_unit_not_support=Unsupported duration unit, please check the pricing rule's duration unit org.product_purchase_wait_pay_error=There are pending payment records for this product under the organization. Please confirm or cancel payment before purchasing again product.price_null_error=Suggested product price is empty, please contact customer service org.product_purchase_not_exist_error=The organization's purchase record does not exist, please check the data org.product_purchase_exist_error=Purchase record for organization [{0}] already exists, please do not duplicate the definition advertisement.no_exist=The advertisement does not exist advertisement.status_endtime_expired=The advertisement's end time has expired. Please republish or edit the delivery time advertisement.image_empty_error=The advertisement image file is empty, please upload again advertisement.image_upload_fail=Failed to upload the advertisement image, please try again later advertisement.update_status_error=The advertisement has already been published. Please end the publication before editing parser.no_exist=The parser does not exist, please reselect parser.template_no_exist=The parser template does not exist, please reselect product_purchase.no_exist=The purchase record does not exist, please check product_purchase.endtime_before_delaytime_error=The product subscription validity period {0} has not exceeded the current date, please adjust the subscription duration \ No newline at end of file