Bladeren bron

add:考勤打卡

caozixuan 1 jaar geleden
bovenliggende
commit
4bf093c2a5

+ 11 - 0
sop-business/src/main/java/com/qmth/sop/business/bean/result/DingElementResult.java

@@ -44,6 +44,9 @@ public class DingElementResult {
     @ApiModelProperty(value = "是否开启人脸,0:不开启,1:开启")
     private Boolean faceOpen;
 
+    @ApiModelProperty("允许补卡次数")
+    private Integer reissueCardCount;
+
     public Long getUserArchivesId() {
         return userArchivesId;
     }
@@ -131,4 +134,12 @@ public class DingElementResult {
     public void setFaceOpen(Boolean faceOpen) {
         this.faceOpen = faceOpen;
     }
+
+    public Integer getReissueCardCount() {
+        return reissueCardCount;
+    }
+
+    public void setReissueCardCount(Integer reissueCardCount) {
+        this.reissueCardCount = reissueCardCount;
+    }
 }

+ 11 - 0
sop-business/src/main/java/com/qmth/sop/business/bean/result/DingStatisticResult.java

@@ -19,6 +19,9 @@ public class DingStatisticResult {
     @ApiModelProperty(value = "异常共计")
     private Integer exceptionCount;
 
+    @ApiModelProperty(value = "剩余补卡次数")
+    private Integer remainCont;
+
     @ApiModelProperty(value = "打卡表单")
     private List<DingFormResult> dingFormList;
 
@@ -46,6 +49,14 @@ public class DingStatisticResult {
         this.exceptionCount = exceptionCount;
     }
 
+    public Integer getRemainCont() {
+        return remainCont;
+    }
+
+    public void setRemainCont(Integer remainCont) {
+        this.remainCont = remainCont;
+    }
+
     public List<DingFormResult> getDingFormList() {
         return dingFormList;
     }

+ 13 - 2
sop-business/src/main/java/com/qmth/sop/business/mapper/TBDingMapper.java

@@ -44,10 +44,11 @@ public interface TBDingMapper extends BaseMapper<TBDing> {
     /**
      * 根据用户id查询打卡信息
      *
-     * @param userId 用户id
+     * @param userId        用户id
+     * @param serviceUnitId 服务单元id
      * @return 打卡信息
      */
-    DingElementResult findDingResultByUserId(@Param("userId") Long userId);
+    DingElementResult findDingResultByUserId(@Param("userId") Long userId, @Param("serviceUnitId") Long serviceUnitId);
 
     /**
      * 根据sopNo查询sop的状态和日期
@@ -56,4 +57,14 @@ public interface TBDingMapper extends BaseMapper<TBDing> {
      * @return 状态 开始时间 更新时间
      */
     List<TFFlowApprove> findDateAndStatusBySopNo(@Param("sopNo") String sopNo);
+
+    /**
+     * 查询打卡异常提交次数
+     *
+     * @param userId 用户id
+     * @param sopNo  sopNo
+     * @return 暂用的打卡次数
+     */
+    int findDingExceptionApplyCount(@Param("userId") Long userId,
+                                    @Param("sopNo") String sopNo);
 }

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

@@ -82,7 +82,7 @@ public interface TBDingSubmitService extends IService<TBDingSubmit> {
     void cancelWithdraw(DingSubmitParam dingSubmitParam);
 
     /**
-     * 查询靠近提交导出集合
+     * 查询考勤提交导出集合
      *
      * @param serviceUnitId        服务单元id
      * @param dingSubmitStatusDesc 考勤提交状态

+ 10 - 4
sop-business/src/main/java/com/qmth/sop/business/service/impl/TBDingServiceImpl.java

@@ -2,7 +2,6 @@ package com.qmth.sop.business.service.impl;
 
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.qmth.sop.business.bean.dto.DateFormDto;
 import com.qmth.sop.business.bean.dto.SopCrmInfo;
@@ -53,7 +52,10 @@ public class TBDingServiceImpl extends ServiceImpl<TBDingMapper, TBDing> impleme
 
     @Override
     public DingElementResult findDingElements(String sopNo, Long userId) {
-        DingElementResult dingElementResult = this.baseMapper.findDingResultByUserId(userId);
+        SopCrmInfo sopCrmInfo = tbCrmService.findSopCrmInfoBySop(sopNo);
+        Long serviceUnitId = sopCrmInfo.getServiceUnitId();
+
+        DingElementResult dingElementResult = this.baseMapper.findDingResultByUserId(userId, serviceUnitId);
         if (Objects.nonNull(dingElementResult)) {
             Long userArchivesId = dingElementResult.getUserArchivesId();
             String currentDayStr = DateFormatUtils.format(System.currentTimeMillis(), SystemConstant.DEFAULT_DATE_DAY_PATTERN);
@@ -87,7 +89,6 @@ public class TBDingServiceImpl extends ServiceImpl<TBDingMapper, TBDing> impleme
     public DingStatisticResult findDingStatistic(String sopNo, Long userId) {
         // 根据sopNo查询日期表单
         DateFormDto dateFormDto = this.buildSignDateFormBySop(sopNo);
-
         List<String> dateFormList = dateFormDto.getDateFormList();
 
         int workCount = 0;
@@ -197,12 +198,17 @@ public class TBDingServiceImpl extends ServiceImpl<TBDingMapper, TBDing> impleme
                 formList.add(dingFormResult);
             }
         }
-
+        SopCrmInfo sopCrmInfo = tbCrmService.findSopCrmInfoBySop(sopNo);
+        Long serviceUnitId = sopCrmInfo.getServiceUnitId();
+        DingElementResult dingElementResult = this.baseMapper.findDingResultByUserId(userId, serviceUnitId);
+        Integer reissueCardCount = dingElementResult.getReissueCardCount();
+        int applyCount = this.baseMapper.findDingExceptionApplyCount(userId, sopNo);
 
         DingStatisticResult dingStatisticResult = new DingStatisticResult();
         dingStatisticResult.setDingFormList(formList);
         dingStatisticResult.setWorkDays(workCount);
         dingStatisticResult.setExceptionCount(exceptionCount);
+        dingStatisticResult.setRemainCont(reissueCardCount - applyCount);
         return dingStatisticResult;
     }
 

+ 22 - 1
sop-business/src/main/resources/mapper/TBDingMapper.xml

@@ -260,7 +260,8 @@
             tbua.name AS userArchivesName,
             tbua.base_photo_path AS basePhotoPath,
             sdg.sign_in_time AS signInTimeScope,
-            sdg.sign_out_time AS signOutTimeScope
+            sdg.sign_out_time AS signOutTimeScope,
+            sdg.reissue_card_count AS reissueCardCount
             sdg.face_open AS faceOpen
         FROM
             t_b_user_archives tbua
@@ -276,6 +277,9 @@
             <if test="userId != null">
                 AND su.id = #{userId}
             </if>
+            <if test="serviceUnitId != null">
+                AND sdg.service_id = #{serviceUnitId}
+            </if>
         </where>
     </select>
     <select id="findDateAndStatusBySopNo" resultType="com.qmth.sop.business.entity.TFFlowApprove">
@@ -293,4 +297,21 @@
             </if>
         </where>
     </select>
+    <select id="findDingExceptionApplyCount" resultType="java.lang.Integer">
+        SELECT
+            COUNT(*)
+        FROM
+            t_b_ding_apply tbda
+                LEFT JOIN
+            t_b_ding tbd ON tbda.ding_id = tbd.id
+        <where>
+            AND (tbda.approve IS NULL OR tbda.approve = 'NO_PASS')
+            <if test="userId != null">
+                AND tbd.user_id = #{userId}
+            </if>
+            <if test="sopNo != null and sopNo != ''">
+                AND tbd.sop_no = #{sopNo}
+            </if>
+        </where>
+    </select>
 </mapper>