lyh
2025-06-25 e756af0f5bfd1addbd5d5c145441fb34aad91a28
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DataImportService.java
@@ -2,11 +2,13 @@
import cn.hutool.core.util.StrUtil;
import com.jeecg.weibo.exception.BusinessException;
import liquibase.pro.packaged.S;
import org.jeecg.modules.dnc.dto.ComponentHierarchy;
import org.jeecg.modules.dnc.dto.TransferPackage;
import org.jeecg.modules.dnc.entity.*;
import org.jeecg.modules.dnc.mapper.*;
import org.jeecg.modules.dnc.service.*;
import org.jeecg.modules.system.entity.MdcProduction;
import org.jeecg.modules.system.service.IMdcProductionService;
import org.jeecg.modules.system.service.ISysUserService;
import org.slf4j.Logger;
@@ -286,20 +288,22 @@
    private void savePermissionStreamNewList(List<PermissionStreamNew> permissionStreamNewList) {
        for (PermissionStreamNew permissionStreamNew : permissionStreamNewList) {
            if (permissionStreamNew.getUserId() != null) {
                String id=sysUserService.getUserByName(permissionStreamNew.getUserId()).getId();
                if (id!=null){
                    permissionStreamNew.setUserId(id);
            if (permissionStreamNewMapper.selectById(permissionStreamNew.getId()) == null) {
                if (permissionStreamNew.getUserId() != null) {
                    String id=sysUserService.getUserByName(permissionStreamNew.getUserId()).getId();
                    if (id!=null){
                        permissionStreamNew.setUserId(id);
                    }
                }
            }
            if (permissionStreamNew.getDepartId() != null) {
                String id=mdcProductionService.findByOrgCode(permissionStreamNew.getDepartId()).getId();
                if (id!=null){
                permissionStreamNew.setDepartId(id);
                if (permissionStreamNew.getDepartId() != null) {
                    MdcProduction mdcProduction=mdcProductionService.findByOrgCode(permissionStreamNew.getDepartId());
                    if (mdcProduction!=null){
                        permissionStreamNew.setDepartId(mdcProduction.getId());
                    }
                }
                permissionStreamNewMapper.insert(permissionStreamNew);
                logger.debug("权限已保存: {}", permissionStreamNew.getId());
            }
            permissionStreamNewMapper.insert(permissionStreamNew);
            logger.debug("权限已保存: {}", permissionStreamNew.getId());
        }
        //分批添加产品、部件、零件、工艺规程、工序、工步权限
        permissionStreamNewList.forEach(item -> {
@@ -383,7 +387,7 @@
                        workStepDepartmentService.save(workStepDepartment);
                    }
                    break;
                    default:
                default:
            }
        });
    }
@@ -446,6 +450,7 @@
    private void saveGuideCardBatch(GuideCardBatch guideCardBatch) {
        if (guideCardBatchMapper.selectById(guideCardBatch.getId()) == null) {
            guideCardBatch.setFlowStatus("1");
            guideCardBatchMapper.insert(guideCardBatch);
            logger.debug("刀片批次已保存: {}", guideCardBatch.getId());
        } else {