Browse Source

feat(对接交行):会员登记薄多个授权人

Wangyafan 1 month ago
parent
commit
c895ad8d02

+ 16 - 0
src/main/java/com/inkasso/factoring/bocom/vipaccount/dao/BocomVipAccountNoticeInfoMapper.java

@@ -0,0 +1,16 @@
+package com.inkasso.factoring.bocom.vipaccount.dao;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.inkasso.factoring.bocom.vipaccount.entity.BocomVipAccountNoticeInfo;
+
+/**
+ * <p>
+ * 会员账户-通知推送表 Mapper 接口
+ * </p>
+ *
+ * @author wangyafan
+ * @since 2024-09-20
+ */
+public interface BocomVipAccountNoticeInfoMapper extends BaseMapper<BocomVipAccountNoticeInfo> {
+
+}

+ 11 - 10
src/main/java/com/inkasso/factoring/bocom/vipaccount/entity/BocomVipAccountBasicInfo.java

@@ -215,11 +215,12 @@ public class BocomVipAccountBasicInfo extends BaseEntity {
     @TableField(exist = false)
     private List<BocomVipBindAccountInfo> bindAccountInfoList = new ArrayList<>();
 
+
     /**
-     * 认证
+     * 认证信息
      */
     @TableField(exist = false)
-    private String authenticator;
+    private List<BocomVipAccountNoticeInfo> noticeInfoList;
 
     public List<BocomVipSilentAccountInfo> getSilentAccountInfoList() {
         return silentAccountInfoList;
@@ -445,14 +446,6 @@ public class BocomVipAccountBasicInfo extends BaseEntity {
         this.plfmSerNo = plfmSerNo;
     }
 
-    public String getAuthenticator() {
-        return authenticator;
-    }
-
-    public void setAuthenticator(String authenticator) {
-        this.authenticator = authenticator;
-    }
-
     public Integer getLegalAuthorizationStatus() {
         return legalAuthorizationStatus;
     }
@@ -485,6 +478,14 @@ public class BocomVipAccountBasicInfo extends BaseEntity {
         this.accountStatusReal = accountStatusReal;
     }
 
+    public List<BocomVipAccountNoticeInfo> getNoticeInfoList() {
+        return noticeInfoList;
+    }
+
+    public void setNoticeInfoList(List<BocomVipAccountNoticeInfo> noticeInfoList) {
+        this.noticeInfoList = noticeInfoList;
+    }
+
     @Override
     public String toString() {
         return "BocomVipAccountBasicInfo{" +

+ 103 - 0
src/main/java/com/inkasso/factoring/bocom/vipaccount/entity/BocomVipAccountNoticeInfo.java

@@ -0,0 +1,103 @@
+package com.inkasso.factoring.bocom.vipaccount.entity;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.inkasso.factoring.common.entity.BaseEntity;
+
+import java.util.Date;
+
+/**
+ * <p>
+ * 会员账户-通知推送表
+ * </p>
+ *
+ * @author wangyafan
+ * @since 2024-09-20
+ */
+@TableName("bocom_vip_account_notice_info")
+public class BocomVipAccountNoticeInfo extends BaseEntity {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 会员账户-基础信息表id
+     */
+    @TableField("bocom_vip_account_basic_info_id")
+    private Long bocomVipAccountBasicInfoId;
+
+    /**
+     * 授权二维码
+     */
+    @TableField("qr_code")
+    private String qrCode;
+
+    /**
+     * 授权二维码生效时间
+     */
+    @TableField("qr_code_effect_time")
+    private Date qrCodeEffectTime;
+
+    /**
+     * 通知推送对象  1-法人 2-授权代理人 3-个人
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @TableField("qr_code_effect_time")
+    private String noticeObject;
+
+    /**
+     * 认证人
+     */
+    @TableField(exist = false)
+    private String authenticator;
+
+    public Long getBocomVipAccountBasicInfoId() {
+        return bocomVipAccountBasicInfoId;
+    }
+
+    public void setBocomVipAccountBasicInfoId(Long bocomVipAccountBasicInfoId) {
+        this.bocomVipAccountBasicInfoId = bocomVipAccountBasicInfoId;
+    }
+
+    public String getQrCode() {
+        return qrCode;
+    }
+
+    public void setQrCode(String qrCode) {
+        this.qrCode = qrCode;
+    }
+
+    public Date getQrCodeEffectTime() {
+        return qrCodeEffectTime;
+    }
+
+    public void setQrCodeEffectTime(Date qrCodeEffectTime) {
+        this.qrCodeEffectTime = qrCodeEffectTime;
+    }
+
+    public String getNoticeObject() {
+        return noticeObject;
+    }
+
+    public void setNoticeObject(String noticeObject) {
+        this.noticeObject = noticeObject;
+    }
+
+    public String getAuthenticator() {
+        return authenticator;
+    }
+
+    public void setAuthenticator(String authenticator) {
+        this.authenticator = authenticator;
+    }
+
+    @Override
+    public String toString() {
+        return "BocomVipAccountNoticeInfo{" +
+                ", bocomVipAccountBasicInfoId=" + bocomVipAccountBasicInfoId +
+                ", qrCode=" + qrCode +
+                ", qrCodeEffectTime=" + qrCodeEffectTime +
+                ", noticeObject=" + noticeObject +
+                "}";
+    }
+}

+ 16 - 0
src/main/java/com/inkasso/factoring/bocom/vipaccount/service/IBocomVipAccountNoticeInfoService.java

@@ -0,0 +1,16 @@
+package com.inkasso.factoring.bocom.vipaccount.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.inkasso.factoring.bocom.vipaccount.entity.BocomVipAccountNoticeInfo;
+
+/**
+ * <p>
+ * 会员账户-通知推送表 服务类
+ * </p>
+ *
+ * @author wangyafan
+ * @since 2024-09-20
+ */
+public interface IBocomVipAccountNoticeInfoService extends IService<BocomVipAccountNoticeInfo> {
+
+}

+ 39 - 122
src/main/java/com/inkasso/factoring/bocom/vipaccount/service/impl/BocomVipAccountBasicInfoServiceImpl.java

@@ -18,15 +18,9 @@ import com.inkasso.factoring.bocom.register.service.IBocomBasicInfoService;
 import com.inkasso.factoring.bocom.register.service.IBocomLegalPersonInfoService;
 import com.inkasso.factoring.bocom.register.service.IBocomShareholderActualControllerService;
 import com.inkasso.factoring.bocom.vipaccount.dao.BocomVipAccountBasicInfoMapper;
-import com.inkasso.factoring.bocom.vipaccount.entity.BocomVipAccountBasicInfo;
-import com.inkasso.factoring.bocom.vipaccount.entity.BocomVipBindAccountInfo;
-import com.inkasso.factoring.bocom.vipaccount.entity.BocomVipLimitInfo;
-import com.inkasso.factoring.bocom.vipaccount.entity.BocomVipSilentAccountInfo;
+import com.inkasso.factoring.bocom.vipaccount.entity.*;
 import com.inkasso.factoring.bocom.vipaccount.entity.vo.BocomVipAccountListVo;
-import com.inkasso.factoring.bocom.vipaccount.service.IBocomVipAccountBasicInfoService;
-import com.inkasso.factoring.bocom.vipaccount.service.IBocomVipBindAccoutInfoService;
-import com.inkasso.factoring.bocom.vipaccount.service.IBocomVipLimitInfoService;
-import com.inkasso.factoring.bocom.vipaccount.service.IBocomVipSilentAccoutInfoService;
+import com.inkasso.factoring.bocom.vipaccount.service.*;
 import com.inkasso.factoring.common.entity.ResponseJson;
 import com.inkasso.factoring.common.service.SerialNumberGenerator;
 import com.inkasso.factoring.common.util.DateUtil;
@@ -85,6 +79,8 @@ public class BocomVipAccountBasicInfoServiceImpl extends ServiceImpl<BocomVipAcc
     private IBocomShareholderActualControllerService bocomShareholderActualControllerService;
     @Autowired
     private IBocomAuthorizedAgentService bocomAuthorizedAgentService;
+    @Autowired
+    private IBocomVipAccountNoticeInfoService bocomVipAccountNoticeInfoService;
 
     @Override
     public List<BocomVipAccountListVo> findList() {
@@ -115,38 +111,8 @@ public class BocomVipAccountBasicInfoServiceImpl extends ServiceImpl<BocomVipAcc
                     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);
-                                }
-                            }
-                        }
+                        //填充需要授权的人
+                        autoAuthenticator(vipAccountBasicInfo);
 
                         //标识是否需要重新创建会员登记簿
                         Date afterFiveDaysDate = DateUtil.addDays(vipAccountBasicInfo.getGmtModified(), 5);
