Browse Source

产品供应商价格接口修改

yzc 1 year ago
parent
commit
72a98c2392

+ 2 - 6
hx-supply/src/main/java/com/fjhx/supply/controller/supplier/SupplierPriceController.java

@@ -1,10 +1,9 @@
 package com.fjhx.supply.controller.supplier;
 
-import com.baomidou.dynamic.datasource.annotation.DS;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.fjhx.common.constant.SourceConstant;
 import com.fjhx.supply.entity.supplier.dto.SupplierPriceDto;
 import com.fjhx.supply.entity.supplier.dto.SupplierPriceSelectDto;
+import com.fjhx.supply.entity.supplier.po.SupplierPrice;
 import com.fjhx.supply.entity.supplier.vo.SupplierPriceAddVo;
 import com.fjhx.supply.entity.supplier.vo.SupplierPriceVo;
 import com.fjhx.supply.service.supplier.SupplierPriceService;
@@ -16,7 +15,6 @@ import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
-import java.math.BigDecimal;
 import java.util.Map;
 
 
@@ -72,11 +70,9 @@ public class SupplierPriceController {
 
     /**
      * 根据供应商id和产品列表获取价格
-     *
-     * @return
      */
     @PostMapping("/getSupplierPriceByProductIds")
-    public Map<Long, BigDecimal> getSupplierPriceByProductIds(@RequestBody SupplierPriceDto dto) {
+    public Map<Long, SupplierPrice> getSupplierPriceByProductIds(@RequestBody SupplierPriceDto dto) {
         return supplierPriceService.getSupplierPriceByProductIds(dto);
     }
 

+ 1 - 2
hx-supply/src/main/java/com/fjhx/supply/service/supplier/SupplierPriceService.java

@@ -8,7 +8,6 @@ import com.fjhx.supply.entity.supplier.vo.SupplierPriceAddVo;
 import com.fjhx.supply.entity.supplier.vo.SupplierPriceVo;
 import com.ruoyi.common.core.service.BaseService;
 
-import java.math.BigDecimal;
 import java.util.List;
 import java.util.Map;
 
@@ -48,7 +47,7 @@ public interface SupplierPriceService extends BaseService<SupplierPrice> {
     /**
      * 根据供应商id和产品列表获取价格
      */
-    Map<Long, BigDecimal> getSupplierPriceByProductIds(SupplierPriceDto dto);
+    Map<Long, SupplierPrice> getSupplierPriceByProductIds(SupplierPriceDto dto);
 
     /**
      * 查某产品前n条低价供应商

+ 2 - 3
hx-supply/src/main/java/com/fjhx/supply/service/supplier/impl/SupplierPriceServiceImpl.java

@@ -24,7 +24,6 @@ import com.ruoyi.common.utils.wrapper.SqlField;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
-import java.math.BigDecimal;
 import java.util.List;
 import java.util.Map;
 import java.util.function.Function;
@@ -190,7 +189,7 @@ public class SupplierPriceServiceImpl extends ServiceImpl<SupplierPriceMapper, S
     }
 
     @Override
-    public Map<Long, BigDecimal> getSupplierPriceByProductIds(SupplierPriceDto dto) {
+    public Map<Long, SupplierPrice> getSupplierPriceByProductIds(SupplierPriceDto dto) {
         Long supplierId = dto.getSupplierInfoId();
         if (ObjectUtils.isEmpty(supplierId)) {
             throw new ServiceException("供应商id不能为空");
@@ -200,7 +199,7 @@ public class SupplierPriceServiceImpl extends ServiceImpl<SupplierPriceMapper, S
             throw new ServiceException("产品id数组不能为空");
         }
         List<SupplierPrice> list = list(q -> q.eq(SupplierPrice::getSupplierInfoId, supplierId).in(SupplierPrice::getProductInfoId, productIdList));
-        return list.stream().collect(Collectors.toMap(SupplierPrice::getProductInfoId, SupplierPrice::getPrice));
+        return list.stream().collect(Collectors.toMap(SupplierPrice::getProductInfoId, Function.identity()));
     }
 
     @Override