Browse Source

打卡判定当前时间设置

anderx 1 year ago
parent
commit
0df466f522

+ 6 - 3
ruoyi-system/src/main/java/com/ruoyi/project/service/impl/ProjectStaffRecordServiceImpl.java

@@ -327,11 +327,14 @@ public class ProjectStaffRecordServiceImpl implements ProjectStaffRecordService
     public AjaxResult checkRecordTime(AjaxResult ajaxResult, ProjectStaffRecord in) {
         if (!ajaxResult.isError()){
             ProjectTask projectTask = projectTaskMapper.selectByPrimaryKey(in.getPid());
-            long endTime = DateUtils.getNowDate().getTime();
+            long nowTime = DateUtils.getNowDate().getTime();
             long startTime = projectTask.getStartTime().getTime();
-            if (endTime>projectTask.getEndTime().getTime())endTime=projectTask.getEndTime().getTime();
+            long endTime = projectTask.getEndTime().getTime();
+
             if (in.getRecordTime().getTime()<startTime){
                 ajaxResult=AjaxResult.error(String.format("项目研发时间未开始[%s],不可打卡",DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD,projectTask.getStartTime())));
+            }else if (in.getRecordTime().getTime()>nowTime){
+                ajaxResult=AjaxResult.error("未到打卡时间,不可打卡");
             }else if (in.getRecordTime().getTime()>endTime){
                 ajaxResult=AjaxResult.error(String.format("项目研发时间已结束[%s],不可打卡",DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD,projectTask.getEndTime())));
             }
@@ -539,7 +542,7 @@ public class ProjectStaffRecordServiceImpl implements ProjectStaffRecordService
         ProjectStaffRecord use = projectStaffRecordMapper.selectByPrimaryKey(id);
         if (processStatus==2||processStatus==3){
             if (use.getProcessStatus()!=1){
-                return AjaxResult.error("项目打卡无需审核!");
+                return AjaxResult.error("提示:包含已审核内容,请勿重复审核!");
             }
             if(processStatus==2){
                 sysUserMapper.userAddDuration(use.getAid(),use.getDuration());