@@ -242,34 +208,7 @@ public class BocomVipAccountBasicInfoServiceImpl extends ServiceImpl<BocomVipAcc
             }
         }
         //填充需要授权的人
-        if (StringUtil.isNotEmpty(newBasicInfo.getNoticeObject())) {
-            String[] values = newBasicInfo.getNoticeObject().split("/");
-            //授权代理人
-            BocomAuthorizedAgent authorizedAgent = bocomAuthorizedAgentService.lambdaQuery()
-                    .eq(BocomAuthorizedAgent::getBocomBasicInfoId, basicInfo.getId())
-                    .one();
-            //法人
-            BocomLegalPersonInfo legalPersonInfo = bocomLegalPersonInfoService.lambdaQuery()
-                    .eq(BocomLegalPersonInfo::getBocomBasicInfoId, basicInfo.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();
-                    }
-                }
-                newBasicInfo.setAuthenticator(authenticator);
-            }
-        }
+        autoAuthenticator(newBasicInfo);
 
         return newBasicInfo;
     }
@@ -422,10 +361,14 @@ public class BocomVipAccountBasicInfoServiceImpl extends ServiceImpl<BocomVipAcc
                 throw new BusinessException(CodeUtil.FAIL, e.getMessage());
             }
             newVipAccount = JSONObject.parseObject(JSONObject.toJSONString(responseJson.getData()), BocomVipAccountBasicInfo.class);
