Merge remote-tracking branch 'origin/master'
commit
22d2763360
|
@ -20,6 +20,7 @@ import org.springframework.stereotype.Service;
|
|||
import org.springframework.transaction.annotation.Isolation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.*;
|
||||
|
@ -125,7 +126,28 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements IT
|
|||
if (projectGroupService.getProjectAccessLevel(token, projectId) == 0) {
|
||||
throw new ForbiddenException(IProjectGroupService.UNABLE_TO_ACCESS_PROJECT);
|
||||
}
|
||||
return baseMapper.selectProjectProcessOfStaff(projectId, staffId);
|
||||
List<StaffProcessDTO> resList = baseMapper.selectProjectProcessOfStaff(projectId, staffId);
|
||||
addResultProjectProcess(resList, Task.TYPE_ASSIGNMENT);
|
||||
addResultProjectProcess(resList, Task.TYPE_DEFECT);
|
||||
addResultProjectProcess(resList, Task.TYPE_DEMAND);
|
||||
return resList;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private void addResultProjectProcess(List<StaffProcessDTO> resList, String projectType) {
|
||||
Boolean typeExist = false;
|
||||
for(StaffProcessDTO staffProcessDTO: resList) {
|
||||
if(Objects.equals(staffProcessDTO.getTaskType(), projectType)) {
|
||||
typeExist = true;
|
||||
}
|
||||
}
|
||||
if(!typeExist) {
|
||||
StaffProcessDTO staffProcessDTO = new StaffProcessDTO();
|
||||
staffProcessDTO.setTaskType(projectType);
|
||||
staffProcessDTO.setCompleteNum(0L);
|
||||
staffProcessDTO.setTotalNum(0L);
|
||||
resList.add(staffProcessDTO);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -33,20 +33,17 @@
|
|||
</select>
|
||||
<select id="selectProjectProcessOfStaff"
|
||||
resultType="cn.edu.hfut.rmdjzz.projectmanagement.entity.dto.StaffProcessDTO">
|
||||
SELECT t2.task_type,
|
||||
IF(complete_num IS NULL, 0, complete_num) AS complete_num,
|
||||
IF(total_num IS NULL, 0, total_num) AS total_num
|
||||
FROM (SELECT task_type,
|
||||
SELECT task_type,
|
||||
SUM(IF(task_status = '已完成' OR task_status = '关闭', 1, 0)) AS complete_num,
|
||||
COUNT(task_status) AS total_num
|
||||
FROM task
|
||||
WHERE is_deleted = false
|
||||
AND task_project_id != 0
|
||||
AND task_project_id = #{projectId}
|
||||
<if test="staffId != null">AND task_holder_id = #{staffId}</if>
|
||||
GROUP BY task_type) AS t1
|
||||
RIGHT JOIN (SELECT DISTINCT task_type FROM task) AS t2
|
||||
ON t1.task_type = t2.task_type
|
||||
<if test="staffId != null">
|
||||
AND task_holder_id = #{staffId}
|
||||
</if>
|
||||
GROUP BY task_type
|
||||
</select>
|
||||
<select id="selectTaskClosedNum" resultType="cn.edu.hfut.rmdjzz.projectmanagement.entity.dto.TaskTrendDTO">
|
||||
SELECT closed_date AS task_date,
|
||||
|
|
Loading…
Reference in New Issue