Resolved conflicts
This commit is contained in:
@@ -101,6 +101,6 @@ public class GepafinConstant {
|
|||||||
public static final String STATUS_SAME_ERROR = "status.same.error";
|
public static final String STATUS_SAME_ERROR = "status.same.error";
|
||||||
public static final String INVALID_STATUS_CHANGE_FROM_DRAFT = "invalid.status.change.from.draft";
|
public static final String INVALID_STATUS_CHANGE_FROM_DRAFT = "invalid.status.change.from.draft";
|
||||||
public static final String STATUS_CANNOT_BE_CHANGED = "status.cannot.be.changed";
|
public static final String STATUS_CANNOT_BE_CHANGED = "status.cannot.be.changed";
|
||||||
public static final String INVALID_STATUS_TRANSITION = "invalid.status.transition";
|
public static final String PUBLISHED_CALL_NOT_UPDATE = "published.call.not.update";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
package net.gepafin.tendermanagement.dao;
|
package net.gepafin.tendermanagement.dao;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@@ -8,7 +7,6 @@ import java.util.List;
|
|||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import net.gepafin.tendermanagement.enums.UserStatusEnum;
|
|
||||||
import net.gepafin.tendermanagement.model.response.*;
|
import net.gepafin.tendermanagement.model.response.*;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
@@ -78,8 +76,10 @@ public class CallDao {
|
|||||||
private UserService userService;
|
private UserService userService;
|
||||||
|
|
||||||
public CallResponse createCallStep1(CreateCallRequestStep1 createCallRequest, Long userId) {
|
public CallResponse createCallStep1(CreateCallRequestStep1 createCallRequest, Long userId) {
|
||||||
|
UserEntity userEntity = userService.validateUser(userId);
|
||||||
|
createCallRequest.setRegionId(userEntity.getRoleEntity().getRegion().getId());
|
||||||
CallEntity callEntity = convertToCallEntity(createCallRequest);
|
CallEntity callEntity = convertToCallEntity(createCallRequest);
|
||||||
convertToFaqEntities(createCallRequest.getFaq(), callEntity, userId);
|
convertToFaqEntities(createCallRequest.getFaq(), callEntity, userEntity,LookUpDataTypeEnum.FAQ);
|
||||||
convertLookUpDataEntities(createCallRequest.getAimedTo(), callEntity,
|
convertLookUpDataEntities(createCallRequest.getAimedTo(), callEntity,
|
||||||
LookUpDataTypeEnum.AIMED_TO);
|
LookUpDataTypeEnum.AIMED_TO);
|
||||||
// createCallResponseBean = assembleCreateCallResponseBean(callEntity, Collections.emptyList(),
|
// createCallResponseBean = assembleCreateCallResponseBean(callEntity, Collections.emptyList(),
|
||||||
@@ -94,7 +94,7 @@ public class CallDao {
|
|||||||
|
|
||||||
public CallEntity convertToCallEntity(CreateCallRequestStep1 createCallRequest) {
|
public CallEntity convertToCallEntity(CreateCallRequestStep1 createCallRequest) {
|
||||||
CallEntity callEntity = new CallEntity();
|
CallEntity callEntity = new CallEntity();
|
||||||
validateCallEntity(createCallRequest);
|
// validateCallEntity(createCallRequest);
|
||||||
RegionEntity region = regionRepository.findById(createCallRequest.getRegionId())
|
RegionEntity region = regionRepository.findById(createCallRequest.getRegionId())
|
||||||
.orElseThrow(() -> new ResourceNotFoundException(Status.VALIDATION_ERROR,
|
.orElseThrow(() -> new ResourceNotFoundException(Status.VALIDATION_ERROR,
|
||||||
Translator.toLocale(GepafinConstant.REGION_NOT_FOUND)));
|
Translator.toLocale(GepafinConstant.REGION_NOT_FOUND)));
|
||||||
@@ -102,8 +102,13 @@ public class CallDao {
|
|||||||
callEntity.setName(createCallRequest.getName());
|
callEntity.setName(createCallRequest.getName());
|
||||||
callEntity.setDescriptionShort(createCallRequest.getDescriptionShort());
|
callEntity.setDescriptionShort(createCallRequest.getDescriptionShort());
|
||||||
callEntity.setDescriptionLong(createCallRequest.getDescriptionLong());
|
callEntity.setDescriptionLong(createCallRequest.getDescriptionLong());
|
||||||
callEntity.setStartDate(createCallRequest.getStartDate());
|
List<LocalDateTime> dates = createCallRequest.getDates();
|
||||||
callEntity.setEndDate(createCallRequest.getEndDate());
|
if(dates!=null) {
|
||||||
|
if(dates.size()>1) {
|
||||||
|
callEntity.setStartDate(dates.get(0));
|
||||||
|
callEntity.setEndDate(dates.get(1));
|
||||||
|
}
|
||||||
|
}
|
||||||
callEntity.setStatus(CallStatusEnum.DRAFT.getValue());
|
callEntity.setStatus(CallStatusEnum.DRAFT.getValue());
|
||||||
callEntity.setAmountMax(createCallRequest.getAmountMax());
|
callEntity.setAmountMax(createCallRequest.getAmountMax());
|
||||||
callEntity.setAmount(createCallRequest.getAmountMax());
|
callEntity.setAmount(createCallRequest.getAmountMax());
|
||||||
@@ -143,7 +148,7 @@ public class CallDao {
|
|||||||
CallEntity callEntity, LookUpDataTypeEnum type) {
|
CallEntity callEntity, LookUpDataTypeEnum type) {
|
||||||
EvaluationCriteriaEntity criteriaEntity = null;
|
EvaluationCriteriaEntity criteriaEntity = null;
|
||||||
LookUpDataEntity lookupDataEntity = convertLookUpDataRequestIntoLookUpDataEntity(criteriaReq, type);
|
LookUpDataEntity lookupDataEntity = convertLookUpDataRequestIntoLookUpDataEntity(criteriaReq, type);
|
||||||
if (criteriaReq.getId() == null && criteriaReq.getId().equals(0l)) {
|
if (criteriaReq.getId() != null && criteriaReq.getId() > 0) {
|
||||||
criteriaEntity = evaluationCriteriaRepository.findById(criteriaReq.getId())
|
criteriaEntity = evaluationCriteriaRepository.findById(criteriaReq.getId())
|
||||||
.orElseThrow(() -> new ResourceNotFoundException(Status.VALIDATION_ERROR,
|
.orElseThrow(() -> new ResourceNotFoundException(Status.VALIDATION_ERROR,
|
||||||
Translator.toLocale(GepafinConstant.EVALUATION_CRITERIA_NOT_FOUND)));
|
Translator.toLocale(GepafinConstant.EVALUATION_CRITERIA_NOT_FOUND)));
|
||||||
@@ -194,22 +199,33 @@ public class CallDao {
|
|||||||
return documentEntity;
|
return documentEntity;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<FaqEntity> convertToFaqEntities(List<FaqReq> faqReqList, CallEntity callEntity, Long userId) {
|
public List<FaqEntity> convertToFaqEntities(List<FaqReq> faqReqList, CallEntity callEntity, UserEntity userEntity, LookUpDataTypeEnum type) {
|
||||||
if (faqReqList == null) {
|
if (faqReqList == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
List<FaqEntity> faqEntities = faqReqList.stream().map(req -> convertToFaqEntity(req, callEntity, userId))
|
List<FaqEntity> existingFaqEntities = faqRepository.findByCallIdAndLookupDataTypeAndIsDeletedFalse(callEntity.getId(), type.getValue());
|
||||||
|
List<Long> incomingIds = faqReqList.stream()
|
||||||
|
.map(FaqReq::getId)
|
||||||
|
.filter(id -> id != null && id > 0)
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
existingFaqEntities.stream()
|
||||||
|
.filter(entity -> !incomingIds.contains(entity.getId()))
|
||||||
|
.forEach(this::softDeleteFaq);
|
||||||
|
List<FaqEntity> faqEntities = faqReqList.stream()
|
||||||
|
.map(req -> convertToFaqEntity(req, callEntity, userEntity, type))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
faqRepository.saveAll(faqEntities);
|
faqRepository.saveAll(faqEntities);
|
||||||
return faqEntities;
|
return faqEntities;
|
||||||
}
|
}
|
||||||
|
|
||||||
public FaqEntity convertToFaqEntity(FaqReq faqReq, CallEntity callEntity, Long userId) {
|
|
||||||
|
public FaqEntity convertToFaqEntity(FaqReq faqReq, CallEntity callEntity, UserEntity userEntity,LookUpDataTypeEnum type) {
|
||||||
FaqEntity faqEntity = new FaqEntity();
|
FaqEntity faqEntity = new FaqEntity();
|
||||||
|
LookUpDataEntity lookupDataEntity = convertLookUpDataRequestIntoLookUpDataEntity(faqReq, type);
|
||||||
validateFaqEntity(faqReq.getQuestion());
|
validateFaqEntity(faqReq.getQuestion());
|
||||||
UserEntity userEntity = userService.validateUser(userId);
|
|
||||||
faqEntity.setUser(userEntity);
|
faqEntity.setUser(userEntity);
|
||||||
faqEntity.setIsVisible(true);
|
faqEntity.setIsVisible(false);
|
||||||
|
faqEntity.setLookupData(lookupDataEntity);
|
||||||
if (faqReq.getIsVisible() != null) {
|
if (faqReq.getIsVisible() != null) {
|
||||||
faqEntity.setIsVisible(faqReq.getIsVisible());
|
faqEntity.setIsVisible(faqReq.getIsVisible());
|
||||||
}
|
}
|
||||||
@@ -233,7 +249,7 @@ public class CallDao {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void validateDocumentEntity(Long documentId) {
|
public void validateDocumentEntity(Long documentId) {
|
||||||
if (documentId == null) {
|
if (documentId == null || documentId < 1) {
|
||||||
throw new CustomValidationException(Status.VALIDATION_ERROR,
|
throw new CustomValidationException(Status.VALIDATION_ERROR,
|
||||||
Translator.toLocale(GepafinConstant.DOCUMENT_ID_NOT_FOUND));
|
Translator.toLocale(GepafinConstant.DOCUMENT_ID_NOT_FOUND));
|
||||||
}
|
}
|
||||||
@@ -246,32 +262,34 @@ public class CallDao {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void validateCallEntity(CreateCallRequestStep1 createCallRequest) {
|
// public void validateCallEntity(CreateCallRequestStep1 createCallRequest) {
|
||||||
if (createCallRequest.getRegionId() == null) {
|
// if (createCallRequest.getRegionId() == null) {
|
||||||
throw new CustomValidationException(Status.VALIDATION_ERROR,
|
// throw new CustomValidationException(Status.VALIDATION_ERROR,
|
||||||
Translator.toLocale(GepafinConstant.REGION_NOT_FOUND_MSG));
|
// Translator.toLocale(GepafinConstant.REGION_NOT_FOUND_MSG));
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
if (createCallRequest.getAmount().compareTo(BigDecimal.ZERO) <= 0
|
// if (createCallRequest.getAmount().compareTo(BigDecimal.ZERO) <= 0
|
||||||
|| createCallRequest.getAmountMax().compareTo(BigDecimal.ZERO) <= 0) {
|
// || createCallRequest.getAmountMax().compareTo(BigDecimal.ZERO) <= 0) {
|
||||||
throw new CustomValidationException(Status.VALIDATION_ERROR,
|
// throw new CustomValidationException(Status.VALIDATION_ERROR,
|
||||||
Translator.toLocale(GepafinConstant.AMOUNT_GREATER_THAN_ZERO_MSG));
|
// Translator.toLocale(GepafinConstant.AMOUNT_GREATER_THAN_ZERO_MSG));
|
||||||
}
|
// }
|
||||||
if (createCallRequest.getStartDate().toLocalDate().isBefore(LocalDate.now())
|
// if (createCallRequest.getStartDate().toLocalDate().isBefore(LocalDate.now())
|
||||||
|| createCallRequest.getEndDate().toLocalDate().isBefore(LocalDate.now()) || createCallRequest
|
// || createCallRequest.getEndDate().toLocalDate().isBefore(LocalDate.now()) || createCallRequest
|
||||||
.getStartDate().toLocalDate().isAfter(createCallRequest.getEndDate().toLocalDate())) {
|
// .getStartDate().toLocalDate().isAfter(createCallRequest.getEndDate().toLocalDate())) {
|
||||||
throw new CustomValidationException(Status.VALIDATION_ERROR,
|
// throw new CustomValidationException(Status.VALIDATION_ERROR,
|
||||||
Translator.toLocale(GepafinConstant.INVALID_DATE_MSG));
|
// Translator.toLocale(GepafinConstant.INVALID_DATE_MSG));
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
}
|
// }
|
||||||
|
|
||||||
public CallResponse convertToCallResponseBean(CallEntity callEntity) {
|
public CallResponse convertToCallResponseBean(CallEntity callEntity) {
|
||||||
CallResponse createCallResponseBean = new CallResponse();
|
CallResponse createCallResponseBean = new CallResponse();
|
||||||
createCallResponseBean.setId(callEntity.getId());
|
createCallResponseBean.setId(callEntity.getId());
|
||||||
createCallResponseBean.setName(callEntity.getName());
|
createCallResponseBean.setName(callEntity.getName());
|
||||||
createCallResponseBean.setStartDate(callEntity.getStartDate());
|
List<LocalDateTime> dates = new ArrayList<>();
|
||||||
createCallResponseBean.setEndDate(callEntity.getEndDate());
|
dates.add(callEntity.getStartDate());
|
||||||
|
dates.add(callEntity.getEndDate());
|
||||||
|
createCallResponseBean.setDates(dates);
|
||||||
createCallResponseBean.setDescriptionShort(callEntity.getDescriptionShort());
|
createCallResponseBean.setDescriptionShort(callEntity.getDescriptionShort());
|
||||||
createCallResponseBean.setDescriptionLong(callEntity.getDescriptionLong());
|
createCallResponseBean.setDescriptionLong(callEntity.getDescriptionLong());
|
||||||
createCallResponseBean.setStatus(CallStatusEnum.valueOf(callEntity.getStatus()));
|
createCallResponseBean.setStatus(CallStatusEnum.valueOf(callEntity.getStatus()));
|
||||||
@@ -281,7 +299,7 @@ public class CallDao {
|
|||||||
createCallResponseBean.setContactInfo(callEntity.getContactInfo());
|
createCallResponseBean.setContactInfo(callEntity.getContactInfo());
|
||||||
createCallResponseBean.setSubmissionMethod(callEntity.getSubmissionMethod());
|
createCallResponseBean.setSubmissionMethod(callEntity.getSubmissionMethod());
|
||||||
createCallResponseBean.setThreshold(callEntity.getThreshold());
|
createCallResponseBean.setThreshold(callEntity.getThreshold());
|
||||||
createCallResponseBean.setDocumentationReqested(callEntity.getDocumentationRequested());
|
createCallResponseBean.setDocumentationRequested(callEntity.getDocumentationRequested());
|
||||||
createCallResponseBean.setPriorityArea(callEntity.getPriorityArea());
|
createCallResponseBean.setPriorityArea(callEntity.getPriorityArea());
|
||||||
createCallResponseBean.setConfidi(callEntity.getConfidi());
|
createCallResponseBean.setConfidi(callEntity.getConfidi());
|
||||||
createCallResponseBean.setCreatedDate(callEntity.getCreatedDate());
|
createCallResponseBean.setCreatedDate(callEntity.getCreatedDate());
|
||||||
@@ -315,6 +333,9 @@ public class CallDao {
|
|||||||
public FaqResponseBean convertToFaqResponseBean(FaqEntity entity) {
|
public FaqResponseBean convertToFaqResponseBean(FaqEntity entity) {
|
||||||
FaqResponseBean responseBean = new FaqResponseBean();
|
FaqResponseBean responseBean = new FaqResponseBean();
|
||||||
responseBean.setId(entity.getId());
|
responseBean.setId(entity.getId());
|
||||||
|
responseBean.setLookUpDataId(entity.getLookupData().getId());
|
||||||
|
responseBean.setValue(entity.getLookupData().getValue());
|
||||||
|
responseBean.setTitle(entity.getLookupData().getTitle());
|
||||||
responseBean.setQuestionShort(entity.getQuestionShort());
|
responseBean.setQuestionShort(entity.getQuestionShort());
|
||||||
responseBean.setResponseShort(entity.getResponseShort());
|
responseBean.setResponseShort(entity.getResponseShort());
|
||||||
responseBean.setResponse(entity.getResponse());
|
responseBean.setResponse(entity.getResponse());
|
||||||
@@ -353,6 +374,9 @@ public class CallDao {
|
|||||||
|
|
||||||
public List<LookUpDataResponse> convertLookUpDataEntities(List<LookUpDataReq> lookUpData, CallEntity callEntity,
|
public List<LookUpDataResponse> convertLookUpDataEntities(List<LookUpDataReq> lookUpData, CallEntity callEntity,
|
||||||
LookUpDataEntity.LookUpDataTypeEnum type) {
|
LookUpDataEntity.LookUpDataTypeEnum type) {
|
||||||
|
if(lookUpData == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
List<LookUpDataEntity> lookUpDataEntities = lookUpData.stream()
|
List<LookUpDataEntity> lookUpDataEntities = lookUpData.stream()
|
||||||
.map(req -> convertLookUpDataRequestIntoLookUpDataEntity(req, type)).collect(Collectors.toList());
|
.map(req -> convertLookUpDataRequestIntoLookUpDataEntity(req, type)).collect(Collectors.toList());
|
||||||
|
|
||||||
@@ -418,7 +442,7 @@ public class CallDao {
|
|||||||
CallEntity callEntity = callRepository.findById(callId)
|
CallEntity callEntity = callRepository.findById(callId)
|
||||||
.orElseThrow(() -> new CustomValidationException(Status.VALIDATION_ERROR,
|
.orElseThrow(() -> new CustomValidationException(Status.VALIDATION_ERROR,
|
||||||
Translator.toLocale(GepafinConstant.CALL_NOT_FOUND)));
|
Translator.toLocale(GepafinConstant.CALL_NOT_FOUND)));
|
||||||
|
validateUpdate(callEntity);
|
||||||
setIfUpdated(callEntity::getThreshold, callEntity::setThreshold, createCallRequest.getThreshold());
|
setIfUpdated(callEntity::getThreshold, callEntity::setThreshold, createCallRequest.getThreshold());
|
||||||
callRepository.save(callEntity);
|
callRepository.save(callEntity);
|
||||||
convertToEvaluationCriteriaEntities(createCallRequest.getCriteria(), callEntity, LookUpDataTypeEnum.EVALUATION_CRITERIA);
|
convertToEvaluationCriteriaEntities(createCallRequest.getCriteria(), callEntity, LookUpDataTypeEnum.EVALUATION_CRITERIA);
|
||||||
@@ -442,11 +466,24 @@ public class CallDao {
|
|||||||
return createCallResponseBean;
|
return createCallResponseBean;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void validateUpdate(CallEntity callEntity) {
|
||||||
|
if(callEntity.getStatus().equals(CallStatusEnum.PUBLISH.getValue())) {
|
||||||
|
throw new CustomValidationException(Status.VALIDATION_ERROR,
|
||||||
|
Translator.toLocale(GepafinConstant.PUBLISHED_CALL_NOT_UPDATE));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void isValidDateRange(UpdateCallRequestStep1 updateCallRequest, CallEntity callEntity) {
|
public void isValidDateRange(UpdateCallRequestStep1 updateCallRequest, CallEntity callEntity) {
|
||||||
LocalDate startDate = updateCallRequest.getStartDate() != null ? updateCallRequest.getStartDate().toLocalDate()
|
List<LocalDateTime> dates = updateCallRequest.getDates();
|
||||||
|
|
||||||
|
LocalDate startDate = (dates != null && dates.size() > 0 && dates.get(0) != null)
|
||||||
|
? dates.get(0).toLocalDate()
|
||||||
: null;
|
: null;
|
||||||
LocalDate endDate = updateCallRequest.getEndDate() != null ? updateCallRequest.getEndDate().toLocalDate()
|
|
||||||
|
LocalDate endDate = (dates != null && dates.size() > 1 && dates.get(1) != null)
|
||||||
|
? dates.get(1).toLocalDate()
|
||||||
: null;
|
: null;
|
||||||
|
|
||||||
Boolean isValid = true;
|
Boolean isValid = true;
|
||||||
if (startDate != null && endDate != null && startDate.isAfter(endDate)) {
|
if (startDate != null && endDate != null && startDate.isAfter(endDate)) {
|
||||||
isValid = false;
|
isValid = false;
|
||||||
@@ -473,21 +510,31 @@ public class CallDao {
|
|||||||
updateCallRequest.getDescriptionShort());
|
updateCallRequest.getDescriptionShort());
|
||||||
setIfUpdated(callEntity::getDescriptionLong, callEntity::setDescriptionLong,
|
setIfUpdated(callEntity::getDescriptionLong, callEntity::setDescriptionLong,
|
||||||
updateCallRequest.getDescriptionLong());
|
updateCallRequest.getDescriptionLong());
|
||||||
setIfUpdated(callEntity::getStartDate, callEntity::setStartDate, updateCallRequest.getStartDate());
|
List<LocalDateTime> dates=updateCallRequest.getDates();
|
||||||
setIfUpdated(callEntity::getEndDate, callEntity::setEndDate, updateCallRequest.getEndDate());
|
|
||||||
|
if (dates != null && dates.size()>1) {
|
||||||
|
if (dates.size() > 0) {
|
||||||
|
setIfUpdated(callEntity::getStartDate, callEntity::setStartDate, dates.get(0));
|
||||||
|
}
|
||||||
|
if (dates.size() > 1) {
|
||||||
|
setIfUpdated(callEntity::getEndDate, callEntity::setEndDate, dates.get(1));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// setIfUpdated(callEntity::getStartDate, callEntity::setStartDate, updateCallRequest.getStartDate());
|
||||||
|
// setIfUpdated(callEntity::getEndDate, callEntity::setEndDate, updateCallRequest.getEndDate());
|
||||||
setIfUpdated(callEntity::getAmount, callEntity::setAmount, updateCallRequest.getAmount());
|
setIfUpdated(callEntity::getAmount, callEntity::setAmount, updateCallRequest.getAmount());
|
||||||
setIfUpdated(callEntity::getAmountMax, callEntity::setAmountMax, updateCallRequest.getAmountMax());
|
setIfUpdated(callEntity::getAmountMax, callEntity::setAmountMax, updateCallRequest.getAmountMax());
|
||||||
setIfUpdated(callEntity::getDocumentationRequested, callEntity::setDocumentationRequested,
|
setIfUpdated(callEntity::getDocumentationRequested, callEntity::setDocumentationRequested,
|
||||||
updateCallRequest.getDocumentationRequested());
|
updateCallRequest.getDocumentationRequested());
|
||||||
setIfUpdated(callEntity::getConfidi, callEntity::setConfidi, updateCallRequest.getConfidi());
|
setIfUpdated(callEntity::getConfidi, callEntity::setConfidi, updateCallRequest.getConfidi());
|
||||||
updateLookUpData(callEntity, updateCallRequest.getAimedTo(), LookUpDataTypeEnum.AIMED_TO);
|
updateLookUpData(callEntity, updateCallRequest.getAimedTo(), LookUpDataTypeEnum.AIMED_TO);
|
||||||
updateFaq(callEntity, updateCallRequest.getFaq(), userEntity);
|
updateFaq(callEntity, updateCallRequest.getFaq(), userEntity, LookUpDataTypeEnum.FAQ);
|
||||||
CallResponse createCallResponseBean = getCallResponseBean(callEntity);
|
CallResponse createCallResponseBean = getCallResponseBean(callEntity);
|
||||||
createCallResponseBean.setCurrentStep(GepafinConstant.STEP_1);
|
createCallResponseBean.setCurrentStep(GepafinConstant.STEP_1);
|
||||||
return createCallResponseBean;
|
return createCallResponseBean;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateFaq(CallEntity callEntity, List<FaqReq> faqReqList, UserEntity userEntity) {
|
private void updateFaq(CallEntity callEntity, List<FaqReq> faqReqList, UserEntity userEntity, LookUpDataTypeEnum type) {
|
||||||
if (faqReqList == null) {
|
if (faqReqList == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -495,7 +542,7 @@ public class CallDao {
|
|||||||
List<Long> incomingIds = faqReqList.stream().map(FaqReq::getId).filter(Objects::nonNull).filter(id -> id > 0)
|
List<Long> incomingIds = faqReqList.stream().map(FaqReq::getId).filter(Objects::nonNull).filter(id -> id > 0)
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
existingFaqs.stream().filter(faq -> !incomingIds.contains(faq.getId())).forEach(this::softDeleteFaq);
|
existingFaqs.stream().filter(faq -> !incomingIds.contains(faq.getId())).forEach(this::softDeleteFaq);
|
||||||
faqReqList.forEach(faqReq -> createOrUpdateFaq(faqReq, callEntity, userEntity));
|
faqReqList.forEach(faqReq -> createOrUpdateFaq(faqReq, callEntity, userEntity, type));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -504,9 +551,11 @@ public class CallDao {
|
|||||||
faqRepository.save(faqEntity);
|
faqRepository.save(faqEntity);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createOrUpdateFaq(FaqReq faqReq, CallEntity callEntity, UserEntity userEntity) {
|
private void createOrUpdateFaq(FaqReq faqReq, CallEntity callEntity, UserEntity userEntity, LookUpDataTypeEnum type) {
|
||||||
FaqEntity faqEntity = null;
|
FaqEntity faqEntity = null;
|
||||||
|
|
||||||
|
LookUpDataEntity lookupDataEntity = convertLookUpDataRequestIntoLookUpDataEntity(faqReq, type);
|
||||||
|
|
||||||
if (isExistingFaq(faqReq)) {
|
if (isExistingFaq(faqReq)) {
|
||||||
faqEntity = faqRepository.findById(faqReq.getId())
|
faqEntity = faqRepository.findById(faqReq.getId())
|
||||||
.orElseThrow(() -> new ResourceNotFoundException(Status.VALIDATION_ERROR,
|
.orElseThrow(() -> new ResourceNotFoundException(Status.VALIDATION_ERROR,
|
||||||
@@ -515,9 +564,14 @@ public class CallDao {
|
|||||||
faqEntity = new FaqEntity();
|
faqEntity = new FaqEntity();
|
||||||
faqEntity.setCall(callEntity);
|
faqEntity.setCall(callEntity);
|
||||||
faqEntity.setUser(userEntity);
|
faqEntity.setUser(userEntity);
|
||||||
|
faqEntity.setLookupData(lookupDataEntity);
|
||||||
|
faqEntity.setIsVisible(false);
|
||||||
faqEntity.setIsDeleted(false);
|
faqEntity.setIsDeleted(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Boolean.FALSE.equals(faqEntity.getLookupData().getId().equals(lookupDataEntity.getId()))) {
|
||||||
|
faqEntity.setLookupData(lookupDataEntity);
|
||||||
|
}
|
||||||
setIfUpdated(faqEntity::getQuestionShort, faqEntity::setQuestionShort, faqReq.getQuestionShort());
|
setIfUpdated(faqEntity::getQuestionShort, faqEntity::setQuestionShort, faqReq.getQuestionShort());
|
||||||
setIfUpdated(faqEntity::getQuestion, faqEntity::setQuestion, faqReq.getQuestion());
|
setIfUpdated(faqEntity::getQuestion, faqEntity::setQuestion, faqReq.getQuestion());
|
||||||
setIfUpdated(faqEntity::getResponseShort, faqEntity::setResponseShort, faqReq.getResponseShort());
|
setIfUpdated(faqEntity::getResponseShort, faqEntity::setResponseShort, faqReq.getResponseShort());
|
||||||
@@ -577,7 +631,10 @@ public class CallDao {
|
|||||||
CallDetailsResponseBean callDetailsResponseBean = new CallDetailsResponseBean();
|
CallDetailsResponseBean callDetailsResponseBean = new CallDetailsResponseBean();
|
||||||
callDetailsResponseBean.setId(callEntity.getId());
|
callDetailsResponseBean.setId(callEntity.getId());
|
||||||
callDetailsResponseBean.setName(callEntity.getName());
|
callDetailsResponseBean.setName(callEntity.getName());
|
||||||
callDetailsResponseBean.setDates(List.of(callEntity.getStartDate(), callEntity.getEndDate()));
|
List<LocalDateTime> dates = new ArrayList<>();
|
||||||
|
dates.add(callEntity.getStartDate());
|
||||||
|
dates.add(callEntity.getEndDate());
|
||||||
|
callDetailsResponseBean.setDates(dates);
|
||||||
callDetailsResponseBean.setDescriptionShort(callEntity.getDescriptionShort());
|
callDetailsResponseBean.setDescriptionShort(callEntity.getDescriptionShort());
|
||||||
callDetailsResponseBean.setDescriptionLong(callEntity.getDescriptionLong());
|
callDetailsResponseBean.setDescriptionLong(callEntity.getDescriptionLong());
|
||||||
callDetailsResponseBean.setStatus(CallStatusEnum.valueOf(callEntity.getStatus()));
|
callDetailsResponseBean.setStatus(CallStatusEnum.valueOf(callEntity.getStatus()));
|
||||||
@@ -587,7 +644,7 @@ public class CallDao {
|
|||||||
callDetailsResponseBean.setContactInfo(callEntity.getContactInfo());
|
callDetailsResponseBean.setContactInfo(callEntity.getContactInfo());
|
||||||
callDetailsResponseBean.setSubmissionMethod(callEntity.getSubmissionMethod());
|
callDetailsResponseBean.setSubmissionMethod(callEntity.getSubmissionMethod());
|
||||||
callDetailsResponseBean.setThreshold(callEntity.getThreshold());
|
callDetailsResponseBean.setThreshold(callEntity.getThreshold());
|
||||||
callDetailsResponseBean.setDocumentationReqested(callEntity.getDocumentationRequested());
|
callDetailsResponseBean.setDocumentationRequested(callEntity.getDocumentationRequested());
|
||||||
callDetailsResponseBean.setPriorityArea(callEntity.getPriorityArea());
|
callDetailsResponseBean.setPriorityArea(callEntity.getPriorityArea());
|
||||||
callDetailsResponseBean.setCreatedDate(callEntity.getCreatedDate());
|
callDetailsResponseBean.setCreatedDate(callEntity.getCreatedDate());
|
||||||
callDetailsResponseBean.setUpdatedDate(callEntity.getUpdatedDate());
|
callDetailsResponseBean.setUpdatedDate(callEntity.getUpdatedDate());
|
||||||
@@ -598,7 +655,7 @@ public class CallDao {
|
|||||||
List<DocumentEntity> documentEntities = documentRepository.findByCallIdAndTypeAndIsDeletedFalse(callEntity.getId(),
|
List<DocumentEntity> documentEntities = documentRepository.findByCallIdAndTypeAndIsDeletedFalse(callEntity.getId(),
|
||||||
DocumentTypeEnum.DOCUMENT.getValue());
|
DocumentTypeEnum.DOCUMENT.getValue());
|
||||||
List<DocumentEntity> imageEntities = documentRepository.findByCallIdAndTypeAndIsDeletedFalse(callEntity.getId(),
|
List<DocumentEntity> imageEntities = documentRepository.findByCallIdAndTypeAndIsDeletedFalse(callEntity.getId(),
|
||||||
DocumentTypeEnum.DOCUMENT.getValue());
|
DocumentTypeEnum.IMAGES.getValue());
|
||||||
List<FaqEntity> faqEntities = faqRepository.findByCallIdAndIsDeletedFalse(callEntity.getId());
|
List<FaqEntity> faqEntities = faqRepository.findByCallIdAndIsDeletedFalse(callEntity.getId());
|
||||||
List<LookUpDataResponse> amiedTo = callTargetAudienceChecklistRepository
|
List<LookUpDataResponse> amiedTo = callTargetAudienceChecklistRepository
|
||||||
.findByCallIdAndLookupDataTypeAndIsDeletedFalse(callEntity.getId(), LookUpDataTypeEnum.AIMED_TO.getValue()).stream()
|
.findByCallIdAndLookupDataTypeAndIsDeletedFalse(callEntity.getId(), LookUpDataTypeEnum.AIMED_TO.getValue()).stream()
|
||||||
@@ -630,6 +687,7 @@ public class CallDao {
|
|||||||
callEntity.setStatus(CallStatusEnum.READY_TO_PUBLISH.getValue());
|
callEntity.setStatus(CallStatusEnum.READY_TO_PUBLISH.getValue());
|
||||||
callRepository.save(callEntity);
|
callRepository.save(callEntity);
|
||||||
callResponseBean.setCurrentStep(GepafinConstant.VALIDATE_REQUEST);
|
callResponseBean.setCurrentStep(GepafinConstant.VALIDATE_REQUEST);
|
||||||
|
callResponseBean.setStatus(CallStatusEnum.READY_TO_PUBLISH);
|
||||||
return callResponseBean;
|
return callResponseBean;
|
||||||
}
|
}
|
||||||
public CallEntity getCallEntityById(Long id){
|
public CallEntity getCallEntityById(Long id){
|
||||||
@@ -664,12 +722,9 @@ public class CallDao {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case PUBLISH:
|
case PUBLISH:
|
||||||
case EXPIRE:
|
case EXPIRED:
|
||||||
throw new CustomValidationException(Status.VALIDATION_ERROR,
|
throw new CustomValidationException(Status.VALIDATION_ERROR,
|
||||||
Translator.toLocale(GepafinConstant.STATUS_CANNOT_BE_CHANGED));
|
Translator.toLocale(GepafinConstant.STATUS_CANNOT_BE_CHANGED));
|
||||||
default:
|
|
||||||
throw new CustomValidationException(Status.VALIDATION_ERROR,
|
|
||||||
Translator.toLocale(GepafinConstant.INVALID_STATUS_TRANSITION));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,12 +4,13 @@ import net.gepafin.tendermanagement.config.Translator;
|
|||||||
import net.gepafin.tendermanagement.constants.GepafinConstant;
|
import net.gepafin.tendermanagement.constants.GepafinConstant;
|
||||||
import net.gepafin.tendermanagement.entities.CallEntity;
|
import net.gepafin.tendermanagement.entities.CallEntity;
|
||||||
import net.gepafin.tendermanagement.entities.FaqEntity;
|
import net.gepafin.tendermanagement.entities.FaqEntity;
|
||||||
|
import net.gepafin.tendermanagement.entities.LookUpDataEntity;
|
||||||
import net.gepafin.tendermanagement.entities.UserEntity;
|
import net.gepafin.tendermanagement.entities.UserEntity;
|
||||||
import net.gepafin.tendermanagement.model.request.FaqReq;
|
import net.gepafin.tendermanagement.model.request.FaqReq;
|
||||||
import net.gepafin.tendermanagement.model.response.FaqResponseBean;
|
import net.gepafin.tendermanagement.model.response.FaqResponseBean;
|
||||||
import net.gepafin.tendermanagement.repositories.CallRepository;
|
import net.gepafin.tendermanagement.repositories.CallRepository;
|
||||||
import net.gepafin.tendermanagement.repositories.FaqRepository;
|
import net.gepafin.tendermanagement.repositories.FaqRepository;
|
||||||
import net.gepafin.tendermanagement.repositories.UserRepository;
|
import net.gepafin.tendermanagement.service.UserService;
|
||||||
import net.gepafin.tendermanagement.util.DateTimeUtil;
|
import net.gepafin.tendermanagement.util.DateTimeUtil;
|
||||||
import net.gepafin.tendermanagement.web.rest.api.errors.ResourceNotFoundException;
|
import net.gepafin.tendermanagement.web.rest.api.errors.ResourceNotFoundException;
|
||||||
import net.gepafin.tendermanagement.web.rest.api.errors.Status;
|
import net.gepafin.tendermanagement.web.rest.api.errors.Status;
|
||||||
@@ -25,7 +26,7 @@ public class FaqDao {
|
|||||||
private FaqRepository faqRepository;
|
private FaqRepository faqRepository;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private UserRepository userRepository;
|
private UserService userService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private CallDao callDao;
|
private CallDao callDao;
|
||||||
@@ -38,7 +39,8 @@ public class FaqDao {
|
|||||||
CallEntity callEntity = callRepository.findById(callId)
|
CallEntity callEntity = callRepository.findById(callId)
|
||||||
.orElseThrow(() -> new ResourceNotFoundException(Status.NOT_FOUND,
|
.orElseThrow(() -> new ResourceNotFoundException(Status.NOT_FOUND,
|
||||||
Translator.toLocale(GepafinConstant.CALL_NOT_FOUND)));
|
Translator.toLocale(GepafinConstant.CALL_NOT_FOUND)));
|
||||||
entity = callDao.convertToFaqEntity(faqRequest, callEntity, userId);
|
UserEntity userEntity = userService.validateUser(userId);
|
||||||
|
entity = callDao.convertToFaqEntity(faqRequest, callEntity, userEntity, LookUpDataEntity.LookUpDataTypeEnum.FAQ);
|
||||||
faqRepository.save(entity);
|
faqRepository.save(entity);
|
||||||
return convertFaqEntityToResponseBean(entity);
|
return convertFaqEntityToResponseBean(entity);
|
||||||
}
|
}
|
||||||
@@ -81,9 +83,7 @@ public class FaqDao {
|
|||||||
|
|
||||||
private void updateFaqEntity(FaqEntity faqEntity, FaqReq faqReq, Long userId, CallEntity callEntity) {
|
private void updateFaqEntity(FaqEntity faqEntity, FaqReq faqReq, Long userId, CallEntity callEntity) {
|
||||||
faqEntity.setQuestion(faqReq.getQuestion());
|
faqEntity.setQuestion(faqReq.getQuestion());
|
||||||
UserEntity userEntity = userRepository.findById(userId)
|
UserEntity userEntity = userService.validateUser(userId);
|
||||||
.orElseThrow(() -> new ResourceNotFoundException(Status.VALIDATION_ERROR,
|
|
||||||
Translator.toLocale(GepafinConstant.LOOK_UP_DATA_NOT_VALID_MSG)));
|
|
||||||
faqEntity.setUser(userEntity);
|
faqEntity.setUser(userEntity);
|
||||||
faqEntity.setIsVisible(true);
|
faqEntity.setIsVisible(true);
|
||||||
if (faqReq.getIsVisible() != null) {
|
if (faqReq.getIsVisible() != null) {
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ import java.time.LocalDateTime;
|
|||||||
@Builder
|
@Builder
|
||||||
public class CallEntity extends BaseEntity {
|
public class CallEntity extends BaseEntity {
|
||||||
|
|
||||||
@Column(name = "NAME", nullable = false, length = 255)
|
@Column(name = "NAME", length = 255)
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
@Column(name = "DESCRIPTION_SHORT", columnDefinition = "TEXT")
|
@Column(name = "DESCRIPTION_SHORT", columnDefinition = "TEXT")
|
||||||
@@ -26,23 +26,23 @@ public class CallEntity extends BaseEntity {
|
|||||||
@Column(name = "DESCRIPTION_LONG", columnDefinition = "TEXT")
|
@Column(name = "DESCRIPTION_LONG", columnDefinition = "TEXT")
|
||||||
private String descriptionLong;
|
private String descriptionLong;
|
||||||
|
|
||||||
@Column(name = "START_DATE", nullable = false)
|
@Column(name = "START_DATE")
|
||||||
private LocalDateTime startDate;
|
private LocalDateTime startDate;
|
||||||
|
|
||||||
@Column(name = "END_DATE", nullable = false)
|
@Column(name = "END_DATE")
|
||||||
private LocalDateTime endDate;
|
private LocalDateTime endDate;
|
||||||
|
|
||||||
@Column(name = "STATUS", nullable = false, length = 255)
|
@Column(name = "STATUS", length = 255)
|
||||||
private String status;
|
private String status;
|
||||||
|
|
||||||
@ManyToOne
|
@ManyToOne
|
||||||
@JoinColumn(name = "REGION_ID", nullable = false, foreignKey = @ForeignKey(name = "fk_region_call"))
|
@JoinColumn(name = "REGION_ID", foreignKey = @ForeignKey(name = "fk_region_call"))
|
||||||
private RegionEntity region;
|
private RegionEntity region;
|
||||||
|
|
||||||
@Column(name = "AMOUNT", nullable = false)
|
@Column(name = "AMOUNT")
|
||||||
private BigDecimal amount;
|
private BigDecimal amount;
|
||||||
|
|
||||||
@Column(name = "AMOUNT_MAX", nullable = false)
|
@Column(name = "AMOUNT_MAX")
|
||||||
private BigDecimal amountMax;
|
private BigDecimal amountMax;
|
||||||
|
|
||||||
@Column(name = "CONTACT_INFO", columnDefinition = "TEXT")
|
@Column(name = "CONTACT_INFO", columnDefinition = "TEXT")
|
||||||
@@ -51,7 +51,7 @@ public class CallEntity extends BaseEntity {
|
|||||||
@Column(name = "SUBMISSION_METHOD", columnDefinition = "TEXT")
|
@Column(name = "SUBMISSION_METHOD", columnDefinition = "TEXT")
|
||||||
private String submissionMethod;
|
private String submissionMethod;
|
||||||
|
|
||||||
@Column(name = "THRESHOLD", nullable = false)
|
@Column(name = "THRESHOLD")
|
||||||
private Long threshold;
|
private Long threshold;
|
||||||
|
|
||||||
@Column(name="DOCUMENTATION_REQUESTED",columnDefinition = "TEXT")
|
@Column(name="DOCUMENTATION_REQUESTED",columnDefinition = "TEXT")
|
||||||
|
|||||||
@@ -39,6 +39,10 @@ public class FaqEntity extends BaseEntity {
|
|||||||
@Column(name = "RESPONSE", columnDefinition = "TEXT")
|
@Column(name = "RESPONSE", columnDefinition = "TEXT")
|
||||||
private String response;
|
private String response;
|
||||||
|
|
||||||
|
@ManyToOne
|
||||||
|
@JoinColumn(name = "LOOKUP_DATA_ID")
|
||||||
|
private LookUpDataEntity lookupData;
|
||||||
|
|
||||||
@Column(name = "RESPONSE_DATE")
|
@Column(name = "RESPONSE_DATE")
|
||||||
private LocalDateTime responseDate;
|
private LocalDateTime responseDate;
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,8 @@ public class LookUpDataEntity extends BaseEntity{
|
|||||||
public enum LookUpDataTypeEnum {
|
public enum LookUpDataTypeEnum {
|
||||||
CHECKLIST("CHECKLIST"),
|
CHECKLIST("CHECKLIST"),
|
||||||
AIMED_TO("AIMED_TO"),
|
AIMED_TO("AIMED_TO"),
|
||||||
EVALUATION_CRITERIA("EVALUATION_CRITERIA");
|
EVALUATION_CRITERIA("EVALUATION_CRITERIA"),
|
||||||
|
FAQ("FAQ");
|
||||||
|
|
||||||
private String value;
|
private String value;
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ public enum CallStatusEnum {
|
|||||||
|
|
||||||
DRAFT("DRAFT"),
|
DRAFT("DRAFT"),
|
||||||
PUBLISH("PUBLISH"),
|
PUBLISH("PUBLISH"),
|
||||||
EXPIRE("EXPIRED"),
|
EXPIRED("EXPIRED"),
|
||||||
READY_TO_PUBLISH("READY_TO_PUBLISH");
|
READY_TO_PUBLISH("READY_TO_PUBLISH");
|
||||||
|
|
||||||
private String value;
|
private String value;
|
||||||
|
|||||||
@@ -3,42 +3,27 @@ package net.gepafin.tendermanagement.model.request;
|
|||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import jakarta.validation.constraints.NotEmpty;
|
|
||||||
import jakarta.validation.constraints.NotNull;
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class CreateCallRequestStep1 {
|
public class CreateCallRequestStep1 {
|
||||||
|
|
||||||
@NotEmpty
|
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
@NotEmpty
|
|
||||||
private String descriptionShort;
|
private String descriptionShort;
|
||||||
|
|
||||||
@NotEmpty
|
|
||||||
private String descriptionLong;
|
private String descriptionLong;
|
||||||
|
|
||||||
@NotNull
|
private List<LocalDateTime> dates;
|
||||||
private LocalDateTime startDate;
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
private LocalDateTime endDate;
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
private Long regionId;
|
private Long regionId;
|
||||||
|
|
||||||
@NotNull
|
|
||||||
private BigDecimal amount;
|
private BigDecimal amount;
|
||||||
|
|
||||||
@NotNull
|
|
||||||
private BigDecimal amountMax;
|
private BigDecimal amountMax;
|
||||||
|
|
||||||
@NotNull
|
|
||||||
private List<LookUpDataReq> aimedTo;
|
private List<LookUpDataReq> aimedTo;
|
||||||
|
|
||||||
@NotEmpty
|
|
||||||
private String documentationRequested;
|
private String documentationRequested;
|
||||||
|
|
||||||
private Boolean confidi;
|
private Boolean confidi;
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ package net.gepafin.tendermanagement.model.request;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import jakarta.validation.constraints.NotNull;
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@@ -10,10 +9,8 @@ public class CreateCallRequestStep2 {
|
|||||||
|
|
||||||
private Long threshold;
|
private Long threshold;
|
||||||
|
|
||||||
@NotNull
|
|
||||||
private List<EvaluationCriteriaReq> criteria;
|
private List<EvaluationCriteriaReq> criteria;
|
||||||
|
|
||||||
@NotNull
|
|
||||||
private List<LookUpDataReq> checkList;
|
private List<LookUpDataReq> checkList;
|
||||||
|
|
||||||
private List<DocumentReq> docs;
|
private List<DocumentReq> docs;
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package net.gepafin.tendermanagement.model.request;
|
|||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class FaqReq {
|
public class FaqReq extends LookUpDataReq{
|
||||||
|
|
||||||
private Long id;
|
private Long id;
|
||||||
private Boolean isVisible;
|
private Boolean isVisible;
|
||||||
|
|||||||
@@ -9,31 +9,20 @@ import lombok.Data;
|
|||||||
@Data
|
@Data
|
||||||
public class UpdateCallRequestStep1 {
|
public class UpdateCallRequestStep1 {
|
||||||
|
|
||||||
|
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
|
|
||||||
private String descriptionShort;
|
private String descriptionShort;
|
||||||
|
|
||||||
|
|
||||||
private String descriptionLong;
|
private String descriptionLong;
|
||||||
|
|
||||||
|
private List<LocalDateTime> dates;
|
||||||
private LocalDateTime startDate;
|
|
||||||
|
|
||||||
|
|
||||||
private LocalDateTime endDate;
|
|
||||||
|
|
||||||
|
|
||||||
private BigDecimal amount;
|
private BigDecimal amount;
|
||||||
|
|
||||||
|
|
||||||
private BigDecimal amountMax;
|
private BigDecimal amountMax;
|
||||||
|
|
||||||
|
|
||||||
private List<LookUpDataReq> aimedTo;
|
private List<LookUpDataReq> aimedTo;
|
||||||
|
|
||||||
|
|
||||||
private String documentationRequested;
|
private String documentationRequested;
|
||||||
|
|
||||||
private Boolean confidi;
|
private Boolean confidi;
|
||||||
|
|||||||
@@ -35,23 +35,10 @@ public class CallDetailsResponseBean {
|
|||||||
|
|
||||||
private String priorityArea;
|
private String priorityArea;
|
||||||
|
|
||||||
private String documentationReqested;
|
private String documentationRequested;
|
||||||
|
|
||||||
private LocalDateTime createdDate;
|
private LocalDateTime createdDate;
|
||||||
|
|
||||||
private LocalDateTime updatedDate;
|
private LocalDateTime updatedDate;
|
||||||
|
|
||||||
private List<LookUpDataResponse> aimedTo;
|
|
||||||
|
|
||||||
private List<EvaluationCriteriaResponseBean> criteria;
|
|
||||||
|
|
||||||
private List<DocumentResponseBean> docs;
|
|
||||||
|
|
||||||
private List<FaqResponseBean> faq;
|
|
||||||
|
|
||||||
private List<DocumentResponseBean> images;
|
|
||||||
|
|
||||||
private List<LookUpDataResponse> checkList;
|
|
||||||
|
|
||||||
private String currentStep;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,9 +18,7 @@ public class CallResponse {
|
|||||||
|
|
||||||
private String descriptionLong;
|
private String descriptionLong;
|
||||||
|
|
||||||
private LocalDateTime startDate;
|
private List<LocalDateTime> dates;
|
||||||
|
|
||||||
private LocalDateTime endDate;
|
|
||||||
|
|
||||||
private CallStatusEnum status;
|
private CallStatusEnum status;
|
||||||
|
|
||||||
@@ -38,7 +36,7 @@ public class CallResponse {
|
|||||||
|
|
||||||
private String priorityArea;
|
private String priorityArea;
|
||||||
|
|
||||||
private String documentationReqested;
|
private String documentationRequested;
|
||||||
|
|
||||||
private Boolean confidi;
|
private Boolean confidi;
|
||||||
|
|
||||||
|
|||||||
@@ -23,4 +23,12 @@ public class FaqResponseBean extends BaseBean {
|
|||||||
|
|
||||||
private LocalDateTime responseDate;
|
private LocalDateTime responseDate;
|
||||||
|
|
||||||
|
private Long lookUpDataId;
|
||||||
|
|
||||||
|
private String title;
|
||||||
|
|
||||||
|
private String value;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package net.gepafin.tendermanagement.repositories;
|
package net.gepafin.tendermanagement.repositories;
|
||||||
|
|
||||||
|
import net.gepafin.tendermanagement.entities.EvaluationCriteriaEntity;
|
||||||
import net.gepafin.tendermanagement.entities.FaqEntity;
|
import net.gepafin.tendermanagement.entities.FaqEntity;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -17,4 +18,6 @@ public interface FaqRepository extends JpaRepository<FaqEntity, Long> {
|
|||||||
Optional<FaqEntity> findById(@Param("id") Long id);
|
Optional<FaqEntity> findById(@Param("id") Long id);
|
||||||
|
|
||||||
List<FaqEntity> findByCallIdAndIsDeletedFalse(Long callId);
|
List<FaqEntity> findByCallIdAndIsDeletedFalse(Long callId);
|
||||||
|
|
||||||
|
List<FaqEntity> findByCallIdAndLookupDataTypeAndIsDeletedFalse(Long callId, String type);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,13 @@
|
|||||||
package net.gepafin.tendermanagement.service.impl;
|
package net.gepafin.tendermanagement.service.impl;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
|
|
||||||
|
import net.gepafin.tendermanagement.config.Translator;
|
||||||
|
import net.gepafin.tendermanagement.constants.GepafinConstant;
|
||||||
import net.gepafin.tendermanagement.model.response.CallResponse;
|
import net.gepafin.tendermanagement.model.response.CallResponse;
|
||||||
import net.gepafin.tendermanagement.util.FieldValidator;
|
import net.gepafin.tendermanagement.util.FieldValidator;
|
||||||
|
import net.gepafin.tendermanagement.web.rest.api.errors.CustomValidationException;
|
||||||
|
import net.gepafin.tendermanagement.web.rest.api.errors.Status;
|
||||||
|
|
||||||
public class CallValidatorServiceImpl {
|
public class CallValidatorServiceImpl {
|
||||||
|
|
||||||
@@ -11,14 +17,14 @@ public class CallValidatorServiceImpl {
|
|||||||
.notNull(response.getName(), "name")
|
.notNull(response.getName(), "name")
|
||||||
.notNull(response.getDescriptionShort(), "descriptionShort")
|
.notNull(response.getDescriptionShort(), "descriptionShort")
|
||||||
.notNull(response.getDescriptionLong(), "descriptionLong")
|
.notNull(response.getDescriptionLong(), "descriptionLong")
|
||||||
.notNull(response.getStartDate(), "startDate")
|
.notNull(response.getDates().get(0), "startDate")
|
||||||
.notNull(response.getEndDate(), "endDate")
|
.notNull(response.getDates().get(1), "endDate")
|
||||||
.notNull(response.getStatus(), "status")
|
.notNull(response.getStatus(), "status")
|
||||||
.notNull(response.getRegionId(), "regionId")
|
.notNull(response.getRegionId(), "regionId")
|
||||||
.notNull(response.getAmount(), "amount")
|
.notNull(response.getAmount(), "amount")
|
||||||
.notNull(response.getAmountMax(), "amountMax")
|
.notNull(response.getAmountMax(), "amountMax")
|
||||||
.notNull(response.getThreshold(), "threshold")
|
.notNull(response.getThreshold(), "threshold")
|
||||||
.notNull(response.getDocumentationReqested(), "documentationReqested")
|
.notNull(response.getDocumentationRequested(), "documentationRequested")
|
||||||
.notEmpty(response.getAimedTo(), "aimedTo")
|
.notEmpty(response.getAimedTo(), "aimedTo")
|
||||||
.notEmpty(response.getCriteria(), "criteria")
|
.notEmpty(response.getCriteria(), "criteria")
|
||||||
.notEmpty(response.getDocs(), "docs")
|
.notEmpty(response.getDocs(), "docs")
|
||||||
@@ -26,6 +32,13 @@ public class CallValidatorServiceImpl {
|
|||||||
.notEmpty(response.getImages(), "images")
|
.notEmpty(response.getImages(), "images")
|
||||||
.notEmpty(response.getCheckList(), "checkList")
|
.notEmpty(response.getCheckList(), "checkList")
|
||||||
.validate();
|
.validate();
|
||||||
|
|
||||||
|
if (response.getDates().get(0).toLocalDate().isBefore(LocalDate.now())
|
||||||
|
|| response.getDates().get(1).toLocalDate().isBefore(LocalDate.now()) ||
|
||||||
|
response.getDates().get(0).toLocalDate().isAfter(response.getDates().get(1).toLocalDate())) {
|
||||||
|
throw new CustomValidationException(Status.VALIDATION_ERROR,
|
||||||
|
Translator.toLocale(GepafinConstant.INVALID_DATE_MSG));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,8 +3,6 @@ package net.gepafin.tendermanagement.web.rest.api;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import net.gepafin.tendermanagement.enums.CallStatusEnum;
|
import net.gepafin.tendermanagement.enums.CallStatusEnum;
|
||||||
import net.gepafin.tendermanagement.enums.UserStatusEnum;
|
|
||||||
import net.gepafin.tendermanagement.model.response.UserResponseBean;
|
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
import org.springframework.http.MediaType;
|
import org.springframework.http.MediaType;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
@@ -46,7 +44,7 @@ public interface CallApi {
|
|||||||
@Parameter(description = "Call request object", required = true)
|
@Parameter(description = "Call request object", required = true)
|
||||||
@Valid @RequestBody CreateCallRequestStep1 createCallRequest);
|
@Valid @RequestBody CreateCallRequestStep1 createCallRequest);
|
||||||
|
|
||||||
@Operation(summary = "Api to create call step 2",
|
@Operation(summary = "Api to update call step 2",
|
||||||
responses = {
|
responses = {
|
||||||
@ApiResponse(responseCode = "200", description = "OK"),
|
@ApiResponse(responseCode = "200", description = "OK"),
|
||||||
@ApiResponse(responseCode = "404", description = "Not Found", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
@ApiResponse(responseCode = "404", description = "Not Found", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ public interface DocumentApi {
|
|||||||
@ApiResponse(responseCode = "400", description = "Bad Request", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
@ApiResponse(responseCode = "400", description = "Bad Request", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||||
@ExampleObject(value = ErrorConstants.BADREQUEST_ERROR_EXAMPLE) }))})
|
@ExampleObject(value = ErrorConstants.BADREQUEST_ERROR_EXAMPLE) }))})
|
||||||
@PostMapping(value = "/uploadFile/call/{callId}", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
|
@PostMapping(value = "/uploadFile/call/{callId}", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
|
||||||
default ResponseEntity<Response<List<DocumentResponseBean>>> uploadFile(HttpServletRequest httpServletRequest, @Parameter(description = "call id", required = true) @PathVariable Long callId, @RequestParam("file") List<MultipartFile> files, @RequestParam("documentType") DocumentTypeEnum documentTypeEnum) {
|
default ResponseEntity<Response<List<DocumentResponseBean>>> uploadFile(HttpServletRequest httpServletRequest, @Parameter(description = "call id", required = true) @PathVariable("callId") Long callId, @RequestParam("file") List<MultipartFile> files, @RequestParam("documentType") DocumentTypeEnum documentTypeEnum) {
|
||||||
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
|
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -59,7 +59,7 @@ public interface DocumentApi {
|
|||||||
@ApiResponse(responseCode = "400", description = "Bad Request", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
@ApiResponse(responseCode = "400", description = "Bad Request", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||||
@ExampleObject(value = ErrorConstants.BADREQUEST_ERROR_EXAMPLE) }))})
|
@ExampleObject(value = ErrorConstants.BADREQUEST_ERROR_EXAMPLE) }))})
|
||||||
@PutMapping(value = "/{id}", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
|
@PutMapping(value = "/{id}", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
|
||||||
default ResponseEntity<Response<DocumentResponseBean>> updateDocument(HttpServletRequest httpServletRequest, @Parameter(description = "document id", required = true) @PathVariable Long documentId, @RequestParam("file") MultipartFile file, @RequestParam("documentType") DocumentTypeEnum documentTypeEnum) {
|
default ResponseEntity<Response<DocumentResponseBean>> updateDocument(HttpServletRequest httpServletRequest, @Parameter(description = "document id", required = true) @PathVariable("id") Long documentId, @RequestParam("file") MultipartFile file, @RequestParam("documentType") DocumentTypeEnum documentTypeEnum) {
|
||||||
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
|
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
|
||||||
}
|
}
|
||||||
@Operation(summary = "API to get document by id",
|
@Operation(summary = "API to get document by id",
|
||||||
@@ -73,6 +73,6 @@ public interface DocumentApi {
|
|||||||
@GetMapping(value = "/{id}", produces = MediaType.APPLICATION_JSON_VALUE)
|
@GetMapping(value = "/{id}", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||||
ResponseEntity<Response<DocumentResponseBean>> getDocumentById(HttpServletRequest request,
|
ResponseEntity<Response<DocumentResponseBean>> getDocumentById(HttpServletRequest request,
|
||||||
@Parameter(description = "document id", required = true)
|
@Parameter(description = "document id", required = true)
|
||||||
@PathVariable Long id);
|
@PathVariable("id") Long id);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,8 +3,6 @@ package net.gepafin.tendermanagement.web.rest.api.impl;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import net.gepafin.tendermanagement.enums.CallStatusEnum;
|
import net.gepafin.tendermanagement.enums.CallStatusEnum;
|
||||||
import net.gepafin.tendermanagement.enums.UserStatusEnum;
|
|
||||||
import net.gepafin.tendermanagement.model.response.UserResponseBean;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
|
|||||||
@@ -514,4 +514,24 @@
|
|||||||
from gepafin_schema.form_field), false)
|
from gepafin_schema.form_field), false)
|
||||||
</sql>
|
</sql>
|
||||||
</changeSet>
|
</changeSet>
|
||||||
|
|
||||||
|
<changeSet id="27-08-2024_3" author="Rajesh Khore">
|
||||||
|
<dropNotNullConstraint tableName="call" columnName="name"/>
|
||||||
|
<dropNotNullConstraint tableName="call" columnName="start_date"/>
|
||||||
|
<dropNotNullConstraint tableName="call" columnName="end_date"/>
|
||||||
|
<dropNotNullConstraint tableName="call" columnName="status"/>
|
||||||
|
<dropNotNullConstraint tableName="call" columnName="region_id"/>
|
||||||
|
<dropNotNullConstraint tableName="call" columnName="amount"/>
|
||||||
|
<dropNotNullConstraint tableName="call" columnName="amount_max"/>
|
||||||
|
</changeSet>
|
||||||
|
|
||||||
|
<changeSet id="29-08-2024_1" author="Harish Bagora">
|
||||||
|
<addColumn tableName="FAQ">
|
||||||
|
<column name="lookup_data_id" type="INTEGER">
|
||||||
|
<constraints nullable="false"
|
||||||
|
foreignKeyName="fk_lookup_data_faq"
|
||||||
|
references="lookup_data(id)" />
|
||||||
|
</column>
|
||||||
|
</addColumn>
|
||||||
|
</changeSet>
|
||||||
</databaseChangeLog>
|
</databaseChangeLog>
|
||||||
|
|||||||
@@ -55,7 +55,9 @@ update_call_status_success_msg=The call status has been updated successfully.
|
|||||||
status.same.error=Status is already set.
|
status.same.error=Status is already set.
|
||||||
invalid.status.change.from.draft=Status cannot be changed to READY_TO_PUBLISH or PUBLISH from DRAFT.
|
invalid.status.change.from.draft=Status cannot be changed to READY_TO_PUBLISH or PUBLISH from DRAFT.
|
||||||
status.cannot.be.changed=Status cannot be changed.
|
status.cannot.be.changed=Status cannot be changed.
|
||||||
invalid.status.transition=Invalid status transition.
|
published.call.not.update=Published call cannot be updated.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Login-related messages
|
# Login-related messages
|
||||||
login.successfully=Login successfully.
|
login.successfully=Login successfully.
|
||||||
|
|||||||
@@ -55,7 +55,8 @@ update_call_status_success_msg=Lo stato della chiamata <20> stato aggiornato con
|
|||||||
status.same.error=Lo stato <20> gi<67> impostato.
|
status.same.error=Lo stato <20> gi<67> impostato.
|
||||||
invalid.status.change.from.draft=Lo stato non pu<70> essere cambiato in READY_TO_PUBLISH o PUBLISH da DRAFT.
|
invalid.status.change.from.draft=Lo stato non pu<70> essere cambiato in READY_TO_PUBLISH o PUBLISH da DRAFT.
|
||||||
status.cannot.be.changed=Lo stato non pu<70> essere cambiato.
|
status.cannot.be.changed=Lo stato non pu<70> essere cambiato.
|
||||||
invalid.status.transition=Transizione di stato non valida.
|
published.call.not.update=Il bando pubblicato non pu<70> essere aggiornato.
|
||||||
|
|
||||||
|
|
||||||
# Login-related messages
|
# Login-related messages
|
||||||
login.successfully=Accesso effettuato con successo.
|
login.successfully=Accesso effettuato con successo.
|
||||||
|
|||||||
Reference in New Issue
Block a user