修改线程池参数

master
bynt 7 months ago
parent b5acdf1c3e
commit 9779c27de4

@ -12,5 +12,11 @@ public class SystemConstant {
*/
public static final String PARSE_DATA_LINK = "http://localhost:9191/data/analysis/tag";
/**
*
*/
public static final String SUCCESS = "success";
}

@ -9,7 +9,7 @@ import org.springframework.stereotype.Component;
@Generated(
value = "org.mapstruct.ap.MappingProcessor",
date = "2023-12-26T11:47:03+0800",
date = "2023-12-28T11:13:16+0800",
comments = "version: 1.3.1.Final, compiler: javac, environment: Java 1.8.0_251 (Oracle Corporation)"
)
@Component

@ -9,7 +9,7 @@ import org.springframework.stereotype.Component;
@Generated(
value = "org.mapstruct.ap.MappingProcessor",
date = "2023-12-26T11:47:03+0800",
date = "2023-12-28T11:13:16+0800",
comments = "version: 1.3.1.Final, compiler: javac, environment: Java 1.8.0_251 (Oracle Corporation)"
)
@Component

@ -50,7 +50,7 @@ public class ThreadPoolConfig {
return threadPoolExecutor;
}
@Bean("workExecutor")
@Bean("WorkExecutor")
public Executor getExecutor() {
return new ThreadPoolExecutor(10, Integer.MAX_VALUE,
DefaultConstant.THREE_NUMBER, TimeUnit.MINUTES,

@ -93,7 +93,7 @@ public class SendCallSourceTask {
}
@Scheduled(cron = "0 0 0 * * ?")
/*@Scheduled(cron = "0 0 0 * * ?")*/
public void getToken() {
List<CallAccount> list = callAccountRepository.findAllByStatus(1);
for (CallAccount account : list) {

@ -20,6 +20,7 @@ import com.jcraft.jsch.Session;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import me.zhengjie.config.thread.ThreadPoolConfig;
import me.zhengjie.constant.SystemConstant;
import me.zhengjie.exception.BadRequestException;
import me.zhengjie.modules.constant.DefaultConstant;
import me.zhengjie.modules.constant.FileConstant;
@ -180,11 +181,11 @@ public class SaveToFileNewTask {
? TxtUtils.txtParseListVyUrl(filePath) :
fileFormat.contains(FileConstant.CSV_FILE_SUB_NAME)
? ToolExcelUtils.csvParseListByUrl(filePath)
: ToolExcelUtils.excelParseListByUrl(filePath);
: ToolExcelUtils.excelParseListByUrl(filePath);
Map<Integer, List<String>> preEncryptNumMap = listT.stream().filter
(phone -> StringUtils.isNotBlank(phone.trim())).collect(Collectors.groupingBy(String::length));
if (CollectionUtil.isNotEmpty(preEncryptNumMap)) {
// 分批调用接口进行
// 分批调用接口进行
if (tbUploadFileNewDto.getEncryptionType() == DefaultConstant.TWO_NUMBER) {
List<String> decryptionList = preEncryptNumMap.get(2 << 4);
if (CollUtil.isNotEmpty(decryptionList)) {
@ -193,7 +194,7 @@ public class SaveToFileNewTask {
// 替换集合并去除空格
phoneList = stringList.stream().filter
(StringUtils::isNotBlank).collect(Collectors.toList());
log.info("============ the phone list as {} ============",phoneList.size());
log.info("============ the phone list as {} ============", phoneList.size());
}
}
}
@ -243,7 +244,7 @@ public class SaveToFileNewTask {
int batchNum = partition.size();
stopWatch.start();
for (List<String> list : partition) {
TimeUnit.MILLISECONDS.sleep(300L);
TimeUnit.MILLISECONDS.sleep(1000L);
// 异步线程池
CompletableFuture<List<String>> future = CompletableFuture.supplyAsync(() -> {
// 转换
@ -252,17 +253,20 @@ public class SaveToFileNewTask {
DecryptionJsonContent build =
DecryptionJsonContent.builder().cellphoneMd5
(decryptStr).requestId(RandomUtil.randomString(TEN_NUM)).build();
// 调用HTTP请求发送数据
DecryptionDTO decryptionDTO = JSONUtil.toBean(HttpUtil.post(decryptAddress, JSON.toJSONString(build)), DecryptionDTO.class);
if (org.apache.commons.lang3.StringUtils.isNotBlank(decryptionDTO.getReason())
&& "success".equals(decryptionDTO.getReason()) && (org.apache.commons.lang3.StringUtils.isNotBlank(decryptionDTO.getCellPhone()))) {
List<String> parseArray = JSON.parseArray(decryptionDTO.getCellPhone(), String.class);
if (!parseArray.isEmpty()) {
log.info("================ response size as {} ================", parseArray.size());
return parseArray;
String result = HttpUtil.post(decryptAddress, JSON.toJSONString(build));
if (result.contains(SystemConstant.SUCCESS) && JSONUtil.isJson(result)) {
// 调用HTTP请求发送数据
DecryptionDTO decryptionDTO = JSONUtil.toBean(result, DecryptionDTO.class);
if (org.apache.commons.lang3.StringUtils.isNotBlank(decryptionDTO.getReason())
&& SystemConstant.SUCCESS.equals(decryptionDTO.getReason()) && (org.apache.commons.lang3.StringUtils.isNotBlank(decryptionDTO.getCellPhone()))) {
List<String> parseArray = JSON.parseArray(decryptionDTO.getCellPhone(), String.class);
if (!parseArray.isEmpty()) {
log.info("================ response size as {} ================", parseArray.size());
return parseArray;
}
}
log.info("============== the response as {} ===========", JSONUtil.toJsonStr(decryptionDTO));
}
log.info("============== the response as {} ===========",JSONUtil.toJsonStr(decryptionDTO));
return Lists.newArrayList();
}, executor);
results.add(future);

@ -58,7 +58,7 @@ inter:
address: https://bd.hzdaba.cn:8085/v3/Accounts/yuyoukeji/BigData/EncryptTel
appid: yuyoukeji
tk: e3fb7090b4babe44a5113601487af433
importAddress: https://ai.hzdaba.cn/external/activity/addClient
importAddress: https://ai.hzdaba.cn/api/activity/addclient
refreshToken: https://ai.hzdaba.cn/external/get/authKey
upload:

Loading…
Cancel
Save