resolved conflicts
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user