zxz 3 gadi atpakaļ
vecāks
revīzija
4215ee8f5c

+ 10 - 0
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/controller/ClockInfoController.java

@@ -41,6 +41,16 @@ public class ClockInfoController {
     public Page<ClockInfo> selectClockInfo(ClockInfo clockInfo) {
         return clockInfoService.selectClockInfo(clockInfo);
     }
+    /**
+     * 考勤记录查询(PC)
+     *
+     * @param clockInfo
+     * @return
+     */
+    @GetMapping("/selectClockInfoPc")
+    public Page<ClockInfo> selectClockInfoPc(ClockInfo clockInfo) {
+        return clockInfoService.selectClockInfoPc(clockInfo);
+    }
     /**
      * 添加补卡信息
      * @param clockInfo

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

@@ -2,6 +2,7 @@ package com.yh.saas.plugin.yiliangyiyun.entity;
 
 import java.util.Date;
 import java.io.Serializable;
+import java.util.List;
 
 
 import com.baomidou.mybatisplus.annotations.TableField;
@@ -125,6 +126,11 @@ public class ClockInfo extends BaseModel<ClockInfo> {
      */
     @TableField(exist = false)
     private String pcFlag;
+    /**
+     *
+     */
+    @TableField(exist = false)
+    private List<ClockInfo> clockInfoList;
     /**
      * 打卡日期
      */
@@ -137,6 +143,25 @@ public class ClockInfo extends BaseModel<ClockInfo> {
      */
     @TableField(exist = false)
     private Integer examineFlag;
+    /**
+     * 模糊查询
+     */
+    @TableField(exist = false)
+    private String searchKeyWord;
+    /**
+     * 开始时间
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    @DateTimeFormat(pattern = "yyyy-MM-dd")
+    @TableField(exist = false)
+    private Date startDate;
+    /**
+     * 结束时间
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    @DateTimeFormat(pattern = "yyyy-MM-dd")
+    @TableField(exist = false)
+    private Date endDate;
 
     @Override
     protected Serializable pkVal() {

+ 15 - 0
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/mapper/ClockInfoMapper.java

@@ -30,4 +30,19 @@ public interface ClockInfoMapper extends BaseMapper<ClockInfo> {
      * @return
      */
     List<ClockInfo> getListByCondition(Map<String, Object> pageView);
+    /**
+     * 根据条件查询总数(PC)
+     *
+     * @param pageView
+     * @return
+     */
+    Integer getCountByConditionPc(Map<String, Object> pageView);
+
+    /**
+     * 根据条件查询打卡记录(PC)
+     *
+     * @param pageView
+     * @return
+     */
+    List<ClockInfo> getListByConditionPc(Map<String, Object> pageView);
 }

+ 7 - 0
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/IClockInfoService.java

@@ -26,6 +26,13 @@ public interface IClockInfoService extends IService<ClockInfo> {
      * @return
      */
     Page<ClockInfo> selectClockInfo(ClockInfo clockInfo);
+    /**
+     * 考勤记录
+     *
+     * @param clockInfo
+     * @return
+     */
+    Page<ClockInfo> selectClockInfoPc(ClockInfo clockInfo);
     /**
      * 添加补卡信息
      * @param  clockInfo

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

@@ -9,6 +9,8 @@ import com.yh.saas.plugin.yiliangyiyun.entity.ClockInfo;
 import com.yh.saas.plugin.yiliangyiyun.mapper.ClockInfoMapper;
 import com.yh.saas.plugin.yiliangyiyun.service.IClockInfoService;
 import com.baomidou.mybatisplus.service.impl.ServiceImpl;
+import org.apache.commons.collections.CollectionUtils;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import java.text.SimpleDateFormat;
@@ -24,7 +26,8 @@ import java.util.*;
  */
 @Service
 public class ClockInfoServiceImpl extends ServiceImpl<ClockInfoMapper, ClockInfo> implements IClockInfoService {
-
+    @Autowired
+    private IClockInfoService clockInfoService;
     /**
      * 添加打卡信息
      *
@@ -126,6 +129,45 @@ public class ClockInfoServiceImpl extends ServiceImpl<ClockInfoMapper, ClockInfo
         return page;
     }
 
+    /**
+     * 考勤记录(PC)
+     * @param clockInfo
+     * @return
+     */
+    @Override
+    public Page<ClockInfo> selectClockInfoPc(ClockInfo clockInfo) {
+        Map<String, Object> pageView = new HashMap<>();
+        pageView.put("startRecord", (clockInfo.getCurrentPage() - 1)
+                * clockInfo.getPageSize());
+        //  公司ID
+        pageView.put("compId", clockInfo.getCompId());
+        pageView.put("pageSize", clockInfo.getPageSize());
+        pageView.put("currentPage", clockInfo.getCurrentPage());
+        pageView.put("searchKeyWord", clockInfo.getSearchKeyWord());
+        pageView.put("startDate", clockInfo.getStartDate());
+        pageView.put("endDate", clockInfo.getEndDate());
+        // 查询总数
+        Integer dataCount = baseMapper.getCountByConditionPc(pageView);
+        List<ClockInfo> dataList = baseMapper.getListByConditionPc(pageView);
+        if (!CollectionUtils.isEmpty(dataList)) {
+            for (ClockInfo clockInfo1 : dataList) {
+                List<ClockInfo> clockInfoList = clockInfoService.selectList(new EntityWrapper<ClockInfo>()
+                                .eq("comp_id",clockInfo1.getCompId())
+                                .eq("common_id",clockInfo1.getCommonId())
+                                .eq("delete_flag","0"));
+                if(CollectionUtils.isNotEmpty(clockInfoList)){
+                    clockInfo1.setClockInfoList(clockInfoList);
+                }
+            }
+        }
+        Page<ClockInfo> page = new Page<>();
+        page.setRecords(dataList == null ? Lists.newArrayList() : dataList);
+        page.setTotal(dataCount == null ? 0 : dataCount);
+        page.setCurrent(clockInfo.getCurrentPage());
+        page.setSize(clockInfo.getPageSize());
+        return page;
+    }
+
     /**
      * 添加补卡信息
      *

+ 50 - 2
winsea-haixin-plugin-yiliangyiyun/src/main/resources/mapper/ClockInfoMapper.xml

@@ -10,7 +10,6 @@
         comp_id = #{compId}
         and common_id = #{commonId}
         and delete_flag = '0'
---         and pc_flag = '0'
     </select>
     <!-- 打卡记录查询 -->
     <select id="getListByCondition" parameterType="Map"
@@ -38,10 +37,59 @@
         comp_id = #{compId}
         and common_id = #{commonId}
         and delete_flag = '0'
---         and pc_flag = '0'
         ORDER BY create_date
         <if test="currentPage != null and currentPage != ''">
             LIMIT ${startRecord}, ${pageSize}
         </if>
     </select>
+    <!-- 获得考勤记录总数 -->
+    <select id="getCountByConditionPc" parameterType="Map" resultType="java.lang.Integer">
+        SELECT
+        COUNT(cl.common_id)
+        FROM clock_info cl
+        LEFT JOIN leave_info l on cl.leave_id = l.id
+        WHERE
+        cl.comp_id = #{compId}
+        and cl.delete_flag = '0'
+        <if test="searchKeyWord != null and searchKeyWord != ''">
+            AND (lower(emp_name) like lower(CONCAT('%',#{searchKeyWord},'%'))
+        </if>
+    </select>
+    <!-- 考勤记录查询 -->
+    <select id="getListByConditionPc" parameterType="Map"
+            resultType="com.yh.saas.plugin.yiliangyiyun.entity.ClockInfo">
+        SELECT
+        cl.id,
+        cl.comp_id as compId,
+        cl.common_id as commonId,
+        cl.dept,
+        cl.phone,
+        cl.emp_name as empName,
+        cl.clock_type as clockType,
+        cl.reason_for_application as reasonForApplication,
+        cl.to_clock_date as toClockDate,
+        cl.off_clock_date as offClockDate,
+        cl.leave_type as leaveType,
+        cl.leave_early_flag as leaveEarlyFlag,
+        cl.late_flag as lateFlag,
+        cl.status,
+        cl.status_flag as statusFlag,
+        cl.approve_status as approveStatus,
+        cl.create_date as createDate,
+        l.id,
+        l.leave_type as leaveType,
+        l.leave_type_key as leaveTypeKey
+        FROM clock_info cl
+        LEFT JOIN leave_info l on cl.leave_id = l.id
+        WHERE
+        cl.comp_id = #{compId}
+        and cl.delete_flag = '0'
+        GROUP BY cl.emp_name
+        <if test="searchKeyWord != null and searchKeyWord != ''">
+            AND (lower(emp_name) like lower(CONCAT('%',#{searchKeyWord},'%'))
+        </if>
+        <if test="currentPage != null and currentPage != ''">
+            LIMIT ${startRecord}, ${pageSize}
+        </if>
+    </select>
 </mapper>