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 {
*/
// @Scheduled(cron = "0/5 * * * * ?") // 测试:5秒执行一次
public String AttendanceTask() throws ParseException {
boolean implement = false;
// int sockid = 0;
// KqglTaskTiming sock = KqglTaskTiming.builder().build().selectOne(new QueryWrapper<KqglTaskTiming>().lambda().eq(KqglTaskTiming::getTask, "AttendanceTask"));
// if(sock == null) {
// KqglTaskTiming sock1 = KqglTaskTiming.builder().task("AttendanceTask").executionStatus(1).lastExecutionTime(new Date().getTime()).build();
// sock1.insert();
// sockid = sock1.getId();
// implement = true;
// }else {
// sockid = sock.getId();
// if(sock.getExecutionStatus() == 0) {
// KqglTaskTiming.builder().task("AttendanceTask").id(sock.getId()).executionStatus(1).lastExecutionTime(new Date().getTime()).build().updateById();
// implement = true;
// }
// }
int sockid = 0;
KqglTaskTiming sock = KqglTaskTiming.builder().build().selectOne(new QueryWrapper<KqglTaskTiming>().lambda().eq(KqglTaskTiming::getTask, "AttendanceTask"));
if(sock == null) {
KqglTaskTiming sock1 = KqglTaskTiming.builder().task("AttendanceTask").executionStatus(1).lastExecutionTime(new Date().getTime()).build();
sock1.insert();
sockid = sock1.getId();
implement = true;
}else {
sockid = sock.getId();
if(sock.getExecutionStatus() == 0) {
KqglTaskTiming.builder().task("AttendanceTask").id(sock.getId()).executionStatus(1).lastExecutionTime(new Date().getTime()).build().updateById();
implement = true;
}
}
//逻辑
if(implement) {
System.err.println("时间:" + dateFormat.format(new Date()));
System.err.println("当前时间:" + dateFormat.format(new Date()));
Calendar c = Calendar.getInstance();
c.add(Calendar.MONTH, 0);
......@@ -137,7 +138,8 @@ public class AttendanceTaskTiming implements SchedulingConfigurer {
String str = new SimpleDateFormat("yyyy-MM-dd").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 month = Calendar.getInstance().get(Calendar.MONTH) + 1;
......@@ -196,7 +198,6 @@ public class AttendanceTaskTiming implements SchedulingConfigurer {
//休息天数,应出勤天数,实际出勤
double daysOff = 0,daysOnDuty = 0;//,actualAttDays = 0;
int zjgzts = 0;//目前为止应该出勤的天数
KqglAssoBcsz shif = KqglAssoBcsz.builder().build();
//工作时长(分钟)、严重迟到次数、严重迟到时长(分钟)、旷工迟到次数
double workinghours = 0,seriouslatetimes = 0,seriouslatehours = 0,absenlatetimes = 0;
// 迟到次数 迟到时长 早退次数 早退时长
......@@ -268,7 +269,7 @@ public class AttendanceTaskTiming implements SchedulingConfigurer {
//目前为止应出勤天数
int w = 0,x=0;
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;
w++;
zjgzts++;
......@@ -280,7 +281,9 @@ public class AttendanceTaskTiming implements SchedulingConfigurer {
ycqts[w] = num;
w++;
zjgzts++;
ClockInTool.doChinFilters(xxts, num);//为必须上班的话从休息日期中去除
if(user.getEmpnum() == 257) {
ClockInTool.doChinFilters(xxts, num);//为必须上班的话从休息日期中去除
}
}
if(Arrays.binarySearch(appmaps, num) >= 0) {//检查是否存在 无需打卡名单中
ClockInTool.doChinFilters(ycqts, num);//为必须休息的话从上班日期中去除
......@@ -345,7 +348,7 @@ public class AttendanceTaskTiming implements SchedulingConfigurer {
//目前为止应出勤天数
int g = 0,x=0;
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;
zjgzts++;
}else {
......@@ -436,7 +439,8 @@ public class AttendanceTaskTiming implements SchedulingConfigurer {
//排查请假是否在最后一次打卡范围内
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());
// List<String> rowData = new ArrayList<String>();
//遍历目前为止所有日期 结合该用户发起的审批进行结合
......@@ -449,7 +453,7 @@ public class AttendanceTaskTiming implements SchedulingConfigurer {
}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) {
rowData.add("旷工");
}else if(sdf1.parse(beginTime).getTime() <= sdf1.parse(num).getTime()) {
}else if(sdf1.parse(beginTime).getTime() < sdf1.parse(num).getTime()) {
rowData.add("未到班期");
}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));
......@@ -546,34 +550,44 @@ public class AttendanceTaskTiming implements SchedulingConfigurer {
//获取该员工最新班次
KqglAssoZhoupaiban gudingpb = KqglAssoZhoupaiban.builder().build().selectOne(new QueryWrapper<KqglAssoZhoupaiban>().lambda().eq(KqglAssoZhoupaiban::getKqzid, attgro.getId())
.eq(KqglAssoZhoupaiban::getType, several));
shif = shif.selectOne(new QueryWrapper<KqglAssoBcsz>().lambda().eq(KqglAssoBcsz::getId, gudingpb.getBcid()));
if(gudingpb!=null) {
shif = shif.selectOne(new QueryWrapper<KqglAssoBcsz>().lambda().eq(KqglAssoBcsz::getId, gudingpb.getBcid()));
}
}else {
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())
.eq(KqglAssoZhoupaiban::getType, several));
shif = shif.selectOne(new QueryWrapper<KqglAssoBcsz>().lambda().eq(KqglAssoBcsz::getId, gudingpb.getBcid()));
if(gudingpb != null) {
shif = shif.selectOne(new QueryWrapper<KqglAssoBcsz>().lambda().eq(KqglAssoBcsz::getId, gudingpb.getBcid()));
}
}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()));
shif = shif.selectOne(new QueryWrapper<KqglAssoBcsz>().lambda().eq(KqglAssoBcsz::getId, pbmxx.getBcid()));
if(pbmxx != null && pbmxx.getBcid() != 0) {
shif = shif.selectOne(new QueryWrapper<KqglAssoBcsz>().lambda().eq(KqglAssoBcsz::getId, pbmxx.getBcid()));
}
}
//未打最后一次卡的时候 判断最后一次打卡时间是否在请假范围内 相对应减少下班缺卡次数
//最后一次应打卡时间
String latimeclock = "";
if(answer == 1) {
latimeclock = ClockInTool.dealDateFormat(shif.getXbdk1(),3);
}else if(answer == 2) {
latimeclock = ClockInTool.dealDateFormat(shif.getXbdk2(),3);
}else {
latimeclock = ClockInTool.dealDateFormat(shif.getXbdk3(),3);
}
for(KqglAssoRelationSummary learel:leainv) {
boolean adopt = ClockInTool.hourMinuteBetween(latimeclock, learel.getStartTime().substring(0, 16), learel.getEndTime().substring(0, 16),"yyyy-MM-dd HH:mm");
if(adopt) {
xbqkcs = xbqkcs-1;
if(shif != null && shif.getSxbcs() != null) {
System.out.println(shif.getSxbcs());
int answer = shif.getSxbcs();//1=2次 2=4次 3=6次
//未打最后一次卡的时候 判断最后一次打卡时间是否在请假范围内 相对应减少下班缺卡次数
//最后一次应打卡时间
String latimeclock = "";
if(answer == 1) {
latimeclock = ClockInTool.dealDateFormat(shif.getXbdk1(),3);
}else if(answer == 2) {
latimeclock = ClockInTool.dealDateFormat(shif.getXbdk2(),3);
}else {
latimeclock = ClockInTool.dealDateFormat(shif.getXbdk3(),3);
}
for(KqglAssoRelationSummary learel:leainv) {
boolean adopt = ClockInTool.hourMinuteBetween(latimeclock, learel.getStartTime().substring(0, 16), learel.getEndTime().substring(0, 16),"yyyy-MM-dd HH:mm");
if(adopt) {
xbqkcs = xbqkcs-1;
}
}
}
}
......
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