package com.muyu.server.controller;

import com.muyu.common.core.domain.Result;
import com.muyu.domain.CarFaultRule;
import com.muyu.domain.Vehicle;
import com.muyu.server.service.FaultRuleService;
import io.swagger.v3.oas.annotations.Operation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
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;

import java.util.List;

/**
 * 故障检测控制层
 * @Author：weiran
 * @Package：com.muyu.cloud.faultmanage.controller
 * @Project：cloud-server-8
 * @name：FaultRuleController
 * @Date：2024/9/19 22:10
 */


@RestController
@RequestMapping("/faultrule")
public class FaultRuleController {

    @Autowired
    private FaultRuleService faultRuleService;


    /**
     * 故障参数匹配检查
     * @param carFaultRule
     * @return
     */
    @PostMapping("/cheakfaults")
    @Operation(summary = "故障参数匹配检查",description = "获取报文数据与故障参数进行比较")
    public Result cheakfaults(@Validated @RequestBody CarFaultRule carFaultRule){
        List<Vehicle> checkfault = faultRuleService.checkfault(carFaultRule);
        return Result.success(checkfault);
    }
}
