|
|
@@ -1199,17 +1199,18 @@ public class WxCorpInfoServiceImpl extends ServiceImpl<WxCorpInfoMapper, WxCorpI
|
|
|
private void handleAllowance(UserCorpwxTime userCorpwxTime, String baseMorningStart, String baseMorningEnd, String baseAfternoonStart, String baseAfternoonEnd, double restTime) {
|
|
|
System.out.println("处理餐补");
|
|
|
OvertimeAllowance allowance = new OvertimeAllowance();
|
|
|
- allowance.setCompmanyId(userCorpwxTime.getCompanyId());
|
|
|
+ allowance.setCompanyId(userCorpwxTime.getCompanyId());
|
|
|
allowance.setCorpwxUserid(userCorpwxTime.getCorpwxUserid());
|
|
|
allowance.setDate(userCorpwxTime.getCreateDate());
|
|
|
DateTimeFormatter df = DateTimeFormatter.ofPattern("yyy-MM-dd HH:mm");
|
|
|
DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
|
|
+ DateTimeFormatter timeFormatter = DateTimeFormatter.ofPattern("HH:mm");
|
|
|
LocalDateTime startTime = LocalDateTime.parse(dateTimeFormatter.format(userCorpwxTime.getCreateDate()) + " " + userCorpwxTime.getStartTime(), df);
|
|
|
LocalDateTime endTime = LocalDateTime.parse(dateTimeFormatter.format(userCorpwxTime.getCreateDate()) + " " + userCorpwxTime.getEndTime(), df);
|
|
|
if (endTime.isBefore(startTime)) {
|
|
|
endTime = endTime.plusDays(1);
|
|
|
}
|
|
|
- if (startTime.toLocalTime().isBefore(LocalTime.parse(baseMorningStart,df))) {
|
|
|
+ if (startTime.toLocalTime().isBefore(LocalTime.parse(baseMorningStart,timeFormatter))) {
|
|
|
//上班时间校准为正常上班开始时间
|
|
|
startTime.withHour(Integer.parseInt(baseMorningStart.split(":")[0])).withMinute(Integer.parseInt(baseMorningStart.split(":")[1])).withSecond(0).withNano(0);
|
|
|
}
|
|
|
@@ -1228,7 +1229,7 @@ public class WxCorpInfoServiceImpl extends ServiceImpl<WxCorpInfoMapper, WxCorpI
|
|
|
if (startTimeTxt.compareTo(baseMorningEnd) <= 0 && endTimeTxt.compareTo(baseAfternoonStart) >= 0) {
|
|
|
//重新计算实际工作工时时长,需要减去中间午休时间
|
|
|
time = time - restTime;
|
|
|
-// System.out.println("午休时间:" + restTime + ", 减去后,工作时长=" + bigDecimal);
|
|
|
+ System.out.println("午休时间:" + restTime + ", 减去后,工作时长=" + bigDecimal);
|
|
|
}
|
|
|
//按小时为单位计算
|
|
|
//超过8小时,进行加班补贴
|
|
|
@@ -1236,10 +1237,10 @@ public class WxCorpInfoServiceImpl extends ServiceImpl<WxCorpInfoMapper, WxCorpI
|
|
|
time = 0;
|
|
|
}
|
|
|
allowance.setWorkHours(time);//实际工作时长
|
|
|
-// System.out.println("计算加班时长==" + (time - standWorkHours));
|
|
|
- if (time - standWorkHours > 0) {
|
|
|
- //是否是工作日加班
|
|
|
- if (WorkDayCalculateUtils.isWorkDay(userCorpwxTime.getCreateDate())) {
|
|
|
+ System.out.println("计算加班时长==" + (time - standWorkHours));
|
|
|
+ //是否是工作日加班
|
|
|
+ if (WorkDayCalculateUtils.isWorkDay(userCorpwxTime.getCreateDate())) {
|
|
|
+ if (time - standWorkHours >= 0) {//小夜班情况下是正好8小时工作,所以等于也要进行判断
|
|
|
if (startTimeTxt.compareTo(baseMorningEnd) < 0) {
|
|
|
//白班,正常工作上午来上班的情况,计算晚上加班的时间
|
|
|
if (time - standWorkHours >= 3.0) {
|
|
|
@@ -1272,41 +1273,41 @@ public class WxCorpInfoServiceImpl extends ServiceImpl<WxCorpInfoMapper, WxCorpI
|
|
|
allowance.setAllowance(30);
|
|
|
}
|
|
|
}
|
|
|
- } else {
|
|
|
- //非工作日,判断是否为全天加班
|
|
|
- if (time - standWorkHours >= 0) {
|
|
|
- if (startTimeTxt.compareTo(baseMorningEnd) < 0) {
|
|
|
- if (endTime.toLocalDate().isEqual(startTime.toLocalDate())) {
|
|
|
- allowance.setType(4);
|
|
|
- allowance.setOvertimeDuration(time - standWorkHours);
|
|
|
- allowance.setAllowance(20);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ //非工作日,判断是否为全天加班
|
|
|
+ if (time - standWorkHours >= 0) {
|
|
|
+ if (startTimeTxt.compareTo(baseMorningEnd) < 0) {
|
|
|
+ if (endTime.toLocalDate().isEqual(startTime.toLocalDate())) {
|
|
|
+ allowance.setType(4);
|
|
|
+ allowance.setOvertimeDuration(time - standWorkHours);
|
|
|
+ allowance.setAllowance(20);
|
|
|
// System.out.println("非工作日,加班白班全天");
|
|
|
- } else {
|
|
|
- //TODO: 非工作日,加班超过凌晨了,怎么计算
|
|
|
+ } else {
|
|
|
+ //TODO: 非工作日,加班超过凌晨了,怎么计算
|
|
|
// allowance.setType(1);
|
|
|
// allowance.setOvertimeDuration(time - standWorkHours);
|
|
|
// allowance.setAllowance(30);
|
|
|
- }
|
|
|
- } else if (startTimeTxt.compareTo("16:00") >= 0) {
|
|
|
- //晚班,计算白班加班的时间
|
|
|
- if (time >= 12.0) {
|
|
|
- //大夜班,超过12小时了
|
|
|
- allowance.setType(3);
|
|
|
- allowance.setOvertimeDuration(time - standWorkHours);
|
|
|
- allowance.setAllowance(50);
|
|
|
- } else {
|
|
|
- //跨天,加班超过凌晨了,补贴30
|
|
|
- allowance.setType(2);
|
|
|
- allowance.setOvertimeDuration(time - standWorkHours);
|
|
|
- allowance.setAllowance(30);
|
|
|
- }
|
|
|
+ }
|
|
|
+ } else if (startTimeTxt.compareTo("16:00") >= 0) {
|
|
|
+ //晚班,计算白班加班的时间
|
|
|
+ if (time >= 12.0) {
|
|
|
+ //大夜班,超过12小时了
|
|
|
+ allowance.setType(3);
|
|
|
+ allowance.setOvertimeDuration(time - standWorkHours);
|
|
|
+ allowance.setAllowance(50);
|
|
|
+ } else {
|
|
|
+ //跨天,加班超过凌晨了,补贴30
|
|
|
+ allowance.setType(2);
|
|
|
+ allowance.setOvertimeDuration(time - standWorkHours);
|
|
|
+ allowance.setAllowance(30);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//保存数据
|
|
|
-// System.out.println("最终allowance==" + allowance.getAllowance());
|
|
|
+ System.out.println("最终allowance==" + allowance.getAllowance());
|
|
|
if (allowance.getAllowance() != null) {
|
|
|
OvertimeAllowance oldAllowance = overtimeAllowanceService.getOne(new QueryWrapper<OvertimeAllowance>()
|
|
|
.eq("corpwx_userid", userCorpwxTime.getCorpwxUserid()).eq("date", userCorpwxTime.getCreateDate()));
|
|
|
@@ -1315,10 +1316,15 @@ public class WxCorpInfoServiceImpl extends ServiceImpl<WxCorpInfoMapper, WxCorpI
|
|
|
overtimeAllowanceService.save(allowance);
|
|
|
} else {
|
|
|
//更新数据
|
|
|
- oldAllowance.setAllowance(allowance.getAllowance());
|
|
|
- oldAllowance.setOvertimeDuration(allowance.getOvertimeDuration());
|
|
|
- oldAllowance.setType(allowance.getType());
|
|
|
- overtimeAllowanceService.updateById(oldAllowance);
|
|
|
+ allowance.setId(oldAllowance.getId());
|
|
|
+ overtimeAllowanceService.updateById(allowance);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ //无餐补,如果之前有记录要删掉
|
|
|
+ OvertimeAllowance oldAllowance = overtimeAllowanceService.getOne(new QueryWrapper<OvertimeAllowance>()
|
|
|
+ .eq("corpwx_userid", userCorpwxTime.getCorpwxUserid()).eq("date", userCorpwxTime.getCreateDate()));
|
|
|
+ if (oldAllowance != null) {
|
|
|
+ overtimeAllowanceService.removeById(oldAllowance.getId());
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -2825,6 +2831,24 @@ public class WxCorpInfoServiceImpl extends ServiceImpl<WxCorpInfoMapper, WxCorpI
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public void setUserCorpWxCardTime(UserCorpwxTime userCorpWxCardTime) {
|
|
|
+ //查找看有没有
|
|
|
+ UserCorpwxTime oldItem = userCorpwxTimeMapper.selectOne(new QueryWrapper<UserCorpwxTime>().eq("corpwx_userid", userCorpWxCardTime.getCorpwxUserid()).eq("company_id", userCorpWxCardTime.getCompanyId()).eq("create_date", userCorpWxCardTime.getCreateDate()));
|
|
|
+ if (oldItem != null) {
|
|
|
+ userCorpWxCardTime.setId(oldItem.getId());
|
|
|
+ userCorpwxTimeMapper.updateById(userCorpWxCardTime);
|
|
|
+ } else {
|
|
|
+ userCorpwxTimeMapper.insert(userCorpWxCardTime);
|
|
|
+ }
|
|
|
+ String baseMorningStart = "08:00";
|
|
|
+ String baseMorningEnd = "12:00";
|
|
|
+ String baseAfternoonStart = "13:00";
|
|
|
+ String baseAfternoonEnd = "17:00";
|
|
|
+ double restTime = 1.0;
|
|
|
+ handleAllowance(userCorpWxCardTime, baseMorningStart, baseMorningEnd, baseAfternoonStart, baseAfternoonEnd, restTime);
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 企业微信账号继承
|
|
|
* @param handoverId
|