Java 类org.springframework.web.bind.annotation.PostMapping 实例源码

项目:Learning-Spring-Boot-2.0-Second-Edition    文件:CommentController.java   
@PostMapping("/comments")
public Mono<String> addComment(Mono<Comment> newComment) {
    if (commentSink != null) {
        return newComment
            .map(comment -> {
                commentSink.next(MessageBuilder
                    .withPayload(comment)
                    .setHeader(MessageHeaders.CONTENT_TYPE,
                        MediaType.APPLICATION_JSON_VALUE)
                    .build());
                return comment;
            })
            .flatMap(comment -> {
                meterRegistry
                    .counter("comments.produced", "imageId", comment.getImageId())
                    .increment();
                return Mono.just("redirect:/");
            });
    } else {
        return Mono.just("redirect:/");
    }
}
项目:Blockchain-Academic-Verification-Service    文件:UnilogResource.java   
@PostMapping(value = "/upload/qualification", headers = "Accept=application/json")
@Secured({"ROLE_ADMIN", "ROLE_USER"})
@ResponseStatus(value = HttpStatus.ACCEPTED)
public String uploadQualifications(@ModelAttribute final com.unilog.app.representation.Qualification qualification,
                                   final HttpSession session, final Map<String, Object> model) throws UnsupportedEncodingException {
    checkSession(session);
    qualification.setIssuer((String) session.getAttribute("currentUser"));
    String result = userService.uploadQualification(qualification);
    if (result.equals("success")) {
        LOGGER.info("Adding qualifications");
        model.put("success", true);
        com.unilog.app.representation.Qualification emptyQualification = new com.unilog.app.representation.Qualification();
        emptyQualification.getTranscripts().add(new Transcript());
        emptyQualification.getTranscripts().add(new Transcript());
        model.put("qualification", emptyQualification);
    } else if (result.equals("qualificationError")) {
        model.put("qualificationError", true);
    } else {
        model.put("emailError", true);
    }
    return "qualification";
}
项目:personspringclouddemo    文件:PersonController.java   
/**
 * 新增用户
 * @param person
 * @param session
 * @return
 */
@PostMapping("/add")
public ServerResponse add(Person person,MultipartFile avatarFile,HttpSession session,HttpServletRequest request){
    if(person.getName().isEmpty()||person.getPwd().isEmpty()){
        return ServerResponse.createErrorResponse(400,"Name or Pwd is null.");
    }
    if(!checkLogin(session)){
        return ServerResponse.createErrorResponse(401,"Login Please.");
    }
    if(!avatarFile.isEmpty()){
        ServerResponse serverResponse=upload(avatarFile);
        if(serverResponse.getStatus()!=200){
            return serverResponse;
        }else{
            person.setAvatar((String) serverResponse.getData());
        }
    }
    return personService.addPerson(person);
}
项目:uis    文件:AdminUsersController.java   
@PostMapping("/create")
public String createUser(@Valid CreateUserForm form,
                         BindingResult bindingResult,
                         RedirectAttributes redirectAttributes) {
    if (bindingResult.hasErrors()) {
        redirectAttributes.addFlashAttribute("flashMessage", "admin.users.create.error." + bindingResult.getFieldError().getField());

        return "redirect:/admin/users";
    }
    boolean error = false;
    try{
        userCreationService.create(form.toUisUser());
    }catch(ValidationException e){
        error = true;
        redirectAttributes.addFlashAttribute("flashMessage", "admin.users.create.error.email");
    }
    if(!error){
        redirectAttributes.addFlashAttribute("flashMessage", "admin.users.create.success");
    }

    return "redirect:/admin/users";
}
项目:scoold    文件:CommentController.java   
@PostMapping("/{id}/delete")
public void deleteAjax(@PathVariable String id, HttpServletRequest req, HttpServletResponse res) {
    if (utils.isAuthenticated(req)) {
        Comment comment = pc.read(id);
        Profile authUser = utils.getAuthUser(req);
        boolean isMod = utils.isMod(authUser);
        if (comment != null && (comment.getCreatorid().equals(authUser.getId()) || isMod)) {
            // check parent and correct (for multi-parent-object pages)
            comment.delete();
            if (!isMod) {
                utils.addBadgeAndUpdate(authUser, DISCIPLINED, true);
            }
        }
    }
    res.setStatus(200);
}
项目:automat    文件:SysAuthorizeController.java   
@ApiOperation(value = "修改用户角色")
@PostMapping(value = "/user/update/role")
@RequiresPermissions("sys.permisson.userRole.update")
public Object userRole(ModelMap modelMap, @RequestBody List<SysUserRole> list) {
    Long userId = null;
    Long currentUserId = getCurrUser();
    for (SysUserRole sysUserRole : list) {
        if (sysUserRole.getUserId() != null) {
            if (userId != null && sysUserRole.getUserId() != null
                && userId.longValue() != sysUserRole.getUserId()) {
                throw new IllegalParameterException("参数错误.");
            }
            userId = sysUserRole.getUserId();
        }
        sysUserRole.setCreateBy(currentUserId);
        sysUserRole.setUpdateBy(currentUserId);
        sysUserRole.setCreateTime(new Date());
        sysUserRole.setUpdateTime(new Date());
    }
    Parameter parameter = new Parameter(getService(), "updateUserRole").setList(list);
    logger.info("{} execute updateUserRole start...", parameter.getNo());
    provider.execute(parameter);
    logger.info("{} execute updateUserRole end.", parameter.getNo());
    return setSuccessModelMap(modelMap);
}
项目:lib-edge    文件:PipeService.java   
/**
 * @param method method
 * @return String
 */
