|
@@ -232,70 +232,102 @@ public class PatentApplicantService extends ServiceImpl<PatentApplicantMapper, P
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- *
|
|
|
|
- * @param name 权利人 通过分割符 | 分割后的List
|
|
|
|
|
|
+ * @param name 权利人 通过分割符 | 分割后的List
|
|
* @param shortName 【标】权利人 通过分割符 | 分割后的List
|
|
* @param shortName 【标】权利人 通过分割符 | 分割后的List
|
|
- * @return
|
|
|
|
*/
|
|
*/
|
|
public List<Integer> updatePatentApplicant(List<String> name, List<String> shortName) {
|
|
public List<Integer> updatePatentApplicant(List<String> name, List<String> shortName) {
|
|
//生成 一个存放ID的List
|
|
//生成 一个存放ID的List
|
|
List<Integer> ids = new ArrayList<>();
|
|
List<Integer> ids = new ArrayList<>();
|
|
- for (int i = 0; i < name.size(); i++) {
|
|
|
|
- String s = i < shortName.size() ? shortName.get(i) : null;
|
|
|
|
- LambdaQueryWrapper<PatentApplicant> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
|
- queryWrapper.eq(PatentApplicant::getName, name.get(i));
|
|
|
|
- queryWrapper.eq(PatentApplicant::getMerge, 0);
|
|
|
|
- PatentApplicant temp = this.getOne(queryWrapper);
|
|
|
|
- if (temp == null) {
|
|
|
|
- temp = this.add(name.get(i), s);
|
|
|
|
- } else if (s != null && !s.equals(temp.getShortName())) {
|
|
|
|
- temp.setShortName(s);
|
|
|
|
- temp.updateById();
|
|
|
|
|
|
+ if (name != null) {
|
|
|
|
+ for (int i = 0; i < name.size(); i++) {
|
|
|
|
+ String s = i < shortName.size() ? shortName.get(i) : null;
|
|
|
|
+ LambdaQueryWrapper<PatentApplicant> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
|
+ queryWrapper.eq(PatentApplicant::getName, name.get(i));
|
|
|
|
+ queryWrapper.eq(PatentApplicant::getMerge, 0);
|
|
|
|
+ PatentApplicant temp = this.getOne(queryWrapper);
|
|
|
|
+ if (temp == null) {
|
|
|
|
+ temp = this.add(name.get(i), s);
|
|
|
|
+ } else if (s != null && !s.equals(temp.getShortName())) {
|
|
|
|
+ temp.setShortName(s);
|
|
|
|
+ temp.updateById();
|
|
|
|
+ }
|
|
|
|
+ ids.add(temp.getId());
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ for (String s : shortName) {
|
|
|
|
+ LambdaQueryWrapper<PatentApplicant> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
|
+ queryWrapper.eq(PatentApplicant::getName, "");
|
|
|
|
+ queryWrapper.eq(PatentApplicant::getShortName, s);
|
|
|
|
+ queryWrapper.eq(PatentApplicant::getMerge, 0);
|
|
|
|
+ PatentApplicant temp = this.getOne(queryWrapper);
|
|
|
|
+ if (temp == null) {
|
|
|
|
+ temp = this.add("", s);
|
|
|
|
+ } else if (s != null && !s.equals(temp.getShortName())) {
|
|
|
|
+ temp.setShortName(s);
|
|
|
|
+ temp.updateById();
|
|
|
|
+ }
|
|
|
|
+ ids.add(temp.getId());
|
|
}
|
|
}
|
|
- ids.add(temp.getId());
|
|
|
|
}
|
|
}
|
|
|
|
+
|
|
return ids;
|
|
return ids;
|
|
}
|
|
}
|
|
|
|
|
|
public void updatePatentApplicantAddress(PatentApplicantAddressParams params) {
|
|
public void updatePatentApplicantAddress(PatentApplicantAddressParams params) {
|
|
|
|
+ //用专利ID获取数据 申请人ID 申请人类型 申请人顺序
|
|
List<PatentApplicantLink> patentApplicantLinkList = patentApplicantLinkService.getPatentApplicantAttributesByPatentId(params.getPatentId());
|
|
List<PatentApplicantLink> patentApplicantLinkList = patentApplicantLinkService.getPatentApplicantAttributesByPatentId(params.getPatentId());
|
|
|
|
+ //获取属于权利人的ID List 并且是第一位
|
|
List<Integer> currentIds = patentApplicantLinkList.stream().filter(item -> item.getType().equals(1) && !item.getOrder().equals(0)).map(PatentApplicantLink::getApplicantId).collect(Collectors.toList());
|
|
List<Integer> currentIds = patentApplicantLinkList.stream().filter(item -> item.getType().equals(1) && !item.getOrder().equals(0)).map(PatentApplicantLink::getApplicantId).collect(Collectors.toList());
|
|
Integer firstCurrentId = patentApplicantLinkList.stream().filter(item -> item.getType().equals(1) && item.getOrder().equals(0)).map(PatentApplicantLink::getApplicantId).findFirst().orElse(null);
|
|
Integer firstCurrentId = patentApplicantLinkList.stream().filter(item -> item.getType().equals(1) && item.getOrder().equals(0)).map(PatentApplicantLink::getApplicantId).findFirst().orElse(null);
|
|
List<Integer> originalIds = patentApplicantLinkList.stream().filter(item -> item.getType().equals(2) && item.getOrder().equals(0)).map(PatentApplicantLink::getApplicantId).collect(Collectors.toList());
|
|
List<Integer> originalIds = patentApplicantLinkList.stream().filter(item -> item.getType().equals(2) && item.getOrder().equals(0)).map(PatentApplicantLink::getApplicantId).collect(Collectors.toList());
|
|
|
|
+
|
|
List<PatentApplicant> currentList = this.getPatentApplicantByIds(currentIds);
|
|
List<PatentApplicant> currentList = this.getPatentApplicantByIds(currentIds);
|
|
PatentApplicant first = this.getById(firstCurrentId);
|
|
PatentApplicant first = this.getById(firstCurrentId);
|
|
List<PatentApplicant> originalList = this.getPatentApplicantByIds(originalIds);
|
|
List<PatentApplicant> originalList = this.getPatentApplicantByIds(originalIds);
|
|
- if (StringUtils.isNotEmpty(params.getCurrentAddress())) {
|
|
|
|
- currentList.forEach(item -> {
|
|
|
|
- AreaAddressDTO dto = areaService.getAreaAddressDTO(params.getCurrentAddress());
|
|
|
|
- item.setAddressStr(params.getCurrentAddress());
|
|
|
|
- item.setProvinceId(dto.getProvinceId());
|
|
|
|
- item.setCityId(dto.getCityId());
|
|
|
|
- item.setAreaId(dto.getAreaId());
|
|
|
|
- item.updateById();
|
|
|
|
- });
|
|
|
|
|
|
+
|
|
|
|
+ if (params.getCurrentAddress() != null) {
|
|
|
|
+ for (int i = 0; i < params.getCurrentAddress().size(); i++) {
|
|
|
|
+ int finalI = i;
|
|
|
|
+ currentList.forEach(item -> {
|
|
|
|
+ AreaAddressDTO dto = areaService.getAreaAddressDTO(params.getCurrentAddress().get(finalI));
|
|
|
|
+ item.setAddressStr(params.getCurrentAddress().get(finalI));
|
|
|
|
+ item.setProvinceId(dto.getProvinceId());
|
|
|
|
+ item.setCityId(dto.getCityId());
|
|
|
|
+ item.setAreaId(dto.getAreaId());
|
|
|
|
+ item.updateById();
|
|
|
|
+ });
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- if (StringUtils.isNotEmpty(params.getCurrentCountry())) {
|
|
|
|
- currentList.forEach(item -> {
|
|
|
|
- item.setCountry(params.getCurrentCountry());
|
|
|
|
- item.updateById();
|
|
|
|
- });
|
|
|
|
|
|
+ if (params.getCurrentCountry() != null) {
|
|
|
|
+ for (int i = 0; i < params.getCurrentCountry().size(); i++) {
|
|
|
|
+ int finalI = i;
|
|
|
|
+ currentList.forEach(item -> {
|
|
|
|
+ item.setCountry(params.getCurrentCountry().get(finalI));
|
|
|
|
+ item.updateById();
|
|
|
|
+ });
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- if (StringUtils.isNotEmpty(params.getOriginalAddress())) {
|
|
|
|
- originalList.forEach(item -> {
|
|
|
|
- AreaAddressDTO dto = areaService.getAreaAddressDTO(params.getOriginalAddress());
|
|
|
|
- item.setAddressStr(params.getOriginalAddress());
|
|
|
|
- item.setProvinceId(dto.getProvinceId());
|
|
|
|
- item.setCityId(dto.getCityId());
|
|
|
|
- item.setAreaId(dto.getAreaId());
|
|
|
|
- item.updateById();
|
|
|
|
- });
|
|
|
|
|
|
+ if (params.getOriginalAddress() != null) {
|
|
|
|
+ for (int i = 0; i < params.getOriginalAddress().size(); i++) {
|
|
|
|
+ int finalI = i;
|
|
|
|
+ originalList.forEach(item -> {
|
|
|
|
+ AreaAddressDTO dto = areaService.getAreaAddressDTO(params.getOriginalAddress().get(finalI));
|
|
|
|
+ item.setAddressStr(params.getOriginalAddress().get(finalI));
|
|
|
|
+ item.setProvinceId(dto.getProvinceId());
|
|
|
|
+ item.setCityId(dto.getCityId());
|
|
|
|
+ item.setAreaId(dto.getAreaId());
|
|
|
|
+ item.updateById();
|
|
|
|
+ });
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- if (StringUtils.isNotEmpty(params.getOriginalCountry())) {
|
|
|
|
- originalList.forEach(item -> {
|
|
|
|
- item.setCountry(params.getOriginalCountry());
|
|
|
|
- item.updateById();
|
|
|
|
- });
|
|
|
|
|
|
+ if (params.getOriginalCountry() != null) {
|
|
|
|
+ for (int i = 0; i < params.getOriginalCountry().size(); i++) {
|
|
|
|
+ int finalI = i;
|
|
|
|
+ originalList.forEach(item -> {
|
|
|
|
+ item.setCountry(params.getOriginalCountry().get(finalI));
|
|
|
|
+ item.updateById();
|
|
|
|
+ });
|
|
|
|
+ }
|
|
}
|
|
}
|
|
if (StringUtils.isNotEmpty(params.getFirstCurrentAddress()) && first != null) {
|
|
if (StringUtils.isNotEmpty(params.getFirstCurrentAddress()) && first != null) {
|
|
AreaAddressDTO dto = areaService.getAreaAddressDTO(params.getFirstCurrentAddress());
|
|
AreaAddressDTO dto = areaService.getAreaAddressDTO(params.getFirstCurrentAddress());
|