|
@@ -1,3 +1,4 @@
|
|
|
|
|
+
|
|
|
package com.sckw.system.service;
|
|
package com.sckw.system.service;
|
|
|
|
|
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
import cn.hutool.core.collection.CollUtil;
|
|
@@ -1558,36 +1559,37 @@ public class KwsEnterpriseService {
|
|
|
|
|
|
|
|
@NotNull
|
|
@NotNull
|
|
|
private EntInfoResp getInfoResp(EntInfoReq req) {
|
|
private EntInfoResp getInfoResp(EntInfoReq req) {
|
|
|
|
|
+ EntInfoResp entInfoResp = buildEntInfoResp(req);
|
|
|
List<KwsEntType> kwsEntTypes = kwsEntTypeRepository.queryByType(req.getEntType());
|
|
List<KwsEntType> kwsEntTypes = kwsEntTypeRepository.queryByType(req.getEntType());
|
|
|
if (CollectionUtils.isEmpty(kwsEntTypes)) {
|
|
if (CollectionUtils.isEmpty(kwsEntTypes)) {
|
|
|
- return new EntInfoResp();
|
|
|
|
|
|
|
+ return entInfoResp;
|
|
|
}
|
|
}
|
|
|
Set<Long> entIds = kwsEntTypes.stream().map(KwsEntType::getEntId).collect(Collectors.toSet());
|
|
Set<Long> entIds = kwsEntTypes.stream().map(KwsEntType::getEntId).collect(Collectors.toSet());
|
|
|
//根据企业id查询企业信息
|
|
//根据企业id查询企业信息
|
|
|
List<KwsEnterprise> kwsEnterprises = kwsEnterpriseRepository.queryByEntIds(entIds, req.getEntName());
|
|
List<KwsEnterprise> kwsEnterprises = kwsEnterpriseRepository.queryByEntIds(entIds, req.getEntName());
|
|
|
if (CollectionUtils.isEmpty(kwsEnterprises)) {
|
|
if (CollectionUtils.isEmpty(kwsEnterprises)) {
|
|
|
- return new EntInfoResp();
|
|
|
|
|
|
|
+ return entInfoResp;
|
|
|
}
|
|
}
|
|
|
//组装返回对象
|
|
//组装返回对象
|
|
|
List<EntInfoResp.EntInfo> entInfos = kwsEnterprises.stream().map(k -> {
|
|
List<EntInfoResp.EntInfo> entInfos = kwsEnterprises.stream().map(k -> {
|
|
|
- EntInfoResp.EntInfo entInfoResp = new EntInfoResp.EntInfo();
|
|
|
|
|
- entInfoResp.setEntId(String.valueOf(k.getId()));
|
|
|
|
|
- entInfoResp.setEntName(k.getFirmName());
|
|
|
|
|
- return entInfoResp;
|
|
|
|
|
|
|
+ EntInfoResp.EntInfo info = new EntInfoResp.EntInfo();
|
|
|
|
|
+ info.setEntId(String.valueOf(k.getId()));
|
|
|
|
|
+ info.setEntName(k.getFirmName());
|
|
|
|
|
+ return info;
|
|
|
}).collect(Collectors.toList());
|
|
}).collect(Collectors.toList());
|
|
|
- EntInfoResp entInfoResp = new EntInfoResp();
|
|
|
|
|
entInfoResp.setEntInfos(entInfos);
|
|
entInfoResp.setEntInfos(entInfos);
|
|
|
return entInfoResp;
|
|
return entInfoResp;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@NotNull
|
|
@NotNull
|
|
|
private EntInfoResp getEntInfoResp(EntInfoReq req) {
|
|
private EntInfoResp getEntInfoResp(EntInfoReq req) {
|
|
|
|
|
+ EntInfoResp entInfoResp = buildEntInfoResp(req);
|
|
|
if (org.apache.commons.lang3.StringUtils.isBlank(req.getEntId())) {
|
|
if (org.apache.commons.lang3.StringUtils.isBlank(req.getEntId())) {
|
|
|
throw new BusinessException("企业id不能为空");
|
|
throw new BusinessException("企业id不能为空");
|
|
|
}
|
|
}
|
|
|
List<KwsEnterprise> kwsEnterprises = kwsEnterpriseRepository.queryByEntIdAndName(req.getEntId(), req.getEntName());
|
|
List<KwsEnterprise> kwsEnterprises = kwsEnterpriseRepository.queryByEntIdAndName(req.getEntId(), req.getEntName());
|
|
|
if (CollectionUtils.isEmpty(kwsEnterprises)) {
|
|
if (CollectionUtils.isEmpty(kwsEnterprises)) {
|
|
|
- return new EntInfoResp();
|
|
|
|
|
|
|
+ return entInfoResp;
|
|
|
}
|
|
}
|
|
|
Set<Long> entIds = kwsEnterprises.stream().map(BaseModel::getId).collect(Collectors.toSet());
|
|
Set<Long> entIds = kwsEnterprises.stream().map(BaseModel::getId).collect(Collectors.toSet());
|
|
|
|
|
|
|
@@ -1599,21 +1601,26 @@ public class KwsEnterpriseService {
|
|
|
//根据类型进行过滤
|
|
//根据类型进行过滤
|
|
|
List<KwsEntType> kwsEntTypes = kwsEntTypeRepository.queryByEntIdsAndType(entIds, req.getEntType());
|
|
List<KwsEntType> kwsEntTypes = kwsEntTypeRepository.queryByEntIdsAndType(entIds, req.getEntType());
|
|
|
if (CollectionUtils.isEmpty(kwsEntTypes)) {
|
|
if (CollectionUtils.isEmpty(kwsEntTypes)) {
|
|
|
- return new EntInfoResp();
|
|
|
|
|
|
|
+ return entInfoResp;
|
|
|
}
|
|
}
|
|
|
Set<Long> entIdList = kwsEntTypes.stream().map(KwsEntType::getEntId).collect(Collectors.toSet());
|
|
Set<Long> entIdList = kwsEntTypes.stream().map(KwsEntType::getEntId).collect(Collectors.toSet());
|
|
|
//过滤类型表中包含的数据
|
|
//过滤类型表中包含的数据
|
|
|
List<EntInfoResp.EntInfo> entInfos = kwsEnterprises.stream().filter(x -> entIdList.contains(x.getId())).map(k -> {
|
|
List<EntInfoResp.EntInfo> entInfos = kwsEnterprises.stream().filter(x -> entIdList.contains(x.getId())).map(k -> {
|
|
|
- EntInfoResp.EntInfo entInfoResp = new EntInfoResp.EntInfo();
|
|
|
|
|
- entInfoResp.setEntId(String.valueOf(k.getId()));
|
|
|
|
|
- entInfoResp.setEntName(k.getFirmName());
|
|
|
|
|
- return entInfoResp;
|
|
|
|
|
|
|
+ EntInfoResp.EntInfo info = new EntInfoResp.EntInfo();
|
|
|
|
|
+ info.setEntId(String.valueOf(k.getId()));
|
|
|
|
|
+ info.setEntName(k.getFirmName());
|
|
|
|
|
+ return info;
|
|
|
}).collect(Collectors.toList());
|
|
}).collect(Collectors.toList());
|
|
|
- EntInfoResp entInfoResp = new EntInfoResp();
|
|
|
|
|
entInfoResp.setEntInfos(entInfos);
|
|
entInfoResp.setEntInfos(entInfos);
|
|
|
return entInfoResp;
|
|
return entInfoResp;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ private EntInfoResp buildEntInfoResp(EntInfoReq req) {
|
|
|
|
|
+ EntInfoResp entInfoResp = new EntInfoResp();
|
|
|
|
|
+ entInfoResp.setBuyer(Objects.equals(req.getLoginEntType(), String.valueOf(EntTypeEnum.PURCHASER.getCode())));
|
|
|
|
|
+ return entInfoResp;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* @return
|
|
* @return
|
|
|
*/
|
|
*/
|