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

项目:app-auth-example    文件:DirectoryWebhookController.java   
/**
 * Create / update pod info.  This endpoint is protected by an "API key" to prevent unauthorized access which
 * could inject bogus pod information into the PodDirectory. For this implementation, the API key is just a
 * hardcoded constant.  Real implementations probably want something more secure - at least a different API key
 * for each pod. The API key is passed as an HTTP header value with name "X-API-KEY".
 *
 * @param podInfo PodInfo object containing metadata about a pod
 * @param apiKey API Key.  Comes from HTTP Header value "X-API-KEY"
 *
 * @return HTTP 401 - if API key missing or invalid<br/>
 *         HTTP 400 - if PodInfo bad or missing<br/>
 *         HTTP 200 - otherwise.
 */
@RequestMapping(method = RequestMethod.POST, path = "/podInfo")
public ResponseEntity updatePodInfo(@RequestBody PodInfo podInfo, @RequestHeader("X-API-KEY") String apiKey) {

    // Check API key
    if (StringUtils.isEmpty(apiKey) || !webhookConfiguration.getApiKey().equals(apiKey)) {
        return new ResponseEntity(HttpStatus.UNAUTHORIZED);
    }

    // Ensure pod info present and at least has company ID.
    if (StringUtils.isEmpty(podInfo.getCompanyId())) {
        return new ResponseEntity(HttpStatus.BAD_REQUEST);
    }

    // Store pod info
    podDirectory.addPodInfo(podInfo);

    return new ResponseEntity(HttpStatus.OK);

}
项目:Spring-Boot-Server    文件:AppUserEvaluateRestful.java   
@RequestMapping(value = "/updateOE_HEL_SP_AI_Stars")
@ResponseBody
public PageData updateOE_HEL_SP_AI_Stars(@RequestBody PageData pd) throws Exception {
    if (StringUtils.isBlank(pd.getString("OE_TYPE"))) {
        return WebResult.requestFailed(10001, "参数缺失!", null);
    }
    else {
        if("1".equals(pd.getString("OE_TYPE"))){//专家
            appUserEvaluateMapper.updateHEL_STARS(pd);
        }else if("2".equals(pd.getString("OE_TYPE"))){//代理
            appUserEvaluateMapper.updateSP_STARS(pd);
        }else if("3".equals(pd.getString("OE_TYPE"))){//陪诊
            appUserEvaluateMapper.updateAI_STARS(pd);
        }
        return WebResult.requestSuccess();
    }
}
项目:Spring-Boot-Server    文件:AppDoctorInfoRestful.java   
/**
 * 医生信息
 * @return
 */
