|
@@ -27,9 +27,7 @@ import org.springframework.context.annotation.Lazy;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.util.CollectionUtils;
|
|
|
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Objects;
|
|
|
+import java.util.*;
|
|
|
import java.util.regex.Pattern;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
@@ -81,58 +79,67 @@ public class MatchCasePersonService extends ServiceImpl<MatchCasePersonMapper, M
|
|
|
String personId = personnelVO.getId();
|
|
|
Integer tenantId = personnelVO.getTenantId();
|
|
|
|
|
|
- IprPerson iprPerson1 = new IprPerson();
|
|
|
- iprPerson1.setName(updateMatchCasePersonDTO.getName());
|
|
|
- iprPerson1.setEmail(email);
|
|
|
- // type asso remark
|
|
|
- iprPerson1.setType(type);
|
|
|
- iprPerson1.setAssoAccountId(assoAccountId);
|
|
|
- iprPerson1.setRemark(remark);
|
|
|
-
|
|
|
- iprPerson1.setIfDefault(false);
|
|
|
- iprPerson1.setCreateId(personId);
|
|
|
- iprPerson1.setTenantId(tenantId);
|
|
|
- iprPerson1.insert();
|
|
|
- iprPersonId = iprPerson1.getId();
|
|
|
+ IprPerson newIprPerson = new IprPerson();
|
|
|
+ newIprPerson.setName(updateMatchCasePersonDTO.getName());
|
|
|
+ newIprPerson.setEmail(email);
|
|
|
+
|
|
|
+ newIprPerson.setType(type);
|
|
|
+ newIprPerson.setAssoAccountId(assoAccountId);
|
|
|
+ newIprPerson.setRemark(remark);
|
|
|
+
|
|
|
+ newIprPerson.setIfDefault(false);
|
|
|
+ newIprPerson.setCreateId(personId);
|
|
|
+ newIprPerson.setTenantId(tenantId);
|
|
|
+ newIprPerson.insert();
|
|
|
+ iprPersonId = newIprPerson.getId();
|
|
|
}
|
|
|
} else {
|
|
|
throw new XiaoShiException(ExceptionEnum.BUSINESS_ERROR, "邮箱不能为空");
|
|
|
}
|
|
|
updateMatchCasePersonDTO.setName(name);
|
|
|
- // new
|
|
|
updateMatchCasePersonDTO.setType(type);
|
|
|
updateMatchCasePersonDTO.setIprPersonId(iprPersonId);
|
|
|
MatchCasePerson matchCasePerson = this.addMatchCasePersonDB(updateMatchCasePersonDTO, assoId);
|
|
|
- if (type != null && type.equals(2)) {
|
|
|
- this.updateReportAgency(updateMatchCasePersonDTO.getReportId());
|
|
|
+ if (type != null) {
|
|
|
+ this.updateReport(updateMatchCasePersonDTO.getReportId(), type);
|
|
|
}
|
|
|
return matchCasePerson.getId();
|
|
|
}
|
|
|
|
|
|
- public void updateReportAgency(Integer projectId) {
|
|
|
- LambdaQueryWrapper<MatchCasePerson> queryWrapper1 = new LambdaQueryWrapper<>();
|
|
|
- queryWrapper1.eq(MatchCasePerson::getProjectId, projectId);
|
|
|
- MatchCasePerson matchCasePerson = this.getOne(queryWrapper1, false);
|
|
|
- Integer iprPersonId = matchCasePerson.getIprPersonId();
|
|
|
- IprPerson iprPerson = iprPersonService.getById(iprPersonId);
|
|
|
- String name = iprPerson.getName();
|
|
|
-
|
|
|
- LambdaQueryWrapper<ReportProject> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
- queryWrapper.eq(ReportProject::getProjectId, projectId);
|
|
|
- ReportProject reportProject = reportProjectService.getById(projectId);
|
|
|
- if (reportProject != null) {
|
|
|
- Integer actType = reportProject.getActType();
|
|
|
- //主动类型 专利权人代理所
|
|
|
- if (actType != null && actType.equals(1)) {
|
|
|
- String rightHolderAgency = reportProject.getRightHolderAgency();
|
|
|
- reportProject.setRightHolderAgency(rightHolderAgency + "," + name);
|
|
|
- } else {//被动类型 请求人代理所
|
|
|
- String applicantAgency = reportProject.getApplicantAgency();
|
|
|
- reportProject.setApplicantAgency(applicantAgency + "," + name);
|
|
|
+ public void updateReport(Integer projectId, Integer type) {
|
|
|
+ if (type != null) {
|
|
|
+ LambdaQueryWrapper<MatchCasePerson> queryWrapper1 = new LambdaQueryWrapper<>();
|
|
|
+ queryWrapper1.eq(MatchCasePerson::getProjectId, projectId)
|
|
|
+ .eq(MatchCasePerson::getType, type);
|
|
|
+ List<MatchCasePerson> matchCasePersons = this.list(queryWrapper1);
|
|
|
+
|
|
|
+ String resultName = Optional.ofNullable(matchCasePersons)
|
|
|
+ .orElse(Collections.emptyList())// 空值安全处理
|
|
|
+ .stream()
|
|
|
+ .map(person -> {
|
|
|
+ IprPerson iprPerson = iprPersonService.getById(person.getIprPersonId());
|
|
|
+ return (iprPerson != null && iprPerson.getName() != null) ? iprPerson.getName() : "";
|
|
|
+ }) //对象转换
|
|
|
+ .filter(name -> !name.isEmpty()) // 过滤无效数据
|
|
|
+ .collect(Collectors.joining("、")); // 只能拼接
|
|
|
+
|
|
|
+ LambdaQueryWrapper<ReportProject> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
+ queryWrapper.eq(ReportProject::getProjectId, projectId);
|
|
|
+ ReportProject reportProject = reportProjectService.getById(projectId);
|
|
|
+
|
|
|
+ if (type.equals(2)) { // 代理所
|
|
|
+ Integer actType = reportProject.getActType();
|
|
|
+ //主动类型 请求人代理所
|
|
|
+ if (actType != null && actType.equals(1)) {
|
|
|
+ reportProject.setApplicantAgency(resultName);
|
|
|
+ } else {//被动类型 专利权人代理所
|
|
|
+ reportProject.setRightHolderAgency(resultName);
|
|
|
+ }
|
|
|
+ } else if (type.equals(1)) { // 内部ipr
|
|
|
+ reportProject.setActualPerson(resultName);
|
|
|
}
|
|
|
reportProject.updateById();
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
|
|
|
public MatchCasePerson addMatchCasePersonDB(UpdateMatchCasePersonDTO updateMatchCasePersonDTO, Integer assoId) {
|
|
@@ -142,15 +149,12 @@ public class MatchCasePersonService extends ServiceImpl<MatchCasePersonMapper, M
|
|
|
Integer tenantId = personnelVO.getTenantId();
|
|
|
Integer id = updateMatchCasePersonDTO.getId();
|
|
|
Integer assoAccountId = updateMatchCasePersonDTO.getAssoAccountId();
|
|
|
-
|
|
|
- //更新
|
|
|
if (id != null) {
|
|
|
matchCasePerson = this.getById(id);
|
|
|
if (matchCasePerson != null) {
|
|
|
matchCasePerson.setIprPersonId(updateMatchCasePersonDTO.getIprPersonId());
|
|
|
matchCasePerson.updateById();
|
|
|
if (assoId != null) {
|
|
|
- //assoId取消关联
|
|
|
LambdaQueryWrapper<AssoProjectPerson> assoProjectPersonLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
assoProjectPersonLambdaQueryWrapper.eq(AssoProjectPerson::getProjectId, updateMatchCasePersonDTO.getReportId())
|
|
|
.eq(AssoProjectPerson::getRole, 1)
|