Przeglądaj źródła

Merge remote-tracking branch 'origin/dev_20260131' into dev_20260131

donglang 2 miesięcy temu
rodzic
commit
5760758f0c

+ 3 - 0
sckw-modules/sckw-system/src/main/java/com/sckw/system/model/vo/res/EntInfoResp.java

@@ -18,6 +18,9 @@ public class EntInfoResp implements Serializable {
     @Serial
     private static final long serialVersionUID = -8957989833318602612L;
 
+    @Schema(description = "当前企业是否为买家:true-买家,false-卖家")
+    private Boolean buyer;
+
     private List<EntInfo> entInfos;
 
     @Data

+ 21 - 14
sckw-modules/sckw-system/src/main/java/com/sckw/system/service/KwsEnterpriseService.java

@@ -1,3 +1,4 @@
+
 package com.sckw.system.service;
 
 import cn.hutool.core.collection.CollUtil;
@@ -1558,36 +1559,37 @@ public class KwsEnterpriseService {
 
     @NotNull
     private EntInfoResp getInfoResp(EntInfoReq req) {
+        EntInfoResp entInfoResp = buildEntInfoResp(req);
         List<KwsEntType> kwsEntTypes = kwsEntTypeRepository.queryByType(req.getEntType());
         if (CollectionUtils.isEmpty(kwsEntTypes)) {
-            return new EntInfoResp();
+            return entInfoResp;
         }
         Set<Long> entIds = kwsEntTypes.stream().map(KwsEntType::getEntId).collect(Collectors.toSet());
         //根据企业id查询企业信息
         List<KwsEnterprise> kwsEnterprises = kwsEnterpriseRepository.queryByEntIds(entIds, req.getEntName());
         if (CollectionUtils.isEmpty(kwsEnterprises)) {
-            return new EntInfoResp();
+            return entInfoResp;
         }
         //组装返回对象
         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());
-        EntInfoResp entInfoResp = new EntInfoResp();
         entInfoResp.setEntInfos(entInfos);
         return entInfoResp;
     }
 
     @NotNull
     private EntInfoResp getEntInfoResp(EntInfoReq req) {
+        EntInfoResp entInfoResp = buildEntInfoResp(req);
         if (org.apache.commons.lang3.StringUtils.isBlank(req.getEntId())) {
             throw new BusinessException("企业id不能为空");
         }
         List<KwsEnterprise> kwsEnterprises = kwsEnterpriseRepository.queryByEntIdAndName(req.getEntId(), req.getEntName());
         if (CollectionUtils.isEmpty(kwsEnterprises)) {
-            return new EntInfoResp();
+            return entInfoResp;
         }
         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());
         if (CollectionUtils.isEmpty(kwsEntTypes)) {
-            return new EntInfoResp();
+            return entInfoResp;
         }
         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 -> {
-            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());
-        EntInfoResp entInfoResp = new EntInfoResp();
         entInfoResp.setEntInfos(entInfos);
         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
      */