Browse Source

修改区域

zyh
小久哥 3 years ago
parent
commit
41dd169a97
  1. 13
      zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/annotation/FarmMsgAspect.java
  2. 5
      zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/task/TaskController.java
  3. 8
      zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/task/dto/TaskDetailDTO.java
  4. 6
      zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/task/vo/TaskBaseVO.java
  5. 4
      zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/task/vo/TaskExcelVO.java
  6. 2
      zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/task/vo/TaskExportReqVO.java
  7. 4
      zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/task/vo/TaskPageReqVO.java
  8. 5
      zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/task/vo/TaskPageSearchReqVO.java
  9. 4
      zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/task/vo/TaskRespVO.java
  10. 5
      zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/dal/dataobject/task/TaskDO.java
  11. 22
      zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/service/task/TaskServiceImpl.java

13
zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/annotation/FarmMsgAspect.java

@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.farm.annotation;
import cn.hutool.core.util.ObjectUtil;
import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.module.farm.annotation.FarmMsg; import cn.iocoder.yudao.module.farm.annotation.FarmMsg;
import cn.iocoder.yudao.module.farm.controller.admin.project.vo.ProjectCreateReqVO; import cn.iocoder.yudao.module.farm.controller.admin.project.vo.ProjectCreateReqVO;
@ -122,33 +123,45 @@ public class FarmMsgAspect {
for (Object object : objects) { for (Object object : objects) {
if (farmMsg.type().equals("项目")){ if (farmMsg.type().equals("项目")){
ProjectUpdateReqVO projectDO = (ProjectUpdateReqVO) object; ProjectUpdateReqVO projectDO = (ProjectUpdateReqVO) object;
if (ObjectUtil.isNotEmpty(projectDO.getName())){
title = projectDO.getName(); title = projectDO.getName();
} }
}
if (farmMsg.type().equals("任务")){ if (farmMsg.type().equals("任务")){
TaskUpdateReqVO taskDO = (TaskUpdateReqVO) object; TaskUpdateReqVO taskDO = (TaskUpdateReqVO) object;
ProjectDO project = projectMapper.selectOne(ProjectDO::getId, taskDO.getProjectId()); ProjectDO project = projectMapper.selectOne(ProjectDO::getId, taskDO.getProjectId());
if (ObjectUtil.isNotEmpty(project)){
title = project.getName(); title = project.getName();
}
TaskCateDO taskCate = taskCateMapper.selectOne(TaskCateDO::getId, taskDO.getTaskCateId()); TaskCateDO taskCate = taskCateMapper.selectOne(TaskCateDO::getId, taskDO.getTaskCateId());
if (ObjectUtil.isNotEmpty(taskCate)){
msg = taskCate.getName(); msg = taskCate.getName();
} }
} }
} }
}
if (method.getName().startsWith("create")){ if (method.getName().startsWith("create")){
for (Object object : objects){ for (Object object : objects){
if (farmMsg.type().equals("项目")){ if (farmMsg.type().equals("项目")){
ProjectCreateReqVO projectDO = (ProjectCreateReqVO) object; ProjectCreateReqVO projectDO = (ProjectCreateReqVO) object;
if (ObjectUtil.isNotEmpty(projectDO.getName())){
title = projectDO.getName(); title = projectDO.getName();
} }
}
if (farmMsg.type().equals("任务")){ if (farmMsg.type().equals("任务")){
TaskCreateReqVO taskDO = (TaskCreateReqVO) object; TaskCreateReqVO taskDO = (TaskCreateReqVO) object;
ProjectDO project = projectMapper.selectOne(ProjectDO::getId, taskDO.getProjectId()); ProjectDO project = projectMapper.selectOne(ProjectDO::getId, taskDO.getProjectId());
if (ObjectUtil.isNotEmpty(project)){
title = project.getName(); title = project.getName();
}
TaskCateDO taskCate = taskCateMapper.selectOne(TaskCateDO::getId, taskDO.getTaskCateId()); TaskCateDO taskCate = taskCateMapper.selectOne(TaskCateDO::getId, taskDO.getTaskCateId());
if (ObjectUtil.isNotEmpty(taskCate)){
msg = taskCate.getName(); msg = taskCate.getName();
} }
} }
} }
}
FarmMsgDTO farmMsgDTO = FarmMsgDTO.builder() FarmMsgDTO farmMsgDTO = FarmMsgDTO.builder()
.type(farmMsg.type()) .type(farmMsg.type())

5
zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/task/TaskController.java

