diff --git a/xymanager_admin/src/main/java/com/shxy/xymanager_admin/controller/CmdController.java b/xymanager_admin/src/main/java/com/shxy/xymanager_admin/controller/CmdController.java index 37a33f9..f1a0a8d 100644 --- a/xymanager_admin/src/main/java/com/shxy/xymanager_admin/controller/CmdController.java +++ b/xymanager_admin/src/main/java/com/shxy/xymanager_admin/controller/CmdController.java @@ -5,6 +5,7 @@ import com.shxy.xymanager_common.base.BaseController; import com.shxy.xymanager_common.base.ResponseReult; import com.shxy.xymanager_common.entity.MntnCmdHistory; import com.shxy.xymanager_common.entity.MntnCmds; +import com.shxy.xymanager_common.model.ActionModel; import com.shxy.xymanager_common.model.CmdModel; import com.shxy.xymanager_service.service.CmdService; import io.swagger.annotations.Api; @@ -13,7 +14,9 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; +import java.util.ArrayList; import java.util.HashMap; +import java.util.List; @RestController @Api(tags = {"命令相关接口"}) @@ -26,20 +29,20 @@ public class CmdController extends BaseController { @GetMapping("listAction") @ApiOperation("命令列表") - public ResponseReult> listAction() { - HashMap map = new HashMap<>(); - map.put("yw_cmd_android_reboot", "重启设备"); - map.put("yw_cmd_mcu_reboot", "MCU单片机重启"); - map.put("i1_cmd_set_i1_server_ip_port", "设置I1服务器"); - map.put("i1_cmd_set_xy_yw_ip_port", "设置运维服务器"); - map.put("i1_cmd_set_i1_heart_beat_time", "设置心跳周期"); - map.put("yw_cmd_upload_i1_zip_log", "上传日志"); - map.put("upgrade", "升级"); - map.put("yw_cmd_start_frpc", "开启frpc"); - map.put("yw_cmd_stop_frpc", "停止frpc"); - map.put("i1_cmd_stop_aging_test", "停止老化测试"); - map.put("yw_upd_ota", "Ota升级"); - return ResponseReult.success(map); + public ResponseReult> listAction() { + List list = new ArrayList<>(); + list.add(new ActionModel(1, "yw_cmd_android_reboot", "重启设备")); + list.add(new ActionModel(2, "yw_cmd_mcu_reboot", "MCU单片机重启")); + list.add(new ActionModel(3, "i1_cmd_set_i1_server_ip_port", "设置I1服务器")); + list.add(new ActionModel(4, "i1_cmd_set_xy_yw_ip_port", "设置运维服务器")); + list.add(new ActionModel(5, "i1_cmd_set_i1_heart_beat_time", "设置心跳周期")); + list.add(new ActionModel(6, "yw_cmd_upload_i1_zip_log", "上传日志")); + list.add(new ActionModel(7, "upgrade", "升级")); + list.add(new ActionModel(8, "yw_cmd_start_frpc", "开启frpc")); + list.add(new ActionModel(9, "yw_cmd_stop_frpc", "停止frpc")); + list.add(new ActionModel(10, "i1_cmd_stop_aging_test", "停止老化测试")); + list.add(new ActionModel(11, "yw_upd_ota", "升级Ota")); + return ResponseReult.success(list); } @PostMapping("send") diff --git a/xymanager_common/src/main/java/com/shxy/xymanager_common/model/ActionModel.java b/xymanager_common/src/main/java/com/shxy/xymanager_common/model/ActionModel.java new file mode 100644 index 0000000..8b36061 --- /dev/null +++ b/xymanager_common/src/main/java/com/shxy/xymanager_common/model/ActionModel.java @@ -0,0 +1,19 @@ +package com.shxy.xymanager_common.model; + +import lombok.Data; + +import java.util.List; + +@Data +public class ActionModel { + + private Integer id; + private String key; + private String desc; + + public ActionModel(Integer id, String key, String desc) { + this.id = id; + this.key = key; + this.desc = desc; + } +}