|
@@ -1,6 +1,8 @@
|
|
|
package com.sckw.system.dubbo;
|
|
package com.sckw.system.dubbo;
|
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
|
|
+import com.sckw.core.common.enums.enums.ErrorCodeEnum;
|
|
|
|
|
+import com.sckw.core.exception.BusinessPlatfromException;
|
|
|
import com.sckw.core.model.constant.Global;
|
|
import com.sckw.core.model.constant.Global;
|
|
|
import com.sckw.core.model.constant.NumberConstant;
|
|
import com.sckw.core.model.constant.NumberConstant;
|
|
|
import com.sckw.core.utils.BeanUtils;
|
|
import com.sckw.core.utils.BeanUtils;
|
|
@@ -21,6 +23,7 @@ import com.sckw.system.service.KwsRoleService;
|
|
|
import com.sckw.system.service.KwsSpecialService;
|
|
import com.sckw.system.service.KwsSpecialService;
|
|
|
import com.sckw.system.service.KwsUserService;
|
|
import com.sckw.system.service.KwsUserService;
|
|
|
import jakarta.annotation.Resource;
|
|
import jakarta.annotation.Resource;
|
|
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
import java.util.*;
|
|
import java.util.*;
|
|
@@ -32,6 +35,7 @@ import java.util.stream.Collectors;
|
|
|
* @date 2023/7/7
|
|
* @date 2023/7/7
|
|
|
*/
|
|
*/
|
|
|
@Service
|
|
@Service
|
|
|
|
|
+@Slf4j
|
|
|
public class RemoteBaseService {
|
|
public class RemoteBaseService {
|
|
|
|
|
|
|
|
@Resource
|
|
@Resource
|
|
@@ -347,8 +351,14 @@ public class RemoteBaseService {
|
|
|
* @return 企业信息
|
|
* @return 企业信息
|
|
|
*/
|
|
*/
|
|
|
public KwsEnterpriseResDto findEnterpriseByNameAndType(String enterpriseName, Integer entType) {
|
|
public KwsEnterpriseResDto findEnterpriseByNameAndType(String enterpriseName, Integer entType) {
|
|
|
- KwsEnterprise kwsEnterprise = kwsEnterpriseDao.findEnterpriseByNameAndType(enterpriseName, entType);
|
|
|
|
|
|
|
+ if (Objects.isNull(enterpriseName) || enterpriseName.trim().isEmpty() || Objects.isNull(entType)) {
|
|
|
|
|
+ log.info("根据企业名称和企业类型精确查询企业参数错误,enterpriseName={}, entType={}", enterpriseName, entType);
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
|
|
+ List<KwsEnterprise> enterpriseList = kwsEnterpriseDao.findEnterpriseByNameAndType(enterpriseName, entType);
|
|
|
|
|
+ KwsEnterprise kwsEnterprise = resolveUniqueEnterpriseByNameAndType(enterpriseList, enterpriseName, entType);
|
|
|
if (Objects.isNull(kwsEnterprise)) {
|
|
if (Objects.isNull(kwsEnterprise)) {
|
|
|
|
|
+ log.info("根据企业名称和企业类型精确查询企业结果为空,enterpriseName={}, entType={}", enterpriseName, entType);
|
|
|
return null;
|
|
return null;
|
|
|
}
|
|
}
|
|
|
KwsEnterpriseResDto kwsEnterpriseResDto = new KwsEnterpriseResDto();
|
|
KwsEnterpriseResDto kwsEnterpriseResDto = new KwsEnterpriseResDto();
|
|
@@ -356,6 +366,26 @@ public class RemoteBaseService {
|
|
|
return kwsEnterpriseResDto;
|
|
return kwsEnterpriseResDto;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 校验企业名称和企业类型共同过滤后的企业唯一性。
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param enterpriseList 企业列表
|
|
|
|
|
+ * @param enterpriseName 企业名称
|
|
|
|
|
+ * @param entType 企业类型
|
|
|
|
|
+ * @return 唯一企业
|
|
|
|
|
+ */
|
|
|
|
|
+ static KwsEnterprise resolveUniqueEnterpriseByNameAndType(List<KwsEnterprise> enterpriseList, String enterpriseName, Integer entType) {
|
|
|
|
|
+ if (CollectionUtils.isEmpty(enterpriseList)) {
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (enterpriseList.size() > NumberConstant.ONE) {
|
|
|
|
|
+ throw new BusinessPlatfromException(
|
|
|
|
|
+ ErrorCodeEnum.PARAM_ERROR,
|
|
|
|
|
+ "企业名称和企业类型匹配到多条企业数据,请检查企业配置:" + enterpriseName + ",类型:" + entType);
|
|
|
|
|
+ }
|
|
|
|
|
+ return enterpriseList.get(NumberConstant.ZERO);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
public PageDataResult<KwsEnterpriseResDto> pageEnt(int pageNum, int pageSize, Long entId) {
|
|
public PageDataResult<KwsEnterpriseResDto> pageEnt(int pageNum, int pageSize, Long entId) {
|
|
|
IPage<KwsEnterprise> kwsEnterprisePage = kwsEnterpriseReposiory.pageEnt(pageNum, pageSize, entId);
|
|
IPage<KwsEnterprise> kwsEnterprisePage = kwsEnterpriseReposiory.pageEnt(pageNum, pageSize, entId);
|
|
|
List<KwsEnterprise> records = kwsEnterprisePage.getRecords();
|
|
List<KwsEnterprise> records = kwsEnterprisePage.getRecords();
|