Browse Source

api 实体 irs

tags/24080901
PoffyZhang 1 year ago
parent
commit
b43c7dff4b
7 changed files with 45 additions and 13 deletions
  1. +1
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/irs/controller/IrsController.java
  2. +7
    -7
      pmapi/src/main/java/com/ningdatech/pmapi/irs/manage/AppIrsManage.java
  3. +7
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/irs/model/dto/ApiApplyDTO.java
  4. +10
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/irs/model/dto/ApiApplySearchResult.java
  5. +8
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/irs/model/dto/ApiDTO.java
  6. +9
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/irs/model/dto/ApiSearchResult.java
  7. +3
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/irs/model/dto/PushProjectAppToIrsDTO.java

pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/controller/IrsController.java → pmapi/src/main/java/com/ningdatech/pmapi/irs/controller/IrsController.java View File

@@ -1,4 +1,4 @@
package com.ningdatech.pmapi.projectdeclared.controller;
package com.ningdatech.pmapi.irs.controller;


import com.ningdatech.log.annotation.WebLog; import com.ningdatech.log.annotation.WebLog;
import com.ningdatech.pmapi.projectdeclared.manage.IrsManage; import com.ningdatech.pmapi.projectdeclared.manage.IrsManage;

+ 7
- 7
pmapi/src/main/java/com/ningdatech/pmapi/irs/manage/AppIrsManage.java View File

@@ -152,20 +152,19 @@ 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=";
"&areaCode=&deptCode=&name=";
log.info("url : {}",url); log.info("url : {}",url);
RestTemplate restTemplate = new RestTemplate(); RestTemplate restTemplate = new RestTemplate();
ResponseEntity<ApiDTO> forEntity = restTemplate.getForEntity(url, ApiDTO.class); ResponseEntity<ApiDTO> forEntity = restTemplate.getForEntity(url, ApiDTO.class);


log.info("查询应用目录 : {}",JSON.toJSONString(forEntity)); log.info("查询应用目录 : {}",JSON.toJSONString(forEntity));


