|
|
@ -1,28 +1,28 @@ |
|
|
|
package com.daqing.financial.guarantee.service.impl; |
|
|
|
package com.daqing.financial.guarantee.service.impl; |
|
|
|
|
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
|
|
import com.daqing.financial.guarantee.feign.HrmsFeignService; |
|
|
|
|
|
|
|
import com.daqing.financial.guarantee.mapper.DgGuaranteeLetterAssignUserMapper; |
|
|
|
import com.daqing.financial.guarantee.mapper.DgGuaranteeLetterAssignUserMapper; |
|
|
|
import com.daqing.financial.guarantee.model.request.GuaranteeLetterAddRequest; |
|
|
|
import com.daqing.financial.guarantee.mapper.DgLoanCommitteeConsiderMapper; |
|
|
|
|
|
|
|
import com.daqing.financial.guarantee.mapper.DgPaymentConfirmationConsiderMapper; |
|
|
|
import com.daqing.financial.guarantee.model.request.GuaranteeLetterQueryRequest; |
|
|
|
import com.daqing.financial.guarantee.model.request.GuaranteeLetterQueryRequest; |
|
|
|
import com.daqing.financial.guarantee.model.request.GuaranteeLetterUpdateStatusRequest; |
|
|
|
import com.daqing.financial.guarantee.model.request.GuaranteeLetterUpdateStatusRequest; |
|
|
|
import com.daqing.financial.guarantee.model.response.GuaranteeLetterResponse; |
|
|
|
import com.daqing.financial.guarantee.model.response.GuaranteeLetterListResponse; |
|
|
|
import com.daqing.financial.guarantee.service.IDgGuaranteeLetterAssignUserService; |
|
|
|
import com.daqing.financial.guarantee.service.IDgGuaranteeLetterAssignUserService; |
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|
|
|
import com.daqing.framework.domain.guarantee.DgGuaranteeLetterAssignUser; |
|
|
|
import com.daqing.framework.domain.guarantee.DgGuaranteeLetterAssignUser; |
|
|
|
import com.daqing.framework.domain.guarantee.response.EmployeeMessageResponse; |
|
|
|
import com.daqing.framework.domain.guarantee.DgLoanCommitteeConsider; |
|
|
|
|
|
|
|
import com.daqing.framework.domain.guarantee.DgPaymentConfirmationConsider; |
|
|
|
|
|
|
|
import com.daqing.framework.model.StatusCode; |
|
|
|
import com.daqing.framework.model.response.PromptSuccess; |
|
|
|
import com.daqing.framework.model.response.PromptSuccess; |
|
|
|
import com.daqing.framework.model.response.ResponseResult; |
|
|
|
|
|
|
|
import com.daqing.framework.utils.PageUtils; |
|
|
|
import com.daqing.framework.utils.PageUtils; |
|
|
|
|
|
|
|
import com.sun.xml.internal.bind.v2.TODO; |
|
|
|
|
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
|
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* <p> |
|
|
|
* <p> |
|
|
|
* 担保函记录 服务实现类 |
|
|
|
* 担保函记录 服务实现类 |
|
|
@ -31,9 +31,16 @@ import java.util.List; |
|
|
|
* @author Qyq |
|
|
|
* @author Qyq |
|
|
|
* @since 2020-11-12 |
|
|
|
* @since 2020-11-12 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
|
|
|
|
@Slf4j |
|
|
|
@Service |
|
|
|
@Service |
|
|
|
public class DgGuaranteeLetterAssignUserServiceImpl extends ServiceImpl<DgGuaranteeLetterAssignUserMapper, DgGuaranteeLetterAssignUser> implements IDgGuaranteeLetterAssignUserService { |
|
|
|
public class DgGuaranteeLetterAssignUserServiceImpl extends ServiceImpl<DgGuaranteeLetterAssignUserMapper, DgGuaranteeLetterAssignUser> implements IDgGuaranteeLetterAssignUserService { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
|
|
|
private DgPaymentConfirmationConsiderMapper paymentConfirmationConsiderMapper; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
|
|
|
private DgLoanCommitteeConsiderMapper dgLoanCommitteeConsiderMapper; |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public PageUtils queryPage(GuaranteeLetterQueryRequest guaranteeLetterQueryRequest) { |
|
|
|
public PageUtils queryPage(GuaranteeLetterQueryRequest guaranteeLetterQueryRequest) { |
|
|
|
//取出条件
|
|
|
|
//取出条件
|
|
|
@ -45,81 +52,485 @@ public class DgGuaranteeLetterAssignUserServiceImpl extends ServiceImpl<DgGuaran |
|
|
|
Integer roleId = guaranteeLetterQueryRequest.getRoleId(); |
|
|
|
Integer roleId = guaranteeLetterQueryRequest.getRoleId(); |
|
|
|
String customerNumberOrName = guaranteeLetterQueryRequest.getCustomerNumberOrName(); |
|
|
|
String customerNumberOrName = guaranteeLetterQueryRequest.getCustomerNumberOrName(); |
|
|
|
//分页条件查询
|
|
|
|
//分页条件查询
|
|
|
|
IPage<GuaranteeLetterResponse> guaranteeLetterVO = baseMapper.pageByCondition(new Page(page,size),userId,roleId,status,customerNumberOrName); |
|
|
|
IPage<GuaranteeLetterListResponse> guaranteeLetterVO = baseMapper.pageByCondition(new Page(page,size),userId,roleId,status,customerNumberOrName); |
|
|
|
|
|
|
|
|
|
|
|
return new PageUtils(guaranteeLetterVO); |
|
|
|
return new PageUtils(guaranteeLetterVO); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Transactional |
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public boolean saveGuaranteeLetter(GuaranteeLetterAddRequest guaranteeLetterAddRequest) { |
|
|
|
public boolean saveGuaranteeLetter(DgGuaranteeLetterAssignUser guaranteeLetterAssignUser) { |
|
|
|
//获取A角用户
|
|
|
|
//添加法规部经理生成担保函
|
|
|
|
Integer aRole = guaranteeLetterAddRequest.getARole(); |
|
|
|
guaranteeLetterAssignUser.setRoleId(PromptSuccess.FG_JL_ID); |
|
|
|
//获取B角用户
|
|
|
|
|
|
|
|
Integer bRole = guaranteeLetterAddRequest.getBRole(); |
|
|
|
|
|
|
|
//获取担保函信息
|
|
|
|
|
|
|
|
DgGuaranteeLetterAssignUser guaranteeLetterAssignUser = guaranteeLetterAddRequest.getDgGuaranteeLetterAssignUser(); |
|
|
|
|
|
|
|
//添加A角用户
|
|
|
|
|
|
|
|
guaranteeLetterAssignUser.setUserId(aRole); |
|
|
|
|
|
|
|
baseMapper.insert(guaranteeLetterAssignUser); |
|
|
|
|
|
|
|
//添加B角用户
|
|
|
|
|
|
|
|
guaranteeLetterAssignUser.setUserId(bRole); |
|
|
|
|
|
|
|
int insert = baseMapper.insert(guaranteeLetterAssignUser); |
|
|
|
int insert = baseMapper.insert(guaranteeLetterAssignUser); |
|
|
|
return insert > 0; |
|
|
|
return insert > 0; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Transactional |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public boolean updateGuaranteeLetterStatus(GuaranteeLetterUpdateStatusRequest guaranteeLetterUpdateStatusRequest) { |
|
|
|
public boolean updateGuaranteeLetterStatus(GuaranteeLetterUpdateStatusRequest guaranteeLetterUpdateStatusRequest) { |
|
|
|
|
|
|
|
// TODO 所有操作待添加业务流程数据
|
|
|
|
|
|
|
|
//更新条件
|
|
|
|
Integer businessId = guaranteeLetterUpdateStatusRequest.getBusinessId(); |
|
|
|
Integer businessId = guaranteeLetterUpdateStatusRequest.getBusinessId(); |
|
|
|
Integer currentUser = guaranteeLetterUpdateStatusRequest.getCurrentUser(); |
|
|
|
//状态值为2表示通过或同意,为4表示驳回操作
|
|
|
|
Integer status = guaranteeLetterUpdateStatusRequest.getStatus(); |
|
|
|
Integer status = guaranteeLetterUpdateStatusRequest.getStatus(); |
|
|
|
|
|
|
|
|
|
|
|
//根据业务id查询记录数
|
|
|
|
String auditOpinion = guaranteeLetterUpdateStatusRequest.getAuditOpinion(); |
|
|
|
QueryWrapper<DgGuaranteeLetterAssignUser> wrapper = new QueryWrapper<>(); |
|
|
|
Integer aUser = guaranteeLetterUpdateStatusRequest.getAUser(); |
|
|
|
wrapper.eq("business_id",businessId); |
|
|
|
Integer bUser = guaranteeLetterUpdateStatusRequest.getBUser(); |
|
|
|
Integer count = baseMapper.selectCount(wrapper); |
|
|
|
Integer currentUser = guaranteeLetterUpdateStatusRequest.getCurrentUser(); |
|
|
|
//只有两条数据,经理还未有数据
|
|
|
|
Integer currentUserRole = guaranteeLetterUpdateStatusRequest.getCurrentUserRole(); |
|
|
|
if (count==2){ |
|
|
|
|
|
|
|
//查询当前用户
|
|
|
|
//*************************************************根据角色更新数据************************************************
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//角色不为空
|
|
|
|
|
|
|
|
if (currentUserRole!=null){ |
|
|
|
|
|
|
|
//角色为法规部经理则生成担保函操作和驳回操作
|
|
|
|
|
|
|
|
if (PromptSuccess.FG_JL_ID.equals(currentUserRole)){ |
|
|
|
|
|
|
|
//更新之前,获取此数据的审批状态,如果审批状态为驳回,则更新ab角用户数据,如果审批状态为审批中,则添加ab角用户数据
|
|
|
|
|
|
|
|
QueryWrapper<DgGuaranteeLetterAssignUser> queryWrapperTemp = new QueryWrapper<>(); |
|
|
|
|
|
|
|
queryWrapperTemp.eq("business_id",businessId).eq("role_id",currentUserRole); |
|
|
|
|
|
|
|
DgGuaranteeLetterAssignUser guaranteeLetterAssignUserTemp = baseMapper.selectOne(queryWrapperTemp); |
|
|
|
|
|
|
|
Integer approveStatus = guaranteeLetterAssignUserTemp.getStatus(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//之前状态为审批中,同意确定生成担保函,添加数据给指派的AB角用户
|
|
|
|
|
|
|
|
if (StatusCode.SP_REVIEWED.equals(status) && StatusCode.SP_IN_REVIEW.equals(approveStatus)){ |
|
|
|
|
|
|
|
//根据角色及业务id查询需要更新数据
|
|
|
|
|
|
|
|
QueryWrapper<DgGuaranteeLetterAssignUser> queryWrapper = new QueryWrapper<>(); |
|
|
|
|
|
|
|
queryWrapper.eq("business_id",businessId).eq("role_id",currentUserRole); |
|
|
|
|
|
|
|
DgGuaranteeLetterAssignUser guaranteeLetterAssignUser = baseMapper.selectOne(queryWrapper); |
|
|
|
|
|
|
|
//操作用户为当前用户
|
|
|
|
|
|
|
|
guaranteeLetterAssignUser.setUserId(currentUser); |
|
|
|
|
|
|
|
guaranteeLetterAssignUser.setStatus(StatusCode.SP_REVIEWED); |
|
|
|
|
|
|
|
guaranteeLetterAssignUser.setOperatingStatus(StatusCode.CZ_PROCESSED); |
|
|
|
|
|
|
|
guaranteeLetterAssignUser.setAuditOpinion(auditOpinion); |
|
|
|
|
|
|
|
//获取公司id
|
|
|
|
|
|
|
|
Integer companyId = guaranteeLetterAssignUser.getCompanyId(); |
|
|
|
|
|
|
|
//根据当前用户更新审核状态和操作状态及审核意见 TODO 添加业务流程
|
|
|
|
|
|
|
|
int i = baseMapper.updateById(guaranteeLetterAssignUser); |
|
|
|
|
|
|
|
//更新成功,添加ab角数据
|
|
|
|
|
|
|
|
if (i > 0){ |
|
|
|
|
|
|
|
//添加a角
|
|
|
|
|
|
|
|
DgGuaranteeLetterAssignUser guaranteeLetterUser = new DgGuaranteeLetterAssignUser(); |
|
|
|
|
|
|
|
guaranteeLetterUser.setUserId(aUser); |
|
|
|
|
|
|
|
guaranteeLetterUser.setBusinessId(businessId); |
|
|
|
|
|
|
|
guaranteeLetterUser.setCompanyId(companyId); |
|
|
|
|
|
|
|
baseMapper.insert(guaranteeLetterUser); |
|
|
|
|
|
|
|
//添加b角
|
|
|
|
|
|
|
|
guaranteeLetterUser.setUserId(bUser); |
|
|
|
|
|
|
|
int insert = baseMapper.insert(guaranteeLetterUser); |
|
|
|
|
|
|
|
//更新成功,返回操作结果
|
|
|
|
|
|
|
|
log.info(insert > 0 ? "法规部经理成功生成担保函" : "法规部经理生成担保函失败"); |
|
|
|
|
|
|
|
return insert > 0; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//之前状态为驳回,同意确定生成担保函,更新数据给指派的AB角用户
|
|
|
|
|
|
|
|
if (StatusCode.SP_REVIEWED.equals(status) && StatusCode.SP_REJECT.equals(approveStatus)){ |
|
|
|
|
|
|
|
//根据角色及业务id查询需要更新数据
|
|
|
|
|
|
|
|
QueryWrapper<DgGuaranteeLetterAssignUser> queryWrapper = new QueryWrapper<>(); |
|
|
|
|
|
|
|
queryWrapper.eq("business_id",businessId).eq("role_id",currentUserRole); |
|
|
|
|
|
|
|
DgGuaranteeLetterAssignUser guaranteeLetterAssignUser = baseMapper.selectOne(queryWrapper); |
|
|
|
|
|
|
|
//操作用户为当前用户
|
|
|
|
|
|
|
|
guaranteeLetterAssignUser.setUserId(currentUser); |
|
|
|
|
|
|
|
guaranteeLetterAssignUser.setStatus(StatusCode.SP_REVIEWED); |
|
|
|
|
|
|
|
guaranteeLetterAssignUser.setOperatingStatus(StatusCode.CZ_PROCESSED); |
|
|
|
|
|
|
|
guaranteeLetterAssignUser.setAuditOpinion(auditOpinion); |
|
|
|
|
|
|
|
//根据当前用户更新审核状态和操作状态及审核意见 TODO 添加业务流程
|
|
|
|
|
|
|
|
int i = baseMapper.updateById(guaranteeLetterAssignUser); |
|
|
|
|
|
|
|
//更新成功,更新ab角数据
|
|
|
|
|
|
|
|
if (i > 0){ |
|
|
|
|
|
|
|
//更新a角
|
|
|
|
|
|
|
|
//根据业务id查询A用户数据
|
|
|
|
|
|
|
|
QueryWrapper<DgGuaranteeLetterAssignUser> guaranteeLetterAssignUserQueryWrapperA = new QueryWrapper<>(); |
|
|
|
|
|
|
|
guaranteeLetterAssignUserQueryWrapperA.eq("business_id",businessId).eq("user_id",aUser); |
|
|
|
|
|
|
|
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<DgGuaranteeLetterAssignUser> guaranteeLetterAssignUserQueryWrapperB = new QueryWrapper<>(); |
|
|
|
|
|
|
|
guaranteeLetterAssignUserQueryWrapperB.eq("business_id",businessId).eq("user_id",bUser); |
|
|
|
|
|
|
|
DgGuaranteeLetterAssignUser dgGuaranteeLetterAssignUserB = baseMapper.selectOne(guaranteeLetterAssignUserQueryWrapperB); |
|
|
|
|
|
|
|
dgGuaranteeLetterAssignUserB.setStatus(StatusCode.SP_IN_REVIEW); |
|
|
|
|
|
|
|
dgGuaranteeLetterAssignUserB.setOperatingStatus(StatusCode.CZ_ON_HAND); |
|
|
|
|
|
|
|
//清空上次的审批意见
|
|
|
|
|
|
|
|
dgGuaranteeLetterAssignUserB.setAuditOpinion(""); |
|
|
|
|
|
|
|
int update = baseMapper.updateById(dgGuaranteeLetterAssignUserB); |
|
|
|
|
|
|
|
//更新成功,返回操作结果
|
|
|
|
|
|
|
|
log.info(update > 0 ? "驳回后法规部经理成功生成担保函" : "驳回后法规部经理生成担保函失败"); |
|
|
|
|
|
|
|
return update > 0; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//驳回操作,更新数据及更新贷审会数据
|
|
|
|
|
|
|
|
if (StatusCode.SP_REJECT.equals(status)){ |
|
|
|
|
|
|
|
//根据角色及业务id查询需要更新数据
|
|
|
|
|
|
|
|
QueryWrapper<DgGuaranteeLetterAssignUser> queryWrapper = new QueryWrapper<>(); |
|
|
|
|
|
|
|
queryWrapper.eq("business_id",businessId).eq("role_id",currentUserRole); |
|
|
|
|
|
|
|
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); |
|
|
|
|
|
|
|
//TODO 更新成功,更新贷审会数据
|
|
|
|
|
|
|
|
if (i > 0){ |
|
|
|
|
|
|
|
//根据业务id查询贷审会数据
|
|
|
|
|
|
|
|
QueryWrapper<DgLoanCommitteeConsider> 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; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//角色为资产部经理则确认担保函操作和驳回操作
|
|
|
|
|
|
|
|
if (PromptSuccess.ZC_JL_ID.equals(currentUserRole)){ |
|
|
|
|
|
|
|
//更新之前,获取此数据的审批状态,如果审批状态为驳回,则更新回款确认数据,如果审批状态为审批中,则添加回款确认数据
|
|
|
|
|
|
|
|
QueryWrapper<DgGuaranteeLetterAssignUser> queryWrapperTemp = new QueryWrapper<>(); |
|
|
|
|
|
|
|
queryWrapperTemp.eq("business_id",businessId).eq("role_id",currentUserRole); |
|
|
|
|
|
|
|
DgGuaranteeLetterAssignUser guaranteeLetterAssignUserTemp = baseMapper.selectOne(queryWrapperTemp); |
|
|
|
|
|
|
|
Integer approveStatus = guaranteeLetterAssignUserTemp.getStatus(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//之前状态为审批中,资产部经理确认担保函,往回款确认添加数据
|
|
|
|
|
|
|
|
if (StatusCode.SP_REVIEWED.equals(status) && StatusCode.SP_IN_REVIEW.equals(approveStatus)){ |
|
|
|
|
|
|
|
//根据角色及业务id查询需要更新数据
|
|
|
|
|
|
|
|
QueryWrapper<DgGuaranteeLetterAssignUser> queryWrapper = new QueryWrapper<>(); |
|
|
|
|
|
|
|
queryWrapper.eq("business_id",businessId).eq("role_id",currentUserRole); |
|
|
|
|
|
|
|
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); |
|
|
|
|
|
|
|
//获取公司id
|
|
|
|
|
|
|
|
Integer companyId = guaranteeLetterAssignUser.getCompanyId(); |
|
|
|
|
|
|
|
//更新成功,添加回款确认数据 TODO 添加业务流程
|
|
|
|
|
|
|
|
if (i > 0){ |
|
|
|
|
|
|
|
//添加财务部经理的回款数据
|
|
|
|
|
|
|
|
DgPaymentConfirmationConsider paymentConfirmationConsider = new DgPaymentConfirmationConsider(); |
|
|
|
|
|
|
|
paymentConfirmationConsider.setRoleId(PromptSuccess.CWB_ID); |
|
|
|
|
|
|
|
paymentConfirmationConsider.setBusinessId(businessId); |
|
|
|
|
|
|
|
paymentConfirmationConsider.setCompanyId(companyId); |
|
|
|
|
|
|
|
int insert = paymentConfirmationConsiderMapper.insert(paymentConfirmationConsider); |
|
|
|
|
|
|
|
//更新成功,返回操作结果
|
|
|
|
|
|
|
|
log.info(insert > 0 ? "资产部经理成功添加回款数据" : "资产部经理添加回款数据失败"); |
|
|
|
|
|
|
|
return insert > 0; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//之前状态为驳回中,资产部经理确认担保函,更新回款确认数据
|
|
|
|
|
|
|
|
if (StatusCode.SP_REVIEWED.equals(status) && StatusCode.SP_REJECT.equals(approveStatus)){ |
|
|
|
|
|
|
|
//根据角色及业务id查询需要更新数据
|
|
|
|
|
|
|
|
QueryWrapper<DgGuaranteeLetterAssignUser> queryWrapper = new QueryWrapper<>(); |
|
|
|
|
|
|
|
queryWrapper.eq("business_id",businessId).eq("role_id",currentUserRole); |
|
|
|
|
|
|
|
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); |
|
|
|
|
|
|
|
//更新成功,更新回款确认数据 TODO 添加业务流程
|
|
|
|
|
|
|
|
if (i > 0){ |
|
|
|
|
|
|
|
//更新财务部经理的回款数据
|
|
|
|
|
|
|
|
QueryWrapper<DgPaymentConfirmationConsider> 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(""); |
|
|
|
|
|
|
|
int update = paymentConfirmationConsiderMapper.updateById(paymentConfirmationConsider); |
|
|
|
|
|
|
|
//更新成功,返回操作结果
|
|
|
|
|
|
|
|
log.info(update > 0 ? "资产部经理成功添加回款数据" : "资产部经理添加回款数据失败"); |
|
|
|
|
|
|
|
return update > 0; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//驳回操作,更新数据及更新AB用户数据
|
|
|
|
|
|
|
|
if (StatusCode.SP_REJECT.equals(status)){ |
|
|
|
|
|
|
|
//根据角色及业务id查询需要更新数据
|
|
|
|
QueryWrapper<DgGuaranteeLetterAssignUser> queryWrapper = new QueryWrapper<>(); |
|
|
|
QueryWrapper<DgGuaranteeLetterAssignUser> queryWrapper = new QueryWrapper<>(); |
|
|
|
queryWrapper.eq("business_id",businessId).eq("user_id",currentUser); |
|
|
|
queryWrapper.eq("business_id",businessId).eq("role_id",currentUserRole); |
|
|
|
DgGuaranteeLetterAssignUser guaranteeLetterAssignUser = baseMapper.selectOne(queryWrapper); |
|
|
|
DgGuaranteeLetterAssignUser guaranteeLetterAssignUser = baseMapper.selectOne(queryWrapper); |
|
|
|
guaranteeLetterAssignUser.setStatus(status); |
|
|
|
//操作用户为当前用户
|
|
|
|
//根据当前用户更新状态
|
|
|
|
guaranteeLetterAssignUser.setUserId(currentUser); |
|
|
|
|
|
|
|
guaranteeLetterAssignUser.setStatus(StatusCode.SP_REJECT); |
|
|
|
|
|
|
|
guaranteeLetterAssignUser.setOperatingStatus(StatusCode.CZ_PROCESSED); |
|
|
|
|
|
|
|
guaranteeLetterAssignUser.setAuditOpinion(auditOpinion); |
|
|
|
|
|
|
|
//根据当前用户更新审核状态和操作状态及审核意见
|
|
|
|
|
|
|
|
int i = baseMapper.updateById(guaranteeLetterAssignUser); |
|
|
|
|
|
|
|
//更新成功,更新AB用户数据
|
|
|
|
|
|
|
|
if (i > 0){ |
|
|
|
|
|
|
|
//根据业务id查询A用户数据
|
|
|
|
|
|
|
|
QueryWrapper<DgGuaranteeLetterAssignUser> guaranteeLetterAssignUserQueryWrapperA = new QueryWrapper<>(); |
|
|
|
|
|
|
|
guaranteeLetterAssignUserQueryWrapperA.eq("business_id",businessId).eq("user_id",aUser); |
|
|
|
|
|
|
|
DgGuaranteeLetterAssignUser dgGuaranteeLetterAssignUserA = baseMapper.selectOne(guaranteeLetterAssignUserQueryWrapperA); |
|
|
|
|
|
|
|
//审批状态为已驳回,操作状态为待处理
|
|
|
|
|
|
|
|
dgGuaranteeLetterAssignUserA.setStatus(StatusCode.SP_REJECT); |
|
|
|
|
|
|
|
dgGuaranteeLetterAssignUserA.setOperatingStatus(StatusCode.CZ_ON_HAND); |
|
|
|
|
|
|
|
//更新a用户操作业务数据
|
|
|
|
|
|
|
|
baseMapper.updateById(dgGuaranteeLetterAssignUserA); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//根据业务id查询B用户数据
|
|
|
|
|
|
|
|
QueryWrapper<DgGuaranteeLetterAssignUser> guaranteeLetterAssignUserQueryWrapperB = new QueryWrapper<>(); |
|
|
|
|
|
|
|
guaranteeLetterAssignUserQueryWrapperB.eq("business_id",businessId).eq("user_id",bUser); |
|
|
|
|
|
|
|
DgGuaranteeLetterAssignUser dgGuaranteeLetterAssignUserB = baseMapper.selectOne(guaranteeLetterAssignUserQueryWrapperB); |
|
|
|
|
|
|
|
//审批状态为已驳回,操作状态为待处理
|
|
|
|
|
|
|
|
dgGuaranteeLetterAssignUserB.setStatus(StatusCode.SP_REJECT); |
|
|
|
|
|
|
|
dgGuaranteeLetterAssignUserB.setOperatingStatus(StatusCode.CZ_ON_HAND); |
|
|
|
|
|
|
|
//更新b用户操作业务数据
|
|
|
|
|
|
|
|
int update = baseMapper.updateById(dgGuaranteeLetterAssignUserB); |
|
|
|
|
|
|
|
//更新成功,返回操作结果
|
|
|
|
|
|
|
|
log.info(update > 0 ? "资产部经理成功驳回" : "资产部经理驳回失败"); |
|
|
|
|
|
|
|
return update > 0; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//*********************************************角色为空根据用户更新数据*********************************************
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//当前用户为a角用户
|
|
|
|
|
|
|
|
if (currentUser.equals(aUser)){ |
|
|
|
|
|
|
|
//更新之前,获取此用户数据的审批状态,如果审批状态为驳回,则更新资产部经理数据,如果审批状态为审批中,则添加资产部经理数据
|
|
|
|
|
|
|
|
QueryWrapper<DgGuaranteeLetterAssignUser> queryWrapperTemp = new QueryWrapper<>(); |
|
|
|
|
|
|
|
queryWrapperTemp.eq("business_id",businessId).eq("user_id",aUser); |
|
|
|
|
|
|
|
DgGuaranteeLetterAssignUser guaranteeLetterAssignUserTemp = baseMapper.selectOne(queryWrapperTemp); |
|
|
|
|
|
|
|
Integer approveStatus = guaranteeLetterAssignUserTemp.getStatus(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//首次a角用户确认担保函,检查b角用户是否确认担保函
|
|
|
|
|
|
|
|
if (StatusCode.SP_REVIEWED.equals(status) && StatusCode.SP_IN_REVIEW.equals(approveStatus)){ |
|
|
|
|
|
|
|
QueryWrapper<DgGuaranteeLetterAssignUser> queryWrapperUser = new QueryWrapper<>(); |
|
|
|
|
|
|
|
queryWrapperUser.eq("business_id",businessId).eq("user_id",aUser); |
|
|
|
|
|
|
|
DgGuaranteeLetterAssignUser guaranteeLetterAssignUser = baseMapper.selectOne(queryWrapperUser); |
|
|
|
|
|
|
|
guaranteeLetterAssignUser.setStatus(StatusCode.SP_REVIEWED); |
|
|
|
|
|
|
|
guaranteeLetterAssignUser.setOperatingStatus(StatusCode.CZ_PROCESSED); |
|
|
|
|
|
|
|
guaranteeLetterAssignUser.setAuditOpinion(auditOpinion); |
|
|
|
|
|
|
|
//获取公司id
|
|
|
|
|
|
|
|
Integer companyId = guaranteeLetterAssignUser.getCompanyId(); |
|
|
|
|
|
|
|
//根据当前用户更新审核状态和操作状态及审核意见
|
|
|
|
|
|
|
|
int i = baseMapper.updateById(guaranteeLetterAssignUser); |
|
|
|
|
|
|
|
log.info(i > 0 ? "首次a角用户确认担保函更新成功" : "首次a角用户确认担保函更新失败"); |
|
|
|
|
|
|
|
//更新成功后,判断b角用户是否确认
|
|
|
|
|
|
|
|
if (i > 0){ |
|
|
|
|
|
|
|
QueryWrapper<DgGuaranteeLetterAssignUser> tempB = new QueryWrapper<>(); |
|
|
|
|
|
|
|
//查询b用户的审核状态
|
|
|
|
|
|
|
|
tempB.eq("business_id",businessId).eq("user_id",bUser).select("status"); |
|
|
|
|
|
|
|
DgGuaranteeLetterAssignUser dgGuaranteeLetterAssignUser = baseMapper.selectOne(tempB); |
|
|
|
|
|
|
|
Integer bStatus = dgGuaranteeLetterAssignUser.getStatus(); |
|
|
|
|
|
|
|
//b用户审核通过,添加资产部经理数据
|
|
|
|
|
|
|
|
if (StatusCode.SP_REVIEWED.equals(bStatus)){ |
|
|
|
|
|
|
|
DgGuaranteeLetterAssignUser ZCJLGuaranteeLetterAssign = new DgGuaranteeLetterAssignUser(); |
|
|
|
|
|
|
|
ZCJLGuaranteeLetterAssign.setBusinessId(businessId); |
|
|
|
|
|
|
|
ZCJLGuaranteeLetterAssign.setCompanyId(companyId); |
|
|
|
|
|
|
|
ZCJLGuaranteeLetterAssign.setRoleId(PromptSuccess.ZC_JL_ID); |
|
|
|
|
|
|
|
int insert = baseMapper.insert(ZCJLGuaranteeLetterAssign); |
|
|
|
|
|
|
|
//添加成功,返回操作结果
|
|
|
|
|
|
|
|
log.info(insert > 0 ? "资产部经理添加成功" : "资产部经理添加失败"); |
|
|
|
|
|
|
|
return insert > 0; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//驳回后a角用户再次确认担保函,检查b角用户是否确认担保函
|
|
|
|
|
|
|
|
if (StatusCode.SP_REVIEWED.equals(status) && StatusCode.SP_REJECT.equals(approveStatus)){ |
|
|
|
|
|
|
|
QueryWrapper<DgGuaranteeLetterAssignUser> queryWrapperUser = new QueryWrapper<>(); |
|
|
|
|
|
|
|
queryWrapperUser.eq("business_id",businessId).eq("user_id",aUser); |
|
|
|
|
|
|
|
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角用户确认担保函更新失败"); |
|
|
|
|
|
|
|
//更新成功后,判断b角用户是否确认
|
|
|
|
|
|
|
|
if (i > 0){ |
|
|
|
|
|
|
|
QueryWrapper<DgGuaranteeLetterAssignUser> tempB = new QueryWrapper<>(); |
|
|
|
|
|
|
|
//查询b用户的审核状态
|
|
|
|
|
|
|
|
tempB.eq("business_id",businessId).eq("user_id",bUser).select("status"); |
|
|
|
|
|
|
|
DgGuaranteeLetterAssignUser dgGuaranteeLetterAssignUser = baseMapper.selectOne(tempB); |
|
|
|
|
|
|
|
Integer bStatus = dgGuaranteeLetterAssignUser.getStatus(); |
|
|
|
|
|
|
|
//b用户审核通过,更新资产部经理数据
|
|
|
|
|
|
|
|
if (StatusCode.SP_REVIEWED.equals(bStatus)){ |
|
|
|
|
|
|
|
QueryWrapper<DgGuaranteeLetterAssignUser> 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.setStatus(StatusCode.CZ_ON_HAND); |
|
|
|
|
|
|
|
int update = baseMapper.updateById(letterAssignUserZCJL); |
|
|
|
|
|
|
|
//更新成功,返回操作结果
|
|
|
|
|
|
|
|
log.info(update > 0 ? "资产部经理更新成功" : "资产部经理更新失败"); |
|
|
|
|
|
|
|
return update > 0; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//a角驳回操作,更新a角数据及b角数据及返回上一流程
|
|
|
|
|
|
|
|
if (StatusCode.SP_REJECT.equals(status)){ |
|
|
|
|
|
|
|
QueryWrapper<DgGuaranteeLetterAssignUser> queryWrapperUser = new QueryWrapper<>(); |
|
|
|
|
|
|
|
queryWrapperUser.eq("business_id",businessId).eq("user_id",aUser); |
|
|
|
|
|
|
|
DgGuaranteeLetterAssignUser guaranteeLetterAssignUser = baseMapper.selectOne(queryWrapperUser); |
|
|
|
|
|
|
|
guaranteeLetterAssignUser.setStatus(StatusCode.SP_REJECT); |
|
|
|
|
|
|
|
guaranteeLetterAssignUser.setOperatingStatus(StatusCode.CZ_PROCESSED); |
|
|
|
|
|
|
|
guaranteeLetterAssignUser.setAuditOpinion(auditOpinion); |
|
|
|
|
|
|
|
//根据当前用户更新审核状态和操作状态及审核意见
|
|
|
|
int i = baseMapper.updateById(guaranteeLetterAssignUser); |
|
|
|
int i = baseMapper.updateById(guaranteeLetterAssignUser); |
|
|
|
//当状态为确认时,判断另一个用户是否确认
|
|
|
|
log.info(i > 0 ? "a角用户驳回担保函更新成功" : "a角用户驳回担保函更新失败"); |
|
|
|
if (status==3){ |
|
|
|
//更新成功后,更新b角数据及更新法规部经理数据
|
|
|
|
//查询另一个用户
|
|
|
|
if (i > 0){ |
|
|
|
QueryWrapper<DgGuaranteeLetterAssignUser> anotherQueryWrapper = new QueryWrapper<>(); |
|
|
|
//更新b用户的审核状态为驳回
|
|
|
|
anotherQueryWrapper.eq("business_id",businessId).ne("user_id",currentUser); |
|
|
|
QueryWrapper<DgGuaranteeLetterAssignUser> tempB = new QueryWrapper<>(); |
|
|
|
DgGuaranteeLetterAssignUser anotherGuaranteeLetterAssignUser = baseMapper.selectOne(anotherQueryWrapper); |
|
|
|
tempB.eq("business_id",businessId).eq("user_id",bUser); |
|
|
|
Integer anotherStatus = anotherGuaranteeLetterAssignUser.getStatus(); |
|
|
|
DgGuaranteeLetterAssignUser dgGuaranteeLetterAssignUserB = baseMapper.selectOne(tempB); |
|
|
|
//如果另一个用户也确认,为资产部经理添加数据
|
|
|
|
dgGuaranteeLetterAssignUserB.setStatus(StatusCode.SP_REJECT); |
|
|
|
if (anotherStatus==3){ |
|
|
|
baseMapper.updateById(dgGuaranteeLetterAssignUserB); |
|
|
|
Integer companyId = anotherGuaranteeLetterAssignUser.getCompanyId(); |
|
|
|
|
|
|
|
DgGuaranteeLetterAssignUser dgGuaranteeLetterAssignUser = new DgGuaranteeLetterAssignUser(); |
|
|
|
//更新法规部经理的审核状态为驳回,操作状态为待处理
|
|
|
|
dgGuaranteeLetterAssignUser.setBusinessId(businessId); |
|
|
|
QueryWrapper<DgGuaranteeLetterAssignUser> tempFG = new QueryWrapper<>(); |
|
|
|
dgGuaranteeLetterAssignUser.setCompanyId(companyId); |
|
|
|
tempFG.eq("business_id",businessId).eq("role_id",PromptSuccess.FG_JL_ID); |
|
|
|
//添加资产部经理角色
|
|
|
|
DgGuaranteeLetterAssignUser dgGuaranteeLetterAssignUserFG = baseMapper.selectOne(tempFG); |
|
|
|
dgGuaranteeLetterAssignUser.setRoleId(PromptSuccess.ZC_JL_ID); |
|
|
|
dgGuaranteeLetterAssignUserFG.setStatus(StatusCode.SP_REJECT); |
|
|
|
int insert = baseMapper.insert(dgGuaranteeLetterAssignUser); |
|
|
|
dgGuaranteeLetterAssignUserFG.setOperatingStatus(StatusCode.CZ_ON_HAND); |
|
|
|
|
|
|
|
int update = baseMapper.updateById(dgGuaranteeLetterAssignUserFG); |
|
|
|
|
|
|
|
//添加成功,返回操作结果
|
|
|
|
|
|
|
|
log.info(update > 0 ? "a角驳回更新成功" : "a角驳回更新失败"); |
|
|
|
|
|
|
|
return update > 0; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//当前用户为b角用户
|
|
|
|
|
|
|
|
if (currentUser.equals(bUser)){ |
|
|
|
|
|
|
|
//更新之前,获取此用户数据的审批状态,如果审批状态为驳回,则更新资产部经理数据,如果审批状态为审批中,则添加资产部经理数据
|
|
|
|
|
|
|
|
QueryWrapper<DgGuaranteeLetterAssignUser> queryWrapperTemp = new QueryWrapper<>(); |
|
|
|
|
|
|
|
queryWrapperTemp.eq("business_id",businessId).eq("user_id",bUser); |
|
|
|
|
|
|
|
DgGuaranteeLetterAssignUser guaranteeLetterAssignUserTemp = baseMapper.selectOne(queryWrapperTemp); |
|
|
|
|
|
|
|
Integer approveStatus = guaranteeLetterAssignUserTemp.getStatus(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//首次b角用户确认担保函,检查a角用户是否确认担保函
|
|
|
|
|
|
|
|
if (StatusCode.SP_REVIEWED.equals(status) && StatusCode.SP_IN_REVIEW.equals(approveStatus)){ |
|
|
|
|
|
|
|
QueryWrapper<DgGuaranteeLetterAssignUser> queryWrapperUser = new QueryWrapper<>(); |
|
|
|
|
|
|
|
queryWrapperUser.eq("business_id",businessId).eq("user_id",bUser); |
|
|
|
|
|
|
|
DgGuaranteeLetterAssignUser guaranteeLetterAssignUser = baseMapper.selectOne(queryWrapperUser); |
|
|
|
|
|
|
|
guaranteeLetterAssignUser.setStatus(StatusCode.SP_REVIEWED); |
|
|
|
|
|
|
|
guaranteeLetterAssignUser.setOperatingStatus(StatusCode.CZ_PROCESSED); |
|
|
|
|
|
|
|
guaranteeLetterAssignUser.setAuditOpinion(auditOpinion); |
|
|
|
|
|
|
|
//获取公司id
|
|
|
|
|
|
|
|
Integer companyId = guaranteeLetterAssignUser.getCompanyId(); |
|
|
|
|
|
|
|
//根据当前用户更新审核状态和操作状态及审核意见
|
|
|
|
|
|
|
|
int i = baseMapper.updateById(guaranteeLetterAssignUser); |
|
|
|
|
|
|
|
log.info(i > 0 ? "首次b角用户确认担保函更新成功" : "首次b角用户确认担保函更新失败"); |
|
|
|
|
|
|
|
//更新成功后,判断a角用户是否确认
|
|
|
|
|
|
|
|
if (i > 0){ |
|
|
|
|
|
|
|
QueryWrapper<DgGuaranteeLetterAssignUser> tempB = new QueryWrapper<>(); |
|
|
|
|
|
|
|
//查询a用户的审核状态
|
|
|
|
|
|
|
|
tempB.eq("business_id",businessId).eq("user_id",aUser).select("status"); |
|
|
|
|
|
|
|
DgGuaranteeLetterAssignUser dgGuaranteeLetterAssignUser = baseMapper.selectOne(tempB); |
|
|
|
|
|
|
|
Integer aStatus = dgGuaranteeLetterAssignUser.getStatus(); |
|
|
|
|
|
|
|
//a用户审核通过,添加资产部经理数据
|
|
|
|
|
|
|
|
if (StatusCode.SP_REVIEWED.equals(aStatus)){ |
|
|
|
|
|
|
|
DgGuaranteeLetterAssignUser ZCJLGuaranteeLetterAssign = new DgGuaranteeLetterAssignUser(); |
|
|
|
|
|
|
|
ZCJLGuaranteeLetterAssign.setBusinessId(businessId); |
|
|
|
|
|
|
|
ZCJLGuaranteeLetterAssign.setCompanyId(companyId); |
|
|
|
|
|
|
|
ZCJLGuaranteeLetterAssign.setRoleId(PromptSuccess.ZC_JL_ID); |
|
|
|
|
|
|
|
int insert = baseMapper.insert(ZCJLGuaranteeLetterAssign); |
|
|
|
|
|
|
|
//添加成功,返回操作结果
|
|
|
|
|
|
|
|
log.info(insert > 0 ? "资产部经理添加成功" : "资产部经理添加失败"); |
|
|
|
return insert > 0; |
|
|
|
return insert > 0; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return i > 0; |
|
|
|
|
|
|
|
//经理有数据,当前确认用户拥有经理角色,确认担保函
|
|
|
|
|
|
|
|
}else { |
|
|
|
|
|
|
|
//当前用户角色为经理
|
|
|
|
|
|
|
|
QueryWrapper<DgGuaranteeLetterAssignUser> queryRoleWrapper = new QueryWrapper<>(); |
|
|
|
|
|
|
|
queryRoleWrapper.eq("business_id",businessId).eq("role_id",PromptSuccess.ZC_JL_ID); |
|
|
|
|
|
|
|
DgGuaranteeLetterAssignUser guaranteeLetterAssignRole = baseMapper.selectOne(queryRoleWrapper); |
|
|
|
|
|
|
|
guaranteeLetterAssignRole.setUserId(currentUser); |
|
|
|
|
|
|
|
guaranteeLetterAssignRole.setStatus(status); |
|
|
|
|
|
|
|
//根据当前用户角色更新状态
|
|
|
|
|
|
|
|
int i = baseMapper.updateById(guaranteeLetterAssignRole); |
|
|
|
|
|
|
|
//TODO 经理确认成功后,向回款确认添加数据
|
|
|
|
|
|
|
|
return i > 0; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//驳回后b角用户再次确认担保函,检查a角用户是否确认担保函
|
|
|
|
|
|
|
|
if (StatusCode.SP_REVIEWED.equals(status) && StatusCode.SP_REJECT.equals(approveStatus)){ |
|
|
|
|
|
|
|
QueryWrapper<DgGuaranteeLetterAssignUser> queryWrapperUser = new QueryWrapper<>(); |
|
|
|
|
|
|
|
queryWrapperUser.eq("business_id",businessId).eq("user_id",bUser); |
|
|
|
|
|
|
|
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角用户确认担保函更新失败"); |
|
|
|
|
|
|
|
//更新成功后,判断a角用户是否确认
|
|
|
|
|
|
|
|
if (i > 0){ |
|
|
|
|
|
|
|
QueryWrapper<DgGuaranteeLetterAssignUser> tempB = new QueryWrapper<>(); |
|
|
|
|
|
|
|
//查询a用户的审核状态
|
|
|
|
|
|
|
|
tempB.eq("business_id",businessId).eq("user_id",aUser).select("status"); |
|
|
|
|
|
|
|
DgGuaranteeLetterAssignUser dgGuaranteeLetterAssignUser = baseMapper.selectOne(tempB); |
|
|
|
|
|
|
|
Integer aStatus = dgGuaranteeLetterAssignUser.getStatus(); |
|
|
|
|
|
|
|
//a用户审核通过,更新资产部经理数据
|
|
|
|
|
|
|
|
if (StatusCode.SP_REVIEWED.equals(aStatus)){ |
|
|
|
|
|
|
|
QueryWrapper<DgGuaranteeLetterAssignUser> 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.setStatus(StatusCode.CZ_ON_HAND); |
|
|
|
|
|
|
|
int update = baseMapper.updateById(letterAssignUserZCJL); |
|
|
|
|
|
|
|
//更新成功,返回操作结果
|
|
|
|
|
|
|
|
log.info(update > 0 ? "资产部经理更新成功" : "资产部经理更新失败"); |
|
|
|
|
|
|
|
return update > 0; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//b角驳回操作,更新b角数据及a角数据及返回上一流程
|
|
|
|
|
|
|
|
if (StatusCode.SP_REJECT.equals(status)){ |
|
|
|
|
|
|
|
QueryWrapper<DgGuaranteeLetterAssignUser> queryWrapperUser = new QueryWrapper<>(); |
|
|
|
|
|
|
|
queryWrapperUser.eq("business_id",businessId).eq("user_id",bUser); |
|
|
|
|
|
|
|
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角用户驳回担保函更新失败"); |
|
|
|
|
|
|
|
//更新成功后,更新a角数据及更新法规部经理数据
|
|
|
|
|
|
|
|
if (i > 0){ |
|
|
|
|
|
|
|
//更新a用户的审核状态为驳回
|
|
|
|
|
|
|
|
QueryWrapper<DgGuaranteeLetterAssignUser> tempA = new QueryWrapper<>(); |
|
|
|
|
|
|
|
tempA.eq("business_id",businessId).eq("user_id",aUser); |
|
|
|
|
|
|
|
DgGuaranteeLetterAssignUser dgGuaranteeLetterAssignUserA = baseMapper.selectOne(tempA); |
|
|
|
|
|
|
|
dgGuaranteeLetterAssignUserA.setStatus(StatusCode.SP_REJECT); |
|
|
|
|
|
|
|
baseMapper.updateById(dgGuaranteeLetterAssignUserA); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//更新法规部经理的审核状态为驳回,操作状态为待处理
|
|
|
|
|
|
|
|
QueryWrapper<DgGuaranteeLetterAssignUser> 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); |
|
|
|
|
|
|
|
int update = baseMapper.updateById(dgGuaranteeLetterAssignUserFG); |
|
|
|
|
|
|
|
//添加成功,返回操作结果
|
|
|
|
|
|
|
|
log.info(update > 0 ? "b角驳回更新成功" : "b角驳回更新失败"); |
|
|
|
|
|
|
|
return update > 0; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
//一个判断都不走,直接返回false
|
|
|
|
|
|
|
|
log.info("《《《《《数据更新失败,请确保数据完整》》》》》"); |
|
|
|
|
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|