|
@@ -7,19 +7,23 @@ import com.fadada.sdk.client.FddClientBase;
|
7
|
7
|
import com.fadada.sdk.client.authForfadada.FindCertInfo;
|
8
|
8
|
import com.fadada.sdk.client.authForfadada.GetPersonVerifyUrl;
|
9
|
9
|
import com.huiju.estateagents.common.CommConstant;
|
|
10
|
+import com.huiju.estateagents.common.StringUtils;
|
10
|
11
|
import com.huiju.estateagents.config.FadadaProperties;
|
11
|
12
|
import com.huiju.estateagents.eContract.entity.TaContractUser;
|
12
|
13
|
import com.huiju.estateagents.eContract.mapper.TaContractUserMapper;
|
13
|
14
|
import com.huiju.estateagents.eContract.service.ITaContractUserService;
|
14
|
15
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
16
|
+import com.huiju.estateagents.entity.TaMiniapp;
|
15
|
17
|
import com.huiju.estateagents.entity.TaPerson;
|
16
|
18
|
import com.huiju.estateagents.entity.TaRaiseRecord;
|
|
19
|
+import com.huiju.estateagents.mapper.TaMiniappMapper;
|
17
|
20
|
import jodd.util.URLDecoder;
|
18
|
21
|
import lombok.extern.slf4j.Slf4j;
|
19
|
22
|
import org.apache.commons.codec.binary.Base64;
|
20
|
23
|
import org.springframework.beans.factory.annotation.Autowired;
|
21
|
24
|
import org.springframework.stereotype.Service;
|
22
|
25
|
|
|
26
|
+import java.io.File;
|
23
|
27
|
import java.time.LocalDateTime;
|
24
|
28
|
|
25
|
29
|
/**
|
|
@@ -39,6 +43,9 @@ public class TaContractUserServiceImpl extends ServiceImpl<TaContractUserMapper,
|
39
|
43
|
|
40
|
44
|
@Autowired
|
41
|
45
|
private TaContractUserMapper taContractUserMapper;
|
|
46
|
+
|
|
47
|
+ @Autowired
|
|
48
|
+ private TaMiniappMapper taMiniappMapper;
|
42
|
49
|
/**
|
43
|
50
|
* 小程序端首次签署合同的是要在法大大处创建账号
|
44
|
51
|
*
|
|
@@ -59,7 +66,7 @@ public class TaContractUserServiceImpl extends ServiceImpl<TaContractUserMapper,
|
59
|
66
|
//没有法大大账号的先注册
|
60
|
67
|
log.info("========法大大个人注册=======");
|
61
|
68
|
//在法大大注册个人用户
|
62
|
|
- FddClientBase base = new FddClientBase(fadadaProperties.getAppId(),fadadaProperties.getAppSecret(),fadadaProperties.getVersion(),fadadaProperties.getServeHost());
|
|
69
|
+ FddClientBase base = new FddClientBase(fadadaProperties.getAppId(),fadadaProperties.getAppSecret(),fadadaProperties.getVersion(),getFddServerHost(person.getMiniappId(),fadadaProperties.getServeHost()));
|
63
|
70
|
//小程序open——id为注册账号
|
64
|
71
|
String open_id = person.getMiniOpenid();
|
65
|
72
|
//account_type 1是个人注册
|
|
@@ -81,22 +88,23 @@ public class TaContractUserServiceImpl extends ServiceImpl<TaContractUserMapper,
|
81
|
88
|
newContractUser.setOrgId(CommConstant.STATUS_UNACCALIMED);
|
82
|
89
|
|
83
|
90
|
log.info("正在申请个人认证,客户编码是{}",jsonObject.getString("data"));
|
84
|
|
- GetPersonVerifyUrl personverify = new GetPersonVerifyUrl(fadadaProperties.getAppId(),fadadaProperties.getAppSecret(),fadadaProperties.getVersion(),fadadaProperties.getServeHost());
|
|
91
|
+ GetPersonVerifyUrl personverify = new GetPersonVerifyUrl(fadadaProperties.getAppId(),fadadaProperties.getAppSecret(),fadadaProperties.getVersion(),getFddServerHost(person.getMiniappId(),fadadaProperties.getServeHost()));
|
85
|
92
|
String customer_id = jsonObject.getString("data");
|
86
|
|
- String verifyed_way = "1";//三要素补充方案
|
|
93
|
+ //0:三要素标准方案; 1:三要素补充方案;
|
|
94
|
+ String verifyed_way = "0";
|
87
|
95
|
String page_modify = "1";
|
88
|
96
|
String notify_url = fadadaProperties.getCompanyNotify();
|
89
|
97
|
String return_url= "/onlineSelling/pages/raiseMoney/Certification?id=" + taRaiseRecord.getRaiseRecordId();
|
90
|
98
|
String customer_ident_type = "0";
|
91
|
99
|
String personResult = personverify.invokePersonVerifyUrl(customer_id,verifyed_way,
|
92
|
100
|
page_modify,notify_url,return_url,null,customer_ident_type,
|
93
|
|
- null,null,null,null,null);
|
|
101
|
+ null,null,null,"1",null);
|
94
|
102
|
|
95
|
103
|
String data = JSON.parseObject(personResult).getString("data");
|
96
|
104
|
if (null !=data){
|
97
|
105
|
String url = JSON.parseObject(data).getString("url");
|
98
|
106
|
url = decode(url);
|
99
|
|
- newContractUser.setCertifiedAddress(url);
|
|
107
|
+ newContractUser.setCertifiedAddress(getFddServerHost(person.getMiniappId(),url));
|
100
|
108
|
newContractUser.setCertifiedSerialNumber(JSON.parseObject(data).getString("transactionNo"));
|
101
|
109
|
}
|
102
|
110
|
newContractUser.setStatus(0);
|
|
@@ -106,6 +114,19 @@ public class TaContractUserServiceImpl extends ServiceImpl<TaContractUserMapper,
|
106
|
114
|
return newContractUser;
|
107
|
115
|
}
|
108
|
116
|
|
|
117
|
+ /**
|
|
118
|
+ * 替换法大大服务器地址
|
|
119
|
+ * @return
|
|
120
|
+ */
|
|
121
|
+ private String getFddServerHost(String miniappId,String subUrl) {
|
|
122
|
+ TaMiniapp taMiniapp = taMiniappMapper.selectById(miniappId);
|
|
123
|
+ int index = subUrl.indexOf(File.separator);
|
|
124
|
+ int twoIndex = subUrl.indexOf(File.separator,index);
|
|
125
|
+ int threeIndex = subUrl.indexOf(File.separator,twoIndex);
|
|
126
|
+ String newUrl = StringUtils.isEmpty(taMiniapp.getFddServerHost()) ? subUrl : taMiniapp.getFddServerHost() + subUrl.substring(threeIndex);
|
|
127
|
+ return newUrl;
|
|
128
|
+ }
|
|
129
|
+
|
109
|
130
|
/**
|
110
|
131
|
* 去法大大处更新客户的状态
|
111
|
132
|
*
|
|
@@ -119,7 +140,7 @@ public class TaContractUserServiceImpl extends ServiceImpl<TaContractUserMapper,
|
119
|
140
|
queryWrapper.eq("mini_openid",person.getMiniOpenid());
|
120
|
141
|
TaContractUser taContractUser = taContractUserMapper.selectOne(queryWrapper);
|
121
|
142
|
log.info("个人正在从法大大获取最新数据,企业编号是 {}", taContractUser.getFadadaCode());
|
122
|
|
- FindCertInfo personCertInfo = new FindCertInfo(fadadaProperties.getAppId(),fadadaProperties.getAppSecret(),fadadaProperties.getVersion(),fadadaProperties.getServeHost());
|
|
143
|
+ FindCertInfo personCertInfo = new FindCertInfo(fadadaProperties.getAppId(),fadadaProperties.getAppSecret(),fadadaProperties.getVersion(),getFddServerHost(person.getMiniappId(),fadadaProperties.getServeHost()));
|
123
|
144
|
String verified_serialno = taContractUser.getCertifiedSerialNumber();
|
124
|
145
|
String result = personCertInfo.invokeFindPersonCert(verified_serialno,
|
125
|
146
|
"1");
|