|
@@ -26,17 +26,14 @@ import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import java.io.File;
|
|
|
import java.io.IOException;
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.Arrays;
|
|
|
-import java.util.Date;
|
|
|
-import java.util.List;
|
|
|
+import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
-* @author Administrator
|
|
|
-* @description 针对表【os_thematic_import(专题库数据导入记录)】的数据库操作Service
|
|
|
-* @createDate 2022-05-19 10:55:10
|
|
|
-*/
|
|
|
+ * @author Administrator
|
|
|
+ * @description 针对表【os_thematic_import(专题库数据导入记录)】的数据库操作Service
|
|
|
+ * @createDate 2022-05-19 10:55:10
|
|
|
+ */
|
|
|
@Service
|
|
|
@RequiredArgsConstructor(onConstructor_ = {@Lazy})
|
|
|
public class ProjectImportService extends ServiceImpl<ProjectImportMapper, ProjectImport> {
|
|
@@ -46,19 +43,21 @@ public class ProjectImportService extends ServiceImpl<ProjectImportMapper, Proje
|
|
|
private final PatentMapper patentMapper;
|
|
|
private final ProjectPatentLinkService projectPatentLinkService;
|
|
|
private final RequestService requestService;
|
|
|
+
|
|
|
public IPage<ProjectImport> getPageList(ProjectImportVO params) throws IOException {
|
|
|
//当查询使用发起人名称时
|
|
|
- if (params.getCreateName() != null && params.getCreateName() != "") {
|
|
|
+ if (params.getCreateName() != null && !params.getCreateName().equals("")) {
|
|
|
String res = requestService.getPersonIdByNamePCS(params.getCreateName());
|
|
|
List<Integer> createIds = JSONArray.parseArray(res, Integer.class);
|
|
|
params.setCreateIds(createIds);
|
|
|
//当未查询到时直接返回空页
|
|
|
if (createIds == null || createIds.size() == 0) {
|
|
|
- params.setCreateIds(Arrays.asList(-1));
|
|
|
+ //params.setCreateIds(Arrays.asList(-1));
|
|
|
+ params.setCreateIds(Collections.singletonList(-1));
|
|
|
}
|
|
|
}
|
|
|
IPage<ProjectImport> pageList = baseMapper.getPageList(new Page<>(params.getCurrent(), params.getSize()), params);
|
|
|
- this.setDataList(pageList.getRecords());
|
|
|
+ this.setDataList(pageList.getRecords());
|
|
|
return pageList;
|
|
|
}
|
|
|
|
|
@@ -96,16 +95,16 @@ public class ProjectImportService extends ServiceImpl<ProjectImportMapper, Proje
|
|
|
if (!patentDTO.getPatentNo().equals("")) {
|
|
|
String[] strs = patentDTO.getPatentNo().split("\\|");
|
|
|
orgPatentNos = new ArrayList<>(Arrays.asList(strs));
|
|
|
- QueryPatentVO params =new QueryPatentVO();
|
|
|
+ QueryPatentVO params = new QueryPatentVO();
|
|
|
params.setPatentNo(patentDTO.getPatentNo());
|
|
|
params.setPatentNos(orgPatentNos);
|
|
|
- List<Patent> patents =patentMapper.getConPantents(params);
|
|
|
- List<String> patentNos =patents.stream().map(Patent::getPatentNo).collect(Collectors.toList());
|
|
|
+ List<Patent> patents = patentMapper.getConPantents(params);
|
|
|
+ List<String> patentNos = patents.stream().map(Patent::getPatentNo).collect(Collectors.toList());
|
|
|
orgPatentNos.removeAll(patentNos);
|
|
|
if (patents.size() > 0) {
|
|
|
- List<ProjectPatentLink> projectPatentLinkList =new ArrayList<>();
|
|
|
- patents.forEach(item->{
|
|
|
- ProjectPatentLink projectPatentLink =new ProjectPatentLink();
|
|
|
+ List<ProjectPatentLink> projectPatentLinkList = new ArrayList<>();
|
|
|
+ patents.forEach(item -> {
|
|
|
+ ProjectPatentLink projectPatentLink = new ProjectPatentLink();
|
|
|
projectPatentLink.setProjectId(patentDTO.getProjectId());
|
|
|
projectPatentLink.setPatentId(item.getId());
|
|
|
projectPatentLinkList.add(projectPatentLink);
|
|
@@ -119,15 +118,20 @@ public class ProjectImportService extends ServiceImpl<ProjectImportMapper, Proje
|
|
|
|
|
|
private void setDataList(List<ProjectImport> importList) throws IOException {
|
|
|
//获得创建人的id集合
|
|
|
- List<Integer> createIds =importList.stream().map(ProjectImport::getCreateBy).collect(Collectors.toList());
|
|
|
+ //List<Integer> createIds = importList.stream().map(ProjectImport::getCreateBy).collect(Collectors.toList());
|
|
|
+ ArrayList<Integer> createPersonIds = new ArrayList<>();
|
|
|
+ for (ProjectImport projectImport : importList) {
|
|
|
+ createPersonIds.add(projectImport.getCreateBy());
|
|
|
+ }
|
|
|
+
|
|
|
//获取专题库负责人对应信息
|
|
|
- String jsonObject1 = requestService.getPersonnelFromPCS(createIds);
|
|
|
+ String jsonObject1 = requestService.getPersonnelFromPCS(createPersonIds);
|
|
|
JSONArray jsonArray = JSON.parseArray(jsonObject1);
|
|
|
List<ProjectVO.Personnel> personnelList = jsonArray.toJavaList(ProjectVO.Personnel.class);
|
|
|
for (ProjectImport projectImport : importList) {
|
|
|
for (ProjectVO.Personnel personnel : personnelList) {
|
|
|
//装载创建人名
|
|
|
- if(projectImport.getCreateBy()!=null){
|
|
|
+ if (projectImport.getCreateBy() != null) {
|
|
|
if (projectImport.getCreateBy().equals(personnel.getId())) {
|
|
|
projectImport.setCreateName(personnel.getPersonnelName());
|
|
|
}
|