|
@@ -3,6 +3,9 @@ package com.huiju.estateagents.controller;
|
3
|
3
|
|
4
|
4
|
import com.huiju.estateagents.base.ResponseBean;
|
5
|
5
|
import com.huiju.estateagents.common.JWTUtils;
|
|
6
|
+import com.huiju.estateagents.entity.TaPerson;
|
|
7
|
+import com.huiju.estateagents.entity.TaRecommendCustomer;
|
|
8
|
+import com.huiju.estateagents.service.ITaPersonService;
|
6
|
9
|
import com.huiju.estateagents.service.ITaRecommendCustomerService;
|
7
|
10
|
import org.springframework.beans.factory.annotation.Autowired;
|
8
|
11
|
import org.springframework.web.bind.annotation.*;
|
|
@@ -10,6 +13,7 @@ import org.springframework.web.bind.annotation.*;
|
10
|
13
|
import com.huiju.estateagents.base.BaseController;
|
11
|
14
|
|
12
|
15
|
import javax.servlet.http.HttpServletRequest;
|
|
16
|
+import java.util.List;
|
13
|
17
|
|
14
|
18
|
/**
|
15
|
19
|
* <p>
|
|
@@ -25,6 +29,8 @@ public class TaRecommendCustomerController extends BaseController {
|
25
|
29
|
|
26
|
30
|
@Autowired
|
27
|
31
|
ITaRecommendCustomerService taRecommendCustomerService;
|
|
32
|
+ @Autowired
|
|
33
|
+ ITaPersonService taPersonService;
|
28
|
34
|
|
29
|
35
|
/**
|
30
|
36
|
* 我的客户列表
|
|
@@ -79,4 +85,118 @@ public class TaRecommendCustomerController extends BaseController {
|
79
|
85
|
String openid = JWTUtils.getSubject(request);
|
80
|
86
|
return taRecommendCustomerService.recommendCust(paramStr, openid);
|
81
|
87
|
}
|
|
88
|
+
|
|
89
|
+ @PostMapping("/wx/customer/recommend")
|
|
90
|
+ public ResponseBean getUnSignedCustomerList (@RequestParam int pageNumber, @RequestParam int pageSize,HttpServletRequest request){
|
|
91
|
+ ResponseBean responseBean = new ResponseBean();
|
|
92
|
+ String openid = JWTUtils.getSubject(request);
|
|
93
|
+ List<TaPerson> taPersons = taPersonService.getPersonsByOpenId(openid);
|
|
94
|
+ if (null == taPersons || taPersons.size() != 1) {
|
|
95
|
+ return ResponseBean.error("验证人员信息失败", ResponseBean.ERROR_UNAVAILABLE);
|
|
96
|
+ }
|
|
97
|
+ TaPerson person = taPersons.get(0);
|
|
98
|
+ String buildingId = "";
|
|
99
|
+ try{
|
|
100
|
+ responseBean.success(taRecommendCustomerService.getUnSignedCustomerList(pageNumber,pageSize,buildingId,person.getPersonId()));
|
|
101
|
+ }catch (Exception e){
|
|
102
|
+ e.printStackTrace();
|
|
103
|
+ responseBean.error(e.getMessage(),ResponseBean.ERROR_UNAVAILABLE);
|
|
104
|
+ }
|
|
105
|
+ return responseBean;
|
|
106
|
+ }
|
|
107
|
+
|
|
108
|
+ @PostMapping("/customer/recommend")
|
|
109
|
+ public ResponseBean getCustomerList (@RequestParam int pageNumber, @RequestParam int pageSize){
|
|
110
|
+ ResponseBean responseBean = new ResponseBean();
|
|
111
|
+ try{
|
|
112
|
+ String buildingId="";
|
|
113
|
+ responseBean.success(taRecommendCustomerService.getCustomerList(pageNumber,pageSize,buildingId));
|
|
114
|
+ }catch (Exception e){
|
|
115
|
+ e.printStackTrace();
|
|
116
|
+ responseBean.error(e.getMessage(),ResponseBean.ERROR_UNAVAILABLE);
|
|
117
|
+ }
|
|
118
|
+ return responseBean;
|
|
119
|
+ }
|
|
120
|
+
|
|
121
|
+ @PostMapping("/customer/recommend/{customerId}")
|
|
122
|
+ public ResponseBean getCustomersIRecommended (@RequestParam int pageNumber, @RequestParam int pageSize,String customerId){
|
|
123
|
+ ResponseBean responseBean = new ResponseBean();
|
|
124
|
+ String buildingId="";
|
|
125
|
+ try{
|
|
126
|
+ responseBean.success(taRecommendCustomerService.getCustomersIRecommended(pageNumber,pageSize,customerId,buildingId));
|
|
127
|
+ }catch (Exception e){
|
|
128
|
+ e.printStackTrace();
|
|
129
|
+ responseBean.error(e.getMessage(),ResponseBean.ERROR_UNAVAILABLE);
|
|
130
|
+ }
|
|
131
|
+ return responseBean;
|
|
132
|
+ }
|
|
133
|
+
|
|
134
|
+ /**
|
|
135
|
+ * 修改对象
|
|
136
|
+ * @param taRecommendCustomer 实体对象
|
|
137
|
+ * @return
|
|
138
|
+ */
|
|
139
|
+ @RequestMapping(value="/wx/customer/recommend/edit/{id}",method= RequestMethod.PUT)
|
|
140
|
+ public ResponseBean taRecommendCustomerUpdateWx(@PathVariable String id,
|
|
141
|
+ @RequestBody TaRecommendCustomer taRecommendCustomer){
|
|
142
|
+ ResponseBean responseBean = new ResponseBean();
|
|
143
|
+ taRecommendCustomer.setCustomerId(id);
|
|
144
|
+ try {
|
|
145
|
+ if (taRecommendCustomerService.updateById(taRecommendCustomer)){
|
|
146
|
+ responseBean.addSuccess(taRecommendCustomer);
|
|
147
|
+ }else {
|
|
148
|
+ responseBean.addError("fail");
|
|
149
|
+ }
|
|
150
|
+ }catch (Exception e){
|
|
151
|
+ e.printStackTrace();
|
|
152
|
+ responseBean.addError(e.getMessage());
|
|
153
|
+ }
|
|
154
|
+ return responseBean;
|
|
155
|
+ }
|
|
156
|
+ /**
|
|
157
|
+ * 修改对象
|
|
158
|
+ * @param taRecommendCustomer 实体对象
|
|
159
|
+ * @return
|
|
160
|
+ */
|
|
161
|
+ @RequestMapping(value="/customer/recommend/edit/{id}",method= RequestMethod.PUT)
|
|
162
|
+ public ResponseBean taRecommendCustomerUpdate(@PathVariable String id,
|
|
163
|
+ @RequestBody TaRecommendCustomer taRecommendCustomer){
|
|
164
|
+ ResponseBean responseBean = new ResponseBean();
|
|
165
|
+ taRecommendCustomer.setCustomerId(id);
|
|
166
|
+ try {
|
|
167
|
+ if (taRecommendCustomerService.updateById(taRecommendCustomer)){
|
|
168
|
+ responseBean.addSuccess(taRecommendCustomer);
|
|
169
|
+ }else {
|
|
170
|
+ responseBean.addError("fail");
|
|
171
|
+ }
|
|
172
|
+ }catch (Exception e){
|
|
173
|
+ e.printStackTrace();
|
|
174
|
+ responseBean.addError(e.getMessage());
|
|
175
|
+ }
|
|
176
|
+ return responseBean;
|
|
177
|
+ }
|
|
178
|
+
|
|
179
|
+ @RequestMapping(value = "/wx/customer/recommend/get/{id}")
|
|
180
|
+ public ResponseBean getSingleCustomer(String customerId) {
|
|
181
|
+ ResponseBean responseBean = new ResponseBean();
|
|
182
|
+ try {
|
|
183
|
+ responseBean.addSuccess(taRecommendCustomerService.getById(customerId));
|
|
184
|
+ }catch (Exception e){
|
|
185
|
+ e.printStackTrace();
|
|
186
|
+ responseBean.addError(e.getMessage());
|
|
187
|
+ }
|
|
188
|
+ return responseBean;
|
|
189
|
+ }
|
|
190
|
+
|
|
191
|
+ @RequestMapping(value = "/customer/recommend/get/{id}")
|
|
192
|
+ public ResponseBean getCutomerDetail(String id) {
|
|
193
|
+ ResponseBean responseBean = new ResponseBean();
|
|
194
|
+ try {
|
|
195
|
+ responseBean.addSuccess(taRecommendCustomerService.getCustomerDetail(id));
|
|
196
|
+ }catch (Exception e){
|
|
197
|
+ e.printStackTrace();
|
|
198
|
+ responseBean.addError(e.getMessage());
|
|
199
|
+ }
|
|
200
|
+ return responseBean;
|
|
201
|
+ }
|
82
|
202
|
}
|