Merge pull request #8 from Kitzanos/crud-operations
Created crud operations for several entitiesImplemented CRUD operations for evaluation criteria, FAQ, LookUp data, and document.
This commit is contained in:
@@ -44,6 +44,25 @@ public class GepafinConstant {
|
||||
public static final String DOCUMENT_ID_NOT_FOUND="document.id.not.found";
|
||||
public static final String INVALID_DATE_MSG = "call.invalid.date";
|
||||
|
||||
public static final String EVALUATION_CRITERIA_NOT_FOUND = "evaluation.criteria.not.found";
|
||||
public static final String EVALUATION_CRITERIA_CREATED_SUCCESSFULLY = "evaluation.criteria.created.successfully";
|
||||
public static final String EVALUATION_CRITERIA_FETCH_SUCCESSFULLY = "evaluation.criteria.fetch.successfully";
|
||||
public static final String EVALUATION_CRITERIA_UPDATED_SUCCESSFULLY = "evaluation.criteria.updated.successfully";
|
||||
public static final String EVALUATION_CRITERIA_DELETED_SUCCESSFULLY = "evaluation.criteria.deleted.successfully";
|
||||
public static final String CALL_NOT_FOUND="call.not.found";
|
||||
public static final String SCORE_NOT_NULL_MSG="score.not.null";
|
||||
public static final String FAQ_NOT_FOUND = "faq.not.found";
|
||||
public static final String FAQ_CREATED_SUCCESSFULLY = "faq.created.successfully";
|
||||
public static final String FAQ_FETCHED_SUCCESSFULLY = "faq.fetched.successfully";
|
||||
public static final String FAQ_UPDATED_SUCCESSFULLY = "faq.updated.successfully";
|
||||
public static final String FAQ_DELETED_SUCCESSFULLY = "faq.deleted.successfully";
|
||||
public static final String LOOKUP_DATA_NOT_FOUND = "lookupdata.not.found";
|
||||
public static final String LOOKUP_DATA_CREATED_SUCCESSFULLY = "lookupdata.created.successfully";
|
||||
public static final String LOOKUP_DATA_FETCHED_SUCCESSFULLY = "lookupdata.fetched.successfully";
|
||||
public static final String LOOKUP_DATA_UPDATED_SUCCESSFULLY = "lookupdata.updated.successfully";
|
||||
public static final String LOOKUP_DATA_DELETED_SUCCESSFULLY = "lookupdata.deleted.successfully";
|
||||
public static final String DOCUMENT_UPDATED_SUCCESSFULLY = "document.updated.successfully";
|
||||
public static final String DOCUMENT_FETCHED_SUCCESSFULLY = "document.fetched.successfully";
|
||||
public static final String RESET_PASSWORD_INITIATED = "password.reset.initiated";
|
||||
public static final String PASSWORD_RESET_SUCCESS = "password.reset.success";
|
||||
public static final String INVALID_TOKEN_MSG = "invalid.token.msg";
|
||||
|
||||
@@ -112,7 +112,7 @@ public class CallDao {
|
||||
return callEntity;
|
||||
}
|
||||
|
||||
public List<EvaluationCriteriaEntity> convertToEvaluationCriteriaEntities(List<EvaluationCriteriaReq> criteriaReqList, CallEntity callEntity) {
|
||||
public List<EvaluationCriteriaEntity> convertListOfEvaluationCriteriaReqToEvaluationCriteriaEntities(List<EvaluationCriteriaReq> criteriaReqList, CallEntity callEntity) {
|
||||
List<EvaluationCriteriaEntity> evaluationCriteriaEntities = criteriaReqList.stream().map(req -> convertToEvaluationCriteriaEntity(req, callEntity)).collect(Collectors.toList());
|
||||
evaluationCriteriaRepository.saveAll(evaluationCriteriaEntities);
|
||||
return evaluationCriteriaEntities;
|
||||
@@ -120,7 +120,7 @@ public class CallDao {
|
||||
|
||||
private EvaluationCriteriaEntity convertToEvaluationCriteriaEntity(EvaluationCriteriaReq criteriaReq, CallEntity callEntity) {
|
||||
EvaluationCriteriaEntity criteriaEntity = new EvaluationCriteriaEntity();
|
||||
validateEvolutionCrieteriaEntity(criteriaReq.getName());
|
||||
validateEvolutionCrieteriaEntity(criteriaReq.getName(),criteriaReq.getScore());
|
||||
criteriaEntity.setName(criteriaReq.getName());
|
||||
criteriaEntity.setDescription(criteriaReq.getValue());
|
||||
criteriaEntity.setScore(criteriaReq.getScore());
|
||||
@@ -156,7 +156,7 @@ public class CallDao {
|
||||
return faqEntities;
|
||||
}
|
||||
|
||||
private FaqEntity convertToFaqEntity(FaqReq faqReq, CallEntity callEntity, Long userId) {
|
||||
public FaqEntity convertToFaqEntity(FaqReq faqReq, CallEntity callEntity, Long userId) {
|
||||
FaqEntity faqEntity = new FaqEntity();
|
||||
validateFaqEntity(faqReq.getQuestion());
|
||||
UserEntity userEntity= userRepository.findById(userId)
|
||||
@@ -193,10 +193,13 @@ public class CallDao {
|
||||
// }
|
||||
}
|
||||
|
||||
public void validateEvolutionCrieteriaEntity(String name) {
|
||||
public void validateEvolutionCrieteriaEntity(String name,Integer score) {
|
||||
if (!StringUtils.hasText(name)) {
|
||||
throw new CustomValidationException(Status.VALIDATION_ERROR, Translator.toLocale(GepafinConstant.NAME_NOT_EMPTY_MSG));
|
||||
}
|
||||
if (score == null || score <= 0) {
|
||||
throw new CustomValidationException(Status.VALIDATION_ERROR, Translator.toLocale(GepafinConstant.SCORE_NOT_NULL_MSG));
|
||||
}
|
||||
}
|
||||
|
||||
public void validateCallEntity(CreateCallRequestStep1 createCallRequest) {
|
||||
@@ -366,6 +369,11 @@ public class CallDao {
|
||||
return createCallResponseBean;
|
||||
|
||||
}
|
||||
public List<EvaluationCriteriaEntity> convertToEvaluationCriteriaEntities(List<EvaluationCriteriaReq> criteriaReqList, CallEntity callEntity) {
|
||||
List<EvaluationCriteriaEntity> evaluationCriteriaEntities = criteriaReqList.stream().map(req -> convertToEvaluationCriteriaEntity(req, callEntity)).collect(Collectors.toList());
|
||||
evaluationCriteriaRepository.saveAll(evaluationCriteriaEntities);
|
||||
return evaluationCriteriaEntities;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
package net.gepafin.tendermanagement.dao;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.apache.commons.io.FilenameUtils;
|
||||
@@ -13,14 +12,20 @@ import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import net.gepafin.tendermanagement.config.Translator;
|
||||
import net.gepafin.tendermanagement.constants.GepafinConstant;
|
||||
import net.gepafin.tendermanagement.entities.CallEntity;
|
||||
import net.gepafin.tendermanagement.entities.DocumentEntity;
|
||||
import net.gepafin.tendermanagement.enums.DocumentTypeEnum;
|
||||
import net.gepafin.tendermanagement.model.response.DocumentResponseBean;
|
||||
import net.gepafin.tendermanagement.repositories.CallRepository;
|
||||
import net.gepafin.tendermanagement.repositories.DocumentRepository;
|
||||
import net.gepafin.tendermanagement.service.AmazonS3Service;
|
||||
import net.gepafin.tendermanagement.util.Utils;
|
||||
import net.gepafin.tendermanagement.web.rest.api.errors.ResourceNotFoundException;
|
||||
import net.gepafin.tendermanagement.web.rest.api.errors.Status;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Component
|
||||
public class DocumentDao {
|
||||
@@ -34,21 +39,32 @@ public class DocumentDao {
|
||||
@Autowired
|
||||
private CallDao callDao;
|
||||
|
||||
public List<DocumentResponseBean> uploadFiles(List<MultipartFile> files, DocumentTypeEnum fileType) {
|
||||
List<DocumentEntity> documentEntities = new ArrayList<>();
|
||||
@Value("${aws.s3.bucket.name}")
|
||||
private String bucketName;
|
||||
|
||||
@Value("${aws.s3.url.folder}")
|
||||
private String s3Folder;
|
||||
|
||||
@Value("${aws.s3.url}")
|
||||
private String s3Url;
|
||||
|
||||
@Autowired
|
||||
private CallRepository callRepository;
|
||||
|
||||
public List<DocumentResponseBean> uploadFiles(List<MultipartFile> files,Long callId, DocumentTypeEnum fileType) {
|
||||
List<DocumentEntity> documentEntities = new ArrayList<>();
|
||||
CallEntity callEntity=callRepository.findById(callId).orElseThrow(() -> new ResourceNotFoundException(Status.NOT_FOUND, Translator.toLocale(GepafinConstant.CALL_NOT_FOUND)));
|
||||
for (MultipartFile file : files) {
|
||||
try {
|
||||
String extension = FilenameUtils.getExtension(file.getOriginalFilename());
|
||||
String fileName = StringUtils.cleanPath(file.getOriginalFilename());
|
||||
String firstNameContain = fileName.substring(0, fileName.lastIndexOf('.'));
|
||||
fileName = (firstNameContain + "." + extension);
|
||||
String filepath = amazonS3Service.upload(fileName,file);
|
||||
uploadFileOnAmazonS3 result = uploadFileOnAmazonS3(file);
|
||||
if(result!=null) {
|
||||
DocumentEntity documentEntity = new DocumentEntity();
|
||||
documentEntity.setFileName(fileName);
|
||||
documentEntity.setFileName(result.fileName());
|
||||
documentEntity.setCall(callEntity);
|
||||
documentEntity.setType(fileType.getValue());
|
||||
documentEntity.setFilePath(filepath);
|
||||
documentEntity.setFilePath(result.filepath());
|
||||
documentEntities.add(documentEntity);
|
||||
}
|
||||
} catch (IOException e) {}
|
||||
}
|
||||
documentRepository.saveAll(documentEntities);
|
||||
@@ -57,14 +73,62 @@ public class DocumentDao {
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
private uploadFileOnAmazonS3 uploadFileOnAmazonS3(MultipartFile file) throws IOException {
|
||||
String extension = FilenameUtils.getExtension(file.getOriginalFilename());
|
||||
String fileName = StringUtils.cleanPath(file.getOriginalFilename());
|
||||
String firstNameContain = fileName.substring(0, fileName.lastIndexOf('.'));
|
||||
fileName = (firstNameContain + "." + extension);
|
||||
String filepath = amazonS3Service.upload(fileName, file);
|
||||
uploadFileOnAmazonS3 result = new uploadFileOnAmazonS3(fileName, filepath);
|
||||
return result;
|
||||
}
|
||||
|
||||
private record uploadFileOnAmazonS3(String fileName, String filepath) {
|
||||
}
|
||||
|
||||
public void deleteFile(Long documentId){
|
||||
DocumentEntity documentEntity = documentRepository.findById(documentId)
|
||||
.orElseThrow(() -> new ResourceNotFoundException(Status.VALIDATION_ERROR,
|
||||
Translator.toLocale(GepafinConstant.DOCUMENT_NOT_FOUND)));
|
||||
|
||||
DocumentEntity documentEntity = getDocumentEntity(documentId);
|
||||
String fileName= Utils.extractFileName(documentEntity.getFilePath());
|
||||
amazonS3Service.delete(fileName);
|
||||
deleteFileOnAmazonS3(fileName);
|
||||
documentRepository.delete(documentEntity);
|
||||
}
|
||||
|
||||
private DocumentEntity deleteFileOnAmazonS3(String fileName) {
|
||||
try {
|
||||
amazonS3Service.delete(fileName);
|
||||
}catch (Exception e){}
|
||||
return null;
|
||||
}
|
||||
|
||||
private DocumentEntity getDocumentEntity(Long documentId) {
|
||||
Optional<DocumentEntity> documentEntity= documentRepository.findById(documentId);
|
||||
if(documentEntity.isEmpty()){
|
||||
throw new ResourceNotFoundException(Status.VALIDATION_ERROR, Translator.toLocale(GepafinConstant.DOCUMENT_NOT_FOUND));
|
||||
}
|
||||
return documentEntity.orElse(null);
|
||||
}
|
||||
|
||||
public DocumentResponseBean updateDocument(Long documentId, MultipartFile file, DocumentTypeEnum documentTypeEnum){
|
||||
DocumentEntity documentEntity = getDocumentEntity(documentId);
|
||||
String fileName= Utils.extractFileName(documentEntity.getFilePath());
|
||||
deleteFileOnAmazonS3(fileName);
|
||||
uploadFileOnAmazonS3 result= null;
|
||||
try {
|
||||
result = uploadFileOnAmazonS3(file);
|
||||
} catch (IOException e) {}
|
||||
if(result!=null){
|
||||
documentEntity.setFilePath(result.filepath);
|
||||
documentEntity.setFileName(result.fileName);
|
||||
documentEntity.setType(documentTypeEnum.getValue());
|
||||
documentRepository.save(documentEntity);
|
||||
}
|
||||
return callDao.convertToDocumentResponseBean(documentEntity);
|
||||
}
|
||||
public DocumentResponseBean getDocument(Long documentId) {
|
||||
Optional<DocumentEntity> documentEntity= documentRepository.findById(documentId);
|
||||
if(documentEntity.isEmpty()){
|
||||
new ResourceNotFoundException(Status.VALIDATION_ERROR, Translator.toLocale(GepafinConstant.DOCUMENT_NOT_FOUND));
|
||||
}
|
||||
return callDao.convertToDocumentResponseBean(documentEntity.orElse(null));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,75 @@
|
||||
package net.gepafin.tendermanagement.dao;
|
||||
|
||||
import net.gepafin.tendermanagement.config.Translator;
|
||||
import net.gepafin.tendermanagement.constants.GepafinConstant;
|
||||
import net.gepafin.tendermanagement.entities.CallEntity;
|
||||
import net.gepafin.tendermanagement.entities.EvaluationCriteriaEntity;
|
||||
import net.gepafin.tendermanagement.model.request.EvaluationCriteriaRequest;
|
||||
import net.gepafin.tendermanagement.model.response.EvaluationCriteriaResponseBean;
|
||||
import net.gepafin.tendermanagement.repositories.CallRepository;
|
||||
import net.gepafin.tendermanagement.repositories.EvaluationCriteriaRepository;
|
||||
import net.gepafin.tendermanagement.web.rest.api.errors.ResourceNotFoundException;
|
||||
import net.gepafin.tendermanagement.web.rest.api.errors.Status;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.dao.EmptyResultDataAccessException;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
|
||||
@Component
|
||||
public class EvaluationCriteriaDao {
|
||||
|
||||
@Autowired
|
||||
private EvaluationCriteriaRepository repository;
|
||||
|
||||
@Autowired
|
||||
private CallRepository callRepository;
|
||||
|
||||
public EvaluationCriteriaResponseBean createEvaluationCriteria(EvaluationCriteriaRequest evaluationCriteriaRequest) {
|
||||
EvaluationCriteriaEntity entity = convertEvaluationCriteriaRequestToEvaluationCriteriaEntity(evaluationCriteriaRequest);
|
||||
return convertEvaluationCriteriaEntityEvaluationCriteriaToResponseBean(entity);
|
||||
}
|
||||
|
||||
private EvaluationCriteriaEntity convertEvaluationCriteriaRequestToEvaluationCriteriaEntity(EvaluationCriteriaRequest evaluationCriteriaRequest) {
|
||||
EvaluationCriteriaEntity entity = new EvaluationCriteriaEntity();
|
||||
CallEntity callEntity= callRepository.findById(evaluationCriteriaRequest.getCallId())
|
||||
.orElseThrow(() -> new ResourceNotFoundException(Status.VALIDATION_ERROR, Translator.toLocale(GepafinConstant.CALL_NOT_FOUND)));
|
||||
entity.setCall(callEntity);
|
||||
entity.setName(evaluationCriteriaRequest.getName());
|
||||
entity.setDescription(evaluationCriteriaRequest.getDescription());
|
||||
entity.setScore(evaluationCriteriaRequest.getScore());
|
||||
entity = repository.save(entity);
|
||||
return entity;
|
||||
}
|
||||
|
||||
public EvaluationCriteriaResponseBean getEvaluationCriteriaById(Long id) {
|
||||
return repository.findById(id)
|
||||
.map(this::convertEvaluationCriteriaEntityEvaluationCriteriaToResponseBean)
|
||||
.orElseThrow(() -> new ResourceNotFoundException(Status.NOT_FOUND, Translator.toLocale(GepafinConstant.EVALUATION_CRITERIA_NOT_FOUND)));
|
||||
}
|
||||
|
||||
public EvaluationCriteriaResponseBean updateEvaluationCriteria(Long id, EvaluationCriteriaRequest request) {
|
||||
EvaluationCriteriaEntity entity = repository.findById(id)
|
||||
.orElseThrow(() -> new ResourceNotFoundException(Status.NOT_FOUND, Translator.toLocale(GepafinConstant.EVALUATION_CRITERIA_NOT_FOUND)));
|
||||
entity = convertEvaluationCriteriaRequestToEvaluationCriteriaEntity(request);
|
||||
return convertEvaluationCriteriaEntityEvaluationCriteriaToResponseBean(entity);
|
||||
}
|
||||
|
||||
public void deleteEvaluationCriteria(Long id) {
|
||||
try {
|
||||
repository.deleteById(id);
|
||||
} catch (EmptyResultDataAccessException e) {
|
||||
throw new ResourceNotFoundException(Status.NOT_FOUND, Translator.toLocale(GepafinConstant.EVALUATION_CRITERIA_NOT_FOUND));
|
||||
}
|
||||
}
|
||||
|
||||
private EvaluationCriteriaResponseBean convertEvaluationCriteriaEntityEvaluationCriteriaToResponseBean(EvaluationCriteriaEntity entity) {
|
||||
EvaluationCriteriaResponseBean response = new EvaluationCriteriaResponseBean();
|
||||
response.setId(entity.getId());
|
||||
response.setName(entity.getName());
|
||||
response.setDescription(entity.getDescription());
|
||||
response.setScore(entity.getScore());
|
||||
response.setCreatedDate(entity.getCreatedDate());
|
||||
response.setUpdatedDate(entity.getUpdatedDate());
|
||||
return response;
|
||||
}
|
||||
}
|
||||
96
src/main/java/net/gepafin/tendermanagement/dao/FaqDao.java
Normal file
96
src/main/java/net/gepafin/tendermanagement/dao/FaqDao.java
Normal file
@@ -0,0 +1,96 @@
|
||||
package net.gepafin.tendermanagement.dao;
|
||||
import net.gepafin.tendermanagement.config.Translator;
|
||||
import net.gepafin.tendermanagement.constants.GepafinConstant;
|
||||
import net.gepafin.tendermanagement.entities.CallEntity;
|
||||
import net.gepafin.tendermanagement.entities.FaqEntity;
|
||||
import net.gepafin.tendermanagement.entities.UserEntity;
|
||||
import net.gepafin.tendermanagement.model.request.FaqReq;
|
||||
import net.gepafin.tendermanagement.model.response.FaqResponseBean;
|
||||
import net.gepafin.tendermanagement.repositories.CallRepository;
|
||||
import net.gepafin.tendermanagement.repositories.FaqRepository;
|
||||
import net.gepafin.tendermanagement.repositories.UserRepository;
|
||||
import net.gepafin.tendermanagement.util.DateTimeUtil;
|
||||
import net.gepafin.tendermanagement.web.rest.api.errors.ResourceNotFoundException;
|
||||
import net.gepafin.tendermanagement.web.rest.api.errors.Status;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Component
|
||||
public class FaqDao {
|
||||
|
||||
@Autowired
|
||||
private FaqRepository faqRepository;
|
||||
|
||||
@Autowired
|
||||
private UserRepository userRepository;
|
||||
|
||||
@Autowired
|
||||
private CallDao callDao;
|
||||
|
||||
@Autowired
|
||||
private CallRepository callRepository;
|
||||
|
||||
public FaqResponseBean createFaq(FaqReq faqRequest,Long userId,Long callId) {
|
||||
FaqEntity entity = new FaqEntity();
|
||||
CallEntity callEntity=callRepository.findById(callId).orElseThrow(() -> new ResourceNotFoundException(Status.NOT_FOUND, Translator.toLocale(GepafinConstant.CALL_NOT_FOUND)));
|
||||
entity= callDao.convertToFaqEntity(faqRequest,callEntity,userId);
|
||||
faqRepository.save(entity);
|
||||
return convertFaqEntityToResponseBean(entity);
|
||||
}
|
||||
|
||||
public FaqResponseBean getFaqById(Long id) {
|
||||
return faqRepository.findById(id)
|
||||
.map(this::convertFaqEntityToResponseBean)
|
||||
.orElseThrow(() -> new ResourceNotFoundException(Status.NOT_FOUND, Translator.toLocale(GepafinConstant.FAQ_NOT_FOUND)));
|
||||
}
|
||||
|
||||
public FaqResponseBean updateFaq(Long id, FaqReq faqRequest,Long userId) {
|
||||
FaqEntity entity = faqRepository.findById(id)
|
||||
.orElseThrow(() -> new ResourceNotFoundException(Status.NOT_FOUND,Translator.toLocale(GepafinConstant.FAQ_NOT_FOUND)));
|
||||
updateFaqEntity(entity,faqRequest,userId,entity.getCall());
|
||||
faqRepository.save(entity);
|
||||
return convertFaqEntityToResponseBean(entity);
|
||||
}
|
||||
|
||||
public void deleteFaq(Long id) {
|
||||
FaqEntity entity = faqRepository.findById(id)
|
||||
.orElseThrow(() -> new ResourceNotFoundException(Status.NOT_FOUND,Translator.toLocale(GepafinConstant.FAQ_NOT_FOUND)));
|
||||
faqRepository.deleteById(entity.getId());
|
||||
|
||||
}
|
||||
|
||||
private FaqResponseBean convertFaqEntityToResponseBean(FaqEntity entity) {
|
||||
FaqResponseBean response = new FaqResponseBean();
|
||||
response.setId(entity.getId());
|
||||
response.setUserId(entity.getUser().getId());
|
||||
response.setIsVisible(entity.getIsVisible());
|
||||
response.setUpdatedDate(entity.getUpdatedDate());
|
||||
response.setCreatedDate(entity.getCreatedDate());
|
||||
response.setQuestionShort(entity.getQuestionShort());
|
||||
response.setQuestion(entity.getQuestion());
|
||||
response.setResponseShort(entity.getResponseShort());
|
||||
response.setResponse(entity.getResponse());
|
||||
response.setResponseDate(entity.getResponseDate());
|
||||
return response;
|
||||
}
|
||||
private void updateFaqEntity(FaqEntity faqEntity, FaqReq faqReq, Long userId,CallEntity callEntity) {
|
||||
faqEntity.setQuestion(faqReq.getQuestion());
|
||||
UserEntity userEntity= userRepository.findById(userId)
|
||||
.orElseThrow(() -> new ResourceNotFoundException(Status.VALIDATION_ERROR, Translator.toLocale(GepafinConstant.LOOK_UP_DATA_NOT_VALID_MSG)));
|
||||
faqEntity.setUser(userEntity);
|
||||
faqEntity.setIsVisible(true);
|
||||
if(faqReq.getIsVisible()!=null){
|
||||
faqEntity.setIsVisible(faqReq.getIsVisible());
|
||||
}
|
||||
faqEntity.setQuestionShort(faqReq.getQuestionShort());
|
||||
faqEntity.setQuestion(faqReq.getQuestion());
|
||||
if(faqReq.getResponse()!=null ||faqReq.getResponseShort()!=null){
|
||||
faqEntity.setResponseDate(DateTimeUtil.DateServerToUTC(LocalDateTime.now()));
|
||||
}
|
||||
faqEntity.setResponseShort(faqReq.getResponseShort());
|
||||
faqEntity.setResponse(faqReq.getResponse());
|
||||
faqEntity.setCall(callEntity);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
package net.gepafin.tendermanagement.dao;
|
||||
|
||||
import net.gepafin.tendermanagement.entities.LookUpDataEntity;
|
||||
import net.gepafin.tendermanagement.model.request.LookUpDataRequest;
|
||||
import net.gepafin.tendermanagement.model.response.LookUpDataResponseBean;
|
||||
import net.gepafin.tendermanagement.repositories.LookUpDataRepository;
|
||||
import net.gepafin.tendermanagement.web.rest.api.errors.ResourceNotFoundException;
|
||||
import net.gepafin.tendermanagement.web.rest.api.errors.Status;
|
||||
import net.gepafin.tendermanagement.config.Translator;
|
||||
import net.gepafin.tendermanagement.constants.GepafinConstant;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class LookUpDataDao {
|
||||
|
||||
@Autowired
|
||||
private LookUpDataRepository lookUpDataRepository;
|
||||
|
||||
public LookUpDataResponseBean createLookUpData(LookUpDataRequest lookUpDataReq) {
|
||||
LookUpDataEntity entity = convertLookUpDataReqToLookUpDataEntity(lookUpDataReq);
|
||||
return convertLookUpDataEntityToResponseBean(entity);
|
||||
}
|
||||
private LookUpDataEntity convertLookUpDataReqToLookUpDataEntity(LookUpDataRequest lookUpDataReq) {
|
||||
LookUpDataEntity entity = new LookUpDataEntity();
|
||||
entity.setTitle(lookUpDataReq.getTitle());
|
||||
entity.setType(lookUpDataReq.getType().getValue());
|
||||
entity.setValue(lookUpDataReq.getValue());
|
||||
lookUpDataRepository.save(entity);
|
||||
return entity;
|
||||
}
|
||||
|
||||
public LookUpDataResponseBean getLookUpDataById(Long id) {
|
||||
return lookUpDataRepository.findById(id)
|
||||
.map(this::convertLookUpDataEntityToResponseBean)
|
||||
.orElseThrow(() -> new ResourceNotFoundException(Status.NOT_FOUND, Translator.toLocale(GepafinConstant.LOOKUP_DATA_NOT_FOUND)));
|
||||
}
|
||||
|
||||
public LookUpDataResponseBean updateLookUpData(Long id, LookUpDataRequest lookUpDataReq) {
|
||||
LookUpDataEntity entity = lookUpDataRepository.findById(id)
|
||||
.orElseThrow(() -> new ResourceNotFoundException(Status.NOT_FOUND, Translator.toLocale(GepafinConstant.LOOKUP_DATA_NOT_FOUND)));
|
||||
entity.setTitle(lookUpDataReq.getTitle());
|
||||
entity.setType(lookUpDataReq.getType().getValue());
|
||||
entity.setValue(lookUpDataReq.getValue());
|
||||
lookUpDataRepository.save(entity);
|
||||
return convertLookUpDataEntityToResponseBean(entity);
|
||||
}
|
||||
|
||||
public void deleteLookUpData(Long id) {
|
||||
LookUpDataEntity entity = lookUpDataRepository.findById(id)
|
||||
.orElseThrow(() -> new ResourceNotFoundException(Status.NOT_FOUND, Translator.toLocale(GepafinConstant.LOOKUP_DATA_NOT_FOUND)));
|
||||
lookUpDataRepository.deleteById(entity.getId());
|
||||
}
|
||||
|
||||
private LookUpDataResponseBean convertLookUpDataEntityToResponseBean(LookUpDataEntity entity) {
|
||||
LookUpDataResponseBean response = new LookUpDataResponseBean();
|
||||
response.setId(entity.getId());
|
||||
response.setTitle(entity.getTitle());
|
||||
response.setType(LookUpDataEntity.LookUpDataTypeEnum.valueOf(entity.getType()));
|
||||
response.setValue(entity.getValue());
|
||||
response.setCreatedDate(entity.getCreatedDate());
|
||||
response.setUpdatedDate(entity.getUpdatedDate());
|
||||
return response;
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,9 @@
|
||||
package net.gepafin.tendermanagement.model.request;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@NoArgsConstructor
|
||||
@Data
|
||||
public class EvaluationCriteriaReq {
|
||||
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
package net.gepafin.tendermanagement.model.request;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@NoArgsConstructor
|
||||
@Data
|
||||
public class EvaluationCriteriaRequest {
|
||||
|
||||
private Long callId;
|
||||
|
||||
private String name;
|
||||
|
||||
private String description;
|
||||
|
||||
private Integer score;
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package net.gepafin.tendermanagement.model.request;
|
||||
|
||||
import lombok.Data;
|
||||
import net.gepafin.tendermanagement.entities.LookUpDataEntity.LookUpDataTypeEnum;
|
||||
|
||||
@Data
|
||||
public class LookUpDataRequest {
|
||||
|
||||
private String title;
|
||||
private LookUpDataTypeEnum type;
|
||||
private String value;
|
||||
}
|
||||
@@ -1,13 +1,11 @@
|
||||
package net.gepafin.tendermanagement.model.response;
|
||||
|
||||
import lombok.Data;
|
||||
import net.gepafin.tendermanagement.model.BaseBean;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
public class EvaluationCriteriaResponseBean {
|
||||
|
||||
private Long id;
|
||||
public class EvaluationCriteriaResponseBean extends BaseBean {
|
||||
|
||||
private String name;
|
||||
|
||||
@@ -15,7 +13,4 @@ public class EvaluationCriteriaResponseBean {
|
||||
|
||||
private Integer score;
|
||||
|
||||
private LocalDateTime createdDate;
|
||||
|
||||
private LocalDateTime updatedDate;
|
||||
}
|
||||
|
||||
@@ -1,14 +1,13 @@
|
||||
package net.gepafin.tendermanagement.model.response;
|
||||
|
||||
import lombok.Data;
|
||||
import net.gepafin.tendermanagement.model.BaseBean;
|
||||
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
public class FaqResponseBean {
|
||||
|
||||
private Long id;
|
||||
public class FaqResponseBean extends BaseBean {
|
||||
|
||||
private Long userId;
|
||||
|
||||
@@ -24,7 +23,4 @@ public class FaqResponseBean {
|
||||
|
||||
private LocalDateTime responseDate;
|
||||
|
||||
private LocalDateTime createdDate;
|
||||
|
||||
private LocalDateTime updatedDate;
|
||||
}
|
||||
|
||||
@@ -1,13 +1,10 @@
|
||||
package net.gepafin.tendermanagement.model.response;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import net.gepafin.tendermanagement.model.BaseBean;
|
||||
|
||||
@Data
|
||||
public class LookUpDataResponse {
|
||||
|
||||
private Long id;
|
||||
public class LookUpDataResponse extends BaseBean {
|
||||
|
||||
private Long lookUpDataId;
|
||||
|
||||
@@ -15,8 +12,4 @@ public class LookUpDataResponse {
|
||||
|
||||
private String value;
|
||||
|
||||
private LocalDateTime createdDate;
|
||||
|
||||
private LocalDateTime updatedDate;
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
package net.gepafin.tendermanagement.model.response;
|
||||
|
||||
import lombok.Data;
|
||||
import net.gepafin.tendermanagement.entities.LookUpDataEntity.LookUpDataTypeEnum;
|
||||
import net.gepafin.tendermanagement.model.BaseBean;
|
||||
|
||||
@Data
|
||||
public class LookUpDataResponseBean extends BaseBean {
|
||||
|
||||
private String title;
|
||||
|
||||
private String value;
|
||||
|
||||
private LookUpDataTypeEnum type;
|
||||
}
|
||||
@@ -3,5 +3,5 @@ package net.gepafin.tendermanagement.repositories;
|
||||
import net.gepafin.tendermanagement.entities.EvaluationCriteriaEntity;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
public interface EvaluationCriteriaRepository extends JpaRepository<EvaluationCriteriaEntity, Integer> {
|
||||
public interface EvaluationCriteriaRepository extends JpaRepository<EvaluationCriteriaEntity, Long> {
|
||||
}
|
||||
|
||||
@@ -5,10 +5,8 @@ import net.gepafin.tendermanagement.entities.FaqEntity;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
@Repository
|
||||
public interface FaqRepository extends JpaRepository<FaqEntity, Integer> {
|
||||
public interface FaqRepository extends JpaRepository<FaqEntity, Long> {
|
||||
|
||||
List<FaqEntity> findByCallId(Long callId);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package net.gepafin.tendermanagement.service;
|
||||
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import net.gepafin.tendermanagement.enums.DocumentTypeEnum;
|
||||
import net.gepafin.tendermanagement.model.response.DocumentResponseBean;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
@@ -8,7 +9,11 @@ import java.util.List;
|
||||
|
||||
public interface DocumentService {
|
||||
|
||||
public List<DocumentResponseBean> uploadFile(List<MultipartFile> files, DocumentTypeEnum fileType);
|
||||
public List<DocumentResponseBean> uploadFile(List<MultipartFile> files,Long callId, DocumentTypeEnum fileType);
|
||||
|
||||
public void deleteFile(Long documentId);
|
||||
|
||||
public DocumentResponseBean updateDocument(HttpServletRequest httpServletRequest, Long documentId, MultipartFile file, DocumentTypeEnum documentTypeEnum);
|
||||
|
||||
public DocumentResponseBean getDocument(HttpServletRequest httpServletRequest,Long documentId);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
package net.gepafin.tendermanagement.service;
|
||||
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import net.gepafin.tendermanagement.model.request.EvaluationCriteriaRequest;
|
||||
import net.gepafin.tendermanagement.model.response.EvaluationCriteriaResponseBean;
|
||||
|
||||
public interface EvaluationCriteriaService {
|
||||
|
||||
public EvaluationCriteriaResponseBean createEvaluationCriteria(HttpServletRequest request,EvaluationCriteriaRequest evaluationCriteriaRequest);
|
||||
|
||||
public EvaluationCriteriaResponseBean getEvaluationCriteria(HttpServletRequest request,Long id);
|
||||
|
||||
public EvaluationCriteriaResponseBean updateEvaluationCriteria(HttpServletRequest request,Long id, EvaluationCriteriaRequest evaluationCriteriaRequest);
|
||||
|
||||
public void deleteEvaluationCriteria(HttpServletRequest request,Long id);
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package net.gepafin.tendermanagement.service;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import net.gepafin.tendermanagement.model.request.FaqReq;
|
||||
import net.gepafin.tendermanagement.model.response.FaqResponseBean;
|
||||
|
||||
public interface FaqService {
|
||||
|
||||
FaqResponseBean createFaq(HttpServletRequest request,Long callId, FaqReq faqRequest);
|
||||
|
||||
FaqResponseBean getFaqById(HttpServletRequest request, Long id);
|
||||
|
||||
FaqResponseBean updateFaq(HttpServletRequest request, Long id, FaqReq faqRequest);
|
||||
|
||||
void deleteFaq(HttpServletRequest request, Long id);
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package net.gepafin.tendermanagement.service;
|
||||
|
||||
import net.gepafin.tendermanagement.model.request.LookUpDataRequest;
|
||||
import net.gepafin.tendermanagement.model.response.LookUpDataResponseBean;
|
||||
|
||||
public interface LookUpDataService {
|
||||
|
||||
LookUpDataResponseBean createLookUpData(LookUpDataRequest lookUpDataReq);
|
||||
|
||||
LookUpDataResponseBean getLookUpDataById(Long id);
|
||||
|
||||
LookUpDataResponseBean updateLookUpData(Long id, LookUpDataRequest lookUpDataReq);
|
||||
|
||||
void deleteLookUpData(Long id);
|
||||
}
|
||||
@@ -2,28 +2,41 @@ package net.gepafin.tendermanagement.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import net.gepafin.tendermanagement.dao.DocumentDao;
|
||||
import net.gepafin.tendermanagement.enums.DocumentTypeEnum;
|
||||
import net.gepafin.tendermanagement.model.response.DocumentResponseBean;
|
||||
import net.gepafin.tendermanagement.service.DocumentService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
|
||||
|
||||
@Service
|
||||
public class DocumentServiceImpl implements DocumentService {
|
||||
|
||||
|
||||
@Autowired
|
||||
private DocumentDao fileDao;
|
||||
private DocumentDao documentDao;
|
||||
|
||||
@Override
|
||||
public List<DocumentResponseBean> uploadFile(List<MultipartFile> files, DocumentTypeEnum fileType) {
|
||||
return fileDao.uploadFiles(files,fileType);
|
||||
public List<DocumentResponseBean> uploadFile(List<MultipartFile> files,Long callId,DocumentTypeEnum fileType) {
|
||||
return documentDao.uploadFiles(files,callId,fileType);
|
||||
}
|
||||
@Override
|
||||
public void deleteFile(Long documentId){
|
||||
fileDao.deleteFile(documentId);
|
||||
documentDao.deleteFile(documentId);
|
||||
return ;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DocumentResponseBean updateDocument(HttpServletRequest httpServletRequest, Long documentId, MultipartFile file, DocumentTypeEnum documentTypeEnum) {
|
||||
return documentDao.updateDocument(documentId,file,documentTypeEnum);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DocumentResponseBean getDocument(HttpServletRequest httpServletRequest, Long documentId) {
|
||||
return documentDao.getDocument(documentId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
package net.gepafin.tendermanagement.service.impl;
|
||||
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import net.gepafin.tendermanagement.dao.EvaluationCriteriaDao;
|
||||
import net.gepafin.tendermanagement.model.request.EvaluationCriteriaRequest;
|
||||
import net.gepafin.tendermanagement.model.response.EvaluationCriteriaResponseBean;
|
||||
import net.gepafin.tendermanagement.service.EvaluationCriteriaService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class EvaluationCriteriaServiceImpl implements EvaluationCriteriaService {
|
||||
|
||||
@Autowired
|
||||
private EvaluationCriteriaDao evaluationCriteriaDao;
|
||||
|
||||
@Override
|
||||
public EvaluationCriteriaResponseBean createEvaluationCriteria(HttpServletRequest request,EvaluationCriteriaRequest evaluationCriteriaRequest) {
|
||||
return evaluationCriteriaDao.createEvaluationCriteria(evaluationCriteriaRequest);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EvaluationCriteriaResponseBean getEvaluationCriteria(HttpServletRequest request,Long id) {
|
||||
return evaluationCriteriaDao.getEvaluationCriteriaById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EvaluationCriteriaResponseBean updateEvaluationCriteria(HttpServletRequest request,Long id, EvaluationCriteriaRequest evaluationCriteriaRequest) {
|
||||
return evaluationCriteriaDao.updateEvaluationCriteria(id,evaluationCriteriaRequest);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteEvaluationCriteria(HttpServletRequest request,Long id) {
|
||||
evaluationCriteriaDao.deleteEvaluationCriteria(id);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package net.gepafin.tendermanagement.service.impl;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import net.gepafin.tendermanagement.config.jwt.TokenProvider;
|
||||
import net.gepafin.tendermanagement.dao.FaqDao;
|
||||
import net.gepafin.tendermanagement.model.request.FaqReq;
|
||||
import net.gepafin.tendermanagement.model.response.FaqResponseBean;
|
||||
import net.gepafin.tendermanagement.service.FaqService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@Service
|
||||
public class FaqServiceImpl implements FaqService {
|
||||
|
||||
@Autowired
|
||||
private FaqDao faqDao;
|
||||
|
||||
@Autowired
|
||||
private TokenProvider tokenProvider;
|
||||
|
||||
@Override
|
||||
public FaqResponseBean createFaq(HttpServletRequest request,Long callId, FaqReq faqRequest) {
|
||||
Map<String, Object> userInfo= tokenProvider.getUserInfoAndUserIdFromToken(request);
|
||||
return faqDao.createFaq(faqRequest,Long.parseLong(userInfo.get("userId").toString()),callId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FaqResponseBean getFaqById(HttpServletRequest request, Long id) {
|
||||
return faqDao.getFaqById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FaqResponseBean updateFaq(HttpServletRequest request, Long id, FaqReq faqRequest) {
|
||||
Map<String, Object> userInfo= tokenProvider.getUserInfoAndUserIdFromToken(request);
|
||||
return faqDao.updateFaq(id, faqRequest,Long.parseLong(userInfo.get("userId").toString()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteFaq(HttpServletRequest request, Long id) {
|
||||
faqDao.deleteFaq(id);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
package net.gepafin.tendermanagement.service.impl;
|
||||
|
||||
import net.gepafin.tendermanagement.dao.LookUpDataDao;
|
||||
import net.gepafin.tendermanagement.model.request.LookUpDataRequest;
|
||||
import net.gepafin.tendermanagement.model.response.LookUpDataResponseBean;
|
||||
import net.gepafin.tendermanagement.service.LookUpDataService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class LookUpDataServiceImpl implements LookUpDataService {
|
||||
|
||||
@Autowired
|
||||
private LookUpDataDao lookUpDataDao;
|
||||
|
||||
@Override
|
||||
public LookUpDataResponseBean createLookUpData(LookUpDataRequest lookUpDataReq) {
|
||||
return lookUpDataDao.createLookUpData(lookUpDataReq);
|
||||
}
|
||||
|
||||
@Override
|
||||
public LookUpDataResponseBean getLookUpDataById(Long id) {
|
||||
return lookUpDataDao.getLookUpDataById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public LookUpDataResponseBean updateLookUpData(Long id, LookUpDataRequest lookUpDataReq) {
|
||||
return lookUpDataDao.updateLookUpData(id, lookUpDataReq);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteLookUpData(Long id) {
|
||||
lookUpDataDao.deleteLookUpData(id);
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package net.gepafin.tendermanagement.web.rest.api;
|
||||
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.media.Content;
|
||||
import io.swagger.v3.oas.annotations.media.ExampleObject;
|
||||
import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
||||
@@ -27,14 +28,12 @@ public interface DocumentApi {
|
||||
@ApiResponse(responseCode = "401", description = "Unauthorized", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||
@ExampleObject(value = ErrorConstants.UNAUTHORIZED_ERROR_EXAMPLE) })),
|
||||
@ApiResponse(responseCode = "400", description = "Bad Request", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||
@ExampleObject(value = ErrorConstants.BADREQUEST_ERROR_EXAMPLE) }))
|
||||
})
|
||||
@PostMapping(value = "/uploadFile", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
|
||||
default ResponseEntity<Response<List<DocumentResponseBean>>> uploadFile(HttpServletRequest httpServletRequest,
|
||||
@RequestParam("file") List<MultipartFile> files,
|
||||
@RequestParam("documentType") DocumentTypeEnum documentTypeEnum) {
|
||||
@ExampleObject(value = ErrorConstants.BADREQUEST_ERROR_EXAMPLE) }))})
|
||||
@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) {
|
||||
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
|
||||
}
|
||||
|
||||
@Operation(summary = "API to delete a file by document id",
|
||||
responses = {
|
||||
@ApiResponse(responseCode = "200", description = "File deleted successfully"),
|
||||
@@ -50,4 +49,30 @@ public interface DocumentApi {
|
||||
@RequestParam( "id") Long id) {
|
||||
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
|
||||
}
|
||||
@Operation(summary = "Api to update document",
|
||||
responses = {
|
||||
@ApiResponse(responseCode = "200", description = "OK"),
|
||||
@ApiResponse(responseCode = "404", description = "Not Found", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||
@ExampleObject(value = ErrorConstants.NOTFOUND_ERROR_EXAMPLE) })),
|
||||
@ApiResponse(responseCode = "401", description = "Unauthorized", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||
@ExampleObject(value = ErrorConstants.UNAUTHORIZED_ERROR_EXAMPLE) })),
|
||||
@ApiResponse(responseCode = "400", description = "Bad Request", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||
@ExampleObject(value = ErrorConstants.BADREQUEST_ERROR_EXAMPLE) }))})
|
||||
@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) {
|
||||
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
|
||||
}
|
||||
@Operation(summary = "API to get document by id",
|
||||
responses = {
|
||||
@ApiResponse(responseCode = "200", description = "OK"),
|
||||
@ApiResponse(responseCode = "404", description = "Not Found", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||
@ExampleObject(value = ErrorConstants.NOTFOUND_ERROR_EXAMPLE) })),
|
||||
@ApiResponse(responseCode = "401", description = "Unauthorized", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||
@ExampleObject(value = ErrorConstants.UNAUTHORIZED_ERROR_EXAMPLE) }))
|
||||
})
|
||||
@GetMapping(value = "/{id}", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
ResponseEntity<Response<DocumentResponseBean>> getDocumentById(HttpServletRequest request,
|
||||
@Parameter(description = "document id", required = true)
|
||||
@PathVariable Long id);
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
package net.gepafin.tendermanagement.web.rest.api;
|
||||
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.media.Content;
|
||||
import io.swagger.v3.oas.annotations.media.ExampleObject;
|
||||
import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.validation.Valid;
|
||||
import net.gepafin.tendermanagement.model.request.EvaluationCriteriaRequest;
|
||||
import net.gepafin.tendermanagement.model.response.EvaluationCriteriaResponseBean;
|
||||
import net.gepafin.tendermanagement.model.util.Response;
|
||||
import net.gepafin.tendermanagement.web.rest.api.errors.ErrorConstants;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
public interface EvaluationCriteriaApi {
|
||||
|
||||
|
||||
@Operation(summary = "API to create evaluation criteria",
|
||||
responses = {
|
||||
@ApiResponse(responseCode = "200", description = "OK"),
|
||||
@ApiResponse(responseCode = "404", description = "Not Found", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||
@ExampleObject(value = ErrorConstants.NOTFOUND_ERROR_EXAMPLE) })),
|
||||
@ApiResponse(responseCode = "401", description = "Unauthorized", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||
@ExampleObject(value = ErrorConstants.UNAUTHORIZED_ERROR_EXAMPLE) })),
|
||||
@ApiResponse(responseCode = "400", description = "Bad Request", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||
@ExampleObject(value = ErrorConstants.BADREQUEST_ERROR_EXAMPLE) }))
|
||||
})
|
||||
@PostMapping(value = "/criteria", produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
ResponseEntity<Response<EvaluationCriteriaResponseBean>> createEvaluationCriteria(HttpServletRequest request,
|
||||
@Parameter(description = "Evaluation criteria request object", required = true)
|
||||
@Valid @RequestBody EvaluationCriteriaRequest createCallRequest);
|
||||
|
||||
@Operation(summary = "API to get evaluation criteria by id",
|
||||
responses = {
|
||||
@ApiResponse(responseCode = "200", description = "OK"),
|
||||
@ApiResponse(responseCode = "404", description = "Not Found", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||
@ExampleObject(value = ErrorConstants.NOTFOUND_ERROR_EXAMPLE) })),
|
||||
@ApiResponse(responseCode = "401", description = "Unauthorized", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||
@ExampleObject(value = ErrorConstants.UNAUTHORIZED_ERROR_EXAMPLE) }))
|
||||
})
|
||||
@GetMapping(value = "/criteria/{id}", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
ResponseEntity<Response<EvaluationCriteriaResponseBean>> getEvaluationCriteriaById(HttpServletRequest request,
|
||||
@Parameter(description = "evaluation criteria id", required = true)
|
||||
@PathVariable Long id);
|
||||
|
||||
@Operation(summary = "API to update evaluation criteria",
|
||||
responses = {
|
||||
@ApiResponse(responseCode = "200", description = "OK"),
|
||||
@ApiResponse(responseCode = "404", description = "Not Found", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||
@ExampleObject(value = ErrorConstants.NOTFOUND_ERROR_EXAMPLE) })),
|
||||
@ApiResponse(responseCode = "401", description = "Unauthorized", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||
@ExampleObject(value = ErrorConstants.UNAUTHORIZED_ERROR_EXAMPLE) })),
|
||||
@ApiResponse(responseCode = "400", description = "Bad Request", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||
@ExampleObject(value = ErrorConstants.BADREQUEST_ERROR_EXAMPLE) }))
|
||||
})
|
||||
@PutMapping(value = "/criteria/{id}", produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
ResponseEntity<Response<EvaluationCriteriaResponseBean>> updateEvaluationCriteria(HttpServletRequest request,
|
||||
@Parameter(description = "evaluation criteria id", required = true)
|
||||
@PathVariable Long id,
|
||||
@Parameter(description = "Evaluation criteria request object", required = true)
|
||||
@Valid @RequestBody EvaluationCriteriaRequest evaluationCriteriaRequest);
|
||||
|
||||
@Operation(summary = "API to delete evaluation criteria",
|
||||
responses = {
|
||||
@ApiResponse(responseCode = "204", description = "No Content"),
|
||||
@ApiResponse(responseCode = "404", description = "Not Found", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||
@ExampleObject(value = ErrorConstants.NOTFOUND_ERROR_EXAMPLE) })),
|
||||
@ApiResponse(responseCode = "401", description = "Unauthorized", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||
@ExampleObject(value = ErrorConstants.UNAUTHORIZED_ERROR_EXAMPLE) }))
|
||||
})
|
||||
@DeleteMapping(value = "/criteria/{id}", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
ResponseEntity<Void> deleteEvaluationCriteria(HttpServletRequest request,
|
||||
@Parameter(description = "evaluation criteria id", required = true)
|
||||
@PathVariable Long id);
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
package net.gepafin.tendermanagement.web.rest.api;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.media.Content;
|
||||
import io.swagger.v3.oas.annotations.media.ExampleObject;
|
||||
import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
||||
import net.gepafin.tendermanagement.model.request.FaqReq;
|
||||
import net.gepafin.tendermanagement.model.response.FaqResponseBean;
|
||||
import net.gepafin.tendermanagement.model.util.Response;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import javax.validation.Valid;
|
||||
|
||||
public interface FaqApi {
|
||||
|
||||
@Operation(summary = "API to create FAQ",
|
||||
responses = {
|
||||
@ApiResponse(responseCode = "201", description = "Created"),
|
||||
@ApiResponse(responseCode = "400", description = "Bad Request", content = @Content(mediaType = "application/json", examples = @ExampleObject(value = "{ \"error\": \"Bad Request\" }"))),
|
||||
@ApiResponse(responseCode = "401", description = "Unauthorized", content = @Content(mediaType = "application/json", examples = @ExampleObject(value = "{ \"error\": \"Unauthorized\" }"))),
|
||||
@ApiResponse(responseCode = "404", description = "Not Found", content = @Content(mediaType = "application/json", examples = @ExampleObject(value = "{ \"error\": \"Not Found\" }")))
|
||||
})
|
||||
@PostMapping(value = "/call/{callId}", consumes = "application/json", produces = "application/json")
|
||||
ResponseEntity<Response<FaqResponseBean>> createFaq(HttpServletRequest request, @Parameter(description = "evaluation criteria id", required = true)
|
||||
@PathVariable Long id, @Valid @RequestBody FaqReq faqRequest);
|
||||
|
||||
@Operation(summary = "API to get FAQ by id",
|
||||
responses = {
|
||||
@ApiResponse(responseCode = "200", description = "OK"),
|
||||
@ApiResponse(responseCode = "404", description = "Not Found", content = @Content(mediaType = "application/json", examples = @ExampleObject(value = "{ \"error\": \"Not Found\" }")))
|
||||
})
|
||||
@GetMapping(value = "/{id}", produces = "application/json")
|
||||
ResponseEntity<Response<FaqResponseBean>> getFaqById(HttpServletRequest request,
|
||||
@PathVariable Long id);
|
||||
|
||||
@Operation(summary = "API to update FAQ",
|
||||
responses = {
|
||||
@ApiResponse(responseCode = "200", description = "OK"),
|
||||
@ApiResponse(responseCode = "404", description = "Not Found", content = @Content(mediaType = "application/json", examples = @ExampleObject(value = "{ \"error\": \"Not Found\" }"))),
|
||||
@ApiResponse(responseCode = "400", description = "Bad Request", content = @Content(mediaType = "application/json", examples = @ExampleObject(value = "{ \"error\": \"Bad Request\" }")))
|
||||
})
|
||||
@PutMapping(value = "/{id}", consumes = "application/json", produces = "application/json")
|
||||
ResponseEntity<Response<FaqResponseBean>> updateFaq(HttpServletRequest request,
|
||||
@PathVariable Long id,
|
||||
@Valid @RequestBody FaqReq faqRequest);
|
||||
|
||||
@Operation(summary = "API to delete FAQ",
|
||||
responses = {
|
||||
@ApiResponse(responseCode = "204", description = "No Content"),
|
||||
@ApiResponse(responseCode = "404", description = "Not Found", content = @Content(mediaType = "application/json", examples = @ExampleObject(value = "{ \"error\": \"Not Found\" }")))
|
||||
})
|
||||
@DeleteMapping(value = "/{id}")
|
||||
ResponseEntity<Response<Void>> deleteFaq(HttpServletRequest request,
|
||||
@PathVariable Long id);
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
package net.gepafin.tendermanagement.web.rest.api;
|
||||
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.media.Content;
|
||||
import io.swagger.v3.oas.annotations.media.ExampleObject;
|
||||
import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
||||
import net.gepafin.tendermanagement.model.request.LookUpDataRequest;
|
||||
import net.gepafin.tendermanagement.model.response.LookUpDataResponseBean;
|
||||
import net.gepafin.tendermanagement.model.util.Response;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import javax.validation.Valid;
|
||||
|
||||
public interface LookUpDataApi {
|
||||
|
||||
@Operation(summary = "API to create LookUp Data",
|
||||
responses = {
|
||||
@ApiResponse(responseCode = "201", description = "Created"),
|
||||
@ApiResponse(responseCode = "400", description = "Bad Request", content = @Content(mediaType = "application/json", examples = @ExampleObject(value = "{ \"error\": \"Bad Request\" }"))),
|
||||
@ApiResponse(responseCode = "404", description = "Not Found", content = @Content(mediaType = "application/json", examples = @ExampleObject(value = "{ \"error\": \"Not Found\" }")))
|
||||
})
|
||||
@PostMapping(value = "", consumes = "application/json", produces = "application/json")
|
||||
ResponseEntity<Response<LookUpDataResponseBean>> createLookUpData(HttpServletRequest request, @Valid @RequestBody LookUpDataRequest lookUpDataReq);
|
||||
|
||||
@Operation(summary = "API to get LookUp Data by id",
|
||||
responses = {
|
||||
@ApiResponse(responseCode = "200", description = "OK"),
|
||||
@ApiResponse(responseCode = "404", description = "Not Found", content = @Content(mediaType = "application/json", examples = @ExampleObject(value = "{ \"error\": \"Not Found\" }")))
|
||||
})
|
||||
@GetMapping(value = "/{id}", produces = "application/json")
|
||||
ResponseEntity<Response<LookUpDataResponseBean>> getLookUpDataById(HttpServletRequest request, @PathVariable Long id);
|
||||
|
||||
@Operation(summary = "API to update LookUp Data",
|
||||
responses = {
|
||||
@ApiResponse(responseCode = "200", description = "OK"),
|
||||
@ApiResponse(responseCode = "400", description = "Bad Request", content = @Content(mediaType = "application/json", examples = @ExampleObject(value = "{ \"error\": \"Bad Request\" }"))),
|
||||
@ApiResponse(responseCode = "404", description = "Not Found", content = @Content(mediaType = "application/json", examples = @ExampleObject(value = "{ \"error\": \"Not Found\" }")))
|
||||
})
|
||||
@PutMapping(value = "/{id}", consumes = "application/json", produces = "application/json")
|
||||
ResponseEntity<Response<LookUpDataResponseBean>> updateLookUpData(HttpServletRequest request, @PathVariable Long id, @Valid @RequestBody LookUpDataRequest lookUpDataReq);
|
||||
|
||||
@Operation(summary = "API to delete LookUp Data",
|
||||
responses = {
|
||||
@ApiResponse(responseCode = "204", description = "No Content"),
|
||||
@ApiResponse(responseCode = "404", description = "Not Found", content = @Content(mediaType = "application/json", examples = @ExampleObject(value = "{ \"error\": \"Not Found\" }")))
|
||||
})
|
||||
@DeleteMapping(value = "/{id}")
|
||||
ResponseEntity<Response<Void>> deleteLookUpData(HttpServletRequest request, @PathVariable Long id);
|
||||
}
|
||||
@@ -20,16 +20,17 @@ import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("${openapi.swaggerBflowsMiddleware.base-path:/v1/document}")
|
||||
public class DocumentApiController implements DocumentApi {
|
||||
public class
|
||||
DocumentApiController implements DocumentApi {
|
||||
|
||||
@Autowired
|
||||
private DocumentService fileService;
|
||||
private DocumentService documentService;
|
||||
|
||||
@Override
|
||||
public ResponseEntity<Response<List<DocumentResponseBean>>> uploadFile(HttpServletRequest httpServletRequest,
|
||||
public ResponseEntity<Response<List<DocumentResponseBean>>> uploadFile(HttpServletRequest httpServletRequest, Long callId,
|
||||
List<MultipartFile> files, DocumentTypeEnum fileType) {
|
||||
try {
|
||||
List<DocumentResponseBean> responseBeans=fileService.uploadFile(files,fileType);
|
||||
List<DocumentResponseBean> responseBeans = documentService.uploadFile(files, callId, fileType);
|
||||
return ResponseEntity.status(HttpStatus.CREATED)
|
||||
.body(new Response<List<DocumentResponseBean>>(responseBeans, Status.SUCCESS, Translator.toLocale(GepafinConstant.FILES_UPLOADED_MSG)));
|
||||
} catch (CustomValidationException ex) {
|
||||
@@ -38,8 +39,22 @@ public class DocumentApiController implements DocumentApi {
|
||||
}
|
||||
@Override
|
||||
public ResponseEntity<Response<Void>> deleteFile(HttpServletRequest httpServletRequest, Long documentId) {
|
||||
fileService.deleteFile(documentId);
|
||||
documentService.deleteFile(documentId);
|
||||
return ResponseEntity.status(HttpStatus.CREATED)
|
||||
.body(new Response<Void>(null, Status.SUCCESS, Translator.toLocale(GepafinConstant.FILE_DELETED_SUCCESSFULLY_MSG)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<Response<DocumentResponseBean>> updateDocument(HttpServletRequest httpServletRequest, Long documentId, MultipartFile file, DocumentTypeEnum documentTypeEnum) {
|
||||
DocumentResponseBean responseBeans = documentService.updateDocument(httpServletRequest, documentId, file, documentTypeEnum);
|
||||
return ResponseEntity.status(HttpStatus.CREATED)
|
||||
.body(new Response<DocumentResponseBean>(responseBeans, Status.SUCCESS, Translator.toLocale(GepafinConstant.DOCUMENT_UPDATED_SUCCESSFULLY)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<Response<DocumentResponseBean>> getDocumentById(HttpServletRequest request, Long id) {
|
||||
DocumentResponseBean documentResponseBean= documentService.getDocument(request,id);
|
||||
return ResponseEntity.status(HttpStatus.CREATED)
|
||||
.body(new Response<DocumentResponseBean>(documentResponseBean, Status.SUCCESS, Translator.toLocale(GepafinConstant.DOCUMENT_FETCHED_SUCCESSFULLY)));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
package net.gepafin.tendermanagement.web.rest.api.impl;
|
||||
|
||||
import net.gepafin.tendermanagement.config.Translator;
|
||||
import net.gepafin.tendermanagement.constants.GepafinConstant;
|
||||
import net.gepafin.tendermanagement.model.request.EvaluationCriteriaRequest;
|
||||
import net.gepafin.tendermanagement.model.response.EvaluationCriteriaResponseBean;
|
||||
import net.gepafin.tendermanagement.model.util.Response;
|
||||
import net.gepafin.tendermanagement.service.EvaluationCriteriaService;
|
||||
import net.gepafin.tendermanagement.web.rest.api.EvaluationCriteriaApi;
|
||||
import net.gepafin.tendermanagement.web.rest.api.errors.Status;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("${openapi.gepafin.base-path:/v1/evaluation}")
|
||||
public class EvaluationCriteriaApiController implements EvaluationCriteriaApi {
|
||||
|
||||
@Autowired
|
||||
private EvaluationCriteriaService service;
|
||||
|
||||
@Override
|
||||
public ResponseEntity<Response<EvaluationCriteriaResponseBean>> createEvaluationCriteria(HttpServletRequest request, EvaluationCriteriaRequest evaluationCriteriaRequest) {
|
||||
EvaluationCriteriaResponseBean responseBean = service.createEvaluationCriteria(request,evaluationCriteriaRequest);
|
||||
return ResponseEntity.status(HttpStatus.CREATED)
|
||||
.body(new Response<>(responseBean, Status.SUCCESS, Translator.toLocale(GepafinConstant.EVALUATION_CRITERIA_CREATED_SUCCESSFULLY)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<Response<EvaluationCriteriaResponseBean>> getEvaluationCriteriaById(HttpServletRequest request, Long id) {
|
||||
EvaluationCriteriaResponseBean responseBean = service.getEvaluationCriteria(request,id);
|
||||
if (responseBean != null) {
|
||||
return ResponseEntity.status(HttpStatus.OK)
|
||||
.body(new Response<>(responseBean, Status.SUCCESS, Translator.toLocale(GepafinConstant.EVALUATION_CRITERIA_FETCH_SUCCESSFULLY)));
|
||||
} else {
|
||||
return ResponseEntity.status(HttpStatus.NOT_FOUND)
|
||||
.body(new Response<>(null, Status.NOT_FOUND, Translator.toLocale(GepafinConstant.EVALUATION_CRITERIA_NOT_FOUND)));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor=Exception.class)
|
||||
public ResponseEntity<Response<EvaluationCriteriaResponseBean>> updateEvaluationCriteria(HttpServletRequest request, Long id, EvaluationCriteriaRequest evaluationCriteriaRequest) {
|
||||
EvaluationCriteriaResponseBean responseBean = service.updateEvaluationCriteria(request,id, evaluationCriteriaRequest);
|
||||
if (responseBean != null) {
|
||||
return ResponseEntity.status(HttpStatus.OK)
|
||||
.body(new Response<>(responseBean, Status.SUCCESS, Translator.toLocale(GepafinConstant.EVALUATION_CRITERIA_UPDATED_SUCCESSFULLY)));
|
||||
} else {
|
||||
return ResponseEntity.status(HttpStatus.NOT_FOUND)
|
||||
.body(new Response<>(null, Status.NOT_FOUND, Translator.toLocale(GepafinConstant.EVALUATION_CRITERIA_NOT_FOUND)));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<Void> deleteEvaluationCriteria(HttpServletRequest request, Long id) {
|
||||
service.deleteEvaluationCriteria(request,id);
|
||||
return ResponseEntity.status(HttpStatus.OK)
|
||||
.header("Message", Translator.toLocale(GepafinConstant.EVALUATION_CRITERIA_DELETED_SUCCESSFULLY))
|
||||
.build();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package net.gepafin.tendermanagement.web.rest.api.impl;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import net.gepafin.tendermanagement.config.Translator;
|
||||
import net.gepafin.tendermanagement.constants.GepafinConstant;
|
||||
import net.gepafin.tendermanagement.model.request.FaqReq;
|
||||
import net.gepafin.tendermanagement.model.response.FaqResponseBean;
|
||||
import net.gepafin.tendermanagement.model.util.Response;
|
||||
import net.gepafin.tendermanagement.service.FaqService;
|
||||
import net.gepafin.tendermanagement.web.rest.api.FaqApi;
|
||||
import net.gepafin.tendermanagement.web.rest.api.errors.Status;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("${openapi.gepafin.base-path:/v1/faq}")
|
||||
public class FaqApiController implements FaqApi {
|
||||
|
||||
@Autowired
|
||||
private FaqService faqService;
|
||||
|
||||
@Override
|
||||
public ResponseEntity<Response<FaqResponseBean>> createFaq(HttpServletRequest request, Long callId,FaqReq faqRequest) {
|
||||
FaqResponseBean response = faqService.createFaq(request,callId, faqRequest);
|
||||
return ResponseEntity.status(HttpStatus.CREATED)
|
||||
.body(new Response<>(response, Status.SUCCESS, Translator.toLocale(GepafinConstant.FAQ_CREATED_SUCCESSFULLY)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<Response<FaqResponseBean>> getFaqById(HttpServletRequest request, Long id) {
|
||||
FaqResponseBean response = faqService.getFaqById(request, id);
|
||||
if (response != null) {
|
||||
return ResponseEntity.status(HttpStatus.OK)
|
||||
.body(new Response<>(response, Status.SUCCESS, Translator.toLocale(GepafinConstant.FAQ_FETCHED_SUCCESSFULLY)));
|
||||
} else {
|
||||
return ResponseEntity.status(HttpStatus.NOT_FOUND)
|
||||
.body(new Response<>(null, Status.NOT_FOUND, Translator.toLocale(GepafinConstant.FAQ_NOT_FOUND)));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<Response<FaqResponseBean>> updateFaq(HttpServletRequest request, Long id, FaqReq faqRequest) {
|
||||
FaqResponseBean response = faqService.updateFaq(request, id, faqRequest);
|
||||
if (response != null) {
|
||||
return ResponseEntity.status(HttpStatus.OK)
|
||||
.body(new Response<>(response, Status.SUCCESS, Translator.toLocale(GepafinConstant.FAQ_UPDATED_SUCCESSFULLY)));
|
||||
} else {
|
||||
return ResponseEntity.status(HttpStatus.NOT_FOUND)
|
||||
.body(new Response<>(null, Status.NOT_FOUND, Translator.toLocale(GepafinConstant.FAQ_NOT_FOUND)));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<Response<Void>> deleteFaq(HttpServletRequest request, Long id) {
|
||||
faqService.deleteFaq(request, id);
|
||||
return ResponseEntity.status(HttpStatus.OK)
|
||||
.body(new Response<>(null, Status.SUCCESS, Translator.toLocale(GepafinConstant.FAQ_DELETED_SUCCESSFULLY)));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
package net.gepafin.tendermanagement.web.rest.api.impl;
|
||||
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import net.gepafin.tendermanagement.config.Translator;
|
||||
import net.gepafin.tendermanagement.constants.GepafinConstant;
|
||||
import net.gepafin.tendermanagement.model.request.LookUpDataRequest;
|
||||
import net.gepafin.tendermanagement.model.response.LookUpDataResponseBean;
|
||||
import net.gepafin.tendermanagement.model.util.Response;
|
||||
import net.gepafin.tendermanagement.service.LookUpDataService;
|
||||
import net.gepafin.tendermanagement.web.rest.api.LookUpDataApi;
|
||||
import net.gepafin.tendermanagement.web.rest.api.errors.Status;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("${openapi.gepafin.base-path:/v1/lookupdata}")
|
||||
public class LookUpDataApiController implements LookUpDataApi {
|
||||
|
||||
@Autowired
|
||||
private LookUpDataService lookUpDataService;
|
||||
|
||||
@Override
|
||||
public ResponseEntity<Response<LookUpDataResponseBean>> createLookUpData(HttpServletRequest request, LookUpDataRequest lookUpDataReq) {
|
||||
LookUpDataResponseBean responseBean = lookUpDataService.createLookUpData(lookUpDataReq);
|
||||
return ResponseEntity.status(HttpStatus.CREATED)
|
||||
.body(new Response<LookUpDataResponseBean>(responseBean, Status.SUCCESS, Translator.toLocale(GepafinConstant.LOOKUP_DATA_CREATED_SUCCESSFULLY)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<Response<LookUpDataResponseBean>> getLookUpDataById(HttpServletRequest request, Long id) {
|
||||
LookUpDataResponseBean responseBean = lookUpDataService.getLookUpDataById(id);
|
||||
if (responseBean != null) {
|
||||
return ResponseEntity.status(HttpStatus.OK)
|
||||
.body(new Response<LookUpDataResponseBean>(responseBean, Status.SUCCESS, Translator.toLocale(GepafinConstant.LOOKUP_DATA_FETCHED_SUCCESSFULLY)));
|
||||
} else {
|
||||
return ResponseEntity.status(HttpStatus.NOT_FOUND)
|
||||
.body(new Response<LookUpDataResponseBean>(responseBean, Status.NOT_FOUND, Translator.toLocale(GepafinConstant.LOOKUP_DATA_NOT_FOUND)));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<Response<LookUpDataResponseBean>> updateLookUpData(HttpServletRequest request, Long id, LookUpDataRequest lookUpDataReq) {
|
||||
LookUpDataResponseBean responseBean = lookUpDataService.updateLookUpData(id, lookUpDataReq);
|
||||
if (responseBean != null) {
|
||||
return ResponseEntity.status(HttpStatus.OK)
|
||||
.body(new Response<LookUpDataResponseBean>(responseBean, Status.SUCCESS, Translator.toLocale(GepafinConstant.LOOKUP_DATA_UPDATED_SUCCESSFULLY)));
|
||||
} else {
|
||||
return ResponseEntity.status(HttpStatus.NOT_FOUND)
|
||||
.body(new Response<LookUpDataResponseBean>(responseBean, Status.NOT_FOUND, Translator.toLocale(GepafinConstant.LOOKUP_DATA_NOT_FOUND)));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<Response<Void>> deleteLookUpData(HttpServletRequest request, Long id) {
|
||||
lookUpDataService.deleteLookUpData(id);
|
||||
return ResponseEntity.status(HttpStatus.OK)
|
||||
.body(new Response<>(null, Status.SUCCESS, Translator.toLocale(GepafinConstant.LOOKUP_DATA_DELETED_SUCCESSFULLY)));
|
||||
}
|
||||
}
|
||||
@@ -45,6 +45,8 @@ document.not.found=Document not found.
|
||||
document.id.not.found=Document ID not found.
|
||||
call.created.successfully=Call created successfully.
|
||||
call.invalid.date=Invalid start or end date.
|
||||
call.not.found=Call not dound.
|
||||
score.not.null=Score cannot be null or cannot be zero.
|
||||
|
||||
# Login-related messages
|
||||
login.successfully=Login successfully.
|
||||
@@ -57,6 +59,12 @@ invalid_signature=Invalid token.
|
||||
invalid_login=Invalid username or password.
|
||||
req_validation_er=Request Validation Error
|
||||
|
||||
#EvaluationCriteria-related messages
|
||||
evaluation.criteria.not.found=EvaluationCriteria not found.
|
||||
evaluation.criteria.created.successfully=EvaluationCriteria created successfully.
|
||||
evaluation.criteria.fetch.successfully=EvaluationCriteria fetched successfully.
|
||||
evaluation.criteria.updated.successfully=EvaluationCriteria updated successfully.
|
||||
evaluation.criteria.deleted.successfully=EvaluationCriteria deleted successfully.
|
||||
# Password reset messages
|
||||
password.reset.initiated=Password reset initiated.
|
||||
password.reset.success=Password has been successfully reset.
|
||||
@@ -72,6 +80,20 @@ update.user.status.success=User status has been successfully updated.
|
||||
|
||||
|
||||
|
||||
#Faq-related messages
|
||||
faq.not.found=Faq not found.
|
||||
faq.created.successfully=Faq created successfully.
|
||||
faq.fetched.successfully=Faq fetched successfully.
|
||||
faq.updated.successfully=Faq updated successfully.
|
||||
faq.deleted.successfully=Faq deleted successfully.
|
||||
|
||||
#LookUpData-related message
|
||||
lookupdata.not.found=LookUpData not found.
|
||||
lookupdata.created.successfully=LookUpData created successfully.
|
||||
lookupdata.fetched.successfully=LookUpData fetched successfully.
|
||||
lookupdata.updated.successfully=LookUpData updated successfully.
|
||||
lookupdata.deleted.successfully=LookUpData deleted successfully.
|
||||
|
||||
|
||||
#Document-related message
|
||||
document.updated.successfully=Document updated successfully.
|
||||
document.fetched.successfully=Document fetched successfully.
|
||||
@@ -44,6 +44,8 @@ file.deleted.successfully=File eliminato con successo.
|
||||
document.not.found=Documento non trovato.
|
||||
document.id.not.found=ID documento non trovato.
|
||||
call.invalid.date=Data di inizio o fine non valida.
|
||||
call.not.found=Chiamata non trovata.
|
||||
score.not.null=Il punteggio non pu<70> essere nullo o zero.
|
||||
|
||||
# Login-related messages
|
||||
login.successfully=Accesso effettuato con successo.
|
||||
@@ -55,13 +57,38 @@ common_message=qualcosa é andato storto. Per favore riprova
|
||||
invalid_signature=Gettone non valido.
|
||||
invalid_login=Nome utente o password errati
|
||||
req_validation_er=Errore di convalida
|
||||
|
||||
#EvaluationCriteria-related messages
|
||||
evaluation.criteria.not.found=EvaluationCriteria non trovato.
|
||||
evaluation.criteria.created.successfully=EvaluationCriteria creato con successo.
|
||||
evaluation.criteria.fetch.successfully=Recupero EvaluationCriteria riuscito.
|
||||
evaluation.criteria.updated.successfully=EvaluationCriteria aggiornato con successo.
|
||||
evaluation.criteria.deleted.successfully=EvaluationCriteria eliminato con successo.
|
||||
|
||||
#faq-related messages
|
||||
faq.not.found=Faq non trovata.
|
||||
faq.created.successfully=Faq creata con successo.
|
||||
faq.fetched.successfully=Faq recuperata con successo.
|
||||
faq.updated.successfully=Faq aggiornata con successo.
|
||||
faq.deleted.successfully=Faq eliminata con successo.
|
||||
|
||||
#LookUpData-related message
|
||||
lookupdata.not.found=LookUpData non trovato.
|
||||
lookupdata.created.successfully=LookUpData creato correttamente.
|
||||
lookupdata.fetched.successfully=LookUpData recuperato correttamente.
|
||||
lookupdata.updated.successfully=LookUpData aggiornato correttamente.
|
||||
lookupdata.deleted.successfully=LookUpData eliminato correttamente.
|
||||
|
||||
#Document-related message
|
||||
document.updated.successfully=Documento aggiornato con successo.
|
||||
document.fetched.successfully=Documento recuperato con successo.
|
||||
# Password reset messages
|
||||
password.reset.initiated=Reimpostazione della password avviata.
|
||||
password.reset.success=La password è stata reimpostata con successo.
|
||||
invalid.token.msg=Il token fornito è invalido o scaduto. Si prega di richiedere un nuovo token.
|
||||
current.password.incorrect = La password attuale non è corretta.
|
||||
password.reset.success=La password <EFBFBD> stata reimpostata con successo.
|
||||
invalid.token.msg=Il token fornito <EFBFBD> invalido o scaduto. Si prega di richiedere un nuovo token.
|
||||
current.password.incorrect = La password attuale non <EFBFBD> corretta.
|
||||
success.password.changed=Password cambiata con successo.
|
||||
logout.successful.msg=Logout riuscito. Sei stato disconnesso con successo.
|
||||
|
||||
update.user.status.success=Lo stato dell'utente è stato aggiornato con successo.
|
||||
update.user.status.success=Lo stato dell'utente <EFBFBD> stato aggiornato con successo.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user