Commit 3b1e4853 by lal Committed by chenzg

提交

parent 58103ff6
......@@ -23,6 +23,10 @@ public class ClockInTool {
static SimpleDateFormat famt = new SimpleDateFormat("yyyy-MM-dd");
public static double round(double value){
return Math.round(value*100)/100.0;
}
/**
* 判断某个字符串是否存在于数组中
* @param stringArray 原数组
......
package cn.timer.api.controller.kqgl.service;
import java.math.BigDecimal;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
......@@ -135,6 +136,7 @@ public class KqglServiceImpl implements KqglService {
modifynumber = balan.getModifyNumber()+1;
}
KqglAssoYhkqz yhd = KqglAssoYhkqz.builder().build().selectOne(new QueryWrapper<KqglAssoYhkqz>().lambda().eq(KqglAssoYhkqz::getUserid, overappr.getUserid()).eq(KqglAssoYhkqz::getQyid, overappr.getOrgcode()));
if(yhd != null) {
KqglAssoOvertimeRange timeran = KqglAssoOvertimeRange.builder().build().selectOne(new QueryWrapper<KqglAssoOvertimeRange>().lambda().eq(KqglAssoOvertimeRange::getAttgroupId, yhd.getKqzid()));
......@@ -170,6 +172,58 @@ public class KqglServiceImpl implements KqglService {
}
}
}
//调休单位是“天”时 按照=》加班时长/班次的工作时长=调休天数
if(learul.getCompany() == 1) {
try {
AttendanceCardListDto attdate = MethodCall(overappr.getOrgcode(),overappr.getUserid(),startdate);//获取当天打卡班次信息
long starttime1 = 0,endtime1 = 0,starttime2 = 0,endtime2 = 0,starttime3 = 0,endtime3 = 0;
double time1 = 0,time2 = 0,time3 = 0;
BigDecimal num0 = new BigDecimal(60);
if(EmptyUtil.isNotEmpty(attdate.getAttsch())) {//班次不为空
List<AttSchedule> ash = attdate.getAttsch();//获取当天应打卡时间
if(attdate.getAttsch().size() == 2 || attdate.getAttsch().size() == 4 || attdate.getAttsch().size() == 6) {
starttime1 = ash.get(0).getTime();
endtime1 = ash.get(1).getTime();
BigDecimal num = new BigDecimal((endtime1 - starttime1)/1000/60);
time1 = num.divide(num0,2,BigDecimal.ROUND_HALF_UP).doubleValue();
}
if(attdate.getAttsch().size() == 4 || attdate.getAttsch().size() == 6) {
starttime2 = ash.get(2).getTime();
endtime2 = ash.get(3).getTime();
BigDecimal num = new BigDecimal((endtime2 - starttime2)/1000/60);
time2 = num.divide(num0,2,BigDecimal.ROUND_HALF_UP).doubleValue();
}
if(attdate.getAttsch().size() == 6) {
starttime3 = ash.get(4).getTime();
endtime3 = ash.get(5).getTime();
BigDecimal num = new BigDecimal((endtime3 - starttime3)/1000/60);
time3 = num.divide(num0,2,BigDecimal.ROUND_HALF_UP).doubleValue();
}
}
BigDecimal num1 = new BigDecimal(time1);
BigDecimal num2 = new BigDecimal(time2);
BigDecimal num3 = num1.add(num2);
BigDecimal num4 = new BigDecimal(time3);
double shift_duration = ClockInTool.round(num3.add(num4).doubleValue());//班次时长
BigDecimal num5 = new BigDecimal(duration);
BigDecimal num6 = new BigDecimal(shift_duration);
//加班时长/班次的工作时长=调休天数
duration = num5.divide(num6,2,BigDecimal.ROUND_HALF_UP).doubleValue();
} catch (ParseException e) {
e.printStackTrace();
}
}
KqglAssoLeaveBalance.builder().leaveRulesId(learul.getId()).userid(overappr.getUserid()).modifyAction(2).balanceDays("+"+duration)
.reason("考勤加班审批").modifyUserid(emp.getEmpNum()).modifyTimer(overappr.getStarttime()).orgCode(emp.getOrgCode()).isAutomatic(1).modifyNumber(modifynumber).build().insert();//员工假期余额
......
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