whycxzp
2025-03-30 87ce3b2705c814523a199572c77402b96801e794
灭火机器人相关接口
2个文件已修改
1个文件已添加
99 ■■■■■ 已修改文件
src/main/java/com/whyc/controller/InterfaceFireRobotController.java 38 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/dto/EnvironmentThreshold.java 27 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/service/FireRobotService.java 34 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/controller/InterfaceFireRobotController.java
@@ -1,6 +1,7 @@
package com.whyc.controller;
import com.github.pagehelper.PageInfo;
import com.whyc.dto.EnvironmentThreshold;
import com.whyc.dto.InspectionRecord;
import com.whyc.dto.Response;
import com.whyc.service.FireRobotService;
@@ -44,6 +45,43 @@
        return service.specifyTask(interval,progress,direction);
    }
    /**
     * 巡检间隔接口
     * 请求参数    参数1    hour(float):巡检间隔    是    2
     *     参数示例
     * http://192.168.10.45:8085/InspectionIntervals?hour=2
     * 返回参数    参数1
     *     参数示例
     * 巡检间隔已设置: 2.0 h/次。
     *
     */
    @PostMapping("setInspectionInterval")
    public Response setInspectionInterval(@RequestParam float hour){
        return service.setInspectionInterval(hour);
    }
    /**
     * 巡检间隔接口
     * 请求参数    参数1    hour(float):巡检间隔    是    2
     *     参数示例
     * http://192.168.10.45:8085/InspectionIntervals?hour=2
     * 返回参数    参数1
     *     参数示例
     * 巡检间隔已设置: 2.0 h/次。
     *
     */
    @PostMapping("setEnvironmentThreshold")
    public Response setEnvironmentThreshold(@RequestBody EnvironmentThreshold threshold){
        return service.setEnvironmentThreshold(threshold);
    }
    @GetMapping("getEnvironmentThreshold")
    public Response getEnvironmentThreshold(){
        return service.getEnvironmentThreshold();
    }
    @ApiOperation("查询分页-巡检记录")
    @GetMapping("getPageOfInspectionRecord")
    public Response<PageInfo<InspectionRecord>> getPageOfInspectionRecord(@RequestParam int pageNum, @RequestParam int pageSize,
src/main/java/com/whyc/dto/EnvironmentThreshold.java
New file
@@ -0,0 +1,27 @@
package com.whyc.dto;
import lombok.Data;
import lombok.ToString;
/**
 * 参数1    tempThold(float):温度阈值
 * 参数2    humidityThold(float):湿度阈值
 * 参数3    COTthold(float):一氧化碳阈值
 * 参数4    CO2Thold(float):二氧化碳阈值
 * 参数5    CH4Thold(float):甲烷阈值
 * 参数6    H2Thold(float):氢气阈值
 * 参数7    smokeThold(float):烟感阈值
 */
@ToString
@Data
public class EnvironmentThreshold {
    private float tempThold;
    private float humidityThold;
    private float COTthold;
    private float CO2Thold;
    private float CH4Thold;
    private float H2Thold;
    private float smokeThold;
}
src/main/java/com/whyc/service/FireRobotService.java
@@ -1,6 +1,7 @@
package com.whyc.service;
import com.github.pagehelper.PageInfo;
import com.whyc.dto.EnvironmentThreshold;
import com.whyc.dto.InspectionRecord;
import com.whyc.dto.Response;
import com.whyc.util.HttpUtil;
@@ -58,6 +59,39 @@
        return response;
    }
    public Response setInspectionInterval(float hour) {
        String httpUrl = "http://192.168.10.45:8085"+"/InspectionIntervals?hour="+2;
        Response response = HttpUtil.doPost(httpUrl, (String) null);
        //对结果进行处理
        if(response.getCode() == 1){ //请求成功,data有正常数据
            String dataStr = (String) response.getData();
            //巡检间隔已设置: 2.0 h/次
            response.setMsg(dataStr);
            response.setData(null);
        }
        return response;
    }
    public Response setEnvironmentThreshold(EnvironmentThreshold threshold) {
        String httpUrl = "http://192.168.10.45:8085"+"/EnvironmentThrSet?tempThold="+threshold.getTempThold()+"&humidityThold="+threshold.getHumidityThold()+"&COTthold="+threshold.getCOTthold()+"&CO2Thold="+threshold.getCO2Thold()+"&CH4Thold="+threshold.getCH4Thold()+"&H2Thold="+threshold.getH2Thold()+"&SmokeThold="+threshold.getSmokeThold();
        Response response = HttpUtil.doPost(httpUrl, (String) null);
        //对结果进行处理
        if(response.getCode() == 1){ //请求成功,data有正常数据
            String dataStr = (String) response.getData();
            //环境阈值修改成功,温度阈值:60.0、湿度阈值:60.0、CO:100.0、CO2:1500、CH4:100.0、H2:100.0、烟感:100.0
            response.setMsg(dataStr);
            response.setData(null);
        }
        return response;
    }
    public Response getEnvironmentThreshold() {
        //TODO 环境读取接口
        return null;
    }
    public Response<PageInfo<InspectionRecord>> getPageOfInspectionRecord(int pageNum, int pageSize, String startDateStr, String endDateStr) {
        List<InspectionRecord> recordList = new LinkedList<>();
        //查询固定位置的文件数