111
tjx
17 小时以前 8c792bb3ce0d58b74b243186792e40814b5eb554
src/test/java/com/gs/dingtalk/DeviceReceivingApplicationTests.java
@@ -280,15 +280,7 @@
                    // 打印异常信息
                    if (data.getExceptionInfos() != null && !data.getExceptionInfos().isEmpty()) {
                        data.getExceptionInfos().forEach(ex -> {
                            String exType = switch (ex.getException()) {
                                case 1 -> "迟到";
                                case 2 -> "早退";
                                case 3 -> "缺卡";
                                case 4 -> "旷工";
                                case 5 -> "地点异常";
                                case 6 -> "设备异常";
                                default -> "未知";
                            };
                            String exType = getExceptionTypeName(ex.getException());
                            System.out.println("      异常: " + exType + ", 次数: " + ex.getCount() + ", 时长(秒): " + ex.getDuration());
                        });
                    }
@@ -356,15 +348,7 @@
                    if (data.getExceptionInfos() != null && !data.getExceptionInfos().isEmpty()) {
                        System.out.println("  异常信息:");
                        data.getExceptionInfos().forEach(ex -> {
                            String exType = switch (ex.getException()) {
                                case 1 -> "迟到";
                                case 2 -> "早退";
                                case 3 -> "缺卡";
                                case 4 -> "旷工";
                                case 5 -> "地点异常";
                                case 6 -> "设备异常";
                                default -> "未知";
                            };
                            String exType = getExceptionTypeName(ex.getException());
                            System.out.println("    - " + exType + ": " + ex.getCount() + "次, 时长: " + formatSeconds(ex.getDuration()));
                        });
                    }
@@ -403,4 +387,30 @@
        return sb.toString();
    }
    /**
     * 获取异常类型名称
     * @param exceptionType 异常类型代码:1-迟到;2-早退;3-缺卡;4-旷工;5-地点异常;6-设备异常
     */
    private String getExceptionTypeName(Integer exceptionType) {
        if (exceptionType == null) {
            return "未知";
        }
        switch (exceptionType) {
            case 1:
                return "迟到";
            case 2:
                return "早退";
            case 3:
                return "缺卡";
            case 4:
                return "旷工";
            case 5:
                return "地点异常";
            case 6:
                return "设备异常";
            default:
                return "未知";
        }
    }
}