| Line 182... |
Line 182... |
| 182 |
|
182 |
|
| 183 |
return responseSender.ok(responseMap);
|
183 |
return responseSender.ok(responseMap);
|
| 184 |
}
|
184 |
}
|
| 185 |
|
185 |
|
| 186 |
@RequestMapping(value = ProfitMandiConstants.URL_USER, method = RequestMethod.POST)
|
186 |
@RequestMapping(value = ProfitMandiConstants.URL_USER, method = RequestMethod.POST)
|
| - |
|
187 |
@ApiImplicitParams({
|
| - |
|
188 |
@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header") })
|
| 187 |
public ResponseEntity<?> createUser(HttpServletRequest request, @RequestBody UserRequest userRequest) {
|
189 |
public ResponseEntity<?> createUser(HttpServletRequest request, @RequestBody UserRequest userRequest) throws Throwable{
|
| 188 |
LOGGER.info("requested url : " + request.getRequestURL().toString());
|
190 |
LOGGER.info("requested url : " + request.getRequestURL().toString());
|
| 189 |
User user = new User();
|
191 |
User user = new User();
|
| 190 |
user.setFirstName(userRequest.getFirstName());
|
192 |
user.setFirstName(userRequest.getFirstName());
|
| 191 |
user.setLastName(userRequest.getLastName());
|
193 |
user.setLastName(userRequest.getLastName());
|
| 192 |
user.setCity(userRequest.getCity());
|
194 |
user.setCity(userRequest.getCity());
|
| Line 197... |
Line 199... |
| 197 |
user.setMobile_verified(false);
|
199 |
user.setMobile_verified(false);
|
| 198 |
user.setReferral_url("");
|
200 |
user.setReferral_url("");
|
| 199 |
user.setGroup_id(1);
|
201 |
user.setGroup_id(1);
|
| 200 |
user.setStatus(0);
|
202 |
user.setStatus(0);
|
| 201 |
user.setActivated(false);
|
203 |
user.setActivated(false);
|
| - |
|
204 |
user.setCreateTimestamp(LocalDateTime.now());
|
| - |
|
205 |
user.setUpdateTimestamp(LocalDateTime.now());
|
| - |
|
206 |
userRepository.persist(user);
|
| - |
|
207 |
|
| - |
|
208 |
UserRole userRole = new UserRole();
|
| - |
|
209 |
userRole.setRoleId(RoleType.USER.getValue());
|
| - |
|
210 |
userRole.setUserId(user.getId());
|
| - |
|
211 |
userRoleRepository.persist(userRole);
|
| 202 |
|
212 |
|
| 203 |
try {
|
- |
|
| 204 |
user.setCreateTimestamp(LocalDateTime.now());
|
- |
|
| 205 |
user.setUpdateTimestamp(LocalDateTime.now());
|
- |
|
| 206 |
userRepository.persist(user);
|
- |
|
| 207 |
return responseSender.ok(ResponseCodeHolder.getMessage("USR_OK_1000"));
|
213 |
return responseSender.ok(ResponseCodeHolder.getMessage("USR_OK_1000"));
|
| 208 |
|
- |
|
| 209 |
} catch (ProfitMandiBusinessException profitMandiBusinessException) {
|
- |
|
| 210 |
LOGGER.error("ProfitMandi error: ", profitMandiBusinessException);
|
- |
|
| 211 |
return responseSender.badRequest(profitMandiBusinessException);
|
- |
|
| 212 |
}
|
214 |
|
| 213 |
}
|
215 |
}
|
| 214 |
|
216 |
|
| 215 |
@RequestMapping(value = ProfitMandiConstants.URL_USER_ALL, method = RequestMethod.GET)
|
217 |
@RequestMapping(value = ProfitMandiConstants.URL_USER_ALL, method = RequestMethod.GET)
|
| 216 |
public ResponseEntity<?> getAll(HttpServletRequest request, @RequestParam(name = ProfitMandiConstants.PAGE_NUMBER) int pageNumber, @RequestParam(name = ProfitMandiConstants.PAGE_SIZE) int pageSize) {
|
218 |
public ResponseEntity<?> getAll(HttpServletRequest request, @RequestParam(name = ProfitMandiConstants.PAGE_NUMBER) int pageNumber, @RequestParam(name = ProfitMandiConstants.PAGE_SIZE) int pageSize) {
|
| 217 |
LOGGER.info("requested url : " + request.getRequestURL().toString());
|
219 |
LOGGER.info("requested url : " + request.getRequestURL().toString());
|
| Line 239... |
Line 241... |
| 239 |
LOGGER.error("ProfitMandi error: ", profitMandiBusinessException);
|
241 |
LOGGER.error("ProfitMandi error: ", profitMandiBusinessException);
|
| 240 |
return responseSender.badRequest(profitMandiBusinessException);
|
242 |
return responseSender.badRequest(profitMandiBusinessException);
|
| 241 |
}
|
243 |
}
|
| 242 |
}
|
244 |
}
|
| 243 |
|
245 |
|
| - |
|
246 |
@ApiImplicitParams({
|
| - |
|
247 |
@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header") })
|
| - |
|
248 |
@RequestMapping(value = ProfitMandiConstants.URL_USER_ACTIVATE, method = RequestMethod.POST)
|
| - |
|
249 |
public ResponseEntity<?> activateUser(HttpServletRequest request,
|
| - |
|
250 |
@RequestParam(name = "activationCode") String activationCode) {
|
| - |
|
251 |
Map<String, Object> response = new HashMap<>();
|
| - |
|
252 |
boolean activated = false;
|
| - |
|
253 |
|
| - |
|
254 |
/*int userId = (int)request.getAttribute("userId");
|
| - |
|
255 |
UserCart uc = userAccountRepository.getUserCart(userId);
|
| - |
|
256 |
Client client = new TransactionClient().getClient();
|
| - |
|
257 |
if (client.registerRsa(uc.getUserId(),activationCode)){
|
| - |
|
258 |
activated = true;
|
| - |
|
259 |
}
|
| - |
|
260 |
else{
|
| - |
|
261 |
|
| - |
|
262 |
}*/
|
| - |
|
263 |
return responseSender.ok(null);
|
| - |
|
264 |
}
|
| - |
|
265 |
|
| 244 |
@RequestMapping(value = ProfitMandiConstants.URL_USER_IS_EXIST_MOBILE_NUMBER, method = RequestMethod.GET)
|
266 |
@RequestMapping(value = ProfitMandiConstants.URL_USER_IS_EXIST_MOBILE_NUMBER, method = RequestMethod.GET)
|
| 245 |
public ResponseEntity<?> isMobileNumberExist(HttpServletRequest request,
|
267 |
public ResponseEntity<?> isMobileNumberExist(HttpServletRequest request,
|
| 246 |
@RequestParam(name = "mobileNumber") String mobileNumber) {
|
268 |
@RequestParam(name = "mobileNumber") String mobileNumber) {
|
| 247 |
LOGGER.info("requested url : " + request.getRequestURL().toString());
|
269 |
LOGGER.info("requested url : " + request.getRequestURL().toString());
|
| 248 |
return responseSender.ok(userRepository.isExistByMobileNumber(mobileNumber));
|
270 |
return responseSender.ok(userRepository.isExistByMobileNumber(mobileNumber));
|