package com.kiisoo.ic.synchronous.service;

import com.alibaba.fastjson.JSON;
import com.kiisoo.ic.common.DisruptorCallackI;
import com.kiisoo.ic.common.DisruptorDataI;
import com.kiisoo.ic.customer.CustomerService;
import com.kiisoo.ic.synchronous.entity.TurnBackDTO;
import com.kiisoo.ic.synchronous.entity.TurnBackVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class BackDisposeService implements DisruptorCallackI {

    @Autowired
    private CustomerService customerService;

    @Override
    public void handel(DisruptorDataI dataMsg) throws Exception {
        TurnBackVO channelStateOrderDTO = (TurnBackVO)dataMsg;
        for (TurnBackDTO turnBackDTO : channelStateOrderDTO.getTurnBackDTOS()) {
            customerService.turnBack(turnBackDTO);
        }
    }
}
