diff --git a/src/com/engine/kq/cmd/attendanceButton/PunchOutButtonCmd.java b/src/com/engine/kq/cmd/attendanceButton/PunchOutButtonCmd.java index b79585f..eec4dd4 100644 --- a/src/com/engine/kq/cmd/attendanceButton/PunchOutButtonCmd.java +++ b/src/com/engine/kq/cmd/attendanceButton/PunchOutButtonCmd.java @@ -145,7 +145,7 @@ public class PunchOutButtonCmd extends AbstractCommonCommand KQWorkTime kqWorkTime = new KQWorkTime(); WorkTimeEntity workTimeEntity = kqWorkTime.getWorkTime(user.getUID()+"", signDate); String userinfo = "#userid#"+user.getUID()+"#getUserSubCompany1#"+user.getUserSubCompany1()+"#getUserSubCompany1#"+user.getUserDepartment() - +"#getJobtitle#"+user.getJobtitle(); + +"#getJobtitle#"+user.getJobtitle(); workTimeEntityLogMap.put("resourceid", userinfo); workTimeEntityLogMap.put("splitDate", signDate); workTimeEntityLogMap.put("workTimeEntity", workTimeEntity); @@ -174,7 +174,7 @@ public class PunchOutButtonCmd extends AbstractCommonCommand return ; } String mobile_sign_sql = "insert into mobile_sign(operater,operate_type,operate_date,operate_time,longitude,latitude,address,remark,attachment,crm,timezone) " - + " values(?,?,?,?,?,?,?,?,?,?,?) "; + + " values(?,?,?,?,?,?,?,?,?,?,?) "; rs1.executeUpdate(mobile_sign_sql, userId,signfrom,signDate,signTime,longitude,latitude,address,remark,attachment,crm,timeZone); logMap.put("outsidesign", outsidesign); @@ -262,9 +262,9 @@ public class PunchOutButtonCmd extends AbstractCommonCommand } deviceInfo = deviceInfo.replaceAll("\\?", ""); String punchSql = "insert into HrmScheduleSign(userId,userType,signType,signDate,signTime,clientAddress,isInCom,timeZone,belongdate,signfrom,longitude,latitude,addr,deviceInfo) "+ - " values(?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; + " values(?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; boolean isok = rs.executeUpdate(punchSql,userId,userType,signType,signDate,signTime,clientAddress,isInCom, - timeZone,belongdate,signfrom,longitude,latitude,address,deviceInfo); + timeZone,belongdate,signfrom,longitude,latitude,address,deviceInfo); logMap.put("punchSql", punchSql); logMap.put("punchSql_isok", isok); @@ -408,17 +408,17 @@ public class PunchOutButtonCmd extends AbstractCommonCommand //考勤当天是节假日或者休息日 if (holiday) { //节假日休息班 - b = rt.executeUpdate(sql, signDate, holidayDefaultSerialid, Util.null2String(userId),signDate,groupid); - kqLog.info("PunchOutButtonCmd.b1:" + b); + b = rt.executeUpdate(sql, signDate, holidayDefaultSerialid, Util.null2String(userId),signDate,groupid); + kqLog.info("PunchOutButtonCmd.b1:" + b); }else{ //周末休息班 // if(DateUtil.getWeek(signDate) == 6 || DateUtil.getWeek(signDate) == 7){ // b = rt.executeUpdate(sql,weekendDefaultSerialid, Util.null2String(userId), signDate,groupid); // kqLog.info("PunchOutButtonCmd.b2:"+b); // }else{ - //设置考勤班次为对应班次 - b = rt.executeUpdate(sql,defaultSerialid, Util.null2String(userId), signDate,groupid); - kqLog.info("PunchOutButtonCmd.b3:"+b); + //设置考勤班次为对应班次 + b = rt.executeUpdate(sql,defaultSerialid, Util.null2String(userId), signDate,groupid); + kqLog.info("PunchOutButtonCmd.b3:"+b); //} } } @@ -429,10 +429,10 @@ public class PunchOutButtonCmd extends AbstractCommonCommand new KQFormatBiz().formatDate(""+userId,DateUtil.getYesterday()); } bb.writeLog("PunchOutButtonCmd:userId:"+userId+":belongdate:"+(belongdate.length() == 0 ? DateUtil.getCurrentDate() : belongdate)); - if(belongdate.length()==0){ - //外勤签到没有归属日期,遇到跨天班次打卡可能归属前一天,需要格式化前一天考勤 - new KQFormatBiz().formatDate(""+userId,DateUtil.getYesterday()); - } +// if(belongdate.length()==0){ + //外勤签到没有归属日期,遇到跨天班次打卡可能归属前一天,需要格式化前一天考勤 + new KQFormatBiz().formatDate(""+userId,DateUtil.getYesterday()); +// } new KQFormatBiz().formatDate(""+userId,(belongdate.length() == 0 ? DateUtil.getCurrentDate() : belongdate)); //外勤签到转的考勤 处理加班规则 SplitActionUtil.pushOverTimeTasksAll(belongdate,belongdate,""+userId); diff --git a/src/weaver/interfaces/hostar/action/OutSignSyncAction.java b/src/weaver/interfaces/hostar/action/OutSignSyncAction.java index 673f42b..6675f6d 100644 --- a/src/weaver/interfaces/hostar/action/OutSignSyncAction.java +++ b/src/weaver/interfaces/hostar/action/OutSignSyncAction.java @@ -11,9 +11,12 @@ import weaver.interfaces.workflow.action.Action; import weaver.soa.workflow.request.Property; import weaver.soa.workflow.request.RequestInfo; +import java.text.SimpleDateFormat; import java.time.LocalTime; import java.time.format.DateTimeFormatter; import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -95,6 +98,8 @@ public class OutSignSyncAction implements Action { LocalTime oldkssj = LocalTime.parse(kssj, formatter); LocalTime minKssj = LocalTime.parse("01:00:00", formatter); + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); + for (String inf : infos) { if (StringUtils.isNotEmpty(inf)) { Map in = mapStringToMap(inf); @@ -140,9 +145,20 @@ public class OutSignSyncAction implements Action { new KQFormatBiz().formatDate(userId, DateUtil.getYesterday()); } // new KQFormatBiz().formatDate(userId, (belongdate.length() == 0 ? DateUtil.getCurrentDate() : belongdate)); + Date date = dateFormat.parse(signDate); + Calendar calendar = Calendar.getInstance(); + calendar.setTime(date); + calendar.add(Calendar.DATE, -1); // 减去一天 + Date previousDay = calendar.getTime(); + String previousDayString = dateFormat.format(previousDay); new KQFormatBiz().formatDate(userId, signDate); + new KQFormatBiz().formatDate(userId, previousDayString); //外勤签到转的考勤 处理加班规则 SplitActionUtil.pushOverTimeTasksAll(signDate, signDate, userId); + if (belongdate.length() != 0) { + new KQFormatBiz().formatDate(userId, belongdate); + SplitActionUtil.pushOverTimeTasksAll(belongdate, belongdate, userId); + } } }