yzc пре 1 година
родитељ
комит
6d9a2afcb4
22 измењених фајлова са 205 додато и 89 уклоњено
  1. 2 0
      hx-mes/src/main/java/com/fjhx/mes/entity/material/vo/MaterialPreparationVo.java
  2. 13 8
      hx-mes/src/main/java/com/fjhx/mes/entity/production/vo/ProductionOrderDetailVo.java
  3. 2 0
      hx-mes/src/main/java/com/fjhx/mes/entity/production/vo/ProductionReportingDetailVo.java
  4. 18 0
      hx-mes/src/main/java/com/fjhx/mes/service/material/impl/MaterialPreparationServiceImpl.java
  5. 8 0
      hx-mes/src/main/java/com/fjhx/mes/service/production/impl/ProduceOrderDetailServiceImpl.java
  6. 12 0
      hx-mes/src/main/java/com/fjhx/mes/service/production/impl/ProduceOrderServiceImpl.java
  7. 13 0
      hx-mes/src/main/java/com/fjhx/mes/service/production/impl/ProductionReportingDetailServiceImpl.java
  8. 1 0
      hx-mes/src/main/resources/mapper/material/MaterialPreparationMapper.xml
  9. 2 1
      hx-mes/src/main/resources/mapper/production/ProduceOrderDetailMapper.xml
  10. 3 1
      hx-mes/src/main/resources/mapper/production/ProduceOrderMapper.xml
  11. 2 1
      hx-mes/src/main/resources/mapper/production/ProductionReportingDetailMapper.xml
  12. 2 0
      hx-purchase/src/main/java/com/fjhx/purchase/entity/subscribe/vo/SubscribeDetailVo.java
  13. 51 42
      hx-purchase/src/main/java/com/fjhx/purchase/service/subscribe/impl/SubscribeDetailServiceImpl.java
  14. 0 15
      hx-sale/src/main/java/com/fjhx/sale/controller/purchase/EhsdPurchaseController.java
  15. 10 8
      hx-sale/src/main/java/com/fjhx/sale/entity/purchase/vo/EhsdPurchaseVo.java
  16. 10 0
      hx-sale/src/main/java/com/fjhx/sale/service/purchase/impl/EhsdPurchaseServiceImpl.java
  17. 5 0
      hx-supply/src/main/java/com/fjhx/supply/entity/supplier/po/SupplierPrice.java
  18. 2 1
      hx-supply/src/main/java/com/fjhx/supply/entity/supplier/vo/SupplierInfoVo.java
  19. 2 0
      hx-supply/src/main/java/com/fjhx/supply/entity/supplier/vo/SupplierPriceVo.java
  20. 20 6
      hx-supply/src/main/java/com/fjhx/supply/service/supplier/impl/SupplierInfoServiceImpl.java
  21. 25 5
      hx-supply/src/main/java/com/fjhx/supply/service/supplier/impl/SupplierPriceServiceImpl.java
  22. 2 1
      hx-supply/src/main/resources/mapper/supplier/SupplierPriceMapper.xml

+ 2 - 0
hx-mes/src/main/java/com/fjhx/mes/entity/material/vo/MaterialPreparationVo.java

@@ -23,4 +23,6 @@ public class MaterialPreparationVo extends MaterialPreparation {
      */
     private String materialCode;
 
+    private String companyName;
+
 }

+ 13 - 8
hx-mes/src/main/java/com/fjhx/mes/entity/production/vo/ProductionOrderDetailVo.java

@@ -107,14 +107,19 @@ public class ProductionOrderDetailVo extends ProductionOrderDetail {
 	 */
 	private List<ProductionTaskProgressVo> productionTaskProgressList;
 
-	/**
-	 * BOM列表
-	 */
-	private List<ContractProductBomVo> contractProductBomList;
+    /**
+     * BOM列表
+     */
+    private List<ContractProductBomVo> contractProductBomList;
 
-	/**
-	 * 投产时间
-	 */
-	private Date produceTime;
+    /**
+     * 投产时间
+     */
+    private Date produceTime;
+
+    /**
+     * 生产公司Id
+     */
+    private String companyName;
 
 }

