Преглед на файлове

省级联审状态 debug

tags/24080901
PoffyZhang преди 1 година
родител
ревизия
4025fa5e94
променени са 2 файла, в които са добавени 26 реда и са изтрити 2 реда
  1. +17
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/converter/ApplicationConverter.java
  2. +9
    -1
      pmapi/src/test/java/com/ningdatech/pmapi/provincial/Test.java

+ 17
- 1
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/converter/ApplicationConverter.java Целия файл

@@ -11,6 +11,7 @@ import com.ningdatech.pmapi.provincial.model.dto.FileDTO;
import com.ningdatech.pmapi.provincial.model.dto.ProvincialApplicationDTO;
import com.ningdatech.pmapi.provincial.model.dto.ProvincialProjectDTO;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.assertj.core.util.Lists;

import java.math.BigDecimal;
@@ -58,7 +59,7 @@ public class ApplicationConverter {
.superUnit(projectInfo.getSuperOrg())
.superUnitCode(projectInfo.getSuperOrgCode())
.projectEstimateFile(convertFile(projectInfo.getCalculationTotalInvestmentFile(),fileService))
.unitThreePlan(projectInfo.getMainResponsibilitiesApplicantFile())
.unitThreePlan(convertFile(projectInfo.getMainResponsibilitiesApplicantFile(),fileService))
.otherFile(convertFile(projectInfo.getPreliminaryPlanFile(),fileService))
.projectRemark(projectInfo.getProjectRemarks())
.includeApplication(projectInfo.getIncludeApplication())
@@ -149,6 +150,7 @@ public class ApplicationConverter {
String fileName = fileJson.getString("originalFileName");
Map<Long, String> fileMap = fileService.findUrlById(Arrays.asList(fileId));
String url = fileMap.get(fileId);
url = removeExpire(url);
FileDTO file = new FileDTO();
file.setFileId(String.valueOf(fileId));
file.setFileName(fileName);
@@ -162,6 +164,19 @@ public class ApplicationConverter {
return null;
}

/**
* 去除掉 oss链接的超时时间
* @param url
* @return
*/
private static String removeExpire(String url) {
if(StringUtils.isNotBlank(url)){
String s = "Expires";
return url.replaceAll("&?" + s + "=[^&]*&", StringUtils.EMPTY);
}
return StringUtils.EMPTY;
}

//立项依据的文件格式不一样
private static String convertBasicFile(String applicationEstimateFile, FileService fileService) {
try {
@@ -176,6 +191,7 @@ public class ApplicationConverter {
String fileName = fJson.getString("originalFileName");
Map<Long, String> fileMap = fileService.findUrlById(Arrays.asList(fileId));
String url = fileMap.get(fileId);
url = removeExpire(url);
FileDTO file = new FileDTO();
file.setFileId(String.valueOf(fileId));
file.setFileName(fileName);


+ 9
- 1
pmapi/src/test/java/com/ningdatech/pmapi/provincial/Test.java Целия файл

@@ -7,6 +7,7 @@ import com.ningdatech.pmapi.projectlib.model.entity.Project;
import com.ningdatech.pmapi.projectlib.service.IProjectService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.codec.binary.Base64;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;

import javax.crypto.Mac;
@@ -22,7 +23,7 @@ import java.security.NoSuchAlgorithmException;
* @Author PoffyZhang
*/
@Slf4j
public class Test extends AppTests {
public class Test {//extends AppTests

@Autowired
private PrequalificationDeclaredProjectManage prequalificationDeclaredProjectManage;
@@ -51,4 +52,11 @@ public class Test extends AppTests {
Project project = projectService.getById(340);
prequalificationDeclaredProjectManage.directStartProcess(project,project.getPreStartUserId());
}

@org.junit.Test
public void Test3333(){
String url = "http://devplat.oss-cn-hangzhou.aliyuncs.com/2023/04/13/5b2e1ef734e14437ba350ef97202c5b7.pdf?Expires=1681367401&OSSAccessKeyId=LTAI4GL7uypycnBjiRn55rMG&Signature=5PbIhpHNZvA2o8xYy8Ujw9Ibhl8%3D";
String s = "Expires";
System.out.println(url.replaceAll("&?" + s + "=[^&]*&", StringUtils.EMPTY));
}
}

Loading…
Отказ
Запис