diff --git a/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/project/ProjectController.java b/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/project/ProjectController.java index 02e79bb5..2b7ce290 100644 --- a/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/project/ProjectController.java +++ b/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/project/ProjectController.java @@ -73,8 +73,7 @@ public class ProjectController { @ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class) @PreAuthorize("@ss.hasPermission('farm:project:query')") public CommonResult getProject(@RequestParam("id") Long id) { - ProjectDO project = projectService.getProject(id); - return success(ProjectConvert.INSTANCE.convert(project)); + return success(projectService.getProject(id)); } @GetMapping("/list") diff --git a/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/project/vo/ProjectBaseVO.java b/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/project/vo/ProjectBaseVO.java index c3c833a8..69a52c3f 100644 --- a/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/project/vo/ProjectBaseVO.java +++ b/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/project/vo/ProjectBaseVO.java @@ -25,7 +25,8 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_ * 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成 */ @Data -public class ProjectBaseVO extends ProjectDO { +public class +ProjectBaseVO extends ProjectDO { @ApiModelProperty(value = "") @@ -78,11 +79,11 @@ public class ProjectBaseVO extends ProjectDO { List roles = roleService.getRolesFromCache(loginUser.getRoleIds()); Optional admin = roles.stream().filter(roleDO -> roleDO.getName().contains("管理员") || roleDO.getCode().contains("admin")).findAny(); - // 是创建者 或者 是 租户的管理员,可以更改项目 - actions.put("edit",getCreator().equals(loginUser.getId().toString()) || admin.isPresent()); +// // 是创建者 或者 是 租户的管理员,可以更改项目 + actions.put("edit",this.getCreator().equals(loginUser.getId().toString()) || admin.isPresent()); // 应该加上,项目下面没有运行中的任务才可以删除 ,或者是在删除部分再做判断 ,此处只做权限显示 - actions.put("delete",getCreator().equals(loginUser.getId().toString()) || admin.isPresent()); + actions.put("delete",this.getCreator().equals(loginUser.getId().toString()) || admin.isPresent()); return actions; } 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 ad838315..d8c6eaa6 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,5 +1,6 @@ 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.*; @@ -16,4 +17,7 @@ public class ProjectRespVO extends ProjectBaseVO { @ApiModelProperty(value = "") private Date createTime; + @ApiModelProperty("项目的成员") + private List userList; + } diff --git a/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/task/TaskController.java b/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/task/TaskController.java index 389cf07f..65ca30e4 100644 --- a/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/task/TaskController.java +++ b/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/task/TaskController.java @@ -141,4 +141,12 @@ public class TaskController { public R taskSummary(){ return R.success(taskService.taskSummary()); } + + + + @GetMapping("/whatDayHaveTask") + @ApiOperation("有任务的日期") + public R>> whatDayHaveTask(){ + return R.success(taskService.whatDayHaveTask()); + } } diff --git a/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/service/project/ProjectService.java b/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/service/project/ProjectService.java index d5631495..3205eca8 100644 --- a/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/service/project/ProjectService.java +++ b/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/service/project/ProjectService.java @@ -46,7 +46,7 @@ public interface ProjectService { * @param id 编号 * @return 农场项目 */ - ProjectDO getProject(Long id); + ProjectRespVO getProject(Long id); /** * 获得农场项目列表 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 cbce2ec4..db11a127 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 @@ -113,8 +113,13 @@ public class ProjectServiceImpl implements ProjectService { } @Override - public ProjectDO getProject(Long id) { - return projectMapper.selectById(id); + public ProjectRespVO getProject(Long id) { + ProjectDO projectDO = projectMapper.selectById(id); + ProjectRespVO respVO = BeanUtil.copyProperties(projectDO, ProjectRespVO.class); + List userList = ObjectUtil.isEmpty(projectDO.getMembers()) ? new ArrayList<>() : cpUserMapper.selectList(CpUserDO::getId, projectDO.getMembers()); + respVO.setUserList(userList); + return respVO; + } @Override diff --git a/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/service/task/TaskService.java b/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/service/task/TaskService.java index b3a2b49d..29bd3136 100644 --- a/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/service/task/TaskService.java +++ b/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/service/task/TaskService.java @@ -93,4 +93,10 @@ public interface TaskService { * 任务汇总 **/ TaskSummaryDTO taskSummary(); + + /** + * 小程序任务 有日期的任务显示 + **/ + List> whatDayHaveTask(); + } 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 6ff35c3e..0551af78 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 @@ -1,6 +1,8 @@ package cn.iocoder.yudao.module.farm.service.task; import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.date.DatePattern; +import cn.hutool.core.date.DateUtil; import cn.hutool.core.text.StrBuilder; import cn.hutool.core.util.NumberUtil; import cn.hutool.core.util.ObjectUtil; @@ -8,6 +10,7 @@ import cn.hutool.system.oshi.CpuInfo; 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.framework.mybatis.core.query.QueryWrapperX; import cn.iocoder.yudao.framework.security.core.LoginUser; import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils; import cn.iocoder.yudao.module.farm.controller.admin.resource.dto.ResourceDTO; @@ -34,6 +37,7 @@ 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 cn.iocoder.yudao.module.system.service.CpUser.CpUserService; +import com.alibaba.excel.annotation.format.DateTimeFormat; import com.alibaba.fastjson.JSONArray; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; @@ -44,6 +48,8 @@ import javax.annotation.Resource; import org.springframework.util.ObjectUtils; import org.springframework.validation.annotation.Validated; +import java.text.DateFormat; +import java.time.LocalDateTime; import java.util.*; import java.util.stream.Collectors; @@ -472,6 +478,21 @@ public class TaskServiceImpl implements TaskService { } + public List> whatDayHaveTask(){ + LambdaQueryWrapperX queryWrapperX = new LambdaQueryWrapperX<>(); + queryWrapperX.ne(TaskDO::getDraft, true); + queryWrapperX.ne(TaskDO::getPretendDelete, true); + List taskList = taskMapper.selectList(queryWrapperX); + Map> dateMap = taskList.stream().collect(Collectors.groupingBy(item -> DateUtil.format(item.getPlanStartTime(), DatePattern.NORM_DATE_FORMAT))); + List> list = new ArrayList<>(); + dateMap.entrySet().stream().forEach(item ->{ + Map map = new HashMap() ; + map.put("date", item.getKey().toString()); + list.add(map); + }); + return list; + } + }