+ 2 - 0
hx-mes/src/main/java/com/fjhx/mes/entity/production/vo/ProductionReportingDetailVo.java

@@ -29,4 +29,6 @@ public class ProductionReportingDetailVo extends ProductionReportingDetail {
      */
     private String createUserName;
 
+    private String companyName;
+
 }

+ 18 - 0
hx-mes/src/main/java/com/fjhx/mes/service/material/impl/MaterialPreparationServiceImpl.java

@@ -1,5 +1,6 @@
 package com.fjhx.mes.service.material.impl;
 
+import cn.hutool.core.util.ObjectUtil;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.fjhx.item.service.product.ProductInfoService;
@@ -8,6 +9,7 @@ import com.fjhx.mes.entity.material.po.MaterialPreparation;
 import com.fjhx.mes.entity.material.vo.MaterialPreparationVo;
 import com.fjhx.mes.mapper.material.MaterialPreparationMapper;
 import com.fjhx.mes.service.material.MaterialPreparationService;
+import com.fjhx.tenant.utils.DeptUstil;
 import com.ruoyi.common.utils.SecurityUtils;
 import com.ruoyi.common.utils.wrapper.IWrapper;
 import com.ruoyi.common.utils.wrapper.SqlField;
@@ -15,7 +17,9 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import java.util.List;
+import java.util.Map;
 import java.util.Objects;
