|
@@ -12,6 +12,7 @@ import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.collections4.ListUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.HashMap;
|
|
@@ -39,6 +40,7 @@ public class CliTqStationServiceImpl implements CliTqStationService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
+ @Transactional
|
|
|
public List<CliTqStation> listSta(String adminCodes) {
|
|
|
/** 2. 调用方法的参数定义,并赋值
|
|
|
/** 2.1 接口ID */
|
|
@@ -107,7 +109,7 @@ public class CliTqStationServiceImpl implements CliTqStationService {
|
|
|
stationList.add(station);
|
|
|
}
|
|
|
//切分数据
|
|
|
- List<List<CliTqStation>> partition = ListUtils.partition(stationList, 500);
|
|
|
+ List<List<CliTqStation>> partition = ListUtils.partition(stationList, 200);
|
|
|
System.out.println(partition);
|
|
|
for (int i = 0; i < partition.size(); i++) {
|
|
|
List<CliTqStation> weaTqstaList = partition.get(i);
|
|
@@ -115,7 +117,7 @@ public class CliTqStationServiceImpl implements CliTqStationService {
|
|
|
if (insert > 0) {
|
|
|
System.out.println("插入成功");
|
|
|
} else {
|
|
|
- throw new RuntimeException("插入数据库失败");
|
|
|
+ System.out.println("插入失败");
|
|
|
}
|
|
|
}
|
|
|
}
|