Commit 13370223 by ilal Committed by chenzg

提交

parent 7dd42df7
......@@ -12,6 +12,7 @@ import java.util.Date;
import java.util.GregorianCalendar;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Locale;
import java.util.Set;
......@@ -26,6 +27,24 @@ public class ClockInTool {
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) {
return ArrayUtils.contains(arr,targetValue);
......
......@@ -101,7 +101,7 @@ public class AttendanceTaskTiming{
//typeid:1-员工 2-考勤组
// @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点 执行
public void AttendanceTask() throws ParseException {
......@@ -289,8 +289,10 @@ public class AttendanceTaskTiming{
String yemo = year + "-" + month;
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++){
boolean xixi = true;
Date date1 = sdf1.parse(yemo + "-" + i);
for(int u=0;u<week.length;u++){
if(sdf2.format(date1).equals(week[u])){
......@@ -306,13 +308,26 @@ public class AttendanceTaskTiming{
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;
daysOnDuty = y+bxdk;
// String[] range=ClockInTool.listToString(ClockInTool.getDays(sdf1.format(c.getTime()),str)).split(";");//目前为止所有日期
......@@ -322,6 +337,7 @@ public class AttendanceTaskTiming{
int zj = 6;
int fd = 0;
for(String num : range) {
boolean xxr = true;
if(ClockInTool.useArrayUtils(needfig, String.valueOf(ClockInTool.dateToWeek(num)))) {//对比排班应打卡时间
String[] ycqtst = new String[ycqts.length + zj];
System.arraycopy(ycqts, 0, ycqtst, 0, ycqts.length);
......@@ -339,6 +355,7 @@ public class AttendanceTaskTiming{
//xxts[x] = num;
x++;
xxr = false;
}
if(ClockInTool.useArrayUtils(bxdkss, num)) {//检查是否存在 必须打卡名单中
String[] ycqtst = new String[ycqts.length + zj];
......@@ -357,7 +374,10 @@ public class AttendanceTaskTiming{
// ycqts = ClockInTool.doChinFilters(ClockInTool.deleteArrayNull(ycqts), num);//为必须休息的话从上班日期中去除
//防止休息日重复减
if(xxr) {
zjgzts = zjgzts - 1;
}
String[] xxtst = new String[xxts.length + zj];
System.arraycopy(xxts, 0, xxtst, 0, xxts.length);
......
......@@ -93,7 +93,7 @@ public class LastMonthtimingExport {
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点 执行
public void LastMonthtimingAttendanceTask() throws ParseException {
......@@ -278,13 +278,16 @@ public class LastMonthtimingExport {
String yemo = year + "-" + month;
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++){
boolean xixi = true;
Date date1 = sdf1.parse(yemo + "-" + i);
for(int u=0;u<week.length;u++){
if(sdf2.format(date1).equals(week[u])){
q++;
y++;
//无需打卡天数
if(Arrays.asList(appmaps).contains(String.valueOf(sdf1.format(date1)))){
y = y-1;
}
......@@ -295,11 +298,26 @@ public class LastMonthtimingExport {
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;
daysOnDuty = y+bxdk;
// String[] range=ClockInTool.listToString(ClockInTool.getDays(sdf1.format(c.getTime()),str)).split(";");//目前为止所有日期
......@@ -309,6 +327,7 @@ public class LastMonthtimingExport {
int zj = 6;
int fd = 0;
for(String num : range) {
boolean xxr = true;
if(ClockInTool.useArrayUtils(needfig, String.valueOf(ClockInTool.dateToWeek(num)))) {//对比排班应打卡时间
String[] ycqtst = new String[ycqts.length + zj];
System.arraycopy(ycqts, 0, ycqtst, 0, ycqts.length);
......@@ -319,6 +338,7 @@ public class LastMonthtimingExport {
w++;
zjgzts++;
}else {
//休息日
String[] xxtst = new String[xxts.length + zj];
System.arraycopy(xxts, 0, xxtst, 0, xxts.length);
xxtst[x] = num;
......@@ -326,6 +346,8 @@ public class LastMonthtimingExport {
//xxts[x] = num;
x++;
xxr = false;
}
if(ClockInTool.useArrayUtils(bxdkss, num)) {//检查是否存在 必须打卡名单中
String[] ycqtst = new String[ycqts.length + zj];
......@@ -341,7 +363,11 @@ public class LastMonthtimingExport {
if(ClockInTool.useArrayUtils(appmaps, num)) {//检查是否存在 无需打卡名单中
ycqts = ClockInTool.doChinFilters(ycqts, num);//为必须休息的话从上班日期中去除
// ycqts = ClockInTool.doChinFilters(ClockInTool.deleteArrayNull(ycqts), num);//为必须休息的话从上班日期中去除
//防止休息日重复减
if(xxr) {
zjgzts = zjgzts - 1;
}
String[] xxtst = new String[xxts.length + zj];
System.arraycopy(xxts, 0, xxtst, 0, xxts.length);
......
......@@ -266,8 +266,10 @@ public class RealTimeUpdate{
String yemo = year + "-" + month;
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++){
boolean xixi = true;
Date date1 = sdf1.parse(yemo + "-" + i);
for(int u=0;u<week.length;u++){
if(sdf2.format(date1).equals(week[u])){
......@@ -283,11 +285,23 @@ public class RealTimeUpdate{
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;
daysOnDuty = y+bxdk;
// String[] range=ClockInTool.listToString(ClockInTool.getDays(sdf1.format(c.getTime()),str)).split(";");//目前为止所有日期
......@@ -297,6 +311,7 @@ public class RealTimeUpdate{
int zj = 6;
int fd = 0;
for(String num : range) {
boolean xxr = true;
if(Arrays.binarySearch(needfig, String.valueOf(ClockInTool.dateToWeek(num))) >= 0) {//对比排班应打卡时间
String[] ycqtst = new String[ycqts.length + zj];
System.arraycopy(ycqts, 0, ycqtst, 0, ycqts.length);
......@@ -314,6 +329,8 @@ public class RealTimeUpdate{
//xxts[x] = num;
x++;
xxr = false;
}
if(Arrays.binarySearch(bxdkss, num) >= 0) {//检查是否存在 必须打卡名单中
String[] ycqtst = new String[ycqts.length + zj];
......@@ -329,7 +346,11 @@ public class RealTimeUpdate{
if(Arrays.binarySearch(appmaps, num) >= 0) {//检查是否存在 无需打卡名单中
ycqts = ClockInTool.doChinFilters(ycqts, num);//为必须休息的话从上班日期中去除
// ycqts = ClockInTool.doChinFilters(ClockInTool.deleteArrayNull(ycqts), num);//为必须休息的话从上班日期中去除
//防止休息日重复减
if(xxr) {
zjgzts = zjgzts - 1;
}
String[] xxtst = new String[xxts.length + zj];
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