-2
@RequestMapping(path = "/registrationuser", method = RequestMethod.POST, produces=MediaType.APPLICATION_JSON_VALUE, consumes=MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<?> getUserDetails(@RequestBody Map<String, Object> input) throws commonException {
Map<String, Object> retMap = new HashMap<String, Object>();
String email=(String) input.get("email");
long id=(Long) input.get("userid");
String password=(String) input.get("password");
String rollid="1";
User user = new User();
user.setEmail(email);
user.setId(id);
user.setPassword(bCryptPasswordEncoder.encode(password));
userRepository.save(user);
ResponseEntity<Map<String, Object>> retValue = new ResponseEntity<Map<String,Object>>(retMap, HttpStatus.OK);
return retValue;
}
===@RequestBody地圖<字符串,對象>輸入獲取int值
$scope.saveUserFunction = function(myVar) {
console.log($scope.edituserdetails.email);
console.log($scope.edituserdetails.email);
console.log($scope.edituserdetails.username);
console.log($scope.edituserdetails.password);
console.log($scope.edituserdetails.id);
console.log($scope.token);
//$scope.user = {};
// calling our submit function.
$http({
method : "POST",
url : "/registrationuser",
data : {
"email" : $scope.edituserdetails.email,
"username": $scope.edituserdetails.username,
"password" : $scope.edituserdetails.password,
"userid": $scope.edituserdetails.id
}
})
.success(function(data) {
if (data.errors) {
} else {
// $scope.message = data.message;
}
});
}
});
獲取用戶ID的以下錯誤。爲什麼它是整數。我需要投射它以及長時間?