Ver código fonte

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

anderx 1 ano atrás
pai
commit
506d414541

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

@@ -284,6 +284,12 @@ public class SysUserController extends BaseController
         return success(userService.selectName(name,type));
     }
 
+    /**
+     * 导入用户考勤
+     * @param file
+     * @return
+     * @throws Exception
+     */
     @PostMapping("/importUserClock")
     public AjaxResult importUserClock( @RequestParam("file") MultipartFile file) throws Exception{
         ExcelUtil<Map> util = new ExcelUtil<>(Map.class);
@@ -291,4 +297,13 @@ public class SysUserController extends BaseController
         userService.pushUserClock(maps);
         return success();
     }
+
+    /**
+     * 考勤与打卡核对表
+     */
+    @GetMapping("/selectUserClock")
+    public AjaxResult selectUserClock() {
+
+        return AjaxResult.success(userService.selectUserClock());
+    }
 }

+ 9 - 0
ruoyi-system/src/main/java/com/ruoyi/system/domain/UserRecordOut.java

@@ -21,9 +21,18 @@ public class UserRecordOut extends UserRecord{
      */
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
     private Date endTime;
+    private Double duration;
 
     private List<ProjectStaffRecord> list;
 
+    public Double getDuration() {
+        return duration;
+    }
+
+    public void setDuration(Double duration) {
+        this.duration = duration;
+    }
+
     public List<ProjectStaffRecord> getList() {
         return list;
     }

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

@@ -26,4 +26,5 @@ public interface UserRecordMapper {
     int updateByPrimaryKey(UserRecord record);
 
 
+    List<UserRecordOut> selectUserClock(Long userId);
 }

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

@@ -217,4 +217,6 @@ public interface ISysUserService
     boolean checkProject(Long[] userIds);
 
     void pushUserClock(List<Map<Integer, String>> maps);
+
+    Object selectUserClock();
 }

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

@@ -823,6 +823,12 @@ public class SysUserServiceImpl implements ISysUserService
         }
     }
 
+    @Override
+    public Object selectUserClock() {
+        Long userId=SecurityUtils.getUserId();
+        return  userRecordMapper.selectUserClock(userId);
+    }
+
     private String  getTime(String s) {
         return s.replace("外勤","").trim();
     }

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

@@ -32,6 +32,7 @@
         where  id = #{id,jdbcType=BIGINT} 
     </select>
 
+
     <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
         delete from user_record
         where  id = #{id,jdbcType=BIGINT} 
@@ -128,4 +129,27 @@
             create_id =  #{createId,jdbcType=BIGINT}
         where   id = #{id,jdbcType=BIGINT} 
     </update>
+
+    <resultMap id="OutMap" type="com.ruoyi.system.domain.UserRecordOut">
+        <id property="id" column="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"/>
+        <result property="content" column="content" jdbcType="VARCHAR"/>
+        <result property="recordTime" column="record_time" jdbcType="TIMESTAMP"/>
+        <result property="startTime" column="start_time" jdbcType="TIMESTAMP"/>
+        <result property="endTime" column="end_time" jdbcType="TIMESTAMP"/>
+        <result property="sumDuration" column="sum_duration" jdbcType="DOUBLE"/>
+        <result property="checkDuration" column="check_duration" jdbcType="DOUBLE"/>
+        <result property="duration" column="duration" jdbcType="DOUBLE"/>
+        <result property="createId" column="create_id" jdbcType="BIGINT"/>
+    </resultMap>
+
+    <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,
+        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}
+    </select>
 </mapper>