Browse Source

获取试运行报告

master
PoffyZhang 1 year ago
parent
commit
430e69fb7f
3 changed files with 72 additions and 16 deletions
  1. +69
    -13
      pmapi/src/main/java/com/ningdatech/pmapi/ding/controller/DingInfoPullController.java
  2. +1
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/irs/controller/ApplicationController.java
  3. +2
    -2
      pmapi/src/main/java/com/ningdatech/pmapi/irs/manage/AppIrsManage.java

+ 69
- 13
pmapi/src/main/java/com/ningdatech/pmapi/ding/controller/DingInfoPullController.java View File

@@ -1,15 +1,9 @@
package com.ningdatech.pmapi.ding.controller;

import cn.hutool.core.util.StrUtil;
import cn.hutool.crypto.SecureUtil;
import cn.hutool.crypto.digest.HMac;
import cn.hutool.crypto.digest.MD5;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.google.common.collect.Maps;
import com.ningdatech.irs.service.IRefreshTokenService;
import com.ningdatech.pmapi.common.util.CryptUtils;
import com.ningdatech.pmapi.common.util.HttpUtil;
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;
@@ -17,8 +11,7 @@ import com.ningdatech.pmapi.irs.manage.AppIrsManage;
import com.ningdatech.pmapi.organization.manage.ProcDefManage;
import com.ningdatech.pmapi.projectlib.model.dto.ProjectDTO;
import com.ningdatech.pmapi.projectlib.model.entity.Project;
import com.sun.crypto.provider.HmacMD5;
import com.sun.crypto.provider.HmacMD5KeyGenerator;
import com.ningdatech.pmapi.projectlib.service.IProjectService;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
@@ -30,16 +23,12 @@ import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.ResponseEntity;
import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
import org.springframework.util.Assert;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.RestTemplate;
import javax.annotation.Resource;
import java.io.*;
import java.nio.charset.StandardCharsets;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
import java.time.LocalDateTime;
import java.util.Objects;

/**
@@ -72,6 +61,8 @@ public class DingInfoPullController {

private final AppIrsManage appIrsManage;

private final IProjectService projectService;

@GetMapping("/employee")
public void employeeBatchGet() {
employeeBatchGetTask.batchGetEmployeeTask();
@@ -199,6 +190,71 @@ public class DingInfoPullController {
return "推送IRS项目详情成功数量:" + sucessNum;
}

@ApiOperation(value = "应用和项目关系推送", notes = "应用和项目关系推送")
@GetMapping("/push-app-project")
public String pushAppProject() throws Exception {
long timestamp = System.currentTimeMillis();
String areaCode = "331123";
String appKey = "A331101453557202109017383";
String appScret = "496f0f2a19994f76b4fd9dae087366c7";
String baseProjSys = "初次建设的应用21";
String baseProjSysCode = "A331123467587202307014177";
String baseProjName = "遂昌县-nsl-项目测试004";
String baseProjId = "331123230130123412186";
String requestSecret = RefreshKeyUtil.getRequestSecret(appKey, appScret);
String capCode = CryptUtils.encryptHMAC(timestamp + areaCode,"bcb4fc0f517fc168ee543fcf4d231f3b");
String capTime = String.valueOf(timestamp);
String sign = CryptUtils.MD5Encode(appKey + requestSecret + timestamp);
String url = "https://interface.zjzwfw.gov.cn/gateway/api/proxy/001003001029/dataSharing/94wbaL1I1Pbz0648.htm?requestTime=" + timestamp +
"&sign=" + sign + "&appKey=" + appKey + "&capCode=" + capCode + "&capTime=" + capTime +
"&baseProjSys=" + baseProjSys + "&areaCode=331123&baseProjName=" + baseProjName + "&baseProjId=" + baseProjId +
"&isEffective=1&baseProjSysCode=" + baseProjSysCode;
RestTemplate restTemplate = new RestTemplate();
log.info("url :{}",url);
ResponseEntity<String> forEntity = restTemplate.getForEntity(url, String.class);

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

return forEntity.getBody();
}

@ApiOperation(value = "项目详情推送", notes = "项目详情推送")
@GetMapping("/push-project-detail")
public String pushProjectDetail() throws NoSuchAlgorithmException {
Project project = projectService.getById(189L);
ProjectDTO projectDto = new ProjectDTO();

projectDto.setProjectCode(project.getProjectCode());
projectDto.setProjectName(project.getProjectName());
projectDto.setArea(project.getArea());
projectDto.setAreaCode(project.getAreaCode());
projectDto.setBaseProjType("1");
projectDto.setBaseConstructionType("03");
projectDto.setBaseProjConsClass("C");
projectDto.setBaseLowestLevel("C");
projectDto.setProjectYear(project.getProjectYear());
projectDto.setBaseProjBasis("1");
projectDto.setBuildBasis("01");
projectDto.setBaseProjSetProg("05");
projectDto.setResponsibleMan(project.getResponsibleMan());
projectDto.setResponsibleManMobile(project.getResponsibleManMobile());
projectDto.setContactName(project.getContactName());
projectDto.setContactPhone(project.getContactPhone());
projectDto.setBuildOrgName(project.getBuildOrgName());
projectDto.setBuildOrgCode(project.getBuildOrgCode());
projectDto.setSuperOrg(project.getSuperOrg());
projectDto.setSuperOrgCode(project.getSuperOrgCode());
projectDto.setHigherSuperOrg(project.getHigherSuperOrg());
projectDto.setHigherSuperOrgCode(project.getHigherSuperOrgCode());

log.info("projectDto :{}",JSON.toJSONString(projectDto));

if(StringUtils.isNotBlank(appIrsManage.pushProjectDetail(projectDto))){
return "推送成功";
}
return "推送失败";
}

public static Workbook readExcel(InputStream is, String extString){
Workbook wb = null;



+ 1
- 1
pmapi/src/main/java/com/ningdatech/pmapi/irs/controller/ApplicationController.java View File

@@ -32,7 +32,7 @@ public class ApplicationController {

@PostMapping("/push-project-app")
@WebLog("推送项目和应用关系")
public Boolean pushProjectApp(@Valid @RequestBody PushProjectAppToIrsDTO dto) throws NoSuchAlgorithmException {
public Boolean pushProjectApp(@Valid @RequestBody PushProjectAppToIrsDTO dto) throws Exception {
return appIrsManage.pushProjectApp(dto);
}



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

@@ -99,7 +99,7 @@ public class AppIrsManage {
* @return
* @throws NoSuchAlgorithmException
*/
public Boolean pushProjectApp(PushProjectAppToIrsDTO dto) throws NoSuchAlgorithmException {
public Boolean pushProjectApp(PushProjectAppToIrsDTO dto) throws Exception {
String appCode = dto.getAppCode();
Long appId = dto.getAppId();
String projectCode = dto.getProjectCode();
@@ -119,7 +119,7 @@ public class AppIrsManage {
String areaCode = project.getAreaCode();
String projectName = project.getProjectName();
String requestSecret = RefreshKeyUtil.getRequestSecret(pushAppKey, pushAppScret);
String capCode = CryptUtils.MD5Encode(timestamp + areaCode);
String capCode = CryptUtils.encryptHMAC(timestamp + areaCode,"bcb4fc0f517fc168ee543fcf4d231f3b");
String capTime = String.valueOf(timestamp);
String sign = CryptUtils.MD5Encode(pushAppKey + requestSecret + timestamp);
String url = pushUrl + "?requestTime=" + timestamp +


Loading…
Cancel
Save