diff --git a/das/src/main/java/com/das/modules/page/controller/WindTurbinesPageController.java b/das/src/main/java/com/das/modules/page/controller/WindTurbinesPageController.java index 2ec4a027..fecc79ea 100644 --- a/das/src/main/java/com/das/modules/page/controller/WindTurbinesPageController.java +++ b/das/src/main/java/com/das/modules/page/controller/WindTurbinesPageController.java @@ -1,14 +1,12 @@ package com.das.modules.page.controller; import com.das.common.result.R; +import com.das.modules.node.domain.dto.DeviceCommandDto; import com.das.modules.page.domian.WindTurbinesPageVo; import com.das.modules.page.service.WindTurbinesPageService; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; import java.util.List; @@ -27,7 +25,7 @@ public class WindTurbinesPageController { * 获取风机机组所属线路列表 * @return 返回字符串数组 */ - @PostMapping("/lines") + @GetMapping("/lines") public R> queryBelongLines() { //TODO: 查询sql: select distinct belong_line as name from sys_equipment t where t.object_type = 10002 and belong_line !=''; List lines = windTurbinesPageService.queryBelongLines(); @@ -43,4 +41,15 @@ public class WindTurbinesPageController { List windTurbinesPageVos = windTurbinesPageService.queryAllWindTurbinesPages(); return R.success(windTurbinesPageVos); } + + /** + * + * @param controlList 遥控List + * @return 成功或者失败 + */ + @PostMapping ("/queryWindTurbinesPages") + public R windTurbinesControl(@RequestBody List controlList){ + windTurbinesPageService.windTurbinesControl(controlList); + return R.success(); + } } diff --git a/das/src/main/java/com/das/modules/page/service/WindTurbinesPageService.java b/das/src/main/java/com/das/modules/page/service/WindTurbinesPageService.java index 7d4cd987..c22074cc 100644 --- a/das/src/main/java/com/das/modules/page/service/WindTurbinesPageService.java +++ b/das/src/main/java/com/das/modules/page/service/WindTurbinesPageService.java @@ -3,6 +3,8 @@ package com.das.modules.page.service; import com.das.modules.data.domain.SnapshotValueQueryParam; import com.das.modules.data.service.DataService; import com.das.modules.equipment.mapper.SysEquipmentMapper; +import com.das.modules.node.domain.dto.DeviceCommandDto; +import com.das.modules.node.service.SysNodeService; import com.das.modules.page.domian.WindTurbinesPageVo; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; @@ -25,6 +27,9 @@ public class WindTurbinesPageService { @Autowired private DataService dataService; + @Autowired + SysNodeService sysNodeService; + /** * 获取风机机组所属线路列表 * @return 返回字符串数组 @@ -33,6 +38,11 @@ public class WindTurbinesPageService { return sysEquipmentMapper.queryBelongLines(OBJECT_TYPE); } + + /** + * 获取风机页面数据 + * @return 返回风机页面数据 + */ public List queryAllWindTurbinesPages(){ List windTurbinesPageVos = sysEquipmentMapper.queryAllWindList(OBJECT_TYPE); List paramList = new ArrayList<>(); @@ -64,4 +74,10 @@ public class WindTurbinesPageService { } return windTurbinesPageVos; } + + public void windTurbinesControl(List controlList){ + for (DeviceCommandDto item : controlList){ + sysNodeService.deviceCommand(item); + } + } }