resolved conflicts
This commit is contained in:
@@ -128,4 +128,5 @@ public class GepafinConstant {
|
||||
|
||||
|
||||
|
||||
public static final String FLOW_NOT_FOUND = "flow.not.found";
|
||||
}
|
||||
|
||||
@@ -3,13 +3,20 @@ package net.gepafin.tendermanagement.dao;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import net.gepafin.tendermanagement.enums.DocumentSourceTypeEnum;
|
||||
import net.gepafin.tendermanagement.enums.RoleStatusEnum;
|
||||
import net.gepafin.tendermanagement.model.response.*;
|
||||
import net.gepafin.tendermanagement.service.FaqService;
|
||||
import net.gepafin.tendermanagement.service.LookUpDataService;
|
||||
import net.gepafin.tendermanagement.service.*;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.core.Authentication;
|
||||
import org.springframework.security.core.GrantedAuthority;
|
||||
import org.springframework.security.core.context.SecurityContext;
|
||||
import org.springframework.security.core.context.SecurityContextHolder;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
@@ -39,13 +46,14 @@ import net.gepafin.tendermanagement.repositories.DocumentRepository;
|
||||
import net.gepafin.tendermanagement.repositories.EvaluationCriteriaRepository;
|
||||
import net.gepafin.tendermanagement.repositories.FaqRepository;
|
||||
import net.gepafin.tendermanagement.repositories.RegionRepository;
|
||||
import net.gepafin.tendermanagement.service.UserService;
|
||||
import net.gepafin.tendermanagement.service.impl.CallValidatorServiceImpl;
|
||||
import net.gepafin.tendermanagement.web.rest.api.errors.CustomValidationException;
|
||||
import net.gepafin.tendermanagement.web.rest.api.errors.ResourceNotFoundException;
|
||||
import net.gepafin.tendermanagement.web.rest.api.errors.Status;
|
||||
|
||||
import static net.gepafin.tendermanagement.enums.RoleStatusEnum.ROLE_SUPER_ADMIN;
|
||||
import static net.gepafin.tendermanagement.util.Utils.setIfUpdated;
|
||||
import static org.springframework.security.authorization.AuthorityReactiveAuthorizationManager.hasRole;
|
||||
|
||||
@Component
|
||||
public class CallDao {
|
||||
@@ -76,6 +84,10 @@ public class CallDao {
|
||||
|
||||
@Autowired
|
||||
private FaqService faqService;
|
||||
@Autowired
|
||||
private FlowDao flowDao;
|
||||
@Autowired
|
||||
private FormDao formDao;
|
||||
|
||||
public CallResponse createCallStep1(CreateCallRequestStep1 createCallRequest, Long userId) {
|
||||
UserEntity userEntity = userService.validateUser(userId);
|
||||
@@ -167,14 +179,14 @@ public class CallDao {
|
||||
}
|
||||
|
||||
|
||||
public List<DocumentEntity> convertToDocumentEntities(List<DocumentReq> documentReqList, CallEntity callEntity,
|
||||
public List<DocumentEntity> convertToDocumentEntities(List<DocumentReq> documentReqList, Long sourceId,
|
||||
DocumentTypeEnum documentType) {
|
||||
if (documentReqList == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
List<DocumentEntity> existingDocuments = documentRepository
|
||||
.findByCallIdAndTypeAndIsDeletedFalse(callEntity.getId(), documentType.getValue());
|
||||
.findBySourceIdAndTypeAndIsDeletedFalse(sourceId, documentType.getValue());
|
||||
|
||||
List<Long> incomingIds = documentReqList.stream().map(DocumentReq::getId).filter(id -> id != null && id > 0)
|
||||
.collect(Collectors.toList());
|
||||
@@ -182,7 +194,7 @@ public class CallDao {
|
||||
existingDocuments.stream().filter(document -> !incomingIds.contains(document.getId()))
|
||||
.forEach(this::softDeleteDocument);
|
||||
List<DocumentEntity> documentEntities = documentReqList.stream()
|
||||
.map(req -> convertToDocumentEntity(req, callEntity)).collect(Collectors.toList());
|
||||
.map(req -> convertToDocumentEntity(req, sourceId)).collect(Collectors.toList());
|
||||
documentRepository.saveAll(documentEntities);
|
||||
return documentEntities;
|
||||
}
|
||||
@@ -192,9 +204,9 @@ public class CallDao {
|
||||
documentRepository.save(documentEntity);
|
||||
}
|
||||
|
||||
private DocumentEntity convertToDocumentEntity(DocumentReq documentReq, CallEntity callEntity) {
|
||||
private DocumentEntity convertToDocumentEntity(DocumentReq documentReq,Long sourceId) {
|
||||
validateDocumentEntity(documentReq.getId());
|
||||
DocumentEntity documentEntity = documentRepository.findByIdAndCallIdAndIsDeletedFalse(documentReq.getId(), callEntity.getId())
|
||||
DocumentEntity documentEntity = documentRepository.findByIdAndSourceIdAndIsDeletedFalse(documentReq.getId(),sourceId)
|
||||
.orElseThrow(() -> new ResourceNotFoundException(Status.NOT_FOUND,
|
||||
Translator.toLocale(GepafinConstant.DOCUMENT_NOT_FOUND)));
|
||||
return documentEntity;
|
||||
@@ -275,7 +287,9 @@ public class CallDao {
|
||||
DocumentResponseBean responseBean = new DocumentResponseBean();
|
||||
responseBean.setId(entity.getId());
|
||||
responseBean.setName(entity.getFileName());
|
||||
responseBean.setDescription(entity.getDescription());
|
||||
responseBean.setType(DocumentTypeEnum.valueOf(entity.getType()));
|
||||
responseBean.setSource(DocumentSourceTypeEnum.valueOf(entity.getSource()));
|
||||
responseBean.setSourceId(entity.getSourceId());
|
||||
responseBean.setFilePath(entity.getFilePath());
|
||||
responseBean.setCreatedDate(entity.getCreatedDate());
|
||||
responseBean.setUpdatedDate(entity.getUpdatedDate());
|
||||
@@ -362,9 +376,9 @@ public class CallDao {
|
||||
callRepository.save(callEntity);
|
||||
convertToEvaluationCriteriaEntities(createCallRequest.getCriteria(), callEntity, LookUpDataTypeEnum.EVALUATION_CRITERIA);
|
||||
|
||||
convertToDocumentEntities(createCallRequest.getDocs(), callEntity, DocumentTypeEnum.DOCUMENT);
|
||||
convertToDocumentEntities(createCallRequest.getDocs(), callEntity.getId(), DocumentTypeEnum.DOCUMENT);
|
||||
|
||||
convertToDocumentEntities(createCallRequest.getImages(), callEntity, DocumentTypeEnum.IMAGES);
|
||||
convertToDocumentEntities(createCallRequest.getImages(), callEntity.getId(), DocumentTypeEnum.IMAGES);
|
||||
|
||||
updateLookUpData(callEntity, createCallRequest.getCheckList(), LookUpDataTypeEnum.CHECKLIST);
|
||||
|
||||
@@ -523,9 +537,9 @@ public class CallDao {
|
||||
}
|
||||
|
||||
private CallResponse getCallResponseBean(CallEntity callEntity) {
|
||||
List<DocumentEntity> documentEntities = documentRepository.findByCallIdAndTypeAndIsDeletedFalse(callEntity.getId(),
|
||||
List<DocumentEntity> documentEntities = documentRepository.findBySourceIdAndTypeAndIsDeletedFalse(callEntity.getId(),
|
||||
DocumentTypeEnum.DOCUMENT.getValue());
|
||||
List<DocumentEntity> imageEntities = documentRepository.findByCallIdAndTypeAndIsDeletedFalse(callEntity.getId(),
|
||||
List<DocumentEntity> imageEntities = documentRepository.findBySourceIdAndTypeAndIsDeletedFalse(callEntity.getId(),
|
||||
DocumentTypeEnum.IMAGES.getValue());
|
||||
List<LookUpDataResponse> amiedTo = callTargetAudienceChecklistRepository
|
||||
.findByCallIdAndLookupDataTypeAndIsDeletedFalse(callEntity.getId(), LookUpDataTypeEnum.AIMED_TO.getValue()).stream()
|
||||
@@ -545,9 +559,14 @@ public class CallDao {
|
||||
return createCallResponseBean;
|
||||
}
|
||||
|
||||
public List<CallDetailsResponseBean> getAllCalls() {
|
||||
return callRepository.findAll()
|
||||
.stream()
|
||||
public List<CallDetailsResponseBean> getAllCalls(UserEntity user) {
|
||||
String type=user.getRoleEntity().getRoleType();
|
||||
List<String> callStatusList =CallStatusEnum.getStatusValues();
|
||||
if (Boolean.FALSE.equals(ROLE_SUPER_ADMIN.getValue().equals(type))) {
|
||||
callStatusList = List.of(CallStatusEnum.PUBLISH.getValue());
|
||||
}
|
||||
List<CallEntity> calls = callRepository.findByStatusIn(callStatusList);
|
||||
return calls.stream()
|
||||
.map(this::convertToCallDetailsResponseBean)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
@@ -555,7 +574,9 @@ public class CallDao {
|
||||
public CallResponse validateCallData(CallEntity callEntity) {
|
||||
validateUpdate(callEntity);
|
||||
CallResponse callResponseBean = getCallResponseBean(callEntity);
|
||||
CallValidatorServiceImpl.validateResponse(callResponseBean);
|
||||
FlowResponseBean flowResponseBean = flowDao.getFlowByCallId(callEntity.getId());
|
||||
List<FormResponseBean> formResponseBean = formDao.getFormsByCallId(callEntity.getId());
|
||||
CallValidatorServiceImpl.validateResponse(callResponseBean,flowResponseBean,formResponseBean);
|
||||
callEntity.setStatus(CallStatusEnum.READY_TO_PUBLISH.getValue());
|
||||
callRepository.save(callEntity);
|
||||
callResponseBean.setCurrentStep(GepafinConstant.VALIDATE_REQUEST);
|
||||
|
||||
@@ -3,6 +3,7 @@ package net.gepafin.tendermanagement.dao;
|
||||
import java.io.IOException;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import net.gepafin.tendermanagement.enums.DocumentSourceTypeEnum;
|
||||
import org.apache.commons.io.FilenameUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
@@ -40,16 +41,17 @@ public class DocumentDao {
|
||||
@Autowired
|
||||
private CallService callService;
|
||||
|
||||
public List<DocumentResponseBean> uploadFiles(List<MultipartFile> files, Long callId, DocumentTypeEnum fileType) {
|
||||
public List<DocumentResponseBean> uploadFiles(List<MultipartFile> files, Long sourceId, DocumentSourceTypeEnum sourceType, DocumentTypeEnum fileType) {
|
||||
List<DocumentEntity> documentEntities = new ArrayList<>();
|
||||
CallEntity callEntity = callService.validateCall(callId);
|
||||
Long source = resolveSourceId(sourceId, sourceType);
|
||||
for (MultipartFile file : files) {
|
||||
try {
|
||||
uploadFileOnAmazonS3 result = uploadFileOnAmazonS3(file);
|
||||
if (result != null) {
|
||||
DocumentEntity documentEntity = new DocumentEntity();
|
||||
documentEntity.setFileName(result.fileName());
|
||||
documentEntity.setCall(callEntity);
|
||||
documentEntity.setSource(sourceType.getValue());
|
||||
documentEntity.setSourceId(source);
|
||||
documentEntity.setType(fileType.getValue());
|
||||
documentEntity.setFilePath(result.filepath());
|
||||
documentEntity.setIsDeleted(false);
|
||||
@@ -61,6 +63,18 @@ public class DocumentDao {
|
||||
documentRepository.saveAll(documentEntities);
|
||||
return documentEntities.stream().map(callDao::convertToDocumentResponseBean).collect(Collectors.toList());
|
||||
}
|
||||
private Long resolveSourceId(Long sourceId, DocumentSourceTypeEnum sourceType) {
|
||||
if (sourceType == DocumentSourceTypeEnum.CALL) {
|
||||
CallEntity callEntity = callService.validateCall(sourceId);
|
||||
return callEntity.getId();
|
||||
}
|
||||
// else if (sourceType == SourceTypeEnum.APPLICATION) {
|
||||
// ApplicationEntity applicationEntity = applicationService.validateApplication(sourceId);
|
||||
// return applicationEntity.getId(); // Assuming ApplicationEntity has getId()
|
||||
// }
|
||||
//
|
||||
return sourceId;
|
||||
}
|
||||
|
||||
private uploadFileOnAmazonS3 uploadFileOnAmazonS3(MultipartFile file) throws IOException {
|
||||
String extension = FilenameUtils.getExtension(file.getOriginalFilename());
|
||||
@@ -109,6 +123,8 @@ public class DocumentDao {
|
||||
documentEntity.setFilePath(result.filepath);
|
||||
documentEntity.setFileName(result.fileName);
|
||||
documentEntity.setType(documentTypeEnum.getValue());
|
||||
documentEntity.setSource(documentEntity.getSource());
|
||||
documentEntity.setSourceId(documentEntity.getSourceId());
|
||||
documentRepository.save(documentEntity);
|
||||
}
|
||||
return callDao.convertToDocumentResponseBean(documentEntity);
|
||||
|
||||
@@ -6,6 +6,7 @@ import net.gepafin.tendermanagement.entities.CallEntity;
|
||||
import net.gepafin.tendermanagement.entities.FaqEntity;
|
||||
import net.gepafin.tendermanagement.entities.LookUpDataEntity;
|
||||
import net.gepafin.tendermanagement.entities.UserEntity;
|
||||
import net.gepafin.tendermanagement.enums.RoleStatusEnum;
|
||||
import net.gepafin.tendermanagement.entities.LookUpDataEntity.LookUpDataTypeEnum;
|
||||
import net.gepafin.tendermanagement.model.request.FaqReq;
|
||||
import net.gepafin.tendermanagement.model.response.FaqResponseBean;
|
||||
@@ -81,7 +82,9 @@ public class FaqDao {
|
||||
.orElseThrow(() -> new ResourceNotFoundException(Status.NOT_FOUND,
|
||||
Translator.toLocale(GepafinConstant.FAQ_NOT_FOUND)));
|
||||
} else {
|
||||
if (Boolean.FALSE.equals(userEntity.getRoleEntity().getRoleType().equals(RoleStatusEnum.ROLE_BENEFICIARY.getValue()))) {
|
||||
lookUpDataService.getOrCreateLookUpDataEntity(faqReq, type);
|
||||
}
|
||||
faqEntity = new FaqEntity();
|
||||
faqEntity.setCall(callEntity);
|
||||
faqEntity.setUser(userEntity);
|
||||
|
||||
@@ -20,11 +20,13 @@ import net.gepafin.tendermanagement.repositories.FlowEdgesRepository;
|
||||
import net.gepafin.tendermanagement.repositories.FlowEdgesRepository;
|
||||
import net.gepafin.tendermanagement.service.CallService;
|
||||
import net.gepafin.tendermanagement.service.FormService;
|
||||
import net.gepafin.tendermanagement.util.DateTimeUtil;
|
||||
import net.gepafin.tendermanagement.web.rest.api.errors.CustomValidationException;
|
||||
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;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
@@ -47,10 +49,11 @@ public class FlowDao {
|
||||
@Autowired
|
||||
private FormService formService;
|
||||
|
||||
public FlowResponseBean createFlow(FlowRequestBean flowRequestBean, Long callId) {
|
||||
public FlowResponseBean createOrUpdateFlow(FlowRequestBean flowRequestBean, Long callId) {
|
||||
validateFlowRequestBean(flowRequestBean);
|
||||
CallEntity call = setInitialAndFinalFormInCall(flowRequestBean, callId);
|
||||
checkIfFlowExits(callId);
|
||||
CallEntity call = callService.validateCall(callId);
|
||||
checkIfFlowExits(call);
|
||||
call= setInitialAndFinalFormInCall(flowRequestBean, call);
|
||||
validateFlowRequest(flowRequestBean);
|
||||
List<FlowDataEntity> flowDataEntities = createFlowData(flowRequestBean,call);
|
||||
List<FlowEdgesEntity> flowEdgesEntities = createFlowEdges(flowRequestBean,call);
|
||||
@@ -59,24 +62,30 @@ public class FlowDao {
|
||||
}
|
||||
|
||||
public void validateFlowRequestBean(FlowRequestBean flowRequestBean){
|
||||
if(flowRequestBean.getFlowData()==null || flowRequestBean.getFlowEdges()==null){
|
||||
throw new CustomValidationException(Status.BAD_REQUEST,Translator.toLocale(GepafinConstant.FLOW_REQUEST_NOT_PROPER));
|
||||
if (flowRequestBean.getFlowEdges() == null || flowRequestBean.getFlowEdges().isEmpty()) {
|
||||
throw new CustomValidationException(Status.BAD_REQUEST, Translator.toLocale(GepafinConstant.FLOW_REQUEST_NOT_PROPER));
|
||||
}
|
||||
}
|
||||
|
||||
public void checkIfFlowExits(Long callId) {
|
||||
List<FlowDataEntity> flowDataEntities = flowDataRepository.findByCallId(callId);
|
||||
List<FlowEdgesEntity> flowEdgesEntities = flowEdgesRepository.findByCallId(callId);
|
||||
if (!flowDataEntities.isEmpty() || !flowEdgesEntities.isEmpty()) {
|
||||
throw new CustomValidationException(Status.BAD_REQUEST, Translator.toLocale(GepafinConstant.FLOW_ALREADY_EXISTS));
|
||||
public void checkIfFlowExits(CallEntity call) {
|
||||
List<FlowDataEntity> flowDataEntities = flowDataRepository.findByCallId(call.getId());
|
||||
List<FlowEdgesEntity> flowEdgesEntities = flowEdgesRepository.findByCallId(call.getId());
|
||||
if (Boolean.FALSE.equals(flowDataEntities.isEmpty()) || Boolean.FALSE.equals(flowEdgesEntities.isEmpty())) {
|
||||
call.setInitialForm(null);
|
||||
call.setFinalForm(null);
|
||||
call=callRepository.save(call);
|
||||
flowDataRepository.deleteAll(flowDataEntities);
|
||||
flowEdgesRepository.deleteAll(flowEdgesEntities);
|
||||
}
|
||||
}
|
||||
|
||||
public void validateFlowRequest(FlowRequestBean flowRequestBean) {
|
||||
formService.validateForm(flowRequestBean.getInitialForm());
|
||||
formService.validateForm(flowRequestBean.getFinalForm());
|
||||
if(flowRequestBean.getFlowData()!=null && !flowRequestBean.getFlowData().isEmpty()) {
|
||||
flowRequestBean.getFlowData().forEach(flowData -> formService.validateForm(flowData.getFormId()));
|
||||
}
|
||||
}
|
||||
|
||||
private List<FlowEdgesResponseBean> createFlowEdgesResponseBean(List<FlowEdgesEntity> flowEdgesEntities) {
|
||||
List<FlowEdgesResponseBean> flowEdgesResponseBeans = flowEdgesEntities.stream()
|
||||
@@ -96,20 +105,23 @@ public class FlowDao {
|
||||
return flowResponseBean;
|
||||
}
|
||||
|
||||
private CallEntity setInitialAndFinalFormInCall(FlowRequestBean flowRequestBean, Long callId) {
|
||||
CallEntity call = callService.validateCall(callId);
|
||||
private CallEntity setInitialAndFinalFormInCall(FlowRequestBean flowRequestBean, CallEntity call) {
|
||||
call.setInitialForm(flowRequestBean.getInitialForm());
|
||||
call.setFinalForm(flowRequestBean.getFinalForm());
|
||||
call.setUpdatedDate(DateTimeUtil.DateServerToUTC(LocalDateTime.now()));
|
||||
call = callRepository.save(call);
|
||||
return call;
|
||||
}
|
||||
|
||||
public List<FlowDataEntity> createFlowData(FlowRequestBean flowRequestBean, CallEntity call) {
|
||||
if (flowRequestBean.getFlowData() != null || !flowRequestBean.getFlowEdges().isEmpty()) {
|
||||
List<FlowDataEntity> flowDataEntities = flowRequestBean.getFlowData().stream()
|
||||
.map(flowDataRequestBean -> createFlowDataEntity(flowDataRequestBean, call))
|
||||
.collect(Collectors.toList());
|
||||
return flowDataRepository.saveAll(flowDataEntities);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public FlowDataEntity createFlowDataEntity(FlowDataRequestBean flowDataRequestBean,CallEntity call) {
|
||||
FlowDataEntity flowDataEntity = new FlowDataEntity();
|
||||
@@ -129,6 +141,7 @@ public class FlowDao {
|
||||
|
||||
public FlowEdgesEntity createFlowEdgesEntity(FlowEdgesRequestBean flowEdgesRequestBean,CallEntity call) {
|
||||
FlowEdgesEntity flowEdgesEntity = new FlowEdgesEntity();
|
||||
flowEdgesEntity.setTrackingId(flowEdgesRequestBean.getId());
|
||||
flowEdgesEntity.setSourceId(Long.valueOf(flowEdgesRequestBean.getSource()));
|
||||
flowEdgesEntity.setTargetId(Long.valueOf(flowEdgesRequestBean.getTarget()));
|
||||
flowEdgesEntity.setType(flowEdgesRequestBean.getType());
|
||||
@@ -147,7 +160,7 @@ public class FlowDao {
|
||||
|
||||
public FlowEdgesResponseBean convertFlowEdgesEntityToFlowEdgesResponseBean(FlowEdgesEntity flowEdgesEntity) {
|
||||
FlowEdgesResponseBean flowEdgesResponseBean = new FlowEdgesResponseBean();
|
||||
flowEdgesResponseBean.setId(flowEdgesEntity.getId());
|
||||
flowEdgesResponseBean.setId(flowEdgesEntity.getTrackingId());
|
||||
flowEdgesResponseBean.setType(flowEdgesEntity.getType());
|
||||
flowEdgesResponseBean.setSource(String.valueOf(flowEdgesEntity.getSourceId()));
|
||||
flowEdgesResponseBean.setTarget(String.valueOf(flowEdgesEntity.getTargetId()));
|
||||
@@ -163,7 +176,7 @@ public class FlowDao {
|
||||
List<FlowEdgesResponseBean> flowEdgesResponseBeans=createFlowEdgesResponseBean(flowEdgesEntities);
|
||||
flowResponseBean.setFlowData(flowDataResponseBeans);
|
||||
flowResponseBean.setFlowEdges(flowEdgesResponseBeans);
|
||||
if(flowResponseBean.getFlowData().isEmpty() || flowResponseBean.getFlowEdges().isEmpty()){
|
||||
if( flowResponseBean.getFlowEdges().isEmpty()){
|
||||
return null;
|
||||
}
|
||||
flowResponseBean.setCallId(call.getId());
|
||||
|
||||
@@ -30,6 +30,8 @@ public class FormFieldDao {
|
||||
FormFieldEntity formFieldEntity = new FormFieldEntity();
|
||||
formFieldEntity.setLabel(formFieldRequest.getLabel());
|
||||
formFieldEntity.setName(formFieldRequest.getName());
|
||||
formFieldEntity.setDescription(formFieldRequest.getDescription());
|
||||
formFieldEntity.setSortOrder(formFieldRequest.getSortOrder());
|
||||
formFieldEntity.setValidators(Utils.convertMapIntoJsonString(formFieldRequest.getValidators()));
|
||||
formFieldEntity.setSettings(setSettingRequestBean(formFieldRequest.getSettings()));
|
||||
formFieldEntity = saveFormFieldEntity(formFieldEntity);
|
||||
@@ -40,6 +42,8 @@ public class FormFieldDao {
|
||||
FormFieldResponseBean formFieldResponseBean = new FormFieldResponseBean();
|
||||
formFieldResponseBean.setId(formFieldEntity.getId());
|
||||
formFieldResponseBean.setName(formFieldEntity.getName());
|
||||
formFieldResponseBean.setDescription(formFieldEntity.getDescription());
|
||||
formFieldResponseBean.setSortOrder(formFieldEntity.getSortOrder());
|
||||
formFieldResponseBean
|
||||
.setSettings(Utils.convertJsonStringToList(formFieldEntity.getSettings(), SettingResponseBean.class));
|
||||
formFieldResponseBean.setLabel(formFieldEntity.getLabel());
|
||||
@@ -69,6 +73,8 @@ public class FormFieldDao {
|
||||
FormFieldEntity formFieldEntity = validateFormField(formFieldId);
|
||||
Utils.setIfUpdated(formFieldEntity::getName, formFieldEntity::setName, formFieldRequest.getName());
|
||||
Utils.setIfUpdated(formFieldEntity::getLabel, formFieldEntity::setLabel, formFieldRequest.getLabel());
|
||||
Utils.setIfUpdated(formFieldEntity::getDescription, formFieldEntity::setDescription, formFieldRequest.getDescription());
|
||||
Utils.setIfUpdated(formFieldEntity::getSortOrder, formFieldEntity::setSortOrder, formFieldRequest.getSortOrder());
|
||||
Utils.setIfUpdated(formFieldEntity::getSettings, formFieldEntity::setSettings,
|
||||
setSettingRequestBean(formFieldRequest.getSettings()));
|
||||
Utils.setIfUpdated(formFieldEntity::getValidators, formFieldEntity::setValidators,
|
||||
|
||||
@@ -20,12 +20,11 @@ public class DocumentEntity extends BaseEntity{
|
||||
@Column(name="TYPE")
|
||||
private String type;
|
||||
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "CALL_ID")
|
||||
private CallEntity call;
|
||||
@Column(name="SOURCE")
|
||||
private String source;
|
||||
|
||||
@Column(name = "DESCRIPTION", columnDefinition = "TEXT")
|
||||
private String description;
|
||||
@Column(name="SOURCE_ID")
|
||||
private Long sourceId;
|
||||
|
||||
@Column(name ="IS_DELETED", nullable = false)
|
||||
private Boolean isDeleted = false;
|
||||
|
||||
@@ -25,4 +25,7 @@ public class FlowEdgesEntity extends BaseEntity {
|
||||
@Column(name="CALL_ID")
|
||||
private Long callId;
|
||||
|
||||
@Column(name="TRACKING_ID")
|
||||
private String trackingId;
|
||||
|
||||
}
|
||||
|
||||
@@ -25,4 +25,10 @@ public class FormFieldEntity extends BaseEntity{
|
||||
|
||||
@Column(name = "VALIDATORS")
|
||||
private String validators;
|
||||
|
||||
@Column(name = "DESCRIPTION")
|
||||
private String description;
|
||||
|
||||
@Column(name = "SORT_ORDER")
|
||||
private Integer sortOrder;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,12 @@
|
||||
package net.gepafin.tendermanagement.enums;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||
import com.fasterxml.jackson.annotation.JsonValue;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public enum CallStatusEnum {
|
||||
|
||||
DRAFT("DRAFT"),
|
||||
@@ -19,4 +24,19 @@ public enum CallStatusEnum {
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
@JsonCreator
|
||||
public static CallStatusEnum fromValue(String value) {
|
||||
for (CallStatusEnum b : CallStatusEnum.values()) {
|
||||
if (b.value.equals(value)) {
|
||||
return b;
|
||||
}
|
||||
}
|
||||
throw new IllegalArgumentException("Unexpected value '" + value + "'");
|
||||
}
|
||||
public static List<String> getStatusValues() {
|
||||
return Arrays.stream(CallStatusEnum.values())
|
||||
.map(CallStatusEnum::getValue)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
package net.gepafin.tendermanagement.enums;
|
||||
|
||||
public enum DocumentSourceTypeEnum {
|
||||
CALL("CALL"),
|
||||
|
||||
APPLICATION("APPLICATION");
|
||||
|
||||
private String value;
|
||||
|
||||
DocumentSourceTypeEnum(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package net.gepafin.tendermanagement.enums;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonValue;
|
||||
|
||||
public enum RoleStatusEnum {
|
||||
|
||||
ROLE_BENEFICIARY("ROLE_BENEFICIARY"),
|
||||
ROLE_SUPER_ADMIN("ROLE_SUPER_ADMIN"),
|
||||
ROLE_PRE_INSTRUCTOR("ROLE_PRE_INSTRUCTOR"),
|
||||
ROLE_GEPAFIN_OPERATOR("ROLE_GEPAFIN_OPERATOR");
|
||||
|
||||
private String value;
|
||||
|
||||
RoleStatusEnum(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@JsonValue
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,8 @@ import lombok.Data;
|
||||
@Data
|
||||
public class FlowEdgesRequestBean {
|
||||
|
||||
private String id;
|
||||
|
||||
private String source;
|
||||
|
||||
private String target;
|
||||
|
||||
@@ -10,6 +10,10 @@ public class FormFieldRequest {
|
||||
|
||||
private String name;
|
||||
|
||||
private String description;
|
||||
|
||||
private Integer sortOrder;
|
||||
|
||||
private String label;
|
||||
|
||||
private List<SettingRequestBean> settings;
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
package net.gepafin.tendermanagement.model.response;
|
||||
|
||||
import lombok.Data;
|
||||
import net.gepafin.tendermanagement.enums.DocumentSourceTypeEnum;
|
||||
import net.gepafin.tendermanagement.enums.DocumentTypeEnum;
|
||||
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@@ -13,7 +16,11 @@ public class DocumentResponseBean {
|
||||
|
||||
private String filePath;
|
||||
|
||||
private String description;
|
||||
private DocumentTypeEnum type;
|
||||
|
||||
private DocumentSourceTypeEnum source;
|
||||
|
||||
private Long sourceId;
|
||||
|
||||
private LocalDateTime createdDate;
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ import org.springframework.security.core.parameters.P;
|
||||
|
||||
@Data
|
||||
public class FlowEdgesResponseBean {
|
||||
private Long id;
|
||||
private String id;
|
||||
|
||||
private String source;
|
||||
|
||||
|
||||
@@ -14,6 +14,11 @@ public class FormFieldResponseBean {
|
||||
|
||||
private String label;
|
||||
|
||||
private String description;
|
||||
|
||||
private Integer sortOrder;
|
||||
|
||||
|
||||
private List<SettingResponseBean> settings;
|
||||
|
||||
private Map<String,Object> validators;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package net.gepafin.tendermanagement.repositories;
|
||||
import net.gepafin.tendermanagement.entities.CallEntity;
|
||||
import net.gepafin.tendermanagement.enums.CallStatusEnum;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
@@ -9,5 +10,5 @@ import java.util.List;
|
||||
public interface CallRepository extends JpaRepository<CallEntity, Long> {
|
||||
|
||||
public CallEntity findByIdAndStatusNotIn(Long id, List<String> status);
|
||||
|
||||
List<CallEntity> findByStatusIn(List<String> callStatus);
|
||||
}
|
||||
|
||||
@@ -15,9 +15,9 @@ public interface DocumentRepository extends JpaRepository<DocumentEntity, Long>
|
||||
@Query("SELECT d FROM DocumentEntity d WHERE d.id = :id AND d.isDeleted = false")
|
||||
Optional<DocumentEntity> findById(@Param("id") Long id);
|
||||
|
||||
List<DocumentEntity> findByCallIdAndTypeAndIsDeletedFalse(Long callId, String type);
|
||||
List<DocumentEntity> findBySourceIdAndTypeAndIsDeletedFalse(Long sourceId, String type);
|
||||
|
||||
Optional<DocumentEntity> findByIdAndCallIdAndIsDeletedFalse(Long id, Long callId);
|
||||
Optional<DocumentEntity> findByIdAndSourceIdAndIsDeletedFalse(Long id, Long sourceId);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ public interface CallService {
|
||||
|
||||
CallResponse getCallById (Long callId);
|
||||
|
||||
List<CallDetailsResponseBean> getAllCalls();
|
||||
List<CallDetailsResponseBean> getAllCalls(HttpServletRequest request);
|
||||
|
||||
CallResponse validateCallData(Long callId);
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package net.gepafin.tendermanagement.service;
|
||||
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import net.gepafin.tendermanagement.enums.DocumentSourceTypeEnum;
|
||||
import net.gepafin.tendermanagement.enums.DocumentTypeEnum;
|
||||
import net.gepafin.tendermanagement.model.response.DocumentResponseBean;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
@@ -9,7 +10,7 @@ import java.util.List;
|
||||
|
||||
public interface DocumentService {
|
||||
|
||||
public List<DocumentResponseBean> uploadFile(List<MultipartFile> files,Long callId, DocumentTypeEnum fileType);
|
||||
public List<DocumentResponseBean> uploadFile(List<MultipartFile> files, Long sourceId, DocumentSourceTypeEnum sourceType, DocumentTypeEnum fileType);
|
||||
|
||||
public void deleteFile(Long documentId);
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ import net.gepafin.tendermanagement.model.response.FlowResponseBean;
|
||||
|
||||
public interface FlowService {
|
||||
|
||||
public FlowResponseBean createFlow(HttpServletRequest httpServletRequest, FlowRequestBean flowRequestBean, Long callId);
|
||||
public FlowResponseBean createOrUpdateFlow(HttpServletRequest httpServletRequest, FlowRequestBean flowRequestBean, Long callId);
|
||||
|
||||
public FlowResponseBean getFlowByCallId(HttpServletRequest request, Long callId);
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import jakarta.servlet.http.HttpServletRequest;
|
||||
import net.gepafin.tendermanagement.config.jwt.TokenProvider;
|
||||
import net.gepafin.tendermanagement.dao.CallDao;
|
||||
import net.gepafin.tendermanagement.entities.CallEntity;
|
||||
import net.gepafin.tendermanagement.entities.UserEntity;
|
||||
import net.gepafin.tendermanagement.enums.CallStatusEnum;
|
||||
import net.gepafin.tendermanagement.model.request.CreateCallRequestStep1;
|
||||
import net.gepafin.tendermanagement.model.request.CreateCallRequestStep2;
|
||||
@@ -57,8 +58,10 @@ public class CallServiceImpl implements CallService {
|
||||
|
||||
@Override
|
||||
@Transactional(readOnly = true)
|
||||
public List<CallDetailsResponseBean> getAllCalls() {
|
||||
return callDao.getAllCalls();
|
||||
public List<CallDetailsResponseBean> getAllCalls(HttpServletRequest request) {
|
||||
Map<String, Object> userInfo= tokenProvider.getUserInfoAndUserIdFromToken(request);
|
||||
UserEntity user=tokenProvider.validateUser(userInfo);
|
||||
return callDao.getAllCalls(user);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,18 +1,22 @@
|
||||
package net.gepafin.tendermanagement.service.impl;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
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.FlowResponseBean;
|
||||
import net.gepafin.tendermanagement.model.response.FormResponseBean;
|
||||
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 static void validateResponse(CallResponse response) {
|
||||
FieldValidator.create()
|
||||
public static void validateResponse(CallResponse response, FlowResponseBean flowResponse, List<FormResponseBean> formResponses) {
|
||||
// Validate CallResponse (existing logic)
|
||||
FieldValidator data = FieldValidator.create()
|
||||
.notNull(response.getId(), "id")
|
||||
.notNull(response.getName(), "name")
|
||||
.notNull(response.getDescriptionShort(), "descriptionShort")
|
||||
@@ -30,15 +34,22 @@ public class CallValidatorServiceImpl {
|
||||
.notEmpty(response.getDocs(), "docs")
|
||||
.notEmpty(response.getFaq(), "faq")
|
||||
.notEmpty(response.getImages(), "images")
|
||||
.notEmpty(response.getCheckList(), "checkList")
|
||||
.validate();
|
||||
.notEmpty(response.getCheckList(), "checkList");
|
||||
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
||||
if (response.getDates().get(0) == null || response.getDates().get(1) == null
|
||||
|| 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())) {
|
||||
data = data.addError(Translator.toLocale(GepafinConstant.INVALID_DATE_MSG));
|
||||
}
|
||||
if (flowResponse == null || ((flowResponse.getFlowData() == null || flowResponse.getFlowData().isEmpty())
|
||||
&& (flowResponse.getFlowEdges() == null || flowResponse.getFlowEdges().isEmpty()))) {
|
||||
data.addError(Translator.toLocale(GepafinConstant.FLOW_NOT_FOUND));
|
||||
}
|
||||
if (formResponses == null || formResponses.isEmpty()) {
|
||||
data.addError(Translator.toLocale(GepafinConstant.FORM_NOT_FOUND));
|
||||
}
|
||||
data.validate();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import java.util.List;
|
||||
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import net.gepafin.tendermanagement.dao.DocumentDao;
|
||||
import net.gepafin.tendermanagement.enums.DocumentSourceTypeEnum;
|
||||
import net.gepafin.tendermanagement.enums.DocumentTypeEnum;
|
||||
import net.gepafin.tendermanagement.model.response.DocumentResponseBean;
|
||||
import net.gepafin.tendermanagement.service.DocumentService;
|
||||
@@ -21,8 +22,8 @@ public class DocumentServiceImpl implements DocumentService {
|
||||
private DocumentDao documentDao;
|
||||
|
||||
@Override
|
||||
public List<DocumentResponseBean> uploadFile(List<MultipartFile> files,Long callId,DocumentTypeEnum fileType) {
|
||||
return documentDao.uploadFiles(files,callId,fileType);
|
||||
public List<DocumentResponseBean> uploadFile(List<MultipartFile> files, Long sourceId, DocumentSourceTypeEnum sourceType, DocumentTypeEnum fileType) {
|
||||
return documentDao.uploadFiles(files,sourceId,sourceType,fileType);
|
||||
}
|
||||
@Override
|
||||
public void deleteFile(Long documentId){
|
||||
|
||||
@@ -7,6 +7,7 @@ import net.gepafin.tendermanagement.model.response.FlowResponseBean;
|
||||
import net.gepafin.tendermanagement.service.FlowService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@Service
|
||||
public class FlowServiceImpl implements FlowService {
|
||||
@@ -15,11 +16,13 @@ public class FlowServiceImpl implements FlowService {
|
||||
private FlowDao flowDao;
|
||||
|
||||
@Override
|
||||
public FlowResponseBean createFlow(HttpServletRequest httpServletRequest, FlowRequestBean flowRequestBean, Long callId) {
|
||||
return flowDao.createFlow(flowRequestBean,callId);
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public FlowResponseBean createOrUpdateFlow(HttpServletRequest httpServletRequest, FlowRequestBean flowRequestBean, Long callId) {
|
||||
return flowDao.createOrUpdateFlow(flowRequestBean,callId);
|
||||
}
|
||||
|
||||
@Override
|
||||
@org.springframework.transaction.annotation.Transactional(readOnly = true)
|
||||
public FlowResponseBean getFlowByCallId(HttpServletRequest request, Long callId) {
|
||||
return flowDao.getFlowByCallId(callId);
|
||||
}
|
||||
|
||||
@@ -57,4 +57,9 @@ public class FieldValidator {
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public FieldValidator addError( String errorMessage) {
|
||||
errors.add(errorMessage);
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -100,7 +100,7 @@ public interface CallApi {
|
||||
@ExampleObject(value = ErrorConstants.BADREQUEST_ERROR_EXAMPLE) })) })
|
||||
@GetMapping(value = "",
|
||||
produces = { "application/json" })
|
||||
ResponseEntity<Response<List<CallDetailsResponseBean>>> getAllCalls();
|
||||
ResponseEntity<Response<List<CallDetailsResponseBean>>> getAllCalls(HttpServletRequest request);
|
||||
|
||||
|
||||
@Operation(summary = "Api to validate call",
|
||||
|
||||
@@ -6,6 +6,7 @@ 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 net.gepafin.tendermanagement.enums.DocumentSourceTypeEnum;
|
||||
import net.gepafin.tendermanagement.enums.DocumentTypeEnum;
|
||||
import net.gepafin.tendermanagement.model.response.DocumentResponseBean;
|
||||
import net.gepafin.tendermanagement.model.util.Response;
|
||||
@@ -29,8 +30,8 @@ public interface DocumentApi {
|
||||
@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/call/{callId}", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
|
||||
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) {
|
||||
@PostMapping(value = "/uploadFile/source/{sourceId}", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
|
||||
default ResponseEntity<Response<List<DocumentResponseBean>>> uploadFile(HttpServletRequest httpServletRequest, @Parameter(description = "Source Id", required = true) @PathVariable("sourceId") Long sourceId, @RequestParam DocumentSourceTypeEnum sourceType, @RequestParam("file") List<MultipartFile> files, @RequestParam("documentType") DocumentTypeEnum documentTypeEnum) {
|
||||
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
|
||||
}
|
||||
|
||||
|
||||
@@ -15,17 +15,14 @@ import net.gepafin.tendermanagement.web.rest.api.errors.ErrorConstants;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Validated
|
||||
public interface FlowApi {
|
||||
|
||||
@Operation(summary = "Api to create flow",
|
||||
@Operation(summary = "Api to create or update flow",
|
||||
responses = {
|
||||
@ApiResponse(responseCode = "200", description = "OK"),
|
||||
@ApiResponse(responseCode = "404", description = "Not Found", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||
@@ -34,9 +31,9 @@ public interface FlowApi {
|
||||
@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 = "/call/{callId}",
|
||||
@PutMapping(value = "/call/{callId}",
|
||||
produces = { "application/json" })
|
||||
ResponseEntity<Response<FlowResponseBean>> createFlow(HttpServletRequest request,
|
||||
ResponseEntity<Response<FlowResponseBean>> createOrUpdateFlow(HttpServletRequest request,
|
||||
@Parameter(description = " Flow request object", required = true) @Valid @RequestBody FlowRequestBean flowRequestBean,
|
||||
@Parameter(description = "The call ID", required = true) @PathVariable("callId") Long callId);
|
||||
|
||||
|
||||
@@ -65,8 +65,8 @@ public class CallApiController implements CallApi {
|
||||
|
||||
@Override
|
||||
@Transactional(readOnly = true)
|
||||
public ResponseEntity<Response<List<CallDetailsResponseBean>>> getAllCalls() {
|
||||
List<CallDetailsResponseBean> calls = callService.getAllCalls();
|
||||
public ResponseEntity<Response<List<CallDetailsResponseBean>>> getAllCalls(HttpServletRequest request) {
|
||||
List<CallDetailsResponseBean> calls = callService.getAllCalls(request);
|
||||
|
||||
return ResponseEntity.status(HttpStatus.OK)
|
||||
.body(new Response<>(calls, Status.SUCCESS, Translator.toLocale(GepafinConstant.CALL_FETCH_SUCCESS_MSG)));
|
||||
|
||||
@@ -3,6 +3,7 @@ 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.enums.DocumentSourceTypeEnum;
|
||||
import net.gepafin.tendermanagement.enums.DocumentTypeEnum;
|
||||
import net.gepafin.tendermanagement.model.response.DocumentResponseBean;
|
||||
import net.gepafin.tendermanagement.model.util.Response;
|
||||
@@ -27,10 +28,10 @@ DocumentApiController implements DocumentApi {
|
||||
private DocumentService documentService;
|
||||
|
||||
@Override
|
||||
public ResponseEntity<Response<List<DocumentResponseBean>>> uploadFile(HttpServletRequest httpServletRequest, Long callId,
|
||||
public ResponseEntity<Response<List<DocumentResponseBean>>> uploadFile(HttpServletRequest httpServletRequest, Long sourceId, DocumentSourceTypeEnum sourceType,
|
||||
List<MultipartFile> files, DocumentTypeEnum fileType) {
|
||||
try {
|
||||
List<DocumentResponseBean> responseBeans = documentService.uploadFile(files, callId, fileType);
|
||||
List<DocumentResponseBean> responseBeans = documentService.uploadFile(files, sourceId,sourceType, fileType);
|
||||
return ResponseEntity.status(HttpStatus.CREATED)
|
||||
.body(new Response<List<DocumentResponseBean>>(responseBeans, Status.SUCCESS, Translator.toLocale(GepafinConstant.FILES_UPLOADED_MSG)));
|
||||
} catch (CustomValidationException ex) {
|
||||
|
||||
@@ -26,15 +26,13 @@ public class FlowApiController implements FlowApi {
|
||||
private FlowService flowService;
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor=Exception.class)
|
||||
public ResponseEntity<Response<FlowResponseBean>> createFlow(HttpServletRequest httpServletRequest, FlowRequestBean flowRequestBean, Long callId) {
|
||||
FlowResponseBean flowResponseBean=flowService.createFlow(httpServletRequest,flowRequestBean,callId);
|
||||
public ResponseEntity<Response<FlowResponseBean>> createOrUpdateFlow(HttpServletRequest httpServletRequest, FlowRequestBean flowRequestBean, Long callId) {
|
||||
FlowResponseBean flowResponseBean=flowService.createOrUpdateFlow(httpServletRequest,flowRequestBean,callId);
|
||||
return ResponseEntity.status(HttpStatus.CREATED)
|
||||
.body(new Response<>(flowResponseBean, Status.SUCCESS, Translator.toLocale(GepafinConstant.FLOW_CREATED_SUCCESSFULLY)));
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor=Exception.class)
|
||||
public ResponseEntity<Response<FlowResponseBean>> getFlowByCallId(HttpServletRequest request, Long callId) {
|
||||
FlowResponseBean flowResponseBean=flowService.getFlowByCallId(request,callId);
|
||||
return ResponseEntity.status(HttpStatus.OK)
|
||||
|
||||
@@ -564,6 +564,15 @@
|
||||
<modifyDataType tableName="LOOKUP_DATA" columnName="title" newDataType="TEXT"/>
|
||||
</changeSet>
|
||||
|
||||
<changeSet id="09-09-2024_2" author="Harish Bagora">
|
||||
<renameColumn tableName="document" oldColumnName="call_id" newColumnName="source_id" columnDataType="BIGINT"/>
|
||||
<addColumn tableName="document">
|
||||
<column name="source" type="VARCHAR(255)"/>
|
||||
</addColumn>
|
||||
<dropColumn tableName="document" columnName="description"/>
|
||||
<dropForeignKeyConstraint baseTableName="document" constraintName="fk_call_document"/>
|
||||
</changeSet>
|
||||
|
||||
<changeSet id="09-09-2024_1" author="Rajesh Khore">
|
||||
<createTable tableName="application_form">
|
||||
<column name="id" type="INTEGER" autoIncrement="true">
|
||||
@@ -669,4 +678,28 @@
|
||||
</dropColumn>
|
||||
</changeSet>
|
||||
|
||||
<changeSet id="13-09-2024_1" author="Harish Bagora">
|
||||
<addColumn tableName="form_field">
|
||||
<column name="description" type="TEXT">
|
||||
<constraints nullable="true"/>
|
||||
</column>
|
||||
<column name="sort_order" type="INTEGER">
|
||||
<constraints nullable="true"/>
|
||||
</column>
|
||||
</addColumn>
|
||||
</changeSet>
|
||||
<changeSet id="13-09-2024_2" author="Harish Bagora">
|
||||
<sql>
|
||||
TRUNCATE TABLE FORM_FIELD RESTART IDENTITY;
|
||||
</sql>
|
||||
<sqlFile dbms="postgresql"
|
||||
path="classpath:db/dump/inserted_form_field_data_13_09_2024.sql" />
|
||||
</changeSet>
|
||||
|
||||
|
||||
<changeSet id="12-09-2024_1" author="Rajesh Khore">
|
||||
<addColumn tableName="flow_edges">
|
||||
<column name="tracking_id" type="VARCHAR(255)"></column>
|
||||
</addColumn>
|
||||
</changeSet>
|
||||
</databaseChangeLog>
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
INSERT INTO FORM_FIELD ( SORT_ORDER, NAME, LABEL, DESCRIPTION, SETTINGS, VALIDATORS, CREATED_DATE, UPDATED_DATE)
|
||||
VALUES
|
||||
( 1, 'textinput', 'Testo Breve', 'Per risposte concise (nomi, titoli, brevi descrizioni)',
|
||||
'{"label": "Testo Breve", "placeholder": ""}',
|
||||
'{"isRequired": false, "minLength": null, "maxLength": null, "pattern": null, "custom": null}',
|
||||
CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
|
||||
|
||||
( 2, 'textarea', 'Testo Lungo', 'Campo di testo esteso per paragrafi, descrizioni, proposte',
|
||||
'{"label": "Testo Lungo", "placeholder": ""}',
|
||||
'{"isRequired": false, "minLength": null, "maxLength": null, "pattern": null, "custom": null}',
|
||||
CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
|
||||
|
||||
( 3, 'wysiwyg', 'Campo di Testo Formattato', 'Editor avanzato per testo con formattazione',
|
||||
'{"label": "Testo Formattato", "placeholder": ""}',
|
||||
'{"isRequired": false, "minLength": null, "maxLength": null, "pattern": null, "custom": null}',
|
||||
CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
|
||||
|
||||
( 4, 'numberinput', 'Campo Numerico', 'Per l''inserimento di valori numerici (quantità, importi, percentuali)',
|
||||
'{"label": "Numero", "placeholder": "0", "step": "0"}',
|
||||
'{"isRequired": false, "min": null, "max": null, "pattern": null, "custom": null}',
|
||||
CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
|
||||
|
||||
(5, 'radio', 'Scelta Singola', 'Gruppo di opzioni per selezione singola',
|
||||
'{"label": "Scelta Singola", "options": []}',
|
||||
'{"isRequired": false, "custom": null}',
|
||||
CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
|
||||
|
||||
( 6, 'select', 'Menu a Tendina', 'Selezione da opzioni predefinite',
|
||||
'{"label": "Menu a Tendina", "options": []}',
|
||||
'{"isRequired": false, "custom": null}',
|
||||
CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
|
||||
|
||||
( 7, 'checkboxes', 'Scelta Multipla', 'Gruppo di opzioni per selezione singola o multipla',
|
||||
'{"label": "Scelta Multipla", "options": []}',
|
||||
'{"isRequired": false, "min": null, "max": null, "custom": null}',
|
||||
CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
|
||||
|
||||
( 8, 'switch', 'Casella di Spunta', 'Per selezioni binarie, accettazioni, conferme',
|
||||
'{"label": "Casella di Spunta"}',
|
||||
'{"isRequired": false}',
|
||||
CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
|
||||
|
||||
( 9, 'datepicker', 'Data', 'Selezione di data',
|
||||
'{"label": "Data"}',
|
||||
'{"isRequired": false, "custom": null}',
|
||||
CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
|
||||
|
||||
( 10, 'fileupload', 'Caricamento File', 'Per l''upload di documenti o immagini',
|
||||
'{"label": "Caricamento File", "mime": []}',
|
||||
'{"isRequired": false, "maxSize": 100000, "custom": null}',
|
||||
CURRENT_TIMESTAMP, CURRENT_TIMESTAMP);
|
||||
@@ -159,3 +159,4 @@ validation.field.not_null=Field {0} must not be null.
|
||||
validation.field.not_empty=Field {0} must not be empty.
|
||||
|
||||
current.form.incomplete=Current form is not filled.
|
||||
flow.not.found=Flow not found.
|
||||
|
||||
@@ -144,7 +144,7 @@ application.get.success=Dettagli dell'applicazione recuperati con successo.
|
||||
application.not.found=Applicazione non trovata con l'ID fornito.
|
||||
application.form.field.not.found=Campo del modulo di domanda non trovato.
|
||||
Form.not.matches.to.call.initial.form=L'ID del modulo non corrisponde all'ID del modulo iniziale della chiamata.
|
||||
application.already.exists=L'applicazione esiste già per questa chiamata.
|
||||
application.already.exists=L'applicazione esiste gi<EFBFBD> per questa chiamata.
|
||||
|
||||
#Validation related messages
|
||||
validation.field.required=Il campo {0} <20> obbligatorio.
|
||||
@@ -153,4 +153,5 @@ validation.field.max_length=Il campo {0} deve essere lungo al massimo {1} caratt
|
||||
validation.field.pattern=Il campo {0} non corrisponde al modello richiesto.
|
||||
validation.field.not_null=Il campo {0} non deve essere nullo.
|
||||
validation.field.not_empty=Il campo {0} non deve essere vuoto.
|
||||
current.form.incomplete=il modulo corrente non è compilato
|
||||
current.form.incomplete=il modulo corrente non <EFBFBD> compilato
|
||||
flow.not.found=Flow not found.
|
||||
|
||||
Reference in New Issue
Block a user