Compare commits
No commits in common. "f715834af718bef29af41bb7a59042360e96caaf" and "434ad8f57b7ee82189e696437d2e0eb7d37e832d" have entirely different histories.
f715834af7
...
434ad8f57b
|
@ -95,13 +95,4 @@ public class ProjectController {
|
|||
projectService.updateProject(token, project);
|
||||
return ResponseMap.ofSuccess("操作成功");
|
||||
}
|
||||
|
||||
@SneakyThrows
|
||||
@GetMapping("/{projectId}/stats")
|
||||
public ResponseMap getProjectProcess(
|
||||
@RequestHeader("Token") String token,
|
||||
@PathVariable Integer projectId
|
||||
) {
|
||||
return ResponseMap.ofSuccess("查询成功", projectService.getProjectProcess(token, projectId));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,11 +2,8 @@ package cn.edu.hfut.rmdjzz.projectmanagement.controller;
|
|||
|
||||
import cn.edu.hfut.rmdjzz.projectmanagement.entity.ProjectGroup;
|
||||
import cn.edu.hfut.rmdjzz.projectmanagement.entity.vo.GroupPositionVo;
|
||||
import cn.edu.hfut.rmdjzz.projectmanagement.exception.BadRequestException;
|
||||
import cn.edu.hfut.rmdjzz.projectmanagement.exception.ForbiddenException;
|
||||
import cn.edu.hfut.rmdjzz.projectmanagement.service.IProjectGroupService;
|
||||
import cn.edu.hfut.rmdjzz.projectmanagement.service.ITaskService;
|
||||
import cn.edu.hfut.rmdjzz.projectmanagement.utils.TokenUtils;
|
||||
import cn.edu.hfut.rmdjzz.projectmanagement.utils.http.ResponseList;
|
||||
import cn.edu.hfut.rmdjzz.projectmanagement.utils.http.ResponseMap;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
|
@ -28,9 +25,6 @@ public class ProjectGroupController {
|
|||
@Autowired
|
||||
private IProjectGroupService projectGroupService;
|
||||
|
||||
@Autowired
|
||||
private ITaskService taskService;
|
||||
|
||||
@SneakyThrows
|
||||
@GetMapping
|
||||
public ResponseList<Integer> getGroupNumber(@PathVariable Integer projectId, @RequestHeader("Token") String token) {
|
||||
|
@ -89,17 +83,4 @@ public class ProjectGroupController {
|
|||
) {
|
||||
return ResponseMap.ofSuccess("统计成功", projectGroupService.collectStatsForGroupPositions(token, projectId));
|
||||
}
|
||||
|
||||
@SneakyThrows
|
||||
@GetMapping("/{staffId}/stats")
|
||||
public ResponseList getProjectProcessOfStaff(
|
||||
@RequestHeader("Token") String token,
|
||||
@PathVariable Integer projectId,
|
||||
@PathVariable Integer staffId
|
||||
) {
|
||||
if(TokenUtils.getStaffId(token) != staffId) {
|
||||
throw new BadRequestException("错误请求");
|
||||
}
|
||||
return ResponseList.ofSuccess("查询成功", taskService.getProjectProcessOfStaff(token, projectId));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -47,7 +47,7 @@ public class Project {
|
|||
private LocalDateTime projectCreatedTime;
|
||||
private LocalDate projectClosedDate;
|
||||
|
||||
public Boolean checkProjectDate() {
|
||||
Boolean checkProjectDate() {
|
||||
if(!TimeUtils.validateTimeLine(projectStartDate, projectFirstTestDate, projectFinalTestDate, projectEndDate)) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -2,12 +2,10 @@ package cn.edu.hfut.rmdjzz.projectmanagement.mapper;
|
|||
|
||||
import cn.edu.hfut.rmdjzz.projectmanagement.entity.Project;
|
||||
import cn.edu.hfut.rmdjzz.projectmanagement.entity.dto.ProjectDto;
|
||||
import cn.edu.hfut.rmdjzz.projectmanagement.entity.dto.ProjectProcessDto;
|
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Constants;
|
||||
import io.swagger.v3.oas.models.security.SecurityScheme;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
|
@ -19,11 +17,9 @@ public interface ProjectMapper extends BaseMapper<Project> {
|
|||
|
||||
@Select("""
|
||||
SELECT COUNT(*) FROM project WHERE project_id IN
|
||||
(SELECT DISTINCT project_id FROM project_group WHERE staff_id = #{staffId})
|
||||
(SELECT DISTINCT project_id FROM project_group WHERE staff_id = #{id})
|
||||
""")
|
||||
Long findProjectCount(@Param("staffId") Integer staffId);
|
||||
Long findProjectCount(@Param("id") Integer staffId);
|
||||
|
||||
ProjectProcessDto findProjectProcess(@Param("projectId") Integer projectId);
|
||||
|
||||
IPage<ProjectDto> findMyProject(IPage<ProjectDto> pg, @Param("staffId") Integer staff_id, @Param(Constants.WRAPPER) Wrapper<Project> wrapper);
|
||||
IPage<ProjectDto> findMyProject(IPage<ProjectDto> pg, @Param("id") Integer staff_id, @Param(Constants.WRAPPER) Wrapper<Project> wrapper);
|
||||
}
|
||||
|
|
|
@ -2,7 +2,6 @@ package cn.edu.hfut.rmdjzz.projectmanagement.mapper;
|
|||
|
||||
import cn.edu.hfut.rmdjzz.projectmanagement.entity.Task;
|
||||
import cn.edu.hfut.rmdjzz.projectmanagement.entity.dto.TaskDto;
|
||||
import cn.edu.hfut.rmdjzz.projectmanagement.entity.dto.StaffProcessDto;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
|
@ -14,6 +13,4 @@ import java.util.List;
|
|||
*/
|
||||
public interface TaskMapper extends BaseMapper<Task> {
|
||||
List<TaskDto> selectSubTaskList(@Param("projectId") Integer projectId, @Param("fatherId") Long fatherId);
|
||||
|
||||
List<StaffProcessDto> selectProjectProcessOfStaff(@Param("projectId") Integer projectId, @Param("staffId") Integer staffId);
|
||||
}
|
||||
|
|
|
@ -2,9 +2,7 @@ package cn.edu.hfut.rmdjzz.projectmanagement.service;
|
|||
|
||||
import cn.edu.hfut.rmdjzz.projectmanagement.entity.Project;
|
||||
import cn.edu.hfut.rmdjzz.projectmanagement.entity.dto.ProjectDto;
|
||||
import cn.edu.hfut.rmdjzz.projectmanagement.entity.dto.ProjectProcessDto;
|
||||
import cn.edu.hfut.rmdjzz.projectmanagement.exception.BadRequestException;
|
||||
import cn.edu.hfut.rmdjzz.projectmanagement.exception.ForbiddenException;
|
||||
import cn.edu.hfut.rmdjzz.projectmanagement.utils.http.RequestPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
@ -19,8 +17,6 @@ public interface IProjectService extends IService<Project> {
|
|||
|
||||
Long getAllProjectOfStaff(String token);
|
||||
|
||||
ProjectProcessDto getProjectProcess(String token, Integer projectId) throws ForbiddenException;
|
||||
|
||||
Page<ProjectDto> getOnePageProject(String token, RequestPage page, Map<String, Object> params);
|
||||
|
||||
Boolean setProjectCompleted(String token, Integer projectId) throws BadRequestException;
|
||||
|
|
|
@ -2,7 +2,6 @@ package cn.edu.hfut.rmdjzz.projectmanagement.service;
|
|||
|
||||
import cn.edu.hfut.rmdjzz.projectmanagement.entity.Task;
|
||||
import cn.edu.hfut.rmdjzz.projectmanagement.entity.dto.TaskDto;
|
||||
import cn.edu.hfut.rmdjzz.projectmanagement.entity.dto.StaffProcessDto;
|
||||
import cn.edu.hfut.rmdjzz.projectmanagement.exception.BadRequestException;
|
||||
import cn.edu.hfut.rmdjzz.projectmanagement.exception.ForbiddenException;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
@ -22,8 +21,6 @@ public interface ITaskService extends IService<Task> {
|
|||
|
||||
Boolean closeTaskAndSubTask(String token, Integer projectId, Long taskId) throws BadRequestException;
|
||||
|
||||
List<StaffProcessDto> getProjectProcessOfStaff(String token, Integer projectId) throws BadRequestException, ForbiddenException;
|
||||
|
||||
/**
|
||||
* @return 1:all rights 2:father holder 3:current holder 0:no right
|
||||
*/
|
||||
|
|
|
@ -2,9 +2,7 @@ package cn.edu.hfut.rmdjzz.projectmanagement.service.impl;
|
|||
|
||||
import cn.edu.hfut.rmdjzz.projectmanagement.entity.Project;
|
||||
import cn.edu.hfut.rmdjzz.projectmanagement.entity.dto.ProjectDto;
|
||||
import cn.edu.hfut.rmdjzz.projectmanagement.entity.dto.ProjectProcessDto;
|
||||
import cn.edu.hfut.rmdjzz.projectmanagement.exception.BadRequestException;
|
||||
import cn.edu.hfut.rmdjzz.projectmanagement.exception.ForbiddenException;
|
||||
import cn.edu.hfut.rmdjzz.projectmanagement.mapper.ProjectMapper;
|
||||
import cn.edu.hfut.rmdjzz.projectmanagement.service.IProjectGroupService;
|
||||
import cn.edu.hfut.rmdjzz.projectmanagement.service.IProjectService;
|
||||
|
@ -38,14 +36,6 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|||
return baseMapper.findProjectCount(staffId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ProjectProcessDto getProjectProcess(String token, Integer projectId) throws ForbiddenException {
|
||||
if(projectGroupService.getProjectAccessLevel(token, projectId) == 0) {
|
||||
throw new ForbiddenException("无查看权限");
|
||||
}
|
||||
return baseMapper.findProjectProcess(projectId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<ProjectDto> getOnePageProject(
|
||||
String token,
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package cn.edu.hfut.rmdjzz.projectmanagement.service.impl;
|
||||
|
||||
import cn.edu.hfut.rmdjzz.projectmanagement.entity.Task;
|
||||
import cn.edu.hfut.rmdjzz.projectmanagement.entity.dto.StaffProcessDto;
|
||||
import cn.edu.hfut.rmdjzz.projectmanagement.entity.dto.TaskDto;
|
||||
import cn.edu.hfut.rmdjzz.projectmanagement.exception.BadRequestException;
|
||||
import cn.edu.hfut.rmdjzz.projectmanagement.exception.ForbiddenException;
|
||||
|
@ -113,15 +112,6 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements IT
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<StaffProcessDto> getProjectProcessOfStaff(String token, Integer projectId) throws BadRequestException, ForbiddenException {
|
||||
Integer staffId = TokenUtils.getStaffId(token);
|
||||
if(projectGroupService.getProjectAccessLevel(token, projectId) == 0) {
|
||||
throw new ForbiddenException("无查看权限");
|
||||
}
|
||||
return baseMapper.selectProjectProcessOfStaff(projectId, staffId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer getHolderLevel(Integer staffId, Long taskId) {
|
||||
try {
|
||||
|
|
|
@ -14,37 +14,15 @@
|
|||
contract_amount,
|
||||
project_importance,
|
||||
project_creator,
|
||||
pt1.project_class_name AS project_class_name,
|
||||
pt2.project_class_name AS project_subclass_name,
|
||||
pt1.project_class_name AS project_class_name,
|
||||
pt2.project_class_name AS project_subclass_name,
|
||||
is_completed,
|
||||
is_deleted,
|
||||
project_closed_date,
|
||||
IF(complete_num IS NULL, 0, complete_num) AS complete_num,
|
||||
IF(total_num IS NULL, 0, total_num) AS total_num
|
||||
project_closed_date
|
||||
FROM project
|
||||
JOIN project_type pt1 ON project.project_class_id = pt1.project_class_id
|
||||
JOIN project_type pt2 ON project.project_subclass_id = pt2.project_class_id
|
||||
LEFT JOIN (SELECT task_project_id,
|
||||
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
|
||||
GROUP BY task_project_id) AS t
|
||||
ON project.project_id = t.task_project_id
|
||||
WHERE project_id IN (SELECT DISTINCT project_id FROM project_group WHERE staff_id = #{staffId})
|
||||
AND is_deleted = false) AS T
|
||||
WHERE project_id IN (SELECT DISTINCT project_id FROM project_group WHERE staff_id = #{id})) AS T
|
||||
${ew.customSqlSegment}
|
||||
</select>
|
||||
<select id="findProjectProcess" resultType="cn.edu.hfut.rmdjzz.projectmanagement.entity.dto.ProjectProcessDto">
|
||||
SELECT #{projectId} AS project_id,
|
||||
IF(complete_num IS NULL, 0, complete_num) AS complete_num,
|
||||
total_num
|
||||
FROM (SELECT 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}) AS T;
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
@ -25,21 +25,4 @@
|
|||
AND task_project_id = #{projectId}
|
||||
AND t.task_father_id = #{fatherId}
|
||||
</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,
|
||||
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
|
||||
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
Loading…
Reference in New Issue