liriming
2024-09-23 3670774f2ba43c075a475ef4fb46ac9e349bb082
Merge remote-tracking branch 'origin/master'
已添加19个文件
已修改34个文件
1276 ■■■■ 文件已修改
iailab-module-data/iailab-module-data-biz/db/mysql/tenant.sql 22 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/controller/admin/HttpTagController.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/entity/HttpApiEntity.java 11 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/entity/HttpTokenEntity.java 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/vo/HttpTokenRespVO.java 44 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/modbus/service/impl/ChannelModbusTagServiceImpl.java 63 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/opcda/service/impl/ChannelOPCDATagServiceImpl.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/opcua/service/impl/ChannelOPCUATagServiceImpl.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/controller/admin/DaPointController.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/controller/package-info.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/service/impl/DaPointServiceImpl.java 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-model/iailab-module-model-biz/db/mysql.sql 34 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-model/iailab-module-model-biz/pom.xml 103 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/controller/admin/StScheduleModelController.java 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/service/impl/StScheduleRecordServiceImpl.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/controller/admin/FileGroupController.java 54 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/controller/admin/FileMenuController.java 54 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/controller/admin/IconController.java 74 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/controller/admin/MpkFileController.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/dao/FileGroupDao.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/dao/FileMenuDao.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/dao/GeneratorCodeHistoryDao.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/dao/IconDao.java 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/dao/MethodSettingDao.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/dao/ModelMethodDao.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/dao/MpkFileDao.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/dao/ProjectDao.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/dao/ProjectModelDao.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/dao/ProjectPackageHistoryDao.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/dao/ProjectPackageHistoryModelDao.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/dao/SettingSelectDao.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/dto/FileGroupDTO.java 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/dto/FileMenuDTO.java 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/entity/FileGroupEntity.java 39 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/entity/FileMenuEntity.java 34 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/entity/IconEntity.java 39 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/entity/MethodSettingEntity.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/entity/ModelMethodEntity.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/entity/MpkFileEntity.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/entity/SettingSelectEntity.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/service/FileGroupService.java 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/service/FileMenuService.java 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/service/IconService.java 27 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/service/ModelMethodService.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/service/SettingSelectService.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/service/impl/FileGroupServiceImpl.java 54 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/service/impl/FileMenuServiceImpl.java 61 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/service/impl/IconServiceImpl.java 58 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/service/impl/ModelMethodServiceImpl.java 28 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/service/impl/MpkFileServiceImpl.java 164 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/service/impl/SettingSelectServiceImpl.java 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/vo/IconPageReqVO.java 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-model/iailab-module-model-biz/src/main/resources/application.yml 21 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-data/iailab-module-data-biz/db/mysql/tenant.sql
@@ -196,14 +196,15 @@
INSERT INTO `t_da_sequence_num` (`id`, `code`, `name`, `sequence_num`, `prefix`) VALUES ('2', 'POINT_C', '计算点编码', 100000, 'C');
CREATE TABLE `t_http_api`  (
                             `id` varchar(36) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT 'ID',
                             `code` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '编码',
                             `name` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '名称',
                             `url` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT 'URL',
                             `method` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '请求方法',
                             `param` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '参数',
                             `descp` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '描述',
                             `status` int NULL DEFAULT NULL COMMENT '状态',
                             `id` varchar(36) NOT NULL COMMENT 'ID',
                             `code` varchar(32) NOT NULL COMMENT '编码',
                             `name` varchar(32) NOT NULL COMMENT '名称',
                             `url` varchar(100) NOT NULL COMMENT 'URL',
                             `method` varchar(10) NULL DEFAULT NULL COMMENT '请求方法',
                             `param` varchar(200) NULL DEFAULT NULL COMMENT '参数',
                             `descp` varchar(100) NULL DEFAULT NULL COMMENT '描述',
                             `is_auth` tinyint(1) NOT NULL COMMENT '是否认证',
                             `auth_url` varchar(36) NULL DEFAULT NULL COMMENT '认证地址',
                             `creator` VARCHAR(64)   COMMENT '创建人' ,
                             `create_time` DATETIME   COMMENT '创建时间' ,
                             `updater` VARCHAR(64)   COMMENT '修改人' ,
@@ -212,20 +213,19 @@
                             UNIQUE KEY `uk_code` (`code`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = 'Api接口' ROW_FORMAT = DYNAMIC;
CREATE TABLE `t_http_token` (
                              `id` varchar(36)  NOT NULL COMMENT 'ID',
                              `api_id` varchar(36) NOT NULL COMMENT '接口ID',
                              `login_url` varchar(200) DEFAULT NULL COMMENT '登录地址',
                              `client_id` varchar(100) DEFAULT NULL COMMENT 'ClientId',
                              `client_secret` varchar(100) DEFAULT NULL COMMENT 'ClientSecret',
                              `username` varchar(50) DEFAULT NULL COMMENT '用户名',
                              `password` varchar(50) DEFAULT NULL COMMENT '密码',
                              `refresh_freq` varchar(10) DEFAULT NULL COMMENT '刷新频率',
                              `token` varchar(2000) DEFAULT NULL COMMENT 'token',
                              `expire_time` datetime DEFAULT NULL COMMENT '过期时间',
                              `update_time` datetime DEFAULT NULL COMMENT '更新时间',
                              PRIMARY KEY (`id`) USING BTREE,
                              UNIQUE KEY `uk_api_id` (`api_id`) USING BTREE
                              UNIQUE KEY `uk_login_url` (`login_url`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC COMMENT='接口Token';
CREATE TABLE `t_http_tag` (
iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/controller/admin/HttpTagController.java
@@ -54,7 +54,7 @@
    @PreAuthorize("@ss.hasPermission('data:channel-http:create')")
    @PostMapping("/create")
    public CommonResult<Boolean> add(@RequestBody HttpTagEntity httpTagEntity){
    public CommonResult<Boolean> create(@RequestBody HttpTagEntity httpTagEntity){
        httpTagEntity.setId(UUID.randomUUID().toString());
        httpTagEntity.setCreateTime(new Date());
        tagService.add(httpTagEntity);
iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/entity/HttpApiEntity.java
@@ -10,7 +10,7 @@
import java.util.Date;
@Data
@TableName("T_HTTP_API")
@TableName("t_http_api")
public class HttpApiEntity implements Serializable {
    private static final long serialVersionUID = 1L;
@@ -52,9 +52,14 @@
    private String descp;
    /**
     * 状态
     * 是否认证
     */
    private Integer status;
    private Boolean isAuth;
    /**
     * 认证地址
     */
    private String authUrl;
    /**
     * 创建人
iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/entity/HttpTokenEntity.java
@@ -22,12 +22,7 @@
    private String id;
    /**
     * 接口ID
     */
    private String apiId;
    /**
     * 登录地址
     * 认证地址
     */
    private String loginUrl;
@@ -52,6 +47,11 @@
    private String password;
    /**
     * 刷新频率
     */
    private String refreshFreq;
    /**
     * token
     */
    private String token;
iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/vo/HttpTokenRespVO.java
@@ -21,48 +21,36 @@
    @ExcelProperty("ID")
    private String id;
    @Schema(description = "", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
    @ExcelProperty("")
    @Schema(description = "接口ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
    @ExcelProperty("接口ID")
    private String apiId;
    @Schema(description = "", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
    @ExcelProperty("")
    @Schema(description = "登录地址", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
    @ExcelProperty("登录地址")
    private String loginUrl;
    @Schema(description = "", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
    @ExcelProperty("")
    @Schema(description = "ClientId", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
    @ExcelProperty("ClientId")
    private String clientId;
    @Schema(description = "", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
    @ExcelProperty("")
    @Schema(description = "ClientSecret", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
    @ExcelProperty("ClientSecret")
    private String clientSecret;
    @Schema(description = "", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
    @ExcelProperty("")
    @Schema(description = "用户名", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
    @ExcelProperty("用户名")
    private String username;
    @Schema(description = "", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
    @ExcelProperty("")
    @Schema(description = "密码", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
    @ExcelProperty("密码")
    private String password;
    @Schema(description = "", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
    @ExcelProperty("")
    @Schema(description = "token", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
    @ExcelProperty("token")
    private String token;
    @Schema(description = "", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
    @ExcelProperty("")
    private String prvsetName;
    @Schema(description = "", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
    @ExcelProperty("")
    private String projectName;
    @Schema(description = "", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
    @ExcelProperty("")
    private String platform;
    @Schema(description = "", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
    @ExcelProperty("")
    @Schema(description = "过期时间", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
    @ExcelProperty("过期时间")
    private Date expireTime;
    @Schema(description = "更新时间", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/modbus/service/impl/ChannelModbusTagServiceImpl.java
@@ -82,67 +82,4 @@
        baseMapper.delete(new QueryWrapper<ChannelModBusTagEntity>().eq("device", name));
    }
//    /**
//     * 导入Tag
//     *
//     * @param device
//     * @param file
//     * @throws Exception
//     */
//    @Override
//    @Transactional(rollbackFor = Exception.class)
//    public void importTag(String device, MultipartFile file) throws Exception {
//        try {
//            String suffix = file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf("."));
//            String fileName = UUID.randomUUID().toString() + suffix;
//            String path = uploadDir + fileName;
//            file.transferTo(new File(path));
//
//            XSSFWorkbook hssfWorkbook = new XSSFWorkbook(new FileInputStream(path));
//            XSSFSheet sheet = hssfWorkbook.getSheetAt(0);
//            int lastRowNum = sheet.getLastRowNum();
//            log.info("最后一行:" + lastRowNum);
//            int lastCellNum = 6;
//            List<ChannelModBusTagEntity> dangerList = new ArrayList<>();
//            for (int i = 1; i <= lastRowNum; i++) {
//                XSSFRow row = sheet.getRow(i);
//                for (int j = row.getFirstCellNum(); j < lastCellNum; j++) {
//                    row.getCell(j).setCellType(CellType.STRING);
//                }
//                ChannelModBusTagEntity tagEntity = new ChannelModBusTagEntity();
//                tagEntity.setId(UUID.randomUUID().toString());
//                tagEntity.setTagName(row.getCell(1).getStringCellValue());
//                tagEntity.setDataType(row.getCell(2).getStringCellValue());
//                tagEntity.setEnabled(true);
//                tagEntity.setFormat("");
//                tagEntity.setDevice(device);
//                tagEntity.setSamplingRate(0);
//                row.getCell(4).setCellType(CellType.STRING);
//                System.out.println(row.getCell(3).getStringCellValue());
//                if(row.getCell(3).getStringCellValue().equals("1")){
//                    tagEntity.setAddress(String.format("1%04d",Integer.parseInt(row.getCell(4).getStringCellValue())));
//                }else if(row.getCell(3).getStringCellValue().equals("3")){
//                    tagEntity.setAddress(String.format("4%04d",Integer.parseInt(row.getCell(4).getStringCellValue())));
//                }
//                tagEntity.setTagDesc(row.getCell(5).getStringCellValue());
//                dangerList.add(tagEntity);
//            }
//            if (CollectionUtils.isEmpty(dangerList)) {
//                return;
//            }
//            //getBaseMapper().insertList(dangerList);
//            dangerList.forEach(item -> {
//                try {
//                    getBaseMapper().insert(item);
//                } catch (Exception ex) {
//                    log.warn("插入异常:" + item.getTagName());
//                }
//            });
//        } catch (Exception ex) {
//            ex.printStackTrace();
//            log.warn("导入失败!");
//            throw ex;
//        }
//    }
}
iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/opcda/service/impl/ChannelOPCDATagServiceImpl.java
@@ -1,5 +1,6 @@
package com.iailab.module.data.channel.opcda.service.impl;
import com.baomidou.dynamic.datasource.annotation.DSTransactional;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -17,7 +18,6 @@
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
@@ -92,7 +92,7 @@
    }
    @Override
    @Transactional(rollbackFor = Exception.class)
    @DSTransactional(rollbackFor = Exception.class)
    public void importTag(String serverId, MultipartFile file) throws Exception {
        try {
            String suffix = file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf("."));
iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/opcua/service/impl/ChannelOPCUATagServiceImpl.java
@@ -1,5 +1,6 @@
package com.iailab.module.data.channel.opcua.service.impl;
import com.baomidou.dynamic.datasource.annotation.DSTransactional;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -17,7 +18,6 @@
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
@@ -93,7 +93,7 @@
    }
    @Override
    @Transactional(rollbackFor = Exception.class)
    @DSTransactional(rollbackFor = Exception.class)
    public void importTag(String device, MultipartFile file) throws Exception {
        try {
            String suffix = file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf("."));
iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/controller/admin/DaPointController.java
@@ -10,6 +10,7 @@
import com.iailab.module.data.point.vo.DaPointRespVO;
import io.swagger.v3.oas.annotations.Operation;
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.*;
@@ -37,12 +38,14 @@
    @Resource
    private DaPointService daPointService;
    @PreAuthorize("@ss.hasPermission('data:point:query')")
    @GetMapping("page")
    public CommonResult<PageResult<DaPointRespVO>> page(@Valid DaPointPageReqVO reqVO){
        PageResult<DaPointEntity> page = daPointService.queryPage(reqVO);
        return success(BeanUtils.toBean(page, DaPointRespVO.class));
    }
    @PreAuthorize("@ss.hasPermission('data:point:query')")
    @GetMapping("/list")
    @Operation(summary = "列表")
    public CommonResult<List<DaPointDTO>> list(@Valid @RequestParam Map<String, Object> params) {
@@ -50,32 +53,37 @@
        return success(list);
    }
    @PreAuthorize("@ss.hasPermission('data:point:query')")
    @GetMapping("/info/{id}")
    public CommonResult<DaPointDTO> info(@PathVariable("id") String id){
        DaPointDTO info= daPointService.info(id);
        return success(info);
    }
    @PreAuthorize("@ss.hasPermission('data:point:create')")
    @PostMapping("/add")
    public CommonResult<Boolean> add(@RequestBody DaPointDTO daPointDTO){
    public CommonResult<Boolean> create(@RequestBody DaPointDTO daPointDTO){
        String id = UUID.randomUUID().toString();
        daPointDTO.setId(id);
        daPointService.add(daPointDTO);
        return success(true);
    }
    @PreAuthorize("@ss.hasPermission('data:point:update')")
    @PutMapping("/update")
    public CommonResult<Boolean> update(@RequestBody DaPointDTO daPointDTO) {
        daPointService.update(daPointDTO);
        return success(true);
    }
    @PreAuthorize("@ss.hasPermission('data:point:delete')")
    @DeleteMapping("/delete")
    public CommonResult<Boolean> delete(String[] ids) {
        daPointService.delete(ids);
        return success(true);
    }
    @PreAuthorize("@ss.hasPermission('data:point:query')")
    @GetMapping("pointNo")
    public CommonResult<List<DaPointDTO>> getpoint(@RequestParam Map<String, Object> params){
        List<DaPointDTO> list = daPointService.list(params);
@@ -83,6 +91,7 @@
        return new CommonResult<List<DaPointDTO>>().setData(list);
    }
    @PreAuthorize("@ss.hasPermission('data:point:update')")
    @PutMapping("/enable")
    @Operation(summary = "启用")
    @Transactional
@@ -91,6 +100,7 @@
        return success(true);
    }
    @PreAuthorize("@ss.hasPermission('data:point:update')")
    @PutMapping("/disable")
    @Operation(summary = "禁用")
    @Transactional
iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/controller/package-info.java
对比新文件
@@ -0,0 +1 @@
package com.iailab.module.data.point.controller;
iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/service/impl/DaPointServiceImpl.java
@@ -1,6 +1,7 @@
package com.iailab.module.data.point.service.impl;
import com.alibaba.fastjson.JSONArray;
import com.baomidou.dynamic.datasource.annotation.DSTransactional;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.iailab.framework.common.pojo.PageResult;
@@ -20,7 +21,6 @@
import com.iailab.module.data.point.vo.DaPointPageReqVO;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import javax.annotation.Resource;
@@ -90,7 +90,7 @@
    }
    @Override
    @Transactional(rollbackFor = Exception.class)
    @DSTransactional(rollbackFor = Exception.class)
    public void add(DaPointDTO dataPoint) {
        DaPointEntity daPointEntity = ConvertUtils.sourceToTarget(dataPoint, DaPointEntity.class);
        daPointEntity.setId(UUID.randomUUID().toString());
@@ -113,7 +113,7 @@
    }
    @Override
    @Transactional(rollbackFor = Exception.class)
    @DSTransactional(rollbackFor = Exception.class)
    public void update(DaPointDTO dataPoint) {
        DaPointEntity daPointEntity = ConvertUtils.sourceToTarget(dataPoint, DaPointEntity.class);
        daPointEntity.setUpdateTime(new Date());
@@ -130,7 +130,7 @@
    }
    @Override
    @Transactional(rollbackFor = Exception.class)
    @DSTransactional(rollbackFor = Exception.class)
    public void delete(String[] ids) {
        daPointDao.deleteBatchIds(Arrays.asList(ids));
        daMeasurePointService.deleteByPoint(ids);
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
@@ -1,5 +1,6 @@
package com.iailab.module.model.mcs.sche.service.impl;
import com.baomidou.dynamic.datasource.annotation.DSTransactional;
import com.iailab.framework.common.pojo.PageResult;
import com.iailab.framework.common.service.impl.BaseServiceImpl;
import com.iailab.module.model.mcs.sche.dao.StScheduleRecordDao;
@@ -10,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;
@@ -33,7 +33,7 @@
    }
    @Override
    @Transactional(rollbackFor = Exception.class)
    @DSTransactional(rollbackFor = Exception.class)
    public void create(ScheduleResultVO resultVO) {
        StScheduleRecordEntity entity = new StScheduleRecordEntity();
        entity.setId(UUID.randomUUID().toString());
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);
@@ -409,7 +337,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();
@@ -420,32 +348,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
@@ -1,3 +1,4 @@
--- #################### 注册中心 + 配置中心相关配置 ####################
spring:
  application:
    name: model-server
@@ -11,12 +12,12 @@
      username: @nacos.username@
      password: @nacos.password@
      discovery: # 【配置中心】配置项
        namespace: test
        namespace: @profiles.active@
        group: DEFAULT_GROUP # 使用的 Nacos 配置分组,默认为 DEFAULT_GROUP
        metadata:
          version: @nacos.metadata.version@ # 服务实例的版本号,可用于灰度发布
      config: # 【注册中心】配置项
        namespace: test
        namespace: @profiles.active@
        group: DEFAULT_GROUP # 使用的 Nacos 配置分组,默认为 DEFAULT_GROUP
  main:
@@ -157,8 +158,8 @@
    admin-ui:
      url:  # Admin 管理后台 UI 的地址
  swagger:
    title: 数据采集
    description: 数据采集
    title: 模型管理
    description: 模型管理
    version: ${iailab.info.version}
    base-package: ${iailab.info.base-package}
  tenant: # 多租户相关配置项
@@ -201,6 +202,18 @@
      - t_st_schedule_suggest
      - t_st_schedule_record
      - t_st_schedule_record_detail
      - t_mpk_file
      - t_mpk_generator_code_history
      - t_mpk_method_setting
      - t_mpk_model_method
      - t_mpk_project
      - t_mpk_project_model
      - 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