Parcourir la source

省级联审文件 解析

tags/24080901
PoffyZhang il y a 1 an
Parent
révision
f5829a6c2b
1 fichiers modifiés avec 30 ajouts et 2 suppressions
  1. +30
    -2
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/converter/ApplicationConverter.java

+ 30
- 2
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/converter/ApplicationConverter.java Voir le fichier

@@ -47,7 +47,7 @@ public class ApplicationConverter {
.beginTime(projectInfo.getBeginTime())
.endTime(projectInfo.getEndTime())
.buildBasis("立项依据")
.buildBasisFile(convertFile(projectInfo.getBuildBasis(),fileService))
.buildBasisFile(convertBasicFile(projectInfo.getBuildBasis(),fileService))
.projectSummary(projectInfo.getProjectIntroduction())
.responsibleMan(projectInfo.getResponsibleMan())
.responsibleManPhone(projectInfo.getResponsibleManMobile())
@@ -146,7 +146,7 @@ public class ApplicationConverter {
List<FileDTO> files = jsonArrays.stream().map(json -> {
JSONObject fileJson = (JSONObject) JSON.toJSON(json);
Long fileId = fileJson.getLong("id");
String fileName = fileJson.getString("name");
String fileName = fileJson.getString("originalFileName");
Map<Long, String> fileMap = fileService.findUrlById(Arrays.asList(fileId));
String url = fileMap.get(fileId);
FileDTO file = new FileDTO();
@@ -162,6 +162,34 @@ public class ApplicationConverter {
return null;
}

//立项依据的文件格式不一样
private static String convertBasicFile(String applicationEstimateFile, FileService fileService) {
try {
List<FileDTO> files = Lists.newArrayList();
JSONArray jsonArrays = JSON.parseArray(applicationEstimateFile);
jsonArrays.stream().forEach(json -> {
JSONObject fileJson = (JSONObject) JSON.toJSON(json);
JSONArray fileList = fileJson.getJSONArray("fileList");
fileList.stream().forEach(f -> {
JSONObject fJson = (JSONObject) JSON.toJSON(f);
Long fileId = fJson.getLong("id");
String fileName = fJson.getString("originalFileName");
Map<Long, String> fileMap = fileService.findUrlById(Arrays.asList(fileId));
String url = fileMap.get(fileId);
FileDTO file = new FileDTO();
file.setFileId(String.valueOf(fileId));
file.setFileName(fileName);
file.setAccessUrl(url);
files.add(file);
});
});
return JSON.toJSONString(files);
} catch (Exception e) {
log.info("转换省局上传 basic文件出错 {}",e.getMessage());
}
return null;
}

private static List<ProvincialApplicationDTO.Cloud> convertCloud(ProjectApplication projectApplication) {
return Lists.newArrayList(ProvincialApplicationDTO.Cloud.builder()
.cloudType(projectApplication.getCloudsType())


Chargement…
Annuler
Enregistrer