Merge branch 'master' into docker_package
This commit is contained in:
commit
cc4049e777
|
@ -1224,64 +1224,65 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
|||
if (list.isEmpty() || list.size() < pageSize) {
|
||||
end.set(false);
|
||||
}
|
||||
customThreadPool.submit(() -> {
|
||||
list.parallelStream().filter(resource -> {
|
||||
Map<String, Object> map = (Map<String, Object>) resource;
|
||||
return !knowledgeUUID.contains(map.get("uuid").toString());
|
||||
}).forEach(resource -> {
|
||||
Map<String, Object> map = (Map<String, Object>) resource;
|
||||
ResourceDTO dto = new ResourceDTO();
|
||||
dto.setName(map.get("title").toString());
|
||||
dto.setType("知识库");
|
||||
dto.setVisits(0L);
|
||||
//所属部门暂时设为青岛市政府办公厅
|
||||
dto.setDeptId(1517116100113850370L);
|
||||
dto.setNote1(map.get("uuid").toString());
|
||||
dto.setDelFlag(0);
|
||||
ArrayList<AttrEntity> infoList = new ArrayList<>();
|
||||
map.forEach((key, value) -> {
|
||||
switch (key) {
|
||||
case "title":
|
||||
dto.setName(value.toString());
|
||||
break;
|
||||
case "url":
|
||||
dto.setLink(value.toString());
|
||||
break;
|
||||
case "createtime":
|
||||
Date createDate = new Date(Long.parseLong(value.toString()));
|
||||
dto.setCreateDate(createDate);
|
||||
break;
|
||||
default:
|
||||
AttrEntity attrEntity = new AttrEntity();
|
||||
attrEntity.setDelFlag(0);
|
||||
attrEntity.setAttrType(key);
|
||||
attrEntity.setAttrValue(value.toString());
|
||||
infoList.add(attrEntity);
|
||||
break;
|
||||
}
|
||||
});
|
||||
AttrEntity attrEntity = new AttrEntity();
|
||||
attrEntity.setDelFlag(0);
|
||||
attrEntity.setAttrType("文件类型");
|
||||
if ("f49561afc7204f008c4bb3cd821eb6ba".equals(index)) {
|
||||
attrEntity.setAttrValue("政府公报");
|
||||
} else {
|
||||
attrEntity.setAttrValue("政策解读");
|
||||
customThreadPool.submit(() -> list.parallelStream().filter(resource -> {
|
||||
Map<String, Object> map = (Map<String, Object>) resource;
|
||||
return !knowledgeUUID.contains(map.get("uuid").toString());
|
||||
}).forEach(resource -> {
|
||||
Map<String, Object> map = (Map<String, Object>) resource;
|
||||
ResourceDTO dto = new ResourceDTO();
|
||||
dto.setName(map.get("title").toString());
|
||||
dto.setType("知识库");
|
||||
dto.setVisits(0L);
|
||||
//所属部门暂时设为青岛市政府办公厅
|
||||
dto.setDeptId(1517116100113850370L);
|
||||
dto.setNote1(map.get("uuid").toString());
|
||||
dto.setDelFlag(0);
|
||||
ArrayList<AttrEntity> infoList = new ArrayList<>();
|
||||
map.forEach((key, value) -> {
|
||||
switch (key) {
|
||||
case "title":
|
||||
dto.setName(value.toString());
|
||||
break;
|
||||
case "url":
|
||||
dto.setLink(value.toString());
|
||||
break;
|
||||
case "createtime":
|
||||
Date createDate = new Date(Long.parseLong(value.toString()));
|
||||
dto.setCreateDate(createDate);
|
||||
break;
|
||||
default:
|
||||
AttrEntity attrEntity = new AttrEntity();
|
||||
attrEntity.setDelFlag(0);
|
||||
attrEntity.setAttrType(key);
|
||||
attrEntity.setAttrValue(value.toString());
|
||||
infoList.add(attrEntity);
|
||||
break;
|
||||
}
|
||||
infoList.add(attrEntity);
|
||||
dto.setInfoList(infoList);
|
||||
this.insertWithAttrs(dto);
|
||||
logger.info("插入:{}", dto.getName());
|
||||
});
|
||||
}).join();
|
||||
AttrEntity attrEntity = new AttrEntity();
|
||||
attrEntity.setDelFlag(0);
|
||||
attrEntity.setAttrType("文件类型");
|
||||
if ("f49561afc7204f008c4bb3cd821eb6ba".equals(index)) {
|
||||
attrEntity.setAttrValue("政府公报");
|
||||
} else {
|
||||
attrEntity.setAttrValue("政策解读");
|
||||
}
|
||||
infoList.add(attrEntity);
|
||||
dto.setInfoList(infoList);
|
||||
this.insertWithAttrs(dto);
|
||||
logger.info("插入:{}", dto.getName());
|
||||
})).join();
|
||||
customThreadPool.shutdown();
|
||||
}, executor));
|
||||
try {
|
||||
Thread.sleep(100L); // 防止任务运行过快,无法跳出循环
|
||||
} catch (InterruptedException e) {
|
||||
logger.info("知识库同步异常", e);
|
||||
// throw new RuntimeException(e);
|
||||
|
||||
if (maxPage.get() == 100) {
|
||||
try {
|
||||
Thread.sleep(new Random().nextInt(100)); // 防止任务运行过快,无法跳出循环
|
||||
} catch (InterruptedException e) {
|
||||
logger.info("知识库同步异常", e);
|
||||
}
|
||||
}
|
||||
|
||||
} while (end.get() || pageIndex.get() < maxPage.get());
|
||||
return task;
|
||||
}).collect(Collectors.toList());
|
||||
|
|
Loading…
Reference in New Issue