日期有任务的显示
This commit is contained in:
+1
-2
@@ -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<ProjectRespVO> getProject(@RequestParam("id") Long id) {
|
||||
ProjectDO project = projectService.getProject(id);
|
||||
return success(ProjectConvert.INSTANCE.convert(project));
|
||||
return success(projectService.getProject(id));
|
||||
}
|
||||
|
||||
@GetMapping("/list")
|
||||
|
||||
+5
-4
@@ -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<RoleDO> roles = roleService.getRolesFromCache(loginUser.getRoleIds());
|
||||
|
||||
Optional<RoleDO> 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;
|
||||
}
|
||||
|
||||
+4
@@ -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<CpUserDO> userList;
|
||||
|
||||
}
|
||||
|
||||
+8
@@ -141,4 +141,12 @@ public class TaskController {
|
||||
public R<TaskSummaryDTO> taskSummary(){
|
||||
return R.success(taskService.taskSummary());
|
||||
}
|
||||
|
||||
|
||||
|
||||
@GetMapping("/whatDayHaveTask")
|
||||
@ApiOperation("有任务的日期")
|
||||
public R<List<Map<String, String>>> whatDayHaveTask(){
|
||||
return R.success(taskService.whatDayHaveTask());
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -46,7 +46,7 @@ public interface ProjectService {
|
||||
* @param id 编号
|
||||
* @return 农场项目
|
||||
*/
|
||||
ProjectDO getProject(Long id);
|
||||
ProjectRespVO getProject(Long id);
|
||||
|
||||
/**
|
||||
* 获得农场项目列表
|
||||
|
||||
+7
-2
@@ -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<CpUserDO> userList = ObjectUtil.isEmpty(projectDO.getMembers()) ? new ArrayList<>() : cpUserMapper.selectList(CpUserDO::getId, projectDO.getMembers());
|
||||
respVO.setUserList(userList);
|
||||
return respVO;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+6
@@ -93,4 +93,10 @@ public interface TaskService {
|
||||
* 任务汇总
|
||||
**/
|
||||
TaskSummaryDTO taskSummary();
|
||||
|
||||
/**
|
||||
* 小程序任务 有日期的任务显示
|
||||
**/
|
||||
List<Map<String, String>> whatDayHaveTask();
|
||||
|
||||
}
|
||||
|
||||
+21
@@ -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<Map<String, String>> whatDayHaveTask(){
|
||||
LambdaQueryWrapperX<TaskDO> queryWrapperX = new LambdaQueryWrapperX<>();
|
||||
queryWrapperX.ne(TaskDO::getDraft, true);
|
||||
queryWrapperX.ne(TaskDO::getPretendDelete, true);
|
||||
List<TaskDO> taskList = taskMapper.selectList(queryWrapperX);
|
||||
Map<Object, List<TaskDO>> dateMap = taskList.stream().collect(Collectors.groupingBy(item -> DateUtil.format(item.getPlanStartTime(), DatePattern.NORM_DATE_FORMAT)));
|
||||
List<Map<String, String>> list = new ArrayList<>();
|
||||
dateMap.entrySet().stream().forEach(item ->{
|
||||
Map map = new HashMap<String,String>() ;
|
||||
map.put("date", item.getKey().toString());
|
||||
list.add(map);
|
||||
});
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user