private String getMappingUrl(String requestMethod, Method method) {
  String[] mappingValue;
  switch (requestMethod) {
    case "POST":
      PostMapping postMapping = method.getAnnotation(PostMapping.class);
      mappingValue = postMapping.value().length != 0 ? postMapping.value() : postMapping.path();
      break;
    case "PUT":
      PutMapping putMapping = method.getAnnotation(PutMapping.class);
      mappingValue = putMapping.value().length != 0 ? putMapping.value() : putMapping.path();
      break;
    case "DELETE":
      DeleteMapping deleteMapping = method.getAnnotation(DeleteMapping.class);
      mappingValue = deleteMapping.value().length != 0 ? deleteMapping.value() : deleteMapping.path();
      break;
    default:
      GetMapping getMapping = method.getAnnotation(GetMapping.class);
      mappingValue = getMapping.value().length != 0 ? getMapping.value() : getMapping.path();
      break;
  }
  return mappingValue[0];
}
项目:easyweb    文件:UserController.java   
@ApiOperation(value = "用户添加界面")
@PostMapping("/edit")
@ResponseBody
public BaseResult edit(SysUser user){
    BaseResult result=new BaseResult(BaseResultCode.SUCCESS,"成功");
    SysUser curentUser= UserUtils.getUser();
    if(StringUtils.isEmpty(user.getId())){
        user.setCreateBy(curentUser.getId());
        user.setUpdateBy(curentUser.getId());
        String ecPwd= MD5Util.shiroPwd(user.getPassword(),user.getLoginName());
        user.setPassword(ecPwd);
        userService.insert(user);
    }else {
        user.setUpdateBy(curentUser.getId());
        userService.updateByPrimaryKeySelective(user);
    }
    return result;
}
项目:borabeber-api    文件:AuthenticationController.java   
/**
 * Gera e retorna um novo token JWT.
 * 
 * @param authenticationDto
 * @param result
 * @return ResponseEntity<Response<TokenDto>>
 * @throws AuthenticationException
 */
@PostMapping
public ResponseEntity<Response<TokenDto>> gerarTokenJwt(
        @Valid @RequestBody JwtAuthenticationDto authenticationDto, BindingResult result)
        throws AuthenticationException {
    Response<TokenDto> response = new Response<TokenDto>();

    if (result.hasErrors()) {
        log.error("Erro validando lançamento: {}", result.getAllErrors());
        result.getAllErrors().forEach(error -> response.getErrors().add(error.getDefaultMessage()));
        return ResponseEntity.badRequest().body(response);
    }

    log.info("Gerando token para o email {}.", authenticationDto.getEmail());
    Authentication authentication = authenticationManager.authenticate(new UsernamePasswordAuthenticationToken(
            authenticationDto.getEmail(), authenticationDto.getSenha()));
    SecurityContextHolder.getContext().setAuthentication(authentication);

    UserDetails userDetails = userDetailsService.loadUserByUsername(authenticationDto.getEmail());
    String token = jwtTokenUtil.obterToken(userDetails);
    response.setData(new TokenDto(token));

    return ResponseEntity.ok(response);
}
项目:mongodb-file-server    文件:FileController.java   
/**
 * 上传接口
 * @param file
 * @return
 */
