Commit 3033eb27 by yuquan.zhu

Merge branch 'develop' of develop-gitlab.youlingrc.com:8timerv2/8timerapiv200 into zyq_debug

parents a4965f12 6ea9837e
...@@ -658,5 +658,18 @@ public class ClockInTool { ...@@ -658,5 +658,18 @@ public class ClockInTool {
return res; return res;
} }
public static String Str_Time_formatting(String str,String Format) {
SimpleDateFormat sdf = new SimpleDateFormat(Format);
// String str = "2020-06-30 12:30:35"; // 把带时分秒的 date 转为 yyyy-MM-dd 格式的字符串
Date date2 = null;
try {
date2 = sdf.parse(str); // 把上面的字符串解析为日期类型
// System.out.println(sdf.format(date2));
} catch (ParseException e) {
e.printStackTrace();
}
return sdf.format(date2);
}
} }
...@@ -3322,4 +3322,73 @@ public class TimeCardController { ...@@ -3322,4 +3322,73 @@ public class TimeCardController {
return ResultUtil.data(msg, "操作成功!"); return ResultUtil.data(msg, "操作成功!");
} }
@GetMapping(value="/overtime_verification/{workovertimetype}/{starttime}/{endtime}")
@ApiOperation(value = "加班验证", httpMethod = "GET", notes = "接口发布说明")
public Result<Object> Overtime_verification(@CurrentUser UserBean userBean,@PathVariable("workovertimetype") Integer workovertimetype,
@PathVariable("starttime") String starttime,@PathVariable("endtime") String endtime) {
String msg = "";
//workovertimetype:1=工作日加班 2=休息日加班 3=节假日加班
Integer ending = 0;
String starttime_ = ClockInTool.Str_Time_formatting(starttime,"yyyy-MM-dd");
String endtime_ = ClockInTool.Str_Time_formatting(endtime,"yyyy-MM-dd");
if((starttime_).equals(endtime_)) {
try {
AttendanceCardListDto attdate = MethodCall(userBean.getOrgCode(),userBean.getEmpNum(),starttime_);//获取当天所打卡班次
List<AttSchedule> ashss = attdate.getAttsch();//获取今天应打卡时间
if(EmptyUtil.isNotEmpty(attdate.getAttsch())) {//班次不为空
if(ashss.get(0).getId() != 0) {
//工作日
ending = 1;
}else {
//休息
ending = 2;
}
}else {
//未排班
ending = 99;
}
} catch (ParseException e) {
e.printStackTrace();
}
}else {//不同日期
try {
AttendanceCardListDto attdateone = MethodCall(userBean.getOrgCode(),userBean.getEmpNum(),starttime_);//获取当天所打卡班次
AttendanceCardListDto attdatetwo = MethodCall(userBean.getOrgCode(),userBean.getEmpNum(),endtime_);//获取当天所打卡班次
List<AttSchedule> ashone = attdateone.getAttsch();//获取今天应打卡时间
List<AttSchedule> ashtwo = attdatetwo.getAttsch();//获取今天应打卡时间
if(EmptyUtil.isNotEmpty(attdateone.getAttsch()) && EmptyUtil.isNotEmpty(attdatetwo.getAttsch())) {//班次不为空
if(ashone.get(0).getId() != 0 && ashtwo.get(0).getId() != 0) {
//工作日
ending = 1;
}else {
//休息
ending = 2;
}
}else {
//未排班
ending = 99;
}
} catch (ParseException e) {
e.printStackTrace();
}
}
if(ending != workovertimetype) {
//所选日期范围与加班类型不匹配,请重新选择
msg = "所选日期范围与加班类型不匹配,请重新选择";
}
if(ending == 99) {
//所选日期范围暂无排班,请联系管理员
msg = "所选日期范围暂无排班,请联系管理员";
}
return ResultUtil.data(msg,"操作成功!");
}
} }
...@@ -109,7 +109,7 @@ public class AttendanceTaskTiming{ ...@@ -109,7 +109,7 @@ public class AttendanceTaskTiming{
// @Scheduled(cron = "0 22 15 * * ?") // 测试:5秒执行一次 0 0 19 * * ? // @Scheduled(cron = "0 22 15 * * ?") // 测试:5秒执行一次 0 0 19 * * ?
// @Scheduled(cron = "0 */5 * * * ?") // @Scheduled(cron = "0 */5 * * * ?")
@Scheduled(cron = "0 0 19 * * ?") // @Scheduled(cron = "0 3 19 * * ?")
public void AttendanceTask() throws ParseException { public void AttendanceTask() throws ParseException {
// boolean implement = false; // boolean implement = false;
......
...@@ -213,11 +213,13 @@ public class KqglServiceImpl implements KqglService { ...@@ -213,11 +213,13 @@ public class KqglServiceImpl implements KqglService {
BigDecimal num4 = new BigDecimal(time3); BigDecimal num4 = new BigDecimal(time3);
double shift_duration = ClockInTool.round(num3.add(num4).doubleValue());//班次时长 double shift_duration = ClockInTool.round(num3.add(num4).doubleValue());//班次时长
if(shift_duration > 0) {
BigDecimal num5 = new BigDecimal(duration); BigDecimal num5 = new BigDecimal(duration);
BigDecimal num6 = new BigDecimal(shift_duration); BigDecimal num6 = new BigDecimal(shift_duration);
//加班时长/班次的工作时长=调休天数 //加班时长/班次的工作时长=调休天数
duration = num5.divide(num6,2,BigDecimal.ROUND_HALF_UP).doubleValue(); duration = num5.divide(num6,2,BigDecimal.ROUND_HALF_UP).doubleValue();
}
} catch (ParseException e) { } catch (ParseException e) {
e.printStackTrace(); e.printStackTrace();
......
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