| 21248 |
ashik.ali |
1 |
package com.spice.profitmandi.web.controller;
|
|
|
2 |
|
| 25300 |
tejbeer |
3 |
import java.io.IOException;
|
| 25488 |
tejbeer |
4 |
import java.time.LocalDate;
|
| 21248 |
ashik.ali |
5 |
import java.time.LocalDateTime;
|
| 25488 |
tejbeer |
6 |
import java.time.YearMonth;
|
| 26636 |
amit.gupta |
7 |
import java.time.ZoneOffset;
|
| 21855 |
amit.gupta |
8 |
import java.util.ArrayList;
|
| 26644 |
amit.gupta |
9 |
import java.util.Base64;
|
| 21428 |
amit.gupta |
10 |
import java.util.HashMap;
|
| 23786 |
amit.gupta |
11 |
import java.util.HashSet;
|
| 21855 |
amit.gupta |
12 |
import java.util.List;
|
| 21277 |
ashik.ali |
13 |
import java.util.Map;
|
| 23786 |
amit.gupta |
14 |
import java.util.Set;
|
| 25488 |
tejbeer |
15 |
import java.util.stream.Collectors;
|
| 21248 |
ashik.ali |
16 |
|
| 26792 |
tejbeer |
17 |
import javax.mail.internet.InternetAddress;
|
|
|
18 |
import javax.mail.internet.MimeMessage;
|
| 21248 |
ashik.ali |
19 |
import javax.servlet.http.HttpServletRequest;
|
|
|
20 |
|
| 25300 |
tejbeer |
21 |
import org.apache.http.client.ClientProtocolException;
|
| 23786 |
amit.gupta |
22 |
import org.apache.logging.log4j.LogManager;
|
| 23859 |
ashik.ali |
23 |
import org.apache.logging.log4j.Logger;
|
| 21278 |
ashik.ali |
24 |
import org.springframework.beans.factory.annotation.Autowired;
|
| 21414 |
kshitij.so |
25 |
import org.springframework.beans.factory.annotation.Value;
|
| 25366 |
tejbeer |
26 |
import org.springframework.http.MediaType;
|
| 21248 |
ashik.ali |
27 |
import org.springframework.http.ResponseEntity;
|
| 26792 |
tejbeer |
28 |
import org.springframework.mail.javamail.JavaMailSender;
|
|
|
29 |
import org.springframework.mail.javamail.MimeMessageHelper;
|
| 21248 |
ashik.ali |
30 |
import org.springframework.stereotype.Controller;
|
| 21702 |
ashik.ali |
31 |
import org.springframework.transaction.annotation.Transactional;
|
| 26590 |
amit.gupta |
32 |
import org.springframework.web.bind.annotation.PathVariable;
|
| 21366 |
kshitij.so |
33 |
import org.springframework.web.bind.annotation.RequestBody;
|
| 21248 |
ashik.ali |
34 |
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
35 |
import org.springframework.web.bind.annotation.RequestMethod;
|
|
|
36 |
import org.springframework.web.bind.annotation.RequestParam;
|
|
|
37 |
|
| 26636 |
amit.gupta |
38 |
import com.fasterxml.jackson.annotation.JsonProperty;
|
| 26646 |
amit.gupta |
39 |
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
40 |
import com.google.gson.Gson;
|
| 21248 |
ashik.ali |
41 |
import com.spice.profitmandi.common.ResponseCodeHolder;
|
|
|
42 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
| 25366 |
tejbeer |
43 |
import com.spice.profitmandi.common.model.CustomRetailer;
|
| 22930 |
ashik.ali |
44 |
import com.spice.profitmandi.common.model.GoogleLoginRequest;
|
| 21248 |
ashik.ali |
45 |
import com.spice.profitmandi.common.model.ProfitMandiConstants;
|
| 22492 |
amit.gupta |
46 |
import com.spice.profitmandi.common.model.RegisteredUserInfo;
|
| 21469 |
amit.gupta |
47 |
import com.spice.profitmandi.common.model.UserInfo;
|
| 21282 |
ashik.ali |
48 |
import com.spice.profitmandi.common.util.JWTUtil;
|
| 21855 |
amit.gupta |
49 |
import com.spice.profitmandi.common.web.client.RestClient;
|
| 21740 |
ashik.ali |
50 |
import com.spice.profitmandi.common.web.util.ResponseSender;
|
| 25366 |
tejbeer |
51 |
import com.spice.profitmandi.dao.entity.auth.AuthUser;
|
| 26636 |
amit.gupta |
52 |
import com.spice.profitmandi.dao.entity.dtr.MobileAppSetting;
|
| 21735 |
ashik.ali |
53 |
import com.spice.profitmandi.dao.entity.dtr.Retailer;
|
| 23858 |
ashik.ali |
54 |
import com.spice.profitmandi.dao.entity.dtr.Role;
|
| 21735 |
ashik.ali |
55 |
import com.spice.profitmandi.dao.entity.dtr.User;
|
| 25366 |
tejbeer |
56 |
import com.spice.profitmandi.dao.entity.dtr.UserAccount;
|
| 21735 |
ashik.ali |
57 |
import com.spice.profitmandi.dao.entity.dtr.UserRole;
|
| 29011 |
amit.gupta |
58 |
import com.spice.profitmandi.dao.entity.fofo.FofoStore;
|
|
|
59 |
import com.spice.profitmandi.dao.entity.fofo.PartnerOnBoardingPanel;
|
| 25622 |
amit.gupta |
60 |
import com.spice.profitmandi.dao.entity.fofo.PartnerType;
|
| 22355 |
ashik.ali |
61 |
import com.spice.profitmandi.dao.entity.user.Address;
|
| 25458 |
tejbeer |
62 |
import com.spice.profitmandi.dao.entity.user.Promoter;
|
|
|
63 |
import com.spice.profitmandi.dao.entity.user.Refferal;
|
| 25488 |
tejbeer |
64 |
import com.spice.profitmandi.dao.enumuration.dtr.RefferalStatus;
|
| 21735 |
ashik.ali |
65 |
import com.spice.profitmandi.dao.enumuration.dtr.RoleType;
|
| 29011 |
amit.gupta |
66 |
import com.spice.profitmandi.dao.enumuration.dtr.StoreTimeline;
|
| 25979 |
tejbeer |
67 |
import com.spice.profitmandi.dao.model.CreateRefferalRequest;
|
| 25488 |
tejbeer |
68 |
import com.spice.profitmandi.dao.model.DateRangeModel;
|
| 29011 |
amit.gupta |
69 |
import com.spice.profitmandi.dao.model.OnBoardingTimelineModel;
|
| 21643 |
ashik.ali |
70 |
import com.spice.profitmandi.dao.model.UserCart;
|
| 25366 |
tejbeer |
71 |
import com.spice.profitmandi.dao.repository.auth.AuthRepository;
|
| 25619 |
amit.gupta |
72 |
import com.spice.profitmandi.dao.repository.cs.CsService;
|
| 29011 |
amit.gupta |
73 |
import com.spice.profitmandi.dao.repository.dtr.FofoStoreRepository;
|
| 26636 |
amit.gupta |
74 |
import com.spice.profitmandi.dao.repository.dtr.MobileAppSettingsRepository;
|
| 29011 |
amit.gupta |
75 |
import com.spice.profitmandi.dao.repository.dtr.PartnerOnBoardingPanelRepository;
|
| 25458 |
tejbeer |
76 |
import com.spice.profitmandi.dao.repository.dtr.RefferalRepository;
|
| 21735 |
ashik.ali |
77 |
import com.spice.profitmandi.dao.repository.dtr.RetailerRepository;
|
| 23786 |
amit.gupta |
78 |
import com.spice.profitmandi.dao.repository.dtr.RoleRepository;
|
| 21735 |
ashik.ali |
79 |
import com.spice.profitmandi.dao.repository.dtr.UserAccountRepository;
|
|
|
80 |
import com.spice.profitmandi.dao.repository.dtr.UserRepository;
|
|
|
81 |
import com.spice.profitmandi.dao.repository.dtr.UserRoleRepository;
|
| 25622 |
amit.gupta |
82 |
import com.spice.profitmandi.dao.repository.fofo.PartnerTypeChangeService;
|
| 22355 |
ashik.ali |
83 |
import com.spice.profitmandi.dao.repository.user.AddressRepository;
|
| 25458 |
tejbeer |
84 |
import com.spice.profitmandi.dao.repository.user.PromoterRepository;
|
| 24491 |
amit.gupta |
85 |
import com.spice.profitmandi.service.AuthService;
|
| 23798 |
amit.gupta |
86 |
import com.spice.profitmandi.service.authentication.RoleManager;
|
| 25366 |
tejbeer |
87 |
import com.spice.profitmandi.service.user.RetailerService;
|
| 29011 |
amit.gupta |
88 |
import com.spice.profitmandi.service.user.StoreTimelineTatService;
|
| 23787 |
amit.gupta |
89 |
import com.spice.profitmandi.service.user.UserService;
|
| 26870 |
amit.gupta |
90 |
import com.spice.profitmandi.web.controller.checkout.OrderController;
|
| 21469 |
amit.gupta |
91 |
import com.spice.profitmandi.web.enumuration.UserStatus;
|
| 21277 |
ashik.ali |
92 |
import com.spice.profitmandi.web.processor.GoogleLoginProcessor;
|
| 25488 |
tejbeer |
93 |
import com.spice.profitmandi.web.req.RefferalEarning;
|
|
|
94 |
import com.spice.profitmandi.web.req.RefferalEarningModel;
|
| 21366 |
kshitij.so |
95 |
import com.spice.profitmandi.web.req.UserRequest;
|
| 25366 |
tejbeer |
96 |
import com.spice.profitmandi.web.res.Partner;
|
| 21248 |
ashik.ali |
97 |
|
| 21469 |
amit.gupta |
98 |
import io.swagger.annotations.ApiImplicitParam;
|
|
|
99 |
import io.swagger.annotations.ApiImplicitParams;
|
|
|
100 |
|
| 21248 |
ashik.ali |
101 |
/**
|
|
|
102 |
* @author ashikali
|
|
|
103 |
*
|
|
|
104 |
*/
|
|
|
105 |
@Controller
|
| 25366 |
tejbeer |
106 |
@Transactional(rollbackFor = Throwable.class)
|
| 21248 |
ashik.ali |
107 |
public class UserController {
|
| 21469 |
amit.gupta |
108 |
|
| 21448 |
ashik.ali |
109 |
@Autowired
|
| 22930 |
ashik.ali |
110 |
private ResponseSender<?> responseSender;
|
| 21469 |
amit.gupta |
111 |
|
| 23568 |
govind |
112 |
private static final Logger LOGGER = LogManager.getLogger(UserController.class);
|
| 21469 |
amit.gupta |
113 |
|
| 21855 |
amit.gupta |
114 |
@Value("${notifications.api.host}")
|
|
|
115 |
private String nodeHost;
|
| 25366 |
tejbeer |
116 |
|
| 26640 |
amit.gupta |
117 |
@Autowired
|
| 26636 |
amit.gupta |
118 |
private MobileAppSettingsRepository mobileAppSettingsRepository;
|
|
|
119 |
|
| 21855 |
amit.gupta |
120 |
@Value("${notifications.api.port}")
|
|
|
121 |
private int nodePort;
|
|
|
122 |
|
| 21414 |
kshitij.so |
123 |
@Value("${admin.token}")
|
|
|
124 |
private String validAdminToken;
|
| 21469 |
amit.gupta |
125 |
|
| 21278 |
ashik.ali |
126 |
@Autowired
|
| 22873 |
ashik.ali |
127 |
private UserRepository userRepository;
|
| 25366 |
tejbeer |
128 |
|
| 22355 |
ashik.ali |
129 |
@Autowired
|
| 22873 |
ashik.ali |
130 |
private com.spice.profitmandi.dao.repository.user.UserRepository userUserRepository;
|
| 21469 |
amit.gupta |
131 |
|
| 21278 |
ashik.ali |
132 |
@Autowired
|
| 22873 |
ashik.ali |
133 |
private RetailerRepository retailerRepository;
|
| 21485 |
amit.gupta |
134 |
|
|
|
135 |
@Autowired
|
| 22873 |
ashik.ali |
136 |
private UserRoleRepository userRoleRepository;
|
| 21469 |
amit.gupta |
137 |
|
| 21426 |
ashik.ali |
138 |
@Autowired
|
| 25622 |
amit.gupta |
139 |
private PartnerTypeChangeService partnerTypeChangeService;
|
|
|
140 |
|
|
|
141 |
@Autowired
|
| 22873 |
ashik.ali |
142 |
private UserAccountRepository userAccountRepository;
|
| 25366 |
tejbeer |
143 |
|
| 22355 |
ashik.ali |
144 |
@Autowired
|
| 24491 |
amit.gupta |
145 |
private AuthService authService;
|
| 25366 |
tejbeer |
146 |
|
| 24491 |
amit.gupta |
147 |
@Autowired
|
| 22873 |
ashik.ali |
148 |
private AddressRepository addressRepository;
|
| 21469 |
amit.gupta |
149 |
|
| 21426 |
ashik.ali |
150 |
@Autowired
|
| 22873 |
ashik.ali |
151 |
private GoogleLoginProcessor googleLoginProcessor;
|
| 21855 |
amit.gupta |
152 |
|
| 21784 |
amit.gupta |
153 |
@Autowired
|
| 22873 |
ashik.ali |
154 |
private UserService userService;
|
| 25366 |
tejbeer |
155 |
|
| 23786 |
amit.gupta |
156 |
@Autowired
|
| 25619 |
amit.gupta |
157 |
private CsService csService;
|
|
|
158 |
|
|
|
159 |
@Autowired
|
| 23858 |
ashik.ali |
160 |
private RestClient restClient;
|
| 25366 |
tejbeer |
161 |
|
| 23858 |
ashik.ali |
162 |
@Autowired
|
| 23798 |
amit.gupta |
163 |
private RoleManager roleManager;
|
| 25366 |
tejbeer |
164 |
|
| 23786 |
amit.gupta |
165 |
@Autowired
|
|
|
166 |
private RoleRepository roleRepository;
|
| 21469 |
amit.gupta |
167 |
|
| 25366 |
tejbeer |
168 |
@Autowired
|
|
|
169 |
private AuthRepository authRepository;
|
| 26792 |
tejbeer |
170 |
|
| 25366 |
tejbeer |
171 |
@Autowired
|
| 26646 |
amit.gupta |
172 |
private ObjectMapper objectMapper;
|
| 26792 |
tejbeer |
173 |
|
| 26646 |
amit.gupta |
174 |
@Autowired
|
| 25366 |
tejbeer |
175 |
private RetailerService retailerService;
|
|
|
176 |
|
| 25458 |
tejbeer |
177 |
@Autowired
|
|
|
178 |
private RefferalRepository refferalRepository;
|
|
|
179 |
|
|
|
180 |
@Autowired
|
|
|
181 |
private PromoterRepository promoterRepository;
|
|
|
182 |
|
| 26792 |
tejbeer |
183 |
@Autowired
|
|
|
184 |
JavaMailSender mailSender;
|
|
|
185 |
|
| 21469 |
amit.gupta |
186 |
@RequestMapping(value = ProfitMandiConstants.URL_USER_GOOGLE_LOGIN, method = RequestMethod.POST)
|
| 25366 |
tejbeer |
187 |
public ResponseEntity<?> googleLogin(HttpServletRequest request, @RequestBody GoogleLoginRequest googleLoginRequest)
|
|
|
188 |
throws ProfitMandiBusinessException {
|
| 26396 |
amit.gupta |
189 |
return responseSender.ok(googleLoginProcessor.process(googleLoginRequest.getToken()));
|
| 21277 |
ashik.ali |
190 |
}
|
| 26636 |
amit.gupta |
191 |
|
| 26592 |
amit.gupta |
192 |
@RequestMapping(value = "/store/token/{storeCode}", method = RequestMethod.GET)
|
| 26590 |
amit.gupta |
193 |
public ResponseEntity<?> googleLogin(HttpServletRequest request, @PathVariable String storeCode)
|
|
|
194 |
throws ProfitMandiBusinessException {
|
| 26597 |
amit.gupta |
195 |
LOGGER.info("StoreCode {}", storeCode);
|
| 26590 |
amit.gupta |
196 |
return responseSender.ok(googleLoginProcessor.processStore(storeCode));
|
|
|
197 |
}
|
| 21469 |
amit.gupta |
198 |
|
|
|
199 |
@RequestMapping(value = ProfitMandiConstants.URL_USER_TOKEN_IS_EXPIRED, method = RequestMethod.GET)
|
| 25366 |
tejbeer |
200 |
public ResponseEntity<?> tokenIsExpired(HttpServletRequest request, @RequestParam(name = "token") String token)
|
|
|
201 |
throws ProfitMandiBusinessException {
|
| 21469 |
amit.gupta |
202 |
LOGGER.info("requested url : " + request.getRequestURL().toString());
|
| 22930 |
ashik.ali |
203 |
return responseSender.ok(JWTUtil.isExpired(token));
|
| 21282 |
ashik.ali |
204 |
}
|
| 21469 |
amit.gupta |
205 |
|
| 22355 |
ashik.ali |
206 |
@RequestMapping(value = ProfitMandiConstants.URL_USER_DETAIL_BY_TOKEN, method = RequestMethod.GET)
|
| 21469 |
amit.gupta |
207 |
@ApiImplicitParams({
|
|
|
208 |
@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header") })
|
|
|
209 |
public ResponseEntity<?> tokenInfo(HttpServletRequest request) throws Throwable {
|
|
|
210 |
Map<String, Object> responseMap = new HashMap<>();
|
|
|
211 |
UserInfo userInfo = (UserInfo) request.getAttribute("userInfo");
|
| 21483 |
amit.gupta |
212 |
User user = null;
|
| 21855 |
amit.gupta |
213 |
if (userInfo.getUserId() > -1) {
|
| 21483 |
amit.gupta |
214 |
user = userRepository.selectById(userInfo.getUserId());
|
| 26636 |
amit.gupta |
215 |
|
| 26533 |
amit.gupta |
216 |
String city = user.getCity();
|
| 25366 |
tejbeer |
217 |
if (!(userInfo.getEmail() == null || user.getEmailId().equalsIgnoreCase(userInfo.getEmail()))) {
|
| 24491 |
amit.gupta |
218 |
String userName = null;
|
| 25366 |
tejbeer |
219 |
if (user.getSecondryEmailId() != null && user.getSecondryEmailId().equals(userInfo.getEmail())) {
|
| 24491 |
amit.gupta |
220 |
userName = user.getFirstName() + " " + user.getLastName();
|
|
|
221 |
} else {
|
| 28021 |
amit.gupta |
222 |
AuthUser authUser = authRepository.selectByGmailId(userInfo.getEmail());
|
|
|
223 |
if(authUser==null || !authUser.isActive()) {
|
|
|
224 |
responseMap.put(ProfitMandiConstants.USER_STATUS, UserStatus.NOT_REGISTERED.getValue());
|
|
|
225 |
responseMap.put(ProfitMandiConstants.EMAIL_ID, userInfo.getEmail());
|
|
|
226 |
return responseSender.ok(responseMap);
|
|
|
227 |
}
|
|
|
228 |
userName = authUser.getName();
|
| 24491 |
amit.gupta |
229 |
}
|
|
|
230 |
responseMap.put(ProfitMandiConstants.USER_ID, userInfo.getUserId());
|
|
|
231 |
responseMap.put(ProfitMandiConstants.USER_NAME, userName);
|
|
|
232 |
responseMap.put(ProfitMandiConstants.USER_STATUS, "fofoAssociate");
|
|
|
233 |
responseMap.put(ProfitMandiConstants.EMAIL_ID, userInfo.getEmail());
|
| 26570 |
amit.gupta |
234 |
responseMap.put("storeUrl", "");
|
| 24491 |
amit.gupta |
235 |
return responseSender.ok(responseMap);
|
|
|
236 |
}
|
| 21483 |
amit.gupta |
237 |
} else {
|
|
|
238 |
try {
|
|
|
239 |
user = userRepository.selectByEmailId(userInfo.getEmail());
|
|
|
240 |
} catch (ProfitMandiBusinessException e1) {
|
|
|
241 |
}
|
| 25366 |
tejbeer |
242 |
if (user == null) {
|
| 23204 |
ashik.ali |
243 |
try {
|
|
|
244 |
user = userRepository.selectBySecondryEmailId(userInfo.getEmail());
|
|
|
245 |
} catch (ProfitMandiBusinessException e1) {
|
|
|
246 |
LOGGER.info("Uneregistered user", userInfo.getEmail());
|
|
|
247 |
}
|
|
|
248 |
}
|
| 21483 |
amit.gupta |
249 |
}
|
|
|
250 |
if (user != null) {
|
| 23858 |
ashik.ali |
251 |
int retailerId = userAccountRepository.selectRetailerIdByUserId(user.getId());
|
| 21491 |
amit.gupta |
252 |
responseMap.put(ProfitMandiConstants.EMAIL_ID, user.getEmailId());
|
| 21526 |
amit.gupta |
253 |
responseMap.put(ProfitMandiConstants.USER_ID, user.getId());
|
| 22017 |
amit.gupta |
254 |
responseMap.put(ProfitMandiConstants.USER_NAME, user.getFirstName() + " " + user.getLastName());
|
| 23786 |
amit.gupta |
255 |
List<Integer> roleIds = userRoleRepository.selectRoleIdsByUserId(user.getId());
|
| 25366 |
tejbeer |
256 |
// LOGGER.info("userRoles {} ", userRoles);
|
| 22032 |
ashik.ali |
257 |
|
|
|
258 |
// generate new token if roles have been updated
|
| 23786 |
amit.gupta |
259 |
if (userInfo.getRoleIds() == null || roleIds.size() != userInfo.getRoleIds().size()) {
|
| 23858 |
ashik.ali |
260 |
String[] roleIdStrings = new String[roleIds.size()];
|
| 22603 |
amit.gupta |
261 |
int index = 0;
|
| 23786 |
amit.gupta |
262 |
for (int roleId : roleIds) {
|
| 23858 |
ashik.ali |
263 |
roleIdStrings[index++] = String.valueOf(roleId);
|
| 22603 |
amit.gupta |
264 |
}
|
| 23858 |
ashik.ali |
265 |
String newToken = JWTUtil.create(user.getId(), retailerId, roleIdStrings);
|
| 21483 |
amit.gupta |
266 |
responseMap.put("newAuthToken", newToken);
|
|
|
267 |
}
|
| 23858 |
ashik.ali |
268 |
// if user is retailer
|
| 23786 |
amit.gupta |
269 |
Set<Integer> roleIdsSet = new HashSet<Integer>(roleIds);
|
| 23858 |
ashik.ali |
270 |
if (roleManager.isRetailer(roleIdsSet)) {
|
| 22032 |
ashik.ali |
271 |
UserCart uc = userAccountRepository.getUserCart(userInfo.getUserId());
|
|
|
272 |
Retailer retailer = retailerRepository.selectById(uc.getUserId());
|
| 22370 |
amit.gupta |
273 |
com.spice.profitmandi.dao.entity.user.User saholicUser = userUserRepository.selectById(uc.getUserId());
|
| 25366 |
tejbeer |
274 |
if (saholicUser.getAddressId() != null) {
|
| 22370 |
amit.gupta |
275 |
Address address = addressRepository.selectById(saholicUser.getAddressId());
|
|
|
276 |
responseMap.put(ProfitMandiConstants.ADDRESS, address);
|
|
|
277 |
}
|
| 21485 |
amit.gupta |
278 |
// if retailer is activated 1 then verified retailer
|
|
|
279 |
// else if migrated is 1 then old retailer
|
| 25366 |
tejbeer |
280 |
// also lets incoporte old process i.e is user is activated then also retailer
|
|
|
281 |
// is verified retailer
|
| 21485 |
amit.gupta |
282 |
// else retailer is not verifed
|
| 22497 |
amit.gupta |
283 |
if (retailer.isActive() || user.isActivated()) {
|
| 23798 |
amit.gupta |
284 |
if (roleManager.isPartner(roleIdsSet)) {
|
| 22017 |
amit.gupta |
285 |
responseMap.put(ProfitMandiConstants.USER_STATUS, UserStatus.FOFO.getValue());
|
| 26533 |
amit.gupta |
286 |
responseMap.put("storeUrl", retailerService.getAllFofoRetailerIdUrlMap().get(uc.getUserId()));
|
| 29011 |
amit.gupta |
287 |
responseMap.put("timelineStatus", this.getTimeLineStatus(uc.getUserId()));
|
| 22017 |
amit.gupta |
288 |
} else {
|
|
|
289 |
responseMap.put(ProfitMandiConstants.USER_STATUS, UserStatus.VERIFIED_RETAILER.getValue());
|
|
|
290 |
}
|
| 22032 |
ashik.ali |
291 |
} else if (retailer.isMigrated()) {
|
| 21485 |
amit.gupta |
292 |
responseMap.put(ProfitMandiConstants.USER_STATUS, UserStatus.RETAILER.getValue());
|
| 21469 |
amit.gupta |
293 |
} else {
|
| 21485 |
amit.gupta |
294 |
responseMap.put(ProfitMandiConstants.USER_STATUS, UserStatus.NOT_VERIFIED_RETAILER.getValue());
|
| 21469 |
amit.gupta |
295 |
}
|
| 23798 |
amit.gupta |
296 |
} else if (roleManager.isUser(roleIdsSet)) {
|
| 22502 |
amit.gupta |
297 |
responseMap.put("userInfo", getRegisteredUserInfo(user));
|
| 21469 |
amit.gupta |
298 |
responseMap.put(ProfitMandiConstants.USER_STATUS, UserStatus.REGISTERED.getValue());
|
| 22032 |
ashik.ali |
299 |
}
|
| 21491 |
amit.gupta |
300 |
} else {
|
|
|
301 |
responseMap.put(ProfitMandiConstants.USER_STATUS, UserStatus.NOT_REGISTERED.getValue());
|
|
|
302 |
responseMap.put(ProfitMandiConstants.EMAIL_ID, userInfo.getEmail());
|
| 21469 |
amit.gupta |
303 |
}
|
| 22032 |
ashik.ali |
304 |
|
| 21469 |
amit.gupta |
305 |
return responseSender.ok(responseMap);
|
|
|
306 |
}
|
| 25366 |
tejbeer |
307 |
|
| 29011 |
amit.gupta |
308 |
@Autowired
|
|
|
309 |
FofoStoreRepository fofoStoreRepository;
|
|
|
310 |
@Autowired
|
|
|
311 |
PartnerOnBoardingPanelRepository partnerOnBoardingPanelRepository;
|
|
|
312 |
@Autowired
|
|
|
313 |
StoreTimelineTatService storeTimelineTatService;
|
|
|
314 |
private boolean getTimeLineStatus(int fofoId) throws ProfitMandiBusinessException {
|
|
|
315 |
FofoStore fs = fofoStoreRepository.selectByRetailerId(fofoId);
|
|
|
316 |
PartnerOnBoardingPanel partnerOnBoardingPanel = partnerOnBoardingPanelRepository.selectByCode(fs.getCode());
|
|
|
317 |
boolean status = true;
|
|
|
318 |
if (partnerOnBoardingPanel != null) {
|
|
|
319 |
|
|
|
320 |
status = storeTimelineTatService.getTimelineCompleted(partnerOnBoardingPanel.getId());
|
|
|
321 |
}
|
|
|
322 |
|
|
|
323 |
LOGGER.info("status" + status);
|
|
|
324 |
return status;
|
|
|
325 |
}
|
|
|
326 |
|
| 22502 |
amit.gupta |
327 |
private RegisteredUserInfo getRegisteredUserInfo(User user) throws Throwable {
|
| 22492 |
amit.gupta |
328 |
RegisteredUserInfo ri = new RegisteredUserInfo();
|
|
|
329 |
ri.setCity(user.getCity());
|
|
|
330 |
ri.setFirstName(user.getFirstName());
|
|
|
331 |
ri.setLastName(user.getLastName());
|
| 22493 |
amit.gupta |
332 |
ri.setPhone(user.getMobileNumber());
|
| 22492 |
amit.gupta |
333 |
ri.setPinCode(user.getPinCode());
|
| 22845 |
amit.gupta |
334 |
ri.setState(user.getState());
|
| 22492 |
amit.gupta |
335 |
return ri;
|
|
|
336 |
}
|
| 21469 |
amit.gupta |
337 |
|
|
|
338 |
@RequestMapping(value = ProfitMandiConstants.URL_USER, method = RequestMethod.POST)
|
| 21501 |
amit.gupta |
339 |
@ApiImplicitParams({
|
| 22032 |
ashik.ali |
340 |
@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header") })
|
|
|
341 |
public ResponseEntity<?> createUser(HttpServletRequest request, @RequestBody UserRequest userRequest)
|
| 22930 |
ashik.ali |
342 |
throws ProfitMandiBusinessException {
|
| 21469 |
amit.gupta |
343 |
LOGGER.info("requested url : " + request.getRequestURL().toString());
|
| 21368 |
kshitij.so |
344 |
User user = new User();
|
|
|
345 |
user.setFirstName(userRequest.getFirstName());
|
|
|
346 |
user.setLastName(userRequest.getLastName());
|
|
|
347 |
user.setCity(userRequest.getCity());
|
|
|
348 |
user.setPinCode(Integer.valueOf(userRequest.getPinCode()));
|
| 22845 |
amit.gupta |
349 |
user.setState(userRequest.getState());
|
| 21708 |
amit.gupta |
350 |
user.setMobileNumber(userRequest.getMobieNumber());
|
| 21368 |
kshitij.so |
351 |
user.setEmailId(userRequest.getEmailId());
|
|
|
352 |
user.setUsername("");
|
|
|
353 |
user.setPassword("");
|
|
|
354 |
user.setMobile_verified(false);
|
|
|
355 |
user.setReferral_url("");
|
|
|
356 |
user.setGroup_id(1);
|
| 22504 |
amit.gupta |
357 |
user.setStatus(1);
|
| 21368 |
kshitij.so |
358 |
user.setActivated(false);
|
| 21501 |
amit.gupta |
359 |
user.setCreateTimestamp(LocalDateTime.now());
|
|
|
360 |
user.setUpdateTimestamp(LocalDateTime.now());
|
| 22930 |
ashik.ali |
361 |
userRepository.persist(user);
|
| 23858 |
ashik.ali |
362 |
Role role = roleRepository.selectByName(RoleType.USER.toString());
|
| 22930 |
ashik.ali |
363 |
UserRole userRole = new UserRole();
|
| 23858 |
ashik.ali |
364 |
userRole.setRoleId(role.getId());
|
| 22930 |
ashik.ali |
365 |
userRole.setUserId(user.getId());
|
|
|
366 |
userRoleRepository.persist(userRole);
|
|
|
367 |
return responseSender.ok(ResponseCodeHolder.getMessage("USR_OK_1000"));
|
| 25366 |
tejbeer |
368 |
|
| 21278 |
ashik.ali |
369 |
}
|
| 21469 |
amit.gupta |
370 |
|
|
|
371 |
@RequestMapping(value = ProfitMandiConstants.URL_USER_ID, method = RequestMethod.GET)
|
| 25366 |
tejbeer |
372 |
public ResponseEntity<?> getById(HttpServletRequest request, @RequestParam(name = "id") int id)
|
|
|
373 |
throws ProfitMandiBusinessException {
|
| 21469 |
amit.gupta |
374 |
LOGGER.info("requested url : " + request.getRequestURL().toString());
|
| 22930 |
ashik.ali |
375 |
return responseSender.ok(userRepository.selectById(id));
|
| 21248 |
ashik.ali |
376 |
}
|
| 21469 |
amit.gupta |
377 |
|
|
|
378 |
@RequestMapping(value = ProfitMandiConstants.URL_USER_MOBILE_NUMBER, method = RequestMethod.GET)
|
|
|
379 |
public ResponseEntity<?> getByMobileNumber(HttpServletRequest request,
|
| 25366 |
tejbeer |
380 |
@RequestParam(name = "mobileNumber") String mobileNumber) throws ProfitMandiBusinessException {
|
| 21469 |
amit.gupta |
381 |
LOGGER.info("requested url : " + request.getRequestURL().toString());
|
| 22930 |
ashik.ali |
382 |
return responseSender.ok(userRepository.selectByMobileNumber(mobileNumber));
|
| 21248 |
ashik.ali |
383 |
}
|
| 21469 |
amit.gupta |
384 |
|
| 21784 |
amit.gupta |
385 |
@ApiImplicitParams({
|
| 21501 |
amit.gupta |
386 |
@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header") })
|
|
|
387 |
@RequestMapping(value = ProfitMandiConstants.URL_USER_ACTIVATE, method = RequestMethod.POST)
|
|
|
388 |
public ResponseEntity<?> activateUser(HttpServletRequest request,
|
| 21784 |
amit.gupta |
389 |
@RequestParam(name = "activationCode") String activationCode) throws Throwable {
|
| 21855 |
amit.gupta |
390 |
int userId = (int) request.getAttribute("userId");
|
| 21784 |
amit.gupta |
391 |
UserCart uc = userAccountRepository.getUserCart(userId);
|
|
|
392 |
return responseSender.ok(userService.updateActivation(userId, uc.getUserId(), activationCode));
|
|
|
393 |
}
|
| 21855 |
amit.gupta |
394 |
|
| 25458 |
tejbeer |
395 |
/*
|
|
|
396 |
* @ApiImplicitParams({
|
|
|
397 |
*
|
|
|
398 |
* @ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true,
|
|
|
399 |
* dataType = "string", paramType = "header") })
|
|
|
400 |
*
|
|
|
401 |
* @RequestMapping(value = ProfitMandiConstants.URL_USER_NOTIFICATIONS, method =
|
|
|
402 |
* RequestMethod.GET) public ResponseEntity<?>
|
|
|
403 |
* getNofitications(HttpServletRequest request,
|
|
|
404 |
*
|
|
|
405 |
* @RequestParam(name = "androidId") String androidId, @RequestParam(name =
|
|
|
406 |
* "pageNumber") int pageNumber,
|
|
|
407 |
*
|
|
|
408 |
* @RequestParam(name = "pageSize") int pageSize) throws
|
|
|
409 |
* ProfitMandiBusinessException { int userId = (int)
|
|
|
410 |
* request.getAttribute("userId"); String restResponse = null; Map<String,
|
|
|
411 |
* String> params = new HashMap<>();
|
|
|
412 |
*
|
|
|
413 |
* String uri = "/getAllNotifications"; params.put("user_id", userId + "");
|
|
|
414 |
* params.put("android_id", androidId); params.put("limit", pageSize + "");
|
|
|
415 |
* params.put("offset", "" + ((pageNumber - 1) * pageSize)); try { restResponse
|
|
|
416 |
* = restClient.get(SchemeType.HTTP, nodeHost, nodePort, uri, params); } catch
|
|
|
417 |
* (HttpHostConnectException e) { throw new ProfitMandiBusinessException("", "",
|
|
|
418 |
* "Could not Connect to host"); }
|
|
|
419 |
*
|
|
|
420 |
* JsonArray result_json = Json.parse(restResponse).asArray();
|
|
|
421 |
*
|
|
|
422 |
* List<Notification> notifications = new ArrayList<>();
|
|
|
423 |
*
|
|
|
424 |
* for (JsonValue j : result_json) {
|
|
|
425 |
* notifications.add(toNotifiaction(j.asObject())); }
|
|
|
426 |
*
|
|
|
427 |
* return responseSender.ok(notifications); }
|
|
|
428 |
*
|
|
|
429 |
* private Notification toNotifiaction(JsonObject jsonObject) { Notification n =
|
|
|
430 |
* (Notification) (new Gson().fromJson(jsonObject.toString(),
|
|
|
431 |
* Notification.class)); if (n.getStatus().equals("opened") ||
|
|
|
432 |
* n.getStatus().equals("referrer") || n.getStatus().equals("seen")) {
|
|
|
433 |
* n.setSeen(true); } return n; }
|
|
|
434 |
*/
|
| 21855 |
amit.gupta |
435 |
|
| 21426 |
ashik.ali |
436 |
@RequestMapping(value = ProfitMandiConstants.URL_USER_IS_EXIST_MOBILE_NUMBER, method = RequestMethod.GET)
|
| 21469 |
amit.gupta |
437 |
public ResponseEntity<?> isMobileNumberExist(HttpServletRequest request,
|
|
|
438 |
@RequestParam(name = "mobileNumber") String mobileNumber) {
|
|
|
439 |
LOGGER.info("requested url : " + request.getRequestURL().toString());
|
| 21448 |
ashik.ali |
440 |
return responseSender.ok(userRepository.isExistByMobileNumber(mobileNumber));
|
| 21426 |
ashik.ali |
441 |
}
|
| 21469 |
amit.gupta |
442 |
|
|
|
443 |
@RequestMapping(value = ProfitMandiConstants.URL_USER_EMAIL_ID, method = RequestMethod.GET)
|
| 25366 |
tejbeer |
444 |
public ResponseEntity<?> getByEmailId(HttpServletRequest request, @RequestParam(name = "emailId") String emailId)
|
|
|
445 |
throws ProfitMandiBusinessException {
|
| 21469 |
amit.gupta |
446 |
LOGGER.info("requested url : " + request.getRequestURL().toString());
|
| 23204 |
ashik.ali |
447 |
User user = null;
|
| 25366 |
tejbeer |
448 |
try {
|
| 23204 |
ashik.ali |
449 |
user = userRepository.selectByEmailId(emailId);
|
| 25366 |
tejbeer |
450 |
} catch (ProfitMandiBusinessException profitMandiBusinessException) {
|
| 23204 |
ashik.ali |
451 |
user = userRepository.selectBySecondryEmailId(emailId);
|
|
|
452 |
}
|
|
|
453 |
return responseSender.ok(user);
|
| 21248 |
ashik.ali |
454 |
}
|
| 21469 |
amit.gupta |
455 |
|
|
|
456 |
@RequestMapping(value = ProfitMandiConstants.URL_USER_ROLE_ALL, method = RequestMethod.GET)
|
|
|
457 |
public ResponseEntity<?> getAllRoles(HttpServletRequest request, @RequestParam(name = "id") int id) {
|
|
|
458 |
LOGGER.info("requested url : " + request.getRequestURL().toString());
|
| 21448 |
ashik.ali |
459 |
return responseSender.ok(userRoleRepository.selectRolesByUserId(id));
|
| 21248 |
ashik.ali |
460 |
}
|
| 25366 |
tejbeer |
461 |
|
| 23204 |
ashik.ali |
462 |
@ApiImplicitParams({
|
| 25366 |
tejbeer |
463 |
@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header") })
|
| 23204 |
ashik.ali |
464 |
@RequestMapping(value = ProfitMandiConstants.URL_USER_SECONDRY_EMAIL_ID_AND_FOFO_STORE_CODE, method = RequestMethod.GET)
|
| 25366 |
tejbeer |
465 |
public ResponseEntity<?> getSecondryEmailAndStoreCode(HttpServletRequest request)
|
|
|
466 |
throws ProfitMandiBusinessException {
|
| 23204 |
ashik.ali |
467 |
LOGGER.info("requested url : " + request.getRequestURL().toString());
|
|
|
468 |
int userId = (int) request.getAttribute(ProfitMandiConstants.USER_ID);
|
|
|
469 |
return responseSender.ok(userService.getEmailsAndFofoStoreCodeByUserId(userId));
|
|
|
470 |
}
|
| 25366 |
tejbeer |
471 |
|
| 23204 |
ashik.ali |
472 |
@ApiImplicitParams({
|
| 25366 |
tejbeer |
473 |
@ApiImplicitParam(name = "Auth-Token", value = "-Token", required = true, dataType = "string", paramType = "header") })
|
| 23858 |
ashik.ali |
474 |
@RequestMapping(value = ProfitMandiConstants.URL_USER_SECONDRY_EMAIL_ID, method = RequestMethod.PUT)
|
| 23204 |
ashik.ali |
475 |
public ResponseEntity<?> updateSecondryEmailId(HttpServletRequest request,
|
| 25366 |
tejbeer |
476 |
@RequestParam(name = ProfitMandiConstants.SECONDRY_EMAIL_ID) String secondryEmailId) throws Throwable {
|
|
|
477 |
int userId = (int) request.getAttribute("userId");
|
|
|
478 |
User user = userRepository.selectById(userId);
|
|
|
479 |
user.setSecondryEmailId(secondryEmailId);
|
|
|
480 |
userRepository.persist(user);
|
|
|
481 |
return responseSender.ok(ResponseCodeHolder.getMessage("USR_OK_1001"));
|
|
|
482 |
}
|
| 21414 |
kshitij.so |
483 |
|
|
|
484 |
@RequestMapping(value = ProfitMandiConstants.URL_ADMIN_TOKEN, method = RequestMethod.POST)
|
| 21469 |
amit.gupta |
485 |
public ResponseEntity<?> getAdminToken(HttpServletRequest request,
|
|
|
486 |
@RequestParam(name = "adminToken") String adminToken, @RequestParam(name = "emailId") String emailId) {
|
|
|
487 |
LOGGER.info("requested url : " + request.getRequestURL().toString());
|
|
|
488 |
if (!adminToken.equals(validAdminToken)) {
|
| 22930 |
ashik.ali |
489 |
return responseSender.forbidden(null);
|
| 21414 |
kshitij.so |
490 |
}
|
| 21469 |
amit.gupta |
491 |
|
| 21414 |
kshitij.so |
492 |
Map<String, Object> responseMap = new HashMap<>(2);
|
| 23204 |
ashik.ali |
493 |
User user = null;
|
| 21469 |
amit.gupta |
494 |
try {
|
| 23204 |
ashik.ali |
495 |
user = userRepository.selectByEmailId(emailId);
|
|
|
496 |
} catch (ProfitMandiBusinessException profitMandiBusinessException) {
|
| 25366 |
tejbeer |
497 |
|
| 23204 |
ashik.ali |
498 |
}
|
| 25366 |
tejbeer |
499 |
|
|
|
500 |
if (user == null) {
|
|
|
501 |
try {
|
| 23204 |
ashik.ali |
502 |
user = userRepository.selectBySecondryEmailId(emailId);
|
| 25366 |
tejbeer |
503 |
} catch (ProfitMandiBusinessException profitMandiBusinessException) {
|
|
|
504 |
|
| 23204 |
ashik.ali |
505 |
}
|
|
|
506 |
}
|
| 25366 |
tejbeer |
507 |
if (user != null) {
|
| 23858 |
ashik.ali |
508 |
int retailerId = 0;
|
|
|
509 |
try {
|
|
|
510 |
retailerId = userAccountRepository.selectRetailerIdByUserId(user.getId());
|
|
|
511 |
} catch (ProfitMandiBusinessException e) {
|
|
|
512 |
// TODO Auto-generated catch block
|
|
|
513 |
e.printStackTrace();
|
|
|
514 |
}
|
|
|
515 |
List<Integer> roleIds = userRoleRepository.selectRoleIdsByUserId(user.getId());
|
|
|
516 |
String[] roleIdsString = new String[roleIds.size()];
|
| 21414 |
kshitij.so |
517 |
int index = 0;
|
| 23858 |
ashik.ali |
518 |
for (int roleId : roleIds) {
|
|
|
519 |
roleIdsString[index++] = String.valueOf(roleId);
|
| 21414 |
kshitij.so |
520 |
}
|
| 23858 |
ashik.ali |
521 |
responseMap.put(ProfitMandiConstants.TOKEN, JWTUtil.create(user.getId(), retailerId, roleIdsString));
|
| 21414 |
kshitij.so |
522 |
responseMap.put(ProfitMandiConstants.REGISTERED, true);
|
| 25366 |
tejbeer |
523 |
} else {
|
| 21469 |
amit.gupta |
524 |
responseMap.put(ProfitMandiConstants.TOKEN, JWTUtil.create(emailId));
|
| 21414 |
kshitij.so |
525 |
responseMap.put(ProfitMandiConstants.REGISTERED, false);
|
|
|
526 |
}
|
| 21448 |
ashik.ali |
527 |
return responseSender.ok(responseMap);
|
| 21469 |
amit.gupta |
528 |
|
| 21414 |
kshitij.so |
529 |
}
|
| 25366 |
tejbeer |
530 |
|
| 26667 |
amit.gupta |
531 |
@RequestMapping(value = "/mobileappsettings")
|
| 25366 |
tejbeer |
532 |
public ResponseEntity<?> mobileAppSettings(HttpServletRequest request, @RequestParam(name = "t") int timestamp,
|
|
|
533 |
@RequestParam(name = "imeinumber") String imeinumber)
|
|
|
534 |
throws ProfitMandiBusinessException, ClientProtocolException, IOException {
|
| 26644 |
amit.gupta |
535 |
|
|
|
536 |
final String uri = "http://192.168.158.89/mobileappsettings?t=" + timestamp + "&imeinumber=" + imeinumber;
|
|
|
537 |
final String BASIC_AUTH = "Basic " + Base64.getEncoder().encodeToString("dtr:dtr18Feb2015".getBytes());
|
|
|
538 |
Map<String, String> headers = new HashMap<>();
|
|
|
539 |
Map<String, String> params = new HashMap<>();
|
|
|
540 |
headers.put("Authorization", BASIC_AUTH);
|
| 26870 |
amit.gupta |
541 |
if(timestamp==0) {
|
|
|
542 |
return responseSender.ok(OrderController.APP_SETTINGS);
|
|
|
543 |
} else {
|
|
|
544 |
return responseSender.ok(OrderController.APP_SETTINGS_BLANK);
|
|
|
545 |
}
|
| 25300 |
tejbeer |
546 |
}
|
| 26792 |
tejbeer |
547 |
|
| 26645 |
amit.gupta |
548 |
@RequestMapping(value = "/mobileappsettings1", method = RequestMethod.POST)
|
|
|
549 |
public ResponseEntity<?> mobileAppSettings1(HttpServletRequest request, @RequestParam(name = "t") int timestamp,
|
|
|
550 |
@RequestParam(name = "imeinumber") String imeinumber)
|
| 26792 |
tejbeer |
551 |
throws ProfitMandiBusinessException, ClientProtocolException, IOException {
|
| 26645 |
amit.gupta |
552 |
LocalDateTime settingsLastUpdated = LocalDateTime.ofEpochSecond(timestamp, 0, ZoneOffset.ofHoursMinutes(5, 30));
|
|
|
553 |
List<MobileAppSetting> mobileAppSettings = mobileAppSettingsRepository.getSettingAftera(settingsLastUpdated);
|
| 26792 |
tejbeer |
554 |
|
| 26645 |
amit.gupta |
555 |
List<MobileAppSettingsWrapper> mobileSettingsWrappersList = mobileAppSettings.stream()
|
|
|
556 |
.map(x -> new MobileAppSettingsWrapper(x)).collect(Collectors.toList());
|
|
|
557 |
SettingsWrapper wrapper = new SettingsWrapper(mobileSettingsWrappersList);
|
| 26792 |
tejbeer |
558 |
|
| 26645 |
amit.gupta |
559 |
LOGGER.info("Wrapper {}", wrapper);
|
| 26646 |
amit.gupta |
560 |
return responseSender.ok(objectMapper.writeValueAsString(wrapper));
|
| 26645 |
amit.gupta |
561 |
}
|
| 22032 |
ashik.ali |
562 |
|
| 25366 |
tejbeer |
563 |
@RequestMapping(value = "/getPartners", method = RequestMethod.GET)
|
|
|
564 |
@ApiImplicitParams({
|
|
|
565 |
@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header") })
|
|
|
566 |
public ResponseEntity<?> getPartners(HttpServletRequest request, @RequestParam(name = "gmailId") String gmailId,
|
|
|
567 |
@RequestParam(value = "offset") int offset, @RequestParam(value = "limit") int limit)
|
|
|
568 |
throws ProfitMandiBusinessException {
|
|
|
569 |
AuthUser authUser = authRepository.selectByGmailId(gmailId);
|
|
|
570 |
|
| 25619 |
amit.gupta |
571 |
Map<String, Set<String>> storeGuyMap = csService.getAuthUserPartnerEmailMapping();
|
| 25366 |
tejbeer |
572 |
|
| 25619 |
amit.gupta |
573 |
Set<String> emails = storeGuyMap.get(authUser.getEmailId().toLowerCase());
|
| 25366 |
tejbeer |
574 |
LOGGER.info("emails" + emails);
|
| 25619 |
amit.gupta |
575 |
List<User> users = userRepository.selectAllByEmails(new ArrayList<>(emails), offset, limit);
|
| 25366 |
tejbeer |
576 |
List<Partner> partners = new ArrayList<>();
|
|
|
577 |
for (User user : users) {
|
| 25458 |
tejbeer |
578 |
|
| 25366 |
tejbeer |
579 |
UserAccount uc = userAccountRepository.selectSaholicByUserId(user.getId());
|
| 25458 |
tejbeer |
580 |
com.spice.profitmandi.dao.entity.user.User userInfo = userUserRepository.selectById(uc.getAccountKey());
|
| 25366 |
tejbeer |
581 |
CustomRetailer customRetailer = retailerService.getFofoRetailer(userInfo.getId());
|
|
|
582 |
|
|
|
583 |
Partner partner = new Partner();
|
|
|
584 |
partner.setBusinessName(customRetailer.getBusinessName());
|
|
|
585 |
partner.setPartnerId(customRetailer.getPartnerId());
|
|
|
586 |
partner.setCartId(customRetailer.getCartId());
|
|
|
587 |
partner.setEmail(customRetailer.getEmail());
|
|
|
588 |
partner.setGstNumber(customRetailer.getGstNumber());
|
|
|
589 |
partner.setDisplayName(customRetailer.getDisplayName());
|
|
|
590 |
partner.setCity(customRetailer.getAddress().getCity());
|
|
|
591 |
partner.setUserId(user.getId());
|
|
|
592 |
partners.add(partner);
|
|
|
593 |
}
|
|
|
594 |
LOGGER.info("partners" + partners);
|
|
|
595 |
return responseSender.ok(partners);
|
|
|
596 |
}
|
|
|
597 |
|
| 25458 |
tejbeer |
598 |
@RequestMapping(value = "/user/refferal", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
|
|
599 |
@ApiImplicitParams({
|
|
|
600 |
@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header") })
|
|
|
601 |
public ResponseEntity<?> RefferalUser(HttpServletRequest request,
|
|
|
602 |
@RequestBody CreateRefferalRequest createRefferalRequest) throws Exception {
|
|
|
603 |
Refferal refferal = new Refferal();
|
|
|
604 |
refferal.setFirstName(createRefferalRequest.getFirstName());
|
|
|
605 |
refferal.setLastName(createRefferalRequest.getLastName());
|
|
|
606 |
refferal.setMobile(createRefferalRequest.getMobile());
|
|
|
607 |
refferal.setState(createRefferalRequest.getState());
|
|
|
608 |
refferal.setCity(createRefferalRequest.getCity());
|
|
|
609 |
refferal.setCreatedTimestamp(LocalDateTime.now());
|
|
|
610 |
refferal.setUpdatedTimestamp(LocalDateTime.now());
|
| 25496 |
tejbeer |
611 |
refferal.setStatus(RefferalStatus.pending);
|
| 25458 |
tejbeer |
612 |
if (createRefferalRequest.isFofoAssociate()) {
|
|
|
613 |
AuthUser authUser = authRepository.selectByGmailId(createRefferalRequest.getReffereeEmail());
|
| 25483 |
tejbeer |
614 |
if (authUser == null) {
|
| 25458 |
tejbeer |
615 |
Promoter promoter = promoterRepository.selectByEmailId(createRefferalRequest.getReffereeEmail());
|
|
|
616 |
refferal.setRefereeName(promoter.getName());
|
| 25483 |
tejbeer |
617 |
refferal.setRefereeEmail(promoter.getEmail());
|
| 25458 |
tejbeer |
618 |
refferal.setRefereeMobile(promoter.getMobile());
|
|
|
619 |
} else {
|
|
|
620 |
refferal.setRefereeName(authUser.getFirstName());
|
| 25483 |
tejbeer |
621 |
refferal.setRefereeEmail(authUser.getGmailId());
|
| 25458 |
tejbeer |
622 |
refferal.setRefereeMobile(authUser.getMobileNumber());
|
|
|
623 |
}
|
|
|
624 |
} else {
|
|
|
625 |
User user = userRepository.selectByEmailId(createRefferalRequest.getReffereeEmail());
|
|
|
626 |
refferal.setRefereeName(user.getFirstName());
|
| 25483 |
tejbeer |
627 |
refferal.setRefereeEmail(user.getEmailId());
|
| 25458 |
tejbeer |
628 |
refferal.setRefereeMobile(user.getMobileNumber());
|
|
|
629 |
}
|
|
|
630 |
|
|
|
631 |
refferalRepository.persist(refferal);
|
| 26792 |
tejbeer |
632 |
String subject = "Referral Validate Request for " + refferal.getRefereeEmail();
|
|
|
633 |
String messageText = this.getMessageForReferral(refferal);
|
|
|
634 |
MimeMessage message = mailSender.createMimeMessage();
|
|
|
635 |
MimeMessageHelper helper = new MimeMessageHelper(message, true);
|
|
|
636 |
String[] email = { "kamini.sharma@smartdukaan.com", "tarun.verma@smartdukaan.com" };
|
|
|
637 |
helper.setSubject(subject);
|
|
|
638 |
helper.setText(messageText, true);
|
|
|
639 |
helper.setTo(email);
|
|
|
640 |
InternetAddress senderAddress = new InternetAddress("noreply@smartdukaan.com", "Smartdukaan Alerts");
|
|
|
641 |
helper.setFrom(senderAddress);
|
|
|
642 |
mailSender.send(message);
|
|
|
643 |
|
| 25458 |
tejbeer |
644 |
return responseSender.ok(true);
|
|
|
645 |
}
|
| 25488 |
tejbeer |
646 |
|
| 26792 |
tejbeer |
647 |
private String getMessageForReferral(Refferal referral) {
|
|
|
648 |
|
|
|
649 |
StringBuilder sb = new StringBuilder();
|
|
|
650 |
sb.append("<html><body><p>Alert</p><p> Referral Requests:-</p>"
|
|
|
651 |
+ "<br/><table style='border:1px solid black ;padding: 5px';>");
|
|
|
652 |
sb.append("<tbody>\n" + " <tr>\n"
|
|
|
653 |
+ " <th style='border:1px solid black;padding: 5px'>RefereeName</th>\n"
|
|
|
654 |
+ " <th style='border:1px solid black;padding: 5px'>Referee Email</th>\n"
|
|
|
655 |
+ " <th style='border:1px solid black;padding: 5px'>Referral Name</th>\n"
|
|
|
656 |
+ " <th style='border:1px solid black;padding: 5px'>Refferal Mobile</th>\n"
|
|
|
657 |
+ " <th style='border:1px solid black;padding: 5px'>city</th>\n"
|
|
|
658 |
+ " <th style='border:1px solid black;padding: 5px'>state</th>\n"
|
|
|
659 |
+ " </tr>");
|
|
|
660 |
|
|
|
661 |
sb.append("<tr>");
|
|
|
662 |
sb.append("<td style='border:1px solid black;padding: 5px'>" + referral.getRefereeName() + "</td>");
|
|
|
663 |
|
|
|
664 |
sb.append("<td style='border:1px solid black;padding: 5px'>" + referral.getRefereeEmail() + "</td>");
|
|
|
665 |
sb.append("<td style='border:1px solid black;padding: 5px'>" + referral.getFirstName() + "</td>");
|
|
|
666 |
sb.append("<td style='border:1px solid black;padding: 5px'>" + referral.getMobile() + "</td>");
|
|
|
667 |
sb.append("<td style='border:1px solid black;padding: 5px'>" + referral.getCity() + "</td>");
|
|
|
668 |
sb.append("<td style='border:1px solid black;padding: 5px'>" + referral.getState() + "</td>");
|
|
|
669 |
|
|
|
670 |
sb.append("</tr>");
|
|
|
671 |
|
|
|
672 |
sb.append("</tbody></table></body></html>");
|
|
|
673 |
|
|
|
674 |
return sb.toString();
|
|
|
675 |
}
|
|
|
676 |
|
| 25488 |
tejbeer |
677 |
@RequestMapping(value = "/user/refferalAmount", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
|
|
678 |
@ApiImplicitParams({
|
|
|
679 |
@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header") })
|
|
|
680 |
public ResponseEntity<?> RefferalAmount(HttpServletRequest request, @RequestParam String refereeEmail)
|
|
|
681 |
throws Exception {
|
|
|
682 |
LocalDateTime ldt = LocalDate.now().atStartOfDay().withDayOfMonth(16);
|
|
|
683 |
DateRangeModel drm = new DateRangeModel();
|
|
|
684 |
List<RefferalEarningModel> refferAmountModel = new ArrayList<RefferalEarningModel>();
|
|
|
685 |
RefferalEarningModel rfm = new RefferalEarningModel();
|
|
|
686 |
long currentMonthEstimaterefferal = 0;
|
|
|
687 |
long currentMonthConfirmedrefferal = 0;
|
|
|
688 |
if (LocalDateTime.now().isBefore(ldt)) {
|
|
|
689 |
List<Refferal> allPendingRefferalBeforeCurrentMonth = refferalRepository
|
|
|
690 |
.selectByEmailIdAndStatusAndbeforeCurrentMonth(refereeEmail, RefferalStatus.pending);
|
|
|
691 |
drm.setStartDate(LocalDateTime.now().minusMonths(1).withDayOfMonth(16));
|
|
|
692 |
drm.setEndDate(LocalDateTime.now().withDayOfMonth(1));
|
|
|
693 |
|
|
|
694 |
List<Refferal> previousMonthapprovedRefferalAfterSixteen = refferalRepository
|
|
|
695 |
.selectByEmailIdAndStatusAndDateRange(refereeEmail, RefferalStatus.approved, drm);
|
|
|
696 |
List<Refferal> previousMonthtransferredRefferalAfterSixteen = refferalRepository
|
|
|
697 |
.selectByEmailIdAndStatusAndDateRange(refereeEmail, RefferalStatus.transferred, drm);
|
|
|
698 |
|
|
|
699 |
drm.setStartDate(LocalDateTime.now().minusMonths(1).withDayOfMonth(1));
|
|
|
700 |
drm.setEndDate(LocalDateTime.now().minusMonths(1).withDayOfMonth(16));
|
|
|
701 |
|
|
|
702 |
List<Refferal> previousMonthapprovedRefferalbeforeSixteen = refferalRepository
|
|
|
703 |
.selectByEmailIdAndStatusAndDateRanges(refereeEmail, RefferalStatus.approved, drm);
|
|
|
704 |
List<Refferal> previousMonthtransferredRefferalbeforeSixteen = refferalRepository
|
|
|
705 |
.selectByEmailIdAndStatusAndDateRanges(refereeEmail, RefferalStatus.transferred, drm);
|
|
|
706 |
long pendingRefferalBeforeCurrentMonth = allPendingRefferalBeforeCurrentMonth.size();
|
|
|
707 |
long previousapprovedRefferalAfterSixteen = previousMonthapprovedRefferalAfterSixteen.size();
|
|
|
708 |
long previoustransferredRefferalAfterSixteen = previousMonthtransferredRefferalAfterSixteen.size();
|
|
|
709 |
long previousapprovedRefferalbeforeSixteen = previousMonthapprovedRefferalbeforeSixteen.size();
|
|
|
710 |
long previoustransferredRefferalbeforeSixteen = previousMonthtransferredRefferalbeforeSixteen.size();
|
|
|
711 |
long previousMonthEstimateRefferal = pendingRefferalBeforeCurrentMonth
|
|
|
712 |
+ previousapprovedRefferalAfterSixteen + previousapprovedRefferalbeforeSixteen;
|
|
|
713 |
long previousMonthConfirmedRefferal = previousapprovedRefferalAfterSixteen
|
|
|
714 |
+ previoustransferredRefferalAfterSixteen + previousapprovedRefferalbeforeSixteen
|
|
|
715 |
+ previoustransferredRefferalbeforeSixteen;
|
| 25490 |
tejbeer |
716 |
rfm = refferAmountEarning(pendingRefferalBeforeCurrentMonth, previousMonthConfirmedRefferal,
|
| 25488 |
tejbeer |
717 |
YearMonth.now().minusMonths(1));
|
|
|
718 |
refferAmountModel.add(rfm);
|
|
|
719 |
LOGGER.info("previousMonthPendingApprovedRefferal" + previousMonthEstimateRefferal);
|
|
|
720 |
LOGGER.info("previousMonthApprovedTransfferedRefferal" + previousMonthConfirmedRefferal);
|
|
|
721 |
|
| 25509 |
tejbeer |
722 |
List<Refferal> pendingofCurrentMonth = refferalRepository
|
|
|
723 |
.selectByEmailIdAndStatusAndBetweenDates(refereeEmail, RefferalStatus.pending, YearMonth.now());
|
| 25488 |
tejbeer |
724 |
List<Refferal> approvedofCurrentMonth = refferalRepository.selectByEmailIdAndStatusAndDatesBetweenTimestamp(
|
|
|
725 |
refereeEmail, RefferalStatus.approved, YearMonth.now());
|
|
|
726 |
List<Refferal> transferredofCurrentMonth = refferalRepository
|
|
|
727 |
.selectByEmailIdAndStatusAndDatesBetweenTimestamp(refereeEmail, RefferalStatus.transferred,
|
|
|
728 |
YearMonth.now());
|
| 25490 |
tejbeer |
729 |
LOGGER.info("pendingofCurrentMonth" + pendingofCurrentMonth);
|
| 25509 |
tejbeer |
730 |
long pendingofCurrentMonthCount = pendingofCurrentMonth.size();
|
| 25488 |
tejbeer |
731 |
currentMonthEstimaterefferal = pendingofCurrentMonth.size() + approvedofCurrentMonth.size();
|
|
|
732 |
currentMonthConfirmedrefferal = approvedofCurrentMonth.size() + transferredofCurrentMonth.size();
|
| 25509 |
tejbeer |
733 |
|
| 25490 |
tejbeer |
734 |
rfm = refferAmountEarning(pendingofCurrentMonthCount, currentMonthConfirmedrefferal, YearMonth.now());
|
| 25488 |
tejbeer |
735 |
|
|
|
736 |
refferAmountModel.add(rfm);
|
|
|
737 |
|
|
|
738 |
} else if (LocalDateTime.now().isAfter(ldt)) {
|
|
|
739 |
drm.setStartDate(LocalDateTime.now().minusMonths(1).withDayOfMonth(1));
|
| 25496 |
tejbeer |
740 |
drm.setEndDate(LocalDateTime.now().minusMonths(1).withDayOfMonth(16));
|
| 25488 |
tejbeer |
741 |
|
|
|
742 |
List<Refferal> previousMonthapprovedRefferalbeforeSixteen = refferalRepository
|
|
|
743 |
.selectByEmailIdAndStatusAndDateRanges(refereeEmail, RefferalStatus.approved, drm);
|
|
|
744 |
List<Refferal> previousMonthtransferredRefferalbeforeSixteen = refferalRepository
|
|
|
745 |
.selectByEmailIdAndStatusAndDateRanges(refereeEmail, RefferalStatus.transferred, drm);
|
|
|
746 |
|
|
|
747 |
drm.setStartDate(LocalDateTime.now().minusMonths(1).withDayOfMonth(16));
|
|
|
748 |
drm.setEndDate(LocalDateTime.now().withDayOfMonth(16));
|
|
|
749 |
|
|
|
750 |
List<Refferal> previousAndcurrentMonthapprovedRefferal = refferalRepository
|
|
|
751 |
.selectByEmailIdAndStatusAndDateRange(refereeEmail, RefferalStatus.approved, drm);
|
|
|
752 |
|
|
|
753 |
LocalDateTime currentMonthdate = LocalDateTime.now().withDayOfMonth(1);
|
|
|
754 |
|
|
|
755 |
List<Refferal> preCurrMonthapproved = previousAndcurrentMonthapprovedRefferal.stream()
|
|
|
756 |
.filter(x -> x.getCreatedTimestamp().isBefore(currentMonthdate)).collect(Collectors.toList());
|
|
|
757 |
List<Refferal> previousAndcurrentMonthtransferredRefferal = refferalRepository
|
|
|
758 |
.selectByEmailIdAndStatusAndDateRange(refereeEmail, RefferalStatus.transferred, drm);
|
|
|
759 |
List<Refferal> preCurrMonthtransferred = previousAndcurrentMonthtransferredRefferal.stream()
|
|
|
760 |
.filter(x -> x.getCreatedTimestamp().isBefore(currentMonthdate)).collect(Collectors.toList());
|
|
|
761 |
|
|
|
762 |
long approvedRefferal = previousMonthapprovedRefferalbeforeSixteen.size()
|
|
|
763 |
+ previousMonthtransferredRefferalbeforeSixteen.size() + preCurrMonthapproved.size()
|
|
|
764 |
+ preCurrMonthtransferred.size();
|
|
|
765 |
rfm = new RefferalEarningModel();
|
| 27595 |
tejbeer |
766 |
rfm.setActualEarning(approvedRefferal * 2000);
|
|
|
767 |
|
| 25488 |
tejbeer |
768 |
rfm.setYearMonth(YearMonth.now().minusMonths(1));
|
| 25490 |
tejbeer |
769 |
rfm.setPendingRefferal(0);
|
| 25509 |
tejbeer |
770 |
rfm.setApprovedRefferal(approvedRefferal);
|
| 25488 |
tejbeer |
771 |
refferAmountModel.add(rfm);
|
|
|
772 |
List<Refferal> allpendingRefferal = refferalRepository.selectByEmailIdAndStatus(refereeEmail,
|
|
|
773 |
RefferalStatus.pending);
|
|
|
774 |
LOGGER.info("allpendingRefferal" + allpendingRefferal);
|
|
|
775 |
|
|
|
776 |
drm.setStartDate(LocalDateTime.now().withDayOfMonth(16));
|
|
|
777 |
drm.setEndDate(LocalDateTime.now().plusMonths(1).withDayOfMonth(1));
|
|
|
778 |
|
|
|
779 |
List<Refferal> currentMonthapprovedRefferalAfterSixteen = refferalRepository
|
|
|
780 |
.selectByEmailIdAndStatusAndDateRange(refereeEmail, RefferalStatus.approved, drm);
|
|
|
781 |
List<Refferal> currentMonthtransferredRefferalAfterSixteen = refferalRepository
|
|
|
782 |
.selectByEmailIdAndStatusAndDateRange(refereeEmail, RefferalStatus.transferred, drm);
|
|
|
783 |
LOGGER.info("currentMonthapprovedRefferalAfterSixteen" + currentMonthapprovedRefferalAfterSixteen);
|
|
|
784 |
drm.setStartDate(LocalDateTime.now().withDayOfMonth(1));
|
|
|
785 |
drm.setEndDate(LocalDateTime.now().withDayOfMonth(16));
|
|
|
786 |
|
|
|
787 |
List<Refferal> currentMonthapprovedRefferalbeforeSixteen = refferalRepository
|
|
|
788 |
.selectByEmailIdAndStatusAndDateRanges(refereeEmail, RefferalStatus.approved, drm);
|
|
|
789 |
List<Refferal> currentMonthtransferredRefferalbeforeSixteen = refferalRepository
|
|
|
790 |
.selectByEmailIdAndStatusAndDateRanges(refereeEmail, RefferalStatus.transferred, drm);
|
|
|
791 |
LOGGER.info("currentMonthapprovedRefferalbeforeSixteen" + currentMonthapprovedRefferalbeforeSixteen);
|
| 25509 |
tejbeer |
792 |
long pendingrefferalcount = allpendingRefferal.size();
|
| 25488 |
tejbeer |
793 |
currentMonthConfirmedrefferal = currentMonthapprovedRefferalAfterSixteen.size()
|
|
|
794 |
+ currentMonthtransferredRefferalAfterSixteen.size()
|
|
|
795 |
+ currentMonthapprovedRefferalbeforeSixteen.size()
|
|
|
796 |
+ currentMonthtransferredRefferalbeforeSixteen.size();
|
| 25509 |
tejbeer |
797 |
|
|
|
798 |
rfm = refferAmountEarning(pendingrefferalcount, currentMonthConfirmedrefferal, YearMonth.now());
|
| 25488 |
tejbeer |
799 |
refferAmountModel.add(rfm);
|
|
|
800 |
LOGGER.info("currentMonthpendingApprovedrefferal" + currentMonthEstimaterefferal);
|
|
|
801 |
|
|
|
802 |
LOGGER.info("currentMonthapprovedTransferredrefferal" + currentMonthConfirmedrefferal);
|
|
|
803 |
|
|
|
804 |
}
|
|
|
805 |
RefferalEarning re = new RefferalEarning();
|
|
|
806 |
re.setTimestamp(LocalDateTime.now());
|
|
|
807 |
re.setRefferalEarningModel(refferAmountModel);
|
|
|
808 |
return responseSender.ok(re);
|
|
|
809 |
}
|
|
|
810 |
|
| 25490 |
tejbeer |
811 |
private RefferalEarningModel refferAmountEarning(long pendingRefferalValue, long confirmedRefferalValue,
|
| 25488 |
tejbeer |
812 |
YearMonth yearMonth) {
|
|
|
813 |
RefferalEarningModel rfm = new RefferalEarningModel();
|
|
|
814 |
rfm.setYearMonth(yearMonth);
|
| 25490 |
tejbeer |
815 |
rfm.setPendingRefferal(pendingRefferalValue);
|
|
|
816 |
rfm.setApprovedRefferal(confirmedRefferalValue);
|
| 25509 |
tejbeer |
817 |
long estimateRefferalValue = pendingRefferalValue + confirmedRefferalValue;
|
| 25488 |
tejbeer |
818 |
|
| 27595 |
tejbeer |
819 |
rfm.setMaximumEarning(estimateRefferalValue * 2000);
|
|
|
820 |
|
|
|
821 |
rfm.setMinimumEarning(confirmedRefferalValue * 2000);
|
|
|
822 |
|
| 25488 |
tejbeer |
823 |
return rfm;
|
|
|
824 |
}
|
| 25979 |
tejbeer |
825 |
|
| 25622 |
amit.gupta |
826 |
@RequestMapping(value = "/user/partnerTarget", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
|
|
827 |
@ApiImplicitParams({
|
|
|
828 |
@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header") })
|
|
|
829 |
public ResponseEntity<?> PartnerTarget(HttpServletRequest request) throws Exception {
|
|
|
830 |
int userId = (int) request.getAttribute(ProfitMandiConstants.USER_ID);
|
|
|
831 |
int retailerId = userAccountRepository.selectRetailerIdByUserId(userId);
|
|
|
832 |
PartnerType partnerType = partnerTypeChangeService.getTypeOnDate(retailerId, LocalDate.now());
|
| 25979 |
tejbeer |
833 |
|
| 25622 |
amit.gupta |
834 |
return responseSender.ok(partnerType);
|
|
|
835 |
}
|
| 26636 |
amit.gupta |
836 |
|
| 27425 |
tejbeer |
837 |
@RequestMapping(value = "/user/authUser", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
|
|
838 |
@ApiImplicitParams({
|
|
|
839 |
@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header") })
|
|
|
840 |
public ResponseEntity<?> authUserDetail(HttpServletRequest request, @RequestParam int userId) throws Exception {
|
|
|
841 |
User user = userRepository.selectById(userId);
|
|
|
842 |
AuthUser authUser = authRepository.selectByEmailOrMobile(user.getEmailId());
|
|
|
843 |
return responseSender.ok(authUser);
|
|
|
844 |
}
|
|
|
845 |
|
| 21248 |
ashik.ali |
846 |
}
|
| 26636 |
amit.gupta |
847 |
|
|
|
848 |
class MobileAppSettingsWrapper {
|
|
|
849 |
@JsonProperty(value = "Mobileappsetting")
|
|
|
850 |
private MobileAppSetting mobileAppSettings;
|
|
|
851 |
|
|
|
852 |
public MobileAppSettingsWrapper(MobileAppSetting mobileAppSettings) {
|
|
|
853 |
super();
|
|
|
854 |
this.mobileAppSettings = mobileAppSettings;
|
|
|
855 |
}
|
| 26642 |
amit.gupta |
856 |
|
|
|
857 |
public MobileAppSetting getMobileAppSettings() {
|
|
|
858 |
return mobileAppSettings;
|
|
|
859 |
}
|
|
|
860 |
|
|
|
861 |
public void setMobileAppSettings(MobileAppSetting mobileAppSettings) {
|
|
|
862 |
this.mobileAppSettings = mobileAppSettings;
|
|
|
863 |
}
|
| 26643 |
amit.gupta |
864 |
|
|
|
865 |
@Override
|
|
|
866 |
public String toString() {
|
|
|
867 |
return "MobileAppSettingsWrapper [mobileAppSettings=" + mobileAppSettings + "]";
|
|
|
868 |
}
|
| 26644 |
amit.gupta |
869 |
|
| 26636 |
amit.gupta |
870 |
}
|
|
|
871 |
|
|
|
872 |
class SettingsWrapper {
|
|
|
873 |
private List<MobileAppSettingsWrapper> settings;
|
| 26644 |
amit.gupta |
874 |
|
| 26636 |
amit.gupta |
875 |
public SettingsWrapper(List<MobileAppSettingsWrapper> settings) {
|
|
|
876 |
super();
|
|
|
877 |
this.settings = settings;
|
|
|
878 |
}
|
|
|
879 |
|
| 26642 |
amit.gupta |
880 |
@Override
|
|
|
881 |
public String toString() {
|
|
|
882 |
return "SettingsWrapper [settings=" + settings + "]";
|
|
|
883 |
}
|
|
|
884 |
|
|
|
885 |
public List<MobileAppSettingsWrapper> getSettings() {
|
|
|
886 |
return settings;
|
|
|
887 |
}
|
|
|
888 |
|
|
|
889 |
public void setSettings(List<MobileAppSettingsWrapper> settings) {
|
|
|
890 |
this.settings = settings;
|
|
|
891 |
}
|
|
|
892 |
|
| 27425 |
tejbeer |
893 |
}
|