peanutive00

Match Scan Card Algorithm

Aug 18th, 2025 (edited)
167
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 3.71 KB | Source Code | 0 0
  1. import java.text.ParseException;
  2. import java.text.SimpleDateFormat;
  3. import java.util.Date;
  4. import java.util.List;
  5.  
  6. public class MatchScanCard {
  7.  
  8.     public static void main(String[] args) {
  9.         try {
  10.             SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
  11.            
  12.             List<OvertimeHour> overtimeHours = List.of(
  13.                 new OvertimeHour(
  14.                     1L, 1L,
  15.                     sdf.parse("2025-01-01 07:00:00"),
  16.                     sdf.parse("2025-01-01 15:00:00"),
  17.                     1, "SCHEDULED"
  18.                 ),
  19.                
  20.                 new OvertimeHour(
  21.                     1L, 2L,
  22.                     sdf.parse("2025-01-01 11:00:00"),
  23.                     sdf.parse("2025-01-01 12:00:00"),
  24.                     2, "SCHEDULED"
  25.                 ),
  26.  
  27.                 new OvertimeHour(
  28.                     1L, 3L,
  29.                     sdf.parse("2025-01-01 13:30:00"),
  30.                     sdf.parse("2025-01-01 13:40:00"),
  31.                     3, "SCHEDULED"
  32.                 )
  33.             );
  34.  
  35.             Overtime ot = new Overtime(1L, 12136L, overtimeHours);
  36.  
  37.             List<AttRec> attRecs = List.of(
  38.                 new AttRec(1L, 12136L, sdf.parse("2025-01-01 06:55:53")),
  39.                 new AttRec(2L, 12136L, sdf.parse("2025-01-01 10:54:53")),
  40.                 new AttRec(3L, 12136L, sdf.parse("2025-01-01 11:01:05")),
  41.                 new AttRec(4L, 12136L, sdf.parse("2025-01-01 11:58:32")),
  42.                 new AttRec(5L, 12136L, sdf.parse("2025-01-01 12:06:32")),
  43.                 new AttRec(6L, 12136L, sdf.parse("2025-01-01 13:24:45")),
  44.                 new AttRec(7L, 12136L, sdf.parse("2025-01-01 15:03:11"))
  45.             );
  46.         } catch (ParseException e) {
  47.             System.err.println(e.getMessage());
  48.             e.printStackTrace();
  49.         }
  50.     }
  51. }
  52.  
  53. class Overtime {
  54.     private final Long otRid;
  55.     private final Long staffRid;
  56.     private final List<OvertimeHour> overtimeHours;
  57.  
  58.     public Overtime(Long otRid, Long staffRid, List<OvertimeHour> overtimeHours) {
  59.         this.otRid = otRid;
  60.         this.staffRid = staffRid;
  61.         this.overtimeHours = overtimeHours;
  62.     }
  63.  
  64.     public Long getOtRid() { return otRid; }
  65.     public Long getStaffRid() { return staffRid; }
  66.     public List<OvertimeHour> getOvertimeHours() { return overtimeHours; }
  67. }
  68.  
  69. class OvertimeHour {
  70.     private final Long otRid;
  71.     private final Long otHourRid;
  72.     private final Date startTime;
  73.     private final Date endTime;
  74.     private final Integer timeslotRid;
  75.     private final String source;
  76.    
  77.     public OvertimeHour(Long otRid, Long otHourRid, Date startTime,
  78.                         Date endTime, Integer timeslotRid, String source) {
  79.         this.otRid = otRid;
  80.         this.otHourRid = otHourRid;
  81.         this.startTime = startTime;
  82.         this.endTime = endTime;
  83.         this.timeslotRid = timeslotRid;
  84.         this.source = source;
  85.     }
  86.  
  87.     public Long getOtRid() { return otRid; }
  88.     public Long getOtHourRid() { return otHourRid; }
  89.     public Date getStartTime() { return startTime; }
  90.     public Date getEndTime() { return endTime; }
  91.     public Integer getTimeslotRid() { return timeslotRid; }
  92.     public String getSource() { return source; }
  93. }
  94.  
  95. class AttRec {
  96.     private final Long recRid;
  97.     private final Long staffRid;
  98.     private final Date scanDateTime;
  99.  
  100.     public AttRec(Long recRid, Long staffRid, Date scanDateTime) {
  101.         this.recRid = recRid;
  102.         this.staffRid = staffRid;
  103.         this.scanDateTime = scanDateTime;
  104.     }
  105.  
  106.     public Long getRecRid() { return recRid; }
  107.     public Long getStaffRid() { return staffRid; }
  108.     public Date getScanDateTime() { return scanDateTime; }
  109. }
Advertisement
Add Comment
Please, Sign In to add comment