From 9589a869065ac7808b72a99c9454dc4cd1485ec5 Mon Sep 17 00:00:00 2001 From: luyie Date: Wed, 4 Sep 2024 17:05:03 +0800 Subject: [PATCH] =?UTF-8?q?add:=E5=A4=A7=E6=A8=A1=E5=9E=8B=EF=BC=8C?= =?UTF-8?q?=E5=90=91=E9=87=8F=E9=85=8D=E7=BD=AE=EF=BC=8C=E5=BC=80=E6=94=BE?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E9=89=B4=E6=9D=83=EF=BC=8C=E5=85=BC=E5=AE=B9?= =?UTF-8?q?hzinfo-auth=E5=92=8Cblade-auth?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/VectorParamController.java | 15 +++++++++++++-- .../maintenance/service/VectorParamService.java | 5 ++++- .../service/impl/VectorParamServiceImpl.java | 22 ++++++++++++++++++++-- 3 files changed, 37 insertions(+), 5 deletions(-) diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/controller/VectorParamController.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/controller/VectorParamController.java index 86b9031..52c04f0 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/controller/VectorParamController.java +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/controller/VectorParamController.java @@ -17,6 +17,7 @@ import org.springblade.core.tool.utils.Func; import org.springframework.web.bind.annotation.*; import java.util.HashMap; +import java.util.List; import java.util.Map; /** @@ -76,8 +77,10 @@ public class VectorParamController { @GetMapping("/getUrlResponse") @ApiOperation(value = "通过url获取向量参数数据") @ApiOperationSupport(order = 7) - public R getUrlResponse(@RequestParam String url, @RequestHeader("Blade-Auth") String token) { - return R.data(vectorParamService.getUrlResponse(url, token)); + public R getUrlResponse(@RequestParam String url, + @RequestHeader(name = "Blade-Auth", value = "Blade-Auth", required = false) String bladeToken, + @RequestHeader(name = "Hzinfo-Auth", value = "Hzinfo-Auth", required = false) String hzinfoToken) { + return R.data(vectorParamService.getUrlResponse(url, bladeToken, hzinfoToken)); } @GetMapping("/getTestData") @@ -91,4 +94,12 @@ public class VectorParamController { data.put("data", "data"); return R.data(data); } + + @GetMapping("/getUrlResponseKeyList") + @ApiOperation(value = "获取url返回的key列表") + public R> getUrlResponseKeyList(@RequestParam String url, + @RequestHeader(name = "Blade-Auth", value = "Blade-Auth", required = false) String bladeToken, + @RequestHeader(name = "Hzinfo-Auth", value = "Hzinfo-Auth", required = false) String hzinfoToken) { + return R.data(vectorParamService.getUrlResponseKeyList(url, bladeToken, hzinfoToken)); + } } diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/service/VectorParamService.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/service/VectorParamService.java index 392a877..4fac0be 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/service/VectorParamService.java +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/service/VectorParamService.java @@ -3,6 +3,7 @@ package com.hnac.hzims.bigmodel.maintenance.service; import com.baomidou.mybatisplus.extension.service.IService; import com.hnac.hzims.bigmodel.maintenance.entity.VectorParamEntity; +import java.util.List; import java.util.Map; /** @@ -13,5 +14,7 @@ import java.util.Map; public interface VectorParamService extends IService { String getAuthorization(); - Map getUrlResponse(String url, String token); + Map getUrlResponse(String url, String bladeToken ,String hzinfoToken); + + List getUrlResponseKeyList(String url, String bladeToken, String hzinfoToken); } diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/service/impl/VectorParamServiceImpl.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/service/impl/VectorParamServiceImpl.java index 65e2545..0878002 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/service/impl/VectorParamServiceImpl.java +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/service/impl/VectorParamServiceImpl.java @@ -6,12 +6,15 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.hnac.hzims.bigmodel.maintenance.entity.VectorParamEntity; import com.hnac.hzims.bigmodel.maintenance.mapper.VectorParamMapper; import com.hnac.hzims.bigmodel.maintenance.service.VectorParamService; +import lombok.extern.slf4j.Slf4j; import org.springblade.core.tool.jackson.JsonUtil; import org.springframework.stereotype.Service; import javax.servlet.http.HttpServletResponse; import java.nio.charset.StandardCharsets; +import java.util.ArrayList; import java.util.Base64; +import java.util.List; import java.util.Map; /** @@ -19,6 +22,7 @@ import java.util.Map; * @Date: 2024/9/2 16:14 */ @Service +@Slf4j public class VectorParamServiceImpl extends ServiceImpl implements VectorParamService { private static final String CLIENT_SIGN = "vector_param"; @@ -29,13 +33,27 @@ public class VectorParamServiceImpl extends ServiceImpl getUrlResponseKeyList(String url, String bladeToken, String hzinfoToken) { + List result = new ArrayList<>(); + Map map = getUrlResponse(url, bladeToken, hzinfoToken); + Map data = ((Map) map.get("data")); + if (data != null) { + result.addAll(data.keySet()); + } else { + result.addAll(map.keySet()); + } + return result; + } }