-            lambdaUpdate().eq(BocomVipAccountBasicInfo::getId, newVipAccount.getId())
-                    .set(BocomVipAccountBasicInfo::getQrCode, newVipAccount.getQrCode())
-                    .set(BocomVipAccountBasicInfo::getQrCodeEffectTime, newVipAccount.getQrCodeEffectTime())
-                    .update();
+            //全删全进
+            bocomVipAccountNoticeInfoService.remove(new QueryWrapper<BocomVipAccountNoticeInfo>()
+                    .eq("bocom_vip_account_basic_info_id",newVipAccount.getId()));
+            if (CollectionUtil.isNotEmpty(newVipAccount.getNoticeInfoList())) {
+                newVipAccount.getNoticeInfoList().forEach(n -> {
+                    bocomVipAccountNoticeInfoService.save(n);
+                });
+            }
 
         }
         return newVipAccount;
@@ -496,57 +439,31 @@ public class BocomVipAccountBasicInfoServiceImpl extends ServiceImpl<BocomVipAcc
     }
 
     /**
-     * 填充账户真实状态
-     *
-     * @param vipAccountBasicInfo
+     * 填充授权代理人
+     * @param bocomVipAccountBasicInfo
      */
-//    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.setAccountStatus(realStatus);
-//        }
-//    }
+    private void autoAuthenticator(BocomVipAccountBasicInfo bocomVipAccountBasicInfo){
+        BocomBasicInfo basicInfo = bocomBasicInfoService.getById(bocomVipAccountBasicInfo.getBocomBasicInfoId());
+        if (CollectionUtil.isNotEmpty(bocomVipAccountBasicInfo.getNoticeInfoList())) {
+            //授权代理人
+            BocomAuthorizedAgent authorizedAgent = bocomAuthorizedAgentService.lambdaQuery()
+                    .eq(BocomAuthorizedAgent::getBocomBasicInfoId, basicInfo.getId())
+                    .one();
+            //法人
+            BocomLegalPersonInfo legalPersonInfo = bocomLegalPersonInfoService.lambdaQuery()
+                    .eq(BocomLegalPersonInfo::getBocomBasicInfoId, basicInfo.getId())
+                    .one();
+            bocomVipAccountBasicInfo.getNoticeInfoList().forEach(n->{
+                if (n.getNoticeObject().equals("1")){
+                    n.setAuthenticator(legalPersonInfo.getName());
+                }
+                if (n.getNoticeObject().equals("2")){
+                    n.setAuthenticator(authorizedAgent.getName());
+                }
+            });
+
+        }
+    }
 
 
 }

+ 20 - 0
src/main/java/com/inkasso/factoring/bocom/vipaccount/service/impl/BocomVipAccountNoticeInfoServiceImpl.java

@@ -0,0 +1,20 @@
+package com.inkasso.factoring.bocom.vipaccount.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.inkasso.factoring.bocom.vipaccount.dao.BocomVipAccountNoticeInfoMapper;
+import com.inkasso.factoring.bocom.vipaccount.entity.BocomVipAccountNoticeInfo;
+import com.inkasso.factoring.bocom.vipaccount.service.IBocomVipAccountNoticeInfoService;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ * 会员账户-通知推送表 服务实现类
+ * </p>
+ *
+ * @author wangyafan
+ * @since 2024-09-20
+ */
+@Service
+public class BocomVipAccountNoticeInfoServiceImpl extends ServiceImpl<BocomVipAccountNoticeInfoMapper, BocomVipAccountNoticeInfo> implements IBocomVipAccountNoticeInfoService {
+
+}