Subversion Repositories SmartDukaan

Rev

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

Rev 29443 Rev 29451
Line 1... Line 1...
1
package com.smartdukaan.cron.scheduled;
1
package com.smartdukaan.cron.scheduled;
2
 
2
 
-
 
3
import java.io.BufferedInputStream;
-
 
4
import java.io.BufferedReader;
-
 
5
import java.io.DataInputStream;
-
 
6
import java.io.File;
-
 
7
import java.io.FileInputStream;
-
 
8
import java.io.FileOutputStream;
3
import java.io.IOException;
9
import java.io.IOException;
-
 
10
import java.io.InputStream;
-
 
11
import java.io.InputStreamReader;
4
import java.io.Serializable;
12
import java.io.Serializable;
-
 
13
import java.net.CookieManager;
-
 
14
import java.net.CookiePolicy;
-
 
15
import java.nio.charset.StandardCharsets;
-
 
16
import java.nio.file.Files;
-
 
17
import java.nio.file.Paths;
5
import java.sql.Timestamp;
18
import java.sql.Timestamp;
6
import java.time.Duration;
19
import java.time.Duration;
7
import java.time.LocalDate;
20
import java.time.LocalDate;
8
import java.time.LocalDateTime;
21
import java.time.LocalDateTime;
9
import java.time.LocalTime;
22
import java.time.LocalTime;
Line 51... Line 64...
51
import org.springframework.stereotype.Component;
64
import org.springframework.stereotype.Component;
52
import org.springframework.transaction.annotation.Transactional;
65
import org.springframework.transaction.annotation.Transactional;
53
 
66
 
54
import com.google.common.collect.Lists;
67
import com.google.common.collect.Lists;
55
import com.google.gson.Gson;
68
import com.google.gson.Gson;
56
import com.razorpay.Payment;
69
import com.razorpay.Payment; 
-
 
70
 
57
import com.spice.profitmandi.common.enumuration.MessageType;
71
import com.spice.profitmandi.common.enumuration.MessageType;
58
import com.spice.profitmandi.common.enumuration.RechargeStatus;
72
import com.spice.profitmandi.common.enumuration.RechargeStatus;
59
import com.spice.profitmandi.common.enumuration.ReporticoProject;
73
import com.spice.profitmandi.common.enumuration.ReporticoProject;
60
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
74
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
61
import com.spice.profitmandi.common.model.CustomRetailer;
75
import com.spice.profitmandi.common.model.CustomRetailer;
Line 173... Line 187...
173
import com.spice.profitmandi.dao.repository.fofo.ScanRecordRepository;
187
import com.spice.profitmandi.dao.repository.fofo.ScanRecordRepository;
174
import com.spice.profitmandi.dao.repository.fofo.SchemeInOutRepository;
188
import com.spice.profitmandi.dao.repository.fofo.SchemeInOutRepository;
175
import com.spice.profitmandi.dao.repository.inventory.StateRepository;
189
import com.spice.profitmandi.dao.repository.inventory.StateRepository;
176
import com.spice.profitmandi.dao.repository.inventory.WarehouseRepository;
190
import com.spice.profitmandi.dao.repository.inventory.WarehouseRepository;
177
import com.spice.profitmandi.dao.repository.transaction.HdfcPaymentRepository;
191
import com.spice.profitmandi.dao.repository.transaction.HdfcPaymentRepository;
-
 
192
import com.spice.profitmandi.dao.repository.transaction.LineItemRepository;
178
import com.spice.profitmandi.dao.repository.transaction.OrderRepository;
193
import com.spice.profitmandi.dao.repository.transaction.OrderRepository;
179
import com.spice.profitmandi.dao.repository.transaction.PriceDropIMEIRepository;
194
import com.spice.profitmandi.dao.repository.transaction.PriceDropIMEIRepository;
180
import com.spice.profitmandi.dao.repository.transaction.PriceDropRepository;
195
import com.spice.profitmandi.dao.repository.transaction.PriceDropRepository;
181
import com.spice.profitmandi.dao.repository.transaction.UserWalletHistoryRepository;
196
import com.spice.profitmandi.dao.repository.transaction.UserWalletHistoryRepository;
182
import com.spice.profitmandi.dao.repository.transaction.UserWalletRepository;
197
import com.spice.profitmandi.dao.repository.transaction.UserWalletRepository;
Line 197... Line 212...
197
import com.spice.profitmandi.service.user.RetailerService;
212
import com.spice.profitmandi.service.user.RetailerService;
198
import com.spice.profitmandi.service.wallet.WalletService;
213
import com.spice.profitmandi.service.wallet.WalletService;
199
 
214
 
200
import in.shop2020.model.v1.order.OrderStatus;
215
import in.shop2020.model.v1.order.OrderStatus;
201
import in.shop2020.model.v1.order.WalletReferenceType;
216
import in.shop2020.model.v1.order.WalletReferenceType;
-
 
217
import okhttp3.Cookie;
-
 
218
import okhttp3.CookieJar;
-
 
219
import okhttp3.FormBody;
-
 
