Browse Source

接口新增:查看任务详情 显示活动时长

zyh
小久哥 3 years ago
parent
commit
9e3968cbda
  1. 5
      zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/discuss/DiscussController.java
  2. 5
      zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/task/dto/TaskDetailDTO.java
  3. 5
      zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/service/discuss/DiscussService.java
  4. 8
      zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/service/discuss/DiscussServiceImpl.java
  5. 8
      zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/service/task/TaskServiceImpl.java

5
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<Integer> cumulativeQuantity(@RequestParam("taskId") Long taskId){
return discussService.cumulativeQuantity(taskId);
}
}

5
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;
}

5
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<PageVO<DiscussDTO>> findDiscussList(DiscussPageDTO pageDTO);
/**
* 根据taskId查询累计的任务时长
**/
R<Integer> cumulativeQuantity(Long taskId);
}

8
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<DiscussDTO> returnList = PageUtil.convertPageInfo(discussDTOList);
return R.success(returnList);
}
public R<Integer> cumulativeQuantity(Long taskId){
List<DiscussDO> discussDOList = discussMapper.selectList(DiscussDO::getTaskId, taskId);
if (ObjectUtil.isEmpty(discussDOList)){
return R.success(0);
}
return R.success(discussDOList.stream().mapToInt(DiscussDO::getCropNum).sum());
}
}

8
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<DiscussDO> discussDOList = discussMapper.selectList(DiscussDO::getTaskId, id);
taskMsg.setCumulativeQuantity(ObjectUtil.isEmpty(discussDOList) ? 0 : discussDOList.stream().mapToInt(DiscussDO::getCropNum).sum());
return R.success(taskMsg);
}

Loading…
Cancel
Save