使用自定义线程池

This commit is contained in:
Guoqs
2024-09-10 12:03:53 +08:00
parent 409307db85
commit 5e9beaf83a
13 changed files with 97 additions and 45 deletions

View File

@@ -35,6 +35,7 @@ import com.jsowell.common.util.DateUtils;
import com.jsowell.common.util.SecurityUtils;
import com.jsowell.common.util.StringUtils;
import com.jsowell.common.util.bean.BeanUtils;
import com.jsowell.common.util.spring.SpringUtils;
import com.jsowell.pile.domain.*;
import com.jsowell.pile.dto.*;
import com.jsowell.pile.service.*;
@@ -54,6 +55,7 @@ import org.apache.commons.collections4.CollectionUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -146,6 +148,9 @@ public class OrderService {
@Resource
private RedisCache redisCache;
// 引入线程池
private ThreadPoolTaskExecutor executor = SpringUtils.getBean("threadPoolTaskExecutor");
/**
* 生成订单
*
@@ -575,7 +580,7 @@ public class OrderService {
} catch (Exception e) {
log.error("异步发送获取实时数据指令error", e);
}
});
}, executor);
}
vo.setOrderCode(orderBasicInfo.getOrderCode());
@@ -680,7 +685,7 @@ public class OrderService {
} catch (Exception e) {
log.error("后管查询订单详情时把redis中的实时数据存到表发生异常", e);
}
});
}, executor);
return vo;
}
@@ -805,7 +810,7 @@ public class OrderService {
} catch (Exception e) {
log.error("人工结算订单 推送第三方平台订单信息error, orderCode:{}", orderBasicInfo.getOrderCode(), e);
}
});
}, executor);
return true;
}
@@ -1190,7 +1195,7 @@ public class OrderService {
} catch (Exception e) {
log.error("更新冻结金额 支付成功后全部冻结error", e);
}
});
}, executor);
// 支付订单成功
PayOrderSuccessCallbackDTO callbackDTO = PayOrderSuccessCallbackDTO.builder()
@@ -1209,7 +1214,7 @@ public class OrderService {
} catch (Exception e) {
log.error("异步推送第三方平台启动充电逻辑 error", e);
}
});
}, executor);
} else if (StringUtils.equals(scenarioType, ScenarioEnum.BALANCE.getValue())) { // 2-充值余额
// 充值余额成功
UpdateMemberBalanceDTO dto = new UpdateMemberBalanceDTO();