|
@@ -27,6 +27,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.util.ObjectUtils;
|
|
import org.springframework.util.ObjectUtils;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
import javax.annotation.Resource;
|
|
|
|
+import java.text.SimpleDateFormat;
|
|
import java.util.*;
|
|
import java.util.*;
|
|
import java.util.concurrent.CountDownLatch;
|
|
import java.util.concurrent.CountDownLatch;
|
|
import java.util.concurrent.ScheduledThreadPoolExecutor;
|
|
import java.util.concurrent.ScheduledThreadPoolExecutor;
|
|
@@ -333,32 +334,45 @@ public class ZEngineeringCivilServiceImpl implements IZEngineeringCivilService {
|
|
lqw.eq(StringUtils.isNotBlank(bo.getEnginCycle()), ZEngineeringCivil::getEnginCycle, bo.getEnginCycle());
|
|
lqw.eq(StringUtils.isNotBlank(bo.getEnginCycle()), ZEngineeringCivil::getEnginCycle, bo.getEnginCycle());
|
|
lqw.eq(StringUtils.isNotBlank(bo.getEnginClassification()), ZEngineeringCivil::getEnginClassification, bo.getEnginClassification());
|
|
lqw.eq(StringUtils.isNotBlank(bo.getEnginClassification()), ZEngineeringCivil::getEnginClassification, bo.getEnginClassification());
|
|
lqw.eq(StringUtils.isNotBlank(bo.getEnginType()), ZEngineeringCivil::getEnginType, bo.getEnginType());
|
|
lqw.eq(StringUtils.isNotBlank(bo.getEnginType()), ZEngineeringCivil::getEnginType, bo.getEnginType());
|
|
- List<ZEngineeringCivil> zEngineeringCivilList=baseMapper.selectList(lqw);
|
|
|
|
- int count=50;
|
|
|
|
|
|
+ SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM");
|
|
|
|
+ lqw.like(StringUtils.isNotBlank(bo.getCreateTime().toString()), ZEngineeringCivil::getCreateTime, "%"+dateFormat.format(bo.getCreateTime())+"%");
|
|
|
|
+ Long sumcount=baseMapper.selectCount(lqw);
|
|
|
|
+// List<ZEngineeringCivil> zEngineeringCivilList=baseMapper.selectList(lqw);
|
|
|
|
+ /**
|
|
|
|
+ * 线程执行插入量
|
|
|
|
+ */
|
|
|
|
+ int count=5000;
|
|
List <ZEngineeringCivil> newList = new ArrayList() ;
|
|
List <ZEngineeringCivil> newList = new ArrayList() ;
|
|
- if (zEngineeringCivilList.size()>0)
|
|
|
|
|
|
+ if (sumcount>0)
|
|
{
|
|
{
|
|
- int runSize=zEngineeringCivilList.size()/count+1;
|
|
|
|
|
|
+ //线程数量(根据查询总数量进行分配线程数量)
|
|
|
|
+ int runSize= (int) (sumcount/count+1);
|
|
ScheduledThreadPoolExecutor threadPoolTaskExecutor=new ScheduledThreadPoolExecutor(runSize);
|
|
ScheduledThreadPoolExecutor threadPoolTaskExecutor=new ScheduledThreadPoolExecutor(runSize);
|
|
CountDownLatch countDownLatch = new CountDownLatch(runSize);
|
|
CountDownLatch countDownLatch = new CountDownLatch(runSize);
|
|
-
|
|
|
|
for(int i=0;i<runSize;i++)
|
|
for(int i=0;i<runSize;i++)
|
|
{
|
|
{
|
|
- if((i+1)==runSize){
|
|
|
|
- int startIndex = (i*count);;
|
|
|
|
- int endIndex = zEngineeringCivilList.size();
|
|
|
|
- newList =zEngineeringCivilList.subList(startIndex,endIndex);
|
|
|
|
- }else{
|
|
|
|
- int startIndex = i*count;;
|
|
|
|
- int endIndex = (i+1)*count;
|
|
|
|
- newList =zEngineeringCivilList.subList(startIndex,endIndex);
|
|
|
|
- }
|
|
|
|
|
|
+ Page page=new Page<>(i,count);
|
|
|
|
+ Page<ZEngineeringCivil> zEngineeringCivilPage=baseMapper.selectPage(page,lqw);
|
|
|
|
+// if((i+1)==runSize){
|
|
|
|
+// int startIndex = (i*count);;
|
|
|
|
+// int endIndex = zEngineeringCivilList.size();
|
|
|
|
+// newList =zEngineeringCivilList.subList(startIndex,endIndex);
|
|
|
|
+// }else{
|
|
|
|
+// int startIndex = i*count;;
|
|
|
|
+// int endIndex = (i+1)*count;
|
|
|
|
+// newList =zEngineeringCivilList.subList(startIndex,endIndex);
|
|
|
|
+// }
|
|
|
|
|
|
- threadPoolTaskExecutor.execute(new RiewTask(newList,zEngineeringNodeBo));
|
|
|
|
|
|
+ threadPoolTaskExecutor.execute(new RiewTask(zEngineeringCivilPage.getRecords(),zEngineeringNodeBo,countDownLatch));
|
|
}
|
|
}
|
|
-
|
|
|
|
threadPoolTaskExecutor.shutdown();
|
|
threadPoolTaskExecutor.shutdown();
|
|
-
|
|
|
|
|
|
+// try {
|
|
|
|
+// countDownLatch.await();
|
|
|
|
+// threadPoolTaskExecutor.shutdown();
|
|
|
|
+// } catch (InterruptedException e) {
|
|
|
|
+// throw new RuntimeException(e);
|
|
|
|
+// }
|
|
|
|
+//
|
|
}
|
|
}
|
|
|
|
|
|
return 0;
|
|
return 0;
|