Subversion Repositories SmartDukaan

Rev

Rev 30765 | Rev 30859 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 30765 Rev 30858
Line 60... Line 60...
60
import com.spice.profitmandi.dao.repository.user.UserRepository;
60
import com.spice.profitmandi.dao.repository.user.UserRepository;
61
import com.spice.profitmandi.service.NotificationService;
61
import com.spice.profitmandi.service.NotificationService;
62
import com.spice.profitmandi.service.PartnerInvestmentService;
62
import com.spice.profitmandi.service.PartnerInvestmentService;
63
import com.spice.profitmandi.service.PartnerStatsService;
63
import com.spice.profitmandi.service.PartnerStatsService;
64
import com.spice.profitmandi.service.integrations.RazorpayPaymentService;
64
import com.spice.profitmandi.service.integrations.RazorpayPaymentService;
-
 
65
import com.spice.profitmandi.service.integrations.bharti.model.BAGInsuranceModel;
65
import com.spice.profitmandi.service.integrations.toffee.ToffeeService;
66
import com.spice.profitmandi.service.integrations.toffee.ToffeeService;
66
import com.spice.profitmandi.service.inventory.InventoryService;
67
import com.spice.profitmandi.service.inventory.InventoryService;
67
import com.spice.profitmandi.service.inventory.SaholicInventoryService;
68
import com.spice.profitmandi.service.inventory.SaholicInventoryService;
68
import com.spice.profitmandi.service.order.OrderService;
69
import com.spice.profitmandi.service.order.OrderService;
69
import com.spice.profitmandi.service.pricing.PriceDropService;
70
import com.spice.profitmandi.service.pricing.PriceDropService;
Line 2241... Line 2242...
2241
		toffeeService.cancelPolicyCopy("110143521986");
2242
		toffeeService.cancelPolicyCopy("110143521986");
2242
		toffeeService.getOrderId("110143521986");
2243
		toffeeService.getOrderId("110143521986");
2243
	}
2244
	}
2244
 
2245
 
2245
	public void attachToffeeInvoices() throws Exception {
2246
	public void attachToffeeInvoices() throws Exception {
2246
		/*
-
 
2247
		 * LOGGER.info("Insurance Sum Summary --- {}",
-
 
2248
		 * insurancePolicyRepository.selectAmountSumGroupByRetailerId(LocalDateTime.MIN,
-
 
2249
		 * LocalDateTime.MAX)); LOGGER.info("Insurance Qty Summary --- {}",
-
 
2250
		 * insurancePolicyRepository.selectQtyGroupByRetailerId(LocalDateTime.MIN,
-
 
2251
		 * LocalDateTime.MAX)); LOGGER.info("SmartPhone Amount Summary --- {}",
-
 
2252
		 * fofoOrderItemRepository.selectSumAmountGroupByRetailer(LocalDateTime.MIN,
-
 
2253
		 * LocalDateTime.MAX, 0, true)); LOGGER.info("Smartphone Qty Summary --- {}",
-
 
2254
		 * fofoOrderItemRepository.selectQtyGroupByRetailer(LocalDateTime.MIN,
-
 
2255
		 * LocalDateTime.MAX, 0, true));
-
 
2256
		 */
-
 
2257
		List<InsurancePolicy> insurancePolicies = insurancePolicyRepository.selectAllByProviderId(3,
2247
		List<InsurancePolicy> insurancePolicies = insurancePolicyRepository.selectAllByProviderId(3,
2258
				Optional.of(false));
2248
				Optional.of(false));
2259
		for (InsurancePolicy insurancePolicy : insurancePolicies) {
2249
		for (InsurancePolicy insurancePolicy : insurancePolicies) {
2260
			String invoiceNumber = insurancePolicy.getInvoiceNumber();
2250
			String invoiceNumber = insurancePolicy.getInvoiceNumber();
2261
			FofoOrder fofoOrder = fofoOrderRepository.selectByInvoiceNumber(invoiceNumber);
2251
			FofoOrder fofoOrder = fofoOrderRepository.selectByInvoiceNumber(invoiceNumber);
Line 2270... Line 2260...
2270
				insurancePolicy.setPosted(true);
2260
				insurancePolicy.setPosted(true);
2271
			}
2261
			}
2272
		}
2262
		}
