Browse Source

debug 查询最新项目

tags/24080901
PoffyZhang 1 year ago
parent
commit
ced211614f
3 changed files with 67 additions and 14 deletions
  1. +30
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/ding/controller/DingInfoPullController.java
  2. +17
    -14
      pmapi/src/main/java/com/ningdatech/pmapi/irs/manage/AppIrsManage.java
  3. +20
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/irs/model/dto/ApiDTO.java

+ 30
- 0
pmapi/src/main/java/com/ningdatech/pmapi/ding/controller/DingInfoPullController.java View File

@@ -1,5 +1,8 @@
package com.ningdatech.pmapi.ding.controller;

import com.alibaba.fastjson.JSON;
import com.ningdatech.pmapi.common.util.CryptUtils;
import com.ningdatech.pmapi.common.util.RefreshKeyUtil;
import com.ningdatech.pmapi.ding.task.EmployeeBatchGetTask;
import com.ningdatech.pmapi.ding.task.GovBusinessStripsTask;
import com.ningdatech.pmapi.ding.task.OrganizationBatchGetTask;
@@ -7,7 +10,11 @@ import com.ningdatech.pmapi.organization.manage.ProcDefManage;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.RestTemplate;

import java.security.NoSuchAlgorithmException;

/**
* <p>
@@ -80,4 +87,27 @@ public class DingInfoPullController {
public String init() {
return procDefManage.init();
}

@ApiOperation(value = "系统流程配置初始化", notes = "系统流程配置初始化")
@GetMapping("/search")
public String testApp() throws NoSuchAlgorithmException {
long timestamp = System.currentTimeMillis();
String areaCode = "331123";
String appScret = "496f0f2a19994f76b4fd9dae087366c7";
String appKey = "A331101453557202109017383";
String appCode = "A331123467587202307014170";

String requestSecret = RefreshKeyUtil.getRequestSecret(appKey, appScret);
String sign = CryptUtils.MD5Encode(appKey + requestSecret + timestamp);
String url = "https://interface.zjzwfw.gov.cn/gateway/api/001003001029/dataSharing/XS8daav3bcemZ3Ra.htm?" +
"requestTime=" + timestamp + "&sign=" + sign + "&appKey=" + appKey + "&name=&" +
"pageSize=10&deptCode=&areaCode=" + areaCode + "&pageNum=1&appCode=" + appCode;
log.info(url);
RestTemplate restTemplate = new RestTemplate();
ResponseEntity<String> forEntity = restTemplate.getForEntity(url, String.class);

log.info(JSON.toJSONString(forEntity));

return JSON.toJSONString(forEntity);
}
}

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

@@ -5,13 +5,11 @@ import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.ningdatech.basic.function.VUtils;
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.util.CryptUtils;
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.projectlib.model.entity.Project;
import com.ningdatech.pmapi.projectlib.model.entity.ProjectApplication;
@@ -154,38 +152,43 @@ 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;
"pageSize=10&pageNum=1&appCode=" + appCode +
"&areaCode=" + areaCode + "&deptCode=&name=";
log.info("url : {}",url);
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));

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;
}

public List<ApiApplySearchResult> searchApps(ApiApplyDTO apply) throws NoSuchAlgorithmException {
long timestamp = System.currentTimeMillis();
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=100&pageNum=1";
"pageSize=100&pageNum=1&areaCode=" + areaCode +
"&deptCode=&name=";
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));

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();
}


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

@@ -0,0 +1,20 @@
package com.ningdatech.pmapi.irs.model.dto;

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

import java.util.List;

/**
* @Classname ApiDTO
* @Description
* @Date 2023/7/13 18:03
* @Author PoffyZhang
*/
@Data
public class ApiDTO {
private String code;
private String msg;
private String data;
private ApiSearchResult datas;
}

Loading…
Cancel
Save