iailab-module-model/iailab-module-model-biz/db/mysql.sql
@@ -493,9 +493,10 @@ `data_length` int NULL DEFAULT 1 COMMENT '输入个数', `model` int NULL DEFAULT 0 COMMENT '是否有model(0:否,1:是)', `result_key` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '结果key', `sort` integer, PRIMARY KEY (`id`, `mpk_file_id`) USING BTREE, INDEX `id`(`id` ASC) USING BTREE, INDEX `del_method`(`mpk_file_id` ASC) USING BTREE, INDEX `idx_method`(`mpk_file_id` ASC) USING BTREE, CONSTRAINT `del_method` FOREIGN KEY (`mpk_file_id`) REFERENCES `t_mpk_file` (`id`) ON DELETE CASCADE ON UPDATE RESTRICT ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic; @@ -513,6 +514,7 @@ `value_type` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '参数类型', `max` int NULL DEFAULT NULL COMMENT '最大值', `min` int NULL DEFAULT NULL COMMENT '最小值', `sort` integer, PRIMARY KEY (`id`, `method_id`) USING BTREE, INDEX `del_setting`(`method_id` ASC) USING BTREE, INDEX `id`(`id` ASC) USING BTREE, @@ -529,6 +531,7 @@ `setting_id` varchar(36) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '参数id', `select_key` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT 'key', `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '名称', `sort` integer, PRIMARY KEY (`id`, `setting_id`) USING BTREE, INDEX `del_select`(`setting_id` ASC) USING BTREE, CONSTRAINT `del_select` FOREIGN KEY (`setting_id`) REFERENCES `t_mpk_method_setting` (`id`) ON DELETE CASCADE ON UPDATE RESTRICT @@ -596,4 +599,31 @@ PRIMARY KEY (`id`, `project_id`) USING BTREE, INDEX `del_package_model`(`project_id` ASC) USING BTREE, CONSTRAINT `del_package_model` FOREIGN KEY (`project_id`) REFERENCES `t_mpk_project` (`id`) ON DELETE CASCADE ON UPDATE RESTRICT ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '打包历史模型关联表' ROW_FORMAT = Dynamic; ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '打包历史模型关联表' ROW_FORMAT = Dynamic; DROP TABLE IF EXISTS `t_mpk_icon`; CREATE TABLE `t_mpk_icon` ( `id` varchar(36) NOT NULL COMMENT 'id', `icon_name` varchar(36) NOT NULL COMMENT '图标名称', `icon_desc` varchar(36) DEFAULT NULL COMMENT '图标描述', `sort` integer DEFAULT NULL COMMENT '排序', PRIMARY KEY (`id`) USING BTREE ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = 'MDK平台图标' ROW_FORMAT = Dynamic; DROP TABLE IF EXISTS `t_mpk_file_menu`; CREATE TABLE `t_mpk_file_menu` ( `id` varchar(36) NOT NULL COMMENT 'id', `name` varchar(36) NOT NULL COMMENT '名称', `sort` integer DEFAULT NULL COMMENT '排序', PRIMARY KEY (`id`) USING BTREE ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '模型文件菜单' ROW_FORMAT = Dynamic; DROP TABLE IF EXISTS `t_mpk_file_group`; CREATE TABLE `t_mpk_file_group` ( `id` varchar(36) NOT NULL COMMENT 'id', `menu_id` varchar(36) NOT NULL COMMENT '菜单', `name` varchar(36) NOT NULL COMMENT '名称', `sort` integer DEFAULT NULL COMMENT '排序', PRIMARY KEY (`id`) USING BTREE ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '模型文件分组' ROW_FORMAT = Dynamic; iailab-module-model/iailab-module-model-biz/pom.xml
@@ -22,32 +22,59 @@ </properties> <dependencies> <dependency> <groupId>com.iailab</groupId> <artifactId>iailab-common-env</artifactId> </dependency> <dependency> <groupId>com.iailab</groupId> <artifactId>iailab-module-data-api</artifactId> <version>${revision}</version> </dependency> <!-- 依赖服务 --> <dependency> <groupId>com.iailab</groupId> <artifactId>iailab-common</artifactId> <artifactId>iailab-module-infra-api</artifactId> <version>${revision}</version> </dependency> <dependency> <groupId>com.iailab</groupId> <artifactId>iailab-common-mybatis</artifactId> <artifactId>iailab-module-system-api</artifactId> <version>${revision}</version> </dependency> <!-- 业务组件 --> <dependency> <groupId>com.iailab</groupId> <artifactId>iailab-common-biz-data-permission</artifactId> </dependency> <dependency> <groupId>com.iailab</groupId> <artifactId>iailab-common-redis</artifactId> <artifactId>iailab-common-biz-tenant</artifactId> </dependency> <dependency> <groupId>com.iailab</groupId> <artifactId>iailab-common-excel</artifactId> <artifactId>iailab-common-biz-ip</artifactId> </dependency> <dependency> <groupId>com.iailab</groupId> <artifactId>iailab-module-model-api</artifactId> <version>${revision}</version> </dependency> <!-- Web 相关 --> <dependency> <groupId>com.iailab</groupId> <artifactId>iailab-common-security</artifactId> </dependency> <!-- DB 相关 --> <dependency> <groupId>com.iailab</groupId> <artifactId>iailab-common-mybatis</artifactId> </dependency> <!-- RPC 远程调用相关 --> <dependency> <groupId>com.iailab</groupId> @@ -62,45 +89,30 @@ <groupId>com.iailab</groupId> <artifactId>iailab-common-biz-data-permission</artifactId> </dependency> <!-- Test 测试相关 --> <dependency> <groupId>com.iailab</groupId> <artifactId>iailab-common-biz-tenant</artifactId> <version>${revision}</version> </dependency> <dependency> <groupId>com.iailab</groupId> <artifactId>iailab-module-model-api</artifactId> <version>${revision}</version> </dependency> <dependency> <groupId>com.iailab</groupId> <artifactId>iailab-module-data-api</artifactId> <version>${revision}</version> </dependency> <dependency> <groupId>com.iailab</groupId> <artifactId>iailab-module-infra-api</artifactId> <version>${revision}</version> </dependency> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-loadbalancer</artifactId> <artifactId>iailab-common-test</artifactId> <scope>test</scope> </dependency> <!-- nacos 客户端 --> <!-- 工具类相关 --> <dependency> <groupId>com.iailab</groupId> <artifactId>iailab-common-excel</artifactId> </dependency> <!-- Registry 注册中心相关 --> <dependency> <groupId>com.alibaba.cloud</groupId> <artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId> </dependency> <!-- nacos 配置中心 --> <!-- Config 配置中心相关 --> <dependency> <groupId>com.alibaba.cloud</groupId> <artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId> </dependency> <dependency> <groupId>org.quartz-scheduler</groupId> <artifactId>quartz</artifactId> <version>2.3.2</version> </dependency> <!-- 引用POI --> @@ -108,26 +120,6 @@ <groupId>org.apache.poi</groupId> <artifactId>poi</artifactId> <version>4.1.1</version> </dependency> <dependency> <groupId>org.jetbrains</groupId> <artifactId>annotations</artifactId> <version>17.0.0</version> <scope>compile</scope> </dependency> <dependency> <groupId>com.iailab</groupId> <artifactId>iailab-module-data-biz</artifactId> <version>0.0.1</version> <scope>test</scope> </dependency> <dependency> <groupId>org.junit.jupiter</groupId> <artifactId>junit-jupiter</artifactId> <scope>test</scope> </dependency> <!-- 引用MDK --> @@ -140,11 +132,6 @@ <groupId>com.iail</groupId> <artifactId>MDK</artifactId> <version>${mdk.version}</version> </dependency> <dependency> <groupId>com.iail</groupId> <artifactId>IAILMDK</artifactId> <version>0.94.9</version> </dependency> <!-- MPK --> iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/controller/admin/StScheduleModelController.java
@@ -59,7 +59,7 @@ @GetMapping("/get") @Operation(summary = "获得详情") @PreAuthorize("@ss.hasPermission('sche:model:query')") public CommonResult<StScheduleModelRespVO> get(@RequestParam("id") String id){ public CommonResult<StScheduleModelRespVO> get(@RequestParam("id") String id) { StScheduleModelEntity data = stScheduleModelService.get(id); StScheduleModelRespVO result = BeanUtils.toBean(data, StScheduleModelRespVO.class); List<StScheduleModelParamEntity> paramList = stScheduleModelParamService.getByModelId(data.getId()); @@ -72,7 +72,7 @@ @PostMapping("/create") @Operation(summary = "创建模型") @PreAuthorize("@ss.hasPermission('sche:model:create')") public CommonResult<Boolean> save(@Valid @RequestBody StScheduleModelSaveReqVO reqVO){ public CommonResult<Boolean> save(@Valid @RequestBody StScheduleModelSaveReqVO reqVO) { Long count = stScheduleModelService.check(reqVO); if (count > 0) { return error(999, "名称或编号重复"); @@ -84,7 +84,7 @@ @PutMapping("/update") @Operation(summary = "更新模型") @PreAuthorize("@ss.hasPermission('sche:model:update')") public CommonResult<Boolean> update(@Valid @RequestBody StScheduleModelSaveReqVO reqVO){ public CommonResult<Boolean> update(@Valid @RequestBody StScheduleModelSaveReqVO reqVO) { Long count = stScheduleModelService.check(reqVO); if (count > 0) { return error(999, "名称或编号重复"); @@ -96,7 +96,7 @@ @DeleteMapping("/delete") @Operation(summary = "删除模型") @PreAuthorize("@ss.hasPermission('sche:model:delete')") public CommonResult<Boolean> delete(@RequestParam("id") String id){ public CommonResult<Boolean> delete(@RequestParam("id") String id) { stScheduleModelService.delete(id); return success(true); } iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/service/impl/StScheduleRecordServiceImpl.java
@@ -11,7 +11,6 @@ import com.iailab.module.model.mdk.vo.ScheduleResultVO; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.util.Date; import java.util.UUID; iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/controller/admin/FileGroupController.java
对比新文件 @@ -0,0 +1,54 @@ package com.iailab.module.model.mpk.controller.admin; import com.iailab.framework.common.pojo.CommonResult; import com.iailab.module.model.mpk.dto.FileGroupDTO; import com.iailab.module.model.mpk.entity.FileGroupEntity; import com.iailab.module.model.mpk.service.FileGroupService; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import javax.validation.Valid; import java.util.List; import static com.iailab.framework.common.pojo.CommonResult.success; /** * @author PanZhibao * @Description * @createTime 2024年09月22日 */ @Tag(name = "模型服务 - 模型文件分组管理") @RestController @RequestMapping("/model/mpk/group") public class FileGroupController { @Autowired private FileGroupService fileGroupService; @GetMapping("/list") @Operation(summary = "获得列表") public CommonResult<List<FileGroupDTO>> list(@RequestParam("menuId") String menuId) { List<FileGroupDTO> list = fileGroupService.list(menuId); return success(list); } @PostMapping("/create") public CommonResult<Boolean> create(@Valid @RequestBody FileGroupEntity entity) { fileGroupService.create(entity); return success(true); } @PostMapping("/update") public CommonResult<Boolean> update(@Valid @RequestBody FileGroupEntity entity) { fileGroupService.update(entity); return success(true); } @DeleteMapping("/delete") public CommonResult<Boolean> delete(@RequestParam("id") String id) { fileGroupService.deleteById(id); return success(true); } } iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/controller/admin/FileMenuController.java
对比新文件 @@ -0,0 +1,54 @@ package com.iailab.module.model.mpk.controller.admin; import com.iailab.framework.common.pojo.CommonResult; import com.iailab.module.model.mpk.dto.FileMenuDTO; import com.iailab.module.model.mpk.entity.FileMenuEntity; import com.iailab.module.model.mpk.service.FileMenuService; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import javax.validation.Valid; import java.util.List; import static com.iailab.framework.common.pojo.CommonResult.success; /** * @author PanZhibao * @Description * @createTime 2024年09月22日 */ @Tag(name = "模型服务 - 模型文件菜单管理") @RestController @RequestMapping("/model/mpk/menu") public class FileMenuController { @Autowired private FileMenuService fileMenuService; @GetMapping("/list") @Operation(summary = "获得列表") public CommonResult<List<FileMenuDTO>> list() { List<FileMenuDTO> list = fileMenuService.list(); return success(list); } @PostMapping("/create") public CommonResult<Boolean> create(@Valid @RequestBody FileMenuEntity entity) { fileMenuService.create(entity); return success(true); } @PostMapping("/update") public CommonResult<Boolean> update(@Valid @RequestBody FileMenuEntity entity) { fileMenuService.update(entity); return success(true); } @DeleteMapping("/delete") public CommonResult<Boolean> delete(@RequestParam("id") String id) { fileMenuService.deleteById(id); return success(true); } } iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/controller/admin/IconController.java
对比新文件 @@ -0,0 +1,74 @@ package com.iailab.module.model.mpk.controller.admin; import com.iailab.framework.common.page.PageData; import com.iailab.framework.common.pojo.CommonResult; import com.iailab.framework.common.pojo.PageResult; import com.iailab.framework.common.util.object.BeanUtils; import com.iailab.module.model.mpk.entity.IconEntity; import com.iailab.module.model.mpk.service.IconService; import com.iailab.module.model.mpk.vo.IconPageReqVO; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import javax.validation.Valid; import java.util.List; import static com.iailab.framework.common.pojo.CommonResult.success; /** * @author PanZhibao * @Description * @createTime 2024年09月22日 */ @Tag(name = "模型服务 - MDK菜单图标管理") @RestController @RequestMapping("/model/mpk/icon") public class IconController { @Autowired private IconService iconService; @GetMapping("/page") @Operation(summary = "获得分页") public CommonResult<PageResult<IconEntity>> page(@Valid IconPageReqVO reqVO) { PageResult<IconEntity> page = iconService.page(reqVO); return success(BeanUtils.toBean(page, IconEntity.class)); } @GetMapping("/list") @Operation(summary = "获得列表") public CommonResult<List<IconEntity>> list() { List<IconEntity> list = iconService.list(); return success(list); } @GetMapping("/get") @Operation(summary = "获得详情") public CommonResult<IconEntity> get(@RequestParam("id") String id) { IconEntity data = iconService.get(id); return success(data); } @PostMapping("/create") @Operation(summary = "创建") public CommonResult<Boolean> save(@Valid @RequestBody IconEntity entity) { iconService.create(entity); return success(true); } @PutMapping("/update") @Operation(summary = "更新") public CommonResult<Boolean> update(@Valid @RequestBody IconEntity entity) { iconService.update(entity); return success(true); } @DeleteMapping("/delete") public CommonResult<Boolean> delete(@RequestParam("id") String id) { iconService.delete(id); return success(true); } } iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/controller/admin/MpkFileController.java
@@ -34,7 +34,6 @@ @PreAuthorize("@ss.hasPermission('mpk:file:query')") public CommonResult<PageData<MpkFileDTO>> page(@RequestParam Map<String, Object> params) { PageData<MpkFileDTO> page = mpkFileService.page(params); return success(page); } @@ -42,7 +41,6 @@ @GetMapping("{id}") public CommonResult<MpkFileDTO> info(@PathVariable("id") String id) { MpkFileDTO schedule = mpkFileService.get(id); return success(schedule); } iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/dao/FileGroupDao.java
对比新文件 @@ -0,0 +1,16 @@ package com.iailab.module.model.mpk.dao; import com.iailab.framework.mybatis.core.mapper.BaseMapperX; import com.iailab.framework.tenant.core.db.dynamic.TenantDS; import com.iailab.module.model.mpk.entity.FileGroupEntity; import org.apache.ibatis.annotations.Mapper; /** * @author PanZhibao * @Description * @createTime 2024年09月22日 */ @TenantDS @Mapper public interface FileGroupDao extends BaseMapperX<FileGroupEntity> { } iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/dao/FileMenuDao.java
对比新文件 @@ -0,0 +1,16 @@ package com.iailab.module.model.mpk.dao; import com.iailab.framework.mybatis.core.mapper.BaseMapperX; import com.iailab.framework.tenant.core.db.dynamic.TenantDS; import com.iailab.module.model.mpk.entity.FileMenuEntity; import org.apache.ibatis.annotations.Mapper; /** * @author PanZhibao * @Description * @createTime 2024年09月22日 */ @TenantDS @Mapper public interface FileMenuDao extends BaseMapperX<FileMenuEntity> { } iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/dao/GeneratorCodeHistoryDao.java
@@ -1,6 +1,7 @@ package com.iailab.module.model.mpk.dao; import com.iailab.framework.common.dao.BaseDao; import com.iailab.framework.tenant.core.db.dynamic.TenantDS; import com.iailab.module.model.mpk.entity.GeneratorCodeHistoryEntity; import org.apache.ibatis.annotations.Mapper; @@ -9,6 +10,7 @@ * @author: dzd * @date: 2024/8/20 11:49 **/ @TenantDS @Mapper public interface GeneratorCodeHistoryDao extends BaseDao<GeneratorCodeHistoryEntity> { iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/dao/IconDao.java
对比新文件 @@ -0,0 +1,25 @@ package com.iailab.module.model.mpk.dao; import com.iailab.framework.common.pojo.PageResult; import com.iailab.framework.mybatis.core.mapper.BaseMapperX; import com.iailab.framework.mybatis.core.query.LambdaQueryWrapperX; import com.iailab.framework.tenant.core.db.dynamic.TenantDS; import com.iailab.module.model.mpk.entity.IconEntity; import com.iailab.module.model.mpk.vo.IconPageReqVO; import org.apache.ibatis.annotations.Mapper; /** * @author PanZhibao * @Description * @createTime 2024年09月22日 */ @TenantDS @Mapper public interface IconDao extends BaseMapperX<IconEntity> { default PageResult<IconEntity> selectPage(IconPageReqVO reqVO) { return selectPage(reqVO, new LambdaQueryWrapperX<IconEntity>() .likeIfPresent(IconEntity::getIconName, reqVO.getIconName()) .orderByDesc(IconEntity::getSort)); } } iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/dao/MethodSettingDao.java
@@ -1,6 +1,7 @@ package com.iailab.module.model.mpk.dao; import com.iailab.framework.common.dao.BaseDao; import com.iailab.framework.tenant.core.db.dynamic.TenantDS; import com.iailab.module.model.mpk.entity.MethodSettingEntity; import org.apache.ibatis.annotations.Mapper; @@ -9,6 +10,7 @@ * @author: dzd * @date: 2024/9/14 15:11 **/ @TenantDS @Mapper public interface MethodSettingDao extends BaseDao<MethodSettingEntity> { } iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/dao/ModelMethodDao.java
@@ -1,6 +1,7 @@ package com.iailab.module.model.mpk.dao; import com.iailab.framework.common.dao.BaseDao; import com.iailab.framework.tenant.core.db.dynamic.TenantDS; import com.iailab.module.model.mpk.entity.ModelMethodEntity; import org.apache.ibatis.annotations.Mapper; @@ -9,6 +10,7 @@ * @author: dzd * @date: 2024/9/9 10:55 **/ @TenantDS @Mapper public interface ModelMethodDao extends BaseDao<ModelMethodEntity> { } iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/dao/MpkFileDao.java
@@ -2,6 +2,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.iailab.framework.common.dao.BaseDao; import com.iailab.framework.tenant.core.db.dynamic.TenantDS; import com.iailab.module.model.mpk.dto.MpkFileDTO; import com.iailab.module.model.mpk.dto.ProjectDTO; import com.iailab.module.model.mpk.entity.MpkFileEntity; @@ -19,6 +20,7 @@ * @Description * @createTime 2024年08月14日 */ @TenantDS @Mapper public interface MpkFileDao extends BaseDao<MpkFileEntity> { MpkFileDTO get(String id); iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/dao/ProjectDao.java
@@ -2,6 +2,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.iailab.framework.common.dao.BaseDao; import com.iailab.framework.tenant.core.db.dynamic.TenantDS; import com.iailab.module.model.mpk.dto.ProjectDTO; import com.iailab.module.model.mpk.entity.ProjectEntity; import org.apache.ibatis.annotations.Mapper; @@ -14,6 +15,7 @@ * @author: dzd * @date: 2024/8/22 14:41 **/ @TenantDS @Mapper public interface ProjectDao extends BaseDao<ProjectEntity> { iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/dao/ProjectModelDao.java
@@ -1,6 +1,7 @@ package com.iailab.module.model.mpk.dao; import com.iailab.framework.common.dao.BaseDao; import com.iailab.framework.tenant.core.db.dynamic.TenantDS; import com.iailab.module.model.mpk.entity.ProjectModelEntity; import org.apache.ibatis.annotations.Mapper; @@ -9,6 +10,7 @@ * @author: dzd * @date: 2024/8/22 14:41 **/ @TenantDS @Mapper public interface ProjectModelDao extends BaseDao<ProjectModelEntity> { iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/dao/ProjectPackageHistoryDao.java
@@ -1,6 +1,7 @@ package com.iailab.module.model.mpk.dao; import com.iailab.framework.common.dao.BaseDao; import com.iailab.framework.tenant.core.db.dynamic.TenantDS; import com.iailab.module.model.mpk.entity.ProjectPackageHistoryEntity; import org.apache.ibatis.annotations.Mapper; @@ -10,6 +11,7 @@ * @author Dzd * @since 1.0.0 2024-08-22 */ @TenantDS @Mapper public interface ProjectPackageHistoryDao extends BaseDao<ProjectPackageHistoryEntity> { iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/dao/ProjectPackageHistoryModelDao.java
@@ -1,6 +1,7 @@ package com.iailab.module.model.mpk.dao; import com.iailab.framework.common.dao.BaseDao; import com.iailab.framework.tenant.core.db.dynamic.TenantDS; import com.iailab.module.model.mpk.entity.ProjectPackageHistoryModelEntity; import org.apache.ibatis.annotations.Mapper; @@ -9,6 +10,7 @@ * @author: dzd * @date: 2024/8/22 14:41 **/ @TenantDS @Mapper public interface ProjectPackageHistoryModelDao extends BaseDao<ProjectPackageHistoryModelEntity> { iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/dao/SettingSelectDao.java
@@ -1,6 +1,7 @@ package com.iailab.module.model.mpk.dao; import com.iailab.framework.common.dao.BaseDao; import com.iailab.framework.tenant.core.db.dynamic.TenantDS; import com.iailab.module.model.mpk.entity.SettingSelectEntity; import org.apache.ibatis.annotations.Mapper; @@ -9,6 +10,7 @@ * @author: dzd * @date: 2024/9/14 15:11 **/ @TenantDS @Mapper public interface SettingSelectDao extends BaseDao<SettingSelectEntity> { } iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/dto/FileGroupDTO.java
对比新文件 @@ -0,0 +1,21 @@ package com.iailab.module.model.mpk.dto; import lombok.Data; import java.io.Serializable; /** * @author PanZhibao * @Description * @createTime 2024年09月22日 */ @Data public class FileGroupDTO implements Serializable { private static final long serialVersionUID = 1L; private String menuId; private String name; private Integer sort; } iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/dto/FileMenuDTO.java
对比新文件 @@ -0,0 +1,24 @@ package com.iailab.module.model.mpk.dto; import lombok.Data; import java.io.Serializable; import java.util.List; /** * @author PanZhibao * @Description * @createTime 2024年09月22日 */ @Data public class FileMenuDTO implements Serializable { private static final long serialVersionUID = 1L; private String id; private String name; private Integer sort; private List<FileGroupDTO> groups; } iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/entity/FileGroupEntity.java
对比新文件 @@ -0,0 +1,39 @@ package com.iailab.module.model.mpk.entity; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; import java.io.Serializable; /** * @author PanZhibao * @Description * @createTime 2024年09月22日 */ @Data @TableName("t_mpk_file_group") public class FileGroupEntity implements Serializable { private static final long serialVersionUID = 1L; /** * id */ @TableId private String id; /** * 菜单 */ private String menuId; /** * 名称 */ private String name; /** * 排序 */ private Integer sort; } iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/entity/FileMenuEntity.java
对比新文件 @@ -0,0 +1,34 @@ package com.iailab.module.model.mpk.entity; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; import java.io.Serializable; /** * @author PanZhibao * @Description * @createTime 2024年09月22日 */ @Data @TableName("t_mpk_file_menu") public class FileMenuEntity implements Serializable { private static final long serialVersionUID = 1L; /** * id */ @TableId private String id; /** * 名称 */ private String name; /** * 排序 */ private Integer sort; } iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/entity/IconEntity.java
对比新文件 @@ -0,0 +1,39 @@ package com.iailab.module.model.mpk.entity; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; import java.io.Serializable; /** * @author PanZhibao * @Description * @createTime 2024年09月22日 */ @Data @TableName("t_mpk_icon") public class IconEntity implements Serializable { private static final long serialVersionUID = 1L; /** * id */ @TableId private String id; /** * 图标名称 */ private String iconName; /** * 图标描述 */ private String iconDesc; /** * 排序 */ private Integer sort; } iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/entity/MethodSettingEntity.java
@@ -61,4 +61,9 @@ * 最小值 */ private Integer min; /** * 排序 */ private Integer sort; } iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/entity/ModelMethodEntity.java
@@ -43,8 +43,14 @@ * 是否有model(0:否,1:是) */ private Integer model; /** * 结果key */ private String resultKey; /** * 排序 */ private Integer sort; } iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/entity/MpkFileEntity.java
@@ -19,6 +19,7 @@ @Data @TableName("t_mpk_file") public class MpkFileEntity implements Serializable { private static final long serialVersionUID = 1L; /** * id iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/entity/SettingSelectEntity.java
@@ -35,4 +35,9 @@ * 名称 */ private String name; /** * 排序 */ private Integer sort; } iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/service/FileGroupService.java
对比新文件 @@ -0,0 +1,24 @@ package com.iailab.module.model.mpk.service; import com.iailab.module.model.mpk.dto.FileGroupDTO; import com.iailab.module.model.mpk.entity.FileGroupEntity; import java.util.List; /** * @author PanZhibao * @Description * @createTime 2024年09月22日 */ public interface FileGroupService { List<FileGroupDTO> list(String menuId); FileGroupEntity get(String id); void create(FileGroupEntity fileMenuEntity); void update(FileGroupEntity fileMenuEntity); void deleteById(String id); } iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/service/FileMenuService.java
对比新文件 @@ -0,0 +1,24 @@ package com.iailab.module.model.mpk.service; import com.iailab.module.model.mpk.dto.FileMenuDTO; import com.iailab.module.model.mpk.entity.FileMenuEntity; import java.util.List; /** * @author PanZhibao * @Description * @createTime 2024年09月22日 */ public interface FileMenuService { List<FileMenuDTO> list(); FileMenuEntity get(String id); void create(FileMenuEntity fileMenuEntity); void update(FileMenuEntity fileMenuEntity); void deleteById(String id); } iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/service/IconService.java
对比新文件 @@ -0,0 +1,27 @@ package com.iailab.module.model.mpk.service; import com.iailab.framework.common.pojo.PageResult; import com.iailab.module.model.mpk.entity.IconEntity; import com.iailab.module.model.mpk.vo.IconPageReqVO; import java.util.List; /** * @author PanZhibao * @Description * @createTime 2024年09月22日 */ public interface IconService { PageResult<IconEntity> page(IconPageReqVO reqVO); List<IconEntity> list(); void create(IconEntity entity); void update(IconEntity entity); IconEntity get(String id); void delete(String id); } iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/service/ModelMethodService.java
@@ -1,8 +1,10 @@ package com.iailab.module.model.mpk.service; import com.iailab.framework.common.service.BaseService; import com.iailab.module.model.mpk.dto.ModelMethodDTO; import com.iailab.module.model.mpk.entity.ModelMethodEntity; import java.util.List; import java.util.Map; /** @@ -13,4 +15,8 @@ public interface ModelMethodService extends BaseService<ModelMethodEntity> { void deleteByMap(Map<String, Object> map); void insertList(List<ModelMethodDTO> list, String fileId); void deleteModelMethod(String mpkId); } iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/service/SettingSelectService.java
@@ -1,8 +1,10 @@ package com.iailab.module.model.mpk.service; import com.iailab.framework.common.service.BaseService; import com.iailab.module.model.mpk.dto.MethodSettingDTO; import com.iailab.module.model.mpk.entity.SettingSelectEntity; import java.util.List; import java.util.Map; /** @@ -13,4 +15,6 @@ public interface SettingSelectService extends BaseService<SettingSelectEntity> { void deleteByMap(Map<String, Object> map); void insertList(List<MethodSettingDTO> list, String settingId); } iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/service/impl/FileGroupServiceImpl.java
对比新文件 @@ -0,0 +1,54 @@ package com.iailab.module.model.mpk.service.impl; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.iailab.framework.common.util.object.ConvertUtils; import com.iailab.module.model.mpk.dao.FileGroupDao; import com.iailab.module.model.mpk.dto.FileGroupDTO; import com.iailab.module.model.mpk.entity.FileGroupEntity; import com.iailab.module.model.mpk.service.FileGroupService; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; import javax.annotation.Resource; import java.util.List; /** * @author PanZhibao * @Description * @createTime 2024年09月22日 */ @Slf4j @Service public class FileGroupServiceImpl implements FileGroupService { @Resource private FileGroupDao fileGroupDao; @Override public List<FileGroupDTO> list(String menuId) { QueryWrapper<FileGroupEntity> wrapper = new QueryWrapper<>(); wrapper.eq("menu_id", menuId) .orderByAsc("sort"); return ConvertUtils.sourceToTarget(fileGroupDao.selectList(wrapper), FileGroupDTO.class); } @Override public FileGroupEntity get(String id) { return fileGroupDao.selectById(id); } @Override public void create(FileGroupEntity fileMenuEntity) { fileGroupDao.insert(fileMenuEntity); } @Override public void update(FileGroupEntity fileMenuEntity) { fileGroupDao.updateById(fileMenuEntity); } @Override public void deleteById(String id) { fileGroupDao.deleteById(id); } } iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/service/impl/FileMenuServiceImpl.java
对比新文件 @@ -0,0 +1,61 @@ package com.iailab.module.model.mpk.service.impl; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.iailab.framework.common.util.object.ConvertUtils; import com.iailab.module.model.mpk.dao.FileMenuDao; import com.iailab.module.model.mpk.dto.FileMenuDTO; import com.iailab.module.model.mpk.entity.FileMenuEntity; import com.iailab.module.model.mpk.service.FileGroupService; import com.iailab.module.model.mpk.service.FileMenuService; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; import javax.annotation.Resource; import java.util.List; /** * @author PanZhibao * @Description * @createTime 2024年09月22日 */ @Slf4j @Service public class FileMenuServiceImpl implements FileMenuService { @Resource private FileMenuDao fileMenuDao; @Resource private FileGroupService fileGroupService; @Override public List<FileMenuDTO> list() { QueryWrapper<FileMenuEntity> wrapper = new QueryWrapper<>(); wrapper.orderByAsc("sort"); List<FileMenuDTO> list = ConvertUtils.sourceToTarget(fileMenuDao.selectList(wrapper), FileMenuDTO.class); list.forEach(item -> { fileGroupService.list(item.getId()); }); return list; } @Override public FileMenuEntity get(String id) { return fileMenuDao.selectById(id); } @Override public void create(FileMenuEntity fileMenuEntity) { fileMenuDao.insert(fileMenuEntity); } @Override public void update(FileMenuEntity fileMenuEntity) { fileMenuDao.updateById(fileMenuEntity); } @Override public void deleteById(String id) { fileMenuDao.deleteById(id); } } iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/service/impl/IconServiceImpl.java
对比新文件 @@ -0,0 +1,58 @@ package com.iailab.module.model.mpk.service.impl; import com.iailab.framework.common.pojo.PageResult; import com.iailab.module.model.mpk.dao.IconDao; import com.iailab.module.model.mpk.entity.IconEntity; import com.iailab.module.model.mpk.service.IconService; import com.iailab.module.model.mpk.vo.IconPageReqVO; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.List; import java.util.UUID; /** * @author PanZhibao * @Description * @createTime 2024年09月22日 */ @Slf4j @Service public class IconServiceImpl implements IconService { @Autowired private IconDao iconDao; @Override public PageResult<IconEntity> page(IconPageReqVO reqVO) { return iconDao.selectPage(reqVO); } @Override public List<IconEntity> list() { return iconDao.selectList(null); } @Override public void create(IconEntity entity) { entity.setId(UUID.randomUUID().toString()); iconDao.insert(entity); } @Override public void update(IconEntity entity) { iconDao.updateById(entity); } @Override public IconEntity get(String id) { return iconDao.selectById(id); } @Override public void delete(String id) { iconDao.deleteById(id); } } iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/service/impl/ModelMethodServiceImpl.java
@@ -2,14 +2,21 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.iailab.framework.common.service.impl.BaseServiceImpl; import com.iailab.framework.common.util.object.ConvertUtils; import com.iailab.module.model.mpk.dao.ModelMethodDao; import com.iailab.module.model.mpk.dto.ModelMethodDTO; import com.iailab.module.model.mpk.entity.ModelMethodEntity; import com.iailab.module.model.mpk.service.ModelMethodService; import com.iailab.module.model.mpk.service.SettingSelectService; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.UUID; /** * @description: @@ -20,6 +27,8 @@ @Service public class ModelMethodServiceImpl extends BaseServiceImpl<ModelMethodDao, ModelMethodEntity> implements ModelMethodService { @Autowired private SettingSelectService settingSelectService; @Override public void deleteByMap(Map<String, Object> map) { @@ -34,4 +43,23 @@ return wrapper; } @Override public void insertList(List<ModelMethodDTO> list, String fileId) { for (int i = 0; i < list.size(); i++) { ModelMethodEntity entity = ConvertUtils.sourceToTarget(list.get(i), ModelMethodEntity.class); entity.setId(UUID.randomUUID().toString()); entity.setMpkFileId(fileId); entity.setSort(i); baseDao.insert(entity); settingSelectService.insertList(list.get(i).getMethodSettings(), entity.getId()); } } @Override public void deleteModelMethod(String mpkId) { Map<String,Object> map = new HashMap<>(); map.put("mpk_file_id", mpkId); baseDao.deleteByMap(map); } } iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/service/impl/MpkFileServiceImpl.java
@@ -4,6 +4,7 @@ import cn.hutool.core.util.RuntimeUtil; import cn.hutool.core.util.ZipUtil; import com.alibaba.fastjson.JSON; import com.baomidou.dynamic.datasource.annotation.DSTransactional; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.iailab.framework.common.page.PageData; @@ -31,7 +32,6 @@ import org.springframework.util.CollectionUtils; import org.springframework.web.multipart.MultipartFile; import javax.annotation.PostConstruct; import java.io.ByteArrayOutputStream; import java.io.File; import java.io.IOException; @@ -52,16 +52,13 @@ @Autowired private GeneratorCodeHistoryService generatorCodeHistoryService; @Autowired private ProjectModelService projectModelService; @Autowired private ProjectPackageHistoryService projectPackageHistoryService; @Autowired private ModelMethodService modelMethodService; @Autowired private MethodSettingService methodSettingService; @Autowired private SettingSelectService settingSelectService; @Autowired private ProjectPackageHistoryModelService projectPackageHistoryModelService; @@ -93,7 +90,7 @@ return ConvertUtils.sourceToTarget(entityList, MpkFileDTO.class); } private QueryWrapper<MpkFileEntity> getWrapper(Map<String, Object> params){ private QueryWrapper<MpkFileEntity> getWrapper(Map<String, Object> params) { String pyName = (String) params.get("pyName"); String pyType = (String) params.get("pyType"); String remark = (String) params.get("remark"); @@ -113,86 +110,29 @@ } @Override @Transactional(rollbackFor = Exception.class) @DSTransactional(rollbackFor = Exception.class) public void save(MpkFileDTO dto) { MpkFileEntity entity = ConvertUtils.sourceToTarget(dto, MpkFileEntity.class); String mpkId = UUID.randomUUID().toString(); entity.setId(mpkId); entity.setId(UUID.randomUUID().toString()); entity.setCreator(SecurityFrameworkUtils.getLoginUserId()); entity.setCreateDate(new Date()); insert(entity); // 添加模型方法 insertModelMethod(dto.getModelMethods(),mpkId); modelMethodService.insertList(dto.getModelMethods(), entity.getId()); } @Override @Transactional(rollbackFor = Exception.class) @DSTransactional(rollbackFor = Exception.class) public void update(MpkFileDTO dto) { MpkFileEntity entity = ConvertUtils.sourceToTarget(dto, MpkFileEntity.class); entity.setUpdater(SecurityFrameworkUtils.getLoginUserId()); entity.setUpdateDate(new Date()); updateById(entity); String mpkId = dto.getId(); // 删除模型方法 会级联删除setting和select deleteModelMethod(mpkId); // 添加模型方法 insertModelMethod(dto.getModelMethods(),mpkId); } private void insertModelMethod(List<ModelMethodDTO> modelMethods, String mpkId) { List<MethodSettingDTO> methodSettingList = new ArrayList<>(); if (!CollectionUtils.isEmpty(modelMethods)) { modelMethods.forEach(e -> { String methodId = UUID.randomUUID().toString(); e.setId(methodId); e.setMpkFileId(mpkId); e.getMethodSettings().forEach(s -> { s.setId(UUID.randomUUID().toString()); s.setMethodId(methodId); methodSettingList.add(s); }); }); modelMethodService.insertBatch(ConvertUtils.sourceToTarget(modelMethods, ModelMethodEntity.class)); //添加setting insertMethodSetting(methodSettingList); } } private void insertMethodSetting(List<MethodSettingDTO> methodSettings) { List<SettingSelectEntity> settingSelectList = new ArrayList<>(); if (!CollectionUtils.isEmpty(methodSettings)) { methodSettings.forEach(e -> { String settingId = UUID.randomUUID().toString(); e.setId(settingId); e.getSettingSelects().forEach(s -> { s.setId(UUID.randomUUID().toString()); s.setSettingId(settingId); settingSelectList.add(ConvertUtils.sourceToTarget(s,SettingSelectEntity.class)); }); }); methodSettingService.insertBatch(ConvertUtils.sourceToTarget(methodSettings, MethodSettingEntity.class)); //添加select settingSelectService.insertBatch(settingSelectList); } } private void deleteModelMethod(String mpkId) { Map<String,Object> map = new HashMap<>(); map.put("mpkFileId", mpkId); modelMethodService.deleteByMap(map); modelMethodService.deleteModelMethod(entity.getId()); modelMethodService.insertList(dto.getModelMethods(), entity.getId()); } @Override @Transactional(rollbackFor = Exception.class) @DSTransactional(rollbackFor = Exception.class) public void delete(String id) { //删除源文件 @@ -206,8 +146,8 @@ } //删除备份文件 Map<String,Object> map1 = new HashMap<>(); map1.put("mdkId",id); Map<String, Object> map1 = new HashMap<>(); map1.put("mdkId", id); List<GeneratorCodeHistoryDTO> list = generatorCodeHistoryService.list(map1); list.forEach(e -> { File file = new File(e.getFilePath()); @@ -219,18 +159,6 @@ //删除 会级联删除掉关联表 deleteById(id); //删除生成历史 // generatorCodeHistoryService.deleteByMap(map1); //删除关联项目 // Map<String,Object> map = new HashMap<>(); // map.put("modelId",id); // projectModelService.deleteByMap(map); //删除模型方法 // deleteModelMethod(id); } @Override @@ -278,13 +206,13 @@ } @Override @Transactional(rollbackFor = Exception.class) public byte[] packageModel(List<String> ids,String projectId,String projectName,String zipFileName,String log,String version) throws IOException, InterruptedException { @DSTransactional(rollbackFor = Exception.class) public byte[] packageModel(List<String> ids, String projectId, String projectName, String zipFileName, String log, String version) throws IOException, InterruptedException { List<MpkFileDTO> entities = baseDao.selectByIds(ids); //模板数据 Map<String, Object> map = new HashMap<>(); map.put("entities",entities); map.put("entities", entities); VelocityContext context = new VelocityContext(map); //临时文件夹 @@ -301,17 +229,17 @@ //生成menu.xml文件 Map<String, Map<String, List<MpkFileDTO>>> collect = entities.stream().collect(Collectors.groupingBy(MpkFileDTO::getMenuName, Collectors.groupingBy(e -> StringUtils.isNotBlank(e.getGroupName()) ? e.getGroupName() : "default_group"))); Map<String, Object> map1 = new HashMap<>(); map1.put("collects",collect); map1.put("collects", collect); File xmlFile = new File(dirPath.getAbsolutePath() + File.separator + "menu.xml"); GenUtils.drawTemplate("menu.xml.vm",new VelocityContext(map1),xmlFile); GenUtils.drawTemplate("menu.xml.vm", new VelocityContext(map1), xmlFile); //生成cpp文件 File cppFile = new File(dirPath.getAbsolutePath() + File.separator + UUID.randomUUID() + ".cpp"); GenUtils.drawTemplate("pkg.cpp.vm",context,cppFile); GenUtils.drawTemplate("pkg.cpp.vm", context, cppFile); //生成Jni.cpp文件 File jniCppFile = new File(dirPath.getAbsolutePath() + File.separator + UUID.randomUUID() + "Jni.cpp"); GenUtils.drawTemplate("pkg.Jni.cpp.vm",context,jniCppFile); GenUtils.drawTemplate("pkg.Jni.cpp.vm", context, jniCppFile); //生成dll文件 String dllSavePath = dirPath.getAbsolutePath() + File.separator + "IAIL.MDK.Mid.Windows.dll"; @@ -328,35 +256,35 @@ for (MpkFileDTO entity : entities) { //封装模板数据 Map<String, Object> data = new HashMap<>(); data.put("pkgName",entity.getPkgName()); data.put("modelMethods",entity.getModelMethods()); data.put("pyName",entity.getPyName()); data.put("pyModule",entity.getPyModule()); data.put("pkgName", entity.getPkgName()); data.put("modelMethods", entity.getModelMethods()); data.put("pyName", entity.getPyName()); data.put("pyModule", entity.getPyModule()); VelocityContext dataContext = new VelocityContext(data); //生成java文件 File javaFile = new File(dirPath.getAbsolutePath() + File.separator + "IAILMDK" + File.separator + entity.getPkgName().replace(".", File.separator) + File.separator + entity.getPyName() + ".java"); GenUtils.drawTemplate("abstract.java.vm",dataContext,javaFile); GenUtils.drawTemplate("abstract.java.vm", dataContext, javaFile); javaFilePaths.add(javaFile.getAbsolutePath()); //生成Impl.java文件 File implJavaFile = new File(dirPath.getAbsolutePath() + File.separator + "IAILMDK" + File.separator + entity.getPkgName().replace(".", File.separator) + File.separator + MdkConstant.IMPL + File.separator + entity.getPyName() + "Impl.java"); GenUtils.drawTemplate("impl.java.vm",dataContext,implJavaFile); GenUtils.drawTemplate("impl.java.vm", dataContext, implJavaFile); javaFilePaths.add(implJavaFile.getAbsolutePath()); // 添加python源文件 String pyFilePath = dirPath.getAbsolutePath() + File.separator + "py" + File.separator + entity.getPyName() + ".pyd"; String pyFilePath = dirPath.getAbsolutePath() + File.separator + "py" + File.separator + entity.getPyName() + ".pyd"; FileUtil.mkParentDirs(pyFilePath); FileUtil.copy(entity.getFilePath(),pyFilePath,true); FileUtil.copy(entity.getFilePath(), pyFilePath, true); } //utils + env java文件 File utilsJavaFile = new File(dirPath.getAbsolutePath() + File.separator + "IAILMDK" + File.separator + "utils" + File.separator + "AlgsUtils.java"); FileUtil.mkParentDirs(utilsJavaFile); FileUtil.copy("bak/AlgsUtils.java",utilsJavaFile.getAbsolutePath(),true); FileUtil.copy("bak/AlgsUtils.java", utilsJavaFile.getAbsolutePath(), true); javaFilePaths.add(utilsJavaFile.getAbsolutePath()); File envJavaFile = new File(dirPath.getAbsolutePath() + File.separator + "IAILMDK" + File.separator + "common" + File.separator + "Environment.java"); FileUtil.mkParentDirs(envJavaFile); FileUtil.copy("bak/Environment.java",envJavaFile.getAbsolutePath(),true); FileUtil.copy("bak/Environment.java", envJavaFile.getAbsolutePath(), true); javaFilePaths.add(envJavaFile.getAbsolutePath()); // 生成class文件 createClassFile(javaFilePaths); @@ -375,10 +303,10 @@ dto.setModelNames(entities.stream().map(MpkFileDTO::getPyName).collect(Collectors.joining(","))); dto.setCreateTime(new Date()); // 生成更新日志 createLog(projectId,projectName,dirPath.getAbsolutePath(),dto,version); createLog(projectId, projectName, dirPath.getAbsolutePath(), dto, version); // 打zip包 String zipPath = mpkBakFilePath + File.separator + zipFileName; ZipUtil.zip(dirPath.getAbsolutePath(),zipPath); ZipUtil.zip(dirPath.getAbsolutePath(), zipPath); byte[] bytes = FileUtil.readBytes(zipPath); // 记录打包日志 dto.setFilePath(zipPath); @@ -408,7 +336,7 @@ } @Override public Map<String,String> savePyFile(MultipartFile file) throws IOException { public Map<String, String> savePyFile(MultipartFile file) throws IOException { File dir = new File(mpkBakFilePath); if (!dir.exists()) { dir.mkdirs(); @@ -419,32 +347,32 @@ // 保存 file.transferTo(saveFile); Map<String,String> result = new HashMap<>(2); result.put("filePath",saveFile.getAbsolutePath()); Map<String, String> result = new HashMap<>(2); result.put("filePath", saveFile.getAbsolutePath()); result.put("fileName", fileName); return result; } private void createLog(String projectId,String projectName,String dirPath,ProjectPackageHistoryDTO dto,String version) throws IOException { Map<String,Object> map = new HashMap<>(); map.put("projectId",projectId); private void createLog(String projectId, String projectName, String dirPath, ProjectPackageHistoryDTO dto, String version) throws IOException { Map<String, Object> map = new HashMap<>(); map.put("projectId", projectId); List<ProjectPackageHistoryDTO> list = projectPackageHistoryService.list(map); list.add(dto); // 按照日期分组再排序 HashMap<String, List<ProjectPackageHistoryDTO>> dataMap = list.stream().collect( Collectors.groupingBy(e -> DateUtils.format(e.getCreateTime(), DateUtils.DATE_PATTERN_POINT), LinkedHashMap::new, Collectors.collectingAndThen(Collectors.toList(), e -> e.stream().sorted(Comparator.comparing(ProjectPackageHistoryDTO::getCreateTime)).collect(Collectors.toList())))); LinkedHashMap::new, Collectors.collectingAndThen(Collectors.toList(), e -> e.stream().sorted(Comparator.comparing(ProjectPackageHistoryDTO::getCreateTime)).collect(Collectors.toList())))); Map<String, Object> data = new HashMap<>(); data.put("dataMap",dataMap); data.put("projectName",projectName); data.put("version",version); data.put("now",DateUtils.format(new Date(),DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)); data.put("dataMap", dataMap); data.put("projectName", projectName); data.put("version", version); data.put("now", DateUtils.format(new Date(), DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)); File logFile = new File(dirPath + File.separator + "更新日志.txt"); GenUtils.drawTemplate("log.txt.vm",data,logFile); GenUtils.drawTemplate("log.txt.vm", data, logFile); } private void pkgJar(String dirPath) throws InterruptedException { iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/service/impl/SettingSelectServiceImpl.java
@@ -2,14 +2,19 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.iailab.framework.common.service.impl.BaseServiceImpl; import com.iailab.framework.common.util.object.ConvertUtils; import com.iailab.module.model.mpk.dao.SettingSelectDao; import com.iailab.module.model.mpk.dto.MethodSettingDTO; import com.iailab.module.model.mpk.entity.ModelMethodEntity; import com.iailab.module.model.mpk.entity.SettingSelectEntity; import com.iailab.module.model.mpk.service.SettingSelectService; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Service; import java.util.List; import java.util.Map; import java.util.UUID; /** * @description: @@ -34,4 +39,17 @@ return wrapper; } @Override public void insertList(List<MethodSettingDTO> list, String settingId) { List<SettingSelectEntity> entityList = ConvertUtils.sourceToTarget(list, SettingSelectEntity.class); for(int i = 0; i < entityList.size(); i++){ SettingSelectEntity entity = entityList.get(i); entity.setId(UUID.randomUUID().toString()); entity.setSettingId(settingId); entity.setSort(i); baseDao.insert(entity); } } } iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/vo/IconPageReqVO.java
对比新文件 @@ -0,0 +1,22 @@ package com.iailab.module.model.mpk.vo; import com.iailab.framework.common.pojo.PageParam; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.ToString; /** * @author PanZhibao * @Description * @createTime 2024年09月22日 */ @Schema(description = "模型服务 - MDK菜单图标分页 Request VO") @Data @EqualsAndHashCode(callSuper = true) @ToString(callSuper = true) public class IconPageReqVO extends PageParam { @Schema(description = "图标名称,模糊匹配", example = "") private String iconName; } iailab-module-model/iailab-module-model-biz/src/main/resources/application.yml
@@ -211,6 +211,9 @@ - t_mpk_project_package_history - t_mpk_project_package_history_model - t_mpk_setting_select - t_mpk_icon - t_mpk_file_menu - t_mpk_file_group app: app-key: model app-secret: 85b0df7edc3df3611913df34ed695011