if(Objects.nonNull(forEntity.getBody()) && Objects.nonNull(forEntity.getBody().getData())
if(Objects.nonNull(forEntity.getBody()) && Objects.nonNull(forEntity.getBody().getDatas())
&& CollUtil.isNotEmpty(forEntity.getBody().getDatas().getApiApplySearchResult())){ && CollUtil.isNotEmpty(forEntity.getBody().getDatas().getApiApplySearchResult())){
return forEntity.getBody().getDatas().getApiApplySearchResult().get(0); return forEntity.getBody().getDatas().getApiApplySearchResult().get(0);
} }
@@ -174,19 +173,20 @@ public class AppIrsManage {


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 areaCode = StringUtils.isNotBlank(apply.getAreaCode()) ?
apply.getAreaCode() : null;
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 + "&" +
"pageSize=100&pageNum=1&areaCode=" + areaCode +
"&appKey=" + searchAppKey + "&pageSize=1000&" +
"pageNum=1&areaCode=" + areaCode +
"&deptCode=&name="; "&deptCode=&name=";
RestTemplate restTemplate = new RestTemplate(); RestTemplate restTemplate = new RestTemplate();
ResponseEntity<ApiDTO> forEntity = restTemplate.getForEntity(url, ApiDTO.class); ResponseEntity<ApiDTO> forEntity = restTemplate.getForEntity(url, ApiDTO.class);


log.info("查询应用目录 : {}",JSON.toJSONString(forEntity)); log.info("查询应用目录 : {}",JSON.toJSONString(forEntity));


if(Objects.nonNull(forEntity.getBody()) && Objects.nonNull(forEntity.getBody().getData())
if(Objects.nonNull(forEntity.getBody()) && Objects.nonNull(forEntity.getBody().getDatas())
&& CollUtil.isNotEmpty(forEntity.getBody().getDatas().getApiApplySearchResult())){ && CollUtil.isNotEmpty(forEntity.getBody().getDatas().getApiApplySearchResult())){
return forEntity.getBody().getDatas().getApiApplySearchResult(); return forEntity.getBody().getDatas().getApiApplySearchResult();
} }


+ 7
- 1
pmapi/src/main/java/com/ningdatech/pmapi/irs/model/dto/ApiApplyDTO.java View File

@@ -2,8 +2,13 @@ package com.ningdatech.pmapi.irs.model.dto;


import lombok.Data; import lombok.Data;


import java.io.Serializable;

@Data @Data
public class ApiApplyDTO {
public class ApiApplyDTO implements Serializable {

private static final long serialVersionUID = 1L;

private int id; private int id;
private String orgId; private String orgId;
private String userId; private String userId;
@@ -21,6 +26,7 @@ public class ApiApplyDTO {
private String deployType; private String deployType;
private String principal; private String principal;
private String employeeCode; private String employeeCode;
private String areaCode;
private String areaName; private String areaName;
private String createTime; private String createTime;
private String modifiedTime; private String modifiedTime;


+ 10
- 1
pmapi/src/main/java/com/ningdatech/pmapi/irs/model/dto/ApiApplySearchResult.java View File

@@ -1,9 +1,18 @@
package com.ningdatech.pmapi.irs.model.dto; package com.ningdatech.pmapi.irs.model.dto;


import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;


@Data @Data
public class ApiApplySearchResult {
@AllArgsConstructor
@NoArgsConstructor
public class ApiApplySearchResult implements Serializable {

private static final long serialVersionUID = 1L;

private int id; private int id;
private String orgId; private String orgId;
private String userId; private String userId;


+ 8
- 1
pmapi/src/main/java/com/ningdatech/pmapi/irs/model/dto/ApiDTO.java View File

@@ -1,8 +1,11 @@
package com.ningdatech.pmapi.irs.model.dto; package com.ningdatech.pmapi.irs.model.dto;


import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.poi.ss.formula.functions.T; import org.apache.poi.ss.formula.functions.T;


import java.io.Serializable;
import java.util.List; import java.util.List;


/** /**
@@ -12,7 +15,11 @@ import java.util.List;
* @Author PoffyZhang * @Author PoffyZhang
*/ */
@Data @Data
public class ApiDTO {
@AllArgsConstructor
@NoArgsConstructor
public class ApiDTO implements Serializable {
private static final long serialVersionUID = 1L;

private String code; private String code;
private String msg; private String msg;
private String data; private String data;


+ 9
- 1
pmapi/src/main/java/com/ningdatech/pmapi/irs/model/dto/ApiSearchResult.java View File

@@ -1,11 +1,19 @@
package com.ningdatech.pmapi.irs.model.dto; package com.ningdatech.pmapi.irs.model.dto;


import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor;


import java.io.Serializable;
import java.util.List; import java.util.List;


@Data @Data
public class ApiSearchResult {
@AllArgsConstructor
@NoArgsConstructor
public class ApiSearchResult implements Serializable {

private static final long serialVersionUID = 1L;

private Boolean success; private Boolean success;
private Integer code; private Integer code;
private String message; private String message;


+ 3
- 1
pmapi/src/main/java/com/ningdatech/pmapi/irs/model/dto/PushProjectAppToIrsDTO.java View File

@@ -8,6 +8,7 @@ import lombok.NoArgsConstructor;


import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
import java.io.Serializable;


/** /**
* @Classname PushProjectAppToIrsDto * @Classname PushProjectAppToIrsDto
@@ -19,7 +20,8 @@ import javax.validation.constraints.NotNull;
@Builder @Builder
@AllArgsConstructor @AllArgsConstructor
@NoArgsConstructor @NoArgsConstructor
public class PushProjectAppToIrsDTO {
public class PushProjectAppToIrsDTO implements Serializable {
private static final long serialVersionUID = 1L;


@ApiModelProperty("我们系统的appId") @ApiModelProperty("我们系统的appId")
@NotNull(message = "appId 不能为空") @NotNull(message = "appId 不能为空")


Loading…
Cancel
Save