Commit 5873f140 by leialin

Merge branch 'lal' into 'develop'

Lal

See merge request 8timerv2/8timerapiv200!320
parents 1311f2fb 5c79f12a
...@@ -2148,75 +2148,108 @@ public class ClockInController { ...@@ -2148,75 +2148,108 @@ public class ClockInController {
//打卡记录 //打卡记录
// List<KqglAssoDkjl> dajllist = kqglassodkjlmapper.getDetailedRecordClock(startDate,endDate,userBean.getEmpNum()); // List<KqglAssoDkjl> dajllist = kqglassodkjlmapper.getDetailedRecordClock(startDate,endDate,userBean.getEmpNum());
// attdate.setAttpr(dajllist); // attdate.setAttpr(dajllist);
List<AttSchedule> attsch = attdate.getAttsch(); if(attdate.getAttgrouptype() != 3) {
int r = 1; List<AttSchedule> attsch = attdate.getAttsch();
for(AttSchedule ash : attsch) { if(EmptyUtil.isNotEmpty(attdate.getAttsch())) {//班次不为空
int bccs = attdate.getAttsch().size();
if(attdate.getAttsch().size() == 2) { int r = 1,bc = 0;
//有范围 int bsz = 0;
if(ash.getStarttime() != 0 && ash.getEndtime() != 0) { for(AttSchedule ash : attsch) {
boolean ectivedate = ClockInTool.hourMinuteBetween(new SimpleDateFormat("yyyy-MM-dd HH:mm").format(nowdate), new SimpleDateFormat("yyyy-MM-dd HH:mm").format(ash.getStarttime()), new SimpleDateFormat("yyyy-MM-dd HH:mm").format(ash.getEndtime()),"yyyy-MM-dd HH:mm"); if(attdate.getAttsch().size() == 2) {
if(ectivedate) { //有范围
ash.setIsdk(0); if(ash.getStarttime() != 0 && ash.getEndtime() != 0) {
boolean ectivedate = ClockInTool.hourMinuteBetween(new SimpleDateFormat("yyyy-MM-dd HH:mm").format(nowdate), new SimpleDateFormat("yyyy-MM-dd HH:mm").format(ash.getStarttime()), new SimpleDateFormat("yyyy-MM-dd HH:mm").format(ash.getEndtime()),"yyyy-MM-dd HH:mm");
if(ectivedate) {
bsz = 1;
ash.setIsdk(0);
}else {
bc++;
ash.setIsdk(1);
}
}else {
KqglAssoBcsz shif = KqglAssoBcsz.builder().build().selectOne(new QueryWrapper<KqglAssoBcsz>().lambda().eq(KqglAssoBcsz::getId, ash.getId()));
Timestamp b = Timestamp.valueOf(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));//
String xbdk1 = (str+" "+shif.getXbdk1()+":00").replaceAll("\r|\n", "");
Timestamp a = Timestamp.valueOf(xbdk1);
String sbdk1 = (str+" "+shif.getSbdk1()+":00").replaceAll("\r|\n", "");
Timestamp c = Timestamp.valueOf(sbdk1);
if(r == 1) {
if (b.after(a) && b.after(c)) {// 当前时间大于下班打卡时间
bc++;
ash.setIsdk(1);
}else {
bsz = 1;
}
}
if(r == 2) {
String stampToDate = ClockInTool.stampToDate(String.valueOf(endDate));
Timestamp d = Timestamp.valueOf(stampToDate);
// if (b.after(a) && b.after(c)) {
// ash.setIsdk(1);
// }
if(b.after(a) && b.before(d)) {
bsz = 1;
ash.setIsdk(0);
}
if(b.before(a) || b.after(c)) {
bc++;
ash.setIsdk(1);
}
}
r++;
}
}else { }else {
ash.setIsdk(1); boolean ectivedate = ClockInTool.hourMinuteBetween(new SimpleDateFormat("yyyy-MM-dd HH:mm").format(nowdate), new SimpleDateFormat("yyyy-MM-dd HH:mm").format(ash.getStarttime()), new SimpleDateFormat("yyyy-MM-dd HH:mm").format(ash.getEndtime()),"yyyy-MM-dd HH:mm");
} if(ectivedate) {
}else { bsz = 1;
KqglAssoBcsz shif = KqglAssoBcsz.builder().build().selectOne(new QueryWrapper<KqglAssoBcsz>().lambda().eq(KqglAssoBcsz::getId, ash.getId())); ash.setIsdk(0);
Timestamp b = Timestamp.valueOf(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));// }else {
bc++;
String xbdk1 = (str+" "+shif.getXbdk1()+":00").replaceAll("\r|\n", "");
Timestamp a = Timestamp.valueOf(xbdk1);
String sbdk1 = (str+" "+shif.getSbdk1()+":00").replaceAll("\r|\n", "");
Timestamp c = Timestamp.valueOf(sbdk1);
if(r == 1) {
if (b.after(a)) {// 当前时间大于下班打卡时间
ash.setIsdk(1);
}
}
if(r == 2) {
String stampToDate = ClockInTool.stampToDate(String.valueOf(endDate));
Timestamp d = Timestamp.valueOf(stampToDate);
if (b.after(a) && b.after(c)) {
ash.setIsdk(1); ash.setIsdk(1);
} }
if(b.after(a) && b.before(d)) { }
ash.setIsdk(0);
List<KqglAssoDkjl> dajllist_ = kqglassodkjlmapper.getDetailedRecordClock(startDate,endDate,userBean.getEmpNum());
KqglAssoDkjl dkjl = KqglAssoDkjl.builder().build();
for(KqglAssoDkjl daj : dajllist_) {
if(ash.getId() == daj.getBcid() && ash.getSort() == daj.getSort()) {//班次id和打卡顺序对应
BeanUtil.copyProperties(daj, dkjl,"attdate","bcid","remarks","userId","attime","dkmxid","commentary","punchequipment","punchmode");
if(bsz == 1) {
bc++;
ash.setIsdk(1);
}else {
ash.setIsdk(1);
}
} }
} }
r++; ash.setDajl(dkjl);
} }
}else {
boolean ectivedate = ClockInTool.hourMinuteBetween(new SimpleDateFormat("yyyy-MM-dd HH:mm").format(nowdate), new SimpleDateFormat("yyyy-MM-dd HH:mm").format(ash.getStarttime()), new SimpleDateFormat("yyyy-MM-dd HH:mm").format(ash.getEndtime()),"yyyy-MM-dd HH:mm");
if(ectivedate) {
ash.setIsdk(0);
}else {
ash.setIsdk(1);
}
}
//自由工时
if(attdate.getAttgrouptype() == 3) {
//全部为 1 时
if(bccs == bc) {
}else { KqglAssoDkjl dk = KqglAssoDkjl.builder().build().selectOne(new QueryWrapper<KqglAssoDkjl>().lambda().eq(KqglAssoDkjl::getQyid, userBean.getOrgCode())
List<KqglAssoDkjl> dajllist_ = kqglassodkjlmapper.getDetailedRecordClock(startDate,endDate,userBean.getEmpNum()); .eq(KqglAssoDkjl::getUserId, userBean.getEmpNum()).ge(KqglAssoDkjl::getDktime, startDate).le(KqglAssoDkjl::getDktime, endDate).orderByDesc(KqglAssoDkjl::getSort).last("LIMIT 1"));
KqglAssoDkjl dkjl = KqglAssoDkjl.builder().build(); if(dk != null && attdate.getAttsch().size() != dk.getSort()) {
for(KqglAssoDkjl daj : dajllist_) { AttSchedule att = attsch.get(dk.getSort());
if(ash.getId() == daj.getBcid() && ash.getSort() == daj.getSort()) {//班次id和打卡顺序对应 att.setIsdk(0);
BeanUtil.copyProperties(daj, dkjl,"attdate","bcid","remarks","userId","attime","dkmxid","commentary","punchequipment","punchmode");
ash.setIsdk(1);
} }
} }
ash.setDajl(dkjl);
} }
}else {
//自由工时
List<AttSchedule> attsch = new ArrayList<AttSchedule>();
List<KqglAssoDkjl> dajllist_ = kqglassodkjlmapper.getDetailedRecordClock(startDate,endDate,userBean.getEmpNum());
KqglAssoDkjl dkjl = KqglAssoDkjl.builder().build();
} }
//外勤 true:开 false:关 //外勤 true:开 false:关
if(attgro.getIsWq() == 1) { if(attgro.getIsWq() == 1) {
attdate.setFieldpersonnel(true); attdate.setFieldpersonnel(true);
...@@ -2280,80 +2313,83 @@ public class ClockInController { ...@@ -2280,80 +2313,83 @@ public class ClockInController {
double latetime_ = 0;//前天晚走时长(分钟) double latetime_ = 0;//前天晚走时长(分钟)
Long changed_time = 0l;//晚到后应打卡时间 Long changed_time = 0l;//晚到后应打卡时间
List<AttSchedule> ash = attdate.getAttsch(); if(attdate.getAttgrouptype() != 3) {
KqglAssoBcsz shif = KqglAssoBcsz.builder().build().selectOne(new QueryWrapper<KqglAssoBcsz>().lambda().eq(KqglAssoBcsz::getId, ash.get(0).getId())); List<AttSchedule> ash = attdate.getAttsch();
KqglAssoBcsz shif = KqglAssoBcsz.builder().build().selectOne(new QueryWrapper<KqglAssoBcsz>().lambda().eq(KqglAssoBcsz::getId, ash.get(0).getId()));
if(shif != null) {
int dkcs_ = shif.getSxbcs();//上下班打卡次数 if(shif != null) {
int iswzwd = shif.getIsWzwd();//是否开启晚走晚到(0:否;1:是) int dkcs_ = shif.getSxbcs();//上下班打卡次数
int iswzwd = shif.getIsWzwd();//是否开启晚走晚到(0:否;1:是)
//统一分钟数
double xbwz1 = 0,xbwz2=0,xbwz3=0;
int sbwd1=0,sbwd2=0,sbwd3=0;
int arrive_late = 0;//晚到时间
String clock_date = "";//应打卡时间
Long latetime = 0l;//前天晚走时长(分钟)
KqglAssoDkmx yesterdaymx = KqglAssoDkmx.builder().build();
AttendanceCardListDto attdateyesterday;
long yesendtime1=0,yesendtime2=0,yesendtime3=0;
//存在晚走玩到
if(iswzwd > 0) {
//统一分钟数 //统一分钟数
xbwz1 = Double.valueOf(shif.getXbwz1()) * 60;//下班晚走1 double xbwz1 = 0,xbwz2=0,xbwz3=0;
sbwd1 = Integer.valueOf(String.valueOf(Double.valueOf(shif.getSbwd1()) * 60));//上班晚到1 int sbwd1=0,sbwd2=0,sbwd3=0;
xbwz2 = Double.valueOf(shif.getXbwz2()) * 60;//下班晚走2
sbwd2 = Integer.valueOf(String.valueOf(Double.valueOf(shif.getSbwd2()) * 60));//上班晚到2 int arrive_late = 0;//晚到时间
xbwz3 = Double.valueOf(shif.getXbwz3()) * 60;//下班晚走3 String clock_date = "";//应打卡时间
sbwd3 = Integer.valueOf(String.valueOf(Double.valueOf(shif.getSbwd3()) * 60));//上班晚到3 Long latetime = 0l;//前天晚走时长(分钟)
//获取前一天最后下班的时间 KqglAssoDkmx yesterdaymx = KqglAssoDkmx.builder().build();
yesterdaymx = KqglAssoDkmx.builder().build().selectOne(new QueryWrapper<KqglAssoDkmx>().lambda().eq(KqglAssoDkmx::getUserid, userBean.getEmpNum()) AttendanceCardListDto attdateyesterday;
.ge(KqglAssoDkmx::getDksj, startDateyesterday).le(KqglAssoDkmx::getDksj, endDateyesterday)); long yesendtime1=0,yesendtime2=0,yesendtime3=0;
attdateyesterday = MethodCall(userBean.getOrgCode(),userBean.getEmpNum(),yesterday); //存在晚走玩到
if(iswzwd > 0) {
List<AttSchedule> ashyes = attdateyesterday.getAttsch(); //统一分钟数
if(attdateyesterday.getAttsch().size() == 2 || attdateyesterday.getAttsch().size() == 4 || attdateyesterday.getAttsch().size() == 6) { xbwz1 = Double.valueOf(shif.getXbwz1()) * 60;//下班晚走1
yesendtime1 = ashyes.get(1).getTime(); sbwd1 = Integer.valueOf(String.valueOf(Double.valueOf(shif.getSbwd1()) * 60));//上班晚到1
} xbwz2 = Double.valueOf(shif.getXbwz2()) * 60;//下班晚走2
if(attdateyesterday.getAttsch().size() == 4 || attdateyesterday.getAttsch().size() == 6) { sbwd2 = Integer.valueOf(String.valueOf(Double.valueOf(shif.getSbwd2()) * 60));//上班晚到2
yesendtime2 = ashyes.get(3).getTime(); xbwz3 = Double.valueOf(shif.getXbwz3()) * 60;//下班晚走3
} sbwd3 = Integer.valueOf(String.valueOf(Double.valueOf(shif.getSbwd3()) * 60));//上班晚到3
if(attdateyesterday.getAttsch().size() == 6) {
yesendtime3 = ashyes.get(5).getTime(); //获取前一天最后下班的时间
} yesterdaymx = KqglAssoDkmx.builder().build().selectOne(new QueryWrapper<KqglAssoDkmx>().lambda().eq(KqglAssoDkmx::getUserid, userBean.getEmpNum())
.ge(KqglAssoDkmx::getDksj, startDateyesterday).le(KqglAssoDkmx::getDksj, endDateyesterday));
if(dkcs_ == 1) { attdateyesterday = MethodCall(userBean.getOrgCode(),userBean.getEmpNum(),yesterday);
if(yesterdaymx.getXbdk1() != null && yesterdaymx.getXbdk1jg() == 0) {
latetime = (yesterdaymx.getXbdk1() - yesendtime1)/1000/60; List<AttSchedule> ashyes = attdateyesterday.getAttsch();
if(attdateyesterday.getAttsch().size() == 2 || attdateyesterday.getAttsch().size() == 4 || attdateyesterday.getAttsch().size() == 6) {
yesendtime1 = ashyes.get(1).getTime();
} }
}else if(dkcs_ == 2){ if(attdateyesterday.getAttsch().size() == 4 || attdateyesterday.getAttsch().size() == 6) {
if(yesterdaymx.getXbdk2() != null && yesterdaymx.getXbdk2jg() == 0) { yesendtime2 = ashyes.get(3).getTime();
latetime = (yesterdaymx.getXbdk2() - yesendtime2)/1000/60;
} }
}else { if(attdateyesterday.getAttsch().size() == 6) {
if(yesterdaymx.getXbdk3() != null && yesterdaymx.getXbdk3jg() == 0) { yesendtime3 = ashyes.get(5).getTime();
latetime = (yesterdaymx.getXbdk3() - yesendtime3)/1000/60; }
if(dkcs_ == 1) {
if(yesterdaymx.getXbdk1() != null && yesterdaymx.getXbdk1jg() == 0) {
latetime = (yesterdaymx.getXbdk1() - yesendtime1)/1000/60;
}
}else if(dkcs_ == 2){
if(yesterdaymx.getXbdk2() != null && yesterdaymx.getXbdk2jg() == 0) {
latetime = (yesterdaymx.getXbdk2() - yesendtime2)/1000/60;
}
}else {
if(yesterdaymx.getXbdk3() != null && yesterdaymx.getXbdk3jg() == 0) {
latetime = (yesterdaymx.getXbdk3() - yesendtime3)/1000/60;
}
} }
} if(latetime != 0) {
if(latetime != 0) { latetime_ = Double.valueOf(String.valueOf(latetime));//前天晚走时长(分钟)
latetime_ = Double.valueOf(String.valueOf(latetime));//前天晚走时长(分钟) if(latetime_ > xbwz1 && latetime_ < xbwz2) {
if(latetime_ > xbwz1 && latetime_ < xbwz2) { arrive_late = sbwd1;
arrive_late = sbwd1; }else if(latetime_ > xbwz2 && latetime_ < xbwz3) {
}else if(latetime_ > xbwz2 && latetime_ < xbwz3) { arrive_late = sbwd2;
arrive_late = sbwd2; }else if(latetime_ > xbwz3) {
}else if(latetime_ > xbwz3) { arrive_late = sbwd3;
arrive_late = sbwd3; }
//ash.get(0).getTime():当天第一次应打卡时间
clock_date = ClockInTool.stampToDate(String.valueOf(ash.get(0).getTime()));
changed_time = Long.valueOf(ClockInTool.dateToStamp(ClockInTool.addtime(clock_date, "+"+arrive_late)));//晚到后应打卡时间
} }
//ash.get(0).getTime():当天第一次应打卡时间
clock_date = ClockInTool.stampToDate(String.valueOf(ash.get(0).getTime()));
changed_time = Long.valueOf(ClockInTool.dateToStamp(ClockInTool.addtime(clock_date, "+"+arrive_late)));//晚到后应打卡时间
} }
} attdate.setLatetime(latetime_);
attdate.setLatetime(latetime_); attdate.setChanged_time(changed_time);
attdate.setChanged_time(changed_time); }
} }
return ResultUtil.data(attdate); return ResultUtil.data(attdate);
}else { }else {
......
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