diff --git a/qknow-module-ext/qknow-module-ext-biz/src/main/java/tech/qiantong/qknow/module/ext/controller/admin/extTaskLog/ExtTaskLogController.java b/qknow-module-ext/qknow-module-ext-biz/src/main/java/tech/qiantong/qknow/module/ext/controller/admin/extTaskLog/ExtTaskLogController.java new file mode 100644 index 0000000000000000000000000000000000000000..8991c16edceb3f94eadafa850f9ae474640b87a6 --- /dev/null +++ b/qknow-module-ext/qknow-module-ext-biz/src/main/java/tech/qiantong/qknow/module/ext/controller/admin/extTaskLog/ExtTaskLogController.java @@ -0,0 +1,142 @@ +/* + * Copyright (c) 2026 Jiangsu Qiantong Technology Co., Ltd. + * * + * Software Name: qKnow Knowledge Platform (Business Edition) + * Software Copyright Registration No. 15980140 + * * + * [RIGHTS AND LICENSE STATEMENT] + * This file contains non-public commercial source code of which Jiangsu Qiantong + * Technology Co., Ltd. lawfully possesses complete intellectual property rights. + * * + * Access and use are limited to entities or individuals who have signed a valid + * commercial license agreement, within the scope stipulated in the agreement. + * The "accessibility" of this source code is premised on lawful authorization + * and does not constitute any form of transfer of intellectual property rights + * or implied licensing. + * * + * [PROHIBITIONS] + * Unless explicitly agreed in the license agreement, the following acts in any + * form are strictly prohibited: + * 1. Copying, disseminating, disclosing, selling, renting, or redistributing + * this source code; + * 2. Providing the software's functionality to third parties via SaaS, PaaS, + * cloud hosting, or other means; + * 3. Using this software or its derivative versions to develop products that + * compete with the Right Holder; + * 4. Providing or displaying this source code or related technical information + * to unauthorized third parties; + * 5. Tampering with, circumventing, or destroying copyright notices, license + * verifications, or other technical protection measures. + * * + * [LEGAL LIABILITY] + * Any unauthorized use constitutes an infringement of trade secrets and + * intellectual property rights. + * * + * The Right Holder will strictly pursue liability for breach of contract and + * infringement in accordance with the commercial agreement and laws such as + * the "Copyright Law of the People's Republic of China" and the "Anti-Unfair + * Competition Law". + * * + * ============================================================================ + * * + * Copyright (c) 2026 江苏千桐科技有限公司 + * * + * 软件名称:qKnow 知识平台(商业版) | 软著登字第15980140号 + * * + * 【权利与授权声明】 + * 本文件属于江苏千桐科技有限公司依法享有完全知识产权的非公开商业源代码。 + * 仅限已签署有效商业授权合同的单位或个人在约定范围内查阅和使用。 + * 源代码的“可访问性”均以合法授权为前提,不构成任何形式的知识产权转让或默示授权。 + * * + * 【禁止事项】 + * 除授权合同明确约定外,严禁任何形式的: + * 1. 复制、传播、披露、出售、出租或再分发本源代码; + * 2. 通过 SaaS、PaaS、云托管等方式向第三方提供本软件功能; + * 3. 将本软件或其衍生版本用于开发与权利人构成竞争的产品; + * 4. 向未授权第三方提供或展示本源代码或相关技术信息; + * 5. 篡改、规避或破坏版权标识、授权校验及其他技术保护措施。 + * * + * 【法律责任】 + * 任何未经授权的利用行为,均构成对商业秘密及知识产权的侵害。 + * 权利人将依据商业合同及《中华人民共和国著作权法》《反不正当竞争法》 + * 等法律法规,严厉追究违约与侵权责任。 + */ + +package tech.qiantong.qknow.module.ext.controller.admin.extTaskLog; + +import cn.hutool.core.lang.Assert; +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.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import tech.qiantong.qknow.common.annotation.Log; +import tech.qiantong.qknow.common.core.controller.BaseController; +import tech.qiantong.qknow.common.core.domain.CommonResult; +import tech.qiantong.qknow.common.core.page.PageParam; +import tech.qiantong.qknow.common.core.page.PageResult; +import tech.qiantong.qknow.common.enums.BusinessType; +import tech.qiantong.qknow.common.utils.object.BeanUtils; +import tech.qiantong.qknow.common.utils.poi.ExcelUtil; +import tech.qiantong.qknow.module.ext.controller.admin.extTaskLog.vo.ExtTaskLogDetailPageReqVO; +import tech.qiantong.qknow.module.ext.controller.admin.extTaskLog.vo.ExtTaskLogPageReqVO; +import tech.qiantong.qknow.module.ext.controller.admin.extTaskLog.vo.ExtTaskLogRespVO; +import tech.qiantong.qknow.module.ext.convert.extTaskLog.ExtTaskLogConvert; +import tech.qiantong.qknow.module.ext.dal.dataobject.extTaskLog.ExtTaskLogDO; +import tech.qiantong.qknow.module.ext.dal.dataobject.extTaskLog.ExtTaskLogDetailDO; +import tech.qiantong.qknow.module.ext.service.extTaskLog.IExtTaskLogService; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; +import java.util.List; + +/** + * 抽取任务执行日志Controller + * + * @author qknow + * @date 2025-12-03 + */ +@Tag(name = "抽取任务执行日志") +@RestController +@RequestMapping("/ext/taskLog") +@Validated +public class ExtTaskLogController extends BaseController { + @Resource + private IExtTaskLogService extTaskLogService; + + @Operation(summary = "查询抽取任务执行日志列表") + @PreAuthorize("@ss.hasAnyPermi('ext:extTasklog:tasklog:list,ext:extUnstructTask:unstructtask:taskLog')") + @GetMapping("/list") + public CommonResult> list(ExtTaskLogPageReqVO extTaskLog) { + PageResult page = extTaskLogService.getExtTaskLogPage(extTaskLog); + return CommonResult.success(BeanUtils.toBean(page, ExtTaskLogRespVO.class)); + } + + @Operation(summary = "抽取任务详情分页") + @PreAuthorize("@ss.hasAnyPermi('ext:extTasklog:tasklog:list,ext:extUnstructTask:unstructtask:taskLog')") + @GetMapping("detail/page") + public CommonResult> detailPage(ExtTaskLogDetailPageReqVO extTaskLogDetail) { + Assert.notNull(extTaskLogDetail.getLogId(),"日志id 不能为空"); + PageResult page = extTaskLogService.getLogDetailPage(extTaskLogDetail); + return CommonResult.success(BeanUtils.toBean(page, ExtTaskLogDetailPageReqVO.class)); + } + + @Operation(summary = "导出抽取任务执行日志列表") + @PreAuthorize("@ss.hasPermi('ext:extTasklog:tasklog:export')") + @Log(title = "抽取任务执行日志", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, ExtTaskLogPageReqVO exportReqVO) { + exportReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); + List list = (List) extTaskLogService.getExtTaskLogPage(exportReqVO).getRows(); + ExcelUtil util = new ExcelUtil<>(ExtTaskLogRespVO.class); + util.exportExcel(response, ExtTaskLogConvert.INSTANCE.convertToRespVOList(list), "应用管理数据"); + } + + @Operation(summary = "获取抽取任务执行日志详细信息") + @PreAuthorize("@ss.hasAnyPermi('ext:extTasklog:tasklog:list,ext:extUnstructTask:unstructtask:taskLog')") + @GetMapping(value = "/{id}") + public CommonResult getInfo(@PathVariable("id") Long id) { + ExtTaskLogDO extTaskLogDO = extTaskLogService.getExtTaskLogById(id); + return CommonResult.success(BeanUtils.toBean(extTaskLogDO, ExtTaskLogRespVO.class)); + } +} diff --git a/qknow-module-ext/qknow-module-ext-biz/src/main/java/tech/qiantong/qknow/module/ext/controller/admin/extTaskLog/vo/ExtTaskLogDetailPageReqVO.java b/qknow-module-ext/qknow-module-ext-biz/src/main/java/tech/qiantong/qknow/module/ext/controller/admin/extTaskLog/vo/ExtTaskLogDetailPageReqVO.java new file mode 100644 index 0000000000000000000000000000000000000000..1cc5fae6c29116aef670b103f187cdda5e1e40fb --- /dev/null +++ b/qknow-module-ext/qknow-module-ext-biz/src/main/java/tech/qiantong/qknow/module/ext/controller/admin/extTaskLog/vo/ExtTaskLogDetailPageReqVO.java @@ -0,0 +1,96 @@ +/* + * Copyright (c) 2026 Jiangsu Qiantong Technology Co., Ltd. + * * + * Software Name: qKnow Knowledge Platform (Business Edition) + * Software Copyright Registration No. 15980140 + * * + * [RIGHTS AND LICENSE STATEMENT] + * This file contains non-public commercial source code of which Jiangsu Qiantong + * Technology Co., Ltd. lawfully possesses complete intellectual property rights. + * * + * Access and use are limited to entities or individuals who have signed a valid + * commercial license agreement, within the scope stipulated in the agreement. + * The "accessibility" of this source code is premised on lawful authorization + * and does not constitute any form of transfer of intellectual property rights + * or implied licensing. + * * + * [PROHIBITIONS] + * Unless explicitly agreed in the license agreement, the following acts in any + * form are strictly prohibited: + * 1. Copying, disseminating, disclosing, selling, renting, or redistributing + * this source code; + * 2. Providing the software's functionality to third parties via SaaS, PaaS, + * cloud hosting, or other means; + * 3. Using this software or its derivative versions to develop products that + * compete with the Right Holder; + * 4. Providing or displaying this source code or related technical information + * to unauthorized third parties; + * 5. Tampering with, circumventing, or destroying copyright notices, license + * verifications, or other technical protection measures. + * * + * [LEGAL LIABILITY] + * Any unauthorized use constitutes an infringement of trade secrets and + * intellectual property rights. + * * + * The Right Holder will strictly pursue liability for breach of contract and + * infringement in accordance with the commercial agreement and laws such as + * the "Copyright Law of the People's Republic of China" and the "Anti-Unfair + * Competition Law". + * * + * ============================================================================ + * * + * Copyright (c) 2026 江苏千桐科技有限公司 + * * + * 软件名称:qKnow 知识平台(商业版) | 软著登字第15980140号 + * * + * 【权利与授权声明】 + * 本文件属于江苏千桐科技有限公司依法享有完全知识产权的非公开商业源代码。 + * 仅限已签署有效商业授权合同的单位或个人在约定范围内查阅和使用。 + * 源代码的“可访问性”均以合法授权为前提,不构成任何形式的知识产权转让或默示授权。 + * * + * 【禁止事项】 + * 除授权合同明确约定外,严禁任何形式的: + * 1. 复制、传播、披露、出售、出租或再分发本源代码; + * 2. 通过 SaaS、PaaS、云托管等方式向第三方提供本软件功能; + * 3. 将本软件或其衍生版本用于开发与权利人构成竞争的产品; + * 4. 向未授权第三方提供或展示本源代码或相关技术信息; + * 5. 篡改、规避或破坏版权标识、授权校验及其他技术保护措施。 + * * + * 【法律责任】 + * 任何未经授权的利用行为,均构成对商业秘密及知识产权的侵害。 + * 权利人将依据商业合同及《中华人民共和国著作权法》《反不正当竞争法》 + * 等法律法规,严厉追究违约与侵权责任。 + */ + +package tech.qiantong.qknow.module.ext.controller.admin.extTaskLog.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import tech.qiantong.qknow.common.core.page.PageParam; + +/** + * 抽取任务执行日志详情 Request VO 对象 ext_task_log_detail + * + * @author qknow + * @date 2025-12-03 + */ +@Schema(description = "抽取任务执行日志详情 Request VO") +@Data +public class ExtTaskLogDetailPageReqVO extends PageParam { + + private static final long serialVersionUID = 1L; + @Schema(description = "ID", example = "") + private Long id; + @Schema(description = "工作区id", example = "") + private Long workspaceId; + + @Schema(description = "执行日志id", example = "") + private Long logId; + + @Schema(description = "任务执行步骤", example = "") + private String step; + + + + +} diff --git a/qknow-module-ext/qknow-module-ext-biz/src/main/java/tech/qiantong/qknow/module/ext/controller/admin/extTaskLog/vo/ExtTaskLogDetailRespVO.java b/qknow-module-ext/qknow-module-ext-biz/src/main/java/tech/qiantong/qknow/module/ext/controller/admin/extTaskLog/vo/ExtTaskLogDetailRespVO.java new file mode 100644 index 0000000000000000000000000000000000000000..9128a19932787c8bb57dbaea555b330e77533168 --- /dev/null +++ b/qknow-module-ext/qknow-module-ext-biz/src/main/java/tech/qiantong/qknow/module/ext/controller/admin/extTaskLog/vo/ExtTaskLogDetailRespVO.java @@ -0,0 +1,141 @@ +/* + * Copyright (c) 2026 Jiangsu Qiantong Technology Co., Ltd. + * * + * Software Name: qKnow Knowledge Platform (Business Edition) + * Software Copyright Registration No. 15980140 + * * + * [RIGHTS AND LICENSE STATEMENT] + * This file contains non-public commercial source code of which Jiangsu Qiantong + * Technology Co., Ltd. lawfully possesses complete intellectual property rights. + * * + * Access and use are limited to entities or individuals who have signed a valid + * commercial license agreement, within the scope stipulated in the agreement. + * The "accessibility" of this source code is premised on lawful authorization + * and does not constitute any form of transfer of intellectual property rights + * or implied licensing. + * * + * [PROHIBITIONS] + * Unless explicitly agreed in the license agreement, the following acts in any + * form are strictly prohibited: + * 1. Copying, disseminating, disclosing, selling, renting, or redistributing + * this source code; + * 2. Providing the software's functionality to third parties via SaaS, PaaS, + * cloud hosting, or other means; + * 3. Using this software or its derivative versions to develop products that + * compete with the Right Holder; + * 4. Providing or displaying this source code or related technical information + * to unauthorized third parties; + * 5. Tampering with, circumventing, or destroying copyright notices, license + * verifications, or other technical protection measures. + * * + * [LEGAL LIABILITY] + * Any unauthorized use constitutes an infringement of trade secrets and + * intellectual property rights. + * * + * The Right Holder will strictly pursue liability for breach of contract and + * infringement in accordance with the commercial agreement and laws such as + * the "Copyright Law of the People's Republic of China" and the "Anti-Unfair + * Competition Law". + * * + * ============================================================================ + * * + * Copyright (c) 2026 江苏千桐科技有限公司 + * * + * 软件名称:qKnow 知识平台(商业版) | 软著登字第15980140号 + * * + * 【权利与授权声明】 + * 本文件属于江苏千桐科技有限公司依法享有完全知识产权的非公开商业源代码。 + * 仅限已签署有效商业授权合同的单位或个人在约定范围内查阅和使用。 + * 源代码的“可访问性”均以合法授权为前提,不构成任何形式的知识产权转让或默示授权。 + * * + * 【禁止事项】 + * 除授权合同明确约定外,严禁任何形式的: + * 1. 复制、传播、披露、出售、出租或再分发本源代码; + * 2. 通过 SaaS、PaaS、云托管等方式向第三方提供本软件功能; + * 3. 将本软件或其衍生版本用于开发与权利人构成竞争的产品; + * 4. 向未授权第三方提供或展示本源代码或相关技术信息; + * 5. 篡改、规避或破坏版权标识、授权校验及其他技术保护措施。 + * * + * 【法律责任】 + * 任何未经授权的利用行为,均构成对商业秘密及知识产权的侵害。 + * 权利人将依据商业合同及《中华人民共和国著作权法》《反不正当竞争法》 + * 等法律法规,严厉追究违约与侵权责任。 + */ + +package tech.qiantong.qknow.module.ext.controller.admin.extTaskLog.vo; + +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import tech.qiantong.qknow.common.annotation.Excel; + +import java.io.Serializable; +import java.util.Date; + +/** + * 抽取任务执行日志详情 Response VO 对象 ext_task_log_detail + * + * @author qknow + * @date 2025-12-03 + */ +@Schema(description = "抽取任务执行日志详情 Response VO") +@Data +public class ExtTaskLogDetailRespVO implements Serializable { + + private static final long serialVersionUID = 1L; + + @Excel(name = "ID") + @Schema(description = "ID") + private Long id; + + @Excel(name = "工作区id") + @Schema(description = "工作区id", example = "") + private Long workspaceId; + + @Excel(name = "执行日志id") + @Schema(description = "执行日志id", example = "") + private Long logId; + + @Excel(name = "任务执行步骤") + @Schema(description = "任务执行步骤", example = "") + private String step; + + @Excel(name = "是否有效") + @Schema(description = "是否有效", example = "") + private Boolean validFlag; + + @Excel(name = "删除标志") + @Schema(description = "删除标志", example = "") + private Boolean delFlag; + + @Excel(name = "创建人") + @Schema(description = "创建人", example = "") + private String createBy; + + @Excel(name = "创建人id") + @Schema(description = "创建人id", example = "") + private Long creatorId; + + @Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Schema(description = "创建时间", example = "") + private Date createTime; + + @Excel(name = "更新人") + @Schema(description = "更新人", example = "") + private String updateBy; + + @Excel(name = "更新人id") + @Schema(description = "更新人id", example = "") + private Long updaterId; + + @Excel(name = "更新时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Schema(description = "更新时间", example = "") + private Date updateTime; + + @Excel(name = "备注") + @Schema(description = "备注", example = "") + private String remark; + +} diff --git a/qknow-module-ext/qknow-module-ext-biz/src/main/java/tech/qiantong/qknow/module/ext/controller/admin/extTaskLog/vo/ExtTaskLogDetailSaveReqVO.java b/qknow-module-ext/qknow-module-ext-biz/src/main/java/tech/qiantong/qknow/module/ext/controller/admin/extTaskLog/vo/ExtTaskLogDetailSaveReqVO.java new file mode 100644 index 0000000000000000000000000000000000000000..33c738b29b6c184093d374ed51effcebaa0fdbc8 --- /dev/null +++ b/qknow-module-ext/qknow-module-ext-biz/src/main/java/tech/qiantong/qknow/module/ext/controller/admin/extTaskLog/vo/ExtTaskLogDetailSaveReqVO.java @@ -0,0 +1,106 @@ +/* + * Copyright (c) 2026 Jiangsu Qiantong Technology Co., Ltd. + * * + * Software Name: qKnow Knowledge Platform (Business Edition) + * Software Copyright Registration No. 15980140 + * * + * [RIGHTS AND LICENSE STATEMENT] + * This file contains non-public commercial source code of which Jiangsu Qiantong + * Technology Co., Ltd. lawfully possesses complete intellectual property rights. + * * + * Access and use are limited to entities or individuals who have signed a valid + * commercial license agreement, within the scope stipulated in the agreement. + * The "accessibility" of this source code is premised on lawful authorization + * and does not constitute any form of transfer of intellectual property rights + * or implied licensing. + * * + * [PROHIBITIONS] + * Unless explicitly agreed in the license agreement, the following acts in any + * form are strictly prohibited: + * 1. Copying, disseminating, disclosing, selling, renting, or redistributing + * this source code; + * 2. Providing the software's functionality to third parties via SaaS, PaaS, + * cloud hosting, or other means; + * 3. Using this software or its derivative versions to develop products that + * compete with the Right Holder; + * 4. Providing or displaying this source code or related technical information + * to unauthorized third parties; + * 5. Tampering with, circumventing, or destroying copyright notices, license + * verifications, or other technical protection measures. + * * + * [LEGAL LIABILITY] + * Any unauthorized use constitutes an infringement of trade secrets and + * intellectual property rights. + * * + * The Right Holder will strictly pursue liability for breach of contract and + * infringement in accordance with the commercial agreement and laws such as + * the "Copyright Law of the People's Republic of China" and the "Anti-Unfair + * Competition Law". + * * + * ============================================================================ + * * + * Copyright (c) 2026 江苏千桐科技有限公司 + * * + * 软件名称:qKnow 知识平台(商业版) | 软著登字第15980140号 + * * + * 【权利与授权声明】 + * 本文件属于江苏千桐科技有限公司依法享有完全知识产权的非公开商业源代码。 + * 仅限已签署有效商业授权合同的单位或个人在约定范围内查阅和使用。 + * 源代码的“可访问性”均以合法授权为前提,不构成任何形式的知识产权转让或默示授权。 + * * + * 【禁止事项】 + * 除授权合同明确约定外,严禁任何形式的: + * 1. 复制、传播、披露、出售、出租或再分发本源代码; + * 2. 通过 SaaS、PaaS、云托管等方式向第三方提供本软件功能; + * 3. 将本软件或其衍生版本用于开发与权利人构成竞争的产品; + * 4. 向未授权第三方提供或展示本源代码或相关技术信息; + * 5. 篡改、规避或破坏版权标识、授权校验及其他技术保护措施。 + * * + * 【法律责任】 + * 任何未经授权的利用行为,均构成对商业秘密及知识产权的侵害。 + * 权利人将依据商业合同及《中华人民共和国著作权法》《反不正当竞争法》 + * 等法律法规,严厉追究违约与侵权责任。 + */ + +package tech.qiantong.qknow.module.ext.controller.admin.extTaskLog.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import tech.qiantong.qknow.common.core.domain.BaseEntity; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; + +/** + * 抽取任务执行日志详情 创建/修改 Request VO ext_task_log_detail + * + * @author qknow + * @date 2025-12-03 + */ +@Schema(description = "抽取任务执行日志详情 Response VO") +@Data +public class ExtTaskLogDetailSaveReqVO extends BaseEntity { + + private static final long serialVersionUID = 1L; + + @Schema(description = "ID") + private Long id; + + @Schema(description = "工作区id", example = "") + @NotNull(message = "工作区id不能为空") + private Long workspaceId; + + @Schema(description = "执行日志id", example = "") + @NotNull(message = "执行日志id不能为空") + private Long logId; + + @Schema(description = "任务执行步骤", example = "") + @NotBlank(message = "任务执行步骤不能为空") + private String step; + + @Schema(description = "备注", example = "") + @NotBlank(message = "备注不能为空") + private String remark; + + +} diff --git a/qknow-module-ext/qknow-module-ext-biz/src/main/java/tech/qiantong/qknow/module/ext/controller/admin/extTaskLog/vo/ExtTaskLogPageReqVO.java b/qknow-module-ext/qknow-module-ext-biz/src/main/java/tech/qiantong/qknow/module/ext/controller/admin/extTaskLog/vo/ExtTaskLogPageReqVO.java new file mode 100644 index 0000000000000000000000000000000000000000..80fc686baa45e5d9cdfcd7c1cc50fa7dc55aeeea --- /dev/null +++ b/qknow-module-ext/qknow-module-ext-biz/src/main/java/tech/qiantong/qknow/module/ext/controller/admin/extTaskLog/vo/ExtTaskLogPageReqVO.java @@ -0,0 +1,113 @@ +/* + * Copyright (c) 2026 Jiangsu Qiantong Technology Co., Ltd. + * * + * Software Name: qKnow Knowledge Platform (Business Edition) + * Software Copyright Registration No. 15980140 + * * + * [RIGHTS AND LICENSE STATEMENT] + * This file contains non-public commercial source code of which Jiangsu Qiantong + * Technology Co., Ltd. lawfully possesses complete intellectual property rights. + * * + * Access and use are limited to entities or individuals who have signed a valid + * commercial license agreement, within the scope stipulated in the agreement. + * The "accessibility" of this source code is premised on lawful authorization + * and does not constitute any form of transfer of intellectual property rights + * or implied licensing. + * * + * [PROHIBITIONS] + * Unless explicitly agreed in the license agreement, the following acts in any + * form are strictly prohibited: + * 1. Copying, disseminating, disclosing, selling, renting, or redistributing + * this source code; + * 2. Providing the software's functionality to third parties via SaaS, PaaS, + * cloud hosting, or other means; + * 3. Using this software or its derivative versions to develop products that + * compete with the Right Holder; + * 4. Providing or displaying this source code or related technical information + * to unauthorized third parties; + * 5. Tampering with, circumventing, or destroying copyright notices, license + * verifications, or other technical protection measures. + * * + * [LEGAL LIABILITY] + * Any unauthorized use constitutes an infringement of trade secrets and + * intellectual property rights. + * * + * The Right Holder will strictly pursue liability for breach of contract and + * infringement in accordance with the commercial agreement and laws such as + * the "Copyright Law of the People's Republic of China" and the "Anti-Unfair + * Competition Law". + * * + * ============================================================================ + * * + * Copyright (c) 2026 江苏千桐科技有限公司 + * * + * 软件名称:qKnow 知识平台(商业版) | 软著登字第15980140号 + * * + * 【权利与授权声明】 + * 本文件属于江苏千桐科技有限公司依法享有完全知识产权的非公开商业源代码。 + * 仅限已签署有效商业授权合同的单位或个人在约定范围内查阅和使用。 + * 源代码的“可访问性”均以合法授权为前提,不构成任何形式的知识产权转让或默示授权。 + * * + * 【禁止事项】 + * 除授权合同明确约定外,严禁任何形式的: + * 1. 复制、传播、披露、出售、出租或再分发本源代码; + * 2. 通过 SaaS、PaaS、云托管等方式向第三方提供本软件功能; + * 3. 将本软件或其衍生版本用于开发与权利人构成竞争的产品; + * 4. 向未授权第三方提供或展示本源代码或相关技术信息; + * 5. 篡改、规避或破坏版权标识、授权校验及其他技术保护措施。 + * * + * 【法律责任】 + * 任何未经授权的利用行为,均构成对商业秘密及知识产权的侵害。 + * 权利人将依据商业合同及《中华人民共和国著作权法》《反不正当竞争法》 + * 等法律法规,严厉追究违约与侵权责任。 + */ + +package tech.qiantong.qknow.module.ext.controller.admin.extTaskLog.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import tech.qiantong.qknow.common.core.page.PageParam; + +import java.util.Date; + +/** + * 抽取任务执行日志 Request VO 对象 ext_task_log + * + * @author qknow + * @date 2025-12-03 + */ +@Schema(description = "抽取任务执行日志 Request VO") +@Data +public class ExtTaskLogPageReqVO extends PageParam { + + private static final long serialVersionUID = 1L; + @Schema(description = "ID", example = "") + private Long id; + @Schema(description = "工作区id", example = "") + private Long workspaceId; + + @Schema(description = "任务id", example = "") + private Long taskId; + + @Schema(description = "任务类型", example = "") + private String taskType; + + @Schema(description = "任务名称", example = "") + private String taskName; + + @Schema(description = "状态", example = "") + private String status; + + @Schema(description = "错误消息", example = "") + private String errorMsg; + + @Schema(description = "执行开始时间", example = "") + private Date startTime; + + @Schema(description = "执行结束时间", example = "") + private Date endTime; + + + + +} diff --git a/qknow-module-ext/qknow-module-ext-biz/src/main/java/tech/qiantong/qknow/module/ext/controller/admin/extTaskLog/vo/ExtTaskLogRespVO.java b/qknow-module-ext/qknow-module-ext-biz/src/main/java/tech/qiantong/qknow/module/ext/controller/admin/extTaskLog/vo/ExtTaskLogRespVO.java new file mode 100644 index 0000000000000000000000000000000000000000..da946a3586ae43f8087441885aa9aa350493e3d9 --- /dev/null +++ b/qknow-module-ext/qknow-module-ext-biz/src/main/java/tech/qiantong/qknow/module/ext/controller/admin/extTaskLog/vo/ExtTaskLogRespVO.java @@ -0,0 +1,163 @@ +/* + * Copyright (c) 2026 Jiangsu Qiantong Technology Co., Ltd. + * * + * Software Name: qKnow Knowledge Platform (Business Edition) + * Software Copyright Registration No. 15980140 + * * + * [RIGHTS AND LICENSE STATEMENT] + * This file contains non-public commercial source code of which Jiangsu Qiantong + * Technology Co., Ltd. lawfully possesses complete intellectual property rights. + * * + * Access and use are limited to entities or individuals who have signed a valid + * commercial license agreement, within the scope stipulated in the agreement. + * The "accessibility" of this source code is premised on lawful authorization + * and does not constitute any form of transfer of intellectual property rights + * or implied licensing. + * * + * [PROHIBITIONS] + * Unless explicitly agreed in the license agreement, the following acts in any + * form are strictly prohibited: + * 1. Copying, disseminating, disclosing, selling, renting, or redistributing + * this source code; + * 2. Providing the software's functionality to third parties via SaaS, PaaS, + * cloud hosting, or other means; + * 3. Using this software or its derivative versions to develop products that + * compete with the Right Holder; + * 4. Providing or displaying this source code or related technical information + * to unauthorized third parties; + * 5. Tampering with, circumventing, or destroying copyright notices, license + * verifications, or other technical protection measures. + * * + * [LEGAL LIABILITY] + * Any unauthorized use constitutes an infringement of trade secrets and + * intellectual property rights. + * * + * The Right Holder will strictly pursue liability for breach of contract and + * infringement in accordance with the commercial agreement and laws such as + * the "Copyright Law of the People's Republic of China" and the "Anti-Unfair + * Competition Law". + * * + * ============================================================================ + * * + * Copyright (c) 2026 江苏千桐科技有限公司 + * * + * 软件名称:qKnow 知识平台(商业版) | 软著登字第15980140号 + * * + * 【权利与授权声明】 + * 本文件属于江苏千桐科技有限公司依法享有完全知识产权的非公开商业源代码。 + * 仅限已签署有效商业授权合同的单位或个人在约定范围内查阅和使用。 + * 源代码的“可访问性”均以合法授权为前提,不构成任何形式的知识产权转让或默示授权。 + * * + * 【禁止事项】 + * 除授权合同明确约定外,严禁任何形式的: + * 1. 复制、传播、披露、出售、出租或再分发本源代码; + * 2. 通过 SaaS、PaaS、云托管等方式向第三方提供本软件功能; + * 3. 将本软件或其衍生版本用于开发与权利人构成竞争的产品; + * 4. 向未授权第三方提供或展示本源代码或相关技术信息; + * 5. 篡改、规避或破坏版权标识、授权校验及其他技术保护措施。 + * * + * 【法律责任】 + * 任何未经授权的利用行为,均构成对商业秘密及知识产权的侵害。 + * 权利人将依据商业合同及《中华人民共和国著作权法》《反不正当竞争法》 + * 等法律法规,严厉追究违约与侵权责任。 + */ + +package tech.qiantong.qknow.module.ext.controller.admin.extTaskLog.vo; + +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import tech.qiantong.qknow.common.annotation.Excel; + +import java.io.Serializable; +import java.util.Date; + +/** + * 抽取任务执行日志 Response VO 对象 ext_task_log + * + * @author qknow + * @date 2025-12-03 + */ +@Schema(description = "抽取任务执行日志 Response VO") +@Data +public class ExtTaskLogRespVO implements Serializable { + + private static final long serialVersionUID = 1L; + + @Excel(name = "ID") + @Schema(description = "ID") + private Long id; + + @Excel(name = "工作区id") + @Schema(description = "工作区id", example = "") + private Long workspaceId; + + @Excel(name = "任务id") + @Schema(description = "任务id", example = "") + private Long taskId; + + @Excel(name = "任务类型") + @Schema(description = "任务类型", example = "") + private String taskType; + + @Excel(name = "任务名称") + @Schema(description = "任务名称", example = "") + private String taskName; + + @Excel(name = "状态") + @Schema(description = "状态", example = "") + private String status; + + @Excel(name = "错误消息") + @Schema(description = "错误消息", example = "") + private String errorMsg; + + @Excel(name = "执行开始时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Schema(description = "执行开始时间", example = "") + private Date startTime; + + @Excel(name = "执行结束时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Schema(description = "执行结束时间", example = "") + private Date endTime; + + @Excel(name = "是否有效") + @Schema(description = "是否有效", example = "") + private Boolean validFlag; + + @Excel(name = "删除标志") + @Schema(description = "删除标志", example = "") + private Boolean delFlag; + + @Excel(name = "创建人") + @Schema(description = "创建人", example = "") + private String createBy; + + @Excel(name = "创建人id") + @Schema(description = "创建人id", example = "") + private Long creatorId; + + @Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Schema(description = "创建时间", example = "") + private Date createTime; + + @Excel(name = "更新人") + @Schema(description = "更新人", example = "") + private String updateBy; + + @Excel(name = "更新人id") + @Schema(description = "更新人id", example = "") + private Long updaterId; + + @Excel(name = "更新时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Schema(description = "更新时间", example = "") + private Date updateTime; + + @Excel(name = "备注") + @Schema(description = "备注", example = "") + private String remark; + +} diff --git a/qknow-module-ext/qknow-module-ext-biz/src/main/java/tech/qiantong/qknow/module/ext/controller/admin/extTaskLog/vo/ExtTaskLogSaveReqVO.java b/qknow-module-ext/qknow-module-ext-biz/src/main/java/tech/qiantong/qknow/module/ext/controller/admin/extTaskLog/vo/ExtTaskLogSaveReqVO.java new file mode 100644 index 0000000000000000000000000000000000000000..300c93878b2ee473634a67442ec29788a25a00f5 --- /dev/null +++ b/qknow-module-ext/qknow-module-ext-biz/src/main/java/tech/qiantong/qknow/module/ext/controller/admin/extTaskLog/vo/ExtTaskLogSaveReqVO.java @@ -0,0 +1,133 @@ +/* + * Copyright (c) 2026 Jiangsu Qiantong Technology Co., Ltd. + * * + * Software Name: qKnow Knowledge Platform (Business Edition) + * Software Copyright Registration No. 15980140 + * * + * [RIGHTS AND LICENSE STATEMENT] + * This file contains non-public commercial source code of which Jiangsu Qiantong + * Technology Co., Ltd. lawfully possesses complete intellectual property rights. + * * + * Access and use are limited to entities or individuals who have signed a valid + * commercial license agreement, within the scope stipulated in the agreement. + * The "accessibility" of this source code is premised on lawful authorization + * and does not constitute any form of transfer of intellectual property rights + * or implied licensing. + * * + * [PROHIBITIONS] + * Unless explicitly agreed in the license agreement, the following acts in any + * form are strictly prohibited: + * 1. Copying, disseminating, disclosing, selling, renting, or redistributing + * this source code; + * 2. Providing the software's functionality to third parties via SaaS, PaaS, + * cloud hosting, or other means; + * 3. Using this software or its derivative versions to develop products that + * compete with the Right Holder; + * 4. Providing or displaying this source code or related technical information + * to unauthorized third parties; + * 5. Tampering with, circumventing, or destroying copyright notices, license + * verifications, or other technical protection measures. + * * + * [LEGAL LIABILITY] + * Any unauthorized use constitutes an infringement of trade secrets and + * intellectual property rights. + * * + * The Right Holder will strictly pursue liability for breach of contract and + * infringement in accordance with the commercial agreement and laws such as + * the "Copyright Law of the People's Republic of China" and the "Anti-Unfair + * Competition Law". + * * + * ============================================================================ + * * + * Copyright (c) 2026 江苏千桐科技有限公司 + * * + * 软件名称:qKnow 知识平台(商业版) | 软著登字第15980140号 + * * + * 【权利与授权声明】 + * 本文件属于江苏千桐科技有限公司依法享有完全知识产权的非公开商业源代码。 + * 仅限已签署有效商业授权合同的单位或个人在约定范围内查阅和使用。 + * 源代码的“可访问性”均以合法授权为前提,不构成任何形式的知识产权转让或默示授权。 + * * + * 【禁止事项】 + * 除授权合同明确约定外,严禁任何形式的: + * 1. 复制、传播、披露、出售、出租或再分发本源代码; + * 2. 通过 SaaS、PaaS、云托管等方式向第三方提供本软件功能; + * 3. 将本软件或其衍生版本用于开发与权利人构成竞争的产品; + * 4. 向未授权第三方提供或展示本源代码或相关技术信息; + * 5. 篡改、规避或破坏版权标识、授权校验及其他技术保护措施。 + * * + * 【法律责任】 + * 任何未经授权的利用行为,均构成对商业秘密及知识产权的侵害。 + * 权利人将依据商业合同及《中华人民共和国著作权法》《反不正当竞争法》 + * 等法律法规,严厉追究违约与侵权责任。 + */ + +package tech.qiantong.qknow.module.ext.controller.admin.extTaskLog.vo; + +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.v3.oas.annotations.media.Schema; + +import lombok.Data; +import tech.qiantong.qknow.common.core.domain.BaseEntity; + + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Size; +import java.util.Date; + +/** + * 抽取任务执行日志 创建/修改 Request VO ext_task_log + * + * @author qknow + * @date 2025-12-03 + */ +@Schema(description = "抽取任务执行日志 Response VO") +@Data +public class ExtTaskLogSaveReqVO extends BaseEntity { + + private static final long serialVersionUID = 1L; + + @Schema(description = "ID") + private Long id; + + @Schema(description = "工作区id", example = "") + @NotNull(message = "工作区id不能为空") + private Long workspaceId; + + @Schema(description = "任务id", example = "") + @NotNull(message = "任务id不能为空") + private Long taskId; + + @Schema(description = "任务类型", example = "") + @NotBlank(message = "任务类型不能为空") + private String taskType; + + @Schema(description = "任务名称", example = "") + @NotBlank(message = "任务名称不能为空") + private String taskName; + + @Schema(description = "状态", example = "") + @NotBlank(message = "状态不能为空") + private String status; + + @Schema(description = "错误消息", example = "") + @NotBlank(message = "错误消息不能为空") + @Size(max = 2000, message = "错误消息长度不能超过2000个字符") + private String errorMsg; + + @Schema(description = "执行开始时间", example = "") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date startTime; + + @Schema(description = "执行结束时间", example = "") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date endTime; + + @Schema(description = "备注", example = "") + @NotBlank(message = "备注不能为空") + @Size(max = 512, message = "备注长度不能超过512个字符") + private String remark; + + +} diff --git a/qknow-module-ext/qknow-module-ext-biz/src/main/java/tech/qiantong/qknow/module/ext/convert/extTaskLog/ExtTaskLogConvert.java b/qknow-module-ext/qknow-module-ext-biz/src/main/java/tech/qiantong/qknow/module/ext/convert/extTaskLog/ExtTaskLogConvert.java new file mode 100644 index 0000000000000000000000000000000000000000..97eeb809019226cda73b09d5ebcc9882156a4fad --- /dev/null +++ b/qknow-module-ext/qknow-module-ext-biz/src/main/java/tech/qiantong/qknow/module/ext/convert/extTaskLog/ExtTaskLogConvert.java @@ -0,0 +1,113 @@ +/* + * Copyright (c) 2026 Jiangsu Qiantong Technology Co., Ltd. + * * + * Software Name: qKnow Knowledge Platform (Business Edition) + * Software Copyright Registration No. 15980140 + * * + * [RIGHTS AND LICENSE STATEMENT] + * This file contains non-public commercial source code of which Jiangsu Qiantong + * Technology Co., Ltd. lawfully possesses complete intellectual property rights. + * * + * Access and use are limited to entities or individuals who have signed a valid + * commercial license agreement, within the scope stipulated in the agreement. + * The "accessibility" of this source code is premised on lawful authorization + * and does not constitute any form of transfer of intellectual property rights + * or implied licensing. + * * + * [PROHIBITIONS] + * Unless explicitly agreed in the license agreement, the following acts in any + * form are strictly prohibited: + * 1. Copying, disseminating, disclosing, selling, renting, or redistributing + * this source code; + * 2. Providing the software's functionality to third parties via SaaS, PaaS, + * cloud hosting, or other means; + * 3. Using this software or its derivative versions to develop products that + * compete with the Right Holder; + * 4. Providing or displaying this source code or related technical information + * to unauthorized third parties; + * 5. Tampering with, circumventing, or destroying copyright notices, license + * verifications, or other technical protection measures. + * * + * [LEGAL LIABILITY] + * Any unauthorized use constitutes an infringement of trade secrets and + * intellectual property rights. + * * + * The Right Holder will strictly pursue liability for breach of contract and + * infringement in accordance with the commercial agreement and laws such as + * the "Copyright Law of the People's Republic of China" and the "Anti-Unfair + * Competition Law". + * * + * ============================================================================ + * * + * Copyright (c) 2026 江苏千桐科技有限公司 + * * + * 软件名称:qKnow 知识平台(商业版) | 软著登字第15980140号 + * * + * 【权利与授权声明】 + * 本文件属于江苏千桐科技有限公司依法享有完全知识产权的非公开商业源代码。 + * 仅限已签署有效商业授权合同的单位或个人在约定范围内查阅和使用。 + * 源代码的“可访问性”均以合法授权为前提,不构成任何形式的知识产权转让或默示授权。 + * * + * 【禁止事项】 + * 除授权合同明确约定外,严禁任何形式的: + * 1. 复制、传播、披露、出售、出租或再分发本源代码; + * 2. 通过 SaaS、PaaS、云托管等方式向第三方提供本软件功能; + * 3. 将本软件或其衍生版本用于开发与权利人构成竞争的产品; + * 4. 向未授权第三方提供或展示本源代码或相关技术信息; + * 5. 篡改、规避或破坏版权标识、授权校验及其他技术保护措施。 + * * + * 【法律责任】 + * 任何未经授权的利用行为,均构成对商业秘密及知识产权的侵害。 + * 权利人将依据商业合同及《中华人民共和国著作权法》《反不正当竞争法》 + * 等法律法规,严厉追究违约与侵权责任。 + */ + +package tech.qiantong.qknow.module.ext.convert.extTaskLog; + +import org.mapstruct.Mapper; +import org.mapstruct.factory.Mappers; +import tech.qiantong.qknow.module.ext.controller.admin.extTaskLog.vo.ExtTaskLogPageReqVO; +import tech.qiantong.qknow.module.ext.controller.admin.extTaskLog.vo.ExtTaskLogRespVO; +import tech.qiantong.qknow.module.ext.controller.admin.extTaskLog.vo.ExtTaskLogSaveReqVO; +import tech.qiantong.qknow.module.ext.dal.dataobject.extTaskLog.ExtTaskLogDO; + +import java.util.List; + +/** + * 抽取任务执行日志 Convert + * + * @author qknow + * @date 2025-12-03 + */ +@Mapper +public interface ExtTaskLogConvert { + ExtTaskLogConvert INSTANCE = Mappers.getMapper(ExtTaskLogConvert.class); + + /** + * PageReqVO 转换为 DO + * @param extTaskLogPageReqVO 请求参数 + * @return ExtTaskLogDO + */ + ExtTaskLogDO convertToDO(ExtTaskLogPageReqVO extTaskLogPageReqVO); + + /** + * SaveReqVO 转换为 DO + * @param extTaskLogSaveReqVO 保存请求参数 + * @return ExtTaskLogDO + */ + ExtTaskLogDO convertToDO(ExtTaskLogSaveReqVO extTaskLogSaveReqVO); + + /** + * DO 转换为 RespVO + * @param extTaskLogDO 实体对象 + * @return ExtTaskLogRespVO + */ + ExtTaskLogRespVO convertToRespVO(ExtTaskLogDO extTaskLogDO); + + /** + * DOList 转换为 RespVOList + * @param extTaskLogDOList 实体对象列表 + * @return List + */ + List convertToRespVOList(List extTaskLogDOList); +} diff --git a/qknow-module-ext/qknow-module-ext-biz/src/main/java/tech/qiantong/qknow/module/ext/dal/dataobject/extTaskLog/ExtTaskLogDO.java b/qknow-module-ext/qknow-module-ext-biz/src/main/java/tech/qiantong/qknow/module/ext/dal/dataobject/extTaskLog/ExtTaskLogDO.java new file mode 100644 index 0000000000000000000000000000000000000000..c77ed72dfa324b5e09686062891dc4fd719f80ad --- /dev/null +++ b/qknow-module-ext/qknow-module-ext-biz/src/main/java/tech/qiantong/qknow/module/ext/dal/dataobject/extTaskLog/ExtTaskLogDO.java @@ -0,0 +1,125 @@ +/* + * Copyright (c) 2026 Jiangsu Qiantong Technology Co., Ltd. + * * + * Software Name: qKnow Knowledge Platform (Business Edition) + * Software Copyright Registration No. 15980140 + * * + * [RIGHTS AND LICENSE STATEMENT] + * This file contains non-public commercial source code of which Jiangsu Qiantong + * Technology Co., Ltd. lawfully possesses complete intellectual property rights. + * * + * Access and use are limited to entities or individuals who have signed a valid + * commercial license agreement, within the scope stipulated in the agreement. + * The "accessibility" of this source code is premised on lawful authorization + * and does not constitute any form of transfer of intellectual property rights + * or implied licensing. + * * + * [PROHIBITIONS] + * Unless explicitly agreed in the license agreement, the following acts in any + * form are strictly prohibited: + * 1. Copying, disseminating, disclosing, selling, renting, or redistributing + * this source code; + * 2. Providing the software's functionality to third parties via SaaS, PaaS, + * cloud hosting, or other means; + * 3. Using this software or its derivative versions to develop products that + * compete with the Right Holder; + * 4. Providing or displaying this source code or related technical information + * to unauthorized third parties; + * 5. Tampering with, circumventing, or destroying copyright notices, license + * verifications, or other technical protection measures. + * * + * [LEGAL LIABILITY] + * Any unauthorized use constitutes an infringement of trade secrets and + * intellectual property rights. + * * + * The Right Holder will strictly pursue liability for breach of contract and + * infringement in accordance with the commercial agreement and laws such as + * the "Copyright Law of the People's Republic of China" and the "Anti-Unfair + * Competition Law". + * * + * ============================================================================ + * * + * Copyright (c) 2026 江苏千桐科技有限公司 + * * + * 软件名称:qKnow 知识平台(商业版) | 软著登字第15980140号 + * * + * 【权利与授权声明】 + * 本文件属于江苏千桐科技有限公司依法享有完全知识产权的非公开商业源代码。 + * 仅限已签署有效商业授权合同的单位或个人在约定范围内查阅和使用。 + * 源代码的“可访问性”均以合法授权为前提,不构成任何形式的知识产权转让或默示授权。 + * * + * 【禁止事项】 + * 除授权合同明确约定外,严禁任何形式的: + * 1. 复制、传播、披露、出售、出租或再分发本源代码; + * 2. 通过 SaaS、PaaS、云托管等方式向第三方提供本软件功能; + * 3. 将本软件或其衍生版本用于开发与权利人构成竞争的产品; + * 4. 向未授权第三方提供或展示本源代码或相关技术信息; + * 5. 篡改、规避或破坏版权标识、授权校验及其他技术保护措施。 + * * + * 【法律责任】 + * 任何未经授权的利用行为,均构成对商业秘密及知识产权的侵害。 + * 权利人将依据商业合同及《中华人民共和国著作权法》《反不正当竞争法》 + * 等法律法规,严厉追究违约与侵权责任。 + */ + +package tech.qiantong.qknow.module.ext.dal.dataobject.extTaskLog; + +import com.baomidou.mybatisplus.annotation.*; +import lombok.*; +import tech.qiantong.qknow.common.core.domain.BaseEntity; + +import java.util.Date; + +/** + * 抽取任务执行日志 DO 对象 ext_task_log + * + * @author qknow + * @date 2025-12-03 + */ +@Data +@TableName(value = "ext_task_log") +@Builder +@NoArgsConstructor +@AllArgsConstructor +@EqualsAndHashCode(callSuper = true) +public class ExtTaskLogDO extends BaseEntity { + @TableField(exist = false) + private static final long serialVersionUID = 1L; + + /** ID */ + @TableId(type = IdType.AUTO) + private Long id; + + /** 工作区id */ + private Long workspaceId; + + /** 任务id */ + private Long taskId; + + /** 任务类型 */ + private Integer taskType; + + /** 任务名称 */ + private String taskName; + + /** 状态 */ + private Integer status; + + /** 错误消息 */ + private String errorMsg; + + /** 执行开始时间 */ + private Date startTime; + + /** 执行结束时间 */ + private Date endTime; + + /** 是否有效 */ + private Boolean validFlag; + + /** 删除标志 */ + @TableLogic + private Boolean delFlag; + + +} diff --git a/qknow-module-ext/qknow-module-ext-biz/src/main/java/tech/qiantong/qknow/module/ext/dal/dataobject/extTaskLog/ExtTaskLogDetailDO.java b/qknow-module-ext/qknow-module-ext-biz/src/main/java/tech/qiantong/qknow/module/ext/dal/dataobject/extTaskLog/ExtTaskLogDetailDO.java new file mode 100644 index 0000000000000000000000000000000000000000..8b0e5eac3193b7002c008e006d6a2c0704bec064 --- /dev/null +++ b/qknow-module-ext/qknow-module-ext-biz/src/main/java/tech/qiantong/qknow/module/ext/dal/dataobject/extTaskLog/ExtTaskLogDetailDO.java @@ -0,0 +1,108 @@ +/* + * Copyright (c) 2026 Jiangsu Qiantong Technology Co., Ltd. + * * + * Software Name: qKnow Knowledge Platform (Business Edition) + * Software Copyright Registration No. 15980140 + * * + * [RIGHTS AND LICENSE STATEMENT] + * This file contains non-public commercial source code of which Jiangsu Qiantong + * Technology Co., Ltd. lawfully possesses complete intellectual property rights. + * * + * Access and use are limited to entities or individuals who have signed a valid + * commercial license agreement, within the scope stipulated in the agreement. + * The "accessibility" of this source code is premised on lawful authorization + * and does not constitute any form of transfer of intellectual property rights + * or implied licensing. + * * + * [PROHIBITIONS] + * Unless explicitly agreed in the license agreement, the following acts in any + * form are strictly prohibited: + * 1. Copying, disseminating, disclosing, selling, renting, or redistributing + * this source code; + * 2. Providing the software's functionality to third parties via SaaS, PaaS, + * cloud hosting, or other means; + * 3. Using this software or its derivative versions to develop products that + * compete with the Right Holder; + * 4. Providing or displaying this source code or related technical information + * to unauthorized third parties; + * 5. Tampering with, circumventing, or destroying copyright notices, license + * verifications, or other technical protection measures. + * * + * [LEGAL LIABILITY] + * Any unauthorized use constitutes an infringement of trade secrets and + * intellectual property rights. + * * + * The Right Holder will strictly pursue liability for breach of contract and + * infringement in accordance with the commercial agreement and laws such as + * the "Copyright Law of the People's Republic of China" and the "Anti-Unfair + * Competition Law". + * * + * ============================================================================ + * * + * Copyright (c) 2026 江苏千桐科技有限公司 + * * + * 软件名称:qKnow 知识平台(商业版) | 软著登字第15980140号 + * * + * 【权利与授权声明】 + * 本文件属于江苏千桐科技有限公司依法享有完全知识产权的非公开商业源代码。 + * 仅限已签署有效商业授权合同的单位或个人在约定范围内查阅和使用。 + * 源代码的“可访问性”均以合法授权为前提,不构成任何形式的知识产权转让或默示授权。 + * * + * 【禁止事项】 + * 除授权合同明确约定外,严禁任何形式的: + * 1. 复制、传播、披露、出售、出租或再分发本源代码; + * 2. 通过 SaaS、PaaS、云托管等方式向第三方提供本软件功能; + * 3. 将本软件或其衍生版本用于开发与权利人构成竞争的产品; + * 4. 向未授权第三方提供或展示本源代码或相关技术信息; + * 5. 篡改、规避或破坏版权标识、授权校验及其他技术保护措施。 + * * + * 【法律责任】 + * 任何未经授权的利用行为,均构成对商业秘密及知识产权的侵害。 + * 权利人将依据商业合同及《中华人民共和国著作权法》《反不正当竞争法》 + * 等法律法规,严厉追究违约与侵权责任。 + */ + +package tech.qiantong.qknow.module.ext.dal.dataobject.extTaskLog; + +import com.baomidou.mybatisplus.annotation.*; +import lombok.*; +import tech.qiantong.qknow.common.core.domain.BaseEntity; + +/** + * 抽取任务执行日志详情 DO 对象 ext_task_log_detail + * + * @author qknow + * @date 2025-12-03 + */ +@Data +@TableName(value = "ext_task_log_detail") +@Builder +@NoArgsConstructor +@AllArgsConstructor +@EqualsAndHashCode(callSuper = true) +public class ExtTaskLogDetailDO extends BaseEntity { + @TableField(exist = false) + private static final long serialVersionUID = 1L; + + /** ID */ + @TableId(type = IdType.AUTO) + private Long id; + + /** 工作区id */ + private Long workspaceId; + + /** 执行日志id */ + private Long logId; + + /** 任务执行步骤 */ + private String step; + + /** 是否有效 */ + private Boolean validFlag; + + /** 删除标志 */ + @TableLogic + private Boolean delFlag; + + +} diff --git a/qknow-module-ext/qknow-module-ext-biz/src/main/java/tech/qiantong/qknow/module/ext/dal/mapper/extTaskLog/ExtTaskLogDetailMapper.java b/qknow-module-ext/qknow-module-ext-biz/src/main/java/tech/qiantong/qknow/module/ext/dal/mapper/extTaskLog/ExtTaskLogDetailMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..f853bfd419fb53f79db98ea480d56f45832c117e --- /dev/null +++ b/qknow-module-ext/qknow-module-ext-biz/src/main/java/tech/qiantong/qknow/module/ext/dal/mapper/extTaskLog/ExtTaskLogDetailMapper.java @@ -0,0 +1,99 @@ +/* + * Copyright (c) 2026 Jiangsu Qiantong Technology Co., Ltd. + * * + * Software Name: qKnow Knowledge Platform (Business Edition) + * Software Copyright Registration No. 15980140 + * * + * [RIGHTS AND LICENSE STATEMENT] + * This file contains non-public commercial source code of which Jiangsu Qiantong + * Technology Co., Ltd. lawfully possesses complete intellectual property rights. + * * + * Access and use are limited to entities or individuals who have signed a valid + * commercial license agreement, within the scope stipulated in the agreement. + * The "accessibility" of this source code is premised on lawful authorization + * and does not constitute any form of transfer of intellectual property rights + * or implied licensing. + * * + * [PROHIBITIONS] + * Unless explicitly agreed in the license agreement, the following acts in any + * form are strictly prohibited: + * 1. Copying, disseminating, disclosing, selling, renting, or redistributing + * this source code; + * 2. Providing the software's functionality to third parties via SaaS, PaaS, + * cloud hosting, or other means; + * 3. Using this software or its derivative versions to develop products that + * compete with the Right Holder; + * 4. Providing or displaying this source code or related technical information + * to unauthorized third parties; + * 5. Tampering with, circumventing, or destroying copyright notices, license + * verifications, or other technical protection measures. + * * + * [LEGAL LIABILITY] + * Any unauthorized use constitutes an infringement of trade secrets and + * intellectual property rights. + * * + * The Right Holder will strictly pursue liability for breach of contract and + * infringement in accordance with the commercial agreement and laws such as + * the "Copyright Law of the People's Republic of China" and the "Anti-Unfair + * Competition Law". + * * + * ============================================================================ + * * + * Copyright (c) 2026 江苏千桐科技有限公司 + * * + * 软件名称:qKnow 知识平台(商业版) | 软著登字第15980140号 + * * + * 【权利与授权声明】 + * 本文件属于江苏千桐科技有限公司依法享有完全知识产权的非公开商业源代码。 + * 仅限已签署有效商业授权合同的单位或个人在约定范围内查阅和使用。 + * 源代码的“可访问性”均以合法授权为前提,不构成任何形式的知识产权转让或默示授权。 + * * + * 【禁止事项】 + * 除授权合同明确约定外,严禁任何形式的: + * 1. 复制、传播、披露、出售、出租或再分发本源代码; + * 2. 通过 SaaS、PaaS、云托管等方式向第三方提供本软件功能; + * 3. 将本软件或其衍生版本用于开发与权利人构成竞争的产品; + * 4. 向未授权第三方提供或展示本源代码或相关技术信息; + * 5. 篡改、规避或破坏版权标识、授权校验及其他技术保护措施。 + * * + * 【法律责任】 + * 任何未经授权的利用行为,均构成对商业秘密及知识产权的侵害。 + * 权利人将依据商业合同及《中华人民共和国著作权法》《反不正当竞争法》 + * 等法律法规,严厉追究违约与侵权责任。 + */ + +package tech.qiantong.qknow.module.ext.dal.mapper.extTaskLog; +import tech.qiantong.qknow.common.core.page.PageResult; +import tech.qiantong.qknow.module.ext.controller.admin.extTaskLog.vo.ExtTaskLogDetailPageReqVO; +import tech.qiantong.qknow.module.ext.dal.dataobject.extTaskLog.ExtTaskLogDetailDO; +import tech.qiantong.qknow.mybatis.core.mapper.BaseMapperX; +import tech.qiantong.qknow.mybatis.core.query.LambdaQueryWrapperX; + +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** + * 抽取任务执行日志详情Mapper接口 + * + * @author qknow + * @date 2025-12-03 + */ +public interface ExtTaskLogDetailMapper extends BaseMapperX { + + default PageResult selectPage(ExtTaskLogDetailPageReqVO reqVO) { + // 定义排序的字段(防止 SQL 注入,与数据库字段名称一致) + Set allowedColumns = new HashSet<>(Arrays.asList("id", "create_time", "update_time")); + + // 构造动态查询条件 + return selectPage(reqVO, new LambdaQueryWrapperX() + .eqIfPresent(ExtTaskLogDetailDO::getWorkspaceId, reqVO.getWorkspaceId()) + .eqIfPresent(ExtTaskLogDetailDO::getLogId, reqVO.getLogId()) + .eqIfPresent(ExtTaskLogDetailDO::getStep, reqVO.getStep()) + .eqIfPresent(ExtTaskLogDetailDO::getCreateTime, reqVO.getCreateTime()) + // 如果 reqVO.getName() 不为空,则添加 name 的精确匹配条件(name = '') + // .likeIfPresent(ExtTaskLogDetailDO::getName, reqVO.getName()) + // 按照 createTime 字段降序排序 + .orderBy(reqVO.getOrderByColumn(), reqVO.getIsAsc(), allowedColumns)); + } +} diff --git a/qknow-module-ext/qknow-module-ext-biz/src/main/java/tech/qiantong/qknow/module/ext/dal/mapper/extTaskLog/ExtTaskLogMapper.java b/qknow-module-ext/qknow-module-ext-biz/src/main/java/tech/qiantong/qknow/module/ext/dal/mapper/extTaskLog/ExtTaskLogMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..c1724af986e5543a5181059ad4c1aafd7a8800c7 --- /dev/null +++ b/qknow-module-ext/qknow-module-ext-biz/src/main/java/tech/qiantong/qknow/module/ext/dal/mapper/extTaskLog/ExtTaskLogMapper.java @@ -0,0 +1,105 @@ +/* + * Copyright (c) 2026 Jiangsu Qiantong Technology Co., Ltd. + * * + * Software Name: qKnow Knowledge Platform (Business Edition) + * Software Copyright Registration No. 15980140 + * * + * [RIGHTS AND LICENSE STATEMENT] + * This file contains non-public commercial source code of which Jiangsu Qiantong + * Technology Co., Ltd. lawfully possesses complete intellectual property rights. + * * + * Access and use are limited to entities or individuals who have signed a valid + * commercial license agreement, within the scope stipulated in the agreement. + * The "accessibility" of this source code is premised on lawful authorization + * and does not constitute any form of transfer of intellectual property rights + * or implied licensing. + * * + * [PROHIBITIONS] + * Unless explicitly agreed in the license agreement, the following acts in any + * form are strictly prohibited: + * 1. Copying, disseminating, disclosing, selling, renting, or redistributing + * this source code; + * 2. Providing the software's functionality to third parties via SaaS, PaaS, + * cloud hosting, or other means; + * 3. Using this software or its derivative versions to develop products that + * compete with the Right Holder; + * 4. Providing or displaying this source code or related technical information + * to unauthorized third parties; + * 5. Tampering with, circumventing, or destroying copyright notices, license + * verifications, or other technical protection measures. + * * + * [LEGAL LIABILITY] + * Any unauthorized use constitutes an infringement of trade secrets and + * intellectual property rights. + * * + * The Right Holder will strictly pursue liability for breach of contract and + * infringement in accordance with the commercial agreement and laws such as + * the "Copyright Law of the People's Republic of China" and the "Anti-Unfair + * Competition Law". + * * + * ============================================================================ + * * + * Copyright (c) 2026 江苏千桐科技有限公司 + * * + * 软件名称:qKnow 知识平台(商业版) | 软著登字第15980140号 + * * + * 【权利与授权声明】 + * 本文件属于江苏千桐科技有限公司依法享有完全知识产权的非公开商业源代码。 + * 仅限已签署有效商业授权合同的单位或个人在约定范围内查阅和使用。 + * 源代码的“可访问性”均以合法授权为前提,不构成任何形式的知识产权转让或默示授权。 + * * + * 【禁止事项】 + * 除授权合同明确约定外,严禁任何形式的: + * 1. 复制、传播、披露、出售、出租或再分发本源代码; + * 2. 通过 SaaS、PaaS、云托管等方式向第三方提供本软件功能; + * 3. 将本软件或其衍生版本用于开发与权利人构成竞争的产品; + * 4. 向未授权第三方提供或展示本源代码或相关技术信息; + * 5. 篡改、规避或破坏版权标识、授权校验及其他技术保护措施。 + * * + * 【法律责任】 + * 任何未经授权的利用行为,均构成对商业秘密及知识产权的侵害。 + * 权利人将依据商业合同及《中华人民共和国著作权法》《反不正当竞争法》 + * 等法律法规,严厉追究违约与侵权责任。 + */ + +package tech.qiantong.qknow.module.ext.dal.mapper.extTaskLog; + +import tech.qiantong.qknow.common.core.page.PageResult; +import tech.qiantong.qknow.module.ext.controller.admin.extTaskLog.vo.ExtTaskLogPageReqVO; +import tech.qiantong.qknow.module.ext.dal.dataobject.extTaskLog.ExtTaskLogDO; +import tech.qiantong.qknow.mybatis.core.mapper.BaseMapperX; +import tech.qiantong.qknow.mybatis.core.query.LambdaQueryWrapperX; + +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** + * 抽取任务执行日志Mapper接口 + * + * @author qknow + * @date 2025-12-03 + */ +public interface ExtTaskLogMapper extends BaseMapperX { + + default PageResult selectPage(ExtTaskLogPageReqVO reqVO) { + // 定义排序的字段(防止 SQL 注入,与数据库字段名称一致) + Set allowedColumns = new HashSet<>(Arrays.asList("id", "start_time", "end_time")); + + // 构造动态查询条件 + return selectPage(reqVO, new LambdaQueryWrapperX() + .eqIfPresent(ExtTaskLogDO::getWorkspaceId, reqVO.getWorkspaceId()) + .eqIfPresent(ExtTaskLogDO::getTaskId, reqVO.getTaskId()) + .eqIfPresent(ExtTaskLogDO::getTaskType, reqVO.getTaskType()) + .likeIfPresent(ExtTaskLogDO::getTaskName, reqVO.getTaskName()) + .eqIfPresent(ExtTaskLogDO::getStatus, reqVO.getStatus()) + .eqIfPresent(ExtTaskLogDO::getErrorMsg, reqVO.getErrorMsg()) + .eqIfPresent(ExtTaskLogDO::getStartTime, reqVO.getStartTime()) + .eqIfPresent(ExtTaskLogDO::getEndTime, reqVO.getEndTime()) + .eqIfPresent(ExtTaskLogDO::getCreateTime, reqVO.getCreateTime()) + // 如果 reqVO.getName() 不为空,则添加 name 的精确匹配条件(name = '') + // .likeIfPresent(ExtTaskLogDO::getName, reqVO.getName()) + // 按照 createTime 字段降序排序 + .orderBy(reqVO.getOrderByColumn(), reqVO.getIsAsc(), allowedColumns)); + } +} diff --git a/qknow-module-ext/qknow-module-ext-biz/src/main/java/tech/qiantong/qknow/module/ext/extEnum/ExtLogStatusEnum.java b/qknow-module-ext/qknow-module-ext-biz/src/main/java/tech/qiantong/qknow/module/ext/extEnum/ExtLogStatusEnum.java new file mode 100644 index 0000000000000000000000000000000000000000..5e08135beb8c85274c0b21f4bb7c13ed96bc9bae --- /dev/null +++ b/qknow-module-ext/qknow-module-ext-biz/src/main/java/tech/qiantong/qknow/module/ext/extEnum/ExtLogStatusEnum.java @@ -0,0 +1,91 @@ +/* + * Copyright (c) 2026 Jiangsu Qiantong Technology Co., Ltd. + * * + * Software Name: qKnow Knowledge Platform (Business Edition) + * Software Copyright Registration No. 15980140 + * * + * [RIGHTS AND LICENSE STATEMENT] + * This file contains non-public commercial source code of which Jiangsu Qiantong + * Technology Co., Ltd. lawfully possesses complete intellectual property rights. + * * + * Access and use are limited to entities or individuals who have signed a valid + * commercial license agreement, within the scope stipulated in the agreement. + * The "accessibility" of this source code is premised on lawful authorization + * and does not constitute any form of transfer of intellectual property rights + * or implied licensing. + * * + * [PROHIBITIONS] + * Unless explicitly agreed in the license agreement, the following acts in any + * form are strictly prohibited: + * 1. Copying, disseminating, disclosing, selling, renting, or redistributing + * this source code; + * 2. Providing the software's functionality to third parties via SaaS, PaaS, + * cloud hosting, or other means; + * 3. Using this software or its derivative versions to develop products that + * compete with the Right Holder; + * 4. Providing or displaying this source code or related technical information + * to unauthorized third parties; + * 5. Tampering with, circumventing, or destroying copyright notices, license + * verifications, or other technical protection measures. + * * + * [LEGAL LIABILITY] + * Any unauthorized use constitutes an infringement of trade secrets and + * intellectual property rights. + * * + * The Right Holder will strictly pursue liability for breach of contract and + * infringement in accordance with the commercial agreement and laws such as + * the "Copyright Law of the People's Republic of China" and the "Anti-Unfair + * Competition Law". + * * + * ============================================================================ + * * + * Copyright (c) 2026 江苏千桐科技有限公司 + * * + * 软件名称:qKnow 知识平台(商业版) | 软著登字第15980140号 + * * + * 【权利与授权声明】 + * 本文件属于江苏千桐科技有限公司依法享有完全知识产权的非公开商业源代码。 + * 仅限已签署有效商业授权合同的单位或个人在约定范围内查阅和使用。 + * 源代码的“可访问性”均以合法授权为前提,不构成任何形式的知识产权转让或默示授权。 + * * + * 【禁止事项】 + * 除授权合同明确约定外,严禁任何形式的: + * 1. 复制、传播、披露、出售、出租或再分发本源代码; + * 2. 通过 SaaS、PaaS、云托管等方式向第三方提供本软件功能; + * 3. 将本软件或其衍生版本用于开发与权利人构成竞争的产品; + * 4. 向未授权第三方提供或展示本源代码或相关技术信息; + * 5. 篡改、规避或破坏版权标识、授权校验及其他技术保护措施。 + * * + * 【法律责任】 + * 任何未经授权的利用行为,均构成对商业秘密及知识产权的侵害。 + * 权利人将依据商业合同及《中华人民共和国著作权法》《反不正当竞争法》 + * 等法律法规,严厉追究违约与侵权责任。 + */ + +package tech.qiantong.qknow.module.ext.extEnum; + +/** + * 抽取任务日志,结果状态 + * + * @author Administrator + */ +public enum ExtLogStatusEnum { + /** + * 失败 + */ + FAIL(0), + /** + * 成功 + */ + SUCCESS(1); + + private final Integer code; + + ExtLogStatusEnum(Integer code) { + this.code = code; + } + + public Integer getValue() { + return this.code; + } +} diff --git a/qknow-module-ext/qknow-module-ext-biz/src/main/java/tech/qiantong/qknow/module/ext/extEnum/ExtTaskStatus.java b/qknow-module-ext/qknow-module-ext-biz/src/main/java/tech/qiantong/qknow/module/ext/extEnum/ExtTaskStatus.java index eaf335ede104e99b46431a73e8342c940c3770fc..cf08c078625dde21469af797a62b852c93a5bf43 100644 --- a/qknow-module-ext/qknow-module-ext-biz/src/main/java/tech/qiantong/qknow/module/ext/extEnum/ExtTaskStatus.java +++ b/qknow-module-ext/qknow-module-ext-biz/src/main/java/tech/qiantong/qknow/module/ext/extEnum/ExtTaskStatus.java @@ -37,7 +37,8 @@ public enum ExtTaskStatus { INPROGRESS(1),//执行中 EXECUTED(2),//已执行 ERROR(3),//执行错误 - CHONG(4);// 文档状态未更新,需要重新执行 + QUEUE(4),// 队列中 + CHONG(5); // 文档状态未更新,需要重新执行; private final Integer status; diff --git a/qknow-module-ext/qknow-module-ext-biz/src/main/java/tech/qiantong/qknow/module/ext/extEnum/ExtTaskTypeEnum.java b/qknow-module-ext/qknow-module-ext-biz/src/main/java/tech/qiantong/qknow/module/ext/extEnum/ExtTaskTypeEnum.java new file mode 100644 index 0000000000000000000000000000000000000000..19c6e713dcbf2602f768aabe55f47dd7c6004a77 --- /dev/null +++ b/qknow-module-ext/qknow-module-ext-biz/src/main/java/tech/qiantong/qknow/module/ext/extEnum/ExtTaskTypeEnum.java @@ -0,0 +1,91 @@ +/* + * Copyright (c) 2026 Jiangsu Qiantong Technology Co., Ltd. + * * + * Software Name: qKnow Knowledge Platform (Business Edition) + * Software Copyright Registration No. 15980140 + * * + * [RIGHTS AND LICENSE STATEMENT] + * This file contains non-public commercial source code of which Jiangsu Qiantong + * Technology Co., Ltd. lawfully possesses complete intellectual property rights. + * * + * Access and use are limited to entities or individuals who have signed a valid + * commercial license agreement, within the scope stipulated in the agreement. + * The "accessibility" of this source code is premised on lawful authorization + * and does not constitute any form of transfer of intellectual property rights + * or implied licensing. + * * + * [PROHIBITIONS] + * Unless explicitly agreed in the license agreement, the following acts in any + * form are strictly prohibited: + * 1. Copying, disseminating, disclosing, selling, renting, or redistributing + * this source code; + * 2. Providing the software's functionality to third parties via SaaS, PaaS, + * cloud hosting, or other means; + * 3. Using this software or its derivative versions to develop products that + * compete with the Right Holder; + * 4. Providing or displaying this source code or related technical information + * to unauthorized third parties; + * 5. Tampering with, circumventing, or destroying copyright notices, license + * verifications, or other technical protection measures. + * * + * [LEGAL LIABILITY] + * Any unauthorized use constitutes an infringement of trade secrets and + * intellectual property rights. + * * + * The Right Holder will strictly pursue liability for breach of contract and + * infringement in accordance with the commercial agreement and laws such as + * the "Copyright Law of the People's Republic of China" and the "Anti-Unfair + * Competition Law". + * * + * ============================================================================ + * * + * Copyright (c) 2026 江苏千桐科技有限公司 + * * + * 软件名称:qKnow 知识平台(商业版) | 软著登字第15980140号 + * * + * 【权利与授权声明】 + * 本文件属于江苏千桐科技有限公司依法享有完全知识产权的非公开商业源代码。 + * 仅限已签署有效商业授权合同的单位或个人在约定范围内查阅和使用。 + * 源代码的“可访问性”均以合法授权为前提,不构成任何形式的知识产权转让或默示授权。 + * * + * 【禁止事项】 + * 除授权合同明确约定外,严禁任何形式的: + * 1. 复制、传播、披露、出售、出租或再分发本源代码; + * 2. 通过 SaaS、PaaS、云托管等方式向第三方提供本软件功能; + * 3. 将本软件或其衍生版本用于开发与权利人构成竞争的产品; + * 4. 向未授权第三方提供或展示本源代码或相关技术信息; + * 5. 篡改、规避或破坏版权标识、授权校验及其他技术保护措施。 + * * + * 【法律责任】 + * 任何未经授权的利用行为,均构成对商业秘密及知识产权的侵害。 + * 权利人将依据商业合同及《中华人民共和国著作权法》《反不正当竞争法》 + * 等法律法规,严厉追究违约与侵权责任。 + */ + +package tech.qiantong.qknow.module.ext.extEnum; + +/** + * 抽取任务,任务类型 + * + * @author Administrator + */ +public enum ExtTaskTypeEnum { + /** + * 结构化抽取 + */ + STRUCT(0), + /** + * 非结构化抽取 + */ + UN_STRUCT(1); + + private final Integer code; + + ExtTaskTypeEnum(Integer code) { + this.code = code; + } + + public Integer getValue() { + return this.code; + } +} diff --git a/qknow-module-ext/qknow-module-ext-biz/src/main/java/tech/qiantong/qknow/module/ext/service/extTaskLog/IExtTaskLogDetailService.java b/qknow-module-ext/qknow-module-ext-biz/src/main/java/tech/qiantong/qknow/module/ext/service/extTaskLog/IExtTaskLogDetailService.java new file mode 100644 index 0000000000000000000000000000000000000000..e6687a2e66a356d34af58a46773848f863c596e9 --- /dev/null +++ b/qknow-module-ext/qknow-module-ext-biz/src/main/java/tech/qiantong/qknow/module/ext/service/extTaskLog/IExtTaskLogDetailService.java @@ -0,0 +1,148 @@ +/* + * Copyright (c) 2026 Jiangsu Qiantong Technology Co., Ltd. + * * + * Software Name: qKnow Knowledge Platform (Business Edition) + * Software Copyright Registration No. 15980140 + * * + * [RIGHTS AND LICENSE STATEMENT] + * This file contains non-public commercial source code of which Jiangsu Qiantong + * Technology Co., Ltd. lawfully possesses complete intellectual property rights. + * * + * Access and use are limited to entities or individuals who have signed a valid + * commercial license agreement, within the scope stipulated in the agreement. + * The "accessibility" of this source code is premised on lawful authorization + * and does not constitute any form of transfer of intellectual property rights + * or implied licensing. + * * + * [PROHIBITIONS] + * Unless explicitly agreed in the license agreement, the following acts in any + * form are strictly prohibited: + * 1. Copying, disseminating, disclosing, selling, renting, or redistributing + * this source code; + * 2. Providing the software's functionality to third parties via SaaS, PaaS, + * cloud hosting, or other means; + * 3. Using this software or its derivative versions to develop products that + * compete with the Right Holder; + * 4. Providing or displaying this source code or related technical information + * to unauthorized third parties; + * 5. Tampering with, circumventing, or destroying copyright notices, license + * verifications, or other technical protection measures. + * * + * [LEGAL LIABILITY] + * Any unauthorized use constitutes an infringement of trade secrets and + * intellectual property rights. + * * + * The Right Holder will strictly pursue liability for breach of contract and + * infringement in accordance with the commercial agreement and laws such as + * the "Copyright Law of the People's Republic of China" and the "Anti-Unfair + * Competition Law". + * * + * ============================================================================ + * * + * Copyright (c) 2026 江苏千桐科技有限公司 + * * + * 软件名称:qKnow 知识平台(商业版) | 软著登字第15980140号 + * * + * 【权利与授权声明】 + * 本文件属于江苏千桐科技有限公司依法享有完全知识产权的非公开商业源代码。 + * 仅限已签署有效商业授权合同的单位或个人在约定范围内查阅和使用。 + * 源代码的“可访问性”均以合法授权为前提,不构成任何形式的知识产权转让或默示授权。 + * * + * 【禁止事项】 + * 除授权合同明确约定外,严禁任何形式的: + * 1. 复制、传播、披露、出售、出租或再分发本源代码; + * 2. 通过 SaaS、PaaS、云托管等方式向第三方提供本软件功能; + * 3. 将本软件或其衍生版本用于开发与权利人构成竞争的产品; + * 4. 向未授权第三方提供或展示本源代码或相关技术信息; + * 5. 篡改、规避或破坏版权标识、授权校验及其他技术保护措施。 + * * + * 【法律责任】 + * 任何未经授权的利用行为,均构成对商业秘密及知识产权的侵害。 + * 权利人将依据商业合同及《中华人民共和国著作权法》《反不正当竞争法》 + * 等法律法规,严厉追究违约与侵权责任。 + */ + +package tech.qiantong.qknow.module.ext.service.extTaskLog; + +import com.baomidou.mybatisplus.extension.service.IService; +import tech.qiantong.qknow.common.core.page.PageResult; +import tech.qiantong.qknow.module.ext.controller.admin.extTaskLog.vo.ExtTaskLogDetailPageReqVO; +import tech.qiantong.qknow.module.ext.controller.admin.extTaskLog.vo.ExtTaskLogDetailRespVO; +import tech.qiantong.qknow.module.ext.controller.admin.extTaskLog.vo.ExtTaskLogDetailSaveReqVO; +import tech.qiantong.qknow.module.ext.dal.dataobject.extTaskLog.ExtTaskLogDetailDO; + +import java.util.Collection; +import java.util.List; +import java.util.Map; +/** + * 抽取任务执行日志详情Service接口 + * + * @author qknow + * @date 2025-12-03 + */ +public interface IExtTaskLogDetailService extends IService { + + /** + * 获得抽取任务执行日志详情分页列表 + * + * @param pageReqVO 分页请求 + * @return 抽取任务执行日志详情分页列表 + */ + PageResult getExtTaskLogDetailPage(ExtTaskLogDetailPageReqVO pageReqVO); + + /** + * 创建抽取任务执行日志详情 + * + * @param createReqVO 抽取任务执行日志详情信息 + * @return 抽取任务执行日志详情编号 + */ + Long createExtTaskLogDetail(ExtTaskLogDetailSaveReqVO createReqVO); + + /** + * 更新抽取任务执行日志详情 + * + * @param updateReqVO 抽取任务执行日志详情信息 + */ + int updateExtTaskLogDetail(ExtTaskLogDetailSaveReqVO updateReqVO); + + /** + * 删除抽取任务执行日志详情 + * + * @param idList 抽取任务执行日志详情编号 + */ + int removeExtTaskLogDetail(Collection idList); + + /** + * 获得抽取任务执行日志详情详情 + * + * @param id 抽取任务执行日志详情编号 + * @return 抽取任务执行日志详情 + */ + ExtTaskLogDetailDO getExtTaskLogDetailById(Long id); + + /** + * 获得全部抽取任务执行日志详情列表 + * + * @return 抽取任务执行日志详情列表 + */ + List getExtTaskLogDetailList(); + + /** + * 获得全部抽取任务执行日志详情 Map + * + * @return 抽取任务执行日志详情 Map + */ + Map getExtTaskLogDetailMap(); + + + /** + * 导入抽取任务执行日志详情数据 + * + * @param importExcelList 抽取任务执行日志详情数据列表 + * @param isUpdateSupport 是否更新支持,如果已存在,则进行更新数据 + * @param operName 操作用户 + * @return 结果 + */ + String importExtTaskLogDetail(List importExcelList, boolean isUpdateSupport, String operName); + +} diff --git a/qknow-module-ext/qknow-module-ext-biz/src/main/java/tech/qiantong/qknow/module/ext/service/extTaskLog/IExtTaskLogService.java b/qknow-module-ext/qknow-module-ext-biz/src/main/java/tech/qiantong/qknow/module/ext/service/extTaskLog/IExtTaskLogService.java new file mode 100644 index 0000000000000000000000000000000000000000..6af7c058466021d6340ee658546a768041c723b6 --- /dev/null +++ b/qknow-module-ext/qknow-module-ext-biz/src/main/java/tech/qiantong/qknow/module/ext/service/extTaskLog/IExtTaskLogService.java @@ -0,0 +1,147 @@ +/* + * Copyright (c) 2026 Jiangsu Qiantong Technology Co., Ltd. + * * + * Software Name: qKnow Knowledge Platform (Business Edition) + * Software Copyright Registration No. 15980140 + * * + * [RIGHTS AND LICENSE STATEMENT] + * This file contains non-public commercial source code of which Jiangsu Qiantong + * Technology Co., Ltd. lawfully possesses complete intellectual property rights. + * * + * Access and use are limited to entities or individuals who have signed a valid + * commercial license agreement, within the scope stipulated in the agreement. + * The "accessibility" of this source code is premised on lawful authorization + * and does not constitute any form of transfer of intellectual property rights + * or implied licensing. + * * + * [PROHIBITIONS] + * Unless explicitly agreed in the license agreement, the following acts in any + * form are strictly prohibited: + * 1. Copying, disseminating, disclosing, selling, renting, or redistributing + * this source code; + * 2. Providing the software's functionality to third parties via SaaS, PaaS, + * cloud hosting, or other means; + * 3. Using this software or its derivative versions to develop products that + * compete with the Right Holder; + * 4. Providing or displaying this source code or related technical information + * to unauthorized third parties; + * 5. Tampering with, circumventing, or destroying copyright notices, license + * verifications, or other technical protection measures. + * * + * [LEGAL LIABILITY] + * Any unauthorized use constitutes an infringement of trade secrets and + * intellectual property rights. + * * + * The Right Holder will strictly pursue liability for breach of contract and + * infringement in accordance with the commercial agreement and laws such as + * the "Copyright Law of the People's Republic of China" and the "Anti-Unfair + * Competition Law". + * * + * ============================================================================ + * * + * Copyright (c) 2026 江苏千桐科技有限公司 + * * + * 软件名称:qKnow 知识平台(商业版) | 软著登字第15980140号 + * * + * 【权利与授权声明】 + * 本文件属于江苏千桐科技有限公司依法享有完全知识产权的非公开商业源代码。 + * 仅限已签署有效商业授权合同的单位或个人在约定范围内查阅和使用。 + * 源代码的“可访问性”均以合法授权为前提,不构成任何形式的知识产权转让或默示授权。 + * * + * 【禁止事项】 + * 除授权合同明确约定外,严禁任何形式的: + * 1. 复制、传播、披露、出售、出租或再分发本源代码; + * 2. 通过 SaaS、PaaS、云托管等方式向第三方提供本软件功能; + * 3. 将本软件或其衍生版本用于开发与权利人构成竞争的产品; + * 4. 向未授权第三方提供或展示本源代码或相关技术信息; + * 5. 篡改、规避或破坏版权标识、授权校验及其他技术保护措施。 + * * + * 【法律责任】 + * 任何未经授权的利用行为,均构成对商业秘密及知识产权的侵害。 + * 权利人将依据商业合同及《中华人民共和国著作权法》《反不正当竞争法》 + * 等法律法规,严厉追究违约与侵权责任。 + */ + +package tech.qiantong.qknow.module.ext.service.extTaskLog; + + +import com.baomidou.mybatisplus.extension.service.IService; +import tech.qiantong.qknow.common.core.page.PageResult; +import tech.qiantong.qknow.module.ext.controller.admin.extTaskLog.vo.ExtTaskLogDetailPageReqVO; +import tech.qiantong.qknow.module.ext.controller.admin.extTaskLog.vo.ExtTaskLogPageReqVO; +import tech.qiantong.qknow.module.ext.controller.admin.extTaskLog.vo.ExtTaskLogSaveReqVO; +import tech.qiantong.qknow.module.ext.dal.dataobject.extTaskLog.ExtTaskLogDO; +import tech.qiantong.qknow.module.ext.dal.dataobject.extTaskLog.ExtTaskLogDetailDO; +import tech.qiantong.qknow.module.ext.extEnum.ExtLogStatusEnum; +import tech.qiantong.qknow.module.ext.extEnum.ExtTaskTypeEnum; + +/** + * 抽取任务执行日志Service接口 + * + * @author qknow + * @date 2025-12-03 + */ +public interface IExtTaskLogService extends IService { + + /** + * 获得抽取任务执行日志分页列表 + * + * @param pageReqVO 分页请求 + * @return 抽取任务执行日志分页列表 + */ + PageResult getExtTaskLogPage(ExtTaskLogPageReqVO pageReqVO); + + /** + * 获得抽取任务执行日志分页列表 + * + * @param detailPageReqVO 分页请求 + * @return 抽取任务执行日志分页列表 + */ + PageResult getLogDetailPage(ExtTaskLogDetailPageReqVO detailPageReqVO); + + /** + * 创建抽取任务执行日志 + * + * @param createReqVO 抽取任务执行日志信息 + * @return 抽取任务执行日志编号 + */ + Long createExtTaskLog(ExtTaskLogSaveReqVO createReqVO); + + /** + * 获得抽取任务执行日志详情 + * + * @param id 抽取任务执行日志编号 + * @return 抽取任务执行日志 + */ + ExtTaskLogDO getExtTaskLogById(Long id); + + /** + * 开始执行日志 + * + * @param workSpaceId 工作空间id + * @param taskId 执行的任务id + * @param taskName 任务名称 + * @param taskType 任务类型 + * @return 日志id + */ + Long startInvoke(Long workSpaceId, Long taskId, String taskName, ExtTaskTypeEnum taskType); + + /** + * 记录日志步骤 + * + * @param logId 日志id + * @param step 执行步骤 + */ + void recordStep(Long logId, String step); + + /** + * 执行结束 + * + * @param logId 日志id + * @param status 日志的执行状态 + * @param errorMsg 错误日志 + */ + void endInvoke(Long logId, ExtLogStatusEnum status, String errorMsg); + + +} diff --git a/qknow-module-ext/qknow-module-ext-biz/src/main/java/tech/qiantong/qknow/module/ext/service/extTaskLog/impl/ExtTaskLogDetailServiceImpl.java b/qknow-module-ext/qknow-module-ext-biz/src/main/java/tech/qiantong/qknow/module/ext/service/extTaskLog/impl/ExtTaskLogDetailServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..731ecf3df2de1c4d87e21863d3de78cb60df5bc7 --- /dev/null +++ b/qknow-module-ext/qknow-module-ext-biz/src/main/java/tech/qiantong/qknow/module/ext/service/extTaskLog/impl/ExtTaskLogDetailServiceImpl.java @@ -0,0 +1,221 @@ +/* + * Copyright (c) 2026 Jiangsu Qiantong Technology Co., Ltd. + * * + * Software Name: qKnow Knowledge Platform (Business Edition) + * Software Copyright Registration No. 15980140 + * * + * [RIGHTS AND LICENSE STATEMENT] + * This file contains non-public commercial source code of which Jiangsu Qiantong + * Technology Co., Ltd. lawfully possesses complete intellectual property rights. + * * + * Access and use are limited to entities or individuals who have signed a valid + * commercial license agreement, within the scope stipulated in the agreement. + * The "accessibility" of this source code is premised on lawful authorization + * and does not constitute any form of transfer of intellectual property rights + * or implied licensing. + * * + * [PROHIBITIONS] + * Unless explicitly agreed in the license agreement, the following acts in any + * form are strictly prohibited: + * 1. Copying, disseminating, disclosing, selling, renting, or redistributing + * this source code; + * 2. Providing the software's functionality to third parties via SaaS, PaaS, + * cloud hosting, or other means; + * 3. Using this software or its derivative versions to develop products that + * compete with the Right Holder; + * 4. Providing or displaying this source code or related technical information + * to unauthorized third parties; + * 5. Tampering with, circumventing, or destroying copyright notices, license + * verifications, or other technical protection measures. + * * + * [LEGAL LIABILITY] + * Any unauthorized use constitutes an infringement of trade secrets and + * intellectual property rights. + * * + * The Right Holder will strictly pursue liability for breach of contract and + * infringement in accordance with the commercial agreement and laws such as + * the "Copyright Law of the People's Republic of China" and the "Anti-Unfair + * Competition Law". + * * + * ============================================================================ + * * + * Copyright (c) 2026 江苏千桐科技有限公司 + * * + * 软件名称:qKnow 知识平台(商业版) | 软著登字第15980140号 + * * + * 【权利与授权声明】 + * 本文件属于江苏千桐科技有限公司依法享有完全知识产权的非公开商业源代码。 + * 仅限已签署有效商业授权合同的单位或个人在约定范围内查阅和使用。 + * 源代码的“可访问性”均以合法授权为前提,不构成任何形式的知识产权转让或默示授权。 + * * + * 【禁止事项】 + * 除授权合同明确约定外,严禁任何形式的: + * 1. 复制、传播、披露、出售、出租或再分发本源代码; + * 2. 通过 SaaS、PaaS、云托管等方式向第三方提供本软件功能; + * 3. 将本软件或其衍生版本用于开发与权利人构成竞争的产品; + * 4. 向未授权第三方提供或展示本源代码或相关技术信息; + * 5. 篡改、规避或破坏版权标识、授权校验及其他技术保护措施。 + * * + * 【法律责任】 + * 任何未经授权的利用行为,均构成对商业秘密及知识产权的侵害。 + * 权利人将依据商业合同及《中华人民共和国著作权法》《反不正当竞争法》 + * 等法律法规,严厉追究违约与侵权责任。 + */ + +package tech.qiantong.qknow.module.ext.service.extTaskLog.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import tech.qiantong.qknow.common.core.page.PageResult; +import tech.qiantong.qknow.common.exception.ServiceException; +import tech.qiantong.qknow.common.utils.StringUtils; +import tech.qiantong.qknow.common.utils.object.BeanUtils; +import tech.qiantong.qknow.module.ext.controller.admin.extTaskLog.vo.ExtTaskLogDetailPageReqVO; +import tech.qiantong.qknow.module.ext.controller.admin.extTaskLog.vo.ExtTaskLogDetailRespVO; +import tech.qiantong.qknow.module.ext.controller.admin.extTaskLog.vo.ExtTaskLogDetailSaveReqVO; +import tech.qiantong.qknow.module.ext.dal.dataobject.extTaskLog.ExtTaskLogDetailDO; +import tech.qiantong.qknow.module.ext.dal.mapper.extTaskLog.ExtTaskLogDetailMapper; +import tech.qiantong.qknow.module.ext.service.extTaskLog.IExtTaskLogDetailService; + +import javax.annotation.Resource; +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +/** + * 抽取任务执行日志详情Service业务层处理 + * + * @author qknow + * @date 2025-12-03 + */ +@Slf4j +@Service +@Transactional(rollbackFor = Exception.class) +public class ExtTaskLogDetailServiceImpl extends ServiceImpl implements IExtTaskLogDetailService { + @Resource + private ExtTaskLogDetailMapper extTaskLogDetailMapper; + + @Override + public PageResult getExtTaskLogDetailPage(ExtTaskLogDetailPageReqVO pageReqVO) { + return extTaskLogDetailMapper.selectPage(pageReqVO); + } + + @Override + public Long createExtTaskLogDetail(ExtTaskLogDetailSaveReqVO createReqVO) { + ExtTaskLogDetailDO dictType = BeanUtils.toBean(createReqVO, ExtTaskLogDetailDO.class); + extTaskLogDetailMapper.insert(dictType); + return dictType.getId(); + } + + @Override + public int updateExtTaskLogDetail(ExtTaskLogDetailSaveReqVO updateReqVO) { + // 相关校验 + + // 更新抽取任务执行日志详情 + ExtTaskLogDetailDO updateObj = BeanUtils.toBean(updateReqVO, ExtTaskLogDetailDO.class); + return extTaskLogDetailMapper.updateById(updateObj); + } + + @Override + public int removeExtTaskLogDetail(Collection idList) { + // 批量删除抽取任务执行日志详情 + return extTaskLogDetailMapper.deleteBatchIds(idList); + } + + @Override + public ExtTaskLogDetailDO getExtTaskLogDetailById(Long id) { + return extTaskLogDetailMapper.selectById(id); + } + + @Override + public List getExtTaskLogDetailList() { + return extTaskLogDetailMapper.selectList(); + } + + @Override + public Map getExtTaskLogDetailMap() { + List extTaskLogDetailList = extTaskLogDetailMapper.selectList(); + return extTaskLogDetailList.stream() + .collect(Collectors.toMap( + ExtTaskLogDetailDO::getId, + extTaskLogDetailDO -> extTaskLogDetailDO, + // 保留已存在的值 + (existing, replacement) -> existing + )); + } + + + /** + * 导入抽取任务执行日志详情数据 + * + * @param importExcelList 抽取任务执行日志详情数据列表 + * @param isUpdateSupport 是否更新支持,如果已存在,则进行更新数据 + * @param operName 操作用户 + * @return 结果 + */ + @Override + public String importExtTaskLogDetail(List importExcelList, boolean isUpdateSupport, String operName) { + if (StringUtils.isNull(importExcelList) || importExcelList.size() == 0) { + throw new ServiceException("导入数据不能为空!"); + } + + int successNum = 0; + int failureNum = 0; + List successMessages = new ArrayList<>(); + List failureMessages = new ArrayList<>(); + + for (ExtTaskLogDetailRespVO respVO : importExcelList) { + try { + ExtTaskLogDetailDO extTaskLogDetailDO = BeanUtils.toBean(respVO, ExtTaskLogDetailDO.class); + Long extTaskLogDetailId = respVO.getId(); + if (isUpdateSupport) { + if (extTaskLogDetailId != null) { + ExtTaskLogDetailDO existingExtTaskLogDetail = extTaskLogDetailMapper.selectById(extTaskLogDetailId); + if (existingExtTaskLogDetail != null) { + extTaskLogDetailMapper.updateById(extTaskLogDetailDO); + successNum++; + successMessages.add("数据更新成功,ID为 " + extTaskLogDetailId + " 的抽取任务执行日志详情记录。"); + } else { + failureNum++; + failureMessages.add("数据更新失败,ID为 " + extTaskLogDetailId + " 的抽取任务执行日志详情记录不存在。"); + } + } else { + failureNum++; + failureMessages.add("数据更新失败,某条记录的ID不存在。"); + } + } else { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("id", extTaskLogDetailId); + ExtTaskLogDetailDO existingExtTaskLogDetail = extTaskLogDetailMapper.selectOne(queryWrapper); + if (existingExtTaskLogDetail == null) { + extTaskLogDetailMapper.insert(extTaskLogDetailDO); + successNum++; + successMessages.add("数据插入成功,ID为 " + extTaskLogDetailId + " 的抽取任务执行日志详情记录。"); + } else { + failureNum++; + failureMessages.add("数据插入失败,ID为 " + extTaskLogDetailId + " 的抽取任务执行日志详情记录已存在。"); + } + } + } catch (Exception e) { + failureNum++; + String errorMsg = "数据导入失败,错误信息:" + e.getMessage(); + failureMessages.add(errorMsg); + log.error(errorMsg, e); + } + } + StringBuilder resultMsg = new StringBuilder(); + if (failureNum > 0) { + resultMsg.append("很抱歉,导入失败!共 ").append(failureNum).append(" 条数据格式不正确,错误如下:"); + resultMsg.append("
").append(String.join("
", failureMessages)); + throw new ServiceException(resultMsg.toString()); + } else { + resultMsg.append("恭喜您,数据已全部导入成功!共 ").append(successNum).append(" 条。"); + } + return resultMsg.toString(); + } +} diff --git a/qknow-module-ext/qknow-module-ext-biz/src/main/java/tech/qiantong/qknow/module/ext/service/extTaskLog/impl/ExtTaskLogServiceImpl.java b/qknow-module-ext/qknow-module-ext-biz/src/main/java/tech/qiantong/qknow/module/ext/service/extTaskLog/impl/ExtTaskLogServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..1feea4833134ae21be61ab592253deecb0e17396 --- /dev/null +++ b/qknow-module-ext/qknow-module-ext-biz/src/main/java/tech/qiantong/qknow/module/ext/service/extTaskLog/impl/ExtTaskLogServiceImpl.java @@ -0,0 +1,213 @@ +/* + * Copyright (c) 2026 Jiangsu Qiantong Technology Co., Ltd. + * * + * Software Name: qKnow Knowledge Platform (Business Edition) + * Software Copyright Registration No. 15980140 + * * + * [RIGHTS AND LICENSE STATEMENT] + * This file contains non-public commercial source code of which Jiangsu Qiantong + * Technology Co., Ltd. lawfully possesses complete intellectual property rights. + * * + * Access and use are limited to entities or individuals who have signed a valid + * commercial license agreement, within the scope stipulated in the agreement. + * The "accessibility" of this source code is premised on lawful authorization + * and does not constitute any form of transfer of intellectual property rights + * or implied licensing. + * * + * [PROHIBITIONS] + * Unless explicitly agreed in the license agreement, the following acts in any + * form are strictly prohibited: + * 1. Copying, disseminating, disclosing, selling, renting, or redistributing + * this source code; + * 2. Providing the software's functionality to third parties via SaaS, PaaS, + * cloud hosting, or other means; + * 3. Using this software or its derivative versions to develop products that + * compete with the Right Holder; + * 4. Providing or displaying this source code or related technical information + * to unauthorized third parties; + * 5. Tampering with, circumventing, or destroying copyright notices, license + * verifications, or other technical protection measures. + * * + * [LEGAL LIABILITY] + * Any unauthorized use constitutes an infringement of trade secrets and + * intellectual property rights. + * * + * The Right Holder will strictly pursue liability for breach of contract and + * infringement in accordance with the commercial agreement and laws such as + * the "Copyright Law of the People's Republic of China" and the "Anti-Unfair + * Competition Law". + * * + * ============================================================================ + * * + * Copyright (c) 2026 江苏千桐科技有限公司 + * * + * 软件名称:qKnow 知识平台(商业版) | 软著登字第15980140号 + * * + * 【权利与授权声明】 + * 本文件属于江苏千桐科技有限公司依法享有完全知识产权的非公开商业源代码。 + * 仅限已签署有效商业授权合同的单位或个人在约定范围内查阅和使用。 + * 源代码的“可访问性”均以合法授权为前提,不构成任何形式的知识产权转让或默示授权。 + * * + * 【禁止事项】 + * 除授权合同明确约定外,严禁任何形式的: + * 1. 复制、传播、披露、出售、出租或再分发本源代码; + * 2. 通过 SaaS、PaaS、云托管等方式向第三方提供本软件功能; + * 3. 将本软件或其衍生版本用于开发与权利人构成竞争的产品; + * 4. 向未授权第三方提供或展示本源代码或相关技术信息; + * 5. 篡改、规避或破坏版权标识、授权校验及其他技术保护措施。 + * * + * 【法律责任】 + * 任何未经授权的利用行为,均构成对商业秘密及知识产权的侵害。 + * 权利人将依据商业合同及《中华人民共和国著作权法》《反不正当竞争法》 + * 等法律法规,严厉追究违约与侵权责任。 + */ + +package tech.qiantong.qknow.module.ext.service.extTaskLog.impl; + +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import tech.qiantong.qknow.common.core.page.PageResult; +import tech.qiantong.qknow.common.exception.ServiceException; +import tech.qiantong.qknow.common.utils.object.BeanUtils; +import tech.qiantong.qknow.module.ext.controller.admin.extTaskLog.vo.ExtTaskLogDetailPageReqVO; +import tech.qiantong.qknow.module.ext.controller.admin.extTaskLog.vo.ExtTaskLogPageReqVO; +import tech.qiantong.qknow.module.ext.controller.admin.extTaskLog.vo.ExtTaskLogSaveReqVO; +import tech.qiantong.qknow.module.ext.dal.dataobject.extTaskLog.ExtTaskLogDO; +import tech.qiantong.qknow.module.ext.dal.dataobject.extTaskLog.ExtTaskLogDetailDO; +import tech.qiantong.qknow.module.ext.dal.mapper.extTaskLog.ExtTaskLogDetailMapper; +import tech.qiantong.qknow.module.ext.dal.mapper.extTaskLog.ExtTaskLogMapper; +import tech.qiantong.qknow.module.ext.extEnum.ExtLogStatusEnum; +import tech.qiantong.qknow.module.ext.extEnum.ExtTaskTypeEnum; +import tech.qiantong.qknow.module.ext.service.extTaskLog.IExtTaskLogService; + +import javax.annotation.Resource; +import java.util.Date; +import java.util.Objects; + +/** + * 抽取任务执行日志Service业务层处理 + * + * @author qknow + * @date 2025-12-03 + */ +@Slf4j +@Service +@Transactional(rollbackFor = Exception.class) +public class ExtTaskLogServiceImpl extends ServiceImpl implements IExtTaskLogService { + @Resource + private ExtTaskLogMapper extTaskLogMapper; + @Resource + private ExtTaskLogDetailMapper logDetailMapper; + + @Override + public PageResult getExtTaskLogPage(ExtTaskLogPageReqVO pageReqVO) { + return extTaskLogMapper.selectPage(pageReqVO); + } + + /** + * 获得抽取任务执行日志分页列表 + * + * @param detailPageReqVO 分页请求 + * @return 抽取任务执行日志分页列表 + */ + @Override + public PageResult getLogDetailPage(ExtTaskLogDetailPageReqVO detailPageReqVO) { + return logDetailMapper.selectPage(detailPageReqVO); + } + + @Override + public Long createExtTaskLog(ExtTaskLogSaveReqVO createReqVO) { + ExtTaskLogDO dictType = BeanUtils.toBean(createReqVO, ExtTaskLogDO.class); + extTaskLogMapper.insert(dictType); + return dictType.getId(); + } + + @Override + public ExtTaskLogDO getExtTaskLogById(Long id) { + return extTaskLogMapper.selectById(id); + } + + /** + * 开始执行日志 + * + * @param taskId 执行的任务id + * @param taskName 任务名称 + * @param taskType 任务类型 + * @return 日志id + */ + @Override + public Long startInvoke(Long workSpaceId, Long taskId, String taskName, ExtTaskTypeEnum taskType) { + ExtTaskLogDO entity = new ExtTaskLogDO(); + entity.setWorkspaceId(workSpaceId); + entity.setTaskId(taskId); + entity.setTaskName(taskName); + entity.setTaskType(taskType.getValue()); + entity.setStatus(ExtLogStatusEnum.SUCCESS.getValue());// 默认是成功的状态 + entity.setStartTime(new Date()); + extTaskLogMapper.insert(entity); + return entity.getId(); + } + + /** + * 记录日志步骤 + * + * @param logId 日志id + * @param step 执行步骤 + */ + @Override + public void recordStep(Long logId, String step) { + if (step.length() > 2000) { + step = step.substring(0, 2000); + } + ExtTaskLogDO taskLogDO = extTaskLogMapper.selectById(logId); + if (Objects.isNull(taskLogDO)) { + throw new ServiceException("获取日志对象出错"); + } + ExtTaskLogDetailDO detailEntity = new ExtTaskLogDetailDO(); + detailEntity.setLogId(logId); + detailEntity.setWorkspaceId(taskLogDO.getWorkspaceId()); + detailEntity.setStep(step); + logDetailMapper.insert(detailEntity); + // 同时修改下结束事件 + updateEndTime(logId); + } + + /** + * 执行结束 + * + * @param logId 日志id + * @param status 日志的执行状态 + * @param errorMsg 错误日志 + */ + @Override + public void endInvoke(Long logId, ExtLogStatusEnum status, String errorMsg) { + if (Objects.isNull(errorMsg)) { + errorMsg = ""; + } + if (errorMsg.length() > 2000) { + errorMsg = errorMsg.substring(0, 2000); + } + LambdaUpdateWrapper updateWrapper = Wrappers.lambdaUpdate() + .set(ExtTaskLogDO::getStatus, status.getValue()) + .set(ExtTaskLogDO::getErrorMsg, errorMsg) + .set(ExtTaskLogDO::getEndTime, new Date()) + .eq(ExtTaskLogDO::getId, logId); + super.update(updateWrapper); + } + + /** + * 更新日志的结束时间 + * + * @param logId 日志id + */ + private void updateEndTime(Long logId) { + LambdaUpdateWrapper updateWrapper = Wrappers.lambdaUpdate() + .set(ExtTaskLogDO::getEndTime, new Date()) + .eq(ExtTaskLogDO::getId, logId); + super.update(updateWrapper); + } +} diff --git a/qknow-module-ext/qknow-module-ext-biz/src/main/java/tech/qiantong/qknow/module/ext/service/extUnstructTask/impl/ExtUnstructTaskServiceImpl.java b/qknow-module-ext/qknow-module-ext-biz/src/main/java/tech/qiantong/qknow/module/ext/service/extUnstructTask/impl/ExtUnstructTaskServiceImpl.java index 073d69d173e5a07595150d3efa7290d2fcf449b5..d29a7536403f9e320dbc4aa6ef2fd0b980a31784 100644 --- a/qknow-module-ext/qknow-module-ext-biz/src/main/java/tech/qiantong/qknow/module/ext/service/extUnstructTask/impl/ExtUnstructTaskServiceImpl.java +++ b/qknow-module-ext/qknow-module-ext-biz/src/main/java/tech/qiantong/qknow/module/ext/service/extUnstructTask/impl/ExtUnstructTaskServiceImpl.java @@ -32,11 +32,13 @@ package tech.qiantong.qknow.module.ext.service.extUnstructTask.impl; +import cn.hutool.core.util.StrUtil; import com.alibaba.fastjson2.JSON; import com.alibaba.fastjson2.JSONArray; import com.alibaba.fastjson2.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.google.common.collect.Lists; import lombok.extern.slf4j.Slf4j; import org.apache.poi.xwpf.usermodel.XWPFDocument; import org.apache.poi.xwpf.usermodel.XWPFParagraph; @@ -60,10 +62,9 @@ import tech.qiantong.qknow.module.ext.dal.dataobject.extraction.ExtExtractionDO; import tech.qiantong.qknow.module.ext.dal.dataobject.unstructTaskRelation.ExtUnstructTaskRelationDO; import tech.qiantong.qknow.module.ext.dal.mapper.extUnstructTask.ExtUnstructTaskMapper; import tech.qiantong.qknow.module.ext.dal.mapper.extUnstructTaskText.ExtUnstructTaskTextMapper; -import tech.qiantong.qknow.module.ext.extEnum.ExtTaskStatus; -import tech.qiantong.qknow.module.ext.extEnum.ExtractType; -import tech.qiantong.qknow.module.ext.extEnum.UnstructTypeEnums; +import tech.qiantong.qknow.module.ext.extEnum.*; import tech.qiantong.qknow.module.ext.service.deepke.DeepkeExtractionService; +import tech.qiantong.qknow.module.ext.service.extTaskLog.IExtTaskLogService; import tech.qiantong.qknow.module.ext.service.extUnstructTask.IExtUnstructTaskService; import tech.qiantong.qknow.module.ext.service.extUnstructTaskDocRel.IExtUnstructTaskDocRelService; import tech.qiantong.qknow.module.ext.service.neo4j.service.ExtNeo4jService; @@ -71,15 +72,17 @@ import tech.qiantong.qknow.module.ext.service.unstructTaskRelation.IExtUnstructT import tech.qiantong.qknow.module.kmc.api.service.IKmcApiService; import tech.qiantong.qknow.module.kmc.dal.dataobject.document.KmcDocumentDO; import tech.qiantong.qknow.module.kmc.service.kmcDocument.IKmcDocumentService; +import tech.qiantong.qknow.module.system.service.ISysConfigService; import tech.qiantong.qknow.redis.service.IRedisService; import javax.annotation.Resource; -import java.io.IOException; import java.io.InputStream; import java.net.HttpURLConnection; import java.net.URL; import java.util.*; -import java.util.concurrent.CompletableFuture; +import java.util.concurrent.*; +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.concurrent.atomic.AtomicInteger; import java.util.stream.Collectors; /** @@ -111,13 +114,22 @@ public class ExtUnstructTaskServiceImpl extends ServiceImpl docRelPage = extUnstructTaskDocRelService.getExtUnstructTaskDocRelPage(docRelPageReqVO); - List taskDocRelDOList = BeanUtils.toBean(docRelPage.getRows(), ExtUnstructTaskDocRelDO.class); - - try { - // 根据配置文件判断使用哪种方式进行抽取 - if (UnstructTypeEnums.MODEL.eq(unstructType)) { - // TODO 使用大模型抽取,开源版本暂未支持,如有需要请咨询相关管理人员 - log.warn("大模型抽取暂未支持~"); - } else { - // 使用DeepKE进行抽取 - this.execExtTask(unstructTaskDO, taskDocRelDOList); + int totalThreadNum = getCurrentConcurrentCount(); + // 获取配置的线程数 + String config = configService.selectConfigByKey("ext.thread.concurrency"); + int threadNum = StringUtils.isEmpty(config) ? 1 : Integer.parseInt(config); + // 限制1~50 + threadNum = Math.max(1, Math.min(50, threadNum)); + + while (totalThreadNum < threadNum) { + // 取出队列中的任务id + String taskId = redisService.leftPop("ext_unstruck"); + + // 判断队列是否为空 + if (StringUtils.isEmpty(taskId)) { + log.info("队列中没有等待抽取的任务"); + break; } - - log.info("----------------非结构化抽取任务结束-----------------------taskId:{}", taskId); - - // 处理任务完成后的状态更新 - unstructTaskDO.setStatus(ExtTaskStatus.EXECUTED.getValue()); - extUnstructTaskMapper.updateExtUnstructTask(unstructTaskDO); - } catch (Exception e) { - e.printStackTrace(); - // 捕获异常并打印日志 - log.error("非结构化任务抽取处理失败: {}", e.getMessage()); - unstructTaskDO.setStatus(ExtTaskStatus.ERROR.getValue()); - extUnstructTaskMapper.updateExtUnstructTask(unstructTaskDO); + executeTask(taskId, getOrRebuildExecutor(threadNum)); + totalThreadNum = getCurrentConcurrentCount(); } } /** * 执行抽取任务 + * + * @param unStructTaskDO 非结构化抽取任务对象 + * @param taskDocRelDOList 任务文档对象 + * @return void * @author shaun * @date 2025/05/27 10:22 - * @param unstructTaskDO - * @param taskDocRelDOList - * @return void */ - private void execExtTask(ExtUnstructTaskDO unstructTaskDO, List taskDocRelDOList) throws Exception { + private void execExtTask(ExtUnstructTaskDO unStructTaskDO, List taskDocRelDOList, + ExecutorService executor, Long logId) throws Exception { // 获取所有的文件,存放至map中 Map documentMap = kmcDocumentService.getKmcDocumentMap(); - - // 遍历任务关联的文件 - for (ExtUnstructTaskDocRelDO extUnstructTaskDocRelDO : taskDocRelDOList) { - KmcDocumentDO kmcDocument = documentMap.get(extUnstructTaskDocRelDO.getDocId()); - - // 拼接文件地址 - String fileUrl = "http://127.0.0.1:8090/profile" + kmcDocument.getPath(); - - // 删除neo4j中之前抽取相关的数据, 如果有的话 - ExtExtractionDO extractionDO = new ExtExtractionDO(); - extractionDO.setTaskId(unstructTaskDO.getId()); - extNeo4jService.deleteExtUnStruck(extractionDO); - // 删除mysql中之前抽取的段落相关的数据, 如果有的话 - extUnstructTaskTextMapper.deleteByTaskId(unstructTaskDO.getId()); - - // 创建 URL 对象 - URL url = new URL(fileUrl); - // 打开连接 - HttpURLConnection connection = (HttpURLConnection) url.openConnection(); - // 设置请求方法 - connection.setRequestMethod("GET"); - // 获取输入流 - InputStream inputStream = connection.getInputStream(); - // 使用 XWPFDocument 解析 docx 文件 - XWPFDocument document = new XWPFDocument(inputStream); - // 获取文档中的段落 - List paragraphs = document.getParagraphs(); - - int i = 0; - // 输出每个段落的文本内容 - for (XWPFParagraph paragraph : paragraphs) { - i++; - String text = paragraph.getText(); - if (StringUtils.isBlank(text)) { - continue; - } - log.info("============>抽取文本: {}", text); - - log.info("============调用DeepKE工具开始抽取============"); - AjaxResult ajaxResult = deepkeExtractionService.deepkeExtraction(text); - log.info("============调用DeepKE工具完成============"); - - if (ajaxResult.isSuccess()) { - log.info("============>抽取文本成功:{}", text); - String result = (String) ajaxResult.get("data"); - String entity = result.substring(result.indexOf("抽取到的实体====>") + 11, result.indexOf("<====抽取到的实体")); - entity = entity.replace("'", "\""); - log.info("============>抽取到的实体:{}", entity); - String triplet = result.substring(result.indexOf("抽取到的三元组====>") + 12, result.indexOf("<====抽取到的三元组")); - triplet = triplet.replace("'", "\""); - log.info("============>抽取到的三元组:{}", JSONArray.parseArray(triplet)); - List extractionList = JSON.parseArray(triplet, ExtExtractionDO.class); - if (extractionList.size() > 0) { - for (ExtExtractionDO e : extractionList) { - e.setTaskId(unstructTaskDO.getId()); - e.setDocId(extUnstructTaskDocRelDO.getDocId().intValue()); - e.setParagraphIndex(i); + List> futures = Lists.newArrayList(); + // 创建任务取消标志 + AtomicBoolean taskCancelled = new AtomicBoolean(false); + try { + // 遍历任务关联的文件 + for (ExtUnstructTaskDocRelDO extUnstructTaskDocRelDO : taskDocRelDOList) { + KmcDocumentDO kmcDocument = documentMap.get(extUnstructTaskDocRelDO.getDocId()); + int fileIndex = taskDocRelDOList.indexOf(extUnstructTaskDocRelDO); + // 拼接文件地址 + String fileUrl = "http://127.0.0.1:8090/profile" + kmcDocument.getPath(); + + // 删除neo4j中之前抽取相关的数据, 如果有的话 + ExtExtractionDO extractionDO = new ExtExtractionDO(); + extractionDO.setTaskId(unStructTaskDO.getId()); + extNeo4jService.deleteExtUnStruck(extractionDO); + // 删除mysql中之前抽取的段落相关的数据, 如果有的话 + extUnstructTaskTextMapper.deleteByTaskId(unStructTaskDO.getId()); + + // 创建 URL 对象 + URL url = new URL(fileUrl); + // 打开连接 + HttpURLConnection connection = (HttpURLConnection) url.openConnection(); + // 设置请求方法 + connection.setRequestMethod("GET"); + // 获取输入流 + InputStream inputStream = connection.getInputStream(); + // 使用 XWPFDocument 解析 docx 文件 + XWPFDocument document = new XWPFDocument(inputStream); + // 获取文档中的段落 + List paragraphs = document.getParagraphs(); + + // 输出每个段落的文本内容 + for (XWPFParagraph paragraph : paragraphs) { + String text = paragraph.getText(); + int partIndex = paragraphs.indexOf(paragraph); + if (taskCancelled.get()) { + subCurrentConcurrentCount(); + return; // 如果任务已被取消,则直接返回 + } + if (StringUtils.isBlank(text)) { + continue; + } + log.info("============>抽取文本: {}", text); + CompletableFuture future = CompletableFuture.runAsync(() -> { + log.info("============调用DeepKE工具开始抽取============"); + AjaxResult ajaxResult = new AjaxResult(); + ServiceException serviceException = new ServiceException(); + String logText = "开始抽取第" + (fileIndex + 1) + "个文件的第" + (partIndex + 1) + "个分段"; + extTaskLogService.recordStep(logId, logText); + try { + ajaxResult = deepkeExtractionService.deepkeExtraction(text); + } catch (Exception e) { + serviceException.setMessage("结果解析异常" + e.getMessage()); + } + log.info("============调用DeepKE工具完成============"); + if (StringUtils.isNotEmpty(serviceException.getMessage()) || !ajaxResult.isSuccess()) { + taskCancelled.set(true); + extTaskLogService.recordStep(logId, StrUtil.format("抽取任务失败:{}", ajaxResult)); + unStructTaskDO.setStatus(ExtTaskStatus.ERROR.getValue()); + extUnstructTaskMapper.updateExtUnstructTask(unStructTaskDO); + subCurrentConcurrentCount(); + throw serviceException; } - //把抽取出来的数据存储到neo4j数据库 - extNeo4jService.insertExtractionList(extractionList); - - //把文字信息存储到数据库 - ExtUnstructTaskTextDO taskTextDO = new ExtUnstructTaskTextDO(); - taskTextDO.setValidFlag(false); - taskTextDO.setDelFlag(false); - taskTextDO.setWorkspaceId(unstructTaskDO.getWorkspaceId()); - taskTextDO.setDocId(extUnstructTaskDocRelDO.getDocId()); - taskTextDO.setTaskId(unstructTaskDO.getId()); - taskTextDO.setParagraphIndex(i); - taskTextDO.setText(text); - taskTextDO.setCreateBy(unstructTaskDO.getUpdateBy()); - taskTextDO.setUpdateBy(unstructTaskDO.getUpdateBy()); - taskTextDO.setCreatorId(unstructTaskDO.getUpdaterId()); - taskTextDO.setUpdaterId(unstructTaskDO.getUpdaterId()); - taskTextDO.setCreateTime(new Date()); - taskTextDO.setUpdateTime(new Date()); - log.info("============>把段落数据添加到数据库:{}", JSONObject.toJSONString(taskTextDO)); - extUnstructTaskTextMapper.insert(taskTextDO); - } - } else { - log.error("============>抽取任务失败: {}", ajaxResult); - unstructTaskDO.setStatus(ExtTaskStatus.ERROR.getValue()); - extUnstructTaskMapper.updateExtUnstructTask(unstructTaskDO); + log.info("============>抽取文本成功:{}", text); + String result = (String) ajaxResult.get("data"); + String entity = result.substring(result.indexOf("抽取到的实体====>") + 11, result.indexOf("<====抽取到的实体")); + entity = entity.replace("'", "\""); + log.info("============>抽取到的实体:{}", entity); + String triplet = result.substring(result.indexOf("抽取到的三元组====>") + 12, result.indexOf("<====抽取到的三元组")); + triplet = triplet.replace("'", "\""); + log.info("============>抽取到的三元组:{}", JSONArray.parseArray(triplet)); + List extractionList = JSON.parseArray(triplet, ExtExtractionDO.class); + if (extractionList.size() > 0) { + for (ExtExtractionDO e : extractionList) { + e.setTaskId(unStructTaskDO.getId()); + e.setDocId(extUnstructTaskDocRelDO.getDocId().intValue()); + e.setParagraphIndex(partIndex); + } + + //把抽取出来的数据存储到neo4j数据库 + extNeo4jService.insertExtractionList(extractionList); + + //把文字信息存储到数据库 + ExtUnstructTaskTextDO taskTextDO = new ExtUnstructTaskTextDO(); + taskTextDO.setValidFlag(false); + taskTextDO.setDelFlag(false); + taskTextDO.setWorkspaceId(unStructTaskDO.getWorkspaceId()); + taskTextDO.setDocId(extUnstructTaskDocRelDO.getDocId()); + taskTextDO.setTaskId(unStructTaskDO.getId()); + taskTextDO.setParagraphIndex(partIndex); + taskTextDO.setText(text); + taskTextDO.setCreateBy(unStructTaskDO.getUpdateBy()); + taskTextDO.setUpdateBy(unStructTaskDO.getUpdateBy()); + taskTextDO.setCreatorId(unStructTaskDO.getUpdaterId()); + taskTextDO.setUpdaterId(unStructTaskDO.getUpdaterId()); + taskTextDO.setCreateTime(new Date()); + taskTextDO.setUpdateTime(new Date()); + log.info("============>把段落数据添加到数据库:{}", JSONObject.toJSONString(taskTextDO)); + extUnstructTaskTextMapper.insert(taskTextDO); + } + subCurrentConcurrentCount(); + }, executor); + futures.add(future); } } + } finally { + // 线程数量 + String count = String.valueOf(getCurrentConcurrentCount() + futures.size()); + redisService.set("ext_run_model_count", count); + if (getCurrentConcurrentCount() <= 0) { + executor.shutdown(); + } } + + CompletableFuture.runAsync(() -> { + try { + // 等待所有片段处理完成 + CompletableFuture.allOf(futures.toArray(new CompletableFuture[0])).join(); + // 处理任务完成后的状态更新 + unStructTaskDO.setStatus(ExtTaskStatus.EXECUTED.getValue()); + extUnstructTaskMapper.updateExtUnstructTask(unStructTaskDO); + extTaskLogService.endInvoke(logId, ExtLogStatusEnum.SUCCESS, ""); + } catch (Exception e) { + unStructTaskDO.setStatus(ExtTaskStatus.ERROR.getValue()); + extUnstructTaskMapper.updateExtUnstructTask(unStructTaskDO); + extTaskLogService.recordStep(logId, e.getMessage()); + extTaskLogService.endInvoke(logId, ExtLogStatusEnum.FAIL, e.getMessage()); + } finally { + if (getCurrentConcurrentCount() <= 0) { + executor.shutdown(); + } + } + }); log.info("---------- 执行抽取任务结束 -------------"); } @@ -440,7 +479,6 @@ public class ExtUnstructTaskServiceImpl extends ServiceImpl docRelPage = extUnstructTaskDocRelService.getExtUnstructTaskDocRelPage(docRelPageReqVO); + List taskDocRelDOList = BeanUtils.toBean(docRelPage.getRows(), ExtUnstructTaskDocRelDO.class); + + // 根据配置文件判断使用哪种方式进行抽取 + if (UnstructTypeEnums.MODEL.eq(unstructType)) { + // TODO 使用大模型抽取,开源版本暂未支持,如有需要请咨询相关管理人员 + log.warn("大模型抽取暂未支持~"); + } else { + // 使用DeepKE进行抽取 + this.execExtTask(unstructTaskDO, taskDocRelDOList, executor, logId); + } + } catch (Exception e) { + unstructTaskDO.setStatus(ExtTaskStatus.ERROR.getValue()); + extUnstructTaskMapper.updateExtUnstructTask(unstructTaskDO); + extTaskLogService.recordStep(logId, e.getMessage()); + extTaskLogService.endInvoke(logId, ExtLogStatusEnum.FAIL, e.getMessage()); + } + } + + /** + * 获取或重建线程池(核心逻辑:存在且存活则复用,否则重建) + * + * @param threadNum 配置的线程数 + * @return 可用的线程池 + */ + private ExecutorService getOrRebuildExecutor(int threadNum) { + // 双重检查锁:避免并发创建 + if (executor == null || executor.isShutdown() || executor.isTerminated()) { + synchronized (executorLock) { + if (executor == null || executor.isShutdown() || executor.isTerminated()) { + executor = new ThreadPoolExecutor( + threadNum, // 核心线程数=配置数 + threadNum, // 固定线程池,最大=核心 + 60L, TimeUnit.SECONDS, // 空闲线程存活时间(固定线程池可设长一点) + new LinkedBlockingQueue<>(1000), // 有界队列,避免OOM + new ThreadFactory() { // 自定义线程名,便于排查 + private final AtomicInteger count = new AtomicInteger(1); + + @Override + public Thread newThread(Runnable r) { + return new Thread(r, "ext-task-thread-" + count.getAndIncrement()); + } + }, + new ThreadPoolExecutor.CallerRunsPolicy() // 拒绝策略:调用方执行,避免任务丢失 + ); + } + } + } + return executor; + } + + /** + * 获取当前并发数 + * + * @author wamg + */ + private int getCurrentConcurrentCount() { + String countStr = redisService.get("ext_run_model_count"); + return StringUtils.isEmpty(countStr) ? 0 : Integer.parseInt(countStr); + } + + /** + * 当前并发数减一 + */ + private void subCurrentConcurrentCount() { + int currentConcurrentCount = getCurrentConcurrentCount(); + if (currentConcurrentCount < 1) { + return; + } + String count = String.valueOf(currentConcurrentCount - 1); + redisService.set("ext_run_model_count", count); + } } diff --git a/qknow-ui/src/api/ext/extTaskLog/extTaskLog.js b/qknow-ui/src/api/ext/extTaskLog/extTaskLog.js new file mode 100644 index 0000000000000000000000000000000000000000..845f84555245f8ef03c3a8df4d6d66d0c5dab522 --- /dev/null +++ b/qknow-ui/src/api/ext/extTaskLog/extTaskLog.js @@ -0,0 +1,83 @@ +/* + * Copyright (c) 2026 Jiangsu Qiantong Technology Co., Ltd. + * * + * Software Name: qKnow Knowledge Platform (Business Edition) + * Software Copyright Registration No. 15980140 + * * + * [RIGHTS AND LICENSE STATEMENT] + * This file contains non-public commercial source code of which Jiangsu Qiantong + * Technology Co., Ltd. lawfully possesses complete intellectual property rights. + * * + * Access and use are limited to entities or individuals who have signed a valid + * commercial license agreement, within the scope stipulated in the agreement. + * The "accessibility" of this source code is premised on lawful authorization + * and does not constitute any form of transfer of intellectual property rights + * or implied licensing. + * * + * [PROHIBITIONS] + * Unless explicitly agreed in the license agreement, the following acts in any + * form are strictly prohibited: + * 1. Copying, disseminating, disclosing, selling, renting, or redistributing + * this source code; + * 2. Providing the software's functionality to third parties via SaaS, PaaS, + * cloud hosting, or other means; + * 3. Using this software or its derivative versions to develop products that + * compete with the Right Holder; + * 4. Providing or displaying this source code or related technical information + * to unauthorized third parties; + * 5. Tampering with, circumventing, or destroying copyright notices, license + * verifications, or other technical protection measures. + * * + * [LEGAL LIABILITY] + * Any unauthorized use constitutes an infringement of trade secrets and + * intellectual property rights. + * * + * The Right Holder will strictly pursue liability for breach of contract and + * infringement in accordance with the commercial agreement and laws such as + * the "Copyright Law of the People's Republic of China" and the "Anti-Unfair + * Competition Law". + * * + * ============================================================================ + * * + * Copyright (c) 2026 江苏千桐科技有限公司 + * * + * 软件名称:qKnow 知识平台(商业版) | 软著登字第15980140号 + * * + * 【权利与授权声明】 + * 本文件属于江苏千桐科技有限公司依法享有完全知识产权的非公开商业源代码。 + * 仅限已签署有效商业授权合同的单位或个人在约定范围内查阅和使用。 + * 源代码的“可访问性”均以合法授权为前提,不构成任何形式的知识产权转让或默示授权。 + * * + * 【禁止事项】 + * 除授权合同明确约定外,严禁任何形式的: + * 1. 复制、传播、披露、出售、出租或再分发本源代码; + * 2. 通过 SaaS、PaaS、云托管等方式向第三方提供本软件功能; + * 3. 将本软件或其衍生版本用于开发与权利人构成竞争的产品; + * 4. 向未授权第三方提供或展示本源代码或相关技术信息; + * 5. 篡改、规避或破坏版权标识、授权校验及其他技术保护措施。 + * * + * 【法律责任】 + * 任何未经授权的利用行为,均构成对商业秘密及知识产权的侵害。 + * 权利人将依据商业合同及《中华人民共和国著作权法》《反不正当竞争法》 + * 等法律法规,严厉追究违约与侵权责任。 + */ + +import request from '@/utils/request' + +// 查询抽取任务执行日志列表 +export function listTaskLog(query) { + return request({ + url: '/ext/taskLog/list', + method: 'get', + params: query + }) +} + +// 查询抽取任务执行日志详细 +export function getDetailPage(query) { + return request({ + url: '/ext/taskLog/detail/page', + method: 'get', + params: query + }) +} diff --git a/qknow-ui/src/views/ext/extTaskLog/index.vue b/qknow-ui/src/views/ext/extTaskLog/index.vue new file mode 100644 index 0000000000000000000000000000000000000000..a3c5f922356dda836f5bd049464028f62ccc5b4d --- /dev/null +++ b/qknow-ui/src/views/ext/extTaskLog/index.vue @@ -0,0 +1,430 @@ + + + + + + + \ No newline at end of file diff --git a/qknow-ui/src/views/ext/extTaskLog/taskLogDialog.vue b/qknow-ui/src/views/ext/extTaskLog/taskLogDialog.vue new file mode 100644 index 0000000000000000000000000000000000000000..71ff0cfe902ae280685227194007c7e81c6c936e --- /dev/null +++ b/qknow-ui/src/views/ext/extTaskLog/taskLogDialog.vue @@ -0,0 +1,409 @@ + + + + + + + diff --git a/qknow-ui/src/views/ext/extUnstructTask/index.vue b/qknow-ui/src/views/ext/extUnstructTask/index.vue index 2ff0ea58e66e5e015eca155d94883abd433e2034..fb56e4b680e9c9433cb5764f824f0cc985a829c0 100644 --- a/qknow-ui/src/views/ext/extUnstructTask/index.vue +++ b/qknow-ui/src/views/ext/extUnstructTask/index.vue @@ -154,21 +154,41 @@ {{ scope.row.remark || '-' }} - @@ -289,6 +309,7 @@ @confirm="selectConfirmData" > + @@ -304,6 +325,7 @@ import { getExtSchemaAllList } from "@/api/ext/extSchema/schema"; import {getToken} from "@/utils/auth.js"; import moment from 'moment'; + import TaskLogDialog from "@/views/ext/extTaskLog/taskLogDialog.vue"; //选择文件 多选 import SelectDoc from "@/views/kmc/kmcDocument/selection/DocumentMultiple.vue"; import RelationMultiple from "@/views/ext/extSchemaRelation/selection/relationMultiple.vue"; @@ -352,6 +374,7 @@ const docList = ref(null) const docTitles = ref(null) const docIds = ref(null) + const logDialog = ref(''); /*** 用户导入参数 */ const upload = reactive({ @@ -688,11 +711,15 @@ proxy.$modal.msgError("任务执行中"); return } + if(row.status == 4){ + proxy.$modal.msgError("任务已在队列中"); + return + } proxy.$modal.confirm('是否确认执行任务名称为"' + row.name + '"的数据项?').then(function () { }).then(() => { executeExtraction({id: row.id}).then(response => { console.log('---执行抽取-------', response) - proxy.$modal.msgSuccess("操作成功,执行中"); + proxy.$modal.msgSuccess(response.msg); getList(); }).catch(error => { }); @@ -775,4 +802,9 @@ } } + function showLogDialog(row) { + // 1,代表非结构化抽取 + logDialog.value.show(row.id, 1); + } + diff --git a/sql/mysql/change.sql b/sql/mysql/change.sql index 329fd4c4c571c3f19e2d8c7c6a95ccfc73caa353..012660b636332998228ffa55df7c218f9637c5c5 100644 --- a/sql/mysql/change.sql +++ b/sql/mysql/change.sql @@ -70,3 +70,59 @@ CREATE TABLE ext_relation_mapping_middle( insert into system_dict_type values (16, '导入表映射状态', 'ext_mapping_status', '0', '小桐', sysdate(), '', NULL, '导入表映射状态'); insert into system_dict_data values (50, 0, '未映射', '0', 'ext_mapping_status', NULL, 'warning', 'N', '0', '小桐', sysdate(), '小桐', sysdate(), NULL); insert into system_dict_data values (51, 1, '已映射', '1', 'ext_mapping_status', NULL, 'success', 'N', '0', '小桐', sysdate(), '', NULL, NULL); + + +# 2026-01-29 +DROP TABLE IF EXISTS ext_task_log; +CREATE TABLE ext_task_log( + `id` BIGINT AUTO_INCREMENT COMMENT 'ID' , + `workspace_id` BIGINT NOT NULL COMMENT '工作区id' , + `task_id` BIGINT NOT NULL COMMENT '任务id;' , + `task_type` TINYINT(4) UNSIGNED NOT NULL COMMENT '任务类型;0:结构化;1:非结构化' , + `task_name` VARCHAR(128) NOT NULL COMMENT '任务名称' , + `status` TINYINT(4) UNSIGNED COMMENT '状态;1成功,0失败' , + `error_msg` VARCHAR(2000) COMMENT '错误消息;' , + `start_time` DATETIME COMMENT '执行开始时间' , + `end_time` DATETIME COMMENT '执行结束时间' , + `valid_flag` TINYINT(1) NOT NULL DEFAULT 1 COMMENT '是否有效;0:无效,1:有效' , + `del_flag` TINYINT(1) NOT NULL DEFAULT 0 COMMENT '删除标志;1:已删除,0:未删除' , + `create_by` VARCHAR(32) COMMENT '创建人' , + `creator_id` BIGINT COMMENT '创建人id' , + `create_time` DATETIME DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间' , + `update_by` VARCHAR(32) COMMENT '更新人' , + `updater_id` BIGINT COMMENT '更新人id' , + `update_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '更新时间' , + `remark` VARCHAR(512) COMMENT '备注' , + PRIMARY KEY (id) +) COMMENT = '抽取任务执行日志'; +DROP TABLE IF EXISTS ext_task_log_detail; +CREATE TABLE ext_task_log_detail( + `id` BIGINT AUTO_INCREMENT COMMENT 'ID;' , + `workspace_id` BIGINT NOT NULL DEFAULT 1001 COMMENT '工作区id' , + `log_id` BIGINT NOT NULL COMMENT '执行日志id' , + `step` VARCHAR(2000) NOT NULL COMMENT '任务执行步骤' , + `valid_flag` TINYINT(1) NOT NULL DEFAULT 1 COMMENT '是否有效;0:无效,1:有效' , + `del_flag` TINYINT(1) NOT NULL DEFAULT 0 COMMENT '删除标志;1:已删除,0:未删除' , + `create_by` VARCHAR(32) COMMENT '创建人' , + `creator_id` BIGINT COMMENT '创建人id' , + `create_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间' , + `update_by` VARCHAR(32) COMMENT '更新人' , + `updater_id` BIGINT COMMENT '更新人id' , + `update_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '更新时间' , + `remark` VARCHAR(512) COMMENT '备注' , + PRIMARY KEY (id) +) COMMENT = '抽取任务执行日志详情'; + +insert into system_menu values (2054, '非结构化抽取任务日志', 2030, 8, '', NULL, NULL, '', 1, 0, 'F', '0', '0', 'ext:extUnstructTask:unstructtask:taskLog', '#', '小桐', sysdate(), '小桐', sysdate(), ''); +insert into system_menu values (2055, '抽取日志', 2015, 5, 'extTaskLog', 'ext/extTaskLog/index', NULL, '', 1, 0, 'C', '0', '0', 'ext:extTasklog:tasklog:list', '#', '小桐', sysdate(), '小桐', sysdate(), ''); + +insert into system_dict_type values (17, '知识抽取日志状态', 'ext_log_status', '0', '小桐', sysdate(), '', NULL, '知识抽取日志状态'); +insert into system_dict_type values (18, '知识抽取任务类型', 'ext_task_type', '0', '小桐', sysdate(), '', NULL, '知识抽取任务类型'); + +insert into system_dict_data values (52, 1, '失败', '0', 'ext_log_status', NULL, 'danger', 'N', '0', '小桐', sysdate(), '', NULL, NULL); +insert into system_dict_data values (53, 2, '成功', '1', 'ext_log_status', NULL, 'success', 'N', '0', '小桐', sysdate(), '', NULL, NULL); +insert into system_dict_data values (54, 1, '结构化抽取', '0', 'ext_task_type', NULL, 'default', 'N', '0', '小桐', sysdate(), '', NULL, NULL); +insert into system_dict_data values (55, 2, '非结构化抽取', '1', 'ext_task_type', NULL, 'default', 'N', '0', '小桐', sysdate(), '', NULL, NULL); +insert into system_dict_data values (56, 1, '队列中', '4', 'ext_task_status', NULL, 'info', 'N', '0', '小桐', sysdate(), '', NULL, NULL); + +insert into system_config values(7, '非结构化抽取线程数量', 'ext.thread.concurrency', '3', 'Y', '小桐', sysdate(), '', NULL, '最大50'); \ No newline at end of file