lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentServiceImpl.java
@@ -25,6 +25,7 @@
import org.jeecg.modules.mdc.model.MdcEquipmentTree;
import org.jeecg.modules.mdc.service.*;
import org.jeecg.modules.mdc.util.DateUtils;
import org.jeecg.modules.mdc.util.DncCopyEquipment;
import org.jeecg.modules.mdc.util.FindsEquipmentDepartUtil;
import org.jeecg.modules.mdc.util.FindsEquipmentProductionUtil;
import org.jeecg.modules.mdc.vo.*;
@@ -34,14 +35,19 @@
import org.jeecg.modules.system.mapper.MdcProductionEquipmentMapper;
import org.jeecg.modules.system.service.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.io.File;
import java.io.IOException;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.nio.file.Files;
import java.nio.file.StandardCopyOption;
import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.Stream;
@@ -99,6 +105,9 @@
    @Resource
    private DncDevicePermissionMapper dncDevicePermissionMapper;
    @Value("${fileNCPath}")
    private String fileNCPath;
    @Override
@@ -194,6 +203,14 @@
                    break;
            }
        }
        //平移设备目录下现有结构与文件
        //获取原有结构
        String OldPath="";
        String NewPath="";
        List<String> OldStrings=mdcProductionService.findListParentTreeAll(mdcEquipment.getId());
        if (OldStrings != null && !OldStrings.isEmpty()) {
            OldPath = fileNCPath+"/"+StringUtils.join(OldStrings.toArray(), "/")+"/"+mdcEquipment.getEquipmentId();
        }
        //step.1 修改设备基础信息
        this.updateById(mdcEquipment);
        //step.2 修改部门
@@ -226,6 +243,13 @@
                mdcProductionEquipmentMapper.insert(productionEquipment);
            }
        }
        List<String> NewStrings = mdcProductionService.findListParentTreeAll(mdcEquipment.getId());
        if (NewStrings != null && !NewStrings.isEmpty()) {
            NewPath = fileNCPath+"/"+StringUtils.join(NewStrings.toArray(), "/")+"/"+mdcEquipment.getEquipmentId();
        }
        // 平移OldPath下的文件到NewPath下
        DncCopyEquipment.CopyEquipmentPath(OldPath,NewPath);
        //保存设备对应的产线权限
        addDevicePermission(mdcEquipment);
        //step.4 修改设备权限
        LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();