From 96119ca3973d5ea643db6a87b6a23fe404ddb8cc Mon Sep 17 00:00:00 2001
From: shiyunteng <shiyunteng@example.com>
Date: 星期一, 29 六月 2026 15:35:40 +0800
Subject: [PATCH] feat:合同编号规则调整 出库编号规则调整

---
 platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/ProductServiceImpl.java |   72 ++++++++++++++++++++++++-----------
 1 files changed, 49 insertions(+), 23 deletions(-)

diff --git a/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/ProductServiceImpl.java b/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/ProductServiceImpl.java
index 75b1d87..72ead27 100644
--- a/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/ProductServiceImpl.java
+++ b/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/ProductServiceImpl.java
@@ -3,19 +3,21 @@
 import cn.hutool.core.lang.tree.Tree;
 import cn.hutool.core.lang.tree.TreeNode;
 import cn.hutool.core.lang.tree.TreeUtil;
-import cn.hutool.core.util.StrUtil;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.by4cloud.platformx.business.dto.ProductQueryDTO;
 import com.by4cloud.platformx.business.entity.Product;
 import com.by4cloud.platformx.business.mapper.ProductMapper;
 import com.by4cloud.platformx.business.service.ProductService;
+import com.by4cloud.platformx.business.vo.ProductSelectVo;
+import com.by4cloud.platformx.common.core.util.R;
+import com.by4cloud.platformx.common.data.datascope.DataScope;
 import jakarta.validation.constraints.NotNull;
-import org.springframework.beans.BeanUtils;
 import org.springframework.stereotype.Service;
 
-import java.util.HashMap;
+
+import java.util.Arrays;
 import java.util.List;
-import java.util.Map;
 import java.util.function.Function;
 import java.util.stream.Collectors;
 
@@ -28,29 +30,36 @@
 @Service
 public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product> implements ProductService {
     @Override
-    public List<Tree<Long>> treeList(Long parentId, String productName) {
-        Long parent = parentId == null ? 0l : parentId;
-
+    public List<Tree<Long>> treeList() {
         List<TreeNode<Long>> collect = baseMapper
-                .selectList(Wrappers.<Product>lambdaQuery()
-                        .like(StrUtil.isNotBlank(productName), Product::getProductName, productName)
-                        .orderByAsc(Product::getCreateTime))
+                .selectListByScope(Wrappers.<Product>lambdaQuery()
+                        .orderByAsc(Product::getCreateTime), DataScope.of("comp_id"))
                 .stream().map(getNodeFunction()).collect(Collectors.toList());
 
         // 妯$硦鏌ヨ 涓嶇粍瑁呮爲缁撴瀯 鐩存帴杩斿洖 琛ㄦ牸鏂逛究缂栬緫
-        if (StrUtil.isNotBlank(productName)) {
-            return collect.stream().map(node -> {
-                Tree<Long> tree = new Tree<>();
-                tree.putAll(node.getExtra());
-                BeanUtils.copyProperties(node, tree);
-                return tree;
-            }).collect(Collectors.toList());
-        }
-
-        return TreeUtil.build(collect, parent);
+//        if (StrUtil.isNotBlank(productName)) {
+//            return collect.stream().map(node -> {
+//                Tree<Long> tree = new Tree<>();
+//                tree.putAll(node.getExtra());
+//                BeanUtils.copyProperties(node, tree);
+//                return tree;
+//            }).collect(Collectors.toList());
+//        }
+		TreeNode<Long> parent = new TreeNode<>();
+		parent.setId(0L);
+		parent.setName("鐩綍");
+		parent.setParentId(-1L);
+		collect.add(parent);
+        return TreeUtil.build(collect, 0L);
     }
 
-    @NotNull
+	@Override
+	public List<ProductSelectVo> getProductList(Product product) {
+		return baseMapper.getProductListByScope(product,DataScope.of("comp_id"));
+	}
+
+
+	@NotNull
     private Function<Product, TreeNode<Long>> getNodeFunction() {
         return product -> {
             TreeNode<Long> node = new TreeNode<>();
@@ -59,7 +68,7 @@
             node.setParentId(product.getParentId());
             //node.setWeight(product.getParentId());
             // 鎵╁睍灞炴��
-            Map<String, Object> extra = new HashMap<>();
+//            Map<String, Object> extra = new HashMap<>();
 //            extra.put("picPath", category.getPicPath());
 //            extra.put("Type", category.getType());
 //            extra.put("isShow", category.getIsShow());
@@ -67,7 +76,7 @@
 //            extra.put("status", category.getStatus());
 
             // 閫傞厤 vue3
-            Map<String, Object> meta = new HashMap<>();
+//            Map<String, Object> meta = new HashMap<>();
            /* meta.put("title", product.getProductName());
             meta.put("icon", product.getPrice());*/
 
@@ -76,4 +85,21 @@
             return node;
         };
     }
+
+	@Override
+	public R getProductListByParentId(ProductQueryDTO queryDTO) {
+		String[] erpCodes = new String[]{"鎴跨绉熻祦","dianli","water"};
+//		MPJLambdaWrapper<Product> wrapper = new MPJLambdaWrapper<Product>()
+//				.selectAs("( SELECT count(1) FROM product t1 WHERE t1.parent_id = t.id )",Product::getChildNum)
+//				.selectAll(Product.class)
+//				.like(StrUtil.isNotEmpty(queryDTO.getProductName()),Product::getProductName,queryDTO.getProductName())
+//        		.eq(StrUtil.isNotEmpty(queryDTO.getParentId()),Product::getParentId,queryDTO.getParentId())
+//				.in(StrUtil.isNotEmpty(queryDTO.getContractCategory())&&StrUtil.equals(queryDTO.getContractCategory(), "water_house"),
+//						Product::getErpCode,erpCodes);
+		List<ProductSelectVo> selectVos = baseMapper.getProductListByParentId(queryDTO, Arrays.asList(erpCodes),DataScope.of("comp_id"));
+		if (selectVos.size()>2000){
+			return R.ok(selectVos.subList(0,1999));
+		}
+		return R.ok(selectVos);
+	}
 }
\ No newline at end of file

--
Gitblit v1.9.1