Browse Source

新增ai代码

ai_dev
zhouhaibin 6 months ago
parent
commit
5244faf3f9
  1. 104
      ruoyi-admin/pom.xml
  2. 68
      ruoyi-admin/src/main/resources/application-dev.yml
  3. 37
      ruoyi-admin/src/main/resources/application-prod.yml
  4. 286
      ruoyi-admin/src/main/resources/application-test.yml
  5. 9
      ruoyi-admin/src/main/resources/application.yml
  6. 147
      ruoyi-admin/src/test/java/org/dromara/test/TagUnitTest.java
  7. 12
      ruoyi-common/ruoyi-common-sse/pom.xml
  8. 21
      ruoyi-common/ruoyi-common-sse/src/main/java/org/dromara/common/sse/dto/ChatGlmDto.java
  9. 33
      ruoyi-common/ruoyi-common-sse/src/main/java/org/dromara/common/sse/utils/ExecuteSSEUtil.java
  10. 2
      ruoyi-extend/ruoyi-snailjob-server/src/main/resources/application-dev.yml
  11. 2
      ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/controller/system/SysOssController.java
  12. 2
      script/sql/snail_job.sql
  13. 52
      zaojiaManagement/zaojia-productManagement/pom.xml
  14. 133
      zaojiaManagement/zaojia-productManagement/src/main/java/org/dromara/productManagement/controller/DocAiController.java
  15. 115
      zaojiaManagement/zaojia-productManagement/src/main/java/org/dromara/productManagement/controller/DocumentTaskResultsController.java
  16. 112
      zaojiaManagement/zaojia-productManagement/src/main/java/org/dromara/productManagement/controller/DocumentTasksController.java
  17. 125
      zaojiaManagement/zaojia-productManagement/src/main/java/org/dromara/productManagement/controller/DocumentTasksPermissionsController.java
  18. 105
      zaojiaManagement/zaojia-productManagement/src/main/java/org/dromara/productManagement/controller/DocumentTasksPermissionsDetailController.java
  19. 125
      zaojiaManagement/zaojia-productManagement/src/main/java/org/dromara/productManagement/controller/FileReadInfoController.java
  20. 622
      zaojiaManagement/zaojia-productManagement/src/main/java/org/dromara/productManagement/controller/Qwen72bController.java
  21. 129
      zaojiaManagement/zaojia-productManagement/src/main/java/org/dromara/productManagement/domain/DocumentEvaluationResult.java
  22. 53
      zaojiaManagement/zaojia-productManagement/src/main/java/org/dromara/productManagement/domain/DocumentTaskResults.java
  23. 66
      zaojiaManagement/zaojia-productManagement/src/main/java/org/dromara/productManagement/domain/DocumentTasks.java
  24. 69
      zaojiaManagement/zaojia-productManagement/src/main/java/org/dromara/productManagement/domain/DocumentTasksPermissions.java
  25. 58
      zaojiaManagement/zaojia-productManagement/src/main/java/org/dromara/productManagement/domain/DocumentTasksPermissionsDetail.java
  26. 51
      zaojiaManagement/zaojia-productManagement/src/main/java/org/dromara/productManagement/domain/FileReadInfo.java
  27. 39
      zaojiaManagement/zaojia-productManagement/src/main/java/org/dromara/productManagement/domain/bo/DocumentTaskResultsBo.java
  28. 58
      zaojiaManagement/zaojia-productManagement/src/main/java/org/dromara/productManagement/domain/bo/DocumentTasksBo.java
  29. 65
      zaojiaManagement/zaojia-productManagement/src/main/java/org/dromara/productManagement/domain/bo/DocumentTasksPermissionsBo.java
  30. 47
      zaojiaManagement/zaojia-productManagement/src/main/java/org/dromara/productManagement/domain/bo/DocumentTasksPermissionsDetailBo.java
  31. 54
      zaojiaManagement/zaojia-productManagement/src/main/java/org/dromara/productManagement/domain/bo/FileReadInfoBo.java
  32. 35
      zaojiaManagement/zaojia-productManagement/src/main/java/org/dromara/productManagement/domain/vo/DocumentTaskResultsVo.java
  33. 57
      zaojiaManagement/zaojia-productManagement/src/main/java/org/dromara/productManagement/domain/vo/DocumentTasksPermissionsDetailVo.java
  34. 74
      zaojiaManagement/zaojia-productManagement/src/main/java/org/dromara/productManagement/domain/vo/DocumentTasksPermissionsVo.java
  35. 62
      zaojiaManagement/zaojia-productManagement/src/main/java/org/dromara/productManagement/domain/vo/DocumentTasksVo.java
  36. 63
      zaojiaManagement/zaojia-productManagement/src/main/java/org/dromara/productManagement/domain/vo/FileReadInfoVo.java
  37. 22
      zaojiaManagement/zaojia-productManagement/src/main/java/org/dromara/productManagement/job/Qwen72bJobExecutor.java
  38. 15
      zaojiaManagement/zaojia-productManagement/src/main/java/org/dromara/productManagement/mapper/DocumentTaskResultsMapper.java
  39. 21
      zaojiaManagement/zaojia-productManagement/src/main/java/org/dromara/productManagement/mapper/DocumentTasksMapper.java
  40. 15
      zaojiaManagement/zaojia-productManagement/src/main/java/org/dromara/productManagement/mapper/DocumentTasksPermissionsDetailMapper.java
  41. 17
      zaojiaManagement/zaojia-productManagement/src/main/java/org/dromara/productManagement/mapper/DocumentTasksPermissionsMapper.java
  42. 15
      zaojiaManagement/zaojia-productManagement/src/main/java/org/dromara/productManagement/mapper/FileReadInfoMapper.java
  43. 1
      zaojiaManagement/zaojia-productManagement/src/main/java/org/dromara/productManagement/mapper/PmgCompanyProductModelDetailsMapper.java
  44. 41
      zaojiaManagement/zaojia-productManagement/src/main/java/org/dromara/productManagement/service/IDocAiService.java
  45. 70
      zaojiaManagement/zaojia-productManagement/src/main/java/org/dromara/productManagement/service/IDocumentTaskResultsService.java
  46. 68
      zaojiaManagement/zaojia-productManagement/src/main/java/org/dromara/productManagement/service/IDocumentTasksPermissionsDetailService.java
  47. 74
      zaojiaManagement/zaojia-productManagement/src/main/java/org/dromara/productManagement/service/IDocumentTasksPermissionsService.java
  48. 71
      zaojiaManagement/zaojia-productManagement/src/main/java/org/dromara/productManagement/service/IDocumentTasksService.java
  49. 72
      zaojiaManagement/zaojia-productManagement/src/main/java/org/dromara/productManagement/service/IFileReadInfoService.java
  50. 178
      zaojiaManagement/zaojia-productManagement/src/main/java/org/dromara/productManagement/service/impl/DocAiServiceImpl.java
  51. 138
      zaojiaManagement/zaojia-productManagement/src/main/java/org/dromara/productManagement/service/impl/DocumentTaskResultsServiceImpl.java
  52. 131
      zaojiaManagement/zaojia-productManagement/src/main/java/org/dromara/productManagement/service/impl/DocumentTasksPermissionsDetailServiceImpl.java
  53. 181
      zaojiaManagement/zaojia-productManagement/src/main/java/org/dromara/productManagement/service/impl/DocumentTasksPermissionsServiceImpl.java
  54. 345
      zaojiaManagement/zaojia-productManagement/src/main/java/org/dromara/productManagement/service/impl/DocumentTasksServiceImpl.java
  55. 179
      zaojiaManagement/zaojia-productManagement/src/main/java/org/dromara/productManagement/service/impl/FileReadInfoServiceImpl.java
  56. 2
      zaojiaManagement/zaojia-productManagement/src/main/java/org/dromara/productManagement/service/impl/PmgSupplierProductsServiceImpl.java
  57. 7
      zaojiaManagement/zaojia-productManagement/src/main/resources/mapper/productManagement/DocumentTaskResultsMapper.xml
  58. 7
      zaojiaManagement/zaojia-productManagement/src/main/resources/mapper/productManagement/DocumentTasksMapper.xml
  59. 7
      zaojiaManagement/zaojia-productManagement/src/main/resources/mapper/productManagement/DocumentTasksPermissionsDetailMapper.xml
  60. 28
      zaojiaManagement/zaojia-productManagement/src/main/resources/mapper/productManagement/DocumentTasksPermissionsMapper.xml

104
ruoyi-admin/pom.xml

