From ddc0f14384619b9618f26a3f363f679833a68b3d Mon Sep 17 00:00:00 2001
From: yangbin <yangbin@qq.com>
Date: 星期三, 16 四月 2025 09:51:32 +0800
Subject: [PATCH] 自动化产线集成模块添加数据查询

---
 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ComponentInfoSeServiceImpl.java |   36 +++++++++++++++++++++++-------------
 1 files changed, 23 insertions(+), 13 deletions(-)

diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ComponentInfoSeServiceImpl.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ComponentInfoSeServiceImpl.java
index 486ed9f..2c31d2c 100644
--- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ComponentInfoSeServiceImpl.java
+++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ComponentInfoSeServiceImpl.java
@@ -1,6 +1,5 @@
 package org.jeecg.modules.dnc.service.impl;
 
-import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
@@ -8,7 +7,7 @@
 import org.apache.shiro.SecurityUtils;
 import org.jeecg.common.system.vo.LoginUser;
 import org.jeecg.modules.dnc.dto.ComponentExt;
-
+import org.jeecg.modules.dnc.entity.*;
 import org.jeecg.modules.dnc.exception.ExceptionCast;
 import org.jeecg.modules.dnc.mapper.ComponentInfoMapper;
 import org.jeecg.modules.dnc.mapper.ProductInfoMapper;
@@ -16,23 +15,16 @@
 import org.jeecg.modules.dnc.response.ComponentInfoCode;
 import org.jeecg.modules.dnc.response.ProductInfoCode;
 import org.jeecg.modules.dnc.response.UcenterCode;
-
 import org.jeecg.modules.dnc.service.*;
-import org.jeecg.modules.dnc.ucenter.Department;
 import org.jeecg.modules.dnc.utils.ValidateUtil;
-import org.jeecg.modules.dnc.entity.*;
 import org.jeecg.modules.system.entity.MdcProduction;
 import org.jeecg.modules.system.entity.SysUser;
-import org.jeecg.modules.dnc.entity.ComponentInfo;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.annotation.Lazy;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
+import java.util.*;
 
 @Service
 public class ComponentInfoSeServiceImpl extends ServiceImpl<ComponentInfoMapper, ComponentInfo> implements IComponentInfoService {
@@ -50,7 +42,7 @@
     @Autowired
     private IProcessStreamService processStreamService;
     @Autowired
-    private IDocInfoService docInfoService;
+    private IProductMixService productMixService;
     @Autowired
     private IDocRelativeService iDocRelativeService;
     @Autowired
@@ -125,13 +117,23 @@
         if (!b) {
             ExceptionCast.cast(ProductInfoCode.PRODUCT_SAVE_ERROR);
         }
-        //鍘婚櫎榛樿鏂板宸ュ簭锛岃浆涓烘墜鍔ㄦ坊鍔�
+        //娣诲姞缁撴瀯鏍�
+        ProductMix productMix=null;
+        if (componentInfo.getParentId() != null) {
+            //瀛愰儴浠�
+            productMix = new ProductMix(Long.parseLong(componentInfo.getComponentId()),Long.parseLong(componentInfo.getParentId())
+                    ,componentInfo.getComponentName(),componentInfo.getComponentCode(),2,new Date());
+        }else {
+            productMix = new ProductMix(Long.parseLong(componentInfo.getComponentId()),Long.parseLong(productInfo.getProductId())
+                    ,componentInfo.getComponentName(),componentInfo.getComponentCode(),2,new Date());
+        }
+        productMixService.save(productMix);
         //娣诲姞鏉冮檺
         PermissionStreamNew stream = new PermissionStreamNew();
         stream.setUserId(userId);
         stream.setBusinessId(componentInfo.getComponentId());
         stream.setBusinessType("2");
-        return permissionStreamNewService.save(stream);
+        return permissionStreamNewService.addPermissionStreamNew(stream);
     }
 
     @Override
@@ -154,6 +156,11 @@
         componentInfo.setRankLevel(null);
         componentInfo.setProductId(null);
         boolean b = super.updateById(componentInfo);
+        //鍚屾淇敼缁撴瀯鏍�
+        ProductMix productMix = productMixService.getById(Long.parseLong(id));
+        productMix.setName(componentInfo.getComponentName());
+        productMix.setCode(componentInfo.getComponentCode());
+        productMixService.updateById(productMix);
         if(!b)
             return false;
         ComponentPermission permission = componentPermissionService.getByComponentIdAndUserId(id, userId);
@@ -278,6 +285,9 @@
         b = permissionStreamNewService.deletePermissionStreamNewByBusinessId(componentInfo.getComponentId(),"2","1");
         if(!b)
             ExceptionCast.cast(CommonCode.FAIL);
+        b = productMixService.removeById(id);
+        if (!b)
+            ExceptionCast.cast(CommonCode.FAIL);
         return super.removeById(id);
     }
 

--
Gitblit v1.9.3