|
@@ -1,11 +1,20 @@
|
1
|
1
|
package com.huiju.estateagents.eContract.service.impl;
|
2
|
2
|
|
|
3
|
+import com.alibaba.fastjson.JSONObject;
|
|
4
|
+import com.fadada.sdk.client.FddClientBase;
|
|
5
|
+import com.fadada.sdk.util.http.HttpsUtil;
|
|
6
|
+import com.huiju.estateagents.common.CommConstant;
|
|
7
|
+import com.huiju.estateagents.config.FadadaProperties;
|
3
|
8
|
import com.huiju.estateagents.eContract.entity.TaCompany;
|
4
|
9
|
import com.huiju.estateagents.eContract.mapper.TaCompanyMapper;
|
5
|
10
|
import com.huiju.estateagents.eContract.service.ITaCompanyService;
|
6
|
11
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
12
|
+import lombok.extern.slf4j.Slf4j;
|
|
13
|
+import org.springframework.beans.factory.annotation.Autowired;
|
7
|
14
|
import org.springframework.stereotype.Service;
|
8
|
15
|
|
|
16
|
+import java.time.LocalDateTime;
|
|
17
|
+
|
9
|
18
|
/**
|
10
|
19
|
* <p>
|
11
|
20
|
* 企业认证表 服务实现类
|
|
@@ -14,7 +23,43 @@ import org.springframework.stereotype.Service;
|
14
|
23
|
* @author fxf
|
15
|
24
|
* @since 2020-03-26
|
16
|
25
|
*/
|
|
26
|
+@Slf4j
|
17
|
27
|
@Service
|
18
|
28
|
public class TaCompanyServiceImpl extends ServiceImpl<TaCompanyMapper, TaCompany> implements ITaCompanyService {
|
19
|
29
|
|
|
30
|
+ @Autowired
|
|
31
|
+ private FadadaProperties fadadaProperties;
|
|
32
|
+
|
|
33
|
+ @Autowired
|
|
34
|
+ private TaCompanyMapper taCompanyMapper;
|
|
35
|
+
|
|
36
|
+ /**
|
|
37
|
+ * 在法大大创建一个新的企业信息
|
|
38
|
+ *
|
|
39
|
+ * @return
|
|
40
|
+ */
|
|
41
|
+ @Override
|
|
42
|
+ public TaCompany newFirstCompanyInfo() throws Exception {
|
|
43
|
+ log.info("========法大大企业注册=======");
|
|
44
|
+ //在法大大注册企业用户
|
|
45
|
+ FddClientBase base = new FddClientBase(fadadaProperties.getAppId(),fadadaProperties.getAppSecret(),fadadaProperties.getVersion(),fadadaProperties.getServeHost());
|
|
46
|
+ String open_id = "CJ_" + HttpsUtil.getTimeStamp();
|
|
47
|
+ String account_type = CommConstant.ACCOUNT_TYPE_COMPANY;
|
|
48
|
+ String result =base.invokeregisterAccount(open_id,account_type);
|
|
49
|
+ log.info("法大大注册信息{}", result);
|
|
50
|
+ JSONObject jsonObject = JSONObject.parseObject(result);
|
|
51
|
+ if (jsonObject.getInteger("code") != 1){
|
|
52
|
+ throw new Exception(jsonObject.getString("msg"));
|
|
53
|
+ }
|
|
54
|
+
|
|
55
|
+ //插入企业数据表
|
|
56
|
+ TaCompany taCompany = new TaCompany();
|
|
57
|
+ taCompany.setCompanyCode(open_id);
|
|
58
|
+ taCompany.setFadadaCode(jsonObject.getString("data"));
|
|
59
|
+ taCompany.setCertifiedStatus(CommConstant.CERTIFIED_STATUS_REGISTERED);
|
|
60
|
+ taCompany.setCreateDate(LocalDateTime.now());
|
|
61
|
+ taCompany.setStatus(CommConstant.STATUS_NORMAL);
|
|
62
|
+ taCompanyMapper.insert(taCompany);
|
|
63
|
+ return taCompany;
|
|
64
|
+ }
|
20
|
65
|
}
|