Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
middleware-automatic
Overview
Overview
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
shenjunjie
middleware-automatic
Commits
f2a4ab0f
Commit
f2a4ab0f
authored
Jul 11, 2024
by
shentao
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'release' into 'master'
Release See merge request
!117
parents
d94cc090
371ba051
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
84 additions
and
39 deletions
+84
-39
middleware-automatic-center-client/src/main/java/com/zhiwei/middleware/automatic/server/pojo/AIMark.java
+10
-0
middleware-automatic-center-client/src/main/java/com/zhiwei/middleware/automatic/server/pojo/AiApiResult.java
+10
-0
middleware-automatic-center-client/src/main/java/com/zhiwei/middleware/automatic/server/pojo/enums/AiInterfaceEnums.java
+5
-10
middleware-automatic-center-son/src/main/java/com/zhiwei/middleware/automatic/son/task/aiTask/AbstractAiTaskService.java
+34
-28
middleware-automatic-center-son/src/main/java/com/zhiwei/middleware/automatic/son/task/aiTask/AiTaskService.java
+1
-1
middleware-automatic-center-son/src/main/java/com/zhiwei/middleware/automatic/son/task/aiTask/AiTaskServiceJNKJ.java
+24
-0
No files found.
middleware-automatic-center-client/src/main/java/com/zhiwei/middleware/automatic/server/pojo/AIMark.java
View file @
f2a4ab0f
...
@@ -230,6 +230,8 @@ public class AIMark implements Serializable {
...
@@ -230,6 +230,8 @@ public class AIMark implements Serializable {
/** 接口头信息*/
/** 接口头信息*/
private
JSONObject
header
;
private
JSONObject
header
;
private
String
waitFor
;
public
String
getUrl
()
{
public
String
getUrl
()
{
return
url
;
return
url
;
}
}
...
@@ -261,5 +263,13 @@ public class AIMark implements Serializable {
...
@@ -261,5 +263,13 @@ public class AIMark implements Serializable {
public
void
setHeader
(
JSONObject
header
)
{
public
void
setHeader
(
JSONObject
header
)
{
this
.
header
=
header
;
this
.
header
=
header
;
}
}
public
String
getWaitFor
()
{
return
waitFor
;
}
public
void
setWaitFor
(
String
waitFor
)
{
this
.
waitFor
=
waitFor
;
}
}
}
}
}
middleware-automatic-center-client/src/main/java/com/zhiwei/middleware/automatic/server/pojo/AiApiResult.java
View file @
f2a4ab0f
...
@@ -18,12 +18,22 @@ public class AiApiResult {
...
@@ -18,12 +18,22 @@ public class AiApiResult {
private
String
negLabel
;
private
String
negLabel
;
private
String
related
;
private
String
project
;
private
String
project
;
private
String
result
;
private
String
result
;
private
Long
createAt
;
private
Long
createAt
;
public
String
getRelated
()
{
return
related
;
}
public
void
setRelated
(
String
related
)
{
this
.
related
=
related
;
}
public
String
getNegLabel
()
{
public
String
getNegLabel
()
{
return
negLabel
;
return
negLabel
;
}
}
...
...
middleware-automatic-center-client/src/main/java/com/zhiwei/middleware/automatic/server/pojo/enums/AiInterfaceEnums.java
View file @
f2a4ab0f
...
@@ -6,20 +6,19 @@ package com.zhiwei.middleware.automatic.server.pojo.enums;
...
@@ -6,20 +6,19 @@ package com.zhiwei.middleware.automatic.server.pojo.enums;
**/
**/
public
enum
AiInterfaceEnums
{
public
enum
AiInterfaceEnums
{
FEI_HE
(
"飞鹤"
,
"62baa19f4d9a553ac3e7cd9b"
,
"feihe-compet-tagger"
),
FEI_HE
(
"飞鹤"
,
"62baa19f4d9a553ac3e7cd9b"
),
LAO_XIANG_JI
(
"老乡鸡"
,
"665d8791b36dd11c5e453955"
,
"laoxiangji-tagger"
);
LAO_XIANG_JI
(
"老乡鸡"
,
"665d8791b36dd11c5e453955"
),
JIA_NAN_KE_JI
(
"嘉楠科技"
,
"65efecab7d8b3a478260e7b6"
);
final
String
project
;
final
String
project
;
final
String
projectId
;
final
String
projectId
;
final
String
waitFor
;
AiInterfaceEnums
(
String
project
,
String
projectId
)
{
AiInterfaceEnums
(
String
project
,
String
projectId
,
String
waitFor
)
{
this
.
project
=
project
;
this
.
project
=
project
;
this
.
projectId
=
projectId
;
this
.
projectId
=
projectId
;
this
.
waitFor
=
waitFor
;
}
}
public
String
getProject
()
{
public
String
getProject
()
{
...
@@ -30,10 +29,6 @@ public enum AiInterfaceEnums {
...
@@ -30,10 +29,6 @@ public enum AiInterfaceEnums {
return
projectId
;
return
projectId
;
}
}
public
String
getWaitFor
()
{
return
waitFor
;
}
public
static
AiInterfaceEnums
create
(
String
projectId
)
{
public
static
AiInterfaceEnums
create
(
String
projectId
)
{
for
(
AiInterfaceEnums
enums
:
AiInterfaceEnums
.
values
())
{
for
(
AiInterfaceEnums
enums
:
AiInterfaceEnums
.
values
())
{
if
(
enums
.
getProjectId
().
equals
(
projectId
))
{
if
(
enums
.
getProjectId
().
equals
(
projectId
))
{
...
...
middleware-automatic-center-son/src/main/java/com/zhiwei/middleware/automatic/son/task/aiTask/AbstractAiTaskService.java
View file @
f2a4ab0f
...
@@ -58,7 +58,7 @@ public abstract class AbstractAiTaskService implements AiTaskService {
...
@@ -58,7 +58,7 @@ public abstract class AbstractAiTaskService implements AiTaskService {
return
null
;
return
null
;
}
}
long
endTime
=
System
.
currentTimeMillis
()
-
now
;
long
endTime
=
System
.
currentTimeMillis
()
-
now
;
AiApiResult
aiRes
=
aiApiResultConversion
(
s
);
AiApiResult
aiRes
=
aiApiResultConversion
(
s
,
aiParam
);
if
(
Objects
.
isNull
(
aiRes
))
{
if
(
Objects
.
isNull
(
aiRes
))
{
requestResIncomplete
(
timeKey
);
requestResIncomplete
(
timeKey
);
log
.
info
(
"项目:{},数据url:{},耗时:{},ai接口返回信息不完整:{}"
,
aiInterfaceEnums
.
getProject
(),
param
.
getJSONObject
(
"data"
).
getString
(
GenericAttribute
.
URL
),
endTime
,
s
);
log
.
info
(
"项目:{},数据url:{},耗时:{},ai接口返回信息不完整:{}"
,
aiInterfaceEnums
.
getProject
(),
param
.
getJSONObject
(
"data"
).
getString
(
GenericAttribute
.
URL
),
endTime
,
s
);
...
@@ -86,7 +86,7 @@ public abstract class AbstractAiTaskService implements AiTaskService {
...
@@ -86,7 +86,7 @@ public abstract class AbstractAiTaskService implements AiTaskService {
protected
JSONObject
aiInterfaceParamBuild
(
AiInterfaceParam
aiParam
)
{
protected
JSONObject
aiInterfaceParamBuild
(
AiInterfaceParam
aiParam
)
{
JSONObject
param
=
new
JSONObject
();
JSONObject
param
=
new
JSONObject
();
param
.
put
(
"wait_for"
,
new
String
[]{
ai
InterfaceEnums
.
getWaitFor
()});
param
.
put
(
"wait_for"
,
new
String
[]{
ai
Param
.
getAiMark
().
getInterfaceRelation
()
.
getWaitFor
()});
JSONObject
data
=
new
JSONObject
();
JSONObject
data
=
new
JSONObject
();
JSONObject
json
=
aiParam
.
getJson
();
JSONObject
json
=
aiParam
.
getJson
();
data
.
put
(
"author"
,
json
.
getString
(
GenericAttribute
.
ES_SOURCE
));
data
.
put
(
"author"
,
json
.
getString
(
GenericAttribute
.
ES_SOURCE
));
...
@@ -134,34 +134,37 @@ public abstract class AbstractAiTaskService implements AiTaskService {
...
@@ -134,34 +134,37 @@ public abstract class AbstractAiTaskService implements AiTaskService {
}
}
@Override
@Override
public
AiApiResult
aiApiResultConversion
(
String
interfaceRes
)
{
public
AiApiResult
aiApiResultConversion
(
String
interfaceRes
,
AiInterfaceParam
aiParam
)
{
JSONObject
res
=
JSONObject
.
parseObject
(
interfaceRes
);
JSONObject
res
=
JSONObject
.
parseObject
(
interfaceRes
);
if
(
Objects
.
nonNull
(
res
))
{
if
(
Objects
.
isNull
(
res
))
{
JSONObject
waitRes
=
res
.
getJSONObject
(
aiInterfaceEnums
.
getWaitFor
());
return
null
;
if
(
Objects
.
nonNull
(
waitRes
))
{
}
JSONObject
result
=
waitRes
.
getJSONObject
(
"result"
);
JSONObject
waitRes
=
res
.
getJSONObject
(
aiParam
.
getAiMark
().
getInterfaceRelation
().
getWaitFor
());
if
(
Objects
.
nonNull
(
result
))
{
if
(
Objects
.
isNull
(
waitRes
))
{
aiApiResultTitleSubString
(
result
);
return
null
;
if
(
waitRes
.
getString
(
"status"
).
equals
(
"DONE"
)
||
(!
StringUtils
.
isEmpty
(
result
.
getString
(
"sent"
))
&&
StringUtils
.
isEmpty
(
"dedup"
)))
{
}
AiApiResult
aiRes
=
new
AiApiResult
();
JSONObject
result
=
waitRes
.
getJSONObject
(
"result"
);
aiRes
.
setId
(
waitRes
.
getString
(
"result_id"
));
if
(
Objects
.
isNull
(
result
))
{
aiRes
.
setCreateAt
(
System
.
currentTimeMillis
());
return
null
;
aiRes
.
setInfo_class
(
result
.
getString
(
"info_class"
));
}
aiRes
.
setNoise
(
result
.
getString
(
"denoise"
));
aiApiResultTitleSubString
(
result
);
aiRes
.
setSent
(
result
.
getString
(
"sent"
));
if
(
waitRes
.
getString
(
"status"
).
equals
(
"DONE"
)
||
(!
StringUtils
.
isEmpty
(
result
.
getString
(
"sent"
))
&&
StringUtils
.
isEmpty
(
"dedup"
)))
{
aiRes
.
setStatus
(
waitRes
.
getString
(
"status"
));
AiApiResult
aiRes
=
new
AiApiResult
();
aiRes
.
setNegLabel
(
result
.
getString
(
"neg_label"
));
aiRes
.
setId
(
waitRes
.
getString
(
"result_id"
));
aiRes
.
setResult
(
res
.
toJSONString
());
aiRes
.
setCreateAt
(
System
.
currentTimeMillis
());
aiRes
.
setProject
(
aiInterfaceEnums
.
getProject
());
aiRes
.
setInfo_class
(
result
.
getString
(
"info_class"
));
aiApiResultDao
.
insert
(
aiRes
);
aiRes
.
setNoise
(
result
.
getString
(
"denoise"
));
return
aiRes
;
aiRes
.
setSent
(
result
.
getString
(
"sent"
));
}
else
{
aiRes
.
setStatus
(
waitRes
.
getString
(
"status"
));
return
aiApiResultDao
.
findOne
(
new
Query
(
Criteria
.
where
(
"_id"
).
is
(
result
.
getString
(
"dedup"
))));
aiRes
.
setNegLabel
(
result
.
getString
(
"neg_label"
));
}
aiRes
.
setRelated
(
result
.
getString
(
"related"
));
}
aiRes
.
setResult
(
res
.
toJSONString
());
}
aiRes
.
setProject
(
aiInterfaceEnums
.
getProject
());
aiApiResultDao
.
insert
(
aiRes
);
return
aiRes
;
}
else
{
return
aiApiResultDao
.
findOne
(
new
Query
(
Criteria
.
where
(
"_id"
).
is
(
result
.
getString
(
"dedup"
))));
}
}
return
null
;
}
}
@Override
@Override
...
@@ -215,6 +218,9 @@ public abstract class AbstractAiTaskService implements AiTaskService {
...
@@ -215,6 +218,9 @@ public abstract class AbstractAiTaskService implements AiTaskService {
case
"neg_label"
:
case
"neg_label"
:
relateValue
=
result
.
getNegLabel
();
relateValue
=
result
.
getNegLabel
();
break
;
break
;
case
"related"
:
relateValue
=
result
.
getRelated
();
break
;
}
}
return
relateValue
;
return
relateValue
;
}
}
...
...
middleware-automatic-center-son/src/main/java/com/zhiwei/middleware/automatic/son/task/aiTask/AiTaskService.java
View file @
f2a4ab0f
...
@@ -39,7 +39,7 @@ public interface AiTaskService {
...
@@ -39,7 +39,7 @@ public interface AiTaskService {
* @param interfaceRes 接口返回值
* @param interfaceRes 接口返回值
* @return AiApiResult
* @return AiApiResult
*/
*/
AiApiResult
aiApiResultConversion
(
String
interfaceRes
);
AiApiResult
aiApiResultConversion
(
String
interfaceRes
,
AiInterfaceParam
aiParam
);
void
requestMarkTotalCount
(
String
timeKey
);
void
requestMarkTotalCount
(
String
timeKey
);
...
...
middleware-automatic-center-son/src/main/java/com/zhiwei/middleware/automatic/son/task/aiTask/AiTaskServiceJNKJ.java
0 → 100644
View file @
f2a4ab0f
package
com
.
zhiwei
.
middleware
.
automatic
.
son
.
task
.
aiTask
;
import
com.alibaba.fastjson.JSONObject
;
import
com.zhiwei.middleware.automatic.server.pojo.AiInterfaceParam
;
import
com.zhiwei.middleware.automatic.server.pojo.enums.AiInterfaceEnums
;
import
com.zhiwei.middleware.automatic.server.util.RedissonUtil
;
import
com.zhiwei.middleware.automatic.son.dao.AiApiResultDao
;
import
org.springframework.stereotype.Service
;
/**
* author:liu-yu
* date: 2024/7/10 16:43
**/
@Service
public
class
AiTaskServiceJNKJ
extends
AbstractAiTaskService
{
public
AiTaskServiceJNKJ
(
RedissonUtil
redissonUtil
,
AiApiResultDao
aiApiResultDao
)
{
super
(
AiInterfaceEnums
.
JIA_NAN_KE_JI
,
redissonUtil
,
aiApiResultDao
);
}
@Override
public
JSONObject
httpParamByMetadata
(
AiInterfaceParam
aiParam
)
{
return
null
;
}
}
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