From dff81402bb67ef88800d4796819db017f8acfc1b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E4=B9=85=E5=93=A5?= <787952492@qq.com> Date: Wed, 8 Jun 2022 19:45:43 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B4=BB=E5=8A=A8=E7=BB=93=E6=9E=84=E6=9B=B4?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/discuss/DiscussController.java | 13 +++ .../admin/discuss/dto/DiscussDTO.java | 32 +++++++ .../admin/discuss/dto/DiscussDto.java | 4 - .../admin/discuss/dto/DiscussPageDTO.java | 18 ++++ .../admin/discuss/vo/DiscussBaseVO.java | 7 ++ .../admin/discuss/vo/DiscussExcelVO.java | 5 ++ .../admin/discuss/vo/DiscussExportReqVO.java | 5 ++ .../admin/discuss/vo/DiscussPageReqVO.java | 5 ++ .../admin/workHour/dto/WorkUserMsgDTO.java | 22 +++++ .../admin/workHour/vo/WorkHourBaseVO.java | 2 + .../admin/workHour/vo/WorkHourExcelVO.java | 2 + .../workHour/vo/WorkHourExportReqVO.java | 2 + .../admin/workHour/vo/WorkHourPageReqVO.java | 2 + .../admin/workHour/vo/WorkHourRespVO.java | 2 + .../dal/dataobject/discuss/DiscussDO.java | 6 ++ .../dal/dataobject/workHour/WorkHourDO.java | 2 + .../farm/dal/mysql/task/TaskMapper.java | 2 + .../farm/service/discuss/DiscussService.java | 8 ++ .../service/discuss/DiscussServiceImpl.java | 83 +++++++++++++++++++ 19 files changed, 218 insertions(+), 4 deletions(-) create mode 100644 zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/discuss/dto/DiscussDTO.java delete mode 100644 zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/discuss/dto/DiscussDto.java create mode 100644 zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/discuss/dto/DiscussPageDTO.java create mode 100644 zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/workHour/dto/WorkUserMsgDTO.java 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 8c7552d9..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 @@ -1,5 +1,11 @@ package cn.iocoder.yudao.module.farm.controller.admin.discuss; +import cn.iocoder.yudao.framework.common.page.PageVO; +import cn.iocoder.yudao.module.farm.controller.admin.discuss.dto.DiscussDTO; +import cn.iocoder.yudao.module.farm.controller.admin.discuss.dto.DiscussPageDTO; +import cn.iocoder.yudao.module.farm.controller.admin.project.dto.ProjectListDTO; +import cn.iocoder.yudao.module.farm.controller.admin.project.dto.ProjectPageDTO; +import com.zsw.base.R; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import org.springframework.validation.annotation.Validated; @@ -97,4 +103,11 @@ public class DiscussController { ExcelUtils.write(response, "农场任务讨论.xls", "数据", DiscussExcelVO.class, datas); } + + @ApiOperation("小程序活动列表") + @PostMapping("/findDiscussList") + public R> findProjectList(@RequestBody DiscussPageDTO pageDTO){ + return discussService.findDiscussList(pageDTO); + } + } diff --git a/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/discuss/dto/DiscussDTO.java b/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/discuss/dto/DiscussDTO.java new file mode 100644 index 00000000..65694ea0 --- /dev/null +++ b/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/discuss/dto/DiscussDTO.java @@ -0,0 +1,32 @@ +package cn.iocoder.yudao.module.farm.controller.admin.discuss.dto; + +import cn.iocoder.yudao.module.farm.controller.admin.workHour.dto.WorkUserMsgDTO; +import cn.iocoder.yudao.module.farm.dal.dataobject.discuss.DiscussDO; +import cn.iocoder.yudao.module.farm.dal.dataobject.project.ProjectDO; +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.Date; +import java.util.List; + +/** + * 分页返回数据 + **/ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class DiscussDTO extends DiscussDO { + + String publishName; + + String publishIcon; + + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + Date publishTime; + + + private List workList; + +} diff --git a/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/discuss/dto/DiscussDto.java b/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/discuss/dto/DiscussDto.java deleted file mode 100644 index 95e17951..00000000 --- a/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/discuss/dto/DiscussDto.java +++ /dev/null @@ -1,4 +0,0 @@ -package cn.iocoder.yudao.module.farm.controller.admin.discuss.dto; - -public class DiscussDto { -} diff --git a/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/discuss/dto/DiscussPageDTO.java b/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/discuss/dto/DiscussPageDTO.java new file mode 100644 index 00000000..41e664ad --- /dev/null +++ b/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/discuss/dto/DiscussPageDTO.java @@ -0,0 +1,18 @@ +package cn.iocoder.yudao.module.farm.controller.admin.discuss.dto; + +import cn.iocoder.yudao.framework.common.page.PageDTO; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * 分页请求参数 + **/ +@Data +public class DiscussPageDTO extends PageDTO { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("当前任务id") + private Long taskId; + +} \ No newline at end of file diff --git a/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/discuss/vo/DiscussBaseVO.java b/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/discuss/vo/DiscussBaseVO.java index 79276022..21b0e908 100644 --- a/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/discuss/vo/DiscussBaseVO.java +++ b/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/discuss/vo/DiscussBaseVO.java @@ -1,6 +1,9 @@ package cn.iocoder.yudao.module.farm.controller.admin.discuss.vo; import cn.iocoder.yudao.module.farm.controller.admin.workHour.vo.WorkHourBaseVO; +import com.alibaba.fastjson.JSONArray; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler; import lombok.*; import java.util.*; import io.swagger.annotations.*; @@ -27,6 +30,10 @@ public class DiscussBaseVO { @ApiModelProperty(value = "") private List images; + private JSONArray areas; + + private Integer cropNum; + private List workHourList; } 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 14f1b3ec..f65cd59a 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 @@ -1,6 +1,7 @@ package cn.iocoder.yudao.module.farm.controller.admin.discuss.vo; import cn.iocoder.yudao.module.farm.controller.admin.workHour.vo.WorkHourBaseVO; +import com.alibaba.fastjson.JSONArray; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler; import lombok.*; @@ -32,6 +33,10 @@ public class DiscussExcelVO { @ExcelProperty("") private List images; + private JSONArray areas; + + private Integer cropNum; + @ExcelProperty("") private Date createTime; diff --git a/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/discuss/vo/DiscussExportReqVO.java b/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/discuss/vo/DiscussExportReqVO.java index 6d71b9fb..ce0e9a59 100644 --- a/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/discuss/vo/DiscussExportReqVO.java +++ b/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/discuss/vo/DiscussExportReqVO.java @@ -1,5 +1,6 @@ package cn.iocoder.yudao.module.farm.controller.admin.discuss.vo; +import com.alibaba.fastjson.JSONArray; import lombok.*; import java.util.*; import io.swagger.annotations.*; @@ -24,6 +25,10 @@ public class DiscussExportReqVO { @ApiModelProperty(value = "") private String images; + private JSONArray areas; + + private Integer cropNum; + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) @ApiModelProperty(value = "开始") private Date beginCreateTime; diff --git a/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/discuss/vo/DiscussPageReqVO.java b/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/discuss/vo/DiscussPageReqVO.java index f7069bd7..de225d92 100644 --- a/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/discuss/vo/DiscussPageReqVO.java +++ b/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/discuss/vo/DiscussPageReqVO.java @@ -1,5 +1,6 @@ package cn.iocoder.yudao.module.farm.controller.admin.discuss.vo; +import com.alibaba.fastjson.JSONArray; import lombok.*; import java.util.*; import io.swagger.annotations.*; @@ -26,6 +27,10 @@ public class DiscussPageReqVO extends PageParam { @ApiModelProperty(value = "") private String images; + private JSONArray areas; + + private Integer cropNum; + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) @ApiModelProperty(value = "开始") private Date beginCreateTime; diff --git a/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/workHour/dto/WorkUserMsgDTO.java b/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/workHour/dto/WorkUserMsgDTO.java new file mode 100644 index 00000000..3a28a091 --- /dev/null +++ b/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/workHour/dto/WorkUserMsgDTO.java @@ -0,0 +1,22 @@ +package cn.iocoder.yudao.module.farm.controller.admin.workHour.dto; + +import cn.iocoder.yudao.module.farm.dal.dataobject.discuss.DiscussDO; +import cn.iocoder.yudao.module.farm.dal.dataobject.workHour.WorkHourDO; +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.Date; + +/** + * 工时返回姓名 + **/ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class WorkUserMsgDTO extends WorkHourDO { + + String userName; + +} diff --git a/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/workHour/vo/WorkHourBaseVO.java b/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/workHour/vo/WorkHourBaseVO.java index 625d5789..f3e2af18 100644 --- a/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/workHour/vo/WorkHourBaseVO.java +++ b/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/workHour/vo/WorkHourBaseVO.java @@ -12,6 +12,8 @@ import javax.validation.constraints.*; @Data public class WorkHourBaseVO { + private Long discussId; + @ApiModelProperty(value = "") private Long userId; 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 2bfc13be..34f87ef5 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 @@ -20,6 +20,8 @@ public class WorkHourExcelVO { @ExcelProperty("") private Integer userId; + private Long discussId; + @ExcelProperty("") private Integer projectId; diff --git a/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/workHour/vo/WorkHourExportReqVO.java b/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/workHour/vo/WorkHourExportReqVO.java index b300e8cc..f8e3a85d 100644 --- a/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/workHour/vo/WorkHourExportReqVO.java +++ b/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/workHour/vo/WorkHourExportReqVO.java @@ -15,6 +15,8 @@ public class WorkHourExportReqVO { @ApiModelProperty(value = "") private Integer userId; + private Long discussId; + @ApiModelProperty(value = "") private Integer projectId; diff --git a/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/workHour/vo/WorkHourPageReqVO.java b/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/workHour/vo/WorkHourPageReqVO.java index f618f450..0b88898b 100644 --- a/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/workHour/vo/WorkHourPageReqVO.java +++ b/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/workHour/vo/WorkHourPageReqVO.java @@ -17,6 +17,8 @@ public class WorkHourPageReqVO extends PageParam { @ApiModelProperty(value = "") private Integer userId; + private Long discussId; + @ApiModelProperty(value = "") private Integer projectId; diff --git a/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/workHour/vo/WorkHourRespVO.java b/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/workHour/vo/WorkHourRespVO.java index c9ff333b..02c19f8e 100644 --- a/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/workHour/vo/WorkHourRespVO.java +++ b/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/workHour/vo/WorkHourRespVO.java @@ -13,6 +13,8 @@ public class WorkHourRespVO extends WorkHourBaseVO { @ApiModelProperty(value = "", required = true) private Long id; + private Long discussId; + @ApiModelProperty(value = "") private Date createTime; diff --git a/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/dal/dataobject/discuss/DiscussDO.java b/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/dal/dataobject/discuss/DiscussDO.java index 3e935066..b75f93af 100644 --- a/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/dal/dataobject/discuss/DiscussDO.java +++ b/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/dal/dataobject/discuss/DiscussDO.java @@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.farm.dal.dataobject.discuss; import cn.iocoder.yudao.module.farm.controller.admin.workHour.vo.WorkHourBaseVO; import cn.iocoder.yudao.module.farm.dal.dataobject.workHour.WorkHourDO; +import com.alibaba.fastjson.JSONArray; import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler; import lombok.*; import java.util.*; @@ -49,4 +50,9 @@ public class DiscussDO extends BaseDO { @TableField(typeHandler = JacksonTypeHandler.class) private List images; + @TableField(typeHandler = JacksonTypeHandler.class) + private JSONArray areas; + + private Integer cropNum; + } diff --git a/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/dal/dataobject/workHour/WorkHourDO.java b/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/dal/dataobject/workHour/WorkHourDO.java index a4430f1e..62ad43fb 100644 --- a/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/dal/dataobject/workHour/WorkHourDO.java +++ b/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/dal/dataobject/workHour/WorkHourDO.java @@ -28,6 +28,8 @@ public class WorkHourDO extends BaseDO { * */ private Long userId; + + private Long discussId; /** * */ diff --git a/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/dal/mysql/task/TaskMapper.java b/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/dal/mysql/task/TaskMapper.java index 6b798e29..07292afd 100644 --- a/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/dal/mysql/task/TaskMapper.java +++ b/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/dal/mysql/task/TaskMapper.java @@ -26,6 +26,7 @@ public interface TaskMapper extends BaseMapperX { .eqIfPresent(TaskDO::getTaskCateName, reqVO.getTaskCateName()) .eqIfPresent(TaskDO::getResources, reqVO.getResources()) .eqIfPresent(TaskDO::getImages, reqVO.getImages()) + .eqIfPresent(TaskDO::getDraft, reqVO.getDraft()) .betweenIfPresent(TaskDO::getPlanStartTime, reqVO.getBeginPlanStartTime(), reqVO.getEndPlanStartTime()) .betweenIfPresent(TaskDO::getPlanEndTime, reqVO.getBeginPlanEndTime(), reqVO.getEndPlanEndTime()) .eqIfPresent(TaskDO::getWeight, reqVO.getWeight()) @@ -42,6 +43,7 @@ public interface TaskMapper extends BaseMapperX { .eqIfPresent(TaskDO::getTaskCateName, reqVO.getTaskCateName()) .eqIfPresent(TaskDO::getResources, reqVO.getResources()) .eqIfPresent(TaskDO::getImages, reqVO.getImages()) + .eqIfPresent(TaskDO::getDraft, reqVO.getDraft()) .betweenIfPresent(TaskDO::getPlanStartTime, reqVO.getBeginPlanStartTime(), reqVO.getEndPlanStartTime()) .betweenIfPresent(TaskDO::getPlanEndTime, reqVO.getBeginPlanEndTime(), reqVO.getEndPlanEndTime()) .eqIfPresent(TaskDO::getWeight, reqVO.getWeight()) 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 2a6f8a01..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 @@ -2,9 +2,14 @@ package cn.iocoder.yudao.module.farm.service.discuss; import java.util.*; import javax.validation.*; + +import cn.iocoder.yudao.framework.common.page.PageVO; +import cn.iocoder.yudao.module.farm.controller.admin.discuss.dto.DiscussDTO; +import cn.iocoder.yudao.module.farm.controller.admin.discuss.dto.DiscussPageDTO; import cn.iocoder.yudao.module.farm.controller.admin.discuss.vo.*; import cn.iocoder.yudao.module.farm.dal.dataobject.discuss.DiscussDO; import cn.iocoder.yudao.framework.common.pojo.PageResult; +import com.zsw.base.R; /** * 农场任务讨论 Service 接口 @@ -67,4 +72,7 @@ public interface DiscussService { */ List getDiscussList(DiscussExportReqVO exportReqVO); + + R> findDiscussList(DiscussPageDTO pageDTO); + } 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 1f1fde72..7661c2ff 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 @@ -1,10 +1,30 @@ package cn.iocoder.yudao.module.farm.service.discuss; +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.util.ObjectUtil; +import cn.iocoder.yudao.framework.common.page.PageUtil; +import cn.iocoder.yudao.framework.common.page.PageVO; +import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; +import cn.iocoder.yudao.module.farm.controller.admin.discuss.dto.DiscussDTO; +import cn.iocoder.yudao.module.farm.controller.admin.discuss.dto.DiscussPageDTO; +import cn.iocoder.yudao.module.farm.controller.admin.project.dto.ProjectListDTO; +import cn.iocoder.yudao.module.farm.controller.admin.workHour.dto.WorkUserMsgDTO; +import cn.iocoder.yudao.module.farm.controller.admin.workHour.vo.WorkHourBaseVO; +import cn.iocoder.yudao.module.farm.dal.dataobject.workHour.WorkHourDO; +import cn.iocoder.yudao.module.farm.dal.mysql.workHour.WorkHourMapper; +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; +import cn.iocoder.yudao.module.system.dal.mysql.user.AdminUserMapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.zsw.base.R; import org.springframework.stereotype.Service; import javax.annotation.Resource; import org.springframework.validation.annotation.Validated; import java.util.*; +import java.util.stream.Collectors; + import cn.iocoder.yudao.module.farm.controller.admin.discuss.vo.*; import cn.iocoder.yudao.module.farm.dal.dataobject.discuss.DiscussDO; import cn.iocoder.yudao.framework.common.pojo.PageResult; @@ -26,6 +46,12 @@ public class DiscussServiceImpl implements DiscussService { @Resource private DiscussMapper discussMapper; + @Resource + private CpUserMapper cpUserMapper; + @Resource + private AdminUserMapper adminUserMapper; + @Resource + private WorkHourMapper workHourMapper; @Override public Long createDiscuss(DiscussCreateReqVO createReqVO) { @@ -79,4 +105,61 @@ public class DiscussServiceImpl implements DiscussService { return discussMapper.selectList(exportReqVO); } + @Override + public R> findDiscussList(DiscussPageDTO pageDTO) { + PageUtil.startPage(pageDTO); + LambdaQueryWrapperX queryWrapperX = new LambdaQueryWrapperX<>(); + queryWrapperX.eqIfPresent(DiscussDO::getTaskId, pageDTO.getTaskId()); + + List discussList = discussMapper.selectList(queryWrapperX); + if (ObjectUtil.isEmpty(discussList)){ + return R.success(PageUtil.emptyPage(pageDTO, DiscussDTO.class)); + } + + //活动创建人id + List adminUserIdList = discussList.stream().map(DiscussDO::getCreator).collect(Collectors.toList()); + //系统用户List + List adminUserList = adminUserMapper.selectBatchIds(adminUserIdList); + //系统用户名对应企业用户名 + List userNameList = adminUserList.stream().map(AdminUserDO::getUsername).collect(Collectors.toList()); + //企业用户 + List cpUserList = cpUserMapper.selectList(Wrappers.lambdaQuery()); + + //工时List + List workIdList = discussList.stream().map(DiscussDO::getId).collect(Collectors.toList()); + List workHourList = workHourMapper.selectList(Wrappers.lambdaQuery().in(WorkHourDO::getProjectId, workIdList)); + + // key 系统用户id value cpUser + Map map = new HashMap<>(); + for (AdminUserDO adminUserDO : adminUserList) { + for (CpUserDO cpUserDO : cpUserList) { + if (adminUserDO.getUsername().equals(cpUserDO.getUserId())){ + map.put(adminUserDO.getId(), cpUserDO); + } + } + } + + List discussDTOList = BeanUtil.copyToList(discussList, DiscussDTO.class); + for (DiscussDTO discussDTO : discussDTOList) { + if (map.containsKey(Long.valueOf(discussDTO.getCreator()))){ + CpUserDO cpUser = map.get(Long.valueOf(discussDTO.getCreator())); + discussDTO.setPublishName(cpUser.getName()); + discussDTO.setPublishIcon(cpUser.getAvatar()); + discussDTO.setPublishTime(discussDTO.getCreateTime()); + } + List workList = workHourList.stream().filter(item -> item.getDiscussId().equals(discussDTO.getId())).collect(Collectors.toList()); + List workUserMsgList = BeanUtil.copyToList(workList, WorkUserMsgDTO.class); + for (WorkUserMsgDTO msg : workUserMsgList){ + for (CpUserDO cpUserDO : cpUserList) { + if (msg.getUserId().equals(cpUserDO.getId())){ + msg.setUserName(cpUserDO.getName()); + } + } + } + discussDTO.setWorkList(workUserMsgList); + } + PageVO returnList = PageUtil.convertPageInfo(discussDTOList); + return R.success(returnList); + } + }