预设项目进度控制

This commit is contained in:
2025-04-12 14:30:23 +08:00
parent f77cf3655c
commit a67cac2ebe
17 changed files with 291 additions and 174 deletions

View File

@@ -64,4 +64,6 @@ public interface ISysOaProjectService {
* @return
*/
List<SysOaProjectVo> getProjectDataByMonthAndDate();
TableDataInfo<SysOaProjectVo> queryFiles(SysOaWarehouseDetailBo bo, PageQuery pageQuery);
}

View File

@@ -33,19 +33,6 @@ public interface ISysOaTaskService {
*/
List<SysOaTaskVo> queryList(SysOaTaskBo bo);
/****
* 据工作类型字典查询任务列表
* @param pid
* @return
*/
R queryTaskByDictList(Long pid);
/**
* 根据工作类型查询列表
* @param bo
* @return
*/
List<SysOaTaskVo> queryListByType(SysOaTaskBo bo);
/**
* 新增任务管理
*/

View File

@@ -79,9 +79,7 @@ public class SysOaHolidayServiceImpl implements ISysOaHolidayService {
Map<String, Object> params = bo.getParams();
LambdaQueryWrapper<SysOaHoliday> lqw = Wrappers.lambdaQuery();
lqw.eq(bo.getType() != null, SysOaHoliday::getType, bo.getType());
System.out.println(bo);
if (bo.getHolidayTime() != null) {
System.out.println("今年考了哈士大夫");
lqw.between(SysOaHoliday::getHolidayTime, getFirstDay(bo.getHolidayTime()),getLastDay(bo.getHolidayTime()));
}
lqw.like(StringUtils.isNotBlank(bo.getName()), SysOaHoliday::getName, bo.getName());

View File

@@ -11,6 +11,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.ruoyi.oa.domain.bo.SysOaWarehouseDetailBo;
import com.ruoyi.oa.domain.vo.SysOaOutWarehouseListVo;
import com.ruoyi.oa.domain.vo.SysOaTaskVo;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import com.ruoyi.oa.domain.bo.SysOaProjectBo;
@@ -20,6 +21,7 @@ import com.ruoyi.oa.mapper.SysOaProjectMapper;
import com.ruoyi.oa.service.ISysOaProjectService;
import java.util.*;
import java.util.stream.Collectors;
/**
* 项目管理Service业务层处理
@@ -153,6 +155,57 @@ public class SysOaProjectServiceImpl implements ISysOaProjectService {
return projectVos;
}
@Override
public TableDataInfo<SysOaProjectVo> queryFiles(SysOaWarehouseDetailBo bo, PageQuery pageQuery) {
QueryWrapper<SysOaProject> sysOaProjectQueryWrapper = buildOutWareQueryWrapper(bo);
sysOaProjectQueryWrapper.groupBy("sop.project_id","sop.project_name","t.task_id","t.task_type","t.status","nick_name","ti.item_id","ti.sign_time","sop.create_time");
// sysOaProjectQueryWrapper.having("file_urls IS NOT NULL");
Page<SysOaProjectVo> result = baseMapper.selectFileVoList(pageQuery.build(), sysOaProjectQueryWrapper);
List<SysOaProjectVo> projects = result.getRecords();
// 2) 遍历每个项目,对其 taskList 做补充
for (SysOaProjectVo project : projects) {
List<SysOaTaskVo> taskList = project.getTaskList();
if (taskList == null || taskList.isEmpty()) {
continue;
}
// 2.1 取出已经出现的 taskType
Set<Long> existingTypes = taskList.stream()
.map(SysOaTaskVo::getTaskType)
.filter(Objects::nonNull)
.collect(Collectors.toSet());
// 2.2 找出最大 taskType
Long maxType = existingTypes.stream().max(Long::compareTo).orElse(0L);
if (maxType <= 1) {
// 如果最大只有1且你仍想补齐1..1,那其实啥都不补。
// 也可以补其它逻辑
continue;
}
// 2.3 在 1..maxType 范围内检查是否缺失
for (Long type = 1L; type <= maxType; type++) {
if (!existingTypes.contains(type)) {
// 缺失则插入一个空对象
SysOaTaskVo emptyTask = new SysOaTaskVo();
emptyTask.setTaskType(type);
// 例如给 status 默认 0, 或者不赋值
emptyTask.setStatus(null);
// 任务item列表为空
emptyTask.setTaskItemVoList(new ArrayList<>());
// 其他字段如 nickName, createTime, etc. 也可设为空或默认值
taskList.add(emptyTask);
}
}
// 此时taskList已经包含了 1..maxType 全部类型
// 如果你想让结果中的 taskType 从大到小排序或从小到大排序再手动sort一下
taskList.sort(Comparator.comparing(SysOaTaskVo::getTaskType));
}
return TableDataInfo.build(result);
}
private QueryWrapper<SysOaProject> buildOutWareQueryWrapper(SysOaWarehouseDetailBo bo) {
QueryWrapper<SysOaProject> lqw = Wrappers.query();
lqw.like(StringUtils.isNotBlank(bo.getProjectName()), "sop.projec_name", bo.getProjectName());

View File

@@ -107,60 +107,6 @@ public class SysOaTaskServiceImpl implements ISysOaTaskService {
return TableDataInfo.build(result);
}
/**
* 据工作类型字典查询任务列表
* @param pid
* @return
*/
@Override
public R queryTaskByDictList(Long pid){
List<Object> objects = new ArrayList<>();
List<SysDictData> sysWorkType = dictTypeService.selectDictDataByType("sys_work_type");
sysWorkType.forEach(item -> {
SysOaTaskBo sysOaTaskBo = new SysOaTaskBo();
sysOaTaskBo.setProjectId(pid);
sysOaTaskBo.setTaskType(item.getDictValue());
List<SysOaTaskVo> sysOaTaskVos = this.queryListByType(sysOaTaskBo);
Map<String, Object> ajax = new HashMap<>();
ajax.put("dictLabel", item.getDictLabel());
ajax.put("dictValue", item.getDictValue());
ajax.put("taskList", sysOaTaskVos);
ajax.put("size", "large");
ajax.put("type", "primary");
ajax.put("icon", "el-icon-more");
ajax.put("color", "#cccccc");
objects.add(ajax);
});
//根据项目id获取任务列表类型属性最大的值
SysOaTaskBo task = new SysOaTaskBo();
task.setProjectId(pid);
List<SysOaTaskVo> taskVos = this.queryListByType(task);
List<Integer> collect = taskVos.stream().map(v -> Integer.parseInt(v.getTaskType())).collect(Collectors.toList());
OptionalInt max = collect.stream().mapToInt(Integer::intValue).max();
Map<String, Object> map = new HashMap<>();
if(max.isPresent()){
map.put("active", max.getAsInt());
}else {
map.put("active", 0);
}
map.put("taskList", objects);
return R.ok(map);
}
/**
* 根据工作类型查询列表
* @param bo
* @return
*/
@Override
public List<SysOaTaskVo> queryListByType(SysOaTaskBo bo){
LambdaQueryWrapper<SysOaTask> lqw = new LambdaQueryWrapper<>();
lqw.eq(bo.getProjectId()!=null, SysOaTask::getProjectId, bo.getProjectId());
lqw.like(bo.getTaskTitle()!=null, SysOaTask::getTaskTitle, bo.getTaskTitle());
lqw.eq(StringUtils.isNotBlank(bo.getTaskType()),SysOaTask::getTaskType, bo.getTaskType());
return baseMapper.selectVoList(lqw);
}
/**
* 查询任务管理列表
*/
@@ -197,7 +143,7 @@ public class SysOaTaskServiceImpl implements ISysOaTaskService {
lqw.eq(bo.getState()!=null, "sot.state", bo.getState());
lqw.eq(bo.getItemStatus()!=null, "soti.status", bo.getItemStatus());
lqw.like(bo.getTaskTitle()!=null, "sot.task_title", bo.getTaskTitle());
lqw.isNotNull("sot.task_title");
lqw.like(bo.getTaskTitle()!=null, "sot.task_title", bo.getTaskTitle());
lqw.like(bo.getCreateUserNickName()!=null, "su1.nick_name", bo.getCreateUserNickName());
lqw.like(bo.getWorkerNickName()!=null, "su2.nick_name", bo.getWorkerNickName());
@@ -209,11 +155,19 @@ public class SysOaTaskServiceImpl implements ISysOaTaskService {
*/
@Override
public Boolean insertByBo(SysOaTaskBo bo) {
List<Long> workerIdList = new ArrayList<>();
// 拿到所有的执行人id列表进行遍历添加
List<Long> workerIdList = Arrays.stream( bo.getWorkerIds().split(","))
.map(Long::valueOf)
.collect(Collectors.toList());
if (bo.getWorkerId()!=null) {
workerIdList = Arrays.stream( bo.getWorkerIds().split(","))
.map(Long::valueOf)
.collect(Collectors.toList());
}else{
bo.setBeginTime(new Date());
bo.setCompletedTime(new Date());
bo.setFinishTime(new Date());
workerIdList.add(LoginHelper.getUserId());
}
boolean flag = false;
for (Long workerId : workerIdList) {
if(Objects.nonNull(bo.getAccessory())){
@@ -221,8 +175,17 @@ public class SysOaTaskServiceImpl implements ISysOaTaskService {
.map(String::valueOf)
.collect(Collectors.toList());
String fileIds = fileService.insertFiles(fileUrls);
bo.setAccessory(fileIds);
}
if (Objects.nonNull(bo.getFiles())) {
List<String> fileUrls = Arrays.stream(bo.getFiles().split(","))
.map(String::valueOf)
.collect(Collectors.toList());
String fileIds = fileService.insertFiles(fileUrls);
bo.setFiles(fileIds);
}
SysOaTask add = BeanUtil.toBean(bo, SysOaTask.class);
add.setCreateUserId(LoginHelper.getUserId());
validEntityBeforeSave(add);