|
|
@@ -11,6 +11,7 @@ import javax.validation.Validator;
|
|
|
import com.ruoyi.common.core.domain.AjaxResult;
|
|
|
import com.ruoyi.common.core.domain.entity.SysDept;
|
|
|
import com.ruoyi.common.enums.UserRolesType;
|
|
|
+import com.ruoyi.common.utils.DateUtils;
|
|
|
import com.ruoyi.common.utils.bean.BeanUtils;
|
|
|
import com.ruoyi.project.bo.ProjectStaffRecordInput;
|
|
|
import com.ruoyi.project.bo.ProjectStaffRecordOut;
|
|
|
@@ -85,7 +86,7 @@ public class SysUserServiceImpl implements ISysUserService
|
|
|
@Autowired
|
|
|
private UserRecordMapper userRecordMapper;
|
|
|
@Autowired
|
|
|
- private ProjectStaffRecordService projectStaffRecordService;
|
|
|
+ private LegalHolidaysMapper legalHolidaysMapper;
|
|
|
|
|
|
|
|
|
/**
|
|
|
@@ -735,7 +736,7 @@ public class SysUserServiceImpl implements ISysUserService
|
|
|
year = date.getYear();
|
|
|
}else if (i==2){
|
|
|
hand=maps.get(2);
|
|
|
- }else {
|
|
|
+ }else if (i>2){
|
|
|
Map<Integer, String> map = maps.get(i);
|
|
|
UserClockDtails userClockDtails=new UserClockDtails();
|
|
|
//每一条是一个人的当月打卡
|
|
|
@@ -750,37 +751,41 @@ public class SysUserServiceImpl implements ISysUserService
|
|
|
//前5为基本信息,后面则是打卡信息
|
|
|
else {
|
|
|
UserClockDtails newUserlock=new UserClockDtails(userClockDtails);
|
|
|
- if(StringUtils.isNotEmpty(s)){
|
|
|
- String[] split = s.split("\n");
|
|
|
- if (split.length==1){
|
|
|
- newUserlock.setStauts(1);
|
|
|
- }
|
|
|
- String regex = "\\d+";
|
|
|
- if (hand.get(j).matches(regex)){
|
|
|
- days=Integer.parseInt(hand.get(j));
|
|
|
- }else {
|
|
|
- days++;
|
|
|
- }
|
|
|
-
|
|
|
- newUserlock.setClockDate(s);
|
|
|
- newUserlock.setClockTime(LocalDate.of(year,month,days));
|
|
|
- int startHour = Integer.parseInt(getTime(split[0].split(":")[0]));
|
|
|
- int startMinute = Integer.parseInt(getTime(split[0].split(":")[1]));
|
|
|
- LocalDateTime startTime=LocalDateTime.of(year,month,days,startHour,startMinute);
|
|
|
- newUserlock.setStartTime(startTime);
|
|
|
- if (newUserlock.getStauts()==0){
|
|
|
- int endHour = Integer.parseInt(getTime(split[split.length - 1].split(":")[0]));
|
|
|
- int endMinute = Integer.parseInt(getTime(split[split.length - 1].split(":")[1]));
|
|
|
- LocalDateTime endTime=LocalDateTime.of(year,month,days,endHour,endMinute);
|
|
|
- newUserlock.setEndTime(endTime);
|
|
|
- Double hours = getHuors(startTime, endTime);
|
|
|
-
|
|
|
- newUserlock.setDuration(hours);
|
|
|
- }else {
|
|
|
- newUserlock.setDuration(0.0);
|
|
|
- }
|
|
|
- list.add(newUserlock);
|
|
|
- }
|
|
|
+ String regex = "\\d+";
|
|
|
+ String daystr=hand.get(j);
|
|
|
+ if (daystr != null){
|
|
|
+ if (daystr.matches(regex)){
|
|
|
+ days=Integer.parseInt(hand.get(j));
|
|
|
+ }else {
|
|
|
+ days++;
|
|
|
+ }
|
|
|
+ newUserlock.setClockTime(LocalDate.of(year,month,days));
|
|
|
+ //false不用上班 true需要上班
|
|
|
+ boolean flag=pushLeaglHolidays(newUserlock.getClockTime());
|
|
|
+ if (flag || StringUtils.isNotEmpty(s)){
|
|
|
+ String[] split = s.split("\n");
|
|
|
+ if (split.length==1){
|
|
|
+ newUserlock.setStauts(1);
|
|
|
+ }
|
|
|
+ newUserlock.setClockDate(s);
|
|
|
+ if (StringUtils.isNotBlank(split[0])){
|
|
|
+ int startHour = Integer.parseInt(getTime(split[0].split(":")[0]));
|
|
|
+ int startMinute = Integer.parseInt(getTime(split[0].split(":")[1]));
|
|
|
+ LocalDateTime startTime=LocalDateTime.of(year,month,days,startHour,startMinute);
|
|
|
+ newUserlock.setStartTime(startTime);
|
|
|
+ String s1 = split[split.length - 1];
|
|
|
+ if (StringUtils.isNotBlank(s1)&&newUserlock.getStauts()==0){
|
|
|
+ int endHour = Integer.parseInt(getTime(split[split.length - 1].split(":")[0]));
|
|
|
+ int endMinute = Integer.parseInt(getTime(split[split.length - 1].split(":")[1]));
|
|
|
+ LocalDateTime endTime=LocalDateTime.of(year,month,days,endHour,endMinute);
|
|
|
+ newUserlock.setEndTime(endTime);
|
|
|
+ Double hours = getHuors(startTime, endTime);
|
|
|
+ newUserlock.setDuration(hours);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ list.add(newUserlock);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -797,12 +802,20 @@ public class SysUserServiceImpl implements ISysUserService
|
|
|
ur.setCheckDuration(e.getDuration());
|
|
|
ur.setSumDuration(e.getDuration());
|
|
|
ur.setContent(e.getClockDate());
|
|
|
- ur.setStartTime(Date.from(e.getStartTime().atZone(ZoneId.systemDefault()).toInstant()));
|
|
|
+ if (e.getStartTime() !=null){
|
|
|
+ ur.setStartTime(Date.from(e.getStartTime().atZone(ZoneId.systemDefault()).toInstant()));
|
|
|
+ }
|
|
|
if (e.getEndTime() != null){
|
|
|
ur.setEndTime(Date.from(e.getEndTime().atZone(ZoneId.systemDefault()).toInstant()));
|
|
|
- ur.setStatus(0);
|
|
|
- }else {
|
|
|
+
|
|
|
+ }
|
|
|
+ if (e.getStartTime()==null||e.getEndTime() == null){
|
|
|
ur.setStatus(1);
|
|
|
+ ur.setDuration(0.0);
|
|
|
+ ur.setSumDuration(0.0);
|
|
|
+ ur.setCheckDuration(0.0);
|
|
|
+ }else{
|
|
|
+ ur.setStatus(0);
|
|
|
}
|
|
|
ur.setRecordTime(Date.from(e.getClockTime().atStartOfDay().atZone(ZoneId.systemDefault()).toInstant()));
|
|
|
if (projectStaffRecords.isEmpty()){
|
|
|
@@ -824,6 +837,26 @@ public class SysUserServiceImpl implements ISysUserService
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ private boolean pushLeaglHolidays(LocalDate clockTime) {
|
|
|
+ boolean flag = true;
|
|
|
+ String format = clockTime.format(DateTimeFormatter.ISO_DATE);
|
|
|
+ int weeks = DateUtils.getWeeks(format);
|
|
|
+ if (weeks==6||weeks==0) flag=false;
|
|
|
+ Instant instant = clockTime.atStartOfDay().toInstant(ZoneOffset.of("+8"));
|
|
|
+ long epochMilli = instant.toEpochMilli();
|
|
|
+ List<LegalHolidays> legalHolidays = legalHolidaysMapper.selectAll();
|
|
|
+ for (LegalHolidays e : legalHolidays) {
|
|
|
+ if (e.getHolidays().getTime()==epochMilli){
|
|
|
+ if(e.getStatus()==1){
|
|
|
+ flag=false;
|
|
|
+ } else if (e.getStatus() == 2) {
|
|
|
+ flag=true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return flag;
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public List<UserRecordOut> selectUserClock(selectUserClockInput in) {
|
|
|
in.setUserId(SecurityUtils.getUserId());
|