|
@@ -15,6 +15,7 @@ import org.springframework.beans.factory.annotation.Qualifier;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.util.List;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
* 采集元素第三方导入副本Service实现
|
|
@@ -59,20 +60,30 @@ public class GisSurveyLayerApplyThirdCopyServiceImpl implements GisSurveyLayerAp
|
|
|
//从session获取mapper
|
|
|
GisSurveyLayerApplyThirdCopyMapper layerApplyThirdCopyMapper = sqlSession.getMapper(GisSurveyLayerApplyThirdCopyMapper.class);
|
|
|
GisSurveyPropertyValueThirdCopyMapper propertyValueThirdCopyMapper = sqlSession.getMapper(GisSurveyPropertyValueThirdCopyMapper.class);
|
|
|
+
|
|
|
//删除原本job
|
|
|
layerApplyThirdCopyMapper.deleteByJobId(jobId);
|
|
|
propertyValueThirdCopyMapper.deleteByJobId(jobId);
|
|
|
- //批量插入
|
|
|
+
|
|
|
+ //批量插入图层
|
|
|
for (GisSurveyLayerApplyThirdCopy layerApply : layerApplyList) {
|
|
|
//检查线程中断,并响应
|
|
|
if (Thread.interrupted()) throw new InterruptedException();
|
|
|
//插入元素
|
|
|
layerApplyThirdCopyMapper.save(layerApply);
|
|
|
- for (GisSurveyPropertyValueThirdCopy propertyValue : layerApply.getPropertyValueList()) {
|
|
|
- //插入属性
|
|
|
- propertyValueThirdCopyMapper.save(propertyValue);
|
|
|
- }
|
|
|
}
|
|
|
+
|
|
|
+ //提取属性集合
|
|
|
+ List<GisSurveyPropertyValueThirdCopy> propertyValueList = layerApplyList.parallelStream()
|
|
|
+ .flatMap(it -> it.getPropertyValueList().stream())
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ //批量插入属性
|
|
|
+ for (GisSurveyPropertyValueThirdCopy gisSurveyPropertyValueThirdCopy : propertyValueList) {
|
|
|
+ //检查线程中断,并响应
|
|
|
+ if (Thread.interrupted()) throw new InterruptedException();
|
|
|
+ propertyValueThirdCopyMapper.save(gisSurveyPropertyValueThirdCopy);
|
|
|
+ }
|
|
|
+
|
|
|
//提交(此处会发送sql至数据库)
|
|
|
sqlSession.commit();
|
|
|
|