feat:增加新业务功能修改审核状态
All checks were successful
代码检查 / 代码检查 (pull_request) Successful in 19s

This commit is contained in:
xiangZr-hhh 2024-04-12 14:28:28 +08:00
parent ff34595002
commit ec45c0b233
11 changed files with 158 additions and 19 deletions

View File

@ -13,16 +13,16 @@ package com.jsl.oa.common.constant;
public class ReviewConstants {
// 审核状态 0未通过1已通过2未审批
public static final int NOT_APPROVED = 0;
public static final short NOT_APPROVED = 0;
public static final int APPROVED = 1;
public static final short APPROVED = 1;
public static final int PENDING = 2;
public static final short PENDING = 2;
// 审核类型 0子系统1子模块
public static final int SUBSYSTEM = 0;
public static final short SUBSYSTEM = 0;
public static final int SUBMODULE = 1;
public static final short SUBMODULE = 1;
}

View File

@ -1,6 +1,7 @@
package com.jsl.oa.controllers;
import com.jsl.oa.model.vodata.ReviewAddVO;
import com.jsl.oa.model.vodata.ReviewUpdateResultVO;
import com.jsl.oa.services.ReviewService;
import com.jsl.oa.utils.BaseResponse;
import com.jsl.oa.utils.ErrorCode;
@ -9,10 +10,7 @@ import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.BindingResult;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import javax.validation.constraints.NotNull;
@ -76,6 +74,21 @@ public class ReviewController {
@PutMapping("/review/updateReview")
public BaseResponse updateReview(@RequestBody @Validated ReviewUpdateResultVO reviewUpdateResultVOVO,
@NotNull BindingResult bindingResult,
HttpServletRequest request) {
log.info("请求接口[PUT]: /review/updateReview");
if (bindingResult.hasErrors()) {
return ResultUtil.error(ErrorCode.REQUEST_BODY_ERROR);
}
return reviewService.updateReviewResult(reviewUpdateResultVOVO, request);
}
}

View File

