Commit fa95cd9b authored by 董建华's avatar 董建华

增加异常控制

parent 5c4b10c3
...@@ -75,11 +75,15 @@ public class CleanDataServiceImp implements CleanDataService { ...@@ -75,11 +75,15 @@ public class CleanDataServiceImp implements CleanDataService {
calendar.setTime(parse); calendar.setTime(parse);
long all = 0L; long all = 0L;
while (true) { while (true) {
Timestamp start = new Timestamp(calendar.getTime().getTime()); Timestamp start = new Timestamp(calendar.getTime().getTime());
calendar.add(Calendar.MONTH, 1); calendar.add(Calendar.MONTH, 1);
Timestamp end = new Timestamp(calendar.getTime().getTime()); Timestamp end = new Timestamp(calendar.getTime().getTime());
String starDate = (start.getYear() + 1900) + "年" + (start.getMonth() + 1) + "月" + start.getDate() + "日";
String endDate = (end.getYear() + 1900) + "年" + (end.getMonth() + 1) + "月" + end.getDate() + "日";
try {
List<UserExtInfo> list = iUserExtInfoService.findByCreatedAtAfterAndCreatedAtBeforeAndOccupationEnum(start, end); List<UserExtInfo> list = iUserExtInfoService.findByCreatedAtAfterAndCreatedAtBeforeAndOccupationEnum(start, end);
if (!CollectionUtils.isEmpty(list)) { if (!CollectionUtils.isEmpty(list)) {
...@@ -93,21 +97,20 @@ public class CleanDataServiceImp implements CleanDataService { ...@@ -93,21 +97,20 @@ public class CleanDataServiceImp implements CleanDataService {
} }
} }
} }
String starDate = (start.getYear() + 1900) + "年" + (start.getMonth() + 1) + "月" + start.getDate() + "日";
String endDate = (end.getYear() + 1900) + "年" + (end.getMonth() + 1) + "月" + end.getDate() + "日";
log.info("开始时间start:{},结束时间end: {} ,条数:{}", starDate, endDate, list.size()); log.info("开始时间start:{},结束时间end: {} ,条数:{}", starDate, endDate, list.size());
re.put(starDate + "-" + endDate, list.size()); re.put(starDate + "-" + endDate, list.size());
if (end.after(new Date())) { if (end.after(new Date())) {
break; break;
} }
} catch (Exception e) {
log.error("时间段:{}--{}执行异常,e", starDate, endDate, e);
} }
log.info("清洗结束总共清洗了all:{}条,耗时:{}秒", all, s.elapsed(TimeUnit.SECONDS)); log.info("清洗结束总共清洗了all:{}条,耗时:{}秒", all, s.elapsed(TimeUnit.SECONDS));
}
log.info("清洗明细:{} ", re); log.info("清洗明细:{} ", re);
} catch (Exception e) { } catch (Exception e) {
log.error("清洗的时候出现了异常e:{}", e);
} finally { } finally {
stringRedisTemplate.delete(LOCKKEY); stringRedisTemplate.delete(LOCKKEY);
} }
......
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