@ -108,6 +108,83 @@
<groupId>org.dromara</groupId>
<artifactId>zaojia-productManagement</artifactId>
</dependency>
<!-- Apache POI核心库 -->
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>5.2.0</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-scratchpad</artifactId>
<version>5.2.0</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>5.2.0</version>
<exclusions>
<!-- <exclusion>-->
<!-- <artifactId>xmlbeans</artifactId>-->
<!-- <groupId>org.apache.xmlbeans</groupId>-->
<!-- </exclusion>-->
<!-- <exclusion>-->
<!-- <artifactId>poi-ooxml-lite</artifactId>-->
<!-- <groupId>org.apache.poi</groupId>-->
<!-- </exclusion>-->
</exclusions>
</dependency>
<dependency>
<groupId>fr.opensagres.xdocreport</groupId>
<artifactId>fr.opensagres.xdocreport.document</artifactId>
<version>2.0.1</version>
</dependency>
<dependency>
<groupId>fr.opensagres.xdocreport</groupId>
<artifactId>org.apache.poi.xwpf.converter.xhtml</artifactId>
<version>1.0.6</version>
</dependency>
<dependency>
<groupId>fr.opensagres.xdocreport</groupId>
<artifactId>fr.opensagres.poi.xwpf.converter.xhtml</artifactId>
<version>2.0.3</version>
<exclusions>
<exclusion>
<artifactId>xmlbeans</artifactId>
<groupId>org.apache.xmlbeans</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>fr.opensagres.xdocreport</groupId>
<artifactId>org.apache.poi.xwpf.converter.core</artifactId>
<version>1.0.6</version>
<exclusions>
<exclusion>
<artifactId>ooxml-schemas</artifactId>
<groupId>org.apache.poi</groupId>
</exclusion>
</exclusions>
</dependency>
<!-- <dependency>-->
<!-- <groupId>fr.opensagres.xdocreport</groupId>-->
<!-- <artifactId>org.apache.poi.xwpf.converter.core</artifactId>-->
<!-- <version>1.0.6</version>-->
<!-- </dependency>-->
<!-- <dependency>-->
<!-- <groupId>fr.opensagres.xdocreport</groupId>-->
<!-- <artifactId>org.apache.poi.xwpf.converter.xhtml</artifactId>-->
<!-- <version>1.0.6</version>-->
<!-- </dependency>-->
<!-- skywalking 整合 logback -->
<!-- <dependency>-->
<!-- <groupId>org.apache.skywalking</groupId>-->
@ -151,6 +228,33 @@
<warName>${project.artifactId}</warName>
</configuration>
</plugin>
<!-- <plugin>-->
<!-- &lt;!&ndash; https://gitee.com/roseboy/classfinal &ndash;&gt;-->
<!--&lt;!&ndash; <groupId>net.roseboy</groupId>&ndash;&gt;-->
<!--&lt;!&ndash; <artifactId>classfinal-maven-plugin</artifactId>&ndash;&gt;-->
<!-- <groupId>cn.ywyu</groupId>-->
<!-- <artifactId>classfinal-maven-plugin</artifactId>-->
<!-- <version>1.3.2</version>-->
<!-- <configuration>-->
<!-- &lt;!&ndash;加密密码,如果是#号,则使用无密码模式加密,【加密后没有pom文件,不用担心泄漏】&ndash;&gt;-->
<!-- <password>123456</password>-->
<!-- &lt;!&ndash;加密的包名(可为空,多个用","分割)&ndash;&gt;-->
<!-- <packages>org.dromara</packages>-->
<!-- &lt;!&ndash;需要加密的配置文件,一般是classes目录下的yml或properties文件(可为空,多个用","分割)&ndash;&gt;-->
<!-- <cfgfiles>*.properties,*.yml,/mapper/**/*Mapper.xml</cfgfiles>-->
<!-- &lt;!&ndash;外部依赖的jar目录,例如/tomcat/lib(可为空,多个用","分割)&ndash;&gt;-->
<!-- &lt;!&ndash;<classpath></classpath>&ndash;&gt;-->
<!-- <libjars>zaojia-productManagement-5.2.2.jar</libjars>-->
<!-- </configuration>-->
<!-- <executions>-->
<!-- <execution>-->
<!-- <phase>package</phase>-->
<!-- <goals>-->
<!-- <goal>classFinal</goal>-->
<!-- </goals>-->
<!-- </execution>-->
<!-- </executions>-->
<!-- </plugin>-->
</plugins>
</build>

68
ruoyi-admin/src/main/resources/application-dev.yml

@ -10,12 +10,14 @@ spring.boot.admin.client:
userpassword: ${spring.boot.admin.client.password}
username: ruoyi
password: 123456
server:
# 端口号
port: 8080
--- # snail-job 配置
snail-job:
enabled: false
enabled: true
# 需要在 SnailJob 后台组管理创建对应名称的组,然后创建任务的时候选择对应的组,才能正确分派任务
group: "ruoyi_group"
group: "guoyanGroup"
# SnailJob 接入验证令牌 详见 script/sql/snail_job.sql `sj_group_config` 表
token: "SJ_cKqBTPzCsWA3VyuCfFoccmuIEGXjr5KT"
server:
@ -45,17 +47,20 @@ spring:
driverClassName: com.mysql.cj.jdbc.Driver
# jdbc 所有参数配置参考 https://lionli.blog.csdn.net/article/details/122018562
# rewriteBatchedStatements=true 批处理优化 大幅提升批量插入更新删除性能(对数据库有性能损耗 使用批量操作应考虑性能问题)
url: jdbc:mysql://localhost:3306/zaojia?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true
# url: jdbc:mysql://localhost:3306/zaojia?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true
# username: root
# password: root
url: jdbc:mysql://218.246.6.174: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
# 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
@ -100,7 +105,7 @@ spring.data:
# 数据库索引
database: 0
# redis 密码必须配置
#password: ruoyi123
# password: root
# 连接超时时间
timeout: 10s
# 是否开启ssl
@ -259,20 +264,25 @@ justauth:
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
#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: D:\python项目39
#http://localhost %http://183.136.156.2:50000
chatUrl: http://183.136.156.2:50000

37
ruoyi-admin/src/main/resources/application-prod.yml

@ -13,10 +13,12 @@ spring.boot.admin.client:
userpassword: ${spring.boot.admin.client.password}
username: ruoyi
password: 123456
server:
# 端口号
port: 8081
--- # snail-job 配置
snail-job:
enabled: true
enabled: false
# 需要在 SnailJob 后台组管理创建对应名称的组,然后创建任务的时候选择对应的组,才能正确分派任务
group: "ruoyi_group"
# SnailJob 接入验证令牌 详见 script/sql/snail_job.sql `sj_group_config` 表
@ -48,7 +50,7 @@ spring:
driverClassName: com.mysql.cj.jdbc.Driver
# jdbc 所有参数配置参考 https://lionli.blog.csdn.net/article/details/122018562
# rewriteBatchedStatements=true 批处理优化 大幅提升批量插入更新删除性能(对数据库有性能损耗 使用批量操作应考虑性能问题)
url: jdbc:mysql://localhost:3306/ry-vue?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true
url: jdbc:mysql://localhost:3306/zaojia?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true
username: root
password: root
# 从库数据源
@ -56,9 +58,9 @@ spring:
lazy: true
type: ${spring.datasource.type}
driverClassName: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://localhost:3306/ry-vue?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true
username:
password:
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
@ -103,7 +105,7 @@ spring.data:
# 数据库索引
database: 0
# redis 密码必须配置
password: ruoyi123
password: root
# 连接超时时间
timeout: 10s
# 是否开启ssl
@ -261,3 +263,24 @@ justauth:
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:50000

286
ruoyi-admin/src/main/resources/application-test.yml

@ -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

9
ruoyi-admin/src/main/resources/application.yml