@PostMapping("/upload")
@ResponseBody
public ResponseEntity<String> handleFileUpload(@RequestParam("file") MultipartFile file) {
    File returnFile = null;
    try {
        File f = new File(file.getOriginalFilename(),  file.getContentType(), file.getSize(),file.getBytes());
        f.setMd5( MD5Util.getMD5(file.getInputStream()) );
        returnFile = fileService.saveFile(f);
        String path = "//"+ serverAddress + ":" + serverPort + "/view/"+returnFile.getId();
        return ResponseEntity.status(HttpStatus.OK).body(path);

    } catch (IOException | NoSuchAlgorithmException ex) {
        ex.printStackTrace();
        return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(ex.getMessage());
    }

}
项目:automat    文件:SysAuthorizeController.java   
@ApiOperation(value = "修改角色操作权限")
@PostMapping(value = "/role/update/permission")
@RequiresPermissions("sys.permisson.role.update")
public Object updateRolePermission(ModelMap modelMap, @RequestBody List<SysRoleMenu> list) {
    Long roleId = null;
    Long userId = getCurrUser();
    for (SysRoleMenu sysRoleMenu : list) {
        if (sysRoleMenu.getRoleId() != null) {
            if (roleId != null && sysRoleMenu.getRoleId() != null
                && roleId.longValue() != sysRoleMenu.getRoleId()) {
                throw new IllegalParameterException("参数错误.");
            }
            roleId = sysRoleMenu.getRoleId();
        }
        sysRoleMenu.setCreateBy(userId);
        sysRoleMenu.setUpdateBy(userId);
        sysRoleMenu.setCreateTime(new Date());
        sysRoleMenu.setUpdateTime(new Date());
    }
    Parameter parameter = new Parameter(getService(), "updateRolePermission").setList(list);
    logger.info("{} execute updateRolePermission start...", parameter.getNo());
    provider.execute(parameter);
    logger.info("{} execute updateRolePermission end.", parameter.getNo());
    return setSuccessModelMap(modelMap);
}
项目:automat    文件:SysAuthorizeController.java   
@ApiOperation(value = "修改角色菜单")
@PostMapping(value = "/role/update/menu")
@RequiresPermissions("sys.permisson.roleMenu.update")
public Object roleMenu(ModelMap modelMap, @RequestBody List<SysRoleMenu> list) {
    Long roleId = null;
    Long userId = getCurrUser();
    for (SysRoleMenu sysRoleMenu : list) {
        if (sysRoleMenu.getRoleId() != null) {
            if (roleId != null && sysRoleMenu.getRoleId() != null
                && roleId.longValue() != sysRoleMenu.getRoleId()) {
                throw new IllegalParameterException("参数错误.");
            }
            roleId = sysRoleMenu.getRoleId();
        }
        sysRoleMenu.setCreateBy(userId);
        sysRoleMenu.setUpdateBy(userId);
        sysRoleMenu.setCreateTime(new Date());
        sysRoleMenu.setUpdateTime(new Date());
    }
    Parameter parameter = new Parameter(getService(), "updateRoleMenu");
    parameter.setList(list);
    logger.info("{} execute updateRoleMenu start...", parameter.getNo());
    provider.execute(parameter);
    logger.info("{} execute updateRoleMenu end.", parameter.getNo());
    return setSuccessModelMap(modelMap);
}
项目:easyweb    文件:MenuController.java   
@ApiOperation(value = "菜单管理-编辑接口")
@PostMapping("/edit")
@ResponseBody
public BaseResult edit(SysMenu model){
    BaseResult result=new BaseResult(BaseResultCode.SUCCESS,"成功");
    SysUser curentUser= UserUtils.getUser();
    if(StringUtils.isEmpty(model.getId())){
        model.setCreateBy(curentUser.getId());
        model.setUpdateBy(curentUser.getId());
        service.insert(model);
    }else {
        model.setUpdateBy(curentUser.getId());
        service.updateByPrimaryKeySelective(model);
    }
    return result;
}
项目:csap-core    文件:ExplorerRequests.java   
@PostMapping ( "/container/create" )
public ObjectNode containerCreate (
                                    boolean start,
                                    String usingImage,
                                    String name,
                                    String command,
                                    String entry,
                                    String workingDirectory,
                                    String networkMode,
                                    String restartPolicy,
                                    String runUser,
                                    String ports,
                                    String volumes,
                                    String environmentVariables,
                                    String limits )
        throws Exception {

    issueAudit( "creating container: " + name + " from image: " + usingImage, null );

    return dockerHelper.containerCreate(
        null, start, usingImage, name,
        command, entry, workingDirectory,
        networkMode, restartPolicy, runUser,
        ports, volumes, environmentVariables,
        limits );
}
项目:miaohu    文件:UserController.java   
@PostMapping("/login")
public JsonResult login(@RequestParam String phone, @RequestParam String password) {
    ErrorsMap errors = validator.existsValid(phone);
    if (errors.hasError())
        return new JsonResult(404, "登陆失败", errors);

    User user = service.login(phone, password);
    if (user == null) {
        errors.put("password", "密码错误");
        return new JsonResult(400, "登陆失败", errors);
    }
    else{
        return new JsonResult(0, "登陆成功",
                new HashMap() {{
                    put("token", jwtUtils.createJWT(user.getId(), user.getUserType()));
                }});
    }
}
项目:JavaQuarkBBS    文件:ReplyController.java   
@ApiOperation("发布回复接口")
@ApiImplicitParams({
        @ApiImplicitParam(name = "content", value = "回复内容", dataType = "String"),
        @ApiImplicitParam(name = "token", value = "用户令牌", dataType = "String"),
        @ApiImplicitParam(name = "postsId", value = "帖子ID", dataType = "Integer")
})
@PostMapping
public QuarkResult CreateReply(Reply reply,Integer postsId,String token){
    QuarkResult result = restProcessor(() -> {
        if (token == null) return QuarkResult.warn("请先登录!");

        User userbytoken = userService.getUserByToken(token);
        if (userbytoken == null) return QuarkResult.warn("用户不存在,请先登录!");

        User user = userService.findOne(userbytoken.getId());
        if (user.getEnable() != 1) return QuarkResult.warn("用户处于封禁状态!");

        replyService.saveReply(reply, postsId, user);
        return QuarkResult.ok();
    });
    return result;
}
项目:SpringBoot_Wechat_Sell    文件:SellerCategoryController.java   
@PostMapping("/save")
public ModelAndView save(@Valid CategoryForm form,
                         BindingResult bindingResult,
                         Map<String, Object> map) {
    if (bindingResult.hasErrors()) {
        map.put("msg", bindingResult.getFieldError().getDefaultMessage());
        map.put("url", "/sell/seller/category/index");
        return new ModelAndView("common/error", map);
    }

    ProductCategory productCategory = new ProductCategory();
    try {
        if (form.getCategoryId() != null) {
            productCategory = categoryService.findOne(form.getCategoryId());
        }
        BeanUtils.copyProperties(form, productCategory);
        categoryService.save(productCategory);
    } catch (SellException e) {
        map.put("msg", e.getMessage());
        map.put("url", "/seller/category/index");
        return new ModelAndView("common/error", map);
    }

    map.put("url", "/seller/category/list");
    return new ModelAndView("common/success", map);
}
项目:travel-agency    文件:VerifyController.java   
@ResponseBody
@PostMapping(URL)
public VerifyCheckResult check(@RequestBody Code code){

    String requestId = verifyAction.getRequestId();
    if(requestId == null){
        log.info("No requestId found.");
        return fail("Your code has expired, reload the page");
    }
    log.info("Verifing request ID {} code {}", requestId, code);
    Optional<CheckResult> checkResult = verifyService.check(requestId, code.getCode());

    if(checkResult.isPresent()){
        if(checkResult.get().getStatus() == CheckResult.STATUS_OK){
            log.info("Verification of Request ID was sucessfull", requestId);
            userUtils.getLoggedUserDetails().get().markTwoFaAsCompleted();
            return ok(verifyAction.getSuccessRedirectUrl());
        }

        return fail(checkResult.get().getErrorText());
    }
    return fail("Verification has failed");
}
项目:Blockchain-Academic-Verification-Service    文件:AdminResource.java   
@PostMapping(value = "/admin/portal", params = "action=Complete All")
@ResponseStatus(value = HttpStatus.ACCEPTED)
@Secured("ROLE_ADMIN")
public String adminPortalPublishAllUsers(final Map<String, Object> model) {
    try {
        String result = adminService.completeAllAccounts();
        if (result.equals("allSuccess")) {
            model.put(result, true);
        } else if (result.equals("partialSuccess")) {
            model.put(result, true);
        } else { //zeroSuccess
            model.put(result, true);
        }
    } catch (Exception e) {
        e.printStackTrace();
        model.put("publishError", true);
    }
    model.put("adminWindow", adminService.generateAdminWindow());
    return "adminPortal";
}
项目:automat    文件:ScheduledController.java   
@PostMapping
@ApiOperation(value = "新增任务")
@RequiresPermissions("sys.task.scheduled.update")
public Object updateTask(@RequestBody TaskScheduled scheduled, ModelMap modelMap) {
    Assert.notNull(scheduled.getTaskGroup(), "TASKGROUP");
    Assert.notNull(scheduled.getTaskName(), "TASKNAME");
    Assert.notNull(scheduled.getJobType(), "JOBTYPE");
    Assert.notNull(scheduled.getTaskType(), "TASKTYPE");
    Assert.notNull(scheduled.getTargetObject(), "TARGETOBJECT");
    Assert.notNull(scheduled.getTargetMethod(), "TARGETMETHOD");
    Assert.notNull(scheduled.getTaskCron(), "TASKCRON");
    Assert.notNull(scheduled.getTaskDesc(), "TASKDESC");
    if (TaskType.dubbo.equals(scheduled.getTaskType())) {
        Assert.notNull(scheduled.getTargetSystem(), "TARGETSYSTEM");
    }
    Parameter parameter = new Parameter(getService(), "updateTask").setModel(scheduled);
    provider.execute(parameter);
    return setSuccessModelMap(modelMap);
}
项目:xm-uaa    文件:UserResource.java   
/**
 * POST /users : Creates a new user.
 *
 * <p>Creates a new user if the login and email are not already used, and sends an mail with an
 * activation link. The user needs to be activated on creation.
 * @param user the user to create
 * @return the ResponseEntity with status 201 (Created) and with body the new user, or with
 *         status 400 (Bad Request) if the login or email is already in use
 * @throws URISyntaxException if the Location URI syntax is incorrect
 */
