Commit da53c5d2 by leialin

Merge branch 'lal' into 'develop'

Lal

See merge request 8timerv2/8timerapiv200!281
parents 2c346f9c 5b0df65a
...@@ -23,6 +23,10 @@ public class ClockInTool { ...@@ -23,6 +23,10 @@ public class ClockInTool {
static SimpleDateFormat famt = new SimpleDateFormat("yyyy-MM-dd"); static SimpleDateFormat famt = new SimpleDateFormat("yyyy-MM-dd");
public static double round(double value){
return Math.round(value*100)/100.0;
}
/** /**
* 判断某个字符串是否存在于数组中 * 判断某个字符串是否存在于数组中
* @param stringArray 原数组 * @param stringArray 原数组
......
...@@ -276,7 +276,7 @@ public class TimeCardController { ...@@ -276,7 +276,7 @@ public class TimeCardController {
if(listAs.get(i).getAppliedScope() == 0) {//全公司 if(listAs.get(i).getAppliedScope() == 0) {//全公司
nary = new String[1];//用户名 nary = new String[1];//用户名
naryid = new String[1];//用户名 naryid = new String[1];//用户名
nary[0] = "全公司"; nary[0] = "未使用";
naryid[0] = "0"; naryid[0] = "0";
}else { }else {
List<KqglAssoOvertimeRange> overtim = kqglassoovertimerangemapper.selectList(new QueryWrapper<KqglAssoOvertimeRange>().lambda().eq(KqglAssoOvertimeRange::getOvertimeRulesId, listAs.get(i).getId())); List<KqglAssoOvertimeRange> overtim = kqglassoovertimerangemapper.selectList(new QueryWrapper<KqglAssoOvertimeRange>().lambda().eq(KqglAssoOvertimeRange::getOvertimeRulesId, listAs.get(i).getId()));
...@@ -3296,4 +3296,30 @@ public class TimeCardController { ...@@ -3296,4 +3296,30 @@ public class TimeCardController {
return ResultUtil.data(tabl, "操作成功!"); return ResultUtil.data(tabl, "操作成功!");
} }
@PostMapping(value = "/isitused")
@ApiOperation(value = "(加班规则)当选择加班规则范围中存在已使用的考勤组时,在用户确认后给用户一个提示,提示用户哪个考勤组已被使用,是否修改", httpMethod = "POST", notes = "接口发布说明")
public Result<Object> Isitused(@CurrentUser UserBean userBean,@RequestBody KqglAssoOvertimeRulesDto overrules) {
String msg = "";
String[] launchs = overrules.getApplyrangeid();
if(launchs.length > 0) {
for(int p=0;p<launchs.length;p++){
KqglAssoOvertimeRange ran = KqglAssoOvertimeRange.builder().build().selectOne(new QueryWrapper<KqglAssoOvertimeRange>().lambda().eq(KqglAssoOvertimeRange::getAttgroupId, launchs[p]));
if(ran != null) {
KqglMainKqz kqz = KqglMainKqz.builder().build().selectOne(new QueryWrapper<KqglMainKqz>().lambda().eq(KqglMainKqz::getId, ran.getAttgroupId()));
if(p == 0) {
msg += kqz.getName();
}else {
msg += "、"+kqz.getName();
}
}
}
}
return ResultUtil.data(msg, "操作成功!");
}
} }
package cn.timer.api.controller.kqgl.service; package cn.timer.api.controller.kqgl.service;
import java.math.BigDecimal;
import java.text.ParseException; import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
...@@ -135,6 +136,7 @@ public class KqglServiceImpl implements KqglService { ...@@ -135,6 +136,7 @@ public class KqglServiceImpl implements KqglService {
modifynumber = balan.getModifyNumber()+1; modifynumber = balan.getModifyNumber()+1;
} }
KqglAssoYhkqz yhd = KqglAssoYhkqz.builder().build().selectOne(new QueryWrapper<KqglAssoYhkqz>().lambda().eq(KqglAssoYhkqz::getUserid, overappr.getUserid()).eq(KqglAssoYhkqz::getQyid, overappr.getOrgcode())); KqglAssoYhkqz yhd = KqglAssoYhkqz.builder().build().selectOne(new QueryWrapper<KqglAssoYhkqz>().lambda().eq(KqglAssoYhkqz::getUserid, overappr.getUserid()).eq(KqglAssoYhkqz::getQyid, overappr.getOrgcode()));
if(yhd != null) { if(yhd != null) {
KqglAssoOvertimeRange timeran = KqglAssoOvertimeRange.builder().build().selectOne(new QueryWrapper<KqglAssoOvertimeRange>().lambda().eq(KqglAssoOvertimeRange::getAttgroupId, yhd.getKqzid())); KqglAssoOvertimeRange timeran = KqglAssoOvertimeRange.builder().build().selectOne(new QueryWrapper<KqglAssoOvertimeRange>().lambda().eq(KqglAssoOvertimeRange::getAttgroupId, yhd.getKqzid()));
...@@ -171,6 +173,58 @@ public class KqglServiceImpl implements KqglService { ...@@ -171,6 +173,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) 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();//员工假期余额 .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