@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); } }
@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"); }
/** * 启动计划任务 */ @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); }
/** * 编辑组织机构 * @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); } }
@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; }
/** * 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"; }
@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[] }
/** * @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); }
/** * 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; }
@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); } }
@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")); } }
@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(); }
@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; }
/** * 检查用户名是否可用 * @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", "用户名不可用"); } }
@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("无权限操作"); } }
@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(); }
/** * 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); }
@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); }
@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); }
@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"); }
@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(); }
@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); }
@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); }
/** * 根据订单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(); }
@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); } }
@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); }
@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"); }
@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"); } }
/** * 支付宝移动支付后台通知响应 * @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; }
/** * 角色权限列表列表 * @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; }
@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 ""; }
@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); }
@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)); }
/** * 接单排名和累计接单数量 * @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); } }
/** * 删除权限 * @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); }
@RequestMapping(value = "/optimizer", method = RequestMethod.GET) public @ResponseBody OptimizerConfig getOptimizerConfig() { Long domainId = SecurityUtils.getCurrentDomainId(); DomainConfig dc = DomainConfig.getInstance(domainId); return dc.getOptimizerConfig(); }
@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); }
/** * 用户登录校验 * @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(); }
@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)); }
/** * 删除文章 * @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, "删除成功"); }