|
|
|
@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.farm.service.task;
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil; |
|
|
|
|
import cn.hutool.core.text.StrBuilder; |
|
|
|
|
import cn.hutool.core.util.NumberUtil; |
|
|
|
|
import cn.hutool.core.util.ObjectUtil; |
|
|
|
|
import cn.iocoder.yudao.framework.common.page.PageUtil; |
|
|
|
|
import cn.iocoder.yudao.framework.common.page.PageVO; |
|
|
|
@ -186,7 +187,12 @@ public class TaskServiceImpl implements TaskService {
|
|
|
|
|
//任务活动的累计数量
|
|
|
|
|
List<DiscussDO> discussDOList = discussMapper.selectList(DiscussDO::getTaskId, id); |
|
|
|
|
taskMsg.setCumulativeQuantity(ObjectUtil.isEmpty(discussDOList) ? 0 : discussDOList.stream().mapToInt(DiscussDO::getCropNum).sum()); |
|
|
|
|
|
|
|
|
|
//已选择的二级区域
|
|
|
|
|
List<AreaDO> secondAreaList = areaMapper.selectList(AreaDO::getId, taskDO.getAreas()); |
|
|
|
|
taskMsg.setSecondAreaList(secondAreaList); |
|
|
|
|
List<Long> parendIdList = secondAreaList.stream().map(AreaDO::getParentId).collect(Collectors.toList()); |
|
|
|
|
List<AreaDO> firstAreaList = areaMapper.selectList(AreaDO::getId, parendIdList); |
|
|
|
|
taskMsg.setFirstAreaList(firstAreaList); |
|
|
|
|
return R.success(taskMsg); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -214,9 +220,7 @@ public class TaskServiceImpl implements TaskService {
|
|
|
|
|
|
|
|
|
|
for (TaskDO taskDO : taskDOList) { |
|
|
|
|
if (ObjectUtil.isNotEmpty(taskDO.getAreas())){ |
|
|
|
|
for (Object area : taskDO.getAreas()) { |
|
|
|
|
areaIdList.addAll(JSONArray.parseArray(area.toString(), Long.class)); |
|
|
|
|
} |
|
|
|
|
areaIdList.addAll(taskDO.getAreas()); |
|
|
|
|
} |
|
|
|
|
if (ObjectUtil.isNotEmpty(taskDO.getExecutorPerson())){ |
|
|
|
|
executorIdList.addAll(taskDO.getExecutorPerson().toJavaList(Long.class)); |
|
|
|
@ -344,17 +348,13 @@ public class TaskServiceImpl implements TaskService {
|
|
|
|
|
//区域名
|
|
|
|
|
List<String> areaNameList = new ArrayList<>(); |
|
|
|
|
if (ObjectUtil.isNotEmpty(taskDO.getAreas())) { |
|
|
|
|
for (Object obj : taskDO.getAreas()) { |
|
|
|
|
List<Long> areaList = JSONArray.parseArray(obj.toString(), Long.class); |
|
|
|
|
StrBuilder areaName = new StrBuilder(); |
|
|
|
|
areaList.forEach( one ->{ |
|
|
|
|
preAssemblyDTO.getAreaDOList().stream().filter(item -> item.getId().equals(one)).findFirst() |
|
|
|
|
.ifPresent(sonArea ->{ |
|
|
|
|
areaName.append(sonArea.getName()); |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
areaNameList.add(areaName.toString()); |
|
|
|
|
} |
|
|
|
|
List<Long> areaList = JSONArray.parseArray(taskDO.getAreas().toString(), Long.class); |
|
|
|
|
areaList.forEach( one ->{ |
|
|
|
|
preAssemblyDTO.getAreaDOList().stream().filter(item -> item.getId().equals(one.longValue())).findFirst() |
|
|
|
|
.ifPresent(sonArea ->{ |
|
|
|
|
areaNameList.add(sonArea.getName()); |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
dto.setAreaNameList(areaNameList); |
|
|
|
|