Subversion Repositories SmartDukaan

Rev

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

Rev 29451 Rev 29488
Line 64... Line 64...
64
import org.springframework.stereotype.Component;
64
import org.springframework.stereotype.Component;
65
import org.springframework.transaction.annotation.Transactional;
65
import org.springframework.transaction.annotation.Transactional;
66
 
66
 
67
import com.google.common.collect.Lists;
67
import com.google.common.collect.Lists;
68
import com.google.gson.Gson;
68
import com.google.gson.Gson;
69
import com.razorpay.Payment; 
69
import com.razorpay.Payment;
70
 
-
 
-
 
70
import com.smartdukaan.cron.itelImeiActivation.ItelImeiActivationService;
-
 
71
import com.smartdukaan.cron.itelImeiActivation.TecnoImeiActivation;
71
import com.spice.profitmandi.common.enumuration.MessageType;
72
import com.spice.profitmandi.common.enumuration.MessageType;
72
import com.spice.profitmandi.common.enumuration.RechargeStatus;
73
import com.spice.profitmandi.common.enumuration.RechargeStatus;
73
import com.spice.profitmandi.common.enumuration.ReporticoProject;
74
import com.spice.profitmandi.common.enumuration.ReporticoProject;
74
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
75
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
75
import com.spice.profitmandi.common.model.CustomRetailer;
76
import com.spice.profitmandi.common.model.CustomRetailer;
Line 233... Line 234...
233
	@Value("${oxigen.recharge.enquiry.url}")
234
	@Value("${oxigen.recharge.enquiry.url}")
234
	private String oxigenRechargeEnquiryUrl;
235
	private String oxigenRechargeEnquiryUrl;
235
 
236
 
236
	@Autowired
237
	@Autowired
237
	private RegionRepository regionRepository;
238
	private RegionRepository regionRepository;
-
 
239
	
-
 
240
	@Autowired
-
 
241
	private TecnoImeiActivation tecnoImeiActivation;
238
 
242
 
239
	private static final DateTimeFormatter leadTimeFormatter = DateTimeFormatter.ofPattern("d LLL, hh:mm a");
243
	private static final DateTimeFormatter leadTimeFormatter = DateTimeFormatter.ofPattern("d LLL, hh:mm a");
240
 
244
 
241
	@Autowired
245
	@Autowired
242
	private PartnerRegionRepository partnerRegionRepository;
246
	private PartnerRegionRepository partnerRegionRepository;
Line 244... Line 248...
244
	@Autowired
248
	@Autowired
245
	private EmployeeAttendanceRepository employeeAttendanceRepository;
249
	private EmployeeAttendanceRepository employeeAttendanceRepository;
246
 
250
 
247
	@Autowired
251
	@Autowired
248
	VivoImeiActivationService vivoImeiActivationService;
252
	VivoImeiActivationService vivoImeiActivationService;
-
 
253
 
-
 
254
	@Autowired
-
 
255
	ItelImeiActivationService itelImeiActivationService;
249
	
256
 
250
	@Autowired
257
	@Autowired
251
	private PartnerTypeChangeService partnerTypeChangeService;
258
	private PartnerTypeChangeService partnerTypeChangeService;
252
 
259
 
253
	@Autowired
260
	@Autowired
254
	private ActivatedImeiRepository activatedImeiRepository;
261
	private ActivatedImeiRepository activatedImeiRepository;
Line 2610... Line 2617...
2610
 
2617
 
2611
		return sb.toString();
2618
		return sb.toString();
2612
	}
2619
	}
2613
 
2620
 
