feat: 考勤打卡模块(NFC)重新开发

基于新方法论(11层源码分析+独立评审)重新开发考勤打卡功能:
- 首页下拉展开打卡面板,点击按钮开启NFC贴卡打卡
- 支持上班打卡、下班打卡、撤销打卡
- NFC超时自动关闭,音效反馈(4种planId)
- MQTT type=5 上下班状态推送处理
- 按钮状态矩阵:onPunchState×offPunchState决定显示

新增: AttendanceStatus / PunchApi / PunchViewModel / PunchPanelView
修改: NetworkModule / HomeFragment / fragment_home.xml
删除: AttendanceInfo(被AttendanceStatus替代)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
dongliang
2026-04-28 20:57:17 +09:30
parent 98de3f0b46
commit 97a3054db2
13 changed files with 881 additions and 55 deletions

View File

@@ -0,0 +1,20 @@
package com.xiaoqu.watch.data.punch
/**
* 考勤状态(对应 GET /watchTask/myCurrentAttendance 响应)
*
* 按钮显示规则:
* - onPunchState=0 → 显示"上班打卡"
* - onPunchState=1, offPunchState=0 → 显示"下班打卡"
* - onPunchState=1, offPunchState=1 → 显示"撤销打卡" + "下班打卡"
*/
data class AttendanceStatus(
/** 上班打卡状态: 0=未打卡, 1=已打卡 */
val onPunchState: Int = 0,
/** 下班打卡状态: 0=未打卡, 1=已打卡 */
val offPunchState: Int = 0,
/** 上班打卡时间 */
val actualOnTime: String? = null,
/** 下班打卡时间 */
val actualOffTime: String? = null
)

View File

@@ -1,14 +0,0 @@
package com.xiaoqu.watch.data.task
import com.google.gson.annotations.SerializedName
/**
* 考勤状态信息
* 对应 watchTask/myCurrentAttendance API 返回
*/
data class AttendanceInfo(
/** 工作状态 (0=工作中) */
@SerializedName("workStatus") val workStatus: Int = 0,
/** 考勤状态 (3=未上班) */
@SerializedName("workAtStatus") val workAtStatus: Int = 0
)