Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
dj
/
rpc-mindworkplate
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 8cbc59a8
authored
Jun 18, 2026
by
章家宝
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
feat:1 接待录音转文本新增ai标签分析 2 暴露dubbo接口供打标用
1 parent
993133d3
Show whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
828 additions
and
1 deletions
rpc-dj-mindworkplate-api/src/main/java/cn/com/glsx/dj/mindworkplate/dto/InspectionCustomerTagDTO.java
rpc-dj-mindworkplate-api/src/main/java/cn/com/glsx/dj/mindworkplate/dto/InspectionCustomerTagPageRequestDTO.java
rpc-dj-mindworkplate-api/src/main/java/cn/com/glsx/dj/mindworkplate/model/InspectionCustomerTag.java
rpc-dj-mindworkplate-api/src/main/java/cn/com/glsx/dj/mindworkplate/remote/InspectionCustomerTagRemote.java
rpc-dj-mindworkplate/pom.xml
rpc-dj-mindworkplate/src/main/java/cn/com/glsx/dj/mindworkplate/client/CustomerTagApiClient.java
rpc-dj-mindworkplate/src/main/java/cn/com/glsx/dj/mindworkplate/client/CustomerTagResult.java
rpc-dj-mindworkplate/src/main/java/cn/com/glsx/dj/mindworkplate/config/DubboConfig.java
rpc-dj-mindworkplate/src/main/java/cn/com/glsx/dj/mindworkplate/job/CustomerTagResultJob.java
rpc-dj-mindworkplate/src/main/java/cn/com/glsx/dj/mindworkplate/mapper/InspectionCustomerTagMapper.java
rpc-dj-mindworkplate/src/main/java/cn/com/glsx/dj/mindworkplate/remote/InspectionCustomerTagRemoteImpl.java
rpc-dj-mindworkplate/src/main/java/cn/com/glsx/dj/mindworkplate/service/ConversationDateService.java
rpc-dj-mindworkplate/src/main/java/cn/com/glsx/dj/mindworkplate/service/InspectionCustomerTagService.java
rpc-dj-mindworkplate/src/main/resources/META-INF/orm/InspectionCustomerTagMapper.xml
rpc-dj-mindworkplate-api/src/main/java/cn/com/glsx/dj/mindworkplate/dto/InspectionCustomerTagDTO.java
0 → 100644
View file @
8cbc59a
package
cn
.
com
.
glsx
.
dj
.
mindworkplate
.
dto
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.io.Serializable
;
import
java.util.Date
;
/**
* 客户标签分析结果DTO
*/
@Data
public
class
InspectionCustomerTagDTO
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
@ApiModelProperty
(
notes
=
"主键"
)
private
Integer
id
;
@ApiModelProperty
(
notes
=
"批次ID"
)
private
Integer
batchId
;
@ApiModelProperty
(
notes
=
"录音ID"
)
private
Integer
recordId
;
@ApiModelProperty
(
notes
=
"大模型任务ID"
)
private
String
taskId
;
@ApiModelProperty
(
notes
=
"结果状态:0-待查询,1-分析中,2-成功,3-失败"
)
private
Integer
resultFlag
;
@ApiModelProperty
(
notes
=
"标签分析结果"
)
private
String
tagResult
;
@ApiModelProperty
(
notes
=
"错误信息"
)
private
String
errMessage
;
@ApiModelProperty
(
notes
=
"创建人"
)
private
String
createdBy
;
@ApiModelProperty
(
notes
=
"创建时间"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
private
Date
createdDate
;
@ApiModelProperty
(
notes
=
"更新人"
)
private
String
updatedBy
;
@ApiModelProperty
(
notes
=
"更新时间"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
private
Date
updatedDate
;
@ApiModelProperty
(
notes
=
"客户手机号"
)
private
String
customerPhone
;
}
rpc-dj-mindworkplate-api/src/main/java/cn/com/glsx/dj/mindworkplate/dto/InspectionCustomerTagPageRequestDTO.java
0 → 100644
View file @
8cbc59a
package
cn
.
com
.
glsx
.
dj
.
mindworkplate
.
dto
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.io.Serializable
;
/**
* 客户标签分析结果分页查询请求
*/
@Data
public
class
InspectionCustomerTagPageRequestDTO
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
@ApiModelProperty
(
notes
=
"批次ID"
)
private
Integer
batchId
;
@ApiModelProperty
(
notes
=
"结果状态:0-待查询,1-分析中,2-成功,3-失败"
)
private
Integer
resultFlag
;
@ApiModelProperty
(
notes
=
"创建时间开始"
)
private
String
startTime
;
@ApiModelProperty
(
notes
=
"创建时间结束"
)
private
String
endTime
;
}
rpc-dj-mindworkplate-api/src/main/java/cn/com/glsx/dj/mindworkplate/model/InspectionCustomerTag.java
0 → 100644
View file @
8cbc59a
package
cn
.
com
.
glsx
.
dj
.
mindworkplate
.
model
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
javax.persistence.*
;
import
java.io.Serializable
;
import
java.util.Date
;
/**
* 客户标签分析结果表
*/
@Data
@Table
(
name
=
"inspection_customer_tag"
)
public
class
InspectionCustomerTag
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
@Id
@GeneratedValue
(
strategy
=
GenerationType
.
IDENTITY
)
private
Integer
id
;
/**
* 批次ID,关联inspection_conversation_batch.id
*/
@Column
(
name
=
"batch_id"
)
@ApiModelProperty
(
notes
=
"批次ID"
)
private
Integer
batchId
;
/**
* 录音ID,关联inspection_badge_recordings.id
*/
@Column
(
name
=
"record_id"
)
@ApiModelProperty
(
notes
=
"录音ID"
)
private
Integer
recordId
;
/**
* 大模型任务ID
*/
@Column
(
name
=
"task_id"
)
@ApiModelProperty
(
notes
=
"大模型任务ID"
)
private
String
taskId
;
/**
* 结果状态:0-待查询,1-分析中,2-成功,3-失败
*/
@Column
(
name
=
"result_flag"
)
@ApiModelProperty
(
notes
=
"结果状态:0-待查询,1-分析中,2-成功,3-失败"
)
private
Integer
resultFlag
;
/**
* 标签分析结果(JSON格式)
*/
@Column
(
name
=
"tag_result"
)
@ApiModelProperty
(
notes
=
"标签分析结果"
)
private
String
tagResult
;
/**
* 错误信息
*/
@Column
(
name
=
"err_message"
)
@ApiModelProperty
(
notes
=
"错误信息"
)
private
String
errMessage
;
/**
* 创建人
*/
@Column
(
name
=
"created_by"
)
private
String
createdBy
;
/**
* 创建时间
*/
@Column
(
name
=
"created_date"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
private
Date
createdDate
;
/**
* 更新人
*/
@Column
(
name
=
"updated_by"
)
private
String
updatedBy
;
/**
* 更新时间
*/
@Column
(
name
=
"updated_date"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
private
Date
updatedDate
;
/**
* 删除标识:D-已删除,N-未删除
*/
@Column
(
name
=
"deleted_flag"
)
private
String
deletedFlag
;
}
rpc-dj-mindworkplate-api/src/main/java/cn/com/glsx/dj/mindworkplate/remote/InspectionCustomerTagRemote.java
0 → 100644
View file @
8cbc59a
package
cn
.
com
.
glsx
.
dj
.
mindworkplate
.
remote
;
import
cn.com.glsx.dj.mindworkplate.dto.InspectionCustomerTagDTO
;
import
cn.com.glsx.dj.mindworkplate.dto.InspectionCustomerTagPageRequestDTO
;
import
cn.com.glsx.framework.core.annotation.ApiMethod
;
import
cn.com.glsx.framework.core.annotation.ApiParam
;
import
cn.com.glsx.framework.core.annotation.ApiResponse
;
import
cn.com.glsx.framework.core.annotation.ApiService
;
import
cn.com.glsx.framework.core.beans.rpc.RpcPagination
;
import
cn.com.glsx.framework.core.beans.rpc.RpcResponse
;
@ApiService
(
value
=
"智享车生活-客户标签分析结果管理"
,
owner
=
"linyj"
)
public
interface
InspectionCustomerTagRemote
{
@ApiMethod
(
"分页查询客户标签分析结果"
)
@ApiParam
(
name
=
"req"
,
notes
=
"查询条件"
,
dataType
=
ApiParam
.
DataTypeEnum
.
OBJECT
,
required
=
true
)
@ApiResponse
(
"客户标签分析结果列表"
)
RpcResponse
<
RpcPagination
<
InspectionCustomerTagDTO
>>
inspectionCustomerTagPage
(
RpcPagination
<
InspectionCustomerTagPageRequestDTO
>
req
);
}
rpc-dj-mindworkplate/pom.xml
View file @
8cbc59a
...
@@ -16,7 +16,7 @@
...
@@ -16,7 +16,7 @@
<dependency>
<dependency>
<groupId>
cn.com.glsx.dj.strategy
</groupId>
<groupId>
cn.com.glsx.dj.strategy
</groupId>
<artifactId>
rpc-dj-strategy-api
</artifactId>
<artifactId>
rpc-dj-strategy-api
</artifactId>
<version>
5.
6.0
-SNAPSHOT
</version>
<version>
5.
8.3
-SNAPSHOT
</version>
</dependency>
</dependency>
<dependency>
<dependency>
<groupId>
cn.com.glsx.dj
</groupId>
<groupId>
cn.com.glsx.dj
</groupId>
...
...
rpc-dj-mindworkplate/src/main/java/cn/com/glsx/dj/mindworkplate/client/CustomerTagApiClient.java
0 → 100644
View file @
8cbc59a
package
cn
.
com
.
glsx
.
dj
.
mindworkplate
.
client
;
import
cn.com.glsx.dj.mindworkplate.util.HttpUtils
;
import
cn.com.glsx.dj.strategy.dto.TagCategoryDimensionQueryReqDTO
;
import
cn.com.glsx.dj.strategy.dto.TagCategoryDimensionRespDTO
;
import
cn.com.glsx.dj.strategy.dto.TagDimensionRespDTO
;
import
cn.com.glsx.dj.strategy.dto.TagEnumRespDTO
;
import
cn.com.glsx.dj.strategy.remote.TagCategoryRemote
;
import
cn.com.glsx.framework.core.beans.rpc.RpcResponse
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.core.env.Environment
;
import
org.springframework.stereotype.Component
;
import
org.springframework.util.CollectionUtils
;
import
java.io.IOException
;
import
java.util.*
;
/**
* 客户标签分析大模型接口客户端
*/
@Slf4j
@Component
public
class
CustomerTagApiClient
{
@Autowired
private
Environment
environment
;
@Autowired
private
TagCategoryRemote
tagCategoryRemote
;
/**
* 获取配置项 - 接口域名
*/
private
String
getBaseUrl
()
{
return
environment
.
getProperty
(
"customer-tag.api.base-url"
);
}
/**
* 获取配置项 - 模板ID
*/
private
String
getTemplateId
()
{
return
environment
.
getProperty
(
"customer-tag.api.template-id"
);
}
/**
* 获取配置项 - 账户ID
*/
private
String
getAccountId
()
{
return
environment
.
getProperty
(
"customer-tag.api.account-id"
);
}
/**
* 获取配置项 - 分类代码
*/
private
String
getCategoryCode
()
{
return
environment
.
getProperty
(
"customer-tag.api.category-code"
);
}
/**
* 提交客户标签分析任务
*
* @param recordingText 录音转文本内容
* @return 返回 task_id
*/
public
String
submitAnalysis
(
String
recordingText
)
{
String
url
=
getBaseUrl
()
+
"/api/v1/calls/by-template"
;
Map
<
String
,
Object
>
request
=
new
HashMap
<>();
request
.
put
(
"template_id"
,
getTemplateId
());
request
.
put
(
"account_id"
,
getAccountId
());
Map
<
String
,
String
>
variables
=
new
HashMap
<>();
String
labelInfo
=
buildLabelInfo
();
variables
.
put
(
"label_info"
,
labelInfo
);
variables
.
put
(
"recording_text"
,
recordingText
);
request
.
put
(
"variables"
,
variables
);
request
.
put
(
"mode"
,
"async"
);
log
.
info
(
"提交客户标签分析任务,url={}, request={}"
,
url
,
JSON
.
toJSONString
(
request
));
try
{
String
response
=
HttpUtils
.
post
(
url
,
JSON
.
toJSONString
(
request
));
log
.
info
(
"提交客户标签分析任务响应,response={}"
,
response
);
if
(
StringUtils
.
isNotBlank
(
response
))
{
JSONObject
result
=
JSON
.
parseObject
(
response
);
if
(
"accepted"
.
equals
(
result
.
getString
(
"status"
)))
{
return
result
.
getString
(
"task_id"
);
}
throw
new
RuntimeException
(
"提交客户标签分析任务失败:"
+
result
.
getString
(
"message"
));
}
}
catch
(
IOException
e
)
{
log
.
error
(
"提交客户标签分析任务异常"
,
e
);
throw
new
RuntimeException
(
"提交客户标签分析任务异常"
,
e
);
}
throw
new
RuntimeException
(
"提交客户标签分析任务失败:响应为空"
);
}
/**
* 查询分析结果
*
* @param taskId 任务ID
* @return 分析结果
*/
public
CustomerTagResult
getResult
(
String
taskId
)
{
String
url
=
getBaseUrl
()
+
"/api/v1/calls/orchestrate/async?task_id="
+
taskId
;
log
.
info
(
"查询客户标签分析结果,url={}"
,
url
);
try
{
String
response
=
HttpUtils
.
get
(
url
);
log
.
info
(
"查询客户标签分析结果响应,response={}"
,
response
);
if
(
StringUtils
.
isNotBlank
(
response
))
{
JSONObject
result
=
JSON
.
parseObject
(
response
);
CustomerTagResult
tagResult
=
new
CustomerTagResult
();
tagResult
.
setTaskId
(
result
.
getString
(
"task_id"
));
tagResult
.
setStatus
(
result
.
getString
(
"status"
));
tagResult
.
setProgress
(
result
.
getInteger
(
"progress"
));
tagResult
.
setCallRecordStatus
(
result
.
getString
(
"call_record_status"
));
tagResult
.
setResponseContent
(
result
.
getString
(
"response_content"
));
tagResult
.
setErrorMessage
(
result
.
getString
(
"error_message"
));
return
tagResult
;
}
}
catch
(
IOException
e
)
{
log
.
error
(
"查询客户标签分析结果异常"
,
e
);
throw
new
RuntimeException
(
"查询客户标签分析结果异常"
,
e
);
}
throw
new
RuntimeException
(
"查询客户标签分析结果失败:响应为空"
);
}
/**
* 构建标签信息 JSON
*/
private
String
buildLabelInfo
()
{
try
{
String
categoryCode
=
getCategoryCode
();
if
(
StringUtils
.
isBlank
(
categoryCode
))
{
log
.
warn
(
"未配置标签分类代码,label_info 返回空"
);
return
""
;
}
TagCategoryDimensionQueryReqDTO
req
=
new
TagCategoryDimensionQueryReqDTO
();
req
.
setCategoryCode
(
categoryCode
);
RpcResponse
<
TagCategoryDimensionRespDTO
>
response
=
tagCategoryRemote
.
queryCategoryWithDimensions
(
req
);
if
(
response
==
null
||
!
response
.
isSuccess
()
||
response
.
getResult
()
==
null
)
{
log
.
warn
(
"查询标签分类信息失败,categoryCode={}"
,
categoryCode
);
return
""
;
}
TagCategoryDimensionRespDTO
data
=
response
.
getResult
();
return
assembleLabelInfoJson
(
data
);
}
catch
(
Exception
e
)
{
log
.
error
(
"构建标签信息异常"
,
e
);
return
""
;
}
}
/**
* 组装标签信息 JSON
* 格式:{categoryName:[{dimensionName:[enumName,enumName,enumName]}]}
*/
private
String
assembleLabelInfoJson
(
TagCategoryDimensionRespDTO
data
)
{
if
(
data
==
null
||
CollectionUtils
.
isEmpty
(
data
.
getDimensions
()))
{
return
""
;
}
Map
<
String
,
List
<
Map
<
String
,
List
<
String
>>>>
result
=
new
LinkedHashMap
<>();
List
<
Map
<
String
,
List
<
String
>>>
dimensionList
=
new
ArrayList
<>();
for
(
TagDimensionRespDTO
dimension
:
data
.
getDimensions
())
{
if
(
dimension
==
null
||
StringUtils
.
isBlank
(
dimension
.
getDimensionName
()))
{
continue
;
}
Map
<
String
,
List
<
String
>>
dimensionMap
=
new
LinkedHashMap
<>();
List
<
String
>
enumNames
=
new
ArrayList
<>();
if
(!
CollectionUtils
.
isEmpty
(
dimension
.
getEnums
()))
{
for
(
TagEnumRespDTO
enumDTO
:
dimension
.
getEnums
())
{
if
(
enumDTO
!=
null
&&
StringUtils
.
isNotBlank
(
enumDTO
.
getEnumName
()))
{
enumNames
.
add
(
enumDTO
.
getEnumName
());
}
}
}
dimensionMap
.
put
(
dimension
.
getDimensionName
(),
enumNames
);
dimensionList
.
add
(
dimensionMap
);
}
result
.
put
(
data
.
getCategoryName
(),
dimensionList
);
return
JSON
.
toJSONString
(
result
);
}
}
rpc-dj-mindworkplate/src/main/java/cn/com/glsx/dj/mindworkplate/client/CustomerTagResult.java
0 → 100644
View file @
8cbc59a
package
cn
.
com
.
glsx
.
dj
.
mindworkplate
.
client
;
import
lombok.Data
;
/**
* 客户标签分析结果响应类
*/
@Data
public
class
CustomerTagResult
{
/**
* 任务ID
*/
private
String
taskId
;
/**
* 任务状态:pending/success/failed
*/
private
String
status
;
/**
* 任务进度 0-100
*/
private
Integer
progress
;
/**
* 调用记录状态
*/
private
String
callRecordStatus
;
/**
* 标签分析结果(JSON字符串)
*/
private
String
responseContent
;
/**
* 错误信息
*/
private
String
errorMessage
;
/**
* 判断任务是否成功完成
*/
public
boolean
isSuccess
()
{
return
"success"
.
equals
(
status
)
&&
"success"
.
equals
(
callRecordStatus
);
}
/**
* 判断任务是否处理中
*/
public
boolean
isPending
()
{
return
"pending"
.
equals
(
status
)
||
(
progress
!=
null
&&
progress
<
100
);
}
/**
* 判断任务是否失败
*/
public
boolean
isFailed
()
{
return
"failed"
.
equals
(
status
)
||
"failed"
.
equals
(
callRecordStatus
);
}
}
rpc-dj-mindworkplate/src/main/java/cn/com/glsx/dj/mindworkplate/config/DubboConfig.java
View file @
8cbc59a
...
@@ -10,6 +10,7 @@ import cn.com.glsx.entmicro.remote.EntmicroStaffRemote;
...
@@ -10,6 +10,7 @@ import cn.com.glsx.entmicro.remote.EntmicroStaffRemote;
import
cn.com.glsx.merchants.remote.MerchantRemote
;
import
cn.com.glsx.merchants.remote.MerchantRemote
;
import
cn.com.glsx.merchants.remote.MerchantStaffRemote
;
import
cn.com.glsx.merchants.remote.MerchantStaffRemote
;
import
cn.com.glsx.scrm.clue.remote.BurialPointRecordRemote
;
import
cn.com.glsx.scrm.clue.remote.BurialPointRecordRemote
;
import
cn.com.glsx.dj.strategy.remote.TagCategoryRemote
;
import
cn.com.glsx.scrm.equity.remote.ServicePackageRemote
;
import
cn.com.glsx.scrm.equity.remote.ServicePackageRemote
;
import
cn.com.glsx.scrm.proxy.remote.CommonProxyRemote
;
import
cn.com.glsx.scrm.proxy.remote.CommonProxyRemote
;
import
cn.com.glsx.scrm.proxy.remote.ShortUrlRemote
;
import
cn.com.glsx.scrm.proxy.remote.ShortUrlRemote
;
...
@@ -182,5 +183,10 @@ public class DubboConfig {
...
@@ -182,5 +183,10 @@ public class DubboConfig {
return
factory
.
builder
(
MerchantRemote
.
class
).
check
(
false
).
version
(
"2.0.0"
).
timeout
(
30000
).
build
();
return
factory
.
builder
(
MerchantRemote
.
class
).
check
(
false
).
version
(
"2.0.0"
).
timeout
(
30000
).
build
();
}
}
@Bean
public
TagCategoryRemote
tagCategoryRemote
()
{
return
factory
.
builder
(
TagCategoryRemote
.
class
).
check
(
false
).
timeout
(
30000
).
build
();
}
}
}
rpc-dj-mindworkplate/src/main/java/cn/com/glsx/dj/mindworkplate/job/CustomerTagResultJob.java
0 → 100644
View file @
8cbc59a
package
cn
.
com
.
glsx
.
dj
.
mindworkplate
.
job
;
import
cn.com.glsx.dj.mindworkplate.model.InspectionCustomerTag
;
import
cn.com.glsx.dj.mindworkplate.service.InspectionCustomerTagService
;
import
com.dangdang.ddframe.job.api.ShardingContext
;
import
com.dangdang.ddframe.job.api.simple.SimpleJob
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.oreframework.boot.autoconfigure.elasticjob.annotation.ElasticJobConf
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
java.util.List
;
/**
* 获取客户标签分析结果定时任务
*/
@Slf4j
@ElasticJobConf
(
name
=
"CustomerTagResultJob"
,
cron
=
"0 0/5 * * * ?"
,
description
=
"获取客户标签分析结果"
,
overwrite
=
false
)
public
class
CustomerTagResultJob
implements
SimpleJob
{
@Autowired
private
InspectionCustomerTagService
inspectionCustomerTagService
;
@Override
public
void
execute
(
ShardingContext
shardingContext
)
{
log
.
info
(
"----------获取客户标签分析结果任务开始----------"
);
List
<
InspectionCustomerTag
>
pendingList
=
inspectionCustomerTagService
.
findPendingResults
();
if
(
CollectionUtils
.
isNotEmpty
(
pendingList
))
{
for
(
InspectionCustomerTag
tag
:
pendingList
)
{
try
{
inspectionCustomerTagService
.
getCustomerTagResult
(
tag
);
}
catch
(
Exception
e
)
{
log
.
error
(
"获取客户标签分析结果异常,id={}"
,
tag
.
getId
(),
e
);
}
}
}
log
.
info
(
"----------获取客户标签分析结果任务结束----------"
);
}
}
rpc-dj-mindworkplate/src/main/java/cn/com/glsx/dj/mindworkplate/mapper/InspectionCustomerTagMapper.java
0 → 100644
View file @
8cbc59a
package
cn
.
com
.
glsx
.
dj
.
mindworkplate
.
mapper
;
import
cn.com.glsx.dj.mindworkplate.dto.InspectionCustomerTagDTO
;
import
cn.com.glsx.dj.mindworkplate.dto.InspectionCustomerTagPageRequestDTO
;
import
cn.com.glsx.dj.mindworkplate.model.InspectionCustomerTag
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
import
org.oreframework.datasource.mybatis.mapper.OreMapper
;
import
java.util.List
;
/**
* 客户标签分析结果Mapper
*/
@Mapper
public
interface
InspectionCustomerTagMapper
extends
OreMapper
<
InspectionCustomerTag
>
{
/**
* 根据批次ID查询
*/
InspectionCustomerTag
selectByBatchId
(
@Param
(
"batchId"
)
Integer
batchId
);
/**
* 查询待获取结果的记录(result_flag = 1)
*/
List
<
InspectionCustomerTag
>
findPendingResults
();
/**
* 更新结果
*/
int
updateResult
(
@Param
(
"id"
)
Integer
id
,
@Param
(
"resultFlag"
)
Integer
resultFlag
,
@Param
(
"tagResult"
)
String
tagResult
,
@Param
(
"errMessage"
)
String
errMessage
);
/**
* 分页查询客户标签分析结果(关联客户手机号)
*/
List
<
InspectionCustomerTagDTO
>
selectPageList
(
@Param
(
"req"
)
InspectionCustomerTagPageRequestDTO
req
);
}
rpc-dj-mindworkplate/src/main/java/cn/com/glsx/dj/mindworkplate/remote/InspectionCustomerTagRemoteImpl.java
0 → 100644
View file @
8cbc59a
package
cn
.
com
.
glsx
.
dj
.
mindworkplate
.
remote
;
import
cn.com.glsx.dj.mindworkplate.dto.InspectionCustomerTagDTO
;
import
cn.com.glsx.dj.mindworkplate.dto.InspectionCustomerTagPageRequestDTO
;
import
cn.com.glsx.dj.mindworkplate.service.InspectionCustomerTagService
;
import
cn.com.glsx.framework.core.beans.rpc.RpcPagination
;
import
cn.com.glsx.framework.core.beans.rpc.RpcResponse
;
import
cn.com.glsx.framework.core.exception.RpcServiceException
;
import
com.github.pagehelper.Page
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.dubbo.config.annotation.DubboService
;
import
org.springframework.beans.factory.annotation.Autowired
;
@Slf4j
@DubboService
(
protocol
=
"dubbo"
)
public
class
InspectionCustomerTagRemoteImpl
implements
InspectionCustomerTagRemote
{
@Autowired
private
InspectionCustomerTagService
inspectionCustomerTagService
;
@Override
public
RpcResponse
<
RpcPagination
<
InspectionCustomerTagDTO
>>
inspectionCustomerTagPage
(
RpcPagination
<
InspectionCustomerTagPageRequestDTO
>
req
)
{
try
{
Page
<
InspectionCustomerTagDTO
>
res
=
inspectionCustomerTagService
.
inspectionCustomerTagPage
(
req
);
return
RpcResponse
.
success
(
RpcPagination
.
copyPage
(
res
));
}
catch
(
RpcServiceException
e
)
{
log
.
error
(
e
.
getMessage
(),
e
);
return
RpcResponse
.
error
(
e
);
}
}
}
rpc-dj-mindworkplate/src/main/java/cn/com/glsx/dj/mindworkplate/service/ConversationDateService.java
View file @
8cbc59a
...
@@ -114,6 +114,9 @@ public class ConversationDateService {
...
@@ -114,6 +114,9 @@ public class ConversationDateService {
@Autowired
@Autowired
private
ReceptionModeltypeConfigMapper
receptionModeltypeConfigMapper
;
private
ReceptionModeltypeConfigMapper
receptionModeltypeConfigMapper
;
@Autowired
private
InspectionCustomerTagService
inspectionCustomerTagService
;
/**
/**
* 语音文本分批次
* 语音文本分批次
*
*
...
@@ -423,6 +426,14 @@ public class ConversationDateService {
...
@@ -423,6 +426,14 @@ public class ConversationDateService {
log
.
warn
(
"第{}个批次的对话内容长度为0,conversationId={},batchId={}"
,
num
,
conversationBatch
.
getConversationId
(),
conversationBatch
.
getId
());
log
.
warn
(
"第{}个批次的对话内容长度为0,conversationId={},batchId={}"
,
num
,
conversationBatch
.
getConversationId
(),
conversationBatch
.
getId
());
return
;
return
;
}
}
// 新增:提交客户标签分析(仅轻改业务 checkType=2)
if
(
conversationBatch
.
getCheckType
()
!=
null
&&
conversationBatch
.
getCheckType
()
==
2
)
{
try
{
inspectionCustomerTagService
.
submitCustomerTagAnalysis
(
conversationBatch
,
sb
.
toString
());
}
catch
(
Exception
e
)
{
log
.
error
(
"提交客户标签分析任务异常,batchId={}"
,
conversationBatch
.
getId
(),
e
);
}
}
//调用大模型接口获取质检结果信息
//调用大模型接口获取质检结果信息
log
.
info
(
"请求参数:{}"
,
sb
);
log
.
info
(
"请求参数:{}"
,
sb
);
int
modelType
=
convertModelType
(
conversationBatch
.
getCheckType
(),
int
modelType
=
convertModelType
(
conversationBatch
.
getCheckType
(),
...
...
rpc-dj-mindworkplate/src/main/java/cn/com/glsx/dj/mindworkplate/service/InspectionCustomerTagService.java
0 → 100644
View file @
8cbc59a
package
cn
.
com
.
glsx
.
dj
.
mindworkplate
.
service
;
import
cn.com.glsx.dj.mindworkplate.client.CustomerTagApiClient
;
import
cn.com.glsx.dj.mindworkplate.client.CustomerTagResult
;
import
cn.com.glsx.dj.mindworkplate.dto.InspectionCustomerTagDTO
;
import
cn.com.glsx.dj.mindworkplate.dto.InspectionCustomerTagPageRequestDTO
;
import
cn.com.glsx.dj.mindworkplate.mapper.InspectionCustomerTagMapper
;
import
cn.com.glsx.dj.mindworkplate.model.ConversationBatch
;
import
cn.com.glsx.dj.mindworkplate.model.InspectionCustomerTag
;
import
cn.com.glsx.framework.core.beans.rpc.RpcPagination
;
import
cn.com.glsx.scrm.equity.enums.DeleteFlagEnum
;
import
com.github.pagehelper.Page
;
import
com.github.pagehelper.PageHelper
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.util.Date
;
import
java.util.List
;
/**
* 客户标签分析服务
*/
@Slf4j
@Service
public
class
InspectionCustomerTagService
{
@Autowired
private
InspectionCustomerTagMapper
inspectionCustomerTagMapper
;
@Autowired
private
CustomerTagApiClient
customerTagApiClient
;
/**
* 提交客户标签分析任务
*
* @param conversationBatch 批次信息
* @param recordingText 录音转文本内容
*/
@Transactional
public
void
submitCustomerTagAnalysis
(
ConversationBatch
conversationBatch
,
String
recordingText
)
{
log
.
info
(
"提交客户标签分析任务,batchId={}, recordId={}"
,
conversationBatch
.
getId
(),
conversationBatch
.
getRecordId
());
// 检查是否已存在记录
InspectionCustomerTag
existTag
=
inspectionCustomerTagMapper
.
selectByBatchId
(
conversationBatch
.
getId
());
if
(
existTag
!=
null
)
{
log
.
info
(
"客户标签分析记录已存在,batchId={}, 跳过"
,
conversationBatch
.
getId
());
return
;
}
// 调用大模型接口
String
taskId
=
customerTagApiClient
.
submitAnalysis
(
recordingText
);
log
.
info
(
"客户标签分析任务已提交,batchId={}, taskId={}"
,
conversationBatch
.
getId
(),
taskId
);
// 保存记录
InspectionCustomerTag
tag
=
new
InspectionCustomerTag
();
tag
.
setBatchId
(
conversationBatch
.
getId
());
tag
.
setRecordId
(
conversationBatch
.
getRecordId
());
tag
.
setTaskId
(
taskId
);
tag
.
setResultFlag
(
1
);
// 分析中
tag
.
setCreatedBy
(
"system"
);
tag
.
setCreatedDate
(
new
Date
());
tag
.
setDeletedFlag
(
DeleteFlagEnum
.
N
.
getValue
());
inspectionCustomerTagMapper
.
insertSelective
(
tag
);
log
.
info
(
"客户标签分析记录已保存,batchId={}, id={}"
,
conversationBatch
.
getId
(),
tag
.
getId
());
}
/**
* 查询并更新分析结果
*
* @param tag 标签记录
*/
@Transactional
public
void
getCustomerTagResult
(
InspectionCustomerTag
tag
)
{
log
.
info
(
"查询客户标签分析结果,id={}, taskId={}"
,
tag
.
getId
(),
tag
.
getTaskId
());
try
{
CustomerTagResult
result
=
customerTagApiClient
.
getResult
(
tag
.
getTaskId
());
if
(
result
.
isSuccess
())
{
// 成功
inspectionCustomerTagMapper
.
updateResult
(
tag
.
getId
(),
2
,
result
.
getResponseContent
(),
null
);
log
.
info
(
"客户标签分析成功,id={}"
,
tag
.
getId
());
}
else
if
(
result
.
isFailed
())
{
// 失败
inspectionCustomerTagMapper
.
updateResult
(
tag
.
getId
(),
3
,
null
,
result
.
getErrorMessage
());
log
.
warn
(
"客户标签分析失败,id={}, error={}"
,
tag
.
getId
(),
result
.
getErrorMessage
());
}
else
{
// 处理中,不更新状态
log
.
info
(
"客户标签分析处理中,id={}, progress={}"
,
tag
.
getId
(),
result
.
getProgress
());
}
}
catch
(
Exception
e
)
{
log
.
error
(
"查询客户标签分析结果异常,id={}"
,
tag
.
getId
(),
e
);
// 更新为失败状态
inspectionCustomerTagMapper
.
updateResult
(
tag
.
getId
(),
3
,
null
,
e
.
getMessage
());
}
}
/**
* 查询待获取结果的记录
*
* @return 待处理记录列表
*/
public
List
<
InspectionCustomerTag
>
findPendingResults
()
{
return
inspectionCustomerTagMapper
.
findPendingResults
();
}
/**
* 根据批次ID查询结果
*
* @param batchId 批次ID
* @return 标签结果
*/
public
InspectionCustomerTag
findByBatchId
(
Integer
batchId
)
{
return
inspectionCustomerTagMapper
.
selectByBatchId
(
batchId
);
}
/**
* 分页查询客户标签分析结果
*
* @param req 查询条件
* @return 分页结果
*/
public
Page
<
InspectionCustomerTagDTO
>
inspectionCustomerTagPage
(
RpcPagination
<
InspectionCustomerTagPageRequestDTO
>
req
)
{
InspectionCustomerTagPageRequestDTO
requestDTO
=
req
.
getCondition
();
if
(
requestDTO
==
null
)
{
requestDTO
=
new
InspectionCustomerTagPageRequestDTO
();
}
PageHelper
.
startPage
(
req
.
getPageNum
(),
req
.
getPageSize
());
List
<
InspectionCustomerTagDTO
>
list
=
inspectionCustomerTagMapper
.
selectPageList
(
requestDTO
);
return
(
Page
<
InspectionCustomerTagDTO
>)
list
;
}
}
rpc-dj-mindworkplate/src/main/resources/META-INF/orm/InspectionCustomerTagMapper.xml
0 → 100644
View file @
8cbc59a
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper
namespace=
"cn.com.glsx.dj.mindworkplate.mapper.InspectionCustomerTagMapper"
>
<resultMap
id=
"BaseResultMap"
type=
"cn.com.glsx.dj.mindworkplate.model.InspectionCustomerTag"
>
<id
column=
"id"
property=
"id"
jdbcType=
"INTEGER"
/>
<result
column=
"batch_id"
property=
"batchId"
jdbcType=
"INTEGER"
/>
<result
column=
"record_id"
property=
"recordId"
jdbcType=
"INTEGER"
/>
<result
column=
"task_id"
property=
"taskId"
jdbcType=
"VARCHAR"
/>
<result
column=
"result_flag"
property=
"resultFlag"
jdbcType=
"TINYINT"
/>
<result
column=
"tag_result"
property=
"tagResult"
jdbcType=
"LONGVARCHAR"
/>
<result
column=
"err_message"
property=
"errMessage"
jdbcType=
"VARCHAR"
/>
<result
column=
"created_by"
property=
"createdBy"
jdbcType=
"VARCHAR"
/>
<result
column=
"created_date"
property=
"createdDate"
jdbcType=
"TIMESTAMP"
/>
<result
column=
"updated_by"
property=
"updatedBy"
jdbcType=
"VARCHAR"
/>
<result
column=
"updated_date"
property=
"updatedDate"
jdbcType=
"TIMESTAMP"
/>
<result
column=
"deleted_flag"
property=
"deletedFlag"
jdbcType=
"CHAR"
/>
</resultMap>
<sql
id=
"Base_Column_List"
>
id, batch_id, record_id, task_id, result_flag, tag_result, err_message,
created_by, created_date, updated_by, updated_date, deleted_flag
</sql>
<select
id=
"selectByBatchId"
resultMap=
"BaseResultMap"
>
SELECT
<include
refid=
"Base_Column_List"
/>
FROM inspection_customer_tag
WHERE batch_id = #{batchId}
AND deleted_flag = 'N'
</select>
<select
id=
"findPendingResults"
resultMap=
"BaseResultMap"
>
SELECT
<include
refid=
"Base_Column_List"
/>
FROM inspection_customer_tag
WHERE result_flag = 1
AND deleted_flag = 'N'
</select>
<update
id=
"updateResult"
>
UPDATE inspection_customer_tag
SET result_flag = #{resultFlag},
<if
test=
"tagResult != null"
>
tag_result = #{tagResult},
</if>
<if
test=
"errMessage != null"
>
err_message = #{errMessage},
</if>
updated_date = NOW()
WHERE id = #{id}
</update>
<resultMap
id=
"DTOResultMap"
type=
"cn.com.glsx.dj.mindworkplate.dto.InspectionCustomerTagDTO"
>
<id
column=
"id"
property=
"id"
jdbcType=
"INTEGER"
/>
<result
column=
"batch_id"
property=
"batchId"
jdbcType=
"INTEGER"
/>
<result
column=
"record_id"
property=
"recordId"
jdbcType=
"INTEGER"
/>
<result
column=
"task_id"
property=
"taskId"
jdbcType=
"VARCHAR"
/>
<result
column=
"result_flag"
property=
"resultFlag"
jdbcType=
"TINYINT"
/>
<result
column=
"tag_result"
property=
"tagResult"
jdbcType=
"LONGVARCHAR"
/>
<result
column=
"err_message"
property=
"errMessage"
jdbcType=
"VARCHAR"
/>
<result
column=
"created_by"
property=
"createdBy"
jdbcType=
"VARCHAR"
/>
<result
column=
"created_date"
property=
"createdDate"
jdbcType=
"TIMESTAMP"
/>
<result
column=
"updated_by"
property=
"updatedBy"
jdbcType=
"VARCHAR"
/>
<result
column=
"updated_date"
property=
"updatedDate"
jdbcType=
"TIMESTAMP"
/>
<result
column=
"customer_phone"
property=
"customerPhone"
jdbcType=
"VARCHAR"
/>
</resultMap>
<select
id=
"selectPageList"
resultMap=
"DTOResultMap"
>
SELECT
t.id,
t.batch_id,
t.record_id,
t.task_id,
t.result_flag,
t.tag_result,
t.err_message,
t.created_by,
t.created_date,
t.updated_by,
t.updated_date,
rci.phone_number AS customer_phone
FROM inspection_customer_tag t
LEFT JOIN inspection_conversation_batch icb ON t.batch_id = icb.id
LEFT JOIN reception_customer_info rci ON icb.task_id = rci.id
WHERE t.deleted_flag = 'N'
<if
test=
"req.batchId != null"
>
AND t.batch_id = #{req.batchId}
</if>
<if
test=
"req.resultFlag != null"
>
AND t.result_flag = #{req.resultFlag}
</if>
<if
test=
"req.startTime != null and req.startTime != ''"
>
AND t.created_date
>
= #{req.startTime}
</if>
<if
test=
"req.endTime != null and req.endTime != ''"
>
AND t.created_date
<
= #{req.endTime}
</if>
ORDER BY t.created_date DESC
</select>
</mapper>
Write
Preview
Markdown
is supported
Attach a file
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 post a comment