抽数删除任务修改

This commit is contained in:
XinWei 2024-08-29 17:52:04 +08:00
parent 21b3850062
commit 544f20b6f7
3 changed files with 9 additions and 2 deletions

View File

@ -47,4 +47,8 @@ public class TicketingController {
public CommonResult<List<String>> testAlla(){
return CommonResult.success(saleDataService.deleteTwoYearLastMonthAgo());
}
@GetMapping("/testSample")
public void testSample(){
ticketDataMigration.deleteTwoYearOneMonthAgoAndUpdateLastYearTomorrow();
}
}

View File

@ -401,6 +401,9 @@ public class TicketDataMigration {
int currentDay = startDate.get(Calendar.DAY_OF_MONTH);
result.add(String.format("抽数服务:%d年%d月%d日" + methodName + "数据抽数正常结束!总共:%d条数据%d条数据重复%d条数据插入成功", currentYear, currentMonth, currentDay, totalRows, duplicatesCount, successCount));
XxlJobHelper.log("抽数服务:{}年{}月{}日:{}数据抽数正常结束!总共:{}条数据,{}条数据重复,{}条数据插入成功!", currentYear, currentMonth, currentDay, methodName, totalRows, duplicatesCount, successCount);
if (startDate.equals(endDate)){ // 如果日期相等退出循环
break;
}
// 日期递增一天
startDate.add(Calendar.DAY_OF_MONTH, 1);
}

View File

@ -139,8 +139,8 @@ public class CheckTicketServiceImpl implements CheckTicketService {
// TODO 使用这种方法删除会报错暂时使用mongoTemplate进行删除
// checkTicketTodayRepository.deleteByCheckticketdateIn(filteredDate);
Query query = new Query();
query.addCriteria(Criteria.where("sddate").in(filteredDate));
mongoTemplate.remove(query, "sale_data_today");
query.addCriteria(Criteria.where("checkticketdate").in(filteredDate));
mongoTemplate.remove(query, "check_ticket_today");
return filteredDate;
}