Commit fb5903e8 by ilal

提交

parent 00c586de
...@@ -12,6 +12,7 @@ import java.util.Date; ...@@ -12,6 +12,7 @@ import java.util.Date;
import java.util.GregorianCalendar; import java.util.GregorianCalendar;
import java.util.HashSet; import java.util.HashSet;
import java.util.Iterator; import java.util.Iterator;
import java.util.LinkedList;
import java.util.List; import java.util.List;
import java.util.Locale; import java.util.Locale;
import java.util.Set; import java.util.Set;
...@@ -26,6 +27,24 @@ public class ClockInTool { ...@@ -26,6 +27,24 @@ public class ClockInTool {
static SimpleDateFormat famt = new SimpleDateFormat("yyyy-MM-dd"); static SimpleDateFormat famt = new SimpleDateFormat("yyyy-MM-dd");
public static String[] shuzuqucong(String[] temp) {
List<String> list = new LinkedList<String>();
for(int i = 0; i < temp.length; i++) {
if(!list.contains(temp[i])) {
list.add(temp[i]);
}
}
String[] rowsTemp = list.toArray(new String[list.size()]);
if(rowsTemp!=null && rowsTemp.length > 0) {
for(int i=0; i<rowsTemp.length; i++) {
System.out.println(rowsTemp[i]);
}
}
return rowsTemp;
}
public static boolean useArrayUtils(String[] arr, String targetValue) { public static boolean useArrayUtils(String[] arr, String targetValue) {
return ArrayUtils.contains(arr,targetValue); return ArrayUtils.contains(arr,targetValue);
......
...@@ -101,7 +101,7 @@ public class AttendanceTaskTiming{ ...@@ -101,7 +101,7 @@ public class AttendanceTaskTiming{
//typeid:1-员工 2-考勤组 //typeid:1-员工 2-考勤组
// @Scheduled(cron = "0 */5 * * * ?") // @Scheduled(cron = "0 */5 * * * ?")
// @Scheduled(cron = "0 33 9 * * ?") // @Scheduled(cron = "0 6 17 * * ?")
@Scheduled(cron = "0 0 8,12,16,20 * * ?")//每天上午8、12点,下午16点,20点 执行 @Scheduled(cron = "0 0 8,12,16,20 * * ?")//每天上午8、12点,下午16点,20点 执行
public void AttendanceTask() throws ParseException { public void AttendanceTask() throws ParseException {
...@@ -289,8 +289,10 @@ public class AttendanceTaskTiming{ ...@@ -289,8 +289,10 @@ public class AttendanceTaskTiming{
String yemo = year + "-" + month; String yemo = year + "-" + month;
sdf1.setLenient(false); sdf1.setLenient(false);
int y = 0,q = 0,jj = 0;//jj:节假日 int y = 0,q = 0,jj = 0,xx = 0;//jj:节假日
String[] zdxx = new String[20];//法定休息的具体天数(yyyy-MM-dd)
for(int i = 1; i <= ClockInTool.getDaysByYearMonth(year,month); i++){ for(int i = 1; i <= ClockInTool.getDaysByYearMonth(year,month); i++){
boolean xixi = true;
Date date1 = sdf1.parse(yemo + "-" + i); Date date1 = sdf1.parse(yemo + "-" + i);
for(int u=0;u<week.length;u++){ for(int u=0;u<week.length;u++){
if(sdf2.format(date1).equals(week[u])){ if(sdf2.format(date1).equals(week[u])){
...@@ -306,13 +308,26 @@ public class AttendanceTaskTiming{ ...@@ -306,13 +308,26 @@ public class AttendanceTaskTiming{
jj ++; jj ++;
} }
} }
xixi = false;
}
}
if(xixi) {
zdxx[xx] = yemo + "-" + i;
xx++;
} }
} }
if(appmaps.length > 0) {
for(String aa : ClockInTool.deleteArrayNull(zdxx)) {
appmaps = ClockInTool.doChinFilters(ClockInTool.deleteArrayNull(appmaps), aa);
} }
}
//全月时间 - 应打卡时间 - 必须打卡时间 + 无需打卡时间 //全月时间 - 应打卡时间 - 必须打卡时间 + 无需打卡时间
int xiuxi = ClockInTool.getDaysByYearMonth(year,month) - q - bxdk + wxdk.size()+jj; int xiuxi = ClockInTool.getDaysByYearMonth(year,month) - q - bxdk + appmaps.length+jj;//ClockInTool.getDaysByYearMonth(year,month) - q - bxdk + wxdk.size()+jj;
daysOff = xiuxi; daysOff = xiuxi;
daysOnDuty = y+bxdk; daysOnDuty = y+bxdk;
// String[] range=ClockInTool.listToString(ClockInTool.getDays(sdf1.format(c.getTime()),str)).split(";");//目前为止所有日期 // String[] range=ClockInTool.listToString(ClockInTool.getDays(sdf1.format(c.getTime()),str)).split(";");//目前为止所有日期
...@@ -322,6 +337,7 @@ public class AttendanceTaskTiming{ ...@@ -322,6 +337,7 @@ public class AttendanceTaskTiming{
int zj = 6; int zj = 6;
int fd = 0; int fd = 0;
for(String num : range) { for(String num : range) {
boolean xxr = true;
if(ClockInTool.useArrayUtils(needfig, String.valueOf(ClockInTool.dateToWeek(num)))) {//对比排班应打卡时间 if(ClockInTool.useArrayUtils(needfig, String.valueOf(ClockInTool.dateToWeek(num)))) {//对比排班应打卡时间
String[] ycqtst = new String[ycqts.length + zj]; String[] ycqtst = new String[ycqts.length + zj];
System.arraycopy(ycqts, 0, ycqtst, 0, ycqts.length); System.arraycopy(ycqts, 0, ycqtst, 0, ycqts.length);
...@@ -339,6 +355,7 @@ public class AttendanceTaskTiming{ ...@@ -339,6 +355,7 @@ public class AttendanceTaskTiming{
//xxts[x] = num; //xxts[x] = num;
x++; x++;
xxr = false;
} }
if(ClockInTool.useArrayUtils(bxdkss, num)) {//检查是否存在 必须打卡名单中 if(ClockInTool.useArrayUtils(bxdkss, num)) {//检查是否存在 必须打卡名单中
String[] ycqtst = new String[ycqts.length + zj]; String[] ycqtst = new String[ycqts.length + zj];
...@@ -357,7 +374,10 @@ public class AttendanceTaskTiming{ ...@@ -357,7 +374,10 @@ public class AttendanceTaskTiming{
// ycqts = ClockInTool.doChinFilters(ClockInTool.deleteArrayNull(ycqts), num);//为必须休息的话从上班日期中去除 // ycqts = ClockInTool.doChinFilters(ClockInTool.deleteArrayNull(ycqts), num);//为必须休息的话从上班日期中去除
//防止休息日重复减
if(xxr) {
zjgzts = zjgzts - 1; zjgzts = zjgzts - 1;
}
String[] xxtst = new String[xxts.length + zj]; String[] xxtst = new String[xxts.length + zj];
System.arraycopy(xxts, 0, xxtst, 0, xxts.length); System.arraycopy(xxts, 0, xxtst, 0, xxts.length);
......
...@@ -93,7 +93,7 @@ public class LastMonthtimingExport { ...@@ -93,7 +93,7 @@ public class LastMonthtimingExport {
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
// @Scheduled(cron = "0 25 9 * * ?") // @Scheduled(cron = "0 48 16 * * ?")
@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 {
...@@ -278,13 +278,16 @@ public class LastMonthtimingExport { ...@@ -278,13 +278,16 @@ public class LastMonthtimingExport {
String yemo = year + "-" + month; String yemo = year + "-" + month;
sdf1.setLenient(false); sdf1.setLenient(false);
int y = 0,q = 0,jj = 0;//jj:节假日 int y = 0,q = 0,jj = 0,xx = 0;//jj:节假日
String[] zdxx = new String[20];//法定休息的具体天数(yyyy-MM-dd)
for(int i = 1; i <= ClockInTool.getDaysByYearMonth(year,month); i++){ for(int i = 1; i <= ClockInTool.getDaysByYearMonth(year,month); i++){
boolean xixi = true;
Date date1 = sdf1.parse(yemo + "-" + i); Date date1 = sdf1.parse(yemo + "-" + i);
for(int u=0;u<week.length;u++){ for(int u=0;u<week.length;u++){
if(sdf2.format(date1).equals(week[u])){ if(sdf2.format(date1).equals(week[u])){
q++; q++;
y++; y++;
//无需打卡天数
if(Arrays.asList(appmaps).contains(String.valueOf(sdf1.format(date1)))){ if(Arrays.asList(appmaps).contains(String.valueOf(sdf1.format(date1)))){
y = y-1; y = y-1;
} }
...@@ -295,11 +298,26 @@ public class LastMonthtimingExport { ...@@ -295,11 +298,26 @@ public class LastMonthtimingExport {
jj ++; jj ++;
} }
} }
xixi = false;
}
}
if(xixi) {
zdxx[xx] = yemo + "-" + i;
xx++;
}
} }
// System.out.println(zdxx);
if(appmaps.length > 0) {
for(String aa : ClockInTool.deleteArrayNull(zdxx)) {
appmaps = ClockInTool.doChinFilters(ClockInTool.deleteArrayNull(appmaps), aa);
} }
} }
//全月时间 - 应打卡时间 - 必须打卡时间 + 无需打卡时间 //全月时间 - 应打卡时间 - 必须打卡时间 + 无需打卡时间
int xiuxi = ClockInTool.getDaysByYearMonth(year,month) - q - bxdk + wxdk.size()+jj; int xiuxi = ClockInTool.getDaysByYearMonth(year,month) - q - bxdk + appmaps.length+jj;//ClockInTool.getDaysByYearMonth(year,month) - q - bxdk + wxdk.size()+jj;
daysOff = xiuxi; daysOff = xiuxi;
daysOnDuty = y+bxdk; daysOnDuty = y+bxdk;
// String[] range=ClockInTool.listToString(ClockInTool.getDays(sdf1.format(c.getTime()),str)).split(";");//目前为止所有日期 // String[] range=ClockInTool.listToString(ClockInTool.getDays(sdf1.format(c.getTime()),str)).split(";");//目前为止所有日期
...@@ -309,6 +327,7 @@ public class LastMonthtimingExport { ...@@ -309,6 +327,7 @@ public class LastMonthtimingExport {
int zj = 6; int zj = 6;
int fd = 0; int fd = 0;
for(String num : range) { for(String num : range) {
boolean xxr = true;
if(ClockInTool.useArrayUtils(needfig, String.valueOf(ClockInTool.dateToWeek(num)))) {//对比排班应打卡时间 if(ClockInTool.useArrayUtils(needfig, String.valueOf(ClockInTool.dateToWeek(num)))) {//对比排班应打卡时间
String[] ycqtst = new String[ycqts.length + zj]; String[] ycqtst = new String[ycqts.length + zj];
System.arraycopy(ycqts, 0, ycqtst, 0, ycqts.length); System.arraycopy(ycqts, 0, ycqtst, 0, ycqts.length);
...@@ -319,6 +338,7 @@ public class LastMonthtimingExport { ...@@ -319,6 +338,7 @@ public class LastMonthtimingExport {
w++; w++;
zjgzts++; zjgzts++;
}else { }else {
//休息日
String[] xxtst = new String[xxts.length + zj]; String[] xxtst = new String[xxts.length + zj];
System.arraycopy(xxts, 0, xxtst, 0, xxts.length); System.arraycopy(xxts, 0, xxtst, 0, xxts.length);
xxtst[x] = num; xxtst[x] = num;
...@@ -326,6 +346,8 @@ public class LastMonthtimingExport { ...@@ -326,6 +346,8 @@ public class LastMonthtimingExport {
//xxts[x] = num; //xxts[x] = num;
x++; x++;
xxr = false;
} }
if(ClockInTool.useArrayUtils(bxdkss, num)) {//检查是否存在 必须打卡名单中 if(ClockInTool.useArrayUtils(bxdkss, num)) {//检查是否存在 必须打卡名单中
String[] ycqtst = new String[ycqts.length + zj]; String[] ycqtst = new String[ycqts.length + zj];
...@@ -341,7 +363,11 @@ public class LastMonthtimingExport { ...@@ -341,7 +363,11 @@ public class LastMonthtimingExport {
if(ClockInTool.useArrayUtils(appmaps, num)) {//检查是否存在 无需打卡名单中 if(ClockInTool.useArrayUtils(appmaps, num)) {//检查是否存在 无需打卡名单中
ycqts = ClockInTool.doChinFilters(ycqts, num);//为必须休息的话从上班日期中去除 ycqts = ClockInTool.doChinFilters(ycqts, num);//为必须休息的话从上班日期中去除
// ycqts = ClockInTool.doChinFilters(ClockInTool.deleteArrayNull(ycqts), num);//为必须休息的话从上班日期中去除 // ycqts = ClockInTool.doChinFilters(ClockInTool.deleteArrayNull(ycqts), num);//为必须休息的话从上班日期中去除
//防止休息日重复减
if(xxr) {
zjgzts = zjgzts - 1; zjgzts = zjgzts - 1;
}
String[] xxtst = new String[xxts.length + zj]; String[] xxtst = new String[xxts.length + zj];
System.arraycopy(xxts, 0, xxtst, 0, xxts.length); System.arraycopy(xxts, 0, xxtst, 0, xxts.length);
......
...@@ -266,8 +266,10 @@ public class RealTimeUpdate{ ...@@ -266,8 +266,10 @@ public class RealTimeUpdate{
String yemo = year + "-" + month; String yemo = year + "-" + month;
sdf1.setLenient(false); sdf1.setLenient(false);
int y = 0,q = 0,jj = 0;//jj:节假日 int y = 0,q = 0,jj = 0,xx = 0;//jj:节假日
String[] zdxx = new String[20];//法定休息的具体天数(yyyy-MM-dd)
for(int i = 1; i <= ClockInTool.getDaysByYearMonth(year,month); i++){ for(int i = 1; i <= ClockInTool.getDaysByYearMonth(year,month); i++){
boolean xixi = true;
Date date1 = sdf1.parse(yemo + "-" + i); Date date1 = sdf1.parse(yemo + "-" + i);
for(int u=0;u<week.length;u++){ for(int u=0;u<week.length;u++){
if(sdf2.format(date1).equals(week[u])){ if(sdf2.format(date1).equals(week[u])){
...@@ -283,11 +285,23 @@ public class RealTimeUpdate{ ...@@ -283,11 +285,23 @@ public class RealTimeUpdate{
jj ++; jj ++;
} }
} }
xixi = false;
} }
} }
if(xixi) {
zdxx[xx] = yemo + "-" + i;
xx++;
}
}
if(appmaps.length > 0) {
for(String aa : ClockInTool.deleteArrayNull(zdxx)) {
appmaps = ClockInTool.doChinFilters(ClockInTool.deleteArrayNull(appmaps), aa);
}
} }
//全月时间 - 应打卡时间 - 必须打卡时间 + 无需打卡时间 //全月时间 - 应打卡时间 - 必须打卡时间 + 无需打卡时间
int xiuxi = ClockInTool.getDaysByYearMonth(year,month) - q - bxdk + wxdk.size()+jj; int xiuxi = ClockInTool.getDaysByYearMonth(year,month) - q - bxdk + appmaps.length+jj;//ClockInTool.getDaysByYearMonth(year,month) - q - bxdk + wxdk.size()+jj;
daysOff = xiuxi; daysOff = xiuxi;
daysOnDuty = y+bxdk; daysOnDuty = y+bxdk;
// String[] range=ClockInTool.listToString(ClockInTool.getDays(sdf1.format(c.getTime()),str)).split(";");//目前为止所有日期 // String[] range=ClockInTool.listToString(ClockInTool.getDays(sdf1.format(c.getTime()),str)).split(";");//目前为止所有日期
...@@ -297,6 +311,7 @@ public class RealTimeUpdate{ ...@@ -297,6 +311,7 @@ public class RealTimeUpdate{
int zj = 6; int zj = 6;
int fd = 0; int fd = 0;
for(String num : range) { for(String num : range) {
boolean xxr = true;
if(Arrays.binarySearch(needfig, String.valueOf(ClockInTool.dateToWeek(num))) >= 0) {//对比排班应打卡时间 if(Arrays.binarySearch(needfig, String.valueOf(ClockInTool.dateToWeek(num))) >= 0) {//对比排班应打卡时间
String[] ycqtst = new String[ycqts.length + zj]; String[] ycqtst = new String[ycqts.length + zj];
System.arraycopy(ycqts, 0, ycqtst, 0, ycqts.length); System.arraycopy(ycqts, 0, ycqtst, 0, ycqts.length);
...@@ -314,6 +329,8 @@ public class RealTimeUpdate{ ...@@ -314,6 +329,8 @@ public class RealTimeUpdate{
//xxts[x] = num; //xxts[x] = num;
x++; x++;
xxr = false;
} }
if(Arrays.binarySearch(bxdkss, num) >= 0) {//检查是否存在 必须打卡名单中 if(Arrays.binarySearch(bxdkss, num) >= 0) {//检查是否存在 必须打卡名单中
String[] ycqtst = new String[ycqts.length + zj]; String[] ycqtst = new String[ycqts.length + zj];
...@@ -329,7 +346,11 @@ public class RealTimeUpdate{ ...@@ -329,7 +346,11 @@ public class RealTimeUpdate{
if(Arrays.binarySearch(appmaps, num) >= 0) {//检查是否存在 无需打卡名单中 if(Arrays.binarySearch(appmaps, num) >= 0) {//检查是否存在 无需打卡名单中
ycqts = ClockInTool.doChinFilters(ycqts, num);//为必须休息的话从上班日期中去除 ycqts = ClockInTool.doChinFilters(ycqts, num);//为必须休息的话从上班日期中去除
// ycqts = ClockInTool.doChinFilters(ClockInTool.deleteArrayNull(ycqts), num);//为必须休息的话从上班日期中去除 // ycqts = ClockInTool.doChinFilters(ClockInTool.deleteArrayNull(ycqts), num);//为必须休息的话从上班日期中去除
//防止休息日重复减
if(xxr) {
zjgzts = zjgzts - 1; zjgzts = zjgzts - 1;
}
String[] xxtst = new String[xxts.length + zj]; String[] xxtst = new String[xxts.length + zj];
System.arraycopy(xxts, 0, xxtst, 0, xxts.length); System.arraycopy(xxts, 0, xxtst, 0, xxts.length);
......
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