| Line 26... |
Line 26... |
| 26 |
import org.springframework.http.MediaType;
|
26 |
import org.springframework.http.MediaType;
|
| 27 |
import org.springframework.http.ResponseEntity;
|
27 |
import org.springframework.http.ResponseEntity;
|
| 28 |
import org.springframework.stereotype.Controller;
|
28 |
import org.springframework.stereotype.Controller;
|
| 29 |
import org.springframework.transaction.annotation.Transactional;
|
29 |
import org.springframework.transaction.annotation.Transactional;
|
| 30 |
import org.springframework.ui.Model;
|
30 |
import org.springframework.ui.Model;
|
| - |
|
31 |
import org.springframework.web.bind.annotation.GetMapping;
|
| 31 |
import org.springframework.web.bind.annotation.PathVariable;
|
32 |
import org.springframework.web.bind.annotation.PathVariable;
|
| 32 |
import org.springframework.web.bind.annotation.PutMapping;
|
33 |
import org.springframework.web.bind.annotation.PutMapping;
|
| 33 |
import org.springframework.web.bind.annotation.RequestBody;
|
34 |
import org.springframework.web.bind.annotation.RequestBody;
|
| 34 |
import org.springframework.web.bind.annotation.RequestMapping;
|
35 |
import org.springframework.web.bind.annotation.RequestMapping;
|
| 35 |
import org.springframework.web.bind.annotation.RequestMethod;
|
36 |
import org.springframework.web.bind.annotation.RequestMethod;
|
| Line 681... |
Line 682... |
| 681 |
&& Float.parseFloat(x.getMinPrice()) <= sellingPrice;
|
682 |
&& Float.parseFloat(x.getMinPrice()) <= sellingPrice;
|
| 682 |
}).collect(Collectors.toList()));
|
683 |
}).collect(Collectors.toList()));
|
| 683 |
});
|
684 |
});
|
| 684 |
return returnPlans;
|
685 |
return returnPlans;
|
| 685 |
}
|
686 |
}
|
| - |
|
687 |
|
| - |
|
688 |
@GetMapping("/insuranceDetails")
|
| - |
|
689 |
public String getInsuranceDetails(HttpServletRequest request,
|
| - |
|
690 |
@RequestParam(name = "offset", defaultValue = "0") int offset,
|
| - |
|
691 |
@RequestParam(name = "limit", defaultValue = "10") int limit, Model model)
|
| - |
|
692 |
throws ProfitMandiBusinessException {
|
| - |
|
693 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| - |
|
694 |
long size = 0;
|
| - |
|
695 |
List<InsurancePolicy> insurancePolicies = insurancePolicyRepository.selectByRetailerId(loginDetails.getFofoId(),
|
| - |
|
696 |
offset, limit);
|
| - |
|
697 |
size = insurancePolicyRepository.selectCountByRetailerId(loginDetails.getFofoId());
|
| - |
|
698 |
Map<Integer, String> providerPolicyNameAndIdMap = insuranceProviderRepository
|
| - |
|
699 |
.selectByIds(insurancePolicies.stream().map(x -> x.getProviderId()).collect(Collectors.toSet()))
|
| - |
|
700 |
.stream().collect(Collectors.toMap(InsuranceProvider::getId, InsuranceProvider::getName));
|
| - |
|
701 |
if (size < limit) {
|
| - |
|
702 |
model.addAttribute("end", offset + size);
|
| - |
|
703 |
} else {
|
| - |
|
704 |
model.addAttribute("end", offset + limit);
|
| - |
|
705 |
}
|
| - |
|
706 |
model.addAttribute("start", offset + 1);
|
| - |
|
707 |
model.addAttribute("size", size);
|
| - |
|
708 |
model.addAttribute("insurancePolicies", insurancePolicies);
|
| - |
|
709 |
model.addAttribute("providerPolicyNameAndIdMap", providerPolicyNameAndIdMap);
|
| - |
|
710 |
return "insurance-details";
|
| - |
|
711 |
}
|
| - |
|
712 |
|
| - |
|
713 |
@GetMapping("/insuranceDetailsPaginated")
|
| - |
|
714 |
public String getInsuranceDetailsPaginated(HttpServletRequest request,
|
| - |
|
715 |
@RequestParam(name = "offset", defaultValue = "0") int offset,
|
| - |
|
716 |
@RequestParam(name = "limit", defaultValue = "10") int limit, Model model)
|
| - |
|
717 |
throws ProfitMandiBusinessException {
|
| - |
|
718 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| - |
|
719 |
List<InsurancePolicy> insurancePolicies = insurancePolicyRepository.selectByRetailerId(loginDetails.getFofoId(),
|
| - |
|
720 |
offset, limit);
|
| - |
|
721 |
Map<Integer, String> providerPolicyNameAndIdMap = insuranceProviderRepository
|
| - |
|
722 |
.selectByIds(insurancePolicies.stream().map(x -> x.getProviderId()).collect(Collectors.toSet()))
|
| - |
|
723 |
.stream().collect(Collectors.toMap(InsuranceProvider::getId, InsuranceProvider::getName));
|
| - |
|
724 |
model.addAttribute("insurancePolicies", insurancePolicies);
|
| - |
|
725 |
model.addAttribute("providerPolicyNameAndIdMap", providerPolicyNameAndIdMap);
|
| - |
|
726 |
return "insurance-details-paginated";
|
| - |
|
727 |
}
|
| 686 |
}
|
728 |
}
|