From e33e5c68c1c6d51af8a1fb0dc262276e9058980f Mon Sep 17 00:00:00 2001
From: weicd <weicd@yhzhg.cn>
Date: Tue, 31 Jan 2023 03:44:48 +0000
Subject: [PATCH] 新增用户选择公司,修正
---
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/task/service/impl/TaskServiceImpl.java | 19 ++++++++++++++-----
1 files changed, 14 insertions(+), 5 deletions(-)
diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/task/service/impl/TaskServiceImpl.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/task/service/impl/TaskServiceImpl.java
index 4d2f8ce..c82c118 100644
--- a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/task/service/impl/TaskServiceImpl.java
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/task/service/impl/TaskServiceImpl.java
@@ -15,12 +15,14 @@
*/
package me.zhengjie.modules.task.service.impl;
+import me.zhengjie.exception.BadRequestException;
import me.zhengjie.modules.constant.Constant;
import me.zhengjie.modules.project.domain.Project;
import me.zhengjie.modules.project.repository.ProjectRepository;
import me.zhengjie.modules.system.repository.DictDetailRepository;
import me.zhengjie.modules.task.domain.Task;
import me.zhengjie.modules.task.domain.TaskDaliy;
+import me.zhengjie.modules.task.domain.TaskUser;
import me.zhengjie.modules.task.repository.TaskDaliyRepository;
import me.zhengjie.modules.task.repository.TaskUserRepository;
import me.zhengjie.utils.*;
@@ -35,12 +37,11 @@
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
import java.io.IOException;
+import java.math.BigDecimal;
+
import javax.servlet.http.HttpServletResponse;
-import java.util.ArrayList;
-import java.util.LinkedHashMap;
import java.util.function.Function;
/**
@@ -124,7 +125,7 @@
// 最大任务进度日报信息
Map taskDaliyMap = taskDaliyMapList.get(i);
// 已完成工时
- completedHours += Double.valueOf(taskDaliyMap.get("task_hours").toString()) * (Double.valueOf(taskDaliyMap.get("task_progress").toString()) / 100);
+ completedHours += new BigDecimal(taskDaliyMap.get("task_hours").toString()).multiply(new BigDecimal(taskDaliyMap.get("task_progress").toString())).doubleValue() / 100;
}
// 已完成工时
taskDto.setCompletedHours(completedHours);
@@ -182,6 +183,12 @@
@Override
public void deleteAll(Long[] ids) {
+ // 根据多任务ID查询任务分配列表
+ List<TaskUser> taskUserList = taskUserRepository.findByTaskIdIn(Arrays.asList(ids));
+ // 判断任务分配列表长度
+ if (taskUserList.size() > 0) {
+ throw new BadRequestException("已分配的任务无法删除!");
+ }
for (Long id : ids) {
taskRepository.deleteById(id);
}
@@ -196,6 +203,7 @@
String priority = task.getPriority() != null ? dictDetailRepository.findByDictNameAndValue(Constant.PRIORITY, task.getPriority()).getLabel() : "";
String taskClassification = task.getTaskClassification() != null ? dictDetailRepository.findByDictNameAndValue(Constant.TASK_CLASSIFICATION, task.getTaskClassification()).getLabel() : "";
String planWorkloadUnit = task.getPlanWorkloadUnit() != null ? dictDetailRepository.findByDictNameAndValue(Constant.STANDARD_WORKLOAD_UNIT, task.getPlanWorkloadUnit()).getLabel() : "";
+ String taskStatus = task.getTaskStatus() != null ? dictDetailRepository.findByDictNameAndValue(Constant.TASK_STATUS, task.getTaskStatus()).getLabel() : "";
Map<String,Object> map = new LinkedHashMap<>();
map.put("项目名称", projectName);
map.put("父任务名称", pidName);
@@ -208,6 +216,7 @@
map.put("计划工时", task.getPlanHours());
map.put("计划工作量", task.getPlanWorkload());
map.put("计划工作量单位", planWorkloadUnit);
+ map.put("任务状态", taskStatus);
map.put("备注", task.getRemarks());
map.put("创建者", task.getCreateBy());
map.put("创建时间", task.getCreateTime());
--
Gitblit v1.9.3