whyclxw
2025-06-12 eb81b0a16b2d4e87eefd085231ab6b20a1ea3cde
src/main/java/com/whyc/controller/AlarmInspectionController.java
@@ -1,14 +1,19 @@
package com.whyc.controller;
import com.whyc.dto.Response;
import com.whyc.pojo.web_site.AlarmInspectionResult;
import com.whyc.service.AlarmInspectionService;
import com.whyc.util.CommonUtil;
import com.whyc.util.JsonUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.io.File;
import java.io.IOException;
import java.util.List;
/**
 * 要实现告警巡检单,创建巡检工单表.
@@ -26,11 +31,18 @@
    @Autowired
    private AlarmInspectionService service;
    @ApiOperation("查询站点对应的巡检单")
    @GetMapping("")
    public Response getList(@RequestParam Integer stationId,@RequestParam Integer inspectionType){
    @ApiOperation(value = "查询站点对应的巡检单",notes = "inspectionType=1表示告警级别为1的故障工单,inspectionType=2表示告警级别不为1的巡检备忘录")
    @GetMapping("getList")
    public Response getList(@RequestParam int stationId,@RequestParam int inspectionType){
        return service.getList(stationId,inspectionType);
    }
    @PostMapping("submitInspection")
    @ApiOperation(value = "提交巡检结果",notes = "alarmInspectionResultJsonStr填json字符串,字段包含stationId,stationName,inspectionType,inspectionResult,finishSuggestion")
    public Response submitInspection(@RequestPart(value = "file",required = false) List<MultipartFile>  file, @RequestParam String alarmInspectionResultJsonStr) throws IOException {
        AlarmInspectionResult result = JsonUtil.getGson().fromJson(alarmInspectionResultJsonStr,AlarmInspectionResult.class);
        return service.submitInspection(result,file);
    }
}