package com.sw.mes.yb.check.service.impl;

import com.sw.mes.yb.check.service.SynchronousUpdateService;
import com.sw.mes.yb.check.service.UpdateService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.context.request.RequestAttributes;
import org.springframework.web.context.request.RequestContextHolder;

import java.util.List;

/**
 * @author zhaowenjie
 */
@Service
public class UpdateServiceImpl implements UpdateService {
    @Autowired
    private SynchronousUpdateService synchronousUpdateService;

    /**
     * 样片数据变动，触发方棒评级
     *
     * @param sectionNo 单晶编号
     */
    @Override
    public void update(String sectionNo) {
        RequestAttributes requestAttributes = RequestContextHolder.getRequestAttributes();
        synchronousUpdateService.synchronousUpdate(sectionNo, requestAttributes);
    }

    /**
     * 样片数据变动，触发方棒评级
     *
     * @param sectionNos 单晶编号
     */
    @Override
    public void updates(List<String> sectionNos) {
        RequestAttributes requestAttributes = RequestContextHolder.getRequestAttributes();
        synchronousUpdateService.synchronousUpdates(sectionNos, requestAttributes);
    }
}
