diff --git a/zc-business/src/main/java/com/zc/business/service/impl/DcBatchFunctionsJobGroupServiceImpl.java b/zc-business/src/main/java/com/zc/business/service/impl/DcBatchFunctionsJobGroupServiceImpl.java index 43642183..b8e601f4 100644 --- a/zc-business/src/main/java/com/zc/business/service/impl/DcBatchFunctionsJobGroupServiceImpl.java +++ b/zc-business/src/main/java/com/zc/business/service/impl/DcBatchFunctionsJobGroupServiceImpl.java @@ -48,6 +48,18 @@ public class DcBatchFunctionsJobGroupServiceImpl extends ServiceImpl dcBatchFunctionsJobLambdaQueryWrapper = new LambdaQueryWrapper<>(); + dcBatchFunctionsJobLambdaQueryWrapper.eq(DcBatchFunctionsJob::getJobGroup,dcBatchFunctionsJobGroup.getId()); + List list = dcBatchFunctionsJobService.list(dcBatchFunctionsJobLambdaQueryWrapper); + list.forEach(item->{ + try { + dcBatchFunctionsJobService.editDcBatchFunctionsJob(item); + } catch (SchedulerException e) { + throw new RuntimeException(e); + } catch (TaskException e) { + throw new RuntimeException(e); + } + }); return dcBatchFunctionsJobGroup; } return null; diff --git a/zc-business/src/main/java/com/zc/business/service/impl/DcBatchFunctionsJobServiceImpl.java b/zc-business/src/main/java/com/zc/business/service/impl/DcBatchFunctionsJobServiceImpl.java index 1f001728..73254a70 100644 --- a/zc-business/src/main/java/com/zc/business/service/impl/DcBatchFunctionsJobServiceImpl.java +++ b/zc-business/src/main/java/com/zc/business/service/impl/DcBatchFunctionsJobServiceImpl.java @@ -9,6 +9,7 @@ import com.ruoyi.common.utils.PageUtils; import com.ruoyi.common.utils.spring.SpringUtils; import com.zc.business.domain.DcBatchFunctionsJob; import com.zc.business.domain.DcBatchFunctionsJobGroup; +import com.zc.business.enums.UniversalEnum; import com.zc.business.mapper.DcBatchFunctionsJobMapper; import com.zc.business.service.IDcBatchFunctionsJobGroupService; import com.zc.business.service.IDcBatchFunctionsJobService; @@ -55,8 +56,18 @@ public class DcBatchFunctionsJobServiceImpl extends ServiceImpl detaileds = detailedConfigurations.stream().filter(detailed -> Objects.equals((String) ((JSONObject) detailed).get("time"), time) ).collect(Collectors.toList()); - Integer id = ThreadLocalRandom.current().nextInt(0, 999999999); - if (detaileds.size() > 0) { - JSONObject detailed = (JSONObject) detaileds.get(0); + Integer id = ThreadLocalRandom.current().nextInt(UniversalEnum.ZERO.getNumber(), UniversalEnum.NINE_HUNDRED_AND_NINETY_NINE_HUNDRED_AND_NINETY_NINE_HUNDRED_AND_NINETY_NINE.getNumber()); + if (detaileds.size() > UniversalEnum.ZERO.getNumber()) { + JSONObject detailed = (JSONObject) detaileds.get(UniversalEnum.ZERO.getNumber()); JSONArray tasks = detailed.getJSONArray("tasks"); tasks.add(id); detailed.put("tasks", tasks); @@ -152,10 +166,10 @@ public class DcBatchFunctionsJobServiceImpl extends ServiceImpl dcBatchFunctionsJobs = listDcBatchFunctionsJob(job); - if (dcBatchFunctionsJobs.size() == 0) { + if (dcBatchFunctionsJobs.size() == UniversalEnum.ZERO.getNumber()) { return false; } - DcBatchFunctionsJob dcBatchFunctionsJob = dcBatchFunctionsJobs.get(0); + DcBatchFunctionsJob dcBatchFunctionsJob = dcBatchFunctionsJobs.get(UniversalEnum.ZERO.getNumber()); ScheduleUtils.deleteJob(scheduler, dcBatchFunctionsJob); DcBatchFunctionsJobGroup dcBatchFunctionsJobGroup = dcBatchFunctionsJobGroupService.getById(dcBatchFunctionsJob.getJobGroup()); if (dcBatchFunctionsJobGroup == null) { @@ -177,8 +191,8 @@ public class DcBatchFunctionsJobServiceImpl extends ServiceImpl 0) { - JSONObject detailed = (JSONObject) detaileds.get(0); + if (detaileds.size() > UniversalEnum.ZERO.getNumber()) { + JSONObject detailed = (JSONObject) detaileds.get(UniversalEnum.ZERO.getNumber()); JSONArray tasks = detailed.getJSONArray("tasks"); tasks = tasks.stream() @@ -223,7 +237,7 @@ public class DcBatchFunctionsJobServiceImpl extends ServiceImpl