调整
This commit is contained in:
parent
ed6d997c41
commit
7d28cb895f
@ -67,7 +67,7 @@ public interface IRzAttendanceService extends IService<RzAttendance>
|
||||
|
||||
public void dingDing(String dingUserId, String bizId, Long checkTime);
|
||||
|
||||
void addRzOverTime(String result, SysStaff sysStaff, DingShiftGroup dingsShiftGroup, String checkType, Date formatWorkDate, Date formatUserCheckTime, String timeResult, String remark, Double debiting);
|
||||
void addRzOverTime(String result, SysStaff sysStaff, DingShiftGroup dingsShiftGroup, String checkType, Date formatWorkDate, Date formatUserCheckTime, String timeResult, String remark, Double debiting, RzAttendance attendance);
|
||||
|
||||
public RzAttendance queryNowDayAttendanceByStatisticalIdAndDate(Long staffId, Date date);
|
||||
|
||||
|
||||
@ -534,7 +534,7 @@ public class RzAttendanceServiceImpl extends ServiceImpl<RzAttendanceMapper, RzA
|
||||
for (int i = 0; i < jsonArray.size(); i++) {
|
||||
JSONObject ob = jsonArray.getJSONObject(i);
|
||||
if(bizId.equals(ob.getString("bizId"))){
|
||||
calculationAddRzOverTime(result, sysStaff, ob);
|
||||
calculationAddRzOverTime(result, sysStaff, ob, null);
|
||||
// //打卡类型
|
||||
// String checkType = ob.getString("checkType");
|
||||
// //考勤组
|
||||
@ -574,13 +574,15 @@ public class RzAttendanceServiceImpl extends ServiceImpl<RzAttendanceMapper, RzA
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addRzOverTime(String result, SysStaff sysStaff, DingShiftGroup dingsShiftGroup, String checkType, Date formatWorkDate, Date formatUserCheckTime, String timeResult, String remark, Double debiting){
|
||||
public void addRzOverTime(String result, SysStaff sysStaff, DingShiftGroup dingsShiftGroup, String checkType, Date formatWorkDate, Date formatUserCheckTime, String timeResult, String remark, Double debiting,RzAttendance attendance){
|
||||
if(dingsShiftGroup != null){
|
||||
//通过打卡类型, classId, 和排班打卡时间, 获取工作时长
|
||||
//通过班次id拿到工作时长
|
||||
DingShift dingsShift = dingsShiftMapper.selectByDingId(dingsShiftGroup.getShiftId());
|
||||
//通过workDate 获取哪一天的卡
|
||||
RzAttendance attendance = queryNowDayAttendanceByStatisticalIdAndDate(sysStaff.getUserId(),formatWorkDate);
|
||||
if(attendance == null){
|
||||
attendance = queryNowDayAttendanceByStatisticalIdAndDate(sysStaff.getUserId(),formatWorkDate);
|
||||
}
|
||||
//生成打卡记录
|
||||
rzAttendanceDetailService.addDetail(attendance, ("OnDuty".equals(checkType) ? "上班卡" : "下班卡"), "/", formatUserCheckTime, StringUtils.isEmpty(remark) ? "钉钉打卡" : remark, "");
|
||||
//上班
|
||||
@ -592,13 +594,13 @@ public class RzAttendanceServiceImpl extends ServiceImpl<RzAttendanceMapper, RzA
|
||||
}
|
||||
}else if("OffDuty".equals(checkType)){
|
||||
attendance.setWorkEndTime(formatUserCheckTime);
|
||||
if("Normal".equals(timeResult) && !"1".equals(attendance.getYcsFlag())){
|
||||
if("Normal".equals(timeResult) && !"1".equals(attendance.getYcsFlag()) && attendance.getWorkStartTime() != null){
|
||||
attendance.setWorkSum(BigDecimal.valueOf(dingsShift.getWorkHour()));
|
||||
}else{
|
||||
//早退需要计算工时
|
||||
if(attendance.getWorkStartTime() != null){
|
||||
Long hours = (attendance.getWorkEndTime().getTime() - attendance.getWorkStartTime().getTime())/1000/60/60;
|
||||
attendance.setWorkSum(BigDecimal.valueOf(hours));
|
||||
attendance.setWorkSum((BigDecimal.valueOf(dingsShift.getWorkHour()).compareTo(BigDecimal.valueOf(hours)) < 0) ? BigDecimal.valueOf(dingsShift.getWorkHour()) : BigDecimal.valueOf(hours));
|
||||
}else {
|
||||
attendance.setWorkSum(DataUtils.DEFAULT_VALUE);
|
||||
}
|
||||
@ -650,11 +652,11 @@ public class RzAttendanceServiceImpl extends ServiceImpl<RzAttendanceMapper, RzA
|
||||
JSONArray jsonArray = resultJson.getJSONArray("recordresult");
|
||||
JSONObject onDutyObject = (JSONObject) jsonArray.stream().filter(data -> "OnDuty".equals(((JSONObject)data).getString("checkType"))).findFirst().orElse(null);
|
||||
if(onDutyObject != null){
|
||||
calculationAddRzOverTime(result, sysStaff, onDutyObject);
|
||||
calculationAddRzOverTime(result, sysStaff, onDutyObject, attendance);
|
||||
}
|
||||
JSONObject offDutyObject = (JSONObject) jsonArray.stream().filter(data -> "OffDuty".equals(((JSONObject)data).getString("checkType"))).findFirst().orElse(null);
|
||||
if(offDutyObject != null){
|
||||
calculationAddRzOverTime(result, sysStaff, offDutyObject);
|
||||
calculationAddRzOverTime(result, sysStaff, offDutyObject, attendance);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
@ -664,7 +666,7 @@ public class RzAttendanceServiceImpl extends ServiceImpl<RzAttendanceMapper, RzA
|
||||
return attendance;
|
||||
}
|
||||
|
||||
public void calculationAddRzOverTime(String result ,SysStaff sysStaff, JSONObject ob){
|
||||
public void calculationAddRzOverTime(String result ,SysStaff sysStaff, JSONObject ob, RzAttendance attendance){
|
||||
//打卡类型
|
||||
String checkType = ob.getString("checkType");
|
||||
//考勤组
|
||||
@ -693,7 +695,7 @@ public class RzAttendanceServiceImpl extends ServiceImpl<RzAttendanceMapper, RzA
|
||||
Date formatWorkDate = Date.from(Instant.ofEpochMilli(workDate));
|
||||
Date formatUserCheckTime = Date.from(Instant.ofEpochMilli(userCheckTime));
|
||||
DingShiftGroup dingsShiftGroup = dingsShiftGroupMapper.selectByGroupIdAndTypeAndCheckTime(groupId, shiftId, checkType, formatPlanCheckTime);
|
||||
addRzOverTime(result, sysStaff, dingsShiftGroup, checkType, formatWorkDate, formatUserCheckTime, timeResult, null, 0d);
|
||||
addRzOverTime(result, sysStaff, dingsShiftGroup, checkType, formatWorkDate, formatUserCheckTime, timeResult, null, 0d, attendance);
|
||||
}
|
||||
|
||||
@Async
|
||||
|
||||
@ -63,7 +63,7 @@ public class InstanceChangeRechargeCardExchangeProcessor implements InstanceChan
|
||||
dingsShiftGroup = getDingShiftGroupService().selectByGroupIdAndTypeAndCheckTime(planResultObject.getString("group_id"), planResultObject.getString("class_id"), checkType, formatPlanCheckTime);
|
||||
Date date= DateUtils.parseDate(bkTime, "yyyy-MM-dd HH:mm");
|
||||
//生成补卡记录信息
|
||||
getIRzAttendanceService().addRzOverTime(json.toString(), sysStaff, dingsShiftGroup, checkType, date, date, "/", "钉钉补卡-"+bkYi, ParamUtils.getDebiting());
|
||||
getIRzAttendanceService().addRzOverTime(json.toString(), sysStaff, dingsShiftGroup, checkType, date, date, "/", "钉钉补卡-"+bkYi, ParamUtils.getDebiting(), null);
|
||||
}
|
||||
}
|
||||
} catch (ParseException e) {
|
||||
|
||||
@ -32,7 +32,7 @@ spring:
|
||||
druid:
|
||||
# 主库数据源
|
||||
master:
|
||||
url: jdbc:mysql://localhost:3306/evo_cw_dev_ding?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||
url: jdbc:mysql://192.168.5.232:3306/evo_cw_dev_ding?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||
username: root
|
||||
password: hbyt123456
|
||||
#username: root
|
||||
|
||||
Loading…
Reference in New Issue
Block a user