@PostMapping("/users")
@Timed
@Secured(AuthoritiesConstants.ADMIN)
public ResponseEntity createUser(@Valid @RequestBody UserDTO user) throws URISyntaxException {
    if (user.getId() != null) {
        return ResponseEntity.badRequest()
            .headers(HeaderUtil.createFailureAlert(ENTITY_NAME, "idexists", "A new user cannot already have an ID"))
            .body(null);
    }
    user.getLogins().forEach(userLogin ->
        userLoginRepository.findOneByLoginIgnoreCase(userLogin.getLogin())
            .ifPresent(s -> {
                throw new BusinessException(Constants.LOGIN_IS_USED_ERROR_TEXT);
            })
    );
    User newUser = userService.createUser(user);
    produceEvent(new UserDTO(newUser), Constants.CREATE_PROFILE_EVENT_TYPE);
    mailService.sendCreationEmail(newUser, TenantUtil.getApplicationUrl(),
        TenantContext.getCurrent().getTenant(), MDCUtil.getRid());
    return ResponseEntity.created(new URI("/api/users/" + newUser.getUserKey()))
        .headers(HeaderUtil.createAlert("userManagement.created", newUser.getUserKey()))
        .body(new UserDTO(newUser));
}
项目:JAVA-    文件:SysAuthorizeController.java   
@ApiOperation(value = "修改用户角色")
@PostMapping(value = "/user/update/role")
@RequiresPermissions("sys.permisson.userRole.update")
public Object userRole(ModelMap modelMap, @RequestBody List<SysUserRole> list) {
    Long userId = null;
    Long currentUserId = getCurrUser();
    for (SysUserRole sysUserRole : list) {
        if (sysUserRole.getUserId() != null) {
            if (userId != null && sysUserRole.getUserId() != null
                && userId.longValue() != sysUserRole.getUserId()) {
                throw new IllegalParameterException("参数错误.");
            }
            userId = sysUserRole.getUserId();
        }
        sysUserRole.setCreateBy(currentUserId);
        sysUserRole.setUpdateBy(currentUserId);
        sysUserRole.setCreateTime(new Date());
        sysUserRole.setUpdateTime(new Date());
    }
    Parameter parameter = new Parameter(getService(), "updateUserRole").setList(list);
    logger.info("{} execute updateUserRole start...", parameter.getNo());
    provider.execute(parameter);
    logger.info("{} execute updateUserRole end.", parameter.getNo());
    return setSuccessModelMap(modelMap);
}
项目:media_information_service    文件:MainController.java   
@PostMapping("/result_music")
public String mediaMusicSubmit(@ModelAttribute Media media, Model model, HttpServletRequest request ) {
    LinkedList<MusicInfo> a = null;
    String maxResult= media.getMaxResult();
    if (maxResult.equals("")) maxResult="10";
    if(media.getTitle().equals("") && media.getAuthor().equals("")) return "media_music";
    try {
        if (media.getService().equals("itunes")) a = APIOperations.musicGetInfoItunes(media.getTitle(), maxResult,media.getOrderBy(),media.getAuthor(),media.getYear());
        else {
            a = APIOperations.musicGetInfoDiscogs(media.getTitle(), maxResult,"FILE,MP3,Single",media.getOrderBy(),media.getAuthor(),media.getYear());
        }
    } catch (Exception e) {
        e.printStackTrace();
        return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).toString();
    }
    RabbitSend.sendMediaRequest(media.getTitle(),"Music",request);
    if (a.size()==0) return "no_result";
    model.addAttribute("mediaList", a);
    if (media.getService().equals("itunes")) return "result_music_itunes";
    else return "result_music";
}
项目:interview-question-code    文件:IndexContoller.java   
@PostMapping("/putArticle")
@ResponseBody
public String putArticle(@RequestParam("artical") String artical, HttpServletRequest request) throws ValidationException {

       String safeArtical = ESAPI.validator().getValidSafeHTML("htmlInput", artical, 1000, true);

    return "{status:ok}";
}
项目:csap-core    文件:ExplorerRequests.java   
@PostMapping ( "/container/stop" )
public ObjectNode containerStop (
                                    String id,
                                    String name,
                                    boolean kill,
                                    int stopSeconds )
        throws Exception {

    issueAudit( "starting container: " + name, null );

    return dockerHelper.containerStop( id, name, kill, stopSeconds );
}
项目:theskeleton    文件:RegistrationRestController.java   
@PostMapping
public RegistrationForm register(@RequestBody @Valid RegistrationForm registrationForm) {
    UserEntity user = registrationService.registerUser(registrationForm);
    if (user != null && user.getId() != null)
        tokenStoreService.sendTokenNotification(TokenStoreType.USER_ACTIVATION, user);
    return registrationForm;
}
项目:bird-java    文件:SchedulerController.java   
@PostMapping(value = "/deleteLog")
public OperationResult deleteLog(Long id){
    Check.GreaterThan(id,0L,"id");
    logService.softDelete(id);

    return OperationResult.Success("删除成功",null);
}
项目:CMSdemo    文件:AdvertiseController.java   
@PostMapping("/searchAds")
public ServerResponse searchAds(HttpSession session,String userId,String startDate,String endDate){
    Map<String,Object> map=new HashMap<>();
    if(userId!=null){
        map.put("userId",userId);
    }
    if(startDate!=null&&endDate!=null){
        map.put("startDate", StringUtils.trimAllWhitespace(startDate));
        map.put("endDate",StringUtils.trimAllWhitespace(endDate));
    }
    String userSessionId= (String) session.getAttribute("userSessionId");
    return ServerResponse.createSuccessResponse(advertiseService.findConditions(map,userSessionId));
}
项目:myfavor    文件:AccountController.java   
@PostMapping("/login")
public JsonMap login(HttpServletRequest request, @RequestBody Account account){
    Account actAccount = accountService.checkUsernameAndPassword(account.getUsername(), account.getPassword());

    String status = "success";
    if (accountService.isNeedChangePassword(actAccount)){
        status = "needChangePassword";
    }
    RequestContext.storeAccountInSession(request, actAccount);
    return success();
}
项目:spring-ddd-bank    文件:ApplicationController.java   
@PostMapping("/client/deposit")
  public ResponseEntity<Void> deposit(@RequestBody  final DepositCommand command,
        final HttpMethod method, final WebRequest request
        ){
_print(method, request);
final Client client = _findClient(request);
    final Account destinationAccount = client.findAccount(command.accountId).get();
    final Amount amount = new Amount(command.amount);
    client.deposit(destinationAccount, amount);
      return new ResponseEntity<>(HttpStatus.NO_CONTENT);
  }
