考勤打卡功能修改

master
Yangwl 3 months ago
parent 7475c667e9
commit 4ad32953ee

@ -3,11 +3,13 @@ package com.op.mes.controller;
import java.util.List; import java.util.List;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import com.op.common.core.utils.poi.ExcelUtil;
import com.op.common.core.web.controller.BaseController; import com.op.common.core.web.controller.BaseController;
import com.op.common.core.web.page.TableDataInfo; import com.op.common.core.web.page.TableDataInfo;
import com.op.common.security.annotation.RequiresPermissions; import com.op.common.security.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
@ -40,18 +42,17 @@ public class MesAttendanceRecordsController extends BaseController
return getDataTable(list); return getDataTable(list);
} }
// /** /**
// * 导出MES打卡记录列表 * MES
// */ */
// @PreAuthorize("@ss.hasPermi('mes:AttendanceRecords:export')") @RequiresPermissions("mes:AttendanceRecords:export")
// @Log(title = "MES打卡记录", businessType = BusinessType.EXPORT) @PostMapping("/export")
// @PostMapping("/export") public void export(HttpServletResponse response, MesAttendanceRecords mesAttendanceRecords)
// public void export(HttpServletResponse response, MesAttendanceRecords mesAttendanceRecords) {
// { List<MesAttendanceRecords> list = mesAttendanceRecordsService.selectMesAttendanceRecordsList(mesAttendanceRecords);
// List<MesAttendanceRecords> list = mesAttendanceRecordsService.selectMesAttendanceRecordsList(mesAttendanceRecords); ExcelUtil<MesAttendanceRecords> util = new ExcelUtil<MesAttendanceRecords>(MesAttendanceRecords.class);
// ExcelUtil<MesAttendanceRecords> util = new ExcelUtil<MesAttendanceRecords>(MesAttendanceRecords.class); util.exportExcel(response, list, "MES打卡记录数据");
// util.exportExcel(response, list, "MES打卡记录数据"); }
// }
// /** // /**
// * 获取MES打卡记录详细信息 // * 获取MES打卡记录详细信息

@ -22,11 +22,11 @@ public class MesAttendanceRecords extends BaseEntity
private String id; private String id;
/** 用户编码 */ /** 用户编码 */
@Excel(name = "用户编码") @Excel(name = "工号")
private String userId; private String userId;
/** 用户名称 */ /** 用户名称 */
@Excel(name = "用户名称") @Excel(name = "姓名")
private String userName; private String userName;
/** 考勤状态 */ /** 考勤状态 */
@ -42,7 +42,7 @@ public class MesAttendanceRecords extends BaseEntity
private Long age; private Long age;
/** 身份证号 */ /** 身份证号 */
@Excel(name = "身份证号") // @Excel(name = "身份证号")
private String idNumber; private String idNumber;
/** 上班打卡时间 */ /** 上班打卡时间 */
@ -51,16 +51,16 @@ public class MesAttendanceRecords extends BaseEntity
private Date startTime; private Date startTime;
/** 上班打卡地点 */ /** 上班打卡地点 */
@Excel(name = "上班打卡地点") // @Excel(name = "上班打卡地点")
private String startAddr; private String startAddr;
/** 下班打卡时间 */ /** 下班打卡时间 */
@JsonFormat(pattern = "yyyy-MM-dd") // @JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "下班打卡时间", width = 30, dateFormat = "yyyy-MM-dd") @Excel(name = "下班打卡时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date endTime; private Date endTime;
/** 下班打开地点 */ /** 下班打开地点 */
@Excel(name = "下班打开地点") // @Excel(name = "下班打开地点")
private String endAddr; private String endAddr;
/** 考勤时间段 */ /** 考勤时间段 */
@ -73,7 +73,7 @@ public class MesAttendanceRecords extends BaseEntity
private Date attendanceDate; private Date attendanceDate;
/** 工作时长 */ /** 工作时长 */
@Excel(name = "工作时长") // @Excel(name = "工作时长")
private Long workHours; private Long workHours;
/** 岗位 */ /** 岗位 */

@ -58,4 +58,7 @@ public interface MesAttendanceRecordsMapper
* @return * @return
*/ */
public int deleteMesAttendanceRecordsByIds(String[] ids); public int deleteMesAttendanceRecordsByIds(String[] ids);
List<MesAttendanceRecords> selectMesClockRecord(MesAttendanceRecords mesAttendanceRecords);
} }

@ -1,5 +1,6 @@
package com.op.mes.service.impl; package com.op.mes.service.impl;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import com.baomidou.dynamic.datasource.annotation.DS; import com.baomidou.dynamic.datasource.annotation.DS;

