|
@@ -14,6 +14,7 @@ import cn.cslg.pas.domain.PatentApplicantMergeLink;
|
|
|
import cn.cslg.pas.domain.SystemDict;
|
|
|
import cn.cslg.pas.mapper.PatentApplicantMapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
@@ -238,16 +239,14 @@ public class PatentApplicantService extends ServiceImpl<PatentApplicantMapper, P
|
|
|
//判断当前名称是否为空
|
|
|
if (name != null) {
|
|
|
for (int i = 0; i < name.size(); i++) {
|
|
|
- String s = i < shortName.size() ? shortName.get(i) : null;
|
|
|
+ String s = i < shortName.size() ? shortName.get(i) :"";
|
|
|
+ s = s.replace((char) 12288, ' '); // 将中文空格替换为英文空格
|
|
|
+ s= s.trim();
|
|
|
String nam = name.get(i);
|
|
|
PatentApplicant temp = patentApplicantList.stream().filter(item->item.getMerge().equals(false)&&item.getName().equals(nam)).findFirst().orElse(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())) {
|
|
|
+ } else if (name.size()==1) {
|
|
|
temp.setShortName(s);
|
|
|
temp.updateById();
|
|
|
}
|
|
@@ -258,25 +257,11 @@ public class PatentApplicantService extends ServiceImpl<PatentApplicantMapper, P
|
|
|
} else {
|
|
|
for (String s : shortName) {
|
|
|
List<PatentApplicant> temp = patentApplicantList.stream().filter(item->item.getMerge().equals(0)&&item.getName().equals(s)).collect(Collectors.toList());
|
|
|
-// LambdaQueryWrapper<PatentApplicant> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
-// queryWrapper.eq(PatentApplicant::getShortName, s);
|
|
|
-// queryWrapper.eq(PatentApplicant::getMerge, 0);
|
|
|
-// List<PatentApplicant> temp = this.list(queryWrapper);
|
|
|
-
|
|
|
PatentApplicant patentApplicant = new PatentApplicant();
|
|
|
if (temp.size() == 0) {
|
|
|
patentApplicant = this.add(s, s);
|
|
|
} else {
|
|
|
- if (temp.size() == 1) {
|
|
|
patentApplicant = temp.get(0);
|
|
|
- } else {
|
|
|
- for (PatentApplicant pa : temp) {
|
|
|
- if (pa.getShortName().equals(pa.getName())) {
|
|
|
- patentApplicant = pa;
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
}
|
|
|
|
|
|
if(!ids.contains(patentApplicant.getId())){ids.add(patentApplicant.getId());}
|
|
@@ -352,4 +337,46 @@ public class PatentApplicantService extends ServiceImpl<PatentApplicantMapper, P
|
|
|
first.updateById();
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public List<Integer> test(){
|
|
|
+List<String> names = this.baseMapper.getNames();
|
|
|
+
|
|
|
+List<Integer> ids1 =new ArrayList<>();
|
|
|
+names.forEach(item->{
|
|
|
+ LambdaQueryWrapper<PatentApplicant> wrapper =new LambdaQueryWrapper<>();
|
|
|
+ wrapper.eq(PatentApplicant::getName,item);
|
|
|
+ List<PatentApplicant> lists =this.list(wrapper);
|
|
|
+ List<Integer> ids =lists.stream().map(PatentApplicant::getId).collect(Collectors.toList());
|
|
|
+ if(ids.size()<=1){
|
|
|
+ System.out.println("个数为"+ids.size());
|
|
|
+ }
|
|
|
+ Integer id =0;
|
|
|
+ for(PatentApplicant tem :lists) {
|
|
|
+ if (tem.getName().equals(tem.getShortName()) ) {
|
|
|
+ ids.remove(tem.getId());
|
|
|
+ id = tem.getId();
|
|
|
+ ids1.addAll(ids);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ PatentApplicant t=lists.get(0);
|
|
|
+ id =t.getId();
|
|
|
+ ids.remove(t.getId());;
|
|
|
+ ids1.addAll(ids);
|
|
|
+ if(id!=0){
|
|
|
+ LambdaUpdateWrapper<PatentApplicantLink> tem =new LambdaUpdateWrapper<>();
|
|
|
+ tem.set(PatentApplicantLink::getApplicantId,id)
|
|
|
+ .in(PatentApplicantLink::getApplicantId,ids);
|
|
|
+ patentApplicantLinkService.update(null,tem);
|
|
|
+ LambdaUpdateWrapper<PatentApplicantMergeLink> te =new LambdaUpdateWrapper<>();
|
|
|
+ te.set(PatentApplicantMergeLink::getApplicantId,id)
|
|
|
+ .in(PatentApplicantMergeLink::getApplicantId,ids);
|
|
|
+ patentApplicantMergeLinkService.update(null,te);
|
|
|
+ }
|
|
|
+ }
|
|
|
+);
|
|
|
+this.removeByIds(ids1);
|
|
|
+return ids1;
|
|
|
+ }
|
|
|
}
|