@RequestMapping(method = RequestMethod.GET, path = "/getblogdetail") public ModelAndView getBlogDetail(Integer blogid) { //博客具体内容 ModelAndView modelAndView = new ModelAndView(); Blog blog = blogService.getBlogDetail(blogid); Blog preblog = blogService.preBlog(blogid); if (preblog != null) { modelAndView.addObject("preblog", preblog); } Blog nextblog = blogService.nextBlog(blogid); if (nextblog != null) { modelAndView.addObject("nextblog", nextblog); } modelAndView.addObject("blog", blog); modelAndView.setViewName("blogdetail"); return modelAndView; }
@RequestMapping(value="/cm/simple/cis/states", method = RequestMethod.PUT) @ResponseBody public String updateCiStateBulk( @RequestParam(value="ids", required = true) String ids, @RequestParam(value="newState", required = true) String newState, @RequestParam(value="relationName", required = false) String relName, @RequestParam(value="direction", required = false) String direction, @RequestParam(value="recursive", required = false) Boolean recursive, @RequestHeader(value="X-Cms-Scope", required = false) String scope, @RequestHeader(value="X-Cms-User", required = false) String userId) { String[] idsStr = ids.split(","); Long[] ciIds = new Long[idsStr.length]; for (int i=0; i<idsStr.length; i++) { ciIds[i] = Long.valueOf(idsStr[i]); } cmManager.updateCiStateBulk(ciIds, newState, relName, direction, recursive != null, userId); return "{\"updated\"}"; }
@RequestMapping(value = "/update", method = { RequestMethod.POST }) public String update(@ModelAttribute User user) { User persistentUser = userService.findByPK(user.getId()); boolean expireUserSession = !user.isActive() || !CollectionUtils.isEqualCollection(user.getRoles(), persistentUser.getRoles()); persistentUser.setFirstname(user.getFirstname()); persistentUser.setLastname(user.getLastname()); persistentUser.setEmail(user.getEmail()); persistentUser.setRoles(user.getRoles()); persistentUser.setActive(user.isActive()); persistentUser.setPasswordExpired(user.isPasswordExpired()); userService.update(persistentUser); if (expireUserSession){ // expire user session sessionService.expireUserSession(persistentUser); }else{ // update user information without expiring her session sessionService.updateUserSession(persistentUser); } return "redirect:/administration/user/list?success=true"; }
/** * 选择表下的字段列表 * @param tableName 表名 * @return */ @ResponseBody @RequestMapping(value={"/select"},method=RequestMethod.GET) public List<SysDBField> exportSelect(String tableName){ List<SysDBField> fields=null; if(tableName==null||"".equals(tableName)){ //获取所有的表 List<SysDBTable> tables = commonService.getAllTable(); if(tables!=null&&tables.size()>0){ fields = commonService.getAllField(tables.get(0).getTableName()); } }else{ fields = commonService.getAllField(tableName); } return fields; }
/** * Is a wrapper to cAdvisor API * * @return * @throws ServiceException * @throws CheckException */ @RequestMapping(value = "/api/machine", method = RequestMethod.GET) public void infoMachine(HttpServletRequest request, HttpServletResponse response) throws ServiceException, CheckException { String responseFromCAdvisor = monitoringService.getJsonMachineFromCAdvisor(); try { response.getWriter().write(responseFromCAdvisor); response.flushBuffer(); } catch (Exception e) { logger.error("error during write and flush response", responseFromCAdvisor); } }
@RequestMapping(value = "/employee", method = { RequestMethod.POST }, produces = MediaType.APPLICATION_JSON_VALUE) public ResponseEntity<MyResponse> addEmployee(@RequestBody Employee employee) { MyResponse resp = new MyResponse(); empService.create(employee); if(HttpStatus.OK.is2xxSuccessful()){ resp.setStatus(HttpStatus.OK.value()); resp.setMessage("Succesfuly created an employee object"); return new ResponseEntity<MyResponse>(resp, HttpStatus.OK); } else{ resp.setStatus(HttpStatus.OK.value()); resp.setMessage("Error while creating an employee object"); return new ResponseEntity<MyResponse>(resp, HttpStatus.INTERNAL_SERVER_ERROR); } }
@PreAuthorize("hasRole('ROLE_MANAGER') or hasRole('ROLE_LIVREUR')") @RequestMapping(value="/multiDelivery", method=RequestMethod.POST) @Transactional public String multiDelivery(@RequestParam List<Long> listeIds, Model uiModel) { for(Long id : listeIds){ try { Card card = Card.findCard(id); card.setDeliveredDate(new Date()); card.merge(); } catch (Exception e) { log.info("La carte avec l'id suivant n'a pas été marquée comme livrée : " + id, e); } } uiModel.asMap().clear(); return "redirect:/manager/"; }
@RequestMapping(method=RequestMethod.POST, path="/admin/chat-list", produces = "application/json") public @ResponseBody List<ChatList> actionChatList(@RequestParam String userId, @RequestParam String page) { try { return helper.getChatDB().getViewRequestBuilder("chats", "getChatList") .newRequest(Key.Type.COMPLEX, ChatList.class) .startKey(Key.complex(userId)) .endKey(Key.complex(userId, "\ufff0")) .inclusiveEnd(true) .limit(MAX_SIZE) .skip((Integer.parseInt(page) - 1) * MAX_SIZE) .build().getResponse().getValues(); } catch (Exception e) { e.printStackTrace(); } return new ArrayList<ChatList>(); }
@RequestMapping(value = "auth", method = RequestMethod.POST) public ResponseEntity<?> auth(@RequestBody AuthRequest ar) { final Authentication authentication = authenticationManager.authenticate( new UsernamePasswordAuthenticationToken(ar.getUsername(), ar.getPassword()) ); SecurityContextHolder.getContext().setAuthentication(authentication); User u = userRepository.findByUsername(ar.getUsername()); if (u != null) { String token = jwtTokenUtil.generateToken(u); return ResponseEntity.ok(new AuthResponse(token)); } else { return ResponseEntity.status(HttpStatus.UNAUTHORIZED).build(); } }
@PreAuthorize("hasAuthority('TENANT_ADMIN')") @RequestMapping(value = "/customer/asset/{assetId}", method = RequestMethod.DELETE) @ResponseBody public Asset unassignAssetFromCustomer(@PathVariable("assetId") String strAssetId) throws IoTPException { checkParameter("assetId", strAssetId); try { AssetId assetId = new AssetId(toUUID(strAssetId)); Asset asset = checkAssetId(assetId); if (asset.getCustomerId() == null || asset.getCustomerId().getId().equals(ModelConstants.NULL_UUID)) { throw new IncorrectParameterException("Asset isn't assigned to any customer!"); } return checkNotNull(assetService.unassignAssetFromCustomer(assetId)); } catch (Exception e) { throw handleException(e); } }
@RequestMapping(method=RequestMethod.PUT, value="/cm/simple/relations/{ciRelId}") @ResponseBody public CmsCIRelationSimple updateCIRelation( @PathVariable long ciRelId, @RequestParam(value="value", required = false) String valueType, @RequestBody CmsCIRelationSimple relSimple, @RequestHeader(value="X-Cms-Scope", required = false) String scope, @RequestHeader(value="X-Cms-User", required = false) String userId) throws CIValidationException { scopeVerifier.verifyScope(scope, relSimple); relSimple.setCiRelationId(ciRelId); CmsCIRelation rel = cmsUtil.custCIRelationSimple2CIRelation(relSimple, valueType); rel.setUpdatedBy(userId); CmsCIRelation newRel = cmManager.updateRelation(rel); String[] attrProps = null; if (relSimple.getRelationAttrProps().size() >0) { attrProps = relSimple.getRelationAttrProps().keySet().toArray(new String[relSimple.getRelationAttrProps().size()]); } return cmsUtil.custCIRelation2CIRelationSimple(newRel, valueType,false, attrProps); }
@RequestMapping(value="/cm/cis/{ciId}", method = RequestMethod.GET) @ResponseBody @ReadOnlyDataAccess public CmsCI getCIById( @PathVariable long ciId, @RequestHeader(value="X-Cms-Scope", required = false) String scope) { CmsCI ci = cmManager.getCiById(ciId); if (ci == null) throw new CmsException(CmsError.CMS_NO_CI_WITH_GIVEN_ID_ERROR, "There is no ci with this id"); scopeVerifier.verifyScope(scope, ci); return ci; }
@RequestMapping(value = "/", method = RequestMethod.POST) public @ResponseBody String create(@RequestBody WidgetModel model, HttpServletRequest request) { SecureUserDetails sUser = SecurityUtils.getUserDetails(request); Locale locale = sUser.getLocale(); ResourceBundle backendMessages = Resources.get().getBundle("BackendMessages", locale); long domainId = SessionMgr.getCurrentDomain(request.getSession(), sUser.getUsername()); try { IWidget wid = builder.buildWidget(model, domainId, sUser.getUsername()); IDashboardService ds = Services.getService(DashboardService.class); ds.createWidget(wid); model.config.wId = wid.getwId(); IWidget widConfig = builder.updateWidgetConfig(ds, model.config); ds.updateWidgetConfig(widConfig); } catch (ServiceException e) { xLogger.severe("Error creating Widget for " + domainId); throw new InvalidServiceException("Error creating Widget for " + domainId); } return "Widget " + MsgUtil.bold(model.nm) + " " + backendMessages.getString("created.success"); }
/** * 更新角色信息 * @param role * @return */ @RequestMapping(value = "edit",method = RequestMethod.POST) @ResponseBody public WebResult edit(Role role,HttpSession session){ boolean success = false; AdminUser loginUser = (AdminUser) session.getAttribute("loginUser"); if(role.getId() != null){ role.setCreator(loginUser.getId()); success = roleService.update(role); }else { role.setUpdateUser(loginUser.getId()); role.setUpdateTime(new Date()); success = roleService.insert(role); } if(success){ return WebResult.success(); }else{ return WebResult.unKnown(); } }
@RequestMapping(value = { "/register" }, method = RequestMethod.POST) public String saveUserAccount(@Valid User user, BindingResult result, ModelMap model) { if (result.hasErrors() || result==null) { return "register"; } if(!userService.isUserSSOUnique(user.getId(), user.getSsoId())){ FieldError ssoError =new FieldError("user","ssoId",messageSource.getMessage("non.unique.ssoId", new String[]{user.getSsoId()}, Locale.getDefault())); result.addError(ssoError); return "register"; } userService.saveCustomerAccount(user); model.addAttribute("success", "Użytkownik " + user.getFirstName() + " "+ user.getLastName() + " został zarejestrowany."); model.addAttribute("loggedinuser", getPrincipal()); return "registrationsuccess"; }
@RequestMapping( value = "/contains/{s}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON ) public StringsResponseDto contains( @PathVariable("s") String s ){ StringsResponseDto dto = new StringsResponseDto(); if(s == null || s.isEmpty()){ dto.valid = false; } else if(s.length() == 3 && "123456789".contains(s)){ dto.valid = true; } else { dto.valid = false; } return dto; }
@RequestMapping(value = "/general", method = RequestMethod.GET) public @ResponseBody GeneralConfigModel getGeneralConfig( @RequestParam(name = "domain_id", required = false) Long domainId) throws ServiceException { SecureUserDetails sUser = getUserDetails(); Locale locale = sUser.getLocale(); ResourceBundle backendMessages = Resources.get().getBundle("BackendMessages", locale); Long dId = (null == domainId) ? SecurityUtils.getCurrentDomainId() : domainId; if (!usersService.hasAccessToDomain(sUser.getUsername(), dId)) { xLogger.warn("User {0} does not have access to domain id {1}", sUser.getUsername(), domainId); throw new InvalidDataException("User does not have access to domain"); } try { return builder.buildGeneralConfigModel(dId, locale, sUser.getTimezone()); } catch (ServiceException | ConfigurationException e) { xLogger.severe("Error in fetching general configuration", e); throw new InvalidServiceException(backendMessages.getString("general.config.fetch.error")); } }
@PreAuthorize(value = "@consumerPermissionValidator.hasReleaseNamespacePermission(#request, #appId, #namespaceName)") @RequestMapping(value = "/apps/{appId}/clusters/{clusterName}/namespaces/{namespaceName}/releases", method = RequestMethod.POST) public OpenReleaseDTO createRelease(@PathVariable String appId, @PathVariable String env, @PathVariable String clusterName, @PathVariable String namespaceName, @RequestBody NamespaceReleaseModel model, HttpServletRequest request) { checkModel(model != null); RequestPrecondition.checkArguments(!StringUtils.isContainEmpty(model.getReleasedBy(), model .getReleaseTitle()), "Params(releaseTitle and releasedBy) can not be empty"); if (userService.findByUserId(model.getReleasedBy()) == null) { throw new BadRequestException("user(releaseBy) not exists"); } model.setAppId(appId); model.setEnv(Env.fromString(env).toString()); model.setClusterName(clusterName); model.setNamespaceName(namespaceName); return OpenApiBeanUtils.transformFromReleaseDTO(releaseService.publish(model)); }
@RequestMapping(method = RequestMethod.POST, value = "/indexes", params = "op=create-defined") @ResponseBody public String createDefinedIndexes( @RequestParam(value = CliStrings.CREATE_DEFINED_INDEXES__GROUP, required = false) final String groupName, @RequestParam(value = CliStrings.CREATE_DEFINED_INDEXES__MEMBER, required = false) final String memberNameId) { CommandStringBuilder command = new CommandStringBuilder(CliStrings.CREATE_DEFINED_INDEXES); if (hasValue(groupName)) { command.addOption(CliStrings.CREATE_DEFINED_INDEXES__GROUP, groupName); } if (hasValue(memberNameId)) { command.addOption(CliStrings.CREATE_DEFINED_INDEXES__MEMBER, memberNameId); } return processCommand(command.toString()); }
@RequestMapping(value = "/member/addressList",method = RequestMethod.POST) @ApiOperation(value = "获得所有收货地址") public Result<List<TbAddress>> addressList(@RequestBody TbAddress tbAddress){ List<TbAddress> list=addressService.getAddressList(tbAddress.getUserId()); return new ResultUtil<List<TbAddress>>().setData(list); }
@RequestMapping(value="/signup/new",method=RequestMethod.POST) public String signup(@Valid SignupForm signupForm, BindingResult result, RedirectAttributes redirectAttributes) { if(result.hasErrors()) { return "signup/form"; } String email = signupForm.getEmail(); if(calendarService.findUserByEmail(email) != null) { result.rejectValue("email", "errors.signup.email", "Email address is already in use."); return "signup/form"; } CalendarUser user = new CalendarUser(); user.setEmail(email); user.setFirstName(signupForm.getFirstName()); user.setLastName(signupForm.getLastName()); user.setPassword(signupForm.getPassword()); logger.info("CalendarUser: {}", user); int id = calendarService.createUser(user); user.setId(id); userContext.setCurrentUser(user); redirectAttributes.addFlashAttribute("message", "You have successfully signed up and logged in."); return "redirect:/"; }
@ApiOperation(value = "Get all groups", notes = "Return docker containers, compose", response = Groups.class, tags={ "Docker", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Groups.class), @ApiResponse(code = 400, message = "Invalid status value", response = Void.class) }) @RequestMapping(value = "/connections/{connection}/get-all", produces = { "application/json" }, method = RequestMethod.GET) ResponseEntity<Groups> getAll(@ApiParam(value = "", required = true) @PathVariable("connection") String connection);
@RequestMapping(value = "/delete", method = RequestMethod.GET) public @ResponseBody String deleteDomainLinks(@RequestParam Long domainId) { if (domainId != null) { IDomainLink parentDomainLink; try { DomainsService ds = Services.getService(DomainsServiceImpl.class); parentDomainLink = ds.getDomainLinks(domainId, IDomainLink.TYPE_PARENT, 0).get(0); List<IDomainLink> childLinksOfParent = ds.getDomainLinks(parentDomainLink.getLinkedDomainId(), IDomainLink.TYPE_CHILD, 0); boolean hasChild = childLinksOfParent.size() > 1; ds.deleteDomainLink(parentDomainLink, hasChild); Map<String, String> params = new HashMap<>(); params.put("domainId", String.valueOf(parentDomainLink.getLinkedDomainId())); params.put("childDomainIds", String.valueOf(domainId)); params.put("type", "remove"); AppFactory.get().getTaskService() .schedule(ITaskService.QUEUE_DEFAULT, DOMAIN_LINK_UPDATE_TASK_URL, params, ITaskService.METHOD_POST); return "Removing domain from parent is scheduled successfully. " + MsgUtil.newLine() + MsgUtil.newLine() + "NOTE: It will take some time to complete."; } catch (Exception e) { xLogger.severe("Unable to remove the domain link", e); throw new InvalidServiceException("Unable to remove domain link"); } } return "success"; }
@ApiOperation(value = "Get Note", notes = "Fetches Note with defined Id.", response = CompleteNote.class, tags = { "Notes", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "Note entity.", response = CompleteNote.class), @ApiResponse(code = 400, message = "Bad request (validation failed).", response = Error.class), @ApiResponse(code = 401, message = "Unauthorized (need to log in / get token).", response = Void.class), @ApiResponse(code = 403, message = "Forbidden (no rights to access resource).", response = Void.class), @ApiResponse(code = 404, message = "Entity not found.", response = Error.class), @ApiResponse(code = 409, message = "Request results in a conflict.", response = Error.class), @ApiResponse(code = 500, message = "Internal Server Error.", response = Error.class) }) @RequestMapping(value = "/api/v1/notes/{noteId}", produces = { "application/json" }, method = RequestMethod.GET) ResponseEntity<CompleteNote> apiV1NotesNoteIdGet( @ApiParam(value = "Unique identifier of a Note.", required = true) @PathVariable("noteId") String noteId, @RequestHeader(value = "userId", required = true) Long userId) throws NoteNotFoundException, AccessingOtherUsersNotesException;
@RequestMapping(value = "/login.html", method = RequestMethod.GET) public String login(@RequestParam(name = "error", required = false) String error, Model model) { try { if (error.equalsIgnoreCase("true")) { String errorMsg = "Login Error"; model.addAttribute("errorMsg", errorMsg); }else{ model.addAttribute("errorMsg", error); } } catch (NullPointerException e) { return "login_form"; } return "login_form"; }
@RequestMapping(value = "/isJoinedChat", method = RequestMethod.GET) @ApiOperation(value = "Find user by ID", notes = "Returns a user") public String getUser( @ApiParam(value = "emailID of user", required = true) @RequestParam(required = true) String email) { Boolean isJoinedChat = slackClientService.isJoinedChat(email); if (isJoinedChat) { return "Y"; } else { return "N"; } }
@RequestMapping(value = "/register", method = RequestMethod.POST) @ResponseBody @ApiOperation( value = "Registers a user in the system", notes = "Registers a user in the system") public Result<Person> register(@RequestBody final Person person) { personManager.savePerson(person); return Result.success(person); }
@RequestMapping(value = "queryOutputTemplate", method = RequestMethod.GET) @ResponseBody public Map<String, Object> queryOutputTemplate(Integer rid, Long otid) { ResultUtil result = new ResultUtil(); OutputTemplateVo outputTemplateVo = bimService.queryOutputTemplate(rid, otid); result.setSuccess(true); result.setData(outputTemplateVo); return result.getResult(); }
@RequestMapping(value = "search", method = RequestMethod.GET) public ModelAndView findDishes(@QuerydslPredicate(root = Dish.class) Predicate predicate, @PageableDefault(sort = {"date"}, direction = Sort.Direction.DESC) Pageable pageable, ModelAndView modelAndView) { Sort realSort = pageable.getSort().and(new Sort(Sort.Direction.ASC, "id")); PageRequest pageRequest = new PageRequest(pageable.getPageNumber(), pageable.getPageSize(), realSort); Page<Dish> page = dishRepo.findAll(predicate, pageRequest); List<DishWebDTO> dishes = page.getContent().stream().map(dishDtoFactory::create).collect(Collectors.toList()); modelAndView.addObject("page", page); modelAndView.addObject("dishes", dishes); modelAndView.addObject("labels", getLabelsFromDishes()); modelAndView.addObject("categories", getCategoriesFromDishes()); modelAndView.addObject("mensas", mensaRepo.findAllByOrderByName()); modelAndView.setViewName("search"); return modelAndView; }
@ApiOperation(value = "测试保存用户动态验证码" ) @RequestMapping(value = "login", method = RequestMethod.GET) public JSONObject login(String username) { String password = String.valueOf(RandomStringUtils.randomNumeric(6)); LoginUser loginUser = loginUserService.saveLoginUser(username,password); LoginUser loginUser1 = loginUserService.getLoginUser(username); JSONObject jsonObject = new JSONObject(); jsonObject.put("设置redis中的loginUser",loginUser); System.out.println(loginUser); jsonObject.put("读取redis中loginUser",loginUser1); System.out.println(loginUser1); return jsonObject; }
@RequestMapping(value = "", method = RequestMethod.GET) public @ResponseBody RestResponsePage<ApprovalModel> getApprovals( @RequestParam(defaultValue = PageParams.DEFAULT_OFFSET_STR) int offset, @RequestParam(defaultValue = PageParams.DEFAULT_SIZE_STR) int size, @RequestParam(required = false, name = "entity_id") Long entityId, @RequestParam(required = false, name = "order_id") Long orderId, @RequestParam(required = false, name = "status") String status, @RequestParam(required = false, name = "expiring_in") Integer expiringIn, @RequestParam(required = false, name = "request_type") Integer requestType, @RequestParam(required = false, name = "requester_id") String requesterId, @RequestParam(required = false, name = "approver_id") String approverId, @RequestParam(required = false, value = "embed") String[] embed) throws ServiceException, ObjectNotFoundException { RestResponsePage<Approval> approvals = getOrderApprovalsAction.invoke( (OrderApprovalFilters) new OrderApprovalFilters() .setEntityId(entityId) .setOrderId(orderId) .setRequestType(requestType) .setExpiringInMinutes(expiringIn) .setStatus(status) .setRequesterId(requesterId) .setApproverId(approverId) .setDomainId(SecurityUtils.getCurrentDomainId()) .setOffset(offset) .setSize(size)); return builder.buildApprovalsModel(approvals, embed); }
/** * 根据cpu类型,phoneId,subCatalog新增包列表 * * @param cputype * @param phoneId * @param brand * @param product * @return */ @Cacheable(exp = defaultCacheTime) @RequestMapping(value = { "/apppack-list.json", "/cdn/apppack-list.json" }, method = RequestMethod.GET, produces = "application/json;charset=UTF-8") @ResponseBody public String getPackageListByCpu(@RequestParam(required = false) Integer cputype, @RequestParam(required = false) String phoneId, @RequestParam(required = false) String subCatalog) { JSONObject output = new JSONObject(); JSONObject server = new JSONObject(); output.put("result", server); try { if (null == cputype && null == phoneId && null == subCatalog && null == subCatalog) { // List<AppForAllBigGameVo> appList = // appService.getAllAppList(); // List<BigGamePacks> getAllBigGameList = // bigGamePackService.getAllBigGameList(); // mybaties List<BigGamePacks> getAllBigGameList = bigGamePackService.getBigGamePakcList(); // list查询后进行封装 output.put("data", getAllBigGameList); } else { // List<AppForAllBigGameVo> applist = // appService.getApplistByParams(cputype, phoneId, subCatalog); List<BigGamePacks> applist = bigGamePackService.getApplistByParams(cputype, phoneId, subCatalog); output.put("data", applist); } server.put("code", OK.getCode()); server.put("msg", OK.getMsg()); } catch (Exception e) { server.put("code", ERROR.getCode()); server.put("msg", ERROR.getMsg()); logger.error("Exception", e); } return output.toJSONString(jsonStyle); }
@RequestMapping(value = "/eliminar-evento/{id}", method = RequestMethod.GET) public String eliminarEvento(@PathVariable("id") Long id, Model model) { if (id > 0) { Contexto contexto = FactoriaComandos.getInstance().crearComando(ELIMINAR_EVENTO).execute(id); if (contexto.getEvento() == ELIMINAR_EVENTO) { return "redirect:/administracion/admin"; } else { return "error-500"; } } return "redirect:/administracion/admin"; }
@RequestMapping(value="/dj/simple/rfcs/count", method = RequestMethod.GET) @ResponseBody public String getRfcCountForNs( @RequestParam(value = "nsPath" , required = true) String nsPath, @RequestHeader(value="X-Cms-Scope", required = false) String scope) { scopeVerifier.verifyScope(scope, nsPath); return "{\"ci\":" + djManager.getRfcCiCountByNs(nsPath) + ",\"relation\":" + djManager.getRfcRelationCountByNs(nsPath) + "}"; }
/** * POST Requests handle submitting new user registration form. */ @RequestMapping(path = "/me", method = RequestMethod.GET) public String me(Authentication auth) { if (isLoggedIn()) { return "redirect:/"; } final CustomUserDetails userDetails = getLoggedInUser(); final User user = userDetails.getUserModel(); logger.info("User: {}", user); logger.info("User Role: {}", user.getRole().name()); logger.info("Authorities: {}", auth.getAuthorities()); return "redirect:/"; }
@RequiresPermissions("permission:delete") @RequestMapping(value = "/delete", method = RequestMethod.GET) public String delete(ModelMap modelMap, @RequestParam(value = "id", required = false, defaultValue = "") Long id) { permissionService.deletePermission(id); return "redirect:/permission/all"; }
@RequestMapping(value = "/createClub", method = RequestMethod.POST) public String createClub(HttpServletRequest request, HttpServletResponse response, Model model, @RequestParam("file") MultipartFile file){ BaseFile baseFile = new BaseFile(); baseFile.upload(file, FOLDER_OFFICE_EXCEL+"importFile"); String fileNamee = file.getOriginalFilename(); clubService.createClub("importFile", fileNamee.substring(0, fileNamee.lastIndexOf("."))); return ajaxReturn(response, null); }
/** * 用户登录 * @param req * @return * @throws BusinessException */ @RequestMapping(value = "/user/doLogin", method=RequestMethod.POST) @ResponseBody public JSON doLogin(@RequestBody @Valid UserLoginReq req, HttpSession session) throws BusinessException { User user = userService.doLogin(req); session.setAttribute(Constant.SESSION_USER, user); User newUser = new User(); newUser.setId(user.getId()); newUser.setUsername(user.getUsername()); return JsonUtil.newJson().addData("data", newUser).toJson(); }
@RequestMapping(method=RequestMethod.POST) public String addUser(@Valid User us) throws Exception{ int count = userService.insertUser(us); if(count>0){ return "redirect:user"; }else{ return "useradd"; } }