Browse Source

Merge branch 'dev' of http://git.ycjcjy.com/zhiyuxing/estateagents into dev

魏超 5 years ago
parent
commit
a0b165e29c

+ 22
- 3
src/main/java/com/huiju/estateagents/eContract/service/impl/TaCompanyServiceImpl.java View File

20
 import com.huiju.estateagents.eContract.mapper.TaContractMapper;
20
 import com.huiju.estateagents.eContract.mapper.TaContractMapper;
21
 import com.huiju.estateagents.eContract.service.ITaCompanyService;
21
 import com.huiju.estateagents.eContract.service.ITaCompanyService;
22
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
22
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
23
+import com.huiju.estateagents.entity.TaMiniapp;
24
+import com.huiju.estateagents.mapper.TaMiniappMapper;
23
 import com.huiju.estateagents.sample.entity.TaContact;
25
 import com.huiju.estateagents.sample.entity.TaContact;
24
 import com.huiju.estateagents.sample.mapper.TaContactMapper;
26
 import com.huiju.estateagents.sample.mapper.TaContactMapper;
25
 import jodd.util.URLDecoder;
27
 import jodd.util.URLDecoder;
28
 import org.springframework.beans.factory.annotation.Autowired;
30
 import org.springframework.beans.factory.annotation.Autowired;
29
 import org.springframework.stereotype.Service;
31
 import org.springframework.stereotype.Service;
30
 
32
 
33
+import java.io.File;
31
 import java.time.LocalDateTime;
34
 import java.time.LocalDateTime;
32
 import java.time.format.DateTimeFormatter;
35
 import java.time.format.DateTimeFormatter;
33
 
36
 
55
     @Autowired
58
     @Autowired
56
     private TaCompanySealUtil taCompanySealUtil;
59
     private TaCompanySealUtil taCompanySealUtil;
57
 
60
 
61
+    @Autowired
62
+    private TaMiniappMapper taMiniappMapper;
63
+
58
     /**
64
     /**
59
      * 在法大大创建一个新的企业信息
65
      * 在法大大创建一个新的企业信息
60
      *
66
      *
64
     public TaCompany newFirstCompanyInfo() throws Exception {
70
     public TaCompany newFirstCompanyInfo() throws Exception {
65
         log.info("========法大大企业注册=======");
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
         String open_id = "CJ_" + HttpsUtil.getTimeStamp();
74
         String open_id = "CJ_" + HttpsUtil.getTimeStamp();
69
         String account_type = CommConstant.ACCOUNT_TYPE_COMPANY;
75
         String account_type = CommConstant.ACCOUNT_TYPE_COMPANY;
70
         String result =base.invokeregisterAccount(open_id,account_type);
76
         String result =base.invokeregisterAccount(open_id,account_type);
103
         }
109
         }
104
         log.info("正在申请企业认证,客户编码是{}",taCompany.getFadadaCode());
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
         String customer_id = taCompany.getFadadaCode();
114
         String customer_id = taCompany.getFadadaCode();
109
         /**
115
         /**
152
     public TaCompany updateCompanyInfoByFdd(Integer id) throws Exception {
158
     public TaCompany updateCompanyInfoByFdd(Integer id) throws Exception {
153
         TaCompany taCompany = taCompanyMapper.selectById(id);
159
         TaCompany taCompany = taCompanyMapper.selectById(id);
154
         log.info("企业正在从法大大获取最新数据,企业编号是 {}", taCompany.getFadadaCode());
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
         String verified_serialno = taCompany.getCertifiedSerialNumber();
162
         String verified_serialno = taCompany.getCertifiedSerialNumber();
157
         String result = personCertInfo.invokeFindPersonCert(verified_serialno, CommConstant.ACCOUNT_TYPE_COMPANY);
163
         String result = personCertInfo.invokeFindPersonCert(verified_serialno, CommConstant.ACCOUNT_TYPE_COMPANY);
158
         log.info("企业最新数据结果 {}",result);
164
         log.info("企业最新数据结果 {}",result);
238
         bizContent = new String(Base64.decodeBase64(bizContent.getBytes()));
244
         bizContent = new String(Base64.decodeBase64(bizContent.getBytes()));
239
         return bizContent;
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
 }