From 46adcbf7494340a495539708210bb39110bdc33b Mon Sep 17 00:00:00 2001
From: czt <czt18638530771@163.com>
Date: 星期六, 29 十一月 2025 17:35:03 +0800
Subject: [PATCH] 快速登记、化验及称重作业页面提交1

---
 fzzy-igdss-core/src/main/java/com/fzzy/igds/service/CoreDeptService.java |   44 +++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 39 insertions(+), 5 deletions(-)

diff --git a/fzzy-igdss-core/src/main/java/com/fzzy/igds/service/CoreDeptService.java b/fzzy-igdss-core/src/main/java/com/fzzy/igds/service/CoreDeptService.java
index d376ebb..9a33407 100644
--- a/fzzy-igdss-core/src/main/java/com/fzzy/igds/service/CoreDeptService.java
+++ b/fzzy-igdss-core/src/main/java/com/fzzy/igds/service/CoreDeptService.java
@@ -1,10 +1,13 @@
 package com.fzzy.igds.service;
 
+import com.fzzy.igds.constant.Constant;
 import com.fzzy.igds.domain.Dept;
 import com.fzzy.igds.repository.DeptRepository;
 import com.fzzy.igds.utils.ContextUtil;
 import com.ruoyi.common.core.domain.entity.SysDept;
+import com.ruoyi.common.core.domain.entity.SysUser;
 import com.ruoyi.common.utils.StringUtils;
+import com.ruoyi.system.service.ISysDeptService;
 import org.springframework.stereotype.Service;
 import javax.annotation.Resource;
 import java.util.Date;
@@ -19,19 +22,43 @@
 public class CoreDeptService {
 
     @Resource
+    private ISysDeptService iSysDeptService;
+    @Resource
     private DeptRepository deptRepository;
+    @Resource
+    private InoutConfService inoutConfService;
+
 
     /**
      * jpa鏌ヨ淇℃伅
-     * @param companyId
+     * @param parentId
      * @return
      */
-    public List<Dept> getAllData(String companyId) {
+    public List<Dept> getDataByParentId(String parentId) {
+        return deptRepository.getDataByParentId(parentId + "%");
+    }
 
-        if (StringUtils.isEmpty(companyId)) {
-            companyId = ContextUtil.getCompanyId();
+
+    /**
+     * jpa鏌ヨ淇℃伅
+     * @return
+     */
+    public List<Dept> getAllDeptData() {
+        return deptRepository.getAllData(ContextUtil.getCompanyId());
+    }
+
+    /**
+     * jpa鏌ヨ淇℃伅
+     * @return
+     */
+    public List<Dept> getDeptData() {
+        SysUser user = ContextUtil.getLoginUser();
+        SysDept userDept = iSysDeptService.selectDeptById(user.getDeptId());
+        if (Constant.DEPT_TYPE_20.equals(userDept.getType())) {
+            return deptRepository.getDataById(ContextUtil.subDeptId(user));
+        }else {
+            return deptRepository.getDataByParentId(user.getDeptId() + "%");
         }
-        return deptRepository.getAllData(companyId);
     }
 
     /**
@@ -53,6 +80,9 @@
         dept.setCreateTime(new Date());
 
         this.update(dept);
+
+        //鐢熸垚鍑哄叆搴撴祦绋嬮厤缃俊鎭�
+        inoutConfService.initSysConfData(sysDept.getCompanyId(), dept.getId());
     }
 
     /**
@@ -76,6 +106,10 @@
      * @return
      */
     public void delData(String deptId) {
+        //鍒犻櫎搴撳尯淇℃伅
         deptRepository.deleteById(deptId);
+
+        //鍒犻櫎娴佺▼閰嶇疆淇℃伅
+        inoutConfService.delSysConfData(deptId);
     }
 }
\ No newline at end of file

--
Gitblit v1.9.3