Sfoglia il codice sorgente

1、转正审批接口调整
2、续签审批接口

dongpo 1 anno fa
parent
commit
5e54b8fc36
13 ha cambiato i file con 950 aggiunte e 615 eliminazioni
  1. 10 2
      yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/oa/conversion/vo/OaConversionRespVO.java
  2. 2 2
      yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/oa/conversion/vo/OaConversionSaveReqVO.java
  3. 87 55
      yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/oa/renew/OaRenewController.java
  4. 7 61
      yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/oa/renew/vo/OaRenewPageReqVO.java
  5. 44 13
      yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/oa/renew/vo/OaRenewRespVO.java
  6. 12 66
      yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/oa/renew/vo/OaRenewSaveReqVO.java
  7. 5 5
      yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/dal/dataobject/oa/conversion/OaConversionDO.java
  8. 26 6
      yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/dal/dataobject/oa/renew/OaRenewDO.java
  9. 2 19
      yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/dal/mysql/oa/renew/OaRenewMapper.java
  10. 2 2
      yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/oa/conversion/OaConversionServiceImpl.java
  11. 16 41
      yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/oa/renew/OaRenewService.java
  12. 512 118
      yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/oa/renew/OaRenewServiceImpl.java
  13. 225 225
      yudao-module-bpm/yudao-module-bpm-biz/src/test/java/cn/iocoder/yudao/module/bpm/service/oa/renew/OaRenewServiceImplTest.java

+ 10 - 2
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/oa/conversion/vo/OaConversionRespVO.java