+import java.util.stream.Collectors;
 
 
 /**
@@ -63,6 +67,20 @@ public class MaterialPreparationServiceImpl extends ServiceImpl<MaterialPreparat
 
         Page<MaterialPreparationVo> page = this.baseMapper.getPage(dto.getPage(), wrapper);
 
+        List<MaterialPreparationVo> records = page.getRecords();
+        if (ObjectUtil.isEmpty(records)) {
+            return page;
+        }
+
+        //获取生产公司信息
+        List<Long> companyIds = records.stream().map(MaterialPreparation::getCompanyId).collect(Collectors.toList());
+        Map<Long, String> companyNameMap = DeptUstil.getDeptNameMap(companyIds);
+
+        for (MaterialPreparationVo record : records) {
+            //赋值生产公司名称
+            record.setCompanyName(companyNameMap.get(record.getCompanyId()));
+        }
+
         return page;
     }
 

+ 8 - 0
hx-mes/src/main/java/com/fjhx/mes/service/production/impl/ProduceOrderDetailServiceImpl.java

@@ -22,6 +22,7 @@ import com.fjhx.sale.entity.contract.po.ContractProductBom;
 import com.fjhx.sale.entity.contract.vo.ContractProductBomVo;
 import com.fjhx.sale.service.contract.ContractProductBomService;
 import com.fjhx.sale.service.contract.ContractProductService;
+import com.fjhx.tenant.utils.DeptUstil;
 import com.ruoyi.common.utils.SecurityUtils;
 import com.ruoyi.common.utils.wrapper.IWrapper;
 import com.ruoyi.common.utils.wrapper.SqlField;
@@ -120,6 +121,10 @@ public class ProduceOrderDetailServiceImpl extends ServiceImpl<ProduceOrderDetai
         Map<Long, List<ProductionTaskProgressVo>> productionTaskProgressMap = productionTaskProgressList
                 .stream().collect(Collectors.groupingBy(ProductionTaskProgress::getTaskId));
 
+        //获取生产公司信息
+        List<Long> companyIds = records.stream().map(ProductionOrderDetail::getCompanyId).collect(Collectors.toList());
+        Map<Long, String> companyNameMap = DeptUstil.getDeptNameMap(companyIds);
+
 
         for (ProductionOrderDetailVo record : records) {
             //赋值产品信息
@@ -152,6 +157,9 @@ public class ProduceOrderDetailServiceImpl extends ServiceImpl<ProduceOrderDetai
 
             //赋值生产进度列表
             record.setProductionTaskProgressList(productionTaskProgressMap.get(record.getId()));
+
+            //赋值生产公司名称
+            record.setCompanyName(companyNameMap.get(record.getCompanyId()));
         }
 
         return page;

+ 12 - 0
hx-mes/src/main/java/com/fjhx/mes/service/production/impl/ProduceOrderServiceImpl.java

@@ -43,6 +43,7 @@ import com.fjhx.sale.service.contract.ContractProductService;
 import com.fjhx.sale.service.contract.ContractService;
 import com.fjhx.socket.core.PushTypeEnum;
 import com.fjhx.socket.core.WebSocketPush;
+import com.fjhx.tenant.utils.DeptUstil;
 import com.ruoyi.common.core.domain.BasePo;
 import com.ruoyi.common.core.domain.entity.SysDept;
 import com.ruoyi.common.exception.ServiceException;
@@ -199,6 +200,17 @@ public class ProduceOrderServiceImpl extends ServiceImpl<ProduceOrderMapper, Pro
         wrapper.orderByAsc("po", ProductionOrder::getCreateTime);
         wrapper.orderByAsc("po", ProductionOrder::getId);
         List<ProductionOrderVo> schedulingList = baseMapper.getSchedulingList(wrapper);
+
+        //获取生产部门信息
+        List<Long> companyIds = schedulingList.stream().map(ProductionOrderVo::getCompanyId).collect(Collectors.toList());
+        if (ObjectUtil.isNotEmpty(companyIds)) {
+            Map<Long, String> deptMap = DeptUstil.getDeptNameMap(companyIds);
+            for (ProductionOrderVo productionOrderVo : schedulingList) {
+                //赋值生产公司名称
+                productionOrderVo.setCompanyName(deptMap.get(productionOrderVo.getCompanyId()));
+            }
+        }
+
         return schedulingList;
     }
 

+ 13 - 0
hx-mes/src/main/java/com/fjhx/mes/service/production/impl/ProductionReportingDetailServiceImpl.java

@@ -22,6 +22,7 @@ import com.fjhx.mes.service.production.ProduceOrderService;
 import com.fjhx.mes.service.production.ProductionReportingDetailService;
 import com.fjhx.mes.service.production.ProductionTaskProgressService;
 import com.fjhx.mes.service.technology.TechnologyProcessLineService;
+import com.fjhx.tenant.utils.DeptUstil;
 import com.ruoyi.common.core.domain.BasePo;
 import com.ruoyi.common.utils.SecurityUtils;
 import com.ruoyi.common.utils.wrapper.IWrapper;
@@ -32,7 +33,9 @@ import org.springframework.stereotype.Service;
 import java.math.BigDecimal;
 import java.util.Date;
 import java.util.List;
+import java.util.Map;
 import java.util.Objects;
+import java.util.stream.Collectors;
 
 
 /**
@@ -80,6 +83,16 @@ public class ProductionReportingDetailServiceImpl extends ServiceImpl<Production
         }
         //赋值创建人名称
         UserUtil.assignmentNickName(records, ProductionReportingDetail::getCreateUser, ProductionReportingDetailVo::setCreateUserName);
+
+        //获取生产公司信息
+        List<Long> companyIds = records.stream().map(ProductionReportingDetail::getCompanyId).collect(Collectors.toList());
+        Map<Long, String> companyNameMap = DeptUstil.getDeptNameMap(companyIds);
+
+        for (ProductionReportingDetailVo record : records) {
+            //赋值生产公司名称
+            record.setCompanyName(companyNameMap.get(record.getCompanyId()));
+        }
+
         return page;
     }
 

+ 1 - 0
hx-mes/src/main/resources/mapper/material/MaterialPreparationMapper.xml

@@ -23,6 +23,7 @@
                mp.create_time,
                mp.update_user,
                mp.update_time,
+               mp.company_id,
                pi.`name`      as materialName,
                pi.custom_code as materialCode
         from material_preparation mp

+ 2 - 1
hx-mes/src/main/resources/mapper/production/ProduceOrderDetailMapper.xml

@@ -20,7 +20,8 @@
 			   po.code        AS orderCode,
 			   po.create_time AS orderCreateTime,
 			   po.produce_time,
-			   po.delivery_period
+			   po.delivery_period,
+			   po.company_id
 		FROM production_order_detail pod
 				 LEFT JOIN production_order po ON pod.produce_order_id = po.id
 			${ew.customSqlSegment}

+ 3 - 1
hx-mes/src/main/resources/mapper/production/ProduceOrderMapper.xml

@@ -12,6 +12,7 @@
 			   po.create_time,
 			   po.update_user,
 			   po.update_time,
+			   po.company_id,
 			   c.prod_tag
 		from production_order po
 				 LEFT JOIN contract c ON po.contract_id = c.id
@@ -23,7 +24,8 @@
 			   GROUP_CONCAT(pi.`name` SEPARATOR ',') AS productName,
 			   po.create_time,
 			   po.produce_time,
-			   po.delivery_period
+			   po.delivery_period,
+			   po.company_id
 		FROM production_order po
 				 LEFT JOIN production_order_detail pod ON pod.produce_order_id = po.id
 				 LEFT JOIN product_info pi ON pod.product_id = pi.id

+ 2 - 1
hx-mes/src/main/resources/mapper/production/ProductionReportingDetailMapper.xml

@@ -11,7 +11,8 @@
                prd.update_user,
                prd.update_time,
                po.`code` AS orderCode,
-               pp.`name` AS processesName
+               pp.`name` AS processesName,
+               prd.company_id
         FROM production_reporting_detail prd
                  LEFT JOIN production_order_detail pod ON prd.production_task_id = pod.id
                  LEFT JOIN production_order po ON pod.produce_order_id = po.id

+ 2 - 0
hx-purchase/src/main/java/com/fjhx/purchase/entity/subscribe/vo/SubscribeDetailVo.java

@@ -125,5 +125,7 @@ public class SubscribeDetailVo extends SubscribeDetail {
      */
     private String prodTag;
 