@ -22,7 +22,7 @@ captcha:
# 开发环境配置
server:
# 服务器的HTTP端口,默认为8080
port: 8080
# port: 8080
servlet:
# 应用的访问路径
context-path: /
@ -70,14 +70,15 @@ spring:
# 国际化资源文件路径
basename: i18n/messages
profiles:
active: @profiles.active@
#@profiles.active@
active: dev
# 文件上传
servlet:
multipart:
# 单个文件大小
max-file-size: 10MB
max-file-size: 1000MB
# 设置总上传的文件大小
max-request-size: 20MB
max-request-size: 1000MB
mvc:
# 设置静态资源路径 防止所有请求都去查静态资源
static-path-pattern: /static/**

147
ruoyi-admin/src/test/java/org/dromara/test/TagUnitTest.java

@ -1,8 +1,30 @@
package org.dromara.test;
import org.apache.poi.hwpf.HWPFDocument;
import org.apache.poi.hwpf.converter.PicturesManager;
import org.apache.poi.hwpf.converter.WordToHtmlConverter;
import org.apache.poi.hwpf.usermodel.PictureType;
import org.apache.poi.xwpf.converter.xhtml.XHTMLConverter;
import org.apache.poi.xwpf.converter.xhtml.XHTMLOptions;
import org.apache.poi.xwpf.usermodel.XWPFDocument;
import org.w3c.dom.Document;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.transform.OutputKeys;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import java.io.*;
import org.junit.jupiter.api.*;
import org.springframework.boot.test.context.SpringBootTest;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.FileInputStream;
/**
* 标签单元测试案例
*
@ -15,40 +37,109 @@ public class TagUnitTest {
@Tag("dev")
@DisplayName("测试 @Tag dev")
@Test
public void testTagDev() {
System.out.println("dev");
}
public void testTagDev() throws Exception {
String inputFilePath="C:\\Users\\gy051\\Desktop\\1223.doc";
String outputFilePath="D:\\JPG\\test.html";
InputStream is = new FileInputStream(inputFilePath);
// InputStream is = FileHelper.convertWordToUTF8Stream(inputFilePath);
System.out.println("outputFilePath:"+outputFilePath);
HWPFDocument wordDocument = new HWPFDocument(is);
WordToHtmlConverter wordToHtmlConverter = new WordToHtmlConverter(DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument());
String rootPath = "D:\\JPG\\";
final int[] fileIndex = {0};
wordToHtmlConverter.setPicturesManager(new PicturesManager() {
@Tag("prod")
@DisplayName("测试 @Tag prod")
@Test
public void testTagProd() {
System.out.println("prod");
}
@Override
public String savePicture(byte[] bytes, PictureType pictureType, String s, float v, float v1) {
fileIndex[0]++;
File file = new File(rootPath + fileIndex[0]+".png");
try {
FileOutputStream out = new FileOutputStream(file);
out.write(bytes);
out.close();
} catch (Exception e) {
e.printStackTrace();
}
return fileIndex[0]+".png"; // 返回图片的相对路径或者URL
}
@Tag("local")
@DisplayName("测试 @Tag local")
@Test
public void testTagLocal() {
System.out.println("local");
}
@Tag("exclude")
@DisplayName("测试 @Tag exclude")
@Test
public void testTagExclude() {
System.out.println("exclude");
}
});
wordToHtmlConverter.processDocument(wordDocument);
Document htmlDocument = wordToHtmlConverter.getDocument();
@BeforeEach
public void testBeforeEach() {
System.out.println("@BeforeEach ==================");
}
// 将Document转换为XHTML
StringWriter writer = new StringWriter();
TransformerFactory transformerFactory = TransformerFactory.newInstance();
Transformer transformer = transformerFactory.newTransformer();
transformer.setOutputProperty(OutputKeys.INDENT, "yes");
transformer.setOutputProperty(OutputKeys.METHOD, "html");
transformer.transform(new DOMSource(htmlDocument), new StreamResult(writer));
// 自定义处理标题
// W3CDocument w3cDocument = converter.getDocument();
// Range range = hwpfDocument.getRange();
//
// for (int i = 0; i < range.numParagraphs(); i++) {
// ParagraphProperties pp = range.getParagraph(i).getParagraphProperties();
// if (pp != null && pp.getParaStyleIndex() >= 0) {
// String styleName = hwpfDocument.getStyleSheet().getParagraphStyle(pp.getParaStyleIndex()).getName();
// // 判断标题样式并转换为对应的 HTML 标签
// if (styleName.startsWith("Heading")) {
// int headingLevel = Character.getNumericValue(styleName.charAt(7));
// // 这里只处理 H1 到 H6
// if (headingLevel >= 1 && headingLevel <= 6) {
// // 你可以将段落内容直接插入到 HTML 中,适当修改格式
// String headingTag = "h" + headingLevel;
// writer.append("<").append(headingTag).append(">")
// .append(range.getParagraph(i).text().trim())
// .append("</").append(headingTag).append(">");
// }
// } else {
// writer.append("<p>").append(range.getParagraph(i).text().trim()).append("</p>");
// }
// }
// }
// 输出 HTML 字符串
String htmlString = writer.getBuffer().toString();
// 将 HTML 字符串写入文件
FileOutputStream out = new FileOutputStream(outputFilePath);
byte[] bytes = htmlString.getBytes("UTF-8");
out.write(bytes);
out.close();
@AfterEach
public void testAfterEach() {
System.out.println("@AfterEach ==================");
}
//
// @Tag("prod")
// @DisplayName("测试 @Tag prod")
// @Test
// public void testTagProd() {
// System.out.println("prod");
// }
//
// @Tag("local")
// @DisplayName("测试 @Tag local")
// @Test
// public void testTagLocal() {
// System.out.println("local");
// }
//
// @Tag("exclude")
// @DisplayName("测试 @Tag exclude")
// @Test
// public void testTagExclude() {
// System.out.println("exclude");
// }
//
// @BeforeEach
// public void testBeforeEach() {
// System.out.println("@BeforeEach ==================");
// }
//
// @AfterEach
// public void testAfterEach() {
// System.out.println("@AfterEach ==================");
// }
//
}

12
ruoyi-common/ruoyi-common-sse/pom.xml

@ -32,5 +32,17 @@
<groupId>org.dromara</groupId>
<artifactId>ruoyi-common-json</artifactId>
</dependency>
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
</dependency>
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp-sse</artifactId>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
</dependency>
</dependencies>
</project>

21
ruoyi-common/ruoyi-common-sse/src/main/java/org/dromara/common/sse/dto/ChatGlmDto.java

@ -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;
}

33
ruoyi-common/ruoyi-common-sse/src/main/java/org/dromara/common/sse/utils/ExecuteSSEUtil.java

@ -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();
}
}

2
ruoyi-extend/ruoyi-snailjob-server/src/main/resources/application-dev.yml

@ -2,7 +2,7 @@ spring:
datasource:
type: com.zaxxer.hikari.HikariDataSource
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://localhost:3306/ry-vue?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true
url: jdbc:mysql://localhost:3306/snail_job?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true
username: root
password: root
hikari:

2
ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/controller/system/SysOssController.java

@ -66,7 +66,7 @@ public class SysOssController extends BaseController {
*
* @param file 文件
*/
@SaCheckPermission("system:oss:upload")
// @SaCheckPermission("system:oss:upload")
@Log(title = "OSS对象存储", businessType = BusinessType.INSERT)
@PostMapping(value = "/upload", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
public R<SysOssUploadVo> upload(@RequestPart("file") MultipartFile file) {

2
script/sql/snail_job.sql

@ -39,7 +39,7 @@ CREATE TABLE `sj_group_config`
AUTO_INCREMENT = 0
DEFAULT CHARSET = utf8mb4 COMMENT ='组配置';
INSERT INTO `sj_group_config` VALUES (1, 'dev', 'ruoyi_group', '', 'SJ_cKqBTPzCsWA3VyuCfFoccmuIEGXjr5KT', 1, 1, 0, 1, 1, 4, now(), now());
INSERT INTO `sj_group_config` VALUES (1, 'dev', 'guoyanGroup', '', 'SJ_cKqBTPzCsWA3VyuCfFoccmuIEGXjr5KT', 1, 1, 0, 1, 1, 4, now(), now());
CREATE TABLE `sj_notify_config`
(

52
zaojiaManagement/zaojia-productManagement/pom.xml

@ -16,68 +16,92 @@
产品管理模块
</description>
<dependencies>
<!-- 通用工具-->
<dependency>
<groupId>org.dromara</groupId>
<artifactId>ruoyi-common-websocket</artifactId>
<artifactId>ruoyi-common-core</artifactId>
</dependency>
<dependency>
<groupId>org.dromara</groupId>
<artifactId>ruoyi-common-mail</artifactId>
<artifactId>ruoyi-common-doc</artifactId>
</dependency>
<dependency>
<groupId>org.dromara</groupId>
<artifactId>ruoyi-common-sms</artifactId>
<artifactId>ruoyi-common-mybatis</artifactId>
</dependency>
<dependency>
<groupId>org.dromara</groupId>
<artifactId>ruoyi-common-mybatis</artifactId>
<artifactId>ruoyi-common-translation</artifactId>
</dependency>
<!-- OSS功能模块 -->
<dependency>
<groupId>org.dromara</groupId>
<artifactId>ruoyi-common-web</artifactId>
<artifactId>ruoyi-common-oss</artifactId>
</dependency>
<dependency>
<groupId>org.dromara</groupId>
<artifactId>ruoyi-common-log</artifactId>
</dependency>
<dependency>
<groupId>org.dromara</groupId>
<artifactId>ruoyi-common-idempotent</artifactId>
</dependency>
<!-- excel-->
<dependency>
<groupId>org.dromara</groupId>
<artifactId>ruoyi-common-excel</artifactId>
</dependency>
<!-- SMS功能模块 -->
<dependency>
<groupId>org.dromara</groupId>
<artifactId>ruoyi-common-translation</artifactId>
<artifactId>ruoyi-common-sms</artifactId>
</dependency>
<dependency>
<groupId>org.dromara</groupId>
<artifactId>ruoyi-common-tenant</artifactId>
</dependency>
<dependency>
<groupId>org.dromara</groupId>
<artifactId>ruoyi-common-security</artifactId>
</dependency>
<dependency>
<groupId>org.dromara</groupId>
<artifactId>ruoyi-common-web</artifactId>
</dependency>
<dependency>
<groupId>org.dromara</groupId>
<artifactId>ruoyi-common-idempotent</artifactId>
</dependency>
<dependency>
<groupId>org.dromara</groupId>
<artifactId>ruoyi-common-sensitive</artifactId>
</dependency>
<dependency>
<groupId>org.dromara</groupId>
<artifactId>ruoyi-common-encrypt</artifactId>
</dependency>
<dependency>
<groupId>org.dromara</groupId>
<artifactId>ruoyi-common-excel</artifactId>
<artifactId>ruoyi-common-websocket</artifactId>
</dependency>
<dependency>
<groupId>org.dromara</groupId>
<artifactId>guoyan-common-elasticsearch</artifactId>
<artifactId>ruoyi-common-sse</artifactId>
</dependency>
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
<groupId>org.dromara</groupId>
<artifactId>ruoyi-system</artifactId>
</dependency>
</dependencies>

133
zaojiaManagement/zaojia-productManagement/src/main/java/org/dromara/productManagement/controller/DocAiController.java

@ -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);
}
}

