Updated code for call end date time updation

This commit is contained in:
nisha
2025-02-27 16:43:07 +05:30
parent 5e43346a26
commit 65a8d6e971
3 changed files with 33 additions and 7 deletions

View File

@@ -571,7 +571,7 @@ public class CallDao {
}
}
public CallResponse updateCallStep1(CallEntity callEntity, UpdateCallRequestStep1 updateCallRequest, UserEntity userEntity) {
public CallResponse updateCallStep1(HttpServletRequest request,CallEntity callEntity, UpdateCallRequestStep1 updateCallRequest, UserEntity userEntity) {
CallEntity oldCallEntity = Utils.getClonedEntityForData(callEntity);
isValidDateRange(updateCallRequest, callEntity);
setIfUpdated(callEntity::getName, callEntity::setName, updateCallRequest.getName());
@@ -580,15 +580,41 @@ public class CallDao {
setIfUpdated(callEntity::getDescriptionLong, callEntity::setDescriptionLong,
updateCallRequest.getDescriptionLong());
List<LocalDateTime> dates=updateCallRequest.getDates();
boolean isEndDateUpdated = false;
boolean isEndTimeUpdated = false;
if (dates != null && dates.size()>1) {
if (dates.size() > 0) {
setIfUpdated(callEntity::getStartDate, callEntity::setStartDate, dates.get(0));
}
if (dates.size() > 1) {
LocalDate requestEndDate = dates.get(1).toLocalDate(); // Extract only the date
LocalDate storedEndDate = callEntity.getEndDate().toLocalDate(); // Extract only the date
if (!requestEndDate.equals(storedEndDate)) { // Check if dates are different
setIfUpdated(callEntity::getEndDate, callEntity::setEndDate, dates.get(1));
isEndDateUpdated = true;
}
}
}
if (updateCallRequest.getEndTime() != null) {
LocalTime requestEndTime = DateTimeUtil.parseTime(updateCallRequest.getEndTime());
LocalTime storedEndTime = callEntity.getEndTime();
if (!requestEndTime.equals(storedEndTime)) {
setIfUpdated(callEntity::getEndTime, callEntity::setEndTime, DateTimeUtil.parseTime(updateCallRequest.getEndTime()));
isEndTimeUpdated = true;
}
}
if (isEndDateUpdated || isEndTimeUpdated) {
loggingUtil.logUserAction(UserActionRequest.builder()
.request(request)
.actionType(UserActionLogsEnum.UPDATE)
.actionContext(UserActionContextEnum.UPDATE_CALL_END_DATE_AND_TIME)
.build());
}
// setIfUpdated(callEntity::getStartDate, callEntity::setStartDate, updateCallRequest.getStartDate());
// setIfUpdated(callEntity::getEndDate, callEntity::setEndDate, updateCallRequest.getEndDate());
setIfUpdated(callEntity::getAmount, callEntity::setAmount, updateCallRequest.getAmount());
@@ -606,7 +632,6 @@ public class CallDao {
setIfUpdated(callEntity::getEmail, callEntity::setEmail, updateCallRequest.getEmail());
setIfUpdated(callEntity::getPhoneNumber, callEntity::setPhoneNumber, updateCallRequest.getPhoneNumber());
setIfUpdated(callEntity::getStartTime, callEntity::setStartTime, DateTimeUtil.parseTime(updateCallRequest.getStartTime()));
setIfUpdated(callEntity::getEndTime, callEntity::setEndTime, DateTimeUtil.parseTime(updateCallRequest.getEndTime()));
setIfUpdated(callEntity::getConfidi, callEntity::setConfidi, updateCallRequest.getConfidi());
setIfUpdated(callEntity::getEvaluationVersion, callEntity::setEvaluationVersion, updateCallRequest.getEvaluationVersion().getValue());
setIfUpdated(callEntity::getNumberOfCheck, callEntity::setNumberOfCheck, updateCallRequest.getNumberOfCheck());

View File

@@ -211,7 +211,8 @@ public enum UserActionContextEnum {
GET_ALL_ASSIGNED_APPLICATION_BY_PAGINATION("GET_ALL_ASSIGNED_APPLICATION_BY_PAGINATION"),
GET_ALL_APPLICATION_AMENDMENT_BY_PAGINATION("GET_ALL_APPLICATION_AMENDMENT_BY_PAGINATION"),
GET_ALL_USER_ACTION_BY_PAGINATION("GET_ALL_USER_ACTION_BY_PAGINATION"),
GET_ALL_USER_BY_PAGINATION("GET_ALL_USER_BY_PAGINATION");
GET_ALL_USER_BY_PAGINATION("GET_ALL_USER_BY_PAGINATION"),
UPDATE_CALL_END_DATE_AND_TIME("UPDATE_CALL_END_DATE_AND_TIME");
private final String value;

View File

@@ -50,7 +50,7 @@ public class CallServiceImpl implements CallService {
UpdateCallRequestStep1 updateCallRequest) {
UserEntity user = validator.validateUser(request);
CallEntity call = validator.validateUserWithCall(user, callId);
return callDao.updateCallStep1(call, updateCallRequest, user);
return callDao.updateCallStep1(request,call, updateCallRequest, user);
}
@Override
@Transactional(readOnly = true)