@RequestMapping(value = "/get")
@ResponseBody
public PageData getDoctorInfo(@RequestBody PageData pd) throws Exception {
    if (StringUtils.isBlank(pd.getString("HEL_ID"))) {
        return WebResult.requestFailed(10001, "参数缺失!", null);
    }
    else {
        PageData earnestMoney = appServiceMapper.getEarestMoney();
        String searnestMoney = earnestMoney.getString("CODE");
        float f = Float.valueOf("500");
        if (StringUtils.isNotBlank(searnestMoney)) {
            f = Float.valueOf(searnestMoney);
        }
        PageData accInfo = appDoctorInfoMapper.getDoctorInfo(pd);
        accInfo.put("EARNEST_MONEY", f);
        List<PageData> videoList = appDoctorInfoMapper.getDoctorVideoList(pd);
        accInfo.put("videoList", videoList);
        List<PageData> deptVideoList = appDoctorInfoMapper.getDeptVideoList(accInfo);
        accInfo.put("deptVideoList", deptVideoList);
        return WebResult.requestSuccess(accInfo);
    }
}
项目:calculator    文件:CalcController.java   
@PostMapping("history")
public ResponseEntity<?> add(@RequestBody CalcEntry entry) {

    try
    {
        entry = CalcWorker.getResult( entry );
    }
    catch (CalcException e)
    {
        LOGGER.error("Exception while calculation result for {}", entry.getOperation());
        // TODO: Stacktrace in logger

        // TODO: Error Message (not only Error Status) to Frontend?
        return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).build();
    }

    return ResponseEntity.ok(repo.save(entry));
}
项目:CommonInformationSpace    文件:CISCoreConnectorRestController.java   
@RequestMapping(value = "/CISCore/postmessage/other", method = RequestMethod.POST)
public ResponseEntity<Response> testConnectorCallback(@RequestBody CISOtherContent otherpayload) {
    log.info("--> testConnectorCallback");
    Response response = new Response();

    log.info(otherpayload);

    log.info("testConnectorCallback -->");
    return new ResponseEntity<Response>(response, HttpStatus.OK);
}
项目:jobManage    文件:JobManageController.java   
/**
     * 更新当前全部记录
     * @throws InterruptedException 
     * @throws IOException 
     */
    @RequestMapping(value= "/updateAllRecord", method=RequestMethod.POST)
    public String updateAllRecord(@RequestBody List<Object> updateRecordList) throws IOException, InterruptedException {
        String executeFile = getExecuteFile();
        ArrayList<Thread> threadList = new ArrayList<Thread>();
        for(int i=0; i < updateRecordList.size(); i++) {
            HashMap<String, String> allRecord = (HashMap<String, String>) updateRecordList.get(i);
//          executePy(allRecord.get("jobTable"), allRecord.get("jobPath"), allRecord.get("jobName"), 
//                  allRecord.get("jobDay"), allRecord.get("jobType"), executeFile);
            Thread newThread = new Thread(new MyRunable(allRecord, executeFile));
            newThread.start();
            threadList.add(newThread);

        }

        for(Thread thread: threadList) {
            thread.join();
        } 

        System.out.println("主线程执行完毕");
        return "index";
    }
项目:va-vedem-api    文件:MailAPI.java   
@ApiOperation(value = "Trimite email.", tags = {"email"})
@RequestMapping(value = {"/mail"}, method = {RequestMethod.POST}, produces = MediaType.APPLICATION_JSON_VALUE,
        consumes = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody
public ResponseEntity<String> sendEmail(@RequestBody @Valid EmailModel model) {
    logger.info("start: trimitere email");

    try {
        mailService.send(model);
    } catch (VaVedemApiException ex) {
        if (ex instanceof VaVedemEmailException) {
            logger.info(ex.getMessage());
            return new ResponseEntity("error send email", HttpStatus.BAD_REQUEST);
        }
    }

    return new ResponseEntity<String>(HttpStatus.OK);
}
项目:participants1b    文件:UpdateInfoController.java   
@RequestMapping(
        value = "/changeInfo",
        method = RequestMethod.POST, produces = { MediaType.APPLICATION_JSON_VALUE, MediaType.APPLICATION_XML_VALUE },
        consumes = { MediaType.APPLICATION_JSON_VALUE, MediaType.APPLICATION_XML_VALUE })
public ResponseEntity<ChangePasswordInfo> postHTML2(@RequestBody ChangePassword info){

    if (info.getEmail() == null || info.getPassword() == null || info.getNewPassword() == null
            || info.getEmail().equals("") || info.getPassword().equals("") || info.getNewPassword().equals("")) {
        throw new HTTP404Exception("No se han introducido todos los datos");
    }

    Ciudadano ci = updateInfo.UpdateCitizen(info);

    if (ci == null) {
        throw new HTTP404Exception("Email o contraseña incorrectas");
    }


    return new ResponseEntity<ChangePasswordInfo>(new ChangePasswordInfo("Se ha cambiado correctamente la contraseña"),
            HttpStatus.OK);
}
项目: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);
}
项目:cas-server-4.2.1    文件:RegisteredServiceSimpleFormController.java   
/**
 * Adds the service to the Service Registry.
 * @param request the request
 * @param response the response
 * @param result the result
 * @param service the edit bean
 */
