跨月删除时,如果在七天以内则从月初开始删除

odoo切换查询方式
YXY 1 year ago
parent 95b682ebe6
commit 1164d3be20

@ -5,6 +5,7 @@ import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.*;
import java.time.format.DateTimeFormatter;
import java.time.temporal.TemporalAdjusters;
import java.util.Date;
import org.apache.commons.lang3.time.DateFormatUtils;
@ -198,4 +199,9 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
Instant instant = time.atZone(zone).toInstant();
return instant.toEpochMilli();
}
public static String firstDayOfMonthToString(){
LocalDate firstDayOfMonth = LocalDate.now().with(TemporalAdjusters.firstDayOfMonth());
return firstDayOfMonth.toString();
}
}

@ -200,7 +200,8 @@ public abstract class SyncAccountsJobAbstract {
LarkCompanyRelation companyRelation = context.getCompanyRelation();
LarkTableRelation tableRelation = context.getTableRelation();
LarkTableRequest request = new LarkTableRequest(companyRelation.getAppId(), companyRelation.getSecret(), tableRelation.getToAppToken(), tableRelation.getToTableId());
String date = DateUtils.ldt2str(now.minusDays(7L), DateUtils.YYYY_MM_DD);
int dayOfMonth = now.getDayOfMonth();
String date = dayOfMonth > 7 ? DateUtils.ldt2str(now.minusDays(7L), DateUtils.YYYY_MM_DD) : DateUtils.firstDayOfMonthToString();
List<String> recordList = erpLarkRelationMapper.queryWaitDeleteRecordList(date, getRequestUrl(), cjt);
List<String> waitDeleteList = new ArrayList<>();
for (String record : recordList) {

Loading…
Cancel
Save