业务申请限制

master
shijie 4 years ago
parent 7b87ba866f
commit 1753ab896a
  1. 78
      dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/service/impl/DgApplyAmountInfoServiceImpl.java
  2. 5
      dq-financial-guarantee/src/main/resources/mapper/guarantee/DgBusinessProcessStatusMapper.xml
  3. 2
      dq-framework-model/src/main/java/com/daqing/framework/domain/guarantee/GuaranteeCode.java

@ -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);
}
}
}
}

@ -12,11 +12,12 @@
<select id="selectBybusinessIdAndStatus" resultType="int" parameterType="long">
SELECT count(0)
FROM dg_business_process_status
WHERE business_id IN
WHERE business_status=#{businessStatus}
AND business_id IN
<foreach collection="businessIds" open="(" separator="," close=")" item="item">
#{item}
</foreach>
AND business_status=#{businessStatus}
</select>
</mapper>

@ -34,7 +34,7 @@ public enum GuaranteeCode implements ResultCode {
FROM_DESIGN_PROCESS_ERROR(false,140001,"当前节点数据不存在!"),
FROM_DESIGN_NAME_NOT_NULL(false,140002,"字段名称不能为空!"),
REPEAT_BUSINESS(false,140002,"企业已申请进行中的业务,不能再次申请!");
REPEAT_BUSINESS(false,150001,"企业存在进行中的业务,不能再次申请!");
/**
* 操作是否成功
*/

Loading…
Cancel
Save