From d3e13a013579a41aff243af671b474ec8273ce36 Mon Sep 17 00:00:00 2001 From: liuzhaotian Date: Wed, 26 Feb 2025 09:17:37 +0800 Subject: [PATCH] =?UTF-8?q?=E7=B3=BB=E7=BB=9F=E9=85=8D=E7=BD=AE=E5=8E=BB?= =?UTF-8?q?=E9=99=A4=E5=A4=9A=E7=A7=8D=E9=A2=9C=E8=89=B2=E6=8E=92=E5=8D=95?= =?UTF-8?q?=EF=BC=8C=E7=A6=85=E9=81=931281=20=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../system/enums/ErrorCodeConstants.java | 14 ++++++++++ .../api/systemconfig/SystemConfigApiImpl.java | 7 ++--- .../system/dal/mysql/organ/OrganMapper.java | 12 +++++++++ .../enums/config/SystemConfigTypeEnum.java | 10 +++---- .../service/organ/OrganServiceImpl.java | 18 +++++++++++++ .../factory/SystemConfigServiceFactory.java | 4 +-- .../DefaultSystemConfigServiceHandler.java | 26 +++++++++---------- .../resources/mapper/organ/OrganMapper.xml | 16 ++++++++++++ 8 files changed, 84 insertions(+), 23 deletions(-) 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 db833d0cb..792662384 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 @@ -137,6 +137,7 @@ public class ErrorCodeConstants { 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, "手机号为【{}】的组织已存在"); // ========== 组织套餐 1-002-016-000 ========== public static final ErrorCode TENANT_PACKAGE_NOT_EXISTS = new ErrorCode(1_002_016_000, "组织套餐不存在"); @@ -378,4 +379,17 @@ public class ErrorCodeConstants { 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, "当前系统配置的数据有误,请重新尝试排序"); + + + + //=========== 系统配置 1-002-041-000 ============ + public static final ErrorCode TOKEN_APP_TYPE_EXIST = new ErrorCode(1_002_041_001, "当前应用以存在token配置,无法继续新增"); + public static final ErrorCode TOKEN_CONFIG_NOT_EXISTS = new ErrorCode(1_002_041_002, "当前应用的token配置不存在"); + public static final ErrorCode TOKEN_TIME_IS_EXPIRES = new ErrorCode(1_002_041_003, "当前token已过期,请重新配置或延长时间"); + public static final ErrorCode TOKEN_DATA_ERROR = new ErrorCode(1_002_041_004, "token解析失败,请重新配置token"); + public static final ErrorCode TOKEN_APP_TYPE_ERROR = new ErrorCode(1_002_041_005, "token解析失败,当前token和应用不匹配,请重新配置"); + public static final ErrorCode TOKEN_APP_TYPE_NO_UPDATE = new ErrorCode(1_002_041_006, "应用名称不允许更改"); + public static final ErrorCode TOKEN_DATA_IS_NULL = new ErrorCode(1_002_041_007, "当前token的配置为空,无需删除"); + public static final ErrorCode TOKEN_EXPIRES_TIME_IS_NULL = new ErrorCode(1_002_041_008, "当前未选择有效时间,请选择再进行新增"); + public static final ErrorCode TOKEN_EXPIRES_TIME_DATA_ERROR = new ErrorCode(1_002_041_009, "当前选择的有效时间已过期,请增加有效时间"); } 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 4e4283be8..d2a20b2ac 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 @@ -268,10 +268,11 @@ public class SystemConfigApiImpl implements SystemConfigApi { @Override public CommonResult getMultiColorConfigStatus() { - List systemConfigDOS = systemConfigMapper.selectSystemConfigList(SystemConfigTypeEnum.MULTI_COLOR_ORDER_PLAN.getType(), CommonStatusEnum.ENABLE.getStatus()); - - return success(CollUtil.isNotEmpty(systemConfigDOS)); +// List systemConfigDOS = systemConfigMapper.selectSystemConfigList(SystemConfigTypeEnum.MULTI_COLOR_ORDER_PLAN.getType(), CommonStatusEnum.ENABLE.getStatus()); +// +// return success(CollUtil.isNotEmpty(systemConfigDOS)); + return success(Boolean.TRUE); } diff --git a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/dal/mysql/organ/OrganMapper.java b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/dal/mysql/organ/OrganMapper.java index 5296cce2c..bf889bf48 100644 --- a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/dal/mysql/organ/OrganMapper.java +++ b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/dal/mysql/organ/OrganMapper.java @@ -50,6 +50,8 @@ public interface OrganMapper extends BaseMapperX { return selectOne(OrganizationDO::getWebsite, website); } + List selectByContactMobile(@Param("contactMobile") String contactMobile,@Param("organId") Long organId); + default Long selectCountByPackageId(Long packageId) { return selectCount(OrganizationDO::getPackageId, packageId); } @@ -119,4 +121,14 @@ public interface OrganMapper extends BaseMapperX { .select(OrganizationDO::getId)); } + + + default OrganizationDO selectByOrganIdAndMobile(Long organId,String mobile) { + return selectOne(new LambdaQueryWrapperX() + .eqIfPresent(OrganizationDO::getDeleted,false) + .eq(OrganizationDO::getId,organId) + .eq(OrganizationDO::getContactMobile,mobile)); + } + + } diff --git a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/enums/config/SystemConfigTypeEnum.java b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/enums/config/SystemConfigTypeEnum.java index 652c8b919..65851a064 100644 --- a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/enums/config/SystemConfigTypeEnum.java +++ b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/enums/config/SystemConfigTypeEnum.java @@ -41,12 +41,12 @@ public enum SystemConfigTypeEnum { /** * 加工方案 */ - PROCESS_SCHEME(6, "加工方案组"), + PROCESS_SCHEME(6, "加工方案组"); - /** - * 支持多种颜色排单 - */ - MULTI_COLOR_ORDER_PLAN(7, "支持多种颜色排单"); +// /** +// * 支持多种颜色排单 +// */ +// MULTI_COLOR_ORDER_PLAN(7, "支持多种颜色排单"); /** 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 5b7ecab86..748d02ee4 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 @@ -148,6 +148,8 @@ public class OrganServiceImpl implements OrganService { validTenantNameDuplicate(createReqVO.getName(), null); // 校验组织域名是否重复 validTenantWebsiteDuplicate(createReqVO.getWebsite(), null); + // 校验组织手机号是否重复 + validContactMobileDuplicate(createReqVO.getContactMobile(),null); // 校验套餐被禁用 TenantPackageDO tenantPackage = tenantPackageService.validTenantPackage(createReqVO.getPackageId()); @@ -221,6 +223,8 @@ public class OrganServiceImpl implements OrganService { validTenantNameDuplicate(updateReqVO.getName(), organId); // 校验组织域名是否重复 validTenantWebsiteDuplicate(updateReqVO.getWebsite(), organId); + // 校验组织手机号是否重复 + validContactMobileDuplicate(updateReqVO.getContactMobile(),organId); // 校验套餐被禁用 TenantPackageDO tenantPackage = tenantPackageService.validTenantPackage(updateReqVO.getPackageId()); if(!Objects.equals(tenant.getName(), updateReqVO.getName())) { @@ -275,6 +279,20 @@ public class OrganServiceImpl implements OrganService { } } + + private void validContactMobileDuplicate(String contactMobile,Long organId) { + + List organizationDOS = organMapper.selectByContactMobile(contactMobile,organId); + + + if(CollUtil.isNotEmpty(organizationDOS)){ + throw exception(ORGAN_CONTACTMOBILE_DUPLICATE,contactMobile); + } + } + + + + @Override @DSTransactional public void updateOrganRoleMenu(Long organId, Set menuIds) { diff --git a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/systemconfig/factory/SystemConfigServiceFactory.java b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/systemconfig/factory/SystemConfigServiceFactory.java index f68b2b293..89653da36 100644 --- a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/systemconfig/factory/SystemConfigServiceFactory.java +++ b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/systemconfig/factory/SystemConfigServiceFactory.java @@ -57,8 +57,8 @@ public class SystemConfigServiceFactory { case PROCESS_SCHEME: return applicationContext.getBean(ProcessSchemeServiceHandler.class); // 多种颜色排单 - case MULTI_COLOR_ORDER_PLAN: - return applicationContext.getBean(MultiColorOrderPlanServiceHandler.class); +// case MULTI_COLOR_ORDER_PLAN: +// return applicationContext.getBean(MultiColorOrderPlanServiceHandler.class); default: throw new ServiceException(ErrorCodeConstants.SYSTEM_CONFIG_TYPE_NOT_SUPPORT); diff --git a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/systemconfig/factory/service/impl/DefaultSystemConfigServiceHandler.java b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/systemconfig/factory/service/impl/DefaultSystemConfigServiceHandler.java index 1abd0aede..91a99f0e4 100644 --- a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/systemconfig/factory/service/impl/DefaultSystemConfigServiceHandler.java +++ b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/systemconfig/factory/service/impl/DefaultSystemConfigServiceHandler.java @@ -72,19 +72,19 @@ public class DefaultSystemConfigServiceHandler extends AbstractSystemConfigServi continue; } - // 支持多种颜色排单 - if(configTypeEnum.getType().equals(SystemConfigTypeEnum.MULTI_COLOR_ORDER_PLAN.getType())){ - SystemConfigDO systemConfigDO = SystemConfigDO - .builder() - .id(null) - .name(configTypeEnum.getName()) - .type(configTypeEnum.getType()) - .status(CommonStatusEnum.DISABLE.getStatus()) - .build(); - systemConfigMapper.insert(systemConfigDO); - resultList.add(systemConfigDO); - continue; - } +// // 支持多种颜色排单 +// if(configTypeEnum.getType().equals(SystemConfigTypeEnum.MULTI_COLOR_ORDER_PLAN.getType())){ +// SystemConfigDO systemConfigDO = SystemConfigDO +// .builder() +// .id(null) +// .name(configTypeEnum.getName()) +// .type(configTypeEnum.getType()) +// .status(CommonStatusEnum.DISABLE.getStatus()) +// .build(); +// systemConfigMapper.insert(systemConfigDO); +// resultList.add(systemConfigDO); +// continue; +// } resultList.add(initConfig); } else { diff --git a/cf-module-system/cf-module-system-biz/src/main/resources/mapper/organ/OrganMapper.xml b/cf-module-system/cf-module-system-biz/src/main/resources/mapper/organ/OrganMapper.xml index f52671131..195ee62ae 100644 --- a/cf-module-system/cf-module-system-biz/src/main/resources/mapper/organ/OrganMapper.xml +++ b/cf-module-system/cf-module-system-biz/src/main/resources/mapper/organ/OrganMapper.xml @@ -78,4 +78,20 @@ group by date; + + \ No newline at end of file