|
@@ -5,6 +5,8 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
5
|
5
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
6
|
6
|
import com.huiju.estateagents.base.BaseController;
|
7
|
7
|
import com.huiju.estateagents.base.ResponseBean;
|
|
8
|
+import com.huiju.estateagents.entity.TaPerson;
|
|
9
|
+import com.huiju.estateagents.service.ITaPersonService;
|
8
|
10
|
import com.huiju.estateagents.statistic.entity.TaCustomerFollowUpRecord;
|
9
|
11
|
import com.huiju.estateagents.statistic.service.ITaCustomerFollowUpRecordService;
|
10
|
12
|
import org.slf4j.Logger;
|
|
@@ -18,6 +20,9 @@ import org.springframework.web.bind.annotation.RequestParam;
|
18
|
20
|
import org.springframework.web.bind.annotation.ResponseBody;
|
19
|
21
|
import org.springframework.web.bind.annotation.RestController;
|
20
|
22
|
|
|
23
|
+import javax.servlet.http.HttpServletRequest;
|
|
24
|
+import java.util.List;
|
|
25
|
+
|
21
|
26
|
/**
|
22
|
27
|
* <p>
|
23
|
28
|
* 跟进记录表 小程序盘客工具我的客户跟进记录信息 前端控制器
|
|
@@ -27,14 +32,16 @@ import org.springframework.web.bind.annotation.RestController;
|
27
|
32
|
* @since 2019-11-08
|
28
|
33
|
*/
|
29
|
34
|
@RestController
|
30
|
|
-@RequestMapping("/")
|
|
35
|
+@RequestMapping("/api")
|
31
|
36
|
public class TaCustomerFollowUpRecordController extends BaseController {
|
32
|
37
|
|
33
|
38
|
private final Logger logger = LoggerFactory.getLogger(TaCustomerFollowUpRecordController.class);
|
34
|
39
|
|
35
|
40
|
@Autowired
|
36
|
41
|
public ITaCustomerFollowUpRecordService iTaCustomerFollowUpRecordService;
|
37
|
|
-
|
|
42
|
+
|
|
43
|
+ @Autowired
|
|
44
|
+ private ITaPersonService taPersonService;
|
38
|
45
|
|
39
|
46
|
/**
|
40
|
47
|
* 分页查询列表
|
|
@@ -146,4 +153,72 @@ public class TaCustomerFollowUpRecordController extends BaseController {
|
146
|
153
|
}
|
147
|
154
|
return responseBean;
|
148
|
155
|
}
|
|
156
|
+
|
|
157
|
+ /**
|
|
158
|
+ * 盘客工具添加跟进记录
|
|
159
|
+ * @param taCustomerFollowUpRecord 实体对象
|
|
160
|
+ * @return
|
|
161
|
+ */
|
|
162
|
+ @RequestMapping(value="/wx/taCustomerFollowUpRecord",method= RequestMethod.POST)
|
|
163
|
+ public ResponseBean wxCustomerFollowUpRecordAdd(@RequestBody TaCustomerFollowUpRecord taCustomerFollowUpRecord, HttpServletRequest request){
|
|
164
|
+ ResponseBean responseBean = new ResponseBean();
|
|
165
|
+ String openid = getOpenId(request);
|
|
166
|
+ Integer orgId = getOrgId(request);
|
|
167
|
+ List<TaPerson> taPersons = taPersonService.getPersonsByOpenId(openid);
|
|
168
|
+ if (null == taPersons || taPersons.size() != 1) {
|
|
169
|
+ return ResponseBean.error("验证人员信息失败", ResponseBean.ERROR_UNAVAILABLE);
|
|
170
|
+ }
|
|
171
|
+ TaPerson person = taPersons.get(0);
|
|
172
|
+ try {
|
|
173
|
+ taCustomerFollowUpRecord.setFollowerId(person.getPersonId());
|
|
174
|
+ if (iTaCustomerFollowUpRecordService.save(taCustomerFollowUpRecord)){
|
|
175
|
+ responseBean.addSuccess(taCustomerFollowUpRecord);
|
|
176
|
+ }else {
|
|
177
|
+ responseBean.addError("fail");
|
|
178
|
+ }
|
|
179
|
+ }catch (Exception e){
|
|
180
|
+ e.printStackTrace();
|
|
181
|
+ logger.error("taCustomerFollowUpRecordAdd -=- {}",e.toString());
|
|
182
|
+ responseBean.addError(e.getMessage());
|
|
183
|
+ }
|
|
184
|
+ return responseBean;
|
|
185
|
+ }
|
|
186
|
+
|
|
187
|
+ /**
|
|
188
|
+ * 分页查询跟进记录列表
|
|
189
|
+ * @param pageNum
|
|
190
|
+ * @param pageSize
|
|
191
|
+ * @return
|
|
192
|
+ */
|
|
193
|
+ @RequestMapping(value="/wx/taCustomerFollowUpRecord",method= RequestMethod.GET)
|
|
194
|
+ public ResponseBean wxCustomerFollowUpRecordList(@RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
|
|
195
|
+ @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize,
|
|
196
|
+ @RequestParam(value ="customerId",required = true) Integer customerId,
|
|
197
|
+ HttpServletRequest request){
|
|
198
|
+ ResponseBean responseBean = new ResponseBean();
|
|
199
|
+ String openid = getOpenId(request);
|
|
200
|
+ Integer orgId = getOrgId(request);
|
|
201
|
+ List<TaPerson> taPersons = taPersonService.getPersonsByOpenId(openid);
|
|
202
|
+ if (null == taPersons || taPersons.size() != 1) {
|
|
203
|
+ return ResponseBean.error("验证人员信息失败", ResponseBean.ERROR_UNAVAILABLE);
|
|
204
|
+ }
|
|
205
|
+ TaPerson person = taPersons.get(0);
|
|
206
|
+ try {
|
|
207
|
+ //使用分页插件
|
|
208
|
+ IPage<TaCustomerFollowUpRecord> pg = new Page<>(pageNum, pageSize);
|
|
209
|
+ QueryWrapper<TaCustomerFollowUpRecord> queryWrapper = new QueryWrapper<>();
|
|
210
|
+ queryWrapper.eq("follower_id",person.getPersonId());
|
|
211
|
+ queryWrapper.eq("org_id",orgId);
|
|
212
|
+ queryWrapper.eq("customer_id",customerId);
|
|
213
|
+ queryWrapper.orderByDesc("create_date");
|
|
214
|
+
|
|
215
|
+ IPage<TaCustomerFollowUpRecord> result = iTaCustomerFollowUpRecordService.page(pg, queryWrapper);
|
|
216
|
+ responseBean.addSuccess(result);
|
|
217
|
+ }catch (Exception e){
|
|
218
|
+ e.printStackTrace();
|
|
219
|
+ logger.error("taCustomerFollowUpRecordList -=- {}",e.toString());
|
|
220
|
+ responseBean.addError(e.getMessage());
|
|
221
|
+ }
|
|
222
|
+ return responseBean;
|
|
223
|
+ }
|
149
|
224
|
}
|