| | |
| | | */ |
| | | package me.zhengjie.modules.project.service.impl; |
| | | |
| | | import java.io.IOException; |
| | | import java.sql.Timestamp; |
| | | import java.text.SimpleDateFormat; |
| | | import java.time.LocalDate; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.LinkedHashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Map.Entry; |
| | | import java.util.function.Function; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | import me.zhengjie.exception.BadRequestException; |
| | | import me.zhengjie.modules.attendance.domain.AttendanceBusinessTravel; |
| | | import me.zhengjie.modules.attendance.service.dto.AttendanceBusinessTravelDto; |
| | | import me.zhengjie.modules.project.domain.Project; |
| | | import me.zhengjie.modules.project.repository.ProjectRepository; |
| | | import me.zhengjie.modules.system.domain.SysConfigProportion; |
| | | import me.zhengjie.modules.system.domain.User; |
| | | import org.apache.commons.lang3.ObjectUtils; |
| | | import org.springframework.data.domain.Page; |
| | | import org.springframework.data.domain.Pageable; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import lombok.RequiredArgsConstructor; |
| | | import me.zhengjie.modules.project.domain.Project; |
| | | import me.zhengjie.modules.project.domain.ProjectPerformance; |
| | | import me.zhengjie.modules.project.domain.ProjectPerformanceDetail; |
| | | import me.zhengjie.modules.project.repository.ProjectPerformanceDetailRepository; |
| | | import me.zhengjie.modules.project.repository.ProjectPerformanceRepository; |
| | | import me.zhengjie.modules.project.repository.ProjectRepository; |
| | | import me.zhengjie.modules.project.service.ProjectPerformanceService; |
| | | import me.zhengjie.modules.project.service.dto.ProjectPerformanceDto; |
| | | import me.zhengjie.modules.project.service.dto.ProjectPerformanceQueryCriteria; |
| | | import me.zhengjie.modules.project.service.mapstruct.ProjectPerformanceMapper; |
| | | import me.zhengjie.modules.system.service.UserService; |
| | | import me.zhengjie.modules.system.service.dto.UserQueryCriteria; |
| | | import me.zhengjie.modules.task.domain.TaskDailyInterface; |
| | | import me.zhengjie.modules.task.domain.TaskUser; |
| | | import me.zhengjie.modules.task.repository.TaskDaliyRepository; |
| | | import me.zhengjie.modules.task.repository.TaskUserRepository; |
| | | import me.zhengjie.modules.task.service.TaskDaliyService; |
| | | import me.zhengjie.utils.FileUtil; |
| | | import me.zhengjie.utils.PageUtil; |
| | | import me.zhengjie.utils.QueryHelp; |
| | | import me.zhengjie.utils.ValidationUtil; |
| | | import org.springframework.data.domain.Page; |
| | | import org.springframework.data.domain.Pageable; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | import java.util.Map.Entry; |
| | | import java.util.function.Function; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | |
| | | private final TaskUserRepository taskUserRepository; |
| | | private final ProjectPerformanceDetailRepository projectPerformanceDetailRepository; |
| | | private final ProjectRepository projectRepository; |
| | | |
| | | private final UserService userService; |
| | | private final TaskDaliyService taskDaliyService; |
| | | |
| | | private final MongoTemplate mongoTemplate; |
| | | |
| | | @Override |
| | | public Map<String,Object> queryAll(ProjectPerformanceQueryCriteria criteria, Pageable pageable){ |
| | |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void generalProjectPerformance(ProjectPerformanceQueryCriteria criteria) { |
| | | UserQueryCriteria userQueryCriteria = new UserQueryCriteria(); |
| | | userQueryCriteria.setEnabled(true); |
| | | userService.queryAll(userQueryCriteria); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public ProjectPerformanceDto create(ProjectPerformance resources) { |
| | | |
| | | List<TaskDailyInterface> taskDailyInterfaceList = taskDaliyRepository.collectCostByProjectIdAndFillDateLessThanGroupUserAndTaskId(resources.getProjectId(), resources.getEndDate()); |
| | | Map<Long, Double> userPerformanceMap = new HashMap<Long, Double>(); |
| | | for (TaskDailyInterface taskDailyInterface : taskDailyInterfaceList) { |
| | | TaskUser taskUser = taskUserRepository.findByTaskIdAndTaskInnerIdAndUserId(taskDailyInterface.getTaskId(), taskDailyInterface.getTaskInnerId(), taskDailyInterface.getUserId()); |
| | | userPerformanceMap.put(taskDailyInterface.getUserId(), userPerformanceMap.getOrDefault(taskDailyInterface.getUserId(), 0.0) + (taskUser.getTaskHours() * taskDailyInterface.getTaskProgress() / 100)); |
| | | //TaskUser taskUser = taskUserRepository.findByTaskIdAndTaskInnerIdAndUserId(taskDailyInterface.getTaskId(), taskDailyInterface.getTaskInnerId(), taskDailyInterface.getUserId()); |
| | | //userPerformanceMap.put(taskDailyInterface.getUserId(), userPerformanceMap.getOrDefault(taskDailyInterface.getUserId(), 0.0) + (taskUser.getTaskHours() * taskDailyInterface.getTaskProgress() / 100)); |
| | | } |
| | | |
| | | // 绩效登录 |