From fb91542ce0668b0281c986f76d45498774530ba7 Mon Sep 17 00:00:00 2001 From: xuhy <3313886187@qq.com> Date: 星期五, 11 七月 2025 11:49:02 +0800 Subject: [PATCH] bug修改 --- ruoyi-admin/src/main/java/com/ruoyi/web/controller/task/TaskUtil.java | 24 ++++++++++++++---------- 1 files changed, 14 insertions(+), 10 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/task/TaskUtil.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/task/TaskUtil.java index 6457e24..bde453c 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/task/TaskUtil.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/task/TaskUtil.java @@ -275,26 +275,26 @@ } } } - + tLocationList = tLocationList.stream().distinct().collect(Collectors.toList()); // 抽取重复点位 Integer currentValue = detail.getCurrentValue(); if(currentValue != cycle){ // 周期天数加一 detail.setCurrentValue(currentValue + 1); // 获取重复点位 - Set<TLocation> repeatLocation = redisCache.getCacheSet(detail.getId() + REPEAT_LOCATION); + Set<TLocation> repeatLocation = redisCache.getCacheSet(detail.getId() + ":" + sysUser.getUserId() + REPEAT_LOCATION); if(!CollectionUtils.isEmpty(repeatLocation)){ List<TLocation> locations = randomSelection(new ArrayList<>(tLocationList), num3); tLocationList.addAll(locations); } Set<TLocation> locationSet = new HashSet<>(tLocationList); - redisCache.setCacheSet(detail.getId() + REPEAT_LOCATION, locationSet); + redisCache.setCacheSet(detail.getId() + ":" + sysUser.getUserId() + REPEAT_LOCATION, locationSet); }else { // 设置当前周期为0 detail.setCurrentValue(0); // 将重复点位置空 - redisCache.deleteObject(detail.getId() + REPEAT_LOCATION); + redisCache.deleteObject(detail.getId() + ":" + sysUser.getUserId() + REPEAT_LOCATION); // 将项目部权重置空 redisCache.deleteObject(detail.getId() + PROJECT_DEPT_WEIGHT); // 将保洁员权重置空 @@ -325,12 +325,16 @@ tasks.add(task); } - // 添加应生成任务数量 - TTemplateCount templateCount = new TTemplateCount(); - templateCount.setTemplateId(detail.getId()); - templateCount.setTaskCount(tLocationList.size()* cycle); - templateCount.setUserId(sysUser.getUserId()); - templateCountService.save(templateCount); + // 添加应生成任务数量 + TTemplateCount templateCount = new TTemplateCount(); + templateCount.setTemplateId(detail.getTemplateId()); + // 查询所有的保洁员下面的点位 + List<String> cleanIds = cleaners.stream().map(TCleaner::getId).collect(Collectors.toList()); + List<TLocation> tLocations = locationService.list(Wrappers.lambdaQuery(TLocation.class) + .in(TLocation::getLocationCleaner, cleanIds)); + templateCount.setTaskCount(tLocations.size()); + templateCount.setUserId(sysUser.getUserId()); + templateCountService.save(templateCount); taskCleanService.saveBatch(tasks); taskCount = taskCount + tasks.size(); -- Gitblit v1.7.1