Explorar el Código

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

xucaiqin hace 2 años
padre
commit
e2d5e59c4b

+ 3 - 0
sckw-modules/sckw-order/src/main/java/com/sckw/order/model/dto/TransportDemandExport.java

@@ -26,6 +26,9 @@ public class TransportDemandExport implements Serializable {
     @ExcelProperty(value = "状态")
     private String statusLabel;
 
+    @ExcelProperty(value = "企业名称")
+    private String entName;
+
     @ExcelProperty(value = "商品名称")
     private String name;
 

+ 3 - 0
sckw-modules/sckw-order/src/main/java/com/sckw/order/model/dto/WantBuyExport.java

@@ -27,6 +27,9 @@ public class WantBuyExport implements Serializable {
     @ExcelProperty(value = "状态")
     private String statusLabel;
 
+    @ExcelProperty(value = "企业名称")
+    private String entName;
+
     @ExcelProperty(value = "商品名称")
     private String name;
 

+ 5 - 0
sckw-modules/sckw-order/src/main/java/com/sckw/order/model/vo/res/TransportDemandListRes.java

@@ -120,5 +120,10 @@ public class TransportDemandListRes implements Serializable {
      */
     private String remark;
 
+    /**
+     * 企业名称
+     */
+    private String entName;
+
 
 }

+ 19 - 6
sckw-modules/sckw-order/src/main/java/com/sckw/order/serivce/KwoTransportDemandService.java

@@ -24,10 +24,7 @@ import com.sckw.order.dao.KwoTransportDemandMapper;
 import com.sckw.order.model.KwoTransportDemand;
 import com.sckw.order.model.dto.TransportDemandExport;
 import com.sckw.order.model.vo.req.*;
-import com.sckw.order.model.vo.res.TransportDemandContactInfoRes;
-import com.sckw.order.model.vo.res.TransportDemandDetailRes;
-import com.sckw.order.model.vo.res.TransportDemandListRes;
-import com.sckw.order.model.vo.res.TransportDemandSquaresListRes;
+import com.sckw.order.model.vo.res.*;
 import com.sckw.system.api.RemoteSystemService;
 import com.sckw.system.api.model.dto.res.EntCacheResDto;
 import com.sckw.system.api.model.dto.res.SysDictResDto;
@@ -186,6 +183,13 @@ public class KwoTransportDemandService {
         if (CollectionUtils.isEmpty(list)) {
             return PageResult.build(param.getPage(), param.getPageSize(), demandPage.getTotal(), Collections.emptyList());
         }
+
+        // 获取供应企业信息
+        List<Long> supplyEntIds = list.stream().map(KwoTransportDemand::getEntId).collect(Collectors.toList());
+        // 通过企业id查询企业信息
+        List<EntCacheResDto> entList = remoteSystemService.queryEntCacheByIds(supplyEntIds);
+        Map<Long, String> entMap = entList.stream().collect(Collectors.toMap(EntCacheResDto::getId, EntCacheResDto::getFirmName, (k1, k2) -> k1));
+
         List<TransportDemandListRes> result = Lists.newArrayList();
         list.forEach(e -> {
             TransportDemandListRes demand = BeanUtils.copyProperties(e, TransportDemandListRes.class);
@@ -197,7 +201,8 @@ public class KwoTransportDemandService {
                     .setTradingLabel(DictEnum.getLabel(DictTypeEnum.TRADE_TYPE.getType(), e.getTrading()))
                     .setStatusLabel(DictEnum.getLabel(DictTypeEnum.TRANSPORT_DEMAND_STATUS.getType(), String.valueOf(e.getStatus())))
                     .setLoadAddress(loadAreaName + loadDetailAddress)
-                    .setUnloadAddress(unloadAreaName + unloadDetailAddress);
+                    .setUnloadAddress(unloadAreaName + unloadDetailAddress)
+                    .setEntName(entMap != null ? entMap.get(e.getEntId()) : null);
             result.add(demand);
         });
         return PageResult.build(param.getPage(), param.getPageSize(), demandPage.getTotal(), result);
@@ -292,6 +297,13 @@ public class KwoTransportDemandService {
         if (CollectionUtils.isEmpty(demands)) {
             return Collections.emptyList();
         }
+
+        // 获取供应企业信息
+        List<Long> supplyEntIds = demands.stream().map(KwoTransportDemand::getEntId).collect(Collectors.toList());
+        // 通过企业id查询企业信息
+        List<EntCacheResDto> entList = remoteSystemService.queryEntCacheByIds(supplyEntIds);
+        Map<Long, String> entMap = entList.stream().collect(Collectors.toMap(EntCacheResDto::getId, EntCacheResDto::getFirmName, (k1, k2) -> k1));
+
         List<TransportDemandExport> result = Lists.newArrayList();
         AtomicInteger i = new AtomicInteger(1);
         demands.forEach(e -> {
@@ -302,7 +314,8 @@ public class KwoTransportDemandService {
                     .setUnloadAddress(e.getUnloadAreaName() + e.getUnloadDetailAddress())
                     .setDeadline(Objects.isNull(e.getDeadline()) ? null : DateUtil.dateToStr(e.getDeadline()))
                     .setCreateTime(Objects.isNull(e.getCreateTime()) ? null : DateUtil.getDateTime(e.getCreateTime()))
-                    .setUpdateTime(Objects.isNull(e.getUpdateTime()) ? null : DateUtil.getDateTime(e.getUpdateTime()));
+                    .setUpdateTime(Objects.isNull(e.getUpdateTime()) ? null : DateUtil.getDateTime(e.getUpdateTime()))
+                    .setEntName(entMap != null ? entMap.get(e.getEntId()) : null);
             result.add(export);
         });
         return result;