diff --git a/blade-service/blade-file/src/main/resources/application-dev.yml b/blade-service/blade-file/src/main/resources/application-dev.yml new file mode 100644 index 0000000..ee83599 --- /dev/null +++ b/blade-service/blade-file/src/main/resources/application-dev.yml @@ -0,0 +1,6 @@ +# 数据源配置 +spring: + datasource: + url: ${blade.datasource.dev.url} + username: ${blade.datasource.dev.username} + password: ${blade.datasource.dev.password} diff --git a/blade-service/blade-file/src/main/resources/application-prod.yml b/blade-service/blade-file/src/main/resources/application-prod.yml new file mode 100644 index 0000000..d6f9af7 --- /dev/null +++ b/blade-service/blade-file/src/main/resources/application-prod.yml @@ -0,0 +1,6 @@ +# 数据源配置 +spring: + datasource: + url: ${blade.datasource.prod.url} + username: ${blade.datasource.prod.username} + password: ${blade.datasource.prod.password} diff --git a/blade-service/blade-file/src/main/resources/application-test.yml b/blade-service/blade-file/src/main/resources/application-test.yml new file mode 100644 index 0000000..8f283d3 --- /dev/null +++ b/blade-service/blade-file/src/main/resources/application-test.yml @@ -0,0 +1,6 @@ +# 数据源配置 +spring: + datasource: + url: ${blade.datasource.test.url} + username: ${blade.datasource.test.username} + password: ${blade.datasource.test.password} diff --git a/blade-service/blade-file/src/main/resources/bootstrap.yml b/blade-service/blade-file/src/main/resources/bootstrap.yml index f2240b3..feb3dfb 100644 --- a/blade-service/blade-file/src/main/resources/bootstrap.yml +++ b/blade-service/blade-file/src/main/resources/bootstrap.yml @@ -1,32 +1,21 @@ server: port: 8107 -#数据源配置 spring: - datasource: - url: ${blade.datasource.dev.url} - username: ${blade.datasource.dev.username} - password: ${blade.datasource.dev.password} + application: + name: blade-file cloud: nacos: + discovery: + namespace: ${spring.profiles.active} config: + file-extension: yaml + namespace: ${spring.profiles.active} shared-configs: - - data-id: third-party-api.yaml + - data-id: blade.yaml + refresh: true + - data-id: blade-${spring.profiles.active}.yaml refresh: true - -#第三方接口本地默认配置,Nacos third-party-api.yaml 可覆盖 -thirdParty: - ocr: - baseUrl: ${OCR_BASE_URL:http://127.0.0.1:8080} - baseOtherUrl: ${OCR_BASE_OTHER_URL:http://127.0.0.1:8080} - wps: - baseUrl: ${WPS_BASE_URL:http://127.0.0.1:8080} - oa: - baseUrl: ${OA_BASE_URL:http://127.0.0.1:8080} - track: - baseUrl: ${TRACK_BASE_URL:http://127.0.0.1:8080} - mk: - baseUrl: ${MK_BASE_URL:http://127.0.0.1:8080} #spring: # application: diff --git a/blade-service/blade-openapi/src/main/resources/application-dev.yml b/blade-service/blade-openapi/src/main/resources/application-dev.yml new file mode 100644 index 0000000..ee83599 --- /dev/null +++ b/blade-service/blade-openapi/src/main/resources/application-dev.yml @@ -0,0 +1,6 @@ +# 数据源配置 +spring: + datasource: + url: ${blade.datasource.dev.url} + username: ${blade.datasource.dev.username} + password: ${blade.datasource.dev.password} diff --git a/blade-service/blade-openapi/src/main/resources/application-prod.yml b/blade-service/blade-openapi/src/main/resources/application-prod.yml new file mode 100644 index 0000000..d6f9af7 --- /dev/null +++ b/blade-service/blade-openapi/src/main/resources/application-prod.yml @@ -0,0 +1,6 @@ +# 数据源配置 +spring: + datasource: + url: ${blade.datasource.prod.url} + username: ${blade.datasource.prod.username} + password: ${blade.datasource.prod.password} diff --git a/blade-service/blade-openapi/src/main/resources/application-test.yml b/blade-service/blade-openapi/src/main/resources/application-test.yml new file mode 100644 index 0000000..8f283d3 --- /dev/null +++ b/blade-service/blade-openapi/src/main/resources/application-test.yml @@ -0,0 +1,6 @@ +# 数据源配置 +spring: + datasource: + url: ${blade.datasource.test.url} + username: ${blade.datasource.test.username} + password: ${blade.datasource.test.password} diff --git a/blade-service/blade-openapi/src/main/resources/bootstrap.yml b/blade-service/blade-openapi/src/main/resources/bootstrap.yml index e97a20a..4c5d14f 100644 --- a/blade-service/blade-openapi/src/main/resources/bootstrap.yml +++ b/blade-service/blade-openapi/src/main/resources/bootstrap.yml @@ -1,32 +1,21 @@ server: port: 8108 -#数据源配置 spring: - datasource: - url: ${blade.datasource.dev.url} - username: ${blade.datasource.dev.username} - password: ${blade.datasource.dev.password} + application: + name: blade-openapi cloud: nacos: + discovery: + namespace: ${spring.profiles.active} config: + file-extension: yaml + namespace: ${spring.profiles.active} shared-configs: - - data-id: third-party-api.yaml + - data-id: blade.yaml + refresh: true + - data-id: blade-${spring.profiles.active}.yaml refresh: true - -#第三方接口本地默认配置,Nacos third-party-api.yaml 可覆盖 -thirdParty: - ocr: - baseUrl: ${OCR_BASE_URL:http://127.0.0.1:8080} - baseOtherUrl: ${OCR_BASE_OTHER_URL:http://127.0.0.1:8080} - wps: - baseUrl: ${WPS_BASE_URL:http://127.0.0.1:8080} - oa: - baseUrl: ${OA_BASE_URL:http://127.0.0.1:8080} - track: - baseUrl: ${TRACK_BASE_URL:http://127.0.0.1:8080} - mk: - baseUrl: ${MK_BASE_URL:http://127.0.0.1:8080} #spring: # application: diff --git a/blade-service/blade-transport/src/main/java/org/springblade/transport/service/impl/CustomerArchiveServiceImpl.java b/blade-service/blade-transport/src/main/java/org/springblade/transport/service/impl/CustomerArchiveServiceImpl.java index 2df82b0..752b4f2 100644 --- a/blade-service/blade-transport/src/main/java/org/springblade/transport/service/impl/CustomerArchiveServiceImpl.java +++ b/blade-service/blade-transport/src/main/java/org/springblade/transport/service/impl/CustomerArchiveServiceImpl.java @@ -23,6 +23,7 @@ package org.springblade.transport.service.impl; import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.toolkit.IdWorker; import com.baomidou.mybatisplus.core.toolkit.Wrappers; @@ -379,17 +380,25 @@ public class CustomerArchiveServiceImpl extends BaseServiceImpllambdaQuery() + LambdaQueryWrapper unifiedCreditCodeQuery = Wrappers.lambdaQuery() .eq(CustomerArchive::getUnifiedCreditCode, customer.getUnifiedCreditCode()) - .eq(CustomerArchive::getIsDeleted, 0) - .ne(Func.isNotEmpty(customer.getId()), CustomerArchive::getId, customer.getId())) > 0L) { + .eq(CustomerArchive::getIsDeleted, 0); + if (customer.getId() != null) { + unifiedCreditCodeQuery.ne(CustomerArchive::getId, customer.getId()); + } + if (count(unifiedCreditCodeQuery) > 0L) { throw new ServiceException("统一社会信用代码已存在"); } - if (Func.isNotEmpty(customer.getCustomerCode()) && count(Wrappers.lambdaQuery() - .eq(CustomerArchive::getCustomerCode, customer.getCustomerCode()) - .eq(CustomerArchive::getIsDeleted, 0) - .ne(Func.isNotEmpty(customer.getId()), CustomerArchive::getId, customer.getId())) > 0L) { - throw new ServiceException("客商编号已存在"); + if (Func.isNotEmpty(customer.getCustomerCode())) { + LambdaQueryWrapper customerCodeQuery = Wrappers.lambdaQuery() + .eq(CustomerArchive::getCustomerCode, customer.getCustomerCode()) + .eq(CustomerArchive::getIsDeleted, 0); + if (customer.getId() != null) { + customerCodeQuery.ne(CustomerArchive::getId, customer.getId()); + } + if (count(customerCodeQuery) > 0L) { + throw new ServiceException("客商编号已存在"); + } } } @@ -718,7 +727,12 @@ public class CustomerArchiveServiceImpl extends BaseServiceImpl { + List userIds = new ArrayList<>(baseMapper.selectIncludeNewCustomerUserIds(customer.getTenantId())); + Long currentUserId = AuthUtil.getUserId(); + if (Func.isNotEmpty(currentUserId) && !userIds.contains(currentUserId)) { + userIds.add(currentUserId); + } + userIds.forEach(userId -> { UserCustomerScope scope = new UserCustomerScope(); scope.setUserId(userId); scope.setCustomerId(customer.getId());