+    private String companyName;
+
 
 }

+ 51 - 42
hx-purchase/src/main/java/com/fjhx/purchase/service/subscribe/impl/SubscribeDetailServiceImpl.java

@@ -25,6 +25,7 @@ import com.fjhx.purchase.service.subscribe.SubscribeDetailService;
 import com.fjhx.tenant.entity.dict.dto.DictTenantDataSelectDto;
 import com.fjhx.tenant.entity.dict.vo.DictTenantDataVo;
 import com.fjhx.tenant.service.dict.DictTenantDataService;
+import com.fjhx.tenant.utils.DeptUstil;
 import com.fjhx.wms.service.warehouse.WarehouseService;
 import com.ruoyi.common.exception.ServiceException;
 import com.ruoyi.common.utils.SecurityUtils;
@@ -113,52 +114,60 @@ public class SubscribeDetailServiceImpl extends ServiceImpl<SubscribeDetailMappe
 		}
 
 		//按类型倒序 先显示合同数据 再显示申购数据
-		wrapper.orderByDesc("t2", SubscribeDetail::getDataType);
-		wrapper.orderByDesc("t2", SubscribeDetail::getCreateTime);
-
-		Page<SubscribeDetailVo> page = this.baseMapper.getPage(dto.getPage(), wrapper);
-		List<SubscribeDetailVo> list = page.getRecords();
-
-		if (list.size() == 0) {
-			return page;
-		}
-
-		// 赋值产品信息
-		for (SubscribeDetailVo s : list) {
-			Map<Long, ProductInfoVo> productMap = productList.stream().collect(Collectors.toMap(ProductInfoVo::getId, Function.identity()));
-			ProductInfoVo productInfo = productMap.get(s.getProductId());
-			s.setProductCode(productInfo.getCustomCode());
-			s.setProductName(productInfo.getName());
-			s.setProductType(productInfo.getType());
-			s.setProductCategory(productInfo.getClassifyName());
-			s.setProductUnit(productInfo.getUnit());
-			s.setProductDefinition(productInfo.getDefinition());
-			s.setProductCustomCode(productInfo.getCustomCode());
-			s.setProductSpec(productInfo.getSpec());
-
-			s.setProductLength(productInfo.getLength());
-			s.setProductWidth(productInfo.getWidth());
-			s.setProductHeight(productInfo.getHeight());
-		}
+        wrapper.orderByDesc("t2", SubscribeDetail::getDataType);
+        wrapper.orderByDesc("t2", SubscribeDetail::getCreateTime);
+
+        Page<SubscribeDetailVo> page = this.baseMapper.getPage(dto.getPage(), wrapper);
+        List<SubscribeDetailVo> records = page.getRecords();
+
+        if (records.size() == 0) {
+            return page;
+        }
+
+        //获取生产公司信息
+        List<Long> companyIds = records.stream().map(SubscribeDetail::getCompanyId).collect(Collectors.toList());
+        Map<Long, String> companyNameMap = DeptUstil.getDeptNameMap(companyIds);
+
+        // 赋值产品信息
+        for (SubscribeDetailVo record : records) {
+            Map<Long, ProductInfoVo> productMap = productList.stream().collect(Collectors.toMap(ProductInfoVo::getId, Function.identity()));
+            ProductInfoVo productInfo = productMap.get(record.getProductId());
+            record.setProductCode(productInfo.getCustomCode());
+            record.setProductName(productInfo.getName());
+            record.setProductType(productInfo.getType());
+            record.setProductCategory(productInfo.getClassifyName());
+            record.setProductUnit(productInfo.getUnit());
+            record.setProductDefinition(productInfo.getDefinition());
+            record.setProductCustomCode(productInfo.getCustomCode());
+            record.setProductSpec(productInfo.getSpec());
+
+            record.setProductLength(productInfo.getLength());
+            record.setProductWidth(productInfo.getWidth());
+            record.setProductHeight(productInfo.getHeight());
+
+
+            //赋值生产公司名称
+            record.setCompanyName(companyNameMap.get(record.getCompanyId()));
+        }
 
 		// 赋值采购数量
