Commit 816c5a9f by Administrator

Merge branch 'lal' into 'develop'

提交

See merge request 8timerv2/8timerapiv200!112
parents 3e510abf 8a701c57
...@@ -104,25 +104,26 @@ public class AttendanceTaskTiming implements SchedulingConfigurer { ...@@ -104,25 +104,26 @@ public class AttendanceTaskTiming implements SchedulingConfigurer {
*/ */
// @Scheduled(cron = "0/5 * * * * ?") // 测试:5秒执行一次 // @Scheduled(cron = "0/5 * * * * ?") // 测试:5秒执行一次
public String AttendanceTask() throws ParseException { public String AttendanceTask() throws ParseException {
boolean implement = false; boolean implement = false;
// int sockid = 0; int sockid = 0;
// KqglTaskTiming sock = KqglTaskTiming.builder().build().selectOne(new QueryWrapper<KqglTaskTiming>().lambda().eq(KqglTaskTiming::getTask, "AttendanceTask")); KqglTaskTiming sock = KqglTaskTiming.builder().build().selectOne(new QueryWrapper<KqglTaskTiming>().lambda().eq(KqglTaskTiming::getTask, "AttendanceTask"));
// if(sock == null) { if(sock == null) {
// KqglTaskTiming sock1 = KqglTaskTiming.builder().task("AttendanceTask").executionStatus(1).lastExecutionTime(new Date().getTime()).build(); KqglTaskTiming sock1 = KqglTaskTiming.builder().task("AttendanceTask").executionStatus(1).lastExecutionTime(new Date().getTime()).build();
// sock1.insert(); sock1.insert();
// sockid = sock1.getId(); sockid = sock1.getId();
// implement = true; implement = true;
// }else { }else {
// sockid = sock.getId(); sockid = sock.getId();
// if(sock.getExecutionStatus() == 0) { if(sock.getExecutionStatus() == 0) {
// KqglTaskTiming.builder().task("AttendanceTask").id(sock.getId()).executionStatus(1).lastExecutionTime(new Date().getTime()).build().updateById(); KqglTaskTiming.builder().task("AttendanceTask").id(sock.getId()).executionStatus(1).lastExecutionTime(new Date().getTime()).build().updateById();
// implement = true; implement = true;
// } }
// } }
//逻辑 //逻辑
if(implement) { if(implement) {
System.err.println("时间:" + dateFormat.format(new Date())); System.err.println("当前时间:" + dateFormat.format(new Date()));
Calendar c = Calendar.getInstance(); Calendar c = Calendar.getInstance();
c.add(Calendar.MONTH, 0); c.add(Calendar.MONTH, 0);
...@@ -137,7 +138,8 @@ public class AttendanceTaskTiming implements SchedulingConfigurer { ...@@ -137,7 +138,8 @@ public class AttendanceTaskTiming implements SchedulingConfigurer {
String str = new SimpleDateFormat("yyyy-MM-dd").format(new Date()).toString();// String str = new SimpleDateFormat("yyyy-MM-dd").format(new Date()).toString();//
String ttstr = new SimpleDateFormat("yyyy-MM").format(new Date()).toString();// String ttstr = new SimpleDateFormat("yyyy-MM").format(new Date()).toString();//
String[] range=ClockInTool.listToString(ClockInTool.getDays(sdf1.format(c.getTime()),str)).split(";");//目前为止所有日期 String[] rangeArray=ClockInTool.listToString(ClockInTool.getDays(sdf1.format(c.getTime()),str)).split(";");//目前为止所有日期
String[] range=rangeArray[0].split(",");
int year = Calendar.getInstance().get(Calendar.YEAR); int year = Calendar.getInstance().get(Calendar.YEAR);
int month = Calendar.getInstance().get(Calendar.MONTH) + 1; int month = Calendar.getInstance().get(Calendar.MONTH) + 1;
...@@ -196,7 +198,6 @@ public class AttendanceTaskTiming implements SchedulingConfigurer { ...@@ -196,7 +198,6 @@ public class AttendanceTaskTiming implements SchedulingConfigurer {
//休息天数,应出勤天数,实际出勤 //休息天数,应出勤天数,实际出勤
double daysOff = 0,daysOnDuty = 0;//,actualAttDays = 0; double daysOff = 0,daysOnDuty = 0;//,actualAttDays = 0;
int zjgzts = 0;//目前为止应该出勤的天数 int zjgzts = 0;//目前为止应该出勤的天数
KqglAssoBcsz shif = KqglAssoBcsz.builder().build();
//工作时长(分钟)、严重迟到次数、严重迟到时长(分钟)、旷工迟到次数 //工作时长(分钟)、严重迟到次数、严重迟到时长(分钟)、旷工迟到次数
double workinghours = 0,seriouslatetimes = 0,seriouslatehours = 0,absenlatetimes = 0; double workinghours = 0,seriouslatetimes = 0,seriouslatehours = 0,absenlatetimes = 0;
// 迟到次数 迟到时长 早退次数 早退时长 // 迟到次数 迟到时长 早退次数 早退时长
...@@ -268,7 +269,7 @@ public class AttendanceTaskTiming implements SchedulingConfigurer { ...@@ -268,7 +269,7 @@ public class AttendanceTaskTiming implements SchedulingConfigurer {
//目前为止应出勤天数 //目前为止应出勤天数
int w = 0,x=0; int w = 0,x=0;
for(String num : range) { for(String num : range) {
if(Arrays.binarySearch(needfig, Integer.valueOf(ClockInTool.dateToWeek(num))) >= 0) {//对比排班应打卡时间 if(Arrays.binarySearch(needfig, String.valueOf(ClockInTool.dateToWeek(num))) >= 0) {//对比排班应打卡时间
ycqts[w] = num; ycqts[w] = num;
w++; w++;
zjgzts++; zjgzts++;
...@@ -280,8 +281,10 @@ public class AttendanceTaskTiming implements SchedulingConfigurer { ...@@ -280,8 +281,10 @@ public class AttendanceTaskTiming implements SchedulingConfigurer {
ycqts[w] = num; ycqts[w] = num;
w++; w++;
zjgzts++; zjgzts++;
if(user.getEmpnum() == 257) {
ClockInTool.doChinFilters(xxts, num);//为必须上班的话从休息日期中去除 ClockInTool.doChinFilters(xxts, num);//为必须上班的话从休息日期中去除
} }
}
if(Arrays.binarySearch(appmaps, num) >= 0) {//检查是否存在 无需打卡名单中 if(Arrays.binarySearch(appmaps, num) >= 0) {//检查是否存在 无需打卡名单中
ClockInTool.doChinFilters(ycqts, num);//为必须休息的话从上班日期中去除 ClockInTool.doChinFilters(ycqts, num);//为必须休息的话从上班日期中去除
zjgzts = zjgzts - 1; zjgzts = zjgzts - 1;
...@@ -345,7 +348,7 @@ public class AttendanceTaskTiming implements SchedulingConfigurer { ...@@ -345,7 +348,7 @@ public class AttendanceTaskTiming implements SchedulingConfigurer {
//目前为止应出勤天数 //目前为止应出勤天数
int g = 0,x=0; int g = 0,x=0;
for(String num : range) { for(String num : range) {
if(Arrays.binarySearch(ziyoupb, Integer.valueOf(ClockInTool.dateToWeek(num))) >= 0) {//对比排班应打卡时间 if(Arrays.binarySearch(ziyoupb, String.valueOf(ClockInTool.dateToWeek(num))) >= 0) {//对比排班应打卡时间
ycqts[g] = num; ycqts[g] = num;
zjgzts++; zjgzts++;
}else { }else {
...@@ -436,7 +439,8 @@ public class AttendanceTaskTiming implements SchedulingConfigurer { ...@@ -436,7 +439,8 @@ public class AttendanceTaskTiming implements SchedulingConfigurer {
//排查请假是否在最后一次打卡范围内 //排查请假是否在最后一次打卡范围内
List<KqglAssoRelationSummary> leainv = kqglassorelationsummarymapper.LeaveInvestigation(user.getEmpnum(), 2, ttstr); List<KqglAssoRelationSummary> leainv = kqglassorelationsummarymapper.LeaveInvestigation(user.getEmpnum(), 2, ttstr);
int answer = shif.getSxbcs();//1=2次 2=4次 3=6次 KqglAssoBcsz shif = KqglAssoBcsz.builder().build();
String beginTime = sdf1.format(new Date()); String beginTime = sdf1.format(new Date());
// List<String> rowData = new ArrayList<String>(); // List<String> rowData = new ArrayList<String>();
//遍历目前为止所有日期 结合该用户发起的审批进行结合 //遍历目前为止所有日期 结合该用户发起的审批进行结合
...@@ -449,7 +453,7 @@ public class AttendanceTaskTiming implements SchedulingConfigurer { ...@@ -449,7 +453,7 @@ public class AttendanceTaskTiming implements SchedulingConfigurer {
}else { }else {
if(Arrays.binarySearch(ClockInTool.replaceNull(ycqts), num) < 0 && Arrays.binarySearch(ClockInTool.replaceNull(leaves), num) < 0 && Arrays.binarySearch(ClockInTool.replaceNull(travels), num) < 0 && Arrays.binarySearch(ClockInTool.replaceNull(goouts), num) < 0 && Arrays.binarySearch(ClockInTool.replaceNull(cards), num) < 0) { if(Arrays.binarySearch(ClockInTool.replaceNull(ycqts), num) < 0 && Arrays.binarySearch(ClockInTool.replaceNull(leaves), num) < 0 && Arrays.binarySearch(ClockInTool.replaceNull(travels), num) < 0 && Arrays.binarySearch(ClockInTool.replaceNull(goouts), num) < 0 && Arrays.binarySearch(ClockInTool.replaceNull(cards), num) < 0) {
rowData.add("旷工"); rowData.add("旷工");
}else if(sdf1.parse(beginTime).getTime() <= sdf1.parse(num).getTime()) { }else if(sdf1.parse(beginTime).getTime() < sdf1.parse(num).getTime()) {
rowData.add("未到班期"); rowData.add("未到班期");
}else if(Arrays.binarySearch(ClockInTool.replaceNull(leaves), num) >= 0) {//请假 }else if(Arrays.binarySearch(ClockInTool.replaceNull(leaves), num) >= 0) {//请假
KqglAssoRelationSummary lea = KqglAssoRelationSummary.builder().build().selectOne(new QueryWrapper<KqglAssoRelationSummary>().lambda().eq(KqglAssoRelationSummary::getUserId, user.getEmpnum()).eq(KqglAssoRelationSummary::getAppTime, num).eq(KqglAssoRelationSummary::getApprovalType, 2)); KqglAssoRelationSummary lea = KqglAssoRelationSummary.builder().build().selectOne(new QueryWrapper<KqglAssoRelationSummary>().lambda().eq(KqglAssoRelationSummary::getUserId, user.getEmpnum()).eq(KqglAssoRelationSummary::getAppTime, num).eq(KqglAssoRelationSummary::getApprovalType, 2));
...@@ -546,19 +550,28 @@ public class AttendanceTaskTiming implements SchedulingConfigurer { ...@@ -546,19 +550,28 @@ public class AttendanceTaskTiming implements SchedulingConfigurer {
//获取该员工最新班次 //获取该员工最新班次
KqglAssoZhoupaiban gudingpb = KqglAssoZhoupaiban.builder().build().selectOne(new QueryWrapper<KqglAssoZhoupaiban>().lambda().eq(KqglAssoZhoupaiban::getKqzid, attgro.getId()) KqglAssoZhoupaiban gudingpb = KqglAssoZhoupaiban.builder().build().selectOne(new QueryWrapper<KqglAssoZhoupaiban>().lambda().eq(KqglAssoZhoupaiban::getKqzid, attgro.getId())
.eq(KqglAssoZhoupaiban::getType, several)); .eq(KqglAssoZhoupaiban::getType, several));
if(gudingpb!=null) {
shif = shif.selectOne(new QueryWrapper<KqglAssoBcsz>().lambda().eq(KqglAssoBcsz::getId, gudingpb.getBcid())); shif = shif.selectOne(new QueryWrapper<KqglAssoBcsz>().lambda().eq(KqglAssoBcsz::getId, gudingpb.getBcid()));
}
}else { }else {
shif = shif.selectOne(new QueryWrapper<KqglAssoBcsz>().lambda().eq(KqglAssoBcsz::getId, tesu.getBcid())); shif = shif.selectOne(new QueryWrapper<KqglAssoBcsz>().lambda().eq(KqglAssoBcsz::getId, tesu.getBcid()));
} }
//获取该员工最新班次 //获取该员工最新班次
KqglAssoZhoupaiban gudingpb = KqglAssoZhoupaiban.builder().build().selectOne(new QueryWrapper<KqglAssoZhoupaiban>().lambda().eq(KqglAssoZhoupaiban::getKqzid, attgro.getId()) KqglAssoZhoupaiban gudingpb = KqglAssoZhoupaiban.builder().build().selectOne(new QueryWrapper<KqglAssoZhoupaiban>().lambda().eq(KqglAssoZhoupaiban::getKqzid, attgro.getId())
.eq(KqglAssoZhoupaiban::getType, several)); .eq(KqglAssoZhoupaiban::getType, several));
if(gudingpb != null) {
shif = shif.selectOne(new QueryWrapper<KqglAssoBcsz>().lambda().eq(KqglAssoBcsz::getId, gudingpb.getBcid())); shif = shif.selectOne(new QueryWrapper<KqglAssoBcsz>().lambda().eq(KqglAssoBcsz::getId, gudingpb.getBcid()));
}
}else if(attgro.getPbfs() == 2){ }else if(attgro.getPbfs() == 2){
KqglAssoPbmx pbmxx = KqglAssoPbmx.builder().build().selectOne(new QueryWrapper<KqglAssoPbmx>().lambda().eq(KqglAssoPbmx::getUserid, user.getEmpnum()).eq(KqglAssoPbmx::getData, num).eq(KqglAssoPbmx::getKqzid, attgro.getId())); KqglAssoPbmx pbmxx = KqglAssoPbmx.builder().build().selectOne(new QueryWrapper<KqglAssoPbmx>().lambda().eq(KqglAssoPbmx::getUserid, user.getEmpnum()).eq(KqglAssoPbmx::getData, num).eq(KqglAssoPbmx::getKqzid, attgro.getId()));
if(pbmxx != null && pbmxx.getBcid() != 0) {
shif = shif.selectOne(new QueryWrapper<KqglAssoBcsz>().lambda().eq(KqglAssoBcsz::getId, pbmxx.getBcid())); shif = shif.selectOne(new QueryWrapper<KqglAssoBcsz>().lambda().eq(KqglAssoBcsz::getId, pbmxx.getBcid()));
} }
}
if(shif != null && shif.getSxbcs() != null) {
System.out.println(shif.getSxbcs());
int answer = shif.getSxbcs();//1=2次 2=4次 3=6次
//未打最后一次卡的时候 判断最后一次打卡时间是否在请假范围内 相对应减少下班缺卡次数 //未打最后一次卡的时候 判断最后一次打卡时间是否在请假范围内 相对应减少下班缺卡次数
//最后一次应打卡时间 //最后一次应打卡时间
...@@ -577,6 +590,7 @@ public class AttendanceTaskTiming implements SchedulingConfigurer { ...@@ -577,6 +590,7 @@ public class AttendanceTaskTiming implements SchedulingConfigurer {
} }
} }
} }
}
}else { }else {
for (String num2 : range) { for (String num2 : range) {
if (Arrays.binarySearch(dkjtts, num2) >= 0) { if (Arrays.binarySearch(dkjtts, num2) >= 0) {
......
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