Commit 86d54a50 authored by 李杨's avatar 李杨

人工模式,启停资源点

parent 792a9028
......@@ -29,10 +29,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
/**
* 设备控制
......@@ -57,6 +54,8 @@ public class EquipmentController extends AbstractController {
private LiStationService liStationService;
@Autowired
private WebSocket webSocket;
@Autowired
private LiResourceService liResourceService;
/**
* 获取每个设备最新的参数值
......@@ -333,9 +332,15 @@ public class EquipmentController extends AbstractController {
Map<String,Object> list = equipmentService.getList();
webSocket.sendAllMessage(JSONObject.toJSONString(list));
// 控制资源点启停
checkModelOnOrOff(type, status);
return R.ok();
}
/**
* 查询定时温控里面的数据
* @return
......@@ -365,7 +370,29 @@ public class EquipmentController extends AbstractController {
@PostMapping("/onOrOff")
public Map<String, Object> doorOnOff(@RequestBody LiResourceModel model) {
// String postUrl = getUrl(model.getStationId());
String postUrl = "http://localhost:8089/command/operation";
return onOrOff(model);
}
/**
* 根据选择人工模式,来控制资源点啊启停
* @param type 1=供暖模式,2=机械通风,3=自然通风
* @param status 1=开启,2=关闭
*/
private void checkModelOnOrOff(Integer type, Integer status) {
List<LiResource> list = new ArrayList();
// 查询所有模式匹配的资源点
// list = liResourceService.
for (int i = 0; i < list.size(); i++) {
LiResourceModel model = new LiResourceModel();
model.setStatus(status);
//操作类型,1=开关
model.setActionType(1);
onOrOff(model);
}
}
private Map<String, Object> onOrOff(LiResourceModel model) {
String postUrl = "http://10.2.72.33:8089/command/operation";
Map<String, String> postParam = new HashMap<String, String>(10);
postParam.put("liResourceId", model.getId());
postParam.put("params", model.getStatus().toString());
......@@ -380,10 +407,13 @@ public class EquipmentController extends AbstractController {
map = JSONObject.parseObject(resultMap.get("data").toString(), Map.class);
}
return map;
}
private String getUrl(String stationId) {
LiStation liStation = liStationService.getById(stationId);
return liStation.getByx1();
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment