zxz 2 lat temu
rodzic
commit
30364cc2f8

+ 12 - 0
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/entity/ClockInfo.java

@@ -97,6 +97,18 @@ public class ClockInfo extends BaseModel<ClockInfo> {
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
     @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
     private Date offClockDate;
+    /**
+     * 打卡日期
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    @DateTimeFormat(pattern = "yyyy-MM-dd")
+    private Date clockDay;
+    /**
+     * 补卡日期
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    @DateTimeFormat(pattern = "yyyy-MM-dd")
+    private Date suppDay;
     /**
      * 请假类型
      */

+ 1 - 0
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/impl/ClockInfoServiceImpl.java

@@ -238,6 +238,7 @@ public class ClockInfoServiceImpl extends ServiceImpl<ClockInfoMapper, ClockInfo
         if (clockInfo != null) {
             clockInfo.setSupplementClockType(clockInfo1.getSupplementClockType());
             clockInfo.setReasonForApplication(clockInfo1.getReasonForApplication());
+            clockInfo.setSuppDay(clockInfo1.getSuppDay());
             this.updateById(clockInfo);
 
             boolean isStartWorkflow = StringUtils.isBlank(clockInfo.getWorkflowId());

+ 57 - 16
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/impl/LeaveInfoServiceImpl.java

@@ -22,6 +22,7 @@ import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.CollectionUtils;
 
+import java.math.BigDecimal;
 import java.text.SimpleDateFormat;
 import java.util.*;
 
@@ -56,12 +57,12 @@ public class LeaveInfoServiceImpl extends ServiceImpl<LeaveInfoMapper, LeaveInfo
         Calendar a = Calendar.getInstance();
         a.setTime(new Date());
         a.add(Calendar.YEAR, 0);
-        Date x = a.getTime();
-        String timeOfDay = now.format(x);
-        String ClockId = IdGenerator.generateUUID();
+//        Date x = a.getTime();
+//        String timeOfDay = now.format(x);
+//        String ClockId = IdGenerator.generateUUID();
         //新增主键id
         leaveInfo.setId(IdGenerator.generateUUID());
-        leaveInfo.setClockId(ClockId);
+//        leaveInfo.setClockId(ClockId);
 
         //获取当前年月日
         SimpleDateFormat f = new SimpleDateFormat("yyyyMMdd");//设置日期格式
@@ -114,29 +115,69 @@ public class LeaveInfoServiceImpl extends ServiceImpl<LeaveInfoMapper, LeaveInfo
             leaveInfoService.updateById(leaveInfo);
             workflowService.activateInstance(leaveInfo.getWorkflowId(), leaveInfo.getId());
         }
+        //设置日期格式
+        SimpleDateFormat start = new SimpleDateFormat("yyyyMMdd");
+        Calendar s = Calendar.getInstance();
+        s.setTime(leaveInfo.getStartDate());
+        s.add(Calendar.YEAR, 0);
+        Date y = s.getTime();
+        String startTime = start.format(y);
+        BigDecimal startNum = new BigDecimal(startTime);
+        //设置日期格式
+        SimpleDateFormat end = new SimpleDateFormat("yyyyMMdd");
+        Calendar e = Calendar.getInstance();
+        e.setTime(leaveInfo.getEndDate());
+        e.add(Calendar.YEAR, 0);
+        Date z = e.getTime();
+        String endTime = end.format(z);
+        BigDecimal endNum = new BigDecimal(endTime);
         //查询打卡信息
         ClockInfo clockInfo1 = clockInfoService.selectOne(new EntityWrapper<ClockInfo>()
                 .eq("comp_id", leaveInfo.getCompId())
                 .eq("common_id", leaveInfo.getCommonId())
                 .eq("delete_flag", "0")
-                .gt("create_date", timeOfDay));
+                .eq("clock_day", startTime));
         if (clockInfo1 != null) {
             clockInfo1.setLeaveId(leaveInfo.getId());
             clockInfo1.setLeaveType(leaveInfo.getLeaveType());
             //修改数据
             clockInfoService.updateById(clockInfo1);
+            int duration = (Integer.parseInt(leaveInfo.getLeaveDuration()) - 4) / 8;
+            for (int num = 0; num < duration; num++) {
+                //新增打卡信息
+                ClockInfo clockInfo = new ClockInfo();
+                clockInfo.setId(IdGenerator.generateUUID());
+                clockInfo.setLeaveId(leaveInfo.getId());
+                clockInfo.setCommonId(leaveInfo.getCommonId());
+                clockInfo.setCompId(leaveInfo.getCompId());
+                clockInfo.setDept(leaveInfo.getDept());
+                clockInfo.setEmpName(leaveInfo.getEmpName());
+                clockInfo.setPhone(leaveInfo.getPhone());
+                clockInfo.setLeaveType(leaveInfo.getLeaveType());
+                a.add(Calendar.DATE, +(num + 1));
+                Date clockDate = a.getTime();
+                clockInfo.setClockDay(clockDate);
+                clockInfoService.insert(clockInfo);
+            }
         } else {
-            //新增打卡信息
-            ClockInfo clockInfo = new ClockInfo();
-            clockInfo.setId(ClockId);
-            clockInfo.setLeaveId(leaveInfo.getId());
-            clockInfo.setCommonId(leaveInfo.getCommonId());
-            clockInfo.setCompId(leaveInfo.getCompId());
-            clockInfo.setDept(leaveInfo.getDept());
-            clockInfo.setEmpName(leaveInfo.getEmpName());
-            clockInfo.setPhone(leaveInfo.getPhone());
-            clockInfo.setLeaveType(leaveInfo.getLeaveType());
-            clockInfoService.insert(clockInfo);
+            BigDecimal result = endNum.subtract(startNum);
+            int b = result.intValue();
+            for (int i = 0; i < b; i++) {
+                //新增打卡信息
+                ClockInfo clockInfo = new ClockInfo();
+                clockInfo.setId(IdGenerator.generateUUID());
+                clockInfo.setLeaveId(leaveInfo.getId());
+                clockInfo.setCommonId(leaveInfo.getCommonId());
+                clockInfo.setCompId(leaveInfo.getCompId());
+                clockInfo.setDept(leaveInfo.getDept());
+                clockInfo.setEmpName(leaveInfo.getEmpName());
+                clockInfo.setPhone(leaveInfo.getPhone());
+                clockInfo.setLeaveType(leaveInfo.getLeaveType());
+                a.add(Calendar.DATE, +i);
+                Date clockDate = a.getTime();
+                clockInfo.setClockDay(clockDate);
+                clockInfoService.insert(clockInfo);
+            }
         }
         return "OK";