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
a0728e8d
Commit
a0728e8d
authored
Jun 24, 2025
by
alex yao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:智写案例接口
parent
18b65d9f
Show whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
751 additions
and
0 deletions
+751
-0
AiWritingService.java
...n/java/cn/com/poc/writing/aggregate/AiWritingService.java
+21
-0
AiWritingServiceImpl.java
.../com/poc/writing/aggregate/impl/AiWritingServiceImpl.java
+50
-0
BizAiWritingExampleConvert.java
...n/com/poc/writing/convert/BizAiWritingExampleConvert.java
+29
-0
BizAiWritingExampleTypeConvert.java
...m/poc/writing/convert/BizAiWritingExampleTypeConvert.java
+26
-0
AiWritingExampleDto.java
...main/java/cn/com/poc/writing/dto/AiWritingExampleDto.java
+57
-0
AiWritingExampleTypeDto.java
.../java/cn/com/poc/writing/dto/AiWritingExampleTypeDto.java
+32
-0
BizAiWritingExampleEntity.java
.../cn/com/poc/writing/entity/BizAiWritingExampleEntity.java
+67
-0
BizAiWritingExampleTypeEntity.java
...com/poc/writing/entity/BizAiWritingExampleTypeEntity.java
+43
-0
BizAiWritingExampleModel.java
...va/cn/com/poc/writing/model/BizAiWritingExampleModel.java
+108
-0
BizAiWritingExampleTypeModel.java
...n/com/poc/writing/model/BizAiWritingExampleTypeModel.java
+76
-0
BizAiWritingExampleRepository.java
...poc/writing/repository/BizAiWritingExampleRepository.java
+6
-0
BizAiWritingExampleTypeRepository.java
...writing/repository/BizAiWritingExampleTypeRepository.java
+6
-0
AiWritingRest.java
src/main/java/cn/com/poc/writing/rest/AiWritingRest.java
+9
-0
AiWritingRestImpl.java
.../java/cn/com/poc/writing/rest/impl/AiWritingRestImpl.java
+15
-0
BizAiWritingExampleService.java
...n/com/poc/writing/service/BizAiWritingExampleService.java
+21
-0
BizAiWritingExampleTypeService.java
...m/poc/writing/service/BizAiWritingExampleTypeService.java
+21
-0
BizAiWritingExampleServiceImpl.java
.../writing/service/impl/BizAiWritingExampleServiceImpl.java
+85
-0
BizAiWritingExampleTypeServiceImpl.java
...ting/service/impl/BizAiWritingExampleTypeServiceImpl.java
+79
-0
No files found.
src/main/java/cn/com/poc/writing/aggregate/AiWritingService.java
View file @
a0728e8d
package
cn
.
com
.
poc
.
writing
.
aggregate
;
import
cn.com.poc.writing.dto.AiWritingExampleDto
;
import
cn.com.poc.writing.dto.AiWritingExampleTypeDto
;
import
java.util.List
;
/**
* @author alex.yao
* @date 2025/6/20
...
...
@@ -19,4 +24,20 @@ public interface AiWritingService {
void
call
(
String
dialoguesId
,
String
fileUrl
,
String
input
,
Integer
[]
knowledgeIds
,
Long
userId
)
throws
Exception
;
/**
* 获取示例列表
*
* @param type 类型
* @return
*/
List
<
AiWritingExampleDto
>
example
(
String
type
)
throws
Exception
;
/**
* 获取示例类型
*
* @return
*/
List
<
AiWritingExampleTypeDto
>
exampleType
()
throws
Exception
;
}
src/main/java/cn/com/poc/writing/aggregate/impl/AiWritingServiceImpl.java
View file @
a0728e8d
...
...
@@ -29,6 +29,12 @@ import cn.com.poc.thirdparty.resource.demand.ai.entity.largemodel.LargeModelDema
import
cn.com.poc.thirdparty.resource.demand.ai.entity.largemodel.LargeModelResponse
;
import
cn.com.poc.thirdparty.service.LLMService
;
import
cn.com.poc.writing.aggregate.AiWritingService
;
import
cn.com.poc.writing.dto.AiWritingExampleDto
;
import
cn.com.poc.writing.dto.AiWritingExampleTypeDto
;
import
cn.com.poc.writing.entity.BizAiWritingExampleEntity
;
import
cn.com.poc.writing.entity.BizAiWritingExampleTypeEntity
;
import
cn.com.poc.writing.service.BizAiWritingExampleService
;
import
cn.com.poc.writing.service.BizAiWritingExampleTypeService
;
import
cn.com.yict.framemax.core.exception.BusinessException
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.commons.lang3.StringUtils
;
...
...
@@ -41,6 +47,7 @@ import java.io.BufferedReader;
import
java.io.File
;
import
java.io.IOException
;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.List
;
import
java.util.stream.Collectors
;
...
...
@@ -81,6 +88,12 @@ public class AiWritingServiceImpl implements AiWritingService {
@Resource
private
DemandKnowledgeService
demandKnowledgeService
;
@Resource
private
BizAiWritingExampleService
bizAiWritingExampleService
;
@Resource
private
BizAiWritingExampleTypeService
bizAiWritingExampleTypeService
;
@Override
public
void
call
(
String
dialoguesId
,
String
fileUrl
,
String
input
,
Integer
[]
knowledgeIds
,
Long
userId
)
throws
Exception
{
...
...
@@ -186,6 +199,43 @@ public class AiWritingServiceImpl implements AiWritingService {
}
@Override
public
List
<
AiWritingExampleDto
>
example
(
String
type
)
throws
Exception
{
BizAiWritingExampleEntity
bizAiWritingExample
=
new
BizAiWritingExampleEntity
();
if
(!
"ALL"
.
equals
(
type
))
{
bizAiWritingExample
.
setType
(
type
);
}
List
<
BizAiWritingExampleEntity
>
exampleEntities
=
bizAiWritingExampleService
.
findByExample
(
bizAiWritingExample
,
null
);
if
(
CollectionUtils
.
isEmpty
(
exampleEntities
))
{
return
Collections
.
emptyList
();
}
return
exampleEntities
.
stream
().
map
(
entity
->
{
AiWritingExampleDto
dto
=
new
AiWritingExampleDto
();
dto
.
setType
(
entity
.
getType
());
dto
.
setTitle
(
entity
.
getTitle
());
dto
.
setDescription
(
entity
.
getDescription
());
dto
.
setQuestion
(
entity
.
getQuestion
());
return
dto
;
}).
collect
(
Collectors
.
toList
());
}
@Override
public
List
<
AiWritingExampleTypeDto
>
exampleType
()
throws
Exception
{
List
<
BizAiWritingExampleTypeEntity
>
entities
=
bizAiWritingExampleTypeService
.
findByExample
(
new
BizAiWritingExampleTypeEntity
(),
null
);
if
(
CollectionUtils
.
isEmpty
(
entities
))
{
return
Collections
.
emptyList
();
}
return
entities
.
stream
().
map
(
entity
->
{
AiWritingExampleTypeDto
dto
=
new
AiWritingExampleTypeDto
();
dto
.
setType
(
entity
.
getType
());
dto
.
setName
(
entity
.
getName
());
return
dto
;
}).
collect
(
Collectors
.
toList
());
}
private
List
<
Message
>
buildMessages
(
String
dialogsId
,
Long
userId
,
String
input
,
String
fileUrl
,
List
<
KnowledgeContentResult
>
knowledgeContentResults
)
throws
Exception
{
// 获取对话提示词
String
promptCode
=
"AiWritingPrompt"
;
...
...
src/main/java/cn/com/poc/writing/convert/BizAiWritingExampleConvert.java
0 → 100644
View file @
a0728e8d
package
cn
.
com
.
poc
.
writing
.
convert
;
import
cn.com.poc.writing.model.BizAiWritingExampleModel
;
import
cn.com.poc.writing.entity.BizAiWritingExampleEntity
;
public
class
BizAiWritingExampleConvert
{
public
static
BizAiWritingExampleEntity
modelToEntity
(
BizAiWritingExampleModel
model
)
{
BizAiWritingExampleEntity
entity
=
new
BizAiWritingExampleEntity
();
entity
.
setId
(
model
.
getId
());
entity
.
setType
(
model
.
getType
());
entity
.
setTitle
(
model
.
getTitle
());
entity
.
setDescription
(
model
.
getDescription
());
entity
.
setQuestion
(
model
.
getQuestion
());
return
entity
;
}
public
static
BizAiWritingExampleModel
entityToModel
(
BizAiWritingExampleEntity
entity
)
{
BizAiWritingExampleModel
model
=
new
BizAiWritingExampleModel
();
model
.
setId
(
entity
.
getId
());
model
.
setType
(
entity
.
getType
());
model
.
setTitle
(
entity
.
getTitle
());
model
.
setDescription
(
entity
.
getDescription
());
model
.
setQuestion
(
entity
.
getQuestion
());
return
model
;
}
}
\ No newline at end of file
src/main/java/cn/com/poc/writing/convert/BizAiWritingExampleTypeConvert.java
0 → 100644
View file @
a0728e8d
package
cn
.
com
.
poc
.
writing
.
convert
;
import
cn.com.poc.writing.model.BizAiWritingExampleTypeModel
;
import
cn.com.poc.writing.entity.BizAiWritingExampleTypeEntity
;
public
class
BizAiWritingExampleTypeConvert
{
public
static
BizAiWritingExampleTypeEntity
modelToEntity
(
BizAiWritingExampleTypeModel
model
){
BizAiWritingExampleTypeEntity
entity
=
new
BizAiWritingExampleTypeEntity
();
entity
.
setId
(
model
.
getId
());
entity
.
setType
(
model
.
getType
());
entity
.
setName
(
model
.
getName
());
return
entity
;
}
public
static
BizAiWritingExampleTypeModel
entityToModel
(
BizAiWritingExampleTypeEntity
entity
){
BizAiWritingExampleTypeModel
model
=
new
BizAiWritingExampleTypeModel
();
model
.
setId
(
entity
.
getId
());
model
.
setType
(
entity
.
getType
());
model
.
setName
(
entity
.
getName
());
return
model
;
}
}
\ No newline at end of file
src/main/java/cn/com/poc/writing/dto/AiWritingExampleDto.java
0 → 100644
View file @
a0728e8d
package
cn
.
com
.
poc
.
writing
.
dto
;
/**
* @author alex.yao
* @date 2025/6/24
*/
public
class
AiWritingExampleDto
{
/** type
*分类
*/
private
java
.
lang
.
String
type
;
public
java
.
lang
.
String
getType
(){
return
this
.
type
;
}
public
void
setType
(
java
.
lang
.
String
type
){
this
.
type
=
type
;
}
/** title
*标题
*/
private
java
.
lang
.
String
title
;
public
java
.
lang
.
String
getTitle
(){
return
this
.
title
;
}
public
void
setTitle
(
java
.
lang
.
String
title
){
this
.
title
=
title
;
}
/** description
*描述
*/
private
java
.
lang
.
String
description
;
public
java
.
lang
.
String
getDescription
(){
return
this
.
description
;
}
public
void
setDescription
(
java
.
lang
.
String
description
){
this
.
description
=
description
;
}
/** question
*提问
*/
private
java
.
lang
.
String
question
;
public
java
.
lang
.
String
getQuestion
(){
return
this
.
question
;
}
public
void
setQuestion
(
java
.
lang
.
String
question
){
this
.
question
=
question
;
}
}
src/main/java/cn/com/poc/writing/dto/AiWritingExampleTypeDto.java
0 → 100644
View file @
a0728e8d
package
cn
.
com
.
poc
.
writing
.
dto
;
public
class
AiWritingExampleTypeDto
{
private
static
final
long
serialVersionUID
=
1L
;
/** type
*类型
*/
private
String
type
;
public
String
getType
(){
return
this
.
type
;
}
public
void
setType
(
String
type
){
this
.
type
=
type
;
}
/** name
*名
*/
private
String
name
;
public
String
getName
(){
return
this
.
name
;
}
public
void
setName
(
String
name
){
this
.
name
=
name
;
}
}
\ No newline at end of file
src/main/java/cn/com/poc/writing/entity/BizAiWritingExampleEntity.java
0 → 100644
View file @
a0728e8d
package
cn
.
com
.
poc
.
writing
.
entity
;
public
class
BizAiWritingExampleEntity
{
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
;
}
/** type
*分类
*/
private
java
.
lang
.
String
type
;
public
java
.
lang
.
String
getType
(){
return
this
.
type
;
}
public
void
setType
(
java
.
lang
.
String
type
){
this
.
type
=
type
;
}
/** title
*标题
*/
private
java
.
lang
.
String
title
;
public
java
.
lang
.
String
getTitle
(){
return
this
.
title
;
}
public
void
setTitle
(
java
.
lang
.
String
title
){
this
.
title
=
title
;
}
/** description
*描述
*/
private
java
.
lang
.
String
description
;
public
java
.
lang
.
String
getDescription
(){
return
this
.
description
;
}
public
void
setDescription
(
java
.
lang
.
String
description
){
this
.
description
=
description
;
}
/** question
*提问
*/
private
java
.
lang
.
String
question
;
public
java
.
lang
.
String
getQuestion
(){
return
this
.
question
;
}
public
void
setQuestion
(
java
.
lang
.
String
question
){
this
.
question
=
question
;
}
}
\ No newline at end of file
src/main/java/cn/com/poc/writing/entity/BizAiWritingExampleTypeEntity.java
0 → 100644
View file @
a0728e8d
package
cn
.
com
.
poc
.
writing
.
entity
;
public
class
BizAiWritingExampleTypeEntity
{
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
;
}
/** type
*类型
*/
private
java
.
lang
.
String
type
;
public
java
.
lang
.
String
getType
(){
return
this
.
type
;
}
public
void
setType
(
java
.
lang
.
String
type
){
this
.
type
=
type
;
}
/** name
*名
*/
private
java
.
lang
.
String
name
;
public
java
.
lang
.
String
getName
(){
return
this
.
name
;
}
public
void
setName
(
java
.
lang
.
String
name
){
this
.
name
=
name
;
}
}
\ No newline at end of file
src/main/java/cn/com/poc/writing/model/BizAiWritingExampleModel.java
0 → 100644
View file @
a0728e8d
package
cn
.
com
.
poc
.
writing
.
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.GeneratedValue
;
import
javax.persistence.GenerationType
;
/**
* Model class for biz_ai_writing_example
* AI-写作 例子
*/
@Entity
@Table
(
name
=
"biz_ai_writing_example"
)
@DynamicInsert
@DynamicUpdate
public
class
BizAiWritingExampleModel
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"
);
}
/** type
*分类
*/
private
java
.
lang
.
String
type
;
@Column
(
name
=
"type"
,
length
=
100
)
public
java
.
lang
.
String
getType
(){
return
this
.
type
;
}
public
void
setType
(
java
.
lang
.
String
type
){
this
.
type
=
type
;
super
.
addValidField
(
"type"
);
}
/** title
*标题
*/
private
java
.
lang
.
String
title
;
@Column
(
name
=
"title"
,
length
=
100
)
public
java
.
lang
.
String
getTitle
(){
return
this
.
title
;
}
public
void
setTitle
(
java
.
lang
.
String
title
){
this
.
title
=
title
;
super
.
addValidField
(
"title"
);
}
/** description
*描述
*/
private
java
.
lang
.
String
description
;
@Column
(
name
=
"description"
,
length
=
100
)
public
java
.
lang
.
String
getDescription
(){
return
this
.
description
;
}
public
void
setDescription
(
java
.
lang
.
String
description
){
this
.
description
=
description
;
super
.
addValidField
(
"description"
);
}
/** question
*提问
*/
private
java
.
lang
.
String
question
;
@Column
(
name
=
"question"
,
length
=
100
)
public
java
.
lang
.
String
getQuestion
(){
return
this
.
question
;
}
public
void
setQuestion
(
java
.
lang
.
String
question
){
this
.
question
=
question
;
super
.
addValidField
(
"question"
);
}
}
\ No newline at end of file
src/main/java/cn/com/poc/writing/model/BizAiWritingExampleTypeModel.java
0 → 100644
View file @
a0728e8d
package
cn
.
com
.
poc
.
writing
.
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.GeneratedValue
;
import
javax.persistence.GenerationType
;
/**
* Model class for biz_ai_writing_example_type
* AI写作分类
*/
@Entity
@Table
(
name
=
"biz_ai_writing_example_type"
)
@DynamicInsert
@DynamicUpdate
public
class
BizAiWritingExampleTypeModel
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"
);
}
/** type
*类型
*/
private
java
.
lang
.
String
type
;
@Column
(
name
=
"type"
,
length
=
100
)
public
java
.
lang
.
String
getType
(){
return
this
.
type
;
}
public
void
setType
(
java
.
lang
.
String
type
){
this
.
type
=
type
;
super
.
addValidField
(
"type"
);
}
/** name
*名
*/
private
java
.
lang
.
String
name
;
@Column
(
name
=
"name"
,
length
=
100
)
public
java
.
lang
.
String
getName
(){
return
this
.
name
;
}
public
void
setName
(
java
.
lang
.
String
name
){
this
.
name
=
name
;
super
.
addValidField
(
"name"
);
}
}
\ No newline at end of file
src/main/java/cn/com/poc/writing/repository/BizAiWritingExampleRepository.java
0 → 100644
View file @
a0728e8d
package
cn
.
com
.
poc
.
writing
.
repository
;
import
cn.com.yict.framemax.data.repository.Repository
;
import
cn.com.poc.writing.model.BizAiWritingExampleModel
;
public
interface
BizAiWritingExampleRepository
extends
Repository
<
BizAiWritingExampleModel
,
java
.
lang
.
Long
>
{
}
\ No newline at end of file
src/main/java/cn/com/poc/writing/repository/BizAiWritingExampleTypeRepository.java
0 → 100644
View file @
a0728e8d
package
cn
.
com
.
poc
.
writing
.
repository
;
import
cn.com.yict.framemax.data.repository.Repository
;
import
cn.com.poc.writing.model.BizAiWritingExampleTypeModel
;
public
interface
BizAiWritingExampleTypeRepository
extends
Repository
<
BizAiWritingExampleTypeModel
,
java
.
lang
.
Long
>
{
}
\ No newline at end of file
src/main/java/cn/com/poc/writing/rest/AiWritingRest.java
View file @
a0728e8d
package
cn
.
com
.
poc
.
writing
.
rest
;
import
cn.com.poc.writing.dto.AiWritingDto
;
import
cn.com.poc.writing.dto.AiWritingExampleDto
;
import
cn.com.poc.writing.dto.AiWritingExampleTypeDto
;
import
cn.com.yict.framemax.core.rest.BaseRest
;
import
cn.com.yict.framemax.web.permission.Access
;
import
cn.com.yict.framemax.web.permission.Permission
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
java.util.List
;
/**
* @author alex.yao
...
...
@@ -14,6 +19,10 @@ import org.springframework.web.bind.annotation.RequestBody;
@Permission
(
Access
.
Safety
)
public
interface
AiWritingRest
extends
BaseRest
{
List
<
AiWritingExampleDto
>
example
(
@RequestParam
String
type
)
throws
Exception
;
void
call
(
@RequestBody
AiWritingDto
aiWritingDto
)
throws
Exception
;
List
<
AiWritingExampleTypeDto
>
exampleType
()
throws
Exception
;
}
src/main/java/cn/com/poc/writing/rest/impl/AiWritingRestImpl.java
View file @
a0728e8d
...
...
@@ -5,11 +5,14 @@ import cn.com.poc.common.utils.BlContext;
import
cn.com.poc.support.security.oauth.entity.UserBaseEntity
;
import
cn.com.poc.writing.aggregate.AiWritingService
;
import
cn.com.poc.writing.dto.AiWritingDto
;
import
cn.com.poc.writing.dto.AiWritingExampleDto
;
import
cn.com.poc.writing.dto.AiWritingExampleTypeDto
;
import
cn.com.poc.writing.rest.AiWritingRest
;
import
cn.com.yict.framemax.core.exception.BusinessException
;
import
org.springframework.stereotype.Component
;
import
javax.annotation.Resource
;
import
java.util.List
;
/**
* @author alex.yao
...
...
@@ -35,4 +38,16 @@ public class AiWritingRestImpl implements AiWritingRest {
aiWritingDto
.
getInput
(),
aiWritingDto
.
getKnowledgeIds
(),
userBaseEntity
.
getUserId
());
}
@Override
public
List
<
AiWritingExampleDto
>
example
(
String
type
)
throws
Exception
{
Assert
.
notNull
(
type
,
"type is null"
);
return
aiWritingService
.
example
(
type
);
}
@Override
public
List
<
AiWritingExampleTypeDto
>
exampleType
()
throws
Exception
{
return
aiWritingService
.
exampleType
();
}
}
src/main/java/cn/com/poc/writing/service/BizAiWritingExampleService.java
0 → 100644
View file @
a0728e8d
package
cn
.
com
.
poc
.
writing
.
service
;
import
cn.com.yict.framemax.core.service.BaseService
;
import
cn.com.poc.writing.entity.BizAiWritingExampleEntity
;
import
cn.com.yict.framemax.data.model.PagingInfo
;
import
java.util.Collection
;
import
java.util.List
;
public
interface
BizAiWritingExampleService
extends
BaseService
{
BizAiWritingExampleEntity
get
(
java
.
lang
.
Long
id
)
throws
Exception
;
List
<
BizAiWritingExampleEntity
>
findByExample
(
BizAiWritingExampleEntity
example
,
PagingInfo
pagingInfo
)
throws
Exception
;
BizAiWritingExampleEntity
save
(
BizAiWritingExampleEntity
entity
)
throws
Exception
;
BizAiWritingExampleEntity
update
(
BizAiWritingExampleEntity
entity
)
throws
Exception
;
void
deletedById
(
java
.
lang
.
Long
id
)
throws
Exception
;
}
\ No newline at end of file
src/main/java/cn/com/poc/writing/service/BizAiWritingExampleTypeService.java
0 → 100644
View file @
a0728e8d
package
cn
.
com
.
poc
.
writing
.
service
;
import
cn.com.yict.framemax.core.service.BaseService
;
import
cn.com.poc.writing.entity.BizAiWritingExampleTypeEntity
;
import
cn.com.yict.framemax.data.model.PagingInfo
;
import
java.util.Collection
;
import
java.util.List
;
public
interface
BizAiWritingExampleTypeService
extends
BaseService
{
BizAiWritingExampleTypeEntity
get
(
java
.
lang
.
Long
id
)
throws
Exception
;
List
<
BizAiWritingExampleTypeEntity
>
findByExample
(
BizAiWritingExampleTypeEntity
example
,
PagingInfo
pagingInfo
)
throws
Exception
;
BizAiWritingExampleTypeEntity
save
(
BizAiWritingExampleTypeEntity
entity
)
throws
Exception
;
BizAiWritingExampleTypeEntity
update
(
BizAiWritingExampleTypeEntity
entity
)
throws
Exception
;
void
deletedById
(
java
.
lang
.
Long
id
)
throws
Exception
;
}
\ No newline at end of file
src/main/java/cn/com/poc/writing/service/impl/BizAiWritingExampleServiceImpl.java
0 → 100644
View file @
a0728e8d
package
cn
.
com
.
poc
.
writing
.
service
.
impl
;
import
cn.com.yict.framemax.core.service.impl.BaseServiceImpl
;
import
cn.com.poc.writing.service.BizAiWritingExampleService
;
import
cn.com.poc.writing.model.BizAiWritingExampleModel
;
import
cn.com.poc.writing.entity.BizAiWritingExampleEntity
;
import
cn.com.poc.writing.convert.BizAiWritingExampleConvert
;
import
cn.com.poc.writing.repository.BizAiWritingExampleRepository
;
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
BizAiWritingExampleServiceImpl
extends
BaseServiceImpl
implements
BizAiWritingExampleService
{
@Resource
private
BizAiWritingExampleRepository
repository
;
public
BizAiWritingExampleEntity
get
(
java
.
lang
.
Long
id
)
throws
Exception
{
Assert
.
notNull
(
id
);
BizAiWritingExampleModel
model
=
this
.
repository
.
get
(
id
);
if
(
model
==
null
){
return
null
;
}
return
BizAiWritingExampleConvert
.
modelToEntity
(
model
);
}
public
List
<
BizAiWritingExampleEntity
>
findByExample
(
BizAiWritingExampleEntity
example
,
PagingInfo
pagingInfo
)
throws
Exception
{
List
<
BizAiWritingExampleEntity
>
result
=
new
ArrayList
<
BizAiWritingExampleEntity
>();
BizAiWritingExampleModel
model
=
new
BizAiWritingExampleModel
();
if
(
example
!=
null
){
model
=
BizAiWritingExampleConvert
.
entityToModel
(
example
);
}
List
<
BizAiWritingExampleModel
>
models
=
this
.
repository
.
findByExample
(
model
,
pagingInfo
);
if
(
CollectionUtils
.
isNotEmpty
(
models
))
{
result
=
models
.
stream
().
map
(
BizAiWritingExampleConvert:
:
modelToEntity
).
collect
(
Collectors
.
toList
());
}
return
result
;
}
public
BizAiWritingExampleEntity
save
(
BizAiWritingExampleEntity
entity
)
throws
Exception
{
Assert
.
notNull
(
entity
);
entity
.
setId
(
null
);
BizAiWritingExampleModel
model
=
BizAiWritingExampleConvert
.
entityToModel
(
entity
);
BizAiWritingExampleModel
saveModel
=
this
.
repository
.
save
(
model
);
return
BizAiWritingExampleConvert
.
modelToEntity
(
saveModel
);
}
public
BizAiWritingExampleEntity
update
(
BizAiWritingExampleEntity
entity
)
throws
Exception
{
Assert
.
notNull
(
entity
);
Assert
.
notNull
(
entity
.
getId
(),
"update pk can not be null"
);
BizAiWritingExampleModel
model
=
this
.
repository
.
get
(
entity
.
getId
());
if
(
entity
.
getType
()
!=
null
){
model
.
setType
(
entity
.
getType
());
}
if
(
entity
.
getTitle
()
!=
null
){
model
.
setTitle
(
entity
.
getTitle
());
}
if
(
entity
.
getDescription
()
!=
null
){
model
.
setDescription
(
entity
.
getDescription
());
}
if
(
entity
.
getQuestion
()
!=
null
){
model
.
setQuestion
(
entity
.
getQuestion
());
}
BizAiWritingExampleModel
saveModel
=
this
.
repository
.
save
(
model
);
return
BizAiWritingExampleConvert
.
modelToEntity
(
saveModel
);
}
public
void
deletedById
(
java
.
lang
.
Long
id
)
throws
Exception
{
Assert
.
notNull
(
id
);
BizAiWritingExampleModel
model
=
this
.
repository
.
get
(
id
);
if
(
model
!=
null
){
}
}
}
\ No newline at end of file
src/main/java/cn/com/poc/writing/service/impl/BizAiWritingExampleTypeServiceImpl.java
0 → 100644
View file @
a0728e8d
package
cn
.
com
.
poc
.
writing
.
service
.
impl
;
import
cn.com.yict.framemax.core.service.impl.BaseServiceImpl
;
import
cn.com.poc.writing.service.BizAiWritingExampleTypeService
;
import
cn.com.poc.writing.model.BizAiWritingExampleTypeModel
;
import
cn.com.poc.writing.entity.BizAiWritingExampleTypeEntity
;
import
cn.com.poc.writing.convert.BizAiWritingExampleTypeConvert
;
import
cn.com.poc.writing.repository.BizAiWritingExampleTypeRepository
;
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
BizAiWritingExampleTypeServiceImpl
extends
BaseServiceImpl
implements
BizAiWritingExampleTypeService
{
@Resource
private
BizAiWritingExampleTypeRepository
repository
;
public
BizAiWritingExampleTypeEntity
get
(
java
.
lang
.
Long
id
)
throws
Exception
{
Assert
.
notNull
(
id
);
BizAiWritingExampleTypeModel
model
=
this
.
repository
.
get
(
id
);
if
(
model
==
null
){
return
null
;
}
return
BizAiWritingExampleTypeConvert
.
modelToEntity
(
model
);
}
public
List
<
BizAiWritingExampleTypeEntity
>
findByExample
(
BizAiWritingExampleTypeEntity
example
,
PagingInfo
pagingInfo
)
throws
Exception
{
List
<
BizAiWritingExampleTypeEntity
>
result
=
new
ArrayList
<
BizAiWritingExampleTypeEntity
>();
BizAiWritingExampleTypeModel
model
=
new
BizAiWritingExampleTypeModel
();
if
(
example
!=
null
){
model
=
BizAiWritingExampleTypeConvert
.
entityToModel
(
example
);
}
List
<
BizAiWritingExampleTypeModel
>
models
=
this
.
repository
.
findByExample
(
model
,
pagingInfo
);
if
(
CollectionUtils
.
isNotEmpty
(
models
))
{
result
=
models
.
stream
().
map
(
BizAiWritingExampleTypeConvert:
:
modelToEntity
).
collect
(
Collectors
.
toList
());
}
return
result
;
}
public
BizAiWritingExampleTypeEntity
save
(
BizAiWritingExampleTypeEntity
entity
)
throws
Exception
{
Assert
.
notNull
(
entity
);
entity
.
setId
(
null
);
BizAiWritingExampleTypeModel
model
=
BizAiWritingExampleTypeConvert
.
entityToModel
(
entity
);
BizAiWritingExampleTypeModel
saveModel
=
this
.
repository
.
save
(
model
);
return
BizAiWritingExampleTypeConvert
.
modelToEntity
(
saveModel
);
}
public
BizAiWritingExampleTypeEntity
update
(
BizAiWritingExampleTypeEntity
entity
)
throws
Exception
{
Assert
.
notNull
(
entity
);
Assert
.
notNull
(
entity
.
getId
(),
"update pk can not be null"
);
BizAiWritingExampleTypeModel
model
=
this
.
repository
.
get
(
entity
.
getId
());
if
(
entity
.
getType
()
!=
null
){
model
.
setType
(
entity
.
getType
());
}
if
(
entity
.
getName
()
!=
null
){
model
.
setName
(
entity
.
getName
());
}
BizAiWritingExampleTypeModel
saveModel
=
this
.
repository
.
save
(
model
);
return
BizAiWritingExampleTypeConvert
.
modelToEntity
(
saveModel
);
}
public
void
deletedById
(
java
.
lang
.
Long
id
)
throws
Exception
{
Assert
.
notNull
(
id
);
BizAiWritingExampleTypeModel
model
=
this
.
repository
.
get
(
id
);
if
(
model
!=
null
){
}
}
}
\ No newline at end of file
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