Subversion Repositories SmartDukaan

Rev

Rev 26228 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 26228 Rev 31238
Line 1... Line 1...
1
package com.spice.profitmandi.web.controller;
1
package com.spice.profitmandi.web.controller;
2
 
2
 
3
import java.time.LocalDate;
-
 
4
import java.time.LocalDateTime;
-
 
5
import java.time.temporal.ChronoUnit;
-
 
6
import java.util.ArrayList;
-
 
7
import java.util.Arrays;
-
 
8
import java.util.HashMap;
-
 
9
import java.util.List;
-
 
10
import java.util.Map;
-
 
11
import java.util.stream.Collectors;
-
 
12
 
-
 
13
import javax.servlet.http.HttpServletRequest;
-
 
14
 
-
 
15
import org.apache.logging.log4j.LogManager;
-
 
16
import org.apache.logging.log4j.Logger;
-
 
17
import org.springframework.beans.factory.annotation.Autowired;
-
 
18
import org.springframework.beans.factory.annotation.Value;
-
 
19
import org.springframework.scheduling.annotation.Scheduled;
-
 
20
import org.springframework.stereotype.Controller;
-
 
21
import org.springframework.transaction.annotation.Transactional;
-
 
22
import org.springframework.ui.Model;
-
 
23
import org.springframework.web.bind.annotation.RequestMapping;
-
 
24
import org.springframework.web.bind.annotation.RequestMethod;
-
 
25
 
-
 
26
import com.spice.profitmandi.common.enumuration.RechargeStatus;
3
import com.spice.profitmandi.common.enumuration.RechargeStatus;
27
import com.spice.profitmandi.common.enumuration.SchemeType;
4
import com.spice.profitmandi.common.enumuration.SchemeType;
28
import com.spice.profitmandi.common.model.RechargeCredential;
5
import com.spice.profitmandi.common.model.RechargeCredential;
29
import com.spice.profitmandi.common.web.client.RestClient;
6
import com.spice.profitmandi.common.web.client.RestClient;
30
import com.spice.profitmandi.dao.entity.dtr.DailyRecharge;
7
import com.spice.profitmandi.dao.entity.dtr.DailyRecharge;
Line 41... Line 18...
41
import com.spice.profitmandi.dao.repository.fofo.PurchaseRepository;
18
import com.spice.profitmandi.dao.repository.fofo.PurchaseRepository;
42
import com.spice.profitmandi.service.recharge.provider.OxigenRechargeProviderService;
19
import com.spice.profitmandi.service.recharge.provider.OxigenRechargeProviderService;
43
import com.spice.profitmandi.service.recharge.provider.ThinkWalnutDigitalRechargeProviderService;
20
import com.spice.profitmandi.service.recharge.provider.ThinkWalnutDigitalRechargeProviderService;
44
import com.spice.profitmandi.service.scheme.SchemeService;
21
import com.spice.profitmandi.service.scheme.SchemeService;
45
import com.spice.profitmandi.web.util.MVCResponseSender;
22
import com.spice.profitmandi.web.util.MVCResponseSender;
-
 
23
import org.apache.logging.log4j.LogManager;
-
 
24
import org.apache.logging.log4j.Logger;
-
 
25
import org.springframework.beans.factory.annotation.Autowired;
-
 
26
import org.springframework.beans.factory.annotation.Value;
-
 
27
import org.springframework.stereotype.Controller;
-
 
28
import org.springframework.transaction.annotation.Transactional;
-
 
29
import org.springframework.ui.Model;
-
 
30
import org.springframework.web.bind.annotation.RequestMapping;
-
 
31
import org.springframework.web.bind.annotation.RequestMethod;
-
 
32
 
-
 
33
import javax.servlet.http.HttpServletRequest;
-
 
34
import java.time.LocalDate;
-
 
35
import java.time.LocalDateTime;
-
 
36
import java.time.temporal.ChronoUnit;
-
 
37
import java.util.*;
-
 
38
import java.util.stream.Collectors;
46
 
39
 
47
@Controller
40
@Controller
48
@Transactional(rollbackFor = Throwable.class)
41
@Transactional(rollbackFor = Throwable.class)
49
public class CronController {
42
public class CronController {
50
 
43
 
Line 229... Line 222...
229
				}
222
				}
230
			} catch (Exception e) {
223
			} catch (Exception e) {
231
				LOGGER.info("Could not check status for Request {}", rechargeTransaction.getRequestId());
224
				LOGGER.info("Could not check status for Request {}", rechargeTransaction.getRequestId());
232
			}
225
			}
233
		}
226
		}
234
		model.addAttribute("response", mvcResponseSender.createResponseString(requestRechargeStatusChanged));
227
		model.addAttribute("response1", mvcResponseSender.createResponseString(requestRechargeStatusChanged));
235
		return "response";
228
		return "response";
236
	}
229
	}
237
 
230
 
238
	@RequestMapping(value = "/cron/process-schemes", method = RequestMethod.GET)
231
	@RequestMapping(value = "/cron/process-schemes", method = RequestMethod.GET)
239
	public String createScheme(HttpServletRequest request, Model model) throws Exception {
232
	public String createScheme(HttpServletRequest request, Model model) throws Exception {
Line 256... Line 249...
256
				schemeService.processSchemeOut(fofoOrder.getId(), fofoOrder.getFofoId());
249
				schemeService.processSchemeOut(fofoOrder.getId(), fofoOrder.getFofoId());
257
			} catch (Exception e) {
250
			} catch (Exception e) {
258
				LOGGER.error("Error while processing sale order {} for scheme Out", fofoOrder.getId());
251
				LOGGER.error("Error while processing sale order {} for scheme Out", fofoOrder.getId());
259
			}
252
			}
260
		}
253
		}
261
		model.addAttribute("response", mvcResponseSender.createResponseString(true));
254
		model.addAttribute("response1", mvcResponseSender.createResponseString(true));
262
		return "response";
255
		return "response";
263
	}
256
	}
264
 
257
 
265
}
258
}