危化品全生命周期管理后端
“djh”
2025-04-21 437f8e2b89a18363a1073fdbb3ab99bcd840a757
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();
@@ -236,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();
@@ -257,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("无权限操作其他企业数据");
                }
            }
        }
    }