Ver Fonte

fix:补充算个人的考勤统计

caozixuan há 1 ano atrás
pai
commit
96d4268fdd

+ 9 - 1
sop-business/src/main/java/com/qmth/sop/business/service/TBDingStatisticService.java

@@ -25,6 +25,14 @@ public interface TBDingStatisticService extends IService<TBDingStatistic> {
      */
     TBDingStatistic findBySopNoAndUserArchivesId(String sopNo, Long userArchivesId);
 
+    /**
+     * 构建考勤统计 (sop计划时间变更 -> 更新打卡统计时间)
+     *
+     * @param sopNo          sopNo
+     * @param userArchivesId 用户档案id
+     */
+    void buildDingStatistic(String sopNo, Long userArchivesId);
+
     /**
      * 构建考勤统计 (sop计划时间变更 -> 更新打卡统计时间)
      *
@@ -45,4 +53,4 @@ public interface TBDingStatisticService extends IService<TBDingStatistic> {
      * @param requestUserId 创建人
      */
     void buildDingStatisticBySop(String sopNo, List<TBDing> datasource, Long requestUserId);
-}
+}|

+ 17 - 0
sop-business/src/main/java/com/qmth/sop/business/service/impl/TBDingStatisticServiceImpl.java

@@ -64,6 +64,23 @@ public class TBDingStatisticServiceImpl extends ServiceImpl<TBDingStatisticMappe
         return this.getOne(new QueryWrapper<TBDingStatistic>().lambda().eq(TBDingStatistic::getSopNo, sopNo).eq(TBDingStatistic::getUserArchivesId, userArchivesId).last(SystemConstant.LIMIT1));
     }
 
+    @Override
+    public void buildDingStatistic(String sopNo, Long userArchivesId) {
+        Long currentEarliestTime = DateDisposeUtils.getEarliestTime(System.currentTimeMillis());
+        List<TBDing> datasource = tbDingService.list(new QueryWrapper<TBDing>().lambda().eq(TBDing::getSopNo, sopNo).eq(TBDing::getUserArchivesId, userArchivesId)).stream().filter(e -> {
+            if (Objects.nonNull(e.getSignInTime()) && Objects.nonNull(e.getSignOutTime())) {
+                return e.getSignInTime() < currentEarliestTime && e.getSignOutTime() < currentEarliestTime;
+            } else if (Objects.isNull(e.getSignInTime())) {
+                return e.getSignOutTime() < currentEarliestTime;
+            } else if (Objects.isNull(e.getSignOutTime())) {
+                return e.getSignInTime() < currentEarliestTime;
+            } else {
+                return true;
+            }
+        }).collect(Collectors.toList());
+        this.buildDingStatisticBySop(sopNo, datasource, -1L);
+    }
+
     @Transactional
     @Override
     public void buildDingStatistic(String sopNo) {

+ 3 - 0
sop-business/src/main/resources/mapper/TBDingSubmitMapper.xml

@@ -179,6 +179,9 @@
             <if test="submitUserId != null">
                 AND tbds.submit_user_id = #{serviceUnitId}
             </if>
+            <if test="archivesId != null">
+                AND sta.user_archives_id = #{archivesId}
+            </if>
             <if test="archivesName != null and archivesName != ''">
                 AND sta.user_archives_name LIKE CONCAT('%',#{archivesName},'%')
             </if>