| Line 30... |
Line 30... |
| 30 |
import com.spice.profitmandi.common.ResponseCodeHolder;
|
30 |
import com.spice.profitmandi.common.ResponseCodeHolder;
|
| 31 |
import com.spice.profitmandi.common.enumuration.SchemeType;
|
31 |
import com.spice.profitmandi.common.enumuration.SchemeType;
|
| 32 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
32 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
| 33 |
import com.spice.profitmandi.common.model.ProfitMandiConstants;
|
33 |
import com.spice.profitmandi.common.model.ProfitMandiConstants;
|
| 34 |
import com.spice.profitmandi.common.model.ProfitMandiResponse;
|
34 |
import com.spice.profitmandi.common.model.ProfitMandiResponse;
|
| - |
|
35 |
import com.spice.profitmandi.common.model.RegisteredUserInfo;
|
| 35 |
import com.spice.profitmandi.common.model.ResponseStatus;
|
36 |
import com.spice.profitmandi.common.model.ResponseStatus;
|
| 36 |
import com.spice.profitmandi.common.model.UserInfo;
|
37 |
import com.spice.profitmandi.common.model.UserInfo;
|
| 37 |
import com.spice.profitmandi.common.util.JWTUtil;
|
38 |
import com.spice.profitmandi.common.util.JWTUtil;
|
| 38 |
import com.spice.profitmandi.common.web.client.RestClient;
|
39 |
import com.spice.profitmandi.common.web.client.RestClient;
|
| 39 |
import com.spice.profitmandi.common.web.util.ResponseSender;
|
40 |
import com.spice.profitmandi.common.web.util.ResponseSender;
|
| Line 205... |
Line 206... |
| 205 |
@Override
|
206 |
@Override
|
| 206 |
public boolean test(UserRole t) {
|
207 |
public boolean test(UserRole t) {
|
| 207 |
return t.getRoleType() == RoleType.USER;
|
208 |
return t.getRoleType() == RoleType.USER;
|
| 208 |
}
|
209 |
}
|
| 209 |
})) {
|
210 |
})) {
|
| - |
|
211 |
responseMap.put("userInfo", getRegisteredUserInfo(userInfo.getUserId()));
|
| 210 |
responseMap.put(ProfitMandiConstants.USER_STATUS, UserStatus.REGISTERED.getValue());
|
212 |
responseMap.put(ProfitMandiConstants.USER_STATUS, UserStatus.REGISTERED.getValue());
|
| 211 |
}
|
213 |
}
|
| 212 |
} else {
|
214 |
} else {
|
| 213 |
responseMap.put(ProfitMandiConstants.USER_STATUS, UserStatus.NOT_REGISTERED.getValue());
|
215 |
responseMap.put(ProfitMandiConstants.USER_STATUS, UserStatus.NOT_REGISTERED.getValue());
|
| 214 |
responseMap.put(ProfitMandiConstants.EMAIL_ID, userInfo.getEmail());
|
216 |
responseMap.put(ProfitMandiConstants.EMAIL_ID, userInfo.getEmail());
|
| 215 |
}
|
217 |
}
|
| 216 |
|
218 |
|
| 217 |
return responseSender.ok(responseMap);
|
219 |
return responseSender.ok(responseMap);
|
| 218 |
}
|
220 |
}
|
| - |
|
221 |
|
| - |
|
222 |
private RegisteredUserInfo getRegisteredUserInfo(int userId) throws Throwable {
|
| - |
|
223 |
RegisteredUserInfo ri = new RegisteredUserInfo();
|
| - |
|
224 |
User user = userRepository.selectById(userId);
|
| - |
|
225 |
ri.setCity(user.getCity());
|
| - |
|
226 |
ri.setFirstName(user.getFirstName());
|
| - |
|
227 |
ri.setLastName(user.getLastName());
|
| - |
|
228 |
ri.setPhone(user.getCity());
|
| - |
|
229 |
ri.setPinCode(user.getPinCode());
|
| - |
|
230 |
return ri;
|
| - |
|
231 |
}
|
| 219 |
|
232 |
|
| 220 |
@RequestMapping(value = ProfitMandiConstants.URL_USER, method = RequestMethod.POST)
|
233 |
@RequestMapping(value = ProfitMandiConstants.URL_USER, method = RequestMethod.POST)
|
| 221 |
@ApiImplicitParams({
|
234 |
@ApiImplicitParams({
|
| 222 |
@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header") })
|
235 |
@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header") })
|
| 223 |
public ResponseEntity<?> createUser(HttpServletRequest request, @RequestBody UserRequest userRequest)
|
236 |
public ResponseEntity<?> createUser(HttpServletRequest request, @RequestBody UserRequest userRequest)
|