Browse Source

活动结构更改

zyh
小久哥 3 years ago
parent
commit
dff81402bb
  1. 13
      zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/discuss/DiscussController.java
  2. 32
      zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/discuss/dto/DiscussDTO.java
  3. 4
      zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/discuss/dto/DiscussDto.java
  4. 18
      zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/discuss/dto/DiscussPageDTO.java
  5. 7
      zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/discuss/vo/DiscussBaseVO.java
  6. 5
      zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/discuss/vo/DiscussExcelVO.java
  7. 5
      zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/discuss/vo/DiscussExportReqVO.java
  8. 5
      zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/discuss/vo/DiscussPageReqVO.java
  9. 22
      zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/workHour/dto/WorkUserMsgDTO.java
  10. 2
      zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/workHour/vo/WorkHourBaseVO.java
  11. 2
      zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/workHour/vo/WorkHourExcelVO.java
  12. 2
      zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/workHour/vo/WorkHourExportReqVO.java
  13. 2
      zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/workHour/vo/WorkHourPageReqVO.java
  14. 2
      zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/workHour/vo/WorkHourRespVO.java
  15. 6
      zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/dal/dataobject/discuss/DiscussDO.java
  16. 2
      zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/dal/dataobject/workHour/WorkHourDO.java
  17. 2
      zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/dal/mysql/task/TaskMapper.java
  18. 8
      zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/service/discuss/DiscussService.java
  19. 83
      zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/service/discuss/DiscussServiceImpl.java

13
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<PageVO<DiscussDTO>> findProjectList(@RequestBody DiscussPageDTO pageDTO){
return discussService.findDiscussList(pageDTO);
}
}

32
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<WorkUserMsgDTO> workList;
}

4
zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/discuss/dto/DiscussDto.java

@ -1,4 +0,0 @@
package cn.iocoder.yudao.module.farm.controller.admin.discuss.dto;
public class DiscussDto {
}

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

7
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<String> images;
private JSONArray areas;
private Integer cropNum;
private List<WorkHourBaseVO> workHourList;
}

5
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<String> images;
private JSONArray areas;
private Integer cropNum;
@ExcelProperty("")
private Date createTime;

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

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

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

2
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;

2
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;

2
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;

2
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;

2
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;

6
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<String> images;
@TableField(typeHandler = JacksonTypeHandler.class)
private JSONArray areas;
private Integer cropNum;
}

2
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;
/**
*
*/

2
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<TaskDO> {
.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<TaskDO> {
.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())

8
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<DiscussDO> getDiscussList(DiscussExportReqVO exportReqVO);
R<PageVO<DiscussDTO>> findDiscussList(DiscussPageDTO pageDTO);
}

83
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<PageVO<DiscussDTO>> findDiscussList(DiscussPageDTO pageDTO) {
PageUtil.startPage(pageDTO);
LambdaQueryWrapperX<DiscussDO> queryWrapperX = new LambdaQueryWrapperX<>();
queryWrapperX.eqIfPresent(DiscussDO::getTaskId, pageDTO.getTaskId());
List<DiscussDO> discussList = discussMapper.selectList(queryWrapperX);
if (ObjectUtil.isEmpty(discussList)){
return R.success(PageUtil.emptyPage(pageDTO, DiscussDTO.class));
}
//活动创建人id
List<String> adminUserIdList = discussList.stream().map(DiscussDO::getCreator).collect(Collectors.toList());
//系统用户List
List<AdminUserDO> adminUserList = adminUserMapper.selectBatchIds(adminUserIdList);
//系统用户名对应企业用户名
List<String> userNameList = adminUserList.stream().map(AdminUserDO::getUsername).collect(Collectors.toList());
//企业用户
List<CpUserDO> cpUserList = cpUserMapper.selectList(Wrappers.<CpUserDO>lambdaQuery());
//工时List
List<Long> workIdList = discussList.stream().map(DiscussDO::getId).collect(Collectors.toList());
List<WorkHourDO> workHourList = workHourMapper.selectList(Wrappers.<WorkHourDO>lambdaQuery().in(WorkHourDO::getProjectId, workIdList));
// key 系统用户id value cpUser
Map<Long, CpUserDO> map = new HashMap<>();
for (AdminUserDO adminUserDO : adminUserList) {
for (CpUserDO cpUserDO : cpUserList) {
if (adminUserDO.getUsername().equals(cpUserDO.getUserId())){
map.put(adminUserDO.getId(), cpUserDO);
}
}
}
List<DiscussDTO> 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<WorkHourDO> workList = workHourList.stream().filter(item -> item.getDiscussId().equals(discussDTO.getId())).collect(Collectors.toList());
List<WorkUserMsgDTO> 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<DiscussDTO> returnList = PageUtil.convertPageInfo(discussDTOList);
return R.success(returnList);
}
}

Loading…
Cancel
Save