Browse Source

1.查询逻辑优化

master
zhenghaoyu 10 months ago
parent
commit
79247211b0
  1. 19
      blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/dto/FindParamterDTO.java
  2. 7
      blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/feign/IDistributionParcelListClient.java
  3. 4
      blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/feign/IDistributionStockArticleClient.java
  4. 22
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/feign/DistributionParcelListClient.java
  5. 8
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/feign/DistributionStockArticleClient.java
  6. 11
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineAdvanceServiceImpl.java
  7. 6
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseTrayTypeServiceImpl.java
  8. 18
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseUpdownTypeServiceImpl.java

19
blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/dto/FindParamterDTO.java

@ -0,0 +1,19 @@
package com.logpm.distribution.dto;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
import java.util.Set;
@Data
public class FindParamterDTO implements Serializable {
private Set<String> orderCodeSet;
private Long warehouseId;
private List<String> orderPackageCodeList;
private List<String> orderCodeList;
}

7
blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/feign/IDistributionParcelListClient.java

@ -16,6 +16,7 @@
*/
package com.logpm.distribution.feign;
import com.logpm.distribution.dto.FindParamterDTO;
import com.logpm.distribution.dto.OrderPackageDTO;
import com.logpm.distribution.entity.DistributionParcelListEntity;
import com.logpm.distribution.vo.DistributionParcelListVO;
@ -190,11 +191,11 @@ public interface IDistributionParcelListClient {
void saveorUpdateBatchByOP(@RequestBody List<DistributionParcelListEntity> parcelListEntityList);
@PostMapping(API_PREFIX + "/findListByOrderCodesAndWarehouseId")
List<DistributionParcelListEntity> findListByOrderCodesAndWarehouseId(@RequestParam Set<String> orderCodeSet, @RequestParam Long warehouseId);
List<DistributionParcelListEntity> findListByOrderCodesAndWarehouseId(@RequestBody FindParamterDTO findParamterDTO);
@PostMapping(API_PREFIX + "/findListByOrderPackageCodeList")
List<DistributionParcelListEntity> findListByOrderPackageCodeList(@RequestParam List<String> orderPackageCodeList, @RequestParam Long warehouseId);
List<DistributionParcelListEntity> findListByOrderPackageCodeList(@RequestBody FindParamterDTO findParamterDTO);
@PostMapping(API_PREFIX + "/findALLNoUpShelfPackageByOrderCodeList")
List<DistributionParcelListEntity> findALLNoUpShelfPackageByOrderCodeList(@RequestParam List<String> orderCodeList, @RequestParam Long warehouseId);
List<DistributionParcelListEntity> findALLNoUpShelfPackageByOrderCodeList(@RequestBody FindParamterDTO findParamterDTO);
}

4
blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/feign/IDistributionStockArticleClient.java

