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
bad35d6f
Commit
bad35d6f
authored
May 17, 2023
by
liuyu
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'release' into 'master'
Release See merge request
!35
parents
9d469c5a
cd18f210
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
121 additions
and
32 deletions
+121
-32
middleware-automatic-center-client/src/main/java/com/zhiwei/middleware/automatic/server/common/GenericAttribute.java
+2
-0
middleware-automatic-center-client/src/main/java/com/zhiwei/middleware/automatic/server/pojo/TemplateTitleVo.java
+21
-4
middleware-automatic-center-client/src/main/java/com/zhiwei/middleware/automatic/server/util/RedissonUtil.java
+10
-0
middleware-automatic-center-son/src/main/java/com/zhiwei/middleware/automatic/son/service/TemplateTitleService.java
+18
-3
middleware-automatic-center-son/src/main/java/com/zhiwei/middleware/automatic/son/service/impl/TemplateTitleServiceImpl.java
+48
-19
middleware-automatic-center-son/src/main/java/com/zhiwei/middleware/automatic/son/task/service/TaskServiceCommon.java
+16
-1
middleware-automatic-center-son/src/main/java/com/zhiwei/middleware/automatic/son/task/service/TaskServiceTemplate.java
+6
-5
No files found.
middleware-automatic-center-client/src/main/java/com/zhiwei/middleware/automatic/server/common/GenericAttribute.java
View file @
bad35d6f
...
@@ -45,6 +45,8 @@ public class GenericAttribute {
...
@@ -45,6 +45,8 @@ public class GenericAttribute {
public
static
final
String
KEY
=
"task"
;
public
static
final
String
KEY
=
"task"
;
public
static
final
String
LOCK
=
"lock"
;
public
static
final
String
RUNNING
=
"running"
;
public
static
final
String
RUNNING
=
"running"
;
public
static
final
String
URL
=
"url"
;
public
static
final
String
URL
=
"url"
;
...
...
middleware-automatic-center-client/src/main/java/com/zhiwei/middleware/automatic/server/pojo/TemplateTitleVo.java
View file @
bad35d6f
...
@@ -15,7 +15,8 @@ public class TemplateTitleVo implements Serializable {
...
@@ -15,7 +15,8 @@ public class TemplateTitleVo implements Serializable {
private
String
templateTitle
;
private
String
templateTitle
;
private
Date
updateTime
;
private
Date
updateTime
;
private
Date
createTime
;
private
Date
createTime
;
private
Long
markSum
;
private
long
markSum
;
private
long
daySum
;
private
String
mtag
;
private
String
mtag
;
private
String
url
;
private
String
url
;
private
TemplateStatus
status
;
private
TemplateStatus
status
;
...
@@ -65,14 +66,22 @@ public class TemplateTitleVo implements Serializable {
...
@@ -65,14 +66,22 @@ public class TemplateTitleVo implements Serializable {
this
.
createTime
=
createTime
;
this
.
createTime
=
createTime
;
}
}
public
L
ong
getMarkSum
()
{
public
l
ong
getMarkSum
()
{
return
markSum
;
return
markSum
;
}
}
public
void
setMarkSum
(
L
ong
markSum
)
{
public
void
setMarkSum
(
l
ong
markSum
)
{
this
.
markSum
=
markSum
;
this
.
markSum
=
markSum
;
}
}
public
long
getDaySum
()
{
return
daySum
;
}
public
void
setDaySum
(
long
daySum
)
{
this
.
daySum
=
daySum
;
}
public
String
getMtag
()
{
public
String
getMtag
()
{
return
mtag
;
return
mtag
;
}
}
...
@@ -103,14 +112,22 @@ public class TemplateTitleVo implements Serializable {
...
@@ -103,14 +112,22 @@ public class TemplateTitleVo implements Serializable {
this
.
createTime
=
new
Date
();
this
.
createTime
=
new
Date
();
this
.
templateTitle
=
templateTitle
;
this
.
templateTitle
=
templateTitle
;
this
.
markSum
=
0L
;
this
.
markSum
=
0L
;
this
.
daySum
=
0L
;
this
.
mtag
=
mtag
;
this
.
mtag
=
mtag
;
this
.
url
=
url
;
this
.
url
=
url
;
this
.
status
=
TemplateStatus
.
运行中
;
this
.
status
=
TemplateStatus
.
运行中
;
}
}
public
TemplateTitleVo
()
{}
public
TemplateTitleVo
()
{
}
public
void
refreshMark
()
{
public
void
refreshMark
()
{
this
.
updateTime
=
new
Date
();
this
.
updateTime
=
new
Date
();
this
.
daySum
++;
}
public
void
accSum
(
long
markSum
,
long
daySum
)
{
this
.
markSum
=
markSum
+
this
.
daySum
;
this
.
daySum
+=
daySum
;
}
}
}
}
middleware-automatic-center-client/src/main/java/com/zhiwei/middleware/automatic/server/util/RedissonUtil.java
View file @
bad35d6f
...
@@ -53,6 +53,16 @@ public class RedissonUtil {
...
@@ -53,6 +53,16 @@ public class RedissonUtil {
bucket
.
delete
();
bucket
.
delete
();
}
}
public
void
unlock
(
String
lockKey
)
{
RLock
lock
=
redissonClient
.
getLock
(
lockKey
);
lock
.
forceUnlock
();
}
public
boolean
tryLock
(
String
lockKey
,
long
waitTime
,
int
leaseTime
)
throws
InterruptedException
{
RLock
lock
=
redissonClient
.
getLock
(
lockKey
);
return
lock
.
tryLock
(
waitTime
,
leaseTime
,
TimeUnit
.
SECONDS
);
}
public
void
putCount
(
String
key
,
long
count
)
{
public
void
putCount
(
String
key
,
long
count
)
{
RAtomicLong
atomicLong
=
redissonClient
.
getAtomicLong
(
redisKey
(
key
));
RAtomicLong
atomicLong
=
redissonClient
.
getAtomicLong
(
redisKey
(
key
));
atomicLong
.
addAndGet
(
count
);
atomicLong
.
addAndGet
(
count
);
...
...
middleware-automatic-center-son/src/main/java/com/zhiwei/middleware/automatic/son/service/TemplateTitleService.java
View file @
bad35d6f
...
@@ -19,10 +19,9 @@ public interface TemplateTitleService {
...
@@ -19,10 +19,9 @@ public interface TemplateTitleService {
/**
/**
* 添加项目文本模板
* 添加项目文本模板
* @param project 项目
* @param project 项目
* @param vos 模板集
* @param vo 模板
* @return 模板集数量
*/
*/
void
setTemplateTitleByProject
(
String
project
,
Map
<
String
,
TemplateTitleVo
>
vos
);
void
setTemplateTitleByProject
(
String
project
,
TemplateTitleVo
vo
);
/**
/**
* 修正模板标题的markTag 如果不存在就会增加
* 修正模板标题的markTag 如果不存在就会增加
...
@@ -46,4 +45,20 @@ public interface TemplateTitleService {
...
@@ -46,4 +45,20 @@ public interface TemplateTitleService {
* @return 是否成功
* @return 是否成功
*/
*/
boolean
resetTemplate
(
String
group
,
String
templateTitle
);
boolean
resetTemplate
(
String
group
,
String
templateTitle
);
/**
* 替换模板
* @param group 项目
* @param title title
* @param templateTitleVo 模板
*/
void
setTemplateValue
(
String
group
,
String
title
,
TemplateTitleVo
templateTitleVo
);
/**
* 替换模板标签
* @param group 项目
* @param title title
* @param fixTag 标签
*/
void
setTemplateValue
(
String
group
,
String
title
,
String
fixTag
);
}
}
middleware-automatic-center-son/src/main/java/com/zhiwei/middleware/automatic/son/service/impl/TemplateTitleServiceImpl.java
View file @
bad35d6f
...
@@ -30,6 +30,7 @@ import org.springframework.stereotype.Service;
...
@@ -30,6 +30,7 @@ import org.springframework.stereotype.Service;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.util.*
;
import
java.util.*
;
import
java.util.concurrent.TimeUnit
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
@Service
@Service
...
@@ -75,11 +76,9 @@ public class TemplateTitleServiceImpl implements TemplateTitleService {
...
@@ -75,11 +76,9 @@ public class TemplateTitleServiceImpl implements TemplateTitleService {
}
}
@Override
@Override
public
synchronized
void
setTemplateTitleByProject
(
String
project
,
Map
<
String
,
TemplateTitleVo
>
vos
)
{
public
void
setTemplateTitleByProject
(
String
project
,
TemplateTitleVo
vo
)
{
String
key
=
Tools
.
assembleKey
(
GenericAttribute
.
REDIS_MAP_KEY
,
project
);
String
key
=
Tools
.
assembleKey
(
GenericAttribute
.
REDIS_MAP_KEY
,
project
);
for
(
Map
.
Entry
<
String
,
TemplateTitleVo
>
entry
:
vos
.
entrySet
())
{
redissonUtil
.
setMapValue
(
key
,
vo
.
getTemplateTitle
(),
JSONObject
.
toJSONString
(
vo
));
redissonUtil
.
setMapValue
(
key
,
entry
.
getKey
(),
JSONObject
.
toJSONString
(
entry
.
getValue
()));
}
}
}
@Override
@Override
...
@@ -87,17 +86,7 @@ public class TemplateTitleServiceImpl implements TemplateTitleService {
...
@@ -87,17 +86,7 @@ public class TemplateTitleServiceImpl implements TemplateTitleService {
try
{
try
{
// 防止增加模板标题有带符号的问题
// 防止增加模板标题有带符号的问题
templateTitle
=
Tools
.
filterSymbol
(
templateTitle
);
templateTitle
=
Tools
.
filterSymbol
(
templateTitle
);
String
key
=
Tools
.
assembleKey
(
GenericAttribute
.
REDIS_MAP_KEY
,
group
);
setTemplateValue
(
group
,
templateTitle
,
fixTag
);
String
mapKeyValue
=
redissonUtil
.
getMapKeyValue
(
key
,
templateTitle
);
if
(
Tools
.
isEmpty
(
mapKeyValue
))
{
return
false
;
}
TemplateTitleVo
titleVo
=
JSONObject
.
parseObject
(
mapKeyValue
,
TemplateTitleVo
.
class
);
String
oldTag
=
titleVo
.
getMtag
();
titleVo
.
setMtag
(
fixTag
);
redissonUtil
.
setMapValue
(
key
,
templateTitle
,
JSONObject
.
toJSONString
(
titleVo
));
log
.
info
(
"修改模板标签成功: group:{} templateTitle:{} oldTag:{} fixTag:{}"
,
group
,
templateTitle
,
oldTag
,
fixTag
);
return
true
;
return
true
;
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
...
@@ -110,9 +99,9 @@ public class TemplateTitleServiceImpl implements TemplateTitleService {
...
@@ -110,9 +99,9 @@ public class TemplateTitleServiceImpl implements TemplateTitleService {
}
}
@Override
@Override
public
boolean
resetTemplate
(
String
group
,
String
t
emplateT
itle
)
{
public
boolean
resetTemplate
(
String
group
,
String
title
)
{
// 防止增加模板标题有带符号的问题
// 防止增加模板标题有带符号的问题
templateTitle
=
Tools
.
filterSymbol
(
templateT
itle
);
String
templateTitle
=
Tools
.
filterSymbol
(
t
itle
);
Map
<
String
,
TemplateTitleVo
>
map
=
getTemplateTitleByProject
(
group
);
Map
<
String
,
TemplateTitleVo
>
map
=
getTemplateTitleByProject
(
group
);
if
(
Objects
.
isNull
(
map
.
get
(
templateTitle
)))
{
if
(
Objects
.
isNull
(
map
.
get
(
templateTitle
)))
{
return
false
;
return
false
;
...
@@ -121,7 +110,7 @@ public class TemplateTitleServiceImpl implements TemplateTitleService {
...
@@ -121,7 +110,7 @@ public class TemplateTitleServiceImpl implements TemplateTitleService {
// 只要在运行中的模板 才能重置
// 只要在运行中的模板 才能重置
if
(
Objects
.
isNull
(
templateTitleVo
.
getStatus
())
||
templateTitleVo
.
getStatus
().
name
().
equals
(
TemplateStatus
.
运行中
.
name
()))
{
if
(
Objects
.
isNull
(
templateTitleVo
.
getStatus
())
||
templateTitleVo
.
getStatus
().
name
().
equals
(
TemplateStatus
.
运行中
.
name
()))
{
templateTitleVo
.
setStatus
(
TemplateStatus
.
重置中
);
templateTitleVo
.
setStatus
(
TemplateStatus
.
重置中
);
setTemplate
TitleByProject
(
group
,
map
);
setTemplate
Value
(
group
,
templateTitle
,
templateTitleVo
);
// 修改模板的标注信息
// 修改模板的标注信息
executor
.
execute
(()
->
{
executor
.
execute
(()
->
{
try
{
try
{
...
@@ -132,7 +121,7 @@ public class TemplateTitleServiceImpl implements TemplateTitleService {
...
@@ -132,7 +121,7 @@ public class TemplateTitleServiceImpl implements TemplateTitleService {
templateTitleVo
.
setStatus
(
TemplateStatus
.
重置失败
);
templateTitleVo
.
setStatus
(
TemplateStatus
.
重置失败
);
log
.
error
(
"重置模板:修改聚和集错误,title:{},以加入重试队列"
,
templateTitleVo
.
getTemplateTitle
());
log
.
error
(
"重置模板:修改聚和集错误,title:{},以加入重试队列"
,
templateTitleVo
.
getTemplateTitle
());
}
finally
{
}
finally
{
setTemplate
TitleByProject
(
group
,
map
);
setTemplate
Value
(
group
,
templateTitle
,
templateTitleVo
);
}
}
});
});
return
true
;
return
true
;
...
@@ -140,6 +129,46 @@ public class TemplateTitleServiceImpl implements TemplateTitleService {
...
@@ -140,6 +129,46 @@ public class TemplateTitleServiceImpl implements TemplateTitleService {
return
false
;
return
false
;
}
}
@Override
public
void
setTemplateValue
(
String
group
,
String
title
,
TemplateTitleVo
templateTitleVo
)
{
setTemplateValue
(
group
,
title
,
templateTitleVo
,
null
);
}
@Override
public
void
setTemplateValue
(
String
group
,
String
title
,
String
fixTag
)
{
setTemplateValue
(
group
,
title
,
null
,
fixTag
);
}
private
void
setTemplateValue
(
String
group
,
String
title
,
TemplateTitleVo
templateTitleVo
,
String
fixTag
)
{
String
lockKey
=
Tools
.
assembleKey
(
GenericAttribute
.
LOCK
,
title
);
try
{
if
(
redissonUtil
.
tryLock
(
lockKey
,
5
,
5
))
{
String
mapKey
=
Tools
.
assembleKey
(
GenericAttribute
.
REDIS_MAP_KEY
,
group
);
String
mapKeyValue
=
redissonUtil
.
getMapKeyValue
(
mapKey
,
title
);
TemplateTitleVo
titleVo
=
JSONObject
.
parseObject
(
mapKeyValue
,
TemplateTitleVo
.
class
);
if
(
Objects
.
isNull
(
titleVo
))
{
return
;
}
if
(
Objects
.
isNull
(
templateTitleVo
))
{
templateTitleVo
=
titleVo
;
}
if
(
Objects
.
isNull
(
fixTag
))
{
templateTitleVo
.
accSum
(
titleVo
.
getMarkSum
(),
titleVo
.
getDaySum
());
}
else
{
String
oldTag
=
templateTitleVo
.
getMtag
();
templateTitleVo
.
setMtag
(
fixTag
);
log
.
info
(
"修改模板标签成功: group:{} templateTitle:{} oldTag:{} fixTag:{}"
,
group
,
title
,
oldTag
,
fixTag
);
}
redissonUtil
.
setMapValue
(
mapKey
,
title
,
JSONObject
.
toJSONString
(
templateTitleVo
));
}
}
catch
(
Exception
e
)
{
log
.
error
(
"修改模板失败,项目:{},title:{}"
,
group
,
title
,
e
);
}
finally
{
redissonUtil
.
unlock
(
lockKey
);
}
}
/**
/**
* 模板自动标注的历史数据修改为新标签
* 模板自动标注的历史数据修改为新标签
* @param templateTitleVo 模板
* @param templateTitleVo 模板
...
...
middleware-automatic-center-son/src/main/java/com/zhiwei/middleware/automatic/son/task/service/TaskServiceCommon.java
View file @
bad35d6f
...
@@ -159,6 +159,7 @@ public class TaskServiceCommon extends BaseTaskTypePair<TaskServiceCommon.TaskCo
...
@@ -159,6 +159,7 @@ public class TaskServiceCommon extends BaseTaskTypePair<TaskServiceCommon.TaskCo
for
(
Map
.
Entry
<
String
,
List
<
MarkInfo
>>
entry
:
groupMap
.
entrySet
())
{
for
(
Map
.
Entry
<
String
,
List
<
MarkInfo
>>
entry
:
groupMap
.
entrySet
())
{
try
{
try
{
Map
<
String
,
TemplateTitleVo
>
template
=
templateTitleService
.
getTemplateTitleByProject
(
entry
.
getKey
());
Map
<
String
,
TemplateTitleVo
>
template
=
templateTitleService
.
getTemplateTitleByProject
(
entry
.
getKey
());
clearTemplateDaySum
(
template
);
asyncTitleMark
(
entry
.
getKey
(),
entry
.
getValue
(),
template
);
asyncTitleMark
(
entry
.
getKey
(),
entry
.
getValue
(),
template
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
error
(
"自动标注处理失败,项目:{}"
,
entry
.
getKey
(),
e
);
log
.
error
(
"自动标注处理失败,项目:{}"
,
entry
.
getKey
(),
e
);
...
@@ -166,6 +167,12 @@ public class TaskServiceCommon extends BaseTaskTypePair<TaskServiceCommon.TaskCo
...
@@ -166,6 +167,12 @@ public class TaskServiceCommon extends BaseTaskTypePair<TaskServiceCommon.TaskCo
}
}
}
}
private
void
clearTemplateDaySum
(
Map
<
String
,
TemplateTitleVo
>
template
)
{
for
(
Map
.
Entry
<
String
,
TemplateTitleVo
>
entry
:
template
.
entrySet
())
{
entry
.
getValue
().
setDaySum
(
0L
);
}
}
/**
/**
* 异步等待
* 异步等待
* @param group 项目
* @param group 项目
...
@@ -195,6 +202,14 @@ public class TaskServiceCommon extends BaseTaskTypePair<TaskServiceCommon.TaskCo
...
@@ -195,6 +202,14 @@ public class TaskServiceCommon extends BaseTaskTypePair<TaskServiceCommon.TaskCo
String
title
=
Tools
.
filterSymbol
(
markInfo
.
getSourceObj
().
getString
(
GenericAttribute
.
ES_TITLE
));
String
title
=
Tools
.
filterSymbol
(
markInfo
.
getSourceObj
().
getString
(
GenericAttribute
.
ES_TITLE
));
return
null
!=
title
&&
title
.
length
()
>
6
;
return
null
!=
title
&&
title
.
length
()
>
6
;
}).
filter
(
e
->
autoMark
(
group
,
e
,
titleVoMap
)).
collect
(
Collectors
.
toList
());
}).
filter
(
e
->
autoMark
(
group
,
e
,
titleVoMap
)).
collect
(
Collectors
.
toList
());
// 模板更新
for
(
Map
.
Entry
<
String
,
TemplateTitleVo
>
entry
:
titleVoMap
.
entrySet
())
{
if
(
entry
.
getValue
().
getDaySum
()
==
0
)
{
continue
;
}
templateTitleService
.
setTemplateValue
(
group
,
entry
.
getKey
(),
entry
.
getValue
());
}
// 自动标注数据发送到标注中间件
// dubboHandler.markUpsert(newList);
// dubboHandler.markUpsert(newList);
}
}
...
@@ -220,7 +235,7 @@ public class TaskServiceCommon extends BaseTaskTypePair<TaskServiceCommon.TaskCo
...
@@ -220,7 +235,7 @@ public class TaskServiceCommon extends BaseTaskTypePair<TaskServiceCommon.TaskCo
// 特征值记录
// 特征值记录
templateTitleService
.
insertTemplateRecord
(
new
TemplateRecord
(
templateTitleVo
.
getId
(),
updates
[
0
]));
templateTitleService
.
insertTemplateRecord
(
new
TemplateRecord
(
templateTitleVo
.
getId
(),
updates
[
0
]));
// 模板标注count累加
// 模板标注count累加
redissonUtil
.
putCount
(
Tools
.
assembleKey
(
COUNT_KEY
,
group
,
templateTitleVo
.
getId
()),
1
);
//
redissonUtil.putCount(Tools.assembleKey(COUNT_KEY, group, templateTitleVo.getId()), 1);
// 测试环境临时添加,用于对比
// 测试环境临时添加,用于对比
templateRecordDao
.
tempRecord
(
new
TemplateTempRecord
(
templateTitleVo
.
getId
(),
templateTitleVo
.
getTemplateTitle
(),
group
,
getUrl
(
markInfo
),
templateRecordDao
.
tempRecord
(
new
TemplateTempRecord
(
templateTitleVo
.
getId
(),
templateTitleVo
.
getTemplateTitle
(),
group
,
getUrl
(
markInfo
),
sourceObj
.
getString
(
"_id"
),
templateTitleVo
.
getMtag
()));
sourceObj
.
getString
(
"_id"
),
templateTitleVo
.
getMtag
()));
...
...
middleware-automatic-center-son/src/main/java/com/zhiwei/middleware/automatic/son/task/service/TaskServiceTemplate.java
View file @
bad35d6f
...
@@ -195,7 +195,7 @@ public class TaskServiceTemplate extends BaseTaskTypePair<TaskServiceTemplate.Ta
...
@@ -195,7 +195,7 @@ public class TaskServiceTemplate extends BaseTaskTypePair<TaskServiceTemplate.Ta
return
true
;
return
true
;
}).
collect
(
Collectors
.
toMap
(
Map
.
Entry
::
getKey
,
Map
.
Entry
::
getValue
));
}).
collect
(
Collectors
.
toMap
(
Map
.
Entry
::
getKey
,
Map
.
Entry
::
getValue
));
// 新旧模板合并 且更新模板
// 新旧模板合并 且更新模板
templateTitleService
.
setTemplateTitleByProject
(
group
,
mergeTemplate
(
aggregation
,
templateTitleByProject
)
);
mergeTemplate
(
group
,
aggregation
,
templateTitleByProject
);
}
}
/**
/**
...
@@ -229,22 +229,23 @@ public class TaskServiceTemplate extends BaseTaskTypePair<TaskServiceTemplate.Ta
...
@@ -229,22 +229,23 @@ public class TaskServiceTemplate extends BaseTaskTypePair<TaskServiceTemplate.Ta
* @param oldTemplate 旧模板
* @param oldTemplate 旧模板
* @param newTemplate 新模板
* @param newTemplate 新模板
*/
*/
private
Map
<
String
,
TemplateTitleVo
>
mergeTemplate
(
Map
<
String
,
TemplateTitleVo
>
oldTemplate
,
Map
<
String
,
TemplateTitleVo
>
newTemplate
)
{
private
void
mergeTemplate
(
String
group
,
Map
<
String
,
TemplateTitleVo
>
oldTemplate
,
Map
<
String
,
TemplateTitleVo
>
newTemplate
)
{
for
(
Map
.
Entry
<
String
,
TemplateTitleVo
>
newEntry
:
newTemplate
.
entrySet
())
{
for
(
Map
.
Entry
<
String
,
TemplateTitleVo
>
newEntry
:
newTemplate
.
entrySet
())
{
List
<
String
>
templateKeys
=
oldTemplate
.
keySet
().
stream
()
List
<
String
>
templateKeys
=
oldTemplate
.
keySet
().
stream
()
.
filter
(
e
->
CosineSimilarity
.
calculateTextSimWithBrand
(
newEntry
.
getKey
(),
e
)
>=
0.96
)
.
filter
(
e
->
CosineSimilarity
.
calculateTextSimWithBrand
(
newEntry
.
getKey
(),
e
)
>=
0.96
)
.
collect
(
Collectors
.
toList
());
.
collect
(
Collectors
.
toList
());
// 添加模板
// 添加模板
if
(
templateKeys
.
isEmpty
())
{
if
(
templateKeys
.
isEmpty
())
{
oldTemplate
.
put
(
newEntry
.
getKey
()
,
newEntry
.
getValue
());
templateTitleService
.
setTemplateTitleByProject
(
group
,
newEntry
.
getValue
());
}
else
{
}
else
{
// 更新标签
// 更新标签
for
(
String
oldKey
:
templateKeys
)
{
for
(
String
oldKey
:
templateKeys
)
{
oldTemplate
.
get
(
oldKey
).
setMtag
(
newEntry
.
getValue
().
getMtag
());
TemplateTitleVo
templateTitleVo
=
oldTemplate
.
get
(
oldKey
);
templateTitleVo
.
setMtag
(
newEntry
.
getValue
().
getMtag
());
templateTitleService
.
setTemplateValue
(
group
,
oldKey
,
templateTitleVo
);
}
}
}
}
}
}
return
oldTemplate
;
}
}
/**
/**
...
...
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