|
|
|
@ -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,32 +119,10 @@ public class DgGuaranteeLetterAssignUserServiceImpl extends ServiceImpl<DgGuaran |
|
|
|
|
return insert > 0; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Transactional |
|
|
|
|
@Override |
|
|
|
|
public boolean updateGuaranteeLetterStatus(GuaranteeLetterUpdateStatusRequest guaranteeLetterUpdateStatusRequest) { |
|
|
|
|
//更新条件
|
|
|
|
|
Integer businessId = guaranteeLetterUpdateStatusRequest.getBusinessId(); |
|
|
|
|
//状态值为2表示通过或同意,为4表示驳回操作
|
|
|
|
|
Integer status = guaranteeLetterUpdateStatusRequest.getStatus(); |
|
|
|
|
|
|
|
|
|
String auditOpinion = guaranteeLetterUpdateStatusRequest.getAuditOpinion(); |
|
|
|
|
//获取当前登录用户id
|
|
|
|
|
Integer currentUser = Integer.parseInt(this.getUserId()); |
|
|
|
|
//获取当前用户拥有的角色ids
|
|
|
|
|
String roleIds = RedisUtil.get("dq:userRole:" + currentUser); |
|
|
|
|
List<String> roleIdList = null; |
|
|
|
|
if(roleIds != null) { |
|
|
|
|
String[] ids = roleIds.split(","); |
|
|
|
|
roleIdList = Arrays.asList(ids); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//*************************************************根据角色更新数据************************************************
|
|
|
|
|
|
|
|
|
|
//角色不为空
|
|
|
|
|
if (roleIdList!=null){ |
|
|
|
|
|
|
|
|
|
//角色为法规部经理则生成担保函操作和驳回操作
|
|
|
|
|
if (roleIdList.contains(String.valueOf(PromptSuccess.FG_JL_ID))){ |
|
|
|
|
/** |
|
|
|
|
* 法规部经理操作 |
|
|
|
|
*/ |
|
|
|
|
private boolean regulatoryDepartmentManagerOperating(Integer businessId,Integer currentUser,String auditOpinion,Integer status){ |
|
|
|
|
//更新之前,获取此数据的审批状态,如果审批状态为驳回,则更新ab角用户数据,如果审批状态为审批中,则添加ab角用户数据
|
|
|
|
|
QueryWrapper<DgGuaranteeLetterAssignUser> queryWrapperTemp = new QueryWrapper<>(); |
|
|
|
|
queryWrapperTemp.eq("business_id",businessId).eq("role_id",PromptSuccess.FG_JL_ID); |
|
|
|
@ -319,10 +298,14 @@ public class DgGuaranteeLetterAssignUserServiceImpl extends ServiceImpl<DgGuaran |
|
|
|
|
return update > 0; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
//其他情况均为失败
|
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//角色为资产部经理则确认担保函操作和驳回操作
|
|
|
|
|
if (roleIdList.contains(String.valueOf(PromptSuccess.ZC_JL_ID))){ |
|
|
|
|
/** |
|
|
|
|
* 资产部经理操作 |
|
|
|
|
*/ |
|
|
|
|
private boolean assetManagerOperating(Integer businessId,Integer currentUser,String auditOpinion,Integer status){ |
|
|
|
|
//更新之前,获取此数据的审批状态,如果审批状态为驳回,则更新回款确认数据,如果审批状态为审批中,则添加回款确认数据
|
|
|
|
|
QueryWrapper<DgGuaranteeLetterAssignUser> queryWrapperTemp = new QueryWrapper<>(); |
|
|
|
|
queryWrapperTemp.eq("business_id",businessId).eq("role_id",PromptSuccess.ZC_JL_ID); |
|
|
|
@ -511,11 +494,14 @@ public class DgGuaranteeLetterAssignUserServiceImpl extends ServiceImpl<DgGuaran |
|
|
|
|
return update > 0; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
//其他情况均为失败
|
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//角色为a角确认担保函操作和驳回操作
|
|
|
|
|
if (roleIdList.contains(String.valueOf(PromptSuccess.DB_A_ID))){ |
|
|
|
|
/** |
|
|
|
|
* a角色操作 |
|
|
|
|
*/ |
|
|
|
|
private boolean aRoleOperating(Integer businessId,Integer currentUser,String auditOpinion,Integer status){ |
|
|
|
|
//更新之前,获取此用户数据的审批状态,如果审批状态为驳回,则更新资产部经理数据,如果审批状态为审批中,则添加资产部经理数据
|
|
|
|
|
QueryWrapper<DgGuaranteeLetterAssignUser> queryWrapperTemp = new QueryWrapper<>(); |
|
|
|
|
queryWrapperTemp.eq("business_id",businessId).eq("role_id",PromptSuccess.DB_A_ID); |
|
|
|
@ -656,11 +642,14 @@ public class DgGuaranteeLetterAssignUserServiceImpl extends ServiceImpl<DgGuaran |
|
|
|
|
return update > 0; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
//其他情况均为失败
|
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//角色为b角确认担保函操作和驳回操作
|
|
|
|
|
if (roleIdList.contains(String.valueOf(PromptSuccess.DB_B_ID))){ |
|
|
|
|
/** |
|
|
|
|
* b角色操作 |
|
|
|
|
*/ |
|
|
|
|
private boolean bRoleOperating(Integer businessId,Integer currentUser,String auditOpinion,Integer status){ |
|
|
|
|
//更新之前,获取此用户数据的审批状态,如果审批状态为驳回,则更新资产部经理数据,如果审批状态为审批中,则添加资产部经理数据
|
|
|
|
|
QueryWrapper<DgGuaranteeLetterAssignUser> queryWrapperTemp = new QueryWrapper<>(); |
|
|
|
|
queryWrapperTemp.eq("business_id",businessId).eq("role_id",PromptSuccess.DB_B_ID); |
|
|
|
@ -802,11 +791,99 @@ public class DgGuaranteeLetterAssignUserServiceImpl extends ServiceImpl<DgGuaran |
|
|
|
|
return update > 0; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
//其他情况均为失败
|
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 更新担保函模块角色或用户确认状态及审核意见 |
|
|
|
|
*/ |
|
|
|
|
@Transactional |
|
|
|
|
@Override |
|
|
|
|
public boolean updateGuaranteeLetterStatus(GuaranteeLetterUpdateStatusRequest guaranteeLetterUpdateStatusRequest) { |
|
|
|
|
//更新条件
|
|
|
|
|
Integer businessId = guaranteeLetterUpdateStatusRequest.getBusinessId(); |
|
|
|
|
//状态值为2表示通过或同意,为4表示驳回操作
|
|
|
|
|
Integer status = guaranteeLetterUpdateStatusRequest.getStatus(); |
|
|
|
|
|
|
|
|
|
String auditOpinion = guaranteeLetterUpdateStatusRequest.getAuditOpinion(); |
|
|
|
|
//获取当前登录用户id
|
|
|
|
|
Integer currentUser = Integer.parseInt(this.getUserId()); |
|
|
|
|
//获取当前用户拥有的角色ids
|
|
|
|
|
String roleIds = RedisUtil.get("dq:userRole:" + currentUser); |
|
|
|
|
List<String> roleIdList = null; |
|
|
|
|
if(roleIds != null) { |
|
|
|
|
String[] ids = roleIds.split(","); |
|
|
|
|
roleIdList = Arrays.asList(ids); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//*************************************************根据角色更新数据************************************************
|
|
|
|
|
|
|
|
|
|
//角色不为空
|
|
|
|
|
if (roleIdList!=null){ |
|
|
|
|
/** |
|
|
|
|
* 多角色情况判断,拥有多种角色,数据操作混乱,针对数据方面问题,再次进行判断,当其中任意角色操作数据后,该数据被指定为当前用户, |
|
|
|
|
* 据此判断,该角色下数据被指定时,进入指定当前用户的其他角色进行操作,来保证该流程模块的正常业务流转 |
|
|
|
|
*/ |
|
|
|
|
//角色为法规部经理则生成担保函操作和驳回操作
|
|
|
|
|
if (roleIdList.contains(String.valueOf(PromptSuccess.FG_JL_ID))){ |
|
|
|
|
//法规部经理数据是否被操作过
|
|
|
|
|
QueryWrapper<DgGuaranteeLetterAssignUser> 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); |
|
|
|
|
} |
|
|
|
|
//操作过,拥有a角,则a角操作
|
|
|
|
|
if (roleIdList.contains(String.valueOf(PromptSuccess.DB_A_ID))){ |
|
|
|
|
//a角数据是否被操作过
|
|
|
|
|
QueryWrapper<DgGuaranteeLetterAssignUser> 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); |
|
|
|
|
} |
|
|
|
|
//操作过,拥有b角,则b角操作
|
|
|
|
|
if (roleIdList.contains(String.valueOf(PromptSuccess.DB_B_ID))){ |
|
|
|
|
//b角数据是否被操作过
|
|
|
|
|
QueryWrapper<DgGuaranteeLetterAssignUser> 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))){ |
|
|
|
|
return this.assetManagerOperating(businessId,currentUser,auditOpinion,status); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//角色为a角确认担保函操作和驳回操作
|
|
|
|
|
if (roleIdList.contains(String.valueOf(PromptSuccess.DB_A_ID))){ |
|
|
|
|
return this.aRoleOperating(businessId,currentUser,auditOpinion,status); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//角色为b角确认担保函操作和驳回操作
|
|
|
|
|
if (roleIdList.contains(String.valueOf(PromptSuccess.DB_B_ID))){ |
|
|
|
|
return this.bRoleOperating(businessId,currentUser,auditOpinion,status); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//一个判断都不走,直接返回false
|
|
|
|
|
log.info("《《《《《数据更新失败,请确保数据完整》》》》》"); |
|
|
|
|
//其他情况均为失败
|
|
|
|
|
log.info("《《《《《数据更新失败,请确保数据正确》》》》》"); |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|