| Line 7... |
Line 7... |
| 7 |
import java.io.OutputStream;
|
7 |
import java.io.OutputStream;
|
| 8 |
import java.text.MessageFormat;
|
8 |
import java.text.MessageFormat;
|
| 9 |
import java.time.LocalDate;
|
9 |
import java.time.LocalDate;
|
| 10 |
import java.time.LocalDateTime;
|
10 |
import java.time.LocalDateTime;
|
| 11 |
import java.time.format.DateTimeFormatter;
|
11 |
import java.time.format.DateTimeFormatter;
|
| - |
|
12 |
import java.util.ArrayList;
|
| 12 |
import java.util.Arrays;
|
13 |
import java.util.Arrays;
|
| 13 |
import java.util.HashSet;
|
14 |
import java.util.HashSet;
|
| 14 |
import java.util.List;
|
15 |
import java.util.List;
|
| 15 |
import java.util.Map;
|
16 |
import java.util.Map;
|
| 16 |
import java.util.Set;
|
17 |
import java.util.Set;
|
| Line 37... |
Line 38... |
| 37 |
import com.spice.profitmandi.common.model.CustomCustomer;
|
38 |
import com.spice.profitmandi.common.model.CustomCustomer;
|
| 38 |
import com.spice.profitmandi.common.model.CustomInsurancePolicy;
|
39 |
import com.spice.profitmandi.common.model.CustomInsurancePolicy;
|
| 39 |
import com.spice.profitmandi.common.model.CustomOrderItem;
|
40 |
import com.spice.profitmandi.common.model.CustomOrderItem;
|
| 40 |
import com.spice.profitmandi.common.model.CustomRetailer;
|
41 |
import com.spice.profitmandi.common.model.CustomRetailer;
|
| 41 |
import com.spice.profitmandi.common.model.GadgetCopsDocumentInsuranceModel;
|
42 |
import com.spice.profitmandi.common.model.GadgetCopsDocumentInsuranceModel;
|
| - |
|
43 |
import com.spice.profitmandi.common.model.GadgetCopsInsuranceCalcResponse;
|
| 42 |
import com.spice.profitmandi.common.model.PdfModel;
|
44 |
import com.spice.profitmandi.common.model.PdfModel;
|
| 43 |
import com.spice.profitmandi.common.model.ProfitMandiConstants;
|
45 |
import com.spice.profitmandi.common.model.ProfitMandiConstants;
|
| 44 |
import com.spice.profitmandi.common.util.InsuranceUtils;
|
46 |
import com.spice.profitmandi.common.util.InsuranceUtils;
|
| 45 |
import com.spice.profitmandi.common.util.PdfUtils;
|
47 |
import com.spice.profitmandi.common.util.PdfUtils;
|
| 46 |
import com.spice.profitmandi.common.util.StringUtils;
|
48 |
import com.spice.profitmandi.common.util.StringUtils;
|
| Line 78... |
Line 80... |
| 78 |
private GadgetCopsInsuranceCalcRepository gadgetCopsInsuranceCalcRepository;
|
80 |
private GadgetCopsInsuranceCalcRepository gadgetCopsInsuranceCalcRepository;
|
| 79 |
|
81 |
|
| 80 |
@RequestMapping(value = ProfitMandiConstants.URL_INSURANCE_GADGET_COPS_MAPPING, method = RequestMethod.GET)
|
82 |
@RequestMapping(value = ProfitMandiConstants.URL_INSURANCE_GADGET_COPS_MAPPING, method = RequestMethod.GET)
|
| 81 |
public ResponseEntity<?> getById(HttpServletRequest request) {
|
83 |
public ResponseEntity<?> getById(HttpServletRequest request) {
|
| 82 |
LOGGER.info("requested url : " + request.getRequestURL().toString());
|
84 |
LOGGER.info("requested url : " + request.getRequestURL().toString());
|
| 83 |
return responseSender.ok(gadgetCopsInsuranceCalcRepository.selectAll());
|
85 |
List<GadgetCopsInsuranceCalc> calcList = gadgetCopsInsuranceCalcRepository.selectAll();
|
| - |
|
86 |
|
| - |
|
87 |
return responseSender.ok(this.toCalcResponseList(calcList));
|
| 84 |
}
|
88 |
}
|
| 85 |
|
89 |
|
| 86 |
@Autowired
|
90 |
@Autowired
|
| 87 |
ResponseSender<?> responseSender;
|
91 |
ResponseSender<?> responseSender;
|
| 88 |
|
92 |
|
| Line 330... |
Line 334... |
| 330 |
|
334 |
|
| 331 |
Set<CustomOrderItem> customerFofoOrderItems = new HashSet<>();
|
335 |
Set<CustomOrderItem> customerFofoOrderItems = new HashSet<>();
|
| 332 |
pdfModel.setOrderItems(customerFofoOrderItems);
|
336 |
pdfModel.setOrderItems(customerFofoOrderItems);
|
| 333 |
return pdfModel;
|
337 |
return pdfModel;
|
| 334 |
}
|
338 |
}
|
| - |
|
339 |
|
| - |
|
340 |
private List<GadgetCopsInsuranceCalcResponse> toCalcResponseList (List<GadgetCopsInsuranceCalc> calcList) {
|
| - |
|
341 |
List<GadgetCopsInsuranceCalcResponse> calcResponseList = new ArrayList<>();
|
| - |
|
342 |
for (GadgetCopsInsuranceCalc calc : calcList) {
|
| - |
|
343 |
GadgetCopsInsuranceCalcResponse calcResponse = new GadgetCopsInsuranceCalcResponse();
|
| - |
|
344 |
calcResponse.setDealerPrice(calc.getDealerPrice());
|
| - |
|
345 |
calcResponse.setPriceRangeMax(calc.getPriceRangeMax());
|
| - |
|
346 |
calcResponse.setPriceRangeMin(calc.getPriceRangeMin());
|
| - |
|
347 |
float taxableInsuranceMargin = (calc.getSellingPrice() - calc.getDealerPrice()) / (1 + ProfitMandiConstants.INSURANCE_TAX_RATE / 100);
|
| - |
|
348 |
calcResponse.setCashBack(taxableInsuranceMargin);
|
| - |
|
349 |
calcResponseList.add(calcResponse);
|
| - |
|
350 |
}
|
| - |
|
351 |
return calcResponseList;
|
| - |
|
352 |
}
|
| 335 |
|
353 |
|
| 336 |
}
|
354 |
}
|