feat: 代码提交

zhairh
chenhc 1 year ago
parent 4d384129b8
commit 5676f02c54

@ -58,7 +58,7 @@ public class ChsYbChsHttpClient {
params.put("sord", "asc");
params.put("specificationCode", "C");
try {
Thread.sleep(20000);
Thread.sleep(15000);
} catch (InterruptedException e) {
e.printStackTrace();
}
@ -78,7 +78,7 @@ public class ChsYbChsHttpClient {
params.put("sord", "asc");
params.put("specificationCode", specificationCode);
try {
Thread.sleep(15000);
Thread.sleep(10000);
} catch (InterruptedException e) {
e.printStackTrace();
}

@ -39,6 +39,7 @@ public class ChsYbHcxxGgService extends ServiceImpl<YbHcxxGgMapper, YbHcxxGgEnti
page.setCurrent(pageNum);
QueryWrapper<YbHcxxEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.select("specificationCode");
// queryWrapper.ge("specificationCode","C0314010870100110845");
queryWrapper.orderByAsc("specificationCode");
ybHcxxMapper.selectPage(page, queryWrapper);
@ -54,6 +55,7 @@ public class ChsYbHcxxGgService extends ServiceImpl<YbHcxxGgMapper, YbHcxxGgEnti
long pageTotal = total/pageSize + 1;
for (int i = 2; i <= pageTotal ; i++) {
page.setCurrent(i);
System.out.println("更新数据库的YbHcxxGg列表数据总页数"+ pageTotal+";当前总进度:"+i);
ybHcxxMapper.selectPage(page, queryWrapper);
List<YbHcxxEntity> records2 = page.getRecords();
records2.forEach( x->{
@ -76,11 +78,12 @@ public class ChsYbHcxxGgService extends ServiceImpl<YbHcxxGgMapper, YbHcxxGgEnti
YbHcxxGgResponse ybHcxxGgResponse = ybChsHttpClient.getYbHcxxGgList(specificationCode, pageNum, pageSize);
Integer total = ybHcxxGgResponse.getTotal();
//处理第一批数据
System.out.println("更新数据库的YbHcxxGg列表数据"+specificationCode + "第"+ 1+"页");
processUpdates(ybHcxxGgResponse);
//处理后续数据
if (total>pageNum){
for (int i = 2; i <= total ; i++) {
System.out.println("更新数据库的YbHcxxGg列表数据"+ i);
System.out.println("更新数据库的YbHcxxGg列表数据"+specificationCode + "第"+ i+"页");
processUpdates(ybChsHttpClient.getYbHcxxGgList(specificationCode,i, pageSize));
}
}
@ -94,6 +97,7 @@ public class ChsYbHcxxGgService extends ServiceImpl<YbHcxxGgMapper, YbHcxxGgEnti
private void processUpdates(YbHcxxGgResponse ybHcxxGgResponse) {
List<YbHcxxGgResponse.RowsDTO> list = ybHcxxGgResponse.getRows();
List<YbHcxxGgEntity> ybHcxxGgEntities = BeanUtil.copyToList(list, YbHcxxGgEntity.class);
if (CollectionUtil.isNotEmpty(ybHcxxGgEntities))
ybHcxxGgMapper.batchSaveOrUpdateBySpecificationCode(ybHcxxGgEntities);
}

@ -33,7 +33,7 @@ public class ChsYbHcxxService extends ServiceImpl<YbHcxxMapper, YbHcxxEntity> {
processUpdates(ybHcxxResponse);
//处理后续数据
if (total>pageNum){
for (int i = 2; i <= total ; i++) {
for (int i = 2 ; i <= total ; i++) {
System.out.println("更新数据库的YbHcxx列表数据"+ i);
processUpdates(ybChsHttpClient.getYbHcxxList(i, pageSize));
}

Loading…
Cancel
Save