|
@@ -5,13 +5,11 @@ import com.alibaba.fastjson.JSON; |
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
import com.ningdatech.basic.function.VUtils; |
|
|
import com.ningdatech.basic.function.VUtils; |
|
|
import com.ningdatech.pmapi.common.enumeration.CommonEnum; |
|
|
import com.ningdatech.pmapi.common.enumeration.CommonEnum; |
|
|
|
|
|
import com.ningdatech.pmapi.common.statemachine.contants.RegionContant; |
|
|
import com.ningdatech.pmapi.common.statemachine.util.StateMachineUtils; |
|
|
import com.ningdatech.pmapi.common.statemachine.util.StateMachineUtils; |
|
|
import com.ningdatech.pmapi.common.util.CryptUtils; |
|
|
import com.ningdatech.pmapi.common.util.CryptUtils; |
|
|
import com.ningdatech.pmapi.common.util.RefreshKeyUtil; |
|
|
import com.ningdatech.pmapi.common.util.RefreshKeyUtil; |
|
|
import com.ningdatech.pmapi.irs.model.dto.ApiApplyDTO; |
|
|
|
|
|
import com.ningdatech.pmapi.irs.model.dto.ApiApplySearchResult; |
|
|
|
|
|
import com.ningdatech.pmapi.irs.model.dto.ApiSearchResult; |
|
|
|
|
|
import com.ningdatech.pmapi.irs.model.dto.PushProjectAppToIrsDTO; |
|
|
|
|
|
|
|
|
import com.ningdatech.pmapi.irs.model.dto.*; |
|
|
import com.ningdatech.pmapi.irs.model.res.ApiResponse; |
|
|
import com.ningdatech.pmapi.irs.model.res.ApiResponse; |
|
|
import com.ningdatech.pmapi.projectlib.model.entity.Project; |
|
|
import com.ningdatech.pmapi.projectlib.model.entity.Project; |
|
|
import com.ningdatech.pmapi.projectlib.model.entity.ProjectApplication; |
|
|
import com.ningdatech.pmapi.projectlib.model.entity.ProjectApplication; |
|
@@ -154,38 +152,43 @@ public class AppIrsManage { |
|
|
public ApiApplySearchResult searchApp(ApiApplyDTO apply) throws NoSuchAlgorithmException { |
|
|
public ApiApplySearchResult searchApp(ApiApplyDTO apply) throws NoSuchAlgorithmException { |
|
|
long timestamp = System.currentTimeMillis(); |
|
|
long timestamp = System.currentTimeMillis(); |
|
|
String appCode = apply.getAppId(); |
|
|
String appCode = apply.getAppId(); |
|
|
|
|
|
|
|
|
|
|
|
String areaCode = RegionContant.LS_SC_CODE; |
|
|
String requestSecret = RefreshKeyUtil.getRequestSecret(searchAppKey, searchAppScret); |
|
|
String requestSecret = RefreshKeyUtil.getRequestSecret(searchAppKey, searchAppScret); |
|
|
String sign = CryptUtils.MD5Encode(searchAppKey + requestSecret + timestamp); |
|
|
String sign = CryptUtils.MD5Encode(searchAppKey + requestSecret + timestamp); |
|
|
String url = searchUrl + "?requestTime=" + timestamp + "&sign=" + sign + |
|
|
String url = searchUrl + "?requestTime=" + timestamp + "&sign=" + sign + |
|
|
"&appKey=" + searchAppKey + "&" + |
|
|
"&appKey=" + searchAppKey + "&" + |
|
|
"pageSize=10&pageNum=1&appCode=" + appCode; |
|
|
|
|
|
|
|
|
"pageSize=10&pageNum=1&appCode=" + appCode + |
|
|
|
|
|
"&areaCode=" + areaCode + "&deptCode=&name="; |
|
|
|
|
|
log.info("url : {}",url); |
|
|
RestTemplate restTemplate = new RestTemplate(); |
|
|
RestTemplate restTemplate = new RestTemplate(); |
|
|
ResponseEntity<ApiSearchResult> forEntity = restTemplate.getForEntity(url, ApiSearchResult.class); |
|
|
|
|
|
|
|
|
ResponseEntity<ApiDTO> forEntity = restTemplate.getForEntity(url, ApiDTO.class); |
|
|
|
|
|
|
|
|
log.info("查询应用目录 : {}",JSON.toJSONString(forEntity)); |
|
|
log.info("查询应用目录 : {}",JSON.toJSONString(forEntity)); |
|
|
|
|
|
|
|
|
if(Objects.nonNull(forEntity.getBody()) && CollUtil.isNotEmpty(forEntity.getBody().getApiApplySearchResult())){ |
|
|
|
|
|
return forEntity.getBody().getApiApplySearchResult().get(0); |
|
|
|
|
|
|
|
|
if(Objects.nonNull(forEntity.getBody()) && Objects.nonNull(forEntity.getBody().getDatas()) |
|
|
|
|
|
&& CollUtil.isNotEmpty(forEntity.getBody().getDatas().getApiApplySearchResult())){ |
|
|
|
|
|
return forEntity.getBody().getDatas().getApiApplySearchResult().get(0); |
|
|
} |
|
|
} |
|
|
return null; |
|
|
return null; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public List<ApiApplySearchResult> searchApps(ApiApplyDTO apply) throws NoSuchAlgorithmException { |
|
|
public List<ApiApplySearchResult> searchApps(ApiApplyDTO apply) throws NoSuchAlgorithmException { |
|
|
long timestamp = System.currentTimeMillis(); |
|
|
long timestamp = System.currentTimeMillis(); |
|
|
|
|
|
|
|
|
|
|
|
String areaCode = RegionContant.LS_SC_CODE; |
|
|
String requestSecret = RefreshKeyUtil.getRequestSecret(searchAppKey, searchAppScret); |
|
|
String requestSecret = RefreshKeyUtil.getRequestSecret(searchAppKey, searchAppScret); |
|
|
String sign = CryptUtils.MD5Encode(searchAppKey + requestSecret + timestamp); |
|
|
String sign = CryptUtils.MD5Encode(searchAppKey + requestSecret + timestamp); |
|
|
String url = searchUrl + "?requestTime=" + timestamp + "&sign=" + sign + |
|
|
String url = searchUrl + "?requestTime=" + timestamp + "&sign=" + sign + |
|
|
"&appKey=" + searchAppKey + "&" + |
|
|
"&appKey=" + searchAppKey + "&" + |
|
|
"pageSize=100&pageNum=1"; |
|
|
|
|
|
|
|
|
"pageSize=100&pageNum=1&areaCode=" + areaCode + |
|
|
|
|
|
"&deptCode=&name="; |
|
|
RestTemplate restTemplate = new RestTemplate(); |
|
|
RestTemplate restTemplate = new RestTemplate(); |
|
|
ResponseEntity<ApiSearchResult> forEntity = restTemplate.getForEntity(url, ApiSearchResult.class); |
|
|
|
|
|
|
|
|
ResponseEntity<ApiDTO> forEntity = restTemplate.getForEntity(url, ApiDTO.class); |
|
|
|
|
|
|
|
|
log.info("查询应用目录 : {}",JSON.toJSONString(forEntity)); |
|
|
log.info("查询应用目录 : {}",JSON.toJSONString(forEntity)); |
|
|
|
|
|
|
|
|
if(Objects.nonNull(forEntity.getBody()) && CollUtil.isNotEmpty(forEntity.getBody().getApiApplySearchResult())){ |
|
|
|
|
|
return forEntity.getBody().getApiApplySearchResult(); |
|
|
|
|
|
|
|
|
if(Objects.nonNull(forEntity.getBody()) && Objects.nonNull(forEntity.getBody().getDatas()) |
|
|
|
|
|
&& CollUtil.isNotEmpty(forEntity.getBody().getDatas().getApiApplySearchResult())){ |
|
|
|
|
|
return forEntity.getBody().getDatas().getApiApplySearchResult(); |
|
|
} |
|
|
} |
|
|
return Collections.emptyList(); |
|
|
return Collections.emptyList(); |
|
|
} |
|
|
} |
|
|