Subversion Repositories SmartDukaan

Rev

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

Rev 25580 Rev 25597
Line 44... Line 44...
44
import com.spice.profitmandi.dao.entity.dtr.Retailer;
44
import com.spice.profitmandi.dao.entity.dtr.Retailer;
45
import com.spice.profitmandi.dao.entity.dtr.Role;
45
import com.spice.profitmandi.dao.entity.dtr.Role;
46
import com.spice.profitmandi.dao.entity.dtr.User;
46
import com.spice.profitmandi.dao.entity.dtr.User;
47
import com.spice.profitmandi.dao.entity.dtr.UserAccount;
47
import com.spice.profitmandi.dao.entity.dtr.UserAccount;
48
import com.spice.profitmandi.dao.entity.dtr.UserRole;
48
import com.spice.profitmandi.dao.entity.dtr.UserRole;
49
import com.spice.profitmandi.dao.entity.fofo.PartnerType;
-
 
50
import com.spice.profitmandi.dao.entity.user.Address;
49
import com.spice.profitmandi.dao.entity.user.Address;
51
import com.spice.profitmandi.dao.entity.user.Promoter;
50
import com.spice.profitmandi.dao.entity.user.Promoter;
52
import com.spice.profitmandi.dao.entity.user.Refferal;
51
import com.spice.profitmandi.dao.entity.user.Refferal;
53
import com.spice.profitmandi.dao.enumuration.dtr.RefferalStatus;
52
import com.spice.profitmandi.dao.enumuration.dtr.RefferalStatus;
54
import com.spice.profitmandi.dao.enumuration.dtr.RoleType;
53
import com.spice.profitmandi.dao.enumuration.dtr.RoleType;
Line 59... Line 58...
59
import com.spice.profitmandi.dao.repository.dtr.RetailerRepository;
58
import com.spice.profitmandi.dao.repository.dtr.RetailerRepository;
60
import com.spice.profitmandi.dao.repository.dtr.RoleRepository;
59
import com.spice.profitmandi.dao.repository.dtr.RoleRepository;
61
import com.spice.profitmandi.dao.repository.dtr.UserAccountRepository;
60
import com.spice.profitmandi.dao.repository.dtr.UserAccountRepository;
62
import com.spice.profitmandi.dao.repository.dtr.UserRepository;
61
import com.spice.profitmandi.dao.repository.dtr.UserRepository;
63
import com.spice.profitmandi.dao.repository.dtr.UserRoleRepository;
62
import com.spice.profitmandi.dao.repository.dtr.UserRoleRepository;
64
import com.spice.profitmandi.dao.repository.fofo.PartnerTypeChangeService;
-
 
65
import com.spice.profitmandi.dao.repository.user.AddressRepository;
63
import com.spice.profitmandi.dao.repository.user.AddressRepository;
66
import com.spice.profitmandi.dao.repository.user.PromoterRepository;
64
import com.spice.profitmandi.dao.repository.user.PromoterRepository;
67
import com.spice.profitmandi.service.AuthService;
65
import com.spice.profitmandi.service.AuthService;
68
import com.spice.profitmandi.service.authentication.RoleManager;
66
import com.spice.profitmandi.service.authentication.RoleManager;
69
import com.spice.profitmandi.service.user.RetailerService;
67
import com.spice.profitmandi.service.user.RetailerService;
Line 72... Line 70...
72
import com.spice.profitmandi.web.processor.GoogleLoginProcessor;
70
import com.spice.profitmandi.web.processor.GoogleLoginProcessor;
73
import com.spice.profitmandi.web.req.CreateRefferalRequest;
71
import com.spice.profitmandi.web.req.CreateRefferalRequest;
74
import com.spice.profitmandi.web.req.RefferalEarning;
72
import com.spice.profitmandi.web.req.RefferalEarning;
75
import com.spice.profitmandi.web.req.RefferalEarningModel;
73
import com.spice.profitmandi.web.req.RefferalEarningModel;
76
import com.spice.profitmandi.web.req.UserRequest;
74
import com.spice.profitmandi.web.req.UserRequest;
-
 
75
import com.spice.profitmandi.web.res.MyRechargesResponse;
77
import com.spice.profitmandi.web.res.Partner;
76
import com.spice.profitmandi.web.res.Partner;
78
 
77
 
79
import io.swagger.annotations.ApiImplicitParam;
78
import io.swagger.annotations.ApiImplicitParam;
80
import io.swagger.annotations.ApiImplicitParams;
79
import io.swagger.annotations.ApiImplicitParams;
81
 
80
 
Line 147... Line 146...
147
	private RefferalRepository refferalRepository;
146
	private RefferalRepository refferalRepository;
148
 
147
 
149
	@Autowired
148
	@Autowired
150
	private PromoterRepository promoterRepository;
149
	private PromoterRepository promoterRepository;
151
 
150
 
152
	@Autowired
-
 
153
	private PartnerTypeChangeService partnerTypeChangeService;
-
 
154
 
-
 
155
	@RequestMapping(value = ProfitMandiConstants.URL_USER_GOOGLE_LOGIN, method = RequestMethod.POST)
151
	@RequestMapping(value = ProfitMandiConstants.URL_USER_GOOGLE_LOGIN, method = RequestMethod.POST)
156
	public ResponseEntity<?> googleLogin(HttpServletRequest request, @RequestBody GoogleLoginRequest googleLoginRequest)
152
	public ResponseEntity<?> googleLogin(HttpServletRequest request, @RequestBody GoogleLoginRequest googleLoginRequest)
157
			throws ProfitMandiBusinessException {
153
			throws ProfitMandiBusinessException {
158
		LOGGER.info("requested url : " + request.getRequestURL().toString());
154
		LOGGER.info("requested url : " + request.getRequestURL().toString());
159
		Map<String, Object> resultMap = googleLoginProcessor.process(googleLoginRequest);
155
		Map<String, Object> resultMap = googleLoginProcessor.process(googleLoginRequest);
Line 934... Line 930...
934
			rfm.setMinimumEarning(200000);
930
			rfm.setMinimumEarning(200000);
935
		}
931
		}
936
		return rfm;
932
		return rfm;
937
	}
933
	}
938
 
934
 
939
	@RequestMapping(value = "/user/partnerTarget", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
-
 
940
	@ApiImplicitParams({
-
 
941
			@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header") })
-
 
942
	public ResponseEntity<?> PartnerTarget(HttpServletRequest request) throws Exception {
-
 
943
		int userId = (int) request.getAttribute(ProfitMandiConstants.USER_ID);
-
 
944
		int retailerId = userAccountRepository.selectRetailerIdByUserId(userId);
-
 
945
		PartnerType partnerType = partnerTypeChangeService.getTypeOnDate(retailerId, LocalDate.now());
-
 
946
		
-
 
947
		return responseSender.ok(partnerType);
-
 
948
	}
-
 
949
 
-
 
950
}
935
}