60 changed files with 4220 additions and 577 deletions
@ -0,0 +1,286 @@ |
|||
--- # 临时文件存储位置 避免临时文件被系统清理报错 |
|||
spring.servlet.multipart.location: /ruoyi/server/temp |
|||
|
|||
--- # 监控中心配置 |
|||
spring.boot.admin.client: |
|||
# 增加客户端开关 |
|||
enabled: true |
|||
url: http://localhost:9090/admin |
|||
instance: |
|||
service-host-type: IP |
|||
metadata: |
|||
username: ${spring.boot.admin.client.username} |
|||
userpassword: ${spring.boot.admin.client.password} |
|||
username: ruoyi |
|||
password: 123456 |
|||
server: |
|||
# 端口号 |
|||
port: 8082 |
|||
--- # snail-job 配置 |
|||
snail-job: |
|||
enabled: false |
|||
# 需要在 SnailJob 后台组管理创建对应名称的组,然后创建任务的时候选择对应的组,才能正确分派任务 |
|||
group: "ruoyi_group" |
|||
# SnailJob 接入验证令牌 详见 script/sql/snail_job.sql `sj_group_config` 表 |
|||
token: "SJ_cKqBTPzCsWA3VyuCfFoccmuIEGXjr5KT" |
|||
server: |
|||
host: 127.0.0.1 |
|||
port: 17888 |
|||
# 详见 script/sql/snail_job.sql `sj_namespace` 表 |
|||
namespace: ${spring.profiles.active} |
|||
# 随主应用端口飘逸 |
|||
port: 3${server.port} |
|||
|
|||
--- # 数据源配置 |
|||
spring: |
|||
datasource: |
|||
type: com.zaxxer.hikari.HikariDataSource |
|||
# 动态数据源文档 https://www.kancloud.cn/tracy5546/dynamic-datasource/content |
|||
dynamic: |
|||
# 性能分析插件(有性能损耗 不建议生产环境使用) |
|||
p6spy: false |
|||
# 设置默认的数据源或者数据源组,默认值即为 master |
|||
primary: master |
|||
# 严格模式 匹配不到数据源则报错 |
|||
strict: true |
|||
datasource: |
|||
# 主库数据源 |
|||
master: |
|||
type: ${spring.datasource.type} |
|||
driverClassName: com.mysql.cj.jdbc.Driver |
|||
# jdbc 所有参数配置参考 https://lionli.blog.csdn.net/article/details/122018562 |
|||
# rewriteBatchedStatements=true 批处理优化 大幅提升批量插入更新删除性能(对数据库有性能损耗 使用批量操作应考虑性能问题) |
|||
url: jdbc:mysql://localhost:3306/zaojiatest?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true |
|||
username: root |
|||
password: root |
|||
# 从库数据源 |
|||
slave: |
|||
lazy: true |
|||
type: ${spring.datasource.type} |
|||
driverClassName: com.mysql.cj.jdbc.Driver |
|||
url: jdbc:mysql://116.62.210.190:3306/ry-vue?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true |
|||
username: root |
|||
password: Guoyan83086775 |
|||
# oracle: |
|||
# type: ${spring.datasource.type} |
|||
# driverClassName: oracle.jdbc.OracleDriver |
|||
# url: jdbc:oracle:thin:@//localhost:1521/XE |
|||
# username: ROOT |
|||
# password: root |
|||
# postgres: |
|||
# type: ${spring.datasource.type} |
|||
# driverClassName: org.postgresql.Driver |
|||
# url: jdbc:postgresql://localhost:5432/postgres?useUnicode=true&characterEncoding=utf8&useSSL=true&autoReconnect=true&reWriteBatchedInserts=true |
|||
# username: root |
|||
# password: root |
|||
# sqlserver: |
|||
# type: ${spring.datasource.type} |
|||
# driverClassName: com.microsoft.sqlserver.jdbc.SQLServerDriver |
|||
# url: jdbc:sqlserver://localhost:1433;DatabaseName=tempdb;SelectMethod=cursor;encrypt=false;rewriteBatchedStatements=true |
|||
# username: SA |
|||
# password: root |
|||
hikari: |
|||
# 最大连接池数量 |
|||
maxPoolSize: 20 |
|||
# 最小空闲线程数量 |
|||
minIdle: 10 |
|||
# 配置获取连接等待超时的时间 |
|||
connectionTimeout: 30000 |
|||
# 校验超时时间 |
|||
validationTimeout: 5000 |
|||
# 空闲连接存活最大时间,默认10分钟 |
|||
idleTimeout: 600000 |
|||
# 此属性控制池中连接的最长生命周期,值0表示无限生命周期,默认30分钟 |
|||
maxLifetime: 1800000 |
|||
# 多久检查一次连接的活性 |
|||
keepaliveTime: 30000 |
|||
|
|||
--- # redis 单机配置(单机与集群只能开启一个另一个需要注释掉) |
|||
spring.data: |
|||
redis: |
|||
# 地址 |
|||
host: localhost |
|||
# 端口,默认为6379 |
|||
port: 6379 |
|||
# 数据库索引 |
|||
database: 0 |
|||
# redis 密码必须配置 |
|||
password: root |
|||
# 连接超时时间 |
|||
timeout: 10s |
|||
# 是否开启ssl |
|||
ssl.enabled: false |
|||
|
|||
# redisson 配置 |
|||
redisson: |
|||
# redis key前缀 |
|||
keyPrefix: |
|||
# 线程池数量 |
|||
threads: 16 |
|||
# Netty线程池数量 |
|||
nettyThreads: 32 |
|||
# 单节点配置 |
|||
singleServerConfig: |
|||
# 客户端名称 |
|||
clientName: ${ruoyi.name} |
|||
# 最小空闲连接数 |
|||
connectionMinimumIdleSize: 32 |
|||
# 连接池大小 |
|||
connectionPoolSize: 64 |
|||
# 连接空闲超时,单位:毫秒 |
|||
idleConnectionTimeout: 10000 |
|||
# 命令等待超时,单位:毫秒 |
|||
timeout: 3000 |
|||
# 发布和订阅连接池大小 |
|||
subscriptionConnectionPoolSize: 50 |
|||
|
|||
--- # mail 邮件发送 |
|||
mail: |
|||
enabled: false |
|||
host: smtp.163.com |
|||
port: 465 |
|||
# 是否需要用户名密码验证 |
|||
auth: true |
|||
# 发送方,遵循RFC-822标准 |
|||
from: xxx@163.com |
|||
# 用户名(注意:如果使用foxmail邮箱,此处user为qq号) |
|||
user: xxx@163.com |
|||
# 密码(注意,某些邮箱需要为SMTP服务单独设置密码,详情查看相关帮助) |
|||
pass: xxxxxxxxxx |
|||
# 使用 STARTTLS安全连接,STARTTLS是对纯文本通信协议的扩展。 |
|||
starttlsEnable: true |
|||
# 使用SSL安全连接 |
|||
sslEnable: true |
|||
# SMTP超时时长,单位毫秒,缺省值不超时 |
|||
timeout: 0 |
|||
# Socket连接超时值,单位毫秒,缺省值不超时 |
|||
connectionTimeout: 0 |
|||
|
|||
--- # sms 短信 支持 阿里云 腾讯云 云片 等等各式各样的短信服务商 |
|||
# https://sms4j.com/doc3/ 差异配置文档地址 支持单厂商多配置,可以配置多个同时使用 |
|||
sms: |
|||
# 配置源类型用于标定配置来源(interface,yaml) |
|||
config-type: yaml |
|||
# 用于标定yml中的配置是否开启短信拦截,接口配置不受此限制 |
|||
restricted: true |
|||
# 短信拦截限制单手机号每分钟最大发送,只对开启了拦截的配置有效 |
|||
minute-max: 1 |
|||
# 短信拦截限制单手机号每日最大发送量,只对开启了拦截的配置有效 |
|||
account-max: 30 |
|||
# 以下配置来自于 org.dromara.sms4j.provider.config.BaseConfig类中 |
|||
blends: |
|||
# 唯一ID 用于发送短信寻找具体配置 随便定义别用中文即可 |
|||
# 可以同时存在两个相同厂商 例如: ali1 ali2 两个不同的阿里短信账号 也可用于区分租户 |
|||
config1: |
|||
# 框架定义的厂商名称标识,标定此配置是哪个厂商,详细请看厂商标识介绍部分 |
|||
supplier: alibaba |
|||
# 有些称为accessKey有些称之为apiKey,也有称为sdkKey或者appId。 |
|||
access-key-id: 您的accessKey |
|||
# 称为accessSecret有些称之为apiSecret |
|||
access-key-secret: 您的accessKeySecret |
|||
signature: 您的短信签名 |
|||
sdk-app-id: 您的sdkAppId |
|||
config2: |
|||
# 厂商标识,标定此配置是哪个厂商,详细请看厂商标识介绍部分 |
|||
supplier: tencent |
|||
access-key-id: 您的accessKey |
|||
access-key-secret: 您的accessKeySecret |
|||
signature: 您的短信签名 |
|||
sdk-app-id: 您的sdkAppId |
|||
|
|||
--- # 三方授权 |
|||
justauth: |
|||
# 前端外网访问地址 |
|||
address: http://localhost:80 |
|||
type: |
|||
maxkey: |
|||
# maxkey 服务器地址 |
|||
# 注意 如下均配置均不需要修改 maxkey 已经内置好了数据 |
|||
server-url: http://sso.maxkey.top |
|||
client-id: 876892492581044224 |
|||
client-secret: x1Y5MTMwNzIwMjMxNTM4NDc3Mzche8 |
|||
redirect-uri: ${justauth.address}/social-callback?source=maxkey |
|||
topiam: |
|||
# topiam 服务器地址 |
|||
server-url: http://127.0.0.1:1989/api/v1/authorize/y0q************spq***********8ol |
|||
client-id: 449c4*********937************759 |
|||
client-secret: ac7***********1e0************28d |
|||
redirect-uri: ${justauth.address}/social-callback?source=topiam |
|||
scopes: [ openid, email, phone, profile ] |
|||
qq: |
|||
client-id: 10**********6 |
|||
client-secret: 1f7d08**********5b7**********29e |
|||
redirect-uri: ${justauth.address}/social-callback?source=qq |
|||
union-id: false |
|||
weibo: |
|||
client-id: 10**********6 |
|||
client-secret: 1f7d08**********5b7**********29e |
|||
redirect-uri: ${justauth.address}/social-callback?source=weibo |
|||
gitee: |
|||
client-id: 91436b7940090d09c72c7daf85b959cfd5f215d67eea73acbf61b6b590751a98 |
|||
client-secret: 02c6fcfd70342980cd8dd2f2c06c1a350645d76c754d7a264c4e125f9ba915ac |
|||
redirect-uri: ${justauth.address}/social-callback?source=gitee |
|||
dingtalk: |
|||
client-id: 10**********6 |
|||
client-secret: 1f7d08**********5b7**********29e |
|||
redirect-uri: ${justauth.address}/social-callback?source=dingtalk |
|||
baidu: |
|||
client-id: 10**********6 |
|||
client-secret: 1f7d08**********5b7**********29e |
|||
redirect-uri: ${justauth.address}/social-callback?source=baidu |
|||
csdn: |
|||
client-id: 10**********6 |
|||
client-secret: 1f7d08**********5b7**********29e |
|||
redirect-uri: ${justauth.address}/social-callback?source=csdn |
|||
coding: |
|||
client-id: 10**********6 |
|||
client-secret: 1f7d08**********5b7**********29e |
|||
redirect-uri: ${justauth.address}/social-callback?source=coding |
|||
coding-group-name: xx |
|||
oschina: |
|||
client-id: 10**********6 |
|||
client-secret: 1f7d08**********5b7**********29e |
|||
redirect-uri: ${justauth.address}/social-callback?source=oschina |
|||
alipay_wallet: |
|||
client-id: 10**********6 |
|||
client-secret: 1f7d08**********5b7**********29e |
|||
redirect-uri: ${justauth.address}/social-callback?source=alipay_wallet |
|||
alipay-public-key: MIIB**************DAQAB |
|||
wechat_open: |
|||
client-id: 10**********6 |
|||
client-secret: 1f7d08**********5b7**********29e |
|||
redirect-uri: ${justauth.address}/social-callback?source=wechat_open |
|||
wechat_mp: |
|||
client-id: 10**********6 |
|||
client-secret: 1f7d08**********5b7**********29e |
|||
redirect-uri: ${justauth.address}/social-callback?source=wechat_mp |
|||
wechat_enterprise: |
|||
client-id: 10**********6 |
|||
client-secret: 1f7d08**********5b7**********29e |
|||
redirect-uri: ${justauth.address}/social-callback?source=wechat_enterprise |
|||
agent-id: 1000002 |
|||
gitlab: |
|||
client-id: 10**********6 |
|||
client-secret: 1f7d08**********5b7**********29e |
|||
redirect-uri: ${justauth.address}/social-callback?source=gitlab |
|||
#elasticsearch: |
|||
# # es host ip 地址(集群),多个以","间隔 |
|||
# uris: localhost:9200 |
|||
# username: elastic |
|||
# password: 123456789 |
|||
# # es 请求方式 |
|||
# scheme: http |
|||
# # es 连接超时时间(ms) |
|||
# connectTimeOut: 1000 |
|||
# # es socket 连接超时时间(ms) |
|||
# socketTimeOut: 30000 |
|||
# # es 请求超时时间(ms) |
|||
# connectionRequestTimeOut: 500 |
|||
# # es 最大连接数 |
|||
# maxConnectNum: 100 |
|||
# # es 每个路由的最大连接数 |
|||
# maxConnectNumPerRoute: 100 |
|||
chat: |
|||
# 聊天机器人配置 |
|||
filePath: /usr/app/tempFile |
|||
chatUrl: http://183.136.156.2:50003 |
@ -0,0 +1,21 @@ |
|||
package org.dromara.common.sse.dto; |
|||
|
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* Created by WeiRan on 2023.03.20 19:19 |
|||
*/ |
|||
@Data |
|||
public class ChatGlmDto { |
|||
|
|||
private String messageId; |
|||
|
|||
private Object context; |
|||
|
|||
private String requestTaskNo; |
|||
|
|||
private boolean incremental = true; |
|||
|
|||
private boolean notSensitive = true; |
|||
|
|||
} |
@ -0,0 +1,33 @@ |
|||
package org.dromara.common.sse.utils; |
|||
|
|||
import okhttp3.MediaType; |
|||
import okhttp3.OkHttpClient; |
|||
import okhttp3.Request; |
|||
import okhttp3.RequestBody; |
|||
import okhttp3.sse.EventSource; |
|||
import okhttp3.sse.EventSources; |
|||
import org.dromara.common.sse.listener.SSEListener; |
|||
|
|||
import java.util.concurrent.TimeUnit; |
|||
|
|||
public class ExecuteSSEUtil { |
|||
private static OkHttpClient okHttpClient = new OkHttpClient.Builder()//构建器
|
|||
.connectTimeout(600, TimeUnit.SECONDS)//连接超时
|
|||
.writeTimeout(600, TimeUnit.SECONDS)//写入超时
|
|||
.readTimeout(600, TimeUnit.SECONDS)//读取超时
|
|||
.build(); |
|||
|
|||
|
|||
public static void executeSSE(String url, SSEListener eventSourceListener, String chatGlm) throws Exception { |
|||
RequestBody formBody = RequestBody.create(chatGlm, MediaType.parse("application/json; charset=utf-8")); |
|||
Request.Builder requestBuilder = new Request.Builder(); |
|||
Request request = requestBuilder.url(url).get().build(); |
|||
okHttpClient.dispatcher().setMaxRequestsPerHost(200); |
|||
okHttpClient.dispatcher().setMaxRequests(200); |
|||
EventSource.Factory factory = EventSources.createFactory(okHttpClient); |
|||
//创建事件
|
|||
factory.newEventSource(request, eventSourceListener); |
|||
eventSourceListener.getCountDownLatch().await(); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,133 @@ |
|||
package org.dromara.productManagement.controller; |
|||
|
|||
import jakarta.servlet.http.HttpServletResponse; |
|||
import lombok.RequiredArgsConstructor; |
|||
import org.dromara.common.core.domain.R; |
|||
import org.dromara.common.satoken.utils.LoginHelper; |
|||
import org.dromara.productManagement.service.IDocAiService; |
|||
import org.springframework.http.MediaType; |
|||
import org.springframework.validation.annotation.Validated; |
|||
import org.springframework.web.bind.annotation.*; |
|||
import org.springframework.web.multipart.MultipartFile; |
|||
|
|||
import java.io.IOException; |
|||
|
|||
/** |
|||
* DocAiController类,处理与文档AI相关的HTTP请求。 |
|||
*/ |
|||
@RequiredArgsConstructor |
|||
@RestController |
|||
@RequestMapping("/productManagement/docAi1") |
|||
@Validated |
|||
public class DocAiController { |
|||
|
|||
private final IDocAiService docAiService; |
|||
|
|||
|
|||
/** |
|||
* SSE调用接口 |
|||
* @param originalFilename 原始文件名 |
|||
* @param context 请求上下文 |
|||
* @param rp HttpServletResponse对象 |
|||
* @throws Exception 异常 |
|||
*/ |
|||
@PostMapping(value = "/sse-invoke", consumes = MediaType.MULTIPART_FORM_DATA_VALUE, produces = "text/event-stream;charset=UTF-8") |
|||
public void sse(@RequestPart(name = "originalFilename") String originalFilename, @RequestPart("content") String context, HttpServletResponse rp) throws Exception { |
|||
docAiService.executeSSE("/stream", originalFilename, context, rp); |
|||
} |
|||
|
|||
/** |
|||
* 检查地名接口 |
|||
* @param originalFilename 原始文件名 |
|||
* @param context 请求上下文 |
|||
* @param rp HttpServletResponse对象 |
|||
* @throws Exception 异常 |
|||
*/ |
|||
@PostMapping(value = "/sse/checkPlaceName", consumes = MediaType.MULTIPART_FORM_DATA_VALUE, produces = "text/event-stream;charset=UTF-8") |
|||
public void checkPlaceName(@RequestPart(name = "originalFilename") String originalFilename, @RequestPart("content") String context, HttpServletResponse rp) throws Exception { |
|||
docAiService.executeSSE("/sse/checkPlaceName", originalFilename, context, rp); |
|||
} |
|||
|
|||
/** |
|||
* 检查重复文本接口 |
|||
* @param originalFilename 原始文件名 |
|||
* @param context 请求上下文 |
|||
* @param rp HttpServletResponse对象 |
|||
* @throws Exception 异常 |
|||
*/ |
|||
@PostMapping(value = "/sse/checkRepeatText", consumes = MediaType.MULTIPART_FORM_DATA_VALUE, produces = "text/event-stream;charset=UTF-8") |
|||
public void checkRepeatText(@RequestPart(name = "originalFilename") String originalFilename, @RequestPart("content") String context, HttpServletResponse rp) throws Exception { |
|||
docAiService.executeSSE("/sse/checkRepeatText", originalFilename, context, rp); |
|||
} |
|||
|
|||
/** |
|||
* 检查公司名称接口 |
|||
* @param originalFilename 原始文件名 |
|||
* @param context 请求上下文 |
|||
* @param rp HttpServletResponse对象 |
|||
* @throws Exception 异常 |
|||
*/ |
|||
@PostMapping(value = "/sse/checkCompanyName", consumes = MediaType.MULTIPART_FORM_DATA_VALUE, produces = "text/event-stream;charset=UTF-8") |
|||
public void checkCompanyName(@RequestPart(name = "originalFilename") String originalFilename, @RequestPart("content") String context, HttpServletResponse rp) throws Exception { |
|||
docAiService.executeSSE("/sse/checkCompanyName", originalFilename, context, rp); |
|||
} |
|||
|
|||
/** |
|||
* 检查文档错误接口 |
|||
* @param originalFilename 原始文件名 |
|||
* @param context 请求上下文 |
|||
* @param rp HttpServletResponse对象 |
|||
* @throws Exception 异常 |
|||
*/ |
|||
@PostMapping(value = "/sse/checkDocumentError", consumes = MediaType.MULTIPART_FORM_DATA_VALUE, produces = "text/event-stream;charset=UTF-8") |
|||
public void checkDocumentError(@RequestPart(name = "originalFilename") String originalFilename, @RequestPart("content") String context, HttpServletResponse rp) throws Exception { |
|||
docAiService.executeSSE("/sse/checkDocumentErrorWeb", originalFilename, context, rp); |
|||
} |
|||
|
|||
/** |
|||
* 检查标题名称接口 |
|||
* @param originalFilename 原始文件名 |
|||
* @param context 请求上下文 |
|||
* @param rp HttpServletResponse对象 |
|||
* @throws Exception 异常 |
|||
*/ |
|||
@PostMapping(value = "/sse/checkTitleName", consumes = MediaType.MULTIPART_FORM_DATA_VALUE, produces = "text/event-stream;charset=UTF-8") |
|||
public void checkTitleName(@RequestPart(name = "originalFilename") String originalFilename, @RequestPart("content") String context, HttpServletResponse rp) throws Exception { |
|||
docAiService.executeSSE("/sse/checkTitleName", originalFilename, context, rp); |
|||
} |
|||
|
|||
/** |
|||
* 文档评估接口 |
|||
* @param originalFilename 原始文件名 |
|||
* @param context 请求上下文 |
|||
* @param rp HttpServletResponse对象 |
|||
* @throws Exception 异常 |
|||
*/ |
|||
@PostMapping(value = "/sse/documentEvaluate", consumes = MediaType.MULTIPART_FORM_DATA_VALUE, produces = "text/event-stream;charset=UTF-8") |
|||
public void documentEvaluate(@RequestPart(name = "originalFilename", required = false) String originalFilename, @RequestPart("content") String context, HttpServletResponse rp) throws Exception { |
|||
docAiService.executeSSE("/sse/documentEvaluate", originalFilename, context, rp); |
|||
} |
|||
|
|||
/** |
|||
* 获取日志接口 |
|||
* @param rp HttpServletResponse对象 |
|||
* @throws Exception 异常 |
|||
*/ |
|||
@GetMapping(value = "/sse/getLog", produces = "text/event-stream;charset=UTF-8") |
|||
public void getLog(HttpServletResponse rp) throws Exception { |
|||
docAiService.getLog(rp); |
|||
} |
|||
|
|||
/** |
|||
* 上传文件接口 |
|||
* @param file 上传的文件 |
|||
* @param originalFilename 原始文件名 |
|||
* @return 上传结果 |
|||
* @throws IOException IO异常 |
|||
* @throws InterruptedException 中断异常 |
|||
*/ |
|||
@PostMapping(value = "/sse/upload", consumes = MediaType.MULTIPART_FORM_DATA_VALUE) |
|||
public R<String> uploadFile(@RequestPart(name = "fileInfo") MultipartFile file, @RequestPart(name = "originalFilename") String originalFilename) throws IOException, InterruptedException { |
|||
return docAiService.uploadFile(file, originalFilename); |
|||
} |
|||
} |
@ -0,0 +1,115 @@ |
|||
package org.dromara.productManagement.controller; |
|||
|
|||
import java.util.List; |
|||
|
|||
import lombok.RequiredArgsConstructor; |
|||
import jakarta.servlet.http.HttpServletResponse; |
|||
import jakarta.validation.constraints.*; |
|||
import cn.dev33.satoken.annotation.SaCheckPermission; |
|||
import org.springframework.web.bind.annotation.*; |
|||
import org.springframework.validation.annotation.Validated; |
|||
import org.dromara.common.idempotent.annotation.RepeatSubmit; |
|||
import org.dromara.common.log.annotation.Log; |
|||
import org.dromara.common.web.core.BaseController; |
|||
import org.dromara.common.mybatis.core.page.PageQuery; |
|||
import org.dromara.common.core.domain.R; |
|||
import org.dromara.common.core.validate.AddGroup; |
|||
import org.dromara.common.core.validate.EditGroup; |
|||
import org.dromara.common.log.enums.BusinessType; |
|||
import org.dromara.common.excel.utils.ExcelUtil; |
|||
import org.dromara.productManagement.domain.vo.DocumentTaskResultsVo; |
|||
import org.dromara.productManagement.domain.bo.DocumentTaskResultsBo; |
|||
import org.dromara.productManagement.service.IDocumentTaskResultsService; |
|||
import org.dromara.common.mybatis.core.page.TableDataInfo; |
|||
|
|||
/** |
|||
* 文档任务结果 |
|||
* |
|||
* @author Lion Li |
|||
* @date 2024-10-23 |
|||
*/ |
|||
@Validated |
|||
@RequiredArgsConstructor |
|||
@RestController |
|||
@RequestMapping("/productManagement/DocumentTaskResults") |
|||
public class DocumentTaskResultsController extends BaseController { |
|||
|
|||
private final IDocumentTaskResultsService documentTaskResultsService; |
|||
|
|||
/** |
|||
* 查询文档任务结果列表 |
|||
*/ |
|||
// @SaCheckPermission("productManagement:DocumentTaskResults:list")
|
|||
@GetMapping("/list") |
|||
public TableDataInfo<DocumentTaskResultsVo> list(DocumentTaskResultsBo bo, PageQuery pageQuery) { |
|||
return documentTaskResultsService.queryPageList(bo, pageQuery); |
|||
} |
|||
|
|||
/** |
|||
* 导出文档任务结果列表 |
|||
*/ |
|||
// @SaCheckPermission("productManagement:DocumentTaskResults:export")
|
|||
@Log(title = "文档任务结果", businessType = BusinessType.EXPORT) |
|||
@PostMapping("/export") |
|||
public void export(DocumentTaskResultsBo bo, HttpServletResponse response) { |
|||
List<DocumentTaskResultsVo> list = documentTaskResultsService.queryList(bo); |
|||
ExcelUtil.exportExcel(list, "文档任务结果", DocumentTaskResultsVo.class, response); |
|||
} |
|||
|
|||
/** |
|||
* 获取文档任务结果详细信息 |
|||
* |
|||
* @param id 主键 |
|||
*/ |
|||
// @SaCheckPermission("productManagement:DocumentTaskResults:query")
|
|||
@GetMapping("/{id}") |
|||
public R<DocumentTaskResultsVo> getInfo(@NotNull(message = "主键不能为空") |
|||
@PathVariable String id) { |
|||
return R.ok(documentTaskResultsService.queryById(id)); |
|||
} |
|||
/** |
|||
* 根据任务id获取文档任务结果详细信息 |
|||
* |
|||
* @param id 任务id |
|||
*/ |
|||
// @SaCheckPermission("productManagement:DocumentTaskResults:query")
|
|||
@GetMapping("/task/{id}") |
|||
public R<DocumentTaskResultsVo> getInfobyTaskId(@NotNull(message = "主键不能为空") |
|||
@PathVariable String id) { |
|||
return R.ok(documentTaskResultsService.queryByTaskId(id)); |
|||
} |
|||
/** |
|||
* 新增文档任务结果 |
|||
*/ |
|||
// @SaCheckPermission("productManagement:DocumentTaskResults:add")
|
|||
@Log(title = "文档任务结果", businessType = BusinessType.INSERT) |
|||
@RepeatSubmit() |
|||
@PostMapping() |
|||
public R<Void> add(@Validated(AddGroup.class) @RequestBody DocumentTaskResultsBo bo) { |
|||
return toAjax(documentTaskResultsService.insertByBo(bo)); |
|||
} |
|||
|
|||
/** |
|||
* 修改文档任务结果 |
|||
*/ |
|||
// @SaCheckPermission("productManagement:DocumentTaskResults:edit")
|
|||
@Log(title = "文档任务结果", businessType = BusinessType.UPDATE) |
|||
@RepeatSubmit() |
|||
@PutMapping() |
|||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody DocumentTaskResultsBo bo) { |
|||
return toAjax(documentTaskResultsService.updateByBo(bo)); |
|||
} |
|||
|
|||
/** |
|||
* 删除文档任务结果 |
|||
* |
|||
* @param ids 主键串 |
|||
*/ |
|||
// @SaCheckPermission("productManagement:DocumentTaskResults:remove")
|
|||
@Log(title = "文档任务结果", businessType = BusinessType.DELETE) |
|||
@DeleteMapping("/{ids}") |
|||
public R<Void> remove(@NotEmpty(message = "主键不能为空") |
|||
@PathVariable String[] ids) { |
|||
return toAjax(documentTaskResultsService.deleteWithValidByIds(List.of(ids), true)); |
|||
} |
|||
} |
@ -0,0 +1,112 @@ |
|||
package org.dromara.productManagement.controller; |
|||
|
|||
import java.io.IOException; |
|||
import java.util.List; |
|||
|
|||
import lombok.RequiredArgsConstructor; |
|||
import jakarta.servlet.http.HttpServletResponse; |
|||
import jakarta.validation.constraints.*; |
|||
import cn.dev33.satoken.annotation.SaCheckPermission; |
|||
import org.dromara.system.service.ISysOssService; |
|||
import org.springframework.web.bind.annotation.*; |
|||
import org.springframework.validation.annotation.Validated; |
|||
import org.dromara.common.idempotent.annotation.RepeatSubmit; |
|||
import org.dromara.common.log.annotation.Log; |
|||
import org.dromara.common.web.core.BaseController; |
|||
import org.dromara.common.mybatis.core.page.PageQuery; |
|||
import org.dromara.common.core.domain.R; |
|||
import org.dromara.common.core.validate.AddGroup; |
|||
import org.dromara.common.core.validate.EditGroup; |
|||
import org.dromara.common.log.enums.BusinessType; |
|||
import org.dromara.common.excel.utils.ExcelUtil; |
|||
import org.dromara.productManagement.domain.vo.DocumentTasksVo; |
|||
import org.dromara.productManagement.domain.bo.DocumentTasksBo; |
|||
import org.dromara.productManagement.service.IDocumentTasksService; |
|||
import org.dromara.common.mybatis.core.page.TableDataInfo; |
|||
|
|||
/** |
|||
* 文档任务 |
|||
* |
|||
* @author Lion Li |
|||
* @date 2024-10-22 |
|||
*/ |
|||
@Validated |
|||
@RequiredArgsConstructor |
|||
@RestController |
|||
@RequestMapping("/productManagement/DocumentTasks") |
|||
public class DocumentTasksController extends BaseController { |
|||
|
|||
private final IDocumentTasksService documentTasksService; |
|||
|
|||
|
|||
/** |
|||
* 查询文档任务列表 |
|||
*/ |
|||
// @SaCheckPermission("productManagement:DocumentTasks:list")
|
|||
@GetMapping("/list") |
|||
public TableDataInfo<DocumentTasksVo> list(DocumentTasksBo bo, PageQuery pageQuery) { |
|||
return documentTasksService.queryPageList(bo, pageQuery); |
|||
} |
|||
|
|||
/** |
|||
* 导出文档任务列表 |
|||
*/ |
|||
// @SaCheckPermission("productManagement:DocumentTasks:export")
|
|||
@Log(title = "文档任务", businessType = BusinessType.EXPORT) |
|||
@PostMapping("/export") |
|||
public void export(DocumentTasksBo bo, HttpServletResponse response) { |
|||
List<DocumentTasksVo> list = documentTasksService.queryList(bo); |
|||
ExcelUtil.exportExcel(list, "文档任务", DocumentTasksVo.class, response); |
|||
} |
|||
|
|||
/** |
|||
* 获取文档任务详细信息 |
|||
* |
|||
* @param id 主键 |
|||
*/ |
|||
// @SaCheckPermission("productManagement:DocumentTasks:query")
|
|||
@GetMapping("/{id}") |
|||
public R<DocumentTasksVo> getInfo(@NotNull(message = "主键不能为空") |
|||
@PathVariable Long id) { |
|||
return R.ok(documentTasksService.queryById(id)); |
|||
} |
|||
|
|||
/** |
|||
* 新增文档任务 |
|||
*/ |
|||
// @SaCheckPermission("productManagement:DocumentTasks:add")
|
|||
@Log(title = "文档任务", businessType = BusinessType.INSERT) |
|||
@RepeatSubmit() |
|||
@PostMapping() |
|||
public R<Void> add(@Validated(AddGroup.class) @RequestBody DocumentTasksBo bo) throws IOException, InterruptedException { |
|||
return toAjax(documentTasksService.insertByBo(bo)); |
|||
} |
|||
|
|||
/** |
|||
* 修改文档任务 |
|||
*/ |
|||
// @SaCheckPermission("productManagement:DocumentTasks:edit")
|
|||
@Log(title = "文档任务", businessType = BusinessType.UPDATE) |
|||
@RepeatSubmit() |
|||
@PutMapping() |
|||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody DocumentTasksBo bo) { |
|||
return toAjax(documentTasksService.updateByBo(bo)); |
|||
} |
|||
|
|||
/** |
|||
* 删除文档任务 |
|||
* |
|||
* @param ids 主键串 |
|||
*/ |
|||
// @SaCheckPermission("productManagement:DocumentTasks:remove")
|
|||
@Log(title = "文档任务", businessType = BusinessType.DELETE) |
|||
@DeleteMapping("/{ids}") |
|||
public R<Void> remove(@NotEmpty(message = "主键不能为空") |
|||
@PathVariable Long[] ids) { |
|||
return toAjax(documentTasksService.deleteWithValidByIds(List.of(ids), true)); |
|||
} |
|||
@PutMapping("/stopTask/{id}") |
|||
public R<Void> stop(@NotNull(message = "主键不能为空") @PathVariable Long id) { |
|||
return toAjax(documentTasksService.stopTask(id)); |
|||
} |
|||
} |
@ -0,0 +1,125 @@ |
|||
package org.dromara.productManagement.controller; |
|||
|
|||
import java.util.List; |
|||
|
|||
import lombok.RequiredArgsConstructor; |
|||
import jakarta.servlet.http.HttpServletResponse; |
|||
import jakarta.validation.constraints.*; |
|||
import cn.dev33.satoken.annotation.SaCheckPermission; |
|||
import org.dromara.common.satoken.utils.LoginHelper; |
|||
import org.dromara.system.domain.vo.SysUserVo; |
|||
import org.springframework.web.bind.annotation.*; |
|||
import org.springframework.validation.annotation.Validated; |
|||
import org.dromara.common.idempotent.annotation.RepeatSubmit; |
|||
import org.dromara.common.log.annotation.Log; |
|||
import org.dromara.common.web.core.BaseController; |
|||
import org.dromara.common.mybatis.core.page.PageQuery; |
|||
import org.dromara.common.core.domain.R; |
|||
import org.dromara.common.core.validate.AddGroup; |
|||
import org.dromara.common.core.validate.EditGroup; |
|||
import org.dromara.common.log.enums.BusinessType; |
|||
import org.dromara.common.excel.utils.ExcelUtil; |
|||
import org.dromara.productManagement.domain.vo.DocumentTasksPermissionsVo; |
|||
import org.dromara.productManagement.domain.bo.DocumentTasksPermissionsBo; |
|||
import org.dromara.productManagement.service.IDocumentTasksPermissionsService; |
|||
import org.dromara.common.mybatis.core.page.TableDataInfo; |
|||
|
|||
/** |
|||
* 文档任务权限 |
|||
* |
|||
* @author Lion Li |
|||
* @date 2024-11-08 |
|||
*/ |
|||
@Validated |
|||
@RequiredArgsConstructor |
|||
@RestController |
|||
@RequestMapping("/productManagement/DocumentTasksPermissions") |
|||
public class DocumentTasksPermissionsController extends BaseController { |
|||
|
|||
private final IDocumentTasksPermissionsService documentTasksPermissionsService; |
|||
|
|||
/** |
|||
* 查询文档任务权限列表 |
|||
*/ |
|||
@SaCheckPermission("productManagement:DocumentTasksPermissions:list") |
|||
@GetMapping("/list") |
|||
public TableDataInfo<DocumentTasksPermissionsVo> list(DocumentTasksPermissionsBo bo, PageQuery pageQuery) { |
|||
return documentTasksPermissionsService.queryPageList(bo, pageQuery); |
|||
} |
|||
|
|||
/** |
|||
* 导出文档任务权限列表 |
|||
*/ |
|||
@SaCheckPermission("productManagement:DocumentTasksPermissions:export") |
|||
@Log(title = "文档任务权限", businessType = BusinessType.EXPORT) |
|||
@PostMapping("/export") |
|||
public void export(DocumentTasksPermissionsBo bo, HttpServletResponse response) { |
|||
List<DocumentTasksPermissionsVo> list = documentTasksPermissionsService.queryList(bo); |
|||
ExcelUtil.exportExcel(list, "文档任务权限", DocumentTasksPermissionsVo.class, response); |
|||
} |
|||
|
|||
/** |
|||
* 获取文档任务权限详细信息 |
|||
* |
|||
* @param id 主键 |
|||
*/ |
|||
@SaCheckPermission("productManagement:DocumentTasksPermissions:query") |
|||
@GetMapping("/{id}") |
|||
public R<DocumentTasksPermissionsVo> getInfo(@NotNull(message = "主键不能为空") |
|||
@PathVariable String id) { |
|||
return R.ok(documentTasksPermissionsService.queryById(id)); |
|||
} |
|||
|
|||
/** |
|||
* 新增文档任务权限 |
|||
*/ |
|||
@SaCheckPermission("productManagement:DocumentTasksPermissions:add") |
|||
@Log(title = "文档任务权限", businessType = BusinessType.INSERT) |
|||
@RepeatSubmit() |
|||
@PostMapping() |
|||
public R<Void> add(@Validated(AddGroup.class) @RequestBody DocumentTasksPermissionsBo bo) { |
|||
return toAjax(documentTasksPermissionsService.insertByBo(bo)); |
|||
} |
|||
|
|||
/** |
|||
* 修改文档任务权限 |
|||
*/ |
|||
@SaCheckPermission("productManagement:DocumentTasksPermissions:edit") |
|||
@Log(title = "文档任务权限", businessType = BusinessType.UPDATE) |
|||
@RepeatSubmit() |
|||
@PutMapping() |
|||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody DocumentTasksPermissionsBo bo) { |
|||
return toAjax(documentTasksPermissionsService.updateByBo(bo)); |
|||
} |
|||
|
|||
/** |
|||
* 删除文档任务权限 |
|||
* |
|||
* @param ids 主键串 |
|||
*/ |
|||
@SaCheckPermission("productManagement:DocumentTasksPermissions:remove") |
|||
@Log(title = "文档任务权限", businessType = BusinessType.DELETE) |
|||
@DeleteMapping("/{ids}") |
|||
public R<Void> remove(@NotEmpty(message = "主键不能为空") |
|||
@PathVariable String[] ids) { |
|||
return toAjax(documentTasksPermissionsService.deleteWithValidByIds(List.of(ids), true)); |
|||
} |
|||
/** |
|||
* 获取所有用户信息 |
|||
*/ |
|||
@GetMapping("/getUsersAll") |
|||
public R<List<SysUserVo>> getUsersAll() { |
|||
List<SysUserVo> list = documentTasksPermissionsService.getUsersAll(); |
|||
return R.ok(list); |
|||
} |
|||
|
|||
/** |
|||
* 获取文档任务权限详细信息根据用户id |
|||
*/ |
|||
@GetMapping("/getTasksPermissionsByUserId") |
|||
public R<DocumentTasksPermissionsVo> getTasksPermissionsByUserId() { |
|||
Long userId = LoginHelper.getUserId(); |
|||
DocumentTasksPermissionsVo documentTasksPermissionsVo = documentTasksPermissionsService.getTasksPermissionsByUserId(userId); |
|||
return R.ok(documentTasksPermissionsVo); |
|||
} |
|||
} |
@ -0,0 +1,105 @@ |
|||
package org.dromara.productManagement.controller; |
|||
|
|||
import java.util.List; |
|||
|
|||
import lombok.RequiredArgsConstructor; |
|||
import jakarta.servlet.http.HttpServletResponse; |
|||
import jakarta.validation.constraints.*; |
|||
import cn.dev33.satoken.annotation.SaCheckPermission; |
|||
import org.springframework.web.bind.annotation.*; |
|||
import org.springframework.validation.annotation.Validated; |
|||
import org.dromara.common.idempotent.annotation.RepeatSubmit; |
|||
import org.dromara.common.log.annotation.Log; |
|||
import org.dromara.common.web.core.BaseController; |
|||
import org.dromara.common.mybatis.core.page.PageQuery; |
|||
import org.dromara.common.core.domain.R; |
|||
import org.dromara.common.core.validate.AddGroup; |
|||
import org.dromara.common.core.validate.EditGroup; |
|||
import org.dromara.common.log.enums.BusinessType; |
|||
import org.dromara.common.excel.utils.ExcelUtil; |
|||
import org.dromara.productManagement.domain.vo.DocumentTasksPermissionsDetailVo; |
|||
import org.dromara.productManagement.domain.bo.DocumentTasksPermissionsDetailBo; |
|||
import org.dromara.productManagement.service.IDocumentTasksPermissionsDetailService; |
|||
import org.dromara.common.mybatis.core.page.TableDataInfo; |
|||
|
|||
/** |
|||
* 文档任务权限详情 |
|||
* |
|||
* @author Lion Li |
|||
* @date 2024-11-11 |
|||
*/ |
|||
@Validated |
|||
@RequiredArgsConstructor |
|||
@RestController |
|||
@RequestMapping("/productManagement/DocumentTasksPermissionsDetail") |
|||
public class DocumentTasksPermissionsDetailController extends BaseController { |
|||
|
|||
private final IDocumentTasksPermissionsDetailService documentTasksPermissionsDetailService; |
|||
|
|||
/** |
|||
* 查询文档任务权限详情列表 |
|||
*/ |
|||
@SaCheckPermission("productManagement:DocumentTasksPermissionsDetail:list") |
|||
@GetMapping("/list") |
|||
public TableDataInfo<DocumentTasksPermissionsDetailVo> list(DocumentTasksPermissionsDetailBo bo, PageQuery pageQuery) { |
|||
return documentTasksPermissionsDetailService.queryPageList(bo, pageQuery); |
|||
} |
|||
|
|||
/** |
|||
* 导出文档任务权限详情列表 |
|||
*/ |
|||
@SaCheckPermission("productManagement:DocumentTasksPermissionsDetail:export") |
|||
@Log(title = "文档任务权限详情", businessType = BusinessType.EXPORT) |
|||
@PostMapping("/export") |
|||
public void export(DocumentTasksPermissionsDetailBo bo, HttpServletResponse response) { |
|||
List<DocumentTasksPermissionsDetailVo> list = documentTasksPermissionsDetailService.queryList(bo); |
|||
ExcelUtil.exportExcel(list, "文档任务权限详情", DocumentTasksPermissionsDetailVo.class, response); |
|||
} |
|||
|
|||
/** |
|||
* 获取文档任务权限详情详细信息 |
|||
* |
|||
* @param id 主键 |
|||
*/ |
|||
@SaCheckPermission("productManagement:DocumentTasksPermissionsDetail:query") |
|||
@GetMapping("/{id}") |
|||
public R<DocumentTasksPermissionsDetailVo> getInfo(@NotNull(message = "主键不能为空") |
|||
@PathVariable String id) { |
|||
return R.ok(documentTasksPermissionsDetailService.queryById(id)); |
|||
} |
|||
|
|||
/** |
|||
* 新增文档任务权限详情 |
|||
*/ |
|||
@SaCheckPermission("productManagement:DocumentTasksPermissionsDetail:add") |
|||
@Log(title = "文档任务权限详情", businessType = BusinessType.INSERT) |
|||
@RepeatSubmit() |
|||
@PostMapping() |
|||
public R<Void> add(@Validated(AddGroup.class) @RequestBody DocumentTasksPermissionsDetailBo bo) { |
|||
return toAjax(documentTasksPermissionsDetailService.insertByBo(bo)); |
|||
} |
|||
|
|||
/** |
|||
* 修改文档任务权限详情 |
|||
*/ |
|||
@SaCheckPermission("productManagement:DocumentTasksPermissionsDetail:edit") |
|||
@Log(title = "文档任务权限详情", businessType = BusinessType.UPDATE) |
|||
@RepeatSubmit() |
|||
@PutMapping() |
|||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody DocumentTasksPermissionsDetailBo bo) { |
|||
return toAjax(documentTasksPermissionsDetailService.updateByBo(bo)); |
|||
} |
|||
|
|||
/** |
|||
* 删除文档任务权限详情 |
|||
* |
|||
* @param ids 主键串 |
|||
*/ |
|||
@SaCheckPermission("productManagement:DocumentTasksPermissionsDetail:remove") |
|||
@Log(title = "文档任务权限详情", businessType = BusinessType.DELETE) |
|||
@DeleteMapping("/{ids}") |
|||
public R<Void> remove(@NotEmpty(message = "主键不能为空") |
|||
@PathVariable String[] ids) { |
|||
return toAjax(documentTasksPermissionsDetailService.deleteWithValidByIds(List.of(ids), true)); |
|||
} |
|||
} |
@ -0,0 +1,125 @@ |
|||
package org.dromara.productManagement.controller; |
|||
|
|||
import java.util.List; |
|||
|
|||
import cn.hutool.core.util.ObjectUtil; |
|||
import lombok.RequiredArgsConstructor; |
|||
import jakarta.servlet.http.HttpServletResponse; |
|||
import jakarta.validation.constraints.*; |
|||
import cn.dev33.satoken.annotation.SaCheckPermission; |
|||
import org.dromara.common.excel.core.ExcelResult; |
|||
import org.springframework.http.MediaType; |
|||
import org.springframework.web.bind.annotation.*; |
|||
import org.springframework.validation.annotation.Validated; |
|||
import org.dromara.common.idempotent.annotation.RepeatSubmit; |
|||
import org.dromara.common.log.annotation.Log; |
|||
import org.dromara.common.web.core.BaseController; |
|||
import org.dromara.common.mybatis.core.page.PageQuery; |
|||
import org.dromara.common.core.domain.R; |
|||
import org.dromara.common.core.validate.AddGroup; |
|||
import org.dromara.common.core.validate.EditGroup; |
|||
import org.dromara.common.log.enums.BusinessType; |
|||
import org.dromara.common.excel.utils.ExcelUtil; |
|||
import org.dromara.productManagement.domain.vo.FileReadInfoVo; |
|||
import org.dromara.productManagement.domain.bo.FileReadInfoBo; |
|||
import org.dromara.productManagement.service.IFileReadInfoService; |
|||
import org.dromara.common.mybatis.core.page.TableDataInfo; |
|||
import org.springframework.web.multipart.MultipartFile; |
|||
|
|||
/** |
|||
* 文件处理信息表 |
|||
* |
|||
* @author Lion Li |
|||
* @date 2024-09-20 |
|||
*/ |
|||
@Validated |
|||
@RequiredArgsConstructor |
|||
@RestController |
|||
@RequestMapping("/productManagement/fileReadInfo") |
|||
public class FileReadInfoController extends BaseController { |
|||
|
|||
private final IFileReadInfoService fileReadInfoService; |
|||
|
|||
/** |
|||
* 查询文件处理信息表列表 |
|||
*/ |
|||
@SaCheckPermission("productManagement:fileReadInfo:list") |
|||
@GetMapping("/list") |
|||
public TableDataInfo<FileReadInfoVo> list(FileReadInfoBo bo, PageQuery pageQuery) { |
|||
return fileReadInfoService.queryPageList(bo, pageQuery); |
|||
} |
|||
|
|||
/** |
|||
* 导出文件处理信息表列表 |
|||
*/ |
|||
@SaCheckPermission("productManagement:fileReadInfo:export") |
|||
@Log(title = "文件处理信息表", businessType = BusinessType.EXPORT) |
|||
@PostMapping("/export") |
|||
public void export(FileReadInfoBo bo, HttpServletResponse response) { |
|||
List<FileReadInfoVo> list = fileReadInfoService.queryList(bo); |
|||
ExcelUtil.exportExcel(list, "文件处理信息表", FileReadInfoVo.class, response); |
|||
} |
|||
|
|||
/** |
|||
* 获取文件处理信息表详细信息 |
|||
* |
|||
* @param id 主键 |
|||
*/ |
|||
@SaCheckPermission("productManagement:fileReadInfo:query") |
|||
@GetMapping("/{id}") |
|||
public R<FileReadInfoVo> getInfo(@NotNull(message = "主键不能为空") |
|||
@PathVariable Long id) { |
|||
return R.ok(fileReadInfoService.queryById(id)); |
|||
} |
|||
|
|||
/** |
|||
* 新增文件处理信息表 |
|||
*/ |
|||
@SaCheckPermission("productManagement:fileReadInfo:add") |
|||
@Log(title = "文件处理信息表", businessType = BusinessType.INSERT) |
|||
@RepeatSubmit() |
|||
@PostMapping() |
|||
public R<Void> add(@Validated(AddGroup.class) @RequestBody FileReadInfoBo bo) { |
|||
return toAjax(fileReadInfoService.insertByBo(bo)); |
|||
} |
|||
|
|||
/** |
|||
* 修改文件处理信息表 |
|||
*/ |
|||
@SaCheckPermission("productManagement:fileReadInfo:edit") |
|||
@Log(title = "文件处理信息表", businessType = BusinessType.UPDATE) |
|||
@RepeatSubmit() |
|||
@PutMapping() |
|||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody FileReadInfoBo bo) { |
|||
return toAjax(fileReadInfoService.updateByBo(bo)); |
|||
} |
|||
|
|||
/** |
|||
* 删除文件处理信息表 |
|||
* |
|||
* @param ids 主键串 |
|||
*/ |
|||
@SaCheckPermission("productManagement:fileReadInfo:remove") |
|||
@Log(title = "文件处理信息表", businessType = BusinessType.DELETE) |
|||
@DeleteMapping("/{ids}") |
|||
public R<Void> remove(@NotEmpty(message = "主键不能为空") |
|||
@PathVariable Long[] ids) { |
|||
return toAjax(fileReadInfoService.deleteWithValidByIds(List.of(ids), true)); |
|||
} |
|||
/** |
|||
* 导入数据 |
|||
* |
|||
* @param file 导入文件 |
|||
* @param updateSupport 是否更新已存在数据 |
|||
*/ |
|||
@Log(title = "文件处理信息表", businessType = BusinessType.IMPORT) |
|||
@SaCheckPermission("productManagement:fileReadInfo:import") |
|||
@PostMapping(value = "/importData", consumes = MediaType.MULTIPART_FORM_DATA_VALUE) |
|||
public R<Void> importData(@RequestPart("file") MultipartFile file,@RequestPart("content") String context) throws Exception { |
|||
if (ObjectUtil.isNull(file)) { |
|||
return R.fail("上传文件不能为空"); |
|||
} |
|||
fileReadInfoService.importData(file,context); |
|||
return R.ok(); |
|||
} |
|||
} |
@ -0,0 +1,129 @@ |
|||
package org.dromara.productManagement.domain; |
|||
|
|||
import com.fasterxml.jackson.annotation.JsonProperty; |
|||
import lombok.Data; |
|||
|
|||
import java.util.List; |
|||
|
|||
// 文档评价结果类
|
|||
@Data |
|||
class DocumentEvaluationResult { |
|||
@JsonProperty("evaluationResultSummary") |
|||
private EvaluationSummary evaluationSummary; // 评价汇总
|
|||
|
|||
@JsonProperty("evaluationDetails") |
|||
private List<EvaluationDetail> evaluationDetails; // 评价详情列表
|
|||
|
|||
// 评价汇总内部类
|
|||
@Data |
|||
public static class EvaluationSummary { |
|||
@JsonProperty("evaluationRegistration") |
|||
private String evaluationRegistration; // 评价登记
|
|||
|
|||
@JsonProperty("evaluationScore") |
|||
private String evaluationScore; // 评价得分
|
|||
} |
|||
|
|||
// 评价详情内部类
|
|||
@Data |
|||
public static class EvaluationDetail { |
|||
@JsonProperty("functionClarity") |
|||
private EvaluationCriteria functionClarity; // 功能清晰性
|
|||
|
|||
@JsonProperty("functionCompleteness") |
|||
private EvaluationCriteria functionCompleteness; // 功能完整性
|
|||
|
|||
@JsonProperty("functionTestability") |
|||
private EvaluationCriteria functionTestability; // 功能可测试性
|
|||
|
|||
@JsonProperty("functionDetail") |
|||
private EvaluationCriteria functionDetail; // 功能详细性
|
|||
|
|||
@JsonProperty("originalText") |
|||
private String originalText; // 原文
|
|||
|
|||
@JsonProperty("polishedText") |
|||
private String polishedText; // 润色完善
|
|||
} |
|||
|
|||
// 评价标准内部类
|
|||
@Data |
|||
public static class EvaluationCriteria { |
|||
@JsonProperty("level") |
|||
private String level; // 级别
|
|||
|
|||
@JsonProperty("score") |
|||
private String score; // 分值
|
|||
|
|||
@JsonProperty("evaluationDescription") |
|||
private String evaluationDescription; // 评价说明
|
|||
} |
|||
} |
|||
/** |
|||
* json格式 |
|||
* { |
|||
* "evaluationResultSummary": { |
|||
* "evaluationRegistration": "2023-001", |
|||
* "evaluationScore": "85" |
|||
* }, |
|||
* "evaluationDetails": [ |
|||
* { |
|||
* "functionClarity": { |
|||
* "level": "Excellent", |
|||
* "score": "90", |
|||
* "evaluationDescription": "The function description is clear and precise." |
|||
* }, |
|||
* "functionCompleteness": { |
|||
* "level": "Good", |
|||
* "score": "80", |
|||
* "evaluationDescription": "The functionality is mostly complete, missing some details." |
|||
* }, |
|||
* "functionTestability": { |
|||
* "level": "Good", |
|||
* "score": "85", |
|||
* "evaluationDescription": "The function is easy to test, but documentation is insufficient." |
|||
* }, |
|||
* "functionDetail": { |
|||
* "level": "Excellent", |
|||
* "score": "95", |
|||
* "evaluationDescription": "The details of the function are accurate and comprehensive." |
|||
* }, |
|||
* "originalText": "Original text content.", |
|||
* "polishedText": "Polished text content." |
|||
* }, |
|||
* { |
|||
* "functionClarity": { |
|||
* "level": "Average", |
|||
* "score": "70", |
|||
* "evaluationDescription": "The function description is not clear enough." |
|||
* }, |
|||
* "functionCompleteness": { |
|||
* "level": "Satisfactory", |
|||
* "score": "75", |
|||
* "evaluationDescription": "Some functionalities are missing." |
|||
* }, |
|||
* "functionTestability": { |
|||
* "level": "Average", |
|||
* "score": "70", |
|||
* "evaluationDescription": "Testing is not convenient enough." |
|||
* }, |
|||
* "functionDetail": { |
|||
* "level": "Good", |
|||
* "score": "80", |
|||
* "evaluationDescription": "Function details are relatively complete." |
|||
* }, |
|||
* "originalText": "Second original text content.", |
|||
* "polishedText": "Second polished text content." |
|||
* } |
|||
* ] |
|||
* } |
|||
* // 创建ObjectMapper实例
|
|||
* ObjectMapper objectMapper = new ObjectMapper(); |
|||
* try { |
|||
* // 将JSON字符串映射到Java对象
|
|||
* DocumentEvaluationResult documentEvaluationResult = objectMapper.readValue(jsonString, DocumentEvaluationResult.class); |
|||
* System.out.println(documentEvaluationResult); |
|||
* } catch (IOException e) { |
|||
* e.printStackTrace(); |
|||
* } |
|||
*/ |
@ -0,0 +1,53 @@ |
|||
package org.dromara.productManagement.domain; |
|||
|
|||
import org.dromara.common.tenant.core.TenantEntity; |
|||
import com.baomidou.mybatisplus.annotation.*; |
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
|
|||
import java.io.Serial; |
|||
|
|||
/** |
|||
* 文档任务结果对象 document_task_results |
|||
* |
|||
* @author Lion Li |
|||
* @date 2024-10-23 |
|||
*/ |
|||
@Data |
|||
@EqualsAndHashCode(callSuper = true) |
|||
@TableName("document_task_results") |
|||
public class DocumentTaskResults extends TenantEntity { |
|||
|
|||
@Serial |
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* id |
|||
*/ |
|||
@TableId(value = "id") |
|||
private String id; |
|||
|
|||
/** |
|||
* 任务id |
|||
*/ |
|||
private Long documentTaskId; |
|||
|
|||
/** |
|||
* 任务结果 |
|||
*/ |
|||
private String result; |
|||
|
|||
/** |
|||
* |
|||
*/ |
|||
@TableLogic |
|||
private String delFlag; |
|||
|
|||
/** |
|||
* 版本号 |
|||
*/ |
|||
@Version |
|||
private Long version; |
|||
|
|||
|
|||
} |
@ -0,0 +1,66 @@ |
|||
package org.dromara.productManagement.domain; |
|||
|
|||
import org.dromara.common.tenant.core.TenantEntity; |
|||
import com.baomidou.mybatisplus.annotation.*; |
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
import java.util.Date; |
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
|
|||
import java.io.Serial; |
|||
|
|||
/** |
|||
* 文档任务对象 document_tasks |
|||
* |
|||
* @author Lion Li |
|||
* @date 2024-10-22 |
|||
*/ |
|||
@Data |
|||
@EqualsAndHashCode(callSuper = true) |
|||
@TableName("document_tasks") |
|||
public class DocumentTasks extends TenantEntity { |
|||
|
|||
@Serial |
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* id |
|||
*/ |
|||
@TableId(value = "id") |
|||
private String id; |
|||
|
|||
/** |
|||
* 任务名称 |
|||
*/ |
|||
private String taskName; |
|||
|
|||
/** |
|||
* 文档名称 |
|||
*/ |
|||
private String documentName; |
|||
private Long ossId; |
|||
|
|||
/** |
|||
* 预计时间 |
|||
*/ |
|||
private Date estimatedCompletionTime; |
|||
|
|||
/** |
|||
* 状态 |
|||
*/ |
|||
private String progressStatus; |
|||
|
|||
/** |
|||
* |
|||
*/ |
|||
@TableLogic |
|||
private String delFlag; |
|||
|
|||
/** |
|||
* 版本号 |
|||
*/ |
|||
@Version |
|||
private Long version; |
|||
|
|||
|
|||
} |
@ -0,0 +1,69 @@ |
|||
package org.dromara.productManagement.domain; |
|||
|
|||
import org.dromara.common.tenant.core.TenantEntity; |
|||
import com.baomidou.mybatisplus.annotation.*; |
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
|
|||
import java.io.Serial; |
|||
|
|||
/** |
|||
* 文档任务权限对象 document_tasks_permissions |
|||
* |
|||
* @author Lion Li |
|||
* @date 2024-11-08 |
|||
*/ |
|||
@Data |
|||
@EqualsAndHashCode(callSuper = true) |
|||
@TableName("document_tasks_permissions") |
|||
public class DocumentTasksPermissions extends TenantEntity { |
|||
|
|||
@Serial |
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 主键ID |
|||
*/ |
|||
@TableId(value = "id") |
|||
private String id; |
|||
|
|||
/** |
|||
* 用户ID |
|||
*/ |
|||
private Long userId; |
|||
|
|||
/** |
|||
* 角色ID |
|||
*/ |
|||
private Long roleId; |
|||
|
|||
/** |
|||
* 每日文档数 |
|||
*/ |
|||
private Long dailyDocumentCount; |
|||
|
|||
/** |
|||
* 优先级 |
|||
*/ |
|||
private Long priority; |
|||
|
|||
/** |
|||
* 任务种类 |
|||
*/ |
|||
private String taskType; |
|||
|
|||
|
|||
/** |
|||
* 删除标志 |
|||
*/ |
|||
@TableLogic |
|||
private String delFlag; |
|||
|
|||
/** |
|||
* 版本号 |
|||
*/ |
|||
@Version |
|||
private Long version; |
|||
|
|||
|
|||
} |
@ -0,0 +1,58 @@ |
|||
package org.dromara.productManagement.domain; |
|||
|
|||
import org.dromara.common.tenant.core.TenantEntity; |
|||
import com.baomidou.mybatisplus.annotation.*; |
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
|
|||
import java.io.Serial; |
|||
|
|||
/** |
|||
* 文档任务权限详情对象 document_tasks_permissions_detail |
|||
* |
|||
* @author Lion Li |
|||
* @date 2024-11-11 |
|||
*/ |
|||
@Data |
|||
@EqualsAndHashCode(callSuper = true) |
|||
@TableName("document_tasks_permissions_detail") |
|||
public class DocumentTasksPermissionsDetail extends TenantEntity { |
|||
|
|||
@Serial |
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 主键ID |
|||
*/ |
|||
@TableId(value = "id") |
|||
private String id; |
|||
|
|||
/** |
|||
* 用户ID |
|||
*/ |
|||
private Long userId; |
|||
|
|||
/** |
|||
* 剩余文档数 |
|||
*/ |
|||
private Long remainingDocumentCount; |
|||
|
|||
/** |
|||
* 任务种类 |
|||
*/ |
|||
private String taskType; |
|||
|
|||
/** |
|||
* 删除标志 |
|||
*/ |
|||
@TableLogic |
|||
private String delFlag; |
|||
|
|||
/** |
|||
* 版本号 |
|||
*/ |
|||
@Version |
|||
private Long version; |
|||
|
|||
|
|||
} |
@ -0,0 +1,51 @@ |
|||
package org.dromara.productManagement.domain; |
|||
|
|||
import org.dromara.common.mybatis.core.domain.BaseEntity; |
|||
import com.baomidou.mybatisplus.annotation.*; |
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
|
|||
import java.io.Serial; |
|||
|
|||
/** |
|||
* 文件处理信息表对象 file_read_info |
|||
* |
|||
* @author Lion Li |
|||
* @date 2024-09-20 |
|||
*/ |
|||
@Data |
|||
@EqualsAndHashCode(callSuper = true) |
|||
@TableName("file_read_info") |
|||
public class FileReadInfo extends BaseEntity { |
|||
|
|||
@Serial |
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* |
|||
*/ |
|||
@TableId(value = "id") |
|||
private Long id; |
|||
|
|||
/** |
|||
* 文件名称 |
|||
*/ |
|||
private String fileName; |
|||
|
|||
/** |
|||
* 文件状态,1是已读 |
|||
*/ |
|||
private String fileStatus; |
|||
|
|||
/** |
|||
* 文件读取模式 |
|||
*/ |
|||
private String fileReadMode; |
|||
|
|||
/** |
|||
* 反馈 |
|||
*/ |
|||
private String feedback; |
|||
|
|||
|
|||
} |
@ -0,0 +1,39 @@ |
|||
package org.dromara.productManagement.domain.bo; |
|||
|
|||
import org.dromara.productManagement.domain.DocumentTaskResults; |
|||
import org.dromara.common.mybatis.core.domain.BaseEntity; |
|||
import org.dromara.common.core.validate.AddGroup; |
|||
import org.dromara.common.core.validate.EditGroup; |
|||
import io.github.linpeilie.annotations.AutoMapper; |
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
import jakarta.validation.constraints.*; |
|||
|
|||
/** |
|||
* 文档任务结果业务对象 document_task_results |
|||
* |
|||
* @author Lion Li |
|||
* @date 2024-10-23 |
|||
*/ |
|||
@Data |
|||
@EqualsAndHashCode(callSuper = true) |
|||
@AutoMapper(target = DocumentTaskResults.class, reverseConvertGenerate = false) |
|||
public class DocumentTaskResultsBo extends BaseEntity { |
|||
|
|||
/** |
|||
* id |
|||
*/ |
|||
private String id; |
|||
|
|||
/** |
|||
* 任务id |
|||
*/ |
|||
private Long documentTaskId; |
|||
|
|||
/** |
|||
* 任务结果 |
|||
*/ |
|||
private String result; |
|||
|
|||
|
|||
} |
@ -0,0 +1,58 @@ |
|||
package org.dromara.productManagement.domain.bo; |
|||
|
|||
import org.dromara.productManagement.domain.DocumentTasks; |
|||
import org.dromara.common.mybatis.core.domain.BaseEntity; |
|||
import org.dromara.common.core.validate.AddGroup; |
|||
import org.dromara.common.core.validate.EditGroup; |
|||
import io.github.linpeilie.annotations.AutoMapper; |
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
import jakarta.validation.constraints.*; |
|||
import java.util.Date; |
|||
import java.util.List; |
|||
|
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
|
|||
/** |
|||
* 文档任务业务对象 document_tasks |
|||
* |
|||
* @author Lion Li |
|||
* @date 2024-10-22 |
|||
*/ |
|||
@Data |
|||
@EqualsAndHashCode(callSuper = true) |
|||
@AutoMapper(target = DocumentTasks.class, reverseConvertGenerate = false) |
|||
public class DocumentTasksBo extends BaseEntity { |
|||
/** |
|||
* 主键 |
|||
*/ |
|||
private String id; |
|||
/** |
|||
* 任务名称 |
|||
*/ |
|||
// @NotBlank(message = "任务名称不能为空", groups = { AddGroup.class, EditGroup.class })
|
|||
private String taskName; |
|||
@NotEmpty(message = "任务名称列表不能为空", groups = { AddGroup.class, EditGroup.class }) |
|||
private List<@NotBlank(message = "任务名称不能为空") String> taskNameList; |
|||
/** |
|||
* 文档名称 |
|||
*/ |
|||
// @NotBlank(message = "文档名称不能为空", groups = { AddGroup.class, EditGroup.class })
|
|||
private String documentName; |
|||
@NotNull(message = "文档不能为空", groups = { AddGroup.class, EditGroup.class }) |
|||
private Long ossId; |
|||
|
|||
/** |
|||
* 预计时间 |
|||
*/ |
|||
// @NotNull(message = "预计时间不能为空", groups = { AddGroup.class, EditGroup.class })
|
|||
private Date estimatedCompletionTime; |
|||
|
|||
/** |
|||
* 状态 |
|||
*/ |
|||
// @NotBlank(message = "状态不能为空", groups = { AddGroup.class, EditGroup.class })
|
|||
private String progressStatus; |
|||
|
|||
|
|||
} |
@ -0,0 +1,65 @@ |
|||
package org.dromara.productManagement.domain.bo; |
|||
|
|||
import org.dromara.productManagement.domain.DocumentTasksPermissions; |
|||
import org.dromara.common.mybatis.core.domain.BaseEntity; |
|||
import org.dromara.common.core.validate.AddGroup; |
|||
import org.dromara.common.core.validate.EditGroup; |
|||
import io.github.linpeilie.annotations.AutoMapper; |
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
import jakarta.validation.constraints.*; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 文档任务权限业务对象 document_tasks_permissions |
|||
* |
|||
* @author Lion Li |
|||
* @date 2024-11-08 |
|||
*/ |
|||
@Data |
|||
@EqualsAndHashCode(callSuper = true) |
|||
@AutoMapper(target = DocumentTasksPermissions.class, reverseConvertGenerate = false) |
|||
public class DocumentTasksPermissionsBo extends BaseEntity { |
|||
|
|||
/** |
|||
* 主键ID |
|||
*/ |
|||
@NotBlank(message = "主键ID不能为空", groups = { EditGroup.class }) |
|||
private String id; |
|||
|
|||
/** |
|||
* 用户ID |
|||
*/ |
|||
private Long userId; |
|||
|
|||
/** |
|||
* 角色ID |
|||
*/ |
|||
private Long roleId; |
|||
|
|||
/** |
|||
* 每日文档数 |
|||
*/ |
|||
@NotNull(message = "每日文档数不能为空", groups = { AddGroup.class, EditGroup.class }) |
|||
private Long dailyDocumentCount; |
|||
|
|||
/** |
|||
* 优先级 |
|||
*/ |
|||
@NotNull(message = "优先级不能为空", groups = { AddGroup.class, EditGroup.class }) |
|||
private Long priority; |
|||
|
|||
/** |
|||
* 任务种类 |
|||
*/ |
|||
private String taskType; |
|||
|
|||
|
|||
/** |
|||
* 任务列表 |
|||
*/ |
|||
@NotNull(message = "任务种类不能为空", groups = { AddGroup.class, EditGroup.class }) |
|||
private List<String> taskTypeList; |
|||
|
|||
} |
@ -0,0 +1,47 @@ |
|||
package org.dromara.productManagement.domain.bo; |
|||
|
|||
import org.dromara.productManagement.domain.DocumentTasksPermissionsDetail; |
|||
import org.dromara.common.mybatis.core.domain.BaseEntity; |
|||
import org.dromara.common.core.validate.AddGroup; |
|||
import org.dromara.common.core.validate.EditGroup; |
|||
import io.github.linpeilie.annotations.AutoMapper; |
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
import jakarta.validation.constraints.*; |
|||
|
|||
/** |
|||
* 文档任务权限详情业务对象 document_tasks_permissions_detail |
|||
* |
|||
* @author Lion Li |
|||
* @date 2024-11-11 |
|||
*/ |
|||
@Data |
|||
@EqualsAndHashCode(callSuper = true) |
|||
@AutoMapper(target = DocumentTasksPermissionsDetail.class, reverseConvertGenerate = false) |
|||
public class DocumentTasksPermissionsDetailBo extends BaseEntity { |
|||
|
|||
/** |
|||
* 主键ID |
|||
*/ |
|||
private String id; |
|||
|
|||
/** |
|||
* 用户ID |
|||
*/ |
|||
@NotNull(message = "用户ID不能为空", groups = { AddGroup.class, EditGroup.class }) |
|||
private Long userId; |
|||
|
|||
/** |
|||
* 剩余文档数 |
|||
*/ |
|||
@NotNull(message = "剩余文档数不能为空", groups = { AddGroup.class, EditGroup.class }) |
|||
private Long remainingDocumentCount; |
|||
|
|||
/** |
|||
* 任务种类 |
|||
*/ |
|||
@NotBlank(message = "任务种类不能为空", groups = { AddGroup.class, EditGroup.class }) |
|||
private String taskType; |
|||
|
|||
|
|||
} |
@ -0,0 +1,54 @@ |
|||
package org.dromara.productManagement.domain.bo; |
|||
|
|||
import org.dromara.productManagement.domain.FileReadInfo; |
|||
import org.dromara.common.mybatis.core.domain.BaseEntity; |
|||
import org.dromara.common.core.validate.AddGroup; |
|||
import org.dromara.common.core.validate.EditGroup; |
|||
import io.github.linpeilie.annotations.AutoMapper; |
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
import jakarta.validation.constraints.*; |
|||
|
|||
/** |
|||
* 文件处理信息表业务对象 file_read_info |
|||
* |
|||
* @author Lion Li |
|||
* @date 2024-09-20 |
|||
*/ |
|||
@Data |
|||
@EqualsAndHashCode(callSuper = true) |
|||
@AutoMapper(target = FileReadInfo.class, reverseConvertGenerate = false) |
|||
public class FileReadInfoBo extends BaseEntity { |
|||
|
|||
/** |
|||
* |
|||
*/ |
|||
@NotNull(message = "不能为空", groups = { EditGroup.class }) |
|||
private Long id; |
|||
|
|||
/** |
|||
* 文件名称 |
|||
*/ |
|||
@NotBlank(message = "文件名称不能为空", groups = { AddGroup.class, EditGroup.class }) |
|||
private String fileName; |
|||
|
|||
/** |
|||
* 文件状态,1是已读 |
|||
*/ |
|||
@NotBlank(message = "文件状态,1是已读不能为空", groups = { AddGroup.class, EditGroup.class }) |
|||
private String fileStatus; |
|||
|
|||
/** |
|||
* 文件读取模式 |
|||
*/ |
|||
@NotBlank(message = "文件读取模式不能为空", groups = { AddGroup.class, EditGroup.class }) |
|||
private String fileReadMode; |
|||
|
|||
/** |
|||
* 反馈 |
|||
*/ |
|||
@NotBlank(message = "反馈不能为空", groups = { AddGroup.class, EditGroup.class }) |
|||
private String feedback; |
|||
|
|||
|
|||
} |
@ -0,0 +1,35 @@ |
|||
package org.dromara.productManagement.domain.vo; |
|||
|
|||
import org.dromara.productManagement.domain.DocumentTaskResults; |
|||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; |
|||
import com.alibaba.excel.annotation.ExcelProperty; |
|||
import org.dromara.common.excel.annotation.ExcelDictFormat; |
|||
import org.dromara.common.excel.convert.ExcelDictConvert; |
|||
import io.github.linpeilie.annotations.AutoMapper; |
|||
import lombok.Data; |
|||
|
|||
import java.io.Serial; |
|||
import java.io.Serializable; |
|||
import java.util.Date; |
|||
|
|||
|
|||
|
|||
/** |
|||
* 文档任务结果视图对象 document_task_results |
|||
* |
|||
* @author Lion Li |
|||
* @date 2024-10-23 |
|||
*/ |
|||
@Data |
|||
@ExcelIgnoreUnannotated |
|||
@AutoMapper(target = DocumentTaskResults.class) |
|||
public class DocumentTaskResultsVo implements Serializable { |
|||
|
|||
@Serial |
|||
private static final long serialVersionUID = 1L; |
|||
/** |
|||
* 任务结果 |
|||
*/ |
|||
private String result; |
|||
|
|||
} |
@ -0,0 +1,57 @@ |
|||
package org.dromara.productManagement.domain.vo; |
|||
|
|||
import org.dromara.productManagement.domain.DocumentTasksPermissionsDetail; |
|||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; |
|||
import com.alibaba.excel.annotation.ExcelProperty; |
|||
import org.dromara.common.excel.annotation.ExcelDictFormat; |
|||
import org.dromara.common.excel.convert.ExcelDictConvert; |
|||
import io.github.linpeilie.annotations.AutoMapper; |
|||
import lombok.Data; |
|||
|
|||
import java.io.Serial; |
|||
import java.io.Serializable; |
|||
import java.util.Date; |
|||
|
|||
|
|||
|
|||
/** |
|||
* 文档任务权限详情视图对象 document_tasks_permissions_detail |
|||
* |
|||
* @author Lion Li |
|||
* @date 2024-11-11 |
|||
*/ |
|||
@Data |
|||
@ExcelIgnoreUnannotated |
|||
@AutoMapper(target = DocumentTasksPermissionsDetail.class) |
|||
public class DocumentTasksPermissionsDetailVo implements Serializable { |
|||
|
|||
@Serial |
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 主键ID |
|||
*/ |
|||
@ExcelProperty(value = "主键ID") |
|||
private String id; |
|||
|
|||
/** |
|||
* 用户ID |
|||
*/ |
|||
@ExcelProperty(value = "用户ID") |
|||
private Long userId; |
|||
|
|||
/** |
|||
* 剩余文档数 |
|||
*/ |
|||
@ExcelProperty(value = "剩余文档数") |
|||
private Long remainingDocumentCount; |
|||
|
|||
/** |
|||
* 任务种类 |
|||
*/ |
|||
@ExcelProperty(value = "任务种类", converter = ExcelDictConvert.class) |
|||
@ExcelDictFormat(dictType = "document_task") |
|||
private String taskType; |
|||
|
|||
|
|||
} |
@ -0,0 +1,74 @@ |
|||
package org.dromara.productManagement.domain.vo; |
|||
|
|||
import org.dromara.productManagement.domain.DocumentTasksPermissions; |
|||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; |
|||
import com.alibaba.excel.annotation.ExcelProperty; |
|||
import org.dromara.common.excel.annotation.ExcelDictFormat; |
|||
import org.dromara.common.excel.convert.ExcelDictConvert; |
|||
import io.github.linpeilie.annotations.AutoMapper; |
|||
import lombok.Data; |
|||
|
|||
import java.io.Serial; |
|||
import java.io.Serializable; |
|||
import java.util.Date; |
|||
import java.util.List; |
|||
|
|||
|
|||
/** |
|||
* 文档任务权限视图对象 document_tasks_permissions |
|||
* |
|||
* @author Lion Li |
|||
* @date 2024-11-08 |
|||
*/ |
|||
@Data |
|||
@ExcelIgnoreUnannotated |
|||
@AutoMapper(target = DocumentTasksPermissions.class) |
|||
public class DocumentTasksPermissionsVo implements Serializable { |
|||
|
|||
@Serial |
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 主键ID |
|||
*/ |
|||
@ExcelProperty(value = "主键ID") |
|||
private String id; |
|||
|
|||
/** |
|||
* 用户ID |
|||
*/ |
|||
@ExcelProperty(value = "用户ID") |
|||
private Long userId; |
|||
|
|||
/** |
|||
* 角色ID |
|||
*/ |
|||
@ExcelProperty(value = "角色ID") |
|||
private Long roleId; |
|||
|
|||
/** |
|||
* 每日文档数 |
|||
*/ |
|||
@ExcelProperty(value = "每日文档数") |
|||
private Long dailyDocumentCount; |
|||
|
|||
/** |
|||
* 优先级 |
|||
*/ |
|||
@ExcelProperty(value = "优先级") |
|||
private Long priority; |
|||
|
|||
/** |
|||
* 任务种类 |
|||
*/ |
|||
@ExcelProperty(value = "任务种类", converter = ExcelDictConvert.class) |
|||
@ExcelDictFormat(dictType = "document_task") |
|||
private String taskType; |
|||
|
|||
|
|||
/** |
|||
* 任务列表 |
|||
*/ |
|||
private List<String> taskTypeList; |
|||
|
|||
} |
@ -0,0 +1,62 @@ |
|||
package org.dromara.productManagement.domain.vo; |
|||
|
|||
import java.util.Date; |
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import org.dromara.productManagement.domain.DocumentTasks; |
|||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; |
|||
import com.alibaba.excel.annotation.ExcelProperty; |
|||
import org.dromara.common.excel.annotation.ExcelDictFormat; |
|||
import org.dromara.common.excel.convert.ExcelDictConvert; |
|||
import io.github.linpeilie.annotations.AutoMapper; |
|||
import lombok.Data; |
|||
|
|||
import java.io.Serial; |
|||
import java.io.Serializable; |
|||
import java.util.Date; |
|||
|
|||
|
|||
|
|||
/** |
|||
* 文档任务视图对象 document_tasks |
|||
* |
|||
* @author Lion Li |
|||
* @date 2024-10-22 |
|||
*/ |
|||
@Data |
|||
@ExcelIgnoreUnannotated |
|||
@AutoMapper(target = DocumentTasks.class) |
|||
public class DocumentTasksVo implements Serializable { |
|||
|
|||
@Serial |
|||
private static final long serialVersionUID = 1L; |
|||
@ExcelProperty(value = "主键") |
|||
private String id; |
|||
/** |
|||
* 任务名称 |
|||
*/ |
|||
@ExcelProperty(value = "任务名称", converter = ExcelDictConvert.class) |
|||
@ExcelDictFormat(dictType = "document_task") |
|||
private String taskName; |
|||
|
|||
/** |
|||
* 文档名称 |
|||
*/ |
|||
@ExcelProperty(value = "文档名称") |
|||
private String documentName; |
|||
|
|||
/** |
|||
* 预计时间 |
|||
*/ |
|||
@ExcelProperty(value = "预计时间") |
|||
private Date estimatedCompletionTime; |
|||
@ExcelProperty(value = "上传时间") |
|||
private Date createTime; |
|||
/** |
|||
* 状态 |
|||
*/ |
|||
@ExcelProperty(value = "状态", converter = ExcelDictConvert.class) |
|||
@ExcelDictFormat(dictType = "document_task_status") |
|||
private String progressStatus; |
|||
|
|||
|
|||
} |
@ -0,0 +1,63 @@ |
|||
package org.dromara.productManagement.domain.vo; |
|||
|
|||
import org.dromara.productManagement.domain.FileReadInfo; |
|||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; |
|||
import com.alibaba.excel.annotation.ExcelProperty; |
|||
import org.dromara.common.excel.annotation.ExcelDictFormat; |
|||
import org.dromara.common.excel.convert.ExcelDictConvert; |
|||
import io.github.linpeilie.annotations.AutoMapper; |
|||
import lombok.Data; |
|||
|
|||
import java.io.Serial; |
|||
import java.io.Serializable; |
|||
import java.util.Date; |
|||
|
|||
|
|||
|
|||
/** |
|||
* 文件处理信息表视图对象 file_read_info |
|||
* |
|||
* @author Lion Li |
|||
* @date 2024-09-20 |
|||
*/ |
|||
@Data |
|||
@ExcelIgnoreUnannotated |
|||
@AutoMapper(target = FileReadInfo.class) |
|||
public class FileReadInfoVo implements Serializable { |
|||
|
|||
@Serial |
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* |
|||
*/ |
|||
@ExcelProperty(value = "") |
|||
private Long id; |
|||
|
|||
/** |
|||
* 文件名称 |
|||
*/ |
|||
@ExcelProperty(value = "文件名称") |
|||
private String fileName; |
|||
|
|||
/** |
|||
* 文件状态,1是已读 |
|||
*/ |
|||
@ExcelProperty(value = "文件状态,1是已读", converter = ExcelDictConvert.class) |
|||
@ExcelDictFormat(dictType = "sys_yes_no") |
|||
private String fileStatus; |
|||
|
|||
/** |
|||
* 文件读取模式 |
|||
*/ |
|||
@ExcelProperty(value = "文件读取模式") |
|||
private String fileReadMode; |
|||
|
|||
/** |
|||
* 反馈 |
|||
*/ |
|||
@ExcelProperty(value = "反馈") |
|||
private String feedback; |
|||
|
|||
|
|||
} |
@ -0,0 +1,15 @@ |
|||
package org.dromara.productManagement.mapper; |
|||
|
|||
import org.dromara.productManagement.domain.DocumentTaskResults; |
|||
import org.dromara.productManagement.domain.vo.DocumentTaskResultsVo; |
|||
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus; |
|||
|
|||
/** |
|||
* 文档任务结果Mapper接口 |
|||
* |
|||
* @author Lion Li |
|||
* @date 2024-10-23 |
|||
*/ |
|||
public interface DocumentTaskResultsMapper extends BaseMapperPlus<DocumentTaskResults, DocumentTaskResultsVo> { |
|||
|
|||
} |
@ -0,0 +1,21 @@ |
|||
package org.dromara.productManagement.mapper; |
|||
|
|||
import org.dromara.common.mybatis.annotation.DataColumn; |
|||
import org.dromara.common.mybatis.annotation.DataPermission; |
|||
import org.dromara.productManagement.domain.DocumentTasks; |
|||
import org.dromara.productManagement.domain.vo.DocumentTasksVo; |
|||
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus; |
|||
|
|||
/** |
|||
* 文档任务Mapper接口 |
|||
* |
|||
* @author Lion Li |
|||
* @date 2024-10-22 |
|||
*/ |
|||
@DataPermission({ |
|||
// @DataColumn(key = "deptName", value = "dept_id"),
|
|||
@DataColumn(key = "userName", value = "create_by") |
|||
}) |
|||
public interface DocumentTasksMapper extends BaseMapperPlus<DocumentTasks, DocumentTasksVo> { |
|||
|
|||
} |
@ -0,0 +1,15 @@ |
|||
package org.dromara.productManagement.mapper; |
|||
|
|||
import org.dromara.productManagement.domain.DocumentTasksPermissionsDetail; |
|||
import org.dromara.productManagement.domain.vo.DocumentTasksPermissionsDetailVo; |
|||
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus; |
|||
|
|||
/** |
|||
* 文档任务权限详情Mapper接口 |
|||
* |
|||
* @author Lion Li |
|||
* @date 2024-11-11 |
|||
*/ |
|||
public interface DocumentTasksPermissionsDetailMapper extends BaseMapperPlus<DocumentTasksPermissionsDetail, DocumentTasksPermissionsDetailVo> { |
|||
|
|||
} |
@ -0,0 +1,17 @@ |
|||
package org.dromara.productManagement.mapper; |
|||
|
|||
import org.apache.ibatis.annotations.Param; |
|||
import org.dromara.productManagement.domain.DocumentTasksPermissions; |
|||
import org.dromara.productManagement.domain.vo.DocumentTasksPermissionsVo; |
|||
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus; |
|||
|
|||
/** |
|||
* 文档任务权限Mapper接口 |
|||
* |
|||
* @author Lion Li |
|||
* @date 2024-11-08 |
|||
*/ |
|||
public interface DocumentTasksPermissionsMapper extends BaseMapperPlus<DocumentTasksPermissions, DocumentTasksPermissionsVo> { |
|||
DocumentTasksPermissionsVo selectDocumentPermissionsByUserIdAndTaskType(@Param("userId") Long userId,@Param("taskType") String taskType); |
|||
|
|||
} |
@ -0,0 +1,15 @@ |
|||
package org.dromara.productManagement.mapper; |
|||
|
|||
import org.dromara.productManagement.domain.FileReadInfo; |
|||
import org.dromara.productManagement.domain.vo.FileReadInfoVo; |
|||
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus; |
|||
|
|||
/** |
|||
* 文件处理信息表Mapper接口 |
|||
* |
|||
* @author Lion Li |
|||
* @date 2024-09-20 |
|||
*/ |
|||
public interface FileReadInfoMapper extends BaseMapperPlus<FileReadInfo, FileReadInfoVo> { |
|||
|
|||
} |
@ -0,0 +1,41 @@ |
|||
package org.dromara.productManagement.service; |
|||
|
|||
import jakarta.servlet.http.HttpServletResponse; |
|||
import org.dromara.common.core.domain.R; |
|||
import org.springframework.web.multipart.MultipartFile; |
|||
|
|||
import java.io.IOException; |
|||
import java.io.InputStream; |
|||
|
|||
/** |
|||
* DocAiService接口,用于定义与文档AI相关的业务逻辑。 |
|||
*/ |
|||
public interface IDocAiService { |
|||
/** |
|||
* 执行SSE请求 |
|||
* @param endpoint 请求的端点 |
|||
* @param originalFilename 原始文件名 |
|||
* @param context 请求上下文 |
|||
* @param rp HttpServletResponse对象 |
|||
* @throws Exception 异常 |
|||
*/ |
|||
void executeSSE(String endpoint, String originalFilename, String context, HttpServletResponse rp) throws Exception; |
|||
|
|||
/** |
|||
* 获取日志 |
|||
* @param rp HttpServletResponse对象 |
|||
* @throws Exception 异常 |
|||
*/ |
|||
void getLog(HttpServletResponse rp) throws Exception; |
|||
|
|||
/** |
|||
* 上传文件 |
|||
* @param file 上传的文件 |
|||
* @param originalFilename 原始文件名 |
|||
* @return 上传结果 |
|||
* @throws IOException IO异常 |
|||
* @throws InterruptedException 中断异常 |
|||
*/ |
|||
R<String> uploadFile(MultipartFile file, String originalFilename) throws IOException, InterruptedException; |
|||
String uploadFileByStream(InputStream inputStream, String originalFilename,String url) throws IOException, InterruptedException; |
|||
} |
@ -0,0 +1,70 @@ |
|||
package org.dromara.productManagement.service; |
|||
|
|||
import org.dromara.productManagement.domain.vo.DocumentTaskResultsVo; |
|||
import org.dromara.productManagement.domain.bo.DocumentTaskResultsBo; |
|||
import org.dromara.common.mybatis.core.page.TableDataInfo; |
|||
import org.dromara.common.mybatis.core.page.PageQuery; |
|||
|
|||
import java.util.Collection; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 文档任务结果Service接口 |
|||
* |
|||
* @author Lion Li |
|||
* @date 2024-10-23 |
|||
*/ |
|||
public interface IDocumentTaskResultsService { |
|||
|
|||
/** |
|||
* 查询文档任务结果 |
|||
* |
|||
* @param id 主键 |
|||
* @return 文档任务结果 |
|||
*/ |
|||
DocumentTaskResultsVo queryById(String id); |
|||
|
|||
/** |
|||
* 分页查询文档任务结果列表 |
|||
* |
|||
* @param bo 查询条件 |
|||
* @param pageQuery 分页参数 |
|||
* @return 文档任务结果分页列表 |
|||
*/ |
|||
TableDataInfo<DocumentTaskResultsVo> queryPageList(DocumentTaskResultsBo bo, PageQuery pageQuery); |
|||
|
|||
/** |
|||
* 查询符合条件的文档任务结果列表 |
|||
* |
|||
* @param bo 查询条件 |
|||
* @return 文档任务结果列表 |
|||
*/ |
|||
List<DocumentTaskResultsVo> queryList(DocumentTaskResultsBo bo); |
|||
|
|||
/** |
|||
* 新增文档任务结果 |
|||
* |
|||
* @param bo 文档任务结果 |
|||
* @return 是否新增成功 |
|||
*/ |
|||
Boolean insertByBo(DocumentTaskResultsBo bo); |
|||
|
|||
/** |
|||
* 修改文档任务结果 |
|||
* |
|||
* @param bo 文档任务结果 |
|||
* @return 是否修改成功 |
|||
*/ |
|||
Boolean updateByBo(DocumentTaskResultsBo bo); |
|||
|
|||
/** |
|||
* 校验并批量删除文档任务结果信息 |
|||
* |
|||
* @param ids 待删除的主键集合 |
|||
* @param isValid 是否进行有效性校验 |
|||
* @return 是否删除成功 |
|||
*/ |
|||
Boolean deleteWithValidByIds(Collection<String> ids, Boolean isValid); |
|||
|
|||
DocumentTaskResultsVo queryByTaskId(String id); |
|||
} |
@ -0,0 +1,68 @@ |
|||
package org.dromara.productManagement.service; |
|||
|
|||
import org.dromara.productManagement.domain.vo.DocumentTasksPermissionsDetailVo; |
|||
import org.dromara.productManagement.domain.bo.DocumentTasksPermissionsDetailBo; |
|||
import org.dromara.common.mybatis.core.page.TableDataInfo; |
|||
import org.dromara.common.mybatis.core.page.PageQuery; |
|||
|
|||
import java.util.Collection; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 文档任务权限详情Service接口 |
|||
* |
|||
* @author Lion Li |
|||
* @date 2024-11-11 |
|||
*/ |
|||
public interface IDocumentTasksPermissionsDetailService { |
|||
|
|||
/** |
|||
* 查询文档任务权限详情 |
|||
* |
|||
* @param id 主键 |
|||
* @return 文档任务权限详情 |
|||
*/ |
|||
DocumentTasksPermissionsDetailVo queryById(String id); |
|||
|
|||
/** |
|||
* 分页查询文档任务权限详情列表 |
|||
* |
|||
* @param bo 查询条件 |
|||
* @param pageQuery 分页参数 |
|||
* @return 文档任务权限详情分页列表 |
|||
*/ |
|||
TableDataInfo<DocumentTasksPermissionsDetailVo> queryPageList(DocumentTasksPermissionsDetailBo bo, PageQuery pageQuery); |
|||
|
|||
/** |
|||
* 查询符合条件的文档任务权限详情列表 |
|||
* |
|||
* @param bo 查询条件 |
|||
* @return 文档任务权限详情列表 |
|||
*/ |
|||
List<DocumentTasksPermissionsDetailVo> queryList(DocumentTasksPermissionsDetailBo bo); |
|||
|
|||
/** |
|||
* 新增文档任务权限详情 |
|||
* |
|||
* @param bo 文档任务权限详情 |
|||
* @return 是否新增成功 |
|||
*/ |
|||
Boolean insertByBo(DocumentTasksPermissionsDetailBo bo); |
|||
|
|||
/** |
|||
* 修改文档任务权限详情 |
|||
* |
|||
* @param bo 文档任务权限详情 |
|||
* @return 是否修改成功 |
|||
*/ |
|||
Boolean updateByBo(DocumentTasksPermissionsDetailBo bo); |
|||
|
|||
/** |
|||
* 校验并批量删除文档任务权限详情信息 |
|||
* |
|||
* @param ids 待删除的主键集合 |
|||
* @param isValid 是否进行有效性校验 |
|||
* @return 是否删除成功 |
|||
*/ |
|||
Boolean deleteWithValidByIds(Collection<String> ids, Boolean isValid); |
|||
} |
@ -0,0 +1,74 @@ |
|||
package org.dromara.productManagement.service; |
|||
|
|||
import org.dromara.productManagement.domain.vo.DocumentTasksPermissionsVo; |
|||
import org.dromara.productManagement.domain.bo.DocumentTasksPermissionsBo; |
|||
import org.dromara.common.mybatis.core.page.TableDataInfo; |
|||
import org.dromara.common.mybatis.core.page.PageQuery; |
|||
import org.dromara.system.domain.vo.SysUserVo; |
|||
|
|||
import java.util.Collection; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 文档任务权限Service接口 |
|||
* |
|||
* @author Lion Li |
|||
* @date 2024-11-08 |
|||
*/ |
|||
public interface IDocumentTasksPermissionsService { |
|||
|
|||
/** |
|||
* 查询文档任务权限 |
|||
* |
|||
* @param id 主键 |
|||
* @return 文档任务权限 |
|||
*/ |
|||
DocumentTasksPermissionsVo queryById(String id); |
|||
|
|||
/** |
|||
* 分页查询文档任务权限列表 |
|||
* |
|||
* @param bo 查询条件 |
|||
* @param pageQuery 分页参数 |
|||
* @return 文档任务权限分页列表 |
|||
*/ |
|||
TableDataInfo<DocumentTasksPermissionsVo> queryPageList(DocumentTasksPermissionsBo bo, PageQuery pageQuery); |
|||
|
|||
/** |
|||
* 查询符合条件的文档任务权限列表 |
|||
* |
|||
* @param bo 查询条件 |
|||
* @return 文档任务权限列表 |
|||
*/ |
|||
List<DocumentTasksPermissionsVo> queryList(DocumentTasksPermissionsBo bo); |
|||
|
|||
/** |
|||
* 新增文档任务权限 |
|||
* |
|||
* @param bo 文档任务权限 |
|||
* @return 是否新增成功 |
|||
*/ |
|||
Boolean insertByBo(DocumentTasksPermissionsBo bo); |
|||
|
|||
/** |
|||
* 修改文档任务权限 |
|||
* |
|||
* @param bo 文档任务权限 |
|||
* @return 是否修改成功 |
|||
*/ |
|||
Boolean updateByBo(DocumentTasksPermissionsBo bo); |
|||
|
|||
/** |
|||
* 校验并批量删除文档任务权限信息 |
|||
* |
|||
* @param ids 待删除的主键集合 |
|||
* @param isValid 是否进行有效性校验 |
|||
* @return 是否删除成功 |
|||
*/ |
|||
Boolean deleteWithValidByIds(Collection<String> ids, Boolean isValid); |
|||
|
|||
|
|||
List<SysUserVo> getUsersAll(); |
|||
|
|||
DocumentTasksPermissionsVo getTasksPermissionsByUserId(Long userId); |
|||
} |
@ -0,0 +1,71 @@ |
|||
package org.dromara.productManagement.service; |
|||
|
|||
import org.dromara.productManagement.domain.vo.DocumentTasksVo; |
|||
import org.dromara.productManagement.domain.bo.DocumentTasksBo; |
|||
import org.dromara.common.mybatis.core.page.TableDataInfo; |
|||
import org.dromara.common.mybatis.core.page.PageQuery; |
|||
|
|||
import java.io.IOException; |
|||
import java.util.Collection; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 文档任务Service接口 |
|||
* |
|||
* @author Lion Li |
|||
* @date 2024-10-22 |
|||
*/ |
|||
public interface IDocumentTasksService { |
|||
|
|||
/** |
|||
* 查询文档任务 |
|||
* |
|||
* @param id 主键 |
|||
* @return 文档任务 |
|||
*/ |
|||
DocumentTasksVo queryById(Long id); |
|||
|
|||
/** |
|||
* 分页查询文档任务列表 |
|||
* |
|||
* @param bo 查询条件 |
|||
* @param pageQuery 分页参数 |
|||
* @return 文档任务分页列表 |
|||
*/ |
|||
TableDataInfo<DocumentTasksVo> queryPageList(DocumentTasksBo bo, PageQuery pageQuery); |
|||
|
|||
/** |
|||
* 查询符合条件的文档任务列表 |
|||
* |
|||
* @param bo 查询条件 |
|||
* @return 文档任务列表 |
|||
*/ |
|||
List<DocumentTasksVo> queryList(DocumentTasksBo bo); |
|||
|
|||
/** |
|||
* 新增文档任务 |
|||
* |
|||
* @param bo 文档任务 |
|||
* @return 是否新增成功 |
|||
*/ |
|||
Boolean insertByBo(DocumentTasksBo bo) throws IOException, InterruptedException; |
|||
|
|||
/** |
|||
* 修改文档任务 |
|||
* |
|||
* @param bo 文档任务 |
|||
* @return 是否修改成功 |
|||
*/ |
|||
Boolean updateByBo(DocumentTasksBo bo); |
|||
|
|||
/** |
|||
* 校验并批量删除文档任务信息 |
|||
* |
|||
* @param ids 待删除的主键集合 |
|||
* @param isValid 是否进行有效性校验 |
|||
* @return 是否删除成功 |
|||
*/ |
|||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid); |
|||
|
|||
int stopTask(Long id); |
|||
} |
@ -0,0 +1,72 @@ |
|||
package org.dromara.productManagement.service; |
|||
|
|||
import org.dromara.productManagement.domain.vo.FileReadInfoVo; |
|||
import org.dromara.productManagement.domain.bo.FileReadInfoBo; |
|||
import org.dromara.common.mybatis.core.page.TableDataInfo; |
|||
import org.dromara.common.mybatis.core.page.PageQuery; |
|||
import org.springframework.web.multipart.MultipartFile; |
|||
|
|||
import java.io.IOException; |
|||
import java.util.Collection; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 文件处理信息表Service接口 |
|||
* |
|||
* @author Lion Li |
|||
* @date 2024-09-20 |
|||
*/ |
|||
public interface IFileReadInfoService { |
|||
|
|||
/** |
|||
* 查询文件处理信息表 |
|||
* |
|||
* @param id 主键 |
|||
* @return 文件处理信息表 |
|||
*/ |
|||
FileReadInfoVo queryById(Long id); |
|||
|
|||
/** |
|||
* 分页查询文件处理信息表列表 |
|||
* |
|||
* @param bo 查询条件 |
|||
* @param pageQuery 分页参数 |
|||
* @return 文件处理信息表分页列表 |
|||
*/ |
|||
TableDataInfo<FileReadInfoVo> queryPageList(FileReadInfoBo bo, PageQuery pageQuery); |
|||
|
|||
/** |
|||
* 查询符合条件的文件处理信息表列表 |
|||
* |
|||
* @param bo 查询条件 |
|||
* @return 文件处理信息表列表 |
|||
*/ |
|||
List<FileReadInfoVo> queryList(FileReadInfoBo bo); |
|||
|
|||
/** |
|||
* 新增文件处理信息表 |
|||
* |
|||
* @param bo 文件处理信息表 |
|||
* @return 是否新增成功 |
|||
*/ |
|||
Boolean insertByBo(FileReadInfoBo bo); |
|||
|
|||
/** |
|||
* 修改文件处理信息表 |
|||
* |
|||
* @param bo 文件处理信息表 |
|||
* @return 是否修改成功 |
|||
*/ |
|||
Boolean updateByBo(FileReadInfoBo bo); |
|||
|
|||
/** |
|||
* 校验并批量删除文件处理信息表信息 |
|||
* |
|||
* @param ids 待删除的主键集合 |
|||
* @param isValid 是否进行有效性校验 |
|||
* @return 是否删除成功 |
|||
*/ |
|||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid); |
|||
|
|||
void importData(MultipartFile file, String context) throws IOException; |
|||
} |
@ -0,0 +1,178 @@ |
|||
package org.dromara.productManagement.service.impl; |
|||
|
|||
import org.dromara.common.core.domain.R; |
|||
import org.dromara.common.satoken.utils.LoginHelper; |
|||
import org.dromara.productManagement.service.IDocAiService; |
|||
import org.springframework.beans.factory.annotation.Value; |
|||
import org.springframework.stereotype.Service; |
|||
import org.springframework.web.multipart.MultipartFile; |
|||
|
|||
import jakarta.servlet.http.HttpServletResponse; |
|||
import java.io.File; |
|||
import java.io.IOException; |
|||
import java.io.InputStream; |
|||
import java.util.concurrent.TimeUnit; |
|||
|
|||
import cn.hutool.core.io.FileUtil; |
|||
import okhttp3.*; |
|||
import com.alibaba.fastjson.JSON; |
|||
import org.springframework.http.MediaType; |
|||
import org.dromara.common.sse.dto.ChatGlmDto; |
|||
import org.dromara.common.sse.listener.SSEListener; |
|||
import org.dromara.common.sse.utils.ExecuteSSEUtil; |
|||
|
|||
/** |
|||
* DocAiServiceImpl类,实现IDocAiService接口,提供文档AI相关的具体逻辑。 |
|||
*/ |
|||
@Service |
|||
public class DocAiServiceImpl implements IDocAiService { |
|||
|
|||
@Value("${chat.filePath}") |
|||
private String chatFilePath; |
|||
@Value("${chat.chatUrl}") |
|||
private String chatUrl; |
|||
|
|||
private final OkHttpClient client = new OkHttpClient.Builder() |
|||
.connectTimeout(300, TimeUnit.SECONDS) |
|||
.callTimeout(1200, TimeUnit.SECONDS) |
|||
.pingInterval(50, TimeUnit.SECONDS) |
|||
.readTimeout(600, TimeUnit.SECONDS) |
|||
.writeTimeout(600, TimeUnit.SECONDS) |
|||
.build(); |
|||
|
|||
/** |
|||
* 执行SSE请求 |
|||
* @param url 请求的URL |
|||
* @param context 请求上下文 |
|||
* @param rp HttpServletResponse对象 |
|||
* @throws Exception 异常 |
|||
*/ |
|||
private void executeSSE(String url, String context, HttpServletResponse rp) throws Exception { |
|||
ChatGlmDto chatGlmDto = new ChatGlmDto(); |
|||
SSEListener sseListener = new SSEListener(chatGlmDto, rp); |
|||
ExecuteSSEUtil.executeSSE(url + "?context=" + context, sseListener, JSON.toJSONString(chatGlmDto)); |
|||
} |
|||
|
|||
/** |
|||
* 获取文件名 |
|||
* @param originalFilename 原始文件名 |
|||
* @return 文件名 |
|||
*/ |
|||
private String getFileName(String originalFilename) { |
|||
return "uploads/" + originalFilename; |
|||
} |
|||
|
|||
/** |
|||
* 获取用户ID |
|||
* @return 用户ID |
|||
*/ |
|||
private Long getUserId() { |
|||
return LoginHelper.getUserId(); |
|||
} |
|||
|
|||
@Override |
|||
public void executeSSE(String endpoint, String originalFilename, String context, HttpServletResponse rp) throws Exception { |
|||
String fileName = getFileName(originalFilename); |
|||
Long userId = getUserId(); |
|||
executeSSE(chatUrl + endpoint + "?filename=" + fileName + "&userId=" + userId, context, rp); |
|||
} |
|||
|
|||
@Override |
|||
public void getLog(HttpServletResponse rp) throws Exception { |
|||
Long userId = getUserId(); |
|||
executeSSE(chatUrl + "/sse/getLog?userId=" + userId, "", rp); |
|||
} |
|||
|
|||
@Override |
|||
public R<String> uploadFile(MultipartFile file, String originalFilename) throws IOException, InterruptedException { |
|||
String destDir = chatFilePath; |
|||
if (originalFilename == null) { |
|||
throw new IllegalArgumentException("文件名不能为空"); |
|||
} |
|||
String suffix = FileUtil.getSuffix(originalFilename); |
|||
String destPath = destDir + File.separator + originalFilename; |
|||
File destFile = new File(destPath); |
|||
FileUtil.writeFromStream(file.getInputStream(), destFile); |
|||
|
|||
if (!originalFilename.endsWith(".docx")) { |
|||
ProcessBuilder builder = new ProcessBuilder("unoconv", "-o", destDir, "-f", "docx", destFile.getAbsolutePath()); |
|||
Process process = builder.start(); |
|||
int completed = process.waitFor(); |
|||
if (completed != 0) { |
|||
InputStream errorStream = process.getErrorStream(); |
|||
String errorMessage = new String(errorStream.readAllBytes()); |
|||
process.destroyForcibly(); |
|||
String failMsg = suffix + "转docx失败,请检查文件是否正确~ 错误信息: " + errorMessage; |
|||
return R.fail(failMsg, failMsg); |
|||
} else { |
|||
process.destroyForcibly(); |
|||
destPath = destPath.substring(0, destPath.lastIndexOf(".")) + ".docx"; |
|||
} |
|||
} |
|||
|
|||
if (!sendRequest(chatUrl + "/sse/upload", destPath)) { |
|||
return R.fail("文件上传失败", "文件上传失败"); |
|||
} |
|||
return R.ok("ok", "uploads/" + originalFilename); |
|||
} |
|||
@Override |
|||
public String uploadFileByStream(InputStream inputStream, String originalFilename,String url) throws IOException, InterruptedException { |
|||
String destDir = chatFilePath; |
|||
if (originalFilename == null) { |
|||
throw new IllegalArgumentException("文件名不能为空"); |
|||
} |
|||
String suffix = FileUtil.getSuffix(originalFilename); |
|||
String destPath = destDir + File.separator + originalFilename; |
|||
File destFile = new File(destPath); |
|||
if(url.equals("/sse/upload")){ |
|||
FileUtil.writeFromStream(inputStream, destFile); |
|||
} |
|||
|
|||
if (!originalFilename.endsWith(".docx")) { |
|||
ProcessBuilder builder = new ProcessBuilder("unoconv", "-o", destDir, "-f", "docx", destFile.getAbsolutePath()); |
|||
Process process = builder.start(); |
|||
int completed = process.waitFor(); |
|||
if (completed != 0) { |
|||
InputStream errorStream = process.getErrorStream(); |
|||
String errorMessage = new String(errorStream.readAllBytes()); |
|||
process.destroyForcibly(); |
|||
String failMsg = suffix + "转docx失败,请检查文件是否正确~ 错误信息: " + errorMessage; |
|||
return failMsg; |
|||
} else { |
|||
process.destroyForcibly(); |
|||
destPath = destPath.substring(0, destPath.lastIndexOf(".")) + ".docx"; |
|||
} |
|||
} |
|||
|
|||
if (!sendRequest(chatUrl + url, destPath)) { |
|||
return "文件上传失败"; |
|||
} |
|||
return "1"; |
|||
} |
|||
/** |
|||
* 发送文件到服务器 |
|||
* @param url 服务器URL |
|||
* @param filePath 文件路径 |
|||
* @return 是否成功 |
|||
*/ |
|||
private boolean sendRequest(String url, String filePath) { |
|||
File file = new File(filePath); |
|||
RequestBody requestBody = new MultipartBody.Builder() |
|||
.setType(MultipartBody.FORM) |
|||
.addFormDataPart("file", file.getName(), |
|||
RequestBody.create(okhttp3.MediaType.parse(MediaType.APPLICATION_OCTET_STREAM_VALUE), file)) |
|||
.build(); |
|||
|
|||
Request request = new Request.Builder() |
|||
.url(url) |
|||
.post(requestBody) |
|||
.build(); |
|||
|
|||
try (Response response = client.newCall(request).execute()) { |
|||
return response.isSuccessful(); |
|||
} catch (IOException e) { |
|||
e.printStackTrace(); |
|||
} |
|||
return false; |
|||
} |
|||
} |
@ -0,0 +1,138 @@ |
|||
package org.dromara.productManagement.service.impl; |
|||
|
|||
import org.dromara.common.core.utils.MapstructUtils; |
|||
import org.dromara.common.core.utils.StringUtils; |
|||
import org.dromara.common.mybatis.core.page.TableDataInfo; |
|||
import org.dromara.common.mybatis.core.page.PageQuery; |
|||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|||
import lombok.RequiredArgsConstructor; |
|||
import org.springframework.stereotype.Service; |
|||
import org.dromara.productManagement.domain.bo.DocumentTaskResultsBo; |
|||
import org.dromara.productManagement.domain.vo.DocumentTaskResultsVo; |
|||
import org.dromara.productManagement.domain.DocumentTaskResults; |
|||
import org.dromara.productManagement.mapper.DocumentTaskResultsMapper; |
|||
import org.dromara.productManagement.service.IDocumentTaskResultsService; |
|||
|
|||
import java.util.List; |
|||
import java.util.Map; |
|||
import java.util.Collection; |
|||
|
|||
/** |
|||
* 文档任务结果Service业务层处理 |
|||
* |
|||
* @author Lion Li |
|||
* @date 2024-10-23 |
|||
*/ |
|||
@RequiredArgsConstructor |
|||
@Service |
|||
public class DocumentTaskResultsServiceImpl implements IDocumentTaskResultsService { |
|||
|
|||
private final DocumentTaskResultsMapper baseMapper; |
|||
|
|||
/** |
|||
* 查询文档任务结果 |
|||
* |
|||
* @param id 主键 |
|||
* @return 文档任务结果 |
|||
*/ |
|||
@Override |
|||
public DocumentTaskResultsVo queryById(String id){ |
|||
return baseMapper.selectVoById(id); |
|||
} |
|||
|
|||
/** |
|||
* 分页查询文档任务结果列表 |
|||
* |
|||
* @param bo 查询条件 |
|||
* @param pageQuery 分页参数 |
|||
* @return 文档任务结果分页列表 |
|||
*/ |
|||
@Override |
|||
public TableDataInfo<DocumentTaskResultsVo> queryPageList(DocumentTaskResultsBo bo, PageQuery pageQuery) { |
|||
LambdaQueryWrapper<DocumentTaskResults> lqw = buildQueryWrapper(bo); |
|||
Page<DocumentTaskResultsVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw); |
|||
return TableDataInfo.build(result); |
|||
} |
|||
|
|||
/** |
|||
* 查询符合条件的文档任务结果列表 |
|||
* |
|||
* @param bo 查询条件 |
|||
* @return 文档任务结果列表 |
|||
*/ |
|||
@Override |
|||
public List<DocumentTaskResultsVo> queryList(DocumentTaskResultsBo bo) { |
|||
LambdaQueryWrapper<DocumentTaskResults> lqw = buildQueryWrapper(bo); |
|||
return baseMapper.selectVoList(lqw); |
|||
} |
|||
|
|||
private LambdaQueryWrapper<DocumentTaskResults> buildQueryWrapper(DocumentTaskResultsBo bo) { |
|||
Map<String, Object> params = bo.getParams(); |
|||
LambdaQueryWrapper<DocumentTaskResults> lqw = Wrappers.lambdaQuery(); |
|||
lqw.eq(bo.getId() != null, DocumentTaskResults::getId, bo.getId()); |
|||
lqw.eq(bo.getDocumentTaskId() != null, DocumentTaskResults::getDocumentTaskId, bo.getDocumentTaskId()); |
|||
lqw.eq(StringUtils.isNotBlank(bo.getResult()), DocumentTaskResults::getResult, bo.getResult()); |
|||
return lqw; |
|||
} |
|||
|
|||
/** |
|||
* 新增文档任务结果 |
|||
* |
|||
* @param bo 文档任务结果 |
|||
* @return 是否新增成功 |
|||
*/ |
|||
@Override |
|||
public Boolean insertByBo(DocumentTaskResultsBo bo) { |
|||
DocumentTaskResults add = MapstructUtils.convert(bo, DocumentTaskResults.class); |
|||
validEntityBeforeSave(add); |
|||
boolean flag = baseMapper.insert(add) > 0; |
|||
if (flag) { |
|||
bo.setId(add.getId()); |
|||
} |
|||
return flag; |
|||
} |
|||
|
|||
/** |
|||
* 修改文档任务结果 |
|||
* |
|||
* @param bo 文档任务结果 |
|||
* @return 是否修改成功 |
|||
*/ |
|||
@Override |
|||
public Boolean updateByBo(DocumentTaskResultsBo bo) { |
|||
DocumentTaskResults update = MapstructUtils.convert(bo, DocumentTaskResults.class); |
|||
validEntityBeforeSave(update); |
|||
return baseMapper.updateById(update) > 0; |
|||
} |
|||
|
|||
/** |
|||
* 保存前的数据校验 |
|||
*/ |
|||
private void validEntityBeforeSave(DocumentTaskResults entity){ |
|||
//TODO 做一些数据校验,如唯一约束
|
|||
} |
|||
|
|||
/** |
|||
* 校验并批量删除文档任务结果信息 |
|||
* |
|||
* @param ids 待删除的主键集合 |
|||
* @param isValid 是否进行有效性校验 |
|||
* @return 是否删除成功 |
|||
*/ |
|||
@Override |
|||
public Boolean deleteWithValidByIds(Collection<String> ids, Boolean isValid) { |
|||
if(isValid){ |
|||
//TODO 做一些业务上的校验,判断是否需要校验
|
|||
} |
|||
return baseMapper.deleteByIds(ids) > 0; |
|||
} |
|||
|
|||
@Override |
|||
public DocumentTaskResultsVo queryByTaskId(String id) { |
|||
LambdaQueryWrapper<DocumentTaskResults> lqw = Wrappers.lambdaQuery(); |
|||
lqw.eq(DocumentTaskResults::getDocumentTaskId, id); |
|||
return baseMapper.selectVoOne(lqw); |
|||
} |
|||
} |
@ -0,0 +1,131 @@ |
|||
package org.dromara.productManagement.service.impl; |
|||
|
|||
import org.dromara.common.core.utils.MapstructUtils; |
|||
import org.dromara.common.core.utils.StringUtils; |
|||
import org.dromara.common.mybatis.core.page.TableDataInfo; |
|||
import org.dromara.common.mybatis.core.page.PageQuery; |
|||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|||
import lombok.RequiredArgsConstructor; |
|||
import org.springframework.stereotype.Service; |
|||
import org.dromara.productManagement.domain.bo.DocumentTasksPermissionsDetailBo; |
|||
import org.dromara.productManagement.domain.vo.DocumentTasksPermissionsDetailVo; |
|||
import org.dromara.productManagement.domain.DocumentTasksPermissionsDetail; |
|||
import org.dromara.productManagement.mapper.DocumentTasksPermissionsDetailMapper; |
|||
import org.dromara.productManagement.service.IDocumentTasksPermissionsDetailService; |
|||
|
|||
import java.util.List; |
|||
import java.util.Map; |
|||
import java.util.Collection; |
|||
|
|||
/** |
|||
* 文档任务权限详情Service业务层处理 |
|||
* |
|||
* @author Lion Li |
|||
* @date 2024-11-11 |
|||
*/ |
|||
@RequiredArgsConstructor |
|||
@Service |
|||
public class DocumentTasksPermissionsDetailServiceImpl implements IDocumentTasksPermissionsDetailService { |
|||
|
|||
private final DocumentTasksPermissionsDetailMapper baseMapper; |
|||
|
|||
/** |
|||
* 查询文档任务权限详情 |
|||
* |
|||
* @param id 主键 |
|||
* @return 文档任务权限详情 |
|||
*/ |
|||
@Override |
|||
public DocumentTasksPermissionsDetailVo queryById(String id){ |
|||
return baseMapper.selectVoById(id); |
|||
} |
|||
|
|||
/** |
|||
* 分页查询文档任务权限详情列表 |
|||
* |
|||
* @param bo 查询条件 |
|||
* @param pageQuery 分页参数 |
|||
* @return 文档任务权限详情分页列表 |
|||
*/ |
|||
@Override |
|||
public TableDataInfo<DocumentTasksPermissionsDetailVo> queryPageList(DocumentTasksPermissionsDetailBo bo, PageQuery pageQuery) { |
|||
LambdaQueryWrapper<DocumentTasksPermissionsDetail> lqw = buildQueryWrapper(bo); |
|||
Page<DocumentTasksPermissionsDetailVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw); |
|||
return TableDataInfo.build(result); |
|||
} |
|||
|
|||
/** |
|||
* 查询符合条件的文档任务权限详情列表 |
|||
* |
|||
* @param bo 查询条件 |
|||
* @return 文档任务权限详情列表 |
|||
*/ |
|||
@Override |
|||
public List<DocumentTasksPermissionsDetailVo> queryList(DocumentTasksPermissionsDetailBo bo) { |
|||
LambdaQueryWrapper<DocumentTasksPermissionsDetail> lqw = buildQueryWrapper(bo); |
|||
return baseMapper.selectVoList(lqw); |
|||
} |
|||
|
|||
private LambdaQueryWrapper<DocumentTasksPermissionsDetail> buildQueryWrapper(DocumentTasksPermissionsDetailBo bo) { |
|||
Map<String, Object> params = bo.getParams(); |
|||
LambdaQueryWrapper<DocumentTasksPermissionsDetail> lqw = Wrappers.lambdaQuery(); |
|||
lqw.eq(bo.getUserId() != null, DocumentTasksPermissionsDetail::getUserId, bo.getUserId()); |
|||
lqw.eq(bo.getRemainingDocumentCount() != null, DocumentTasksPermissionsDetail::getRemainingDocumentCount, bo.getRemainingDocumentCount()); |
|||
lqw.eq(StringUtils.isNotBlank(bo.getTaskType()), DocumentTasksPermissionsDetail::getTaskType, bo.getTaskType()); |
|||
return lqw; |
|||
} |
|||
|
|||
/** |
|||
* 新增文档任务权限详情 |
|||
* |
|||
* @param bo 文档任务权限详情 |
|||
* @return 是否新增成功 |
|||
*/ |
|||
@Override |
|||
public Boolean insertByBo(DocumentTasksPermissionsDetailBo bo) { |
|||
DocumentTasksPermissionsDetail add = MapstructUtils.convert(bo, DocumentTasksPermissionsDetail.class); |
|||
validEntityBeforeSave(add); |
|||
boolean flag = baseMapper.insert(add) > 0; |
|||
if (flag) { |
|||
bo.setId(add.getId()); |
|||
} |
|||
return flag; |
|||
} |
|||
|
|||
/** |
|||
* 修改文档任务权限详情 |
|||
* |
|||
* @param bo 文档任务权限详情 |
|||
* @return 是否修改成功 |
|||
*/ |
|||
@Override |
|||
public Boolean updateByBo(DocumentTasksPermissionsDetailBo bo) { |
|||
DocumentTasksPermissionsDetail update = MapstructUtils.convert(bo, DocumentTasksPermissionsDetail.class); |
|||
validEntityBeforeSave(update); |
|||
return baseMapper.updateById(update) > 0; |
|||
} |
|||
|
|||
/** |
|||
* 保存前的数据校验 |
|||
*/ |
|||
private void validEntityBeforeSave(DocumentTasksPermissionsDetail entity){ |
|||
//TODO 做一些数据校验,如唯一约束
|
|||
} |
|||
|
|||
/** |
|||
* 校验并批量删除文档任务权限详情信息 |
|||
* |
|||
* @param ids 待删除的主键集合 |
|||
* @param isValid 是否进行有效性校验 |
|||
* @return 是否删除成功 |
|||
*/ |
|||
@Override |
|||
public Boolean deleteWithValidByIds(Collection<String> ids, Boolean isValid) { |
|||
if(isValid){ |
|||
//TODO 做一些业务上的校验,判断是否需要校验
|
|||
} |
|||
return baseMapper.deleteByIds(ids) > 0; |
|||
} |
|||
} |
@ -0,0 +1,181 @@ |
|||
package org.dromara.productManagement.service.impl; |
|||
|
|||
import cn.hutool.core.util.StrUtil; |
|||
import org.dromara.common.core.service.DictService; |
|||
import org.dromara.common.core.utils.MapstructUtils; |
|||
import org.dromara.common.core.utils.StringUtils; |
|||
import org.dromara.common.mybatis.core.page.TableDataInfo; |
|||
import org.dromara.common.mybatis.core.page.PageQuery; |
|||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|||
import lombok.RequiredArgsConstructor; |
|||
import org.dromara.system.domain.SysUser; |
|||
import org.dromara.system.domain.vo.SysUserVo; |
|||
import org.dromara.system.mapper.SysUserMapper; |
|||
import org.dromara.system.service.ISysDictTypeService; |
|||
import org.springframework.stereotype.Service; |
|||
import org.dromara.productManagement.domain.bo.DocumentTasksPermissionsBo; |
|||
import org.dromara.productManagement.domain.vo.DocumentTasksPermissionsVo; |
|||
import org.dromara.productManagement.domain.DocumentTasksPermissions; |
|||
import org.dromara.productManagement.mapper.DocumentTasksPermissionsMapper; |
|||
import org.dromara.productManagement.service.IDocumentTasksPermissionsService; |
|||
|
|||
import java.util.Arrays; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
import java.util.Collection; |
|||
|
|||
/** |
|||
* 文档任务权限Service业务层处理 |
|||
* |
|||
* @author Lion Li |
|||
* @date 2024-11-08 |
|||
*/ |
|||
@RequiredArgsConstructor |
|||
@Service |
|||
public class DocumentTasksPermissionsServiceImpl implements IDocumentTasksPermissionsService { |
|||
|
|||
private final DocumentTasksPermissionsMapper baseMapper; |
|||
private final SysUserMapper userMapper; |
|||
private final DictService dictTypeService; |
|||
|
|||
/** |
|||
* 查询文档任务权限 |
|||
* |
|||
* @param id 主键 |
|||
* @return 文档任务权限 |
|||
*/ |
|||
@Override |
|||
public DocumentTasksPermissionsVo queryById(String id){ |
|||
DocumentTasksPermissionsVo vo = baseMapper.selectVoById(id); |
|||
vo.setTaskTypeList(List.of(vo.getTaskType().split(","))); |
|||
return vo; |
|||
} |
|||
|
|||
/** |
|||
* 分页查询文档任务权限列表 |
|||
* |
|||
* @param bo 查询条件 |
|||
* @param pageQuery 分页参数 |
|||
* @return 文档任务权限分页列表 |
|||
*/ |
|||
@Override |
|||
public TableDataInfo<DocumentTasksPermissionsVo> queryPageList(DocumentTasksPermissionsBo bo, PageQuery pageQuery) { |
|||
LambdaQueryWrapper<DocumentTasksPermissions> lqw = buildQueryWrapper(bo); |
|||
Page<DocumentTasksPermissionsVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw); |
|||
result.getRecords().forEach(r -> r.setTaskTypeList(List.of(r.getTaskType().split(",")))); |
|||
return TableDataInfo.build(result); |
|||
} |
|||
|
|||
/** |
|||
* 查询符合条件的文档任务权限列表 |
|||
* |
|||
* @param bo 查询条件 |
|||
* @return 文档任务权限列表 |
|||
*/ |
|||
@Override |
|||
public List<DocumentTasksPermissionsVo> queryList(DocumentTasksPermissionsBo bo) { |
|||
LambdaQueryWrapper<DocumentTasksPermissions> lqw = buildQueryWrapper(bo); |
|||
return baseMapper.selectVoList(lqw); |
|||
} |
|||
|
|||
private LambdaQueryWrapper<DocumentTasksPermissions> buildQueryWrapper(DocumentTasksPermissionsBo bo) { |
|||
Map<String, Object> params = bo.getParams(); |
|||
LambdaQueryWrapper<DocumentTasksPermissions> lqw = Wrappers.lambdaQuery(); |
|||
lqw.eq(bo.getUserId() != null, DocumentTasksPermissions::getUserId, bo.getUserId()); |
|||
lqw.eq(bo.getRoleId() != null, DocumentTasksPermissions::getRoleId, bo.getRoleId()); |
|||
lqw.eq(bo.getDailyDocumentCount() != null, DocumentTasksPermissions::getDailyDocumentCount, bo.getDailyDocumentCount()); |
|||
lqw.eq(bo.getPriority() != null, DocumentTasksPermissions::getPriority, bo.getPriority()); |
|||
lqw.eq(StringUtils.isNotBlank(bo.getTaskType()), DocumentTasksPermissions::getTaskType, bo.getTaskType()); |
|||
lqw.orderByAsc(DocumentTasksPermissions::getPriority).orderByDesc(DocumentTasksPermissions::getRoleId); |
|||
return lqw; |
|||
} |
|||
|
|||
/** |
|||
* 新增文档任务权限 |
|||
* |
|||
* @param bo 文档任务权限 |
|||
* @return 是否新增成功 |
|||
*/ |
|||
@Override |
|||
public Boolean insertByBo(DocumentTasksPermissionsBo bo) { |
|||
DocumentTasksPermissions add = MapstructUtils.convert(bo, DocumentTasksPermissions.class); |
|||
add.setTaskType(String.join(",", bo.getTaskTypeList())); |
|||
validEntityBeforeSave(add); |
|||
boolean flag = baseMapper.insert(add) > 0; |
|||
if (flag) { |
|||
bo.setId(add.getId()); |
|||
} |
|||
return flag; |
|||
} |
|||
|
|||
/** |
|||
* 修改文档任务权限 |
|||
* |
|||
* @param bo 文档任务权限 |
|||
* @return 是否修改成功 |
|||
*/ |
|||
@Override |
|||
public Boolean updateByBo(DocumentTasksPermissionsBo bo) { |
|||
DocumentTasksPermissions update = MapstructUtils.convert(bo, DocumentTasksPermissions.class); |
|||
update.setTaskType(String.join(",", bo.getTaskTypeList())); |
|||
validEntityBeforeSave(update); |
|||
return baseMapper.updateById(update) > 0; |
|||
} |
|||
|
|||
/** |
|||
* 保存前的数据校验 |
|||
*/ |
|||
private void validEntityBeforeSave(DocumentTasksPermissions entity){ |
|||
//TODO 做一些数据校验,如唯一约束
|
|||
Arrays.stream(entity.getTaskType().split(",")).forEach(t -> { |
|||
LambdaQueryWrapper<DocumentTasksPermissions> lqw = Wrappers.lambdaQuery(); |
|||
if (!StrUtil.isBlankIfStr(entity.getUserId())){ |
|||
lqw.eq(DocumentTasksPermissions::getUserId, entity.getUserId()); |
|||
} |
|||
if (!StrUtil.isBlankIfStr(entity.getRoleId())){ |
|||
lqw.eq(DocumentTasksPermissions::getRoleId, entity.getRoleId()); |
|||
} |
|||
lqw.like(DocumentTasksPermissions::getTaskType, t); |
|||
//id不能相同
|
|||
if(!StrUtil.isBlankIfStr(entity.getId())){ |
|||
lqw.ne(DocumentTasksPermissions::getId, entity.getId()); |
|||
} |
|||
Long count = baseMapper.selectCount(lqw); |
|||
if (count > 0 ) { |
|||
String label = dictTypeService.getDictLabel("document_task", t); |
|||
throw new IllegalArgumentException(label + "已有权限,不能重复添加!"); |
|||
} |
|||
}); |
|||
} |
|||
|
|||
/** |
|||
* 校验并批量删除文档任务权限信息 |
|||
* |
|||
* @param ids 待删除的主键集合 |
|||
* @param isValid 是否进行有效性校验 |
|||
* @return 是否删除成功 |
|||
*/ |
|||
@Override |
|||
public Boolean deleteWithValidByIds(Collection<String> ids, Boolean isValid) { |
|||
if(isValid){ |
|||
//TODO 做一些业务上的校验,判断是否需要校验
|
|||
} |
|||
return baseMapper.deleteByIds(ids) > 0; |
|||
} |
|||
|
|||
@Override |
|||
public List<SysUserVo> getUsersAll() { |
|||
LambdaQueryWrapper<SysUser> lqw = Wrappers.lambdaQuery(); |
|||
lqw.eq(SysUser::getStatus, 0); |
|||
return userMapper.selectVoList(lqw); |
|||
} |
|||
|
|||
@Override |
|||
public DocumentTasksPermissionsVo getTasksPermissionsByUserId(Long userId) { |
|||
// DocumentTasksPermissionsVo documentTasksPermissionsVo = baseMapper.selectDocumentPermissionsByUserId(userId);
|
|||
// return documentTasksPermissionsVo;
|
|||
return null; |
|||
} |
|||
} |
@ -0,0 +1,345 @@ |
|||
package org.dromara.productManagement.service.impl; |
|||
|
|||
import cn.dev33.satoken.stp.StpUtil; |
|||
import okhttp3.*; |
|||
import org.dromara.common.core.service.DictService; |
|||
import org.dromara.common.core.utils.MapstructUtils; |
|||
import org.dromara.common.core.utils.StringUtils; |
|||
import org.dromara.common.mybatis.core.page.TableDataInfo; |
|||
import org.dromara.common.mybatis.core.page.PageQuery; |
|||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|||
import lombok.RequiredArgsConstructor; |
|||
import org.dromara.common.oss.core.OssClient; |
|||
import org.dromara.common.oss.factory.OssFactory; |
|||
import org.dromara.common.satoken.utils.LoginHelper; |
|||
import org.dromara.productManagement.domain.DocumentTasksPermissionsDetail; |
|||
import org.dromara.productManagement.domain.vo.DocumentTasksPermissionsDetailVo; |
|||
import org.dromara.productManagement.domain.vo.DocumentTasksPermissionsVo; |
|||
import org.dromara.productManagement.mapper.DocumentTasksPermissionsDetailMapper; |
|||
import org.dromara.productManagement.mapper.DocumentTasksPermissionsMapper; |
|||
import org.dromara.productManagement.service.IDocAiService; |
|||
import org.dromara.system.domain.vo.SysOssVo; |
|||
import org.dromara.system.service.ISysOssService; |
|||
import org.springframework.beans.BeanUtils; |
|||
import org.springframework.beans.factory.annotation.Value; |
|||
import org.springframework.stereotype.Service; |
|||
import org.dromara.productManagement.domain.bo.DocumentTasksBo; |
|||
import org.dromara.productManagement.domain.vo.DocumentTasksVo; |
|||
import org.dromara.productManagement.domain.DocumentTasks; |
|||
import org.dromara.productManagement.mapper.DocumentTasksMapper; |
|||
import org.dromara.productManagement.service.IDocumentTasksService; |
|||
import org.springframework.transaction.annotation.Transactional; |
|||
|
|||
import java.io.IOException; |
|||
import java.io.InputStream; |
|||
import java.nio.file.Files; |
|||
import java.nio.file.Paths; |
|||
import java.nio.file.StandardCopyOption; |
|||
import java.text.SimpleDateFormat; |
|||
import java.util.Date; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
import java.util.Collection; |
|||
|
|||
/** |
|||
* 文档任务Service业务层处理 |
|||
* |
|||
* @author Lion Li |
|||
* @date 2024-10-22 |
|||
*/ |
|||
@RequiredArgsConstructor |
|||
@Service |
|||
@Transactional |
|||
public class DocumentTasksServiceImpl implements IDocumentTasksService { |
|||
private final OkHttpClient client = new OkHttpClient.Builder().build(); |
|||
private final DocumentTasksMapper baseMapper; |
|||
private final DocumentTasksPermissionsMapper documentTasksPermissionsMapper; |
|||
private final DocumentTasksPermissionsDetailMapper documentTasksPermissionsDetailMapper; |
|||
private final ISysOssService ossService; |
|||
private final IDocAiService docAiService; |
|||
private final DictService dictTypeService; |
|||
@Value("${chat.chatUrl}") |
|||
private String chatUrl; |
|||
/** |
|||
* 查询文档任务 |
|||
* |
|||
* @param id 主键 |
|||
* @return 文档任务 |
|||
*/ |
|||
@Override |
|||
public DocumentTasksVo queryById(Long id){ |
|||
return baseMapper.selectVoById(id); |
|||
} |
|||
|
|||
/** |
|||
* 分页查询文档任务列表 |
|||
* |
|||
* @param bo 查询条件 |
|||
* @param pageQuery 分页参数 |
|||
* @return 文档任务分页列表 |
|||
*/ |
|||
@Override |
|||
public TableDataInfo<DocumentTasksVo> queryPageList(DocumentTasksBo bo, PageQuery pageQuery) { |
|||
LambdaQueryWrapper<DocumentTasks> lqw = buildQueryWrapper(bo); |
|||
Page<DocumentTasksVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw); |
|||
return TableDataInfo.build(result); |
|||
} |
|||
|
|||
/** |
|||
* 查询符合条件的文档任务列表 |
|||
* |
|||
* @param bo 查询条件 |
|||
* @return 文档任务列表 |
|||
*/ |
|||
@Override |
|||
public List<DocumentTasksVo> queryList(DocumentTasksBo bo) { |
|||
LambdaQueryWrapper<DocumentTasks> lqw = buildQueryWrapper(bo); |
|||
return baseMapper.selectVoList(lqw); |
|||
} |
|||
|
|||
private LambdaQueryWrapper<DocumentTasks> buildQueryWrapper(DocumentTasksBo bo) { |
|||
Map<String, Object> params = bo.getParams(); |
|||
LambdaQueryWrapper<DocumentTasks> lqw = Wrappers.lambdaQuery(); |
|||
lqw.eq(StringUtils.isNotBlank(bo.getTaskName()), DocumentTasks::getTaskName, bo.getTaskName()); |
|||
// 处理 taskName 是 List<String> 的情况
|
|||
List<String> taskNames = bo.getTaskNameList(); |
|||
if (taskNames != null && !taskNames.isEmpty()) { |
|||
lqw.in(DocumentTasks::getTaskName, taskNames); |
|||
} |
|||
lqw.like(StringUtils.isNotBlank(bo.getDocumentName()), DocumentTasks::getDocumentName, bo.getDocumentName()); |
|||
lqw.eq(bo.getEstimatedCompletionTime() != null, DocumentTasks::getEstimatedCompletionTime, bo.getEstimatedCompletionTime()); |
|||
lqw.eq(StringUtils.isNotBlank(bo.getProgressStatus()), DocumentTasks::getProgressStatus, bo.getProgressStatus()); |
|||
return lqw; |
|||
} |
|||
|
|||
/** |
|||
* 新增文档任务 |
|||
* |
|||
* @param bo 文档任务 |
|||
* @return 是否新增成功 |
|||
*/ |
|||
@Override |
|||
@Transactional |
|||
public Boolean insertByBo(DocumentTasksBo bo) throws IOException, InterruptedException { |
|||
List<String> taskNames = bo.getTaskNameList(); |
|||
//验证当前用户是否有任务权限,如果是超级管理员,则不做权限验证
|
|||
if(!StpUtil.hasRole("superadmin")){ |
|||
taskNames.forEach(taskName -> { |
|||
Long userId = LoginHelper.getUserId(); |
|||
DocumentTasksPermissionsVo vo = documentTasksPermissionsMapper.selectDocumentPermissionsByUserIdAndTaskType(userId, taskName); |
|||
//任务是否有权限
|
|||
if(vo == null || !vo.getTaskType().contains(taskName)){ |
|||
String label = dictTypeService.getDictLabel("document_task", taskName); |
|||
throw new RuntimeException("无权操作["+label+"],请联系管理员"); |
|||
} |
|||
//任务是否数量超限
|
|||
//先查询数据库中是否有数据
|
|||
LambdaQueryWrapper<DocumentTasksPermissionsDetail> queryWrapper = new LambdaQueryWrapper<>(); |
|||
queryWrapper.eq(DocumentTasksPermissionsDetail::getUserId, userId); |
|||
queryWrapper.eq(DocumentTasksPermissionsDetail::getTaskType, taskName); |
|||
DocumentTasksPermissionsDetailVo documentTasksPermissionsDetailVo = documentTasksPermissionsDetailMapper.selectVoOne(queryWrapper); |
|||
if(documentTasksPermissionsDetailVo != null ){ |
|||
if( documentTasksPermissionsDetailVo.getRemainingDocumentCount()<=0){ |
|||
//超限
|
|||
String label = dictTypeService.getDictLabel("document_task", taskName); |
|||
throw new RuntimeException("任务["+label+"]数量超限,请联系管理员"); |
|||
}else{ |
|||
//数量减1
|
|||
DocumentTasksPermissionsDetail detail = new DocumentTasksPermissionsDetail(); |
|||
documentTasksPermissionsDetailVo.setRemainingDocumentCount(documentTasksPermissionsDetailVo.getRemainingDocumentCount()-1); |
|||
BeanUtils.copyProperties(documentTasksPermissionsDetailVo,detail); |
|||
documentTasksPermissionsDetailMapper.updateById(detail); |
|||
} |
|||
|
|||
} |
|||
if(documentTasksPermissionsDetailVo==null){ |
|||
//没有数据,则新增一条数据
|
|||
DocumentTasksPermissionsDetail documentTasksPermissionsDetail = new DocumentTasksPermissionsDetail(); |
|||
documentTasksPermissionsDetail.setUserId(userId); |
|||
documentTasksPermissionsDetail.setTaskType(taskName); |
|||
documentTasksPermissionsDetail.setRemainingDocumentCount(vo.getDailyDocumentCount()-1); |
|||
documentTasksPermissionsDetailMapper.insert(documentTasksPermissionsDetail); |
|||
} |
|||
|
|||
}); |
|||
} |
|||
boolean flag = false; |
|||
Long ossId = bo.getOssId(); |
|||
SysOssVo fileInfo = ossService.getById(ossId); |
|||
String fileName = fileInfo.getOriginalName(); |
|||
OssClient storage = OssFactory.instance(fileInfo.getService()); |
|||
InputStream inputStream = storage.getObjectContent(fileInfo.getUrl()); |
|||
String timestamp = new SimpleDateFormat("yyyyMMddHHmmss").format(new Date()); // 获取当前时间戳
|
|||
|
|||
// // 获取文件扩展名
|
|||
// String fileExtension = "";
|
|||
// int lastIndexOfDot = fileName.lastIndexOf('.');
|
|||
// if (lastIndexOfDot != -1) {
|
|||
// fileExtension = fileName.substring(lastIndexOfDot); // 获取文件扩展名
|
|||
// fileName = fileName.substring(0, lastIndexOfDot); // 获取文件名
|
|||
// }
|
|||
//
|
|||
// // 拼接新的文件名
|
|||
// String newFileName = fileName + "_" + timestamp + fileExtension;
|
|||
// String s = docAiService.uploadFileByStream(inputStream, newFileName,"/sse/upload");
|
|||
// if(!s.equals("1")){
|
|||
// throw new RuntimeException(s);
|
|||
// }
|
|||
bo.setDocumentName(fileInfo.getOriginalName()); |
|||
if (taskNames != null && !taskNames.isEmpty()) { |
|||
for (String taskName : taskNames) { |
|||
// 创建 DocumentTasks 实体并设置属性
|
|||
DocumentTasks add = MapstructUtils.convert(bo, DocumentTasks.class); |
|||
add.setTaskName(taskName); |
|||
// 验证实体并保存
|
|||
validEntityBeforeSave(add); |
|||
// 发送请求
|
|||
// if(taskName.equals("DocumentEvaluation")){
|
|||
// String s1 = docAiService.uploadFileByStream(inputStream, newFileName,"/xysse/upload");
|
|||
// if(!s1.equals("1")){
|
|||
// throw new RuntimeException(s1);
|
|||
// }
|
|||
// }
|
|||
// if(!fileExtension.contains("docx")){
|
|||
// newFileName = fileName + "_" + timestamp + ".docx";
|
|||
// }
|
|||
//参数 add.id,taskName。newFileName;
|
|||
flag = baseMapper.insert(add) > 0; |
|||
//获取当前用户的任务优先级
|
|||
DocumentTasksPermissionsVo documentTasksPermissionsVo = documentTasksPermissionsMapper.selectDocumentPermissionsByUserIdAndTaskType(LoginHelper.getUserId(),taskName); |
|||
Long priority = documentTasksPermissionsVo.getPriority(); |
|||
// sendRequest(add.getId(), taskName, "uploads/"+newFileName, priority);
|
|||
|
|||
if (!flag) { |
|||
throw new RuntimeException("新增文档任务失败"); |
|||
} |
|||
} |
|||
} |
|||
|
|||
return flag; |
|||
} |
|||
private void sendRequest(String taskId, String taskName, String filename,Long priority) { |
|||
// String url = getUrlByTaskName(taskName);
|
|||
String url = chatUrl+"/back/taskStart"; |
|||
if (url == null) { |
|||
throw new IllegalArgumentException("无效的任务名称: " + taskName); |
|||
} |
|||
|
|||
Request request = new Request.Builder() |
|||
.url(url+"?userId="+ LoginHelper.getUserId()+"&taskId="+taskId+"&filename="+filename+"&taskName="+taskName+"&priority="+priority) |
|||
.build(); |
|||
|
|||
// 使用异步调用
|
|||
client.newCall(request).enqueue(new Callback() { |
|||
@Override |
|||
public void onFailure(Call call, IOException e) { |
|||
e.printStackTrace(); // 处理请求失败
|
|||
} |
|||
|
|||
@Override |
|||
public void onResponse(Call call, Response response) throws IOException { |
|||
// 忽略返回内容
|
|||
response.close(); // 确保响应被关闭
|
|||
} |
|||
}); |
|||
} |
|||
|
|||
private String getUrlByTaskName(String taskName) { |
|||
switch (taskName) { |
|||
case "checkRepeatText": |
|||
return chatUrl+"/back/checkRepeatText"; |
|||
case "checkPlaceName": |
|||
return chatUrl+"/back/checkPlaceName"; |
|||
case "checkCompanyName": |
|||
return chatUrl+"/back/checkCompanyName"; |
|||
case "checkDocumentError": |
|||
return chatUrl+"/back/checkDocumentErrorWeb"; |
|||
case "checkTitleName": |
|||
return chatUrl+"/back/checkTitleName"; |
|||
case "DocumentEvaluation": |
|||
return chatUrl+"/xyback/documentEvaluate"; |
|||
default: |
|||
return null; |
|||
} |
|||
} |
|||
/** |
|||
* 修改文档任务 |
|||
* |
|||
* @param bo 文档任务 |
|||
* @return 是否修改成功 |
|||
*/ |
|||
@Override |
|||
public Boolean updateByBo(DocumentTasksBo bo) { |
|||
// DocumentTasks update = MapstructUtils.convert(bo, DocumentTasks.class);
|
|||
//// validEntityBeforeSave(update);
|
|||
//// return baseMapper.updateById(update) > 0;
|
|||
List<String> taskNames = bo.getTaskNameList(); |
|||
boolean flag = false; |
|||
|
|||
if (taskNames != null && !taskNames.isEmpty()) { |
|||
for (String taskName : taskNames) { |
|||
// 创建 DocumentTasks 实体并设置属性
|
|||
DocumentTasks update = MapstructUtils.convert(bo, DocumentTasks.class); |
|||
update.setTaskName(taskName); |
|||
|
|||
// 验证实体并保存
|
|||
validEntityBeforeSave(update); |
|||
flag = baseMapper.updateById(update) > 0; |
|||
|
|||
if (!flag) { |
|||
throw new RuntimeException("新增文档任务失败"); |
|||
} |
|||
} |
|||
} |
|||
|
|||
return flag; |
|||
} |
|||
|
|||
/** |
|||
* 保存前的数据校验 |
|||
*/ |
|||
private void validEntityBeforeSave(DocumentTasks entity){ |
|||
//TODO 做一些数据校验,如唯一约束
|
|||
} |
|||
|
|||
/** |
|||
* 校验并批量删除文档任务信息 |
|||
* |
|||
* @param ids 待删除的主键集合 |
|||
* @param isValid 是否进行有效性校验 |
|||
* @return 是否删除成功 |
|||
*/ |
|||
@Override |
|||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) { |
|||
if(isValid){ |
|||
//TODO 做一些业务上的校验,判断是否需要校验
|
|||
} |
|||
return baseMapper.deleteByIds(ids) > 0; |
|||
} |
|||
|
|||
@Override |
|||
public int stopTask(Long id) { |
|||
String url = chatUrl + "/back/stopTask"; |
|||
//查询任务名称
|
|||
DocumentTasksVo documentTasksVo = baseMapper.selectVoById(id); |
|||
String taskName = documentTasksVo.getTaskName(); |
|||
//发送请求
|
|||
Request request = new Request.Builder() |
|||
.url(url+"?taskId="+id+"&taskName="+taskName) |
|||
.build(); |
|||
|
|||
//使用同步调用
|
|||
try (Response response = client.newCall(request).execute()) { |
|||
if (response.isSuccessful()) { |
|||
return response.code(); |
|||
} else { |
|||
throw new RuntimeException("任务暂停失败: " + response); |
|||
} |
|||
} catch (IOException e) { |
|||
e.printStackTrace(); |
|||
} |
|||
return 0; |
|||
} |
|||
} |
@ -0,0 +1,179 @@ |
|||
package org.dromara.productManagement.service.impl; |
|||
|
|||
import cn.hutool.core.util.ObjectUtil; |
|||
import okhttp3.*; |
|||
import org.dromara.common.core.domain.R; |
|||
import org.dromara.common.core.service.OssService; |
|||
import org.dromara.common.core.utils.MapstructUtils; |
|||
import org.dromara.common.core.utils.StringUtils; |
|||
import org.dromara.common.mybatis.core.page.TableDataInfo; |
|||
import org.dromara.common.mybatis.core.page.PageQuery; |
|||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|||
import lombok.RequiredArgsConstructor; |
|||
import org.dromara.system.domain.vo.SysOssUploadVo; |
|||
import org.dromara.system.domain.vo.SysOssVo; |
|||
import org.dromara.system.service.ISysOssService; |
|||
import org.springframework.beans.factory.annotation.Value; |
|||
import org.springframework.http.MediaType; |
|||
import org.springframework.stereotype.Service; |
|||
import org.dromara.productManagement.domain.bo.FileReadInfoBo; |
|||
import org.dromara.productManagement.domain.vo.FileReadInfoVo; |
|||
import org.dromara.productManagement.domain.FileReadInfo; |
|||
import org.dromara.productManagement.mapper.FileReadInfoMapper; |
|||
import org.dromara.productManagement.service.IFileReadInfoService; |
|||
import org.springframework.web.multipart.MultipartFile; |
|||
|
|||
import java.io.File; |
|||
import java.io.IOException; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
import java.util.Collection; |
|||
import java.util.concurrent.TimeUnit; |
|||
|
|||
/** |
|||
* 文件处理信息表Service业务层处理 |
|||
* |
|||
* @author Lion Li |
|||
* @date 2024-09-20 |
|||
*/ |
|||
@RequiredArgsConstructor |
|||
@Service |
|||
public class FileReadInfoServiceImpl implements IFileReadInfoService { |
|||
|
|||
private final FileReadInfoMapper baseMapper; |
|||
private final ISysOssService ossService; |
|||
@Value("${chat.filePath}") |
|||
private String chatFilePath; |
|||
@Value("${chat.chatUrl}") |
|||
private String chatUrl; |
|||
private final OkHttpClient client = new OkHttpClient.Builder() |
|||
.connectTimeout(300, TimeUnit.SECONDS)//连接超时(单位:秒)
|
|||
.callTimeout(1200, TimeUnit.SECONDS)//整个流程耗费的超时时间(单位:秒)--很少人使用
|
|||
.pingInterval(50, TimeUnit.SECONDS)//websocket轮训间隔(单位:秒)
|
|||
.readTimeout(600, TimeUnit.SECONDS)//读取超时(单位:秒)
|
|||
.writeTimeout(600, TimeUnit.SECONDS)//写入超时(单位:秒)
|
|||
.build(); |
|||
/** |
|||
* 查询文件处理信息表 |
|||
* |
|||
* @param id 主键 |
|||
* @return 文件处理信息表 |
|||
*/ |
|||
@Override |
|||
public FileReadInfoVo queryById(Long id){ |
|||
return baseMapper.selectVoById(id); |
|||
} |
|||
|
|||
/** |
|||
* 分页查询文件处理信息表列表 |
|||
* |
|||
* @param bo 查询条件 |
|||
* @param pageQuery 分页参数 |
|||
* @return 文件处理信息表分页列表 |
|||
*/ |
|||
@Override |
|||
public TableDataInfo<FileReadInfoVo> queryPageList(FileReadInfoBo bo, PageQuery pageQuery) { |
|||
LambdaQueryWrapper<FileReadInfo> lqw = buildQueryWrapper(bo); |
|||
Page<FileReadInfoVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw); |
|||
return TableDataInfo.build(result); |
|||
} |
|||
|
|||
/** |
|||
* 查询符合条件的文件处理信息表列表 |
|||
* |
|||
* @param bo 查询条件 |
|||
* @return 文件处理信息表列表 |
|||
*/ |
|||
@Override |
|||
public List<FileReadInfoVo> queryList(FileReadInfoBo bo) { |
|||
LambdaQueryWrapper<FileReadInfo> lqw = buildQueryWrapper(bo); |
|||
return baseMapper.selectVoList(lqw); |
|||
} |
|||
|
|||
private LambdaQueryWrapper<FileReadInfo> buildQueryWrapper(FileReadInfoBo bo) { |
|||
Map<String, Object> params = bo.getParams(); |
|||
LambdaQueryWrapper<FileReadInfo> lqw = Wrappers.lambdaQuery(); |
|||
lqw.like(StringUtils.isNotBlank(bo.getFileName()), FileReadInfo::getFileName, bo.getFileName()); |
|||
lqw.eq(StringUtils.isNotBlank(bo.getFileStatus()), FileReadInfo::getFileStatus, bo.getFileStatus()); |
|||
lqw.eq(StringUtils.isNotBlank(bo.getFileReadMode()), FileReadInfo::getFileReadMode, bo.getFileReadMode()); |
|||
lqw.eq(StringUtils.isNotBlank(bo.getFeedback()), FileReadInfo::getFeedback, bo.getFeedback()); |
|||
return lqw; |
|||
} |
|||
|
|||
/** |
|||
* 新增文件处理信息表 |
|||
* |
|||
* @param bo 文件处理信息表 |
|||
* @return 是否新增成功 |
|||
*/ |
|||
@Override |
|||
public Boolean insertByBo(FileReadInfoBo bo) { |
|||
FileReadInfo add = MapstructUtils.convert(bo, FileReadInfo.class); |
|||
validEntityBeforeSave(add); |
|||
boolean flag = baseMapper.insert(add) > 0; |
|||
if (flag) { |
|||
bo.setId(add.getId()); |
|||
} |
|||
return flag; |
|||
} |
|||
|
|||
/** |
|||
* 修改文件处理信息表 |
|||
* |
|||
* @param bo 文件处理信息表 |
|||
* @return 是否修改成功 |
|||
*/ |
|||
@Override |
|||
public Boolean updateByBo(FileReadInfoBo bo) { |
|||
FileReadInfo update = MapstructUtils.convert(bo, FileReadInfo.class); |
|||
validEntityBeforeSave(update); |
|||
return baseMapper.updateById(update) > 0; |
|||
} |
|||
|
|||
/** |
|||
* 保存前的数据校验 |
|||
*/ |
|||
private void validEntityBeforeSave(FileReadInfo entity){ |
|||
//TODO 做一些数据校验,如唯一约束
|
|||
} |
|||
|
|||
/** |
|||
* 校验并批量删除文件处理信息表信息 |
|||
* |
|||
* @param ids 待删除的主键集合 |
|||
* @param isValid 是否进行有效性校验 |
|||
* @return 是否删除成功 |
|||
*/ |
|||
@Override |
|||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) { |
|||
if(isValid){ |
|||
//TODO 做一些业务上的校验,判断是否需要校验
|
|||
} |
|||
return baseMapper.deleteByIds(ids) > 0; |
|||
} |
|||
|
|||
@Override |
|||
public void importData(MultipartFile file, String context) throws IOException { |
|||
RequestBody requestBody = new MultipartBody.Builder() |
|||
.setType(MultipartBody.FORM) |
|||
.addFormDataPart("file", file.getName(), |
|||
RequestBody.create(okhttp3.MediaType.parse(MediaType.APPLICATION_OCTET_STREAM_VALUE), file.getBytes())) |
|||
.build(); |
|||
Request request = new Request.Builder() |
|||
.url(chatUrl+"/upload") // 替换为你的Flask服务器地址
|
|||
.post(requestBody) |
|||
.build(); |
|||
try (Response response = client.newCall(request).execute()) { |
|||
if (response.isSuccessful()) { |
|||
SysOssVo oss = ossService.upload(file); |
|||
String fileName = oss.getFileName(); |
|||
} |
|||
} catch (IOException e) { |
|||
e.printStackTrace(); |
|||
} |
|||
|
|||
} |
|||
|
|||
} |
@ -0,0 +1,7 @@ |
|||
<?xml version="1.0" encoding="UTF-8" ?> |
|||
<!DOCTYPE mapper |
|||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
|||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
|||
<mapper namespace="org.dromara.productManagement.mapper.DocumentTaskResultsMapper"> |
|||
|
|||
</mapper> |
@ -0,0 +1,7 @@ |
|||
<?xml version="1.0" encoding="UTF-8" ?> |
|||
<!DOCTYPE mapper |
|||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
|||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
|||
<mapper namespace="org.dromara.productManagement.mapper.DocumentTasksMapper"> |
|||
|
|||
</mapper> |
@ -0,0 +1,7 @@ |
|||
<?xml version="1.0" encoding="UTF-8" ?> |
|||
<!DOCTYPE mapper |
|||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
|||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
|||
<mapper namespace="org.dromara.productManagement.mapper.DocumentTasksPermissionsDetailMapper"> |
|||
|
|||
</mapper> |
@ -0,0 +1,28 @@ |
|||
<?xml version="1.0" encoding="UTF-8" ?> |
|||
<!DOCTYPE mapper |
|||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
|||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
|||
<mapper namespace="org.dromara.productManagement.mapper.DocumentTasksPermissionsMapper"> |
|||
<select id="selectDocumentPermissionsByUserIdAndTaskType" resultType="org.dromara.productManagement.domain.vo.DocumentTasksPermissionsVo"> |
|||
SELECT * |
|||
FROM ( |
|||
SELECT tp.* |
|||
FROM document_tasks_permissions tp |
|||
WHERE tp.user_id = #{userId} |
|||
|
|||
UNION ALL |
|||
|
|||
SELECT p.* |
|||
FROM document_tasks_permissions p |
|||
JOIN sys_user_role ur ON p.role_id = ur.role_id |
|||
WHERE ur.user_id = #{userId} |
|||
AND p.del_flag = '0' |
|||
AND p.user_id IS NULL |
|||
) AS combined_results |
|||
<if test="taskType!= null and taskType!= ''"> |
|||
WHERE combined_results.task_type LIKE CONCAT('%', #{taskType}, '%') |
|||
</if> |
|||
ORDER BY user_id DESC, priority DESC |
|||
LIMIT 1; |
|||
</select> |
|||
</mapper> |
Loading…
Reference in new issue