package com.rongwei.bsserver.sys.controller;


import com.rongwei.bscommon.sys.service.EquOverhaulInventorySetService;
import com.rongwei.bscommon.sys.utils.ExceptionUtils;
import com.rongwei.rwcommon.base.R;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * <p>
 * 设备子系统——备品备件库存设置 前端控制器
 * </p>
 *
 * @author zdz
 * @since 2023-11-27
 */
@RestController
@RequestMapping("/equOverhaulInventorySet")
public class EquOverhaulInventorySetController {

    private static final Logger logger = LoggerFactory.getLogger(EquOverhaulInventoryController.class);

    @Autowired
    private EquOverhaulInventorySetService EquOverhaulInventorySetService;

    /**
     * 系统每个小时更新一次预警状态
     * @param map
     * @return
     */
    @RequestMapping("/updateInventorySetReminderStatus")
    public R updateInventorySetReminderStatus(@RequestBody Map<String,Object> map){
        try {
            logger.info("系统自动根据安全库存信息、过期信息自动更新预警状态...");
            EquOverhaulInventorySetService.updateInventorySetWarnStatus();
        } catch (Exception e) {
            ExceptionUtils.printExceptionDetail(e,"系统每个小时更新一次预警状态:");
        }
        return R.ok();
    }
}

