package com.fjhx.service.flow;

import com.fjhx.params.JumpVo;
import com.fjhx.params.order.OrderInfoVo;
import com.fjhx.service.order.OrderInfoService;
import com.fjhx.utils.ExampleAbstract;
import com.fjhx.utils.FlowConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * 发起申购
 */
@Service
public class CompensateFlowService {

    @Lazy
    @Autowired
    private OrderInfoService orderInfoService;


    private final FlowConstructor flowConstructor = FlowConstructor.init(new ExampleAbstract() {

        @Override
        public String getCode() {
            return "v_compensate";
        }

        @Override
        public void end() {

        }

    });


    @Transactional(rollbackFor = Exception.class)
    public void create(OrderInfoVo orderInfoVo) {
        flowConstructor.create(orderInfoVo.getId(), "订单补偿", orderInfoVo.getRemark(), orderInfoVo.getId());
    }

    @Transactional(rollbackFor = Exception.class)
    public void jump(JumpVo jumpVo) {
        flowConstructor.jump(jumpVo);
    }

}
