|
@@ -20,6 +20,8 @@ import com.huiju.estateagents.eContract.mapper.TaCompanyMapper;
|
20
|
20
|
import com.huiju.estateagents.eContract.mapper.TaContractMapper;
|
21
|
21
|
import com.huiju.estateagents.eContract.service.ITaCompanyService;
|
22
|
22
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
23
|
+import com.huiju.estateagents.entity.TaMiniapp;
|
|
24
|
+import com.huiju.estateagents.mapper.TaMiniappMapper;
|
23
|
25
|
import com.huiju.estateagents.sample.entity.TaContact;
|
24
|
26
|
import com.huiju.estateagents.sample.mapper.TaContactMapper;
|
25
|
27
|
import jodd.util.URLDecoder;
|
|
@@ -28,6 +30,7 @@ import org.apache.commons.codec.binary.Base64;
|
28
|
30
|
import org.springframework.beans.factory.annotation.Autowired;
|
29
|
31
|
import org.springframework.stereotype.Service;
|
30
|
32
|
|
|
33
|
+import java.io.File;
|
31
|
34
|
import java.time.LocalDateTime;
|
32
|
35
|
import java.time.format.DateTimeFormatter;
|
33
|
36
|
|
|
@@ -55,6 +58,9 @@ public class TaCompanyServiceImpl extends ServiceImpl<TaCompanyMapper, TaCompany
|
55
|
58
|
@Autowired
|
56
|
59
|
private TaCompanySealUtil taCompanySealUtil;
|
57
|
60
|
|
|
61
|
+ @Autowired
|
|
62
|
+ private TaMiniappMapper taMiniappMapper;
|
|
63
|
+
|
58
|
64
|
/**
|
59
|
65
|
* 在法大大创建一个新的企业信息
|
60
|
66
|
*
|
|
@@ -64,7 +70,7 @@ public class TaCompanyServiceImpl extends ServiceImpl<TaCompanyMapper, TaCompany
|
64
|
70
|
public TaCompany newFirstCompanyInfo() throws Exception {
|
65
|
71
|
log.info("========法大大企业注册=======");
|
66
|
72
|
//在法大大注册企业用户
|
67
|
|
- FddClientBase base = new FddClientBase(fadadaProperties.getAppId(),fadadaProperties.getAppSecret(),fadadaProperties.getVersion(),fddServerHost);
|
|
73
|
+ FddClientBase base = new FddClientBase(fadadaProperties.getAppId(),fadadaProperties.getAppSecret(),fadadaProperties.getVersion(),fadadaProperties.getServeHost());
|
68
|
74
|
String open_id = "CJ_" + HttpsUtil.getTimeStamp();
|
69
|
75
|
String account_type = CommConstant.ACCOUNT_TYPE_COMPANY;
|
70
|
76
|
String result =base.invokeregisterAccount(open_id,account_type);
|
|
@@ -103,7 +109,7 @@ public class TaCompanyServiceImpl extends ServiceImpl<TaCompanyMapper, TaCompany
|
103
|
109
|
}
|
104
|
110
|
log.info("正在申请企业认证,客户编码是{}",taCompany.getFadadaCode());
|
105
|
111
|
//和法大大申请认证页面
|
106
|
|
- GetCompanyVerifyUrl comverify = new GetCompanyVerifyUrl(fadadaProperties.getAppId(),fadadaProperties.getAppSecret(),fadadaProperties.getVersion(),fddServerHost);
|
|
112
|
+ GetCompanyVerifyUrl comverify = new GetCompanyVerifyUrl(fadadaProperties.getAppId(),fadadaProperties.getAppSecret(),fadadaProperties.getVersion(),fadadaProperties.getServeHost());
|
107
|
113
|
//客户编号必填
|
108
|
114
|
String customer_id = taCompany.getFadadaCode();
|
109
|
115
|
/**
|
|
@@ -152,7 +158,7 @@ public class TaCompanyServiceImpl extends ServiceImpl<TaCompanyMapper, TaCompany
|
152
|
158
|
public TaCompany updateCompanyInfoByFdd(Integer id) throws Exception {
|
153
|
159
|
TaCompany taCompany = taCompanyMapper.selectById(id);
|
154
|
160
|
log.info("企业正在从法大大获取最新数据,企业编号是 {}", taCompany.getFadadaCode());
|
155
|
|
- FindCertInfo personCertInfo = new FindCertInfo(fadadaProperties.getAppId(),fadadaProperties.getAppSecret(),fadadaProperties.getVersion(),fddServerHost);
|
|
161
|
+ FindCertInfo personCertInfo = new FindCertInfo(fadadaProperties.getAppId(),fadadaProperties.getAppSecret(),fadadaProperties.getVersion(),fadadaProperties.getServeHost());
|
156
|
162
|
String verified_serialno = taCompany.getCertifiedSerialNumber();
|
157
|
163
|
String result = personCertInfo.invokeFindPersonCert(verified_serialno, CommConstant.ACCOUNT_TYPE_COMPANY);
|
158
|
164
|
log.info("企业最新数据结果 {}",result);
|
|
@@ -238,4 +244,17 @@ public class TaCompanyServiceImpl extends ServiceImpl<TaCompanyMapper, TaCompany
|
238
|
244
|
bizContent = new String(Base64.decodeBase64(bizContent.getBytes()));
|
239
|
245
|
return bizContent;
|
240
|
246
|
}
|
|
247
|
+
|
|
248
|
+ /**
|
|
249
|
+ * 替换法大大服务器地址
|
|
250
|
+ * @return
|
|
251
|
+ */
|
|
252
|
+ private String getFddServerHost(String miniappId,String subUrl) {
|
|
253
|
+ TaMiniapp taMiniapp = taMiniappMapper.selectById(miniappId);
|
|
254
|
+ int index = subUrl.indexOf(File.separator);
|
|
255
|
+ int twoIndex = subUrl.indexOf(File.separator,index);
|
|
256
|
+ int threeIndex = subUrl.indexOf(File.separator,twoIndex);
|
|
257
|
+ String newUrl = StringUtils.isEmpty(taMiniapp.getFddServerHost()) ? subUrl : taMiniapp.getFddServerHost() + subUrl.substring(threeIndex);
|
|
258
|
+ return newUrl;
|
|
259
|
+ }
|
241
|
260
|
}
|