@ -18,6 +18,7 @@ package com.logpm.distribution.feign;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.logpm.distribution.dto.FindParamterDTO;
import com.logpm.distribution.dto.OrderPackageDTO;
import com.logpm.distribution.entity.DistributionStockArticleEntity;
import com.logpm.distribution.vo.UpDownStockupAreaVO;
@ -32,7 +33,6 @@ import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
import java.util.Map;
import java.util.Set;
/**
* 配送在库订单 Feign接口类
@ -178,7 +178,7 @@ public interface IDistributionStockArticleClient {
void updateCustomerAllByOrderCode(@RequestBody String data);
@PostMapping(value = API_PREFIX + "/findListByOrderCodesAndWarehouseId",consumes = MediaType.APPLICATION_JSON_VALUE)
List<DistributionStockArticleEntity> findListByOrderCodesAndWarehouseId(@RequestParam Set<String> orderCodeSet, @RequestParam Long warehouseId);
List<DistributionStockArticleEntity> findListByOrderCodesAndWarehouseId(@RequestBody FindParamterDTO findParamterDTO);
@PostMapping(value = API_PREFIX + "/addReturnList",consumes = MediaType.APPLICATION_JSON_VALUE)
List<DistributionStockArticleEntity> addReturnList(@RequestBody List<DistributionStockArticleEntity> addStockArticleEntities);

22
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/feign/DistributionParcelListClient.java

@ -23,6 +23,7 @@ import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.logpm.distribution.dto.FindParamterDTO;
import com.logpm.distribution.dto.OrderPackageDTO;
import com.logpm.distribution.entity.DistributionParcelListEntity;
import com.logpm.distribution.entity.DistributionStockArticleEntity;
@ -36,7 +37,10 @@ import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.annotations.ApiIgnore;
import java.util.*;
@ -423,25 +427,25 @@ public class DistributionParcelListClient implements IDistributionParcelListClie
}
@Override
public List<DistributionParcelListEntity> findListByOrderCodesAndWarehouseId(Set<String> orderCodeSet, Long warehouseId) {
public List<DistributionParcelListEntity> findListByOrderCodesAndWarehouseId(FindParamterDTO findParamterDTO) {
QueryWrapper<DistributionParcelListEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.in("order_code", orderCodeSet)
.eq("warehouse_id", warehouseId);
queryWrapper.in("order_code", findParamterDTO.getOrderCodeSet())
.eq("warehouse_id", findParamterDTO.getWarehouseId());
return distributionParcelListService.list(queryWrapper);
}
@Override
public List<DistributionParcelListEntity> findListByOrderPackageCodeList(List<String> orderPackageCodeList, Long warehouseId) {
public List<DistributionParcelListEntity> findListByOrderPackageCodeList(FindParamterDTO findParamterDTO) {
QueryWrapper<DistributionParcelListEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.in("order_package_code", orderPackageCodeList)
.eq("warehouse_id", warehouseId);
queryWrapper.in("order_package_code", findParamterDTO.getOrderPackageCodeList())
.eq("warehouse_id", findParamterDTO.getWarehouseId());
return distributionParcelListService.list(queryWrapper);
}
@Override
public List<DistributionParcelListEntity> findALLNoUpShelfPackageByOrderCodeList(List<String> orderCodeList, Long warehouseId) {
return distributionParcelListService.findALLNoUpShelfPackageByOrderCodeList(orderCodeList,warehouseId);
public List<DistributionParcelListEntity> findALLNoUpShelfPackageByOrderCodeList(FindParamterDTO findParamterDTO) {
return distributionParcelListService.findALLNoUpShelfPackageByOrderCodeList(findParamterDTO.getOrderCodeList(),findParamterDTO.getWarehouseId());
}
}

8
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/feign/DistributionStockArticleClient.java

@ -21,6 +21,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.logpm.distribution.dto.FindParamterDTO;
import com.logpm.distribution.dto.OrderPackageDTO;
import com.logpm.distribution.entity.DistributionParcelListEntity;
import com.logpm.distribution.entity.DistributionStockArticleEntity;
@ -41,7 +42,6 @@ import springfox.documentation.annotations.ApiIgnore;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
/**
* 配送在库订单 Feign实现类
@ -336,10 +336,10 @@ public class DistributionStockArticleClient implements IDistributionStockArticle
}
@Override
public List<DistributionStockArticleEntity> findListByOrderCodesAndWarehouseId(Set<String> orderCodeSet, Long warehouseId) {
public List<DistributionStockArticleEntity> findListByOrderCodesAndWarehouseId(FindParamterDTO findParamterDTO) {
QueryWrapper<DistributionStockArticleEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.in("order_code",orderCodeSet)
.eq("warehouse_id",warehouseId);
queryWrapper.in("order_code",findParamterDTO.getOrderCodeSet())
.eq("warehouse_id",findParamterDTO.getWarehouseId());
return distributionStockArticleService.list(queryWrapper);
}

11
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineAdvanceServiceImpl.java

@ -14,6 +14,7 @@ import com.logpm.basicdata.feign.IBasicdataClientClient;
import com.logpm.basicdata.feign.IBasicdataStoreBusinessClient;
import com.logpm.basicdata.feign.IBasicdataTripartiteMallClient;
import com.logpm.basicdata.feign.IBasicdataWarehouseClient;
import com.logpm.distribution.dto.FindParamterDTO;
import com.logpm.distribution.entity.DistributionParcelListEntity;
import com.logpm.distribution.entity.DistributionStockArticleEntity;
import com.logpm.distribution.feign.IDistributionParcelListClient;
@ -731,13 +732,19 @@ public class TrunklineAdvanceServiceImpl extends BaseServiceImpl<TrunklineAdvanc
}
List<DistributionStockArticleEntity> stockArticleEntities = stockArticleClient.findListByOrderCodesAndWarehouseId(orderCodeSet,warehouseId);
FindParamterDTO findParamterDTO = new FindParamterDTO();
findParamterDTO.setOrderCodeSet(orderCodeSet);
findParamterDTO.setWarehouseId(warehouseId);
List<DistributionStockArticleEntity> stockArticleEntities = stockArticleClient.findListByOrderCodesAndWarehouseId(findParamterDTO);
Map<String, DistributionStockArticleEntity> stockArticleMap = new HashMap<>();
if(!stockArticleEntities.isEmpty()){
stockArticleMap = stockArticleEntities.stream().collect(Collectors.toMap(DistributionStockArticleEntity::getOrderCode, Function.identity()));
}
List<DistributionParcelListEntity> parcelListEntities = parcelListClient.findListByOrderCodesAndWarehouseId(orderCodeSet,warehouseId);
FindParamterDTO findParamterD = new FindParamterDTO();
findParamterD.setOrderCodeSet(orderCodeSet);
findParamterD.setWarehouseId(warehouseId);
List<DistributionParcelListEntity> parcelListEntities = parcelListClient.findListByOrderCodesAndWarehouseId(findParamterD);
Map<String, DistributionParcelListEntity> parcelListMap = new HashMap<>();
if(!parcelListEntities.isEmpty()){
parcelListMap = parcelListEntities.stream().collect(Collectors.toMap(DistributionParcelListEntity::getOrderPackageCode, Function.identity()));

6
blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseTrayTypeServiceImpl.java

@ -9,6 +9,7 @@ import com.logpm.basic.entity.BasicMaterialEntity;
import com.logpm.basic.feign.IBasicMaterialClient;
import com.logpm.basicdata.entity.*;
import com.logpm.basicdata.feign.*;
import com.logpm.distribution.dto.FindParamterDTO;
import com.logpm.distribution.entity.DistributionParcelListEntity;
import com.logpm.distribution.entity.DistributionStockArticleEntity;
import com.logpm.distribution.entity.DistributionStockListEntity;
@ -709,7 +710,10 @@ public class WarehouseTrayTypeServiceImpl extends BaseServiceImpl<WarehouseTrayT
//把parcelListEntityList通过orderCode进行分组
Map<String, List<DistributionParcelListEntity>> map = parcelListEntityList.stream().collect(Collectors.groupingBy(DistributionParcelListEntity::getOrderCode));
List<DistributionStockArticleEntity> stockArticleEntityList = distributionStockArticleClient.findListByOrderCodesAndWarehouseId(map.keySet(), warehouseId);
FindParamterDTO findParamterDTO = new FindParamterDTO();
findParamterDTO.setOrderCodeSet(map.keySet());
findParamterDTO.setWarehouseId(warehouseId);
List<DistributionStockArticleEntity> stockArticleEntityList = distributionStockArticleClient.findListByOrderCodesAndWarehouseId(findParamterDTO);
//把stockArticleEntityList转化成orderCode为key的Map
Map<String, DistributionStockArticleEntity> stockArticleEntityMap = stockArticleEntityList.stream().collect(Collectors.toMap(DistributionStockArticleEntity::getOrderCode, Function.identity()));

18
blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseUpdownTypeServiceImpl.java

@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.logpm.basicdata.entity.*;
import com.logpm.basicdata.feign.*;
import com.logpm.distribution.dto.FindParamterDTO;
import com.logpm.distribution.dto.OrderPackageDTO;
import com.logpm.distribution.entity.DistributionParcelListEntity;
import com.logpm.distribution.entity.DistributionStockArticleEntity;
@ -879,7 +880,11 @@ public class WarehouseUpdownTypeServiceImpl extends BaseServiceImpl<WarehouseUpd
//把upShelfOrderList中的orderCode提取到一个Set集合中
List<String> orderCodeList = upShelfOrderList.stream().map(UpShelfOrderDTO::getOrderCode).collect(Collectors.toList());
List<DistributionParcelListEntity> parcelListList = distributionParcelListClient.findALLNoUpShelfPackageByOrderCodeList(orderCodeList, warehouseId);
FindParamterDTO findParamterDTO = new FindParamterDTO();
findParamterDTO.setOrderCodeList(orderCodeList);
findParamterDTO.setWarehouseId(warehouseId);
List<DistributionParcelListEntity> parcelListList = distributionParcelListClient.findALLNoUpShelfPackageByOrderCodeList(findParamterDTO);
List<UpShelfPackageDTO> upShelfPackageList = new ArrayList<>();
@ -969,7 +974,11 @@ public class WarehouseUpdownTypeServiceImpl extends BaseServiceImpl<WarehouseUpd
List<String> orderPackageCodes = trayGoodsEntityList.stream().map(WarehouseTrayGoodsEntity::getAssociationValue).collect(Collectors.toList());
warehouseTrayTypeService.downPackageByOrderPackageCodeList(orderPackageCodes,"同步处理:包件解托",warehouseId);
}
List<DistributionParcelListEntity> parcelListEntityList = distributionParcelListClient.findListByOrderPackageCodeList(orderPackageCodeList, warehouseId);
FindParamterDTO findParamterDTO = new FindParamterDTO();
findParamterDTO.setOrderPackageCodeList(orderPackageCodeList);
findParamterDTO.setWarehouseId(warehouseId);
List<DistributionParcelListEntity> parcelListEntityList = distributionParcelListClient.findListByOrderPackageCodeList(findParamterDTO);
//排除parcelListEntityList中元素orderPackageStatus 不等于20的
parcelListEntityList = parcelListEntityList.stream().filter(parcelListEntity -> "20".equals(parcelListEntity.getOrderPackageStatus())).collect(Collectors.toList());
@ -1427,7 +1436,10 @@ public class WarehouseUpdownTypeServiceImpl extends BaseServiceImpl<WarehouseUpd
//把updownGoodsEntities的association_value提取到一个List中
List<String> associationValueList = updownGoodsEntities.stream().map(WarehouseUpdownGoodsEntity::getAssociationValue).collect(Collectors.toList());
List<DistributionParcelListEntity> parcelListEntityList = distributionParcelListClient.findListByOrderPackageCodeList(associationValueList, warehouseId);
FindParamterDTO findParamterDTO = new FindParamterDTO();
findParamterDTO.setOrderPackageCodeList(associationValueList);
findParamterDTO.setWarehouseId(warehouseId);
List<DistributionParcelListEntity> parcelListEntityList = distributionParcelListClient.findListByOrderPackageCodeList(findParamterDTO);
//把parcelListEntityList转化成orderPackageCode为key的Map
Map<String, DistributionParcelListEntity> parcelListEntityMap = parcelListEntityList.stream().collect(Collectors.toMap(DistributionParcelListEntity::getOrderPackageCode, Function.identity()));

Loading…
Cancel
Save