From 18c713238d5be4f03983fdab7ab52bfec2a14af9 Mon Sep 17 00:00:00 2001 From: guoyuqi Date: Wed, 5 Jun 2024 11:31:05 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E7=B3=BB=E7=BB=9F=E7=AE=A1=E7=90=86):=20?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E9=92=89=E9=92=89=E7=99=BB=E9=99=86=E4=BB=A5?= =?UTF-8?q?=E5=8F=8A=E4=BF=AE=E5=A4=8D=E8=84=91=E5=9B=BE=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E7=94=A8=E4=BE=8B=E9=87=8D=E5=A4=8D=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sdk/util/FilterChainUtils.java | 2 +- .../service/FunctionalCaseMinderService.java | 28 +++++++++++++------ frontend/src/api/requrls/user.ts | 2 +- frontend/src/models/user.ts | 2 +- .../views/login/components/dingTalkQrCode.vue | 4 ++- .../src/views/login/components/tabQrCode.vue | 15 ++++++++-- 6 files changed, 38 insertions(+), 15 deletions(-) diff --git a/backend/framework/sdk/src/main/java/io/metersphere/sdk/util/FilterChainUtils.java b/backend/framework/sdk/src/main/java/io/metersphere/sdk/util/FilterChainUtils.java index de0febe456..6b403cfa1f 100644 --- a/backend/framework/sdk/src/main/java/io/metersphere/sdk/util/FilterChainUtils.java +++ b/backend/framework/sdk/src/main/java/io/metersphere/sdk/util/FilterChainUtils.java @@ -14,7 +14,7 @@ public class FilterChainUtils { filterChainDefinitionMap.put("/we_com/info", "anon"); filterChainDefinitionMap.put("/ding_talk/info", "anon"); filterChainDefinitionMap.put("/sso/callback/we_com", "anon"); - filterChainDefinitionMap.put("/auth", "anon"); + filterChainDefinitionMap.put("/sso/callback/ding_talk", "anon"); filterChainDefinitionMap.put("/setting/get/platform/param", "anon"); filterChainDefinitionMap.put("/signout", "anon"); filterChainDefinitionMap.put("/is-login", "anon"); diff --git a/backend/services/case-management/src/main/java/io/metersphere/functional/service/FunctionalCaseMinderService.java b/backend/services/case-management/src/main/java/io/metersphere/functional/service/FunctionalCaseMinderService.java index 6f498b1bed..c56c4f28a7 100644 --- a/backend/services/case-management/src/main/java/io/metersphere/functional/service/FunctionalCaseMinderService.java +++ b/backend/services/case-management/src/main/java/io/metersphere/functional/service/FunctionalCaseMinderService.java @@ -301,15 +301,7 @@ public class FunctionalCaseMinderService { Map customFieldNameMap = getCustomFieldNameMap(request); List addList = resourceMap.get(OperationLogType.ADD.toString()); List updatePosList = new ArrayList<>(); - CustomFieldExample customFieldExample = new CustomFieldExample(); - customFieldExample.createCriteria().andNameEqualTo("functional_priority").andSceneEqualTo(TemplateScene.FUNCTIONAL.toString()).andInternalEqualTo(true); - List defaultCustomFields = customFieldMapper.selectByExample(customFieldExample); - CustomField customField = defaultCustomFields.get(0); - TemplateDTO defaultTemplateDTO = projectTemplateService.getDefaultTemplateDTO(request.getProjectId(), TemplateScene.FUNCTIONAL.toString()); - List customFields = defaultTemplateDTO.getCustomFields(); - Map defaultValueMap = customFields.stream().filter(t -> t.getDefaultValue() != null).collect(Collectors.toMap(TemplateCustomFieldDTO::getFieldId, TemplateCustomFieldDTO::getDefaultValue)); - defaultValueMap.putIfAbsent(customField.getId(), "P0"); - + Map defaultValueMap = getDefaultValueMap(request); if (CollectionUtils.isNotEmpty(addList)) { Map> moduleCaseMap = getModuleCaseMap(addList); for (FunctionalCaseChangeRequest functionalCaseChangeRequest : addList) { @@ -399,6 +391,24 @@ public class FunctionalCaseMinderService { commonNoticeSendService.sendNotice(NoticeConstants.TaskType.FUNCTIONAL_CASE_TASK, NoticeConstants.Event.UPDATE, resources, user, request.getProjectId()); } + @NotNull + private Map getDefaultValueMap(FunctionalCaseMinderEditRequest request) { + TemplateDTO defaultTemplateDTO = projectTemplateService.getDefaultTemplateDTO(request.getProjectId(), TemplateScene.FUNCTIONAL.toString()); + List customFields = defaultTemplateDTO.getCustomFields(); + Map defaultValueMap = new HashMap<>(); + for (TemplateCustomFieldDTO field : customFields) { + if (StringUtils.equalsIgnoreCase(field.getFieldName(), "functional_priority")) { + if (field.getDefaultValue() == null) { + field.setDefaultValue("P0"); + } + } + if (field.getDefaultValue() != null) { + defaultValueMap.put(field.getFieldId(), field.getDefaultValue()); + } + } + return defaultValueMap; + } + private void dealAdditionalNode(FunctionalCaseMinderEditRequest request, String userId, MindAdditionalNodeMapper additionalNodeMapper, Map newModuleMap) { if (CollectionUtils.isNotEmpty(request.getAdditionalNodeList())) { List updatePosList = new ArrayList<>(); diff --git a/frontend/src/api/requrls/user.ts b/frontend/src/api/requrls/user.ts index 87f42c3a5c..6c3ab64430 100644 --- a/frontend/src/api/requrls/user.ts +++ b/frontend/src/api/requrls/user.ts @@ -30,4 +30,4 @@ export const GetWeComInfoUrl = '/we_com/info'; // 获取企业微信登陆的配 export const GetWeComCallbackUrl = '/sso/callback/we_com'; // 获取企业微信登陆的回调信息 export const GetPlatformParamUrl = '/setting/get/platform/param'; export const GeDingInfoUrl = '/ding_talk/info'; // 获取企业微信登陆的配置信息 -export const GetDingCallbackUrl = '/auth'; // 获取企业微信登陆的回调信息 +export const GetDingCallbackUrl = '/sso/callback/ding_talk'; // 获取企业微信登陆的回调信息 diff --git a/frontend/src/models/user.ts b/frontend/src/models/user.ts index bb05ac3b98..9037925324 100644 --- a/frontend/src/models/user.ts +++ b/frontend/src/models/user.ts @@ -23,7 +23,7 @@ export interface WecomInfo { // 企业微信对接信息 export interface DingInfo { - agentId?: string; + appKey?: string; state?: string; callBack?: string; } diff --git a/frontend/src/views/login/components/dingTalkQrCode.vue b/frontend/src/views/login/components/dingTalkQrCode.vue index 13a86603a9..d46b6de9c1 100644 --- a/frontend/src/views/login/components/dingTalkQrCode.vue +++ b/frontend/src/views/login/components/dingTalkQrCode.vue @@ -37,7 +37,7 @@ }, { redirect_uri: url, - client_id: data.agentId ? data.agentId : '', + client_id: data.appKey ? data.appKey : '', scope: 'openid', response_type: 'code', state: 'fit2cloud-ding-qr', @@ -45,6 +45,8 @@ }, async (loginResult) => { const { redirectUrl, authCode, state } = loginResult; + console.log('authCode'); + console.log(authCode); const dingCallback = getDingCallback(authCode); userStore.qrCodeLogin(await dingCallback); Message.success(t('login.form.login.success')); diff --git a/frontend/src/views/login/components/tabQrCode.vue b/frontend/src/views/login/components/tabQrCode.vue index e09f786577..07db310cd0 100644 --- a/frontend/src/views/login/components/tabQrCode.vue +++ b/frontend/src/views/login/components/tabQrCode.vue @@ -1,7 +1,7 @@