地区相关问题处理
This commit is contained in:
parent
f949896685
commit
0fc179cff2
@ -1,6 +1,8 @@
|
|||||||
package cn.lili.modules.base.serviceimpl;
|
package cn.lili.modules.base.serviceimpl;
|
||||||
|
|
||||||
import cn.lili.common.cache.Cache;
|
import cn.lili.common.cache.Cache;
|
||||||
|
import cn.lili.common.utils.StringUtils;
|
||||||
|
import cn.lili.common.utils.HttpClientUtils;
|
||||||
import cn.lili.common.utils.SnowFlake;
|
import cn.lili.common.utils.SnowFlake;
|
||||||
import cn.lili.modules.base.mapper.RegionMapper;
|
import cn.lili.modules.base.mapper.RegionMapper;
|
||||||
import cn.lili.modules.base.service.RegionService;
|
import cn.lili.modules.base.service.RegionService;
|
||||||
@ -39,20 +41,20 @@ public class RegionServiceImpl extends ServiceImpl<RegionMapper, Region> impleme
|
|||||||
public void synchronizationData(String url) {
|
public void synchronizationData(String url) {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
// //清空数据
|
//清空数据
|
||||||
// QueryWrapper<Region> queryWrapper = new QueryWrapper();
|
QueryWrapper<Region> queryWrapper = new QueryWrapper();
|
||||||
// queryWrapper.ne("id", "-1");
|
queryWrapper.ne("id", "-1");
|
||||||
// this.remove(queryWrapper);
|
this.remove(queryWrapper);
|
||||||
//
|
|
||||||
// //读取数据
|
//读取数据
|
||||||
// String jsonString = HttpClientUtils.doGet(StringUtils.isEmpty(url) ? syncUrl : url, null);
|
String jsonString = HttpClientUtils.doGet(StringUtils.isEmpty(url) ? syncUrl : url, null);
|
||||||
//
|
|
||||||
// //构造存储数据库的对象集合
|
//构造存储数据库的对象集合
|
||||||
// List<Region> regions = this.initData(jsonString);
|
List<Region> regions = this.initData(jsonString);
|
||||||
// for (int i = 0; i < (regions.size() / 100 + (regions.size() % 100 == 0 ? 0 : 1)); i++) {
|
for (int i = 0; i < (regions.size() / 100 + (regions.size() % 100 == 0 ? 0 : 1)); i++) {
|
||||||
// int endPoint = Math.min((100 + (i * 100)), regions.size());
|
int endPoint = Math.min((100 + (i * 100)), regions.size());
|
||||||
// this.saveBatch(regions.subList(i * 100, endPoint));
|
this.saveBatch(regions.subList(i * 100, endPoint));
|
||||||
// }
|
}
|
||||||
//删除缓存
|
//删除缓存
|
||||||
cache.vagueDel("{regions}");
|
cache.vagueDel("{regions}");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user