whycxzp
2025-03-26 986823bfca95c8969eed8f543eedc8f48603f88a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
package com.whyc.service;
 
import com.github.pagehelper.PageInfo;
import com.google.gson.reflect.TypeToken;
import com.whyc.dto.InspectionTask;
import com.whyc.dto.Response;
import com.whyc.dto.WmsMaterialDto;
import com.whyc.util.HttpUtil;
import com.whyc.util.JsonUtil;
import org.springframework.stereotype.Service;
 
import java.util.List;
 
@Service
public class FireRobotService {
 
 
    /**
     *
     * @param command
     * @return
     */
    public Response control(String command) {
        String httpUrl = "http://192.168.10.45:8085"+"/ControlInterfaceHandler?command="+command;
        Response response = HttpUtil.doPost(httpUrl, (String) null);
        //对结果进行处理
        if(response.getCode() == 1){ //请求成功,data有正常数据
            String dataStr = (String) response.getData();
            //参数示例
            //执行成功返回:
            //开门成功!
            //关门成功!
            //七氟丙烷打开成功!
            //七氟丙烷关闭成功成功!
            //指令执行失败,请重新发送!
            if(dataStr.contains("成功")){
                response.set(1,true,dataStr);
            }else{
                response.set(1,false,dataStr);
            }
        }else{
            response.set(1,false);
        }
        return response;
    }
 
    public Response specifyTask(String interval, Integer progress, Integer direction) {
        String httpUrl = "http://192.168.10.45:8085"+"/SpecifyTask?interval="+interval+"&progress="+progress+"&direction="+direction;
        Response response = HttpUtil.doPost(httpUrl, (String) null);
        //对结果进行处理
        if(response.getCode() == 1){ //请求成功,data有正常数据
            String dataStr = (String) response.getData();
            //任务已设置: interval=0-1, progress=88%, direction=左
            response.setMsg(dataStr);
            response.setData(null);
        }
        return response;
    }
 
    public Response<PageInfo<InspectionTask>> getPageOfInspectionRecord(int pageNum, int pageSize) {
        //查询固定位置的文件数
        //再通过传入的pageNum和pageSize来获取 文件顺序的起止具体index值
 
        PageInfo<InspectionTask> pageInfo = new PageInfo<>();
        return new Response().set(1,pageInfo);
    }
}