From da2c594ade5d69621dd11a13bb758477e2dc079e Mon Sep 17 00:00:00 2001
From: “djh” <“3298565835@qq.com”>
Date: 星期三, 07 五月 2025 15:57:51 +0800
Subject: [PATCH] 危化品新版修改

---
 hazmat-system/src/main/java/com/gkhy/hazmat/system/service/impl/HzProductEntryRecordServiceImpl.java |   20 ++++++++++++++------
 1 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/hazmat-system/src/main/java/com/gkhy/hazmat/system/service/impl/HzProductEntryRecordServiceImpl.java b/hazmat-system/src/main/java/com/gkhy/hazmat/system/service/impl/HzProductEntryRecordServiceImpl.java
index ff9d8a7..cb70f0f 100644
--- a/hazmat-system/src/main/java/com/gkhy/hazmat/system/service/impl/HzProductEntryRecordServiceImpl.java
+++ b/hazmat-system/src/main/java/com/gkhy/hazmat/system/service/impl/HzProductEntryRecordServiceImpl.java
@@ -56,7 +56,7 @@
     @Override
     public CommonPage selectEntryRecordList(HzProductEntryRecord entryRecord) {
         SysUser currentUser = SecurityUtils.getLoginUser().getUser();
-        if (!currentUser.getUserType().equals(UserTypeEnum.SYSTEM_USER.getCode())) {
+        if (!currentUser.getUserType().equals(UserTypeEnum.SYSTEM_USER.getCode())&&!currentUser.getUserType().equals(UserTypeEnum.CHECK_USER.getCode())) {
             entryRecord.setCompanyId(currentUser.getCompanyId());
         }
         PageUtils.startPage();
@@ -160,6 +160,7 @@
             //新增危化品变动记录
             HzProductWarehouseRecord warehouseRecord = new HzProductWarehouseRecord()
                     .setWarehouseId(entryRecord.getWarehouseId())
+                    .setCupboardId(entryRecord.getCupboardId())
                     .setBasicId(productBasic.getId())
                     .setNum(entryRecord.getNum())
                     .setCompanyId(currentUser.getCompanyId())
@@ -173,6 +174,7 @@
                 String lastCode= StringUtils.addZeroForNum(String.valueOf(i),4);
                 String code=String.format("%s%s",entryRecord.getCodePrex(),lastCode);
                 productList.add(new HzProduct().setWarehouseId(entryRecord.getWarehouseId())
+                                .setCupboardId(entryRecord.getCupboardId())
                         .setBasicId(entryRecord.getBasicId())
                         .setEntryId(entryRecord.getId())
                         .setRemaining(productBasic.getMetering())
@@ -234,15 +236,19 @@
     }
 
     @Override
-    public CommonPage selectProductListByEntryId(Long entryId) {
+    public CommonPage selectProductListByEntryId(Long entryId,Long companyId) {
         SysUser currentUser = SecurityUtils.getLoginUser().getUser();
         HzProductEntryRecord entryRecord=getById(entryId);
         if(entryRecord==null){
             throw new ApiException("入库信息不存在");
         }
         checkUserAllowed(entryRecord,currentUser);
-        //设置分表id
-        IdTableNameHandler.setCurrentId(currentUser.getCompanyId());
+        if (currentUser.getUserType().equals(UserTypeEnum.CHECK_USER.getCode())){
+            IdTableNameHandler.setCurrentId(companyId);
+        }else {
+            //设置分表id
+            IdTableNameHandler.setCurrentId(currentUser.getCompanyId());
+        }
         PageUtils.startPage();
         List<HzProduct> productList = productMapper.selectProductList(new HzProduct().setEntryId(entryId));
         IdTableNameHandler.removeCurrentId();
@@ -255,8 +261,10 @@
             throw new ApiException("管理员不能操作");
         }
         if(entryRecord!=null){
-            if(!Objects.equals(user.getCompanyId(), entryRecord.getCompanyId())){
-                throw new ApiException("无权限操作其他企业数据");
+            if (!user.getUserType().equals(UserTypeEnum.CHECK_USER.getCode())){
+                if(!Objects.equals(user.getCompanyId(), entryRecord.getCompanyId())){
+                    throw new ApiException("无权限操作其他企业数据");
+                }
             }
         }
     }

--
Gitblit v1.9.2