Browse Source

Merge remote-tracking branch 'origin/bocom' into bocom

liutao 1 month ago
parent
commit
5edc806b8c

+ 14 - 0
src/main/java/com/inkasso/factoring/bocom/vipaccount/entity/BocomVipAccountBasicInfo.java

@@ -201,6 +201,12 @@ public class BocomVipAccountBasicInfo extends BaseEntity {
     @TableField(exist = false)
     private String customerStatus;
 
+    /**
+     * 认证人
+     */
+    @TableField(exist = false)
+    private String authenticator;
+
     public List<BocomVipSilentAccountInfo> getSilentAccountInfoList() {
         return silentAccountInfoList;
     }
@@ -441,6 +447,14 @@ public class BocomVipAccountBasicInfo extends BaseEntity {
         this.chdbokSts = chdbokSts;
     }
 
+    public String getAuthenticator() {
+        return authenticator;
+    }
+
+    public void setAuthenticator(String authenticator) {
+        this.authenticator = authenticator;
+    }
+
     @Override
     public String toString() {
         return "BocomVipAccountBasicInfo{" +

+ 77 - 28
src/main/java/com/inkasso/factoring/bocom/vipaccount/service/impl/BocomVipAccountBasicInfoServiceImpl.java

@@ -205,6 +205,32 @@ public class BocomVipAccountBasicInfoServiceImpl extends ServiceImpl<BocomVipAcc
                 bocomVipLimitInfoService.save(bocomVipLimitInfo);
             }
         }
+        if (basicInfo.getCustomerType() != null) {
+            if (0 == newBasicInfo.getCustomerType()) {
+                BocomLegalPersonInfo legalPersonInfo = bocomLegalPersonInfoService.lambdaQuery()
+                        .eq(BocomLegalPersonInfo::getBocomBasicInfoId, basicInfo.getId())
+                        .one();
+                if (legalPersonInfo != null) {
+                    newBasicInfo.setAuthenticator(legalPersonInfo.getName());
+                }
+            }
+            if (1 == newBasicInfo.getCustomerType()) {
+                List<BocomShareholderActualController> shareholderActualControllerList = bocomShareholderActualControllerService.lambdaQuery()
+                        .eq(BocomShareholderActualController::getBocomBasicInfoId, basicInfo.getId())
+                        .orderByDesc(BocomShareholderActualController::getGmtCreate)
+                        .list();
+                if (cn.hutool.core.collection.CollectionUtil.isNotEmpty(shareholderActualControllerList)) {
+                    BocomShareholderActualController bocomShareholderActualController = shareholderActualControllerList.get(0);
+                    if (bocomShareholderActualController != null) {
+                        newBasicInfo.setAuthenticator(bocomShareholderActualController.getName());
+                    }
+                }
+            }
+            if (2 == newBasicInfo.getCustomerType()) {
+                newBasicInfo.setAuthenticator(basicInfo.getCustomerName());
+            }
+        }
+
         return newBasicInfo;
     }
 
@@ -249,41 +275,64 @@ public class BocomVipAccountBasicInfoServiceImpl extends ServiceImpl<BocomVipAcc
         BocomVipAccountBasicInfo oldBasicInfo = getById(basicInfo.getId());
         basicInfo.setAccountNumber(oldBasicInfo.getAccountNumber());
         basicInfo.setBocomBasicInfoId(oldBasicInfo.getBocomBasicInfoId());
