Commit e55ad617 by leialin

提交

parent 09ce455a
...@@ -5,6 +5,8 @@ import java.text.Format; ...@@ -5,6 +5,8 @@ import java.text.Format;
import java.text.ParseException; import java.text.ParseException;
import java.text.ParsePosition; import java.text.ParsePosition;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Calendar; import java.util.Calendar;
...@@ -52,15 +54,20 @@ public class ClockInTool { ...@@ -52,15 +54,20 @@ public class ClockInTool {
// 获得上个月月份年份 // 获得上个月月份年份
public static String getLastYearMonth() { public static String getLastYearMonth() {
Calendar now = Calendar.getInstance(); // Calendar now = Calendar.getInstance();
int month = now.get(Calendar.MONTH); // int month = now.get(Calendar.MONTH);
String m; // String m;
if (month < 10) { // if (month < 10) {
m = "0" + month; // m = "0" + month;
} else { // } else {
m = month + ""; // m = month + "";
} // }
return now.get(Calendar.YEAR) + "-" + m; // return now.get(Calendar.YEAR) + "-" + m;
LocalDate today = LocalDate.now();
today = today.minusMonths(1);
DateTimeFormatter formatters = DateTimeFormatter.ofPattern("yyyy-MM");
return formatters.format(today);
} }
/** /**
......
...@@ -91,7 +91,7 @@ public class LastMonthtimingExport { ...@@ -91,7 +91,7 @@ public class LastMonthtimingExport {
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
// @Scheduled(cron = "0 22 14 * * ?") // @Scheduled(cron = "0 55 11 * * ?")
@Scheduled(cron = "0 0 4,20 * * ?")//每天上午4点,下午20点 执行 @Scheduled(cron = "0 0 4,20 * * ?")//每天上午4点,下午20点 执行
public void LastMonthtimingAttendanceTask() throws ParseException { public void LastMonthtimingAttendanceTask() throws ParseException {
......
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