项目:happylifeplat-transaction    文件:PayController.java   
@PostMapping("/aliPayFail")
@ApiOperation("当alipay支付异常的时候,pay表的数据不会新增 alipay表不会新增 wechat表不会新增")
public String aliPayFail() {

    try {
        payService.payWithAliPayFail();
    } catch (Exception e) {
        e.printStackTrace();
        return "aili pay fail and pay not commit";
    }

    return "success";
}
项目:automat    文件:SysUserController.java   
@ApiOperation(value = "修改个人信息")
@PostMapping(value = "/update/person")
public Object updatePerson(ModelMap modelMap, @RequestBody SysUser param) {
    param.setId(getCurrUser());
    param.setPassword(null);
    Assert.isNotBlank(param.getAccount(), "ACCOUNT");
    Assert.length(param.getAccount(), 3, 15, "ACCOUNT");
    return super.update(modelMap, param);
}
项目:Blockchain-Academic-Verification-Service    文件:AdminResource.java   
@PostMapping(value = "/admin/portal", params = "action=Register")
@ResponseStatus(value = HttpStatus.ACCEPTED)
@Secured("ROLE_ADMIN")
public String adminPortalRegisterUser(@ModelAttribute final AdminWindow request, final Map<String, Object> model) {
    if (!adminService.registerAccount(request)) {
        model.put("registrationError", true);
    } else {
        model.put("registrationSuccess", true);
    }
    model.put("adminWindow", adminService.generateAdminWindow());
    return "adminPortal";
}
项目:restdocs-raml    文件:RamlResourceSnippetIntegrationTest.java   
@PostMapping(path = "/some/{someId}/other/{otherId}")
public ResponseEntity<Resource<TestDateHolder>> doSomething(@PathVariable String someId,
                                                           @PathVariable Integer otherId,
                                                           @RequestBody TestDateHolder testDateHolder) {
    testDateHolder.setId(UUID.randomUUID().toString());
    Resource<TestDateHolder> resource = new Resource<>(testDateHolder);
    resource.add(linkTo(methodOn(TestController.class).doSomething(someId, otherId, null)).withSelfRel());
    return ResponseEntity.ok(resource);
}
项目:SaleWeb    文件:SaleWebController.java   
@PostMapping("/comentario/articulo/{id}")
public String comentar (Model model, Comentario comentario, @PathVariable long id, HttpSession sesion){

    //Guardo el comentario escrito creado
    Articulo articulo = articulo_repository.findOne(id);
    comentario.setArticulo(articulo);
    Usuario usuario = usuario_repository.findByEmail((String) sesion.getAttribute("email"));
    comentario.setAutor(usuario);
    articulo.getComentarios().add(comentario);
    comentario_repository.save(comentario);
    return "comentario_guardado";
}
项目:Building-Web-Apps-with-Spring-5-and-Angular    文件:UserAccountController.java   
@PostMapping(value="/signup")
public ExecutionStatus processSignup(ModelMap model, @RequestBody User reqUser) {
    User user = null;
    try {
        user = userService.doesUserExist(reqUser.getEmail());
    } catch (UserNotFoundException e) {
    }
    if(user != null) {
        return new ExecutionStatus("USER_ACCOUNT_EXISTS", "User account with same email address exists. Please try again!");
    }
    user = new User();
    user.setEmail(reqUser.getEmail());
    user.setPassword(reqUser.getPassword());
    user.setFirstName(reqUser.getFirstname());
    user.setLastname(reqUser.getLastname());
    user.setContactNumber(reqUser.getContactNumber());
    user.setAlternateContactNumber(reqUser.getAlternateContactNumber());
    user.setCityCode(reqUser.getCityCode());
    user.setStateCode(reqUser.getStateCode());
    user.setCountryCode(reqUser.getCountryCode());
    user.setAge(reqUser.getAge());
    user.setGender(reqUser.getGender());
    user.setRole(reqUser.getRole());
    User persistedUser = userService.save(user);
    //
    // Add entry in doctor table if user is a doctor
    //
    docService.addDoctor(user);

    return new ExecutionStatus("USER_ACCOUNT_CREATED", "User account successfully created");
}
项目:iBase4J    文件:LoginController.java   
@ApiOperation(value = "用户登录")
@PostMapping("/login")
public Object login(@RequestBody SysUser sysUser, ModelMap modelMap, HttpServletRequest request) {
    Assert.notNull(sysUser.getAccount(), "ACCOUNT");
    Assert.notNull(sysUser.getPassword(), "PASSWORD");
    if (LoginHelper.login(sysUser.getAccount(), SecurityUtil.encryptPassword(sysUser.getPassword()))) {
        request.setAttribute("msg", "[" + sysUser.getAccount() + "]登录成功.");
        return setSuccessModelMap(modelMap);
    }
    request.setAttribute("msg", "[" + sysUser.getAccount() + "]登录失败.");
    throw new LoginException(Resources.getMessage("LOGIN_FAIL"));
}
项目:OAuth-2.0-Cookbook    文件:ProfileController.java   
@PostMapping
public ModelAndView save(Profile profile) {
    GoogleUser user = (GoogleUser) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
    profile.setUser(user);

    Profile newProfile = profileRepository.save(profile);
    ModelAndView mv = new ModelAndView("redirect:/profile");
    mv.addObject("profile", newProfile);
    return mv;
}
项目:aces-backend    文件:TestContractController.java   
@PostMapping("/test-contracts")
public TestContractView createContract(
        @RequestParam("returnArkAddress") String returnArkAddress,
        @RequestParam("donationArkAmount") String donationArkAmount
) {
    BigDecimal donationArkAmountValue = new BigDecimal(donationArkAmount);

    BigDecimal requiredArkAmount = donationArkAmountValue.add(arkTransactionFee);

    TestContractEntity testContractEntity = new TestContractEntity();
    testContractEntity.setToken(UUID.randomUUID().toString());
    testContractEntity.setCreatedAt(ZonedDateTime.from(Instant.now().atOffset(ZoneOffset.UTC)));
    testContractEntity.setStatus(TestContractEntity.STATUS_PENDING);
    testContractEntity.setServiceArkAddress(serviceArkAddress);
    testContractEntity.setDonationArkAmount(donationArkAmountValue.setScale(8, BigDecimal.ROUND_UP));
    testContractEntity.setReturnArkAddress(returnArkAddress);
    testContractEntity.setRequiredArkAmount(requiredArkAmount);
    testContractRepository.save(testContractEntity);

    // Register contract message with listener so we get a callback when a matching ark transaction is found
    CreateMessageRequest createMessageRequest = new CreateMessageRequest();
    createMessageRequest.setCallbackUrl("http://localhost:8080/test-contracts/ark-transaction-matches");
    createMessageRequest.setToken(testContractEntity.getToken());
    listenerRestTemplate.postForObject("/messages", createMessageRequest, Void.class);

    return testContractViewMapper.map(testContractEntity);
}
项目:happylifeplat-tcc    文件:CompensationController.java   
@PostMapping(value = "/update")
@Permission
public AjaxResponse update(@RequestBody CompensationDTO compensationDTO) {
    if (recoverRetryMax < compensationDTO.getRetry()) {
        return AjaxResponse.error("重试次数超过最大设置,请您重新设置!");
    }
    final Boolean success = compensationService.updateRetry(compensationDTO.getId(),
            compensationDTO.getRetry(), compensationDTO.getApplicationName());
    return AjaxResponse.success(success);

}