@ -1,5 +1,6 @@
package cn.iocoder.yudao.module.farm.controller.admin.task; package cn.iocoder.yudao.module.farm.controller.admin.task;
import cn.hutool.core.util.NumberUtil;
import cn.iocoder.yudao.framework.common.page.PageVO; import cn.iocoder.yudao.framework.common.page.PageVO;
import cn.iocoder.yudao.module.farm.annotation.FarmMsg; import cn.iocoder.yudao.module.farm.annotation.FarmMsg;
import cn.iocoder.yudao.module.farm.controller.admin.task.dto.TaskAssemblyDTO; import cn.iocoder.yudao.module.farm.controller.admin.task.dto.TaskAssemblyDTO;
@ -92,7 +93,9 @@ public class TaskController {
@PreAuthorize("@ss.hasPermission('farm:task:query')") @PreAuthorize("@ss.hasPermission('farm:task:query')")
public CommonResult<PageResult<TaskRespVO>> getTaskPage(@Valid TaskPageReqVO pageVO) { public CommonResult<PageResult<TaskRespVO>> getTaskPage(@Valid TaskPageReqVO pageVO) {
PageResult<TaskDO> pageResult = taskService.getTaskPage(pageVO); PageResult<TaskDO> pageResult = taskService.getTaskPage(pageVO);
return success(TaskConvert.INSTANCE.convertPage(pageResult)); PageResult<TaskRespVO> rs = TaskConvert.INSTANCE.convertPage(pageResult);
CommonResult<PageResult<TaskRespVO>> s1 = success(rs);
return s1;
} }
@GetMapping("/apiPage") @GetMapping("/apiPage")

8
zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/task/dto/TaskDetailDTO.java

@ -4,6 +4,7 @@ import cn.hutool.system.oshi.CpuInfo;
import cn.iocoder.yudao.module.farm.dal.dataobject.area.AreaDO; import cn.iocoder.yudao.module.farm.dal.dataobject.area.AreaDO;
import cn.iocoder.yudao.module.farm.dal.dataobject.task.TaskDO; import cn.iocoder.yudao.module.farm.dal.dataobject.task.TaskDO;
import cn.iocoder.yudao.module.system.dal.dataobject.CpUser.CpUserDO; import cn.iocoder.yudao.module.system.dal.dataobject.CpUser.CpUserDO;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
@ -19,8 +20,11 @@ public class TaskDetailDTO extends TaskDO {
//项目名 //项目名
String apiProjectName; String apiProjectName;
//区域 //已选择的一级区域
List<AreaDO> apiArea; List<AreaDO> firstAreaList;
//已选择的二级区域
List<AreaDO> secondAreaList;
//执行人 //执行人
List<CpUserDO> apiExecutor; List<CpUserDO> apiExecutor;

6
zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/task/vo/TaskBaseVO.java

@ -2,6 +2,8 @@ package cn.iocoder.yudao.module.farm.controller.admin.task.vo;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import cn.iocoder.yudao.module.farm.enums.TaskStatus; import cn.iocoder.yudao.module.farm.enums.TaskStatus;
import com.fasterxml.jackson.annotation.JsonManagedReference;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import lombok.*; import lombok.*;
import java.util.*; import java.util.*;
import io.swagger.annotations.*; import io.swagger.annotations.*;
@ -25,7 +27,9 @@ public class TaskBaseVO {
@ApiModelProperty(value = "") @ApiModelProperty(value = "")
private JSONArray resources; private JSONArray resources;
private JSONArray areas;
@ApiModelProperty("子区域列表")
private List<Long> areas;
private Long mainPerson; private Long mainPerson;
private JSONArray executorPerson; private JSONArray executorPerson;

4
zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/task/vo/TaskExcelVO.java

@ -30,7 +30,9 @@ public class TaskExcelVO {
@ExcelProperty("") @ExcelProperty("")
private JSONArray resources; private JSONArray resources;
private JSONArray areas; @ApiModelProperty("子区域列表")
private List<Long> areas;
private Long mainPerson; private Long mainPerson;
private JSONArray executorPerson; private JSONArray executorPerson;

2
zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/task/vo/TaskExportReqVO.java

@ -22,7 +22,7 @@ public class TaskExportReqVO {
@ApiModelProperty(value = "") @ApiModelProperty(value = "")
private JSONArray resources; private JSONArray resources;
private JSONArray areas; private List<Long> areas;
private Long mainPerson; private Long mainPerson;
private JSONArray executorPerson; private JSONArray executorPerson;

4
zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/task/vo/TaskPageReqVO.java

@ -24,7 +24,7 @@ public class TaskPageReqVO extends PageParam {
@ApiModelProperty(value = "") @ApiModelProperty(value = "")
private JSONArray resources; private JSONArray resources;
private JSONArray areas; private List<Long> areas;
private Long mainPerson; private Long mainPerson;
private JSONArray executorPerson; private JSONArray executorPerson;
@ -61,7 +61,7 @@ public class TaskPageReqVO extends PageParam {
private Date endCreateTime; private Date endCreateTime;
@ApiModelProperty("草稿") @ApiModelProperty("草稿")
private Boolean draft; private Boolean draft = false;
private Boolean pretendDelete = false; private Boolean pretendDelete = false;

5
zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/task/vo/TaskPageSearchReqVO.java

@ -11,6 +11,7 @@ import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.Date; import java.util.Date;
import java.util.List;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@ -29,7 +30,9 @@ public class TaskPageSearchReqVO extends PageParam {
@ApiModelProperty(value = "") @ApiModelProperty(value = "")
private JSONArray resources; private JSONArray resources;
private JSONArray areas; @ApiModelProperty("子区域列表")
private List<Long> areas;
private Long mainPerson; private Long mainPerson;

4
zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/task/vo/TaskRespVO.java

@ -1,6 +1,10 @@
package cn.iocoder.yudao.module.farm.controller.admin.task.vo; package cn.iocoder.yudao.module.farm.controller.admin.task.vo;
import cn.iocoder.yudao.module.farm.dal.dataobject.area.AreaDO;
import com.alibaba.ttl.threadpool.agent.internal.javassist.SerialVersionUID;
import lombok.*; import lombok.*;
import java.io.Serializable;
import java.util.*; import java.util.*;
import io.swagger.annotations.*; import io.swagger.annotations.*;

5
zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/dal/dataobject/task/TaskDO.java

@ -1,6 +1,7 @@
package cn.iocoder.yudao.module.farm.dal.dataobject.task; package cn.iocoder.yudao.module.farm.dal.dataobject.task;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.baomidou.mybatisplus.extension.handlers.FastjsonTypeHandler;
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler; import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import cn.iocoder.yudao.module.farm.enums.TaskStatus; import cn.iocoder.yudao.module.farm.enums.TaskStatus;
@ -51,9 +52,9 @@ public class TaskDO extends BaseDO {
@ApiModelProperty("资源") @ApiModelProperty("资源")
@TableField(typeHandler = JacksonTypeHandler.class) @TableField(typeHandler = JacksonTypeHandler.class)
private JSONArray resources; private JSONArray resources;
@ApiModelProperty("区域及子区域") @ApiModelProperty("子区域")
@TableField(typeHandler = JacksonTypeHandler.class) @TableField(typeHandler = JacksonTypeHandler.class)
private JSONArray areas; private List<Long> areas;
@ApiModelProperty("任务图片") @ApiModelProperty("任务图片")
@TableField(typeHandler = JacksonTypeHandler.class) @TableField(typeHandler = JacksonTypeHandler.class)

22
zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/service/task/TaskServiceImpl.java

@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.farm.service.task;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.text.StrBuilder; import cn.hutool.core.text.StrBuilder;
import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import cn.iocoder.yudao.framework.common.page.PageUtil; import cn.iocoder.yudao.framework.common.page.PageUtil;
import cn.iocoder.yudao.framework.common.page.PageVO; 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); List<DiscussDO> discussDOList = discussMapper.selectList(DiscussDO::getTaskId, id);
taskMsg.setCumulativeQuantity(ObjectUtil.isEmpty(discussDOList) ? 0 : discussDOList.stream().mapToInt(DiscussDO::getCropNum).sum()); 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); return R.success(taskMsg);
} }
@ -214,9 +220,7 @@ public class TaskServiceImpl implements TaskService {
for (TaskDO taskDO : taskDOList) { for (TaskDO taskDO : taskDOList) {
if (ObjectUtil.isNotEmpty(taskDO.getAreas())){ if (ObjectUtil.isNotEmpty(taskDO.getAreas())){
for (Object area : taskDO.getAreas()) { areaIdList.addAll(taskDO.getAreas());
areaIdList.addAll(JSONArray.parseArray(area.toString(), Long.class));
}
} }
if (ObjectUtil.isNotEmpty(taskDO.getExecutorPerson())){ if (ObjectUtil.isNotEmpty(taskDO.getExecutorPerson())){
executorIdList.addAll(taskDO.getExecutorPerson().toJavaList(Long.class)); executorIdList.addAll(taskDO.getExecutorPerson().toJavaList(Long.class));
@ -344,17 +348,13 @@ public class TaskServiceImpl implements TaskService {
//区域名 //区域名
List<String> areaNameList = new ArrayList<>(); List<String> areaNameList = new ArrayList<>();
if (ObjectUtil.isNotEmpty(taskDO.getAreas())) { if (ObjectUtil.isNotEmpty(taskDO.getAreas())) {
for (Object obj : taskDO.getAreas()) { List<Long> areaList = JSONArray.parseArray(taskDO.getAreas().toString(), Long.class);
List<Long> areaList = JSONArray.parseArray(obj.toString(), Long.class);
StrBuilder areaName = new StrBuilder();
areaList.forEach( one ->{ areaList.forEach( one ->{
preAssemblyDTO.getAreaDOList().stream().filter(item -> item.getId().equals(one)).findFirst() preAssemblyDTO.getAreaDOList().stream().filter(item -> item.getId().equals(one.longValue())).findFirst()
.ifPresent(sonArea ->{ .ifPresent(sonArea ->{
areaName.append(sonArea.getName()); areaNameList.add(sonArea.getName());
}); });
}); });
areaNameList.add(areaName.toString());
}
} }
dto.setAreaNameList(areaNameList); dto.setAreaNameList(areaNameList);

Loading…
Cancel
Save