修改LED查询考勤服务

dev_xd
lj7788 2026-01-04 15:48:49 +08:00
parent f3cca74a55
commit 4a2fc96768
4 changed files with 31 additions and 5600 deletions

File diff suppressed because one or more lines are too long

View File

@ -27,6 +27,9 @@ public interface ProMobileAttendanceDataMapper
*/
public List<ProMobileAttendanceData> selectProMobileAttendanceDataList(ProMobileAttendanceData proMobileAttendanceData);
public List<ProMobileAttendanceData> selectProMobileAttendanceDataListByWorkArea(ProMobileAttendanceData proMobileAttendanceData);
/**
*
*

View File

@ -71,6 +71,28 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</where>
order by pma.att_date desc,pma.id desc
</select>
<select id="selectProMobileAttendanceDataListByWorkArea" parameterType="ProMobileAttendanceData" resultMap="ProMobileAttendanceDataResult">
SELECT *
FROM (
SELECT pma.id, pma.user_id, pma.project_id, pma.cfg_id, pma.in_out, pma.longitude, pma.latitude, pma.att_date, pma.att_img, pma.is_del,
pma.remark, pma.state, pma.create_by, pma.create_time, pma.update_by, pma.update_time,
dic1.dict_label as craft_type_name,dic2.dict_label as craft_post_name,pma.att_device,
psu.user_name, psu.user_phone,psu.sub_dept_name,psu.sub_dept_group_name,psu.user_post,psu.user_sex,
pma.work_area_id,
ROW_NUMBER() OVER (PARTITION BY pma.user_id ORDER BY pma.att_date DESC) as rn
FROM pro_mobile_attendance_data pma
left join (
SELECT t.* FROM pro_project_info_subdepts_users t
INNER JOIN (SELECT user_id, MAX(CONCAT(IFNULL(update_time, DATE('2099-12-31')), create_time)) AS max_time_key FROM pro_project_info_subdepts_users GROUP BY user_id) t_max ON t.user_id = t_max.user_id
AND CONCAT(IFNULL(t.update_time, DATE('2099-12-31')), t.create_time) = t_max.max_time_key
) psu ON pma.user_id = psu.user_id
left join sys_dict_data dic1 on psu.`craft_type`=dic1.`dict_value` and dic1.`dict_type`='pro_craft_type'
left join sys_dict_data dic2 on psu.`craft_post`=dic2.`dict_value` and dic2.`dict_type`='pro_craft_post'
WHERE pma.is_del = 0 AND pma.in_out = 'in' AND pma.work_area_id = #{workAreaId} and pma.project_id = #{projectId}
AND DATE(pma.att_date) = CURDATE()
) ranked_data
WHERE rn = 1
</select>
<select id="selectProMobileAttendanceDataById" parameterType="Long" resultMap="ProMobileAttendanceDataResult">
<include refid="selectProMobileAttendanceDataVo"/>

View File

@ -113,18 +113,19 @@ public class LedScreenServiceImpl implements ILedScreenService {
//根据屏的DeviceNo为目录创建图片路径
if(ledScreen.getDrawType().intValue()==1){
// 获取考勤数据
List<ProMobileAttendanceData> attendanceDataList = getAttendanceDataByWorkAreaId(ledScreen.getWorkareaId());
List<ProMobileAttendanceData> attendanceDataList = getAttendanceDataByWorkAreaId(ledScreen);
return UniLedDrawer.drawLedScreen(ledScreen, ledProperties, attendanceDataList);
}
return new String[]{}; // 实际使用时应从配置或数据库获取
}
// 根据工区ID获取考勤数据
private List<ProMobileAttendanceData> getAttendanceDataByWorkAreaId(Long workAreaId) {
private List<ProMobileAttendanceData> getAttendanceDataByWorkAreaId(SysLedscreen ledScreen) {
ProMobileAttendanceData where = new ProMobileAttendanceData();
where.setWorkAreaId(workAreaId);
where.setWorkAreaId(ledScreen.getWorkareaId());
where.setProjectId(ledScreen.getProjectId());
// 可以添加更多筛选条件,如最近考勤时间等
return proMobileAttendanceDataMapper.selectProMobileAttendanceDataList(where);
return proMobileAttendanceDataMapper.selectProMobileAttendanceDataListByWorkArea(where);
// return Arrays.stream("1,2,3,4,5,6,7,8,9,10".split(",")).map(id -> {
// ProMobileAttendanceData d=new ProMobileAttendanceData();
// d.setId(Long.parseLong(id));