@RequestMapping(method = RequestMethod.POST, value = {"saveService.html"})
public void saveService(final HttpServletRequest request,
                        final HttpServletResponse response,
                        @RequestBody final RegisteredServiceEditBean.ServiceData service,
                        final BindingResult result) {
    try {

        final RegisteredService svcToUse = registeredServiceFactory.createRegisteredService(service);
        final RegisteredService newSvc = this.servicesManager.save(svcToUse);
        logger.info("Saved changes to service {}", svcToUse.getId());

        final Map<String, Object> model = new HashMap<>();
        model.put("id", newSvc.getId());
        model.put("status", HttpServletResponse.SC_OK);
        JsonViewUtils.render(model, response);

    } catch (final Exception e) {
        throw new RuntimeException(e);
    }
}
项目:NGB-master    文件:BedController.java   
@ResponseBody
@RequestMapping(value = "/bed/track/histogram", method = RequestMethod.POST)
@ApiOperation(
        value = "Returns a histogram of BED records amount on regions of chromosome",
        notes = "It provides histogram for a BEd track with the given scale factor between the " +
                "beginning position with the first base having position 1 and ending position inclusive " +
                "in a target chromosome. All parameters are mandatory and described below:<br/><br/>" +
                "1) <b>id</b> specifies ID of a track;<br/>" +
                "2) <b>chromosomeId</b> specifies ID of a chromosome corresponded to a track;<br/>" +
                "3) <b>startIndex</b> is the most left base position for a requested window. The first base in a " +
                "chromosome always has got position 1;<br/>" +
                "4) <b>endIndex</b> is the last base position for a requested window. " +
                "It is treated inclusively;<br/>" +
                "5) <b>scaleFactor</b> specifies an inverse value to number of bases per one visible element" +
                " on a track (e.g., pixel) - IS IGNORED FOR NOW",
        produces = MediaType.APPLICATION_JSON_VALUE)
@ApiResponses(
        value = {@ApiResponse(code = HTTP_STATUS_OK, message = API_STATUS_DESCRIPTION)
        })
public Result<Track<Wig>> loadHistogram(@RequestBody final TrackQuery trackQuery)
        throws HistogramReadingException {
    final Track<Wig> histogramTrack = convertToTrack(trackQuery);
    return Result.success(bedManager.loadHistogram(histogramTrack));
}
项目:iBase4J    文件: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");
    }
    scheduledService.updateTask(scheduled);
    return setSuccessModelMap(modelMap);
}
项目:SilkAppDriver    文件:W3CProtocolController.java   
/**
 * Implements the "Execute Async Script" command See
 * https://www.w3.org/TR/webdriver/#dfn-execute-async-script
 */
@RequestMapping(value = "/session/{sessionId}/execute/async", method = RequestMethod.POST, produces = "application/json; charset=utf-8")
public @ResponseBody ResponseEntity<Response> executeAsyncScript(@PathVariable String sessionId,
        @RequestBody(required = false) String body) throws Throwable {
    LOGGER.info("executeAsyncScript -->");
    LOGGER.info("  -> " + body);
    LOGGER.info("  <- ERROR: unknown command");
    LOGGER.info("executeAsyncScript <--");

    return responseFactory.error(sessionId, ProtocolError.UNKNOWN_COMMAND);
}
项目:device-mqtt    文件:UpdateController.java   
public void addWatcher(@RequestBody String provisionWatcher) {
  if (provisionWatcher != null) {
    if (update.addWatcher(provisionWatcher)) {
      logger.debug("New device watcher received to add devices with provision watcher id:"
          + provisionWatcher);
    } else {
      logger.error("Received add device provision watcher request without an id attached.");
      throw new NotFoundException("provisionWatcher", provisionWatcher);
    }
  }
}
项目:WeiMusicCommunity-server    文件:PathController.java   
@RequestMapping(produces = "application/json")
public ResponseEntity<HttpJson> getPathTest(@RequestBody String test) {
    HttpJson inObj = new HttpJson(test);
    HttpJson json = new HttpJson();
    UserExtend ue = new UserExtend();
    json.setClassObject(ue);
    json.setClassName(String.class.toString());

    return new ResponseEntity<HttpJson>(json, HttpStatus.ACCEPTED);
}
项目:CommonInformationSpace    文件:CISAdaptorConnectorRestController.java   
@RequestMapping(value = "/CISCore/postmessage/xml", method = RequestMethod.POST)
public ResponseEntity<Response> testXMLConnectorCallback(@RequestBody CISXMLContent xmlpayload) {
    log.info("--> testXMLConnectorCallback");
    Response response = new Response();

    log.info(xmlpayload);

    log.info("testXMLConnectorCallback -->");
    return new ResponseEntity<Response>(response, HttpStatus.OK);
}
项目:happy-news    文件:AdminPostController.java   
/**
 * Create or replace a post. The post will be validated using {@link PostValidator}.
 *
 * @param uuid The UUID.
 * @param post The post content.
 * @return The new state of the post.
 */
