Commit cfea190a by 284718418@qq.com

1.修改BUG 自由工时补卡

parent bd2aacc1
......@@ -326,8 +326,9 @@ public class KqglServiceImpl implements KqglService {
KqglMainKqz attgro = kqglmainkqzmapper.getAttendanceGroupInformationByUserid(repaappr.getUserid(),repaappr.getOrgcode()); //考勤组信息
if(attgro != null) {
AttendanceCardListDto attdate = MethodCall(repaappr.getOrgcode(),repaappr.getUserid(),cardrepltime);//获取当天打卡班次信息
if(EmptyUtil.isNotEmpty(attdate.getAttsch())) {//班次不为空
//排班方式 // 考勤类型:1-固定排班、2-排班制、3-自由工时
//自由工时无班次ID 另行逻辑
if(attgro.getPbfs()<3 && EmptyUtil.isNotEmpty(attdate.getAttsch())) {//班次不为空
List<AttSchedule> ash = attdate.getAttsch();//获取当天应打卡时间
shifid = ash.get(0).getId();//班次id
long starttime1 = 0,starttime1ks = 0,starttime1js = 0,endtime1 = 0,endtime1ks = 0,endtime1js = 0,starttime2 = 0,starttime2ks = 0,starttime2js = 0,endtime2 = 0,endtime2ks = 0,endtime2js = 0,starttime3 = 0,starttime3ks = 0,starttime3js = 0,
......@@ -806,6 +807,165 @@ public class KqglServiceImpl implements KqglService {
}
}
if(attgro.getPbfs() == 3){
long starttime1 = 0,starttime1ks = 0,starttime1js = 0,endtime1 = 0,endtime1ks = 0,endtime1js = 0,starttime2 = 0,starttime2ks = 0,starttime2js = 0,endtime2 = 0,endtime2ks = 0,endtime2js = 0,starttime3 = 0,starttime3ks = 0,starttime3js = 0,
endtime3 = 0,endtime3ks = 0,endtime3js = 0;
KqglAssoDkmx dkmc = KqglAssoDkmx.builder().build().selectOne(new QueryWrapper<KqglAssoDkmx>().lambda().eq(KqglAssoDkmx::getUserid, repaappr.getUserid()).eq(KqglAssoDkmx::getQyid, repaappr.getOrgcode())
.ge(KqglAssoDkmx::getDksj, start_time).le(KqglAssoDkmx::getDksj, end_time));//获取补卡当天是否有打卡记录
if(dkmc != null) {
dkmxid = dkmc.getId();
if(repaappr.getCardreplperiod() == 1 && dkmc.getSbdk1() == null) {//上班
int sbdkjg = 0;
if(isRange) {
Long time = (repaappr.getCardrepltime() - starttime1)/1000/60;
if(time > 0){//上班1打卡结果
sbdkjg = Math.abs(Integer.valueOf(time.toString()));
}
Double gzsctime = null;//工作时长
if(dkmc.getXbdk1() != null){
Long time1 = (repaappr.getCardrepltime() - dkmc.getXbdk1())/1000/60;
gzsctime = Math.abs(Double.valueOf(time1.toString()));//只打一次卡时计算工作时长
}
KqglAssoDkmx.builder().id(dkmc.getId()).sbdk1(repaappr.getCardrepltime()).sbdk1jg(sbdkjg).dktj1(1).gzsc(gzsctime).build().updateById();
}
atttype = 1;
results = sbdkjg;
}else if(repaappr.getCardreplperiod() == 2 && dkmc.getXbdk1() == null) {//下班
int xbdk1jg = 0;
if(isRange) {
Long time = (repaappr.getCardrepltime() - endtime1)/1000/60;
if(time > 0){}else{
xbdk1jg = Math.abs(Integer.valueOf(time.toString()));
}
Double gzsctime = null;//工作时长
if(dkmc.getSbdk1() != null) {
Long time1 = (repaappr.getCardrepltime() - dkmc.getSbdk1())/1000/60;
gzsctime = Math.abs(Double.valueOf(time1.toString()));
}
KqglAssoDkmx.builder().id(dkmc.getId()).xbdk1(repaappr.getCardrepltime()).xbdk1jg(xbdk1jg).dktj2(1).gzsc(gzsctime).build().updateById();
}
atttype = 2;
results = xbdk1jg;
}
}else {//补卡当天无打卡记录时
KqglAssoDkmx pcd = KqglAssoDkmx.builder().userid(repaappr.getUserid()).data(cardrepltime).qyid(repaappr.getOrgcode()).dksj(start_time).ydkcs(2)
.gzsc(0d).build();
if(repaappr.getCardreplperiod() == 1) {//上班
int sbdkjg = 0;
if(isRange) {
pcd.setSbdk1(repaappr.getCardrepltime());
pcd.setSbdk1jg(sbdkjg);
pcd.setDktj1(1);
if (!pcd.insert()) {
throw new CustomException("打卡明细-新增异常-1");
}
}
atttype = 1;
}else if(repaappr.getCardreplperiod() == 2) {//下班
int xbdk1jg = 0;
if(isRange) {
pcd.setXbdk1(repaappr.getCardrepltime());
pcd.setXbdk1jg(xbdk1jg);
pcd.setDktj2(1);
if (!pcd.insert()) {
throw new CustomException("打卡明细-新增异常-1");
}
}
atttype = 2;
}
if(isRange) {
dkmxid = pcd.getId();
}else {
throw new CustomException("当前时间,没有考勤异常无需补卡");
}
}
//0:打卡无效:此记录已被更新 1:正常 2:异常 3:迟到 4:早退 5:补卡 6:请假 7:加班 8:调休
//9:管理员改为正常 10:管理员改为迟到 11:管理员改为早退 12:补卡通过/正常 13:补卡通过/迟到 14:补卡通过/早退
int status = 2;
if((atttype)%2 > 0){
type = 1;
if(results == 0) {
status = 12;
}else {
status = 13;
}
}else {
type = 2;
if(results == 0) {
status = 12;
}else {
status = 14;
}
}
Long startDate = DateUtil.getStartTime(0,DateUtil.getStringTime(cardrepltime,"yyyy-MM-dd")).getTime();
String attdate_ = new SimpleDateFormat("yy-MM-dd").format(Double.valueOf(startDate));//转换打卡时间格式
//attime 应打卡时间
double gzsc = 0;
//long rest_time = 0;
/*if(shif.getStartTime() != null && !("").equals(shif.getStartTime()) && shif.getEndTime() != null && !("").equals(shif.getEndTime())) {
long kaishixiuxi = Long.valueOf(ClockInTool.dateToStamp(cardrepltime + " " +shif.getStartTime()+":00"));
long jieshuxiuxi = Long.valueOf(ClockInTool.dateToStamp(cardrepltime + " " +shif.getEndTime()+":00"));
rest_time = (jieshuxiuxi - kaishixiuxi)/1000/60;//休息时间
}*/
//请假时长
//KqglAssoRelationSummary qjsc = kqglassorelationsummarymapper.Businessdayclockin(repaappr.getUserid(), 2, cardrepltime, repaappr.getOrgcode());
//计算工作时长
KqglAssoDkmx dkgzsc = KqglAssoDkmx.builder().id(dkmxid).build().selectById();
if(dkgzsc.getYdkcs() == 2 || dkgzsc.getYdkcs() == 4 || dkgzsc.getYdkcs() == 6) {
if(dkgzsc.getSbdk1() != null && dkgzsc.getXbdk1() != null) {
gzsc = gzsc + (dkgzsc.getXbdk1() - dkgzsc.getSbdk1())/1000/60;
}
}
if(dkgzsc.getYdkcs() == 4 || dkgzsc.getYdkcs() == 6) {
if(dkgzsc.getSbdk2() != null && dkgzsc.getXbdk2() != null) {
gzsc = gzsc + (dkgzsc.getXbdk2() - dkgzsc.getSbdk2())/1000/60;
}
}
if(dkgzsc.getYdkcs() == 6) {
if(dkgzsc.getSbdk3() != null && dkgzsc.getXbdk3() != null) {
gzsc = gzsc + (dkgzsc.getXbdk3() - dkgzsc.getSbdk3())/1000/60;
}
}
//gzsc = gzsc - rest_time - qjsc.getDuration();
KqglAssoDkmx.builder().id(dkmxid).gzsc(gzsc).build().updateById();
KqglAssoDkjl pre = KqglAssoDkjl.builder().dktime(repaappr.getCardrepltime()).results(results).userId(repaappr.getUserid()).type(type).status(status).sort(atttype)
.cardType(0).qyid(repaappr.getOrgcode()).attdate(attdate_+" "+ClockInTool.dateToWeek2(cardrepltime)).attime(repaappr.getCardrepltime()).dkmxid(dkmxid).bcid(shifid).remarks("审批补卡通过打卡").punchmode(0)
.punchequipment("").commentary("成功打卡").build();
if (!pre.insert()) {
throw new CustomException("打卡记录-新增异常-2");
}
}
//}
}
......
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