115
zaojiaManagement/zaojia-productManagement/src/main/java/org/dromara/productManagement/controller/DocumentTaskResultsController.java

@ -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));
}
}

112
zaojiaManagement/zaojia-productManagement/src/main/java/org/dromara/productManagement/controller/DocumentTasksController.java

@ -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));
}
}

125
zaojiaManagement/zaojia-productManagement/src/main/java/org/dromara/productManagement/controller/DocumentTasksPermissionsController.java

@ -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);
}
}

105
zaojiaManagement/zaojia-productManagement/src/main/java/org/dromara/productManagement/controller/DocumentTasksPermissionsDetailController.java

@ -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));
}
}

125
zaojiaManagement/zaojia-productManagement/src/main/java/org/dromara/productManagement/controller/FileReadInfoController.java

@ -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();
}
}

622
zaojiaManagement/zaojia-productManagement/src/main/java/org/dromara/productManagement/controller/Qwen72bController.java

@ -2,31 +2,17 @@ package org.dromara.productManagement.controller;
import java.io.File;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
import cn.hutool.core.io.FileUtil;
import cn.hutool.core.util.IdUtil;
import com.aizuda.snailjob.client.job.core.annotation.JobExecutor;
import com.aizuda.snailjob.client.job.core.dto.JobArgs;
import com.aizuda.snailjob.client.model.ExecuteResult;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import jakarta.servlet.http.HttpServletResponse;
import lombok.RequiredArgsConstructor;
import cn.dev33.satoken.annotation.SaCheckPermission;
import okhttp3.*;
import okhttp3.RequestBody;
import org.dromara.common.core.utils.StringUtils;
import org.dromara.common.satoken.utils.LoginHelper;
import org.dromara.common.sse.dto.ChatGlmDto;
import org.dromara.common.sse.listener.SSEListener;
import org.dromara.common.sse.utils.ExecuteSSEUtil;
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;
@ -49,13 +35,12 @@ import org.springframework.web.multipart.MultipartFile;
@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/productManagement/supplierInformation")
@RequestMapping("/productManagement/docAi")
public class Qwen72bController extends BaseController {
@Value("${chat.filePath}")
private String chatFilePath;
@Value("${chat.chatUrl}")
private String chatUrl;
private final ISysOssService ossService;
private final OkHttpClient client = new OkHttpClient.Builder()
.connectTimeout(300, TimeUnit.SECONDS)//连接超时(单位:秒)
@ -64,493 +49,181 @@ public class Qwen72bController extends BaseController {
.readTimeout(600, TimeUnit.SECONDS)//读取超时(单位:秒)
.writeTimeout(600, TimeUnit.SECONDS)//写入超时(单位:秒)
.build();
@SaCheckPermission("productManagement:supplierInformation:list")
@PostMapping(value = "/importData", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
public R<String> list111(@RequestPart("file") MultipartFile file,String content) throws IOException, ExecutionException, InterruptedException {
// 使用Hutool的FileUtil将MultipartFile保存到目标文件
String fileName= uploadFile(file);
//
// String result = "";
// String infozong = "";
// CompletableFuture<String> checkPlaceName = fetchDataAsync("http://localhost:5000/checkPlaceName/"+fileName);
// CompletableFuture<String> checkRepeatText = fetchDataAsync("http://localhost:5000/checkRepeatText/"+fileName);
// CompletableFuture<String> checkCompanyName = fetchDataAsync("http://localhost:5000/checkCompanyName/"+fileName);
//
// CompletableFuture.allOf(checkPlaceName, checkRepeatText, checkCompanyName)
// .thenAccept(ignore -> {
// try {
// String checkPlaceNameData = checkPlaceName.get();
// String checkRepeatTextData = checkRepeatText.get();
// String checkCompanyNameData = checkCompanyName.get();
// List<HashMap> entity =null;
// if(StringUtils.isNotBlank(checkPlaceNameData)){
// ObjectMapper objectMapper = new ObjectMapper();
// entity = objectMapper.readValue(result, new TypeReference<List<HashMap>>() {});
// }
// // 在这里处理所有数据
// System.out.println("Data1: " + checkPlaceNameData);
// System.out.println("Data2: " + checkRepeatTextData);
// System.out.println("Data3: " + checkCompanyNameData);
// } catch (Exception e) {
// e.printStackTrace();
// }
// })
// .exceptionally(ex -> {
// ex.printStackTrace();
// return null;
// });
//同时访问三个接口
// CompletableFuture<String> checkPlaceNameData = fetchDataAsync("http://183.136.156.2:50000/checkPlaceName/"+fileName)
// .thenApply(data -> {
// List<HashMap> entity =null;
// if(StringUtils.isNotBlank(data)){
// ObjectMapper objectMapper = new ObjectMapper();
// try {
// entity = objectMapper.readValue(data, new TypeReference<List<HashMap>>() {});
// } catch (JsonProcessingException e) {
// throw new RuntimeException(e);
// }
// }
// if(entity==null||entity.size()==0){
// return "未发现发现异常地名";
// }
// String info = "发现异常地名:\n";
// for(HashMap map:entity){
// String placeName = (String) map.get("placeName");
// String yuanwen = (String) map.get("yuanwen");
// info += "原文:"+yuanwen+"\n出现异常地名:"+placeName+"!请注意"+"\n";
// }
// // 对第一个接口的数据进行处理
// return info;
// });
////
//// CompletableFuture<String> checkRepeatTextData = fetchDataAsync("http://183.136.156.2:50000/checkRepeatText/"+fileName)
//// .thenApply(data -> {
//// // 对第二个接口的数据进行处理
//// List<HashMap> entity =null;
//// if(StringUtils.isNotBlank(data)){
//// ObjectMapper objectMapper = new ObjectMapper();
//// try {
//// entity = objectMapper.readValue(data, new TypeReference<List<HashMap>>() {});
//// } catch (JsonProcessingException e) {
//// throw new RuntimeException(e);
//// }
//// }
//// String info = "发现存在相似地方:\n";
////
//// if(entity==null||entity.size()==0){
//// return "未发现原文存在相似地方";
//// }else{
//// for(HashMap map:entity){
//// String yuanwen1 = (String) map.get("yuanwen1");
//// String yuanwen2 = (String) map.get("yuanwen2");
//// info += "原文1:"+yuanwen1+"\n原文2:"+yuanwen2+"\n请注意,存在相似"+"\n\n";
//// }
//// return info;
//// }
//// });
////
// CompletableFuture<String> checkCompanyNameData = fetchDataAsync("http://183.136.156.2:50000/checkCompanyName/"+fileName)
// .thenApply(data -> {
// // 对第三个接口的数据进行处理
// List<HashMap> entity =null;
// if(StringUtils.isNotBlank(data)){
// ObjectMapper objectMapper = new ObjectMapper();
// try {
// entity = objectMapper.readValue(data, new TypeReference<List<HashMap>>() {});
// } catch (JsonProcessingException e) {
// throw new RuntimeException(e);
// }
// }
// if(entity==null||entity.size()==0){
// return "未发现异常公司或组织名称";
// }
// String info = "发现异常公司或组织名称:\n";
// for(HashMap map:entity){
// String placeName = (String) map.get("placeName");
// String yuanwen = (String) map.get("yuanwen");
// info += "原文:"+yuanwen+"\n异常公司或组织名称:"+placeName+"!请注意"+"\n";
// }
// // 对第一个接口的数据进行处理
// return info;
// });
// CompletableFuture<String> getDocumentErrorData = fetchDataAsync("http://183.136.156.2:50000/getDocumentError/"+fileName)
// .thenApply(data -> {
// // 对第三个接口的数据进行处理
// List<HashMap> entity =null;
// if(StringUtils.isNotBlank(data)){
// ObjectMapper objectMapper = new ObjectMapper();
// try {
// entity = objectMapper.readValue(data, new TypeReference<List<HashMap>>() {});
// } catch (JsonProcessingException e) {
// throw new RuntimeException(e);
// }
// }
// if(entity==null||entity.size()==0){
// return "未发现错别字";
// }
// String info = "发现错别字:\n";
// for(HashMap map:entity){
// String placeName = (String) map.get("placeName");
// String jianyi = (String) map.get("jianyi");
// info += "原文:"+placeName+"\n建议:"+jianyi+"\n";
// }
// // 对第一个接口的数据进行处理
// return info;
// });
//// CompletableFuture<String> completableFuture = CompletableFuture.allOf(checkPlaceNameData, checkRepeatTextData, checkCompanyNameData,getDocumentErrorData)
//// .thenApply(ignore -> {
//// try {
//// return checkPlaceNameData.get()+"\n"+checkRepeatTextData.get()+"\n"+checkCompanyNameData.get();
//// } catch (Exception e) {
//// throw new RuntimeException(e);
//// }
//// });
// CompletableFuture<String> completableFuture = CompletableFuture.allOf(checkPlaceNameData,checkCompanyNameData,getDocumentErrorData)
// .thenApply(ignore -> {
// try {
// return checkPlaceNameData.get()+"\n"+checkCompanyNameData.get()+"\n";
// } catch (Exception e) {
// throw new RuntimeException(e);
// }
// });
// String strings = completableFuture.get();
CompletableFuture<String> checkPlaceNameData = fetchDataAsync(chatUrl+"/checkPlaceName?filename=" + fileName)
.thenApply(data -> {
List<HashMap> entity = null;
if (StringUtils.isNotBlank(data)) {
ObjectMapper objectMapper = new ObjectMapper();
try {
entity = objectMapper.readValue(data, new TypeReference<List<HashMap>>() {});
} catch (JsonProcessingException e) {
throw new RuntimeException(e);
}
}
if (entity == null || entity.size() == 0) {
return "未发现发现异常地名";
}
String info = "发现异常地名:\n";
for (HashMap map : entity) {
String placeName = (String) map.get("placeName");
String yuanwen = (String) map.get("yuanwen");
info += "原文:" + yuanwen + "\n出现异常地名:" + placeName + "!请注意" + "\n";
}
return info;
});
CompletableFuture<String> checkCompanyNameData = checkPlaceNameData
.thenCompose(result -> fetchDataAsync(chatUrl+"/checkCompanyName?filename=" + fileName))
.thenApply(data -> {
List<HashMap> entity = null;
if (StringUtils.isNotBlank(data)) {
ObjectMapper objectMapper = new ObjectMapper();
try {
entity = objectMapper.readValue(data, new TypeReference<List<HashMap>>() {});
} catch (JsonProcessingException e) {
throw new RuntimeException(e);
}
}
if (entity == null || entity.size() == 0) {
return "未发现异常公司或组织名称";
}
String info = "发现异常公司或组织名称:\n";
for (HashMap map : entity) {
String companyName = (String) map.get("companyName");
String yuanwen = (String) map.get("yuanwen");
info += "原文:" + yuanwen + "\n异常公司或组织名称:" + companyName + "!请注意" + "\n";
}
return info;
});
CompletableFuture<String> getDocumentErrorData = checkCompanyNameData
.thenCompose(result -> fetchDataAsync(chatUrl+"/getDocumentError?filename=" + fileName))
.thenApply(data -> {
List<HashMap> entity = null;
if (StringUtils.isNotBlank(data)) {
ObjectMapper objectMapper = new ObjectMapper();
try {
entity = objectMapper.readValue(data, new TypeReference<List<HashMap>>() {});
} catch (JsonProcessingException e) {
throw new RuntimeException(e);
}
}
if (entity == null || entity.size() == 0) {
return "未发现错别字";
}
String info = "发现错别字:\n";
for (HashMap map : entity) {
String placeName = (String) map.get("placeName");
String jianyi = (String) map.get("jianyi");
info += "原文:" + placeName + "\n建议:" + jianyi + "\n";
}
return info;
});
CompletableFuture<String> checkRepeatTextData = getDocumentErrorData
.thenCompose(result -> fetchDataAsync(chatUrl+"/getDocumentError?filename=" + fileName+"&sectionName="+content))
.thenApply(data -> {
// 对第二个接口的数据进行处理
List<HashMap> entity =null;
if(StringUtils.isNotBlank(data)){
ObjectMapper objectMapper = new ObjectMapper();
try {
entity = objectMapper.readValue(data, new TypeReference<List<HashMap>>() {});
} catch (JsonProcessingException e) {
throw new RuntimeException(e);
}
}
String info = "发现存在相似地方:\n";
if(entity==null||entity.size()==0){
return "未发现原文存在相似地方";
}else{
for(HashMap map:entity){
String yuanwen1 = (String) map.get("yuanwen1");
String yuanwen2 = (String) map.get("yuanwen2");
info += "原文1:"+yuanwen1+"\n原文2:"+yuanwen2+"\n请注意,存在相似"+"\n\n";
}
return info;
}
});
CompletableFuture<String> completableFuture = checkRepeatTextData
.thenApply(result -> {
StringBuilder combinedResult = new StringBuilder();
try {
combinedResult.append(checkPlaceNameData.get()).append("\n");
combinedResult.append(checkCompanyNameData.get()).append("\n");
combinedResult.append(getDocumentErrorData.get()).append("\n");
combinedResult.append(checkRepeatTextData.get()).append("\n");;
} catch (Exception e) {
throw new RuntimeException(e);
}
return combinedResult.toString();
});
String strings = completableFuture.get();
return R.ok("ok",strings);
}
//对多个请求进行异步处理,并返回CompletableFuture对象,最后通过thenAccept()方法处理结果。
public CompletableFuture<String> fetchDataAsync(String url) {
CompletableFuture<String> future = new CompletableFuture<>();
Request request = new Request.Builder()
.url(url)
.build();
client.newCall(request).enqueue(new Callback() {
@Override
public void onFailure(Call call, IOException e) {
future.completeExceptionally(e);
}
@Override
public void onResponse(Call call, Response response) throws IOException {
if (response.isSuccessful()) {
future.complete(response.body().string());
} else {
future.completeExceptionally(new IOException("Unexpected code " + response));
}
}
});
return future;
}
@PostMapping(value = "/sse-invoke", consumes = MediaType.MULTIPART_FORM_DATA_VALUE,produces = "text/event-stream;charset=UTF-8")
public void sse(@RequestPart(name = "fileInfo", required = false) MultipartFile fileInfo, @RequestPart("content") String context, HttpServletResponse rp) {
try {
public void sse(@RequestPart(name = "originalFilename") String originalFilename, @RequestPart("content") String context, HttpServletResponse rp) throws Exception {
// String token = ApiTokenUtil.generateClientToken(API_KEY);
ChatGlmDto chatGlmDto = new ChatGlmDto();
SSEListener sseListener = new SSEListener(chatGlmDto, rp);
ExecuteSSEUtil.executeSSE(chatUrl+"/stream?context="+context, sseListener, JSON.toJSONString(chatGlmDto));
} catch (Exception e) {
e.printStackTrace();
}
ChatGlmDto chatGlmDto = new ChatGlmDto();
SSEListener sseListener = new SSEListener(chatGlmDto, rp);
ExecuteSSEUtil.executeSSE(chatUrl+"/stream?context="+context, sseListener, JSON.toJSONString(chatGlmDto));
}
@PostMapping(value = "/sse/checkPlaceName", consumes = MediaType.MULTIPART_FORM_DATA_VALUE,produces = "text/event-stream;charset=UTF-8")
public void checkPlaceName(@RequestPart(name = "fileInfo", required = false) MultipartFile fileInfo, @RequestPart("content") String context, HttpServletResponse rp) {
try {
String fileName = uploadFile(fileInfo);
// String token = ApiTokenUtil.generateClientToken(API_KEY);
ChatGlmDto chatGlmDto = new ChatGlmDto();
SSEListener sseListener = new SSEListener(chatGlmDto, rp);
//http://183.136.156.2:50000/see/checkPlaceName?filename="+fileName
ExecuteSSEUtil.executeSSE(chatUrl+"/sse/checkPlaceName?filename="+fileName, sseListener, JSON.toJSONString(chatGlmDto));
} catch (Exception e) {
e.printStackTrace();
}
public void checkPlaceName(
@RequestPart(name = "originalFilename") String originalFilename,
@RequestPart("content") String context, HttpServletResponse rp) throws Exception {
String fileName="uploads/"+originalFilename;
Long userId = LoginHelper.getUserId();
ChatGlmDto chatGlmDto = new ChatGlmDto();
SSEListener sseListener = new SSEListener(chatGlmDto, rp);
//http://183.136.156.2:50000/see/checkPlaceName?filename="+fileName
ExecuteSSEUtil.executeSSE(chatUrl+"/sse/checkPlaceName?filename="+fileName+"&userId="+userId, sseListener, JSON.toJSONString(chatGlmDto));
}
@PostMapping(value = "/sse/checkRepeatText", consumes = MediaType.MULTIPART_FORM_DATA_VALUE,produces = "text/event-stream;charset=UTF-8")
public void checkRepeatText(@RequestPart(name = "fileInfo", required = false) MultipartFile fileInfo, @RequestPart("content") String context, HttpServletResponse rp) {
try {
String fileName = uploadFile(fileInfo);
// String token = ApiTokenUtil.generateClientToken(API_KEY);
ChatGlmDto chatGlmDto = new ChatGlmDto();
SSEListener sseListener = new SSEListener(chatGlmDto, rp);
ExecuteSSEUtil.executeSSE(chatUrl+"/sse/checkRepeatText?filename="+fileName, sseListener, JSON.toJSONString(chatGlmDto));
} catch (Exception e) {
e.printStackTrace();
}
public void checkRepeatText(
@RequestPart(name = "originalFilename") String originalFilename,
@RequestPart("content") String context, HttpServletResponse rp) throws Exception {
String fileName="uploads/"+originalFilename;
Long userId = LoginHelper.getUserId();
ChatGlmDto chatGlmDto = new ChatGlmDto();
SSEListener sseListener = new SSEListener(chatGlmDto, rp);
ExecuteSSEUtil.executeSSE(chatUrl+"/sse/checkRepeatText?filename="+fileName+"&userId="+userId, sseListener, JSON.toJSONString(chatGlmDto));
}
@PostMapping(value = "/sse/checkCompanyName", consumes = MediaType.MULTIPART_FORM_DATA_VALUE,produces = "text/event-stream;charset=UTF-8")
public void checkCompanyName(@RequestPart(name = "fileInfo", required = false) MultipartFile fileInfo, @RequestPart("content") String context, HttpServletResponse rp) {
try {
String fileName = uploadFile(fileInfo);
// String token = ApiTokenUtil.generateClientToken(API_KEY);
ChatGlmDto chatGlmDto = new ChatGlmDto();
SSEListener sseListener = new SSEListener(chatGlmDto, rp);
ExecuteSSEUtil.executeSSE(chatUrl+"/sse/checkCompanyName?filename="+fileName, sseListener, JSON.toJSONString(chatGlmDto));
} catch (Exception e) {
e.printStackTrace();
}
public void checkCompanyName(
@RequestPart(name = "originalFilename") String originalFilename,
@RequestPart("content") String context, HttpServletResponse rp) throws Exception {
String fileName="uploads/"+originalFilename;
Long userId = LoginHelper.getUserId();
ChatGlmDto chatGlmDto = new ChatGlmDto();
SSEListener sseListener = new SSEListener(chatGlmDto, rp);
ExecuteSSEUtil.executeSSE(chatUrl+"/sse/checkCompanyName?filename="+fileName+"&userId="+userId, sseListener, JSON.toJSONString(chatGlmDto));
}
@PostMapping(value = "/sse/checkDocumentError", consumes = MediaType.MULTIPART_FORM_DATA_VALUE,produces = "text/event-stream;charset=UTF-8")
public void checkDocumentError(@RequestPart(name = "fileInfo", required = false) MultipartFile fileInfo, @RequestPart("content") String context, HttpServletResponse rp) {
try {
String fileName = uploadFile(fileInfo);
// String token = ApiTokenUtil.generateClientToken(API_KEY);
ChatGlmDto chatGlmDto = new ChatGlmDto();
SSEListener sseListener = new SSEListener(chatGlmDto, rp);
ExecuteSSEUtil.executeSSE(chatUrl+"/sse/checkDocumentErrorWeb?filename="+fileName, sseListener, JSON.toJSONString(chatGlmDto));
} catch (Exception e) {
e.printStackTrace();
}
public void checkDocumentError(
@RequestPart(name = "originalFilename") String originalFilename,
@RequestPart("content") String context, HttpServletResponse rp) throws Exception {
String fileName="uploads/"+originalFilename;
Long userId = LoginHelper.getUserId();
ChatGlmDto chatGlmDto = new ChatGlmDto();
SSEListener sseListener = new SSEListener(chatGlmDto, rp);
ExecuteSSEUtil.executeSSE(chatUrl+"/sse/checkDocumentErrorWeb?filename="+fileName+"&userId="+userId, sseListener, JSON.toJSONString(chatGlmDto));
}
@PostMapping(value = "/sse/checkTitleName", consumes = MediaType.MULTIPART_FORM_DATA_VALUE,produces = "text/event-stream;charset=UTF-8")
public void checkTitleName(@RequestPart(name = "fileInfo", required = false) MultipartFile fileInfo, @RequestPart("content") String context, HttpServletResponse rp) {
try {
String fileName = uploadFile(fileInfo);
// String token = ApiTokenUtil.generateClientToken(API_KEY);
ChatGlmDto chatGlmDto = new ChatGlmDto();
SSEListener sseListener = new SSEListener(chatGlmDto, rp);
ExecuteSSEUtil.executeSSE(chatUrl+"/sse/checkTitleName?filename="+fileName, sseListener, JSON.toJSONString(chatGlmDto));
} catch (Exception e) {
e.printStackTrace();
}
}
@PostMapping(value = "/sse/checkDocumentAll/checkPlaceName", consumes = MediaType.MULTIPART_FORM_DATA_VALUE,produces = "text/event-stream;charset=UTF-8")
public void checkDocumentAllCheckPlaceName(@RequestPart(name = "fileInfo", required = false) MultipartFile fileInfo, @RequestPart("uuid") String uuid, HttpServletResponse rp) {
try {
String fileName = uploadFile(fileInfo,uuid);
// String token = ApiTokenUtil.generateClientToken(API_KEY);
ChatGlmDto chatGlmDto = new ChatGlmDto();
SSEListener sseListener = new SSEListener(chatGlmDto, rp);
//http://183.136.156.2:50000/see/checkPlaceName?filename="+fileName
ExecuteSSEUtil.executeSSE(chatUrl+"/sse/checkPlaceName?filename="+fileName, sseListener, JSON.toJSONString(chatGlmDto));
} catch (Exception e) {
e.printStackTrace();
}
}
@PostMapping(value = "/sse/checkDocumentAll/checkRepeatText", consumes = MediaType.MULTIPART_FORM_DATA_VALUE,produces = "text/event-stream;charset=UTF-8")
public void checkDocumentAllCheckRepeatText(@RequestPart(name = "fileInfo", required = false) MultipartFile fileInfo, @RequestPart("uuid") String uuid, HttpServletResponse rp) {
try {
String fileName = "uploads/"+uuid;
// String token = ApiTokenUtil.generateClientToken(API_KEY);
ChatGlmDto chatGlmDto = new ChatGlmDto();
SSEListener sseListener = new SSEListener(chatGlmDto, rp);
ExecuteSSEUtil.executeSSE(chatUrl+"/sse/checkRepeatText?filename="+fileName, sseListener, JSON.toJSONString(chatGlmDto));
} catch (Exception e) {
e.printStackTrace();
}
}
@PostMapping(value = "/sse/checkDocumentAll/checkCompanyName", consumes = MediaType.MULTIPART_FORM_DATA_VALUE,produces = "text/event-stream;charset=UTF-8")
public void checkDocumentAllCheckCompanyName(@RequestPart(name = "fileInfo", required = false) MultipartFile fileInfo, @RequestPart("uuid") String uuid, HttpServletResponse rp) {
try {
String fileName = "uploads/"+uuid;
// String token = ApiTokenUtil.generateClientToken(API_KEY);
ChatGlmDto chatGlmDto = new ChatGlmDto();
SSEListener sseListener = new SSEListener(chatGlmDto, rp);
ExecuteSSEUtil.executeSSE(chatUrl+"/sse/checkCompanyName?filename="+fileName, sseListener, JSON.toJSONString(chatGlmDto));
} catch (Exception e) {
e.printStackTrace();
}
}
@PostMapping(value = "/sse/checkDocumentAll/checkDocumentError", consumes = MediaType.MULTIPART_FORM_DATA_VALUE,produces = "text/event-stream;charset=UTF-8")
public void checkDocumentAllCcheckDocumentError(@RequestPart(name = "fileInfo", required = false) MultipartFile fileInfo, @RequestPart("uuid") String uuid, HttpServletResponse rp) {
try {
String fileName = "uploads/"+uuid;
// String token = ApiTokenUtil.generateClientToken(API_KEY);
ChatGlmDto chatGlmDto = new ChatGlmDto();
SSEListener sseListener = new SSEListener(chatGlmDto, rp);
ExecuteSSEUtil.executeSSE(chatUrl+"/sse/checkDocumentErrorWeb?filename="+fileName, sseListener, JSON.toJSONString(chatGlmDto));
} catch (Exception e) {
e.printStackTrace();
public void checkTitleName(
@RequestPart(name = "originalFilename") String originalFilename,
@RequestPart("content") String context, HttpServletResponse rp) throws Exception {
String fileName="uploads/"+originalFilename;
Long userId = LoginHelper.getUserId();
ChatGlmDto chatGlmDto = new ChatGlmDto();
SSEListener sseListener = new SSEListener(chatGlmDto, rp);
ExecuteSSEUtil.executeSSE(chatUrl+"/sse/checkTitleName?filename="+fileName+"&userId="+userId, sseListener, JSON.toJSONString(chatGlmDto));
}
@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 {
String fileName="uploads/"+originalFilename;
Long userId = LoginHelper.getUserId();
ChatGlmDto chatGlmDto = new ChatGlmDto();
SSEListener sseListener = new SSEListener(chatGlmDto, rp);
ExecuteSSEUtil.executeSSE(chatUrl+"/xysse/documentEvaluate?filename="+fileName+"&userId="+userId, sseListener, JSON.toJSONString(chatGlmDto));
}
@GetMapping(value = "/sse/getLog",produces = "text/event-stream;charset=UTF-8")
public void getlog(HttpServletResponse rp) throws Exception {
Long userId = LoginHelper.getUserId();
ChatGlmDto chatGlmDto = new ChatGlmDto();
SSEListener sseListener = new SSEListener(chatGlmDto, rp);
ExecuteSSEUtil.executeSSE(chatUrl+"/sse/getLog?userId="+userId, sseListener, JSON.toJSONString(chatGlmDto));
}
/**
* 上传文件与文件转换
* @param file 上传的文件
* @param uuid 文件唯一标识
* @return 上传成功返回文件路径失败返回失败原因
* @throws IOException
* @throws InterruptedException
*/
@PostMapping(value = "/sse/upload", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
public R<String> uploadFileby(@RequestPart(name = "fileInfo") MultipartFile file,@RequestPart(name = "originalFilename") String originalFilename) throws IOException, InterruptedException {
String destDir = chatFilePath;
if (originalFilename == null) {
throw new IllegalArgumentException("文件名不能为空");
}
}
@PostMapping(value = "/sse/checkDocumentAll/checkTitleName", consumes = MediaType.MULTIPART_FORM_DATA_VALUE,produces = "text/event-stream;charset=UTF-8")
public void checkDocumentAllCheckTitleName(@RequestPart(name = "fileInfo", required = false) MultipartFile fileInfo, @RequestPart("uuid") String uuid, HttpServletResponse rp) {
try {
String fileName = "uploads/"+uuid;
// String token = ApiTokenUtil.generateClientToken(API_KEY);
ChatGlmDto chatGlmDto = new ChatGlmDto();
SSEListener sseListener = new SSEListener(chatGlmDto, rp);
ExecuteSSEUtil.executeSSE(chatUrl+"/sse/checkTitleName?filename="+fileName, sseListener, JSON.toJSONString(chatGlmDto));
} catch (Exception e) {
e.printStackTrace();
// 获取文件的后缀
String suffix = FileUtil.getSuffix(originalFilename);
// 构建目标文件路径
String destPath = destDir + File.separator + originalFilename;
// 创建目标文件
File destFile = new File(destPath);
FileUtil.writeFromStream(file.getInputStream(), destFile);
//不是docx文件需要转换
if (!originalFilename.endsWith(".docx")) {
ProcessBuilder builder = new ProcessBuilder("unoconv","-o" ,destDir,"-f", "docx", destFile.getAbsolutePath());
Process process = builder.start();
int complated = process.waitFor();
if (complated!=0) {
// 如果返回值不是0,说明转换失败
process.destroyForcibly();
String failMsg = suffix+"转docx失败,请检查文件是否正确~";
return R.fail(failMsg,failMsg);
}else{
//文档转换成果
process.destroyForcibly();
destPath=destPath.substring(0,destPath.lastIndexOf("."))+".docx";
}
}
}
public String uploadFile(MultipartFile file) throws IOException {
// String destDir = chatFilePath;
// String originalFilename = file.getOriginalFilename();
// if (originalFilename == null) {
// throw new IllegalArgumentException("文件名不能为空");
// }
//
// // 获取文件的后缀
// String suffix = FileUtil.getSuffix(originalFilename);
//
// // 生成唯一的文件名
// String name = IdUtil.fastSimpleUUID() + "." + suffix;
//
// // 构建目标文件路径
// String destPath = destDir + File.separator + name;
//
// // 创建目标文件
// File destFile = new File(destPath);
// FileUtil.writeFromStream(file.getInputStream(), destFile);
// if(!sendRequest(chatUrl+"/upload", destPath)){
// throw new RuntimeException("上传文件失败");
// }
SysOssVo oss = ossService.upload(file);
String fileName = oss.getOriginalName();
RequestBody requestBody = new MultipartBody.Builder()
.setType(MultipartBody.FORM)
.addFormDataPart("file", fileName,
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();
Response response = client.newCall(request).execute();
return "uploads/"+fileName;
if(!sendRequest(chatUrl+"/sse/upload", destPath)){
return R.fail("文件上传失败","文件上传失败");
}
return R.ok("ok","uploads/"+originalFilename);
}
public String uploadFile(MultipartFile file,String uuid) throws IOException {
@PostMapping(value = "/xysse/upload", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
public R<String> uploadFileby1(@RequestPart(name = "fileInfo") MultipartFile file,@RequestPart(name = "originalFilename") String originalFilename) throws IOException, InterruptedException {
String destDir = chatFilePath;
String originalFilename = file.getOriginalFilename();
if (originalFilename == null) {
throw new IllegalArgumentException("文件名不能为空");
}
// 获取文件的后缀
String suffix = FileUtil.getSuffix(originalFilename);
// 生成唯一的文件名
String name = uuid;
// 构建目标文件路径
String destPath = destDir + File.separator + name;
String destPath = destDir + File.separator + originalFilename;
// 创建目标文件
File destFile = new File(destPath);
FileUtil.writeFromStream(file.getInputStream(), destFile);
if(!sendRequest(chatUrl+"/upload", destPath)){
throw new RuntimeException("上传文件失败");
//不是docx文件需要转换
if (!originalFilename.endsWith(".docx")) {
ProcessBuilder builder = new ProcessBuilder("unoconv","-o" ,destDir,"-f", "docx", destFile.getAbsolutePath());
Process process = builder.start();
int complated = process.waitFor();
if (complated!=0) {
// 如果返回值不是0,说明转换失败
process.destroyForcibly();
String failMsg = suffix+"转docx失败,请检查文件是否正确~";
return R.fail(failMsg,failMsg);
}else{
//文档转换成果
process.destroyForcibly();
destPath=destPath.substring(0,destPath.lastIndexOf("."))+".docx";
}
}
if(!sendRequest(chatUrl+"/xysse/upload", destPath)){
return R.fail("文件上传失败","文件上传失败");
}
return "uploads/"+name;
return R.ok("ok","uploads/"+originalFilename);
}
/**
* 发送文件到flask服务器
* @param url
* @param filePath
* @return
*/
public boolean sendRequest(String url,String filePath) {
// 替换为你要上传的文件路径
File file = new File(filePath);
@ -576,9 +249,4 @@ public class Qwen72bController extends BaseController {
}
return false;
}
@JobExecutor(name="ces")
public ExecuteResult jobExecute(JobArgs jobArgs) {
System.out.println(jobArgs.getJobParams());
return ExecuteResult.success("测试成功aaaaaaa");
}
}

129
zaojiaManagement/zaojia-productManagement/src/main/java/org/dromara/productManagement/domain/DocumentEvaluationResult.java

@ -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();
* }
*/

53
zaojiaManagement/zaojia-productManagement/src/main/java/org/dromara/productManagement/domain/DocumentTaskResults.java

@ -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;
}

66
zaojiaManagement/zaojia-productManagement/src/main/java/org/dromara/productManagement/domain/DocumentTasks.java

@ -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;
}

69
zaojiaManagement/zaojia-productManagement/src/main/java/org/dromara/productManagement/domain/DocumentTasksPermissions.java

@ -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;
}

58
zaojiaManagement/zaojia-productManagement/src/main/java/org/dromara/productManagement/domain/DocumentTasksPermissionsDetail.java

@ -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;
}

51
zaojiaManagement/zaojia-productManagement/src/main/java/org/dromara/productManagement/domain/FileReadInfo.java

@ -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;
}

39
zaojiaManagement/zaojia-productManagement/src/main/java/org/dromara/productManagement/domain/bo/DocumentTaskResultsBo.java

@ -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;
}

58
zaojiaManagement/zaojia-productManagement/src/main/java/org/dromara/productManagement/domain/bo/DocumentTasksBo.java

@ -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;
}

65
zaojiaManagement/zaojia-productManagement/src/main/java/org/dromara/productManagement/domain/bo/DocumentTasksPermissionsBo.java

@ -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;
}

47
zaojiaManagement/zaojia-productManagement/src/main/java/org/dromara/productManagement/domain/bo/DocumentTasksPermissionsDetailBo.java

@ -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;
}

54
zaojiaManagement/zaojia-productManagement/src/main/java/org/dromara/productManagement/domain/bo/FileReadInfoBo.java

@ -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;
}

35
zaojiaManagement/zaojia-productManagement/src/main/java/org/dromara/productManagement/domain/vo/DocumentTaskResultsVo.java

@ -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;
}

57
zaojiaManagement/zaojia-productManagement/src/main/java/org/dromara/productManagement/domain/vo/DocumentTasksPermissionsDetailVo.java

@ -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;
}

74
zaojiaManagement/zaojia-productManagement/src/main/java/org/dromara/productManagement/domain/vo/DocumentTasksPermissionsVo.java

@ -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;
}

62
zaojiaManagement/zaojia-productManagement/src/main/java/org/dromara/productManagement/domain/vo/DocumentTasksVo.java

@ -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;
}

