Commit 0e6689ba by 邓实川
parents 1b008853 27623c25
......@@ -22,6 +22,29 @@ public class ClockInTool {
static SimpleDateFormat famt = new SimpleDateFormat("yyyy-MM-dd");
/***
* 去除String数组中的空值
*/
public static String[] deleteArrayNull(String string[]) {
String strArr[] = string;
// step1: 定义一个list列表,并循环赋值
ArrayList<String> strList = new ArrayList<String>();
for (int i = 0; i < strArr.length; i++) {
strList.add(strArr[i]);
}
// step2: 删除list列表中所有的空值
while (strList.remove(null));
while (strList.remove(""));
// step3: 把list列表转换给一个新定义的中间数组,并赋值给它
String strArrLast[] = strList.toArray(new String[strList.size()]);
return strArrLast;
}
/**
* @param timeStr 修改的时间
* @param num 修改数字
......
......@@ -105,7 +105,7 @@ public class AttendanceTaskTiming{
*/
//3.添加定时任务 每天下午七点执行一次
@Scheduled(cron = "0 34 10 * * ?")
@Scheduled(cron = "0 37 10 * * ?")
//或直接指定时间间隔,例如:5秒
//@Scheduled(fixedRate=5000)
......@@ -282,11 +282,11 @@ public class AttendanceTaskTiming{
w++;
zjgzts++;
if(user.getEmpnum() == 257) {
ClockInTool.doChinFilters(xxts, num);//为必须上班的话从休息日期中去除
ClockInTool.doChinFilters(ClockInTool.deleteArrayNull(xxts), num);//为必须上班的话从休息日期中去除
}
}
if(Arrays.binarySearch(appmaps, num) >= 0) {//检查是否存在 无需打卡名单中
ClockInTool.doChinFilters(ycqts, num);//为必须休息的话从上班日期中去除
ClockInTool.doChinFilters(ClockInTool.deleteArrayNull(ycqts), num);//为必须休息的话从上班日期中去除
zjgzts = zjgzts - 1;
xxts[x] = num;
x++;
......@@ -448,18 +448,18 @@ public class AttendanceTaskTiming{
//遍历目前为止所有日期 结合该用户发起的审批进行结合
//1:加班 2:请假 3:出差 4:外出 5:补卡
for(String num : range) {
if(Arrays.binarySearch(ClockInTool.doChinFilters(ClockInTool.replaceNull(xxts),"null"), num) >= 0 && Arrays.binarySearch(ClockInTool.doChinFilters(ClockInTool.replaceNull(dkjtts),"null"),num) >= 0) {
if(Arrays.binarySearch(ClockInTool.deleteArrayNull(xxts), num) >= 0 && Arrays.binarySearch(ClockInTool.deleteArrayNull(dkjtts),num) >= 0) {
rowData.add("休息并打卡");
}else if(Arrays.binarySearch(ClockInTool.doChinFilters(ClockInTool.replaceNull(xxts),"null"), num) >= 0){
}else if(Arrays.binarySearch(ClockInTool.deleteArrayNull(xxts), num) >= 0){
rowData.add("休息");
}else {
if(Arrays.binarySearch(ClockInTool.doChinFilters(ClockInTool.replaceNull(ycqts),"null"), num) >= 0 && Arrays.binarySearch(ClockInTool.doChinFilters(ClockInTool.replaceNull(dkjtts),"null"), num) < 0 && Arrays.binarySearch(ClockInTool.doChinFilters(ClockInTool.replaceNull(leaves),"null"), num) < 0 && Arrays.binarySearch(ClockInTool.doChinFilters(ClockInTool.replaceNull(travels),"null"), num) < 0 && Arrays.binarySearch(ClockInTool.doChinFilters(ClockInTool.replaceNull(goouts),"null"), num) < 0 && Arrays.binarySearch(ClockInTool.doChinFilters(ClockInTool.replaceNull(cards),"null"), num) < 0) {
if(Arrays.binarySearch(ClockInTool.deleteArrayNull(ycqts), num) >= 0 && Arrays.binarySearch(ClockInTool.deleteArrayNull(dkjtts), num) < 0 && Arrays.binarySearch(ClockInTool.deleteArrayNull(leaves), num) < 0 && Arrays.binarySearch(ClockInTool.deleteArrayNull(travels), num) < 0 && Arrays.binarySearch(ClockInTool.deleteArrayNull(goouts), num) < 0 && Arrays.binarySearch(ClockInTool.deleteArrayNull(cards), num) < 0) {
rowData.add("旷工");
}else if(Arrays.binarySearch(ClockInTool.doChinFilters(ClockInTool.replaceNull(ycqts),"null"), num) < 0 && Arrays.binarySearch(ClockInTool.doChinFilters(ClockInTool.replaceNull(xxts),"null"), num) < 0) {//日期不在上班也不在休息里面即为未排班
}else if(Arrays.binarySearch(ClockInTool.deleteArrayNull(ycqts), num) < 0 && Arrays.binarySearch(ClockInTool.deleteArrayNull(xxts), num) < 0) {//日期不在上班也不在休息里面即为未排班
rowData.add("未排班");
}else if(sdf1.parse(beginTime).getTime() < sdf1.parse(num).getTime()) {
rowData.add("未到班期");
}else if(Arrays.binarySearch(ClockInTool.doChinFilters(ClockInTool.replaceNull(leaves),"null"), num) >= 0) {//请假
}else if(Arrays.binarySearch(ClockInTool.deleteArrayNull(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));
String leavetype = "未知";//请假类型
String company = "未知";//请假单位
......@@ -474,16 +474,16 @@ public class AttendanceTaskTiming{
}
}
rowData.add(lea.getStartTime() +"到"+ lea.getEndTime()+"请"+leavetype+lea.getDuration()+company);
}else if(Arrays.binarySearch(ClockInTool.doChinFilters(ClockInTool.replaceNull(travels),"null"), num) >= 0) {//出差
}else if(Arrays.binarySearch(ClockInTool.deleteArrayNull(travels), num) >= 0) {//出差
KqglAssoRelationSummary lea = KqglAssoRelationSummary.builder().build().selectOne(new QueryWrapper<KqglAssoRelationSummary>().lambda().eq(KqglAssoRelationSummary::getUserId, user.getEmpnum()).eq(KqglAssoRelationSummary::getAppTime, num).eq(KqglAssoRelationSummary::getApprovalType, 3));
rowData.add(lea.getStartTime() +"到"+ lea.getEndTime()+"出差"+lea.getDuration()+"天");
}else if(Arrays.binarySearch(ClockInTool.doChinFilters(ClockInTool.replaceNull(goouts),"null"), num) >= 0){//外出
}else if(Arrays.binarySearch(ClockInTool.deleteArrayNull(goouts), num) >= 0){//外出
KqglAssoRelationSummary lea = KqglAssoRelationSummary.builder().build().selectOne(new QueryWrapper<KqglAssoRelationSummary>().lambda().eq(KqglAssoRelationSummary::getUserId, user.getEmpnum()).eq(KqglAssoRelationSummary::getAppTime, num).eq(KqglAssoRelationSummary::getApprovalType, 4));
rowData.add(lea.getStartTime() +"到"+ lea.getEndTime()+"外出"+lea.getDuration()+"天");
}else if(Arrays.binarySearch(ClockInTool.doChinFilters(ClockInTool.replaceNull(cards),"null"), num) >= 0){//补卡
}else if(Arrays.binarySearch(ClockInTool.deleteArrayNull(cards), num) >= 0){//补卡
KqglAssoRelationSummary lea = KqglAssoRelationSummary.builder().build().selectOne(new QueryWrapper<KqglAssoRelationSummary>().lambda().eq(KqglAssoRelationSummary::getUserId, user.getEmpnum()).eq(KqglAssoRelationSummary::getAppTime, num).eq(KqglAssoRelationSummary::getApprovalType, 5));
rowData.add("已补卡:"+lea.getStartTime());
}else if(Arrays.binarySearch(ClockInTool.doChinFilters(ClockInTool.replaceNull(overtimes),"null"), num) >= 0) {//加班
}else if(Arrays.binarySearch(ClockInTool.deleteArrayNull(overtimes), num) >= 0) {//加班
KqglAssoRelationSummary lea = KqglAssoRelationSummary.builder().build().selectOne(new QueryWrapper<KqglAssoRelationSummary>().lambda().eq(KqglAssoRelationSummary::getUserId, user.getEmpnum()).eq(KqglAssoRelationSummary::getAppTime, num).eq(KqglAssoRelationSummary::getApprovalType, 1));
String company = "未知",method = "无";//加班单位、加班补偿方式
//最小加班单位 1:按分钟加班、2:按半小时加班、3:按小时加班、4:按半天加班、5:按天加班
......@@ -500,7 +500,7 @@ public class AttendanceTaskTiming{
rowData.add(lea.getStartTime() +"到"+ lea.getEndTime()+"加班"+lea.getDuration()+company+"["+method+"]");
//加班补偿方式 1:转调休;2:转加班费;3:转调休或加班费
//工作日
if(Arrays.binarySearch(ClockInTool.doChinFilters(ClockInTool.replaceNull(ycqts),"null"), num) >= 0) {
if(Arrays.binarySearch(ClockInTool.deleteArrayNull(ycqts), num) >= 0) {
if(lea.getCompensateId() == 1) {
workingturncompenleave++;
}else if(lea.getCompensateId() == 2) {
......@@ -508,14 +508,14 @@ public class AttendanceTaskTiming{
}
}
//休息日
if(Arrays.binarySearch(ClockInTool.doChinFilters(ClockInTool.replaceNull(xxts),"null"), num) >= 0) {
if(Arrays.binarySearch(ClockInTool.deleteArrayNull(xxts), num) >= 0) {
if(lea.getCompensateId() == 1) {
restturncompenleave++;
}else if(lea.getCompensateId() == 2) {
resttransferovertime++;
}
}
if(Arrays.binarySearch(ClockInTool.doChinFilters(ClockInTool.replaceNull(ycqts),"null"), num) < 0 && Arrays.binarySearch(ClockInTool.doChinFilters(ClockInTool.replaceNull(xxts),"null"), num) < 0) {
if(Arrays.binarySearch(ClockInTool.deleteArrayNull(ycqts), num) < 0 && Arrays.binarySearch(ClockInTool.deleteArrayNull(xxts), num) < 0) {
if(lea.getCompensateId() == 1) {
holidayturncompenleave++;
}else if(lea.getCompensateId() == 2) {
......@@ -523,19 +523,19 @@ public class AttendanceTaskTiming{
}
}
}else{
if(Arrays.binarySearch(ClockInTool.doChinFilters(ClockInTool.replaceNull(sblacks),"null"), num) >= 0) {
if(Arrays.binarySearch(ClockInTool.deleteArrayNull(sblacks), num) >= 0) {
rowData.add("上班缺卡");
}else if(Arrays.binarySearch(ClockInTool.doChinFilters(ClockInTool.replaceNull(sblacks),"null"), num) >= 0 && Arrays.binarySearch(ClockInTool.doChinFilters(ClockInTool.replaceNull(ztts),"null"), num) >= 0) {
}else if(Arrays.binarySearch(ClockInTool.deleteArrayNull(sblacks), num) >= 0 && Arrays.binarySearch(ClockInTool.deleteArrayNull(ztts), num) >= 0) {
rowData.add("上班缺卡,下班早退");
}else if(Arrays.binarySearch(ClockInTool.doChinFilters(ClockInTool.replaceNull(cdts),"null"), num) >= 0) {
}else if(Arrays.binarySearch(ClockInTool.deleteArrayNull(cdts), num) >= 0) {
rowData.add("上班迟到");
}else if(Arrays.binarySearch(ClockInTool.doChinFilters(ClockInTool.replaceNull(cdts),"null"), num) >= 0 && Arrays.binarySearch(ClockInTool.doChinFilters(ClockInTool.replaceNull(xblacks),"null"), num) >= 0) {
}else if(Arrays.binarySearch(ClockInTool.deleteArrayNull(cdts), num) >= 0 && Arrays.binarySearch(ClockInTool.deleteArrayNull(xblacks), num) >= 0) {
rowData.add("上班迟到,下班缺卡");
}else if(Arrays.binarySearch(ClockInTool.doChinFilters(ClockInTool.replaceNull(cdts),"null"), num) >= 0 && Arrays.binarySearch(ClockInTool.doChinFilters(ClockInTool.replaceNull(ztts),"null"), num) >= 0) {
}else if(Arrays.binarySearch(ClockInTool.deleteArrayNull(cdts), num) >= 0 && Arrays.binarySearch(ClockInTool.deleteArrayNull(ztts), num) >= 0) {
rowData.add("上班迟到,下班早退");
}else if(Arrays.binarySearch(ClockInTool.doChinFilters(ClockInTool.replaceNull(xblacks),"null"), num) >= 0) {
}else if(Arrays.binarySearch(ClockInTool.deleteArrayNull(xblacks), num) >= 0) {
rowData.add("下班缺卡");
}else if(Arrays.binarySearch(ClockInTool.doChinFilters(ClockInTool.replaceNull(ztts),"null"), num) >= 0) {
}else if(Arrays.binarySearch(ClockInTool.deleteArrayNull(ztts), num) >= 0) {
rowData.add("下班早退");
}else {
rowData.add("正常");
......@@ -554,8 +554,11 @@ public class AttendanceTaskTiming{
shif = shif.selectOne(new QueryWrapper<KqglAssoBcsz>().lambda().eq(KqglAssoBcsz::getId, gudingpb.getBcid()));
}
}else {
if(tesu.getBcid() > 0) {
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));
......
......@@ -309,8 +309,13 @@
dkmx.`xbdk2jg`,dkmx.`sbdk3` ,dkmx.`sbdk3jg` ,dkmx.`xbdk3`,dkmx.`xbdk3jg` ,dkmx.`ydkcs` ,dkmx.`gzsc` ,dkmx.`qyid`,dkmx.`dksj` ,
dkmx.`yzcdcs` ,dkmx.`yzcdsc` ,dkmx.`kgcdfzs`
from kqgl_asso_dkmx dkmx
LEFT JOIN yggl_main_emp as info on info.emp_num = dkmx.userid and info.org_code = 117
LEFT JOIN kqgl_asso_dkjl as dkjl on dkjl.dkmxid = dkmx.id
LEFT JOIN yggl_main_emp as info on info.emp_num = dkmx.userid and info.org_code = #{param.orgCode}
LEFT JOIN (select * from kqgl_asso_dkjl dkjl
where dkjl.id in (select MAX(dkjl.id) from kqgl_asso_dkjl dkjl
LEFT JOIN kqgl_asso_dkmx as dkmx on dkmx.id = dkjl.dkmxid
where dkmx.qyid = #{param.orgCode}
and dkmx.`data` = #{param.times}
GROUP BY dkjl.user_id)) as dkjl on dkjl.dkmxid = dkmx.id
LEFT JOIN kqgl_asso_bcsz as bcsz on bcsz.id = dkjl.bcid
where dkmx.qyid = #{param.orgCode}
and dkmx.`data` = #{param.times}
......
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