Resolved conflicts for GEPAFINBE-31.

This commit is contained in:
piyushkag
2024-11-25 19:10:24 +05:30
61 changed files with 1473 additions and 601 deletions

View File

@@ -10,6 +10,7 @@ import net.gepafin.tendermanagement.entities.FaqEntity;
import net.gepafin.tendermanagement.entities.UserEntity;
import net.gepafin.tendermanagement.enums.ApplicationStatusTypeEnum;
import net.gepafin.tendermanagement.enums.AssignedApplicationEnum;
import net.gepafin.tendermanagement.model.request.ApplicationEvaluationRequest;
import net.gepafin.tendermanagement.enums.VersionActionTypeEnum;
import net.gepafin.tendermanagement.model.request.AssignedApplicationsRequest;
import net.gepafin.tendermanagement.model.request.VersionHistoryRequest;
@@ -53,6 +54,10 @@ public class AssignedApplicationsDao {
@Autowired
private Validator validator;
@Autowired
private ApplicationEvaluationDao applicationEvaluationDao;
@Autowired
private LoggingUtil loggingUtil;
@@ -85,7 +90,7 @@ public class AssignedApplicationsDao {
UserEntity user = userService.validateUser(userId);
AssignedApplicationsEntity assignment = createAssignmentEntity(application, user.getId(), assignedByUser, assignedApplicationsRequest);
AssignedApplicationsResponse assignApplicationToInstructorResponse = convertEntityToResponse(assignment);
applicationEvaluationDao.createOrUpdateApplicationEvaluation(user, new ApplicationEvaluationRequest(), assignApplicationToInstructorResponse.getId());
log.info("Application assigned succesfully {}", assignApplicationToInstructorResponse);
return assignApplicationToInstructorResponse;
}
@@ -150,6 +155,7 @@ public class AssignedApplicationsDao {
assignedApplicationsResponse.setAssignedAt(assignedApplications.getAssignedAt());
assignedApplicationsResponse.setProtocolNumber(protocolNumber);
assignedApplicationsResponse.setCallName(callName);
assignedApplicationsResponse.setCompanyName(application.getCompany().getCompanyName());
assignedApplicationsResponse.setBeneficiaryName(beneficiaryName);
assignedApplicationsResponse.setSubmissionDate(submissionDate);
assignedApplicationsResponse.setCallEndDate(callEndDate);
@@ -174,31 +180,34 @@ public class AssignedApplicationsDao {
log.info("Assigned Application deleted with ID: {}", id);
}
public List<AssignedApplicationsResponse> getAllAssignedApplications(HttpServletRequest request, Long userId) {
UserEntity user = validator.validateUser(request);
if (validator.checkIsPreInstructor() && userId == null) {
throw new CustomValidationException(Status.BAD_REQUEST, Translator.toLocale(GepafinConstant.USER_ID_NOT_NULL_MSG));
public List<AssignedApplicationsResponse> getAllAssignedApplications(HttpServletRequest request, Long userId) {
UserEntity user = validator.validateUser(request);
if(validator.checkIsPreInstructor() && userId == null) {
throw new CustomValidationException(Status.BAD_REQUEST, Translator.toLocale(GepafinConstant.USER_ID_NOT_NULL_MSG));
}
if(userId != null) {
validator.validatePreInstructor(request, userId);
}
Specification<AssignedApplicationsEntity> spec = search(user.getHub().getId() ,userId);
List<AssignedApplicationsEntity> assignedApplicationsEntityList = assignedApplicationsRepository.findAll(spec);
return assignedApplicationsEntityList.stream()
.map(entity -> convertEntityToResponse(entity))
.collect(Collectors.toList());
}
if (userId != null) {
validator.validatePreInstructor(request, userId);
private Specification<AssignedApplicationsEntity> search(Long hubId, Long userId) {
return (root, query, builder) -> {
Predicate predicate = builder.isFalse(root.get("isDeleted"));
if (userId != null) {
predicate = builder.and(predicate, builder.equal(root.get("userId"), userId));
}
query.orderBy(
builder.desc(builder.isNotNull(root.get(GepafinConstant.ASSIGNED_AT))),
builder.desc(root.get(GepafinConstant.ASSIGNED_AT))
);
predicate = builder.and(predicate, builder.equal(root.get("application").get("hubId"), hubId));
return predicate;
};
}
Specification<AssignedApplicationsEntity> spec = search(user.getHub().getId(), userId);
List<AssignedApplicationsEntity> assignedApplicationsEntityList = assignedApplicationsRepository.findAll(spec);
return assignedApplicationsEntityList.stream()
.map(entity -> convertEntityToResponse(entity))
.collect(Collectors.toList());
}
private Specification<AssignedApplicationsEntity> search(Long hubId, Long userId) {
return (root, query, builder) -> {
Predicate predicate = builder.isFalse(root.get("isDeleted"));
if (userId != null) {
predicate = builder.and(predicate, builder.equal(root.get("userId"), userId));
}
predicate = builder.and(predicate, builder.equal(root.get("application").get("hubId"), hubId));
return predicate;
};
}
public AssignedApplicationsResponse updateAssignedApplication(HttpServletRequest request,