Java Code Examples for org.jeecg.common.api.vo.Result#error500()
The following examples show how to use
org.jeecg.common.api.vo.Result#error500() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SysPermissionController.java From jeecg-cloud with Apache License 2.0 | 6 votes |
/** * 保存部门授权 * * @return */ @RequestMapping(value = "/saveDepartPermission", method = RequestMethod.POST) //@RequiresRoles({"admin"}) public Result<String> saveDepartPermission(@RequestBody JSONObject json) { long start = System.currentTimeMillis(); Result<String> result = new Result<>(); try { String departId = json.getString("departId"); String permissionIds = json.getString("permissionIds"); String lastPermissionIds = json.getString("lastpermissionIds"); this.sysDepartPermissionService.saveDepartPermission(departId, permissionIds, lastPermissionIds); result.success("保存成功!"); log.info("======部门授权成功=====耗时:" + (System.currentTimeMillis() - start) + "毫秒"); } catch (Exception e) { result.error500("授权失败!"); log.error(e.getMessage(), e); } return result; }
Example 2
Source File: SysAnnouncementSendController.java From jeecg-boot-with-activiti with MIT License | 6 votes |
/** * 编辑 * @param sysAnnouncementSend * @return */ @PutMapping(value = "/edit") public Result<SysAnnouncementSend> eidt(@RequestBody SysAnnouncementSend sysAnnouncementSend) { Result<SysAnnouncementSend> result = new Result<SysAnnouncementSend>(); SysAnnouncementSend sysAnnouncementSendEntity = sysAnnouncementSendService.getById(sysAnnouncementSend.getId()); if(sysAnnouncementSendEntity==null) { result.error500("未找到对应实体"); }else { boolean ok = sysAnnouncementSendService.updateById(sysAnnouncementSend); //TODO 返回false说明什么? if(ok) { result.success("修改成功!"); } } return result; }
Example 3
Source File: SysDictItemController.java From jeecg-cloud with Apache License 2.0 | 6 votes |
/** * @功能:编辑 * @param sysDictItem * @return */ @RequestMapping(value = "/edit", method = RequestMethod.PUT) @CacheEvict(value=CacheConstant.SYS_DICT_CACHE, allEntries=true) public Result<SysDictItem> edit(@RequestBody SysDictItem sysDictItem) { Result<SysDictItem> result = new Result<SysDictItem>(); SysDictItem sysdict = sysDictItemService.getById(sysDictItem.getId()); if(sysdict==null) { result.error500("未找到对应实体"); }else { sysDictItem.setUpdateTime(new Date()); boolean ok = sysDictItemService.updateById(sysDictItem); //TODO 返回false说明什么? if(ok) { result.success("编辑成功!"); } } return result; }
Example 4
Source File: JoaDemoController.java From teaching with Apache License 2.0 | 6 votes |
/** * 编辑 * @param joaDemo * @return */ @PutMapping(value = "/edit") public Result<JoaDemo> edit(@RequestBody JoaDemo joaDemo) { Result<JoaDemo> result = new Result<JoaDemo>(); JoaDemo joaDemoEntity = joaDemoService.getById(joaDemo.getId()); if(joaDemoEntity==null) { result.error500("未找到对应实体"); }else { boolean ok = joaDemoService.updateById(joaDemo); //TODO 返回false说明什么? if(ok) { result.success("修改成功!"); } } return result; }
Example 5
Source File: SysDepartController.java From jeecg-boot with Apache License 2.0 | 6 votes |
/** * 通过id删除 * @param id * @return */ //@RequiresRoles({"admin"}) @RequestMapping(value = "/delete", method = RequestMethod.DELETE) @CacheEvict(value= {CacheConstant.SYS_DEPARTS_CACHE,CacheConstant.SYS_DEPART_IDS_CACHE}, allEntries=true) public Result<SysDepart> delete(@RequestParam(name="id",required=true) String id) { Result<SysDepart> result = new Result<SysDepart>(); SysDepart sysDepart = sysDepartService.getById(id); if(sysDepart==null) { result.error500("未找到对应实体"); }else { boolean ok = sysDepartService.delete(id); if(ok) { //清除部门树内存 //FindsDepartsChildrenUtil.clearSysDepartTreeList(); // FindsDepartsChildrenUtil.clearDepartIdModel(); result.success("删除成功!"); } } return result; }
Example 6
Source File: SysPermissionController.java From jeecg-boot with Apache License 2.0 | 6 votes |
/** * 保存角色授权 * * @return */ @RequestMapping(value = "/saveRolePermission", method = RequestMethod.POST) //@RequiresRoles({"admin"}) public Result<String> saveRolePermission(@RequestBody JSONObject json) { long start = System.currentTimeMillis(); Result<String> result = new Result<>(); try { String roleId = json.getString("roleId"); String permissionIds = json.getString("permissionIds"); String lastPermissionIds = json.getString("lastpermissionIds"); this.sysRolePermissionService.saveRolePermission(roleId, permissionIds, lastPermissionIds); result.success("保存成功!"); log.info("======角色授权成功=====耗时:" + (System.currentTimeMillis() - start) + "毫秒"); } catch (Exception e) { result.error500("授权失败!"); log.error(e.getMessage(), e); } return result; }
Example 7
Source File: SysAnnouncementController.java From jeecg-cloud with Apache License 2.0 | 6 votes |
/** * 通过id删除 * @param id * @return */ @RequestMapping(value = "/delete", method = RequestMethod.DELETE) public Result<SysAnnouncement> delete(@RequestParam(name="id",required=true) String id) { Result<SysAnnouncement> result = new Result<SysAnnouncement>(); SysAnnouncement sysAnnouncement = sysAnnouncementService.getById(id); if(sysAnnouncement==null) { result.error500("未找到对应实体"); }else { sysAnnouncement.setDelFlag(CommonConstant.DEL_FLAG_1.toString()); boolean ok = sysAnnouncementService.updateById(sysAnnouncement); if(ok) { result.success("删除成功!"); } } return result; }
Example 8
Source File: SysPositionController.java From jeecg-cloud with Apache License 2.0 | 6 votes |
/** * 编辑 * * @param sysPosition * @return */ @AutoLog(value = "职务表-编辑") @ApiOperation(value = "职务表-编辑", notes = "职务表-编辑") @PutMapping(value = "/edit") public Result<SysPosition> edit(@RequestBody SysPosition sysPosition) { Result<SysPosition> result = new Result<SysPosition>(); SysPosition sysPositionEntity = sysPositionService.getById(sysPosition.getId()); if (sysPositionEntity == null) { result.error500("未找到对应实体"); } else { boolean ok = sysPositionService.updateById(sysPosition); //TODO 返回false说明什么? if (ok) { result.success("修改成功!"); } } return result; }
Example 9
Source File: TeachingCourseUnitController.java From teaching with Apache License 2.0 | 6 votes |
@GetMapping("getUnitWorkInfo") public Result<CourseUnitWorkModel> getUnitWorkInfo(@RequestParam String unitId) { Result<CourseUnitWorkModel> result = new Result<CourseUnitWorkModel>(); LoginUser user = getCurrentUser(); if (user == null){ //未登录 } CourseUnitWorkModel teachingCourseUnit = teachingCourseUnitService.getCourseWorkUnit(unitId, user.getId()); if(teachingCourseUnit==null) { result.error500("未找到对应实体"); }else { result.setResult(teachingCourseUnit); result.setSuccess(true); } return result; }
Example 10
Source File: SysCategoryController.java From jeecg-cloud with Apache License 2.0 | 6 votes |
/** * 通过id删除 * @param id * @return */ @DeleteMapping(value = "/delete") public Result<SysCategory> delete(@RequestParam(name="id",required=true) String id) { Result<SysCategory> result = new Result<SysCategory>(); SysCategory sysCategory = sysCategoryService.getById(id); if(sysCategory==null) { result.error500("未找到对应实体"); }else { boolean ok = sysCategoryService.removeById(id); if(ok) { result.success("删除成功!"); } } return result; }
Example 11
Source File: SysLogController.java From jeecg-boot with Apache License 2.0 | 5 votes |
/** * @功能:删除单个日志记录 * @param id * @return */ @RequestMapping(value = "/delete", method = RequestMethod.DELETE) public Result<SysLog> delete(@RequestParam(name="id",required=true) String id) { Result<SysLog> result = new Result<SysLog>(); SysLog sysLog = sysLogService.getById(id); if(sysLog==null) { result.error500("未找到对应实体"); }else { boolean ok = sysLogService.removeById(id); if(ok) { result.success("删除成功!"); } } return result; }
Example 12
Source File: JoaDemoController.java From jeecg-boot with Apache License 2.0 | 5 votes |
/** * 批量删除 * @param ids * @return */ @DeleteMapping(value = "/deleteBatch") public Result<JoaDemo> deleteBatch(@RequestParam(name="ids",required=true) String ids) { Result<JoaDemo> result = new Result<JoaDemo>(); if(ids==null || "".equals(ids.trim())) { result.error500("参数不识别!"); }else { this.joaDemoService.removeByIds(Arrays.asList(ids.split(","))); result.success("删除成功!"); } return result; }
Example 13
Source File: SysCategoryController.java From jeecg-boot-with-activiti with MIT License | 5 votes |
/** * 通过id查询 * @param id * @return */ @GetMapping(value = "/queryById") public Result<SysCategory> queryById(@RequestParam(name="id",required=true) String id) { Result<SysCategory> result = new Result<SysCategory>(); SysCategory sysCategory = sysCategoryService.getById(id); if(sysCategory==null) { result.error500("未找到对应实体"); }else { result.setResult(sysCategory); result.setSuccess(true); } return result; }
Example 14
Source File: SysDictController.java From jeecg-boot with Apache License 2.0 | 5 votes |
/** * 大数据量的字典表 走异步加载 即前端输入内容过滤数据 * @param dictCode * @return */ @RequestMapping(value = "/loadDict/{dictCode}", method = RequestMethod.GET) public Result<List<DictModel>> loadDict(@PathVariable String dictCode,@RequestParam(name="keyword") String keyword, @RequestParam(value = "sign",required = false) String sign,HttpServletRequest request) { log.info(" 加载字典表数据,加载关键字: "+ keyword); Result<List<DictModel>> result = new Result<List<DictModel>>(); List<DictModel> ls = null; try { if(dictCode.indexOf(",")!=-1) { String[] params = dictCode.split(","); if(params.length!=3) { result.error500("字典Code格式不正确!"); return result; } ls = sysDictService.queryTableDictItems(params[0],params[1],params[2],keyword); result.setSuccess(true); result.setResult(ls); log.info(result.toString()); }else { result.error500("字典Code格式不正确!"); } } catch (Exception e) { log.error(e.getMessage(),e); result.error500("操作失败"); return result; } return result; }
Example 15
Source File: MockController.java From jeecg-cloud with Apache License 2.0 | 5 votes |
/** * 实时磁盘监控 * @param request * @param response * @return */ @GetMapping("/queryDiskInfo") public Result<List<Map<String,Object>>> queryDiskInfo(HttpServletRequest request, HttpServletResponse response){ Result<List<Map<String,Object>>> res = new Result<>(); try { // 当前文件系统类 FileSystemView fsv = FileSystemView.getFileSystemView(); // 列出所有windows 磁盘 File[] fs = File.listRoots(); log.info("查询磁盘信息:"+fs.length+"个"); List<Map<String,Object>> list = new ArrayList<>(); for (int i = 0; i < fs.length; i++) { if(fs[i].getTotalSpace()==0) { continue; } Map<String,Object> map = new HashMap<>(); map.put("name", fsv.getSystemDisplayName(fs[i])); map.put("max", fs[i].getTotalSpace()); map.put("rest", fs[i].getFreeSpace()); map.put("restPPT", fs[i].getFreeSpace()*100/fs[i].getTotalSpace()); list.add(map); log.info(map.toString()); } res.setResult(list); res.success("查询成功"); } catch (Exception e) { res.error500("查询失败"+e.getMessage()); } return res; }
Example 16
Source File: SysAnnouncementSendController.java From teaching with Apache License 2.0 | 5 votes |
/** * 批量删除 * @param ids * @return */ @DeleteMapping(value = "/deleteBatch") public Result<SysAnnouncementSend> deleteBatch(@RequestParam(name="ids",required=true) String ids) { Result<SysAnnouncementSend> result = new Result<SysAnnouncementSend>(); if(ids==null || "".equals(ids.trim())) { result.error500("参数不识别!"); }else { this.sysAnnouncementSendService.removeByIds(Arrays.asList(ids.split(","))); result.success("删除成功!"); } return result; }
Example 17
Source File: ActuatorRedisController.java From jeecg-boot with Apache License 2.0 | 5 votes |
/** * @功能:获取磁盘信息 * @param request * @param response * @return */ @GetMapping("/queryDiskInfo") public Result<List<Map<String,Object>>> queryDiskInfo(HttpServletRequest request, HttpServletResponse response){ Result<List<Map<String,Object>>> res = new Result<>(); try { // 当前文件系统类 FileSystemView fsv = FileSystemView.getFileSystemView(); // 列出所有windows 磁盘 File[] fs = File.listRoots(); log.info("查询磁盘信息:"+fs.length+"个"); List<Map<String,Object>> list = new ArrayList<>(); for (int i = 0; i < fs.length; i++) { if(fs[i].getTotalSpace()==0) { continue; } Map<String,Object> map = new HashMap<>(); map.put("name", fsv.getSystemDisplayName(fs[i])); map.put("max", fs[i].getTotalSpace()); map.put("rest", fs[i].getFreeSpace()); map.put("restPPT", (fs[i].getTotalSpace()-fs[i].getFreeSpace())*100/fs[i].getTotalSpace()); list.add(map); log.info(map.toString()); } res.setResult(list); res.success("查询成功"); } catch (Exception e) { res.error500("查询失败"+e.getMessage()); } return res; }
Example 18
Source File: SysPermissionController.java From jeecg-boot-with-activiti with MIT License | 5 votes |
/** * 添加菜单 * @param permission * @return */ @RequiresRoles({ "admin" }) @RequestMapping(value = "/add", method = RequestMethod.POST) public Result<SysPermission> add(@RequestBody SysPermission permission) { Result<SysPermission> result = new Result<SysPermission>(); try { permission = PermissionDataUtil.intelligentProcessData(permission); sysPermissionService.addPermission(permission); result.success("添加成功!"); } catch (Exception e) { log.error(e.getMessage(), e); result.error500("操作失败"); } return result; }
Example 19
Source File: SysPositionController.java From jeecg-cloud with Apache License 2.0 | 5 votes |
/** * 通过id查询 * * @param id * @return */ @AutoLog(value = "职务表-通过id查询") @ApiOperation(value = "职务表-通过id查询", notes = "职务表-通过id查询") @GetMapping(value = "/queryById") public Result<SysPosition> queryById(@RequestParam(name = "id", required = true) String id) { Result<SysPosition> result = new Result<SysPosition>(); SysPosition sysPosition = sysPositionService.getById(id); if (sysPosition == null) { result.error500("未找到对应实体"); } else { result.setResult(sysPosition); result.setSuccess(true); } return result; }
Example 20
Source File: SysUserAgentController.java From teaching with Apache License 2.0 | 4 votes |
/** * 批量删除 * @param ids * @return */ @DeleteMapping(value = "/deleteBatch") public Result<SysUserAgent> deleteBatch(@RequestParam(name="ids",required=true) String ids) { Result<SysUserAgent> result = new Result<SysUserAgent>(); if(ids==null || "".equals(ids.trim())) { result.error500("参数不识别!"); }else { this.sysUserAgentService.removeByIds(Arrays.asList(ids.split(","))); result.success("删除成功!"); } return result; }