|
@@ -16,7 +16,6 @@ import com.inkasso.factoring.bocom.register.entity.*;
|
|
|
import com.inkasso.factoring.bocom.register.entity.vo.BocomSearchVo;
|
|
|
import com.inkasso.factoring.bocom.register.entity.vo.EnterpriseDetailVo;
|
|
|
import com.inkasso.factoring.bocom.register.enums.BocomCustomerStageEnums;
|
|
|
-import com.inkasso.factoring.bocom.register.enums.BocomCustomerStatuEnums;
|
|
|
import com.inkasso.factoring.bocom.register.service.*;
|
|
|
import com.inkasso.factoring.dict.entity.Dictionary;
|
|
|
import com.inkasso.factoring.dict.service.DictionaryService;
|
|
@@ -25,7 +24,6 @@ import com.inkasso.factoring.file.enums.FileTypeEnum;
|
|
|
import com.inkasso.factoring.file.service.FileService;
|
|
|
import com.inkasso.factoring.system.user.entity.UserDO;
|
|
|
import com.inkasso.factoring.system.user.service.UserService;
|
|
|
-import org.apache.bcel.classfile.Code;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Service;
|
|
@@ -34,7 +32,6 @@ import org.springframework.web.client.RestTemplate;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
-import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
* <p>
|
|
@@ -96,13 +93,16 @@ public class BocomBasicInfoServiceImpl extends ServiceImpl<BocomBasicInfoMapper,
|
|
|
@Autowired
|
|
|
private DictionaryService dictionaryService;
|
|
|
|
|
|
+ @Value("${trade.bocomRegisterResetUrl}")
|
|
|
+ private String bocomRegisterResetUrl;
|
|
|
+
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public void add(BocomBasicInfo bocomBasicInfo) {
|
|
|
- if(bocomBasicInfo.getId() == null){
|
|
|
+ if (bocomBasicInfo.getId() == null) {
|
|
|
Long count = this.lambdaQuery().notIn(BocomBasicInfo::getCustomerStatus, BocomCustomerStageEnums.FAIL.getCode()).eq(BocomBasicInfo::getSocialCreditCode, bocomBasicInfo.getSocialCreditCode()).count();
|
|
|
- if(count > 0){
|
|
|
- throw new BusinessException(CodeUtil.FAIL,"该用户有在途的开户数据!");
|
|
|
+ if (count > 0) {
|
|
|
+ throw new BusinessException(CodeUtil.FAIL, "该用户有在途的开户数据!");
|
|
|
}
|
|
|
}
|
|
|
bocomBasicInfo.setCustomerSource("贸理通C");
|
|
@@ -290,23 +290,39 @@ public class BocomBasicInfoServiceImpl extends ServiceImpl<BocomBasicInfoMapper,
|
|
|
public List<BocomBasicInfo> findBySearch(BocomSearchVo bocomSearchVo) {
|
|
|
AbstractUser abstractUser = LoginUserHolder.get();
|
|
|
UserDO userDO = userService.getById(abstractUser.getId());
|
|
|
- List<BocomBasicInfo> list = this.lambdaQuery().in(BocomBasicInfo::getUserCreate, userDO.getLoginName(),userDO.getUserName()).list();
|
|
|
+ List<BocomBasicInfo> list = this.lambdaQuery().in(BocomBasicInfo::getUserCreate, userDO.getLoginName(), userDO.getUserName()).list();
|
|
|
for (BocomBasicInfo bocomBasicInfo : list) {
|
|
|
Dictionary stage = dictionaryService.getByCode(bocomBasicInfo.getStage());
|
|
|
Dictionary status = dictionaryService.getByCode(bocomBasicInfo.getCustomerStatus());
|
|
|
- if(stage != null){
|
|
|
+ if (stage != null) {
|
|
|
bocomBasicInfo.setStage(stage.getName());
|
|
|
}
|
|
|
- if(status != null){
|
|
|
+ if (status != null) {
|
|
|
bocomBasicInfo.setCustomerStatus(status.getName());
|
|
|
}
|
|
|
List<BocomApproval> bocomApprovals = bocomApprovalService.lambdaQuery().eq(BocomApproval::getBocomBasicInfoId, bocomBasicInfo.getId()).orderByDesc(BocomApproval::getGmtCreate).list();
|
|
|
- if(CollectionUtil.isNotEmpty(bocomApprovals)){
|
|
|
+ if (CollectionUtil.isNotEmpty(bocomApprovals)) {
|
|
|
BocomApproval bocomApproval = bocomApprovals.get(0);
|
|
|
if (bocomApproval != null && bocomApproval.getApprovalConclusion().equals("back")) {
|
|
|
bocomBasicInfo.setReason(bocomApproval.getApprovalComment());
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ //填充法人授权人
|
|
|
+ if (bocomBasicInfo.getCustomerType() == 0) {
|
|
|
+ BocomLegalPersonInfo legalPersonInfo = bocomLegalPersonInfoService.lambdaQuery().eq(BocomLegalPersonInfo::getBocomBasicInfoId, bocomBasicInfo.getId())
|
|
|
+ .one();
|
|
|
+ if (legalPersonInfo != null) {
|
|
|
+ bocomBasicInfo.setAuthenticator(legalPersonInfo.getName());
|
|
|
+ }
|
|
|
+ } else if (bocomBasicInfo.getCustomerType() == 1) {
|
|
|
+ BocomShareholderActualController actualController = bocomShareholderActualControllerService.lambdaQuery().eq(BocomShareholderActualController::getBocomBasicInfoId, bocomBasicInfo.getId())
|
|
|
+ .eq(BocomShareholderActualController::getPersonType, 2)
|
|
|
+ .one();
|
|
|
+ if (actualController != null){
|
|
|
+ bocomBasicInfo.setAuthenticator(actualController.getName());
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
return list;
|
|
|
}
|
|
@@ -317,7 +333,7 @@ public class BocomBasicInfoServiceImpl extends ServiceImpl<BocomBasicInfoMapper,
|
|
|
ResponseJson responseJson = restTemplate.getForObject(getEnterpriseDetail + "?keyword=" + keyword, ResponseJson.class);
|
|
|
JSONObject data = new JSONObject(responseJson.getData());
|
|
|
String date = data.getStr("date");
|
|
|
- if(StringUtil.isEmpty(date)){
|
|
|
+ if (StringUtil.isEmpty(date)) {
|
|
|
date = "99991231";
|
|
|
}
|
|
|
String scope = data.getStr("scope");
|
|
@@ -330,7 +346,7 @@ public class BocomBasicInfoServiceImpl extends ServiceImpl<BocomBasicInfoMapper,
|
|
|
if (CollectionUtil.isNotEmpty(partnerArray)) {
|
|
|
for (Object o : partnerArray) {
|
|
|
String name = (String) o;
|
|
|
- if(name.length() <= 4){
|
|
|
+ if (name.length() <= 4) {
|
|
|
JSONObject jsonObject = new JSONObject();
|
|
|
jsonObject.set("name", name);
|
|
|
jsonObject.set("type", 0);
|
|
@@ -338,13 +354,13 @@ public class BocomBasicInfoServiceImpl extends ServiceImpl<BocomBasicInfoMapper,
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- if(CollectionUtil.isEmpty(partnerList)){
|
|
|
+ if (CollectionUtil.isEmpty(partnerList)) {
|
|
|
//实际控制人
|
|
|
JSONArray actualControlArray = data.getJSONArray("actualControlList");
|
|
|
if (CollectionUtil.isNotEmpty(actualControlArray)) {
|
|
|
for (Object o : actualControlArray) {
|
|
|
String name = (String) o;
|
|
|
- if(name.length() <= 4){
|
|
|
+ if (name.length() <= 4) {
|
|
|
JSONObject jsonObject = new JSONObject();
|
|
|
jsonObject.set("name", name);
|
|
|
jsonObject.set("type", 1);
|
|
@@ -360,7 +376,7 @@ public class BocomBasicInfoServiceImpl extends ServiceImpl<BocomBasicInfoMapper,
|
|
|
if (CollectionUtil.isNotEmpty(beneficialOwnerArray)) {
|
|
|
for (Object o : beneficialOwnerArray) {
|
|
|
String name = (String) o;
|
|
|
- if(name.length() <= 4){
|
|
|
+ if (name.length() <= 4) {
|
|
|
beneficialOwnerList.add(name);
|
|
|
}
|
|
|
}
|
|
@@ -392,6 +408,36 @@ public class BocomBasicInfoServiceImpl extends ServiceImpl<BocomBasicInfoMapper,
|
|
|
return reason;
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public BocomBasicInfo resetUrlAuthorized(Long id) {
|
|
|
+
|
|
|
+ try {
|
|
|
+ com.inkasso.factoring.common.entity.ResponseJson responseJson = restTemplate.getForObject(bocomRegisterResetUrl + "?id=" + id, com.inkasso.factoring.common.entity.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());
|
|
|
+ }
|
|
|
+ BocomBasicInfo basicInfo = getById(id);
|
|
|
+ //填充法人授权人
|
|
|
+ if (basicInfo.getCustomerType() == 0) {
|
|
|
+ BocomLegalPersonInfo legalPersonInfo = bocomLegalPersonInfoService.lambdaQuery().eq(BocomLegalPersonInfo::getBocomBasicInfoId, id)
|
|
|
+ .one();
|
|
|
+ if (legalPersonInfo != null) {
|
|
|
+ basicInfo.setAuthenticator(legalPersonInfo.getName());
|
|
|
+ }
|
|
|
+ } else if (basicInfo.getCustomerType() == 1) {
|
|
|
+ BocomShareholderActualController actualController = bocomShareholderActualControllerService.lambdaQuery().eq(BocomShareholderActualController::getBocomBasicInfoId, id)
|
|
|
+ .eq(BocomShareholderActualController::getPersonType, 2)
|
|
|
+ .one();
|
|
|
+ if (actualController != null){
|
|
|
+ basicInfo.setAuthenticator(actualController.getName());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return basicInfo;
|
|
|
+ }
|
|
|
+
|
|
|
private String findReasons(int index) {
|
|
|
int number = index + 1;
|
|
|
String result = "";
|
|
@@ -540,7 +586,7 @@ public class BocomBasicInfoServiceImpl extends ServiceImpl<BocomBasicInfoMapper,
|
|
|
bocomLegalPersonInfoHistory.setBocomBasicInfoId(bocomBasicInfoHistory.getId());
|
|
|
bocomLegalPersonInfoHistoryService.save(bocomLegalPersonInfoHistory);
|
|
|
Long front = bocomLegalPersonInfo.getFront();
|
|
|
- if(front != null){
|
|
|
+ if (front != null) {
|
|
|
FileStorageDO frontFile = fileService.getById(front);
|
|
|
frontFile.setId(null);
|
|
|
frontFile.setBusinessType(FileTypeEnum.BOCOM_LEGAL_REPRESENTATIVE_IDCARD_FRONT_HISTORY.getCode());
|
|
@@ -548,7 +594,7 @@ public class BocomBasicInfoServiceImpl extends ServiceImpl<BocomBasicInfoMapper,
|
|
|
fileService.save(frontFile);
|
|
|
}
|
|
|
Long back = bocomLegalPersonInfo.getBack();
|
|
|
- if(back != null){
|
|
|
+ if (back != null) {
|
|
|
FileStorageDO backFile = fileService.getById(back);
|
|
|
backFile.setId(null);
|
|
|
backFile.setBusinessType(FileTypeEnum.BOCOM_LEGAL_REPRESENTATIVE_IDCARD_BACK_HISTORY.getCode());
|
|
@@ -564,7 +610,7 @@ public class BocomBasicInfoServiceImpl extends ServiceImpl<BocomBasicInfoMapper,
|
|
|
bocomShareholderActualControllerHistory.setBocomBasicInfoId(bocomBasicInfoHistory.getId());
|
|
|
bocomShareholderActualControllerHistoryService.save(bocomShareholderActualControllerHistory);
|
|
|
Long front = bocomShareholderActualController.getFront();
|
|
|
- if(front != null){
|
|
|
+ if (front != null) {
|
|
|
FileStorageDO frontFile = fileService.getById(front);
|
|
|
frontFile.setId(null);
|
|
|
frontFile.setBusinessType(FileTypeEnum.BOCOM_SHAREHOLDER_IDCARD_FRONT_HISTORY.getCode());
|
|
@@ -572,7 +618,7 @@ public class BocomBasicInfoServiceImpl extends ServiceImpl<BocomBasicInfoMapper,
|
|
|
fileService.save(frontFile);
|
|
|
}
|
|
|
Long back = bocomShareholderActualController.getBack();
|
|
|
- if(back != null){
|
|
|
+ if (back != null) {
|
|
|
FileStorageDO backFile = fileService.getById(back);
|
|
|
backFile.setId(null);
|
|
|
backFile.setBusinessType(FileTypeEnum.BOCOM_SHAREHOLDER_IDCARD_BACK_HISTORY.getCode());
|
|
@@ -589,7 +635,7 @@ public class BocomBasicInfoServiceImpl extends ServiceImpl<BocomBasicInfoMapper,
|
|
|
bocomBeneficiaryInfoHistory.setBocomBasicInfoId(bocomBasicInfoHistory.getId());
|
|
|
bocomBeneficiaryInfoHistoryService.save(bocomBeneficiaryInfoHistory);
|
|
|
Long front = bocomBeneficiaryInfo.getFront();
|
|
|
- if(front != null){
|
|
|
+ if (front != null) {
|
|
|
FileStorageDO frontFile = fileService.getById(front);
|
|
|
frontFile.setId(null);
|
|
|
frontFile.setBusinessType(FileTypeEnum.BOCOM_BENEFICIARY_IDCARD_FRONT_HISTORY.getCode());
|
|
@@ -597,7 +643,7 @@ public class BocomBasicInfoServiceImpl extends ServiceImpl<BocomBasicInfoMapper,
|
|
|
fileService.save(frontFile);
|
|
|
}
|
|
|
Long back = bocomBeneficiaryInfo.getBack();
|
|
|
- if(back != null){
|
|
|
+ if (back != null) {
|
|
|
FileStorageDO backFile = fileService.getById(back);
|
|
|
backFile.setId(null);
|
|
|
backFile.setBusinessType(FileTypeEnum.BOCOM_BENEFICIARY_IDCARD_BACK_HISTORY.getCode());
|
|
@@ -613,7 +659,7 @@ public class BocomBasicInfoServiceImpl extends ServiceImpl<BocomBasicInfoMapper,
|
|
|
bocomAuthorizedAgentHistory.setBocomBasicInfoId(bocomBasicInfoHistory.getId());
|
|
|
bocomAuthorizedAgentHistoryService.save(bocomAuthorizedAgentHistory);
|
|
|
Long front = bocomAuthorizedAgent.getFront();
|
|
|
- if(front != null){
|
|
|
+ if (front != null) {
|
|
|
FileStorageDO frontFile = fileService.getById(front);
|
|
|
frontFile.setId(null);
|
|
|
frontFile.setBusinessType(FileTypeEnum.BOCOM_AUTHORIZED_AGENT_IDCARD_FRONT_HISTORY.getCode());
|
|
@@ -621,7 +667,7 @@ public class BocomBasicInfoServiceImpl extends ServiceImpl<BocomBasicInfoMapper,
|
|
|
fileService.save(frontFile);
|
|
|
}
|
|
|
Long back = bocomAuthorizedAgent.getBack();
|
|
|
- if(back != null){
|
|
|
+ if (back != null) {
|
|
|
FileStorageDO backFile = fileService.getById(back);
|
|
|
backFile.setId(null);
|
|
|
backFile.setBusinessType(FileTypeEnum.BOCOM_AUTHORIZED_AGENT_IDCARD_BACK_HISTORY.getCode());
|