|
@@ -56,6 +56,7 @@ public class YoumeiDataServiceImpl extends ServiceImpl<YoumeiDataMapper, YoumeiD
|
|
|
@Resource
|
|
|
private EsClientPool esClientPool;
|
|
|
|
|
|
+ private Boolean lock = false;
|
|
|
|
|
|
public Page<YoumeiEsData> search(DataRequestDTO dataRequestDTO) throws Exception {
|
|
|
|
|
@@ -145,8 +146,12 @@ public class YoumeiDataServiceImpl extends ServiceImpl<YoumeiDataMapper, YoumeiD
|
|
|
(new Thread(this::putData)).start();
|
|
|
}
|
|
|
|
|
|
- public void putData() {
|
|
|
|
|
|
+ public void putData() {
|
|
|
+ if(lock){
|
|
|
+ throw new BizException(40000,"正在执行,请勿重复执行");
|
|
|
+ }
|
|
|
+ lock = true;
|
|
|
log.info("ES 入数据开始");
|
|
|
YoumeiOffset youmeiOffset = youmeiOffsetService.getById(4);
|
|
|
long offset = youmeiOffset.getOffset() + 1L;
|
|
@@ -181,6 +186,7 @@ public class YoumeiDataServiceImpl extends ServiceImpl<YoumeiDataMapper, YoumeiD
|
|
|
e.printStackTrace();
|
|
|
logger.error("error", e);
|
|
|
}finally {
|
|
|
+ lock = false;
|
|
|
if (null != elasticsearchClient){
|
|
|
esClientPool.returnClient(elasticsearchClient);
|
|
|
}
|