Subversion Repositories SmartDukaan

Rev

Rev 27493 | Rev 27497 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 27493 Rev 27496
Line 142... Line 142...
142
					em.setPunchIn(false);
142
					em.setPunchIn(false);
143
				}
143
				}
144
			} else {
144
			} else {
145
				em.setPunchIn(false);
145
				em.setPunchIn(false);
146
			}
146
			}
-
 
147
 
-
 
148
			if (employeeAttendances.get(employeeAttendances.size() - 1).getPunch().equals("punchIn")) {
-
 
149
				LocalTime startTime = employeeAttendances.get(0).getCreateTimestamp().toLocalTime();
-
 
150
				Long secondsBetween = ChronoUnit.SECONDS.between(startTime, LocalDateTime.now().toLocalTime());
-
 
151
				long hours = secondsBetween / 3600;
-
 
152
				long minutes = (secondsBetween % 3600) / 60;
-
 
153
				long seconds = secondsBetween % 60;
-
 
154
				em.setPunchHours(hours);
-
 
155
				em.setPunchMinutes(minutes);
-
 
156
				em.setPunchSeconds(seconds);
-
 
157
			}
-
 
158
 
147
		} else {
159
		} else {
148
			em.setPunchIn(false);
160
			em.setPunchIn(false);
149
		}
161
		}
150
		return responseSender.ok(em);
162
		return responseSender.ok(em);
151
	}
163
	}
Line 200... Line 212...
200
					deviceId, LocalDate.now());
212
					deviceId, LocalDate.now());
201
			long hours = 0;
213
			long hours = 0;
202
			long minutes = 0;
214
			long minutes = 0;
203
			long seconds = 0;
215
			long seconds = 0;
204
			long totalSeconds = 0;
216
			long totalSeconds = 0;
205
			String punchTotalHour = null;
-
 
206
			LocalTime startTime = null;
217
			LocalTime startTime = null;
207
			LocalTime endTime = null;
218
			LocalTime endTime = null;
208
			List<Long> hghg = new ArrayList<>();
-
 
209
 
219
 
210
			for (EmployeeAttendance em : employeeAttendances) {
220
			for (EmployeeAttendance em : employeeAttendances) {
211
				if (em.getPunch().equals("punchIn")) {
221
				if (em.getPunch().equals("punchIn")) {
212
					startTime = em.getCreateTimestamp().toLocalTime();
222
					startTime = em.getCreateTimestamp().toLocalTime();
213
				} else if (em.getPunch().equals("punchOut")) {
223
				} else if (em.getPunch().equals("punchOut")) {
214
					endTime = em.getCreateTimestamp().toLocalTime();
224
					endTime = em.getCreateTimestamp().toLocalTime();
215
				}
225
				}
216
				if (startTime != null && endTime != null) {
226
				if (startTime != null && endTime != null) {
217
					Long secondsBetween = ChronoUnit.SECONDS.between(startTime, endTime);
227
					Long secondsBetween = ChronoUnit.SECONDS.between(startTime, endTime);
218
					totalSeconds += secondsBetween;
228
					totalSeconds += secondsBetween;
219
 
-
 
220
					startTime = null;
229
					startTime = null;
221
					endTime = null;
230
					endTime = null;
222
				}
231
				}
223
 
232
 
224
			}
233
			}
225
 
-
 
226
			/*
-
 
227
			 * if (employeeAttendances.get(0).getPunch().equals("punchIn")) { LocalTime
-
 
228
			 * punchInTime = employeeAttendances.get(0).getCreateTimestamp().toLocalTime();
-
 
229
			 * Long totalPunchSeconds = ChronoUnit.SECONDS.between(punchInTime,
-
 
230
			 * dateTime.toLocalTime()); long punchHours = totalPunchSeconds / 3600; long
-
 
231
			 * punchMinutes = (totalPunchSeconds % 3600) / 60; long punchSeconds =
-
 
232
			 * totalPunchSeconds % 60; punchTotalHour = punchHours + ":" + punchMinutes +
-
 
233
			 * ":" + punchSeconds;
-
 
234
			 * 
-
 
235
			 * }
-
 
236
			 */
-
 
237
			LOGGER.info("employeeAttendance" + employeeAttendances);
-
 
238
 
-
 
239
			hours = totalSeconds / 3600;
234
			hours = totalSeconds / 3600;
240
			minutes = (totalSeconds % 3600) / 60;
235
			minutes = (totalSeconds % 3600) / 60;
241
			seconds = totalSeconds % 60;
236
			seconds = totalSeconds % 60;
242
			EmployeeAttendanceModel emm = new EmployeeAttendanceModel();
237
			EmployeeAttendanceModel emm = new EmployeeAttendanceModel();
243
			emm.setHours(hours);
238
			emm.setHours(hours);
244
			emm.setMinutes(minutes);
239
			emm.setMinutes(minutes);
245
			emm.setSeconds(seconds);
240
			emm.setSeconds(seconds);
246
			// emm.setTotalPunchHour(punchTotalHour);
-
 
247
			return responseSender.ok(emm);
241
			return responseSender.ok(emm);
248
 
242
 
249
		}
243
		}
250
		return responseSender.ok(true);
244
		return responseSender.ok(true);
251
	}
245
	}