| Line 16... |
Line 16... |
| 16 |
import java.util.Map;
|
16 |
import java.util.Map;
|
| 17 |
import java.util.Set;
|
17 |
import java.util.Set;
|
| 18 |
import java.util.stream.Collectors;
|
18 |
import java.util.stream.Collectors;
|
| 19 |
|
19 |
|
| 20 |
import javax.servlet.http.HttpServletRequest;
|
20 |
import javax.servlet.http.HttpServletRequest;
|
| - |
|
21 |
import javax.servlet.http.HttpServletResponse;
|
| 21 |
import javax.transaction.Transactional;
|
22 |
import javax.transaction.Transactional;
|
| 22 |
|
23 |
|
| - |
|
24 |
import org.apache.commons.csv.CSVRecord;
|
| 23 |
import org.apache.logging.log4j.LogManager;
|
25 |
import org.apache.logging.log4j.LogManager;
|
| 24 |
import org.apache.logging.log4j.Logger;
|
26 |
import org.apache.logging.log4j.Logger;
|
| 25 |
import org.springframework.beans.factory.annotation.Autowired;
|
27 |
import org.springframework.beans.factory.annotation.Autowired;
|
| 26 |
import org.springframework.beans.factory.annotation.Qualifier;
|
28 |
import org.springframework.beans.factory.annotation.Qualifier;
|
| 27 |
import org.springframework.core.io.InputStreamResource;
|
29 |
import org.springframework.core.io.InputStreamResource;
|
| Line 32... |
Line 34... |
| 32 |
import org.springframework.ui.Model;
|
34 |
import org.springframework.ui.Model;
|
| 33 |
import org.springframework.web.bind.annotation.RequestBody;
|
35 |
import org.springframework.web.bind.annotation.RequestBody;
|
| 34 |
import org.springframework.web.bind.annotation.RequestMapping;
|
36 |
import org.springframework.web.bind.annotation.RequestMapping;
|
| 35 |
import org.springframework.web.bind.annotation.RequestMethod;
|
37 |
import org.springframework.web.bind.annotation.RequestMethod;
|
| 36 |
import org.springframework.web.bind.annotation.RequestParam;
|
38 |
import org.springframework.web.bind.annotation.RequestParam;
|
| - |
|
39 |
import org.springframework.web.bind.annotation.RequestPart;
|
| - |
|
40 |
import org.springframework.web.multipart.MultipartFile;
|
| 37 |
|
41 |
|
| 38 |
import com.spice.profitmandi.common.enumuration.DateTimePattern;
|
42 |
import com.spice.profitmandi.common.enumuration.DateTimePattern;
|
| 39 |
import com.spice.profitmandi.common.enumuration.ReporticoProject;
|
43 |
import com.spice.profitmandi.common.enumuration.ReporticoProject;
|
| 40 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
44 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
| 41 |
import com.spice.profitmandi.common.model.CustomRetailer;
|
45 |
import com.spice.profitmandi.common.model.CustomRetailer;
|
| Line 48... |
Line 52... |
| 48 |
import com.spice.profitmandi.common.util.FileUtil;
|
52 |
import com.spice.profitmandi.common.util.FileUtil;
|
| 49 |
import com.spice.profitmandi.common.util.FormattingUtils;
|
53 |
import com.spice.profitmandi.common.util.FormattingUtils;
|
| 50 |
import com.spice.profitmandi.common.util.StringUtils;
|
54 |
import com.spice.profitmandi.common.util.StringUtils;
|
| 51 |
import com.spice.profitmandi.common.util.Utils;
|
55 |
import com.spice.profitmandi.common.util.Utils;
|
| 52 |
import com.spice.profitmandi.common.web.util.ResponseSender;
|
56 |
import com.spice.profitmandi.common.web.util.ResponseSender;
|
| - |
|
57 |
import com.spice.profitmandi.dao.entity.catalog.CustomerOffer;
|
| - |
|
58 |
import com.spice.profitmandi.dao.entity.catalog.CustomerOfferItem;
|
| 53 |
import com.spice.profitmandi.dao.entity.catalog.EvaluateSchemeInvestmentPayoutModel;
|
59 |
import com.spice.profitmandi.dao.entity.catalog.EvaluateSchemeInvestmentPayoutModel;
|
| 54 |
import com.spice.profitmandi.dao.entity.catalog.Item;
|
60 |
import com.spice.profitmandi.dao.entity.catalog.Item;
|
| - |
|
61 |
import com.spice.profitmandi.dao.entity.catalog.SamsungUpgradeOffer;
|
| 55 |
import com.spice.profitmandi.dao.entity.catalog.Scheme;
|
62 |
import com.spice.profitmandi.dao.entity.catalog.Scheme;
|
| 56 |
import com.spice.profitmandi.dao.entity.catalog.TagListing;
|
63 |
import com.spice.profitmandi.dao.entity.catalog.TagListing;
|
| - |
|
64 |
import com.spice.profitmandi.dao.entity.fofo.FofoLineItem;
|
| - |
|
65 |
import com.spice.profitmandi.dao.entity.fofo.FofoOrder;
|
| - |
|
66 |
import com.spice.profitmandi.dao.entity.fofo.FofoOrderItem;
|
| 57 |
import com.spice.profitmandi.dao.entity.fofo.FofoStore;
|
67 |
import com.spice.profitmandi.dao.entity.fofo.FofoStore;
|
| 58 |
import com.spice.profitmandi.dao.entity.fofo.InventoryItem;
|
68 |
import com.spice.profitmandi.dao.entity.fofo.InventoryItem;
|
| 59 |
import com.spice.profitmandi.dao.entity.fofo.PartnerDailyInvestment;
|
69 |
import com.spice.profitmandi.dao.entity.fofo.PartnerDailyInvestment;
|
| 60 |
import com.spice.profitmandi.dao.entity.fofo.PartnerType;
|
70 |
import com.spice.profitmandi.dao.entity.fofo.PartnerType;
|
| 61 |
import com.spice.profitmandi.dao.entity.fofo.SchemeInOut;
|
71 |
import com.spice.profitmandi.dao.entity.fofo.SchemeInOut;
|
| 62 |
import com.spice.profitmandi.dao.entity.fofo.SchemeItem;
|
72 |
import com.spice.profitmandi.dao.entity.fofo.SchemeItem;
|
| 63 |
import com.spice.profitmandi.dao.entity.transaction.PriceDrop;
|
73 |
import com.spice.profitmandi.dao.entity.transaction.PriceDrop;
|
| 64 |
import com.spice.profitmandi.dao.entity.transaction.PriceDropIMEI;
|
74 |
import com.spice.profitmandi.dao.entity.transaction.PriceDropIMEI;
|
| 65 |
import com.spice.profitmandi.dao.enumuration.catalog.AmountType;
|
75 |
import com.spice.profitmandi.dao.enumuration.catalog.AmountType;
|
| 66 |
import com.spice.profitmandi.dao.enumuration.catalog.SchemeType;
|
76 |
import com.spice.profitmandi.dao.enumuration.catalog.SchemeType;
|
| - |
|
77 |
import com.spice.profitmandi.dao.enumuration.catalog.UpgradeOfferStatus;
|
| 67 |
import com.spice.profitmandi.dao.enumuration.transaction.SchemePayoutStatus;
|
78 |
import com.spice.profitmandi.dao.enumuration.transaction.SchemePayoutStatus;
|
| 68 |
import com.spice.profitmandi.dao.model.CreateOfferRequest;
|
79 |
import com.spice.profitmandi.dao.model.CreateOfferRequest;
|
| 69 |
import com.spice.profitmandi.dao.model.CreateSchemeRequest;
|
80 |
import com.spice.profitmandi.dao.model.CreateSchemeRequest;
|
| - |
|
81 |
import com.spice.profitmandi.dao.repository.catalog.CustomerOfferItemRepository;
|
| - |
|
82 |
import com.spice.profitmandi.dao.repository.catalog.CustomerOfferRepository;
|
| 70 |
import com.spice.profitmandi.dao.repository.catalog.ItemRepository;
|
83 |
import com.spice.profitmandi.dao.repository.catalog.ItemRepository;
|
| - |
|
84 |
import com.spice.profitmandi.dao.repository.catalog.SamsungUpgradeOfferRepository;
|
| 71 |
import com.spice.profitmandi.dao.repository.catalog.SchemeRepository;
|
85 |
import com.spice.profitmandi.dao.repository.catalog.SchemeRepository;
|
| 72 |
import com.spice.profitmandi.dao.repository.catalog.StateGstRateRepository;
|
86 |
import com.spice.profitmandi.dao.repository.catalog.StateGstRateRepository;
|
| 73 |
import com.spice.profitmandi.dao.repository.catalog.TagListingRepository;
|
87 |
import com.spice.profitmandi.dao.repository.catalog.TagListingRepository;
|
| 74 |
import com.spice.profitmandi.dao.repository.dtr.FofoStoreRepository;
|
88 |
import com.spice.profitmandi.dao.repository.dtr.FofoStoreRepository;
|
| 75 |
import com.spice.profitmandi.dao.repository.dtr.Mongo;
|
89 |
import com.spice.profitmandi.dao.repository.dtr.Mongo;
|
| - |
|
90 |
import com.spice.profitmandi.dao.repository.fofo.FofoLineItemRepository;
|
| - |
|
91 |
import com.spice.profitmandi.dao.repository.fofo.FofoOrderItemRepository;
|
| - |
|
92 |
import com.spice.profitmandi.dao.repository.fofo.FofoOrderRepository;
|
| 76 |
import com.spice.profitmandi.dao.repository.fofo.InventoryItemRepository;
|
93 |
import com.spice.profitmandi.dao.repository.fofo.InventoryItemRepository;
|
| 77 |
import com.spice.profitmandi.dao.repository.fofo.PartnerDailyInvestmentRepository;
|
94 |
import com.spice.profitmandi.dao.repository.fofo.PartnerDailyInvestmentRepository;
|
| 78 |
import com.spice.profitmandi.dao.repository.fofo.PartnerTypeChangeService;
|
95 |
import com.spice.profitmandi.dao.repository.fofo.PartnerTypeChangeService;
|
| 79 |
import com.spice.profitmandi.dao.repository.fofo.SchemeInOutRepository;
|
96 |
import com.spice.profitmandi.dao.repository.fofo.SchemeInOutRepository;
|
| 80 |
import com.spice.profitmandi.dao.repository.fofo.SchemeItemRepository;
|
97 |
import com.spice.profitmandi.dao.repository.fofo.SchemeItemRepository;
|
| Line 166... |
Line 183... |
| 166 |
PriceDropRepository priceDropRepository;
|
183 |
PriceDropRepository priceDropRepository;
|
| 167 |
|
184 |
|
| 168 |
@Autowired
|
185 |
@Autowired
|
| 169 |
SchemeInOutRepository schemeInOutRepository;
|
186 |
SchemeInOutRepository schemeInOutRepository;
|
| 170 |
|
187 |
|
| - |
|
188 |
@Autowired
|
| - |
|
189 |
private CustomerOfferRepository customerOfferRepository;
|
| - |
|
190 |
|
| - |
|
191 |
@Autowired
|
| - |
|
192 |
private CustomerOfferItemRepository customerOfferItemRepository;
|
| - |
|
193 |
|
| - |
|
194 |
@Autowired
|
| - |
|
195 |
private SamsungUpgradeOfferRepository samsungUpgradeOfferRepository;
|
| - |
|
196 |
|
| 171 |
@RequestMapping(value = "/createScheme", method = RequestMethod.GET)
|
197 |
@RequestMapping(value = "/createScheme", method = RequestMethod.GET)
|
| 172 |
public String createScheme(HttpServletRequest request, Model model) {
|
198 |
public String createScheme(HttpServletRequest request, Model model) {
|
| 173 |
|
199 |
|
| 174 |
LocalDate currentdate = LocalDate.now();
|
200 |
LocalDate currentdate = LocalDate.now();
|
| 175 |
Month month = currentdate.getMonth().minus(1);
|
201 |
Month month = currentdate.getMonth().minus(1);
|
| Line 595... |
Line 621... |
| 595 |
Item item = itemRepository.selectById(searchItem);
|
621 |
Item item = itemRepository.selectById(searchItem);
|
| 596 |
if (tagListing != null) {
|
622 |
if (tagListing != null) {
|
| 597 |
model.addAttribute("dp", tagListing.getSellingPrice());
|
623 |
model.addAttribute("dp", tagListing.getSellingPrice());
|
| 598 |
model.addAttribute("mop", tagListing.getMop());
|
624 |
model.addAttribute("mop", tagListing.getMop());
|
| 599 |
}
|
625 |
}
|
| 600 |
schemes = schemeService.selectSchemeByPartnerType(partnerType, date, searchItem, isAdmin, offset, limit).stream().filter(x-> {
|
626 |
schemes = schemeService.selectSchemeByPartnerType(partnerType, date, searchItem, isAdmin, offset, limit)
|
| - |
|
627 |
.stream().filter(x -> {
|
| 601 |
return (x.getId()!=411 && x.getId()!=612) || date1.isBefore(LocalDate.of(2021, 12, 1));
|
628 |
return (x.getId() != 411 && x.getId() != 612) || date1.isBefore(LocalDate.of(2021, 12, 1));
|
| 602 |
}).collect(Collectors.toList());
|
629 |
}).collect(Collectors.toList());
|
| 603 |
//Remove 411 and 612
|
630 |
// Remove 411 and 612
|
| 604 |
model.addAttribute("schemes", schemes);
|
631 |
model.addAttribute("schemes", schemes);
|
| 605 |
if (schemes.size() == 0) {
|
632 |
if (schemes.size() == 0) {
|
| 606 |
if (isAdmin)
|
633 |
if (isAdmin)
|
| 607 |
return "schemes";
|
634 |
return "schemes";
|
| 608 |
else {
|
635 |
else {
|
| Line 665... |
Line 692... |
| 665 |
model.addAttribute("searchItem", searchItem);
|
692 |
model.addAttribute("searchItem", searchItem);
|
| 666 |
model.addAttribute("searchTerm", searchTerm);
|
693 |
model.addAttribute("searchTerm", searchTerm);
|
| 667 |
model.addAttribute("partnerType", partnerType);
|
694 |
model.addAttribute("partnerType", partnerType);
|
| 668 |
model.addAttribute("isAdmin", isAdmin);
|
695 |
model.addAttribute("isAdmin", isAdmin);
|
| 669 |
LOGGER.info("schemes" + schemes);
|
696 |
LOGGER.info("schemes" + schemes);
|
| 670 |
model.addAttribute("schemes", schemes !=null ? schemes.stream().filter(x-> {
|
697 |
model.addAttribute("schemes", schemes != null ? schemes.stream().filter(x -> {
|
| 671 |
return (x.getId()!=411 && x.getId()!=612) || date1.isBefore(LocalDate.of(2021, 12, 1));
|
698 |
return (x.getId() != 411 && x.getId() != 612) || date1.isBefore(LocalDate.of(2021, 12, 1));
|
| 672 |
}).collect(Collectors.toList()) : null);
|
699 |
}).collect(Collectors.toList()) : null);
|
| 673 |
LOGGER.info("schemes" + schemes);
|
700 |
LOGGER.info("schemes" + schemes);
|
| 674 |
// model.addAttribute("roleTypes", loginDetails.getRoleTypes());
|
701 |
// model.addAttribute("roleTypes", loginDetails.getRoleTypes());
|
| 675 |
if (isAdmin)
|
702 |
if (isAdmin)
|
| 676 |
return "schemes";
|
703 |
return "schemes";
|
| Line 997... |
Line 1024... |
| 997 |
model.addAttribute("searchItem", searchItem);
|
1024 |
model.addAttribute("searchItem", searchItem);
|
| 998 |
model.addAttribute("roleType", roleManager.isAdmin(loginDetails.getRoleIds()));
|
1025 |
model.addAttribute("roleType", roleManager.isAdmin(loginDetails.getRoleIds()));
|
| 999 |
return "schemes-paginated";
|
1026 |
return "schemes-paginated";
|
| 1000 |
|
1027 |
|
| 1001 |
}
|
1028 |
}
|
| - |
|
1029 |
|
| - |
|
1030 |
@RequestMapping(value = "/getCustomerOffer", method = RequestMethod.GET)
|
| - |
|
1031 |
public String getCustomerOffer(HttpServletRequest request, Model model) throws ProfitMandiBusinessException {
|
| - |
|
1032 |
|
| - |
|
1033 |
List<CustomerOffer> customerOffers = customerOfferRepository.selectAll();
|
| - |
|
1034 |
|
| - |
|
1035 |
model.addAttribute("customerOffers", customerOffers);
|
| - |
|
1036 |
return "customer-offer";
|
| - |
|
1037 |
|
| - |
|
1038 |
}
|
| - |
|
1039 |
|
| - |
|
1040 |
@RequestMapping(value = "/createCustomerOffer", method = RequestMethod.POST)
|
| - |
|
1041 |
public String createCustomerOffer(HttpServletRequest request, @RequestParam String offerName,
|
| - |
|
1042 |
@RequestParam LocalDateTime startDate, @RequestParam LocalDateTime endDate, Model model) throws Exception {
|
| - |
|
1043 |
|
| - |
|
1044 |
CustomerOffer co = new CustomerOffer();
|
| - |
|
1045 |
co.setOfferName(offerName);
|
| - |
|
1046 |
co.setStartDate(startDate);
|
| - |
|
1047 |
co.setEndDate(endDate);
|
| - |
|
1048 |
co.setCreatedTimestamp(LocalDateTime.now());
|
| - |
|
1049 |
co.setUpdatedTimestamp(LocalDateTime.now());
|
| - |
|
1050 |
customerOfferRepository.persist(co);
|
| - |
|
1051 |
|
| - |
|
1052 |
model.addAttribute("response", mvcResponseSender.createResponseString(true));
|
| - |
|
1053 |
|
| - |
|
1054 |
return "response";
|
| - |
|
1055 |
|
| - |
|
1056 |
}
|
| - |
|
1057 |
|
| - |
|
1058 |
@RequestMapping(value = "/customerOffer/downloadTemplate", method = RequestMethod.GET)
|
| - |
|
1059 |
public ResponseEntity<?> downloadCustomerOfferTemplate(HttpServletRequest request) throws Exception {
|
| - |
|
1060 |
List<List<?>> rows = new ArrayList<>();
|
| - |
|
1061 |
|
| - |
|
1062 |
org.apache.commons.io.output.ByteArrayOutputStream baos = FileUtil
|
| - |
|
1063 |
.getCSVByteStream(Arrays.asList("id", "Catalog Id", "Scheme Payout", "Dealer Payout"), rows);
|
| - |
|
1064 |
|
| - |
|
1065 |
final HttpHeaders headers = new HttpHeaders();
|
| - |
|
1066 |
headers.set("Content-Type", "text/csv");
|
| - |
|
1067 |
headers.set("Content-disposition", "inline; filename=customer-offer-template.csv");
|
| - |
|
1068 |
headers.setContentLength(baos.toByteArray().length);
|
| - |
|
1069 |
|
| - |
|
1070 |
final InputStream inputStream = new ByteArrayInputStream(baos.toByteArray());
|
| - |
|
1071 |
final InputStreamResource inputStreamResource = new InputStreamResource(inputStream);
|
| - |
|
1072 |
return new ResponseEntity<InputStreamResource>(inputStreamResource, headers, HttpStatus.OK);
|
| - |
|
1073 |
|
| - |
|
1074 |
}
|
| - |
|
1075 |
|
| - |
|
1076 |
@RequestMapping(value = "/customerOfferItem/upload", method = RequestMethod.POST)
|
| - |
|
1077 |
public String uploadCustomerOfferItem(HttpServletRequest request, Model model, @RequestParam int offerId,
|
| - |
|
1078 |
HttpServletResponse response, @RequestPart MultipartFile file) throws Throwable {
|
| - |
|
1079 |
|
| - |
|
1080 |
List<CSVRecord> records = FileUtil.readFile(file);
|
| - |
|
1081 |
|
| - |
|
1082 |
for (CSVRecord record : records) {
|
| - |
|
1083 |
if (Integer.parseInt(record.get(0)) == 0) {
|
| - |
|
1084 |
CustomerOfferItem coi = new CustomerOfferItem();
|
| - |
|
1085 |
coi.setCatalogId(Integer.parseInt(record.get(1)));
|
| - |
|
1086 |
coi.setSchemePayout(Integer.parseInt(record.get(2)));
|
| - |
|
1087 |
coi.setDealerPayout(Integer.parseInt(record.get(3)));
|
| - |
|
1088 |
coi.setCustomerOfferId(offerId);
|
| - |
|
1089 |
coi.setUpdatedTimestamp(LocalDateTime.now());
|
| - |
|
1090 |
coi.setCreatedTimestamp(LocalDateTime.now());
|
| - |
|
1091 |
customerOfferItemRepository.persist(coi);
|
| - |
|
1092 |
|
| - |
|
1093 |
} else {
|
| - |
|
1094 |
CustomerOfferItem coi = customerOfferItemRepository.selectById(Integer.parseInt(record.get(0)));
|
| - |
|
1095 |
coi.setSchemePayout(Integer.parseInt(record.get(2)));
|
| - |
|
1096 |
coi.setDealerPayout(Integer.parseInt(record.get(3)));
|
| - |
|
1097 |
coi.setUpdatedTimestamp(LocalDateTime.now());
|
| - |
|
1098 |
|
| - |
|
1099 |
}
|
| - |
|
1100 |
|
| - |
|
1101 |
}
|
| - |
|
1102 |
|
| - |
|
1103 |
model.addAttribute("response", mvcResponseSender.createResponseString(true));
|
| - |
|
1104 |
|
| - |
|
1105 |
return "response";
|
| - |
|
1106 |
|
| - |
|
1107 |
}
|
| - |
|
1108 |
|
| - |
|
1109 |
@RequestMapping(value = "/customerOfferItem/download", method = RequestMethod.GET)
|
| - |
|
1110 |
public ResponseEntity<?> downloadOfferItem(HttpServletRequest request, @RequestParam int offerId) throws Exception {
|
| - |
|
1111 |
|
| - |
|
1112 |
List<CustomerOfferItem> cois = customerOfferItemRepository.selectByOfferId(offerId);
|
| - |
|
1113 |
List<List<?>> rows = new ArrayList<>();
|
| - |
|
1114 |
|
| - |
|
1115 |
for (CustomerOfferItem coi : cois) {
|
| - |
|
1116 |
rows.add(Arrays.asList(coi.getId(), coi.getCatalogId(), coi.getSchemePayout(), coi.getDealerPayout()));
|
| - |
|
1117 |
|
| - |
|
1118 |
}
|
| - |
|
1119 |
|
| - |
|
1120 |
org.apache.commons.io.output.ByteArrayOutputStream baos = FileUtil
|
| - |
|
1121 |
.getCSVByteStream(Arrays.asList("id", "Catalog Id", "Scheme Payout", "Dealer Payout"), rows);
|
| - |
|
1122 |
|
| - |
|
1123 |
final HttpHeaders headers = new HttpHeaders();
|
| - |
|
1124 |
headers.set("Content-Type", "text/csv");
|
| - |
|
1125 |
headers.set("Content-disposition", "inline; filename=customer-offer-template.csv");
|
| - |
|
1126 |
headers.setContentLength(baos.toByteArray().length);
|
| - |
|
1127 |
|
| - |
|
1128 |
final InputStream inputStream = new ByteArrayInputStream(baos.toByteArray());
|
| - |
|
1129 |
final InputStreamResource inputStreamResource = new InputStreamResource(inputStream);
|
| - |
|
1130 |
return new ResponseEntity<InputStreamResource>(inputStreamResource, headers, HttpStatus.OK);
|
| - |
|
1131 |
|
| - |
|
1132 |
}
|
| - |
|
1133 |
|
| - |
|
1134 |
@RequestMapping(value = "/extendCustomerOffer", method = RequestMethod.POST)
|
| - |
|
1135 |
public String extendCustomerOffer(HttpServletRequest request, @RequestParam int id,
|
| - |
|
1136 |
@RequestParam LocalDateTime endDate, Model model) throws ProfitMandiBusinessException {
|
| - |
|
1137 |
|
| - |
|
1138 |
CustomerOffer co = customerOfferRepository.selectById(id);
|
| - |
|
1139 |
co.setEndDate(endDate);
|
| - |
|
1140 |
co.setUpdatedTimestamp(LocalDateTime.now());
|
| - |
|
1141 |
|
| - |
|
1142 |
model.addAttribute("co", co);
|
| - |
|
1143 |
|
| - |
|
1144 |
return "customer-index-offer";
|
| - |
|
1145 |
|
| - |
|
1146 |
}
|
| - |
|
1147 |
|
| - |
|
1148 |
@RequestMapping(value = "/getSamsungUpgradeOffer", method = RequestMethod.GET)
|
| - |
|
1149 |
public String getSamsungUpgradeOffer(HttpServletRequest request, Model model) throws ProfitMandiBusinessException {
|
| - |
|
1150 |
|
| - |
|
1151 |
List<UpgradeOfferStatus> uos = UpgradeOfferStatus.offerStatus;
|
| - |
|
1152 |
List<SamsungUpgradeOffer> samsungUpgradeOffers = samsungUpgradeOfferRepository.selectByStatus(
|
| - |
|
1153 |
uos.stream().filter(x -> !x.equals(UpgradeOfferStatus.rejected)).collect(Collectors.toList()));
|
| - |
|
1154 |
|
| - |
|
1155 |
model.addAttribute("samsungUpgradeOffers", samsungUpgradeOffers);
|
| - |
|
1156 |
return "samsung-upgrade-offer";
|
| - |
|
1157 |
|
| - |
|
1158 |
}
|
| - |
|
1159 |
|
| - |
|
1160 |
@RequestMapping(value = "/approveSamsungUpgradeOffer", method = RequestMethod.POST)
|
| - |
|
1161 |
public String approveSamsungUpgradeOffer(HttpServletRequest request, @RequestParam int id, Model model)
|
| - |
|
1162 |
throws ProfitMandiBusinessException {
|
| - |
|
1163 |
|
| - |
|
1164 |
SamsungUpgradeOffer suo = samsungUpgradeOfferRepository.selectById(id);
|
| - |
|
1165 |
suo.setStatus(UpgradeOfferStatus.approved);
|
| - |
|
1166 |
suo.setApprovedTimestamp(LocalDateTime.now());
|
| - |
|
1167 |
model.addAttribute("suo", suo);
|
| - |
|
1168 |
return "samsung-upgrade-offer-index";
|
| - |
|
1169 |
|
| - |
|
1170 |
}
|
| - |
|
1171 |
|
| - |
|
1172 |
@RequestMapping(value = "/rejectSamsungUpgradeOffer", method = RequestMethod.POST)
|
| - |
|
1173 |
public String rejectSamsungUpgradeOffer(HttpServletRequest request, @RequestParam int id, Model model)
|
| - |
|
1174 |
throws ProfitMandiBusinessException {
|
| - |
|
1175 |
|
| - |
|
1176 |
SamsungUpgradeOffer suo = samsungUpgradeOfferRepository.selectById(id);
|
| - |
|
1177 |
suo.setStatus(UpgradeOfferStatus.rejected);
|
| - |
|
1178 |
|
| - |
|
1179 |
model.addAttribute("suo", suo);
|
| - |
|
1180 |
return "samsung-upgrade-offer-index";
|
| - |
|
1181 |
|
| - |
|
1182 |
}
|
| - |
|
1183 |
|
| 1002 |
}
|
1184 |
}
|
| 1003 |
|
1185 |
|