Authored by qinchao

增加订单状态记录表

package com.yohoufo.dal.order;
import com.yohoufo.dal.order.model.BuyerOrderStatusFlow;
public interface BuyerOrderStatusFlowMapper {
int insert(BuyerOrderStatusFlow record);
}
\ No newline at end of file
... ...
package com.yohoufo.dal.order.model;
import lombok.Data;
import lombok.ToString;
/**
* 状态流转信息表
*/
@Data
@ToString
public class BuyerOrderStatusFlow {
private Integer id;
private Long orderCode;
private Integer status;
private Integer createTime;
}
\ No newline at end of file
... ...
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yohoufo.dal.order.BuyerOrderStatusFlowMapper">
<resultMap id="BaseResultMap" type="com.yohoufo.dal.order.model.BuyerOrderStatusFlow">
<id column="id" jdbcType="INTEGER" property="id" />
<result column="order_code" jdbcType="BIGINT" property="orderCode" />
<result column="status" jdbcType="TINYINT" property="status" />
<result column="create_time" jdbcType="INTEGER" property="createTime" />
</resultMap>
<sql id="Base_Column_List">
id, order_code, status, create_time
</sql>
<insert id="insert" parameterType="com.yohoufo.dal.order.model.BuyerOrderStatusFlow">
insert into buyer_order_status_flow ( order_code, status,
create_time)
values ( #{orderCode,jdbcType=BIGINT}, #{status,jdbcType=TINYINT},
#{createTime,jdbcType=INTEGER})
</insert>
</mapper>
\ No newline at end of file
... ...
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);
}
}
}
... ...
... ... @@ -68,6 +68,7 @@ datasources:
- com.yohoufo.dal.order.SellerTaskDetailMapper
- com.yohoufo.dal.order.OrdersPrePayMapper
- com.yohoufo.dal.order.MetaConfigMapper
- com.yohoufo.dal.order.BuyerOrderStatusFlowMapper
ufo_promotion:
servers:
... ...
... ... @@ -68,6 +68,7 @@ datasources:
- com.yohoufo.dal.order.SellerTaskDetailMapper
- com.yohoufo.dal.order.OrdersPrePayMapper
- com.yohoufo.dal.order.MetaConfigMapper
- com.yohoufo.dal.order.BuyerOrderStatusFlowMapper
ufo_promotion:
servers:
... ...
... ... @@ -68,6 +68,7 @@ datasources:
- com.yohoufo.dal.order.SellerTaskDetailMapper
- com.yohoufo.dal.order.OrdersPrePayMapper
- com.yohoufo.dal.order.MetaConfigMapper
- com.yohoufo.dal.order.BuyerOrderStatusFlowMapper
ufo_promotion:
servers:
... ...