体测导入修改
This commit is contained in:
@@ -1,9 +1,6 @@
|
|||||||
package com.srs.common.utils;
|
package com.srs.common.utils;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@@ -29,37 +26,41 @@ public class listFunc {
|
|||||||
}).collect(Collectors.toList());
|
}).collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<String> subList(List<String> actualList, List<String> expectList){
|
/**
|
||||||
List<String> list1 = actualList.stream().map(String::new).collect(Collectors.toList());
|
* 获取需要添加的元素(在list1中存在但在list2中不存在的元素)
|
||||||
List<String> list2 = expectList.stream().map(String::new).collect(Collectors.toList());
|
* @param list1 待导入的列表
|
||||||
|
* @param list2 已存在的列表
|
||||||
|
* @return 需要添加的元素列表
|
||||||
|
*/
|
||||||
|
public static List<String> subList(List<String> list1, List<String> list2) {
|
||||||
|
List<String> result = new ArrayList<>();
|
||||||
|
Set<String> set2 = new HashSet<>(list2); // 使用HashSet提高查找效率
|
||||||
|
|
||||||
if(list2.size() == 0){
|
for (String item : list1) {
|
||||||
return list1;
|
if (!set2.contains(item)) {
|
||||||
}
|
result.add(item);
|
||||||
if(list1.containsAll(list2) && list2.containsAll(list1)){
|
}
|
||||||
return new ArrayList<>();
|
|
||||||
} else {
|
|
||||||
List<String> temp = list1.stream()
|
|
||||||
.filter(x->list2.contains(x)).collect(Collectors.toList());
|
|
||||||
list1.removeAll(temp);
|
|
||||||
return list1;
|
|
||||||
}
|
}
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 两个列表的交集
|
* 获取需要修改的元素(两个列表中都存在的元素)
|
||||||
* @author zhy
|
* @param list1 待导入的列表
|
||||||
* @date 2023-08-18 09:59:34
|
* @param list2 已存在的列表
|
||||||
* @param list1
|
* @return 需要修改的元素列表
|
||||||
* @param list2
|
*/
|
||||||
* @return
|
public static List<String> intersectList(List<String> list1, List<String> list2) {
|
||||||
**/
|
List<String> result = new ArrayList<>();
|
||||||
public static List<String> intersectList(List<String> list1, List<String> list2){
|
Set<String> set2 = new HashSet<>(list2); // 使用HashSet提高查找效率
|
||||||
Map<String, String> tempMap = list2.parallelStream().collect(Collectors.toMap(Function.identity(), Function.identity(), (oldData, newData) -> newData));
|
|
||||||
return list1.parallelStream().filter(str->{
|
for (String item : list1) {
|
||||||
return tempMap.containsKey(str);
|
if (set2.contains(item)) {
|
||||||
}).collect(Collectors.toList());
|
result.add(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import java.util.stream.Collectors;
|
|||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.srs.common.annotation.Excel;
|
import com.srs.common.annotation.Excel;
|
||||||
import com.srs.common.core.domain.AjaxResult;
|
import com.srs.common.core.domain.AjaxResult;
|
||||||
import com.srs.common.core.domain.BaseEntity;
|
import com.srs.common.core.domain.BaseEntity;
|
||||||
@@ -38,7 +39,7 @@ import static org.apache.commons.lang3.SystemUtils.getUserName;
|
|||||||
* @date 2023-06-28
|
* @date 2023-06-28
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class SrsSportTestServiceImpl implements ISrsSportTestService
|
public class SrsSportTestServiceImpl extends ServiceImpl<SrsSportTestMapper,SrsSportTest> implements ISrsSportTestService
|
||||||
{
|
{
|
||||||
@Autowired
|
@Autowired
|
||||||
private SrsSportTestMapper srsSportTestMapper;
|
private SrsSportTestMapper srsSportTestMapper;
|
||||||
@@ -274,10 +275,12 @@ public class SrsSportTestServiceImpl implements ISrsSportTestService
|
|||||||
}
|
}
|
||||||
//修改体能测试
|
//修改体能测试
|
||||||
if (needUpdateQuery.size() != 0) {
|
if (needUpdateQuery.size() != 0) {
|
||||||
//单条
|
this.updateBatchById(needUpdateQuery);
|
||||||
for (SrsSportTest srsSportTest:needUpdateQuery){
|
// //单条
|
||||||
srsSportTestMapper.updateSrsSportTest(srsSportTest);
|
// for (SrsSportTest srsSportTest:needUpdateQuery){
|
||||||
}
|
//
|
||||||
|
// srsSportTestMapper.updateSrsSportTest(srsSportTest);
|
||||||
|
// }
|
||||||
//切片批量
|
//切片批量
|
||||||
// int userListSize=needUpdateQuery.size();
|
// int userListSize=needUpdateQuery.size();
|
||||||
// int sum=userListSize/1000;
|
// int sum=userListSize/1000;
|
||||||
|
|||||||
Reference in New Issue
Block a user