@ApiOperation("Create or replace a post")
@RequestMapping(value = "/{uuid}", method = RequestMethod.PUT, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Post> updatePost(@PathVariable String uuid, @Valid @RequestBody Post post) {
    post.setUuid(uuid);

    try {
        return ResponseEntity
            .ok(postRepository.save(post));
    } catch (Exception e) {
        logger.error("Could not update post.", e);
        throw new PostCreationException("Could not update post.", e);
    }
}
项目:product-management-system    文件:UserController.java   
/**
 * Creating {@link User} from client form.
 */
@PostMapping
@ResponseStatus(HttpStatus.CREATED)
public UserDto createUser(@RequestBody @Valid final UserDto userDto) {
    log.info("Start createUser: {}", userDto.getUsername());
    final User user = mapper.map(userDto, User.class);
    return mapper.map(userService.create(user), UserDto.class);
}
项目:SilkAppDriver    文件:W3CProtocolController.java   
/**
 * Implements the "Get Window Rect" command See
 * https://www.w3.org/TR/webdriver/#dfn-get-window-rect
 */
@RequestMapping(value = "/session/{sessionId}/window/rect", method = RequestMethod.GET, produces = "application/json; charset=utf-8")
public @ResponseBody ResponseEntity<Response> getWindowRect(@PathVariable String sessionId,
        @RequestBody(required = false) String body) throws Throwable {
    LOGGER.info("getWindowRect -->");

    Rect result = sessionManager.getSession(sessionId).getCurrentWindowRect();

    LOGGER.info("  <- " + result);
    LOGGER.info("getWindowRect <--");

    return responseFactory.success(sessionId,
            new ElementGetRectResponse(result.getX(), result.getY(), result.getWidth(), result.getHeight()));
}
项目:pinkyLam-Blog-Server    文件:MemoRemindController.java   
@RequestMapping("saveMemoRemind")
public ExecuteResult<Boolean> saveMemoRemind(@RequestBody MemoRemind memoRemind) {
    final ExecuteResult<Boolean> result = new ExecuteResult<>();
    try {
        memoRemind.setCreateTime(new Date());
        memoRemindDao.save(memoRemind);
        result.setSuccess(true);
    } catch (final Exception e) {
        logger.error("", e);
        result.setSuccess(false);
        result.setErrorCode(ErrorCode.EXCEPTION.getErrorCode());
        result.setErrorMsg(ErrorCode.EXCEPTION.getErrorMsg());
    }
    return result;
}
项目:Spring-Boot-Server    文件:ShareRestful.java   
/**
 * 查看图片信息
 * 
 * @param pd
 *            参数
 * @return
 * @throws Exception
 */
@RequestMapping(value = "/selectPic")
public PageData selectPic(@RequestBody PageData pd) throws Exception {
    List<PageData> lists = null;
    PageData pds = pd;
    lists = shareMapper.selectPic(pds);
    pd.put("lists", lists);
    return WebResult.requestSuccess(pd);
}
项目:iBase4J    文件:ScheduledController.java   
@PostMapping("/run")
@ApiOperation(value = "立即执行任务")
@RequiresPermissions("sys.task.scheduled.run")
public Object exec(@RequestBody TaskScheduled scheduled, ModelMap modelMap) {
    Assert.notNull(scheduled.getTaskGroup(), "TASKGROUP");
    Assert.notNull(scheduled.getTaskName(), "TASKNAME");
    scheduledService.execTask(scheduled);
    return setSuccessModelMap(modelMap);
}
项目:oneops    文件:DpmtRestController.java   
@RequestMapping(value="/dj/simple/approvals/{approvalId}", method = RequestMethod.PUT)
@ResponseBody
public CmsDpmtApproval dpmtApprove(
        @RequestBody CmsDpmtApproval approval, @PathVariable long approvalId,
        @RequestHeader(value="X-Cms-Scope", required = false)  String scope,
        @RequestHeader(value="X-Cms-User", required = true)  String userId){

    approval.setUpdatedBy(userId);

    djManager.updateApprovalList(Arrays.asList(approval));
    return djManager.getDeploymentApproval(approval.getApprovalId());
}
项目:project-template    文件:ProductController.java   
@ApiOperation(value = "Catalogue new product or update existing one")
@ApiResponses({
        @ApiResponse(code = 201, message = "Successfully catalogue product"),
        @ApiResponse(code = 428, message = "Invalid product info", response = ErrorDto.class)})
@ResponseStatus(code = HttpStatus.CREATED)
@PostMapping
public ProductDto catalogue(@ApiParam(value = "Product data", name = "Product",
        required = true) @Validated @RequestBody ProductDto productDto) {
    return productService.catalogue(productDto);
}
项目:Mastering-Spring-5.0    文件:TodoController.java   
@PostMapping("/users/{name}/todos")
ResponseEntity<?> add(@PathVariable String name, @RequestBody Todo todo) {
    Todo createdTodo = todoService.addTodo(name, todo.getDesc(), todo.getTargetDate(), todo.isDone());
    if (createdTodo == null) {
        return ResponseEntity.noContent().build();
    }
    URI location = ServletUriComponentsBuilder.fromCurrentRequest().path("/{id}")
            .buildAndExpand(createdTodo.getId()).toUri();
    return ResponseEntity.created(location).build();
}
项目:Spring-Boot-Server    文件:AccompanyInfoRestful.java   
/**
 * 删除
 * 
 * @param pd
 *            参数
 * @return
 * @throws Exception
 */
@RequestMapping(value = "/toDelete")
public PageData toDelete(@RequestBody PageData pd) throws Exception {
    String s_IDS = pd.getString("IDS");
    if(null != s_IDS && !"".equals(s_IDS)){
        pd.put("IDSs", s_IDS.split(","));
        accompanyInfoMapper.delete(pd);
        pd.put("msg", "success");
    }else{
        pd.put("msg", "failed");
    }
    return WebResult.requestSuccess(pd);
}
项目:WeiMusicCommunity-server    文件:CommityContorller.java   
@RequestMapping("isMemIn")
public ResponseEntity<HttpJson> isExistMem(@RequestBody String jsonString) {
    return ControllerFreamwork.excecute(jsonString, CommityMember.class, "CommityMember:isMemberExist", new ControllerFreamwork.ControllerFuntion() {
        @Override
        public HttpJson thisControllerDoing(HttpJson inObj, HttpJson re) throws Exception {
            CommityMember member = (CommityMember) inObj.getClassObject();
            boolean flag = commityService.isMemExist(member);
            re.setClassObject(flag);
            return re;
        }
    });
}
项目:Spring-Boot-Server    文件:ConstantRestful.java   
/**
 * 
 * @Description: 修改系统常量保存
 * @param pd
 * @return
 * @throws Exception
 */
@RequestMapping(value = "/saveEdit")
public Object saveEdit(@RequestBody PageData pd) throws Exception{
        Map<String, Object> msg = new HashMap<String, Object>();
        //用户id
        constantMapper.edit(pd);
        msg.put("msg", "success");
        //结果集封装
        return WebResult.requestSuccess(msg);
}
项目:Spring-Boot-Server    文件:AppSpRestful.java   
/**
 * 订单评价
 * @return
 */
@RequestMapping(value = "/getEvaluateOfSpOrder")
@ResponseBody
public PageData getEvaluateOfSpOrder(@RequestBody PageData pd) throws Exception {
    if (StringUtils.isBlank(pd.getString("O_ID"))) {
        return WebResult.requestFailed(10001, "参数缺失!", null);
    }
    else {
        PageData npd = appSpMapper.getEvaluateOfSpOrder(pd);
        return WebResult.requestSuccess(npd);
    }
}
项目:WeiMusicCommunity-server    文件:RegistContoller.java   
@RequestMapping(value = "common",produces = "application/json;charset=UTF-8")
public ResponseEntity<HttpJson> Regist(@RequestBody String inObj){

    HttpJson re = new HttpJson(), input = new HttpJson(inObj);
    String thisFormType = input.getClassName();
    if (!thisFormType.equals("form:regist")){
        re.setStatusCode(250);
        re.setMessage("不匹配的请求");
        return new ResponseEntity<HttpJson>(re, HttpStatus.BAD_REQUEST);
    }
    String getRegistType = input.getPara("style");
    String getUserName = input.getPara("username");
    String getUserPwd = input.getPara("password");

    Login login = new Login();
    login.setUPwd(getUserPwd);
    login.setUAName(getUserName);

    String flag = "-2";
    try {
        flag = registService.registUserWithType(login,getRegistType);
    } catch (Exception e) {
        e.printStackTrace();
        re.setMessage("服务器出错");
        re.setStatusCode(202);
        re.constractJsonString();
        return new ResponseEntity<HttpJson>(re,HttpStatus.BAD_GATEWAY);
    }

    if (flag.equals("-1")){
        re.setMessage("用户已存在,请检查用户名");
        re.setStatusCode(201);
    }else if(flag.equals("-2")){
        re.setStatusCode(202);
        re.setMessage("服务器太忙,请稍后再试");
    }else{
        re.setMessage("UserUUid");
        re.setClassObject(String.class.toString());
        re.setClassObject(flag);
    }

    re.constractJsonString();

    return new ResponseEntity<HttpJson>(re,HttpStatus.ACCEPTED);
}
项目:Spring-Boot-Server    文件:AppUserInfoRestful.java   
/**
 * 用户信息
 * @return
 */
@RequestMapping(value = "/get")
@ResponseBody
public PageData getUserInfo(@RequestBody PageData pd) throws Exception {
    PageData accInfo = appUserInfoMapper.getUserInfo(pd);
    return WebResult.requestSuccess(accInfo);
}
项目:WIFIProbe    文件:ReceiverController.java   
@ApiOperation(value = "Post new old statistic data", notes = "Add new old customer statistic data to server",
        response = NewOldVo.class, produces = "application/json;charset=UTF-8")
@PostMapping(value = "/newOld" ,produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public List<NewOldVo> newOld(@RequestBody List<NewOldCustomElement> elements) {
    List<NewOldVo> resultList = Lists.newArrayList();
    for (NewOldCustomElement element: elements) {
        resultList.add(newOldService.save(element));
    }
    return resultList;
}
项目:Spring-Boot-Server    文件:AppUserFriendRestful.java   
/**
 * 查看两人之间的关系状态
 * 
 * @return
 */
@RequestMapping(value = "/getTwoPersonRelation")
@ResponseBody
public PageData getTwoPersonRelation(@RequestBody PageData pd) throws Exception {
    if (StringUtils.isBlank(pd.getString("UI_ID")) || StringUtils.isBlank(pd.getString("FRIEND_ID"))) {
        return WebResult.requestFailed(10001, "参数缺失!", null);
    }
    else {
        PageData res = new PageData();
        List<PageData> list = appUserFriendMapper.isFirstFriend(pd);
        if (list.size() == 0) {
            res.put("STATUS", "0"); // 不是好友
        }
        else {
            PageData temp = list.get(0);
            String ui_id = pd.getString("UI_ID"); // 用户id
            if ("0".equals(temp.getString("CONFIRM_STATE"))) {
                // 未通过验证
                if (ui_id.equals(temp.getString("SPONSOR"))) {
                    res.put("STATUS", "1"); // 是好友等待对方确认
                }
                else {
                    res.put("STATUS", "2"); // 是好友我方确认点击确认
                    res.put("CONFIRM_MSG", temp.getString("CONFIRM_MSG")); // 发送的信息
                }
            }
            else {
                res.put("STATUS", "3"); // 双方是好友
            }
        }
        return WebResult.requestSuccess(res);
    }
}
项目:SilkAppDriver    文件:W3CProtocolController.java   
/**
 * Implements the "Get Page Source" command See
 * https://www.w3.org/TR/webdriver/#dfn-get-page-source
 */
@RequestMapping(value = "/session/{sessionId}/source", method = RequestMethod.GET, produces = "application/json; charset=utf-8")
public @ResponseBody ResponseEntity<Response> getPageSource(@PathVariable String sessionId,
        @RequestBody(required = false) String body) throws Throwable {
    LOGGER.info("getPageSource -->");
    LOGGER.info("  -> " + body);
    LOGGER.info("  <- ERROR: unknown command");
    LOGGER.info("getPageSource <--");

    return responseFactory.error(sessionId, ProtocolError.UNKNOWN_COMMAND);
}
项目:device-modbus    文件:UpdateController.java   
public void addDevice(@RequestBody String deviceId) {
    if (deviceId != null) {
        if (update.addDevice(deviceId)) {
            logger.debug("Added device.  Received add device request with id:" + deviceId);
        } else {
            logger.error("Received add device request without a device id attached.");
            throw new DeviceNotFoundException("no device id provided in request.");
        }
    }
}
项目:Spring-Boot-Server    文件:AppUserFamilyRestful.java   
/**
 * 根据家庭成员ID来删除家庭成员
 * @return
 */
@RequestMapping(value = "/member/delFamilyMemberByFMID")
@ResponseBody
public PageData delFamilyMemberByFMID(@RequestBody PageData pd) throws Exception {
    if (StringUtils.isBlank(pd.getString("FM_ID"))) {
        return WebResult.requestFailed(10001, "参数缺失!", null);
    }
    else {
        appUserFamilyMapper.delFamilyMemberByFMID(pd);
        return WebResult.requestSuccess();
    }
}
项目:Spring-Boot-Server    文件:UserRestful.java   
@RequestMapping(value = "/updateGuide")
public Object updateGuide(@RequestBody PageData pd) throws Exception{
    PageData map = new PageData();
    userMapper.updateGuide(pd);
        map.put("result", "success"); // 返回结果
        // 结果集封装
        return WebResult.requestSuccess(map);
}
项目:logistimo-web-service    文件:AuthControllerMV1.java   
/**
 * This method will validate user's otp
 *
 * @param otpModel consists of user id, otp
 */
@RequestMapping(value = "/validate-otp", method = RequestMethod.POST)
@ResponseStatus(HttpStatus.NO_CONTENT)
public void validateOtp(@RequestBody ValidateOtpModel otpModel) throws ValidationException {
  AuthenticationService as;
  as = Services.getService(AuthenticationServiceImpl.class);
  as.validateOtpMMode(otpModel.uid, otpModel.otp);
}
项目:iBase4J    文件:ScheduledController.java   
@DeleteMapping
@ApiOperation(value = "删除任务")
@RequiresPermissions("sys.task.scheduled.close")
public Object delete(@RequestBody TaskScheduled scheduled, ModelMap modelMap) {
    Assert.notNull(scheduled.getTaskGroup(), "TASKGROUP");
    Assert.notNull(scheduled.getTaskName(), "TASKNAME");
    scheduledService.delTask(scheduled);
    return setSuccessModelMap(modelMap);
}
项目:monarch    文件:ShellCommandsController.java   
@RequestMapping(method = RequestMethod.POST, value = "/mbean/query")
public ResponseEntity<?> queryNames(@RequestBody final QueryParameterSource query) {
  try {
    final Set<ObjectName> objectNames =
        getMBeanServer().queryNames(query.getObjectName(), query.getQueryExpression());

    return new ResponseEntity<byte[]>(IOUtils.serializeObject(objectNames), HttpStatus.OK);
  } catch (IOException e) {
    return new ResponseEntity<String>(printStackTrace(e), HttpStatus.INTERNAL_SERVER_ERROR);
  }
}