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
d68e8e1f
Commit
d68e8e1f
authored
May 12, 2025
by
alex yao
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/release' into release
parents
1803590e
763f9e2d
Show whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
1085 additions
and
1 deletion
+1085
-1
AgentApplicationServiceImpl.java
...plication/aggregate/impl/AgentApplicationServiceImpl.java
+3
-1
LargeModelFunctionEnum.java
...y/resource/demand/ai/function/LargeModelFunctionEnum.java
+6
-0
TraveReimbursementlFormFunction.java
.../ai/function/oa_form/TraveReimbursementlFormFunction.java
+128
-0
TravelFormFunction.java
...source/demand/ai/function/oa_form/TravelFormFunction.java
+134
-0
BizPluginBusinessConvert.java
.../ai/plugin_business/convert/BizPluginBusinessConvert.java
+69
-0
BizPluginBusinessDto.java
...e/demand/ai/plugin_business/dto/BizPluginBusinessDto.java
+140
-0
FromDataDto.java
...y/resource/demand/ai/plugin_business/dto/FromDataDto.java
+71
-0
BizPluginBusinessEntity.java
...nd/ai/plugin_business/entity/BizPluginBusinessEntity.java
+127
-0
BizPluginBusinessModel.java
...mand/ai/plugin_business/model/BizPluginBusinessModel.java
+190
-0
BizPluginBusinessRepository.java
...ugin_business/repository/BizPluginBusinessRepository.java
+6
-0
BizPluginBusinessRest.java
...demand/ai/plugin_business/rest/BizPluginBusinessRest.java
+17
-0
BizPluginBusinessRestImpl.java
.../plugin_business/rest/impl/BizPluginBusinessRestImpl.java
+64
-0
BizPluginBusinessService.java
.../ai/plugin_business/service/BizPluginBusinessService.java
+21
-0
BizPluginBusinessServiceImpl.java
...n_business/service/impl/BizPluginBusinessServiceImpl.java
+109
-0
No files found.
src/main/java/cn/com/poc/agent_application/aggregate/impl/AgentApplicationServiceImpl.java
View file @
d68e8e1f
...
...
@@ -55,6 +55,7 @@ import org.apache.commons.lang.ArrayUtils;
import
org.apache.commons.lang3.StringUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Component
;
import
org.springframework.transaction.annotation.Transactional
;
...
...
@@ -1029,7 +1030,8 @@ public class AgentApplicationServiceImpl implements AgentApplicationService {
toolFunction
.
setDisplayFormat
(
bizAgentApplicationPluginEntity
.
getDisplayFormat
());
}
toolFunction
.
setArguments
(
functionResult
.
getFunctionArg
());
toolFunction
.
setResult
(
JsonUtils
.
serialize
(
functionResult
.
getFunctionResult
()));
String
functionResultStr
=
functionResult
.
getFunctionResult
()
instanceof
String
?
String
.
valueOf
(
functionResult
.
getFunctionResult
())
:
JsonUtils
.
serialize
(
functionResult
.
getFunctionResult
());
toolFunction
.
setResult
(
functionResultStr
);
return
toolFunction
;
}
...
...
src/main/java/cn/com/poc/thirdparty/resource/demand/ai/function/LargeModelFunctionEnum.java
View file @
d68e8e1f
...
...
@@ -10,6 +10,8 @@ import cn.com.poc.thirdparty.resource.demand.ai.function.long_memory.SetLongMemo
import
cn.com.poc.thirdparty.resource.demand.ai.function.memory_variable_writer.MemoryVariableWriterFunction
;
import
cn.com.poc.thirdparty.resource.demand.ai.function.notification_reminder.NotificationReminderFunction
;
import
cn.com.poc.thirdparty.resource.demand.ai.function.text_in_pdf2md.PdfToMDFunction
;
import
cn.com.poc.thirdparty.resource.demand.ai.function.oa_form.TraveReimbursementlFormFunction
;
import
cn.com.poc.thirdparty.resource.demand.ai.function.oa_form.TravelFormFunction
;
import
cn.com.poc.thirdparty.resource.demand.ai.function.top_search.DouyinTopSearchFunction
;
import
cn.com.poc.thirdparty.resource.demand.ai.function.top_search.ToutiaoTopSearchFunction
;
import
cn.com.poc.thirdparty.resource.demand.ai.function.top_search.WeiboTopSearchFunction
;
...
...
@@ -35,6 +37,10 @@ public enum LargeModelFunctionEnum {
bing_web_search
(
null
),
completion_of_travel_form
(
TravelFormFunction
.
class
),
completion_of_travel_reimbursement_form
(
TraveReimbursementlFormFunction
.
class
),
pdf_to_md
(
PdfToMDFunction
.
class
),
;
...
...
src/main/java/cn/com/poc/thirdparty/resource/demand/ai/function/oa_form/TraveReimbursementlFormFunction.java
0 → 100644
View file @
d68e8e1f
package
cn
.
com
.
poc
.
thirdparty
.
resource
.
demand
.
ai
.
function
.
oa_form
;
import
cn.com.poc.agent_application.entity.Variable
;
import
cn.com.poc.common.utils.JsonUtils
;
import
cn.com.poc.common.utils.StringUtils
;
import
cn.com.poc.thirdparty.resource.demand.ai.entity.dialogue.Message
;
import
cn.com.poc.thirdparty.resource.demand.ai.entity.largemodel.LargeModelDemandResult
;
import
cn.com.poc.thirdparty.resource.demand.ai.entity.largemodel.LargeModelResponse
;
import
cn.com.poc.thirdparty.resource.demand.ai.function.AbstractFunctionResult
;
import
cn.com.poc.thirdparty.resource.demand.ai.function.AbstractLargeModelFunction
;
import
cn.com.poc.thirdparty.resource.demand.ai.function.entity.FunctionLLMConfig
;
import
cn.com.poc.thirdparty.resource.demand.ai.function.entity.Parameters
;
import
cn.com.poc.thirdparty.resource.demand.ai.function.entity.Properties
;
import
cn.com.poc.thirdparty.service.LLMService
;
import
cn.hutool.core.collection.ListUtil
;
import
org.springframework.stereotype.Component
;
import
javax.annotation.Resource
;
import
java.util.List
;
/**
* @Author:Roger Wu
* @name:oa_form
* @Date:2025-05-06 20:36
*/
@Component
public
class
TraveReimbursementlFormFunction
extends
AbstractLargeModelFunction
{
@Resource
private
LLMService
llmService
;
private
final
String
MODEL
=
"ERNIE-3.5-8K-0205"
;
private
final
String
DESC
=
"该方法执行出差的报销表单申请"
;
private
final
FunctionLLMConfig
functionLLMConfig
=
new
FunctionLLMConfig
.
FunctionLLMConfigBuilder
()
.
name
(
"completion_of_travel_reimbursement_form"
)
.
parameters
(
new
Parameters
(
"object"
)
.
addProperties
(
"query"
,
new
Properties
(
"string"
,
"获取用户输入"
)))
.
description
(
DESC
)
.
build
();
private
final
String
TEMPLATE
=
"# 角色:\n"
+
"关键词提取助手\n"
+
"\n"
+
"## 工作规范:\n"
+
"1.严格遵守提取规则:\n"
+
"-仅从我给你的数据中提取关键词,不要添加任何外部信息\n"
+
"\n"
+
"2.精准匹配流程:\n"
+
"①熟知以下字段名称:出差目的(purpose)(选择:客户拜访、会议、培训)、出差地点(place)、出发日期(departureDate)、返回日期(returnDate)、交通工具(vehicle)、预计交通费用(transportationFee)、住宿地点(accommodation)、预计住宿费用\n"
+
"(accommodationCost)、预支金额(advancePaymentAmount)、总预算(totalBudget)\n"
+
"②查询系统今天的日期,今天日期是:[2025-4-30]\n"
+
"③遍历我给你的数据,从数据中提取关键词,将与字段匹配的关键词填充到字段名称后,例如:我要到香港出差,则将“香港”提取出来填充到出差地点里。\n"
+
"注意:\n"
+
"(1)用户有提到如“今天、明天、后天、昨天”这类,你要把它们提取出来根据给的今天日期转换为具体日期。例如:我今天要去香港出差五天,则你要提取出今天和五天,把今天和五天转换为具体日期,填充到出发日期和返回日期里\n"
+
"(2)匹配要使用英文字段,不能用中文\n"
+
"(3)数据中有明确与字段匹配的关键词再输出字段,否则不要输出多余字段,不要按照自己想法输出,尤其是出差目的\n"
+
"(4)若数据中有出差目的匹配的关键词,要从三个选择中选择一个\n"
+
"③使用JSON格式将有内容的字段名称输出\n"
+
"\n"
+
"3.输出示例:\n"
+
"数据:我今天要到香港出差\n"
+
"正确输出:\n"
+
"{\"place\":\"香港\",\n"
+
"\"departureDate\":\"2025-4-30\"}\n"
+
"\n"
+
"## 限制:\n"
+
"-数据中有与字段匹配的关键词再输出字段,否则不要输出\n"
+
"-输出必须用JSON格式,不能用其他格式输出\n"
+
"-全程只能做关键词提取工作,不做其他工作\n"
+
"-输出里不能有提示语任何相关内容\n"
+
"\n"
+
"## 输入数据:\n"
+
"数据:【{content}】"
;
/**
* 执行函数
*
* @param content 入参
* @param identifier 唯一标识
* @return
*/
@Override
public
AbstractFunctionResult
<
String
>
doFunction
(
String
content
,
String
identifier
)
{
AbstractFunctionResult
<
String
>
result
=
new
AbstractFunctionResult
<>();
if
(
StringUtils
.
isBlank
(
content
))
{
result
.
setFunctionResult
(
StringUtils
.
EMPTY
);
result
.
setPromptContent
(
StringUtils
.
EMPTY
);
return
result
;
}
Message
message
=
new
Message
();
message
.
setRole
(
"user"
);
message
.
setContent
(
TEMPLATE
.
replace
(
"${content}"
,
content
));
LargeModelResponse
largeModelResponse
=
new
LargeModelResponse
();
largeModelResponse
.
setModel
(
MODEL
);
largeModelResponse
.
setMessages
(
new
Message
[]{
message
});
largeModelResponse
.
setStream
(
false
);
largeModelResponse
.
setUser
(
"traveReimbursementlFormFunction"
);
LargeModelDemandResult
largeModelDemandResult
=
llmService
.
chat
(
largeModelResponse
);
if
(
largeModelDemandResult
==
null
)
{
result
.
setFunctionResult
(
StringUtils
.
EMPTY
);
result
.
setPromptContent
(
StringUtils
.
EMPTY
);
return
result
;
}
result
.
setFunctionResult
(
largeModelDemandResult
.
getMessage
());
result
.
setPromptContent
(
largeModelDemandResult
.
getMessage
());
return
result
;
}
@Override
public
String
getDesc
()
{
return
DESC
;
}
@Override
public
List
<
String
>
getLLMConfig
()
{
return
ListUtil
.
toList
(
JsonUtils
.
serialize
(
functionLLMConfig
));
}
@Override
public
List
<
String
>
getLLMConfig
(
List
<
Variable
>
variableStructure
)
{
return
getLLMConfig
();
}
}
src/main/java/cn/com/poc/thirdparty/resource/demand/ai/function/oa_form/TravelFormFunction.java
0 → 100644
View file @
d68e8e1f
package
cn
.
com
.
poc
.
thirdparty
.
resource
.
demand
.
ai
.
function
.
oa_form
;
import
cn.com.poc.agent_application.entity.Variable
;
import
cn.com.poc.common.utils.DateUtils
;
import
cn.com.poc.common.utils.DocumentLoad
;
import
cn.com.poc.common.utils.JsonUtils
;
import
cn.com.poc.common.utils.StringUtils
;
import
cn.com.poc.thirdparty.resource.demand.ai.entity.dialogue.Message
;
import
cn.com.poc.thirdparty.resource.demand.ai.entity.largemodel.LargeModelDemandResult
;
import
cn.com.poc.thirdparty.resource.demand.ai.entity.largemodel.LargeModelResponse
;
import
cn.com.poc.thirdparty.resource.demand.ai.function.AbstractFunctionResult
;
import
cn.com.poc.thirdparty.resource.demand.ai.function.AbstractLargeModelFunction
;
import
cn.com.poc.thirdparty.resource.demand.ai.function.entity.FunctionLLMConfig
;
import
cn.com.poc.thirdparty.resource.demand.ai.function.entity.Parameters
;
import
cn.com.poc.thirdparty.resource.demand.ai.function.entity.Properties
;
import
cn.com.poc.thirdparty.service.LLMService
;
import
cn.hutool.core.collection.ListUtil
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
org.springframework.stereotype.Component
;
import
javax.annotation.Resource
;
import
java.io.File
;
import
java.util.Date
;
import
java.util.List
;
/**
* @Author:Roger Wu
* @name:oa_form
* @Date:2025-05-06 20:36
*/
@Component
public
class
TravelFormFunction
extends
AbstractLargeModelFunction
{
@Resource
private
LLMService
llmService
;
private
final
String
DESC
=
"该方法执行出差表单申请"
;
// private final String MODEL = "ERNIE-3.5-8K-0205";
private
final
String
MODEL
=
"qwen-long"
;
private
final
FunctionLLMConfig
functionLLMConfig
=
new
FunctionLLMConfig
.
FunctionLLMConfigBuilder
()
.
name
(
"completion_of_travel_form"
)
.
parameters
(
new
Parameters
(
"object"
)
.
addProperties
(
"query"
,
new
Properties
(
"string"
,
"获取用户输入"
)))
.
description
(
DESC
)
.
build
();
private
final
String
TEMPLATE
=
"# 角色:\n"
+
"关键词提取助手\n"
+
"\n"
+
"## 工作规范:\n"
+
"1.严格遵守提取规则:\n"
+
"-仅从我给你的数据中提取关键词,不要添加任何外部信息\n"
+
"\n"
+
"2.精准匹配流程:\n"
+
"①熟知以下字段名称:出差目的(purpose)(选择:客户拜访、会议、培训)、出差地点(place)、出发日期和时间(departureDate)、返回日期和时间(returnDate)、交通工具(vehicle)、预计交通费用(transportationFee)、住宿地点(accommodation)、预计住宿费用\n"
+
"(accommodationCost)、预支金额(advancePaymentAmount)、总预算(totalBudget)\n"
+
"②查询系统今天的日期,今天日期是:${nowday}"
+
"③遍历我给你的数据,从数据中提取关键词,将与字段匹配的关键词填充到字段名称后,例如:我要到香港出差,则将“香港”提取出来填充到出差地点里。\n"
+
"注意:\n"
+
"(1)用户有提到如“今天、明天、后天、昨天”这类,你要把它们提取出来根据给的今天日期转换为具体日期和时间。例如:我今天要去香港出差五天,则你要提取出今天和五天,把今天和五天转换为具体日期,填充到出发日期和返回日期里\n"
+
"(2)匹配要使用英文字段,不能用中文\n"
+
"(3)数据中有明确与字段匹配的关键词再输出字段,否则不要输出多余字段,不要按照自己想法输出,尤其是出差目的\n"
+
"(4)若数据中有出差目的匹配的关键词,要从三个选择中选择一个\n"
+
"③使用JSON格式将有内容的字段名称输出\n"
+
"\n"
+
"3.输出示例:\n"
+
"数据:我今天要到香港出差\n"
+
"正确输出:\n"
+
"{\"place\":\"香港\",\n"
+
"\"departureDate\":\"2025-4-30 12:00:00\"}\n"
+
"## 限制:\n"
+
"-数据中有与字段匹配的关键词再输出字段,否则不要输出\n"
+
"-输出必须用JSON格式,不能用其他格式输出\n"
+
"-全程只能做关键词提取工作,不做其他工作\n"
+
"-输出里不能有提示语任何相关内容\n"
+
"\n"
+
"## 输入数据:\n"
+
"数据:【${content}】"
;
/**
* 执行函数
*
* @param content 入参
* @param identifier 唯一标识
* @return
*/
@Override
public
AbstractFunctionResult
<
String
>
doFunction
(
String
content
,
String
identifier
)
{
// content = "我今天要去北京出差,主要是去客户那边交流一下";
AbstractFunctionResult
<
String
>
result
=
new
AbstractFunctionResult
<>();
if
(
StringUtils
.
isBlank
(
content
))
{
result
.
setFunctionResult
(
StringUtils
.
EMPTY
);
result
.
setPromptContent
(
StringUtils
.
EMPTY
);
return
result
;
}
Message
message
=
new
Message
();
message
.
setRole
(
"user"
);
message
.
setContent
(
TEMPLATE
.
replace
(
"${content}"
,
content
).
replace
(
"${nowday}"
,
DateUtils
.
dateToString
(
new
Date
())));
LargeModelResponse
largeModelResponse
=
new
LargeModelResponse
();
largeModelResponse
.
setModel
(
MODEL
);
largeModelResponse
.
setMessages
(
new
Message
[]{
message
});
largeModelResponse
.
setStream
(
false
);
largeModelResponse
.
setUser
(
"travelFormFunction"
);
LargeModelDemandResult
largeModelDemandResult
=
llmService
.
chat
(
largeModelResponse
);
if
(
largeModelDemandResult
==
null
)
{
result
.
setFunctionResult
(
StringUtils
.
EMPTY
);
result
.
setPromptContent
(
StringUtils
.
EMPTY
);
return
result
;
}
String
functionResult
=
largeModelDemandResult
.
getMessage
().
replace
(
"`"
,
""
).
replace
(
"json"
,
""
).
replace
(
"\n"
,
""
);
functionResult
=
functionResult
.
replace
(
"客户拜访"
,
"CustomerVisits"
).
replace
(
"会议"
,
" Meetings"
).
replace
(
"培训"
,
"Training"
);
result
.
setFunctionResult
(
functionResult
);
result
.
setPromptContent
(
functionResult
);
return
result
;
}
@Override
public
String
getDesc
()
{
return
DESC
;
}
@Override
public
List
<
String
>
getLLMConfig
()
{
return
ListUtil
.
toList
(
JsonUtils
.
serialize
(
functionLLMConfig
));
}
@Override
public
List
<
String
>
getLLMConfig
(
List
<
Variable
>
variableStructure
)
{
return
getLLMConfig
();
}
}
src/main/java/cn/com/poc/thirdparty/resource/demand/ai/plugin_business/convert/BizPluginBusinessConvert.java
0 → 100644
View file @
d68e8e1f
package
cn
.
com
.
poc
.
thirdparty
.
resource
.
demand
.
ai
.
plugin_business
.
convert
;
import
cn.com.poc.thirdparty.resource.demand.ai.plugin_business.model.BizPluginBusinessModel
;
import
cn.com.poc.thirdparty.resource.demand.ai.plugin_business.entity.BizPluginBusinessEntity
;
import
cn.com.poc.thirdparty.resource.demand.ai.plugin_business.dto.BizPluginBusinessDto
;
public
class
BizPluginBusinessConvert
{
public
static
BizPluginBusinessEntity
modelToEntity
(
BizPluginBusinessModel
model
)
{
BizPluginBusinessEntity
entity
=
new
BizPluginBusinessEntity
();
entity
.
setFormId
(
model
.
getFormId
());
entity
.
setFormNo
(
model
.
getFormNo
());
entity
.
setFormData
(
model
.
getFormData
());
entity
.
setFormType
(
model
.
getFormType
());
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
BizPluginBusinessModel
entityToModel
(
BizPluginBusinessEntity
entity
)
{
BizPluginBusinessModel
model
=
new
BizPluginBusinessModel
();
model
.
setFormId
(
entity
.
getFormId
());
model
.
setFormNo
(
entity
.
getFormNo
());
model
.
setFormData
(
entity
.
getFormData
());
model
.
setFormType
(
entity
.
getFormType
());
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
;
}
public
static
BizPluginBusinessDto
entityToDto
(
BizPluginBusinessEntity
entity
)
{
BizPluginBusinessDto
dto
=
new
BizPluginBusinessDto
();
dto
.
setFormId
(
entity
.
getFormId
());
dto
.
setFormNo
(
entity
.
getFormNo
());
dto
.
setFormData
(
entity
.
getFormData
());
dto
.
setFormType
(
entity
.
getFormType
());
dto
.
setIsDeleted
(
entity
.
getIsDeleted
());
dto
.
setCreator
(
entity
.
getCreator
());
dto
.
setCreatedTime
(
entity
.
getCreatedTime
());
dto
.
setModifier
(
entity
.
getModifier
());
dto
.
setModifiedTime
(
entity
.
getModifiedTime
());
dto
.
setSysVersion
(
entity
.
getSysVersion
());
return
dto
;
}
public
static
BizPluginBusinessEntity
dtoToEntity
(
BizPluginBusinessDto
dto
)
{
BizPluginBusinessEntity
entity
=
new
BizPluginBusinessEntity
();
entity
.
setFormId
(
dto
.
getFormId
());
entity
.
setFormNo
(
dto
.
getFormNo
());
entity
.
setFormData
(
dto
.
getFormData
());
entity
.
setFormType
(
dto
.
getFormType
());
entity
.
setIsDeleted
(
dto
.
getIsDeleted
());
entity
.
setCreator
(
dto
.
getCreator
());
entity
.
setCreatedTime
(
dto
.
getCreatedTime
());
entity
.
setModifier
(
dto
.
getModifier
());
entity
.
setModifiedTime
(
dto
.
getModifiedTime
());
entity
.
setSysVersion
(
dto
.
getSysVersion
());
return
entity
;
}
}
\ No newline at end of file
src/main/java/cn/com/poc/thirdparty/resource/demand/ai/plugin_business/dto/BizPluginBusinessDto.java
0 → 100644
View file @
d68e8e1f
package
cn
.
com
.
poc
.
thirdparty
.
resource
.
demand
.
ai
.
plugin_business
.
dto
;
public
class
BizPluginBusinessDto
{
private
FromDataDto
fromDataDto
;
public
FromDataDto
getFromDataDto
()
{
return
fromDataDto
;
}
public
void
setFromDataDto
(
FromDataDto
fromDataDto
)
{
this
.
fromDataDto
=
fromDataDto
;
}
private
static
final
long
serialVersionUID
=
1L
;
/** form_id
*
*/
private
Integer
formId
;
public
Integer
getFormId
(){
return
this
.
formId
;
}
public
void
setFormId
(
Integer
formId
){
this
.
formId
=
formId
;
}
/** form_no
*表单号
*/
private
String
formNo
;
public
String
getFormNo
(){
return
this
.
formNo
;
}
public
void
setFormNo
(
String
formNo
){
this
.
formNo
=
formNo
;
}
/** form_data
*信息
*/
private
String
formData
;
public
String
getFormData
(){
return
this
.
formData
;
}
public
void
setFormData
(
String
formData
){
this
.
formData
=
formData
;
}
/** form_type
*类型
*/
private
String
formType
;
public
String
getFormType
(){
return
this
.
formType
;
}
public
void
setFormType
(
String
formType
){
this
.
formType
=
formType
;
}
/** is_deleted
*是否删除 Y 是 N 否
*/
private
String
isDeleted
;
public
String
getIsDeleted
(){
return
this
.
isDeleted
;
}
public
void
setIsDeleted
(
String
isDeleted
){
this
.
isDeleted
=
isDeleted
;
}
/** CREATOR
*创建人
*/
private
String
creator
;
public
String
getCreator
(){
return
this
.
creator
;
}
public
void
setCreator
(
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
String
modifier
;
public
String
getModifier
(){
return
this
.
modifier
;
}
public
void
setModifier
(
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
Integer
sysVersion
;
public
Integer
getSysVersion
(){
return
this
.
sysVersion
;
}
public
void
setSysVersion
(
Integer
sysVersion
){
this
.
sysVersion
=
sysVersion
;
}
}
\ No newline at end of file
src/main/java/cn/com/poc/thirdparty/resource/demand/ai/plugin_business/dto/FromDataDto.java
0 → 100644
View file @
d68e8e1f
package
cn
.
com
.
poc
.
thirdparty
.
resource
.
demand
.
ai
.
plugin_business
.
dto
;
public
class
FromDataDto
{
private
String
email
;
public
String
getEmail
()
{
return
email
;
}
public
void
setEmail
(
String
email
)
{
this
.
email
=
email
;
}
private
String
purpose
;
private
String
place
;
private
String
departureDate
;
private
String
advancePaymentAmount
;
private
String
accommodationCost
;
private
String
totalBudget
;
public
String
getPurpose
()
{
return
purpose
;
}
public
void
setPurpose
(
String
purpose
)
{
this
.
purpose
=
purpose
;
}
public
String
getPlace
()
{
return
place
;
}
public
void
setPlace
(
String
place
)
{
this
.
place
=
place
;
}
public
String
getDepartureDate
()
{
return
departureDate
;
}
public
void
setDepartureDate
(
String
departureDate
)
{
this
.
departureDate
=
departureDate
;
}
public
String
getAdvancePaymentAmount
()
{
return
advancePaymentAmount
;
}
public
void
setAdvancePaymentAmount
(
String
advancePaymentAmount
)
{
this
.
advancePaymentAmount
=
advancePaymentAmount
;
}
public
String
getAccommodationCost
()
{
return
accommodationCost
;
}
public
void
setAccommodationCost
(
String
accommodationCost
)
{
this
.
accommodationCost
=
accommodationCost
;
}
public
String
getTotalBudget
()
{
return
totalBudget
;
}
public
void
setTotalBudget
(
String
totalBudget
)
{
this
.
totalBudget
=
totalBudget
;
}
}
\ No newline at end of file
src/main/java/cn/com/poc/thirdparty/resource/demand/ai/plugin_business/entity/BizPluginBusinessEntity.java
0 → 100644
View file @
d68e8e1f
package
cn
.
com
.
poc
.
thirdparty
.
resource
.
demand
.
ai
.
plugin_business
.
entity
;
public
class
BizPluginBusinessEntity
{
private
static
final
long
serialVersionUID
=
1L
;
/** form_id
*
*/
private
Integer
formId
;
public
Integer
getFormId
(){
return
this
.
formId
;
}
public
void
setFormId
(
Integer
formId
){
this
.
formId
=
formId
;
}
/** form_no
*表单号
*/
private
String
formNo
;
public
String
getFormNo
(){
return
this
.
formNo
;
}
public
void
setFormNo
(
String
formNo
){
this
.
formNo
=
formNo
;
}
/** form_data
*信息
*/
private
String
formData
;
public
String
getFormData
(){
return
this
.
formData
;
}
public
void
setFormData
(
String
formData
){
this
.
formData
=
formData
;
}
/** form_type
*类型
*/
private
String
formType
;
public
String
getFormType
(){
return
this
.
formType
;
}
public
void
setFormType
(
String
formType
){
this
.
formType
=
formType
;
}
/** is_deleted
*是否删除 Y 是 N 否
*/
private
String
isDeleted
;
public
String
getIsDeleted
(){
return
this
.
isDeleted
;
}
public
void
setIsDeleted
(
String
isDeleted
){
this
.
isDeleted
=
isDeleted
;
}
/** CREATOR
*创建人
*/
private
String
creator
;
public
String
getCreator
(){
return
this
.
creator
;
}
public
void
setCreator
(
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
String
modifier
;
public
String
getModifier
(){
return
this
.
modifier
;
}
public
void
setModifier
(
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
Integer
sysVersion
;
public
Integer
getSysVersion
(){
return
this
.
sysVersion
;
}
public
void
setSysVersion
(
Integer
sysVersion
){
this
.
sysVersion
=
sysVersion
;
}
}
\ No newline at end of file
src/main/java/cn/com/poc/thirdparty/resource/demand/ai/plugin_business/model/BizPluginBusinessModel.java
0 → 100644
View file @
d68e8e1f
package
cn
.
com
.
poc
.
thirdparty
.
resource
.
demand
.
ai
.
plugin_business
.
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_plugin_business
*
*/
@Entity
@Table
(
name
=
"biz_plugin_business"
)
@DynamicInsert
@DynamicUpdate
public
class
BizPluginBusinessModel
extends
BaseModelClass
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
/** form_id
*
*/
private
Integer
formId
;
@Column
(
name
=
"form_id"
,
length
=
10
)
@Id
@GeneratedValue
(
strategy
=
GenerationType
.
AUTO
)
public
Integer
getFormId
(){
return
this
.
formId
;
}
public
void
setFormId
(
Integer
formId
){
this
.
formId
=
formId
;
super
.
addValidField
(
"formId"
);
}
/** form_no
*表单号
*/
private
String
formNo
;
@Column
(
name
=
"form_no"
,
length
=
11
)
public
String
getFormNo
(){
return
this
.
formNo
;
}
public
void
setFormNo
(
String
formNo
){
this
.
formNo
=
formNo
;
super
.
addValidField
(
"formNo"
);
}
/** form_data
*信息
*/
private
String
formData
;
@Column
(
name
=
"form_data"
,
length
=
1073741824
)
public
String
getFormData
(){
return
this
.
formData
;
}
public
void
setFormData
(
String
formData
){
this
.
formData
=
formData
;
super
.
addValidField
(
"formData"
);
}
/** form_type
*类型
*/
private
String
formType
;
@Column
(
name
=
"form_type"
,
length
=
10
)
public
String
getFormType
(){
return
this
.
formType
;
}
public
void
setFormType
(
String
formType
){
this
.
formType
=
formType
;
super
.
addValidField
(
"formType"
);
}
/** is_deleted
*是否删除 Y 是 N 否
*/
private
String
isDeleted
;
@Column
(
name
=
"is_deleted"
,
length
=
1
)
public
String
getIsDeleted
(){
return
this
.
isDeleted
;
}
public
void
setIsDeleted
(
String
isDeleted
){
this
.
isDeleted
=
isDeleted
;
super
.
addValidField
(
"isDeleted"
);
}
/** CREATOR
*创建人
*/
private
String
creator
;
@Column
(
name
=
"CREATOR"
,
length
=
50
)
public
String
getCreator
(){
return
this
.
creator
;
}
public
void
setCreator
(
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
String
modifier
;
@Column
(
name
=
"MODIFIER"
,
length
=
50
)
public
String
getModifier
(){
return
this
.
modifier
;
}
public
void
setModifier
(
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
Integer
sysVersion
;
@Column
(
name
=
"SYS_VERSION"
,
length
=
10
)
@Version
public
Integer
getSysVersion
(){
return
this
.
sysVersion
;
}
public
void
setSysVersion
(
Integer
sysVersion
){
this
.
sysVersion
=
sysVersion
;
super
.
addValidField
(
"sysVersion"
);
}
}
\ No newline at end of file
src/main/java/cn/com/poc/thirdparty/resource/demand/ai/plugin_business/repository/BizPluginBusinessRepository.java
0 → 100644
View file @
d68e8e1f
package
cn
.
com
.
poc
.
thirdparty
.
resource
.
demand
.
ai
.
plugin_business
.
repository
;
import
cn.com.yict.framemax.data.repository.Repository
;
import
cn.com.poc.thirdparty.resource.demand.ai.plugin_business.model.BizPluginBusinessModel
;
public
interface
BizPluginBusinessRepository
extends
Repository
<
BizPluginBusinessModel
,
Integer
>
{
}
\ No newline at end of file
src/main/java/cn/com/poc/thirdparty/resource/demand/ai/plugin_business/rest/BizPluginBusinessRest.java
0 → 100644
View file @
d68e8e1f
package
cn
.
com
.
poc
.
thirdparty
.
resource
.
demand
.
ai
.
plugin_business
.
rest
;
import
cn.com.yict.framemax.core.rest.BaseRest
;
import
cn.com.poc.thirdparty.resource.demand.ai.plugin_business.dto.BizPluginBusinessDto
;
import
cn.com.yict.framemax.data.model.PagingInfo
;
import
java.util.Collection
;
import
java.util.List
;
import
cn.com.yict.framemax.web.permission.Access
;
import
cn.com.yict.framemax.web.permission.Permission
;
import
org.springframework.web.bind.annotation.RequestBody
;
@Permission
(
Access
.
Safety
)
public
interface
BizPluginBusinessRest
extends
BaseRest
{
void
submitTravelForm
(
@RequestBody
BizPluginBusinessDto
bizPluginBusinessDto
)
throws
Exception
;
}
\ No newline at end of file
src/main/java/cn/com/poc/thirdparty/resource/demand/ai/plugin_business/rest/impl/BizPluginBusinessRestImpl.java
0 → 100644
View file @
d68e8e1f
package
cn
.
com
.
poc
.
thirdparty
.
resource
.
demand
.
ai
.
plugin_business
.
rest
.
impl
;
import
java.util.Date
;
import
java.util.LinkedList
;
import
java.util.List
;
import
javax.annotation.Resource
;
import
cn.com.poc.common.utils.Assert
;
import
cn.com.poc.common.utils.DateUtils
;
import
cn.com.poc.common.utils.RandomCodeUtils
;
import
cn.com.poc.common.utils.StringUtils
;
import
cn.com.yict.framemax.core.i18n.I18nMessageException
;
import
cn.com.yict.framemax.frame.entity.EmailSenderEntity
;
import
cn.com.yict.framemax.frame.service.EmailSenderService
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
org.springframework.stereotype.Component
;
import
cn.com.poc.thirdparty.resource.demand.ai.plugin_business.rest.BizPluginBusinessRest
;
import
cn.com.poc.thirdparty.resource.demand.ai.plugin_business.service.BizPluginBusinessService
;
import
cn.com.poc.thirdparty.resource.demand.ai.plugin_business.dto.BizPluginBusinessDto
;
import
cn.com.poc.thirdparty.resource.demand.ai.plugin_business.entity.BizPluginBusinessEntity
;
@Component
public
class
BizPluginBusinessRestImpl
implements
BizPluginBusinessRest
{
@Resource
private
BizPluginBusinessService
service
;
@Resource
private
EmailSenderService
emailSenderService
;
@Override
public
void
submitTravelForm
(
BizPluginBusinessDto
bizPluginBusinessDto
)
throws
Exception
{
Assert
.
notBlank
(
bizPluginBusinessDto
.
getFormType
());
Assert
.
notNull
(
bizPluginBusinessDto
.
getFromDataDto
());
String
formData
=
cn
.
com
.
yict
.
framemax
.
core
.
utils
.
JSON
.
serialize
(
bizPluginBusinessDto
.
getFromDataDto
());
BizPluginBusinessEntity
entity
=
new
BizPluginBusinessEntity
();
entity
.
setFormNo
(
String
.
valueOf
(
new
Date
().
getTime
()));
entity
.
setFormData
(
formData
);
entity
.
setFormType
(
bizPluginBusinessDto
.
getFormType
());
BizPluginBusinessEntity
save
=
service
.
save
(
entity
);
JSONObject
jsonObject
=
JSON
.
parseObject
(
formData
);
String
email
=
jsonObject
.
getString
(
"email"
);
if
(
StringUtils
.
isBlank
(
email
))
{
return
;
}
EmailSenderEntity
emailSenderEntity
=
new
EmailSenderEntity
();
emailSenderEntity
.
setBody
(
"您提交的出差申请已成功受理!"
);
emailSenderEntity
.
setSubject
(
"出差申请回执"
);
List
<
String
>
list
=
new
LinkedList
<>();
list
.
add
(
email
);
emailSenderEntity
.
setTo
(
list
);
//接收者
try
{
// 如果成功发送,则把验证码存入redis当中,并设置15分钟的过期时间
emailSenderService
.
sendMail
(
emailSenderEntity
,
null
);
}
catch
(
Exception
e
)
{
throw
new
I18nMessageException
(
"exception/verification.code.sending.failed.please.try.again"
);
}
}
}
\ No newline at end of file
src/main/java/cn/com/poc/thirdparty/resource/demand/ai/plugin_business/service/BizPluginBusinessService.java
0 → 100644
View file @
d68e8e1f
package
cn
.
com
.
poc
.
thirdparty
.
resource
.
demand
.
ai
.
plugin_business
.
service
;
import
cn.com.yict.framemax.core.service.BaseService
;
import
cn.com.poc.thirdparty.resource.demand.ai.plugin_business.entity.BizPluginBusinessEntity
;
import
cn.com.yict.framemax.data.model.PagingInfo
;
import
java.util.Collection
;
import
java.util.List
;
public
interface
BizPluginBusinessService
extends
BaseService
{
BizPluginBusinessEntity
get
(
Integer
id
)
throws
Exception
;
List
<
BizPluginBusinessEntity
>
findByExample
(
BizPluginBusinessEntity
example
,
PagingInfo
pagingInfo
)
throws
Exception
;
BizPluginBusinessEntity
save
(
BizPluginBusinessEntity
entity
)
throws
Exception
;
BizPluginBusinessEntity
update
(
BizPluginBusinessEntity
entity
)
throws
Exception
;
void
deletedById
(
Integer
id
)
throws
Exception
;
}
\ No newline at end of file
src/main/java/cn/com/poc/thirdparty/resource/demand/ai/plugin_business/service/impl/BizPluginBusinessServiceImpl.java
0 → 100644
View file @
d68e8e1f
package
cn
.
com
.
poc
.
thirdparty
.
resource
.
demand
.
ai
.
plugin_business
.
service
.
impl
;
import
cn.com.yict.framemax.core.service.impl.BaseServiceImpl
;
import
cn.com.poc.thirdparty.resource.demand.ai.plugin_business.service.BizPluginBusinessService
;
import
cn.com.poc.thirdparty.resource.demand.ai.plugin_business.model.BizPluginBusinessModel
;
import
cn.com.poc.thirdparty.resource.demand.ai.plugin_business.entity.BizPluginBusinessEntity
;
import
cn.com.poc.thirdparty.resource.demand.ai.plugin_business.convert.BizPluginBusinessConvert
;
import
cn.com.poc.thirdparty.resource.demand.ai.plugin_business.repository.BizPluginBusinessRepository
;
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
BizPluginBusinessServiceImpl
extends
BaseServiceImpl
implements
BizPluginBusinessService
{
@Resource
private
BizPluginBusinessRepository
repository
;
public
BizPluginBusinessEntity
get
(
Integer
id
)
throws
Exception
{
Assert
.
notNull
(
id
);
BizPluginBusinessModel
model
=
this
.
repository
.
get
(
id
);
if
(
model
==
null
){
return
null
;
}
if
(
"Y"
.
equals
(
model
.
getIsDeleted
())){
return
null
;
}
return
BizPluginBusinessConvert
.
modelToEntity
(
model
);
}
public
List
<
BizPluginBusinessEntity
>
findByExample
(
BizPluginBusinessEntity
example
,
PagingInfo
pagingInfo
)
throws
Exception
{
List
<
BizPluginBusinessEntity
>
result
=
new
ArrayList
<
BizPluginBusinessEntity
>();
BizPluginBusinessModel
model
=
new
BizPluginBusinessModel
();
if
(
example
!=
null
){
model
=
BizPluginBusinessConvert
.
entityToModel
(
example
);
}
model
.
setIsDeleted
(
"N"
);
List
<
BizPluginBusinessModel
>
models
=
this
.
repository
.
findByExample
(
model
,
pagingInfo
);
if
(
CollectionUtils
.
isNotEmpty
(
models
))
{
result
=
models
.
stream
().
map
(
BizPluginBusinessConvert:
:
modelToEntity
).
collect
(
Collectors
.
toList
());
}
return
result
;
}
public
BizPluginBusinessEntity
save
(
BizPluginBusinessEntity
entity
)
throws
Exception
{
Assert
.
notNull
(
entity
);
entity
.
setFormId
(
null
);
entity
.
setIsDeleted
(
"N"
);
BizPluginBusinessModel
model
=
BizPluginBusinessConvert
.
entityToModel
(
entity
);
BizPluginBusinessModel
saveModel
=
this
.
repository
.
save
(
model
);
return
BizPluginBusinessConvert
.
modelToEntity
(
saveModel
);
}
public
BizPluginBusinessEntity
update
(
BizPluginBusinessEntity
entity
)
throws
Exception
{
Assert
.
notNull
(
entity
);
Assert
.
notNull
(
entity
.
getFormId
(),
"update pk can not be null"
);
BizPluginBusinessModel
model
=
this
.
repository
.
get
(
entity
.
getFormId
());
if
(
entity
.
getFormNo
()
!=
null
){
model
.
setFormNo
(
entity
.
getFormNo
());
}
if
(
entity
.
getFormData
()
!=
null
){
model
.
setFormData
(
entity
.
getFormData
());
}
if
(
entity
.
getFormType
()
!=
null
){
model
.
setFormType
(
entity
.
getFormType
());
}
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
());
}
BizPluginBusinessModel
saveModel
=
this
.
repository
.
save
(
model
);
return
BizPluginBusinessConvert
.
modelToEntity
(
saveModel
);
}
public
void
deletedById
(
Integer
id
)
throws
Exception
{
Assert
.
notNull
(
id
);
BizPluginBusinessModel
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
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