From 126251e1139ad8d321ee4bfab4ecc38d5e5e47a5 Mon Sep 17 00:00:00 2001 From: zhanyunjiu <787952492@qq.com> Date: Wed, 20 Jul 2022 14:31:08 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/admin/area/vo/AreaExcelVO.java | 18 ++++---- .../controller/admin/crop/vo/CropExcelVO.java | 2 +- .../cropRecord/vo/CropRecordExcelVO.java | 11 ++--- .../admin/discuss/vo/DiscussExcelVO.java | 16 ++++--- .../admin/logMsg/vo/LogMsgExcelVO.java | 8 ++-- .../admin/project/dto/ProjectPageDTO.java | 6 +-- .../admin/project/vo/ProjectExcelVO.java | 19 ++++---- .../admin/project/vo/ProjectRespVO.java | 14 ++++-- .../admin/resource/vo/ResourceExcelVO.java | 17 ++++--- .../resourceType/vo/ResourceTypeExcelVO.java | 13 +++--- .../controller/admin/task/vo/TaskExcelVO.java | 32 +++++-------- .../admin/task/vo/TaskPageReqVO.java | 3 ++ .../admin/taskCate/vo/TaskCateExcelVO.java | 11 +++-- .../admin/workHour/vo/WorkHourExcelVO.java | 20 ++++---- .../farm/dal/mysql/project/ProjectMapper.java | 42 +++-------------- .../module/farm/service/area/AreaService.java | 7 +++ .../farm/service/area/AreaServiceImpl.java | 31 +++++++++++-- .../service/project/ProjectServiceImpl.java | 46 +++++++++++++++++-- .../farm/service/task/TaskServiceImpl.java | 15 +++++- .../service/taskCate/TaskCateService.java | 18 ++++++-- .../service/taskCate/TaskCateServiceImpl.java | 29 ++++++++---- 21 files changed, 230 insertions(+), 148 deletions(-) diff --git a/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/area/vo/AreaExcelVO.java b/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/area/vo/AreaExcelVO.java index b10cfd57..383a5069 100644 --- a/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/area/vo/AreaExcelVO.java +++ b/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/area/vo/AreaExcelVO.java @@ -1,10 +1,9 @@ package cn.iocoder.yudao.module.farm.controller.admin.area.vo; -import lombok.*; -import java.util.*; -import io.swagger.annotations.*; - import com.alibaba.excel.annotation.ExcelProperty; +import lombok.Data; + +import java.util.Date; /** * Excel VO @@ -14,22 +13,25 @@ import com.alibaba.excel.annotation.ExcelProperty; @Data public class AreaExcelVO { - @ExcelProperty("") + @ExcelProperty("ID") private Long id; - @ExcelProperty("") + @ExcelProperty("区域名") private String name; + @ExcelProperty("父级") private Long parentId; + @ExcelProperty("面积") private Double area; - @ExcelProperty("") + @ExcelProperty("创建时间") private Date createTime; + @ExcelProperty private Boolean pretendDelete; - @ApiModelProperty("是否占用") + @ExcelProperty("是否占用") private Boolean occupied; } diff --git a/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/crop/vo/CropExcelVO.java b/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/crop/vo/CropExcelVO.java index 59ea81b0..8d9aa223 100644 --- a/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/crop/vo/CropExcelVO.java +++ b/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/crop/vo/CropExcelVO.java @@ -29,7 +29,7 @@ public class CropExcelVO { @ExcelProperty("当前库存") private Integer stock; - @ExcelProperty("") + @ExcelProperty("创建时间") private Date createTime; private Boolean pretendDelete; diff --git a/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/cropRecord/vo/CropRecordExcelVO.java b/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/cropRecord/vo/CropRecordExcelVO.java index 3354643c..69bda395 100644 --- a/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/cropRecord/vo/CropRecordExcelVO.java +++ b/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/cropRecord/vo/CropRecordExcelVO.java @@ -1,10 +1,9 @@ package cn.iocoder.yudao.module.farm.controller.admin.cropRecord.vo; -import lombok.*; -import java.util.*; -import io.swagger.annotations.*; - import com.alibaba.excel.annotation.ExcelProperty; +import lombok.Data; + +import java.util.Date; /** * Excel VO @@ -14,7 +13,7 @@ import com.alibaba.excel.annotation.ExcelProperty; @Data public class CropRecordExcelVO { - @ExcelProperty("") + @ExcelProperty("ID") private Long id; @ExcelProperty("物料id") @@ -29,7 +28,7 @@ public class CropRecordExcelVO { @ExcelProperty("剩余数量") private Integer afterStock; - @ExcelProperty("") + @ExcelProperty("创建时间") private Date createTime; private Boolean pretendDelete; diff --git a/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/discuss/vo/DiscussExcelVO.java b/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/discuss/vo/DiscussExcelVO.java index 78107fb2..1e5edb12 100644 --- a/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/discuss/vo/DiscussExcelVO.java +++ b/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/discuss/vo/DiscussExcelVO.java @@ -15,29 +15,31 @@ import java.util.List; @Data public class DiscussExcelVO { - @ExcelProperty("") + @ExcelProperty("ID") private Long id; - @ExcelProperty("") + @ExcelProperty("项目ID") private Long projectId; - @ExcelProperty("") + @ExcelProperty("任务ID") private Long taskId; - @ExcelProperty("") + @ExcelProperty("内容") private String content; - @ExcelProperty("") + @ExcelProperty("图片") private List images; + @ExcelProperty("区域") private List areas; + @ExcelProperty("作物数量") private Double cropNum; - @ExcelProperty("") + @ExcelProperty("创建时间") private Date createTime; - @ExcelProperty("") + @ExcelProperty("工时记录") private List workHourList; private Boolean pretendDelete; diff --git a/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/logMsg/vo/LogMsgExcelVO.java b/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/logMsg/vo/LogMsgExcelVO.java index 00929111..86e822f1 100644 --- a/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/logMsg/vo/LogMsgExcelVO.java +++ b/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/logMsg/vo/LogMsgExcelVO.java @@ -1,10 +1,9 @@ package cn.iocoder.yudao.module.farm.controller.admin.logMsg.vo; -import lombok.*; -import java.util.*; -import io.swagger.annotations.*; - import com.alibaba.excel.annotation.ExcelProperty; +import lombok.Data; + +import java.util.Date; /** * Excel VO @@ -25,6 +24,7 @@ public class LogMsgExcelVO { @ExcelProperty("标题") private String title; + @ExcelProperty("内容") private String msg; @ExcelProperty("用户id") diff --git a/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/project/dto/ProjectPageDTO.java b/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/project/dto/ProjectPageDTO.java index ab6eb87a..718a7b2b 100644 --- a/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/project/dto/ProjectPageDTO.java +++ b/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/project/dto/ProjectPageDTO.java @@ -1,12 +1,9 @@ package cn.iocoder.yudao.module.farm.controller.admin.project.dto; import cn.iocoder.yudao.framework.common.page.PageDTO; -import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; -import java.io.Serializable; - @Data public class ProjectPageDTO extends PageDTO { @@ -25,4 +22,7 @@ public class ProjectPageDTO extends PageDTO { @ApiModelProperty("true查看我参与的项目") private Boolean myProject; + + @ApiModelProperty("一级区域的id") + private Long areaId; } \ No newline at end of file diff --git a/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/project/vo/ProjectExcelVO.java b/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/project/vo/ProjectExcelVO.java index c1adaf71..290c20cf 100644 --- a/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/project/vo/ProjectExcelVO.java +++ b/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/project/vo/ProjectExcelVO.java @@ -2,7 +2,6 @@ package cn.iocoder.yudao.module.farm.controller.admin.project.vo; import cn.iocoder.yudao.module.farm.enums.ProjectStateEnum; import com.alibaba.excel.annotation.ExcelProperty; -import io.swagger.annotations.ApiModelProperty; import lombok.Data; import java.util.Date; @@ -16,29 +15,31 @@ import java.util.List; @Data public class ProjectExcelVO { - @ExcelProperty("") + @ExcelProperty("ID") private Long id; - @ExcelProperty("") + @ExcelProperty("项目名") private String name; - @ExcelProperty("") + @ExcelProperty("内容") private String content; - @ExcelProperty("") + @ExcelProperty("状态") private ProjectStateEnum state; + @ExcelProperty("区域") private List areas; - @ApiModelProperty("种植面积") + @ExcelProperty("种植面积") private Double plantArea; - @ApiModelProperty("项目负责人") + @ExcelProperty("项目负责人") private Long mainPerson; - @ApiModelProperty("项目成员") + @ExcelProperty("项目成员") private List members; + @ExcelProperty("作物ID") private Long cropId; @ExcelProperty("项目图片") @@ -62,7 +63,7 @@ public class ProjectExcelVO { @ExcelProperty("") private Date createTime; - @ApiModelProperty("草稿") + @ExcelProperty("草稿") private Boolean draft; private Boolean pretendDelete; diff --git a/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/project/vo/ProjectRespVO.java b/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/project/vo/ProjectRespVO.java index d8c6eaa6..f3083057 100644 --- a/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/project/vo/ProjectRespVO.java +++ b/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/project/vo/ProjectRespVO.java @@ -1,9 +1,14 @@ package cn.iocoder.yudao.module.farm.controller.admin.project.vo; import cn.iocoder.yudao.module.system.dal.dataobject.CpUser.CpUserDO; -import lombok.*; -import java.util.*; -import io.swagger.annotations.*; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.ToString; + +import java.util.Date; +import java.util.List; @ApiModel("管理后台 - 农场项目 Response VO") @Data @@ -20,4 +25,7 @@ public class ProjectRespVO extends ProjectBaseVO { @ApiModelProperty("项目的成员") private List userList; + @ApiModelProperty("项目负责人信息") + private CpUserDO mainPersonMsg; + } diff --git a/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/resource/vo/ResourceExcelVO.java b/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/resource/vo/ResourceExcelVO.java index 89ac7434..15b2b086 100644 --- a/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/resource/vo/ResourceExcelVO.java +++ b/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/resource/vo/ResourceExcelVO.java @@ -2,7 +2,6 @@ package cn.iocoder.yudao.module.farm.controller.admin.resource.vo; import com.alibaba.excel.annotation.ExcelProperty; import com.alibaba.fastjson.JSONArray; -import io.swagger.annotations.ApiModelProperty; import lombok.Data; import java.util.Date; @@ -15,22 +14,22 @@ import java.util.Date; @Data public class ResourceExcelVO { - @ExcelProperty("") + @ExcelProperty("ID") private Long id; - @ExcelProperty("") + @ExcelProperty("资源父级Id") private Long resourceType; - @ExcelProperty("") + @ExcelProperty("资源名") private String name; - @ApiModelProperty(value = "保管人id") + @ExcelProperty(value = "保管人id") private Long custodianId; - @ExcelProperty("") + @ExcelProperty("内容") private String content; - @ExcelProperty("") + @ExcelProperty("图片") private JSONArray images; @ExcelProperty("") @@ -42,7 +41,7 @@ public class ResourceExcelVO { @ExcelProperty("唯一占用标识") private Boolean solo; - @ExcelProperty("") + @ExcelProperty("创建时间") private Date createTime; private Boolean pretendDelete; @@ -51,7 +50,7 @@ public class ResourceExcelVO { private Integer number; - @ApiModelProperty("是否占用") + @ExcelProperty("是否占用") private Boolean occupied; } diff --git a/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/resourceType/vo/ResourceTypeExcelVO.java b/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/resourceType/vo/ResourceTypeExcelVO.java index 4747d455..8507f395 100644 --- a/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/resourceType/vo/ResourceTypeExcelVO.java +++ b/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/resourceType/vo/ResourceTypeExcelVO.java @@ -1,10 +1,9 @@ package cn.iocoder.yudao.module.farm.controller.admin.resourceType.vo; -import lombok.*; -import java.util.*; -import io.swagger.annotations.*; - import com.alibaba.excel.annotation.ExcelProperty; +import lombok.Data; + +import java.util.Date; /** * 农场资源分类 Excel VO @@ -14,13 +13,13 @@ import com.alibaba.excel.annotation.ExcelProperty; @Data public class ResourceTypeExcelVO { - @ExcelProperty("") + @ExcelProperty("ID") private Long id; - @ExcelProperty("") + @ExcelProperty("类型名") private String name; - @ExcelProperty("") + @ExcelProperty("创建时间") private Date createTime; private Boolean pretendDelete; diff --git a/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/task/vo/TaskExcelVO.java b/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/task/vo/TaskExcelVO.java index f92bb999..aa677fba 100644 --- a/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/task/vo/TaskExcelVO.java +++ b/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/task/vo/TaskExcelVO.java @@ -2,7 +2,6 @@ package cn.iocoder.yudao.module.farm.controller.admin.task.vo; import com.alibaba.excel.annotation.ExcelProperty; import com.alibaba.fastjson.JSONArray; -import io.swagger.annotations.ApiModelProperty; import lombok.Data; import java.util.Date; @@ -16,47 +15,40 @@ import java.util.List; @Data public class TaskExcelVO { - @ExcelProperty("") + @ExcelProperty("ID") private Long id; - - @ExcelProperty("") + @ExcelProperty("项目id") private Long projectId; - @ExcelProperty("") + @ExcelProperty("作物id") private Long cropId; - @ExcelProperty("") + @ExcelProperty("作物数量") private Integer cropNum; - + @ExcelProperty("任务类型") private Long taskCateId; + @ExcelProperty("任务内容") private Long taskCateName; - @ExcelProperty(value = "任务所需资源") private JSONArray resources; @ExcelProperty("子区域列表") private List areas; - - + @ExcelProperty("负责人") private Long mainPerson; + @ExcelProperty("执行人") private List executorPerson; + @ExcelProperty("工时") private Integer workingHours; - - @ExcelProperty("") + @ExcelProperty("图片") private List images; - @ExcelProperty("") private Date planStartTime; - @ExcelProperty("") private Date planEndTime; - @ExcelProperty("优先级") private Integer weight; - - @ExcelProperty("") + @ExcelProperty("创建时间") private Date createTime; - - @ApiModelProperty("草稿") + @ExcelProperty("草稿") private Boolean draft; - private Boolean pretendDelete; } diff --git a/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/task/vo/TaskPageReqVO.java b/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/task/vo/TaskPageReqVO.java index cebbe5b3..08412aec 100644 --- a/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/task/vo/TaskPageReqVO.java +++ b/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/task/vo/TaskPageReqVO.java @@ -88,4 +88,7 @@ public class TaskPageReqVO extends PageParam { @ApiModelProperty("后台搜索执行人") private Long executorName; + @ApiModelProperty("查看采收类型") + private Boolean recovery; + } diff --git a/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/taskCate/vo/TaskCateExcelVO.java b/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/taskCate/vo/TaskCateExcelVO.java index 19e4111a..173b679f 100644 --- a/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/taskCate/vo/TaskCateExcelVO.java +++ b/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/taskCate/vo/TaskCateExcelVO.java @@ -1,7 +1,6 @@ package cn.iocoder.yudao.module.farm.controller.admin.taskCate.vo; import com.alibaba.excel.annotation.ExcelProperty; -import io.swagger.annotations.ApiModelProperty; import lombok.Data; import java.util.Date; @@ -14,19 +13,21 @@ import java.util.Date; @Data public class TaskCateExcelVO { - @ExcelProperty("") + @ExcelProperty("父级id") private Long parentId; - @ExcelProperty("") + @ExcelProperty("任务名") private String name; - @ExcelProperty("") + @ExcelProperty("创建时间") private Date createTime; + @ExcelProperty("是否删除") private Boolean pretendDelete; + @ExcelProperty("任务单位") private String unit; - @ApiModelProperty("同步到erp") + @ExcelProperty("同步到erp") private Boolean synchronizeErp; } diff --git a/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/workHour/vo/WorkHourExcelVO.java b/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/workHour/vo/WorkHourExcelVO.java index 24e2eead..6043d74a 100644 --- a/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/workHour/vo/WorkHourExcelVO.java +++ b/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/workHour/vo/WorkHourExcelVO.java @@ -1,10 +1,9 @@ package cn.iocoder.yudao.module.farm.controller.admin.workHour.vo; -import lombok.*; -import java.util.*; -import io.swagger.annotations.*; - import com.alibaba.excel.annotation.ExcelProperty; +import lombok.Data; + +import java.util.Date; /** * Excel VO @@ -14,24 +13,25 @@ import com.alibaba.excel.annotation.ExcelProperty; @Data public class WorkHourExcelVO { - @ExcelProperty("") + @ExcelProperty("ID") private Long id; - @ExcelProperty("") + @ExcelProperty("用户ID") private Integer userId; + @ExcelProperty("活动ID") private Long discussId; - @ExcelProperty("") + @ExcelProperty("项目ID") private Integer projectId; - @ExcelProperty("") + @ExcelProperty("任务Id") private Integer taskId; - @ExcelProperty("") + @ExcelProperty("工时") private Integer hour; - @ExcelProperty("") + @ExcelProperty("创建时间") private Date createTime; private Boolean pretendDelete; diff --git a/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/dal/mysql/project/ProjectMapper.java b/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/dal/mysql/project/ProjectMapper.java index 6b2a505c..2beaeb4e 100644 --- a/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/dal/mysql/project/ProjectMapper.java +++ b/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/dal/mysql/project/ProjectMapper.java @@ -1,16 +1,12 @@ package cn.iocoder.yudao.module.farm.dal.mysql.project; -import java.util.*; - -import cn.hutool.core.util.ObjectUtil; -import cn.iocoder.yudao.framework.common.pojo.PageResult; -import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; -import cn.iocoder.yudao.module.farm.controller.admin.project.dto.ProjectPageDTO; +import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; +import cn.iocoder.yudao.module.farm.controller.admin.project.vo.ProjectExportReqVO; import cn.iocoder.yudao.module.farm.dal.dataobject.project.ProjectDO; -import cn.iocoder.yudao.module.farm.dal.dataobject.task.TaskDO; import org.apache.ibatis.annotations.Mapper; -import cn.iocoder.yudao.module.farm.controller.admin.project.vo.*; + +import java.util.List; /** * 农场项目 Mapper @@ -20,32 +16,6 @@ import cn.iocoder.yudao.module.farm.controller.admin.project.vo.*; @Mapper public interface ProjectMapper extends BaseMapperX { - default PageResult selectPage(ProjectPageReqVO reqVO) { - LambdaQueryWrapperX lambdaQueryWrapperX = new LambdaQueryWrapperX(); - //搜索执行人 - if (ObjectUtil.isNotEmpty(reqVO.getExecutorName())){ - lambdaQueryWrapperX.apply("JSON_CONTAINS(members, '"+ reqVO.getExecutorName()+"')"); - } - //区域 - if (ObjectUtil.isNotEmpty(reqVO.getAreaId())){ - lambdaQueryWrapperX.apply("JSON_CONTAINS(areas, '"+ reqVO.getAreaId()+"')"); - } - lambdaQueryWrapperX.likeIfPresent(ProjectDO::getName, reqVO.getName()) - .eqIfPresent(ProjectDO::getContent, reqVO.getContent()) - .eqIfPresent(ProjectDO::getAreas, reqVO.getAreas()) - .eqIfPresent(ProjectDO::getCropId, reqVO.getCropId()) - .eqIfPresent(ProjectDO::getState, reqVO.getState()) - .eqIfPresent(ProjectDO::getImages, reqVO.getImages()) - .betweenIfPresent(ProjectDO::getPlanStartTime, reqVO.getBeginPlanStartTime(), reqVO.getEndPlanStartTime()) - .betweenIfPresent(ProjectDO::getPlanEndTime, reqVO.getBeginPlanEndTime(), reqVO.getEndPlanEndTime()) - .eqIfPresent(ProjectDO::getWeight, reqVO.getWeight()) - .betweenIfPresent(ProjectDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime()) - .eqIfPresent(ProjectDO::getPretendDelete, reqVO.getPretendDelete()) - .eqIfPresent(ProjectDO::getDraft, reqVO.getDraft()) - .orderByDesc(ProjectDO::getId); - - return selectPage(reqVO,lambdaQueryWrapperX); - } default List selectList(ProjectExportReqVO reqVO) { return selectList(new LambdaQueryWrapperX() @@ -59,8 +29,8 @@ public interface ProjectMapper extends BaseMapperX { .betweenIfPresent(ProjectDO::getPlanEndTime, reqVO.getBeginPlanEndTime(), reqVO.getEndPlanEndTime()) .eqIfPresent(ProjectDO::getWeight, reqVO.getWeight()) .betweenIfPresent(ProjectDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime()) - .eqIfPresent(ProjectDO::getPretendDelete, reqVO.getPretendDelete()) - .eqIfPresent(ProjectDO::getDraft, reqVO.getDraft()) + .ne(ProjectDO::getPretendDelete, true) + .ne(ProjectDO::getDraft, true) .orderByDesc(ProjectDO::getId)); } diff --git a/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/service/area/AreaService.java b/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/service/area/AreaService.java index 289a8c93..f3bed240 100644 --- a/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/service/area/AreaService.java +++ b/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/service/area/AreaService.java @@ -83,4 +83,11 @@ public interface AreaService { */ void checkAreaOccupied(); + /** + * 根据区域id 获得本级及子集区域 + * eg: 传一级 返回一级及对应的二级三级区域 + * 传二级 返回二级及对应的三级区域 + */ + List getAreaAndSubArea(Long id); + } diff --git a/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/service/area/AreaServiceImpl.java b/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/service/area/AreaServiceImpl.java index 5cc6b672..b78a9035 100644 --- a/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/service/area/AreaServiceImpl.java +++ b/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/service/area/AreaServiceImpl.java @@ -16,9 +16,7 @@ import org.springframework.stereotype.Service; import org.springframework.validation.annotation.Validated; import javax.annotation.Resource; -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; +import java.util.*; import java.util.stream.Collectors; import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; @@ -157,4 +155,31 @@ public class AreaServiceImpl implements AreaService { } + /** + * 根据区域id 获得本级及子集区域 + * eg: 传一级 返回一级及对应的二级三级区域 + * 传二级 返回二级及对应的三级区域 + */ + public List getAreaAndSubArea(Long id){ + List allList = areaMapper.selectList(); + Optional parentArea = allList.stream().filter(item -> item.getId().equals(id)).findFirst(); + List list = new ArrayList<>(); + if (parentArea.isPresent()){ + AreaDO areaDO = parentArea.get(); + //装入一级 + list.add(areaDO); + List sonList = allList.stream().filter(item -> item.getParentId().equals(areaDO.getId())).collect(Collectors.toList()); + if (ObjectUtil.isNotEmpty(sonList)){ + //装入二级 + list.addAll(sonList); + sonList.forEach(item ->{ + //转入三级 + list.addAll(allList.stream().filter(son -> son.getParentId().equals(item.getId())).collect(Collectors.toList())); + }); + } + return list; + } + return null; + } + } diff --git a/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/service/project/ProjectServiceImpl.java b/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/service/project/ProjectServiceImpl.java index 4653a8dd..6cc8729d 100644 --- a/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/service/project/ProjectServiceImpl.java +++ b/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/service/project/ProjectServiceImpl.java @@ -28,6 +28,7 @@ import cn.iocoder.yudao.module.system.dal.mysql.CpUser.CpUserMapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.zsw.base.R; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections4.CollectionUtils; import org.springframework.stereotype.Service; import org.springframework.validation.annotation.Validated; @@ -116,6 +117,8 @@ public class ProjectServiceImpl implements ProjectService { public ProjectRespVO getProject(Long id) { ProjectDO projectDO = projectMapper.selectById(id); ProjectRespVO respVO = BeanUtil.copyProperties(projectDO, ProjectRespVO.class); + CpUserDO mainUser = ObjectUtil.isEmpty(projectDO.getMainPerson()) ? null : cpUserMapper.selectById(projectDO.getMainPerson()); + respVO.setMainPersonMsg(mainUser); List userList = ObjectUtil.isEmpty(projectDO.getMembers()) ? new ArrayList<>() : cpUserMapper.selectList(CpUserDO::getId, projectDO.getMembers()); respVO.setUserList(userList); return respVO; @@ -129,7 +132,31 @@ public class ProjectServiceImpl implements ProjectService { @Override public PageResult getProjectPage(ProjectPageReqVO pageReqVO) { - return projectMapper.selectPage(pageReqVO); + LambdaQueryWrapperX lambdaQueryWrapperX = new LambdaQueryWrapperX(); + //搜索执行人 + if (ObjectUtil.isNotEmpty(pageReqVO.getExecutorName())){ + lambdaQueryWrapperX.apply("JSON_CONTAINS(members, '"+ pageReqVO.getExecutorName()+"')"); + } + //区域 + if (ObjectUtil.isNotEmpty(pageReqVO.getAreaId())){ + List allAreaList = areaService.getAreaAndSubArea(pageReqVO.getAreaId()); + List allIdList = allAreaList.stream().map(AreaDO::getId).collect(Collectors.toList()); + lambdaQueryWrapperX.apply("JSON_OVERLAPS(areas, '"+ allIdList+"') = 1" ); + } + lambdaQueryWrapperX.likeIfPresent(ProjectDO::getName, pageReqVO.getName()) + .eqIfPresent(ProjectDO::getContent, pageReqVO.getContent()) + .eqIfPresent(ProjectDO::getAreas, pageReqVO.getAreas()) + .eqIfPresent(ProjectDO::getCropId, pageReqVO.getCropId()) + .eqIfPresent(ProjectDO::getState, pageReqVO.getState()) + .eqIfPresent(ProjectDO::getImages, pageReqVO.getImages()) + .betweenIfPresent(ProjectDO::getPlanStartTime, pageReqVO.getBeginPlanStartTime(), pageReqVO.getEndPlanStartTime()) + .betweenIfPresent(ProjectDO::getPlanEndTime, pageReqVO.getBeginPlanEndTime(), pageReqVO.getEndPlanEndTime()) + .eqIfPresent(ProjectDO::getWeight, pageReqVO.getWeight()) + .betweenIfPresent(ProjectDO::getCreateTime, pageReqVO.getBeginCreateTime(), pageReqVO.getEndCreateTime()) + .eqIfPresent(ProjectDO::getPretendDelete, pageReqVO.getPretendDelete()) + .eqIfPresent(ProjectDO::getDraft, pageReqVO.getDraft()) + .orderByDesc(ProjectDO::getId); + return projectMapper.selectPage(pageReqVO, lambdaQueryWrapperX); } @Override @@ -154,7 +181,6 @@ public class ProjectServiceImpl implements ProjectService { //查看自己的草稿 queryWrapperX.eqIfPresent(ProjectDO::getCreator, getLoginUserId()); } - if (ObjectUtil.isNotEmpty(pageDTO.getMyProject()) && pageDTO.getMyProject()){ CpUserDO user = cpUserMapper.selectOne(CpUserDO::getUserId, getLoginUser().getUsername()); if (ObjectUtil.isNotEmpty(user)){ @@ -162,6 +188,13 @@ public class ProjectServiceImpl implements ProjectService { queryWrapperX.apply(" ((JSON_CONTAINS(members, '"+ user.getId()+"') or creator = " + getLoginUserId() +"))"); } } + //根据区域id展示 + if (ObjectUtil.isNotEmpty(pageDTO.getAreaId())){ + List allAreaList = areaService.getAreaAndSubArea(pageDTO.getAreaId()); + List allIdList = allAreaList.stream().map(AreaDO::getId).collect(Collectors.toList()); + queryWrapperX.apply("JSON_OVERLAPS(areas, '"+ allIdList+"') = 1" ); + } + queryWrapperX.orderByDesc(ProjectDO::getId); PageParam pageParam = new PageParam(); @@ -263,6 +296,13 @@ public class ProjectServiceImpl implements ProjectService { */ public void checkProjectAreas(ProjectDO projectDO){ if (projectDO.getState().equals(ProjectStateEnum.STARTING)){ + ProjectDO old = projectMapper.selectById(projectDO.getId()); + + //区域没修改 跳过下面的检查 + if (CollectionUtils.isEqualCollection(projectDO.getAreas(), old.getAreas())){ + return; + } + //检查项目所选区域是否占用 List areaList = areaService.getAreaList(projectDO.getAreas()); List occupiedList = areaList.stream().filter(item -> item.getOccupied()).collect(Collectors.toList()); @@ -288,7 +328,7 @@ public class ProjectServiceImpl implements ProjectService { //项目更改失败, 进行中的项目不可修改作物 throw exception(PROJECT_STARTING_CANT_CHANGE_CROP); } - if (!project.getAreas().equals(updateProject.getAreas())){ + if (!CollectionUtils.isEqualCollection(project.getAreas(), updateProject.getAreas())){ //项目更改失败, 进行中的项目不可修改区域 throw exception(PROJECT_STARTING_CANT_CHANGE_AREA); } 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 cf0c2e36..93eb3e53 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 @@ -35,6 +35,7 @@ import cn.iocoder.yudao.module.farm.dal.mysql.taskCate.TaskCateMapper; import cn.iocoder.yudao.module.farm.enums.ProjectStateEnum; import cn.iocoder.yudao.module.farm.enums.TaskMemberEnum; import cn.iocoder.yudao.module.farm.enums.TaskStatus; +import cn.iocoder.yudao.module.farm.service.taskCate.TaskCateService; import cn.iocoder.yudao.module.system.dal.dataobject.CpUser.CpUserDO; import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO; import cn.iocoder.yudao.module.system.dal.mysql.CpUser.CpUserMapper; @@ -73,6 +74,8 @@ public class TaskServiceImpl implements TaskService { @Resource private TaskCateMapper taskCateMapper; @Resource + private TaskCateService taskCateService; + @Resource private CpUserService cpUserService; @Resource private ProjectMapper projectMapper; @@ -161,6 +164,15 @@ public class TaskServiceImpl implements TaskService { } } + //查看采收类型任务 + if (ObjectUtil.isNotEmpty(pageReqVO.getRecovery()) && pageReqVO.getRecovery()){ + List taskCateList = taskCateService.getTaskRecovery(); + if (ObjectUtil.isNotEmpty(taskCateList)){ + List taskCateIdList = taskCateList.stream().map(TaskCateDO::getId).collect(Collectors.toList()); + queryWrapperX.inIfPresent(TaskDO::getTaskCateId, taskCateIdList); + } + } + queryWrapperX.eqIfPresent(TaskDO::getProjectId, pageReqVO.getProjectId()) .eqIfPresent(TaskDO::getCropId, pageReqVO.getCropId()) .eqIfPresent(TaskDO::getCropNum, pageReqVO.getCropNum()) @@ -476,9 +488,10 @@ public class TaskServiceImpl implements TaskService { * 新增或修改检查任务所需资源数量 */ public void checkTaskResourceNumber(TaskDO taskDO){ - List resourceList = taskDO.getResources().toJavaList(ResourceDTO.class); +// List resourceList = taskDO.getResources().toJavaList(ResourceDTO.class); //任务状态更改成进行中 或 任务状态更改成完成 if (taskDO.getStatus().equals(TaskStatus.STARTED) || taskDO.getStatus().equals(TaskStatus.COMPLETE)){ + List resourceList = taskDO.getResources().toJavaList(ResourceDTO.class); for (ResourceDTO resourceDTO : resourceList) { ResourceDO resourceDO = resourceMapper.selectById(resourceDTO.getResourceId().get(1)); //更改成进行中 diff --git a/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/service/taskCate/TaskCateService.java b/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/service/taskCate/TaskCateService.java index 60d9fa85..a45f2d17 100644 --- a/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/service/taskCate/TaskCateService.java +++ b/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/service/taskCate/TaskCateService.java @@ -1,10 +1,15 @@ package cn.iocoder.yudao.module.farm.service.taskCate; -import java.util.*; -import javax.validation.*; -import cn.iocoder.yudao.module.farm.controller.admin.taskCate.vo.*; -import cn.iocoder.yudao.module.farm.dal.dataobject.taskCate.TaskCateDO; import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.module.farm.controller.admin.taskCate.vo.TaskCateCreateReqVO; +import cn.iocoder.yudao.module.farm.controller.admin.taskCate.vo.TaskCateExportReqVO; +import cn.iocoder.yudao.module.farm.controller.admin.taskCate.vo.TaskCatePageReqVO; +import cn.iocoder.yudao.module.farm.controller.admin.taskCate.vo.TaskCateUpdateReqVO; +import cn.iocoder.yudao.module.farm.dal.dataobject.taskCate.TaskCateDO; + +import javax.validation.Valid; +import java.util.Collection; +import java.util.List; /** * 任务类型 Service 接口 @@ -67,4 +72,9 @@ public interface TaskCateService { */ List getTaskCateList(TaskCateExportReqVO exportReqVO); + /** + * 获取所有采收类型任务类别 + */ + List getTaskRecovery(); + } diff --git a/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/service/taskCate/TaskCateServiceImpl.java b/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/service/taskCate/TaskCateServiceImpl.java index c759c98a..6b92c53b 100644 --- a/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/service/taskCate/TaskCateServiceImpl.java +++ b/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/service/taskCate/TaskCateServiceImpl.java @@ -1,19 +1,23 @@ package cn.iocoder.yudao.module.farm.service.taskCate; -import org.springframework.stereotype.Service; -import javax.annotation.Resource; -import org.springframework.validation.annotation.Validated; - -import java.util.*; -import cn.iocoder.yudao.module.farm.controller.admin.taskCate.vo.*; -import cn.iocoder.yudao.module.farm.dal.dataobject.taskCate.TaskCateDO; import cn.iocoder.yudao.framework.common.pojo.PageResult; - +import cn.iocoder.yudao.module.farm.controller.admin.taskCate.vo.TaskCateCreateReqVO; +import cn.iocoder.yudao.module.farm.controller.admin.taskCate.vo.TaskCateExportReqVO; +import cn.iocoder.yudao.module.farm.controller.admin.taskCate.vo.TaskCatePageReqVO; +import cn.iocoder.yudao.module.farm.controller.admin.taskCate.vo.TaskCateUpdateReqVO; import cn.iocoder.yudao.module.farm.convert.taskCate.TaskCateConvert; +import cn.iocoder.yudao.module.farm.dal.dataobject.taskCate.TaskCateDO; import cn.iocoder.yudao.module.farm.dal.mysql.taskCate.TaskCateMapper; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import org.springframework.stereotype.Service; +import org.springframework.validation.annotation.Validated; + +import javax.annotation.Resource; +import java.util.Collection; +import java.util.List; import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; -import static cn.iocoder.yudao.module.farm.enums.ErrorCodeConstants.*; +import static cn.iocoder.yudao.module.farm.enums.ErrorCodeConstants.TASK_CATE_NOT_EXISTS; /** * 任务类型 Service 实现类 @@ -82,4 +86,11 @@ public class TaskCateServiceImpl implements TaskCateService { return taskCateMapper.selectList(exportReqVO); } + /** + * 获取所有采收类型任务类别 + */ + public List getTaskRecovery(){ + return taskCateMapper.selectList(new LambdaQueryWrapper().eq(TaskCateDO::getSynchronizeErp, true)); + } + }