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.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 {
long timestamp = System.currentTimeMillis();
String appCode = apply.getAppId();
String areaCode = RegionContant.LS_SC_CODE;
String requestSecret = RefreshKeyUtil.getRequestSecret(searchAppKey, searchAppScret);
String sign = CryptUtils.MD5Encode(searchAppKey + requestSecret + timestamp);
String url = searchUrl + "?requestTime=" + timestamp + "&sign=" + sign +
"&appKey=" + searchAppKey + "&" +
"pageSize=10&pageNum=1&appCode=" + appCode +
"&areaCode=" + areaCode + "&deptCode=&name=";
"&areaCode=&deptCode=&name=";
log.info("url : {}",url);
RestTemplate restTemplate = new RestTemplate();
ResponseEntity<ApiDTO> forEntity = restTemplate.getForEntity(url, ApiDTO.class);

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())){
return forEntity.getBody().getDatas().getApiApplySearchResult().get(0);
}
@@ -174,19 +173,20 @@ public class AppIrsManage {

public List<ApiApplySearchResult> searchApps(ApiApplyDTO apply) throws NoSuchAlgorithmException {
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 sign = CryptUtils.MD5Encode(searchAppKey + requestSecret + timestamp);
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=";
RestTemplate restTemplate = new RestTemplate();
ResponseEntity<ApiDTO> forEntity = restTemplate.getForEntity(url, ApiDTO.class);

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())){
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 java.io.Serializable;

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

private static final long serialVersionUID = 1L;

private int id;
private String orgId;
private String userId;
@@ -21,6 +26,7 @@ public class ApiApplyDTO {
private String deployType;
private String principal;
private String employeeCode;
private String areaCode;
private String areaName;
private String createTime;
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;

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

import java.io.Serializable;

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

private static final long serialVersionUID = 1L;

private int id;
private String orgId;
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;

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

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

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

private String code;
private String msg;
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;

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

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

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

private static final long serialVersionUID = 1L;

private Boolean success;
private Integer code;
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.NotNull;
import java.io.Serializable;

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

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


Loading…
Cancel
Save