|
@@ -107,6 +107,7 @@ public class ProjectService extends ServiceImpl<ProjectMapper, Project> {
|
|
|
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());
|
|
@@ -115,7 +116,8 @@ public class ProjectService extends ServiceImpl<ProjectMapper, Project> {
|
|
|
queryWrapper.last("limit 1");
|
|
|
return this.getOne(queryWrapper);
|
|
|
}
|
|
|
- public Project getProjectByName(String name,Integer loginId) {
|
|
|
+
|
|
|
+ public Project getProjectByName(String name, Integer loginId) {
|
|
|
LambdaQueryWrapper<Project> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
PersonnelVO personnelVO = cacheUtils.getLoginUser(loginId);
|
|
|
queryWrapper.eq(Project::getName, name);
|
|
@@ -123,6 +125,7 @@ public class ProjectService extends ServiceImpl<ProjectMapper, Project> {
|
|
|
queryWrapper.last("limit 1");
|
|
|
return this.getOne(queryWrapper);
|
|
|
}
|
|
|
+
|
|
|
public IPage<Project> getPageList(ProjectVO params) throws IOException {
|
|
|
List<Integer> projectIds = new ArrayList<Integer>() {{
|
|
|
add(-1);
|
|
@@ -176,7 +179,7 @@ public class ProjectService extends ServiceImpl<ProjectMapper, Project> {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- List<Integer> personnelIds =dataList.stream().map(Project::getPersonnelId).collect(Collectors.toList());
|
|
|
+ List<Integer> personnelIds = dataList.stream().map(Project::getPersonnelId).collect(Collectors.toList());
|
|
|
//获取专题库负责人对应信息
|
|
|
String jsonObject1 = requestService.getPersonnelFromPCS(personnelIds);
|
|
|
JSONArray jsonArray = JSON.parseArray(jsonObject1);
|
|
@@ -222,68 +225,68 @@ public class ProjectService extends ServiceImpl<ProjectMapper, Project> {
|
|
|
//获得委托方的id集合
|
|
|
List<Integer> clientIds = dataList.stream().map(Project::getClientId).collect(Collectors.toList());
|
|
|
//获得负责人的id集合
|
|
|
- List<Integer> personIds =dataList.stream().map(Project::getPersonnelId).collect(Collectors.toList());
|
|
|
+ List<Integer> personIds = dataList.stream().map(Project::getPersonnelId).collect(Collectors.toList());
|
|
|
//获得创建人的id集合
|
|
|
- List<Integer> createIds =dataList.stream().map(Project::getCreateBy).collect(Collectors.toList());
|
|
|
+ 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());
|
|
|
- }
|
|
|
+ //获取所属部门对应信息
|
|
|
+ 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());
|
|
|
- }
|
|
|
+ }
|
|
|
+ //装载创建人名
|
|
|
+ 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());
|
|
|
- }
|
|
|
+ //装载委托方名
|
|
|
+ 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());
|
|
|
- }
|
|
|
+ }
|
|
|
+ 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 -> {
|
|
@@ -333,7 +336,7 @@ public class ProjectService extends ServiceImpl<ProjectMapper, Project> {
|
|
|
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() != null &&item.getScenarioName().contains(scenario)).collect(Collectors.toList());
|
|
|
+ projectList = projectList.stream().filter(item -> item.getScenarioName() != null && item.getScenarioName().contains(scenario)).collect(Collectors.toList());
|
|
|
List<SystemDict> systemDictList = systemDictService.getSystemDictListByType(Collections.singletonList(Constants.INVESTIGATION_TYPE));
|
|
|
for (SystemDict systemDict : systemDictList) {
|
|
|
map.put(systemDict.getLabel(), projectList.stream().filter(item -> item.getTypeList().contains(Integer.parseInt(systemDict.getValue()))).count());
|
|
@@ -400,18 +403,20 @@ public class ProjectService extends ServiceImpl<ProjectMapper, Project> {
|
|
|
}
|
|
|
return tempName;
|
|
|
}
|
|
|
- public String getImportProjectName(String name,Integer userId) {
|
|
|
+
|
|
|
+ public String getImportProjectName(String name, Integer userId) {
|
|
|
String tempName = name + "(1)";
|
|
|
- Project project1 = this.getProjectByName(name,userId);
|
|
|
+ Project project1 = this.getProjectByName(name, userId);
|
|
|
if (project1 == null) {
|
|
|
return name;
|
|
|
}
|
|
|
- Project project2 = this.getProjectByName(tempName,userId);
|
|
|
+ Project project2 = this.getProjectByName(tempName, userId);
|
|
|
if (project2 != null) {
|
|
|
- tempName = this.getImportProjectName(tempName,userId);
|
|
|
+ tempName = this.getImportProjectName(tempName, userId);
|
|
|
}
|
|
|
return tempName;
|
|
|
}
|
|
|
+
|
|
|
public Integer importProject(Integer projectId, String json, Integer userId) throws IOException {
|
|
|
if ((projectId == null || projectId.equals(0)) && StringUtils.isEmpty(json)) {
|
|
|
return 0;
|
|
@@ -430,7 +435,7 @@ public class ProjectService extends ServiceImpl<ProjectMapper, Project> {
|
|
|
String projectName = temp.getName();
|
|
|
BeanUtils.copyProperties(data, temp);
|
|
|
if (projectName == null || !projectName.equals(data.getName())) {
|
|
|
- temp.setName(this.getImportProjectName(temp.getName(),userId));
|
|
|
+ temp.setName(this.getImportProjectName(temp.getName(), userId));
|
|
|
}
|
|
|
|
|
|
if (projectId == null || projectId.equals(0)) {
|
|
@@ -452,7 +457,7 @@ public class ProjectService extends ServiceImpl<ProjectMapper, Project> {
|
|
|
if (temp != null) {
|
|
|
ThrowException.throwXiaoShiException("专题库名称已存在");
|
|
|
}
|
|
|
- if ((project.getClientId() == null || project.getClientId() == -1)&&project.getClientName()!=null&&project.getClientName()!="") {
|
|
|
+ if ((project.getClientId() == null || project.getClientId() == -1) && project.getClientName() != null && project.getClientName() != "") {
|
|
|
ClientDTO clientDTO = new ClientDTO();
|
|
|
clientDTO.setName(project.getClientName());
|
|
|
clientDTO.setTenantId(user.getTenantId());
|
|
@@ -492,11 +497,11 @@ public class ProjectService extends ServiceImpl<ProjectMapper, Project> {
|
|
|
ProjectStandardVO queryResult = projectMapper.getStandardById(projectId);
|
|
|
Integer oldProductId = queryResult.getProductId();
|
|
|
//若当前产品id和原产品id不一致,则表示当前的修改要修改产品
|
|
|
- if (newProductId!=null&&!newProductId.equals(oldProductId)) {
|
|
|
+ if (newProductId != null && !newProductId.equals(oldProductId)) {
|
|
|
//检查当前专题库产品架构是否已标引,若已标引则不允许修改产品
|
|
|
int count = assoStructurePatentMapper.countByProjectId(projectId);
|
|
|
if (count > 0) {
|
|
|
- String message = "修改专题库失败,该专题库已被标引,无法更换产品或架构";
|
|
|
+ String message = "修改专题库失败,该专题库产品或架构已被标引,无法更换产品或架构";
|
|
|
log.info("{}", message);
|
|
|
throw new XiaoShiException(message);
|
|
|
}
|
|
@@ -1002,9 +1007,9 @@ public class ProjectService extends ServiceImpl<ProjectMapper, Project> {
|
|
|
);
|
|
|
projectPatentLinkService.saveBatch(projectPatentLinkList);
|
|
|
//复制专题库标引信息
|
|
|
- copyService.CopyPatentLabels(oldId,project.getId());
|
|
|
+ copyService.CopyPatentLabels(oldId, project.getId());
|
|
|
//复制专题库文件夹
|
|
|
- copyService.CopyProjectFolder(oldId,project.getId());
|
|
|
+ copyService.CopyProjectFolder(oldId, project.getId());
|
|
|
return project.getId();
|
|
|
}
|
|
|
|