220
import okhttp3.HttpUrl;
202
import okhttp3.OkHttpClient;
221
import okhttp3.OkHttpClient;
203
import okhttp3.Request;
222
import okhttp3.Request;
-
 
223
import okhttp3.RequestBody;
204
import okhttp3.Response;;
224
import okhttp3.Response;;
205
 
225
 
206
@Component
226
@Component
207
@Transactional(rollbackFor = Throwable.class)
227
@Transactional(rollbackFor = Throwable.class)
208
public class ScheduledTasks {
228
public class ScheduledTasks {
Line 223... Line 243...
223
 
243
 
224
	@Autowired
244
	@Autowired
225
	private EmployeeAttendanceRepository employeeAttendanceRepository;
245
	private EmployeeAttendanceRepository employeeAttendanceRepository;
226
 
246
 
227
	@Autowired
247
	@Autowired
-
 
248
	VivoImeiActivationService vivoImeiActivationService;
-
 
249
	
-
 
250
	@Autowired
228
	private PartnerTypeChangeService partnerTypeChangeService;
251
	private PartnerTypeChangeService partnerTypeChangeService;
229
 
252
 
230
	@Autowired
253
	@Autowired
231
	private ActivatedImeiRepository activatedImeiRepository;
254
	private ActivatedImeiRepository activatedImeiRepository;
232
 
255
 
233
	@Autowired
256
	@Autowired
-
 
257
	private LineItemRepository lineItemRepository;
-
 
258
 
-
 
259
	@Autowired
234
	private LeadRepository leadRepository;
260
	private LeadRepository leadRepository;
235
 
261
 
236
	@Autowired
262
	@Autowired
237
	private AuthRepository authRepository;
263
	private AuthRepository authRepository;
238
 
264
 
Line 2989... Line 3015...
2989
 
3015
 
2990
	public void getVendorWarehouses(int warehouseId) {
3016
	public void getVendorWarehouses(int warehouseId) {
2991
		LOGGER.info("Warehouses - {}", warehouseRepository.getVendorWarehouses().get(warehouseId));
3017
		LOGGER.info("Warehouses - {}", warehouseRepository.getVendorWarehouses().get(warehouseId));
2992
 
3018
 
2993
	}
3019
	}
-
 
3020
	
-
 
3021
	public void checkImeiActivation() {
-
 
3022
		
-
 
3023
		try {
-
 
3024
			vivoImeiActivationService.checkImeiActivation();
-
 
3025
		} catch (ProfitMandiBusinessException e) {
-
 
3026
			// TODO Auto-generated catch block
-
 
3027
			e.printStackTrace();
-
 
3028
		} catch (IOException e) {
-
 
3029
			// TODO Auto-generated catch block
-
 
3030
			e.printStackTrace();
-
 
3031
		} catch (Exception e) {
-
 
3032
			// TODO Auto-generated catch block
-
 
3033
			e.printStackTrace();
-
 
3034
		}
-
 
3035
 
-
 
3036
	}
-
 
3037
	
2994
 
3038
 
2995
	public void checkCancellationMargin() throws Exception {
3039
	public void checkCancellationMargin() throws Exception {
2996
		LocalDateTime startDate = LocalDate.of(2021, 4, 1).atStartOfDay();
3040
		LocalDateTime startDate = LocalDate.of(2021, 4, 1).atStartOfDay();
2997
		List<FofoOrder> fofoOrders = fofoOrderRepository.selectCancelledBetweenSaleDate(startDate, LocalDateTime.now());
3041
		List<FofoOrder> fofoOrders = fofoOrderRepository.selectCancelledBetweenSaleDate(startDate, LocalDateTime.now());
2998
		LOGGER.info("Total Orders =  {}", fofoOrders.size());
3042
		LOGGER.info("Total Orders =  {}", fofoOrders.size());
Line 3046... Line 3090...
3046
			}
3090
			}
3047
		}
3091
		}
3048
 
3092
 
3049
	}
3093
	}
3050
 
3094
 
-
 
3095
	
-
 
3096
	 public static String readFileAsString(String file)throws Exception
-
 
3097
     {
-
 
3098
       String data = "";
-
 
3099
       data = new String(Files.readAllBytes(Paths.get(file)));
-
 
3100
       return data;
-
 
3101
     }
-
 
3102
 
3051
	public void markDelhiveryOrderDelivered() throws ProfitMandiBusinessException, IOException {
3103
	public void markDelhiveryOrderDelivered() throws ProfitMandiBusinessException, IOException {
3052
		List<Order> orders = orderRepository.selectOrderByProviderIdAndStatus(ProfitMandiConstants.DELHIVERY_PROVIDERID,
3104
		List<Order> orders = orderRepository.selectOrderByProviderIdAndStatus(ProfitMandiConstants.DELHIVERY_PROVIDERID,
3053
				OrderStatus.SHIPPED_FROM_WH);
3105
				OrderStatus.SHIPPED_FROM_WH);
3054
 
3106
 
3055
		if (!orders.isEmpty()) {
3107
		if (!orders.isEmpty()) {