Bläddra i källkod

查询建设方案的应用

master
PoffyZhang 1 år sedan
förälder
incheckning
8a73fec746
3 ändrade filer med 79 tillägg och 2 borttagningar
  1. +33
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/ding/controller/DingInfoPullController.java
  2. +3
    -2
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ApplicationManage.java
  3. +43
    -0
      pmapi/src/test/java/com/ningdatech/pmapi/irs/irsTest3.java

+ 33
- 0
pmapi/src/main/java/com/ningdatech/pmapi/ding/controller/DingInfoPullController.java Visa fil

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

import com.ningdatech.pmapi.common.util.CryptUtils;
import com.ningdatech.pmapi.common.util.HttpUtil;
import com.ningdatech.pmapi.ding.task.EmployeeBatchGetTask;
import com.ningdatech.pmapi.ding.task.GovBusinessStripsTask;
import com.ningdatech.pmapi.ding.task.OrganizationBatchGetTask;
@@ -7,7 +9,13 @@ 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.http.client.HttpComponentsClientHttpRequestFactory;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.RestTemplate;

import java.security.NoSuchAlgorithmException;
import java.util.Objects;

/**
* <p>
@@ -86,4 +94,29 @@ public class DingInfoPullController {
public String initByArea(@PathVariable String areaCode) {
return procDefManage.initByArea(areaCode);
}

@ApiOperation(value = "系统流程配置初始化", notes = "系统流程配置初始化")
@GetMapping("/test-org")
public String testOrg() throws NoSuchAlgorithmException {
long timestamp = System.currentTimeMillis();
String appSecret = "496f0f2a19994f76b4fd9dae087366c7";
String appKey = "A331101453557202109017383";
String dataName = "大数据管理局";
String sign = CryptUtils.MD5Encode(appKey + appSecret + timestamp);
HttpComponentsClientHttpRequestFactory factory = HttpUtil.generateHttpRequestFactory();
RestTemplate restTemplate;
if(Objects.nonNull(factory)){
restTemplate = new RestTemplate(factory);
}else{
restTemplate = new RestTemplate();
}

String url = "https://interface.ls.local/a/api/shared/1689239219101?" +
"data_name=" + dataName + "&appKey=" + appKey + "&sign=" + sign + "&requestTime=" + timestamp;
log.info("url :{}",url);
ResponseEntity<String> forEntity = restTemplate.getForEntity(url, String.class);
log.info(forEntity.getBody());

return forEntity.getBody();
}
}

+ 3
- 2
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ApplicationManage.java Visa fil

@@ -149,9 +149,10 @@ public class ApplicationManage {
}

List<String> projectCodes = page.getRecords().stream().map(Project::getProjectCode).collect(Collectors.toList());
//要去查询应用
//要去查询应用 此阶段 必定是 建设方案后的 所以直接查 建设方案的应用
List<ProjectApplication> apps = applicationService.list(Wrappers.lambdaQuery(ProjectApplication.class)
.in(ProjectApplication::getProjectCode, projectCodes));
.in(ProjectApplication::getProjectCode, projectCodes)
.eq(ProjectApplication::getIsConstruct,Boolean.TRUE));
Map<String, List<ProjectApplication>> appMap = apps.stream().collect(Collectors.groupingBy(ProjectApplication::getProjectCode));
List<ProjectDetailVO> res = page.getRecords().stream().map(p -> {
ProjectDetailVO vo = BeanUtil.copyProperties(p,ProjectDetailVO.class);


+ 43
- 0
pmapi/src/test/java/com/ningdatech/pmapi/irs/irsTest3.java Visa fil

@@ -0,0 +1,43 @@
package com.ningdatech.pmapi.irs;

import com.ningdatech.pmapi.common.util.CryptUtils;
import com.ningdatech.pmapi.common.util.HttpUtil;
import org.junit.Test;
import org.springframework.http.ResponseEntity;
import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
import org.springframework.web.client.RestTemplate;

import java.security.NoSuchAlgorithmException;
import java.util.Objects;

/**
* @Classname irsTest3
* @Description
* @Date 2023/7/25 9:52
* @Author PoffyZhang
*/
public class irsTest3 {

@Test
public void test1() throws NoSuchAlgorithmException {
long timestamp = System.currentTimeMillis();
String appSecret = "496f0f2a19994f76b4fd9dae087366c7";
String appKey = "A331101453557202109017383";
String dataName = "大数据管理局";
String sign = CryptUtils.MD5Encode(appKey + appSecret + timestamp);
HttpComponentsClientHttpRequestFactory factory = HttpUtil.generateHttpRequestFactory();
RestTemplate restTemplate;
if(Objects.nonNull(factory)){
restTemplate = new RestTemplate(factory);
}else{
restTemplate = new RestTemplate();
}

String url = "https://interface.ls.local/a/api/shared/1689239219101?" +
"data_name=" + dataName + "&appKey=" + appKey + "&sign=" + sign + "&requestTime=" + timestamp;

ResponseEntity<String> forEntity = restTemplate.getForEntity(url, String.class);
System.out.println(forEntity.getBody());
}

}

Laddar…
Avbryt
Spara