@ -24,28 +24,78 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap> </resultMap>
<sql id="selectMesAttendanceRecordsVo"> <sql id="selectMesAttendanceRecordsVo">
select id, user_id, user_name, attendance_status, sex, age, id_number, start_time, start_addr, end_time, end_addr, attendance_time, attendance_date, work_hours, create_time, post -- select id, user_id, user_name, attendance_status, sex, age, id_number, start_time, start_addr, end_time, end_addr, attendance_time, attendance_date, work_hours, create_time, post
from mes_attendance_records -- from mes_attendance_records
-- SELECT
-- id,
-- user_id,
-- user_name,
-- attendance_status,
-- start_time,
-- post
-- FROM
-- mes_attendance_records UNION
-- SELECT
-- null AS id,
-- workno AS user_id,
-- name AS user_name,
-- NULL as attendance_status,
-- clock_time AS startTime,
-- NULL AS post
--
-- FROM
-- mes_clock_record
</sql> </sql>
<select id="selectMesAttendanceRecordsList" parameterType="MesAttendanceRecords" resultMap="MesAttendanceRecordsResult"> <select id="selectMesAttendanceRecordsList" parameterType="MesAttendanceRecords" resultMap="MesAttendanceRecordsResult">
<include refid="selectMesAttendanceRecordsVo"/> ( SELECT id, user_id, user_name, attendance_status, start_time, post FROM mes_attendance_records
<where> <where>
<if test="userId != null and userId != ''"> and user_id = #{userId}</if> <if test="userId != null and userId != ''"> and user_id = #{userId}</if>
<if test="userName != null and userName != ''"> and user_name like concat('%', #{userName}, '%')</if> <if test="userName != null and userName != ''"> and user_name like concat('%', #{userName}, '%') </if>
<if test="attendanceStatus != null and attendanceStatus != ''"> and attendance_status = #{attendanceStatus}</if> <if test="attendanceStatus != null and attendanceStatus != ''"> and attendance_status = #{attendanceStatus}</if>
<if test="startTime != null "> and start_time = #{startTime}</if> <if test="params.beginTime != null and params.beginTime != '' and params.endTime != null and params.endTime != ''">
and start_time between #{params.beginTime} and #{params.endTime}
</if>
<!-- <if test="startTime != null "> and start_time = #{startTime}</if>-->
<if test="attendanceTime != null and attendanceTime != ''"> and attendance_time = #{attendanceTime}</if> <if test="attendanceTime != null and attendanceTime != ''"> and attendance_time = #{attendanceTime}</if>
<if test="post != null and post != ''"> and post = #{post}</if> <if test="post != null and post != ''"> and post = #{post}</if>
</where> </where>
ORDER BY attendance_date DESC, start_addr ASC; )
UNION ALL
( SELECT NULL AS id, workno AS user_id, name AS user_name, NULL AS attendance_status, clock_time AS start_time, NULL AS post
FROM mes_clock_record
<where>
<if test="userId != null and userId != ''"> and workno = #{userId}</if>
<if test="userName != null and userName != ''"> and name like concat('%', #{userName}, '%') </if>
<if test="params.beginTime != null and params.beginTime != '' and params.endTime != null and params.endTime != ''">
and clock_time between #{params.beginTime} and #{params.endTime}
</if>
</where>
)
</select> </select>
<select id="selectMesAttendanceRecordsById" parameterType="String" resultMap="MesAttendanceRecordsResult"> <select id="selectMesAttendanceRecordsById" parameterType="String" resultMap="MesAttendanceRecordsResult">
<include refid="selectMesAttendanceRecordsVo"/> <include refid="selectMesAttendanceRecordsVo"/>
where id = #{id} where id = #{id}
</select> </select>
<select id="selectMesClockRecord" parameterType="MesAttendanceRecords" resultMap="MesAttendanceRecordsResult">
SELECT
clock_time AS start_time,
workno AS user_id,
name AS user_name
FROM
mes_clock_record
<where>
<if test="userId != null and userId != ''"> and workno = #{userId}</if>
<if test="userName != null and userName != ''"> and name like concat('%', #{userName}, '%')</if>
<if test="params.beginTime != null and params.beginTime != '' and params.endTime != null and params.endTime != ''">
and clock_time between #{params.beginTime} and #{params.endTime}
</if>
</where>
</select>
<insert id="insertMesAttendanceRecords" parameterType="MesAttendanceRecords"> <insert id="insertMesAttendanceRecords" parameterType="MesAttendanceRecords">
insert into mes_attendance_records insert into mes_attendance_records

Loading…
Cancel
Save