-		List<Long> subscribeDetailIds = list.stream().map(SubscribeDetail::getId).collect(Collectors.toList());
-		List<PurchaseDetailVo> purchaseDetailsList = purchaseDetailService.getPurchaseCountListBySubscribeDetailIds(subscribeDetailIds);
+        List<Long> subscribeDetailIds = records.stream().map(SubscribeDetail::getId).collect(Collectors.toList());
+        List<PurchaseDetailVo> purchaseDetailsList = purchaseDetailService.getPurchaseCountListBySubscribeDetailIds(subscribeDetailIds);
 //        List<PurchaseDetail> purchaseDetailsList = purchaseDetailService.list(q -> q.in(PurchaseDetail::getSubscribeDetailId, subscribeDetailIds));
 		Map<Long, List<PurchaseDetail>> purchaseDetailsMap = purchaseDetailsList.stream().collect(Collectors.groupingBy(PurchaseDetail::getSubscribeDetailId));
-		for (SubscribeDetailVo subscribeDetailVo : list) {
-			List<PurchaseDetail> purchaseDetails = purchaseDetailsMap.get(subscribeDetailVo.getId());
-			if (ObjectUtil.isEmpty(purchaseDetails)) {
-				subscribeDetailVo.setPurchaseCount(BigDecimal.ZERO);
-				continue;
-			}
-			BigDecimal count = purchaseDetails.stream().map(PurchaseDetail::getCount).reduce(BigDecimal.ZERO, BigDecimal::add);
-			subscribeDetailVo.setPurchaseCount(count);
-		}
-
-		corporationService.attributeAssign(list, SubscribeDetailVo::getCorporationId, (item, corporation) -> {
-			item.setCorporationName(corporation.getName());
-		});
+        for (SubscribeDetailVo subscribeDetailVo : records) {
+            List<PurchaseDetail> purchaseDetails = purchaseDetailsMap.get(subscribeDetailVo.getId());
+            if (ObjectUtil.isEmpty(purchaseDetails)) {
+                subscribeDetailVo.setPurchaseCount(BigDecimal.ZERO);
+                continue;
+            }
+            BigDecimal count = purchaseDetails.stream().map(PurchaseDetail::getCount).reduce(BigDecimal.ZERO, BigDecimal::add);
+            subscribeDetailVo.setPurchaseCount(count);
+        }
+
+        corporationService.attributeAssign(records, SubscribeDetailVo::getCorporationId, (item, corporation) -> {
+            item.setCorporationName(corporation.getName());
+        });
 
 		return page;
 	}

