调整
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);
|
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);
|
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++) {
|
for (int i = 0; i < jsonArray.size(); i++) {
|
||||||
JSONObject ob = jsonArray.getJSONObject(i);
|
JSONObject ob = jsonArray.getJSONObject(i);
|
||||||
if(bizId.equals(ob.getString("bizId"))){
|
if(bizId.equals(ob.getString("bizId"))){
|
||||||
calculationAddRzOverTime(result, sysStaff, ob);
|
calculationAddRzOverTime(result, sysStaff, ob, null);
|
||||||
// //打卡类型
|
// //打卡类型
|
||||||
// String checkType = ob.getString("checkType");
|
// String checkType = ob.getString("checkType");
|
||||||
// //考勤组
|
// //考勤组
|
||||||
@ -574,13 +574,15 @@ public class RzAttendanceServiceImpl extends ServiceImpl<RzAttendanceMapper, RzA
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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){
|
if(dingsShiftGroup != null){
|
||||||
//通过打卡类型, classId, 和排班打卡时间, 获取工作时长
|
//通过打卡类型, classId, 和排班打卡时间, 获取工作时长
|
||||||
//通过班次id拿到工作时长
|
//通过班次id拿到工作时长
|
||||||
DingShift dingsShift = dingsShiftMapper.selectByDingId(dingsShiftGroup.getShiftId());
|
DingShift dingsShift = dingsShiftMapper.selectByDingId(dingsShiftGroup.getShiftId());
|
||||||
//通过workDate 获取哪一天的卡
|
//通过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, "");
|
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)){
|
}else if("OffDuty".equals(checkType)){
|
||||||
attendance.setWorkEndTime(formatUserCheckTime);
|
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()));
|
attendance.setWorkSum(BigDecimal.valueOf(dingsShift.getWorkHour()));
|
||||||
}else{
|
}else{
|
||||||
//早退需要计算工时
|
//早退需要计算工时
|
||||||
if(attendance.getWorkStartTime() != null){
|
if(attendance.getWorkStartTime() != null){
|
||||||
Long hours = (attendance.getWorkEndTime().getTime() - attendance.getWorkStartTime().getTime())/1000/60/60;
|
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 {
|
}else {
|
||||||
attendance.setWorkSum(DataUtils.DEFAULT_VALUE);
|
attendance.setWorkSum(DataUtils.DEFAULT_VALUE);
|
||||||
}
|
}
|
||||||
@ -650,11 +652,11 @@ public class RzAttendanceServiceImpl extends ServiceImpl<RzAttendanceMapper, RzA
|
|||||||
JSONArray jsonArray = resultJson.getJSONArray("recordresult");
|
JSONArray jsonArray = resultJson.getJSONArray("recordresult");
|
||||||
JSONObject onDutyObject = (JSONObject) jsonArray.stream().filter(data -> "OnDuty".equals(((JSONObject)data).getString("checkType"))).findFirst().orElse(null);
|
JSONObject onDutyObject = (JSONObject) jsonArray.stream().filter(data -> "OnDuty".equals(((JSONObject)data).getString("checkType"))).findFirst().orElse(null);
|
||||||
if(onDutyObject != 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);
|
JSONObject offDutyObject = (JSONObject) jsonArray.stream().filter(data -> "OffDuty".equals(((JSONObject)data).getString("checkType"))).findFirst().orElse(null);
|
||||||
if(offDutyObject != null){
|
if(offDutyObject != null){
|
||||||
calculationAddRzOverTime(result, sysStaff, offDutyObject);
|
calculationAddRzOverTime(result, sysStaff, offDutyObject, attendance);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
@ -664,7 +666,7 @@ public class RzAttendanceServiceImpl extends ServiceImpl<RzAttendanceMapper, RzA
|
|||||||
return attendance;
|
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");
|
String checkType = ob.getString("checkType");
|
||||||
//考勤组
|
//考勤组
|
||||||
@ -693,7 +695,7 @@ public class RzAttendanceServiceImpl extends ServiceImpl<RzAttendanceMapper, RzA
|
|||||||
Date formatWorkDate = Date.from(Instant.ofEpochMilli(workDate));
|
Date formatWorkDate = Date.from(Instant.ofEpochMilli(workDate));
|
||||||
Date formatUserCheckTime = Date.from(Instant.ofEpochMilli(userCheckTime));
|
Date formatUserCheckTime = Date.from(Instant.ofEpochMilli(userCheckTime));
|
||||||
DingShiftGroup dingsShiftGroup = dingsShiftGroupMapper.selectByGroupIdAndTypeAndCheckTime(groupId, shiftId, checkType, formatPlanCheckTime);
|
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
|
@Async
|
||||||
|
|||||||
@ -63,7 +63,7 @@ public class InstanceChangeRechargeCardExchangeProcessor implements InstanceChan
|
|||||||
dingsShiftGroup = getDingShiftGroupService().selectByGroupIdAndTypeAndCheckTime(planResultObject.getString("group_id"), planResultObject.getString("class_id"), checkType, formatPlanCheckTime);
|
dingsShiftGroup = getDingShiftGroupService().selectByGroupIdAndTypeAndCheckTime(planResultObject.getString("group_id"), planResultObject.getString("class_id"), checkType, formatPlanCheckTime);
|
||||||
Date date= DateUtils.parseDate(bkTime, "yyyy-MM-dd HH:mm");
|
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) {
|
} catch (ParseException e) {
|
||||||
|
|||||||
@ -32,7 +32,7 @@ spring:
|
|||||||
druid:
|
druid:
|
||||||
# 主库数据源
|
# 主库数据源
|
||||||
master:
|
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
|
username: root
|
||||||
password: hbyt123456
|
password: hbyt123456
|
||||||
#username: root
|
#username: root
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user