Bladeren bron

应用接口

master
PoffyZhang 1 jaar geleden
bovenliggende
commit
b902a510a9
3 gewijzigde bestanden met toevoegingen van 31 en 10 verwijderingen
  1. +2
    -2
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/controller/ProjectApplicationController.java
  2. +28
    -7
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ApplicationManage.java
  3. +1
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java

+ 2
- 2
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/controller/ProjectApplicationController.java Bestand weergeven

@@ -24,10 +24,10 @@ public class ProjectApplicationController {

private final ApplicationManage applicationManage;

@GetMapping("/get-report")
@GetMapping("/get-report/{appCode}")
@ApiOperation("获取应用 试运行报告")
@WebLog("获取应用 试运行报告")
public String getReport(@RequestParam(required = false) String appCode) {
public String getReport(@PathVariable String appCode) {
return applicationManage.getReport(appCode);
}



+ 28
- 7
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ApplicationManage.java Bestand weergeven

@@ -1,7 +1,12 @@
package com.ningdatech.pmapi.projectlib.manage;

import cn.hutool.core.collection.CollUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.ningdatech.basic.exception.BizException;
import com.ningdatech.basic.function.VUtils;
import com.ningdatech.basic.model.ApiResponse;
import com.ningdatech.pmapi.common.util.HmacAuthUtil;
import com.ningdatech.pmapi.projectlib.model.dto.ApplicationAppCodeSaveDTO;
import com.ningdatech.pmapi.projectlib.model.entity.ProjectApplication;
@@ -9,11 +14,9 @@ import com.ningdatech.pmapi.projectlib.service.IProjectApplicationService;
import com.ningdatech.pmapi.user.util.LoginUserUtil;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.ResponseEntity;
import org.springframework.http.*;
import org.springframework.stereotype.Component;
import org.springframework.util.MultiValueMap;
import org.springframework.web.client.RestTemplate;
@@ -85,11 +88,29 @@ public class ApplicationManage {
HttpEntity<MultiValueMap<String, Object>> formEntity = new HttpEntity<MultiValueMap<String, Object>>(headers);

RestTemplate restTemplate = new RestTemplate();
ResponseEntity<String> forEntity = restTemplate.exchange(url, HttpMethod.GET,formEntity, String.class);
ResponseEntity<ApiResponse> forEntity = restTemplate.exchange(appUrl, HttpMethod.GET,formEntity, ApiResponse.class);

log.info("body:",forEntity.getBody());
String body = forEntity.getBody();
ApiResponse body = forEntity.getBody();

return null;
if(!body.getCode().equals(HttpStatus.OK.value())){
throw new BizException(body.getMessage());
}

Object data = body.getData();
if(Objects.nonNull(data)){
JSONObject dataJson = JSON.parseObject(JSON.toJSONString(data));
JSONArray resourceList = dataJson.getJSONArray("resourceList");
if(CollUtil.isNotEmpty(resourceList)){
JSONObject resource = JSON.parseObject(JSON.toJSONString(resourceList.get(0)));
if(StringUtils.isBlank(resource.getString("reportOss"))){
//暂时没有 appCode 所以先返回测试数据
return "https://irs-yyyw.oss-cn-hangzhou-zwynet-d01-a.internet.cloud.zj.gov.cn/tmp/%E6%B8%A9%E5%B7%9E%E5%B8%82%E4%B9%90%E6%B8%85%E5%B8%82%E5%8C%BA%E5%9F%9F%E4%BD%93%E6%A3%80%E4%BF%A1%E6%81%AF%E7%B3%BB%E7%BB%9F_9cf0b901f2ca4fbf8ff274da359ad219.html?Expires=1687833685&OSSAccessKeyId=wMhEw2BhpIDc1xwO&Signature=UPAbMdDy23FI1sNemszg5WH%2BG40%3D";
}else{
return resource.getString("reportOss");
}
}
}
throw new BizException("获取报告失败!");
}
}

+ 1
- 1
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java Bestand weergeven

@@ -731,7 +731,7 @@ public class ProjectLibManage {

if(StringUtils.isNotBlank(req.getApplicationName())){
wrapper.and(q1 -> q1.like(ProjectApplication::getApplicationName,req.getApplicationName())
.or(q2 -> q2.like(ProjectApplication::getAccountAppName,req.getApplicationName())));
.or(q2 -> q2.like(ProjectApplication::getRelatedExistsApplication,req.getApplicationName())));
}
wrapper.orderByDesc(ProjectApplication::getUpdateOn);
projectApplicationService.page(page,wrapper);


Laden…
Annuleren
Opslaan