63
zaojiaManagement/zaojia-productManagement/src/main/java/org/dromara/productManagement/domain/vo/FileReadInfoVo.java

@ -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;
}

22
zaojiaManagement/zaojia-productManagement/src/main/java/org/dromara/productManagement/job/Qwen72bJobExecutor.java

@ -1,22 +1,18 @@
package org.dromara.productManagement.job;
import com.aizuda.snailjob.client.job.core.annotation.JobExecutor;
import com.aizuda.snailjob.client.job.core.dto.JobArgs;
import com.aizuda.snailjob.client.model.ExecuteResult;
import com.aizuda.snailjob.common.core.util.JsonUtil;
import com.aizuda.snailjob.common.log.SnailJobLog;
import org.springframework.stereotype.Component;
@Component
public class Qwen72bJobExecutor {
@JobExecutor(name = "checkRepeatTextJobExecute")
public ExecuteResult checkRepeatTextJobExecute(JobArgs jobArgs) {
SnailJobLog.LOCAL.info("testJobExecutor. jobArgs:{}", JsonUtil.toJsonString(jobArgs));
SnailJobLog.REMOTE.info("testJobExecutor. jobArgs:{}", JsonUtil.toJsonString(jobArgs));
return ExecuteResult.success("测试成功");
}
// @JobExecutor(name = "checkRepeatTextJobExecute")
//
// public ExecuteResult checkRepeatTextJobExecute(JobArgs jobArgs) {
// SnailJobLog.LOCAL.info("testJobExecutor. jobArgs:{}", JsonUtil.toJsonString(jobArgs));
// SnailJobLog.REMOTE.info("testJobExecutor. jobArgs:{}", JsonUtil.toJsonString(jobArgs));
//
// return ExecuteResult.success("测试成功");
// }
}

