【8.0】【res】更新资源汇报功能

pull/57/head
fengshuonan 2023-08-09 21:16:50 +08:00
parent 1e808bbae1
commit e4088140d2
4 changed files with 41 additions and 5 deletions

View File

@ -24,6 +24,7 @@
*/
package cn.stylefeng.roses.kernel.scanner.api;
import cn.stylefeng.roses.kernel.scanner.api.constants.ScannerConstants;
import cn.stylefeng.roses.kernel.scanner.api.pojo.resource.ReportResourceParam;
import cn.stylefeng.roses.kernel.scanner.api.pojo.resource.SysResourcePersistencePojo;
import org.springframework.web.bind.annotation.RequestBody;
@ -51,7 +52,7 @@ public interface ResourceReportApi {
* @author fengshuonan
* @since 2020/10/19 22:02
*/
@RequestMapping(value = "/resourceService/reportResources", method = RequestMethod.POST)
@RequestMapping(value = ScannerConstants.REPORT_RES_URL, method = RequestMethod.POST)
void reportResources(@RequestBody ReportResourceParam reportResourceReq);
/**
@ -65,7 +66,7 @@ public interface ResourceReportApi {
* @author fengshuonan
* @since 2020/10/19 22:02
*/
@RequestMapping(value = "/resourceService/reportResourcesAndGetResult", method = RequestMethod.POST)
@RequestMapping(value = ScannerConstants.REPORT_RES_AND_GET_RESULT_URL, method = RequestMethod.POST)
List<SysResourcePersistencePojo> reportResourcesAndGetResult(@RequestBody ReportResourceParam reportResourceReq);
}

View File

@ -84,10 +84,22 @@ public interface ScannerConstants {
/**
*
*/
List<String> DONT_PARSE_FIELD = ListUtil.list(false, "serialVersionUID", "delFlag", "createTime", "createUser", "updateTime", "updateUser");
List<String> DONT_PARSE_FIELD = ListUtil.list(false, "serialVersionUID", "delFlag", "createTime", "createUser", "updateTime",
"updateUser");
/**
* validateGroups@Validateclass
*/
String DEFAULT_VALIDATED = "default-all";
/**
*
*/
String REPORT_RES_URL = "/resourceService/reportResources";
/**
*
*/
String REPORT_RES_AND_GET_RESULT_URL = "/resourceService/reportResourcesAndGetResult";
}

View File

@ -55,6 +55,9 @@ public class ReportResourceParam extends BaseRequest {
@ChineseDescription("资源集合")
private Map<String, Map<String, ResourceDefinition>> resourceDefinitions;
public ReportResourceParam() {
}
public ReportResourceParam(String projectCode, Map<String, Map<String, ResourceDefinition>> resourceDefinitions) {
this.projectCode = projectCode;
this.resourceDefinitions = resourceDefinitions;

View File

@ -5,11 +5,14 @@ import cn.stylefeng.roses.kernel.rule.pojo.response.SuccessResponseData;
import cn.stylefeng.roses.kernel.scanner.api.ResourceReportApi;
import cn.stylefeng.roses.kernel.scanner.api.annotation.ApiResource;
import cn.stylefeng.roses.kernel.scanner.api.annotation.PostResource;
import cn.stylefeng.roses.kernel.scanner.api.constants.ScannerConstants;
import cn.stylefeng.roses.kernel.scanner.api.pojo.resource.ReportResourceParam;
import cn.stylefeng.roses.kernel.scanner.api.pojo.resource.SysResourcePersistencePojo;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.List;
/**
*
@ -18,9 +21,15 @@ import javax.annotation.Resource;
* @since 2023/8/9 0:30
*/
@RestController
@ApiResource(name = "接收微服务远程资源")
@ApiResource(name = "接收微服务远程资源", requiredPermission = true,
requirePermissionCode = ResourceReceiveController.RES_REQUEST_PERMISSION_CODE)
public class ResourceReceiveController {
/**
* 访
*/
public static final String RES_REQUEST_PERMISSION_CODE = "SYS_CONFIG";
@Resource
private ResourceReportApi resourceReportApi;
@ -30,10 +39,21 @@ public class ResourceReceiveController {
* @author fengshuonan
* @date 2021/8/26 17:28
*/
@PostResource(name = "接受资源", path = "/resourceService/reportResources")
@PostResource(name = "接受资源", path = ScannerConstants.REPORT_RES_URL)
public ResponseData<?> reportResources(@RequestBody ReportResourceParam reportResourceReq) {
resourceReportApi.reportResources(reportResourceReq);
return new SuccessResponseData<>();
}
/**
*
*
* @author fengshuonan
* @since 2023/8/9 20:38
*/
@PostResource(name = "接受资源并获取返回的结果", path = ScannerConstants.REPORT_RES_AND_GET_RESULT_URL)
public List<SysResourcePersistencePojo> reportResourcesAndGetResult(@RequestBody ReportResourceParam reportResourceReq) {
return resourceReportApi.reportResourcesAndGetResult(reportResourceReq);
}
}