|
|
package com.yohoufo.order.service.proxy;
|
|
|
|
|
|
import com.yohoufo.common.utils.DateUtil;
|
|
|
import com.yohoufo.dal.order.BuyerOrderStatusFlowMapper;
|
|
|
import com.yohoufo.dal.order.model.BuyerOrderStatusFlow;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.util.concurrent.*;
|
|
|
|
|
|
@Service
|
|
|
public class OrderStatusFlowService {
|
|
|
private final Logger logger = LoggerFactory.getLogger(getClass());
|
|
|
|
|
|
private ExecutorService executorService = new ThreadPoolExecutor(5, 10, 60, TimeUnit.SECONDS, new ArrayBlockingQueue<>(1000));
|
|
|
|
|
|
@Autowired
|
|
|
private BuyerOrderStatusFlowMapper buyerOrderStatusFlowMapper;
|
|
|
|
|
|
public void addAsy(Long orderCode, Integer status){
|
|
|
try {
|
|
|
logger.info("OrderStatusFlowService add enter , status {}, orderCode {} ",
|
|
|
status, orderCode);
|
|
|
executorService.execute(() -> {
|
|
|
BuyerOrderStatusFlow buyerOrderStatusFlow = new BuyerOrderStatusFlow();
|
|
|
buyerOrderStatusFlow.setOrderCode(orderCode);
|
|
|
buyerOrderStatusFlow.setStatus(status);
|
|
|
buyerOrderStatusFlow.setCreateTime(DateUtil.getCurrentTimeSecond());
|
|
|
logger.info("OrderStatusFlowService add execute , buyerOrderStatusFlow {} ",buyerOrderStatusFlow );
|
|
|
buyerOrderStatusFlowMapper.insert(buyerOrderStatusFlow);
|
|
|
});
|
|
|
} catch (Exception e) {
|
|
|
logger.warn("OrderStatusFlowService add error , status {}, orderCode {} ",
|
|
|
status, orderCode, e);
|
|
|
}
|
|
|
|
|
|
|
|
|
}
|
|
|
} |
...
|
...
|
|