已修改5个文件
76 ■■■■ 文件已修改
iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/controller/admin/DaPointController.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/service/impl/DaPointServiceImpl.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/controller/admin/MpkFileController.java 9 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/service/impl/MethodSettingServiceImpl.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/service/impl/MpkFileServiceImpl.java 58 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/controller/admin/DaPointController.java
@@ -20,7 +20,6 @@
import io.swagger.v3.oas.annotations.Parameters;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
@@ -111,7 +110,6 @@
    @PreAuthorize("@ss.hasPermission('data:point:update')")
    @PutMapping("/enable")
    @Operation(summary = "启用")
    @Transactional
    public CommonResult<Boolean> enable(@RequestBody String[] ids) {
        daPointService.enableByIds(ids);
        return success(true);
@@ -120,7 +118,6 @@
    @PreAuthorize("@ss.hasPermission('data:point:update')")
    @PutMapping("/disable")
    @Operation(summary = "禁用")
    @Transactional
    public CommonResult<Boolean> disable(@RequestBody String[] ids) {
        daPointService.disableByIds(ids);
        return success(true);
iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/service/impl/DaPointServiceImpl.java
@@ -402,6 +402,7 @@
    }
    @Override
    @DSTransactional(rollbackFor = Exception.class)
    public void enableByIds(String[] ids) {
        if (CollectionUtils.isEmpty(Arrays.asList(ids))) {
            return;
@@ -410,11 +411,13 @@
            DaPointEntity entity = new DaPointEntity();
            entity.setId(item);
            entity.setIsEnable(IsEnableEnum.ENABLE.getCode());
            entity.setUpdateTime(new Date());
            daPointDao.updateById(entity);
        });
    }
    @Override
    @DSTransactional(rollbackFor = Exception.class)
    public void disableByIds(String[] ids) {
        if (CollectionUtils.isEmpty(Arrays.asList(ids))) {
            return;
@@ -423,6 +426,7 @@
            DaPointEntity entity = new DaPointEntity();
            entity.setId(item);
            entity.setIsEnable(IsEnableEnum.DISABLE.getCode());
            entity.setUpdateTime(new Date());
            daPointDao.updateById(entity);
        });
    }
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/controller/admin/MpkFileController.java
@@ -7,6 +7,7 @@
import com.iailab.module.model.mpk.service.PackService;
import io.swagger.v3.oas.annotations.Operation;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.util.CollectionUtils;
@@ -47,8 +48,12 @@
    public CommonResult<MpkFileDTO> info(@PathVariable("id") String id) {
        MpkFileDTO schedule = mpkFileService.get(id);
        List<String> menuAndGroup = new ArrayList<>();
        menuAndGroup.add(schedule.getMenuName());
        menuAndGroup.add(schedule.getGroupName());
        if (StringUtils.isNotBlank(schedule.getMenuName())) {
            menuAndGroup.add(schedule.getMenuName());
        }
        if (StringUtils.isNotBlank(schedule.getGroupName())) {
            menuAndGroup.add(schedule.getGroupName());
        }
        schedule.setMenuAndGroup(menuAndGroup);
        return success(schedule);
    }
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/service/impl/MethodSettingServiceImpl.java
@@ -37,7 +37,7 @@
            MethodSettingEntity entity = entityList.get(i);
            if (StringUtils.isNotBlank(entity.getValue())){
                // 去掉空格
                entity.setValue(entity.getValue().trim().replace("\\s+", ""));
                entity.setValue(entity.getValue().trim().replaceAll("\\s+", ""));
            }
            entity.setId(UUID.randomUUID().toString());
            entity.setMethodId(MethodId);
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/service/impl/MpkFileServiceImpl.java
@@ -166,36 +166,36 @@
    @Override
    @DSTransactional(rollbackFor = Exception.class)
    public void update(MpkFileDTO dto) {
        // 判断py文件是否修改
        MpkFileEntity oldEntity = selectById(dto.getId());
        if (!oldEntity.getFilePath().equals(dto.getFilePath())) {
            // 将备份的pyd文件,转移到MDK_PKGS环境变量下,并添加方法的默认参数(pyFile,模型路径)
            String mdkPkgs = System.getenv("MDK_PKGS");
            String fileName = dto.getFilePath().substring(dto.getFilePath().lastIndexOf("\\") + 1,dto.getFilePath().lastIndexOf(".pyd"));
            String pyFilePath = mdkPkgs + File.separator + dto.getPyModule().replace(".", File.separator) + File.separator + fileName + ".pyd";
        // 添加方法的默认参数(pyFile,模型路径)
        String mdkPkgs = System.getenv("MDK_PKGS");
        String fileName = dto.getFilePath().substring(dto.getFilePath().lastIndexOf("\\") + 1,dto.getFilePath().lastIndexOf(".pyd"));
        String pyFilePath = mdkPkgs + File.separator + dto.getPyModule().replace(".", File.separator) + File.separator + fileName + ".pyd";
        // 判断文件是否存在,不存在的话将备份的pyd文件,转移到MDK_PKGS环境变量下
        File pyFile = new File(pyFilePath);
        if (!pyFile.exists()) {
            FileUtil.mkParentDirs(pyFilePath);
            FileUtil.copy(dto.getFilePath(), pyFilePath, true);
        }
            // 添加/修改参数
            for (ModelMethodDTO method : dto.getModelMethods()) {
                List<MethodSettingDTO> methodSettings = method.getMethodSettings();
                if (methodSettings.stream().anyMatch(e -> e.getSettingKey().equals(MdkConstant.PY_FILE_KEY))) {
                    methodSettings.forEach(e -> {
                        if (e.getSettingKey().equals(MdkConstant.PY_FILE_KEY)) {
                            e.setValue(dto.getPyModule() + "." + fileName);
                        }
                    });
                }else {
                    MethodSettingDTO setting = new MethodSettingDTO();
                    setting.setId(UUID.randomUUID().toString());
                    setting.setMethodId(method.getId());
                    setting.setSettingKey(MdkConstant.PY_FILE_KEY);
                    setting.setValue(dto.getPyModule() + "." + fileName);
                    setting.setName("模型路径");
                    setting.setType("input");
                    setting.setValueType("string");
                    methodSettings.add(setting);
                }
        // 添加/修改参数
        for (ModelMethodDTO method : dto.getModelMethods()) {
            List<MethodSettingDTO> methodSettings = method.getMethodSettings();
            if (methodSettings.stream().anyMatch(e -> e.getSettingKey().equals(MdkConstant.PY_FILE_KEY))) {
                methodSettings.forEach(e -> {
                    if (e.getSettingKey().equals(MdkConstant.PY_FILE_KEY)) {
                        e.setValue(dto.getPyModule() + "." + fileName);
                    }
                });
            }else {
                MethodSettingDTO setting = new MethodSettingDTO();
                setting.setId(UUID.randomUUID().toString());
                setting.setMethodId(method.getId());
                setting.setSettingKey(MdkConstant.PY_FILE_KEY);
                setting.setValue(dto.getPyModule() + "." + fileName);
                setting.setName("模型路径");
                setting.setType("input");
                setting.setValueType("string");
                methodSettings.add(setting);
            }
        }
@@ -300,7 +300,7 @@
        GenUtils.drawTemplate("Jni.h.vm", dataContext, jniHFile);
        // 添加python源文件
        String pyFilePath = dirPath.getAbsolutePath() + File.separator + MdkConstant.ALGS + File.separator + entity.getPyModule().replace(".", File.separator) + File.separator + entity.getPyName() + ".pyd";
        String pyFilePath = dirPath.getAbsolutePath() + File.separator + MdkConstant.ALGS + File.separator + entity.getPyModule().replace(".", File.separator) + File.separator + entity.getFilePath().substring(entity.getFilePath().lastIndexOf("\\"));
        FileUtil.mkParentDirs(pyFilePath);
        FileUtil.copy(entity.getFilePath(), pyFilePath, true);
@@ -434,7 +434,7 @@
            GenUtils.drawTemplate("Jni.h.vm", dataContext, jniHFile);
            // 添加python源文件
            String pyFilePath = dirPath.getAbsolutePath() + File.separator + MdkConstant.ALGS + File.separator + entity.getPyModule().replace(".", File.separator) + File.separator + entity.getPyName() + ".pyd";
            String pyFilePath = dirPath.getAbsolutePath() + File.separator + MdkConstant.ALGS + File.separator + entity.getPyModule().replace(".", File.separator) + File.separator + entity.getFilePath().substring(entity.getFilePath().lastIndexOf("\\"));
            FileUtil.mkParentDirs(pyFilePath);
            FileUtil.copy(entity.getFilePath(), pyFilePath, true);
        }