resolved conflicts
This commit is contained in:
@@ -104,5 +104,9 @@ public class GepafinConstant {
|
||||
public static final String STATUS_CANNOT_BE_CHANGED = "status.cannot.be.changed";
|
||||
public static final String PUBLISHED_CALL_NOT_UPDATE = "published.call.not.update";
|
||||
public static final String INVALID_USER = "invalid_user";
|
||||
|
||||
public static final String FLOW_CREATED_SUCCESSFULLY="flow.created.successfully";
|
||||
public static final String FLOW_FETCHED_SUCCESSFULLY="flow.fetched.successfully";
|
||||
public static final String FLOW_ALREADY_EXISTS="flow.already.exists";
|
||||
public static final String FLOW_REQUEST_NOT_PROPER="flow.request.not.complete";
|
||||
public static final String FLOW_NOT_FOUND = "flow.not.found";
|
||||
}
|
||||
|
||||
@@ -3,14 +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;
|
||||
|
||||
@@ -40,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 {
|
||||
@@ -65,7 +72,7 @@ public class CallDao {
|
||||
|
||||
@Autowired
|
||||
private RegionRepository regionRepository;
|
||||
|
||||
|
||||
@Autowired
|
||||
private LookUpDataService lookUpDataService;
|
||||
|
||||
@@ -74,20 +81,24 @@ public class CallDao {
|
||||
|
||||
@Autowired
|
||||
private UserService userService;
|
||||
|
||||
|
||||
@Autowired
|
||||
private FaqService faqService;
|
||||
@Autowired
|
||||
private FlowDao flowDao;
|
||||
@Autowired
|
||||
private FormDao formDao;
|
||||
|
||||
public CallResponse createCallStep1(CreateCallRequestStep1 createCallRequest, Long userId) {
|
||||
UserEntity userEntity = userService.validateUser(userId);
|
||||
createCallRequest.setRegionId(userEntity.getRoleEntity().getRegion().getId());
|
||||
CallEntity callEntity = convertToCallEntity(createCallRequest);
|
||||
|
||||
|
||||
updateFaq(createCallRequest.getFaq(), callEntity, userEntity,LookUpDataTypeEnum.FAQ);
|
||||
|
||||
|
||||
convertLookUpDataEntities(createCallRequest.getAimedTo(), callEntity,
|
||||
LookUpDataTypeEnum.AIMED_TO);
|
||||
|
||||
|
||||
CallResponse createCallResponseBean = getCallResponseBean(callEntity);
|
||||
createCallResponseBean.setCurrentStep(GepafinConstant.STEP_1);
|
||||
return createCallResponseBean;
|
||||
@@ -394,12 +405,12 @@ public class CallDao {
|
||||
public void isValidDateRange(UpdateCallRequestStep1 updateCallRequest, CallEntity callEntity) {
|
||||
List<LocalDateTime> dates = updateCallRequest.getDates();
|
||||
|
||||
LocalDate startDate = (dates != null && dates.size() > 0 && dates.get(0) != null)
|
||||
? dates.get(0).toLocalDate()
|
||||
LocalDate startDate = (dates != null && dates.size() > 0 && dates.get(0) != null)
|
||||
? dates.get(0).toLocalDate()
|
||||
: null;
|
||||
|
||||
LocalDate endDate = (dates != null && dates.size() > 1 && dates.get(1) != null)
|
||||
? dates.get(1).toLocalDate()
|
||||
LocalDate endDate = (dates != null && dates.size() > 1 && dates.get(1) != null)
|
||||
? dates.get(1).toLocalDate()
|
||||
: null;
|
||||
|
||||
Boolean isValid = true;
|
||||
@@ -430,7 +441,7 @@ public class CallDao {
|
||||
setIfUpdated(callEntity::getDescriptionLong, callEntity::setDescriptionLong,
|
||||
updateCallRequest.getDescriptionLong());
|
||||
List<LocalDateTime> dates=updateCallRequest.getDates();
|
||||
|
||||
|
||||
if (dates != null && dates.size()>1) {
|
||||
if (dates.size() > 0) {
|
||||
setIfUpdated(callEntity::getStartDate, callEntity::setStartDate, dates.get(0));
|
||||
@@ -548,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());
|
||||
}
|
||||
@@ -558,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);
|
||||
|
||||
@@ -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 {
|
||||
lookUpDataService.getOrCreateLookUpDataEntity(faqReq, type);
|
||||
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);
|
||||
|
||||
188
src/main/java/net/gepafin/tendermanagement/dao/FlowDao.java
Normal file
188
src/main/java/net/gepafin/tendermanagement/dao/FlowDao.java
Normal file
@@ -0,0 +1,188 @@
|
||||
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.FlowDataEntity;
|
||||
import net.gepafin.tendermanagement.entities.FlowDataEntity;
|
||||
import net.gepafin.tendermanagement.entities.FlowEdgesEntity;
|
||||
import net.gepafin.tendermanagement.model.request.FlowDataRequestBean;
|
||||
import net.gepafin.tendermanagement.model.request.FlowEdgesRequestBean;
|
||||
import net.gepafin.tendermanagement.model.request.FlowRequestBean;
|
||||
import net.gepafin.tendermanagement.model.response.EvaluationCriteriaResponseBean;
|
||||
import net.gepafin.tendermanagement.model.response.FlowDataResponseBean;
|
||||
import net.gepafin.tendermanagement.model.response.FlowEdgesResponseBean;
|
||||
import net.gepafin.tendermanagement.model.response.FlowResponseBean;
|
||||
import net.gepafin.tendermanagement.repositories.CallRepository;
|
||||
import net.gepafin.tendermanagement.repositories.FlowDataRepository;
|
||||
import net.gepafin.tendermanagement.repositories.FlowDataRepository;
|
||||
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;
|
||||
|
||||
@Component
|
||||
public class FlowDao {
|
||||
|
||||
@Autowired
|
||||
private FlowDataRepository flowDataRepository;
|
||||
|
||||
@Autowired
|
||||
private FlowEdgesRepository flowEdgesRepository;
|
||||
|
||||
@Autowired
|
||||
private CallRepository callRepository;
|
||||
|
||||
@Autowired
|
||||
private CallService callService;
|
||||
|
||||
@Autowired
|
||||
private FormService formService;
|
||||
|
||||
public FlowResponseBean createOrUpdateFlow(FlowRequestBean flowRequestBean, Long callId) {
|
||||
validateFlowRequestBean(flowRequestBean);
|
||||
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);
|
||||
FlowResponseBean flowResponseBean = getFlowByCallId(call.getId());
|
||||
return flowResponseBean;
|
||||
}
|
||||
|
||||
public void validateFlowRequestBean(FlowRequestBean flowRequestBean){
|
||||
if (flowRequestBean.getFlowEdges() == null || flowRequestBean.getFlowEdges().isEmpty()) {
|
||||
throw new CustomValidationException(Status.BAD_REQUEST, Translator.toLocale(GepafinConstant.FLOW_REQUEST_NOT_PROPER));
|
||||
}
|
||||
}
|
||||
|
||||
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()
|
||||
.map(this::convertFlowEdgesEntityToFlowEdgesResponseBean).collect(Collectors.toList());
|
||||
return flowEdgesResponseBeans;
|
||||
}
|
||||
|
||||
private List<FlowDataResponseBean> createFlowDataResponseBean(List<FlowDataEntity> flowDataEntities) {
|
||||
List<FlowDataResponseBean> flowDataResponseBeans = flowDataEntities.stream()
|
||||
.map(this::convertFlowDataEntityToFlowDataResponseBean).collect(Collectors.toList());
|
||||
return flowDataResponseBeans;
|
||||
}
|
||||
|
||||
public FlowResponseBean setInitialAndFinalFormInFlowResponseBean(FlowResponseBean flowResponseBean, CallEntity call) {
|
||||
flowResponseBean.setInitialForm(call.getInitialForm());
|
||||
flowResponseBean.setFinalForm(call.getFinalForm());
|
||||
return flowResponseBean;
|
||||
}
|
||||
|
||||
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();
|
||||
flowDataEntity.setFormId(flowDataRequestBean.getFormId());
|
||||
flowDataEntity.setChoosenField(flowDataRequestBean.getChosenField());
|
||||
flowDataEntity.setChoosenValue(flowDataRequestBean.getChosenValue());
|
||||
flowDataEntity.setCallId(call.getId());
|
||||
return flowDataEntity;
|
||||
}
|
||||
|
||||
public List<FlowEdgesEntity> createFlowEdges(FlowRequestBean flowRequestBean, CallEntity call) {
|
||||
List<FlowEdgesEntity> flowEdgesEntities = flowRequestBean.getFlowEdges().stream()
|
||||
.map(flowEdgesRequestBean -> createFlowEdgesEntity(flowEdgesRequestBean, call))
|
||||
.collect(Collectors.toList());
|
||||
return flowEdgesRepository.saveAll(flowEdgesEntities);
|
||||
}
|
||||
|
||||
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());
|
||||
flowEdgesEntity.setCallId(call.getId());
|
||||
return flowEdgesEntity;
|
||||
}
|
||||
|
||||
public FlowDataResponseBean convertFlowDataEntityToFlowDataResponseBean(FlowDataEntity flowDataEntity) {
|
||||
FlowDataResponseBean flowDataResponseBean = new FlowDataResponseBean();
|
||||
flowDataResponseBean.setId(flowDataEntity.getId());
|
||||
flowDataResponseBean.setFormId(flowDataEntity.getFormId());
|
||||
flowDataResponseBean.setChosenField(flowDataEntity.getChoosenField());
|
||||
flowDataResponseBean.setChosenValue(flowDataEntity.getChoosenValue());
|
||||
return flowDataResponseBean;
|
||||
}
|
||||
|
||||
public FlowEdgesResponseBean convertFlowEdgesEntityToFlowEdgesResponseBean(FlowEdgesEntity flowEdgesEntity) {
|
||||
FlowEdgesResponseBean flowEdgesResponseBean = new FlowEdgesResponseBean();
|
||||
flowEdgesResponseBean.setId(flowEdgesEntity.getTrackingId());
|
||||
flowEdgesResponseBean.setType(flowEdgesEntity.getType());
|
||||
flowEdgesResponseBean.setSource(String.valueOf(flowEdgesEntity.getSourceId()));
|
||||
flowEdgesResponseBean.setTarget(String.valueOf(flowEdgesEntity.getTargetId()));
|
||||
return flowEdgesResponseBean;
|
||||
}
|
||||
|
||||
public FlowResponseBean getFlowByCallId(Long callId){
|
||||
CallEntity call= callService.validateCall(callId);
|
||||
FlowResponseBean flowResponseBean=new FlowResponseBean();
|
||||
List<FlowDataEntity> flowDataEntities=flowDataRepository.findByCallId(call.getId());
|
||||
List<FlowEdgesEntity> flowEdgesEntities=flowEdgesRepository.findByCallId(call.getId());
|
||||
List<FlowDataResponseBean> flowDataResponseBeans=createFlowDataResponseBean(flowDataEntities);
|
||||
List<FlowEdgesResponseBean> flowEdgesResponseBeans=createFlowEdgesResponseBean(flowEdgesEntities);
|
||||
flowResponseBean.setFlowData(flowDataResponseBeans);
|
||||
flowResponseBean.setFlowEdges(flowEdgesResponseBeans);
|
||||
if( flowResponseBean.getFlowEdges().isEmpty()){
|
||||
return null;
|
||||
}
|
||||
flowResponseBean.setCallId(call.getId());
|
||||
flowResponseBean.setInitialForm(call.getInitialForm());
|
||||
flowResponseBean.setFinalForm(call.getFinalForm());
|
||||
return flowResponseBean;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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,
|
||||
|
||||
@@ -62,5 +62,11 @@ public class CallEntity extends BaseEntity {
|
||||
|
||||
@Column(name = "CONFIDI")
|
||||
private Boolean confidi;
|
||||
|
||||
@Column(name="INITIAL_FORM")
|
||||
private Long initialForm;
|
||||
|
||||
@Column(name="FINAL_FORM")
|
||||
private Long finalForm;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
package net.gepafin.tendermanagement.entities;
|
||||
import jakarta.persistence.*;
|
||||
import lombok.*;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Entity
|
||||
@Table(name = "FLOW_DATA")
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
public class FlowDataEntity extends BaseEntity{
|
||||
|
||||
@Column(name = "FORM_ID")
|
||||
private Long formId;
|
||||
|
||||
@Column(name = "CHOOSEN_FIELD")
|
||||
private String choosenField;
|
||||
|
||||
@Column(name = "CHOOSEN_VALUE")
|
||||
private String choosenValue;
|
||||
|
||||
@Column(name="CALL_ID")
|
||||
private Long callId;
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package net.gepafin.tendermanagement.entities;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
import lombok.*;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Entity
|
||||
@Table(name = "FLOW_EDGES")
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
public class FlowEdgesEntity extends BaseEntity {
|
||||
|
||||
@Column(name = "SOURCE_ID")
|
||||
private Long sourceId;
|
||||
|
||||
@Column(name = "TARGET_ID")
|
||||
private Long targetId;
|
||||
|
||||
@Column(name = "TYPE", length = 255)
|
||||
private String type;
|
||||
|
||||
@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,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;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package net.gepafin.tendermanagement.model.request;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class FlowDataRequestBean {
|
||||
|
||||
private Long formId;
|
||||
|
||||
private String chosenField;
|
||||
|
||||
private String chosenValue;
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package net.gepafin.tendermanagement.model.request;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class FlowEdgesRequestBean {
|
||||
|
||||
private String id;
|
||||
|
||||
private String source;
|
||||
|
||||
private String target;
|
||||
|
||||
private String type;
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package net.gepafin.tendermanagement.model.request;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class FlowRequestBean {
|
||||
|
||||
private Long initialForm;
|
||||
|
||||
private Long finalForm;
|
||||
|
||||
private List<FlowDataRequestBean> flowData;
|
||||
|
||||
private List<FlowEdgesRequestBean> flowEdges;
|
||||
}
|
||||
@@ -10,6 +10,10 @@ public class FormFieldRequest {
|
||||
|
||||
private String name;
|
||||
|
||||
private String description;
|
||||
|
||||
private Integer sortOrder;
|
||||
|
||||
private String label;
|
||||
|
||||
private List<SettingRequestBean> settings;
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
package net.gepafin.tendermanagement.model.response;
|
||||
|
||||
import lombok.Data;
|
||||
import net.gepafin.tendermanagement.model.BaseBean;
|
||||
|
||||
@Data
|
||||
public class FlowDataResponseBean {
|
||||
|
||||
private Long id;
|
||||
|
||||
private Long formId;
|
||||
|
||||
private String chosenField;
|
||||
|
||||
private String chosenValue;
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package net.gepafin.tendermanagement.model.response;
|
||||
|
||||
import lombok.Data;
|
||||
import net.gepafin.tendermanagement.model.BaseBean;
|
||||
import org.springframework.security.core.parameters.P;
|
||||
|
||||
@Data
|
||||
public class FlowEdgesResponseBean {
|
||||
private String id;
|
||||
|
||||
private String source;
|
||||
|
||||
private String target;
|
||||
|
||||
private String type;
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package net.gepafin.tendermanagement.model.response;
|
||||
|
||||
import lombok.Data;
|
||||
import net.gepafin.tendermanagement.model.request.FlowDataRequestBean;
|
||||
import net.gepafin.tendermanagement.model.request.FlowEdgesRequestBean;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class FlowResponseBean {
|
||||
|
||||
private Long callId;
|
||||
|
||||
private Long initialForm;
|
||||
|
||||
private Long finalForm;
|
||||
|
||||
private List<FlowDataResponseBean> flowData;
|
||||
|
||||
private List<FlowEdgesResponseBean> flowEdges;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
package net.gepafin.tendermanagement.repositories;
|
||||
|
||||
import net.gepafin.tendermanagement.entities.FlowDataEntity;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Repository
|
||||
public interface FlowDataRepository extends JpaRepository<FlowDataEntity,Long> {
|
||||
|
||||
public List<FlowDataEntity> findByCallId(Long callId);
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package net.gepafin.tendermanagement.repositories;
|
||||
|
||||
import net.gepafin.tendermanagement.entities.FlowEdgesEntity;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Repository
|
||||
public interface FlowEdgesRepository extends JpaRepository<net.gepafin.tendermanagement.entities.FlowEdgesEntity,Long> {
|
||||
|
||||
public List<FlowEdgesEntity> findByCallId(Long callId);
|
||||
}
|
||||
@@ -21,7 +21,7 @@ public interface CallService {
|
||||
|
||||
CallResponse getCallById (Long callId);
|
||||
|
||||
List<CallDetailsResponseBean> getAllCalls();
|
||||
List<CallDetailsResponseBean> getAllCalls(HttpServletRequest request);
|
||||
|
||||
CallResponse validateCallData(Long callId);
|
||||
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
package net.gepafin.tendermanagement.service;
|
||||
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import net.gepafin.tendermanagement.model.request.FlowRequestBean;
|
||||
import net.gepafin.tendermanagement.model.response.FlowResponseBean;
|
||||
|
||||
public interface FlowService {
|
||||
|
||||
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,44 +1,55 @@
|
||||
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()
|
||||
.notNull(response.getId(), "id")
|
||||
.notNull(response.getName(), "name")
|
||||
.notNull(response.getDescriptionShort(), "descriptionShort")
|
||||
.notNull(response.getDescriptionLong(), "descriptionLong")
|
||||
.notNull(response.getDates().get(0), "startDate")
|
||||
.notNull(response.getDates().get(1), "endDate")
|
||||
.notNull(response.getStatus(), "status")
|
||||
.notNull(response.getRegionId(), "regionId")
|
||||
.notNull(response.getAmount(), "amount")
|
||||
.notNull(response.getAmountMax(), "amountMax")
|
||||
.notNull(response.getThreshold(), "threshold")
|
||||
.notNull(response.getDocumentationRequested(), "documentationRequested")
|
||||
.notEmpty(response.getAimedTo(), "aimedTo")
|
||||
.notEmpty(response.getCriteria(), "criteria")
|
||||
.notEmpty(response.getDocs(), "docs")
|
||||
.notEmpty(response.getFaq(), "faq")
|
||||
.notEmpty(response.getImages(), "images")
|
||||
.notEmpty(response.getCheckList(), "checkList")
|
||||
.validate();
|
||||
|
||||
if (response.getDates().get(0).toLocalDate().isBefore(LocalDate.now())
|
||||
|| response.getDates().get(1).toLocalDate().isBefore(LocalDate.now()) ||
|
||||
response.getDates().get(0).toLocalDate().isAfter(response.getDates().get(1).toLocalDate())) {
|
||||
throw new CustomValidationException(Status.VALIDATION_ERROR,
|
||||
Translator.toLocale(GepafinConstant.INVALID_DATE_MSG));
|
||||
}
|
||||
}
|
||||
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")
|
||||
.notNull(response.getDescriptionLong(), "descriptionLong")
|
||||
.notNull(response.getDates().get(0), "startDate")
|
||||
.notNull(response.getDates().get(1), "endDate")
|
||||
.notNull(response.getStatus(), "status")
|
||||
.notNull(response.getRegionId(), "regionId")
|
||||
.notNull(response.getAmount(), "amount")
|
||||
.notNull(response.getAmountMax(), "amountMax")
|
||||
.notNull(response.getThreshold(), "threshold")
|
||||
.notNull(response.getDocumentationRequested(), "documentationRequested")
|
||||
.notEmpty(response.getAimedTo(), "aimedTo")
|
||||
.notEmpty(response.getCriteria(), "criteria")
|
||||
.notEmpty(response.getDocs(), "docs")
|
||||
.notEmpty(response.getFaq(), "faq")
|
||||
.notEmpty(response.getImages(), "images")
|
||||
.notEmpty(response.getCheckList(), "checkList");
|
||||
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
package net.gepafin.tendermanagement.service.impl;
|
||||
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import net.gepafin.tendermanagement.dao.FlowDao;
|
||||
import net.gepafin.tendermanagement.model.request.FlowRequestBean;
|
||||
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 {
|
||||
|
||||
@Autowired
|
||||
private FlowDao flowDao;
|
||||
|
||||
@Override
|
||||
@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);
|
||||
}
|
||||
}
|
||||
@@ -37,4 +37,9 @@ public class FieldValidator {
|
||||
throw new ValidationException(Status.VALIDATION_ERROR, errors);
|
||||
}
|
||||
}
|
||||
|
||||
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",
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
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.FlowRequestBean;
|
||||
import net.gepafin.tendermanagement.model.response.FlowResponseBean;
|
||||
import net.gepafin.tendermanagement.model.response.FormResponseBean;
|
||||
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.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Validated
|
||||
public interface FlowApi {
|
||||
|
||||
@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 = {
|
||||
@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 = "/call/{callId}",
|
||||
produces = { "application/json" })
|
||||
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);
|
||||
|
||||
@Operation(summary = "Api to get flow by callId",
|
||||
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) })) })
|
||||
@GetMapping(value = "/call/{callId}",
|
||||
produces = { "application/json" })
|
||||
ResponseEntity<Response<FlowResponseBean>> getFlowByCallId(HttpServletRequest request,
|
||||
@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)));
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
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.FlowRequestBean;
|
||||
import net.gepafin.tendermanagement.model.response.FlowResponseBean;
|
||||
import net.gepafin.tendermanagement.model.util.Response;
|
||||
import net.gepafin.tendermanagement.service.FlowService;
|
||||
import net.gepafin.tendermanagement.web.rest.api.FlowApi;
|
||||
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.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("${openapi.gepafin.base-path:/v1/flow}")
|
||||
public class FlowApiController implements FlowApi {
|
||||
|
||||
@Autowired
|
||||
private FlowService flowService;
|
||||
|
||||
@Override
|
||||
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
|
||||
public ResponseEntity<Response<FlowResponseBean>> getFlowByCallId(HttpServletRequest request, Long callId) {
|
||||
FlowResponseBean flowResponseBean=flowService.getFlowByCallId(request,callId);
|
||||
return ResponseEntity.status(HttpStatus.OK)
|
||||
.body(new Response<>(flowResponseBean, Status.SUCCESS, Translator.toLocale(GepafinConstant.FLOW_FETCHED_SUCCESSFULLY)));
|
||||
}
|
||||
}
|
||||
@@ -564,7 +564,7 @@
|
||||
<modifyDataType tableName="LOOKUP_DATA" columnName="title" newDataType="TEXT"/>
|
||||
</changeSet>
|
||||
|
||||
<changeSet id="09-09-2024_1" author="Harish Bagora">
|
||||
<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)"/>
|
||||
@@ -573,4 +573,97 @@
|
||||
<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">
|
||||
<constraints nullable="false" primaryKey="true" primaryKeyName="application_form_pkey"/>
|
||||
</column>
|
||||
<column name="form_id" type="INTEGER">
|
||||
<constraints nullable="false" foreignKeyName="fk_form_application_form" references="form(id)"/>
|
||||
</column>
|
||||
<column name="order_no" type="VARCHAR(255)"></column>
|
||||
<column name="created_date" type="TIMESTAMP WITHOUT TIME ZONE">
|
||||
<constraints nullable="false"/>
|
||||
</column>
|
||||
<column name="updated_date" type="TIMESTAMP WITHOUT TIME ZONE">
|
||||
<constraints nullable="true"/></column>
|
||||
</createTable>
|
||||
|
||||
<createTable tableName="application_form_field">
|
||||
<column name="id" type="INTEGER" autoIncrement="true">
|
||||
<constraints nullable="false" primaryKey="true" primaryKeyName="application_form_field_pkey"/>
|
||||
</column>
|
||||
<column name="application_form_id" type="INTEGER">
|
||||
<constraints nullable="false" foreignKeyName="fk_application_form_application_form_field" references="application_form(id)"/>
|
||||
</column>
|
||||
<column name="field_id" type="VARCHAR(255)" ></column>
|
||||
<column name="field_value" type="VARCHAR(255)"></column>
|
||||
<column name="created_date" type="TIMESTAMP WITHOUT TIME ZONE">
|
||||
<constraints nullable="false"/>
|
||||
</column>
|
||||
<column name="updated_date" type="TIMESTAMP WITHOUT TIME ZONE">
|
||||
<constraints nullable="true"/></column>
|
||||
</createTable>
|
||||
|
||||
<createTable tableName="flow_edges">
|
||||
<column name="id" type="INTEGER" autoIncrement="true">
|
||||
<constraints nullable="false" primaryKey="true" primaryKeyName="flow_edges_pkey"/>
|
||||
</column>
|
||||
<column name="call_id" type="INTEGER">
|
||||
</column>
|
||||
<column name="source_id" type="INTEGER"></column>
|
||||
<column name="target_id" type="INTEGER"></column>
|
||||
<column name="type" type="VARCHAR(255)"></column>
|
||||
<column name="created_date" type="TIMESTAMP WITHOUT TIME ZONE">
|
||||
<constraints nullable="false"/>
|
||||
</column>
|
||||
<column name="updated_date" type="TIMESTAMP WITHOUT TIME ZONE">
|
||||
<constraints nullable="true"/></column>
|
||||
</createTable>
|
||||
|
||||
<createTable tableName="flow_data">
|
||||
<column name="id" type="INTEGER" autoIncrement="true">
|
||||
<constraints nullable="false" primaryKey="true" primaryKeyName="flow_data_pkey"/>
|
||||
</column>
|
||||
<column name="call_id" type="INTEGER">
|
||||
</column>
|
||||
<column name="form_id" type="INTEGER"></column>
|
||||
<column name="choosen_field" type="VARCHAR(255)"></column>
|
||||
<column name="choosen_value" type="VARCHAR(255)"></column>
|
||||
<column name="created_date" type="TIMESTAMP WITHOUT TIME ZONE">
|
||||
<constraints nullable="false"/>
|
||||
</column>
|
||||
<column name="updated_date" type="TIMESTAMP WITHOUT TIME ZONE">
|
||||
<constraints nullable="true"/></column>
|
||||
</createTable>
|
||||
|
||||
<addColumn tableName="call">
|
||||
<column name="initial_form" type="INTEGER"></column>
|
||||
<column name="final_form" type="INTEGER"></column>
|
||||
</addColumn>
|
||||
</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);
|
||||
@@ -133,3 +133,10 @@ lookupdata.value.cannot.be.empty=Value field cannot be empty
|
||||
#Document-related message
|
||||
document.updated.successfully=Document updated successfully.
|
||||
document.fetched.successfully=Document fetched successfully.
|
||||
|
||||
#Flow-related message
|
||||
flow.created.successfully=Flow created successfully.
|
||||
flow.fetched.successfully=Flow fetched successfully.
|
||||
flow.already.exists= Flow already exist for this call.
|
||||
flow.request.not.complete=Flow request is not complete.
|
||||
flow.not.found=Flow not found.
|
||||
|
||||
@@ -56,7 +56,7 @@ status.same.error=Lo stato <20> gi<67> impostato.
|
||||
invalid.status.change.from.draft=Lo stato non pu<70> essere cambiato in READY_TO_PUBLISH o PUBLISH da DRAFT.
|
||||
status.cannot.be.changed=Lo stato non pu<70> essere cambiato.
|
||||
published.call.not.update=Il bando pubblicato non pu<70> essere aggiornato.
|
||||
invalid.status.change.from.publish=Lo stato non può essere modificato in READY_TO_PUBLISH o DRAFT da PUBLISH.
|
||||
invalid.status.change.from.publish=Lo stato non pu<EFBFBD> essere modificato in READY_TO_PUBLISH o DRAFT da PUBLISH.
|
||||
|
||||
|
||||
# Login-related messages
|
||||
@@ -115,7 +115,7 @@ lookupdata.created.successfully=LookUpData creato correttamente.
|
||||
lookupdata.fetched.successfully=LookUpData recuperato correttamente.
|
||||
lookupdata.updated.successfully=LookUpData aggiornato correttamente.
|
||||
lookupdata.deleted.successfully=LookUpData eliminato correttamente.
|
||||
lookupdata.value.cannot.be.empty=Il campo valore non può essere vuoto
|
||||
lookupdata.value.cannot.be.empty=Il campo valore non pu<EFBFBD> essere vuoto
|
||||
|
||||
#Document-related message
|
||||
document.updated.successfully=Documento aggiornato con successo.
|
||||
@@ -130,3 +130,9 @@ logout.successful.msg=Logout riuscito. Sei stato disconnesso con successo.
|
||||
|
||||
update.user.status.success=Lo stato dell'utente <20> stato aggiornato con successo.
|
||||
|
||||
#Flow-related message
|
||||
flow.created.successfully=Flusso creato con successo.
|
||||
flow.fetched.successfully=Flusso recuperato con successo.
|
||||
flow.already.exists= Il flusso esiste gi<67> per questa chiamata.
|
||||
flow.request.not.complete=La richiesta di flusso non <20> completa.
|
||||
flow.not.found=Flow not found.
|
||||
Reference in New Issue
Block a user