|
@@ -1,18 +1,25 @@
|
1
|
1
|
package com.huiju.estateagents.eContract.controller;
|
2
|
2
|
|
|
3
|
+import com.alibaba.fastjson.JSONObject;
|
3
|
4
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
4
|
5
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
5
|
6
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
6
|
7
|
import com.huiju.estateagents.base.BaseController;
|
7
|
8
|
import com.huiju.estateagents.base.ResponseBean;
|
|
9
|
+import com.huiju.estateagents.common.CommConstant;
|
8
|
10
|
import com.huiju.estateagents.common.StringUtils;
|
|
11
|
+import com.huiju.estateagents.eContract.entity.TaCompany;
|
9
|
12
|
import com.huiju.estateagents.eContract.entity.TaCompanySeal;
|
10
|
13
|
import com.huiju.estateagents.eContract.service.ITaCompanySealService;
|
|
14
|
+import com.huiju.estateagents.eContract.service.ITaCompanyService;
|
|
15
|
+import com.huiju.estateagents.eContract.service.impl.TaCompanySealUtil;
|
11
|
16
|
import org.slf4j.Logger;
|
12
|
17
|
import org.slf4j.LoggerFactory;
|
13
|
18
|
import org.springframework.beans.factory.annotation.Autowired;
|
14
|
19
|
import org.springframework.web.bind.annotation.*;
|
15
|
20
|
|
|
21
|
+import java.time.LocalDateTime;
|
|
22
|
+
|
16
|
23
|
/**
|
17
|
24
|
* <p>
|
18
|
25
|
* 公司印章 前端控制器
|
|
@@ -30,6 +37,11 @@ public class TaCompanySealController extends BaseController {
|
30
|
37
|
@Autowired
|
31
|
38
|
public ITaCompanySealService iTaCompanySealService;
|
32
|
39
|
|
|
40
|
+ @Autowired
|
|
41
|
+ private ITaCompanyService iTaCompanyService;
|
|
42
|
+
|
|
43
|
+ @Autowired
|
|
44
|
+ private TaCompanySealUtil taCompanySealUtil;
|
33
|
45
|
|
34
|
46
|
/**
|
35
|
47
|
* 分页查询列表
|
|
@@ -59,15 +71,57 @@ public class TaCompanySealController extends BaseController {
|
59
|
71
|
return responseBean;
|
60
|
72
|
}
|
61
|
73
|
|
|
74
|
+ /**
|
|
75
|
+ * 分页查询列表
|
|
76
|
+ * @param pageNum
|
|
77
|
+ * @param pageSize
|
|
78
|
+ * @return
|
|
79
|
+ */
|
|
80
|
+ @RequestMapping(value="/channel/taCompanySeal",method= RequestMethod.GET)
|
|
81
|
+ public ResponseBean channelCompanySealList(
|
|
82
|
+ @RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
|
|
83
|
+ @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize,
|
|
84
|
+ @RequestParam(value ="companyId", required = false) String companyId,
|
|
85
|
+ @RequestParam(value ="sealName", required = false) String sealName){
|
|
86
|
+ ResponseBean responseBean = new ResponseBean();
|
|
87
|
+ try {
|
|
88
|
+ //使用分页插件
|
|
89
|
+ IPage<TaCompanySeal> pg = new Page<>(pageNum, pageSize);
|
|
90
|
+ QueryWrapper<TaCompanySeal> queryWrapper = new QueryWrapper<>();
|
|
91
|
+ queryWrapper.eq("company_id", companyId);
|
|
92
|
+ queryWrapper.like(!StringUtils.isEmpty(sealName), "seal_name", sealName);
|
|
93
|
+ queryWrapper.orderByDesc("create_date");
|
|
94
|
+
|
|
95
|
+ IPage<TaCompanySeal> result = iTaCompanySealService.page(pg, queryWrapper);
|
|
96
|
+ responseBean.addSuccess(result);
|
|
97
|
+ }catch (Exception e){
|
|
98
|
+ e.printStackTrace();
|
|
99
|
+ logger.error("taCompanySealList -=- {}",e.toString());
|
|
100
|
+ responseBean.addError(e.getMessage());
|
|
101
|
+ }
|
|
102
|
+ return responseBean;
|
|
103
|
+ }
|
|
104
|
+
|
62
|
105
|
/**
|
63
|
106
|
* 保存对象
|
64
|
107
|
* @param taCompanySeal 实体对象
|
65
|
108
|
* @return
|
66
|
109
|
*/
|
67
|
|
- @RequestMapping(value="/taCompanySeal",method= RequestMethod.POST)
|
|
110
|
+ @RequestMapping(value="/channel/taCompanySeal",method= RequestMethod.POST)
|
68
|
111
|
public ResponseBean taCompanySealAdd(@RequestBody TaCompanySeal taCompanySeal){
|
69
|
112
|
ResponseBean responseBean = new ResponseBean();
|
70
|
113
|
try {
|
|
114
|
+ TaCompany taCompany = iTaCompanyService.getById(taCompanySeal.getCompanyId());
|
|
115
|
+ String result = taCompanySealUtil.addSignaTrue(taCompany.getFadadaCode(), taCompanySeal.getSealImg());
|
|
116
|
+ JSONObject params = JSONObject.parseObject(result);
|
|
117
|
+ if (!String.valueOf(CommConstant.STATUS_NORMAL).equals(params.get("code"))){
|
|
118
|
+ responseBean.addError(params.get("msg").toString());
|
|
119
|
+ return responseBean;
|
|
120
|
+ }
|
|
121
|
+
|
|
122
|
+ String data = params.getString("data");
|
|
123
|
+ taCompanySeal.setCreateDate(LocalDateTime.now());
|
|
124
|
+ taCompanySeal.setStatus(CommConstant.STATUS_NORMAL);
|
71
|
125
|
if (iTaCompanySealService.save(taCompanySeal)){
|
72
|
126
|
responseBean.addSuccess(taCompanySeal);
|
73
|
127
|
}else {
|