+ 0 - 15
hx-sale/src/main/java/com/fjhx/sale/controller/purchase/EhsdPurchaseController.java

@@ -61,13 +61,6 @@ public class EhsdPurchaseController {
         ehsdPurchaseService.add(ehsdPurchaseDto);
     }
 
-//    /**
-//     * ehsd采购表编辑
-//     */
-//    @PostMapping("/edit")
-//    public void edit(@RequestBody EhsdPurchaseDto ehsdPurchaseDto) {
-//        ehsdPurchaseService.edit(ehsdPurchaseDto);
-//    }
 
     /**
      * ehsd采购表删除
@@ -103,12 +96,4 @@ public class EhsdPurchaseController {
         return ehsdPurchaseService.getProductPriceInfo(dto);
     }
 
-    /**
-     * 采购pdf
-     */
-    @PostMapping("/getPurchaseDtoPdfInfo")
-    private void getPurchaseDtoPdfInfo(@RequestBody EhsdPurchaseDto dto) {
-        //
-    }
-
 }

+ 10 - 8
hx-sale/src/main/java/com/fjhx/sale/entity/purchase/vo/EhsdPurchaseVo.java

@@ -85,13 +85,15 @@ public class EhsdPurchaseVo extends EhsdPurchase {
 	 */
 	private String createUserName;
 
-	/**
-	 * 创建人手机
-	 */
-	private String createUserPhone;
+    /**
+     * 创建人手机
+     */
+    private String createUserPhone;
 
-	/**
-	 * 卖方传真
-	 */
-	private String sellCorporationFax;
+    /**
+     * 卖方传真
+     */
+    private String sellCorporationFax;
+
+    private String companyName;
 }

+ 10 - 0
hx-sale/src/main/java/com/fjhx/sale/service/purchase/impl/EhsdPurchaseServiceImpl.java

@@ -66,6 +66,7 @@ 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.fjhx.tenant.utils.DeptUstil;
 import com.ruoyi.common.core.domain.BasePo;
 import com.ruoyi.common.core.domain.BaseSelectDto;
 import com.ruoyi.common.core.domain.entity.SysUser;
@@ -192,6 +193,15 @@ public class EhsdPurchaseServiceImpl extends ServiceImpl<EhsdPurchaseMapper, Ehs
         //赋值用户名称
         UserUtil.assignmentNickName(records, EhsdPurchase::getCreateUser, EhsdPurchase::setUserName);
 
+        //获取生产公司信息
+        List<Long> companyIds = records.stream().map(EhsdPurchase::getCompanyId).collect(Collectors.toList());
+        Map<Long, String> companyNameMap = DeptUstil.getDeptNameMap(companyIds);
+
+        for (EhsdPurchaseVo record : records) {
+            //赋值生产公司名称
+            record.setCompanyName(companyNameMap.get(record.getCompanyId()));
+        }
+
         return page;
     }
 

+ 5 - 0
hx-supply/src/main/java/com/fjhx/supply/entity/supplier/po/SupplierPrice.java

@@ -37,4 +37,9 @@ public class SupplierPrice extends BasePo {
      */
     private BigDecimal price;
 
+    /**
+     * 归属公司id
+     */
+    private Long companyId;
+
 }

+ 2 - 1
hx-supply/src/main/java/com/fjhx/supply/entity/supplier/vo/SupplierInfoVo.java