-        ResponseJson responseJson;
-        try {
-            responseJson = restTemplate.postForObject(bocomVipUpdateUrl, basicInfo, ResponseJson.class);
-            if (!responseJson.getCode().equals(200)) {
-                throw new BusinessException(CodeUtil.FAIL, responseJson.getMsg().toString());
+        ResponseJson responseJson = null;
+        if (CollectionUtil.isNotEmpty(basicInfo.getSilentAccountInfoList())) {
+            List<BocomVipSilentAccountInfo> newSilentAccountInfoList = basicInfo.getSilentAccountInfoList();
+            for (BocomVipSilentAccountInfo newSilentAccountInfo : newSilentAccountInfoList) {
+
+                ArrayList<BocomVipSilentAccountInfo> silentAccountInfos = new ArrayList<>();
+                silentAccountInfos.add(newSilentAccountInfo);
+                oldBasicInfo.setSilentAccountInfoList(silentAccountInfos);
+                try {
+                    responseJson = restTemplate.postForObject(bocomVipUpdateUrl, basicInfo, ResponseJson.class);
+                    if (!responseJson.getCode().equals(200)) {
+                        throw new BusinessException(CodeUtil.FAIL, responseJson.getMsg().toString());
+                    }
+
+                } catch (Exception e) {
+                    throw new BusinessException(CodeUtil.FAIL, e.getMessage());
+                }
+                //静默户入库
+                newSilentAccountInfo.setBocomVipAccountBasicInfoId(oldBasicInfo.getId());
+                bocomVipSilentAccoutInfoService.save(newSilentAccountInfo);
             }
 
-        } catch (Exception e) {
-            throw new BusinessException(CodeUtil.FAIL, e.getMessage());
-        }
-        BocomVipAccountBasicInfo newBasicInfo = JSONObject.parseObject(JSONObject.toJSONString(responseJson.getData()), BocomVipAccountBasicInfo.class);
+            if (CollectionUtil.isNotEmpty(basicInfo.getDeleteSilentIds())) {
+                //删除会员登记簿
+                for (Long deleteSilentId : basicInfo.getDeleteSilentIds()) {
+                    List<Long> ids = new ArrayList<>();
+                    ids.add(deleteSilentId);
+                    oldBasicInfo.setDeleteSilentIds(ids);
+                    try {
+                        responseJson = restTemplate.postForObject(bocomVipUpdateUrl, basicInfo, ResponseJson.class);
+                        if (!responseJson.getCode().equals(200)) {
+                            throw new BusinessException(CodeUtil.FAIL, responseJson.getMsg().toString());
+                        }
+
+                    } catch (Exception e) {
+                        throw new BusinessException(CodeUtil.FAIL, e.getMessage());
+                    }
+                    bocomVipSilentAccoutInfoService.removeById(deleteSilentId);
+                }
 
-        updateById(newBasicInfo);
-        if (newBasicInfo.getBocomVipLimitInfo() != null) {
-            BocomVipLimitInfo bocomVipLimitInfo = newBasicInfo.getBocomVipLimitInfo();
-            BocomVipLimitInfo oldLimitInfo = bocomVipLimitInfoService.lambdaQuery()
-                    .eq(BocomVipLimitInfo::getBocomVipAccountBasicInfoId, newBasicInfo.getId())
-                    .one();
-            bocomVipLimitInfo.setBocomVipAccountBasicInfoId(newBasicInfo.getId());
-            bocomVipLimitInfo.setId(oldLimitInfo.getId());
-            bocomVipLimitInfoService.updateById(bocomVipLimitInfo);
-
-            if (CollectionUtils.isNotEmpty(newBasicInfo.getSilentAccountInfoList())) {
-                newBasicInfo.getSilentAccountInfoList().forEach(bocomVipSilentAccountInfo -> {
-                    bocomVipSilentAccountInfo.setBocomVipAccountBasicInfoId(newBasicInfo.getId());
-                    bocomVipSilentAccoutInfoService.save(bocomVipSilentAccountInfo);
-                });
             }
 
-            if (CollectionUtils.isNotEmpty(newBasicInfo.getDeleteSilentIds())) {
-                newBasicInfo.getDeleteSilentIds().forEach(silentId -> {
-                    bocomVipSilentAccoutInfoService.removeById(silentId);
-                });
+            if (responseJson != null){
+                BocomVipAccountBasicInfo newBasicInfo = JSONObject.parseObject(JSONObject.toJSONString(responseJson.getData()), BocomVipAccountBasicInfo.class);
 
+                updateById(newBasicInfo);
+                if (newBasicInfo.getBocomVipLimitInfo() != null) {
+                    BocomVipLimitInfo bocomVipLimitInfo = newBasicInfo.getBocomVipLimitInfo();
+                    BocomVipLimitInfo oldLimitInfo = bocomVipLimitInfoService.lambdaQuery()
+                            .eq(BocomVipLimitInfo::getBocomVipAccountBasicInfoId, newBasicInfo.getId())
+                            .one();
+                    bocomVipLimitInfo.setBocomVipAccountBasicInfoId(newBasicInfo.getId());
+                    bocomVipLimitInfo.setId(oldLimitInfo.getId());
+                    bocomVipLimitInfoService.updateById(bocomVipLimitInfo);
+
+                }
             }
+
         }
     }