Java Code Examples for org.springframework.web.bind.annotation.ResponseBody

The following are top voted examples for showing how to use org.springframework.web.bind.annotation.ResponseBody. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: esup-sgc   File: StatsController.java   Source Code and License 6 votes vote down vote up
@RequestMapping(value="/prefs", headers = "Accept=application/json; charset=utf-8")
@ResponseBody
public void savePrefs(@RequestParam List<String> values, @RequestParam String key) {
	Authentication auth = SecurityContextHolder.getContext().getAuthentication();
	String eppn = auth.getName();
	
	try {
		preferencesService.setPrefs(eppn, key, StringUtils.join(values, ","));
		if(KEYRM.equals(key)){
			List <String>  prefsStats = new ArrayList<String>(Arrays.asList(preferencesService.getPrefs(eppn, KEY).getValue().split("\\s*,\\s*")));
			prefsStats.remove(values.get(0));
		}
		
	} catch (Exception e) {
		log.warn("Impossible de sauvegarder les préférences", e);
	}
}
 
Example 2
Project: oneops   File: CmRestController.java   Source Code and License 6 votes vote down vote up
@RequestMapping(value="/cm/simple/relations/count", method = RequestMethod.GET)
@ResponseBody
public Map<String, Long> getRelationsCounts(
		@RequestParam(value="nsPath", required = true) String nsPath,
		@RequestParam(value="ciId", required = false) Long ciId,
		@RequestParam(value="direction", required = true) String direction, 
		@RequestParam(value="relationName", required = false) String relationName,
		@RequestParam(value="relationShortName", required = false) String shortRelationName,
		@RequestParam(value="targetClassName", required = false) String targetClazz,
		@RequestParam(value="recursive", required = false)  Boolean recursive,
		@RequestParam(value="groupBy", required = false) String groupBy,
		@RequestHeader(value="X-Cms-Scope", required = false)  String scope){

	if (scope != null) {
		scopeVerifier.verifyScope(scope, nsPath);
	}
	if (recursive == null) {
		recursive = false;
	}
	CmsDataHelper<RelationParam, Map<String, Long>> dataHelper = new CmsDataHelper<>();
	RelationParam param = new RelationParam(nsPath, relationName, shortRelationName, targetClazz, recursive);
	param.setCiId(ciId);
	param.setDirection(direction);
	param.setGroupBy(groupBy);
	return dataHelper.execute(this::getRelationsCountsInternal, param, isOrgLevelRecursiveAccess(nsPath, recursive), "getRelationsCounts");
}
 
Example 3
Project: openapi   File: CronWebService.java   Source Code and License 6 votes vote down vote up
/**
 * 启动计划任务
 */
@RequestMapping(value = "/start", method = {RequestMethod.POST,RequestMethod.GET})
@ResponseBody
public String startCron(String cron_id){
	LOG.info("request /api/v2/cron/start start");
	Map<String,Object>  result = new HashMap<String, Object>();
	result.put("flag", "false");
	if(cron_id.length() != 16){
		result.put("error", Errorcode.ERR403_9.getValue());
		return JSON.toJSONString(result, JsonFilter.filter);
	}
	try{
		Map<String,Object>  mqrequest = new HashMap<String, Object>();
		mqrequest.put("id",cron_id );
		result = messageProducer.call("openapi.cron","startCron", mqrequest, 5000);
	}catch(Exception e){
		result.put("error", Errorcode.ERR500.getValue()+",openapi try/catch:"+ExceptionUtil.getStackTraceAsString(e));
	}
    	return JSON.toJSONString(result,JsonFilter.filter);
}
 
Example 4
Project: mumu   File: SysOrganizeController.java   Source Code and License 6 votes vote down vote up
/**
 * 编辑组织机构
 * @param orgName 组织名称
 * @param parentOrgId 父组织id
 * @param remark 组织描述
 * @return
 */
@ResponseBody
@RequiresPermissions("system:organize:edit")
@MumuLog(name = "编辑组织机构",operater = "PUT")
@RequestMapping(value="/edit",method=RequestMethod.PUT)
public ResponseEntity updateOrganize(int orgId,String orgName,String parentOrgId,String remark){
    List<SysOrganize> organizes=organizeService.querySysOrganizeByCondition(orgName);
    if(organizes!=null&&organizes.size()>0&&organizes.get(0).getOrgId()!=orgId){
        return new ResponseEntity(500, "组织机构名称不可重复", null);
    }
    try {
        SysOrganize organize=new SysOrganize();
        organize.setOrgId(orgId);
        organize.setOrgName(orgName);
        organize.setParentOrgId(Integer.parseInt(parentOrgId));
        organize.setRemark(remark);
        organize.setEditor(SecurityUtils.getSubject().getPrincipal().toString());
        organizeService.updateSysOrganize(organize);
        return new ResponseEntity(200, "更新组织机构成功", null);
    } catch (NumberFormatException e) {
        log.error(e);
        return new ResponseEntity(500, "更新组织机构出现异常", null);
    }
}
 
Example 5
Project: lemon   File: RoleDefController.java   Source Code and License 6 votes vote down vote up
@RequestMapping("role-def-checkName")
@ResponseBody
public boolean checkName(@RequestParam("name") String name,
        @RequestParam(value = "id", required = false) Long id)
        throws Exception {
    String hql = "from RoleDef where tenantId="
            + tenantHolder.getTenantId() + " and name=?";
    Object[] params = { name };

    if (id != null) {
        hql = "from RoleDef where tenantId=" + tenantHolder.getTenantId()
                + " and name=? and id<>?";
        params = new Object[] { name, id };
    }

    boolean result = roleDefManager.findUnique(hql, params) == null;

    return result;
}
 
Example 6
Project: image-server   File: ImageController.java   Source Code and License 6 votes vote down vote up
/**
 * WebUploader插件当使用二进制流的方式上传图片时接收方法
 *
 * @param request
 * @param response
 * @return
 * @throws java.io.IOException
 */
@RequestMapping(value = "/webUploaderBinary", method = RequestMethod.POST)
@ResponseBody
public String webUploaderBinary(HttpServletRequest request, HttpServletResponse response) throws IOException {
    ServletInputStream inputStream = request.getInputStream();

    BufferedInputStream in = new BufferedInputStream(inputStream);
    FileOutputStream out = new FileOutputStream(new File("d:/test.jpg"));

    int b = -1;
    byte[] bytes = new byte[1024];

    while ((b = in.read(bytes, 0, bytes.length)) != -1) {
        out.write(b);
    }

    out.close();
    in.close();

    return "success";
}
 
Example 7
Project: Learning-Spring-Boot-2.0-Second-Edition   File: HomeController.java   Source Code and License 6 votes vote down vote up
@GetMapping(value = BASE_PATH + "/" + FILENAME + "/raw",
	produces = MediaType.IMAGE_JPEG_VALUE)