@ -35,7 +35,7 @@ public class ReviewDAO {
}
public List<ReviewDO> selectApprovedResultReviewFromProject(Long projectId,
Integer result) {
short result) {
log.info("\t> 执行 DAO 层 ReviewDAO.selectApprovedResultReviewFromProject 方法");
log.info("\t\t> 从 MySQL 获取数据");
return reviewMapper.selectApprovedResultReviewFromProject(projectId,
@ -49,7 +49,7 @@ public class ReviewDAO {
}
public List<ReviewDO> selectApprovedResultReviewsFromSubsystem(Long subsystemId,
Integer result) {
short result) {
log.info("\t> 执行 DAO 层 ReviewDAO.selectApprovedResultReviewsFromSubsystem 方法");
log.info("\t\t> 从 MySQL 获取数据");
return reviewMapper.selectApprovedResultReviewsFromSubsystem(subsystemId,
@ -68,6 +68,18 @@ public class ReviewDAO {
reviewMapper.addReview(reviewDO);
}
public ReviewDO selectReviewById(Long id) {
log.info("\t> 执行 DAO 层 ReviewDAO.selectReviewById 方法");
log.info("\t\t> 从 MySQL 获取数据");
return reviewMapper.selectReviewById(id);
}
public void updateReview(ReviewDO reviewDO) {
log.info("\t> 执行 DAO 层 ReviewDAO.updateReview 方法");
log.info("\t\t> 从 MySQL 更新数据");
reviewMapper.updateReview(reviewDO);
}
public String getNameBySubproject(Long subId) {

View File

@ -14,7 +14,7 @@ public interface ReviewMapper {
@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);
List<ReviewDO> selectApprovedResultReviewFromProject(Long projectId, short result);
@Select("SELECT * FROM organize_oa.oa_review WHERE "
+ "project_subsystem_id = #{subsystemId} AND is_delete = 0")
@ -23,7 +23,7 @@ public interface ReviewMapper {
@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);
List<ReviewDO> selectApprovedResultReviewsFromSubsystem(Long subsystemId, short result);
@Select("SELECT * FROM organize_oa.oa_review WHERE "
+ "project_submodule_id = #{subsystemId} AND is_delete = 0")
@ -32,6 +32,8 @@ public interface ReviewMapper {
@Select("SELECT * FROM organize_oa.oa_review WHERE id = #{id} AND is_delete = 0")
ReviewDO selectReviewById(Long id);
void updateReview(ReviewDO reviewDO);
void addReview(ReviewDO reviewDO);
}

View File

@ -31,7 +31,7 @@ public class ReviewDO {
//审核者用户id
private Long recipientId;
//审核类别0子系统1子模块
private Integer category;
private Short category;
//申请的项目id
private Long projectId;
//申请的子系统id
@ -43,9 +43,9 @@ public class ReviewDO {
//审核时间
private Date reviewTime;
//审核结果0未通过1通过2未审批
private Integer reviewResult;
private Short reviewResult;
//是否删除0未删除1已删除
private Integer isDelete;
private String isDelete;
}

View File

@ -0,0 +1,23 @@
package com.jsl.oa.model.vodata;
import lombok.Data;
import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
@Data
public class ReviewUpdateResultVO {
@NotNull
private Long id;
@NotNull
@Min(value = 0, message = "未通过:0,已通过:1,待审批:2")
@Max(value = 2, message = "未通过:0,已通过:1,待审批:2")
private Short result;
}

View File

@ -2,6 +2,7 @@ package com.jsl.oa.services;
import com.jsl.oa.model.vodata.ReviewAddVO;
import com.jsl.oa.model.vodata.ReviewUpdateResultVO;
import com.jsl.oa.utils.BaseResponse;
import javax.servlet.http.HttpServletRequest;
@ -13,4 +14,6 @@ public interface ReviewService {
BaseResponse getUserReview(HttpServletRequest request);
BaseResponse addReview(ReviewAddVO reviewAddVO, HttpServletRequest request);
BaseResponse updateReviewResult(ReviewUpdateResultVO reviewUpdateResultVOVO, HttpServletRequest request);
}

View File

@ -10,9 +10,11 @@ import com.jsl.oa.model.dodata.ProjectDO;
import com.jsl.oa.model.dodata.ProjectWorkDO;
import com.jsl.oa.model.dodata.ReviewDO;
import com.jsl.oa.model.vodata.ReviewAddVO;
import com.jsl.oa.model.vodata.ReviewUpdateResultVO;
import com.jsl.oa.model.vodata.ReviewVO;
import com.jsl.oa.services.ReviewService;
import com.jsl.oa.utils.BaseResponse;
import com.jsl.oa.utils.ErrorCode;
import com.jsl.oa.utils.Processing;
import com.jsl.oa.utils.ResultUtil;
import lombok.RequiredArgsConstructor;
@ -174,6 +176,32 @@ public class ReviewServiceImpl implements ReviewService {
}
@Override
public BaseResponse updateReviewResult(ReviewUpdateResultVO reviewUpdateResultVO, HttpServletRequest request) {
//获取当前用户
Long userId = Processing.getAuthHeaderToUserId(request);
//获取对应审核信息
ReviewDO reviewDO = reviewDAO.selectReviewById(reviewUpdateResultVO.getId());
if (reviewDO == null) {
return ResultUtil.error(ErrorCode.REVIEW_NOT_EXIST);
}
//设置对应属性
reviewDO.setReviewTime(new Date());
reviewDO.setRecipientId(userId);
reviewDO.setReviewResult(reviewUpdateResultVO.getResult());
//更新数据
reviewDAO.updateReview(reviewDO);
return ResultUtil.success();
}
/**
* @Description: 封装审核的VO类
* @Date: 2024/4/11

View File

@ -52,7 +52,8 @@ public enum ErrorCode {
PROJECT_CUTTING_NOT_EXIST("ProjectCuttingNotExist", 40017, "项目分割模块不存在"),
PROJECT_USER_NOT_EXIST("ProjectUserNotExist", 40018, "用户项目表无对应记录"),
PROJECT_FILE_JSON_ERROR("ProjectFileJsonError", 40019, "项目文件json格式错误"),
PROJECT_NOT_USER("ProjectNotUser", 40020, "项目无此用户");
PROJECT_NOT_USER("ProjectNotUser", 40020, "项目无此用户"),
REVIEW_NOT_EXIST("ReviewNotExit", 40101, "未找到对应审核信息");
private final String output;

View File

@ -434,7 +434,7 @@ public class Processing {
* @Date: 2024/4/11
* @Param category:
**/
public static String turnReviewCategory(Integer category) {
public static String turnReviewCategory(short category) {
switch (category) {
case 0:
return "子系统";
@ -445,7 +445,7 @@ public class Processing {
}
}
public static String turnReviewResult(Integer result) {
public static String turnReviewResult(short result) {
switch (result) {
case 0:
return "已拒绝";

View File

@ -61,4 +61,61 @@
</insert>
<update id="updateReview" parameterType="com.jsl.oa.model.dodata.ReviewDO">
update organize_oa.oa_review
<set>
<if test="name != null and name != ''">
name = #{name},
</if>
<if test="content != null and content != ''">
content = #{content},
</if>
<if test="sender_id != null">
sender_id = #{sender_id},
</if>
<if test="recipient_id != null">
recipient_id = #{recipient_id},
</if>
<if test="category != null">
category = #{category},
</if>
<if test="project_id != null">
project_id = #{project_id},
</if>
<if test="project_subsystem_id != null">
project_subsystem_id = #{project_subsystem_id},
</if>
<if test="project_submodule_id != null">
project_submodule_id = #{project_submodule_id},
</if>
<if test="application_time != null">
application_time = #{application_time},
</if>
<if test="review_time != null">
review_time = #{review_time},
</if>
<if test="review_result != null">
review_result = #{review_result},
</if>
<if test="is_delete != null">
is_delete = #{is_delete},
</if>
</set>
where id = #{id}
</update>
</mapper>