@@ -1,6 +1,5 @@
 package com.fjhx.supply.entity.supplier.vo;
 
-import com.fjhx.area.service.ISetAreaName;
 import com.fjhx.area.service.SetCustomizeAreaName;
 import com.fjhx.supply.entity.supplier.po.SupplierInfo;
 import lombok.Getter;
@@ -22,4 +21,6 @@ public class SupplierInfoVo extends SupplierInfo implements SetCustomizeAreaName
 
     private String cityName;
 
+    private String companyName;
+
 }

+ 2 - 0
hx-supply/src/main/java/com/fjhx/supply/entity/supplier/vo/SupplierPriceVo.java

@@ -65,4 +65,6 @@ public class SupplierPriceVo extends SupplierPrice {
      */
     private String supplierName;
 
+    private String companyName;
+
 }

+ 20 - 6
hx-supply/src/main/java/com/fjhx/supply/service/supplier/impl/SupplierInfoServiceImpl.java

@@ -21,6 +21,7 @@ import com.fjhx.supply.utils.CodeEnum;
 import com.fjhx.tenant.entity.dict.dto.DictTenantDataSelectDto;
 import com.fjhx.tenant.entity.dict.vo.DictTenantDataVo;
 import com.fjhx.tenant.service.dict.DictTenantDataService;
+import com.fjhx.tenant.utils.DeptUstil;
 import com.ruoyi.common.core.domain.BaseSelectDto;
 import com.ruoyi.common.exception.ServiceException;
 import com.ruoyi.common.utils.SecurityUtils;
@@ -29,10 +30,7 @@ import com.ruoyi.common.utils.wrapper.SqlField;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 import java.util.stream.Collectors;
 
 
@@ -65,8 +63,13 @@ public class SupplierInfoServiceImpl extends ServiceImpl<SupplierInfoMapper, Sup
                 new SqlField("si", SupplierInfo::getCode)
         );
 
-        //权限过滤:供应商自己看自己
-        wrapper.eq("si", SupplierInfo::getCompanyId, SecurityUtils.getCompanyId());
+        //权限过滤:供应商自己看自己,总公司看全部
+        Long companyId = SecurityUtils.getCompanyId();
+        if (!Objects.equals(companyId, 100L)) {
+            wrapper.eq("si", SupplierInfo::getCompanyId, companyId);
+        } else {
+            wrapper.eq("si", SupplierInfo::getCompanyId, dto.getCompanyId());
+        }
 
         wrapper.orderByDesc("si", SupplierInfo::getId);
 
@@ -77,6 +80,17 @@ public class SupplierInfoServiceImpl extends ServiceImpl<SupplierInfoMapper, Sup
             return page;
         }
         CustomizeAreaUtil.setAreaName(records);
+
+
+        //获取归属公司信息
+        List<Long> companyIds = records.stream().map(SupplierInfo::getCompanyId).collect(Collectors.toList());
+        Map<Long, String> companyNameMap = DeptUstil.getDeptNameMap(companyIds);
+
+        for (SupplierInfoVo record : records) {
+            //赋值生产公司名称
+            record.setCompanyName(companyNameMap.get(record.getCompanyId()));
+        }
+
         return page;
     }
 

+ 25 - 5
hx-supply/src/main/java/com/fjhx/supply/service/supplier/impl/SupplierPriceServiceImpl.java

@@ -1,11 +1,9 @@
 package com.fjhx.supply.service.supplier.impl;
 
-import com.baomidou.dynamic.datasource.annotation.DS;
-import com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder;
+import cn.hutool.core.util.ObjectUtil;
 import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.fjhx.common.constant.SourceConstant;
 import com.fjhx.item.entity.product.po.ProductInfo;
 import com.fjhx.item.service.product.ProductClassifyService;
 import com.fjhx.item.service.product.ProductInfoService;
