异步配置修改

This commit is contained in:
Jack 2025-09-01 10:23:25 +08:00
parent 2333b17388
commit c8b6ac2f4b
7 changed files with 43 additions and 21 deletions

View File

@ -2052,8 +2052,7 @@ public class AccountUserBaseServiceImpl extends BaseServiceImpl<AccountUserBaseM
*/
@Override
public boolean doResetPasswdByUserId(Integer user_id, String user_password, String old_password) {
// logger.info("重置账号密码:{},{},{}", user_account, user_password, old_password);
logger.info("根据userId重置账号密码{},{},{}", user_id, user_password, old_password);
// logger.info("根据userId重置账号密码{},{},{}", user_id, user_password, old_password);
if (ObjectUtil.isEmpty(user_id)) {
throw new ApiException(_("缺少UserID"));
@ -3675,7 +3674,7 @@ public class AccountUserBaseServiceImpl extends BaseServiceImpl<AccountUserBaseM
return CommonResult.failed("用户信息有误!");
}
logger.info("商家修改密码:{}", accountUserBase);
// logger.info("商家修改密码:{}", accountUserBase);
// 直接重置密码
Boolean success = doResetPasswdByUserId(accountUserBase.getUser_id(), newPassword, null);

View File

@ -348,7 +348,7 @@ public class AccountUserBindConnectServiceImpl extends BaseServiceImpl<AccountUs
queryWrapper.select("user_id").orderByAsc("bind_time");
AccountUserBindConnect accountUserBindConnect = findOne(queryWrapper);
AccountUserBindConnect accountUserBindConnect = getOne(queryWrapper);
return accountUserBindConnect != null ? accountUserBindConnect.getUser_id() : null;
}

View File

@ -9,6 +9,7 @@
package com.suisung.mall.shop.config;
import org.springframework.aop.interceptor.AsyncUncaughtExceptionHandler;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.AsyncConfigurer;
@ -16,23 +17,45 @@ import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import java.lang.reflect.Method;
import java.util.concurrent.Executor;
import java.util.concurrent.ThreadPoolExecutor;
@Configuration
public class AsyncConfig implements AsyncConfigurer {
@Autowired
private Executor asyncExecutor; // 注入现有命名执行器
@Bean(name = "asyncExecutor")
@Override
public Executor getAsyncExecutor() {
public Executor asyncExecutor() {
// ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
// // 保留原有配置
// executor.setCorePoolSize(5);
// executor.setMaxPoolSize(10);
// executor.setQueueCapacity(100);
// executor.setThreadNamePrefix("Async-Executor-");
// executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy());
// executor.initialize();
// return executor;
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
executor.setCorePoolSize(5); // 核心线程数
executor.setMaxPoolSize(10); // 最大线程数
executor.setQueueCapacity(25); // 队列容量
executor.setThreadNamePrefix("Async-"); // 线程名前缀
executor.setCorePoolSize(5);
executor.setMaxPoolSize(10);
executor.setQueueCapacity(100);
executor.setThreadNamePrefix("ASYNC-");
executor.setWaitForTasksToCompleteOnShutdown(true);
executor.setAwaitTerminationSeconds(60);
executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy());
// executor.setTaskDecorator(new MdcTaskDecorator()); // 添加MDC上下文支持
executor.initialize();
return executor;
}
@Override
public Executor getAsyncExecutor() {
return asyncExecutor;
}
@Override
public AsyncUncaughtExceptionHandler getAsyncUncaughtExceptionHandler() {
return new CustomAsyncExceptionHandler();

View File

@ -106,7 +106,7 @@ public class PushMessageServiceImpl implements PushMessageService {
* @return
*/
@Async("asyncExecutor")
@Async
@Override
public CompletableFuture<Boolean> noticeMerchantSignEcContract(Integer userId, JSONObject payload) {
try {

View File

@ -9038,7 +9038,7 @@ public class ShopOrderBaseServiceImpl extends BaseServiceImpl<ShopOrderBaseMappe
* @param expireSeconds 过期时间
* @return 是否发送成功
*/
// @Async("asyncExecutor")
// @Async
// @Override
// public Boolean preSendExpiredSFOrderPushMessage(Integer storeId, String orderId, Long expireSeconds) {
// try {

View File

@ -609,7 +609,7 @@ public class ShopMchEntryServiceImpl extends BaseServiceImpl<ShopMchEntryMapper,
*
* @param record 商户入驻记录
*/
@Async("asyncExecutor")
@Async
@Override
public void updateMerchEntrySignedStatusAndContractDownloadUrl(ShopMchEntry record) {
try {
@ -934,12 +934,12 @@ public class ShopMchEntryServiceImpl extends BaseServiceImpl<ShopMchEntryMapper,
QueryWrapper<ShopMchEntry> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("login_mobile", mobile).select("approval_status").orderByAsc("id");
List<ShopMchEntry> recordList = list(queryWrapper);
if (CollectionUtil.isEmpty(recordList)) {
ShopMchEntry record = findOne(queryWrapper);
if (record == null) {
return 0;
}
return recordList.get(0).getApproval_status();
return record.getApproval_status();
}
/**

View File

@ -3116,9 +3116,9 @@ public class ShopStoreBaseServiceImpl extends BaseServiceImpl<ShopStoreBaseMappe
}
// 校验店铺状态
if (CommonConstant.Enable.equals(shopMchEntry.getStore_status())) {
return Pair.of(0, "操作失败,检查店铺是否已创建完成?");
}
// if (CommonConstant.Enable.equals(shopMchEntry.getStore_status())) {
// return Pair.of(0, "操作失败,检查店铺已创建完成?");
// }
// 如果 还没有签署入网电子合同且没有进件成功则提示前置条件未满足
if (!CommonConstant.Enable.equals(shopMchEntry.getHas_ec_signed())
@ -3145,7 +3145,7 @@ public class ShopStoreBaseServiceImpl extends BaseServiceImpl<ShopStoreBaseMappe
return Pair.of(0, "店铺名称已存在,请使用另一名称");
}
// 新增 shop_store_baseshop_store_infoshop_store_company, shop_store_employee 待补充
// shop_store_base
@ -3606,7 +3606,7 @@ public class ShopStoreBaseServiceImpl extends BaseServiceImpl<ShopStoreBaseMappe
QueryWrapper<ShopStoreBase> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("store_name", storeName).orderByAsc("store_id");
return findOne(queryWrapper);
return getOne(queryWrapper);
}
/**