|
|
|
@ -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<VectorParamMapper, VectorParamEntity> implements VectorParamService { |
|
|
|
|
|
|
|
|
|
private static final String CLIENT_SIGN = "vector_param"; |
|
|
|
@ -29,13 +33,27 @@ public class VectorParamServiceImpl extends ServiceImpl<VectorParamMapper, Vecto
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public Map getUrlResponse(String url, String token) { |
|
|
|
|
public Map getUrlResponse(String url, String bladeToken, String hzinfoToken) { |
|
|
|
|
HttpResponse response = HttpRequest.get(url) |
|
|
|
|
.header("Authorization", getAuthorization()) |
|
|
|
|
.header("Blade-Auth", token).execute(); |
|
|
|
|
.header("Blade-Auth", bladeToken) |
|
|
|
|
.header("Hzinfo-Auth", hzinfoToken).execute(); |
|
|
|
|
if (response.getStatus() == HttpServletResponse.SC_OK) { |
|
|
|
|
return JsonUtil.toMap(response.body()); |
|
|
|
|
} |
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public List<String> getUrlResponseKeyList(String url, String bladeToken, String hzinfoToken) { |
|
|
|
|
List<String> result = new ArrayList<>(); |
|
|
|
|
Map map = getUrlResponse(url, bladeToken, hzinfoToken); |
|
|
|
|
Map<String, Object> data = ((Map<String, Object>) map.get("data")); |
|
|
|
|
if (data != null) { |
|
|
|
|
result.addAll(data.keySet()); |
|
|
|
|
} else { |
|
|
|
|
result.addAll(map.keySet()); |
|
|
|
|
} |
|
|
|
|
return result; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|