From 06b2c7348c49864a47b4964d4d0d09f2f1bc1da7 Mon Sep 17 00:00:00 2001 From: chen <1251790704@qq.com> Date: Fri, 19 Mar 2021 10:57:29 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8B=85=E4=BF=9D=E5=87=BD=E5=A4=9A=E8=A7=92?= =?UTF-8?q?=E8=89=B2=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../model/request/CopySendRequest.java | 4 + ...gGuaranteeLetterAssignUserServiceImpl.java | 1367 +++++++++-------- 2 files changed, 726 insertions(+), 645 deletions(-) diff --git a/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/model/request/CopySendRequest.java b/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/model/request/CopySendRequest.java index 55b011ca..21b09db5 100644 --- a/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/model/request/CopySendRequest.java +++ b/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/model/request/CopySendRequest.java @@ -2,6 +2,8 @@ package com.daqing.financial.guarantee.model.request; import lombok.Data; +import javax.validation.constraints.NotNull; + /** * @Author chen * @DATE 2021/1/18 16:15 @@ -10,8 +12,10 @@ import lombok.Data; @Data public class CopySendRequest { + @NotNull private Integer businessId; + @NotNull private Integer processId; private String imgData; diff --git a/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/service/impl/DgGuaranteeLetterAssignUserServiceImpl.java b/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/service/impl/DgGuaranteeLetterAssignUserServiceImpl.java index ca99b795..ff9d8c9c 100644 --- a/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/service/impl/DgGuaranteeLetterAssignUserServiceImpl.java +++ b/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/service/impl/DgGuaranteeLetterAssignUserServiceImpl.java @@ -1,5 +1,6 @@ package com.daqing.financial.guarantee.service.impl; +import cn.hutool.core.util.ObjectUtil; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; @@ -118,6 +119,685 @@ public class DgGuaranteeLetterAssignUserServiceImpl extends ServiceImpl 0; } + /** + * 法规部经理操作 + */ + private boolean regulatoryDepartmentManagerOperating(Integer businessId,Integer currentUser,String auditOpinion,Integer status){ + //更新之前,获取此数据的审批状态,如果审批状态为驳回,则更新ab角用户数据,如果审批状态为审批中,则添加ab角用户数据 + QueryWrapper queryWrapperTemp = new QueryWrapper<>(); + queryWrapperTemp.eq("business_id",businessId).eq("role_id",PromptSuccess.FG_JL_ID); + DgGuaranteeLetterAssignUser guaranteeLetterAssignUserTemp = baseMapper.selectOne(queryWrapperTemp); + Integer approveStatus = guaranteeLetterAssignUserTemp.getStatus(); + + //之前状态为审批中,同意确定生成担保函,添加数据给指派的AB角用户 + if (StatusCode.SP_IN_REVIEW.equals(approveStatus) && StatusCode.SP_REVIEWED.equals(status)){ + //根据角色及业务id查询需要更新数据 + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("business_id",businessId).eq("role_id",PromptSuccess.FG_JL_ID); + DgGuaranteeLetterAssignUser guaranteeLetterAssignUser = baseMapper.selectOne(queryWrapper); + //操作用户为当前用户 + guaranteeLetterAssignUser.setUserId(currentUser); + guaranteeLetterAssignUser.setOperatingStatus(StatusCode.CZ_PROCESSED); + guaranteeLetterAssignUser.setAuditOpinion(auditOpinion); + //获取公司id + Integer companyId = guaranteeLetterAssignUser.getCompanyId(); + //根据当前用户更新审核状态和操作状态及审核意见 + int i = baseMapper.updateById(guaranteeLetterAssignUser); + //同时往审核流程进程表新增一条记录 + String account = DgApplyAmountInfoController.getAccount(); + String departmentId = OrdinaryUtil.getDepartmentId(currentUser); + AuditProcessUtil.save(currentUser,businessId,account,departmentId, + auditOpinion,8,PromptSuccess.FG_JL_ID,"","","",status); + //更新成功,添加ab角数据 + if (i > 0){ + //获取之前指定的a角用户 + QueryWrapper wrapperA = new QueryWrapper<>(); + wrapperA.eq("business_id",businessId).eq("role_id",PromptSuccess.DB_A_ID); + DgGuaranteeAssignUser dgGuaranteeAssignUserA = guaranteeAssignUserMapper.selectOne(wrapperA); + Integer userA = dgGuaranteeAssignUserA.getEmpId(); + DgGuaranteeLetterAssignUser guaranteeLetterUser = new DgGuaranteeLetterAssignUser(); + //根据业务id查询A用户数据 + QueryWrapper guaranteeLetterAssignUserQueryWrapperA = new QueryWrapper<>(); + guaranteeLetterAssignUserQueryWrapperA.eq("business_id",businessId).eq("role_id",PromptSuccess.DB_A_ID); + DgGuaranteeLetterAssignUser dgGuaranteeLetterAssignUserA = baseMapper.selectOne(guaranteeLetterAssignUserQueryWrapperA); + //如果a角数据不存在,则进行添加 + if (dgGuaranteeLetterAssignUserA==null){ + //添加a角 + guaranteeLetterUser.setRoleId(PromptSuccess.DB_A_ID); + guaranteeLetterUser.setUserId(userA); + guaranteeLetterUser.setBusinessId(businessId); + guaranteeLetterUser.setCompanyId(companyId); + baseMapper.insert(guaranteeLetterUser); + }else { + //存在则进行更新 + dgGuaranteeLetterAssignUserA.setStatus(StatusCode.SP_IN_REVIEW); + dgGuaranteeLetterAssignUserA.setOperatingStatus(StatusCode.CZ_ON_HAND); + //清空上次的审批意见 + dgGuaranteeLetterAssignUserA.setAuditOpinion(""); + baseMapper.updateById(dgGuaranteeLetterAssignUserA); + } + + //获取之前指定的b角用户 + QueryWrapper wrapperB = new QueryWrapper<>(); + wrapperB.eq("business_id",businessId).eq("role_id",PromptSuccess.DB_B_ID); + DgGuaranteeAssignUser dgGuaranteeAssignUserB = guaranteeAssignUserMapper.selectOne(wrapperB); + Integer userB = dgGuaranteeAssignUserB.getEmpId(); + int insert = 0; + //根据业务id查询B用户数据 + QueryWrapper guaranteeLetterAssignUserQueryWrapperB = new QueryWrapper<>(); + guaranteeLetterAssignUserQueryWrapperB.eq("business_id",businessId).eq("role_id",PromptSuccess.DB_B_ID); + DgGuaranteeLetterAssignUser dgGuaranteeLetterAssignUserB = baseMapper.selectOne(guaranteeLetterAssignUserQueryWrapperB); + if (dgGuaranteeLetterAssignUserB==null){ + //添加b角 + guaranteeLetterUser.setUserId(userB); + guaranteeLetterUser.setRoleId(PromptSuccess.DB_B_ID); + insert = baseMapper.insert(guaranteeLetterUser); + }else { + dgGuaranteeLetterAssignUserB.setStatus(StatusCode.SP_IN_REVIEW); + dgGuaranteeLetterAssignUserB.setOperatingStatus(StatusCode.CZ_ON_HAND); + //清空上次的审批意见 + dgGuaranteeLetterAssignUserB.setAuditOpinion(""); + insert = baseMapper.updateById(dgGuaranteeLetterAssignUserB); + } + //更新成功,返回操作结果 + log.info(insert > 0 ? "法规部经理成功生成担保函" : "法规部经理生成担保函失败"); + return insert > 0; + } + } + + //之前状态为驳回,同意确定生成担保函,更新数据给指派的AB角用户 + if (StatusCode.SP_REJECT.equals(approveStatus) && StatusCode.SP_REVIEWED.equals(status)){ + //根据角色及业务id查询需要更新数据 + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("business_id",businessId).eq("role_id",PromptSuccess.FG_JL_ID); + DgGuaranteeLetterAssignUser guaranteeLetterAssignUser = baseMapper.selectOne(queryWrapper); + //操作用户为当前用户 + guaranteeLetterAssignUser.setUserId(currentUser); + guaranteeLetterAssignUser.setStatus(StatusCode.SP_IN_REVIEW); + guaranteeLetterAssignUser.setOperatingStatus(StatusCode.CZ_PROCESSED); + guaranteeLetterAssignUser.setAuditOpinion(auditOpinion); + //根据当前用户更新审核状态和操作状态及审核意见 + int i = baseMapper.updateById(guaranteeLetterAssignUser); + //同时往审核流程进程表新增一条记录 + String account = DgApplyAmountInfoController.getAccount(); + String departmentId = OrdinaryUtil.getDepartmentId(currentUser); + AuditProcessUtil.save(currentUser,businessId,account,departmentId, + auditOpinion,8,PromptSuccess.FG_JL_ID,"","","",status); + //更新成功,更新ab角数据及资产部经理数据 + if (i > 0){ + //更新a角 + //根据业务id查询A用户数据 + QueryWrapper guaranteeLetterAssignUserQueryWrapperA = new QueryWrapper<>(); + guaranteeLetterAssignUserQueryWrapperA.eq("business_id",businessId).eq("role_id",PromptSuccess.DB_A_ID); + DgGuaranteeLetterAssignUser dgGuaranteeLetterAssignUserA = baseMapper.selectOne(guaranteeLetterAssignUserQueryWrapperA); + dgGuaranteeLetterAssignUserA.setStatus(StatusCode.SP_IN_REVIEW); + dgGuaranteeLetterAssignUserA.setOperatingStatus(StatusCode.CZ_ON_HAND); + //清空上次的审批意见 + dgGuaranteeLetterAssignUserA.setAuditOpinion(""); + baseMapper.updateById(dgGuaranteeLetterAssignUserA); + + //更新b角 + //根据业务id查询B用户数据 + QueryWrapper guaranteeLetterAssignUserQueryWrapperB = new QueryWrapper<>(); + guaranteeLetterAssignUserQueryWrapperB.eq("business_id",businessId).eq("role_id",PromptSuccess.DB_B_ID); + DgGuaranteeLetterAssignUser dgGuaranteeLetterAssignUserB = baseMapper.selectOne(guaranteeLetterAssignUserQueryWrapperB); + dgGuaranteeLetterAssignUserB.setStatus(StatusCode.SP_IN_REVIEW); + dgGuaranteeLetterAssignUserB.setOperatingStatus(StatusCode.CZ_ON_HAND); + //清空上次的审批意见 + dgGuaranteeLetterAssignUserB.setAuditOpinion(""); + int update = baseMapper.updateById(dgGuaranteeLetterAssignUserB); + + //更新资产部经理 + //根据业务id查询资产部经理数据 + QueryWrapper guaranteeLetterAssignUserQueryWrapperZc = new QueryWrapper<>(); + guaranteeLetterAssignUserQueryWrapperZc.eq("business_id",businessId).eq("role_id",PromptSuccess.ZC_JL_ID); + DgGuaranteeLetterAssignUser dgGuaranteeLetterAssignUserZc = baseMapper.selectOne(guaranteeLetterAssignUserQueryWrapperZc); + //查询为空不作操作 + if (dgGuaranteeLetterAssignUserZc!=null){ + dgGuaranteeLetterAssignUserZc.setStatus(StatusCode.SP_IN_REVIEW); + dgGuaranteeLetterAssignUserZc.setOperatingStatus(StatusCode.CZ_ON_HAND); + //清空上次的审批意见 + dgGuaranteeLetterAssignUserZc.setAuditOpinion(""); + baseMapper.updateById(dgGuaranteeLetterAssignUserZc); + } + //更新成功,返回操作结果 + log.info(update > 0 ? "驳回后法规部经理成功生成担保函" : "驳回后法规部经理生成担保函失败"); + return update > 0; + } + } + + //驳回操作,更新数据及更新贷审会数据 + if (StatusCode.SP_REJECT.equals(status)){ + //根据角色及业务id查询需要更新数据 + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("business_id",businessId).eq("role_id",PromptSuccess.FG_JL_ID); + DgGuaranteeLetterAssignUser guaranteeLetterAssignUser = baseMapper.selectOne(queryWrapper); + //操作用户为当前用户 + guaranteeLetterAssignUser.setUserId(currentUser); + guaranteeLetterAssignUser.setStatus(StatusCode.SP_REJECT); + guaranteeLetterAssignUser.setOperatingStatus(StatusCode.CZ_PROCESSED); + guaranteeLetterAssignUser.setAuditOpinion(auditOpinion); + //根据当前用户更新审核状态和操作状态及审核意见 + int i = baseMapper.updateById(guaranteeLetterAssignUser); + //同时往审核流程进程表新增一条记录 + String account = DgApplyAmountInfoController.getAccount(); + String departmentId = OrdinaryUtil.getDepartmentId(currentUser); + AuditProcessUtil.save(currentUser,businessId,account,departmentId, + auditOpinion,8,PromptSuccess.FG_JL_ID,"","","",status); + //更新成功,更新贷审会数据 + if (i > 0){ + //根据业务id查询贷审会数据 + QueryWrapper loanCommitteeConsiderQueryWrapper = new QueryWrapper<>(); + loanCommitteeConsiderQueryWrapper.eq("business_id",businessId); + DgLoanCommitteeConsider loanCommitteeConsider = dgLoanCommitteeConsiderMapper.selectOne(loanCommitteeConsiderQueryWrapper); + loanCommitteeConsider.setStatus(StatusCode.SP_REJECT); + loanCommitteeConsider.setOperatingStatus(StatusCode.CZ_ON_HAND); + int update = dgLoanCommitteeConsiderMapper.updateById(loanCommitteeConsider); + //更新成功,返回操作结果 + log.info(update > 0 ? "法规部经理成功驳回" : "法规部经理驳回失败"); + return update > 0; + } + } + //其他情况均为失败 + return false; + } + + /** + * 资产部经理操作 + */ + private boolean assetManagerOperating(Integer businessId,Integer currentUser,String auditOpinion,Integer status){ + //更新之前,获取此数据的审批状态,如果审批状态为驳回,则更新回款确认数据,如果审批状态为审批中,则添加回款确认数据 + QueryWrapper queryWrapperTemp = new QueryWrapper<>(); + queryWrapperTemp.eq("business_id",businessId).eq("role_id",PromptSuccess.ZC_JL_ID); + DgGuaranteeLetterAssignUser guaranteeLetterAssignUserTemp = baseMapper.selectOne(queryWrapperTemp); + Integer approveStatus = guaranteeLetterAssignUserTemp.getStatus(); + + //之前状态为审批中,资产部经理确认担保函,往回款确认添加数据 + if (StatusCode.SP_REVIEWED.equals(status) && StatusCode.SP_IN_REVIEW.equals(approveStatus)){ + //根据角色及业务id查询需要更新数据 + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("business_id",businessId).eq("role_id",PromptSuccess.ZC_JL_ID); + DgGuaranteeLetterAssignUser guaranteeLetterAssignUser = baseMapper.selectOne(queryWrapper); + //操作用户为当前用户 + guaranteeLetterAssignUser.setUserId(currentUser); + guaranteeLetterAssignUser.setStatus(StatusCode.SP_REVIEWED); + guaranteeLetterAssignUser.setOperatingStatus(StatusCode.CZ_PROCESSED); + guaranteeLetterAssignUser.setAuditOpinion(auditOpinion); + //根据当前用户更新审核状态和操作状态及审核意见 + int i = baseMapper.updateById(guaranteeLetterAssignUser); + //同时往审核流程进程表新增一条记录 + String account = DgApplyAmountInfoController.getAccount(); + String departmentId = OrdinaryUtil.getDepartmentId(currentUser); + AuditProcessUtil.save(currentUser,businessId,account,departmentId, + auditOpinion,8,PromptSuccess.ZC_JL_ID,"","","",status); + //获取公司id + Integer companyId = guaranteeLetterAssignUser.getCompanyId(); + //更新成功,添加回款确认数据及更新整个业务的审核状态 + if (i > 0){ + //更新法规部经理数据 + //根据业务id查询法规部经理数据 + QueryWrapper guaranteeLetterAssignUserQueryWrapperFg = new QueryWrapper<>(); + guaranteeLetterAssignUserQueryWrapperFg.eq("business_id",businessId).eq("role_id",PromptSuccess.FG_JL_ID); + DgGuaranteeLetterAssignUser dgGuaranteeLetterAssignUserFg = baseMapper.selectOne(guaranteeLetterAssignUserQueryWrapperFg); + dgGuaranteeLetterAssignUserFg.setStatus(StatusCode.SP_REVIEWED); + baseMapper.updateById(dgGuaranteeLetterAssignUserFg); + + //更新a角 + //根据业务id查询A用户数据 + QueryWrapper guaranteeLetterAssignUserQueryWrapperA = new QueryWrapper<>(); + guaranteeLetterAssignUserQueryWrapperA.eq("business_id",businessId).eq("role_id",PromptSuccess.DB_A_ID); + DgGuaranteeLetterAssignUser dgGuaranteeLetterAssignUserA = baseMapper.selectOne(guaranteeLetterAssignUserQueryWrapperA); + dgGuaranteeLetterAssignUserA.setStatus(StatusCode.SP_REVIEWED); + baseMapper.updateById(dgGuaranteeLetterAssignUserA); + + //更新b角 + //根据业务id查询B用户数据 + QueryWrapper guaranteeLetterAssignUserQueryWrapperB = new QueryWrapper<>(); + guaranteeLetterAssignUserQueryWrapperB.eq("business_id",businessId).eq("role_id",PromptSuccess.DB_B_ID); + DgGuaranteeLetterAssignUser dgGuaranteeLetterAssignUserB = baseMapper.selectOne(guaranteeLetterAssignUserQueryWrapperB); + dgGuaranteeLetterAssignUserB.setStatus(StatusCode.SP_REVIEWED); + baseMapper.updateById(dgGuaranteeLetterAssignUserB); + int insert = 0; + //添加财务部经理的回款数据,如果财务部数据存在则进行更新 + QueryWrapper queryWrapperCWB = new QueryWrapper<>(); + queryWrapperCWB.eq("business_id",businessId).eq("role_id", PromptSuccess.CWB_ID); + DgPaymentConfirmationConsider paymentConfirmationConsiderCWB = paymentConfirmationConsiderMapper.selectOne(queryWrapperCWB); + if (paymentConfirmationConsiderCWB==null){ + DgPaymentConfirmationConsider paymentConfirmationConsider = new DgPaymentConfirmationConsider(); + paymentConfirmationConsider.setRoleId(PromptSuccess.CWB_ID); + paymentConfirmationConsider.setBusinessId(businessId); + paymentConfirmationConsider.setCompanyId(companyId); + insert = paymentConfirmationConsiderMapper.insert(paymentConfirmationConsider); + }else { + paymentConfirmationConsiderCWB.setOperatingStatus(StatusCode.CZ_ON_HAND); + paymentConfirmationConsiderCWB.setStatus(StatusCode.SP_IN_REVIEW); + paymentConfirmationConsiderCWB.setAuditOpinion(""); + insert = paymentConfirmationConsiderMapper.updateById(paymentConfirmationConsiderCWB); + } + //更新成功,返回操作结果 + log.info(insert > 0 ? "资产部经理成功添加回款数据" : "资产部经理添加回款数据失败"); + return insert > 0; + } + } + + //之前状态为驳回中,资产部经理确认担保函,更新回款确认数据 + if (StatusCode.SP_REVIEWED.equals(status) && StatusCode.SP_REJECT.equals(approveStatus)){ + //根据角色及业务id查询需要更新数据 + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("business_id",businessId).eq("role_id",PromptSuccess.ZC_JL_ID); + DgGuaranteeLetterAssignUser guaranteeLetterAssignUser = baseMapper.selectOne(queryWrapper); + //操作用户为当前用户 + guaranteeLetterAssignUser.setUserId(currentUser); + guaranteeLetterAssignUser.setStatus(StatusCode.SP_REVIEWED); + guaranteeLetterAssignUser.setOperatingStatus(StatusCode.CZ_PROCESSED); + guaranteeLetterAssignUser.setAuditOpinion(auditOpinion); + //根据当前用户更新审核状态和操作状态及审核意见 + int i = baseMapper.updateById(guaranteeLetterAssignUser); + //同时往审核流程进程表新增一条记录 + String account = DgApplyAmountInfoController.getAccount(); + String departmentId = OrdinaryUtil.getDepartmentId(currentUser); + AuditProcessUtil.save(currentUser,businessId,account,departmentId, + auditOpinion,8,PromptSuccess.ZC_JL_ID,"","","",status); + //更新成功,更新回款确认数据及更新整个业务的审核状态 + if (i > 0){ + //更新法规部经理数据 + //根据业务id查询法规部经理数据 + QueryWrapper guaranteeLetterAssignUserQueryWrapperFg = new QueryWrapper<>(); + guaranteeLetterAssignUserQueryWrapperFg.eq("business_id",businessId).eq("role_id",PromptSuccess.FG_JL_ID); + DgGuaranteeLetterAssignUser dgGuaranteeLetterAssignUserFg = baseMapper.selectOne(guaranteeLetterAssignUserQueryWrapperFg); + dgGuaranteeLetterAssignUserFg.setStatus(StatusCode.SP_REVIEWED); + baseMapper.updateById(dgGuaranteeLetterAssignUserFg); + + //更新a角 + //根据业务id查询A用户数据 + QueryWrapper guaranteeLetterAssignUserQueryWrapperA = new QueryWrapper<>(); + guaranteeLetterAssignUserQueryWrapperA.eq("business_id",businessId).eq("role_id",PromptSuccess.DB_A_ID); + DgGuaranteeLetterAssignUser dgGuaranteeLetterAssignUserA = baseMapper.selectOne(guaranteeLetterAssignUserQueryWrapperA); + dgGuaranteeLetterAssignUserA.setStatus(StatusCode.SP_REVIEWED); + baseMapper.updateById(dgGuaranteeLetterAssignUserA); + + //更新b角 + //根据业务id查询B用户数据 + QueryWrapper guaranteeLetterAssignUserQueryWrapperB = new QueryWrapper<>(); + guaranteeLetterAssignUserQueryWrapperB.eq("business_id",businessId).eq("role_id",PromptSuccess.DB_B_ID); + DgGuaranteeLetterAssignUser dgGuaranteeLetterAssignUserB = baseMapper.selectOne(guaranteeLetterAssignUserQueryWrapperB); + dgGuaranteeLetterAssignUserB.setStatus(StatusCode.SP_REVIEWED); + baseMapper.updateById(dgGuaranteeLetterAssignUserB); + + //更新财务部经理的回款数据 + QueryWrapper paymentConfirmationConsiderQueryWrapper = new QueryWrapper<>(); + paymentConfirmationConsiderQueryWrapper.eq("business_id",businessId).eq("role_id",PromptSuccess.CWB_ID); + DgPaymentConfirmationConsider paymentConfirmationConsider = paymentConfirmationConsiderMapper.selectOne(paymentConfirmationConsiderQueryWrapper); + paymentConfirmationConsider.setStatus(StatusCode.SP_IN_REVIEW); + paymentConfirmationConsider.setOperatingStatus(StatusCode.CZ_ON_HAND); + //清空上次的审批意见及银行回单 + paymentConfirmationConsider.setAuditOpinion(""); + paymentConfirmationConsider.setImgFile(""); + int update = paymentConfirmationConsiderMapper.updateById(paymentConfirmationConsider); + //更新成功,返回操作结果 + log.info(update > 0 ? "资产部经理成功添加回款数据" : "资产部经理添加回款数据失败"); + return update > 0; + } + } + + //驳回操作,更新数据及更新AB用户数据及法规部经理数据 + if (StatusCode.SP_REJECT.equals(status)){ + //根据角色及业务id查询需要更新数据 + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("business_id",businessId).eq("role_id",PromptSuccess.ZC_JL_ID); + DgGuaranteeLetterAssignUser guaranteeLetterAssignUser = baseMapper.selectOne(queryWrapper); + //操作用户为当前用户 + guaranteeLetterAssignUser.setUserId(currentUser); + guaranteeLetterAssignUser.setStatus(StatusCode.SP_REJECT); + guaranteeLetterAssignUser.setOperatingStatus(StatusCode.CZ_PROCESSED); + guaranteeLetterAssignUser.setAuditOpinion(auditOpinion); + //根据当前用户更新审核状态和操作状态及审核意见 + int i = baseMapper.updateById(guaranteeLetterAssignUser); + //同时往审核流程进程表新增一条记录 + String account = DgApplyAmountInfoController.getAccount(); + String departmentId = OrdinaryUtil.getDepartmentId(currentUser); + AuditProcessUtil.save(currentUser,businessId,account,departmentId, + auditOpinion,8,PromptSuccess.ZC_JL_ID,"","","",status); + //更新成功,更新AB角数据 + if (i > 0){ + //更新法规部经理数据 + //根据业务id查询法规部经理数据 + QueryWrapper guaranteeLetterAssignUserQueryWrapperFg = new QueryWrapper<>(); + guaranteeLetterAssignUserQueryWrapperFg.eq("business_id",businessId).eq("role_id",PromptSuccess.FG_JL_ID); + DgGuaranteeLetterAssignUser dgGuaranteeLetterAssignUserFg = baseMapper.selectOne(guaranteeLetterAssignUserQueryWrapperFg); + dgGuaranteeLetterAssignUserFg.setStatus(StatusCode.SP_REJECT); + baseMapper.updateById(dgGuaranteeLetterAssignUserFg); + + //根据业务id查询A角数据 + QueryWrapper guaranteeLetterAssignUserQueryWrapperA = new QueryWrapper<>(); + guaranteeLetterAssignUserQueryWrapperA.eq("business_id",businessId).eq("role_id",PromptSuccess.DB_A_ID); + DgGuaranteeLetterAssignUser dgGuaranteeLetterAssignUserA = baseMapper.selectOne(guaranteeLetterAssignUserQueryWrapperA); + //审批状态为已驳回,操作状态为待处理 + dgGuaranteeLetterAssignUserA.setStatus(StatusCode.SP_REJECT); + dgGuaranteeLetterAssignUserA.setOperatingStatus(StatusCode.CZ_ON_HAND); + dgGuaranteeLetterAssignUserA.setAuditOpinion(""); + //更新a角操作业务数据 + baseMapper.updateById(dgGuaranteeLetterAssignUserA); + + //根据业务id查询B角数据 + QueryWrapper guaranteeLetterAssignUserQueryWrapperB = new QueryWrapper<>(); + guaranteeLetterAssignUserQueryWrapperB.eq("business_id",businessId).eq("role_id",PromptSuccess.DB_B_ID); + DgGuaranteeLetterAssignUser dgGuaranteeLetterAssignUserB = baseMapper.selectOne(guaranteeLetterAssignUserQueryWrapperB); + //审批状态为已驳回,操作状态为待处理 + dgGuaranteeLetterAssignUserB.setStatus(StatusCode.SP_REJECT); + dgGuaranteeLetterAssignUserB.setOperatingStatus(StatusCode.CZ_ON_HAND); + dgGuaranteeLetterAssignUserB.setAuditOpinion(""); + //更新b用户操作业务数据 + int update = baseMapper.updateById(dgGuaranteeLetterAssignUserB); + //更新成功,返回操作结果 + log.info(update > 0 ? "资产部经理成功驳回" : "资产部经理驳回失败"); + return update > 0; + } + } + //其他情况均为失败 + return false; + } + + /** + * a角色操作 + */ + private boolean aRoleOperating(Integer businessId,Integer currentUser,String auditOpinion,Integer status){ + //更新之前,获取此用户数据的审批状态,如果审批状态为驳回,则更新资产部经理数据,如果审批状态为审批中,则添加资产部经理数据 + QueryWrapper queryWrapperTemp = new QueryWrapper<>(); + queryWrapperTemp.eq("business_id",businessId).eq("role_id",PromptSuccess.DB_A_ID); + DgGuaranteeLetterAssignUser guaranteeLetterAssignUserTemp = baseMapper.selectOne(queryWrapperTemp); + Integer approveStatus = guaranteeLetterAssignUserTemp.getStatus(); + + //首次a角用户确认担保函,检查b角用户是否确认担保函 + if (StatusCode.SP_REVIEWED.equals(status) && StatusCode.SP_IN_REVIEW.equals(approveStatus)){ + QueryWrapper queryWrapperUser = new QueryWrapper<>(); + queryWrapperUser.eq("business_id",businessId).eq("role_id",PromptSuccess.DB_A_ID); + DgGuaranteeLetterAssignUser guaranteeLetterAssignUser = baseMapper.selectOne(queryWrapperUser); + guaranteeLetterAssignUser.setOperatingStatus(StatusCode.CZ_PROCESSED); + guaranteeLetterAssignUser.setAuditOpinion(auditOpinion); + //获取公司id + Integer companyId = guaranteeLetterAssignUser.getCompanyId(); + //根据当前用户更新审核状态和操作状态及审核意见 + int i = baseMapper.updateById(guaranteeLetterAssignUser); + log.info(i > 0 ? "首次a角用户确认担保函更新成功" : "首次a角用户确认担保函更新失败"); + //同时往审核流程进程表新增一条记录 + String account = DgApplyAmountInfoController.getAccount(); + String departmentId = OrdinaryUtil.getDepartmentId(currentUser); + AuditProcessUtil.save(currentUser,businessId,account,departmentId, + auditOpinion,8,PromptSuccess.DB_A_ID,"","","",status); + //更新成功后,判断b角用户是否确认 + if (i > 0){ + QueryWrapper tempB = new QueryWrapper<>(); + //查询b用户的操作状态 + tempB.eq("business_id",businessId).eq("role_id",PromptSuccess.DB_B_ID).select("operating_status"); + DgGuaranteeLetterAssignUser dgGuaranteeLetterAssignUser = baseMapper.selectOne(tempB); + Integer bStatus = dgGuaranteeLetterAssignUser.getOperatingStatus(); + //b用户审核通过,添加资产部经理数据,数据存在进行更新 + if (StatusCode.CZ_PROCESSED.equals(bStatus)){ + int insert = 0; + QueryWrapper queryWrapperZC = new QueryWrapper<>(); + queryWrapperZC.eq("business_id",businessId).eq("role_id",PromptSuccess.ZC_JL_ID); + DgGuaranteeLetterAssignUser guaranteeLetterAssignUserZC = baseMapper.selectOne(queryWrapperZC); + if (guaranteeLetterAssignUserZC==null){ + DgGuaranteeLetterAssignUser ZCJLGuaranteeLetterAssign = new DgGuaranteeLetterAssignUser(); + ZCJLGuaranteeLetterAssign.setBusinessId(businessId); + ZCJLGuaranteeLetterAssign.setCompanyId(companyId); + ZCJLGuaranteeLetterAssign.setRoleId(PromptSuccess.ZC_JL_ID); + insert = baseMapper.insert(ZCJLGuaranteeLetterAssign); + }else { + guaranteeLetterAssignUserZC.setStatus(StatusCode.SP_IN_REVIEW); + guaranteeLetterAssignUserZC.setOperatingStatus(StatusCode.CZ_ON_HAND); + guaranteeLetterAssignUserZC.setAuditOpinion(""); + insert = baseMapper.updateById(guaranteeLetterAssignUserZC); + } + //添加成功,返回操作结果 + log.info(insert > 0 ? "资产部经理添加成功" : "资产部经理添加失败"); + //b用户审核没通过,返回结果 + return insert > 0; + }else { + return true; + } + } + } + + //驳回后a角用户再次确认担保函,检查b角用户是否确认担保函 + if (StatusCode.SP_REVIEWED.equals(status) && StatusCode.SP_REJECT.equals(approveStatus)){ + QueryWrapper queryWrapperUser = new QueryWrapper<>(); + queryWrapperUser.eq("business_id",businessId).eq("role_id",PromptSuccess.DB_A_ID); + DgGuaranteeLetterAssignUser guaranteeLetterAssignUser = baseMapper.selectOne(queryWrapperUser); + guaranteeLetterAssignUser.setStatus(StatusCode.SP_REVIEWED); + guaranteeLetterAssignUser.setOperatingStatus(StatusCode.CZ_PROCESSED); + guaranteeLetterAssignUser.setAuditOpinion(auditOpinion); + //根据当前用户更新审核状态和操作状态及审核意见 + int i = baseMapper.updateById(guaranteeLetterAssignUser); + log.info(i > 0 ? "驳回后a角用户确认担保函更新成功" : "驳回后a角用户确认担保函更新失败"); + //同时往审核流程进程表新增一条记录 + String account = DgApplyAmountInfoController.getAccount(); + String departmentId = OrdinaryUtil.getDepartmentId(currentUser); + AuditProcessUtil.save(currentUser,businessId,account,departmentId, + auditOpinion,8,PromptSuccess.DB_A_ID,"","","",status); + //更新成功后,判断b角用户是否确认 + if (i > 0){ + QueryWrapper tempB = new QueryWrapper<>(); + //查询b用户的审核状态 + tempB.eq("business_id",businessId).eq("role_id",PromptSuccess.DB_B_ID).select("operating_status"); + DgGuaranteeLetterAssignUser dgGuaranteeLetterAssignUser = baseMapper.selectOne(tempB); + Integer bStatus = dgGuaranteeLetterAssignUser.getOperatingStatus(); + //b用户审核通过,更新资产部经理数据 + if (StatusCode.CZ_PROCESSED.equals(bStatus)){ + QueryWrapper queryZCJLUser = new QueryWrapper<>(); + queryZCJLUser.eq("business_id",businessId).eq("role_id",PromptSuccess.ZC_JL_ID); + DgGuaranteeLetterAssignUser letterAssignUserZCJL = baseMapper.selectOne(queryZCJLUser); + //清空审批意见 + letterAssignUserZCJL.setAuditOpinion(""); + letterAssignUserZCJL.setStatus(StatusCode.SP_IN_REVIEW); + letterAssignUserZCJL.setOperatingStatus(StatusCode.CZ_ON_HAND); + int update = baseMapper.updateById(letterAssignUserZCJL); + //更新成功,返回操作结果 + log.info(update > 0 ? "资产部经理更新成功" : "资产部经理更新失败"); + //b用户审核没通过,返回结果 + return update > 0; + }else { + return true; + } + } + } + + //a角驳回操作,更新a角数据及b角数据及返回上一流程 + if (StatusCode.SP_REJECT.equals(status)){ + QueryWrapper queryWrapperUser = new QueryWrapper<>(); + queryWrapperUser.eq("business_id",businessId).eq("role_id",PromptSuccess.DB_A_ID); + DgGuaranteeLetterAssignUser guaranteeLetterAssignUser = baseMapper.selectOne(queryWrapperUser); + guaranteeLetterAssignUser.setStatus(StatusCode.SP_REJECT); + guaranteeLetterAssignUser.setOperatingStatus(StatusCode.CZ_PROCESSED); + guaranteeLetterAssignUser.setAuditOpinion(auditOpinion); + //根据当前用户更新审核状态和操作状态及审核意见 + int i = baseMapper.updateById(guaranteeLetterAssignUser); + log.info(i > 0 ? "a角用户驳回担保函更新成功" : "a角用户驳回担保函更新失败"); + //同时往审核流程进程表新增一条记录 + String account = DgApplyAmountInfoController.getAccount(); + String departmentId = OrdinaryUtil.getDepartmentId(currentUser); + AuditProcessUtil.save(currentUser,businessId,account,departmentId, + auditOpinion,8,PromptSuccess.DB_A_ID,"","","",status); + //更新成功后,更新b角数据及更新法规部经理数据 + if (i > 0){ + //更新b用户的审核状态为驳回,操作状态为已处理 + QueryWrapper tempB = new QueryWrapper<>(); + tempB.eq("business_id",businessId).eq("role_id",PromptSuccess.DB_B_ID); + DgGuaranteeLetterAssignUser dgGuaranteeLetterAssignUserB = baseMapper.selectOne(tempB); + dgGuaranteeLetterAssignUserB.setStatus(StatusCode.SP_REJECT); + dgGuaranteeLetterAssignUserB.setOperatingStatus(StatusCode.CZ_PROCESSED); + baseMapper.updateById(dgGuaranteeLetterAssignUserB); + + //更新法规部经理的审核状态为驳回,操作状态为待处理,清空审批意见 + QueryWrapper tempFG = new QueryWrapper<>(); + tempFG.eq("business_id",businessId).eq("role_id",PromptSuccess.FG_JL_ID); + DgGuaranteeLetterAssignUser dgGuaranteeLetterAssignUserFG = baseMapper.selectOne(tempFG); + dgGuaranteeLetterAssignUserFG.setStatus(StatusCode.SP_REJECT); + dgGuaranteeLetterAssignUserFG.setOperatingStatus(StatusCode.CZ_ON_HAND); + dgGuaranteeLetterAssignUserFG.setAuditOpinion(""); + int update = baseMapper.updateById(dgGuaranteeLetterAssignUserFG); + //添加成功,返回操作结果 + log.info(update > 0 ? "a角驳回更新成功" : "a角驳回更新失败"); + return update > 0; + } + } + //其他情况均为失败 + return false; + } + + /** + * b角色操作 + */ + private boolean bRoleOperating(Integer businessId,Integer currentUser,String auditOpinion,Integer status){ + //更新之前,获取此用户数据的审批状态,如果审批状态为驳回,则更新资产部经理数据,如果审批状态为审批中,则添加资产部经理数据 + QueryWrapper queryWrapperTemp = new QueryWrapper<>(); + queryWrapperTemp.eq("business_id",businessId).eq("role_id",PromptSuccess.DB_B_ID); + DgGuaranteeLetterAssignUser guaranteeLetterAssignUserTemp = baseMapper.selectOne(queryWrapperTemp); + Integer approveStatus = guaranteeLetterAssignUserTemp.getStatus(); + + //首次b角用户确认担保函,检查a角用户是否确认担保函 + if (StatusCode.SP_REVIEWED.equals(status) && StatusCode.SP_IN_REVIEW.equals(approveStatus)){ + QueryWrapper queryWrapperUser = new QueryWrapper<>(); + queryWrapperUser.eq("business_id",businessId).eq("role_id",PromptSuccess.DB_B_ID); + DgGuaranteeLetterAssignUser guaranteeLetterAssignUser = baseMapper.selectOne(queryWrapperUser); + guaranteeLetterAssignUser.setOperatingStatus(StatusCode.CZ_PROCESSED); + guaranteeLetterAssignUser.setAuditOpinion(auditOpinion); + //获取公司id + Integer companyId = guaranteeLetterAssignUser.getCompanyId(); + //根据当前用户更新审核状态和操作状态及审核意见 + int i = baseMapper.updateById(guaranteeLetterAssignUser); + log.info(i > 0 ? "首次b角用户确认担保函更新成功" : "首次b角用户确认担保函更新失败"); + //同时往审核流程进程表新增一条记录 + String account = DgApplyAmountInfoController.getAccount(); + String departmentId = OrdinaryUtil.getDepartmentId(currentUser); + AuditProcessUtil.save(currentUser,businessId,account,departmentId, + auditOpinion,8,PromptSuccess.DB_B_ID,"","","",status); + //更新成功后,判断a角用户是否确认 + if (i > 0){ + QueryWrapper tempB = new QueryWrapper<>(); + //查询a用户的审核状态 + tempB.eq("business_id",businessId).eq("role_id",PromptSuccess.DB_A_ID).select("operating_status"); + DgGuaranteeLetterAssignUser dgGuaranteeLetterAssignUser = baseMapper.selectOne(tempB); + Integer aStatus = dgGuaranteeLetterAssignUser.getOperatingStatus(); + //a用户审核通过,添加资产部经理数据 + if (StatusCode.CZ_PROCESSED.equals(aStatus)){ + int insert = 0; + QueryWrapper queryWrapperZC = new QueryWrapper<>(); + queryWrapperZC.eq("business_id",businessId).eq("role_id",PromptSuccess.ZC_JL_ID); + DgGuaranteeLetterAssignUser guaranteeLetterAssignUserZC = baseMapper.selectOne(queryWrapperZC); + if (guaranteeLetterAssignUserZC==null){ + DgGuaranteeLetterAssignUser ZCJLGuaranteeLetterAssign = new DgGuaranteeLetterAssignUser(); + ZCJLGuaranteeLetterAssign.setBusinessId(businessId); + ZCJLGuaranteeLetterAssign.setCompanyId(companyId); + ZCJLGuaranteeLetterAssign.setRoleId(PromptSuccess.ZC_JL_ID); + insert = baseMapper.insert(ZCJLGuaranteeLetterAssign); + }else { + guaranteeLetterAssignUserZC.setStatus(StatusCode.SP_IN_REVIEW); + guaranteeLetterAssignUserZC.setOperatingStatus(StatusCode.CZ_ON_HAND); + guaranteeLetterAssignUserZC.setAuditOpinion(""); + insert = baseMapper.updateById(guaranteeLetterAssignUserZC); + } + //添加成功,返回操作结果 + log.info(insert > 0 ? "资产部经理添加成功" : "资产部经理添加失败"); + return insert > 0; + //a用户审核没通过,返回结果 + }else { + return true; + } + } + } + + //驳回后b角用户再次确认担保函,检查a角用户是否确认担保函 + if (StatusCode.SP_REVIEWED.equals(status) && StatusCode.SP_REJECT.equals(approveStatus)){ + QueryWrapper queryWrapperUser = new QueryWrapper<>(); + queryWrapperUser.eq("business_id",businessId).eq("role_id",PromptSuccess.DB_B_ID); + DgGuaranteeLetterAssignUser guaranteeLetterAssignUser = baseMapper.selectOne(queryWrapperUser); + guaranteeLetterAssignUser.setStatus(StatusCode.SP_REVIEWED); + guaranteeLetterAssignUser.setOperatingStatus(StatusCode.CZ_PROCESSED); + guaranteeLetterAssignUser.setAuditOpinion(auditOpinion); + + //根据当前用户更新审核状态和操作状态及审核意见 + int i = baseMapper.updateById(guaranteeLetterAssignUser); + log.info(i > 0 ? "驳回后b角用户确认担保函更新成功" : "驳回后b角用户确认担保函更新失败"); + //同时往审核流程进程表新增一条记录 + String account = DgApplyAmountInfoController.getAccount(); + String departmentId = OrdinaryUtil.getDepartmentId(currentUser); + AuditProcessUtil.save(currentUser,businessId,account,departmentId, + auditOpinion,8,PromptSuccess.DB_B_ID,"","","",status); + //更新成功后,判断a角用户是否确认 + if (i > 0){ + QueryWrapper tempB = new QueryWrapper<>(); + //查询a用户的审核状态 + tempB.eq("business_id",businessId).eq("role_id",PromptSuccess.DB_A_ID).select("operating_status"); + DgGuaranteeLetterAssignUser dgGuaranteeLetterAssignUser = baseMapper.selectOne(tempB); + Integer aStatus = dgGuaranteeLetterAssignUser.getOperatingStatus(); + //a用户审核通过,更新资产部经理数据 + if (StatusCode.CZ_PROCESSED.equals(aStatus)){ + QueryWrapper queryZCJLUser = new QueryWrapper<>(); + queryZCJLUser.eq("business_id",businessId).eq("role_id",PromptSuccess.ZC_JL_ID); + DgGuaranteeLetterAssignUser letterAssignUserZCJL = baseMapper.selectOne(queryZCJLUser); + //清空审批意见 + letterAssignUserZCJL.setAuditOpinion(""); + letterAssignUserZCJL.setStatus(StatusCode.SP_IN_REVIEW); + letterAssignUserZCJL.setOperatingStatus(StatusCode.CZ_ON_HAND); + int update = baseMapper.updateById(letterAssignUserZCJL); + //更新成功,返回操作结果 + log.info(update > 0 ? "资产部经理更新成功" : "资产部经理更新失败"); + return update > 0; + //a用户审核没通过,返回结果 + }else { + return true; + } + } + } + + //b角驳回操作,更新b角数据及a角数据及返回上一流程 + if (StatusCode.SP_REJECT.equals(status)){ + QueryWrapper queryWrapperUser = new QueryWrapper<>(); + queryWrapperUser.eq("business_id",businessId).eq("role_id",PromptSuccess.DB_B_ID); + DgGuaranteeLetterAssignUser guaranteeLetterAssignUser = baseMapper.selectOne(queryWrapperUser); + guaranteeLetterAssignUser.setStatus(StatusCode.SP_REJECT); + guaranteeLetterAssignUser.setOperatingStatus(StatusCode.CZ_PROCESSED); + guaranteeLetterAssignUser.setAuditOpinion(auditOpinion); + //根据当前用户更新审核状态和操作状态及审核意见 + int i = baseMapper.updateById(guaranteeLetterAssignUser); + log.info(i > 0 ? "b角用户驳回担保函更新成功" : "b角用户驳回担保函更新失败"); + //同时往审核流程进程表新增一条记录 + String account = DgApplyAmountInfoController.getAccount(); + String departmentId = OrdinaryUtil.getDepartmentId(currentUser); + AuditProcessUtil.save(currentUser,businessId,account,departmentId, + auditOpinion,8,PromptSuccess.DB_B_ID,"","","",status); + //更新成功后,更新a角数据及更新法规部经理数据 + if (i > 0){ + //更新a用户的审核状态为驳回,操作状态为已处理 + QueryWrapper tempA = new QueryWrapper<>(); + tempA.eq("business_id",businessId).eq("role_id",PromptSuccess.DB_A_ID); + DgGuaranteeLetterAssignUser dgGuaranteeLetterAssignUserA = baseMapper.selectOne(tempA); + dgGuaranteeLetterAssignUserA.setStatus(StatusCode.SP_REJECT); + dgGuaranteeLetterAssignUserA.setOperatingStatus(StatusCode.CZ_PROCESSED); + baseMapper.updateById(dgGuaranteeLetterAssignUserA); + + //更新法规部经理的审核状态为驳回,操作状态为待处理 + QueryWrapper tempFG = new QueryWrapper<>(); + tempFG.eq("business_id",businessId).eq("role_id",PromptSuccess.FG_JL_ID); + DgGuaranteeLetterAssignUser dgGuaranteeLetterAssignUserFG = baseMapper.selectOne(tempFG); + dgGuaranteeLetterAssignUserFG.setStatus(StatusCode.SP_REJECT); + dgGuaranteeLetterAssignUserFG.setAuditOpinion(""); + dgGuaranteeLetterAssignUserFG.setOperatingStatus(StatusCode.CZ_ON_HAND); + int update = baseMapper.updateById(dgGuaranteeLetterAssignUserFG); + //添加成功,返回操作结果 + log.info(update > 0 ? "b角驳回更新成功" : "b角驳回更新失败"); + return update > 0; + } + } + //其他情况均为失败 + return false; + } + + /** + * 更新担保函模块角色或用户确认状态及审核意见 + */ @Transactional @Override public boolean updateGuaranteeLetterStatus(GuaranteeLetterUpdateStatusRequest guaranteeLetterUpdateStatusRequest) { @@ -141,672 +821,69 @@ public class DgGuaranteeLetterAssignUserServiceImpl extends ServiceImpl queryWrapperTemp = new QueryWrapper<>(); - queryWrapperTemp.eq("business_id",businessId).eq("role_id",PromptSuccess.FG_JL_ID); - DgGuaranteeLetterAssignUser guaranteeLetterAssignUserTemp = baseMapper.selectOne(queryWrapperTemp); - Integer approveStatus = guaranteeLetterAssignUserTemp.getStatus(); - - //之前状态为审批中,同意确定生成担保函,添加数据给指派的AB角用户 - if (StatusCode.SP_IN_REVIEW.equals(approveStatus) && StatusCode.SP_REVIEWED.equals(status)){ - //根据角色及业务id查询需要更新数据 - QueryWrapper queryWrapper = new QueryWrapper<>(); - queryWrapper.eq("business_id",businessId).eq("role_id",PromptSuccess.FG_JL_ID); - DgGuaranteeLetterAssignUser guaranteeLetterAssignUser = baseMapper.selectOne(queryWrapper); - //操作用户为当前用户 - guaranteeLetterAssignUser.setUserId(currentUser); - guaranteeLetterAssignUser.setOperatingStatus(StatusCode.CZ_PROCESSED); - guaranteeLetterAssignUser.setAuditOpinion(auditOpinion); - //获取公司id - Integer companyId = guaranteeLetterAssignUser.getCompanyId(); - //根据当前用户更新审核状态和操作状态及审核意见 - int i = baseMapper.updateById(guaranteeLetterAssignUser); - //同时往审核流程进程表新增一条记录 - String account = DgApplyAmountInfoController.getAccount(); - String departmentId = OrdinaryUtil.getDepartmentId(currentUser); - AuditProcessUtil.save(currentUser,businessId,account,departmentId, - auditOpinion,8,PromptSuccess.FG_JL_ID,"","","",status); - //更新成功,添加ab角数据 - if (i > 0){ - //获取之前指定的a角用户 - QueryWrapper wrapperA = new QueryWrapper<>(); - wrapperA.eq("business_id",businessId).eq("role_id",PromptSuccess.DB_A_ID); - DgGuaranteeAssignUser dgGuaranteeAssignUserA = guaranteeAssignUserMapper.selectOne(wrapperA); - Integer userA = dgGuaranteeAssignUserA.getEmpId(); - DgGuaranteeLetterAssignUser guaranteeLetterUser = new DgGuaranteeLetterAssignUser(); - //根据业务id查询A用户数据 - QueryWrapper guaranteeLetterAssignUserQueryWrapperA = new QueryWrapper<>(); - guaranteeLetterAssignUserQueryWrapperA.eq("business_id",businessId).eq("role_id",PromptSuccess.DB_A_ID); - DgGuaranteeLetterAssignUser dgGuaranteeLetterAssignUserA = baseMapper.selectOne(guaranteeLetterAssignUserQueryWrapperA); - //如果a角数据不存在,则进行添加 - if (dgGuaranteeLetterAssignUserA==null){ - //添加a角 - guaranteeLetterUser.setRoleId(PromptSuccess.DB_A_ID); - guaranteeLetterUser.setUserId(userA); - guaranteeLetterUser.setBusinessId(businessId); - guaranteeLetterUser.setCompanyId(companyId); - baseMapper.insert(guaranteeLetterUser); - }else { - //存在则进行更新 - dgGuaranteeLetterAssignUserA.setStatus(StatusCode.SP_IN_REVIEW); - dgGuaranteeLetterAssignUserA.setOperatingStatus(StatusCode.CZ_ON_HAND); - //清空上次的审批意见 - dgGuaranteeLetterAssignUserA.setAuditOpinion(""); - baseMapper.updateById(dgGuaranteeLetterAssignUserA); - } - - //获取之前指定的b角用户 - QueryWrapper wrapperB = new QueryWrapper<>(); - wrapperB.eq("business_id",businessId).eq("role_id",PromptSuccess.DB_B_ID); - DgGuaranteeAssignUser dgGuaranteeAssignUserB = guaranteeAssignUserMapper.selectOne(wrapperB); - Integer userB = dgGuaranteeAssignUserB.getEmpId(); - int insert = 0; - //根据业务id查询B用户数据 - QueryWrapper guaranteeLetterAssignUserQueryWrapperB = new QueryWrapper<>(); - guaranteeLetterAssignUserQueryWrapperB.eq("business_id",businessId).eq("role_id",PromptSuccess.DB_B_ID); - DgGuaranteeLetterAssignUser dgGuaranteeLetterAssignUserB = baseMapper.selectOne(guaranteeLetterAssignUserQueryWrapperB); - if (dgGuaranteeLetterAssignUserB==null){ - //添加b角 - guaranteeLetterUser.setUserId(userB); - guaranteeLetterUser.setRoleId(PromptSuccess.DB_B_ID); - insert = baseMapper.insert(guaranteeLetterUser); - }else { - dgGuaranteeLetterAssignUserB.setStatus(StatusCode.SP_IN_REVIEW); - dgGuaranteeLetterAssignUserB.setOperatingStatus(StatusCode.CZ_ON_HAND); - //清空上次的审批意见 - dgGuaranteeLetterAssignUserB.setAuditOpinion(""); - insert = baseMapper.updateById(dgGuaranteeLetterAssignUserB); - } - //更新成功,返回操作结果 - log.info(insert > 0 ? "法规部经理成功生成担保函" : "法规部经理生成担保函失败"); - return insert > 0; - } + //法规部经理数据是否被操作过 + QueryWrapper queryWrapperOne = new QueryWrapper<>(); + queryWrapperOne.eq("business_id",businessId).eq("role_id",PromptSuccess.FG_JL_ID); + DgGuaranteeLetterAssignUser guaranteeLetterAssignUserOne = baseMapper.selectOne(queryWrapperOne); + Integer userId = guaranteeLetterAssignUserOne.getUserId(); + //没有操作过则法规部经理操作 + if (ObjectUtil.isNull(userId)){ + return this.regulatoryDepartmentManagerOperating(businessId,currentUser,auditOpinion,status); } - - //之前状态为驳回,同意确定生成担保函,更新数据给指派的AB角用户 - if (StatusCode.SP_REJECT.equals(approveStatus) && StatusCode.SP_REVIEWED.equals(status)){ - //根据角色及业务id查询需要更新数据 - QueryWrapper queryWrapper = new QueryWrapper<>(); - queryWrapper.eq("business_id",businessId).eq("role_id",PromptSuccess.FG_JL_ID); - DgGuaranteeLetterAssignUser guaranteeLetterAssignUser = baseMapper.selectOne(queryWrapper); - //操作用户为当前用户 - guaranteeLetterAssignUser.setUserId(currentUser); - guaranteeLetterAssignUser.setStatus(StatusCode.SP_IN_REVIEW); - guaranteeLetterAssignUser.setOperatingStatus(StatusCode.CZ_PROCESSED); - guaranteeLetterAssignUser.setAuditOpinion(auditOpinion); - //根据当前用户更新审核状态和操作状态及审核意见 - int i = baseMapper.updateById(guaranteeLetterAssignUser); - //同时往审核流程进程表新增一条记录 - String account = DgApplyAmountInfoController.getAccount(); - String departmentId = OrdinaryUtil.getDepartmentId(currentUser); - AuditProcessUtil.save(currentUser,businessId,account,departmentId, - auditOpinion,8,PromptSuccess.FG_JL_ID,"","","",status); - //更新成功,更新ab角数据及资产部经理数据 - if (i > 0){ - //更新a角 - //根据业务id查询A用户数据 - QueryWrapper guaranteeLetterAssignUserQueryWrapperA = new QueryWrapper<>(); - guaranteeLetterAssignUserQueryWrapperA.eq("business_id",businessId).eq("role_id",PromptSuccess.DB_A_ID); - DgGuaranteeLetterAssignUser dgGuaranteeLetterAssignUserA = baseMapper.selectOne(guaranteeLetterAssignUserQueryWrapperA); - dgGuaranteeLetterAssignUserA.setStatus(StatusCode.SP_IN_REVIEW); - dgGuaranteeLetterAssignUserA.setOperatingStatus(StatusCode.CZ_ON_HAND); - //清空上次的审批意见 - dgGuaranteeLetterAssignUserA.setAuditOpinion(""); - baseMapper.updateById(dgGuaranteeLetterAssignUserA); - - //更新b角 - //根据业务id查询B用户数据 - QueryWrapper guaranteeLetterAssignUserQueryWrapperB = new QueryWrapper<>(); - guaranteeLetterAssignUserQueryWrapperB.eq("business_id",businessId).eq("role_id",PromptSuccess.DB_B_ID); - DgGuaranteeLetterAssignUser dgGuaranteeLetterAssignUserB = baseMapper.selectOne(guaranteeLetterAssignUserQueryWrapperB); - dgGuaranteeLetterAssignUserB.setStatus(StatusCode.SP_IN_REVIEW); - dgGuaranteeLetterAssignUserB.setOperatingStatus(StatusCode.CZ_ON_HAND); - //清空上次的审批意见 - dgGuaranteeLetterAssignUserB.setAuditOpinion(""); - int update = baseMapper.updateById(dgGuaranteeLetterAssignUserB); - - //更新资产部经理 - //根据业务id查询资产部经理数据 - QueryWrapper guaranteeLetterAssignUserQueryWrapperZc = new QueryWrapper<>(); - guaranteeLetterAssignUserQueryWrapperZc.eq("business_id",businessId).eq("role_id",PromptSuccess.ZC_JL_ID); - DgGuaranteeLetterAssignUser dgGuaranteeLetterAssignUserZc = baseMapper.selectOne(guaranteeLetterAssignUserQueryWrapperZc); - //查询为空不作操作 - if (dgGuaranteeLetterAssignUserZc!=null){ - dgGuaranteeLetterAssignUserZc.setStatus(StatusCode.SP_IN_REVIEW); - dgGuaranteeLetterAssignUserZc.setOperatingStatus(StatusCode.CZ_ON_HAND); - //清空上次的审批意见 - dgGuaranteeLetterAssignUserZc.setAuditOpinion(""); - baseMapper.updateById(dgGuaranteeLetterAssignUserZc); - } - //更新成功,返回操作结果 - log.info(update > 0 ? "驳回后法规部经理成功生成担保函" : "驳回后法规部经理生成担保函失败"); - return update > 0; + //操作过,拥有a角,则a角操作 + if (roleIdList.contains(String.valueOf(PromptSuccess.DB_A_ID))){ + //a角数据是否被操作过 + QueryWrapper queryWrapperTwo = new QueryWrapper<>(); + queryWrapperTwo.eq("business_id",businessId).eq("role_id",PromptSuccess.DB_A_ID); + DgGuaranteeLetterAssignUser guaranteeLetterAssignUserTwo = baseMapper.selectOne(queryWrapperTwo); + Integer userIdA = guaranteeLetterAssignUserTwo.getUserId(); + //没有操作过则a角操作 + if (ObjectUtil.isNull(userIdA)){ + return this.aRoleOperating(businessId,currentUser,auditOpinion,status); } - } - - //驳回操作,更新数据及更新贷审会数据 - if (StatusCode.SP_REJECT.equals(status)){ - //根据角色及业务id查询需要更新数据 - QueryWrapper queryWrapper = new QueryWrapper<>(); - queryWrapper.eq("business_id",businessId).eq("role_id",PromptSuccess.FG_JL_ID); - DgGuaranteeLetterAssignUser guaranteeLetterAssignUser = baseMapper.selectOne(queryWrapper); - //操作用户为当前用户 - guaranteeLetterAssignUser.setUserId(currentUser); - guaranteeLetterAssignUser.setStatus(StatusCode.SP_REJECT); - guaranteeLetterAssignUser.setOperatingStatus(StatusCode.CZ_PROCESSED); - guaranteeLetterAssignUser.setAuditOpinion(auditOpinion); - //根据当前用户更新审核状态和操作状态及审核意见 - int i = baseMapper.updateById(guaranteeLetterAssignUser); - //同时往审核流程进程表新增一条记录 - String account = DgApplyAmountInfoController.getAccount(); - String departmentId = OrdinaryUtil.getDepartmentId(currentUser); - AuditProcessUtil.save(currentUser,businessId,account,departmentId, - auditOpinion,8,PromptSuccess.FG_JL_ID,"","","",status); - //更新成功,更新贷审会数据 - if (i > 0){ - //根据业务id查询贷审会数据 - QueryWrapper loanCommitteeConsiderQueryWrapper = new QueryWrapper<>(); - loanCommitteeConsiderQueryWrapper.eq("business_id",businessId); - DgLoanCommitteeConsider loanCommitteeConsider = dgLoanCommitteeConsiderMapper.selectOne(loanCommitteeConsiderQueryWrapper); - loanCommitteeConsider.setStatus(StatusCode.SP_REJECT); - loanCommitteeConsider.setOperatingStatus(StatusCode.CZ_ON_HAND); - int update = dgLoanCommitteeConsiderMapper.updateById(loanCommitteeConsider); - //更新成功,返回操作结果 - log.info(update > 0 ? "法规部经理成功驳回" : "法规部经理驳回失败"); - return update > 0; + //操作过,拥有b角,则b角操作 + if (roleIdList.contains(String.valueOf(PromptSuccess.DB_B_ID))){ + //b角数据是否被操作过 + QueryWrapper queryWrapperThree = new QueryWrapper<>(); + queryWrapperThree.eq("business_id",businessId).eq("role_id",PromptSuccess.DB_B_ID); + DgGuaranteeLetterAssignUser guaranteeLetterAssignUserThree = baseMapper.selectOne(queryWrapperThree); + Integer userIdB = guaranteeLetterAssignUserThree.getUserId(); + //没有操作过则b角操作 + if (ObjectUtil.isNull(userIdB)){ + return this.bRoleOperating(businessId,currentUser,auditOpinion,status); + } + //操作过,拥有资产部经理,则资产部经理操作 + if (roleIdList.contains(String.valueOf(PromptSuccess.ZC_JL_ID))){ + return this.assetManagerOperating(businessId,currentUser,auditOpinion,status); + } } } } //角色为资产部经理则确认担保函操作和驳回操作 if (roleIdList.contains(String.valueOf(PromptSuccess.ZC_JL_ID))){ - //更新之前,获取此数据的审批状态,如果审批状态为驳回,则更新回款确认数据,如果审批状态为审批中,则添加回款确认数据 - QueryWrapper queryWrapperTemp = new QueryWrapper<>(); - queryWrapperTemp.eq("business_id",businessId).eq("role_id",PromptSuccess.ZC_JL_ID); - DgGuaranteeLetterAssignUser guaranteeLetterAssignUserTemp = baseMapper.selectOne(queryWrapperTemp); - Integer approveStatus = guaranteeLetterAssignUserTemp.getStatus(); - - //之前状态为审批中,资产部经理确认担保函,往回款确认添加数据 - if (StatusCode.SP_REVIEWED.equals(status) && StatusCode.SP_IN_REVIEW.equals(approveStatus)){ - //根据角色及业务id查询需要更新数据 - QueryWrapper queryWrapper = new QueryWrapper<>(); - queryWrapper.eq("business_id",businessId).eq("role_id",PromptSuccess.ZC_JL_ID); - DgGuaranteeLetterAssignUser guaranteeLetterAssignUser = baseMapper.selectOne(queryWrapper); - //操作用户为当前用户 - guaranteeLetterAssignUser.setUserId(currentUser); - guaranteeLetterAssignUser.setStatus(StatusCode.SP_REVIEWED); - guaranteeLetterAssignUser.setOperatingStatus(StatusCode.CZ_PROCESSED); - guaranteeLetterAssignUser.setAuditOpinion(auditOpinion); - //根据当前用户更新审核状态和操作状态及审核意见 - int i = baseMapper.updateById(guaranteeLetterAssignUser); - //同时往审核流程进程表新增一条记录 - String account = DgApplyAmountInfoController.getAccount(); - String departmentId = OrdinaryUtil.getDepartmentId(currentUser); - AuditProcessUtil.save(currentUser,businessId,account,departmentId, - auditOpinion,8,PromptSuccess.ZC_JL_ID,"","","",status); - //获取公司id - Integer companyId = guaranteeLetterAssignUser.getCompanyId(); - //更新成功,添加回款确认数据及更新整个业务的审核状态 - if (i > 0){ - //更新法规部经理数据 - //根据业务id查询法规部经理数据 - QueryWrapper guaranteeLetterAssignUserQueryWrapperFg = new QueryWrapper<>(); - guaranteeLetterAssignUserQueryWrapperFg.eq("business_id",businessId).eq("role_id",PromptSuccess.FG_JL_ID); - DgGuaranteeLetterAssignUser dgGuaranteeLetterAssignUserFg = baseMapper.selectOne(guaranteeLetterAssignUserQueryWrapperFg); - dgGuaranteeLetterAssignUserFg.setStatus(StatusCode.SP_REVIEWED); - baseMapper.updateById(dgGuaranteeLetterAssignUserFg); - - //更新a角 - //根据业务id查询A用户数据 - QueryWrapper guaranteeLetterAssignUserQueryWrapperA = new QueryWrapper<>(); - guaranteeLetterAssignUserQueryWrapperA.eq("business_id",businessId).eq("role_id",PromptSuccess.DB_A_ID); - DgGuaranteeLetterAssignUser dgGuaranteeLetterAssignUserA = baseMapper.selectOne(guaranteeLetterAssignUserQueryWrapperA); - dgGuaranteeLetterAssignUserA.setStatus(StatusCode.SP_REVIEWED); - baseMapper.updateById(dgGuaranteeLetterAssignUserA); - - //更新b角 - //根据业务id查询B用户数据 - QueryWrapper guaranteeLetterAssignUserQueryWrapperB = new QueryWrapper<>(); - guaranteeLetterAssignUserQueryWrapperB.eq("business_id",businessId).eq("role_id",PromptSuccess.DB_B_ID); - DgGuaranteeLetterAssignUser dgGuaranteeLetterAssignUserB = baseMapper.selectOne(guaranteeLetterAssignUserQueryWrapperB); - dgGuaranteeLetterAssignUserB.setStatus(StatusCode.SP_REVIEWED); - baseMapper.updateById(dgGuaranteeLetterAssignUserB); - int insert = 0; - //添加财务部经理的回款数据,如果财务部数据存在则进行更新 - QueryWrapper queryWrapperCWB = new QueryWrapper<>(); - queryWrapperCWB.eq("business_id",businessId).eq("role_id", PromptSuccess.CWB_ID); - DgPaymentConfirmationConsider paymentConfirmationConsiderCWB = paymentConfirmationConsiderMapper.selectOne(queryWrapperCWB); - if (paymentConfirmationConsiderCWB==null){ - DgPaymentConfirmationConsider paymentConfirmationConsider = new DgPaymentConfirmationConsider(); - paymentConfirmationConsider.setRoleId(PromptSuccess.CWB_ID); - paymentConfirmationConsider.setBusinessId(businessId); - paymentConfirmationConsider.setCompanyId(companyId); - insert = paymentConfirmationConsiderMapper.insert(paymentConfirmationConsider); - }else { - paymentConfirmationConsiderCWB.setOperatingStatus(StatusCode.CZ_ON_HAND); - paymentConfirmationConsiderCWB.setStatus(StatusCode.SP_IN_REVIEW); - paymentConfirmationConsiderCWB.setAuditOpinion(""); - insert = paymentConfirmationConsiderMapper.updateById(paymentConfirmationConsiderCWB); - } - //更新成功,返回操作结果 - log.info(insert > 0 ? "资产部经理成功添加回款数据" : "资产部经理添加回款数据失败"); - return insert > 0; - } - } - - //之前状态为驳回中,资产部经理确认担保函,更新回款确认数据 - if (StatusCode.SP_REVIEWED.equals(status) && StatusCode.SP_REJECT.equals(approveStatus)){ - //根据角色及业务id查询需要更新数据 - QueryWrapper queryWrapper = new QueryWrapper<>(); - queryWrapper.eq("business_id",businessId).eq("role_id",PromptSuccess.ZC_JL_ID); - DgGuaranteeLetterAssignUser guaranteeLetterAssignUser = baseMapper.selectOne(queryWrapper); - //操作用户为当前用户 - guaranteeLetterAssignUser.setUserId(currentUser); - guaranteeLetterAssignUser.setStatus(StatusCode.SP_REVIEWED); - guaranteeLetterAssignUser.setOperatingStatus(StatusCode.CZ_PROCESSED); - guaranteeLetterAssignUser.setAuditOpinion(auditOpinion); - //根据当前用户更新审核状态和操作状态及审核意见 - int i = baseMapper.updateById(guaranteeLetterAssignUser); - //同时往审核流程进程表新增一条记录 - String account = DgApplyAmountInfoController.getAccount(); - String departmentId = OrdinaryUtil.getDepartmentId(currentUser); - AuditProcessUtil.save(currentUser,businessId,account,departmentId, - auditOpinion,8,PromptSuccess.ZC_JL_ID,"","","",status); - //更新成功,更新回款确认数据及更新整个业务的审核状态 - if (i > 0){ - //更新法规部经理数据 - //根据业务id查询法规部经理数据 - QueryWrapper guaranteeLetterAssignUserQueryWrapperFg = new QueryWrapper<>(); - guaranteeLetterAssignUserQueryWrapperFg.eq("business_id",businessId).eq("role_id",PromptSuccess.FG_JL_ID); - DgGuaranteeLetterAssignUser dgGuaranteeLetterAssignUserFg = baseMapper.selectOne(guaranteeLetterAssignUserQueryWrapperFg); - dgGuaranteeLetterAssignUserFg.setStatus(StatusCode.SP_REVIEWED); - baseMapper.updateById(dgGuaranteeLetterAssignUserFg); - - //更新a角 - //根据业务id查询A用户数据 - QueryWrapper guaranteeLetterAssignUserQueryWrapperA = new QueryWrapper<>(); - guaranteeLetterAssignUserQueryWrapperA.eq("business_id",businessId).eq("role_id",PromptSuccess.DB_A_ID); - DgGuaranteeLetterAssignUser dgGuaranteeLetterAssignUserA = baseMapper.selectOne(guaranteeLetterAssignUserQueryWrapperA); - dgGuaranteeLetterAssignUserA.setStatus(StatusCode.SP_REVIEWED); - baseMapper.updateById(dgGuaranteeLetterAssignUserA); - - //更新b角 - //根据业务id查询B用户数据 - QueryWrapper guaranteeLetterAssignUserQueryWrapperB = new QueryWrapper<>(); - guaranteeLetterAssignUserQueryWrapperB.eq("business_id",businessId).eq("role_id",PromptSuccess.DB_B_ID); - DgGuaranteeLetterAssignUser dgGuaranteeLetterAssignUserB = baseMapper.selectOne(guaranteeLetterAssignUserQueryWrapperB); - dgGuaranteeLetterAssignUserB.setStatus(StatusCode.SP_REVIEWED); - baseMapper.updateById(dgGuaranteeLetterAssignUserB); - - //更新财务部经理的回款数据 - QueryWrapper paymentConfirmationConsiderQueryWrapper = new QueryWrapper<>(); - paymentConfirmationConsiderQueryWrapper.eq("business_id",businessId).eq("role_id",PromptSuccess.CWB_ID); - DgPaymentConfirmationConsider paymentConfirmationConsider = paymentConfirmationConsiderMapper.selectOne(paymentConfirmationConsiderQueryWrapper); - paymentConfirmationConsider.setStatus(StatusCode.SP_IN_REVIEW); - paymentConfirmationConsider.setOperatingStatus(StatusCode.CZ_ON_HAND); - //清空上次的审批意见及银行回单 - paymentConfirmationConsider.setAuditOpinion(""); - paymentConfirmationConsider.setImgFile(""); - int update = paymentConfirmationConsiderMapper.updateById(paymentConfirmationConsider); - //更新成功,返回操作结果 - log.info(update > 0 ? "资产部经理成功添加回款数据" : "资产部经理添加回款数据失败"); - return update > 0; - } - } - - //驳回操作,更新数据及更新AB用户数据及法规部经理数据 - if (StatusCode.SP_REJECT.equals(status)){ - //根据角色及业务id查询需要更新数据 - QueryWrapper queryWrapper = new QueryWrapper<>(); - queryWrapper.eq("business_id",businessId).eq("role_id",PromptSuccess.ZC_JL_ID); - DgGuaranteeLetterAssignUser guaranteeLetterAssignUser = baseMapper.selectOne(queryWrapper); - //操作用户为当前用户 - guaranteeLetterAssignUser.setUserId(currentUser); - guaranteeLetterAssignUser.setStatus(StatusCode.SP_REJECT); - guaranteeLetterAssignUser.setOperatingStatus(StatusCode.CZ_PROCESSED); - guaranteeLetterAssignUser.setAuditOpinion(auditOpinion); - //根据当前用户更新审核状态和操作状态及审核意见 - int i = baseMapper.updateById(guaranteeLetterAssignUser); - //同时往审核流程进程表新增一条记录 - String account = DgApplyAmountInfoController.getAccount(); - String departmentId = OrdinaryUtil.getDepartmentId(currentUser); - AuditProcessUtil.save(currentUser,businessId,account,departmentId, - auditOpinion,8,PromptSuccess.ZC_JL_ID,"","","",status); - //更新成功,更新AB角数据 - if (i > 0){ - //更新法规部经理数据 - //根据业务id查询法规部经理数据 - QueryWrapper guaranteeLetterAssignUserQueryWrapperFg = new QueryWrapper<>(); - guaranteeLetterAssignUserQueryWrapperFg.eq("business_id",businessId).eq("role_id",PromptSuccess.FG_JL_ID); - DgGuaranteeLetterAssignUser dgGuaranteeLetterAssignUserFg = baseMapper.selectOne(guaranteeLetterAssignUserQueryWrapperFg); - dgGuaranteeLetterAssignUserFg.setStatus(StatusCode.SP_REJECT); - baseMapper.updateById(dgGuaranteeLetterAssignUserFg); - - //根据业务id查询A角数据 - QueryWrapper guaranteeLetterAssignUserQueryWrapperA = new QueryWrapper<>(); - guaranteeLetterAssignUserQueryWrapperA.eq("business_id",businessId).eq("role_id",PromptSuccess.DB_A_ID); - DgGuaranteeLetterAssignUser dgGuaranteeLetterAssignUserA = baseMapper.selectOne(guaranteeLetterAssignUserQueryWrapperA); - //审批状态为已驳回,操作状态为待处理 - dgGuaranteeLetterAssignUserA.setStatus(StatusCode.SP_REJECT); - dgGuaranteeLetterAssignUserA.setOperatingStatus(StatusCode.CZ_ON_HAND); - dgGuaranteeLetterAssignUserA.setAuditOpinion(""); - //更新a角操作业务数据 - baseMapper.updateById(dgGuaranteeLetterAssignUserA); - - //根据业务id查询B角数据 - QueryWrapper guaranteeLetterAssignUserQueryWrapperB = new QueryWrapper<>(); - guaranteeLetterAssignUserQueryWrapperB.eq("business_id",businessId).eq("role_id",PromptSuccess.DB_B_ID); - DgGuaranteeLetterAssignUser dgGuaranteeLetterAssignUserB = baseMapper.selectOne(guaranteeLetterAssignUserQueryWrapperB); - //审批状态为已驳回,操作状态为待处理 - dgGuaranteeLetterAssignUserB.setStatus(StatusCode.SP_REJECT); - dgGuaranteeLetterAssignUserB.setOperatingStatus(StatusCode.CZ_ON_HAND); - dgGuaranteeLetterAssignUserB.setAuditOpinion(""); - //更新b用户操作业务数据 - int update = baseMapper.updateById(dgGuaranteeLetterAssignUserB); - //更新成功,返回操作结果 - log.info(update > 0 ? "资产部经理成功驳回" : "资产部经理驳回失败"); - return update > 0; - } - } + return this.assetManagerOperating(businessId,currentUser,auditOpinion,status); } - //角色为a角确认担保函操作和驳回操作 if (roleIdList.contains(String.valueOf(PromptSuccess.DB_A_ID))){ - //更新之前,获取此用户数据的审批状态,如果审批状态为驳回,则更新资产部经理数据,如果审批状态为审批中,则添加资产部经理数据 - QueryWrapper queryWrapperTemp = new QueryWrapper<>(); - queryWrapperTemp.eq("business_id",businessId).eq("role_id",PromptSuccess.DB_A_ID); - DgGuaranteeLetterAssignUser guaranteeLetterAssignUserTemp = baseMapper.selectOne(queryWrapperTemp); - Integer approveStatus = guaranteeLetterAssignUserTemp.getStatus(); - - //首次a角用户确认担保函,检查b角用户是否确认担保函 - if (StatusCode.SP_REVIEWED.equals(status) && StatusCode.SP_IN_REVIEW.equals(approveStatus)){ - QueryWrapper queryWrapperUser = new QueryWrapper<>(); - queryWrapperUser.eq("business_id",businessId).eq("role_id",PromptSuccess.DB_A_ID); - DgGuaranteeLetterAssignUser guaranteeLetterAssignUser = baseMapper.selectOne(queryWrapperUser); - guaranteeLetterAssignUser.setOperatingStatus(StatusCode.CZ_PROCESSED); - guaranteeLetterAssignUser.setAuditOpinion(auditOpinion); - //获取公司id - Integer companyId = guaranteeLetterAssignUser.getCompanyId(); - //根据当前用户更新审核状态和操作状态及审核意见 - int i = baseMapper.updateById(guaranteeLetterAssignUser); - log.info(i > 0 ? "首次a角用户确认担保函更新成功" : "首次a角用户确认担保函更新失败"); - //同时往审核流程进程表新增一条记录 - String account = DgApplyAmountInfoController.getAccount(); - String departmentId = OrdinaryUtil.getDepartmentId(currentUser); - AuditProcessUtil.save(currentUser,businessId,account,departmentId, - auditOpinion,8,PromptSuccess.DB_A_ID,"","","",status); - //更新成功后,判断b角用户是否确认 - if (i > 0){ - QueryWrapper tempB = new QueryWrapper<>(); - //查询b用户的操作状态 - tempB.eq("business_id",businessId).eq("role_id",PromptSuccess.DB_B_ID).select("operating_status"); - DgGuaranteeLetterAssignUser dgGuaranteeLetterAssignUser = baseMapper.selectOne(tempB); - Integer bStatus = dgGuaranteeLetterAssignUser.getOperatingStatus(); - //b用户审核通过,添加资产部经理数据,数据存在进行更新 - if (StatusCode.CZ_PROCESSED.equals(bStatus)){ - int insert = 0; - QueryWrapper queryWrapperZC = new QueryWrapper<>(); - queryWrapperZC.eq("business_id",businessId).eq("role_id",PromptSuccess.ZC_JL_ID); - DgGuaranteeLetterAssignUser guaranteeLetterAssignUserZC = baseMapper.selectOne(queryWrapperZC); - if (guaranteeLetterAssignUserZC==null){ - DgGuaranteeLetterAssignUser ZCJLGuaranteeLetterAssign = new DgGuaranteeLetterAssignUser(); - ZCJLGuaranteeLetterAssign.setBusinessId(businessId); - ZCJLGuaranteeLetterAssign.setCompanyId(companyId); - ZCJLGuaranteeLetterAssign.setRoleId(PromptSuccess.ZC_JL_ID); - insert = baseMapper.insert(ZCJLGuaranteeLetterAssign); - }else { - guaranteeLetterAssignUserZC.setStatus(StatusCode.SP_IN_REVIEW); - guaranteeLetterAssignUserZC.setOperatingStatus(StatusCode.CZ_ON_HAND); - guaranteeLetterAssignUserZC.setAuditOpinion(""); - insert = baseMapper.updateById(guaranteeLetterAssignUserZC); - } - //添加成功,返回操作结果 - log.info(insert > 0 ? "资产部经理添加成功" : "资产部经理添加失败"); - //b用户审核没通过,返回结果 - return insert > 0; - }else { - return true; - } - } - } - - //驳回后a角用户再次确认担保函,检查b角用户是否确认担保函 - if (StatusCode.SP_REVIEWED.equals(status) && StatusCode.SP_REJECT.equals(approveStatus)){ - QueryWrapper queryWrapperUser = new QueryWrapper<>(); - queryWrapperUser.eq("business_id",businessId).eq("role_id",PromptSuccess.DB_A_ID); - DgGuaranteeLetterAssignUser guaranteeLetterAssignUser = baseMapper.selectOne(queryWrapperUser); - guaranteeLetterAssignUser.setStatus(StatusCode.SP_REVIEWED); - guaranteeLetterAssignUser.setOperatingStatus(StatusCode.CZ_PROCESSED); - guaranteeLetterAssignUser.setAuditOpinion(auditOpinion); - //根据当前用户更新审核状态和操作状态及审核意见 - int i = baseMapper.updateById(guaranteeLetterAssignUser); - log.info(i > 0 ? "驳回后a角用户确认担保函更新成功" : "驳回后a角用户确认担保函更新失败"); - //同时往审核流程进程表新增一条记录 - String account = DgApplyAmountInfoController.getAccount(); - String departmentId = OrdinaryUtil.getDepartmentId(currentUser); - AuditProcessUtil.save(currentUser,businessId,account,departmentId, - auditOpinion,8,PromptSuccess.DB_A_ID,"","","",status); - //更新成功后,判断b角用户是否确认 - if (i > 0){ - QueryWrapper tempB = new QueryWrapper<>(); - //查询b用户的审核状态 - tempB.eq("business_id",businessId).eq("role_id",PromptSuccess.DB_B_ID).select("operating_status"); - DgGuaranteeLetterAssignUser dgGuaranteeLetterAssignUser = baseMapper.selectOne(tempB); - Integer bStatus = dgGuaranteeLetterAssignUser.getOperatingStatus(); - //b用户审核通过,更新资产部经理数据 - if (StatusCode.CZ_PROCESSED.equals(bStatus)){ - QueryWrapper queryZCJLUser = new QueryWrapper<>(); - queryZCJLUser.eq("business_id",businessId).eq("role_id",PromptSuccess.ZC_JL_ID); - DgGuaranteeLetterAssignUser letterAssignUserZCJL = baseMapper.selectOne(queryZCJLUser); - //清空审批意见 - letterAssignUserZCJL.setAuditOpinion(""); - letterAssignUserZCJL.setStatus(StatusCode.SP_IN_REVIEW); - letterAssignUserZCJL.setOperatingStatus(StatusCode.CZ_ON_HAND); - int update = baseMapper.updateById(letterAssignUserZCJL); - //更新成功,返回操作结果 - log.info(update > 0 ? "资产部经理更新成功" : "资产部经理更新失败"); - //b用户审核没通过,返回结果 - return update > 0; - }else { - return true; - } - } - } - - //a角驳回操作,更新a角数据及b角数据及返回上一流程 - if (StatusCode.SP_REJECT.equals(status)){ - QueryWrapper queryWrapperUser = new QueryWrapper<>(); - queryWrapperUser.eq("business_id",businessId).eq("role_id",PromptSuccess.DB_A_ID); - DgGuaranteeLetterAssignUser guaranteeLetterAssignUser = baseMapper.selectOne(queryWrapperUser); - guaranteeLetterAssignUser.setStatus(StatusCode.SP_REJECT); - guaranteeLetterAssignUser.setOperatingStatus(StatusCode.CZ_PROCESSED); - guaranteeLetterAssignUser.setAuditOpinion(auditOpinion); - //根据当前用户更新审核状态和操作状态及审核意见 - int i = baseMapper.updateById(guaranteeLetterAssignUser); - log.info(i > 0 ? "a角用户驳回担保函更新成功" : "a角用户驳回担保函更新失败"); - //同时往审核流程进程表新增一条记录 - String account = DgApplyAmountInfoController.getAccount(); - String departmentId = OrdinaryUtil.getDepartmentId(currentUser); - AuditProcessUtil.save(currentUser,businessId,account,departmentId, - auditOpinion,8,PromptSuccess.DB_A_ID,"","","",status); - //更新成功后,更新b角数据及更新法规部经理数据 - if (i > 0){ - //更新b用户的审核状态为驳回,操作状态为已处理 - QueryWrapper tempB = new QueryWrapper<>(); - tempB.eq("business_id",businessId).eq("role_id",PromptSuccess.DB_B_ID); - DgGuaranteeLetterAssignUser dgGuaranteeLetterAssignUserB = baseMapper.selectOne(tempB); - dgGuaranteeLetterAssignUserB.setStatus(StatusCode.SP_REJECT); - dgGuaranteeLetterAssignUserB.setOperatingStatus(StatusCode.CZ_PROCESSED); - baseMapper.updateById(dgGuaranteeLetterAssignUserB); - - //更新法规部经理的审核状态为驳回,操作状态为待处理,清空审批意见 - QueryWrapper tempFG = new QueryWrapper<>(); - tempFG.eq("business_id",businessId).eq("role_id",PromptSuccess.FG_JL_ID); - DgGuaranteeLetterAssignUser dgGuaranteeLetterAssignUserFG = baseMapper.selectOne(tempFG); - dgGuaranteeLetterAssignUserFG.setStatus(StatusCode.SP_REJECT); - dgGuaranteeLetterAssignUserFG.setOperatingStatus(StatusCode.CZ_ON_HAND); - dgGuaranteeLetterAssignUserFG.setAuditOpinion(""); - int update = baseMapper.updateById(dgGuaranteeLetterAssignUserFG); - //添加成功,返回操作结果 - log.info(update > 0 ? "a角驳回更新成功" : "a角驳回更新失败"); - return update > 0; - } - } + return this.aRoleOperating(businessId,currentUser,auditOpinion,status); } - //角色为b角确认担保函操作和驳回操作 if (roleIdList.contains(String.valueOf(PromptSuccess.DB_B_ID))){ - //更新之前,获取此用户数据的审批状态,如果审批状态为驳回,则更新资产部经理数据,如果审批状态为审批中,则添加资产部经理数据 - QueryWrapper queryWrapperTemp = new QueryWrapper<>(); - queryWrapperTemp.eq("business_id",businessId).eq("role_id",PromptSuccess.DB_B_ID); - DgGuaranteeLetterAssignUser guaranteeLetterAssignUserTemp = baseMapper.selectOne(queryWrapperTemp); - Integer approveStatus = guaranteeLetterAssignUserTemp.getStatus(); - - //首次b角用户确认担保函,检查a角用户是否确认担保函 - if (StatusCode.SP_REVIEWED.equals(status) && StatusCode.SP_IN_REVIEW.equals(approveStatus)){ - QueryWrapper queryWrapperUser = new QueryWrapper<>(); - queryWrapperUser.eq("business_id",businessId).eq("role_id",PromptSuccess.DB_B_ID); - DgGuaranteeLetterAssignUser guaranteeLetterAssignUser = baseMapper.selectOne(queryWrapperUser); - guaranteeLetterAssignUser.setOperatingStatus(StatusCode.CZ_PROCESSED); - guaranteeLetterAssignUser.setAuditOpinion(auditOpinion); - //获取公司id - Integer companyId = guaranteeLetterAssignUser.getCompanyId(); - //根据当前用户更新审核状态和操作状态及审核意见 - int i = baseMapper.updateById(guaranteeLetterAssignUser); - log.info(i > 0 ? "首次b角用户确认担保函更新成功" : "首次b角用户确认担保函更新失败"); - //同时往审核流程进程表新增一条记录 - String account = DgApplyAmountInfoController.getAccount(); - String departmentId = OrdinaryUtil.getDepartmentId(currentUser); - AuditProcessUtil.save(currentUser,businessId,account,departmentId, - auditOpinion,8,PromptSuccess.DB_B_ID,"","","",status); - //更新成功后,判断a角用户是否确认 - if (i > 0){ - QueryWrapper tempB = new QueryWrapper<>(); - //查询a用户的审核状态 - tempB.eq("business_id",businessId).eq("role_id",PromptSuccess.DB_A_ID).select("operating_status"); - DgGuaranteeLetterAssignUser dgGuaranteeLetterAssignUser = baseMapper.selectOne(tempB); - Integer aStatus = dgGuaranteeLetterAssignUser.getOperatingStatus(); - //a用户审核通过,添加资产部经理数据 - if (StatusCode.CZ_PROCESSED.equals(aStatus)){ - int insert = 0; - QueryWrapper queryWrapperZC = new QueryWrapper<>(); - queryWrapperZC.eq("business_id",businessId).eq("role_id",PromptSuccess.ZC_JL_ID); - DgGuaranteeLetterAssignUser guaranteeLetterAssignUserZC = baseMapper.selectOne(queryWrapperZC); - if (guaranteeLetterAssignUserZC==null){ - DgGuaranteeLetterAssignUser ZCJLGuaranteeLetterAssign = new DgGuaranteeLetterAssignUser(); - ZCJLGuaranteeLetterAssign.setBusinessId(businessId); - ZCJLGuaranteeLetterAssign.setCompanyId(companyId); - ZCJLGuaranteeLetterAssign.setRoleId(PromptSuccess.ZC_JL_ID); - insert = baseMapper.insert(ZCJLGuaranteeLetterAssign); - }else { - guaranteeLetterAssignUserZC.setStatus(StatusCode.SP_IN_REVIEW); - guaranteeLetterAssignUserZC.setOperatingStatus(StatusCode.CZ_ON_HAND); - guaranteeLetterAssignUserZC.setAuditOpinion(""); - insert = baseMapper.updateById(guaranteeLetterAssignUserZC); - } - //添加成功,返回操作结果 - log.info(insert > 0 ? "资产部经理添加成功" : "资产部经理添加失败"); - return insert > 0; - //a用户审核没通过,返回结果 - }else { - return true; - } - } - } - - //驳回后b角用户再次确认担保函,检查a角用户是否确认担保函 - if (StatusCode.SP_REVIEWED.equals(status) && StatusCode.SP_REJECT.equals(approveStatus)){ - QueryWrapper queryWrapperUser = new QueryWrapper<>(); - queryWrapperUser.eq("business_id",businessId).eq("role_id",PromptSuccess.DB_B_ID); - DgGuaranteeLetterAssignUser guaranteeLetterAssignUser = baseMapper.selectOne(queryWrapperUser); - guaranteeLetterAssignUser.setStatus(StatusCode.SP_REVIEWED); - guaranteeLetterAssignUser.setOperatingStatus(StatusCode.CZ_PROCESSED); - guaranteeLetterAssignUser.setAuditOpinion(auditOpinion); - - //根据当前用户更新审核状态和操作状态及审核意见 - int i = baseMapper.updateById(guaranteeLetterAssignUser); - log.info(i > 0 ? "驳回后b角用户确认担保函更新成功" : "驳回后b角用户确认担保函更新失败"); - //同时往审核流程进程表新增一条记录 - String account = DgApplyAmountInfoController.getAccount(); - String departmentId = OrdinaryUtil.getDepartmentId(currentUser); - AuditProcessUtil.save(currentUser,businessId,account,departmentId, - auditOpinion,8,PromptSuccess.DB_B_ID,"","","",status); - //更新成功后,判断a角用户是否确认 - if (i > 0){ - QueryWrapper tempB = new QueryWrapper<>(); - //查询a用户的审核状态 - tempB.eq("business_id",businessId).eq("role_id",PromptSuccess.DB_A_ID).select("operating_status"); - DgGuaranteeLetterAssignUser dgGuaranteeLetterAssignUser = baseMapper.selectOne(tempB); - Integer aStatus = dgGuaranteeLetterAssignUser.getOperatingStatus(); - //a用户审核通过,更新资产部经理数据 - if (StatusCode.CZ_PROCESSED.equals(aStatus)){ - QueryWrapper queryZCJLUser = new QueryWrapper<>(); - queryZCJLUser.eq("business_id",businessId).eq("role_id",PromptSuccess.ZC_JL_ID); - DgGuaranteeLetterAssignUser letterAssignUserZCJL = baseMapper.selectOne(queryZCJLUser); - //清空审批意见 - letterAssignUserZCJL.setAuditOpinion(""); - letterAssignUserZCJL.setStatus(StatusCode.SP_IN_REVIEW); - letterAssignUserZCJL.setOperatingStatus(StatusCode.CZ_ON_HAND); - int update = baseMapper.updateById(letterAssignUserZCJL); - //更新成功,返回操作结果 - log.info(update > 0 ? "资产部经理更新成功" : "资产部经理更新失败"); - return update > 0; - //a用户审核没通过,返回结果 - }else { - return true; - } - } - } - - //b角驳回操作,更新b角数据及a角数据及返回上一流程 - if (StatusCode.SP_REJECT.equals(status)){ - QueryWrapper queryWrapperUser = new QueryWrapper<>(); - queryWrapperUser.eq("business_id",businessId).eq("role_id",PromptSuccess.DB_B_ID); - DgGuaranteeLetterAssignUser guaranteeLetterAssignUser = baseMapper.selectOne(queryWrapperUser); - guaranteeLetterAssignUser.setStatus(StatusCode.SP_REJECT); - guaranteeLetterAssignUser.setOperatingStatus(StatusCode.CZ_PROCESSED); - guaranteeLetterAssignUser.setAuditOpinion(auditOpinion); - //根据当前用户更新审核状态和操作状态及审核意见 - int i = baseMapper.updateById(guaranteeLetterAssignUser); - log.info(i > 0 ? "b角用户驳回担保函更新成功" : "b角用户驳回担保函更新失败"); - //同时往审核流程进程表新增一条记录 - String account = DgApplyAmountInfoController.getAccount(); - String departmentId = OrdinaryUtil.getDepartmentId(currentUser); - AuditProcessUtil.save(currentUser,businessId,account,departmentId, - auditOpinion,8,PromptSuccess.DB_B_ID,"","","",status); - //更新成功后,更新a角数据及更新法规部经理数据 - if (i > 0){ - //更新a用户的审核状态为驳回,操作状态为已处理 - QueryWrapper tempA = new QueryWrapper<>(); - tempA.eq("business_id",businessId).eq("role_id",PromptSuccess.DB_A_ID); - DgGuaranteeLetterAssignUser dgGuaranteeLetterAssignUserA = baseMapper.selectOne(tempA); - dgGuaranteeLetterAssignUserA.setStatus(StatusCode.SP_REJECT); - dgGuaranteeLetterAssignUserA.setOperatingStatus(StatusCode.CZ_PROCESSED); - baseMapper.updateById(dgGuaranteeLetterAssignUserA); - - //更新法规部经理的审核状态为驳回,操作状态为待处理 - QueryWrapper tempFG = new QueryWrapper<>(); - tempFG.eq("business_id",businessId).eq("role_id",PromptSuccess.FG_JL_ID); - DgGuaranteeLetterAssignUser dgGuaranteeLetterAssignUserFG = baseMapper.selectOne(tempFG); - dgGuaranteeLetterAssignUserFG.setStatus(StatusCode.SP_REJECT); - dgGuaranteeLetterAssignUserFG.setAuditOpinion(""); - dgGuaranteeLetterAssignUserFG.setOperatingStatus(StatusCode.CZ_ON_HAND); - int update = baseMapper.updateById(dgGuaranteeLetterAssignUserFG); - //添加成功,返回操作结果 - log.info(update > 0 ? "b角驳回更新成功" : "b角驳回更新失败"); - return update > 0; - } - } + return this.bRoleOperating(businessId,currentUser,auditOpinion,status); } } - //一个判断都不走,直接返回false - log.info("《《《《《数据更新失败,请确保数据完整》》》》》"); + //其他情况均为失败 + log.info("《《《《《数据更新失败,请确保数据正确》》》》》"); return false; } }