Merge branch 'master' into docker_package

This commit is contained in:
wangliwen 2022-07-08 10:13:04 +08:00
commit 5a88770943
1 changed files with 12 additions and 6 deletions

View File

@ -45,10 +45,7 @@ import io.renren.modules.sys.dao.SysDeptDao;
import io.renren.modules.sys.dto.SysUserDTO;
import io.renren.modules.sys.service.SysDeptService;
import io.renren.modules.sys.service.SysUserService;
import okhttp3.FormBody;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;
import okhttp3.*;
import org.activiti.engine.HistoryService;
import org.activiti.engine.history.HistoricProcessInstance;
import org.activiti.engine.history.HistoricProcessInstanceQuery;
@ -85,6 +82,16 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
private static final Integer cpuNUm = Runtime.getRuntime().availableProcessors();
private static final ExecutorService executor = Executors.newWorkStealingPool(cpuNUm * 3);
/**
* 公共http客户端
*/
private static final OkHttpClient client = new OkHttpClient().newBuilder()
.connectTimeout(100, TimeUnit.MICROSECONDS)
.readTimeout(1, TimeUnit.MINUTES)
.connectionPool(new ConnectionPool(cpuNUm * 2, 2, TimeUnit.MINUTES))
.retryOnConnectionFailure(false)
.build();
private static final Logger logger = LoggerFactory.getLogger(ResourceServiceImpl.class);
private static final String selectDeptListKey = "selectDeptList";
@ -993,8 +1000,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
@CacheEvict(cacheNames = {selectDeptListKey, selectDTOPageSpecilTotalKey}, allEntries = true)
public void KnowledgeBase() {
final List<String> knowledgeUUID = jdbcTemplate.queryForList("SELECT note1 FROM tb_data_resource WHERE type ='知识库' AND note1 IS NOT NULL FOR UPDATE;", String.class).stream().distinct().collect(Collectors.toList());
final int pageSize = 100;
final OkHttpClient client = new OkHttpClient();
final int pageSize = cpuNUm * 10;
Arrays.stream(catalogIds).map(index -> {
logger.info("处理:" + index);
CopyOnWriteArrayList<CompletableFuture> task = new CopyOnWriteArrayList<>();