|
@@ -2,6 +2,7 @@ package com.huiju.estateagents.eContract.controller;
|
2
|
2
|
|
3
|
3
|
import com.alibaba.fastjson.JSONArray;
|
4
|
4
|
import com.alibaba.fastjson.JSONObject;
|
|
5
|
+import com.baomidou.mybatisplus.core.conditions.query.Query;
|
5
|
6
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
6
|
7
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
7
|
8
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
@@ -10,11 +11,16 @@ import com.huiju.estateagents.base.ResponseBean;
|
10
|
11
|
import com.huiju.estateagents.common.CommConstant;
|
11
|
12
|
import com.huiju.estateagents.eContract.entity.TaCompanySeal;
|
12
|
13
|
import com.huiju.estateagents.eContract.entity.TaContract;
|
|
14
|
+import com.huiju.estateagents.eContract.service.ITaCompanySealService;
|
|
15
|
+import com.huiju.estateagents.config.FadadaProperties;
|
|
16
|
+import com.huiju.estateagents.eContract.service.ITaContractService;
|
13
|
17
|
import com.huiju.estateagents.eContract.entity.TaContractUser;
|
14
|
18
|
import com.huiju.estateagents.eContract.service.ITaCompanySealService;
|
15
|
19
|
import com.huiju.estateagents.config.FadadaProperties;
|
16
|
20
|
import com.huiju.estateagents.eContract.service.ITaContractUserService;
|
|
21
|
+import com.huiju.estateagents.entity.TaMiniapp;
|
17
|
22
|
import com.huiju.estateagents.sample.entity.TaH5Demand;
|
|
23
|
+import com.huiju.estateagents.service.impl.TaMiniappServiceImpl;
|
18
|
24
|
import org.apache.commons.lang3.StringUtils;
|
19
|
25
|
import org.slf4j.Logger;
|
20
|
26
|
import org.slf4j.LoggerFactory;
|
|
@@ -30,9 +36,13 @@ import com.huiju.estateagents.eContract.entity.TaCompany;
|
30
|
36
|
import org.springframework.web.bind.annotation.RestController;
|
31
|
37
|
|
32
|
38
|
import javax.servlet.http.HttpServletRequest;
|
|
39
|
+import javax.servlet.http.HttpServletResponse;
|
|
40
|
+import java.io.IOException;
|
|
41
|
+import java.io.PrintWriter;
|
33
|
42
|
import java.util.HashMap;
|
34
|
43
|
import java.util.List;
|
35
|
44
|
import java.util.Map;
|
|
45
|
+import java.util.ResourceBundle;
|
36
|
46
|
|
37
|
47
|
/**
|
38
|
48
|
* <p>
|
|
@@ -57,9 +67,16 @@ public class TaCompanyController extends BaseController {
|
57
|
67
|
@Autowired
|
58
|
68
|
private ITaCompanySealService iTaCompanySealService;
|
59
|
69
|
|
|
70
|
+ @Autowired
|
|
71
|
+ private ITaContractService iTaContractService;
|
|
72
|
+
|
60
|
73
|
@Autowired
|
61
|
74
|
public ITaContractUserService iTaContractUserService;
|
62
|
75
|
|
|
76
|
+ @Autowired
|
|
77
|
+ private TaMiniappServiceImpl taMiniappService;
|
|
78
|
+
|
|
79
|
+
|
63
|
80
|
/**
|
64
|
81
|
* 条件查询企业列表
|
65
|
82
|
*
|
|
@@ -82,7 +99,7 @@ public class TaCompanyController extends BaseController {
|
82
|
99
|
queryWrapper.like(StringUtils.isNotBlank(companyName), "company_name", companyName);
|
83
|
100
|
queryWrapper.like(StringUtils.isNotBlank(companyCode), "company_code", companyCode);
|
84
|
101
|
queryWrapper.eq(StringUtils.isNotBlank(certifiedStatus), "certified_status", certifiedStatus);
|
85
|
|
- queryWrapper.eq("status", CommConstant.STATUS_NORMAL);
|
|
102
|
+ queryWrapper.eq("status", 2);
|
86
|
103
|
queryWrapper.orderByDesc("create_date");
|
87
|
104
|
|
88
|
105
|
IPage<TaCompany> result = iTaCompanyService.page(pg, queryWrapper);
|
|
@@ -113,7 +130,7 @@ public class TaCompanyController extends BaseController {
|
113
|
130
|
QueryWrapper<TaCompany> queryWrapper = new QueryWrapper<>();
|
114
|
131
|
queryWrapper.like(StringUtils.isNotBlank(companyName), "company_name", companyName);
|
115
|
132
|
queryWrapper.like(StringUtils.isNotBlank(companyCode), "company_code", companyCode);
|
116
|
|
- queryWrapper.eq("status", CommConstant.STATUS_NORMAL);
|
|
133
|
+ queryWrapper.eq("status", CommConstant.REAL_NAME_STATUS);
|
117
|
134
|
queryWrapper.orderByDesc("create_date");
|
118
|
135
|
|
119
|
136
|
IPage<TaCompany> result = iTaCompanyService.page(pg, queryWrapper);
|
|
@@ -121,6 +138,7 @@ public class TaCompanyController extends BaseController {
|
121
|
138
|
for (TaCompany taCompany : taCompanyList){
|
122
|
139
|
QueryWrapper<TaCompanySeal> sealQueryWrapper = new QueryWrapper<>();
|
123
|
140
|
sealQueryWrapper.eq("company_id", taCompany.getCompanyId());
|
|
141
|
+ sealQueryWrapper.ne("status", CommConstant.STATUS_DELETE);
|
124
|
142
|
taCompany.setSealNum(iTaCompanySealService.count(sealQueryWrapper));
|
125
|
143
|
}
|
126
|
144
|
responseBean.addSuccess(result);
|
|
@@ -143,10 +161,10 @@ public class TaCompanyController extends BaseController {
|
143
|
161
|
@RequestMapping(value = "/channel/taCompanyList", method = RequestMethod.GET)
|
144
|
162
|
public ResponseBean channelCompanyList(@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
|
145
|
163
|
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
|
146
|
|
- @RequestParam(value = "companyName") String companyName,
|
147
|
|
- @RequestParam(value = "companyCode")String companyCode,
|
148
|
|
- @RequestParam(value = "certifiedStatus")String certifiedStatus,
|
149
|
|
- @RequestParam(value = "authorizeStatus")String authorizeStatus) {
|
|
164
|
+ @RequestParam(value = "companyName", required = false) String companyName,
|
|
165
|
+ @RequestParam(value = "companyCode", required = false)String companyCode,
|
|
166
|
+ @RequestParam(value = "status", required = false)String status,
|
|
167
|
+ @RequestParam(value = "authorizeStatus", required = false)String authorizeStatus) {
|
150
|
168
|
ResponseBean responseBean = new ResponseBean();
|
151
|
169
|
try {
|
152
|
170
|
//使用分页插件
|
|
@@ -154,9 +172,9 @@ public class TaCompanyController extends BaseController {
|
154
|
172
|
QueryWrapper<TaCompany> queryWrapper = new QueryWrapper<>();
|
155
|
173
|
queryWrapper.like(StringUtils.isNotBlank(companyName), "company_name", companyName);
|
156
|
174
|
queryWrapper.like(StringUtils.isNotBlank(companyCode), "company_code", companyCode);
|
157
|
|
- queryWrapper.eq(StringUtils.isNotBlank(certifiedStatus), "certified_status", certifiedStatus);
|
|
175
|
+ queryWrapper.eq(StringUtils.isNotBlank(status), "status", status);
|
158
|
176
|
queryWrapper.eq(StringUtils.isNotBlank(authorizeStatus), "authorize_status", authorizeStatus);
|
159
|
|
- queryWrapper.eq("status", CommConstant.STATUS_NORMAL);
|
|
177
|
+ queryWrapper.ne("status", CommConstant.STATUS_DELETE);
|
160
|
178
|
queryWrapper.orderByDesc("create_date");
|
161
|
179
|
|
162
|
180
|
IPage<TaCompany> result = iTaCompanyService.page(pg, queryWrapper);
|
|
@@ -164,6 +182,7 @@ public class TaCompanyController extends BaseController {
|
164
|
182
|
for (TaCompany taCompany : taCompanyList){
|
165
|
183
|
QueryWrapper<TaCompanySeal> sealQueryWrapper = new QueryWrapper<>();
|
166
|
184
|
sealQueryWrapper.eq("company_id", taCompany.getCompanyId());
|
|
185
|
+ sealQueryWrapper.ne("status", CommConstant.STATUS_DELETE);
|
167
|
186
|
taCompany.setSealNum(iTaCompanySealService.count(sealQueryWrapper));
|
168
|
187
|
}
|
169
|
188
|
responseBean.addSuccess(result);
|
|
@@ -255,7 +274,8 @@ public class TaCompanyController extends BaseController {
|
255
|
274
|
public ResponseBean taCompanyGet(@PathVariable Integer id) {
|
256
|
275
|
ResponseBean responseBean = new ResponseBean();
|
257
|
276
|
try {
|
258
|
|
- responseBean.addSuccess(iTaCompanyService.getById(id));
|
|
277
|
+ TaCompany taCompany = iTaCompanyService.getCompanyAndContractInfo(id);
|
|
278
|
+ responseBean.addSuccess(taCompany);
|
259
|
279
|
} catch (Exception e) {
|
260
|
280
|
e.printStackTrace();
|
261
|
281
|
logger.error("taCompanyDelete -=- {}", e.toString());
|
|
@@ -439,11 +459,55 @@ public class TaCompanyController extends BaseController {
|
439
|
459
|
}
|
440
|
460
|
}
|
441
|
461
|
|
|
462
|
+ /**
|
|
463
|
+ * 自动授权签章回调
|
|
464
|
+ */
|
|
465
|
+ @RequestMapping(value = "/fadd/autoAuthCompanySeal", method = RequestMethod.POST)
|
|
466
|
+ public void autoAuthCompanySealNotify(@RequestParam(value = "transaction_id",required = false) String transactionId,
|
|
467
|
+ @RequestParam(value = "contract_id",required = false) Integer contractId,
|
|
468
|
+ @RequestParam(value = "download_url",required = false) String downloadUrl,
|
|
469
|
+ @RequestParam(value = "viewpdf_url",required = false) String viewpdfUrl,
|
|
470
|
+ @RequestParam(value = "result_code",required = false) String resultCode,
|
|
471
|
+ @RequestParam(value = "result_desc",required = false) String resultDesc,
|
|
472
|
+ HttpServletRequest request){
|
|
473
|
+ TaContract taContract = new TaContract();
|
|
474
|
+ taContract.setContractId(contractId);
|
|
475
|
+ taContract.setContractDownloadUrl(downloadUrl);
|
|
476
|
+ taContract.setContractViewUrl(viewpdfUrl);
|
|
477
|
+ taContract.setStatus(CommConstant.STATUS_NORMAL);
|
|
478
|
+ iTaContractService.updateById(taContract);
|
|
479
|
+
|
|
480
|
+ if (CommConstant.AUTO_AUTH_STATUS.equals(resultCode) && CommConstant.AUTH_SUCCESS_DESC.equals(resultDesc)){
|
|
481
|
+ TaCompany taCompany = new TaCompany();
|
|
482
|
+ taCompany.setCompanyId(iTaContractService.getById(contractId).getCompanyId());
|
|
483
|
+ taCompany.setAuthorizeStatus(resultCode);
|
|
484
|
+ taCompany.setAuthorizeTransactionId(transactionId);
|
|
485
|
+ taCompany.setAuthorizeContractId(String.valueOf(contractId));
|
|
486
|
+ taCompany.setAuthorizeDownloadUrl(downloadUrl);
|
|
487
|
+ taCompany.setAuthorizeViewUrl(viewpdfUrl);
|
|
488
|
+ taCompany.setAuthorizeDescription(resultDesc);
|
|
489
|
+ taCompany.setAuthorizeType(CommConstant.ONLINEAUTH);
|
|
490
|
+ iTaCompanyService.updateById(taCompany);
|
|
491
|
+ }
|
|
492
|
+ }
|
|
493
|
+
|
442
|
494
|
/**
|
443
|
495
|
* 自动签章授权
|
444
|
496
|
*/
|
445
|
|
- public ResponseBean autoAuthCompanySeal(Integer companyId, HttpServletRequest request){
|
446
|
|
- return null;
|
|
497
|
+ @RequestMapping(value = "/channel/company/autoAuthCompany/{id}", method = RequestMethod.PUT)
|
|
498
|
+ public ResponseBean autoAuthCompanySeal(@PathVariable Integer id, HttpServletRequest request) throws Exception {
|
|
499
|
+ ResponseBean responseBean = new ResponseBean();
|
|
500
|
+ QueryWrapper<TaMiniapp> taMiniappQueryWrapper = new QueryWrapper<>();
|
|
501
|
+ taMiniappQueryWrapper.eq("org_id", getOrgId(request));
|
|
502
|
+ TaMiniapp taMiniapp = taMiniappService.getOne(taMiniappQueryWrapper);
|
|
503
|
+
|
|
504
|
+ String res = iTaCompanyService.autoAuthCompanySeal(id, getOrgId(request), taMiniapp.getMiniappId());
|
|
505
|
+ TaCompany taCompany = new TaCompany();
|
|
506
|
+ taCompany.setCompanyId(id);
|
|
507
|
+ taCompany.setAuthorizeAddress(res);
|
|
508
|
+ iTaCompanyService.updateById(taCompany);
|
|
509
|
+ responseBean.addSuccess((Object)res);
|
|
510
|
+ return responseBean;
|
447
|
511
|
}
|
448
|
512
|
|
449
|
513
|
|
|
@@ -451,7 +515,7 @@ public class TaCompanyController extends BaseController {
|
451
|
515
|
* 手动签署回调函数
|
452
|
516
|
*
|
453
|
517
|
*/
|
454
|
|
- @RequestMapping(value = "/fadd/sign", method = RequestMethod.POST)
|
|
518
|
+ @RequestMapping(value = "/fadd/sign", method = {RequestMethod.GET,RequestMethod.POST})
|
455
|
519
|
public void faddSignNotify(@RequestParam(value = "transaction_id ",required = false) String transaction_id,
|
456
|
520
|
@RequestParam(value = "contract_id ",required = false) String contract_id,
|
457
|
521
|
@RequestParam(value = "result_code",required = false) String result_code,
|
|
@@ -462,5 +526,32 @@ public class TaCompanyController extends BaseController {
|
462
|
526
|
@RequestParam(value = "msg_digest",required = false) String msg_digest,
|
463
|
527
|
HttpServletRequest request) {
|
464
|
528
|
logger.info("企业认证回调函数参数:交易号 {},合同编号 {},签章结果代码 {},签章结果描述 ,{}, 下载地址{}, 查看地址 {},请求时间 {}, 摘要 {} ",transaction_id,contract_id,result_code,result_desc,download_url,viewpdf_url,timestamp,msg_digest);
|
|
529
|
+ TaContract taContract = iTaContractService.getById(contract_id);
|
|
530
|
+ taContract.setContractDownloadUrl(download_url);
|
|
531
|
+ taContract.setContractViewUrl(viewpdf_url);
|
|
532
|
+ iTaContractService.updateById(taContract);
|
|
533
|
+ }
|
|
534
|
+
|
|
535
|
+ /**
|
|
536
|
+ * 查询授权状态接口
|
|
537
|
+ * @param id
|
|
538
|
+ * @return
|
|
539
|
+ */
|
|
540
|
+ @RequestMapping(value = "/channel/company/getAuthStatus/{id}", method = RequestMethod.GET)
|
|
541
|
+ public ResponseBean getAuthStatus(@PathVariable Integer id, HttpServletRequest request){
|
|
542
|
+ QueryWrapper<TaMiniapp> taMiniappQueryWrapper = new QueryWrapper<>();
|
|
543
|
+ taMiniappQueryWrapper.eq("org_id", getOrgId(request));
|
|
544
|
+ TaMiniapp taMiniapp = taMiniappService.getOne(taMiniappQueryWrapper);
|
|
545
|
+
|
|
546
|
+ ResponseBean responseBean = new ResponseBean();
|
|
547
|
+ String res = iTaCompanyService.getAuthStatus(id, taMiniapp.getMiniappId());
|
|
548
|
+ JSONObject result = JSONObject.parseObject(res);
|
|
549
|
+
|
|
550
|
+ if ((Integer) result.get("code") != 1){
|
|
551
|
+ responseBean.addError(result.getString("msg"));
|
|
552
|
+ return responseBean;
|
|
553
|
+ }
|
|
554
|
+ responseBean.addSuccess(result.get("data"));
|
|
555
|
+ return responseBean;
|
465
|
556
|
}
|
466
|
557
|
}
|