15
zaojiaManagement/zaojia-productManagement/src/main/java/org/dromara/productManagement/mapper/DocumentTaskResultsMapper.java

@ -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> {
}

21
zaojiaManagement/zaojia-productManagement/src/main/java/org/dromara/productManagement/mapper/DocumentTasksMapper.java

@ -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> {
}

15
zaojiaManagement/zaojia-productManagement/src/main/java/org/dromara/productManagement/mapper/DocumentTasksPermissionsDetailMapper.java

@ -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> {
}

17
zaojiaManagement/zaojia-productManagement/src/main/java/org/dromara/productManagement/mapper/DocumentTasksPermissionsMapper.java

@ -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);
}

15
zaojiaManagement/zaojia-productManagement/src/main/java/org/dromara/productManagement/mapper/FileReadInfoMapper.java

@ -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> {
}

1
zaojiaManagement/zaojia-productManagement/src/main/java/org/dromara/productManagement/mapper/PmgCompanyProductModelDetailsMapper.java

@ -11,5 +11,4 @@ import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
* @date 2024-07-01
*/
public interface PmgCompanyProductModelDetailsMapper extends BaseMapperPlus<PmgCompanyProductModelDetails, PmgCompanyProductModelDetailsVo> {
}

41
zaojiaManagement/zaojia-productManagement/src/main/java/org/dromara/productManagement/service/IDocAiService.java

