Browse Source

代码修改

wangliang 1 năm trước cách đây
mục cha
commit
8e9dbfd05c

+ 19 - 0
sop-business/src/main/java/com/qmth/sop/business/service/impl/TBDingApplyServiceImpl.java

@@ -18,6 +18,7 @@ import com.qmth.sop.business.service.*;
 import com.qmth.sop.common.contant.SpringContextHolder;
 import com.qmth.sop.common.contant.SystemConstant;
 import com.qmth.sop.common.enums.*;
+import com.qmth.sop.common.util.DateDisposeUtils;
 import com.qmth.sop.common.util.GsonUtil;
 import com.qmth.sop.common.util.ServletUtil;
 import org.activiti.engine.TaskService;
@@ -89,6 +90,12 @@ public class TBDingApplyServiceImpl extends ServiceImpl<TBDingApplyMapper, TBDin
     @Resource
     TBDingStatisticService tbDingStatisticService;
 
+    @Resource
+    TBDingSubmitService tbDingSubmitService;
+
+    @Resource
+    SysDingDateService sysDingDateService;
+
     /**
      * 新增考勤异常补卡申请
      *
@@ -138,6 +145,10 @@ public class TBDingApplyServiceImpl extends ServiceImpl<TBDingApplyMapper, TBDin
         tbDingApply.setCode(tfCustomFlowEntity.getCode(), tbDingApply.getAttachmentIdList(), sysUser.getId());
         tfCustomFlowEntity.setObjId(tbDingApply.getId());
         tfCustomFlowEntityService.updateById(tfCustomFlowEntity);
+
+        if (!tbDingSubmitService.canUpdateDingSetting(sopNo, sysUser.getId())) {
+            throw ExceptionResultEnum.ERROR.exception("考勤已提交,不能申请补卡");
+        }
         TBUserArchives tbUserArchives = tbUserArchivesService.findByUserId(sysUser.getId());
         tbDingStatisticService.buildDingStatistic(sopNo, tbUserArchives.getId());
         return tbDingApplyService.save(tbDingApply);
@@ -328,6 +339,11 @@ public class TBDingApplyServiceImpl extends ServiceImpl<TBDingApplyMapper, TBDin
                     tbDing.setSignOutTime(tbDingApply.getApplyTime());
                     tbDing.setSignOutAddress("(补卡)");
                 }
+                if (Objects.isNull(tbDing.getDateType())) {
+                    DingDateTypeEnum dateType = sysDingDateService.getDingDateType(
+                            DateDisposeUtils.timestampToLocalDate(tbDingApply.getApplyTime()));
+                    tbDing.setDateType(dateType);
+                }
                 tbDingService.updateById(tbDing);
             } else {
                 TBCrm tbCrm = tbCrmService.getOne(
@@ -364,6 +380,9 @@ public class TBDingApplyServiceImpl extends ServiceImpl<TBDingApplyMapper, TBDin
                     tbDing.setSignOutTime(tbDingApply.getApplyTime());
                     tbDing.setSignOutAddress("(补卡)");
                 }
+                DingDateTypeEnum dateType = sysDingDateService.getDingDateType(
+                        DateDisposeUtils.timestampToLocalDate(tbDingApply.getApplyTime()));
+                tbDing.setDateType(dateType);
                 tbDingService.save(tbDing);
                 tbDingApply.setDingId(tbDing.getId());
             }

+ 7 - 3
sop-business/src/main/java/com/qmth/sop/business/service/impl/TBSopInfoServiceImpl.java

@@ -114,6 +114,9 @@ public class TBSopInfoServiceImpl extends ServiceImpl<TBSopInfoMapper, TBSopInfo
     @Resource
     TBDingService tbDingService;
 
+    @Resource
+    TBDingSubmitService tbDingSubmitService;
+
     /**
      * 查询动态sop表名是否存在
      *
@@ -1162,7 +1165,6 @@ public class TBSopInfoServiceImpl extends ServiceImpl<TBSopInfoMapper, TBSopInfo
         Optional.ofNullable(tbSopInfo).orElseThrow(() -> ExceptionResultEnum.SOP_INFO_NO_DATA.exception());
 
         TFCustomFlowEntity tfCustomFlowEntity = tfCustomFlowEntityService.findByCode(tbSopInfo.getSopNo());
-
         String oldFlowProcessVar = tfCustomFlowEntity.getFlowProcessVar();
         TFFlowApprove tfFlowApprove = tfFlowApproveService.findByFlowId(tfCustomFlowEntity.getFlowId());
         TFCustomFlow tfCustomFlow = tfCustomFlowService.findById(tfCustomFlowEntity.gettFCustomFlowId());
@@ -1295,9 +1297,11 @@ public class TBSopInfoServiceImpl extends ServiceImpl<TBSopInfoMapper, TBSopInfo
                             new UserArchivesAllocationParam(allocationParams, tbCrmDetail.getId()));
                 }
             }
-            tbDingService.resetDingExceptionBySopNo(tbSopInfo.getSopNo());
         }
-
+        if (!tbDingSubmitService.canUpdateDingSetting(tbSopInfo.getSopNo())) {
+            throw ExceptionResultEnum.ERROR.exception("考勤已提交,不能修改时间");
+        }
+        tbDingService.resetDingExceptionBySopNo(tbSopInfo.getSopNo());
         tbCrmDetailService.updateById(tbCrmDetail);
         return tfCustomFlowEntityService.updateById(tfCustomFlowEntity);
     }