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
d46339dc
Commit
d46339dc
authored
Jun 19, 2025
by
alex yao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(LongTextDialogues):新增核心观点、总结摘要提取接口
parent
bc9cf150
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
840 additions
and
14 deletions
+840
-14
BizFileUploadRecordModel.java
...ava/cn/com/poc/common/model/BizFileUploadRecordModel.java
+14
-0
BosRestImpl.java
src/main/java/cn/com/poc/common/rest/impl/BosRestImpl.java
+11
-0
MD5Utils.java
src/main/java/cn/com/poc/common/utils/MD5Utils.java
+3
-0
LongTextDialoguesService.java
...poc/long_document/aggregate/LongTextDialoguesService.java
+3
-0
LongTextDialoguesServiceImpl.java
...document/aggregate/impl/LongTextDialoguesServiceImpl.java
+207
-14
BizLongTextSummaryCacheConvert.java
...long_document/convert/BizLongTextSummaryCacheConvert.java
+41
-0
LongTextSummaryDto.java
...java/cn/com/poc/long_document/dto/LongTextSummaryDto.java
+28
-0
BizLongTextSummaryCacheEntity.java
...c/long_document/entity/BizLongTextSummaryCacheEntity.java
+139
-0
BizLongTextSummaryCacheModel.java
...poc/long_document/model/BizLongTextSummaryCacheModel.java
+206
-0
BizLongTextSummaryCacheRepository.java
...ocument/repository/BizLongTextSummaryCacheRepository.java
+6
-0
LongTextDialoguesRest.java
.../cn/com/poc/long_document/rest/LongTextDialoguesRest.java
+5
-0
LongTextDialoguesRestImpl.java
...oc/long_document/rest/impl/LongTextDialoguesRestImpl.java
+10
-0
BizLongTextSummaryCacheService.java
...long_document/service/BizLongTextSummaryCacheService.java
+21
-0
BizLongTextSummaryCacheServiceImpl.java
...ment/service/impl/BizLongTextSummaryCacheServiceImpl.java
+112
-0
MD5UtilsTest.java
src/test/java/cn/com/poc/utils/MD5UtilsTest.java
+34
-0
No files found.
src/main/java/cn/com/poc/common/model/BizFileUploadRecordModel.java
View file @
d46339dc
...
@@ -89,4 +89,18 @@ public class BizFileUploadRecordModel extends BaseModelClass implements Serializ
...
@@ -89,4 +89,18 @@ public class BizFileUploadRecordModel extends BaseModelClass implements Serializ
super
.
addValidField
(
"coverSheetUrl"
);
super
.
addValidField
(
"coverSheetUrl"
);
}
}
/**
* md5
*/
private
String
md5
;
@Column
(
name
=
"md5"
,
length
=
128
)
public
String
getMd5
()
{
return
this
.
md5
;
}
public
void
setMd5
(
String
md5
)
{
this
.
md5
=
md5
;
super
.
addValidField
(
"md5"
);
}
}
}
\ No newline at end of file
src/main/java/cn/com/poc/common/rest/impl/BosRestImpl.java
View file @
d46339dc
...
@@ -5,11 +5,15 @@ import cn.com.poc.common.rest.BosRest;
...
@@ -5,11 +5,15 @@ import cn.com.poc.common.rest.BosRest;
import
cn.com.poc.common.service.BizFileUploadRecordService
;
import
cn.com.poc.common.service.BizFileUploadRecordService
;
import
cn.com.poc.common.service.BosConfigService
;
import
cn.com.poc.common.service.BosConfigService
;
import
cn.com.poc.common.utils.Assert
;
import
cn.com.poc.common.utils.Assert
;
import
cn.com.poc.common.utils.MD5Util
;
import
cn.com.poc.common.utils.MD5Utils
;
import
cn.hutool.crypto.digest.MD5
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
import
org.springframework.web.multipart.MultipartFile
;
import
org.springframework.web.multipart.MultipartFile
;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.io.InputStream
;
@Component
@Component
public
class
BosRestImpl
implements
BosRest
{
public
class
BosRestImpl
implements
BosRest
{
...
@@ -29,9 +33,16 @@ public class BosRestImpl implements BosRest {
...
@@ -29,9 +33,16 @@ public class BosRestImpl implements BosRest {
String
upload
=
bosConfigService
.
upload
(
file
.
getInputStream
(),
prefix
,
contentType
);
String
upload
=
bosConfigService
.
upload
(
file
.
getInputStream
(),
prefix
,
contentType
);
//计算文件MD5值
InputStream
inputStream
=
file
.
getInputStream
();
byte
[]
bytes
=
new
byte
[
inputStream
.
available
()];
inputStream
.
read
(
bytes
);
String
md5
=
MD5
.
create
().
digestHex
(
bytes
);
BizFileUploadRecordModel
bizFileUploadRecordModel
=
new
BizFileUploadRecordModel
();
BizFileUploadRecordModel
bizFileUploadRecordModel
=
new
BizFileUploadRecordModel
();
bizFileUploadRecordModel
.
setFileName
(
file
.
getOriginalFilename
());
bizFileUploadRecordModel
.
setFileName
(
file
.
getOriginalFilename
());
bizFileUploadRecordModel
.
setFileUrl
(
upload
);
bizFileUploadRecordModel
.
setFileUrl
(
upload
);
bizFileUploadRecordModel
.
setMd5
(
md5
);
bizFileUploadRecordModel
.
setCoverSheetUrl
(
""
);
bizFileUploadRecordModel
.
setCoverSheetUrl
(
""
);
bizFileUploadRecordService
.
save
(
bizFileUploadRecordModel
);
bizFileUploadRecordService
.
save
(
bizFileUploadRecordModel
);
return
upload
;
return
upload
;
...
...
src/main/java/cn/com/poc/common/utils/MD5Utils.java
View file @
d46339dc
...
@@ -3,8 +3,11 @@ package cn.com.poc.common.utils;
...
@@ -3,8 +3,11 @@ package cn.com.poc.common.utils;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
java.io.UnsupportedEncodingException
;
import
java.io.UnsupportedEncodingException
;
import
java.security.MessageDigest
;
import
java.security.NoSuchAlgorithmException
;
public
class
MD5Utils
{
public
class
MD5Utils
{
/*** 编码 */
/*** 编码 */
public
static
byte
[]
getContentBytes
(
String
content
,
String
charset
)
{
public
static
byte
[]
getContentBytes
(
String
content
,
String
charset
)
{
if
(
charset
==
null
||
""
.
equals
(
charset
))
{
if
(
charset
==
null
||
""
.
equals
(
charset
))
{
...
...
src/main/java/cn/com/poc/long_document/aggregate/LongTextDialoguesService.java
View file @
d46339dc
...
@@ -3,6 +3,7 @@ package cn.com.poc.long_document.aggregate;
...
@@ -3,6 +3,7 @@ package cn.com.poc.long_document.aggregate;
import
cn.com.poc.long_document.dto.DialoguesContextDto
;
import
cn.com.poc.long_document.dto.DialoguesContextDto
;
import
cn.com.poc.long_document.dto.LongTextDialoguesDto
;
import
cn.com.poc.long_document.dto.LongTextDialoguesDto
;
import
cn.com.poc.long_document.dto.LongTextExampleDto
;
import
cn.com.poc.long_document.dto.LongTextExampleDto
;
import
cn.com.poc.long_document.dto.LongTextSummaryDto
;
import
java.util.List
;
import
java.util.List
;
...
@@ -16,6 +17,8 @@ public interface LongTextDialoguesService {
...
@@ -16,6 +17,8 @@ public interface LongTextDialoguesService {
void
call
(
String
dialoguesId
,
String
fileUrl
,
String
input
,
Integer
[]
knowledgeIds
,
Long
userId
)
throws
Exception
;
void
call
(
String
dialoguesId
,
String
fileUrl
,
String
input
,
Integer
[]
knowledgeIds
,
Long
userId
)
throws
Exception
;
LongTextSummaryDto
summary
(
String
dialoguesId
,
Long
userId
)
throws
Exception
;
void
delete
(
String
dialoguesId
,
Long
userId
)
throws
Exception
;
void
delete
(
String
dialoguesId
,
Long
userId
)
throws
Exception
;
LongTextDialoguesDto
dialoguesDetail
(
String
dialoguesId
,
Long
userId
)
throws
Exception
;
LongTextDialoguesDto
dialoguesDetail
(
String
dialoguesId
,
Long
userId
)
throws
Exception
;
...
...
src/main/java/cn/com/poc/long_document/aggregate/impl/LongTextDialoguesServiceImpl.java
View file @
d46339dc
This diff is collapsed.
Click to expand it.
src/main/java/cn/com/poc/long_document/convert/BizLongTextSummaryCacheConvert.java
0 → 100644
View file @
d46339dc
package
cn
.
com
.
poc
.
long_document
.
convert
;
import
cn.com.poc.long_document.entity.BizLongTextSummaryCacheEntity
;
import
cn.com.poc.long_document.model.BizLongTextSummaryCacheModel
;
public
class
BizLongTextSummaryCacheConvert
{
public
static
BizLongTextSummaryCacheEntity
modelToEntity
(
BizLongTextSummaryCacheModel
model
)
{
BizLongTextSummaryCacheEntity
entity
=
new
BizLongTextSummaryCacheEntity
();
entity
.
setId
(
model
.
getId
());
entity
.
setCorePoint
(
model
.
getCorePoint
());
entity
.
setSummary
(
model
.
getSummary
());
entity
.
setFileUrl
(
model
.
getFileUrl
());
entity
.
setFileMd5
(
model
.
getFileMd5
());
entity
.
setIsDeleted
(
model
.
getIsDeleted
());
entity
.
setCreator
(
model
.
getCreator
());
entity
.
setCreatedTime
(
model
.
getCreatedTime
());
entity
.
setModifier
(
model
.
getModifier
());
entity
.
setModifiedTime
(
model
.
getModifiedTime
());
entity
.
setSysVersion
(
model
.
getSysVersion
());
return
entity
;
}
public
static
BizLongTextSummaryCacheModel
entityToModel
(
BizLongTextSummaryCacheEntity
entity
)
{
BizLongTextSummaryCacheModel
model
=
new
BizLongTextSummaryCacheModel
();
model
.
setId
(
entity
.
getId
());
model
.
setCorePoint
(
entity
.
getCorePoint
());
model
.
setSummary
(
entity
.
getSummary
());
model
.
setFileUrl
(
entity
.
getFileUrl
());
model
.
setFileMd5
(
entity
.
getFileMd5
());
model
.
setIsDeleted
(
entity
.
getIsDeleted
());
model
.
setCreator
(
entity
.
getCreator
());
model
.
setCreatedTime
(
entity
.
getCreatedTime
());
model
.
setModifier
(
entity
.
getModifier
());
model
.
setModifiedTime
(
entity
.
getModifiedTime
());
model
.
setSysVersion
(
entity
.
getSysVersion
());
return
model
;
}
}
\ No newline at end of file
src/main/java/cn/com/poc/long_document/dto/LongTextSummaryDto.java
0 → 100644
View file @
d46339dc
package
cn
.
com
.
poc
.
long_document
.
dto
;
/**
* @author alex.yao
* @date 2025/6/18
*/
public
class
LongTextSummaryDto
{
private
String
summary
;
private
String
corePoint
;
public
String
getSummary
()
{
return
summary
;
}
public
void
setSummary
(
String
summary
)
{
this
.
summary
=
summary
;
}
public
String
getCorePoint
()
{
return
corePoint
;
}
public
void
setCorePoint
(
String
corePoint
)
{
this
.
corePoint
=
corePoint
;
}
}
src/main/java/cn/com/poc/long_document/entity/BizLongTextSummaryCacheEntity.java
0 → 100644
View file @
d46339dc
package
cn
.
com
.
poc
.
long_document
.
entity
;
public
class
BizLongTextSummaryCacheEntity
{
private
static
final
long
serialVersionUID
=
1L
;
/** id
*
*/
private
java
.
lang
.
Long
id
;
public
java
.
lang
.
Long
getId
(){
return
this
.
id
;
}
public
void
setId
(
java
.
lang
.
Long
id
){
this
.
id
=
id
;
}
/** core_point
*核心观点
*/
private
java
.
lang
.
String
corePoint
;
public
java
.
lang
.
String
getCorePoint
(){
return
this
.
corePoint
;
}
public
void
setCorePoint
(
java
.
lang
.
String
corePoint
){
this
.
corePoint
=
corePoint
;
}
/** summary
*总结摘要
*/
private
java
.
lang
.
String
summary
;
public
java
.
lang
.
String
getSummary
(){
return
this
.
summary
;
}
public
void
setSummary
(
java
.
lang
.
String
summary
){
this
.
summary
=
summary
;
}
/** file_url
*文件地址
*/
private
java
.
lang
.
String
fileUrl
;
public
java
.
lang
.
String
getFileUrl
(){
return
this
.
fileUrl
;
}
public
void
setFileUrl
(
java
.
lang
.
String
fileUrl
){
this
.
fileUrl
=
fileUrl
;
}
/** file_md5
*文件MD5
*/
private
java
.
lang
.
String
fileMd5
;
public
java
.
lang
.
String
getFileMd5
(){
return
this
.
fileMd5
;
}
public
void
setFileMd5
(
java
.
lang
.
String
fileMd5
){
this
.
fileMd5
=
fileMd5
;
}
/** is_deleted
*是否删除 1、Y 是 2、N 否
*/
private
java
.
lang
.
String
isDeleted
;
public
java
.
lang
.
String
getIsDeleted
(){
return
this
.
isDeleted
;
}
public
void
setIsDeleted
(
java
.
lang
.
String
isDeleted
){
this
.
isDeleted
=
isDeleted
;
}
/** CREATOR
*创建人
*/
private
java
.
lang
.
String
creator
;
public
java
.
lang
.
String
getCreator
(){
return
this
.
creator
;
}
public
void
setCreator
(
java
.
lang
.
String
creator
){
this
.
creator
=
creator
;
}
/** CREATED_TIME
*创建时间
*/
private
java
.
util
.
Date
createdTime
;
public
java
.
util
.
Date
getCreatedTime
(){
return
this
.
createdTime
;
}
public
void
setCreatedTime
(
java
.
util
.
Date
createdTime
){
this
.
createdTime
=
createdTime
;
}
/** MODIFIER
*修改人
*/
private
java
.
lang
.
String
modifier
;
public
java
.
lang
.
String
getModifier
(){
return
this
.
modifier
;
}
public
void
setModifier
(
java
.
lang
.
String
modifier
){
this
.
modifier
=
modifier
;
}
/** MODIFIED_TIME
*修改时间
*/
private
java
.
util
.
Date
modifiedTime
;
public
java
.
util
.
Date
getModifiedTime
(){
return
this
.
modifiedTime
;
}
public
void
setModifiedTime
(
java
.
util
.
Date
modifiedTime
){
this
.
modifiedTime
=
modifiedTime
;
}
/** SYS_VERSION
*乐观锁,版本号
*/
private
java
.
lang
.
Integer
sysVersion
;
public
java
.
lang
.
Integer
getSysVersion
(){
return
this
.
sysVersion
;
}
public
void
setSysVersion
(
java
.
lang
.
Integer
sysVersion
){
this
.
sysVersion
=
sysVersion
;
}
}
\ No newline at end of file
src/main/java/cn/com/poc/long_document/model/BizLongTextSummaryCacheModel.java
0 → 100644
View file @
d46339dc
package
cn
.
com
.
poc
.
long_document
.
model
;
import
java.io.Serializable
;
import
cn.com.yict.framemax.data.model.BaseModelClass
;
import
javax.persistence.Column
;
import
javax.persistence.Entity
;
import
javax.persistence.Table
;
import
javax.persistence.Id
;
import
org.hibernate.annotations.DynamicInsert
;
import
org.hibernate.annotations.DynamicUpdate
;
import
javax.persistence.Version
;
import
javax.persistence.GeneratedValue
;
import
javax.persistence.GenerationType
;
/**
* Model class for biz_long_text_summary_cache
* 文档核心观点提取、总结摘要缓存表
*/
@Entity
@Table
(
name
=
"biz_long_text_summary_cache"
)
@DynamicInsert
@DynamicUpdate
public
class
BizLongTextSummaryCacheModel
extends
BaseModelClass
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
/** id
*
*/
private
java
.
lang
.
Long
id
;
@Column
(
name
=
"id"
,
length
=
19
)
@Id
@GeneratedValue
(
strategy
=
GenerationType
.
AUTO
)
public
java
.
lang
.
Long
getId
(){
return
this
.
id
;
}
public
void
setId
(
java
.
lang
.
Long
id
){
this
.
id
=
id
;
super
.
addValidField
(
"id"
);
}
/** core_point
*核心观点
*/
private
java
.
lang
.
String
corePoint
;
@Column
(
name
=
"core_point"
,
length
=
2147483647
)
public
java
.
lang
.
String
getCorePoint
(){
return
this
.
corePoint
;
}
public
void
setCorePoint
(
java
.
lang
.
String
corePoint
){
this
.
corePoint
=
corePoint
;
super
.
addValidField
(
"corePoint"
);
}
/** summary
*总结摘要
*/
private
java
.
lang
.
String
summary
;
@Column
(
name
=
"summary"
,
length
=
2147483647
)
public
java
.
lang
.
String
getSummary
(){
return
this
.
summary
;
}
public
void
setSummary
(
java
.
lang
.
String
summary
){
this
.
summary
=
summary
;
super
.
addValidField
(
"summary"
);
}
/** file_url
*文件地址
*/
private
java
.
lang
.
String
fileUrl
;
@Column
(
name
=
"file_url"
,
length
=
200
)
public
java
.
lang
.
String
getFileUrl
(){
return
this
.
fileUrl
;
}
public
void
setFileUrl
(
java
.
lang
.
String
fileUrl
){
this
.
fileUrl
=
fileUrl
;
super
.
addValidField
(
"fileUrl"
);
}
/** file_md5
*文件MD5
*/
private
java
.
lang
.
String
fileMd5
;
@Column
(
name
=
"file_md5"
,
length
=
128
)
public
java
.
lang
.
String
getFileMd5
(){
return
this
.
fileMd5
;
}
public
void
setFileMd5
(
java
.
lang
.
String
fileMd5
){
this
.
fileMd5
=
fileMd5
;
super
.
addValidField
(
"fileMd5"
);
}
/** is_deleted
*是否删除 1、Y 是 2、N 否
*/
private
java
.
lang
.
String
isDeleted
;
@Column
(
name
=
"is_deleted"
,
length
=
1
)
public
java
.
lang
.
String
getIsDeleted
(){
return
this
.
isDeleted
;
}
public
void
setIsDeleted
(
java
.
lang
.
String
isDeleted
){
this
.
isDeleted
=
isDeleted
;
super
.
addValidField
(
"isDeleted"
);
}
/** CREATOR
*创建人
*/
private
java
.
lang
.
String
creator
;
@Column
(
name
=
"CREATOR"
,
length
=
225
)
public
java
.
lang
.
String
getCreator
(){
return
this
.
creator
;
}
public
void
setCreator
(
java
.
lang
.
String
creator
){
this
.
creator
=
creator
;
super
.
addValidField
(
"creator"
);
}
/** CREATED_TIME
*创建时间
*/
private
java
.
util
.
Date
createdTime
;
@Column
(
name
=
"CREATED_TIME"
,
length
=
19
)
public
java
.
util
.
Date
getCreatedTime
(){
return
this
.
createdTime
;
}
public
void
setCreatedTime
(
java
.
util
.
Date
createdTime
){
this
.
createdTime
=
createdTime
;
super
.
addValidField
(
"createdTime"
);
}
/** MODIFIER
*修改人
*/
private
java
.
lang
.
String
modifier
;
@Column
(
name
=
"MODIFIER"
,
length
=
225
)
public
java
.
lang
.
String
getModifier
(){
return
this
.
modifier
;
}
public
void
setModifier
(
java
.
lang
.
String
modifier
){
this
.
modifier
=
modifier
;
super
.
addValidField
(
"modifier"
);
}
/** MODIFIED_TIME
*修改时间
*/
private
java
.
util
.
Date
modifiedTime
;
@Column
(
name
=
"MODIFIED_TIME"
,
length
=
19
)
public
java
.
util
.
Date
getModifiedTime
(){
return
this
.
modifiedTime
;
}
public
void
setModifiedTime
(
java
.
util
.
Date
modifiedTime
){
this
.
modifiedTime
=
modifiedTime
;
super
.
addValidField
(
"modifiedTime"
);
}
/** SYS_VERSION
*乐观锁,版本号
*/
private
java
.
lang
.
Integer
sysVersion
;
@Column
(
name
=
"SYS_VERSION"
,
length
=
10
)
@Version
public
java
.
lang
.
Integer
getSysVersion
(){
return
this
.
sysVersion
;
}
public
void
setSysVersion
(
java
.
lang
.
Integer
sysVersion
){
this
.
sysVersion
=
sysVersion
;
super
.
addValidField
(
"sysVersion"
);
}
}
\ No newline at end of file
src/main/java/cn/com/poc/long_document/repository/BizLongTextSummaryCacheRepository.java
0 → 100644
View file @
d46339dc
package
cn
.
com
.
poc
.
long_document
.
repository
;
import
cn.com.yict.framemax.data.repository.Repository
;
import
cn.com.poc.long_document.model.BizLongTextSummaryCacheModel
;
public
interface
BizLongTextSummaryCacheRepository
extends
Repository
<
BizLongTextSummaryCacheModel
,
java
.
lang
.
Long
>
{
}
\ No newline at end of file
src/main/java/cn/com/poc/long_document/rest/LongTextDialoguesRest.java
View file @
d46339dc
...
@@ -28,6 +28,11 @@ public interface LongTextDialoguesRest extends BaseRest {
...
@@ -28,6 +28,11 @@ public interface LongTextDialoguesRest extends BaseRest {
*/
*/
String
create
(
@RequestBody
CreateDialoguesDto
dto
)
throws
Exception
;
String
create
(
@RequestBody
CreateDialoguesDto
dto
)
throws
Exception
;
/**
*核心观点提取、总结摘要
*
*/
LongTextSummaryDto
summary
(
@RequestParam
String
dialoguesId
)
throws
Exception
;
/**
/**
* 对话调用
* 对话调用
...
...
src/main/java/cn/com/poc/long_document/rest/impl/LongTextDialoguesRestImpl.java
View file @
d46339dc
...
@@ -51,6 +51,16 @@ public class LongTextDialoguesRestImpl implements LongTextDialoguesRest {
...
@@ -51,6 +51,16 @@ public class LongTextDialoguesRestImpl implements LongTextDialoguesRest {
userBaseEntity
.
getUserId
());
userBaseEntity
.
getUserId
());
}
}
@Override
public
LongTextSummaryDto
summary
(
String
dialoguesId
)
throws
Exception
{
UserBaseEntity
userBaseEntity
=
BlContext
.
getCurrentUserNotException
();
if
(
userBaseEntity
==
null
)
{
throw
new
BusinessException
(
"用户未登录"
);
}
return
longTextDialoguesService
.
summary
(
dialoguesId
,
userBaseEntity
.
getUserId
());
}
@Override
@Override
public
void
delete
(
String
dialoguesId
)
throws
Exception
{
public
void
delete
(
String
dialoguesId
)
throws
Exception
{
Assert
.
notBlank
(
dialoguesId
,
"对话ID不能为空"
);
Assert
.
notBlank
(
dialoguesId
,
"对话ID不能为空"
);
...
...
src/main/java/cn/com/poc/long_document/service/BizLongTextSummaryCacheService.java
0 → 100644
View file @
d46339dc
package
cn
.
com
.
poc
.
long_document
.
service
;
import
cn.com.yict.framemax.core.service.BaseService
;
import
cn.com.poc.long_document.entity.BizLongTextSummaryCacheEntity
;
import
cn.com.yict.framemax.data.model.PagingInfo
;
import
java.util.Collection
;
import
java.util.List
;
public
interface
BizLongTextSummaryCacheService
extends
BaseService
{
BizLongTextSummaryCacheEntity
get
(
java
.
lang
.
Long
id
)
throws
Exception
;
List
<
BizLongTextSummaryCacheEntity
>
findByExample
(
BizLongTextSummaryCacheEntity
example
,
PagingInfo
pagingInfo
)
throws
Exception
;
BizLongTextSummaryCacheEntity
save
(
BizLongTextSummaryCacheEntity
entity
)
throws
Exception
;
BizLongTextSummaryCacheEntity
update
(
BizLongTextSummaryCacheEntity
entity
)
throws
Exception
;
void
deletedById
(
java
.
lang
.
Long
id
)
throws
Exception
;
}
\ No newline at end of file
src/main/java/cn/com/poc/long_document/service/impl/BizLongTextSummaryCacheServiceImpl.java
0 → 100644
View file @
d46339dc
package
cn
.
com
.
poc
.
long_document
.
service
.
impl
;
import
cn.com.yict.framemax.core.service.impl.BaseServiceImpl
;
import
cn.com.poc.long_document.service.BizLongTextSummaryCacheService
;
import
cn.com.poc.long_document.model.BizLongTextSummaryCacheModel
;
import
cn.com.poc.long_document.entity.BizLongTextSummaryCacheEntity
;
import
cn.com.poc.long_document.convert.BizLongTextSummaryCacheConvert
;
import
cn.com.poc.long_document.repository.BizLongTextSummaryCacheRepository
;
import
cn.com.yict.framemax.data.model.PagingInfo
;
import
org.springframework.stereotype.Service
;
import
org.apache.commons.collections4.CollectionUtils
;
import
java.util.ArrayList
;
import
java.util.stream.Collectors
;
import
java.util.List
;
import
javax.annotation.Resource
;
import
org.springframework.util.Assert
;
@Service
public
class
BizLongTextSummaryCacheServiceImpl
extends
BaseServiceImpl
implements
BizLongTextSummaryCacheService
{
@Resource
private
BizLongTextSummaryCacheRepository
repository
;
public
BizLongTextSummaryCacheEntity
get
(
java
.
lang
.
Long
id
)
throws
Exception
{
Assert
.
notNull
(
id
);
BizLongTextSummaryCacheModel
model
=
this
.
repository
.
get
(
id
);
if
(
model
==
null
){
return
null
;
}
if
(
"Y"
.
equals
(
model
.
getIsDeleted
())){
return
null
;
}
return
BizLongTextSummaryCacheConvert
.
modelToEntity
(
model
);
}
public
List
<
BizLongTextSummaryCacheEntity
>
findByExample
(
BizLongTextSummaryCacheEntity
example
,
PagingInfo
pagingInfo
)
throws
Exception
{
List
<
BizLongTextSummaryCacheEntity
>
result
=
new
ArrayList
<
BizLongTextSummaryCacheEntity
>();
BizLongTextSummaryCacheModel
model
=
new
BizLongTextSummaryCacheModel
();
if
(
example
!=
null
){
model
=
BizLongTextSummaryCacheConvert
.
entityToModel
(
example
);
}
model
.
setIsDeleted
(
"N"
);
List
<
BizLongTextSummaryCacheModel
>
models
=
this
.
repository
.
findByExample
(
model
,
pagingInfo
);
if
(
CollectionUtils
.
isNotEmpty
(
models
))
{
result
=
models
.
stream
().
map
(
BizLongTextSummaryCacheConvert:
:
modelToEntity
).
collect
(
Collectors
.
toList
());
}
return
result
;
}
public
BizLongTextSummaryCacheEntity
save
(
BizLongTextSummaryCacheEntity
entity
)
throws
Exception
{
Assert
.
notNull
(
entity
);
entity
.
setId
(
null
);
entity
.
setIsDeleted
(
"N"
);
BizLongTextSummaryCacheModel
model
=
BizLongTextSummaryCacheConvert
.
entityToModel
(
entity
);
BizLongTextSummaryCacheModel
saveModel
=
this
.
repository
.
save
(
model
);
return
BizLongTextSummaryCacheConvert
.
modelToEntity
(
saveModel
);
}
public
BizLongTextSummaryCacheEntity
update
(
BizLongTextSummaryCacheEntity
entity
)
throws
Exception
{
Assert
.
notNull
(
entity
);
Assert
.
notNull
(
entity
.
getId
(),
"update pk can not be null"
);
BizLongTextSummaryCacheModel
model
=
this
.
repository
.
get
(
entity
.
getId
());
if
(
entity
.
getCorePoint
()
!=
null
){
model
.
setCorePoint
(
entity
.
getCorePoint
());
}
if
(
entity
.
getSummary
()
!=
null
){
model
.
setSummary
(
entity
.
getSummary
());
}
if
(
entity
.
getFileUrl
()
!=
null
){
model
.
setFileUrl
(
entity
.
getFileUrl
());
}
if
(
entity
.
getFileMd5
()
!=
null
){
model
.
setFileMd5
(
entity
.
getFileMd5
());
}
if
(
entity
.
getIsDeleted
()
!=
null
){
model
.
setIsDeleted
(
entity
.
getIsDeleted
());
}
if
(
entity
.
getCreator
()
!=
null
){
model
.
setCreator
(
entity
.
getCreator
());
}
if
(
entity
.
getCreatedTime
()
!=
null
){
model
.
setCreatedTime
(
entity
.
getCreatedTime
());
}
if
(
entity
.
getModifier
()
!=
null
){
model
.
setModifier
(
entity
.
getModifier
());
}
if
(
entity
.
getModifiedTime
()
!=
null
){
model
.
setModifiedTime
(
entity
.
getModifiedTime
());
}
if
(
entity
.
getSysVersion
()
!=
null
){
model
.
setSysVersion
(
entity
.
getSysVersion
());
}
BizLongTextSummaryCacheModel
saveModel
=
this
.
repository
.
save
(
model
);
return
BizLongTextSummaryCacheConvert
.
modelToEntity
(
saveModel
);
}
public
void
deletedById
(
java
.
lang
.
Long
id
)
throws
Exception
{
Assert
.
notNull
(
id
);
BizLongTextSummaryCacheModel
model
=
this
.
repository
.
get
(
id
);
if
(
model
!=
null
){
if
(
"N"
.
equals
(
model
.
getIsDeleted
())){
model
.
setIsDeleted
(
"Y"
);
this
.
repository
.
save
(
model
);
}
}
}
}
\ No newline at end of file
src/test/java/cn/com/poc/utils/MD5UtilsTest.java
0 → 100644
View file @
d46339dc
package
cn
.
com
.
poc
.
utils
;
import
cn.com.poc.common.utils.MD5Utils
;
import
cn.com.yict.framemax.core.spring.SingleContextInitializer
;
import
cn.hutool.crypto.digest.MD5
;
import
org.junit.runner.RunWith
;
import
org.junit.Test
;
import
org.springframework.test.context.ContextConfiguration
;
import
org.springframework.test.context.junit4.SpringJUnit4ClassRunner
;
import
org.springframework.test.context.web.WebAppConfiguration
;
import
java.io.*
;
import
java.nio.file.Files
;
/**
* @author alex.yao
* @date 2025/6/18
*/
@RunWith
(
SpringJUnit4ClassRunner
.
class
)
@ContextConfiguration
(
initializers
=
SingleContextInitializer
.
class
)
@WebAppConfiguration
public
class
MD5UtilsTest
{
@Test
public
void
test_md5
()
throws
IOException
{
//计算文件MD5值
File
file
=
new
File
(
"C:\\Users\\52747\\Documents\\dataset\\22222(中文版).pdf"
);
InputStream
inputStream
=
Files
.
newInputStream
(
file
.
toPath
());
byte
[]
bytes
=
new
byte
[
inputStream
.
available
()];
inputStream
.
read
(
bytes
);
String
md5
=
MD5
.
create
().
digestHex
(
bytes
);
System
.
out
.
println
(
md5
);
}
}
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