@ResponseBody
public Mono<ResponseEntity<?>> oneRawImage(
	@PathVariable String filename) {
	// tag::try-catch[]
	return imageService.findOneImage(filename)
		.map(resource -> {
			try {
				return ResponseEntity.ok()
					.contentLength(resource.contentLength())
					.body(new InputStreamResource(
						resource.getInputStream()));
			} catch (IOException e) {
				return ResponseEntity.badRequest()
					.body("Couldn't find " + filename +
						" => " + e.getMessage());
			}
		});
	// end::try-catch[]
}
 
Example 8
Project: TITAN   File: LoginController.java   Source Code and License 6 votes vote down vote up
/**
 * @desc 退出系统
 *
 * @author liuliang
 *
 * @param request
 * @return
 */
@RequestMapping(value = "/logout")
@ResponseBody
public Result logout(HttpServletRequest request){
	Result result = new Result();
	try {
		String ticket = CookieUtil.getCookieValueByName(request,TitanConstant.TICKET_PREFIX);
		if(StringUtils.isNotBlank(ticket)){
			jedisCluster.del(TitanConstant.TICKET_PREFIX + ticket);
			return ResultUtil.success(result);
		}else {
			logger.error("ticket为空,ticket:{}",ticket);
			return ResultUtil.fail(ErrorCode.REQUEST_PARA_ERROR,result);
		}
	} catch (Exception e) {
		logger.error("退出titan异常",e);
	}
	return ResultUtil.fail(result);
}
 
Example 9
Project: cas-5.1.0   File: SingleSignOnSessionsReportController.java   Source Code and License 6 votes vote down vote up
/**
 * Endpoint for destroying a single SSO Session.
 *
 * @param ticketGrantingTicket the ticket granting ticket
 * @param request              the request
 * @param response             the response
 * @return result map
 */