2273
	}
2263
	}
2274
 
2264
 
-
 
2265
	public void sendBAGPendingPolicies() throws Exception {
-
 
2266
		List<InsurancePolicy> insurancePolicies = insurancePolicyRepository.selectAllByProviderId(4,
-
 
2267
				Optional.of(false));
-
 
2268
		for (InsurancePolicy insurancePolicy : insurancePolicies) {
-
 
2269
			String invoiceNumber = insurancePolicy.getInvoiceNumber();
-
 
2270
			FofoOrder fofoOrder = fofoOrderRepository.selectByInvoiceNumber(invoiceNumber);
-
 
2271
			FofoOrderItem fofoOrderItem = fofoOrderItemRepository.selectByOrderId(fofoOrder.getId()).get(0);
-
 
2272
			CustomerAddress customerAddress = customerAddressRepository.selectById(fofoOrder.getCustomerAddressId());
-
 
2273
			Customer customer = customerRepository.selectById(fofoOrder.getCustomerId());
-
 
2274
			BAGInsuranceModel bagInsuranceModel = new BAGInsuranceModel();
-
 
2275
			//bagInsuranceModel.setModelId();
-
 
2276
			bagInsuranceModel.setAddressLine1(customerAddress.getLine1());
-
 
2277
			bagInsuranceModel.setAddressLine2(customerAddress.getLine2());
-
 
2278
			bagInsuranceModel.setCity(customerAddress.getCity());
-
 
2279
			bagInsuranceModel.setBrandWarranty("1 Year");
-
 
2280
			Item item = itemRepository.selectById(fofoOrderItem.getId());
-
 
2281
			bagInsuranceModel.setModelName(item.getItemDescription());
-
 
2282
			bagInsuranceModel.setDateOfPurchase(fofoOrder.getFormattedDate());
-
 
2283
			bagInsuranceModel.setEmail(customer.getEmailId());
-
 
2284
			bagInsuranceModel.setImei1(insurancePolicy.getSerialNumber());
-
 
2285
			bagInsuranceModel.setFirstName(customer.getFirstName());
-
 
2286
			bagInsuranceModel.setLastName(customer.getLastName());
-
 
2287
			bagInsuranceModel.setMobileNumber(customer.getMobileNumber());
-
 
2288
			bagInsuranceModel.setPlanId("");
-
 
2289
			insurancePolicy.setPosted(true);
-
 
2290
		}
-
 
2291
	}
-
 
2292
 
2275
	public void schemeRollback(List<String> schemeIds) throws Exception {
2293
	public void schemeRollback(List<String> schemeIds) throws Exception {
2276
		List<Integer> schemeIdsInt = schemeIds.stream().map(x -> Integer.parseInt(x)).collect(Collectors.toList());
2294
		List<Integer> schemeIdsInt = schemeIds.stream().map(x -> Integer.parseInt(x)).collect(Collectors.toList());
2277
		Map<Integer, Scheme> schemesMap = schemeRepository.selectBySchemeIds(schemeIdsInt, 0, schemeIds.size()).stream()
2295
		Map<Integer, Scheme> schemesMap = schemeRepository.selectBySchemeIds(schemeIdsInt, 0, schemeIds.size()).stream()
2278
				.collect(Collectors.toMap(x -> x.getId(), x -> x));
2296
				.collect(Collectors.toMap(x -> x.getId(), x -> x));
2279
		List<SchemeInOut> schemeInOuts = schemeInOutRepository.selectBySchemeIds(new HashSet<>(schemeIdsInt));
2297
		List<SchemeInOut> schemeInOuts = schemeInOutRepository.selectBySchemeIds(new HashSet<>(schemeIdsInt));