那个判断可以用case then
排除假日可以建立一个假期安排表,把该签到未签的查出来标记成未签
public class Test06 {static List<Student_Status> list_Student_Status = new ArrayList<Student_Status>()
static List<Student> list_Student = new ArrayList<Student>()
static List<Status> list_Studus = new ArrayList<Status>()
static Scanner scanner = new Scanner(System.in)
public Test06() {
list_Studus.add(new Status("001", "病假"))
list_Studus.add(new Status("002", "产假"))
list_Studus.add(new Status("003", "事假"))
list_Studus.add(new Status("004", "婚假"))
list_Student.add(new Student("001", "张三"))
list_Student.add(new Student("002", "李四"))
list_Student.add(new Student("003", "王五"))
list_Student.add(new Student("004", "刘杰"))
list_Student.add(new Student("005", "陈朋"))
list_Student.add(new Student("006", "赵明明"))
list_Student.add(new Student("007", "罗四海"))
list_Student.add(new Student("008", "谢一刀"))
list_Student_Status.add(new Student_Status("001", list_Student.get(0),
list_Studus.get(0)))
list_Student_Status.add(new Student_Status("002", list_Student.get(1),
list_Studus.get(0)))
list_Student_Status.add(new Student_Status("003", list_Student.get(2),
list_Studus.get(1)))
list_Student_Status.add(new Student_Status("004", list_Student.get(3),
list_Studus.get(0)))
list_Student_Status.add(new Student_Status("005", list_Student.get(4),
list_Studus.get(2)))
list_Student_Status.add(new Student_Status("006", list_Student.get(5),
list_Studus.get(0)))
list_Student_Status.add(new Student_Status("007", list_Student.get(6),
list_Studus.get(3)))
list_Student_Status.add(new Student_Status("008", list_Student.get(7),
list_Studus.get(0)))
}
public static void main(String[] args) {
new Test06()
showHelp()
doMothed()
}
public static void doMothed() {
System.out.println("请选择你要 *** 作的类型 1-按学号查询考勤 2-按考勤态度id杳学生")
System.out.println("请输入...")
int num = scanner.nextInt()
switch (num) {
case 1:
Find_1()
break
case 2:
Find_2()
break
default:
showHelp()
break
}
doMothed()
}
public static void Find_2() {
System.out.println("请输考勤类型代号:")
String ids2 = scanner.next()
List<Student> list_temp = findStudentsByStatusID(ids2)
System.out.println("当前请 " + findByStatusID(ids2).status + " 的人员有:")
for (Student student : list_temp) {
System.out.println(student.getName())
}
}
public static void Find_1() {
System.out.println("请输入学生学号:")
String ids = scanner.next()
List<Student_Status> list_ss = GetByStudentID(ids)
System.out.println("当前学生为: " + FindByid(ids).getName())
for (Student_Status student_Status : list_ss) {
System.out.println("时间: " + student_Status.getDate() + " 姓名: "
+ student_Status.getStudent().getName() + " 事由: "
+ student_Status.getStatus().status)
}
}
public static void showHelp() {
System.out.println(" 学生信息列表")
System.out.println("********************************")
System.out.println("ID 姓名")
for (Student student : list_Student) {
System.out.println(student.getId() + " "
+ student.getName())
}
System.out.println("********************************")
System.out.println("考勤状态表")
System.out.println("********************************")
System.out.println("ID 状态")
for (Status status : list_Studus) {
System.out.println(status.id + " " + status.status)
}
System.out.println("********************************")
}
public static Status findByStatusID(String ids) {
for (Status status : list_Studus) {
if (status.id.equals(ids))
return status
}
return null
}
public static Student FindByid(String id) {
for (Student ss : list_Student) {
if (ss.getId().equals(id)) {
return ss
}
}
return null
}
// 添加考勤
public void Add_Student_Status(Student_Status ss) {
list_Student_Status.add(ss)
}
// 按考勤类型查人员
public static List<Student> findStudentsByStatusID(String id) {
List<Student> list = new ArrayList<Student>()
for (Student_Status ss : list_Student_Status) {
if (ss.getStatus().id.equals(id)) {
list.add(ss.getStudent())
}
}
return list
}
// 按学号查询考勤
public static List<Student_Status> GetByStudentID(String id) {
Student student = FindByid(id)
return student.getStudent_Status()
}
// 学生对象
class Student {
String id
String name
public Student(String id, String name) {
this.name = name
this.id = id
}
public String getId() {
return id
}
public String getName() {
return name
}
public List<Student_Status> getStudent_Status() {
List<Student_Status> list1 = new ArrayList<Student_Status>()
for (Student_Status ss : list_Student_Status) {
if (ss.getStudent().getId().equals(getId())) {
list1.add(ss)
}
}
return list1
}
}
// 考勤对象
class Status {
String id
String status
public Status(String id, String status) {
this.status = status
this.id = id
}
}
class Student_Status {
String id
Date date
Student student
Status status
public Student_Status(String id, Student student, Status status) {
this.id = id
this.date = new Date()
this.student = student
this.status = status
}
public String getId() {
return id
}
public Date getDate() {
return date
}
public Student getStudent() {
return student
}
public Status getStatus() {
return status
}
}
}
你应该在记录员工考勤时将班次、上班打卡时间、下班打卡时间记录下来,同时为不同的班次设定不同的迟到时间。在最后统计时以班次作为分组条件,将每天的记录分组然后再来根据你设定的迟到时间检查谁迟到了欢迎分享,转载请注明来源:内存溢出
评论列表(0条)