@PostMapping(value = "/destroySsoSession")
@ResponseBody
public Map<String, Object> destroySsoSession(@RequestParam final String ticketGrantingTicket,
                                             final HttpServletRequest request,
                                             final HttpServletResponse response) {
    ensureEndpointAccessIsAuthorized(request, response);

    final Map<String, Object> sessionsMap = new HashMap<>(1);
    try {
        this.centralAuthenticationService.destroyTicketGrantingTicket(ticketGrantingTicket);
        sessionsMap.put(STATUS, HttpServletResponse.SC_OK);
        sessionsMap.put(TICKET_GRANTING_TICKET, ticketGrantingTicket);
    } catch (final Exception e) {
        LOGGER.error(e.getMessage(), e);
        sessionsMap.put(STATUS, HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
        sessionsMap.put(TICKET_GRANTING_TICKET, ticketGrantingTicket);
        sessionsMap.put("message", e.getMessage());
    }
    return sessionsMap;
}
 
Example 10
Project: iotplatform   File: EntityRelationController.java   Source Code and License 6 votes vote down vote up
@PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN', 'CUSTOMER_USER')")
@RequestMapping(value = "/relations", method = RequestMethod.GET, params = { "fromId", "fromType" })
@ResponseBody
public List<EntityRelation> findByFrom(@RequestParam("fromId") String strFromId,
    @RequestParam("fromType") String strFromType,
    @RequestParam(value = "relationTypeGroup", required = false) String strRelationTypeGroup) throws IoTPException {
  checkParameter("fromId", strFromId);
  checkParameter("fromType", strFromType);
  EntityId entityId = EntityIdFactory.getByTypeAndId(strFromType, strFromId);
  checkEntityId(entityId);
  RelationTypeGroup typeGroup = parseRelationTypeGroup(strRelationTypeGroup, RelationTypeGroup.COMMON);
  try {
    return checkNotNull(relationService.findByFrom(entityId, typeGroup).get());
  } catch (Exception e) {
    throw handleException(e);
  }
}
 
Example 11
Project: logistimo-web-service   File: EntityController.java   Source Code and License 6 votes vote down vote up
@RequestMapping(value = "/stockboard", method = RequestMethod.GET)
public
@ResponseBody
StockBoardModel getStockBoard(@RequestParam Long entityId, HttpServletRequest request) {
  KioskConfig kc = null;
  StockBoardModel model = new StockBoardModel();
  StockBoardBuilder stockBoardBuilder = new StockBoardBuilder();
  SecureUserDetails sUser = SecurityUtils.getUserDetails(request);
  Locale locale = sUser.getLocale();
  ResourceBundle backendMessages = Resources.get().getBundle("BackendMessages", locale);
  try {
    if (entityId != null) {
      kc = KioskConfig.getInstance(entityId);
      if (kc != null) {
        model = stockBoardBuilder.buildStockBoardModel(kc, model);
      }
    }
    return model;
  } catch (Exception e) {
    xLogger.severe("Exception when retrieving stock board config");
    throw new InvalidServiceException(backendMessages.getString("stock.board.config.fetch"));
  }

}
 
Example 12
Project: sjk   File: UserController.java   Source Code and License 6 votes vote down vote up
@RequestMapping(value = "/del.d", produces = "application/json;charset=UTF-8")
@ResponseBody
public String delete(@RequestParam("id") int id) {
    JSONObject output = new JSONObject();
    JSONObject server = new JSONObject();
    output.put("result", server);
    try {
        boolean result = service.deleteByIds(Arrays.asList(id));
        if (result) {
            server.put("code", SvrResult.OK.getCode());
            server.put("msg", SvrResult.OK.getMsg());
        } else {
            server.put("code", SvrResult.ERROR.getCode());
            server.put("msg", SvrResult.ERROR.getMsg());
        }
    } catch (Exception e) {
        server.put("code", -1.);
        server.put("msg", e.getMessage());
        logger.error("Exception:", e);
    }
    return output.toJSONString();
}
 
Example 13
Project: Spring-5.0-Cookbook   File: DataController.java   Source Code and License 6 votes vote down vote up
@RequestMapping(value="/web/react.json",produces ="application/json",method = RequestMethod.GET,headers = {"Accept=text/xml, application/json"})
@ResponseBody
public Callable<Employee> asynchAction(){
	Callable<Employee> task = new Callable<Employee>() {
		
		
           @Override
           public Employee call () throws Exception {
           	logger.info("controller#asynchAction task started.");
               System.out.println("controller#async task started. Thread: " +
                                                      Thread.currentThread()
                                                            .getName());
               Thread.sleep(5000);
               Employee emp = employeeServiceImpl.readEmployee(15).get();
               System.out.println(emp.getLastName());
               return emp;
           }
       };
	return task;
}
 
Example 14
Project: SSM-   File: EmployeeController.java   Source Code and License 6 votes vote down vote up
/**
 * 检查用户名是否可用
 * @param empName
 * @return
 */
@ResponseBody
@RequestMapping("/checkuser")
public Msg checkuse(@RequestParam("empName")String empName){
	//先判断用户名是否是合法的表达式
	String regx="(^[a-zA-Z0-9_-]{6,16}$)|(^[\u2E80-\u9FFF]{2,5})";
	
	if(!(empName.matches(regx))){
		System.out.println("不可用");
		return Msg.fail().add("va_msg","用户名必须是6-16位数字和字母的组合或者2-5位中文");
	}
	
	//数据库用户名重复校验
	boolean b =employeeService.checkUser(empName);
	if(b){
		return Msg.success();
	}else{
		return Msg.fail().add("va_msg", "用户名不可用");
	}

}
 
Example 15
Project: mmall   File: OrderManageController.java   Source Code and License 6 votes vote down vote up
@RequestMapping("search.do")
@ResponseBody
public ServerResponse<PageInfo> orderSearch(HttpSession session, Long orderNo,@RequestParam(value = "pageNum",defaultValue = "1") int pageNum,
                                            @RequestParam(value = "pageSize",defaultValue = "10")int pageSize){
    User user = (User)session.getAttribute(Const.CURRENT_USER);
    if(user == null){
        return ServerResponse.createByErrorCodeMessage(ResponseCode.NEED_LOGIN.getCode(),"用户未登录,请登录管理员");

    }
    if(iUserService.checkUserRole(user).isSuccess()){
        //填充我们增加产品的业务逻辑
        return iOrderService.manageSearch(orderNo,pageNum,pageSize);
    }else{
        return ServerResponse.createByError("无权限操作");
    }
}
 
Example 16
Project: Spring-Boot-Server   File: JybAPPUserMobilePersonalMyNodeRestful.java   Source Code and License 6 votes vote down vote up
@RequestMapping("/accompanyInsertKeyNodeInfor")
@ResponseBody
public PageData accompanyInsertKeyNodeInfor(@RequestBody PageData pd) throws Exception{
	
	if(StringUtils.isBlank(pd.getString("O_ID"))||StringUtils.isBlank(pd.getString("NM_ID"))
			||StringUtils.isBlank(pd.getString("KN_CONTENT"))){
		return WebResult.requestFailed(10001, "参数缺失!", null);
	}
	
	//如果没有数据,还有修改此数据的接口
	if(pd.getString("KN_LOC") == null) pd.put("KN_LOC", "");
	if(pd.getString("KN_PHOTO") == null) pd.put("KN_PHOTO", "");
	
	pd.put("KN_ID", UuidUtil.get32UUID());
	JybAPPUserMobilePersonalMyNodeMapper.accompanyInsertKeyNodeInfor(pd);
	
	return WebResult.requestSuccess();
	
}
 
Example 17
Project: open-kilda   File: SwitchController.java   Source Code and License 6 votes vote down vote up
/**
 * Gets the ports detail switch id.
 *
 * @param switchId
 *            the switch id
 * @return the ports detail switch id
 */
@RequestMapping(value = "/{switchId}/ports", method = RequestMethod.GET)
public @ResponseBody ResponseEntity<Object> getPortsDetailSwitchId(
		@PathVariable String switchId) {

	log.info("Inside SwitchController method getPortsDetailSwitchId : SwitchId "
			+ switchId);
	List<PortInfo> portResponse = null;
	try {
		portResponse = serviceSwitch
				.getPortResponseBasedOnSwitchId(switchId);
	} catch (Exception exception) {
		log.error("Exception in getPortsDetailSwitchId : "
				+ exception.getMessage());
	}
	log.info("exit SwitchController method getPortsDetailSwitchId ");
	return new ResponseEntity<Object>(portResponse, HttpStatus.OK);
}
 
Example 18
Project: batch-scheduler   File: BatchGroupRelController.java   Source Code and License 6 votes vote down vote up
@RequestMapping(value = "/v1/dispatch/batch/define/group/delete", method = RequestMethod.POST)
@ResponseBody
public String deleteGroup(HttpServletResponse response, HttpServletRequest request) {
    String id = request.getParameter("id");
    logger.debug("suiteKey is:{}", id);

    List<BatchGroupDto> list = new ArrayList<>();
    BatchGroupDto dto = new BatchGroupDto();
    dto.setSuiteKey(id);
    list.add(dto);

    RetMsg retMsg = batchGroupService.deleteGroup(list);

    if (!retMsg.checkCode()) {
        response.setStatus(retMsg.getCode());
        return Hret.error(retMsg);
    }
    return Hret.success(retMsg);
}
 
Example 19
Project: sjk   File: PhoneBaseInfoController.java   Source Code and License 6 votes vote down vote up
@RequestMapping(value = "/cdn/brand-list.json", method = RequestMethod.GET, produces = "application/json;charset=UTF-8")
@ResponseBody
public String getPhoneBrand() {
    JSONObject output = new JSONObject();
    JSONObject server = new JSONObject();
    output.put("result", server);
    try {
        List<BrandListVo> list = phoneInfoService.findPhoneLetterList();
        output.put("data", list);
        server.put("code", SvrResult.OK.getCode());
        server.put("msg", SvrResult.OK.getMsg());
    } catch (Exception e) {
        server.put("code", SvrResult.ERROR.getCode());
        server.put("msg", SvrResult.ERROR.getMsg());
        logger.error("Exception", e);
    }
    return output.toJSONString(jsonStyle);
}
 
Example 20
Project: pay-xxpay-master   File: GoodsOrderController.java   Source Code and License 6 votes vote down vote up
@RequestMapping("/toAliPay.html")
@ResponseBody
public String toAliPay(HttpServletRequest request, Long amount, String channelId) {
    String logPrefix = "【支付宝支付】";
    _log.info("====== 开始接收支付宝支付请求 ======");
    String goodsId = "G_0001";
    _log.info("{}接收参数:goodsId={},amount={},channelId={}", logPrefix, goodsId, amount, channelId);
    // 先插入订单数据
    Map params = new HashMap<>();
    params.put("channelId", channelId);
    // 下单
    GoodsOrder goodsOrder = createGoodsOrder(goodsId, amount);
    Map<String, String> orderMap = createPayOrder(goodsOrder, params);
    if(orderMap != null && "success".equalsIgnoreCase(orderMap.get("resCode"))) {
        String payOrderId = orderMap.get("payOrderId");
        GoodsOrder go = new GoodsOrder();
        go.setGoodsOrderId(goodsOrder.getGoodsOrderId());
        go.setPayOrderId(payOrderId);
        go.setChannelId(channelId);
        int ret = goodsOrderService.update(go);
        _log.info("修改商品订单,返回:{}", ret);
    }
    if(PayConstant.PAY_CHANNEL_ALIPAY_MOBILE.equalsIgnoreCase(channelId)) return orderMap.get("payParams");
    return orderMap.get("payUrl");
}
 
Example 21
Project: sjk   File: MoTagAppController.java   Source Code and License 6 votes vote down vote up
@RequestMapping(value = "/save-tagapp.d", produces = "application/json;charset=UTF-8")
@ResponseBody
public String saveAppAndTag(@RequestParam Integer[] appId, @RequestParam Integer[] tagId,
        @RequestParam String[] tagName, @RequestParam Short[] tagType) {
    JSONObject output = new JSONObject();
    JSONObject server = new JSONObject();
    output.put("result", server);
    try {
        moTagRelationshipService.saveMoAppAndTag(appId, tagId, tagName, tagType);
        server.put("code", SvrResult.OK.getCode());
        server.put("msg", SvrResult.OK.getMsg());
    } catch (Exception e) {
        server.put("code", SvrResult.ERROR.getCode());
        server.put("msg", SvrResult.ERROR.getMsg());
    }
    return output.toJSONString();
}
 
Example 22
Project: ssm-web   File: SeRoleController.java   Source Code and License 6 votes vote down vote up
@RequestMapping(value = "/se_role_del_action.do", method = {RequestMethod.POST}, produces = "application/json")
@ResponseBody
public String seRoleDelActionDoHandler(HttpServletRequest request, HttpServletResponse response) throws ServletException {
    Map<String, Object> info = new HashMap<>();
    String rolecode = request.getParameter("rolecode");
    try {
        if (!Utils.strIsNull(rolecode)) {
            Map<String, Object> param = new HashMap<>();
            param.put("rolecode", rolecode);
            seRoleService.deleteRole(param);
        }

        info.put("status", 1);
        info.put("msg", "操作成功");
    } catch (Exception e) {
        info.put("status", 0);
        info.put("msg", "操作失败" + e.getLocalizedMessage());
    }
    return JSON.toJSONString(info, WriteNullStringAsEmpty);
}
 
Example 23
Project: sjk   File: AppController.java   Source Code and License 6 votes vote down vote up
@RequestMapping(value = "/show.d", produces = "application/json;charset=UTF-8")
@ResponseBody
public String show(@RequestParam Integer[] ids) {
    JSONObject output = new JSONObject();
    JSONObject server = new JSONObject();
    output.put("result", server);

    if (ids == null || ids.length < 1) {
        server.put("msg", "Don't do that!The ids is empty!!!");
        return output.toJSONString(jsonStyle);
    }
    StringBuilder sbOutputMessage = new StringBuilder();
    try {
        appService.updateShow(Arrays.asList(ids), sbOutputMessage);
        server.put("code", SvrResult.OK.getCode());
        server.put("msg", sbOutputMessage.toString());
    } catch (Exception e) {
        server.put("code", SvrResult.ERROR.getCode());
        server.put("msg", "系统错误");
    }

    return output.toJSONString(jsonStyle);
}
 
Example 24
Project: Spring-Boot-Server   File: JybUserMobilePersonalMyOrderRestful.java   Source Code and License 5 votes vote down vote up
/**
 * 根据订单id去lb_jyb_pay支付方法表中去修改为已支付
 * @param O_ID
 * @return
 */
@RequestMapping("/updatePayWay")
@ResponseBody
public PageData updatePayWay(@RequestBody PageData pd) throws Exception {
	if (StringUtils.isBlank(pd.getString("O_ID")) || StringUtils.isBlank(pd.getString("PAY_WAY"))) {
		return WebResult.requestFailed(10001, "参数缺失!", null);
	}
	jybUserMobilePersonalMyOrderMapper.updatePayWay(pd);
	return WebResult.requestSuccess();
}
 
Example 25
Project: iotplatform   File: AlarmController.java   Source Code and License 5 votes vote down vote up
@PreAuthorize("hasAnyAuthority('SYS_ADMIN', 'TENANT_ADMIN', 'CUSTOMER_USER')")
@RequestMapping(value = "/alarm/info/{alarmId}", method = RequestMethod.GET)
@ResponseBody
public AlarmInfo getAlarmInfoById(@PathVariable("alarmId") String strAlarmId) throws IoTPException {
    checkParameter("alarmId", strAlarmId);
    try {
        AlarmId alarmId = new AlarmId(toUUID(strAlarmId));
        return checkAlarmInfoId(alarmId);
    } catch (Exception e) {
        throw handleException(e);
    }
}
 
Example 26
Project: spring-ddd-bank   File: ExceptionAdvice.java   Source Code and License 5 votes vote down vote up
@ResponseBody
@ExceptionHandler({Exception.class})
@ResponseStatus(HttpStatus.BAD_REQUEST)
/**Reports the given Exception with messages localized according to the given Locale of the web request.*/
VndErrors reportException(final Exception ex, final Locale requestLocale) {
	//prepare messages for client with the Locale of the request:
	/** Message texts for exceptions. */
	final ResourceBundle requestResourceBundle = ResourceBundle.getBundle(BASE_NAME, requestLocale);
	final StringBuffer clientMessages = new StringBuffer();
	multex.Msg.printMessages(clientMessages, ex, requestResourceBundle);
	final String clientMesagesString = clientMessages.toString();

	//prepare log report with messages and stack trace:
	final StringBuffer serverMessages = new StringBuffer();
	serverMessages.append("Processing REST request threw exception:\n");
	final Locale defaultLocale = Locale.getDefault();
	final ResourceBundle defaultResourceBundle = ResourceBundle.getBundle(BASE_NAME, defaultLocale);
	if(!defaultResourceBundle.equals(requestResourceBundle)) {
		serverMessages.append(clientMesagesString);
		serverMessages.append("\n-----\n");
	}
	Msg.printReport(serverMessages, ex, defaultResourceBundle);
	
	//log the report on the server:
	log.error(serverMessages.toString());
	//respond with localized messages to the client:
	return new VndErrors("error", clientMesagesString);
}
 
Example 27
Project: logistimo-web-service   File: ShipmentController.java   Source Code and License 5 votes vote down vote up
@RequestMapping(value = "/update/{sId}/transporter", method = RequestMethod.POST)
public
@ResponseBody
ShipmentResponseModel updateShipmentInfo(@PathVariable String sId, @RequestBody String updValue,
                                         @RequestParam(required = false, value = "orderUpdatedAt") String orderUpdatedAt,
                                         HttpServletRequest request) {
  return updateShipmentData("tpName", updValue, orderUpdatedAt, sId, request,
      "ship.transporter.update.success", "ship.transporter.update.error");
}
 
Example 28
Project: loom   File: LoomServiceImpl.java   Source Code and License 5 votes vote down vote up
@Override
@RequestMapping(value = ApiConfig.TAPESTRY_BASE + "/{tapestryId}/threads/{threadId}/results",
        method = RequestMethod.GET, headers = ApiConfig.API_HEADERS, produces = {ApiConfig.API_PRODUCES})
@ResponseBody
public QueryResult getQueryResult(@PathVariable final String tapestryId, @PathVariable final String threadId,
        @CookieValue(value = SessionManager.SESSION_COOKIE, required = false) final String sessionId,
        final HttpServletResponse response) throws NoSuchSessionException, NoSuchThreadDefinitionException,
        NoSuchTapestryDefinitionException, NoSuchQueryDefinitionException, NoSuchAggregationException,
        LogicalIdAlreadyExistsException, InvalidQueryInputException, OperationException, ItemPropertyNotFound,
        RelationPropertyNotFound, ThreadDeletedByDynAdapterUnload, NoSuchItemTypeException,
        InvalidQueryParametersException, AccessExpiredException, JsonProcessingException, NoSuchProviderException {

    if (rateLimiter.tryAcquire()) {
        Session session = modelValidator.validateSessionAndAccess(sessionId, response, tapestryId, threadId);
        if (LOG.isDebugEnabled()) {
            LOG.debug("Query a thread with tapestryId: " + tapestryId + " and threadId: " + threadId
                    + " with session ID " + sessionId);
        }
        synchronized (session) {
            modelValidator.validateTapestryDefinition(tapestryId);
            modelValidator.validateThreadDefinition(threadId);
            return queryManager.getThread(session, threadId, false);
        }
    } else {
        throw new ApiThrottlingException("Exceeded max number of requests per second");
    }
}
 
Example 29
Project: pay-xxpay-master   File: Notify4AliPayController.java   Source Code and License 5 votes vote down vote up
/**
 * 支付宝移动支付后台通知响应
 * @param request
 * @return
 * @throws ServletException
 * @throws IOException
    */
@RequestMapping(value = "/notify/pay/aliPayNotifyRes.htm")
@ResponseBody
public String aliPayNotifyRes(HttpServletRequest request) throws ServletException, IOException {
	_log.info("====== 开始接收支付宝支付回调通知 ======");
	String notifyRes = doAliPayRes(request);
	_log.info("响应给支付宝:{}", notifyRes);
	_log.info("====== 完成接收支付宝支付回调通知 ======");
	return notifyRes;
}
 
Example 30
Project: mumu   File: SystemRoleController.java   Source Code and License 5 votes vote down vote up
/**
 * 角色权限列表列表
 * @param roleId 角色id
 * @return
 */
@ResponseBody
@RequestMapping(value = {"/allowPermission/{roleId}"}, method = RequestMethod.GET)
public List<ZTreeBean> roleAllowPermissions(@PathVariable String roleId) {
	// 获取当前角色下的菜单
	List<SysMenu> selectedMenus = menuService.getSysMenuByRoleId(roleId, PublicEnum.NORMAL.value());
	// 获取所有的权限
	List<SysPermission> allPermissions = permissionService.querySysPermissionByCondition(null, null, null, PublicEnum.NORMAL.value());
	// 获取当前角色下的权限
	List<SysPermission> selectedPermissions = permissionService.getSysPermissionByRoleId(roleId, PublicEnum.NORMAL.value());
	// ztree 权限树树
	List<ZTreeBean> ztree = new ArrayList<ZTreeBean>();
	// ztree菜单树
	for (SysMenu sysMenu : selectedMenus) {
		if (sysMenu.getParentMenuId().intValue() == 0) {
			ztree.add(new ZTreeBean(sysMenu.getMenuId().toString(), "topPermission", sysMenu.getMenuName(), true, sysMenu.getMenuIcon(), true));
		} else {
			ztree.add(new ZTreeBean(sysMenu.getMenuId().toString(), sysMenu.getParentMenuId().toString(), sysMenu.getMenuName(), true, sysMenu.getMenuIcon(), true));
		}

		for (SysPermission sysPermission : allPermissions) {
			// 找到菜单下的权限
			if (sysPermission.getMenuId().intValue() == sysMenu.getMenuId().intValue()) {
				// 在判断这个权限是否被选中
				Integer permissionId = sysPermission.getPermissionId();
				boolean flag = false;
				for (SysPermission selectedPermission : selectedPermissions) {
					if (selectedPermission.getPermissionId().intValue() == permissionId.intValue()) {
						flag = true;
						break;
					}
				}
				ztree.add(new ZTreeBean("p" + permissionId.toString(), sysPermission.getMenuId().toString(), sysPermission.getPermissionName(), true, null, flag));
			}
		}
	}
	ztree.add(new ZTreeBean("topPermission", "0", "权限树", true, "", "", false));
	return ztree;
}
 
Example 31
Project: logistimo-web-service   File: AssetController.java   Source Code and License 5 votes vote down vote up
@RequestMapping(value = "/device/config", method = RequestMethod.POST)
public
@ResponseBody
String pushPullDeviceConfig(@RequestBody DeviceConfigPushPullModel configModel,
                            HttpServletRequest request) throws ServiceException {
  SecureUserDetails sUser = SecurityUtils.getUserDetails(request);
  configModel.stub = sUser.getUsername();
  String json = new Gson().toJson(configModel);
  try {
    AssetUtil.pushDeviceConfig(json);
  } catch (ServiceException e) {
    throw new InvalidServiceException(e.getMessage());
  }
  return "";
}
 
Example 32
Project: bnade-web-ssh   File: ExceptionHandle.java   Source Code and License 5 votes vote down vote up
@ExceptionHandler(value = Exception.class)
@ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
@ResponseBody
public Result handleError(HttpServletRequest req, Exception e) {
    String url = req.getMethod() + " " + req.getRequestURL() + "?" + req.getQueryString();
    logger.error("未知错误url: {}", url, e);
    ResultEnum serverError = ResultEnum.INTERNAL_SERVER_ERROR;
    return ResultUtils.error(serverError.getCode(), serverError.getMessage(), url);
}
 
Example 33
Project: springboot-shiro-cas-mybatis   File: UserController.java   Source Code and License 5 votes vote down vote up
@RequestMapping("/add/{name}/{password}")
@ResponseBody
public String addUser(@PathVariable("password")String password,@PathVariable("name")String name){
    User user = new User();
    user.setName(name);
    user.setPassword(password);
    return String.valueOf(userService.addUser(user));
}
 
Example 34
Project: Spring-Boot-Server   File: AppDoctorInfoRestful.java   Source Code and License 5 votes vote down vote up
/**
 * 接单排名和累计接单数量
 * @param 消息id
 */
@RequestMapping(value = "/getRankLast")
@ResponseBody
public PageData getRankLast(@RequestBody PageData pd) throws Exception {
	if (StringUtils.isBlank(pd.getString("HEL_ID"))) {
		return WebResult.requestFailed(10001, "参数缺失!", null);
	}
	else {
		PageData accinfo = appDoctorInfoMapper.getRankLast(pd);
		return WebResult.requestSuccess(accinfo);
	}
}
 
Example 35
Project: mumu   File: SystemPermissionController.java   Source Code and License 5 votes vote down vote up
/**
 * 删除权限
 * @param permissionId 权限id
 * @return
 */
@ResponseBody
@RequiresPermissions("system:permission:delete")
@MumuLog(name = "删除权限",operater = "DELETE")
@RequestMapping(value="/delete/{permissionId}",method=RequestMethod.DELETE)
public ResponseEntity permissionDelete(@PathVariable String permissionId){
	try {
		permissionService.deletePermissionById(permissionId);
	} catch (Exception e) {
		log.error(e);
		return new ResponseEntity(500, "删除菜单权限出现异常", null);
	}
	return new ResponseEntity(200,"删除菜单权限操作成功",null);
}
 
Example 36
Project: logistimo-web-service   File: DomainConfigController.java   Source Code and License 5 votes vote down vote up
@RequestMapping(value = "/optimizer", method = RequestMethod.GET)
public
@ResponseBody
OptimizerConfig getOptimizerConfig() {
  Long domainId = SecurityUtils.getCurrentDomainId();
  DomainConfig dc = DomainConfig.getInstance(domainId);
  return dc.getOptimizerConfig();
}
 
Example 37
Project: clemon   File: ResourceController.java   Source Code and License 5 votes vote down vote up
@ResponseBody
@RequestMapping(value = "/get/resourceAndOperation")
public String findResourceAndOperation() {
	List<Resource> resourceList = resourceService.findAll();
	List<Operation> operationList = operationService.findAll();
	Map <String,Object> map = new HashMap<String,Object>();
	map.put("resource", resourceList);
	map.put("operation", operationList);
	return JsonUtil.toJsonByProperties(map);
}
 
Example 38
Project: SSMFrameBase   File: UserController.java   Source Code and License 5 votes vote down vote up
/**
 * 用户登录校验
 * @return
 */
@RequestMapping(value = "/user/loginCheck", method=RequestMethod.POST)
@ResponseBody
public JSON check(){
	int status = 1;
	try {

	} catch (Exception e) {
		status = -1;
	}
	Map<String, Object> map = new HashMap<>();
	map.put("status", status);
	return JsonUtil.newJson().addData("data", map).toJson();
}
 
Example 39
Project: oneops   File: DjRestController.java   Source Code and License 5 votes vote down vote up
@RequestMapping(method=RequestMethod.PUT, value="/dj/simple/rfc/relations/{rfcId}")
@ResponseBody
public CmsRfcRelationSimple updateRfcRelation(
		@PathVariable long rfcId, 
		@RequestBody CmsRfcRelationSimple relSimple,
		@RequestHeader(value="X-Cms-Scope", required = false)  String scope,
		@RequestHeader(value="X-Cms-User", required = false)  String userId) throws DJException {
	
	scopeVerifier.verifyScope(scope, relSimple);

	relSimple.setRfcId(rfcId);
	CmsRfcRelation rel = cmsUtil.custRfcRelSimple2RfcRel(relSimple);
	rel.setUpdatedBy(userId);
	return cmsUtil.custRfcRel2RfcRelSimple(djManager.updateRfcRelation(rel));
}
 
Example 40
Project: wangmarket   File: AdminNewsController.java   Source Code and License 5 votes vote down vote up
/**
 * 删除文章
 * @param id News.id
 * @param model
 * @return
 */
@RequiresPermissions("adminNewsDelete")
@RequestMapping("delete")
@ResponseBody
public String delete(@RequestParam(value = "id", required = true , defaultValue="") int id, Model model){
	News news = sqlService.findById(News.class, id);
	if(news == null){
		return "信息不存在";
	}
	sqlService.delete(news);
	return success(model, "删除成功");
}
 
Example 41
Project: Spring-Boot-Server   File: AppDoctorRestful.java   Source Code and License 5 votes vote down vote up
/**
 * 新单提醒列表(分页)
 * @return
 */
@RequestMapping(value = "/getNewOrderInfoList")
@ResponseBody
public PageData getNewOrderInfoList(@RequestBody PageData pd) throws Exception {
	if (StringUtils.isBlank(pd.getString("UI_ID"))) {
		return WebResult.requestFailed(10001, "参数缺失!", null);
	}
	else {
		List<PageData> list = null;
		list = appDoctorMapper.getNewOrderInfoList(pd);
		return WebResult.requestSuccess(list);
	}
}
 
Example 42
Project: IPPR2016   File: ProcessModelStorageGatewayController.java   Source Code and License 5 votes vote down vote up
@RequestMapping(value = "api/processes", method = RequestMethod.GET)
public @ResponseBody Callable<ResponseEntity<ProcessModelDTO[]>> findActiveProcesses(
    final HttpServletRequest request,
    @RequestParam(value = "page", required = true) final int page,
    @RequestParam(value = "size", required = false, defaultValue = "10") final int size) {
  return () -> {
    final HttpHeaderUser user = new HttpHeaderUser(request);
    return processModelStorageCaller.findActiveProcesses(user, page, size).get();
  };
}
 
Example 43
Project: sjk   File: AppController.java   Source Code and License 5 votes vote down vote up
/**
 * 移动应用的色块接口
 * 
 * @return
 */
@Cacheable(exp = defaultCacheTime)
@RequestMapping(value = "/cdn/mobile-metroinfo.json", method = RequestMethod.GET, produces = "application/json;charset=UTF-8")
@ResponseBody
public String mobileMetroinfo() {
    List<MetroOldMobileVO> list = metroService.getMoFeaturedlist();

    JSONObject output = new JSONObject();
    JSONObject server = new JSONObject();
    output.put("result", server);
    output.put("data", list);
    server.put("code", SvrResult.OK.getCode());
    server.put("msg", SvrResult.OK.getMsg());
    return output.toJSONString(jsonStyle);
}
 
Example 44
Project: Spring-Boot-Server   File: FilesUploadsRestful.java   Source Code and License 5 votes vote down vote up
/**
 * @param pd
 * @return
 * @throws Exception
 */
@RequestMapping(value = "saveAdd")
@ResponseBody
public PageData saveAdd(@RequestBody PageData pd) throws Exception {
    pd.put("id", UuidUtil.get32UUID());
    fileUploadsMapper.save(pd);
    //return "system/filesuploads/filesuploads_list";
    return WebResult.requestSuccess();
}
 
Example 45
Project: popular-movie-store   File: ShoppingCartController.java   Source Code and License 5 votes vote down vote up
/**
 * @param movieId
 * @param qty
 * @param session
 * @return
 */
@GetMapping("/cart/add")
public @ResponseBody
String addItemToCart(@RequestParam("movieId") String movieId, @RequestParam("quantity") int qty,
                     HttpSession session) {

    MovieCart movieCart;

    if (session.getAttribute(SESSION_ATTR_MOVIE_CART) == null) {
        log.info("No Cart Exists for the session, creating one");
        movieCart = new MovieCart();
        movieCart.setOrderId(UUID.randomUUID().toString());
    } else {
        log.info("Cart Exists for the session, will be updated");
        movieCart = (MovieCart) session.getAttribute(SESSION_ATTR_MOVIE_CART);
    }

    log.info("Adding/Updating {} with Quantity {} to cart ", movieId, qty);

    Map<String, Integer> movieItems = movieCart.getMovieItems();

    if (movieItems.containsKey(movieId)) {
        movieItems.replace(movieId, qty);
    } else {
        movieItems.put(movieId, qty);
    }

    log.info("Movie Cart:{}", movieCart);

    //update the session back
    session.setAttribute(SESSION_ATTR_MOVIE_CART, movieCart);

    return String.valueOf(movieCart.getMovieItems().size());
}
 
Example 46
Project: Android_watch_magpie   File: PublisherController.java   Source Code and License 5 votes vote down vote up
@Override
@RequestMapping(value = PUB_ALERT_SVC, method = RequestMethod.POST)
public @ResponseBody boolean notifyAlert(
		@PathVariable("pubId") long pubId, 
		@RequestBody GlucoseAlert glucoseAlert,
		HttpServletResponse response) {
	
	// Check that exists a publisher with the provided id
	if (!mobileclients.exists(pubId)) {
		response.setStatus(HttpServletResponse.SC_FORBIDDEN);
		return false;
	}
	
	// Store the alert
	glucosealerts.save(glucoseAlert);
	
	System.out.println(glucoseAlert.toString());
	
	MobileClient publisher = mobileclients.findOne(pubId);
	if (publisher.getClients().containsValue(SubscriptionStatus.ACCEPTED)) {
		List<String> subGcmTokens = new ArrayList<String>();
		for (Map.Entry<Long, SubscriptionStatus> entry : publisher.getClients().entrySet()) {
			if (entry.getValue().equals(SubscriptionStatus.ACCEPTED)) {
				MobileClient subscriber = mobileclients.findOne(entry.getKey());
				subGcmTokens.add(subscriber.getGcmToken());
			}
		}
		try {
			GcmSender.notifyAlert(publisher, glucoseAlert, subGcmTokens);
		} catch (IOException e) {
			e.printStackTrace();
			return false;
		}
		return true;
	} else {
		return false;
	}
}
 
Example 47
Project: easyweb   File: IndexController.java   Source Code and License 5 votes vote down vote up
@ResponseBody
@RequestMapping("/menus")
@ApiOperation(value = "菜单接口")
public Object menus() {
    List<SysMenu> menuList = UserUtils.getMenuList();
    return new BaseResult(BaseResultCode.SUCCESS, menuList);
}
 
Example 48
Project: batch-scheduler   File: DomainController.java   Source Code and License 5 votes vote down vote up
/**
 * 更新域信息
 */
@RequestMapping(method = RequestMethod.PUT)
@ResponseBody
@ApiOperation(value = "更新域定义信息", notes = "更新域的详细信息,如:域名称,域状态")
@ApiImplicitParams({
        @ApiImplicitParam(required = true, name = "domain_id", value = "域编码"),
        @ApiImplicitParam(required = true, name = "domain_desc", value = "域描述信息")
})
public String update(@Validated DomainEntity domainEntity, BindingResult bindingResult, HttpServletResponse response, HttpServletRequest request) {
    if (bindingResult.hasErrors()) {
        for (ObjectError m : bindingResult.getAllErrors()) {
            response.setStatus(421);
            return Hret.error(421, m.getDefaultMessage(), null);
        }
    }

    String userId = JwtService.getConnUser(request).getUserId();
    domainEntity.setDomainModifyUser(userId);
    domainEntity.setCreateUserId(userId);

    Boolean status = authService.domainAuth(request, domainEntity.getDomainId(), "w").getStatus();
    if (!status) {
        response.setStatus(403);
        return Hret.error(403, "你没有权限编辑域 [ " + domainEntity.getDomainDesc() + " ]", domainEntity);
    }

    RetMsg retMsg = domainService.update(domainEntity);
    if (retMsg.checkCode()) {
        return Hret.success(retMsg);
    }

    response.setStatus(retMsg.getCode());
    return Hret.error(retMsg);
}
 
Example 49
Project: sjk   File: MixFeaturedController.java   Source Code and License 5 votes vote down vote up
@RequestMapping(value = "/show.d", produces = "application/json;charset=UTF-8")
@ResponseBody
public String show(@RequestParam Integer[] id) {
    JSONObject output = new JSONObject();
    JSONObject server = new JSONObject();
    output.put("result", server);

    if (id == null || id.length < 1) {
        server.put("msg", "Don't do that!The ids is empty!!!");
        return output.toJSONString(jsonStyle);
    }
    try {
        boolean result = service.updateShow(Arrays.asList(id));
        if (result) {
            server.put("code", SvrResult.OK.getCode());
            server.put("msg", SvrResult.OK.getMsg());
        } else {
            server.put("code", SvrResult.ERROR.getCode());
            server.put("msg", "数目不对");
        }
    } catch (Exception e) {
        logger.error("Exception", e);
        server.put("code", SvrResult.ERROR.getCode());
        server.put("msg", SvrResult.ERROR.getMsg());
    }
    return output.toJSONString(jsonStyle);
}
 
Example 50
Project: iotplatform   File: ComponentDescriptorController.java   Source Code and License 5 votes vote down vote up
@PreAuthorize("hasAnyAuthority('SYS_ADMIN','TENANT_ADMIN')")
@RequestMapping(value = "/components/{componentType}", method = RequestMethod.GET)
@ResponseBody
public List<ComponentDescriptor> getComponentDescriptorsByType(@PathVariable("componentType") String strComponentType) throws IoTPException {
    checkParameter("componentType", strComponentType);
    try {
        return checkComponentDescriptorsByType(ComponentType.valueOf(strComponentType));
    } catch (Exception e) {
        throw handleException(e);
    }
}
 
Example 51
Project: logistimo-web-service   File: EntityController.java   Source Code and License 5 votes vote down vote up
@RequestMapping(value = "/task/updateentityactivitytimestamps", method = RequestMethod.POST)
public
@ResponseBody
void updateEntityActivityTimestamps(@RequestParam Long entityId, @RequestParam Long timestamp,
                                    @RequestParam int actType) {
  try {
    if (entityId != null && timestamp != null) {
      EntitiesService as = Services.getService(EntitiesServiceImpl.class);
      as.updateEntityActivityTimestamps(entityId, new Date(timestamp), actType);
    }
  } catch (Exception e) {
    xLogger.severe("Error while updating activity timestamps for kiosk: {0} for actType: {1}",
        entityId, actType, e);
  }
}
 
Example 52
Project: OperatieBRP   File: GlobalExceptionHandler.java   Source Code and License 5 votes vote down vote up
/**
 * Exception handler voor {@link MethodArgumentNotValidException}.
 * @param exception de exception
 * @return de map met fouten
 */
@ExceptionHandler
@ResponseBody
@ResponseStatus(HttpStatus.BAD_REQUEST)
public Map<String, Object> handle(MethodArgumentNotValidException exception) {
    return error(exception.getBindingResult().getFieldErrors()
            .stream()
            .map(FieldError::getDefaultMessage)
            .collect(Collectors.toList()));
}
 
Example 53
Project: wangmarket   File: AgencyUserController.java   Source Code and License 5 votes vote down vote up
/**
 * 站点续费,给自己开通的站点续费时长
 * @param siteid 要续费的站点id,site.id
 * @param year 要续费的年数,支持1~10,最大续费10年
 * @return
 */
@RequiresPermissions("agencySiteXuFie")
@RequestMapping("siteXuFie")
@ResponseBody
public BaseVO siteXuFie(HttpServletRequest request, Model model,
		@RequestParam(value = "siteid", required = true) int siteid,
		@RequestParam(value = "year", required = false, defaultValue = "0") int year){
	return transactionalService.siteXuFei(request, siteid, year);
}
 
Example 54
Project: cms-boot   File: SysUserInfoApiController.java   Source Code and License 5 votes vote down vote up
/**
 * 获取用户信息列表
 * @return 用户信息列表
 */
@RequestMapping("/getUserInfoList")
@ResponseBody
public JsonDataBean getUserInfoList(UserInfoFilter userInfoFilter){

    List<SysUserInfo> sysUserInfoList = sysUserInfoService.search(userInfoFilter);

    if (ObjectUtils.isBlank(sysUserInfoList)){
        return getJsonDataBean("200","用户信息为空");
    }

    List<UserInfoBean> userInfoBeanList = new ArrayList<>();
    for (SysUserInfo sysUserInfo: sysUserInfoList){

        SysLoginInfo sysLoginInfo = sysLoginInfoService.findByUserId(sysUserInfo.getSysId());

        UserInfoBean userInfoBean = new UserInfoBean();
        userInfoBean.setSysId(sysUserInfo.getSysId());
        userInfoBean.setNick(sysUserInfo.getNick());
        userInfoBean.setSex(sysUserInfo.getSex());
        userInfoBean.setBirthday(sysUserInfo.getBirthday());

        if (ObjectUtils.isNotBlank(sysLoginInfo)){
            userInfoBean.setUserName(sysLoginInfo.getUserName());
            userInfoBean.setPassWord(sysLoginInfo.getPassWord());
            if(sysLoginInfo.getStatus().equals("1")){
                userInfoBean.setStatus("正常");
            }else if(sysLoginInfo.getStatus().equals("0")){
                userInfoBean.setStatus("禁用");
            }
        }

        userInfoBeanList.add(userInfoBean);
    }

    return getJsonDataBean("200","用户信息",userInfoBeanList);
}
 
Example 55
Project: NGB-master   File: BucketController.java   Source Code and License 5 votes vote down vote up
@ResponseBody
@RequestMapping(value = "/bucket/{bucketId}/load", method = RequestMethod.GET)
@ApiOperation(
        value = "Returns a bucket by given ID",
        notes = "Provides extended data, including files in project",
        produces = MediaType.APPLICATION_JSON_VALUE)
@ApiResponses(
        value = {@ApiResponse(code = HTTP_STATUS_OK, message = API_STATUS_DESCRIPTION)
        })
public final Result<Bucket> loadBucketById(@PathVariable(value = "bucketId") final Long bucketId) {
    return Result.success(bucketManager.loadBucket(bucketId));
}
 
Example 56
Project: Spring-Boot-Server   File: JybAppUserMobileMyTeamRestful.java   Source Code and License 5 votes vote down vote up
@RequestMapping("/checkAllStatusTeams")
@ResponseBody
@Transactional		
public PageData checkAllStatusTeams(@RequestBody PageData pd) throws Exception{
	if(StringUtils.isBlank(pd.getString("UI_ID"))){
		return WebResult.requestFailed(10001, "参数缺失!", null);
	}
	List<PageData> pgTeams = jybAppUserMobileMyTeamMapper.checkAllStatusTeams(pd);
	
	return WebResult.requestSuccess(pgTeams);
}
 
Example 57
Project: mmall   File: ShippingController.java   Source Code and License 5 votes vote down vote up
@RequestMapping("list.do")
@ResponseBody
public ServerResponse<PageInfo> list(@RequestParam(value = "pageNum",defaultValue = "1") int pageNum,
                                     @RequestParam(value = "pageSize",defaultValue = "10")int pageSize,
                                     HttpSession session){
    User user = (User)session.getAttribute(Const.CURRENT_USER);
    if(user ==null){
        return ServerResponse.createByErrorCodeMessage(ResponseCode.NEED_LOGIN.getCode(),ResponseCode.NEED_LOGIN.getDesc());
    }
    return iShippingService.list(user.getId(),pageNum,pageSize);
}
 
Example 58
Project: conversationinsights-service   File: SynonymController.java   Source Code and License 5 votes vote down vote up
@RequestMapping(value = "/synonyms/{synonymId}/variants", method = RequestMethod.GET)
@ResponseBody
public List<EntitySynonymVariant> getEntitySynonymVariants(@PathVariable("synonymId") String synonymId) throws Exception {
  try {
    return variantRepository.findBySynonymId(synonymId);
  } catch (Exception e) {
    e.printStackTrace();
    throw e;
  }
}
 
Example 59
Project: sjk   File: HealthController.java   Source Code and License 5 votes vote down vote up
@RequestMapping(value = "/health.d", produces = "application/json;charset=UTF-8")
@ResponseBody
public String health() {
    JSONObject server = new JSONObject();
    server.put("msg", "It's running...");
    return server.toJSONString();
}
 
Example 60
Project: webside   File: UserController.java   Source Code and License 5 votes vote down vote up
@RequestMapping("add.html")
@ResponseBody
public Object add(UserEntity userEntity) throws AjaxException
{
	Map<String, Object> map = new HashMap<String, Object>();
	try
	{
		String password = userEntity.getPassword();
		// 加密用户输入的密码,得到密码和加密盐,保存到数据库
		UserEntity user = EndecryptUtils.md5Password(userEntity.getAccountName(), userEntity.getPassword(), 2);
		//设置添加用户的密码和加密盐
		userEntity.setPassword(user.getPassword());
		userEntity.setCredentialsSalt(user.getCredentialsSalt());
		//设置创建者姓名
		userEntity.setCreatorName(ShiroAuthenticationManager.getUserAccountName());
		userEntity.setCreateTime(new Date(System.currentTimeMillis()));
		//设置锁定状态:未锁定;删除状态:未删除
		userEntity.setLocked(0);
		userEntity.setDeleteStatus(0);
		UserInfoEntity userInfo = new UserInfoEntity();
		userEntity.setUserInfo(userInfo);
		int result = userService.insert(userEntity, password);
		if(result == 1)
		{
			map.put("success", Boolean.TRUE);
			map.put("data", null);
			map.put("message", "添加成功");
		}else
		{
			map.put("success", Boolean.FALSE);
			map.put("data", null);
			map.put("message", "添加失败");
		}
	}catch(ServiceException e)
	{
		throw new AjaxException(e);
	}
	return map;
}