Compare commits

...

3 Commits

Author SHA1 Message Date
xiangZr-hhh
3b9a7cfe5e feat:增加新业务功能获取我的审核
All checks were successful
代码检查 / 代码检查 (pull_request) Successful in 22s
2024-04-12 08:20:28 +08:00
5a57ea4b1c
patch: 数据表上传 2024-04-11 23:53:16 +08:00
383de6766f Merge pull request 'feat:增加新业务功能获取审核列表' (#10) from feature-zrx into develop
Reviewed-on: #10
Reviewed-by: 筱锋xiao_lfeng <gm@x-lf.cn>
2024-04-11 20:46:33 +08:00
7 changed files with 166 additions and 7 deletions

View File

@ -0,0 +1,23 @@
USE organize_oa;
create table oa_project_child
(
id bigint unsigned auto_increment comment '项目id'
primary key,
project_id bigint unsigned not null comment '主要项目id',
name varchar(100) not null comment '项目名称',
principal_id bigint unsigned not null comment '项目负责人',
description json null comment '项目描述(技术选择,描述)',
cycle int unsigned not null comment '项目周期',
work_load int unsigned default '1' not null comment '工作量(人天)',
files json null comment '子项目文件',
complete_time date null comment '完成时间',
created_at timestamp default CURRENT_TIMESTAMP not null comment '创建时间',
updated_at timestamp null comment '更新时间',
is_delete tinyint(1) default 0 not null comment '项目是否删除',
constraint oa_project_child_oa_user_id_fk
foreign key (principal_id) references oa_user (id)
on update cascade
)
comment '项目表';

View File

@ -0,0 +1,21 @@
USE organize_oa;
create table oa_project_modules
(
id bigint unsigned auto_increment comment '模块id'
primary key,
project_child_id bigint unsigned not null comment '子项目id',
name varchar(100) not null comment '模块名称',
principal_id bigint unsigned not null comment '模块负责人',
description json null comment '项目描述(技术选择,描述)',
work_load int unsigned default '1' not null comment '工作量(人天)',
complete_time datetime null comment '完成时间',
created_at timestamp default CURRENT_TIMESTAMP not null comment '创建时间',
updated_at timestamp null comment '更新时间',
is_delete tinyint(1) default 0 not null comment '项目是否删除',
constraint oa_project_modules_oa_user_id_fk
foreign key (principal_id) references oa_user (id)
on update cascade
)
comment '模块表';

View File

@ -0,0 +1,23 @@
package com.jsl.oa.common.constant;
/**
* <h1>Review常量类</h1>
* <hr/>
* 用于存放审核信息的审批状态常量
*
* @version v1.1.0
* @since v1.1.0
* @author zrx_hhh
*/
public class ReviewConstants {
public static final int NOT_APPROVED = 0;
public static final int APPROVED = 1;
public static final int PENDING = 2;
}

View File

@ -5,7 +5,6 @@ import com.jsl.oa.utils.BaseResponse;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
@ -26,16 +25,29 @@ public class ReviewController {
private final ReviewService reviewService;
/**
* @Description: 获取我的审核列表
* @Description: 获取审核记录列表
* @Date: 2024/4/11
* @Param request:
**/
@GetMapping("/review/getMyReview")
public BaseResponse getUserReview(@RequestParam Long projectId, HttpServletRequest request) {
@GetMapping("/review/getReviewRecords")
public BaseResponse getUserReviewRecords(HttpServletRequest request) {
log.info("请求接口[GET]: /review/getMyReview");
return reviewService.getUserReview(projectId, request);
return reviewService.getUserReview(request);
}
/**
* @Description: 获取我的审核数据
* @Date: 2024/4/12
* @Param request:
**/
@GetMapping("/review/getMyReview")
public BaseResponse getMyReview(HttpServletRequest request) {
log.info("请求接口[GET]: /review/getMyReview");
return reviewService.getUserPendingApprovalReview(request);
}
}

View File

@ -12,10 +12,19 @@ public interface ReviewMapper {
+ "AND is_delete = 0")
List<ReviewDO> selectAllReviewFromProject(Long projectId);
@Select("SELECT * FROM organize_oa.oa_review WHERE project_id = #{projectId}"
+ "AND is_delete = 0 AND review_result = #{result}")
List<ReviewDO> selectApprovedResultReviewFromProject(Long projectId, Integer result);
@Select("SELECT * FROM organize_oa.oa_review WHERE "
+ "project_subsystem_id = #{subsystemId} AND is_delete = 0")
List<ReviewDO> selectReviewFromSubsystem(Long subsystemId);
@Select("SELECT * FROM organize_oa.oa_review WHERE "
+ "project_subsystem_id = #{subsystemId} "
+ "AND is_delete = 0 AND review_result = #{result}")
List<ReviewDO> selectApprovedResultReviewsFromSubsystem(Long subsystemId, Integer result);
@Select("SELECT * FROM organize_oa.oa_review WHERE "
+ "project_submodule_id = #{subsystemId} AND is_delete = 0")
List<ReviewDO> selectReviewFromSubmodule(Long submoduleId);

View File

@ -7,6 +7,8 @@ import javax.servlet.http.HttpServletRequest;
public interface ReviewService {
BaseResponse getUserReview(Long projectId, HttpServletRequest request);
BaseResponse getUserPendingApprovalReview(HttpServletRequest request);
BaseResponse getUserReview(HttpServletRequest request);
}

View File

@ -1,6 +1,7 @@
package com.jsl.oa.services.impl;
import com.jsl.oa.common.constant.ReviewConstants;
import com.jsl.oa.dao.ProjectDAO;
import com.jsl.oa.dao.ReviewDAO;
import com.jsl.oa.dao.UserDAO;
@ -20,6 +21,8 @@ import org.springframework.stereotype.Service;
import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
@Slf4j
@ -36,7 +39,65 @@ public class ReviewServiceImpl implements ReviewService {
@Override
public BaseResponse getUserReview(Long projectId, HttpServletRequest request) {
public BaseResponse getUserPendingApprovalReview(HttpServletRequest request) {
log.info("\t> 执行 Service 层 ReviewService.getUserPendingApprovalReview 方法");
//获取用户
Long userId = Processing.getAuthHeaderToUserId(request);
//存储审核数据的数组
List<ReviewVO> reviewData = new ArrayList<>();
//先获取用户为项目负责人的项目列表
projectDAO.getProjectByPrincipalUser(userId);
//先从用户为 项目负责人 的项目中获取对应 审核信息
for (ProjectDO projectDO : projectDAO.getProjectByPrincipalUser(userId)) {
//查询每个项目下所有的审核信息
List<ReviewDO> reviewDOS = reviewMapper.
selectApprovedResultReviewFromProject(projectDO.getId(),
ReviewConstants.PENDING);
//封装VO类
reviewData.addAll(encapsulateArrayClass(reviewDOS));
}
//在从用户为 子系统负责人 的项目中获取对应 审核信息
for (ProjectWorkDO projectWorkDO : projectDAO.getAllSubsystemByUserId(userId)) {
//查询每个项目下状态为2的审核信息
List<ReviewDO> reviewDOS = reviewMapper.
selectApprovedResultReviewsFromSubsystem(projectWorkDO.getId(),
ReviewConstants.PENDING);
//封装VO类
reviewData.addAll(encapsulateArrayClass(reviewDOS));
}
//在从用户为 子模块负责人 的项目中获取对应 审核信息
for (ProjectWorkDO projectWorkDO : projectDAO.getAllSubmoduleByUserId(userId)) {
//查询每个项目下所有的审核信息
List<ReviewDO> reviewDOS = reviewMapper.
selectApprovedResultReviewsFromSubsystem(projectWorkDO.getId(),
ReviewConstants.PENDING);
//封装VO类
reviewData.addAll(encapsulateArrayClass(reviewDOS));
}
//按照申请时间降序排序
Collections.sort(reviewData, new Comparator<ReviewVO>() {
@Override
public int compare(ReviewVO review1, ReviewVO review2) {
return review2.getApplicationTime().compareTo(review1.getApplicationTime());
}
});
return ResultUtil.success(reviewData);
}
@Override
public BaseResponse getUserReview(HttpServletRequest request) {
log.info("\t> 执行 Service 层 ReviewService.getUserReview 方法");
//获取用户
@ -76,6 +137,14 @@ public class ReviewServiceImpl implements ReviewService {
reviewData.addAll(encapsulateArrayClass(reviewDOS));
}
//按照申请时间降序排序
Collections.sort(reviewData, new Comparator<ReviewVO>() {
@Override
public int compare(ReviewVO review1, ReviewVO review2) {
return review2.getApplicationTime().compareTo(review1.getApplicationTime());
}
});
return ResultUtil.success(reviewData);
}