-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #47 from fqliao/feature-milestone2
add listJob && queryJobByDataset && sys config api for admin
- Loading branch information
Showing
43 changed files
with
819 additions
and
241 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
-- 管理端初始化 | ||
insert into wedpr_user (username, password, status) values('admin', '{bcrypt}$2a$10$XuiuKLg23kxtC/ldvYN0/evt0Y3aoBC9iV29srhIBMMDORzCQiYA.', 0); | ||
insert into wedpr_user_role(username, role_id) values ('admin', '10'); | ||
insert into wedpr_role_permission (role_id, role_name, permission_id) values ('10', 'admin_user', '1'); | ||
insert into wedpr_role_permission (role_id, role_name, permission_id) values ('10', 'admin_user', '1'); | ||
|
||
insert into `wedpr_config_table`(`config_key`, `config_value`) values("wedpr_algorithm_templates", '{"version":"1.0","templates":[{"name":"PSI","title":"数据对齐","detail":"","version":"1.0"},{"name":"XGB_TRAINING","title":"SecureLGBM训练","detail":"","version":"1.0"},{"name":"XGB_PREDICTING","title":"SecureLGBM预测","detail":"","version":"1.0"}]}'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
...rc/main/java/com/webank/wedpr/components/admin/controller/WedprConfigTableController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package com.webank.wedpr.components.admin.controller; | ||
|
||
import com.webank.wedpr.components.meta.sys.config.service.SysConfigService; | ||
import com.webank.wedpr.core.utils.Constant; | ||
import com.webank.wedpr.core.utils.WeDPRResponse; | ||
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.RequestMapping; | ||
import org.springframework.web.bind.annotation.RequestParam; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
/** | ||
* 前端控制器 | ||
* | ||
* @author caryliao | ||
* @since 2024-09-07 | ||
*/ | ||
@RestController | ||
@RequestMapping( | ||
path = Constant.WEDPR_API_PREFIX + "/admin", | ||
produces = {"application/json"}) | ||
@Slf4j | ||
public class WedprConfigTableController { | ||
@Autowired private SysConfigService sysConfigService; | ||
|
||
@GetMapping("/getConfig") | ||
public WeDPRResponse getSystemConfig(@RequestParam String key) { | ||
try { | ||
return sysConfigService.getSystemConfig(key); | ||
} catch (Exception e) { | ||
log.warn("getSystemConfig exception, key: {}, error: ", key, e); | ||
return new WeDPRResponse( | ||
Constant.WEDPR_FAILED, "getSystemConfig failed for " + e.getMessage()); | ||
} | ||
} | ||
} |
47 changes: 47 additions & 0 deletions
47
.../java/com/webank/wedpr/components/admin/controller/WedprJobDatasetRelationController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package com.webank.wedpr.components.admin.controller; | ||
|
||
import com.webank.wedpr.components.admin.common.Utils; | ||
import com.webank.wedpr.components.admin.request.GetJobByDatasetRequest; | ||
import com.webank.wedpr.components.admin.response.ListJobResponse; | ||
import com.webank.wedpr.components.admin.service.WedprJobDatasetRelationService; | ||
import com.webank.wedpr.components.token.auth.model.UserToken; | ||
import com.webank.wedpr.core.utils.Constant; | ||
import com.webank.wedpr.core.utils.WeDPRResponse; | ||
import javax.servlet.http.HttpServletRequest; | ||
import javax.validation.Valid; | ||
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.RequestMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
/** | ||
* 前端控制器 | ||
* | ||
* @author caryliao | ||
* @since 2024-09-06 | ||
*/ | ||
@RestController | ||
@RequestMapping( | ||
path = Constant.WEDPR_API_PREFIX + "/admin", | ||
produces = {"application/json"}) | ||
@Slf4j | ||
public class WedprJobDatasetRelationController { | ||
@Autowired private WedprJobDatasetRelationService wedprJobDatasetRelationService; | ||
|
||
@GetMapping("/queryJobsByDatasetId") | ||
public WeDPRResponse queryJobsByDatasetId( | ||
@Valid GetJobByDatasetRequest getJobByDatasetRequest, HttpServletRequest request) { | ||
try { | ||
// check user permission | ||
UserToken userToken = Utils.checkPermission(request); | ||
ListJobResponse listJobResponse = | ||
wedprJobDatasetRelationService.queryJobsByDatasetId(getJobByDatasetRequest); | ||
return new WeDPRResponse( | ||
Constant.WEDPR_SUCCESS, Constant.WEDPR_SUCCESS_MSG, listJobResponse); | ||
} catch (Exception e) { | ||
log.error("getJobByDatasetId error", e); | ||
return new WeDPRResponse(Constant.WEDPR_FAILED, e.getMessage()); | ||
} | ||
} | ||
} |
Oops, something went wrong.