Merge branch 'dev-V0.4.5' of https://gitee.com/iotkit-open-source/iotkit-parent into dev-V0.4.5

V0.5.x
xiwa 2023-06-18 20:14:52 +08:00
commit 68dc41b4d1
16 changed files with 174 additions and 22 deletions

View File

@ -10,11 +10,13 @@
package cc.iotkit.common.web.handler;
import cc.iotkit.common.api.Response;
import cc.iotkit.common.utils.JsonUtils;
import cn.dev33.satoken.util.SaResult;
import cn.hutool.core.util.IdUtil;
import org.springframework.core.MethodParameter;
import org.springframework.http.MediaType;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.http.converter.StringHttpMessageConverter;
import org.springframework.http.server.ServerHttpRequest;
import org.springframework.http.server.ServerHttpResponse;
import org.springframework.web.bind.annotation.ControllerAdvice;
@ -26,7 +28,7 @@ import java.util.Map;
public class ResponseResultHandler implements ResponseBodyAdvice<Object> {
@Override
public boolean supports(MethodParameter returnType, Class<? extends HttpMessageConverter<?>> converterType) {
return true;
return !converterType.equals(StringHttpMessageConverter.class);
}
@Override
@ -48,6 +50,8 @@ public class ResponseResultHandler implements ResponseBodyAdvice<Object> {
return new Response((Integer) map.get("status"), (String) map.get("error"),
"", IdUtil.simpleUUID());
}
} else if (body instanceof Response) {
return body;
}
return new Response(200, "", body, IdUtil.simpleUUID());

View File

@ -3,12 +3,10 @@
<parent>
<artifactId>iot-components</artifactId>
<groupId>cc.iotkit</groupId>
<version>0.4.5-SNAPSHOT</version>
<version>${revision}</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>cc.iotkit</groupId>
<artifactId>iot-DLT645-component</artifactId>
<version>0.4.5-SNAPSHOT</version>
<build>
<plugins>
<plugin>

View File

@ -3,12 +3,10 @@
<parent>
<artifactId>iot-components</artifactId>
<groupId>cc.iotkit</groupId>
<version>0.4.5-SNAPSHOT</version>
<version>${revision}</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>cc.iotkit</groupId>
<artifactId>iot-component-tcp</artifactId>
<version>0.4.5-SNAPSHOT</version>
<build>
<plugins>
<plugin>

View File

@ -3,12 +3,10 @@
<parent>
<artifactId>iot-components</artifactId>
<groupId>cc.iotkit</groupId>
<version>0.4.5-SNAPSHOT</version>
<version>${revision}</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>cc.iotkit</groupId>
<artifactId>iot-emqx-component</artifactId>
<version>0.4.5-SNAPSHOT</version>
<build>
<plugins>
<plugin>

View File

@ -3,12 +3,10 @@
<parent>
<artifactId>iot-components</artifactId>
<groupId>cc.iotkit</groupId>
<version>0.4.5-SNAPSHOT</version>
<version>${revision}</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>cc.iotkit</groupId>
<artifactId>iot-http-biz-component</artifactId>
<version>0.4.5-SNAPSHOT</version>
<build>
<plugins>
<plugin>

View File

@ -3,12 +3,10 @@
<parent>
<artifactId>iot-components</artifactId>
<groupId>cc.iotkit</groupId>
<version>0.4.5-SNAPSHOT</version>
<version>${revision}</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>cc.iotkit</groupId>
<artifactId>iot-mqtt-component</artifactId>
<version>0.4.5-SNAPSHOT</version>
<build>
<plugins>
<plugin>

View File

@ -3,12 +3,10 @@
<parent>
<artifactId>iot-components</artifactId>
<groupId>cc.iotkit</groupId>
<version>0.4.5-SNAPSHOT</version>
<version>${revision}</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>cc.iotkit</groupId>
<artifactId>iot-websocket-component</artifactId>
<version>0.4.5-SNAPSHOT</version>
<build>
<plugins>
<plugin>

View File

@ -25,4 +25,10 @@ public interface IBaetylService {
GetNodeCoreVersionVo getNodeCoreVersion(String data);
GetNodesVo getNodes(GetNodesBo data);
GetCoreConfigVo getCoreConfig(String data);
String getInstallCommand(GetInstallCommandBo data);
GetNodePropertiesVo getNodeProperties(String data);
}

View File