@ -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;
}

70
zaojiaManagement/zaojia-productManagement/src/main/java/org/dromara/productManagement/service/IDocumentTaskResultsService.java

@ -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);
}

68
zaojiaManagement/zaojia-productManagement/src/main/java/org/dromara/productManagement/service/IDocumentTasksPermissionsDetailService.java

@ -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);
}

74
zaojiaManagement/zaojia-productManagement/src/main/java/org/dromara/productManagement/service/IDocumentTasksPermissionsService.java

@ -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);
}

71
zaojiaManagement/zaojia-productManagement/src/main/java/org/dromara/productManagement/service/IDocumentTasksService.java

@ -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);
}

72
zaojiaManagement/zaojia-productManagement/src/main/java/org/dromara/productManagement/service/IFileReadInfoService.java

@ -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;
}

178
zaojiaManagement/zaojia-productManagement/src/main/java/org/dromara/productManagement/service/impl/DocAiServiceImpl.java

@ -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;
}
}

138
zaojiaManagement/zaojia-productManagement/src/main/java/org/dromara/productManagement/service/impl/DocumentTaskResultsServiceImpl.java

@ -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);
}
}

131
zaojiaManagement/zaojia-productManagement/src/main/java/org/dromara/productManagement/service/impl/DocumentTasksPermissionsDetailServiceImpl.java

