|
@@ -3,10 +3,7 @@ package cn.cslg.pas.service;
|
|
|
import cn.cslg.pas.common.core.base.Constants;
|
|
|
import cn.cslg.pas.common.core.exception.CustomException;
|
|
|
import cn.cslg.pas.common.model.PersonnelVO;
|
|
|
-import cn.cslg.pas.common.model.dto.ClientDTO;
|
|
|
-import cn.cslg.pas.common.model.dto.EventAddNewDTO;
|
|
|
-import cn.cslg.pas.common.model.dto.ProjectEventAddNewDTO;
|
|
|
-import cn.cslg.pas.common.model.dto.UploadFileDTO;
|
|
|
+import cn.cslg.pas.common.model.dto.*;
|
|
|
import cn.cslg.pas.common.model.vo.*;
|
|
|
import cn.cslg.pas.common.utils.*;
|
|
|
import cn.cslg.pas.common.utils.SecurityUtils.LoginUtils;
|
|
@@ -109,7 +106,7 @@ public class ProjectService extends ServiceImpl<ProjectMapper, Project> {
|
|
|
private final ProjectMapper projectMapper;
|
|
|
private final IEventService eventService;
|
|
|
private final IAssoEventProjectService assoEventProjectService;
|
|
|
-
|
|
|
+ private final CopyService copyService;
|
|
|
public Project getProjectByName(String name) {
|
|
|
LambdaQueryWrapper<Project> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
PersonnelVO personnelVO = cacheUtils.getLoginUser(loginUtils.getId());
|
|
@@ -140,66 +137,12 @@ public class ProjectService extends ServiceImpl<ProjectMapper, Project> {
|
|
|
IPage<Project> pageList = baseMapper.getPageList(new Page<>(params.getCurrent(), params.getSize()), params);
|
|
|
|
|
|
List<Project> dataList = pageList.getRecords();
|
|
|
- List<Integer> clientIds = dataList.stream().map(Project::getClientId).collect(Collectors.toList());
|
|
|
-
|
|
|
- try {
|
|
|
- //获取所属部门对应信息
|
|
|
- String jsonObject = requestService.getDepartmentFromPCS(dataList);
|
|
|
- JSONArray jsonArray1 = JSON.parseArray(jsonObject);
|
|
|
- List<ProjectVO.Department> departmentList = jsonArray1.toJavaList(ProjectVO.Department.class);
|
|
|
- for (Project project : dataList) {
|
|
|
- Integer productId = project.getProductId();
|
|
|
- if (productId != null) {
|
|
|
- ProductVO queryResult = productMapper.getStandardById(productId);
|
|
|
- String productName = queryResult.getProductName();
|
|
|
- project.setProductName(productName);
|
|
|
- }
|
|
|
- for (ProjectVO.Department department : departmentList) {
|
|
|
- if (project.getDepartmentId() != null) {
|
|
|
- if (project.getDepartmentId().equals(department.getId())) {
|
|
|
- project.setDepartmentName(department.getDepartmentName());
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- //获取专题库负责人对应信息
|
|
|
- String jsonObject1 = requestService.getPersonnelFromPCS(dataList);
|
|
|
- JSONArray jsonArray = JSON.parseArray(jsonObject1);
|
|
|
- List<ProjectVO.Personnel> personnelList = jsonArray.toJavaList(ProjectVO.Personnel.class);
|
|
|
- //获取专题库委托方对应信息
|
|
|
- List<ClientDTO> clientList = new ArrayList<>();
|
|
|
- if (clientIds.size() > 0) {
|
|
|
- String jsonObject2 = requestService.getClientByIds(clientIds);
|
|
|
- JSONArray jsonArray2 = JSON.parseArray(jsonObject2);
|
|
|
- clientList = jsonArray2.toJavaList(ClientDTO.class);
|
|
|
- }
|
|
|
- for (Project project : dataList) {
|
|
|
- for (ProjectVO.Personnel personnel : personnelList) {
|
|
|
- if (project.getPersonnelId() != null) {
|
|
|
- if (project.getPersonnelId().equals(personnel.getId())) {
|
|
|
- project.setPersonnelName(personnel.getPersonnelName());
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- for (ClientDTO clientDTO : clientList) {
|
|
|
- if (project.getClientId() != null) {
|
|
|
- if (project.getClientId().equals(clientDTO.getId())) {
|
|
|
- project.setClientName(clientDTO.getName());
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- } catch (IOException e) {
|
|
|
- e.printStackTrace();
|
|
|
- }
|
|
|
-
|
|
|
this.setDataList(dataList);
|
|
|
pageList.setRecords(dataList);
|
|
|
return pageList;
|
|
|
}
|
|
|
|
|
|
- public List<Project> getProjectByIds(List<Integer> ids) {
|
|
|
+ public List<Project> getProjectByIds(List<Integer> ids) throws IOException {
|
|
|
if (ids == null || ids.size() == 0) {
|
|
|
return new ArrayList<>();
|
|
|
}
|
|
@@ -232,9 +175,9 @@ public class ProjectService extends ServiceImpl<ProjectMapper, Project> {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+ List<Integer> personnelIds =dataList.stream().map(Project::getPersonnelId).collect(Collectors.toList());
|
|
|
//获取专题库负责人对应信息
|
|
|
- String jsonObject1 = requestService.getPersonnelFromPCS(dataList);
|
|
|
+ String jsonObject1 = requestService.getPersonnelFromPCS(personnelIds);
|
|
|
JSONArray jsonArray = JSON.parseArray(jsonObject1);
|
|
|
List<ProjectVO.Personnel> personnelList = jsonArray.toJavaList(ProjectVO.Personnel.class);
|
|
|
for (Project project : dataList) {
|
|
@@ -269,13 +212,78 @@ public class ProjectService extends ServiceImpl<ProjectMapper, Project> {
|
|
|
project.setClientName(clientList.get(0).getName());
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
-
|
|
|
}
|
|
|
|
|
|
return project;
|
|
|
}
|
|
|
|
|
|
- private void setDataList(List<Project> dataList) {
|
|
|
+ private void setDataList(List<Project> dataList) throws IOException {
|
|
|
+ //获得委托方的id集合
|
|
|
+ List<Integer> clientIds = dataList.stream().map(Project::getClientId).collect(Collectors.toList());
|
|
|
+ //获得负责人的id集合
|
|
|
+ List<Integer> personIds =dataList.stream().map(Project::getPersonnelId).collect(Collectors.toList());
|
|
|
+ //获得创建人的id集合
|
|
|
+ List<Integer> createIds =dataList.stream().map(Project::getCreateBy).collect(Collectors.toList());
|
|
|
+ personIds.addAll(createIds);
|
|
|
+ //获取所属部门对应信息
|
|
|
+ String jsonObject = requestService.getDepartmentFromPCS(dataList);
|
|
|
+ JSONArray jsonArray1 = JSON.parseArray(jsonObject);
|
|
|
+ List<ProjectVO.Department> departmentList = jsonArray1.toJavaList(ProjectVO.Department.class);
|
|
|
+ //获取专题库负责人对应信息
|
|
|
+ String jsonObject1 = requestService.getPersonnelFromPCS(personIds);
|
|
|
+ JSONArray jsonArray = JSON.parseArray(jsonObject1);
|
|
|
+ List<ProjectVO.Personnel> personnelList = jsonArray.toJavaList(ProjectVO.Personnel.class);
|
|
|
+ //获取专题库委托方对应信息
|
|
|
+ List<ClientDTO> clientList = new ArrayList<>();
|
|
|
+ if (clientIds.size() > 0) {
|
|
|
+ String jsonObject2 = requestService.getClientByIds(clientIds);
|
|
|
+ JSONArray jsonArray2 = JSON.parseArray(jsonObject2);
|
|
|
+ clientList = jsonArray2.toJavaList(ClientDTO.class);
|
|
|
+ }
|
|
|
+ for (Project project : dataList) {
|
|
|
+ //装载负责人名
|
|
|
+ for (ProjectVO.Personnel personnel : personnelList) {
|
|
|
+ if (project.getPersonnelId() != null) {
|
|
|
+ if (project.getPersonnelId().equals(personnel.getId())) {
|
|
|
+ project.setPersonnelName(personnel.getPersonnelName());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //装载创建人名
|
|
|
+ if(project.getCreateBy()!=null){
|
|
|
+ if (project.getCreateBy().equals(personnel.getId())) {
|
|
|
+ project.setCreateName(personnel.getPersonnelName());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ //装载委托方名
|
|
|
+ for (ClientDTO clientDTO : clientList) {
|
|
|
+ if (project.getClientId() != null) {
|
|
|
+ if (project.getClientId().equals(clientDTO.getId())) {
|
|
|
+ project.setClientName(clientDTO.getName());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ Integer productId = project.getProductId();
|
|
|
+ //装载产品id
|
|
|
+ if (productId != null) {
|
|
|
+ ProductVO queryResult = productMapper.getStandardById(productId);
|
|
|
+ String productName = queryResult.getProductName();
|
|
|
+ project.setProductName(productName);
|
|
|
+ }
|
|
|
+ //装载部门
|
|
|
+ for (ProjectVO.Department department : departmentList) {
|
|
|
+ if (project.getDepartmentId() != null) {
|
|
|
+ if (project.getDepartmentId().equals(department.getId())) {
|
|
|
+ project.setDepartmentName(department.getDepartmentName());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
List<SystemDict> systemDictList = systemDictService.getSystemDictListByType(Arrays.asList(Constants.ENTERPRISE_APPLICATION_SCENARIO, Constants.INVESTIGATION_TYPE));
|
|
|
dataList.forEach(item -> {
|
|
|
if (StringUtils.isNotEmpty(item.getScenario())) {
|
|
@@ -293,7 +301,7 @@ public class ProjectService extends ServiceImpl<ProjectMapper, Project> {
|
|
|
});
|
|
|
}
|
|
|
|
|
|
- public List<Project> getAllProjectByMySelf() {
|
|
|
+ public List<Project> getAllProjectByMySelf() throws IOException {
|
|
|
ProjectVO params = new ProjectVO();
|
|
|
PersonnelVO personnelVO = cacheUtils.getLoginUser(loginUtils.getId());
|
|
|
if (personnelVO.getRoleType() == null || personnelVO.getRoleType() != 1) {
|
|
@@ -307,13 +315,13 @@ public class ProjectService extends ServiceImpl<ProjectMapper, Project> {
|
|
|
return projectList;
|
|
|
}
|
|
|
|
|
|
- public Map<Object, Object> getProjectStatusTotal() {
|
|
|
+ public Map<Object, Object> getProjectStatusTotal() throws IOException {
|
|
|
Map<Object, Object> map = new HashMap<>();
|
|
|
List<Project> projectList = this.getAllProjectByMySelf();
|
|
|
List<SystemDict> systemDictList = systemDictService.getSystemDictListByType(Collections.singletonList(Constants.ENTERPRISE_APPLICATION_SCENARIO));
|
|
|
for (SystemDict systemDict : systemDictList) {
|
|
|
Map<String, Object> result = new HashMap<>();
|
|
|
- List<Project> tempList = projectList.stream().filter(item ->item.getScenarioList()!=null&& item.getScenarioList().contains(Integer.parseInt(systemDict.getValue()))).collect(Collectors.toList());
|
|
|
+ List<Project> tempList = projectList.stream().filter(item -> item.getScenarioList() != null && item.getScenarioList().contains(Integer.parseInt(systemDict.getValue()))).collect(Collectors.toList());
|
|
|
result.put("completed", tempList.stream().filter(item -> item.getStatus().equals("1")).count());
|
|
|
result.put("unfinished", tempList.stream().filter(item -> item.getStatus().equals("0")).count());
|
|
|
map.put(systemDict.getLabel(), result);
|
|
@@ -321,7 +329,7 @@ public class ProjectService extends ServiceImpl<ProjectMapper, Project> {
|
|
|
return map;
|
|
|
}
|
|
|
|
|
|
- public Map<String, Object> getProjectTypeTotal(String scenario) {
|
|
|
+ public Map<String, Object> getProjectTypeTotal(String scenario) throws IOException {
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
List<Project> projectList = this.getAllProjectByMySelf();
|
|
|
projectList = projectList.stream().filter(item -> item.getScenarioName().contains(scenario)).collect(Collectors.toList());
|
|
@@ -350,7 +358,7 @@ public class ProjectService extends ServiceImpl<ProjectMapper, Project> {
|
|
|
systemDictList.forEach(systemDict -> {
|
|
|
switch (systemDict.getType()) {
|
|
|
case Constants.ENTERPRISE_APPLICATION_SCENARIO:
|
|
|
- scenario.put(systemDict.getLabel(), projectList.stream().filter(item ->item.getScenarioList()!=null && item.getScenarioList().contains(Integer.parseInt(systemDict.getValue()))).count());
|
|
|
+ scenario.put(systemDict.getLabel(), projectList.stream().filter(item -> item.getScenarioList() != null && item.getScenarioList().contains(Integer.parseInt(systemDict.getValue()))).count());
|
|
|
break;
|
|
|
case Constants.INVESTIGATION_TYPE:
|
|
|
type.put(systemDict.getLabel(), projectList.stream().filter(item -> item.getTypeList().contains(Integer.parseInt(systemDict.getValue()))).count());
|
|
@@ -434,14 +442,14 @@ public class ProjectService extends ServiceImpl<ProjectMapper, Project> {
|
|
|
}
|
|
|
|
|
|
@Transactional
|
|
|
- public String add(Project project) throws IOException {
|
|
|
+ public Integer add(Project project) throws IOException {
|
|
|
PersonnelVO user = cacheUtils.getLoginUserPersonnel(loginUtils.getId());
|
|
|
//检查专题库名称是否被占用
|
|
|
Project temp = this.getProjectByName(project.getName());
|
|
|
if (temp != null) {
|
|
|
ThrowException.throwXiaoShiException("专题库名称已存在");
|
|
|
}
|
|
|
- if (project.getClientId() == null || project.getClientId() == -1) {
|
|
|
+ if ((project.getClientId() == null || project.getClientId() == -1)&&project.getClientName()!=null&&project.getClientName()!="") {
|
|
|
ClientDTO clientDTO = new ClientDTO();
|
|
|
clientDTO.setName(project.getClientName());
|
|
|
clientDTO.setTenantId(user.getTenantId());
|
|
@@ -470,7 +478,7 @@ public class ProjectService extends ServiceImpl<ProjectMapper, Project> {
|
|
|
}
|
|
|
|
|
|
log.info("新增专题库完成");
|
|
|
- return Response.success(project.getId());
|
|
|
+ return project.getId();
|
|
|
}
|
|
|
|
|
|
@Transactional
|
|
@@ -481,7 +489,7 @@ public class ProjectService extends ServiceImpl<ProjectMapper, Project> {
|
|
|
ProjectStandardVO queryResult = projectMapper.getStandardById(projectId);
|
|
|
Integer oldProductId = queryResult.getProductId();
|
|
|
//若当前产品id和原产品id不一致,则表示当前的修改要修改产品
|
|
|
- if (!newProductId.equals(oldProductId)) {
|
|
|
+ if (newProductId!=null&&!newProductId.equals(oldProductId)) {
|
|
|
//检查当前专题库产品架构是否已标引,若已标引则不允许修改产品
|
|
|
int count = assoStructurePatentMapper.countByProjectId(projectId);
|
|
|
if (count > 0) {
|
|
@@ -964,4 +972,37 @@ public class ProjectService extends ServiceImpl<ProjectMapper, Project> {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @param projectCopyDTO
|
|
|
+ * @return
|
|
|
+ * @throws IOException
|
|
|
+ * @deprecated 复制专题库
|
|
|
+ */
|
|
|
+ @Transactional
|
|
|
+ public Integer copy(ProjectCopyDTO projectCopyDTO) throws IOException {
|
|
|
+ Integer oldId = projectCopyDTO.getId();
|
|
|
+ //复制专题库基本信息
|
|
|
+ Project project = this.getById(oldId);
|
|
|
+ project.setTenantId(projectCopyDTO.getTenantId());
|
|
|
+ project.setId(null);
|
|
|
+ project.insert();
|
|
|
+ //复制专题库专利
|
|
|
+ LambdaQueryWrapper<ProjectPatentLink> patentLinkWrapper = new LambdaQueryWrapper<>();
|
|
|
+ patentLinkWrapper.eq(ProjectPatentLink::getProjectId, oldId);
|
|
|
+ List<ProjectPatentLink> projectPatentLinkList = projectPatentLinkService.list(patentLinkWrapper);
|
|
|
+ projectPatentLinkList.forEach(
|
|
|
+ item -> {
|
|
|
+ item.setProjectId(project.getId());
|
|
|
+ item.setId(null);
|
|
|
+ }
|
|
|
+ );
|
|
|
+ projectPatentLinkService.saveBatch(projectPatentLinkList);
|
|
|
+ //复制专题库标引信息
|
|
|
+ copyService.CopyPatentLabels(oldId,project.getId());
|
|
|
+ //复制专题库文件夹
|
|
|
+ copyService.CopyProjectFolder(oldId,project.getId());
|
|
|
+ return project.getId();
|
|
|
+ }
|
|
|
+
|
|
|
}
|