package com.rongwei.bsserver.sys.controller;

import com.rongwei.bscommon.sys.service.EquipmentArchivesService;
import com.rongwei.bscommon.sys.utils.ExceptionUtils;
import com.rongwei.bsentity.dto.EquipmentDisposeDTO;
import com.rongwei.rwcommon.base.R;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author shangmi
 * @title WordDeriveController
 * @date 2024/1/16 9:40
 * @description 设备档案
 */
@RestController
@RequestMapping("/Equipment-Archives")
@Slf4j
public class EquipmentArchivesController {

    @Autowired
    private EquipmentArchivesService archivesService;

    /**
     * 处置申请后更新设备库
     *
     * @param equipmentDisposeDTO
     * @return {@link R}
     * @date 2024/1/16 14:26
     * @author shangmi
     *
     */
    @PostMapping("/updateEquipmentData")
    public R updateEquipmentData(@RequestBody EquipmentDisposeDTO equipmentDisposeDTO){
        try {
            log.info("进入接口：/Equipment-Archives/updateEquipmentData，参数为：{}",equipmentDisposeDTO);
            return archivesService.updateEquipmentData(equipmentDisposeDTO);
        }catch (Exception e){
            ExceptionUtils.printExceptionDetail(e,"更新设备库失败,异常为：");
            log.info(e.getMessage());
            return R.error(e.getMessage());
        }

    }

}
