From f00a793327da566a519a5cab63a04869e7f0bc5d Mon Sep 17 00:00:00 2001
From: weicd <weicd@yhzhg.cn>
Date: Wed, 27 Dec 2023 08:14:30 +0000
Subject: [PATCH] 首页统计图和绩效时长不统一
---
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/task/service/impl/TaskDaliyServiceImpl.java | 31 +++++++++++++++++++++++--------
1 files changed, 23 insertions(+), 8 deletions(-)
diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/task/service/impl/TaskDaliyServiceImpl.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/task/service/impl/TaskDaliyServiceImpl.java
index 10bb4d6..834bb8c 100644
--- a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/task/service/impl/TaskDaliyServiceImpl.java
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/task/service/impl/TaskDaliyServiceImpl.java
@@ -15,6 +15,7 @@
*/
package me.zhengjie.modules.task.service.impl;
+import java.math.BigDecimal;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
@@ -217,7 +218,11 @@
mongoTemplate.save(resources);
TaskUserMongo byId = mongoTemplate.findById(resources.getTaskUserMongo().getId(), TaskUserMongo.class);
byId.setCostHours(resources.getConsumedHours());
- byId.setTaskStatus("task_status_in_hand");
+ if (resources.getTaskProgress().equals(100.0)){
+ byId.setTaskStatus("task_status_unrecognized");
+ } else {
+ byId.setTaskStatus("task_status_in_hand");
+ }
mongoTemplate.save(byId);
return null;
} else {
@@ -227,7 +232,11 @@
//这天没填写过日报
//check(resources, taskUserMongoList);
TaskUserMongo byId = mongoTemplate.findById(resources.getTaskUserMongo().getId(), TaskUserMongo.class);
- byId.setTaskStatus("task_status_in_hand");
+ if (resources.getTaskProgress().equals(100.0)){
+ byId.setTaskStatus("task_status_unrecognized");
+ } else {
+ byId.setTaskStatus("task_status_in_hand");
+ }
byId.setCostHours(byId.getCostHours() + resources.getConsumedHours());
mongoTemplate.save(byId);
mongoTemplate.save(resources);
@@ -241,7 +250,11 @@
// taskDaliyMongo.setConsumedHours(resources.getConsumedHours());
TaskUserMongo byId = mongoTemplate.findById(resources.getTaskUserMongo().getId(), TaskUserMongo.class);
- byId.setTaskStatus("task_status_in_hand");
+ if (resources.getTaskProgress().equals(100.0)){
+ byId.setTaskStatus("task_status_unrecognized");
+ } else {
+ byId.setTaskStatus("task_status_in_hand");
+ }
byId.setCostHours(byId.getCostHours() - taskDaliyMongo.getConsumedHours() + resources.getConsumedHours());
mongoTemplate.save(byId);
@@ -314,7 +327,7 @@
TaskDaliy previousTaskDaliy = taskDaliyRepository.findPreviousByProjectIdAndTaskIdAndAndUserId(resources.getProjectId(), resources.getTaskId(), resources.getUserId(), resources.getFillDate());
if (previousTaskDaliy != null) {
TaskUser previousTaskUser = taskUserRepository.findByTaskIdAndTaskInnerIdAndUserId(previousTaskDaliy.getTaskId(), previousTaskDaliy.getTaskInnerId(), previousTaskDaliy.getUserId());
- if (previousTaskUser != null && resources.getTaskProgress() * currentTaskUser.getTaskHours() < previousTaskDaliy.getTaskProgress() * previousTaskUser.getTaskHours()) {
+ if (previousTaskUser != null && new BigDecimal(resources.getTaskProgress() * currentTaskUser.getTaskHours()).compareTo(new BigDecimal(previousTaskDaliy.getTaskProgress() * previousTaskUser.getTaskHours())) < 0) {
throw new BadRequestException("任务进度必须比前一次多且比后一次少!");
}
}
@@ -325,7 +338,7 @@
// 后日任务分配
TaskUser nextTaskUser = taskUserRepository.findByTaskIdAndTaskInnerIdAndUserId(nextTaskDaliy.getTaskId(), nextTaskDaliy.getTaskInnerId(), nextTaskDaliy.getUserId());
// 判断任务进度是否比前一次多,比后一次少
- if (nextTaskUser != null && resources.getTaskProgress() * currentTaskUser.getTaskHours() > nextTaskDaliy.getTaskProgress() * nextTaskUser.getTaskHours()) {
+ if (nextTaskUser != null && new BigDecimal(resources.getTaskProgress() * currentTaskUser.getTaskHours()).compareTo(new BigDecimal(nextTaskDaliy.getTaskProgress() * nextTaskUser.getTaskHours())) > 0) {
throw new BadRequestException("任务进度必须比前一次多且比后一次少!");
}
}
@@ -449,8 +462,10 @@
throw new BadRequestException("任务日报进度计算存在异常!");
}
// 判断进度是否正常
- if (taskDaliyDay.getConsumedWorkload() < taskDaliyHistory.getConsumedWorkload()) {
- throw new BadRequestException("任务日报进度计算存在异常!");
+ if (taskDaliyDay.getConsumedWorkload() != null && taskDaliyHistory.getConsumedWorkload() != null) {
+ if (taskDaliyDay.getConsumedWorkload() < taskDaliyHistory.getConsumedWorkload()) {
+ throw new BadRequestException("任务日报进度计算存在异常!");
+ }
}
// 本日任务日报进度
//completedWork += task.getPieceRate() * (taskDaliyDay.getConsumedWorkload() - taskDaliyHistory.getConsumedWorkload());
@@ -481,7 +496,7 @@
Date dt = sdf.parse(criteria.getTargetYearMonth());
Calendar cal = Calendar.getInstance();
cal.setTime(dt);
- cal.add(Calendar.MONTH,1);
+ cal.add(Calendar.MONTH, 1);
Date nextMonth = cal.getTime();
// daliyMongoList = mongoTemplate.find(Query.query(new Criteria("userId").is(criteria.getUserId()).and("fillDate").gte(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(criteria.getTargetYearMonth())).lte(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(nextMonth)))), TaskDaliyMongo.class);
daliyMongoList = mongoTemplate.find(Query.query(new Criteria("userId").is(criteria.getUserId()).and("fillDate").gte(dt).lte(nextMonth)), TaskDaliyMongo.class);
--
Gitblit v1.9.3