@@ -17,8 +15,10 @@ import com.fjhx.supply.entity.supplier.vo.SupplierPriceAddVo;
 import com.fjhx.supply.entity.supplier.vo.SupplierPriceVo;
 import com.fjhx.supply.mapper.supplier.SupplierPriceMapper;
 import com.fjhx.supply.service.supplier.SupplierPriceService;
+import com.fjhx.tenant.utils.DeptUstil;
 import com.ruoyi.common.core.domain.BaseIdPo;
 import com.ruoyi.common.exception.ServiceException;
+import com.ruoyi.common.utils.SecurityUtils;
 import com.ruoyi.common.utils.wrapper.IWrapper;
 import com.ruoyi.common.utils.wrapper.SqlField;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -70,6 +70,9 @@ public class SupplierPriceServiceImpl extends ServiceImpl<SupplierPriceMapper, S
         wrapper.eq("si", SupplierInfo::getType, dto.getSupplierType());
         wrapper.keyword(dto, new SqlField("si.name"));
 
+        //权限过滤:供应商价格自己看自己
+        wrapper.eq("sp", SupplierPrice::getCompanyId, SecurityUtils.getCompanyId());
+
         Page<SupplierPriceVo> page = this.baseMapper.getPage(dto.getPage(), wrapper);
         List<SupplierPriceVo> records = page.getRecords();
 
@@ -92,6 +95,15 @@ public class SupplierPriceServiceImpl extends ServiceImpl<SupplierPriceMapper, S
             item.setProductClassifyName(productClassify.getName());
         });
 
+        //获取归属公司信息
+        List<Long> companyIds = records.stream().map(SupplierPrice::getCompanyId).collect(Collectors.toList());
+        Map<Long, String> companyNameMap = DeptUstil.getDeptNameMap(companyIds);
+
+        for (SupplierPriceVo record : records) {
+            //赋值生产公司名称
+            record.setCompanyName(companyNameMap.get(record.getCompanyId()));
+        }
+
 //        DynamicDataSourceContextHolder.clear();
         return page;
     }
@@ -102,6 +114,14 @@ public class SupplierPriceServiceImpl extends ServiceImpl<SupplierPriceMapper, S
 
         // 添加产品列表
         List<SupplierPrice> supplierPriceList = supplierPriceDto.getSupplierPriceList();
+        for (SupplierPrice supplierPrice : supplierPriceList) {
+            //赋值产品归属公司
+            Long companyId = supplierPrice.getCompanyId();
+            if (ObjectUtil.isEmpty(companyId)) {
+                supplierPrice.setCompanyId(SecurityUtils.getCompanyId());
+            }
+        }
+
         // 添加产品id列表
         List<Long> productInfoIdList = supplierPriceList.stream().map(SupplierPrice::getProductInfoId).collect(Collectors.toList());
 
@@ -115,7 +135,7 @@ public class SupplierPriceServiceImpl extends ServiceImpl<SupplierPriceMapper, S
 
         if (existSupplierPriceList.size() == 0) {
             supplierPriceList.forEach(item -> item.setSupplierInfoId(supplierPriceDto.getSupplierInfoId()));
-            saveBatch(supplierPriceList);
+            this.saveBatch(supplierPriceList);
             supplierPriceAddVo.setAddSuccess(true);
             return supplierPriceAddVo;
         }
@@ -135,7 +155,7 @@ public class SupplierPriceServiceImpl extends ServiceImpl<SupplierPriceMapper, S
                     supplierPrice.setId(existSupplierPrice.getId());
                 }
             }
-            saveOrUpdateBatch(supplierPriceList);
+            this.saveOrUpdateBatch(supplierPriceList);
             supplierPriceAddVo.setAddSuccess(true);
             return supplierPriceAddVo;
         }

+ 2 - 1
hx-supply/src/main/resources/mapper/supplier/SupplierPriceMapper.xml

@@ -7,7 +7,8 @@
                sp.product_info_id,
                sp.price,
                si.name supplierName,
-               si.type supplierType
+               si.type supplierType,
+               sp.company_id
         from supplier_price sp
                  inner join supplier_info si on sp.supplier_info_id = si.id
             ${ew.customSqlSegment}