Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
P
poc-api
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
poc
poc-api
Commits
87d16df2
Commit
87d16df2
authored
Oct 14, 2024
by
alex yao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 知识库文档保存分片规则
parent
9495df61
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
346 additions
and
247 deletions
+346
-247
KnowledgeServiceImpl.java
...om/poc/knowledge/aggregate/impl/KnowledgeServiceImpl.java
+5
-0
KnowledgeDocumentConvert.java
...n/com/poc/knowledge/convert/KnowledgeDocumentConvert.java
+8
-0
BizKnowledgeDocumentDto.java
...ava/cn/com/poc/knowledge/dto/BizKnowledgeDocumentDto.java
+13
-0
BizKnowledgeDocumentEntity.java
.../com/poc/knowledge/entity/BizKnowledgeDocumentEntity.java
+16
-2
BizKnowledgeDocumentModel.java
...cn/com/poc/knowledge/model/BizKnowledgeDocumentModel.java
+195
-163
KnowledgeQuery.sql
src/main/java/cn/com/poc/knowledge/query/KnowledgeQuery.sql
+1
-0
KnowledgeQueryItem.java
...n/java/cn/com/poc/knowledge/query/KnowledgeQueryItem.java
+103
-82
BizKnowledgeDocumentServiceImpl.java
...owledge/service/impl/BizKnowledgeDocumentServiceImpl.java
+5
-0
No files found.
src/main/java/cn/com/poc/knowledge/aggregate/impl/KnowledgeServiceImpl.java
View file @
87d16df2
...
@@ -176,6 +176,7 @@ public class KnowledgeServiceImpl implements KnowledgeService {
...
@@ -176,6 +176,7 @@ public class KnowledgeServiceImpl implements KnowledgeService {
}
}
bizKnowledgeDocumentEntity
.
setTrainStatus
(
KnowledgeConstant
.
TrainStatus
.
LINE
);
bizKnowledgeDocumentEntity
.
setTrainStatus
(
KnowledgeConstant
.
TrainStatus
.
LINE
);
bizKnowledgeDocumentEntity
.
setSegmentationConfig
(
segmentationConfig
);
bizKnowledgeDocumentService
.
update
(
kdId
,
bizKnowledgeDocumentEntity
);
bizKnowledgeDocumentService
.
update
(
kdId
,
bizKnowledgeDocumentEntity
);
TrainKnowledgeMessage
message
=
new
TrainKnowledgeMessage
();
TrainKnowledgeMessage
message
=
new
TrainKnowledgeMessage
();
...
@@ -213,6 +214,10 @@ public class KnowledgeServiceImpl implements KnowledgeService {
...
@@ -213,6 +214,10 @@ public class KnowledgeServiceImpl implements KnowledgeService {
result
=
knowledgeQueryItems
.
stream
().
map
(
item
->
{
result
=
knowledgeQueryItems
.
stream
().
map
(
item
->
{
BizKnowledgeDocumentEntity
entity
=
new
BizKnowledgeDocumentEntity
();
BizKnowledgeDocumentEntity
entity
=
new
BizKnowledgeDocumentEntity
();
BeanUtil
.
copyProperties
(
item
,
entity
);
BeanUtil
.
copyProperties
(
item
,
entity
);
if
(
StringUtils
.
isNotBlank
(
item
.
getSegmentationConfig
()))
{
SegmentationConfigRequest
segmentationConfigRequest
=
JsonUtils
.
deSerialize
(
item
.
getSegmentationConfig
(),
SegmentationConfigRequest
.
class
);
entity
.
setSegmentationConfig
(
segmentationConfigRequest
);
}
return
entity
;
return
entity
;
}).
collect
(
Collectors
.
toList
());
}).
collect
(
Collectors
.
toList
());
}
}
...
...
src/main/java/cn/com/poc/knowledge/convert/KnowledgeDocumentConvert.java
View file @
87d16df2
package
cn
.
com
.
poc
.
knowledge
.
convert
;
package
cn
.
com
.
poc
.
knowledge
.
convert
;
import
cn.com.poc.common.utils.JsonUtils
;
import
cn.com.poc.common.utils.StringUtils
;
import
cn.com.poc.knowledge.entity.BizKnowledgeDocumentEntity
;
import
cn.com.poc.knowledge.entity.BizKnowledgeDocumentEntity
;
import
cn.com.poc.knowledge.model.BizKnowledgeDocumentModel
;
import
cn.com.poc.knowledge.model.BizKnowledgeDocumentModel
;
import
cn.com.poc.thirdparty.resource.demand.ai.entity.knowledge.SegmentationConfigRequest
;
public
class
KnowledgeDocumentConvert
{
public
class
KnowledgeDocumentConvert
{
...
@@ -16,6 +19,10 @@ public class KnowledgeDocumentConvert {
...
@@ -16,6 +19,10 @@ public class KnowledgeDocumentConvert {
bizKnowledgeDocumentEntity
.
setCharCount
(
model
.
getCharCount
());
bizKnowledgeDocumentEntity
.
setCharCount
(
model
.
getCharCount
());
bizKnowledgeDocumentEntity
.
setUploadTime
(
model
.
getUploadTime
());
bizKnowledgeDocumentEntity
.
setUploadTime
(
model
.
getUploadTime
());
bizKnowledgeDocumentEntity
.
setIsEnable
(
model
.
getIsEnable
());
bizKnowledgeDocumentEntity
.
setIsEnable
(
model
.
getIsEnable
());
if
(
StringUtils
.
isNotBlank
(
model
.
getSegmentationConfig
()))
{
SegmentationConfigRequest
segmentationConfigRequest
=
JsonUtils
.
deSerialize
(
model
.
getSegmentationConfig
(),
SegmentationConfigRequest
.
class
);
bizKnowledgeDocumentEntity
.
setSegmentationConfig
(
segmentationConfigRequest
);
}
bizKnowledgeDocumentEntity
.
setKnowledgeId
(
model
.
getKnowledgeId
());
bizKnowledgeDocumentEntity
.
setKnowledgeId
(
model
.
getKnowledgeId
());
bizKnowledgeDocumentEntity
.
setTrainStatus
(
model
.
getTrainStatus
());
bizKnowledgeDocumentEntity
.
setTrainStatus
(
model
.
getTrainStatus
());
bizKnowledgeDocumentEntity
.
setIsDeleted
(
model
.
getIsDeleted
());
bizKnowledgeDocumentEntity
.
setIsDeleted
(
model
.
getIsDeleted
());
...
@@ -37,6 +44,7 @@ public class KnowledgeDocumentConvert {
...
@@ -37,6 +44,7 @@ public class KnowledgeDocumentConvert {
bizKnowledgeDocumentModel
.
setCharCount
(
entity
.
getCharCount
());
bizKnowledgeDocumentModel
.
setCharCount
(
entity
.
getCharCount
());
bizKnowledgeDocumentModel
.
setUploadTime
(
entity
.
getUploadTime
());
bizKnowledgeDocumentModel
.
setUploadTime
(
entity
.
getUploadTime
());
bizKnowledgeDocumentModel
.
setIsEnable
(
entity
.
getIsEnable
());
bizKnowledgeDocumentModel
.
setIsEnable
(
entity
.
getIsEnable
());
bizKnowledgeDocumentModel
.
setSegmentationConfig
(
JsonUtils
.
serialize
(
entity
.
getSegmentationConfig
()));
bizKnowledgeDocumentModel
.
setKnowledgeId
(
entity
.
getKnowledgeId
());
bizKnowledgeDocumentModel
.
setKnowledgeId
(
entity
.
getKnowledgeId
());
bizKnowledgeDocumentModel
.
setTrainStatus
(
entity
.
getTrainStatus
());
bizKnowledgeDocumentModel
.
setTrainStatus
(
entity
.
getTrainStatus
());
bizKnowledgeDocumentModel
.
setIsDeleted
(
entity
.
getIsDeleted
());
bizKnowledgeDocumentModel
.
setIsDeleted
(
entity
.
getIsDeleted
());
...
...
src/main/java/cn/com/poc/knowledge/dto/BizKnowledgeDocumentDto.java
View file @
87d16df2
package
cn
.
com
.
poc
.
knowledge
.
dto
;
package
cn
.
com
.
poc
.
knowledge
.
dto
;
import
cn.com.poc.thirdparty.resource.demand.ai.entity.knowledge.SegmentationConfigRequest
;
/**
/**
* Model class for biz_knowledge_document
* Model class for biz_knowledge_document
* 知识库文件表
* 知识库文件表
...
@@ -146,5 +148,16 @@ public class BizKnowledgeDocumentDto {
...
@@ -146,5 +148,16 @@ public class BizKnowledgeDocumentDto {
this
.
trainStatus
=
trainStatus
;
this
.
trainStatus
=
trainStatus
;
}
}
/**
* 分片规则
*/
private
SegmentationConfigRequest
segmentationConfig
;
public
SegmentationConfigRequest
getSegmentationConfig
()
{
return
segmentationConfig
;
}
public
void
setSegmentationConfig
(
SegmentationConfigRequest
segmentationConfig
)
{
this
.
segmentationConfig
=
segmentationConfig
;
}
}
}
\ No newline at end of file
src/main/java/cn/com/poc/knowledge/entity/BizKnowledgeDocumentEntity.java
View file @
87d16df2
package
cn
.
com
.
poc
.
knowledge
.
entity
;
package
cn
.
com
.
poc
.
knowledge
.
entity
;
import
cn.com.poc.thirdparty.resource.demand.ai.entity.knowledge.SegmentationConfigRequest
;
/**
/**
* Model class for biz_knowledge_document
* Model class for biz_knowledge_document
* 知识库文件表
* 知识库文件表
...
@@ -145,8 +147,20 @@ public class BizKnowledgeDocumentEntity{
...
@@ -145,8 +147,20 @@ public class BizKnowledgeDocumentEntity{
public
void
setTrainStatus
(
String
trainStatus
){
public
void
setTrainStatus
(
String
trainStatus
){
this
.
trainStatus
=
trainStatus
;
this
.
trainStatus
=
trainStatus
;
}
}
/**
* 分片规则
*/
private
SegmentationConfigRequest
segmentationConfig
;
public
SegmentationConfigRequest
getSegmentationConfig
()
{
return
segmentationConfig
;
}
public
void
setSegmentationConfig
(
SegmentationConfigRequest
segmentationConfig
)
{
this
.
segmentationConfig
=
segmentationConfig
;
}
/** is_deleted
/** is_deleted
*是否删除 Y 是 N 否
*是否删除 Y 是 N 否
*/
*/
...
...
src/main/java/cn/com/poc/knowledge/model/BizKnowledgeDocumentModel.java
View file @
87d16df2
This diff is collapsed.
Click to expand it.
src/main/java/cn/com/poc/knowledge/query/KnowledgeQuery.sql
View file @
87d16df2
...
@@ -5,6 +5,7 @@ select
...
@@ -5,6 +5,7 @@ select
bkd
.
document_name
,
bkd
.
document_name
,
bkd
.
document_url
,
bkd
.
document_url
,
bkd
.
char_count
,
bkd
.
char_count
,
bkd
.
segmentation_config
,
bkd
.
upload_time
,
bkd
.
upload_time
,
bkd
.
is_enable
,
bkd
.
is_enable
,
bkd
.
knowledge_id
,
bkd
.
knowledge_id
,
...
...
src/main/java/cn/com/poc/knowledge/query/KnowledgeQueryItem.java
View file @
87d16df2
...
@@ -10,148 +10,169 @@ import java.io.Serializable;
...
@@ -10,148 +10,169 @@ import java.io.Serializable;
* Query Item class for KnowledgeQuery
* Query Item class for KnowledgeQuery
*/
*/
@Entity
@Entity
public
class
KnowledgeQueryItem
extends
BaseItemClass
implements
Serializable
{
public
class
KnowledgeQueryItem
extends
BaseItemClass
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
private
static
final
long
serialVersionUID
=
1L
;
/** kd_id
/**
*kd_id
* kd_id
*/
* kd_id
*/
private
Integer
kdId
;
private
Integer
kdId
;
@Column
(
name
=
"kd_id"
)
@Column
(
name
=
"kd_id"
)
public
Integer
getKdId
(){
public
Integer
getKdId
()
{
return
this
.
kdId
;
return
this
.
kdId
;
}
}
public
void
setKdId
(
Integer
kdId
){
public
void
setKdId
(
Integer
kdId
)
{
this
.
kdId
=
kdId
;
this
.
kdId
=
kdId
;
}
}
/** owner
/**
*owner
* owner
*/
* owner
*/
private
String
owner
;
private
String
owner
;
@Column
(
name
=
"owner"
)
@Column
(
name
=
"owner"
)
public
String
getOwner
(){
public
String
getOwner
()
{
return
this
.
owner
;
return
this
.
owner
;
}
}
public
void
setOwner
(
String
owner
){
public
void
setOwner
(
String
owner
)
{
this
.
owner
=
owner
;
this
.
owner
=
owner
;
}
}
/** knowledge_type
/**
*knowledge_type
* knowledge_type
*/
* knowledge_type
*/
private
String
knowledgeType
;
private
String
knowledgeType
;
@Column
(
name
=
"knowledge_type"
)
@Column
(
name
=
"knowledge_type"
)
public
String
getKnowledgeType
(){
public
String
getKnowledgeType
()
{
return
this
.
knowledgeType
;
return
this
.
knowledgeType
;
}
}
public
void
setKnowledgeType
(
String
knowledgeType
){
public
void
setKnowledgeType
(
String
knowledgeType
)
{
this
.
knowledgeType
=
knowledgeType
;
this
.
knowledgeType
=
knowledgeType
;
}
}
/** document_name
/**
*document_name
* document_name
*/
* document_name
*/
private
String
documentName
;
private
String
documentName
;
@Column
(
name
=
"document_name"
)
@Column
(
name
=
"document_name"
)
public
String
getDocumentName
(){
public
String
getDocumentName
()
{
return
this
.
documentName
;
return
this
.
documentName
;
}
}
public
void
setDocumentName
(
String
documentName
){
public
void
setDocumentName
(
String
documentName
)
{
this
.
documentName
=
documentName
;
this
.
documentName
=
documentName
;
}
}
/** document_url
/**
*document_url
* document_url
*/
* document_url
*/
private
String
documentUrl
;
private
String
documentUrl
;
@Column
(
name
=
"document_url"
)
@Column
(
name
=
"document_url"
)
public
String
getDocumentUrl
(){
public
String
getDocumentUrl
()
{
return
this
.
documentUrl
;
return
this
.
documentUrl
;
}
}
public
void
setDocumentUrl
(
String
documentUrl
){
public
void
setDocumentUrl
(
String
documentUrl
)
{
this
.
documentUrl
=
documentUrl
;
this
.
documentUrl
=
documentUrl
;
}
}
/** char_count
/**
*char_count
* char_count
*/
* char_count
*/
private
Long
charCount
;
private
Long
charCount
;
@Column
(
name
=
"char_count"
)
@Column
(
name
=
"char_count"
)
public
Long
getCharCount
(){
public
Long
getCharCount
()
{
return
this
.
charCount
;
return
this
.
charCount
;
}
}
public
void
setCharCount
(
Long
charCount
){
public
void
setCharCount
(
Long
charCount
)
{
this
.
charCount
=
charCount
;
this
.
charCount
=
charCount
;
}
}
/** upload_time
/**
*upload_time
* upload_time
*/
* upload_time
*/
private
java
.
util
.
Date
uploadTime
;
private
java
.
util
.
Date
uploadTime
;
@Column
(
name
=
"upload_time"
)
@Column
(
name
=
"upload_time"
)
public
java
.
util
.
Date
getUploadTime
(){
public
java
.
util
.
Date
getUploadTime
()
{
return
this
.
uploadTime
;
return
this
.
uploadTime
;
}
}
public
void
setUploadTime
(
java
.
util
.
Date
uploadTime
){
public
void
setUploadTime
(
java
.
util
.
Date
uploadTime
)
{
this
.
uploadTime
=
uploadTime
;
this
.
uploadTime
=
uploadTime
;
}
}
/** is_enable
private
String
segmentationConfig
;
*is_enable
*/
@Column
(
name
=
"segmentation_config"
)
public
String
getSegmentationConfig
()
{
return
segmentationConfig
;
}
public
void
setSegmentationConfig
(
String
segmentationConfig
)
{
this
.
segmentationConfig
=
segmentationConfig
;
}
/**
* is_enable
* is_enable
*/
private
String
isEnable
;
private
String
isEnable
;
@Column
(
name
=
"is_enable"
)
@Column
(
name
=
"is_enable"
)
public
String
getIsEnable
(){
public
String
getIsEnable
()
{
return
this
.
isEnable
;
return
this
.
isEnable
;
}
}
public
void
setIsEnable
(
String
isEnable
){
public
void
setIsEnable
(
String
isEnable
)
{
this
.
isEnable
=
isEnable
;
this
.
isEnable
=
isEnable
;
}
}
/** knowledge_id
/**
*knowledge_id
* knowledge_id
*/
* knowledge_id
*/
private
String
knowledgeId
;
private
String
knowledgeId
;
@Column
(
name
=
"knowledge_id"
)
@Column
(
name
=
"knowledge_id"
)
public
String
getKnowledgeId
(){
public
String
getKnowledgeId
()
{
return
this
.
knowledgeId
;
return
this
.
knowledgeId
;
}
}
public
void
setKnowledgeId
(
String
knowledgeId
){
public
void
setKnowledgeId
(
String
knowledgeId
)
{
this
.
knowledgeId
=
knowledgeId
;
this
.
knowledgeId
=
knowledgeId
;
}
}
/** train_status
/**
*train_status
* train_status
*/
* train_status
*/
private
String
trainStatus
;
private
String
trainStatus
;
@Column
(
name
=
"train_status"
)
@Column
(
name
=
"train_status"
)
public
String
getTrainStatus
(){
public
String
getTrainStatus
()
{
return
this
.
trainStatus
;
return
this
.
trainStatus
;
}
}
public
void
setTrainStatus
(
String
trainStatus
){
public
void
setTrainStatus
(
String
trainStatus
)
{
this
.
trainStatus
=
trainStatus
;
this
.
trainStatus
=
trainStatus
;
}
}
}
}
\ No newline at end of file
src/main/java/cn/com/poc/knowledge/service/impl/BizKnowledgeDocumentServiceImpl.java
View file @
87d16df2
...
@@ -2,6 +2,7 @@ package cn.com.poc.knowledge.service.impl;
...
@@ -2,6 +2,7 @@ package cn.com.poc.knowledge.service.impl;
import
cn.com.poc.common.constant.CommonConstant
;
import
cn.com.poc.common.constant.CommonConstant
;
import
cn.com.poc.common.utils.Assert
;
import
cn.com.poc.common.utils.Assert
;
import
cn.com.poc.common.utils.JsonUtils
;
import
cn.com.poc.knowledge.convert.KnowledgeDocumentConvert
;
import
cn.com.poc.knowledge.convert.KnowledgeDocumentConvert
;
import
cn.com.poc.knowledge.entity.BizKnowledgeDocumentEntity
;
import
cn.com.poc.knowledge.entity.BizKnowledgeDocumentEntity
;
import
cn.com.poc.knowledge.model.BizKnowledgeDocumentModel
;
import
cn.com.poc.knowledge.model.BizKnowledgeDocumentModel
;
...
@@ -64,6 +65,10 @@ public class BizKnowledgeDocumentServiceImpl extends BaseServiceImpl
...
@@ -64,6 +65,10 @@ public class BizKnowledgeDocumentServiceImpl extends BaseServiceImpl
BeanUtil
.
copyProperties
(
entity
,
bizKnowledgeDocumentModel
,
new
CopyOptions
()
{{
BeanUtil
.
copyProperties
(
entity
,
bizKnowledgeDocumentModel
,
new
CopyOptions
()
{{
setIgnoreNullValue
(
true
);
setIgnoreNullValue
(
true
);
}});
}});
if
(
null
!=
entity
.
getSegmentationConfig
())
{
String
config
=
JsonUtils
.
serialize
(
entity
.
getSegmentationConfig
());
bizKnowledgeDocumentModel
.
setSegmentationConfig
(
config
);
}
BizKnowledgeDocumentModel
updateModel
=
this
.
repository
.
save
(
bizKnowledgeDocumentModel
);
BizKnowledgeDocumentModel
updateModel
=
this
.
repository
.
save
(
bizKnowledgeDocumentModel
);
return
KnowledgeDocumentConvert
.
modelToEntity
(
updateModel
);
return
KnowledgeDocumentConvert
.
modelToEntity
(
updateModel
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment