|
@@ -6,10 +6,13 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.inkasso.adapter.exception.BusinessException;
|
|
|
import com.inkasso.adapter.util.CodeUtil;
|
|
|
+import com.inkasso.adapter.util.StringUtil;
|
|
|
import com.inkasso.adapter.web.LoginUserHolder;
|
|
|
+import com.inkasso.factoring.bocom.register.entity.BocomAuthorizedAgent;
|
|
|
import com.inkasso.factoring.bocom.register.entity.BocomBasicInfo;
|
|
|
import com.inkasso.factoring.bocom.register.entity.BocomLegalPersonInfo;
|
|
|
import com.inkasso.factoring.bocom.register.entity.BocomShareholderActualController;
|
|
|
+import com.inkasso.factoring.bocom.register.service.IBocomAuthorizedAgentService;
|
|
|
import com.inkasso.factoring.bocom.register.service.IBocomBasicInfoService;
|
|
|
import com.inkasso.factoring.bocom.register.service.IBocomLegalPersonInfoService;
|
|
|
import com.inkasso.factoring.bocom.register.service.IBocomShareholderActualControllerService;
|
|
@@ -79,6 +82,8 @@ public class BocomVipAccountBasicInfoServiceImpl extends ServiceImpl<BocomVipAcc
|
|
|
private IBocomLegalPersonInfoService bocomLegalPersonInfoService;
|
|
|
@Autowired
|
|
|
private IBocomShareholderActualControllerService bocomShareholderActualControllerService;
|
|
|
+ @Autowired
|
|
|
+ private IBocomAuthorizedAgentService bocomAuthorizedAgentService;
|
|
|
|
|
|
@Override
|
|
|
public List<BocomVipAccountListVo> findList() {
|
|
@@ -103,37 +108,46 @@ public class BocomVipAccountBasicInfoServiceImpl extends ServiceImpl<BocomVipAcc
|
|
|
vo.setCustomerStatus(customerStatusDic.getName());
|
|
|
}
|
|
|
|
|
|
- if (bocomBasicInfo.getCustomerType() != null) {
|
|
|
- if (bocomBasicInfo.getCustomerType() == 0) {
|
|
|
- BocomLegalPersonInfo legalPersonInfo = bocomLegalPersonInfoService.lambdaQuery()
|
|
|
- .eq(BocomLegalPersonInfo::getBocomBasicInfoId, bocomBasicInfo.getId())
|
|
|
- .one();
|
|
|
- if (legalPersonInfo != null) {
|
|
|
- vo.setAuthenticator(legalPersonInfo.getName());
|
|
|
- }
|
|
|
- }
|
|
|
- if (bocomBasicInfo.getCustomerType() == 1) {
|
|
|
- List<BocomShareholderActualController> shareholderActualControllerList = bocomShareholderActualControllerService.lambdaQuery()
|
|
|
- .eq(BocomShareholderActualController::getBocomBasicInfoId, bocomBasicInfo.getId())
|
|
|
- .orderByDesc(BocomShareholderActualController::getGmtCreate)
|
|
|
- .list();
|
|
|
- if (CollectionUtil.isNotEmpty(shareholderActualControllerList)) {
|
|
|
- BocomShareholderActualController bocomShareholderActualController = shareholderActualControllerList.get(0);
|
|
|
- if (bocomShareholderActualController != null) {
|
|
|
- vo.setAuthenticator(bocomShareholderActualController.getName());
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- if (bocomBasicInfo.getCustomerType() == 2) {
|
|
|
- vo.setAuthenticator(bocomBasicInfo.getCustomerName());
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
List<BocomVipAccountBasicInfo> vipList = lambdaQuery()
|
|
|
.eq(BocomVipAccountBasicInfo::getBocomBasicInfoId, bocomBasicInfo.getId())
|
|
|
.list();
|
|
|
if (CollectionUtils.isNotEmpty(vipList)) {
|
|
|
vipList.forEach(vipAccountBasicInfo -> {
|
|
|
+
|
|
|
+ autoAccountRealStatus(vipAccountBasicInfo);
|
|
|
+
|
|
|
+ if (bocomBasicInfo != null) {
|
|
|
+ //填充需要授权的人
|
|
|
+ if (StringUtil.isNotEmpty(vipAccountBasicInfo.getNoticeObject())) {
|
|
|
+ String[] values = vipAccountBasicInfo.getNoticeObject().split("/");
|
|
|
+ //授权代理热
|
|
|
+ BocomAuthorizedAgent authorizedAgent = bocomAuthorizedAgentService.lambdaQuery()
|
|
|
+ .eq(BocomAuthorizedAgent::getBocomBasicInfoId, bocomBasicInfo.getId())
|
|
|
+ .one();
|
|
|
+ //法人
|
|
|
+ BocomLegalPersonInfo legalPersonInfo = bocomLegalPersonInfoService.lambdaQuery()
|
|
|
+ .eq(BocomLegalPersonInfo::getBocomBasicInfoId, bocomBasicInfo.getId())
|
|
|
+ .one();
|
|
|
+ String authenticator = "";
|
|
|
+ if (values.length > 0) {
|
|
|
+ if (values.length == 1) {
|
|
|
+ if (authorizedAgent != null) {
|
|
|
+ //取授权代理人
|
|
|
+ authenticator = authorizedAgent.getName();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (values.length > 1) {
|
|
|
+ if (authorizedAgent != null && legalPersonInfo != null) {
|
|
|
+ //取法人和授权代理人
|
|
|
+ authenticator = authorizedAgent.getName() + "和" + legalPersonInfo.getName();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ vipAccountBasicInfo.setAuthenticator(authenticator);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
//标识是否需要重新创建会员登记簿
|
|
|
Date afterFiveDaysDate = DateUtil.addDays(vipAccountBasicInfo.getGmtModified(), 5);
|
|
|
if (new Date().before(afterFiveDaysDate)) {
|
|
@@ -163,10 +177,20 @@ public class BocomVipAccountBasicInfoServiceImpl extends ServiceImpl<BocomVipAcc
|
|
|
vo.setVipAccountBasicInfoList(vipList);
|
|
|
}
|
|
|
|
|
|
- if (CollectionUtil.isNotEmpty(vipList) || (customerStatusDic != null && "bocomCustomerStatus_success".equals(customerStatusDic.getCode()))) {
|
|
|
- //生效:展示;
|
|
|
- //待生效:不展示-整个卡片都不展示;
|
|
|
- //终止:如果存在登记簿,则展示;如果不存在,则该卡片整个不展示
|
|
|
+ if ("生效".equals(bocomBasicInfo.getCustomerRealStatus())) {
|
|
|
+ //客户真实状态为生效 且 该客户名下不存在待生效的登记簿 或者 该客户下账户状态为 生效的 会员登记簿少于五个时 展示新增账户按钮
|
|
|
+ Integer addVipAccount = 1;
|
|
|
+ if (CollectionUtil.isNotEmpty(vipList)){
|
|
|
+ long count = vipList.stream().filter(c -> "待生效".equals(c.getAccountStatusReal())).count();
|
|
|
+ if (count > 0){
|
|
|
+ addVipAccount = 0;
|
|
|
+ }
|
|
|
+ long effectCount = vipList.stream().filter(c -> c.getAccountStatus() == 1).count();
|
|
|
+ if (effectCount > 4){
|
|
|
+ addVipAccount = 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ vo.setAddVipAccount(addVipAccount);
|
|
|
voList.add(vo);
|
|
|
}
|
|
|
});
|
|
@@ -407,6 +431,9 @@ public class BocomVipAccountBasicInfoServiceImpl extends ServiceImpl<BocomVipAcc
|
|
|
} else {
|
|
|
bindAccountInfo.setOprTp("1");
|
|
|
}
|
|
|
+ if (bindAccountInfo.IsBankOfCommunications() == 1) {
|
|
|
+ bindAccountInfo.setBankName("中国交通银行");
|
|
|
+ }
|
|
|
ResponseJson responseJson;
|
|
|
try {
|
|
|
responseJson = restTemplate.postForObject(bocomVipBindDoUpdateUrl, bindAccountInfo, ResponseJson.class);
|
|
@@ -459,5 +486,58 @@ public class BocomVipAccountBasicInfoServiceImpl extends ServiceImpl<BocomVipAcc
|
|
|
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 填充账户真实状态
|
|
|
+ *
|
|
|
+ * @param vipAccountBasicInfo
|
|
|
+ */
|
|
|
+ private void autoAccountRealStatus(BocomVipAccountBasicInfo vipAccountBasicInfo) {
|
|
|
+
|
|
|
+ if (vipAccountBasicInfo != null) {
|
|
|
+ BocomVipLimitInfo vipLimitInfo = bocomVipLimitInfoService
|
|
|
+ .lambdaQuery()
|
|
|
+ .eq(BocomVipLimitInfo::getBocomVipAccountBasicInfoId, vipAccountBasicInfo.getId())
|
|
|
+ .one();
|
|
|
+
|
|
|
+ String realStatus = "";
|
|
|
+ if (vipAccountBasicInfo.getAccountStatus() == 1 ) {
|
|
|
+ // 授权状态 0-待用户授权 1-银行审核中 2-授权失败(用户拒绝)3-授权失败(银行拒绝)4-授权成功
|
|
|
+ //授权代理人授权状态
|
|
|
+ Integer authorizationStatus = vipAccountBasicInfo.getAuthorizationStatus();
|
|
|
+ //法人授权状态
|
|
|
+ Integer legalAuthorizationStatus = vipAccountBasicInfo.getLegalAuthorizationStatus();
|
|
|
+
|
|
|
+
|
|
|
+ if (authorizationStatus == 1 || legalAuthorizationStatus == 1 ||
|
|
|
+ authorizationStatus == 2 || legalAuthorizationStatus == 2 ||
|
|
|
+ authorizationStatus == 3 || legalAuthorizationStatus == 3) {
|
|
|
+ //任一授权状态为 1/2/3 时 账户真实状态置为 开通失败
|
|
|
+ realStatus = "开通失败";
|
|
|
+ }
|
|
|
+
|
|
|
+ if ((authorizationStatus == 0 || authorizationStatus == 4) && (authorizationStatus == 0 || authorizationStatus == 4)) {
|
|
|
+ //授权状态组合为 0+0 || 0+4 时 且 可收可付款(无收入管控且无支出管控)且 接口返回的登记簿状态为是生效 时 账户真实状态置为 生效
|
|
|
+ if (vipAccountBasicInfo.getChdbokSts() != null && vipAccountBasicInfo.getChdbokSts() == 1 || (vipLimitInfo != null && vipLimitInfo.getIncFlg() == 1 && vipLimitInfo.getPayFlg() == 1)) {
|
|
|
+ realStatus = "生效";
|
|
|
+ } else {
|
|
|
+ //授权状态组合为 0+0 || 0+4 时 且 可收可付款(无收入管控且无支出管控) 时 账户真实状态置为 待生效
|
|
|
+ realStatus = "待生效";
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (authorizationStatus == 4 && authorizationStatus == 4) {
|
|
|
+ //授权状态组合为 4+4 且 可收可付款(无收入管控且无支出管控) 时 账户真实状态置 为 生效
|
|
|
+ if (vipAccountBasicInfo.getChdbokSts() != null && vipAccountBasicInfo.getChdbokSts() == 1 || (vipLimitInfo != null && vipLimitInfo.getIncFlg() == 1 && vipLimitInfo.getPayFlg() == 1)) {
|
|
|
+ realStatus = "生效";
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ } else {
|
|
|
+ realStatus = "失效";
|
|
|
+ }
|
|
|
+ vipAccountBasicInfo.setAccountStatusReal(realStatus);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
}
|