异步配置修改
This commit is contained in:
parent
2333b17388
commit
c8b6ac2f4b
@ -2052,8 +2052,7 @@ public class AccountUserBaseServiceImpl extends BaseServiceImpl<AccountUserBaseM
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean doResetPasswdByUserId(Integer user_id, String user_password, String old_password) {
|
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)) {
|
if (ObjectUtil.isEmpty(user_id)) {
|
||||||
throw new ApiException(_("缺少UserID"));
|
throw new ApiException(_("缺少UserID"));
|
||||||
@ -3675,7 +3674,7 @@ public class AccountUserBaseServiceImpl extends BaseServiceImpl<AccountUserBaseM
|
|||||||
return CommonResult.failed("用户信息有误!");
|
return CommonResult.failed("用户信息有误!");
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.info("商家修改密码:{}", accountUserBase);
|
// logger.info("商家修改密码:{}", accountUserBase);
|
||||||
|
|
||||||
// 直接重置密码
|
// 直接重置密码
|
||||||
Boolean success = doResetPasswdByUserId(accountUserBase.getUser_id(), newPassword, null);
|
Boolean success = doResetPasswdByUserId(accountUserBase.getUser_id(), newPassword, null);
|
||||||
|
|||||||
@ -348,7 +348,7 @@ public class AccountUserBindConnectServiceImpl extends BaseServiceImpl<AccountUs
|
|||||||
|
|
||||||
queryWrapper.select("user_id").orderByAsc("bind_time");
|
queryWrapper.select("user_id").orderByAsc("bind_time");
|
||||||
|
|
||||||
AccountUserBindConnect accountUserBindConnect = findOne(queryWrapper);
|
AccountUserBindConnect accountUserBindConnect = getOne(queryWrapper);
|
||||||
return accountUserBindConnect != null ? accountUserBindConnect.getUser_id() : null;
|
return accountUserBindConnect != null ? accountUserBindConnect.getUser_id() : null;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -9,6 +9,7 @@
|
|||||||
package com.suisung.mall.shop.config;
|
package com.suisung.mall.shop.config;
|
||||||
|
|
||||||
import org.springframework.aop.interceptor.AsyncUncaughtExceptionHandler;
|
import org.springframework.aop.interceptor.AsyncUncaughtExceptionHandler;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.scheduling.annotation.AsyncConfigurer;
|
import org.springframework.scheduling.annotation.AsyncConfigurer;
|
||||||
@ -16,23 +17,45 @@ import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
|||||||
|
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.util.concurrent.Executor;
|
import java.util.concurrent.Executor;
|
||||||
|
import java.util.concurrent.ThreadPoolExecutor;
|
||||||
|
|
||||||
|
|
||||||
@Configuration
|
@Configuration
|
||||||
public class AsyncConfig implements AsyncConfigurer {
|
public class AsyncConfig implements AsyncConfigurer {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private Executor asyncExecutor; // 注入现有命名执行器
|
||||||
|
|
||||||
@Bean(name = "asyncExecutor")
|
@Bean(name = "asyncExecutor")
|
||||||
@Override
|
public Executor asyncExecutor() {
|
||||||
public Executor getAsyncExecutor() {
|
// 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();
|
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
|
||||||
executor.setCorePoolSize(5); // 核心线程数
|
executor.setCorePoolSize(5);
|
||||||
executor.setMaxPoolSize(10); // 最大线程数
|
executor.setMaxPoolSize(10);
|
||||||
executor.setQueueCapacity(25); // 队列容量
|
executor.setQueueCapacity(100);
|
||||||
executor.setThreadNamePrefix("Async-"); // 线程名前缀
|
executor.setThreadNamePrefix("ASYNC-");
|
||||||
|
executor.setWaitForTasksToCompleteOnShutdown(true);
|
||||||
|
executor.setAwaitTerminationSeconds(60);
|
||||||
|
executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy());
|
||||||
|
// executor.setTaskDecorator(new MdcTaskDecorator()); // 添加MDC上下文支持
|
||||||
executor.initialize();
|
executor.initialize();
|
||||||
return executor;
|
return executor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Executor getAsyncExecutor() {
|
||||||
|
return asyncExecutor;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AsyncUncaughtExceptionHandler getAsyncUncaughtExceptionHandler() {
|
public AsyncUncaughtExceptionHandler getAsyncUncaughtExceptionHandler() {
|
||||||
return new CustomAsyncExceptionHandler();
|
return new CustomAsyncExceptionHandler();
|
||||||
|
|||||||
@ -106,7 +106,7 @@ public class PushMessageServiceImpl implements PushMessageService {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@Async("asyncExecutor")
|
@Async
|
||||||
@Override
|
@Override
|
||||||
public CompletableFuture<Boolean> noticeMerchantSignEcContract(Integer userId, JSONObject payload) {
|
public CompletableFuture<Boolean> noticeMerchantSignEcContract(Integer userId, JSONObject payload) {
|
||||||
try {
|
try {
|
||||||
|
|||||||
@ -9038,7 +9038,7 @@ public class ShopOrderBaseServiceImpl extends BaseServiceImpl<ShopOrderBaseMappe
|
|||||||
* @param expireSeconds 过期时间(秒)
|
* @param expireSeconds 过期时间(秒)
|
||||||
* @return 是否发送成功
|
* @return 是否发送成功
|
||||||
*/
|
*/
|
||||||
// @Async("asyncExecutor")
|
// @Async
|
||||||
// @Override
|
// @Override
|
||||||
// public Boolean preSendExpiredSFOrderPushMessage(Integer storeId, String orderId, Long expireSeconds) {
|
// public Boolean preSendExpiredSFOrderPushMessage(Integer storeId, String orderId, Long expireSeconds) {
|
||||||
// try {
|
// try {
|
||||||
|
|||||||
@ -609,7 +609,7 @@ public class ShopMchEntryServiceImpl extends BaseServiceImpl<ShopMchEntryMapper,
|
|||||||
*
|
*
|
||||||
* @param record 商户入驻记录
|
* @param record 商户入驻记录
|
||||||
*/
|
*/
|
||||||
@Async("asyncExecutor")
|
@Async
|
||||||
@Override
|
@Override
|
||||||
public void updateMerchEntrySignedStatusAndContractDownloadUrl(ShopMchEntry record) {
|
public void updateMerchEntrySignedStatusAndContractDownloadUrl(ShopMchEntry record) {
|
||||||
try {
|
try {
|
||||||
@ -934,12 +934,12 @@ public class ShopMchEntryServiceImpl extends BaseServiceImpl<ShopMchEntryMapper,
|
|||||||
|
|
||||||
QueryWrapper<ShopMchEntry> queryWrapper = new QueryWrapper<>();
|
QueryWrapper<ShopMchEntry> queryWrapper = new QueryWrapper<>();
|
||||||
queryWrapper.eq("login_mobile", mobile).select("approval_status").orderByAsc("id");
|
queryWrapper.eq("login_mobile", mobile).select("approval_status").orderByAsc("id");
|
||||||
List<ShopMchEntry> recordList = list(queryWrapper);
|
ShopMchEntry record = findOne(queryWrapper);
|
||||||
if (CollectionUtil.isEmpty(recordList)) {
|
if (record == null) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return recordList.get(0).getApproval_status();
|
return record.getApproval_status();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -3116,9 +3116,9 @@ public class ShopStoreBaseServiceImpl extends BaseServiceImpl<ShopStoreBaseMappe
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 校验店铺状态,
|
// 校验店铺状态,
|
||||||
if (CommonConstant.Enable.equals(shopMchEntry.getStore_status())) {
|
// if (CommonConstant.Enable.equals(shopMchEntry.getStore_status())) {
|
||||||
return Pair.of(0, "操作失败,检查店铺是否已创建完成?");
|
// return Pair.of(0, "操作失败,检查店铺已创建完成?");
|
||||||
}
|
// }
|
||||||
|
|
||||||
// 如果 还没有签署入网电子合同且没有进件成功,则提示前置条件未满足
|
// 如果 还没有签署入网电子合同且没有进件成功,则提示前置条件未满足
|
||||||
if (!CommonConstant.Enable.equals(shopMchEntry.getHas_ec_signed())
|
if (!CommonConstant.Enable.equals(shopMchEntry.getHas_ec_signed())
|
||||||
@ -3606,7 +3606,7 @@ public class ShopStoreBaseServiceImpl extends BaseServiceImpl<ShopStoreBaseMappe
|
|||||||
QueryWrapper<ShopStoreBase> queryWrapper = new QueryWrapper<>();
|
QueryWrapper<ShopStoreBase> queryWrapper = new QueryWrapper<>();
|
||||||
queryWrapper.eq("store_name", storeName).orderByAsc("store_id");
|
queryWrapper.eq("store_name", storeName).orderByAsc("store_id");
|
||||||
|
|
||||||
return findOne(queryWrapper);
|
return getOne(queryWrapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user