Resolved Conflicts

This commit is contained in:
harish
2024-10-30 11:08:04 +05:30
21 changed files with 152 additions and 112 deletions

View File

@@ -67,10 +67,10 @@ public class ApplicationAmendmentRequestDao {
@Autowired
private ApplicationEvaluationService applicationEvaluationService;
@Autowired
private ProtocolDao protocolDao;
@Autowired
private AssignedApplicationsService assignedApplicationsService;
@@ -208,11 +208,11 @@ public class ApplicationAmendmentRequestDao {
.collect(Collectors.joining(","));
applicationAmendmentRequestEntity.setFormFields(fieldIdsString);
}
UserEntity userEntity = userService.validateUser(applicationEvaluationId);
UserEntity userEntity = userService.validateUser(applicationEvaluationEntity.getUserId());
Long protocolNumber = protocolDao.getProtocolNumber(userEntity.getHub());
ProtocolEntity protocolEntity = protocolDao.createProtocolEntity(
applicationEvaluationEntity.getAssignedApplicationsEntity().getApplication(), protocolNumber,
userEntity.getHub().getId());
ProtocolEntity protocolEntity = protocolDao.createProtocolEntity(
applicationEvaluationEntity.getAssignedApplicationsEntity().getApplication(), protocolNumber,
userEntity.getHub().getId());
applicationAmendmentRequestEntity.setProtocol(protocolEntity);
applicationAmendmentRequestEntity.setIsEmail(false);
applicationAmendmentRequestEntity.setIsNotification(false);
@@ -303,11 +303,11 @@ public class ApplicationAmendmentRequestDao {
return applicationAmendmentRequestResponse;
}
public ApplicationAmendmentRequestEntity validateApplicationAmendmentRequest(Long id) {
return applicationAmendmentRequestRepository.findByIdAndIsDeletedFalse(id)
.orElseThrow(() -> new ResourceNotFoundException(Status.NOT_FOUND,
Translator.toLocale(GepafinConstant.APPLICATION_AMENDMENT_NOT_FOUND_MSG)));
}
public ApplicationAmendmentRequestEntity validateApplicationAmendmentRequest(Long id) {
return applicationAmendmentRequestRepository.findByIdAndIsDeletedFalse(id)
.orElseThrow(() -> new ResourceNotFoundException(Status.NOT_FOUND,
Translator.toLocale(GepafinConstant.APPLICATION_AMENDMENT_NOT_FOUND_MSG)));
}
public void deleteById(Long id) {
log.info("Deleting assigned application with ID: {}", id);
@@ -444,4 +444,16 @@ public class ApplicationAmendmentRequestDao {
return response;
}
public ApplicationAmendmentRequestResponse extendResponseDays(Long id, Long newResponseDays) {
ApplicationAmendmentRequestEntity request = applicationAmendmentRequestRepository.findByIdAndIsDeletedFalse(id)
.orElseThrow(() -> new ResourceNotFoundException(Status.NOT_FOUND,
Translator.toLocale(GepafinConstant.APPLICATION_AMENDMENT_NOT_FOUND_MSG)));
if (newResponseDays != null && newResponseDays > 0) {
Long currentResponseDays = request.getResponseDays() != null ? request.getResponseDays() : 0L;
request.setResponseDays(currentResponseDays + newResponseDays);
applicationAmendmentRequestRepository.save(request);
}
return convertEntityToResponse(request);
}
}

View File

@@ -115,8 +115,8 @@ public class ApplicationDao {
@Autowired
private ApplicationSignedDocumentRepository applicationSignedDocumentRepository;
@Value("${aws.s3.url.folder.signed.document}")
private String signedDocumentS3Folder;
// @Value("${aws.s3.url.folder.signed.document}")
// private String signedDocumentS3Folder;
@Autowired
private UserService userService;
@@ -611,8 +611,11 @@ public class ApplicationDao {
sendMailToUserAndCompany(userEntity, applicationEntity);
sendMailTodefaultSystemAndGepafin(userEntity, applicationEntity);
applicationEntity.setStatus(status.getValue());
applicationEntity = saveApplicationEntity(applicationEntity);
}
if (status.equals(ApplicationStatusTypeEnum.DRAFT) && Boolean.TRUE.equals(applicationEntity.getStatus().equals(ApplicationStatusTypeEnum.AWAITING.getValue()))) {
applicationEntity.setStatus(status.getValue());
}
applicationEntity = saveApplicationEntity(applicationEntity);
return getApplicationResponse(applicationEntity);

View File

@@ -342,11 +342,18 @@ public class ApplicationEvaluationDao {
response.setCallEndDate(callEndDate);
}
public ApplicationEvaluationResponse createOrUpdateApplicationEvaluation(UserEntity user, ApplicationEvaluationRequest req, Long assignedApplciationId) {
Optional<ApplicationEvaluationEntity> existingEntityOptional = applicationEvaluationRepository.findByAssignedApplicationsEntity_IdAndIsDeletedFalse(assignedApplciationId);
public ApplicationEvaluationResponse createOrUpdateApplicationEvaluation(
UserEntity user,
ApplicationEvaluationRequest req,
Long assignedApplicationId) {
Optional<ApplicationEvaluationEntity> existingEntityOptional =
applicationEvaluationRepository.findByAssignedApplicationsEntity_IdAndIsDeletedFalse(assignedApplicationId);
ApplicationEvaluationEntity entity;
Optional<AssignedApplicationsEntity> assignedApplications=assignedApplicationsRepository.findByIdAndIsDeletedFalse(assignedApplciationId);
Optional<AssignedApplicationsEntity> assignedApplications =
assignedApplicationsRepository.findByIdAndIsDeletedFalse(assignedApplicationId);
if (existingEntityOptional.isPresent()) {
entity = existingEntityOptional.get();
entity.setCriteria(Utils.convertObjectToJson(filterNonNullCriteria(processCriteria(entity, req))));
@@ -355,13 +362,21 @@ public class ApplicationEvaluationDao {
entity.setIsDeleted(false);
setIfUpdated(entity::getNote, entity::setNote, req.getNote());
} else {
entity = convertToEntity(user, req, assignedApplciationId);
entity = convertToEntity(user, req, assignedApplicationId);
}
ApplicationStatusForEvaluation status = req.getApplicationStatus();
ApplicationEvaluationEntity savedEntity = applicationEvaluationRepository.save(entity);
return convertToResponse(savedEntity);
if (status != null) {
ApplicationEntity application = applicationService.validateApplication(assignedApplications.get().getApplication().getId());
AssignedApplicationsEntity assignedApplicationsEntity = assignedApplications.get();
return updateApplicationEvaluationStatus(application, assignedApplicationsEntity, status);
} else {
return convertToResponse(savedEntity);
}
}
private List<ChecklistRequest> filterNonNullChecklist(List<ChecklistRequest> checklistRequests) {
return checklistRequests.stream().filter(request -> request.getValid() != null).collect(Collectors.toList());
@@ -862,17 +877,18 @@ public class ApplicationEvaluationDao {
}
public ApplicationEvaluationResponse updateApplicationEvaluationStatus(ApplicationEntity application, AssignedApplicationsEntity assignedApplicationsEntity,
AssignedEvaluationStatus newStatus) {
ApplicationStatusForEvaluation newStatus) {
Optional<ApplicationEvaluationEntity> existingEntityOptional = applicationEvaluationRepository.findByAssignedApplicationsEntity_IdAndIsDeletedFalse(
assignedApplicationsEntity.getId());
ApplicationEvaluationEntity entity;
String statusType = application.getStatus();
if (existingEntityOptional.isPresent()) {
ApplicationEvaluationEntity existingEntity = existingEntityOptional.get();
application.setStatus(newStatus.getValue());
application = applicationRepository.save(application);
String statusType = application.getStatus();
if (application.getStatus().equals(ApplicationStatusTypeEnum.APPROVED.getValue()) || application.getStatus().equals(ApplicationStatusTypeEnum.REJECTED.getValue())) {
existingEntity.setStatus(ApplicationEvaluationStatusTypeEnum.CLOSE.getValue());
assignedApplicationsEntity.setStatus(AssignedApplicationEnum.CLOSE.getValue());

View File

@@ -21,7 +21,6 @@ import net.gepafin.tendermanagement.util.DateTimeUtil;
import net.gepafin.tendermanagement.util.Utils;
import org.h2.util.IOUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import org.springframework.util.StringUtils;
@@ -94,14 +93,17 @@ public class CallDao {
@Autowired
private FormDao formDao;
@Value("${aws.s3.url.folder}")
private String s3Folder;
// @Value("${aws.s3.url.folder}")
// private String s3Folder;
@Autowired
private AmazonS3Service amazonS3Service;
@Autowired
private CriteriaFormFieldRepository criteriaFormFieldRepository;
@Autowired
private S3PathConfig s3PathConfig;
public CallResponse createCallStep1(CreateCallRequestStep1 createCallRequest, UserEntity userEntity) {
createCallRequest.setRegionId(userEntity.getRoleEntity().getRegion().getId());
@@ -127,6 +129,7 @@ public class CallDao {
ZipOutputStream zos = new ZipOutputStream(zipOutputStream)) {
for (DocumentEntity document : documents) {
String s3Folder = s3PathConfig.generateDocumentPath(DocumentSourceTypeEnum.CALL, callId, 0L);
try (InputStream fileInputStream = amazonS3Service.getFile(s3Folder, document.getFilePath())) {
String fileName = Utils.extractFileName(document.getFilePath());
ZipEntry zipEntry = new ZipEntry(fileName);

View File

@@ -8,10 +8,10 @@ import java.util.Map;
import java.util.function.Function;
import net.gepafin.tendermanagement.enums.DocOtherSourceTypeEnum;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.xwpf.usermodel.XWPFDocument;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import org.springframework.web.multipart.MultipartFile;
@@ -58,8 +58,8 @@ public class DelegationDao {
@Autowired
private S3PathConfig s3ConfigBean;
@Value("${aws.s3.url.folder.delegation}")
private String s3Folder;
// @Value("${aws.s3.url.folder.delegation}")
// private String s3Folder;
@Autowired
private UserCompanyDelegationRepository userCompanyDelegationRepository;
@@ -67,9 +67,9 @@ public class DelegationDao {
@Autowired
private Validator validator;
public ByteArrayOutputStream generateDocument(Map<String, String> placeholders, String templateName) {
try {
String s3Folder = s3ConfigBean.generateDocumentPathForOther(DocOtherSourceTypeEnum.TEMPLATE, 0L, 0L);
InputStream templateStream = amazonS3Service.getFile(s3Folder ,templateName);
XWPFDocument doc = loadTemplate(templateStream);
replacePlaceholders(doc, placeholders);

View File

@@ -7,7 +7,6 @@ import net.gepafin.tendermanagement.enums.DocumentSourceTypeEnum;
import net.gepafin.tendermanagement.repositories.ApplicationRepository;
import net.gepafin.tendermanagement.web.rest.api.errors.CustomValidationException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import org.springframework.web.multipart.MultipartFile;
@@ -49,8 +48,8 @@ public class DocumentDao {
@Autowired
private ApplicationRepository applicationFormRepository;
@Value("${aws.s3.url.folder}")
private String s3Folder;
// @Value("${aws.s3.url.folder}")
// private String s3Folder;
public List<DocumentResponseBean> uploadFiles(List<MultipartFile> files, Long sourceId, DocumentSourceTypeEnum sourceType, DocumentTypeEnum fileType) {
List<DocumentEntity> documentEntities = new ArrayList<>();
@@ -141,7 +140,7 @@ public class DocumentDao {
try {
Long callId;
Long applicationId;
if(type.equals("APPLICATION")){
if(type.equals(DocumentSourceTypeEnum.APPLICATION)){
callId = applicationFormRepository.findCallIdById(id);
applicationId = id;
}else{