com.xxl.job.admin.core.model.XxlJobGroup Java Examples
The following examples show how to use
com.xxl.job.admin.core.model.XxlJobGroup.
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: XxlJobGroupDaoTest.java From microservices-platform with Apache License 2.0 | 6 votes |
@Test public void test(){ List<XxlJobGroup> list = xxlJobGroupDao.findAll(); List<XxlJobGroup> list2 = xxlJobGroupDao.findByAddressType(0); XxlJobGroup group = new XxlJobGroup(); group.setAppName("setAppName"); group.setTitle("setTitle"); group.setOrder(1); group.setAddressType(0); group.setAddressList("setAddressList"); int ret = xxlJobGroupDao.save(group); XxlJobGroup group2 = xxlJobGroupDao.load(group.getId()); group2.setAppName("setAppName2"); group2.setTitle("setTitle2"); group2.setOrder(2); group2.setAddressType(2); group2.setAddressList("setAddressList2"); int ret2 = xxlJobGroupDao.update(group2); int ret3 = xxlJobGroupDao.remove(group.getId()); }
Example #2
Source File: JobGroupController.java From microservices-platform with Apache License 2.0 | 6 votes |
@RequestMapping("/remove") @ResponseBody public ReturnT<String> remove(int id){ // valid int count = xxlJobInfoDao.pageListCount(0, 10, id, null, null); if (count > 0) { return new ReturnT<String>(500, I18nUtil.getString("jobgroup_del_limit_0") ); } List<XxlJobGroup> allList = xxlJobGroupDao.findAll(); if (allList.size() == 1) { return new ReturnT<String>(500, I18nUtil.getString("jobgroup_del_limit_1") ); } int ret = xxlJobGroupDao.remove(id); return (ret>0)?ReturnT.SUCCESS:ReturnT.FAIL; }
Example #3
Source File: JobGroupController.java From open-capacity-platform with Apache License 2.0 | 6 votes |
@RequestMapping("/remove") @ResponseBody public ReturnT<String> remove(int id){ // valid int count = xxlJobInfoDao.pageListCount(0, 10, id, null, null); if (count > 0) { return new ReturnT<String>(500, I18nUtil.getString("jobgroup_del_limit_0") ); } List<XxlJobGroup> allList = xxlJobGroupDao.findAll(); if (allList.size() == 1) { return new ReturnT<String>(500, I18nUtil.getString("jobgroup_del_limit_1") ); } int ret = xxlJobGroupDao.remove(id); return (ret>0)?ReturnT.SUCCESS:ReturnT.FAIL; }
Example #4
Source File: JobInfoController.java From open-capacity-platform with Apache License 2.0 | 6 votes |
@RequestMapping public String index(Model model, @RequestParam(required = false, defaultValue = "-1") int jobGroup) { // 枚举-字典 model.addAttribute("ExecutorRouteStrategyEnum", ExecutorRouteStrategyEnum.values()); // 路由策略-列表 model.addAttribute("GlueTypeEnum", GlueTypeEnum.values()); // Glue类型-字典 model.addAttribute("ExecutorBlockStrategyEnum", ExecutorBlockStrategyEnum.values()); // 阻塞处理策略-字典 model.addAttribute("ExecutorFailStrategyEnum", ExecutorFailStrategyEnum.values()); // 失败处理策略-字典 // 任务组 List<XxlJobGroup> jobGroupList = xxlJobGroupDao.findAll(); model.addAttribute("JobGroupList", jobGroupList); model.addAttribute("jobGroup", jobGroup); return "jobinfo/jobinfo.index"; }
Example #5
Source File: JobLogController.java From open-capacity-platform with Apache License 2.0 | 6 votes |
@RequestMapping public String index(Model model, @RequestParam(required = false, defaultValue = "0") Integer jobId) { // 执行器列表 List<XxlJobGroup> jobGroupList = xxlJobGroupDao.findAll(); model.addAttribute("JobGroupList", jobGroupList); model.addAttribute("GlueTypeEnum", GlueTypeEnum.values()); // 任务 if (jobId > 0) { XxlJobInfo jobInfo = xxlJobInfoDao.loadById(jobId); model.addAttribute("jobInfo", jobInfo); } return "joblog/joblog.index"; }
Example #6
Source File: JobGroupController.java From xxl-job with GNU General Public License v3.0 | 6 votes |
@RequestMapping("/pageList") @ResponseBody public Map<String, Object> pageList(HttpServletRequest request, @RequestParam(required = false, defaultValue = "0") int start, @RequestParam(required = false, defaultValue = "10") int length, String appname, String title) { // page query List<XxlJobGroup> list = xxlJobGroupDao.pageList(start, length, appname, title); int list_count = xxlJobGroupDao.pageListCount(start, length, appname, title); // package result Map<String, Object> maps = new HashMap<String, Object>(); maps.put("recordsTotal", list_count); // 总记录数 maps.put("recordsFiltered", list_count); // 过滤后的总记录数 maps.put("data", list); // 分页列表 return maps; }
Example #7
Source File: JobInfoController.java From xxl-job with GNU General Public License v3.0 | 6 votes |
@RequestMapping public String index(HttpServletRequest request, Model model, @RequestParam(required = false, defaultValue = "-1") int jobGroup) { // 枚举-字典 model.addAttribute("ExecutorRouteStrategyEnum", ExecutorRouteStrategyEnum.values()); // 路由策略-列表 model.addAttribute("GlueTypeEnum", GlueTypeEnum.values()); // Glue类型-字典 model.addAttribute("ExecutorBlockStrategyEnum", ExecutorBlockStrategyEnum.values()); // 阻塞处理策略-字典 // 执行器列表 List<XxlJobGroup> jobGroupList_all = xxlJobGroupDao.findAll(); // filter group List<XxlJobGroup> jobGroupList = filterJobGroupByRole(request, jobGroupList_all); if (jobGroupList==null || jobGroupList.size()==0) { throw new XxlJobException(I18nUtil.getString("jobgroup_empty")); } model.addAttribute("JobGroupList", jobGroupList); model.addAttribute("jobGroup", jobGroup); return "jobinfo/jobinfo.index"; }
Example #8
Source File: JobGroupController.java From xxl-job with GNU General Public License v3.0 | 6 votes |
@RequestMapping("/remove") @ResponseBody public ReturnT<String> remove(int id){ // valid int count = xxlJobInfoDao.pageListCount(0, 10, id, -1, null, null, null); if (count > 0) { return new ReturnT<String>(500, I18nUtil.getString("jobgroup_del_limit_0") ); } List<XxlJobGroup> allList = xxlJobGroupDao.findAll(); if (allList.size() == 1) { return new ReturnT<String>(500, I18nUtil.getString("jobgroup_del_limit_1") ); } int ret = xxlJobGroupDao.remove(id); return (ret>0)?ReturnT.SUCCESS:ReturnT.FAIL; }
Example #9
Source File: XxlJobGroupDaoTest.java From xxl-job with GNU General Public License v3.0 | 6 votes |
@Test public void test(){ List<XxlJobGroup> list = xxlJobGroupDao.findAll(); List<XxlJobGroup> list2 = xxlJobGroupDao.findByAddressType(0); XxlJobGroup group = new XxlJobGroup(); group.setAppname("setAppName"); group.setTitle("setTitle"); group.setAddressType(0); group.setAddressList("setAddressList"); int ret = xxlJobGroupDao.save(group); XxlJobGroup group2 = xxlJobGroupDao.load(group.getId()); group2.setAppname("setAppName2"); group2.setTitle("setTitle2"); group2.setAddressType(2); group2.setAddressList("setAddressList2"); int ret2 = xxlJobGroupDao.update(group2); int ret3 = xxlJobGroupDao.remove(group.getId()); }
Example #10
Source File: JobGroupController.java From zuihou-admin-cloud with Apache License 2.0 | 6 votes |
@RequestMapping("/remove") @ResponseBody public ReturnT<String> remove(Integer id, Integer type) { // valid int count = xxlJobInfoDao.pageListCount(0, 10, id, null, null, type); if (count > 0) { return new ReturnT<String>(500, I18nUtil.getString("jobgroup_del_limit_0")); } List<XxlJobGroup> allList = xxlJobGroupDao.findAll(); if (allList.size() == 1) { return new ReturnT<String>(500, I18nUtil.getString("jobgroup_del_limit_1")); } int ret = xxlJobGroupDao.remove(id); return (ret > 0) ? ReturnT.SUCCESS : ReturnT.FAIL; }
Example #11
Source File: JobGroupController.java From zuihou-admin-boot with Apache License 2.0 | 6 votes |
@RequestMapping("/remove") @ResponseBody public ReturnT<String> remove(Integer id, Integer type) { // valid int count = xxlJobInfoDao.pageListCount(0, 10, id, null, null, type); if (count > 0) { return new ReturnT<String>(500, I18nUtil.getString("jobgroup_del_limit_0")); } List<XxlJobGroup> allList = xxlJobGroupDao.findAll(); if (allList.size() == 1) { return new ReturnT<String>(500, I18nUtil.getString("jobgroup_del_limit_1")); } int ret = xxlJobGroupDao.remove(id); return (ret > 0) ? ReturnT.SUCCESS : ReturnT.FAIL; }
Example #12
Source File: JobFailMonitorHelper.java From open-capacity-platform with Apache License 2.0 | 6 votes |
/** * fail alarm * * @param jobLog */ private void failAlarm(XxlJobLog jobLog){ // 发送监控的邮件 XxlJobInfo info = XxlJobDynamicScheduler.xxlJobInfoDao.loadById(jobLog.getJobId()); if (info!=null && info.getAlarmEmail()!=null && info.getAlarmEmail().trim().length()>0) { Set<String> emailSet = new HashSet<String>(Arrays.asList(info.getAlarmEmail().split(","))); for (String email: emailSet) { XxlJobGroup group = XxlJobDynamicScheduler.xxlJobGroupDao.load(Integer.valueOf(info.getJobGroup())); String title = I18nUtil.getString("jobconf_monitor"); String content = MessageFormat.format(mailBodyTemplate, group!=null?group.getTitle():"null", info.getId(), info.getJobDesc()); MailUtil.sendMail(email, title, content); } } // TODO, custom alarm strategy, such as sms }
Example #13
Source File: JobGroupController.java From zuihou-admin-cloud with Apache License 2.0 | 5 votes |
@RequestMapping public String index(Model model) { // job group (executor) List<XxlJobGroup> list = xxlJobGroupDao.findAll(); model.addAttribute("list", list); return "jobgroup/jobgroup.index"; }
Example #14
Source File: XxlJobTrigger.java From microservices-platform with Apache License 2.0 | 5 votes |
/** * trigger job * * @param jobId * @param triggerType * @param failRetryCount * >=0: use this param * <0: use param from job info config * @param executorShardingParam * @param executorParam * null: use job param * not null: cover job param */ public static void trigger(int jobId, TriggerTypeEnum triggerType, int failRetryCount, String executorShardingParam, String executorParam) { // load data XxlJobInfo jobInfo = XxlJobAdminConfig.getAdminConfig().getXxlJobInfoDao().loadById(jobId); if (jobInfo == null) { logger.warn(">>>>>>>>>>>> trigger fail, jobId invalid,jobId={}", jobId); return; } if (executorParam != null) { jobInfo.setExecutorParam(executorParam); } int finalFailRetryCount = failRetryCount>=0?failRetryCount:jobInfo.getExecutorFailRetryCount(); XxlJobGroup group = XxlJobAdminConfig.getAdminConfig().getXxlJobGroupDao().load(jobInfo.getJobGroup()); // sharding param int[] shardingParam = null; if (executorShardingParam!=null){ String[] shardingArr = executorShardingParam.split("/"); if (shardingArr.length==2 && StringUtils.isNumeric(shardingArr[0]) && StringUtils.isNumeric(shardingArr[1])) { shardingParam = new int[2]; shardingParam[0] = Integer.valueOf(shardingArr[0]); shardingParam[1] = Integer.valueOf(shardingArr[1]); } } if (ExecutorRouteStrategyEnum.SHARDING_BROADCAST==ExecutorRouteStrategyEnum.match(jobInfo.getExecutorRouteStrategy(), null) && group.getRegistryList()!=null && !group.getRegistryList().isEmpty() && shardingParam==null) { for (int i = 0; i < group.getRegistryList().size(); i++) { processTrigger(group, jobInfo, finalFailRetryCount, triggerType, i, group.getRegistryList().size()); } } else { if (shardingParam == null) { shardingParam = new int[]{0, 1}; } processTrigger(group, jobInfo, finalFailRetryCount, triggerType, shardingParam[0], shardingParam[1]); } }
Example #15
Source File: XxlJobServiceImpl.java From microservices-platform with Apache License 2.0 | 5 votes |
@Override public Map<String, Object> dashboardInfo() { int jobInfoCount = xxlJobInfoDao.findAllCount(); int jobLogCount = xxlJobLogDao.triggerCountByHandleCode(-1); int jobLogSuccessCount = xxlJobLogDao.triggerCountByHandleCode(ReturnT.SUCCESS_CODE); // executor count Set<String> executerAddressSet = new HashSet<String>(); List<XxlJobGroup> groupList = xxlJobGroupDao.findAll(); if (groupList!=null && !groupList.isEmpty()) { for (XxlJobGroup group: groupList) { if (group.getRegistryList()!=null && !group.getRegistryList().isEmpty()) { executerAddressSet.addAll(group.getRegistryList()); } } } int executorCount = executerAddressSet.size(); Map<String, Object> dashboardMap = new HashMap<String, Object>(); dashboardMap.put("jobInfoCount", jobInfoCount); dashboardMap.put("jobLogCount", jobLogCount); dashboardMap.put("jobLogSuccessCount", jobLogSuccessCount); dashboardMap.put("executorCount", executorCount); return dashboardMap; }
Example #16
Source File: JobLogController.java From xxl-job with GNU General Public License v3.0 | 5 votes |
@RequestMapping public String index(HttpServletRequest request, Model model, @RequestParam(required = false, defaultValue = "0") Integer jobId) { // 执行器列表 List<XxlJobGroup> jobGroupList_all = xxlJobGroupDao.findAll(); // filter group List<XxlJobGroup> jobGroupList = JobInfoController.filterJobGroupByRole(request, jobGroupList_all); if (jobGroupList==null || jobGroupList.size()==0) { throw new XxlJobException(I18nUtil.getString("jobgroup_empty")); } model.addAttribute("JobGroupList", jobGroupList); // 任务 if (jobId > 0) { XxlJobInfo jobInfo = xxlJobInfoDao.loadById(jobId); if (jobInfo == null) { throw new RuntimeException(I18nUtil.getString("jobinfo_field_id") + I18nUtil.getString("system_unvalid")); } model.addAttribute("jobInfo", jobInfo); // valid permission JobInfoController.validPermission(request, jobInfo.getJobGroup()); } return "joblog/joblog.index"; }
Example #17
Source File: JobGroupController.java From zuihou-admin-cloud with Apache License 2.0 | 5 votes |
@RequestMapping("/save") @ResponseBody public ReturnT<String> save(XxlJobGroup xxlJobGroup) { // valid if (xxlJobGroup.getAppName() == null || StringUtils.isBlank(xxlJobGroup.getAppName())) { return new ReturnT<String>(500, (I18nUtil.getString("system_please_input") + "AppName")); } if (xxlJobGroup.getAppName().length() < 4 || xxlJobGroup.getAppName().length() > 64) { return new ReturnT<String>(500, I18nUtil.getString("jobgroup_field_appName_length")); } if (xxlJobGroup.getTitle() == null || StringUtils.isBlank(xxlJobGroup.getTitle())) { return new ReturnT<String>(500, (I18nUtil.getString("system_please_input") + I18nUtil.getString("jobgroup_field_title"))); } if (xxlJobGroup.getAddressType() != 0) { if (StringUtils.isBlank(xxlJobGroup.getAddressList())) { return new ReturnT<String>(500, I18nUtil.getString("jobgroup_field_addressType_limit")); } String[] addresss = xxlJobGroup.getAddressList().split(","); for (String item : addresss) { if (StringUtils.isBlank(item)) { return new ReturnT<String>(500, I18nUtil.getString("jobgroup_field_registryList_unvalid")); } } } int ret = xxlJobGroupDao.save(xxlJobGroup); return (ret > 0) ? ReturnT.SUCCESS : ReturnT.FAIL; }
Example #18
Source File: JobInfoController.java From zuihou-admin-cloud with Apache License 2.0 | 5 votes |
@RequestMapping("/index2") public String index2(Model model, @RequestParam(required = false, defaultValue = "-1") Integer jobGroup) { // 枚举-字典 model.addAttribute("ExecutorRouteStrategyEnum", ExecutorRouteStrategyEnum.values()); // 路由策略-列表 model.addAttribute("GlueTypeEnum", GlueTypeEnum.values()); // Glue类型-字典 model.addAttribute("ExecutorBlockStrategyEnum", ExecutorBlockStrategyEnum.values()); // 阻塞处理策略-字典 // 任务组 List<XxlJobGroup> jobGroupList = xxlJobGroupDao.findAll(); model.addAttribute("JobGroupList", jobGroupList); model.addAttribute("jobGroup", jobGroup); return "jobinfo/jobinfo.index2"; }
Example #19
Source File: JobInfoController.java From zuihou-admin-cloud with Apache License 2.0 | 5 votes |
@RequestMapping("/index1") public String index1(Model model, @RequestParam(required = false, defaultValue = "-1") Integer jobGroup) { // 枚举-字典 model.addAttribute("ExecutorRouteStrategyEnum", ExecutorRouteStrategyEnum.values()); // 路由策略-列表 model.addAttribute("GlueTypeEnum", GlueTypeEnum.values()); // Glue类型-字典 model.addAttribute("ExecutorBlockStrategyEnum", ExecutorBlockStrategyEnum.values()); // 阻塞处理策略-字典 // 任务组 List<XxlJobGroup> jobGroupList = xxlJobGroupDao.findAll(); model.addAttribute("JobGroupList", jobGroupList); model.addAttribute("jobGroup", jobGroup); return "jobinfo/jobinfo.index1"; }
Example #20
Source File: UserController.java From xxl-job with GNU General Public License v3.0 | 5 votes |
@RequestMapping @PermissionLimit(adminuser = true) public String index(Model model) { // 执行器列表 List<XxlJobGroup> groupList = xxlJobGroupDao.findAll(); model.addAttribute("groupList", groupList); return "user/user.index"; }
Example #21
Source File: JobGroupController.java From zuihou-admin-boot with Apache License 2.0 | 5 votes |
@RequestMapping public String index(Model model) { // job group (executor) List<XxlJobGroup> list = xxlJobGroupDao.findAll(); model.addAttribute("list", list); return "jobgroup/jobgroup.index"; }
Example #22
Source File: JobGroupController.java From zuihou-admin-boot with Apache License 2.0 | 5 votes |
@RequestMapping("/save") @ResponseBody public ReturnT<String> save(XxlJobGroup xxlJobGroup) { // valid if (xxlJobGroup.getAppName() == null || StringUtils.isBlank(xxlJobGroup.getAppName())) { return new ReturnT<String>(500, (I18nUtil.getString("system_please_input") + "AppName")); } if (xxlJobGroup.getAppName().length() < 4 || xxlJobGroup.getAppName().length() > 64) { return new ReturnT<String>(500, I18nUtil.getString("jobgroup_field_appName_length")); } if (xxlJobGroup.getTitle() == null || StringUtils.isBlank(xxlJobGroup.getTitle())) { return new ReturnT<String>(500, (I18nUtil.getString("system_please_input") + I18nUtil.getString("jobgroup_field_title"))); } if (xxlJobGroup.getAddressType() != 0) { if (StringUtils.isBlank(xxlJobGroup.getAddressList())) { return new ReturnT<String>(500, I18nUtil.getString("jobgroup_field_addressType_limit")); } String[] addresss = xxlJobGroup.getAddressList().split(","); for (String item : addresss) { if (StringUtils.isBlank(item)) { return new ReturnT<String>(500, I18nUtil.getString("jobgroup_field_registryList_unvalid")); } } } int ret = xxlJobGroupDao.save(xxlJobGroup); return (ret > 0) ? ReturnT.SUCCESS : ReturnT.FAIL; }
Example #23
Source File: JobGroupController.java From zuihou-admin-boot with Apache License 2.0 | 5 votes |
@RequestMapping("/update") @ResponseBody public ReturnT<String> update(XxlJobGroup xxlJobGroup) { // valid if (xxlJobGroup.getAppName() == null || StringUtils.isBlank(xxlJobGroup.getAppName())) { return new ReturnT<String>(500, (I18nUtil.getString("system_please_input") + "AppName")); } if (xxlJobGroup.getAppName().length() < 4 || xxlJobGroup.getAppName().length() > 64) { return new ReturnT<String>(500, I18nUtil.getString("jobgroup_field_appName_length")); } if (xxlJobGroup.getTitle() == null || StringUtils.isBlank(xxlJobGroup.getTitle())) { return new ReturnT<String>(500, (I18nUtil.getString("system_please_input") + I18nUtil.getString("jobgroup_field_title"))); } if (xxlJobGroup.getAddressType() == 0) { // 0=自动注册 List<String> registryList = findRegistryByAppName(xxlJobGroup.getAppName()); String addressListStr = null; if (CollectionUtils.isNotEmpty(registryList)) { Collections.sort(registryList); addressListStr = StringUtils.join(registryList, ","); } xxlJobGroup.setAddressList(addressListStr); } else { // 1=手动录入 if (StringUtils.isBlank(xxlJobGroup.getAddressList())) { return new ReturnT<String>(500, I18nUtil.getString("jobgroup_field_addressType_limit")); } String[] addresss = xxlJobGroup.getAddressList().split(","); for (String item : addresss) { if (StringUtils.isBlank(item)) { return new ReturnT<String>(500, I18nUtil.getString("jobgroup_field_registryList_unvalid")); } } } int ret = xxlJobGroupDao.update(xxlJobGroup); return (ret > 0) ? ReturnT.SUCCESS : ReturnT.FAIL; }
Example #24
Source File: JobInfoController.java From zuihou-admin-boot with Apache License 2.0 | 5 votes |
@RequestMapping("/index1") public String index1(Model model, @RequestParam(required = false, defaultValue = "-1") Integer jobGroup) { // 枚举-字典 model.addAttribute("ExecutorRouteStrategyEnum", ExecutorRouteStrategyEnum.values()); // 路由策略-列表 model.addAttribute("GlueTypeEnum", GlueTypeEnum.values()); // Glue类型-字典 model.addAttribute("ExecutorBlockStrategyEnum", ExecutorBlockStrategyEnum.values()); // 阻塞处理策略-字典 // 任务组 List<XxlJobGroup> jobGroupList = xxlJobGroupDao.findAll(); model.addAttribute("JobGroupList", jobGroupList); model.addAttribute("jobGroup", jobGroup); return "jobinfo/jobinfo.index1"; }
Example #25
Source File: JobInfoController.java From zuihou-admin-boot with Apache License 2.0 | 5 votes |
@RequestMapping("/index2") public String index2(Model model, @RequestParam(required = false, defaultValue = "-1") Integer jobGroup) { // 枚举-字典 model.addAttribute("ExecutorRouteStrategyEnum", ExecutorRouteStrategyEnum.values()); // 路由策略-列表 model.addAttribute("GlueTypeEnum", GlueTypeEnum.values()); // Glue类型-字典 model.addAttribute("ExecutorBlockStrategyEnum", ExecutorBlockStrategyEnum.values()); // 阻塞处理策略-字典 // 任务组 List<XxlJobGroup> jobGroupList = xxlJobGroupDao.findAll(); model.addAttribute("JobGroupList", jobGroupList); model.addAttribute("jobGroup", jobGroup); return "jobinfo/jobinfo.index2"; }
Example #26
Source File: JobLogController.java From zuihou-admin-boot with Apache License 2.0 | 5 votes |
@RequestMapping public String index(Model model, @RequestParam(required = false, defaultValue = "0") Integer jobId) { // 执行器列表 List<XxlJobGroup> jobGroupList = xxlJobGroupDao.findAll(); model.addAttribute("JobGroupList", jobGroupList); // 任务 if (jobId > 0) { XxlJobInfo jobInfo = xxlJobInfoDao.loadById(jobId); model.addAttribute("jobInfo", jobInfo); } return "joblog/joblog.index"; }
Example #27
Source File: JobGroupController.java From xxl-job with GNU General Public License v3.0 | 5 votes |
@RequestMapping("/save") @ResponseBody public ReturnT<String> save(XxlJobGroup xxlJobGroup){ // valid if (xxlJobGroup.getAppname()==null || xxlJobGroup.getAppname().trim().length()==0) { return new ReturnT<String>(500, (I18nUtil.getString("system_please_input")+"AppName") ); } if (xxlJobGroup.getAppname().length()<4 || xxlJobGroup.getAppname().length()>64) { return new ReturnT<String>(500, I18nUtil.getString("jobgroup_field_appname_length") ); } if (xxlJobGroup.getTitle()==null || xxlJobGroup.getTitle().trim().length()==0) { return new ReturnT<String>(500, (I18nUtil.getString("system_please_input") + I18nUtil.getString("jobgroup_field_title")) ); } if (xxlJobGroup.getAddressType()!=0) { if (xxlJobGroup.getAddressList()==null || xxlJobGroup.getAddressList().trim().length()==0) { return new ReturnT<String>(500, I18nUtil.getString("jobgroup_field_addressType_limit") ); } String[] addresss = xxlJobGroup.getAddressList().split(","); for (String item: addresss) { if (item==null || item.trim().length()==0) { return new ReturnT<String>(500, I18nUtil.getString("jobgroup_field_registryList_unvalid") ); } } } int ret = xxlJobGroupDao.save(xxlJobGroup); return (ret>0)?ReturnT.SUCCESS:ReturnT.FAIL; }
Example #28
Source File: XxlJobServiceImpl.java From zuihou-admin-boot with Apache License 2.0 | 5 votes |
@Override public Map<String, Object> dashboardInfo() { int jobInfoCount = xxlJobInfoDao.findAllCount(); int jobLogCount = xxlJobLogDao.triggerCountByHandleCode(-1); int jobLogSuccessCount = xxlJobLogDao.triggerCountByHandleCode(ReturnT.SUCCESS_CODE); // executor count Set<String> executerAddressSet = new HashSet<String>(); List<XxlJobGroup> groupList = xxlJobGroupDao.findAll(); if (CollectionUtils.isNotEmpty(groupList)) { for (XxlJobGroup group : groupList) { if (CollectionUtils.isNotEmpty(group.getRegistryList())) { executerAddressSet.addAll(group.getRegistryList()); } } } int executorCount = executerAddressSet.size(); Map<String, Object> dashboardMap = new HashMap<String, Object>(); dashboardMap.put("jobInfoCount", jobInfoCount); dashboardMap.put("jobLogCount", jobLogCount); dashboardMap.put("jobLogSuccessCount", jobLogSuccessCount); dashboardMap.put("executorCount", executorCount); return dashboardMap; }
Example #29
Source File: JobFailMonitorHelper.java From zuihou-admin-cloud with Apache License 2.0 | 5 votes |
/** * fail alarm * * @param jobLog */ private void failAlarm(XxlJobInfo info, XxlJobLog jobLog) { // send monitor email if (info != null && info.getAlarmEmail() != null && info.getAlarmEmail().trim().length() > 0) { String alarmContent = "Alarm Job LogId=" + jobLog.getId(); if (jobLog.getTriggerCode() != ReturnT.SUCCESS_CODE) { alarmContent += "<br>TriggerMsg=" + jobLog.getTriggerMsg(); } if (jobLog.getHandleCode() > 0 && jobLog.getHandleCode() != ReturnT.SUCCESS_CODE) { alarmContent += "<br>HandleCode=" + jobLog.getHandleMsg(); } Set<String> emailSet = new HashSet<String>(Arrays.asList(info.getAlarmEmail().split(","))); for (String email : emailSet) { XxlJobGroup group = XxlJobAdminConfig.getAdminConfig().getXxlJobGroupDao().load(Integer.valueOf(info.getJobGroup())); String title = I18nUtil.getString("jobconf_monitor"); String content = MessageFormat.format(MAIL_BODY_TEMPLATE, group != null ? group.getTitle() : "null", info.getId(), info.getJobDesc(), alarmContent); MailUtil.sendMail(email, title, content); } } // 自定义报警策略, 如短信 }
Example #30
Source File: XxlJobServiceImpl.java From zuihou-admin-cloud with Apache License 2.0 | 5 votes |
@Override public Map<String, Object> dashboardInfo() { int jobInfoCount = xxlJobInfoDao.findAllCount(); int jobLogCount = xxlJobLogDao.triggerCountByHandleCode(-1); int jobLogSuccessCount = xxlJobLogDao.triggerCountByHandleCode(ReturnT.SUCCESS_CODE); // executor count Set<String> executerAddressSet = new HashSet<String>(); List<XxlJobGroup> groupList = xxlJobGroupDao.findAll(); if (CollectionUtils.isNotEmpty(groupList)) { for (XxlJobGroup group : groupList) { if (CollectionUtils.isNotEmpty(group.getRegistryList())) { executerAddressSet.addAll(group.getRegistryList()); } } } int executorCount = executerAddressSet.size(); Map<String, Object> dashboardMap = new HashMap<String, Object>(); dashboardMap.put("jobInfoCount", jobInfoCount); dashboardMap.put("jobLogCount", jobLogCount); dashboardMap.put("jobLogSuccessCount", jobLogSuccessCount); dashboardMap.put("executorCount", executorCount); return dashboardMap; }