@@ -100,10 +100,18 @@ public class OaConversionRespVO {
     @ExcelProperty("最后审核时间")
     private LocalDateTime finalAuditDate;
 
-    @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
-    @ExcelProperty("创建时间")
+    @Schema(description = "申请时间")
+    @ExcelProperty("申请时间")
     private LocalDateTime createTime;
 
+    @Schema(description = "申请人id")
+    @ExcelProperty("申请人id")
+    private Long applyEmployeeId;
+
+    @Schema(description = "申请人姓名")
+    @ExcelProperty("申请人姓名")
+    private String applyEmployeeName;
+
     @Schema(description = "附件列表")
     private List<FileDTO> fileList;
 

+ 2 - 2
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/oa/conversion/vo/OaConversionSaveReqVO.java

@@ -33,11 +33,11 @@ public class OaConversionSaveReqVO {
     @Schema(description = "备注")
     private String remarks;
 
-    @Schema(description = "发起人自选审批人", example = " [100, 1]")
+    @Schema(description = "发起人自选审批人id集合", example = " [100, 1]")
     @NotEmpty(message = "发起人自选审批人集合不能为空")
     private List<Long> startUserSelectAssignees;
 
-    @Schema(description = "附件主键id", example = "[1, 2]")
+    @Schema(description = "附件主键id集合", example = "[1, 2]")
     private List<Long> fileIdList;
 
 }

+ 87 - 55
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/oa/renew/OaRenewController.java

@@ -2,7 +2,6 @@ package cn.iocoder.yudao.module.bpm.controller.admin.oa.renew;
 
 import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
 import cn.iocoder.yudao.framework.common.pojo.CommonResult;
-import cn.iocoder.yudao.framework.common.pojo.PageParam;
 import cn.iocoder.yudao.framework.common.pojo.PageResult;
 import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
 import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
@@ -10,12 +9,13 @@ import cn.iocoder.yudao.module.bpm.controller.admin.oa.renew.vo.OaRenewPageReqVO
 import cn.iocoder.yudao.module.bpm.controller.admin.oa.renew.vo.OaRenewRespVO;
 import cn.iocoder.yudao.module.bpm.controller.admin.oa.renew.vo.OaRenewSaveReqVO;
 import cn.iocoder.yudao.module.bpm.controller.admin.task.vo.task.BpmTaskApproveReqVO;
-import cn.iocoder.yudao.module.bpm.dal.dataobject.oa.renew.OaRenewDO;
+import cn.iocoder.yudao.module.bpm.controller.admin.task.vo.task.BpmTaskReturnReqVO;
 import cn.iocoder.yudao.module.bpm.service.oa.renew.OaRenewService;
+import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
 import io.swagger.v3.oas.annotations.Operation;
 import io.swagger.v3.oas.annotations.Parameter;
 import io.swagger.v3.oas.annotations.tags.Tag;
-import org.springframework.security.access.prepost.PreAuthorize;
+import org.springdoc.api.annotations.ParameterObject;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.*;
 
@@ -27,7 +27,6 @@ import java.util.List;
 
 import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT;
 import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
-import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
 
 @Tag(name = "管理后台 - 合同续签流程信息")
 @RestController
@@ -38,87 +37,120 @@ public class OaRenewController {
     @Resource
     private OaRenewService oaRenewService;
 
-    @PostMapping("/start")
-    @Operation(summary = "提交或暂存合同续签流程信息")
-    @PreAuthorize("@ss.hasPermission('bpm:oa-Renew:start')")
-    public CommonResult<Long> startOaRenew(@Valid @RequestBody OaRenewSaveReqVO createReqVO) {
-        return success(oaRenewService.startOaRenew(getLoginUserId(), createReqVO));
+    @PostMapping("/staging")
+    @Operation(summary = "暂存续签审批流程信息")
+    @ApiOperationSupport(order = 1)
+    // @PreAuthorize("@ss.hasPermission('bpm:oa-renew:staging')")
+    public CommonResult<Long> stagingOaRenew(@RequestBody OaRenewSaveReqVO stagingReqVO) {
+        Long oaRenewId = oaRenewService.stagingOaRenew(stagingReqVO);
+        return success(oaRenewId, "暂存成功");
     }
 
-    @PostMapping("/completeTure")
-    @Operation(summary = "审批同意合同续签流程信息")
-    @PreAuthorize("@ss.hasPermission('bpm:oa-entry:complete-true')")
-    public CommonResult<Long> completeTrueOaRenew(@Valid @RequestBody BpmTaskApproveReqVO reqVO) {
-        return success(oaRenewService.completeTrueOaRenew(getLoginUserId(), reqVO));
+    @PostMapping("/commit")
+    @Operation(summary = "提交续签审批流程信息")
+    @ApiOperationSupport(order = 2)
+    // @PreAuthorize("@ss.hasPermission('bpm:oa-renew:commit')")
+    public CommonResult<Long> commitOaRenew(@Valid @RequestBody OaRenewSaveReqVO commitReqVO) {
+        Long oaRenewId = oaRenewService.commitOaRenew(commitReqVO);
+        return success(oaRenewId, "提交成功");
     }
 
-    @PostMapping("/completeFalse")
-    @Operation(summary = "驳回或撤回合同续签流程信息")
-    @PreAuthorize("@ss.hasPermission('bpm:oa-entry:complete-false')")
-    public CommonResult<Long> completeFalseOaRenew(@Valid @RequestBody BpmTaskApproveReqVO reqVO) {
-        return success(oaRenewService.completeFalseOaRenew(getLoginUserId(), reqVO));
+    @PostMapping("/agree")
+    @Operation(summary = "审批同意续签审批流程信息")
+    @ApiOperationSupport(order = 3)
+    // @PreAuthorize("@ss.hasPermission('bpm:oa-renew:agree')")
+    public CommonResult<Long> agreeOaRenew(@Valid @RequestBody BpmTaskApproveReqVO agreeReqVO) {
+        Long result = oaRenewService.agreeOaRenew(agreeReqVO);
+        return success(result, "审批成功");
     }
 
-    @PostMapping("/updateComplete")
-    @Operation(summary = "驳回和撤回后再次提交或关闭合同续签流程信息")
-    @PreAuthorize("@ss.hasPermission('bpm:oa-entry:update-complete')")
-    public CommonResult<Long> updateCompleteOaRenew(@Valid @RequestBody OaRenewSaveReqVO createReqVO) {
-        return success(oaRenewService.updateCompleteOaRenew(getLoginUserId(), createReqVO, createReqVO.getBpmTaskApproveReqVO()));
+    @PostMapping("/disagree")
+    @Operation(summary = "驳回续签审批流程信息")
+    @ApiOperationSupport(order = 4)
+    // @PreAuthorize("@ss.hasPermission('bpm:oa-renew:disagree')")
+    public CommonResult<Long> disagreeOaRenew(@Valid @RequestBody BpmTaskReturnReqVO disagreeReqVO) {
+        Long result = oaRenewService.disagreeOaRenew(disagreeReqVO);
+        return success(result, "驳回成功");
     }
 
+    @PostMapping("/revocation")
+    @Operation(summary = "撤回续签审批流程信息")
+    @ApiOperationSupport(order = 5)
+    // @PreAuthorize("@ss.hasPermission('bpm:oa-renew:revocation')")
+    public CommonResult<Long> revocationOaRenew(@Valid @RequestBody BpmTaskApproveReqVO revocationReqVO) {
+        Long result = oaRenewService.revocationOaRenew(revocationReqVO);
+        return success(result, "撤回成功");
+    }
 
-    @PostMapping("/create")
-    @Operation(summary = "创建合同续签流程信息")
-    @PreAuthorize("@ss.hasPermission('bpm:oa-renew:create')")
-    public CommonResult<Long> createOaRenew(@Valid @RequestBody OaRenewSaveReqVO createReqVO) {
-        return success(oaRenewService.createOaRenew(createReqVO));
+    @PostMapping("/reCommit")
+    @Operation(summary = "驳回或撤回后再次提交续签审批流程信息")
+    @ApiOperationSupport(order = 6)
+    // @PreAuthorize("@ss.hasPermission('bpm:oa-renew:re-commit')")
+    public CommonResult<Long> reCommitOaRenew(@Valid @RequestBody OaRenewSaveReqVO reCommitReqVO) {
+        Long result = oaRenewService.reCommitOaRenew(reCommitReqVO);
+        return success(result, "再次提交成功");
     }
 
-    @PutMapping("/update")
-    @Operation(summary = "更新合同续签流程信息")
-    @PreAuthorize("@ss.hasPermission('bpm:oa-renew:update')")
-    public CommonResult<Boolean> updateOaRenew(@Valid @RequestBody OaRenewSaveReqVO updateReqVO) {
-        oaRenewService.updateOaRenew(updateReqVO);
-        return success(true);
+    @DeleteMapping("/close")
+    @Operation(summary = "驳回或撤回后关闭续签审批流程信息")
+    @ApiOperationSupport(order = 7)
+    // @PreAuthorize("@ss.hasPermission('bpm:oa-entry:close')")
+    public CommonResult<Long> closeOaRenew(@RequestParam("id") Long id) {
+        Long result = oaRenewService.closeOaRenew(id);
+
+        return success(result, "关闭成功");
     }
 
     @DeleteMapping("/delete")
-    @Operation(summary = "删除合同续签流程信息")
+    @Operation(summary = "删除续签审批流程信息")
+    @ApiOperationSupport(order = 8)
     @Parameter(name = "id", description = "编号", required = true)
-    @PreAuthorize("@ss.hasPermission('bpm:oa-renew:delete')")
+    // @PreAuthorize("@ss.hasPermission('bpm:oa-renew:delete')")
     public CommonResult<Boolean> deleteOaRenew(@RequestParam("id") Long id) {
         oaRenewService.deleteOaRenew(id);
-        return success(true);
+        return success(true, "删除成功");
     }
 
     @GetMapping("/get")
-    @Operation(summary = "获得合同续签流程信息")
-    @Parameter(name = "id", description = "编号", required = true, example = "1024")
-    @PreAuthorize("@ss.hasPermission('bpm:oa-renew:query')")
+    @Operation(summary = "根据id获得续签审批流程信息")
+    @Parameter(name = "id", description = "编号", required = true, example = "1")
+    @ApiOperationSupport(order = 9)
+    // @PreAuthorize("@ss.hasPermission('bpm:oa-renew:query-id')")
     public CommonResult<OaRenewRespVO> getOaRenew(@RequestParam("id") Long id) {
-        OaRenewDO oaRenew = oaRenewService.getOaRenew(id);
-        return success(BeanUtils.toBean(oaRenew, OaRenewRespVO.class));
+        OaRenewRespVO respVO = oaRenewService.getOaRenew(id);
+        return success(respVO, "查询对象成功");
+    }
+
+    @GetMapping("/getByProcInstId")
+    @Operation(summary = "根据流程实例id获得续签审批流程信息")
+    @Parameter(name = "procInstId", description = "流程实例id", required = true, example = "9528a78d-457e-11ef-853c-4c034fce6445")
+    @ApiOperationSupport(order = 10)
+    // @PreAuthorize("@ss.hasPermission('bpm:oa-renew:query-proc-inst-id')")
+    public CommonResult<OaRenewRespVO> getOaRenewByProcInstId(@RequestParam("procInstId") String procInstId) {
+        OaRenewRespVO respVO = oaRenewService.getOaRenewByProcInstId(procInstId);
+        return success(respVO, "查询对象成功");
     }
 
     @GetMapping("/page")
-    @Operation(summary = "获得合同续签流程信息分页")
-    @PreAuthorize("@ss.hasPermission('bpm:oa-renew:query')")
-    public CommonResult<PageResult<OaRenewRespVO>> getOaRenewPage(@Valid OaRenewPageReqVO pageReqVO) {
-        PageResult<OaRenewDO> pageResult = oaRenewService.getOaRenewPage(pageReqVO);
-        return success(BeanUtils.toBean(pageResult, OaRenewRespVO.class));
+    @Operation(summary = "获得续签审批流程信息分页")
+    @ApiOperationSupport(order = 11)
+    // @PreAuthorize("@ss.hasPermission('bpm:oa-renew:query-page')")
+    public CommonResult<PageResult<OaRenewRespVO>> getOaRenewPage(@Valid @ParameterObject OaRenewPageReqVO pageReqVO) {
+        return success(oaRenewService.getOaRenewPage(pageReqVO), "查询列表成功");
     }
 
     @GetMapping("/export-excel")
-    @Operation(summary = "导出合同续签流程信息 Excel")
-    @PreAuthorize("@ss.hasPermission('bpm:oa-renew:export')")
+    @Operation(summary = "导出续签审批流程信息 Excel")
+    @ApiOperationSupport(order = 12)
+    // @PreAuthorize("@ss.hasPermission('bpm:oa-renew:export')")
     @ApiAccessLog(operateType = EXPORT)
     public void exportOaRenewExcel(@Valid OaRenewPageReqVO pageReqVO,
-              HttpServletResponse response) throws IOException {
-        pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
-        List<OaRenewDO> list = oaRenewService.getOaRenewPage(pageReqVO).getList();
+                                        HttpServletResponse response) throws IOException {
+        PageResult<OaRenewRespVO> pageResult = oaRenewService.exportOaRenewExcel(pageReqVO);
+        List<OaRenewRespVO> list = pageResult.getList();
         // 导出 Excel
-        ExcelUtils.write(response, "合同续签流程信息.xls", "数据", OaRenewRespVO.class,
-                        BeanUtils.toBean(list, OaRenewRespVO.class));
+        ExcelUtils.write(response, "续签审批流程信息.xls", "数据", OaRenewRespVO.class,
+                BeanUtils.toBean(list, OaRenewRespVO.class));
     }
 
 }

+ 7 - 61
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/oa/renew/vo/OaRenewPageReqVO.java

@@ -15,44 +15,18 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_
 @ToString(callSuper = true)
 public class OaRenewPageReqVO extends PageParam {
 
-    @Schema(description = "uuid", example = "14308")
-    private String renewId;
-
-    @Schema(description = "转正人id", example = "4530")
-    private Long employeeId;
-
-    @Schema(description = "转正人uuid", example = "24001")
-    private String employeeUuid;
-
-    @Schema(description = "转正员工姓名", example = "赵六")
+    @Schema(description = "续签员工姓名", example = "赵六")
     private String employeeName;
 
-    @Schema(description = "用户账号id", example = "16762")
-    private Long userId;
-
-    @Schema(description = "用户账号uuid", example = "12052")
-    private String userUuid;
+    @Schema(description = "续签员工手机号", example = "1394920000")
+    private String employeePhone;
 
     @Schema(description = "部门id", example = "28162")
     private Long deptId;
 
-    @Schema(description = "部门uuid", example = "17499")
-    private String deptUuid;
-
     @Schema(description = "职位")
     private String position;
 
-    @Schema(description = "原合同开始日期")
-    @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
-    private String[] oldContractStartDate;
-
-    @Schema(description = "原合同结束日期")
-    @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
-    private String[] oldContractEndDate;
-
-    @Schema(description = "续签合同期限")
-    private String renewPeriod;
-
     @Schema(description = "续签开始日期")
     @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
     private String[] renewContractStartDate;
@@ -61,41 +35,13 @@ public class OaRenewPageReqVO extends PageParam {
     @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
     private String[] renewContractEndDate;
 
-    @Schema(description = "续签理由", example = "不喜欢")
-    private String renewReason;
-
-    @Schema(description = "工作表现")
-    private String workPerformance;
-
-    @Schema(description = "备注")
-    private String remarks;
-
-    @Schema(description = "流程实例id", example = "25043")
-    private String procInstId;
-
-    @Schema(description = "审核状态(0暂存、1已提交、2审核中、3已审核、4已关闭、5已驳回)", example = "1")
+    @Schema(description = "审核状态(0暂存、1已提交、2审核中、3已审核、4已关闭、5已驳回、6已撤回)", example = "1")
     private String auditStatus;
 
-    @Schema(description = "当前审核人用户id", example = "19532")
-    private Long currentAuditUserId;
-
-    @Schema(description = "当前审核人用户uuid", example = "31429")
-    private String currentAuditUserUuid;
-
-    @Schema(description = "当前审核人员工id", example = "22621")
-    private Long currentAuditEmployeeId;
-
-    @Schema(description = "当前审核人员工uuid", example = "12859")
-    private String currentAuditEmployeeUuid;
-
-    @Schema(description = "最后审核时间")
-    @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
-    private LocalDateTime[] finalAuditDate;
-
-    @Schema(description = "数据来源,0流程添加、1手动添加")
-    private String infoSource;
+    @Schema(description = "申请人")
+    private String applyEmployeeName;
 
-    @Schema(description = "创建时间")
+    @Schema(description = "申请时间")
     @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
     private LocalDateTime[] createTime;
 

+ 44 - 13
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/oa/renew/vo/OaRenewRespVO.java

@@ -1,5 +1,8 @@
 package cn.iocoder.yudao.module.bpm.controller.admin.oa.renew.vo;
 
+import cn.iocoder.yudao.module.bpm.controller.admin.task.vo.task.BpmTaskRespVO;
+import cn.iocoder.yudao.module.infra.api.file.dto.FileDTO;
+import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
 import io.swagger.v3.oas.annotations.media.Schema;
 import lombok.*;
 import java.util.*;
@@ -13,7 +16,7 @@ import com.alibaba.excel.annotation.*;
 @ExcelIgnoreUnannotated
 public class OaRenewRespVO {
 
-    @Schema(description = "续签表单主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "31139")
+    @Schema(description = "续签表单主键", example = "1")
     @ExcelProperty("续签表单主键")
     private Long id;
 
@@ -21,18 +24,22 @@ public class OaRenewRespVO {
     @ExcelProperty("uuid")
     private String renewId;
 
-    @Schema(description = "转正人id", example = "4530")
-    @ExcelProperty("转正人id")
+    @Schema(description = "续签人id", example = "4530")
+    @ExcelProperty("续签人id")
     private Long employeeId;
 
-    @Schema(description = "转正人uuid", example = "24001")
-    @ExcelProperty("转正人uuid")
+    @Schema(description = "续签人uuid", example = "24001")
+    @ExcelProperty("续签人uuid")
     private String employeeUuid;
 
-    @Schema(description = "转正员工姓名", example = "赵六")
-    @ExcelProperty("转正员工姓名")
+    @Schema(description = "续签员工姓名", example = "赵六")
+    @ExcelProperty("续签员工姓名")
     private String employeeName;
 
+    @Schema(description = "续签员工手机号", example = "1394920000")
+    @ExcelProperty("续签员工手机号")
+    private String employeePhone;
+
     @Schema(description = "用户账号id", example = "16762")
     @ExcelProperty("用户账号id")
     private Long userId;
@@ -49,6 +56,10 @@ public class OaRenewRespVO {
     @ExcelProperty("部门uuid")
     private String deptUuid;
 
+    @Schema(description = "部门名称")
+    @ExcelProperty("部门名称")
+    private String deptName;
+
     @Schema(description = "职位")
     @ExcelProperty("职位")
     private String position;
@@ -109,16 +120,36 @@ public class OaRenewRespVO {
     @ExcelProperty("当前审核人员工uuid")
     private String currentAuditEmployeeUuid;
 
+    @Schema(description = "当前审核人员工姓名")
+    @ExcelProperty("当前审核人员工姓名")
+    private String currentAuditEmployeeName;
+
     @Schema(description = "最后审核时间")
     @ExcelProperty("最后审核时间")
     private LocalDateTime finalAuditDate;
 
-    @Schema(description = "数据来源,0流程添加、1手动添加")
-    @ExcelProperty("数据来源,0流程添加、1手动添加")
-    private String infoSource;
-
-    @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
-    @ExcelProperty("创建时间")
+    @Schema(description = "申请时间")
+    @ExcelProperty("申请时间")
     private LocalDateTime createTime;
 
+    @Schema(description = "申请人id")
+    @ExcelProperty("申请人id")
+    private Long applyEmployeeId;
+
+    @Schema(description = "申请人姓名")
+    @ExcelProperty("申请人姓名")
+    private String applyEmployeeName;
+
+    @Schema(description = "附件列表")
+    private List<FileDTO> fileList;
+
+    @Schema(description = "审批记录列表")
+    private List<BpmTaskRespVO> auditRecordList;
+
+    @Schema(description = "审批人员列表")
+    private List<AdminUserRespDTO> auditUserList;
+
+    @Schema(description = "当前用户待处理的任务id")
+    private String taskId;
+
 }

+ 12 - 66
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/oa/renew/vo/OaRenewSaveReqVO.java

@@ -4,6 +4,8 @@ import cn.iocoder.yudao.module.bpm.controller.admin.task.vo.task.BpmTaskApproveR
 import io.swagger.v3.oas.annotations.media.Schema;
 import lombok.Data;
 
+import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.NotNull;
 import java.time.LocalDateTime;
 import java.util.List;
 
@@ -11,52 +13,27 @@ import java.util.List;
 @Data
 public class OaRenewSaveReqVO {
 
-    @Schema(description = "续签表单主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "31139")
+    @Schema(description = "续签表单主键", example = "1")
     private Long id;
 
-    @Schema(description = "uuid", example = "14308")
-    private String renewId;
-
-    @Schema(description = "转正人id", example = "4530")
+    @Schema(description = "续签人id", example = "1")
+    @NotNull(message = "续签人id不能为空")
     private Long employeeId;
 
-    @Schema(description = "转正人uuid", example = "24001")
-    private String employeeUuid;
-
-    @Schema(description = "转正员工姓名", example = "赵六")
-    private String employeeName;
-
-    @Schema(description = "用户账号id", example = "16762")
-    private Long userId;
-
-    @Schema(description = "用户账号uuid", example = "12052")
-    private String userUuid;
-
-    @Schema(description = "部门id", example = "28162")
-    private Long deptId;
-
-    @Schema(description = "部门uuid", example = "17499")
-    private String deptUuid;
-
-    @Schema(description = "职位")
-    private String position;
-
-    @Schema(description = "原合同开始日期")
-    private String oldContractStartDate;
-
-    @Schema(description = "原合同结束日期")
-    private String oldContractEndDate;
-
-    @Schema(description = "续签合同期限")
+    @Schema(description = "续签合同期限,单位:月")
+    @NotBlank(message = "续签合同期限,单位:月,不能为空")
     private String renewPeriod;
 
     @Schema(description = "续签开始日期")
+    @NotBlank(message = "续签开始日期,不能为空")
     private String renewContractStartDate;
 
     @Schema(description = "续签结束日期")
+    @NotBlank(message = "续签结束日期,不能为空")
     private String renewContractEndDate;
 
     @Schema(description = "续签理由", example = "不喜欢")
+    @NotBlank(message = "续签理由,不能为空")
     private String renewReason;
 
     @Schema(description = "工作表现")
@@ -65,41 +42,10 @@ public class OaRenewSaveReqVO {
     @Schema(description = "备注")
     private String remarks;
 
-    @Schema(description = "流程实例id", example = "25043")
-    private String procInstId;
-
-    @Schema(description = "审核状态(0暂存、1已提交、2审核中、3已审核、4已关闭、5已驳回)", example = "1")
-    private String auditStatus;
-
-    @Schema(description = "当前审核人用户id", example = "19532")
-    private Long currentAuditUserId;
-
-    @Schema(description = "当前审核人用户uuid", example = "31429")
-    private String currentAuditUserUuid;
-
-    @Schema(description = "当前审核人员工id", example = "22621")
-    private Long currentAuditEmployeeId;
-
-    @Schema(description = "当前审核人员工uuid", example = "12859")
-    private String currentAuditEmployeeUuid;
-
-    @Schema(description = "最后审核时间")
-    private LocalDateTime finalAuditDate;
-
-    @Schema(description = "数据来源,0流程添加、1手动添加")
-    private String infoSource;
-
-    @Schema(description = "审批,true 通过,false 驳回", example = "true")
-    private Boolean auditPass;
-
-    @Schema(description = "发起人自选审批人 Map", example = " [1, 1]")
+    @Schema(description = "发起人自选审批人id集合", example = " [100, 1]")
     private List<Long> startUserSelectAssignees;
 
-    @Schema(description = "附件主键id", example = "[1, 2]")
+    @Schema(description = "附件主键id集合", example = "[1, 2]")
     private List<Long> fileIdList;
 
-    @Schema(description = "审批信息")
-    private BpmTaskApproveReqVO bpmTaskApproveReqVO;
-
-
 }

+ 5 - 5
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/dal/dataobject/oa/conversion/OaConversionDO.java

@@ -97,9 +97,13 @@ public class OaConversionDO extends BaseDO {
      */
     private String procInstId;
     /**
-     * 审核状态(0暂存、1已提交、2审核中、3已审核、4已关闭、5已驳回)
+     * 审核状态(0暂存、1已提交、2审核中、3已审核、4已关闭、5已驳回、6已撤回
      */
     private String auditStatus;
+    /**
+     * 数据来源,0流程添加、1手动添加
+     */
+    private String infoSource;
     /**
      * 当前审核人员工id
      */
@@ -128,10 +132,6 @@ public class OaConversionDO extends BaseDO {
      * 申请人选择的审批人
      */
     private String startUserSelectAssignees;
-    /**
-     * 数据来源,0流程添加、1手动添加
-     */
-    private String infoSource;
     /**
      * 申请人id
      */

+ 26 - 6
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/dal/dataobject/oa/renew/OaRenewDO.java

@@ -33,17 +33,21 @@ public class OaRenewDO extends BaseDO {
      */
     private String renewId;
     /**
-     * 转正人id
+     * 续签人id
      */
     private Long employeeId;
     /**
-     * 转正人uuid
+     * 续签人uuid
      */
     private String employeeUuid;
     /**
-     * 转正员工姓名
+     * 续签员工姓名
      */
     private String employeeName;
+    /**
+     * 续签员工手机号
+     */
+    private String employeePhone;
     /**
      * 用户账号id
      */
@@ -101,9 +105,13 @@ public class OaRenewDO extends BaseDO {
      */
     private String procInstId;
     /**
-     * 审核状态(0暂存、1已提交、2审核中、3已审核、4已关闭、5已驳回)
+     * 审核状态(0暂存、1已提交、2审核中、3已审核、4已关闭、5已驳回、6已撤回
      */
     private String auditStatus;
+    /**
+     * 数据来源,0流程添加、1手动添加
+     */
+    private String infoSource;
     /**
      * 当前审核人用户id
      */
@@ -120,13 +128,25 @@ public class OaRenewDO extends BaseDO {
      * 当前审核人员工uuid
      */
     private String currentAuditEmployeeUuid;
+    /**
+     * 当前审核人员工姓名
+     */
+    private String currentAuditEmployeeName;
     /**
      * 最后审核时间
      */
     private LocalDateTime finalAuditDate;
     /**
-     * 数据来源,0流程添加、1手动添加
+     * 申请人选择的审批人
      */
-    private String infoSource;
+    private String startUserSelectAssignees;
+    /**
+     * 申请人id
+     */
+    private Long applyEmployeeId;
+    /**
+     * 申请人姓名
+     */
+    private String applyEmployeeName;
 
 }

+ 2 - 19
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/dal/mysql/oa/renew/OaRenewMapper.java

@@ -17,31 +17,14 @@ public interface OaRenewMapper extends BaseMapperX<OaRenewDO> {
 
     default PageResult<OaRenewDO> selectPage(OaRenewPageReqVO reqVO) {
         return selectPage(reqVO, new LambdaQueryWrapperX<OaRenewDO>()
-                .eqIfPresent(OaRenewDO::getRenewId, reqVO.getRenewId())
-                .eqIfPresent(OaRenewDO::getEmployeeId, reqVO.getEmployeeId())
-                .eqIfPresent(OaRenewDO::getEmployeeUuid, reqVO.getEmployeeUuid())
                 .likeIfPresent(OaRenewDO::getEmployeeName, reqVO.getEmployeeName())
-                .eqIfPresent(OaRenewDO::getUserId, reqVO.getUserId())
-                .eqIfPresent(OaRenewDO::getUserUuid, reqVO.getUserUuid())
+                .likeIfPresent(OaRenewDO::getEmployeePhone, reqVO.getEmployeePhone())
                 .eqIfPresent(OaRenewDO::getDeptId, reqVO.getDeptId())
-                .eqIfPresent(OaRenewDO::getDeptUuid, reqVO.getDeptUuid())
                 .eqIfPresent(OaRenewDO::getPosition, reqVO.getPosition())
-                .betweenIfPresent(OaRenewDO::getOldContractStartDate, reqVO.getOldContractStartDate())
-                .betweenIfPresent(OaRenewDO::getOldContractEndDate, reqVO.getOldContractEndDate())
-                .eqIfPresent(OaRenewDO::getRenewPeriod, reqVO.getRenewPeriod())
                 .betweenIfPresent(OaRenewDO::getRenewContractStartDate, reqVO.getRenewContractStartDate())
                 .betweenIfPresent(OaRenewDO::getRenewContractEndDate, reqVO.getRenewContractEndDate())
-                .eqIfPresent(OaRenewDO::getRenewReason, reqVO.getRenewReason())
-                .eqIfPresent(OaRenewDO::getWorkPerformance, reqVO.getWorkPerformance())
-                .eqIfPresent(OaRenewDO::getRemarks, reqVO.getRemarks())
-                .eqIfPresent(OaRenewDO::getProcInstId, reqVO.getProcInstId())
                 .eqIfPresent(OaRenewDO::getAuditStatus, reqVO.getAuditStatus())
-                .eqIfPresent(OaRenewDO::getCurrentAuditUserId, reqVO.getCurrentAuditUserId())
-                .eqIfPresent(OaRenewDO::getCurrentAuditUserUuid, reqVO.getCurrentAuditUserUuid())
-                .eqIfPresent(OaRenewDO::getCurrentAuditEmployeeId, reqVO.getCurrentAuditEmployeeId())
-                .eqIfPresent(OaRenewDO::getCurrentAuditEmployeeUuid, reqVO.getCurrentAuditEmployeeUuid())
-                .betweenIfPresent(OaRenewDO::getFinalAuditDate, reqVO.getFinalAuditDate())
-                .eqIfPresent(OaRenewDO::getInfoSource, reqVO.getInfoSource())
+                .likeIfPresent(OaRenewDO::getApplyEmployeeName, reqVO.getApplyEmployeeName())
                 .betweenIfPresent(OaRenewDO::getCreateTime, reqVO.getCreateTime())
                 .orderByDesc(OaRenewDO::getId));
     }

+ 2 - 2
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/oa/conversion/OaConversionServiceImpl.java

@@ -43,7 +43,7 @@ import java.util.*;
 import java.util.stream.Collectors;
 
 import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
-import static cn.iocoder.yudao.module.bpm.enums.ErrorCodeConstants.OA_UNIVERSAL_NOT_EXISTS;
+import static cn.iocoder.yudao.module.bpm.enums.ErrorCodeConstants.OA_CONVERSION_NOT_EXISTS;
 
 /**
  * 转正流程信息 Service 实现类
@@ -621,7 +621,7 @@ public class OaConversionServiceImpl implements OaConversionService {
     private void validateOaConversionExists(Long id) {
         OaConversionDO oaConversionDO = oaConversionMapper.selectById(id);
         if (oaConversionDO == null) {
-            throw exception(OA_UNIVERSAL_NOT_EXISTS);
+            throw exception(OA_CONVERSION_NOT_EXISTS);
         }
         if (!DictDataConstants.OA_AUDIT_STATUS_STAGING.equals(oaConversionDO.getAuditStatus())) {
             throw exception(ErrorCodeConstants.DELETE_FAIL_NOT_STAGING);

+ 16 - 41
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/oa/renew/OaRenewService.java

@@ -2,65 +2,40 @@ package cn.iocoder.yudao.module.bpm.service.oa.renew;
 
 import cn.iocoder.yudao.framework.common.pojo.PageResult;
 import cn.iocoder.yudao.module.bpm.controller.admin.oa.renew.vo.OaRenewPageReqVO;
+import cn.iocoder.yudao.module.bpm.controller.admin.oa.renew.vo.OaRenewRespVO;
 import cn.iocoder.yudao.module.bpm.controller.admin.oa.renew.vo.OaRenewSaveReqVO;
 import cn.iocoder.yudao.module.bpm.controller.admin.task.vo.task.BpmTaskApproveReqVO;
-import cn.iocoder.yudao.module.bpm.dal.dataobject.oa.renew.OaRenewDO;
-import com.baomidou.mybatisplus.extension.service.IService;
-
-import javax.validation.Valid;
+import cn.iocoder.yudao.module.bpm.controller.admin.task.vo.task.BpmTaskReturnReqVO;
 
 /**
  * 合同续签流程信息 Service 接口
  *
  * @author dp
  */
-public interface OaRenewService extends IService<OaRenewDO> {
+public interface OaRenewService {
 
-    Long startOaRenew(Long userId, @Valid OaRenewSaveReqVO createReqVO);
+    Long stagingOaRenew(OaRenewSaveReqVO stagingReqVO);
 
-    Long completeTrueOaRenew(Long userId, BpmTaskApproveReqVO reqVO);
+    Long commitOaRenew(OaRenewSaveReqVO commitReqVO);
 
-    Long completeFalseOaRenew(Long userId, BpmTaskApproveReqVO reqVO);
+    Long agreeOaRenew(BpmTaskApproveReqVO agreeReqVO);
 
-    Long updateCompleteOaRenew(Long userId, @Valid OaRenewSaveReqVO createReqVO, @Valid BpmTaskApproveReqVO reqVO);
+    Long disagreeOaRenew(BpmTaskReturnReqVO disagreeReqVO);
 
+    Long revocationOaRenew(BpmTaskApproveReqVO revocationReqVO);
 
-    /**
-     * 创建合同续签流程信息
-     *
-     * @param createReqVO 创建信息
-     * @return 编号
-     */
-    Long createOaRenew(@Valid OaRenewSaveReqVO createReqVO);
+    Long reCommitOaRenew(OaRenewSaveReqVO reCommitReqVO);
 
-    /**
-     * 更新合同续签流程信息
-     *
-     * @param updateReqVO 更新信息
-     */
-    void updateOaRenew(@Valid OaRenewSaveReqVO updateReqVO);
+    Long closeOaRenew(Long id);
 
-    /**
-     * 删除合同续签流程信息
-     *
-     * @param id 编号
-     */
     void deleteOaRenew(Long id);
 
-    /**
-     * 获得合同续签流程信息
-     *
-     * @param id 编号
-     * @return 合同续签流程信息
-     */
-    OaRenewDO getOaRenew(Long id);
+    OaRenewRespVO getOaRenew(Long id);
+
+    OaRenewRespVO getOaRenewByProcInstId(String procInstId);
+
+    PageResult<OaRenewRespVO> getOaRenewPage(OaRenewPageReqVO pageReqVO);
 
-    /**
-     * 获得合同续签流程信息分页
-     *
-     * @param pageReqVO 分页查询
-     * @return 合同续签流程信息分页
-     */
-    PageResult<OaRenewDO> getOaRenewPage(OaRenewPageReqVO pageReqVO);
+    PageResult<OaRenewRespVO> exportOaRenewExcel(OaRenewPageReqVO pageReqVO);
 
 }

+ 512 - 118
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/oa/renew/OaRenewServiceImpl.java

@@ -2,19 +2,34 @@ package cn.iocoder.yudao.module.bpm.service.oa.renew;
 
 import cn.hutool.core.collection.CollectionUtil;
 import cn.hutool.core.util.IdUtil;
+import cn.hutool.core.util.StrUtil;
+import cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil;
+import cn.iocoder.yudao.framework.common.pojo.PageParam;
 import cn.iocoder.yudao.framework.common.pojo.PageResult;
 import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
+import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
 import cn.iocoder.yudao.module.bpm.api.task.BpmProcessInstanceApi;
 import cn.iocoder.yudao.module.bpm.api.task.dto.BpmProcessInstanceCreateReqDTO;
 import cn.iocoder.yudao.module.bpm.controller.admin.oa.renew.vo.OaRenewPageReqVO;
+import cn.iocoder.yudao.module.bpm.controller.admin.oa.renew.vo.OaRenewRespVO;
 import cn.iocoder.yudao.module.bpm.controller.admin.oa.renew.vo.OaRenewSaveReqVO;
 import cn.iocoder.yudao.module.bpm.controller.admin.task.vo.task.BpmTaskApproveReqVO;
+import cn.iocoder.yudao.module.bpm.controller.admin.task.vo.task.BpmTaskRespVO;
 import cn.iocoder.yudao.module.bpm.controller.admin.task.vo.task.BpmTaskReturnReqVO;
 import cn.iocoder.yudao.module.bpm.dal.dataobject.oa.renew.OaRenewDO;
 import cn.iocoder.yudao.module.bpm.dal.mysql.oa.renew.OaRenewMapper;
+import cn.iocoder.yudao.module.bpm.enums.DictDataConstants;
+import cn.iocoder.yudao.module.bpm.enums.ErrorCodeConstants;
+import cn.iocoder.yudao.module.bpm.framework.flowable.core.enums.BpmConstants;
 import cn.iocoder.yudao.module.bpm.service.task.BpmTaskService;
+import cn.iocoder.yudao.module.infra.api.file.FileApi;
+import cn.iocoder.yudao.module.infra.api.file.dto.FileDTO;
+import cn.iocoder.yudao.module.system.api.dept.DeptApi;
+import cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO;
+import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
+import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.apache.commons.lang3.StringUtils;
 import org.flowable.engine.TaskService;
 import org.flowable.task.api.Task;
@@ -24,10 +39,8 @@ import org.springframework.validation.annotation.Validated;
 
 import javax.annotation.Resource;
 import java.time.LocalDateTime;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
+import java.util.stream.Collectors;
 
 import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
 import static cn.iocoder.yudao.module.bpm.enums.ErrorCodeConstants.OA_RENEW_NOT_EXISTS;
@@ -39,7 +52,7 @@ import static cn.iocoder.yudao.module.bpm.enums.ErrorCodeConstants.OA_RENEW_NOT_
  */
 @Service
 @Validated
-public class OaRenewServiceImpl extends ServiceImpl<OaRenewMapper, OaRenewDO> implements OaRenewService {
+public class OaRenewServiceImpl implements OaRenewService {
 
 
     /**
@@ -59,90 +72,215 @@ public class OaRenewServiceImpl extends ServiceImpl<OaRenewMapper, OaRenewDO> im
     @Resource
     private TaskService taskService;
 
+    @Resource
+    private FileApi fileApi;
+
+    @Resource
+    private AdminUserApi adminUserApi;
+
+    @Resource
+    private DeptApi deptApi;
+
     @Override
     @Transactional
-    public Long startOaRenew(Long userId, OaRenewSaveReqVO createReqVO) {
-        //判断是否已经发起流程
-        Boolean auditPass = createReqVO.getAuditPass();
-        // 创建单据uuid
-        String uuid = IdUtil.fastSimpleUUID();
-        OaRenewDO oaRenew = BeanUtils.toBean(createReqVO, OaRenewDO.class);
+    public Long stagingOaRenew(OaRenewSaveReqVO stagingReqVO) {
+        // 登录人信息
+        Long loginUserId = SecurityFrameworkUtils.getLoginUserId();
+        AdminUserRespDTO loginUser = adminUserApi.getUser(loginUserId);
+        Objects.requireNonNull(loginUser, "登录用户不能为空");
+        // 转正人信息
+        AdminUserRespDTO employee = adminUserApi.getUser(stagingReqVO.getEmployeeId());
+
+        OaRenewDO oaRenew = BeanUtils.toBean(stagingReqVO, OaRenewDO.class);
         if (StringUtils.isBlank(oaRenew.getRenewId())) {
+            // 创建单据uuid
+            String uuid = IdUtil.fastSimpleUUID();
             oaRenew.setRenewId(uuid);
         }
+        if (employee != null) {
+            oaRenew.setEmployeeId(loginUser.getId());
+            oaRenew.setEmployeeName(loginUser.getNickname());
+            oaRenew.setEmployeePhone(loginUser.getMobile());
+            oaRenew.setDeptId(loginUser.getDeptId());
+            oaRenew.setPosition("员工职位");
+            oaRenew.setOldContractStartDate("2023-01-01");
+            oaRenew.setOldContractEndDate("2023-12-31");
+            oaRenew.setUserId(loginUser.getId());
+        }
+        oaRenew.setAuditStatus(DictDataConstants.OA_AUDIT_STATUS_STAGING);
+        oaRenew.setInfoSource("0");
+        oaRenew.setApplyEmployeeId(loginUser.getId());
+        oaRenew.setApplyEmployeeName(loginUser.getNickname());
+        // 暂存不保存审批人信息
+        oaRenew.setStartUserSelectAssignees(null);
         // 保存或更新表单信息
-        this.saveOrUpdate(oaRenew);
-
-        // 提交
-        if (auditPass) {
-            // 发起 BPM 流程
-            Map<String, Object> processInstanceVariables = new HashMap<>();
-            processInstanceVariables.put("auditPass", auditPass);
-            //添加审批人信息
-            Map<String, List<Long>> startUserSelectAssignees = new HashMap<>();
-            startUserSelectAssignees.put("approver", createReqVO.getStartUserSelectAssignees());
-            String processInstanceId = processInstanceApi
-                    .createProcessInstance(userId,
-                            new BpmProcessInstanceCreateReqDTO()
-                                    .setProcessDefinitionKey(PROCESS_KEY)
-                                    .setVariables(processInstanceVariables)
-                                    .setBusinessKey(String.valueOf(oaRenew.getId()))
-                                    .setStartUserSelectAssignees(startUserSelectAssignees));
-
-            //获取下一个审批人
-            Task task = taskService.createTaskQuery().processInstanceId(processInstanceId).singleResult();
-
-            // 将工作流的编号,单据状态 最后一次审批时间 当前审批人  更新到 OA 转正中
-            oaRenewMapper.updateById(new OaRenewDO()
-                    .setId(oaRenew.getId())
-                    .setProcInstId(processInstanceId)
-                    .setAuditStatus("1")
-                    .setRenewId(uuid)
-                    .setFinalAuditDate(LocalDateTime.now())
-                    .setCurrentAuditEmployeeId(Long.valueOf(task.getAssignee())));
+        if (oaRenew.getId() == null) {
+            oaRenewMapper.insert(oaRenew);
+        } else {
+            oaRenewMapper.updateById(oaRenew);
+        }
+        // 保存业务uuid到附件中
+        saveFileList(stagingReqVO.getFileIdList(), oaRenew.getRenewId());
 
-            // TODO 发送通知
+        return oaRenew.getId();
+    }
 
-        }else {
-            // 暂存,不发起流程
-            // 将单据状态 更新到 OA转正中
-            oaRenewMapper.updateById(new OaRenewDO()
-                    .setId(oaRenew.getId())
-                    .setAuditStatus("0"));
+    @Override
+    @Transactional
+    public Long commitOaRenew(OaRenewSaveReqVO commitReqVO) {
+        if (CollectionUtil.isEmpty(commitReqVO.getStartUserSelectAssignees())) {
+            throw exception(ErrorCodeConstants.TASK_CREATE_FAIL_NO_START_SELECT_ASSIGNEE);
+        }
+        // 登录人信息
+        Long loginUserId = SecurityFrameworkUtils.getLoginUserId();
+        AdminUserRespDTO loginUser = adminUserApi.getUser(loginUserId);
+        if (loginUser == null) {
+            throw exception(ErrorCodeConstants.OA_LOGIN_USER_NOT_EXISTS);
+        }
+        // 转正人信息
+        AdminUserRespDTO employee = adminUserApi.getUser(commitReqVO.getEmployeeId());
+        if (employee == null) {
+            throw exception(ErrorCodeConstants.OA_EMPLOYEE_NOT_EXISTS);
         }
 
-        // TODO 保存或更新附件uuid
-        if (CollectionUtil.isNotEmpty(createReqVO.getFileIdList())) {
+
+        OaRenewDO oaRenew = BeanUtils.toBean(commitReqVO, OaRenewDO.class);
+        if (StringUtils.isBlank(oaRenew.getRenewId())) {
+            // 创建单据uuid
+            String uuid = IdUtil.fastSimpleUUID();
+            oaRenew.setRenewId(uuid);
         }
+        oaRenew.setEmployeeId(employee.getId());
+        oaRenew.setEmployeeName(employee.getNickname());
+        oaRenew.setEmployeePhone(employee.getMobile());
+        oaRenew.setDeptId(employee.getDeptId());
+        oaRenew.setPosition("员工职位");
+        oaRenew.setOldContractStartDate("2023-01-01");
+        oaRenew.setOldContractEndDate("2023-12-31");
+        oaRenew.setUserId(loginUser.getId());
+        oaRenew.setInfoSource("0");
+        oaRenew.setApplyEmployeeId(loginUser.getId());
+        oaRenew.setApplyEmployeeName(loginUser.getNickname());
+        // 保存或更新表单信息
+        if (oaRenew.getId() == null) {
+            oaRenewMapper.insert(oaRenew);
+        } else {
+            OaRenewDO oaRenewDO = oaRenewMapper.selectById(oaRenew.getId());
+            if (StrUtil.isNotBlank(oaRenewDO.getProcInstId())) {
+                throw exception(ErrorCodeConstants.PROCESS_INSTANCE_CREATE_FAIL_HAS_PROCESS);
+            }
+            oaRenewMapper.updateById(oaRenew);
+        }
+        // 发起流程
+        Map<String, Object> processInstanceVariables = new HashMap<>();
+        processInstanceVariables.put("auditPass", "true");
+        // 添加审批人信息
+        Map<String, List<Long>> startUserSelectAssignees = new HashMap<>();
+        List<Long> selectAssignees = commitReqVO.getStartUserSelectAssignees();
+        startUserSelectAssignees.put("approver", selectAssignees);
+        String processInstanceId = processInstanceApi
+                .createProcessInstance(loginUser.getId(),
+                        new BpmProcessInstanceCreateReqDTO()
+                                .setProcessDefinitionKey(PROCESS_KEY)
+                                .setVariables(processInstanceVariables)
+                                .setBusinessKey(String.valueOf(oaRenew.getId()))
+                                .setStartUserSelectAssignees(startUserSelectAssignees));
+
+        //获取下一个审批人
+        Task task = taskService.createTaskQuery().processInstanceId(processInstanceId).singleResult();
 
-        // 返回
+        // 审批同意
+        BpmTaskApproveReqVO agreeReqVO = new BpmTaskApproveReqVO();
+        agreeReqVO.setId(task.getId());
+        agreeReqVO.setReason("[首次提交]");
+        agreeReqVO.setTaskStatus(Integer.valueOf(DictDataConstants.OA_AUDIT_STATUS_COMMITTED));
+        taskService.setVariable(task.getId(), BpmConstants.PROCESS_INSTANCE_VARIABLE_STATUS, DictDataConstants.OA_AUDIT_STATUS_COMMITTED);
+        taskService.setVariable(task.getId(), "auditPass", "true");
+        bpmTaskService.approveTask(loginUserId, agreeReqVO);
+
+        Task nextTask = taskService.createTaskQuery().processInstanceId(processInstanceId).singleResult();
+        if (nextTask == null) {
+            throw exception(ErrorCodeConstants.TASK_CREATE_FAIL_NO_START_SELECT_ASSIGNEE);
+        }
+        Long currentAuditEmployeeId = Long.valueOf(nextTask.getAssignee());
+        AdminUserRespDTO currentAuditEmployee = adminUserApi.getUser(currentAuditEmployeeId);
+
+
+        // 将工作流的流程实例ID、单据状态、最后一次审批时间、当前审批人更新到单据信息中
+        oaRenewMapper.updateById(new OaRenewDO()
+                .setId(oaRenew.getId())
+                .setProcInstId(processInstanceId)
+                .setAuditStatus(DictDataConstants.OA_AUDIT_STATUS_COMMITTED)
+                .setFinalAuditDate(LocalDateTime.now())
+                .setCurrentAuditEmployeeId(currentAuditEmployeeId)
+                .setCurrentAuditEmployeeName(currentAuditEmployee.getNickname())
+                .setStartUserSelectAssignees(selectAssignees.stream().map(String::valueOf).collect(Collectors.joining(","))));
+        // 保存业务uuid到附件中
+        saveFileList(commitReqVO.getFileIdList(), oaRenew.getRenewId());
+        // TODO DP 发送提交成功站内信
         return oaRenew.getId();
     }
+
     @Override
-    public Long completeTrueOaRenew(Long userId, BpmTaskApproveReqVO reqVO) {
-        Task currentTask = bpmTaskService.getTask(reqVO.getId());
+    @Transactional
+    public Long agreeOaRenew(BpmTaskApproveReqVO agreeReqVO) {
+        // 登录人信息
+        Long loginUserId = SecurityFrameworkUtils.getLoginUserId();
+        // TODO DP 根据登录人查询出对应的员工信息
+
+        Task currentTask = bpmTaskService.getTask(agreeReqVO.getId());
+        if (currentTask == null) {
+            throw exception(ErrorCodeConstants.TASK_NOT_EXISTS);
+        }
+        // 先更新为审批中
+        taskService.setVariable(currentTask.getId(), BpmConstants.PROCESS_INSTANCE_VARIABLE_STATUS, DictDataConstants.OA_AUDIT_STATUS_AUDITING);
+        LambdaQueryWrapper<OaRenewDO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
+        lambdaQueryWrapper.eq(OaRenewDO::getProcInstId, currentTask.getProcessInstanceId());
+        OaRenewDO oaRenew = oaRenewMapper.selectOne(lambdaQueryWrapper);
+        // 如果是最后一个人审批同意,设置流程审批状态为已审核
+        String[] auditPersons = oaRenew.getStartUserSelectAssignees().split(",");
+        String lastAuditPerson = Arrays.stream(auditPersons)
+                .reduce((first, second) -> second)
+                .orElse(null);
+        if (currentTask.getAssignee().equals(lastAuditPerson)) {
+            // 更新为已审核(暂时未生效,未找到原因,先不处理)
+            taskService.setVariable(agreeReqVO.getId(),BpmConstants.PROCESS_INSTANCE_VARIABLE_STATUS, DictDataConstants.OA_AUDIT_STATUS_AUDITED);
+        }
         // 审批同意
-        bpmTaskService.approveTask(userId, reqVO);
+        String reason = "[同意]";
+        if (StrUtil.isNotBlank(agreeReqVO.getReason())) {
+            reason = reason + agreeReqVO.getReason();
+        }
+        agreeReqVO.setReason(reason);
+        agreeReqVO.setTaskStatus(Integer.valueOf(DictDataConstants.OA_AUDIT_STATUS_AUDITING));
+        taskService.setVariable(agreeReqVO.getId(), "auditPass", "true");
+        bpmTaskService.approveTask(loginUserId, agreeReqVO);
 
         Task nextTask = taskService.createTaskQuery().processInstanceId(currentTask.getProcessInstanceId()).singleResult();
+        OaRenewDO oaRenewDO = new OaRenewDO();
         if (nextTask != null) {
-            LambdaUpdateWrapper<OaRenewDO> updateWrapper = new LambdaUpdateWrapper<>();
-            updateWrapper.set(OaRenewDO::getAuditStatus, "2")
-                    .set(OaRenewDO::getCurrentAuditEmployeeId, nextTask.getAssignee())
-                    .set(OaRenewDO::getFinalAuditDate, new Date())
-                    .eq(OaRenewDO::getProcInstId, currentTask.getProcessInstanceId());
-            oaRenewMapper.update(updateWrapper);
+            Long currentAuditEmployeeId = Long.valueOf(nextTask.getAssignee());
+            AdminUserRespDTO currentAuditEmployee = adminUserApi.getUser(currentAuditEmployeeId);
+
+            // 如果审批人重复,实际未结束,再次更新为审核中
+            taskService.setVariable(nextTask.getId(), BpmConstants.PROCESS_INSTANCE_VARIABLE_STATUS, DictDataConstants.OA_AUDIT_STATUS_AUDITING);
+            oaRenewDO.setAuditStatus(DictDataConstants.OA_AUDIT_STATUS_AUDITING)
+                    .setCurrentAuditEmployeeId(currentAuditEmployeeId)
+                    .setCurrentAuditEmployeeName(currentAuditEmployee.getNickname())
+                    .setFinalAuditDate(LocalDateTime.now())
+                    .setId(oaRenew.getId());
+
         } else {
-            LambdaUpdateWrapper<OaRenewDO> updateWrapper = new LambdaUpdateWrapper<>();
-            updateWrapper.set(OaRenewDO::getAuditStatus, "3")
-                    .set(OaRenewDO::getCurrentAuditEmployeeId, null)
-                    .set(OaRenewDO::getFinalAuditDate, new Date())
-                    .eq(OaRenewDO::getProcInstId, currentTask.getProcessInstanceId());
-            oaRenewMapper.update(updateWrapper);
+            oaRenewDO.setAuditStatus(DictDataConstants.OA_AUDIT_STATUS_AUDITED)
+                    .setCurrentAuditEmployeeId(null)
+                    .setCurrentAuditEmployeeName(null)
+                    .setFinalAuditDate(LocalDateTime.now())
+                    .setId(oaRenew.getId());
 
             // TODO 复制业务单据信息到业务模块单据表
 
         }
+        oaRenewMapper.updateById(oaRenewDO);
         // 发送通知
 
         // 返回
@@ -150,80 +288,189 @@ public class OaRenewServiceImpl extends ServiceImpl<OaRenewMapper, OaRenewDO> im
     }
 
     @Override
-    public Long completeFalseOaRenew(Long userId, BpmTaskApproveReqVO reqVO) {
+    @Transactional
+    public Long disagreeOaRenew(BpmTaskReturnReqVO disagreeReqVO) {
+        // 登录人信息
+        Long loginUserId = SecurityFrameworkUtils.getLoginUserId();
+        // TODO DP 根据登录人查询出对应的员工信息
 
-        Task currentTask = bpmTaskService.getTask(reqVO.getId());
+        Task currentTask = bpmTaskService.getTask(disagreeReqVO.getId());
 
-        BpmTaskReturnReqVO reqVO2 = BeanUtils.toBean(reqVO, BpmTaskReturnReqVO.class);
-        reqVO2.setTargetTaskDefinitionKey("modifyApply");
-        bpmTaskService.returnTask(userId, reqVO2);
+        disagreeReqVO.setTargetTaskDefinitionKey("modifyApply");
+        disagreeReqVO.setReason("[驳回]" + disagreeReqVO.getReason());
+        disagreeReqVO.setTaskStatus(Integer.valueOf(DictDataConstants.OA_AUDIT_STATUS_RETURNED));
+        taskService.setVariable(disagreeReqVO.getId(), "auditPass", "false");
+        taskService.setVariable(disagreeReqVO.getId(),BpmConstants.PROCESS_INSTANCE_VARIABLE_STATUS, DictDataConstants.OA_AUDIT_STATUS_RETURNED);
+        bpmTaskService.returnTask(loginUserId, disagreeReqVO);
 
         Task nextTask = taskService.createTaskQuery().processInstanceId(currentTask.getProcessInstanceId()).singleResult();
+        Long currentAuditEmployeeId = Long.valueOf(nextTask.getAssignee());
+        AdminUserRespDTO currentAuditEmployee = adminUserApi.getUser(currentAuditEmployeeId);
 
         // 更新单据状态,当前处理人,最后处理时间
         LambdaUpdateWrapper<OaRenewDO> updateWrapper = new LambdaUpdateWrapper<>();
-        updateWrapper.set(OaRenewDO::getCurrentAuditEmployeeId, nextTask.getAssignee())
-                .set(OaRenewDO::getFinalAuditDate, new Date())
-                .set(OaRenewDO::getAuditStatus, "0")
+        updateWrapper.set(OaRenewDO::getCurrentAuditEmployeeId, currentAuditEmployeeId)
+                .set(OaRenewDO::getCurrentAuditEmployeeName, currentAuditEmployee.getNickname())
+                .set(OaRenewDO::getFinalAuditDate, LocalDateTime.now())
+                .set(OaRenewDO::getAuditStatus, DictDataConstants.OA_AUDIT_STATUS_RETURNED)
                 .eq(OaRenewDO::getProcInstId, currentTask.getProcessInstanceId());
         oaRenewMapper.update(updateWrapper);
 
         // 发送通知
 
-        // 返回
         return 1L;
     }
 
     @Override
-    public Long updateCompleteOaRenew(Long userId, OaRenewSaveReqVO createReqVO, BpmTaskApproveReqVO reqVO) {
-        // 判断是否已经发起流程
-        Boolean auditPass = createReqVO.getAuditPass();
+    @Transactional
+    public Long revocationOaRenew(BpmTaskApproveReqVO revocationReqVO) {
+        // 登录人信息
+        Long loginUserId = SecurityFrameworkUtils.getLoginUserId();
+        // TODO DP 根据登录人查询出对应的员工信息
+
+        Task currentTask = bpmTaskService.getTask(revocationReqVO.getId());
+        if (currentTask == null) {
+            throw ServiceExceptionUtil.exception(ErrorCodeConstants.TASK_NOT_EXISTS);
+        }
+        LambdaQueryWrapper<OaRenewDO> lambdaQueryWrapper = new LambdaQueryWrapper<OaRenewDO>()
+                .eq(OaRenewDO::getProcInstId, currentTask.getProcessInstanceId());
+        OaRenewDO oaRenewDO = oaRenewMapper.selectOne(lambdaQueryWrapper);
+        if (!DictDataConstants.OA_AUDIT_STATUS_COMMITTED.equals(oaRenewDO.getAuditStatus())
+                || !Objects.equals(String.valueOf(loginUserId), oaRenewDO.getCreator())) {
+            throw ServiceExceptionUtil.exception(ErrorCodeConstants.TASK_REVOCATION_NOT_ALLOWED);
+        }
 
-        OaRenewDO oaRenew = BeanUtils.toBean(createReqVO, OaRenewDO.class);
+        BpmTaskReturnReqVO returnReqVO = BeanUtils.toBean(revocationReqVO, BpmTaskReturnReqVO.class);
+        returnReqVO.setTargetTaskDefinitionKey("modifyApply");
+        String reason = "[撤回]";
+        if (StrUtil.isNotBlank(returnReqVO.getReason())) {
+            reason = reason + returnReqVO.getReason();
+        }
+        returnReqVO.setReason(reason);
+        returnReqVO.setTaskStatus(Integer.valueOf(DictDataConstants.OA_AUDIT_STATUS_RECALLED));
+        taskService.setVariable(currentTask.getId(),BpmConstants.PROCESS_INSTANCE_VARIABLE_STATUS, DictDataConstants.OA_AUDIT_STATUS_RECALLED);
+        bpmTaskService.revocationTask(loginUserId, returnReqVO);
 
-        Task currentTask = taskService.createTaskQuery().processInstanceId(oaRenew.getProcInstId()).singleResult();
+        Task nextTask = taskService.createTaskQuery().processInstanceId(currentTask.getProcessInstanceId()).singleResult();
+        Long currentAuditEmployeeId = Long.valueOf(nextTask.getAssignee());
+        AdminUserRespDTO currentAuditEmployee = adminUserApi.getUser(currentAuditEmployeeId);
 
-        //审批通过
-        bpmTaskService.approveTask(userId, reqVO);
+        // 更新单据状态,当前处理人,最后处理时间
+        LambdaUpdateWrapper<OaRenewDO> updateWrapper = new LambdaUpdateWrapper<>();
+        updateWrapper.set(OaRenewDO::getCurrentAuditEmployeeId, currentAuditEmployeeId)
+                .set(OaRenewDO::getCurrentAuditEmployeeName, currentAuditEmployee.getNickname())
+                .set(OaRenewDO::getFinalAuditDate, LocalDateTime.now())
+                .set(OaRenewDO::getAuditStatus, DictDataConstants.OA_AUDIT_STATUS_RECALLED)
+                .eq(OaRenewDO::getProcInstId, currentTask.getProcessInstanceId());
+        oaRenewMapper.update(updateWrapper);
 
-        // 提交
-        if (auditPass) {
-            Task nextTask = taskService.createTaskQuery().processInstanceId(currentTask.getProcessInstanceId()).singleResult();
+        // 发送通知
 
-            oaRenew.setAuditStatus("1");
-            oaRenew.setCurrentAuditEmployeeId(Long.valueOf(nextTask.getAssignee()));
-            oaRenew.setFinalAuditDate(LocalDateTime.now());
-            oaRenewMapper.updateById(oaRenew);
+        return 1L;
+    }
 
-        } else {
-            OaRenewDO oaRenewClose = new OaRenewDO();
-            oaRenewClose.setId(oaRenew.getId());
-            oaRenewClose.setAuditStatus("4");
-            oaRenewClose.setCurrentAuditEmployeeId(null);
-            oaRenewClose.setFinalAuditDate(LocalDateTime.now());
-            oaRenewMapper.updateById(oaRenewClose);
+    @Override
+    @Transactional
+    public Long reCommitOaRenew(OaRenewSaveReqVO reCommitReqVO) {
+        if (reCommitReqVO.getId() == null) {
+            throw exception(ErrorCodeConstants.SERVICE_ID_NOT_EXISTS);
+        }
+        // 登录人信息
+        Long loginUserId = SecurityFrameworkUtils.getLoginUserId();
+        AdminUserRespDTO loginUser = adminUserApi.getUser(loginUserId);
+        if (loginUser == null) {
+            throw exception(ErrorCodeConstants.OA_LOGIN_USER_NOT_EXISTS);
+        }
+        // 转正人信息
+        AdminUserRespDTO employee = adminUserApi.getUser(reCommitReqVO.getEmployeeId());
+        if (employee == null) {
+            throw exception(ErrorCodeConstants.OA_EMPLOYEE_NOT_EXISTS);
         }
 
-        return oaRenew.getId();
-    }
+        OaRenewDO oaRenewNew = BeanUtils.toBean(reCommitReqVO, OaRenewDO.class);
+        OaRenewDO oaRenewOld = oaRenewMapper.selectById(oaRenewNew.getId());
+        oaRenewNew.setRenewId(oaRenewOld.getRenewId())
+                .setProcInstId(oaRenewOld.getProcInstId());
+
+        oaRenewNew.setEmployeeId(employee.getId());
+        oaRenewNew.setEmployeeName(employee.getNickname());
+        oaRenewNew.setEmployeePhone(employee.getMobile());
+        oaRenewNew.setDeptId(employee.getDeptId());
+        oaRenewNew.setPosition("员工职位");
+        oaRenewNew.setOldContractStartDate("2023-01-01");
+        oaRenewNew.setOldContractEndDate("2023-12-31");
+        oaRenewNew.setUserId(loginUser.getId());
+        oaRenewNew.setApplyEmployeeId(loginUser.getId());
+        oaRenewNew.setApplyEmployeeName(loginUser.getNickname());
+
+        Task currentTask = taskService.createTaskQuery().processInstanceId(oaRenewNew.getProcInstId()).singleResult();
+        BpmTaskApproveReqVO approveReqVO = new BpmTaskApproveReqVO();
+        approveReqVO.setId(currentTask.getId())
+                .setReason("[再次提交]");
+        approveReqVO.setTaskStatus(Integer.valueOf(DictDataConstants.OA_AUDIT_STATUS_COMMITTED));
+        if (CollectionUtil.isNotEmpty(reCommitReqVO.getStartUserSelectAssignees())) {
+            // 添加审批人信息到流程参数中
+            Map<String, List<Long>> startUserSelectAssignees = new HashMap<>();
+            List<Long> selectAssignees = reCommitReqVO.getStartUserSelectAssignees();
+            startUserSelectAssignees.put("approver", selectAssignees);
+            taskService.setVariable(currentTask.getId(), BpmConstants.PROCESS_INSTANCE_VARIABLE_START_USER_SELECT_ASSIGNEES, startUserSelectAssignees);
+            // 保存审批人信息
+            oaRenewNew.setStartUserSelectAssignees(selectAssignees.stream().map(String::valueOf).collect(Collectors.joining(",")));
+        }
+        taskService.setVariable(currentTask.getId(), "auditPass", "true");
+        taskService.setVariable(currentTask.getId(),BpmConstants.PROCESS_INSTANCE_VARIABLE_STATUS, DictDataConstants.OA_AUDIT_STATUS_COMMITTED);
+        // 再次提交,和审批通过逻辑相同
+        bpmTaskService.approveTask(loginUserId, approveReqVO);
 
+        Task nextTask = taskService.createTaskQuery().processInstanceId(currentTask.getProcessInstanceId()).singleResult();
+        Long currentAuditEmployeeId = Long.valueOf(nextTask.getAssignee());
+        AdminUserRespDTO currentAuditEmployee = adminUserApi.getUser(currentAuditEmployeeId);
+        oaRenewNew.setAuditStatus(DictDataConstants.OA_AUDIT_STATUS_COMMITTED)
+                .setCurrentAuditEmployeeId(currentAuditEmployeeId)
+                .setCurrentAuditEmployeeName(currentAuditEmployee.getNickname())
+                .setFinalAuditDate(LocalDateTime.now());
+        oaRenewMapper.updateById(oaRenewNew);
 
-    @Override
-    public Long createOaRenew(OaRenewSaveReqVO createReqVO) {
-        // 插入
-        OaRenewDO oaRenew = BeanUtils.toBean(createReqVO, OaRenewDO.class);
-        oaRenewMapper.insert(oaRenew);
-        // 返回
-        return oaRenew.getId();
+        // 保存业务uuid到附件中
+        saveFileList(reCommitReqVO.getFileIdList(), oaRenewNew.getRenewId());
+
+        return 1L;
     }
 
     @Override
-    public void updateOaRenew(OaRenewSaveReqVO updateReqVO) {
-        // 校验存在
-        validateOaRenewExists(updateReqVO.getId());
-        // 更新
-        OaRenewDO updateObj = BeanUtils.toBean(updateReqVO, OaRenewDO.class);
-        oaRenewMapper.updateById(updateObj);
+    @Transactional
+    public Long closeOaRenew(Long id) {
+        if (id == null) {
+            throw exception(ErrorCodeConstants.SERVICE_ID_NOT_EXISTS);
+        }
+        // 登录人信息
+        Long loginUserId = SecurityFrameworkUtils.getLoginUserId();
+        // TODO DP 根据登录人查询出对应的员工信息
+
+        OaRenewDO oaRenewDO = oaRenewMapper.selectById(id);
+        if (!DictDataConstants.OA_AUDIT_STATUS_RETURNED.equals(oaRenewDO.getAuditStatus())
+                && !DictDataConstants.OA_AUDIT_STATUS_RECALLED.equals(oaRenewDO.getAuditStatus())) {
+            throw exception(ErrorCodeConstants.TASK_CLOSE_NOT_ALLOWED);
+        }
+
+        Task currentTask = taskService.createTaskQuery().processInstanceId(oaRenewDO.getProcInstId()).singleResult();
+        BpmTaskApproveReqVO approveReqVO = new BpmTaskApproveReqVO();
+        approveReqVO.setId(currentTask.getId())
+                .setReason("[关闭]");
+        approveReqVO.setTaskStatus(Integer.valueOf(DictDataConstants.OA_AUDIT_STATUS_CLOSED));
+        taskService.setVariable(currentTask.getId(), "auditPass", "false");
+        taskService.setVariable(currentTask.getId(),BpmConstants.PROCESS_INSTANCE_VARIABLE_STATUS, DictDataConstants.OA_AUDIT_STATUS_CLOSED);
+        // 关闭,使用审批通过的方法实现
+        bpmTaskService.approveTask(loginUserId, approveReqVO);
+
+        LambdaUpdateWrapper<OaRenewDO> lambdaUpdateWrapper = new LambdaUpdateWrapper<>();
+        lambdaUpdateWrapper.set(OaRenewDO::getAuditStatus, DictDataConstants.OA_AUDIT_STATUS_CLOSED)
+                .set(OaRenewDO::getCurrentAuditEmployeeId, null)
+                .set(OaRenewDO::getCurrentAuditEmployeeName, null)
+                .set(OaRenewDO::getFinalAuditDate, LocalDateTime.now())
+                .eq(OaRenewDO::getId, id);
+        oaRenewMapper.update(lambdaUpdateWrapper);
+        return 1L;
     }
 
     @Override
@@ -234,20 +481,167 @@ public class OaRenewServiceImpl extends ServiceImpl<OaRenewMapper, OaRenewDO> im
         oaRenewMapper.deleteById(id);
     }
 
-    private void validateOaRenewExists(Long id) {
-        if (oaRenewMapper.selectById(id) == null) {
-            throw exception(OA_RENEW_NOT_EXISTS);
+    @Override
+    public OaRenewRespVO getOaRenew(Long id) {
+        // 登录人信息
+        Long loginUserId = SecurityFrameworkUtils.getLoginUserId();
+        // TODO DP 根据登录人查询出对应的员工信息
+
+        OaRenewDO oaRenewDO = oaRenewMapper.selectById(id);
+        OaRenewRespVO oaRenewRespVO = BeanUtils.toBean(oaRenewDO, OaRenewRespVO.class);
+        if (oaRenewDO.getDeptId() != null) {
+            DeptRespDTO dept = deptApi.getDept(oaRenewDO.getDeptId());
+            if (dept != null) {
+                oaRenewRespVO.setDeptName(dept.getName());
+            }
+        }
+
+        String procInstId = oaRenewDO.getProcInstId();
+        if (StrUtil.isNotBlank(procInstId)) {
+            Task task = taskService.createTaskQuery()
+                    .processInstanceId(procInstId)
+                    .taskAssignee(String.valueOf(loginUserId))
+                    .singleResult();
+            if (DictDataConstants.OA_AUDIT_STATUS_COMMITTED.equals(oaRenewDO.getAuditStatus())) {
+                // 如果是已提交,不限制任务处理人是当前登录人,用于直接撤回
+                task = taskService.createTaskQuery()
+                        .processInstanceId(procInstId)
+                        .singleResult();
+            }
+            if (task != null) {
+                oaRenewRespVO.setTaskId(task.getId());
+            }
+        }
+
+        // 附件列表
+        List<FileDTO> fileList = fileApi.getFileDTOListByBiz(oaRenewDO.getRenewId());
+        oaRenewRespVO.setFileList(fileList);
+
+        // 审批记录
+        if (StrUtil.isNotBlank(oaRenewDO.getProcInstId())) {
+            List<BpmTaskRespVO> auditRecordList = bpmTaskService.getAuditRecordListByProcessInstanceId(oaRenewDO.getProcInstId());
+            oaRenewRespVO.setAuditRecordList(auditRecordList);
         }
+
+        // 审批人
+        String startUserSelectAssignees = oaRenewDO.getStartUserSelectAssignees();
+        if (StrUtil.isNotEmpty(startUserSelectAssignees)) {
+            List<Long> userIdList = Arrays.stream(startUserSelectAssignees.split(","))
+                    .map(Long::valueOf).collect(Collectors.toList());
+            List<AdminUserRespDTO> userList = adminUserApi.getUserList(userIdList);
+            List<AdminUserRespDTO> auditUserList = new ArrayList<>();
+            for (Long userId : userIdList) {
+                for (AdminUserRespDTO adminUserRespDTO : userList) {
+                    if (Objects.equals(userId, adminUserRespDTO.getId())) {
+                        auditUserList.add(adminUserRespDTO);
+                        break;
+                    }
+                }
+            }
+            oaRenewRespVO.setAuditUserList(auditUserList);
+        }
+
+        return oaRenewRespVO;
+    }
+
+    @Override
+    public OaRenewRespVO getOaRenewByProcInstId(String procInstId) {
+        OaRenewDO oaRenewDO = oaRenewMapper.selectOne(OaRenewDO::getProcInstId, procInstId);
+        OaRenewRespVO oaRenewRespVO = BeanUtils.toBean(oaRenewDO, OaRenewRespVO.class);
+        if (oaRenewDO.getDeptId() != null) {
+            DeptRespDTO dept = deptApi.getDept(oaRenewDO.getDeptId());
+            if (dept != null) {
+                oaRenewRespVO.setDeptName(dept.getName());
+            }
+        }
+
+        // 附件列表
+        List<FileDTO> fileList = fileApi.getFileDTOListByBiz(oaRenewDO.getRenewId());
+        oaRenewRespVO.setFileList(fileList);
+
+        // 审批记录
+        if (StrUtil.isNotBlank(oaRenewDO.getProcInstId())) {
+            List<BpmTaskRespVO> auditRecordList = bpmTaskService.getAuditRecordListByProcessInstanceId(oaRenewDO.getProcInstId());
+            oaRenewRespVO.setAuditRecordList(auditRecordList);
+        }
+
+        // 审批人
+        String startUserSelectAssignees = oaRenewDO.getStartUserSelectAssignees();
+        if (StrUtil.isNotEmpty(startUserSelectAssignees)) {
+            List<Long> userIdList = Arrays.stream(startUserSelectAssignees.split(","))
+                    .map(Long::valueOf).collect(Collectors.toList());
+            List<AdminUserRespDTO> userList = adminUserApi.getUserList(userIdList);
+            List<AdminUserRespDTO> auditUserList = new ArrayList<>();
+            for (Long userId : userIdList) {
+                for (AdminUserRespDTO adminUserRespDTO : userList) {
+                    if (Objects.equals(userId, adminUserRespDTO.getId())) {
+                        auditUserList.add(adminUserRespDTO);
+                        break;
+                    }
+                }
+            }
+            oaRenewRespVO.setAuditUserList(auditUserList);
+        }
+
+        return oaRenewRespVO;
     }
 
     @Override
-    public OaRenewDO getOaRenew(Long id) {
-        return oaRenewMapper.selectById(id);
+    public PageResult<OaRenewRespVO> getOaRenewPage(OaRenewPageReqVO pageReqVO) {
+        PageResult<OaRenewDO> oaRenewDOPageResult = oaRenewMapper.selectPage(pageReqVO);
+        PageResult<OaRenewRespVO> oaRenewRespVOPageResult = BeanUtils.toBean(oaRenewDOPageResult, OaRenewRespVO.class);
+
+        List<OaRenewRespVO> oaRenewRespVOList = oaRenewRespVOPageResult.getList();
+        if (CollectionUtil.isNotEmpty(oaRenewRespVOList)) {
+            List<Long> employeeIdList = oaRenewRespVOList.stream().map(OaRenewRespVO::getCurrentAuditEmployeeId).collect(Collectors.toList());
+            List<AdminUserRespDTO> employeeList = adminUserApi.getUserList(employeeIdList);
+            for (OaRenewRespVO respVO : oaRenewRespVOList) {
+                for (AdminUserRespDTO employee : employeeList) {
+                    if (respVO.getCurrentAuditEmployeeId() == employee.getId()) {
+                        respVO.setCurrentAuditEmployeeName(employee.getNickname());
+                        break;
+                    }
+                }
+            }
+
+            List<Long> deptIdList = oaRenewRespVOList.stream().map(OaRenewRespVO::getDeptId).collect(Collectors.toList());
+            List<DeptRespDTO> deptList = deptApi.getDeptList(deptIdList);
+            for (OaRenewRespVO respVO : oaRenewRespVOList) {
+                for (DeptRespDTO dept : deptList) {
+                    if (respVO.getDeptId() == dept.getId()) {
+                        respVO.setDeptName(dept.getName());
+                        break;
+                    }
+                }
+            }
+        }
+
+        return oaRenewRespVOPageResult;
     }
 
     @Override
-    public PageResult<OaRenewDO> getOaRenewPage(OaRenewPageReqVO pageReqVO) {
-        return oaRenewMapper.selectPage(pageReqVO);
+    public PageResult<OaRenewRespVO> exportOaRenewExcel(OaRenewPageReqVO pageReqVO) {
+        pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
+        return getOaRenewPage(pageReqVO);
+    }
+
+    private void validateOaRenewExists(Long id) {
+        OaRenewDO oaRenewDO = oaRenewMapper.selectById(id);
+        if (oaRenewDO == null) {
+            throw exception(OA_RENEW_NOT_EXISTS);
+        }
+        if (!DictDataConstants.OA_AUDIT_STATUS_STAGING.equals(oaRenewDO.getAuditStatus())) {
+            throw exception(ErrorCodeConstants.DELETE_FAIL_NOT_STAGING);
+        }
+    }
+
+    /**
+     * 保存业务uuid到附件中
+     */
+    private void saveFileList(List<Long> fileIdList, String serviceId) {
+        if (CollectionUtil.isNotEmpty(fileIdList) && StrUtil.isNotEmpty(serviceId)) {
+            fileApi.updateFileBiz(fileIdList, serviceId);
+        }
     }
 
 }

+ 225 - 225
yudao-module-bpm/yudao-module-bpm-biz/src/test/java/cn/iocoder/yudao/module/bpm/service/oa/renew/OaRenewServiceImplTest.java

@@ -1,225 +1,225 @@
-package cn.iocoder.yudao.module.bpm.service.oa.renew;
-
-import cn.iocoder.yudao.module.bpm.controller.admin.oa.renew.vo.OaRenewPageReqVO;
-import cn.iocoder.yudao.module.bpm.controller.admin.oa.renew.vo.OaRenewSaveReqVO;
-import cn.iocoder.yudao.module.bpm.service.oa.renew.OaRenewServiceImpl;
-import org.junit.jupiter.api.Disabled;
-import org.junit.jupiter.api.Test;
-
-import javax.annotation.Resource;
-
-import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest;
-
-import cn.iocoder.yudao.module.bpm.dal.dataobject.oa.renew.OaRenewDO;
-import cn.iocoder.yudao.module.bpm.dal.mysql.oa.renew.OaRenewMapper;
-import cn.iocoder.yudao.framework.common.pojo.PageResult;
-
-import org.springframework.context.annotation.Import;
-
-import static cn.iocoder.yudao.module.bpm.enums.ErrorCodeConstants.*;
-import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.*;
-import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.*;
-import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.*;
-import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.*;
-import static org.junit.jupiter.api.Assertions.*;
-
-/**
- * {@link OaRenewServiceImpl} 的单元测试类
- *
- * @author dp
- */
-@Import(OaRenewServiceImpl.class)
-public class OaRenewServiceImplTest extends BaseDbUnitTest {
-
-    @Resource
-    private OaRenewServiceImpl oaRenewService;
-
-    @Resource
-    private OaRenewMapper oaRenewMapper;
-
-    @Test
-    public void testCreateOaRenew_success() {
-        // 准备参数
-        OaRenewSaveReqVO createReqVO = randomPojo(OaRenewSaveReqVO.class).setId(null);
-
-        // 调用
-        Long oaRenewId = oaRenewService.createOaRenew(createReqVO);
-        // 断言
-        assertNotNull(oaRenewId);
-        // 校验记录的属性是否正确
-        OaRenewDO oaRenew = oaRenewMapper.selectById(oaRenewId);
-        assertPojoEquals(createReqVO, oaRenew, "id");
-    }
-
-    @Test
-    public void testUpdateOaRenew_success() {
-        // mock 数据
-        OaRenewDO dbOaRenew = randomPojo(OaRenewDO.class);
-        oaRenewMapper.insert(dbOaRenew);// @Sql: 先插入出一条存在的数据
-        // 准备参数
-        OaRenewSaveReqVO updateReqVO = randomPojo(OaRenewSaveReqVO.class, o -> {
-            o.setId(dbOaRenew.getId()); // 设置更新的 ID
-        });
-
-        // 调用
-        oaRenewService.updateOaRenew(updateReqVO);
-        // 校验是否更新正确
-        OaRenewDO oaRenew = oaRenewMapper.selectById(updateReqVO.getId()); // 获取最新的
-        assertPojoEquals(updateReqVO, oaRenew);
-    }
-
-    @Test
-    public void testUpdateOaRenew_notExists() {
-        // 准备参数
-        OaRenewSaveReqVO updateReqVO = randomPojo(OaRenewSaveReqVO.class);
-
-        // 调用, 并断言异常
-        assertServiceException(() -> oaRenewService.updateOaRenew(updateReqVO), OA_RENEW_NOT_EXISTS);
-    }
-
-    @Test
-    public void testDeleteOaRenew_success() {
-        // mock 数据
-        OaRenewDO dbOaRenew = randomPojo(OaRenewDO.class);
-        oaRenewMapper.insert(dbOaRenew);// @Sql: 先插入出一条存在的数据
-        // 准备参数
-        Long id = dbOaRenew.getId();
-
-        // 调用
-        oaRenewService.deleteOaRenew(id);
-       // 校验数据不存在了
-       assertNull(oaRenewMapper.selectById(id));
-    }
-
-    @Test
-    public void testDeleteOaRenew_notExists() {
-        // 准备参数
-        Long id = randomLongId();
-
-        // 调用, 并断言异常
-        assertServiceException(() -> oaRenewService.deleteOaRenew(id), OA_RENEW_NOT_EXISTS);
-    }
-
-    @Test
-    @Disabled  // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解
-    public void testGetOaRenewPage() {
-       // mock 数据
-       OaRenewDO dbOaRenew = randomPojo(OaRenewDO.class, o -> { // 等会查询到
-           o.setRenewId(null);
-           o.setEmployeeId(null);
-           o.setEmployeeUuid(null);
-           o.setEmployeeName(null);
-           o.setUserId(null);
-           o.setUserUuid(null);
-           o.setDeptId(null);
-           o.setDeptUuid(null);
-           o.setPosition(null);
-           o.setOldContractStartDate(null);
-           o.setOldContractEndDate(null);
-           o.setRenewPeriod(null);
-           o.setRenewContractStartDate(null);
-           o.setRenewContractEndDate(null);
-           o.setRenewReason(null);
-           o.setWorkPerformance(null);
-           o.setRemarks(null);
-           o.setProcInstId(null);
-           o.setAuditStatus(null);
-           o.setCurrentAuditUserId(null);
-           o.setCurrentAuditUserUuid(null);
-           o.setCurrentAuditEmployeeId(null);
-           o.setCurrentAuditEmployeeUuid(null);
-           o.setFinalAuditDate(null);
-           o.setInfoSource(null);
-           o.setCreateTime(null);
-       });
-       oaRenewMapper.insert(dbOaRenew);
-       // 测试 renewId 不匹配
-       oaRenewMapper.insert(cloneIgnoreId(dbOaRenew, o -> o.setRenewId(null)));
-       // 测试 employeeId 不匹配
-       oaRenewMapper.insert(cloneIgnoreId(dbOaRenew, o -> o.setEmployeeId(null)));
-       // 测试 employeeUuid 不匹配
-       oaRenewMapper.insert(cloneIgnoreId(dbOaRenew, o -> o.setEmployeeUuid(null)));
-       // 测试 employeeName 不匹配
-       oaRenewMapper.insert(cloneIgnoreId(dbOaRenew, o -> o.setEmployeeName(null)));
-       // 测试 userId 不匹配
-       oaRenewMapper.insert(cloneIgnoreId(dbOaRenew, o -> o.setUserId(null)));
-       // 测试 userUuid 不匹配
-       oaRenewMapper.insert(cloneIgnoreId(dbOaRenew, o -> o.setUserUuid(null)));
-       // 测试 deptId 不匹配
-       oaRenewMapper.insert(cloneIgnoreId(dbOaRenew, o -> o.setDeptId(null)));
-       // 测试 deptUuid 不匹配
-       oaRenewMapper.insert(cloneIgnoreId(dbOaRenew, o -> o.setDeptUuid(null)));
-       // 测试 position 不匹配
-       oaRenewMapper.insert(cloneIgnoreId(dbOaRenew, o -> o.setPosition(null)));
-       // 测试 oldContractStartDate 不匹配
-       oaRenewMapper.insert(cloneIgnoreId(dbOaRenew, o -> o.setOldContractStartDate(null)));
-       // 测试 oldContractEndDate 不匹配
-       oaRenewMapper.insert(cloneIgnoreId(dbOaRenew, o -> o.setOldContractEndDate(null)));
-       // 测试 renewPeriod 不匹配
-       oaRenewMapper.insert(cloneIgnoreId(dbOaRenew, o -> o.setRenewPeriod(null)));
-       // 测试 renewContractStartDate 不匹配
-       oaRenewMapper.insert(cloneIgnoreId(dbOaRenew, o -> o.setRenewContractStartDate(null)));
-       // 测试 renewContractEndDate 不匹配
-       oaRenewMapper.insert(cloneIgnoreId(dbOaRenew, o -> o.setRenewContractEndDate(null)));
-       // 测试 renewReason 不匹配
-       oaRenewMapper.insert(cloneIgnoreId(dbOaRenew, o -> o.setRenewReason(null)));
-       // 测试 workPerformance 不匹配
-       oaRenewMapper.insert(cloneIgnoreId(dbOaRenew, o -> o.setWorkPerformance(null)));
-       // 测试 remarks 不匹配
-       oaRenewMapper.insert(cloneIgnoreId(dbOaRenew, o -> o.setRemarks(null)));
-       // 测试 procInstId 不匹配
-       oaRenewMapper.insert(cloneIgnoreId(dbOaRenew, o -> o.setProcInstId(null)));
-       // 测试 auditStatus 不匹配
-       oaRenewMapper.insert(cloneIgnoreId(dbOaRenew, o -> o.setAuditStatus(null)));
-       // 测试 currentAuditUserId 不匹配
-       oaRenewMapper.insert(cloneIgnoreId(dbOaRenew, o -> o.setCurrentAuditUserId(null)));
-       // 测试 currentAuditUserUuid 不匹配
-       oaRenewMapper.insert(cloneIgnoreId(dbOaRenew, o -> o.setCurrentAuditUserUuid(null)));
-       // 测试 currentAuditEmployeeId 不匹配
-       oaRenewMapper.insert(cloneIgnoreId(dbOaRenew, o -> o.setCurrentAuditEmployeeId(null)));
-       // 测试 currentAuditEmployeeUuid 不匹配
-       oaRenewMapper.insert(cloneIgnoreId(dbOaRenew, o -> o.setCurrentAuditEmployeeUuid(null)));
-       // 测试 finalAuditDate 不匹配
-       oaRenewMapper.insert(cloneIgnoreId(dbOaRenew, o -> o.setFinalAuditDate(null)));
-       // 测试 infoSource 不匹配
-       oaRenewMapper.insert(cloneIgnoreId(dbOaRenew, o -> o.setInfoSource(null)));
-       // 测试 createTime 不匹配
-       oaRenewMapper.insert(cloneIgnoreId(dbOaRenew, o -> o.setCreateTime(null)));
-       // 准备参数
-       OaRenewPageReqVO reqVO = new OaRenewPageReqVO();
-       reqVO.setRenewId(null);
-       reqVO.setEmployeeId(null);
-       reqVO.setEmployeeUuid(null);
-       reqVO.setEmployeeName(null);
-       reqVO.setUserId(null);
-       reqVO.setUserUuid(null);
-       reqVO.setDeptId(null);
-       reqVO.setDeptUuid(null);
-       reqVO.setPosition(null);
-       reqVO.setOldContractStartDate(null);
-       reqVO.setOldContractEndDate(null);
-       reqVO.setRenewPeriod(null);
-       reqVO.setRenewContractStartDate(null);
-       reqVO.setRenewContractEndDate(null);
-       reqVO.setRenewReason(null);
-       reqVO.setWorkPerformance(null);
-       reqVO.setRemarks(null);
-       reqVO.setProcInstId(null);
-       reqVO.setAuditStatus(null);
-       reqVO.setCurrentAuditUserId(null);
-       reqVO.setCurrentAuditUserUuid(null);
-       reqVO.setCurrentAuditEmployeeId(null);
-       reqVO.setCurrentAuditEmployeeUuid(null);
-       reqVO.setFinalAuditDate(buildBetweenTime(2023, 2, 1, 2023, 2, 28));
-       reqVO.setInfoSource(null);
-       reqVO.setCreateTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28));
-
-       // 调用
-       PageResult<OaRenewDO> pageResult = oaRenewService.getOaRenewPage(reqVO);
-       // 断言
-       assertEquals(1, pageResult.getTotal());
-       assertEquals(1, pageResult.getList().size());
-       assertPojoEquals(dbOaRenew, pageResult.getList().get(0));
-    }
-
-}
+// package cn.iocoder.yudao.module.bpm.service.oa.renew;
+//
+// import cn.iocoder.yudao.module.bpm.controller.admin.oa.renew.vo.OaRenewPageReqVO;
+// import cn.iocoder.yudao.module.bpm.controller.admin.oa.renew.vo.OaRenewSaveReqVO;
+// import cn.iocoder.yudao.module.bpm.service.oa.renew.OaRenewServiceImpl;
+// import org.junit.jupiter.api.Disabled;
+// import org.junit.jupiter.api.Test;
+//
+// import javax.annotation.Resource;
+//
+// import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest;
+//
+// import cn.iocoder.yudao.module.bpm.dal.dataobject.oa.renew.OaRenewDO;
+// import cn.iocoder.yudao.module.bpm.dal.mysql.oa.renew.OaRenewMapper;
+// import cn.iocoder.yudao.framework.common.pojo.PageResult;
+//
+// import org.springframework.context.annotation.Import;
+//
+// import static cn.iocoder.yudao.module.bpm.enums.ErrorCodeConstants.*;
+// import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.*;
+// import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.*;
+// import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.*;
+// import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.*;
+// import static org.junit.jupiter.api.Assertions.*;
+//
+// /**
+//  * {@link OaRenewServiceImpl} 的单元测试类
+//  *
+//  * @author dp
+//  */
+// @Import(OaRenewServiceImpl.class)
+// public class OaRenewServiceImplTest extends BaseDbUnitTest {
+//
+//     @Resource
+//     private OaRenewServiceImpl oaRenewService;
+//
+//     @Resource
+//     private OaRenewMapper oaRenewMapper;
+//
+//     @Test
+//     public void testCreateOaRenew_success() {
+//         // 准备参数
+//         OaRenewSaveReqVO createReqVO = randomPojo(OaRenewSaveReqVO.class).setId(null);
+//
+//         // 调用
+//         Long oaRenewId = oaRenewService.createOaRenew(createReqVO);
+//         // 断言
+//         assertNotNull(oaRenewId);
+//         // 校验记录的属性是否正确
+//         OaRenewDO oaRenew = oaRenewMapper.selectById(oaRenewId);
+//         assertPojoEquals(createReqVO, oaRenew, "id");
+//     }
+//
+//     @Test
+//     public void testUpdateOaRenew_success() {
+//         // mock 数据
+//         OaRenewDO dbOaRenew = randomPojo(OaRenewDO.class);
+//         oaRenewMapper.insert(dbOaRenew);// @Sql: 先插入出一条存在的数据
+//         // 准备参数
+//         OaRenewSaveReqVO updateReqVO = randomPojo(OaRenewSaveReqVO.class, o -> {
+//             o.setId(dbOaRenew.getId()); // 设置更新的 ID
+//         });
+//
+//         // 调用
+//         oaRenewService.updateOaRenew(updateReqVO);
+//         // 校验是否更新正确
+//         OaRenewDO oaRenew = oaRenewMapper.selectById(updateReqVO.getId()); // 获取最新的
+//         assertPojoEquals(updateReqVO, oaRenew);
+//     }
+//
+//     @Test
+//     public void testUpdateOaRenew_notExists() {
+//         // 准备参数
+//         OaRenewSaveReqVO updateReqVO = randomPojo(OaRenewSaveReqVO.class);
+//
+//         // 调用, 并断言异常
+//         assertServiceException(() -> oaRenewService.updateOaRenew(updateReqVO), OA_RENEW_NOT_EXISTS);
+//     }
+//
+//     @Test
+//     public void testDeleteOaRenew_success() {
+//         // mock 数据
+//         OaRenewDO dbOaRenew = randomPojo(OaRenewDO.class);
+//         oaRenewMapper.insert(dbOaRenew);// @Sql: 先插入出一条存在的数据
+//         // 准备参数
+//         Long id = dbOaRenew.getId();
+//
+//         // 调用
+//         oaRenewService.deleteOaRenew(id);
+//        // 校验数据不存在了
+//        assertNull(oaRenewMapper.selectById(id));
+//     }
+//
+//     @Test
+//     public void testDeleteOaRenew_notExists() {
+//         // 准备参数
+//         Long id = randomLongId();
+//
+//         // 调用, 并断言异常
+//         assertServiceException(() -> oaRenewService.deleteOaRenew(id), OA_RENEW_NOT_EXISTS);
+//     }
+//
+//     @Test
+//     @Disabled  // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解
+//     public void testGetOaRenewPage() {
+//        // mock 数据
+//        OaRenewDO dbOaRenew = randomPojo(OaRenewDO.class, o -> { // 等会查询到
+//            o.setRenewId(null);
+//            o.setEmployeeId(null);
+//            o.setEmployeeUuid(null);
+//            o.setEmployeeName(null);
+//            o.setUserId(null);
+//            o.setUserUuid(null);
+//            o.setDeptId(null);
+//            o.setDeptUuid(null);
+//            o.setPosition(null);
+//            o.setOldContractStartDate(null);
+//            o.setOldContractEndDate(null);
+//            o.setRenewPeriod(null);
+//            o.setRenewContractStartDate(null);
+//            o.setRenewContractEndDate(null);
+//            o.setRenewReason(null);
+//            o.setWorkPerformance(null);
+//            o.setRemarks(null);
+//            o.setProcInstId(null);
+//            o.setAuditStatus(null);
+//            o.setCurrentAuditUserId(null);
+//            o.setCurrentAuditUserUuid(null);
+//            o.setCurrentAuditEmployeeId(null);
+//            o.setCurrentAuditEmployeeUuid(null);
+//            o.setFinalAuditDate(null);
+//            o.setInfoSource(null);
+//            o.setCreateTime(null);
+//        });
+//        oaRenewMapper.insert(dbOaRenew);
+//        // 测试 renewId 不匹配
+//        oaRenewMapper.insert(cloneIgnoreId(dbOaRenew, o -> o.setRenewId(null)));
+//        // 测试 employeeId 不匹配
+//        oaRenewMapper.insert(cloneIgnoreId(dbOaRenew, o -> o.setEmployeeId(null)));
+//        // 测试 employeeUuid 不匹配
+//        oaRenewMapper.insert(cloneIgnoreId(dbOaRenew, o -> o.setEmployeeUuid(null)));
+//        // 测试 employeeName 不匹配
+//        oaRenewMapper.insert(cloneIgnoreId(dbOaRenew, o -> o.setEmployeeName(null)));
+//        // 测试 userId 不匹配
+//        oaRenewMapper.insert(cloneIgnoreId(dbOaRenew, o -> o.setUserId(null)));
+//        // 测试 userUuid 不匹配
+//        oaRenewMapper.insert(cloneIgnoreId(dbOaRenew, o -> o.setUserUuid(null)));
+//        // 测试 deptId 不匹配
+//        oaRenewMapper.insert(cloneIgnoreId(dbOaRenew, o -> o.setDeptId(null)));
+//        // 测试 deptUuid 不匹配
+//        oaRenewMapper.insert(cloneIgnoreId(dbOaRenew, o -> o.setDeptUuid(null)));
+//        // 测试 position 不匹配
+//        oaRenewMapper.insert(cloneIgnoreId(dbOaRenew, o -> o.setPosition(null)));
+//        // 测试 oldContractStartDate 不匹配
+//        oaRenewMapper.insert(cloneIgnoreId(dbOaRenew, o -> o.setOldContractStartDate(null)));
+//        // 测试 oldContractEndDate 不匹配
+//        oaRenewMapper.insert(cloneIgnoreId(dbOaRenew, o -> o.setOldContractEndDate(null)));
+//        // 测试 renewPeriod 不匹配
+//        oaRenewMapper.insert(cloneIgnoreId(dbOaRenew, o -> o.setRenewPeriod(null)));
+//        // 测试 renewContractStartDate 不匹配
+//        oaRenewMapper.insert(cloneIgnoreId(dbOaRenew, o -> o.setRenewContractStartDate(null)));
+//        // 测试 renewContractEndDate 不匹配
+//        oaRenewMapper.insert(cloneIgnoreId(dbOaRenew, o -> o.setRenewContractEndDate(null)));
+//        // 测试 renewReason 不匹配
+//        oaRenewMapper.insert(cloneIgnoreId(dbOaRenew, o -> o.setRenewReason(null)));
+//        // 测试 workPerformance 不匹配
+//        oaRenewMapper.insert(cloneIgnoreId(dbOaRenew, o -> o.setWorkPerformance(null)));
+//        // 测试 remarks 不匹配
+//        oaRenewMapper.insert(cloneIgnoreId(dbOaRenew, o -> o.setRemarks(null)));
+//        // 测试 procInstId 不匹配
+//        oaRenewMapper.insert(cloneIgnoreId(dbOaRenew, o -> o.setProcInstId(null)));
+//        // 测试 auditStatus 不匹配
+//        oaRenewMapper.insert(cloneIgnoreId(dbOaRenew, o -> o.setAuditStatus(null)));
+//        // 测试 currentAuditUserId 不匹配
+//        oaRenewMapper.insert(cloneIgnoreId(dbOaRenew, o -> o.setCurrentAuditUserId(null)));
+//        // 测试 currentAuditUserUuid 不匹配
+//        oaRenewMapper.insert(cloneIgnoreId(dbOaRenew, o -> o.setCurrentAuditUserUuid(null)));
+//        // 测试 currentAuditEmployeeId 不匹配
+//        oaRenewMapper.insert(cloneIgnoreId(dbOaRenew, o -> o.setCurrentAuditEmployeeId(null)));
+//        // 测试 currentAuditEmployeeUuid 不匹配
+//        oaRenewMapper.insert(cloneIgnoreId(dbOaRenew, o -> o.setCurrentAuditEmployeeUuid(null)));
+//        // 测试 finalAuditDate 不匹配
+//        oaRenewMapper.insert(cloneIgnoreId(dbOaRenew, o -> o.setFinalAuditDate(null)));
+//        // 测试 infoSource 不匹配
+//        oaRenewMapper.insert(cloneIgnoreId(dbOaRenew, o -> o.setInfoSource(null)));
+//        // 测试 createTime 不匹配
+//        oaRenewMapper.insert(cloneIgnoreId(dbOaRenew, o -> o.setCreateTime(null)));
+//        // 准备参数
+//        OaRenewPageReqVO reqVO = new OaRenewPageReqVO();
+//        reqVO.setRenewId(null);
+//        reqVO.setEmployeeId(null);
+//        reqVO.setEmployeeUuid(null);
+//        reqVO.setEmployeeName(null);
+//        reqVO.setUserId(null);
+//        reqVO.setUserUuid(null);
+//        reqVO.setDeptId(null);
+//        reqVO.setDeptUuid(null);
+//        reqVO.setPosition(null);
+//        reqVO.setOldContractStartDate(null);
+//        reqVO.setOldContractEndDate(null);
+//        reqVO.setRenewPeriod(null);
+//        reqVO.setRenewContractStartDate(null);
+//        reqVO.setRenewContractEndDate(null);
+//        reqVO.setRenewReason(null);
+//        reqVO.setWorkPerformance(null);
+//        reqVO.setRemarks(null);
+//        reqVO.setProcInstId(null);
+//        reqVO.setAuditStatus(null);
+//        reqVO.setCurrentAuditUserId(null);
+//        reqVO.setCurrentAuditUserUuid(null);
+//        reqVO.setCurrentAuditEmployeeId(null);
+//        reqVO.setCurrentAuditEmployeeUuid(null);
+//        reqVO.setFinalAuditDate(buildBetweenTime(2023, 2, 1, 2023, 2, 28));
+//        reqVO.setInfoSource(null);
+//        reqVO.setCreateTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28));
+//
+//        // 调用
+//        PageResult<OaRenewDO> pageResult = oaRenewService.getOaRenewPage(reqVO);
+//        // 断言
+//        assertEquals(1, pageResult.getTotal());
+//        assertEquals(1, pageResult.getList().size());
+//        assertPojoEquals(dbOaRenew, pageResult.getList().get(0));
+//     }
+//
+// }