2614
	public void notifyLead() throws Exception {
2621
	public void notifyLead() throws Exception {
2615
		List<Lead> leadsToNotify = leadRepository.selectLeadsScheduledBetweenDate(null, LocalDateTime.now().minusDays(15),
2622
		List<Lead> leadsToNotify = leadRepository.selectLeadsScheduledBetweenDate(null,
2616
				LocalDateTime.now().plusHours(4));
2623
				LocalDateTime.now().minusDays(15), LocalDateTime.now().plusHours(4));
2617
		Map<Integer, String> authUserEmailMap = authRepository.selectAllActiveUser().stream()
2624
		Map<Integer, String> authUserEmailMap = authRepository.selectAllActiveUser().stream()
2618
				.collect(Collectors.toMap(x -> x.getId(), x -> x.getEmailId()));
2625
				.collect(Collectors.toMap(x -> x.getId(), x -> x.getEmailId()));
2619
		LOGGER.info("authUserEmailMap {}", authUserEmailMap);
2626
		LOGGER.info("authUserEmailMap {}", authUserEmailMap);
2620
		Map<String, Integer> dtrEmailMap = dtrUserRepository
2627
		Map<String, Integer> dtrEmailMap = dtrUserRepository
2621
				.selectAllByEmailIds(new ArrayList<>(authUserEmailMap.values())).stream()
2628
				.selectAllByEmailIds(new ArrayList<>(authUserEmailMap.values())).stream()
Line 3015... Line 3022...
3015
 
3022
 
3016
	public void getVendorWarehouses(int warehouseId) {
3023
	public void getVendorWarehouses(int warehouseId) {
3017
		LOGGER.info("Warehouses - {}", warehouseRepository.getVendorWarehouses().get(warehouseId));
3024
		LOGGER.info("Warehouses - {}", warehouseRepository.getVendorWarehouses().get(warehouseId));
3018
 
3025
 
3019
	}
3026
	}
3020
	
3027
 
3021
	public void checkImeiActivation() {
3028
	public void checkImeiActivation() {
3022
		
3029
 
3023
		try {
3030
		try {
3024
			vivoImeiActivationService.checkImeiActivation();
3031
			vivoImeiActivationService.checkImeiActivation();
3025
		} catch (ProfitMandiBusinessException e) {
3032
		} catch (ProfitMandiBusinessException e) {
3026
			// TODO Auto-generated catch block
3033
			// TODO Auto-generated catch block
3027
			e.printStackTrace();
3034
			e.printStackTrace();
Line 3033... Line 3040...
3033
			e.printStackTrace();
3040
			e.printStackTrace();
3034
		}
3041
		}
3035
 
3042
 
3036
	}
3043
	}
3037
	
3044
	
-
 
3045
	
-
 
3046
 
-
 
3047
	public void checkItelImeiActivation(LocalDate date,Integer day) {
-
 
3048
		LOGGER.info("Hello - {}", "hhh");
-
 
3049
 
-
 
3050
		try {
-
 
3051
			itelImeiActivationService.checkItelImeiActivation(date,day);
-
 
3052
		} catch (ProfitMandiBusinessException e) {
-
 
3053
			// TODO Auto-generated catch block
-
 
3054
			e.printStackTrace();
-
 
3055
		} catch (IOException e) {
-
 
3056
			// TODO Auto-generated catch block
-
 
3057
			e.printStackTrace();
-
 
3058
		} catch (Exception e) {
-
 
3059
			// TODO Auto-generated catch block
-
 
3060
			e.printStackTrace();
-
 
3061
		}
-
 
3062
 
-
 
3063
	}
-
 
3064
 
-
 
3065
	public void checkTecnoImeiActivation(LocalDate date,Integer day) {
-
 
3066
		LOGGER.info("Hello - {}", "hhh");
-
 
3067
 
-
 
3068
		try {
-
 
3069
			tecnoImeiActivation.checkTecnoImeiActivation(date,day);
-
 
3070
		} catch (ProfitMandiBusinessException e) {
-
 
3071
			// TODO Auto-generated catch block
-
 
3072
			e.printStackTrace();
-
 
3073
		} catch (IOException e) {
-
 
3074
			// TODO Auto-generated catch block
-
 
3075
			e.printStackTrace();
-
 
3076
		} catch (Exception e) {
-
 
3077
			// TODO Auto-generated catch block
-
 
3078
			e.printStackTrace();
-
 
3079
		}
3038
 
3080
 
-
 
3081
	}
-
 
3082
 
-
 
3083
	
3039
	public void checkCancellationMargin() throws Exception {
3084
	public void checkCancellationMargin() throws Exception {
3040
		LocalDateTime startDate = LocalDate.of(2021, 4, 1).atStartOfDay();
3085
		LocalDateTime startDate = LocalDate.of(2021, 4, 1).atStartOfDay();
3041
		List<FofoOrder> fofoOrders = fofoOrderRepository.selectCancelledBetweenSaleDate(startDate, LocalDateTime.now());
3086
		List<FofoOrder> fofoOrders = fofoOrderRepository.selectCancelledBetweenSaleDate(startDate, LocalDateTime.now());
3042
		LOGGER.info("Total Orders =  {}", fofoOrders.size());
3087
		LOGGER.info("Total Orders =  {}", fofoOrders.size());
3043
		for (FofoOrder fofoOrder : fofoOrders) {
3088
		for (FofoOrder fofoOrder : fofoOrders) {
Line 3090... Line 3135...
3090
			}
3135
			}
3091
		}
3136
		}
3092
 
3137
 
3093
	}
3138
	}
3094
 
3139
 
3095
	
-
 
3096
	 public static String readFileAsString(String file)throws Exception
3140
	public static String readFileAsString(String file) throws Exception {
3097
     {
-
 
3098
       String data = "";
3141
		String data = "";
3099
       data = new String(Files.readAllBytes(Paths.get(file)));
3142
		data = new String(Files.readAllBytes(Paths.get(file)));
3100
       return data;
3143
		return data;
3101
     }
3144
	}
3102
 
3145
 
3103
	public void markDelhiveryOrderDelivered() throws ProfitMandiBusinessException, IOException {
3146
	public void markDelhiveryOrderDelivered() throws ProfitMandiBusinessException, IOException {
3104
		List<Order> orders = orderRepository.selectOrderByProviderIdAndStatus(ProfitMandiConstants.DELHIVERY_PROVIDERID,
3147
		List<Order> orders = orderRepository.selectOrderByProviderIdAndStatus(ProfitMandiConstants.DELHIVERY_PROVIDERID,
3105
				OrderStatus.SHIPPED_FROM_WH);
3148
				OrderStatus.SHIPPED_FROM_WH);
3106
 
3149