@ -23,9 +23,9 @@ import org.springframework.web.bind.annotation.RestController;
@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/baetyl")
@Api(tags = "边缘计算管理")
public class BartylController extends BaseController {
@RequestMapping("/baetyl/node")
@Api(tags = "边缘计算节点管理")
public class BartylNodeController extends BaseController {
@Autowired
private IBaetylService configService;
@ -96,4 +96,23 @@ public class BartylController extends BaseController {
return configService.getNodes(request.getData());
}
@ApiOperation("获取 core 配置")
@PostMapping("/getCoreConfig")
public GetCoreConfigVo getCoreConfig(@Validated @RequestBody Request<String> request) {
return configService.getCoreConfig(request.getData());
}
@ApiOperation("获取安装命令")
@PostMapping("/getInstallCommand")
public String getInstallCommand(@Validated @RequestBody Request<GetInstallCommandBo> request) {
return configService.getInstallCommand(request.getData());
}
@ApiOperation("获取节点属性")
@PostMapping("/getNodeProperties")
public GetNodePropertiesVo getNodeProperties(@Validated @RequestBody Request<String> request) {
return configService.getNodeProperties(request.getData());
}
}

View File

@ -0,0 +1,26 @@
package cc.iotkit.baetyl.dto.bo;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @author: regan
* @description:
* @date:created in 2023/6/18 16:22
* @modificed by:
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class GetInstallCommandBo {
@ApiModelProperty(value = "节点名称")
private String name;
@ApiModelProperty(value = "缺省或kube为kube安装命令")
private String mode;
}

View File

@ -0,0 +1,27 @@
package cc.iotkit.baetyl.dto.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @author: regan
* @description:
* @date:created in 2023/6/18 15:58
* @modificed by:
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class GetCoreConfigVo {
@ApiModelProperty(value = "core 版本")
private String version;
@ApiModelProperty(value = "core 上报频率")
private Integer frequency;
@ApiModelProperty(value = "core 边缘 API 端口")
private Integer apiport;
}

View File

@ -0,0 +1,45 @@
package cc.iotkit.baetyl.dto.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @author: regan
* @description:
* @date:created in 2023/6/18 18:08
* @modificed by:
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class GetNodePropertiesVo {
@ApiModelProperty(value = "map[string]string, value必须为 string")
private GetNodePropertiesVoBodyState state;
@ApiModelProperty(value = "map[string]string, value必须为 string")
private GetNodePropertiesVoBodyMetadata metadata;
@Data
@AllArgsConstructor
@NoArgsConstructor
public static class GetNodePropertiesVoBodyState {
@ApiModelProperty(value = "map[string]string, value必须为 string")
private String report;
@ApiModelProperty(value = "map[string]string, value必须为 string")
private String desire;
}
@Data
@AllArgsConstructor
@NoArgsConstructor
public static class GetNodePropertiesVoBodyMetadata {
@ApiModelProperty(value = "map[string]string, value必须为 string")
private String report;
@ApiModelProperty(value = "map[string]string, value必须为 string")
private String desire;
}
}

View File

@ -45,4 +45,10 @@ public interface BaetylServiceFeignClient {
GetNodesVo getNodes(@RequestParam(value = "selector") String selector, @RequestParam(value = "fieldSelector") String fieldSelector, @RequestParam(value = "limit") Integer limit,
@RequestParam(value = "continue") String isContinue, @RequestParam(value = "pageNo") Integer pageNo, @RequestParam(value = "pageSize") Integer pageSize,
@RequestParam(value = "name") String name, @RequestParam(value = "nodeSelector") String nodeSelector);
@GetMapping(value = BaetylConstant.Url.NodeManagement.GetCoreConfig)
GetCoreConfigVo getCoreConfig(@PathVariable(value = "name") String name);
@GetMapping(value = BaetylConstant.Url.NodeManagement.GetInstallCommand)
String getInstallCommand(@PathVariable(value = "name") String name, @RequestParam(value = "mode") String mode);
@GetMapping(value = BaetylConstant.Url.NodeManagement.GetNodeProperties)
GetNodePropertiesVo getNodeProperties(@PathVariable(value = "name") String data);
}

View File

@ -74,4 +74,19 @@ public class BaetylServiceFeignImpl implements IBaetylService {
return client.getNodes(data.getSelector(),data.getFieldSelector(),data.getLimit(),data.getIsContinue(),data.getPageNo(),data.getPageSize(),
data.getName(),data.getNodeSelector());
}
@Override
public GetCoreConfigVo getCoreConfig(String data) {
return client.getCoreConfig(data);
}
@Override
public String getInstallCommand(GetInstallCommandBo data) {
return client.getInstallCommand(data.getName(),data.getMode());
}
@Override
public GetNodePropertiesVo getNodeProperties(String data) {
return client.getNodeProperties(data);
}
}

View File

@ -84,4 +84,19 @@ public class BaetylServiceWebclientImpl implements IBaetylService {
public GetNodesVo getNodes(GetNodesBo data) {
return null;
}
@Override
public GetCoreConfigVo getCoreConfig(String data) {
return null;
}
@Override
public String getInstallCommand(GetInstallCommandBo data) {
return null;
}
@Override
public GetNodePropertiesVo getNodeProperties(String data) {
return null;
}
}

View File

@ -237,6 +237,7 @@ public class SysRoleServiceImpl implements ISysRoleService {
* @param status
*/
@Override
@Transactional(rollbackFor = Exception.class)
public void updateRoleStatus(Long roleId, String status) {
SysRole sysRole = new SysRole();
sysRole.setId(roleId);