diff --git a/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/discuss/DiscussController.java b/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/discuss/DiscussController.java index 2a7c945a..e3e96e76 100644 --- a/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/discuss/DiscussController.java +++ b/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/discuss/DiscussController.java @@ -110,9 +110,4 @@ public class DiscussController { return discussService.findDiscussList(pageDTO); } - @ApiModelProperty("根据taskId查询累计的任务时长") - @GetMapping("/cumulativeQuantity") - public R cumulativeQuantity(@RequestParam("taskId") Long taskId){ - return discussService.cumulativeQuantity(taskId); - } } diff --git a/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/task/dto/TaskDetailDTO.java b/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/task/dto/TaskDetailDTO.java index 2aa4ce3f..d5524866 100644 --- a/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/task/dto/TaskDetailDTO.java +++ b/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/task/dto/TaskDetailDTO.java @@ -36,4 +36,9 @@ public class TaskDetailDTO extends TaskDO { //任务内容 String apiTaskMsg; + + //任务下活动累计数量 + Integer cumulativeQuantity; + + } diff --git a/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/service/discuss/DiscussService.java b/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/service/discuss/DiscussService.java index 81674a3a..a9675fec 100644 --- a/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/service/discuss/DiscussService.java +++ b/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/service/discuss/DiscussService.java @@ -75,9 +75,4 @@ public interface DiscussService { R> findDiscussList(DiscussPageDTO pageDTO); - /** - * 根据taskId查询累计的任务时长 - **/ - R cumulativeQuantity(Long taskId); - } diff --git a/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/service/discuss/DiscussServiceImpl.java b/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/service/discuss/DiscussServiceImpl.java index 91a1d915..dfe6aea7 100644 --- a/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/service/discuss/DiscussServiceImpl.java +++ b/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/service/discuss/DiscussServiceImpl.java @@ -208,12 +208,4 @@ public class DiscussServiceImpl implements DiscussService { PageVO returnList = PageUtil.convertPageInfo(discussDTOList); return R.success(returnList); } - - public R cumulativeQuantity(Long taskId){ - List discussDOList = discussMapper.selectList(DiscussDO::getTaskId, taskId); - if (ObjectUtil.isEmpty(discussDOList)){ - return R.success(0); - } - return R.success(discussDOList.stream().mapToInt(DiscussDO::getCropNum).sum()); - } } diff --git a/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/service/task/TaskServiceImpl.java b/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/service/task/TaskServiceImpl.java index 5dc8e1a7..17416763 100644 --- a/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/service/task/TaskServiceImpl.java +++ b/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/service/task/TaskServiceImpl.java @@ -11,12 +11,14 @@ import cn.iocoder.yudao.module.farm.controller.admin.resource.dto.ResourceMsgDTO import cn.iocoder.yudao.module.farm.controller.admin.task.dto.*; import cn.iocoder.yudao.module.farm.dal.dataobject.area.AreaDO; import cn.iocoder.yudao.module.farm.dal.dataobject.crop.CropDO; +import cn.iocoder.yudao.module.farm.dal.dataobject.discuss.DiscussDO; import cn.iocoder.yudao.module.farm.dal.dataobject.project.ProjectDO; import cn.iocoder.yudao.module.farm.dal.dataobject.resource.ResourceDO; import cn.iocoder.yudao.module.farm.dal.dataobject.resourceType.ResourceTypeDO; import cn.iocoder.yudao.module.farm.dal.dataobject.taskCate.TaskCateDO; import cn.iocoder.yudao.module.farm.dal.mysql.area.AreaMapper; import cn.iocoder.yudao.module.farm.dal.mysql.crop.CropMapper; +import cn.iocoder.yudao.module.farm.dal.mysql.discuss.DiscussMapper; import cn.iocoder.yudao.module.farm.dal.mysql.project.ProjectMapper; import cn.iocoder.yudao.module.farm.dal.mysql.resource.ResourceMapper; import cn.iocoder.yudao.module.farm.dal.mysql.resourceType.ResourceTypeMapper; @@ -73,6 +75,8 @@ public class TaskServiceImpl implements TaskService { private ResourceTypeMapper resourceTypeMapper; @Resource private ResourceMapper resourceMapper; + @Resource + private DiscussMapper discussMapper; @Override @@ -179,6 +183,10 @@ public class TaskServiceImpl implements TaskService { taskMsg.setApiMainPerson(cpUserService.getById(String.valueOf(taskMsg.getMainPerson()))); //执行人 taskMsg.setApiExecutor(userList); + //任务活动的累计数量 + List discussDOList = discussMapper.selectList(DiscussDO::getTaskId, id); + taskMsg.setCumulativeQuantity(ObjectUtil.isEmpty(discussDOList) ? 0 : discussDOList.stream().mapToInt(DiscussDO::getCropNum).sum()); + return R.success(taskMsg); }