Procházet zdrojové kódy

导入用户打卡数据开发第二版,导入数据库再做处理

anderx před 1 rokem
rodič
revize
5febe11d67

+ 2 - 2
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java

@@ -302,9 +302,9 @@ public class SysUserController extends BaseController
      * 考勤与打卡核对表
      */
     @GetMapping("/selectUserClock")
-    public AjaxResult selectUserClock() {
+    public AjaxResult selectUserClock(Integer status) {
 
-        return AjaxResult.success(userService.selectUserClock());
+        return AjaxResult.success(userService.selectUserClock(status));
     }
 
     /**

+ 1 - 1
ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java

@@ -392,7 +392,7 @@ public class ExcelUtil<T>
                     if (row.getCell(x) !=null){
                          val= row.getCell(x).getStringCellValue();
                     }
-                    map.put( x,val);
+                        map.put( x,val);
                 }
                 list.add(map);
             }

+ 2 - 1
ruoyi-system/src/main/java/com/ruoyi/system/mapper/UserRecordMapper.java

@@ -2,6 +2,7 @@ package com.ruoyi.system.mapper;
 
 import com.ruoyi.system.domain.UserRecord;
 import com.ruoyi.system.domain.UserRecordOut;
+import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
 
@@ -26,5 +27,5 @@ public interface UserRecordMapper {
     int updateByPrimaryKey(UserRecord record);
 
 
-    List<UserRecordOut> selectUserClock(Long userId);
+    List<UserRecordOut> selectUserClock(@Param("userId") Long userId, @Param("status") Integer status);
 }

+ 1 - 1
ruoyi-system/src/main/java/com/ruoyi/system/service/ISysUserService.java

@@ -219,7 +219,7 @@ public interface ISysUserService
 
     void pushUserClock(List<Map<Integer, String>> maps);
 
-    List<UserRecordOut> selectUserClock();
+    List<UserRecordOut> selectUserClock(Integer status);
 
     UserRecordOut UserClockDetails(Long id);
 }

+ 5 - 5
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java

@@ -785,7 +785,6 @@ public class SysUserServiceImpl implements ISysUserService
         for (UserClockDtails e:list){
             Long ddUserId = Long.valueOf(e.getUserId());
             List<ProjectStaffRecord> projectStaffRecords = projectStaffRecordMapper.selectByDDUidAndTime(ddUserId, e.getClockTime());
-            if (!projectStaffRecords.isEmpty()){
                 UserRecordOut ur=new UserRecordOut();
                 ur.setName(e.getName());
                 ur.setDdUserId(Long.valueOf(e.getUserId()));
@@ -800,7 +799,9 @@ public class SysUserServiceImpl implements ISysUserService
                     ur.setStatus(1);
                 }
                 ur.setRecordTime(Date.from(e.getClockTime().atStartOfDay().atZone(ZoneId.systemDefault()).toInstant()));
-                if (projectStaffRecords.size()==1){
+                if (projectStaffRecords.isEmpty()){
+                    ur.setStatus(4);
+                }else if (projectStaffRecords.size()==1){
                     ur.setStatus(0);
                     ur.setPsrId(projectStaffRecords.get(0).getId());
                 }else if (projectStaffRecords.size()>1){
@@ -813,7 +814,6 @@ public class SysUserServiceImpl implements ISysUserService
                 }
                 ur.setCreateId(SecurityUtils.getUserId());
                 userRecordList.add(ur);
-            }
         }
         if (!userRecordList.isEmpty()){
             for (UserRecordOut userRecordOut : userRecordList) {
@@ -823,9 +823,9 @@ public class SysUserServiceImpl implements ISysUserService
     }
 
     @Override
-    public List<UserRecordOut> selectUserClock() {
+    public List<UserRecordOut> selectUserClock(Integer status) {
         Long userId=SecurityUtils.getUserId();
-        return  userRecordMapper.selectUserClock(userId);
+        return  userRecordMapper.selectUserClock(userId,status);
     }
 
 

+ 3 - 0
ruoyi-system/src/main/resources/mapper/UserRecordMapper.xml

@@ -160,5 +160,8 @@
         b.duration
         from user_record a left join project_staff_record b on a.psr_id=b.id
         where a.create_id= #{userId,jdbcType=BIGINT}
+        <if test="status != null">
+            and a.status = #{status,jdbcType=INTEGER}
+        </if>
     </select>
 </mapper>