Commit 877df31b authored by “yiyousong”'s avatar “yiyousong”
parents d31cf9ad a5aa5cc5
...@@ -46,11 +46,20 @@ public class SyncSiteMatterTaskImpl implements ITaskExcuteService { ...@@ -46,11 +46,20 @@ public class SyncSiteMatterTaskImpl implements ITaskExcuteService {
if (siteRest.getCode() == YesNoEnum.YES.getValue()) { if (siteRest.getCode() == YesNoEnum.YES.getValue()) {
log.info("总数量:{}",siteRest.getData().size()); log.info("总数量:{}",siteRest.getData().size());
siteRest.getData().forEach(site -> { siteRest.getData().forEach(site -> {
sheetMatterService.getDao().delete(new SheetMatterQuery().siteId(site.getId()));
int page=100;
int pageNum=100;
for(int i=1;i<=page;i++){
SiteMatterPdu siteMatterPdu = new SiteMatterPdu(); SiteMatterPdu siteMatterPdu = new SiteMatterPdu();
siteMatterPdu.setPage(1); siteMatterPdu.setPage(i);
siteMatterPdu.setSize(-1); siteMatterPdu.setSize(pageNum);
log.info("请求列表:"+i);
Rest<RespData<List<SiteMatterPdu>>> siteMatterRest = siteMatterFeign.list(siteMatterPdu); Rest<RespData<List<SiteMatterPdu>>> siteMatterRest = siteMatterFeign.list(siteMatterPdu);
if (siteMatterRest.getCode() == YesNoEnum.YES.getValue()) { if (siteMatterRest.getCode() == YesNoEnum.YES.getValue()) {
if(siteMatterRest.getData().getData().size()==0){
log.info("数据没有!跳出循环");
break;
}
//删除后新增 //删除后新增
log.info("事项总数量:{}",siteMatterRest.getData().getData().size()); log.info("事项总数量:{}",siteMatterRest.getData().getData().size());
List<SheetMatterEntity> sheetMatterEntities = siteMatterRest.getData().getData().stream().map(siteMatter -> { List<SheetMatterEntity> sheetMatterEntities = siteMatterRest.getData().getData().stream().map(siteMatter -> {
...@@ -68,17 +77,19 @@ public class SyncSiteMatterTaskImpl implements ITaskExcuteService { ...@@ -68,17 +77,19 @@ public class SyncSiteMatterTaskImpl implements ITaskExcuteService {
}).collect(Collectors.toList()); }).collect(Collectors.toList());
if (!ObjectUtils.isEmpty(sheetMatterEntities)) { if (!ObjectUtils.isEmpty(sheetMatterEntities)) {
sheetMatterService.getDao().delete(new SheetMatterQuery().siteId(site.getId())); // sheetMatterService.getDao().delete(new SheetMatterQuery().siteId(site.getId()));
log.info("新增数量:{}",sheetMatterEntities.size()); log.info("新增数量:{}",sheetMatterEntities.size());
List<List<SheetMatterEntity>> partition = ListUtil.partition(sheetMatterEntities, 500); sheetMatterService.save(sheetMatterEntities);
/* List<List<SheetMatterEntity>> partition = ListUtil.partition(sheetMatterEntities, 500);
for (List<SheetMatterEntity> matterEntities : partition) { for (List<SheetMatterEntity> matterEntities : partition) {
sheetMatterService.save(matterEntities); }*/
}
} }
}else{ }else{
log.info("请求错误,code:{}",siteMatterRest.getCode()); log.info("请求错误,code:{}",siteMatterRest.getCode());
} }
}
}); });
} }
} }
......
...@@ -13,7 +13,6 @@ spring: ...@@ -13,7 +13,6 @@ spring:
jackson: jackson:
date-format: yyyy-MM-dd HH:mm:ss date-format: yyyy-MM-dd HH:mm:ss
time-zone: GMT+8 time-zone: GMT+8
cloud: cloud:
nacos: nacos:
# Nacos 作为注册中心的配置项,对应 NacosDiscoveryProperties 配置类 # Nacos 作为注册中心的配置项,对应 NacosDiscoveryProperties 配置类
...@@ -45,3 +44,10 @@ cookie: ...@@ -45,3 +44,10 @@ cookie:
port: 111 port: 111
token: token:
head: mortal head: mortal
hystrix:
command:
default:
execution:
isolation:
thread:
timeoutInMilliseconds: 60000
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment