|
@@ -54,7 +54,10 @@ import com.fjhx.sale.service.pack.PackDetailService;
|
|
|
import com.fjhx.sale.service.purchase.*;
|
|
|
import com.fjhx.sale.service.sample.SampleProductService;
|
|
|
import com.fjhx.supply.entity.supplier.po.SupplierInfo;
|
|
|
+import com.fjhx.supply.entity.supplier.po.SupplierPrice;
|
|
|
+import com.fjhx.supply.entity.supplier.vo.SupplierPriceVo;
|
|
|
import com.fjhx.supply.service.supplier.SupplierInfoService;
|
|
|
+import com.fjhx.supply.service.supplier.SupplierPriceService;
|
|
|
import com.ruoyi.common.core.domain.BasePo;
|
|
|
import com.ruoyi.common.core.domain.BaseSelectDto;
|
|
|
import com.ruoyi.common.exception.ServiceException;
|
|
@@ -121,6 +124,8 @@ public class EhsdPurchaseServiceImpl extends ServiceImpl<EhsdPurchaseMapper, Ehs
|
|
|
private SubscribeDetailService subscribeDetailService;
|
|
|
@Autowired
|
|
|
private AccountManagementService accountManagementService;
|
|
|
+ @Autowired
|
|
|
+ private SupplierPriceService supplierPriceService;
|
|
|
|
|
|
/**
|
|
|
* 分页
|
|
@@ -539,6 +544,10 @@ public class EhsdPurchaseServiceImpl extends ServiceImpl<EhsdPurchaseMapper, Ehs
|
|
|
Map<Long, List<EhsdPurchaseProductVo>> purchaseProductMap =
|
|
|
purchaseProductList.stream().collect(Collectors.groupingBy(EhsdPurchaseProductVo::getProductId));
|
|
|
|
|
|
+ //按价格升序 获取前10供应商
|
|
|
+ List<SupplierPriceVo> topPriceList = supplierPriceService.getTopPriceList(productIds, 10);
|
|
|
+ Map<Long, List<SupplierPriceVo>> topPriceMap = topPriceList.stream().collect(Collectors.groupingBy(SupplierPrice::getProductInfoId));
|
|
|
+
|
|
|
//处理输出数据
|
|
|
Map<Long, Map<String, Object>> reData = new HashMap<>();
|
|
|
for (Long productId : productIds) {
|
|
@@ -547,6 +556,8 @@ public class EhsdPurchaseServiceImpl extends ServiceImpl<EhsdPurchaseMapper, Ehs
|
|
|
data.put("supplyPurchaseProductList", supplyPurchaseProductMap.getOrDefault(productId, new ArrayList<>()));
|
|
|
//该产品近20条销售价格
|
|
|
data.put("purchaseProductList", purchaseProductMap.getOrDefault(productId, new ArrayList<>()));
|
|
|
+ //前10供应商价格
|
|
|
+ data.put("topPriceList", topPriceMap.getOrDefault(productId, new ArrayList<>()));
|
|
|
|
|
|
reData.put(productId, data);
|
|
|
}
|