Browse Source

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

anderx 1 year ago
parent
commit
18dd3b3a05

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

@@ -311,7 +311,7 @@ public class SysUserController extends BaseController
      * 考勤与打卡核对表
      */
     @GetMapping("/UserClockDetails")
-    public AjaxResult UserClockDetails(Long id) {
+    public AjaxResult UserClockDetails(@RequestParam("id") Long id) {
 
         return AjaxResult.success(userService.UserClockDetails(id));
     }

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

@@ -6,6 +6,7 @@ import java.util.Map;
 import com.ruoyi.common.core.domain.entity.SysUser;
 import com.ruoyi.system.domain.UserClockDtails;
 import com.ruoyi.system.domain.UserRecord;
+import com.ruoyi.system.domain.UserRecordOut;
 
 /**
  * 用户 业务层
@@ -218,7 +219,7 @@ public interface ISysUserService
 
     void pushUserClock(List<Map<Integer, String>> maps);
 
-    Object selectUserClock();
+    List<UserRecordOut> selectUserClock();
 
-    Object UserClockDetails(Long id);
+    UserRecordOut UserClockDetails(Long id);
 }

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

@@ -2,10 +2,7 @@ package com.ruoyi.system.service.impl;
 
 import java.sql.SQLException;
 import java.sql.SQLIntegrityConstraintViolationException;
-import java.time.Duration;
-import java.time.LocalDate;
-import java.time.LocalDateTime;
-import java.time.ZoneId;
+import java.time.*;
 import java.time.format.DateTimeFormatter;
 import java.util.*;
 import java.util.stream.Collectors;
@@ -826,7 +823,7 @@ public class SysUserServiceImpl implements ISysUserService
     }
 
     @Override
-    public Object selectUserClock() {
+    public List<UserRecordOut> selectUserClock() {
         Long userId=SecurityUtils.getUserId();
         return  userRecordMapper.selectUserClock(userId);
     }
@@ -877,11 +874,14 @@ public class SysUserServiceImpl implements ISysUserService
 
 
     @Override
-    public Object UserClockDetails(Long id) {
+    public UserRecordOut UserClockDetails(Long id) {
         UserRecord userRecord = userRecordMapper.selectByPrimaryKey(id);
         UserRecordOut out=new UserRecordOut();
         BeanUtils.copyProperties(userRecord, out);
-        return null;
+        LocalDate localDate =userRecord.getRecordTime().toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
+        List<ProjectStaffRecord> projectStaffRecords = projectStaffRecordMapper.selectByDDUidAndTime(out.getDdUserId(), localDate);
+        out.setList(projectStaffRecords);
+        return out;
     }
 
 }

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

@@ -139,6 +139,7 @@
 
     <resultMap id="OutMap" type="com.ruoyi.system.domain.UserRecordOut">
         <id property="id" column="id" jdbcType="BIGINT"/>
+        <result property="ddUserId" column="dd_user_id" jdbcType="BIGINT"/>
         <result property="psrId" column="psr_id" jdbcType="BIGINT"/>
         <result property="name" column="name" jdbcType="VARCHAR"/>
         <result property="status" column="status" jdbcType="INTEGER"/>
@@ -154,7 +155,8 @@
 
     <select id="selectUserClock" resultMap="OutMap">
         select
-        a.id, a.psr_id, a.name, a.status, a.content, a.record_time, a.start_time, a.end_time, a.sum_duration, a.check_duration, a.create_id,
+        a.id,a.dd_user_id, a.psr_id, a.name, a.status, a.content, a.record_time, a.start_time, a.end_time,
+        a.sum_duration, a.check_duration, a.create_id,
         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}