@ -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;
}
}

181
zaojiaManagement/zaojia-productManagement/src/main/java/org/dromara/productManagement/service/impl/DocumentTasksPermissionsServiceImpl.java

@ -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;
}
}

345
zaojiaManagement/zaojia-productManagement/src/main/java/org/dromara/productManagement/service/impl/DocumentTasksServiceImpl.java

@ -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;
}
}

179
zaojiaManagement/zaojia-productManagement/src/main/java/org/dromara/productManagement/service/impl/FileReadInfoServiceImpl.java

@ -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();
}
}
}

2
zaojiaManagement/zaojia-productManagement/src/main/java/org/dromara/productManagement/service/impl/PmgSupplierProductsServiceImpl.java

@ -4,7 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.dromara.common.core.utils.MapstructUtils;
import org.dromara.common.core.utils.StringUtils;
import org.dromara.common.elasticsearch.entity.SupplierProductsDTO;
//import org.dromara.common.elasticsearch.entity.SupplierProductsDTO;
import org.dromara.common.mybatis.core.page.TableDataInfo;
import org.dromara.common.mybatis.core.page.PageQuery;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;

7
zaojiaManagement/zaojia-productManagement/src/main/resources/mapper/productManagement/DocumentTaskResultsMapper.xml

@ -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>

7
zaojiaManagement/zaojia-productManagement/src/main/resources/mapper/productManagement/DocumentTasksMapper.xml

@ -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>

7
zaojiaManagement/zaojia-productManagement/src/main/resources/mapper/productManagement/DocumentTasksPermissionsDetailMapper.xml

@ -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>

28
zaojiaManagement/zaojia-productManagement/src/main/resources/mapper/productManagement/DocumentTasksPermissionsMapper.xml

@ -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…
Cancel
Save