|
@@ -199,7 +199,7 @@ public class AttendanceServiceImpl implements AttendanceService {
|
|
|
public String showAttendanceType(String tableName, String userName) {
|
|
|
requireNonNull(tableName, "tableName is empty");
|
|
|
requireNonNull(userName, "userName is empty");
|
|
|
- JSONObject attendanceTableUsername = commonService.getOneByMap(tableName, JSONObjectUtils.putValue("attendance_table_username", userName, ATTENDANCE_TABLE_TODAYTIME, Lists.newArrayList(DateUtils.getDate())));
|
|
|
+ JSONObject attendanceTableUsername = commonService.getOneByMap(tableName, JSONObjectUtils.putValue("attendance_table_username", userName, ATTENDANCE_TABLE_TODAYTIME, DateUtils.getDate()));
|
|
|
GregorianCalendar ca = new GregorianCalendar();
|
|
|
int result = ca.get(GregorianCalendar.AM_PM);
|
|
|
if (0 == result){
|
|
@@ -291,7 +291,7 @@ public class AttendanceServiceImpl implements AttendanceService {
|
|
|
|
|
|
JSONObject commitData = new JSONObject();
|
|
|
commitData.put(ATTENDANCE_USER_NAME, SecurityUtils.getUsername());
|
|
|
- commitData.put(ATTENDANCE_TABLE_TODAYTIME, Lists.newArrayList(DateUtils.getDate()));
|
|
|
+ commitData.put(ATTENDANCE_TABLE_TODAYTIME, DateUtils.getDate());
|
|
|
commitData.put(ATTENDANCE_TABLE_LONGITUDE, dto.getLongitude());
|
|
|
commitData.put(ATTENDANCE_TABLE_LATITUDE, dto.getLatitude());
|
|
|
commitData.put(ATTENDANCE_USER_ID, SecurityUtils.getUserId());
|
|
@@ -300,34 +300,40 @@ public class AttendanceServiceImpl implements AttendanceService {
|
|
|
if (checkIsLeave()) {
|
|
|
//
|
|
|
}
|
|
|
- if (checkIsLate(currentTime,type)) {
|
|
|
- commitData.put(ATTENDANCE_ABNORMAL, Y);
|
|
|
- commitData.put(ATTENDANCE_TABLE_LATE, Y);
|
|
|
- }
|
|
|
+
|
|
|
UpdateDto updateDto = new UpdateDto();
|
|
|
JSONObject commitDataUpdate = new JSONObject();
|
|
|
if (GO_TO_WORK_TYPE == type) {
|
|
|
+ if (checkIsLate(currentTime,type)) {
|
|
|
+ commitData.put(ATTENDANCE_ABNORMAL, Y);
|
|
|
+ commitData.put(ATTENDANCE_TABLE_LATE, Y);
|
|
|
+ }
|
|
|
commitData.put(ATTENDANCE_TABLE_WORK, currentTime);
|
|
|
commitDataUpdate.put(ATTENDANCE_TABLE_WORK, currentTime);
|
|
|
} else if (GO_OFF_WORK_TYPE == type) {
|
|
|
commitData.put(ATTENDANCE_TABLE_OFFWORK, currentTime);
|
|
|
commitDataUpdate.put(ATTENDANCE_TABLE_OFFWORK, currentTime);
|
|
|
}else if(GO_TO_WORK_TYPE_PM == type){
|
|
|
+ if (checkIsLate(currentTime,type)) {
|
|
|
+ commitData.put(ATTENDANCE_ABNORMAL, Y);
|
|
|
+ commitData.put(ATTENDANCE_TABLE_LATE, Y);
|
|
|
+ }
|
|
|
commitData.put(ATTENDANCE_TABLE_WORK_PM, currentTime);
|
|
|
commitDataUpdate.put(ATTENDANCE_TABLE_WORK_PM, currentTime);
|
|
|
}else if(GO_OFF_WORK_TYPE_PM == type){
|
|
|
commitData.put(ATTENDANCE_TABLE_OFFWORK_PM, currentTime);
|
|
|
commitDataUpdate.put(ATTENDANCE_TABLE_OFFWORK_PM, currentTime);
|
|
|
}
|
|
|
- JSONObject jsonObject = JSONObjectUtils.putValue(ATTENDANCE_USER_NAME, SecurityUtils.getUsername(), ATTENDANCE_TABLE_TODAYTIME, Lists.newArrayList(DateUtils.getDate()));
|
|
|
+ JSONObject jsonObject = JSONObjectUtils.putValue(ATTENDANCE_USER_NAME, SecurityUtils.getUsername(), ATTENDANCE_TABLE_TODAYTIME, DateUtils.getDate());
|
|
|
JSONObject oneByMap = commonService.getOneByMap(tableName, jsonObject);
|
|
|
if (MapUtils.isEmpty(oneByMap)){
|
|
|
saveClockOn(tableName, commitData);
|
|
|
}else {
|
|
|
Long id = oneByMap.getLong("id");
|
|
|
updateDto.setCommitData(commitDataUpdate);
|
|
|
- JSONObjectUtils.putValue("id",id);
|
|
|
+ JSONObject condition = JSONObjectUtils.putValue("id", id);
|
|
|
updateDto.setTableName(tableName);
|
|
|
+ updateDto.setCondition(condition);
|
|
|
commonService.update(updateDto);
|
|
|
}
|
|
|
return commitData;
|
|
@@ -532,7 +538,7 @@ public class AttendanceServiceImpl implements AttendanceService {
|
|
|
private List<JSONObject> listByUserNameAndTime(String tableName, String userName, String time) {
|
|
|
JSONObject condition = new JSONObject(2);
|
|
|
condition.put(ATTENDANCE_USER_NAME, userName);
|
|
|
- condition.put(ATTENDANCE_TABLE_TODAYTIME, Lists.newArrayList(time));
|
|
|
+ condition.put(ATTENDANCE_TABLE_TODAYTIME, time);
|
|
|
return commonService.getByMap(tableName, condition);
|
|
|
}
|
|
|
|