| Line 35... |
Line 35... |
| 35 |
import com.spice.profitmandi.web.model.Response;
|
35 |
import com.spice.profitmandi.web.model.Response;
|
| 36 |
import com.spice.profitmandi.web.model.ResponseStatus;
|
36 |
import com.spice.profitmandi.web.model.ResponseStatus;
|
| 37 |
import com.spice.profitmandi.web.processor.GoogleLoginProcessor;
|
37 |
import com.spice.profitmandi.web.processor.GoogleLoginProcessor;
|
| 38 |
import com.spice.profitmandi.web.req.UserAddRoleRequest;
|
38 |
import com.spice.profitmandi.web.req.UserAddRoleRequest;
|
| 39 |
import com.spice.profitmandi.web.req.UserRequest;
|
39 |
import com.spice.profitmandi.web.req.UserRequest;
|
| - |
|
40 |
import com.spice.profitmandi.web.util.ResponseSender;
|
| 40 |
|
41 |
|
| 41 |
/**
|
42 |
/**
|
| 42 |
* @author ashikali
|
43 |
* @author ashikali
|
| 43 |
*
|
44 |
*
|
| 44 |
*/
|
45 |
*/
|
| 45 |
@Controller
|
46 |
@Controller
|
| 46 |
public class UserController {
|
47 |
public class UserController {
|
| 47 |
|
48 |
|
| - |
|
49 |
@Autowired
|
| - |
|
50 |
ResponseSender<?> responseSender;
|
| - |
|
51 |
|
| 48 |
private static final Logger LOGGER=LoggerFactory.getLogger(UserController.class);
|
52 |
private static final Logger LOGGER=LoggerFactory.getLogger(UserController.class);
|
| 49 |
|
53 |
|
| 50 |
@Value("${admin.token}")
|
54 |
@Value("${admin.token}")
|
| 51 |
private String validAdminToken;
|
55 |
private String validAdminToken;
|
| 52 |
|
56 |
|
| Line 70... |
Line 74... |
| 70 |
public ResponseEntity<?> googleLogin(HttpServletRequest request){
|
74 |
public ResponseEntity<?> googleLogin(HttpServletRequest request){
|
| 71 |
LOGGER.info("requested url : "+request.getRequestURL().toString());
|
75 |
LOGGER.info("requested url : "+request.getRequestURL().toString());
|
| 72 |
final Map<String, Object> googleLoginMap = (Map<String, Object>)request.getAttribute(ProfitMandiConstants.GOOGLE_LOGIN_MAP);
|
76 |
final Map<String, Object> googleLoginMap = (Map<String, Object>)request.getAttribute(ProfitMandiConstants.GOOGLE_LOGIN_MAP);
|
| 73 |
request.removeAttribute(ProfitMandiConstants.GOOGLE_LOGIN_MAP);
|
77 |
request.removeAttribute(ProfitMandiConstants.GOOGLE_LOGIN_MAP);
|
| 74 |
try {
|
78 |
try {
|
| 75 |
final ProfitMandiResponse<?> profitMandiResponse=new ProfitMandiResponse<>(LocalDateTime.now(), request.getRequestURL().toString(), HttpStatus.OK.toString(), HttpStatus.OK, ResponseStatus.SUCCESS, googleLoginProcessor.process(googleLoginMap));
|
- |
|
| 76 |
return new ResponseEntity<>(profitMandiResponse, HttpStatus.OK);
|
79 |
return responseSender.ok(googleLoginProcessor.process(googleLoginMap));
|
| 77 |
}catch (ProfitMandiBusinessException profitMandiBusinessException) {
|
80 |
}catch (ProfitMandiBusinessException profitMandiBusinessException) {
|
| 78 |
LOGGER.error("ProfitMandi error: ", profitMandiBusinessException);
|
81 |
LOGGER.error("ProfitMandi error: ", profitMandiBusinessException);
|
| 79 |
final Response response=new Response(profitMandiBusinessException.getRejectedType(), profitMandiBusinessException.getRejectedValue(),profitMandiBusinessException.getCode(), profitMandiBusinessException.getMessage());
|
- |
|
| 80 |
final ProfitMandiResponse<Response> profitMandiResponse=new ProfitMandiResponse<Response>(LocalDateTime.now(), request.getRequestURL().toString(), HttpStatus.BAD_REQUEST.toString(), HttpStatus.BAD_REQUEST, ResponseStatus.FAILURE, response);
|
- |
|
| 81 |
return new ResponseEntity<>(profitMandiResponse,HttpStatus.BAD_REQUEST);
|
82 |
return responseSender.badRequest(profitMandiBusinessException);
|
| 82 |
}
|
83 |
}
|
| 83 |
}
|
84 |
}
|
| 84 |
|
85 |
|
| 85 |
@RequestMapping(value = ProfitMandiConstants.URL_USER_TOKEN_IS_EXPIRED, method=RequestMethod.GET)
|
86 |
@RequestMapping(value = ProfitMandiConstants.URL_USER_TOKEN_IS_EXPIRED, method=RequestMethod.GET)
|
| 86 |
public ResponseEntity<?> tokenIsExpired(HttpServletRequest request, @RequestParam(name = "token") String token){
|
87 |
public ResponseEntity<?> tokenIsExpired(HttpServletRequest request, @RequestParam(name = "token") String token){
|
| 87 |
LOGGER.info("requested url : "+request.getRequestURL().toString());
|
88 |
LOGGER.info("requested url : "+request.getRequestURL().toString());
|
| 88 |
try {
|
89 |
try {
|
| 89 |
final ProfitMandiResponse<?> profitMandiResponse=new ProfitMandiResponse<>(LocalDateTime.now(), request.getRequestURL().toString(), HttpStatus.OK.toString(), HttpStatus.OK, ResponseStatus.SUCCESS, JWTUtil.isExpired(token));
|
- |
|
| 90 |
return new ResponseEntity<>(profitMandiResponse,HttpStatus.OK);
|
90 |
return responseSender.ok(JWTUtil.isExpired(token));
|
| - |
|
91 |
|
| 91 |
}catch (ProfitMandiBusinessException profitMandiBusinessException) {
|
92 |
}catch (ProfitMandiBusinessException profitMandiBusinessException) {
|
| 92 |
LOGGER.error("ProfitMandi error: ", profitMandiBusinessException);
|
93 |
LOGGER.error("ProfitMandi error: ", profitMandiBusinessException);
|
| 93 |
final Response response=new Response(profitMandiBusinessException.getRejectedType(), profitMandiBusinessException.getRejectedValue(),profitMandiBusinessException.getCode(), profitMandiBusinessException.getMessage());
|
- |
|
| 94 |
final ProfitMandiResponse<Response> profitMandiResponse=new ProfitMandiResponse<Response>(LocalDateTime.now(), request.getRequestURL().toString(), HttpStatus.BAD_REQUEST.toString(), HttpStatus.BAD_REQUEST, ResponseStatus.FAILURE, response);
|
- |
|
| 95 |
return new ResponseEntity<>(profitMandiResponse,HttpStatus.BAD_REQUEST);
|
94 |
return responseSender.badRequest(profitMandiBusinessException);
|
| 96 |
}
|
95 |
}
|
| 97 |
}
|
96 |
}
|
| 98 |
|
97 |
|
| 99 |
|
98 |
|
| 100 |
@RequestMapping(value = ProfitMandiConstants.URL_USER, method=RequestMethod.POST)
|
99 |
@RequestMapping(value = ProfitMandiConstants.URL_USER, method=RequestMethod.POST)
|
| Line 116... |
Line 115... |
| 116 |
|
115 |
|
| 117 |
try {
|
116 |
try {
|
| 118 |
user.setCreateTimestamp(LocalDateTime.now());
|
117 |
user.setCreateTimestamp(LocalDateTime.now());
|
| 119 |
user.setUpdateTimestamp(LocalDateTime.now());
|
118 |
user.setUpdateTimestamp(LocalDateTime.now());
|
| 120 |
userRepository.persist(user);
|
119 |
userRepository.persist(user);
|
| 121 |
final ProfitMandiResponse<?> profitMandiResponse=new ProfitMandiResponse<>(LocalDateTime.now(), request.getRequestURL().toString(), HttpStatus.OK.toString(), HttpStatus.OK, ResponseStatus.SUCCESS, ResponseCodeHolder.getMessage("USR_OK_1000"));
|
- |
|
| 122 |
return new ResponseEntity<>(profitMandiResponse, HttpStatus.OK);
|
120 |
return responseSender.ok(ResponseCodeHolder.getMessage("USR_OK_1000"));
|
| - |
|
121 |
|
| 123 |
}catch (ProfitMandiBusinessException profitMandiBusinessException) {
|
122 |
}catch (ProfitMandiBusinessException profitMandiBusinessException) {
|
| 124 |
LOGGER.error("ProfitMandi error: ", profitMandiBusinessException);
|
123 |
LOGGER.error("ProfitMandi error: ", profitMandiBusinessException);
|
| 125 |
final Response response=new Response(profitMandiBusinessException.getRejectedType(), profitMandiBusinessException.getRejectedValue(),profitMandiBusinessException.getCode(), profitMandiBusinessException.getMessage());
|
- |
|
| 126 |
final ProfitMandiResponse<Response> chatOnResponse=new ProfitMandiResponse<Response>(LocalDateTime.now(), request.getRequestURL().toString(), HttpStatus.BAD_REQUEST.toString(), HttpStatus.BAD_REQUEST, ResponseStatus.FAILURE, response);
|
- |
|
| 127 |
return new ResponseEntity<>(chatOnResponse,HttpStatus.BAD_REQUEST);
|
124 |
return responseSender.badRequest(profitMandiBusinessException);
|
| 128 |
}
|
125 |
}
|
| 129 |
}
|
126 |
}
|
| 130 |
|
127 |
|
| 131 |
@RequestMapping(value = ProfitMandiConstants.URL_USER_ALL,method=RequestMethod.GET)
|
128 |
@RequestMapping(value = ProfitMandiConstants.URL_USER_ALL,method=RequestMethod.GET)
|
| 132 |
public ResponseEntity<?> getAll(HttpServletRequest request){
|
129 |
public ResponseEntity<?> getAll(HttpServletRequest request){
|
| 133 |
LOGGER.info("requested url : "+request.getRequestURL().toString());
|
130 |
LOGGER.info("requested url : "+request.getRequestURL().toString());
|
| 134 |
final ProfitMandiResponse<?> profitMandiResponse=new ProfitMandiResponse<>(LocalDateTime.now(), request.getRequestURL().toString(), HttpStatus.OK.toString(), HttpStatus.OK, ResponseStatus.SUCCESS, userRepository.selectAll());
|
- |
|
| 135 |
return new ResponseEntity<>(profitMandiResponse,HttpStatus.OK);
|
131 |
return responseSender.ok(userRepository.selectAll());
|
| 136 |
}
|
132 |
}
|
| 137 |
|
133 |
|
| 138 |
@RequestMapping(value = ProfitMandiConstants.URL_USER_ID,method=RequestMethod.GET)
|
134 |
@RequestMapping(value = ProfitMandiConstants.URL_USER_ID,method=RequestMethod.GET)
|
| 139 |
public ResponseEntity<?> getById(HttpServletRequest request, @RequestParam(name = "id") int id){
|
135 |
public ResponseEntity<?> getById(HttpServletRequest request, @RequestParam(name = "id") int id){
|
| 140 |
LOGGER.info("requested url : "+request.getRequestURL().toString());
|
136 |
LOGGER.info("requested url : "+request.getRequestURL().toString());
|
| 141 |
try {
|
137 |
try {
|
| 142 |
final ProfitMandiResponse<?> profitMandiResponse=new ProfitMandiResponse<>(LocalDateTime.now(), request.getRequestURL().toString(), HttpStatus.OK.toString(), HttpStatus.OK, ResponseStatus.SUCCESS, userRepository.selectById(id));
|
- |
|
| 143 |
return new ResponseEntity<>(profitMandiResponse,HttpStatus.OK);
|
138 |
return responseSender.ok(userRepository.selectById(id));
|
| 144 |
}catch (ProfitMandiBusinessException profitMandiBusinessException) {
|
139 |
}catch (ProfitMandiBusinessException profitMandiBusinessException) {
|
| 145 |
LOGGER.error("ProfitMandi error: ", profitMandiBusinessException);
|
140 |
LOGGER.error("ProfitMandi error: ", profitMandiBusinessException);
|
| 146 |
final Response response=new Response(profitMandiBusinessException.getRejectedType(), profitMandiBusinessException.getRejectedValue(),profitMandiBusinessException.getCode(), profitMandiBusinessException.getMessage());
|
- |
|
| 147 |
final ProfitMandiResponse<Response> profitMandiResponse=new ProfitMandiResponse<Response>(LocalDateTime.now(), request.getRequestURL().toString(), HttpStatus.BAD_REQUEST.toString(), HttpStatus.BAD_REQUEST, ResponseStatus.FAILURE, response);
|
- |
|
| 148 |
return new ResponseEntity<>(profitMandiResponse,HttpStatus.BAD_REQUEST);
|
141 |
return responseSender.badRequest(profitMandiBusinessException);
|
| 149 |
}
|
142 |
}
|
| 150 |
}
|
143 |
}
|
| 151 |
|
144 |
|
| 152 |
@RequestMapping(value = ProfitMandiConstants.URL_USER_MOBILE_NUMBER,method=RequestMethod.GET)
|
145 |
@RequestMapping(value = ProfitMandiConstants.URL_USER_MOBILE_NUMBER,method=RequestMethod.GET)
|
| 153 |
public ResponseEntity<?> getByMobileNumber(HttpServletRequest request, @RequestParam(name = "mobileNumber") String mobileNumber){
|
146 |
public ResponseEntity<?> getByMobileNumber(HttpServletRequest request, @RequestParam(name = "mobileNumber") String mobileNumber){
|
| 154 |
LOGGER.info("requested url : "+request.getRequestURL().toString());
|
147 |
LOGGER.info("requested url : "+request.getRequestURL().toString());
|
| 155 |
try {
|
148 |
try {
|
| 156 |
final ProfitMandiResponse<?> profitMandiResponse=new ProfitMandiResponse<>(LocalDateTime.now(), request.getRequestURL().toString(), HttpStatus.OK.toString(), HttpStatus.OK, ResponseStatus.SUCCESS, userRepository.selectByMobileNumber(mobileNumber));
|
- |
|
| 157 |
return new ResponseEntity<>(profitMandiResponse,HttpStatus.OK);
|
149 |
return responseSender.ok(userRepository.selectByMobileNumber(mobileNumber));
|
| 158 |
}catch (ProfitMandiBusinessException profitMandiBusinessException) {
|
150 |
}catch (ProfitMandiBusinessException profitMandiBusinessException) {
|
| 159 |
LOGGER.error("ProfitMandi error: ", profitMandiBusinessException);
|
151 |
LOGGER.error("ProfitMandi error: ", profitMandiBusinessException);
|
| 160 |
final Response response=new Response(profitMandiBusinessException.getRejectedType(), profitMandiBusinessException.getRejectedValue(),profitMandiBusinessException.getCode(), profitMandiBusinessException.getMessage());
|
- |
|
| 161 |
final ProfitMandiResponse<Response> profitMandiResponse=new ProfitMandiResponse<Response>(LocalDateTime.now(), request.getRequestURL().toString(), HttpStatus.BAD_REQUEST.toString(), HttpStatus.BAD_REQUEST, ResponseStatus.FAILURE, response);
|
- |
|
| 162 |
return new ResponseEntity<>(profitMandiResponse,HttpStatus.BAD_REQUEST);
|
152 |
return responseSender.badRequest(profitMandiBusinessException);
|
| 163 |
}
|
153 |
}
|
| 164 |
}
|
154 |
}
|
| 165 |
|
155 |
|
| 166 |
@RequestMapping(value = ProfitMandiConstants.URL_USER_IS_EXIST_MOBILE_NUMBER, method = RequestMethod.GET)
|
156 |
@RequestMapping(value = ProfitMandiConstants.URL_USER_IS_EXIST_MOBILE_NUMBER, method = RequestMethod.GET)
|
| 167 |
public ResponseEntity<?> isMobileNumberExist(HttpServletRequest request, @RequestParam(name = "mobileNumber") String mobileNumber){
|
157 |
public ResponseEntity<?> isMobileNumberExist(HttpServletRequest request, @RequestParam(name = "mobileNumber") String mobileNumber){
|
| 168 |
LOGGER.info("requested url : "+request.getRequestURL().toString());
|
158 |
LOGGER.info("requested url : "+request.getRequestURL().toString());
|
| 169 |
final ProfitMandiResponse<?> profitMandiResponse=new ProfitMandiResponse<>(LocalDateTime.now(), request.getRequestURL().toString(), HttpStatus.OK.toString(), HttpStatus.OK, ResponseStatus.SUCCESS, userRepository.isExistByMobileNumber(mobileNumber));
|
- |
|
| 170 |
return new ResponseEntity<>(profitMandiResponse,HttpStatus.OK);
|
159 |
return responseSender.ok(userRepository.isExistByMobileNumber(mobileNumber));
|
| 171 |
}
|
160 |
}
|
| 172 |
|
161 |
|
| 173 |
|
162 |
|
| 174 |
@RequestMapping(value = ProfitMandiConstants.URL_USER_EMAIL_ID,method=RequestMethod.GET)
|
163 |
@RequestMapping(value = ProfitMandiConstants.URL_USER_EMAIL_ID,method=RequestMethod.GET)
|
| 175 |
public ResponseEntity<?> getByEmailId(HttpServletRequest request, @RequestParam(name = "emailId") String emailId){
|
164 |
public ResponseEntity<?> getByEmailId(HttpServletRequest request, @RequestParam(name = "emailId") String emailId){
|
| 176 |
LOGGER.info("requested url : "+request.getRequestURL().toString());
|
165 |
LOGGER.info("requested url : "+request.getRequestURL().toString());
|
| 177 |
try {
|
166 |
try {
|
| 178 |
final ProfitMandiResponse<?> profitMandiResponse=new ProfitMandiResponse<>(LocalDateTime.now(), request.getRequestURL().toString(), HttpStatus.OK.toString(), HttpStatus.OK, ResponseStatus.SUCCESS, userRepository.selectByEmailId(emailId));
|
- |
|
| 179 |
return new ResponseEntity<>(profitMandiResponse,HttpStatus.OK);
|
167 |
return responseSender.ok(userRepository.selectByEmailId(emailId));
|
| 180 |
}catch (ProfitMandiBusinessException profitMandiBusinessException) {
|
168 |
}catch (ProfitMandiBusinessException profitMandiBusinessException) {
|
| 181 |
LOGGER.error("ProfitMandi error: ", profitMandiBusinessException);
|
169 |
LOGGER.error("ProfitMandi error: ", profitMandiBusinessException);
|
| 182 |
final Response response=new Response(profitMandiBusinessException.getRejectedType(), profitMandiBusinessException.getRejectedValue(),profitMandiBusinessException.getCode(), profitMandiBusinessException.getMessage());
|
- |
|
| 183 |
final ProfitMandiResponse<Response> profitMandiResponse=new ProfitMandiResponse<Response>(LocalDateTime.now(), request.getRequestURL().toString(), HttpStatus.BAD_REQUEST.toString(), HttpStatus.BAD_REQUEST, ResponseStatus.FAILURE, response);
|
- |
|
| 184 |
return new ResponseEntity<>(profitMandiResponse,HttpStatus.BAD_REQUEST);
|
170 |
return responseSender.badRequest(profitMandiBusinessException);
|
| 185 |
}
|
171 |
}
|
| 186 |
}
|
172 |
}
|
| 187 |
|
173 |
|
| 188 |
@RequestMapping(value = ProfitMandiConstants.URL_USER_ROLE_ADD, method=RequestMethod.POST)
|
174 |
@RequestMapping(value = ProfitMandiConstants.URL_USER_ROLE_ADD, method=RequestMethod.POST)
|
| 189 |
public ResponseEntity<?> addRole(HttpServletRequest request, @RequestBody UserAddRoleRequest userAddRoleRequest){
|
175 |
public ResponseEntity<?> addRole(HttpServletRequest request, @RequestBody UserAddRoleRequest userAddRoleRequest){
|
| Line 206... |
Line 192... |
| 206 |
permissionRepository.persist(permission);
|
192 |
permissionRepository.persist(permission);
|
| 207 |
UserRole userRole = new UserRole();
|
193 |
UserRole userRole = new UserRole();
|
| 208 |
userRole.setRoleId(role.getId());
|
194 |
userRole.setRoleId(role.getId());
|
| 209 |
userRole.setUserId(user.getId());
|
195 |
userRole.setUserId(user.getId());
|
| 210 |
userRoleRepository.persist(userRole);
|
196 |
userRoleRepository.persist(userRole);
|
| 211 |
//role.setPermissionType(userAddRoleRequest.getRole().getPermissionType());
|
- |
|
| 212 |
final ProfitMandiResponse<?> profitMandiResponse=new ProfitMandiResponse<>(LocalDateTime.now(), request.getRequestURL().toString(), HttpStatus.OK.toString(), HttpStatus.OK, ResponseStatus.SUCCESS, "");
|
- |
|
| 213 |
return new ResponseEntity<>(profitMandiResponse,HttpStatus.OK);
|
197 |
return responseSender.ok("");
|
| 214 |
}catch (ProfitMandiBusinessException profitMandiBusinessException) {
|
198 |
}catch (ProfitMandiBusinessException profitMandiBusinessException) {
|
| 215 |
LOGGER.error("ProfitMandi error: ", profitMandiBusinessException);
|
199 |
LOGGER.error("ProfitMandi error: ", profitMandiBusinessException);
|
| 216 |
final Response response=new Response(profitMandiBusinessException.getRejectedType(), profitMandiBusinessException.getRejectedValue(),profitMandiBusinessException.getCode(), profitMandiBusinessException.getMessage());
|
- |
|
| 217 |
final ProfitMandiResponse<Response> profitMandiResponse=new ProfitMandiResponse<Response>(LocalDateTime.now(), request.getRequestURL().toString(), HttpStatus.BAD_REQUEST.toString(), HttpStatus.BAD_REQUEST, ResponseStatus.FAILURE, response);
|
- |
|
| 218 |
return new ResponseEntity<>(profitMandiResponse,HttpStatus.BAD_REQUEST);
|
200 |
return responseSender.badRequest(profitMandiBusinessException);
|
| 219 |
}
|
201 |
}
|
| 220 |
}
|
202 |
}
|
| 221 |
|
203 |
|
| 222 |
@RequestMapping(value = ProfitMandiConstants.URL_USER_ROLE_REMOVE,method=RequestMethod.DELETE)
|
204 |
@RequestMapping(value = ProfitMandiConstants.URL_USER_ROLE_REMOVE,method=RequestMethod.DELETE)
|
| 223 |
public ResponseEntity<?> removeRole(HttpServletRequest request, @RequestParam(name = "roleId") int roleId, @RequestParam(name = "userId") int userId){
|
205 |
public ResponseEntity<?> removeRole(HttpServletRequest request, @RequestParam(name = "roleId") int roleId, @RequestParam(name = "userId") int userId){
|
| Line 225... |
Line 207... |
| 225 |
try {
|
207 |
try {
|
| 226 |
roleRepository.selectById(roleId);
|
208 |
roleRepository.selectById(roleId);
|
| 227 |
userRepository.selectById(userId);
|
209 |
userRepository.selectById(userId);
|
| 228 |
userRoleRepository.deleteByUserAndRoleId(userId, roleId);
|
210 |
userRoleRepository.deleteByUserAndRoleId(userId, roleId);
|
| 229 |
permissionRepository.deleteByRoleId(roleId);
|
211 |
permissionRepository.deleteByRoleId(roleId);
|
| 230 |
final ProfitMandiResponse<?> profitMandiResponse=new ProfitMandiResponse<>(LocalDateTime.now(), request.getRequestURL().toString(), HttpStatus.OK.toString(), HttpStatus.OK, ResponseStatus.SUCCESS, "");
|
- |
|
| 231 |
return new ResponseEntity<>(profitMandiResponse,HttpStatus.OK);
|
212 |
return responseSender.ok("");
|
| 232 |
}catch (ProfitMandiBusinessException profitMandiBusinessException) {
|
213 |
}catch (ProfitMandiBusinessException profitMandiBusinessException) {
|
| 233 |
LOGGER.error("ProfitMandi error: ", profitMandiBusinessException);
|
214 |
LOGGER.error("ProfitMandi error: ", profitMandiBusinessException);
|
| 234 |
final Response response=new Response(profitMandiBusinessException.getRejectedType(), profitMandiBusinessException.getRejectedValue(),profitMandiBusinessException.getCode(), profitMandiBusinessException.getMessage());
|
- |
|
| 235 |
final ProfitMandiResponse<Response> profitMandiResponse=new ProfitMandiResponse<Response>(LocalDateTime.now(), request.getRequestURL().toString(), HttpStatus.BAD_REQUEST.toString(), HttpStatus.BAD_REQUEST, ResponseStatus.FAILURE, response);
|
- |
|
| 236 |
return new ResponseEntity<>(profitMandiResponse,HttpStatus.BAD_REQUEST);
|
215 |
return responseSender.badRequest(profitMandiBusinessException);
|
| 237 |
}
|
216 |
}
|
| 238 |
}
|
217 |
}
|
| 239 |
|
218 |
|
| 240 |
|
219 |
|
| 241 |
@RequestMapping(value = ProfitMandiConstants.URL_USER_ROLE_ALL,method=RequestMethod.GET)
|
220 |
@RequestMapping(value = ProfitMandiConstants.URL_USER_ROLE_ALL,method=RequestMethod.GET)
|
| 242 |
public ResponseEntity<?> getAllRoles(HttpServletRequest request, @RequestParam(name = "id") int id){
|
221 |
public ResponseEntity<?> getAllRoles(HttpServletRequest request, @RequestParam(name = "id") int id){
|
| 243 |
LOGGER.info("requested url : "+request.getRequestURL().toString());
|
222 |
LOGGER.info("requested url : "+request.getRequestURL().toString());
|
| 244 |
final ProfitMandiResponse<?> profitMandiResponse=new ProfitMandiResponse<>(LocalDateTime.now(), request.getRequestURL().toString(), HttpStatus.OK.toString(), HttpStatus.OK, ResponseStatus.SUCCESS, userRoleRepository.selectRolesByUserId(id));
|
- |
|
| 245 |
return new ResponseEntity<>(profitMandiResponse,HttpStatus.OK);
|
223 |
return responseSender.ok(userRoleRepository.selectRolesByUserId(id));
|
| 246 |
}
|
224 |
}
|
| 247 |
|
225 |
|
| 248 |
@RequestMapping(value = ProfitMandiConstants.URL_ADMIN_TOKEN, method = RequestMethod.POST)
|
226 |
@RequestMapping(value = ProfitMandiConstants.URL_ADMIN_TOKEN, method = RequestMethod.POST)
|
| 249 |
public ResponseEntity<?> getAdminToken(HttpServletRequest request, @RequestParam(name = "adminToken") String adminToken, @RequestParam(name = "emailId") String emailId){
|
227 |
public ResponseEntity<?> getAdminToken(HttpServletRequest request, @RequestParam(name = "adminToken") String adminToken, @RequestParam(name = "emailId") String emailId){
|
| 250 |
LOGGER.info("requested url : "+request.getRequestURL().toString());
|
228 |
LOGGER.info("requested url : "+request.getRequestURL().toString());
|
| Line 267... |
Line 245... |
| 267 |
responseMap.put(ProfitMandiConstants.REGISTERED, true);
|
245 |
responseMap.put(ProfitMandiConstants.REGISTERED, true);
|
| 268 |
}catch (ProfitMandiBusinessException profitMandiBusinessException) {
|
246 |
}catch (ProfitMandiBusinessException profitMandiBusinessException) {
|
| 269 |
responseMap.put(ProfitMandiConstants.TOKEN, JWTUtil.create());
|
247 |
responseMap.put(ProfitMandiConstants.TOKEN, JWTUtil.create());
|
| 270 |
responseMap.put(ProfitMandiConstants.REGISTERED, false);
|
248 |
responseMap.put(ProfitMandiConstants.REGISTERED, false);
|
| 271 |
}
|
249 |
}
|
| 272 |
final ProfitMandiResponse<?> profitMandiResponse=new ProfitMandiResponse<>(LocalDateTime.now(), request.getRequestURL().toString(), HttpStatus.OK.toString(), HttpStatus.OK, ResponseStatus.SUCCESS, responseMap);
|
- |
|
| 273 |
return new ResponseEntity<>(profitMandiResponse, HttpStatus.OK);
|
250 |
return responseSender.ok(responseMap);
|
| - |
|
251 |
|
| 274 |
}
|
252 |
}
|
| 275 |
}
|
253 |
}
|