Compare commits

..

No commits in common. "056a5ee8f720605b1eeff904b4195cbd3f4cab2f" and "6a37f2387eb5342f87395efcb02cd681e6da1db0" have entirely different histories.

4 changed files with 32 additions and 11 deletions

View File

@ -20,6 +20,8 @@ import java.util.List;
public interface TaskMapper extends BaseMapper<Task> { public interface TaskMapper extends BaseMapper<Task> {
List<TaskDTO> selectTaskList(@Param(Constants.WRAPPER) Wrapper<Task> wrapper); List<TaskDTO> selectTaskList(@Param(Constants.WRAPPER) Wrapper<Task> wrapper);
List<TaskDTO> selectSubTaskList(@Param("projectId") Integer projectId, @Param("fatherId") Long fatherId);
List<StaffProcessDTO> selectProjectProcess(@Param("projectId") Integer projectId, @Param("staffId") Integer staffId); List<StaffProcessDTO> selectProjectProcess(@Param("projectId") Integer projectId, @Param("staffId") Integer staffId);
List<TaskTrendDTO> selectClosedTaskTrendBeforeDate(@Param("projectId") Integer projectId, @Param("startDate") LocalDate startDate); List<TaskTrendDTO> selectClosedTaskTrendBeforeDate(@Param("projectId") Integer projectId, @Param("startDate") LocalDate startDate);

View File

@ -93,13 +93,12 @@ public class ProjectGroupServiceImpl extends ServiceImpl<ProjectGroupMapper, Pro
@Override @Override
public Boolean updateStaffPositions(String token, Integer projectId, Integer targetId, String positions) throws ForbiddenException { public Boolean updateStaffPositions(String token, Integer projectId, Integer targetId, String positions) throws ForbiddenException {
int accessLevel = getProjectAccessLevel(token, projectId); int accessLevel = getProjectAccessLevel(token, projectId);
int originTargetLevel = getProjectAccessLevelIgnoreGlobalLevel(targetId, projectId); int targetLevel = getProjectAccessLevel(targetId, 2, projectId); //假定目标的全局level为2防止get时出现问题
int targetLevel = 3;
if (accessLevel == 0) { if (accessLevel == 0) {
throw new ForbiddenException(IProjectGroupService.UNABLE_TO_ACCESS_PROJECT); throw new ForbiddenException(IProjectGroupService.UNABLE_TO_ACCESS_PROJECT);
} }
if (accessLevel > 2 || accessLevel >= originTargetLevel) { if (accessLevel > 2 || accessLevel >= targetLevel) {
throw new ForbiddenException(ForbiddenException.UNABLE_TO_OPERATE); throw new ForbiddenException(ForbiddenException.UNABLE_TO_OPERATE);
} }
String[] positionArray = positions.split(","); String[] positionArray = positions.split(",");

View File

@ -45,10 +45,7 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements IT
if (fatherId == null) { if (fatherId == null) {
throw new BadRequestException(BadRequestException.WRONG_PARAMETERS); throw new BadRequestException(BadRequestException.WRONG_PARAMETERS);
} }
return baseMapper.selectTaskList(Wrappers.<Task>lambdaQuery() return baseMapper.selectSubTaskList(projectId, fatherId);
.eq(Task::getTaskProjectId, projectId)
.eq(Task::getTaskFatherId, fatherId)
.eq(Task::getDeleted, false));
} }
@Override @Override
@ -135,7 +132,7 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements IT
@Override @Override
public List<StaffProcessDTO> getProjectStatistics(String token, Integer projectId, Integer staffId) throws ForbiddenException { public List<StaffProcessDTO> getProjectStatistics(String token, Integer projectId, Integer staffId) throws ForbiddenException {
if (staffId != null && !TokenUtils.getStaffId(token).equals(staffId)) { if(staffId != null && !TokenUtils.getStaffId(token).equals(staffId)) {
throw new ForbiddenException(IProjectGroupService.UNABLE_TO_ACCESS_PROJECT); throw new ForbiddenException(IProjectGroupService.UNABLE_TO_ACCESS_PROJECT);
} }
if (projectGroupService.getProjectAccessLevel(token, projectId) == 0) { if (projectGroupService.getProjectAccessLevel(token, projectId) == 0) {
@ -527,13 +524,13 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements IT
} }
@Override @Override
public Map<String, Long> getProjectProcessOfEveryone(String token, Integer projectId) throws ForbiddenException { public Map<String, Long> getProjectProcessOfEveryone(String token, Integer projectId) throws ForbiddenException{
if (projectGroupService.getProjectAccessLevel(token, projectId) == 0) { if(projectGroupService.getProjectAccessLevel(token, projectId) == 0) {
throw new ForbiddenException(IProjectGroupService.UNABLE_TO_ACCESS_PROJECT); throw new ForbiddenException(IProjectGroupService.UNABLE_TO_ACCESS_PROJECT);
} }
Map<String, Long> resMap = new HashMap<>(); Map<String, Long> resMap = new HashMap<>();
List<TaskNumOfEveryoneDTO> resList = baseMapper.selectProjectProcessOfEveryone(projectId); List<TaskNumOfEveryoneDTO> resList = baseMapper.selectProjectProcessOfEveryone(projectId);
for (TaskNumOfEveryoneDTO taskNumOfEveryoneDTO : resList) { for(TaskNumOfEveryoneDTO taskNumOfEveryoneDTO: resList) {
resMap.put(taskNumOfEveryoneDTO.getStaffFullname(), taskNumOfEveryoneDTO.getCompletedNum()); resMap.put(taskNumOfEveryoneDTO.getStaffFullname(), taskNumOfEveryoneDTO.getCompletedNum());
} }
return resMap; return resMap;

View File

@ -27,6 +27,29 @@
JOIN (SELECT staff_id, staff_fullname FROM staff) AS s ON t.task_holder_id = s.staff_id JOIN (SELECT staff_id, staff_fullname FROM staff) AS s ON t.task_holder_id = s.staff_id
${ew.customSqlSegment} ${ew.customSqlSegment}
</select> </select>
<select id="selectSubTaskList" resultMap="taskDto">
SELECT task_id,
task_name,
task_project_id,
task_holder_id,
s.staff_fullname AS task_holder_name,
task_status,
task_type,
t.task_father_id,
task_created_time,
task_start_time,
task_end_time,
task_closed_time,
task_priority,
task_description,
attached_info,
children_count
FROM task AS t
JOIN (SELECT staff_id, staff_fullname FROM staff) AS s ON t.task_holder_id = s.staff_id
WHERE is_deleted = 0
AND task_project_id = #{projectId}
AND t.task_father_id = #{fatherId}
</select>
<select id="selectProjectProcess" <select id="selectProjectProcess"
resultType="cn.edu.hfut.rmdjzz.projectmanagement.entity.dto.StaffProcessDTO"> resultType="cn.edu.hfut.rmdjzz.projectmanagement.entity.dto.StaffProcessDTO">
SELECT task_type, SELECT task_type,