|
|
|
@ -62,8 +62,6 @@ public class DgApplyAmountInfoServiceImpl extends ServiceImpl<DgApplyAmountInfoM |
|
|
|
|
|
|
|
|
|
@Resource |
|
|
|
|
private DgEnclosureInfoMapper dgEnclosureInfoMapper; |
|
|
|
|
@Resource |
|
|
|
|
private RedisTemplate<String,String> redisTemplate; |
|
|
|
|
|
|
|
|
|
@Resource |
|
|
|
|
private CrmsFeignService crmsFeignService; |
|
|
|
@ -136,20 +134,16 @@ public class DgApplyAmountInfoServiceImpl extends ServiceImpl<DgApplyAmountInfoM |
|
|
|
|
e.printStackTrace(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//根据社会统一信用代码判断是否可以申请业务,同一客户如果有一笔业务在业务流程在进行中,则不能再申请
|
|
|
|
|
//首先根据统一社会信用代码查询备份企业业务关联表中的业务id
|
|
|
|
|
List<DgBusinessCompany> businessCompanyList = dgBusinessCompanyMapper.selectList(new QueryWrapper<DgBusinessCompany>() |
|
|
|
|
.eq("social_unified_code", businessApplication.getSocialUnifiedCode())); |
|
|
|
|
List<Integer> businessIds = new ArrayList<Integer>(); |
|
|
|
|
for (DgBusinessCompany businessCompany:businessCompanyList) { |
|
|
|
|
businessIds.add(businessCompany.getBusinessId()); |
|
|
|
|
} |
|
|
|
|
//根据业务id查询dg_business_process_status表中是否存在业务为进行中的记录
|
|
|
|
|
Integer businessStatus=StatusCode.YW_IN_PROGRESS;//进行中
|
|
|
|
|
int count2 = dgBusinessProcessStatusMapper.selectBybusinessIdAndStatus(businessIds,businessStatus); |
|
|
|
|
//如果存在,则不能再申请业务
|
|
|
|
|
if(count2>0){ |
|
|
|
|
ExceptionCast.cast(GuaranteeCode.REPEAT_BUSINESS); |
|
|
|
|
DgApplyAmountList dgApplyAmountList = new DgApplyAmountList(); |
|
|
|
|
if(businessApplication.getIsSaveOrCommit()==1){//提交
|
|
|
|
|
//根据社会统一信用代码判断是否可以申请业务,同一客户如果有一笔业务在业务流程在进行中,则不能再申请
|
|
|
|
|
this.repeatBusiness(businessApplication); |
|
|
|
|
|
|
|
|
|
dgApplyAmountList.setStatus(StatusCode.SP_IN_REVIEW);//审批状态 设置为审核中
|
|
|
|
|
dgApplyAmountList.setOperatingStatus(StatusCode.CZ_LAUNCH);//操作状态设置为已发起
|
|
|
|
|
}else{//保存
|
|
|
|
|
dgApplyAmountList.setStatus(StatusCode.SP_DRAFT);//审批状态 保存为草稿
|
|
|
|
|
dgApplyAmountList.setOperatingStatus(StatusCode.CZ_TO_BE_SUBMITTED);//操作状态设置为待提交
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//申请贷款相关信息
|
|
|
|
@ -194,41 +188,18 @@ public class DgApplyAmountInfoServiceImpl extends ServiceImpl<DgApplyAmountInfoM |
|
|
|
|
int insert = dgApplyAmountInfoMapper.insert(dgApplyAmountInfo); |
|
|
|
|
|
|
|
|
|
//新增到业务列表
|
|
|
|
|
DgApplyAmountList dgApplyAmountList = new DgApplyAmountList(); |
|
|
|
|
dgApplyAmountList.setBusinessId(dgApplyAmountInfo.getId()); |
|
|
|
|
dgApplyAmountList.setPresenterId(Integer.parseInt(userId)); |
|
|
|
|
dgApplyAmountList.setEmpId(Integer.parseInt(userId)); |
|
|
|
|
dgApplyAmountList.setRoleId(PromptSuccess.DB_YWY_ID); |
|
|
|
|
dgApplyAmountList.setType(1);//类型为担保业务员
|
|
|
|
|
|
|
|
|
|
if(businessApplication.getIsSaveOrCommit()==1){//提交
|
|
|
|
|
dgApplyAmountList.setStatus(StatusCode.SP_IN_REVIEW);//审批状态 设置为审核中
|
|
|
|
|
dgApplyAmountList.setOperatingStatus(StatusCode.CZ_LAUNCH);//操作状态设置为已发起
|
|
|
|
|
}else{//保存
|
|
|
|
|
dgApplyAmountList.setStatus(StatusCode.SP_DRAFT);//审批状态 保存为草稿
|
|
|
|
|
dgApplyAmountList.setOperatingStatus(StatusCode.CZ_TO_BE_SUBMITTED);//操作状态设置为待提交
|
|
|
|
|
} |
|
|
|
|
dgApplyAmountListMapper.insert(dgApplyAmountList); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//修改是否存在关联人
|
|
|
|
|
crmsFeignService.updateIsExistRelated(dgApplyAmountInfo.getCompanyId(),businessApplication.getIsExistRelated()); |
|
|
|
|
|
|
|
|
|
//绑定关联关系
|
|
|
|
|
/* List<CrmsCustomerRelated> relatedList = new ArrayList<>(); |
|
|
|
|
List<Integer> intList = businessApplication.getRelatedId(); |
|
|
|
|
|
|
|
|
|
for(int i=0;i<intList.size();i++){ |
|
|
|
|
CrmsCustomerRelated crmsCustomerRelated = new CrmsCustomerRelated(); |
|
|
|
|
Integer integer = intList.get(i); |
|
|
|
|
crmsCustomerRelated.setCustomerId(dgApplyAmountInfo.getCompanyId());//企业id
|
|
|
|
|
crmsCustomerRelated.setRelatedId(integer);//关联人/企业id
|
|
|
|
|
relatedList.add(crmsCustomerRelated); |
|
|
|
|
}*/ |
|
|
|
|
|
|
|
|
|
//此处在新增关联企业/个人的时候就做了绑定,不需要重复绑定
|
|
|
|
|
//crmsFeignService.insertCustomerRelated(relatedList);
|
|
|
|
|
|
|
|
|
|
//上传附件信息
|
|
|
|
|
DgEnclosureInfo dgEnclosureInfo = new DgEnclosureInfo(); |
|
|
|
|
dgEnclosureInfo.setBusinessId(dgApplyAmountInfo.getId());//业务id
|
|
|
|
@ -325,13 +296,6 @@ public class DgApplyAmountInfoServiceImpl extends ServiceImpl<DgApplyAmountInfoM |
|
|
|
|
} |
|
|
|
|
dgApplyAmountInfo.setRemark(dgApplyAmountList.getApplyContent()); |
|
|
|
|
|
|
|
|
|
/* DgApplyAmountInfoRequest applyAmountInfo = new DgApplyAmountInfoRequest(); |
|
|
|
|
applyAmountInfo.setCompanyId(dgApplyAmountInfo.getCompanyId()); |
|
|
|
|
//根据企业id查询企业详情
|
|
|
|
|
ResponseResult result = crmsFeignService.queryCustomerInfoById(applyAmountInfo); |
|
|
|
|
|
|
|
|
|
LinkedHashMap linkedList = (LinkedHashMap)result.getData();*/ |
|
|
|
|
|
|
|
|
|
//根据业务id查询备份企业信息
|
|
|
|
|
DgBusinessCompany dgBusinessCompany = dgBusinessCompanyMapper.selectOne(new QueryWrapper<DgBusinessCompany>() |
|
|
|
|
.eq("business_id", dgApplyAmountList.getBusinessId())); |
|
|
|
@ -392,6 +356,8 @@ public class DgApplyAmountInfoServiceImpl extends ServiceImpl<DgApplyAmountInfoM |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public int updateBusinessApplication(BusinessApplicationRequest businessApplication) { |
|
|
|
|
//根据社会统一信用代码判断是否可以申请业务,同一客户如果有一笔业务在业务流程在进行中,则不能再申请
|
|
|
|
|
this.repeatBusiness(businessApplication); |
|
|
|
|
//申请贷款相关信息
|
|
|
|
|
DgApplyAmountInfo dgApplyAmountInfo = new DgApplyAmountInfo(); |
|
|
|
|
dgApplyAmountInfo.setId(businessApplication.getBusinessId()); |
|
|
|
@ -724,4 +690,24 @@ public class DgApplyAmountInfoServiceImpl extends ServiceImpl<DgApplyAmountInfoM |
|
|
|
|
return userId; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void repeatBusiness(BusinessApplicationRequest businessApplication){ |
|
|
|
|
//根据社会统一信用代码判断是否可以申请业务,同一客户如果有一笔业务在业务流程在进行中,则不能再申请
|
|
|
|
|
//首先根据统一社会信用代码查询备份企业业务关联表中的业务id
|
|
|
|
|
List<DgBusinessCompany> businessCompanyList = dgBusinessCompanyMapper.selectList(new QueryWrapper<DgBusinessCompany>() |
|
|
|
|
.eq("social_unified_code", businessApplication.getSocialUnifiedCode())); |
|
|
|
|
List<Integer> businessIds = new ArrayList<Integer>(); |
|
|
|
|
for (DgBusinessCompany businessCompany:businessCompanyList) { |
|
|
|
|
businessIds.add(businessCompany.getBusinessId()); |
|
|
|
|
} |
|
|
|
|
//根据业务id查询dg_business_process_status表中是否存在业务为进行中的记录
|
|
|
|
|
Integer businessStatus=StatusCode.YW_IN_PROGRESS;//进行中
|
|
|
|
|
if(businessIds.size()>0){ |
|
|
|
|
int count2 = dgBusinessProcessStatusMapper.selectBybusinessIdAndStatus(businessIds,businessStatus); |
|
|
|
|
//如果存在,则不能再申请业务
|
|
|
|
|
if(count2>0){ |
|
|
|
|
ExceptionCast.cast(GuaranteeCode.REPEAT_BUSINESS); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|