Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ cd frontend && npm run check-i18n
- Java 中能用 Lombok 解决 getter / setter 模板代码的地方,优先使用 Lombok。
- 重复胶水代码要适度收敛,但收敛方式不能比原逻辑更难懂。
- 注释只解释不明显的业务约束、协议边界或复杂流程,不写重复代码字面含义的注释。
- 前端调用后端时,使用的接口名称要求格式为驼峰命名法。

## Java 后端规则

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ public ResWebData<?> endAutoExecJob(@Valid @RequestBody DmTicketFO fo, HttpServl
//

@RequestAuth(level = HIGH, value = RDP_WORKER_ORDER_READ)
@RequestMapping(value = "/listbasic", method = RequestMethod.POST)
@RequestMapping(value = "/listBasic", method = RequestMethod.POST)
public ResWebData<?> listTicketsBasic(@Valid @RequestBody RdpListTicketFO fo, HttpServletRequest request) {
String puid = (String) request.getAttribute(RdpUserService.PUID);
String uid = (String) request.getAttribute(RdpUserService.UID);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public ResWebData<?> deleteCluster(@RequestBody @Valid DeleteClusterFO fo, HttpS
}

@RequestAuth(DM_WORKER_MANAGE)
@RequestMapping(value = "/updatedesc", method = RequestMethod.POST)
@RequestMapping(value = "/updateDesc", method = RequestMethod.POST)
public ResWebData<?> updateClusterDesc(@RequestBody @Valid UpdateClusterDescFO fo, HttpServletRequest request) {
String puid = (String) request.getAttribute(RdpUserService.PUID);
this.objectCacheDao.ownCluster(puid, fo.getClusterId());
Expand All @@ -89,7 +89,7 @@ public ResWebData<?> updateClusterDesc(@RequestBody @Valid UpdateClusterDescFO f
}

@RequestAuth(DM_WORKER_READ)
@RequestMapping(value = "/listbycondition", method = RequestMethod.POST)
@RequestMapping(value = "/listByCondition", method = RequestMethod.POST)
public ResWebData<?> listByCondition(@RequestBody @Valid ListClustersFO fo, HttpServletRequest request) {
String puid = (String) request.getAttribute(RdpUserService.PUID);

Expand All @@ -98,7 +98,7 @@ public ResWebData<?> listByCondition(@RequestBody @Valid ListClustersFO fo, Http
}

@RequestAuth(DM_WORKER_READ)
@RequestMapping(value = "/listwithworkernets", method = RequestMethod.POST)
@RequestMapping(value = "/listWithWorkerNets", method = RequestMethod.POST)
public ResWebData<?> listWithWorkerNets(HttpServletRequest request) {
String puid = (String) request.getAttribute(RdpUserService.PUID);

Expand All @@ -113,7 +113,7 @@ public ResWebData<?> listWithWorkerNets(HttpServletRequest request) {
}

@RequestAuth(DM_WORKER_READ)
@RequestMapping(value = "/querybyid", method = RequestMethod.POST)
@RequestMapping(value = "/queryById", method = RequestMethod.POST)
public ResWebData<?> queryById(@RequestBody @Valid QueryClusterFO fo, HttpServletRequest request) {
String puid = (String) request.getAttribute(RdpUserService.PUID);
this.objectCacheDao.ownCluster(puid, fo.getClusterId());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public class WorkerController {
private WorkerDetector workerDetector;

@RequestAuth(DM_WORKER_READ)
@RequestMapping(value = "/listworkers", method = RequestMethod.POST)
@RequestMapping(value = "/listWorkers", method = RequestMethod.POST)
public ResWebData<?> listWorkers(@Valid @RequestBody ListWorkersFO fo, HttpServletRequest request) {
String puid = (String) request.getAttribute(RdpUserService.PUID);
this.objectCacheDao.ownCluster(puid, fo.getClusterId());
Expand All @@ -74,7 +74,7 @@ public ResWebData<?> listWorkers(@Valid @RequestBody ListWorkersFO fo, HttpServl
}

@RequestAuth(DM_WORKER_MANAGE)
@RequestMapping(value = "/updateworkerdesc", method = RequestMethod.POST)
@RequestMapping(value = "/updateWorkerDesc", method = RequestMethod.POST)
public ResWebData<?> updateWorkerDesc(@Valid @RequestBody UpdateWorkerDescFO fo, HttpServletRequest request) {
String puid = (String) request.getAttribute(RdpUserService.PUID);
this.objectCacheDao.ownWorker(puid, fo.getWorkerId());
Expand All @@ -84,7 +84,7 @@ public ResWebData<?> updateWorkerDesc(@Valid @RequestBody UpdateWorkerDescFO fo,
}

@RequestAuth(DM_WORKER_READ)
@RequestMapping(value = "/queryworkerbyid", method = RequestMethod.POST)
@RequestMapping(value = "/queryWorkerById", method = RequestMethod.POST)
public ResWebData<?> queryWorkerById(@Valid @RequestBody QueryWorkerFO fo, HttpServletRequest request) {
String puid = (String) request.getAttribute(RdpUserService.PUID);
this.objectCacheDao.ownWorker(puid, fo.getWorkerId());
Expand All @@ -95,7 +95,7 @@ public ResWebData<?> queryWorkerById(@Valid @RequestBody QueryWorkerFO fo, HttpS
}

@RequestAuth(level = HIGH, value = DM_WORKER_MANAGE)
@RequestMapping(value = "/createinitialworker", method = RequestMethod.POST)
@RequestMapping(value = "/createInitialWorker", method = RequestMethod.POST)
public ResWebData<?> createInitialWorker(@Valid @RequestBody CreateInitialWorkerFO fo, HttpServletRequest request) {
String puid = (String) request.getAttribute(RdpUserService.PUID);
this.objectCacheDao.ownCluster(puid, fo.getClusterId());
Expand All @@ -105,7 +105,7 @@ public ResWebData<?> createInitialWorker(@Valid @RequestBody CreateInitialWorker
}

@RequestAuth(level = HIGH, value = DM_WORKER_MANAGE)
@RequestMapping(value = "/deleteworker", method = RequestMethod.POST)
@RequestMapping(value = "/deleteWorker", method = RequestMethod.POST)
public ResWebData<?> deleteWorker(@Valid @RequestBody DeleteWorkerFO fo, HttpServletRequest request) {
String puid = (String) request.getAttribute(RdpUserService.PUID);
this.objectCacheDao.ownWorker(puid, fo.getWorkerId());
Expand All @@ -115,7 +115,7 @@ public ResWebData<?> deleteWorker(@Valid @RequestBody DeleteWorkerFO fo, HttpSer
}

@RequestAuth(level = HIGH, value = DM_WORKER_MANAGE)
@RequestMapping(value = "/waittooffline", method = RequestMethod.POST)
@RequestMapping(value = "/waitToOffline", method = RequestMethod.POST)
public ResWebData<?> waitToOffline(@Valid @RequestBody WaitToOfflineFO fo, HttpServletRequest request) {
String puid = (String) request.getAttribute(RdpUserService.PUID);
this.objectCacheDao.ownWorker(puid, fo.getWorkerId());
Expand All @@ -125,7 +125,7 @@ public ResWebData<?> waitToOffline(@Valid @RequestBody WaitToOfflineFO fo, HttpS
}

@RequestAuth(level = HIGH, value = DM_WORKER_MANAGE)
@RequestMapping(value = "/waittoonline", method = RequestMethod.POST)
@RequestMapping(value = "/waitToOnline", method = RequestMethod.POST)
public ResWebData<?> waitToOnline(@Valid @RequestBody WaitToOnlineFO fo, HttpServletRequest request) {
String puid = (String) request.getAttribute(RdpUserService.PUID);
this.objectCacheDao.ownWorker(puid, fo.getWorkerId());
Expand All @@ -135,8 +135,8 @@ public ResWebData<?> waitToOnline(@Valid @RequestBody WaitToOnlineFO fo, HttpSer
}

@RequestAuth(DM_WORKER_READ)
@RequestMapping(value = "/downloadclienturl", method = RequestMethod.POST)
public ResWebData<?> downLoadClientUrl(@Valid @RequestBody ClientUrlFO fo, HttpServletRequest request) {
@RequestMapping(value = "/downloadClientUrl", method = RequestMethod.POST)
public ResWebData<?> downloadClientUrl(@Valid @RequestBody ClientUrlFO fo, HttpServletRequest request) {
String puid = (String) request.getAttribute(RdpUserService.PUID);
this.objectCacheDao.ownWorker(puid, fo.getWorkerId());

Expand All @@ -145,7 +145,7 @@ public ResWebData<?> downLoadClientUrl(@Valid @RequestBody ClientUrlFO fo, HttpS
}

@RequestAuth(level = HIGH, value = DM_WORKER_READ)
@RequestMapping(value = "/clientcoreconfig", method = RequestMethod.POST)
@RequestMapping(value = "/clientCoreConfig", method = RequestMethod.POST)
public ResWebData<?> clientCoreConfig(@Valid @RequestBody ClientCoreConfFO fo, HttpServletRequest request) {
String puid = (String) request.getAttribute(RdpUserService.PUID);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public class DmDsController {
private DmDsConfigService dmDsConfigService;

@RequestAuth(DM_DS_READ)
@RequestMapping(value = "/listbycondition", method = RequestMethod.POST)
@RequestMapping(value = "/listByCondition", method = RequestMethod.POST)
public ResWebData<?> listByCondition(@RequestBody @Valid ListDsFO listDsFO, HttpServletRequest request) {
String puid = (String) request.getAttribute(RdpUserService.PUID);
String uid = (String) request.getAttribute(RdpUserService.UID);
Expand Down Expand Up @@ -240,7 +240,7 @@ public ResWebData<?> disableDsDevOps(@Valid @RequestBody DisableDsDevOpsFO fo, H
}

@RequestAuth(DM_DS_READ)
@RequestMapping(value = "/querydsconfig", method = RequestMethod.POST)
@RequestMapping(value = "/queryDsConfig", method = RequestMethod.POST)
public ResWebData<?> queryDsConfig(@RequestBody QueryDsConfigFO fo, HttpServletRequest request) {
String uid = (String) request.getAttribute(RdpUserService.UID);
String puid = (String) request.getAttribute(RdpUserService.PUID);
Expand All @@ -256,7 +256,7 @@ public ResWebData<?> queryDsConfig(@RequestBody QueryDsConfigFO fo, HttpServletR
}

@RequestAuth(DM_DS_MANAGE)
@RequestMapping(value = "/connectds", method = RequestMethod.POST)
@RequestMapping(value = "/connectDs", method = RequestMethod.POST)
public ResWebData<?> connectDs(@Valid @RequestBody ConnectDsFO fo, HttpServletRequest request) {
String puid = (String) request.getAttribute(RdpUserService.PUID);
String uid = (String) request.getAttribute(RdpUserService.UID);
Expand All @@ -279,7 +279,7 @@ public ResWebData<?> connectDs(@Valid @RequestBody ConnectDsFO fo, HttpServletRe
}

@RequestAuth(value = DM_DS_MANAGE, level = HIGH)
@RequestMapping(value = "/upsertdsconfig", method = RequestMethod.POST)
@RequestMapping(value = "/upsertDsConfig", method = RequestMethod.POST)
public ResWebData<?> upsertDsConfig(@RequestBody UpsertDsConfigFO fo, HttpServletRequest request) {
String uid = (String) request.getAttribute(RdpUserService.UID);
String puid = (String) request.getAttribute(RdpUserService.PUID);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public class QueryEditorController {
private DmSupportSpiWrapper dmSupportSpiWrapper;

@RequestAuth(checkOpPassword = true, value = DM_QUERY_CONSOLE)
@RequestMapping(value = "/createsession", method = RequestMethod.POST)
@RequestMapping(value = "/createSession", method = RequestMethod.POST)
public ResWebData<?> createSession(@Valid @RequestBody CreateSessionFO fo, HttpServletRequest request) {
String puid = (String) request.getAttribute(RdpUserService.PUID);
String uid = (String) request.getAttribute(RdpUserService.UID);
Expand All @@ -116,7 +116,7 @@ public ResWebData<?> createSession(@Valid @RequestBody CreateSessionFO fo, HttpS
}

@RequestAuth(DM_QUERY_CONSOLE)
@RequestMapping(value = "/closesession", method = RequestMethod.POST)
@RequestMapping(value = "/closeSession", method = RequestMethod.POST)
public ResWebData<?> closeSession(@Valid @RequestBody CloseSessionFO fo, HttpServletRequest request) {
String puid = (String) request.getAttribute(RdpUserService.PUID);
String uid = (String) request.getAttribute(RdpUserService.UID);
Expand All @@ -125,16 +125,6 @@ public ResWebData<?> closeSession(@Valid @RequestBody CloseSessionFO fo, HttpSer
return ResWebDataUtils.buildSuccess(fo.getSessionId());
}

@RequestAuth(checkOpPassword = true, value = DM_QUERY_CONSOLE)
@RequestMapping(value = "/listsession", method = RequestMethod.POST)
public ResWebData<List<SessionVO>> sessionList(HttpServletRequest request) {
String puid = (String) request.getAttribute(RdpUserService.PUID);
String uid = (String) request.getAttribute(RdpUserService.UID);

List<SessionVO> vos = this.queryService.getSessionList(puid, uid);
return ResWebDataUtils.buildSuccess(vos);
}

@RequestAuth(checkOpPassword = true, value = DM_QUERY_CONSOLE)
@RequestMapping(value = "/fetchDsStatusConf", method = RequestMethod.POST)
public ResWebData<DsStatusConfVO> fetchDsStatusConf(@Valid @RequestBody AvailableDsFO fo, HttpServletRequest request) {
Expand Down Expand Up @@ -205,31 +195,6 @@ private static DsStatusSupportConfVO convertToSupportedInfoMap(String i18nKey, R
return vo;
}

@RequestAuth(DM_QUERY_CONSOLE)
@RequestMapping(value = "/rdbColumns", method = RequestMethod.POST)
public ResWebData<?> rdbColumns(@Valid @RequestBody BatchColumnsFO fo, HttpServletRequest request) {
String puid = (String) request.getAttribute(RdpUserService.PUID);
String uid = (String) request.getAttribute(RdpUserService.UID);

DsLevels levels = this.dmDsConfigService.parseLevels(fo.getLevels());
this.objectCacheDao.ownDataSource(puid, levels.dsDO().getId());

UmiTypes leafType = UmiTypes.valueOfCode(fo.getTargetType());
List<String> leafName = fo.getTargetNames();

leafName = leafName.stream().filter(tabName -> {
DsResPath dsResource = RdpAuthUtils.genResPathByList(levels.dbLevels(), tabName);
return this.dmAuthServiceForBiz.checkResPathWithoutError(puid, uid, levels.dsDO().getId(), AuthKind.DataSource, dsResource, SecDataAuthLabel.DM_DAUTH_QUERY);
}).collect(Collectors.toList());

if (leafName.isEmpty()) {
return ResWebDataUtils.buildSuccess(Collections.emptyMap());
}

Map<String, List<BrowseColumnMO>> result = this.queryService.rdbBatchColumns(puid, uid, levels, leafType, leafName);
return ResWebDataUtils.buildSuccess(result);
}

@RequestAuth(DM_QUERY_CONSOLE)
@RequestMapping(value = "/closeResultWindow", method = RequestMethod.POST)
public ResWebData<?> closeResultWindow(@Valid @RequestBody CloseResultWindowFO fo, HttpServletRequest request) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,63 +111,6 @@ public void stop() {

}

@RequestMapping(value = "/doQuery", method = RequestMethod.POST)
public ResWebData<?> doQuery(@RequestBody WsQueryFO wsQueryFO, HttpServletRequest request) {
if (!openTest) {
throw new UnsupportedOperationException();
}
String puid = (String) request.getAttribute(RdpUserService.PUID);
String uid = (String) request.getAttribute(RdpUserService.UID);

wsQueryFO.setCurrentUserId(uid);
wsQueryFO.setPrimaryUserId(puid);
wsQueryFO.setChannelKey(UUID.randomUUID().toString());

checkMap.put(wsQueryFO.getSessionId(), false);

this.queryServiceApi.offerQueryRequest(wsQueryFO, DmGlobalEventBus::triggerQueryResultEvent);
return ResWebDataUtils.buildSuccess();
}

@RequestMapping(value = "/queryResults", method = RequestMethod.POST)
public ResWebData<?> queryResults(@RequestBody QueryResultFO fo, HttpServletRequest request) {
if (!openTest) {
throw new UnsupportedOperationException();
}
QueryResultVO queryResultVO = new QueryResultVO();
String sessionId = fo.getSessionId();
if (checkMap.get(sessionId) == null || !checkMap.get(sessionId)) {
throw new ErrorMessageException("query is running");
}
checkMap.remove(sessionId);
List<WsQueryResult> wsResMsgs = map.remove(sessionId);

for (WsQueryResult wsResMsg : wsResMsgs) {
if (wsResMsg instanceof WsInfoResMsg wsInfoResMsg) {
for (WsInfoEntity entity : wsInfoResMsg.getEntities()) {
if (entity.getMode() == MessageMode.Console) {
queryResultVO.getWsInfoResMsgList().add(wsInfoResMsg);
}
}
} else if (wsResMsg instanceof WsResultSetMsg wsResultSetResMsg) {
queryResultVO.getResultSetResMsgList().add(wsResultSetResMsg);
} else if (wsResMsg instanceof WsStatusResMsg wsStatusResMsg) {
queryResultVO.getStatusResMsgList().add(wsStatusResMsg);
} else if (wsResMsg instanceof WsRuleResMsg wsRuleResMsg) {
queryResultVO.getWsRuleResMsgList().add(wsRuleResMsg);
}
}
return ResWebDataUtils.buildSuccess(queryResultVO);
}

@RequestMapping(value = "/checkQuery", method = RequestMethod.POST)
public ResWebData<?> checkQuery(@RequestBody QueryResultFO fo, HttpServletRequest request) {
if (!openTest) {
throw new UnsupportedOperationException();
}
return ResWebDataUtils.buildSuccess(checkMap.get(fo.getSessionId()));
}

@RequestAuth(strategy = RequestAuth.AuthStrategy.Ignore)
@RequestMapping(value = "/encrypt", method = RequestMethod.POST)
public ResWebData<?> encrypt(String password) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ private Object redirectOrDone(HttpServletRequest request, HttpServletResponse re
}

@RequestAuth(strategy = AuthStrategy.Ignore)
@RequestMapping(value = "/check_supplement", method = { RequestMethod.POST })
@RequestMapping(value = "/checkSupplement", method = { RequestMethod.POST })
public ResWebData<?> checkSupplement(@Valid @RequestBody CheckSubAccountBindInfoFO checkFO, HttpServletResponse response) {
String puid = checkFO.getPrimaryUid();
CheckSubAccountMO re = userService.checkSubAccount(puid, checkFO);
Expand Down Expand Up @@ -318,7 +318,7 @@ protected void fillResponseJwtToken(String token, HttpServletResponse response)
}

@RequestAuth(strategy = RequestAuth.AuthStrategy.Ignore)
@RequestMapping(value = DmControllerUrlPrefix.CONSOLE_PREFIX + "/dm_global_settings", method = { RequestMethod.POST })
@RequestMapping(value = DmControllerUrlPrefix.CONSOLE_PREFIX + "/dmGlobalSettings", method = { RequestMethod.POST })
public ResWebData<?> dmGlobalSettings() {
GlobalSettingsVO vo = new GlobalSettingsVO();
vo.setVersion(GlobalConfUtils.getAppVersion());
Expand All @@ -337,7 +337,7 @@ public ResWebData<?> dmGlobalSettings() {
}

@RequestAuth(strategy = AuthStrategy.Ignore)
@RequestMapping(value = "/global_settings", method = { RequestMethod.POST })
@RequestMapping(value = "/globalSettings", method = { RequestMethod.POST })
public ResWebData<?> globalSettings(HttpServletRequest request, HttpServletResponse response) {
RdpGlobalSettingsVO settings = new RdpGlobalSettingsVO();
settings.setFeatures(new HashMap<>());
Expand All @@ -354,7 +354,7 @@ public ResWebData<?> globalSettings(HttpServletRequest request, HttpServletRespo
}

@RequestAuth(strategy = RequestAuth.AuthStrategy.Ignore)
@RequestMapping(value = DmControllerUrlPrefix.CONSOLE_PREFIX + "/dm_console_settings", method = { RequestMethod.POST })
@RequestMapping(value = DmControllerUrlPrefix.CONSOLE_PREFIX + "/dmConsoleSettings", method = { RequestMethod.POST })
public ResWebData<?> dmConsoleSettings(HttpServletRequest request) {
String puid = (String) request.getAttribute(RdpUserService.PUID);
String uid = (String) request.getAttribute(RdpUserService.UID);
Expand Down
Loading