package com.skr.mdm.service.impl.reload.handler;

import com.skr.mdm.annotation.MdmReloadHandler;
import com.skr.mdm.bean.so.ReloadSO;
import com.skr.mdm.dao.DeviceInstructUserStatusDao;
import com.skr.mdm.enums.StrategyEquipmentStateEnum;
import com.skr.mdm.service.impl.reload.ReloadHandler;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * @author nfq
 * @date 2022/06/10 14:53
 */
@MdmReloadHandler
@Slf4j
public class CmdRetrieveReloadHandler implements ReloadHandler {

    @Autowired
    private DeviceInstructUserStatusDao deviceInstructUserStatusDao;

    @Override
    public void doHandler(ReloadSO reloadSO, Integer equipmentId) {
        try {
            reloadSO.setRetrieveList(deviceInstructUserStatusDao.listRetrieveByEquipmentId(equipmentId, 3, StrategyEquipmentStateEnum.ISSUING.getState()));
        } catch (Exception e) {
            log.error("卸载重装找回异常：" + equipmentId, e);
        }
    }
}
